include/vcl/builderbase.hxx   |    1 +
 include/vcl/widgetbuilder.hxx |   10 ++++++++--
 vcl/source/window/builder.cxx |   31 ++++++++++++++-----------------
 3 files changed, 23 insertions(+), 19 deletions(-)

New commits:
commit 550f2558ef8b87a4e8a2b27210378ef7ba5c47ac
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Oct 11 23:01:44 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Oct 12 17:19:57 2024 +0200

    tdf#130857 VclBuilder: Move internal child visible logic to base
    
    Move the special handling for internal children in .ui files
    from VclBuilder to the base class and set the "visible" property
    to true for them, instead of directly
    calling vcl::Window::Show.
    
    This allows to have this special logic that
    internal children are visible by default, even
    if the "visible" property is not explicitly set
    in one place, and thus reuse it for QtBuilder as well.
    
    Change-Id: Ic7a932556e02f47ee6007b5167f82bef152e1ef0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174833
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/include/vcl/widgetbuilder.hxx b/include/vcl/widgetbuilder.hxx
index b111b2d2041f..aad9651fbaed 100644
--- a/include/vcl/widgetbuilder.hxx
+++ b/include/vcl/widgetbuilder.hxx
@@ -103,7 +103,8 @@ protected:
             {
                 if (name == "object" || name == "placeholder")
                 {
-                    pCurrentChild = handleObject(pParent, pAtkProps, reader, 
bToolbarItem);
+                    pCurrentChild
+                        = handleObject(pParent, pAtkProps, reader, 
sInternalChild, bToolbarItem);
 
                     bool bObjectInserted = pCurrentChild && pParent != 
pCurrentChild;
                     if (bObjectInserted)
@@ -139,7 +140,7 @@ protected:
     }
 
     WidgetPtr handleObject(Widget* pParent, stringmap* pAtkProps, 
xmlreader::XmlReader& reader,
-                           bool bToolbarItem)
+                           std::string_view sInternalChild, bool bToolbarItem)
     {
         OUString sClass;
         OUString sID;
@@ -187,6 +188,11 @@ protected:
         if (!sCustomProperty.isEmpty())
             aProperties[u"customproperty"_ustr] = sCustomProperty;
 
+        // Internal-children default in glade to not having their visible bits 
set
+        // even though they are visible (generally anyway)
+        if (!sInternalChild.empty())
+            aProperties[u"visible"_ustr] = "True";
+
         WidgetPtr pCurrentChild = nullptr;
         while (true)
         {
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 5e91bb9e259f..0320715b7a02 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2752,11 +2752,6 @@ void VclBuilder::tweakInsertedChild(vcl::Window 
*pParent, vcl::Window* pCurrentC
 {
     assert(pCurrentChild);
 
-    //Internal-children default in glade to not having their visible bits set
-    //even though they are visible (generally anyway)
-    if (!sInternalChild.empty())
-        pCurrentChild->Show();
-
     //Select the first page if it's a notebook
     if (pCurrentChild->GetType() == WindowType::TABCONTROL)
     {
commit cf992140298b14212d99bdbb05253d2cd7863fb7
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Oct 11 22:35:51 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Oct 12 17:19:43 2024 +0200

    tdf#130857 VclBuilder: Make extractVisible a static helper
    
    ... in the base class BuilderBase, in order to reuse it in
    QtBuilder in an upcoming commit.
    
    Change-Id: I61e73f98be9e4f0e0fd15f92d6d16c4e6e617c0e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174832
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/include/vcl/builderbase.hxx b/include/vcl/builderbase.hxx
index 55f46c67a6e2..909792d2ca52 100644
--- a/include/vcl/builderbase.hxx
+++ b/include/vcl/builderbase.hxx
@@ -80,6 +80,7 @@ protected:
     static void collectAccelerator(xmlreader::XmlReader& reader, accelmap& 
rMap);
     stringmap collectPackingProperties(xmlreader::XmlReader& reader);
     void collectProperty(xmlreader::XmlReader& rReader, stringmap& rMap) const;
+    static bool extractVisible(stringmap& rMap);
     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 ddfa66e0ac3b..5e91bb9e259f 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1085,18 +1085,6 @@ namespace
         return sActionName;
     }
 
-    bool extractVisible(VclBuilder::stringmap &rMap)
-    {
-        bool bRet = false;
-        VclBuilder::stringmap::iterator aFind = rMap.find(u"visible"_ustr);
-        if (aFind != rMap.end())
-        {
-            bRet = toBool(aFind->second);
-            rMap.erase(aFind);
-        }
-        return bRet;
-    }
-
     Size extractSizeRequest(VclBuilder::stringmap &rMap)
     {
         OUString sWidthRequest(u"0"_ustr);
@@ -3783,6 +3771,20 @@ bool 
BuilderBase::hasOrientationVertical(VclBuilder::stringmap &rMap)
     return bVertical;
 }
 
+
+
+bool BuilderBase::extractVisible(VclBuilder::stringmap& rMap)
+{
+    bool bRet = false;
+    VclBuilder::stringmap::iterator aFind = rMap.find(u"visible"_ustr);
+    if (aFind != rMap.end())
+    {
+        bRet = toBool(aFind->second);
+        rMap.erase(aFind);
+    }
+    return bRet;
+}
+
 void BuilderBase::collectProperty(xmlreader::XmlReader& reader, stringmap& 
rMap) const
 {
     xmlreader::Span name;

Reply via email to