[Libreoffice-commits] .: vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 21 06:53:32 PST 2012


 vcl/inc/vcl/builder.hxx       |    2 +-
 vcl/source/window/builder.cxx |   21 ++++++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 19c54819a9d8f03788a97ecd4296093f72643069
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 21 14:52:32 2012 +0000

    apply packing properties of pseudo-scrolledwindow to self-scrolling child
    
    Change-Id: I13b0b625109237a0ec9711ed2efdc34cd3e0d32b

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 796f33f..e350a81 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -125,7 +125,7 @@ private:
         std::vector<ButtonImageWidgetMap> m_aButtonImageWidgetMaps;
         StockMap m_aStockMap;
         Translations m_aTranslations;
-        std::set<Window*> m_aRedundantParentWidgets;
+        std::map<Window*, Window*> m_aRedundantParentWidgets;
     };
 
     void loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString &rUri);
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 76ee4ad..e2fcca6 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -224,10 +224,10 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
 
     //Remove ScrollWindow parent widgets whose children in vcl implement scrolling
     //internally.
-    for (std::set<Window*>::iterator aI = m_pParserState->m_aRedundantParentWidgets.begin(),
+    for (std::map<Window*, Window*>::iterator aI = m_pParserState->m_aRedundantParentWidgets.begin(),
         aEnd = m_pParserState->m_aRedundantParentWidgets.end(); aI != aEnd; ++aI)
     {
-        delete_by_window(*aI);
+        delete_by_window(aI->first);
     }
 
     //drop maps, etc. that we don't need again
@@ -795,23 +795,28 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
         //so if it appears as a child of a scrolling window
         //shoehorn that scrolling settings to this
         //widget and remove the parent
+        Window *pScrollParent = NULL;
         if (pParent && pParent->GetType() == WINDOW_SCROLLWINDOW)
         {
             WinBits nScrollBits = pParent->GetStyle();
             nScrollBits &= (WB_AUTOHSCROLL|WB_HSCROLL|WB_AUTOVSCROLL|WB_VSCROLL);
             nWinStyle |= nScrollBits;
 
-            Window *pScrollParent = pParent;
+            pScrollParent = pParent;
             pParent = pParent->GetParent();
+        }
+
+        pWindow = new VclMultiLineEdit(pParent, nWinStyle);
 
+        if (pScrollParent)
+        {
             sal_Int32 nWidthReq = pScrollParent->get_width_request();
             rMap[OString("width-request")] = OString::valueOf(nWidthReq);
             sal_Int32 nHeightReq = pScrollParent->get_height_request();
             rMap[OString("height-request")] = OString::valueOf(nHeightReq);
 
-            m_pParserState->m_aRedundantParentWidgets.insert(pScrollParent);
+            m_pParserState->m_aRedundantParentWidgets[pScrollParent] = pWindow;
         }
-        pWindow = new VclMultiLineEdit(pParent, nWinStyle);
     }
     else
     {
@@ -1446,6 +1451,12 @@ void VclBuilder::applyPackingProperty(Window *pCurrent,
     xmlreader::Span name;
     int nsId;
 
+    if (pCurrent->GetType() == WINDOW_SCROLLWINDOW)
+    {
+        pCurrent = m_pParserState->m_aRedundantParentWidgets[pCurrent];
+        assert(pCurrent);
+    }
+
     while (reader.nextAttribute(&nsId, &name))
     {
         if (name.equals(RTL_CONSTASCII_STRINGPARAM("name")))


More information about the Libreoffice-commits mailing list