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_AXISWRAPPER_HXX 24 #define CHART_AXISWRAPPER_HXX 25 26 #include "WrappedPropertySet.hxx" 27 #include "ReferenceSizePropertyProvider.hxx" 28 #include "ServiceMacros.hxx" 29 #include <cppuhelper/implbase5.hxx> 30 #include <comphelper/uno3.hxx> 31 #include <cppuhelper/interfacecontainer.hxx> 32 #include <com/sun/star/chart/XAxis.hpp> 33 #include <com/sun/star/chart2/XAxis.hpp> 34 #include <com/sun/star/frame/XModel.hpp> 35 #include <com/sun/star/drawing/XShape.hpp> 36 #include <com/sun/star/lang/XComponent.hpp> 37 #include <com/sun/star/lang/XServiceInfo.hpp> 38 #include <com/sun/star/uno/XComponentContext.hpp> 39 #include <com/sun/star/util/XNumberFormatsSupplier.hpp> 40 41 #include <boost/shared_ptr.hpp> 42 43 namespace chart 44 { 45 namespace wrapper 46 { 47 class Chart2ModelContact; 48 49 class AxisWrapper : public ::cppu::ImplInheritanceHelper5< 50 WrappedPropertySet 51 , com::sun::star::chart::XAxis 52 , com::sun::star::drawing::XShape 53 , com::sun::star::lang::XComponent 54 , com::sun::star::lang::XServiceInfo 55 , com::sun::star::util::XNumberFormatsSupplier 56 > 57 , public ReferenceSizePropertyProvider 58 { 59 public: 60 enum tAxisType 61 { 62 X_AXIS, 63 Y_AXIS, 64 Z_AXIS, 65 SECOND_X_AXIS, 66 SECOND_Y_AXIS 67 }; 68 69 AxisWrapper( tAxisType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 70 virtual ~AxisWrapper(); 71 72 static void getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, sal_Bool& rbMainAxis ); 73 74 /// XServiceInfo declarations 75 APPHELPER_XSERVICEINFO_DECL() 76 77 //ReferenceSizePropertyProvider 78 virtual void updateReferenceSize(); 79 virtual ::com::sun::star::uno::Any getReferenceSize(); 80 virtual ::com::sun::star::awt::Size getCurrentSizeForReference(); 81 82 // ____ XComponent ____ 83 virtual void SAL_CALL dispose(); 84 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< 85 ::com::sun::star::lang::XEventListener >& xListener ); 86 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< 87 ::com::sun::star::lang::XEventListener >& aListener ); 88 89 // ____ chart::XAxis ____ 90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getAxisTitle( ); 91 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMajorGrid( ); 92 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinorGrid( ); 93 94 // ____ XShape ____ 95 virtual ::com::sun::star::awt::Point SAL_CALL getPosition(); 96 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ); 97 virtual ::com::sun::star::awt::Size SAL_CALL getSize(); 98 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ); 99 100 // ____ XShapeDescriptor (base of XShape) ____ 101 virtual ::rtl::OUString SAL_CALL getShapeType(); 102 103 // ____ XNumberFormatsSupplier ____ 104 virtual ::com::sun::star::uno::Reference< 105 ::com::sun::star::beans::XPropertySet > SAL_CALL getNumberFormatSettings(); 106 virtual ::com::sun::star::uno::Reference< 107 ::com::sun::star::util::XNumberFormats > SAL_CALL getNumberFormats(); 108 109 protected: 110 // ____ WrappedPropertySet ____ 111 virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence(); 112 virtual const std::vector< WrappedProperty* > createWrappedProperties(); 113 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet(); 114 115 private: //methods 116 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > getAxis(); 117 118 private: //member 119 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 120 ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; 121 122 tAxisType m_eType; 123 ::com::sun::star::uno::Any m_aTemporaryHelpStepValue; 124 125 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAxisTitle; 126 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMajorGrid; 127 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMinorGrid; 128 }; 129 130 } // namespace wrapper 131 } // namespace chart 132 133 // CHART_AXISWRAPPER_HXX 134 #endif 135