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
;
109 using namespace ::com::sun::star::office
;
112 extern Reference
< XAnnotation
> createAnnotation( const Reference
< XComponentContext
>& xContext
, SdPage
* );
113 extern Reference
< XAnnotationEnumeration
> createAnnotationEnumeration( const sd::AnnotationVector
& );
116 /* this are the ids for page properties */
119 WID_PAGE_LEFT
, WID_PAGE_RIGHT
, WID_PAGE_TOP
, WID_PAGE_BOTTOM
, WID_PAGE_WIDTH
,
120 WID_PAGE_HEIGHT
, WID_PAGE_EFFECT
, WID_PAGE_CHANGE
, WID_PAGE_SPEED
, WID_PAGE_NUMBER
,
121 WID_PAGE_ORIENT
, WID_PAGE_LAYOUT
, WID_PAGE_DURATION
, WID_PAGE_LDNAME
, WID_PAGE_LDBITMAP
,
122 WID_PAGE_BACK
, WID_PAGE_PREVIEW
, WID_PAGE_PREVIEWBITMAP
, WID_PAGE_VISIBLE
, WID_PAGE_SOUNDFILE
, WID_PAGE_BACKFULL
,
123 WID_PAGE_BACKVIS
, WID_PAGE_BACKOBJVIS
, WID_PAGE_USERATTRIBS
, WID_PAGE_BOOKMARK
, WID_PAGE_ISDARK
,
124 WID_PAGE_HEADERVISIBLE
, WID_PAGE_HEADERTEXT
, WID_PAGE_FOOTERVISIBLE
, WID_PAGE_FOOTERTEXT
,
125 WID_PAGE_PAGENUMBERVISIBLE
, WID_PAGE_DATETIMEVISIBLE
, WID_PAGE_DATETIMEFIXED
,
126 WID_PAGE_DATETIMETEXT
, WID_PAGE_DATETIMEFORMAT
, WID_TRANSITION_TYPE
, WID_TRANSITION_SUBTYPE
,
127 WID_TRANSITION_DIRECTION
, WID_TRANSITION_FADE_COLOR
, WID_TRANSITION_DURATION
, WID_LOOP_SOUND
,
132 #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
133 #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
135 #define SEQTYPE(x) &(x)
139 static sal_Char __FAR_DATA sEmptyPageName
[sizeof("page")] = "page";
141 /** this function stores the property maps for draw pages in impress and draw */
142 const SvxItemPropertySet
* ImplGetDrawPagePropertySet( sal_Bool bImpress
, PageKind ePageKind
)
144 static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl
[] =
146 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE( beans::XPropertySet
), beans::PropertyAttribute::MAYBEVOID
,0},
147 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM
), WID_PAGE_BOTTOM
, &::getCppuType((const sal_Int32
*)0), 0, 0},
148 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT
), WID_PAGE_LEFT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
149 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT
), WID_PAGE_RIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
150 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP
), WID_PAGE_TOP
, &::getCppuType((const sal_Int32
*)0), 0, 0},
151 { MAP_CHAR_LEN(UNO_NAME_PAGE_CHANGE
), WID_PAGE_CHANGE
, &::getCppuType((const sal_Int32
*)0), 0, 0},
152 { MAP_CHAR_LEN(UNO_NAME_PAGE_DURATION
), WID_PAGE_DURATION
, &::getCppuType((const sal_Int32
*)0), 0, 0},
153 { MAP_CHAR_LEN(UNO_NAME_PAGE_EFFECT
), WID_PAGE_EFFECT
, &::getCppuType((const presentation::FadeEffect
*)0), 0, 0},
154 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT
), WID_PAGE_HEIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
155 { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT
), WID_PAGE_LAYOUT
, &::getCppuType((const sal_Int16
*)0), 0, 0},
156 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP
), WID_PAGE_LDBITMAP
, &ITYPE( awt::XBitmap
), beans::PropertyAttribute::READONLY
, 0},
157 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME
), WID_PAGE_LDNAME
, &::getCppuType((const OUString
*)0), beans::PropertyAttribute::READONLY
, 0},
158 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER
), WID_PAGE_NUMBER
, &::getCppuType((const sal_Int16
*)0), beans::PropertyAttribute::READONLY
, 0},
159 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION
), WID_PAGE_ORIENT
, &::getCppuType((const view::PaperOrientation
*)0),0, 0},
160 { MAP_CHAR_LEN(UNO_NAME_PAGE_SPEED
), WID_PAGE_SPEED
, &::getCppuType((const presentation::AnimationSpeed
*)0), 0, 0},
161 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH
), WID_PAGE_WIDTH
, &::getCppuType((const sal_Int32
*)0), 0, 0},
162 { 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},
163 { 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},
164 { MAP_CHAR_LEN(UNO_NAME_PAGE_VISIBLE
), WID_PAGE_VISIBLE
, &::getBooleanCppuType(), 0, 0},
165 { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE
), WID_PAGE_SOUNDFILE
, &::getCppuType((const Any
*)0), 0, 0},
166 { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundVisible
), WID_PAGE_BACKVIS
, &::getBooleanCppuType(), 0, 0},
167 { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible
), WID_PAGE_BACKOBJVIS
, &::getBooleanCppuType(), 0, 0},
168 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes
),WID_PAGE_USERATTRIBS
, &::getCppuType((const Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
169 { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL
), WID_PAGE_BOOKMARK
, &::getCppuType((const OUString
*)0), 0, 0},
170 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK
, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY
, 0},
171 { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE
, &::getBooleanCppuType(), 0, 0},
172 { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT
, &::getCppuType((const OUString
*)0), 0, 0},
173 { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE
, &::getBooleanCppuType(), 0, 0},
174 { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE
, &::getBooleanCppuType(), 0, 0},
175 { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED
, &::getBooleanCppuType(), 0, 0},
176 { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT
, &::getCppuType((const OUString
*)0), 0, 0},
177 { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
178 { MAP_CHAR_LEN("TransitionType"), WID_TRANSITION_TYPE
, &::getCppuType((const sal_Int16
*)0), 0, 0},
179 { MAP_CHAR_LEN("TransitionSubtype"), WID_TRANSITION_SUBTYPE
, &::getCppuType((const sal_Int16
*)0), 0, 0},
180 { MAP_CHAR_LEN("TransitionDirection"), WID_TRANSITION_DIRECTION
, &::getCppuType((const sal_Bool
*)0), 0, 0},
181 { MAP_CHAR_LEN("TransitionFadeColor"), WID_TRANSITION_FADE_COLOR
, &::getCppuType((const sal_Int32
*)0), 0, 0},
182 { MAP_CHAR_LEN("TransitionDuration"), WID_TRANSITION_DURATION
, &::getCppuType((const double*)0), 0, 0},
183 { MAP_CHAR_LEN("LoopSound"), WID_LOOP_SOUND
, &::getBooleanCppuType(), 0, 0},
184 { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER
, &::com::sun::star::container::XIndexAccess::static_type(),0, 0},
188 #define DRAW_PAGE_NOTES_PROPERTIES \
189 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
190 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
191 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
192 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
193 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
194 { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, \
195 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
196 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
197 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
198 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
199 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
200 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},\
201 { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
202 { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
203 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
204 { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
205 { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
206 { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
207 { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0}, \
208 { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0}, \
209 { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0}, \
210 { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
211 { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
214 static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl
[] =
216 // this must be the first two entries so they can be excluded for PK_STANDARD
217 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE( beans::XPropertySet
), beans::PropertyAttribute::MAYBEVOID
,0},
218 DRAW_PAGE_NOTES_PROPERTIES
220 static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl
[] =
222 DRAW_PAGE_NOTES_PROPERTIES
225 #define GRAPHIC_PAGE_PROPERTIES \
226 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
227 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
228 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
229 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
230 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
231 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
232 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
233 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
234 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
235 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
236 { 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}, \
237 { 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},\
238 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, \
239 { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, \
240 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
241 { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
244 static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl
[] =
246 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE( beans::XPropertySet
), beans::PropertyAttribute::MAYBEVOID
,0},
247 GRAPHIC_PAGE_PROPERTIES
249 static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl
[] =
251 GRAPHIC_PAGE_PROPERTIES
255 bool bWithoutBackground
= ePageKind
!= PK_STANDARD
&& ePageKind
!= PK_HANDOUT
;
256 const SvxItemPropertySet
* pRet
= 0;
259 if( ePageKind
== PK_STANDARD
)
261 //PK_STANDARD always has a background property
262 static SvxItemPropertySet
aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl
);
263 pRet
= &aDrawPagePropertySet_Impl
;
267 if(bWithoutBackground
)
269 static SvxItemPropertySet
aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl
);
270 pRet
= &aDrawPageNotesHandoutPropertyNoBackSet_Impl
;
274 static SvxItemPropertySet
aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl
);
275 pRet
= &aDrawPageNotesHandoutPropertySet_Impl
;
281 if(bWithoutBackground
)
283 static SvxItemPropertySet
aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl
);
284 pRet
= &aGraphicPagePropertyNoBackSet_Impl
;
288 static SvxItemPropertySet
aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl
);
289 pRet
= &aGraphicPagePropertySet_Impl
;
295 /** this function stores the property map for master pages in impress and draw */
296 const SvxItemPropertySet
* ImplGetMasterPagePropertySet( PageKind ePageKind
)
298 static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl
[] =
300 { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND
), WID_PAGE_BACK
, &ITYPE(beans::XPropertySet
), 0, 0},
301 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM
), WID_PAGE_BOTTOM
, &::getCppuType((const sal_Int32
*)0), 0, 0},
302 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT
), WID_PAGE_LEFT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
303 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT
), WID_PAGE_RIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
304 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP
), WID_PAGE_TOP
, &::getCppuType((const sal_Int32
*)0), 0, 0},
305 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT
), WID_PAGE_HEIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
306 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP
), WID_PAGE_LDBITMAP
, &ITYPE(awt::XBitmap
), beans::PropertyAttribute::READONLY
, 0},
307 { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME
), WID_PAGE_LDNAME
, &::getCppuType((const OUString
*)0), beans::PropertyAttribute::READONLY
, 0},
308 { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER
), WID_PAGE_NUMBER
, &::getCppuType((const sal_Int16
*)0), beans::PropertyAttribute::READONLY
, 0},
309 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION
), WID_PAGE_ORIENT
, &::getCppuType((const view::PaperOrientation
*)0),0, 0},
310 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH
), WID_PAGE_WIDTH
, &::getCppuType((const sal_Int32
*)0), 0, 0},
311 { MAP_CHAR_LEN("BackgroundFullSize"), WID_PAGE_BACKFULL
, &::getBooleanCppuType(), 0, 0},
312 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes
),WID_PAGE_USERATTRIBS
, &::getCppuType((const Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
313 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK
, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY
, 0},
317 static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl
[] =
319 { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM
), WID_PAGE_BOTTOM
, &::getCppuType((const sal_Int32
*)0), 0, 0},
320 { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT
), WID_PAGE_LEFT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
321 { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT
), WID_PAGE_RIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
322 { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP
), WID_PAGE_TOP
, &::getCppuType((const sal_Int32
*)0), 0, 0},
323 { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT
), WID_PAGE_HEIGHT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
324 { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION
), WID_PAGE_ORIENT
, &::getCppuType((const view::PaperOrientation
*)0),0, 0},
325 { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH
), WID_PAGE_WIDTH
, &::getCppuType((const sal_Int32
*)0), 0, 0},
326 { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT
), WID_PAGE_LAYOUT
, &::getCppuType((const sal_Int16
*)0), 0, 0},
327 { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes
),WID_PAGE_USERATTRIBS
, &::getCppuType((const Reference
< ::com::sun::star::container::XNameContainer
>*)0) , 0, 0},
328 { MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK
, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY
, 0},
329 { MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE
, &::getBooleanCppuType(), 0, 0},
330 { MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT
, &::getCppuType((const OUString
*)0), 0, 0},
331 { MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE
, &::getBooleanCppuType(), 0, 0},
332 { MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT
, &::getCppuType((const OUString
*)0), 0, 0},
333 { MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE
, &::getBooleanCppuType(), 0, 0},
334 { MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE
, &::getBooleanCppuType(), 0, 0},
335 { MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED
, &::getBooleanCppuType(), 0, 0},
336 { MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT
, &::getCppuType((const OUString
*)0), 0, 0},
337 { MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT
, &::getCppuType((const sal_Int32
*)0), 0, 0},
341 const SvxItemPropertySet
* pRet
= 0;
342 if( ePageKind
== PK_HANDOUT
)
344 static SvxItemPropertySet
aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl
);
345 pRet
= &aHandoutMasterPagePropertySet_Impl
;
349 static SvxItemPropertySet
aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl
);
350 pRet
= &aMasterPagePropertySet_Impl
;
355 UNO3_GETIMPLEMENTATION2_IMPL( SdGenericDrawPage
, SvxFmDrawPage
);
357 /***********************************************************************
359 ***********************************************************************/
360 SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument
* _pModel
, SdPage
* pInPage
, const SvxItemPropertySet
* _pSet
) throw()
361 : SvxFmDrawPage( (SdrPage
*) pInPage
),
362 SdUnoSearchReplaceShape(this),
366 mbHasBackgroundObject(sal_False
),
367 mbIsImpressDocument(false)
369 mpSdrModel
= SvxFmDrawPage::mpModel
;
371 mbIsImpressDocument
= mpModel
->IsImpressDocument() ? true : false;
375 SdGenericDrawPage::~SdGenericDrawPage() throw()
379 void SdGenericDrawPage::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException
)
381 if( (SvxFmDrawPage::mpModel
== 0) || (mpModel
== 0) || (SvxFmDrawPage::mpPage
== 0) )
382 throw lang::DisposedException();
385 SdXImpressDocument
* SdGenericDrawPage::GetModel() const
387 if( mpSdrModel
!= SvxFmDrawPage::mpModel
)
389 const_cast< SdGenericDrawPage
* >(this)->mpSdrModel
= SvxFmDrawPage::mpModel
;
392 uno::Reference
< uno::XInterface
> xModel( SvxFmDrawPage::mpModel
->getUnoModel() );
393 const_cast< SdGenericDrawPage
*>(this)->mpModel
= SdXImpressDocument::getImplementation( xModel
);
395 const_cast< SdGenericDrawPage
*>(this)->mbIsImpressDocument
= mpModel
->IsImpressDocument() ? true : false;
399 const_cast< SdGenericDrawPage
* >(this)->mpModel
= 0;
406 // this is called whenever a SdrObject must be created for a empty api shape wrapper
407 SdrObject
* SdGenericDrawPage::_CreateSdrObject( const Reference
< drawing::XShape
>& xShape
) throw()
409 if( NULL
== SvxFmDrawPage::mpPage
|| !xShape
.is() )
412 String
aType( xShape
->getShapeType() );
413 const String
aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") );
414 if(aType
.CompareTo( aPrefix
, aPrefix
.Len() ) != 0)
416 SdrObject
* pObj
= SvxFmDrawPage::_CreateSdrObject( xShape
);
417 if( pObj
&& ( (pObj
->GetObjInventor() != SdrInventor
) || (pObj
->GetObjIdentifier() != OBJ_PAGE
) ) )
419 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
421 pObj
->NbcSetStyleSheet( pDoc
->GetDefaultStyleSheet(), sal_True
);
426 aType
= aType
.Copy( aPrefix
.Len() );
428 PresObjKind eObjKind
= PRESOBJ_NONE
;
430 if( aType
.EqualsAscii( "TitleTextShape" ) )
432 eObjKind
= PRESOBJ_TITLE
;
434 else if( aType
.EqualsAscii( "OutlinerShape" ) )
436 eObjKind
= PRESOBJ_OUTLINE
;
438 else if( aType
.EqualsAscii( "SubtitleShape" ) )
440 eObjKind
= PRESOBJ_TEXT
;
442 else if( aType
.EqualsAscii( "OLE2Shape" ) )
444 eObjKind
= PRESOBJ_OBJECT
;
446 else if( aType
.EqualsAscii( "ChartShape" ) )
448 eObjKind
= PRESOBJ_CHART
;
450 else if( aType
.EqualsAscii( "TableShape" ) )
452 eObjKind
= PRESOBJ_TABLE
;
454 else if( aType
.EqualsAscii( "GraphicObjectShape" ) )
456 #ifdef STARIMAGE_AVAILABLE
457 eObjKind
= PRESOBJ_IMAGE
;
459 eObjKind
= PRESOBJ_GRAPHIC
;
462 else if( aType
.EqualsAscii( "OrgChartShape" ) )
464 eObjKind
= PRESOBJ_ORGCHART
;
466 else if( aType
.EqualsAscii( "PageShape" ) )
468 if( GetPage()->GetPageKind() == PK_NOTES
&& GetPage()->IsMasterPage() )
469 eObjKind
= PRESOBJ_TITLE
;
471 eObjKind
= PRESOBJ_PAGE
;
473 else if( aType
.EqualsAscii( "NotesShape" ) )
475 eObjKind
= PRESOBJ_NOTES
;
477 else if( aType
.EqualsAscii( "HandoutShape" ) )
479 eObjKind
= PRESOBJ_HANDOUT
;
481 else if( aType
.EqualsAscii( "FooterShape" ) )
483 eObjKind
= PRESOBJ_FOOTER
;
485 else if( aType
.EqualsAscii( "HeaderShape" ) )
487 eObjKind
= PRESOBJ_HEADER
;
489 else if( aType
.EqualsAscii( "SlideNumberShape" ) )
491 eObjKind
= PRESOBJ_SLIDENUMBER
;
493 else if( aType
.EqualsAscii( "DateTimeShape" ) )
495 eObjKind
= PRESOBJ_DATETIME
;
498 Rectangle
aRect( eObjKind
== PRESOBJ_TITLE
? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
500 const awt::Point
aPos( aRect
.Left(), aRect
.Top() );
501 xShape
->setPosition( aPos
);
503 const awt::Size
aSize( aRect
.GetWidth(), aRect
.GetHeight() );
504 xShape
->setSize( aSize
);
506 SdrObject
*pPresObj
= GetPage()->CreatePresObj( eObjKind
, FALSE
, aRect
, sal_True
);
509 pPresObj
->SetUserCall( GetPage() );
515 Any SAL_CALL
SdGenericDrawPage::queryInterface( const uno::Type
& rType
)
516 throw(uno::RuntimeException
)
520 QUERYINT( beans::XPropertySet
);
521 else QUERYINT( container::XNamed
);
522 else QUERYINT( util::XReplaceable
);
523 else QUERYINT( util::XSearchable
);
524 else QUERYINT( document::XLinkTargetSupplier
);
525 else QUERYINT( drawing::XShapeCombiner
);
526 else QUERYINT( drawing::XShapeBinder
);
527 else QUERYINT( beans::XMultiPropertySet
);
528 else if( rType
== ITYPE( office::XAnnotationAccess
) )
530 return Any( Reference
< office::XAnnotationAccess
>( this ) );
532 else if( rType
== ITYPE( XAnimationNodeSupplier
) )
534 if( mbIsImpressDocument
)
536 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
538 if( ePageKind
== PK_STANDARD
)
539 return makeAny( Reference
< XAnimationNodeSupplier
>( this ) );
543 return SvxDrawPage::queryInterface( rType
);
549 Reference
< beans::XPropertySetInfo
> SAL_CALL
SdGenericDrawPage::getPropertySetInfo()
550 throw(uno::RuntimeException
)
552 OGuard
aGuard( Application::GetSolarMutex() );
554 return mpPropSet
->getPropertySetInfo();
557 void SAL_CALL
SdGenericDrawPage::setPropertyValue( const OUString
& aPropertyName
, const Any
& aValue
)
558 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
560 OGuard
aGuard( Application::GetSolarMutex() );
564 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
566 switch( pEntry
? pEntry
->nWID
: -1 )
569 setNavigationOrder( aValue
);
574 case WID_PAGE_BOTTOM
:
575 case WID_PAGE_LAYOUT
:
576 case WID_PAGE_DURATION
:
577 case WID_PAGE_CHANGE
:
579 sal_Int32 nValue
= 0;
580 if(!(aValue
>>= nValue
))
581 throw lang::IllegalArgumentException();
583 switch( pEntry
->nWID
)
586 SetLftBorder(nValue
);
589 SetRgtBorder( nValue
);
592 SetUppBorder( nValue
);
594 case WID_PAGE_BOTTOM
:
595 SetLwrBorder( nValue
);
597 case WID_PAGE_CHANGE
:
598 GetPage()->SetPresChange( (PresChange
)nValue
);
600 case WID_PAGE_LAYOUT
:
601 GetPage()->SetAutoLayout( (AutoLayout
)nValue
, sal_True
);
603 case WID_PAGE_DURATION
:
604 GetPage()->SetTime((sal_uInt32
)nValue
);
611 sal_Int32 nWidth
= 0;
612 if(!(aValue
>>= nWidth
))
613 throw lang::IllegalArgumentException();
618 case WID_PAGE_HEIGHT
:
620 sal_Int32 nHeight
= 0;
621 if(!(aValue
>>= nHeight
))
622 throw lang::IllegalArgumentException();
624 SetHeight( nHeight
);
627 case WID_PAGE_ORIENT
:
630 if(!::cppu::enum2int( nEnum
, aValue
))
631 throw lang::IllegalArgumentException();
633 Orientation eOri
= (((view::PaperOrientation
)nEnum
) == view::PaperOrientation_PORTRAIT
)?ORIENTATION_PORTRAIT
:ORIENTATION_LANDSCAPE
;
635 if( eOri
!= GetPage()->GetOrientation() )
637 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
638 const PageKind ePageKind
= GetPage()->GetPageKind();
640 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
641 for (i
= 0; i
< nPageCnt
; i
++)
643 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
644 pPage
->SetOrientation( eOri
);
647 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
649 for (i
= 0; i
< nPageCnt
; i
++)
651 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
652 pPage
->SetOrientation( eOri
);
657 case WID_PAGE_EFFECT
:
660 if(!::cppu::enum2int( nEnum
, aValue
))
661 throw lang::IllegalArgumentException();
663 GetPage()->SetFadeEffect( (presentation::FadeEffect
)nEnum
);
667 setBackground( aValue
);
672 if(!::cppu::enum2int( nEnum
, aValue
))
673 throw lang::IllegalArgumentException();
675 GetPage()->setTransitionDuration( nEnum
== 0 ? 3.0 : (nEnum
== 1 ? 2.0 : 1.0 ) );
678 case WID_PAGE_VISIBLE
:
680 sal_Bool bVisible
= sal_False
;
681 if( ! ( aValue
>>= bVisible
) )
682 throw lang::IllegalArgumentException();
683 GetPage()->SetExcluded( bVisible
== FALSE
);
686 case WID_PAGE_SOUNDFILE
:
689 if( aValue
>>= aURL
)
691 GetPage()->SetSoundFile( aURL
);
692 GetPage()->SetSound( aURL
.getLength() != 0 ? sal_True
: sal_False
);
697 sal_Bool bStopSound
= sal_False
;
698 if( aValue
>>= bStopSound
)
700 GetPage()->SetStopSound( bStopSound
? true : false );
706 throw lang::IllegalArgumentException();
710 sal_Bool bLoop
= sal_False
;
711 if( ! (aValue
>>= bLoop
) )
712 throw lang::IllegalArgumentException();
714 GetPage()->SetLoopSound( bLoop
? true : false );
717 case WID_PAGE_BACKFULL
:
719 sal_Bool bFullSize
= sal_False
;
720 if( ! ( aValue
>>= bFullSize
) )
721 throw lang::IllegalArgumentException();
722 GetPage()->SetBackgroundFullSize( bFullSize
);
725 case WID_PAGE_BACKVIS
:
727 sal_Bool bVisible
= sal_False
;
728 if( ! ( aValue
>>= bVisible
) )
729 throw lang::IllegalArgumentException();
731 SdrPage
* pPage
= GetPage();
734 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
735 if( pDoc
->GetMasterPageCount() )
737 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
738 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
739 aVisibleLayers
.Set(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRND
)), FALSE
), bVisible
);
740 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
745 case WID_PAGE_BACKOBJVIS
:
747 sal_Bool bVisible
= sal_False
;
748 if( ! ( aValue
>>= bVisible
) )
749 throw lang::IllegalArgumentException();
751 SdrPage
* pPage
= GetPage();
754 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
755 if( pDoc
->GetMasterPageCount() )
757 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
758 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
759 aVisibleLayers
.Set(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ
)), FALSE
), bVisible
);
760 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
766 case WID_PAGE_USERATTRIBS
:
768 if( !GetPage()->setAlienAttributes( aValue
) )
769 throw lang::IllegalArgumentException();
772 case WID_PAGE_BOOKMARK
:
774 OUString aBookmarkURL
;
775 if( ! ( aValue
>>= aBookmarkURL
) )
776 throw lang::IllegalArgumentException();
778 setBookmarkURL( aBookmarkURL
);
782 case WID_PAGE_HEADERVISIBLE
:
783 case WID_PAGE_HEADERTEXT
:
784 case WID_PAGE_FOOTERVISIBLE
:
785 case WID_PAGE_FOOTERTEXT
:
786 case WID_PAGE_PAGENUMBERVISIBLE
:
787 case WID_PAGE_DATETIMEVISIBLE
:
788 case WID_PAGE_DATETIMEFIXED
:
789 case WID_PAGE_DATETIMETEXT
:
790 case WID_PAGE_DATETIMEFORMAT
:
792 sd::HeaderFooterSettings
aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
794 switch( pEntry
->nWID
)
796 case WID_PAGE_HEADERVISIBLE
:
798 sal_Bool bVisible
= sal_False
;
799 if( ! ( aValue
>>= bVisible
) )
800 throw lang::IllegalArgumentException();
802 aHeaderFooterSettings
.mbHeaderVisible
= bVisible
;
805 case WID_PAGE_HEADERTEXT
:
808 if( ! ( aValue
>>= aText
) )
809 throw lang::IllegalArgumentException();
811 aHeaderFooterSettings
.maHeaderText
= aText
;
814 case WID_PAGE_FOOTERVISIBLE
:
816 sal_Bool bVisible
= sal_False
;
817 if( ! ( aValue
>>= bVisible
) )
818 throw lang::IllegalArgumentException();
820 aHeaderFooterSettings
.mbFooterVisible
= bVisible
;
823 case WID_PAGE_FOOTERTEXT
:
826 if( ! ( aValue
>>= aText
) )
827 throw lang::IllegalArgumentException();
829 aHeaderFooterSettings
.maFooterText
= aText
;
832 case WID_PAGE_PAGENUMBERVISIBLE
:
834 sal_Bool bVisible
= sal_False
;
835 if( ! ( aValue
>>= bVisible
) )
836 throw lang::IllegalArgumentException();
838 aHeaderFooterSettings
.mbSlideNumberVisible
= bVisible
;
841 case WID_PAGE_DATETIMEVISIBLE
:
843 sal_Bool bVisible
= sal_False
;
844 if( ! ( aValue
>>= bVisible
) )
845 throw lang::IllegalArgumentException();
847 aHeaderFooterSettings
.mbDateTimeVisible
= bVisible
;
850 case WID_PAGE_DATETIMEFIXED
:
852 sal_Bool bVisible
= sal_False
;
853 if( ! ( aValue
>>= bVisible
) )
854 throw lang::IllegalArgumentException();
856 aHeaderFooterSettings
.mbDateTimeIsFixed
= bVisible
;
859 case WID_PAGE_DATETIMETEXT
:
862 if( ! ( aValue
>>= aText
) )
863 throw lang::IllegalArgumentException();
865 aHeaderFooterSettings
.maDateTimeText
= aText
;
868 case WID_PAGE_DATETIMEFORMAT
:
870 sal_Int32 nValue
= 0;
871 if( ! ( aValue
>>= nValue
) )
872 throw lang::IllegalArgumentException();
874 aHeaderFooterSettings
.meDateTimeFormat
= nValue
;
879 if( !(aHeaderFooterSettings
== GetPage()->getHeaderFooterSettings()) )
880 GetPage()->setHeaderFooterSettings( aHeaderFooterSettings
);
885 case WID_PAGE_LDBITMAP
:
886 case WID_PAGE_LDNAME
:
887 case WID_PAGE_NUMBER
:
888 case WID_PAGE_ISDARK
:
889 throw beans::PropertyVetoException();
891 case WID_TRANSITION_TYPE
:
893 sal_Int16 nValue
= 0;
894 if( ! ( aValue
>>= nValue
) )
895 throw lang::IllegalArgumentException();
897 GetPage()->setTransitionType( nValue
);
901 case WID_TRANSITION_SUBTYPE
:
903 sal_Int16 nValue
= 0;
904 if( ! ( aValue
>>= nValue
) )
905 throw lang::IllegalArgumentException();
907 GetPage()->setTransitionSubtype( nValue
);
911 case WID_TRANSITION_DIRECTION
:
913 sal_Bool bValue
= sal_False
;
914 if( ! ( aValue
>>= bValue
) )
915 throw lang::IllegalArgumentException();
917 GetPage()->setTransitionDirection( bValue
);
921 case WID_TRANSITION_FADE_COLOR
:
923 sal_Int32 nValue
= 0;
924 if( ! ( aValue
>>= nValue
) )
925 throw lang::IllegalArgumentException();
927 GetPage()->setTransitionFadeColor( nValue
);
931 case WID_TRANSITION_DURATION
:
934 if( ! ( aValue
>>= fValue
) )
935 throw lang::IllegalArgumentException();
937 GetPage()->setTransitionDuration( fValue
);
942 throw beans::UnknownPropertyException();
945 GetModel()->SetModified();
948 /***********************************************************************
950 ***********************************************************************/
951 Any SAL_CALL
SdGenericDrawPage::getPropertyValue( const OUString
& PropertyName
)
952 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
954 OGuard
aGuard( Application::GetSolarMutex() );
960 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(PropertyName
);
962 switch( pEntry
? pEntry
->nWID
: -1 )
965 aAny
= getNavigationOrder();
968 aAny
<<= (sal_Int32
)( GetPage()->GetLftBorder() );
971 aAny
<<= (sal_Int32
)( GetPage()->GetRgtBorder() );
974 aAny
<<= (sal_Int32
)( GetPage()->GetUppBorder() );
976 case WID_PAGE_BOTTOM
:
977 aAny
<<= (sal_Int32
)( GetPage()->GetLwrBorder() );
980 aAny
<<= (sal_Int32
)( GetPage()->GetSize().getWidth() );
982 case WID_PAGE_HEIGHT
:
983 aAny
<<= (sal_Int32
)( GetPage()->GetSize().getHeight() );
985 case WID_PAGE_ORIENT
:
986 aAny
= ::cppu::int2enum( (sal_Int32
)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT
)? view::PaperOrientation_PORTRAIT
: view::PaperOrientation_LANDSCAPE
), ::getCppuType((const view::PaperOrientation
*)0) );
988 case WID_PAGE_EFFECT
:
989 aAny
= ::cppu::int2enum( (sal_Int32
)GetPage()->GetFadeEffect(), ::getCppuType((const presentation::FadeEffect
*)0) );
991 case WID_PAGE_CHANGE
:
992 aAny
<<= (sal_Int32
)( GetPage()->GetPresChange() );
996 const double fDuration
= GetPage()->getTransitionDuration();
997 aAny
= ::cppu::int2enum( fDuration
< 2.0 ? 2 : (fDuration
> 2.0 ? 0 : 1), ::getCppuType((const presentation::AnimationSpeed
*)0) );
1000 case WID_PAGE_LAYOUT
:
1001 aAny
<<= (sal_Int16
)( GetPage()->GetAutoLayout() );
1003 case WID_PAGE_NUMBER
:
1004 aAny
<<= (sal_Int16
)((sal_uInt16
)((GetPage()->GetPageNum()-1)>>1) + 1);
1006 case WID_PAGE_DURATION
:
1007 aAny
<<= (sal_Int32
)(GetPage()->GetTime());
1009 case WID_PAGE_LDNAME
:
1011 const OUString
aName( GetPage()->GetName() );
1015 case WID_PAGE_LDBITMAP
:
1017 BOOL bHC
= Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark();
1018 Reference
< awt::XBitmap
> xBitmap(
1019 VCLUnoHelper::CreateBitmap( BitmapEx( SdResId( bHC
? BMP_PAGE_H
: BMP_PAGE
) ) ) );
1024 getBackground( aAny
);
1026 case WID_PAGE_PREVIEW
:
1028 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1031 ::sd::DrawDocShell
* pDocShell
= pDoc
->GetDocSh();
1034 sal_uInt16 nPgNum
= 0;
1035 sal_uInt16 nPageCount
= pDoc
->GetSdPageCount( PK_STANDARD
);
1036 sal_uInt16 nPageNumber
= (sal_uInt16
)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1037 while( nPgNum
< nPageCount
)
1039 pDoc
->SetSelected( pDoc
->GetSdPage( nPgNum
, PK_STANDARD
), nPgNum
== nPageNumber
);
1042 ::boost::shared_ptr
<GDIMetaFile
> pMetaFile
=
1043 pDocShell
->GetPreviewMetaFile();
1047 Size
aSize( GetPage()->GetSize() );
1048 pMetaFile
->AddAction( (MetaAction
*) new MetaFillColorAction( COL_WHITE
, TRUE
), 0 );
1049 pMetaFile
->AddAction( (MetaAction
*) new MetaRectAction( Rectangle( aPoint
, aSize
) ), 1 );
1050 pMetaFile
->SetPrefMapMode( MAP_100TH_MM
);
1051 pMetaFile
->SetPrefSize( aSize
);
1053 SvMemoryStream
aDestStrm( 65535, 65535 );
1054 ConvertGDIMetaFileToWMF( *pMetaFile
, aDestStrm
, NULL
, sal_False
);
1055 Sequence
<sal_Int8
> aSeq( (sal_Int8
*)aDestStrm
.GetData(), aDestStrm
.Tell() );
1063 case WID_PAGE_PREVIEWBITMAP
:
1065 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1068 ::sd::DrawDocShell
* pDocShell
= pDoc
->GetDocSh();
1071 sal_uInt16 nPgNum
= 0;
1072 sal_uInt16 nPageCount
= pDoc
->GetSdPageCount( PK_STANDARD
);
1073 sal_uInt16 nPageNumber
= (sal_uInt16
)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
1074 while( nPgNum
< nPageCount
)
1076 pDoc
->SetSelected( pDoc
->GetSdPage( nPgNum
, PK_STANDARD
), nPgNum
== nPageNumber
);
1079 ::boost::shared_ptr
<GDIMetaFile
> pMetaFile
=
1080 pDocShell
->GetPreviewMetaFile();
1082 if ( pMetaFile
&& pMetaFile
->CreateThumbnail( 160, /* magic value taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() */
1085 SvMemoryStream aMemStream
;
1086 aBitmap
.GetBitmap().Write( aMemStream
, FALSE
, FALSE
);
1087 uno::Sequence
<sal_Int8
> aSeq( (sal_Int8
*)aMemStream
.GetData(), aMemStream
.Tell() );
1095 case WID_PAGE_VISIBLE
:
1097 sal_Bool bVisible
= GetPage()->IsExcluded() == FALSE
;
1098 aAny
<<= Any( &bVisible
, ::getBooleanCppuType() );
1102 case WID_PAGE_SOUNDFILE
:
1104 if( GetPage()->IsStopSound() )
1111 if( GetPage()->IsSoundOn() )
1112 aURL
= GetPage()->GetSoundFile();
1117 case WID_LOOP_SOUND
:
1119 aAny
<<= (sal_Bool
)GetPage()->IsLoopSound();
1122 case WID_PAGE_BACKFULL
:
1124 sal_Bool bFullSize
= GetPage()->IsBackgroundFullSize();
1125 aAny
= Any( &bFullSize
, ::getBooleanCppuType() );
1128 case WID_PAGE_BACKVIS
:
1130 SdrPage
* pPage
= GetPage();
1133 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
1134 if( pDoc
->GetMasterPageCount() )
1136 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
1137 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1138 aAny
<<= (sal_Bool
)aVisibleLayers
.IsSet(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRND
)), FALSE
));
1142 aAny
<<= (sal_Bool
)sal_False
;
1147 case WID_PAGE_BACKOBJVIS
:
1149 SdrPage
* pPage
= GetPage();
1152 SdDrawDocument
* pDoc
= (SdDrawDocument
*)pPage
->GetModel();
1153 if( pDoc
->GetMasterPageCount() )
1155 SdrLayerAdmin
& rLayerAdmin
= pDoc
->GetLayerAdmin();
1156 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
1157 aAny
<<= (sal_Bool
)aVisibleLayers
.IsSet(rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ
)), FALSE
));
1161 aAny
<<= (sal_Bool
)sal_False
;
1166 case WID_PAGE_USERATTRIBS
:
1168 GetPage()->getAlienAttributes( aAny
);
1171 case WID_PAGE_BOOKMARK
:
1173 aAny
<<= getBookmarkURL();
1176 case WID_PAGE_ISDARK
:
1178 aAny
<<= (sal_Bool
)GetPage()->GetPageBackgroundColor().IsDark();
1181 case WID_PAGE_HEADERVISIBLE
:
1182 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbHeaderVisible
;
1184 case WID_PAGE_HEADERTEXT
:
1186 const OUString
aText( GetPage()->getHeaderFooterSettings().maHeaderText
);
1190 case WID_PAGE_FOOTERVISIBLE
:
1191 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbFooterVisible
;
1193 case WID_PAGE_FOOTERTEXT
:
1195 const OUString
aText( GetPage()->getHeaderFooterSettings().maFooterText
);
1199 case WID_PAGE_PAGENUMBERVISIBLE
:
1200 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbSlideNumberVisible
;
1202 case WID_PAGE_DATETIMEVISIBLE
:
1203 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbDateTimeVisible
;
1205 case WID_PAGE_DATETIMEFIXED
:
1206 aAny
<<= (sal_Bool
)GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed
;
1208 case WID_PAGE_DATETIMETEXT
:
1210 const OUString
aText( GetPage()->getHeaderFooterSettings().maDateTimeText
);
1214 case WID_PAGE_DATETIMEFORMAT
:
1215 aAny
<<= (sal_Int32
)GetPage()->getHeaderFooterSettings().meDateTimeFormat
;
1218 case WID_TRANSITION_TYPE
:
1219 aAny
<<= GetPage()->getTransitionType();
1222 case WID_TRANSITION_SUBTYPE
:
1223 aAny
<<= GetPage()->getTransitionSubtype();
1226 case WID_TRANSITION_DIRECTION
:
1227 aAny
<<= GetPage()->getTransitionDirection();
1230 case WID_TRANSITION_FADE_COLOR
:
1231 aAny
<<= GetPage()->getTransitionFadeColor();
1234 case WID_TRANSITION_DURATION
:
1235 aAny
<<= GetPage()->getTransitionDuration();
1239 throw beans::UnknownPropertyException();
1244 void SAL_CALL
SdGenericDrawPage::addPropertyChangeListener( const OUString
& , const Reference
< beans::XPropertyChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1245 void SAL_CALL
SdGenericDrawPage::removePropertyChangeListener( const OUString
& , const Reference
< beans::XPropertyChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1246 void SAL_CALL
SdGenericDrawPage::addVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1247 void SAL_CALL
SdGenericDrawPage::removeVetoableChangeListener( const OUString
& , const Reference
< beans::XVetoableChangeListener
>& ) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
) {}
1249 // XMultiPropertySet
1250 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
)
1252 if( aPropertyNames
.getLength() != aValues
.getLength() )
1253 throw lang::IllegalArgumentException();
1255 const OUString
* pNames
= aPropertyNames
.getConstArray();
1256 const Any
* pValues
= aValues
.getConstArray();
1257 sal_uInt32 nCount
= aValues
.getLength();
1262 setPropertyValue( *pNames
++, *pValues
++ );
1264 catch( beans::UnknownPropertyException
& )
1266 // ignore for multi property set
1267 // todo: optimize this!
1272 Sequence
< Any
> SAL_CALL
SdGenericDrawPage::getPropertyValues( const Sequence
< OUString
>& aPropertyNames
) throw (RuntimeException
)
1274 const OUString
* pNames
= aPropertyNames
.getConstArray();
1275 sal_uInt32 nCount
= aPropertyNames
.getLength();
1276 Sequence
< Any
> aValues( nCount
);
1277 Any
* pValues
= aValues
.getArray();
1283 aValue
= getPropertyValue( *pNames
++ );
1285 catch( beans::UnknownPropertyException
& )
1287 // ignore for multi property set
1288 // todo: optimize this!
1290 *pValues
++ = aValue
;
1295 void SAL_CALL
SdGenericDrawPage::addPropertiesChangeListener( const Sequence
< OUString
>& , const Reference
< beans::XPropertiesChangeListener
>& ) throw (RuntimeException
)
1299 void SAL_CALL
SdGenericDrawPage::removePropertiesChangeListener( const Reference
< beans::XPropertiesChangeListener
>& ) throw (RuntimeException
)
1303 void SAL_CALL
SdGenericDrawPage::firePropertiesChangeEvent( const Sequence
< OUString
>& , const Reference
< beans::XPropertiesChangeListener
>& ) throw (RuntimeException
)
1307 Reference
< drawing::XShape
> SdGenericDrawPage::_CreateShape( SdrObject
*pObj
) const throw()
1309 DBG_ASSERT( GetPage(), "SdGenericDrawPage::_CreateShape(), can't create shape for disposed page!" );
1310 DBG_ASSERT( pObj
, "SdGenericDrawPage::_CreateShape(), invalid call with pObj == 0!" );
1312 if( GetPage() && pObj
)
1314 PresObjKind eKind
= GetPage()->GetPresObjKind(pObj
);
1316 SvxShape
* pShape
= NULL
;
1318 if(pObj
->GetObjInventor() == SdrInventor
)
1320 sal_uInt32 nInventor
= pObj
->GetObjIdentifier();
1324 pShape
= new SvxShapeText( pObj
);
1325 if( GetPage()->GetPageKind() == PK_NOTES
&& GetPage()->IsMasterPage() )
1327 // fake a empty PageShape if its a title shape on the master page
1328 pShape
->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")));
1332 pShape
->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")));
1334 eKind
= PRESOBJ_NONE
;
1336 case OBJ_OUTLINETEXT
:
1337 pShape
= new SvxShapeText( pObj
);
1338 pShape
->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")));
1339 eKind
= PRESOBJ_NONE
;
1344 Reference
< drawing::XShape
> xShape( pShape
);
1347 xShape
= SvxFmDrawPage::_CreateShape( pObj
);
1350 if( eKind
!= PRESOBJ_NONE
)
1352 String
aShapeType( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation."));
1357 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("TitleTextShape") );
1359 case PRESOBJ_OUTLINE
:
1360 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("OutlinerShape") );
1363 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("SubtitleShape") );
1365 case PRESOBJ_GRAPHIC
:
1366 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape") );
1368 case PRESOBJ_OBJECT
:
1369 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("OLE2Shape") );
1372 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("ChartShape") );
1374 case PRESOBJ_ORGCHART
:
1375 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("OrgChartShape") );
1378 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("TableShape") );
1380 case PRESOBJ_BACKGROUND
:
1381 DBG_ASSERT( sal_False
, "Danger! Someone got hold of the horrible background shape!" );
1384 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("PageShape") );
1386 case PRESOBJ_HANDOUT
:
1387 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("HandoutShape") );
1390 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("NotesShape") );
1392 case PRESOBJ_FOOTER
:
1393 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("FooterShape") );
1395 case PRESOBJ_HEADER
:
1396 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("HeaderShape") );
1398 case PRESOBJ_SLIDENUMBER
:
1399 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("SlideNumberShape") );
1401 case PRESOBJ_DATETIME
:
1402 aShapeType
+= String( RTL_CONSTASCII_USTRINGPARAM("DateTimeShape") );
1411 pShape
= SvxShape::getImplementation( xShape
);
1414 pShape
->SetShapeType( aShapeType
);
1417 // SdXShape aggregiert SvxShape
1418 new SdXShape( SvxShape::getImplementation( xShape
), GetModel() );
1423 return SvxFmDrawPage::_CreateShape( pObj
);
1428 //----------------------------------------------------------------------
1431 Sequence
< OUString
> SAL_CALL
SdGenericDrawPage::getSupportedServiceNames()
1432 throw(uno::RuntimeException
)
1434 Sequence
< OUString
> aSeq( SvxFmDrawPage::getSupportedServiceNames() );
1435 SvxServiceInfoHelper::addToSequence( aSeq
, 3, "com.sun.star.drawing.GenericDrawPage",
1436 "com.sun.star.document.LinkTarget",
1437 "com.sun.star.document.LinkTargetSupplier");
1441 //----------------------------------------------------------------------
1443 // XLinkTargetSupplier
1444 Reference
< container::XNameAccess
> SAL_CALL
SdGenericDrawPage::getLinks( )
1445 throw(uno::RuntimeException
)
1447 return new SdPageLinkTargets( (SdGenericDrawPage
*)this );
1450 //----------------------------------------------------------------------
1452 void SdGenericDrawPage::setBackground( const Any
& ) throw(lang::IllegalArgumentException
)
1454 DBG_ERROR( "Don't call me, I'm useless!" );
1457 //----------------------------------------------------------------------
1459 void SdGenericDrawPage::getBackground( Any
& ) throw()
1461 DBG_ERROR( "Don't call me, I'm useless!" );
1464 //----------------------------------------------------------------------
1466 OUString
SdGenericDrawPage::getBookmarkURL() const
1468 OUStringBuffer aRet
;
1469 if( SvxFmDrawPage::mpPage
)
1471 OUString
aFileName( static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->GetFileName() );
1472 if( aFileName
.getLength() )
1474 const OUString
aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->GetBookmarkName() ) );
1475 aRet
.append( aFileName
);
1476 aRet
.append( (sal_Unicode
)'#' );
1477 aRet
.append( aBookmarkName
);
1481 return aRet
.makeStringAndClear();
1484 //----------------------------------------------------------------------
1485 void SdGenericDrawPage::setBookmarkURL( rtl::OUString
& rURL
)
1487 if( SvxFmDrawPage::mpPage
)
1489 sal_Int32 nIndex
= rURL
.indexOf( (sal_Unicode
)'#' );
1492 const String
aFileName( rURL
.copy( 0, nIndex
) );
1493 const String
aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL
.copy( nIndex
+1 ) ) );
1495 if( aFileName
.Len() && aBookmarkName
.Len() )
1497 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->DisconnectLink();
1498 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->SetFileName( aFileName
);
1499 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->SetBookmarkName( aBookmarkName
);
1500 static_cast<SdPage
*>(SvxFmDrawPage::mpPage
)->ConnectLink();
1506 //----------------------------------------------------------------------
1507 Reference
< drawing::XShape
> SAL_CALL
SdGenericDrawPage::combine( const Reference
< drawing::XShapes
>& xShapes
)
1508 throw( uno::RuntimeException
)
1510 OGuard
aGuard( Application::GetSolarMutex() );
1514 DBG_ASSERT(SvxFmDrawPage::mpPage
,"SdrPage ist NULL! [CL]");
1515 DBG_ASSERT(mpView
, "SdrView ist NULL! [CL]");
1517 Reference
< drawing::XShape
> xShape
;
1518 if(mpView
==NULL
||!xShapes
.is()||GetPage()==NULL
)
1521 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1523 _SelectObjectsInView( xShapes
, pPageView
);
1525 mpView
->CombineMarkedObjects( sal_False
);
1527 mpView
->AdjustMarkHdl();
1528 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
1529 if( rMarkList
.GetMarkCount() == 1 )
1531 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
1533 xShape
= Reference
< drawing::XShape
>::query( pObj
->getUnoShape() );
1536 mpView
->HideSdrPage();
1538 GetModel()->SetModified();
1543 //----------------------------------------------------------------------
1544 void SAL_CALL
SdGenericDrawPage::split( const Reference
< drawing::XShape
>& xGroup
)
1545 throw( uno::RuntimeException
)
1547 OGuard
aGuard( Application::GetSolarMutex() );
1551 if(mpView
==NULL
||!xGroup
.is()||GetPage()==NULL
)
1554 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1555 _SelectObjectInView( xGroup
, pPageView
);
1556 mpView
->DismantleMarkedObjects( sal_False
);
1557 mpView
->HideSdrPage();
1559 GetModel()->SetModified();
1562 //----------------------------------------------------------------------
1563 Reference
< drawing::XShape
> SAL_CALL
SdGenericDrawPage::bind( const Reference
< drawing::XShapes
>& xShapes
)
1564 throw( uno::RuntimeException
)
1566 OGuard
aGuard( Application::GetSolarMutex() );
1570 uno::Reference
< drawing::XShape
> xShape
;
1571 if(mpView
==NULL
||!xShapes
.is()||GetPage()==NULL
)
1574 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1576 _SelectObjectsInView( xShapes
, pPageView
);
1578 mpView
->CombineMarkedObjects( sal_True
);
1580 mpView
->AdjustMarkHdl();
1581 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
1582 if( rMarkList
.GetMarkCount() == 1 )
1584 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
1586 xShape
= Reference
< drawing::XShape
>::query( pObj
->getUnoShape() );
1589 mpView
->HideSdrPage();
1591 GetModel()->SetModified();
1596 //----------------------------------------------------------------------
1597 void SAL_CALL
SdGenericDrawPage::unbind( const Reference
< drawing::XShape
>& xShape
)
1598 throw( uno::RuntimeException
)
1600 OGuard
aGuard( Application::GetSolarMutex() );
1604 if(mpView
==NULL
||!xShape
.is()||GetPage()==NULL
)
1607 SdrPageView
* pPageView
= mpView
->ShowSdrPage( GetPage() );
1608 _SelectObjectInView( xShape
, pPageView
);
1609 mpView
->DismantleMarkedObjects( sal_True
);
1610 mpView
->HideSdrPage();
1612 GetModel()->SetModified();
1615 void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue
)
1617 if( nValue
!= GetPage()->GetLftBorder() )
1619 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1620 const PageKind ePageKind
= GetPage()->GetPageKind();
1622 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1623 for (i
= 0; i
< nPageCnt
; i
++)
1625 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1626 pPage
->SetLftBorder( nValue
);
1629 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1631 for (i
= 0; i
< nPageCnt
; i
++)
1633 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1634 pPage
->SetLftBorder( nValue
);
1639 void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue
)
1641 if( nValue
!= GetPage()->GetRgtBorder() )
1643 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1644 const PageKind ePageKind
= GetPage()->GetPageKind();
1646 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1647 for (i
= 0; i
< nPageCnt
; i
++)
1649 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1650 pPage
->SetRgtBorder( nValue
);
1653 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1655 for (i
= 0; i
< nPageCnt
; i
++)
1657 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1658 pPage
->SetRgtBorder( nValue
);
1663 void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue
)
1665 if( nValue
!= GetPage()->GetUppBorder() )
1667 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1668 const PageKind ePageKind
= GetPage()->GetPageKind();
1670 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1671 for (i
= 0; i
< nPageCnt
; i
++)
1673 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1674 pPage
->SetUppBorder( nValue
);
1677 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1679 for (i
= 0; i
< nPageCnt
; i
++)
1681 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1682 pPage
->SetUppBorder( nValue
);
1687 void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue
)
1689 if( nValue
!= GetPage()->GetLwrBorder() )
1691 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1692 const PageKind ePageKind
= GetPage()->GetPageKind();
1694 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1695 for (i
= 0; i
< nPageCnt
; i
++)
1697 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1698 pPage
->SetLwrBorder( nValue
);
1701 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1703 for (i
= 0; i
< nPageCnt
; i
++)
1705 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1706 pPage
->SetLwrBorder( nValue
);
1711 static void refreshpage( SdDrawDocument
* pDoc
, const PageKind ePageKind
)
1713 ::sd::DrawDocShell
* pDocShell
= pDoc
->GetDocSh();
1716 ::sd::ViewShell
* pViewSh
= pDocShell
->GetViewShell();
1720 if( pViewSh
->ISA(::sd::DrawViewShell
) )
1721 static_cast< ::sd::DrawViewShell
*>(pViewSh
)->ResetActualPage();
1723 Size aPageSize
= pDoc
->GetSdPage(0, ePageKind
)->GetSize();
1724 const long nWidth
= aPageSize
.Width();
1725 const long nHeight
= aPageSize
.Height();
1727 Point aPageOrg
= Point(nWidth
, nHeight
/ 2);
1728 Size aViewSize
= Size(nWidth
* 3, nHeight
* 2);
1730 pDoc
->SetMaxObjSize(aViewSize
);
1732 pViewSh
->InitWindows(aPageOrg
, aViewSize
, Point(-1, -1), TRUE
);
1734 pViewSh
->UpdateScrollBars();
1739 void SdGenericDrawPage::SetWidth( sal_Int32 nWidth
)
1741 Size
aSize( GetPage()->GetSize() );
1742 if( aSize
.getWidth() != nWidth
)
1744 aSize
.setWidth( nWidth
);
1746 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1747 const PageKind ePageKind
= GetPage()->GetPageKind();
1749 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1750 for (i
= 0; i
< nPageCnt
; i
++)
1752 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1753 pPage
->SetSize(aSize
);
1756 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1758 for (i
= 0; i
< nPageCnt
; i
++)
1760 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1761 pPage
->SetSize(aSize
);
1764 refreshpage( pDoc
, ePageKind
);
1768 void SdGenericDrawPage::SetHeight( sal_Int32 nHeight
)
1770 Size
aSize( GetPage()->GetSize() );
1771 if( aSize
.getHeight() != nHeight
)
1773 aSize
.setHeight( nHeight
);
1775 SdDrawDocument
* pDoc
= (SdDrawDocument
*)GetPage()->GetModel();
1776 const PageKind ePageKind
= GetPage()->GetPageKind();
1778 USHORT i
, nPageCnt
= pDoc
->GetMasterSdPageCount(ePageKind
);
1779 for (i
= 0; i
< nPageCnt
; i
++)
1781 SdPage
* pPage
= pDoc
->GetMasterSdPage(i
, ePageKind
);
1782 pPage
->SetSize(aSize
);
1785 nPageCnt
= pDoc
->GetSdPageCount(ePageKind
);
1787 for (i
= 0; i
< nPageCnt
; i
++)
1789 SdPage
* pPage
= pDoc
->GetSdPage(i
, ePageKind
);
1790 pPage
->SetSize(aSize
);
1793 refreshpage( pDoc
, ePageKind
);
1798 void SdGenericDrawPage::release() throw()
1801 OWeakAggObject::release();
1805 void SdGenericDrawPage::disposing() throw()
1808 SvxFmDrawPage::disposing();
1811 // XAnimationNodeSupplier
1812 Reference
< XAnimationNode
> SAL_CALL
SdGenericDrawPage::getAnimationNode() throw (uno::RuntimeException
)
1814 OGuard
aGuard( Application::GetSolarMutex() );
1818 SdPage
*pSdPage
= static_cast<SdPage
*>(SvxFmDrawPage::mpPage
);
1821 return pSdPage
->getAnimationNode();
1824 //========================================================================
1825 // SdPageLinkTargets
1826 //========================================================================
1828 SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage
* pUnoPage
) throw()
1831 mpUnoPage
= pUnoPage
;
1834 SdPageLinkTargets::~SdPageLinkTargets() throw()
1839 uno::Type SAL_CALL
SdPageLinkTargets::getElementType()
1840 throw(uno::RuntimeException
)
1842 return ITYPE(beans::XPropertySet
);
1845 sal_Bool SAL_CALL
SdPageLinkTargets::hasElements()
1846 throw(uno::RuntimeException
)
1848 OGuard
aGuard( Application::GetSolarMutex() );
1850 SdPage
* pPage
= mpUnoPage
->GetPage();
1853 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1855 while( aIter
.IsMore() )
1857 SdrObject
* pObj
= aIter
.Next();
1858 String
aStr( pObj
->GetName() );
1859 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1860 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1869 // container::XNameAccess
1872 Any SAL_CALL
SdPageLinkTargets::getByName( const OUString
& aName
)
1873 throw(container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
1875 OGuard
aGuard( Application::GetSolarMutex() );
1877 SdPage
* pPage
= mpUnoPage
->GetPage();
1880 SdrObject
* pObj
= FindObject( aName
);
1883 Reference
< beans::XPropertySet
> aRef( pObj
->getUnoShape(), uno::UNO_QUERY
);
1884 return makeAny( aRef
);
1888 throw container::NoSuchElementException();
1891 Sequence
< OUString
> SAL_CALL
SdPageLinkTargets::getElementNames()
1892 throw(uno::RuntimeException
)
1894 OGuard
aGuard( Application::GetSolarMutex() );
1896 sal_uInt32 nObjCount
= 0;
1898 SdPage
* pPage
= mpUnoPage
->GetPage();
1901 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1902 while( aIter
.IsMore() )
1904 SdrObject
* pObj
= aIter
.Next();
1905 String
aStr( pObj
->GetName() );
1906 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1907 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1913 Sequence
< OUString
> aSeq( nObjCount
);
1916 OUString
* pStr
= aSeq
.getArray();
1918 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1919 while( aIter
.IsMore() )
1921 SdrObject
* pObj
= aIter
.Next();
1922 String
aStr( pObj
->GetName() );
1923 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1924 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1933 sal_Bool SAL_CALL
SdPageLinkTargets::hasByName( const OUString
& aName
)
1934 throw(uno::RuntimeException
)
1936 OGuard
aGuard( Application::GetSolarMutex() );
1938 return FindObject( aName
) != NULL
;
1941 /***********************************************************************
1943 ***********************************************************************/
1944 SdrObject
* SdPageLinkTargets::FindObject( const String
& rName
) const throw()
1946 SdPage
* pPage
= mpUnoPage
->GetPage();
1950 SdrObjListIter
aIter( *pPage
, IM_DEEPWITHGROUPS
);
1952 while( aIter
.IsMore() )
1954 SdrObject
* pObj
= aIter
.Next();
1955 String
aStr( pObj
->GetName() );
1956 if( !aStr
.Len() && pObj
->ISA( SdrOle2Obj
) )
1957 aStr
= static_cast< const SdrOle2Obj
* >( pObj
)->GetPersistName();
1958 if( aStr
.Len() && (aStr
== rName
) )
1966 OUString SAL_CALL
SdPageLinkTargets::getImplementationName()
1967 throw(uno::RuntimeException
)
1969 return OUString( RTL_CONSTASCII_USTRINGPARAM("SdPageLinkTargets") );
1972 sal_Bool SAL_CALL
SdPageLinkTargets::supportsService( const OUString
& ServiceName
)
1973 throw(uno::RuntimeException
)
1975 return SvxServiceInfoHelper::supportsService( ServiceName
, getSupportedServiceNames() );
1978 Sequence
< OUString
> SAL_CALL
SdPageLinkTargets::getSupportedServiceNames()
1979 throw(uno::RuntimeException
)
1981 const OUString
aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") );
1982 Sequence
< OUString
> aSeq( &aSN
, 1);
1986 //========================================================================
1988 //========================================================================
1990 SdDrawPage::SdDrawPage( SdXImpressDocument
* pModel
, SdPage
* pPage
) throw()
1991 : SdGenericDrawPage( pModel
, pPage
, ImplGetDrawPagePropertySet( pModel
->IsImpressDocument(), pPage
->GetPageKind() ) )
1995 SdDrawPage::~SdDrawPage() throw()
2000 Any SAL_CALL
SdDrawPage::queryInterface( const uno::Type
& rType
)
2001 throw(uno::RuntimeException
)
2003 if( rType
== ITYPE( drawing::XMasterPageTarget
) )
2005 return makeAny( Reference
< drawing::XMasterPageTarget
>( this ) );
2009 if( mbIsImpressDocument
)
2011 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
2013 if( ePageKind
!= PK_HANDOUT
&& rType
== ITYPE( presentation::XPresentationPage
) )
2015 return makeAny( Reference
< presentation::XPresentationPage
>( this ) );
2020 return SdGenericDrawPage::queryInterface( rType
);
2023 void SAL_CALL
SdDrawPage::acquire() throw()
2025 SvxDrawPage::acquire();
2028 void SAL_CALL
SdDrawPage::release() throw()
2030 SvxDrawPage::release();
2033 UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage
, SdGenericDrawPage
);
2036 Sequence
< uno::Type
> SAL_CALL
SdDrawPage::getTypes() throw(uno::RuntimeException
)
2038 OGuard
aGuard( Application::GetSolarMutex() );
2042 if( maTypeSequence
.getLength() == 0 )
2044 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
2045 sal_Bool bPresPage
= mbIsImpressDocument
&& ePageKind
!= PK_HANDOUT
;
2047 // Collect the types of this class.
2048 ::std::vector
<uno::Type
> aTypes
;
2050 aTypes
.push_back(ITYPE(drawing::XDrawPage
));
2051 aTypes
.push_back(ITYPE(beans::XPropertySet
));
2052 aTypes
.push_back(ITYPE(container::XNamed
));
2053 aTypes
.push_back(ITYPE(drawing::XMasterPageTarget
));
2054 aTypes
.push_back(ITYPE(lang::XServiceInfo
));
2055 aTypes
.push_back(ITYPE(util::XReplaceable
));
2056 aTypes
.push_back(ITYPE(document::XLinkTargetSupplier
));
2057 aTypes
.push_back(ITYPE( drawing::XShapeCombiner
));
2058 aTypes
.push_back(ITYPE( drawing::XShapeBinder
));
2059 aTypes
.push_back(ITYPE( office::XAnnotationAccess
));
2060 aTypes
.push_back(ITYPE( beans::XMultiPropertySet
));
2062 aTypes
.push_back(ITYPE(presentation::XPresentationPage
));
2063 if( bPresPage
&& ePageKind
== PK_STANDARD
)
2064 aTypes
.push_back(ITYPE(XAnimationNodeSupplier
));
2066 // Get types of base class.
2067 const Sequence
< uno::Type
> aBaseTypes( SdGenericDrawPage::getTypes() );
2068 const sal_Int32 nBaseTypes
= aBaseTypes
.getLength();
2069 const uno::Type
* pBaseTypes
= aBaseTypes
.getConstArray();
2071 // Join those types in a sequence.
2072 maTypeSequence
.realloc(aTypes
.size() + nBaseTypes
);
2073 uno::Type
* pTypes
= maTypeSequence
.getArray();
2074 ::std::vector
<uno::Type
>::const_iterator iType
;
2075 for (iType
=aTypes
.begin(); iType
!=aTypes
.end(); ++iType
)
2077 for( sal_Int32 nType
= 0; nType
< nBaseTypes
; nType
++ )
2078 *pTypes
++ = *pBaseTypes
++;
2081 return maTypeSequence
;
2084 Sequence
< sal_Int8
> SAL_CALL
SdDrawPage::getImplementationId() throw(uno::RuntimeException
)
2086 OGuard
aGuard( Application::GetSolarMutex() );
2090 static Sequence
< sal_Int8
> aId
;
2091 if( aId
.getLength() == 0 )
2094 rtl_createUuid( (sal_uInt8
*)aId
.getArray(), 0, sal_True
);
2099 OUString
SdDrawPage::getPageApiName( SdPage
* pPage
)
2101 return ::getPageApiName( pPage
);
2104 OUString
getPageApiName( SdPage
* pPage
)
2110 aPageName
= pPage
->GetRealName();
2112 if( aPageName
.getLength() == 0 )
2114 OUStringBuffer sBuffer
;
2115 sBuffer
.appendAscii( RTL_CONSTASCII_STRINGPARAM( sEmptyPageName
) );
2116 const sal_Int32 nPageNum
= ( ( pPage
->GetPageNum() - 1 ) >> 1 ) + 1;
2117 sBuffer
.append( nPageNum
);
2118 aPageName
= sBuffer
.makeStringAndClear();
2126 OUString
getPageApiNameFromUiName( const String
& rUIName
)
2130 String
aDefPageName(SdResId(STR_PAGE
));
2131 aDefPageName
+= sal_Unicode( ' ' );
2133 if( rUIName
.Equals( aDefPageName
, 0, aDefPageName
.Len() ) )
2135 aApiName
= OUString( RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName
) );
2136 aApiName
+= rUIName
.Copy( aDefPageName
.Len() );
2146 OUString
SdDrawPage::getPageApiNameFromUiName( const String
& rUIName
)
2148 return ::getPageApiNameFromUiName( rUIName
);
2151 String
getUiNameFromPageApiNameImpl( const OUString
& rApiName
)
2153 const String
aDefPageName(RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName
));
2154 if( rApiName
.compareTo( aDefPageName
, aDefPageName
.Len() ) == 0 )
2156 OUString
aNumber( rApiName
.copy( sizeof( sEmptyPageName
) - 1 ) );
2158 // create the page number
2159 sal_Int32 nPageNumber
= aNumber
.toInt32();
2161 // check if there are non number characters in the number part
2162 const sal_Int32 nChars
= aNumber
.getLength();
2163 const sal_Unicode
* pString
= aNumber
.getStr();
2165 for( nChar
= 0; nChar
< nChars
; nChar
++, pString
++ )
2167 if((*pString
< sal_Unicode('0')) || (*pString
> sal_Unicode('9')))
2169 // found a non number character, so this is not the default
2170 // name for this page
2176 if( nPageNumber
!= -1)
2178 OUStringBuffer sBuffer
;
2179 sBuffer
.append( String(SdResId(STR_PAGE
)) );
2180 sBuffer
.append( sal_Unicode( ' ' ) );
2181 sBuffer
.append( aNumber
);
2182 return sBuffer
.makeStringAndClear();
2189 String
SdDrawPage::getUiNameFromPageApiName( const OUString
& rApiName
)
2191 return getUiNameFromPageApiNameImpl( rApiName
);
2195 OUString SAL_CALL
SdDrawPage::getImplementationName() throw(uno::RuntimeException
)
2197 return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDrawPage") );
2200 Sequence
< OUString
> SAL_CALL
SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException
)
2202 OGuard
aGuard( Application::GetSolarMutex() );
2206 Sequence
< OUString
> aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2207 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.drawing.DrawPage" );
2209 if( mbIsImpressDocument
)
2210 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.presentation.DrawPage" );
2215 sal_Bool SAL_CALL
SdDrawPage::supportsService( const OUString
& ServiceName
)
2216 throw(uno::RuntimeException
)
2218 return SdGenericDrawPage::supportsService( ServiceName
);
2222 void SAL_CALL
SdDrawPage::setName( const OUString
& rName
)
2223 throw(uno::RuntimeException
)
2225 OGuard
aGuard( Application::GetSolarMutex() );
2229 DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
2231 OUString
aName( rName
);
2233 if(GetPage() && GetPage()->GetPageKind() != PK_NOTES
)
2235 // check if this is the default 'page1234' name
2236 if(aName
.compareToAscii( sEmptyPageName
, sizeof( sEmptyPageName
) - 1 ) == 0)
2238 // ok, it maybe is, first get the number part after 'page'
2239 OUString
aNumber( aName
.copy( sizeof( sEmptyPageName
) - 1 ) );
2241 // create the page number
2242 sal_Int32 nPageNumber
= aNumber
.toInt32();
2244 // check if there are non number characters in the number part
2245 const sal_Int32 nChars
= aNumber
.getLength();
2246 const sal_Unicode
* pString
= aNumber
.getStr();
2248 for( nChar
= 0; nChar
< nChars
; nChar
++, pString
++ )
2250 if((*pString
< '0') || (*pString
> '9'))
2252 // found a non number character, so this is not the default
2253 // name for this page
2259 if( nPageNumber
== ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
2264 String
aDefaultPageName( SdResId(STR_PAGE
) );
2265 aDefaultPageName
+= sal_Unicode( ' ' );
2266 if( aName
.compareTo( aDefaultPageName
, aDefaultPageName
.Len() ) == 0 )
2270 GetPage()->SetName( aName
);
2272 USHORT nNotesPageNum
= (GetPage()->GetPageNum()-1)>>1;
2273 if( GetModel()->GetDoc()->GetSdPageCount( PK_NOTES
) > nNotesPageNum
)
2275 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetSdPage( nNotesPageNum
, PK_NOTES
);
2277 pNotesPage
->SetName(aName
);
2280 // fake a mode change to repaint the page tab bar
2281 ::sd::DrawDocShell
* pDocSh
= GetModel()->GetDocShell();
2282 ::sd::ViewShell
* pViewSh
= pDocSh
? pDocSh
->GetViewShell() : NULL
;
2283 if( pViewSh
&& pViewSh
->ISA(::sd::DrawViewShell
))
2285 ::sd::DrawViewShell
* pDrawViewSh
= static_cast<
2286 ::sd::DrawViewShell
*>(pViewSh
);
2288 EditMode eMode
= pDrawViewSh
->GetEditMode();
2289 if( eMode
== EM_PAGE
)
2291 BOOL bLayer
= pDrawViewSh
->IsLayerModeActive();
2293 pDrawViewSh
->ChangeEditMode( eMode
, !bLayer
);
2294 pDrawViewSh
->ChangeEditMode( eMode
, bLayer
);
2298 GetModel()->SetModified();
2302 OUString SAL_CALL
SdDrawPage::getName()
2303 throw(uno::RuntimeException
)
2305 OGuard
aGuard( Application::GetSolarMutex() );
2309 return getPageApiName( GetPage() );
2312 // XMasterPageTarget
2313 Reference
< drawing::XDrawPage
> SAL_CALL
SdDrawPage::getMasterPage( )
2314 throw(uno::RuntimeException
)
2316 OGuard
aGuard( Application::GetSolarMutex() );
2322 Reference
< drawing::XDrawPages
> xPages( GetModel()->getMasterPages() );
2323 Reference
< drawing::XDrawPage
> xPage
;
2325 if(SvxFmDrawPage::mpPage
->TRG_HasMasterPage())
2327 SdrPage
& rMasterPage
= SvxFmDrawPage::mpPage
->TRG_GetMasterPage();
2328 xPage
= uno::Reference
< drawing::XDrawPage
>( rMasterPage
.getUnoPage(), uno::UNO_QUERY
);
2336 void SAL_CALL
SdDrawPage::setMasterPage( const Reference
< drawing::XDrawPage
>& xMasterPage
)
2337 throw(uno::RuntimeException
)
2339 OGuard
aGuard( Application::GetSolarMutex() );
2343 if(SvxFmDrawPage::mpPage
)
2345 SdMasterPage
* pMasterPage
= SdMasterPage::getImplementation( xMasterPage
);
2346 if( pMasterPage
&& pMasterPage
->isValid() )
2348 SvxFmDrawPage::mpPage
->TRG_ClearMasterPage();
2350 SdPage
* pSdPage
= (SdPage
*) pMasterPage
->GetSdrPage();
2351 SvxFmDrawPage::mpPage
->TRG_SetMasterPage(*pSdPage
);
2353 SvxFmDrawPage::mpPage
->SetBorder(pSdPage
->GetLftBorder(),pSdPage
->GetUppBorder(),
2354 pSdPage
->GetRgtBorder(),pSdPage
->GetLwrBorder() );
2356 SvxFmDrawPage::mpPage
->SetSize( pSdPage
->GetSize() );
2357 SvxFmDrawPage::mpPage
->SetOrientation( pSdPage
->GetOrientation() );
2358 ((SdPage
*)SvxFmDrawPage::mpPage
)->SetLayoutName( ( (SdPage
*)pSdPage
)->GetLayoutName() );
2360 // set notes master also
2361 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PK_NOTES
);
2363 pNotesPage
->TRG_ClearMasterPage();
2364 sal_uInt16 nNum
= (SvxFmDrawPage::mpPage
->TRG_GetMasterPage()).GetPageNum() + 1;
2365 pNotesPage
->TRG_SetMasterPage(*SvxFmDrawPage::mpPage
->GetModel()->GetMasterPage(nNum
));
2366 pNotesPage
->SetLayoutName( ( (SdPage
*)pSdPage
)->GetLayoutName() );
2368 GetModel()->SetModified();
2374 // XPresentationPage
2375 Reference
< drawing::XDrawPage
> SAL_CALL
SdDrawPage::getNotesPage()
2376 throw(uno::RuntimeException
)
2378 OGuard
aGuard( Application::GetSolarMutex() );
2382 if(SvxFmDrawPage::mpPage
&& GetModel()->GetDoc() && SvxFmDrawPage::mpPage
->GetPageNum() )
2384 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PK_NOTES
);
2387 Reference
< drawing::XDrawPage
> xPage( pNotesPage
->getUnoPage(), uno::UNO_QUERY
);
2396 sal_Int32 SAL_CALL
SdDrawPage::getCount()
2397 throw(uno::RuntimeException
)
2399 return SdGenericDrawPage::getCount();
2402 Any SAL_CALL
SdDrawPage::getByIndex( sal_Int32 Index
)
2403 throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
2405 return SdGenericDrawPage::getByIndex( Index
);
2409 uno::Type SAL_CALL
SdDrawPage::getElementType()
2410 throw(uno::RuntimeException
)
2412 return SdGenericDrawPage::getElementType();
2415 sal_Bool SAL_CALL
SdDrawPage::hasElements()
2416 throw(uno::RuntimeException
)
2418 return SdGenericDrawPage::hasElements();
2422 void SAL_CALL
SdDrawPage::add( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
2424 SdGenericDrawPage::add( xShape
);
2427 void SAL_CALL
SdDrawPage::remove( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
2429 OGuard
aGuard( Application::GetSolarMutex() );
2433 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
2436 SdrObject
* pObj
= pShape
->GetSdrObject();
2439 GetPage()->RemovePresObj(pObj
);
2440 pObj
->SetUserCall(NULL
);
2444 SdGenericDrawPage::remove( xShape
);
2447 void SdDrawPage::setBackground( const Any
& rValue
)
2448 throw( lang::IllegalArgumentException
)
2450 Reference
< beans::XPropertySet
> xSet
;
2452 if( !(rValue
>>= xSet
) && !rValue
.hasValue() )
2453 throw lang::IllegalArgumentException();
2457 // the easy case, clear the background obj
2458 GetPage()->SetBackgroundObj( NULL
);
2461 // tell the page that it's visualization has changed
2462 GetPage()->ActionChanged();
2467 // prepare background object
2468 SdrObject
* pObj
= GetPage()->GetBackgroundObj();
2471 pObj
= new SdrRectObj();
2472 GetPage()->SetBackgroundObj( pObj
);
2475 // tell the page that it's visualization has changed
2476 GetPage()->ActionChanged();
2479 const sal_Int32 nLeft
= GetPage()->GetLftBorder();
2480 const sal_Int32 nRight
= GetPage()->GetRgtBorder();
2481 const sal_Int32 nUpper
= GetPage()->GetUppBorder();
2482 const sal_Int32 nLower
= GetPage()->GetLwrBorder();
2484 Point
aPos ( nLeft
, nRight
);
2485 Size
aSize( GetPage()->GetSize() );
2486 aSize
.Width() -= nLeft
+ nRight
- 1;
2487 aSize
.Height() -= nUpper
+ nLower
- 1;
2488 Rectangle
aRect( aPos
, aSize
);
2489 pObj
->SetLogicRect( aRect
);
2491 // is it our own implementation?
2492 SdUnoPageBackground
* pBack
= SdUnoPageBackground::getImplementation( xSet
);
2494 SfxItemSet
aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST
, XATTR_FILL_LAST
);
2498 pBack
->fillItemSet( (SdDrawDocument
*)GetPage()->GetModel(), aSet
);
2502 SdUnoPageBackground
* pBackground
= new SdUnoPageBackground();
2504 Reference
< beans::XPropertySetInfo
> xSetInfo( xSet
->getPropertySetInfo() );
2505 Reference
< beans::XPropertySet
> xDestSet( (beans::XPropertySet
*)pBackground
);
2506 Reference
< beans::XPropertySetInfo
> xDestSetInfo( xDestSet
->getPropertySetInfo() );
2508 Sequence
< beans::Property
> aProperties( xDestSetInfo
->getProperties() );
2509 sal_Int32 nCount
= aProperties
.getLength();
2510 beans::Property
* pProp
= aProperties
.getArray();
2514 const OUString
aPropName( pProp
->Name
);
2515 if( xSetInfo
->hasPropertyByName( aPropName
) )
2516 xDestSet
->setPropertyValue( aPropName
,
2517 xSet
->getPropertyValue( aPropName
) );
2522 pBackground
->fillItemSet( (SdDrawDocument
*)GetPage()->GetModel(), aSet
);
2525 //-/ pObj->NbcSetAttributes( aSet, sal_False );
2526 if( aSet
.Count() == 0 )
2528 GetPage()->SetBackgroundObj( NULL
);
2532 pObj
->SetMergedItemSet(aSet
);
2536 SvxFmDrawPage::mpPage
->ActionChanged();
2537 // pPage->SendRepaintBroadcast();
2540 // XAnnotationAccess:
2541 Reference
< XAnnotation
> SAL_CALL
SdGenericDrawPage::createAndInsertAnnotation() throw (RuntimeException
)
2544 throw DisposedException();
2546 Reference
< XAnnotation
> xRet
;
2547 GetPage()->createAnnotation(xRet
);
2551 void SAL_CALL
SdGenericDrawPage::removeAnnotation(const Reference
< XAnnotation
> & annotation
) throw (RuntimeException
, IllegalArgumentException
)
2553 GetPage()->removeAnnotation(annotation
);
2556 Reference
< XAnnotationEnumeration
> SAL_CALL
SdGenericDrawPage::createAnnotationEnumeration() throw (RuntimeException
)
2558 return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() );
2561 void SdDrawPage::getBackground( Any
& rValue
) throw()
2563 SdrObject
* pObj
= GetPage()->GetBackgroundObj();
2570 Reference
< beans::XPropertySet
> xSet( new SdUnoPageBackground( GetModel()->GetDoc(), pObj
) );
2575 void SdGenericDrawPage::setNavigationOrder( const Any
& rValue
)
2577 Reference
< XIndexAccess
> xIA( rValue
, UNO_QUERY
);
2580 if( dynamic_cast< SdDrawPage
* >( xIA
.get() ) == this )
2582 if( GetPage()->HasObjectNavigationOrder() )
2583 GetPage()->ClearObjectNavigationOrder();
2587 else if( xIA
->getCount() == static_cast< sal_Int32
>( GetPage()->GetObjCount() ) )
2589 GetPage()->SetNavigationOrder(xIA
);
2593 throw IllegalArgumentException();
2596 class NavigationOrderAccess
: public ::cppu::WeakImplHelper1
< XIndexAccess
>
2599 NavigationOrderAccess( SdrPage
* pPage
);
2602 virtual sal_Int32 SAL_CALL
getCount( ) throw (RuntimeException
);
2603 virtual Any SAL_CALL
getByIndex( sal_Int32 Index
) throw (IndexOutOfBoundsException
, WrappedTargetException
, RuntimeException
);
2606 virtual Type SAL_CALL
getElementType( ) throw (RuntimeException
);
2607 virtual sal_Bool SAL_CALL
hasElements( ) throw (RuntimeException
);
2610 std::vector
< Reference
< XShape
> > maShapes
;
2613 NavigationOrderAccess::NavigationOrderAccess( SdrPage
* pPage
)
2614 : maShapes( static_cast< sal_uInt32
>( pPage
? pPage
->GetObjCount() : 0 ) )
2619 const sal_uInt32 nCount
= static_cast< sal_uInt32
>( pPage
->GetObjCount() );
2620 for( nIndex
= 0; nIndex
< nCount
; ++nIndex
)
2622 SdrObject
* pObj
= pPage
->GetObj( nIndex
);
2623 sal_uInt32 nNavPos
= pObj
->GetNavigationPosition();
2624 DBG_ASSERT( !maShapes
[nNavPos
].is(), "sd::NavigationOrderAccess::NavigationOrderAccess(), duplicate navigation positions from core!" );
2625 maShapes
[nNavPos
] = Reference
< XShape
>( pObj
->getUnoShape(), UNO_QUERY
);
2631 sal_Int32 SAL_CALL
NavigationOrderAccess::getCount( ) throw (RuntimeException
)
2633 return static_cast< sal_Int32
>( maShapes
.size() );
2636 Any SAL_CALL
NavigationOrderAccess::getByIndex( sal_Int32 Index
) throw (IndexOutOfBoundsException
, WrappedTargetException
, RuntimeException
)
2638 if( (Index
< 0) || (Index
> getCount()) )
2639 throw IndexOutOfBoundsException();
2641 return Any( maShapes
[Index
] );
2645 Type SAL_CALL
NavigationOrderAccess::getElementType( ) throw (RuntimeException
)
2647 return XShape::static_type();
2650 sal_Bool SAL_CALL
NavigationOrderAccess::hasElements( ) throw (RuntimeException
)
2652 return maShapes
.empty() ? sal_False
: sal_True
;
2655 Any
SdGenericDrawPage::getNavigationOrder()
2657 if( GetPage()->HasObjectNavigationOrder() )
2659 return Any( Reference
< XIndexAccess
>( new NavigationOrderAccess( GetPage() ) ) );
2663 return Any( Reference
< XIndexAccess
>( this ) );
2667 //========================================================================
2668 // class SdMasterPage
2669 //========================================================================
2671 SdMasterPage::SdMasterPage( SdXImpressDocument
* pModel
, SdPage
* pPage
) throw()
2672 : SdGenericDrawPage( pModel
, pPage
, ImplGetMasterPagePropertySet( pPage
? pPage
->GetPageKind() : PK_STANDARD
) )
2674 mbHasBackgroundObject
= pPage
&& GetPage()->GetPageKind() == PK_STANDARD
;
2677 SdMasterPage::~SdMasterPage() throw()
2682 Any SAL_CALL
SdMasterPage::queryInterface( const uno::Type
& rType
)
2683 throw(uno::RuntimeException
)
2685 OGuard
aGuard( Application::GetSolarMutex() );
2691 if( rType
== ITYPE( container::XIndexAccess
) )
2692 aAny
<<= Reference
< container::XIndexAccess
>((presentation::XPresentationPage
*)(this));
2693 else if( rType
== ITYPE( container::XElementAccess
) )
2694 aAny
<<= Reference
< container::XElementAccess
>((presentation::XPresentationPage
*)(this));
2695 else if( rType
== ITYPE( container::XNamed
) )
2696 aAny
<<= Reference
< container::XNamed
>(this);
2697 else if( rType
== ITYPE( presentation::XPresentationPage
) &&
2698 ( mbIsImpressDocument
&&
2699 GetPage() && GetPage()->GetPageKind() != PK_HANDOUT
) )
2700 aAny
<<= Reference
< presentation::XPresentationPage
>( this );
2702 return SdGenericDrawPage::queryInterface( rType
);
2707 void SAL_CALL
SdMasterPage::acquire() throw()
2709 SvxDrawPage::acquire();
2712 void SAL_CALL
SdMasterPage::release() throw()
2714 SvxDrawPage::release();
2717 UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage
, SdGenericDrawPage
);
2720 Sequence
< uno::Type
> SAL_CALL
SdMasterPage::getTypes() throw(uno::RuntimeException
)
2722 OGuard
aGuard( Application::GetSolarMutex() );
2726 if( maTypeSequence
.getLength() == 0 )
2728 const PageKind ePageKind
= GetPage() ? GetPage()->GetPageKind() : PK_STANDARD
;
2729 sal_Bool bPresPage
= mbIsImpressDocument
&& SvxFmDrawPage::mpPage
&& ePageKind
!= PK_HANDOUT
;
2731 // Collect the types of this class.
2732 ::std::vector
<uno::Type
> aTypes
;
2734 aTypes
.push_back(ITYPE(drawing::XDrawPage
));
2735 aTypes
.push_back(ITYPE(beans::XPropertySet
));
2736 aTypes
.push_back(ITYPE(container::XNamed
));
2737 aTypes
.push_back(ITYPE(lang::XServiceInfo
));
2738 aTypes
.push_back(ITYPE(util::XReplaceable
));
2739 aTypes
.push_back(ITYPE(document::XLinkTargetSupplier
));
2740 aTypes
.push_back(ITYPE( drawing::XShapeCombiner
));
2741 aTypes
.push_back(ITYPE( drawing::XShapeBinder
));
2742 aTypes
.push_back(ITYPE( office::XAnnotationAccess
));
2743 aTypes
.push_back(ITYPE( beans::XMultiPropertySet
));
2745 aTypes
.push_back(ITYPE(presentation::XPresentationPage
));
2746 if( bPresPage
&& ePageKind
== PK_STANDARD
)
2747 aTypes
.push_back(ITYPE(XAnimationNodeSupplier
));
2749 // Get types of base class.
2750 const Sequence
< uno::Type
> aBaseTypes( SdGenericDrawPage::getTypes() );
2751 const sal_Int32 nBaseTypes
= aBaseTypes
.getLength();
2752 const uno::Type
* pBaseTypes
= aBaseTypes
.getConstArray();
2754 // Join those types in a sequence.
2755 maTypeSequence
.realloc(aTypes
.size() + nBaseTypes
);
2756 uno::Type
* pTypes
= maTypeSequence
.getArray();
2757 ::std::vector
<uno::Type
>::const_iterator iType
;
2758 for (iType
=aTypes
.begin(); iType
!=aTypes
.end(); ++iType
)
2760 for( sal_Int32 nType
= 0; nType
< nBaseTypes
; nType
++ )
2761 *pTypes
++ = *pBaseTypes
++;
2764 return maTypeSequence
;
2767 Sequence
< sal_Int8
> SAL_CALL
SdMasterPage::getImplementationId() throw(uno::RuntimeException
)
2769 OGuard
aGuard( Application::GetSolarMutex() );
2773 static Sequence
< sal_Int8
> aId
;
2774 if( aId
.getLength() == 0 )
2777 rtl_createUuid( (sal_uInt8
*)aId
.getArray(), 0, sal_True
);
2783 OUString SAL_CALL
SdMasterPage::getImplementationName() throw(uno::RuntimeException
)
2785 return OUString( RTL_CONSTASCII_USTRINGPARAM("SdMasterPage") );
2788 Sequence
< OUString
> SAL_CALL
SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException
)
2790 OGuard
aGuard( Application::GetSolarMutex() );
2794 Sequence
< OUString
> aSeq( SdGenericDrawPage::getSupportedServiceNames() );
2795 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.drawing.MasterPage" );
2797 if( SvxFmDrawPage::mpPage
&& ((SdPage
*)SvxFmDrawPage::mpPage
)->GetPageKind() == PK_HANDOUT
)
2798 SvxServiceInfoHelper::addToSequence( aSeq
, 1, "com.sun.star.presentation.HandoutMasterPage" );
2803 sal_Bool SAL_CALL
SdMasterPage::supportsService( const OUString
& ServiceName
)
2804 throw(uno::RuntimeException
)
2806 return SdGenericDrawPage::supportsService( ServiceName
);
2810 sal_Bool SAL_CALL
SdMasterPage::hasElements() throw(uno::RuntimeException
)
2812 OGuard
aGuard( Application::GetSolarMutex() );
2816 if( SvxFmDrawPage::mpPage
== NULL
)
2819 return (SvxFmDrawPage::mpPage
->GetObjCount() > 1) || (!mbHasBackgroundObject
&& SvxFmDrawPage::mpPage
->GetObjCount() == 1 );
2822 uno::Type SAL_CALL
SdMasterPage::getElementType()
2823 throw(uno::RuntimeException
)
2825 return SdGenericDrawPage::getElementType();
2829 sal_Int32 SAL_CALL
SdMasterPage::getCount()
2830 throw(uno::RuntimeException
)
2832 OGuard
aGuard( Application::GetSolarMutex() );
2836 sal_Int32 nCount
= SdGenericDrawPage::getCount();
2837 DBG_ASSERT( !mbHasBackgroundObject
|| (nCount
> 0), "possible wrong shape count!" );
2839 if( mbHasBackgroundObject
&& ( nCount
> 0 ) )
2845 Any SAL_CALL
SdMasterPage::getByIndex( sal_Int32 Index
)
2846 throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
2848 OGuard
aGuard( Application::GetSolarMutex() );
2852 if( mbHasBackgroundObject
)
2855 return SdGenericDrawPage::getByIndex(Index
);
2859 void SdMasterPage::setBackground( const Any
& rValue
)
2860 throw( lang::IllegalArgumentException
)
2862 // we need at least an beans::XPropertySet
2863 Reference
< beans::XPropertySet
> xInputSet( rValue
, UNO_QUERY
);
2864 if( !xInputSet
.is() )
2865 throw lang::IllegalArgumentException();
2869 if( GetModel() && mbIsImpressDocument
)
2871 Reference
< container::XNameAccess
> xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW
);
2872 Reference
< container::XNameAccess
> xFamily( xFamilies
->getByName( getName() ), UNO_QUERY_THROW
) ;
2875 OUString
aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background
) );
2877 Reference
< beans::XPropertySet
> xStyleSet( xFamily
->getByName( aStyleName
), UNO_QUERY_THROW
);
2879 Reference
< beans::XPropertySetInfo
> xSetInfo( xInputSet
->getPropertySetInfo(), UNO_QUERY_THROW
);
2880 Reference
< beans::XPropertyState
> xSetStates( xInputSet
, UNO_QUERY
);
2882 PropertyEntryVector_t aBackgroundProperties
= ImplGetPageBackgroundPropertySet()->getPropertyMap()->getPropertyEntries();
2883 PropertyEntryVector_t::const_iterator aIt
= aBackgroundProperties
.begin();
2884 while( aIt
!= aBackgroundProperties
.end() )
2886 if( xSetInfo
->hasPropertyByName( aIt
->sName
) )
2888 if( !xSetStates
.is() || xSetStates
->getPropertyState( aIt
->sName
) == beans::PropertyState_DIRECT_VALUE
)
2889 xStyleSet
->setPropertyValue( aIt
->sName
, xInputSet
->getPropertyValue( aIt
->sName
) );
2891 xSetStates
->setPropertyToDefault( aIt
->sName
);
2900 // first fill an item set
2901 // is it our own implementation?
2902 SdUnoPageBackground
* pBack
= SdUnoPageBackground::getImplementation( xInputSet
);
2904 SfxItemSet
aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST
, XATTR_FILL_LAST
);
2908 pBack
->fillItemSet( (SdDrawDocument
*)GetPage()->GetModel(), aSet
);
2912 SdUnoPageBackground
* pBackground
= new SdUnoPageBackground();
2914 Reference
< beans::XPropertySetInfo
> xInputSetInfo( xInputSet
->getPropertySetInfo(), UNO_QUERY_THROW
);
2915 Reference
< beans::XPropertySet
> xDestSet( (beans::XPropertySet
*)pBackground
);
2916 Reference
< beans::XPropertySetInfo
> xDestSetInfo( xDestSet
->getPropertySetInfo(), UNO_QUERY_THROW
);
2918 uno::Sequence
< beans::Property
> aProperties( xDestSetInfo
->getProperties() );
2919 sal_Int32 nCount
= aProperties
.getLength();
2920 beans::Property
* pProp
= aProperties
.getArray();
2924 const OUString
aPropName( pProp
->Name
);
2925 if( xInputSetInfo
->hasPropertyByName( aPropName
) )
2926 xDestSet
->setPropertyValue( aPropName
, xInputSet
->getPropertyValue( aPropName
) );
2931 pBackground
->fillItemSet( (SdDrawDocument
*)SvxFmDrawPage::mpPage
->GetModel(), aSet
);
2934 // if we find the background style, copy the set to the background
2935 SdDrawDocument
* pDoc
= (SdDrawDocument
*)SvxFmDrawPage::mpPage
->GetModel();
2936 SfxStyleSheetBasePool
* pSSPool
= (SfxStyleSheetBasePool
*)pDoc
->GetStyleSheetPool();
2939 String
aLayoutName( static_cast< SdPage
* >( SvxFmDrawPage::mpPage
)->GetLayoutName() );
2940 aLayoutName
.Erase(aLayoutName
.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR
)))+4);
2941 aLayoutName
+= String(SdResId(STR_LAYOUT_BACKGROUND
));
2942 SfxStyleSheetBase
* pStyleSheet
= pSSPool
->Find( aLayoutName
, SD_STYLE_FAMILY_MASTERPAGE
);
2946 pStyleSheet
->GetItemSet().Put( aSet
);
2949 SvxFmDrawPage::mpPage
->ActionChanged();
2955 // if no background style is available, try the background object
2956 SdrObject
* pObj
= GetPage()->GetPresObj(PRESOBJ_BACKGROUND
);
2960 pObj
->SetMergedItemSet(aSet
);
2963 SvxFmDrawPage::mpPage
->ActionChanged();
2968 DBG_ERROR("sd::SdMasterPage::setBackground(), exception caught!");
2972 void SdMasterPage::getBackground( Any
& rValue
) throw()
2974 if( GetModel() ) try
2976 if( mbIsImpressDocument
)
2978 Reference
< container::XNameAccess
> xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW
);
2979 Reference
< container::XNameAccess
> xFamily( xFamilies
->getByName( getName() ), UNO_QUERY_THROW
);
2981 const OUString
aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background
) );
2982 rValue
<<= Reference
< beans::XPropertySet
>( xFamily
->getByName( aStyleName
), UNO_QUERY_THROW
);
2986 SdDrawDocument
* pDoc
= (SdDrawDocument
*)SvxFmDrawPage::mpPage
->GetModel();
2987 SfxStyleSheetBasePool
* pSSPool
= (SfxStyleSheetBasePool
*)pDoc
->GetStyleSheetPool();
2990 String
aLayoutName( static_cast< SdPage
* >(SvxFmDrawPage::mpPage
)->GetLayoutName() );
2991 aLayoutName
.Erase( aLayoutName
.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR
)))+4);
2992 aLayoutName
+= String(SdResId(STR_LAYOUT_BACKGROUND
));
2993 SfxStyleSheetBase
* pStyleSheet
= pSSPool
->Find( aLayoutName
, SD_STYLE_FAMILY_MASTERPAGE
);
2997 SfxItemSet
aStyleSet( pStyleSheet
->GetItemSet());
2998 if( aStyleSet
.Count() )
3000 rValue
<<= Reference
< beans::XPropertySet
>( new SdUnoPageBackground( pDoc
, &aStyleSet
) );
3006 // no stylesheet? try old fashion background rectangle
3007 SdrObject
* pObj
= NULL
;
3008 if( SvxFmDrawPage::mpPage
->GetObjCount() >= 1 )
3010 pObj
= SvxFmDrawPage::mpPage
->GetObj(0);
3011 if( pObj
->GetObjInventor() != SdrInventor
|| pObj
->GetObjIdentifier() != OBJ_RECT
)
3017 rValue
<<= Reference
< beans::XPropertySet
>( new SdUnoPageBackground( GetModel()->GetDoc(), pObj
) );
3028 DBG_ERROR("sd::SdMasterPage::getBackground(), exception caught!");
3033 void SAL_CALL
SdMasterPage::setName( const OUString
& aName
)
3034 throw(uno::RuntimeException
)
3036 OGuard
aGuard( Application::GetSolarMutex() );
3040 if(SvxFmDrawPage::mpPage
&& GetPage()->GetPageKind() != PK_NOTES
)
3042 String
aNewName( aName
);
3043 GetPage()->SetName( aNewName
);
3045 if(GetModel()->GetDoc())
3046 GetModel()->GetDoc()->RenameLayoutTemplate(GetPage()->GetLayoutName(), aNewName
);
3048 // fake a mode change to repaint the page tab bar
3049 ::sd::DrawDocShell
* pDocSh
= GetModel()->GetDocShell();
3050 ::sd::ViewShell
* pViewSh
= pDocSh
? pDocSh
->GetViewShell() : NULL
;
3051 if( pViewSh
&& pViewSh
->ISA(::sd::DrawViewShell
) )
3053 ::sd::DrawViewShell
* pDrawViewSh
=
3054 static_cast< ::sd::DrawViewShell
*>(pViewSh
);
3056 EditMode eMode
= pDrawViewSh
->GetEditMode();
3057 if( eMode
== EM_MASTERPAGE
)
3059 BOOL bLayer
= pDrawViewSh
->IsLayerModeActive();
3061 pDrawViewSh
->ChangeEditMode( eMode
, !bLayer
);
3062 pDrawViewSh
->ChangeEditMode( eMode
, bLayer
);
3066 GetModel()->SetModified();
3070 OUString SAL_CALL
SdMasterPage::getName( )
3071 throw(uno::RuntimeException
)
3073 OGuard
aGuard( Application::GetSolarMutex() );
3077 if(SvxFmDrawPage::mpPage
)
3079 String
aLayoutName( GetPage()->GetLayoutName() );
3080 aLayoutName
= aLayoutName
.Erase(aLayoutName
.Search( String( RTL_CONSTASCII_USTRINGPARAM((SD_LT_SEPARATOR
)))));
3088 // XPresentationPage
3089 Reference
< drawing::XDrawPage
> SAL_CALL
SdMasterPage::getNotesPage()
3090 throw(uno::RuntimeException
)
3092 OGuard
aGuard( Application::GetSolarMutex() );
3096 if(SvxFmDrawPage::mpPage
&& GetModel()->GetDoc() )
3098 SdPage
* pNotesPage
= GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage
->GetPageNum()-1)>>1, PK_NOTES
);
3101 Reference
< drawing::XDrawPage
> xPage( pNotesPage
->getUnoPage(), uno::UNO_QUERY
);
3109 void SAL_CALL
SdMasterPage::add( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
3111 SdGenericDrawPage::add( xShape
);
3114 void SAL_CALL
SdMasterPage::remove( const Reference
< drawing::XShape
>& xShape
) throw(uno::RuntimeException
)
3116 OGuard
aGuard( Application::GetSolarMutex() );
3120 SvxShape
* pShape
= SvxShape::getImplementation( xShape
);
3123 SdrObject
* pObj
= pShape
->GetSdrObject();
3126 if( GetPage()->IsPresObj( pObj
) )
3127 GetPage()->RemovePresObj(pObj
);
3131 SdGenericDrawPage::remove( xShape
);
3135 Reference
< uno::XInterface
> createUnoPageImpl( SdPage
* pPage
)
3137 Reference
< uno::XInterface
> xPage
;
3139 if( pPage
&& pPage
->GetModel() )
3141 SdXImpressDocument
* pModel
= SdXImpressDocument::getImplementation( pPage
->GetModel()->getUnoModel() );
3144 if( pPage
->IsMasterPage() )
3146 xPage
= (::cppu::OWeakObject
*)new SdMasterPage( pModel
, pPage
);
3150 xPage
= (::cppu::OWeakObject
*)new SdDrawPage( pModel
, pPage
);