diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2025-03-07 14:55:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2025-03-07 17:30:50 +0100 |
commit | a0f4f4b5e476fa5c3c64fcdc2e3cb473969703f7 (patch) | |
tree | 9ce118676ccaca0a97d1bcf61743323930906f97 | |
parent | a0ac8d313c9e8469b4545f5d4fc30894a3719004 (diff) |
use more concrete UNO in sc
Change-Id: Id339156cd7f9b74985575a200ed3946c6d3e5d8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182622
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
-rw-r--r-- | sc/inc/PivotTableDataProvider.hxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dpsave.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 38 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/AccessibleSpreadsheet.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/PivotTableDataProvider.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaaxis.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaformatconditions.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/vba/vbaformatconditions.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/vba/vbanames.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 4 |
13 files changed, 61 insertions, 68 deletions
diff --git a/sc/inc/PivotTableDataProvider.hxx b/sc/inc/PivotTableDataProvider.hxx index a1df012ccad1..17442949b1bc 100644 --- a/sc/inc/PivotTableDataProvider.hxx +++ b/sc/inc/PivotTableDataProvider.hxx @@ -35,6 +35,7 @@ namespace sc { struct ValueAndFormat; +class PivotTableDataSequence; typedef cppu::WeakImplHelper<css::chart2::data::XDataProvider, css::chart2::data::XPivotTableDataProvider, @@ -147,11 +148,11 @@ private: css::uno::Reference<css::chart2::data::XLabeledDataSequence> newLabeledDataSequence(); - css::uno::Reference<css::chart2::data::XDataSequence> assignLabelsToDataSequence(size_t nIndex); + rtl::Reference<PivotTableDataSequence> assignLabelsToDataSequence(size_t nIndex); - css::uno::Reference<css::chart2::data::XDataSequence> assignValuesToDataSequence(size_t nIndex); + rtl::Reference<PivotTableDataSequence> assignValuesToDataSequence(size_t nIndex); - css::uno::Reference<css::chart2::data::XDataSequence> assignFirstCategoriesToDataSequence(); + rtl::Reference<PivotTableDataSequence> assignFirstCategoriesToDataSequence(); void collectPivotTableData(); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index c96ccaa7de74..512a4a52cbb3 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -2039,7 +2039,7 @@ void ScDPObject::ToggleDetails(const DataPilotTableHeaderData& rElemDesc, ScDPOb // query old state tools::Long nHierCount = 0; - uno::Reference<container::XIndexAccess> xHiers; + rtl::Reference<ScNameToIndexAccess> xHiers; uno::Reference<sheet::XHierarchiesSupplier> xHierSupp( xDim, uno::UNO_QUERY ); if ( xHierSupp.is() ) { @@ -2054,7 +2054,7 @@ void ScDPObject::ToggleDetails(const DataPilotTableHeaderData& rElemDesc, ScDPOb if ( !xHier.is() ) return; tools::Long nLevCount = 0; - uno::Reference<container::XIndexAccess> xLevels; + rtl::Reference<ScNameToIndexAccess> xLevels; uno::Reference<sheet::XLevelsSupplier> xLevSupp( xHier, uno::UNO_QUERY ); if ( xLevSupp.is() ) { diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index 6e1d5c56f085..82494c99431b 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -517,7 +517,7 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD tools::Long nCount = maMemberHash.size(); tools::Long nHierCount = 0; - uno::Reference<container::XIndexAccess> xHiers; + rtl::Reference<ScNameToIndexAccess> xHiers; uno::Reference<sheet::XHierarchiesSupplier> xHierSupp( xDim, uno::UNO_QUERY ); if ( xHierSupp.is() ) { @@ -530,7 +530,7 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD for (tools::Long nHier=0; nHier<nHierCount; nHier++) { tools::Long nLevCount = 0; - uno::Reference<container::XIndexAccess> xLevels; + rtl::Reference<ScNameToIndexAccess> xLevels; uno::Reference<sheet::XLevelsSupplier> xLevSupp(xHiers->getByIndex(nHier), uno::UNO_QUERY); if ( xLevSupp.is() ) { diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index e41e3ece60c4..aa139c4f6d06 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -5321,7 +5321,7 @@ void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& } bool bVBACompat = false; - uno::Reference <container::XNameAccess> xCodeNameAccess; + rtl::Reference<XMLCodeNameProvider> xCodeNameAccess; OSL_ENSURE( pDoc, "ScXMLExport::GetConfigurationSettings - no ScDocument!" ); // tdf#71271 - add code names regardless of VBA compatibility mode if (pDoc) @@ -5359,7 +5359,7 @@ void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& if( xCodeNameAccess.is() ) { pProps[nCount].Name = "ScriptConfiguration"; - pProps[nCount].Value <<= xCodeNameAccess; + pProps[nCount].Value <<= uno::Reference<container::XNameAccess>(xCodeNameAccess); ++nCount; } } diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 0bad15e85566..f418ca2d2bb9 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -597,24 +597,24 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint { CommitFocusCell(aNewCell); } - uno::Reference< XAccessible > xChild ; + rtl::Reference< ScAccessibleCell > xChild ; if (bNewPosCellFocus) { - xChild = mpAccCell.get(); + xChild = mpAccCell; } else { mpAccCell = GetAccessibleCellAt(aNewCell.Row(),aNewCell.Col()); - xChild = mpAccCell.get(); + xChild = mpAccCell; maActiveCell = aNewCell; aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS; - aEvent.NewValue <<= xChild; + aEvent.NewValue <<= uno::Reference< XAccessible >(xChild); aEvent.OldValue <<= uno::Reference< XAccessible >(); CommitChange(aEvent); } aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; - aEvent.NewValue <<= xChild; + aEvent.NewValue <<= uno::Reference< XAccessible >(xChild); CommitChange(aEvent); OSL_ASSERT(m_mapSelectionSend.count(aNewCell) == 0 ); m_mapSelectionSend.emplace(aNewCell,xChild); @@ -645,15 +645,15 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint { for(const auto& rAddr : vecNew) { - uno::Reference< XAccessible > xChild = getAccessibleCellAt(rAddr.Row(),rAddr.Col()); + rtl::Reference< ScAccessibleCell > xChild = GetAccessibleCellAt(rAddr.Row(),rAddr.Col()); if (!(bNewPosCellFocus && rAddr == aNewCell) ) { aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS; - aEvent.NewValue <<= xChild; + aEvent.NewValue <<= uno::Reference< XAccessible >(xChild); CommitChange(aEvent); } aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; - aEvent.NewValue <<= xChild; + aEvent.NewValue <<= uno::Reference< XAccessible >(xChild); CommitChange(aEvent); m_mapSelectionSend.emplace(rAddr,xChild); } @@ -757,7 +757,7 @@ void ScAccessibleSpreadsheet::RemoveSelection(const ScMarkData &refScMarkData) continue; } aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE; - aEvent.NewValue <<= miRemove->second; + aEvent.NewValue <<= uno::Reference< XAccessible >(miRemove->second); CommitChange(aEvent); miRemove = m_mapSelectionSend.erase(miRemove); } @@ -1576,13 +1576,13 @@ void ScAccessibleSpreadsheet::NotifyRefMode() aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; aEvent.OldValue <<= uno::Reference<XAccessible>(m_pAccFormulaCell); m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(), aFormulaAddr.Col()); - uno::Reference< XAccessible > xNew = m_pAccFormulaCell; - aEvent.NewValue <<= xNew; + rtl::Reference< ScAccessibleCell > xNew = m_pAccFormulaCell; + aEvent.NewValue <<= uno::Reference< XAccessible >(xNew); CommitChange(aEvent); if (nRefStartX == nRefEndX && nRefStartY == nRefEndY) {//Selection Single aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; - aEvent.NewValue <<= xNew; + aEvent.NewValue <<= uno::Reference< XAccessible >(xNew); CommitChange(aEvent); m_mapFormulaSelectionSend.emplace(aFormulaAddr,xNew); m_vecFormulaLastMyAddr.clear(); @@ -1617,20 +1617,20 @@ void ScAccessibleSpreadsheet::NotifyRefMode() { for(const auto& rAddr : vecNew) { - uno::Reference< XAccessible > xChild; + rtl::Reference< ScAccessibleCell > xChild; if (rAddr == aFormulaAddr) { - xChild = m_pAccFormulaCell.get(); + xChild = m_pAccFormulaCell; } else { - xChild = getAccessibleCellAt(rAddr.Row(),rAddr.Col()); + xChild = GetAccessibleCellAt(rAddr.Row(),rAddr.Col()); aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS; - aEvent.NewValue <<= xChild; + aEvent.NewValue <<= uno::Reference< XAccessible >(xChild); CommitChange(aEvent); } aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; - aEvent.NewValue <<= xChild; + aEvent.NewValue <<= uno::Reference< XAccessible >(xChild); CommitChange(aEvent); m_mapFormulaSelectionSend.emplace(rAddr,xChild); } @@ -1645,7 +1645,7 @@ void ScAccessibleSpreadsheet::RemoveFormulaSelection(bool bRemoveAll ) { AccessibleEventObject aEvent; aEvent.Source = uno::Reference< XAccessible >(this); - MAP_ADDR_XACC::iterator miRemove = m_mapFormulaSelectionSend.begin(); + auto miRemove = m_mapFormulaSelectionSend.begin(); while (miRemove != m_mapFormulaSelectionSend.end()) { if( !bRemoveAll && IsScAddrFormulaSel(miRemove->first) ) @@ -1654,7 +1654,7 @@ void ScAccessibleSpreadsheet::RemoveFormulaSelection(bool bRemoveAll ) continue; } aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE; - aEvent.NewValue <<= miRemove->second; + aEvent.NewValue <<= uno::Reference< XAccessible >(miRemove->second); CommitChange(aEvent); miRemove = m_mapFormulaSelectionSend.erase(miRemove); } diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index cc373117bfa2..12594eb7379b 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -137,7 +137,7 @@ void lcl_ChartInit(const uno::Reference <embed::XEmbeddedObject>& xObj, ScViewDa } else { - xDataProvider.set(new ScChart2DataProvider(&rScDoc)); + xDataProvider = new ScChart2DataProvider(&rScDoc); } xReceiver->attachDataProvider(xDataProvider); diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx index 49c9f1c27946..ec5228c5bc84 100644 --- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx +++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx @@ -251,7 +251,7 @@ private: bool mbIsSpreadsheet; bool mbDelIns; bool mbIsFocusSend; - typedef std::map<ScMyAddress,css::uno::Reference< css::accessibility::XAccessible > > + typedef std::map<ScMyAddress, rtl::Reference<ScAccessibleCell> > MAP_ADDR_XACC; MAP_ADDR_XACC m_mapSelectionSend; bool m_bFormulaMode; diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx index cbd7ebbecda5..0083cbdeabf8 100644 --- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx +++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx @@ -575,27 +575,23 @@ void PivotTableDataProvider::collectPivotTableData() m_bNeedsUpdate = false; } -uno::Reference<chart2::data::XDataSequence> +rtl::Reference<PivotTableDataSequence> PivotTableDataProvider::assignValuesToDataSequence(size_t nIndex) { - uno::Reference<chart2::data::XDataSequence> xDataSequence; if (nIndex >= m_aDataRowVector.size()) - return xDataSequence; + return nullptr; OUString sDataID = lcl_identifierForData(nIndex); std::vector<ValueAndFormat> const & rRowOfData = m_aDataRowVector[nIndex]; rtl::Reference<PivotTableDataSequence> pSequence(new PivotTableDataSequence(m_pDocument, sDataID, std::vector(rRowOfData))); pSequence->setRole(u"values-y"_ustr); - xDataSequence = pSequence; - return xDataSequence; + return pSequence; } -uno::Reference<chart2::data::XDataSequence> +rtl::Reference<PivotTableDataSequence> PivotTableDataProvider::assignLabelsToDataSequence(size_t nIndex) { - uno::Reference<chart2::data::XDataSequence> xDataSequence; - OUString sLabelID = lcl_identifierForLabel(nIndex); OUStringBuffer aLabel; @@ -626,26 +622,21 @@ PivotTableDataProvider::assignLabelsToDataSequence(size_t nIndex) rtl::Reference<PivotTableDataSequence> pSequence(new PivotTableDataSequence(m_pDocument, std::move(sLabelID), std::move(aLabelVector))); pSequence->setRole(u"values-y"_ustr); - xDataSequence = pSequence; - return xDataSequence; + return pSequence; } -css::uno::Reference<css::chart2::data::XDataSequence> +rtl::Reference<PivotTableDataSequence> PivotTableDataProvider::assignFirstCategoriesToDataSequence() { - uno::Reference<chart2::data::XDataSequence> xDataSequence; - if (m_aCategoriesColumnOrientation.empty()) - return xDataSequence; + return nullptr; std::vector<ValueAndFormat> const & rCategories = m_aCategoriesColumnOrientation.back(); rtl::Reference<PivotTableDataSequence> pSequence(new PivotTableDataSequence(m_pDocument, lcl_identifierForCategories(), std::vector(rCategories))); pSequence->setRole(u"categories"_ustr); - xDataSequence = pSequence; - - return xDataSequence; + return pSequence; } uno::Reference<chart2::data::XDataSource> diff --git a/sc/source/ui/vba/vbaaxis.cxx b/sc/source/ui/vba/vbaaxis.cxx index 46a5db7f0eb6..2fb718d27392 100644 --- a/sc/source/ui/vba/vbaaxis.cxx +++ b/sc/source/ui/vba/vbaaxis.cxx @@ -78,26 +78,26 @@ ScVbaAxis::Delete( ) uno::Reference< ::ooo::vba::excel::XAxisTitle > SAL_CALL ScVbaAxis::getAxisTitle( ) { - uno::Reference< excel::XAxisTitle > xAxisTitle; + rtl::Reference< ScVbaAxisTitle > xAxisTitle; try { ScVbaChart* pChart = getChartPtr(); - if (getHasTitle() ) + if (!getHasTitle() ) + return nullptr; + + int nType = getType(); + switch(nType) { - int nType = getType(); - switch(nType) - { - case xlCategory: - xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisXSupplier->getXAxisTitle()); - break; - case xlSeriesAxis: - xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisZSupplier->getZAxisTitle()); - break; - default: // xlValue: - xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisYSupplier->getYAxisTitle()); - break; - } + case xlCategory: + xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisXSupplier->getXAxisTitle()); + break; + case xlSeriesAxis: + xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisZSupplier->getZAxisTitle()); + break; + default: // xlValue: + xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisYSupplier->getYAxisTitle()); + break; } } catch (const uno::Exception& e) diff --git a/sc/source/ui/vba/vbaformatconditions.cxx b/sc/source/ui/vba/vbaformatconditions.cxx index 64f82e003610..ad326f61c672 100644 --- a/sc/source/ui/vba/vbaformatconditions.cxx +++ b/sc/source/ui/vba/vbaformatconditions.cxx @@ -134,7 +134,7 @@ ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, cons return Add( _nType, _aOperator, _aFormula1, _aFormula2, uno::Reference< excel::XStyle >() ); } -uno::Reference< excel::XFormatCondition > +rtl::Reference< ScVbaFormatCondition > ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, const uno::Any& _aFormula1, const uno::Any& _aFormula2, const css::uno::Reference< excel::XStyle >& _xStyle ) { // #TODO @@ -145,7 +145,7 @@ ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, cons // [*] reason: getA1Formula method below is just a hook and just // returns what it gets ( e.g. doesn't convert anything ) uno::Reference< excel::XStyle > xStyle( _xStyle ); - uno::Reference< excel::XFormatCondition > xFormatCondition; + rtl::Reference< ScVbaFormatCondition > xFormatCondition; try { OUString sStyleName; diff --git a/sc/source/ui/vba/vbaformatconditions.hxx b/sc/source/ui/vba/vbaformatconditions.hxx index 8fe7cfabb83f..54721192fdb4 100644 --- a/sc/source/ui/vba/vbaformatconditions.hxx +++ b/sc/source/ui/vba/vbaformatconditions.hxx @@ -29,6 +29,7 @@ namespace ooo::vba::excel { class XRange; } namespace ooo::vba::excel { class XStyle; } namespace ooo::vba::excel { class XStyles; } class ScVbaStyles; +class ScVbaFormatCondition; // This class is used only as a target for casting, it seems, // and no objects of this type are created as such, I think. @@ -44,7 +45,7 @@ public: void notifyRange(); /// @throws css::script::BasicErrorException /// @throws css::uno::RuntimeException - css::uno::Reference< ov::excel::XFormatCondition > Add( ::sal_Int32 Type, const css::uno::Any& Operator, const css::uno::Any& Formula1, const css::uno::Any& Formula2, const css::uno::Reference< ov::excel::XStyle >& _xCalcStyle ); + rtl::Reference< ScVbaFormatCondition > Add( ::sal_Int32 Type, const css::uno::Any& Operator, const css::uno::Any& Formula1, const css::uno::Any& Formula2, const css::uno::Reference< ov::excel::XStyle >& _xCalcStyle ); /// @throws css::script::BasicErrorException static OUString getA1Formula(const css::uno::Any& _aFormula); OUString getStyleName(); diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 4e316e83f481..a90505a6662f 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -116,7 +116,7 @@ ScVbaNames::Add( const css::uno::Any& Name , throw uno::RuntimeException( u"This Name is not valid ."_ustr ); } } - uno::Reference< table::XCellRange > xUnoRange; + rtl::Reference< ScCellRangeObj > xUnoRange; if ( RefersTo.hasValue() || RefersToR1C1.hasValue() || RefersToR1C1Local.hasValue() ) { OUString sFormula; diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 433b069fa6d0..e0562dc7f0f2 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -197,9 +197,9 @@ static uno::Any lcl_makeRange( const uno::Reference< XHelperInterface >& rParent return uno::Any( uno::Reference< excel::XRange >( new ScVbaRange( rParent, rContext, xCellRange, bIsRows, bIsColumns ) ) ); } -static uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRanges >& xLocSheetCellRanges, ScDocShell* pDoc ) +static rtl::Reference< ScVbaRange > lcl_makeXRangeFromSheetCellRanges( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRanges >& xLocSheetCellRanges, ScDocShell* pDoc ) { - uno::Reference< excel::XRange > xRange; + rtl::Reference< ScVbaRange > xRange; const uno::Sequence< table::CellRangeAddress > sAddresses = xLocSheetCellRanges->getRangeAddresses(); ScRangeList aCellRanges; if ( sAddresses.hasElements() ) |