merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / unoidl / unocpres.hxx
blob6584ffe781808524b5a7e10841a21028e3b3114b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unocpres.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SD_UNOCPRES_HXX
31 #define _SD_UNOCPRES_HXX
33 #include <com/sun/star/lang/XComponent.hpp>
34 #include <com/sun/star/container/XIndexContainer.hpp>
35 #include <com/sun/star/container/XNamed.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/lang/XUnoTunnel.hpp>
38 #include <cppuhelper/interfacecontainer.h>
39 #include <osl/mutex.hxx>
41 #include <cppuhelper/implbase5.hxx>
42 #include <comphelper/servicehelper.hxx>
44 ///////////////////////////////////////////////////////////////////////////////
46 class SdXImpressDocument;
47 class SdView;
48 class SdDrawViewShell;
49 class SdCustomShow;
51 class SdXCustomPresentation : public ::cppu::WeakImplHelper5< ::com::sun::star::container::XIndexContainer,
52 ::com::sun::star::container::XNamed,
53 ::com::sun::star::lang::XUnoTunnel,
54 ::com::sun::star::lang::XComponent,
55 ::com::sun::star::lang::XServiceInfo >
57 private:
58 SdCustomShow* mpSdCustomShow;
59 SdXImpressDocument* mpModel;
61 // for xComponent
62 ::osl::Mutex aDisposeContainerMutex;
63 ::cppu::OInterfaceContainerHelper aDisposeListeners;
64 BOOL bDisposing;
66 public:
67 SdXCustomPresentation() throw();
68 SdXCustomPresentation( SdCustomShow* mpSdCustomShow, SdXImpressDocument* pMyModel) throw();
69 virtual ~SdXCustomPresentation() throw();
71 // internal
72 void Invalidate() { mpSdCustomShow = NULL; }
73 SdCustomShow* GetSdCustomShow() const throw() { return mpSdCustomShow; }
74 void SetSdCustomShow( SdCustomShow* pShow ) throw() { mpSdCustomShow = pShow; }
75 SdXImpressDocument* GetModel() const throw() { return mpModel; }
77 // uno helper
78 UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation)
80 // XServiceInfo
81 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
82 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
83 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
85 // XIndexContainer
86 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);
87 virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
89 // XIndexReplace
90 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);
92 // XElementAccess
93 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
94 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
96 // XIndexAccess
97 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
98 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);
100 // XNamed
101 virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
102 virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
104 // XComponent
105 virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
106 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
107 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
110 // --------------------------------------------------------------------------
111 #include <com/sun/star/container/XNameContainer.hpp>
112 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
114 #include <cppuhelper/implbase3.hxx>
116 #include "unomodel.hxx"
117 #include "drawdoc.hxx"
119 class List;
121 class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameContainer,
122 ::com::sun::star::lang::XSingleServiceFactory,
123 ::com::sun::star::lang::XServiceInfo >
125 private:
126 SdXImpressDocument& mrModel;
128 // intern
129 inline List* GetCustomShowList() const throw();
130 sal_Int32 getSdCustomShowIdx( const ::rtl::OUString& Name ) const throw();
131 SdCustomShow * getSdCustomShow( const ::rtl::OUString& Name ) const throw();
133 public:
134 SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw();
135 ~SdXCustomPresentationAccess() throw();
137 // XServiceInfo
138 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
139 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
140 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
142 // XSingleServiceFactory
143 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);
144 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);
146 // XNameContainer
147 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);
148 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);
150 // XNameReplace
151 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);
153 // XNameAccess
154 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);
155 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
156 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
158 // XElementAccess
159 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
160 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
163 inline List * SdXCustomPresentationAccess::GetCustomShowList() const throw()
165 if(mrModel.GetDoc())
166 return mrModel.GetDoc()->GetCustomShowList(sal_False);
167 else
168 return NULL;
171 #endif