00001 // $Id: clipint.h 1282 2006-06-09 09:46:49Z alex $ 00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE 00003 ================================XARAHEADERSTART=========================== 00004 00005 Xara LX, a vector drawing and manipulation program. 00006 Copyright (C) 1993-2006 Xara Group Ltd. 00007 Copyright on certain contributions may be held in joint with their 00008 respective authors. See AUTHORS file for details. 00009 00010 LICENSE TO USE AND MODIFY SOFTWARE 00011 ---------------------------------- 00012 00013 This file is part of Xara LX. 00014 00015 Xara LX is free software; you can redistribute it and/or modify it 00016 under the terms of the GNU General Public License version 2 as published 00017 by the Free Software Foundation. 00018 00019 Xara LX and its component source files are distributed in the hope 00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00022 See the GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with Xara LX (see the file GPL in the root directory of the 00026 distribution); if not, write to the Free Software Foundation, Inc., 51 00027 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00028 00029 00030 ADDITIONAL RIGHTS 00031 ----------------- 00032 00033 Conditional upon your continuing compliance with the GNU General Public 00034 License described above, Xara Group Ltd grants to you certain additional 00035 rights. 00036 00037 The additional rights are to use, modify, and distribute the software 00038 together with the wxWidgets library, the wxXtra library, and the "CDraw" 00039 library and any other such library that any version of Xara LX relased 00040 by Xara Group Ltd requires in order to compile and execute, including 00041 the static linking of that library to XaraLX. In the case of the 00042 "CDraw" library, you may satisfy obligation under the GNU General Public 00043 License to provide source code by providing a binary copy of the library 00044 concerned and a copy of the license accompanying it. 00045 00046 Nothing in this section restricts any of the rights you have under 00047 the GNU General Public License. 00048 00049 00050 SCOPE OF LICENSE 00051 ---------------- 00052 00053 This license applies to this program (XaraLX) and its constituent source 00054 files only, and does not necessarily apply to other Xara products which may 00055 in part share the same code base, and are subject to their own licensing 00056 terms. 00057 00058 This license does not apply to files in the wxXtra directory, which 00059 are built into a separate library, and are subject to the wxWindows 00060 license contained within that directory in the file "WXXTRA-LICENSE". 00061 00062 This license does not apply to the binary libraries (if any) within 00063 the "libs" directory, which are subject to a separate license contained 00064 within that directory in the file "LIBS-LICENSE". 00065 00066 00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS 00068 ---------------------------------------------- 00069 00070 Subject to the terms of the GNU Public License (see above), you are 00071 free to do whatever you like with your modifications. However, you may 00072 (at your option) wish contribute them to Xara's source tree. You can 00073 find details of how to do this at: 00074 http://www.xaraxtreme.org/developers/ 00075 00076 Prior to contributing your modifications, you will need to complete our 00077 contributor agreement. This can be found at: 00078 http://www.xaraxtreme.org/developers/contribute/ 00079 00080 Please note that Xara will not accept modifications which modify any of 00081 the text between the start and end of this header (marked 00082 XARAHEADERSTART and XARAHEADEREND). 00083 00084 00085 MARKS 00086 ----- 00087 00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara 00089 designs are registered or unregistered trademarks, design-marks, and/or 00090 service marks of Xara Group Ltd. All rights in these marks are reserved. 00091 00092 00093 Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK. 00094 http://www.xara.com/ 00095 00096 =================================XARAHEADEREND============================ 00097 */ 00098 /* 00099 * */ 00100 // Camelot's Internal clipboard 00101 00102 #ifndef INC_CLIPINT 00103 #define INC_CLIPINT 00104 00105 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00106 00107 00108 class Layer; 00109 class CCamDoc; 00110 class Range; 00111 00112 00113 /******************************************************************************************** 00114 > class InternalClipboard : public Document 00115 00116 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> (Connection to ExternalClipboard by Jason, OLE stuff by JustinF) 00117 Created: 05/07/94 (19/4/95) 00118 00119 Purpose: Camelot's internal clipboard document. 00120 00121 This is a cache, if you like, of the contents of the ExternalClipboard 00122 00123 When Camelot "owns" the external clipboard, the InternalClipboard contains 00124 the objects which will be pasted into other applications. (When external 00125 apps paste, they will request that Camelot exports the InternalClipboard 00126 in some external exchange format) 00127 00128 When Camelot doesn't own the external clipboard, the InternalClipboard 00129 will either be empty, or will be a cached copy of the external clipboard 00130 (if the user has pasted once into Camelot, while the clipboard remains 00131 unchanged, the internal clipboard will have the internal camelot tree 00132 representation of the clipboard cached - thus, pasting a .cdr file into 00133 camelot will only do the slow conversion once, and subsequent pastes 00134 will be 'native') 00135 00136 SeeAlso: ExternalClipboard; Document 00137 *********************************************************************************************/ 00138 00139 class InternalClipboard : public Document 00140 { 00141 00143 // Interface. 00144 00145 public: 00146 00147 // The identifier's of the two clipboards. 00148 enum ID { CLIPBOARD, DRAGDROP }; 00149 00150 // Access the the two clipboards through these. 00151 static InternalClipboard* Instance() { return pInstance; } 00152 static InternalClipboard* Other() { return pOther; } 00153 static void Swap(); 00154 static ID GetCurrentID(); 00155 00156 // Attributes. 00157 static BOOL IsEmpty(BOOL AskExternalClipboard = TRUE); 00158 static void DescribeContents(String_64* Result); 00159 static DocRect GetObjectsBounds(); 00160 static Layer* GetInsertionLayer(); 00161 static Range* GetClipboardRange() { return pInstance->pClipboardRange; } 00162 00163 // Copying. 00164 static BOOL PrepareForCopy(); 00165 static BOOL CopyInProgress(); 00166 static BOOL CopyObjects(Range& RangeToCopy, Operation * pOp = NULL); 00167 static BOOL CopyComponentData(BaseDocument* pSrcDoc); 00168 static BOOL CopyCompleted(); 00169 00170 //Graham 24/4/97 00171 //A quick way of putting some text on the internal clipboard 00172 static BOOL CopyText(TCHAR* pBuffer); 00173 00174 00175 // Pasting. 00176 static BOOL PrepareForPaste(BOOL* pExternalSource = 0); 00177 static BOOL PasteCompleted(); 00178 static DocCoord GetOriginalCentrePoint(); 00179 static void SetOriginalCentrePoint(DocCoord NewCentre); 00180 // Notifications. 00181 static void Clear(); 00182 static void AttrsHaveChanged(); 00183 00184 00186 // Implementation. 00187 00188 public: 00189 00190 // Startup / shutdown. These manage the two internal clipboards, Instance and Other. 00191 static BOOL Initialise(); 00192 static void Deinit(); 00193 00194 protected: 00195 00196 // Creation & destruction. 00197 InternalClipboard(ID id, BOOL fHide = TRUE); 00198 virtual ~InternalClipboard(); 00199 virtual BOOL Init(CCamDoc* pOilDoc); 00200 00201 // RTTI (of sorts). 00202 virtual BOOL IsNotAClipboard() const { return FALSE; }; 00203 virtual BOOL IsAClipboard() const { return TRUE; }; 00204 00205 private: 00206 00207 // Helpers. 00208 BOOL OnNewClipboardObjects(); 00209 static void DescribeContentsInternal(String_64* Result); 00210 00211 // Data members. 00212 static InternalClipboard* pInstance; // The only instance of the InternalClipboard 00213 static InternalClipboard* pOther; // the other instance (temp save) of the clipboard 00214 Range* pClipboardRange; // the other instance's range 00215 BOOL ClipOp; // TRUE while we're doing a copy operation 00216 DocCoord dcCentre; // centre of copied objects 00217 ID m_id; // identifier of this clipboard 00218 BOOL OriginalCentreLock; // TRUE when calls to SetOriginalCentrePoint are disallowed 00219 // (only used when clipboard data was from an external source) 00220 00221 CC_DECLARE_DYNAMIC(InternalClipboard); 00222 00223 friend class ExternalClipboard; 00224 friend class OpDeleteBitmap; 00225 }; 00226 00227 #endif