Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SD_SOURCE_UI_UNOIDL_UNOCPRES_HXX
20 : #define INCLUDED_SD_SOURCE_UI_UNOIDL_UNOCPRES_HXX
21 :
22 : #include <com/sun/star/lang/XComponent.hpp>
23 : #include <com/sun/star/container/XIndexContainer.hpp>
24 : #include <com/sun/star/container/XNamed.hpp>
25 : #include <com/sun/star/lang/XServiceInfo.hpp>
26 : #include <com/sun/star/lang/XUnoTunnel.hpp>
27 : #include <cppuhelper/interfacecontainer.h>
28 : #include <osl/mutex.hxx>
29 :
30 : #include <cppuhelper/implbase5.hxx>
31 : #include <comphelper/servicehelper.hxx>
32 :
33 :
34 :
35 : class SdXImpressDocument;
36 : class SdCustomShow;
37 :
38 : class SdXCustomPresentation : public ::cppu::WeakImplHelper5< ::com::sun::star::container::XIndexContainer,
39 : ::com::sun::star::container::XNamed,
40 : ::com::sun::star::lang::XUnoTunnel,
41 : ::com::sun::star::lang::XComponent,
42 : ::com::sun::star::lang::XServiceInfo >
43 : {
44 : private:
45 : SdCustomShow* mpSdCustomShow;
46 : SdXImpressDocument* mpModel;
47 :
48 : // for xComponent
49 : ::osl::Mutex aDisposeContainerMutex;
50 : ::cppu::OInterfaceContainerHelper aDisposeListeners;
51 : sal_Bool bDisposing;
52 :
53 : public:
54 : SdXCustomPresentation() throw();
55 : SdXCustomPresentation( SdCustomShow* mpSdCustomShow, SdXImpressDocument* pMyModel) throw();
56 : virtual ~SdXCustomPresentation() throw();
57 :
58 : // internal
59 : void Invalidate() { mpSdCustomShow = NULL; }
60 0 : SdCustomShow* GetSdCustomShow() const throw() { return mpSdCustomShow; }
61 0 : void SetSdCustomShow( SdCustomShow* pShow ) throw() { mpSdCustomShow = pShow; }
62 0 : SdXImpressDocument* GetModel() const throw() { return mpModel; }
63 :
64 : // uno helper
65 : UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation)
66 :
67 : // XServiceInfo
68 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 :
72 : // XIndexContainer
73 : 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, std::exception) SAL_OVERRIDE;
74 : virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 :
76 : // XIndexReplace
77 : 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, std::exception) SAL_OVERRIDE;
78 :
79 : // XElementAccess
80 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 :
83 : // XIndexAccess
84 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
85 : 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, std::exception) SAL_OVERRIDE;
86 :
87 : // XNamed
88 : virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 :
91 : // XComponent
92 : virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : };
96 :
97 :
98 : #include <com/sun/star/container/XNameContainer.hpp>
99 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
100 :
101 : #include <cppuhelper/implbase3.hxx>
102 :
103 : #include "unomodel.hxx"
104 : #include "drawdoc.hxx"
105 :
106 : class List;
107 :
108 : class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameContainer,
109 : ::com::sun::star::lang::XSingleServiceFactory,
110 : ::com::sun::star::lang::XServiceInfo >
111 : {
112 : private:
113 : SdXImpressDocument& mrModel;
114 :
115 : // intern
116 : inline SdCustomShowList* GetCustomShowList() const throw();
117 : SdCustomShow * getSdCustomShow( const OUString& Name ) const throw();
118 :
119 : public:
120 : SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw();
121 : virtual ~SdXCustomPresentationAccess() throw();
122 :
123 : // XServiceInfo
124 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 :
128 : // XSingleServiceFactory
129 : 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, std::exception) SAL_OVERRIDE;
130 : 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, std::exception) SAL_OVERRIDE;
131 :
132 : // XNameContainer
133 : virtual void SAL_CALL insertByName( const 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, std::exception) SAL_OVERRIDE;
134 : virtual void SAL_CALL removeByName( const OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 :
136 : // XNameReplace
137 : virtual void SAL_CALL replaceByName( const 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, std::exception) SAL_OVERRIDE;
138 :
139 : // XNameAccess
140 : 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, std::exception) SAL_OVERRIDE;
141 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 :
144 : // XElementAccess
145 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
147 : };
148 :
149 0 : inline SdCustomShowList* SdXCustomPresentationAccess::GetCustomShowList() const throw()
150 : {
151 0 : if(mrModel.GetDoc())
152 0 : return mrModel.GetDoc()->GetCustomShowList(sal_False);
153 : else
154 0 : return NULL;
155 : };
156 :
157 : #endif
158 :
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|