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