1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unopage.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <com/sun/star/lang/DisposedException.hpp>
34 #include <com/sun/star/presentation/ClickAction.hpp>
35 #include <com/sun/star/presentation/FadeEffect.hpp>
36 #include <com/sun/star/presentation/AnimationEffect.hpp>
37 #include <com/sun/star/presentation/PresentationRange.hpp>
38 #include <com/sun/star/presentation/AnimationSpeed.hpp>
39 #include <com/sun/star/view/PaperOrientation.hpp>
40 #include <com/sun/star/animations/AnimationNodeType.hpp>
41 #include <com/sun/star/presentation/EffectNodeType.hpp>
42 #include <com/sun/star/lang/DisposedException.hpp>
43 #include <comphelper/processfactory.hxx>
44 #include <rtl/ustrbuf.hxx>
45 #include <vcl/bitmapex.hxx>
46 #include <vcl/metaact.hxx>
47 #ifndef _TOOLKIT_UNOIFACE_HXX
48 #include <toolkit/unohlp.hxx>
50 #include <vcl/svapp.hxx>
51 #include <vcl/settings.hxx>
52 #include <unomodel.hxx>
53 #include <unopage.hxx>
54 #ifndef _SVX_SVXIDS_HRC
55 #include <svx/svxids.hrc>
57 #include <svtools/itemset.hxx>
58 #include <svx/svdmodel.hxx>
59 #include <sdresid.hxx>
61 #ifndef _SD_PAGE_HXX //autogen
64 #include <unoprnms.hxx>
66 #include <drawdoc.hxx>
67 #include <svx/unoshape.hxx>
68 #include <com/sun/star/style/XStyle.hpp>
69 #include <svx/svdorect.hxx>
70 #include <vos/mutex.hxx>
71 #include <svtools/style.hxx>
73 #include <rtl/memory.h>
75 #include <comphelper/extract.hxx>
77 #include <svx/svditer.hxx>
78 #include <svtools/wmf.hxx>
79 #include <svx/svdoole2.hxx>
81 #include <svx/svdview.hxx>
85 #ifndef SD_DRAW_DOC_SHELL_HXX
86 #include "DrawDocShell.hxx"
89 #include "ViewShell.hxx"
90 #include "DrawViewShell.hxx"
92 #include "res_bmp.hrc"
93 #include "unokywds.hxx"
94 #include "unopback.hxx"
95 #include "unohelp.hxx"
97 using ::com::sun::star::animations::XAnimationNode
;
98 using ::com::sun::star::animations::XAnimationNodeSupplier
;
99 using ::rtl::OUString
;
100 using ::rtl::OUStringBuffer
;
102 using namespace ::vos
;
103 using namespace ::osl
;
104 using namespace ::com::sun::star
;
105 using namespace ::com::sun::star::uno
;
106 using namespace ::com::sun::star::lang
;
107 using namespace ::com::sun::star::container
;
108 using namespace ::com::sun::star::drawing
;
110 /* this are the ids for page properties */
113 WID_PAGE_LEFT
, WID_PAGE_RIGHT
, WID_PAGE_TOP
, WID_PAGE_BOTTOM
, WID_PAGE_WIDTH
,
114 WID_PAGE_HEIGHT
, WID_PAGE_EFFECT
, WID_PAGE_CHANGE
, WID_PAGE_SPEED
, WID_PAGE_NUMBER
,
115 WID_PAGE_ORIENT
, WID_PAGE_LAYOUT
, WID_PAGE_DURATION
, WID_PAGE_LDNAME
, WID_PAGE_LDBITMAP
,
116 WID_PAGE_BACK
, WID_PAGE_PREVIEW
, WID_PAGE_PREVIEWBITMAP
, WID_PAGE_VISIBLE
, WID_PAGE_SOUNDFILE
, WID_PAGE_BACKFULL
,
117 WID_PAGE_BACKVIS
, WID_PAGE_BACKOBJVIS
, WID_PAGE_USERATTRIBS
, WID_PAGE_BOOKMARK
, WID_PAGE_ISDARK
,
118 WID_PAGE_HEADERVISIBLE
, WID_PAGE_HEADERTEXT
, WID_PAGE_FOOTERVISIBLE
, WID_PAGE_FOOTERTEXT
,
119 WID_PAGE_PAGENUMBERVISIBLE
, WID_PAGE_DATETIMEVISIBLE
, WID_PAGE_DATETIMEFIXED
,
120 WID_PAGE_DATETIMETEXT
, WID_PAGE_DATETIMEFORMAT
, WID_TRANSITION_TYPE
, WID_TRANSITION_SUBTYPE
,
121 WID_TRANSITION_DIRECTION
, WID_TRANSITION_FADE_COLOR
, WID_TRANSITION_DURATION
, WID_LOOP_SOUND
,
126 #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
127 #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
129 #define SEQTYPE(x) &(x)
133 static sal_Char __FAR_DATA sEmptyPageName
[sizeof("page")] = "page";
135 /** this function stores the property maps for draw pages in impress and draw */
136 const SvxItemPropertySet
* ImplGetDrawPagePropertySet( sal_Bool bImpress
, PageKind ePageKind
)
138 static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl
[] =
140 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE( beans::XPropertySet
), beans::PropertyAttribute::MAYBEVOID
,0},
141 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM
), WID_PAGE_BOTTOM
, &::getCppuType((const sal_Int32
*)0), 0, 0},
142 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT
), WID_PAGE_LEFT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
143 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT
), WID_PAGE_RIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
144 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP
), WID_PAGE_TOP
, &::getCppuType((const sal_Int32
*)0), 0, 0},
145 { MAP_CHAR_LEN(UNO_NAME_PAGE_CHANGE
), WID_PAGE_CHANGE
, &::getCppuType((const sal_Int32
*)0), 0, 0},
146 { MAP_CHAR_LEN(UNO_NAME_PAGE_DURATION
), WID_PAGE_DURATION
, &::getCppuType((const sal_Int32
*)0), 0, 0},
147 { MAP_CHAR_LEN(UNO_NAME_PAGE_EFFECT
), WID_PAGE_EFFECT
, &::getCppuType((const presentation::FadeEffect
*)0), 0, 0},
148 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT
), WID_PAGE_HEIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
149 { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT
), WID_PAGE_LAYOUT
, &::getCppuType((const sal_Int16
*)0), 0, 0},
150 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP
), WID_PAGE_LDBITMAP
, &ITYPE( awt::XBitmap
), beans::PropertyAttribute::READONLY
, 0},
151 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME
), WID_PAGE_LDNAME
, &::getCppuType((const OUString
*)0), beans::PropertyAttribute::READONLY
, 0},
152 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER
), WID_PAGE_NUMBER
, &::getCppuType((const sal_Int16
*)0), beans::PropertyAttribute::READONLY
, 0},
153 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION
), WID_PAGE_ORIENT
, &::getCppuType((const view::PaperOrientation
*)0),0, 0},
154 { MAP_CHAR_LEN(UNO_NAME_PAGE_SPEED
), WID_PAGE_SPEED
, &::getCppuType((const presentation::AnimationSpeed
*)0), 0, 0},
155 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH
), WID_PAGE_WIDTH
, &::getCppuType((const sal_Int32
*)0), 0, 0},
156 { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW
), WID_PAGE_PREVIEW
, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence
<sal_Int8
>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY
, 0},
157 { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP
), WID_PAGE_PREVIEWBITMAP
, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence
<sal_Int8
>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY
, 0},
158 { MAP_CHAR_LEN(UNO_NAME_PAGE_VISIBLE
), WID_PAGE_VISIBLE
, &::getBooleanCppuType(), 0, 0},
159 { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE
), WID_PAGE_SOUNDFILE
, &::getCppuType((const Any
*)0), 0, 0},
160 { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundVisible
), WID_PAGE_BACKVIS
, &::getBooleanCppuType(), 0, 0},
161 { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible
), WID_PAGE_BACKOBJVIS
, &::getBooleanCppuType(), 0, 0},
162 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes
),WID_PAGE_USERATTRIBS
, &::getCppuType((const Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
163 { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL
), WID_PAGE_BOOKMARK
, &::getCppuType((const OUString
*)0), 0, 0},
164 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK
, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY
, 0},
165 { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE
, &::getBooleanCppuType(), 0, 0},
166 { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT
, &::getCppuType((const OUString
*)0), 0, 0},
167 { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE
, &::getBooleanCppuType(), 0, 0},
168 { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE
, &::getBooleanCppuType(), 0, 0},
169 { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED
, &::getBooleanCppuType(), 0, 0},
170 { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT
, &::getCppuType((const OUString
*)0), 0, 0},
171 { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
172 { MAP_CHAR_LEN("TransitionType"), WID_TRANSITION_TYPE
, &::getCppuType((const sal_Int16
*)0), 0, 0},
173 { MAP_CHAR_LEN("TransitionSubtype"), WID_TRANSITION_SUBTYPE
, &::getCppuType((const sal_Int16
*)0), 0, 0},
174 { MAP_CHAR_LEN("TransitionDirection"), WID_TRANSITION_DIRECTION
, &::getCppuType((const sal_Bool
*)0), 0, 0},
175 { MAP_CHAR_LEN("TransitionFadeColor"), WID_TRANSITION_FADE_COLOR
, &::getCppuType((const sal_Int32
*)0), 0, 0},
176 { MAP_CHAR_LEN("TransitionDuration"), WID_TRANSITION_DURATION
, &::getCppuType((const double*)0), 0, 0},
177 { MAP_CHAR_LEN("LoopSound"), WID_LOOP_SOUND
, &::getBooleanCppuType(), 0, 0},
178 { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER
, &::com::sun::star::container::XIndexAccess::static_type(),0, 0},
182 #define DRAW_PAGE_NOTES_PROPERTIES \
183 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
184 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
185 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
186 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
187 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
188 { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, \
189 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
190 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
191 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
192 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
193 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
194 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},\
195 { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
196 { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
197 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
198 { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
199 { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
200 { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
201 { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0}, \
202 { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0}, \
203 { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0}, \
204 { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
205 { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
208 static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl
[] =
210 // this must be the first two entries so they can be excluded for PK_STANDARD
211 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE( beans::XPropertySet
), beans::PropertyAttribute::MAYBEVOID
,0},
212 DRAW_PAGE_NOTES_PROPERTIES
214 static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl
[] =
216 DRAW_PAGE_NOTES_PROPERTIES
219 #define GRAPHIC_PAGE_PROPERTIES \
220 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
221 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
222 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
223 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
224 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
225 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
226 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
227 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
228 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
229 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
230 { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
231 { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
232 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, \
233 { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, \
234 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
235 { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
238 static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl
[] =
240 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE( beans::XPropertySet
), beans::PropertyAttribute::MAYBEVOID
,0},
241 GRAPHIC_PAGE_PROPERTIES
243 static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl
[] =
245 GRAPHIC_PAGE_PROPERTIES
249 bool bWithoutBackground
= ePageKind
!= PK_STANDARD
&& ePageKind
!= PK_HANDOUT
;
250 const SvxItemPropertySet
* pRet
= 0;
253 if( ePageKind
== PK_STANDARD
)
255 //PK_STANDARD always has a background property
256 static SvxItemPropertySet
aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl
);
257 pRet
= &aDrawPagePropertySet_Impl
;
261 if(bWithoutBackground
)
263 static SvxItemPropertySet
aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl
);
264 pRet
= &aDrawPageNotesHandoutPropertyNoBackSet_Impl
;
268 static SvxItemPropertySet
aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl
);
269 pRet
= &aDrawPageNotesHandoutPropertySet_Impl
;
275 if(bWithoutBackground
)
277 static SvxItemPropertySet
aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl
);
278 pRet
= &aGraphicPagePropertyNoBackSet_Impl
;
282 static SvxItemPropertySet
aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl
);
283 pRet
= &aGraphicPagePropertySet_Impl
;
289 /** this function stores the property map for master pages in impress and draw */
290 const SvxItemPropertySet
* ImplGetMasterPagePropertySet( PageKind ePageKind
)
292 static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl
[] =
294 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE(beans::XPropertySet
), 0, 0},
295 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM
), WID_PAGE_BOTTOM
, &::getCppuType((const sal_Int32
*)0), 0, 0},
296 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT
), WID_PAGE_LEFT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
297 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT
), WID_PAGE_RIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
298 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP
), WID_PAGE_TOP
, &::getCppuType((const sal_Int32
*)0), 0, 0},
299 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT
), WID_PAGE_HEIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
300 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP
), WID_PAGE_LDBITMAP
, &ITYPE(awt::XBitmap
), beans::PropertyAttribute::READONLY
, 0},
301 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME
), WID_PAGE_LDNAME
, &::getCppuType((const OUString
*)0), beans::PropertyAttribute::READONLY
, 0},
302 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER
), WID_PAGE_NUMBER
, &::getCppuType((const sal_Int16
*)0), beans::PropertyAttribute::READONLY
, 0},
303 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION
), WID_PAGE_ORIENT
, &::getCppuType((const view::PaperOrientation
*)0),0, 0},
304 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH
), WID_PAGE_WIDTH
, &::getCppuType((const sal_Int32
*)0), 0, 0},
305 { MAP_CHAR_LEN("BackgroundFullSize"), WID_PAGE_BACKFULL
, &::getBooleanCppuType(), 0, 0},
306 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes
),WID_PAGE_USERATTRIBS
, &::getCppuType((const Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
307 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK
, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY
, 0},
311 static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl
[] =
313 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM
), WID_PAGE_BOTTOM
, &::getCppuType((const sal_Int32
*)0), 0, 0},
314 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT
), WID_PAGE_LEFT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
315 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT
), WID_PAGE_RIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
316 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP
), WID_PAGE_TOP
, &::getCppuType((const sal_Int32
*)0), 0, 0},
317 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT
), WID_PAGE_HEIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
318 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION
), WID_PAGE_ORIENT
, &::getCppuType((const view::PaperOrientation
*)0),0, 0},
319 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH
), WID_PAGE_WIDTH
, &::getCppuType((const sal_Int32
*)0), 0, 0},
320 { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT
), WID_PAGE_LAYOUT
, &::getCppuType((const sal_Int16
*)0), 0, 0},
321 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes
),WID_PAGE_USERATTRIBS
, &::getCppuType((const Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
322 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK
, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY
, 0},
323 { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE
, &::getBooleanCppuType(), 0, 0},
324 { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT
, &::getCppuType((const OUString
*)0), 0, 0},
325 { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE
, &::getBooleanCppuType(), 0, 0},
326 { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT
, &::getCppuType((const OUString
*)0), 0, 0},
327 { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE
, &::getBooleanCppuType(), 0, 0},
328 { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE
, &::getBooleanCppuType(), 0, 0},
329 { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED
, &::getBooleanCppuType(), 0, 0},
330 { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT
, &::getCppuType((const OUString
*)0), 0, 0},
331 { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
335 const SvxItemPropertySet
* pRet
= 0;
336 if( ePageKind
== PK_HANDOUT
)
338 static SvxItemPropertySet
aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl
);
339 pRet
= &aHandoutMasterPagePropertySet_Impl
;
343 static SvxItemPropertySet
aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl
);
344 pRet
= &aMasterPagePropertySet_Impl
;
349 UNO3_GETIMPLEMENTATION2_IMPL( SdGenericDrawPage
, SvxFmDrawPage
);
351 /***********************************************************************
353 ***********************************************************************/
354 SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument
* _pModel
, SdPage
* pInPage
, const SvxItemPropertySet
* _pSet
) throw()
355 : SvxFmDrawPage( (SdrPage
*) pInPage
),
356 SdUnoSearchReplaceShape(this),
360 mbHasBackgroundObject(sal_False
),
361 mbIsImpressDocument(false)
363 mpSdrModel
= SvxFmDrawPage::mpModel
;
365 mbIsImpressDocument
= mpModel
->IsImpressDocument() ? true : false;
369 SdGenericDrawPage::~SdGenericDrawPage() throw()
373 void SdGenericDrawPage::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException
)
375 if( (SvxFmDrawPage::mpModel
== 0) || (mpModel
== 0) || (SvxFmDrawPage::mpPage
== 0) )
376 throw lang::DisposedException();
379 SdXImpressDocument
* SdGenericDrawPage::GetModel() const
381 if( mpSdrModel
!= SvxFmDrawPage::mpModel
)
383 const_cast< SdGenericDrawPage
* >(this)->mpSdrModel
= SvxFmDrawPage::mpModel
;
386 uno::Reference
< uno::XInterface
> xModel( SvxFmDrawPage::mpModel
->getUnoModel() );
387 const_cast< SdGenericDrawPage
*>(this)->mpModel
= SdXImpressDocument::getImplementation( xModel
);
389 const_cast< SdGenericDrawPage
*>(this)->mbIsImpressDocument
= mpModel
->IsImpressDocument() ? true : false;
393 const_cast< SdGenericDrawPage
* >(this)->mpModel
= 0;
400 // this is called whenever a SdrObject must be created for a empty api shape wrapper
401 SdrObject
* SdGenericDrawPage::_CreateSdrObject( const Reference
< drawing::XShape
>& xShape
) throw()
403 if( NULL
== SvxFmDrawPage::mpPage
|| !xShape
.is() )
406 String
aType( xShape
->getShapeType() );
407 const String
aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") );
408 if(aType
.CompareTo( aPrefix
, aPrefix
.Len() ) != 0)
410 SdrObject
* pObj
= SvxFmDrawPage::_CreateSdrObject( xShape
);
411 if( pObj
&& ( (pObj
->GetObjInventor() != SdrInventor
) || (pObj
->GetObjIdentifier() != OBJ_PAGE
) ) )
413 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
415 pObj
->NbcSetStyleSheet( pDoc
->GetDefaultStyleSheet(), sal_True
);
420 aType
= aType
.Copy( aPrefix
.Len() );
422 PresObjKind eObjKind
= PRESOBJ_NONE
;
424 if( aType
.EqualsAscii( "TitleTextShape" ) )
426 eObjKind
= PRESOBJ_TITLE
;
428 else if( aType
.EqualsAscii( "OutlinerShape" ) )
430 eObjKind
= PRESOBJ_OUTLINE
;
432 else if( aType
.EqualsAscii( "SubtitleShape" ) )
434 eObjKind
= PRESOBJ_TEXT
;
436 else if( aType
.EqualsAscii( "OLE2Shape" ) )
438 eObjKind
= PRESOBJ_OBJECT
;
440 else if( aType
.EqualsAscii( "ChartShape" ) )
442 eObjKind
= PRESOBJ_CHART
;
444 else if( aType
.EqualsAscii( "TableShape" ) )
446 eObjKind
= PRESOBJ_TABLE
;
448 else if( aType
.EqualsAscii( "GraphicObjectShape" ) )
450 #ifdef STARIMAGE_AVAILABLE
451 eObjKind
= PRESOBJ_IMAGE
;
453 eObjKind
= PRESOBJ_GRAPHIC
;
456 else if( aType
.EqualsAscii( "OrgChartShape" ) )
458 eObjKind
= PRESOBJ_ORGCHART
;
460 else if( aType
.EqualsAscii( "PageShape" ) )
462 if( GetPage()->GetPageKind() == PK_NOTES
&& GetPage()->IsMasterPage() )
463 eObjKind
= PRESOBJ_TITLE
;
465 eObjKind
= PRESOBJ_PAGE
;
467 else if( aType
.EqualsAscii( "NotesShape" ) )
469 eObjKind
= PRESOBJ_NOTES
;
471 else if( aType
.EqualsAscii( "HandoutShape" ) )
473 eObjKind
= PRESOBJ_HANDOUT
;
475 else if( aType
.EqualsAscii( "FooterShape" ) )
477 eObjKind
= PRESOBJ_FOOTER
;
479 else if( aType
.EqualsAscii( "HeaderShape" ) )
481 eObjKind
= PRESOBJ_HEADER
;
483 else if( aType
.EqualsAscii( "SlideNumberShape" ) )
485 eObjKind
= PRESOBJ_SLIDENUMBER
;
487 else if( aType
.EqualsAscii( "DateTimeShape" ) )
489 eObjKind
= PRESOBJ_DATETIME
;
492 Rectangle
aRect( eObjKind
== PRESOBJ_TITLE
? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
494 const awt::Point
aPos( aRect
.Left(), aRect
.Top() );
495 xShape
->setPosition( aPos
);
497 const awt::Size
aSize( aRect
.GetWidth(), aRect
.GetHeight() );
498 xShape
->setSize( aSize
);
500 SdrObject
*pPresObj
= GetPage()->CreatePresObj( eObjKind
, FALSE
, aRect
, sal_True
);
503 pPresObj
->SetUserCall( GetPage() );
509 Any SAL_CALL
SdGenericDrawPage::queryInterface( const uno::Type
& rType
)
510 throw(uno::RuntimeException
)
514 QUERYINT( beans::XPropertySet
);
515 else QUERYINT( container::XNamed
);
516 else QUERYINT( util::XReplaceable
);
517 else QUERYINT( util::XSearchable
);
518 else QUERYINT( document::XLinkTargetSupplier
);
519 else QUERYINT( drawing::XShapeCombiner
);
520 else QUERYINT( drawing::XShapeBinder
);
521 else QUERYINT( beans::XMultiPropertySet
);
522 else if( rType
== ITYPE( XAnimationNodeSupplier
) )
524 if( mbIsImpressDocument
)
526 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
528 if( ePageKind
== PK_STANDARD
)
529 return makeAny( Reference
< XAnimationNodeSupplier
>( this ) );
533 return SvxDrawPage::queryInterface( rType
);
539 Reference
< beans::XPropertySetInfo
> SAL_CALL
SdGenericDrawPage::getPropertySetInfo()
540 throw(uno::RuntimeException
)
542 OGuard
aGuard( Application::GetSolarMutex() );
544 return mpPropSet
->getPropertySetInfo();
547 void SAL_CALL
SdGenericDrawPage::setPropertyValue( const OUString
& aPropertyName
, const Any
& aValue
)
548 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
550 OGuard
aGuard( Application::GetSolarMutex() );
554 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
556 switch( pEntry
? pEntry
->nWID
: -1 )
559 setNavigationOrder( aValue
);
564 case WID_PAGE_BOTTOM
:
565 case WID_PAGE_LAYOUT
:
566 case WID_PAGE_DURATION
:
567 case WID_PAGE_CHANGE
:
569 sal_Int32 nValue
= 0;
570 if(!(aValue
>>= nValue
))
571 throw lang::IllegalArgumentException();
573 switch( pEntry
->nWID
)
576 SetLftBorder(nValue
);
579 SetRgtBorder( nValue
);
582 SetUppBorder( nValue
);
584 case WID_PAGE_BOTTOM
:
585 SetLwrBorder( nValue
);
587 case WID_PAGE_CHANGE
:
588 GetPage()->SetPresChange( (PresChange
)nValue
);
590 case WID_PAGE_LAYOUT
:
591 GetPage()->SetAutoLayout( (AutoLayout
)nValue
, sal_True
);
593 case WID_PAGE_DURATION
:
594 GetPage()->SetTime((sal_uInt32
)nValue
);
601 sal_Int32 nWidth
= 0;
602 if(!(aValue
>>= nWidth
))
603 throw lang::IllegalArgumentException();
608 case WID_PAGE_HEIGHT
:
610 sal_Int32 nHeight
= 0;
611 if(!(aValue
>>= nHeight
))
612 throw lang::IllegalArgumentException();
614 SetHeight( nHeight
);
617 case WID_PAGE_ORIENT
:
620 if(!::cppu::enum2int( nEnum
, aValue
))
621 throw lang::IllegalArgumentException();
623 Orientation eOri
= (((view::PaperOrientation
)nEnum
) == view::PaperOrientation_PORTRAIT
)?ORIENTATION_PORTRAIT
:ORIENTATION_LANDSCAPE
;
625 if( eOri
!= GetPage()->GetOrientation() )
627 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
628 const PageKind ePageKind
= GetPage()->GetPageKind();
630 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
631 for (i
= 0; i
< nPageCnt
; i
++)
633 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
634 pPage
->SetOrientation( eOri
);
637 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
639 for (i
= 0; i
< nPageCnt
; i
++)
641 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
642 pPage
->SetOrientation( eOri
);
647 case WID_PAGE_EFFECT
:
650 if(!::cppu::enum2int( nEnum
, aValue
))
651 throw lang::IllegalArgumentException();
653 GetPage()->SetFadeEffect( (presentation::FadeEffect
)nEnum
);
657 setBackground( aValue
);
662 if(!::cppu::enum2int( nEnum
, aValue
))
663 throw lang::IllegalArgumentException();
665 GetPage()->setTransitionDuration( nEnum
== 0 ? 3.0 : (nEnum
== 1 ? 2.0 : 1.0 ) );
668 case WID_PAGE_VISIBLE
:
670 sal_Bool bVisible
= sal_False
;
671 if( ! ( aValue
>>= bVisible
) )
672 throw lang::IllegalArgumentException();
673 GetPage()->SetExcluded( bVisible
== FALSE
);
676 case WID_PAGE_SOUNDFILE
:
679 if( aValue
>>= aURL
)
681 GetPage()->SetSoundFile( aURL
);
682 GetPage()->SetSound( aURL
.getLength() != 0 ? sal_True
: sal_False
);
687 sal_Bool bStopSound
= sal_False
;
688 if( aValue
>>= bStopSound
)
690 GetPage()->SetStopSound( bStopSound
? true : false );
696 throw lang::IllegalArgumentException();
700 sal_Bool bLoop
= sal_False
;
701 if( ! (aValue
>>= bLoop
) )
702 throw lang::IllegalArgumentException();
704 GetPage()->SetLoopSound( bLoop
? true : false );
707 case WID_PAGE_BACKFULL
:
709 sal_Bool bFullSize
= sal_False
;
710 if( ! ( aValue
>>= bFullSize
) )
711 throw lang::IllegalArgumentException();
712 GetPage()->SetBackgroundFullSize( bFullSize
);
715 case WID_PAGE_BACKVIS
:
717 sal_Bool bVisible
= sal_False
;
718 if( ! ( aValue
>>= bVisible
) )
719 throw lang::IllegalArgumentException();
721 SdrPage
* pPage
= GetPage();
724 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
725 if( pDoc
->GetMasterPageCount() )
727 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
728 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
729 aVisibleLayers
.Set(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRND
)), FALSE
), bVisible
);
730 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
735 case WID_PAGE_BACKOBJVIS
:
737 sal_Bool bVisible
= sal_False
;
738 if( ! ( aValue
>>= bVisible
) )
739 throw lang::IllegalArgumentException();
741 SdrPage
* pPage
= GetPage();
744 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
745 if( pDoc
->GetMasterPageCount() )
747 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
748 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
749 aVisibleLayers
.Set(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ
)), FALSE
), bVisible
);
750 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
756 case WID_PAGE_USERATTRIBS
:
758 if( !GetPage()->setAlienAttributes( aValue
) )
759 throw lang::IllegalArgumentException();
762 case WID_PAGE_BOOKMARK
:
764 OUString aBookmarkURL
;
765 if( ! ( aValue
>>= aBookmarkURL
) )
766 throw lang::IllegalArgumentException();
768 setBookmarkURL( aBookmarkURL
);
772 case WID_PAGE_HEADERVISIBLE
:
773 case WID_PAGE_HEADERTEXT
:
774 case WID_PAGE_FOOTERVISIBLE
:
775 case WID_PAGE_FOOTERTEXT
:
776 case WID_PAGE_PAGENUMBERVISIBLE
:
777 case WID_PAGE_DATETIMEVISIBLE
:
778 case WID_PAGE_DATETIMEFIXED
:
779 case WID_PAGE_DATETIMETEXT
:
780 case WID_PAGE_DATETIMEFORMAT
:
782 sd::HeaderFooterSettings
aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
784 switch( pEntry
->nWID
)
786 case WID_PAGE_HEADERVISIBLE
:
788 sal_Bool bVisible
= sal_False
;
789 if( ! ( aValue
>>= bVisible
) )
790 throw lang::IllegalArgumentException();
792 aHeaderFooterSettings
.mbHeaderVisible
= bVisible
;
795 case WID_PAGE_HEADERTEXT
:
798 if( ! ( aValue
>>= aText
) )
799 throw lang::IllegalArgumentException();
801 aHeaderFooterSettings
.maHeaderText
= aText
;
804 case WID_PAGE_FOOTERVISIBLE
:
806 sal_Bool bVisible
= sal_False
;
807 if( ! ( aValue
>>= bVisible
) )
808 throw lang::IllegalArgumentException();
810 aHeaderFooterSettings
.mbFooterVisible
= bVisible
;
813 case WID_PAGE_FOOTERTEXT
:
816 if( ! ( aValue
>>= aText
) )
817 throw lang::IllegalArgumentException();
819 aHeaderFooterSettings
.maFooterText
= aText
;
822 case WID_PAGE_PAGENUMBERVISIBLE
:
824 sal_Bool bVisible
= sal_False
;
825 if( ! ( aValue
>>= bVisible
) )
826 throw lang::IllegalArgumentException();
828 aHeaderFooterSettings
.mbSlideNumberVisible
= bVisible
;
831 case WID_PAGE_DATETIMEVISIBLE
:
833 sal_Bool bVisible
= sal_False
;
834 if( ! ( aValue
>>= bVisible
) )
835 throw lang::IllegalArgumentException();
837 aHeaderFooterSettings
.mbDateTimeVisible
= bVisible
;
840 case WID_PAGE_DATETIMEFIXED
:
842 sal_Bool bVisible
= sal_False
;
843 if( ! ( aValue
>>= bVisible
) )
844 throw lang::IllegalArgumentException();
846 aHeaderFooterSettings
.mbDateTimeIsFixed
= bVisible
;
849 case WID_PAGE_DATETIMETEXT
:
852 if( ! ( aValue
>>= aText
) )
853 throw lang::IllegalArgumentException();
855 aHeaderFooterSettings
.maDateTimeText
= aText
;
858 case WID_PAGE_DATETIMEFORMAT
:
860 sal_Int32 nValue
= 0;
861 if( ! ( aValue
>>= nValue
) )
862 throw lang::IllegalArgumentException();
864 aHeaderFooterSettings
.meDateTimeFormat
= nValue
;
869 if( !(aHeaderFooterSettings
== GetPage()->getHeaderFooterSettings()) )
870 GetPage()->setHeaderFooterSettings( aHeaderFooterSettings
);
875 case WID_PAGE_LDBITMAP
:
876 case WID_PAGE_LDNAME
:
877 case WID_PAGE_NUMBER
:
878 case WID_PAGE_ISDARK
:
879 throw beans::PropertyVetoException();
881 case WID_TRANSITION_TYPE
:
883 sal_Int16 nValue
= 0;
884 if( ! ( aValue
>>= nValue
) )
885 throw lang::IllegalArgumentException();
887 GetPage()->setTransitionType( nValue
);
891 case WID_TRANSITION_SUBTYPE
:
893 sal_Int16 nValue
= 0;
894 if( ! ( aValue
>>= nValue
) )
895 throw lang::IllegalArgumentException();
897 GetPage()->setTransitionSubtype( nValue
);
901 case WID_TRANSITION_DIRECTION
:
903 sal_Bool bValue
= sal_False
;
904 if( ! ( aValue
>>= bValue
) )
905 throw lang::IllegalArgumentException();
907 GetPage()->setTransitionDirection( bValue
);
911 case WID_TRANSITION_FADE_COLOR
:
913 sal_Int32 nValue
= 0;
914 if( ! ( aValue
>>= nValue
) )
915 throw lang::IllegalArgumentException();
917 GetPage()->setTransitionFadeColor( nValue
);
921 case WID_TRANSITION_DURATION
:
924 if( ! ( aValue
>>= fValue
) )
925 throw lang::IllegalArgumentException();
927 GetPage()->setTransitionDuration( fValue
);
932 throw beans::UnknownPropertyException();
935 GetModel()->SetModified();
938 /***********************************************************************
940 ***********************************************************************/
941 Any SAL_CALL
SdGenericDrawPage::getPropertyValue( const OUString
& PropertyName
)
942 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
944 OGuard
aGuard( Application::GetSolarMutex() );
950 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(PropertyName
);
952 switch( pEntry
? pEntry
->nWID
: -1 )
955 aAny
= getNavigationOrder();
958 aAny
<<= (sal_Int32
)( GetPage()->GetLftBorder() );
961 aAny
<<= (sal_Int32
)( GetPage()->GetRgtBorder() );
964 aAny
<<= (sal_Int32
)( GetPage()->GetUppBorder() );
966 case WID_PAGE_BOTTOM
:
967 aAny
<<= (sal_Int32
)( GetPage()->GetLwrBorder() );
970 aAny
<<= (sal_Int32
)( GetPage()->GetSize().getWidth() );
972 case WID_PAGE_HEIGHT
:
973 aAny
<<= (sal_Int32
)( GetPage()->GetSize().getHeight() );
975 case WID_PAGE_ORIENT
:
976 aAny
= ::cppu::int2enum( (sal_Int32
)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT
)? view::PaperOrientation_PORTRAIT
: view::PaperOrientation_LANDSCAPE
), ::getCppuType((const view::PaperOrientation
*)0) );
978 case WID_PAGE_EFFECT
:
979 aAny
= ::cppu::int2enum( (sal_Int32
)GetPage()->GetFadeEffect(), ::getCppuType((const presentation::FadeEffect
*)0) );
981 case WID_PAGE_CHANGE
:
982 aAny
<<= (sal_Int32
)( GetPage()->GetPresChange() );
986 const double fDuration
= GetPage()->getTransitionDuration();
987 aAny
= ::cppu::int2enum( fDuration
< 2.0 ? 2 : (fDuration
> 2.0 ? 0 : 1), ::getCppuType((const presentation::AnimationSpeed
*)0) );
990 case WID_PAGE_LAYOUT
:
991 aAny
<<= (sal_Int16
)( GetPage()->GetAutoLayout() );
993 case WID_PAGE_NUMBER
:
994 aAny
<<= (sal_Int16
)((sal_uInt16
)((GetPage()->GetPageNum()-1)>>1) + 1);
996 case WID_PAGE_DURATION
:
997 aAny
<<= (sal_Int32
)(GetPage()->GetTime());
999 case WID_PAGE_LDNAME
:
1001 const OUString
aName( GetPage()->GetName() );
1005 case WID_PAGE_LDBITMAP
:
1007 BOOL bHC
= Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark();
1008 Reference
< awt::XBitmap
> xBitmap(
1009 VCLUnoHelper::CreateBitmap( BitmapEx( SdResId( bHC
? BMP_PAGE_H
: BMP_PAGE
) ) ) );
1014 getBackground( aAny
);
1016 case WID_PAGE_PREVIEW
:
1018 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1021 ::sd::DrawDocShell
* pDocShell
= pDoc
->GetDocSh();
1024 sal_uInt16 nPgNum
= 0;
1025 sal_uInt16 nPageCount
= pDoc
->GetSdPageCount( PK_STANDARD
);
1026 sal_uInt16 nPageNumber
= (sal_uInt16
)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1027 while( nPgNum
< nPageCount
)
1029 pDoc
->SetSelected( pDoc
->GetSdPage( nPgNum
, PK_STANDARD
), nPgNum
== nPageNumber
);
1032 ::boost::shared_ptr
<GDIMetaFile
> pMetaFile
=
1033 pDocShell
->GetPreviewMetaFile();
1037 Size
aSize( GetPage()->GetSize() );
1038 pMetaFile
->AddAction( (MetaAction
*) new MetaFillColorAction( COL_WHITE
, TRUE
), 0 );
1039 pMetaFile
->AddAction( (MetaAction
*) new MetaRectAction( Rectangle( aPoint
, aSize
) ), 1 );
1040 pMetaFile
->SetPrefMapMode( MAP_100TH_MM
);
1041 pMetaFile
->SetPrefSize( aSize
);
1043 SvMemoryStream
aDestStrm( 65535, 65535 );
1044 ConvertGDIMetaFileToWMF( *pMetaFile
, aDestStrm
, NULL
, sal_False
);
1045 Sequence
<sal_Int8
> aSeq( (sal_Int8
*)aDestStrm
.GetData(), aDestStrm
.Tell() );
1053 case WID_PAGE_PREVIEWBITMAP
:
1055 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1058 ::sd::DrawDocShell
* pDocShell
= pDoc
->GetDocSh();
1061 sal_uInt16 nPgNum
= 0;
1062 sal_uInt16 nPageCount
= pDoc
->GetSdPageCount( PK_STANDARD
);
1063 sal_uInt16 nPageNumber
= (sal_uInt16
)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1064 while( nPgNum
< nPageCount
)
1066 pDoc
->SetSelected( pDoc
->GetSdPage( nPgNum
, PK_STANDARD
), nPgNum
== nPageNumber
);
1069 ::boost::shared_ptr
<GDIMetaFile
> pMetaFile
=
1070 pDocShell
->GetPreviewMetaFile();
1072 if ( pMetaFile
&& pMetaFile
->CreateThumbnail( 160, /* magic value taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() */
1075 SvMemoryStream aMemStream
;
1076 aBitmap
.GetBitmap().Write( aMemStream
, FALSE
, FALSE
);
1077 uno::Sequence
<sal_Int8
> aSeq( (sal_Int8
*)aMemStream
.GetData(), aMemStream
.Tell() );
1085 case WID_PAGE_VISIBLE
:
1087 sal_Bool bVisible
= GetPage()->IsExcluded() == FALSE
;
1088 aAny
<<= Any( &bVisible
, ::getBooleanCppuType() );
1092 case WID_PAGE_SOUNDFILE
:
1094 if( GetPage()->IsStopSound() )
1101 if( GetPage()->IsSoundOn() )
1102 aURL
= GetPage()->GetSoundFile();
1107 case WID_LOOP_SOUND
:
1109 aAny
<<= (sal_Bool
)GetPage()->IsLoopSound();
1112 case WID_PAGE_BACKFULL
:
1114 sal_Bool bFullSize
= GetPage()->IsBackgroundFullSize();
1115 aAny
= Any( &bFullSize
, ::getBooleanCppuType() );
1118 case WID_PAGE_BACKVIS
:
1120 SdrPage
* pPage
= GetPage();
1123 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
1124 if( pDoc
->GetMasterPageCount() )
1126 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
1127 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1128 aAny
<<= (sal_Bool
)aVisibleLayers
.IsSet(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRND
)), FALSE
));
1132 aAny
<<= (sal_Bool
)sal_False
;
1137 case WID_PAGE_BACKOBJVIS
:
1139 SdrPage
* pPage
= GetPage();
1142 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
1143 if( pDoc
->GetMasterPageCount() )
1145 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
1146 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1147 aAny
<<= (sal_Bool
)aVisibleLayers
.IsSet(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ
)), FALSE
));
1151 aAny
<<= (sal_Bool
)sal_False
;
1156 case WID_PAGE_USERATTRIBS
:
1158 GetPage()->getAlienAttributes( aAny
);
1161 case WID_PAGE_BOOKMARK
:
1163 aAny
<<= getBookmarkURL();
1166 case WID_PAGE_ISDARK
:
1168 aAny
<<= (sal_Bool
)GetPage()->GetPageBackgroundColor().IsDark();
1171 case WID_PAGE_HEADERVISIBLE
:
1172 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbHeaderVisible
;
1174 case WID_PAGE_HEADERTEXT
:
1176 const OUString
aText( GetPage()->getHeaderFooterSettings().maHeaderText
);
1180 case WID_PAGE_FOOTERVISIBLE
:
1181 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbFooterVisible
;
1183 case WID_PAGE_FOOTERTEXT
:
1185 const OUString
aText( GetPage()->getHeaderFooterSettings().maFooterText
);
1189 case WID_PAGE_PAGENUMBERVISIBLE
:
1190 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbSlideNumberVisible
;
1192 case WID_PAGE_DATETIMEVISIBLE
:
1193 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbDateTimeVisible
;
1195 case WID_PAGE_DATETIMEFIXED
:
1196 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed
;
1198 case WID_PAGE_DATETIMETEXT
:
1200 const OUString
aText( GetPage()->getHeaderFooterSettings().maDateTimeText
);
1204 case WID_PAGE_DATETIMEFORMAT
:
1205 aAny
<<= (sal_Int32
)GetPage()->getHeaderFooterSettings().meDateTimeFormat
;
1208 case WID_TRANSITION_TYPE
:
1209 aAny
<<= GetPage()->getTransitionType();
1212 case WID_TRANSITION_SUBTYPE
:
1213 aAny
<<= GetPage()->getTransitionSubtype();
1216 case WID_TRANSITION_DIRECTION
:
1217 aAny
<<= GetPage()->getTransitionDirection();
1220 case WID_TRANSITION_FADE_COLOR
:
1221 aAny
<<= GetPage()->getTransitionFadeColor();
1224 case WID_TRANSITION_DURATION
:
1225 aAny
<<= GetPage()->getTransitionDuration();
1229 throw beans::UnknownPropertyException();
1234 void SAL_CALL
SdGenericDrawPage::addPropertyChangeListener( const OUString
& , const Reference
< beans::XPropertyChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1235 void SAL_CALL
SdGenericDrawPage::removePropertyChangeListener( const OUString
& , const Reference
< beans::XPropertyChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1236 void SAL_CALL
SdGenericDrawPage::addVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1237 void SAL_CALL
SdGenericDrawPage::removeVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1239 // XMultiPropertySet
1240 void SAL_CALL
SdGenericDrawPage::setPropertyValues( const Sequence
< OUString
>& aPropertyNames
, const Sequence
< Any
>& aValues
) throw (beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1242 if( aPropertyNames
.getLength() != aValues
.getLength() )
1243 throw lang::IllegalArgumentException();
1245 const OUString
* pNames
= aPropertyNames
.getConstArray();
1246 const Any
* pValues
= aValues
.getConstArray();
1247 sal_uInt32 nCount
= aValues
.getLength();
1252 setPropertyValue( *pNames
++, *pValues
++ );
1254 catch( beans::UnknownPropertyException
& )
1256 // ignore for multi property set
1257 // todo: optimize this!
1262 Sequence
< Any
> SAL_CALL
SdGenericDrawPage::getPropertyValues( const Sequence
< OUString
>& aPropertyNames
) throw (RuntimeException
)
1264 const OUString
* pNames
= aPropertyNames
.getConstArray();
1265 sal_uInt32 nCount
= aPropertyNames
.getLength();
1266 Sequence
< Any
> aValues( nCount
);
1267 Any
* pValues
= aValues
.getArray();
1273 aValue
= getPropertyValue( *pNames
++ );
1275 catch( beans::UnknownPropertyException
& )
1277 // ignore for multi property set
1278 // todo: optimize this!
1280 *pValues
++ = aValue
;
1285 void SAL_CALL
SdGenericDrawPage::addPropertiesChangeListener( const Sequence
< OUString
>& , const Reference
< beans::XPropertiesChangeListener
>& ) throw (RuntimeException
)
1289 void SAL_CALL
SdGenericDrawPage::removePropertiesChangeListener( const Reference
< beans::XPropertiesChangeListener
>& ) throw (RuntimeException
)
1293 void SAL_CALL
SdGenericDrawPage::firePropertiesChangeEvent( const Sequence
< OUString
>& , const Reference
< beans::XPropertiesChangeListener
>& ) throw (RuntimeException
)
1297 Reference
< drawing::XShape
> SdGenericDrawPage::_CreateShape( SdrObject
*pObj
) const throw()
1299 DBG_ASSERT( GetPage(), "SdGenericDrawPage::_CreateShape(), can't create shape for disposed page!" );
1300 DBG_ASSERT( pObj
, "SdGenericDrawPage::_CreateShape(), invalid call with pObj == 0!" );
1302 if( GetPage() && pObj
)
1304 PresObjKind eKind
= GetPage()->GetPresObjKind(pObj
);
1306 SvxShape
* pShape
= NULL
;
1308 if(pObj
->GetObjInventor() == SdrInventor
)
1310 sal_uInt32 nInventor
= pObj
->GetObjIdentifier();
1314 pShape
= new SvxShapeText( pObj
);
1315 if( GetPage()->GetPageKind() == PK_NOTES
&& GetPage()->IsMasterPage() )
1317 // fake a empty PageShape if its a title shape on the master page
1318 pShape
->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")));
1322 pShape
->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")));
1324 eKind
= PRESOBJ_NONE
;
1326 case OBJ_OUTLINETEXT
:
1327 pShape
= new SvxShapeText( pObj
);
1328 pShape
->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")));
1329 eKind
= PRESOBJ_NONE
;
1334 Reference
< drawing::XShape
> xShape( pShape
);
1337 xShape
= SvxFmDrawPage::_CreateShape( pObj
);
1340 if( eKind
!= PRESOBJ_NONE
)
1342 String
aShapeType( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation."));
1347 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("TitleTextShape") );
1349 case PRESOBJ_OUTLINE
:
1350 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("OutlinerShape") );
1353 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("SubtitleShape") );
1355 case PRESOBJ_GRAPHIC
:
1356 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape") );
1358 case PRESOBJ_OBJECT
:
1359 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("OLE2Shape") );
1362 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("ChartShape") );
1364 case PRESOBJ_ORGCHART
:
1365 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("OrgChartShape") );
1368 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("TableShape") );
1370 case PRESOBJ_BACKGROUND
:
1371 DBG_ASSERT( sal_False
, "Danger! Someone got hold of the horrible background shape!" );
1374 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("PageShape") );
1376 case PRESOBJ_HANDOUT
:
1377 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("HandoutShape") );
1380 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("NotesShape") );
1382 case PRESOBJ_FOOTER
:
1383 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("FooterShape") );
1385 case PRESOBJ_HEADER
:
1386 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("HeaderShape") );
1388 case PRESOBJ_SLIDENUMBER
:
1389 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("SlideNumberShape") );
1391 case PRESOBJ_DATETIME
:
1392 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("DateTimeShape") );
1401 pShape
= SvxShape::getImplementation( xShape
);
1404 pShape
->SetShapeType( aShapeType
);
1407 // SdXShape aggregiert SvxShape
1408 new SdXShape( SvxShape::getImplementation( xShape
), GetModel() );
1413 return SvxFmDrawPage::_CreateShape( pObj
);
1418 //----------------------------------------------------------------------
1421 Sequence
< OUString
> SAL_CALL
SdGenericDrawPage::getSupportedServiceNames()
1422 throw(uno::RuntimeException
)
1424 Sequence
< OUString
> aSeq( SvxFmDrawPage::getSupportedServiceNames() );
1425 SvxServiceInfoHelper::addToSequence( aSeq
, 3, "com.sun.star.drawing.GenericDrawPage",
1426 "com.sun.star.document.LinkTarget",
1427 "com.sun.star.document.LinkTargetSupplier");
1431 //----------------------------------------------------------------------
1433 // XLinkTargetSupplier
1434 Reference
< container::XNameAccess
> SAL_CALL
SdGenericDrawPage::getLinks( )
1435 throw(uno::RuntimeException
)
1437 return new SdPageLinkTargets( (SdGenericDrawPage
*)this );
1440 //----------------------------------------------------------------------
1442 void SdGenericDrawPage::setBackground( const Any
& ) throw(lang::IllegalArgumentException
)
1444 DBG_ERROR( "Don't call me, I'm useless!" );
1447 //----------------------------------------------------------------------
1449 void SdGenericDrawPage::getBackground( Any
& ) throw()
1451 DBG_ERROR( "Don't call me, I'm useless!" );
1454 //----------------------------------------------------------------------
1456 OUString
SdGenericDrawPage::getBookmarkURL() const
1458 OUStringBuffer aRet
;
1459 if( SvxFmDrawPage::mpPage
)
1461 OUString
aFileName( static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->GetFileName() );
1462 if( aFileName
.getLength() )
1464 const OUString
aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->GetBookmarkName() ) );
1465 aRet
.append( aFileName
);
1466 aRet
.append( (sal_Unicode
)'#' );
1467 aRet
.append( aBookmarkName
);
1471 return aRet
.makeStringAndClear();
1474 //----------------------------------------------------------------------
1475 void SdGenericDrawPage::setBookmarkURL( rtl::OUString
& rURL
)
1477 if( SvxFmDrawPage::mpPage
)
1479 sal_Int32 nIndex
= rURL
.indexOf( (sal_Unicode
)'#' );
1482 const String
aFileName( rURL
.copy( 0, nIndex
) );
1483 const String
aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL
.copy( nIndex
+1 ) ) );
1485 if( aFileName
.Len() && aBookmarkName
.Len() )
1487 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->DisconnectLink();
1488 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->SetFileName( aFileName
);
1489 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->SetBookmarkName( aBookmarkName
);
1490 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->ConnectLink();
1496 //----------------------------------------------------------------------
1497 Reference
< drawing::XShape
> SAL_CALL
SdGenericDrawPage::combine( const Reference
< drawing::XShapes
>& xShapes
)
1498 throw( uno::RuntimeException
)
1500 OGuard
aGuard( Application::GetSolarMutex() );
1504 DBG_ASSERT(SvxFmDrawPage::mpPage
,"SdrPage ist NULL! [CL]");
1505 DBG_ASSERT(mpView
, "SdrView ist NULL! [CL]");
1507 Reference
< drawing::XShape
> xShape
;
1508 if(mpView
==NULL
||!xShapes
.is()||GetPage()==NULL
)
1511 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1513 _SelectObjectsInView( xShapes
, pPageView
);
1515 mpView
->CombineMarkedObjects( sal_False
);
1517 mpView
->AdjustMarkHdl();
1518 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
1519 if( rMarkList
.GetMarkCount() == 1 )
1521 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
1523 xShape
= Reference
< drawing::XShape
>::query( pObj
->getUnoShape() );
1526 mpView
->HideSdrPage();
1528 GetModel()->SetModified();
1533 //----------------------------------------------------------------------
1534 void SAL_CALL
SdGenericDrawPage::split( const Reference
< drawing::XShape
>& xGroup
)
1535 throw( uno::RuntimeException
)
1537 OGuard
aGuard( Application::GetSolarMutex() );
1541 if(mpView
==NULL
||!xGroup
.is()||GetPage()==NULL
)
1544 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1545 _SelectObjectInView( xGroup
, pPageView
);
1546 mpView
->DismantleMarkedObjects( sal_False
);
1547 mpView
->HideSdrPage();
1549 GetModel()->SetModified();
1552 //----------------------------------------------------------------------
1553 Reference
< drawing::XShape
> SAL_CALL
SdGenericDrawPage::bind( const Reference
< drawing::XShapes
>& xShapes
)
1554 throw( uno::RuntimeException
)
1556 OGuard
aGuard( Application::GetSolarMutex() );
1560 uno::Reference
< drawing::XShape
> xShape
;
1561 if(mpView
==NULL
||!xShapes
.is()||GetPage()==NULL
)
1564 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1566 _SelectObjectsInView( xShapes
, pPageView
);
1568 mpView
->CombineMarkedObjects( sal_True
);
1570 mpView
->AdjustMarkHdl();
1571 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
1572 if( rMarkList
.GetMarkCount() == 1 )
1574 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
1576 xShape
= Reference
< drawing::XShape
>::query( pObj
->getUnoShape() );
1579 mpView
->HideSdrPage();
1581 GetModel()->SetModified();
1586 //----------------------------------------------------------------------
1587 void SAL_CALL
SdGenericDrawPage::unbind( const Reference
< drawing::XShape
>& xShape
)
1588 throw( uno::RuntimeException
)
1590 OGuard
aGuard( Application::GetSolarMutex() );
1594 if(mpView
==NULL
||!xShape
.is()||GetPage()==NULL
)
1597 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1598 _SelectObjectInView( xShape
, pPageView
);
1599 mpView
->DismantleMarkedObjects( sal_True
);
1600 mpView
->HideSdrPage();
1602 GetModel()->SetModified();
1605 void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue
)
1607 if( nValue
!= GetPage()->GetLftBorder() )
1609 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1610 const PageKind ePageKind
= GetPage()->GetPageKind();
1612 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1613 for (i
= 0; i
< nPageCnt
; i
++)
1615 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1616 pPage
->SetLftBorder( nValue
);
1619 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1621 for (i
= 0; i
< nPageCnt
; i
++)
1623 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1624 pPage
->SetLftBorder( nValue
);
1629 void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue
)
1631 if( nValue
!= GetPage()->GetRgtBorder() )
1633 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1634 const PageKind ePageKind
= GetPage()->GetPageKind();
1636 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1637 for (i
= 0; i
< nPageCnt
; i
++)
1639 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1640 pPage
->SetRgtBorder( nValue
);
1643 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1645 for (i
= 0; i
< nPageCnt
; i
++)
1647 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1648 pPage
->SetRgtBorder( nValue
);
1653 void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue
)
1655 if( nValue
!= GetPage()->GetUppBorder() )
1657 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1658 const PageKind ePageKind
= GetPage()->GetPageKind();
1660 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1661 for (i
= 0; i
< nPageCnt
; i
++)
1663 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1664 pPage
->SetUppBorder( nValue
);
1667 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1669 for (i
= 0; i
< nPageCnt
; i
++)
1671 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1672 pPage
->SetUppBorder( nValue
);
1677 void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue
)
1679 if( nValue
!= GetPage()->GetLwrBorder() )
1681 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1682 const PageKind ePageKind
= GetPage()->GetPageKind();
1684 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1685 for (i
= 0; i
< nPageCnt
; i
++)
1687 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1688 pPage
->SetLwrBorder( nValue
);
1691 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1693 for (i
= 0; i
< nPageCnt
; i
++)
1695 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1696 pPage
->SetLwrBorder( nValue
);
1701 static void refreshpage( SdDrawDocument
* pDoc
, const PageKind ePageKind
)
1703 ::sd::DrawDocShell
* pDocShell
= pDoc
->GetDocSh();
1706 ::sd::ViewShell
* pViewSh
= pDocShell
->GetViewShell();
1710 if( pViewSh
->ISA(::sd::DrawViewShell
) )
1711 static_cast< ::sd::DrawViewShell
*>(pViewSh
)->ResetActualPage();
1713 Size aPageSize
= pDoc
->GetSdPage(0, ePageKind
)->GetSize();
1714 const long nWidth
= aPageSize
.Width();
1715 const long nHeight
= aPageSize
.Height();
1717 Point aPageOrg
= Point(nWidth
, nHeight
/ 2);
1718 Size aViewSize
= Size(nWidth
* 3, nHeight
* 2);
1720 pDoc
->SetMaxObjSize(aViewSize
);
1722 pViewSh
->InitWindows(aPageOrg
, aViewSize
, Point(-1, -1), TRUE
);
1724 pViewSh
->UpdateScrollBars();
1729 void SdGenericDrawPage::SetWidth( sal_Int32 nWidth
)
1731 Size
aSize( GetPage()->GetSize() );
1732 if( aSize
.getWidth() != nWidth
)
1734 aSize
.setWidth( nWidth
);
1736 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1737 const PageKind ePageKind
= GetPage()->GetPageKind();
1739 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1740 for (i
= 0; i
< nPageCnt
; i
++)
1742 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1743 pPage
->SetSize(aSize
);
1746 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1748 for (i
= 0; i
< nPageCnt
; i
++)
1750 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1751 pPage
->SetSize(aSize
);
1754 refreshpage( pDoc
, ePageKind
);
1758 void SdGenericDrawPage::SetHeight( sal_Int32 nHeight
)
1760 Size
aSize( GetPage()->GetSize() );
1761 if( aSize
.getHeight() != nHeight
)
1763 aSize
.setHeight( nHeight
);
1765 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1766 const PageKind ePageKind
= GetPage()->GetPageKind();
1768 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1769 for (i
= 0; i
< nPageCnt
; i
++)
1771 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1772 pPage
->SetSize(aSize
);
1775 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1777 for (i
= 0; i
< nPageCnt
; i
++)
1779 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1780 pPage
->SetSize(aSize
);
1783 refreshpage( pDoc
, ePageKind
);
1788 void SdGenericDrawPage::release() throw()
1791 OWeakAggObject::release();
1795 void SdGenericDrawPage::disposing() throw()
1798 SvxFmDrawPage::disposing();
1801 // XAnimationNodeSupplier
1802 Reference
< XAnimationNode
> SAL_CALL
SdGenericDrawPage::getAnimationNode() throw (uno::RuntimeException
)
1804 OGuard
aGuard( Application::GetSolarMutex() );
1808 SdPage
*pSdPage
= static_cast<SdPage
*>(SvxFmDrawPage::mpPage
);
1811 return pSdPage
->getAnimationNode();
1814 //========================================================================
1815 // SdPageLinkTargets
1816 //========================================================================
1818 SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage
* pUnoPage
) throw()
1821 mpUnoPage
= pUnoPage
;
1824 SdPageLinkTargets::~SdPageLinkTargets() throw()
1829 uno::Type SAL_CALL
SdPageLinkTargets::getElementType()
1830 throw(uno::RuntimeException
)
1832 return ITYPE(beans::XPropertySet
);
1835 sal_Bool SAL_CALL
SdPageLinkTargets::hasElements()
1836 throw(uno::RuntimeException
)
1838 OGuard
aGuard( Application::GetSolarMutex() );
1840 SdPage
* pPage
= mpUnoPage
->GetPage();
1843 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1845 while( aIter
.IsMore() )
1847 SdrObject
* pObj
= aIter
.Next();
1848 String
aStr( pObj
->GetName() );
1849 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1850 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1859 // container::XNameAccess
1862 Any SAL_CALL
SdPageLinkTargets::getByName( const OUString
& aName
)
1863 throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
1865 OGuard
aGuard( Application::GetSolarMutex() );
1867 SdPage
* pPage
= mpUnoPage
->GetPage();
1870 SdrObject
* pObj
= FindObject( aName
);
1873 Reference
< beans::XPropertySet
> aRef( pObj
->getUnoShape(), uno::UNO_QUERY
);
1874 return makeAny( aRef
);
1878 throw container::NoSuchElementException();
1881 Sequence
< OUString
> SAL_CALL
SdPageLinkTargets::getElementNames()
1882 throw(uno::RuntimeException
)
1884 OGuard
aGuard( Application::GetSolarMutex() );
1886 sal_uInt32 nObjCount
= 0;
1888 SdPage
* pPage
= mpUnoPage
->GetPage();
1891 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1892 while( aIter
.IsMore() )
1894 SdrObject
* pObj
= aIter
.Next();
1895 String
aStr( pObj
->GetName() );
1896 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1897 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1903 Sequence
< OUString
> aSeq( nObjCount
);
1906 OUString
* pStr
= aSeq
.getArray();
1908 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1909 while( aIter
.IsMore() )
1911 SdrObject
* pObj
= aIter
.Next();
1912 String
aStr( pObj
->GetName() );
1913 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1914 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1923 sal_Bool SAL_CALL
SdPageLinkTargets::hasByName( const OUString
& aName
)
1924 throw(uno::RuntimeException
)
1926 OGuard
aGuard( Application::GetSolarMutex() );
1928 return FindObject( aName
) != NULL
;
1931 /***********************************************************************
1933 ***********************************************************************/
1934 SdrObject
* SdPageLinkTargets::FindObject( const String
& rName
) const throw()
1936 SdPage
* pPage
= mpUnoPage
->GetPage();
1940 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1942 while( aIter
.IsMore() )
1944 SdrObject
* pObj
= aIter
.Next();
1945 String
aStr( pObj
->GetName() );
1946 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1947 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1948 if( aStr
.Len() && (aStr
== rName
) )
1956 OUString SAL_CALL
SdPageLinkTargets::getImplementationName()
1957 throw(uno::RuntimeException
)
1959 return OUString( RTL_CONSTASCII_USTRINGPARAM("SdPageLinkTargets") );
1962 sal_Bool SAL_CALL
SdPageLinkTargets::supportsService( const OUString
& ServiceName
)
1963 throw(uno::RuntimeException
)
1965 return SvxServiceInfoHelper::supportsService( ServiceName
, getSupportedServiceNames() );
1968 Sequence
< OUString
> SAL_CALL
SdPageLinkTargets::getSupportedServiceNames()
1969 throw(uno::RuntimeException
)
1971 const OUString
aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") );
1972 Sequence
< OUString
> aSeq( &aSN
, 1);
1976 //========================================================================
1978 //========================================================================
1980 SdDrawPage::SdDrawPage( SdXImpressDocument
* pModel
, SdPage
* pPage
) throw()
1981 : SdGenericDrawPage( pModel
, pPage
, ImplGetDrawPagePropertySet( pModel
->IsImpressDocument(), pPage
->GetPageKind() ) )
1985 SdDrawPage::~SdDrawPage() throw()
1990 Any SAL_CALL
SdDrawPage::queryInterface( const uno::Type
& rType
)
1991 throw(uno::RuntimeException
)
1993 if( rType
== ITYPE( drawing::XMasterPageTarget
) )
1995 return makeAny( Reference
< drawing::XMasterPageTarget
>( this ) );
1999 if( mbIsImpressDocument
)
2001 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
2003 if( ePageKind
!= PK_HANDOUT
&& rType
== ITYPE( presentation::XPresentationPage
) )
2005 return makeAny( Reference
< presentation::XPresentationPage
>( this ) );
2010 return SdGenericDrawPage::queryInterface( rType
);
2013 void SAL_CALL
SdDrawPage::acquire() throw()
2015 SvxDrawPage::acquire();
2018 void SAL_CALL
SdDrawPage::release() throw()
2020 SvxDrawPage::release();
2023 UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage
, SdGenericDrawPage
);
2026 Sequence
< uno::Type
> SAL_CALL
SdDrawPage::getTypes() throw(uno::RuntimeException
)
2028 OGuard
aGuard( Application::GetSolarMutex() );
2032 if( maTypeSequence
.getLength() == 0 )
2034 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
2035 sal_Bool bPresPage
= mbIsImpressDocument
&& ePageKind
!= PK_HANDOUT
;
2037 // Collect the types of this class.
2038 ::std::vector
<uno::Type
> aTypes
;
2040 aTypes
.push_back(ITYPE(drawing::XDrawPage
));
2041 aTypes
.push_back(ITYPE(beans::XPropertySet
));
2042 aTypes
.push_back(ITYPE(container::XNamed
));
2043 aTypes
.push_back(ITYPE(drawing::XMasterPageTarget
));
2044 aTypes
.push_back(ITYPE(lang::XServiceInfo
));
2045 aTypes
.push_back(ITYPE(util::XReplaceable
));
2046 aTypes
.push_back(ITYPE(document::XLinkTargetSupplier
));
2047 aTypes
.push_back(ITYPE( drawing::XShapeCombiner
));
2048 aTypes
.push_back(ITYPE( drawing::XShapeBinder
));
2049 aTypes
.push_back(ITYPE( beans::XMultiPropertySet
));
2051 aTypes
.push_back(ITYPE(presentation::XPresentationPage
));
2052 if( bPresPage
&& ePageKind
== PK_STANDARD
)
2053 aTypes
.push_back(ITYPE(XAnimationNodeSupplier
));
2055 // Get types of base class.
2056 const Sequence
< uno::Type
> aBaseTypes( SdGenericDrawPage::getTypes() );
2057 const sal_Int32 nBaseTypes
= aBaseTypes
.getLength();
2058 const uno::Type
* pBaseTypes
= aBaseTypes
.getConstArray();
2060 // Join those types in a sequence.
2061 maTypeSequence
.realloc(aTypes
.size() + nBaseTypes
);
2062 uno::Type
* pTypes
= maTypeSequence
.getArray();
2063 ::std::vector
<uno::Type
>::const_iterator iType
;
2064 for (iType
=aTypes
.begin(); iType
!=aTypes
.end(); ++iType
)
2066 for( sal_Int32 nType
= 0; nType
< nBaseTypes
; nType
++ )
2067 *pTypes
++ = *pBaseTypes
++;
2070 return maTypeSequence
;
2073 Sequence
< sal_Int8
> SAL_CALL
SdDrawPage::getImplementationId() throw(uno::RuntimeException
)
2075 OGuard
aGuard( Application::GetSolarMutex() );
2079 static Sequence
< sal_Int8
> aId
;
2080 if( aId
.getLength() == 0 )
2083 rtl_createUuid( (sal_uInt8
*)aId
.getArray(), 0, sal_True
);
2088 OUString
SdDrawPage::getPageApiName( SdPage
* pPage
)
2090 return ::getPageApiName( pPage
);
2093 OUString
getPageApiName( SdPage
* pPage
)
2099 aPageName
= pPage
->GetRealName();
2101 if( aPageName
.getLength() == 0 )
2103 OUStringBuffer sBuffer
;
2104 sBuffer
.appendAscii( RTL_CONSTASCII_STRINGPARAM( sEmptyPageName
) );
2105 const sal_Int32 nPageNum
= ( ( pPage
->GetPageNum() - 1 ) >> 1 ) + 1;
2106 sBuffer
.append( nPageNum
);
2107 aPageName
= sBuffer
.makeStringAndClear();
2115 OUString
getPageApiNameFromUiName( const String
& rUIName
)
2119 String
aDefPageName(SdResId(STR_PAGE
));
2120 aDefPageName
+= sal_Unicode( ' ' );
2122 if( rUIName
.Equals( aDefPageName
, 0, aDefPageName
.Len() ) )
2124 aApiName
= OUString( RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName
) );
2125 aApiName
+= rUIName
.Copy( aDefPageName
.Len() );
2135 OUString
SdDrawPage::getPageApiNameFromUiName( const String
& rUIName
)
2137 return ::getPageApiNameFromUiName( rUIName
);
2140 String
getUiNameFromPageApiNameImpl( const OUString
& rApiName
)
2142 const String
aDefPageName(RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName
));
2143 if( rApiName
.compareTo( aDefPageName
, aDefPageName
.Len() ) == 0 )
2145 OUString
aNumber( rApiName
.copy( sizeof( sEmptyPageName
) - 1 ) );
2147 // create the page number
2148 sal_Int32 nPageNumber
= aNumber
.toInt32();
2150 // check if there are non number characters in the number part
2151 const sal_Int32 nChars
= aNumber
.getLength();
2152 const sal_Unicode
* pString
= aNumber
.getStr();
2154 for( nChar
= 0; nChar
< nChars
; nChar
++, pString
++ )
2156 if((*pString
< sal_Unicode('0')) || (*pString
> sal_Unicode('9')))
2158 // found a non number character, so this is not the default
2159 // name for this page
2165 if( nPageNumber
!= -1)
2167 OUStringBuffer sBuffer
;
2168 sBuffer
.append( String(SdResId(STR_PAGE
)) );
2169 sBuffer
.append( sal_Unicode( ' ' ) );
2170 sBuffer
.append( aNumber
);
2171 return sBuffer
.makeStringAndClear();
2178 String
SdDrawPage::getUiNameFromPageApiName( const OUString
& rApiName
)
2180 return getUiNameFromPageApiNameImpl( rApiName
);
2184 OUString SAL_CALL
SdDrawPage::getImplementationName() throw(uno::RuntimeException
)
2186 return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDrawPage") );
2189 Sequence
< OUString
> SAL_CALL
SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException
)
2191 OGuard
aGuard( Application::GetSolarMutex() );
2195 Sequence
< OUString
> aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2196 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.drawing.DrawPage" );
2198 if( mbIsImpressDocument
)
2199 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.presentation.DrawPage" );
2204 sal_Bool SAL_CALL
SdDrawPage::supportsService( const OUString
& ServiceName
)
2205 throw(uno::RuntimeException
)
2207 return SdGenericDrawPage::supportsService( ServiceName
);
2211 void SAL_CALL
SdDrawPage::setName( const OUString
& rName
)
2212 throw(uno::RuntimeException
)
2214 OGuard
aGuard( Application::GetSolarMutex() );
2218 DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
2220 OUString
aName( rName
);
2222 if(GetPage() && GetPage()->GetPageKind() != PK_NOTES
)
2224 // check if this is the default 'page1234' name
2225 if(aName
.compareToAscii( sEmptyPageName
, sizeof( sEmptyPageName
) - 1 ) == 0)
2227 // ok, it maybe is, first get the number part after 'page'
2228 OUString
aNumber( aName
.copy( sizeof( sEmptyPageName
) - 1 ) );
2230 // create the page number
2231 sal_Int32 nPageNumber
= aNumber
.toInt32();
2233 // check if there are non number characters in the number part
2234 const sal_Int32 nChars
= aNumber
.getLength();
2235 const sal_Unicode
* pString
= aNumber
.getStr();
2237 for( nChar
= 0; nChar
< nChars
; nChar
++, pString
++ )
2239 if((*pString
< '0') || (*pString
> '9'))
2241 // found a non number character, so this is not the default
2242 // name for this page
2248 if( nPageNumber
== ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
2253 String
aDefaultPageName( SdResId(STR_PAGE
) );
2254 aDefaultPageName
+= sal_Unicode( ' ' );
2255 if( aName
.compareTo( aDefaultPageName
, aDefaultPageName
.Len() ) == 0 )
2259 GetPage()->SetName( aName
);
2261 USHORT nNotesPageNum
= (GetPage()->GetPageNum()-1)>>1;
2262 if( GetModel()->GetDoc()->GetSdPageCount( PK_NOTES
) > nNotesPageNum
)
2264 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetSdPage( nNotesPageNum
, PK_NOTES
);
2266 pNotesPage
->SetName(aName
);
2269 // fake a mode change to repaint the page tab bar
2270 ::sd::DrawDocShell
* pDocSh
= GetModel()->GetDocShell();
2271 ::sd::ViewShell
* pViewSh
= pDocSh
? pDocSh
->GetViewShell() : NULL
;
2272 if( pViewSh
&& pViewSh
->ISA(::sd::DrawViewShell
))
2274 ::sd::DrawViewShell
* pDrawViewSh
= static_cast<
2275 ::sd::DrawViewShell
*>(pViewSh
);
2277 EditMode eMode
= pDrawViewSh
->GetEditMode();
2278 if( eMode
== EM_PAGE
)
2280 BOOL bLayer
= pDrawViewSh
->IsLayerModeActive();
2282 pDrawViewSh
->ChangeEditMode( eMode
, !bLayer
);
2283 pDrawViewSh
->ChangeEditMode( eMode
, bLayer
);
2287 GetModel()->SetModified();
2291 OUString SAL_CALL
SdDrawPage::getName()
2292 throw(uno::RuntimeException
)
2294 OGuard
aGuard( Application::GetSolarMutex() );
2298 return getPageApiName( GetPage() );
2301 // XMasterPageTarget
2302 Reference
< drawing::XDrawPage
> SAL_CALL
SdDrawPage::getMasterPage( )
2303 throw(uno::RuntimeException
)
2305 OGuard
aGuard( Application::GetSolarMutex() );
2311 Reference
< drawing::XDrawPages
> xPages( GetModel()->getMasterPages() );
2312 Reference
< drawing::XDrawPage
> xPage
;
2314 if(SvxFmDrawPage::mpPage
->TRG_HasMasterPage())
2316 SdrPage
& rMasterPage
= SvxFmDrawPage::mpPage
->TRG_GetMasterPage();
2317 xPage
= uno::Reference
< drawing::XDrawPage
>( rMasterPage
.getUnoPage(), uno::UNO_QUERY
);
2325 void SAL_CALL
SdDrawPage::setMasterPage( const Reference
< drawing::XDrawPage
>& xMasterPage
)
2326 throw(uno::RuntimeException
)
2328 OGuard
aGuard( Application::GetSolarMutex() );
2332 if(SvxFmDrawPage::mpPage
)
2334 SdMasterPage
* pMasterPage
= SdMasterPage::getImplementation( xMasterPage
);
2335 if( pMasterPage
&& pMasterPage
->isValid() )
2337 SvxFmDrawPage::mpPage
->TRG_ClearMasterPage();
2339 SdPage
* pSdPage
= (SdPage
*) pMasterPage
->GetSdrPage();
2340 SvxFmDrawPage::mpPage
->TRG_SetMasterPage(*pSdPage
);
2342 SvxFmDrawPage::mpPage
->SetBorder(pSdPage
->GetLftBorder(),pSdPage
->GetUppBorder(),
2343 pSdPage
->GetRgtBorder(),pSdPage
->GetLwrBorder() );
2345 SvxFmDrawPage::mpPage
->SetSize( pSdPage
->GetSize() );
2346 SvxFmDrawPage::mpPage
->SetOrientation( pSdPage
->GetOrientation() );
2347 ((SdPage
*)SvxFmDrawPage::mpPage
)->SetLayoutName( ( (SdPage
*)pSdPage
)->GetLayoutName() );
2349 // set notes master also
2350 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PK_NOTES
);
2352 pNotesPage
->TRG_ClearMasterPage();
2353 sal_uInt16 nNum
= (SvxFmDrawPage::mpPage
->TRG_GetMasterPage()).GetPageNum() + 1;
2354 pNotesPage
->TRG_SetMasterPage(*SvxFmDrawPage::mpPage
->GetModel()->GetMasterPage(nNum
));
2355 pNotesPage
->SetLayoutName( ( (SdPage
*)pSdPage
)->GetLayoutName() );
2357 GetModel()->SetModified();
2363 // XPresentationPage
2364 Reference
< drawing::XDrawPage
> SAL_CALL
SdDrawPage::getNotesPage()
2365 throw(uno::RuntimeException
)
2367 OGuard
aGuard( Application::GetSolarMutex() );
2371 if(SvxFmDrawPage::mpPage
&& GetModel()->GetDoc() && SvxFmDrawPage::mpPage
->GetPageNum() )
2373 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PK_NOTES
);
2376 Reference
< drawing::XDrawPage
> xPage( pNotesPage
->getUnoPage(), uno::UNO_QUERY
);
2385 sal_Int32 SAL_CALL
SdDrawPage::getCount()
2386 throw(uno::RuntimeException
)
2388 return SdGenericDrawPage::getCount();
2391 Any SAL_CALL
SdDrawPage::getByIndex( sal_Int32 Index
)
2392 throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
2394 return SdGenericDrawPage::getByIndex( Index
);
2398 uno::Type SAL_CALL
SdDrawPage::getElementType()
2399 throw(uno::RuntimeException
)
2401 return SdGenericDrawPage::getElementType();
2404 sal_Bool SAL_CALL
SdDrawPage::hasElements()
2405 throw(uno::RuntimeException
)
2407 return SdGenericDrawPage::hasElements();
2411 void SAL_CALL
SdDrawPage::add( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
2413 SdGenericDrawPage::add( xShape
);
2416 void SAL_CALL
SdDrawPage::remove( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
2418 OGuard
aGuard( Application::GetSolarMutex() );
2422 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
2425 SdrObject
* pObj
= pShape
->GetSdrObject();
2428 GetPage()->RemovePresObj(pObj
);
2429 pObj
->SetUserCall(NULL
);
2433 SdGenericDrawPage::remove( xShape
);
2436 void SdDrawPage::setBackground( const Any
& rValue
)
2437 throw( lang::IllegalArgumentException
)
2439 Reference
< beans::XPropertySet
> xSet
;
2441 if( !(rValue
>>= xSet
) && !rValue
.hasValue() )
2442 throw lang::IllegalArgumentException();
2446 // the easy case, clear the background obj
2447 GetPage()->SetBackgroundObj( NULL
);
2450 // tell the page that it's visualization has changed
2451 GetPage()->ActionChanged();
2456 // prepare background object
2457 SdrObject
* pObj
= GetPage()->GetBackgroundObj();
2460 pObj
= new SdrRectObj();
2461 GetPage()->SetBackgroundObj( pObj
);
2464 // tell the page that it's visualization has changed
2465 GetPage()->ActionChanged();
2468 const sal_Int32 nLeft
= GetPage()->GetLftBorder();
2469 const sal_Int32 nRight
= GetPage()->GetRgtBorder();
2470 const sal_Int32 nUpper
= GetPage()->GetUppBorder();
2471 const sal_Int32 nLower
= GetPage()->GetLwrBorder();
2473 Point
aPos ( nLeft
, nRight
);
2474 Size
aSize( GetPage()->GetSize() );
2475 aSize
.Width() -= nLeft
+ nRight
- 1;
2476 aSize
.Height() -= nUpper
+ nLower
- 1;
2477 Rectangle
aRect( aPos
, aSize
);
2478 pObj
->SetLogicRect( aRect
);
2480 // is it our own implementation?
2481 SdUnoPageBackground
* pBack
= SdUnoPageBackground::getImplementation( xSet
);
2483 SfxItemSet
aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST
, XATTR_FILL_LAST
);
2487 pBack
->fillItemSet( (SdDrawDocument
*)GetPage()->GetModel(), aSet
);
2491 SdUnoPageBackground
* pBackground
= new SdUnoPageBackground();
2493 Reference
< beans::XPropertySetInfo
> xSetInfo( xSet
->getPropertySetInfo() );
2494 Reference
< beans::XPropertySet
> xDestSet( (beans::XPropertySet
*)pBackground
);
2495 Reference
< beans::XPropertySetInfo
> xDestSetInfo( xDestSet
->getPropertySetInfo() );
2497 Sequence
< beans::Property
> aProperties( xDestSetInfo
->getProperties() );
2498 sal_Int32 nCount
= aProperties
.getLength();
2499 beans::Property
* pProp
= aProperties
.getArray();
2503 const OUString
aPropName( pProp
->Name
);
2504 if( xSetInfo
->hasPropertyByName( aPropName
) )
2505 xDestSet
->setPropertyValue( aPropName
,
2506 xSet
->getPropertyValue( aPropName
) );
2511 pBackground
->fillItemSet( (SdDrawDocument
*)GetPage()->GetModel(), aSet
);
2514 //-/ pObj->NbcSetAttributes( aSet, sal_False );
2515 if( aSet
.Count() == 0 )
2517 GetPage()->SetBackgroundObj( NULL
);
2521 pObj
->SetMergedItemSet(aSet
);
2525 SvxFmDrawPage::mpPage
->ActionChanged();
2526 // pPage->SendRepaintBroadcast();
2529 void SdDrawPage::getBackground( Any
& rValue
) throw()
2531 SdrObject
* pObj
= GetPage()->GetBackgroundObj();
2538 Reference
< beans::XPropertySet
> xSet( new SdUnoPageBackground( GetModel()->GetDoc(), pObj
) );
2543 void SdGenericDrawPage::setNavigationOrder( const Any
& rValue
)
2545 Reference
< XIndexAccess
> xIA( rValue
, UNO_QUERY
);
2548 if( dynamic_cast< SdDrawPage
* >( xIA
.get() ) == this )
2550 if( GetPage()->HasObjectNavigationOrder() )
2551 GetPage()->ClearObjectNavigationOrder();
2555 else if( xIA
->getCount() == static_cast< sal_Int32
>( GetPage()->GetObjCount() ) )
2557 GetPage()->SetNavigationOrder(xIA
);
2561 throw IllegalArgumentException();
2564 class NavigationOrderAccess
: public ::cppu::WeakImplHelper1
< XIndexAccess
>
2567 NavigationOrderAccess( SdrPage
* pPage
);
2570 virtual sal_Int32 SAL_CALL
getCount( ) throw (RuntimeException
);
2571 virtual Any SAL_CALL
getByIndex( sal_Int32 Index
) throw (IndexOutOfBoundsException
, WrappedTargetException
, RuntimeException
);
2574 virtual Type SAL_CALL
getElementType( ) throw (RuntimeException
);
2575 virtual sal_Bool SAL_CALL
hasElements( ) throw (RuntimeException
);
2578 std::vector
< Reference
< XShape
> > maShapes
;
2581 NavigationOrderAccess::NavigationOrderAccess( SdrPage
* pPage
)
2582 : maShapes( static_cast< sal_uInt32
>( pPage
? pPage
->GetObjCount() : 0 ) )
2587 const sal_uInt32 nCount
= static_cast< sal_uInt32
>( pPage
->GetObjCount() );
2588 for( nIndex
= 0; nIndex
< nCount
; ++nIndex
)
2590 SdrObject
* pObj
= pPage
->GetObj( nIndex
);
2591 sal_uInt32 nNavPos
= pObj
->GetNavigationPosition();
2592 DBG_ASSERT( !maShapes
[nNavPos
].is(), "sd::NavigationOrderAccess::NavigationOrderAccess(), duplicate navigation positions from core!" );
2593 maShapes
[nNavPos
] = Reference
< XShape
>( pObj
->getUnoShape(), UNO_QUERY
);
2599 sal_Int32 SAL_CALL
NavigationOrderAccess::getCount( ) throw (RuntimeException
)
2601 return static_cast< sal_Int32
>( maShapes
.size() );
2604 Any SAL_CALL
NavigationOrderAccess::getByIndex( sal_Int32 Index
) throw (IndexOutOfBoundsException
, WrappedTargetException
, RuntimeException
)
2606 if( (Index
< 0) || (Index
> getCount()) )
2607 throw IndexOutOfBoundsException();
2609 return Any( maShapes
[Index
] );
2613 Type SAL_CALL
NavigationOrderAccess::getElementType( ) throw (RuntimeException
)
2615 return XShape::static_type();
2618 sal_Bool SAL_CALL
NavigationOrderAccess::hasElements( ) throw (RuntimeException
)
2620 return maShapes
.empty() ? sal_False
: sal_True
;
2623 Any
SdGenericDrawPage::getNavigationOrder()
2625 if( GetPage()->HasObjectNavigationOrder() )
2627 return Any( Reference
< XIndexAccess
>( new NavigationOrderAccess( GetPage() ) ) );
2631 return Any( Reference
< XIndexAccess
>( this ) );
2635 //========================================================================
2636 // class SdMasterPage
2637 //========================================================================
2639 SdMasterPage::SdMasterPage( SdXImpressDocument
* pModel
, SdPage
* pPage
) throw()
2640 : SdGenericDrawPage( pModel
, pPage
, ImplGetMasterPagePropertySet( pPage
? pPage
->GetPageKind() : PK_STANDARD
) )
2642 mbHasBackgroundObject
= pPage
&& GetPage()->GetPageKind() == PK_STANDARD
;
2645 SdMasterPage::~SdMasterPage() throw()
2650 Any SAL_CALL
SdMasterPage::queryInterface( const uno::Type
& rType
)
2651 throw(uno::RuntimeException
)
2653 OGuard
aGuard( Application::GetSolarMutex() );
2659 if( rType
== ITYPE( container::XIndexAccess
) )
2660 aAny
<<= Reference
< container::XIndexAccess
>((presentation::XPresentationPage
*)(this));
2661 else if( rType
== ITYPE( container::XElementAccess
) )
2662 aAny
<<= Reference
< container::XElementAccess
>((presentation::XPresentationPage
*)(this));
2663 else if( rType
== ITYPE( container::XNamed
) )
2664 aAny
<<= Reference
< container::XNamed
>(this);
2665 else if( rType
== ITYPE( presentation::XPresentationPage
) &&
2666 ( mbIsImpressDocument
&&
2667 GetPage() && GetPage()->GetPageKind() != PK_HANDOUT
) )
2668 aAny
<<= Reference
< presentation::XPresentationPage
>( this );
2670 return SdGenericDrawPage::queryInterface( rType
);
2675 void SAL_CALL
SdMasterPage::acquire() throw()
2677 SvxDrawPage::acquire();
2680 void SAL_CALL
SdMasterPage::release() throw()
2682 SvxDrawPage::release();
2685 UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage
, SdGenericDrawPage
);
2688 Sequence
< uno::Type
> SAL_CALL
SdMasterPage::getTypes() throw(uno::RuntimeException
)
2690 OGuard
aGuard( Application::GetSolarMutex() );
2694 if( maTypeSequence
.getLength() == 0 )
2696 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
2697 sal_Bool bPresPage
= mbIsImpressDocument
&& SvxFmDrawPage::mpPage
&& ePageKind
!= PK_HANDOUT
;
2699 // Collect the types of this class.
2700 ::std::vector
<uno::Type
> aTypes
;
2702 aTypes
.push_back(ITYPE(drawing::XDrawPage
));
2703 aTypes
.push_back(ITYPE(beans::XPropertySet
));
2704 aTypes
.push_back(ITYPE(container::XNamed
));
2705 aTypes
.push_back(ITYPE(lang::XServiceInfo
));
2706 aTypes
.push_back(ITYPE(util::XReplaceable
));
2707 aTypes
.push_back(ITYPE(document::XLinkTargetSupplier
));
2708 aTypes
.push_back(ITYPE( drawing::XShapeCombiner
));
2709 aTypes
.push_back(ITYPE( drawing::XShapeBinder
));
2710 aTypes
.push_back(ITYPE( beans::XMultiPropertySet
));
2712 aTypes
.push_back(ITYPE(presentation::XPresentationPage
));
2713 if( bPresPage
&& ePageKind
== PK_STANDARD
)
2714 aTypes
.push_back(ITYPE(XAnimationNodeSupplier
));
2716 // Get types of base class.
2717 const Sequence
< uno::Type
> aBaseTypes( SdGenericDrawPage::getTypes() );
2718 const sal_Int32 nBaseTypes
= aBaseTypes
.getLength();
2719 const uno::Type
* pBaseTypes
= aBaseTypes
.getConstArray();
2721 // Join those types in a sequence.
2722 maTypeSequence
.realloc(aTypes
.size() + nBaseTypes
);
2723 uno::Type
* pTypes
= maTypeSequence
.getArray();
2724 ::std::vector
<uno::Type
>::const_iterator iType
;
2725 for (iType
=aTypes
.begin(); iType
!=aTypes
.end(); ++iType
)
2727 for( sal_Int32 nType
= 0; nType
< nBaseTypes
; nType
++ )
2728 *pTypes
++ = *pBaseTypes
++;
2731 return maTypeSequence
;
2734 Sequence
< sal_Int8
> SAL_CALL
SdMasterPage::getImplementationId() throw(uno::RuntimeException
)
2736 OGuard
aGuard( Application::GetSolarMutex() );
2740 static Sequence
< sal_Int8
> aId
;
2741 if( aId
.getLength() == 0 )
2744 rtl_createUuid( (sal_uInt8
*)aId
.getArray(), 0, sal_True
);
2750 OUString SAL_CALL
SdMasterPage::getImplementationName() throw(uno::RuntimeException
)
2752 return OUString( RTL_CONSTASCII_USTRINGPARAM("SdMasterPage") );
2755 Sequence
< OUString
> SAL_CALL
SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException
)
2757 OGuard
aGuard( Application::GetSolarMutex() );
2761 Sequence
< OUString
> aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2762 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.drawing.MasterPage" );
2764 if( SvxFmDrawPage::mpPage
&& ((SdPage
*)SvxFmDrawPage::mpPage
)->GetPageKind() == PK_HANDOUT
)
2765 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.presentation.HandoutMasterPage" );
2770 sal_Bool SAL_CALL
SdMasterPage::supportsService( const OUString
& ServiceName
)
2771 throw(uno::RuntimeException
)
2773 return SdGenericDrawPage::supportsService( ServiceName
);
2777 sal_Bool SAL_CALL
SdMasterPage::hasElements() throw(uno::RuntimeException
)
2779 OGuard
aGuard( Application::GetSolarMutex() );
2783 if( SvxFmDrawPage::mpPage
== NULL
)
2786 return (SvxFmDrawPage::mpPage
->GetObjCount() > 1) || (!mbHasBackgroundObject
&& SvxFmDrawPage::mpPage
->GetObjCount() == 1 );
2789 uno::Type SAL_CALL
SdMasterPage::getElementType()
2790 throw(uno::RuntimeException
)
2792 return SdGenericDrawPage::getElementType();
2796 sal_Int32 SAL_CALL
SdMasterPage::getCount()
2797 throw(uno::RuntimeException
)
2799 OGuard
aGuard( Application::GetSolarMutex() );
2803 sal_Int32 nCount
= SdGenericDrawPage::getCount();
2804 DBG_ASSERT( !mbHasBackgroundObject
|| (nCount
> 0), "possible wrong shape count!" );
2806 if( mbHasBackgroundObject
&& ( nCount
> 0 ) )
2812 Any SAL_CALL
SdMasterPage::getByIndex( sal_Int32 Index
)
2813 throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
2815 OGuard
aGuard( Application::GetSolarMutex() );
2819 if( mbHasBackgroundObject
)
2822 return SdGenericDrawPage::getByIndex(Index
);
2826 void SdMasterPage::setBackground( const Any
& rValue
)
2827 throw( lang::IllegalArgumentException
)
2829 // we need at least an beans::XPropertySet
2830 Reference
< beans::XPropertySet
> xInputSet( rValue
, UNO_QUERY
);
2831 if( !xInputSet
.is() )
2832 throw lang::IllegalArgumentException();
2836 if( GetModel() && mbIsImpressDocument
)
2838 Reference
< container::XNameAccess
> xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW
);
2839 Reference
< container::XNameAccess
> xFamily( xFamilies
->getByName( getName() ), UNO_QUERY_THROW
) ;
2842 OUString
aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background
) );
2844 Reference
< beans::XPropertySet
> xStyleSet( xFamily
->getByName( aStyleName
), UNO_QUERY_THROW
);
2846 Reference
< beans::XPropertySetInfo
> xSetInfo( xInputSet
->getPropertySetInfo(), UNO_QUERY_THROW
);
2847 Reference
< beans::XPropertyState
> xSetStates( xInputSet
, UNO_QUERY
);
2849 PropertyEntryVector_t aBackgroundProperties
= ImplGetPageBackgroundPropertySet()->getPropertyMap()->getPropertyEntries();
2850 PropertyEntryVector_t::const_iterator aIt
= aBackgroundProperties
.begin();
2851 while( aIt
!= aBackgroundProperties
.end() )
2853 if( xSetInfo
->hasPropertyByName( aIt
->sName
) )
2855 if( !xSetStates
.is() || xSetStates
->getPropertyState( aIt
->sName
) == beans::PropertyState_DIRECT_VALUE
)
2856 xStyleSet
->setPropertyValue( aIt
->sName
, xInputSet
->getPropertyValue( aIt
->sName
) );
2858 xSetStates
->setPropertyToDefault( aIt
->sName
);
2867 // first fill an item set
2868 // is it our own implementation?
2869 SdUnoPageBackground
* pBack
= SdUnoPageBackground::getImplementation( xInputSet
);
2871 SfxItemSet
aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST
, XATTR_FILL_LAST
);
2875 pBack
->fillItemSet( (SdDrawDocument
*)GetPage()->GetModel(), aSet
);
2879 SdUnoPageBackground
* pBackground
= new SdUnoPageBackground();
2881 Reference
< beans::XPropertySetInfo
> xInputSetInfo( xInputSet
->getPropertySetInfo(), UNO_QUERY_THROW
);
2882 Reference
< beans::XPropertySet
> xDestSet( (beans::XPropertySet
*)pBackground
);
2883 Reference
< beans::XPropertySetInfo
> xDestSetInfo( xDestSet
->getPropertySetInfo(), UNO_QUERY_THROW
);
2885 uno::Sequence
< beans::Property
> aProperties( xDestSetInfo
->getProperties() );
2886 sal_Int32 nCount
= aProperties
.getLength();
2887 beans::Property
* pProp
= aProperties
.getArray();
2891 const OUString
aPropName( pProp
->Name
);
2892 if( xInputSetInfo
->hasPropertyByName( aPropName
) )
2893 xDestSet
->setPropertyValue( aPropName
, xInputSet
->getPropertyValue( aPropName
) );
2898 pBackground
->fillItemSet( (SdDrawDocument
*)SvxFmDrawPage::mpPage
->GetModel(), aSet
);
2901 // if we find the background style, copy the set to the background
2902 SdDrawDocument
* pDoc
= (SdDrawDocument
*)SvxFmDrawPage::mpPage
->GetModel();
2903 SfxStyleSheetBasePool
* pSSPool
= (SfxStyleSheetBasePool
*)pDoc
->GetStyleSheetPool();
2906 String
aLayoutName( static_cast< SdPage
* >( SvxFmDrawPage::mpPage
)->GetLayoutName() );
2907 aLayoutName
.Erase(aLayoutName
.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR
)))+4);
2908 aLayoutName
+= String(SdResId(STR_LAYOUT_BACKGROUND
));
2909 SfxStyleSheetBase
* pStyleSheet
= pSSPool
->Find( aLayoutName
, SD_STYLE_FAMILY_MASTERPAGE
);
2913 pStyleSheet
->GetItemSet().Put( aSet
);
2916 SvxFmDrawPage::mpPage
->ActionChanged();
2922 // if no background style is available, try the background object
2923 SdrObject
* pObj
= GetPage()->GetPresObj(PRESOBJ_BACKGROUND
);
2927 pObj
->SetMergedItemSet(aSet
);
2930 SvxFmDrawPage::mpPage
->ActionChanged();
2935 DBG_ERROR("sd::SdMasterPage::setBackground(), exception caught!");
2939 void SdMasterPage::getBackground( Any
& rValue
) throw()
2941 if( GetModel() ) try
2943 if( mbIsImpressDocument
)
2945 Reference
< container::XNameAccess
> xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW
);
2946 Reference
< container::XNameAccess
> xFamily( xFamilies
->getByName( getName() ), UNO_QUERY_THROW
);
2948 const OUString
aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background
) );
2949 rValue
<<= Reference
< beans::XPropertySet
>( xFamily
->getByName( aStyleName
), UNO_QUERY_THROW
);
2953 SdDrawDocument
* pDoc
= (SdDrawDocument
*)SvxFmDrawPage::mpPage
->GetModel();
2954 SfxStyleSheetBasePool
* pSSPool
= (SfxStyleSheetBasePool
*)pDoc
->GetStyleSheetPool();
2957 String
aLayoutName( static_cast< SdPage
* >(SvxFmDrawPage::mpPage
)->GetLayoutName() );
2958 aLayoutName
.Erase( aLayoutName
.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR
)))+4);
2959 aLayoutName
+= String(SdResId(STR_LAYOUT_BACKGROUND
));
2960 SfxStyleSheetBase
* pStyleSheet
= pSSPool
->Find( aLayoutName
, SD_STYLE_FAMILY_MASTERPAGE
);
2964 SfxItemSet
aStyleSet( pStyleSheet
->GetItemSet());
2965 if( aStyleSet
.Count() )
2967 rValue
<<= Reference
< beans::XPropertySet
>( new SdUnoPageBackground( pDoc
, &aStyleSet
) );
2973 // no stylesheet? try old fashion background rectangle
2974 SdrObject
* pObj
= NULL
;
2975 if( SvxFmDrawPage::mpPage
->GetObjCount() >= 1 )
2977 pObj
= SvxFmDrawPage::mpPage
->GetObj(0);
2978 if( pObj
->GetObjInventor() != SdrInventor
|| pObj
->GetObjIdentifier() != OBJ_RECT
)
2984 rValue
<<= Reference
< beans::XPropertySet
>( new SdUnoPageBackground( GetModel()->GetDoc(), pObj
) );
2995 DBG_ERROR("sd::SdMasterPage::getBackground(), exception caught!");
3000 void SAL_CALL
SdMasterPage::setName( const OUString
& aName
)
3001 throw(uno::RuntimeException
)
3003 OGuard
aGuard( Application::GetSolarMutex() );
3007 if(SvxFmDrawPage::mpPage
&& GetPage()->GetPageKind() != PK_NOTES
)
3009 String
aNewName( aName
);
3010 GetPage()->SetName( aNewName
);
3012 if(GetModel()->GetDoc())
3013 GetModel()->GetDoc()->RenameLayoutTemplate(GetPage()->GetLayoutName(), aNewName
);
3015 // fake a mode change to repaint the page tab bar
3016 ::sd::DrawDocShell
* pDocSh
= GetModel()->GetDocShell();
3017 ::sd::ViewShell
* pViewSh
= pDocSh
? pDocSh
->GetViewShell() : NULL
;
3018 if( pViewSh
&& pViewSh
->ISA(::sd::DrawViewShell
) )
3020 ::sd::DrawViewShell
* pDrawViewSh
=
3021 static_cast< ::sd::DrawViewShell
*>(pViewSh
);
3023 EditMode eMode
= pDrawViewSh
->GetEditMode();
3024 if( eMode
== EM_MASTERPAGE
)
3026 BOOL bLayer
= pDrawViewSh
->IsLayerModeActive();
3028 pDrawViewSh
->ChangeEditMode( eMode
, !bLayer
);
3029 pDrawViewSh
->ChangeEditMode( eMode
, bLayer
);
3033 GetModel()->SetModified();
3037 OUString SAL_CALL
SdMasterPage::getName( )
3038 throw(uno::RuntimeException
)
3040 OGuard
aGuard( Application::GetSolarMutex() );
3044 if(SvxFmDrawPage::mpPage
)
3046 String
aLayoutName( GetPage()->GetLayoutName() );
3047 aLayoutName
= aLayoutName
.Erase(aLayoutName
.Search( String( RTL_CONSTASCII_USTRINGPARAM((SD_LT_SEPARATOR
)))));
3055 // XPresentationPage
3056 Reference
< drawing::XDrawPage
> SAL_CALL
SdMasterPage::getNotesPage()
3057 throw(uno::RuntimeException
)
3059 OGuard
aGuard( Application::GetSolarMutex() );
3063 if(SvxFmDrawPage::mpPage
&& GetModel()->GetDoc() )
3065 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PK_NOTES
);
3068 Reference
< drawing::XDrawPage
> xPage( pNotesPage
->getUnoPage(), uno::UNO_QUERY
);
3076 void SAL_CALL
SdMasterPage::add( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
3078 SdGenericDrawPage::add( xShape
);
3081 void SAL_CALL
SdMasterPage::remove( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
3083 OGuard
aGuard( Application::GetSolarMutex() );
3087 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
3090 SdrObject
* pObj
= pShape
->GetSdrObject();
3093 if( GetPage()->IsPresObj( pObj
) )
3094 GetPage()->RemovePresObj(pObj
);
3098 SdGenericDrawPage::remove( xShape
);
3102 Reference
< uno::XInterface
> createUnoPageImpl( SdPage
* pPage
)
3104 Reference
< uno::XInterface
> xPage
;
3106 if( pPage
&& pPage
->GetModel() )
3108 SdXImpressDocument
* pModel
= SdXImpressDocument::getImplementation( pPage
->GetModel()->getUnoModel() );
3111 if( pPage
->IsMasterPage() )
3113 xPage
= (::cppu::OWeakObject
*)new SdMasterPage( pModel
, pPage
);
3117 xPage
= (::cppu::OWeakObject
*)new SdDrawPage( pModel
, pPage
);