1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
46 #include <unoprnms.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>
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>
62 #include <DrawDocShell.hxx>
63 #include <ViewShell.hxx>
64 #include <DrawViewShell.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
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;
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
;
230 if(bWithoutBackground
)
232 static SvxItemPropertySet
aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl
, SdrObject::GetGlobalDrawObjectItemPool() );
233 pRet
= &aDrawPageNotesHandoutPropertyNoBackSet_Impl
;
237 static SvxItemPropertySet
aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl
, SdrObject::GetGlobalDrawObjectItemPool() );
238 pRet
= &aDrawPageNotesHandoutPropertySet_Impl
;
244 if(bWithoutBackground
)
246 static SvxItemPropertySet
aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl
, SdrObject::GetGlobalDrawObjectItemPool() );
247 pRet
= &aGraphicPagePropertyNoBackSet_Impl
;
251 static SvxItemPropertySet
aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl
, SdrObject::GetGlobalDrawObjectItemPool() );
252 pRet
= &aGraphicPagePropertySet_Impl
;
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
;
313 static SvxItemPropertySet
aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl
, SdrObject::GetGlobalDrawObjectItemPool() );
314 pRet
= &aMasterPagePropertySet_Impl
;
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));
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
),
347 mbIsImpressDocument(false),
351 mpSdrModel
= SvxFmDrawPage::mpModel
;
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();
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
;
387 uno::Reference
< uno::XInterface
> xModel( SvxFmDrawPage::mpModel
->getUnoModel() );
388 mpDocModel
= SdXImpressDocument::getImplementation( xModel
);
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() )
403 OUString
aType( xShape
->getShapeType() );
404 const OUString
aPrefix( "com.sun.star.presentation." );
405 if( !aType
.startsWith( aPrefix
) )
407 SdrObject
* pObj
= SvxFmDrawPage::CreateSdrObject_( xShape
);
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
;
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
);
501 SdDrawDocument
& rDoc(static_cast< SdDrawDocument
& >(GetPage()->getSdrModelFromSdrPage()));
502 pPresObj
->NbcSetStyleSheet(rDoc
.GetDefaultStyleSheet(), true);
503 GetPage()->InsertPresObj( pPresObj
, eObjKind
);
508 pPresObj
= GetPage()->CreatePresObj( eObjKind
, false, aRect
);
512 pPresObj
->SetUserCall( GetPage() );
518 Any SAL_CALL
SdGenericDrawPage::queryInterface( const uno::Type
& rType
)
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 ) );
566 return SvxDrawPage::queryInterface( rType
);
572 Reference
< beans::XPropertySetInfo
> SAL_CALL
SdGenericDrawPage::getPropertySetInfo()
574 ::SolarMutexGuard aGuard
;
576 return mpPropSet
->getPropertySetInfo();
579 void SAL_CALL
SdGenericDrawPage::setPropertyValue( const OUString
& aPropertyName
, const Any
& aValue
)
581 ::SolarMutexGuard aGuard
;
585 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
587 switch( pEntry
? pEntry
->nWID
: -1 )
590 setNavigationOrder( aValue
);
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
)
607 SetLeftBorder(nValue
);
610 SetRightBorder( nValue
);
613 SetUpperBorder( nValue
);
615 case WID_PAGE_BOTTOM
:
616 SetLowerBorder( nValue
);
618 case WID_PAGE_CHANGE
:
619 GetPage()->SetPresChange( static_cast<PresChange
>(nValue
) );
621 case WID_PAGE_LAYOUT
:
622 GetPage()->SetAutoLayout( static_cast<AutoLayout
>(nValue
), true );
624 case WID_PAGE_DURATION
:
625 GetPage()->SetTime(nValue
);
630 case WID_PAGE_HIGHRESDURATION
:
633 if(!(aValue
>>= fValue
))
634 throw lang::IllegalArgumentException();
636 GetPage()->SetTime(fValue
);
641 sal_Int32 nWidth
= 0;
642 if(!(aValue
>>= nWidth
))
643 throw lang::IllegalArgumentException();
648 case WID_PAGE_HEIGHT
:
650 sal_Int32 nHeight
= 0;
651 if(!(aValue
>>= nHeight
))
652 throw lang::IllegalArgumentException();
654 SetHeight( nHeight
);
657 case WID_PAGE_ORIENT
:
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
);
687 case WID_PAGE_EFFECT
:
690 if(!::cppu::enum2int( nEnum
, aValue
))
691 throw lang::IllegalArgumentException();
693 GetPage()->SetFadeEffect( static_cast<presentation::FadeEffect
>(nEnum
) );
697 setBackground( aValue
);
702 if(!::cppu::enum2int( nEnum
, aValue
))
703 throw lang::IllegalArgumentException();
705 GetPage()->setTransitionDuration( nEnum
== 0 ? 3.0 : (nEnum
== 1 ? 2.0 : 1.0 ) );
708 case WID_PAGE_VISIBLE
:
710 bool bVisible
= false;
711 if( ! ( aValue
>>= bVisible
) )
712 throw lang::IllegalArgumentException();
713 GetPage()->SetExcluded( !bVisible
);
716 case WID_PAGE_SOUNDFILE
:
719 if( aValue
>>= aURL
)
721 GetPage()->SetSoundFile( aURL
);
722 GetPage()->SetSound( !aURL
.isEmpty() );
727 bool bStopSound
= false;
728 if( aValue
>>= bStopSound
)
730 GetPage()->SetStopSound( bStopSound
);
735 throw lang::IllegalArgumentException();
740 if( ! (aValue
>>= bLoop
) )
741 throw lang::IllegalArgumentException();
743 GetPage()->SetLoopSound( bLoop
);
746 case WID_PAGE_BACKFULL
:
748 bool bFullSize
= false;
749 if( ! ( aValue
>>= bFullSize
) )
750 throw lang::IllegalArgumentException();
751 GetPage()->SetBackgroundFullSize( bFullSize
);
754 case WID_PAGE_BACKVIS
:
756 bool bVisible
= false;
757 if( ! ( aValue
>>= bVisible
) )
758 throw lang::IllegalArgumentException();
760 SdrPage
* pPage
= GetPage();
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
);
774 case WID_PAGE_BACKOBJVIS
:
776 bool bVisible
= false;
777 if( ! ( aValue
>>= bVisible
) )
778 throw lang::IllegalArgumentException();
780 SdrPage
* pPage
= GetPage();
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
);
795 case WID_PAGE_USERATTRIBS
:
797 if( !GetPage()->setAlienAttributes( aValue
) )
798 throw lang::IllegalArgumentException();
801 case WID_PAGE_BOOKMARK
:
803 OUString aBookmarkURL
;
804 if( ! ( aValue
>>= aBookmarkURL
) )
805 throw lang::IllegalArgumentException();
807 setBookmarkURL( aBookmarkURL
);
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
;
834 case WID_PAGE_HEADERTEXT
:
837 if( ! ( aValue
>>= aText
) )
838 throw lang::IllegalArgumentException();
840 aHeaderFooterSettings
.maHeaderText
= aText
;
843 case WID_PAGE_FOOTERVISIBLE
:
845 bool bVisible
= false;
846 if( ! ( aValue
>>= bVisible
) )
847 throw lang::IllegalArgumentException();
849 aHeaderFooterSettings
.mbFooterVisible
= bVisible
;
852 case WID_PAGE_FOOTERTEXT
:
855 if( ! ( aValue
>>= aText
) )
856 throw lang::IllegalArgumentException();
858 aHeaderFooterSettings
.maFooterText
= aText
;
861 case WID_PAGE_PAGENUMBERVISIBLE
:
863 bool bVisible
= false;
864 if( ! ( aValue
>>= bVisible
) )
865 throw lang::IllegalArgumentException();
867 aHeaderFooterSettings
.mbSlideNumberVisible
= bVisible
;
870 case WID_PAGE_DATETIMEVISIBLE
:
872 bool bVisible
= false;
873 if( ! ( aValue
>>= bVisible
) )
874 throw lang::IllegalArgumentException();
876 aHeaderFooterSettings
.mbDateTimeVisible
= bVisible
;
879 case WID_PAGE_DATETIMEFIXED
:
881 bool bVisible
= false;
882 if( ! ( aValue
>>= bVisible
) )
883 throw lang::IllegalArgumentException();
885 aHeaderFooterSettings
.mbDateTimeIsFixed
= bVisible
;
888 case WID_PAGE_DATETIMETEXT
:
891 if( ! ( aValue
>>= aText
) )
892 throw lang::IllegalArgumentException();
894 aHeaderFooterSettings
.maDateTimeText
= aText
;
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);
909 if( !(aHeaderFooterSettings
== GetPage()->getHeaderFooterSettings()) )
910 GetPage()->setHeaderFooterSettings( aHeaderFooterSettings
);
915 case WID_PAGE_NUMBER
:
916 if( (GetPage()->GetPageKind() == PageKind::Handout
) && !GetPage()->IsMasterPage() )
918 if( !(aValue
>>= mnTempPageNumber
) )
919 throw lang::IllegalArgumentException();
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
);
940 case WID_TRANSITION_SUBTYPE
:
942 sal_Int16 nValue
= 0;
943 if( ! ( aValue
>>= nValue
) )
944 throw lang::IllegalArgumentException();
946 GetPage()->setTransitionSubtype( nValue
);
950 case WID_TRANSITION_DIRECTION
:
953 if( ! ( aValue
>>= bValue
) )
954 throw lang::IllegalArgumentException();
956 GetPage()->setTransitionDirection( bValue
);
960 case WID_TRANSITION_FADE_COLOR
:
962 sal_Int32 nValue
= 0;
963 if( ! ( aValue
>>= nValue
) )
964 throw lang::IllegalArgumentException();
966 GetPage()->setTransitionFadeColor( nValue
);
970 case WID_TRANSITION_DURATION
:
973 if( ! ( aValue
>>= fValue
) )
974 throw lang::IllegalArgumentException();
976 GetPage()->setTransitionDuration( fValue
);
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
;
995 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(PropertyName
);
997 sal_Int16 nEntry
= pEntry
? pEntry
->nWID
: -1;
1001 aAny
= getNavigationOrder();
1004 aAny
<<= GetPage()->GetLeftBorder();
1006 case WID_PAGE_RIGHT
:
1007 aAny
<<= GetPage()->GetRightBorder();
1010 aAny
<<= GetPage()->GetUpperBorder();
1012 case WID_PAGE_BOTTOM
:
1013 aAny
<<= GetPage()->GetLowerBorder();
1015 case WID_PAGE_WIDTH
:
1016 aAny
<<= static_cast<sal_Int32
>( GetPage()->GetSize().getWidth() );
1018 case WID_PAGE_HEIGHT
:
1019 aAny
<<= static_cast<sal_Int32
>( GetPage()->GetSize().getHeight() );
1021 case WID_PAGE_ORIENT
:
1023 GetPage()->GetOrientation() == Orientation::Portrait
1024 ? view::PaperOrientation_PORTRAIT
1025 : view::PaperOrientation_LANDSCAPE
;
1027 case WID_PAGE_EFFECT
:
1028 aAny
<<= GetPage()->GetFadeEffect();
1030 case WID_PAGE_CHANGE
:
1031 aAny
<<= static_cast<sal_Int32
>( GetPage()->GetPresChange() );
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);
1040 case WID_PAGE_LAYOUT
:
1041 aAny
<<= static_cast<sal_Int16
>( GetPage()->GetAutoLayout() );
1043 case WID_PAGE_NUMBER
:
1045 const sal_uInt16
nPageNumber(GetPage()->GetPageNum());
1049 // for all other pages calculate the number
1050 aAny
<<= static_cast<sal_Int16
>(static_cast<sal_uInt16
>((nPageNumber
-1)>>1) + 1);
1054 aAny
<<= mnTempPageNumber
;
1058 case WID_PAGE_DURATION
:
1059 aAny
<<= static_cast<sal_Int32
>( GetPage()->GetTime() + .5 );
1061 case WID_PAGE_HIGHRESDURATION
:
1062 aAny
<<= GetPage()->GetTime();
1064 case WID_PAGE_LDNAME
:
1066 const OUString
aName( GetPage()->GetName() );
1070 case WID_PAGE_LDBITMAP
:
1072 Reference
< awt::XBitmap
> xBitmap(VCLUnoHelper::CreateBitmap(BitmapEx(BMP_PAGE
)));
1077 getBackground( aAny
);
1079 case WID_PAGE_PREVIEW
:
1080 case WID_PAGE_PREVIEWMETAFILE
:
1082 SdDrawDocument
& rDoc(static_cast< SdDrawDocument
& >(GetPage()->getSdrModelFromSdrPage()));
1083 ::sd::DrawDocShell
* pDocShell
= rDoc
.GetDocSh();
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
);
1094 std::shared_ptr
<GDIMetaFile
> xMetaFile
= pDocShell
->GetPreviewMetaFile();
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);
1108 // PreviewMetafile: SVM format.
1109 xMetaFile
->Write(aDestStrm
);
1110 Sequence
<sal_Int8
> aSeq( static_cast<sal_Int8
const *>(aDestStrm
.GetData()), aDestStrm
.Tell() );
1117 case WID_PAGE_PREVIEWBITMAP
:
1119 SdDrawDocument
& rDoc(static_cast< SdDrawDocument
& >(GetPage()->getSdrModelFromSdrPage()));
1120 ::sd::DrawDocShell
* pDocShell
= rDoc
.GetDocSh();
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
);
1131 std::shared_ptr
<GDIMetaFile
> xMetaFile
= pDocShell
->GetPreviewMetaFile();
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() );
1144 case WID_PAGE_VISIBLE
:
1146 bool bVisible
= !GetPage()->IsExcluded();
1151 case WID_PAGE_SOUNDFILE
:
1153 if( GetPage()->IsStopSound() )
1160 if( GetPage()->IsSoundOn() )
1161 aURL
= GetPage()->GetSoundFile();
1166 case WID_LOOP_SOUND
:
1168 aAny
<<= GetPage()->IsLoopSound();
1171 case WID_PAGE_BACKFULL
:
1173 bool bFullSize
= GetPage()->IsBackgroundFullSize();
1177 case WID_PAGE_BACKVIS
:
1179 SdrPage
* pPage
= GetPage();
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
));
1196 case WID_PAGE_BACKOBJVIS
:
1198 SdrPage
* pPage
= GetPage();
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
));
1215 case WID_PAGE_USERATTRIBS
:
1217 GetPage()->getAlienAttributes( aAny
);
1220 case WID_PAGE_BOOKMARK
:
1222 aAny
<<= getBookmarkURL();
1225 case WID_PAGE_ISDARK
:
1227 aAny
<<= GetPage()->GetPageBackgroundColor().IsDark();
1230 case WID_PAGE_HEADERVISIBLE
:
1231 aAny
<<= GetPage()->getHeaderFooterSettings().mbHeaderVisible
;
1233 case WID_PAGE_HEADERTEXT
:
1235 const OUString
aText( GetPage()->getHeaderFooterSettings().maHeaderText
);
1239 case WID_PAGE_FOOTERVISIBLE
:
1240 aAny
<<= GetPage()->getHeaderFooterSettings().mbFooterVisible
;
1242 case WID_PAGE_FOOTERTEXT
:
1244 const OUString
aText( GetPage()->getHeaderFooterSettings().maFooterText
);
1248 case WID_PAGE_PAGENUMBERVISIBLE
:
1249 aAny
<<= GetPage()->getHeaderFooterSettings().mbSlideNumberVisible
;
1251 case WID_PAGE_DATETIMEVISIBLE
:
1252 aAny
<<= GetPage()->getHeaderFooterSettings().mbDateTimeVisible
;
1254 case WID_PAGE_DATETIMEFIXED
:
1255 aAny
<<= GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed
;
1257 case WID_PAGE_DATETIMETEXT
:
1259 const OUString
aText( GetPage()->getHeaderFooterSettings().maDateTimeText
);
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);
1271 case WID_TRANSITION_TYPE
:
1272 aAny
<<= GetPage()->getTransitionType();
1275 case WID_TRANSITION_SUBTYPE
:
1276 aAny
<<= GetPage()->getTransitionSubtype();
1279 case WID_TRANSITION_DIRECTION
:
1280 aAny
<<= GetPage()->getTransitionDirection();
1283 case WID_TRANSITION_FADE_COLOR
:
1284 aAny
<<= GetPage()->getTransitionFadeColor();
1287 case WID_TRANSITION_DURATION
:
1288 aAny
<<= GetPage()->getTransitionDuration();
1292 throw beans::UnknownPropertyException( PropertyName
, static_cast<cppu::OWeakObject
*>(this));
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();
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();
1336 aValue
= getPropertyValue( *pNames
++ );
1338 catch( beans::UnknownPropertyException
& )
1340 // ignore for multi property set
1341 // todo: optimize this!
1343 *pValues
++ = aValue
;
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!" );
1366 return Reference
< drawing::XShape
>();
1370 PresObjKind eKind
= GetPage()->GetPresObjKind(pObj
);
1372 SvxShape
* pShape
= nullptr;
1374 if(pObj
->GetObjInventor() == SdrInventor::Default
)
1376 sal_uInt32 nInventor
= pObj
->GetObjIdentifier();
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");
1388 pShape
->SetShapeType("com.sun.star.presentation.TitleTextShape");
1390 eKind
= PRESOBJ_NONE
;
1392 case OBJ_OUTLINETEXT
:
1393 pShape
= new SvxShapeText( pObj
);
1394 pShape
->SetShapeType("com.sun.star.presentation.OutlinerShape");
1395 eKind
= PRESOBJ_NONE
;
1400 Reference
< drawing::XShape
> xShape( pShape
);
1403 xShape
= SvxFmDrawPage::CreateShape( pObj
);
1405 if( eKind
!= PRESOBJ_NONE
)
1407 OUString
aShapeType("com.sun.star.presentation.");
1412 aShapeType
+= "TitleTextShape";
1414 case PRESOBJ_OUTLINE
:
1415 aShapeType
+= "OutlinerShape";
1418 aShapeType
+= "SubtitleShape";
1420 case PRESOBJ_GRAPHIC
:
1421 aShapeType
+= "GraphicObjectShape";
1423 case PRESOBJ_OBJECT
:
1424 aShapeType
+= "OLE2Shape";
1427 aShapeType
+= "ChartShape";
1429 case PRESOBJ_ORGCHART
:
1430 aShapeType
+= "OrgChartShape";
1433 aShapeType
+= "CalcShape";
1436 aShapeType
+= "TableShape";
1439 aShapeType
+= "MediaShape";
1442 aShapeType
+= "PageShape";
1444 case PRESOBJ_HANDOUT
:
1445 aShapeType
+= "HandoutShape";
1448 aShapeType
+= "NotesShape";
1450 case PRESOBJ_FOOTER
:
1451 aShapeType
+= "FooterShape";
1453 case PRESOBJ_HEADER
:
1454 aShapeType
+= "HeaderShape";
1456 case PRESOBJ_SLIDENUMBER
:
1457 aShapeType
+= "SlideNumberShape";
1459 case PRESOBJ_DATETIME
:
1460 aShapeType
+= "DateTimeShape";
1462 // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
1469 pShape
= SvxShape::getImplementation( xShape
);
1472 pShape
->SetShapeType( aShapeType
);
1475 SvxShape
*pSdShape
= SvxShape::getImplementation(xShape
);
1478 // SdXShape aggregates SvxShape
1479 new SdXShape(pSdShape
, GetModel());
1485 return SvxFmDrawPage::CreateShape( pObj
);
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"});
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
);
1527 aRet
.append( aBookmarkName
);
1531 return aRet
.makeStringAndClear();
1534 void SdGenericDrawPage::setBookmarkURL( OUString
const & rURL
)
1536 if( !SvxFmDrawPage::mpPage
)
1539 sal_Int32 nIndex
= rURL
.indexOf( '#' );
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
;
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)
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();
1580 xShape
.set( pObj
->getUnoShape(), UNO_QUERY
);
1583 mpView
->HideSdrPage();
1585 GetModel()->SetModified();
1590 void SAL_CALL
SdGenericDrawPage::split( const Reference
< drawing::XShape
>& xGroup
)
1592 ::SolarMutexGuard aGuard
;
1596 if(mpView
==nullptr||!xGroup
.is()||GetPage()==nullptr)
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
;
1613 uno::Reference
< drawing::XShape
> xShape
;
1614 if(mpView
==nullptr||!xShapes
.is()||GetPage()==nullptr)
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();
1629 xShape
.set( pObj
->getUnoShape(), UNO_QUERY
);
1632 mpView
->HideSdrPage();
1634 GetModel()->SetModified();
1639 void SAL_CALL
SdGenericDrawPage::unbind( const Reference
< drawing::XShape
>& xShape
)
1641 ::SolarMutexGuard aGuard
;
1645 if(mpView
==nullptr||!xShape
.is()||GetPage()==nullptr)
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() )
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() )
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() )
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() )
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();
1758 ::sd::ViewShell
* pViewSh
= pDocShell
->GetViewShell();
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
)
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
)
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
);
1839 void SdGenericDrawPage::release() throw()
1842 OWeakAggObject::release();
1846 void SdGenericDrawPage::disposing() throw()
1848 mpDocModel
= nullptr;
1849 SvxFmDrawPage::disposing();
1852 // XAnimationNodeSupplier
1853 Reference
< XAnimationNode
> SAL_CALL
SdGenericDrawPage::getAnimationNode()
1855 ::SolarMutexGuard aGuard
;
1859 SdPage
*pSdPage
= static_cast<SdPage
*>(SvxFmDrawPage::mpPage
);
1861 return pSdPage
->getAnimationNode();
1864 // SdPageLinkTargets
1865 SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage
* pUnoPage
) throw()
1868 mpUnoPage
= pUnoPage
;
1871 SdPageLinkTargets::~SdPageLinkTargets() throw()
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() )
1904 // container::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
);
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() )
1946 Sequence
< OUString
> aSeq( nObjCount
);
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() )
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 )
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
) )
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" };
2012 SdDrawPage::SdDrawPage(SdXImpressDocument
* pModel
, SdPage
* pPage
)
2013 : SdGenericDrawPage( pModel
, pPage
, ImplGetDrawPagePropertySet( pModel
->IsImpressDocument(), pPage
->GetPageKind() ) )
2017 SdDrawPage::~SdDrawPage() throw()
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
);
2054 Sequence
< uno::Type
> SAL_CALL
SdDrawPage::getTypes()
2056 ::SolarMutexGuard aGuard
;
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
;
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());
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
)
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();
2125 OUString
getPageApiNameFromUiName( const OUString
& rUIName
)
2129 OUString
aDefPageName(SdResId(STR_PAGE
) + " ");
2131 if( rUIName
.startsWith( aDefPageName
) )
2133 aApiName
= sEmptyPageName
;
2134 aApiName
+= rUIName
.copy( aDefPageName
.getLength() );
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();
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
2174 if( nPageNumber
!= -1)
2176 OUStringBuffer sBuffer
;
2177 sBuffer
.append( SdResId(STR_PAGE
) );
2178 sBuffer
.append( ' ' );
2179 sBuffer
.append( aNumber
);
2180 return sBuffer
.makeStringAndClear();
2187 OUString
SdDrawPage::getUiNameFromPageApiName( const OUString
& rApiName
)
2189 return getUiNameFromPageApiNameImpl( rApiName
);
2193 OUString SAL_CALL
SdDrawPage::getImplementationName()
2195 return OUString( "SdDrawPage" );
2198 Sequence
< OUString
> SAL_CALL
SdDrawPage::getSupportedServiceNames()
2200 ::SolarMutexGuard aGuard
;
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"} );
2213 sal_Bool SAL_CALL
SdDrawPage::supportsService( const OUString
& ServiceName
)
2215 return cppu::supportsService( this, ServiceName
);
2219 void SAL_CALL
SdDrawPage::setName( const OUString
& rName
)
2221 ::SolarMutexGuard aGuard
;
2225 DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
2227 OUString
aName( rName
);
2229 if(!(GetPage() && GetPage()->GetPageKind() != PageKind::Notes
))
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();
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
2256 if( nPageNumber
== ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
2261 OUString
aDefaultPageName( SdResId(STR_PAGE
) + " " );
2262 if( aName
.startsWith( aDefaultPageName
) )
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
);
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
;
2300 return getPageApiName( GetPage() );
2303 // XMasterPageTarget
2304 Reference
< drawing::XDrawPage
> SAL_CALL
SdDrawPage::getMasterPage( )
2306 ::SolarMutexGuard aGuard
;
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
);
2325 void SAL_CALL
SdDrawPage::setMasterPage( const Reference
< drawing::XDrawPage
>& xMasterPage
)
2327 ::SolarMutexGuard aGuard
;
2328 comphelper::ProfileZone
aZone("setMasterPage");
2332 if(!SvxFmDrawPage::mpPage
)
2335 SdMasterPage
* pMasterPage
= SdMasterPage::getImplementation( xMasterPage
);
2336 if( !(pMasterPage
&& pMasterPage
->isValid()) )
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
;
2369 if(SvxFmDrawPage::mpPage
&& GetModel()->GetDoc() && SvxFmDrawPage::mpPage
->GetPageNum() )
2371 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PageKind::Notes
);
2374 Reference
< drawing::XDrawPage
> xPage( pNotesPage
->getUnoPage(), uno::UNO_QUERY
);
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
);
2393 uno::Type SAL_CALL
SdDrawPage::getElementType()
2395 return SdGenericDrawPage::getElementType();
2398 sal_Bool SAL_CALL
SdDrawPage::hasElements()
2400 return SdGenericDrawPage::hasElements();
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
;
2415 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
2418 SdrObject
* pObj
= pShape
->GetSdrObject();
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();
2438 // the easy case, no background set. Set drawing::FillStyle_NONE to represent this
2439 GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE
));
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
>{} );
2450 pBack
->fillItemSet( static_cast<SdDrawDocument
*>(&GetPage()->getSdrModelFromSdrPage()), aSet
);
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();
2466 const OUString
aPropName( pProp
->Name
);
2467 if( xSetInfo
->hasPropertyByName( aPropName
) )
2468 xDestSet
->setPropertyValue( aPropName
,
2469 xSet
->getPropertyValue( aPropName
) );
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
));
2484 // background fill, set at page (not sure if ClearItem is needed)
2485 GetPage()->getSdrPageProperties().ClearItem();
2486 GetPage()->getSdrPageProperties().PutItemSet(aSet
);
2490 SvxFmDrawPage::mpPage
->ActionChanged();
2493 // XAnnotationAccess:
2494 Reference
< XAnnotation
> SAL_CALL
SdGenericDrawPage::createAndInsertAnnotation()
2497 throw DisposedException();
2499 Reference
< XAnnotation
> xRet
;
2500 GetPage()->createAnnotation(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
2525 // there is a fill set, export to rValue
2526 Reference
< beans::XPropertySet
> xSet(new SdUnoPageBackground(
2527 GetModel()->GetDoc(),
2528 &GetPage()->getSdrPageProperties().GetItemSet()));
2533 void SdGenericDrawPage::setNavigationOrder( const Any
& rValue
)
2535 Reference
< XIndexAccess
> xIA( rValue
, UNO_QUERY
);
2538 if( dynamic_cast< SdDrawPage
* >( xIA
.get() ) == this )
2540 if( GetPage()->HasObjectNavigationOrder() )
2541 GetPage()->ClearObjectNavigationOrder();
2545 else if( static_cast<size_t>(xIA
->getCount()) == GetPage()->GetObjCount() )
2547 GetPage()->SetNavigationOrder(xIA
);
2551 throw IllegalArgumentException();
2554 class SdNavigationOrderAccess
: public ::cppu::WeakImplHelper
< XIndexAccess
>
2557 explicit SdNavigationOrderAccess(SdrPage
const * pPage
);
2560 virtual sal_Int32 SAL_CALL
getCount( ) override
;
2561 virtual Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
2564 virtual Type SAL_CALL
getElementType( ) override
;
2565 virtual sal_Bool SAL_CALL
hasElements( ) override
;
2568 std::vector
< Reference
< XShape
> > maShapes
;
2571 SdNavigationOrderAccess::SdNavigationOrderAccess( SdrPage
const * pPage
)
2572 : maShapes( pPage
? pPage
->GetObjCount() : 0 )
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
);
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
] );
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() ) ) );
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()
2635 Any SAL_CALL
SdMasterPage::queryInterface( const uno::Type
& rType
)
2637 ::SolarMutexGuard aGuard
;
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 );
2654 return SdGenericDrawPage::queryInterface( rType
);
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
);
2672 Sequence
< uno::Type
> SAL_CALL
SdMasterPage::getTypes()
2674 ::SolarMutexGuard aGuard
;
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
;
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());
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
>();
2717 OUString SAL_CALL
SdMasterPage::getImplementationName()
2719 return OUString( "SdMasterPage" );
2722 Sequence
< OUString
> SAL_CALL
SdMasterPage::getSupportedServiceNames()
2724 ::SolarMutexGuard aGuard
;
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"} );
2737 sal_Bool SAL_CALL
SdMasterPage::supportsService( const OUString
& ServiceName
)
2739 return cppu::supportsService( this, ServiceName
);
2743 sal_Bool SAL_CALL
SdMasterPage::hasElements()
2745 ::SolarMutexGuard aGuard
;
2749 if( SvxFmDrawPage::mpPage
== nullptr )
2752 return SvxFmDrawPage::mpPage
->GetObjCount() > 0;
2755 uno::Type SAL_CALL
SdMasterPage::getElementType()
2757 return SdGenericDrawPage::getElementType();
2761 sal_Int32 SAL_CALL
SdMasterPage::getCount()
2763 ::SolarMutexGuard aGuard
;
2767 return SdGenericDrawPage::getCount();
2770 Any SAL_CALL
SdMasterPage::getByIndex( sal_Int32 Index
)
2772 ::SolarMutexGuard aGuard
;
2776 return SdGenericDrawPage::getByIndex(Index
);
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
) );
2808 xSetStates
->setPropertyToDefault( rProp
.sName
);
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
>{} );
2822 pBack
->fillItemSet( static_cast<SdDrawDocument
*>(&GetPage()->getSdrModelFromSdrPage()), aSet
);
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();
2838 const OUString
aPropName( pProp
->Name
);
2839 if( xInputSetInfo
->hasPropertyByName( aPropName
) )
2840 xDestSet
->setPropertyValue( aPropName
, xInputSet
->getPropertyValue( aPropName
) );
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();
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
);
2860 pStyleSheet
->GetItemSet().Put( aSet
);
2863 SvxFmDrawPage::mpPage
->ActionChanged();
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
);
2875 OSL_FAIL("sd::SdMasterPage::setBackground(), exception caught!");
2879 void SdMasterPage::getBackground( Any
& rValue
)
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
);
2896 SdDrawDocument
* pDoc
= static_cast<SdDrawDocument
*>(&SvxFmDrawPage::mpPage
->getSdrModelFromSdrPage());
2897 SfxStyleSheetBasePool
* pSSPool
= pDoc
->GetStyleSheetPool();
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
);
2907 SfxItemSet
aStyleSet( pStyleSheet
->GetItemSet());
2908 if( aStyleSet
.Count() )
2910 rValue
<<= Reference
< beans::XPropertySet
>( new SdUnoPageBackground( pDoc
, &aStyleSet
) );
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
));
2934 OSL_FAIL("sd::SdMasterPage::getBackground(), exception caught!");
2939 void SAL_CALL
SdMasterPage::setName( const OUString
& rName
)
2941 ::SolarMutexGuard aGuard
;
2945 if(!(SvxFmDrawPage::mpPage
&& GetPage()->GetPageKind() != PageKind::Notes
))
2948 SdDrawDocument
* pDoc
= GetModel()->GetDoc();
2951 // Slide Name has to be unique
2952 if( pDoc
&& pDoc
->GetPageByName( rName
, bOutDummy
) != SDRPAGE_NOTFOUND
)
2953 return; // throw Exception ?
2955 GetPage()->SetName( rName
);
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
;
2984 if(SvxFmDrawPage::mpPage
)
2986 OUString
aLayoutName( GetPage()->GetLayoutName() );
2987 return aLayoutName
.copy(0, aLayoutName
.indexOf(SD_LT_SEPARATOR
));
2993 // XPresentationPage
2994 Reference
< drawing::XDrawPage
> SAL_CALL
SdMasterPage::getNotesPage()
2996 ::SolarMutexGuard aGuard
;
3000 if(SvxFmDrawPage::mpPage
&& GetModel()->GetDoc() )
3002 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PageKind::Notes
);
3005 Reference
< drawing::XDrawPage
> xPage( pNotesPage
->getUnoPage(), uno::UNO_QUERY
);
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
;
3024 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
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
;
3041 SdXImpressDocument
* pModel
= SdXImpressDocument::getImplementation( pPage
->getSdrModelFromSdrPage().getUnoModel() );
3044 if( pPage
->IsMasterPage() )
3046 xPage
= static_cast<cppu::OWeakObject
*>(new SdMasterPage( pModel
, pPage
));
3050 xPage
= static_cast<cppu::OWeakObject
*>(new SdDrawPage( pModel
, pPage
));
3058 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */