1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _FRMFMT_HXX 24 #define _FRMFMT_HXX 25 26 #include <com/sun/star/text/PositionLayoutDir.hpp> 27 #include <cppuhelper/weakref.hxx> 28 #include <tools/gen.hxx> 29 #include <format.hxx> 30 #include "swdllapi.h" 31 32 class SwFlyFrm; 33 class SwAnchoredObject; 34 class Graphic; 35 class Point; 36 class ImageMap; 37 class IMapObject; 38 class SwRect; 39 class SwContact; 40 class SdrObject; 41 42 class SW_DLLPUBLIC SwFrmFmt: public SwFmt 43 { 44 friend class SwDoc; 45 friend class SwPageDesc; //darf den protected CTor rufen. 46 47 ::com::sun::star::uno::WeakReference< 48 ::com::sun::star::uno::XInterface> m_wXObject; 49 50 //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage 51 drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes; 52 53 protected: 54 SwFrmFmt* pCaptionFmt; 55 56 SwFrmFmt( 57 SwAttrPool& rPool, 58 const sal_Char* pFmtNm, 59 SwFrmFmt *pDrvdFrm, 60 sal_uInt16 nFmtWhich = RES_FRMFMT, 61 const sal_uInt16* pWhichRange = 0); 62 63 SwFrmFmt( 64 SwAttrPool& rPool, 65 const String &rFmtNm, 66 SwFrmFmt *pDrvdFrm, 67 sal_uInt16 nFmtWhich = RES_FRMFMT, 68 const sal_uInt16* pWhichRange = 0); 69 70 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue ); 71 72 public: 73 TYPEINFO(); //Bereits in Basisklasse Client drin. 74 //UUUU 75 ~SwFrmFmt(); 76 77 //Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt). 78 virtual void DelFrms(); 79 80 //Erzeugt die Ansichten 81 virtual void MakeFrms(); 82 83 virtual Graphic MakeGraphic( ImageMap* pMap = NULL ); 84 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; 91 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 sal_Bool bPrtArea = sal_False, 96 const Point* pPoint = 0, 97 const sal_Bool bCalcFrm = sal_False ) const; 98 99 // Sucht das SdrObject. Der SdrObjUserCall ist Client vom Format. 100 // Der UserCall kennt sein SdrObject. 101 SwContact *FindContactObj(); FindContactObj() const102 const SwContact *FindContactObj() const 103 { return ((SwFrmFmt*)this)->FindContactObj(); } 104 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(); FindSdrObject() const110 const SdrObject *FindSdrObject() const 111 { return ((SwFrmFmt*)this)->FindSdrObject(); } 112 113 SdrObject *FindRealSdrObject(); FindRealSdrObject() const114 const SdrObject *FindRealSdrObject() const 115 { return ((SwFrmFmt*)this)->FindRealSdrObject(); } 116 117 sal_Bool IsLowerOf( const SwFrmFmt& rFmt ) const; 118 119 // --> OD 2004-07-27 #i31698# 120 enum tLayoutDir 121 { 122 HORI_L2R, 123 HORI_R2L, 124 VERT_R2L, 125 VERT_L2R // not supported yet 126 }; 127 128 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const; 129 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir ); 130 // <-- 131 132 // --> OD 2004-08-06 #i28749# 133 virtual sal_Int16 GetPositionLayoutDir() const; 134 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ); 135 // <-- 136 137 virtual String GetDescription() const; 138 sal_Bool HasCaption() const; 139 void SetCaptionFmt(SwFrmFmt* pFmt); 140 SwFrmFmt* GetCaptionFmt() const; 141 142 SW_DLLPRIVATE ::com::sun::star::uno::WeakReference< GetXObject() const143 ::com::sun::star::uno::XInterface> const& GetXObject() const 144 { return m_wXObject; } SetXObject(::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> const & xObject)145 SW_DLLPRIVATE void SetXObject(::com::sun::star::uno::Reference< 146 ::com::sun::star::uno::XInterface> const& xObject) 147 { m_wXObject = xObject; } 148 149 DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt) 150 void RegisterToFormat( SwFmt& rFmt ); 151 152 //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage 153 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; 154 }; 155 156 //Das FlyFrame-Format ------------------------------ 157 158 class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt 159 { 160 friend class SwDoc; 161 String msTitle; 162 String msDesc; 163 164 // #i972: 165 // it stores the previous position of Prt rectangle from RequestObjectResize 166 // so it can be used to move frames of non-resizable objects to align them correctly 167 // when they get borders (this is done in SwWrtShell::CalcAndGetScale) 168 Point m_aLastFlyFrmPrtRectPos; 169 170 //Beide nicht vorhanden. 171 SwFlyFrmFmt( const SwFlyFrmFmt &rCpy ); 172 SwFlyFrmFmt &operator=( const SwFlyFrmFmt &rCpy ); 173 174 protected: SwFlyFrmFmt(SwAttrPool & rPool,const sal_Char * pFmtNm,SwFrmFmt * pDrvdFrm)175 SwFlyFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm, 176 SwFrmFmt *pDrvdFrm ) 177 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FLYFRMFMT ) 178 {} SwFlyFrmFmt(SwAttrPool & rPool,const String & rFmtNm,SwFrmFmt * pDrvdFrm)179 SwFlyFrmFmt( SwAttrPool& rPool, const String &rFmtNm, 180 SwFrmFmt *pDrvdFrm ) 181 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FLYFRMFMT ) 182 {} 183 184 public: 185 TYPEINFO(); 186 ~SwFlyFrmFmt(); 187 188 //Erzeugt die Ansichten 189 virtual void MakeFrms(); 190 191 SwFlyFrm* GetFrm( const Point* pDocPos = 0, 192 const sal_Bool bCalcFrm = sal_False ) const; 193 194 SwAnchoredObject* GetAnchoredObj( const Point* pDocPos = 0, 195 const sal_Bool bCalcFrm = sal_False ) const; 196 197 virtual Graphic MakeGraphic( ImageMap* pMap = NULL ); 198 199 virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const; 200 201 // --> OD 2009-07-14 #i73249# 202 const String GetObjTitle() const; 203 void SetObjTitle( const String& rTitle, 204 bool bBroadcast = false ); 205 const String GetObjDescription() const; 206 void SetObjDescription( const String& rDescription, 207 bool bBroadcast = false ); 208 bool IsObjDecorative() const; 209 void SetObjDecorative( bool bDecorative ); 210 // <-- 211 212 /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657# 213 214 OD 22.08.2002 - overloading virtual method and its default implementation, 215 because format of fly frame provides transparent backgrounds. 216 Method determines, if background of fly frame is transparent. 217 218 @author OD 219 220 @return true, if background color is transparent, but not "no fill" 221 or a existing background graphic is transparent. 222 */ 223 virtual sal_Bool IsBackgroundTransparent() const; 224 225 /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898# 226 227 OD 08.10.2002 - method to determine, if the brush for drawing the 228 background is "inherited" from its parent/grandparent. 229 This is the case, if no background graphic is set and the background 230 color is "no fill"/"auto fill" 231 232 @author OD 233 234 @return true, if background brush is "inherited" from parent/grandparent 235 */ 236 sal_Bool IsBackgroundBrushInherited() const; 237 GetLastFlyFrmPrtRectPos() const238 const Point & GetLastFlyFrmPrtRectPos() const { return m_aLastFlyFrmPrtRectPos; } SetLastFlyFrmPrtRectPos(const Point & rPoint)239 void SetLastFlyFrmPrtRectPos( const Point &rPoint ) { m_aLastFlyFrmPrtRectPos = rPoint; } 240 241 DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt) 242 }; 243 244 //Das DrawFrame-Format ----------------------------- 245 246 class SW_DLLPUBLIC SwDrawFrmFmt: public SwFrmFmt 247 { 248 friend class SwDoc; 249 250 mutable const SdrObject * pSdrObjCached; 251 mutable String sSdrObjCachedComment; 252 253 //Beide nicht vorhanden. 254 SwDrawFrmFmt( const SwDrawFrmFmt &rCpy ); 255 SwDrawFrmFmt &operator=( const SwDrawFrmFmt &rCpy ); 256 257 // --> OD 2004-07-27 #i31698# 258 SwFrmFmt::tLayoutDir meLayoutDir; 259 // <-- 260 // --> OD 2004-08-06 #i28749# 261 sal_Int16 mnPositionLayoutDir; 262 // <-- 263 // --> OD 2005-03-11 #i44334#, #i44681# 264 bool mbPosAttrSet; 265 // <-- 266 protected: SwDrawFrmFmt(SwAttrPool & rPool,const sal_Char * pFmtNm,SwFrmFmt * pDrvdFrm)267 SwDrawFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm, 268 SwFrmFmt *pDrvdFrm ) 269 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_DRAWFRMFMT ), 270 pSdrObjCached(NULL), 271 // --> OD 2004-07-28 #i31698# 272 meLayoutDir( SwFrmFmt::HORI_L2R ), 273 // <-- 274 // --> OD 2004-08-06 #i28749# 275 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010# 276 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), 277 // <-- 278 // --> OD 2005-03-11 #i44334#, #i44681# 279 mbPosAttrSet( false ) 280 // <-- 281 282 {} SwDrawFrmFmt(SwAttrPool & rPool,const String & rFmtNm,SwFrmFmt * pDrvdFrm)283 SwDrawFrmFmt( SwAttrPool& rPool, const String &rFmtNm, 284 SwFrmFmt *pDrvdFrm ) 285 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_DRAWFRMFMT ), 286 pSdrObjCached(NULL), 287 // --> OD 2004-07-28 #i31698# 288 meLayoutDir( SwFrmFmt::HORI_L2R ), 289 // <-- 290 // --> OD 2004-08-06 #i28749# 291 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010# 292 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), 293 // <-- 294 // --> OD 2005-03-11 #i44334#, #i44681# 295 mbPosAttrSet( false ) 296 // <-- 297 {} 298 299 public: 300 TYPEINFO(); 301 ~SwDrawFrmFmt(); 302 303 //DrawObjecte werden aus den Arrays am Layout entfernt. Die DrawObjecte 304 //werden als geloescht gekennzeichnet. 305 virtual void DelFrms(); 306 307 //Anmelden der DrawObjecte in den Arrays am Layout. Loeschkennzeichen 308 //werden zurueckgesetzt. 309 virtual void MakeFrms(); 310 311 virtual Graphic MakeGraphic( ImageMap* pMap = NULL ); 312 313 // --> OD 2004-07-27 #i31698# 314 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const; 315 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir ); 316 // <-- 317 318 // --> OD 2004-08-06 #i28749# 319 virtual sal_Int16 GetPositionLayoutDir() const; 320 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ); 321 // <-- 322 323 // --> OD 2005-03-11 #i44334#, #i44681# IsPosAttrSet() const324 inline bool IsPosAttrSet() const { return mbPosAttrSet; } PosAttrSet()325 inline void PosAttrSet() { mbPosAttrSet = true; } 326 // <-- 327 328 // --> OD 2005-08-16 #i53320# ResetPosAttr()329 inline void ResetPosAttr() 330 { 331 mbPosAttrSet = false; 332 } 333 // <-- 334 335 virtual String GetDescription() const; 336 337 DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt); 338 }; 339 340 341 #endif 342