1de7b3f82SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3de7b3f82SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4de7b3f82SAndrew Rist * or more contributor license agreements. See the NOTICE file 5de7b3f82SAndrew Rist * distributed with this work for additional information 6de7b3f82SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7de7b3f82SAndrew Rist * to you under the Apache License, Version 2.0 (the 8de7b3f82SAndrew Rist * "License"); you may not use this file except in compliance 9de7b3f82SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11de7b3f82SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13de7b3f82SAndrew Rist * Unless required by applicable law or agreed to in writing, 14de7b3f82SAndrew Rist * software distributed under the License is distributed on an 15de7b3f82SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16de7b3f82SAndrew Rist * KIND, either express or implied. See the License for the 17de7b3f82SAndrew Rist * specific language governing permissions and limitations 18de7b3f82SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20de7b3f82SAndrew Rist *************************************************************/ 21de7b3f82SAndrew Rist 22de7b3f82SAndrew Rist 23*376a13c5Smseidel 24cdf0e10cSrcweir #ifndef CHART_CHART2MODELCONTACT_HXX 25cdf0e10cSrcweir #define CHART_CHART2MODELCONTACT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <chartview/ExplicitScaleValues.hxx> 28cdf0e10cSrcweir #include <com/sun/star/chart2/XAxis.hpp> 29cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp> 30cdf0e10cSrcweir #include <com/sun/star/chart2/XDataSeries.hpp> 31cdf0e10cSrcweir #include <com/sun/star/chart2/XDiagram.hpp> 32cdf0e10cSrcweir #include <com/sun/star/chart2/XTitle.hpp> 33cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 34cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp> 35cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 36cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp> 37cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 38cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 39cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <map> 42cdf0e10cSrcweir 43cdf0e10cSrcweir namespace chart 44cdf0e10cSrcweir { 45cdf0e10cSrcweir class ExplicitValueProvider; 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace wrapper 48cdf0e10cSrcweir { 49cdf0e10cSrcweir 50cdf0e10cSrcweir class Chart2ModelContact 51cdf0e10cSrcweir { 52cdf0e10cSrcweir public: 53cdf0e10cSrcweir Chart2ModelContact( const ::com::sun::star::uno::Reference< 54cdf0e10cSrcweir ::com::sun::star::uno::XComponentContext >& xContext ); 55cdf0e10cSrcweir virtual ~Chart2ModelContact(); 56cdf0e10cSrcweir 57cdf0e10cSrcweir public: 58cdf0e10cSrcweir void setModel( const ::com::sun::star::uno::Reference< 59cdf0e10cSrcweir ::com::sun::star::frame::XModel >& xChartModel ); 60cdf0e10cSrcweir void clear(); 61cdf0e10cSrcweir 62cdf0e10cSrcweir ::com::sun::star::uno::Reference< 63cdf0e10cSrcweir ::com::sun::star::frame::XModel > getChartModel() const; 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::com::sun::star::uno::Reference< 66cdf0e10cSrcweir ::com::sun::star::chart2::XChartDocument > getChart2Document() const; 67cdf0e10cSrcweir ::com::sun::star::uno::Reference< 68cdf0e10cSrcweir ::com::sun::star::chart2::XDiagram > getChart2Diagram() const; 69cdf0e10cSrcweir 70cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getDrawPage(); 71cdf0e10cSrcweir 72*376a13c5Smseidel /** Get the current values calculated for an axis in the current view in 73cdf0e10cSrcweir case properties are 'auto'. 74cdf0e10cSrcweir */ 75cdf0e10cSrcweir sal_Bool getExplicitValuesForAxis( 76cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 77cdf0e10cSrcweir ::com::sun::star::chart2::XAxis > & xAxis, 78cdf0e10cSrcweir ExplicitScaleData & rOutExplicitScale, 79cdf0e10cSrcweir ExplicitIncrementData & rOutExplicitIncrement ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir sal_Int32 getExplicitNumberFormatKeyForAxis( 82cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); 83cdf0e10cSrcweir 84cdf0e10cSrcweir sal_Int32 getExplicitNumberFormatKeyForSeries( 85cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries ); 86cdf0e10cSrcweir 87cdf0e10cSrcweir /** Returns the size of the page in logic coordinates. This value is used 88cdf0e10cSrcweir for setting an appropriate "ReferencePageSize" for FontHeights. 89cdf0e10cSrcweir */ 90cdf0e10cSrcweir ::com::sun::star::awt::Size GetPageSize() const; 91cdf0e10cSrcweir 92*376a13c5Smseidel /** Calculates the current axes title sizes and subtract that space them from the given rectangle. 93cdf0e10cSrcweir */ 94cdf0e10cSrcweir ::com::sun::star::awt::Rectangle SubstractAxisTitleSizes( const ::com::sun::star::awt::Rectangle& rPositionRect ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir /** Returns the position and size of the diagram in logic coordinates (100th mm) including 97cdf0e10cSrcweir the space used for axes including axes titles. 98cdf0e10cSrcweir */ 99cdf0e10cSrcweir ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingTitle() const; 100cdf0e10cSrcweir 101cdf0e10cSrcweir /** Returns the position and size of the diagram in logic coordinates (100th mm) including 102cdf0e10cSrcweir the space used for axes excluding axes titles. 103cdf0e10cSrcweir */ 104cdf0e10cSrcweir ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingAxes() const; 105cdf0e10cSrcweir 106cdf0e10cSrcweir /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding 107cdf0e10cSrcweir the space used for axes (inner plot area). 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir ::com::sun::star::awt::Rectangle GetDiagramRectangleExcludingAxes() const; 110cdf0e10cSrcweir 111cdf0e10cSrcweir /** Returns the size of the object in logic coordinates. 112cdf0e10cSrcweir */ 113cdf0e10cSrcweir ::com::sun::star::awt::Size GetLegendSize() const; 114cdf0e10cSrcweir 115cdf0e10cSrcweir /** Returns the position of the object in logic coordinates. 116cdf0e10cSrcweir */ 117cdf0e10cSrcweir ::com::sun::star::awt::Point GetLegendPosition() const; 118cdf0e10cSrcweir 119cdf0e10cSrcweir /** Returns the size of the object in logic coordinates. 120cdf0e10cSrcweir */ 121cdf0e10cSrcweir ::com::sun::star::awt::Size GetTitleSize( const ::com::sun::star::uno::Reference< 122cdf0e10cSrcweir ::com::sun::star::chart2::XTitle > & xTitle ) const; 123cdf0e10cSrcweir 124cdf0e10cSrcweir /** Returns the position of the object in logic coordinates. 125cdf0e10cSrcweir */ 126cdf0e10cSrcweir ::com::sun::star::awt::Point GetTitlePosition( const ::com::sun::star::uno::Reference< 127cdf0e10cSrcweir ::com::sun::star::chart2::XTitle > & xTitle ) const; 128cdf0e10cSrcweir 129cdf0e10cSrcweir 130cdf0e10cSrcweir /** Returns the size of the object in logic coordinates. 131cdf0e10cSrcweir */ 132cdf0e10cSrcweir ::com::sun::star::awt::Size GetAxisSize( const ::com::sun::star::uno::Reference< 133cdf0e10cSrcweir ::com::sun::star::chart2::XAxis > & xAxis ) const; 134cdf0e10cSrcweir 135cdf0e10cSrcweir /** Returns the position of the object in logic coordinates. 136cdf0e10cSrcweir */ 137cdf0e10cSrcweir ::com::sun::star::awt::Point GetAxisPosition( const ::com::sun::star::uno::Reference< 138cdf0e10cSrcweir ::com::sun::star::chart2::XAxis > & xAxis ) const; 139cdf0e10cSrcweir 140cdf0e10cSrcweir private: // methods 141cdf0e10cSrcweir ExplicitValueProvider* getExplicitValueProvider() const; 142cdf0e10cSrcweir ::com::sun::star::uno::Reference< 143cdf0e10cSrcweir ::com::sun::star::lang::XUnoTunnel > getChartView() const; 144cdf0e10cSrcweir 145cdf0e10cSrcweir public: // member 146cdf0e10cSrcweir ::com::sun::star::uno::Reference< 147cdf0e10cSrcweir ::com::sun::star::uno::XComponentContext > 148cdf0e10cSrcweir m_xContext; 149cdf0e10cSrcweir 150cdf0e10cSrcweir private: // member 151cdf0e10cSrcweir ::com::sun::star::uno::WeakReference< 152cdf0e10cSrcweir ::com::sun::star::frame::XModel > m_xChartModel; 153cdf0e10cSrcweir 154cdf0e10cSrcweir mutable ::com::sun::star::uno::Reference< 155cdf0e10cSrcweir ::com::sun::star::lang::XUnoTunnel > m_xChartView; 156cdf0e10cSrcweir 157*376a13c5Smseidel typedef std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > > tTableMap;// GradientTable, HatchTable, etc. 158cdf0e10cSrcweir tTableMap m_aTableMap; 159cdf0e10cSrcweir }; 160cdf0e10cSrcweir 161cdf0e10cSrcweir } // namespace wrapper 162cdf0e10cSrcweir } // namespace chart 163cdf0e10cSrcweir 164cdf0e10cSrcweir // CHART_CHART2MODELCONTACT_HXX 165cdf0e10cSrcweir #endif 166