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 // <-- 209 210 /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657# 211 212 OD 22.08.2002 - overloading virtual method and its default implementation, 213 because format of fly frame provides transparent backgrounds. 214 Method determines, if background of fly frame is transparent. 215 216 @author OD 217 218 @return true, if background color is transparent, but not "no fill" 219 or a existing background graphic is transparent. 220 */ 221 virtual sal_Bool IsBackgroundTransparent() const; 222 223 /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898# 224 225 OD 08.10.2002 - method to determine, if the brush for drawing the 226 background is "inherited" from its parent/grandparent. 227 This is the case, if no background graphic is set and the background 228 color is "no fill"/"auto fill" 229 230 @author OD 231 232 @return true, if background brush is "inherited" from parent/grandparent 233 */ 234 sal_Bool IsBackgroundBrushInherited() const; 235 GetLastFlyFrmPrtRectPos() const236 const Point & GetLastFlyFrmPrtRectPos() const { return m_aLastFlyFrmPrtRectPos; } SetLastFlyFrmPrtRectPos(const Point & rPoint)237 void SetLastFlyFrmPrtRectPos( const Point &rPoint ) { m_aLastFlyFrmPrtRectPos = rPoint; } 238 239 DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt) 240 }; 241 242 //Das DrawFrame-Format ----------------------------- 243 244 class SW_DLLPUBLIC SwDrawFrmFmt: public SwFrmFmt 245 { 246 friend class SwDoc; 247 248 mutable const SdrObject * pSdrObjCached; 249 mutable String sSdrObjCachedComment; 250 251 //Beide nicht vorhanden. 252 SwDrawFrmFmt( const SwDrawFrmFmt &rCpy ); 253 SwDrawFrmFmt &operator=( const SwDrawFrmFmt &rCpy ); 254 255 // --> OD 2004-07-27 #i31698# 256 SwFrmFmt::tLayoutDir meLayoutDir; 257 // <-- 258 // --> OD 2004-08-06 #i28749# 259 sal_Int16 mnPositionLayoutDir; 260 // <-- 261 // --> OD 2005-03-11 #i44334#, #i44681# 262 bool mbPosAttrSet; 263 // <-- 264 protected: SwDrawFrmFmt(SwAttrPool & rPool,const sal_Char * pFmtNm,SwFrmFmt * pDrvdFrm)265 SwDrawFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm, 266 SwFrmFmt *pDrvdFrm ) 267 : SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_DRAWFRMFMT ), 268 pSdrObjCached(NULL), 269 // --> OD 2004-07-28 #i31698# 270 meLayoutDir( SwFrmFmt::HORI_L2R ), 271 // <-- 272 // --> OD 2004-08-06 #i28749# 273 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010# 274 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), 275 // <-- 276 // --> OD 2005-03-11 #i44334#, #i44681# 277 mbPosAttrSet( false ) 278 // <-- 279 280 {} SwDrawFrmFmt(SwAttrPool & rPool,const String & rFmtNm,SwFrmFmt * pDrvdFrm)281 SwDrawFrmFmt( SwAttrPool& rPool, const String &rFmtNm, 282 SwFrmFmt *pDrvdFrm ) 283 : SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_DRAWFRMFMT ), 284 pSdrObjCached(NULL), 285 // --> OD 2004-07-28 #i31698# 286 meLayoutDir( SwFrmFmt::HORI_L2R ), 287 // <-- 288 // --> OD 2004-08-06 #i28749# 289 // --> OD 2005-03-10 #i44344#, #i44681# - undo change of issue #i36010# 290 mnPositionLayoutDir( com::sun::star::text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), 291 // <-- 292 // --> OD 2005-03-11 #i44334#, #i44681# 293 mbPosAttrSet( false ) 294 // <-- 295 {} 296 297 public: 298 TYPEINFO(); 299 ~SwDrawFrmFmt(); 300 301 //DrawObjecte werden aus den Arrays am Layout entfernt. Die DrawObjecte 302 //werden als geloescht gekennzeichnet. 303 virtual void DelFrms(); 304 305 //Anmelden der DrawObjecte in den Arrays am Layout. Loeschkennzeichen 306 //werden zurueckgesetzt. 307 virtual void MakeFrms(); 308 309 virtual Graphic MakeGraphic( ImageMap* pMap = NULL ); 310 311 // --> OD 2004-07-27 #i31698# 312 virtual SwFrmFmt::tLayoutDir GetLayoutDir() const; 313 virtual void SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir ); 314 // <-- 315 316 // --> OD 2004-08-06 #i28749# 317 virtual sal_Int16 GetPositionLayoutDir() const; 318 virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir ); 319 // <-- 320 321 // --> OD 2005-03-11 #i44334#, #i44681# IsPosAttrSet() const322 inline bool IsPosAttrSet() const { return mbPosAttrSet; } PosAttrSet()323 inline void PosAttrSet() { mbPosAttrSet = true; } 324 // <-- 325 326 // --> OD 2005-08-16 #i53320# ResetPosAttr()327 inline void ResetPosAttr() 328 { 329 mbPosAttrSet = false; 330 } 331 // <-- 332 333 virtual String GetDescription() const; 334 335 DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt); 336 }; 337 338 339 #endif 340 341