include/vcl/toolkit/svtabbx.hxx | 9 +-------- vcl/source/app/salvtables.cxx | 5 +---- vcl/source/treelist/svtabbx.cxx | 4 ++-- vcl/source/treelist/treelistbox.cxx | 33 ++++++++++++++++++++------------- 4 files changed, 24 insertions(+), 27 deletions(-)
New commits: commit b0b97184aa56fd507785045afb51d2b53419d023 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Feb 10 10:14:07 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Feb 10 14:05:35 2025 +0100 vcl: Simplify and rename SvTabListBox::SetTabJustify SvTabListBox::SetTabJustify only ever gets called with SvTabJustify::AdjustCenter for param `eJustify`. Drop the param and rename the method to SvTabListBox::SetTabAlignCenter to simplify the code. Drop now unused enum class SvTabJustify. Change-Id: Ibaaafcbdc16551f7562987212b25a68552290c66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181337 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx index 1656d466f300..b390f996a3c7 100644 --- a/include/vcl/toolkit/svtabbx.hxx +++ b/include/vcl/toolkit/svtabbx.hxx @@ -34,13 +34,6 @@ #include <memory> #include <vector> -enum class SvTabJustify -{ - AdjustRight = static_cast<int>(SvLBoxTabFlags::ADJUST_RIGHT), - AdjustLeft = static_cast<int>(SvLBoxTabFlags::ADJUST_LEFT), - AdjustCenter = static_cast<int>(SvLBoxTabFlags::ADJUST_CENTER) -}; - class UNLESS_MERGELIBS_MORE(VCL_DLLPUBLIC) SvTabListBox : public SvTreeListBox { private: @@ -79,7 +72,7 @@ public: OUString GetCellText( sal_uInt32 nPos, sal_uInt16 nCol ) const; sal_uInt32 GetEntryPos( const SvTreeListEntry* pEntry ) const; - void SetTabJustify( sal_uInt16 nTab, SvTabJustify ); + void SetTabAlignCenter(sal_uInt16 nTab); void SetTabEditable( sal_uInt16 nTab, bool bEditable ); virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 8eb8721cd910..d05c9419698a 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3969,10 +3969,7 @@ void SalInstanceTreeView::set_column_editables(const std::vector<bool>& rEditabl m_xTreeView->SetTabEditable(i, rEditables[i]); } -void SalInstanceTreeView::set_centered_column(int nCol) -{ - m_xTreeView->SetTabJustify(nCol, SvTabJustify::AdjustCenter); -} +void SalInstanceTreeView::set_centered_column(int nCol) { m_xTreeView->SetTabAlignCenter(nCol); } int SalInstanceTreeView::get_column_width(int nColumn) const { diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index 54c83e79ea91..b2a1a4319891 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -506,7 +506,7 @@ SvTreeListEntry* SvTabListBox::GetChildOnPos( SvTreeListEntry* _pParent, sal_uIn return nullptr; } -void SvTabListBox::SetTabJustify( sal_uInt16 nTab, SvTabJustify eJustify) +void SvTabListBox::SetTabAlignCenter(sal_uInt16 nTab) { DBG_ASSERT(nTab<mvTabList.size(),"GetTabPos:Invalid Tab"); if( nTab >= mvTabList.size() ) @@ -515,7 +515,7 @@ void SvTabListBox::SetTabJustify( sal_uInt16 nTab, SvTabJustify eJustify) SvLBoxTabFlags nFlags = rTab.nFlags; nFlags &= ~MYTABMASK; // see SvLBoxTab::CalcOffset for force, which only matters for centering - nFlags |= static_cast<SvLBoxTabFlags>(eJustify) | SvLBoxTabFlags::FORCE; + nFlags |= SvLBoxTabFlags::ADJUST_CENTER | SvLBoxTabFlags::FORCE; rTab.nFlags = nFlags; SvTreeListBox::nTreeFlags |= SvTreeFlags::RECALCTABS; if( IsUpdateMode() ) commit 59d34ccdbd27ddba09179c235ba89e542d818a41 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Feb 10 10:01:32 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Feb 10 14:05:26 2025 +0100 vcl: Use enum class instead of int defines for treeview button types Change-Id: I2d19d71cb3ac5a2b7d8319635610369036d4ac0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181336 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index a7a482a59d4c..4ef41e271ec1 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1364,6 +1364,9 @@ void SvTreeListBox::Resize() pImpl->ShowCursor( true ); } + +namespace { + /* Cases: A) entries have bitmaps @@ -1377,11 +1380,15 @@ void SvTreeListBox::Resize() 2. node buttons (can optionally also be on root items) + CheckButton 3. CheckButton */ +enum class TreeListButtonType +{ + NO_BUTTONS, + NODE_BUTTONS, + NODE_AND_CHECK_BUTTONS, + CHECK_BUTTONS, +}; -#define NO_BUTTONS 0 -#define NODE_BUTTONS 1 -#define NODE_AND_CHECK_BUTTONS 2 -#define CHECK_BUTTONS 3 +} #define TABFLAGS_TEXT (SvLBoxTabFlags::DYNAMIC | \ SvLBoxTabFlags::ADJUST_LEFT | \ @@ -1421,23 +1428,23 @@ void SvTreeListBox::SetTabs() ClearTabList(); - int nCase = NO_BUTTONS; + TreeListButtonType eButtonType = TreeListButtonType::NO_BUTTONS; if( !(nTreeFlags & SvTreeFlags::CHKBTN) ) { if( bHasButtons ) - nCase = NODE_BUTTONS; + eButtonType = TreeListButtonType::NODE_BUTTONS; } else { if( bHasButtons ) - nCase = NODE_AND_CHECK_BUTTONS; + eButtonType = TreeListButtonType::NODE_AND_CHECK_BUTTONS; else - nCase = CHECK_BUTTONS; + eButtonType = TreeListButtonType::CHECK_BUTTONS; } - switch( nCase ) + switch(eButtonType) { - case NO_BUTTONS : + case TreeListButtonType::NO_BUTTONS: nStartPos += nContextWidthDIV2; // because of centering AddTab( nStartPos, TABFLAGS_CONTEXTBMP ); nStartPos += nContextWidthDIV2; // right edge of context bitmap @@ -1447,7 +1454,7 @@ void SvTreeListBox::SetTabs() AddTab( nStartPos, TABFLAGS_TEXT ); break; - case NODE_BUTTONS : + case TreeListButtonType::NODE_BUTTONS: if( bHasButtonsAtRoot ) nStartPos += ( nIndent + (nNodeWidthPixel/2) ); else @@ -1463,7 +1470,7 @@ void SvTreeListBox::SetTabs() AddTab( nStartPos, TABFLAGS_TEXT ); break; - case NODE_AND_CHECK_BUTTONS : + case TreeListButtonType::NODE_AND_CHECK_BUTTONS: if( bHasButtonsAtRoot ) nStartPos += ( nIndent + nNodeWidthPixel ); else @@ -1480,7 +1487,7 @@ void SvTreeListBox::SetTabs() AddTab( nStartPos, TABFLAGS_TEXT ); break; - case CHECK_BUTTONS : + case TreeListButtonType::CHECK_BUTTONS: nStartPos += nCheckWidthDIV2; AddTab( nStartPos, TABFLAGS_CHECKBTN ); nStartPos += nCheckWidthDIV2; // right edge of CheckButton