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