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