Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : :
21 : : #include <sot/object.hxx>
22 : : #include <tools/stream.hxx>
23 : : #include <vcl/splitwin.hxx>
24 : : #include <svl/itemset.hxx>
25 : :
26 : : #include <sfx2/frmdescr.hxx>
27 : : #include <sfx2/app.hxx>
28 : :
29 : : DBG_NAME(SfxFrameDescriptor);
30 : :
31 : : struct SfxFrameDescriptor_Impl
32 : : {
33 : : Wallpaper* pWallpaper;
34 : : SfxItemSet* pArgs;
35 : : sal_Bool bEditable;
36 : :
37 : 1711 : SfxFrameDescriptor_Impl() : pWallpaper( NULL ), pArgs( NULL ), bEditable( sal_True ) {}
38 : 1620 : ~SfxFrameDescriptor_Impl()
39 : : {
40 [ - + ]: 1620 : delete pWallpaper;
41 [ + - ]: 1620 : delete pArgs;
42 : 1620 : }
43 : : };
44 : :
45 : 1711 : SfxFrameDescriptor::SfxFrameDescriptor() :
46 : : aMargin( -1, -1 ),
47 : : nWidth( 0L ),
48 : : eScroll( ScrollingAuto ),
49 : : eSizeSelector( SIZE_ABS ),
50 : : nHasBorder( BORDER_YES ),
51 : : nItemId( 0 ),
52 : : bResizeHorizontal( sal_True ),
53 : : bResizeVertical( sal_True ),
54 : : bHasUI( sal_True ),
55 [ + - ][ + - ]: 1711 : bReadOnly( sal_False )
56 : : {
57 : : DBG_CTOR(SfxFrameDescriptor, 0);
58 : :
59 [ + - ]: 1711 : pImp = new SfxFrameDescriptor_Impl;
60 : 1711 : }
61 : :
62 [ + - ][ + - ]: 1620 : SfxFrameDescriptor::~SfxFrameDescriptor()
63 : : {
64 : : DBG_DTOR(SfxFrameDescriptor, 0);
65 [ + - ][ + - ]: 1620 : delete pImp;
66 : 1620 : }
67 : :
68 : 1713 : SfxItemSet* SfxFrameDescriptor::GetArgs()
69 : : {
70 [ + + ]: 1713 : if( !pImp->pArgs )
71 [ + - ]: 1711 : pImp->pArgs = new SfxAllItemSet( SFX_APP()->GetPool() );
72 : 1713 : return pImp->pArgs;
73 : : }
74 : :
75 : 0 : void SfxFrameDescriptor::SetURL( const String& rURL )
76 : : {
77 [ # # ][ # # ]: 0 : aURL = INetURLObject(rURL);
[ # # ]
78 : 0 : SetActualURL( aURL );
79 : 0 : }
80 : :
81 : 1711 : void SfxFrameDescriptor::SetActualURL( const String& rURL )
82 : : {
83 [ + - ][ + - ]: 1711 : aActualURL = INetURLObject(rURL);
[ + - ]
84 [ - + ]: 1711 : if ( pImp->pArgs )
85 : 0 : pImp->pArgs->ClearItem();
86 : 1711 : }
87 : :
88 : 0 : void SfxFrameDescriptor::SetActualURL( const INetURLObject& rURL )
89 : : {
90 [ # # ][ # # ]: 0 : SetActualURL(String(rURL.GetMainURL( INetURLObject::DECODE_TO_IURI )));
[ # # ]
91 : 0 : }
92 : :
93 : 1711 : void SfxFrameDescriptor::SetEditable( sal_Bool bSet )
94 : : {
95 : 1711 : pImp->bEditable = bSet;
96 : 1711 : }
97 : :
98 : 0 : sal_Bool SfxFrameDescriptor::IsEditable() const
99 : : {
100 : 0 : return pImp->bEditable;
101 : : }
102 : :
103 : 0 : SfxFrameDescriptor* SfxFrameDescriptor::Clone( sal_Bool bWithIds ) const
104 : : {
105 [ # # ]: 0 : SfxFrameDescriptor *pFrame = new SfxFrameDescriptor;
106 : :
107 : 0 : pFrame->aURL = aURL;
108 : 0 : pFrame->aActualURL = aActualURL;
109 : 0 : pFrame->aName = aName;
110 : 0 : pFrame->aMargin = aMargin;
111 : 0 : pFrame->nWidth = nWidth;
112 : 0 : pFrame->eSizeSelector = eSizeSelector;
113 : 0 : pFrame->eScroll = eScroll;
114 : 0 : pFrame->bResizeHorizontal = bResizeHorizontal;
115 : 0 : pFrame->bResizeVertical = bResizeVertical;
116 : 0 : pFrame->nHasBorder = nHasBorder;
117 : 0 : pFrame->bHasUI = bHasUI;
118 : 0 : pFrame->SetReadOnly( IsReadOnly() );
119 : 0 : pFrame->SetEditable( IsEditable() );
120 [ # # ]: 0 : if ( pImp->pWallpaper )
121 [ # # ]: 0 : pFrame->pImp->pWallpaper = new Wallpaper( *pImp->pWallpaper );
122 [ # # ]: 0 : if( pImp->pArgs )
123 : : {
124 : : // Currently in the clone of SfxAllItemSets there is still a bug ...
125 [ # # ]: 0 : pFrame->pImp->pArgs = new SfxAllItemSet( SFX_APP()->GetPool() );
126 : 0 : pFrame->pImp->pArgs->Put(*pImp->pArgs);
127 : : }
128 : :
129 [ # # ]: 0 : if ( bWithIds )
130 : 0 : pFrame->nItemId = nItemId;
131 : : else
132 : 0 : pFrame->nItemId = 0;
133 : :
134 : 0 : return pFrame;
135 : : }
136 : :
137 : 0 : sal_Bool SfxFrameDescriptor::HasFrameBorder() const
138 : : {
139 : 0 : return (nHasBorder & BORDER_YES) != 0;
140 : : }
141 : :
142 : 0 : void SfxFrameDescriptor::SetWallpaper( const Wallpaper& rWallpaper )
143 : : {
144 [ # # ]: 0 : DELETEZ( pImp->pWallpaper );
145 : :
146 [ # # ]: 0 : if ( rWallpaper.GetStyle() != WALLPAPER_NULL )
147 [ # # ]: 0 : pImp->pWallpaper = new Wallpaper( rWallpaper );
148 : 0 : }
149 : :
150 : 0 : SfxFrameProperties& SfxFrameProperties::operator =(
151 : : const SfxFrameProperties &rProp )
152 : : {
153 : 0 : aURL = rProp.aURL;
154 : 0 : aName = rProp.aName;
155 : 0 : lMarginWidth = rProp.lMarginWidth;
156 : 0 : lMarginHeight = rProp.lMarginHeight;
157 : 0 : lSize = rProp.lSize;
158 : 0 : lSetSize = rProp.lSetSize;
159 : 0 : lFrameSpacing = rProp.lFrameSpacing;
160 : 0 : lInheritedFrameSpacing = rProp.lInheritedFrameSpacing;
161 : 0 : eScroll = rProp.eScroll;
162 : 0 : eSizeSelector = rProp.eSizeSelector;
163 : 0 : eSetSizeSelector = rProp.eSetSizeSelector;
164 : 0 : bHasBorder = rProp.bHasBorder;
165 : 0 : bBorderSet = rProp.bBorderSet;
166 : 0 : bResizable = rProp.bResizable;
167 : 0 : bSetResizable = rProp.bSetResizable;
168 : 0 : bIsRootSet = rProp.bIsRootSet;
169 : 0 : bIsInColSet = rProp.bIsInColSet;
170 : 0 : bHasBorderInherited = rProp.bHasBorderInherited;
171 : 0 : pFrame = rProp.pFrame->Clone();
172 : 0 : return *this;
173 : : }
174 : :
175 : 0 : int SfxFrameProperties::operator ==( const SfxFrameProperties& rProp ) const
176 : : {
177 : 0 : return aURL == rProp.aURL && aName == rProp.aName && lMarginWidth == rProp.lMarginWidth && lMarginHeight == rProp.lMarginHeight &&
178 : : lSize == rProp.lSize && eScroll == rProp.eScroll && eSizeSelector == rProp.eSizeSelector &&
179 : : lSetSize == rProp.lSetSize && lFrameSpacing == rProp.lFrameSpacing && eSetSizeSelector == rProp.eSetSizeSelector &&
180 : : bHasBorder == rProp.bHasBorder && bBorderSet == rProp.bBorderSet &&
181 [ # # ][ # # ]: 0 : bResizable == rProp.bResizable && bSetResizable == rProp.bSetResizable;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
182 : : }
183 : :
184 [ # # ][ # # ]: 0 : TYPEINIT1(SfxFrameDescriptorItem, SfxPoolItem);
185 : :
186 [ # # ]: 0 : SfxFrameDescriptorItem::~SfxFrameDescriptorItem()
187 [ # # ]: 0 : {}
188 : :
189 : 0 : int SfxFrameDescriptorItem::operator==( const SfxPoolItem& rAttr ) const
190 : : {
191 : : DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
192 : :
193 : 0 : return aProperties == ((SfxFrameDescriptorItem&)rAttr).aProperties;
194 : : }
195 : :
196 : : // -----------------------------------------------------------------------
197 : :
198 : 0 : SfxPoolItem* SfxFrameDescriptorItem::Clone( SfxItemPool* ) const
199 : : {
200 [ # # ]: 0 : return new SfxFrameDescriptorItem( *this );
201 : : }
202 : :
203 : : //------------------------------------------------------------------------
204 : :
205 : 0 : SfxItemPresentation SfxFrameDescriptorItem::GetPresentation
206 : : (
207 : : SfxItemPresentation /*ePres*/,
208 : : SfxMapUnit /*eCoreUnit*/,
209 : : SfxMapUnit /*ePresUnit*/,
210 : : XubString& rText,
211 : : const IntlWrapper *
212 : : ) const
213 : : {
214 : 0 : rText.Erase();
215 : 0 : return SFX_ITEM_PRESENTATION_NONE;
216 : : }
217 : :
218 : :
219 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|