Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_so3 / embobj.hxx
blob549af85a4efc6e7dd077951d3441990650311ac3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: embobj.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _EMBOBJ_HXX
32 #define _EMBOBJ_HXX
34 #include <bf_so3/persist.hxx>
35 #include <bf_so3/pseudo.hxx>
36 #include <bf_so3/protocol.hxx>
37 #include <bf_so3/svstor.hxx>
38 #include <com/sun/star/uno/Reference.hxx>
39 #ifndef _MAPMOD_HXX //autogen
40 #include <vcl/mapmod.hxx>
41 #endif
42 #include <bf_svtools/ownlist.hxx>
44 #ifndef INCLUDED_SO3DLLAPI_H
45 #include "bf_so3/so3dllapi.h"
46 #endif
48 class Printer;
50 /*************************************************************************/
51 // Datenart !!! Uebereinstimmung mit MS-Windows
52 #define ASPECT_CONTENT 1
53 #define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Farben DIB in MetaFile */
54 #define ASPECT_ICON 4
55 #define ASPECT_DOCPRINT 8
56 #define ASPECT_ALL (ASPECT_CONTENT | ASPECT_THUMBNAIL | ASPECT_ICON | ASPECT_DOCPRINT)
58 struct TransferableObjectDescriptor;
59 class ImpOleObject;
60 class ImpViewObject;
61 class OutputDevice;
62 class Region;
63 class Menu;
64 class GDIMetaFile;
65 class JobSetup;
66 class SotStorage;
67 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
69 namespace binfilter {
70 class SvEmbeddedClient;
71 class SvStorage;
73 class SO3_DLLPUBLIC SvEmbeddedObject : virtual public SvPersist,
74 public SvPseudoObject
76 friend class ImpOleObject;
77 friend class SvEmbeddedClient;
78 friend class SvEditObjectProtocol;
79 friend class ImplSvEditObjectProtocol;
80 friend class SvPersist; // nur wegen Sun-C40 Compiler
81 friend class SwWW6WrGrf; // SH benoetigt MakeMetafile
82 BOOL bAutoSave:1, // TRUE, bei DoOpen( FALSE ), Save
83 bAutoHatch:1; // TRUE, bei Embed automatisch Hatch zeichnen
84 Rectangle aVisArea; // leer == nicht gesetzt
85 MapUnit nMapUnit;
86 String aDocName; // Documentname
88 void DrawHatch( OutputDevice * pDev, const Point & rPos,
89 const Size & rSize );
90 protected:
91 SvEditObjectProtocol aProt; // Referenz auf das Protokoll
92 ~SvEmbeddedObject();
93 virtual BOOL Load( SvStorage * );
94 virtual BOOL Save();
95 virtual BOOL SaveAs( SvStorage * pNewStg );
96 virtual void LoadContent( SvStream & rStm, BOOL bOwner_ );
97 virtual void SaveContent( SvStream & rStm, BOOL bOwner_ );
98 virtual void Connect( BOOL bConnect );
99 virtual void Open( BOOL bOpen );
100 virtual void Embed( BOOL bEmbedded );
101 virtual void PlugIn( BOOL bPlugIn );
102 virtual ErrCode Verb( long nVerbPos, ::binfilter::SvEmbeddedClient * pCallerClient,
103 Window * pWin, const Rectangle * pWorkAreaPixel );
105 virtual BOOL Close();
106 void SetMapUnit( MapUnit nUnit )
107 { nMapUnit = nUnit; }
108 virtual void Draw( OutputDevice *, const JobSetup & rSetup,
109 USHORT nAspect = ASPECT_CONTENT );
110 virtual void DocumentNameChanged( const String & rDocName );
112 public:
113 SvEmbeddedObject();
114 SO2_DECL_STANDARD_CLASS_DLL(SvEmbeddedObject,SOAPP)
115 virtual void FillClass( SvGlobalName * pClassName,
116 ULONG * pFormat,
117 String * pAppName,
118 String * pFullTypeName,
119 String * pShortTypeName,
120 long nFileFormat = SOFFICE_FILEFORMAT_CURRENT ) const;
121 SvGlobalName GetClassName() const
122 { return SvPseudoObject::GetClassName(); }
124 void SetAutoSave( BOOL bAutoSaveP )
125 { bAutoSave = bAutoSaveP; }
126 BOOL IsAutoSave() const { return bAutoSave; }
127 virtual void SetModified( BOOL = TRUE );
129 void SetAutoHatch( BOOL bAutoHatchP )
130 { bAutoHatch = bAutoHatchP; }
131 BOOL IsAutoHatch() const { return bAutoHatch; }
133 SvEmbeddedClient * GetClient() const { return aProt.GetClient(); }
135 // Konvertieren von StarObjects
136 static BOOL InsertStarObject
137 ( const String &rObjName, const String& rStgName,
138 SvStream& rSrc, SvPersist* pPersist );
139 // Einlesen eines StarObjects als Picture
140 static BOOL LoadStarObjectPicture( SvStream& rSrc, GDIMetaFile& rMTF );
142 static BOOL MakeContentStream( SvStorage * pStor, const GDIMetaFile & );
143 static BOOL MakeContentStream( SotStorage * pStor, const GDIMetaFile & );
145 // Attribute zum Feintuning
146 virtual ULONG GetMiscStatus() const;
148 // Robuste Protokollsteuerung
149 ErrCode DoEmbed( BOOL bEmbedded );
150 ErrCode DoPlugIn( BOOL bPLugIn );
151 ErrCode DoOpen( BOOL bOpen );
153 const String & GetDocumentName() const { return aDocName; }
155 SvEditObjectProtocol & GetProtocol() { return aProt; }
156 const SvEditObjectProtocol & GetProtocol() const { return aProt; }
158 void SendViewChanged();
159 void ViewChanged( USHORT nAspect);
161 GDIMetaFile& GetGDIMetaFile( GDIMetaFile& );
162 virtual BOOL SetData( const String& rData );
164 MapUnit GetMapUnit() const { return nMapUnit; }
165 //virtual Rectangle GetVisArea( USHORT nAspect = ASPECT_CONTENT ) const;
166 virtual Rectangle GetVisArea( USHORT nAspect ) const;
167 const Rectangle & GetVisArea() const;
168 virtual void SetVisArea( const Rectangle & rVisArea );
169 // Optimierung gegenueber SetVisArea, wenn dana GetVisArea
170 const Rectangle & SetGetVisArea( const Rectangle & rVisArea );
171 void SetVisAreaSize( const Size & rVisSize );
173 void DoDraw( OutputDevice *, const Point & rObjPos,
174 const Fraction & rXScale,
175 const Fraction & rScaleY,
176 const JobSetup & rSetup, const Size& rSize,
177 USHORT nAspect = ASPECT_CONTENT );
178 void DoDraw( OutputDevice *, const Point & rObjPos,
179 const Size & rSize,
180 const JobSetup & rSetup,
181 USHORT nAspect = ASPECT_CONTENT );
183 // WYSIWYG
184 /* Return the printer of the document. A return of null means that the
185 * document has no printer.
186 * The default implementation call the parent if one exist or return null.
188 virtual Printer * GetDocumentPrinter();
189 virtual OutputDevice* GetDocumentRefDev();
191 /* This Method is called if the printer in the document changed.
192 * The default implementation does not call the childs.
193 * @param pNewPrinter the new printer. Only hold references
194 * to this object during the call.
195 * @see documentation in so3\source\inplace\embobj.cxx::OnDocumentPrinterChanged
197 virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
199 virtual UINT32 GetViewAspect() const;
201 #ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
202 #define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
203 SO2_DECL_REF(SvEmbeddedObject)
204 #endif
205 SO2_IMPL_REF(SvEmbeddedObject)
207 /*************************************************************************
208 *************************************************************************/
209 class SO3_DLLPUBLIC SvEmbeddedInfoObject : public SvInfoObject
211 Rectangle aVisArea;
212 UINT32 nViewAspect;
213 protected:
214 ~SvEmbeddedInfoObject();
215 virtual void Assign( const SvInfoObject * pObj );
216 public:
217 SV_DECL_PERSIST1(SvEmbeddedObject,SvInfoObject,2)
218 SvEmbeddedInfoObject();
219 SvEmbeddedInfoObject( SvEmbeddedObject *, const String & rObjName );
220 SvEmbeddedInfoObject( const String& rObjName,
221 const SvGlobalName& rClassName );
223 virtual void SetObj( SvPersist * );
225 SvEmbeddedObject * GetEmbed() const { return &SvEmbeddedObjectRef( GetObj() ); }
226 BOOL IsLink() const;
227 const Rectangle & GetVisArea() const;
228 const Rectangle & GetInfoVisArea() const { return aVisArea; }
229 void SetInfoVisArea( const Rectangle& r) { aVisArea = r; }
231 UINT32 GetInfoViewAspect() const { return nViewAspect; }
232 void SetInfoViewAspect( UINT32 nAspect ) { nViewAspect = nAspect; }
233 UINT32 GetViewAspect() const;
238 #endif // _EMBOBJ_HXX