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