summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-04-25 19:49:09 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-04-25 20:02:21 +0200
commita371f5de634195785c9e4b90118049b3c8260ac6 (patch)
tree7aec79a701519f904eafb46210272296fd4f8a5e
parent08299e911131c2850907d9c612950497a8348d2f (diff)
fix missing service factory during import, related fdo#74333, cp#1000057
Change-Id: I2cce561587d82b0434ef2d3e65e5d35b7ff99260
-rw-r--r--chart2/inc/ChartModel.hxx3
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx33
-rw-r--r--chart2/source/model/main/ChartModel.cxx5
3 files changed, 35 insertions, 6 deletions
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index d62628fafd5e..38735d983f6f 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -581,12 +581,15 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
getNumberFormatsSupplier();
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > getChartView();
+
bool isTimeBased() const;
void setTimeBased(bool bTimeBased);
void getNextTimePoint();
void setTimeBasedRange(sal_Int32 nStart, sal_Int32 nEnd);
+private:
sal_Int32 mnStart;
sal_Int32 mnEnd;
bool bSet;
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index f68cd670d1a5..5e27717b8dc2 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1147,6 +1147,24 @@ uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() co
return m_spChart2ModelContact->getDrawPage();
}
+namespace {
+
+uno::Reference< lang::XMultiServiceFactory > getShapeFactory(uno::Reference<uno::XInterface> xChartView)
+{
+ Reference< lang::XUnoTunnel> xUnoTunnel(xChartView,uno::UNO_QUERY);
+ if(xUnoTunnel.is())
+ {
+ ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
+ ExplicitValueProvider::getUnoTunnelId() ));
+ if( pProvider )
+ return pProvider->getDrawModelWrapper()->getShapeFactory();
+
+ }
+ return uno::Reference< lang::XMultiServiceFactory >();
+}
+
+}
+
// ____ XMultiServiceFactory ____
uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
const OUString& aServiceSpecifier )
@@ -1385,15 +1403,18 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
if( !m_xShapeFactory.is() && m_xChartView.is() )
{
- Reference< lang::XUnoTunnel> xUnoTunnel(m_xChartView,uno::UNO_QUERY);
- if(xUnoTunnel.is())
+ m_xShapeFactory = getShapeFactory( m_xChartView );
+ }
+ else
+ {
+ ChartModel* pModel = m_spChart2ModelContact->getModel();
+ if(pModel)
{
- ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
- ExplicitValueProvider::getUnoTunnelId() ));
- if( pProvider )
- m_xShapeFactory.set( pProvider->getDrawModelWrapper()->getShapeFactory() );
+ m_xChartView = pModel->getChartView();
+ m_xShapeFactory = getShapeFactory( m_xChartView );
}
}
+
if( m_xShapeFactory.is() )
{
xResult = m_xShapeFactory->createInstance( aServiceSpecifier );
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 1b725ac05afc..e386d7f41a79 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1402,6 +1402,11 @@ void ChartModel::setTimeBasedRange(sal_Int32 nStart, sal_Int32 nEnd)
mbTimeBased = true;
}
+uno::Reference< uno::XInterface > ChartModel::getChartView()
+{
+ return xChartView;
+}
+
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */