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 : class SdXImpressDocument;
34 : class SdCustomShow;
35 :
36 : class SdXCustomPresentation : public ::cppu::WeakImplHelper5< ::com::sun::star::container::XIndexContainer,
37 : ::com::sun::star::container::XNamed,
38 : ::com::sun::star::lang::XUnoTunnel,
39 : ::com::sun::star::lang::XComponent,
40 : ::com::sun::star::lang::XServiceInfo >
41 : {
42 : private:
43 : SdCustomShow* mpSdCustomShow;
44 : SdXImpressDocument* mpModel;
45 :
46 : // for xComponent
47 : ::osl::Mutex aDisposeContainerMutex;
48 : ::cppu::OInterfaceContainerHelper aDisposeListeners;
49 : bool bDisposing;
50 :
51 : public:
52 : SdXCustomPresentation() throw();
53 : SdXCustomPresentation( SdCustomShow* mpSdCustomShow, SdXImpressDocument* pMyModel) throw();
54 : virtual ~SdXCustomPresentation() throw();
55 :
56 : // internal
57 : void Invalidate() { mpSdCustomShow = NULL; }
58 6 : SdCustomShow* GetSdCustomShow() const throw() { return mpSdCustomShow; }
59 6 : void SetSdCustomShow( SdCustomShow* pShow ) throw() { mpSdCustomShow = pShow; }
60 0 : SdXImpressDocument* GetModel() const throw() { return mpModel; }
61 :
62 : // uno helper
63 : UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation)
64 :
65 : // XServiceInfo
66 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 :
70 : // XIndexContainer
71 : 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;
72 : 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;
73 :
74 : // XIndexReplace
75 : 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;
76 :
77 : // XElementAccess
78 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 :
81 : // XIndexAccess
82 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
83 : 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;
84 :
85 : // XNamed
86 : virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 : virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 :
89 : // XComponent
90 : virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 : 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;
92 : 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;
93 : };
94 :
95 : #include <com/sun/star/container/XNameContainer.hpp>
96 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
97 :
98 : #include <cppuhelper/implbase3.hxx>
99 :
100 : #include "unomodel.hxx"
101 : #include "drawdoc.hxx"
102 :
103 : class List;
104 :
105 : class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper3< ::com::sun::star::container::XNameContainer,
106 : ::com::sun::star::lang::XSingleServiceFactory,
107 : ::com::sun::star::lang::XServiceInfo >
108 : {
109 : private:
110 : SdXImpressDocument& mrModel;
111 :
112 : // intern
113 : inline SdCustomShowList* GetCustomShowList() const throw();
114 : SdCustomShow * getSdCustomShow( const OUString& Name ) const throw();
115 :
116 : public:
117 : SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) throw();
118 : virtual ~SdXCustomPresentationAccess() throw();
119 :
120 : // XServiceInfo
121 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 :
125 : // XSingleServiceFactory
126 : 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;
127 : 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;
128 :
129 : // XNameContainer
130 : 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;
131 : 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;
132 :
133 : // XNameReplace
134 : 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;
135 :
136 : // XNameAccess
137 : 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;
138 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 :
141 : // XElementAccess
142 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 : };
145 :
146 6 : inline SdCustomShowList* SdXCustomPresentationAccess::GetCustomShowList() const throw()
147 : {
148 6 : if(mrModel.GetDoc())
149 6 : return mrModel.GetDoc()->GetCustomShowList(false);
150 : else
151 0 : return NULL;
152 : };
153 :
154 : #endif
155 :
156 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|