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 _SD_UNOCPRES_HXX
20 #define _SD_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 <cppuhelper/interfacecontainer.h>
28 #include <osl/mutex.hxx>
30 #include <cppuhelper/implbase5.hxx>
31 #include <comphelper/servicehelper.hxx>
33 ///////////////////////////////////////////////////////////////////////////////
35 class SdXImpressDocument
;
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
>
45 SdCustomShow
* mpSdCustomShow
;
46 SdXImpressDocument
* mpModel
;
49 ::osl::Mutex aDisposeContainerMutex
;
50 ::cppu::OInterfaceContainerHelper aDisposeListeners
;
54 SdXCustomPresentation() throw();
55 SdXCustomPresentation( SdCustomShow
* mpSdCustomShow
, SdXImpressDocument
* pMyModel
) throw();
56 virtual ~SdXCustomPresentation() throw();
59 void Invalidate() { mpSdCustomShow
= NULL
; }
60 SdCustomShow
* GetSdCustomShow() const throw() { return mpSdCustomShow
; }
61 void SetSdCustomShow( SdCustomShow
* pShow
) throw() { mpSdCustomShow
= pShow
; }
62 SdXImpressDocument
* GetModel() const throw() { return mpModel
; }
65 UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation
)
68 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
69 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
70 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
80 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
);
81 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
84 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
) ;
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
);
88 virtual OUString SAL_CALL
getName( ) throw(::com::sun::star::uno::RuntimeException
);
89 virtual void SAL_CALL
setName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
);
92 virtual void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
);
93 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
);
94 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw(::com::sun::star::uno::RuntimeException
);
97 // --------------------------------------------------------------------------
98 #include <com/sun/star/container/XNameContainer.hpp>
99 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
101 #include <cppuhelper/implbase3.hxx>
103 #include "unomodel.hxx"
104 #include "drawdoc.hxx"
108 class SdXCustomPresentationAccess
: public ::cppu::WeakImplHelper3
< ::com::sun::star::container::XNameContainer
,
109 ::com::sun::star::lang::XSingleServiceFactory
,
110 ::com::sun::star::lang::XServiceInfo
>
113 SdXImpressDocument
& mrModel
;
116 inline SdCustomShowList
* GetCustomShowList() const throw();
117 SdCustomShow
* getSdCustomShow( const OUString
& Name
) const throw();
120 SdXCustomPresentationAccess(SdXImpressDocument
& rMyModel
) throw();
121 ~SdXCustomPresentationAccess() throw();
124 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
125 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
126 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
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
);
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
);
141 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw(::com::sun::star::uno::RuntimeException
);
142 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
);
145 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
);
146 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
149 inline SdCustomShowList
* SdXCustomPresentationAccess::GetCustomShowList() const throw()
152 return mrModel
.GetDoc()->GetCustomShowList(sal_False
);
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */