1*353d8f4dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*353d8f4dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*353d8f4dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*353d8f4dSAndrew Rist * distributed with this work for additional information 6*353d8f4dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*353d8f4dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*353d8f4dSAndrew Rist * "License"); you may not use this file except in compliance 9*353d8f4dSAndrew Rist * with the License. You may obtain a copy of the License at 10*353d8f4dSAndrew Rist * 11*353d8f4dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*353d8f4dSAndrew Rist * 13*353d8f4dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*353d8f4dSAndrew Rist * software distributed under the License is distributed on an 15*353d8f4dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*353d8f4dSAndrew Rist * KIND, either express or implied. See the License for the 17*353d8f4dSAndrew Rist * specific language governing permissions and limitations 18*353d8f4dSAndrew Rist * under the License. 19*353d8f4dSAndrew Rist * 20*353d8f4dSAndrew Rist *************************************************************/ 21*353d8f4dSAndrew Rist 22*353d8f4dSAndrew Rist 23cdf0e10cSrcweir #ifndef _SFX_FRMDESCRHXX 24cdf0e10cSrcweir #define _SFX_FRMDESCRHXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "sal/config.h" 27cdf0e10cSrcweir #include "sfx2/dllapi.h" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <sfx2/sfxsids.hrc> 30cdf0e10cSrcweir #include <svl/poolitem.hxx> 31cdf0e10cSrcweir #include <tools/urlobj.hxx> 32cdf0e10cSrcweir #include <tools/string.hxx> 33cdf0e10cSrcweir #include <svl/svarray.hxx> 34cdf0e10cSrcweir #include <tools/gen.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir class SvStream; 37cdf0e10cSrcweir struct SfxFrameDescriptor_Impl; 38cdf0e10cSrcweir class SvStrings; 39cdf0e10cSrcweir class SfxFrameDescriptor; 40cdf0e10cSrcweir class Wallpaper; 41cdf0e10cSrcweir typedef SfxFrameDescriptor* SfxFrameDescriptorPtr; 42cdf0e10cSrcweir SV_DECL_PTRARR(SfxFramesArr, SfxFrameDescriptorPtr, 4, 2) 43cdf0e10cSrcweir 44cdf0e10cSrcweir //=========================================================================== 45cdf0e10cSrcweir // Die SfxFrame...descriptoren bauen eine rekursive Struktur auf, die 46cdf0e10cSrcweir // s"amtliche zur Anzeige des Frame-Dokuments erforderlichen Daten umfa\st. 47cdf0e10cSrcweir // "Uber einen SfxFrameSetDescriptor hat man Zugriff auf die gesamte darunter 48cdf0e10cSrcweir // liegende Struktur. 49cdf0e10cSrcweir // Aufgrund der besonderen Eigenschaften des SfxFrames-Dokuments ist ein 50cdf0e10cSrcweir // SfxFramesSetDescriptor nicht nur der Inhalt dieses Dokuments, sondern 51cdf0e10cSrcweir // beschreibt auch die View darauf. 52cdf0e10cSrcweir // Das FrameSet wird aus Zeilen aufgebaut, die wiederum die eigentlichen 53cdf0e10cSrcweir // Fenster enthalten. Eine Zeile kann horizontal oder vertikal ausgerichtet 54cdf0e10cSrcweir // sein, woraus sich auch das Alignment des FrameSets ergibt. 55cdf0e10cSrcweir //=========================================================================== 56cdf0e10cSrcweir 57cdf0e10cSrcweir enum ScrollingMode 58cdf0e10cSrcweir { 59cdf0e10cSrcweir ScrollingYes, 60cdf0e10cSrcweir ScrollingNo, 61cdf0e10cSrcweir ScrollingAuto 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir enum SizeSelector 65cdf0e10cSrcweir { 66cdf0e10cSrcweir SIZE_ABS, 67cdf0e10cSrcweir SIZE_PERCENT, 68cdf0e10cSrcweir SIZE_REL 69cdf0e10cSrcweir }; 70cdf0e10cSrcweir 71cdf0e10cSrcweir #define BORDER_SET 2 72cdf0e10cSrcweir #define BORDER_YES 1 73cdf0e10cSrcweir #define BORDER_NO 0 74cdf0e10cSrcweir #define SPACING_NOT_SET -1L 75cdf0e10cSrcweir #define SIZE_NOT_SET -1L 76cdf0e10cSrcweir 77cdf0e10cSrcweir class SfxItemSet; 78cdf0e10cSrcweir struct SfxFrameProperties; 79cdf0e10cSrcweir 80cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxFrameDescriptor 81cdf0e10cSrcweir { 82cdf0e10cSrcweir INetURLObject aURL; 83cdf0e10cSrcweir INetURLObject aActualURL; 84cdf0e10cSrcweir String aName; 85cdf0e10cSrcweir Size aMargin; 86cdf0e10cSrcweir long nWidth; 87cdf0e10cSrcweir ScrollingMode eScroll; 88cdf0e10cSrcweir SizeSelector eSizeSelector; 89cdf0e10cSrcweir sal_uInt16 nHasBorder; 90cdf0e10cSrcweir sal_uInt16 nItemId; 91cdf0e10cSrcweir sal_Bool bResizeHorizontal; 92cdf0e10cSrcweir sal_Bool bResizeVertical; 93cdf0e10cSrcweir sal_Bool bHasUI; 94cdf0e10cSrcweir sal_Bool bReadOnly; 95cdf0e10cSrcweir SfxFrameDescriptor_Impl* pImp; 96cdf0e10cSrcweir SvStrings* pScripts; 97cdf0e10cSrcweir SvStrings* pComments; 98cdf0e10cSrcweir 99cdf0e10cSrcweir public: 100cdf0e10cSrcweir SfxFrameDescriptor(); 101cdf0e10cSrcweir ~SfxFrameDescriptor(); 102cdf0e10cSrcweir 103cdf0e10cSrcweir // Eigenschaften 104cdf0e10cSrcweir void TakeProperties( const SfxFrameProperties& rProp ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir // FileName/URL 107cdf0e10cSrcweir SfxItemSet* GetArgs(); GetURL() const108cdf0e10cSrcweir const INetURLObject& GetURL() const 109cdf0e10cSrcweir { return aURL; } 110cdf0e10cSrcweir void SetURL( const INetURLObject& rURL ); 111cdf0e10cSrcweir void SetURL( const String& rURL ); GetActualURL() const112cdf0e10cSrcweir const INetURLObject& GetActualURL() const 113cdf0e10cSrcweir { return aActualURL; } 114cdf0e10cSrcweir void SetActualURL( const INetURLObject& rURL ); 115cdf0e10cSrcweir void SetActualURL( const String& rURL ); 116cdf0e10cSrcweir sal_Bool CheckContent() const; 117cdf0e10cSrcweir sal_Bool CompareOriginal( SfxFrameDescriptor& rSet ) const; 118cdf0e10cSrcweir void UnifyContent( sal_Bool ); SetReadOnly(sal_Bool bSet)119cdf0e10cSrcweir void SetReadOnly( sal_Bool bSet ) { bReadOnly = bSet;} IsReadOnly() const120cdf0e10cSrcweir sal_Bool IsReadOnly( ) const { return bReadOnly;} 121cdf0e10cSrcweir void SetEditable( sal_Bool bSet ); 122cdf0e10cSrcweir sal_Bool IsEditable() const; 123cdf0e10cSrcweir 124cdf0e10cSrcweir // Size SetWidth(long n)125cdf0e10cSrcweir void SetWidth( long n ) 126cdf0e10cSrcweir { nWidth = n; } SetWidthPercent(long n)127cdf0e10cSrcweir void SetWidthPercent( long n ) 128cdf0e10cSrcweir { nWidth = n; eSizeSelector = SIZE_PERCENT; } SetWidthRel(long n)129cdf0e10cSrcweir void SetWidthRel( long n ) 130cdf0e10cSrcweir { nWidth = n; eSizeSelector = SIZE_REL; } SetWidthAbs(long n)131cdf0e10cSrcweir void SetWidthAbs( long n ) 132cdf0e10cSrcweir { nWidth = n; eSizeSelector = SIZE_ABS; } GetWidth() const133cdf0e10cSrcweir long GetWidth() const 134cdf0e10cSrcweir { return nWidth; } GetSizeSelector() const135cdf0e10cSrcweir SizeSelector GetSizeSelector() const 136cdf0e10cSrcweir { return eSizeSelector; } IsResizable() const137cdf0e10cSrcweir sal_Bool IsResizable() const 138cdf0e10cSrcweir { return bResizeHorizontal && bResizeVertical; } SetResizable(sal_Bool bRes)139cdf0e10cSrcweir void SetResizable( sal_Bool bRes ) 140cdf0e10cSrcweir { bResizeHorizontal = bResizeVertical = bRes; } 141cdf0e10cSrcweir 142cdf0e10cSrcweir // FrameName GetName() const143cdf0e10cSrcweir const String& GetName() const 144cdf0e10cSrcweir { return aName; } SetName(const String & rName)145cdf0e10cSrcweir void SetName( const String& rName ) 146cdf0e10cSrcweir { aName = rName; } 147cdf0e10cSrcweir 148cdf0e10cSrcweir // Margin, Scrolling GetMargin() const149cdf0e10cSrcweir const Size& GetMargin() const 150cdf0e10cSrcweir { return aMargin; } SetMargin(const Size & rMargin)151cdf0e10cSrcweir void SetMargin( const Size& rMargin ) 152cdf0e10cSrcweir { aMargin = rMargin; } GetScrollingMode() const153cdf0e10cSrcweir ScrollingMode GetScrollingMode() const 154cdf0e10cSrcweir { return eScroll; } SetScrollingMode(ScrollingMode eMode)155cdf0e10cSrcweir void SetScrollingMode( ScrollingMode eMode ) 156cdf0e10cSrcweir { eScroll = eMode; } 157cdf0e10cSrcweir 158cdf0e10cSrcweir // FrameBorder 159cdf0e10cSrcweir void SetWallpaper( const Wallpaper& rWallpaper ); 160cdf0e10cSrcweir const Wallpaper* GetWallpaper() const; 161cdf0e10cSrcweir sal_Bool HasFrameBorder() const; 162cdf0e10cSrcweir IsFrameBorderOn() const163cdf0e10cSrcweir sal_Bool IsFrameBorderOn() const 164cdf0e10cSrcweir { return ( nHasBorder & BORDER_YES ) != 0; } 165cdf0e10cSrcweir SetFrameBorder(sal_Bool bBorder)166cdf0e10cSrcweir void SetFrameBorder( sal_Bool bBorder ) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir nHasBorder = bBorder ? 169cdf0e10cSrcweir BORDER_YES | BORDER_SET : 170cdf0e10cSrcweir BORDER_NO | BORDER_SET; 171cdf0e10cSrcweir } IsFrameBorderSet() const172cdf0e10cSrcweir sal_Bool IsFrameBorderSet() const 173cdf0e10cSrcweir { return (nHasBorder & BORDER_SET) != 0; } ResetBorder()174cdf0e10cSrcweir void ResetBorder() 175cdf0e10cSrcweir { nHasBorder = 0; } 176cdf0e10cSrcweir HasUI() const177cdf0e10cSrcweir sal_Bool HasUI() const 178cdf0e10cSrcweir { return bHasUI; } SetHasUI(sal_Bool bOn)179cdf0e10cSrcweir void SetHasUI( sal_Bool bOn ) 180cdf0e10cSrcweir { bHasUI = bOn; } 181cdf0e10cSrcweir 182cdf0e10cSrcweir // Attribute f"ur das Splitwindow GetItemId() const183cdf0e10cSrcweir sal_uInt16 GetItemId() const 184cdf0e10cSrcweir { return nItemId; } SetItemId(sal_uInt16 nId)185cdf0e10cSrcweir void SetItemId( sal_uInt16 nId ) 186cdf0e10cSrcweir { nItemId = nId; } 187cdf0e10cSrcweir sal_uInt16 GetWinBits() const; 188cdf0e10cSrcweir long GetSize() const; 189cdf0e10cSrcweir sal_uInt16 GetItemPos() const; 190cdf0e10cSrcweir 191cdf0e10cSrcweir // Kopie z.B. f"ur die Views 192cdf0e10cSrcweir SfxFrameDescriptor* Clone( sal_Bool bWithIds = sal_True ) const; 193cdf0e10cSrcweir }; 194cdf0e10cSrcweir 195cdf0e10cSrcweir // Kein Bock, einen operator= zu implementieren... 196cdf0e10cSrcweir struct SfxFrameProperties 197cdf0e10cSrcweir { 198cdf0e10cSrcweir String aURL; 199cdf0e10cSrcweir String aName; 200cdf0e10cSrcweir long lMarginWidth; 201cdf0e10cSrcweir long lMarginHeight; 202cdf0e10cSrcweir long lSize; 203cdf0e10cSrcweir long lSetSize; 204cdf0e10cSrcweir long lFrameSpacing; 205cdf0e10cSrcweir long lInheritedFrameSpacing; 206cdf0e10cSrcweir ScrollingMode eScroll; 207cdf0e10cSrcweir SizeSelector eSizeSelector; 208cdf0e10cSrcweir SizeSelector eSetSizeSelector; 209cdf0e10cSrcweir sal_Bool bHasBorder; 210cdf0e10cSrcweir sal_Bool bBorderSet; 211cdf0e10cSrcweir sal_Bool bResizable; 212cdf0e10cSrcweir sal_Bool bSetResizable; 213cdf0e10cSrcweir sal_Bool bIsRootSet; 214cdf0e10cSrcweir sal_Bool bIsInColSet; 215cdf0e10cSrcweir sal_Bool bHasBorderInherited; 216cdf0e10cSrcweir SfxFrameDescriptor* pFrame; 217cdf0e10cSrcweir 218cdf0e10cSrcweir private: SfxFramePropertiesSfxFrameProperties219cdf0e10cSrcweir SfxFrameProperties( SfxFrameProperties& ) {} 220cdf0e10cSrcweir public: SfxFramePropertiesSfxFrameProperties221cdf0e10cSrcweir SfxFrameProperties() 222cdf0e10cSrcweir : lMarginWidth( SIZE_NOT_SET ), 223cdf0e10cSrcweir lMarginHeight( SIZE_NOT_SET ), 224cdf0e10cSrcweir lSize( 1L ), 225cdf0e10cSrcweir lSetSize( 1L ), 226cdf0e10cSrcweir lFrameSpacing( SPACING_NOT_SET ), 227cdf0e10cSrcweir lInheritedFrameSpacing( SPACING_NOT_SET ), 228cdf0e10cSrcweir eScroll( ScrollingAuto ), 229cdf0e10cSrcweir eSizeSelector( SIZE_REL ), 230cdf0e10cSrcweir eSetSizeSelector( SIZE_REL ), 231cdf0e10cSrcweir bHasBorder( sal_True ), 232cdf0e10cSrcweir bBorderSet( sal_True ), 233cdf0e10cSrcweir bResizable( sal_True ), 234cdf0e10cSrcweir bSetResizable( sal_True ), 235cdf0e10cSrcweir bIsRootSet( sal_False ), 236cdf0e10cSrcweir bIsInColSet( sal_False ), 237cdf0e10cSrcweir bHasBorderInherited( sal_True ), 238cdf0e10cSrcweir pFrame( 0 ) {} 239cdf0e10cSrcweir 240cdf0e10cSrcweir SfxFrameProperties( const SfxFrameDescriptor *pD ); ~SfxFramePropertiesSfxFrameProperties241cdf0e10cSrcweir ~SfxFrameProperties() { delete pFrame; } 242cdf0e10cSrcweir 243cdf0e10cSrcweir int operator ==( const SfxFrameProperties& ) const; 244cdf0e10cSrcweir SfxFrameProperties& operator =( const SfxFrameProperties &rProp ); 245cdf0e10cSrcweir }; 246cdf0e10cSrcweir 247cdf0e10cSrcweir class SfxFrameDescriptorItem : public SfxPoolItem 248cdf0e10cSrcweir { 249cdf0e10cSrcweir SfxFrameProperties aProperties; 250cdf0e10cSrcweir public: 251cdf0e10cSrcweir TYPEINFO(); 252cdf0e10cSrcweir SfxFrameDescriptorItem(const SfxFrameDescriptor * pD,const sal_uInt16 nId=SID_FRAMEDESCRIPTOR)253cdf0e10cSrcweir SfxFrameDescriptorItem ( const SfxFrameDescriptor *pD, const sal_uInt16 nId = SID_FRAMEDESCRIPTOR ) 254cdf0e10cSrcweir : SfxPoolItem( nId ) 255cdf0e10cSrcweir , aProperties( pD ) 256cdf0e10cSrcweir {} 257cdf0e10cSrcweir SfxFrameDescriptorItem(const sal_uInt16 nId=SID_FRAMEDESCRIPTOR)258cdf0e10cSrcweir SfxFrameDescriptorItem ( const sal_uInt16 nId = SID_FRAMEDESCRIPTOR ) 259cdf0e10cSrcweir : SfxPoolItem( nId ) 260cdf0e10cSrcweir {} 261cdf0e10cSrcweir SfxFrameDescriptorItem(const SfxFrameDescriptorItem & rCpy)262cdf0e10cSrcweir SfxFrameDescriptorItem( const SfxFrameDescriptorItem& rCpy ) 263cdf0e10cSrcweir : SfxPoolItem( rCpy ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir aProperties = rCpy.aProperties; 266cdf0e10cSrcweir } 267cdf0e10cSrcweir 268cdf0e10cSrcweir virtual ~SfxFrameDescriptorItem(); 269cdf0e10cSrcweir 270cdf0e10cSrcweir virtual int operator ==( const SfxPoolItem& ) const; 271cdf0e10cSrcweir SfxFrameDescriptorItem& operator =( const SfxFrameDescriptorItem & ); 272cdf0e10cSrcweir 273cdf0e10cSrcweir virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 274cdf0e10cSrcweir SfxMapUnit eCoreMetric, 275cdf0e10cSrcweir SfxMapUnit ePresMetric, 276cdf0e10cSrcweir UniString &rText, const IntlWrapper * = 0 ) const; 277cdf0e10cSrcweir 278cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 279cdf0e10cSrcweir //virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; 280cdf0e10cSrcweir //virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; 281cdf0e10cSrcweir //virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; 282cdf0e10cSrcweir GetProperties() const283cdf0e10cSrcweir const SfxFrameProperties& GetProperties() const 284cdf0e10cSrcweir { return aProperties; } SetProperties(const SfxFrameProperties & rProp)285cdf0e10cSrcweir void SetProperties( const SfxFrameProperties& rProp ) 286cdf0e10cSrcweir { aProperties = rProp; } 287cdf0e10cSrcweir }; 288cdf0e10cSrcweir 289cdf0e10cSrcweir #endif // #ifndef _SFX_FRMDESCRHXX 290cdf0e10cSrcweir 291