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