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 #ifndef CHART_TITLEWRAPPER_HXX 24 #define CHART_TITLEWRAPPER_HXX 25 26 #include "WrappedPropertySet.hxx" 27 #include "ReferenceSizePropertyProvider.hxx" 28 #include "Chart2ModelContact.hxx" 29 #include "ServiceMacros.hxx" 30 #include "TitleHelper.hxx" 31 #include <cppuhelper/implbase3.hxx> 32 #include <comphelper/uno3.hxx> 33 #include <cppuhelper/interfacecontainer.hxx> 34 #include <com/sun/star/drawing/XShape.hpp> 35 #include <com/sun/star/lang/XComponent.hpp> 36 #include <com/sun/star/lang/XServiceInfo.hpp> 37 #include <com/sun/star/chart2/XTitle.hpp> 38 #include <com/sun/star/uno/XComponentContext.hpp> 39 40 #include <boost/shared_ptr.hpp> 41 42 namespace chart 43 { 44 namespace wrapper 45 { 46 47 class TitleWrapper : public ::cppu::ImplInheritanceHelper3< 48 WrappedPropertySet 49 , com::sun::star::drawing::XShape 50 , com::sun::star::lang::XComponent 51 , com::sun::star::lang::XServiceInfo 52 > 53 , public ReferenceSizePropertyProvider 54 { 55 public: 56 TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType, 57 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 58 virtual ~TitleWrapper(); 59 60 /// XServiceInfo declarations 61 APPHELPER_XSERVICEINFO_DECL() 62 63 //ReferenceSizePropertyProvider 64 virtual void updateReferenceSize(); 65 virtual ::com::sun::star::uno::Any getReferenceSize(); 66 virtual ::com::sun::star::awt::Size getCurrentSizeForReference(); 67 68 protected: 69 // ____ XShape ____ 70 virtual ::com::sun::star::awt::Point SAL_CALL getPosition() 71 throw (::com::sun::star::uno::RuntimeException); 72 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) 73 throw (::com::sun::star::uno::RuntimeException); 74 virtual ::com::sun::star::awt::Size SAL_CALL getSize() 75 throw (::com::sun::star::uno::RuntimeException); 76 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) 77 throw (::com::sun::star::beans::PropertyVetoException, 78 ::com::sun::star::uno::RuntimeException); 79 80 // ____ XShapeDescriptor (base of XShape) ____ 81 virtual ::rtl::OUString SAL_CALL getShapeType() 82 throw (::com::sun::star::uno::RuntimeException); 83 84 // ____ XComponent ____ 85 virtual void SAL_CALL dispose() 86 throw (::com::sun::star::uno::RuntimeException); 87 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< 88 ::com::sun::star::lang::XEventListener >& xListener ) 89 throw (::com::sun::star::uno::RuntimeException); 90 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< 91 ::com::sun::star::lang::XEventListener >& aListener ) 92 throw (::com::sun::star::uno::RuntimeException); 93 94 // character properties have to be handled differently (via the XFormattedString elements) 95 void getFastCharacterPropertyValue( sal_Int32 nHandle, ::com::sun::star::uno::Any& rValue ); 96 void setFastCharacterPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 97 throw (::com::sun::star::uno::Exception); 98 99 // ____ WrappedPropertySet ____ 100 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 101 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 102 103 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 104 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 105 106 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 107 108 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 109 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 110 111 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet(); 112 113 virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence(); 114 virtual const std::vector< WrappedProperty* > createWrappedProperties(); 115 116 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getFirstCharacterPropertySet(); 117 118 private: 119 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > getTitleObject(); 120 121 private: 122 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 123 ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; 124 125 ::chart::TitleHelper::eTitleType m_eTitleType; 126 }; 127 128 } // namespace wrapper 129 } // namespace chart 130 131 // CHART_TITLEWRAPPER_HXX 132 #endif 133