#include <clipext.h>
Inheritance diagram for OpClipboardImport:
Public Member Functions | |
virtual void | DoWithParam (OpDescriptor *, OpParam *pOpParam) |
Imports data from the Windows clipboard into the InternalClipboard document. When it is done, you can tell if it succeeded by checking InternalClipboard::IsEmpty(FALSE);. | |
virtual void | Do (OpDescriptor *pOpDesc) |
Saves the Current Doc as the default document. | |
Static Public Member Functions | |
static BOOL | Init () |
Registers our OpDescriptor. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
Yet another empty OpState function. |
Definition at line 366 of file clipext.h.
|
Saves the Current Doc as the default document.
Reimplemented from Operation. Definition at line 2128 of file clipext.cpp. 02129 { 02130 ERROR3("Don't invoke OpClipboardImport with Do. I don't like it"); 02131 }
|
|
Imports data from the Windows clipboard into the InternalClipboard document. When it is done, you can tell if it succeeded by checking InternalClipboard::IsEmpty(FALSE);.
Reimplemented from Operation. Definition at line 2041 of file clipext.cpp. 02042 { 02043 // Remember the selected doc, in case it gets changed later on in the function 02044 Document* pSelDoc = Document::GetSelected(); 02045 02046 if (!ExternalClipboard::GetOwnerWindow()->OpenClipboard()) 02047 { 02048 ERROR3("Couldn't open the clipboard"); 02049 End(); 02050 return; 02051 } 02052 02053 InternalClipboard *ClipboardDoc = InternalClipboard::Instance(); 02054 ClipboardMapping *Mapping = (ClipboardMapping*) pOpParam->Param1; 02055 02056 #if (_OLE_VER >= 0x200) 02057 02058 // If Param2 is not NULL then it is an HGLOBAL extracted from a COleDataObject, in 02059 // ExternalClipboard::PrepareForOlePaste. If it is NULL then we have been called 02060 // from PrepareForPaste and we must extract the handle from the Windows clipboard. 02061 HANDLE hClipData = (HANDLE) (HGLOBAL) pOpParam->Param2; 02062 if (!hClipData) hClipData = ::GetClipboardData(Mapping->RealExternalType); 02063 02064 #else 02065 02066 HANDLE hClipData = ::GetClipboardData(Mapping->RealExternalType); 02067 02068 #endif 02069 02070 // Ensure we put any undo information into the clipboard document, not the selected doc! 02071 pOurDoc = ClipboardDoc; 02072 02073 // Get a new view for use during the import 02074 View* OldView = View::GetCurrent(); 02075 ClipboardView *View = new ClipboardView; 02076 if (View == NULL || !View->Init()) 02077 { 02078 // We failed. Set the data to NULL, and we can drop through the rest of the 02079 // function safely to exit. 02080 hClipData = NULL; 02081 if (View != NULL) 02082 delete View; 02083 } 02084 02085 if (hClipData != NULL) 02086 { 02087 pOurView = View; // Make sure we're using a safe view pointer during import 02088 02089 View->SetCurrent(); 02090 Camelot.UpdateSelection(); 02091 02092 // Import the data onto the Internal Clipboard 02093 Mapping->HandleImport(this, hClipData, ClipboardDoc); 02094 02095 pOurView = NULL; // For safety, as View is about to be deleted 02096 02097 // And restore the previous view 02098 if (OldView != NULL) 02099 OldView->SetCurrent(); 02100 delete View; 02101 } 02102 02103 // Close the windows clipboard 02104 ::CloseClipboard(); 02105 02106 // Restore the selected doc on entry as the selected & current doc 02107 Document::SetSelectedViewAndSpread(pSelDoc); 02108 pSelDoc->SetCurrent(); // This extra call is needed if the doc has no doc views (i.e. it's a clipboard) 02109 02110 // Finished the operation 02111 End(); 02112 }
|
|
Yet another empty OpState function.
Definition at line 2171 of file clipext.cpp. 02172 { 02173 OpState Bob; 02174 return Bob; 02175 }
|
|
Registers our OpDescriptor.
Reimplemented from SimpleCCObject. Definition at line 2148 of file clipext.cpp. 02149 { 02150 return (RegisterOpDescriptor( 02151 0, 02152 _R(IDS_CLIPBOARD_OPIMPORT), 02153 CC_RUNTIME_CLASS(OpClipboardImport), 02154 OPTOKEN_CLIPBOARDIMPORT, 02155 OpClipboardImport::GetState 02156 )); 02157 }
|