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 75 //Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt). 76 virtual void DelFrms(); 77 78 //Erzeugt die Ansichten 79 virtual void MakeFrms(); 80 81 virtual Graphic MakeGraphic( ImageMap* pMap = NULL ); 82 83 // returnt das IMapObject, das an dem Format (Fly), in der ImageMap 84 // an der Point Position definiert ist. 85 // rPoint - teste auf der DocPosition 86 // pFly - optionaler FlyFrame, falls der schon bekannt ist. 87 IMapObject* GetIMapObject( const Point& rPoint, 88 const SwFlyFrm *pFly = 0 ) const; 89 90 // Gibt die tatsaechlche Groesse des Frames zurueck bzw. ein leeres 91 // Rechteck, wenn kein Layout existiert. Wird pPoint angegeben, dann 92 // wird der am dichtesten liegende Frame gesucht. 93 SwRect FindLayoutRect( const sal_Bool bPrtArea = sal_False, 94 const Point* pPoint = 0, 95 const sal_Bool bCalcFrm = sal_False ) const; 96 97 // Sucht das SdrObject. Der SdrObjUserCall ist Client vom Format. 98 // Der UserCall kennt sein SdrObject. 99 SwContact *FindContactObj(); 100 const SwContact *FindContactObj() const 101 { return ((SwFrmFmt*)this)->FindContactObj(); } 102 103 // returns the SdrObject, that ist connected to the ContactObject. 104 // Only DrawFrmFmts are connected to the "real SdrObject". FlyFrmFmts 105 // are connected to a Master and all FlyFrms has the "real SdrObject". 106 // "Real SdrObject" has position and a Z-order. 107 SdrObject *FindSdrObject(); 108 const SdrObject *FindSdrObject() const 109 { return ((SwFrmFmt*)this)->FindSdrObject(); } 110 111 SdrObject *FindRealSdrObject(); 112 const SdrObject *FindRealSdrObject() const 113 { return ((SwFrmFmt*)this)->FindRealSdrObject(); } 114 115 sal_Bool IsLowerOf( const SwFrmFmt& rFmt ) const; 116 117 // --> OD 2004-07-27 #i31698# 118 enum tLayoutDir 119 { 120 HORI_L2R, 121 HORI_R2L, 122 VERT_R2L, 123 VERT_L2R // not supported yet 124 }; 125 126 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const; 127 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir ); 128 // <-- 129 130 // --> OD 2004-08-06 #i28749# 131 virtual sal_Int16 GetPositionLayoutDir() const; 132 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ); 133 // <-- 134 135 virtual String GetDescription() const; 136 sal_Bool HasCaption() const; 137 void SetCaptionFmt(SwFrmFmt* pFmt); 138 SwFrmFmt* GetCaptionFmt() const; 139 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; } 146 147 DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt) 148 void RegisterToFormat( SwFmt& rFmt ); 149 150 //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage 151 virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; 152 }; 153 154 //Das FlyFrame-Format ------------------------------ 155 156 class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt 157 { 158 friend class SwDoc; 159 String msTitle; 160 String msDesc; 161 162 // #i972: 163 // it stores the previous position of Prt rectangle from RequestObjectResize 164 // so it can be used to move frames of non-resizable objects to align them correctly 165 // when they get borders (this is done in SwWrtShell::CalcAndGetScale) 166 Point m_aLastFlyFrmPrtRectPos; 167 168 //Beide nicht vorhanden. 169 SwFlyFrmFmt( const SwFlyFrmFmt &rCpy ); 170 SwFlyFrmFmt &operator=( const SwFlyFrmFmt &rCpy ); 171 172 protected: 173 SwFlyFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm, 174 SwFrmFmt *pDrvdFrm ) 175 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FLYFRMFMT ) 176 {} 177 SwFlyFrmFmt( SwAttrPool& rPool, const String &rFmtNm, 178 SwFrmFmt *pDrvdFrm ) 179 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FLYFRMFMT ) 180 {} 181 182 public: 183 TYPEINFO(); 184 ~SwFlyFrmFmt(); 185 186 //Erzeugt die Ansichten 187 virtual void MakeFrms(); 188 189 SwFlyFrm* GetFrm( const Point* pDocPos = 0, 190 const sal_Bool bCalcFrm = sal_False ) const; 191 192 SwAnchoredObject* GetAnchoredObj( const Point* pDocPos = 0, 193 const sal_Bool bCalcFrm = sal_False ) const; 194 195 virtual Graphic MakeGraphic( ImageMap* pMap = NULL ); 196 197 virtual sal_Bool GetInfo( SfxPoolItem& rInfo ) const; 198 199 // --> OD 2009-07-14 #i73249# 200 const String GetObjTitle() const; 201 void SetObjTitle( const String& rTitle, 202 bool bBroadcast = false ); 203 const String GetObjDescription() const; 204 void SetObjDescription( const String& rDescription, 205 bool bBroadcast = false ); 206 // <-- 207 208 /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657# 209 210 OD 22.08.2002 - overloading virtual method and its default implementation, 211 because format of fly frame provides transparent backgrounds. 212 Method determines, if background of fly frame is transparent. 213 214 @author OD 215 216 @return true, if background color is transparent, but not "no fill" 217 or a existing background graphic is transparent. 218 */ 219 virtual sal_Bool IsBackgroundTransparent() const; 220 221 /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898# 222 223 OD 08.10.2002 - method to determine, if the brush for drawing the 224 background is "inherited" from its parent/grandparent. 225 This is the case, if no background graphic is set and the background 226 color is "no fill"/"auto fill" 227 228 @author OD 229 230 @return true, if background brush is "inherited" from parent/grandparent 231 */ 232 sal_Bool IsBackgroundBrushInherited() const; 233 234 const Point & GetLastFlyFrmPrtRectPos() const { return m_aLastFlyFrmPrtRectPos; } 235 void SetLastFlyFrmPrtRectPos( const Point &rPoint ) { m_aLastFlyFrmPrtRectPos = rPoint; } 236 237 DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt) 238 }; 239 240 //Das DrawFrame-Format ----------------------------- 241 242 class SW_DLLPUBLIC SwDrawFrmFmt: public SwFrmFmt 243 { 244 friend class SwDoc; 245 246 mutable const SdrObject * pSdrObjCached; 247 mutable String sSdrObjCachedComment; 248 249 //Beide nicht vorhanden. 250 SwDrawFrmFmt( const SwDrawFrmFmt &rCpy ); 251 SwDrawFrmFmt &operator=( const SwDrawFrmFmt &rCpy ); 252 253 // --> OD 2004-07-27 #i31698# 254 SwFrmFmt::tLayoutDir meLayoutDir; 255 // <-- 256 // --> OD 2004-08-06 #i28749# 257 sal_Int16 mnPositionLayoutDir; 258 // <-- 259 // --> OD 2005-03-11 #i44334#, #i44681# 260 bool mbPosAttrSet; 261 // <-- 262 protected: 263 SwDrawFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm, 264 SwFrmFmt *pDrvdFrm ) 265 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_DRAWFRMFMT ), 266 pSdrObjCached(NULL), 267 // --> OD 2004-07-28 #i31698# 268 meLayoutDir( SwFrmFmt::HORI_L2R ), 269 // <-- 270 // --> OD 2004-08-06 #i28749# 271 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010# 272 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), 273 // <-- 274 // --> OD 2005-03-11 #i44334#, #i44681# 275 mbPosAttrSet( false ) 276 // <-- 277 278 {} 279 SwDrawFrmFmt( SwAttrPool& rPool, const String &rFmtNm, 280 SwFrmFmt *pDrvdFrm ) 281 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_DRAWFRMFMT ), 282 pSdrObjCached(NULL), 283 // --> OD 2004-07-28 #i31698# 284 meLayoutDir( SwFrmFmt::HORI_L2R ), 285 // <-- 286 // --> OD 2004-08-06 #i28749# 287 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010# 288 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), 289 // <-- 290 // --> OD 2005-03-11 #i44334#, #i44681# 291 mbPosAttrSet( false ) 292 // <-- 293 {} 294 295 public: 296 TYPEINFO(); 297 ~SwDrawFrmFmt(); 298 299 //DrawObjecte werden aus den Arrays am Layout entfernt. Die DrawObjecte 300 //werden als geloescht gekennzeichnet. 301 virtual void DelFrms(); 302 303 //Anmelden der DrawObjecte in den Arrays am Layout. Loeschkennzeichen 304 //werden zurueckgesetzt. 305 virtual void MakeFrms(); 306 307 virtual Graphic MakeGraphic( ImageMap* pMap = NULL ); 308 309 // --> OD 2004-07-27 #i31698# 310 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const; 311 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir ); 312 // <-- 313 314 // --> OD 2004-08-06 #i28749# 315 virtual sal_Int16 GetPositionLayoutDir() const; 316 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ); 317 // <-- 318 319 // --> OD 2005-03-11 #i44334#, #i44681# 320 inline bool IsPosAttrSet() const { return mbPosAttrSet; } 321 inline void PosAttrSet() { mbPosAttrSet = true; } 322 // <-- 323 324 // --> OD 2005-08-16 #i53320# 325 inline void ResetPosAttr() 326 { 327 mbPosAttrSet = false; 328 } 329 // <-- 330 331 virtual String GetDescription() const; 332 333 DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt); 334 }; 335 336 337 #endif 338 339