bump product version to 4.2.0.1
[LibreOffice.git] / include / sfx2 / frmdescr.hxx
blob7837849f8768ee58e278d00c4a63239e94c874dc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _SFX_FRMDESCRHXX
20 #define _SFX_FRMDESCRHXX
22 #include <rtl/ustring.hxx>
23 #include <sal/config.h>
24 #include <sfx2/dllapi.h>
25 #include <sfx2/sfxsids.hrc>
26 #include <svl/poolitem.hxx>
27 #include <tools/gen.hxx>
28 #include <tools/urlobj.hxx>
30 class SvStream;
31 struct SfxFrameDescriptor_Impl;
32 class SfxFrameDescriptor;
33 class Wallpaper;
35 //===========================================================================
36 // The SfxFrame descriptors build a recursive structure, that covers all the
37 // required data in-order to display the frame document.
38 // Through a SfxFrameSetDescriptor access is given to the whole underlying
39 // structure. Due to the nature of the SfxFrames document, the
40 // SfxFramesSetDescriptor is not only the content of this document, but also
41 // describes the view on it. The FrameSet is made up of lines, which in turn,
42 // contains the actual window . A line can be horizontally or vertically
43 // aligned, from which also the alignment of the FrameSet is given.
44 //===========================================================================
46 enum ScrollingMode
48 ScrollingYes,
49 ScrollingNo,
50 ScrollingAuto
53 enum SizeSelector
55 SIZE_ABS,
56 SIZE_PERCENT,
57 SIZE_REL
60 #define BORDER_SET 2
61 #define BORDER_YES 1
62 #define BORDER_NO 0
63 #define SPACING_NOT_SET -1L
64 #define SIZE_NOT_SET -1L
66 class SfxItemSet;
67 struct SfxFrameProperties;
69 class SFX2_DLLPUBLIC SfxFrameDescriptor
71 INetURLObject aURL;
72 INetURLObject aActualURL;
73 OUString aName;
74 Size aMargin;
75 long nWidth;
76 ScrollingMode eScroll;
77 SizeSelector eSizeSelector;
78 sal_uInt16 nHasBorder;
79 sal_uInt16 nItemId;
80 sal_Bool bResizeHorizontal;
81 sal_Bool bResizeVertical;
82 sal_Bool bHasUI;
83 sal_Bool bReadOnly;
84 SfxFrameDescriptor_Impl* pImp;
86 public:
87 SfxFrameDescriptor();
88 ~SfxFrameDescriptor();
90 // FileName/URL
91 SfxItemSet* GetArgs();
92 const INetURLObject& GetURL() const
93 { return aURL; }
94 void SetURL( const OUString& rURL );
95 const INetURLObject& GetActualURL() const
96 { return aActualURL; }
97 void SetActualURL( const INetURLObject& rURL );
98 void SetActualURL( const OUString& rURL );
99 void SetReadOnly( sal_Bool bSet ) { bReadOnly = bSet;}
100 sal_Bool IsReadOnly( ) const { return bReadOnly;}
101 void SetEditable( sal_Bool bSet );
102 sal_Bool IsEditable() const;
104 // Size
105 void SetWidth( long n )
106 { nWidth = n; }
107 void SetWidthPercent( long n )
108 { nWidth = n; eSizeSelector = SIZE_PERCENT; }
109 void SetWidthRel( long n )
110 { nWidth = n; eSizeSelector = SIZE_REL; }
111 void SetWidthAbs( long n )
112 { nWidth = n; eSizeSelector = SIZE_ABS; }
113 long GetWidth() const
114 { return nWidth; }
115 SizeSelector GetSizeSelector() const
116 { return eSizeSelector; }
117 sal_Bool IsResizable() const
118 { return bResizeHorizontal && bResizeVertical; }
119 void SetResizable( sal_Bool bRes )
120 { bResizeHorizontal = bResizeVertical = bRes; }
122 // FrameName
123 const OUString& GetName() const
124 { return aName; }
125 void SetName( const OUString& rName )
126 { aName = rName; }
128 // Margin, Scrolling
129 const Size& GetMargin() const
130 { return aMargin; }
131 void SetMargin( const Size& rMargin )
132 { aMargin = rMargin; }
133 ScrollingMode GetScrollingMode() const
134 { return eScroll; }
135 void SetScrollingMode( ScrollingMode eMode )
136 { eScroll = eMode; }
138 // FrameBorder
139 void SetWallpaper( const Wallpaper& rWallpaper );
140 sal_Bool HasFrameBorder() const;
142 sal_Bool IsFrameBorderOn() const
143 { return ( nHasBorder & BORDER_YES ) != 0; }
145 void SetFrameBorder( sal_Bool bBorder )
147 nHasBorder = bBorder ?
148 BORDER_YES | BORDER_SET :
149 BORDER_NO | BORDER_SET;
151 sal_Bool IsFrameBorderSet() const
152 { return (nHasBorder & BORDER_SET) != 0; }
153 void ResetBorder()
154 { nHasBorder = 0; }
156 sal_Bool HasUI() const
157 { return bHasUI; }
158 void SetHasUI( sal_Bool bOn )
159 { bHasUI = bOn; }
161 // Attribute for Splitwindow
162 sal_uInt16 GetItemId() const
163 { return nItemId; }
164 void SetItemId( sal_uInt16 nId )
165 { nItemId = nId; }
167 // Copy for example for Views
168 SfxFrameDescriptor* Clone( sal_Bool bWithIds = sal_True ) const;
171 // No block to implement a =operator
172 struct SfxFrameProperties
174 OUString aURL;
175 OUString aName;
176 long lMarginWidth;
177 long lMarginHeight;
178 long lSize;
179 long lSetSize;
180 long lFrameSpacing;
181 long lInheritedFrameSpacing;
182 ScrollingMode eScroll;
183 SizeSelector eSizeSelector;
184 SizeSelector eSetSizeSelector;
185 sal_Bool bHasBorder;
186 sal_Bool bBorderSet;
187 sal_Bool bResizable;
188 sal_Bool bSetResizable;
189 sal_Bool bIsRootSet;
190 sal_Bool bIsInColSet;
191 sal_Bool bHasBorderInherited;
192 SfxFrameDescriptor* pFrame;
194 private:
195 SfxFrameProperties( SfxFrameProperties& ) {}
196 public:
197 SfxFrameProperties()
198 : lMarginWidth( SIZE_NOT_SET ),
199 lMarginHeight( SIZE_NOT_SET ),
200 lSize( 1L ),
201 lSetSize( 1L ),
202 lFrameSpacing( SPACING_NOT_SET ),
203 lInheritedFrameSpacing( SPACING_NOT_SET ),
204 eScroll( ScrollingAuto ),
205 eSizeSelector( SIZE_REL ),
206 eSetSizeSelector( SIZE_REL ),
207 bHasBorder( sal_True ),
208 bBorderSet( sal_True ),
209 bResizable( sal_True ),
210 bSetResizable( sal_True ),
211 bIsRootSet( sal_False ),
212 bIsInColSet( sal_False ),
213 bHasBorderInherited( sal_True ),
214 pFrame( 0 ) {}
216 ~SfxFrameProperties() { delete pFrame; }
218 int operator ==( const SfxFrameProperties& ) const;
219 SfxFrameProperties& operator =( const SfxFrameProperties &rProp );
222 class SfxFrameDescriptorItem : public SfxPoolItem
224 SfxFrameProperties aProperties;
225 public:
226 TYPEINFO();
228 SfxFrameDescriptorItem ( const sal_uInt16 nId = SID_FRAMEDESCRIPTOR )
229 : SfxPoolItem( nId )
232 SfxFrameDescriptorItem( const SfxFrameDescriptorItem& rCpy )
233 : SfxPoolItem( rCpy )
235 aProperties = rCpy.aProperties;
238 virtual ~SfxFrameDescriptorItem();
240 virtual int operator ==( const SfxPoolItem& ) const;
241 SfxFrameDescriptorItem& operator =( const SfxFrameDescriptorItem & );
243 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
244 SfxMapUnit eCoreMetric,
245 SfxMapUnit ePresMetric,
246 OUString &rText, const IntlWrapper * = 0 ) const;
248 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
250 const SfxFrameProperties& GetProperties() const
251 { return aProperties; }
252 void SetProperties( const SfxFrameProperties& rProp )
253 { aProperties = rProp; }
256 #endif // #ifndef _SFX_FRMDESCRHXX
258 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */