Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <com/sun/star/presentation/XPresentation2.hpp>
22 :
23 : #include <com/sun/star/lang/DisposedException.hpp>
24 : #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
25 : #include <com/sun/star/lang/Locale.hpp>
26 : #include <com/sun/star/style/XStyle.hpp>
27 : #include <com/sun/star/awt/XDevice.hpp>
28 :
29 : #include <com/sun/star/embed/Aspects.hpp>
30 :
31 : #include <osl/mutex.hxx>
32 : #include <comphelper/sequence.hxx>
33 : #include <comphelper/servicehelper.hxx>
34 : #include <comphelper/serviceinfohelper.hxx>
35 :
36 : #include <editeng/unofield.hxx>
37 : #include <unomodel.hxx>
38 : #include <sfx2/dispatch.hxx>
39 : #include <sfx2/bindings.hxx>
40 : #include <vcl/svapp.hxx>
41 : #include <editeng/UnoForbiddenCharsTable.hxx>
42 : #include <svx/svdoutl.hxx>
43 : #include <editeng/forbiddencharacterstable.hxx>
44 : #include <svx/UnoNamespaceMap.hxx>
45 : #include <svx/svdlayer.hxx>
46 : #include <svx/svdsob.hxx>
47 : #include <svx/unoapi.hxx>
48 : #include <svx/unofill.hxx>
49 : #include <svx/unopool.hxx>
50 : #include <svx/svdorect.hxx>
51 : #include <editeng/flditem.hxx>
52 : #include <toolkit/awt/vclxdevice.hxx>
53 : #include <svx/svdpool.hxx>
54 : #include <editeng/unolingu.hxx>
55 : #include <svx/svdpagv.hxx>
56 : #include <svtools/unoimap.hxx>
57 : #include <svx/unoshape.hxx>
58 : #include <editeng/unonrule.hxx>
59 : #include <editeng/eeitem.hxx>
60 :
61 : // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
62 : #include <svx/xmleohlp.hxx>
63 : #include <svx/xmlgrhlp.hxx>
64 : #include "DrawDocShell.hxx"
65 : #include "ViewShellBase.hxx"
66 : #include <UnoDocumentSettings.hxx>
67 :
68 : #include <drawdoc.hxx>
69 : #include <glob.hrc>
70 : #include <sdresid.hxx>
71 : #include <sdpage.hxx>
72 :
73 : #include <strings.hrc>
74 : #include "unohelp.hxx"
75 : #include <unolayer.hxx>
76 : #include <unoprnms.hxx>
77 : #include <unopage.hxx>
78 : #include <unocpres.hxx>
79 : #include <unoobj.hxx>
80 : #include <stlpool.hxx>
81 : #include <unopback.hxx>
82 : #include <unokywds.hxx>
83 : #include "FrameView.hxx"
84 : #include "ClientView.hxx"
85 : #include "ViewShell.hxx"
86 : #include "app.hrc"
87 : #include <vcl/pdfextoutdevdata.hxx>
88 : #include <com/sun/star/presentation/AnimationEffect.hpp>
89 : #include <com/sun/star/presentation/AnimationSpeed.hpp>
90 : #include <com/sun/star/presentation/ClickAction.hpp>
91 : #include <svx/sdr/contact/viewobjectcontact.hxx>
92 : #include <svx/sdr/contact/viewcontact.hxx>
93 : #include <svx/sdr/contact/displayinfo.hxx>
94 :
95 : #include <com/sun/star/office/XAnnotation.hpp>
96 : #include <com/sun/star/office/XAnnotationAccess.hpp>
97 : #include <com/sun/star/office/XAnnotationEnumeration.hpp>
98 : #include <com/sun/star/geometry/RealPoint2D.hpp>
99 : #include <com/sun/star/util/DateTime.hpp>
100 :
101 : using ::rtl::OUString;
102 :
103 : #include <drawinglayer/primitive2d/structuretagprimitive2d.hxx>
104 :
105 : using namespace ::osl;
106 : using namespace ::cppu;
107 : using namespace ::com::sun::star;
108 :
109 : extern uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel );
110 :
111 : class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
112 : public SfxListener
113 : {
114 : public:
115 : SdUnoForbiddenCharsTable( SdrModel* pModel );
116 : ~SdUnoForbiddenCharsTable();
117 :
118 : // SfxListener
119 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
120 : protected:
121 : virtual void onChange();
122 :
123 : private:
124 : SdrModel* mpModel;
125 : };
126 :
127 4 : SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel )
128 4 : : SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel )
129 : {
130 4 : StartListening( *pModel );
131 4 : }
132 :
133 6 : void SdUnoForbiddenCharsTable::onChange()
134 : {
135 6 : if( mpModel )
136 : {
137 6 : mpModel->ReformatAllTextObjects();
138 : }
139 6 : }
140 :
141 12 : SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable()
142 : {
143 4 : if( mpModel )
144 4 : EndListening( *mpModel );
145 8 : }
146 :
147 0 : void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
148 : {
149 0 : const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
150 :
151 0 : if( pSdrHint )
152 : {
153 0 : if( HINT_MODELCLEARED == pSdrHint->GetKind() )
154 : {
155 0 : mpModel = NULL;
156 : }
157 : }
158 0 : }
159 :
160 : ///////////////////////////////////////////////////////////////////////
161 :
162 : const sal_Int32 WID_MODEL_LANGUAGE = 1;
163 : const sal_Int32 WID_MODEL_TABSTOP = 2;
164 : const sal_Int32 WID_MODEL_VISAREA = 3;
165 : const sal_Int32 WID_MODEL_MAPUNIT = 4;
166 : const sal_Int32 WID_MODEL_FORBCHARS= 5;
167 : const sal_Int32 WID_MODEL_CONTFOCUS = 6;
168 : const sal_Int32 WID_MODEL_DSGNMODE = 7;
169 : const sal_Int32 WID_MODEL_BASICLIBS = 8;
170 : const sal_Int32 WID_MODEL_RUNTIMEUID = 9;
171 : const sal_Int32 WID_MODEL_BUILDID = 10;
172 : const sal_Int32 WID_MODEL_HASVALIDSIGNATURES = 11;
173 : const sal_Int32 WID_MODEL_DIALOGLIBS = 12;
174 :
175 36 : const SvxItemPropertySet* ImplGetDrawModelPropertySet()
176 : {
177 : // Achtung: Der erste Parameter MUSS sortiert vorliegen !!!
178 : const static SfxItemPropertyMapEntry aDrawModelPropertyMap_Impl[] =
179 : {
180 4 : { MAP_CHAR_LEN("BuildId"), WID_MODEL_BUILDID, &::getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
181 4 : { MAP_CHAR_LEN(sUNO_Prop_CharLocale), WID_MODEL_LANGUAGE, &::getCppuType((const lang::Locale*)0), 0, 0},
182 4 : { MAP_CHAR_LEN(sUNO_Prop_TabStop), WID_MODEL_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0},
183 4 : { MAP_CHAR_LEN(sUNO_Prop_VisibleArea), WID_MODEL_VISAREA, &::getCppuType((const awt::Rectangle*)0), 0, 0},
184 4 : { MAP_CHAR_LEN(sUNO_Prop_MapUnit), WID_MODEL_MAPUNIT, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
185 4 : { MAP_CHAR_LEN(sUNO_Prop_ForbiddenCharacters), WID_MODEL_FORBCHARS,&::getCppuType((const uno::Reference< i18n::XForbiddenCharacters > *)0), beans::PropertyAttribute::READONLY, 0 },
186 4 : { MAP_CHAR_LEN(sUNO_Prop_AutomContFocus ), WID_MODEL_CONTFOCUS, &::getBooleanCppuType(), 0, 0},
187 4 : { MAP_CHAR_LEN(sUNO_Prop_ApplyFrmDsgnMode), WID_MODEL_DSGNMODE, &::getBooleanCppuType(), 0, 0},
188 4 : { MAP_CHAR_LEN("BasicLibraries"), WID_MODEL_BASICLIBS,&::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
189 4 : { MAP_CHAR_LEN("DialogLibraries"), WID_MODEL_DIALOGLIBS, &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 },
190 4 : { MAP_CHAR_LEN(sUNO_Prop_RuntimeUID), WID_MODEL_RUNTIMEUID, &::getCppuType(static_cast< const rtl::OUString * >(0)), beans::PropertyAttribute::READONLY, 0 },
191 4 : { MAP_CHAR_LEN(sUNO_Prop_HasValidSignatures), WID_MODEL_HASVALIDSIGNATURES, &::getCppuType(static_cast< const sal_Bool * >(0)), beans::PropertyAttribute::READONLY, 0 },
192 : { 0,0,0,0,0,0 }
193 84 : };
194 36 : static SvxItemPropertySet aDrawModelPropertySet_Impl( aDrawModelPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
195 36 : return &aDrawModelPropertySet_Impl;
196 : }
197 :
198 : // this ctor is used from the DocShell
199 36 : SdXImpressDocument::SdXImpressDocument (::sd::DrawDocShell* pShell, bool bClipBoard ) throw()
200 : : SfxBaseModel( pShell ),
201 : mpDocShell( pShell ),
202 : mpDoc( pShell ? pShell->GetDoc() : NULL ),
203 : mbDisposed(false),
204 72 : mbImpressDoc( pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
205 : mbClipBoard( bClipBoard ),
206 108 : mpPropSet( ImplGetDrawModelPropertySet() )
207 : {
208 36 : if( mpDoc )
209 : {
210 36 : StartListening( *mpDoc );
211 : }
212 : else
213 : {
214 : OSL_FAIL("DocShell is invalid");
215 : }
216 36 : }
217 :
218 0 : SdXImpressDocument::SdXImpressDocument( SdDrawDocument* pDoc, bool bClipBoard ) throw()
219 : : SfxBaseModel( NULL ),
220 : mpDocShell( NULL ),
221 : mpDoc( pDoc ),
222 : mbDisposed(false),
223 0 : mbImpressDoc( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ),
224 : mbClipBoard( bClipBoard ),
225 0 : mpPropSet( ImplGetDrawModelPropertySet() )
226 : {
227 0 : if( mpDoc )
228 : {
229 0 : StartListening( *mpDoc );
230 : }
231 : else
232 : {
233 : OSL_FAIL("SdDrawDocument is invalid");
234 : }
235 0 : }
236 :
237 : /***********************************************************************
238 : * *
239 : ***********************************************************************/
240 64 : SdXImpressDocument::~SdXImpressDocument() throw()
241 : {
242 64 : }
243 :
244 : // XInterface
245 3666 : uno::Any SAL_CALL SdXImpressDocument::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
246 : {
247 3666 : uno::Any aAny;
248 :
249 3666 : QUERYINT(lang::XServiceInfo);
250 3610 : else QUERYINT(beans::XPropertySet);
251 3544 : else QUERYINT(lang::XMultiServiceFactory);
252 3054 : else QUERYINT(drawing::XDrawPageDuplicator);
253 3054 : else QUERYINT(drawing::XLayerSupplier);
254 3050 : else QUERYINT(drawing::XMasterPagesSupplier);
255 3026 : else QUERYINT(drawing::XDrawPagesSupplier);
256 2996 : else QUERYINT(presentation::XHandoutMasterSupplier);
257 2994 : else QUERYINT(document::XLinkTargetSupplier);
258 2994 : else QUERYINT(style::XStyleFamiliesSupplier);
259 2750 : else QUERYINT(com::sun::star::ucb::XAnyCompareFactory);
260 2728 : else QUERYINT(view::XRenderable);
261 2728 : else if( mbImpressDoc && rType == ITYPE(presentation::XPresentationSupplier) )
262 2 : aAny <<= uno::Reference< presentation::XPresentationSupplier >(this);
263 2726 : else if( mbImpressDoc && rType == ITYPE(presentation::XCustomPresentationSupplier) )
264 2 : aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this);
265 : else
266 2724 : return SfxBaseModel::queryInterface( rType );
267 :
268 942 : return aAny;
269 : }
270 :
271 7302 : void SAL_CALL SdXImpressDocument::acquire() throw ( )
272 : {
273 7302 : SfxBaseModel::acquire();
274 7302 : }
275 :
276 7286 : void SAL_CALL SdXImpressDocument::release() throw ( )
277 : {
278 7286 : if (osl_atomic_decrement( &m_refCount ) == 0)
279 : {
280 : // restore reference count:
281 32 : osl_atomic_increment( &m_refCount );
282 32 : if(!mbDisposed)
283 : {
284 : try
285 : {
286 0 : dispose();
287 : }
288 0 : catch (const uno::RuntimeException& exc)
289 : { // don't break throw ()
290 : OSL_FAIL(
291 : OUStringToOString(
292 : exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
293 : static_cast<void>(exc);
294 : }
295 : }
296 32 : SfxBaseModel::release();
297 : }
298 7286 : }
299 :
300 : namespace
301 : {
302 : class theSdXImpressDocumentUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdXImpressDocumentUnoTunnelId> {};
303 : }
304 :
305 : // XUnoTunnel
306 280 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SdXImpressDocument::getUnoTunnelId() throw()
307 : {
308 280 : return theSdXImpressDocumentUnoTunnelId::get().getSeq();
309 : }
310 :
311 128 : SdXImpressDocument* SdXImpressDocument::getImplementation( const uno::Reference< uno::XInterface >& xInt )
312 : {
313 128 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
314 128 : if( xUT.is() )
315 128 : return reinterpret_cast<SdXImpressDocument*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( SdXImpressDocument::getUnoTunnelId() )));
316 : else
317 0 : return NULL;
318 : }
319 :
320 152 : sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException)
321 : {
322 152 : if( rIdentifier.getLength() == 16 )
323 : {
324 152 : if( (0 == memcmp( SdXImpressDocument::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
325 128 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
326 :
327 24 : if( (0 == memcmp( SdrModel::getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 )) )
328 0 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc));
329 : }
330 :
331 24 : return SfxBaseModel::getSomething( rIdentifier );
332 : }
333 :
334 : // XTypeProvider
335 0 : uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( ) throw(uno::RuntimeException)
336 : {
337 0 : ::SolarMutexGuard aGuard;
338 :
339 0 : if( maTypeSequence.getLength() == 0 )
340 : {
341 0 : const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() );
342 0 : const sal_Int32 nBaseTypes = aBaseTypes.getLength();
343 0 : const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
344 :
345 0 : const sal_Int32 nOwnTypes = mbImpressDoc ? 14 : 11; // !DANGER! Keep this updated!
346 :
347 0 : maTypeSequence.realloc( nBaseTypes + nOwnTypes );
348 0 : uno::Type* pTypes = maTypeSequence.getArray();
349 :
350 0 : *pTypes++ = ITYPE(beans::XPropertySet);
351 0 : *pTypes++ = ITYPE(lang::XServiceInfo);
352 0 : *pTypes++ = ITYPE(lang::XMultiServiceFactory);
353 0 : *pTypes++ = ITYPE(drawing::XDrawPageDuplicator);
354 0 : *pTypes++ = ITYPE(drawing::XLayerSupplier);
355 0 : *pTypes++ = ITYPE(drawing::XMasterPagesSupplier);
356 0 : *pTypes++ = ITYPE(drawing::XDrawPagesSupplier);
357 0 : *pTypes++ = ITYPE(document::XLinkTargetSupplier);
358 0 : *pTypes++ = ITYPE(style::XStyleFamiliesSupplier);
359 0 : *pTypes++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory);
360 0 : *pTypes++ = ITYPE(view::XRenderable);
361 0 : if( mbImpressDoc )
362 : {
363 0 : *pTypes++ = ITYPE(presentation::XPresentationSupplier);
364 0 : *pTypes++ = ITYPE(presentation::XCustomPresentationSupplier);
365 0 : *pTypes++ = ITYPE(presentation::XHandoutMasterSupplier);
366 : }
367 :
368 0 : for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
369 0 : *pTypes++ = *pBaseTypes++;
370 : }
371 :
372 0 : return maTypeSequence;
373 : }
374 :
375 : namespace
376 : {
377 : class theSdXImpressDocumentImplementationId : public rtl::Static< UnoTunnelIdInit, theSdXImpressDocumentImplementationId > {};
378 : }
379 :
380 0 : uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( ) throw(uno::RuntimeException)
381 : {
382 0 : return theSdXImpressDocumentImplementationId::get().getSeq();
383 : }
384 :
385 : /***********************************************************************
386 : * *
387 : ***********************************************************************/
388 2598 : void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
389 : {
390 2598 : if( mpDoc )
391 : {
392 2586 : const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
393 :
394 2586 : if( pSdrHint )
395 : {
396 2150 : if( hasEventListeners() )
397 : {
398 0 : document::EventObject aEvent;
399 0 : if( SvxUnoDrawMSFactory::createEvent( mpDoc, pSdrHint, aEvent ) )
400 0 : notifyEvent( aEvent );
401 : }
402 :
403 2150 : if( pSdrHint->GetKind() == HINT_MODELCLEARED )
404 : {
405 0 : if( mpDoc )
406 0 : EndListening( *mpDoc );
407 0 : mpDoc = NULL;
408 0 : mpDocShell = NULL;
409 : }
410 : }
411 : else
412 : {
413 436 : const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint );
414 :
415 : // ist unser SdDrawDocument gerade gestorben?
416 436 : if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING)
417 : {
418 : // yup, also schnell ein neues erfragen
419 0 : if( mpDocShell )
420 : {
421 0 : SdDrawDocument *pNewDoc = mpDocShell->GetDoc();
422 :
423 : // ist ueberhaupt ein neues da?
424 0 : if( pNewDoc != mpDoc )
425 : {
426 0 : mpDoc = pNewDoc;
427 0 : if(mpDoc)
428 0 : StartListening( *mpDoc );
429 : }
430 : }
431 : }
432 : }
433 : }
434 2598 : SfxBaseModel::Notify( rBC, rHint );
435 2598 : }
436 :
437 : /******************************************************************************
438 : * *
439 : ******************************************************************************/
440 14 : SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate ) throw()
441 : {
442 14 : sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
443 14 : SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
444 14 : sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
445 14 : sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
446 :
447 14 : SdPage* pStandardPage = NULL;
448 :
449 14 : if( 0 == nPageCount )
450 : {
451 : // this is only used for clipboard where we only have one page
452 0 : pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
453 :
454 0 : Size aDefSize(21000, 29700); // A4-Hochformat
455 0 : pStandardPage->SetSize( aDefSize );
456 0 : mpDoc->InsertPage(pStandardPage, 0);
457 : }
458 : else
459 : {
460 : // Hier wird die Seite ermittelt, hinter der eingefuegt werden soll
461 14 : SdPage* pPreviousStandardPage = mpDoc->GetSdPage( Min( (sal_uInt16)(nPageCount - 1), nPage ), PK_STANDARD );
462 14 : SetOfByte aVisibleLayers = pPreviousStandardPage->TRG_GetMasterPageVisibleLayers();
463 14 : sal_Bool bIsPageBack = aVisibleLayers.IsSet( aBckgrnd );
464 14 : sal_Bool bIsPageObj = aVisibleLayers.IsSet( aBckgrndObj );
465 :
466 : // AutoLayouts must be ready
467 14 : mpDoc->StopWorkStartupDelay();
468 :
469 : /**************************************************************
470 : * Es wird stets zuerst eine Standardseite und dann eine
471 : * Notizseite erzeugt. Es ist sichergestellt, dass auf eine
472 : * Standardseite stets die zugehoerige Notizseite folgt.
473 : **************************************************************/
474 :
475 14 : sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2;
476 14 : SdPage* pPreviousNotesPage = (SdPage*) mpDoc->GetPage( nStandardPageNum - 1 );
477 14 : sal_uInt16 nNotesPageNum = nStandardPageNum + 1;
478 14 : String aStandardPageName;
479 14 : String aNotesPageName;
480 :
481 : /**************************************************************
482 : * Standardpage
483 : **************************************************************/
484 14 : if( bDuplicate )
485 0 : pStandardPage = (SdPage*) pPreviousStandardPage->Clone();
486 : else
487 14 : pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False);
488 :
489 14 : pStandardPage->SetSize( pPreviousStandardPage->GetSize() );
490 14 : pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(),
491 14 : pPreviousStandardPage->GetUppBorder(),
492 14 : pPreviousStandardPage->GetRgtBorder(),
493 56 : pPreviousStandardPage->GetLwrBorder() );
494 14 : pStandardPage->SetOrientation( pPreviousStandardPage->GetOrientation() );
495 14 : pStandardPage->SetName(aStandardPageName);
496 :
497 : // Seite hinter aktueller Seite einfuegen
498 14 : mpDoc->InsertPage(pStandardPage, nStandardPageNum);
499 :
500 14 : if( !bDuplicate )
501 : {
502 : // MasterPage der aktuellen Seite verwenden
503 14 : pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage());
504 14 : pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() );
505 14 : pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True );
506 : }
507 :
508 14 : aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False);
509 14 : aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False);
510 14 : aVisibleLayers.Set(aBckgrnd, bIsPageBack);
511 14 : aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
512 14 : pStandardPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
513 :
514 : /**************************************************************
515 : * Notespage
516 : **************************************************************/
517 14 : SdPage* pNotesPage = NULL;
518 :
519 14 : if( bDuplicate )
520 0 : pNotesPage = (SdPage*) pPreviousNotesPage->Clone();
521 : else
522 14 : pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False);
523 :
524 14 : pNotesPage->SetSize( pPreviousNotesPage->GetSize() );
525 14 : pNotesPage->SetBorder( pPreviousNotesPage->GetLftBorder(),
526 14 : pPreviousNotesPage->GetUppBorder(),
527 14 : pPreviousNotesPage->GetRgtBorder(),
528 56 : pPreviousNotesPage->GetLwrBorder() );
529 14 : pNotesPage->SetOrientation( pPreviousNotesPage->GetOrientation() );
530 14 : pNotesPage->SetName(aNotesPageName);
531 14 : pNotesPage->SetPageKind(PK_NOTES);
532 :
533 : // Seite hinter aktueller Seite einfuegen
534 14 : mpDoc->InsertPage(pNotesPage, nNotesPageNum);
535 :
536 14 : if( !bDuplicate )
537 : {
538 : // MasterPage der aktuellen Seite verwenden
539 14 : pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage());
540 14 : pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() );
541 14 : pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True );
542 14 : }
543 : }
544 :
545 14 : SetModified();
546 :
547 14 : return( pStandardPage );
548 : }
549 :
550 3440 : void SdXImpressDocument::SetModified( sal_Bool bModified /* = sal_True */ ) throw()
551 : {
552 3440 : if( mpDoc )
553 3440 : mpDoc->SetChanged( bModified );
554 3440 : }
555 :
556 : // XModel
557 12 : void SAL_CALL SdXImpressDocument ::lockControllers( )
558 : throw(uno::RuntimeException)
559 : {
560 12 : ::SolarMutexGuard aGuard;
561 :
562 12 : if( NULL == mpDoc )
563 0 : throw lang::DisposedException();
564 :
565 12 : mpDoc->setLock(true);
566 12 : }
567 :
568 12 : void SAL_CALL SdXImpressDocument::unlockControllers( )
569 : throw(uno::RuntimeException)
570 : {
571 12 : ::SolarMutexGuard aGuard;
572 :
573 12 : if( NULL == mpDoc )
574 0 : throw lang::DisposedException();
575 :
576 12 : if( mpDoc->isLocked() )
577 : {
578 12 : mpDoc->setLock(false);
579 12 : }
580 12 : }
581 :
582 0 : sal_Bool SAL_CALL SdXImpressDocument::hasControllersLocked( )
583 : throw(uno::RuntimeException)
584 : {
585 0 : ::SolarMutexGuard aGuard;
586 :
587 0 : if( NULL == mpDoc )
588 0 : throw lang::DisposedException();
589 :
590 0 : return mpDoc && mpDoc->isLocked();
591 : }
592 :
593 : #include <comphelper/processfactory.hxx>
594 :
595 0 : uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewData() throw( uno::RuntimeException )
596 : {
597 0 : ::SolarMutexGuard aGuard;
598 :
599 0 : if( NULL == mpDoc )
600 0 : throw lang::DisposedException();
601 :
602 0 : uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() );
603 :
604 0 : if( !xRet.is() )
605 : {
606 0 : const std::vector<sd::FrameView*> &rList = mpDoc->GetFrameViewList();
607 :
608 0 : if( !rList.empty() )
609 : {
610 0 : xRet = uno::Reference < container::XIndexAccess >::query(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.document.IndexedPropertyValues"));
611 :
612 :
613 0 : uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY );
614 : DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" );
615 0 : if( xCont.is() )
616 : {
617 0 : for( sal_uInt32 i = 0, n = rList.size(); i < n; i++ )
618 : {
619 0 : ::sd::FrameView* pFrameView = rList[ i ];
620 :
621 0 : uno::Sequence< beans::PropertyValue > aSeq;
622 0 : pFrameView->WriteUserDataSequence( aSeq );
623 0 : xCont->insertByIndex( i, uno::makeAny( aSeq ) );
624 0 : }
625 0 : }
626 : }
627 : }
628 :
629 0 : return xRet;
630 : }
631 :
632 4 : void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container::XIndexAccess >& xData ) throw(::com::sun::star::uno::RuntimeException)
633 : {
634 4 : ::SolarMutexGuard aGuard;
635 :
636 4 : if( NULL == mpDoc )
637 0 : throw lang::DisposedException();
638 :
639 4 : SfxBaseModel::setViewData( xData );
640 4 : if( mpDocShell && (mpDocShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) && xData.is() )
641 : {
642 4 : const sal_Int32 nCount = xData->getCount();
643 :
644 4 : std::vector<sd::FrameView*>::iterator pIter;
645 4 : std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
646 :
647 4 : for ( pIter = rViews.begin(); pIter != rViews.end(); ++pIter )
648 0 : delete *pIter;
649 :
650 4 : rViews.clear();
651 :
652 : ::sd::FrameView* pFrameView;
653 4 : uno::Sequence< beans::PropertyValue > aSeq;
654 8 : for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
655 : {
656 4 : if( xData->getByIndex( nIndex ) >>= aSeq )
657 : {
658 4 : pFrameView = new ::sd::FrameView( mpDoc );
659 :
660 4 : pFrameView->ReadUserDataSequence( aSeq );
661 4 : rViews.push_back( pFrameView );
662 : }
663 4 : }
664 4 : }
665 4 : }
666 :
667 : // XDrawPageDuplicator
668 0 : uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::duplicate( const uno::Reference< drawing::XDrawPage >& xPage )
669 : throw(uno::RuntimeException)
670 : {
671 0 : ::SolarMutexGuard aGuard;
672 :
673 0 : if( NULL == mpDoc )
674 0 : throw lang::DisposedException();
675 :
676 : // pPage von xPage besorgen und dann die Id (nPos )ermitteln
677 0 : SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage );
678 0 : if( pSvxPage )
679 : {
680 0 : SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
681 0 : sal_uInt16 nPos = pPage->GetPageNum();
682 0 : nPos = ( nPos - 1 ) / 2;
683 0 : pPage = InsertSdPage( nPos, sal_True );
684 0 : if( pPage )
685 : {
686 0 : uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
687 0 : return xDrawPage;
688 : }
689 : }
690 :
691 0 : uno::Reference< drawing::XDrawPage > xDrawPage;
692 0 : return xDrawPage;
693 : }
694 :
695 :
696 : // XDrawPagesSupplier
697 30 : uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages()
698 : throw(uno::RuntimeException)
699 : {
700 30 : ::SolarMutexGuard aGuard;
701 :
702 30 : if( NULL == mpDoc )
703 0 : throw lang::DisposedException();
704 :
705 30 : uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess );
706 :
707 30 : if( !xDrawPages.is() )
708 : {
709 28 : initializeDocument();
710 28 : mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SdDrawPagesAccess(*this);
711 : }
712 :
713 30 : return xDrawPages;
714 : }
715 :
716 : // XMasterPagesSupplier
717 24 : uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getMasterPages()
718 : throw(uno::RuntimeException)
719 : {
720 24 : ::SolarMutexGuard aGuard;
721 :
722 24 : if( NULL == mpDoc )
723 0 : throw lang::DisposedException();
724 :
725 24 : uno::Reference< drawing::XDrawPages > xMasterPages( mxMasterPagesAccess );
726 :
727 24 : if( !xMasterPages.is() )
728 : {
729 24 : initializeDocument();
730 24 : mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this);
731 : }
732 :
733 24 : return xMasterPages;
734 : }
735 :
736 : // XLayerManagerSupplier
737 4 : uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLayerManager( )
738 : throw(uno::RuntimeException)
739 : {
740 4 : ::SolarMutexGuard aGuard;
741 :
742 4 : if( NULL == mpDoc )
743 0 : throw lang::DisposedException();
744 :
745 4 : uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
746 :
747 4 : if( !xLayerManager.is() )
748 4 : mxLayerManager = xLayerManager = new SdLayerManager(*this);
749 :
750 4 : return xLayerManager;
751 : }
752 :
753 : // XCustomPresentationSupplier
754 2 : uno::Reference< container::XNameContainer > SAL_CALL SdXImpressDocument::getCustomPresentations()
755 : throw(uno::RuntimeException)
756 : {
757 2 : ::SolarMutexGuard aGuard;
758 :
759 2 : if( NULL == mpDoc )
760 0 : throw lang::DisposedException();
761 :
762 2 : uno::Reference< container::XNameContainer > xCustomPres( mxCustomPresentationAccess );
763 :
764 2 : if( !xCustomPres.is() )
765 2 : mxCustomPresentationAccess = xCustomPres = new SdXCustomPresentationAccess(*this);
766 :
767 2 : return xCustomPres;
768 : }
769 :
770 : extern uno::Reference< presentation::XPresentation > createPresentation( SdXImpressDocument& rModel );
771 :
772 : // XPresentationSupplier
773 2 : uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPresentation()
774 : throw(uno::RuntimeException)
775 : {
776 2 : ::SolarMutexGuard aGuard;
777 :
778 2 : if( NULL == mpDoc )
779 0 : throw lang::DisposedException();
780 :
781 2 : return uno::Reference< presentation::XPresentation >( mpDoc->getPresentation().get() );
782 : }
783 :
784 : // XHandoutMasterSupplier
785 2 : uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMasterPage()
786 : throw (uno::RuntimeException)
787 : {
788 2 : ::SolarMutexGuard aGuard;
789 :
790 2 : if( NULL == mpDoc )
791 0 : throw lang::DisposedException();
792 :
793 2 : uno::Reference< drawing::XDrawPage > xPage;
794 :
795 2 : if( mpDoc )
796 : {
797 2 : initializeDocument();
798 2 : SdPage* pPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT );
799 2 : if( pPage )
800 2 : xPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
801 : }
802 2 : return xPage;
803 : }
804 :
805 : // XMultiServiceFactory ( SvxFmMSFactory )
806 432 : uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier )
807 : throw(uno::Exception, uno::RuntimeException)
808 : {
809 432 : ::SolarMutexGuard aGuard;
810 :
811 432 : if( NULL == mpDoc )
812 0 : throw lang::DisposedException();
813 :
814 432 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) )
815 : {
816 6 : if( !mxDashTable.is() )
817 4 : mxDashTable = SvxUnoDashTable_createInstance( mpDoc );
818 :
819 6 : return mxDashTable;
820 : }
821 426 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) )
822 : {
823 6 : if( !mxGradientTable.is() )
824 4 : mxGradientTable = SvxUnoGradientTable_createInstance( mpDoc );
825 :
826 6 : return mxGradientTable;
827 : }
828 420 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) )
829 : {
830 6 : if( !mxHatchTable.is() )
831 4 : mxHatchTable = SvxUnoHatchTable_createInstance( mpDoc );
832 :
833 6 : return mxHatchTable;
834 : }
835 414 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) )
836 : {
837 4 : if( !mxBitmapTable.is() )
838 4 : mxBitmapTable = SvxUnoBitmapTable_createInstance( mpDoc );
839 :
840 4 : return mxBitmapTable;
841 : }
842 410 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) )
843 : {
844 4 : if( !mxTransGradientTable.is() )
845 4 : mxTransGradientTable = SvxUnoTransGradientTable_createInstance( mpDoc );
846 :
847 4 : return mxTransGradientTable;
848 : }
849 406 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
850 : {
851 10 : if( !mxMarkerTable.is() )
852 6 : mxMarkerTable = SvxUnoMarkerTable_createInstance( mpDoc );
853 :
854 10 : return mxMarkerTable;
855 : }
856 396 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) )
857 : {
858 14 : return uno::Reference< uno::XInterface >( SvxCreateNumRule( mpDoc ), uno::UNO_QUERY );
859 : }
860 382 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Background" ) ) )
861 : {
862 : return uno::Reference< uno::XInterface >(
863 22 : static_cast<uno::XWeak*>(new SdUnoPageBackground( mpDoc )));
864 : }
865 :
866 360 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) )
867 : {
868 4 : if( !mxDrawingPool.is() )
869 4 : mxDrawingPool = SdUnoCreatePool( mpDoc );
870 :
871 4 : return mxDrawingPool;
872 :
873 : }
874 :
875 356 : if ( aServiceSpecifier == sUNO_Service_ImageMapRectangleObject )
876 : {
877 0 : return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() );
878 : }
879 :
880 356 : if ( aServiceSpecifier == sUNO_Service_ImageMapCircleObject )
881 : {
882 0 : return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() );
883 : }
884 :
885 356 : if ( aServiceSpecifier == sUNO_Service_ImageMapPolygonObject )
886 : {
887 0 : return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() );
888 : }
889 :
890 1052 : if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) ||
891 348 : ( !mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DocumentSettings") ) ) ) ||
892 348 : ( mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.DocumentSettings") ) ) ) )
893 : {
894 8 : return sd::DocumentSettings_createInstance( this );
895 : }
896 :
897 694 : if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) ||
898 346 : ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime") ) ) )
899 : {
900 2 : return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::DATE );
901 : }
902 :
903 688 : if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Header"))) ||
904 342 : (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Header"))) )
905 : {
906 4 : return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_HEADER );
907 : }
908 :
909 678 : if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Footer"))) ||
910 336 : (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Footer"))) )
911 : {
912 6 : return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_FOOTER );
913 : }
914 :
915 666 : if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.DateTime"))) ||
916 330 : (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.DateTime"))) )
917 : {
918 6 : return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_DATE_TIME );
919 : }
920 :
921 330 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) )
922 : {
923 : static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 };
924 :
925 0 : return svx::NamespaceMap_createInstance( aWhichIds, &mpDoc->GetItemPool() );
926 : }
927 :
928 : // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
929 330 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver") ) )
930 : {
931 0 : return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE );
932 : }
933 :
934 330 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver") ) )
935 : {
936 4 : return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ );
937 : }
938 :
939 326 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver") ) )
940 : {
941 0 : ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
942 0 : if( NULL == pPersist )
943 0 : throw lang::DisposedException();
944 :
945 0 : return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE );
946 : }
947 :
948 326 : if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) )
949 : {
950 4 : ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL;
951 4 : if( NULL == pPersist )
952 0 : throw lang::DisposedException();
953 :
954 4 : return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_READ );
955 : }
956 :
957 322 : uno::Reference< uno::XInterface > xRet;
958 :
959 322 : const String aType( aServiceSpecifier );
960 322 : if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) )
961 : {
962 110 : SvxShape* pShape = NULL;
963 :
964 110 : sal_uInt16 nType = OBJ_TEXT;
965 : // create a shape wrapper
966 110 : if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) )
967 : {
968 12 : nType = OBJ_TEXT;
969 : }
970 98 : else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) )
971 : {
972 8 : nType = OBJ_TEXT;
973 : }
974 90 : else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) )
975 : {
976 0 : nType = OBJ_TEXT;
977 : }
978 90 : else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) )
979 : {
980 2 : nType = OBJ_GRAF;
981 : }
982 88 : else if( aType.EqualsAscii( "PageShape", 26, 9 ) )
983 : {
984 20 : nType = OBJ_PAGE;
985 : }
986 68 : else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) )
987 : {
988 0 : nType = OBJ_OLE2;
989 : }
990 68 : else if( aType.EqualsAscii( "ChartShape", 26, 10 ) )
991 : {
992 0 : nType = OBJ_OLE2;
993 : }
994 68 : else if( aType.EqualsAscii( "CalcShape", 26, 9 ) )
995 : {
996 0 : nType = OBJ_OLE2;
997 : }
998 68 : else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
999 : {
1000 0 : nType = OBJ_TABLE;
1001 : }
1002 68 : else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) )
1003 : {
1004 0 : nType = OBJ_OLE2;
1005 : }
1006 68 : else if( aType.EqualsAscii( "NotesShape", 26, 13 ) )
1007 : {
1008 20 : nType = OBJ_TEXT;
1009 : }
1010 48 : else if( aType.EqualsAscii( "HandoutShape", 26, 13 ) )
1011 : {
1012 12 : nType = OBJ_PAGE;
1013 : }
1014 36 : else if( aType.EqualsAscii( "FooterShape", 26, 12 ) )
1015 : {
1016 10 : nType = OBJ_TEXT;
1017 : }
1018 26 : else if( aType.EqualsAscii( "HeaderShape", 26, 12 ) )
1019 : {
1020 4 : nType = OBJ_TEXT;
1021 : }
1022 22 : else if( aType.EqualsAscii( "SlideNumberShape", 26, 17 ) )
1023 : {
1024 14 : nType = OBJ_TEXT;
1025 : }
1026 8 : else if( aType.EqualsAscii( "DateTimeShape", 26, 17 ) )
1027 : {
1028 8 : nType = OBJ_TEXT;
1029 : }
1030 0 : else if( aType.EqualsAscii( "MediaShape", 26, 10 ) )
1031 : {
1032 0 : nType = OBJ_MEDIA;
1033 : }
1034 : else
1035 : {
1036 0 : throw lang::ServiceNotRegisteredException();
1037 : }
1038 :
1039 : // create the API wrapper
1040 110 : pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor );
1041 :
1042 : // set shape type
1043 110 : if( pShape && !mbClipBoard )
1044 110 : pShape->SetShapeType(aServiceSpecifier);
1045 :
1046 110 : xRet = (uno::XWeak*)pShape;
1047 : }
1048 212 : else if ( aServiceSpecifier == "com.sun.star.drawing.TableShape" )
1049 : {
1050 4 : SvxShape* pShape = CreateSvxShapeByTypeAndInventor( OBJ_TABLE, SdrInventor );
1051 4 : if( pShape && !mbClipBoard )
1052 4 : pShape->SetShapeType(aServiceSpecifier);
1053 :
1054 4 : xRet = (uno::XWeak*)pShape;
1055 : }
1056 : else
1057 : {
1058 208 : xRet = SvxFmMSFactory::createInstance( aServiceSpecifier );
1059 : }
1060 :
1061 322 : uno::Reference< drawing::XShape > xShape( xRet, uno::UNO_QUERY );
1062 322 : if( xShape.is() )
1063 : {
1064 308 : xRet.clear();
1065 308 : new SdXShape( SvxShape::getImplementation( xShape ), (SdXImpressDocument*)this );
1066 308 : xRet = xShape;
1067 308 : xShape.clear();
1068 : }
1069 :
1070 322 : return xRet;
1071 : }
1072 :
1073 16 : uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames()
1074 : throw(uno::RuntimeException)
1075 : {
1076 16 : ::SolarMutexGuard aGuard;
1077 :
1078 16 : if( NULL == mpDoc )
1079 0 : throw lang::DisposedException();
1080 :
1081 16 : const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
1082 :
1083 16 : uno::Sequence< OUString > aSNS( mbImpressDoc ? (36) : (19) );
1084 :
1085 16 : sal_uInt16 i(0);
1086 :
1087 16 : aSNS[i++] = "com.sun.star.drawing.DashTable";
1088 16 : aSNS[i++] = "com.sun.star.drawing.GradientTable";
1089 16 : aSNS[i++] = "com.sun.star.drawing.HatchTable";
1090 16 : aSNS[i++] = "com.sun.star.drawing.BitmapTable";
1091 16 : aSNS[i++] = "com.sun.star.drawing.TransparencyGradientTable";
1092 16 : aSNS[i++] = "com.sun.star.drawing.MarkerTable";
1093 16 : aSNS[i++] = "com.sun.star.text.NumberingRules";
1094 16 : aSNS[i++] = "com.sun.star.drawing.Background";
1095 16 : aSNS[i++] = "com.sun.star.document.Settings";
1096 16 : aSNS[i++] = sUNO_Service_ImageMapRectangleObject;
1097 16 : aSNS[i++] = sUNO_Service_ImageMapCircleObject;
1098 16 : aSNS[i++] = sUNO_Service_ImageMapPolygonObject;
1099 16 : aSNS[i++] = "com.sun.star.xml.NamespaceMap";
1100 :
1101 : // Support creation of GraphicObjectResolver and EmbeddedObjectResolver
1102 16 : aSNS[i++] = "com.sun.star.document.ExportGraphicObjectResolver";
1103 16 : aSNS[i++] = "com.sun.star.document.ImportGraphicObjectResolver";
1104 16 : aSNS[i++] = "com.sun.star.document.ExportEmbeddedObjectResolver";
1105 16 : aSNS[i++] = "com.sun.star.document.ImportEmbeddedObjectResolver";
1106 16 : aSNS[i++] = "com.sun.star.drawing.TableShape";
1107 :
1108 16 : if(mbImpressDoc)
1109 : {
1110 16 : aSNS[i++] = "com.sun.star.presentation.TitleTextShape";
1111 16 : aSNS[i++] = "com.sun.star.presentation.OutlinerShape";
1112 16 : aSNS[i++] = "com.sun.star.presentation.SubtitleShape";
1113 16 : aSNS[i++] = "com.sun.star.presentation.GraphicObjectShape";
1114 16 : aSNS[i++] = "com.sun.star.presentation.ChartShape";
1115 16 : aSNS[i++] = "com.sun.star.presentation.PageShape";
1116 16 : aSNS[i++] = "com.sun.star.presentation.OLE2Shape";
1117 16 : aSNS[i++] = "com.sun.star.presentation.TableShape";
1118 16 : aSNS[i++] = "com.sun.star.presentation.OrgChartShape";
1119 16 : aSNS[i++] = "com.sun.star.presentation.NotesShape";
1120 16 : aSNS[i++] = "com.sun.star.presentation.HandoutShape";
1121 16 : aSNS[i++] = "com.sun.star.presentation.DocumentSettings";
1122 16 : aSNS[i++] = "com.sun.star.presentation.FooterShape";
1123 16 : aSNS[i++] = "com.sun.star.presentation.HeaderShape";
1124 16 : aSNS[i++] = "com.sun.star.presentation.SlideNumberShape";
1125 16 : aSNS[i++] = "com.sun.star.presentation.DateTimeShape";
1126 16 : aSNS[i++] = "com.sun.star.presentation.CalcShape";
1127 16 : aSNS[i++] = "com.sun.star.presentation.MediaShape";
1128 : }
1129 : else
1130 : {
1131 0 : aSNS[i++] = "com.sun.star.drawing.DocumentSettings";
1132 : }
1133 :
1134 : DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" );
1135 :
1136 16 : return comphelper::concatSequences( aSNS_ORG, aSNS );
1137 : }
1138 :
1139 : // lang::XServiceInfo
1140 0 : OUString SAL_CALL SdXImpressDocument::getImplementationName()
1141 : throw(uno::RuntimeException)
1142 : {
1143 0 : return OUString( "SdXImpressDocument" );
1144 : }
1145 :
1146 56 : sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName )
1147 : throw(uno::RuntimeException)
1148 : {
1149 56 : ::SolarMutexGuard aGuard;
1150 :
1151 120 : if ( ServiceName == "com.sun.star.document.OfficeDocument"
1152 32 : || ServiceName == "com.sun.star.drawing.GenericDrawingDocument"
1153 32 : || ServiceName == "com.sun.star.drawing.DrawingDocumentFactory" )
1154 : {
1155 24 : return sal_True;
1156 : }
1157 :
1158 32 : return ( ( mbImpressDoc && ServiceName == "com.sun.star.presentation.PresentationDocument" )
1159 64 : || ( !mbImpressDoc && ServiceName == "com.sun.star.drawing.DrawingDocument" ) );
1160 : }
1161 :
1162 0 : uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getSupportedServiceNames() throw(uno::RuntimeException)
1163 : {
1164 0 : ::SolarMutexGuard aGuard;
1165 :
1166 0 : uno::Sequence< OUString > aSeq( 4 );
1167 0 : OUString* pServices = aSeq.getArray();
1168 :
1169 0 : *pServices++ = "com.sun.star.document.OfficeDocument";
1170 0 : *pServices++ = "com.sun.star.drawing.GenericDrawingDocument";
1171 0 : *pServices++ = "com.sun.star.drawing.DrawingDocumentFactory";
1172 :
1173 0 : if( mbImpressDoc )
1174 0 : *pServices++ = "com.sun.star.presentation.PresentationDocument";
1175 : else
1176 0 : *pServices++ = "com.sun.star.drawing.DrawingDocument";
1177 :
1178 0 : return aSeq;
1179 : }
1180 :
1181 : // XPropertySet
1182 6 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXImpressDocument::getPropertySetInfo( )
1183 : throw(uno::RuntimeException)
1184 : {
1185 6 : ::SolarMutexGuard aGuard;
1186 6 : return mpPropSet->getPropertySetInfo();
1187 : }
1188 :
1189 20 : void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
1190 : throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1191 : {
1192 20 : ::SolarMutexGuard aGuard;
1193 :
1194 20 : if( NULL == mpDoc )
1195 0 : throw lang::DisposedException();
1196 :
1197 20 : const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
1198 :
1199 20 : switch( pEntry ? pEntry->nWID : -1 )
1200 : {
1201 : case WID_MODEL_LANGUAGE:
1202 : {
1203 0 : lang::Locale aLocale;
1204 0 : if(!(aValue >>= aLocale))
1205 0 : throw lang::IllegalArgumentException();
1206 :
1207 0 : mpDoc->SetLanguage( LanguageTag(aLocale).getLanguageType(), EE_CHAR_LANGUAGE );
1208 0 : break;
1209 : }
1210 : case WID_MODEL_TABSTOP:
1211 : {
1212 0 : sal_Int32 nValue = 0;
1213 0 : if(!(aValue >>= nValue) || nValue < 0 )
1214 0 : throw lang::IllegalArgumentException();
1215 :
1216 0 : mpDoc->SetDefaultTabulator((sal_uInt16)nValue);
1217 : break;
1218 : }
1219 : case WID_MODEL_VISAREA:
1220 : {
1221 4 : SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
1222 4 : if( !pEmbeddedObj )
1223 : break;
1224 :
1225 4 : awt::Rectangle aVisArea;
1226 4 : if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) )
1227 0 : throw lang::IllegalArgumentException();
1228 :
1229 4 : pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width - 1, aVisArea.Y + aVisArea.Height - 1 ) );
1230 : }
1231 4 : break;
1232 : case WID_MODEL_CONTFOCUS:
1233 : {
1234 2 : sal_Bool bFocus = sal_False;
1235 2 : if( !(aValue >>= bFocus ) )
1236 0 : throw lang::IllegalArgumentException();
1237 2 : mpDoc->SetAutoControlFocus( bFocus );
1238 : }
1239 2 : break;
1240 : case WID_MODEL_DSGNMODE:
1241 : {
1242 2 : sal_Bool bMode = sal_False;
1243 2 : if( !(aValue >>= bMode ) )
1244 0 : throw lang::IllegalArgumentException();
1245 2 : mpDoc->SetOpenInDesignMode( bMode );
1246 : }
1247 2 : break;
1248 : case WID_MODEL_BUILDID:
1249 4 : aValue >>= maBuildId;
1250 12 : return;
1251 : case WID_MODEL_MAPUNIT:
1252 : case WID_MODEL_BASICLIBS:
1253 : case WID_MODEL_RUNTIMEUID: // is read-only
1254 : case WID_MODEL_DIALOGLIBS:
1255 0 : throw beans::PropertyVetoException();
1256 : default:
1257 8 : throw beans::UnknownPropertyException();
1258 : }
1259 :
1260 16 : SetModified();
1261 : }
1262 :
1263 48 : uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& PropertyName )
1264 : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1265 : {
1266 48 : ::SolarMutexGuard aGuard;
1267 :
1268 48 : uno::Any aAny;
1269 48 : if( NULL == mpDoc )
1270 0 : throw lang::DisposedException();
1271 :
1272 48 : const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
1273 :
1274 48 : switch( pEntry ? pEntry->nWID : -1 )
1275 : {
1276 : case WID_MODEL_LANGUAGE:
1277 : {
1278 0 : LanguageType eLang = mpDoc->GetLanguage( EE_CHAR_LANGUAGE );
1279 0 : aAny <<= LanguageTag( eLang).getLocale();
1280 0 : break;
1281 : }
1282 : case WID_MODEL_TABSTOP:
1283 0 : aAny <<= (sal_Int32)mpDoc->GetDefaultTabulator();
1284 0 : break;
1285 : case WID_MODEL_VISAREA:
1286 : {
1287 0 : SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
1288 0 : if( !pEmbeddedObj )
1289 : break;
1290 :
1291 0 : const Rectangle& aRect = pEmbeddedObj->GetVisArea();
1292 0 : awt::Rectangle aVisArea( aRect.Left(), aRect.Top(), aRect.getWidth(), aRect.getHeight() );
1293 0 : aAny <<= aVisArea;
1294 : }
1295 0 : break;
1296 : case WID_MODEL_MAPUNIT:
1297 : {
1298 0 : SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh();
1299 0 : if( !pEmbeddedObj )
1300 : break;
1301 :
1302 0 : sal_Int16 nMeasureUnit = 0;
1303 0 : SvxMapUnitToMeasureUnit( (const short)pEmbeddedObj->GetMapUnit(), nMeasureUnit );
1304 0 : aAny <<= (sal_Int16)nMeasureUnit;
1305 : }
1306 0 : break;
1307 : case WID_MODEL_FORBCHARS:
1308 : {
1309 0 : aAny <<= getForbiddenCharsTable();
1310 : }
1311 0 : break;
1312 : case WID_MODEL_CONTFOCUS:
1313 0 : aAny <<= (sal_Bool)mpDoc->GetAutoControlFocus();
1314 0 : break;
1315 : case WID_MODEL_DSGNMODE:
1316 0 : aAny <<= mpDoc->GetOpenInDesignMode();
1317 0 : break;
1318 : case WID_MODEL_BASICLIBS:
1319 0 : aAny <<= mpDocShell->GetBasicContainer();
1320 0 : break;
1321 : case WID_MODEL_DIALOGLIBS:
1322 0 : aAny <<= mpDocShell->GetDialogContainer();
1323 0 : break;
1324 : case WID_MODEL_RUNTIMEUID:
1325 48 : aAny <<= getRuntimeUID();
1326 48 : break;
1327 : case WID_MODEL_BUILDID:
1328 0 : return uno::Any( maBuildId );
1329 : case WID_MODEL_HASVALIDSIGNATURES:
1330 0 : aAny <<= hasValidSignatures();
1331 0 : break;
1332 : default:
1333 0 : throw beans::UnknownPropertyException();
1334 : }
1335 :
1336 48 : return aAny;
1337 : }
1338 :
1339 0 : void SAL_CALL SdXImpressDocument::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
1340 0 : void SAL_CALL SdXImpressDocument::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
1341 0 : void SAL_CALL SdXImpressDocument::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
1342 0 : void SAL_CALL SdXImpressDocument::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
1343 :
1344 : // XLinkTargetSupplier
1345 0 : uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLinks()
1346 : throw(uno::RuntimeException)
1347 : {
1348 0 : ::SolarMutexGuard aGuard;
1349 :
1350 0 : if( NULL == mpDoc )
1351 0 : throw lang::DisposedException();
1352 :
1353 0 : uno::Reference< container::XNameAccess > xLinks( mxLinks );
1354 0 : if( !xLinks.is() )
1355 0 : mxLinks = xLinks = new SdDocLinkTargets( *this );
1356 0 : return xLinks;
1357 : }
1358 :
1359 : // XStyleFamiliesSupplier
1360 254 : uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getStyleFamilies( )
1361 : throw(uno::RuntimeException)
1362 : {
1363 254 : ::SolarMutexGuard aGuard;
1364 :
1365 254 : if( NULL == mpDoc )
1366 0 : throw lang::DisposedException();
1367 :
1368 254 : uno::Reference< container::XNameAccess > xStyles( dynamic_cast< container::XNameAccess* >( mpDoc->GetStyleSheetPool()) );
1369 254 : return xStyles;
1370 : }
1371 :
1372 : // XAnyCompareFactory
1373 22 : uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SdXImpressDocument::createAnyCompareByName( const OUString& )
1374 : throw (uno::RuntimeException)
1375 : {
1376 22 : return SvxCreateNumRuleCompare();
1377 : }
1378 :
1379 : // XRenderable
1380 0 : sal_Int32 SAL_CALL SdXImpressDocument::getRendererCount( const uno::Any& rSelection,
1381 : const uno::Sequence< beans::PropertyValue >& )
1382 : throw (lang::IllegalArgumentException, uno::RuntimeException)
1383 : {
1384 0 : ::SolarMutexGuard aGuard;
1385 0 : sal_Int32 nRet = 0;
1386 :
1387 0 : if( NULL == mpDoc )
1388 0 : throw lang::DisposedException();
1389 :
1390 0 : uno::Sequence< beans::PropertyValue > aRenderer;
1391 :
1392 0 : if( mpDocShell && mpDoc )
1393 : {
1394 0 : uno::Reference< frame::XModel > xModel;
1395 :
1396 0 : rSelection >>= xModel;
1397 :
1398 0 : if( xModel == mpDocShell->GetModel() )
1399 0 : nRet = mpDoc->GetSdPageCount( PK_STANDARD );
1400 : else
1401 : {
1402 0 : uno::Reference< drawing::XShapes > xShapes;
1403 :
1404 0 : rSelection >>= xShapes;
1405 :
1406 0 : if( xShapes.is() && xShapes->getCount() )
1407 0 : nRet = 1;
1408 0 : }
1409 : }
1410 0 : return nRet;
1411 : }
1412 :
1413 0 : uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( sal_Int32 , const uno::Any& ,
1414 : const uno::Sequence< beans::PropertyValue >& rxOptions )
1415 : throw (lang::IllegalArgumentException, uno::RuntimeException)
1416 : {
1417 0 : ::SolarMutexGuard aGuard;
1418 :
1419 0 : if( NULL == mpDoc )
1420 0 : throw lang::DisposedException();
1421 :
1422 0 : sal_Bool bExportNotesPages = sal_False;
1423 0 : for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
1424 : {
1425 0 : if ( rxOptions[ nProperty ].Name == "ExportNotesPages" )
1426 0 : rxOptions[ nProperty].Value >>= bExportNotesPages;
1427 : }
1428 0 : uno::Sequence< beans::PropertyValue > aRenderer;
1429 0 : if( mpDocShell && mpDoc )
1430 : {
1431 0 : awt::Size aPageSize;
1432 0 : if ( bExportNotesPages )
1433 : {
1434 0 : Size aNotesPageSize = mpDoc->GetSdPage( 0, PK_NOTES )->GetSize();
1435 0 : aPageSize = awt::Size( aNotesPageSize.Width(), aNotesPageSize.Height() );
1436 : }
1437 : else
1438 : {
1439 0 : const Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) );
1440 0 : aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() );
1441 : }
1442 0 : aRenderer.realloc( 1 );
1443 :
1444 0 : aRenderer[ 0 ].Name = "PageSize" ;
1445 0 : aRenderer[ 0 ].Value <<= aPageSize;
1446 : }
1447 0 : return aRenderer;
1448 : }
1449 :
1450 : class ImplRenderPaintProc : public ::sdr::contact::ViewObjectContactRedirector
1451 : {
1452 : const SdrLayerAdmin& rLayerAdmin;
1453 : SdrPageView* pSdrPageView;
1454 : vcl::PDFExtOutDevData* pPDFExtOutDevData;
1455 :
1456 : vcl::PDFWriter::StructElement ImplBegStructureTag( SdrObject& rObject );
1457 :
1458 : public:
1459 : sal_Bool IsVisible ( const SdrObject* pObj ) const;
1460 : sal_Bool IsPrintable( const SdrObject* pObj ) const;
1461 :
1462 : ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData );
1463 : virtual ~ImplRenderPaintProc();
1464 :
1465 : // all default implementations just call the same methods at the original. To do something
1466 : // different, overload the method and at least do what the method does.
1467 : virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
1468 : const sdr::contact::ViewObjectContact& rOriginal,
1469 : const sdr::contact::DisplayInfo& rDisplayInfo);
1470 : };
1471 :
1472 0 : ImplRenderPaintProc::ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData )
1473 : : ViewObjectContactRedirector(),
1474 : rLayerAdmin ( rLA ),
1475 : pSdrPageView ( pView ),
1476 0 : pPDFExtOutDevData ( pData )
1477 : {
1478 0 : }
1479 :
1480 0 : ImplRenderPaintProc::~ImplRenderPaintProc()
1481 : {
1482 0 : }
1483 :
1484 0 : sal_Int32 ImplPDFGetBookmarkPage( const String& rBookmark, SdDrawDocument& rDoc )
1485 : {
1486 0 : sal_Int32 nPage = -1;
1487 :
1488 : OSL_TRACE("GotoBookmark %s",
1489 : ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr());
1490 :
1491 0 : String aBookmark( rBookmark );
1492 :
1493 0 : if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') )
1494 0 : aBookmark = rBookmark.Copy( 1 );
1495 :
1496 : // is the bookmark a page ?
1497 : sal_Bool bIsMasterPage;
1498 0 : sal_uInt16 nPgNum = rDoc.GetPageByName( aBookmark, bIsMasterPage );
1499 0 : SdrObject* pObj = NULL;
1500 :
1501 0 : if ( nPgNum == SDRPAGE_NOTFOUND )
1502 : {
1503 : // is the bookmark a object ?
1504 0 : pObj = rDoc.GetObj( aBookmark );
1505 0 : if (pObj)
1506 0 : nPgNum = pObj->GetPage()->GetPageNum();
1507 : }
1508 0 : if ( nPgNum != SDRPAGE_NOTFOUND )
1509 0 : nPage = ( nPgNum - 1 ) / 2;
1510 0 : return nPage;
1511 : }
1512 :
1513 0 : void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDFExtOutDevData& rPDFExtOutDevData )
1514 : {
1515 : try
1516 : {
1517 0 : uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
1518 0 : uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
1519 :
1520 0 : LanguageType eLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
1521 0 : while( xAnnotationEnumeration->hasMoreElements() )
1522 : {
1523 0 : uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
1524 :
1525 0 : geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
1526 0 : uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
1527 0 : util::DateTime aDateTime( xAnnotation->getDateTime() );
1528 :
1529 0 : Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
1530 0 : Time aTime( Time::EMPTY );
1531 0 : String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, SVXDATEFORMAT_B, *(SD_MOD()->GetNumberFormatter()), eLanguage ) );
1532 :
1533 0 : vcl::PDFNote aNote;
1534 0 : String sTitle( xAnnotation->getAuthor() );
1535 0 : sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
1536 0 : sTitle += aStr;
1537 0 : aNote.Title = sTitle;
1538 0 : aNote.Contents = xText->getString();
1539 : rPDFExtOutDevData.CreateNote( Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ),
1540 0 : static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote );
1541 0 : }
1542 : }
1543 0 : catch (const uno::Exception&)
1544 : {
1545 : }
1546 0 : }
1547 :
1548 0 : void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData )
1549 : {
1550 0 : const rtl::OUString sGroup ( "com.sun.star.drawing.GroupShape");
1551 0 : const rtl::OUString sOnClick ( "OnClick" );
1552 0 : const rtl::OUString sBookmark( "Bookmark" );
1553 :
1554 0 : if ( xShape->getShapeType().equals( sGroup ) )
1555 : {
1556 0 : uno::Reference< container::XIndexAccess > xIndexAccess( xShape, uno::UNO_QUERY );
1557 0 : if ( xIndexAccess.is() )
1558 : {
1559 0 : sal_Int32 i, nCount = xIndexAccess->getCount();
1560 0 : for ( i = 0; i < nCount; i++ )
1561 : {
1562 0 : uno::Reference< drawing::XShape > xSubShape( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
1563 0 : if ( xSubShape.is() )
1564 0 : ImplPDFExportShapeInteraction( xSubShape, rDoc, rPDFExtOutDevData );
1565 0 : }
1566 0 : }
1567 : }
1568 : else
1569 : {
1570 0 : uno::Reference< beans::XPropertySet > xShapePropSet( xShape, uno::UNO_QUERY );
1571 0 : if( xShapePropSet.is() )
1572 : {
1573 0 : Size aPageSize( rDoc.GetSdPage( 0, PK_STANDARD )->GetSize() );
1574 0 : Point aPoint( 0, 0 );
1575 0 : Rectangle aPageRect( aPoint, aPageSize );
1576 :
1577 0 : awt::Point aShapePos( xShape->getPosition() );
1578 0 : awt::Size aShapeSize( xShape->getSize() );
1579 0 : Rectangle aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) );
1580 :
1581 : presentation::ClickAction eCa;
1582 0 : uno::Any aAny( xShapePropSet->getPropertyValue( sOnClick ) );
1583 0 : if ( aAny >>= eCa )
1584 : {
1585 0 : switch ( eCa )
1586 : {
1587 : case presentation::ClickAction_LASTPAGE :
1588 : {
1589 0 : sal_Int32 nCount = rDoc.GetSdPageCount( PK_STANDARD );
1590 0 : sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::FitRectangle );
1591 0 : sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
1592 0 : rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1593 : }
1594 0 : break;
1595 : case presentation::ClickAction_FIRSTPAGE :
1596 : {
1597 0 : sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::FitRectangle );
1598 0 : sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
1599 0 : rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1600 : }
1601 0 : break;
1602 : case presentation::ClickAction_PREVPAGE :
1603 : {
1604 0 : sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber();
1605 0 : if ( nDestPage )
1606 0 : nDestPage--;
1607 0 : sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
1608 0 : sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
1609 0 : rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1610 : }
1611 0 : break;
1612 : case presentation::ClickAction_NEXTPAGE :
1613 : {
1614 0 : sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber() + 1;
1615 0 : sal_Int32 nLastPage = rDoc.GetSdPageCount( PK_STANDARD ) - 1;
1616 0 : if ( nDestPage > nLastPage )
1617 0 : nDestPage = nLastPage;
1618 0 : sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle );
1619 0 : sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
1620 0 : rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1621 : }
1622 0 : break;
1623 :
1624 : case presentation::ClickAction_PROGRAM :
1625 : case presentation::ClickAction_BOOKMARK :
1626 : case presentation::ClickAction_DOCUMENT :
1627 : {
1628 0 : rtl::OUString aBookmark;
1629 0 : xShapePropSet->getPropertyValue( sBookmark ) >>= aBookmark;
1630 0 : if( !aBookmark.isEmpty() )
1631 : {
1632 0 : switch( eCa )
1633 : {
1634 : case presentation::ClickAction_DOCUMENT :
1635 : case presentation::ClickAction_PROGRAM :
1636 : {
1637 0 : sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
1638 0 : rPDFExtOutDevData.SetLinkURL( nLinkId, aBookmark );
1639 : }
1640 0 : break;
1641 : case presentation::ClickAction_BOOKMARK :
1642 : {
1643 0 : sal_Int32 nPage = ImplPDFGetBookmarkPage( aBookmark, rDoc );
1644 0 : if ( nPage != -1 )
1645 : {
1646 0 : sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle );
1647 0 : sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 );
1648 0 : rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId );
1649 : }
1650 : }
1651 0 : break;
1652 : default:
1653 0 : break;
1654 : }
1655 0 : }
1656 : }
1657 0 : break;
1658 :
1659 : case presentation::ClickAction_STOPPRESENTATION :
1660 : case presentation::ClickAction_SOUND :
1661 : case presentation::ClickAction_INVISIBLE :
1662 : case presentation::ClickAction_VERB :
1663 : case presentation::ClickAction_VANISH :
1664 : case presentation::ClickAction_MACRO :
1665 : default :
1666 0 : break;
1667 : }
1668 0 : }
1669 0 : }
1670 0 : }
1671 0 : }
1672 :
1673 0 : vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObject& rObject )
1674 : {
1675 0 : vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement);
1676 :
1677 0 : if ( pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF() )
1678 : {
1679 0 : sal_uInt32 nInventor = rObject.GetObjInventor();
1680 0 : sal_uInt16 nIdentifier = rObject.GetObjIdentifier();
1681 0 : sal_Bool bIsTextObj = rObject.ISA( SdrTextObj );
1682 :
1683 0 : if ( nInventor == SdrInventor )
1684 : {
1685 0 : if ( nIdentifier == OBJ_GRUP )
1686 0 : eElement = vcl::PDFWriter::Section;
1687 0 : else if ( nIdentifier == OBJ_TITLETEXT )
1688 0 : eElement = vcl::PDFWriter::Heading;
1689 0 : else if ( nIdentifier == OBJ_OUTLINETEXT )
1690 0 : eElement = vcl::PDFWriter::Division;
1691 0 : else if ( !bIsTextObj || !((SdrTextObj&)rObject).HasText() )
1692 0 : eElement = vcl::PDFWriter::Figure;
1693 : }
1694 : }
1695 :
1696 0 : return eElement;
1697 : }
1698 :
1699 0 : drawinglayer::primitive2d::Primitive2DSequence ImplRenderPaintProc::createRedirectedPrimitive2DSequence(
1700 : const sdr::contact::ViewObjectContact& rOriginal,
1701 : const sdr::contact::DisplayInfo& rDisplayInfo)
1702 : {
1703 0 : SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
1704 :
1705 0 : if(pObject)
1706 : {
1707 0 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
1708 :
1709 0 : if(pObject->GetPage())
1710 : {
1711 0 : if(pObject->GetPage()->checkVisibility(rOriginal, rDisplayInfo, false))
1712 : {
1713 0 : if(IsVisible(pObject) && IsPrintable(pObject))
1714 : {
1715 0 : const vcl::PDFWriter::StructElement eElement(ImplBegStructureTag( *pObject ));
1716 0 : const bool bTagUsed(vcl::PDFWriter::NonStructElement != eElement);
1717 :
1718 0 : xRetval = ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
1719 :
1720 0 : if(xRetval.hasElements() && bTagUsed)
1721 : {
1722 : // embed Primitive2DSequence in a structure tag element for
1723 : // exactly this purpose (StructureTagPrimitive2D)
1724 0 : const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::StructureTagPrimitive2D(eElement, xRetval));
1725 0 : xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
1726 : }
1727 : }
1728 : }
1729 : }
1730 :
1731 0 : return xRetval;
1732 : }
1733 : else
1734 : {
1735 : // not an object, maybe a page
1736 0 : return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
1737 : }
1738 : }
1739 :
1740 0 : sal_Bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const
1741 : {
1742 0 : sal_Bool bVisible = sal_True;
1743 0 : SdrLayerID nLayerId = pObj->GetLayer();
1744 0 : if( pSdrPageView )
1745 : {
1746 0 : const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
1747 0 : if ( pSdrLayer )
1748 : {
1749 0 : String aLayerName = pSdrLayer->GetName();
1750 0 : bVisible = pSdrPageView->IsLayerVisible( aLayerName );
1751 : }
1752 : }
1753 0 : return bVisible;
1754 : }
1755 0 : sal_Bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const
1756 : {
1757 0 : sal_Bool bPrintable = sal_True;
1758 0 : SdrLayerID nLayerId = pObj->GetLayer();
1759 0 : if( pSdrPageView )
1760 : {
1761 0 : const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId );
1762 0 : if ( pSdrLayer )
1763 : {
1764 0 : String aLayerName = pSdrLayer->GetName();
1765 0 : bPrintable = pSdrPageView->IsLayerPrintable( aLayerName );
1766 : }
1767 : }
1768 0 : return bPrintable;
1769 :
1770 : }
1771 0 : void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection,
1772 : const uno::Sequence< beans::PropertyValue >& rxOptions )
1773 : throw (lang::IllegalArgumentException, uno::RuntimeException)
1774 : {
1775 0 : ::SolarMutexGuard aGuard;
1776 :
1777 0 : if( NULL == mpDoc )
1778 0 : throw lang::DisposedException();
1779 :
1780 0 : if( mpDocShell && mpDoc )
1781 : {
1782 0 : uno::Reference< awt::XDevice > xRenderDevice;
1783 0 : const sal_Int32 nPageNumber = nRenderer + 1;
1784 0 : PageKind ePageKind = PK_STANDARD;
1785 0 : sal_Bool bExportNotesPages = sal_False;
1786 :
1787 0 : for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
1788 : {
1789 0 : if ( rxOptions[ nProperty ].Name == "RenderDevice" )
1790 0 : rxOptions[ nProperty ].Value >>= xRenderDevice;
1791 0 : else if ( rxOptions[ nProperty ].Name == "ExportNotesPages" )
1792 : {
1793 0 : rxOptions[ nProperty].Value >>= bExportNotesPages;
1794 0 : if ( bExportNotesPages )
1795 0 : ePageKind = PK_NOTES;
1796 : }
1797 : }
1798 :
1799 0 : if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) )
1800 : {
1801 0 : VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
1802 0 : OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
1803 :
1804 0 : if( pOut )
1805 : {
1806 0 : vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOut->GetExtOutDevData() );
1807 :
1808 0 : if ( !( (mpDoc->GetSdPage((sal_Int16) nPageNumber-1, PK_STANDARD))->IsExcluded() ) ||
1809 0 : pPDFExtOutDevData->GetIsExportHiddenSlides() )
1810 : {
1811 0 : ::sd::ClientView* pView = new ::sd::ClientView( mpDocShell, pOut, NULL );
1812 0 : Rectangle aVisArea = Rectangle( Point(), mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind )->GetSize() );
1813 0 : Region aRegion( aVisArea );
1814 0 : Point aOrigin;
1815 :
1816 0 : ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell();
1817 0 : ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : NULL;
1818 :
1819 0 : if ( pOldSdView )
1820 0 : pOldSdView->SdrEndTextEdit();
1821 :
1822 0 : pView->SetHlplVisible( sal_False );
1823 0 : pView->SetGridVisible( sal_False );
1824 0 : pView->SetBordVisible( sal_False );
1825 0 : pView->SetPageVisible( sal_False );
1826 0 : pView->SetGlueVisible( sal_False );
1827 :
1828 0 : pOut->SetMapMode( MAP_100TH_MM );
1829 0 : pOut->IntersectClipRegion( aVisArea );
1830 :
1831 :
1832 :
1833 0 : uno::Reference< frame::XModel > xModel;
1834 0 : rSelection >>= xModel;
1835 :
1836 0 : if( xModel == mpDocShell->GetModel() )
1837 : {
1838 0 : pView->ShowSdrPage( mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind ));
1839 0 : SdrPageView* pPV = pView->GetSdrPageView();
1840 :
1841 0 : if( pOldSdView )
1842 : {
1843 0 : SdrPageView* pOldPV = pOldSdView->GetSdrPageView();
1844 0 : if( pPV && pOldPV )
1845 : {
1846 0 : pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() );
1847 0 : pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() );
1848 : }
1849 : }
1850 :
1851 0 : ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
1852 0 : pPV, pPDFExtOutDevData );
1853 :
1854 : // background color for outliner :o
1855 0 : SdPage* pPage = (SdPage*)pPV->GetPage();
1856 0 : if( pPage )
1857 : {
1858 0 : SdrOutliner& rOutl = mpDoc->GetDrawOutliner( NULL );
1859 0 : bool bScreenDisplay(true);
1860 :
1861 0 : if(bScreenDisplay && pOut && OUTDEV_PRINTER == pOut->GetOutDevType())
1862 : {
1863 : // #i75566# printing; suppress AutoColor BackgroundColor generation
1864 : // for visibility reasons by giving GetPageBackgroundColor()
1865 : // the needed hint
1866 0 : bScreenDisplay = false;
1867 : }
1868 :
1869 0 : if(bScreenDisplay && pOut && pOut->GetPDFWriter())
1870 : {
1871 : // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
1872 0 : bScreenDisplay = false;
1873 : }
1874 :
1875 : // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
1876 : // hint value if screen display. Only then the AutoColor mechanisms shall be applied
1877 0 : rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) );
1878 : }
1879 0 : pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc );
1880 :
1881 0 : if ( pPDFExtOutDevData )
1882 : {
1883 : try
1884 : {
1885 0 : uno::Any aAny;
1886 0 : uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) );
1887 0 : if ( xPage.is() )
1888 : {
1889 0 : if ( pPDFExtOutDevData->GetIsExportNotes() )
1890 0 : ImplPDFExportComments( xPage, *pPDFExtOutDevData );
1891 0 : uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY );
1892 0 : if( xPagePropSet.is() )
1893 : {
1894 : // exporting object interactions to pdf
1895 :
1896 : // if necessary, the master page interactions will be exported first
1897 0 : sal_Bool bIsBackgroundObjectsVisible = sal_False; // #i39428# IsBackgroundObjectsVisible not available for Draw
1898 0 : if ( mbImpressDoc && xPagePropSet->getPropertySetInfo()->hasPropertyByName( "IsBackgroundObjectsVisible" ) )
1899 0 : xPagePropSet->getPropertyValue( "IsBackgroundObjectsVisible" ) >>= bIsBackgroundObjectsVisible;
1900 0 : if ( bIsBackgroundObjectsVisible && !pPDFExtOutDevData->GetIsExportNotesPages() )
1901 : {
1902 0 : uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY );
1903 0 : if ( xMasterPageTarget.is() )
1904 : {
1905 0 : uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
1906 0 : if ( xMasterPage.is() )
1907 : {
1908 0 : uno::Reference< drawing::XShapes> xShapes( xMasterPage, uno::UNO_QUERY );
1909 0 : sal_Int32 i, nCount = xShapes->getCount();
1910 0 : for ( i = 0; i < nCount; i++ )
1911 : {
1912 0 : aAny = xShapes->getByIndex( i );
1913 0 : uno::Reference< drawing::XShape > xShape;
1914 0 : if ( aAny >>= xShape )
1915 0 : ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
1916 0 : }
1917 0 : }
1918 0 : }
1919 : }
1920 :
1921 : // exporting slide page object interactions
1922 0 : uno::Reference< drawing::XShapes> xShapes( xPage, uno::UNO_QUERY );
1923 0 : sal_Int32 i, nCount = xShapes->getCount();
1924 0 : for ( i = 0; i < nCount; i++ )
1925 : {
1926 0 : aAny = xShapes->getByIndex( i );
1927 0 : uno::Reference< drawing::XShape > xShape;
1928 0 : if ( aAny >>= xShape )
1929 0 : ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData );
1930 0 : }
1931 :
1932 : // exporting transition effects to pdf
1933 0 : if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() )
1934 : {
1935 0 : const rtl::OUString sEffect( "Effect" );
1936 0 : const rtl::OUString sSpeed ( "Speed" );
1937 0 : sal_Int32 nTime = 800;
1938 : presentation::AnimationSpeed aAs;
1939 0 : if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
1940 : {
1941 0 : aAny = xPagePropSet->getPropertyValue( sSpeed );
1942 0 : if ( aAny >>= aAs )
1943 : {
1944 0 : switch( aAs )
1945 : {
1946 0 : case presentation::AnimationSpeed_SLOW : nTime = 1500; break;
1947 0 : case presentation::AnimationSpeed_FAST : nTime = 300; break;
1948 : default:
1949 0 : case presentation::AnimationSpeed_MEDIUM : nTime = 800;
1950 : }
1951 : }
1952 : }
1953 : presentation::FadeEffect eFe;
1954 0 : vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::Regular;
1955 0 : if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) )
1956 : {
1957 0 : aAny = xPagePropSet->getPropertyValue( sEffect );
1958 0 : if ( aAny >>= eFe )
1959 : {
1960 0 : switch( eFe )
1961 : {
1962 : case presentation::FadeEffect_HORIZONTAL_LINES :
1963 : case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD :
1964 0 : case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::BlindsHorizontal; break;
1965 :
1966 : case presentation::FadeEffect_VERTICAL_LINES :
1967 : case presentation::FadeEffect_VERTICAL_CHECKERBOARD :
1968 0 : case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::BlindsVertical; break;
1969 :
1970 : case presentation::FadeEffect_UNCOVER_TO_RIGHT :
1971 : case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT :
1972 : case presentation::FadeEffect_ROLL_FROM_LEFT :
1973 : case presentation::FadeEffect_FADE_FROM_UPPERLEFT :
1974 : case presentation::FadeEffect_MOVE_FROM_UPPERLEFT :
1975 : case presentation::FadeEffect_FADE_FROM_LEFT :
1976 0 : case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::WipeLeftToRight; break;
1977 :
1978 : case presentation::FadeEffect_UNCOVER_TO_BOTTOM :
1979 : case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT :
1980 : case presentation::FadeEffect_ROLL_FROM_TOP :
1981 : case presentation::FadeEffect_FADE_FROM_UPPERRIGHT :
1982 : case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT :
1983 : case presentation::FadeEffect_FADE_FROM_TOP :
1984 0 : case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::WipeTopToBottom; break;
1985 :
1986 : case presentation::FadeEffect_UNCOVER_TO_LEFT :
1987 : case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT :
1988 : case presentation::FadeEffect_ROLL_FROM_RIGHT :
1989 :
1990 : case presentation::FadeEffect_FADE_FROM_LOWERRIGHT :
1991 : case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT :
1992 : case presentation::FadeEffect_FADE_FROM_RIGHT :
1993 0 : case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::WipeRightToLeft; break;
1994 :
1995 : case presentation::FadeEffect_UNCOVER_TO_TOP :
1996 : case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT :
1997 : case presentation::FadeEffect_ROLL_FROM_BOTTOM :
1998 : case presentation::FadeEffect_FADE_FROM_LOWERLEFT :
1999 : case presentation::FadeEffect_MOVE_FROM_LOWERLEFT :
2000 : case presentation::FadeEffect_FADE_FROM_BOTTOM :
2001 0 : case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::WipeBottomToTop; break;
2002 :
2003 0 : case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::SplitHorizontalInward; break;
2004 0 : case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::SplitHorizontalOutward; break;
2005 :
2006 0 : case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::SplitVerticalInward; break;
2007 0 : case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::SplitVerticalOutward; break;
2008 :
2009 0 : case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::BoxInward; break;
2010 0 : case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::BoxOutward; break;
2011 :
2012 0 : case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::Regular; break;
2013 :
2014 : case presentation::FadeEffect_RANDOM :
2015 : case presentation::FadeEffect_DISSOLVE :
2016 0 : default: eType = vcl::PDFWriter::Dissolve; break;
2017 : }
2018 : }
2019 : }
2020 :
2021 0 : if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) ||
2022 0 : xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) )
2023 : {
2024 0 : pPDFExtOutDevData->SetPageTransition( eType, nTime, -1 );
2025 0 : }
2026 0 : }
2027 0 : }
2028 : }
2029 :
2030 0 : Size aPageSize( mpDoc->GetSdPage( 0, PK_STANDARD )->GetSize() );
2031 0 : Point aPoint( 0, 0 );
2032 0 : Rectangle aPageRect( aPoint, aPageSize );
2033 :
2034 : // resolving links found in this page by the method ImpEditEngine::Paint
2035 0 : std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
2036 0 : std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIBeg = rBookmarks.begin();
2037 0 : std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIEnd = rBookmarks.end();
2038 0 : while ( aIBeg != aIEnd )
2039 : {
2040 0 : sal_Int32 nPage = ImplPDFGetBookmarkPage( aIBeg->aBookmark, *mpDoc );
2041 0 : if ( nPage != -1 )
2042 : {
2043 0 : if ( aIBeg->nLinkId != -1 )
2044 0 : pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) );
2045 : else
2046 0 : pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, aPageRect, nPage, vcl::PDFWriter::FitRectangle );
2047 : }
2048 : else
2049 0 : pPDFExtOutDevData->SetLinkURL( aIBeg->nLinkId, aIBeg->aBookmark );
2050 0 : ++aIBeg;
2051 : }
2052 0 : rBookmarks.clear();
2053 : //---> #i56629, #i40318
2054 : //get the page name, will be used as outline element in PDF bookmark pane
2055 0 : String aPageName = mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1 , PK_STANDARD )->GetName();
2056 0 : if( aPageName.Len() > 0 )
2057 : {
2058 : // insert the bookmark to this page into the NamedDestinations
2059 0 : if( pPDFExtOutDevData->GetIsExportNamedDestinations() )
2060 0 : pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect, nPageNumber - 1 );
2061 : //
2062 : // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx
2063 : // issue #i40318.
2064 : //
2065 0 : if( pPDFExtOutDevData->GetIsExportBookmarks() )
2066 : {
2067 : // Destination Export
2068 : const sal_Int32 nDestId =
2069 0 : pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 );
2070 :
2071 : // Create a new outline item:
2072 0 : pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId );
2073 : }
2074 0 : }
2075 : //<--- #i56629, #i40318
2076 : }
2077 0 : catch (const uno::Exception&)
2078 : {
2079 : }
2080 :
2081 0 : }
2082 : }
2083 : else
2084 : {
2085 0 : uno::Reference< drawing::XShapes > xShapes;
2086 0 : rSelection >>= xShapes;
2087 :
2088 0 : if( xShapes.is() && xShapes->getCount() )
2089 : {
2090 0 : SdrPageView* pPV = NULL;
2091 :
2092 0 : ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(),
2093 0 : pOldSdView ? pOldSdView->GetSdrPageView() : NULL, pPDFExtOutDevData );
2094 :
2095 0 : for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ )
2096 : {
2097 0 : uno::Reference< drawing::XShape > xShape;
2098 0 : xShapes->getByIndex( i ) >>= xShape;
2099 :
2100 0 : if( xShape.is() )
2101 : {
2102 0 : SvxShape* pShape = SvxShape::getImplementation( xShape );
2103 :
2104 0 : if( pShape )
2105 : {
2106 0 : SdrObject* pObj = pShape->GetSdrObject();
2107 0 : if( pObj && pObj->GetPage()
2108 0 : && aImplRenderPaintProc.IsVisible( pObj )
2109 0 : && aImplRenderPaintProc.IsPrintable( pObj ) )
2110 : {
2111 0 : if( !pPV )
2112 0 : pPV = pView->ShowSdrPage( pObj->GetPage() );
2113 :
2114 0 : if( pPV )
2115 0 : pView->MarkObj( pObj, pPV );
2116 : }
2117 : }
2118 : }
2119 0 : }
2120 0 : pView->DrawMarkedObj(*pOut);
2121 0 : }
2122 : }
2123 :
2124 0 : delete pView;
2125 : }
2126 : }
2127 0 : }
2128 0 : }
2129 0 : }
2130 :
2131 4 : uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
2132 : {
2133 4 : uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
2134 :
2135 4 : if( !xForb.is() )
2136 4 : mxForbidenCharacters = xForb = new SdUnoForbiddenCharsTable( mpDoc );
2137 :
2138 4 : return xForb;
2139 : }
2140 :
2141 54 : void SdXImpressDocument::initializeDocument()
2142 : {
2143 54 : if( !mbClipBoard )
2144 : {
2145 54 : switch( mpDoc->GetPageCount() )
2146 : {
2147 : case 1:
2148 : {
2149 : // nasty hack to detect clipboard document
2150 0 : mbClipBoard = true;
2151 0 : break;
2152 : }
2153 : case 0:
2154 : {
2155 8 : mpDoc->CreateFirstPages();
2156 8 : mpDoc->StopWorkStartupDelay();
2157 8 : break;
2158 : }
2159 : }
2160 : }
2161 54 : }
2162 :
2163 44 : void SAL_CALL SdXImpressDocument::dispose() throw (::com::sun::star::uno::RuntimeException)
2164 : {
2165 44 : if( !mbDisposed )
2166 : {
2167 : {
2168 44 : ::SolarMutexGuard aGuard;
2169 :
2170 44 : if( mpDoc )
2171 : {
2172 32 : EndListening( *mpDoc );
2173 32 : mpDoc = NULL;
2174 : }
2175 :
2176 : // Call the base class dispose() before setting the mbDisposed flag
2177 : // to true. The reason for this is that if close() has not yet been
2178 : // called this is done in SfxBaseModel::dispose(). At the end of
2179 : // that dispose() is called again. It is important to forward this
2180 : // second dispose() to the base class, too.
2181 : // As a consequence the following code has to be able to be run twice.
2182 44 : SfxBaseModel::dispose();
2183 44 : mbDisposed = true;
2184 :
2185 44 : uno::Reference< container::XNameAccess > xStyles(mxStyleFamilies);
2186 44 : if( xStyles.is() )
2187 : {
2188 0 : uno::Reference< lang::XComponent > xComp( xStyles, uno::UNO_QUERY );
2189 0 : if( xComp.is() )
2190 0 : xComp->dispose();
2191 :
2192 0 : xStyles = 0;
2193 : }
2194 :
2195 44 : uno::Reference< presentation::XPresentation > xPresentation( mxPresentation );
2196 44 : if( xPresentation.is() )
2197 : {
2198 0 : uno::Reference< ::com::sun::star::presentation::XPresentation2 > xPres( mpDoc->getPresentation().get() );
2199 0 : uno::Reference< lang::XComponent > xPresComp( xPres, uno::UNO_QUERY );
2200 0 : if( xPresComp.is() )
2201 0 : xPresComp->dispose();
2202 : }
2203 :
2204 44 : uno::Reference< container::XNameAccess > xLinks( mxLinks );
2205 44 : if( xLinks.is() )
2206 : {
2207 0 : uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY );
2208 0 : if( xComp.is() )
2209 0 : xComp->dispose();
2210 :
2211 0 : xLinks = 0;
2212 : }
2213 :
2214 44 : uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess );
2215 44 : if( xDrawPagesAccess.is() )
2216 : {
2217 4 : uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY );
2218 4 : if( xComp.is() )
2219 4 : xComp->dispose();
2220 :
2221 4 : xDrawPagesAccess = 0;
2222 : }
2223 :
2224 44 : uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess );
2225 44 : if( xDrawPagesAccess.is() )
2226 : {
2227 0 : uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY );
2228 0 : if( xComp.is() )
2229 0 : xComp->dispose();
2230 :
2231 0 : xDrawPagesAccess = 0;
2232 : }
2233 :
2234 44 : uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
2235 44 : if( xLayerManager.is() )
2236 : {
2237 0 : uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY );
2238 0 : if( xComp.is() )
2239 0 : xComp->dispose();
2240 :
2241 0 : xLayerManager = 0;
2242 : }
2243 :
2244 44 : uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess );
2245 44 : if( xCustomPresentationAccess.is() )
2246 : {
2247 0 : uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY );
2248 0 : if( xComp.is() )
2249 0 : xComp->dispose();
2250 :
2251 0 : xCustomPresentationAccess = 0;
2252 : }
2253 :
2254 44 : mxDashTable = 0;
2255 44 : mxGradientTable = 0;
2256 44 : mxHatchTable = 0;
2257 44 : mxBitmapTable = 0;
2258 44 : mxTransGradientTable = 0;
2259 44 : mxMarkerTable = 0;
2260 44 : mxDrawingPool = 0;
2261 : }
2262 : }
2263 44 : }
2264 :
2265 : //=============================================================================
2266 : // class SdDrawPagesAccess
2267 : //=============================================================================
2268 :
2269 28 : SdDrawPagesAccess::SdDrawPagesAccess( SdXImpressDocument& rMyModel ) throw()
2270 28 : : mpModel( &rMyModel)
2271 : {
2272 28 : }
2273 :
2274 56 : SdDrawPagesAccess::~SdDrawPagesAccess() throw()
2275 : {
2276 56 : }
2277 :
2278 : // XIndexAccess
2279 52 : sal_Int32 SAL_CALL SdDrawPagesAccess::getCount()
2280 : throw(uno::RuntimeException)
2281 : {
2282 52 : ::SolarMutexGuard aGuard;
2283 :
2284 52 : if( NULL == mpModel )
2285 0 : throw lang::DisposedException();
2286 :
2287 52 : return mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
2288 : }
2289 :
2290 46 : uno::Any SAL_CALL SdDrawPagesAccess::getByIndex( sal_Int32 Index )
2291 : throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
2292 : {
2293 46 : ::SolarMutexGuard aGuard;
2294 :
2295 46 : if( NULL == mpModel )
2296 0 : throw lang::DisposedException();
2297 :
2298 46 : uno::Any aAny;
2299 :
2300 46 : if( (Index < 0) || (Index >= mpModel->mpDoc->GetSdPageCount( PK_STANDARD ) ) )
2301 0 : throw lang::IndexOutOfBoundsException();
2302 :
2303 46 : SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)Index, PK_STANDARD );
2304 46 : if( pPage )
2305 : {
2306 46 : uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
2307 46 : aAny <<= xDrawPage;
2308 : }
2309 :
2310 46 : return aAny;
2311 : }
2312 :
2313 : // XNameAccess
2314 0 : uno::Any SAL_CALL SdDrawPagesAccess::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
2315 : {
2316 0 : ::SolarMutexGuard aGuard;
2317 :
2318 0 : if( NULL == mpModel )
2319 0 : throw lang::DisposedException();
2320 :
2321 0 : if( !aName.isEmpty() )
2322 : {
2323 0 : const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
2324 : sal_uInt16 nPage;
2325 0 : for( nPage = 0; nPage < nCount; nPage++ )
2326 : {
2327 0 : SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
2328 0 : if(NULL == pPage)
2329 0 : continue;
2330 :
2331 0 : if( aName == SdDrawPage::getPageApiName( pPage ) )
2332 : {
2333 0 : uno::Any aAny;
2334 0 : uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
2335 0 : aAny <<= xDrawPage;
2336 0 : return aAny;
2337 : }
2338 : }
2339 : }
2340 :
2341 0 : throw container::NoSuchElementException();
2342 : }
2343 :
2344 0 : uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getElementNames() throw(uno::RuntimeException)
2345 : {
2346 0 : ::SolarMutexGuard aGuard;
2347 :
2348 0 : if( NULL == mpModel )
2349 0 : throw lang::DisposedException();
2350 :
2351 0 : const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
2352 0 : uno::Sequence< OUString > aNames( nCount );
2353 0 : OUString* pNames = aNames.getArray();
2354 :
2355 : sal_uInt16 nPage;
2356 0 : for( nPage = 0; nPage < nCount; nPage++ )
2357 : {
2358 0 : SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
2359 0 : *pNames++ = SdDrawPage::getPageApiName( pPage );
2360 : }
2361 :
2362 0 : return aNames;
2363 : }
2364 :
2365 0 : sal_Bool SAL_CALL SdDrawPagesAccess::hasByName( const OUString& aName ) throw(uno::RuntimeException)
2366 : {
2367 0 : ::SolarMutexGuard aGuard;
2368 :
2369 0 : if( NULL == mpModel )
2370 0 : throw lang::DisposedException();
2371 :
2372 0 : const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD );
2373 : sal_uInt16 nPage;
2374 0 : for( nPage = 0; nPage < nCount; nPage++ )
2375 : {
2376 0 : SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD );
2377 0 : if(NULL == pPage)
2378 0 : continue;
2379 :
2380 0 : if( aName == SdDrawPage::getPageApiName( pPage ) )
2381 0 : return sal_True;
2382 : }
2383 :
2384 0 : return sal_False;
2385 : }
2386 :
2387 : // XElementAccess
2388 0 : uno::Type SAL_CALL SdDrawPagesAccess::getElementType()
2389 : throw(uno::RuntimeException)
2390 : {
2391 0 : return ITYPE( drawing::XDrawPage );
2392 : }
2393 :
2394 0 : sal_Bool SAL_CALL SdDrawPagesAccess::hasElements()
2395 : throw(uno::RuntimeException)
2396 : {
2397 0 : return getCount() > 0;
2398 : }
2399 :
2400 : // XDrawPages
2401 :
2402 : /******************************************************************************
2403 : * Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die *
2404 : * dazugehoerige SdDrawPage zurueck. *
2405 : ******************************************************************************/
2406 14 : uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex )
2407 : throw(uno::RuntimeException)
2408 : {
2409 14 : ::SolarMutexGuard aGuard;
2410 :
2411 14 : if( NULL == mpModel )
2412 0 : throw lang::DisposedException();
2413 :
2414 14 : if( mpModel->mpDoc )
2415 : {
2416 14 : SdPage* pPage = mpModel->InsertSdPage( (sal_uInt16)nIndex );
2417 14 : if( pPage )
2418 : {
2419 14 : uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
2420 14 : return xDrawPage;
2421 : }
2422 : }
2423 0 : uno::Reference< drawing::XDrawPage > xDrawPage;
2424 0 : return xDrawPage;
2425 : }
2426 :
2427 : /******************************************************************************
2428 : * Entfernt die angegebenne SdDrawPage aus dem Model und aus der internen *
2429 : * Liste. Dies funktioniert nur, wenn mindestens eine *normale* Seite im Model *
2430 : * nach dem entfernen dieser Seite vorhanden ist. *
2431 : ******************************************************************************/
2432 0 : void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
2433 : throw(uno::RuntimeException)
2434 : {
2435 0 : ::SolarMutexGuard aGuard;
2436 :
2437 0 : if( NULL == mpModel || mpModel->mpDoc == NULL )
2438 0 : throw lang::DisposedException();
2439 :
2440 0 : SdDrawDocument& rDoc = *mpModel->mpDoc;
2441 :
2442 0 : sal_uInt16 nPageCount = rDoc.GetSdPageCount( PK_STANDARD );
2443 0 : if( nPageCount > 1 )
2444 : {
2445 : // pPage von xPage besorgen und dann die Id (nPos )ermitteln
2446 0 : SdDrawPage* pSvxPage = SdDrawPage::getImplementation( xPage );
2447 0 : if( pSvxPage )
2448 : {
2449 0 : SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage();
2450 0 : if(pPage && ( pPage->GetPageKind() == PK_STANDARD ) )
2451 : {
2452 0 : sal_uInt16 nPage = pPage->GetPageNum();
2453 :
2454 0 : SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetPage( nPage+1 ) );
2455 :
2456 0 : bool bUndo = rDoc.IsUndoEnabled();
2457 0 : if( bUndo )
2458 : {
2459 : // Add undo actions and delete the pages. The order of adding
2460 : // the undo actions is important.
2461 0 : rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
2462 0 : rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
2463 0 : rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
2464 : }
2465 :
2466 0 : rDoc.RemovePage( nPage ); // the page
2467 0 : rDoc.RemovePage( nPage ); // the notes page
2468 :
2469 0 : if( bUndo )
2470 : {
2471 0 : rDoc.EndUndo();
2472 : }
2473 : else
2474 : {
2475 0 : delete pNotesPage;
2476 0 : delete pPage;
2477 : }
2478 : }
2479 : }
2480 : }
2481 :
2482 0 : mpModel->SetModified();
2483 0 : }
2484 :
2485 : // XServiceInfo
2486 : const char pSdDrawPagesAccessService[] = "com.sun.star.drawing.DrawPages";
2487 :
2488 0 : OUString SAL_CALL SdDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException)
2489 : {
2490 0 : return OUString( "SdDrawPagesAccess" );
2491 : }
2492 :
2493 0 : sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
2494 : {
2495 0 : return ServiceName == pSdDrawPagesAccessService;
2496 : }
2497 :
2498 0 : uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException)
2499 : {
2500 0 : OUString aService( pSdDrawPagesAccessService );
2501 0 : uno::Sequence< OUString > aSeq( &aService, 1 );
2502 0 : return aSeq;
2503 : }
2504 :
2505 : // XComponent
2506 4 : void SAL_CALL SdDrawPagesAccess::dispose( ) throw (uno::RuntimeException)
2507 : {
2508 4 : mpModel = NULL;
2509 4 : }
2510 :
2511 0 : void SAL_CALL SdDrawPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
2512 : {
2513 : OSL_FAIL( "not implemented!" );
2514 0 : }
2515 :
2516 0 : void SAL_CALL SdDrawPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
2517 : {
2518 : OSL_FAIL( "not implemented!" );
2519 0 : }
2520 :
2521 : //=============================================================================
2522 : // class SdMasterPagesAccess
2523 : //=============================================================================
2524 :
2525 24 : SdMasterPagesAccess::SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw()
2526 24 : : mpModel(&rMyModel)
2527 : {
2528 24 : }
2529 :
2530 48 : SdMasterPagesAccess::~SdMasterPagesAccess() throw()
2531 : {
2532 48 : }
2533 :
2534 : // XComponent
2535 0 : void SAL_CALL SdMasterPagesAccess::dispose( ) throw (uno::RuntimeException)
2536 : {
2537 0 : mpModel = NULL;
2538 0 : }
2539 :
2540 0 : void SAL_CALL SdMasterPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
2541 : {
2542 : OSL_FAIL( "not implemented!" );
2543 0 : }
2544 :
2545 0 : void SAL_CALL SdMasterPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
2546 : {
2547 : OSL_FAIL( "not implemented!" );
2548 0 : }
2549 :
2550 : // XIndexAccess
2551 22 : sal_Int32 SAL_CALL SdMasterPagesAccess::getCount()
2552 : throw(uno::RuntimeException)
2553 : {
2554 22 : ::SolarMutexGuard aGuard;
2555 :
2556 22 : if( NULL == mpModel->mpDoc )
2557 0 : throw lang::DisposedException();
2558 :
2559 22 : return mpModel->mpDoc->GetMasterSdPageCount(PK_STANDARD);
2560 : }
2561 :
2562 : /******************************************************************************
2563 : * Liefert ein drawing::XDrawPage Interface fuer den Zugriff auf die Masterpage and der *
2564 : * angegebennen Position im Model. *
2565 : ******************************************************************************/
2566 30 : uno::Any SAL_CALL SdMasterPagesAccess::getByIndex( sal_Int32 Index )
2567 : throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
2568 : {
2569 30 : ::SolarMutexGuard aGuard;
2570 :
2571 30 : if( NULL == mpModel )
2572 0 : throw lang::DisposedException();
2573 :
2574 30 : uno::Any aAny;
2575 :
2576 30 : if( (Index < 0) || (Index >= mpModel->mpDoc->GetMasterSdPageCount( PK_STANDARD ) ) )
2577 0 : throw lang::IndexOutOfBoundsException();
2578 :
2579 30 : SdPage* pPage = mpModel->mpDoc->GetMasterSdPage( (sal_uInt16)Index, PK_STANDARD );
2580 30 : if( pPage )
2581 : {
2582 30 : uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
2583 30 : aAny <<= xDrawPage;
2584 : }
2585 :
2586 30 : return aAny;
2587 : }
2588 :
2589 : // XElementAccess
2590 0 : uno::Type SAL_CALL SdMasterPagesAccess::getElementType()
2591 : throw(uno::RuntimeException)
2592 : {
2593 0 : return ITYPE(drawing::XDrawPage);
2594 : }
2595 :
2596 0 : sal_Bool SAL_CALL SdMasterPagesAccess::hasElements()
2597 : throw(uno::RuntimeException)
2598 : {
2599 0 : return getCount() > 0;
2600 : }
2601 :
2602 : // XDrawPages
2603 0 : uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIndex( sal_Int32 nInsertPos )
2604 : throw(uno::RuntimeException)
2605 : {
2606 0 : ::SolarMutexGuard aGuard;
2607 :
2608 0 : if( NULL == mpModel )
2609 0 : throw lang::DisposedException();
2610 :
2611 0 : uno::Reference< drawing::XDrawPage > xDrawPage;
2612 :
2613 0 : SdDrawDocument* mpDoc = mpModel->mpDoc;
2614 0 : if( mpDoc )
2615 : {
2616 : // calculate internal index and check for range errors
2617 0 : const sal_Int32 nMPageCount = mpDoc->GetMasterPageCount();
2618 0 : nInsertPos = nInsertPos * 2 + 1;
2619 0 : if( nInsertPos < 0 || nInsertPos > nMPageCount )
2620 0 : nInsertPos = nMPageCount;
2621 :
2622 : // now generate a unique name for the new masterpage
2623 0 : const String aStdPrefix( SdResId(STR_LAYOUT_DEFAULT_NAME) );
2624 0 : String aPrefix( aStdPrefix );
2625 :
2626 0 : sal_Bool bUnique = sal_True;
2627 0 : sal_Int32 i = 0;
2628 0 : do
2629 : {
2630 0 : bUnique = sal_True;
2631 0 : for( sal_Int32 nMaster = 1; nMaster < nMPageCount; nMaster++ )
2632 : {
2633 0 : SdPage* pPage = (SdPage*)mpDoc->GetMasterPage((sal_uInt16)nMaster);
2634 0 : if( pPage && pPage->GetName() == aPrefix )
2635 : {
2636 0 : bUnique = sal_False;
2637 0 : break;
2638 : }
2639 : }
2640 :
2641 0 : if( !bUnique )
2642 : {
2643 0 : i++;
2644 0 : aPrefix = aStdPrefix;
2645 0 : aPrefix += sal_Unicode( ' ' );
2646 0 : aPrefix += String::CreateFromInt32( i );
2647 : }
2648 :
2649 0 : } while( !bUnique );
2650 :
2651 0 : String aLayoutName( aPrefix );
2652 0 : aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ));
2653 0 : aLayoutName += String(SdResId(STR_LAYOUT_OUTLINE));
2654 :
2655 : // create styles
2656 0 : ((SdStyleSheetPool*)mpDoc->GetStyleSheetPool())->CreateLayoutStyleSheets( aPrefix );
2657 :
2658 : // get the first page for initial size and border settings
2659 0 : SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_STANDARD );
2660 0 : SdPage* pRefNotesPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_NOTES);
2661 :
2662 : // create and instert new draw masterpage
2663 0 : SdPage* pMPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
2664 0 : pMPage->SetSize( pPage->GetSize() );
2665 0 : pMPage->SetBorder( pPage->GetLftBorder(),
2666 0 : pPage->GetUppBorder(),
2667 0 : pPage->GetRgtBorder(),
2668 0 : pPage->GetLwrBorder() );
2669 0 : pMPage->SetLayoutName( aLayoutName );
2670 0 : mpDoc->InsertMasterPage(pMPage, (sal_uInt16)nInsertPos);
2671 :
2672 : {
2673 : // ensure default MasterPage fill
2674 0 : pMPage->EnsureMasterPageDefaultBackground();
2675 : }
2676 :
2677 0 : xDrawPage = uno::Reference< drawing::XDrawPage >::query( pMPage->getUnoPage() );
2678 :
2679 : // create and instert new notes masterpage
2680 0 : SdPage* pMNotesPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True);
2681 0 : pMNotesPage->SetSize( pRefNotesPage->GetSize() );
2682 0 : pMNotesPage->SetPageKind(PK_NOTES);
2683 0 : pMNotesPage->SetBorder( pRefNotesPage->GetLftBorder(),
2684 0 : pRefNotesPage->GetUppBorder(),
2685 0 : pRefNotesPage->GetRgtBorder(),
2686 0 : pRefNotesPage->GetLwrBorder() );
2687 0 : pMNotesPage->SetLayoutName( aLayoutName );
2688 0 : mpDoc->InsertMasterPage(pMNotesPage, (sal_uInt16)nInsertPos + 1);
2689 0 : pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True);
2690 0 : mpModel->SetModified();
2691 : }
2692 :
2693 0 : return( xDrawPage );
2694 : }
2695 :
2696 : /******************************************************************************
2697 : * Entfernt die angegebenne SdMasterPage aus dem Model und aus der internen *
2698 : * Liste. Dies funktioniert nur, wenn keine *normale* Seite im Model diese *
2699 : * Seite als Masterpage benutzt. *
2700 : ******************************************************************************/
2701 0 : void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
2702 : throw(uno::RuntimeException)
2703 : {
2704 0 : ::SolarMutexGuard aGuard;
2705 :
2706 0 : if( NULL == mpModel || mpModel->mpDoc == NULL )
2707 0 : throw lang::DisposedException();
2708 :
2709 0 : SdDrawDocument& rDoc = *mpModel->mpDoc;
2710 :
2711 0 : SdMasterPage* pSdPage = SdMasterPage::getImplementation( xPage );
2712 0 : if(pSdPage == NULL)
2713 : return;
2714 :
2715 0 : SdPage* pPage = dynamic_cast< SdPage* > (pSdPage->GetSdrPage());
2716 :
2717 : DBG_ASSERT( pPage && pPage->IsMasterPage(), "SdMasterPage is not masterpage?");
2718 :
2719 0 : if( !pPage || !pPage->IsMasterPage() || (mpModel->mpDoc->GetMasterPageUserCount(pPage) > 0))
2720 : return; //Todo: this should be excepted
2721 :
2722 : // only standard pages can be removed directly
2723 0 : if( pPage->GetPageKind() == PK_STANDARD )
2724 : {
2725 0 : sal_uInt16 nPage = pPage->GetPageNum();
2726 :
2727 0 : SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) );
2728 :
2729 0 : bool bUndo = rDoc.IsUndoEnabled();
2730 0 : if( bUndo )
2731 : {
2732 : // Add undo actions and delete the pages. The order of adding
2733 : // the undo actions is important.
2734 0 : rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) );
2735 0 : rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage));
2736 0 : rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage));
2737 : }
2738 :
2739 0 : rDoc.RemoveMasterPage( nPage );
2740 0 : rDoc.RemoveMasterPage( nPage );
2741 :
2742 0 : if( bUndo )
2743 : {
2744 0 : rDoc.EndUndo();
2745 : }
2746 : else
2747 : {
2748 0 : delete pNotesPage;
2749 0 : delete pPage;
2750 : }
2751 0 : }
2752 : }
2753 :
2754 : // XServiceInfo
2755 : const char pSdMasterPagesAccessService[] = "com.sun.star.drawing.MasterPages";
2756 :
2757 0 : OUString SAL_CALL SdMasterPagesAccess::getImplementationName( ) throw(uno::RuntimeException)
2758 : {
2759 0 : return OUString( "SdMasterPagesAccess" );
2760 : }
2761 :
2762 0 : sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
2763 : {
2764 0 : return ServiceName == pSdMasterPagesAccessService;
2765 : }
2766 :
2767 0 : uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException)
2768 : {
2769 0 : OUString aService( pSdMasterPagesAccessService );
2770 0 : uno::Sequence< OUString > aSeq( &aService, 1 );
2771 0 : return aSeq;
2772 : }
2773 :
2774 : //=============================================================================
2775 : // class SdDocLinkTargets
2776 : //=============================================================================
2777 :
2778 0 : SdDocLinkTargets::SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw()
2779 0 : : mpModel( &rMyModel )
2780 : {
2781 0 : }
2782 :
2783 0 : SdDocLinkTargets::~SdDocLinkTargets() throw()
2784 : {
2785 0 : }
2786 :
2787 : // XComponent
2788 0 : void SAL_CALL SdDocLinkTargets::dispose( ) throw (uno::RuntimeException)
2789 : {
2790 0 : mpModel = NULL;
2791 0 : }
2792 :
2793 0 : void SAL_CALL SdDocLinkTargets::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
2794 : {
2795 : OSL_FAIL( "not implemented!" );
2796 0 : }
2797 :
2798 0 : void SAL_CALL SdDocLinkTargets::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException)
2799 : {
2800 : OSL_FAIL( "not implemented!" );
2801 0 : }
2802 :
2803 : // XNameAccess
2804 0 : uno::Any SAL_CALL SdDocLinkTargets::getByName( const OUString& aName )
2805 : throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
2806 : {
2807 0 : ::SolarMutexGuard aGuard;
2808 :
2809 0 : if( NULL == mpModel )
2810 0 : throw lang::DisposedException();
2811 :
2812 0 : SdPage* pPage = FindPage( aName );
2813 :
2814 0 : if( pPage == NULL )
2815 0 : throw container::NoSuchElementException();
2816 :
2817 0 : uno::Any aAny;
2818 :
2819 0 : uno::Reference< beans::XPropertySet > xProps( pPage->getUnoPage(), uno::UNO_QUERY );
2820 0 : if( xProps.is() )
2821 0 : aAny <<= xProps;
2822 :
2823 0 : return aAny;
2824 : }
2825 :
2826 0 : uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getElementNames()
2827 : throw(uno::RuntimeException)
2828 : {
2829 0 : ::SolarMutexGuard aGuard;
2830 :
2831 0 : if( NULL == mpModel )
2832 0 : throw lang::DisposedException();
2833 :
2834 0 : SdDrawDocument* mpDoc = mpModel->GetDoc();
2835 0 : if( mpDoc == NULL )
2836 : {
2837 0 : uno::Sequence< OUString > aSeq;
2838 0 : return aSeq;
2839 : }
2840 :
2841 0 : if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW )
2842 : {
2843 0 : const sal_uInt16 nMaxPages = mpDoc->GetSdPageCount( PK_STANDARD );
2844 0 : const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterSdPageCount( PK_STANDARD );
2845 :
2846 0 : uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
2847 0 : OUString* pStr = aSeq.getArray();
2848 :
2849 : sal_uInt16 nPage;
2850 : // standard pages
2851 0 : for( nPage = 0; nPage < nMaxPages; nPage++ )
2852 0 : *pStr++ = mpDoc->GetSdPage( nPage, PK_STANDARD )->GetName();
2853 :
2854 : // master pages
2855 0 : for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
2856 0 : *pStr++ = mpDoc->GetMasterSdPage( nPage, PK_STANDARD )->GetName();
2857 0 : return aSeq;
2858 : }
2859 : else
2860 : {
2861 0 : const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
2862 0 : const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
2863 :
2864 0 : uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages );
2865 0 : OUString* pStr = aSeq.getArray();
2866 :
2867 : sal_uInt16 nPage;
2868 : // standard pages
2869 0 : for( nPage = 0; nPage < nMaxPages; nPage++ )
2870 0 : *pStr++ = ((SdPage*)mpDoc->GetPage( nPage ))->GetName();
2871 :
2872 : // master pages
2873 0 : for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
2874 0 : *pStr++ = ((SdPage*)mpDoc->GetMasterPage( nPage ))->GetName();
2875 0 : return aSeq;
2876 0 : }
2877 : }
2878 :
2879 0 : sal_Bool SAL_CALL SdDocLinkTargets::hasByName( const OUString& aName )
2880 : throw(uno::RuntimeException)
2881 : {
2882 0 : ::SolarMutexGuard aGuard;
2883 :
2884 0 : if( NULL == mpModel )
2885 0 : throw lang::DisposedException();
2886 :
2887 0 : return FindPage( aName ) != NULL;
2888 : }
2889 :
2890 : // container::XElementAccess
2891 0 : uno::Type SAL_CALL SdDocLinkTargets::getElementType()
2892 : throw(uno::RuntimeException)
2893 : {
2894 0 : return ITYPE(beans::XPropertySet);
2895 : }
2896 :
2897 0 : sal_Bool SAL_CALL SdDocLinkTargets::hasElements()
2898 : throw(uno::RuntimeException)
2899 : {
2900 0 : ::SolarMutexGuard aGuard;
2901 :
2902 0 : if( NULL == mpModel )
2903 0 : throw lang::DisposedException();
2904 :
2905 0 : return mpModel->GetDoc() != NULL;
2906 : }
2907 :
2908 0 : SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw()
2909 : {
2910 0 : SdDrawDocument* mpDoc = mpModel->GetDoc();
2911 0 : if( mpDoc == NULL )
2912 0 : return NULL;
2913 :
2914 0 : const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
2915 0 : const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
2916 :
2917 : sal_uInt16 nPage;
2918 : SdPage* pPage;
2919 :
2920 0 : const String aName( rName );
2921 :
2922 0 : const bool bDraw = mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW;
2923 :
2924 : // standard pages
2925 0 : for( nPage = 0; nPage < nMaxPages; nPage++ )
2926 : {
2927 0 : pPage = (SdPage*)mpDoc->GetPage( nPage );
2928 0 : if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
2929 0 : return pPage;
2930 : }
2931 :
2932 : // master pages
2933 0 : for( nPage = 0; nPage < nMaxMasterPages; nPage++ )
2934 : {
2935 0 : pPage = (SdPage*)mpDoc->GetMasterPage( nPage );
2936 0 : if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) )
2937 0 : return pPage;
2938 : }
2939 :
2940 0 : return NULL;
2941 : }
2942 :
2943 : // XServiceInfo
2944 0 : OUString SAL_CALL SdDocLinkTargets::getImplementationName()
2945 : throw(uno::RuntimeException)
2946 : {
2947 0 : return OUString( "SdDocLinkTargets" );
2948 : }
2949 :
2950 0 : sal_Bool SAL_CALL SdDocLinkTargets::supportsService( const OUString& ServiceName )
2951 : throw(uno::RuntimeException)
2952 : {
2953 0 : return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
2954 : }
2955 :
2956 0 : uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames()
2957 : throw(uno::RuntimeException)
2958 : {
2959 0 : const OUString aSN( "com.sun.star.document.LinkTargets" );
2960 0 : uno::Sequence< OUString > aSeq( &aSN, 1 );
2961 0 : return aSeq;
2962 : }
2963 :
2964 0 : rtl::Reference< SdXImpressDocument > SdXImpressDocument::GetModel( SdDrawDocument* pDocument )
2965 : {
2966 0 : rtl::Reference< SdXImpressDocument > xRet;
2967 0 : if( pDocument )
2968 : {
2969 0 : ::sd::DrawDocShell* pDocShell = pDocument->GetDocSh();
2970 0 : if( pDocShell )
2971 : {
2972 0 : uno::Reference<frame::XModel> xModel(pDocShell->GetModel());
2973 :
2974 0 : xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) );
2975 : }
2976 : }
2977 :
2978 0 : return xRet;
2979 : }
2980 :
2981 0 : void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName )
2982 : {
2983 0 : rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
2984 :
2985 0 : if( xModel.is() )
2986 : {
2987 0 : uno::Reference< uno::XInterface > xSource( static_cast<uno::XWeak*>( xModel.get() ) );
2988 0 : ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
2989 0 : xModel->notifyEvent(aEvent );
2990 0 : }
2991 0 : }
2992 :
2993 0 : void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const uno::Reference< uno::XInterface >& xSource )
2994 : {
2995 0 : rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
2996 :
2997 0 : if( xModel.is() )
2998 : {
2999 0 : ::com::sun::star::document::EventObject aEvent( xSource, rEventName );
3000 0 : xModel->notifyEvent(aEvent );
3001 0 : }
3002 0 : }
3003 :
3004 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|