include/vcl/builder.hxx       |    5 +----
 include/vcl/builderbase.hxx   |    5 +++++
 vcl/source/window/builder.cxx |    9 +++++----
 3 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit a055c9a8b5441e578defe2763a504ed2329a4257
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Sep 20 14:09:44 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Sep 21 09:08:07 2024 +0200

    tdf#130857 VclBuilder: Move handleActionWidget to base class
    
    Move the `handleActionWidget` Method from `VclBuilder` to
    it base class, `BuilderBase` and make `set_response` that
    gets called by `handleActionWidget` a purely virtual
    method in the base class.
    
    The existing `VclBuilder::set_response` that now overrides
    the base class one implements the `vcl::Window`-specific
    handling for it.
    
    Change-Id: I7664fc77dc98ab0edca1aa7e6982f28822b7caef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173733
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 9eaaeda9635f..d3f06fc4935b 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -316,15 +316,13 @@ private:
     // if bToolbarItem=true, pParent is the ToolBox that the item belongs to, 
since there's no widget for the item itself
     void applyAtkProperties(vcl::Window *pWindow, const stringmap& 
rProperties, bool bToolbarItem);
 
-    void        handleActionWidget(xmlreader::XmlReader &reader);
-
     PackingData get_window_packing_data(const vcl::Window *pWindow) const;
     void        set_window_packing_position(const vcl::Window *pWindow, 
sal_Int32 nPosition);
 
     static vcl::Window* prepareWidgetOwnScrolling(vcl::Window *pParent, 
WinBits &rWinStyle);
     void        cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, 
vcl::Window *pWindow, stringmap &rMap);
 
-    void        set_response(std::u16string_view sID, short nResponse);
+    void set_response(std::u16string_view sID, short nResponse) override;
 
     OUString        get_by_window(const vcl::Window *pWindow) const;
     void            delete_by_window(vcl::Window *pWindow);
diff --git a/include/vcl/builderbase.hxx b/include/vcl/builderbase.hxx
index 965fb33b3379..9c6e744ba8b9 100644
--- a/include/vcl/builderbase.hxx
+++ b/include/vcl/builderbase.hxx
@@ -66,6 +66,8 @@ protected:
     void collectProperty(xmlreader::XmlReader& rReader, stringmap& rMap) const;
     void extractClassAndIdAndCustomProperty(xmlreader::XmlReader& reader, 
OUString& rClass,
                                             OUString& rId, OUString& 
rCustomProperty);
+
+    void handleActionWidget(xmlreader::XmlReader& reader);
     void handleInterfaceDomain(xmlreader::XmlReader& rReader);
     static bool isToolbarItemClass(std::u16string_view sClass);
     static std::vector<vcl::EnumContext::Context> 
handleStyle(xmlreader::XmlReader& reader,
@@ -95,6 +97,8 @@ protected:
 
     const ListStore* get_model_by_name(const OUString& sID) const;
 
+    virtual void set_response(std::u16string_view sID, short nResponse) = 0;
+
     void handleSizeGroup(xmlreader::XmlReader& reader);
 
     virtual void resetParserState();
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 38e8196cdfcf..f7f5d836f88d 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -4023,7 +4023,7 @@ void BuilderBase::collectProperty(xmlreader::XmlReader& 
reader, stringmap& rMap)
     }
 }
 
-void VclBuilder::handleActionWidget(xmlreader::XmlReader &reader)
+void BuilderBase::handleActionWidget(xmlreader::XmlReader &reader)
 {
     xmlreader::Span name;
     int nsId;
commit b1c2d718af1c6fe9a3e7c2467ae15b049547d59a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Sep 20 12:40:59 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Sep 21 09:07:58 2024 +0200

    tdf#130857 VclBuilder: Move "packing" parsing to base class
    
    With previous commit
    
        Change-Id: If29cbd7a13da2732c46e4a0b0b50d0963525e729
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Sep 20 12:21:05 2024 +0200
    
            tdf#130857 Refactor VclBuilder::handlePacking/applyPackingProperties
    
    having split the XML parsing logic for the "packing"
    property from applying it to vcl::Window, slightly
    refactor further to have the XML parsing logic in the
    new base class method `BuilderBase::collectPackingProperties`
    that doesn't take any vcl::Window param, and call
    `VclBuilder::applyPackingProperties` from
    `VclBuilder::handleChild` instead.
    
    Change-Id: I5a52fa85cc8c68a9f7c5c2da1c8d392e031d4fbf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173715
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 216b2f0d814c..9eaaeda9635f 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -294,7 +294,6 @@ private:
     // if bToolbarItem=true, pParent is the ToolBox that the item belongs to, 
since there's no widget for the item itself
     VclPtr<vcl::Window> handleObject(vcl::Window *pParent, stringmap 
*pAtkProps, xmlreader::XmlReader &reader, bool bToolbarItem);
 
-    void        handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, 
xmlreader::XmlReader &reader);
     void applyPackingProperties(vcl::Window* pCurrent, vcl::Window* pParent,
                                 const stringmap& rPackingProperties);
 
diff --git a/include/vcl/builderbase.hxx b/include/vcl/builderbase.hxx
index b345a7d8b1ff..965fb33b3379 100644
--- a/include/vcl/builderbase.hxx
+++ b/include/vcl/builderbase.hxx
@@ -62,6 +62,7 @@ protected:
     static void collectAtkRelationAttribute(xmlreader::XmlReader& reader, 
stringmap& rMap);
     static void collectAtkRoleAttribute(xmlreader::XmlReader& reader, 
stringmap& rMap);
     static void collectAccelerator(xmlreader::XmlReader& reader, accelmap& 
rMap);
+    stringmap collectPackingProperties(xmlreader::XmlReader& reader);
     void collectProperty(xmlreader::XmlReader& rReader, stringmap& rMap) const;
     void extractClassAndIdAndCustomProperty(xmlreader::XmlReader& reader, 
OUString& rClass,
                                             OUString& rId, OUString& 
rCustomProperty);
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index ba8540feb329..38e8196cdfcf 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2882,7 +2882,8 @@ void VclBuilder::handleChild(vcl::Window *pParent, 
stringmap* pAtkProps, xmlread
             }
             else if (name == "packing")
             {
-                handlePacking(pCurrentChild, pParent, reader);
+                const stringmap aPackingProperties = 
collectPackingProperties(reader);
+                applyPackingProperties(pCurrentChild, pParent, 
aPackingProperties);
             }
             else if (name == "interface")
             {
@@ -3777,7 +3778,7 @@ void 
BuilderBase::handleInterfaceDomain(xmlreader::XmlReader& rReader)
     m_pParserState->m_aResLocale = Translate::Create(sPrefixName);
 }
 
-void VclBuilder::handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, 
xmlreader::XmlReader &reader)
+BuilderBase::stringmap 
BuilderBase::collectPackingProperties(xmlreader::XmlReader& reader)
 {
     int nLevel = 1;
     stringmap aPackingProperties;
@@ -3809,7 +3810,7 @@ void VclBuilder::handlePacking(vcl::Window *pCurrent, 
vcl::Window *pParent, xmlr
             break;
     }
 
-    applyPackingProperties(pCurrent, pParent, aPackingProperties);
+    return aPackingProperties;
 }
 
 void VclBuilder::applyPackingProperties(vcl::Window* pCurrent, vcl::Window* 
pParent,

Reply via email to