xref: /AOO41X/main/chart2/source/view/main/ChartView.hxx (revision de7b3f825c374d9f7270d1282e9d92876f197200)
1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CHARTVIEWIMPL_HXX
24cdf0e10cSrcweir #define _CHARTVIEWIMPL_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "chartview/ExplicitValueProvider.hxx"
27cdf0e10cSrcweir #include "ServiceMacros.hxx"
28cdf0e10cSrcweir #include <cppuhelper/implbase9.hxx>
29cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // header for class SfxListener
32cdf0e10cSrcweir #include <svl/lstner.hxx>
33cdf0e10cSrcweir #include <com/sun/star/datatransfer/XTransferable.hpp>
34cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
35cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
36cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp>
37cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
38cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
40cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
41cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
42cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp>
43cdf0e10cSrcweir #include <com/sun/star/util/XModeChangeBroadcaster.hpp>
44cdf0e10cSrcweir #include <com/sun/star/util/XUpdatable.hpp>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include <vector>
47cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class SdrPage;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir //.............................................................................
52cdf0e10cSrcweir namespace chart
53cdf0e10cSrcweir {
54cdf0e10cSrcweir //.............................................................................
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class VCoordinateSystem;
57cdf0e10cSrcweir class DrawModelWrapper;
58cdf0e10cSrcweir class SeriesPlotterContainer;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir //-----------------------------------------------------------------------------
61cdf0e10cSrcweir /** The ChartView is responsible to manage the generation of Drawing Objects
62cdf0e10cSrcweir for visualization on a given OutputDevice. The ChartModel is responsible to notify changes to the view.
63cdf0e10cSrcweir The view than changes to state dirty. The view can be updated with call 'update'.
64cdf0e10cSrcweir 
65cdf0e10cSrcweir The View is not responsible to handle single user events (that is instead done by the ChartWindow).
66cdf0e10cSrcweir */
67cdf0e10cSrcweir 
68cdf0e10cSrcweir class ChartView : public ::cppu::WeakImplHelper9<
69cdf0e10cSrcweir 	::com::sun::star::lang::XInitialization
70cdf0e10cSrcweir 		, ::com::sun::star::lang::XServiceInfo
71cdf0e10cSrcweir         , ::com::sun::star::datatransfer::XTransferable
72cdf0e10cSrcweir         ,::com::sun::star::lang::XUnoTunnel
73cdf0e10cSrcweir 		//::com::sun::star::lang::XComponent ???
74cdf0e10cSrcweir 		//::com::sun::star::uno::XWeak			// implemented by WeakImplHelper(optional interface)
75cdf0e10cSrcweir 		//::com::sun::star::uno::XInterface		// implemented by WeakImplHelper(optional interface)
76cdf0e10cSrcweir 		//::com::sun::star::lang::XTypeProvider	// implemented by WeakImplHelper
77cdf0e10cSrcweir         ,::com::sun::star::util::XModifyListener
78cdf0e10cSrcweir         ,::com::sun::star::util::XModeChangeBroadcaster
79cdf0e10cSrcweir         ,::com::sun::star::util::XUpdatable
80cdf0e10cSrcweir         ,::com::sun::star::beans::XPropertySet
81cdf0e10cSrcweir         ,::com::sun::star::lang::XMultiServiceFactory
82cdf0e10cSrcweir 		>
83cdf0e10cSrcweir         , public ExplicitValueProvider
84cdf0e10cSrcweir         , private SfxListener
85cdf0e10cSrcweir {
86cdf0e10cSrcweir public:
87cdf0e10cSrcweir     ChartView(::com::sun::star::uno::Reference<
88cdf0e10cSrcweir 			   ::com::sun::star::uno::XComponentContext > const & xContext);
89cdf0e10cSrcweir 	virtual ~ChartView();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     // ___lang::XServiceInfo___
92cdf0e10cSrcweir 	APPHELPER_XSERVICEINFO_DECL()
93cdf0e10cSrcweir 	APPHELPER_SERVICE_FACTORY_HELPER(ChartView)
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	// ___lang::XInitialization___
96cdf0e10cSrcweir     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
97cdf0e10cSrcweir                 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     // ___ExplicitValueProvider___
100cdf0e10cSrcweir     virtual sal_Bool getExplicitValuesForAxis(
101cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
102cdf0e10cSrcweir         , ExplicitScaleData&  rExplicitScale
103cdf0e10cSrcweir         , ExplicitIncrementData& rExplicitIncrement );
104cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
105cdf0e10cSrcweir         getShapeForCID( const rtl::OUString& rObjectCID );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     // ___XTransferable___
114cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
115cdf0e10cSrcweir                 throw (::com::sun::star::datatransfer::UnsupportedFlavorException
116cdf0e10cSrcweir                      , ::com::sun::star::io::IOException
117cdf0e10cSrcweir                      , ::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors(  )
119cdf0e10cSrcweir                 throw (::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
121cdf0e10cSrcweir                 throw (::com::sun::star::uno::RuntimeException);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     //-------------------------------------------------------------------------------------
124cdf0e10cSrcweir 	// ::com::sun::star::util::XEventListener (base of XCloseListener and XModifyListener)
125cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------
126cdf0e10cSrcweir 	virtual void SAL_CALL
127cdf0e10cSrcweir 		disposing( const ::com::sun::star::lang::EventObject& Source )
128cdf0e10cSrcweir 							throw (::com::sun::star::uno::RuntimeException);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     //-----------------------------------------------------------------
131cdf0e10cSrcweir     // ::com::sun::star::util::XModifyListener
132cdf0e10cSrcweir     //-----------------------------------------------------------------
133cdf0e10cSrcweir     virtual void SAL_CALL modified(
134cdf0e10cSrcweir         const ::com::sun::star::lang::EventObject& aEvent )
135cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     //SfxListener
138cdf0e10cSrcweir     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     //-----------------------------------------------------------------
141cdf0e10cSrcweir     // ::com::sun::star::util::XModeChangeBroadcaster
142cdf0e10cSrcweir     //-----------------------------------------------------------------
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     virtual void SAL_CALL addModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir     virtual void SAL_CALL removeModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir     virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir     virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     //-----------------------------------------------------------------
150cdf0e10cSrcweir     // ::com::sun::star::util::XUpdatable
151cdf0e10cSrcweir     //-----------------------------------------------------------------
152cdf0e10cSrcweir     virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     //-----------------------------------------------------------------
155cdf0e10cSrcweir     // ::com::sun::star::beans::XPropertySet
156cdf0e10cSrcweir     //-----------------------------------------------------------------
157cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir     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);
159cdf0e10cSrcweir     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);
160cdf0e10cSrcweir     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);
161cdf0e10cSrcweir     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);
162cdf0e10cSrcweir     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     //-----------------------------------------------------------------
166cdf0e10cSrcweir     // ::com::sun::star::lang::XMultiServiceFactory
167cdf0e10cSrcweir     //-----------------------------------------------------------------
168cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier )
169cdf0e10cSrcweir         throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
170cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
171cdf0e10cSrcweir         const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
172cdf0e10cSrcweir         throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
173cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     // for ExplicitValueProvider
176cdf0e10cSrcweir     // ____ XUnoTunnel ___
177cdf0e10cSrcweir     virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier )
178cdf0e10cSrcweir             throw (::com::sun::star::uno::RuntimeException);
179cdf0e10cSrcweir 
180cdf0e10cSrcweir private: //methods
181cdf0e10cSrcweir     ChartView();
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     void createShapes();
184cdf0e10cSrcweir     void getMetaFile( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream
185cdf0e10cSrcweir                       , bool bUseHighContrast );
186cdf0e10cSrcweir     SdrPage* getSdrPage();
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     void impl_setChartModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
189cdf0e10cSrcweir     void impl_deleteCoordinateSystems();
190cdf0e10cSrcweir     void impl_notifyModeChangeListener( const rtl::OUString& rNewMode );
191cdf0e10cSrcweir 
192cdf0e10cSrcweir     void impl_refreshAddIn();
193cdf0e10cSrcweir     bool impl_AddInDrawsAllByItself();
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     void impl_updateView();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     ::com::sun::star::awt::Rectangle impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
198cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes>& xDiagramPlusAxes_Shapes
199cdf0e10cSrcweir         , const ::com::sun::star::awt::Point& rAvailablePos
200cdf0e10cSrcweir         , const ::com::sun::star::awt::Size& rAvailableSize
201cdf0e10cSrcweir         , const ::com::sun::star::awt::Size& rPageSize
202cdf0e10cSrcweir         , bool bUseFixedInnerSize
203cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xDiagram_MarkHandles );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 
206cdf0e10cSrcweir private: //member
207cdf0e10cSrcweir     ::osl::Mutex m_aMutex;
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
210cdf0e10cSrcweir 			m_xCC;
211cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
212cdf0e10cSrcweir             m_xChartModel;
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
215cdf0e10cSrcweir 			m_xShapeFactory;
216cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage>
217cdf0e10cSrcweir 			m_xDrawPage;
218cdf0e10cSrcweir 
219cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDashTable;
220cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xGradientTable;
221cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xHatchTable;
222cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xBitmapTable;
223cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xTransGradientTable;
224cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xMarkerTable;
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     std::vector< VCoordinateSystem* > m_aVCooSysList;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     ::cppu::OMultiTypeInterfaceContainerHelper
231cdf0e10cSrcweir                         m_aListenerContainer;
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     bool volatile       m_bViewDirty; //states wether the view needs to be rebuild
234cdf0e10cSrcweir     bool volatile       m_bInViewUpdate;
235cdf0e10cSrcweir     bool volatile       m_bViewUpdatePending;
236cdf0e10cSrcweir     bool volatile		m_bRefreshAddIn;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     //better performance for big data
239cdf0e10cSrcweir     ::com::sun::star::awt::Size m_aPageResolution;
240cdf0e10cSrcweir     bool m_bPointsWereSkipped;
241cdf0e10cSrcweir 
242cdf0e10cSrcweir     //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
243cdf0e10cSrcweir     sal_Int32 m_nScaleXNumerator;
244cdf0e10cSrcweir     sal_Int32 m_nScaleXDenominator;
245cdf0e10cSrcweir     sal_Int32 m_nScaleYNumerator;
246cdf0e10cSrcweir     sal_Int32 m_nScaleYDenominator;
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     sal_Bool m_bSdrViewIsInEditMode;
249cdf0e10cSrcweir 
250cdf0e10cSrcweir     ::com::sun::star::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes;
251cdf0e10cSrcweir };
252cdf0e10cSrcweir 
253cdf0e10cSrcweir //.............................................................................
254cdf0e10cSrcweir } //namespace chart
255cdf0e10cSrcweir //.............................................................................
256cdf0e10cSrcweir 
257cdf0e10cSrcweir #endif
258