[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 6 17:46:14 UTC 2020


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

New commits:
commit 78abf4065049d16da1bdf878f414a38af498577e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jun 4 19:04:31 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jun 6 19:45:42 2020 +0200

    tdf#133486 Revert "fix TODO"
    
    This reverts commit 457d2a0c9373937332ad2ec7b16edc4b2c971a97.
    
    Reason for revert: <INSERT REASONING HERE>
    
    Change-Id: I4493fd0f1a309bd49ebe4ea3c14f7f558db9b90d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95551
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit bfb807bf6cf07243a88dc1e66883dfcea872ceab)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95670

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index a338a2d861c5..a8de8508f4d1 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1982,15 +1982,17 @@ void ScXMLExport::ExportStyles_( bool bUsed )
     SvXMLExport::ExportStyles_(bUsed);
 }
 
-void ScXMLExport::AddStyleFromCells(const uno::Reference<sheet::XSheetCellRanges>& xCellRanges,
+void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& xProperties,
                                     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);
@@ -2256,10 +2258,10 @@ void ScXMLExport::collectAutoStyles()
                 if (bCopySheet)
                 {
                     uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-                    uno::Reference <sheet::XSheetCellRanges> xCellRanges(
+                    uno::Reference <beans::XPropertySet> xProperties(
                         xTable->getCellByPosition( aPos.Col(), aPos.Row() ), uno::UNO_QUERY );
 
-                    AddStyleFromCells(xCellRanges, xTable, nTable, &rCellEntry.maName);
+                    AddStyleFromCells(xProperties, xTable, nTable, &rCellEntry.maName);
                 }
             }
 
@@ -2514,8 +2516,12 @@ void ScXMLExport::collectAutoStyles()
                         uno::Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY);
                         if (xCellRanges.is())
                         {
-                            AddStyleFromCells(xCellRanges, xTable, nTable, nullptr);
-                            IncrementProgressBar(false);
+                            uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY);
+                            if (xProperties.is())
+                            {
+                                AddStyleFromCells(xProperties, xTable, nTable, nullptr);
+                                IncrementProgressBar(false);
+                            }
                         }
                     }
                 }
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 1473dadf1317..de7402125d46 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -35,7 +35,6 @@ 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; }
@@ -207,7 +206,7 @@ class ScXMLExport : public SvXMLExport
     void CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 nAttrib);
 
     void AddStyleFromCells(
-        const css::uno::Reference< css::sheet::XSheetCellRanges >& xCellRanges,
+        const css::uno::Reference< css::beans::XPropertySet >& xProperties,
         const css::uno::Reference< css::sheet::XSpreadsheet >& xTable,
         sal_Int32 nTable, const OUString* pOldName );
     void AddStyleFromColumn(


More information about the Libreoffice-commits mailing list