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