1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef SD_UNO_MODEL_HXX
20 #define SD_UNO_MODEL_HXX
22 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
23 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
24 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
25 #include <com/sun/star/drawing/XDrawPageSummarizer.hpp>
26 #include <com/sun/star/drawing/XDrawPageDuplicator.hpp>
27 #include <com/sun/star/drawing/XLayerSupplier.hpp>
28 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
29 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
30 #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
31 #include <com/sun/star/drawing/XLayerManager.hpp>
32 #include <com/sun/star/container/XNameContainer.hpp>
33 #include <com/sun/star/presentation/XPresentation.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/drawing/XDrawPages.hpp>
36 #include <com/sun/star/ucb/XAnyCompareFactory.hpp>
37 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
38 #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
39 #include <com/sun/star/view/XRenderable.hpp>
40 #include <com/sun/star/util/MeasureUnit.hpp>
42 #include <rtl/ref.hxx>
44 #include <svl/lstner.hxx>
45 #include <sfx2/sfxbasemodel.hxx>
46 #include <svx/fmdmod.hxx>
48 #include <editeng/unoipset.hxx>
50 #include <comphelper/servicehelper.hxx>
59 extern OUString
getPageApiName( SdPage
* pPage
);
60 extern OUString
getPageApiNameFromUiName( const String
& rUIName
);
62 /***********************************************************************
64 ***********************************************************************/
65 class SdXImpressDocument
: public SfxBaseModel
, // implements SfxListener, OWEAKOBJECT & other
66 public SvxFmMSFactory
,
67 public ::com::sun::star::drawing::XDrawPageDuplicator
,
68 public ::com::sun::star::drawing::XLayerSupplier
,
69 public ::com::sun::star::drawing::XMasterPagesSupplier
,
70 public ::com::sun::star::drawing::XDrawPagesSupplier
,
71 public ::com::sun::star::presentation::XPresentationSupplier
,
72 public ::com::sun::star::presentation::XCustomPresentationSupplier
,
73 public ::com::sun::star::document::XLinkTargetSupplier
,
74 public ::com::sun::star::beans::XPropertySet
,
75 public ::com::sun::star::style::XStyleFamiliesSupplier
,
76 public ::com::sun::star::lang::XServiceInfo
,
77 public ::com::sun::star::ucb::XAnyCompareFactory
,
78 public ::com::sun::star::presentation::XHandoutMasterSupplier
,
79 public ::com::sun::star::view::XRenderable
81 friend class SdDrawPagesAccess
;
82 friend class SdMasterPagesAccess
;
83 friend class SdLayerManager
;
86 ::sd::DrawDocShell
* mpDocShell
;
87 SdDrawDocument
* mpDoc
;
90 SdPage
* InsertSdPage( sal_uInt16 nPage
, sal_Bool bDuplicate
= sal_False
) throw();
92 const sal_Bool mbImpressDoc
;
95 ::com::sun::star::uno::WeakReference
< ::com::sun::star::drawing::XDrawPages
> mxDrawPagesAccess
;
96 ::com::sun::star::uno::WeakReference
< ::com::sun::star::drawing::XDrawPages
> mxMasterPagesAccess
;
97 ::com::sun::star::uno::WeakReference
< ::com::sun::star::container::XNameAccess
> mxLayerManager
;
98 ::com::sun::star::uno::WeakReference
< ::com::sun::star::container::XNameContainer
> mxCustomPresentationAccess
;
99 ::com::sun::star::uno::WeakReference
< ::com::sun::star::container::XNameAccess
> mxStyleFamilies
;
100 ::com::sun::star::uno::WeakReference
< ::com::sun::star::presentation::XPresentation
> mxPresentation
;
101 ::com::sun::star::uno::WeakReference
< ::com::sun::star::i18n::XForbiddenCharacters
> mxForbidenCharacters
;
102 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> mxLinks
;
104 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxDashTable
;
105 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxGradientTable
;
106 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxHatchTable
;
107 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxBitmapTable
;
108 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxTransGradientTable
;
109 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxMarkerTable
;
110 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxDrawingPool
;
112 const SvxItemPropertySet
* mpPropSet
;
114 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> maTypeSequence
;
118 void initializeDocument();
120 SdXImpressDocument( ::sd::DrawDocShell
* pShell
, bool bClipBoard
= false ) throw();
121 SdXImpressDocument( SdDrawDocument
* pDoc
, bool bClipBoard
= false ) throw();
122 virtual ~SdXImpressDocument() throw();
124 static rtl::Reference
< SdXImpressDocument
> GetModel( SdDrawDocument
* pDoc
);
127 virtual int operator==( const SdXImpressDocument
& rModel
) const { return mpDoc
== rModel
.mpDoc
; }
128 virtual int operator!=( const SdXImpressDocument
& rModel
) const { return mpDoc
!= rModel
.mpDoc
; }
130 ::sd::DrawDocShell
* GetDocShell() const { return mpDocShell
; }
131 SdDrawDocument
* GetDoc() const { return mpDoc
; }
132 sal_Bool
IsImpressDocument() const { return mbImpressDoc
; }
134 void SetModified( sal_Bool bModified
= sal_True
) throw();
136 ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XForbiddenCharacters
> getForbiddenCharsTable();
139 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
141 UNO3_GETIMPLEMENTATION_DECL(SdXImpressDocument
)
144 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
145 virtual void SAL_CALL
acquire() throw();
146 virtual void SAL_CALL
release() throw();
149 virtual void SAL_CALL
lockControllers( ) throw(::com::sun::star::uno::RuntimeException
);
150 virtual void SAL_CALL
unlockControllers( ) throw(::com::sun::star::uno::RuntimeException
);
151 virtual sal_Bool SAL_CALL
hasControllersLocked( ) throw(::com::sun::star::uno::RuntimeException
);
152 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
> SAL_CALL
getViewData() throw(::com::sun::star::uno::RuntimeException
);
153 virtual void SAL_CALL
setViewData( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& aData
) throw(::com::sun::star::uno::RuntimeException
);
156 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
157 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId( ) throw(::com::sun::star::uno::RuntimeException
);
159 // XDrawPageDuplicator
160 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
duplicate( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
) throw(::com::sun::star::uno::RuntimeException
);
162 // XDrawPagesSupplier
163 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPages
> SAL_CALL
getDrawPages( ) throw(::com::sun::star::uno::RuntimeException
);
165 // XMasterPagesSupplier
166 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPages
> SAL_CALL
getMasterPages( ) throw(::com::sun::star::uno::RuntimeException
);
168 // XLayerManagerSupplier
169 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getLayerManager( ) throw(::com::sun::star::uno::RuntimeException
);
171 // XCustomPresentationSupplier
172 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> SAL_CALL
getCustomPresentations( ) throw(::com::sun::star::uno::RuntimeException
);
174 // XHandoutMasterSupplier
175 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
getHandoutMasterPage( ) throw (::com::sun::star::uno::RuntimeException
);
177 // XPresentationSupplier
178 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::presentation::XPresentation
> SAL_CALL
getPresentation( ) throw(::com::sun::star::uno::RuntimeException
);
180 // XMultiServiceFactory ( SvxFmMSFactory )
181 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
createInstance( const OUString
& aServiceSpecifier
) throw(::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
182 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException
);
185 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
186 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
187 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
190 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
191 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
192 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
193 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
194 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
195 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
196 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
198 // XLinkTargetSupplier
199 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getLinks( ) throw(::com::sun::star::uno::RuntimeException
);
201 // XStyleFamiliesSupplier
202 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getStyleFamilies( ) throw(::com::sun::star::uno::RuntimeException
);
204 // XAnyCompareFactory
205 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XAnyCompare
> SAL_CALL
createAnyCompareByName( const OUString
& PropertyName
) throw(::com::sun::star::uno::RuntimeException
);
208 virtual sal_Int32 SAL_CALL
getRendererCount( const ::com::sun::star::uno::Any
& aSelection
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& xOptions
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
209 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> SAL_CALL
getRenderer( sal_Int32 nRenderer
, const ::com::sun::star::uno::Any
& aSelection
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& xOptions
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
210 virtual void SAL_CALL
render( sal_Int32 nRenderer
, const ::com::sun::star::uno::Any
& aSelection
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& xOptions
) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
214 /** This dispose implementation releases the resources held by the
215 called object and forwards the call to its base class.
216 When close() has not yet been called then this is done first. As a
217 consequence the implementation has to cope with being called twice
218 and still has to forward the second call to the base class.
219 See also comments of issue 27847.
221 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
);
224 /***********************************************************************
226 ***********************************************************************/
228 #include <cppuhelper/implbase4.hxx>
230 class SdDrawPagesAccess
: public ::cppu::WeakImplHelper4
< ::com::sun::star::drawing::XDrawPages
, ::com::sun::star::container::XNameAccess
, ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::lang::XComponent
>
233 SdXImpressDocument
* mpModel
;
236 SdDrawPagesAccess( SdXImpressDocument
& rMyModel
) throw();
237 virtual ~SdDrawPagesAccess() throw();
240 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
insertNewByIndex( sal_Int32 nIndex
) throw(::com::sun::star::uno::RuntimeException
);
241 virtual void SAL_CALL
remove( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
) throw(::com::sun::star::uno::RuntimeException
);
244 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
) throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
245 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw(::com::sun::star::uno::RuntimeException
);
246 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
);
249 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
) ;
250 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) throw(::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
253 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
);
254 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
257 virtual OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
);
258 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
259 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
);
262 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
);
263 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
264 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
267 /***********************************************************************
269 ***********************************************************************/
271 #include <cppuhelper/implbase3.hxx>
273 class SdMasterPagesAccess
: public ::cppu::WeakImplHelper3
< ::com::sun::star::drawing::XDrawPages
, ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::lang::XComponent
>
276 SdXImpressDocument
* mpModel
;
279 SdMasterPagesAccess( SdXImpressDocument
& rMyModel
) throw();
280 virtual ~SdMasterPagesAccess() throw();
283 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
insertNewByIndex( sal_Int32 nIndex
) throw(::com::sun::star::uno::RuntimeException
);
284 virtual void SAL_CALL
remove( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
) throw(::com::sun::star::uno::RuntimeException
);
287 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
) ;
288 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) throw(::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
291 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
);
292 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
295 virtual OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
);
296 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
297 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
);
300 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
);
301 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
302 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
305 /***********************************************************************
307 ***********************************************************************/
309 class SdDocLinkTargets
: public ::cppu::WeakImplHelper3
< ::com::sun::star::container::XNameAccess
,
310 ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::lang::XComponent
>
313 SdXImpressDocument
* mpModel
;
316 SdDocLinkTargets( SdXImpressDocument
& rMyModel
) throw();
317 virtual ~SdDocLinkTargets() throw();
320 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
) throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
321 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw(::com::sun::star::uno::RuntimeException
);
322 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
);
325 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
);
326 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
329 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
330 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
331 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
334 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
);
335 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
336 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
339 SdPage
* FindPage( const OUString
& rName
) const throw();
345 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */