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_DIAGRAMWRAPPER_HXX 24 #define CHART_DIAGRAMWRAPPER_HXX 25 26 #include "WrappedPropertySet.hxx" 27 #include "ServiceMacros.hxx" 28 #include "DiagramHelper.hxx" 29 30 #if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13) 31 #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13 32 #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13 33 #include "comphelper/implbase_var.hxx" 34 #endif 35 36 #include <comphelper/uno3.hxx> 37 #include <cppuhelper/interfacecontainer.hxx> 38 #include <com/sun/star/chart2/XChartDocument.hpp> 39 #include <com/sun/star/chart2/XDiagram.hpp> 40 #include <com/sun/star/uno/XComponentContext.hpp> 41 #include <com/sun/star/chart/XDiagramPositioning.hpp> 42 #include <com/sun/star/chart2/XDiagramProvider.hpp> 43 #include <com/sun/star/chart2/XChartTypeTemplate.hpp> 44 #include <com/sun/star/chart2/XChartTypeManager.hpp> 45 #include <com/sun/star/chart/XDiagram.hpp> 46 #include <com/sun/star/chart/XAxisSupplier.hpp> 47 #include <com/sun/star/chart/XAxisZSupplier.hpp> 48 #include <com/sun/star/chart/XTwoAxisXSupplier.hpp> 49 #include <com/sun/star/chart/XTwoAxisYSupplier.hpp> 50 #include <com/sun/star/chart/XStatisticDisplay.hpp> 51 #include <com/sun/star/chart/X3DDisplay.hpp> 52 #include <com/sun/star/lang/XServiceInfo.hpp> 53 #include <com/sun/star/lang/XComponent.hpp> 54 #include <com/sun/star/lang/XEventListener.hpp> 55 #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> 56 57 #include <com/sun/star/chart/X3DDefaultSetter.hpp> 58 #include <boost/shared_ptr.hpp> 59 60 namespace chart 61 { 62 namespace wrapper 63 { 64 65 class Chart2ModelContact; 66 67 class DiagramWrapper : public ::comphelper::ImplInheritanceHelper13< 68 WrappedPropertySet 69 , ::com::sun::star::chart::XDiagram 70 , ::com::sun::star::chart::XAxisSupplier 71 , ::com::sun::star::chart::XAxisZSupplier 72 , ::com::sun::star::chart::XTwoAxisXSupplier // : XAxisXSupplier 73 , ::com::sun::star::chart::XTwoAxisYSupplier // : XAxisYSupplier 74 , ::com::sun::star::chart::XStatisticDisplay 75 , ::com::sun::star::chart::X3DDisplay 76 , ::com::sun::star::chart::X3DDefaultSetter 77 , ::com::sun::star::lang::XServiceInfo 78 , ::com::sun::star::lang::XComponent 79 // , ::com::sun::star::lang::XEventListener 80 , ::com::sun::star::chart::XDiagramPositioning 81 , ::com::sun::star::chart2::XDiagramProvider 82 , ::com::sun::star::chart::XSecondAxisTitleSupplier 83 > 84 { 85 public: 86 DiagramWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 87 virtual ~DiagramWrapper(); 88 89 /// XServiceInfo declarations 90 APPHELPER_XSERVICEINFO_DECL() 91 92 // ____ XComponent ____ 93 virtual void SAL_CALL dispose() 94 throw (::com::sun::star::uno::RuntimeException); 95 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< 96 ::com::sun::star::lang::XEventListener >& xListener ) 97 throw (::com::sun::star::uno::RuntimeException); 98 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< 99 ::com::sun::star::lang::XEventListener >& aListener ) 100 throw (::com::sun::star::uno::RuntimeException); 101 102 // ____ XDiagram ____ 103 virtual ::rtl::OUString SAL_CALL getDiagramType() 104 throw (::com::sun::star::uno::RuntimeException); 105 virtual ::com::sun::star::uno::Reference< 106 ::com::sun::star::beans::XPropertySet > SAL_CALL getDataRowProperties( sal_Int32 nRow ) 107 throw (::com::sun::star::lang::IndexOutOfBoundsException, 108 ::com::sun::star::uno::RuntimeException); 109 virtual ::com::sun::star::uno::Reference< 110 ::com::sun::star::beans::XPropertySet > SAL_CALL getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow ) 111 throw (::com::sun::star::lang::IndexOutOfBoundsException, 112 ::com::sun::star::uno::RuntimeException); 113 114 // ____ XShape (base of XDiagram) ____ 115 virtual ::com::sun::star::awt::Point SAL_CALL getPosition() 116 throw (::com::sun::star::uno::RuntimeException); 117 virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) 118 throw (::com::sun::star::uno::RuntimeException); 119 virtual ::com::sun::star::awt::Size SAL_CALL getSize() 120 throw (::com::sun::star::uno::RuntimeException); 121 virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) 122 throw (::com::sun::star::beans::PropertyVetoException, 123 ::com::sun::star::uno::RuntimeException); 124 125 // ____ XShapeDescriptor (base of XShape) ____ 126 virtual ::rtl::OUString SAL_CALL getShapeType() 127 throw (::com::sun::star::uno::RuntimeException); 128 129 // ____ XAxisSupplier ____ 130 virtual ::com::sun::star::uno::Reference< 131 ::com::sun::star::chart::XAxis > SAL_CALL getAxis( sal_Int32 nDimensionIndex ) 132 throw (::com::sun::star::uno::RuntimeException); 133 virtual ::com::sun::star::uno::Reference< 134 ::com::sun::star::chart::XAxis > SAL_CALL getSecondaryAxis( sal_Int32 nDimensionIndex ) 135 throw (::com::sun::star::uno::RuntimeException); 136 137 // ____ XAxisZSupplier ____ 138 virtual ::com::sun::star::uno::Reference< 139 ::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle() 140 throw (::com::sun::star::uno::RuntimeException); 141 virtual ::com::sun::star::uno::Reference< 142 ::com::sun::star::beans::XPropertySet > SAL_CALL getZMainGrid() 143 throw (::com::sun::star::uno::RuntimeException); 144 virtual ::com::sun::star::uno::Reference< 145 ::com::sun::star::beans::XPropertySet > SAL_CALL getZHelpGrid() 146 throw (::com::sun::star::uno::RuntimeException); 147 virtual ::com::sun::star::uno::Reference< 148 ::com::sun::star::beans::XPropertySet > SAL_CALL getZAxis() 149 throw (::com::sun::star::uno::RuntimeException); 150 151 // ____ XTwoAxisXSupplier ____ 152 virtual ::com::sun::star::uno::Reference< 153 ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryXAxis() 154 throw (::com::sun::star::uno::RuntimeException); 155 156 // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____ 157 virtual ::com::sun::star::uno::Reference< 158 ::com::sun::star::drawing::XShape > SAL_CALL getXAxisTitle() 159 throw (::com::sun::star::uno::RuntimeException); 160 virtual ::com::sun::star::uno::Reference< 161 ::com::sun::star::beans::XPropertySet > SAL_CALL getXAxis() 162 throw (::com::sun::star::uno::RuntimeException); 163 virtual ::com::sun::star::uno::Reference< 164 ::com::sun::star::beans::XPropertySet > SAL_CALL getXMainGrid() 165 throw (::com::sun::star::uno::RuntimeException); 166 virtual ::com::sun::star::uno::Reference< 167 ::com::sun::star::beans::XPropertySet > SAL_CALL getXHelpGrid() 168 throw (::com::sun::star::uno::RuntimeException); 169 170 // ____ XTwoAxisYSupplier ____ 171 virtual ::com::sun::star::uno::Reference< 172 ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryYAxis() 173 throw (::com::sun::star::uno::RuntimeException); 174 175 // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____ 176 virtual ::com::sun::star::uno::Reference< 177 ::com::sun::star::drawing::XShape > SAL_CALL getYAxisTitle() 178 throw (::com::sun::star::uno::RuntimeException); 179 virtual ::com::sun::star::uno::Reference< 180 ::com::sun::star::beans::XPropertySet > SAL_CALL getYAxis() 181 throw (::com::sun::star::uno::RuntimeException); 182 virtual ::com::sun::star::uno::Reference< 183 ::com::sun::star::beans::XPropertySet > SAL_CALL getYHelpGrid() 184 throw (::com::sun::star::uno::RuntimeException); 185 virtual ::com::sun::star::uno::Reference< 186 ::com::sun::star::beans::XPropertySet > SAL_CALL getYMainGrid() 187 throw (::com::sun::star::uno::RuntimeException); 188 189 // ____ XSecondAxisTitleSupplier ____ 190 virtual ::com::sun::star::uno::Reference< 191 ::com::sun::star::drawing::XShape > SAL_CALL getSecondXAxisTitle() 192 throw (::com::sun::star::uno::RuntimeException); 193 virtual ::com::sun::star::uno::Reference< 194 ::com::sun::star::drawing::XShape > SAL_CALL getSecondYAxisTitle() 195 throw (::com::sun::star::uno::RuntimeException); 196 197 // ____ XStatisticDisplay ____ 198 virtual ::com::sun::star::uno::Reference< 199 ::com::sun::star::beans::XPropertySet > SAL_CALL getUpBar() 200 throw (::com::sun::star::uno::RuntimeException); 201 virtual ::com::sun::star::uno::Reference< 202 ::com::sun::star::beans::XPropertySet > SAL_CALL getDownBar() 203 throw (::com::sun::star::uno::RuntimeException); 204 virtual ::com::sun::star::uno::Reference< 205 ::com::sun::star::beans::XPropertySet > SAL_CALL getMinMaxLine() 206 throw (::com::sun::star::uno::RuntimeException); 207 208 // ____ X3DDisplay ____ 209 virtual ::com::sun::star::uno::Reference< 210 ::com::sun::star::beans::XPropertySet > SAL_CALL getWall() 211 throw (::com::sun::star::uno::RuntimeException); 212 virtual ::com::sun::star::uno::Reference< 213 ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor() 214 throw (::com::sun::star::uno::RuntimeException); 215 216 // ____ X3DDefaultSetter ____ 217 virtual void SAL_CALL set3DSettingsToDefault() throw (::com::sun::star::uno::RuntimeException); 218 virtual void SAL_CALL setDefaultRotation() throw (::com::sun::star::uno::RuntimeException); 219 virtual void SAL_CALL setDefaultIllumination() throw (::com::sun::star::uno::RuntimeException); 220 221 // // ____ XEventListener ____ 222 // virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 223 // throw (::com::sun::star::uno::RuntimeException); 224 225 // ____ XDiagramPositioning ____ 226 227 virtual void SAL_CALL setAutomaticDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException); 228 virtual ::sal_Bool SAL_CALL isAutomaticDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException); 229 virtual void SAL_CALL setDiagramPositionExcludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException); 230 virtual ::sal_Bool SAL_CALL isExcludingDiagramPositioning( ) throw (::com::sun::star::uno::RuntimeException); 231 virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionExcludingAxes( ) throw (::com::sun::star::uno::RuntimeException); 232 virtual void SAL_CALL setDiagramPositionIncludingAxes( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException); 233 virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxes( ) throw (::com::sun::star::uno::RuntimeException); 234 virtual void SAL_CALL setDiagramPositionIncludingAxesAndAxisTitles( const ::com::sun::star::awt::Rectangle& PositionRect ) throw (::com::sun::star::uno::RuntimeException); 235 virtual ::com::sun::star::awt::Rectangle SAL_CALL calculateDiagramPositionIncludingAxesAndAxisTitles( ) throw (::com::sun::star::uno::RuntimeException); 236 237 // ____ XDiagramProvider ____ 238 virtual ::com::sun::star::uno::Reference< 239 ::com::sun::star::chart2::XDiagram > SAL_CALL getDiagram() 240 throw (::com::sun::star::uno::RuntimeException); 241 virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference< 242 ::com::sun::star::chart2::XDiagram >& xDiagram ) 243 throw (::com::sun::star::uno::RuntimeException); 244 245 protected: 246 // ____ WrappedPropertySet ____ 247 virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence(); 248 virtual const std::vector< WrappedProperty* > createWrappedProperties(); 249 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet(); 250 251 private: 252 void updateFromModel(); 253 254 ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 255 ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; 256 257 ::com::sun::star::uno::Reference< 258 ::com::sun::star::chart::XAxis > m_xXAxis; 259 ::com::sun::star::uno::Reference< 260 ::com::sun::star::chart::XAxis > m_xYAxis; 261 ::com::sun::star::uno::Reference< 262 ::com::sun::star::chart::XAxis > m_xZAxis; 263 ::com::sun::star::uno::Reference< 264 ::com::sun::star::chart::XAxis > m_xSecondXAxis; 265 ::com::sun::star::uno::Reference< 266 ::com::sun::star::chart::XAxis > m_xSecondYAxis; 267 268 ::com::sun::star::uno::Reference< 269 ::com::sun::star::beans::XPropertySet > m_xWall; 270 ::com::sun::star::uno::Reference< 271 ::com::sun::star::beans::XPropertySet > m_xFloor; 272 273 ::com::sun::star::uno::Reference< 274 ::com::sun::star::beans::XPropertySet > m_xMinMaxLineWrapper; 275 ::com::sun::star::uno::Reference< 276 ::com::sun::star::beans::XPropertySet > m_xUpBarWrapper; 277 ::com::sun::star::uno::Reference< 278 ::com::sun::star::beans::XPropertySet > m_xDownBarWrapper; 279 }; 280 281 } // namespace wrapper 282 } // namespace chart 283 284 // CHART_DIAGRAMWRAPPER_HXX 285 #endif 286