merged tag ooo/OOO330_m14
[LibreOffice.git] / sw / inc / frmfmt.hxx
blob388607d4f0e0feada3c4c265ef29be0cd7f3a590
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _FRMFMT_HXX
28 #define _FRMFMT_HXX
30 // --> OD 2004-08-06 #i28749#
31 #include <com/sun/star/text/PositionLayoutDir.hpp>
32 // <--
34 #include <cppuhelper/weakref.hxx>
36 #include <format.hxx>
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.
55 ::com::sun::star::uno::WeakReference<
56 ::com::sun::star::uno::XInterface> m_wXObject;
58 protected:
59 SwFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
60 SwFrmFmt *pDrvdFrm, USHORT nFmtWhich = RES_FRMFMT,
61 const USHORT* pWhichRange = 0 )
62 : SwFmt( rPool, pFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
63 pDrvdFrm, nFmtWhich )
66 SwFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
67 SwFrmFmt *pDrvdFrm, USHORT nFmtWhich = RES_FRMFMT,
68 const USHORT* pWhichRange = 0 )
69 : SwFmt( rPool, rFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
70 pDrvdFrm, nFmtWhich )
73 public:
74 TYPEINFO(); //Bereits in Basisklasse Client drin.
76 //Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
77 virtual void DelFrms();
79 //Erzeugt die Ansichten
80 virtual void MakeFrms();
82 virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
84 virtual void Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue );
86 // returnt das IMapObject, das an dem Format (Fly), in der ImageMap
87 // an der Point Position definiert ist.
88 // rPoint - teste auf der DocPosition
89 // pFly - optionaler FlyFrame, falls der schon bekannt ist.
90 IMapObject* GetIMapObject( const Point& rPoint,
91 const SwFlyFrm *pFly = 0 ) const;
93 // Gibt die tatsaechlche Groesse des Frames zurueck bzw. ein leeres
94 // Rechteck, wenn kein Layout existiert. Wird pPoint angegeben, dann
95 // wird der am dichtesten liegende Frame gesucht.
96 SwRect FindLayoutRect( const BOOL bPrtArea = FALSE,
97 const Point* pPoint = 0,
98 const BOOL bCalcFrm = FALSE ) const;
100 // Sucht das SdrObject. Der SdrObjUserCall ist Client vom Format.
101 // Der UserCall kennt sein SdrObject.
102 SwContact *FindContactObj();
103 const SwContact *FindContactObj() const
104 { return ((SwFrmFmt*)this)->FindContactObj(); }
106 // returns the SdrObject, that ist connected to the ContactObject.
107 // Only DrawFrmFmts are connected to the "real SdrObject". FlyFrmFmts
108 // are connected to a Master and all FlyFrms has the "real SdrObject".
109 // "Real SdrObject" has position and a Z-order.
110 SdrObject *FindSdrObject();
111 const SdrObject *FindSdrObject() const
112 { return ((SwFrmFmt*)this)->FindSdrObject(); }
114 SdrObject *FindRealSdrObject();
115 const SdrObject *FindRealSdrObject() const
116 { return ((SwFrmFmt*)this)->FindRealSdrObject(); }
118 BOOL IsLowerOf( const SwFrmFmt& rFmt ) const;
120 // --> OD 2004-07-27 #i31698#
121 enum tLayoutDir
123 HORI_L2R,
124 HORI_R2L,
125 VERT_R2L,
126 VERT_L2R // not supported yet
129 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const;
130 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir );
131 // <--
133 // --> OD 2004-08-06 #i28749#
134 virtual sal_Int16 GetPositionLayoutDir() const;
135 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
136 // <--
138 virtual String GetDescription() const;
140 SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
141 ::com::sun::star::uno::XInterface> const& GetXObject() const
142 { return m_wXObject; }
143 SW_DLLPRIVATE void SetXObject(::com::sun::star::uno::Reference<
144 ::com::sun::star::uno::XInterface> const& xObject)
145 { m_wXObject = xObject; }
147 DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt)
150 //Das FlyFrame-Format ------------------------------
152 class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt
154 friend class SwDoc;
156 //Beide nicht vorhanden.
157 SwFlyFrmFmt( const SwFlyFrmFmt &rCpy );
158 SwFlyFrmFmt &operator=( const SwFlyFrmFmt &rCpy );
160 protected:
161 SwFlyFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
162 SwFrmFmt *pDrvdFrm )
163 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FLYFRMFMT )
165 SwFlyFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
166 SwFrmFmt *pDrvdFrm )
167 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FLYFRMFMT )
170 public:
171 TYPEINFO();
172 ~SwFlyFrmFmt();
174 //Erzeugt die Ansichten
175 virtual void MakeFrms();
177 SwFlyFrm* GetFrm( const Point* pDocPos = 0,
178 const BOOL bCalcFrm = FALSE ) const;
180 SwAnchoredObject* GetAnchoredObj( const Point* pDocPos = 0,
181 const BOOL bCalcFrm = FALSE ) const;
183 virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
185 virtual BOOL GetInfo( SfxPoolItem& rInfo ) const;
187 // --> OD 2009-07-14 #i73249#
188 const String GetObjTitle() const;
189 void SetObjTitle( const String& rTitle,
190 bool bBroadcast = false );
191 const String GetObjDescription() const;
192 void SetObjDescription( const String& rDescription,
193 bool bBroadcast = false );
194 // <--
196 /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
198 OD 22.08.2002 - overloading virtual method and its default implementation,
199 because format of fly frame provides transparent backgrounds.
200 Method determines, if background of fly frame is transparent.
202 @author OD
204 @return true, if background color is transparent, but not "no fill"
205 or a existing background graphic is transparent.
207 virtual sal_Bool IsBackgroundTransparent() const;
209 /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898#
211 OD 08.10.2002 - method to determine, if the brush for drawing the
212 background is "inherited" from its parent/grandparent.
213 This is the case, if no background graphic is set and the background
214 color is "no fill"/"auto fill"
216 @author OD
218 @return true, if background brush is "inherited" from parent/grandparent
220 sal_Bool IsBackgroundBrushInherited() const;
222 DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt)
225 //Das DrawFrame-Format -----------------------------
227 class SW_DLLPUBLIC SwDrawFrmFmt: public SwFrmFmt
229 friend class SwDoc;
231 mutable const SdrObject * pSdrObjCached;
232 mutable String sSdrObjCachedComment;
234 //Beide nicht vorhanden.
235 SwDrawFrmFmt( const SwDrawFrmFmt &rCpy );
236 SwDrawFrmFmt &operator=( const SwDrawFrmFmt &rCpy );
238 // --> OD 2004-07-27 #i31698#
239 SwFrmFmt::tLayoutDir meLayoutDir;
240 // <--
241 // --> OD 2004-08-06 #i28749#
242 sal_Int16 mnPositionLayoutDir;
243 // <--
244 // --> OD 2005-03-11 #i44334#, #i44681#
245 bool mbPosAttrSet;
246 // <--
247 protected:
248 SwDrawFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
249 SwFrmFmt *pDrvdFrm )
250 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_DRAWFRMFMT ),
251 pSdrObjCached(NULL),
252 // --> OD 2004-07-28 #i31698#
253 meLayoutDir( SwFrmFmt::HORI_L2R ),
254 // <--
255 // --> OD 2004-08-06 #i28749#
256 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010#
257 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
258 // <--
259 // --> OD 2005-03-11 #i44334#, #i44681#
260 mbPosAttrSet( false )
261 // <--
264 SwDrawFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
265 SwFrmFmt *pDrvdFrm )
266 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_DRAWFRMFMT ),
267 pSdrObjCached(NULL),
268 // --> OD 2004-07-28 #i31698#
269 meLayoutDir( SwFrmFmt::HORI_L2R ),
270 // <--
271 // --> OD 2004-08-06 #i28749#
272 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010#
273 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ),
274 // <--
275 // --> OD 2005-03-11 #i44334#, #i44681#
276 mbPosAttrSet( false )
277 // <--
280 public:
281 TYPEINFO();
282 ~SwDrawFrmFmt();
284 //DrawObjecte werden aus den Arrays am Layout entfernt. Die DrawObjecte
285 //werden als geloescht gekennzeichnet.
286 virtual void DelFrms();
288 //Anmelden der DrawObjecte in den Arrays am Layout. Loeschkennzeichen
289 //werden zurueckgesetzt.
290 virtual void MakeFrms();
292 virtual Graphic MakeGraphic( ImageMap* pMap = NULL );
294 // --> OD 2004-07-27 #i31698#
295 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const;
296 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir );
297 // <--
299 // --> OD 2004-08-06 #i28749#
300 virtual sal_Int16 GetPositionLayoutDir() const;
301 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
302 // <--
304 // --> OD 2005-03-11 #i44334#, #i44681#
305 inline bool IsPosAttrSet() const { return mbPosAttrSet; }
306 inline void PosAttrSet() { mbPosAttrSet = true; }
307 // <--
309 // --> OD 2005-08-16 #i53320#
310 inline void ResetPosAttr()
312 mbPosAttrSet = false;
314 // <--
316 virtual String GetDescription() const;
318 DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt);
322 #endif