cui/source/inc/cuitabarea.hxx   |    2 +
 cui/source/tabpages/tphatch.cxx |   43 ++++++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 19 deletions(-)

New commits:
commit 82b4b84660556685be0c19b715bfe1a82816d679
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Jan 20 09:57:44 2026 +0000
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Jan 21 14:08:29 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]>

diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 31519ea6e900..911bb1120587 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -513,6 +513,8 @@ private:
     void ClickRenameHdl();
     void ClickDeleteHdl();
 
+    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 3b9235fb61bd..3f368ce23fef 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -435,6 +435,29 @@ 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) * 10)) 
);
+
+    m_pHatchingList->Insert(std::make_unique<XHatchEntry>(aXHatch, aName), 
nCount);
+
+    OUString sId = nCount > 0 ? m_xHatchLB->get_id( nCount - 1 ) : OUString();
+    sal_Int32 nId = !sId.isEmpty() ? sId.toInt32() : -1;
+    BitmapEx aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, aIconSize 
);
+    VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmap);
+
+    m_xHatchLB->insert( nId + 1, &aName, &sId, pVDev, nullptr);
+    FillPresetListBox();
+    m_xHatchLB->select( nId + 1 );
+
+    m_nHatchingListState |= ChangeType::MODIFIED;
+
+    ChangeHatchHdl_Impl();
+}
+
 IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void)
 {
     OUString aNewName( SvxResId( RID_SVXSTR_HATCH ) );
@@ -476,25 +499,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) * 10)) 
);
-
-    m_pHatchingList->Insert(std::make_unique<XHatchEntry>(aXHatch, aName), 
nCount);
-
-    OUString sId = nCount > 0 ? m_xHatchLB->get_id( nCount - 1 ) : OUString();
-    sal_Int32 nId = !sId.isEmpty() ? sId.toInt32() : -1;
-    BitmapEx aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, aIconSize 
);
-    VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmap);
-
-    m_xHatchLB->insert( nId + 1, &aName, &sId, pVDev, nullptr);
-    FillPresetListBox();
-    m_xHatchLB->select( nId + 1 );
-
-    m_nHatchingListState |= ChangeType::MODIFIED;
-
-    ChangeHatchHdl_Impl();
+    AddHatch(aName, nCount);
 }
 
 IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, weld::Button&, void)

Reply via email to