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 ************************************************************************/
35 // --> OD 2004-08-06 #i28749#
36 #include <com/sun/star/text/PositionLayoutDir.hpp>
41 class SwAnchoredObject
;
50 class SW_DLLPUBLIC SwFrmFmt
: public SwFmt
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!
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
),
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
),
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#
125 VERT_L2R
// not supported yet
128 virtual SwFrmFmt::tLayoutDir
GetLayoutDir() const;
129 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir
);
132 // --> OD 2004-08-06 #i28749#
133 virtual sal_Int16
GetPositionLayoutDir() const;
134 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir
);
137 virtual String
GetDescription() const;
139 DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt
)
142 //Das FlyFrame-Format ------------------------------
144 class SW_DLLPUBLIC SwFlyFrmFmt
: public SwFrmFmt
148 //Beide nicht vorhanden.
149 SwFlyFrmFmt( const SwFlyFrmFmt
&rCpy
);
150 SwFlyFrmFmt
&operator=( const SwFlyFrmFmt
&rCpy
);
153 SwFlyFrmFmt( SwAttrPool
& rPool
, const sal_Char
* pFmtNm
,
155 : SwFrmFmt( rPool
, pFmtNm
, pDrvdFrm
, RES_FLYFRMFMT
)
157 SwFlyFrmFmt( SwAttrPool
& rPool
, const String
&rFmtNm
,
159 : SwFrmFmt( rPool
, rFmtNm
, pDrvdFrm
, RES_FLYFRMFMT
)
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 );
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.
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"
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
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
;
233 // --> OD 2004-08-06 #i28749#
234 sal_Int16 mnPositionLayoutDir
;
236 // --> OD 2005-03-11 #i44334#, #i44681#
240 SwDrawFrmFmt( SwAttrPool
& rPool
, const sal_Char
* pFmtNm
,
242 : SwFrmFmt( rPool
, pFmtNm
, pDrvdFrm
, RES_DRAWFRMFMT
),
244 // --> OD 2004-07-28 #i31698#
245 meLayoutDir( SwFrmFmt::HORI_L2R
),
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
),
251 // --> OD 2005-03-11 #i44334#, #i44681#
252 mbPosAttrSet( false )
256 SwDrawFrmFmt( SwAttrPool
& rPool
, const String
&rFmtNm
,
258 : SwFrmFmt( rPool
, rFmtNm
, pDrvdFrm
, RES_DRAWFRMFMT
),
260 // --> OD 2004-07-28 #i31698#
261 meLayoutDir( SwFrmFmt::HORI_L2R
),
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
),
267 // --> OD 2005-03-11 #i44334#, #i44681#
268 mbPosAttrSet( false )
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
);
291 // --> OD 2004-08-06 #i28749#
292 virtual sal_Int16
GetPositionLayoutDir() const;
293 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir
);
296 // --> OD 2005-03-11 #i44334#, #i44681#
297 inline bool IsPosAttrSet() const { return mbPosAttrSet
; }
298 inline void PosAttrSet() { mbPosAttrSet
= true; }
301 // --> OD 2005-08-16 #i53320#
302 inline void ResetPosAttr()
304 mbPosAttrSet
= false;
308 virtual String
GetDescription() const;
310 DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt
);