1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*c45d927aSAndrew Rist * distributed with this work for additional information
6*c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at
10*c45d927aSAndrew Rist *
11*c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist *
13*c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist * KIND, either express or implied. See the License for the
17*c45d927aSAndrew Rist * specific language governing permissions and limitations
18*c45d927aSAndrew Rist * under the License.
19*c45d927aSAndrew Rist *
20*c45d927aSAndrew Rist *************************************************************/
21*c45d927aSAndrew Rist
22*c45d927aSAndrew Rist
23cdf0e10cSrcweir #ifndef _SD_UNOCPRES_HXX
24cdf0e10cSrcweir #define _SD_UNOCPRES_HXX
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
27cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
28cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
31cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
32cdf0e10cSrcweir #include <osl/mutex.hxx>
33cdf0e10cSrcweir
34cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
35cdf0e10cSrcweir #include <comphelper/servicehelper.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////////
38cdf0e10cSrcweir
39cdf0e10cSrcweir class SdXImpressDocument;
40cdf0e10cSrcweir class SdView;
41cdf0e10cSrcweir class SdDrawViewShell;
42cdf0e10cSrcweir class SdCustomShow;
43cdf0e10cSrcweir
44cdf0e10cSrcweir class SdXCustomPresentation : public ::cppu::WeakImplHelper5< ::com::sun::star::container::XIndexContainer,
45cdf0e10cSrcweir ::com::sun::star::container::XNamed,
46cdf0e10cSrcweir ::com::sun::star::lang::XUnoTunnel,
47cdf0e10cSrcweir ::com::sun::star::lang::XComponent,
48cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo >
49cdf0e10cSrcweir {
50cdf0e10cSrcweir private:
51cdf0e10cSrcweir SdCustomShow* mpSdCustomShow;
52cdf0e10cSrcweir SdXImpressDocument* mpModel;
53cdf0e10cSrcweir
54cdf0e10cSrcweir // for xComponent
55cdf0e10cSrcweir ::osl::Mutex aDisposeContainerMutex;
56cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper aDisposeListeners;
57cdf0e10cSrcweir sal_Bool bDisposing;
58cdf0e10cSrcweir
59cdf0e10cSrcweir public:
60cdf0e10cSrcweir SdXCustomPresentation() throw();
61cdf0e10cSrcweir SdXCustomPresentation( SdCustomShow* mpSdCustomShow, SdXImpressDocument* pMyModel) throw();
62cdf0e10cSrcweir virtual ~SdXCustomPresentation() throw();
63cdf0e10cSrcweir
64cdf0e10cSrcweir // internal
Invalidate()65cdf0e10cSrcweir void Invalidate() { mpSdCustomShow = NULL; }
GetSdCustomShow() const66cdf0e10cSrcweir SdCustomShow* GetSdCustomShow() const throw() { return mpSdCustomShow; }
SetSdCustomShow(SdCustomShow * pShow)67cdf0e10cSrcweir void SetSdCustomShow( SdCustomShow* pShow ) throw() { mpSdCustomShow = pShow; }
GetModel() const68cdf0e10cSrcweir SdXImpressDocument* GetModel() const throw() { return mpModel; }
69cdf0e10cSrcweir
70cdf0e10cSrcweir // uno helper
71cdf0e10cSrcweir UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation)
72cdf0e10cSrcweir
73cdf0e10cSrcweir // XServiceInfo
74cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
75cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
77cdf0e10cSrcweir
78cdf0e10cSrcweir // XIndexContainer
79cdf0e10cSrcweir virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir
82cdf0e10cSrcweir // XIndexReplace
83cdf0e10cSrcweir virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir
85cdf0e10cSrcweir // XElementAccess
86cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir
89cdf0e10cSrcweir // XIndexAccess
90cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
91cdf0e10cSrcweir 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);
92cdf0e10cSrcweir
93cdf0e10cSrcweir // XNamed
94cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir
97cdf0e10cSrcweir // XComponent
98cdf0e10cSrcweir virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir };
102cdf0e10cSrcweir
103cdf0e10cSrcweir // --------------------------------------------------------------------------
104cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
105cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
106cdf0e10cSrcweir
107cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
108cdf0e10cSrcweir
109cdf0e10cSrcweir #include "unomodel.hxx"
110cdf0e10cSrcweir #include "drawdoc.hxx"
111cdf0e10cSrcweir
112cdf0e10cSrcweir class List;
113cdf0e10cSrcweir
114cdf0e10cSrcweir class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameContainer,
115cdf0e10cSrcweir ::com::sun::star::lang::XSingleServiceFactory,
116cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo >
117cdf0e10cSrcweir {
118cdf0e10cSrcweir private:
119cdf0e10cSrcweir SdXImpressDocument& mrModel;
120cdf0e10cSrcweir
121cdf0e10cSrcweir // intern
122cdf0e10cSrcweir inline List* GetCustomShowList() const throw();
123cdf0e10cSrcweir SdCustomShow * getSdCustomShow( const ::rtl::OUString& Name ) const throw();
124cdf0e10cSrcweir
125cdf0e10cSrcweir public:
126cdf0e10cSrcweir SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw();
127cdf0e10cSrcweir ~SdXCustomPresentationAccess() throw();
128cdf0e10cSrcweir
129cdf0e10cSrcweir // XServiceInfo
130cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
132cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir
134cdf0e10cSrcweir // XSingleServiceFactory
135cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
137cdf0e10cSrcweir
138cdf0e10cSrcweir // XNameContainer
139cdf0e10cSrcweir virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir
142cdf0e10cSrcweir // XNameReplace
143cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
144cdf0e10cSrcweir
145cdf0e10cSrcweir // XNameAccess
146cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
149cdf0e10cSrcweir
150cdf0e10cSrcweir // XElementAccess
151cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir };
154cdf0e10cSrcweir
GetCustomShowList() const155cdf0e10cSrcweir inline List * SdXCustomPresentationAccess::GetCustomShowList() const throw()
156cdf0e10cSrcweir {
157cdf0e10cSrcweir if(mrModel.GetDoc())
158cdf0e10cSrcweir return mrModel.GetDoc()->GetCustomShowList(sal_False);
159cdf0e10cSrcweir else
160cdf0e10cSrcweir return NULL;
161cdf0e10cSrcweir };
162cdf0e10cSrcweir
163cdf0e10cSrcweir #endif
164cdf0e10cSrcweir
165cdf0e10cSrcweir
166