1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SD_SOURCE_UI_UNOIDL_UNOCPRES_HXX
20 #define INCLUDED_SD_SOURCE_UI_UNOIDL_UNOCPRES_HXX
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 <comphelper/interfacecontainer2.hxx>
28 #include <osl/mutex.hxx>
30 #include <cppuhelper/implbase.hxx>
31 #include <comphelper/servicehelper.hxx>
32 #include <com/sun/star/container/XNameContainer.hpp>
33 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
35 #include <unomodel.hxx>
36 #include <drawdoc.hxx>
41 class SdXCustomPresentation
: public ::cppu::WeakImplHelper
< css::container::XIndexContainer
,
42 css::container::XNamed
,
43 css::lang::XUnoTunnel
,
44 css::lang::XComponent
,
45 css::lang::XServiceInfo
>
48 SdCustomShow
* mpSdCustomShow
;
49 SdXImpressDocument
* mpModel
;
52 ::osl::Mutex aDisposeContainerMutex
;
53 ::comphelper::OInterfaceContainerHelper2 aDisposeListeners
;
57 SdXCustomPresentation() throw();
58 explicit SdXCustomPresentation( SdCustomShow
* mpSdCustomShow
) throw();
59 virtual ~SdXCustomPresentation() throw() override
;
62 SdCustomShow
* GetSdCustomShow() const throw() { return mpSdCustomShow
; }
63 void SetSdCustomShow( SdCustomShow
* pShow
) throw() { mpSdCustomShow
= pShow
; }
64 SdXImpressDocument
* GetModel() const throw() { return mpModel
; }
67 UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation
)
70 virtual OUString SAL_CALL
getImplementationName() override
;
71 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
72 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
75 virtual void SAL_CALL
insertByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
76 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
) override
;
79 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
82 virtual css::uno::Type SAL_CALL
getElementType() override
;
83 virtual sal_Bool SAL_CALL
hasElements() override
;
86 virtual sal_Int32 SAL_CALL
getCount() override
;
87 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
90 virtual OUString SAL_CALL
getName( ) override
;
91 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
94 virtual void SAL_CALL
dispose( ) override
;
95 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
96 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
99 class SdXCustomPresentationAccess
: public ::cppu::WeakImplHelper
< css::container::XNameContainer
,
100 css::lang::XSingleServiceFactory
,
101 css::lang::XServiceInfo
>
104 SdXImpressDocument
& mrModel
;
107 inline SdCustomShowList
* GetCustomShowList() const throw();
108 SdCustomShow
* getSdCustomShow( const OUString
& Name
) const throw();
111 explicit SdXCustomPresentationAccess(SdXImpressDocument
& rMyModel
) throw();
112 virtual ~SdXCustomPresentationAccess() throw() override
;
115 virtual OUString SAL_CALL
getImplementationName() override
;
116 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
117 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
119 // XSingleServiceFactory
120 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstance( ) override
;
121 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstanceWithArguments( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
124 virtual void SAL_CALL
insertByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
125 virtual void SAL_CALL
removeByName( const OUString
& Name
) override
;
128 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const css::uno::Any
& aElement
) override
;
131 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
132 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
133 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
136 virtual css::uno::Type SAL_CALL
getElementType() override
;
137 virtual sal_Bool SAL_CALL
hasElements() override
;
140 inline SdCustomShowList
* SdXCustomPresentationAccess::GetCustomShowList() const throw()
143 return mrModel
.GetDoc()->GetCustomShowList();
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */