[Libreoffice-commits] core.git: sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri May 15 16:04:21 UTC 2020


 sc/source/filter/xml/xmlexprt.cxx |   18 ++++++------------
 sc/source/filter/xml/xmlexprt.hxx |    3 ++-
 2 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 457d2a0c9373937332ad2ec7b16edc4b2c971a97
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 15 15:47:08 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri May 15 18:03:46 2020 +0200

    fix TODO
    
    Change-Id: I01fe587334f15fc165baef47d799549cc165d528
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94312
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 93e4743276c8..bbadc34397f9 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1982,17 +1982,15 @@ void ScXMLExport::ExportStyles_( bool bUsed )
     SvXMLExport::ExportStyles_(bUsed);
 }
 
-void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& xProperties,
+void ScXMLExport::AddStyleFromCells(const uno::Reference<sheet::XSheetCellRanges>& xCellRanges,
                                     const uno::Reference<sheet::XSpreadsheet>& xTable,
                                     sal_Int32 nTable, const OUString* pOldName)
 {
+    uno::Reference<beans::XPropertySet> xProperties(xCellRanges, uno::UNO_QUERY_THROW);
     css::uno::Any aAny = xProperties->getPropertyValue("FormatID");
     sal_uInt64 nKey = 0;
     aAny >>= nKey;
 
-    //! pass xCellRanges instead
-    uno::Reference<sheet::XSheetCellRanges> xCellRanges( xProperties, uno::UNO_QUERY );
-
     OUString sStyleName;
     sal_Int32 nNumberFormat(-1);
     sal_Int32 nValidationIndex(-1);
@@ -2258,10 +2256,10 @@ void ScXMLExport::collectAutoStyles()
                 if (bCopySheet)
                 {
                     uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-                    uno::Reference <beans::XPropertySet> xProperties(
+                    uno::Reference <sheet::XSheetCellRanges> xCellRanges(
                         xTable->getCellByPosition( aPos.Col(), aPos.Row() ), uno::UNO_QUERY );
 
-                    AddStyleFromCells(xProperties, xTable, nTable, &rCellEntry.maName);
+                    AddStyleFromCells(xCellRanges, xTable, nTable, &rCellEntry.maName);
                 }
             }
 
@@ -2516,12 +2514,8 @@ void ScXMLExport::collectAutoStyles()
                         uno::Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY);
                         if (xCellRanges.is())
                         {
-                            uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY);
-                            if (xProperties.is())
-                            {
-                                AddStyleFromCells(xProperties, xTable, nTable, nullptr);
-                                IncrementProgressBar(false);
-                            }
+                            AddStyleFromCells(xCellRanges, xTable, nTable, nullptr);
+                            IncrementProgressBar(false);
                         }
                     }
                 }
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index de7402125d46..1473dadf1317 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -35,6 +35,7 @@ namespace com::sun::star {
 
 namespace com::sun::star::table { class XCellRange; }
 namespace com::sun::star::sheet { class XSpreadsheet; }
+namespace com::sun::star::sheet { class XSheetCellRanges; }
 namespace com::sun::star::sheet { class XSpreadsheetDocument; }
 
 namespace sc { class DataTransformation; }
@@ -206,7 +207,7 @@ class ScXMLExport : public SvXMLExport
     void CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 nAttrib);
 
     void AddStyleFromCells(
-        const css::uno::Reference< css::beans::XPropertySet >& xProperties,
+        const css::uno::Reference< css::sheet::XSheetCellRanges >& xCellRanges,
         const css::uno::Reference< css::sheet::XSpreadsheet >& xTable,
         sal_Int32 nTable, const OUString* pOldName );
     void AddStyleFromColumn(


More information about the Libreoffice-commits mailing list