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