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