1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <sot/object.hxx>
31 #include <tools/stream.hxx>
32 #include <vcl/splitwin.hxx>
33 #include <svl/itemset.hxx>
35 #include <sfx2/frmdescr.hxx>
36 #include <sfx2/app.hxx>
38 DBG_NAME(SfxFrameDescriptor
);
40 struct SfxFrameDescriptor_Impl
42 Wallpaper
* pWallpaper
;
46 SfxFrameDescriptor_Impl() : pWallpaper( NULL
), pArgs( NULL
), bEditable( sal_True
) {}
47 ~SfxFrameDescriptor_Impl()
54 SfxFrameDescriptor::SfxFrameDescriptor() :
57 eScroll( ScrollingAuto
),
58 eSizeSelector( SIZE_ABS
),
59 nHasBorder( BORDER_YES
),
61 bResizeHorizontal( sal_True
),
62 bResizeVertical( sal_True
),
64 bReadOnly( sal_False
)
66 DBG_CTOR(SfxFrameDescriptor
, 0);
68 pImp
= new SfxFrameDescriptor_Impl
;
71 SfxFrameDescriptor::~SfxFrameDescriptor()
73 DBG_DTOR(SfxFrameDescriptor
, 0);
77 SfxItemSet
* SfxFrameDescriptor::GetArgs()
80 pImp
->pArgs
= new SfxAllItemSet( SFX_APP()->GetPool() );
84 void SfxFrameDescriptor::SetURL( const String
& rURL
)
86 aURL
= INetURLObject(rURL
);
90 void SfxFrameDescriptor::SetActualURL( const String
& rURL
)
92 aActualURL
= INetURLObject(rURL
);
94 pImp
->pArgs
->ClearItem();
97 void SfxFrameDescriptor::SetActualURL( const INetURLObject
& rURL
)
99 SetActualURL(String(rURL
.GetMainURL( INetURLObject::DECODE_TO_IURI
)));
102 void SfxFrameDescriptor::SetEditable( sal_Bool bSet
)
104 pImp
->bEditable
= bSet
;
107 sal_Bool
SfxFrameDescriptor::IsEditable() const
109 return pImp
->bEditable
;
112 SfxFrameDescriptor
* SfxFrameDescriptor::Clone( sal_Bool bWithIds
) const
114 SfxFrameDescriptor
*pFrame
= new SfxFrameDescriptor
;
117 pFrame
->aActualURL
= aActualURL
;
118 pFrame
->aName
= aName
;
119 pFrame
->aMargin
= aMargin
;
120 pFrame
->nWidth
= nWidth
;
121 pFrame
->eSizeSelector
= eSizeSelector
;
122 pFrame
->eScroll
= eScroll
;
123 pFrame
->bResizeHorizontal
= bResizeHorizontal
;
124 pFrame
->bResizeVertical
= bResizeVertical
;
125 pFrame
->nHasBorder
= nHasBorder
;
126 pFrame
->bHasUI
= bHasUI
;
127 pFrame
->SetReadOnly( IsReadOnly() );
128 pFrame
->SetEditable( IsEditable() );
129 if ( pImp
->pWallpaper
)
130 pFrame
->pImp
->pWallpaper
= new Wallpaper( *pImp
->pWallpaper
);
133 // Currently in the clone of SfxAllItemSets there is still a bug ...
134 pFrame
->pImp
->pArgs
= new SfxAllItemSet( SFX_APP()->GetPool() );
135 pFrame
->pImp
->pArgs
->Put(*pImp
->pArgs
);
139 pFrame
->nItemId
= nItemId
;
146 sal_Bool
SfxFrameDescriptor::HasFrameBorder() const
148 return (nHasBorder
& BORDER_YES
) != 0;
151 void SfxFrameDescriptor::SetWallpaper( const Wallpaper
& rWallpaper
)
153 DELETEZ( pImp
->pWallpaper
);
155 if ( rWallpaper
.GetStyle() != WALLPAPER_NULL
)
156 pImp
->pWallpaper
= new Wallpaper( rWallpaper
);
159 SfxFrameProperties
& SfxFrameProperties::operator =(
160 const SfxFrameProperties
&rProp
)
164 lMarginWidth
= rProp
.lMarginWidth
;
165 lMarginHeight
= rProp
.lMarginHeight
;
167 lSetSize
= rProp
.lSetSize
;
168 lFrameSpacing
= rProp
.lFrameSpacing
;
169 lInheritedFrameSpacing
= rProp
.lInheritedFrameSpacing
;
170 eScroll
= rProp
.eScroll
;
171 eSizeSelector
= rProp
.eSizeSelector
;
172 eSetSizeSelector
= rProp
.eSetSizeSelector
;
173 bHasBorder
= rProp
.bHasBorder
;
174 bBorderSet
= rProp
.bBorderSet
;
175 bResizable
= rProp
.bResizable
;
176 bSetResizable
= rProp
.bSetResizable
;
177 bIsRootSet
= rProp
.bIsRootSet
;
178 bIsInColSet
= rProp
.bIsInColSet
;
179 bHasBorderInherited
= rProp
.bHasBorderInherited
;
180 pFrame
= rProp
.pFrame
->Clone();
184 int SfxFrameProperties::operator ==( const SfxFrameProperties
& rProp
) const
186 return aURL
== rProp
.aURL
&& aName
== rProp
.aName
&& lMarginWidth
== rProp
.lMarginWidth
&& lMarginHeight
== rProp
.lMarginHeight
&&
187 lSize
== rProp
.lSize
&& eScroll
== rProp
.eScroll
&& eSizeSelector
== rProp
.eSizeSelector
&&
188 lSetSize
== rProp
.lSetSize
&& lFrameSpacing
== rProp
.lFrameSpacing
&& eSetSizeSelector
== rProp
.eSetSizeSelector
&&
189 bHasBorder
== rProp
.bHasBorder
&& bBorderSet
== rProp
.bBorderSet
&&
190 bResizable
== rProp
.bResizable
&& bSetResizable
== rProp
.bSetResizable
;
193 TYPEINIT1(SfxFrameDescriptorItem
, SfxPoolItem
);
195 SfxFrameDescriptorItem::~SfxFrameDescriptorItem()
198 int SfxFrameDescriptorItem::operator==( const SfxPoolItem
& rAttr
) const
200 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
202 return aProperties
== ((SfxFrameDescriptorItem
&)rAttr
).aProperties
;
205 // -----------------------------------------------------------------------
207 SfxPoolItem
* SfxFrameDescriptorItem::Clone( SfxItemPool
* ) const
209 return new SfxFrameDescriptorItem( *this );
212 //------------------------------------------------------------------------
214 SfxItemPresentation
SfxFrameDescriptorItem::GetPresentation
216 SfxItemPresentation
/*ePres*/,
217 SfxMapUnit
/*eCoreUnit*/,
218 SfxMapUnit
/*ePresUnit*/,
224 return SFX_ITEM_PRESENTATION_NONE
;
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */