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 : #include <com/sun/star/lang/DisposedException.hpp>
21 : #include <com/sun/star/presentation/ClickAction.hpp>
22 : #include <com/sun/star/presentation/FadeEffect.hpp>
23 : #include <com/sun/star/presentation/AnimationEffect.hpp>
24 : #include <com/sun/star/presentation/PresentationRange.hpp>
25 : #include <com/sun/star/presentation/AnimationSpeed.hpp>
26 : #include <com/sun/star/view/PaperOrientation.hpp>
27 : #include <com/sun/star/animations/AnimationNodeType.hpp>
28 : #include <com/sun/star/presentation/EffectNodeType.hpp>
29 : #include <comphelper/processfactory.hxx>
30 : #include <comphelper/servicehelper.hxx>
31 : #include <cppuhelper/supportsservice.hxx>
32 : #include <rtl/ustrbuf.hxx>
33 : #include <vcl/bitmapex.hxx>
34 : #include <vcl/metaact.hxx>
35 : #include <toolkit/helper/vclunohelper.hxx>
36 : #include <vcl/svapp.hxx>
37 : #include <vcl/settings.hxx>
38 : #include <AnnotationEnumeration.hxx>
39 : #include <createunopageimpl.hxx>
40 : #include <unomodel.hxx>
41 : #include <unopage.hxx>
42 : #include <svx/svxids.hrc>
43 : #include <svl/itemset.hxx>
44 : #include <svx/svdmodel.hxx>
45 : #include <sdresid.hxx>
46 : #include <glob.hrc>
47 : #include <sdpage.hxx>
48 : #include <unoprnms.hxx>
49 : #include <sdattr.hxx>
50 : #include <drawdoc.hxx>
51 : #include <svx/unoshape.hxx>
52 : #include <com/sun/star/style/XStyle.hpp>
53 : #include <svx/svdorect.hxx>
54 : #include <osl/mutex.hxx>
55 : #include <svl/style.hxx>
56 : #include <comphelper/serviceinfohelper.hxx>
57 : #include <comphelper/extract.hxx>
58 : #include <list>
59 : #include <svx/svditer.hxx>
60 : #include <vcl/wmf.hxx>
61 : #include <svx/svdoole2.hxx>
62 : #include <svx/svdpool.hxx>
63 : #include <svx/svdview.hxx>
64 : #include "View.hxx"
65 : #include "DrawDocShell.hxx"
66 : #include "ViewShell.hxx"
67 : #include "DrawViewShell.hxx"
68 : #include "unoobj.hxx"
69 : #include "res_bmp.hrc"
70 : #include "unokywds.hxx"
71 : #include "unopback.hxx"
72 : #include "unohelp.hxx"
73 : #include <vcl/dibtools.hxx>
74 : #include <svx/svdograf.hxx>
75 :
76 : using ::com::sun::star::animations::XAnimationNode;
77 : using ::com::sun::star::animations::XAnimationNodeSupplier;
78 :
79 : using namespace ::osl;
80 : using namespace ::com::sun::star;
81 : using namespace ::com::sun::star::uno;
82 : using namespace ::com::sun::star::lang;
83 : using namespace ::com::sun::star::container;
84 : using namespace ::com::sun::star::drawing;
85 : using namespace ::com::sun::star::office;
86 :
87 : // this are the ids for page properties
88 : enum WID_PAGE
89 : {
90 : WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH,
91 : WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER,
92 : WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_HIGHRESDURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
93 : WID_PAGE_BACK, WID_PAGE_PREVIEW, WID_PAGE_PREVIEWBITMAP, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL,
94 : WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK,
95 : WID_PAGE_HEADERVISIBLE, WID_PAGE_HEADERTEXT, WID_PAGE_FOOTERVISIBLE, WID_PAGE_FOOTERTEXT,
96 : WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, WID_PAGE_DATETIMEFIXED,
97 : WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, WID_TRANSITION_SUBTYPE,
98 : WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, WID_TRANSITION_DURATION, WID_LOOP_SOUND,
99 : WID_NAVORDER
100 : };
101 :
102 : static sal_Char const sEmptyPageName[sizeof("page")] = "page";
103 :
104 : // this function stores the property maps for draw pages in impress and draw
105 886 : const SvxItemPropertySet* ImplGetDrawPagePropertySet( bool bImpress, PageKind ePageKind )
106 : {
107 : static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl[] =
108 : {
109 19 : { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), beans::PropertyAttribute::MAYBEVOID,0},
110 19 : { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
111 19 : { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
112 19 : { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
113 19 : { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
114 19 : { OUString(UNO_NAME_PAGE_CHANGE), WID_PAGE_CHANGE, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
115 19 : { OUString(UNO_NAME_PAGE_DURATION), WID_PAGE_DURATION, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
116 19 : { OUString(UNO_NAME_PAGE_EFFECT), WID_PAGE_EFFECT, ::cppu::UnoType<presentation::FadeEffect>::get(), 0, 0},
117 19 : { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
118 19 : { OUString(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
119 19 : { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0},
120 19 : { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0},
121 19 : { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0},
122 19 : { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0},
123 19 : { OUString(UNO_NAME_PAGE_SPEED), WID_PAGE_SPEED, ::cppu::UnoType<presentation::AnimationSpeed>::get(), 0, 0},
124 19 : { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
125 19 : { OUString(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
126 19 : { OUString(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
127 19 : { OUString(UNO_NAME_PAGE_VISIBLE), WID_PAGE_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
128 19 : { OUString(UNO_NAME_OBJ_SOUNDFILE), WID_PAGE_SOUNDFILE, cppu::UnoType<Any>::get(), 0, 0},
129 19 : { OUString(sUNO_Prop_IsBackgroundVisible), WID_PAGE_BACKVIS, cppu::UnoType<bool>::get(), 0, 0},
130 19 : { OUString(sUNO_Prop_IsBackgroundObjectsVisible), WID_PAGE_BACKOBJVIS, cppu::UnoType<bool>::get(), 0, 0},
131 19 : { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<com::sun::star::container::XNameContainer>::get(), 0, 0},
132 19 : { OUString(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, ::cppu::UnoType<OUString>::get(), 0, 0},
133 19 : { OUString("HighResDuration"), WID_PAGE_HIGHRESDURATION, ::cppu::UnoType<double>::get(), 0, 0},
134 19 : { OUString("IsBackgroundDark") , WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
135 19 : { OUString("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
136 19 : { OUString("FooterText"), WID_PAGE_FOOTERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
137 19 : { OUString("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
138 19 : { OUString("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
139 19 : { OUString("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, cppu::UnoType<bool>::get(), 0, 0},
140 19 : { OUString("DateTimeText"), WID_PAGE_DATETIMETEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
141 19 : { OUString("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
142 19 : { OUString("TransitionType"), WID_TRANSITION_TYPE, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
143 19 : { OUString("TransitionSubtype"), WID_TRANSITION_SUBTYPE, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
144 19 : { OUString("TransitionDirection"), WID_TRANSITION_DIRECTION, ::cppu::UnoType<sal_Bool>::get(), 0, 0},
145 19 : { OUString("TransitionFadeColor"), WID_TRANSITION_FADE_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
146 19 : { OUString("TransitionDuration"), WID_TRANSITION_DURATION, ::cppu::UnoType<double>::get(), 0, 0},
147 19 : { OUString("LoopSound"), WID_LOOP_SOUND, cppu::UnoType<bool>::get(), 0, 0},
148 19 : { OUString("NavigationOrder"), WID_NAVORDER, cppu::UnoType<css::container::XIndexAccess>::get(),0, 0},
149 : { OUString(), 0, css::uno::Type(), 0, 0 }
150 1665 : };
151 :
152 : #define DRAW_PAGE_NOTES_PROPERTIES \
153 : { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
154 : { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
155 : { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
156 : { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
157 : { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
158 : { OUString(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
159 : { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0}, \
160 : { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0}, \
161 : { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0}, \
162 : { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0}, \
163 : { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
164 : { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<com::sun::star::container::XNameContainer>::get(), 0, 0},\
165 : { OUString("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
166 : { OUString("HeaderText"), WID_PAGE_HEADERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0}, \
167 : { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0}, \
168 : { OUString("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
169 : { OUString("FooterText"), WID_PAGE_FOOTERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0}, \
170 : { OUString("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
171 : { OUString("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
172 : { OUString("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, cppu::UnoType<bool>::get(), 0, 0}, \
173 : { OUString("DateTimeText"), WID_PAGE_DATETIMETEXT, ::cppu::UnoType<OUString>::get(), 0, 0}, \
174 : { OUString("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
175 : { OUString("NavigationOrder"), WID_NAVORDER, cppu::UnoType<css::container::XIndexAccess>::get(),0, 0}, \
176 : { OUString(), 0, css::uno::Type(), 0, 0 }
177 :
178 : static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl[] =
179 : {
180 : // this must be the first two entries so they can be excluded for PK_STANDARD
181 19 : { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), beans::PropertyAttribute::MAYBEVOID,0},
182 437 : DRAW_PAGE_NOTES_PROPERTIES
183 1361 : };
184 : static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl[] =
185 : {
186 437 : DRAW_PAGE_NOTES_PROPERTIES
187 1342 : };
188 :
189 : #define GRAPHIC_PAGE_PROPERTIES \
190 : { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
191 : { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
192 : { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
193 : { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
194 : { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
195 : { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0}, \
196 : { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0}, \
197 : { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0}, \
198 : { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0}, \
199 : { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
200 : { OUString(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
201 : { OUString(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
202 : { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<com::sun::star::container::XNameContainer>::get(), 0, 0}, \
203 : { OUString(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, ::cppu::UnoType<OUString>::get(), 0, 0}, \
204 : { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0}, \
205 : { OUString("NavigationOrder"), WID_NAVORDER, cppu::UnoType<css::container::XIndexAccess>::get(),0, 0}, \
206 : { OUString(), 0, css::uno::Type(), 0, 0 }
207 :
208 : static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl[] =
209 : {
210 19 : { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), beans::PropertyAttribute::MAYBEVOID,0},
211 304 : GRAPHIC_PAGE_PROPERTIES
212 1228 : };
213 : static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl[] =
214 : {
215 304 : GRAPHIC_PAGE_PROPERTIES
216 1209 : };
217 :
218 886 : bool bWithoutBackground = ePageKind != PK_STANDARD && ePageKind != PK_HANDOUT;
219 886 : const SvxItemPropertySet* pRet = 0;
220 886 : if( bImpress )
221 : {
222 667 : if( ePageKind == PK_STANDARD )
223 : {
224 : //PK_STANDARD always has a background property
225 552 : static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
226 552 : pRet = &aDrawPagePropertySet_Impl;
227 : }
228 : else
229 : {
230 115 : if(bWithoutBackground)
231 : {
232 114 : static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
233 114 : pRet = &aDrawPageNotesHandoutPropertyNoBackSet_Impl;
234 : }
235 : else
236 : {
237 1 : static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
238 1 : pRet = &aDrawPageNotesHandoutPropertySet_Impl;
239 : }
240 : }
241 : }
242 : else
243 : {
244 219 : if(bWithoutBackground)
245 : {
246 106 : static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
247 106 : pRet = &aGraphicPagePropertyNoBackSet_Impl;
248 : }
249 : else
250 : {
251 113 : static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
252 113 : pRet = &aGraphicPagePropertySet_Impl;
253 : }
254 : }
255 886 : return pRet;
256 : }
257 :
258 : /** this function stores the property map for master pages in impress and draw */
259 404 : const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
260 : {
261 : static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl[] =
262 : {
263 18 : { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), 0, 0},
264 18 : { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
265 18 : { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
266 18 : { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
267 18 : { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
268 18 : { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
269 18 : { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0},
270 18 : { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0},
271 18 : { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0},
272 18 : { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0},
273 18 : { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
274 18 : { OUString("BackgroundFullSize"), WID_PAGE_BACKFULL, cppu::UnoType<bool>::get(), 0, 0},
275 18 : { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<com::sun::star::container::XNameContainer>::get(), 0, 0},
276 18 : { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
277 : { OUString(), 0, css::uno::Type(), 0, 0 }
278 674 : };
279 :
280 : static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl[] =
281 : {
282 18 : { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
283 18 : { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
284 18 : { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
285 18 : { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
286 18 : { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
287 18 : { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0},
288 18 : { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0},
289 18 : { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
290 18 : { OUString(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
291 18 : { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<com::sun::star::container::XNameContainer>::get(), 0, 0},
292 18 : { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
293 18 : { OUString("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
294 18 : { OUString("HeaderText"), WID_PAGE_HEADERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
295 18 : { OUString("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
296 18 : { OUString("FooterText"), WID_PAGE_FOOTERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
297 18 : { OUString("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
298 18 : { OUString("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
299 18 : { OUString("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, cppu::UnoType<bool>::get(), 0, 0},
300 18 : { OUString("DateTimeText"), WID_PAGE_DATETIMETEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
301 18 : { OUString("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
302 : { OUString(), 0, css::uno::Type(), 0, 0 }
303 782 : };
304 :
305 404 : const SvxItemPropertySet* pRet = 0;
306 404 : if( ePageKind == PK_HANDOUT )
307 : {
308 65 : static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
309 65 : pRet = &aHandoutMasterPagePropertySet_Impl;
310 : }
311 : else
312 : {
313 339 : static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
314 339 : pRet = &aMasterPagePropertySet_Impl;
315 : }
316 404 : return pRet;
317 : }
318 :
319 : namespace
320 : {
321 : class theSdGenericDrawPageUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdGenericDrawPageUnoTunnelId> {};
322 : }
323 :
324 14129 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() throw()
325 : {
326 14129 : return theSdGenericDrawPageUnoTunnelId::get().getSeq();
327 : }
328 :
329 14129 : sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException, std::exception)
330 : {
331 42387 : if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
332 28258 : rId.getConstArray(), 16 ) )
333 : {
334 0 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
335 : }
336 : else
337 : {
338 14129 : return SvxFmDrawPage::getSomething( rId );
339 : }
340 : }
341 :
342 1290 : SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPage, const SvxItemPropertySet* _pSet ) throw()
343 : : SvxFmDrawPage( static_cast<SdrPage*>(pInPage) ),
344 : SdUnoSearchReplaceShape(this),
345 : mpModel ( _pModel ),
346 : mpSdrModel(0),
347 : mnTempPageNumber(0),
348 : mpPropSet ( _pSet ),
349 1290 : mbIsImpressDocument(false)
350 : {
351 1290 : mpSdrModel = SvxFmDrawPage::mpModel;
352 1290 : if( mpModel )
353 1290 : mbIsImpressDocument = mpModel->IsImpressDocument();
354 :
355 1290 : }
356 :
357 1275 : SdGenericDrawPage::~SdGenericDrawPage() throw()
358 : {
359 1275 : }
360 :
361 28700 : void SdGenericDrawPage::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException )
362 : {
363 28700 : if( (SvxFmDrawPage::mpModel == 0) || (mpModel == 0) || (SvxFmDrawPage::mpPage == 0) )
364 0 : throw lang::DisposedException();
365 28700 : }
366 :
367 16847 : SdXImpressDocument* SdGenericDrawPage::GetModel() const
368 : {
369 16847 : if( mpSdrModel != SvxFmDrawPage::mpModel )
370 : {
371 0 : const_cast< SdGenericDrawPage* >(this)->mpSdrModel = SvxFmDrawPage::mpModel;
372 0 : if( mpSdrModel )
373 : {
374 0 : uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
375 0 : const_cast< SdGenericDrawPage*>(this)->mpModel = SdXImpressDocument::getImplementation( xModel );
376 0 : if( mpModel )
377 0 : const_cast< SdGenericDrawPage*>(this)->mbIsImpressDocument = mpModel->IsImpressDocument();
378 : }
379 : else
380 : {
381 0 : const_cast< SdGenericDrawPage* >(this)->mpModel = 0;
382 : }
383 : }
384 :
385 16847 : return mpModel;
386 : }
387 :
388 : // this is called whenever a SdrObject must be created for a empty api shape wrapper
389 3707 : SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShape >& xShape )
390 : throw (css::uno::RuntimeException, std::exception)
391 : {
392 3707 : if( NULL == SvxFmDrawPage::mpPage || !xShape.is() )
393 0 : return NULL;
394 :
395 3707 : OUString aType( xShape->getShapeType() );
396 7414 : const OUString aPrefix( "com.sun.star.presentation." );
397 3707 : if( !aType.startsWith( aPrefix ) )
398 : {
399 2271 : SdrObject* pObj = SvxFmDrawPage::_CreateSdrObject( xShape );
400 2271 : if( pObj && ( (pObj->GetObjInventor() != SdrInventor) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
401 : {
402 2271 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
403 2271 : if( pDoc )
404 : {
405 : // #i119287# similar to the code in the SdrObject methods the graphic and ole
406 : // SdrObjects need another default style than the rest, see task. Adding here, too.
407 : // TTTT: Same as for #i119287#: Can be removed in branch aw080 again
408 2271 : const bool bIsSdrGrafObj(0 != dynamic_cast< SdrGrafObj* >(pObj));
409 2271 : const bool bIsSdrOle2Obj(0 != dynamic_cast< SdrOle2Obj* >(pObj));
410 :
411 2271 : if(bIsSdrGrafObj || bIsSdrOle2Obj)
412 : {
413 60 : pObj->NbcSetStyleSheet(pDoc->GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true);
414 : }
415 : else
416 : {
417 2211 : pObj->NbcSetStyleSheet(pDoc->GetDefaultStyleSheet(), true);
418 : }
419 : }
420 : }
421 2271 : return pObj;
422 : }
423 :
424 1436 : aType = aType.copy( aPrefix.getLength() );
425 :
426 1436 : PresObjKind eObjKind = PRESOBJ_NONE;
427 :
428 1436 : if( aType == "TitleTextShape" )
429 : {
430 176 : eObjKind = PRESOBJ_TITLE;
431 : }
432 1260 : else if( aType == "OutlinerShape" )
433 : {
434 83 : eObjKind = PRESOBJ_OUTLINE;
435 : }
436 1177 : else if( aType == "SubtitleShape" )
437 : {
438 88 : eObjKind = PRESOBJ_TEXT;
439 : }
440 1089 : else if( aType == "OLE2Shape" )
441 : {
442 0 : eObjKind = PRESOBJ_OBJECT;
443 : }
444 1089 : else if( aType == "ChartShape" )
445 : {
446 0 : eObjKind = PRESOBJ_CHART;
447 : }
448 1089 : else if( aType == "CalcShape" )
449 : {
450 0 : eObjKind = PRESOBJ_CALC;
451 : }
452 1089 : else if( aType == "TableShape" )
453 : {
454 1 : eObjKind = PRESOBJ_TABLE;
455 : }
456 1088 : else if( aType == "GraphicObjectShape" )
457 : {
458 10 : eObjKind = PRESOBJ_GRAPHIC;
459 : }
460 1078 : else if( aType == "OrgChartShape" )
461 : {
462 0 : eObjKind = PRESOBJ_ORGCHART;
463 : }
464 1078 : else if( aType == "PageShape" )
465 : {
466 123 : if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
467 42 : eObjKind = PRESOBJ_TITLE;
468 : else
469 81 : eObjKind = PRESOBJ_PAGE;
470 : }
471 955 : else if( aType == "NotesShape" )
472 : {
473 122 : eObjKind = PRESOBJ_NOTES;
474 : }
475 833 : else if( aType == "HandoutShape" )
476 : {
477 246 : eObjKind = PRESOBJ_HANDOUT;
478 : }
479 587 : else if( aType == "FooterShape" )
480 : {
481 165 : eObjKind = PRESOBJ_FOOTER;
482 : }
483 422 : else if( aType == "HeaderShape" )
484 : {
485 83 : eObjKind = PRESOBJ_HEADER;
486 : }
487 339 : else if( aType == "SlideNumberShape" )
488 : {
489 173 : eObjKind = PRESOBJ_SLIDENUMBER;
490 : }
491 166 : else if( aType == "DateTimeShape" )
492 : {
493 164 : eObjKind = PRESOBJ_DATETIME;
494 : }
495 2 : else if( aType == "MediaShape" )
496 : {
497 2 : eObjKind = PRESOBJ_MEDIA;
498 : }
499 :
500 1436 : Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
501 :
502 1436 : const awt::Point aPos( aRect.Left(), aRect.Top() );
503 1436 : xShape->setPosition( aPos );
504 :
505 1436 : const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() );
506 1436 : xShape->setSize( aSize );
507 :
508 1436 : SdrObject *pPresObj = 0;
509 1436 : if( (eObjKind == PRESOBJ_TABLE) || (eObjKind == PRESOBJ_MEDIA) )
510 : {
511 3 : pPresObj = SvxFmDrawPage::_CreateSdrObject( xShape );
512 3 : if( pPresObj )
513 : {
514 3 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
515 3 : if( pDoc )
516 3 : pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), true );
517 3 : GetPage()->InsertPresObj( pPresObj, eObjKind );
518 3 : }
519 : }
520 : else
521 : {
522 1433 : pPresObj = GetPage()->CreatePresObj( eObjKind, false, aRect, true );
523 : }
524 :
525 1436 : if( pPresObj )
526 1436 : pPresObj->SetUserCall( GetPage() );
527 :
528 5143 : return pPresObj;
529 : }
530 :
531 : // XInterface
532 33143 : Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
533 : throw(uno::RuntimeException, std::exception)
534 : {
535 33143 : Any aAny;
536 :
537 33143 : if (rType == cppu::UnoType<beans::XPropertySet>::get())
538 : {
539 3191 : aAny <<= Reference<beans::XPropertySet>(this);
540 : }
541 29952 : else if (rType == cppu::UnoType<container::XNamed>::get())
542 : {
543 161 : aAny <<= Reference<container::XNamed>(this);
544 : }
545 29791 : else if (rType == cppu::UnoType<util::XReplaceable>::get())
546 : {
547 0 : aAny <<= Reference<util::XReplaceable>(this);
548 : }
549 29791 : else if (rType == cppu::UnoType<util::XSearchable>::get())
550 : {
551 0 : aAny <<= Reference<util::XSearchable>(this);
552 : }
553 29791 : else if (rType == cppu::UnoType<document::XLinkTargetSupplier>::get())
554 : {
555 1 : aAny <<= Reference<document::XLinkTargetSupplier>(this);
556 : }
557 29790 : else if (rType == cppu::UnoType<drawing::XShapeCombiner>::get())
558 : {
559 3 : aAny <<= Reference<drawing::XShapeCombiner>(this);
560 : }
561 29787 : else if (rType == cppu::UnoType<drawing::XShapeBinder>::get())
562 : {
563 3 : aAny <<= Reference<drawing::XShapeBinder>(this);
564 : }
565 29784 : else if (rType == cppu::UnoType<beans::XMultiPropertySet>::get())
566 : {
567 699 : aAny <<= Reference<beans::XMultiPropertySet>(this);
568 : }
569 29085 : else if (rType == cppu::UnoType<office::XAnnotationAccess>::get())
570 : {
571 654 : aAny <<= Reference<office::XAnnotationAccess>(this);
572 : }
573 28431 : else if (mbIsImpressDocument && rType == cppu::UnoType<XAnimationNodeSupplier>::get())
574 : {
575 281 : const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
576 :
577 281 : if( ePageKind == PK_STANDARD )
578 270 : return makeAny( Reference< XAnimationNodeSupplier >( this ) );
579 : }
580 : else
581 28150 : return SvxDrawPage::queryInterface( rType );
582 :
583 4723 : return aAny;
584 : }
585 :
586 : // XPropertySet
587 2324 : Reference< beans::XPropertySetInfo > SAL_CALL SdGenericDrawPage::getPropertySetInfo()
588 : throw(uno::RuntimeException, std::exception)
589 : {
590 2324 : ::SolarMutexGuard aGuard;
591 2324 : throwIfDisposed();
592 2324 : return mpPropSet->getPropertySetInfo();
593 : }
594 :
595 3953 : void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
596 : throw (beans::UnknownPropertyException,
597 : beans::PropertyVetoException,
598 : lang::IllegalArgumentException,
599 : lang::WrappedTargetException,
600 : uno::RuntimeException,
601 : std::exception)
602 : {
603 3953 : ::SolarMutexGuard aGuard;
604 :
605 3953 : throwIfDisposed();
606 :
607 3953 : const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
608 :
609 3953 : switch( pEntry ? pEntry->nWID : -1 )
610 : {
611 : case WID_NAVORDER:
612 0 : setNavigationOrder( aValue );
613 0 : break;
614 : case WID_PAGE_LEFT:
615 : case WID_PAGE_RIGHT:
616 : case WID_PAGE_TOP:
617 : case WID_PAGE_BOTTOM:
618 : case WID_PAGE_LAYOUT:
619 : case WID_PAGE_DURATION:
620 : case WID_PAGE_CHANGE:
621 : {
622 1258 : sal_Int32 nValue = 0;
623 1258 : if(!(aValue >>= nValue))
624 0 : throw lang::IllegalArgumentException();
625 :
626 1258 : switch( pEntry->nWID )
627 : {
628 : case WID_PAGE_LEFT:
629 187 : SetLftBorder(nValue);
630 187 : break;
631 : case WID_PAGE_RIGHT:
632 187 : SetRgtBorder( nValue );
633 187 : break;
634 : case WID_PAGE_TOP:
635 187 : SetUppBorder( nValue );
636 187 : break;
637 : case WID_PAGE_BOTTOM:
638 187 : SetLwrBorder( nValue );
639 187 : break;
640 : case WID_PAGE_CHANGE:
641 2 : GetPage()->SetPresChange( (PresChange)nValue );
642 2 : break;
643 : case WID_PAGE_LAYOUT:
644 508 : GetPage()->SetAutoLayout( (AutoLayout)nValue, true );
645 508 : break;
646 : case WID_PAGE_DURATION:
647 0 : GetPage()->SetTime((sal_Int32)nValue);
648 0 : break;
649 : }
650 1258 : break;
651 : }
652 : case WID_PAGE_HIGHRESDURATION:
653 : {
654 0 : double fValue = 0;
655 0 : if(!(aValue >>= fValue))
656 0 : throw lang::IllegalArgumentException();
657 :
658 0 : GetPage()->SetTime(fValue);
659 0 : break;
660 : }
661 : case WID_PAGE_WIDTH:
662 : {
663 380 : sal_Int32 nWidth = 0;
664 380 : if(!(aValue >>= nWidth))
665 0 : throw lang::IllegalArgumentException();
666 :
667 380 : SetWidth( nWidth );
668 380 : break;
669 : }
670 : case WID_PAGE_HEIGHT:
671 : {
672 380 : sal_Int32 nHeight = 0;
673 380 : if(!(aValue >>= nHeight))
674 0 : throw lang::IllegalArgumentException();
675 :
676 380 : SetHeight( nHeight );
677 380 : break;
678 : }
679 : case WID_PAGE_ORIENT:
680 : {
681 187 : sal_Int32 nEnum = 0;
682 187 : if(!::cppu::enum2int( nEnum, aValue ))
683 0 : throw lang::IllegalArgumentException();
684 :
685 187 : Orientation eOri = (((view::PaperOrientation)nEnum) == view::PaperOrientation_PORTRAIT)?ORIENTATION_PORTRAIT:ORIENTATION_LANDSCAPE;
686 :
687 187 : if( eOri != GetPage()->GetOrientation() )
688 : {
689 16 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
690 16 : const PageKind ePageKind = GetPage()->GetPageKind();
691 :
692 16 : sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
693 40 : for (i = 0; i < nPageCnt; i++)
694 : {
695 24 : SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
696 24 : pPage->SetOrientation( eOri );
697 : }
698 :
699 16 : nPageCnt = pDoc->GetSdPageCount(ePageKind);
700 :
701 32 : for (i = 0; i < nPageCnt; i++)
702 : {
703 16 : SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
704 16 : pPage->SetOrientation( eOri );
705 : }
706 : }
707 187 : break;
708 : }
709 : case WID_PAGE_EFFECT:
710 : {
711 0 : sal_Int32 nEnum = 0;
712 0 : if(!::cppu::enum2int( nEnum, aValue ))
713 0 : throw lang::IllegalArgumentException();
714 :
715 0 : GetPage()->SetFadeEffect( (presentation::FadeEffect)nEnum );
716 0 : break;
717 : }
718 : case WID_PAGE_BACK:
719 291 : setBackground( aValue );
720 291 : break;
721 : case WID_PAGE_SPEED:
722 : {
723 2 : sal_Int32 nEnum = 0;
724 2 : if(!::cppu::enum2int( nEnum, aValue ))
725 0 : throw lang::IllegalArgumentException();
726 :
727 2 : GetPage()->setTransitionDuration( nEnum == 0 ? 3.0 : (nEnum == 1 ? 2.0 : 1.0 ) );
728 2 : break;
729 : }
730 : case WID_PAGE_VISIBLE :
731 : {
732 94 : bool bVisible = false;
733 94 : if( ! ( aValue >>= bVisible ) )
734 0 : throw lang::IllegalArgumentException();
735 94 : GetPage()->SetExcluded( !bVisible );
736 94 : break;
737 : }
738 : case WID_PAGE_SOUNDFILE :
739 : {
740 0 : OUString aURL;
741 0 : if( aValue >>= aURL )
742 : {
743 0 : GetPage()->SetSoundFile( aURL );
744 0 : GetPage()->SetSound( !aURL.isEmpty() );
745 0 : break;
746 : }
747 : else
748 : {
749 0 : bool bStopSound = false;
750 0 : if( aValue >>= bStopSound )
751 : {
752 0 : GetPage()->SetStopSound( bStopSound );
753 0 : break;
754 : }
755 : }
756 :
757 0 : throw lang::IllegalArgumentException();
758 : }
759 : case WID_LOOP_SOUND:
760 : {
761 0 : bool bLoop = false;
762 0 : if( ! (aValue >>= bLoop) )
763 0 : throw lang::IllegalArgumentException();
764 :
765 0 : GetPage()->SetLoopSound( bLoop );
766 0 : break;
767 : }
768 : case WID_PAGE_BACKFULL:
769 : {
770 47 : bool bFullSize = false;
771 47 : if( ! ( aValue >>= bFullSize ) )
772 0 : throw lang::IllegalArgumentException();
773 47 : GetPage()->SetBackgroundFullSize( bFullSize );
774 47 : break;
775 : }
776 : case WID_PAGE_BACKVIS:
777 : {
778 67 : bool bVisible = false;
779 67 : if( ! ( aValue >>= bVisible ) )
780 0 : throw lang::IllegalArgumentException();
781 :
782 67 : SdrPage* pPage = GetPage();
783 67 : if( pPage )
784 : {
785 67 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
786 67 : if( pDoc->GetMasterPageCount() )
787 : {
788 67 : SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
789 67 : SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
790 67 : aVisibleLayers.Set(rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRND), false), bVisible);
791 67 : pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
792 : }
793 : }
794 67 : break;
795 : }
796 : case WID_PAGE_BACKOBJVIS:
797 : {
798 67 : bool bVisible = false;
799 67 : if( ! ( aValue >>= bVisible ) )
800 0 : throw lang::IllegalArgumentException();
801 :
802 67 : SdrPage* pPage = GetPage();
803 67 : if( pPage )
804 : {
805 67 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
806 67 : if( pDoc->GetMasterPageCount() )
807 : {
808 67 : SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
809 67 : SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
810 67 : aVisibleLayers.Set(rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRNDOBJ), false), bVisible);
811 67 : pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
812 : }
813 : }
814 :
815 67 : break;
816 : }
817 : case WID_PAGE_USERATTRIBS:
818 : {
819 0 : if( !GetPage()->setAlienAttributes( aValue ) )
820 0 : throw lang::IllegalArgumentException();
821 0 : break;
822 : }
823 : case WID_PAGE_BOOKMARK:
824 : {
825 0 : OUString aBookmarkURL;
826 0 : if( ! ( aValue >>= aBookmarkURL ) )
827 0 : throw lang::IllegalArgumentException();
828 :
829 0 : setBookmarkURL( aBookmarkURL );
830 0 : break;
831 : }
832 :
833 : case WID_PAGE_HEADERVISIBLE:
834 : case WID_PAGE_HEADERTEXT:
835 : case WID_PAGE_FOOTERVISIBLE:
836 : case WID_PAGE_FOOTERTEXT:
837 : case WID_PAGE_PAGENUMBERVISIBLE:
838 : case WID_PAGE_DATETIMEVISIBLE:
839 : case WID_PAGE_DATETIMEFIXED:
840 : case WID_PAGE_DATETIMETEXT:
841 : case WID_PAGE_DATETIMEFORMAT:
842 : {
843 983 : sd::HeaderFooterSettings aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
844 :
845 983 : switch( pEntry->nWID )
846 : {
847 : case WID_PAGE_HEADERVISIBLE:
848 : {
849 125 : bool bVisible = false;
850 125 : if( ! ( aValue >>= bVisible ) )
851 0 : throw lang::IllegalArgumentException();
852 :
853 125 : aHeaderFooterSettings.mbHeaderVisible = bVisible;
854 125 : break;
855 : }
856 : case WID_PAGE_HEADERTEXT:
857 : {
858 0 : OUString aText;
859 0 : if( ! ( aValue >>= aText ) )
860 0 : throw lang::IllegalArgumentException();
861 :
862 0 : aHeaderFooterSettings.maHeaderText = aText;
863 0 : break;
864 : }
865 : case WID_PAGE_FOOTERVISIBLE:
866 : {
867 286 : bool bVisible = false;
868 286 : if( ! ( aValue >>= bVisible ) )
869 0 : throw lang::IllegalArgumentException();
870 :
871 286 : aHeaderFooterSettings.mbFooterVisible = bVisible;
872 286 : break;
873 : }
874 : case WID_PAGE_FOOTERTEXT:
875 : {
876 0 : OUString aText;
877 0 : if( ! ( aValue >>= aText ) )
878 0 : throw lang::IllegalArgumentException();
879 :
880 0 : aHeaderFooterSettings.maFooterText = aText;
881 0 : break;
882 : }
883 : case WID_PAGE_PAGENUMBERVISIBLE:
884 : {
885 286 : bool bVisible = false;
886 286 : if( ! ( aValue >>= bVisible ) )
887 0 : throw lang::IllegalArgumentException();
888 :
889 286 : aHeaderFooterSettings.mbSlideNumberVisible = bVisible;
890 286 : break;
891 : }
892 : case WID_PAGE_DATETIMEVISIBLE:
893 : {
894 286 : bool bVisible = false;
895 286 : if( ! ( aValue >>= bVisible ) )
896 0 : throw lang::IllegalArgumentException();
897 :
898 286 : aHeaderFooterSettings.mbDateTimeVisible = bVisible;
899 286 : break;
900 : }
901 : case WID_PAGE_DATETIMEFIXED:
902 : {
903 0 : bool bVisible = false;
904 0 : if( ! ( aValue >>= bVisible ) )
905 0 : throw lang::IllegalArgumentException();
906 :
907 0 : aHeaderFooterSettings.mbDateTimeIsFixed = bVisible;
908 0 : break;
909 : }
910 : case WID_PAGE_DATETIMETEXT:
911 : {
912 0 : OUString aText;
913 0 : if( ! ( aValue >>= aText ) )
914 0 : throw lang::IllegalArgumentException();
915 :
916 0 : aHeaderFooterSettings.maDateTimeText = aText;
917 0 : break;
918 : }
919 : case WID_PAGE_DATETIMEFORMAT:
920 : {
921 0 : sal_Int32 nValue = 0;
922 0 : if( ! ( aValue >>= nValue ) )
923 0 : throw lang::IllegalArgumentException();
924 :
925 0 : aHeaderFooterSettings.meDateTimeFormat = nValue;
926 0 : break;
927 : }
928 : }
929 :
930 983 : if( !(aHeaderFooterSettings == GetPage()->getHeaderFooterSettings()) )
931 227 : GetPage()->setHeaderFooterSettings( aHeaderFooterSettings );
932 :
933 983 : break;
934 : }
935 :
936 : case WID_PAGE_NUMBER:
937 0 : if( (GetPage()->GetPageKind() == PK_HANDOUT) && !GetPage()->IsMasterPage() )
938 : {
939 0 : if( !(aValue >>= mnTempPageNumber) )
940 0 : throw lang::IllegalArgumentException();
941 :
942 0 : break;
943 : }
944 0 : throw beans::PropertyVetoException();
945 :
946 : case WID_PAGE_LDBITMAP:
947 : case WID_PAGE_LDNAME:
948 : case WID_PAGE_ISDARK:
949 3 : throw beans::PropertyVetoException();
950 :
951 : case WID_TRANSITION_TYPE:
952 : {
953 2 : sal_Int16 nValue = 0;
954 2 : if( ! ( aValue >>= nValue ) )
955 0 : throw lang::IllegalArgumentException();
956 :
957 2 : GetPage()->setTransitionType( nValue );
958 2 : break;
959 : }
960 :
961 : case WID_TRANSITION_SUBTYPE:
962 : {
963 2 : sal_Int16 nValue = 0;
964 2 : if( ! ( aValue >>= nValue ) )
965 0 : throw lang::IllegalArgumentException();
966 :
967 2 : GetPage()->setTransitionSubtype( nValue );
968 2 : break;
969 : }
970 :
971 : case WID_TRANSITION_DIRECTION:
972 : {
973 2 : bool bValue = false;
974 2 : if( ! ( aValue >>= bValue ) )
975 0 : throw lang::IllegalArgumentException();
976 :
977 2 : GetPage()->setTransitionDirection( bValue );
978 2 : break;
979 : }
980 :
981 : case WID_TRANSITION_FADE_COLOR:
982 : {
983 2 : sal_Int32 nValue = 0;
984 2 : if( ! ( aValue >>= nValue ) )
985 0 : throw lang::IllegalArgumentException();
986 :
987 2 : GetPage()->setTransitionFadeColor( nValue );
988 2 : break;
989 : }
990 :
991 : case WID_TRANSITION_DURATION:
992 : {
993 0 : double fValue = 0.0;
994 0 : if( ! ( aValue >>= fValue ) )
995 0 : throw lang::IllegalArgumentException();
996 :
997 0 : GetPage()->setTransitionDuration( fValue );
998 0 : break;
999 : }
1000 :
1001 : default:
1002 186 : throw beans::UnknownPropertyException();
1003 : }
1004 :
1005 3953 : GetModel()->SetModified();
1006 3764 : }
1007 :
1008 2362 : Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
1009 : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1010 : {
1011 2362 : ::SolarMutexGuard aGuard;
1012 :
1013 2362 : throwIfDisposed();
1014 :
1015 2362 : uno::Any aAny;
1016 :
1017 2362 : const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
1018 :
1019 2362 : switch( pEntry ? pEntry->nWID : -1 )
1020 : {
1021 : case WID_NAVORDER:
1022 21 : aAny = getNavigationOrder();
1023 21 : break;
1024 : case WID_PAGE_LEFT:
1025 74 : aAny <<= (sal_Int32)( GetPage()->GetLftBorder() );
1026 74 : break;
1027 : case WID_PAGE_RIGHT:
1028 51 : aAny <<= (sal_Int32)( GetPage()->GetRgtBorder() );
1029 51 : break;
1030 : case WID_PAGE_TOP:
1031 74 : aAny <<= (sal_Int32)( GetPage()->GetUppBorder() );
1032 74 : break;
1033 : case WID_PAGE_BOTTOM:
1034 51 : aAny <<= (sal_Int32)( GetPage()->GetLwrBorder() );
1035 51 : break;
1036 : case WID_PAGE_WIDTH:
1037 132 : aAny <<= (sal_Int32)( GetPage()->GetSize().getWidth() );
1038 132 : break;
1039 : case WID_PAGE_HEIGHT:
1040 132 : aAny <<= (sal_Int32)( GetPage()->GetSize().getHeight() );
1041 132 : break;
1042 : case WID_PAGE_ORIENT:
1043 45 : aAny = ::cppu::int2enum( (sal_Int32)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT)? view::PaperOrientation_PORTRAIT: view::PaperOrientation_LANDSCAPE), ::cppu::UnoType<view::PaperOrientation>::get() );
1044 45 : break;
1045 : case WID_PAGE_EFFECT:
1046 42 : aAny = ::cppu::int2enum( (sal_Int32)GetPage()->GetFadeEffect(), ::cppu::UnoType<presentation::FadeEffect>::get() );
1047 42 : break;
1048 : case WID_PAGE_CHANGE:
1049 14 : aAny <<= (sal_Int32)( GetPage()->GetPresChange() );
1050 14 : break;
1051 : case WID_PAGE_SPEED:
1052 : {
1053 14 : const double fDuration = GetPage()->getTransitionDuration();
1054 14 : aAny = ::cppu::int2enum( fDuration < 2.0 ? 2 : (fDuration > 2.0 ? 0 : 1), ::cppu::UnoType<presentation::AnimationSpeed>::get() );
1055 : }
1056 14 : break;
1057 : case WID_PAGE_LAYOUT:
1058 82 : aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() );
1059 82 : break;
1060 : case WID_PAGE_NUMBER:
1061 : {
1062 344 : const sal_uInt16 nPageNumber(GetPage()->GetPageNum());
1063 :
1064 344 : if(nPageNumber > 0)
1065 : {
1066 : // for all other pages calculate the number
1067 341 : aAny <<= (sal_Int16)((sal_uInt16)((nPageNumber-1)>>1) + 1);
1068 : }
1069 : else
1070 : {
1071 3 : aAny <<= mnTempPageNumber;
1072 : }
1073 : }
1074 344 : break;
1075 : case WID_PAGE_DURATION:
1076 5 : aAny <<= (sal_Int32)( GetPage()->GetTime() + .5 );
1077 5 : break;
1078 : case WID_PAGE_HIGHRESDURATION:
1079 9 : aAny <<= (double)( GetPage()->GetTime() );
1080 9 : break;
1081 : case WID_PAGE_LDNAME:
1082 : {
1083 2 : const OUString aName( GetPage()->GetName() );
1084 2 : aAny <<= aName;
1085 2 : break;
1086 : }
1087 : case WID_PAGE_LDBITMAP:
1088 : {
1089 : Reference< awt::XBitmap > xBitmap(
1090 0 : VCLUnoHelper::CreateBitmap( BitmapEx( SdResId( BMP_PAGE ) ) ) );
1091 0 : aAny <<= xBitmap;
1092 : }
1093 0 : break;
1094 : case WID_PAGE_BACK:
1095 535 : getBackground( aAny );
1096 535 : break;
1097 : case WID_PAGE_PREVIEW :
1098 : {
1099 0 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1100 0 : if ( pDoc )
1101 : {
1102 0 : ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
1103 0 : if ( pDocShell )
1104 : {
1105 0 : sal_uInt16 nPgNum = 0;
1106 0 : sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
1107 0 : sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1108 0 : while( nPgNum < nPageCount )
1109 : {
1110 0 : pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
1111 0 : nPgNum++;
1112 : }
1113 0 : std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
1114 0 : if (xMetaFile)
1115 : {
1116 0 : Point aPoint;
1117 0 : Size aSize( GetPage()->GetSize() );
1118 0 : xMetaFile->AddAction( static_cast<MetaAction*>(new MetaFillColorAction( COL_WHITE, true )), 0 );
1119 0 : xMetaFile->AddAction( static_cast<MetaAction*>(new MetaRectAction( Rectangle( aPoint, aSize ) )), 1 );
1120 0 : xMetaFile->SetPrefMapMode( MAP_100TH_MM );
1121 0 : xMetaFile->SetPrefSize( aSize );
1122 :
1123 0 : SvMemoryStream aDestStrm( 65535, 65535 );
1124 0 : ConvertGDIMetaFileToWMF( *xMetaFile, aDestStrm, NULL, false );
1125 0 : Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aDestStrm.GetData()), aDestStrm.Tell() );
1126 0 : aAny <<= aSeq;
1127 0 : }
1128 : }
1129 : }
1130 : }
1131 0 : break;
1132 :
1133 : case WID_PAGE_PREVIEWBITMAP :
1134 : {
1135 3 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1136 3 : if ( pDoc )
1137 : {
1138 3 : ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
1139 3 : if ( pDocShell )
1140 : {
1141 3 : sal_uInt16 nPgNum = 0;
1142 3 : sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
1143 3 : sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1144 11 : while( nPgNum < nPageCount )
1145 : {
1146 5 : pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
1147 5 : nPgNum++;
1148 : }
1149 3 : std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
1150 6 : BitmapEx aBitmap;
1151 3 : if (xMetaFile && xMetaFile->CreateThumbnail(aBitmap))
1152 : {
1153 3 : SvMemoryStream aMemStream;
1154 3 : WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false);
1155 6 : uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aMemStream.GetData()), aMemStream.Tell() );
1156 6 : aAny <<= aSeq;
1157 3 : }
1158 : }
1159 : }
1160 : }
1161 3 : break;
1162 :
1163 : case WID_PAGE_VISIBLE :
1164 : {
1165 42 : bool bVisible = !GetPage()->IsExcluded();
1166 42 : aAny <<= bVisible;
1167 42 : break;
1168 : }
1169 :
1170 : case WID_PAGE_SOUNDFILE :
1171 : {
1172 23 : if( GetPage()->IsStopSound() )
1173 : {
1174 0 : aAny <<= true;
1175 : }
1176 : else
1177 : {
1178 23 : OUString aURL;
1179 23 : if( GetPage()->IsSoundOn() )
1180 0 : aURL = GetPage()->GetSoundFile();
1181 23 : aAny <<= aURL;
1182 : }
1183 23 : break;
1184 : }
1185 : case WID_LOOP_SOUND:
1186 : {
1187 5 : aAny <<= GetPage()->IsLoopSound();
1188 5 : break;
1189 : }
1190 : case WID_PAGE_BACKFULL:
1191 : {
1192 15 : bool bFullSize = GetPage()->IsBackgroundFullSize();
1193 15 : aAny <<= bFullSize;
1194 15 : break;
1195 : }
1196 : case WID_PAGE_BACKVIS:
1197 : {
1198 9 : SdrPage* pPage = GetPage();
1199 9 : if( pPage )
1200 : {
1201 9 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
1202 9 : if( pDoc->GetMasterPageCount() )
1203 : {
1204 9 : SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
1205 9 : SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1206 9 : aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRND), false));
1207 : }
1208 : else
1209 : {
1210 0 : aAny <<= false;
1211 : }
1212 : }
1213 9 : break;
1214 : }
1215 : case WID_PAGE_BACKOBJVIS:
1216 : {
1217 42 : SdrPage* pPage = GetPage();
1218 42 : if( pPage )
1219 : {
1220 42 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
1221 42 : if( pDoc->GetMasterPageCount() )
1222 : {
1223 42 : SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
1224 42 : SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1225 42 : aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRNDOBJ), false));
1226 : }
1227 : else
1228 : {
1229 0 : aAny <<= false;
1230 : }
1231 : }
1232 42 : break;
1233 : }
1234 : case WID_PAGE_USERATTRIBS:
1235 : {
1236 51 : GetPage()->getAlienAttributes( aAny );
1237 51 : break;
1238 : }
1239 : case WID_PAGE_BOOKMARK:
1240 : {
1241 19 : aAny <<= getBookmarkURL();
1242 19 : break;
1243 : }
1244 : case WID_PAGE_ISDARK:
1245 : {
1246 117 : aAny <<= GetPage()->GetPageBackgroundColor().IsDark();
1247 117 : break;
1248 : }
1249 : case WID_PAGE_HEADERVISIBLE:
1250 21 : aAny <<= GetPage()->getHeaderFooterSettings().mbHeaderVisible;
1251 21 : break;
1252 : case WID_PAGE_HEADERTEXT:
1253 : {
1254 24 : const OUString aText( GetPage()->getHeaderFooterSettings().maHeaderText );
1255 24 : aAny <<= aText;
1256 : }
1257 24 : break;
1258 : case WID_PAGE_FOOTERVISIBLE:
1259 35 : aAny <<= GetPage()->getHeaderFooterSettings().mbFooterVisible;
1260 35 : break;
1261 : case WID_PAGE_FOOTERTEXT:
1262 : {
1263 38 : const OUString aText( GetPage()->getHeaderFooterSettings().maFooterText );
1264 38 : aAny <<= aText;
1265 : }
1266 38 : break;
1267 : case WID_PAGE_PAGENUMBERVISIBLE:
1268 35 : aAny <<= GetPage()->getHeaderFooterSettings().mbSlideNumberVisible;
1269 35 : break;
1270 : case WID_PAGE_DATETIMEVISIBLE:
1271 35 : aAny <<= GetPage()->getHeaderFooterSettings().mbDateTimeVisible;
1272 35 : break;
1273 : case WID_PAGE_DATETIMEFIXED:
1274 35 : aAny <<= GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed;
1275 35 : break;
1276 : case WID_PAGE_DATETIMETEXT:
1277 : {
1278 38 : const OUString aText( GetPage()->getHeaderFooterSettings().maDateTimeText );
1279 38 : aAny <<= aText;
1280 : }
1281 38 : break;
1282 : case WID_PAGE_DATETIMEFORMAT:
1283 35 : aAny <<= (sal_Int32)GetPage()->getHeaderFooterSettings().meDateTimeFormat;
1284 35 : break;
1285 :
1286 : case WID_TRANSITION_TYPE:
1287 51 : aAny <<= GetPage()->getTransitionType();
1288 51 : break;
1289 :
1290 : case WID_TRANSITION_SUBTYPE:
1291 42 : aAny <<= GetPage()->getTransitionSubtype();
1292 42 : break;
1293 :
1294 : case WID_TRANSITION_DIRECTION:
1295 9 : aAny <<= GetPage()->getTransitionDirection();
1296 9 : break;
1297 :
1298 : case WID_TRANSITION_FADE_COLOR:
1299 9 : aAny <<= GetPage()->getTransitionFadeColor();
1300 9 : break;
1301 :
1302 : case WID_TRANSITION_DURATION:
1303 0 : aAny <<= GetPage()->getTransitionDuration();
1304 0 : break;
1305 :
1306 : default:
1307 2 : throw beans::UnknownPropertyException();
1308 : }
1309 2362 : return aAny;
1310 : }
1311 :
1312 0 : void SAL_CALL SdGenericDrawPage::addPropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
1313 0 : void SAL_CALL SdGenericDrawPage::removePropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
1314 0 : void SAL_CALL SdGenericDrawPage::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
1315 0 : void SAL_CALL SdGenericDrawPage::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
1316 :
1317 : // XMultiPropertySet
1318 300 : void SAL_CALL SdGenericDrawPage::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
1319 : {
1320 300 : if( aPropertyNames.getLength() != aValues.getLength() )
1321 0 : throw lang::IllegalArgumentException();
1322 :
1323 300 : const OUString* pNames = aPropertyNames.getConstArray();
1324 300 : const Any* pValues = aValues.getConstArray();
1325 300 : sal_uInt32 nCount = aValues.getLength();
1326 1258 : while( nCount-- )
1327 : {
1328 : try
1329 : {
1330 658 : setPropertyValue( *pNames++, *pValues++ );
1331 : }
1332 98 : catch( beans::UnknownPropertyException& )
1333 : {
1334 : // ignore for multi property set
1335 : // todo: optimize this!
1336 : }
1337 : }
1338 300 : }
1339 :
1340 34 : Sequence< Any > SAL_CALL SdGenericDrawPage::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException, std::exception)
1341 : {
1342 34 : const OUString* pNames = aPropertyNames.getConstArray();
1343 34 : sal_uInt32 nCount = aPropertyNames.getLength();
1344 34 : Sequence< Any > aValues( nCount );
1345 34 : Any* pValues = aValues.getArray();
1346 286 : while( nCount-- )
1347 : {
1348 218 : Any aValue;
1349 : try
1350 : {
1351 218 : aValue = getPropertyValue( *pNames++ );
1352 : }
1353 0 : catch( beans::UnknownPropertyException& )
1354 : {
1355 : // ignore for multi property set
1356 : // todo: optimize this!
1357 : }
1358 218 : *pValues++ = aValue;
1359 218 : }
1360 34 : return aValues;
1361 : }
1362 :
1363 0 : void SAL_CALL SdGenericDrawPage::addPropertiesChangeListener( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
1364 : {
1365 0 : }
1366 :
1367 0 : void SAL_CALL SdGenericDrawPage::removePropertiesChangeListener( const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
1368 : {
1369 0 : }
1370 :
1371 0 : void SAL_CALL SdGenericDrawPage::firePropertiesChangeEvent( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException, std::exception)
1372 : {
1373 0 : }
1374 :
1375 9253 : Reference< drawing::XShape > SdGenericDrawPage::_CreateShape(SdrObject *pObj) const
1376 : throw (RuntimeException, std::exception)
1377 : {
1378 : DBG_ASSERT( GetPage(), "SdGenericDrawPage::_CreateShape(), can't create shape for disposed page!" );
1379 : DBG_ASSERT( pObj, "SdGenericDrawPage::_CreateShape(), invalid call with pObj == 0!" );
1380 :
1381 9253 : if (!pObj)
1382 0 : return Reference< drawing::XShape >();
1383 :
1384 9253 : if (GetPage())
1385 : {
1386 9253 : PresObjKind eKind = GetPage()->GetPresObjKind(pObj);
1387 :
1388 9253 : SvxShape* pShape = NULL;
1389 :
1390 9253 : if(pObj->GetObjInventor() == SdrInventor)
1391 : {
1392 9248 : sal_uInt32 nInventor = pObj->GetObjIdentifier();
1393 9248 : switch( nInventor )
1394 : {
1395 : case OBJ_TITLETEXT:
1396 853 : pShape = new SvxShapeText( pObj );
1397 853 : if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
1398 : {
1399 : // fake a empty PageShape if it's a title shape on the master page
1400 170 : pShape->SetShapeType("com.sun.star.presentation.PageShape");
1401 : }
1402 : else
1403 : {
1404 683 : pShape->SetShapeType("com.sun.star.presentation.TitleTextShape");
1405 : }
1406 853 : eKind = PRESOBJ_NONE;
1407 853 : break;
1408 : case OBJ_OUTLINETEXT:
1409 829 : pShape = new SvxShapeText( pObj );
1410 829 : pShape->SetShapeType("com.sun.star.presentation.OutlinerShape");
1411 829 : eKind = PRESOBJ_NONE;
1412 829 : break;
1413 : }
1414 : }
1415 :
1416 9253 : Reference< drawing::XShape > xShape( pShape );
1417 :
1418 9253 : if(!xShape.is())
1419 7571 : xShape = SvxFmDrawPage::_CreateShape( pObj );
1420 :
1421 9253 : if( eKind != PRESOBJ_NONE )
1422 : {
1423 2627 : OUString aShapeType("com.sun.star.presentation.");
1424 :
1425 2627 : switch( eKind )
1426 : {
1427 : case PRESOBJ_TITLE:
1428 0 : aShapeType += "TitleTextShape";
1429 0 : break;
1430 : case PRESOBJ_OUTLINE:
1431 0 : aShapeType += "OutlinerShape";
1432 0 : break;
1433 : case PRESOBJ_TEXT:
1434 201 : aShapeType += "SubtitleShape";
1435 201 : break;
1436 : case PRESOBJ_GRAPHIC:
1437 69 : aShapeType += "GraphicObjectShape";
1438 69 : break;
1439 : case PRESOBJ_OBJECT:
1440 9 : aShapeType += "OLE2Shape";
1441 9 : break;
1442 : case PRESOBJ_CHART:
1443 0 : aShapeType += "ChartShape";
1444 0 : break;
1445 : case PRESOBJ_ORGCHART:
1446 0 : aShapeType += "OrgChartShape";
1447 0 : break;
1448 : case PRESOBJ_CALC:
1449 0 : aShapeType += "CalcShape";
1450 0 : break;
1451 : case PRESOBJ_TABLE:
1452 0 : aShapeType += "TableShape";
1453 0 : break;
1454 : case PRESOBJ_MEDIA:
1455 1 : aShapeType += "MediaShape";
1456 1 : break;
1457 : case PRESOBJ_PAGE:
1458 281 : aShapeType += "PageShape";
1459 281 : break;
1460 : case PRESOBJ_HANDOUT:
1461 474 : aShapeType += "HandoutShape";
1462 474 : break;
1463 : case PRESOBJ_NOTES:
1464 369 : aShapeType += "NotesShape";
1465 369 : break;
1466 : case PRESOBJ_FOOTER:
1467 353 : aShapeType += "FooterShape";
1468 353 : break;
1469 : case PRESOBJ_HEADER:
1470 164 : aShapeType += "HeaderShape";
1471 164 : break;
1472 : case PRESOBJ_SLIDENUMBER:
1473 353 : aShapeType += "SlideNumberShape";
1474 353 : break;
1475 : case PRESOBJ_DATETIME:
1476 353 : aShapeType += "DateTimeShape";
1477 353 : break;
1478 : // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
1479 : case PRESOBJ_NONE:
1480 : case PRESOBJ_IMAGE:
1481 : case PRESOBJ_MAX:
1482 0 : break;
1483 : }
1484 :
1485 2627 : if( !pShape )
1486 2627 : pShape = SvxShape::getImplementation( xShape );
1487 :
1488 2627 : if( pShape )
1489 2627 : pShape->SetShapeType( aShapeType );
1490 : }
1491 :
1492 9253 : SvxShape *pSdShape = SvxShape::getImplementation(xShape);
1493 9253 : if (pSdShape)
1494 : {
1495 : // SdXShape aggregates SvxShape
1496 9253 : new SdXShape(pSdShape, GetModel());
1497 : }
1498 9253 : return xShape;
1499 : }
1500 : else
1501 : {
1502 0 : return SvxFmDrawPage::_CreateShape( pObj );
1503 : }
1504 :
1505 : }
1506 :
1507 : // XServiceInfo
1508 373 : Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
1509 : throw(uno::RuntimeException, std::exception)
1510 : {
1511 373 : Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
1512 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage",
1513 : "com.sun.star.document.LinkTarget",
1514 373 : "com.sun.star.document.LinkTargetSupplier");
1515 373 : return aSeq;
1516 : }
1517 :
1518 : // XLinkTargetSupplier
1519 1 : Reference< container::XNameAccess > SAL_CALL SdGenericDrawPage::getLinks( )
1520 : throw(uno::RuntimeException, std::exception)
1521 : {
1522 1 : return new SdPageLinkTargets( this );
1523 : }
1524 :
1525 0 : void SdGenericDrawPage::setBackground( const Any& ) throw(lang::IllegalArgumentException)
1526 : {
1527 : OSL_FAIL( "Don't call me, I'm useless!" );
1528 0 : }
1529 :
1530 0 : void SdGenericDrawPage::getBackground( Any& ) throw()
1531 : {
1532 : OSL_FAIL( "Don't call me, I'm useless!" );
1533 0 : }
1534 :
1535 19 : OUString SdGenericDrawPage::getBookmarkURL() const
1536 : {
1537 19 : OUStringBuffer aRet;
1538 19 : if( SvxFmDrawPage::mpPage )
1539 : {
1540 19 : OUString aFileName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetFileName() );
1541 19 : if( !aFileName.isEmpty() )
1542 : {
1543 0 : const OUString aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetBookmarkName() ) );
1544 0 : aRet.append( aFileName );
1545 0 : aRet.append( '#' );
1546 0 : aRet.append( aBookmarkName );
1547 19 : }
1548 : }
1549 :
1550 19 : return aRet.makeStringAndClear();
1551 : }
1552 :
1553 0 : void SdGenericDrawPage::setBookmarkURL( OUString& rURL )
1554 : {
1555 0 : if( SvxFmDrawPage::mpPage )
1556 : {
1557 0 : sal_Int32 nIndex = rURL.indexOf( '#' );
1558 0 : if( nIndex != -1 )
1559 : {
1560 0 : const OUString aFileName( rURL.copy( 0, nIndex ) );
1561 0 : const OUString aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) );
1562 :
1563 0 : if( !aFileName.isEmpty() && !aBookmarkName.isEmpty() )
1564 : {
1565 0 : static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink();
1566 0 : static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName );
1567 0 : static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName );
1568 0 : static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink();
1569 0 : }
1570 : }
1571 : }
1572 0 : }
1573 :
1574 3 : Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::combine( const Reference< drawing::XShapes >& xShapes )
1575 : throw( uno::RuntimeException, std::exception )
1576 : {
1577 3 : ::SolarMutexGuard aGuard;
1578 :
1579 3 : throwIfDisposed();
1580 :
1581 : DBG_ASSERT(SvxFmDrawPage::mpPage,"SdrPage is NULL! [CL]");
1582 : DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
1583 :
1584 3 : Reference< drawing::XShape > xShape;
1585 3 : if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
1586 0 : return xShape;
1587 :
1588 3 : SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1589 :
1590 3 : _SelectObjectsInView( xShapes, pPageView );
1591 :
1592 3 : mpView->CombineMarkedObjects( false );
1593 :
1594 3 : mpView->AdjustMarkHdl();
1595 3 : const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
1596 3 : if( rMarkList.GetMarkCount() == 1 )
1597 : {
1598 3 : SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
1599 3 : if( pObj )
1600 3 : xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
1601 : }
1602 :
1603 3 : mpView->HideSdrPage();
1604 :
1605 3 : GetModel()->SetModified();
1606 :
1607 3 : return xShape;
1608 : }
1609 :
1610 3 : void SAL_CALL SdGenericDrawPage::split( const Reference< drawing::XShape >& xGroup )
1611 : throw( uno::RuntimeException, std::exception )
1612 : {
1613 3 : ::SolarMutexGuard aGuard;
1614 :
1615 3 : throwIfDisposed();
1616 :
1617 3 : if(mpView==NULL||!xGroup.is()||GetPage()==NULL)
1618 3 : return;
1619 :
1620 3 : SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1621 3 : _SelectObjectInView( xGroup, pPageView );
1622 3 : mpView->DismantleMarkedObjects( false );
1623 3 : mpView->HideSdrPage();
1624 :
1625 3 : GetModel()->SetModified();
1626 : }
1627 :
1628 3 : Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::bind( const Reference< drawing::XShapes >& xShapes )
1629 : throw( uno::RuntimeException, std::exception )
1630 : {
1631 3 : ::SolarMutexGuard aGuard;
1632 :
1633 3 : throwIfDisposed();
1634 :
1635 3 : uno::Reference< drawing::XShape > xShape;
1636 3 : if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
1637 0 : return xShape;
1638 :
1639 3 : SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1640 :
1641 3 : _SelectObjectsInView( xShapes, pPageView );
1642 :
1643 3 : mpView->CombineMarkedObjects( true );
1644 :
1645 3 : mpView->AdjustMarkHdl();
1646 3 : const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
1647 3 : if( rMarkList.GetMarkCount() == 1 )
1648 : {
1649 3 : SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
1650 3 : if( pObj )
1651 3 : xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
1652 : }
1653 :
1654 3 : mpView->HideSdrPage();
1655 :
1656 3 : GetModel()->SetModified();
1657 :
1658 3 : return xShape;
1659 : }
1660 :
1661 3 : void SAL_CALL SdGenericDrawPage::unbind( const Reference< drawing::XShape >& xShape )
1662 : throw( uno::RuntimeException, std::exception )
1663 : {
1664 3 : ::SolarMutexGuard aGuard;
1665 :
1666 3 : throwIfDisposed();
1667 :
1668 3 : if(mpView==NULL||!xShape.is()||GetPage()==NULL)
1669 3 : return;
1670 :
1671 3 : SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1672 3 : _SelectObjectInView( xShape, pPageView );
1673 3 : mpView->DismantleMarkedObjects( true );
1674 3 : mpView->HideSdrPage();
1675 :
1676 3 : GetModel()->SetModified();
1677 : }
1678 :
1679 187 : void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue )
1680 : {
1681 187 : if( nValue != GetPage()->GetLftBorder() )
1682 : {
1683 50 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1684 50 : const PageKind ePageKind = GetPage()->GetPageKind();
1685 :
1686 50 : sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
1687 102 : for (i = 0; i < nPageCnt; i++)
1688 : {
1689 52 : SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
1690 52 : pPage->SetLftBorder( nValue );
1691 : }
1692 :
1693 50 : nPageCnt = pDoc->GetSdPageCount(ePageKind);
1694 :
1695 100 : for (i = 0; i < nPageCnt; i++)
1696 : {
1697 50 : SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
1698 50 : pPage->SetLftBorder( nValue );
1699 : }
1700 : }
1701 187 : }
1702 :
1703 187 : void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue )
1704 : {
1705 187 : if( nValue != GetPage()->GetRgtBorder() )
1706 : {
1707 50 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1708 50 : const PageKind ePageKind = GetPage()->GetPageKind();
1709 :
1710 50 : sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
1711 102 : for (i = 0; i < nPageCnt; i++)
1712 : {
1713 52 : SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
1714 52 : pPage->SetRgtBorder( nValue );
1715 : }
1716 :
1717 50 : nPageCnt = pDoc->GetSdPageCount(ePageKind);
1718 :
1719 100 : for (i = 0; i < nPageCnt; i++)
1720 : {
1721 50 : SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
1722 50 : pPage->SetRgtBorder( nValue );
1723 : }
1724 : }
1725 187 : }
1726 :
1727 187 : void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue )
1728 : {
1729 187 : if( nValue != GetPage()->GetUppBorder() )
1730 : {
1731 50 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1732 50 : const PageKind ePageKind = GetPage()->GetPageKind();
1733 :
1734 50 : sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
1735 102 : for (i = 0; i < nPageCnt; i++)
1736 : {
1737 52 : SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
1738 52 : pPage->SetUppBorder( nValue );
1739 : }
1740 :
1741 50 : nPageCnt = pDoc->GetSdPageCount(ePageKind);
1742 :
1743 100 : for (i = 0; i < nPageCnt; i++)
1744 : {
1745 50 : SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
1746 50 : pPage->SetUppBorder( nValue );
1747 : }
1748 : }
1749 187 : }
1750 :
1751 187 : void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue )
1752 : {
1753 187 : if( nValue != GetPage()->GetLwrBorder() )
1754 : {
1755 50 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1756 50 : const PageKind ePageKind = GetPage()->GetPageKind();
1757 :
1758 50 : sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
1759 102 : for (i = 0; i < nPageCnt; i++)
1760 : {
1761 52 : SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
1762 52 : pPage->SetLwrBorder( nValue );
1763 : }
1764 :
1765 50 : nPageCnt = pDoc->GetSdPageCount(ePageKind);
1766 :
1767 100 : for (i = 0; i < nPageCnt; i++)
1768 : {
1769 50 : SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
1770 50 : pPage->SetLwrBorder( nValue );
1771 : }
1772 : }
1773 187 : }
1774 :
1775 298 : static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind )
1776 : {
1777 298 : ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
1778 298 : if ( pDocShell )
1779 : {
1780 298 : ::sd::ViewShell* pViewSh = pDocShell->GetViewShell();
1781 :
1782 298 : if( pViewSh )
1783 : {
1784 44 : if( pViewSh->ISA(::sd::DrawViewShell ) )
1785 44 : static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage();
1786 :
1787 44 : Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
1788 44 : const long nWidth = aPageSize.Width();
1789 44 : const long nHeight = aPageSize.Height();
1790 :
1791 44 : Point aPageOrg = Point(nWidth, nHeight / 2);
1792 44 : Size aViewSize = Size(nWidth * 3, nHeight * 2);
1793 :
1794 44 : pDoc->SetMaxObjSize(aViewSize);
1795 :
1796 44 : pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), true);
1797 :
1798 44 : pViewSh->UpdateScrollBars();
1799 : }
1800 : }
1801 298 : }
1802 :
1803 380 : void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
1804 : {
1805 380 : Size aSize( GetPage()->GetSize() );
1806 380 : if( aSize.getWidth() != nWidth )
1807 : {
1808 149 : aSize.setWidth( nWidth );
1809 :
1810 149 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1811 149 : const PageKind ePageKind = GetPage()->GetPageKind();
1812 :
1813 149 : sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
1814 301 : for (i = 0; i < nPageCnt; i++)
1815 : {
1816 152 : SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
1817 152 : pPage->SetSize(aSize);
1818 : }
1819 :
1820 149 : nPageCnt = pDoc->GetSdPageCount(ePageKind);
1821 :
1822 299 : for (i = 0; i < nPageCnt; i++)
1823 : {
1824 150 : SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
1825 150 : pPage->SetSize(aSize);
1826 : }
1827 :
1828 149 : refreshpage( pDoc, ePageKind );
1829 : }
1830 380 : }
1831 :
1832 380 : void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
1833 : {
1834 380 : Size aSize( GetPage()->GetSize() );
1835 380 : if( aSize.getHeight() != nHeight )
1836 : {
1837 149 : aSize.setHeight( nHeight );
1838 :
1839 149 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
1840 149 : const PageKind ePageKind = GetPage()->GetPageKind();
1841 :
1842 149 : sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
1843 301 : for (i = 0; i < nPageCnt; i++)
1844 : {
1845 152 : SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
1846 152 : pPage->SetSize(aSize);
1847 : }
1848 :
1849 149 : nPageCnt = pDoc->GetSdPageCount(ePageKind);
1850 :
1851 299 : for (i = 0; i < nPageCnt; i++)
1852 : {
1853 150 : SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
1854 150 : pPage->SetSize(aSize);
1855 : }
1856 :
1857 149 : refreshpage( pDoc, ePageKind );
1858 : }
1859 380 : }
1860 :
1861 : // XInterface
1862 0 : void SdGenericDrawPage::release() throw()
1863 : {
1864 :
1865 0 : OWeakAggObject::release();
1866 0 : }
1867 :
1868 : // XComponent
1869 1276 : void SdGenericDrawPage::disposing() throw()
1870 : {
1871 1276 : mpModel = 0;
1872 1276 : SvxFmDrawPage::disposing();
1873 1276 : }
1874 :
1875 : // XAnimationNodeSupplier
1876 279 : Reference< XAnimationNode > SAL_CALL SdGenericDrawPage::getAnimationNode() throw (uno::RuntimeException, std::exception)
1877 : {
1878 279 : ::SolarMutexGuard aGuard;
1879 :
1880 279 : throwIfDisposed();
1881 :
1882 279 : SdPage *pSdPage = static_cast<SdPage*>(SvxFmDrawPage::mpPage);
1883 :
1884 279 : return pSdPage->getAnimationNode();
1885 : }
1886 :
1887 : // SdPageLinkTargets
1888 1 : SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw()
1889 : {
1890 1 : mxPage = pUnoPage;
1891 1 : mpUnoPage = pUnoPage;
1892 1 : }
1893 :
1894 2 : SdPageLinkTargets::~SdPageLinkTargets() throw()
1895 : {
1896 2 : }
1897 :
1898 : // XElementAccess
1899 1 : uno::Type SAL_CALL SdPageLinkTargets::getElementType()
1900 : throw(uno::RuntimeException, std::exception)
1901 : {
1902 1 : return cppu::UnoType<beans::XPropertySet>::get();
1903 : }
1904 :
1905 1 : sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
1906 : throw(uno::RuntimeException, std::exception)
1907 : {
1908 1 : ::SolarMutexGuard aGuard;
1909 :
1910 1 : SdPage* pPage = mpUnoPage->GetPage();
1911 1 : if( pPage != NULL )
1912 : {
1913 1 : SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
1914 :
1915 2 : while( aIter.IsMore() )
1916 : {
1917 1 : SdrObject* pObj = aIter.Next();
1918 1 : OUString aStr( pObj->GetName() );
1919 1 : if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) )
1920 1 : aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
1921 1 : if( !aStr.isEmpty() )
1922 1 : return sal_True;
1923 0 : }
1924 : }
1925 :
1926 0 : return sal_False;
1927 : }
1928 :
1929 : // container::XNameAccess
1930 :
1931 : // XNameAccess
1932 2 : Any SAL_CALL SdPageLinkTargets::getByName( const OUString& aName )
1933 : throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1934 : {
1935 2 : ::SolarMutexGuard aGuard;
1936 :
1937 2 : SdPage* pPage = mpUnoPage->GetPage();
1938 2 : if( pPage != NULL )
1939 : {
1940 2 : SdrObject* pObj = FindObject( aName );
1941 2 : if( pObj )
1942 : {
1943 1 : Reference< beans::XPropertySet > aRef( pObj->getUnoShape(), uno::UNO_QUERY );
1944 2 : return makeAny( aRef );
1945 : }
1946 : }
1947 :
1948 1 : throw container::NoSuchElementException();
1949 : }
1950 :
1951 1 : Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
1952 : throw(uno::RuntimeException, std::exception)
1953 : {
1954 1 : ::SolarMutexGuard aGuard;
1955 :
1956 1 : sal_uInt32 nObjCount = 0;
1957 :
1958 1 : SdPage* pPage = mpUnoPage->GetPage();
1959 1 : if( pPage != NULL )
1960 : {
1961 1 : SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
1962 3 : while( aIter.IsMore() )
1963 : {
1964 1 : SdrObject* pObj = aIter.Next();
1965 1 : OUString aStr( pObj->GetName() );
1966 1 : if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) )
1967 1 : aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
1968 1 : if( !aStr.isEmpty() )
1969 1 : nObjCount++;
1970 2 : }
1971 : }
1972 :
1973 1 : Sequence< OUString > aSeq( nObjCount );
1974 1 : if( nObjCount > 0 )
1975 : {
1976 1 : OUString* pStr = aSeq.getArray();
1977 :
1978 1 : SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
1979 3 : while( aIter.IsMore() )
1980 : {
1981 1 : SdrObject* pObj = aIter.Next();
1982 1 : OUString aStr( pObj->GetName() );
1983 1 : if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) )
1984 1 : aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
1985 1 : if( !aStr.isEmpty() )
1986 1 : *pStr++ = aStr;
1987 2 : }
1988 : }
1989 :
1990 1 : return aSeq;
1991 : }
1992 :
1993 2 : sal_Bool SAL_CALL SdPageLinkTargets::hasByName( const OUString& aName )
1994 : throw(uno::RuntimeException, std::exception)
1995 : {
1996 2 : ::SolarMutexGuard aGuard;
1997 :
1998 2 : return FindObject( aName ) != NULL;
1999 : }
2000 :
2001 4 : SdrObject* SdPageLinkTargets::FindObject( const OUString& rName ) const throw()
2002 : {
2003 4 : SdPage* pPage = mpUnoPage->GetPage();
2004 4 : if( pPage == NULL )
2005 0 : return NULL;
2006 :
2007 4 : SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
2008 :
2009 10 : while( aIter.IsMore() )
2010 : {
2011 4 : SdrObject* pObj = aIter.Next();
2012 4 : OUString aStr( pObj->GetName() );
2013 4 : if( aStr.isEmpty() && pObj->ISA( SdrOle2Obj ) )
2014 4 : aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
2015 4 : if( !aStr.isEmpty() && (aStr == rName) )
2016 2 : return pObj;
2017 2 : }
2018 :
2019 2 : return NULL;
2020 : }
2021 :
2022 : // XServiceInfo
2023 0 : OUString SAL_CALL SdPageLinkTargets::getImplementationName()
2024 : throw(uno::RuntimeException, std::exception)
2025 : {
2026 0 : return OUString( "SdPageLinkTargets" );
2027 : }
2028 :
2029 0 : sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName )
2030 : throw(uno::RuntimeException, std::exception)
2031 : {
2032 0 : return cppu::supportsService( this, ServiceName );
2033 : }
2034 :
2035 0 : Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames()
2036 : throw(uno::RuntimeException, std::exception)
2037 : {
2038 0 : const OUString aSN( "com.sun.star.document.LinkTargets" );
2039 0 : Sequence< OUString > aSeq( &aSN, 1);
2040 0 : return aSeq;
2041 : }
2042 :
2043 : // SdDrawPage
2044 886 : SdDrawPage::SdDrawPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
2045 886 : : SdGenericDrawPage( pModel, pPage, ImplGetDrawPagePropertySet( pModel->IsImpressDocument(), pPage->GetPageKind() ) )
2046 : {
2047 886 : }
2048 :
2049 1758 : SdDrawPage::~SdDrawPage() throw()
2050 : {
2051 1758 : }
2052 :
2053 : // XInterface
2054 24213 : Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
2055 : throw(uno::RuntimeException, std::exception)
2056 : {
2057 24213 : if( rType == cppu::UnoType<drawing::XMasterPageTarget>::get() )
2058 : {
2059 623 : return makeAny( Reference< drawing::XMasterPageTarget >( this ) );
2060 : }
2061 23590 : else if( mbIsImpressDocument
2062 23590 : && rType == cppu::UnoType<presentation::XPresentationPage>::get() )
2063 : {
2064 266 : SdPage * p = dynamic_cast<SdPage *>(SvxDrawPage::mpPage);
2065 266 : if( p == 0 || p->GetPageKind() != PK_HANDOUT )
2066 : {
2067 266 : return makeAny( Reference< presentation::XPresentationPage >( this ) );
2068 : }
2069 : }
2070 :
2071 23324 : return SdGenericDrawPage::queryInterface( rType );
2072 : }
2073 :
2074 89142 : void SAL_CALL SdDrawPage::acquire() throw()
2075 : {
2076 89142 : SvxDrawPage::acquire();
2077 89142 : }
2078 :
2079 89135 : void SAL_CALL SdDrawPage::release() throw()
2080 : {
2081 89135 : SvxDrawPage::release();
2082 89135 : }
2083 :
2084 22606 : UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage, SdGenericDrawPage );
2085 :
2086 : // XTypeProvider
2087 0 : Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeException, std::exception)
2088 : {
2089 0 : ::SolarMutexGuard aGuard;
2090 :
2091 0 : throwIfDisposed();
2092 :
2093 0 : if( maTypeSequence.getLength() == 0 )
2094 : {
2095 0 : const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
2096 0 : bool bPresPage = mbIsImpressDocument && ePageKind != PK_HANDOUT;
2097 :
2098 : // Collect the types of this class.
2099 0 : ::std::vector<uno::Type> aTypes;
2100 0 : aTypes.reserve(13);
2101 0 : aTypes.push_back(cppu::UnoType<drawing::XDrawPage>::get());
2102 0 : aTypes.push_back(cppu::UnoType<beans::XPropertySet>::get());
2103 0 : aTypes.push_back(cppu::UnoType<container::XNamed>::get());
2104 0 : aTypes.push_back(cppu::UnoType<drawing::XMasterPageTarget>::get());
2105 0 : aTypes.push_back(cppu::UnoType<lang::XServiceInfo>::get());
2106 0 : aTypes.push_back(cppu::UnoType<util::XReplaceable>::get());
2107 0 : aTypes.push_back(cppu::UnoType<document::XLinkTargetSupplier>::get());
2108 0 : aTypes.push_back(cppu::UnoType<drawing::XShapeCombiner>::get());
2109 0 : aTypes.push_back(cppu::UnoType<drawing::XShapeBinder>::get());
2110 0 : aTypes.push_back(cppu::UnoType<office::XAnnotationAccess>::get());
2111 0 : aTypes.push_back(cppu::UnoType<beans::XMultiPropertySet>::get());
2112 0 : if( bPresPage )
2113 0 : aTypes.push_back(cppu::UnoType<presentation::XPresentationPage>::get());
2114 0 : if( bPresPage && ePageKind == PK_STANDARD )
2115 0 : aTypes.push_back(cppu::UnoType<XAnimationNodeSupplier>::get());
2116 :
2117 : // Get types of base class.
2118 0 : const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
2119 0 : const sal_Int32 nBaseTypes = aBaseTypes.getLength();
2120 0 : const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
2121 :
2122 : // Join those types in a sequence.
2123 0 : maTypeSequence.realloc(aTypes.size() + nBaseTypes);
2124 0 : uno::Type* pTypes = maTypeSequence.getArray();
2125 0 : ::std::vector<uno::Type>::const_iterator iType;
2126 0 : for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
2127 0 : *pTypes++ = *iType;
2128 0 : for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
2129 0 : *pTypes++ = *pBaseTypes++;
2130 : }
2131 :
2132 0 : return maTypeSequence;
2133 : }
2134 :
2135 0 : Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException, std::exception)
2136 : {
2137 0 : return css::uno::Sequence<sal_Int8>();
2138 : }
2139 :
2140 30 : OUString SdDrawPage::getPageApiName( SdPage* pPage )
2141 : {
2142 30 : return ::getPageApiName( pPage );
2143 : }
2144 :
2145 30 : OUString getPageApiName( SdPage* pPage )
2146 : {
2147 30 : OUString aPageName;
2148 :
2149 30 : if(pPage)
2150 : {
2151 30 : aPageName = pPage->GetRealName();
2152 :
2153 30 : if( aPageName.isEmpty() )
2154 : {
2155 24 : OUStringBuffer sBuffer;
2156 24 : sBuffer.appendAscii( sEmptyPageName );
2157 24 : const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1;
2158 24 : sBuffer.append( nPageNum );
2159 24 : aPageName = sBuffer.makeStringAndClear();
2160 : }
2161 : }
2162 :
2163 30 : return aPageName;
2164 : }
2165 :
2166 0 : OUString getPageApiNameFromUiName( const OUString& rUIName )
2167 : {
2168 0 : OUString aApiName;
2169 :
2170 0 : OUString aDefPageName(SD_RESSTR(STR_PAGE) + " ");
2171 :
2172 0 : if( rUIName.startsWith( aDefPageName ) )
2173 : {
2174 0 : aApiName = sEmptyPageName;
2175 0 : aApiName += rUIName.copy( aDefPageName.getLength() );
2176 : }
2177 : else
2178 : {
2179 0 : aApiName = rUIName;
2180 : }
2181 :
2182 0 : return aApiName;
2183 : }
2184 :
2185 0 : OUString SdDrawPage::getPageApiNameFromUiName( const OUString& rUIName )
2186 : {
2187 0 : return ::getPageApiNameFromUiName( rUIName );
2188 : }
2189 :
2190 0 : OUString getUiNameFromPageApiNameImpl( const OUString& rApiName )
2191 : {
2192 0 : const OUString aDefPageName( sEmptyPageName );
2193 0 : if( rApiName.startsWith( aDefPageName ) )
2194 : {
2195 0 : OUString aNumber( rApiName.copy( aDefPageName.getLength() ) );
2196 :
2197 : // create the page number
2198 0 : sal_Int32 nPageNumber = aNumber.toInt32();
2199 :
2200 : // check if there are non number characters in the number part
2201 0 : const sal_Int32 nChars = aNumber.getLength();
2202 0 : const sal_Unicode* pString = aNumber.getStr();
2203 : sal_Int32 nChar;
2204 0 : for( nChar = 0; nChar < nChars; nChar++, pString++ )
2205 : {
2206 0 : if((*pString < '0') || (*pString > '9'))
2207 : {
2208 : // found a non number character, so this is not the default
2209 : // name for this page
2210 0 : nPageNumber = -1;
2211 0 : break;
2212 : }
2213 : }
2214 :
2215 0 : if( nPageNumber != -1)
2216 : {
2217 0 : OUStringBuffer sBuffer;
2218 0 : sBuffer.append( SD_RESSTR(STR_PAGE) );
2219 0 : sBuffer.append( ' ' );
2220 0 : sBuffer.append( aNumber );
2221 0 : return sBuffer.makeStringAndClear();
2222 0 : }
2223 : }
2224 :
2225 0 : return rApiName;
2226 : }
2227 :
2228 0 : OUString SdDrawPage::getUiNameFromPageApiName( const OUString& rApiName )
2229 : {
2230 0 : return getUiNameFromPageApiNameImpl( rApiName );
2231 : }
2232 :
2233 : // XServiceInfo
2234 2 : OUString SAL_CALL SdDrawPage::getImplementationName() throw(uno::RuntimeException, std::exception)
2235 : {
2236 2 : return OUString( "SdDrawPage" );
2237 : }
2238 :
2239 81 : Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
2240 : {
2241 81 : ::SolarMutexGuard aGuard;
2242 :
2243 81 : throwIfDisposed();
2244 :
2245 81 : Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2246 81 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" );
2247 :
2248 81 : if( mbIsImpressDocument )
2249 73 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" );
2250 :
2251 81 : return aSeq;
2252 : }
2253 :
2254 77 : sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName )
2255 : throw(uno::RuntimeException, std::exception)
2256 : {
2257 77 : return cppu::supportsService( this, ServiceName );
2258 : }
2259 :
2260 : // XNamed
2261 139 : void SAL_CALL SdDrawPage::setName( const OUString& rName )
2262 : throw(uno::RuntimeException, std::exception)
2263 : {
2264 139 : ::SolarMutexGuard aGuard;
2265 :
2266 139 : throwIfDisposed();
2267 :
2268 : DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
2269 :
2270 278 : OUString aName( rName );
2271 :
2272 139 : if(GetPage() && GetPage()->GetPageKind() != PK_NOTES)
2273 : {
2274 : // check if this is the default 'page1234' name
2275 139 : if(aName.startsWith( sEmptyPageName ))
2276 : {
2277 : // ok, it maybe is, first get the number part after 'page'
2278 112 : OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) );
2279 :
2280 : // create the page number
2281 112 : sal_Int32 nPageNumber = aNumber.toInt32();
2282 :
2283 : // check if there are non number characters in the number part
2284 112 : const sal_Int32 nChars = aNumber.getLength();
2285 112 : const sal_Unicode* pString = aNumber.getStr();
2286 : sal_Int32 nChar;
2287 224 : for( nChar = 0; nChar < nChars; nChar++, pString++ )
2288 : {
2289 114 : if((*pString < '0') || (*pString > '9'))
2290 : {
2291 : // found a non number character, so this is not the default
2292 : // name for this page
2293 2 : nPageNumber = -1;
2294 2 : break;
2295 : }
2296 : }
2297 :
2298 112 : if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
2299 110 : aName.clear();
2300 : }
2301 : else
2302 : {
2303 27 : OUString aDefaultPageName( SD_RESSTR(STR_PAGE) + " " );
2304 27 : if( aName.startsWith( aDefaultPageName ) )
2305 0 : aName.clear();
2306 : }
2307 :
2308 139 : GetPage()->SetName( aName );
2309 :
2310 139 : sal_uInt16 nNotesPageNum = (GetPage()->GetPageNum()-1)>>1;
2311 139 : if( GetModel()->GetDoc()->GetSdPageCount( PK_NOTES ) > nNotesPageNum )
2312 : {
2313 139 : SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PK_NOTES );
2314 139 : if( pNotesPage )
2315 139 : pNotesPage->SetName(aName);
2316 : }
2317 :
2318 : // fake a mode change to repaint the page tab bar
2319 139 : ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
2320 139 : ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
2321 139 : if( pViewSh && pViewSh->ISA(::sd::DrawViewShell))
2322 : {
2323 : ::sd::DrawViewShell* pDrawViewSh = static_cast<
2324 59 : ::sd::DrawViewShell*>(pViewSh);
2325 :
2326 59 : EditMode eMode = pDrawViewSh->GetEditMode();
2327 59 : if( eMode == EM_PAGE )
2328 : {
2329 59 : bool bLayer = pDrawViewSh->IsLayerModeActive();
2330 :
2331 59 : pDrawViewSh->ChangeEditMode( eMode, !bLayer );
2332 59 : pDrawViewSh->ChangeEditMode( eMode, bLayer );
2333 : }
2334 : }
2335 :
2336 139 : GetModel()->SetModified();
2337 139 : }
2338 139 : }
2339 :
2340 30 : OUString SAL_CALL SdDrawPage::getName()
2341 : throw(uno::RuntimeException, std::exception)
2342 : {
2343 30 : ::SolarMutexGuard aGuard;
2344 :
2345 30 : throwIfDisposed();
2346 :
2347 30 : return getPageApiName( GetPage() );
2348 : }
2349 :
2350 : // XMasterPageTarget
2351 407 : Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getMasterPage( )
2352 : throw(uno::RuntimeException, std::exception)
2353 : {
2354 407 : ::SolarMutexGuard aGuard;
2355 :
2356 407 : throwIfDisposed();
2357 :
2358 407 : if(GetPage())
2359 : {
2360 407 : Reference< drawing::XDrawPages > xPages( GetModel()->getMasterPages() );
2361 814 : Reference< drawing::XDrawPage > xPage;
2362 :
2363 407 : if(SvxFmDrawPage::mpPage->TRG_HasMasterPage())
2364 : {
2365 407 : SdrPage& rMasterPage = SvxFmDrawPage::mpPage->TRG_GetMasterPage();
2366 407 : xPage = uno::Reference< drawing::XDrawPage >( rMasterPage.getUnoPage(), uno::UNO_QUERY );
2367 : }
2368 :
2369 814 : return xPage;
2370 : }
2371 0 : return NULL;
2372 : }
2373 :
2374 218 : void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& xMasterPage )
2375 : throw(uno::RuntimeException, std::exception)
2376 : {
2377 218 : ::SolarMutexGuard aGuard;
2378 :
2379 218 : throwIfDisposed();
2380 :
2381 218 : if(SvxFmDrawPage::mpPage)
2382 : {
2383 218 : SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage );
2384 218 : if( pMasterPage && pMasterPage->isValid() )
2385 : {
2386 218 : SvxFmDrawPage::mpPage->TRG_ClearMasterPage();
2387 :
2388 218 : SdPage* pSdPage = static_cast<SdPage*>(pMasterPage->GetSdrPage());
2389 218 : SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage);
2390 :
2391 : SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLftBorder(),pSdPage->GetUppBorder(),
2392 218 : pSdPage->GetRgtBorder(),pSdPage->GetLwrBorder() );
2393 :
2394 218 : SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() );
2395 218 : SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() );
2396 218 : static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetLayoutName( pSdPage->GetLayoutName() );
2397 :
2398 : // set notes master also
2399 218 : SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
2400 :
2401 218 : pNotesPage->TRG_ClearMasterPage();
2402 218 : sal_uInt16 nNum = (SvxFmDrawPage::mpPage->TRG_GetMasterPage()).GetPageNum() + 1;
2403 218 : pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum));
2404 218 : pNotesPage->SetLayoutName( pSdPage->GetLayoutName() );
2405 :
2406 218 : GetModel()->SetModified();
2407 : }
2408 :
2409 218 : }
2410 218 : }
2411 :
2412 : // XPresentationPage
2413 275 : Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getNotesPage()
2414 : throw(uno::RuntimeException, std::exception)
2415 : {
2416 275 : ::SolarMutexGuard aGuard;
2417 :
2418 275 : throwIfDisposed();
2419 :
2420 275 : if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() && SvxFmDrawPage::mpPage->GetPageNum() )
2421 : {
2422 275 : SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
2423 275 : if( pNotesPage )
2424 : {
2425 275 : Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
2426 275 : return xPage;
2427 : }
2428 : }
2429 0 : return NULL;
2430 : }
2431 :
2432 : // XIndexAccess
2433 1507 : sal_Int32 SAL_CALL SdDrawPage::getCount()
2434 : throw(uno::RuntimeException, std::exception)
2435 : {
2436 1507 : return SdGenericDrawPage::getCount();
2437 : }
2438 :
2439 2042 : Any SAL_CALL SdDrawPage::getByIndex( sal_Int32 Index )
2440 : throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
2441 : {
2442 2042 : return SdGenericDrawPage::getByIndex( Index );
2443 : }
2444 :
2445 : // XElementAccess
2446 2 : uno::Type SAL_CALL SdDrawPage::getElementType()
2447 : throw(uno::RuntimeException, std::exception)
2448 : {
2449 2 : return SdGenericDrawPage::getElementType();
2450 : }
2451 :
2452 2 : sal_Bool SAL_CALL SdDrawPage::hasElements()
2453 : throw(uno::RuntimeException, std::exception)
2454 : {
2455 2 : return SdGenericDrawPage::hasElements();
2456 : }
2457 :
2458 : // XShapes
2459 1646 : void SAL_CALL SdDrawPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException, std::exception)
2460 : {
2461 1646 : SdGenericDrawPage::add( xShape );
2462 1646 : }
2463 :
2464 479 : void SAL_CALL SdDrawPage::remove( const Reference< drawing::XShape >& xShape )
2465 : throw (uno::RuntimeException,
2466 : std::exception)
2467 : {
2468 479 : ::SolarMutexGuard aGuard;
2469 :
2470 479 : throwIfDisposed();
2471 :
2472 479 : SvxShape* pShape = SvxShape::getImplementation( xShape );
2473 479 : if( pShape )
2474 : {
2475 479 : SdrObject* pObj = pShape->GetSdrObject();
2476 479 : if( pObj )
2477 : {
2478 479 : GetPage()->RemovePresObj(pObj);
2479 479 : pObj->SetUserCall(NULL);
2480 : }
2481 : }
2482 :
2483 479 : SdGenericDrawPage::remove( xShape );
2484 479 : }
2485 :
2486 127 : void SdDrawPage::setBackground( const Any& rValue )
2487 : throw( lang::IllegalArgumentException )
2488 : {
2489 127 : Reference< beans::XPropertySet > xSet;
2490 :
2491 127 : if( !(rValue >>= xSet) && !rValue.hasValue() )
2492 0 : throw lang::IllegalArgumentException();
2493 :
2494 127 : if( !xSet.is() )
2495 : {
2496 : // the easy case, no background set. Set drawing::FillStyle_NONE to represent this
2497 0 : GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE));
2498 127 : return;
2499 : }
2500 :
2501 : // is it our own implementation?
2502 127 : SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet );
2503 :
2504 254 : SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
2505 :
2506 127 : if( pBack )
2507 : {
2508 121 : pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
2509 : }
2510 : else
2511 : {
2512 6 : SdUnoPageBackground* pBackground = new SdUnoPageBackground();
2513 :
2514 6 : Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
2515 12 : Reference< beans::XPropertySet > xDestSet( static_cast<beans::XPropertySet*>(pBackground) );
2516 12 : Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() );
2517 :
2518 12 : Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() );
2519 6 : sal_Int32 nCount = aProperties.getLength();
2520 6 : beans::Property* pProp = aProperties.getArray();
2521 :
2522 174 : while( nCount-- )
2523 : {
2524 162 : const OUString aPropName( pProp->Name );
2525 162 : if( xSetInfo->hasPropertyByName( aPropName ) )
2526 22 : xDestSet->setPropertyValue( aPropName,
2527 22 : xSet->getPropertyValue( aPropName ) );
2528 :
2529 162 : pProp++;
2530 162 : }
2531 :
2532 12 : pBackground->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
2533 : }
2534 :
2535 127 : if( aSet.Count() == 0 )
2536 : {
2537 : // no background fill, represent by setting drawing::FillStyle_NONE
2538 66 : GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE));
2539 : }
2540 : else
2541 : {
2542 : // background fill, set at page (not sure if ClearItem is needed)
2543 61 : GetPage()->getSdrPageProperties().ClearItem();
2544 61 : GetPage()->getSdrPageProperties().PutItemSet(aSet);
2545 : }
2546 :
2547 : // repaint only
2548 254 : SvxFmDrawPage::mpPage->ActionChanged();
2549 : }
2550 :
2551 : // XAnnotationAccess:
2552 0 : Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation() throw (RuntimeException, std::exception)
2553 : {
2554 0 : if( !GetPage() )
2555 0 : throw DisposedException();
2556 :
2557 0 : Reference< XAnnotation > xRet;
2558 0 : GetPage()->createAnnotation(xRet);
2559 0 : return xRet;
2560 : }
2561 :
2562 0 : void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation) throw (RuntimeException, IllegalArgumentException, std::exception)
2563 : {
2564 0 : GetPage()->removeAnnotation(annotation);
2565 0 : }
2566 :
2567 260 : Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration() throw (RuntimeException, std::exception)
2568 : {
2569 260 : return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() );
2570 : }
2571 :
2572 156 : void SdDrawPage::getBackground( Any& rValue ) throw()
2573 : {
2574 156 : const SfxItemSet& rFillAttributes = GetPage()->getSdrPageProperties().GetItemSet();
2575 :
2576 156 : if(drawing::FillStyle_NONE == static_cast<const XFillStyleItem&>(rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
2577 : {
2578 : // no fill set (switched off by drawing::FillStyle_NONE), clear rValue to represent this
2579 150 : rValue.clear();
2580 : }
2581 : else
2582 : {
2583 : // there is a fill set, export to rValue
2584 : Reference< beans::XPropertySet > xSet(new SdUnoPageBackground(
2585 6 : GetModel()->GetDoc(),
2586 6 : &GetPage()->getSdrPageProperties().GetItemSet()));
2587 6 : rValue <<= xSet;
2588 : }
2589 156 : }
2590 :
2591 0 : void SdGenericDrawPage::setNavigationOrder( const Any& rValue )
2592 : {
2593 0 : Reference< XIndexAccess > xIA( rValue, UNO_QUERY );
2594 0 : if( xIA.is() )
2595 : {
2596 0 : if( dynamic_cast< SdDrawPage* >( xIA.get() ) == this )
2597 : {
2598 0 : if( GetPage()->HasObjectNavigationOrder() )
2599 0 : GetPage()->ClearObjectNavigationOrder();
2600 :
2601 0 : return;
2602 : }
2603 0 : else if( static_cast<size_t>(xIA->getCount()) == GetPage()->GetObjCount() )
2604 : {
2605 0 : GetPage()->SetNavigationOrder(xIA);
2606 0 : return;
2607 : }
2608 : }
2609 0 : throw IllegalArgumentException();
2610 : }
2611 :
2612 0 : class SdNavigationOrderAccess : public ::cppu::WeakImplHelper1< XIndexAccess >
2613 : {
2614 : public:
2615 : SdNavigationOrderAccess( SdrPage* pPage );
2616 :
2617 : // XIndexAccess
2618 : virtual sal_Int32 SAL_CALL getCount( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
2619 : virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
2620 :
2621 : // XElementAccess
2622 : virtual Type SAL_CALL getElementType( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
2623 : virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
2624 :
2625 : private:
2626 : std::vector< Reference< XShape > > maShapes;
2627 : };
2628 :
2629 0 : SdNavigationOrderAccess::SdNavigationOrderAccess( SdrPage* pPage )
2630 0 : : maShapes( pPage ? pPage->GetObjCount() : 0 )
2631 : {
2632 0 : if( pPage )
2633 : {
2634 0 : const size_t nCount = pPage->GetObjCount();
2635 0 : for( size_t nIndex = 0; nIndex < nCount; ++nIndex )
2636 : {
2637 0 : SdrObject* pObj = pPage->GetObj( nIndex );
2638 0 : sal_uInt32 nNavPos = pObj->GetNavigationPosition();
2639 : DBG_ASSERT( !maShapes[nNavPos].is(), "sd::SdNavigationOrderAccess::SdNavigationOrderAccess(), duplicate navigation positions from core!" );
2640 0 : maShapes[nNavPos] = Reference< XShape >( pObj->getUnoShape(), UNO_QUERY );
2641 : }
2642 : }
2643 0 : }
2644 :
2645 : // XIndexAccess
2646 0 : sal_Int32 SAL_CALL SdNavigationOrderAccess::getCount( ) throw (RuntimeException, std::exception)
2647 : {
2648 0 : return static_cast< sal_Int32 >( maShapes.size() );
2649 : }
2650 :
2651 0 : Any SAL_CALL SdNavigationOrderAccess::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
2652 : {
2653 0 : if( (Index < 0) || (Index > getCount()) )
2654 0 : throw IndexOutOfBoundsException();
2655 :
2656 0 : return Any( maShapes[Index] );
2657 : }
2658 :
2659 : // XElementAccess
2660 0 : Type SAL_CALL SdNavigationOrderAccess::getElementType( ) throw (RuntimeException, std::exception)
2661 : {
2662 0 : return cppu::UnoType<XShape>::get();
2663 : }
2664 :
2665 0 : sal_Bool SAL_CALL SdNavigationOrderAccess::hasElements( ) throw (RuntimeException, std::exception)
2666 : {
2667 0 : return maShapes.empty() ? sal_False : sal_True;
2668 : }
2669 :
2670 21 : Any SdGenericDrawPage::getNavigationOrder()
2671 : {
2672 21 : if( GetPage()->HasObjectNavigationOrder() )
2673 : {
2674 0 : return Any( Reference< XIndexAccess >( new SdNavigationOrderAccess( GetPage() ) ) );
2675 : }
2676 : else
2677 : {
2678 21 : return Any( Reference< XIndexAccess >( this ) );
2679 : }
2680 : }
2681 :
2682 : // class SdMasterPage
2683 404 : SdMasterPage::SdMasterPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
2684 404 : : SdGenericDrawPage( pModel, pPage, ImplGetMasterPagePropertySet( pPage ? pPage->GetPageKind() : PK_STANDARD ) )
2685 : {
2686 404 : }
2687 :
2688 792 : SdMasterPage::~SdMasterPage() throw()
2689 : {
2690 792 : }
2691 :
2692 : // XInterface
2693 10438 : Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
2694 : throw(uno::RuntimeException, std::exception)
2695 : {
2696 10438 : ::SolarMutexGuard aGuard;
2697 :
2698 10438 : throwIfDisposed();
2699 :
2700 20876 : uno::Any aAny;
2701 :
2702 10438 : if( rType == cppu::UnoType<container::XIndexAccess>::get() )
2703 0 : aAny <<= Reference< container::XIndexAccess >(static_cast<presentation::XPresentationPage*>(this));
2704 10438 : else if( rType == cppu::UnoType<container::XElementAccess>::get() )
2705 0 : aAny <<= Reference< container::XElementAccess >(static_cast<presentation::XPresentationPage*>(this));
2706 10438 : else if( rType == cppu::UnoType<container::XNamed>::get() )
2707 532 : aAny <<= Reference< container::XNamed >(this);
2708 9993 : else if( rType == cppu::UnoType<presentation::XPresentationPage>::get() &&
2709 87 : ( mbIsImpressDocument &&
2710 174 : GetPage() && GetPage()->GetPageKind() != PK_HANDOUT) )
2711 87 : aAny <<= Reference< presentation::XPresentationPage >( this );
2712 : else
2713 9819 : return SdGenericDrawPage::queryInterface( rType );
2714 :
2715 11057 : return aAny;
2716 : }
2717 :
2718 36810 : void SAL_CALL SdMasterPage::acquire() throw()
2719 : {
2720 36810 : SvxDrawPage::acquire();
2721 36810 : }
2722 :
2723 36801 : void SAL_CALL SdMasterPage::release() throw()
2724 : {
2725 36801 : SvxDrawPage::release();
2726 36801 : }
2727 :
2728 7792 : UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage, SdGenericDrawPage );
2729 :
2730 : // XTypeProvider
2731 0 : Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeException, std::exception)
2732 : {
2733 0 : ::SolarMutexGuard aGuard;
2734 :
2735 0 : throwIfDisposed();
2736 :
2737 0 : if( maTypeSequence.getLength() == 0 )
2738 : {
2739 0 : const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
2740 0 : bool bPresPage = mbIsImpressDocument && SvxFmDrawPage::mpPage && ePageKind != PK_HANDOUT;
2741 :
2742 : // Collect the types of this class.
2743 0 : ::std::vector<uno::Type> aTypes;
2744 0 : aTypes.reserve(12);
2745 0 : aTypes.push_back(cppu::UnoType<drawing::XDrawPage>::get());
2746 0 : aTypes.push_back(cppu::UnoType<beans::XPropertySet>::get());
2747 0 : aTypes.push_back(cppu::UnoType<container::XNamed>::get());
2748 0 : aTypes.push_back(cppu::UnoType<lang::XServiceInfo>::get());
2749 0 : aTypes.push_back(cppu::UnoType<util::XReplaceable>::get());
2750 0 : aTypes.push_back(cppu::UnoType<document::XLinkTargetSupplier>::get());
2751 0 : aTypes.push_back(cppu::UnoType<drawing::XShapeCombiner>::get());
2752 0 : aTypes.push_back(cppu::UnoType<drawing::XShapeBinder>::get());
2753 0 : aTypes.push_back(cppu::UnoType<office::XAnnotationAccess>::get());
2754 0 : aTypes.push_back(cppu::UnoType<beans::XMultiPropertySet>::get());
2755 0 : if( bPresPage )
2756 0 : aTypes.push_back(cppu::UnoType<presentation::XPresentationPage>::get());
2757 0 : if( bPresPage && ePageKind == PK_STANDARD )
2758 0 : aTypes.push_back(cppu::UnoType<XAnimationNodeSupplier>::get());
2759 :
2760 : // Get types of base class.
2761 0 : const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
2762 0 : const sal_Int32 nBaseTypes = aBaseTypes.getLength();
2763 0 : const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
2764 :
2765 : // Join those types in a sequence.
2766 0 : maTypeSequence.realloc(aTypes.size() + nBaseTypes);
2767 0 : uno::Type* pTypes = maTypeSequence.getArray();
2768 0 : ::std::vector<uno::Type>::const_iterator iType;
2769 0 : for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
2770 0 : *pTypes++ = *iType;
2771 0 : for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
2772 0 : *pTypes++ = *pBaseTypes++;
2773 : }
2774 :
2775 0 : return maTypeSequence;
2776 : }
2777 :
2778 0 : Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException, std::exception)
2779 : {
2780 0 : return css::uno::Sequence<sal_Int8>();
2781 : }
2782 :
2783 : // XServiceInfo
2784 1 : OUString SAL_CALL SdMasterPage::getImplementationName() throw(uno::RuntimeException, std::exception)
2785 : {
2786 1 : return OUString( "SdMasterPage" );
2787 : }
2788 :
2789 292 : Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
2790 : {
2791 292 : ::SolarMutexGuard aGuard;
2792 :
2793 292 : throwIfDisposed();
2794 :
2795 292 : Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2796 292 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" );
2797 :
2798 292 : if( SvxFmDrawPage::mpPage && static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetPageKind() == PK_HANDOUT )
2799 246 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" );
2800 :
2801 292 : return aSeq;
2802 : }
2803 :
2804 290 : sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName )
2805 : throw(uno::RuntimeException, std::exception)
2806 : {
2807 290 : return cppu::supportsService( this, ServiceName );
2808 : }
2809 :
2810 : // XElementAccess
2811 1 : sal_Bool SAL_CALL SdMasterPage::hasElements() throw(uno::RuntimeException, std::exception)
2812 : {
2813 1 : ::SolarMutexGuard aGuard;
2814 :
2815 1 : throwIfDisposed();
2816 :
2817 1 : if( SvxFmDrawPage::mpPage == NULL )
2818 0 : return sal_False;
2819 :
2820 1 : return SvxFmDrawPage::mpPage->GetObjCount() > 0;
2821 : }
2822 :
2823 1 : uno::Type SAL_CALL SdMasterPage::getElementType()
2824 : throw(uno::RuntimeException, std::exception)
2825 : {
2826 1 : return SdGenericDrawPage::getElementType();
2827 : }
2828 :
2829 : // XIndexAccess
2830 2247 : sal_Int32 SAL_CALL SdMasterPage::getCount()
2831 : throw(uno::RuntimeException, std::exception)
2832 : {
2833 2247 : ::SolarMutexGuard aGuard;
2834 :
2835 2247 : throwIfDisposed();
2836 :
2837 2247 : return SdGenericDrawPage::getCount();
2838 : }
2839 :
2840 2364 : Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
2841 : throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
2842 : {
2843 2364 : ::SolarMutexGuard aGuard;
2844 :
2845 2364 : throwIfDisposed();
2846 :
2847 2364 : return SdGenericDrawPage::getByIndex(Index);
2848 : }
2849 :
2850 : // intern
2851 164 : void SdMasterPage::setBackground( const Any& rValue )
2852 : throw( lang::IllegalArgumentException )
2853 : {
2854 : // we need at least an beans::XPropertySet
2855 164 : Reference< beans::XPropertySet > xInputSet( rValue, UNO_QUERY );
2856 164 : if( !xInputSet.is() )
2857 0 : throw lang::IllegalArgumentException();
2858 :
2859 : try
2860 : {
2861 164 : if( GetModel() && mbIsImpressDocument )
2862 : {
2863 120 : Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
2864 240 : Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ;
2865 120 : if( xFamily.is() )
2866 : {
2867 120 : OUString aStyleName(sUNO_PseudoSheet_Background);
2868 :
2869 240 : Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
2870 :
2871 240 : Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
2872 240 : Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY );
2873 :
2874 240 : PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries();
2875 120 : PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin();
2876 3480 : while( aIt != aBackgroundProperties.end() )
2877 : {
2878 3240 : if( xSetInfo->hasPropertyByName( aIt->sName ) )
2879 : {
2880 1465 : if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE )
2881 195 : xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) );
2882 : else
2883 1270 : xSetStates->setPropertyToDefault( aIt->sName );
2884 : }
2885 :
2886 3240 : ++aIt;
2887 120 : }
2888 120 : }
2889 : }
2890 : else
2891 : {
2892 : // first fill an item set
2893 : // is it our own implementation?
2894 44 : SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xInputSet );
2895 :
2896 44 : SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
2897 :
2898 44 : if( pBack )
2899 : {
2900 44 : pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
2901 : }
2902 : else
2903 : {
2904 0 : SdUnoPageBackground* pBackground = new SdUnoPageBackground();
2905 :
2906 0 : Reference< beans::XPropertySetInfo > xInputSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
2907 0 : Reference< beans::XPropertySet > xDestSet( static_cast<beans::XPropertySet*>(pBackground) );
2908 0 : Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_QUERY_THROW );
2909 :
2910 0 : uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() );
2911 0 : sal_Int32 nCount = aProperties.getLength();
2912 0 : beans::Property* pProp = aProperties.getArray();
2913 :
2914 0 : while( nCount-- )
2915 : {
2916 0 : const OUString aPropName( pProp->Name );
2917 0 : if( xInputSetInfo->hasPropertyByName( aPropName ) )
2918 0 : xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) );
2919 :
2920 0 : pProp++;
2921 0 : }
2922 :
2923 0 : pBackground->fillItemSet( static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()), aSet );
2924 : }
2925 :
2926 : // if we find the background style, copy the set to the background
2927 44 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel());
2928 44 : SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
2929 44 : if(pSSPool)
2930 : {
2931 44 : OUString aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
2932 44 : aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4);
2933 44 : aLayoutName += SD_RESSTR(STR_LAYOUT_BACKGROUND);
2934 44 : SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
2935 :
2936 44 : if( pStyleSheet )
2937 : {
2938 44 : pStyleSheet->GetItemSet().Put( aSet );
2939 :
2940 : // repaint only
2941 44 : SvxFmDrawPage::mpPage->ActionChanged();
2942 208 : return;
2943 0 : }
2944 : }
2945 :
2946 : // if no background style is available, set at page directly. This
2947 : // is an error and should NOT happen (and will be asserted from the SdrPage)
2948 0 : GetPage()->getSdrPageProperties().PutItemSet(aSet);
2949 : }
2950 : }
2951 0 : catch( Exception& )
2952 : {
2953 : OSL_FAIL("sd::SdMasterPage::setBackground(), exception caught!");
2954 120 : }
2955 : }
2956 :
2957 379 : void SdMasterPage::getBackground( Any& rValue ) throw()
2958 : {
2959 379 : if( GetModel() ) try
2960 : {
2961 379 : if( mbIsImpressDocument )
2962 : {
2963 375 : Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
2964 750 : Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW );
2965 :
2966 750 : const OUString aStyleName(sUNO_PseudoSheet_Background);
2967 750 : rValue <<= Reference< beans::XPropertySet >( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
2968 : }
2969 : else
2970 : {
2971 4 : SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel());
2972 4 : SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
2973 4 : if(pSSPool)
2974 : {
2975 4 : OUString aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
2976 4 : aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4);
2977 4 : aLayoutName += SD_RESSTR(STR_LAYOUT_BACKGROUND);
2978 4 : SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
2979 :
2980 4 : if( pStyleSheet )
2981 : {
2982 4 : SfxItemSet aStyleSet( pStyleSheet->GetItemSet());
2983 4 : if( aStyleSet.Count() )
2984 : {
2985 4 : rValue <<= Reference< beans::XPropertySet >( new SdUnoPageBackground( pDoc, &aStyleSet ) );
2986 383 : return;
2987 0 : }
2988 0 : }
2989 : }
2990 :
2991 : // No style found, use fill attributes from page background. This
2992 : // should NOT happen and is an error
2993 0 : const SfxItemSet& rFallbackItemSet(SvxFmDrawPage::mpPage->getSdrPageProperties().GetItemSet());
2994 :
2995 0 : if(drawing::FillStyle_NONE == static_cast<const XFillStyleItem&>(rFallbackItemSet.Get(XATTR_FILLSTYLE)).GetValue())
2996 : {
2997 0 : rValue <<= Reference< beans::XPropertySet >(
2998 0 : new SdUnoPageBackground(GetModel()->GetDoc(), &rFallbackItemSet));
2999 : }
3000 : else
3001 : {
3002 0 : rValue.clear();
3003 : }
3004 : }
3005 : }
3006 0 : catch( Exception& )
3007 : {
3008 0 : rValue.clear();
3009 : OSL_FAIL("sd::SdMasterPage::getBackground(), exception caught!");
3010 : }
3011 : }
3012 :
3013 : // XNamed
3014 185 : void SAL_CALL SdMasterPage::setName( const OUString& rName )
3015 : throw(uno::RuntimeException, std::exception)
3016 : {
3017 185 : ::SolarMutexGuard aGuard;
3018 :
3019 185 : throwIfDisposed();
3020 :
3021 185 : if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PK_NOTES)
3022 : {
3023 185 : SdDrawDocument* pDoc = GetModel()->GetDoc();
3024 : bool bOutDummy;
3025 185 : OUString aNewName( rName );
3026 :
3027 : // Slide Name has to be unique
3028 185 : if( pDoc && pDoc->GetPageByName( aNewName, bOutDummy ) != SDRPAGE_NOTFOUND )
3029 223 : return; // throw Exception ?
3030 :
3031 147 : GetPage()->SetName( aNewName );
3032 :
3033 147 : if( pDoc )
3034 147 : pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), aNewName );
3035 :
3036 : // fake a mode change to repaint the page tab bar
3037 147 : ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
3038 147 : ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
3039 147 : if( pViewSh && pViewSh->ISA(::sd::DrawViewShell ) )
3040 : {
3041 : ::sd::DrawViewShell* pDrawViewSh =
3042 45 : static_cast< ::sd::DrawViewShell*>(pViewSh);
3043 :
3044 45 : EditMode eMode = pDrawViewSh->GetEditMode();
3045 45 : if( eMode == EM_MASTERPAGE )
3046 : {
3047 0 : bool bLayer = pDrawViewSh->IsLayerModeActive();
3048 :
3049 0 : pDrawViewSh->ChangeEditMode( eMode, !bLayer );
3050 0 : pDrawViewSh->ChangeEditMode( eMode, bLayer );
3051 : }
3052 : }
3053 :
3054 147 : GetModel()->SetModified();
3055 147 : }
3056 : }
3057 :
3058 1116 : OUString SAL_CALL SdMasterPage::getName( )
3059 : throw(uno::RuntimeException, std::exception)
3060 : {
3061 1116 : ::SolarMutexGuard aGuard;
3062 :
3063 1116 : throwIfDisposed();
3064 :
3065 1116 : if(SvxFmDrawPage::mpPage)
3066 : {
3067 1116 : OUString aLayoutName( GetPage()->GetLayoutName() );
3068 1116 : return aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR));
3069 : }
3070 :
3071 0 : return OUString();
3072 : }
3073 :
3074 : // XPresentationPage
3075 87 : Reference< drawing::XDrawPage > SAL_CALL SdMasterPage::getNotesPage()
3076 : throw(uno::RuntimeException, std::exception)
3077 : {
3078 87 : ::SolarMutexGuard aGuard;
3079 :
3080 87 : throwIfDisposed();
3081 :
3082 87 : if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() )
3083 : {
3084 87 : SdPage* pNotesPage = GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
3085 87 : if( pNotesPage )
3086 : {
3087 87 : Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
3088 87 : return xPage;
3089 : }
3090 : }
3091 0 : return NULL;
3092 : }
3093 :
3094 : // XShapes
3095 1175 : void SAL_CALL SdMasterPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException, std::exception)
3096 : {
3097 1175 : SdGenericDrawPage::add( xShape );
3098 1175 : }
3099 :
3100 1411 : void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape )
3101 : throw (uno::RuntimeException,
3102 : std::exception)
3103 : {
3104 1411 : ::SolarMutexGuard aGuard;
3105 :
3106 1411 : throwIfDisposed();
3107 :
3108 1411 : SvxShape* pShape = SvxShape::getImplementation( xShape );
3109 1411 : if( pShape )
3110 : {
3111 1411 : SdrObject* pObj = pShape->GetSdrObject();
3112 1411 : if( pObj )
3113 : {
3114 1411 : if( GetPage()->IsPresObj( pObj ) )
3115 1410 : GetPage()->RemovePresObj(pObj);
3116 : }
3117 : }
3118 :
3119 1411 : SdGenericDrawPage::remove( xShape );
3120 1411 : }
3121 :
3122 1290 : Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
3123 : {
3124 1290 : Reference< uno::XInterface > xPage;
3125 :
3126 1290 : if( pPage && pPage->GetModel() )
3127 : {
3128 1290 : SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() );
3129 1290 : if( pModel )
3130 : {
3131 1290 : if( pPage->IsMasterPage() )
3132 : {
3133 404 : xPage = static_cast<cppu::OWeakObject*>(new SdMasterPage( pModel, pPage ));
3134 : }
3135 : else
3136 : {
3137 886 : xPage = static_cast<cppu::OWeakObject*>(new SdDrawPage( pModel, pPage ));
3138 : }
3139 : }
3140 : }
3141 :
3142 1290 : return xPage;
3143 66 : }
3144 :
3145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|