fix missing service factory during import, related fdo#74333, cp#1000057
Change-Id: I2cce561587d82b0434ef2d3e65e5d35b7ff99260
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index d62628f..38735d98 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 f68cd67..5e27717 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 1b725ac..e386d7f4 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: */