LibreOffice Module sc (master)  1
shapeuno.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 
20 #pragma once
21 
22 #include <com/sun/star/beans/XPropertyState.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/text/XTextContent.hpp>
25 #include <com/sun/star/text/XText.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/document/XEventsSupplier.hpp>
28 #include <com/sun/star/container/XChild.hpp>
29 
30 #include <cppuhelper/implbase.hxx>
31 #include <cppuhelper/implbase1.hxx>
32 
33 namespace com::sun::star {
34  namespace uno {
35  class XAggregation;
36  }
37  namespace drawing {
38  class XShape;
39  }
40 }
41 
42 class SdrObject;
43 struct SvEventDescription;
45 
46 // object which aggregates all svx shape objects,
47 // to add own properties
48 
49 typedef ::cppu::WeakImplHelper < css::beans::XPropertySet
50  , css::beans::XPropertyState
51  , css::text::XTextContent
52  , css::document::XEventsSupplier
53  , css::lang::XServiceInfo
55 typedef ::cppu::ImplHelper1 < css::text::XText
57 typedef ::cppu::ImplHelper1 < css::container::XChild
59 class ScShapeObj final : public ScShapeObj_Base
60  ,public ScShapeObj_TextBase
61  ,public ScShapeObj_ChildBase
62 {
63 private:
64  friend ScMacroInfo* ScShapeObj_getShapeHyperMacroInfo( const ScShapeObj* pShape, bool bCreate );
65  css::uno::Reference< css::uno::XAggregation > mxShapeAgg;
66  // cached pointers to avoid repeated queryAggregation calls:
67  css::beans::XPropertySet* pShapePropertySet;
68  css::beans::XPropertyState* pShapePropertyState;
69  css::uno::Reference< css::beans::XPropertySetInfo > mxPropSetInfo;
72 
73  SdrObject* GetSdrObject() const noexcept;
74 
75  void GetShapePropertySet();
76  void GetShapePropertyState();
77 
79 
80 public:
82 
83  // ctor modifies xShape parameter
84  ScShapeObj( css::uno::Reference<
85  css::drawing::XShape > & xShape );
86  virtual ~ScShapeObj() override;
87 
88  // XInterface
89  virtual css::uno::Any SAL_CALL queryInterface(
90  const css::uno::Type & rType ) override;
91  virtual void SAL_CALL acquire() noexcept override;
92  virtual void SAL_CALL release() noexcept override;
93 
94  // XPropertySet
95  virtual css::uno::Reference< css::beans::XPropertySetInfo >
96  SAL_CALL getPropertySetInfo() override;
97  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
98  const css::uno::Any& aValue ) override;
99  virtual css::uno::Any SAL_CALL getPropertyValue(
100  const OUString& PropertyName ) override;
101  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
102  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
103  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
104  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
105  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
106  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
107  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
108  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
109 
110  // XPropertyState
111  virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
112  virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL
113  getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
114  virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
115  virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
116 
117  // XTextContent
118  virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) override;
119  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
120  getAnchor() override;
121 
122  // XComponent
123  virtual void SAL_CALL dispose() override;
124  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
125  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
126 
127  // XText
128  virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange,
129  const css::uno::Reference< css::text::XTextContent >& xContent,
130  sal_Bool bAbsorb ) override;
131  virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override;
132 
133  // XSimpleText
134  virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
135  createTextCursor() override;
136  virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
137  createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
138  virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange,
139  const OUString& aString, sal_Bool bAbsorb ) override;
140  virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange,
141  sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
142 
143  // XTextRange
144  virtual css::uno::Reference< css::text::XText > SAL_CALL
145  getText() override;
146  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
147  getStart() override;
148  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
149  getEnd() override;
150  virtual OUString SAL_CALL getString() override;
151  virtual void SAL_CALL setString( const OUString& aString ) override;
152 
153  // XChild
154  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override;
155  virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) override;
156 
157  // XTypeProvider
158  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
159  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
160 
161  // XEventsSupplier
162  virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
163 
164  // XServiceInfo
165  virtual OUString SAL_CALL getImplementationName( ) override ;
166  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
167  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
168 };
169 
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: shapeuno.cxx:1209
Type
SdrObject * GetSdrObject() const noexcept
Definition: shapeuno.cxx:1307
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: shapeuno.cxx:1426
css::beans::XPropertyState * pShapePropertyState
Definition: shapeuno.hxx:68
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: shapeuno.cxx:214
signed char sal_Int8
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: shapeuno.cxx:888
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: shapeuno.cxx:1244
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: shapeuno.cxx:931
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: shapeuno.cxx:878
css::uno::Reference< css::beans::XPropertySetInfo > mxPropSetInfo
Definition: shapeuno.hxx:69
virtual OUString SAL_CALL getImplementationName() override
Definition: shapeuno.cxx:1416
css::beans::XPropertySet * pShapePropertySet
Definition: shapeuno.hxx:67
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: shapeuno.cxx:1421
virtual void SAL_CALL dispose() override
Definition: shapeuno.cxx:1040
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &aTextPosition) override
Definition: shapeuno.cxx:1144
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: shapeuno.cxx:868
void GetShapePropertyState()
Definition: shapeuno.cxx:166
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: shapeuno.cxx:1302
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &xParent) override
Definition: shapeuno.cxx:1275
::cppu::ImplHelper1< css::container::XChild > ScShapeObj_ChildBase
Definition: shapeuno.hxx:58
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: shapeuno.cxx:1178
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: shapeuno.cxx:900
#define static
Definition: arraysum.hxx:27
virtual void SAL_CALL acquire() noexcept override
Definition: shapeuno.cxx:142
unsigned char sal_Bool
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: shapeuno.cxx:1166
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: shapeuno.cxx:309
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: shapeuno.cxx:1193
virtual void SAL_CALL setString(const OUString &aString) override
Definition: shapeuno.cxx:1231
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: shapeuno.cxx:996
friend ScMacroInfo * ScShapeObj_getShapeHyperMacroInfo(const ScShapeObj *pShape, bool bCreate)
Definition: shapeuno.cxx:75
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: shapeuno.cxx:1049
::cppu::ImplHelper1< css::text::XText > ScShapeObj_TextBase
Definition: shapeuno.hxx:56
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: shapeuno.cxx:661
css::uno::Reference< css::uno::XAggregation > mxShapeAgg
Definition: shapeuno.hxx:65
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: shapeuno.cxx:1282
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: shapeuno.cxx:126
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: shapeuno.cxx:1114
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: shapeuno.cxx:973
::cppu::WeakImplHelper< css::beans::XPropertySet, css::beans::XPropertyState, css::text::XTextContent, css::document::XEventsSupplier, css::lang::XServiceInfo > ScShapeObj_Base
Definition: shapeuno.hxx:44
virtual OUString SAL_CALL getString() override
Definition: shapeuno.cxx:1220
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: shapeuno.cxx:858
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: shapeuno.cxx:944
virtual void SAL_CALL release() noexcept override
Definition: shapeuno.cxx:147
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: shapeuno.cxx:1003
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
Definition: shapeuno.cxx:1085
bool bIsNoteCaption
Definition: shapeuno.hxx:71
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: shapeuno.cxx:1059
void GetShapePropertySet()
Definition: shapeuno.cxx:152
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: shapeuno.cxx:1411
bool bIsTextShape
Definition: shapeuno.hxx:70
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: shapeuno.cxx:1198
static const SvEventDescription * GetSupportedMacroItems()
Definition: shapeuno.cxx:67
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: shapeuno.cxx:1128