nodebmp.h

Go to the documentation of this file.
00001 // $Id: nodebmp.h 1708 2006-08-17 17:13:38Z gerry $
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 // Node representing a bitmap object.
00100 
00101 #ifndef INC_NODEBMP
00102 #define INC_NODEBMP
00103 
00104 
00105 //#include "bitmap.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "noderect.h"
00107 //#include "doccolor.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "xpehost.h"  // For OPTOKEN_XPE_EDIT
00109 
00110 class SelOperation;
00111 class AttrBitmapTranspFill;
00112 
00113 /********************************************************************************************
00114 
00115 >   class NodeBitmap : public NodeRect
00116 
00117     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00118     Created:    08/03/94
00119     Purpose:    A class for including bitmap objects within the tree.
00120     SeeAlso:    NodeRect, KernelBitmap
00121 
00122 ********************************************************************************************/
00123 
00124 class NodeBitmap : public NodeRect
00125 {
00126 // Give my name out in memory dumps
00127 CC_DECLARE_DYNCREATE(NodeBitmap);
00128 
00129 public:
00130     NodeBitmap();   
00131     NodeBitmap( Node* ContextNode,
00132                 AttachNodeDirection Direction,
00133                 BOOL Locked = FALSE,
00134                 BOOL Mangled = FALSE,
00135                 BOOL Marked = FALSE,
00136                 BOOL Selected = FALSE
00137               );
00138 
00139     virtual Node* SimpleCopy();
00140     void CopyNodeContents(NodeBitmap* NodeCopy);
00141     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00142     virtual String Describe(BOOL Plural, BOOL Verbose);
00143 
00144     virtual KernelBitmap *EnumerateBitmaps(UINT32 Count);
00145     virtual double GetEffectiveBitmapMinDPI(KernelBitmap* pBitmap);
00146     virtual BOOL ReplaceBitmap(KernelBitmap* pOrigBitmap, KernelBitmap* pNewBitmap);
00147 
00148     // Function for interrogation by clipboard to determine exportable data types
00149     virtual BOOL SupportsClipboardFormat(InternalClipboardFormat *Format) const;
00150 
00151     UINT32 GetBitmapDPI();
00152 
00153     // Render the bitmap
00154     virtual void Render( RenderRegion* pRender );
00155     virtual void PreExportRender(RenderRegion* pRender );
00156     virtual BOOL ExportRender( RenderRegion* pRender ); 
00157     virtual INT32 GetSizeOfExport(Filter*);
00158 
00159     virtual BOOL RequiresAttrib(NodeAttribute* pAttrib, BOOL Search = FALSE);
00160     virtual BOOL ApplyDefaultBitmapAttrs(UndoableOperation* pOp, AttrBitmapTranspFill* pTranspBitmap = NULL);
00161 
00162     // Popup menus
00163     virtual BOOL OnNodePopUp(Spread* pSpread, DocCoord PointerPos, ContextMenu* pMenu);
00164 
00165     // Information functions
00166     virtual UINT32 GetNodeSize() const;             // Returns size of node in bytes
00167     virtual BOOL IsABitmap() const;
00168     virtual BOOL NeedsTransparency() const;
00169 
00170     // Make Shapes functions
00171     virtual BOOL CanBecomeA(BecomeA* pBecomeA);
00172     virtual BOOL DoBecomeA(BecomeA* pBecomeA);
00173 
00174     // AllowOp stuff
00175     BOOL AllowOp(ObjChangeParam*, BOOL);
00176     BOOL MakeContoneBitmap(UndoableOperation*);
00177 
00178     static KernelBitmap* CheckGreyscaleBitmap(KernelBitmap* pBitmap, UINT32 PromptID, UINT32 OkID);
00179 
00180     KernelBitmapRef BitmapRef;
00181 
00182     virtual KernelBitmapRef* GetBitmapRef() { return &BitmapRef; }
00183     virtual KernelBitmap* GetBitmap();
00184 
00185     virtual BOOL HidingNode();
00186     virtual BOOL ShowingNode();
00187 
00188     virtual void SetStartColour(DocColour*);
00189     virtual void SetEndColour(DocColour*);
00190 
00191     virtual DocColour* GetStartColour();
00192     virtual DocColour* GetEndColour();
00193 
00194     virtual BOOL GetApplyContoneColour() {return ApplyContoneColour;};
00195 
00196     // For render region capabilities
00197     BOOL HasSimpleOrientation(RenderRegion *);
00198 
00199     virtual BOOL OnClick(DocCoord PointerPos,
00200                          ClickType Click,
00201                          ClickModifiers ClickMods,
00202                          Spread* pSpread);
00203 
00204 PORTNOTE("other","Change GetDefaultOpToken - OPTOKEN_XPE_EDIT reference")
00205     // Find out the optoken of the default operation for this node. (See EditSelectionOp and Return hotkey.)
00206     virtual TCHAR* GetDefaultOpToken() {return _T("None");}
00207         
00208     virtual void SetAspectRatio(double dExWidth, double dExHeight, BOOL bPathAndFill);
00209     virtual BOOL ReleaseCached(BOOL bAndParents = TRUE, BOOL bAndChildren = TRUE, BOOL bSelf = TRUE, BOOL bAndDerived = TRUE);
00210 
00211     // Functions to give effects info about this instance of the bitmap so that
00212     // they can operate in the the upright bitmap domain, then do the appropriate
00213     // instance transformation at the top of the effects stack
00214     virtual DocRect GetOriginalBitmapRect();
00215     virtual Matrix GetInstanceTransform();
00216 
00217     virtual BOOL CanSupplyDirectBitmap() {return TRUE;}
00218     virtual BOOL GetDirectBitmap(RenderRegion* pRender, LPBITMAPINFO* plpInfo, LPBYTE* plpBits, DocRect* pRect, Matrix* pMat, double* pdRes);
00219 
00220 protected:
00221     virtual BOOL HasBitmapAttrs();
00222 
00223 public:
00224     // new file format export functions
00225     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00226     virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00227     
00228 protected:
00229     DocColour Colour;
00230     DocColour EndColour;
00231 
00232     BOOL ApplyContoneColour;
00233 }; 
00234 
00235 //-------------------------------------------------------------------------------
00236 //-------------------------------------------------------------------------------
00237 //-------------------------------------------------------------------------------
00238 //-------------------------------------------------------------------------------
00239 
00240 // Optoken for the CreateNodeBitmap operation
00241 #define OPTOKEN_CREATENODEBITMAP _T("CreateNodeBitmap") 
00242 
00243 /********************************************************************************************
00244 
00245 >   class OpCreateNodeBitmap: public UndoableOperation
00246 
00247     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00248     Created:    19/3/95
00249     Purpose:    Creates a new Node Bitmap, at a specific position on the page.
00250     SeeAlso:    -
00251 
00252 ********************************************************************************************/
00253 
00254 class CCAPI OpCreateNodeBitmap: public UndoableOperation
00255 {         
00256     CC_DECLARE_DYNCREATE( OpCreateNodeBitmap );
00257 
00258 public:
00259     static BOOL     Init();             
00260     static OpState  GetState(String_256*, OpDescriptor*);       
00261 
00262     void DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam);  
00263     virtual void GetOpName(String_256* OpName); // Overloaded so that we can store the undo string in 
00264                                                 // the operation rather than the OpDescriptor.  
00265 
00266     // Karim 21/01/2000 - see UndoableOperation base implementation.
00267     virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00268 };  
00269 
00270 /********************************************************************************************
00271 
00272 >   class ChangeBitmapPtrAction : public Action
00273 
00274     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00275     Created:    24/7/94
00276     Purpose:    An action which undoes the modification of Grad Fill data. This action can
00277                 be used for undoing changing control points.
00278     SeeAlso:    -
00279 
00280 ********************************************************************************************/
00281 
00282 class ChangeBitmapPtrAction : public Action
00283 {
00284 
00285 CC_DECLARE_DYNCREATE(ChangeBitmapPtrAction)
00286 
00287 public:
00288     ChangeBitmapPtrAction();
00289     virtual ActionCode Execute();
00290     static ActionCode Init( Operation* pOp,
00291                             ActionList* pActionList,
00292                             Action** NewAction);
00293     void StoreChanges(NodeBitmap* pBmpNode);
00294 
00295     KernelBitmapRef* GetBitmapRef() { return &BitmapRef; }
00296     KernelBitmap* GetBitmap() { return BitmapRef.GetBitmap(); }
00297 
00298 protected:
00299 
00300     NodeBitmap*         pChangedBmpNode;
00301     KernelBitmapRef     BitmapRef;
00302 };
00303 
00304 #endif  // INC_NODEBMP
00305 
00306 

Generated on Sat Nov 10 03:45:58 2007 for Camelot by  doxygen 1.4.4