diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx index 3acae421796b..79f2e67b1147 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(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 @@ -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..a732119360db 100644 --- a/sc/source/ui/sidebar/DatabasePropertyPanel.hxx +++ b/sc/source/ui/sidebar/DatabasePropertyPanel.hxx @@ -14,6 +14,7 @@ #include #include #include +#include namespace sc::sidebar { @@ -51,10 +52,12 @@ private: std::unique_ptr m_xChkBandedColumns; std::unique_ptr m_xChkFirstColumn; std::unique_ptr m_xChkLastColumn; + std::unique_ptr 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 0715336e1a3e..c3a67d959b32 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 @@ - + @@ -8,19 +8,22 @@ False 2 2 + 5 True False + True 2 2 - Show Header Row + Show Header Row True True False + True True @@ -30,10 +33,11 @@ - Show Total Row + Show Total Row True True False + True True @@ -43,10 +47,11 @@ - Show Filter Buttons + Show Filter Buttons True True False + True True @@ -58,6 +63,7 @@ True False + True 0 @@ -68,6 +74,7 @@ True False + True 1 @@ -76,10 +83,11 @@ - Banded Rows + Banded Rows True True False + True True @@ -89,10 +97,11 @@ - Banded Columns + Banded Columns True True False + True True @@ -102,10 +111,11 @@ - First Column + First Column True True False + True True @@ -115,10 +125,11 @@ - Last Column + Last Column True True False + True True @@ -135,5 +146,124 @@ 0 + + + True + False + True + + + 0 + 1 + + + + + True + False + True + 5 + + + True + False + Table Styles + True + cb_styles + + + False + True + 0 + + + + + True + False + True + 0 + + None + Table Style Light 1 + Table Style Light 2 + Table Style Light 3 + Table Style Light 4 + Table Style Light 5 + Table Style Light 6 + Table Style Light 7 + Table Style Light 8 + Table Style Light 9 + Table Style Light 10 + Table Style Light 11 + Table Style Light 12 + Table Style Light 13 + Table Style Light 14 + Table Style Light 15 + Table Style Light 16 + Table Style Light 17 + Table Style Light 18 + Table Style Light 19 + Table Style Light 20 + Table Style Light 21 + Table Style Medium 1 + Table Style Medium 2 + Table Style Medium 3 + Table Style Medium 4 + Table Style Medium 5 + Table Style Medium 6 + Table Style Medium 7 + Table Style Medium 8 + Table Style Medium 9 + Table Style Medium 10 + Table Style Medium 11 + Table Style Medium 12 + Table Style Medium 13 + Table Style Medium 14 + Table Style Medium 15 + Table Style Medium 16 + Table Style Medium 17 + Table Style Medium 18 + Table Style Medium 19 + Table Style Medium 20 + Table Style Medium 21 + Table Style Medium 22 + Table Style Medium 23 + Table Style Medium 24 + Table Style Medium 25 + Table Style Medium 26 + Table Style Medium 27 + Table Style Medium 28 + Table Style Dark 1 + Table Style Dark 2 + Table Style Dark 3 + Table Style Dark 4 + Table Style Dark 5 + Table Style Dark 6 + Table Style Dark 7 + Table Style Dark 8 + Table Style Dark 9 + Table Style Dark 10 + Table Style Dark 11 + + + + Table Style Names + Default Table Style Names + + + + + False + True + 1 + + + + + 0 + 2 + + diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index a6ba49019389..81fd9c7e31a2 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -560,6 +560,7 @@ public: bool bTakeOwnership); 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, diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 12be503b6834..e2e75938f319 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(pSender, pComboBox, pBuilder,