summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-10-15 07:55:26 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-11-19 13:47:36 +0100
commit401f01caf5b357ac6c15b37a89c0a9aaeb46f4e4 (patch)
tree587823c8639fe4c5166ccd8a70b6a5335242677f /chart2
parentcf90715b35b11286d800c0e1d57ce3a62303e883 (diff)
use ChartModel instead of XModel in a few places
This allows us easier implementation of some advanced features. Mainly the 4D chartting will now be able to work without several ugly layers of UNO. Change-Id: I74d07229eaef921c508f3bab8fae6d6075ad737a
Diffstat (limited to 'chart2')
-rw-r--r--chart2/Library_chartcontroller.mk1
-rw-r--r--chart2/Library_chartcore.mk2
-rw-r--r--chart2/inc/ChartModel.hxx (renamed from chart2/source/model/main/ChartModel.hxx)14
-rw-r--r--chart2/inc/ChartView.hxx (renamed from chart2/source/view/main/ChartView.hxx)11
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx22
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx5
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx4
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx20
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx16
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.cxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx2
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx2
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx17
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx8
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx3
-rw-r--r--chart2/source/controller/dialogs/RangeSelectionHelper.cxx2
-rw-r--r--chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx2
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx9
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx6
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx2
-rw-r--r--chart2/source/controller/inc/RangeSelectionListener.hxx2
-rw-r--r--chart2/source/controller/inc/TimerTriggeredControllerLock.hxx2
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx5
-rw-r--r--chart2/source/controller/main/ChartController.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx22
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx5
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx16
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx7
-rw-r--r--chart2/source/controller/main/ChartModelClone.cxx5
-rw-r--r--chart2/source/controller/main/PositionAndSizeHelper.cxx2
-rw-r--r--chart2/source/inc/AxisHelper.hxx4
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx13
-rw-r--r--chart2/source/inc/ControllerLockGuard.hxx18
-rw-r--r--chart2/source/inc/DataSourceHelper.hxx6
-rw-r--r--chart2/source/inc/DiagramHelper.hxx9
-rw-r--r--chart2/source/inc/ExplicitCategoriesProvider.hxx13
-rw-r--r--chart2/source/inc/LegendHelper.hxx12
-rw-r--r--chart2/source/inc/ObjectIdentifier.hxx21
-rw-r--r--chart2/source/inc/TitleHelper.hxx14
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx8
-rw-r--r--chart2/source/model/main/ChartModel.cxx31
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx2
-rw-r--r--chart2/source/model/main/_serviceregistration_model.cxx8
-rw-r--r--chart2/source/tools/AxisHelper.cxx10
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx44
-rw-r--r--chart2/source/tools/ControllerLockGuard.cxx22
-rw-r--r--chart2/source/tools/DataSourceHelper.cxx28
-rw-r--r--chart2/source/tools/DiagramHelper.cxx46
-rw-r--r--chart2/source/tools/ExplicitCategoriesProvider.cxx123
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx4
-rw-r--r--chart2/source/tools/LegendHelper.cxx42
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx136
-rw-r--r--chart2/source/tools/TitleHelper.cxx80
-rw-r--r--chart2/source/view/inc/VDataSeries.hxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx328
-rw-r--r--chart2/source/view/main/VLegend.cxx20
-rw-r--r--chart2/source/view/main/VLegend.hxx15
62 files changed, 797 insertions, 492 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index bd15c3f7aeed..a4e606730ee3 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_Library_set_include,chartcontroller,\
$$(INCLUDE) \
-I$(SRCDIR)/chart2/source/controller/inc \
-I$(SRCDIR)/chart2/source/inc \
+ -I$(SRCDIR)/chart2/inc \
))
$(eval $(call gb_Library_set_precompiled_header,chartcontroller,$(SRCDIR)/chart2/inc/pch/precompiled_chartcontroller))
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 601821c436bc..53fbd2ac5d89 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_Library_set_include,chartcore,\
-I$(SRCDIR)/chart2/source/model/inc \
-I$(SRCDIR)/chart2/source/view/inc \
-I$(SRCDIR)/chart2/source/inc \
+ -I$(SRCDIR)/chart2/inc \
))
# not ideal - we should use a single core define ideally
@@ -100,7 +101,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/view/main/PlottingPositionHelper \
chart2/source/view/main/PolarLabelPositionHelper \
chart2/source/view/main/PropertyMapper \
- chart2/source/view/main/_serviceregistration_view \
chart2/source/view/main/ShapeFactory \
chart2/source/view/main/AbstractShapeFactory \
chart2/source/view/main/Stripe \
diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index 0d3354e589c6..e4cde2c46b33 100644
--- a/chart2/source/model/main/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -106,8 +106,9 @@ typedef ::comphelper::WeakImplHelper22<
}
class UndoManager;
+class ChartView;
-class ChartModel : public impl::ChartModel_Base
+class OOO_DLLPUBLIC_CHARTTOOLS ChartModel : public impl::ChartModel_Base
{
private:
@@ -119,7 +120,9 @@ private:
sal_Int32 m_nInLoad;
sal_Bool volatile m_bUpdateNotificationsPending;
- OUString m_aResource;
+ ChartView* mpChartView;
+
+ OUString m_aResource;
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aMediaDescriptor;
::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > m_xDocumentProperties;
::rtl::Reference< UndoManager > m_pUndoManager;
@@ -217,9 +220,6 @@ private:
void impl_adjustAdditionalShapesPositionAndSize(
const ::com::sun::star::awt::Size& aVisualAreaSize );
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
- impl_getNumberFormatsSupplier();
-
public:
//no default constructor
ChartModel(::com::sun::star::uno::Reference<
@@ -576,6 +576,10 @@ public:
// XDumper
virtual OUString SAL_CALL dump()
throw (com::sun::star::uno::RuntimeException);
+
+ // normal methods
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
+ getNumberFormatsSupplier();
};
} // namespace chart
diff --git a/chart2/source/view/main/ChartView.hxx b/chart2/inc/ChartView.hxx
index 80001e0a55ba..d56fe1433085 100644
--- a/chart2/source/view/main/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTVIEW_HXX
#define INCLUDED_CHART2_SOURCE_VIEW_MAIN_CHARTVIEW_HXX
+#include "ChartModel.hxx"
#include "chartview/ExplicitValueProvider.hxx"
#include "ServiceMacros.hxx"
#include <cppuhelper/implbase10.hxx>
@@ -77,12 +78,13 @@ class ChartView : public ::cppu::WeakImplHelper10<
{
public:
ChartView(::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext > const & xContext);
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ ChartModel& rModel);
+
virtual ~ChartView();
// ___lang::XServiceInfo___
APPHELPER_XSERVICEINFO_DECL()
- APPHELPER_SERVICE_FACTORY_HELPER(ChartView)
// ___lang::XInitialization___
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
@@ -169,7 +171,6 @@ private: //methods
, bool bUseHighContrast );
SdrPage* getSdrPage();
- void impl_setChartModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
void impl_deleteCoordinateSystems();
void impl_notifyModeChangeListener( const OUString& rNewMode );
@@ -191,8 +192,8 @@ private: //member
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
m_xCC;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
- m_xChartModel;
+
+ chart::ChartModel& mrChartModel;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
m_xShapeFactory;
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
index 80132a8286ee..969f830f940e 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -29,6 +29,8 @@
#include "AxisHelper.hxx"
#include "DiagramHelper.hxx"
+#include "ChartModel.hxx"
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -44,6 +46,7 @@ Chart2ModelContact::Chart2ModelContact(
const Reference< uno::XComponentContext > & xContext ) :
m_xContext( xContext ),
m_xChartModel( 0 ),
+ mpModel( NULL ),
m_xChartView(0)
{
}
@@ -58,6 +61,7 @@ void Chart2ModelContact::setModel( const ::com::sun::star::uno::Reference<
{
this->clear();
m_xChartModel = xChartModel;
+ mpModel = dynamic_cast<ChartModel*>(xChartModel.get());
uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartModel, uno::UNO_QUERY );
if( xTableFactory.is() )
{
@@ -78,6 +82,7 @@ void Chart2ModelContact::clear()
{
m_xChartModel = uno::WeakReference< frame::XModel >(0);
m_xChartView.clear();
+ mpModel = NULL;
}
Reference< frame::XModel > Chart2ModelContact::getChartModel() const
@@ -85,6 +90,11 @@ Reference< frame::XModel > Chart2ModelContact::getChartModel() const
return Reference< frame::XModel >( m_xChartModel.get(), uno::UNO_QUERY );
}
+ChartModel* Chart2ModelContact::getModel() const
+{
+ return mpModel;
+}
+
Reference< chart2::XChartDocument > Chart2ModelContact::getChart2Document() const
{
return Reference< chart2::XChartDocument >( m_xChartModel.get(), uno::UNO_QUERY );
@@ -175,7 +185,7 @@ awt::Size Chart2ModelContact::GetPageSize() const
awt::Rectangle Chart2ModelContact::SubstractAxisTitleSizes( const awt::Rectangle& rPositionRect )
{
awt::Rectangle aRect = ExplicitValueProvider::substractAxisTitleSizes(
- m_xChartModel, getChartView(), rPositionRect );
+ *mpModel, getChartView(), rPositionRect );
return aRect;
}
@@ -185,7 +195,7 @@ awt::Rectangle Chart2ModelContact::GetDiagramRectangleIncludingTitle() const
//add axis title sizes to the diagram size
aRect = ExplicitValueProvider::addAxisTitleSizes(
- m_xChartModel, getChartView(), aRect );
+ *mpModel, getChartView(), aRect );
return aRect;
}
@@ -228,8 +238,8 @@ awt::Size Chart2ModelContact::GetLegendSize() const
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider )
{
- uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_xChartModel ) );
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
+ uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *mpModel ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, *mpModel ) );
aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
}
return aSize;
@@ -241,8 +251,8 @@ awt::Point Chart2ModelContact::GetLegendPosition() const
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider )
{
- uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_xChartModel ) );
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
+ uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *mpModel ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, *mpModel ) );
aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
}
return aPoint;
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
index 992cf384ffa1..c73da310cda4 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -38,6 +38,7 @@
namespace chart
{
class ExplicitValueProvider;
+class ChartModel;
namespace wrapper
{
@@ -57,6 +58,8 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel > getChartModel() const;
+ ChartModel* getModel() const;
+
::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > getChart2Document() const;
::com::sun::star::uno::Reference<
@@ -145,6 +148,8 @@ private: //member
::com::sun::star::uno::WeakReference<
::com::sun::star::frame::XModel > m_xChartModel;
+ ChartModel* mpModel;
+
mutable ::com::sun::star::uno::Reference<
::com::sun::star::lang::XUnoTunnel > m_xChartView;
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
index 0ca43ba6305f..35afa7c20d37 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
@@ -530,7 +530,7 @@ void SAL_CALL ChartDataWrapper::setAnyColumnDescriptions( const Sequence< Sequen
void SAL_CALL ChartDataWrapper::setDateCategories( const Sequence< double >& rDates ) throw (uno::RuntimeException)
{
Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
- ControllerLockGuard aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ ControllerLockGuardUNO aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
lcl_DateCategoriesOperator aOperator( rDates );
applyData( aOperator );
DiagramHelper::switchToDateCategories( xChartDoc );
@@ -682,7 +682,7 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator )
aRangeString, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories ) );
// /-- locked controllers
- ControllerLockGuard aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ ControllerLockGuardUNO aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
// create and attach new data source
switchToInternalDataProvider();
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index fc2d7c2cc64d..de42006c6273 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -31,6 +31,8 @@
#include "chartview/DrawModelWrapper.hxx"
#include "Chart2ModelContact.hxx"
+#include "ChartModel.hxx"
+
#include "DiagramHelper.hxx"
#include "DataSourceHelper.hxx"
#include "ChartModelHelper.hxx"
@@ -501,7 +503,7 @@ void WrappedHasLegendProperty::setPropertyValue( const Any& rOuterValue, const R
try
{
- Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext,bNewValue ));
+ Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *m_spChart2ModelContact->getModel(), m_spChart2ModelContact->m_xContext,bNewValue ));
if(xLegend.is())
{
Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW );
@@ -525,7 +527,7 @@ Any WrappedHasLegendProperty::getPropertyValue( const Reference< beans::XPropert
try
{
Reference< beans::XPropertySet > xLegendProp(
- LegendHelper::getLegend( m_spChart2ModelContact->getChartModel() ), uno::UNO_QUERY );
+ LegendHelper::getLegend( *m_spChart2ModelContact->getModel() ), uno::UNO_QUERY );
if( xLegendProp.is())
aRet = xLegendProp->getPropertyValue("Show");
else
@@ -722,7 +724,7 @@ Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getTitle()
{
if( !m_xTitle.is() )
{
- ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
m_xTitle = new TitleWrapper( TitleHelper::MAIN_TITLE, m_spChart2ModelContact );
}
return m_xTitle;
@@ -733,7 +735,7 @@ Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getSubTitle()
{
if( !m_xSubTitle.is() )
{
- ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
m_xSubTitle = new TitleWrapper( TitleHelper::SUB_TITLE, m_spChart2ModelContact );
}
return m_xSubTitle;
@@ -833,7 +835,7 @@ void SAL_CALL ChartDocumentWrapper::attachData( const Reference< XChartData >& x
return;
// /-- locked controllers
- ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact, xNewData ) );
// \-- locked controllers
}
@@ -1022,7 +1024,7 @@ void ChartDocumentWrapper::impl_resetAddIn()
void ChartDocumentWrapper::setBaseDiagram( const OUString& rBaseDiagram )
{
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
m_aBaseDiagram = rBaseDiagram;
uno::Reference< XDiagram > xDiagram( ChartDocumentWrapper::createInstance( rBaseDiagram ), uno::UNO_QUERY );
@@ -1045,7 +1047,7 @@ void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAdd
if( m_xAddIn == xAddIn )
return;
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
impl_resetAddIn();
m_xAddIn = xAddIn;
// initialize AddIn with this as chart document
@@ -1291,7 +1293,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
// locked controllers
Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY );
- ControllerLockGuard aCtrlLockGuard( xModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xModel );
Reference< chart2::XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
Reference< lang::XMultiServiceFactory > xTemplateManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
@@ -1307,7 +1309,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
else
{
// locked controllers
- ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
xDia.set( xTemplate->createDiagramByDataSource(
uno::Reference< chart2::data::XDataSource >(),
uno::Sequence< beans::PropertyValue >()));
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 9836d2929589..c54a2dc56752 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -705,7 +705,7 @@ awt::Point SAL_CALL DiagramWrapper::getPosition()
void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition )
throw (uno::RuntimeException)
{
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
if( xProp.is() )
{
@@ -738,7 +738,7 @@ void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize )
throw (beans::PropertyVetoException,
uno::RuntimeException)
{
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
if( xProp.is() )
{
@@ -772,7 +772,7 @@ OUString SAL_CALL DiagramWrapper::getShapeType()
void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::RuntimeException)
{
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
if( xDiaProps.is() )
{
@@ -794,7 +794,7 @@ void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::Runti
}
void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
{
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
if( xDiaProps.is() )
@@ -822,7 +822,7 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes(
}
void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
{
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect );
uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY );
if( xDiaProps.is() )
@@ -834,7 +834,7 @@ awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes(
}
void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException)
{
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) );
DiagramWrapper::setDiagramPositionIncludingAxes( aRect );
}
@@ -1646,7 +1646,7 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con
try
{
// locked controllers
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
xProp->setPropertyValue( "NumberOfLines", uno::makeAny(nNewValue) );
xTemplate->changeDiagram( xDiagram );
@@ -1966,7 +1966,7 @@ void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue
if( ! (rOuterValue >>= bNewValue) )
throw lang::IllegalArgumentException( "Property Dim3D requires boolean value", 0, 0 );
- ChartModelHelper::setIncludeHiddenCells( bNewValue, m_spChart2ModelContact->getChartModel() );
+ ChartModelHelper::setIncludeHiddenCells( bNewValue, *m_spChart2ModelContact->getModel() );
}
// ____ XDiagramProvider ____
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
index ecbe98db34bc..9ca382f98f1b 100644
--- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -204,7 +204,7 @@ TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
m_aEventListenerContainer( m_aMutex ),
m_eTitleType(eTitleType)
{
- ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+ ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
if( !getTitleObject().is() ) //#i83831# create an empty title at the model, thus references to properties can be mapped mapped correctly
TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
}
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
index 181d3a3b3820..8cdf63006ca8 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
@@ -98,7 +98,7 @@ void WrappedStockProperty::setPropertyValue( const ::com::sun::star::uno::Any& r
try
{
// locked controllers
- ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
xTemplate->changeDiagram( xDiagram );
}
catch( const uno::Exception & ex )
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index baf4568cd663..3aee103766b5 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -322,7 +322,7 @@ bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame
uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY);
// locked controllers
- ControllerLockGuard aCtrlLockGuard( xModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xModel );
uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
DiagramHelper::tTemplateWithServiceName aTemplateWithService(
DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 6e2c6576b269..8bfa963a0aaf 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -31,6 +31,8 @@
#include "chartview/ExplicitValueProvider.hxx"
#include "ExplicitCategoriesProvider.hxx"
+#include "ChartModel.hxx"
+
#include <com/sun/star/container/XIndexReplace.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
@@ -432,7 +434,7 @@ void DataBrowserModel::insertComplexCategoryLevel( sal_Int32 nAfterColumnIndex )
}
m_apDialogModel->startControllerLockTimer();
- ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
xDataProvider->insertComplexCategoryLevel( nAfterColumnIndex+1 );
updateFromModel();
}
@@ -498,7 +500,7 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
if( xDataProvider.is() )
{
m_apDialogModel->startControllerLockTimer();
- ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
xDataProvider->deleteComplexCategoryLevel( nAtColumnIndex );
updateFromModel();
}
@@ -526,7 +528,7 @@ void DataBrowserModel::swapDataPointForAllSeries( sal_Int32 nFirstIndex )
Reference< chart2::XInternalDataProvider > xDataProvider(
m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
// lockControllers
- ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ ControllerLockGuardUNO aGuard( m_apDialogModel->getChartModel());
if( xDataProvider.is())
xDataProvider->swapDataPointWithNextOneForAllSequences( nFirstIndex );
// unlockControllers
@@ -537,7 +539,7 @@ void DataBrowserModel::insertDataPointForAllSeries( sal_Int32 nAfterIndex )
Reference< chart2::XInternalDataProvider > xDataProvider(
m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
// lockControllers
- ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ ControllerLockGuardUNO aGuard( m_apDialogModel->getChartModel());
if( xDataProvider.is())
xDataProvider->insertDataPointForAllSequences( nAfterIndex );
// unlockControllers
@@ -548,7 +550,7 @@ void DataBrowserModel::removeDataPointForAllSeries( sal_Int32 nAtIndex )
Reference< chart2::XInternalDataProvider > xDataProvider(
m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
// lockControllers
- ControllerLockGuard aGuard( m_apDialogModel->getChartModel());
+ ControllerLockGuardUNO aGuard( m_apDialogModel->getChartModel());
if( xDataProvider.is())
xDataProvider->deleteDataPointForAllSequences( nAtIndex );
// unlockControllers
@@ -663,7 +665,7 @@ bool DataBrowserModel::setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const
bResult = true;
try
{
- ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
// label
if( nAtRow == -1 )
@@ -790,7 +792,8 @@ void DataBrowserModel::updateFromModel()
if( lcl_ShowCategories( xDiagram ))
{
Reference< frame::XModel > xChartModel( m_xChartDocument, uno::UNO_QUERY );
- ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), xChartModel );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), *pModel );
const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 6c2ad6190f4c..c6d4f84ff146 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -501,7 +501,7 @@ void DialogModel::moveSeries(
eMoveDirection eDirection )
{
m_aTimerTriggeredControllerLock.startTimer();
- ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
Reference< XDiagram > xDiagram( m_xChartDocument->getFirstDiagram());
DiagramHelper::moveSeries( xDiagram, xSeries, eDirection==MOVE_UP );
@@ -513,7 +513,7 @@ Reference< chart2::XDataSeries > DialogModel::insertSeriesAfter(
bool bCreateDataCachedSequences /* = false */ )
{
m_aTimerTriggeredControllerLock.startTimer();
- ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
Reference< XDataSeries > xNewSeries;
try
@@ -572,7 +572,7 @@ void DialogModel::deleteSeries(
const Reference< XChartType > & xChartType )
{
m_aTimerTriggeredControllerLock.startTimer();
- ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
DataSeriesHelper::deleteSeries( xSeries, xChartType );
}
@@ -673,7 +673,7 @@ bool DialogModel::setData(
const Sequence< beans::PropertyValue > & rArguments )
{
m_aTimerTriggeredControllerLock.startTimer();
- ControllerLockGuard aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) );
Reference< data::XDataProvider > xDataProvider( getDataProvider());
if( ! xDataProvider.is() ||
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 749131632b4b..81146d389259 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -176,7 +176,8 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
if( aX.isEmpty() )
{
- aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, xChartModel, nPointIndex );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
+ aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, *pModel, nPointIndex );
}
else
{
diff --git a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
index b96d063e677b..b2fd8fb31a62 100644
--- a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
+++ b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx
@@ -108,7 +108,7 @@ bool RangeSelectionHelper::chooseRange(
const OUString & aUIString,
RangeSelectionListenerParent & rListenerParent )
{
- ControllerLockGuard aGuard( Reference< frame::XModel >(m_xChartDocument, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aGuard( Reference< frame::XModel >(m_xChartDocument, uno::UNO_QUERY ) );
bool bResult = true;
raiseRangeSelectionDocument();
diff --git a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
index 42e2e09c17ab..f564673cc05d 100644
--- a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
+++ b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx
@@ -43,7 +43,7 @@ TimerTriggeredControllerLock::~TimerTriggeredControllerLock()
void TimerTriggeredControllerLock::startTimer()
{
if(!m_apControllerLockGuard.get())
- m_apControllerLockGuard.reset( new ControllerLockGuard(m_xModel) );
+ m_apControllerLockGuard.reset( new ControllerLockGuardUNO(m_xModel) );
m_aTimer.Start();
}
IMPL_LINK_NOARG(TimerTriggeredControllerLock, TimerTimeout)
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index d7c658753c96..05b554406b74 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -44,6 +44,7 @@
#include "AxisIndexDefines.hxx"
#include "AxisHelper.hxx"
#include "ExplicitCategoriesProvider.hxx"
+#include "ChartModel.hxx"
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XChartType.hpp>
@@ -186,13 +187,17 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
ScaleData aScale( xCrossingMainAxis->getScaleData() );
m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType );
if( m_bIsCrossingAxisIsCategoryAxis )
- m_aCategories = DiagramHelper::getExplicitSimpleCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) );
+ {
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
+ m_aCategories = DiagramHelper::getExplicitSimpleCategories( *pModel );
+ }
}
m_bComplexCategoriesAxis = false;
if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY )
{
- ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *pModel );
m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
}
}
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx
index c5e5cf530296..3f0b459e4fed 100644
--- a/chart2/source/controller/dialogs/res_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -25,6 +25,7 @@
#include "ChartModelHelper.hxx"
#include "macros.hxx"
#include "LegendHelper.hxx"
+#include "ChartModel.hxx"
#include <svtools/controldims.hrc>
#include <com/sun/star/chart2/LegendPosition.hpp>
@@ -132,7 +133,8 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen
try
{
sal_Bool bShowLegend = static_cast<sal_Bool>(m_aCbxShow.IsChecked());
- uno::Reference< beans::XPropertySet > xProp( LegendHelper::getLegend( xChartModel,m_xCC,bShowLegend ), uno::UNO_QUERY );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
+ uno::Reference< beans::XPropertySet > xProp( LegendHelper::getLegend( *pModel,m_xCC,bShowLegend ), uno::UNO_QUERY );
if( xProp.is() )
{
//show
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 3235fa742e03..031c593a5995 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -364,7 +364,7 @@ IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel)
void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLightNumber )
{
- ControllerLockGuard aGuard( m_xChartModel );
+ ControllerLockGuardUNO aGuard( m_xChartModel );
m_bInCommitToModel = true;
sal_Int32 nIndex( nLightNumber );
lcl_setLightSource( m_xSceneProperties, m_pLightSourceInfoList[nIndex].aLightSource, nIndex );
@@ -374,7 +374,7 @@ void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLigh
void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
{
m_aTimerTriggeredControllerLock.startTimer();
- ControllerLockGuard aGuard( m_xChartModel );
+ ControllerLockGuardUNO aGuard( m_xChartModel );
for( sal_Int32 nL=0; nL<8; nL++)
applyLightSourceToModel( nL );
m_aTimerTriggeredControllerLock.startTimer();
@@ -542,7 +542,7 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, LightBut
}
else
{
- ControllerLockGuard aGuard( m_xChartModel );
+ ControllerLockGuardUNO aGuard( m_xChartModel );
for( nL=0; nL<8; nL++)
{
LightButton* pLightButton = m_pLightSourceInfoList[nL].pButton;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index bec737d61298..dd09bd7a3694 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -989,7 +989,7 @@ void ChartTypeTabPage::commitToModel( const ChartTypeParameter& rParameter )
return;
m_aTimerTriggeredControllerLock.startTimer();
- ControllerLockGuard aLockedControllers( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) );
+ ControllerLockGuardUNO aLockedControllers( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) );
m_pCurrentMainType->commitToModel( rParameter, m_xChartModel );
}
void ChartTypeTabPage::stateChanged( ChangingResource* /*pResource*/ )
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index d8aa5afc8732..c0232aef65a8 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -875,7 +875,7 @@ bool DataSourceTabPage::updateModelFromControl( Edit * pField )
if( !m_bIsDirty )
return true;
- ControllerLockGuard aLockedControllers( m_rDialogModel.getChartModel() );
+ ControllerLockGuardUNO aLockedControllers( m_rDialogModel.getChartModel() );
// @todo: validity check of field content
bool bResult = true;
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
index 1dc6a98a8a8b..966bc0291c25 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -122,7 +122,7 @@ void TitlesAndObjectsTabPage::commitToModel()
m_aTimerTriggeredControllerLock.startTimer();
uno::Reference< frame::XModel > xModel( m_xChartModel, uno::UNO_QUERY);
- ControllerLockGuard aLockedControllers( xModel );
+ ControllerLockGuardUNO aLockedControllers( xModel );
//commit title changes to model
{
diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/controller/inc/RangeSelectionListener.hxx
index cfb1bc3676a7..1226ef200153 100644
--- a/chart2/source/controller/inc/RangeSelectionListener.hxx
+++ b/chart2/source/controller/inc/RangeSelectionListener.hxx
@@ -63,7 +63,7 @@ protected:
private:
RangeSelectionListenerParent & m_rParent;
OUString m_aRange;
- ControllerLockGuard m_aControllerLockGuard;
+ ControllerLockGuardUNO m_aControllerLockGuard;
};
} // namespace chart
diff --git a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
index 49703581f675..2bdc76872209 100644
--- a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
+++ b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx
@@ -41,7 +41,7 @@ public:
private:
::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel > m_xModel;
- boost::scoped_ptr< ControllerLockGuard > m_apControllerLockGuard;
+ boost::scoped_ptr< ControllerLockGuardUNO > m_apControllerLockGuard;
AutoTimer m_aTimer;
DECL_LINK( TimerTimeout, void* );
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index 1b6f1aa529d6..5763764957e4 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -348,7 +348,10 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
{
bool bIncludeHiddenCells = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue();
if (bIncludeHiddenCells != m_bIncludeHiddenCells)
- bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, m_xChartModel );
+ {
+ ChartModel* pModel = dynamic_cast<ChartModel*>(m_xChartModel.get());
+ bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, *pModel );
+ }
}
}
break;
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 0ae910b1acaa..25981e364716 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1285,7 +1285,7 @@ void SAL_CALL ChartController::executeDispatch_SourceData()
void SAL_CALL ChartController::executeDispatch_MoveSeries( sal_Bool bForward )
{
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
//get selected series
OUString aObjectCID(m_aSelection.getSelectedCID());
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 4313502349c2..034b32678e94 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -117,7 +117,7 @@ void ChartController::executeDispatch_InsertAxes()
if( aDlg.Execute() == RET_OK )
{
// lock controllers till end of block
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
InsertAxisOrGridDialogData aDialogOutput;
aDlg.getResult( aDialogOutput );
@@ -155,7 +155,7 @@ void ChartController::executeDispatch_InsertGrid()
if( aDlg.Execute() == RET_OK )
{
// lock controllers till end of block
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
InsertAxisOrGridDialogData aDialogOutput;
aDlg.getResult( aDialogOutput );
bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
@@ -187,7 +187,7 @@ void ChartController::executeDispatch_InsertTitles()
if( aDlg.Execute() == RET_OK )
{
// lock controllers till end of block
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
TitleDialogData aDialogOutput( impl_createReferenceSizeProvider().release());
aDlg.getResult( aDialogOutput );
bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput );
@@ -208,7 +208,8 @@ void ChartController::executeDispatch_DeleteLegend()
ActionDescriptionProvider::DELETE, SCH_RESSTR( STR_OBJECT_LEGEND )),
m_xUndoManager );
- LegendHelper::hideLegend( getModel() );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(getModel().get());
+ LegendHelper::hideLegend( *pModel );
aUndoGuard.commit();
}
@@ -219,7 +220,8 @@ void ChartController::executeDispatch_InsertLegend()
ActionDescriptionProvider::INSERT, SCH_RESSTR( STR_OBJECT_LEGEND )),
m_xUndoManager );
- Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( getModel(), m_xCC );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(getModel().get());
+ Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( *pModel, m_xCC );
aUndoGuard.commit();
}
@@ -239,7 +241,7 @@ void ChartController::executeDispatch_OpenLegendDialog()
if( aDlg.Execute() == RET_OK )
{
// lock controllers till end of block
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
bool bChanged = aDlg.writeToModel( getModel() );
if( bChanged )
aUndoGuard.commit();
@@ -301,7 +303,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels()
SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
aDlg.FillItemSet( aOutItemSet );
// lock controllers till end of block
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
if( bChanged )
aUndoGuard.commit();
@@ -409,7 +411,7 @@ void ChartController::executeDispatch_InsertTrendline()
const SfxItemSet* pOutItemSet = aDialog.GetOutputItemSet();
if( pOutItemSet )
{
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
aItemConverter.ApplyItemSet( *pOutItemSet );
}
aUndoGuard.commit();
@@ -467,7 +469,7 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
if( pOutItemSet )
{
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
aItemConverter.ApplyItemSet( *pOutItemSet );
}
aUndoGuard.commit();
@@ -505,7 +507,7 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError )
aDlg.FillItemSet( aOutItemSet );
// lock controllers till end of block
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
if( bChanged )
aUndoGuard.commit();
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index 752495f7b54e..2af88ba787b5 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -158,7 +158,10 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize()
bool bChanged = false;
if ( eObjectType == OBJECTTYPE_LEGEND )
- bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true );
+ {
+ ChartModel* pModel = dynamic_cast<ChartModel*>(getModel().get());
+ bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( *pModel, false , true );
+ }
bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel()
, aObjectRect, aPageRect );
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index f1a64789de63..5c05794cd932 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -776,7 +776,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const OUStri
const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
if(pOutItemSet)
{
- ControllerLockGuard aCLGuard( getModel());
+ ControllerLockGuardUNO aCLGuard( getModel());
apItemConverter->ApplyItemSet( *pOutItemSet );//model should be changed now
bRet = true;
}
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index b495acb31620..32e75a805d6d 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -134,7 +134,7 @@ bool ChartController::EndTextEdit()
ObjectIdentifier::getObjectPropertySet( aObjectCID, getModel() );
// lock controllers till end of block
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
TitleHelper::setCompleteString( aString, uno::Reference<
::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC );
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 3415ec892bd8..7ee860cc0d9b 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -195,7 +195,7 @@ void ChartController::executeDispatch_NewArrangement()
UndoGuard aUndoGuard = UndoGuard(
SCH_RESSTR( STR_ACTION_REARRANGE_CHART ),
m_xUndoManager );
- ControllerLockGuard aCtlLockGuard( xModel );
+ ControllerLockGuardUNO aCtlLockGuard( xModel );
// diagram
Reference< beans::XPropertyState > xState( xDiagram, uno::UNO_QUERY_THROW );
@@ -249,7 +249,7 @@ void ChartController::executeDispatch_ScaleText()
UndoGuard aUndoGuard = UndoGuard(
SCH_RESSTR( STR_ACTION_SCALE_TEXT ),
m_xUndoManager );
- ControllerLockGuard aCtlLockGuard( getModel() );
+ ControllerLockGuardUNO aCtlLockGuard( getModel() );
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< ReferenceSizeProvider > apRefSizeProv( impl_createReferenceSizeProvider());
SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -724,7 +724,7 @@ bool ChartController::executeDispatch_Delete()
ActionDescriptionProvider::DELETE, SCH_RESSTR( STR_OBJECT_CURVE_EQUATION )),
m_xUndoManager );
{
- ControllerLockGuard aCtlLockGuard( xModel );
+ ControllerLockGuardUNO aCtlLockGuard( xModel );
xEqProp->setPropertyValue( "ShowEquation", uno::makeAny( false ));
xEqProp->setPropertyValue( "ShowCorrelationCoefficient", uno::makeAny( false ));
}
@@ -758,7 +758,7 @@ bool ChartController::executeDispatch_Delete()
ActionDescriptionProvider::DELETE, SCH_RESSTR( nId )),
m_xUndoManager );
{
- ControllerLockGuard aCtlLockGuard( xModel );
+ ControllerLockGuardUNO aCtlLockGuard( xModel );
xErrorBarProp->setPropertyValue(
"ErrorBarStyle",
uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ));
@@ -845,7 +845,8 @@ void ChartController::executeDispatch_ToggleLegend()
Reference< frame::XModel > xModel( getModel() );
UndoGuard aUndoGuard = UndoGuard(
SCH_RESSTR( STR_ACTION_TOGGLE_LEGEND ), m_xUndoManager );
- Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend( xModel ), uno::UNO_QUERY );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
+ Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend( *pModel ), uno::UNO_QUERY );
bool bChanged = false;
if( xLegendProp.is())
{
@@ -865,7 +866,7 @@ void ChartController::executeDispatch_ToggleLegend()
}
else
{
- xLegendProp.set( LegendHelper::getLegend( xModel, m_xCC, true ), uno::UNO_QUERY );
+ xLegendProp.set( LegendHelper::getLegend( *pModel, m_xCC, true ), uno::UNO_QUERY );
if( xLegendProp.is())
bChanged = true;
}
@@ -957,7 +958,8 @@ void ChartController::impl_switchDiagramPositioningToExcludingPositioning()
ActionDescriptionProvider::POS_SIZE,
ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)),
m_xUndoManager );
- if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_aModel->getModel(), true, true ) )
+ ChartModel* pModel = dynamic_cast<ChartModel*>(m_aModel->getModel().get());
+ if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( *pModel, true, true ) )
aUndoGuard.commit();
}
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index cb99f8ec70e4..7a55cc7d8b7b 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -749,7 +749,7 @@ void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ )
void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
{
- ControllerLockGuard aCLGuard( getModel() );
+ ControllerLockGuardUNO aCLGuard( getModel() );
bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
m_bWaitingForMouseUp = false;
bool bNotifySelectionChange = false;
@@ -849,8 +849,9 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
m_xUndoManager );
bool bChanged = false;
+ ChartModel* pModel = dynamic_cast<ChartModel*>(getModel().get());
if ( eObjectType == OBJECTTYPE_LEGEND )
- bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true );
+ bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( *pModel, false , true );
bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID()
, getModel()
@@ -1792,7 +1793,7 @@ bool ChartController::impl_moveOrResizeObject(
UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager );
{
- ControllerLockGuard aCLGuard( xChartModel );
+ ControllerLockGuardUNO aCLGuard( xChartModel );
if( bNeedShift )
xObjProp->setPropertyValue( "RelativePosition", uno::makeAny( aRelPos ));
if( bNeedResize || (eObjectType == OBJECTTYPE_DIAGRAM) )//Also set an explicat size at the diagram when an explicit position is set
diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx
index f8ae21852ef8..aef15eb21f27 100644
--- a/chart2/source/controller/main/ChartModelClone.cxx
+++ b/chart2/source/controller/main/ChartModelClone.cxx
@@ -191,12 +191,13 @@ namespace chart
try
{
// /-- loccked controllers of destination
- ControllerLockGuard aLockedControllers( i_model );
+ ControllerLockGuardUNO aLockedControllers( i_model );
Reference< XChartDocument > xSource( i_modelToCopyFrom, UNO_QUERY_THROW );
Reference< XChartDocument > xDestination( i_model, UNO_QUERY_THROW );
// propagate the correct flag for plotting of hidden values to the data provider and all used sequences
- ChartModelHelper::setIncludeHiddenCells( ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ) , i_model );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(i_model.get());
+ ChartModelHelper::setIncludeHiddenCells( ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ) , *pModel );
// diagram
xDestination->setFirstDiagram( xSource->getFirstDiagram() );
diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx
index 5e4005a9e7a4..7b7f255009f5 100644
--- a/chart2/source/controller/main/PositionAndSizeHelper.cxx
+++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx
@@ -131,7 +131,7 @@ bool PositionAndSizeHelper::moveObject( const OUString& rObjectCID
, const awt::Rectangle& rPageRectangle
)
{
- ControllerLockGuard aLockedControllers( xChartModel );
+ ControllerLockGuardUNO aLockedControllers( xChartModel );
awt::Rectangle aNewPositionAndSize( rNewPositionAndSize );
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx
index f016495dd081..b6e4a611c9dd 100644
--- a/chart2/source/inc/AxisHelper.hxx
+++ b/chart2/source/inc/AxisHelper.hxx
@@ -28,6 +28,8 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include "ChartModel.hxx"
+
#include <vector>
namespace chart
@@ -50,7 +52,7 @@ public:
::com::sun::star::chart2::XScaling >& xScaling );
static void checkDateAxis( ::com::sun::star::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis );
- static ::com::sun::star::chart2::ScaleData getDateCheckedScale( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
+ static ::com::sun::star::chart2::ScaleData getDateCheckedScale( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis, ChartModel& rModel );
static sal_Int32 getExplicitNumberFormatKeyForAxis(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index 4ae5782c916f..9b947cd45a72 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -31,6 +31,8 @@
#include <com/sun/star/frame/XModel.hpp>
#include "charttoolsdllapi.hxx"
+#include "ChartModel.hxx"
+
#include <vector>
namespace chart
@@ -58,10 +60,18 @@ public:
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem >
+ getFirstCoordinateSystem( ChartModel& rModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >
getFirstCoordinateSystem( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
SAL_DLLPRIVATE static ::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDataSeries > > getDataSeries(
+ ChartModel& rModel );
+
+ SAL_DLLPRIVATE static ::std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > getDataSeries(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc );
static ::std::vector< ::com::sun::star::uno::Reference<
@@ -93,8 +103,7 @@ public:
static bool isIncludeHiddenCells( const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel );
- static bool setIncludeHiddenCells( bool bIncludeHiddenCells, const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xChartModel );
+ static bool setIncludeHiddenCells( bool bIncludeHiddenCells, ChartModel& rModel);
};
} //namespace chart
diff --git a/chart2/source/inc/ControllerLockGuard.hxx b/chart2/source/inc/ControllerLockGuard.hxx
index aa1bdaf70e51..22036d0605f0 100644
--- a/chart2/source/inc/ControllerLockGuard.hxx
+++ b/chart2/source/inc/ControllerLockGuard.hxx
@@ -21,6 +21,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include "charttoolsdllapi.hxx"
+#include "ChartModel.hxx"
namespace chart
{
@@ -29,17 +30,26 @@ namespace chart
unlockControllers in the DTOR. Using this ensures that controllers do not
remain locked when leaving a function even in case an exception is thrown.
*/
-class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockGuard
+class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockGuardUNO
{
public:
- explicit ControllerLockGuard(
+ explicit ControllerLockGuardUNO(
const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel > & xModel );
+ ~ControllerLockGuardUNO();
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::frame::XModel > mxModel;
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockGuard
+{
+public:
+ explicit ControllerLockGuard( ChartModel& rModel );
~ControllerLockGuard();
private:
- ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > m_xModel;
+ ChartModel& mrModel;
};
/** This helper class can be used to pass a locking mechanism to other objects
diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx
index aa40363d9cde..a0f4d5b10f53 100644
--- a/chart2/source/inc/DataSourceHelper.hxx
+++ b/chart2/source/inc/DataSourceHelper.hxx
@@ -28,6 +28,8 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include "ChartModel.hxx"
+
#include "charttoolsdllapi.hxx"
#include <vector>
@@ -99,6 +101,10 @@ public:
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSource > getUsedData(
+ ChartModel& rModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XDataSource > getUsedData(
const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel );
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index febb2b9670e4..375aa70d51ca 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -33,6 +33,8 @@
#include <com/sun/star/util/XNumberFormats.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include "ChartModel.hxx"
+
#include <utility>
#include <vector>
@@ -224,9 +226,7 @@ public:
::com::sun::star::chart2::XDiagram > & xDiagram );
static ::com::sun::star::uno::Sequence< OUString >
- getExplicitSimpleCategories(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+ getExplicitSimpleCategories( ChartModel& rModel );
SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< OUString >
generateAutomaticCategoriesFromCooSys(
@@ -340,8 +340,7 @@ public:
static ::com::sun::star::awt::Rectangle getDiagramRectangleFromModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
- static bool switchDiagramPositioningToExcludingPositioning( const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xChartModel
+ static bool switchDiagramPositioningToExcludingPositioning( ChartModel& rModel
, bool bResetModifiedState //set model back to unchanged if it was unchanged before
, bool bConvertAlsoFromAutoPositioning );
diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx
index ddc5ca5762b4..7b24560e34ae 100644
--- a/chart2/source/inc/ExplicitCategoriesProvider.hxx
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -24,8 +24,8 @@
#include <cppuhelper/weakref.hxx>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include "charttoolsdllapi.hxx"
+#include "ChartModel.hxx"
#include <vector>
@@ -73,8 +73,7 @@ class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider
public:
ExplicitCategoriesProvider( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xChartModel
+ , ChartModel& rChartModel
);
virtual ~ExplicitCategoriesProvider();
@@ -89,8 +88,7 @@ public:
static OUString getCategoryByIndex(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xChartModel
+ , ChartModel& rModel
, sal_Int32 nIndex );
static ::com::sun::star::uno::Sequence< OUString > getExplicitSimpleCategories(
@@ -98,7 +96,7 @@ public:
static void convertCategoryAnysToText( ::com::sun::star::uno::Sequence< OUString >& rOutTexts
, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rInAnys
- , ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xChartModel );
+ , ChartModel& rModel );
bool hasComplexCategories() const;
sal_Int32 getCategoryLevelCount() const;
@@ -113,8 +111,7 @@ private: //member
bool volatile m_bDirty;
::com::sun::star::uno::WeakReference<
::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
- ::com::sun::star::uno::WeakReference<
- ::com::sun::star::frame::XModel > m_xChartModel;
+ ChartModel& mrModel;
::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx
index 98c5ee529cb4..e30297c42b6f 100644
--- a/chart2/source/inc/LegendHelper.hxx
+++ b/chart2/source/inc/LegendHelper.hxx
@@ -23,10 +23,11 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/chart2/XLegend.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include "charttoolsdllapi.hxx"
+#include "ChartModel.hxx"
+
namespace chart
{
@@ -38,18 +39,15 @@ class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper
public:
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XLegend >
- showLegend( const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xModel
+ showLegend( ChartModel& rModel
, const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext );
- static void hideLegend( const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xModel );
+ static void hideLegend( ChartModel& rModel );
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XLegend >
- getLegend( const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xModel
+ getLegend( ChartModel& rModel
, const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext = 0
, bool bCreate = false );
diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx
index 17b7f9c2afef..193e21421701 100644
--- a/chart2/source/inc/ObjectIdentifier.hxx
+++ b/chart2/source/inc/ObjectIdentifier.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include "TitleHelper.hxx"
#include "charttoolsdllapi.hxx"
+#include "ChartModel.hxx"
// header for class OUString
#include <rtl/ustring.hxx>
@@ -104,6 +105,11 @@ public:
static OUString createClassifiedIdentifierForObject(
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface >& xObject
+ , ChartModel& rModel);
+
+ static OUString createClassifiedIdentifierForObject(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xObject
, const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel );
@@ -126,12 +132,22 @@ public:
SAL_DLLPRIVATE static OUString createParticleForDiagram(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram >& xDiagram
+ , ChartModel& rModel);
+
+ SAL_DLLPRIVATE static OUString createParticleForDiagram(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram
, const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel );
static OUString createParticleForCoordinateSystem(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem >& xCooSys
+ , ChartModel& rModel );
+
+ static OUString createParticleForCoordinateSystem(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
, const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel );
@@ -147,6 +163,11 @@ public:
static OUString createParticleForLegend(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XLegend >& xLegend
+ , ChartModel& rModel );
+
+ static OUString createParticleForLegend(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend >& xLegend
, const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel );
diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx
index 36c7a99c1533..f5f299f098ef 100644
--- a/chart2/source/inc/TitleHelper.hxx
+++ b/chart2/source/inc/TitleHelper.hxx
@@ -26,6 +26,8 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
+#include "ChartModel.hxx"
+
namespace chart
{
@@ -52,8 +54,13 @@ public:
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XTitle >
getTitle( eTitleType nTitleIndex
+ , ChartModel& rModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >
+ getTitle( eTitleType nTitleIndex
, const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xModel );
+ ::com::sun::star::frame::XModel >& xModel );
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XTitle >
@@ -81,6 +88,11 @@ public:
static bool getTitleType( eTitleType& rType
, const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XTitle >& xTitle
+ , ChartModel& rModel);
+
+ static bool getTitleType( eTitleType& rType
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& xTitle
, const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xModel );
};
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index 0614ace7438f..5367c199ac5f 100644
--- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -32,6 +32,8 @@
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include "chartviewdllapi.hxx"
+#include "ChartModel.hxx"
+
namespace chart
{
@@ -69,16 +71,14 @@ public:
static ::com::sun::star::awt::Rectangle
addAxisTitleSizes(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xChartModel
+ ChartModel& rModel
, const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface >& xChartView
, const ::com::sun::star::awt::Rectangle& rExcludingPositionAndSize );
static ::com::sun::star::awt::Rectangle
substractAxisTitleSizes(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel >& xChartModel
+ ChartModel& rModel
, const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface >& xChartView
, const ::com::sun::star::awt::Rectangle& rPositionAndSizeIncludingTitles );
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 4741d8c5c052..3eedcfef875d 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -31,6 +31,7 @@
#include "CloneHelper.hxx"
#include "NameContainer.hxx"
#include "UndoManager.hxx"
+#include "ChartView.hxx"
#include <com/sun/star/chart/ChartDataRowSource.hpp>
@@ -91,6 +92,7 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
, m_bModified( sal_False )
, m_nInLoad(0)
, m_bUpdateNotificationsPending(false)
+ , mpChartView(NULL)
, m_pUndoManager( NULL )
, m_aControllers( m_aModelMutex )
, m_nControllerLockCount(0)
@@ -128,6 +130,7 @@ ChartModel::ChartModel( const ChartModel & rOther )
, m_bModified( rOther.m_bModified )
, m_nInLoad(0)
, m_bUpdateNotificationsPending(false)
+ , mpChartView(NULL)
, m_aResource( rOther.m_aResource )
, m_aMediaDescriptor( rOther.m_aMediaDescriptor )
, m_aControllers( m_aModelMutex )
@@ -182,6 +185,8 @@ ChartModel::~ChartModel()
OSL_TRACE( "ChartModel: DTOR called" );
if( m_xOldModelAgg.is())
m_xOldModelAgg->setDelegator( NULL );
+
+ delete mpChartView;
}
void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ )
@@ -1004,7 +1009,7 @@ void SAL_CALL ChartModel::setVisualAreaSize( ::sal_Int64 nAspect, const awt::Siz
{
if( nAspect == embed::Aspects::MSOLE_CONTENT )
{
- ControllerLockGuard aLockGuard( this );
+ ControllerLockGuard aLockGuard( *this );
bool bChanged =
(m_aVisualAreaSize.Width != aSize.Width ||
m_aVisualAreaSize.Height != aSize.Height);
@@ -1193,18 +1198,22 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString
case SERVICE_TRANSP_GRADIENT_TABLE:
case SERVICE_MARKER_TABLE:
{
- uno::Reference< lang::XMultiServiceFactory > xFact(
- this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
- if ( xFact.is() )
- {
- return xFact->createInstance( rServiceSpecifier );
- }
+ if(!mpChartView)
+ mpChartView = new ChartView( m_xContext, *this);
+ return mpChartView->createInstance( rServiceSpecifier );
}
break;
case SERVICE_NAMESPACE_MAP:
return Reference< uno::XInterface >( m_xXMLNamespaceMap );
}
}
+ else if(rServiceSpecifier == CHART_VIEW_SERVICE_NAME)
+ {
+ if(!mpChartView)
+ mpChartView = new ChartView( m_xContext, *this);
+
+ return static_cast< ::cppu::OWeakObject* >( mpChartView );
+ }
else
{
if( m_xOldModelAgg.is() )
@@ -1246,7 +1255,7 @@ Sequence< OUString > SAL_CALL ChartModel::getAvailableServiceNames()
return aResult;
}
-Reference< util::XNumberFormatsSupplier > ChartModel::impl_getNumberFormatsSupplier()
+Reference< util::XNumberFormatsSupplier > ChartModel::getNumberFormatsSupplier()
{
if( !m_xNumberFormatsSupplier.is() )
{
@@ -1268,7 +1277,7 @@ Reference< util::XNumberFormatsSupplier > ChartModel::impl_getNumberFormatsSuppl
if( aIdentifier.getLength() == 16 && 0 == memcmp( SvNumberFormatsSupplierObj::getUnoTunnelId().getConstArray(),
aIdentifier.getConstArray(), 16 ) )
{
- Reference< lang::XUnoTunnel > xTunnel( impl_getNumberFormatsSupplier(), uno::UNO_QUERY );
+ Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier(), uno::UNO_QUERY );
if( xTunnel.is() )
return xTunnel->getSomething( aIdentifier );
}
@@ -1279,7 +1288,7 @@ Reference< util::XNumberFormatsSupplier > ChartModel::impl_getNumberFormatsSuppl
uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getNumberFormatSettings()
throw (uno::RuntimeException)
{
- Reference< util::XNumberFormatsSupplier > xSupplier( impl_getNumberFormatsSupplier() );
+ Reference< util::XNumberFormatsSupplier > xSupplier( getNumberFormatsSupplier() );
if( xSupplier.is() )
return xSupplier->getNumberFormatSettings();
return uno::Reference< beans::XPropertySet >();
@@ -1288,7 +1297,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getNumberFormatSettin
uno::Reference< util::XNumberFormats > SAL_CALL ChartModel::getNumberFormats()
throw (uno::RuntimeException)
{
- Reference< util::XNumberFormatsSupplier > xSupplier( impl_getNumberFormatsSupplier() );
+ Reference< util::XNumberFormatsSupplier > xSupplier( getNumberFormatsSupplier() );
if( xSupplier.is() )
return xSupplier->getNumberFormats();
return uno::Reference< util::XNumberFormats >();
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index eebf278eeb2e..d964ced0d9ff 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -471,7 +471,7 @@ void SAL_CALL ChartModel::initNew()
ASSERT_EXCEPTION( ex );
}
}
- ChartModelHelper::setIncludeHiddenCells( false, this );
+ ChartModelHelper::setIncludeHiddenCells( false, *this );
}
catch( const uno::Exception & ex )
{
diff --git a/chart2/source/model/main/_serviceregistration_model.cxx b/chart2/source/model/main/_serviceregistration_model.cxx
index 95e4d4a3b689..911eb0509a3d 100644
--- a/chart2/source/model/main/_serviceregistration_model.cxx
+++ b/chart2/source/model/main/_serviceregistration_model.cxx
@@ -174,8 +174,6 @@ static const struct ::cppu::ImplementationEntry g_entries_chart2_model[] =
// component exports
extern "C"
{
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL chartview_component_getFactory(
- const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
SAL_DLLPUBLIC_EXPORT void * SAL_CALL charttools_component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
SAL_DLLPUBLIC_EXPORT void * SAL_CALL chartcore_component_getFactory(
@@ -194,12 +192,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL chartcore_component_getFactory(
pImplName, pServiceManager, pRegistryKey);
}
- if (!pResult)
- {
- pResult = chartview_component_getFactory(
- pImplName, pServiceManager, pRegistryKey);
- }
-
return pResult;
}
}
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index 003795bbcbae..cb8c9efab23c 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -96,11 +96,11 @@ bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling )
return bReturn;
}
-chart2::ScaleData AxisHelper::getDateCheckedScale( const Reference< chart2::XAxis >& xAxis, const Reference< frame::XModel >& xChartModel )
+chart2::ScaleData AxisHelper::getDateCheckedScale( const Reference< chart2::XAxis >& xAxis, ChartModel& rModel )
{
OSL_ENSURE(xChartModel.is(),"missing chart model");
ScaleData aScale = xAxis->getScaleData();
- Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
if( aScale.AutoDateAxis && aScale.AxisType == AxisType::CATEGORY )
{
sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
@@ -111,7 +111,7 @@ chart2::ScaleData AxisHelper::getDateCheckedScale( const Reference< chart2::XAxi
}
if( aScale.AxisType == AxisType::DATE )
{
- ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys,xChartModel );
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, rModel );
if( !aExplicitCategoriesProvider.isDateAxis() )
aScale.AxisType = AxisType::CATEGORY;
}
@@ -152,7 +152,9 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
//check whether we have a percent scale -> use percent format
if( xNumberFormatsSupplier.is() )
{
- ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, Reference< frame::XModel >( xNumberFormatsSupplier, uno::UNO_QUERY ) );
+ ChartModel* pModel = dynamic_cast<ChartModel*>( xNumberFormatsSupplier.get() );
+ assert(pModel);
+ ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *pModel );
if( aData.AxisType==AxisType::PERCENT )
{
sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xNumberFormatsSupplier );
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
index b49ca02c8d4b..f50c47c4da7a 100644
--- a/chart2/source/tools/ChartModelHelper.cxx
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -24,6 +24,7 @@
#include "ControllerLockGuard.hxx"
#include "RangeHighlighter.hxx"
#include "InternalDataProvider.hxx"
+#include "ChartModel.hxx"
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
@@ -103,6 +104,19 @@ uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference<
return NULL;
}
+uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( ChartModel& rModel )
+{
+ uno::Reference< XCoordinateSystem > XCooSys;
+ uno::Reference< XCoordinateSystemContainer > xCooSysCnt( rModel.getFirstDiagram(), uno::UNO_QUERY );
+ if( xCooSysCnt.is() )
+ {
+ uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
+ if( aCooSysSeq.getLength() )
+ XCooSys = aCooSysSeq[0];
+ }
+ return XCooSys;
+}
+
uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const uno::Reference< frame::XModel >& xModel )
{
uno::Reference< XCoordinateSystem > XCooSys;
@@ -117,6 +131,18 @@ uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem(
}
::std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
+ ChartModel& rModel )
+{
+ ::std::vector< uno::Reference< XDataSeries > > aResult;
+
+ uno::Reference< XDiagram > xDiagram = rModel.getFirstDiagram();
+ if( xDiagram.is())
+ aResult = DiagramHelper::getDataSeriesFromDiagram( xDiagram );
+
+ return aResult;
+}
+
+::std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
const uno::Reference< XChartDocument > & xChartDoc )
{
::std::vector< uno::Reference< XDataSeries > > aResult;
@@ -202,14 +228,14 @@ bool ChartModelHelper::isIncludeHiddenCells( const uno::Reference< frame::XModel
return bIncluded;
}
-bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, const uno::Reference< frame::XModel >& xChartModel )
+bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, ChartModel& rModel )
{
bool bChanged = false;
try
{
- ControllerLockGuard aLockedControllers( xChartModel );
+ ControllerLockGuard aLockedControllers( rModel );
- uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(xChartModel), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xDiagramProperties( rModel.getFirstDiagram(), uno::UNO_QUERY );
if (xDiagramProperties.is())
{
bool bOldValue = bIncludeHiddenCells;
@@ -223,13 +249,9 @@ bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, const un
try
{
- uno::Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
- if( xChartDoc.is() )
- {
- uno::Reference< beans::XPropertySet > xDataProviderProperties( xChartDoc->getDataProvider(), uno::UNO_QUERY );
- if( xDataProviderProperties.is() )
- xDataProviderProperties->setPropertyValue("IncludeHiddenCells", aNewValue );
- }
+ uno::Reference< beans::XPropertySet > xDataProviderProperties( rModel.getDataProvider(), uno::UNO_QUERY );
+ if( xDataProviderProperties.is() )
+ xDataProviderProperties->setPropertyValue("IncludeHiddenCells", aNewValue );
}
catch( const beans::UnknownPropertyException& )
{
@@ -238,7 +260,7 @@ bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, const un
try
{
- uno::Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( xChartModel ) );
+ uno::Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( rModel ) );
if( xUsedData.is() )
{
uno::Reference< beans::XPropertySet > xProp;
diff --git a/chart2/source/tools/ControllerLockGuard.cxx b/chart2/source/tools/ControllerLockGuard.cxx
index 9487769a7d26..541b35cc0483 100644
--- a/chart2/source/tools/ControllerLockGuard.cxx
+++ b/chart2/source/tools/ControllerLockGuard.cxx
@@ -18,6 +18,7 @@
*/
#include "ControllerLockGuard.hxx"
+#include "ChartModel.hxx"
using namespace ::com::sun::star;
@@ -27,17 +28,26 @@ using ::com::sun::star::uno::Sequence;
namespace chart
{
-ControllerLockGuard::ControllerLockGuard( const Reference< frame::XModel > & xModel ) :
- m_xModel( xModel )
+ControllerLockGuardUNO::ControllerLockGuardUNO( const uno::Reference< frame::XModel >& xModel ) :
+ mxModel( xModel )
{
- if( m_xModel.is())
- m_xModel->lockControllers();
+ mxModel->lockControllers();
+}
+
+ControllerLockGuardUNO::~ControllerLockGuardUNO()
+{
+ mxModel->unlockControllers();
+}
+
+ControllerLockGuard::ControllerLockGuard( ChartModel& rModel ) :
+ mrModel( rModel )
+{
+ mrModel.lockControllers();
}
ControllerLockGuard::~ControllerLockGuard()
{
- if( m_xModel.is())
- m_xModel->unlockControllers();
+ mrModel.unlockControllers();
}
ControllerLockHelper::ControllerLockHelper( const Reference< frame::XModel > & xModel ) :
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
index 4c9690fc6054..ccbbc286b142 100644
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -327,6 +327,32 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
new DataSource( ContainerHelper::ContainerToSequence( aResult )));
}
+uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
+ ChartModel& rModel )
+{
+ ::std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aResult;
+
+ uno::Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
+ uno::Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ if( xCategories.is() )
+ aResult.push_back( xCategories );
+
+ ::std::vector< uno::Reference< XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( rModel ) );
+ for( ::std::vector< uno::Reference< XDataSeries > >::const_iterator aSeriesIt( aSeriesVector.begin() )
+ ; aSeriesIt != aSeriesVector.end(); ++aSeriesIt )
+ {
+ uno::Reference< data::XDataSource > xDataSource( *aSeriesIt, uno::UNO_QUERY );
+ if( !xDataSource.is() )
+ continue;
+ uno::Sequence< uno::Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
+ ::std::copy( aDataSequences.getConstArray(), aDataSequences.getConstArray() + aDataSequences.getLength(),
+ ::std::back_inserter( aResult ));
+ }
+
+ return uno::Reference< chart2::data::XDataSource >(
+ new DataSource( ContainerHelper::ContainerToSequence( aResult )));
+}
+
bool DataSourceHelper::detectRangeSegmentation(
const uno::Reference<
frame::XModel >& xChartModel
@@ -445,7 +471,7 @@ void DataSourceHelper::setRangeSegmentation(
if( !xDataSource.is() )
return;
- ControllerLockGuard aCtrlLockGuard( xChartModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
xDiagram->setDiagramData( xDataSource, aArguments );
}
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 908ede1aa137..6685fe596cf0 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1002,17 +1002,11 @@ Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const
}
Sequence< OUString > DiagramHelper::getExplicitSimpleCategories(
- const Reference< XChartDocument >& xChartDoc )
+ ChartModel& rModel )
{
- Sequence< OUString > aRet;
- uno::Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
- if(xChartModel.is())
- {
- uno::Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
- ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel );
- aRet = aExplicitCategoriesProvider.getSimpleCategories();
- }
- return aRet;
+ uno::Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, rModel );
+ return aExplicitCategoriesProvider.getSimpleCategories();
}
namespace
@@ -1117,7 +1111,7 @@ void DiagramHelper::switchToDateCategories( const Reference< XChartDocument >& x
Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
if(xChartModel.is())
{
- ControllerLockGuard aCtrlLockGuard( xChartModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
if( xCooSys.is() )
@@ -1133,7 +1127,7 @@ void DiagramHelper::switchToTextCategories( const Reference< XChartDocument >& x
Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
if(xChartModel.is())
{
- ControllerLockGuard aCtrlLockGuard( xChartModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
if( xCooSys.is() )
@@ -1622,7 +1616,7 @@ void lcl_ensureRange0to1( double& rValue )
bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >& xChartModel,
const awt::Rectangle& rPosRect /*100th mm*/ )
{
- ControllerLockGuard aCtrlLockGuard( xChartModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
bool bChanged = false;
awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) );
@@ -1695,28 +1689,22 @@ awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference
}
bool DiagramHelper::switchDiagramPositioningToExcludingPositioning(
- const uno::Reference< frame::XModel >& xChartModel
- , bool bResetModifiedState, bool bConvertAlsoFromAutoPositioning )
+ ChartModel& rModel, bool bResetModifiedState, bool bConvertAlsoFromAutoPositioning )
{
//return true if something was changed
const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
if( nCurrentODFVersion > SvtSaveOptions::ODFVER_012 )
{
- uno::Reference< ::com::sun::star::chart::XChartDocument > xOldDoc( xChartModel, uno::UNO_QUERY ) ;
- if( xOldDoc.is() )
- {
- uno::Reference< ::com::sun::star::chart::XDiagramPositioning > xDiagramPositioning( xOldDoc->getDiagram(), uno::UNO_QUERY );
- if( xDiagramPositioning.is() && ( bConvertAlsoFromAutoPositioning || !xDiagramPositioning->isAutomaticDiagramPositioning() )
+ uno::Reference< ::com::sun::star::chart::XDiagramPositioning > xDiagramPositioning( rModel.getFirstDiagram(), uno::UNO_QUERY );
+ if( xDiagramPositioning.is() && ( bConvertAlsoFromAutoPositioning || !xDiagramPositioning->isAutomaticDiagramPositioning() )
&& !xDiagramPositioning->isExcludingDiagramPositioning() )
- {
- ControllerLockGuard aCtrlLockGuard( xChartModel );
- uno::Reference< util::XModifiable > xModifiable( xChartModel, uno::UNO_QUERY );
- bool bModelWasModified = xModifiable.is() && xModifiable->isModified();
- xDiagramPositioning->setDiagramPositionExcludingAxes( xDiagramPositioning->calculateDiagramPositionExcludingAxes() );
- if(bResetModifiedState && !bModelWasModified && xModifiable.is() )
- xModifiable->setModified(sal_False);
- return true;
- }
+ {
+ ControllerLockGuard aCtrlLockGuard( rModel );
+ bool bModelWasModified = rModel.isModified();
+ xDiagramPositioning->setDiagramPositionExcludingAxes( xDiagramPositioning->calculateDiagramPositionExcludingAxes() );
+ if(bResetModifiedState && !bModelWasModified )
+ rModel.setModified(sal_False);
+ return true;
}
}
return false;
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index 315f25f76048..7d57947a3a27 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/frame/XModel.hpp>
namespace chart
{
@@ -42,10 +43,10 @@ using ::com::sun::star::uno::Sequence;
using ::std::vector;
ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2::XCoordinateSystem >& xCooSysModel
- , const uno::Reference< frame::XModel >& xChartModel )
+ , ChartModel& rModel )
: m_bDirty(true)
, m_xCooSysModel( xCooSysModel )
- , m_xChartModel( xChartModel )
+ , mrModel(rModel)
, m_xOriginalCategories()
, m_bIsExplicitCategoriesInited(false)
, m_bIsDateAxis(false)
@@ -67,54 +68,50 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
if( m_xOriginalCategories.is() )
{
- Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
- if( xChartDoc.is() )
+ uno::Reference< data::XDataProvider > xDataProvider( mrModel.getDataProvider() );
+
+ OUString aCategoriesRange( DataSourceHelper::getRangeFromValues( m_xOriginalCategories ) );
+ if( xDataProvider.is() && !aCategoriesRange.isEmpty() )
{
- uno::Reference< data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
+ const bool bFirstCellAsLabel = false;
+ const bool bHasCategories = false;
+ const uno::Sequence< sal_Int32 > aSequenceMapping;
- OUString aCategoriesRange( DataSourceHelper::getRangeFromValues( m_xOriginalCategories ) );
- if( xDataProvider.is() && !aCategoriesRange.isEmpty() )
- {
- const bool bFirstCellAsLabel = false;
- const bool bHasCategories = false;
- const uno::Sequence< sal_Int32 > aSequenceMapping;
+ uno::Reference< data::XDataSource > xColumnCategoriesSource( xDataProvider->createDataSource(
+ DataSourceHelper::createArguments( aCategoriesRange, aSequenceMapping, true /*bUseColumns*/
+ , bFirstCellAsLabel, bHasCategories ) ) );
- uno::Reference< data::XDataSource > xColumnCategoriesSource( xDataProvider->createDataSource(
- DataSourceHelper::createArguments( aCategoriesRange, aSequenceMapping, true /*bUseColumns*/
- , bFirstCellAsLabel, bHasCategories ) ) );
+ uno::Reference< data::XDataSource > xRowCategoriesSource( xDataProvider->createDataSource(
+ DataSourceHelper::createArguments( aCategoriesRange, aSequenceMapping, false /*bUseColumns*/
+ , bFirstCellAsLabel, bHasCategories ) ) );
- uno::Reference< data::XDataSource > xRowCategoriesSource( xDataProvider->createDataSource(
- DataSourceHelper::createArguments( aCategoriesRange, aSequenceMapping, false /*bUseColumns*/
- , bFirstCellAsLabel, bHasCategories ) ) );
+ if( xColumnCategoriesSource.is() && xRowCategoriesSource.is() )
+ {
+ Sequence< Reference< data::XLabeledDataSequence> > aColumns = xColumnCategoriesSource->getDataSequences();
+ Sequence< Reference< data::XLabeledDataSequence> > aRows = xRowCategoriesSource->getDataSequences();
- if( xColumnCategoriesSource.is() && xRowCategoriesSource.is() )
+ sal_Int32 nColumnCount = aColumns.getLength();
+ sal_Int32 nRowCount = aRows.getLength();
+ if( nColumnCount>1 && nRowCount>1 )
{
- Sequence< Reference< data::XLabeledDataSequence> > aColumns = xColumnCategoriesSource->getDataSequences();
- Sequence< Reference< data::XLabeledDataSequence> > aRows = xRowCategoriesSource->getDataSequences();
-
- sal_Int32 nColumnCount = aColumns.getLength();
- sal_Int32 nRowCount = aRows.getLength();
- if( nColumnCount>1 && nRowCount>1 )
+ //we have complex categories
+ //->split them in the direction of the first series
+ //detect whether the first series is a row or a column
+ bool bSeriesUsesColumns = true;
+ ::std::vector< Reference< XDataSeries > > aSeries( ChartModelHelper::getDataSeries( mrModel ) );
+ if( !aSeries.empty() )
{
- //we have complex categories
- //->split them in the direction of the first series
- //detect whether the first series is a row or a column
- bool bSeriesUsesColumns = true;
- ::std::vector< Reference< XDataSeries > > aSeries( ChartModelHelper::getDataSeries( xChartModel ) );
- if( !aSeries.empty() )
- {
- uno::Reference< data::XDataSource > xSeriesSource( aSeries.front(), uno::UNO_QUERY );
- OUString aStringDummy;
- bool bDummy;
- uno::Sequence< sal_Int32 > aSeqDummy;
- DataSourceHelper::readArguments( xDataProvider->detectArguments( xSeriesSource),
- aStringDummy, aSeqDummy, bSeriesUsesColumns, bDummy, bDummy );
- }
- if( bSeriesUsesColumns )
- m_aSplitCategoriesList=aColumns;
- else
- m_aSplitCategoriesList=aRows;
+ uno::Reference< data::XDataSource > xSeriesSource( aSeries.front(), uno::UNO_QUERY );
+ OUString aStringDummy;
+ bool bDummy;
+ uno::Sequence< sal_Int32 > aSeqDummy;
+ DataSourceHelper::readArguments( xDataProvider->detectArguments( xSeriesSource),
+ aStringDummy, aSeqDummy, bSeriesUsesColumns, bDummy, bDummy );
}
+ if( bSeriesUsesColumns )
+ m_aSplitCategoriesList=aColumns;
+ else
+ m_aSplitCategoriesList=aRows;
}
}
}
@@ -175,30 +172,28 @@ std::vector<sal_Int32> lcl_getLimitingBorders( const std::vector< ComplexCategor
return aLimitingBorders;
}
-void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUString >& rOutTexts, const uno::Sequence< uno::Any >& rInAnys, Reference< frame::XModel > xChartModel )
+void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUString >& rOutTexts, const uno::Sequence< uno::Any >& rInAnys, ChartModel& rModel )
{
sal_Int32 nCount = rInAnys.getLength();
if(!nCount)
return;
rOutTexts.realloc(nCount);
- Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
Reference< util::XNumberFormats > xNumberFormats;
- if( xNumberFormatsSupplier.is() )
- xNumberFormats = Reference< util::XNumberFormats >( xNumberFormatsSupplier->getNumberFormats() );
+ xNumberFormats = Reference< util::XNumberFormats >( rModel.getNumberFormats() );
sal_Int32 nAxisNumberFormat = 0;
- Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) );
+ Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
if( xCooSysModel.is() )
{
Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
nAxisNumberFormat = AxisHelper::getExplicitNumberFormatKeyForAxis(
- xAxis, xCooSysModel, xNumberFormatsSupplier, false );
+ xAxis, xCooSysModel, rModel.getNumberFormatsSupplier(), false );
}
sal_Int32 nLabelColor;
bool bColorChanged = false;
- NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+ NumberFormatterWrapper aNumberFormatterWrapper( rModel.getNumberFormatsSupplier() );
for(sal_Int32 nN=0;nN<nCount;nN++)
{
@@ -234,9 +229,9 @@ public:
const ::com::sun::star::uno::Sequence<
::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence> >& rSplitCategoriesList
- , const Reference< frame::XModel >& xChartModel )
+ , ChartModel& rModel )
: m_rSplitCategoriesList( rSplitCategoriesList )
- , m_xChartModel( xChartModel )
+ , mrModel( rModel )
{}
virtual ~SplitCategoriesProvider_ForLabeledDataSequences()
{}
@@ -248,7 +243,7 @@ private:
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence> >& m_rSplitCategoriesList;
- Reference< frame::XModel > m_xChartModel;
+ ChartModel& mrModel;
};
sal_Int32 SplitCategoriesProvider_ForLabeledDataSequences::getLevelCount() const
@@ -263,7 +258,7 @@ uno::Sequence< OUString > SplitCategoriesProvider_ForLabeledDataSequences::getSt
{
uno::Reference< data::XDataSequence > xDataSequence( xLabeledDataSequence->getValues() );
if( xDataSequence.is() )
- ExplicitCategoriesProvider::convertCategoryAnysToText( aRet, xDataSequence->getData(), m_xChartModel );
+ ExplicitCategoriesProvider::convertCategoryAnysToText( aRet, xDataSequence->getData(), mrModel );
}
return aRet;
}
@@ -420,7 +415,7 @@ struct DatePlusIndexComparator
}
};
-bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< DatePlusIndex >& rDateCategories, bool bIsAutoDate, Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier )
+bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataSequence, std::vector< DatePlusIndex >& rDateCategories, bool bIsAutoDate, ChartModel& rModel )
{
bool bOnlyDatesFound = true;
bool bAnyDataFound = false;
@@ -431,17 +426,15 @@ bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& xDataS
sal_Int32 nCount = aValues.getLength();
rDateCategories.reserve(nCount);
Reference< util::XNumberFormats > xNumberFormats;
- if( xNumberFormatsSupplier.is() )
- xNumberFormats = Reference< util::XNumberFormats >( xNumberFormatsSupplier->getNumberFormats() );
+ xNumberFormats = Reference< util::XNumberFormats >( rModel.getNumberFormats() );
bool bOwnData = false;
bool bOwnDataAnddAxisHasAnyFormat = false;
bool bOwnDataAnddAxisHasDateFormat = false;
- Reference< chart2::XChartDocument > xChartDoc( xNumberFormatsSupplier, uno::UNO_QUERY );
- Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ) ) );
- if( xChartDoc.is() && xCooSysModel.is() )
+ Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ if( xCooSysModel.is() )
{
- if( xChartDoc->hasInternalDataProvider() )
+ if( rModel.hasInternalDataProvider() )
{
bOwnData = true;
Reference< beans::XPropertySet > xAxisProps( xCooSysModel->getAxisByDimension(0,0), uno::UNO_QUERY );
@@ -513,7 +506,7 @@ void ExplicitCategoriesProvider::init()
if(m_bIsDateAxis)
{
if( ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ), 2, 0 ) )
- m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, Reference< util::XNumberFormatsSupplier >( m_xChartModel.get(), uno::UNO_QUERY ) );
+ m_bIsDateAxis = lcl_fillDateCategories( m_xOriginalCategories->getValues(), m_aDateCategories, m_bIsAutoDate, mrModel );
else
m_bIsDateAxis = false;
}
@@ -541,12 +534,12 @@ Sequence< OUString > ExplicitCategoriesProvider::getSimpleCategories()
{
uno::Reference< data::XDataSequence > xDataSequence( m_xOriginalCategories->getValues() );
if( xDataSequence.is() )
- ExplicitCategoriesProvider::convertCategoryAnysToText( m_aExplicitCategories, xDataSequence->getData(), m_xChartModel );
+ ExplicitCategoriesProvider::convertCategoryAnysToText( m_aExplicitCategories, xDataSequence->getData(), mrModel );
}
else
{
m_aExplicitCategories = lcl_getExplicitSimpleCategories(
- SplitCategoriesProvider_ForLabeledDataSequences( m_aSplitCategoriesList, m_xChartModel ), m_aComplexCats );
+ SplitCategoriesProvider_ForLabeledDataSequences( m_aSplitCategoriesList, mrModel ), m_aComplexCats );
}
}
if(!m_aExplicitCategories.getLength())
@@ -567,12 +560,12 @@ const std::vector<ComplexCategory>* ExplicitCategoriesProvider::getCategoriesByL
OUString ExplicitCategoriesProvider::getCategoryByIndex(
const Reference< XCoordinateSystem >& xCooSysModel
- , const uno::Reference< frame::XModel >& xChartModel
+ , ChartModel& rModel
, sal_Int32 nIndex )
{
if( xCooSysModel.is())
{
- ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSysModel, xChartModel );
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSysModel, rModel );
Sequence< OUString > aCategories( aExplicitCategoriesProvider.getSimpleCategories());
if( nIndex < aCategories.getLength())
return aCategories[ nIndex ];
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 30d0d52bb332..fe70d7c59066 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -343,7 +343,9 @@ InternalDataProvider::InternalDataProvider(
{
vector< vector< uno::Any > > aNewCategories;//inner count is level
{
- ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), xChartModel );
+ ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
+ assert(pModel);
+ ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), *pModel );
const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx
index 9ee10499fe0a..129a7a71d61f 100644
--- a/chart2/source/tools/LegendHelper.cxx
+++ b/chart2/source/tools/LegendHelper.cxx
@@ -32,10 +32,10 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::XModel >& xModel
+Reference< chart2::XLegend > LegendHelper::showLegend( ChartModel& rModel
, const uno::Reference< uno::XComponentContext >& xContext )
{
- uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, xContext, true );
+ uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( rModel, xContext, true );
uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
if( xProp.is())
{
@@ -63,9 +63,9 @@ Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::X
return xLegend;
}
-void LegendHelper::hideLegend( const Reference< frame::XModel >& xModel )
+void LegendHelper::hideLegend( ChartModel& rModel )
{
- uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, 0, false );
+ uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( rModel, 0, false );
uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
if( xProp.is())
{
@@ -74,38 +74,34 @@ void LegendHelper::hideLegend( const Reference< frame::XModel >& xModel )
}
uno::Reference< chart2::XLegend > LegendHelper::getLegend(
- const uno::Reference< frame::XModel >& xModel
+ ChartModel& rModel
, const uno::Reference< uno::XComponentContext >& xContext
, bool bCreate )
{
uno::Reference< chart2::XLegend > xResult;
- uno::Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- if( xChartDoc.is())
+ try
{
- try
+ uno::Reference< chart2::XDiagram > xDia( rModel.getFirstDiagram());
+ if( xDia.is() )
{
- uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
- if( xDia.is() )
+ xResult.set( xDia->getLegend() );
+ if( bCreate && !xResult.is() && xContext.is() )
{
- xResult.set( xDia->getLegend() );
- if( bCreate && !xResult.is() && xContext.is() )
- {
- xResult.set( xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.chart2.Legend", xContext ), uno::UNO_QUERY );
- xDia->setLegend( xResult );
- }
- }
- else if(bCreate)
- {
- OSL_FAIL("need diagram for creation of legend");
+ xResult.set( xContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.chart2.Legend", xContext ), uno::UNO_QUERY );
+ xDia->setLegend( xResult );
}
}
- catch( const uno::Exception & ex )
+ else if(bCreate)
{
- ASSERT_EXCEPTION( ex );
+ OSL_FAIL("need diagram for creation of legend");
}
}
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
return xResult;
}
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index a5052c938e4f..a6fd0602ebd6 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -327,6 +327,88 @@ bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
const Reference< uno::XInterface >& xObject
+ , ChartModel& rModel)
+{
+ OUString aRet;
+
+ enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
+ OUString aObjectID;
+ OUString aParentParticle;
+ OUString aDragMethodServiceName;
+ OUString aDragParameterString;
+
+ try
+ {
+ //title
+ Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
+ if( xTitle.is() )
+ {
+ TitleHelper::eTitleType aTitleType;
+ if( TitleHelper::getTitleType( aTitleType, xTitle, rModel ) )
+ {
+ eObjectType = OBJECTTYPE_TITLE;
+ aParentParticle = lcl_getTitleParentParticle( aTitleType );
+ aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
+ }
+ return aRet;
+
+ }
+
+ //axis
+ Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
+ if( xAxis.is() )
+ {
+ Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, rModel.getFirstDiagram() ) );
+ OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, rModel ) );
+ sal_Int32 nDimensionIndex=-1;
+ sal_Int32 nAxisIndex=-1;
+ AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
+ OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
+ return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
+ }
+
+ //legend
+ Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
+ if( xLegend.is() )
+ {
+ return createClassifiedIdentifierForParticle( createParticleForLegend( xLegend, rModel ) );
+ }
+
+ //diagram
+ Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
+ if( xDiagram.is() )
+ {
+ return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, rModel ) );
+ }
+
+ //todo
+ //XDataSeries
+ //CooSys
+ //charttype
+ //datapoint?
+ //Gridproperties
+ }
+ catch(const uno::Exception& ex)
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( eObjectType != OBJECTTYPE_UNKNOWN )
+ {
+ aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
+ }
+ else
+ {
+ OSL_FAIL("give object could not be identifed in createClassifiedIdentifierForObject");
+ }
+
+ return aRet;
+}
+
+OUString ObjectIdentifier::createClassifiedIdentifierForObject(
+ const Reference< uno::XInterface >& xObject
, const Reference< frame::XModel >& xChartModel )
{
OUString aRet;
@@ -441,6 +523,15 @@ OUString ObjectIdentifier::createClassifiedIdentifierForParticles(
OUString ObjectIdentifier::createParticleForDiagram(
const Reference< XDiagram >& /*xDiagram*/
+ , ChartModel& /*xChartModel*/ )
+{
+ static OUString aRet("D=0");
+ //todo: if more than one diagram is implemeted, add the correct diagram index here
+ return aRet;
+}
+
+OUString ObjectIdentifier::createParticleForDiagram(
+ const Reference< XDiagram >& /*xDiagram*/
, const Reference< frame::XModel >& /*xChartModel*/ )
{
static OUString aRet("D=0");
@@ -450,6 +541,34 @@ OUString ObjectIdentifier::createParticleForDiagram(
OUString ObjectIdentifier::createParticleForCoordinateSystem(
const Reference< XCoordinateSystem >& xCooSys
+ , ChartModel& rModel )
+{
+ OUStringBuffer aRet;
+
+ Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
+ Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if( xCooSysContainer.is() )
+ {
+ sal_Int32 nCooSysIndex = 0;
+ uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
+ {
+ Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
+ if( xCooSys == xCurrentCooSys )
+ {
+ aRet = ObjectIdentifier::createParticleForDiagram( xDiagram, rModel );
+ aRet.appendAscii(":CS=");
+ aRet.append( OUString::number( nCooSysIndex ) );
+ break;
+ }
+ }
+ }
+
+ return aRet.makeStringAndClear();
+}
+
+OUString ObjectIdentifier::createParticleForCoordinateSystem(
+ const Reference< XCoordinateSystem >& xCooSys
, const Reference< frame::XModel >& xChartModel )
{
OUStringBuffer aRet;
@@ -542,6 +661,23 @@ OUString ObjectIdentifier::createParticleForSeries(
OUString ObjectIdentifier::createParticleForLegend(
const Reference< XLegend >& /*xLegend*/
+ , ChartModel& rModel )
+{
+ OUStringBuffer aRet;
+
+ Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
+ //todo: if more than one diagram is implemeted, find the correct diagram which is owner of the given legend
+
+ aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, rModel ) );
+ aRet.appendAscii(":");
+ aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
+ aRet.appendAscii("=");
+
+ return aRet.makeStringAndClear();
+}
+
+OUString ObjectIdentifier::createParticleForLegend(
+ const Reference< XLegend >& /*xLegend*/
, const Reference< frame::XModel >& xChartModel )
{
OUStringBuffer aRet;
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index d55837e81ba0..26bffc3459aa 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -33,6 +33,8 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
+namespace {
+
uno::Reference< XTitled > lcl_getTitleParentFromDiagram(
TitleHelper::eTitleType nTitleIndex
, const uno::Reference< XDiagram >& xDiagram )
@@ -88,18 +90,13 @@ uno::Reference< XTitled > lcl_getTitleParentFromDiagram(
}
uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex
- , const uno::Reference< frame::XModel >& xModel )
+ , const uno::Reference< XDiagram >& xDiagram )
{
uno::Reference< XTitled > xResult;
- uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- uno::Reference< XDiagram > xDiagram;
- if( xChartDoc.is())
- xDiagram.set( xChartDoc->getFirstDiagram());
-
switch( nTitleIndex )
{
case TitleHelper::MAIN_TITLE:
- xResult.set( xModel, uno::UNO_QUERY );
+ SAL_WARN("chart2", "should not be reached");
break;
case TitleHelper::SUB_TITLE:
case TitleHelper::X_AXIS_TITLE:
@@ -119,10 +116,55 @@ uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleInde
return xResult;
}
+uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex
+ , const uno::Reference< frame::XModel >& xModel )
+{
+ if(nTitleIndex == TitleHelper::MAIN_TITLE)
+ {
+ uno::Reference< XTitled > xTitled( xModel, uno::UNO_QUERY );
+ return xTitled;
+ }
+
+ uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ uno::Reference< XDiagram > xDiagram;
+
+ if( xChartDoc.is())
+ xDiagram.set( xChartDoc->getFirstDiagram());
+
+ return lcl_getTitleParent( nTitleIndex, xDiagram );
+}
+
+}
+
+uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
+ , ChartModel& rModel )
+{
+ if(nTitleIndex == TitleHelper::MAIN_TITLE)
+ return rModel.getTitleObject();
+
+ uno::Reference< XDiagram > xDiagram( rModel.getFirstDiagram(), uno::UNO_QUERY );
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xDiagram ) );
+ if( xTitled.is())
+ return xTitled->getTitleObject();
+ return NULL;
+}
+
uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
, const uno::Reference< frame::XModel >& xModel )
{
- uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) );
+ if(nTitleIndex == TitleHelper::MAIN_TITLE)
+ {
+ uno::Reference< XTitled > xTitled( xModel, uno::UNO_QUERY );
+ return xTitled->getTitleObject();
+ }
+
+ uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ uno::Reference< XDiagram > xDiagram;
+
+ if( xChartDoc.is())
+ xDiagram.set( xChartDoc->getFirstDiagram());
+
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xDiagram ) );
if( xTitled.is())
return xTitled->getTitleObject();
return NULL;
@@ -335,6 +377,28 @@ void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex
bool TitleHelper::getTitleType( eTitleType& rType
, const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XTitle >& xTitle
+ , ChartModel& rModel )
+{
+ if( !xTitle.is() )
+ return false;
+
+ Reference< chart2::XTitle > xCurrentTitle;
+ for( sal_Int32 nTitleType = TITLE_BEGIN; nTitleType < NORMAL_TITLE_END; nTitleType++ )
+ {
+ xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), rModel );
+ if( xCurrentTitle == xTitle )
+ {
+ rType = static_cast<eTitleType>(nTitleType);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool TitleHelper::getTitleType( eTitleType& rType
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle >& xTitle
, const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xModel )
{
diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx
index 805794e37a0e..be0fab624f63 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -52,7 +52,7 @@ public:
sal_Int32 getLength() const;
::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::data::XDataSequence > Model;
+ ::com::sun::star::chart2::data::XDataSequence > Model;
mutable ::com::sun::star::uno::Sequence< double > Doubles;
};
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index ae48bbb4d030..387e840f0d82 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -90,6 +90,7 @@
#include <com/sun/star/drawing/XShapeDescriptor.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
@@ -142,10 +143,11 @@ ExplicitValueProvider* ExplicitValueProvider::getExplicitValueProvider(
}
ChartView::ChartView(
- uno::Reference<uno::XComponentContext> const & xContext)
+ uno::Reference<uno::XComponentContext> const & xContext,
+ ChartModel& rModel)
: m_aMutex()
, m_xCC(xContext)
- , m_xChartModel()
+ , mrChartModel(rModel)
, m_xShapeFactory()
, m_xDrawPage()
, m_pDrawModelWrapper()
@@ -165,15 +167,6 @@ ChartView::ChartView(
{
}
-void ChartView::impl_setChartModel( const uno::Reference< frame::XModel >& xChartModel )
-{
- if( m_xChartModel != xChartModel )
- {
- m_xChartModel = xChartModel;
- m_bViewDirty = true;
- }
-}
-
void SAL_CALL ChartView::initialize( const uno::Sequence< uno::Any >& aArguments )
throw ( uno::Exception, uno::RuntimeException)
{
@@ -181,13 +174,6 @@ void SAL_CALL ChartView::initialize( const uno::Sequence< uno::Any >& aArguments
if( !(aArguments.getLength() >= 1) )
return;
- uno::Reference< frame::XModel > xNewChartModel;
- if( !(aArguments[0] >>= xNewChartModel) )
- {
- OSL_FAIL( "need a Reference to frame::XModel as first parameter for view initialization" );
- }
- impl_setChartModel( xNewChartModel );
-
if( !m_pDrawModelWrapper.get() )
{
SolarMutexGuard aSolarGuard;
@@ -400,7 +386,7 @@ VCoordinateSystem* findInCooSysList( const std::vector< VCoordinateSystem* >& rV
VCoordinateSystem* addCooSysToList( std::vector< VCoordinateSystem* >& rVCooSysList
, const uno::Reference< XCoordinateSystem >& xCooSys
- , const uno::Reference< frame::XModel >& xChartModel )
+ , ChartModel& rChartModel )
{
VCoordinateSystem* pVCooSys = findInCooSysList( rVCooSysList, xCooSys );
if( !pVCooSys )
@@ -408,10 +394,10 @@ VCoordinateSystem* addCooSysToList( std::vector< VCoordinateSystem* >& rVCooSysL
pVCooSys = VCoordinateSystem::createCoordinateSystem(xCooSys );
if(pVCooSys)
{
- OUString aCooSysParticle( ObjectIdentifier::createParticleForCoordinateSystem( xCooSys, xChartModel ) );
+ OUString aCooSysParticle( ObjectIdentifier::createParticleForCoordinateSystem( xCooSys, rChartModel ) );
pVCooSys->setParticle(aCooSysParticle);
- pVCooSys->setExplicitCategoriesProvider( new ExplicitCategoriesProvider(xCooSys,xChartModel) );
+ pVCooSys->setExplicitCategoriesProvider( new ExplicitCategoriesProvider(xCooSys, rChartModel) );
rVCooSysList.push_back( pVCooSys );
}
@@ -527,9 +513,9 @@ public:
SeriesPlotterContainer( std::vector< VCoordinateSystem* >& rVCooSysList );
~SeriesPlotterContainer();
- void initializeCooSysAndSeriesPlotter( const uno::Reference< frame::XModel >& xChartModel );
+ void initializeCooSysAndSeriesPlotter( ChartModel& rModel );
void initAxisUsageList(const Date& rNullDate);
- void doAutoScaling( const uno::Reference< frame::XModel >& xChartModel );
+ void doAutoScaling( ChartModel& rModel );
void updateScalesAndIncrementsOnAxes();
void setScalesFromCooSysToPlotter();
void setNumberFormatsFromAxes();
@@ -539,7 +525,7 @@ public:
std::vector< VCoordinateSystem* >& getCooSysList() { return m_rVCooSysList; }
std::vector< LegendEntryProvider* > getLegendEntryProviderList();
- void AdaptScaleOfYAxisWithoutAttachedSeries( const uno::Reference< frame::XModel >& xChartModel );
+ void AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel );
private:
std::vector< VSeriesPlotter* > m_aSeriesPlotterList;
@@ -583,17 +569,15 @@ std::vector< LegendEntryProvider* > SeriesPlotterContainer::getLegendEntryProvid
}
void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
- const uno::Reference< frame::XModel >& xChartModel )
+ ChartModel& rChartModel )
{
sal_Int32 nDiagramIndex = 0;//todo if more than one diagram is supported
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ uno::Reference< XDiagram > xDiagram( rChartModel.getFirstDiagram() );
if( !xDiagram.is())
return;
- uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
- uno::Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
- if( xChartDoc.is() && xChartDoc->hasInternalDataProvider()
- && DiagramHelper::isSupportingDateAxis( xDiagram ) )
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast< ::cppu::OWeakObject* >( &rChartModel ), uno::UNO_QUERY );
+ if( rChartModel.hasInternalDataProvider() && DiagramHelper::isSupportingDateAxis( xDiagram ) )
m_nDefaultDateNumberFormat=DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier );
sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
@@ -644,7 +628,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
{
uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
- VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,xChartModel);
+ VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,rChartModel);
//iterate through all chart types in the current coordinate system
uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
@@ -918,7 +902,7 @@ void SeriesPlotterContainer::updateScalesAndIncrementsOnAxes()
m_rVCooSysList[nC]->updateScalesAndIncrementsOnAxes();
}
-void SeriesPlotterContainer::doAutoScaling( const uno::Reference< frame::XModel >& xChartModel )
+void SeriesPlotterContainer::doAutoScaling( ChartModel& rChartModel )
{
//precondition: need a initialized m_aSeriesPlotterList
//precondition: need a initialized m_aAxisUsageList
@@ -980,10 +964,10 @@ void SeriesPlotterContainer::doAutoScaling( const uno::Reference< frame::XModel
aVCooSysList_Z[nC]->setExplicitScaleAndIncrement( 2, nAxisIndex, aExplicitScale, aExplicitIncrement );
}
}
- AdaptScaleOfYAxisWithoutAttachedSeries( xChartModel );
+ AdaptScaleOfYAxisWithoutAttachedSeries( rChartModel );
}
-void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( const uno::Reference< frame::XModel >& xChartModel )
+void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel )
{
//issue #i80518#
@@ -999,7 +983,7 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( const uno::
if( !aVCooSysList_Y.size() )
continue;
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ uno::Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
if( xDiagram.is() )
{
bool bSeriesAttachedToThisAxis = false;
@@ -1183,123 +1167,114 @@ bool lcl_IsPieOrDonut( const uno::Reference< XDiagram >& xDiagram )
return DiagramHelper::isPieOrDonutChart( xDiagram );
}
-void lcl_setDefaultWritingMode( ::boost::shared_ptr< DrawModelWrapper > pDrawModelWrapper, const Reference< frame::XModel >& xChartModel )
+void lcl_setDefaultWritingMode( ::boost::shared_ptr< DrawModelWrapper > pDrawModelWrapper, ChartModel& rModel)
{
//get writing mode from parent document:
if( SvtLanguageOptions().IsCTLFontEnabled() )
{
try
{
- uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
sal_Int16 nWritingMode=-1;
- if ( xChild.is() )
+ uno::Reference< beans::XPropertySet > xParentProps( rModel.getParent(), uno::UNO_QUERY );
+ uno::Reference< style::XStyleFamiliesSupplier > xStyleFamiliesSupplier( xParentProps, uno::UNO_QUERY );
+ if( xStyleFamiliesSupplier.is() )
{
- uno::Reference< beans::XPropertySet > xParentProps( xChild->getParent(), uno::UNO_QUERY );
- uno::Reference< style::XStyleFamiliesSupplier > xStyleFamiliesSupplier( xParentProps, uno::UNO_QUERY );
- if( xStyleFamiliesSupplier.is() )
+ uno::Reference< container::XNameAccess > xStylesFamilies( xStyleFamiliesSupplier->getStyleFamilies() );
+ if( xStylesFamilies.is() )
{
- uno::Reference< container::XNameAccess > xStylesFamilies( xStyleFamiliesSupplier->getStyleFamilies() );
- if( xStylesFamilies.is() )
+ if( !xStylesFamilies->hasByName( "PageStyles" ) )
{
- if( !xStylesFamilies->hasByName( "PageStyles" ) )
+ //draw/impress is parent document
+ uno::Reference< lang::XMultiServiceFactory > xFatcory( xParentProps, uno::UNO_QUERY );
+ if( xFatcory.is() )
{
- //draw/impress is parent document
- uno::Reference< lang::XMultiServiceFactory > xFatcory( xParentProps, uno::UNO_QUERY );
- if( xFatcory.is() )
- {
- uno::Reference< beans::XPropertySet > xDrawDefaults( xFatcory->createInstance( "com.sun.star.drawing.Defaults" ), uno::UNO_QUERY );
- if( xDrawDefaults.is() )
- xDrawDefaults->getPropertyValue( "WritingMode" ) >>= nWritingMode;
- }
+ uno::Reference< beans::XPropertySet > xDrawDefaults( xFatcory->createInstance( "com.sun.star.drawing.Defaults" ), uno::UNO_QUERY );
+ if( xDrawDefaults.is() )
+ xDrawDefaults->getPropertyValue( "WritingMode" ) >>= nWritingMode;
}
- else
+ }
+ else
+ {
+ uno::Reference< container::XNameAccess > xPageStyles( xStylesFamilies->getByName( "PageStyles" ), uno::UNO_QUERY );
+ if( xPageStyles.is() )
{
- uno::Reference< container::XNameAccess > xPageStyles( xStylesFamilies->getByName( "PageStyles" ), uno::UNO_QUERY );
- if( xPageStyles.is() )
+ OUString aPageStyle;
+
+ uno::Reference< text::XTextDocument > xTextDocument( xParentProps, uno::UNO_QUERY );
+ if( xTextDocument.is() )
{
- OUString aPageStyle;
+ //writer is parent document
+ //retrieve the current page style from the text cursor property PageStyleName
- uno::Reference< text::XTextDocument > xTextDocument( xParentProps, uno::UNO_QUERY );
- if( xTextDocument.is() )
+ uno::Reference< text::XTextEmbeddedObjectsSupplier > xTextEmbeddedObjectsSupplier( xTextDocument, uno::UNO_QUERY );
+ if( xTextEmbeddedObjectsSupplier.is() )
{
- //writer is parent document
- //retrieve the current page style from the text cursor property PageStyleName
-
- uno::Reference< text::XTextEmbeddedObjectsSupplier > xTextEmbeddedObjectsSupplier( xTextDocument, uno::UNO_QUERY );
- if( xTextEmbeddedObjectsSupplier.is() )
+ uno::Reference< container::XNameAccess > xEmbeddedObjects( xTextEmbeddedObjectsSupplier->getEmbeddedObjects() );
+ if( xEmbeddedObjects.is() )
{
- uno::Reference< container::XNameAccess > xEmbeddedObjects( xTextEmbeddedObjectsSupplier->getEmbeddedObjects() );
- if( xEmbeddedObjects.is() )
- {
- uno::Sequence< OUString > aNames( xEmbeddedObjects->getElementNames() );
+ uno::Sequence< OUString > aNames( xEmbeddedObjects->getElementNames() );
- sal_Int32 nCount = aNames.getLength();
- for( sal_Int32 nN=0; nN<nCount; nN++ )
+ sal_Int32 nCount = aNames.getLength();
+ for( sal_Int32 nN=0; nN<nCount; nN++ )
+ {
+ uno::Reference< beans::XPropertySet > xEmbeddedProps( xEmbeddedObjects->getByName( aNames[nN] ), uno::UNO_QUERY );
+ if( xEmbeddedProps.is() )
{
- uno::Reference< beans::XPropertySet > xEmbeddedProps( xEmbeddedObjects->getByName( aNames[nN] ), uno::UNO_QUERY );
- if( xEmbeddedProps.is() )
+ static OUString aChartCLSID = OUString( SvGlobalName( SO3_SCH_CLASSID ).GetHexName());
+ OUString aCLSID;
+ xEmbeddedProps->getPropertyValue( "CLSID" ) >>= aCLSID;
+ if( aCLSID.equals(aChartCLSID) )
{
- static OUString aChartCLSID = OUString( SvGlobalName( SO3_SCH_CLASSID ).GetHexName());
- OUString aCLSID;
- xEmbeddedProps->getPropertyValue( "CLSID" ) >>= aCLSID;
- if( aCLSID.equals(aChartCLSID) )
+ uno::Reference< text::XTextContent > xEmbeddedObject( xEmbeddedProps, uno::UNO_QUERY );
+ if( xEmbeddedObject.is() )
{
- uno::Reference< frame::XModel > xModel;
- xEmbeddedProps->getPropertyValue( "Model" ) >>= xModel;
- if( xModel == xChartModel )
+ uno::Reference< text::XTextRange > xAnchor( xEmbeddedObject->getAnchor() );
+ if( xAnchor.is() )
{
- uno::Reference< text::XTextContent > xEmbeddedObject( xEmbeddedProps, uno::UNO_QUERY );
- if( xEmbeddedObject.is() )
+ uno::Reference< beans::XPropertySet > xAnchorProps( xAnchor, uno::UNO_QUERY );
+ if( xAnchorProps.is() )
{
- uno::Reference< text::XTextRange > xAnchor( xEmbeddedObject->getAnchor() );
- if( xAnchor.is() )
- {
- uno::Reference< beans::XPropertySet > xAnchorProps( xAnchor, uno::UNO_QUERY );
- if( xAnchorProps.is() )
- {
- xAnchorProps->getPropertyValue( "WritingMode" ) >>= nWritingMode;
- }
- uno::Reference< text::XText > xText( xAnchor->getText() );
- if( xText.is() )
- {
- uno::Reference< beans::XPropertySet > xTextCursorProps( xText->createTextCursor(), uno::UNO_QUERY );
- if( xTextCursorProps.is() )
- xTextCursorProps->getPropertyValue( "PageStyleName" ) >>= aPageStyle;
- }
- }
+ xAnchorProps->getPropertyValue( "WritingMode" ) >>= nWritingMode;
+ }
+ uno::Reference< text::XText > xText( xAnchor->getText() );
+ if( xText.is() )
+ {
+ uno::Reference< beans::XPropertySet > xTextCursorProps( xText->createTextCursor(), uno::UNO_QUERY );
+ if( xTextCursorProps.is() )
+ xTextCursorProps->getPropertyValue( "PageStyleName" ) >>= aPageStyle;
}
- break;
}
}
+ break;
}
}
}
}
- if( aPageStyle.isEmpty() )
- {
- uno::Reference< text::XText > xText( xTextDocument->getText() );
- if( xText.is() )
- {
- uno::Reference< beans::XPropertySet > xTextCursorProps( xText->createTextCursor(), uno::UNO_QUERY );
- if( xTextCursorProps.is() )
- xTextCursorProps->getPropertyValue( "PageStyleName" ) >>= aPageStyle;
- }
- }
- }
- else
- {
- //Calc is parent document
- xParentProps->getPropertyValue( "PageStyle" ) >>= aPageStyle;
- if(aPageStyle.isEmpty())
- aPageStyle = "Default";
}
- if( nWritingMode == -1 || nWritingMode == text::WritingMode2::PAGE )
+ if( aPageStyle.isEmpty() )
{
- uno::Reference< beans::XPropertySet > xPageStyle( xPageStyles->getByName( aPageStyle ), uno::UNO_QUERY );
- if( xPageStyle.is() )
- xPageStyle->getPropertyValue( "WritingMode" ) >>= nWritingMode;
+ uno::Reference< text::XText > xText( xTextDocument->getText() );
+ if( xText.is() )
+ {
+ uno::Reference< beans::XPropertySet > xTextCursorProps( xText->createTextCursor(), uno::UNO_QUERY );
+ if( xTextCursorProps.is() )
+ xTextCursorProps->getPropertyValue( "PageStyleName" ) >>= aPageStyle;
+ }
}
}
+ else
+ {
+ //Calc is parent document
+ xParentProps->getPropertyValue( "PageStyle" ) >>= aPageStyle;
+ if(aPageStyle.isEmpty())
+ aPageStyle = "Default";
+ }
+ if( nWritingMode == -1 || nWritingMode == text::WritingMode2::PAGE )
+ {
+ uno::Reference< beans::XPropertySet > xPageStyle( xPageStyles->getByName( aPageStyle ), uno::UNO_QUERY );
+ if( xPageStyle.is() )
+ xPageStyle->getPropertyValue( "WritingMode" ) >>= nWritingMode;
+ }
}
}
}
@@ -1344,7 +1319,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
awt::Rectangle aUsedOuterRect( rAvailablePos.X, rAvailablePos.Y, 0, 0 );
// sal_Int32 nDiagramIndex = 0;//todo if more than one diagam is supported
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+ uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
if( !xDiagram.is())
return aUsedOuterRect;
@@ -1361,7 +1336,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
const std::vector< VSeriesPlotter* >& rSeriesPlotterList( rSeriesPlotterContainer.getSeriesPlotterList() );
//create VAxis, so they can give necessary information for automatic scaling
- uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( m_xChartModel, uno::UNO_QUERY );
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast< ::cppu::OWeakObject* >( &mrChartModel ), uno::UNO_QUERY );
size_t nC = 0;
for( nC=0; nC < rVCooSysList.size(); nC++)
{
@@ -1381,9 +1356,9 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
}
// - prepare list of all axis and how they are used
- Date aNullDate = NumberFormatterWrapper( uno::Reference< util::XNumberFormatsSupplier >( m_xChartModel, uno::UNO_QUERY ) ).getNullDate();
+ Date aNullDate = NumberFormatterWrapper( xNumberFormatsSupplier ).getNullDate();
rSeriesPlotterContainer.initAxisUsageList(aNullDate);
- rSeriesPlotterContainer.doAutoScaling( m_xChartModel );
+ rSeriesPlotterContainer.doAutoScaling( mrChartModel );
rSeriesPlotterContainer.setScalesFromCooSysToPlotter();
rSeriesPlotterContainer.setNumberFormatsFromAxes();
@@ -1443,7 +1418,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
createTransformationSceneToScreen( aNewInnerRect ) ));
//redo autoscaling to get size and text dependent automatic main increment count
- rSeriesPlotterContainer.doAutoScaling( m_xChartModel );
+ rSeriesPlotterContainer.doAutoScaling( mrChartModel );
rSeriesPlotterContainer.updateScalesAndIncrementsOnAxes();
rSeriesPlotterContainer.setScalesFromCooSysToPlotter();
@@ -1626,7 +1601,7 @@ sal_Bool ChartView::getExplicitValuesForAxis(
if(!xAxis.is())
return sal_False;
- uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(xAxis,ChartModelHelper::findDiagram( m_xChartModel ) ) );
+ uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(xAxis, mrChartModel.getFirstDiagram() ) );
const VCoordinateSystem* pVCooSys = findInCooSysList(m_aVCooSysList,xCooSys);
if(!pVCooSys)
return sal_False;
@@ -1859,24 +1834,24 @@ sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabe
}
awt::Rectangle ExplicitValueProvider::addAxisTitleSizes(
- const Reference< frame::XModel >& xChartModel
+ ChartModel& rModel
, const Reference< uno::XInterface >& xChartView
, const awt::Rectangle& rExcludingPositionAndSize )
{
awt::Rectangle aRet(rExcludingPositionAndSize);
//add axis title sizes to the diagram size
- uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xChartModel ) );
- uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xChartModel ) );
- uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xChartModel ) );
- uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xChartModel ) );
+ uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, rModel ) );
+ uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, rModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, rModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, rModel ) );
if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || xSecondTitle_Width.is() )
{
ExplicitValueProvider* pExplicitValueProvider = ExplicitValueProvider::getExplicitValueProvider(xChartView);
if( pExplicitValueProvider )
{
//detect whether x axis points into x direction or not
- if( lcl_getPropertySwapXAndYAxis( ChartModelHelper::findDiagram( xChartModel ) ) )
+ if( lcl_getPropertySwapXAndYAxis( rModel.getFirstDiagram() ) )
{
std::swap( xTitle_Height, xTitle_Width );
std::swap( xSecondTitle_Height, xSecondTitle_Width );
@@ -1889,28 +1864,28 @@ awt::Rectangle ExplicitValueProvider::addAxisTitleSizes(
if( xTitle_Height.is() )
{
- OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, xChartModel ) );
+ OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, rModel ) );
nTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
if( nTitleSpaceHeight )
nTitleSpaceHeight+=lcl_getDiagramTitleSpace();
}
if( xTitle_Width.is() )
{
- OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, xChartModel ) );
+ OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, rModel ) );
nTitleSpaceWidth = pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
if(nTitleSpaceWidth)
nTitleSpaceWidth+=lcl_getDiagramTitleSpace();
}
if( xSecondTitle_Height.is() )
{
- OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, xChartModel ) );
+ OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, rModel ) );
nSecondTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
if( nSecondTitleSpaceHeight )
nSecondTitleSpaceHeight+=lcl_getDiagramTitleSpace();
}
if( xSecondTitle_Width.is() )
{
- OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, xChartModel ) );
+ OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, rModel ) );
nSecondTitleSpaceWidth += pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
if( nSecondTitleSpaceWidth )
nSecondTitleSpaceWidth+=lcl_getDiagramTitleSpace();
@@ -1926,24 +1901,24 @@ awt::Rectangle ExplicitValueProvider::addAxisTitleSizes(
}
awt::Rectangle ExplicitValueProvider::substractAxisTitleSizes(
- const Reference< frame::XModel >& xChartModel
+ ChartModel& rModel
, const Reference< uno::XInterface >& xChartView
, const awt::Rectangle& rPositionAndSizeIncludingTitles )
{
awt::Rectangle aRet(rPositionAndSizeIncludingTitles);
//add axis title sizes to the diagram size
- uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xChartModel ) );
- uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xChartModel ) );
- uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xChartModel ) );
- uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xChartModel ) );
+ uno::Reference< chart2::XTitle > xTitle_Height( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, rModel ) );
+ uno::Reference< chart2::XTitle > xTitle_Width( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, rModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Height( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, rModel ) );
+ uno::Reference< chart2::XTitle > xSecondTitle_Width( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, rModel ) );
if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || xSecondTitle_Width.is() )
{
ExplicitValueProvider* pExplicitValueProvider = ExplicitValueProvider::getExplicitValueProvider(xChartView);
if( pExplicitValueProvider )
{
//detect whether x axis points into x direction or not
- if( lcl_getPropertySwapXAndYAxis( ChartModelHelper::findDiagram( xChartModel ) ) )
+ if( lcl_getPropertySwapXAndYAxis( rModel.getFirstDiagram() ) )
{
std::swap( xTitle_Height, xTitle_Width );
std::swap( xSecondTitle_Height, xSecondTitle_Width );
@@ -1956,28 +1931,28 @@ awt::Rectangle ExplicitValueProvider::substractAxisTitleSizes(
if( xTitle_Height.is() )
{
- OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, xChartModel ) );
+ OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Height, rModel ) );
nTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
if( nTitleSpaceHeight )
nTitleSpaceHeight+=lcl_getDiagramTitleSpace();
}
if( xTitle_Width.is() )
{
- OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, xChartModel ) );
+ OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle_Width, rModel ) );
nTitleSpaceWidth = pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
if(nTitleSpaceWidth)
nTitleSpaceWidth+=lcl_getDiagramTitleSpace();
}
if( xSecondTitle_Height.is() )
{
- OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, xChartModel ) );
+ OUString aCID_X( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Height, rModel ) );
nSecondTitleSpaceHeight = pExplicitValueProvider->getRectangleOfObject( aCID_X, true ).Height;
if( nSecondTitleSpaceHeight )
nSecondTitleSpaceHeight+=lcl_getDiagramTitleSpace();
}
if( xSecondTitle_Width.is() )
{
- OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, xChartModel ) );
+ OUString aCID_Y( ObjectIdentifier::createClassifiedIdentifierForObject( xSecondTitle_Width, rModel ) );
nSecondTitleSpaceWidth += pExplicitValueProvider->getRectangleOfObject( aCID_Y, true ).Width;
if( nSecondTitleSpaceWidth )
nSecondTitleSpaceWidth+=lcl_getDiagramTitleSpace();
@@ -2122,7 +2097,7 @@ void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment
boost::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
, const uno::Reference< drawing::XShapes>& xPageShapes
, const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
- , const uno::Reference< frame::XModel >& xChartModel
+ , ChartModel& rModel
, awt::Rectangle& rRemainingSpace
, const awt::Size & rPageSize
, TitleAlignment eAlignment
@@ -2150,13 +2125,13 @@ boost::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
nXDistance = nXOffset;
}
- uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, xChartModel ) );
+ uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, rModel ) );
OUString aCompleteString( TitleHelper::getCompleteString( xTitle ) );
if( !aCompleteString.isEmpty() )
{
//create title
apVTitle.reset(new VTitle(xTitle));
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, xChartModel ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, rModel ) );
apVTitle->init(xPageShapes,xShapeFactory,aCID);
apVTitle->createShapes( awt::Point(0,0), rPageSize );
awt::Size aTitleUnrotatedSize = apVTitle->getUnrotatedSize();
@@ -2268,14 +2243,14 @@ bool lcl_createLegend( const uno::Reference< XLegend > & xLegend
, const uno::Reference< uno::XComponentContext > & xContext
, awt::Rectangle & rRemainingSpace
, const awt::Size & rPageSize
- , const uno::Reference< frame::XModel > & xModel
+ , ChartModel& rModel
, const std::vector< LegendEntryProvider* >& rLegendEntryProviderList
, sal_Int16 nDefaultWritingMode )
{
if( VLegend::isVisible( xLegend ))
{
- VLegend aVLegend( xLegend, xContext, rLegendEntryProviderList );
- aVLegend.init( xPageShapes, xShapeFactory, xModel );
+ VLegend aVLegend( xLegend, xContext, rLegendEntryProviderList,
+ xPageShapes, xShapeFactory, rModel);
aVLegend.setDefaultWritingMode( nDefaultWritingMode );
aVLegend.createShapes( awt::Size( rRemainingSpace.Width, rRemainingSpace.Height ),
rPageSize );
@@ -2286,7 +2261,7 @@ bool lcl_createLegend( const uno::Reference< XLegend > & xLegend
}
void formatPage(
- const uno::Reference< frame::XModel > & xModel
+ ChartModel& rChartModel
, const awt::Size rPageSize
, const uno::Reference< drawing::XShapes >& xTarget
, const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
@@ -2294,11 +2269,7 @@ void formatPage(
{
try
{
- uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- OSL_ASSERT( xChartDoc.is());
- if( ! xChartDoc.is())
- return;
- uno::Reference< beans::XPropertySet > xModelPage( xChartDoc->getPageBackground());
+ uno::Reference< beans::XPropertySet > xModelPage( rChartModel.getPageBackground());
if( ! xModelPage.is())
return;
@@ -2371,7 +2342,7 @@ void ChartView::impl_refreshAddIn()
if( !m_bRefreshAddIn )
return;
- uno::Reference< beans::XPropertySet > xProp( m_xChartModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProp( static_cast< ::cppu::OWeakObject* >( &mrChartModel ), uno::UNO_QUERY );
if( xProp.is()) try
{
uno::Reference< util::XRefreshable > xAddIn;
@@ -2412,9 +2383,9 @@ void ChartView::createShapes()
m_pDrawModelWrapper->clearMainDrawPage();
}
- lcl_setDefaultWritingMode( m_pDrawModelWrapper, m_xChartModel );
+ lcl_setDefaultWritingMode( m_pDrawModelWrapper, mrChartModel );
- awt::Size aPageSize = ChartModelHelper::getPageSize( m_xChartModel );
+ awt::Size aPageSize = mrChartModel.getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
uno::Reference<drawing::XShapes> xPageShapes(
@@ -2433,13 +2404,13 @@ void ChartView::createShapes()
// todo: it would be nicer to just pass the page m_xDrawPage and format it,
// but the draw page does not support XPropertySet
- formatPage( m_xChartModel, aPageSize, xPageShapes, m_xShapeFactory );
+ formatPage( mrChartModel, aPageSize, xPageShapes, m_xShapeFactory );
//sal_Int32 nYDistance = static_cast<sal_Int32>(aPageSize.Height*lcl_getPageLayoutDistancePercentage());
awt::Rectangle aRemainingSpace( 0, 0, aPageSize.Width, aPageSize.Height );
//create the group shape for diagram and axes first to have title and legends on top of it
- uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) );
+ uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
OUString aDiagramCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ) );//todo: other index if more than one diagram is possible
uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes(
pShapeFactory->createGroup2D(xPageShapes,aDiagramCID) );
@@ -2456,21 +2427,21 @@ void ChartView::createShapes()
bool bAutoPositionDummy = true;
- lcl_createTitle( TitleHelper::MAIN_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ lcl_createTitle( TitleHelper::MAIN_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
- lcl_createTitle( TitleHelper::SUB_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ lcl_createTitle( TitleHelper::SUB_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
SeriesPlotterContainer aSeriesPlotterContainer( m_aVCooSysList );
- aSeriesPlotterContainer.initializeCooSysAndSeriesPlotter( m_xChartModel );
+ aSeriesPlotterContainer.initializeCooSysAndSeriesPlotter( mrChartModel );
- lcl_createLegend( LegendHelper::getLegend( m_xChartModel ), xPageShapes, m_xShapeFactory, m_xCC
- , aRemainingSpace, aPageSize, m_xChartModel, aSeriesPlotterContainer.getLegendEntryProviderList()
+ lcl_createLegend( LegendHelper::getLegend( mrChartModel ), xPageShapes, m_xShapeFactory, m_xCC
+ , aRemainingSpace, aPageSize, mrChartModel, aSeriesPlotterContainer.getLegendEntryProviderList()
, lcl_getDefaultWritingModeFromPool( m_pDrawModelWrapper ) );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2481,7 +2452,7 @@ void ChartView::createShapes()
bool bAutoPosition_XTitle = true;
boost::shared_ptr<VTitle> apVTitle_X;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 0 ) )
- apVTitle_X = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_X = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xPageShapes, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_BOTTOM, bAutoPosition_XTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2489,7 +2460,7 @@ void ChartView::createShapes()
bool bAutoPosition_YTitle = true;
boost::shared_ptr<VTitle> apVTitle_Y;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 1 ) )
- apVTitle_Y = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_Y = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xPageShapes, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_LEFT, bAutoPosition_YTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2497,7 +2468,7 @@ void ChartView::createShapes()
bool bAutoPosition_ZTitle = true;
boost::shared_ptr<VTitle> apVTitle_Z;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 2 ) )
- apVTitle_Z = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_Z = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, ALIGN_RIGHT, bAutoPosition_ZTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2508,7 +2479,7 @@ void ChartView::createShapes()
bool bAutoPosition_SecondXTitle = true;
boost::shared_ptr<VTitle> apVTitle_SecondX;
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 0 ) )
- apVTitle_SecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_SecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, bIsVertical? ALIGN_RIGHT : ALIGN_TOP, bAutoPosition_SecondXTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2516,7 +2487,7 @@ void ChartView::createShapes()
bool bAutoPosition_SecondYTitle = true;
boost::shared_ptr<VTitle> apVTitle_SecondY;
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 1 ) )
- apVTitle_SecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_SecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xPageShapes, m_xShapeFactory, mrChartModel
, aRemainingSpace, aPageSize, bIsVertical? ALIGN_TOP : ALIGN_RIGHT, bAutoPosition_SecondYTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2525,7 +2496,7 @@ void ChartView::createShapes()
awt::Size aAvailableSizeForDiagram;
bool bUseFixedInnerSize = false;
if( getAvailablePosAndSizeForDiagram( aAvailablePosDia, aAvailableSizeForDiagram, aRemainingSpace, aPageSize
- , ChartModelHelper::findDiagram( m_xChartModel ), bUseFixedInnerSize ) )
+ , mrChartModel.getFirstDiagram(), bUseFixedInnerSize ) )
{
awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent( aSeriesPlotterContainer
, xDiagramPlusAxes_Shapes
@@ -2574,12 +2545,11 @@ void ChartView::createShapes()
void SAL_CALL ChartView::disposing( const lang::EventObject& /* rSource */ )
throw(uno::RuntimeException)
{
- impl_setChartModel( 0 );
}
void ChartView::impl_updateView()
{
- if( !m_xChartModel.is() || !m_pDrawModelWrapper )
+ if( !m_pDrawModelWrapper )
return;
// #i12587# support for shapes in chart
@@ -2663,9 +2633,9 @@ void ChartView::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
return;
// #i12587# support for shapes in chart
- if ( m_bSdrViewIsInEditMode && m_xChartModel.is() )
+ if ( m_bSdrViewIsInEditMode )
{
- uno::Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartModel->getCurrentController(), uno::UNO_QUERY );
+ uno::Reference< view::XSelectionSupplier > xSelectionSupplier( mrChartModel.getCurrentController(), uno::UNO_QUERY );
if ( xSelectionSupplier.is() )
{
OUString aSelObjCID;
@@ -2714,9 +2684,7 @@ void ChartView::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
if(!bShapeChanged)
return;
- Reference< util::XModifiable > xModifiable( m_xChartModel, uno::UNO_QUERY );
- if( xModifiable.is() )
- xModifiable->setModified( sal_True );
+ mrChartModel.setModified(sal_True);
}
void ChartView::impl_notifyModeChangeListener( const OUString& rNewMode )
@@ -2778,7 +2746,7 @@ void SAL_CALL ChartView::update() throw (uno::RuntimeException)
//When a view update is requested (what happens for creating the metafile or displaying
//the chart in edit mode or printing) it is most likely that all necessary information are available - like the underlying spreadsheet data for example.
//Those data is important for the correct axis lable sizes which are needed during conversion.
- if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_xChartModel, true, false ) )
+ if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( mrChartModel, true, false ) )
impl_updateView();
}
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 60872ec74118..cd26ecde2fb0 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -779,23 +779,19 @@ bool lcl_shouldSymbolsBePlacedOnTheLeftSide( const Reference< beans::XPropertySe
VLegend::VLegend(
const Reference< XLegend > & xLegend,
const Reference< uno::XComponentContext > & xContext,
- const std::vector< LegendEntryProvider* >& rLegendEntryProviderList ) :
+ const std::vector< LegendEntryProvider* >& rLegendEntryProviderList,
+ const Reference< drawing::XShapes >& xTargetPage,
+ const Reference< lang::XMultiServiceFactory >& xFactory,
+ ChartModel& rModel ) :
+ m_xTarget(xTargetPage),
+ m_xShapeFactory(xFactory),
m_xLegend( xLegend ),
+ mrModel(rModel),
m_xContext( xContext ),
m_aLegendEntryProviderList( rLegendEntryProviderList )
{
}
-void VLegend::init(
- const Reference< drawing::XShapes >& xTargetPage,
- const Reference< lang::XMultiServiceFactory >& xFactory,
- const Reference< frame::XModel >& xModel )
-{
- m_xTarget = xTargetPage;
- m_xShapeFactory = xFactory;
- m_xModel = xModel;
-}
-
void VLegend::setDefaultWritingMode( sal_Int16 nDefaultWritingMode )
{
m_nDefaultWritingMode = nDefaultWritingMode;
@@ -833,7 +829,7 @@ void VLegend::createShapes(
{
//create shape and add to page
AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
- OUString aLegendParticle( ObjectIdentifier::createParticleForLegend( m_xLegend, m_xModel ) );
+ OUString aLegendParticle( ObjectIdentifier::createParticleForLegend( m_xLegend, mrModel ) );
m_xShape.set( pShapeFactory->createGroup2D( m_xTarget,
ObjectIdentifier::createClassifiedIdentifierForParticle( aLegendParticle )),
uno::UNO_QUERY);
diff --git a/chart2/source/view/main/VLegend.hxx b/chart2/source/view/main/VLegend.hxx
index 0dc5896e6872..cbaaa834c672 100644
--- a/chart2/source/view/main/VLegend.hxx
+++ b/chart2/source/view/main/VLegend.hxx
@@ -26,6 +26,8 @@
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include "ChartModel.hxx"
+
#include <vector>
namespace chart
@@ -43,14 +45,12 @@ public:
::com::sun::star::chart2::XLegend > & xLegend,
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > & xContext,
- const std::vector< LegendEntryProvider* >& rLegendEntryProviderList );
-
- void init( const ::com::sun::star::uno::Reference<
+ const std::vector< LegendEntryProvider* >& rLegendEntryProviderList,
+ const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTargetPage,
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > & xModel );
+ ChartModel& rModel );
void setDefaultWritingMode( sal_Int16 nDefaultWritingMode );
@@ -83,8 +83,9 @@ private:
::com::sun::star::chart2::XLegend > m_xLegend;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape > m_xShape;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > m_xModel;
+
+ ChartModel& mrModel;
+
::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > m_xContext;