cui/source/inc/cuitabarea.hxx | 2 ++ cui/source/tabpages/tphatch.cxx | 39 ++++++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 17 deletions(-)
New commits: commit b6ea686cc154c1c1eca968c6a2cfd5956c63cca2 Author: Caolán McNamara <[email protected]> AuthorDate: Tue Jan 20 09:57:44 2026 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Feb 24 00:08:02 2026 +0100 split out an AddHatch Change-Id: I70adde0fef6db2c21f606a845038d2e27bee1980 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197662 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200092 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 08aaf627691f..45ed836a55b4 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -489,6 +489,8 @@ private: sal_Int32 SearchHatchList(std::u16string_view rHatchName); + void AddHatch(const OUString& aName, tools::Long nCount); + public: SvxHatchTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); virtual ~SvxHatchTabPage() override; diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 4594c17917f6..775cdd233a15 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -417,6 +417,27 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl() m_xLbBackgroundColor->SaveValue(); } +void SvxHatchTabPage::AddHatch(const OUString& aName, tools::Long nCount) +{ + XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), + static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), + GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), + Degree10(static_cast<sal_Int16>((m_xMtrAngle->get_value(FieldUnit::NONE) % 360) * 10)) ); + + m_pHatchingList->Insert(std::make_unique<XHatchEntry>(aXHatch, aName), nCount); + + sal_Int32 nId = m_xHatchLB->GetItemId(nCount - 1); // calculate the last ID + Bitmap aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, m_xHatchLB->GetIconSize() ); + // Insert the new entry at the next ID + m_xHatchLB->InsertItem( nId + 1, Image(aBitmap), aName ); + m_xHatchLB->SelectItem( nId + 1 ); + m_xHatchLB->Resize(); + + m_nHatchingListState |= ChangeType::MODIFIED; + + ChangeHatchHdl_Impl(); +} + IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void) { OUString aNewName( SvxResId( RID_SVXSTR_HATCH ) ); @@ -456,23 +477,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void) if( nError ) return; - XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), - static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), - GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), - Degree10(static_cast<sal_Int16>((m_xMtrAngle->get_value(FieldUnit::NONE) % 360) * 10)) ); - - m_pHatchingList->Insert(std::make_unique<XHatchEntry>(aXHatch, aName), nCount); - - sal_Int32 nId = m_xHatchLB->GetItemId(nCount - 1); // calculate the last ID - Bitmap aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, m_xHatchLB->GetIconSize() ); - // Insert the new entry at the next ID - m_xHatchLB->InsertItem( nId + 1, Image(aBitmap), aName ); - m_xHatchLB->SelectItem( nId + 1 ); - m_xHatchLB->Resize(); - - m_nHatchingListState |= ChangeType::MODIFIED; - - ChangeHatchHdl_Impl(); + AddHatch(aName, nCount); } IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, weld::Button&, void)
