sc/inc/fielduno.hxx | 5 ---- sc/source/ui/unoobj/cellsuno.cxx | 4 +-- sc/source/ui/unoobj/fielduno.cxx | 4 --- sc/source/ui/unoobj/shapeuno.cxx | 2 - sc/source/ui/unoobj/textuno.cxx | 4 +-- starmath/inc/mathml/export.hxx | 5 ++-- starmath/inc/mathml/import.hxx | 5 ++-- starmath/inc/mathml/mathmlimport.hxx | 7 +++-- starmath/source/document.cxx | 4 +-- starmath/source/mathml/export.cxx | 24 ++++++-------------- starmath/source/mathml/import.cxx | 38 +++++++++++--------------------- starmath/source/mathml/mathmlimport.cxx | 18 ++++++--------- starmath/source/view.cxx | 4 +-- 13 files changed, 49 insertions(+), 75 deletions(-)
New commits: commit fc270b8e046d277606255018f6fc165d65beef8a Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jan 20 18:45:02 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jan 23 06:34:02 2023 +0000 XUnoTunnel->dynamic_cast in ScEditFieldObj Change-Id: I6bf89f1a6dc3f7bd1c1934e651e235ba572e83c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145979 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 89160dfa055f..41a0eb6104f4 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -26,7 +26,6 @@ #include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XContainer.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -160,7 +159,6 @@ public: typedef comphelper::WeakComponentImplHelper< css::text::XTextField, css::beans::XPropertySet, - css::lang::XUnoTunnel, css::lang::XServiceInfo> ScEditFieldObj_Base; class ScEditFieldObj final : public ScEditFieldObj_Base { @@ -232,9 +230,6 @@ public: virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; - // XUnoTunnel - UNO3_GETIMPLEMENTATION_DECL(ScEditFieldObj) - // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 9216ba7a4a31..5d44da0d8fca 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6016,7 +6016,7 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRang ScDocShell* pDocSh = GetDocShell(); if ( pDocSh && xContent.is() ) { - ScEditFieldObj* pCellField = comphelper::getFromUnoTunnel<ScEditFieldObj>(xContent); + ScEditFieldObj* pCellField = dynamic_cast<ScEditFieldObj*>(xContent.get()); SvxUnoTextRangeBase* pTextRange = comphelper::getFromUnoTunnel<ScCellTextCursor>( xRange ); if ( pCellField && !pCellField->IsInserted() && pTextRange ) @@ -6066,7 +6066,7 @@ void SAL_CALL ScCellObj::removeTextContent( const uno::Reference<text::XTextCont SolarMutexGuard aGuard; if ( xContent.is() ) { - ScEditFieldObj* pCellField = comphelper::getFromUnoTunnel<ScEditFieldObj>(xContent); + ScEditFieldObj* pCellField = dynamic_cast<ScEditFieldObj*>(xContent.get()); if ( pCellField && pCellField->IsInserted() ) { //! Check if field is in this cell diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 4d14e4139652..96271342c06d 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -1252,10 +1252,6 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const OUString& aPropertyNam SC_IMPL_DUMMY_PROPERTY_LISTENER( ScEditFieldObj ) -// XUnoTunnel - -UNO3_GETIMPLEMENTATION_IMPL(ScEditFieldObj); - // XServiceInfo OUString SAL_CALL ScEditFieldObj::getImplementationName() diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index 257d15f5d9d6..2dfd6ca10701 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -1086,7 +1086,7 @@ void SAL_CALL ScShapeObj::insertTextContent( const uno::Reference<text::XTextRan uno::Reference<text::XTextContent> xEffContent; - ScEditFieldObj* pCellField = comphelper::getFromUnoTunnel<ScEditFieldObj>( xContent ); + ScEditFieldObj* pCellField = dynamic_cast<ScEditFieldObj*>( xContent.get() ); if ( pCellField ) { // createInstance("TextField.URL") from the document creates a ScCellFieldObj. diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index b8056d0c90d1..6102cdb9fac2 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -358,7 +358,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent( SolarMutexGuard aGuard; if ( xContent.is() && xRange.is() ) { - ScEditFieldObj* pHeaderField = comphelper::getFromUnoTunnel<ScEditFieldObj>( xContent ); + ScEditFieldObj* pHeaderField = dynamic_cast<ScEditFieldObj*>( xContent.get() ); SvxUnoTextRangeBase* pTextRange = comphelper::getFromUnoTunnel<ScHeaderFooterTextCursor>( xRange ); @@ -425,7 +425,7 @@ void SAL_CALL ScHeaderFooterTextObj::removeTextContent( SolarMutexGuard aGuard; if ( xContent.is() ) { - ScEditFieldObj* pHeaderField = comphelper::getFromUnoTunnel<ScEditFieldObj>(xContent); + ScEditFieldObj* pHeaderField = dynamic_cast<ScEditFieldObj*>(xContent.get()); if ( pHeaderField && pHeaderField->IsInserted() ) { //! check if the field is in this cell commit a6339b4a281675164034e10a05ca1b62aad89c67 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sun Jan 22 21:24:10 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jan 23 06:33:50 2023 +0000 use more concrete SmModel type Change-Id: I7804e7201e64f419383e37b916b212ac9c129ef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145984 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/starmath/inc/mathml/export.hxx b/starmath/inc/mathml/export.hxx index 0ed354be4b67..08d3f92d06de 100644 --- a/starmath/inc/mathml/export.hxx +++ b/starmath/inc/mathml/export.hxx @@ -33,12 +33,13 @@ class SfxMedium; class SmDocShell; +class SmModel; class SmMLExportWrapper { private: // Model - css::uno::Reference<css::frame::XModel> m_xModel; + rtl::Reference<SmModel> m_xModel; // Save as a flat document ( mml, fodf ... ) bool m_bFlat; // Use html / mathml entities @@ -77,7 +78,7 @@ public: void setUseExportTag(bool bUseExportTag) { m_bUseExportTag = bUseExportTag; } public: - explicit SmMLExportWrapper(css::uno::Reference<css::frame::XModel> xRef) + explicit SmMLExportWrapper(rtl::Reference<SmModel> xRef) : m_xModel(std::move(xRef)) , m_bFlat(true) , m_bUseHTMLMLEntities(false) diff --git a/starmath/inc/mathml/import.hxx b/starmath/inc/mathml/import.hxx index 312768e43f22..18c4334060ba 100644 --- a/starmath/inc/mathml/import.hxx +++ b/starmath/inc/mathml/import.hxx @@ -22,10 +22,11 @@ class SfxMedium; class SmDocShell; class SmMLImport; +class SmModel; class SmMLImportWrapper { - css::uno::Reference<css::frame::XModel> m_xModel; + rtl::Reference<SmModel> m_xModel; SmDocShell* m_pDocShell; SmMLImport* m_pMlImport; @@ -40,7 +41,7 @@ public: public: /** Constructor */ - explicit SmMLImportWrapper(css::uno::Reference<css::frame::XModel> xRef) + explicit SmMLImportWrapper(rtl::Reference<SmModel> xRef) : m_xModel(std::move(xRef)) , m_pDocShell(nullptr) , m_pMlImport(nullptr) diff --git a/starmath/inc/mathml/mathmlimport.hxx b/starmath/inc/mathml/mathmlimport.hxx index c18b587f20b5..efa5c353700f 100644 --- a/starmath/inc/mathml/mathmlimport.hxx +++ b/starmath/inc/mathml/mathmlimport.hxx @@ -34,20 +34,21 @@ namespace beans class XPropertySet; } } +class SmModel; typedef std::deque<std::unique_ptr<SmNode>> SmNodeStack; class SmXMLImportWrapper { - css::uno::Reference<css::frame::XModel> xModel; + rtl::Reference<SmModel> m_xModel; private: // Use customized entities bool m_bUseHTMLMLEntities; public: - explicit SmXMLImportWrapper(css::uno::Reference<css::frame::XModel> xRef) - : xModel(std::move(xRef)) + explicit SmXMLImportWrapper(rtl::Reference<SmModel> xRef) + : m_xModel(std::move(xRef)) , m_bUseHTMLMLEntities(false) { } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 556dbf9d3d78..73b53f675301 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -595,7 +595,7 @@ bool SmDocShell::ConvertFrom(SfxMedium &rMedium) mpTree.reset(); InvalidateCursor(); } - Reference<css::frame::XModel> xModel(GetModel()); + rtl::Reference<SmModel> xModel(dynamic_cast<SmModel*>(GetModel().get())); SmXMLImportWrapper aEquation(xModel); aEquation.useHTMLMLEntities(true); bSuccess = ( ERRCODE_NONE == aEquation.Import(rMedium) ); @@ -656,7 +656,7 @@ bool SmDocShell::Load( SfxMedium& rMedium ) if (xStorage->hasByName("content.xml") && xStorage->isStreamElement("content.xml")) { // is this a fabulous math package ? - Reference<css::frame::XModel> xModel(GetModel()); + rtl::Reference<SmModel> xModel(dynamic_cast<SmModel*>(GetModel().get())); SmXMLImportWrapper aEquation(xModel); auto nError = aEquation.Import(rMedium); bRet = ERRCODE_NONE == nError; diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index c9b7bbf6d41a..bafdd7c431a8 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -76,16 +76,8 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) if (m_xModel == nullptr || xContext == nullptr) return false; - //Get model - uno::Reference<lang::XComponent> xModelComp = m_xModel; - SAL_WARN_IF(xModelComp == nullptr, "starmath", "Missing model component"); - SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel); - SAL_WARN_IF(pModel == nullptr, "starmath", "Failed to get threw uno tunnel"); - if (xModelComp == nullptr || pModel == nullptr) - return false; - // Get doc shell - SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); + SmDocShell* pDocShell = static_cast<SmDocShell*>(m_xModel->GetObjectShell()); if (pDocShell == nullptr) { SAL_WARN("starmath", "Failed to fetch sm document"); @@ -175,7 +167,7 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) if (xStatusIndicator.is()) xStatusIndicator->setValue(1); - bRet = WriteThroughComponentS(xStg, xModelComp, u"meta.xml", xContext, xInfoSet, + bRet = WriteThroughComponentS(xStg, m_xModel, u"meta.xml", xContext, xInfoSet, u"com.sun.star.comp.Math.MLOasisMetaExporter", 6); } @@ -187,10 +179,10 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) xStatusIndicator->setValue(2); if (pDocShell->GetSmSyntaxVersion() == 5) - bRet = WriteThroughComponentS(xStg, xModelComp, u"content.xml", xContext, xInfoSet, + bRet = WriteThroughComponentS(xStg, m_xModel, u"content.xml", xContext, xInfoSet, u"com.sun.star.comp.Math.XMLContentExporter", 5); else - bRet = WriteThroughComponentS(xStg, xModelComp, u"content.xml", xContext, xInfoSet, + bRet = WriteThroughComponentS(xStg, m_xModel, u"content.xml", xContext, xInfoSet, u"com.sun.star.comp.Math.MLContentExporter", 6); } @@ -201,7 +193,7 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) if (xStatusIndicator.is()) xStatusIndicator->setValue(3); - bRet = WriteThroughComponentS(xStg, xModelComp, u"settings.xml", xContext, xInfoSet, + bRet = WriteThroughComponentS(xStg, m_xModel, u"settings.xml", xContext, xInfoSet, u"com.sun.star.comp.Math.MLOasisSettingsExporter", 6); } } @@ -222,10 +214,10 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) // Write everything in the same place // Note: export through an XML exporter component (output stream version) if (pDocShell->GetSmSyntaxVersion() == 5) - bRet = WriteThroughComponentOS(xOut, xModelComp, xContext, xInfoSet, + bRet = WriteThroughComponentOS(xOut, m_xModel, xContext, xInfoSet, u"com.sun.star.comp.Math.XMLContentExporter", 5); else - bRet = WriteThroughComponentOS(xOut, xModelComp, xContext, xInfoSet, + bRet = WriteThroughComponentOS(xOut, m_xModel, xContext, xInfoSet, u"com.sun.star.comp.Math.MLContentExporter", 6); } @@ -248,7 +240,7 @@ OUString SmMLExportWrapper::Export(SmMlElement* pElementTree) //Get model uno::Reference<lang::XComponent> xModelComp = m_xModel; SAL_WARN_IF(xModelComp == nullptr, "starmath", "Missing model component"); - SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel); + SmModel* pModel = m_xModel.get(); SAL_WARN_IF(pModel == nullptr, "starmath", "Failed to get threw uno tunnel"); if (xModelComp == nullptr || pModel == nullptr) return u""; diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index 62cd455ad069..8a0463283286 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -90,19 +90,11 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) return ERRCODE_SFX_DOLOADFAILED; } - // Make a model component from our SmModel - uno::Reference<lang::XComponent> xModelComp = m_xModel; - if (!xModelComp.is()) - { - SAL_WARN("starmath", "Failed to make model while file input"); - return ERRCODE_SFX_DOLOADFAILED; - } - // Try to get an XStatusIndicator from the Medium uno::Reference<task::XStatusIndicator> xStatusIndicator; // Get model via uno - SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel); + SmModel* pModel = m_xModel.get(); if (pModel == nullptr) { SAL_WARN("starmath", "Failed to fetch sm model while file input"); @@ -197,12 +189,12 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) if (!bEmbedded) { if (bOASIS) - nWarn = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"meta.xml", - xContext, xInfoSet, + nWarn = ReadThroughComponentS(rMedium.GetStorage(), m_xModel, u"meta.xml", xContext, + xInfoSet, u"com.sun.star.comp.Math.MLOasisMetaImporter", 6); else nWarn - = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"meta.xml", xContext, + = ReadThroughComponentS(rMedium.GetStorage(), m_xModel, u"meta.xml", xContext, xInfoSet, u"com.sun.star.comp.Math.XMLMetaImporter", 5); } @@ -222,12 +214,12 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) // Read settings // read a component from storage if (bOASIS) - nWarn = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"settings.xml", - xContext, xInfoSet, + nWarn = ReadThroughComponentS(rMedium.GetStorage(), m_xModel, u"settings.xml", xContext, + xInfoSet, u"com.sun.star.comp.Math.MLOasisSettingsImporter", 6); else nWarn - = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"settings.xml", xContext, + = ReadThroughComponentS(rMedium.GetStorage(), m_xModel, u"settings.xml", xContext, xInfoSet, u"com.sun.star.comp.Math.XMLSettingsImporter", 5); // Check if successful @@ -246,13 +238,11 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) // Read document // read a component from storage if (m_pDocShell->GetSmSyntaxVersion() == 5) - nWarn - = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"content.xml", xContext, - xInfoSet, u"com.sun.star.comp.Math.XMLImporter", 5); + nWarn = ReadThroughComponentS(rMedium.GetStorage(), m_xModel, u"content.xml", xContext, + xInfoSet, u"com.sun.star.comp.Math.XMLImporter", 5); else - nWarn - = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"content.xml", xContext, - xInfoSet, u"com.sun.star.comp.Math.MLImporter", 6); + nWarn = ReadThroughComponentS(rMedium.GetStorage(), m_xModel, u"content.xml", xContext, + xInfoSet, u"com.sun.star.comp.Math.MLImporter", 6); // Check if successful if (nWarn != ERRCODE_NONE) { @@ -281,10 +271,10 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) // read a component from input stream ErrCode nError = ERRCODE_NONE; if (m_pDocShell->GetSmSyntaxVersion() == 5) - nError = ReadThroughComponentIS(xInputStream, xModelComp, xContext, xInfoSet, + nError = ReadThroughComponentIS(xInputStream, m_xModel, xContext, xInfoSet, u"com.sun.star.comp.Math.XMLImporter", false, 5); else - nError = ReadThroughComponentIS(xInputStream, xModelComp, xContext, xInfoSet, + nError = ReadThroughComponentIS(xInputStream, m_xModel, xContext, xInfoSet, u"com.sun.star.comp.Math.MLImporter", false, 6); // Finish @@ -325,7 +315,7 @@ ErrCode SmMLImportWrapper::Import(std::u16string_view aSource) } // Get model via uno - SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(m_xModel); + SmModel* pModel = m_xModel.get(); if (pModel == nullptr) { SAL_WARN("starmath", "Failed to fetch sm model while file input"); diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index f31383d076ea..a33a4015846f 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -99,15 +99,13 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); - //Make a model component from our SmModel - uno::Reference<lang::XComponent> xModelComp = xModel; - OSL_ENSURE(xModelComp.is(), "XMLReader::Read: got no model"); + OSL_ENSURE(m_xModel.is(), "XMLReader::Read: got no model"); // try to get an XStatusIndicator from the Medium uno::Reference<task::XStatusIndicator> xStatusIndicator; bool bEmbedded = false; - SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel); + SmModel* pModel = m_xModel.get(); SmDocShell* pDocShell = pModel ? static_cast<SmDocShell*>(pModel->GetObjectShell()) : nullptr; if (pDocShell) @@ -184,7 +182,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) xStatusIndicator->setValue(nSteps++); auto nWarn - = ReadThroughComponent(rMedium.GetStorage(), xModelComp, "meta.xml", xContext, xInfoSet, + = ReadThroughComponent(rMedium.GetStorage(), m_xModel, "meta.xml", xContext, xInfoSet, (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaImporter" : "com.sun.star.comp.Math.XMLMetaImporter"), m_bUseHTMLMLEntities); @@ -194,7 +192,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) if (xStatusIndicator.is()) xStatusIndicator->setValue(nSteps++); - nWarn = ReadThroughComponent(rMedium.GetStorage(), xModelComp, "settings.xml", xContext, + nWarn = ReadThroughComponent(rMedium.GetStorage(), m_xModel, "settings.xml", xContext, xInfoSet, (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsImporter" : "com.sun.star.comp.Math.XMLSettingsImporter"), @@ -206,7 +204,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) xStatusIndicator->setValue(nSteps++); nError = ReadThroughComponent( - rMedium.GetStorage(), xModelComp, "content.xml", xContext, xInfoSet, + rMedium.GetStorage(), m_xModel, "content.xml", xContext, xInfoSet, "com.sun.star.comp.Math.XMLImporter", m_bUseHTMLMLEntities); } else @@ -223,7 +221,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) if (xStatusIndicator.is()) xStatusIndicator->setValue(nSteps++); - nError = ReadThroughComponent(xInputStream, xModelComp, xContext, xInfoSet, + nError = ReadThroughComponent(xInputStream, m_xModel, xContext, xInfoSet, "com.sun.star.comp.Math.XMLImporter", false, m_bUseHTMLMLEntities); } @@ -435,7 +433,7 @@ void SmXMLImport::endDocument() if (pTree && pTree->GetType() == SmNodeType::Table) { uno::Reference<frame::XModel> xModel = GetModel(); - SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel); + SmModel* pModel = dynamic_cast<SmModel*>(xModel.get()); if (pModel) { @@ -2565,7 +2563,7 @@ void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps) if (!xModel.is()) return; - SmModel* pModel = comphelper::getFromUnoTunnel<SmModel>(xModel); + SmModel* pModel = dynamic_cast<SmModel*>(xModel.get()); if (!pModel) return; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 45059c9816b9..1b51c8b71a6e 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1602,7 +1602,7 @@ void SmViewShell::Insert( SfxMedium& rMedium ) if (xStorage->hasByName("content.xml")) { // is this a fabulous math package ? - Reference<css::frame::XModel> xModel(pDoc->GetModel()); + rtl::Reference<SmModel> xModel(dynamic_cast<SmModel*>(pDoc->GetModel().get())); SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !! bRet = ERRCODE_NONE == aEquation.Import(rMedium); } @@ -1639,7 +1639,7 @@ void SmViewShell::InsertFrom(SfxMedium &rMedium) const OUString& rFltName = rMedium.GetFilter()->GetFilterName(); if ( rFltName == MATHML_XML ) { - Reference<css::frame::XModel> xModel(pDoc->GetModel()); + rtl::Reference<SmModel> xModel(dynamic_cast<SmModel*>(pDoc->GetModel().get())); SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !! bSuccess = ERRCODE_NONE == aEquation.Import(rMedium); }