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