#include <metafilt.h>
Inheritance diagram for MetaFileClipMap:
Static Public Member Functions | |
static void | CreateAndRegister (ClipboardMappingType TheType, Filter *TheFilter, InternalClipboardFormat &InternalDataType, UINT32 ExternalDataType, UINT32 Priority) |
Constructs and registers a clipboard mapping with the ExternalClipboard manager. This mapping info describes a filter which is able to import data from or export data to a windows clipboard in some way. | |
Protected Member Functions | |
MetaFileClipMap () | |
MetaFileClipMap (ClipboardMappingType TheType, Filter *TheFilter, InternalClipboardFormat &InternalDataType, UINT32 ExternalDataType, UINT32 Priority) | |
Constructs a clipboard mapping with the ExternalClipboard manager. This mapping info describes a filter which is able to import data from or export data to a windows clipboard in some way. | |
virtual BOOL | HandleImport (SelOperation *Caller, HANDLE ClipboardData, InternalClipboard *Dest) |
Calls the parent filter as appropriate to import the given data from the external clipboard. | |
virtual HANDLE | HandleExport (Operation *Caller, InternalClipboard *Source) |
Invokes this mapping for exporting This takes the document tree of Source, and exports it to the external (windows) clipboard. Usually this just involves calling Filter::DoExport for the parent filter, and then returning the handle to the global memory block to be placed onto the external clipboard. | |
Friends | |
class | ExternalClipboard |
class | OpClipboardExport |
class | OpClipboardImport |
Definition at line 162 of file metafilt.h.
|
Definition at line 171 of file metafilt.h.
|
|
Constructs a clipboard mapping with the ExternalClipboard manager. This mapping info describes a filter which is able to import data from or export data to a windows clipboard in some way.
TheInternalDatatType - An object defining the internal data type (see cliptype.h) TheExternalDataType - A Windows CF_ constant defining the external clipboard data type which will be imported/exported. ThePriority - An integer indicating the priority of this mapping. The highest available priority mapping will be used in order to retain as much information in the data as possible. See docs.doc for details of the existing mappings. Notes: DON'T call the constructor - call CreateAndRegister
Definition at line 773 of file metafilt.cpp. 00777 : ClipboardMapping(TheType, TheFilter, TheInternalDataType, 00778 TheExternalDataType, ThePriority) 00779 { 00780 }
|
|
Constructs and registers a clipboard mapping with the ExternalClipboard manager. This mapping info describes a filter which is able to import data from or export data to a windows clipboard in some way.
TheInternalDatatType - An object defining the internal data type (see cliptype.h) TheExternalDataType - A Windows CF_ constant defining the external clipboard data type which will be imported/exported. ThePriority - An integer indicating the priority of this mapping. The highest available priority mapping will be used in order to retain as much information in the data as possible. See docs.doc for details of the existing mappings. Reimplemented from ClipboardMapping. Definition at line 813 of file metafilt.cpp. 00817 { 00818 MetaFileClipMap *Mapping = new MetaFileClipMap(TheType, TheFilter, 00819 TheInternalDataType, 00820 TheExternalDataType, 00821 ThePriority); 00822 if (Mapping == NULL) 00823 InformError(); 00824 else 00825 ExternalClipboard::RegisterDataType(Mapping); 00826 }
|
|
Invokes this mapping for exporting This takes the document tree of Source, and exports it to the external (windows) clipboard. Usually this just involves calling Filter::DoExport for the parent filter, and then returning the handle to the global memory block to be placed onto the external clipboard.
Reimplemented from ClipboardMapping. Definition at line 914 of file metafilt.cpp. 00915 { 00916 #if (_OLE_VER >= 0x200) 00917 00918 // Check if we need to allocate some memory. 00919 HANDLE hGlobalMem; 00920 if ((hGlobalMem = m_hMem) != 0) 00921 { 00922 // We have some already. Is it big enough? 00923 if (m_cbMemSize < sizeof(METAFILEPICT)) return 0; 00924 } 00925 else 00926 { 00927 // We must allocate some. 00928 hGlobalMem = m_hMem = GlobalAlloc(GHND, sizeof(METAFILEPICT)); 00929 if (!hGlobalMem) return 0; 00930 } 00931 00932 #else 00933 00934 HANDLE hGlobalMem = GlobalAlloc(GHND, sizeof(METAFILEPICT)); 00935 if (!hGlobalMem) return 0; 00936 00937 #endif 00938 00939 METAFILEPICT* Info = (METAFILEPICT*) GlobalLock(hGlobalMem); 00940 00941 // Initialise to suitable defaults, just in case 00942 Info->mm = MM_ANISOTROPIC; 00943 Info->xExt = 0; 00944 Info->yExt = 0; 00945 Info->hMF = NULL; 00946 00947 // --- Now, export the source clipboard to a memory metafile 00948 // Create a dummy MemFile to keep the exporter happy 00949 char *temp[1024]; 00950 CCMemFile DummyFile(temp, 1000); 00951 00952 ((MetaFileFilter *)pFilter)->DoExport(Caller, &DummyFile, (Document *)Source, Info); 00953 00954 if (DummyFile.isOpen()) DummyFile.close(); 00955 00956 // -- Finally, lob the metafile on the clipboard (we can forget about it now, as 00957 // it is now owned (and will be deleted) by the OS) 00958 // We must unlock the block before giving it to the clipboard 00959 GlobalUnlock(hGlobalMem); 00960 return(hGlobalMem); 00961 }
|
|
Calls the parent filter as appropriate to import the given data from the external clipboard.
Reimplemented from ClipboardMapping. Definition at line 848 of file metafilt.cpp. 00850 { 00851 BOOL ok = FALSE; 00852 00853 // Get a scratch file - if TMP isn't set, this will try for c:\temp. 00854 // The filename will have XS as a prefix 00855 char *tempname = GetTempFileName(); //_ttempnam("C:\temp", "XS"); 00856 if (tempname == NULL) 00857 { 00858 ERROR3("Couldn't get a temp filename"); 00859 return(FALSE); 00860 } 00861 00862 // --- 00863 // Get the header data out of the clipboard, and copy the referenced metafile to disc 00864 METAFILEPICT *Info = (METAFILEPICT *) GlobalLock(ClipboardData); 00865 00866 if (Info == NULL) 00867 { 00868 RemoveTempFile(); 00869 return(FALSE); 00870 } 00871 00872 HMETAFILE hCopy = CopyMetaFile(Info->hMF, tempname); 00873 00874 GlobalUnlock(ClipboardData); 00875 00876 if (hCopy != NULL) 00877 { 00878 ok = ImportFromTempFile(tempname, Caller, Dest); 00879 DeleteMetaFile(hCopy); 00880 } 00881 00882 RemoveTempFile(); 00883 00884 return(ok); 00885 }
|
|
Reimplemented from ClipboardMapping. Definition at line 166 of file metafilt.h. |
|
Reimplemented from ClipboardMapping. Definition at line 167 of file metafilt.h. |
|
Reimplemented from ClipboardMapping. Definition at line 168 of file metafilt.h. |