sc/source/filter/inc/tablebuffer.hxx |    8 ++++----
 sc/source/filter/oox/tablebuffer.cxx |   35 +++++++++++++++--------------------
 sc/source/ui/docshell/dbdocfun.cxx   |    4 ++--
 3 files changed, 21 insertions(+), 26 deletions(-)

New commits:
commit 18ed6166963d1152c8ab188518895aca800f46e2
Author:     Balazs Varga <[email protected]>
AuthorDate: Tue Dec 23 20:12:39 2025 +0100
Commit:     Balazs Varga <[email protected]>
CommitDate: Wed Jan 7 17:18:42 2026 +0100

    Table Style: import table area with empty style even if
    
    XML_TableStyleInfo is not present in the ooxml file.
    
    Change-Id: If3045d5eedd1ec21f69230e641bdf6f7b7aa88d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196174
    Reviewed-by: Balazs Varga <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196777
    Tested-by: Balazs Varga <[email protected]>

diff --git a/sc/source/filter/inc/tablebuffer.hxx 
b/sc/source/filter/inc/tablebuffer.hxx
index bf995393000c..886ed2bac664 100644
--- a/sc/source/filter/inc/tablebuffer.hxx
+++ b/sc/source/filter/inc/tablebuffer.hxx
@@ -28,7 +28,7 @@ namespace oox::xls {
 
 struct TableStyleInfo
 {
-    std::optional<OUString> maStyleName;
+    OUString maStyleName;
     bool mbShowFirstColumn;
     bool mbShowLastColumn;
     bool mbShowRowStripes;
@@ -63,8 +63,8 @@ public:
     AutoFilter&  createAutoFilter() { return maAutoFilters.createAutoFilter(); 
}
     /** Creates a new tableColumns handler and stores it internally. */
     TableColumns&  createTableColumns() { return 
maTableColumns.createTableColumns(); }
-
-    void importTableStyleInfo(const AttributeList& rAttribs);
+    /** Imports the table style info attributes. */
+    void importTableStyleInfo( const AttributeList& rAttribs );
 
     /** Creates a database range from this tables. */
     void                finalizeImport();
@@ -93,7 +93,7 @@ public:
 
 private:
     TableModel          maModel;
-    std::optional<TableStyleInfo> maStyleInfo;
+    TableStyleInfo      maStyleInfo;        /// Table style information.
     AutoFilterBuffer    maAutoFilters;      /// Filter settings for this table.
     TableColumnsBuffer  maTableColumns;     /// Column names of this table.
     OUString            maDBRangeName;      /// Name of the database range in 
the Calc document.
diff --git a/sc/source/filter/oox/tablebuffer.cxx 
b/sc/source/filter/oox/tablebuffer.cxx
index 9fcd6a32f252..a3d3d7627eab 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -40,11 +40,12 @@ using namespace ::com::sun::star::sheet;
 using namespace ::com::sun::star::uno;
 
 TableStyleInfo::TableStyleInfo():
-    mbShowFirstColumn(true),
-    mbShowLastColumn(true),
-    mbShowRowStripes(true),
-    mbShowColStripes(true)
+    mbShowFirstColumn( false ),
+    mbShowLastColumn( false ),
+    mbShowRowStripes( false ),
+    mbShowColStripes( false )
 {
+    maStyleName = u"none"_ustr;
 }
 
 TableModel::TableModel() :
@@ -95,14 +96,11 @@ void Table::importTable( SequenceInputStream& rStrm, 
sal_Int16 nSheet )
 
 void Table::importTableStyleInfo(const AttributeList& rAttribs)
 {
-    TableStyleInfo aInfo;
-    aInfo.maStyleName = rAttribs.getString(XML_name, u"none"_ustr);
-    aInfo.mbShowFirstColumn = rAttribs.getBool(XML_showFirstColumn, true);
-    aInfo.mbShowLastColumn = rAttribs.getBool(XML_showLastColumn, true);
-    aInfo.mbShowRowStripes = rAttribs.getBool(XML_showRowStripes, true);
-    aInfo.mbShowColStripes = rAttribs.getBool(XML_showColumnStripes, true);
-
-    maStyleInfo = aInfo;
+    maStyleInfo.maStyleName = rAttribs.getString(XML_name, u"none"_ustr);
+    maStyleInfo.mbShowFirstColumn = rAttribs.getBool(XML_showFirstColumn, 
false);
+    maStyleInfo.mbShowLastColumn = rAttribs.getBool(XML_showLastColumn, false);
+    maStyleInfo.mbShowRowStripes = rAttribs.getBool(XML_showRowStripes, false);
+    maStyleInfo.mbShowColStripes = rAttribs.getBool(XML_showColumnStripes, 
false);
 }
 
 void Table::finalizeImport()
@@ -164,14 +162,11 @@ void Table::finalizeImport()
         if( !(xDatabaseRange->getPropertyValue(u"TokenIndex"_ustr) >>= 
mnTokenIndex))
             mnTokenIndex = -1;
 
-        if(maStyleInfo && maStyleInfo->maStyleName)
-        {
-            xDatabaseRange->setPropertyValue( u"TableStyleName"_ustr, 
css::uno::Any(*maStyleInfo->maStyleName));
-            xDatabaseRange->setPropertyValue( u"UseRowStripes"_ustr, 
css::uno::Any(maStyleInfo->mbShowRowStripes));
-            xDatabaseRange->setPropertyValue( u"UseColStripes"_ustr, 
css::uno::Any(maStyleInfo->mbShowColStripes));
-            xDatabaseRange->setPropertyValue( 
u"UseFirstColumnFormatting"_ustr, 
css::uno::Any(maStyleInfo->mbShowFirstColumn));
-            xDatabaseRange->setPropertyValue( u"UseLastColumnFormatting"_ustr, 
css::uno::Any(maStyleInfo->mbShowLastColumn));
-        }
+        xDatabaseRange->setPropertyValue( u"TableStyleName"_ustr, 
css::uno::Any(maStyleInfo.maStyleName));
+        xDatabaseRange->setPropertyValue( u"UseRowStripes"_ustr, 
css::uno::Any(maStyleInfo.mbShowRowStripes));
+        xDatabaseRange->setPropertyValue( u"UseColStripes"_ustr, 
css::uno::Any(maStyleInfo.mbShowColStripes));
+        xDatabaseRange->setPropertyValue( u"UseFirstColumnFormatting"_ustr, 
css::uno::Any(maStyleInfo.mbShowFirstColumn));
+        xDatabaseRange->setPropertyValue( u"UseLastColumnFormatting"_ustr, 
css::uno::Any(maStyleInfo.mbShowLastColumn));
     }
     catch( Exception& )
     {
commit 5440e73c40405737e46c54336daeb07384a8c6b2
Author:     Balazs Varga <[email protected]>
AuthorDate: Thu Dec 11 09:16:16 2025 +0100
Commit:     Balazs Varga <[email protected]>
CommitDate: Wed Jan 7 17:18:34 2026 +0100

    Table Style: fix dangling reference leading to undefined behavior
    
    after commit: 5ec4c2397d6099ade3347478f5e2e291eee59198
    
    Change-Id: Id619a22b1a1d66f5653c9d9c5ce3a2d7edab6dbe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195427
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Balazs Varga <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196776
    Tested-by: Balazs Varga <[email protected]>

diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index c975f41510a3..641f7b613fd8 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -286,7 +286,7 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, 
const OUString& rNew )
         ScDocShellModificator aModificator( rDocShell );
 
         std::unique_ptr<ScDBData> pNewData(new ScDBData(rNew, **iterOld));
-
+        OUString aUndoName = rOld;
         std::unique_ptr<ScDBCollection> pUndoColl( new ScDBCollection( 
*pDocColl ) );
 
         rDoc.PreprocessDBDataUpdate();
@@ -304,7 +304,7 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, 
const OUString& rNew )
             if (bUndo)
             {
                 rDocShell.GetUndoManager()->AddUndoAction(
-                                std::make_unique<ScUndoDBData>( rDocShell, 
rOld, std::move(pUndoColl),
+                                std::make_unique<ScUndoDBData>( rDocShell, 
aUndoName, std::move(pUndoColl),
                                     rNew, std::make_unique<ScDBCollection>( 
*pDocColl ) ) );
             }
             else

Reply via email to