Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sfx2 / frmdescr.hxx
blobdb2820e4c0c6fada077ca74ca0ddd0b1338f2c29
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: frmdescr.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SFX_FRMDESCRHXX
31 #define _SFX_FRMDESCRHXX
33 #include <bf_sfx2/sfxsids.hrc>
35 #ifndef _SFXPOOLITEM_HXX //autogen
36 #include <bf_svtools/poolitem.hxx>
37 #endif
38 #ifndef _URLOBJ_HXX //autogen
39 #include <tools/urlobj.hxx>
40 #endif
41 #ifndef _STRING_HXX //autogen
42 #include <tools/string.hxx>
43 #endif
44 #ifndef _SVARRAY_HXX //autogen
45 #include <bf_svtools/svarray.hxx>
46 #endif
47 #ifndef _SV_GEN_HXX
48 #include <tools/gen.hxx>
49 #endif
50 class SvStream;
51 class SvStrings;
52 class Wallpaper;
53 namespace binfilter {
54 class SfxItemSet;
56 struct SfxFrameDescriptor_Impl;
57 struct SfxFrameSetDescriptor_Impl;
58 class SfxFrameDescriptor;
59 typedef SfxFrameDescriptor* SfxFrameDescriptorPtr;
60 SV_DECL_PTRARR(SfxFramesArr, SfxFrameDescriptorPtr, 4, 2)//STRIP008 ;
62 //===========================================================================
63 // Die SfxFrame...descriptoren bauen eine rekursive Struktur auf, die
64 // s"amtliche zur Anzeige des Frame-Dokuments erforderlichen Daten umfa\st.
65 // "Uber einen SfxFrameSetDescriptor hat man Zugriff auf die gesamte darunter
66 // liegende Struktur.
67 // Aufgrund der besonderen Eigenschaften des SfxFrames-Dokuments ist ein
68 // SfxFramesSetDescriptor nicht nur der Inhalt dieses Dokuments, sondern
69 // beschreibt auch die View darauf.
70 // Das FrameSet wird aus Zeilen aufgebaut, die wiederum die eigentlichen
71 // Fenster enthalten. Eine Zeile kann horizontal oder vertikal ausgerichtet
72 // sein, woraus sich auch das Alignment des FrameSets ergibt.
73 //===========================================================================
75 enum ScrollingMode
77 ScrollingYes,
78 ScrollingNo,
79 ScrollingAuto
82 enum SizeSelector
84 SIZE_ABS,
85 SIZE_PERCENT,
86 SIZE_REL
89 #define BORDER_SET 2
90 #define BORDER_YES 1
91 #define BORDER_NO 0
92 #define SPACING_NOT_SET -1L
93 #define SIZE_NOT_SET -1L
95 class SfxFrameSetDescriptor
97 friend class SfxFrameDescriptor;
99 SfxFramesArr aFrames;
100 String aBitmapName;
101 SfxFrameSetDescriptor_Impl* pImp;
102 String aDocumentTitle;
103 SfxFrameDescriptor* pParentFrame;
104 long nFrameSpacing;
105 USHORT nHasBorder;
106 USHORT nMaxId;
107 BOOL bIsRoot;
108 BOOL bRowSet;
109 SvStrings* pScripts;
110 SvStrings* pComments;
113 struct SfxFrameProperties;
115 class SfxFrameDescriptor
117 friend class SfxFrameSetDescriptor;
119 SfxFrameSetDescriptor* pParentFrameSet; // Der Vater
120 SfxFrameSetDescriptor* pFrameSet; // Wenn Kinder da sind, die
121 // Set-Daten dazu
122 INetURLObject aURL;
123 INetURLObject aActualURL;
124 String aName;
125 Size aMargin;
126 long nWidth;
127 ScrollingMode eScroll;
128 SizeSelector eSizeSelector;
129 USHORT nHasBorder;
130 USHORT nItemId;
131 BOOL bResizeHorizontal;
132 BOOL bResizeVertical;
133 BOOL bHasUI;
134 BOOL bReadOnly;
135 SfxFrameDescriptor_Impl* pImp;
136 SvStrings* pScripts;
137 SvStrings* pComments;
139 public:
140 SfxFrameDescriptor(SfxFrameSetDescriptor* pSet);
141 ~SfxFrameDescriptor();
143 // Eigenschaften
145 // FileName/URL
146 const INetURLObject& GetURL() const
147 { return aURL; }
148 void SetURL( const String& rURL );
149 const INetURLObject& GetActualURL() const
150 { return aActualURL; }
151 void SetReadOnly( BOOL bSet ) { bReadOnly = bSet;}
152 BOOL IsReadOnly( ) const { return bReadOnly;}
154 // Size
155 void SetWidth( long n )
156 { nWidth = n; }
157 void SetWidthPercent( long n )
158 { nWidth = n; eSizeSelector = SIZE_PERCENT; }
159 void SetWidthRel( long n )
160 { nWidth = n; eSizeSelector = SIZE_REL; }
161 void SetWidthAbs( long n )
162 { nWidth = n; eSizeSelector = SIZE_ABS; }
163 long GetWidth() const
164 { return nWidth; }
165 SizeSelector GetSizeSelector() const
166 { return eSizeSelector; }
167 BOOL IsResizable() const
168 { return bResizeHorizontal && bResizeVertical; }
169 void SetResizable( BOOL bRes )
170 { bResizeHorizontal = bResizeVertical = bRes; }
172 // FrameName
173 const String& GetName() const
174 { return aName; }
175 void SetName( const String& rName )
176 { aName = rName; }
178 // Margin, Scrolling
179 const Size& GetMargin() const
180 { return aMargin; }
181 void SetMargin( const Size& rMargin )
182 { aMargin = rMargin; }
183 ScrollingMode GetScrollingMode() const
184 { return eScroll; }
185 void SetScrollingMode( ScrollingMode eMode )
186 { eScroll = eMode; }
188 BOOL IsFrameBorderOn() const
189 { return ( nHasBorder & BORDER_YES ) != 0; }
191 void SetFrameBorder( BOOL bBorder )
193 nHasBorder = bBorder ?
194 BORDER_YES | BORDER_SET :
195 BORDER_NO | BORDER_SET;
197 BOOL IsFrameBorderSet() const
198 { return (nHasBorder & BORDER_SET) != 0; }
199 void ResetBorder()
200 { nHasBorder = 0; }
202 BOOL HasUI() const
203 { return bHasUI; }
204 void SetHasUI( BOOL bOn )
205 { bHasUI = bOn; }
207 // Attribute f"ur das Splitwindow
208 USHORT GetItemId() const
209 { return nItemId; }
210 void SetItemId( USHORT nId )
211 { nItemId = nId; }
213 // Rekursion, Iteration
214 SfxFrameSetDescriptor* GetParent() const
215 { return pParentFrameSet; }
216 SfxFrameSetDescriptor* GetFrameSet() const
217 { return pFrameSet; }
218 void SetFrameSet( SfxFrameSetDescriptor* pSet)
220 if ( pFrameSet )
221 pFrameSet->pParentFrame = NULL;
222 pFrameSet = pSet;
223 if ( pSet )
224 pSet->pParentFrame = this;
227 // Kopie z.B. f"ur die Views
228 SfxFrameDescriptor* Clone(SfxFrameSetDescriptor *pFrame=NULL, BOOL bWithIds = TRUE ) const;
232 // Kein Bock, einen operator= zu implementieren...
233 struct SfxFrameProperties
235 String aURL;
236 String aName;
237 long lMarginWidth;
238 long lMarginHeight;
239 long lSize;
240 long lSetSize;
241 long lFrameSpacing;
242 long lInheritedFrameSpacing;
243 ScrollingMode eScroll;
244 SizeSelector eSizeSelector;
245 SizeSelector eSetSizeSelector;
246 BOOL bHasBorder;
247 BOOL bBorderSet;
248 BOOL bResizable;
249 BOOL bSetResizable;
250 BOOL bIsRootSet;
251 BOOL bIsInColSet;
252 BOOL bHasBorderInherited;
253 SfxFrameDescriptor* pFrame;
255 private:
256 SfxFrameProperties( SfxFrameProperties& ) {}
257 public:
258 SfxFrameProperties()
259 : pFrame( 0 ),
260 lMarginWidth( SIZE_NOT_SET ),
261 lMarginHeight( SIZE_NOT_SET ),
262 lSize( 1L ),
263 lSetSize( 1L ),
264 lFrameSpacing( SPACING_NOT_SET ),
265 lInheritedFrameSpacing( SPACING_NOT_SET ),
266 eScroll( ScrollingAuto ),
267 eSizeSelector( SIZE_REL ),
268 eSetSizeSelector( SIZE_REL ),
269 bHasBorder( TRUE ),
270 bHasBorderInherited( TRUE ),
271 bBorderSet( TRUE ),
272 bResizable( TRUE ),
273 bSetResizable( TRUE ),
274 bIsRootSet( FALSE ),
275 bIsInColSet( FALSE ) {}
277 ~SfxFrameProperties() { delete pFrame; }
279 int operator ==( const SfxFrameProperties& ) const;
280 SfxFrameProperties& operator =( const SfxFrameProperties &rProp );
283 class SfxFrameDescriptorItem : public SfxPoolItem
285 SfxFrameProperties aProperties;
286 public:
287 TYPEINFO();
289 SfxFrameDescriptorItem ( const USHORT nId = SID_FRAMEDESCRIPTOR )
290 : SfxPoolItem( nId )
293 SfxFrameDescriptorItem( const SfxFrameDescriptorItem& rCpy )
294 : SfxPoolItem( rCpy )
296 aProperties = rCpy.aProperties;
299 virtual ~SfxFrameDescriptorItem();
301 virtual int operator ==( const SfxPoolItem& ) const;
302 SfxFrameDescriptorItem& operator =( const SfxFrameDescriptorItem & );
304 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
305 SfxMapUnit eCoreMetric,
306 SfxMapUnit ePresMetric,
307 UniString &rText, const ::IntlWrapper * = 0 ) const;
309 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
310 //virtual SfxPoolItem* Create(SvStream &, USHORT) const;
311 //virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const;
312 //virtual USHORT GetVersion( USHORT nFileFormatVersion ) const;
314 const SfxFrameProperties& GetProperties() const
315 { return aProperties; }
316 void SetProperties( const SfxFrameProperties& rProp )
317 { aProperties = rProp; }
320 }//end of namespace binfilter
321 #endif // #ifndef _SFX_FRMDESCRHXX