sc/inc/dbdata.hxx | 8 + sc/inc/mid.h | 7 - sc/inc/tablestyle.hxx | 5 sc/sdi/scslots.sdi | 1 sc/source/core/data/documen4.cxx | 4 sc/source/core/data/fillinfo.cxx | 4 sc/source/core/data/tablestyle.cxx | 52 ++++++-- sc/source/core/tool/dbdata.cxx | 36 +++++- sc/source/filter/excel/xedbdata.cxx | 2 sc/source/filter/excel/xestyle.cxx | 4 sc/source/ui/sidebar/DatabasePropertyPanel.cxx | 16 ++ sc/source/ui/sidebar/DatabasePropertyPanel.hxx | 2 sc/source/ui/unoobj/datauno.cxx | 8 - sc/source/ui/view/tableshell.cxx | 5 sc/uiconfig/scalc/ui/sidebardatabase.ui | 146 +++++++++++++++++++++++-- vcl/inc/jsdialog/jsdialogbuilder.hxx | 1 vcl/jsdialog/jsdialogbuilder.cxx | 6 + 17 files changed, 259 insertions(+), 48 deletions(-)
New commits: commit 2f949f4747b6323d46b1be70abb00eacd41cff9e Author: Balazs Varga <[email protected]> AuthorDate: Thu Nov 13 12:34:35 2025 +0100 Commit: Balazs Varga <[email protected]> CommitDate: Wed Jan 7 17:15:37 2026 +0100 Table styles: add a simple combobox with the default ooxml table style names to make it possible to change a table style on an already exist table style. Change-Id: Ie9db663a42141b89119af70e9ddab4c8fbfbe7cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193986 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196760 Tested-by: Balazs Varga <[email protected]> Reviewed-by: Balazs Varga <[email protected]> diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index b47fcc282414..981ac3b6e9de 100644 --- a/sc/inc/dbdata.hxx +++ b/sc/inc/dbdata.hxx @@ -47,12 +47,15 @@ class SC_DLLPUBLIC ScDatabaseSettingItem final : public SfxPoolItem bool mbStripedRows; bool mbStripedCols; bool mbShowFilters; + OUString maStyleID; public: static SfxPoolItem* CreateDefault(); DECLARE_ITEM_TYPE_FUNCTION(ScDatabaseSettingItem) ScDatabaseSettingItem(); - ScDatabaseSettingItem(bool bHeaderRow, bool bTotalRow, bool bFirstCol, bool bLastCol, bool bStripedRows, bool bStripedCols, bool bShowFilter); + ScDatabaseSettingItem(bool bHeaderRow, bool bTotalRow, bool bFirstCol, bool bLastCol, + bool bStripedRows, bool bStripedCols, bool bShowFilter, + const OUString& aStyleID); ScDatabaseSettingItem( const ScDatabaseSettingItem& rItem ); virtual ~ScDatabaseSettingItem() override; @@ -70,6 +73,7 @@ public: bool HasStripedRows() const; bool HasStripedCols() const; bool HasShowFilters() const; + const OUString& GetStyleID() const; }; /** Enum used to indicate which portion of the DBArea is to be considered. */ @@ -126,7 +130,7 @@ protected: struct SAL_DLLPUBLIC_RTTI ScTableStyleParam { - OUString maStyleName; + OUString maStyleID; bool mbRowStripes; bool mbColumnStripes; bool mbFirstColumn; diff --git a/sc/inc/mid.h b/sc/inc/mid.h index e609a184e7ff..3ae9f3c4f148 100644 --- a/sc/inc/mid.h +++ b/sc/inc/mid.h @@ -24,9 +24,10 @@ #define MID_2 2 #define MID_3 3 #define MID_4 4 -#define MID_5 4 -#define MID_6 4 -#define MID_7 4 +#define MID_5 5 +#define MID_6 6 +#define MID_7 7 +#define MID_8 8 #endif diff --git a/sc/sdi/scslots.sdi b/sc/sdi/scslots.sdi index 77b97f36baa7..f0d4a498bf6c 100644 --- a/sc/sdi/scslots.sdi +++ b/sc/sdi/scslots.sdi @@ -30,6 +30,7 @@ module StarCalc BOOL StripedRows MID_5; BOOL StripedCols MID_6; BOOL ShowFilters MID_7; + String StyleID MID_8 }; item ScDatabaseSetting ScDatabaseSettingItem; diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 9612ec11154a..76b92b4fa8de 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -802,7 +802,7 @@ const SfxItemSet* ScDocument::GetTableFormatSet(SCCOL nCol, SCROW nRow, SCTAB nT if (!pTableStyleInfo) return nullptr; - const ScTableStyle* pTableStyle = mpTableStyles->GetTableStyle(pTableStyleInfo->maStyleName); + const ScTableStyle* pTableStyle = mpTableStyles->GetTableStyle(pTableStyleInfo->maStyleID); if (!pTableStyle) return nullptr; diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index ad5c735f696a..d8930634dd37 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -421,7 +421,7 @@ void ScDocument::FillInfo( ScRange aDBRange; pDBData->GetArea(aDBRange); ScRange aIntersectionRange = aDBRange.Intersection(aTargetRange); - const ScTableStyle* pTableStyle = mpTableStyles->GetTableStyle(pTableStyleInfo->maStyleName); + const ScTableStyle* pTableStyle = mpTableStyles->GetTableStyle(pTableStyleInfo->maStyleID); if (!pTableStyle) continue; diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 2d2dcc5ba4a8..b0a7a883aea3 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -58,7 +58,10 @@ ScDatabaseSettingItem::ScDatabaseSettingItem(): { } -ScDatabaseSettingItem::ScDatabaseSettingItem(bool bHeaderRow, bool bTotalRow, bool bFirstCol, bool bLastCol, bool bStripedRows, bool bStripedCols, bool bShowFilters): +ScDatabaseSettingItem::ScDatabaseSettingItem(bool bHeaderRow, bool bTotalRow, bool bFirstCol, + bool bLastCol, bool bStripedRows, bool bStripedCols, + bool bShowFilters, const OUString& aStyleID) + : SfxPoolItem(SCITEM_DATABASE_SETTING), mbHeaderRow(bHeaderRow), mbTotalRow(bTotalRow), @@ -66,7 +69,8 @@ ScDatabaseSettingItem::ScDatabaseSettingItem(bool bHeaderRow, bool bTotalRow, bo mbLastCol(bLastCol), mbStripedRows(bStripedRows), mbStripedCols(bStripedCols), - mbShowFilters(bShowFilters) + mbShowFilters(bShowFilters), + maStyleID(aStyleID) { } @@ -78,7 +82,8 @@ ScDatabaseSettingItem::ScDatabaseSettingItem(const ScDatabaseSettingItem& rItem) mbLastCol(rItem.mbLastCol), mbStripedRows(rItem.mbStripedRows), mbStripedCols(rItem.mbStripedCols), - mbShowFilters(rItem.mbShowFilters) + mbShowFilters(rItem.mbShowFilters), + maStyleID(rItem.maStyleID) { } @@ -111,6 +116,9 @@ bool ScDatabaseSettingItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId ) con case 6: rVal <<= mbShowFilters; break; + case 7: + rVal <<= maStyleID; + break; default: return false; } @@ -121,8 +129,13 @@ bool ScDatabaseSettingItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId ) con bool ScDatabaseSettingItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId ) { bool bVal = false; + bool bRet = false; - bool bRet = (rVal >>= bVal); + OUString aStyleID; + if (nMemberId == 7) + bRet = (rVal >>= aStyleID); + else + bRet = (rVal >>= bVal); if(!bRet) return false; @@ -150,6 +163,9 @@ bool ScDatabaseSettingItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId ) case 6: mbShowFilters = bVal; break; + case 7: + maStyleID = std::move(aStyleID); + break; default: return false; } @@ -176,6 +192,7 @@ ScDatabaseSettingItem& ScDatabaseSettingItem::operator=(const ScDatabaseSettingI mbStripedRows = rItem.mbStripedRows; mbStripedCols = rItem.mbStripedCols; mbShowFilters = rItem.mbShowFilters; + maStyleID = rItem.maStyleID; return *this; } @@ -187,7 +204,9 @@ bool ScDatabaseSettingItem::operator==(const SfxPoolItem& rItem) const return false; const ScDatabaseSettingItem& rDBItem = static_cast<const ScDatabaseSettingItem&>(rItem); - return mbHeaderRow == rDBItem.mbHeaderRow && mbTotalRow == rDBItem.mbTotalRow && mbFirstCol == rDBItem.mbFirstCol && mbLastCol == rDBItem.mbLastCol && mbStripedRows == rDBItem.mbStripedRows && mbStripedCols == rDBItem.mbStripedCols && mbShowFilters == rDBItem.mbShowFilters; + return mbHeaderRow == rDBItem.mbHeaderRow && mbTotalRow == rDBItem.mbTotalRow && mbFirstCol == rDBItem.mbFirstCol && + mbLastCol == rDBItem.mbLastCol && mbStripedRows == rDBItem.mbStripedRows && mbStripedCols == rDBItem.mbStripedCols && + mbShowFilters == rDBItem.mbShowFilters && maStyleID == rDBItem.maStyleID; } bool ScDatabaseSettingItem::HasHeaderRow() const @@ -225,6 +244,11 @@ bool ScDatabaseSettingItem::HasShowFilters() const return mbShowFilters; } +const OUString& ScDatabaseSettingItem::GetStyleID() const +{ + return maStyleID; +} + ScTableStyleParam::ScTableStyleParam(): mbRowStripes(true), mbColumnStripes(false), @@ -235,7 +259,7 @@ ScTableStyleParam::ScTableStyleParam(): bool ScTableStyleParam::operator==(const ScTableStyleParam& rParam) const { - if(maStyleName != rParam.maStyleName) + if(maStyleID != rParam.maStyleID) return false; if (mbRowStripes != rParam.mbRowStripes) diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 2440213419b4..cde80605294a 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -320,7 +320,7 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry ) if (const ScTableStyleParam* pParam = rData.GetTableStyleInfo()) { - const OUString& rStyleName = pParam->maStyleName; + const OUString& rStyleName = pParam->maStyleID; const ScTableStyle* pTableStyle = rStrm.GetRoot().GetDoc().GetTableStyles().GetTableStyle(rStyleName); if (pTableStyle) { diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index bee635eca515..ee749733cdef 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3385,9 +3385,9 @@ XclExpXmlTableStyles::XclExpXmlTableStyles( const XclExpRoot& rRoot): for (auto itr = rDBs.begin(); itr != rDBs.end(); ++itr) { const ScTableStyleParam* pParam = itr->get()->GetTableStyleInfo(); - if (pParam && rTableStyles.GetTableStyle(pParam->maStyleName)) + if (pParam && rTableStyles.GetTableStyle(pParam->maStyleID)) { - aTableStyleNames.insert(pParam->maStyleName); + aTableStyleNames.insert(pParam->maStyleID); } } diff --git a/sc/source/ui/sidebar/DatabasePropertyPanel.cxx b/sc/source/ui/sidebar/DatabasePropertyPanel.cxx index c2dcc3825124..359699e783a0 100644 --- a/sc/source/ui/sidebar/DatabasePropertyPanel.cxx +++ b/sc/source/ui/sidebar/DatabasePropertyPanel.cxx @@ -41,6 +41,7 @@ ScDatabasePropertyPanel::ScDatabasePropertyPanel(weld::Widget* pParent, , m_xChkBandedColumns(m_xBuilder->weld_check_button(u"chk_banded_cols"_ustr)) , m_xChkFirstColumn(m_xBuilder->weld_check_button(u"chk_first_column"_ustr)) , m_xChkLastColumn(m_xBuilder->weld_check_button(u"chk_last_column"_ustr)) + , m_xCmbStyle(m_xBuilder->weld_combo_box(u"cb_styles"_ustr)) , maHeaderRowCtrl(SID_DATABASE_SETTINGS, *pBindings, *this) , mpBindings(pBindings) { @@ -56,6 +57,7 @@ ScDatabasePropertyPanel::~ScDatabasePropertyPanel() m_xChkBandedColumns.reset(); m_xChkFirstColumn.reset(); m_xChkLastColumn.reset(); + m_xCmbStyle.reset(); maHeaderRowCtrl.dispose(); } @@ -69,6 +71,7 @@ void ScDatabasePropertyPanel::Initialize() m_xChkBandedColumns->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged)); m_xChkFirstColumn->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged)); m_xChkLastColumn->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged)); + m_xCmbStyle->connect_changed(LINK(this, ScDatabasePropertyPanel, StyleChanged)); } std::unique_ptr<PanelLayout> @@ -118,6 +121,7 @@ void ScDatabasePropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState eSt m_xChkBandedRows->set_active(pItem->HasStripedRows()); m_xChkBandedColumns->set_active(pItem->HasStripedCols()); m_xChkFilterButtons->set_active(pItem->HasShowFilters()); + m_xCmbStyle->set_active_id(pItem->GetStyleID()); } break; } @@ -128,7 +132,17 @@ IMPL_LINK_NOARG(ScDatabasePropertyPanel, EntryChanged, weld::Toggleable&, void) ScDatabaseSettingItem aItem(m_xChkHeaderRow->get_active(), m_xChkTotalRow->get_active(), m_xChkFirstColumn->get_active(), m_xChkLastColumn->get_active(), m_xChkBandedRows->get_active(), m_xChkBandedColumns->get_active(), - m_xChkFilterButtons->get_active()); + m_xChkFilterButtons->get_active(), m_xCmbStyle->get_active_id()); + GetBindings()->GetDispatcher()->ExecuteList(SID_DATABASE_SETTINGS, SfxCallMode::RECORD, + { &aItem }); +} + +IMPL_LINK_NOARG(ScDatabasePropertyPanel, StyleChanged, weld::ComboBox&, void) +{ + ScDatabaseSettingItem aItem(m_xChkHeaderRow->get_active(), m_xChkTotalRow->get_active(), + m_xChkFirstColumn->get_active(), m_xChkLastColumn->get_active(), + m_xChkBandedRows->get_active(), m_xChkBandedColumns->get_active(), + m_xChkFilterButtons->get_active(), m_xCmbStyle->get_active_id()); GetBindings()->GetDispatcher()->ExecuteList(SID_DATABASE_SETTINGS, SfxCallMode::RECORD, { &aItem }); } diff --git a/sc/source/ui/sidebar/DatabasePropertyPanel.hxx b/sc/source/ui/sidebar/DatabasePropertyPanel.hxx index d1d6f6e39c99..3f3af3c4aea7 100644 --- a/sc/source/ui/sidebar/DatabasePropertyPanel.hxx +++ b/sc/source/ui/sidebar/DatabasePropertyPanel.hxx @@ -51,10 +51,12 @@ private: std::unique_ptr<weld::CheckButton> m_xChkBandedColumns; std::unique_ptr<weld::CheckButton> m_xChkFirstColumn; std::unique_ptr<weld::CheckButton> m_xChkLastColumn; + std::unique_ptr<weld::ComboBox> m_xCmbStyle; ::sfx2::sidebar::ControllerItem maHeaderRowCtrl; DECL_LINK(EntryChanged, weld::Toggleable&, void); + DECL_LINK(StyleChanged, weld::ComboBox&, void); vcl::EnumContext maContext; SfxBindings* mpBindings; diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 27c6780621ff..28c8f4efceb1 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -1991,15 +1991,15 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( } else if (aPropertyName == SC_UNONAME_TABLE_STYLENAME) { - OUString aStyleName; - aValue >>= aStyleName; + OUString aStyleID; + aValue >>= aStyleID; ScTableStyleParam aParam; const ScTableStyleParam* pOldParam = pData->GetTableStyleInfo(); if (pOldParam) { aParam = *pOldParam; } - aParam.maStyleName = aStyleName; + aParam.maStyleID = aStyleID; aNewData.SetTableStyleInfo(aParam); } @@ -2119,7 +2119,7 @@ uno::Any SAL_CALL ScDatabaseRangeObj::getPropertyValue( const OUString& aPropert { const ScTableStyleParam* pTableStyleInfo = GetDBData_Impl()->GetTableStyleInfo(); if (pTableStyleInfo) - aRet <<= pTableStyleInfo->maStyleName; + aRet <<= pTableStyleInfo->maStyleID; else aRet <<= OUString(); diff --git a/sc/source/ui/view/tableshell.cxx b/sc/source/ui/view/tableshell.cxx index 52744dd972bb..6fc243bda319 100644 --- a/sc/source/ui/view/tableshell.cxx +++ b/sc/source/ui/view/tableshell.cxx @@ -89,6 +89,7 @@ void ScTableShell::ExecuteDatabaseSettings(SfxRequest& rReq) aNewParam.mbColumnStripes = pDBItem->HasStripedCols(); aNewParam.mbFirstColumn = pDBItem->HasFirstCol(); aNewParam.mbLastColumn = pDBItem->HasLastCol(); + aNewParam.maStyleID = pDBItem->GetStyleID(); aNewDBData.SetTableStyleInfo(aNewParam); ScDBDocFunc aFunc(*rViewData.GetDocShell()); @@ -150,13 +151,13 @@ void ScTableShell::GetDatabaseSettings(SfxItemSet& rSet) rSet.Put(ScDatabaseSettingItem( pDBData->HasHeader(), pDBData->HasTotals(), pParam->mbFirstColumn, pParam->mbLastColumn, pParam->mbRowStripes, pParam->mbColumnStripes, - pDBData->HasAutoFilter())); + pDBData->HasAutoFilter(), pParam->maStyleID)); } else { rSet.Put(ScDatabaseSettingItem(pDBData->HasHeader(), pDBData->HasTotals(), false, false, false, false, - pDBData->HasAutoFilter())); + pDBData->HasAutoFilter(), u""_ustr)); } } break; diff --git a/sc/uiconfig/scalc/ui/sidebardatabase.ui b/sc/uiconfig/scalc/ui/sidebardatabase.ui index 55942dd17e6c..ad68788b5837 100644 --- a/sc/uiconfig/scalc/ui/sidebardatabase.ui +++ b/sc/uiconfig/scalc/ui/sidebardatabase.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.40.0 --> +<!-- Generated with glade 3.38.2 --> <interface domain="sc"> <requires lib="gtk+" version="3.20"/> <!-- n-columns=2 n-rows=5 --> @@ -8,19 +8,22 @@ <property name="can-focus">False</property> <property name="margin-top">2</property> <property name="margin-bottom">2</property> + <property name="row-spacing">5</property> <child> <!-- n-columns=2 n-rows=5 --> <object class="GtkGrid" id="grid1"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="hexpand">True</property> <property name="row-spacing">2</property> <property name="column-spacing">2</property> <child> <object class="GtkCheckButton" id="chk_header_row"> - <property name="label" translatable="yes" context="sidebardatabase|show_header_row_checkbox">Show Header Row</property> + <property name="label" translatable="yes" context="sidebardatabase|chk_header_row">Show Header Row</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="hexpand">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -30,10 +33,11 @@ </child> <child> <object class="GtkCheckButton" id="chk_total_row"> - <property name="label" translatable="yes" context="sidebardatabase|show_total_row_checkbox">Show Total Row</property> + <property name="label" translatable="yes" context="sidebardatabase|chk_total_row">Show Total Row</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="hexpand">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -43,10 +47,11 @@ </child> <child> <object class="GtkCheckButton" id="chk_filter_buttons"> - <property name="label" translatable="yes" context="sidebardatabase|show_filter_buttons_checkbox">Show Filter Buttons</property> + <property name="label" translatable="yes" context="sidebardatabase|chk_filter_buttons">Show Filter Buttons</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="hexpand">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -58,6 +63,7 @@ <object class="GtkSeparator"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="hexpand">True</property> </object> <packing> <property name="left-attach">0</property> @@ -68,6 +74,7 @@ <object class="GtkSeparator"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="hexpand">True</property> </object> <packing> <property name="left-attach">1</property> @@ -76,10 +83,11 @@ </child> <child> <object class="GtkCheckButton" id="chk_banded_rows"> - <property name="label" translatable="yes" context="sidebardatabase|banded_rows_formatting_checkbox">Banded Rows</property> + <property name="label" translatable="yes" context="sidebardatabase|chk_banded_rows">Banded Rows</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="hexpand">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -89,10 +97,11 @@ </child> <child> <object class="GtkCheckButton" id="chk_banded_cols"> - <property name="label" translatable="yes" context="sidebardatabase|banded_columns_formatting_checkbox">Banded Columns</property> + <property name="label" translatable="yes" context="sidebardatabase|chk_banded_cols">Banded Columns</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="hexpand">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -102,10 +111,11 @@ </child> <child> <object class="GtkCheckButton" id="chk_first_column"> - <property name="label" translatable="yes" context="sidebardatabase|first_column_formatting_checkbox">First Column</property> + <property name="label" translatable="yes" context="sidebardatabase|chk_first_column">First Column</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="hexpand">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -115,10 +125,11 @@ </child> <child> <object class="GtkCheckButton" id="chk_last_column"> - <property name="label" translatable="yes" context="sidebardatabase|last_column_formatting_checkbox">Last Column</property> + <property name="label" translatable="yes" context="sidebardatabase|chk_last_column">Last Column</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="receives-default">False</property> + <property name="hexpand">True</property> <property name="draw-indicator">True</property> </object> <packing> @@ -135,5 +146,124 @@ <property name="top-attach">0</property> </packing> </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">5</property> + <child> + <object class="GtkLabel" id="lbl_styles"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="sidebardatabase|lbl_styles">Table Styles</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">cb_styles</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="cb_styles"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="active">0</property> + <items> + <item id="none" translatable="yes" context="sidebardatabase|none">None</item> + <item id="TableStyleLight1" translatable="yes" context="sidebardatabase|tablestylelight1">Table Style Light 1</item> + <item id="TableStyleLight2" translatable="yes" context="sidebardatabase|tablestylelight2">Table Style Light 2</item> + <item id="TableStyleLight3" translatable="yes" context="sidebardatabase|tablestylelight3">Table Style Light 3</item> + <item id="TableStyleLight4" translatable="yes" context="sidebardatabase|tablestylelight4">Table Style Light 4</item> + <item id="TableStyleLight5" translatable="yes" context="sidebardatabase|tablestylelight5">Table Style Light 5</item> + <item id="TableStyleLight6" translatable="yes" context="sidebardatabase|tablestylelight6">Table Style Light 6</item> + <item id="TableStyleLight7" translatable="yes" context="sidebardatabase|tablestylelight7">Table Style Light 7</item> + <item id="TableStyleLight8" translatable="yes" context="sidebardatabase|tablestylelight8">Table Style Light 8</item> + <item id="TableStyleLight9" translatable="yes" context="sidebardatabase|tablestylelight9">Table Style Light 9</item> + <item id="TableStyleLight10" translatable="yes" context="sidebardatabase|tablestylelight10">Table Style Light 10</item> + <item id="TableStyleLight11" translatable="yes" context="sidebardatabase|tablestylelight11">Table Style Light 11</item> + <item id="TableStyleLight12" translatable="yes" context="sidebardatabase|tablestylelight12">Table Style Light 12</item> + <item id="TableStyleLight13" translatable="yes" context="sidebardatabase|tablestylelight13">Table Style Light 13</item> + <item id="TableStyleLight14" translatable="yes" context="sidebardatabase|tablestylelight14">Table Style Light 14</item> + <item id="TableStyleLight15" translatable="yes" context="sidebardatabase|tablestylelight15">Table Style Light 15</item> + <item id="TableStyleLight16" translatable="yes" context="sidebardatabase|tablestylelight16">Table Style Light 16</item> + <item id="TableStyleLight17" translatable="yes" context="sidebardatabase|tablestylelight17">Table Style Light 17</item> + <item id="TableStyleLight18" translatable="yes" context="sidebardatabase|tablestylelight18">Table Style Light 18</item> + <item id="TableStyleLight19" translatable="yes" context="sidebardatabase|tablestylelight19">Table Style Light 19</item> + <item id="TableStyleLight20" translatable="yes" context="sidebardatabase|tablestylelight20">Table Style Light 20</item> + <item id="TableStyleLight21" translatable="yes" context="sidebardatabase|tablestylelight21">Table Style Light 21</item> + <item id="TableStyleMedium1" translatable="yes" context="sidebardatabase|tablestylemedium1">Table Style Medium 1</item> + <item id="TableStyleMedium2" translatable="yes" context="sidebardatabase|tablestylemedium2">Table Style Medium 2</item> + <item id="TableStyleMedium3" translatable="yes" context="sidebardatabase|tablestylemedium3">Table Style Medium 3</item> + <item id="TableStyleMedium4" translatable="yes" context="sidebardatabase|tablestylemedium4">Table Style Medium 4</item> + <item id="TableStyleMedium5" translatable="yes" context="sidebardatabase|tablestylemedium5">Table Style Medium 5</item> + <item id="TableStyleMedium6" translatable="yes" context="sidebardatabase|tablestylemedium6">Table Style Medium 6</item> + <item id="TableStyleMedium7" translatable="yes" context="sidebardatabase|tablestylemedium7">Table Style Medium 7</item> + <item id="TableStyleMedium8" translatable="yes" context="sidebardatabase|tablestylemedium8">Table Style Medium 8</item> + <item id="TableStyleMedium9" translatable="yes" context="sidebardatabase|tablestylemedium9">Table Style Medium 9</item> + <item id="TableStyleMedium10" translatable="yes" context="sidebardatabase|tablestylemedium10">Table Style Medium 10</item> + <item id="TableStyleMedium11" translatable="yes" context="sidebardatabase|tablestylemedium11">Table Style Medium 11</item> + <item id="TableStyleMedium12" translatable="yes" context="sidebardatabase|tablestylemedium12">Table Style Medium 12</item> + <item id="TableStyleMedium13" translatable="yes" context="sidebardatabase|tablestylemedium13">Table Style Medium 13</item> + <item id="TableStyleMedium14" translatable="yes" context="sidebardatabase|tablestylemedium14">Table Style Medium 14</item> + <item id="TableStyleMedium15" translatable="yes" context="sidebardatabase|tablestylemedium15">Table Style Medium 15</item> + <item id="TableStyleMedium16" translatable="yes" context="sidebardatabase|tablestylemedium16">Table Style Medium 16</item> + <item id="TableStyleMedium17" translatable="yes" context="sidebardatabase|tablestylemedium17">Table Style Medium 17</item> + <item id="TableStyleMedium18" translatable="yes" context="sidebardatabase|tablestylemedium18">Table Style Medium 18</item> + <item id="TableStyleMedium19" translatable="yes" context="sidebardatabase|tablestylemedium19">Table Style Medium 19</item> + <item id="TableStyleMedium20" translatable="yes" context="sidebardatabase|tablestylemedium20">Table Style Medium 20</item> + <item id="TableStyleMedium21" translatable="yes" context="sidebardatabase|tablestylemedium21">Table Style Medium 21</item> + <item id="TableStyleMedium22" translatable="yes" context="sidebardatabase|tablestylemedium22">Table Style Medium 22</item> + <item id="TableStyleMedium23" translatable="yes" context="sidebardatabase|tablestylemedium23">Table Style Medium 23</item> + <item id="TableStyleMedium24" translatable="yes" context="sidebardatabase|tablestylemedium24">Table Style Medium 24</item> + <item id="TableStyleMedium25" translatable="yes" context="sidebardatabase|tablestylemedium25">Table Style Medium 25</item> + <item id="TableStyleMedium26" translatable="yes" context="sidebardatabase|tablestylemedium26">Table Style Medium 26</item> + <item id="TableStyleMedium27" translatable="yes" context="sidebardatabase|tablestylemedium27">Table Style Medium 27</item> + <item id="TableStyleMedium28" translatable="yes" context="sidebardatabase|tablestylemedium28">Table Style Medium 28</item> + <item id="TableStyleDark1" translatable="yes" context="sidebardatabase|tablestyledark1">Table Style Dark 1</item> + <item id="TableStyleDark2" translatable="yes" context="sidebardatabase|tablestyledark2">Table Style Dark 2</item> + <item id="TableStyleDark3" translatable="yes" context="sidebardatabase|tablestyledark3">Table Style Dark 3</item> + <item id="TableStyleDark4" translatable="yes" context="sidebardatabase|tablestyledark4">Table Style Dark 4</item> + <item id="TableStyleDark5" translatable="yes" context="sidebardatabase|tablestyledark5">Table Style Dark 5</item> + <item id="TableStyleDark6" translatable="yes" context="sidebardatabase|tablestyledark6">Table Style Dark 6</item> + <item id="TableStyleDark7" translatable="yes" context="sidebardatabase|tablestyledark7">Table Style Dark 7</item> + <item id="TableStyleDark8" translatable="yes" context="sidebardatabase|tablestyledark8">Table Style Dark 8</item> + <item id="TableStyleDark9" translatable="yes" context="sidebardatabase|tablestyledark9">Table Style Dark 9</item> + <item id="TableStyleDark10" translatable="yes" context="sidebardatabase|tablestyledark10">Table Style Dark 10</item> + <item id="TableStyleDark11" translatable="yes" context="sidebardatabase|tablestyledark11">Table Style Dark 11</item> + </items> + <child internal-child="accessible"> + <object class="AtkObject" id="cb_styles-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="sidebardatabase|tablestylenames">Table Style Names</property> + <property name="AtkObject::accessible-description" translatable="yes" context="sidebardatabase|defaulttablestylenames">Default Table Style Names</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">2</property> + </packing> + </child> </object> </interface> diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 135676b0ac8f..72d03bb5dc45 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -558,6 +558,7 @@ public: const OUString* pIconName, VirtualDevice* pImageSurface) override; virtual void remove(int pos) override; virtual void do_set_active(int pos) override; + virtual void do_set_active_id(const OUString& rStr) override; }; class JSComboBox final : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>, diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 52e7cf8419f6..cc5d5f015028 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1266,6 +1266,12 @@ void JSListBox::do_set_active(int pos) sendUpdate(); } +void JSListBox::do_set_active_id(const OUString& rStr) +{ + sal_uInt16 nPos = find_id(rStr); + set_active(nPos); +} + JSComboBox::JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>(pSender, pComboBox, pBuilder, commit a6b6ce4e92503b45db1c6d41ee5118c74c0adebe Author: Balazs Varga <[email protected]> AuthorDate: Thu Nov 13 10:39:52 2025 +0100 Commit: Balazs Varga <[email protected]> CommitDate: Wed Jan 7 17:15:25 2026 +0100 Table styles: fix wrong font colors after we applied an empty font attr set for FirstColumnStripePattern, which didn't have any font attr but TablePattern has. Change-Id: Ib125432b3d34311348f864005f97a2eeeac92ea1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193985 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196759 Tested-by: Balazs Varga <[email protected]> Reviewed-by: Balazs Varga <[email protected]> diff --git a/sc/inc/tablestyle.hxx b/sc/inc/tablestyle.hxx index 04b9c36d56e4..514f23d7ecce 100644 --- a/sc/inc/tablestyle.hxx +++ b/sc/inc/tablestyle.hxx @@ -71,8 +71,9 @@ private: public: ScTableStyle(const OUString& rName, const std::optional<OUString>& rUIName); - const SfxItemSet* GetTableCellItemSet(const ScDBData& rDBData, SCCOL nCol, SCROW nRow, - SCROW nRowIndex) const; + static bool HasFontAttrSet(ScPatternAttr* pPattern); + const SfxItemSet* GetFontItemSet(const ScDBData& rDBData, SCCOL nCol, SCROW nRow, + SCROW nRowIndex) const; const SvxBrushItem* GetFillItem(const ScDBData& rDBData, SCCOL nCol, SCROW nRow, SCROW nRowIndex) const; std::unique_ptr<SvxBoxItem> GetBoxItem(const ScDBData& rDBData, SCCOL nCol, SCROW nRow, diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index b0664bcae0ed..9612ec11154a 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -813,7 +813,7 @@ const SfxItemSet* ScDocument::GetTableFormatSet(SCCOL nCol, SCROW nRow, SCTAB nT { nNonEmptyRowsBeforePaintRange += this->CountNonFilteredRows(aDBRange.aStart.Row(), nRow - 1, nTab); } - return pTableStyle->GetTableCellItemSet(*pDBData, nCol, nRow, nNonEmptyRowsBeforePaintRange); + return pTableStyle->GetFontItemSet(*pDBData, nCol, nRow, nNonEmptyRowsBeforePaintRange); } return nullptr; } diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index e175216a26c3..ad5c735f696a 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -458,7 +458,7 @@ void ScDocument::FillInfo( pInfo->maLinesAttr = SfxPoolItemHolder(*pPool, pLinesAttr.get()); } - const SfxItemSet* pPoolItem = pTableStyle->GetTableCellItemSet(*pDBData, nCol, nRow, nRowIndex); + const SfxItemSet* pPoolItem = pTableStyle->GetFontItemSet(*pDBData, nCol, nRow, nRowIndex); if (pPoolItem) { pInfo->pTableFormatSet = pPoolItem; diff --git a/sc/source/core/data/tablestyle.cxx b/sc/source/core/data/tablestyle.cxx index d7d3ff02a330..9d930e888e90 100644 --- a/sc/source/core/data/tablestyle.cxx +++ b/sc/source/core/data/tablestyle.cxx @@ -20,8 +20,23 @@ ScTableStyle::ScTableStyle(const OUString& rName, const std::optional<OUString>& { } -const SfxItemSet* ScTableStyle::GetTableCellItemSet(const ScDBData& rDBData, SCCOL nCol, SCROW nRow, - SCROW nRowIndex) const +bool ScTableStyle::HasFontAttrSet(ScPatternAttr* pPattern) +{ + // TODO: maybe different pPatterns can have different font attributes, and + // now we only check if any font attribute is set on a pattern. + // e.g.: mpFirstRowStripePattern only has ATTR_FONT_WEIGHT set and we will retirn that one, + // but mpTablePattern also can have ATTR_FONT_COLOR set (need to merge them and return that + // one for custom styles, but now it is enough for the ooxml default styles). + for (sal_Int16 nWhich = ATTR_FONT; nWhich <= ATTR_FONT_RELIEF; nWhich++) + { + if (pPattern->GetItemSet().GetItemState(nWhich) == SfxItemState::SET) + return true; + } + return false; +} + +const SfxItemSet* ScTableStyle::GetFontItemSet(const ScDBData& rDBData, SCCOL nCol, SCROW nRow, + SCROW nRowIndex) const { const ScTableStyleParam* pParam = rDBData.GetTableStyleInfo(); ScRange aRange; @@ -32,33 +47,39 @@ const SfxItemSet* ScTableStyle::GetTableCellItemSet(const ScDBData& rDBData, SCC if (bHasHeader && mpLastHeaderCellPattern && nRow == aRange.aStart.Row() && nCol == aRange.aEnd.Col()) { - return &mpLastHeaderCellPattern->GetItemSet(); + if (HasFontAttrSet(mpLastHeaderCellPattern.get())) + return &mpLastHeaderCellPattern->GetItemSet(); } if (bHasHeader && mpFirstHeaderCellPattern && nRow == aRange.aStart.Row() && nCol == aRange.aStart.Col()) { - return &mpFirstHeaderCellPattern->GetItemSet(); + if (HasFontAttrSet(mpFirstHeaderCellPattern.get())) + return &mpFirstHeaderCellPattern->GetItemSet(); } if (bHasTotal && mpTotalRowPattern && nRow == aRange.aEnd.Row()) { - return &mpTotalRowPattern->GetItemSet(); + if (HasFontAttrSet(mpTotalRowPattern.get())) + return &mpTotalRowPattern->GetItemSet(); } if (bHasHeader && mpHeaderRowPattern && nRow == aRange.aStart.Row()) { - return &mpHeaderRowPattern->GetItemSet(); + if (HasFontAttrSet(mpHeaderRowPattern.get())) + return &mpHeaderRowPattern->GetItemSet(); } if (pParam->mbFirstColumn && mpFirstColumnPattern && nCol == aRange.aStart.Col()) { - return &mpFirstColumnPattern->GetItemSet(); + if (HasFontAttrSet(mpFirstColumnPattern.get())) + return &mpFirstColumnPattern->GetItemSet(); } if (pParam->mbLastColumn && mpLastColumnPattern && nCol == aRange.aEnd.Col()) { - return &mpLastColumnPattern->GetItemSet(); + if (HasFontAttrSet(mpLastColumnPattern.get())) + return &mpLastColumnPattern->GetItemSet(); } if (!bHasTotal || aRange.aEnd.Row() != nRow) @@ -69,12 +90,14 @@ const SfxItemSet* ScTableStyle::GetTableCellItemSet(const ScDBData& rDBData, SCC bool bFirstRowStripe = (nRowIndex % nTotalRowStripPattern) < mnFirstRowStripeSize; if (mpSecondRowStripePattern && !bFirstRowStripe) { - return &mpSecondRowStripePattern->GetItemSet(); + if (HasFontAttrSet(mpSecondRowStripePattern.get())) + return &mpSecondRowStripePattern->GetItemSet(); } if (mpFirstRowStripePattern && bFirstRowStripe) { - return &mpFirstRowStripePattern->GetItemSet(); + if (HasFontAttrSet(mpFirstRowStripePattern.get())) + return &mpFirstRowStripePattern->GetItemSet(); } } @@ -85,19 +108,22 @@ const SfxItemSet* ScTableStyle::GetTableCellItemSet(const ScDBData& rDBData, SCC bool bFirstColStripe = (nRelativeCol % nTotalColStripePattern) < mnFirstColStripeSize; if (mpSecondColumnStripePattern && !bFirstColStripe) { - return &mpSecondColumnStripePattern->GetItemSet(); + if (HasFontAttrSet(mpSecondColumnStripePattern.get())) + return &mpSecondColumnStripePattern->GetItemSet(); } if (mpFirstColumnStripePattern && bFirstColStripe) { - return &mpFirstColumnStripePattern->GetItemSet(); + if (HasFontAttrSet(mpFirstColumnStripePattern.get())) + return &mpFirstColumnStripePattern->GetItemSet(); } } } if (mpTablePattern) { - return &mpTablePattern->GetItemSet(); + if (HasFontAttrSet(mpTablePattern.get())) + return &mpTablePattern->GetItemSet(); } return nullptr;
