diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-18 01:12:00 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-06-18 13:21:01 +0200 |
commit | e062d42f587ad758ecfc42967bf257a9e2e37a3d (patch) | |
tree | c9f73f0dc4863cbedb427c7bd9e593f96e2a0f2e /sc | |
parent | 086c186209e33faa38403c1d9122fd2e90921b3a (diff) |
tdf#39593 Remove ScModelObj::getImplementation
Replace with comphelper::getUnoTunnelImplementation.
Change-Id: I06a8db37b5c5c38c52a15a76e6e2df3b431a2040
Reviewed-on: https://gerrit.libreoffice.org/74237
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
26 files changed, 55 insertions, 54 deletions
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 501028b7340a..b5a5e71b1a60 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -260,7 +260,6 @@ public: virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; static const css::uno::Sequence<sal_Int8>& getUnoTunnelId(); - static ScModelObj* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj); /// XTypeProvider virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 967faaadf13a..8a65609b51b1 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -205,7 +205,7 @@ void ScCopyPasteTest::testTdf84411() // 3. Disable OpenCL - ScModelObj* pModel = ScModelObj::getImplementation(pFoundShell->GetModel()); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pFoundShell->GetModel()); CPPUNIT_ASSERT(pModel != nullptr); bool bOpenCLState = ScCalcConfig::isOpenCLEnabled(); pModel->enableOpenCL(false); diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index aefbcb293d70..059293291eee 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -20,6 +20,7 @@ #include <scitems.hxx> #include <comphelper/fileformat.h> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <tools/urlobj.hxx> #include <editeng/editobj.hxx> #include <editeng/frmdiritem.hxx> @@ -708,7 +709,7 @@ void ScDocument::RepaintRange( const ScRange& rRange ) { if ( bIsVisible && mpShell ) { - ScModelObj* pModel = ScModelObj::getImplementation( mpShell->GetModel() ); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>( mpShell->GetModel() ); if ( pModel ) pModel->RepaintRange( rRange ); // locked repaints are checked there } @@ -718,7 +719,7 @@ void ScDocument::RepaintRange( const ScRangeList& rRange ) { if ( bIsVisible && mpShell ) { - ScModelObj* pModel = ScModelObj::getImplementation( mpShell->GetModel() ); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>( mpShell->GetModel() ); if ( pModel ) pModel->RepaintRange( rRange ); // locked repaints are checked there } diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 7d054c52204c..3f559b285703 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <sot/storage.hxx> #include <vcl/svapp.hxx> #include <svl/stritem.hxx> @@ -291,7 +292,7 @@ SfxObjectShell* XclRoot::GetDocShell() const ScModelObj* XclRoot::GetDocModelObj() const { SfxObjectShell* pDocShell = GetDocShell(); - return pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : nullptr; + return pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr; } OutputDevice* XclRoot::GetPrinter() const diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx index 54c5fdce1f4b..303795ace556 100644 --- a/sc/source/filter/xml/XMLConverter.cxx +++ b/sc/source/filter/xml/XMLConverter.cxx @@ -20,6 +20,7 @@ #include "XMLConverter.hxx" #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/sheet/GeneralFunction2.hpp> +#include <comphelper/servicehelper.hxx> #include <tools/datetime.hxx> #include <sax/tools/converter.hxx> #include <xmloff/xmltoken.hxx> @@ -34,7 +35,7 @@ ScDocument* ScXMLConverter::GetScDocument( const uno::Reference< frame::XModel > { if (xModel.is()) { - ScModelObj* pDocObj = ScModelObj::getImplementation( xModel ); + ScModelObj* pDocObj = comphelper::getUnoTunnelImplementation<ScModelObj>( xModel ); return pDocObj ? pDocObj->GetDocument() : nullptr; } return nullptr; diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx index 3089291f0aa8..21b2abd10917 100644 --- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx +++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx @@ -236,7 +236,7 @@ void XMLTableShapeImportHelper::finishShape( if (!bNote) { // any shape other than a note prevents copying the sheet - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(mrImporter.GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(mrImporter.GetModel())->GetSheetSaveData(); pSheetData->BlockSheet( rTables.GetCurrentSheet() ); } diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx index 0a123090de11..2b9a5886a049 100644 --- a/sc/source/filter/xml/xmlbodyi.cxx +++ b/sc/source/filter/xml/xmlbodyi.cxx @@ -46,6 +46,7 @@ #include <xmloff/xmlnmspe.hxx> #include <comphelper/base64.hxx> +#include <comphelper/servicehelper.hxx> #include <sal/types.h> #include <sal/log.hxx> @@ -120,7 +121,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLBodyContext::createFastChildContext( sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) { - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetScImport().GetModel())->GetSheetSaveData(); if ( pSheetData && pSheetData->HasStartPos() ) { // stream part to copy ends before the next child element @@ -197,7 +198,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL void SAL_CALL ScXMLBodyContext::characters(const OUString &) { - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetScImport().GetModel())->GetSheetSaveData(); if ( pSheetData && pSheetData->HasStartPos() ) { // stream part to copy ends before any content (whitespace) within the spreadsheet element @@ -209,7 +210,7 @@ void SAL_CALL ScXMLBodyContext::characters(const OUString &) void SAL_CALL ScXMLBodyContext::endFastElement(sal_Int32 nElement) { - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetScImport().GetModel())->GetSheetSaveData(); if ( pSheetData && pSheetData->HasStartPos() ) { // stream part to copy ends before the closing tag of spreadsheet element diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 09ae2fe92b0b..586ecf3222c1 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -94,6 +94,8 @@ #include <sal/log.hxx> #include <i18nlangtag/lang.h> +#include <comphelper/servicehelper.hxx> + using namespace com::sun::star; using namespace xmloff::token; @@ -370,7 +372,7 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, cons rFmt.maSelection.nEndPos = nEnd; // Store the used text styles for export. - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(rXMLImport.GetModel())->GetSheetSaveData(); ScAddress aCellPos = rXMLImport.GetTables().GetCurrentCellPos(); pSheetData->AddTextStyle(rStyleName, aCellPos, rFmt.maSelection); @@ -830,7 +832,7 @@ void ScXMLTableRowCellContext::SetContentValidation( const ScRange& rScRange ) // is the below still needed? // For now, any sheet with validity is blocked from stream-copying. // Later, the validation names could be stored along with the style names. - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetImport().GetModel())->GetSheetSaveData(); pSheetData->BlockSheet( GetScImport().GetTables().GetCurrentSheet() ); } } @@ -937,7 +939,7 @@ void ScXMLTableRowCellContext::SetAnnotation(const ScAddress& rPos) } // store the style names for stream copying - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(rXMLImport.GetModel())->GetSheetSaveData(); pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, mxAnnotationData->maTextStyle, rPos ); for (const auto& rContentStyle : mxAnnotationData->maContentStyles) diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index f4271ef75192..97bb79f705a9 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/table/XColumnRowRange.hpp> #include <com/sun/star/sheet/XPrintAreas.hpp> +#include <comphelper/servicehelper.hxx> using namespace com::sun::star; using namespace xmloff::token; @@ -116,7 +117,7 @@ void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 /*nElement*/ ) if ( nSheet != pStyle->GetLastSheet() ) { - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(rXMLImport.GetModel())->GetSheetSaveData(); pSheetData->AddColumnStyle( sStyleName, ScAddress( static_cast<SCCOL>(nCurrentColumn), 0, nSheet ) ); pStyle->SetLastSheet(nSheet); } diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index db6554592668..c4bd8fa8c292 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -444,7 +444,7 @@ void ScXMLExport::SetSourceStream( const uno::Reference<io::XInputStream>& xNewS // keep track of the bytes already read nSourceStreamPos = nRead; - const ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + const ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetSheetSaveData(); if (pSheetData) { // add the loaded namespaces to the name space map @@ -1838,7 +1838,7 @@ const ScXMLEditAttributeMap& ScXMLExport::GetEditAttributeMap() const void ScXMLExport::RegisterDefinedStyleNames( const uno::Reference< css::sheet::XSpreadsheetDocument > & xSpreadDoc ) { - ScFormatSaveData* pFormatData = ScModelObj::getImplementation(xSpreadDoc)->GetFormatSaveData(); + ScFormatSaveData* pFormatData = comphelper::getUnoTunnelImplementation<ScModelObj>(xSpreadDoc)->GetFormatSaveData(); auto xAutoStylePool = GetAutoStylePool(); for (const auto& rFormatInfo : pFormatData->maIDToName) { @@ -1866,7 +1866,7 @@ void ScXMLExport::ExportContent_() if ( !xSpreadDoc.is() ) return; - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(xSpreadDoc)->GetSheetSaveData(); if (pSheetData) pSheetData->ResetSaveEntries(); @@ -2088,7 +2088,7 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x if (nKey) { uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY ); - ScFormatSaveData* pFormatData = ScModelObj::getImplementation(xSpreadDoc)->GetFormatSaveData(); + ScFormatSaveData* pFormatData = comphelper::getUnoTunnelImplementation<ScModelObj>(xSpreadDoc)->GetFormatSaveData(); auto itr = pFormatData->maIDToName.find(nKey); if (itr != pFormatData->maIDToName.end()) { @@ -2254,7 +2254,7 @@ void ScXMLExport::collectAutoStyles() RegisterDefinedStyleNames( xSpreadDoc); // re-create automatic styles with old names from stored data - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(xSpreadDoc)->GetSheetSaveData(); if (pSheetData && pDoc) { // formulas have to be calculated now, to detect changed results @@ -5097,7 +5097,7 @@ void ScXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps) { rProps.realloc(4); beans::PropertyValue* pProps(rProps.getArray()); - ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() )); + ScModelObj* pDocObj(comphelper::getUnoTunnelImplementation<ScModelObj>( GetModel() )); if (pDocObj) { SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject(); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index ba67f06b2f75..36176b87e56b 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1064,7 +1064,7 @@ void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aVi } if (nHeight && nWidth && GetModel().is()) { - ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() )); + ScModelObj* pDocObj(comphelper::getUnoTunnelImplementation<ScModelObj>( GetModel() )); if (pDocObj) { SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject(); @@ -1364,7 +1364,7 @@ void ScXMLImport::SetStyleToRanges() sal_uInt64 nKey = 0; if ((aAny >>= nKey) && nKey) { - ScFormatSaveData* pFormatSaveData = ScModelObj::getImplementation(GetModel())->GetFormatSaveData(); + ScFormatSaveData* pFormatSaveData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetFormatSaveData(); pFormatSaveData->maIDToName.insert(std::pair<sal_uInt64, OUString>(nKey, sPrevStyleName)); } @@ -1376,7 +1376,7 @@ void ScXMLImport::SetStyleToRanges() const table::CellRangeAddress& rRange = aAddresses[0]; if ( rRange.Sheet != pStyle->GetLastSheet() ) { - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetSheetSaveData(); pSheetData->AddCellStyle( sPrevStyleName, ScAddress( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), static_cast<SCTAB>(rRange.Sheet) ) ); pStyle->SetLastSheet(rRange.Sheet); @@ -1502,7 +1502,7 @@ void SAL_CALL ScXMLImport::startDocument() SvXMLImport::startDocument(); if (pDoc && !pDoc->IsImportingXML()) { - ScModelObj::getImplementation(GetModel())->BeforeXMLLoading(); + comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->BeforeXMLLoading(); bSelfImportingXMLSet = true; } @@ -1517,7 +1517,7 @@ void SAL_CALL ScXMLImport::startDocument() if (GetModel().is()) { // store initial namespaces, to find the ones that were added from the file later - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetSheetSaveData(); const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap(); pSheetData->StoreInitialNamespaces(rNamespaces); } @@ -1768,7 +1768,7 @@ void SAL_CALL ScXMLImport::endDocument() { // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results // in UpdateRowHeights can already clear the flags again) - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetSheetSaveData(); SCTAB nTabCount = pDoc->GetTableCount(); for (SCTAB nTab=0; nTab<nTabCount; ++nTab) @@ -1814,7 +1814,7 @@ void SAL_CALL ScXMLImport::endDocument() } if(pDoc && bSelfImportingXMLSet) - ScModelObj::getImplementation(GetModel())->AfterXMLLoading(); + comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->AfterXMLLoading(); } // XEventListener diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index e0b6480a7fb3..eff02d8b6cc5 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/table/XColumnRowRange.hpp> #include <com/sun/star/sheet/XPrintAreas.hpp> +#include <comphelper/servicehelper.hxx> #include <osl/diagnose.h> #define SC_ISFILTERED "IsFiltered" @@ -173,7 +174,7 @@ void SAL_CALL ScXMLTableRowContext::endFastElement(sal_Int32 /*nElement*/) if ( nSheet != pStyle->GetLastSheet() ) { - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(rXMLImport.GetModel())->GetSheetSaveData(); pSheetData->AddRowStyle( sStyleName, ScAddress( 0, static_cast<SCROW>(nFirstRow), nSheet ) ); pStyle->SetLastSheet(nSheet); } diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 72555fc3321c..d3d2ac76e1c1 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -1034,7 +1034,7 @@ void ScCellTextStyleContext::FillPropertySet( const uno::Reference<beans::XPrope { ESelection aSel = pCellImp->GetSelection(); - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetImport().GetModel())->GetSheetSaveData(); pSheetData->AddTextStyle( GetName(), aPos, aSel ); nLastSheet = aPos.Tab(); diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index 1dea576a3e75..7e7455dc1477 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -33,6 +33,7 @@ #include <osl/diagnose.h> #include <comphelper/base64.hxx> +#include <comphelper/servicehelper.hxx> #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> @@ -153,7 +154,7 @@ void ScMyTables::SetTableStyle(const OUString& sStyleName) { pStyle->FillPropertySet(xProperties); - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rImport.GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(rImport.GetModel())->GetSheetSaveData(); pSheetData->AddTableStyle( sStyleName, ScAddress( 0, 0, maCurrentCellPos.Tab() ) ); } } diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx index ce006dc9e399..367fe65efb2f 100644 --- a/sc/source/filter/xml/xmltabi.cxx +++ b/sc/source/filter/xml/xmltabi.cxx @@ -43,6 +43,7 @@ #include <tools/urlobj.hxx> #include <sax/fastattribs.hxx> +#include <comphelper/servicehelper.hxx> using namespace com::sun::star; using namespace xmloff::token; @@ -418,7 +419,7 @@ void SAL_CALL ScXMLTableContext::endFastElement(sal_Int32 /*nElement*/) // store stream positions if (!pExternalRefInfo && nStartOffset >= 0 /* && nEndOffset >= 0 */) { - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rImport.GetModel())->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(rImport.GetModel())->GetSheetSaveData(); SCTAB nTab = rTables.GetCurrentSheet(); // pSheetData->AddStreamPos( nTab, nStartOffset, nEndOffset ); pSheetData->StartStreamPos( nTab, nStartOffset ); diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 71ed6ac6345d..5c0fcf636046 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -687,7 +687,7 @@ bool ScXMLImportWrapper::ExportToComponent(const uno::Reference<uno::XComponentC // #i108978# If an embedded object is saved and no events are notified, don't use the stream // because without the ...DONE events, stream positions aren't updated. - ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xModel)->GetSheetSaveData(); + ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(xModel)->GetSheetSaveData(); if (pSheetData && pSheetData->IsInSupportedSave()) { try diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 48b0532f73a7..9f9741db2add 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -800,7 +800,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) // check if shared flag is set in shared file bool bShared = false; - ScModelObj* pDocObj = ScModelObj::getImplementation( xModel ); + ScModelObj* pDocObj = comphelper::getUnoTunnelImplementation<ScModelObj>( xModel ); ScDocShell* pSharedDocShell = ( pDocObj ? dynamic_cast< ScDocShell* >( pDocObj->GetObjectShell() ) : nullptr ); if ( pSharedDocShell ) { diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index e2d14daf4220..c036b3ea496b 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1017,7 +1017,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) // check if shared flag is set in shared file bool bShared = false; - ScModelObj* pDocObj = ScModelObj::getImplementation( xModel ); + ScModelObj* pDocObj = comphelper::getUnoTunnelImplementation<ScModelObj>( xModel ); if ( pDocObj ) { ScDocShell* pDocShell = dynamic_cast< ScDocShell* >( pDocObj->GetEmbeddedObject() ); diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 99ce6a6d12c9..a29abd774958 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -512,7 +512,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) if ( bCopy && pDocument && pPage ) { ScDocShell* pDocShell = rViewData.GetDocShell(); - ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : nullptr ); + ScModelObj* pModelObj = ( pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr ); if ( pModelObj ) { SCTAB nTab = rViewData.GetTabNo(); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 1a339d3d9552..375d84378eb9 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -25,6 +25,7 @@ #include <sfx2/sfxmodelfactory.hxx> #include <sfx2/viewsh.hxx> #include <o3tl/deleter.hxx> +#include <comphelper/servicehelper.hxx> #include <scdllapi.h> #include <document.hxx> @@ -467,7 +468,7 @@ namespace HelperNotifyChanges { inline ScModelObj* getMustPropagateChangesModel(const ScDocShell &rDocShell) { - ScModelObj* pModelObj = ScModelObj::getImplementation(rDocShell.GetModel()); + ScModelObj* pModelObj = comphelper::getUnoTunnelImplementation<ScModelObj>(rDocShell.GetModel()); if (pModelObj && pModelObj->HasChangesListeners()) return pModelObj; return nullptr; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 4ceb2c03f711..56ace0ee0a74 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1539,7 +1539,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, } } } - else if ( ScModelObj::getImplementation( xInterface ) == this ) + else if ( comphelper::getUnoTunnelImplementation<ScModelObj>( xInterface ) == this ) { // render the whole document // -> no selection, all sheets @@ -2925,15 +2925,6 @@ const uno::Sequence<sal_Int8>& ScModelObj::getUnoTunnelId() return theScModelObjUnoTunnelId::get().getSeq(); } -ScModelObj* ScModelObj::getImplementation(const uno::Reference<uno::XInterface>& rObj) -{ - ScModelObj* pRet = nullptr; - uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast<ScModelObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} - // XChangesNotifier void ScModelObj::addChangesListener( const uno::Reference< util::XChangesListener >& aListener ) @@ -3595,7 +3586,7 @@ sal_Int32 ScTableSheetsObj::importSheet( // Source document docShell if ( !xDocSrc.is() ) throw uno::RuntimeException(); - ScModelObj* pObj = ScModelObj::getImplementation(xDocSrc); + ScModelObj* pObj = comphelper::getUnoTunnelImplementation<ScModelObj>(xDocSrc); ScDocShell* pDocShellSrc = static_cast<ScDocShell*>(pObj->GetEmbeddedObject()); // SourceSheet Position and does srcName exists ? diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index b13234bd2adb..0a3c0c3d8893 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2546,7 +2546,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) if (nEndRow > aViewData.GetMaxTiledRow() - nVisibleRows) { ScDocShell* pDocSh = aViewData.GetDocShell(); - ScModelObj* pModelObj = pDocSh ? ScModelObj::getImplementation( pDocSh->GetModel() ) : nullptr; + ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ) : nullptr; Size aOldSize(0, 0); if (pModelObj) aOldSize = pModelObj->getDocumentSize(); @@ -2688,7 +2688,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) if (nEndCol > aViewData.GetMaxTiledCol() - nVisibleCols) { ScDocShell* pDocSh = aViewData.GetDocShell(); - ScModelObj* pModelObj = pDocSh ? ScModelObj::getImplementation( pDocSh->GetModel() ) : nullptr; + ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ) : nullptr; Size aOldSize(0, 0); if (pModelObj) aOldSize = pModelObj->getDocumentSize(); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 03f1067638a2..adfa1230ec5c 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -389,7 +389,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (nPosX > aViewData.GetMaxTiledCol() - 10 || nPosY > aViewData.GetMaxTiledRow() - 25) { ScDocShell* pDocSh = aViewData.GetDocShell(); - ScModelObj* pModelObj = pDocSh ? ScModelObj::getImplementation( pDocSh->GetModel() ) : nullptr; + ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ) : nullptr; Size aOldSize(0, 0); if (pModelObj) aOldSize = pModelObj->getDocumentSize(); diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index fcf4e9b91f43..7ab18e937d02 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -323,7 +323,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) if (comphelper::LibreOfficeKit::isActive()) { ScDocShell* pDocSh = GetViewData().GetDocShell(); - ScModelObj* pModelObj = pDocSh ? ScModelObj::getImplementation( pDocSh->GetModel()) : nullptr; + ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel()) : nullptr; if (pModelObj) { diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 46bb690d19b8..b2911cabcc9e 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1441,7 +1441,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, if ( nFlags & InsertDeleteFlags::OBJECTS ) { - ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() ); + ScModelObj* pModelObj = comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ); if ( pPage && pModelObj ) { bool bSameDoc = ( rClipParam.getSourceDocID() == pDoc->GetDocumentID() ); diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 3466beca42d1..b128516379ff 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -182,7 +182,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, ScDocument* pDocument = GetViewData().GetDocument(); ScDocShell* pDocShell = GetViewData().GetDocShell(); - ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : nullptr ); + ScModelObj* pModelObj = ( pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr ); if ( pDocument && pDestPage && pModelObj && pDrawTrans ) { const ScRangeListVector& rProtectedChartRangesVector( pDrawTrans->GetProtectedChartRangesVector() ); @@ -251,7 +251,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, ScDocument* pDocument = GetViewData().GetDocument(); ScDocShell* pDocShell = GetViewData().GetDocShell(); - ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : nullptr ); + ScModelObj* pModelObj = ( pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr ); const ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin())); if ( pDocument && pPage && pModelObj && ( pTransferObj || pDrawTrans ) ) { |