1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "sal/config.h"
23 #include "sfx2/dllapi.h"
25 #include <sfx2/sfxsids.hrc>
26 #include <svl/poolitem.hxx>
27 #include <tools/urlobj.hxx>
28 #include <tools/string.hxx>
29 #include <tools/gen.hxx>
32 struct SfxFrameDescriptor_Impl
;
33 class SfxFrameDescriptor
;
36 //===========================================================================
37 // The SfxFrame descriptors build a recursive structure, that covers all the
38 // required data in-order to display the frame document.
39 // Through a SfxFrameSetDescriptor access is given to the whole underlying
40 // structure. Due to the nature of the SfxFrames document, the
41 // SfxFramesSetDescriptor is not only the content of this document, but also
42 // describes the view on it. The FrameSet is made up of lines, which in turn,
43 // contains the actual window . A line can be horizontally or vertically
44 // aligned, from which also the alignment of the FrameSet is given.
45 //===========================================================================
64 #define SPACING_NOT_SET -1L
65 #define SIZE_NOT_SET -1L
68 struct SfxFrameProperties
;
70 class SFX2_DLLPUBLIC SfxFrameDescriptor
73 INetURLObject aActualURL
;
77 ScrollingMode eScroll
;
78 SizeSelector eSizeSelector
;
79 sal_uInt16 nHasBorder
;
81 sal_Bool bResizeHorizontal
;
82 sal_Bool bResizeVertical
;
85 SfxFrameDescriptor_Impl
* pImp
;
89 ~SfxFrameDescriptor();
92 SfxItemSet
* GetArgs();
93 const INetURLObject
& GetURL() const
95 void SetURL( const String
& rURL
);
96 const INetURLObject
& GetActualURL() const
97 { return aActualURL
; }
98 void SetActualURL( const INetURLObject
& rURL
);
99 void SetActualURL( const String
& rURL
);
100 void SetReadOnly( sal_Bool bSet
) { bReadOnly
= bSet
;}
101 sal_Bool
IsReadOnly( ) const { return bReadOnly
;}
102 void SetEditable( sal_Bool bSet
);
103 sal_Bool
IsEditable() const;
106 void SetWidth( long n
)
108 void SetWidthPercent( long n
)
109 { nWidth
= n
; eSizeSelector
= SIZE_PERCENT
; }
110 void SetWidthRel( long n
)
111 { nWidth
= n
; eSizeSelector
= SIZE_REL
; }
112 void SetWidthAbs( long n
)
113 { nWidth
= n
; eSizeSelector
= SIZE_ABS
; }
114 long GetWidth() const
116 SizeSelector
GetSizeSelector() const
117 { return eSizeSelector
; }
118 sal_Bool
IsResizable() const
119 { return bResizeHorizontal
&& bResizeVertical
; }
120 void SetResizable( sal_Bool bRes
)
121 { bResizeHorizontal
= bResizeVertical
= bRes
; }
124 const String
& GetName() const
126 void SetName( const String
& rName
)
130 const Size
& GetMargin() const
132 void SetMargin( const Size
& rMargin
)
133 { aMargin
= rMargin
; }
134 ScrollingMode
GetScrollingMode() const
136 void SetScrollingMode( ScrollingMode eMode
)
140 void SetWallpaper( const Wallpaper
& rWallpaper
);
141 sal_Bool
HasFrameBorder() const;
143 sal_Bool
IsFrameBorderOn() const
144 { return ( nHasBorder
& BORDER_YES
) != 0; }
146 void SetFrameBorder( sal_Bool bBorder
)
148 nHasBorder
= bBorder
?
149 BORDER_YES
| BORDER_SET
:
150 BORDER_NO
| BORDER_SET
;
152 sal_Bool
IsFrameBorderSet() const
153 { return (nHasBorder
& BORDER_SET
) != 0; }
157 sal_Bool
HasUI() const
159 void SetHasUI( sal_Bool bOn
)
162 // Attribute for Splitwindow
163 sal_uInt16
GetItemId() const
165 void SetItemId( sal_uInt16 nId
)
168 // Copy for example for Views
169 SfxFrameDescriptor
* Clone( sal_Bool bWithIds
= sal_True
) const;
172 // No block to implement a =operator
173 struct SfxFrameProperties
182 long lInheritedFrameSpacing
;
183 ScrollingMode eScroll
;
184 SizeSelector eSizeSelector
;
185 SizeSelector eSetSizeSelector
;
189 sal_Bool bSetResizable
;
191 sal_Bool bIsInColSet
;
192 sal_Bool bHasBorderInherited
;
193 SfxFrameDescriptor
* pFrame
;
196 SfxFrameProperties( SfxFrameProperties
& ) {}
199 : lMarginWidth( SIZE_NOT_SET
),
200 lMarginHeight( SIZE_NOT_SET
),
203 lFrameSpacing( SPACING_NOT_SET
),
204 lInheritedFrameSpacing( SPACING_NOT_SET
),
205 eScroll( ScrollingAuto
),
206 eSizeSelector( SIZE_REL
),
207 eSetSizeSelector( SIZE_REL
),
208 bHasBorder( sal_True
),
209 bBorderSet( sal_True
),
210 bResizable( sal_True
),
211 bSetResizable( sal_True
),
212 bIsRootSet( sal_False
),
213 bIsInColSet( sal_False
),
214 bHasBorderInherited( sal_True
),
217 ~SfxFrameProperties() { delete pFrame
; }
219 int operator ==( const SfxFrameProperties
& ) const;
220 SfxFrameProperties
& operator =( const SfxFrameProperties
&rProp
);
223 class SfxFrameDescriptorItem
: public SfxPoolItem
225 SfxFrameProperties aProperties
;
229 SfxFrameDescriptorItem ( const sal_uInt16 nId
= SID_FRAMEDESCRIPTOR
)
233 SfxFrameDescriptorItem( const SfxFrameDescriptorItem
& rCpy
)
234 : SfxPoolItem( rCpy
)
236 aProperties
= rCpy
.aProperties
;
239 virtual ~SfxFrameDescriptorItem();
241 virtual int operator ==( const SfxPoolItem
& ) const;
242 SfxFrameDescriptorItem
& operator =( const SfxFrameDescriptorItem
& );
244 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
245 SfxMapUnit eCoreMetric
,
246 SfxMapUnit ePresMetric
,
247 OUString
&rText
, const IntlWrapper
* = 0 ) const;
249 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
251 const SfxFrameProperties
& GetProperties() const
252 { return aProperties
; }
253 void SetProperties( const SfxFrameProperties
& rProp
)
254 { aProperties
= rProp
; }
257 #endif // #ifndef _SFX_FRMDESCRHXX
259 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */