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