1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTVIEW_HXX
20 #define INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTVIEW_HXX
22 #include "ChartModel.hxx"
23 #include "chartview/ExplicitValueProvider.hxx"
24 #include "ServiceMacros.hxx"
25 #include <cppuhelper/implbase10.hxx>
26 #include <cppuhelper/interfacecontainer.hxx>
28 // header for class SfxListener
29 #include <svl/lstner.hxx>
30 #include <com/sun/star/datatransfer/XTransferable.hpp>
31 #include <com/sun/star/drawing/XDrawPage.hpp>
32 #include <com/sun/star/frame/XModel.hpp>
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/lang/XUnoTunnel.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 #include <com/sun/star/util/XModifyListener.hpp>
40 #include <com/sun/star/util/XModeChangeBroadcaster.hpp>
41 #include <com/sun/star/util/XUpdatable.hpp>
42 #include <com/sun/star/qa/XDumper.hpp>
45 #include <boost/shared_ptr.hpp>
51 class VCoordinateSystem
;
52 class DrawModelWrapper
;
53 class SeriesPlotterContainer
;
56 * The ChartView is responsible to manage the generation of Drawing Objects
57 * for visualization on a given OutputDevice. The ChartModel is responsible
58 * to notify changes to the view. The view than changes to state dirty. The
59 * view can be updated with call 'update'.
61 * The View is not responsible to handle single user events (that is instead
62 * done by the ChartWindow).
64 class ChartView
: public ::cppu::WeakImplHelper10
<
65 ::com::sun::star::lang::XInitialization
66 ,::com::sun::star::lang::XServiceInfo
67 ,::com::sun::star::datatransfer::XTransferable
68 ,::com::sun::star::lang::XUnoTunnel
69 ,::com::sun::star::util::XModifyListener
70 ,::com::sun::star::util::XModeChangeBroadcaster
71 ,::com::sun::star::util::XUpdatable
72 ,::com::sun::star::beans::XPropertySet
73 ,::com::sun::star::lang::XMultiServiceFactory
74 ,::com::sun::star::qa::XDumper
76 , public ExplicitValueProvider
83 ChartView(::com::sun::star::uno::Reference
<
84 ::com::sun::star::uno::XComponentContext
> const & xContext
,
89 // ___lang::XServiceInfo___
90 APPHELPER_XSERVICEINFO_DECL()
92 // ___lang::XInitialization___
93 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
94 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
96 // ___ExplicitValueProvider___
97 virtual sal_Bool
getExplicitValuesForAxis(
98 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
> xAxis
99 , ExplicitScaleData
& rExplicitScale
100 , ExplicitIncrementData
& rExplicitIncrement
);
101 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>
102 getShapeForCID( const OUString
& rObjectCID
);
104 virtual ::com::sun::star::awt::Rectangle
getRectangleOfObject( const OUString
& rObjectCID
, bool bSnapRect
=false );
106 virtual ::com::sun::star::awt::Rectangle
getDiagramRectangleExcludingAxes();
108 ::boost::shared_ptr
< DrawModelWrapper
> getDrawModelWrapper();
110 // ___XTransferable___
111 virtual ::com::sun::star::uno::Any SAL_CALL
getTransferData( const ::com::sun::star::datatransfer::DataFlavor
& aFlavor
)
112 throw (::com::sun::star::datatransfer::UnsupportedFlavorException
113 , ::com::sun::star::io::IOException
114 , ::com::sun::star::uno::RuntimeException
);
115 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::datatransfer::DataFlavor
> SAL_CALL
getTransferDataFlavors( )
116 throw (::com::sun::star::uno::RuntimeException
);
117 virtual ::sal_Bool SAL_CALL
isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor
& aFlavor
)
118 throw (::com::sun::star::uno::RuntimeException
);
120 // ::com::sun::star::util::XEventListener (base of XCloseListener and XModifyListener)
121 virtual void SAL_CALL
122 disposing( const ::com::sun::star::lang::EventObject
& Source
)
123 throw (::com::sun::star::uno::RuntimeException
);
125 // ::com::sun::star::util::XModifyListener
126 virtual void SAL_CALL
modified(
127 const ::com::sun::star::lang::EventObject
& aEvent
)
128 throw (::com::sun::star::uno::RuntimeException
);
131 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
133 // ::com::sun::star::util::XModeChangeBroadcaster
135 virtual void SAL_CALL
addModeChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModeChangeListener
>& _rxListener
) throw (::com::sun::star::uno::RuntimeException
);
136 virtual void SAL_CALL
removeModeChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModeChangeListener
>& _rxListener
) throw (::com::sun::star::uno::RuntimeException
);
137 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
);
138 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
);
140 // ::com::sun::star::util::XUpdatable
141 virtual void SAL_CALL
update() throw (::com::sun::star::uno::RuntimeException
);
143 // ::com::sun::star::beans::XPropertySet
144 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException
);
145 virtual void SAL_CALL
setPropertyValue( const 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
);
146 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
147 virtual void SAL_CALL
addPropertyChangeListener( const 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
);
148 virtual void SAL_CALL
removePropertyChangeListener( const 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
);
149 virtual void SAL_CALL
addVetoableChangeListener( const 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
);
150 virtual void SAL_CALL
removeVetoableChangeListener( const 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
);
152 // ::com::sun::star::lang::XMultiServiceFactory
153 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
createInstance( const OUString
& aServiceSpecifier
)
154 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
155 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
createInstanceWithArguments(
156 const OUString
& ServiceSpecifier
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Arguments
)
157 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
158 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException
);
160 // for ExplicitValueProvider
161 // ____ XUnoTunnel ___
162 virtual ::sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< ::sal_Int8
>& aIdentifier
)
163 throw (::com::sun::star::uno::RuntimeException
);
166 virtual OUString SAL_CALL
dump()
167 throw(::com::sun::star::uno::RuntimeException
);
173 void getMetaFile( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
>& xOutStream
174 , bool bUseHighContrast
);
175 SdrPage
* getSdrPage();
177 void impl_deleteCoordinateSystems();
178 void impl_notifyModeChangeListener( const OUString
& rNewMode
);
180 void impl_refreshAddIn();
181 bool impl_AddInDrawsAllByItself();
183 void impl_updateView();
185 ::com::sun::star::awt::Rectangle
impl_createDiagramAndContent( SeriesPlotterContainer
& rSeriesPlotterContainer
186 , const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShapes
>& xDiagramPlusAxes_Shapes
187 , const ::com::sun::star::awt::Point
& rAvailablePos
188 , const ::com::sun::star::awt::Size
& rAvailableSize
189 , const ::com::sun::star::awt::Size
& rPageSize
190 , bool bUseFixedInnerSize
191 , const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& xDiagram_MarkHandles
);
194 ::osl::Mutex m_aMutex
;
196 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
199 chart::ChartModel
& mrChartModel
;
201 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
203 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>
206 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xDashTable
;
207 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xGradientTable
;
208 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xHatchTable
;
209 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xBitmapTable
;
210 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xTransGradientTable
;
211 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> m_xMarkerTable
;
213 ::boost::shared_ptr
< DrawModelWrapper
> m_pDrawModelWrapper
;
215 std::vector
< VCoordinateSystem
* > m_aVCooSysList
;
217 ::cppu::OMultiTypeInterfaceContainerHelper
218 m_aListenerContainer
;
220 bool volatile m_bViewDirty
; //states whether the view needs to be rebuild
221 bool volatile m_bInViewUpdate
;
222 bool volatile m_bViewUpdatePending
;
223 bool volatile m_bRefreshAddIn
;
225 //better performance for big data
226 ::com::sun::star::awt::Size m_aPageResolution
;
227 bool m_bPointsWereSkipped
;
229 //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
230 sal_Int32 m_nScaleXNumerator
;
231 sal_Int32 m_nScaleXDenominator
;
232 sal_Int32 m_nScaleYNumerator
;
233 sal_Int32 m_nScaleYDenominator
;
235 sal_Bool m_bSdrViewIsInEditMode
;
237 ::com::sun::star::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes
;
244 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */