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