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