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