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