merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / frmfmt.hxx
blob12ef87e948d9238b7b8bebbd6b75496cec7849b3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: frmfmt.hxx,v $
10 * $Revision: 1.15.214.1 $
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 ************************************************************************/
30 #ifndef _FRMFMT_HXX
31 #define _FRMFMT_HXX
33 #include <format.hxx>
35 // --> OD 2004-08-06 #i28749#
36 #include <com/sun/star/text/PositionLayoutDir.hpp>
37 // <--
38 #include "swdllapi.h"
40 class SwFlyFrm;
41 class SwAnchoredObject;
42 class Graphic;
43 class Point;
44 class ImageMap;
45 class IMapObject;
46 class SwRect;
47 class SwContact;
48 class SdrObject;
50 class SW_DLLPUBLIC SwFrmFmt: public SwFmt
52 friend class SwDoc;
53 friend class SwPageDesc; //darf den protected CTor rufen.
54 // friend class SwSwgReader; // der SW2-Reader auch!
55 // friend class Sw3IoImp; // der SW3-Reader auch!
57 protected:
58 SwFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
59 SwFrmFmt *pDrvdFrm, USHORT nFmtWhich = RES_FRMFMT,
60 const USHORT* pWhichRange = 0 )
61 : SwFmt( rPool, pFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
62 pDrvdFrm, nFmtWhich )
65 SwFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
66 SwFrmFmt *pDrvdFrm, USHORT nFmtWhich = RES_FRMFMT,
67 const USHORT* pWhichRange = 0 )
68 : SwFmt( rPool, rFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
69 pDrvdFrm, nFmtWhich )
72 public:
73 TYPEINFO(); //Bereits in Basisklasse Client drin.
75 //Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
76 virtual void DelFrms();
78 //Erzeugt die Ansichten
79 virtual void MakeFrms();
81 virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
83 virtual void Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue );
85 // returnt das IMapObject, das an dem Format (Fly), in der ImageMap
86 // an der Point Position definiert ist.
87 // rPoint - teste auf der DocPosition
88 // pFly - optionaler FlyFrame, falls der schon bekannt ist.
89 IMapObject* GetIMapObject( const Point& rPoint,
90 const SwFlyFrm *pFly = 0 ) const;
92 // Gibt die tatsaechlche Groesse des Frames zurueck bzw. ein leeres
93 // Rechteck, wenn kein Layout existiert. Wird pPoint angegeben, dann
94 // wird der am dichtesten liegende Frame gesucht.
95 SwRect FindLayoutRect( const BOOL bPrtArea = FALSE,
96 const Point* pPoint = 0,
97 const BOOL bCalcFrm = FALSE ) const;
99 // Sucht das SdrObject. Der SdrObjUserCall ist Client vom Format.
100 // Der UserCall kennt sein SdrObject.
101 SwContact *FindContactObj();
102 const SwContact *FindContactObj() const
103 { return ((SwFrmFmt*)this)->FindContactObj(); }
105 // returns the SdrObject, that ist connected to the ContactObject.
106 // Only DrawFrmFmts are connected to the "real SdrObject". FlyFrmFmts
107 // are connected to a Master and all FlyFrms has the "real SdrObject".
108 // "Real SdrObject" has position and a Z-order.
109 SdrObject *FindSdrObject();
110 const SdrObject *FindSdrObject() const
111 { return ((SwFrmFmt*)this)->FindSdrObject(); }
113 SdrObject *FindRealSdrObject();
114 const SdrObject *FindRealSdrObject() const
115 { return ((SwFrmFmt*)this)->FindRealSdrObject(); }
117 BOOL IsLowerOf( const SwFrmFmt& rFmt ) const;
119 // --> OD 2004-07-27 #i31698#
120 enum tLayoutDir
122 HORI_L2R,
123 HORI_R2L,
124 VERT_R2L,
125 VERT_L2R // not supported yet
128 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const;
129 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir );
130 // <--
132 // --> OD 2004-08-06 #i28749#
133 virtual sal_Int16 GetPositionLayoutDir() const;
134 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
135 // <--
137 virtual String GetDescription() const;
139 DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt)
142 //Das FlyFrame-Format ------------------------------
144 class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt
146 friend class SwDoc;
148 //Beide nicht vorhanden.
149 SwFlyFrmFmt( const SwFlyFrmFmt &rCpy );
150 SwFlyFrmFmt &operator=( const SwFlyFrmFmt &rCpy );
152 protected:
153 SwFlyFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
154 SwFrmFmt *pDrvdFrm )
155 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FLYFRMFMT )
157 SwFlyFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
158 SwFrmFmt *pDrvdFrm )
159 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FLYFRMFMT )
162 public:
163 TYPEINFO();
164 ~SwFlyFrmFmt();
166 //Erzeugt die Ansichten
167 virtual void MakeFrms();
169 SwFlyFrm* GetFrm( const Point* pDocPos = 0,
170 const BOOL bCalcFrm = FALSE ) const;
172 SwAnchoredObject* GetAnchoredObj( const Point* pDocPos = 0,
173 const BOOL bCalcFrm = FALSE ) const;
175 virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
177 virtual BOOL GetInfo( SfxPoolItem& rInfo ) const;
179 // --> OD 2009-07-14 #i73249#
180 const String GetObjTitle() const;
181 void SetObjTitle( const String& rTitle,
182 bool bBroadcast = false );
183 const String GetObjDescription() const;
184 void SetObjDescription( const String& rDescription,
185 bool bBroadcast = false );
186 // <--
188 /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
190 OD 22.08.2002 - overloading virtual method and its default implementation,
191 because format of fly frame provides transparent backgrounds.
192 Method determines, if background of fly frame is transparent.
194 @author OD
196 @return true, if background color is transparent, but not "no fill"
197 or a existing background graphic is transparent.
199 virtual sal_Bool IsBackgroundTransparent() const;
201 /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898#
203 OD 08.10.2002 - method to determine, if the brush for drawing the
204 background is "inherited" from its parent/grandparent.
205 This is the case, if no background graphic is set and the background
206 color is "no fill"/"auto fill"
208 @author OD
210 @return true, if background brush is "inherited" from parent/grandparent
212 sal_Bool IsBackgroundBrushInherited() const;
214 DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt)
217 //Das DrawFrame-Format -----------------------------
219 class SW_DLLPUBLIC SwDrawFrmFmt: public SwFrmFmt
221 friend class SwDoc;
223 mutable const SdrObject * pSdrObjCached;
224 mutable String sSdrObjCachedComment;
226 //Beide nicht vorhanden.
227 SwDrawFrmFmt( const SwDrawFrmFmt &rCpy );
228 SwDrawFrmFmt &operator=( const SwDrawFrmFmt &rCpy );
230 // --> OD 2004-07-27 #i31698#
231 SwFrmFmt::tLayoutDir meLayoutDir;
232 // <--
233 // --> OD 2004-08-06 #i28749#
234 sal_Int16 mnPositionLayoutDir;
235 // <--
236 // --> OD 2005-03-11 #i44334#, #i44681#
237 bool mbPosAttrSet;
238 // <--
239 protected:
240 SwDrawFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
241 SwFrmFmt *pDrvdFrm )
242 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_DRAWFRMFMT ),
243 pSdrObjCached(NULL),
244 // --> OD 2004-07-28 #i31698#
245 meLayoutDir( SwFrmFmt::HORI_L2R ),
246 // <--
247 // --> OD 2004-08-06 #i28749#
248 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010#
249 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
250 // <--
251 // --> OD 2005-03-11 #i44334#, #i44681#
252 mbPosAttrSet( false )
253 // <--
256 SwDrawFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
257 SwFrmFmt *pDrvdFrm )
258 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_DRAWFRMFMT ),
259 pSdrObjCached(NULL),
260 // --> OD 2004-07-28 #i31698#
261 meLayoutDir( SwFrmFmt::HORI_L2R ),
262 // <--
263 // --> OD 2004-08-06 #i28749#
264 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010#
265 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
266 // <--
267 // --> OD 2005-03-11 #i44334#, #i44681#
268 mbPosAttrSet( false )
269 // <--
272 public:
273 TYPEINFO();
274 ~SwDrawFrmFmt();
276 //DrawObjecte werden aus den Arrays am Layout entfernt. Die DrawObjecte
277 //werden als geloescht gekennzeichnet.
278 virtual void DelFrms();
280 //Anmelden der DrawObjecte in den Arrays am Layout. Loeschkennzeichen
281 //werden zurueckgesetzt.
282 virtual void MakeFrms();
284 virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
286 // --> OD 2004-07-27 #i31698#
287 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const;
288 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir );
289 // <--
291 // --> OD 2004-08-06 #i28749#
292 virtual sal_Int16 GetPositionLayoutDir() const;
293 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
294 // <--
296 // --> OD 2005-03-11 #i44334#, #i44681#
297 inline bool IsPosAttrSet() const { return mbPosAttrSet; }
298 inline void PosAttrSet() { mbPosAttrSet = true; }
299 // <--
301 // --> OD 2005-08-16 #i53320#
302 inline void ResetPosAttr()
304 mbPosAttrSet = false;
306 // <--
308 virtual String GetDescription() const;
310 DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt);
314 #endif