LibreOffice Module sd (master) 1
unocpres.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <com/sun/star/lang/XComponent.hpp>
22#include <com/sun/star/container/XIndexContainer.hpp>
23#include <com/sun/star/container/XNamed.hpp>
24#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <osl/mutex.hxx>
27
30#include <com/sun/star/container/XNameContainer.hpp>
31#include <com/sun/star/lang/XSingleServiceFactory.hpp>
32
33#include <unomodel.hxx>
34#include <drawdoc.hxx>
35
36
37class SdCustomShow;
38
39class SdXCustomPresentation : public ::cppu::WeakImplHelper< css::container::XIndexContainer,
40 css::container::XNamed,
41 css::lang::XComponent,
42 css::lang::XServiceInfo >
43{
44private:
47
48 // for xComponent
52
53public:
54 SdXCustomPresentation() noexcept;
56 virtual ~SdXCustomPresentation() noexcept override;
57
58 // internal
59 SdCustomShow* GetSdCustomShow() const noexcept { return mpSdCustomShow; }
60 void SetSdCustomShow( SdCustomShow* pShow ) noexcept { mpSdCustomShow = pShow; }
61 SdXImpressDocument* GetModel() const noexcept { return mpModel; }
62
63 // XServiceInfo
64 virtual OUString SAL_CALL getImplementationName() override;
65 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
66 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
67
68 // XIndexContainer
69 virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
70 virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override;
71
72 // XIndexReplace
73 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
74
75 // XElementAccess
76 virtual css::uno::Type SAL_CALL getElementType() override;
77 virtual sal_Bool SAL_CALL hasElements() override;
78
79 // XIndexAccess
80 virtual sal_Int32 SAL_CALL getCount() override ;
81 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
82
83 // XNamed
84 virtual OUString SAL_CALL getName( ) override;
85 virtual void SAL_CALL setName( const OUString& aName ) override;
86
87 // XComponent
88 virtual void SAL_CALL dispose( ) override;
89 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
90 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
91};
92
93class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper< css::container::XNameContainer,
94 css::lang::XSingleServiceFactory,
95 css::lang::XServiceInfo >
96{
97private:
99
100 // internal
101 inline SdCustomShowList* GetCustomShowList() const noexcept;
102 SdCustomShow * getSdCustomShow( std::u16string_view Name ) const noexcept;
103
104public:
105 explicit SdXCustomPresentationAccess(SdXImpressDocument& rMyModel) noexcept;
106 virtual ~SdXCustomPresentationAccess() noexcept override;
107
108 // XServiceInfo
109 virtual OUString SAL_CALL getImplementationName() override;
110 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
111 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
112
113 // XSingleServiceFactory
114 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ) override;
115 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
116
117 // XNameContainer
118 virtual void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override;
119 virtual void SAL_CALL removeByName( const OUString& Name ) override;
120
121 // XNameReplace
122 virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
123
124 // XNameAccess
125 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
126 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
127 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
128
129 // XElementAccess
130 virtual css::uno::Type SAL_CALL getElementType() override;
131 virtual sal_Bool SAL_CALL hasElements() override;
132};
133
135{
136 if(mrModel.GetDoc())
137 return mrModel.GetDoc()->GetCustomShowList();
138 else
139 return nullptr;
140};
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
SdCustomShowList * GetCustomShowList(bool bCreate=false)
Definition: drawdoc3.cxx:1161
SdCustomShow * getSdCustomShow(std::u16string_view Name) const noexcept
Definition: unocpres.cxx:434
SdXImpressDocument & mrModel
Definition: unocpres.hxx:98
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: unocpres.cxx:379
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: unocpres.cxx:356
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocpres.cxx:285
virtual OUString SAL_CALL getImplementationName() override
Definition: unocpres.cxx:275
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: unocpres.cxx:303
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocpres.cxx:421
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unocpres.cxx:393
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocpres.cxx:426
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: unocpres.cxx:372
SdCustomShowList * GetCustomShowList() const noexcept
Definition: unocpres.hxx:134
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: unocpres.cxx:414
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: unocpres.cxx:297
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocpres.cxx:280
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance() override
Definition: unocpres.cxx:291
virtual void SAL_CALL dispose() override
Definition: unocpres.cxx:223
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > aDisposeListeners
Definition: unocpres.hxx:50
virtual OUString SAL_CALL getImplementationName() override
Definition: unocpres.cxx:61
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unocpres.cxx:150
SdXImpressDocument * GetModel() const noexcept
Definition: unocpres.hxx:61
SdXImpressDocument * mpModel
Definition: unocpres.hxx:46
SdCustomShow * mpSdCustomShow
Definition: unocpres.hxx:45
virtual void SAL_CALL setName(const OUString &aName) override
Definition: unocpres.cxx:211
virtual sal_Bool SAL_CALL hasElements() override
Definition: unocpres.cxx:155
virtual OUString SAL_CALL getName() override
Definition: unocpres.cxx:198
virtual void SAL_CALL removeByIndex(sal_Int32 Index) override
Definition: unocpres.cxx:111
SdCustomShow * GetSdCustomShow() const noexcept
Definition: unocpres.hxx:59
void SetSdCustomShow(SdCustomShow *pShow) noexcept
Definition: unocpres.hxx:60
std::mutex aDisposeContainerMutex
Definition: unocpres.hxx:49
SdXCustomPresentation() noexcept
Definition: unocpres.cxx:44
virtual sal_Int32 SAL_CALL getCount() override
Definition: unocpres.cxx:166
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: unocpres.cxx:175
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unocpres.cxx:242
virtual void SAL_CALL replaceByIndex(sal_Int32 Index, const css::uno::Any &Element) override
Definition: unocpres.cxx:143
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unocpres.cxx:71
virtual void SAL_CALL insertByIndex(sal_Int32 Index, const css::uno::Any &Element) override
Definition: unocpres.cxx:77
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unocpres.cxx:251
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unocpres.cxx:66
SdDrawDocument * GetDoc() const
Definition: unomodel.hxx:141
Type
unsigned char sal_Bool