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