bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / unoidl / unopage.cxx
blob55186e478033231bfe2c55b33481441dae392758
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/lang/DisposedException.hpp>
21 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
22 #include <com/sun/star/presentation/FadeEffect.hpp>
23 #include <com/sun/star/presentation/AnimationSpeed.hpp>
24 #include <com/sun/star/view/PaperOrientation.hpp>
25 #include <com/sun/star/beans/PropertyAttribute.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <comphelper/profilezone.hxx>
28 #include <comphelper/servicehelper.hxx>
29 #include <cppuhelper/supportsservice.hxx>
30 #include <rtl/ustrbuf.hxx>
31 #include <vcl/bitmapex.hxx>
32 #include <vcl/metaact.hxx>
33 #include <toolkit/helper/vclunohelper.hxx>
34 #include <vcl/svapp.hxx>
35 #include <vcl/settings.hxx>
36 #include <AnnotationEnumeration.hxx>
37 #include <createunopageimpl.hxx>
38 #include <unomodel.hxx>
39 #include <unopage.hxx>
40 #include <svx/svxids.hrc>
41 #include <svl/itemset.hxx>
42 #include <svx/svdmodel.hxx>
43 #include <sdresid.hxx>
44 #include <strings.hrc>
45 #include <sdpage.hxx>
46 #include <unoprnms.hxx>
47 #include <sdattr.hxx>
48 #include <drawdoc.hxx>
49 #include <svx/unoshape.hxx>
50 #include <com/sun/star/style/XStyle.hpp>
51 #include <svx/svdorect.hxx>
52 #include <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"
67 #include <strings.hxx>
68 #include <bitmaps.hlst>
69 #include <unokywds.hxx>
70 #include "unopback.hxx"
71 #include <vcl/dibtools.hxx>
72 #include <svx/svdograf.hxx>
73 #include <svx/svdoashp.hxx>
75 using ::com::sun::star::animations::XAnimationNode;
76 using ::com::sun::star::animations::XAnimationNodeSupplier;
78 using namespace ::com::sun::star;
79 using namespace ::com::sun::star::uno;
80 using namespace ::com::sun::star::lang;
81 using namespace ::com::sun::star::container;
82 using namespace ::com::sun::star::drawing;
83 using namespace ::com::sun::star::office;
85 // this are the ids for page properties
86 enum WID_PAGE
88 WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH,
89 WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER,
90 WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_HIGHRESDURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
91 WID_PAGE_BACK, WID_PAGE_PREVIEW, WID_PAGE_PREVIEWBITMAP, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL,
92 WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK,
93 WID_PAGE_HEADERVISIBLE, WID_PAGE_HEADERTEXT, WID_PAGE_FOOTERVISIBLE, WID_PAGE_FOOTERTEXT,
94 WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, WID_PAGE_DATETIMEFIXED,
95 WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, WID_TRANSITION_SUBTYPE,
96 WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, WID_TRANSITION_DURATION, WID_LOOP_SOUND,
97 WID_NAVORDER, WID_PAGE_PREVIEWMETAFILE
100 static sal_Char const sEmptyPageName[sizeof("page")] = "page";
102 // this function stores the property maps for draw pages in impress and draw
103 static const SvxItemPropertySet* ImplGetDrawPagePropertySet( bool bImpress, PageKind ePageKind )
105 static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl[] =
107 { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), beans::PropertyAttribute::MAYBEVOID,0},
108 { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
109 { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
110 { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
111 { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
112 { OUString(UNO_NAME_PAGE_CHANGE), WID_PAGE_CHANGE, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
113 { OUString(UNO_NAME_PAGE_DURATION), WID_PAGE_DURATION, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
114 { OUString(UNO_NAME_PAGE_EFFECT), WID_PAGE_EFFECT, ::cppu::UnoType<presentation::FadeEffect>::get(), 0, 0},
115 { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
116 { OUString(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
117 { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0},
118 { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0},
119 { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0},
120 { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0},
121 { OUString(UNO_NAME_PAGE_SPEED), WID_PAGE_SPEED, ::cppu::UnoType<presentation::AnimationSpeed>::get(), 0, 0},
122 { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
123 { OUString(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), css::beans::PropertyAttribute::READONLY, 0},
124 { OUString(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), css::beans::PropertyAttribute::READONLY, 0},
125 { OUString(UNO_NAME_PAGE_PREVIEWMETAFILE), WID_PAGE_PREVIEWMETAFILE, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), css::beans::PropertyAttribute::READONLY, 0},
126 { OUString(UNO_NAME_PAGE_VISIBLE), WID_PAGE_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
127 { OUString(UNO_NAME_OBJ_SOUNDFILE), WID_PAGE_SOUNDFILE, cppu::UnoType<Any>::get(), 0, 0},
128 { OUString(sUNO_Prop_IsBackgroundVisible), WID_PAGE_BACKVIS, cppu::UnoType<bool>::get(), 0, 0},
129 { OUString(sUNO_Prop_IsBackgroundObjectsVisible), WID_PAGE_BACKOBJVIS, cppu::UnoType<bool>::get(), 0, 0},
130 { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
131 { OUString(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, ::cppu::UnoType<OUString>::get(), 0, 0},
132 { OUString("HighResDuration"), WID_PAGE_HIGHRESDURATION, ::cppu::UnoType<double>::get(), 0, 0},
133 { OUString("IsBackgroundDark") , WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
134 { OUString("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
135 { OUString("FooterText"), WID_PAGE_FOOTERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
136 { OUString("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
137 { OUString("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
138 { OUString("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, cppu::UnoType<bool>::get(), 0, 0},
139 { OUString("DateTimeText"), WID_PAGE_DATETIMETEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
140 { OUString("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
141 { OUString("TransitionType"), WID_TRANSITION_TYPE, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
142 { OUString("TransitionSubtype"), WID_TRANSITION_SUBTYPE, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
143 { OUString("TransitionDirection"), WID_TRANSITION_DIRECTION, ::cppu::UnoType<sal_Bool>::get(), 0, 0},
144 { OUString("TransitionFadeColor"), WID_TRANSITION_FADE_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
145 { OUString(UNO_NAME_PAGE_TRANSITION_DURATION), WID_TRANSITION_DURATION, ::cppu::UnoType<double>::get(), 0, 0},
146 { OUString("LoopSound"), WID_LOOP_SOUND, cppu::UnoType<bool>::get(), 0, 0},
147 { OUString("NavigationOrder"), WID_NAVORDER, cppu::UnoType<css::container::XIndexAccess>::get(),0, 0},
148 { OUString(), 0, css::uno::Type(), 0, 0 }
151 #define DRAW_PAGE_NOTES_PROPERTIES \
152 { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
153 { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
154 { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
155 { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
156 { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
157 { OUString(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \
158 { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0}, \
159 { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0}, \
160 { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0}, \
161 { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0}, \
162 { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
163 { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},\
164 { OUString("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
165 { OUString("HeaderText"), WID_PAGE_HEADERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0}, \
166 { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0}, \
167 { OUString("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
168 { OUString("FooterText"), WID_PAGE_FOOTERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0}, \
169 { OUString("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
170 { OUString("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, cppu::UnoType<bool>::get(), 0, 0}, \
171 { OUString("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, cppu::UnoType<bool>::get(), 0, 0}, \
172 { OUString("DateTimeText"), WID_PAGE_DATETIMETEXT, ::cppu::UnoType<OUString>::get(), 0, 0}, \
173 { OUString("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
174 { OUString("NavigationOrder"), WID_NAVORDER, cppu::UnoType<css::container::XIndexAccess>::get(),0, 0}, \
175 { OUString(), 0, css::uno::Type(), 0, 0 }
177 static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl[] =
179 // this must be the first two entries so they can be excluded for PageKind::Standard
180 { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), beans::PropertyAttribute::MAYBEVOID,0},
181 DRAW_PAGE_NOTES_PROPERTIES
183 static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl[] =
185 DRAW_PAGE_NOTES_PROPERTIES
188 #define GRAPHIC_PAGE_PROPERTIES \
189 { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
190 { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
191 { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
192 { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
193 { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
194 { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0}, \
195 { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0}, \
196 { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0}, \
197 { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0}, \
198 { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0}, \
199 { OUString(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
200 { OUString(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), css::beans::PropertyAttribute::READONLY, 0},\
201 { OUString(UNO_NAME_PAGE_PREVIEWMETAFILE), WID_PAGE_PREVIEWMETAFILE, cppu::UnoType<css::uno::Sequence<sal_Int8>>::get(), css::beans::PropertyAttribute::READONLY, 0},\
202 { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0}, \
203 { OUString(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, ::cppu::UnoType<OUString>::get(), 0, 0}, \
204 { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0}, \
205 { OUString("NavigationOrder"), WID_NAVORDER, cppu::UnoType<css::container::XIndexAccess>::get(),0, 0}, \
206 { OUString(), 0, css::uno::Type(), 0, 0 }
208 static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl[] =
210 { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), beans::PropertyAttribute::MAYBEVOID,0},
211 GRAPHIC_PAGE_PROPERTIES
213 static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl[] =
215 GRAPHIC_PAGE_PROPERTIES
218 bool bWithoutBackground = ePageKind != PageKind::Standard && ePageKind != PageKind::Handout;
219 const SvxItemPropertySet* pRet = nullptr;
220 if( bImpress )
222 if( ePageKind == PageKind::Standard )
224 //PageKind::Standard always has a background property
225 static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
226 pRet = &aDrawPagePropertySet_Impl;
228 else
230 if(bWithoutBackground)
232 static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
233 pRet = &aDrawPageNotesHandoutPropertyNoBackSet_Impl;
235 else
237 static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
238 pRet = &aDrawPageNotesHandoutPropertySet_Impl;
242 else
244 if(bWithoutBackground)
246 static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
247 pRet = &aGraphicPagePropertyNoBackSet_Impl;
249 else
251 static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
252 pRet = &aGraphicPagePropertySet_Impl;
255 return pRet;
258 /** this function stores the property map for master pages in impress and draw */
259 static const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
261 static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl[] =
263 { OUString(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, cppu::UnoType<beans::XPropertySet>::get(), 0, 0},
264 { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
265 { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
266 { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
267 { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
268 { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
269 { OUString(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, cppu::UnoType<awt::XBitmap>::get(), beans::PropertyAttribute::READONLY, 0},
270 { OUString(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0},
271 { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0},
272 { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0},
273 { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
274 { OUString("BackgroundFullSize"), WID_PAGE_BACKFULL, cppu::UnoType<bool>::get(), 0, 0},
275 { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
276 { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
277 { OUString(), 0, css::uno::Type(), 0, 0 }
280 static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl[] =
282 { OUString(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
283 { OUString(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
284 { OUString(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
285 { OUString(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
286 { OUString(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
287 { OUString(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, ::cppu::UnoType<view::PaperOrientation>::get(),0, 0},
288 { OUString(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, ::cppu::UnoType<sal_Int16>::get(), beans::PropertyAttribute::READONLY, 0},
289 { OUString(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
290 { OUString(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, ::cppu::UnoType<sal_Int16>::get(), 0, 0},
291 { OUString(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
292 { OUString("IsBackgroundDark"), WID_PAGE_ISDARK, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0},
293 { OUString("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
294 { OUString("HeaderText"), WID_PAGE_HEADERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
295 { OUString("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
296 { OUString("FooterText"), WID_PAGE_FOOTERTEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
297 { OUString("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
298 { OUString("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, cppu::UnoType<bool>::get(), 0, 0},
299 { OUString("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, cppu::UnoType<bool>::get(), 0, 0},
300 { OUString("DateTimeText"), WID_PAGE_DATETIMETEXT, ::cppu::UnoType<OUString>::get(), 0, 0},
301 { OUString("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0},
302 { OUString(), 0, css::uno::Type(), 0, 0 }
305 const SvxItemPropertySet* pRet = nullptr;
306 if( ePageKind == PageKind::Handout )
308 static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
309 pRet = &aHandoutMasterPagePropertySet_Impl;
311 else
313 static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
314 pRet = &aMasterPagePropertySet_Impl;
316 return pRet;
319 namespace
321 class theSdGenericDrawPageUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdGenericDrawPageUnoTunnelId> {};
324 const css::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() throw()
326 return theSdGenericDrawPageUnoTunnelId::get().getSeq();
329 sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
331 if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
332 rId.getConstArray(), 16 ) )
334 return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
336 else
338 return SvxFmDrawPage::getSomething( rId );
342 SdGenericDrawPage::SdGenericDrawPage(SdXImpressDocument* _pModel, SdPage* pInPage, const SvxItemPropertySet* _pSet)
343 : SvxFmDrawPage( static_cast<SdrPage*>(pInPage) ),
344 SdUnoSearchReplaceShape(this),
345 mpDocModel( _pModel ),
346 mpSdrModel(nullptr),
347 mbIsImpressDocument(false),
348 mnTempPageNumber(0),
349 mpPropSet ( _pSet )
351 mpSdrModel = SvxFmDrawPage::mpModel;
352 if( mpDocModel )
353 mbIsImpressDocument = mpDocModel->IsImpressDocument();
357 SdGenericDrawPage::~SdGenericDrawPage() throw()
361 void SdGenericDrawPage::throwIfDisposed() const
363 if( (SvxFmDrawPage::mpModel == nullptr) || (mpDocModel == nullptr) || (SvxFmDrawPage::mpPage == nullptr) )
364 throw lang::DisposedException();
367 SdXImpressDocument* SdGenericDrawPage::GetModel() const
369 if( mpSdrModel != SvxFmDrawPage::mpModel )
370 const_cast<SdGenericDrawPage*>(this)->UpdateModel();
371 return mpDocModel;
374 bool SdGenericDrawPage::IsImpressDocument() const
376 if( mpSdrModel != SvxFmDrawPage::mpModel )
377 const_cast<SdGenericDrawPage*>(this)->UpdateModel();
378 return mbIsImpressDocument;
382 void SdGenericDrawPage::UpdateModel()
384 mpSdrModel = SvxFmDrawPage::mpModel;
385 if( mpSdrModel )
387 uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
388 mpDocModel = SdXImpressDocument::getImplementation( xModel );
390 else
392 mpDocModel = nullptr;
394 mbIsImpressDocument = mpDocModel && mpDocModel->IsImpressDocument();
397 // this is called whenever a SdrObject must be created for a empty api shape wrapper
398 SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShape >& xShape )
400 if( nullptr == SvxFmDrawPage::mpPage || !xShape.is() )
401 return nullptr;
403 OUString aType( xShape->getShapeType() );
404 const OUString aPrefix( "com.sun.star.presentation." );
405 if( !aType.startsWith( aPrefix ) )
407 SdrObject* pObj = SvxFmDrawPage::CreateSdrObject_( xShape );
408 return pObj;
411 aType = aType.copy( aPrefix.getLength() );
413 PresObjKind eObjKind = PRESOBJ_NONE;
415 if( aType == "TitleTextShape" )
417 eObjKind = PRESOBJ_TITLE;
419 else if( aType == "OutlinerShape" )
421 eObjKind = PRESOBJ_OUTLINE;
423 else if( aType == "SubtitleShape" )
425 eObjKind = PRESOBJ_TEXT;
427 else if( aType == "OLE2Shape" )
429 eObjKind = PRESOBJ_OBJECT;
431 else if( aType == "ChartShape" )
433 eObjKind = PRESOBJ_CHART;
435 else if( aType == "CalcShape" )
437 eObjKind = PRESOBJ_CALC;
439 else if( aType == "TableShape" )
441 eObjKind = PRESOBJ_TABLE;
443 else if( aType == "GraphicObjectShape" )
445 eObjKind = PRESOBJ_GRAPHIC;
447 else if( aType == "OrgChartShape" )
449 eObjKind = PRESOBJ_ORGCHART;
451 else if( aType == "PageShape" )
453 if( GetPage()->GetPageKind() == PageKind::Notes && GetPage()->IsMasterPage() )
454 eObjKind = PRESOBJ_TITLE;
455 else
456 eObjKind = PRESOBJ_PAGE;
458 else if( aType == "NotesShape" )
460 eObjKind = PRESOBJ_NOTES;
462 else if( aType == "HandoutShape" )
464 eObjKind = PRESOBJ_HANDOUT;
466 else if( aType == "FooterShape" )
468 eObjKind = PRESOBJ_FOOTER;
470 else if( aType == "HeaderShape" )
472 eObjKind = PRESOBJ_HEADER;
474 else if( aType == "SlideNumberShape" )
476 eObjKind = PRESOBJ_SLIDENUMBER;
478 else if( aType == "DateTimeShape" )
480 eObjKind = PRESOBJ_DATETIME;
482 else if( aType == "MediaShape" )
484 eObjKind = PRESOBJ_MEDIA;
487 ::tools::Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
489 const awt::Point aPos( aRect.Left(), aRect.Top() );
490 xShape->setPosition( aPos );
492 const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() );
493 xShape->setSize( aSize );
495 SdrObject *pPresObj = nullptr;
496 if( (eObjKind == PRESOBJ_TABLE) || (eObjKind == PRESOBJ_MEDIA) )
498 pPresObj = SvxFmDrawPage::CreateSdrObject_( xShape );
499 if( pPresObj )
501 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
502 pPresObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true);
503 GetPage()->InsertPresObj( pPresObj, eObjKind );
506 else
508 pPresObj = GetPage()->CreatePresObj( eObjKind, false, aRect );
511 if( pPresObj )
512 pPresObj->SetUserCall( GetPage() );
514 return pPresObj;
517 // XInterface
518 Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
520 Any aAny;
522 if (rType == cppu::UnoType<beans::XPropertySet>::get())
524 aAny <<= Reference<beans::XPropertySet>(this);
526 else if (rType == cppu::UnoType<container::XNamed>::get())
528 aAny <<= Reference<container::XNamed>(this);
530 else if (rType == cppu::UnoType<util::XReplaceable>::get())
532 aAny <<= Reference<util::XReplaceable>(this);
534 else if (rType == cppu::UnoType<util::XSearchable>::get())
536 aAny <<= Reference<util::XSearchable>(this);
538 else if (rType == cppu::UnoType<document::XLinkTargetSupplier>::get())
540 aAny <<= Reference<document::XLinkTargetSupplier>(this);
542 else if (rType == cppu::UnoType<drawing::XShapeCombiner>::get())
544 aAny <<= Reference<drawing::XShapeCombiner>(this);
546 else if (rType == cppu::UnoType<drawing::XShapeBinder>::get())
548 aAny <<= Reference<drawing::XShapeBinder>(this);
550 else if (rType == cppu::UnoType<beans::XMultiPropertySet>::get())
552 aAny <<= Reference<beans::XMultiPropertySet>(this);
554 else if (rType == cppu::UnoType<office::XAnnotationAccess>::get())
556 aAny <<= Reference<office::XAnnotationAccess>(this);
558 else if (IsImpressDocument() && rType == cppu::UnoType<XAnimationNodeSupplier>::get())
560 const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PageKind::Standard;
562 if( ePageKind == PageKind::Standard )
563 return makeAny( Reference< XAnimationNodeSupplier >( this ) );
565 else
566 return SvxDrawPage::queryInterface( rType );
568 return aAny;
571 // XPropertySet
572 Reference< beans::XPropertySetInfo > SAL_CALL SdGenericDrawPage::getPropertySetInfo()
574 ::SolarMutexGuard aGuard;
575 throwIfDisposed();
576 return mpPropSet->getPropertySetInfo();
579 void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
581 ::SolarMutexGuard aGuard;
583 throwIfDisposed();
585 const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
587 switch( pEntry ? pEntry->nWID : -1 )
589 case WID_NAVORDER:
590 setNavigationOrder( aValue );
591 break;
592 case WID_PAGE_LEFT:
593 case WID_PAGE_RIGHT:
594 case WID_PAGE_TOP:
595 case WID_PAGE_BOTTOM:
596 case WID_PAGE_LAYOUT:
597 case WID_PAGE_DURATION:
598 case WID_PAGE_CHANGE:
600 sal_Int32 nValue = 0;
601 if(!(aValue >>= nValue))
602 throw lang::IllegalArgumentException();
604 switch( pEntry->nWID )
606 case WID_PAGE_LEFT:
607 SetLeftBorder(nValue);
608 break;
609 case WID_PAGE_RIGHT:
610 SetRightBorder( nValue );
611 break;
612 case WID_PAGE_TOP:
613 SetUpperBorder( nValue );
614 break;
615 case WID_PAGE_BOTTOM:
616 SetLowerBorder( nValue );
617 break;
618 case WID_PAGE_CHANGE:
619 GetPage()->SetPresChange( static_cast<PresChange>(nValue) );
620 break;
621 case WID_PAGE_LAYOUT:
622 GetPage()->SetAutoLayout( static_cast<AutoLayout>(nValue), true );
623 break;
624 case WID_PAGE_DURATION:
625 GetPage()->SetTime(nValue);
626 break;
628 break;
630 case WID_PAGE_HIGHRESDURATION:
632 double fValue = 0;
633 if(!(aValue >>= fValue))
634 throw lang::IllegalArgumentException();
636 GetPage()->SetTime(fValue);
637 break;
639 case WID_PAGE_WIDTH:
641 sal_Int32 nWidth = 0;
642 if(!(aValue >>= nWidth))
643 throw lang::IllegalArgumentException();
645 SetWidth( nWidth );
646 break;
648 case WID_PAGE_HEIGHT:
650 sal_Int32 nHeight = 0;
651 if(!(aValue >>= nHeight))
652 throw lang::IllegalArgumentException();
654 SetHeight( nHeight );
655 break;
657 case WID_PAGE_ORIENT:
659 sal_Int32 nEnum = 0;
660 if(!::cppu::enum2int( nEnum, aValue ))
661 throw lang::IllegalArgumentException();
663 Orientation eOri = (static_cast<view::PaperOrientation>(nEnum) == view::PaperOrientation_PORTRAIT)?Orientation::Portrait:Orientation::Landscape;
665 if( eOri != GetPage()->GetOrientation() )
667 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
668 const PageKind ePageKind = GetPage()->GetPageKind();
670 sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
671 for (i = 0; i < nPageCnt; i++)
673 SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
674 pPage->SetOrientation( eOri );
677 nPageCnt = rDoc.GetSdPageCount(ePageKind);
679 for (i = 0; i < nPageCnt; i++)
681 SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
682 pPage->SetOrientation( eOri );
685 break;
687 case WID_PAGE_EFFECT:
689 sal_Int32 nEnum = 0;
690 if(!::cppu::enum2int( nEnum, aValue ))
691 throw lang::IllegalArgumentException();
693 GetPage()->SetFadeEffect( static_cast<presentation::FadeEffect>(nEnum) );
694 break;
696 case WID_PAGE_BACK:
697 setBackground( aValue );
698 break;
699 case WID_PAGE_SPEED:
701 sal_Int32 nEnum = 0;
702 if(!::cppu::enum2int( nEnum, aValue ))
703 throw lang::IllegalArgumentException();
705 GetPage()->setTransitionDuration( nEnum == 0 ? 3.0 : (nEnum == 1 ? 2.0 : 1.0 ) );
706 break;
708 case WID_PAGE_VISIBLE :
710 bool bVisible = false;
711 if( ! ( aValue >>= bVisible ) )
712 throw lang::IllegalArgumentException();
713 GetPage()->SetExcluded( !bVisible );
714 break;
716 case WID_PAGE_SOUNDFILE :
718 OUString aURL;
719 if( aValue >>= aURL )
721 GetPage()->SetSoundFile( aURL );
722 GetPage()->SetSound( !aURL.isEmpty() );
723 break;
725 else
727 bool bStopSound = false;
728 if( aValue >>= bStopSound )
730 GetPage()->SetStopSound( bStopSound );
731 break;
735 throw lang::IllegalArgumentException();
737 case WID_LOOP_SOUND:
739 bool bLoop = false;
740 if( ! (aValue >>= bLoop) )
741 throw lang::IllegalArgumentException();
743 GetPage()->SetLoopSound( bLoop );
744 break;
746 case WID_PAGE_BACKFULL:
748 bool bFullSize = false;
749 if( ! ( aValue >>= bFullSize ) )
750 throw lang::IllegalArgumentException();
751 GetPage()->SetBackgroundFullSize( bFullSize );
752 break;
754 case WID_PAGE_BACKVIS:
756 bool bVisible = false;
757 if( ! ( aValue >>= bVisible ) )
758 throw lang::IllegalArgumentException();
760 SdrPage* pPage = GetPage();
761 if( pPage )
763 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
764 if( rDoc.GetMasterPageCount() )
766 SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
767 SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
768 aVisibleLayers.Set(rLayerAdmin.GetLayerID(sUNO_LayerName_background), bVisible);
769 pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
772 break;
774 case WID_PAGE_BACKOBJVIS:
776 bool bVisible = false;
777 if( ! ( aValue >>= bVisible ) )
778 throw lang::IllegalArgumentException();
780 SdrPage* pPage = GetPage();
781 if( pPage )
783 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
784 if( rDoc.GetMasterPageCount() )
786 SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
787 SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
788 aVisibleLayers.Set(rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects), bVisible);
789 pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
793 break;
795 case WID_PAGE_USERATTRIBS:
797 if( !GetPage()->setAlienAttributes( aValue ) )
798 throw lang::IllegalArgumentException();
799 break;
801 case WID_PAGE_BOOKMARK:
803 OUString aBookmarkURL;
804 if( ! ( aValue >>= aBookmarkURL ) )
805 throw lang::IllegalArgumentException();
807 setBookmarkURL( aBookmarkURL );
808 break;
811 case WID_PAGE_HEADERVISIBLE:
812 case WID_PAGE_HEADERTEXT:
813 case WID_PAGE_FOOTERVISIBLE:
814 case WID_PAGE_FOOTERTEXT:
815 case WID_PAGE_PAGENUMBERVISIBLE:
816 case WID_PAGE_DATETIMEVISIBLE:
817 case WID_PAGE_DATETIMEFIXED:
818 case WID_PAGE_DATETIMETEXT:
819 case WID_PAGE_DATETIMEFORMAT:
821 sd::HeaderFooterSettings aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
823 switch( pEntry->nWID )
825 case WID_PAGE_HEADERVISIBLE:
827 bool bVisible = false;
828 if( ! ( aValue >>= bVisible ) )
829 throw lang::IllegalArgumentException();
831 aHeaderFooterSettings.mbHeaderVisible = bVisible;
832 break;
834 case WID_PAGE_HEADERTEXT:
836 OUString aText;
837 if( ! ( aValue >>= aText ) )
838 throw lang::IllegalArgumentException();
840 aHeaderFooterSettings.maHeaderText = aText;
841 break;
843 case WID_PAGE_FOOTERVISIBLE:
845 bool bVisible = false;
846 if( ! ( aValue >>= bVisible ) )
847 throw lang::IllegalArgumentException();
849 aHeaderFooterSettings.mbFooterVisible = bVisible;
850 break;
852 case WID_PAGE_FOOTERTEXT:
854 OUString aText;
855 if( ! ( aValue >>= aText ) )
856 throw lang::IllegalArgumentException();
858 aHeaderFooterSettings.maFooterText = aText;
859 break;
861 case WID_PAGE_PAGENUMBERVISIBLE:
863 bool bVisible = false;
864 if( ! ( aValue >>= bVisible ) )
865 throw lang::IllegalArgumentException();
867 aHeaderFooterSettings.mbSlideNumberVisible = bVisible;
868 break;
870 case WID_PAGE_DATETIMEVISIBLE:
872 bool bVisible = false;
873 if( ! ( aValue >>= bVisible ) )
874 throw lang::IllegalArgumentException();
876 aHeaderFooterSettings.mbDateTimeVisible = bVisible;
877 break;
879 case WID_PAGE_DATETIMEFIXED:
881 bool bVisible = false;
882 if( ! ( aValue >>= bVisible ) )
883 throw lang::IllegalArgumentException();
885 aHeaderFooterSettings.mbDateTimeIsFixed = bVisible;
886 break;
888 case WID_PAGE_DATETIMETEXT:
890 OUString aText;
891 if( ! ( aValue >>= aText ) )
892 throw lang::IllegalArgumentException();
894 aHeaderFooterSettings.maDateTimeText = aText;
895 break;
897 case WID_PAGE_DATETIMEFORMAT:
899 sal_Int32 nValue = 0;
900 if( ! ( aValue >>= nValue ) )
901 throw lang::IllegalArgumentException();
903 aHeaderFooterSettings.meDateFormat = static_cast<SvxDateFormat>(nValue & 0x0f);
904 aHeaderFooterSettings.meTimeFormat = static_cast<SvxTimeFormat>((nValue >> 4) & 0x0f);
905 break;
909 if( !(aHeaderFooterSettings == GetPage()->getHeaderFooterSettings()) )
910 GetPage()->setHeaderFooterSettings( aHeaderFooterSettings );
912 break;
915 case WID_PAGE_NUMBER:
916 if( (GetPage()->GetPageKind() == PageKind::Handout) && !GetPage()->IsMasterPage() )
918 if( !(aValue >>= mnTempPageNumber) )
919 throw lang::IllegalArgumentException();
921 break;
923 throw beans::PropertyVetoException();
925 case WID_PAGE_LDBITMAP:
926 case WID_PAGE_LDNAME:
927 case WID_PAGE_ISDARK:
928 throw beans::PropertyVetoException();
930 case WID_TRANSITION_TYPE:
932 sal_Int16 nValue = 0;
933 if( ! ( aValue >>= nValue ) )
934 throw lang::IllegalArgumentException();
936 GetPage()->setTransitionType( nValue );
937 break;
940 case WID_TRANSITION_SUBTYPE:
942 sal_Int16 nValue = 0;
943 if( ! ( aValue >>= nValue ) )
944 throw lang::IllegalArgumentException();
946 GetPage()->setTransitionSubtype( nValue );
947 break;
950 case WID_TRANSITION_DIRECTION:
952 bool bValue = false;
953 if( ! ( aValue >>= bValue ) )
954 throw lang::IllegalArgumentException();
956 GetPage()->setTransitionDirection( bValue );
957 break;
960 case WID_TRANSITION_FADE_COLOR:
962 sal_Int32 nValue = 0;
963 if( ! ( aValue >>= nValue ) )
964 throw lang::IllegalArgumentException();
966 GetPage()->setTransitionFadeColor( nValue );
967 break;
970 case WID_TRANSITION_DURATION:
972 double fValue = 0.0;
973 if( ! ( aValue >>= fValue ) )
974 throw lang::IllegalArgumentException();
976 GetPage()->setTransitionDuration( fValue );
977 break;
980 default:
981 throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
984 GetModel()->SetModified();
987 Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
989 ::SolarMutexGuard aGuard;
991 throwIfDisposed();
993 uno::Any aAny;
995 const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
997 sal_Int16 nEntry = pEntry ? pEntry->nWID : -1;
998 switch (nEntry)
1000 case WID_NAVORDER:
1001 aAny = getNavigationOrder();
1002 break;
1003 case WID_PAGE_LEFT:
1004 aAny <<= GetPage()->GetLeftBorder();
1005 break;
1006 case WID_PAGE_RIGHT:
1007 aAny <<= GetPage()->GetRightBorder();
1008 break;
1009 case WID_PAGE_TOP:
1010 aAny <<= GetPage()->GetUpperBorder();
1011 break;
1012 case WID_PAGE_BOTTOM:
1013 aAny <<= GetPage()->GetLowerBorder();
1014 break;
1015 case WID_PAGE_WIDTH:
1016 aAny <<= static_cast<sal_Int32>( GetPage()->GetSize().getWidth() );
1017 break;
1018 case WID_PAGE_HEIGHT:
1019 aAny <<= static_cast<sal_Int32>( GetPage()->GetSize().getHeight() );
1020 break;
1021 case WID_PAGE_ORIENT:
1022 aAny <<=
1023 GetPage()->GetOrientation() == Orientation::Portrait
1024 ? view::PaperOrientation_PORTRAIT
1025 : view::PaperOrientation_LANDSCAPE;
1026 break;
1027 case WID_PAGE_EFFECT:
1028 aAny <<= GetPage()->GetFadeEffect();
1029 break;
1030 case WID_PAGE_CHANGE:
1031 aAny <<= static_cast<sal_Int32>( GetPage()->GetPresChange() );
1032 break;
1033 case WID_PAGE_SPEED:
1035 const double fDuration = GetPage()->getTransitionDuration();
1036 aAny <<= presentation::AnimationSpeed(
1037 fDuration < 2.0 ? 2 : fDuration > 2.0 ? 0 : 1);
1039 break;
1040 case WID_PAGE_LAYOUT:
1041 aAny <<= static_cast<sal_Int16>( GetPage()->GetAutoLayout() );
1042 break;
1043 case WID_PAGE_NUMBER:
1045 const sal_uInt16 nPageNumber(GetPage()->GetPageNum());
1047 if(nPageNumber > 0)
1049 // for all other pages calculate the number
1050 aAny <<= static_cast<sal_Int16>(static_cast<sal_uInt16>((nPageNumber-1)>>1) + 1);
1052 else
1054 aAny <<= mnTempPageNumber;
1057 break;
1058 case WID_PAGE_DURATION:
1059 aAny <<= static_cast<sal_Int32>( GetPage()->GetTime() + .5 );
1060 break;
1061 case WID_PAGE_HIGHRESDURATION:
1062 aAny <<= GetPage()->GetTime();
1063 break;
1064 case WID_PAGE_LDNAME:
1066 const OUString aName( GetPage()->GetName() );
1067 aAny <<= aName;
1068 break;
1070 case WID_PAGE_LDBITMAP:
1072 Reference< awt::XBitmap > xBitmap(VCLUnoHelper::CreateBitmap(BitmapEx(BMP_PAGE)));
1073 aAny <<= xBitmap;
1075 break;
1076 case WID_PAGE_BACK:
1077 getBackground( aAny );
1078 break;
1079 case WID_PAGE_PREVIEW :
1080 case WID_PAGE_PREVIEWMETAFILE :
1082 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1083 ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh();
1084 if ( pDocShell )
1086 sal_uInt16 nPgNum = 0;
1087 sal_uInt16 nPageCount = rDoc.GetSdPageCount( PageKind::Standard );
1088 sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1089 while( nPgNum < nPageCount )
1091 rDoc.SetSelected( rDoc.GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber );
1092 nPgNum++;
1094 std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
1095 if (xMetaFile)
1097 Size aSize( GetPage()->GetSize() );
1098 xMetaFile->AddAction( new MetaFillColorAction( COL_WHITE, true ), 0 );
1099 xMetaFile->AddAction( new MetaRectAction( ::tools::Rectangle( Point(), aSize ) ), 1 );
1100 xMetaFile->SetPrefMapMode(MapMode(MapUnit::Map100thMM));
1101 xMetaFile->SetPrefSize( aSize );
1103 SvMemoryStream aDestStrm( 65535, 65535 );
1104 if (nEntry == WID_PAGE_PREVIEW)
1105 // Preview: WMF format.
1106 ConvertGDIMetaFileToWMF(*xMetaFile, aDestStrm, nullptr, false);
1107 else
1108 // PreviewMetafile: SVM format.
1109 xMetaFile->Write(aDestStrm);
1110 Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aDestStrm.GetData()), aDestStrm.Tell() );
1111 aAny <<= aSeq;
1115 break;
1117 case WID_PAGE_PREVIEWBITMAP :
1119 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1120 ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh();
1121 if ( pDocShell )
1123 sal_uInt16 nPgNum = 0;
1124 sal_uInt16 nPageCount = rDoc.GetSdPageCount( PageKind::Standard );
1125 sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1126 while( nPgNum < nPageCount )
1128 rDoc.SetSelected( rDoc.GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber );
1129 nPgNum++;
1131 std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
1132 BitmapEx aBitmap;
1133 if (xMetaFile && xMetaFile->CreateThumbnail(aBitmap))
1135 SvMemoryStream aMemStream;
1136 WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false);
1137 uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aMemStream.GetData()), aMemStream.Tell() );
1138 aAny <<= aSeq;
1142 break;
1144 case WID_PAGE_VISIBLE :
1146 bool bVisible = !GetPage()->IsExcluded();
1147 aAny <<= bVisible;
1148 break;
1151 case WID_PAGE_SOUNDFILE :
1153 if( GetPage()->IsStopSound() )
1155 aAny <<= true;
1157 else
1159 OUString aURL;
1160 if( GetPage()->IsSoundOn() )
1161 aURL = GetPage()->GetSoundFile();
1162 aAny <<= aURL;
1164 break;
1166 case WID_LOOP_SOUND:
1168 aAny <<= GetPage()->IsLoopSound();
1169 break;
1171 case WID_PAGE_BACKFULL:
1173 bool bFullSize = GetPage()->IsBackgroundFullSize();
1174 aAny <<= bFullSize;
1175 break;
1177 case WID_PAGE_BACKVIS:
1179 SdrPage* pPage = GetPage();
1180 if( pPage )
1182 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
1183 if( rDoc.GetMasterPageCount() )
1185 SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
1186 SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1187 aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(sUNO_LayerName_background));
1189 else
1191 aAny <<= false;
1194 break;
1196 case WID_PAGE_BACKOBJVIS:
1198 SdrPage* pPage = GetPage();
1199 if( pPage )
1201 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
1202 if( rDoc.GetMasterPageCount() )
1204 SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
1205 SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
1206 aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects));
1208 else
1210 aAny <<= false;
1213 break;
1215 case WID_PAGE_USERATTRIBS:
1217 GetPage()->getAlienAttributes( aAny );
1218 break;
1220 case WID_PAGE_BOOKMARK:
1222 aAny <<= getBookmarkURL();
1223 break;
1225 case WID_PAGE_ISDARK:
1227 aAny <<= GetPage()->GetPageBackgroundColor().IsDark();
1228 break;
1230 case WID_PAGE_HEADERVISIBLE:
1231 aAny <<= GetPage()->getHeaderFooterSettings().mbHeaderVisible;
1232 break;
1233 case WID_PAGE_HEADERTEXT:
1235 const OUString aText( GetPage()->getHeaderFooterSettings().maHeaderText );
1236 aAny <<= aText;
1238 break;
1239 case WID_PAGE_FOOTERVISIBLE:
1240 aAny <<= GetPage()->getHeaderFooterSettings().mbFooterVisible;
1241 break;
1242 case WID_PAGE_FOOTERTEXT:
1244 const OUString aText( GetPage()->getHeaderFooterSettings().maFooterText );
1245 aAny <<= aText;
1247 break;
1248 case WID_PAGE_PAGENUMBERVISIBLE:
1249 aAny <<= GetPage()->getHeaderFooterSettings().mbSlideNumberVisible;
1250 break;
1251 case WID_PAGE_DATETIMEVISIBLE:
1252 aAny <<= GetPage()->getHeaderFooterSettings().mbDateTimeVisible;
1253 break;
1254 case WID_PAGE_DATETIMEFIXED:
1255 aAny <<= GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed;
1256 break;
1257 case WID_PAGE_DATETIMETEXT:
1259 const OUString aText( GetPage()->getHeaderFooterSettings().maDateTimeText );
1260 aAny <<= aText;
1262 break;
1263 case WID_PAGE_DATETIMEFORMAT:
1265 auto const & rSettings = GetPage()->getHeaderFooterSettings();
1266 sal_Int32 x = static_cast<sal_Int32>(rSettings.meDateFormat) | (static_cast<sal_Int32>(rSettings.meTimeFormat) << 4);
1267 aAny <<= x;
1269 break;
1271 case WID_TRANSITION_TYPE:
1272 aAny <<= GetPage()->getTransitionType();
1273 break;
1275 case WID_TRANSITION_SUBTYPE:
1276 aAny <<= GetPage()->getTransitionSubtype();
1277 break;
1279 case WID_TRANSITION_DIRECTION:
1280 aAny <<= GetPage()->getTransitionDirection();
1281 break;
1283 case WID_TRANSITION_FADE_COLOR:
1284 aAny <<= GetPage()->getTransitionFadeColor();
1285 break;
1287 case WID_TRANSITION_DURATION:
1288 aAny <<= GetPage()->getTransitionDuration();
1289 break;
1291 default:
1292 throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
1294 return aAny;
1297 void SAL_CALL SdGenericDrawPage::addPropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) {}
1298 void SAL_CALL SdGenericDrawPage::removePropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) {}
1299 void SAL_CALL SdGenericDrawPage::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) {}
1300 void SAL_CALL SdGenericDrawPage::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) {}
1302 // XMultiPropertySet
1303 void SAL_CALL SdGenericDrawPage::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues )
1305 if( aPropertyNames.getLength() != aValues.getLength() )
1306 throw lang::IllegalArgumentException();
1308 const OUString* pNames = aPropertyNames.getConstArray();
1309 const Any* pValues = aValues.getConstArray();
1310 sal_uInt32 nCount = aValues.getLength();
1311 while( nCount-- )
1315 setPropertyValue( *pNames++, *pValues++ );
1317 catch( beans::UnknownPropertyException& )
1319 // ignore for multi property set
1320 // todo: optimize this!
1325 Sequence< Any > SAL_CALL SdGenericDrawPage::getPropertyValues( const Sequence< OUString >& aPropertyNames )
1327 const OUString* pNames = aPropertyNames.getConstArray();
1328 sal_uInt32 nCount = aPropertyNames.getLength();
1329 Sequence< Any > aValues( nCount );
1330 Any* pValues = aValues.getArray();
1331 while( nCount-- )
1333 Any aValue;
1336 aValue = getPropertyValue( *pNames++ );
1338 catch( beans::UnknownPropertyException& )
1340 // ignore for multi property set
1341 // todo: optimize this!
1343 *pValues++ = aValue;
1345 return aValues;
1348 void SAL_CALL SdGenericDrawPage::addPropertiesChangeListener( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& )
1352 void SAL_CALL SdGenericDrawPage::removePropertiesChangeListener( const Reference< beans::XPropertiesChangeListener >& )
1356 void SAL_CALL SdGenericDrawPage::firePropertiesChangeEvent( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& )
1360 Reference< drawing::XShape > SdGenericDrawPage::CreateShape(SdrObject *pObj) const
1362 DBG_ASSERT( GetPage(), "SdGenericDrawPage::CreateShape(), can't create shape for disposed page!" );
1363 DBG_ASSERT( pObj, "SdGenericDrawPage::CreateShape(), invalid call with pObj == 0!" );
1365 if (!pObj)
1366 return Reference< drawing::XShape >();
1368 if (GetPage())
1370 PresObjKind eKind = GetPage()->GetPresObjKind(pObj);
1372 SvxShape* pShape = nullptr;
1374 if(pObj->GetObjInventor() == SdrInventor::Default)
1376 sal_uInt32 nInventor = pObj->GetObjIdentifier();
1377 switch( nInventor )
1379 case OBJ_TITLETEXT:
1380 pShape = new SvxShapeText( pObj );
1381 if( GetPage()->GetPageKind() == PageKind::Notes && GetPage()->IsMasterPage() )
1383 // fake a empty PageShape if it's a title shape on the master page
1384 pShape->SetShapeType("com.sun.star.presentation.PageShape");
1386 else
1388 pShape->SetShapeType("com.sun.star.presentation.TitleTextShape");
1390 eKind = PRESOBJ_NONE;
1391 break;
1392 case OBJ_OUTLINETEXT:
1393 pShape = new SvxShapeText( pObj );
1394 pShape->SetShapeType("com.sun.star.presentation.OutlinerShape");
1395 eKind = PRESOBJ_NONE;
1396 break;
1400 Reference< drawing::XShape > xShape( pShape );
1402 if(!xShape.is())
1403 xShape = SvxFmDrawPage::CreateShape( pObj );
1405 if( eKind != PRESOBJ_NONE )
1407 OUString aShapeType("com.sun.star.presentation.");
1409 switch( eKind )
1411 case PRESOBJ_TITLE:
1412 aShapeType += "TitleTextShape";
1413 break;
1414 case PRESOBJ_OUTLINE:
1415 aShapeType += "OutlinerShape";
1416 break;
1417 case PRESOBJ_TEXT:
1418 aShapeType += "SubtitleShape";
1419 break;
1420 case PRESOBJ_GRAPHIC:
1421 aShapeType += "GraphicObjectShape";
1422 break;
1423 case PRESOBJ_OBJECT:
1424 aShapeType += "OLE2Shape";
1425 break;
1426 case PRESOBJ_CHART:
1427 aShapeType += "ChartShape";
1428 break;
1429 case PRESOBJ_ORGCHART:
1430 aShapeType += "OrgChartShape";
1431 break;
1432 case PRESOBJ_CALC:
1433 aShapeType += "CalcShape";
1434 break;
1435 case PRESOBJ_TABLE:
1436 aShapeType += "TableShape";
1437 break;
1438 case PRESOBJ_MEDIA:
1439 aShapeType += "MediaShape";
1440 break;
1441 case PRESOBJ_PAGE:
1442 aShapeType += "PageShape";
1443 break;
1444 case PRESOBJ_HANDOUT:
1445 aShapeType += "HandoutShape";
1446 break;
1447 case PRESOBJ_NOTES:
1448 aShapeType += "NotesShape";
1449 break;
1450 case PRESOBJ_FOOTER:
1451 aShapeType += "FooterShape";
1452 break;
1453 case PRESOBJ_HEADER:
1454 aShapeType += "HeaderShape";
1455 break;
1456 case PRESOBJ_SLIDENUMBER:
1457 aShapeType += "SlideNumberShape";
1458 break;
1459 case PRESOBJ_DATETIME:
1460 aShapeType += "DateTimeShape";
1461 break;
1462 // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
1463 case PRESOBJ_NONE:
1464 case PRESOBJ_MAX:
1465 break;
1468 if( !pShape )
1469 pShape = SvxShape::getImplementation( xShape );
1471 if( pShape )
1472 pShape->SetShapeType( aShapeType );
1475 SvxShape *pSdShape = SvxShape::getImplementation(xShape);
1476 if (pSdShape)
1478 // SdXShape aggregates SvxShape
1479 new SdXShape(pSdShape, GetModel());
1481 return xShape;
1483 else
1485 return SvxFmDrawPage::CreateShape( pObj );
1490 // XServiceInfo
1491 Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
1493 Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
1494 comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.GenericDrawPage",
1495 "com.sun.star.document.LinkTarget",
1496 "com.sun.star.document.LinkTargetSupplier"});
1497 return aSeq;
1500 // XLinkTargetSupplier
1501 Reference< container::XNameAccess > SAL_CALL SdGenericDrawPage::getLinks( )
1503 return new SdPageLinkTargets( this );
1506 void SdGenericDrawPage::setBackground( const Any& )
1508 OSL_FAIL( "Don't call me, I'm useless!" );
1511 void SdGenericDrawPage::getBackground( Any& )
1513 OSL_FAIL( "Don't call me, I'm useless!" );
1516 OUString SdGenericDrawPage::getBookmarkURL() const
1518 OUStringBuffer aRet;
1519 if( SvxFmDrawPage::mpPage )
1521 OUString aFileName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetFileName() );
1522 if( !aFileName.isEmpty() )
1524 const OUString aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetBookmarkName() ) );
1525 aRet.append( aFileName );
1526 aRet.append( '#' );
1527 aRet.append( aBookmarkName );
1531 return aRet.makeStringAndClear();
1534 void SdGenericDrawPage::setBookmarkURL( OUString const & rURL )
1536 if( !SvxFmDrawPage::mpPage )
1537 return;
1539 sal_Int32 nIndex = rURL.indexOf( '#' );
1540 if( nIndex == -1 )
1541 return;
1543 const OUString aFileName( rURL.copy( 0, nIndex ) );
1544 const OUString aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) );
1546 if( !aFileName.isEmpty() && !aBookmarkName.isEmpty() )
1548 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink();
1549 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName );
1550 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName );
1551 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink();
1555 Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::combine( const Reference< drawing::XShapes >& xShapes )
1557 ::SolarMutexGuard aGuard;
1559 throwIfDisposed();
1561 DBG_ASSERT(SvxFmDrawPage::mpPage,"SdrPage is NULL! [CL]");
1562 DBG_ASSERT(mpView, "SdrView is NULL! [CL]");
1564 Reference< drawing::XShape > xShape;
1565 if(mpView==nullptr||!xShapes.is()||GetPage()==nullptr)
1566 return xShape;
1568 SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1570 SelectObjectsInView( xShapes, pPageView );
1572 mpView->CombineMarkedObjects( false );
1574 mpView->AdjustMarkHdl();
1575 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
1576 if( rMarkList.GetMarkCount() == 1 )
1578 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
1579 if( pObj )
1580 xShape.set( pObj->getUnoShape(), UNO_QUERY );
1583 mpView->HideSdrPage();
1585 GetModel()->SetModified();
1587 return xShape;
1590 void SAL_CALL SdGenericDrawPage::split( const Reference< drawing::XShape >& xGroup )
1592 ::SolarMutexGuard aGuard;
1594 throwIfDisposed();
1596 if(mpView==nullptr||!xGroup.is()||GetPage()==nullptr)
1597 return;
1599 SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1600 SelectObjectInView( xGroup, pPageView );
1601 mpView->DismantleMarkedObjects();
1602 mpView->HideSdrPage();
1604 GetModel()->SetModified();
1607 Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::bind( const Reference< drawing::XShapes >& xShapes )
1609 ::SolarMutexGuard aGuard;
1611 throwIfDisposed();
1613 uno::Reference< drawing::XShape > xShape;
1614 if(mpView==nullptr||!xShapes.is()||GetPage()==nullptr)
1615 return xShape;
1617 SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1619 SelectObjectsInView( xShapes, pPageView );
1621 mpView->CombineMarkedObjects();
1623 mpView->AdjustMarkHdl();
1624 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
1625 if( rMarkList.GetMarkCount() == 1 )
1627 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
1628 if( pObj )
1629 xShape.set( pObj->getUnoShape(), UNO_QUERY );
1632 mpView->HideSdrPage();
1634 GetModel()->SetModified();
1636 return xShape;
1639 void SAL_CALL SdGenericDrawPage::unbind( const Reference< drawing::XShape >& xShape )
1641 ::SolarMutexGuard aGuard;
1643 throwIfDisposed();
1645 if(mpView==nullptr||!xShape.is()||GetPage()==nullptr)
1646 return;
1648 SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
1649 SelectObjectInView( xShape, pPageView );
1650 mpView->DismantleMarkedObjects( true );
1651 mpView->HideSdrPage();
1653 GetModel()->SetModified();
1656 void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue )
1658 if( nValue == GetPage()->GetLeftBorder() )
1659 return;
1661 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1662 const PageKind ePageKind = GetPage()->GetPageKind();
1664 sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
1665 for (i = 0; i < nPageCnt; i++)
1667 SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
1668 pPage->SetLeftBorder( nValue );
1671 nPageCnt = rDoc.GetSdPageCount(ePageKind);
1673 for (i = 0; i < nPageCnt; i++)
1675 SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
1676 pPage->SetLeftBorder( nValue );
1680 void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue )
1682 if( nValue == GetPage()->GetRightBorder() )
1683 return;
1685 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1686 const PageKind ePageKind = GetPage()->GetPageKind();
1688 sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
1689 for (i = 0; i < nPageCnt; i++)
1691 SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
1692 pPage->SetRightBorder( nValue );
1695 nPageCnt = rDoc.GetSdPageCount(ePageKind);
1697 for (i = 0; i < nPageCnt; i++)
1699 SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
1700 pPage->SetRightBorder( nValue );
1704 void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue )
1706 if( nValue == GetPage()->GetUpperBorder() )
1707 return;
1709 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1710 const PageKind ePageKind = GetPage()->GetPageKind();
1712 sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
1713 for (i = 0; i < nPageCnt; i++)
1715 SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
1716 pPage->SetUpperBorder( nValue );
1719 nPageCnt = rDoc.GetSdPageCount(ePageKind);
1721 for (i = 0; i < nPageCnt; i++)
1723 SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
1724 pPage->SetUpperBorder( nValue );
1728 void SdGenericDrawPage::SetLowerBorder( sal_Int32 nValue )
1730 if( nValue == GetPage()->GetLowerBorder() )
1731 return;
1733 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1734 const PageKind ePageKind = GetPage()->GetPageKind();
1736 sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
1737 for (i = 0; i < nPageCnt; i++)
1739 SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
1740 pPage->SetLowerBorder( nValue );
1743 nPageCnt = rDoc.GetSdPageCount(ePageKind);
1745 for (i = 0; i < nPageCnt; i++)
1747 SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
1748 pPage->SetLowerBorder( nValue );
1752 static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind )
1754 ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
1755 if ( !pDocShell )
1756 return;
1758 ::sd::ViewShell* pViewSh = pDocShell->GetViewShell();
1760 if( !pViewSh )
1761 return;
1763 if( dynamic_cast<const ::sd::DrawViewShell* >(pViewSh) != nullptr )
1764 static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage();
1766 Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
1767 const long nWidth = aPageSize.Width();
1768 const long nHeight = aPageSize.Height();
1770 Point aPageOrg(nWidth, nHeight / 2);
1771 Size aViewSize(nWidth * 3, nHeight * 2);
1773 pDoc->SetMaxObjSize(aViewSize);
1775 pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), true);
1777 pViewSh->UpdateScrollBars();
1780 void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
1782 Size aSize( GetPage()->GetSize() );
1783 if( aSize.getWidth() == nWidth )
1784 return;
1786 aSize.setWidth( nWidth );
1788 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1789 const PageKind ePageKind = GetPage()->GetPageKind();
1791 sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
1792 for (i = 0; i < nPageCnt; i++)
1794 SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
1795 pPage->SetSize(aSize);
1798 nPageCnt = rDoc.GetSdPageCount(ePageKind);
1800 for (i = 0; i < nPageCnt; i++)
1802 SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
1803 pPage->SetSize(aSize);
1806 refreshpage( &rDoc, ePageKind );
1809 void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
1811 Size aSize( GetPage()->GetSize() );
1812 if( aSize.getHeight() == nHeight )
1813 return;
1815 aSize.setHeight( nHeight );
1817 SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
1818 const PageKind ePageKind = GetPage()->GetPageKind();
1820 sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
1821 for (i = 0; i < nPageCnt; i++)
1823 SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
1824 pPage->SetSize(aSize);
1827 nPageCnt = rDoc.GetSdPageCount(ePageKind);
1829 for (i = 0; i < nPageCnt; i++)
1831 SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
1832 pPage->SetSize(aSize);
1835 refreshpage( &rDoc, ePageKind );
1838 // XInterface
1839 void SdGenericDrawPage::release() throw()
1842 OWeakAggObject::release();
1845 // XComponent
1846 void SdGenericDrawPage::disposing() throw()
1848 mpDocModel = nullptr;
1849 SvxFmDrawPage::disposing();
1852 // XAnimationNodeSupplier
1853 Reference< XAnimationNode > SAL_CALL SdGenericDrawPage::getAnimationNode()
1855 ::SolarMutexGuard aGuard;
1857 throwIfDisposed();
1859 SdPage *pSdPage = static_cast<SdPage*>(SvxFmDrawPage::mpPage);
1861 return pSdPage->getAnimationNode();
1864 // SdPageLinkTargets
1865 SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw()
1867 mxPage = pUnoPage;
1868 mpUnoPage = pUnoPage;
1871 SdPageLinkTargets::~SdPageLinkTargets() throw()
1875 // XElementAccess
1876 uno::Type SAL_CALL SdPageLinkTargets::getElementType()
1878 return cppu::UnoType<beans::XPropertySet>::get();
1881 sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
1883 ::SolarMutexGuard aGuard;
1885 SdPage* pPage = mpUnoPage->GetPage();
1886 if( pPage != nullptr )
1888 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
1890 while( aIter.IsMore() )
1892 SdrObject* pObj = aIter.Next();
1893 OUString aStr( pObj->GetName() );
1894 if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
1895 aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
1896 if( !aStr.isEmpty() )
1897 return true;
1901 return false;
1904 // container::XNameAccess
1906 // XNameAccess
1907 Any SAL_CALL SdPageLinkTargets::getByName( const OUString& aName )
1909 ::SolarMutexGuard aGuard;
1911 SdPage* pPage = mpUnoPage->GetPage();
1912 if( pPage != nullptr )
1914 SdrObject* pObj = FindObject( aName );
1915 if( pObj )
1917 Reference< beans::XPropertySet > aRef( pObj->getUnoShape(), uno::UNO_QUERY );
1918 return makeAny( aRef );
1922 throw container::NoSuchElementException();
1925 Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
1927 ::SolarMutexGuard aGuard;
1929 sal_uInt32 nObjCount = 0;
1931 SdPage* pPage = mpUnoPage->GetPage();
1932 if( pPage != nullptr )
1934 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
1935 while( aIter.IsMore() )
1937 SdrObject* pObj = aIter.Next();
1938 OUString aStr( pObj->GetName() );
1939 if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
1940 aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
1941 if( !aStr.isEmpty() )
1942 nObjCount++;
1946 Sequence< OUString > aSeq( nObjCount );
1947 if( nObjCount > 0 )
1949 OUString* pStr = aSeq.getArray();
1951 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
1952 while( aIter.IsMore() )
1954 SdrObject* pObj = aIter.Next();
1955 OUString aStr( pObj->GetName() );
1956 if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
1957 aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
1958 if( !aStr.isEmpty() )
1959 *pStr++ = aStr;
1963 return aSeq;
1966 sal_Bool SAL_CALL SdPageLinkTargets::hasByName( const OUString& aName )
1968 ::SolarMutexGuard aGuard;
1970 return FindObject( aName ) != nullptr;
1973 SdrObject* SdPageLinkTargets::FindObject( const OUString& rName ) const throw()
1975 SdPage* pPage = mpUnoPage->GetPage();
1976 if( pPage == nullptr )
1977 return nullptr;
1979 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
1981 while( aIter.IsMore() )
1983 SdrObject* pObj = aIter.Next();
1984 OUString aStr( pObj->GetName() );
1985 if( aStr.isEmpty() && dynamic_cast< const SdrOle2Obj *>( pObj ) != nullptr )
1986 aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
1987 if( !aStr.isEmpty() && (aStr == rName) )
1988 return pObj;
1991 return nullptr;
1994 // XServiceInfo
1995 OUString SAL_CALL SdPageLinkTargets::getImplementationName()
1997 return OUString( "SdPageLinkTargets" );
2000 sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName )
2002 return cppu::supportsService( this, ServiceName );
2005 Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames()
2007 Sequence< OUString > aSeq { "com.sun.star.document.LinkTargets" };
2008 return aSeq;
2011 // SdDrawPage
2012 SdDrawPage::SdDrawPage(SdXImpressDocument* pModel, SdPage* pPage)
2013 : SdGenericDrawPage( pModel, pPage, ImplGetDrawPagePropertySet( pModel->IsImpressDocument(), pPage->GetPageKind() ) )
2017 SdDrawPage::~SdDrawPage() throw()
2021 // XInterface
2022 Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
2024 if( rType == cppu::UnoType<drawing::XMasterPageTarget>::get() )
2026 return makeAny( Reference< drawing::XMasterPageTarget >( this ) );
2028 else if( IsImpressDocument()
2029 && rType == cppu::UnoType<presentation::XPresentationPage>::get() )
2031 SdPage * p = dynamic_cast<SdPage *>(SvxDrawPage::mpPage);
2032 if( p == nullptr || p->GetPageKind() != PageKind::Handout )
2034 return makeAny( Reference< presentation::XPresentationPage >( this ) );
2038 return SdGenericDrawPage::queryInterface( rType );
2041 void SAL_CALL SdDrawPage::acquire() throw()
2043 SvxDrawPage::acquire();
2046 void SAL_CALL SdDrawPage::release() throw()
2048 SvxDrawPage::release();
2051 UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage, SdGenericDrawPage );
2053 // XTypeProvider
2054 Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes()
2056 ::SolarMutexGuard aGuard;
2058 throwIfDisposed();
2060 if( !maTypeSequence.hasElements() )
2062 const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PageKind::Standard;
2063 bool bPresPage = IsImpressDocument() && ePageKind != PageKind::Handout;
2065 // Collect the types of this class.
2066 ::std::vector<uno::Type> aTypes;
2067 aTypes.reserve(13);
2068 aTypes.push_back(cppu::UnoType<drawing::XDrawPage>::get());
2069 aTypes.push_back(cppu::UnoType<beans::XPropertySet>::get());
2070 aTypes.push_back(cppu::UnoType<container::XNamed>::get());
2071 aTypes.push_back(cppu::UnoType<drawing::XMasterPageTarget>::get());
2072 aTypes.push_back(cppu::UnoType<lang::XServiceInfo>::get());
2073 aTypes.push_back(cppu::UnoType<util::XReplaceable>::get());
2074 aTypes.push_back(cppu::UnoType<document::XLinkTargetSupplier>::get());
2075 aTypes.push_back(cppu::UnoType<drawing::XShapeCombiner>::get());
2076 aTypes.push_back(cppu::UnoType<drawing::XShapeBinder>::get());
2077 aTypes.push_back(cppu::UnoType<office::XAnnotationAccess>::get());
2078 aTypes.push_back(cppu::UnoType<beans::XMultiPropertySet>::get());
2079 if( bPresPage )
2080 aTypes.push_back(cppu::UnoType<presentation::XPresentationPage>::get());
2081 if( bPresPage && ePageKind == PageKind::Standard )
2082 aTypes.push_back(cppu::UnoType<XAnimationNodeSupplier>::get());
2084 // Get types of base class.
2085 // Join those types in a sequence.
2086 return comphelper::concatSequences(
2087 comphelper::containerToSequence(aTypes),
2088 SdGenericDrawPage::getTypes() );
2091 return maTypeSequence;
2094 Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId()
2096 return css::uno::Sequence<sal_Int8>();
2099 OUString SdDrawPage::getPageApiName( SdPage const * pPage )
2101 return ::getPageApiName( pPage );
2104 OUString getPageApiName( SdPage const * pPage )
2106 OUString aPageName;
2108 if(pPage)
2110 aPageName = pPage->GetRealName();
2112 if( aPageName.isEmpty() )
2114 OUStringBuffer sBuffer;
2115 sBuffer.append( sEmptyPageName );
2116 const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1;
2117 sBuffer.append( nPageNum );
2118 aPageName = sBuffer.makeStringAndClear();
2122 return aPageName;
2125 OUString getPageApiNameFromUiName( const OUString& rUIName )
2127 OUString aApiName;
2129 OUString aDefPageName(SdResId(STR_PAGE) + " ");
2131 if( rUIName.startsWith( aDefPageName ) )
2133 aApiName = sEmptyPageName;
2134 aApiName += rUIName.copy( aDefPageName.getLength() );
2136 else
2138 aApiName = rUIName;
2141 return aApiName;
2144 OUString SdDrawPage::getPageApiNameFromUiName( const OUString& rUIName )
2146 return ::getPageApiNameFromUiName( rUIName );
2149 OUString getUiNameFromPageApiNameImpl( const OUString& rApiName )
2151 const OUString aDefPageName( sEmptyPageName );
2152 if( rApiName.startsWith( aDefPageName ) )
2154 OUString aNumber( rApiName.copy( aDefPageName.getLength() ) );
2156 // create the page number
2157 sal_Int32 nPageNumber = aNumber.toInt32();
2159 // check if there are non number characters in the number part
2160 const sal_Int32 nChars = aNumber.getLength();
2161 const sal_Unicode* pString = aNumber.getStr();
2162 sal_Int32 nChar;
2163 for( nChar = 0; nChar < nChars; nChar++, pString++ )
2165 if((*pString < '0') || (*pString > '9'))
2167 // found a non number character, so this is not the default
2168 // name for this page
2169 nPageNumber = -1;
2170 break;
2174 if( nPageNumber != -1)
2176 OUStringBuffer sBuffer;
2177 sBuffer.append( SdResId(STR_PAGE) );
2178 sBuffer.append( ' ' );
2179 sBuffer.append( aNumber );
2180 return sBuffer.makeStringAndClear();
2184 return rApiName;
2187 OUString SdDrawPage::getUiNameFromPageApiName( const OUString& rApiName )
2189 return getUiNameFromPageApiNameImpl( rApiName );
2192 // XServiceInfo
2193 OUString SAL_CALL SdDrawPage::getImplementationName()
2195 return OUString( "SdDrawPage" );
2198 Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames()
2200 ::SolarMutexGuard aGuard;
2202 throwIfDisposed();
2204 Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2205 comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.DrawPage"} );
2207 if( IsImpressDocument() )
2208 comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.DrawPage"} );
2210 return aSeq;
2213 sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName )
2215 return cppu::supportsService( this, ServiceName );
2218 // XNamed
2219 void SAL_CALL SdDrawPage::setName( const OUString& rName )
2221 ::SolarMutexGuard aGuard;
2223 throwIfDisposed();
2225 DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
2227 OUString aName( rName );
2229 if(!(GetPage() && GetPage()->GetPageKind() != PageKind::Notes))
2230 return;
2232 // check if this is the default 'page1234' name
2233 if(aName.startsWith( sEmptyPageName ))
2235 // ok, it maybe is, first get the number part after 'page'
2236 OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) );
2238 // create the page number
2239 sal_Int32 nPageNumber = aNumber.toInt32();
2241 // check if there are non number characters in the number part
2242 const sal_Int32 nChars = aNumber.getLength();
2243 const sal_Unicode* pString = aNumber.getStr();
2244 sal_Int32 nChar;
2245 for( nChar = 0; nChar < nChars; nChar++, pString++ )
2247 if((*pString < '0') || (*pString > '9'))
2249 // found a non number character, so this is not the default
2250 // name for this page
2251 nPageNumber = -1;
2252 break;
2256 if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
2257 aName.clear();
2259 else
2261 OUString aDefaultPageName( SdResId(STR_PAGE) + " " );
2262 if( aName.startsWith( aDefaultPageName ) )
2263 aName.clear();
2266 GetPage()->SetName( aName );
2268 sal_uInt16 nNotesPageNum = (GetPage()->GetPageNum()-1)>>1;
2269 if( GetModel()->GetDoc()->GetSdPageCount( PageKind::Notes ) > nNotesPageNum )
2271 SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PageKind::Notes );
2272 if( pNotesPage )
2273 pNotesPage->SetName(aName);
2276 // fake a mode change to repaint the page tab bar
2277 ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
2278 ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr;
2279 if( auto pDrawViewSh = dynamic_cast<::sd::DrawViewShell* >(pViewSh) )
2281 EditMode eMode = pDrawViewSh->GetEditMode();
2282 if( eMode == EditMode::Page )
2284 bool bLayer = pDrawViewSh->IsLayerModeActive();
2286 pDrawViewSh->ChangeEditMode( eMode, !bLayer );
2287 pDrawViewSh->ChangeEditMode( eMode, bLayer );
2291 GetModel()->SetModified();
2294 OUString SAL_CALL SdDrawPage::getName()
2296 ::SolarMutexGuard aGuard;
2298 throwIfDisposed();
2300 return getPageApiName( GetPage() );
2303 // XMasterPageTarget
2304 Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getMasterPage( )
2306 ::SolarMutexGuard aGuard;
2308 throwIfDisposed();
2310 if(GetPage())
2312 Reference< drawing::XDrawPage > xPage;
2314 if(SvxFmDrawPage::mpPage->TRG_HasMasterPage())
2316 SdrPage& rMasterPage = SvxFmDrawPage::mpPage->TRG_GetMasterPage();
2317 xPage.set( rMasterPage.getUnoPage(), uno::UNO_QUERY );
2320 return xPage;
2322 return nullptr;
2325 void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& xMasterPage )
2327 ::SolarMutexGuard aGuard;
2328 comphelper::ProfileZone aZone("setMasterPage");
2330 throwIfDisposed();
2332 if(!SvxFmDrawPage::mpPage)
2333 return;
2335 SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage );
2336 if( !(pMasterPage && pMasterPage->isValid()) )
2337 return;
2339 SvxFmDrawPage::mpPage->TRG_ClearMasterPage();
2341 SdPage* pSdPage = static_cast<SdPage*>(pMasterPage->GetSdrPage());
2342 SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage);
2344 SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLeftBorder(),pSdPage->GetUpperBorder(),
2345 pSdPage->GetRightBorder(),pSdPage->GetLowerBorder() );
2347 SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() );
2348 SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() );
2349 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetLayoutName( pSdPage->GetLayoutName() );
2351 // set notes master also
2352 SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PageKind::Notes );
2354 pNotesPage->TRG_ClearMasterPage();
2355 sal_uInt16 nNum = SvxFmDrawPage::mpPage->TRG_GetMasterPage().GetPageNum() + 1;
2356 pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->getSdrModelFromSdrPage().GetMasterPage(nNum));
2357 pNotesPage->SetLayoutName( pSdPage->GetLayoutName() );
2359 GetModel()->SetModified();
2362 // XPresentationPage
2363 Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getNotesPage()
2365 ::SolarMutexGuard aGuard;
2367 throwIfDisposed();
2369 if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() && SvxFmDrawPage::mpPage->GetPageNum() )
2371 SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PageKind::Notes );
2372 if( pNotesPage )
2374 Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
2375 return xPage;
2378 return nullptr;
2381 // XIndexAccess
2382 sal_Int32 SAL_CALL SdDrawPage::getCount()
2384 return SdGenericDrawPage::getCount();
2387 Any SAL_CALL SdDrawPage::getByIndex( sal_Int32 Index )
2389 return SdGenericDrawPage::getByIndex( Index );
2392 // XElementAccess
2393 uno::Type SAL_CALL SdDrawPage::getElementType()
2395 return SdGenericDrawPage::getElementType();
2398 sal_Bool SAL_CALL SdDrawPage::hasElements()
2400 return SdGenericDrawPage::hasElements();
2403 // XShapes
2404 void SAL_CALL SdDrawPage::add( const Reference< drawing::XShape >& xShape )
2406 SdGenericDrawPage::add( xShape );
2409 void SAL_CALL SdDrawPage::remove( const Reference< drawing::XShape >& xShape )
2411 ::SolarMutexGuard aGuard;
2413 throwIfDisposed();
2415 SvxShape* pShape = SvxShape::getImplementation( xShape );
2416 if( pShape )
2418 SdrObject* pObj = pShape->GetSdrObject();
2419 if( pObj )
2421 GetPage()->RemovePresObj(pObj);
2422 pObj->SetUserCall(nullptr);
2426 SdGenericDrawPage::remove( xShape );
2429 void SdDrawPage::setBackground( const Any& rValue )
2431 Reference< beans::XPropertySet > xSet;
2433 if( !(rValue >>= xSet) && !rValue.hasValue() )
2434 throw lang::IllegalArgumentException();
2436 if( !xSet.is() )
2438 // the easy case, no background set. Set drawing::FillStyle_NONE to represent this
2439 GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE));
2440 return;
2443 // is it our own implementation?
2444 SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet );
2446 SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{} );
2448 if( pBack )
2450 pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
2452 else
2454 SdUnoPageBackground* pBackground = new SdUnoPageBackground();
2456 Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
2457 Reference< beans::XPropertySet > xDestSet( static_cast<beans::XPropertySet*>(pBackground) );
2458 Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() );
2460 Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() );
2461 sal_Int32 nCount = aProperties.getLength();
2462 beans::Property* pProp = aProperties.getArray();
2464 while( nCount-- )
2466 const OUString aPropName( pProp->Name );
2467 if( xSetInfo->hasPropertyByName( aPropName ) )
2468 xDestSet->setPropertyValue( aPropName,
2469 xSet->getPropertyValue( aPropName ) );
2471 pProp++;
2474 pBackground->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
2477 if( aSet.Count() == 0 )
2479 // no background fill, represent by setting drawing::FillStyle_NONE
2480 GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE));
2482 else
2484 // background fill, set at page (not sure if ClearItem is needed)
2485 GetPage()->getSdrPageProperties().ClearItem();
2486 GetPage()->getSdrPageProperties().PutItemSet(aSet);
2489 // repaint only
2490 SvxFmDrawPage::mpPage->ActionChanged();
2493 // XAnnotationAccess:
2494 Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation()
2496 if( !GetPage() )
2497 throw DisposedException();
2499 Reference< XAnnotation > xRet;
2500 GetPage()->createAnnotation(xRet);
2501 return xRet;
2504 void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation)
2506 GetPage()->removeAnnotation(annotation);
2509 Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration()
2511 return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() );
2514 void SdDrawPage::getBackground(Any& rValue)
2516 const SfxItemSet& rFillAttributes = GetPage()->getSdrPageProperties().GetItemSet();
2518 if(drawing::FillStyle_NONE == rFillAttributes.Get(XATTR_FILLSTYLE).GetValue())
2520 // no fill set (switched off by drawing::FillStyle_NONE), clear rValue to represent this
2521 rValue.clear();
2523 else
2525 // there is a fill set, export to rValue
2526 Reference< beans::XPropertySet > xSet(new SdUnoPageBackground(
2527 GetModel()->GetDoc(),
2528 &GetPage()->getSdrPageProperties().GetItemSet()));
2529 rValue <<= xSet;
2533 void SdGenericDrawPage::setNavigationOrder( const Any& rValue )
2535 Reference< XIndexAccess > xIA( rValue, UNO_QUERY );
2536 if( xIA.is() )
2538 if( dynamic_cast< SdDrawPage* >( xIA.get() ) == this )
2540 if( GetPage()->HasObjectNavigationOrder() )
2541 GetPage()->ClearObjectNavigationOrder();
2543 return;
2545 else if( static_cast<size_t>(xIA->getCount()) == GetPage()->GetObjCount() )
2547 GetPage()->SetNavigationOrder(xIA);
2548 return;
2551 throw IllegalArgumentException();
2554 class SdNavigationOrderAccess : public ::cppu::WeakImplHelper< XIndexAccess >
2556 public:
2557 explicit SdNavigationOrderAccess(SdrPage const * pPage);
2559 // XIndexAccess
2560 virtual sal_Int32 SAL_CALL getCount( ) override;
2561 virtual Any SAL_CALL getByIndex( sal_Int32 Index ) override;
2563 // XElementAccess
2564 virtual Type SAL_CALL getElementType( ) override;
2565 virtual sal_Bool SAL_CALL hasElements( ) override;
2567 private:
2568 std::vector< Reference< XShape > > maShapes;
2571 SdNavigationOrderAccess::SdNavigationOrderAccess( SdrPage const * pPage )
2572 : maShapes( pPage ? pPage->GetObjCount() : 0 )
2574 if( pPage )
2576 const size_t nCount = pPage->GetObjCount();
2577 for( size_t nIndex = 0; nIndex < nCount; ++nIndex )
2579 SdrObject* pObj = pPage->GetObj( nIndex );
2580 sal_uInt32 nNavPos = pObj->GetNavigationPosition();
2581 DBG_ASSERT( !maShapes[nNavPos].is(), "sd::SdNavigationOrderAccess::SdNavigationOrderAccess(), duplicate navigation positions from core!" );
2582 maShapes[nNavPos].set( pObj->getUnoShape(), UNO_QUERY );
2587 // XIndexAccess
2588 sal_Int32 SAL_CALL SdNavigationOrderAccess::getCount( )
2590 return static_cast< sal_Int32 >( maShapes.size() );
2593 Any SAL_CALL SdNavigationOrderAccess::getByIndex( sal_Int32 Index )
2595 if( (Index < 0) || (Index > getCount()) )
2596 throw IndexOutOfBoundsException();
2598 return Any( maShapes[Index] );
2601 // XElementAccess
2602 Type SAL_CALL SdNavigationOrderAccess::getElementType( )
2604 return cppu::UnoType<XShape>::get();
2607 sal_Bool SAL_CALL SdNavigationOrderAccess::hasElements( )
2609 return !maShapes.empty();
2612 Any SdGenericDrawPage::getNavigationOrder()
2614 if( GetPage()->HasObjectNavigationOrder() )
2616 return Any( Reference< XIndexAccess >( new SdNavigationOrderAccess( GetPage() ) ) );
2618 else
2620 return Any( Reference< XIndexAccess >( this ) );
2624 // class SdMasterPage
2625 SdMasterPage::SdMasterPage(SdXImpressDocument* pModel, SdPage* pPage)
2626 : SdGenericDrawPage(pModel, pPage, ImplGetMasterPagePropertySet(pPage->GetPageKind()))
2630 SdMasterPage::~SdMasterPage() throw()
2634 // XInterface
2635 Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
2637 ::SolarMutexGuard aGuard;
2639 throwIfDisposed();
2641 uno::Any aAny;
2643 if( rType == cppu::UnoType<container::XIndexAccess>::get() )
2644 aAny <<= Reference< container::XIndexAccess >(static_cast<presentation::XPresentationPage*>(this));
2645 else if( rType == cppu::UnoType<container::XElementAccess>::get() )
2646 aAny <<= Reference< container::XElementAccess >(static_cast<presentation::XPresentationPage*>(this));
2647 else if( rType == cppu::UnoType<container::XNamed>::get() )
2648 aAny <<= Reference< container::XNamed >(this);
2649 else if( rType == cppu::UnoType<presentation::XPresentationPage>::get() &&
2650 ( IsImpressDocument() &&
2651 GetPage() && GetPage()->GetPageKind() != PageKind::Handout) )
2652 aAny <<= Reference< presentation::XPresentationPage >( this );
2653 else
2654 return SdGenericDrawPage::queryInterface( rType );
2656 return aAny;
2659 void SAL_CALL SdMasterPage::acquire() throw()
2661 SvxDrawPage::acquire();
2664 void SAL_CALL SdMasterPage::release() throw()
2666 SvxDrawPage::release();
2669 UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage, SdGenericDrawPage );
2671 // XTypeProvider
2672 Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes()
2674 ::SolarMutexGuard aGuard;
2676 throwIfDisposed();
2678 if( !maTypeSequence.hasElements() )
2680 const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PageKind::Standard;
2681 bool bPresPage = IsImpressDocument() && SvxFmDrawPage::mpPage && ePageKind != PageKind::Handout;
2683 // Collect the types of this class.
2684 ::std::vector<uno::Type> aTypes;
2685 aTypes.reserve(12);
2686 aTypes.push_back(cppu::UnoType<drawing::XDrawPage>::get());
2687 aTypes.push_back(cppu::UnoType<beans::XPropertySet>::get());
2688 aTypes.push_back(cppu::UnoType<container::XNamed>::get());
2689 aTypes.push_back(cppu::UnoType<lang::XServiceInfo>::get());
2690 aTypes.push_back(cppu::UnoType<util::XReplaceable>::get());
2691 aTypes.push_back(cppu::UnoType<document::XLinkTargetSupplier>::get());
2692 aTypes.push_back(cppu::UnoType<drawing::XShapeCombiner>::get());
2693 aTypes.push_back(cppu::UnoType<drawing::XShapeBinder>::get());
2694 aTypes.push_back(cppu::UnoType<office::XAnnotationAccess>::get());
2695 aTypes.push_back(cppu::UnoType<beans::XMultiPropertySet>::get());
2696 if( bPresPage )
2697 aTypes.push_back(cppu::UnoType<presentation::XPresentationPage>::get());
2698 if( bPresPage && ePageKind == PageKind::Standard )
2699 aTypes.push_back(cppu::UnoType<XAnimationNodeSupplier>::get());
2701 // Get types of base class.
2702 // Join those types in a sequence.
2703 return comphelper::concatSequences(
2704 comphelper::containerToSequence(aTypes),
2705 SdGenericDrawPage::getTypes() );
2708 return maTypeSequence;
2711 Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId()
2713 return css::uno::Sequence<sal_Int8>();
2716 // XServiceInfo
2717 OUString SAL_CALL SdMasterPage::getImplementationName()
2719 return OUString( "SdMasterPage" );
2722 Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames()
2724 ::SolarMutexGuard aGuard;
2726 throwIfDisposed();
2728 Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2729 comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.MasterPage"} );
2731 if( SvxFmDrawPage::mpPage && static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetPageKind() == PageKind::Handout )
2732 comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.HandoutMasterPage"} );
2734 return aSeq;
2737 sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName )
2739 return cppu::supportsService( this, ServiceName );
2742 // XElementAccess
2743 sal_Bool SAL_CALL SdMasterPage::hasElements()
2745 ::SolarMutexGuard aGuard;
2747 throwIfDisposed();
2749 if( SvxFmDrawPage::mpPage == nullptr )
2750 return false;
2752 return SvxFmDrawPage::mpPage->GetObjCount() > 0;
2755 uno::Type SAL_CALL SdMasterPage::getElementType()
2757 return SdGenericDrawPage::getElementType();
2760 // XIndexAccess
2761 sal_Int32 SAL_CALL SdMasterPage::getCount()
2763 ::SolarMutexGuard aGuard;
2765 throwIfDisposed();
2767 return SdGenericDrawPage::getCount();
2770 Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
2772 ::SolarMutexGuard aGuard;
2774 throwIfDisposed();
2776 return SdGenericDrawPage::getByIndex(Index);
2779 // intern
2780 void SdMasterPage::setBackground( const Any& rValue )
2782 // we need at least an beans::XPropertySet
2783 Reference< beans::XPropertySet > xInputSet( rValue, UNO_QUERY );
2784 if( !xInputSet.is() )
2785 throw lang::IllegalArgumentException();
2789 if( GetModel() && IsImpressDocument() )
2791 Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_SET_THROW );
2792 Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ;
2793 OUString aStyleName(sUNO_PseudoSheet_Background);
2795 Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
2797 Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_SET_THROW );
2798 Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY );
2800 PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries();
2801 for( const auto& rProp : aBackgroundProperties )
2803 if( xSetInfo->hasPropertyByName( rProp.sName ) )
2805 if( !xSetStates.is() || xSetStates->getPropertyState( rProp.sName ) == beans::PropertyState_DIRECT_VALUE )
2806 xStyleSet->setPropertyValue( rProp.sName, xInputSet->getPropertyValue( rProp.sName ) );
2807 else
2808 xSetStates->setPropertyToDefault( rProp.sName );
2812 else
2814 // first fill an item set
2815 // is it our own implementation?
2816 SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xInputSet );
2818 SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{} );
2820 if( pBack )
2822 pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
2824 else
2826 SdUnoPageBackground* pBackground = new SdUnoPageBackground();
2828 Reference< beans::XPropertySetInfo > xInputSetInfo( xInputSet->getPropertySetInfo(), UNO_SET_THROW );
2829 Reference< beans::XPropertySet > xDestSet( static_cast<beans::XPropertySet*>(pBackground) );
2830 Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_SET_THROW );
2832 uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() );
2833 sal_Int32 nCount = aProperties.getLength();
2834 beans::Property* pProp = aProperties.getArray();
2836 while( nCount-- )
2838 const OUString aPropName( pProp->Name );
2839 if( xInputSetInfo->hasPropertyByName( aPropName ) )
2840 xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) );
2842 pProp++;
2845 pBackground->fillItemSet( static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()), aSet );
2848 // if we find the background style, copy the set to the background
2849 SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage());
2850 SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
2851 if(pSSPool)
2853 OUString aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
2854 aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4);
2855 aLayoutName += STR_LAYOUT_BACKGROUND;
2856 SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
2858 if( pStyleSheet )
2860 pStyleSheet->GetItemSet().Put( aSet );
2862 // repaint only
2863 SvxFmDrawPage::mpPage->ActionChanged();
2864 return;
2868 // if no background style is available, set at page directly. This
2869 // is an error and should NOT happen (and will be asserted from the SdrPage)
2870 GetPage()->getSdrPageProperties().PutItemSet(aSet);
2873 catch( Exception& )
2875 OSL_FAIL("sd::SdMasterPage::setBackground(), exception caught!");
2879 void SdMasterPage::getBackground( Any& rValue )
2881 if( !GetModel() )
2882 return;
2886 if( IsImpressDocument() )
2888 Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_SET_THROW );
2889 Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW );
2891 const OUString aStyleName(sUNO_PseudoSheet_Background);
2892 rValue <<= Reference< beans::XPropertySet >( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
2894 else
2896 SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage());
2897 SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
2898 if(pSSPool)
2900 OUString aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
2901 aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4);
2902 aLayoutName += STR_LAYOUT_BACKGROUND;
2903 SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
2905 if( pStyleSheet )
2907 SfxItemSet aStyleSet( pStyleSheet->GetItemSet());
2908 if( aStyleSet.Count() )
2910 rValue <<= Reference< beans::XPropertySet >( new SdUnoPageBackground( pDoc, &aStyleSet ) );
2911 return;
2916 // No style found, use fill attributes from page background. This
2917 // should NOT happen and is an error
2918 const SfxItemSet& rFallbackItemSet(SvxFmDrawPage::mpPage->getSdrPageProperties().GetItemSet());
2920 if(drawing::FillStyle_NONE == rFallbackItemSet.Get(XATTR_FILLSTYLE).GetValue())
2922 rValue <<= Reference< beans::XPropertySet >(
2923 new SdUnoPageBackground(GetModel()->GetDoc(), &rFallbackItemSet));
2925 else
2927 rValue.clear();
2931 catch( Exception& )
2933 rValue.clear();
2934 OSL_FAIL("sd::SdMasterPage::getBackground(), exception caught!");
2938 // XNamed
2939 void SAL_CALL SdMasterPage::setName( const OUString& rName )
2941 ::SolarMutexGuard aGuard;
2943 throwIfDisposed();
2945 if(!(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PageKind::Notes))
2946 return;
2948 SdDrawDocument* pDoc = GetModel()->GetDoc();
2949 bool bOutDummy;
2951 // Slide Name has to be unique
2952 if( pDoc && pDoc->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND )
2953 return; // throw Exception ?
2955 GetPage()->SetName( rName );
2957 if( pDoc )
2958 pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), rName );
2960 // fake a mode change to repaint the page tab bar
2961 ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
2962 ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : nullptr;
2963 if( auto pDrawViewSh = dynamic_cast< ::sd::DrawViewShell* >(pViewSh) )
2965 EditMode eMode = pDrawViewSh->GetEditMode();
2966 if( eMode == EditMode::MasterPage )
2968 bool bLayer = pDrawViewSh->IsLayerModeActive();
2970 pDrawViewSh->ChangeEditMode( eMode, !bLayer );
2971 pDrawViewSh->ChangeEditMode( eMode, bLayer );
2975 GetModel()->SetModified();
2978 OUString SAL_CALL SdMasterPage::getName( )
2980 ::SolarMutexGuard aGuard;
2982 throwIfDisposed();
2984 if(SvxFmDrawPage::mpPage)
2986 OUString aLayoutName( GetPage()->GetLayoutName() );
2987 return aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR));
2990 return OUString();
2993 // XPresentationPage
2994 Reference< drawing::XDrawPage > SAL_CALL SdMasterPage::getNotesPage()
2996 ::SolarMutexGuard aGuard;
2998 throwIfDisposed();
3000 if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() )
3002 SdPage* pNotesPage = GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PageKind::Notes );
3003 if( pNotesPage )
3005 Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
3006 return xPage;
3009 return nullptr;
3012 // XShapes
3013 void SAL_CALL SdMasterPage::add( const Reference< drawing::XShape >& xShape )
3015 SdGenericDrawPage::add( xShape );
3018 void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape )
3020 ::SolarMutexGuard aGuard;
3022 throwIfDisposed();
3024 SvxShape* pShape = SvxShape::getImplementation( xShape );
3025 if( pShape )
3027 SdrObject* pObj = pShape->GetSdrObject();
3028 if( pObj && GetPage()->IsPresObj( pObj ) )
3029 GetPage()->RemovePresObj(pObj);
3032 SdGenericDrawPage::remove( xShape );
3035 Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
3037 Reference< uno::XInterface > xPage;
3039 if( pPage )
3041 SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->getSdrModelFromSdrPage().getUnoModel() );
3042 if( pModel )
3044 if( pPage->IsMasterPage() )
3046 xPage = static_cast<cppu::OWeakObject*>(new SdMasterPage( pModel, pPage ));
3048 else
3050 xPage = static_cast<cppu::OWeakObject*>(new SdDrawPage( pModel, pPage ));
3055 return xPage;
3058 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */