1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_SHAPEUNO_HXX 25 #define SC_SHAPEUNO_HXX 26 27 #include <tools/solar.h> 28 #include <com/sun/star/beans/XPropertyState.hpp> 29 #include <com/sun/star/beans/XPropertySet.hpp> 30 #include <com/sun/star/text/XTextContent.hpp> 31 #include <com/sun/star/text/XText.hpp> 32 #include <com/sun/star/lang/XTypeProvider.hpp> 33 #include <com/sun/star/lang/XServiceInfo.hpp> 34 #include <com/sun/star/document/XEventsSupplier.hpp> 35 #include <com/sun/star/container/XChild.hpp> 36 37 #include <cppuhelper/implbase5.hxx> 38 #include <cppuhelper/implbase1.hxx> 39 40 namespace com { namespace sun { namespace star { 41 namespace uno { 42 class XAggregation; 43 } 44 namespace drawing { 45 class XShape; 46 } 47 }}} 48 49 class SdrObject; 50 struct SvEventDescription; 51 class ShapeUnoEventAccessImpl; 52 53 //------------------------------------------------------------------------ 54 55 // object which aggregates all svx shape objects, 56 // to add own properties 57 58 typedef ::cppu::WeakImplHelper5 < ::com::sun::star::beans::XPropertySet 59 , ::com::sun::star::beans::XPropertyState 60 , ::com::sun::star::text::XTextContent 61 , ::com::sun::star::document::XEventsSupplier 62 , ::com::sun::star::lang::XServiceInfo 63 > ScShapeObj_Base; 64 typedef ::cppu::ImplHelper1 < ::com::sun::star::text::XText 65 > ScShapeObj_TextBase; 66 typedef ::cppu::ImplHelper1 < ::com::sun::star::container::XChild 67 > ScShapeObj_ChildBase; 68 class ScShapeObj :public ScShapeObj_Base 69 ,public ScShapeObj_TextBase 70 ,public ScShapeObj_ChildBase 71 { 72 private: 73 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg; 74 // cached pointers to avoid repeated queryAggregation calls: 75 ::com::sun::star::beans::XPropertySet* pShapePropertySet; 76 ::com::sun::star::beans::XPropertyState* pShapePropertyState; 77 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > mxPropSetInfo; 78 com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId; 79 bool bIsTextShape; 80 bool bIsNoteCaption; 81 bool bInitializedNotifier; 82 83 SdrObject* GetSdrObject() const throw(); 84 85 void GetShapePropertySet(); 86 void GetShapePropertyState(); 87 88 friend class ShapeUnoEventAccessImpl; 89 90 public: 91 static const SvEventDescription* GetSupportedMacroItems(); 92 93 // ctor modifies xShape parameter 94 ScShapeObj( ::com::sun::star::uno::Reference< 95 ::com::sun::star::drawing::XShape > & xShape ); 96 virtual ~ScShapeObj(); 97 98 // XInterface 99 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 100 const ::com::sun::star::uno::Type & rType ); 101 virtual void SAL_CALL acquire() throw(); 102 virtual void SAL_CALL release() throw(); 103 104 // XPropertySet 105 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > 106 SAL_CALL getPropertySetInfo(); 107 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, 108 const ::com::sun::star::uno::Any& aValue ); 109 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 110 const ::rtl::OUString& PropertyName ); 111 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, 112 const ::com::sun::star::uno::Reference< 113 ::com::sun::star::beans::XPropertyChangeListener >& xListener ); 114 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, 115 const ::com::sun::star::uno::Reference< 116 ::com::sun::star::beans::XPropertyChangeListener >& aListener ); 117 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, 118 const ::com::sun::star::uno::Reference< 119 ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 120 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, 121 const ::com::sun::star::uno::Reference< 122 ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 123 124 // XPropertyState 125 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( 126 const ::rtl::OUString& PropertyName ); 127 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL 128 getPropertyStates( const ::com::sun::star::uno::Sequence< 129 ::rtl::OUString >& aPropertyName ); 130 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ); 131 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( 132 const ::rtl::OUString& aPropertyName ); 133 134 // XTextContent 135 virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< 136 ::com::sun::star::text::XTextRange > & xTextRange); 137 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 138 getAnchor(void); 139 140 // XComponent 141 virtual void SAL_CALL dispose(void); 142 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< 143 ::com::sun::star::lang::XEventListener > & aListener); 144 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< 145 ::com::sun::star::lang::XEventListener > & aListener); 146 147 // XText 148 virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< 149 ::com::sun::star::text::XTextRange >& xRange, 150 const ::com::sun::star::uno::Reference< 151 ::com::sun::star::text::XTextContent >& xContent, 152 sal_Bool bAbsorb ); 153 virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< 154 ::com::sun::star::text::XTextContent >& xContent ); 155 156 // XSimpleText 157 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL 158 createTextCursor(); 159 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL 160 createTextCursorByRange( const ::com::sun::star::uno::Reference< 161 ::com::sun::star::text::XTextRange >& aTextPosition ); 162 virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< 163 ::com::sun::star::text::XTextRange >& xRange, 164 const ::rtl::OUString& aString, sal_Bool bAbsorb ); 165 virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< 166 ::com::sun::star::text::XTextRange >& xRange, 167 sal_Int16 nControlCharacter, sal_Bool bAbsorb ); 168 169 // XTextRange 170 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 171 getText(); 172 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 173 getStart(); 174 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 175 getEnd(); 176 virtual ::rtl::OUString SAL_CALL getString(); 177 virtual void SAL_CALL setString( const ::rtl::OUString& aString ); 178 179 // XChild 180 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(); 181 virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent ); 182 183 // XTypeProvider 184 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(); 185 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(); 186 187 // XEventsSupplier 188 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents(); 189 190 // XServiceInfo 191 virtual ::rtl::OUString SAL_CALL getImplementationName( ) ; 192 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 193 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ); 194 }; 195 196 #endif 197