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