LibreOffice Module sd (master) 1
unolayer.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/drawing/XLayer.hpp>
22#include <com/sun/star/drawing/XLayerManager.hpp>
23
26#include <rtl/ref.hxx>
27
28#include <unomodel.hxx>
29
30class SdrLayer;
31class SdLayerManager;
33
34namespace sd {
35class View;
36}
38
39/***********************************************************************
40* *
41***********************************************************************/
42class SdLayer : public ::cppu::WeakImplHelper< css::drawing::XLayer,
43 css::lang::XServiceInfo,
44 css::container::XChild,
45 css::lang::XComponent >
46{
47public:
48 SdLayer(SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_);
49 virtual ~SdLayer() noexcept override;
50
51 // internal
52 SdrLayer* GetSdrLayer() const noexcept { return pLayer; }
53
54 // XServiceInfo
55 virtual OUString SAL_CALL getImplementationName() override;
56 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
57 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
58
59 // css::beans::XPropertySet
60 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
61 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
62 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
63 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
64 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
65 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
66 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
67
68 // css::container::XChild
69
72 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
73
74 // XComponent
75 virtual void SAL_CALL dispose( ) override;
76 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
77 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
78
82 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
83
84private:
88
89 bool get( LayerAttribute what ) noexcept;
90 void set( LayerAttribute what, bool flag ) noexcept;
91
92};
93
94/***********************************************************************
95* *
96***********************************************************************/
97
98class SdLayerManager : public ::cppu::WeakImplHelper< css::drawing::XLayerManager,
99 css::container::XNameAccess,
100 css::lang::XServiceInfo,
101 css::lang::XComponent >
102{
103 friend class SdLayer;
104
105public:
106 explicit SdLayerManager( SdXImpressDocument& rMyModel ) noexcept;
107 virtual ~SdLayerManager() noexcept override;
108
109 // XServiceInfo
110 virtual OUString SAL_CALL getImplementationName() override;
111 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
112 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
113
114 // XLayerManager
115 virtual css::uno::Reference< css::drawing::XLayer > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) override;
116 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XLayer >& xLayer ) override;
117 virtual void SAL_CALL attachShapeToLayer( const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XLayer >& xLayer ) override;
118 virtual css::uno::Reference< css::drawing::XLayer > SAL_CALL getLayerForShape( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
119
120 // XIndexAccess
121 virtual sal_Int32 SAL_CALL getCount() override ;
122 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) 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
145 css::uno::Reference< css::drawing::XLayer> GetLayer (SdrLayer* pLayer);
146
147 // XComponent
148 virtual void SAL_CALL dispose( ) override;
149 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
150 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
151
152private:
155
156 ::sd::View* GetView() const noexcept;
157 ::sd::DrawDocShell* GetDocShell() const noexcept { return mpModel->mpDocShell; }
158 void UpdateLayerView() const noexcept;
159};
160
161/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
SdXImpressDocument * mpModel
Definition: unolayer.hxx:153
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unolayer.cxx:390
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unolayer.cxx:567
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unolayer.cxx:395
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: unolayer.cxx:530
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unolayer.cxx:406
SdLayerManager(SdXImpressDocument &rMyModel) noexcept
Definition: unolayer.cxx:368
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XLayer > &xLayer) override
Definition: unolayer.cxx:449
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unolayer.cxx:411
virtual sal_Bool SAL_CALL hasElements() override
Definition: unolayer.cxx:609
std::unique_ptr< SvUnoWeakContainer > mpLayers
Definition: unolayer.hxx:154
virtual css::uno::Reference< css::drawing::XLayer > SAL_CALL getLayerForShape(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: unolayer.cxx:491
virtual css::uno::Reference< css::drawing::XLayer > SAL_CALL insertNewByIndex(sal_Int32 nIndex) override
Definition: unolayer.cxx:417
::sd::DrawDocShell * GetDocShell() const noexcept
Definition: unolayer.hxx:157
virtual void SAL_CALL dispose() override
Definition: unolayer.cxx:380
virtual void SAL_CALL attachShapeToLayer(const css::uno::Reference< css::drawing::XShape > &xShape, const css::uno::Reference< css::drawing::XLayer > &xLayer) override
Definition: unolayer.cxx:469
css::uno::Reference< css::drawing::XLayer > GetLayer(SdrLayer *pLayer)
Return the <type>XLayer</type> object that is associated with the given <type>SdrLayer</type> object.
Definition: unolayer.cxx:680
virtual ~SdLayerManager() noexcept override
Definition: unolayer.cxx:374
void UpdateLayerView() const noexcept
If something was changed at the layers, this methods takes care that the changes are made visible in ...
Definition: unolayer.cxx:618
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: unolayer.cxx:552
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unolayer.cxx:604
::sd::View * GetView() const noexcept
Definition: unolayer.cxx:636
virtual OUString SAL_CALL getImplementationName() override
Definition: unolayer.cxx:401
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: unolayer.cxx:591
virtual sal_Int32 SAL_CALL getCount() override
Definition: unolayer.cxx:514
bool get(LayerAttribute what) noexcept
Definition: unolayer.cxx:228
rtl::Reference< SdLayerManager > mxLayerManager
Definition: unolayer.hxx:85
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Not implemented.
Definition: unolayer.cxx:345
SdrLayer * pLayer
Definition: unolayer.hxx:86
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unolayer.cxx:224
virtual OUString SAL_CALL getImplementationName() override
Definition: unolayer.cxx:92
void set(LayerAttribute what, bool flag) noexcept
Definition: unolayer.cxx:274
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unolayer.cxx:182
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unolayer.cxx:223
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Returns the layer manager that manages this layer.
Definition: unolayer.cxx:335
virtual void SAL_CALL dispose() override
Definition: unolayer.cxx:351
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unolayer.cxx:225
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unolayer.cxx:108
SdrLayer * GetSdrLayer() const noexcept
Definition: unolayer.hxx:52
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unolayer.cxx:97
virtual ~SdLayer() noexcept override
Definition: unolayer.cxx:87
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unolayer.cxx:114
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unolayer.cxx:362
const SvxItemPropertySet * pPropSet
Definition: unolayer.hxx:87
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unolayer.cxx:357
SdLayer(SdLayerManager *pLayerManager_, SdrLayer *pSdrLayer_)
Definition: unolayer.cxx:77
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unolayer.cxx:102
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unolayer.cxx:226
::sd::DrawDocShell * mpDocShell
Definition: unomodel.hxx:86
Type
unsigned char sal_Bool
LayerAttribute
Definition: unolayer.hxx:37
@ LOCKED
Definition: unolayer.hxx:37
@ VISIBLE
Definition: unolayer.hxx:37
@ PRINTABLE
Definition: unolayer.hxx:37