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