cui/source/inc/cuitabarea.hxx   |    2 ++
 cui/source/tabpages/tphatch.cxx |   39 ++++++++++++++++++++++-----------------
 2 files changed, 24 insertions(+), 17 deletions(-)

New commits:
commit 028a2292ec5a6a14d882aeda38a3641510c26827
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 10:45:38 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/+/200130
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index c1acc7f2ce14..c7a787bc7ae0 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -484,6 +484,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 46c7f2754a3b..166d16057e4d 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -413,6 +413,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 ) );
@@ -454,23 +475,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)

Reply via email to