[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/source

Caolán McNamara caolanm at redhat.com
Tue Jul 30 04:15:34 PDT 2013


 include/vcl/builder.hxx       |    3 +++
 include/vcl/layout.hxx        |    8 ++++++++
 include/vcl/msgbox.hxx        |   24 ++++++++++++------------
 vcl/source/window/builder.cxx |   22 +++++++++++++++++++++-
 vcl/source/window/layout.cxx  |   10 ----------
 vcl/source/window/msgbox.cxx  |   19 +++++++------------
 6 files changed, 51 insertions(+), 35 deletions(-)

New commits:
commit 5718ffbf0e3e68e43f87541ce0368a15de8ec90e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 30 12:12:36 2013 +0100

    Resolves: fdo#67378 merge the label into the disclosure button
    
    Change-Id: I43df94c16a178c90da9c006565390a81c2fda29b

diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index bdf0c82..71f24a7 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -31,6 +31,7 @@ class PopupMenu;
 class ScrollBar;
 class DateField;
 class TimeField;
+class VclExpander;
 class VclMultiLineEdit;
 
 class VCL_DLLPUBLIC VclBuilder: private boost::noncopyable
@@ -209,6 +210,8 @@ private:
         AtkMap m_aAtkInfo;
 
         std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps;
+
+        std::vector<VclExpander*> m_aExpanderWidgets;
     };
 
     void loadTranslations(const LanguageTag &rLanguageTag, const OUString &rUri);
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index bdcbedf..9c46acd 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -525,6 +525,14 @@ public:
     {
         m_aDisclosureButton.Check(bExpanded);
     }
+    void set_label(const OUString& rLabel)
+    {
+        m_aDisclosureButton.SetText(rLabel);
+    }
+    OUString get_label() const
+    {
+        return m_aDisclosureButton.GetText();
+    }
     virtual void StateChanged(StateChangedType nType);
     void  SetExpandedHdl( const Link& rLink ) { maExpandedHdl = rLink; }
     const Link& GetExpandedHdl() const { return maExpandedHdl; }
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index da45c56..2dbd0af 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -411,6 +411,22 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
         delete_by_window(aI->first);
     }
 
+    //fdo#67378 merge the label into the disclosure button
+    for (std::vector<VclExpander*>::iterator aI = m_pParserState->m_aExpanderWidgets.begin(),
+        aEnd = m_pParserState->m_aExpanderWidgets.end(); aI != aEnd; ++aI)
+    {
+        VclExpander *pOne = *aI;
+
+        Window *pChild = pOne->get_child();
+        Window* pLabel = pOne->GetWindow(WINDOW_LASTCHILD);
+        if (pLabel && pLabel != pChild && pLabel->GetType() == WINDOW_FIXEDTEXT)
+        {
+            FixedText *pLabelWidget = static_cast<FixedText*>(pLabel);
+            pOne->set_label(pLabelWidget->GetText());
+            delete_by_window(pLabel);
+        }
+    }
+
     //drop maps, etc. that we don't need again
     delete m_pParserState;
 
@@ -1116,7 +1132,11 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
     else if (name == "GtkFrame")
         pWindow = new VclFrame(pParent);
     else if (name == "GtkExpander")
-        pWindow = new VclExpander(pParent);
+    {
+        VclExpander *pExpander = new VclExpander(pParent);
+        m_pParserState->m_aExpanderWidgets.push_back(pExpander);
+        pWindow = pExpander;
+    }
     else if (name == "GtkAlignment")
         pWindow = new VclAlignment(pParent);
     else if (name == "GtkButton")
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index d458a8a..513dab4 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1504,17 +1504,7 @@ void VclExpander::StateChanged(StateChangedType nType)
 
     if (nType == STATE_CHANGE_INITSHOW)
     {
-        //The label widget is the last (of two) children
         Window *pChild = get_child();
-        WindowImpl* pWindowImpl = ImplGetWindowImpl();
-        Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild : NULL;
-        if (pLabel && pLabel->GetType() == WINDOW_FIXEDTEXT)
-        {
-            FixedText *pLabelWidget = static_cast<FixedText*>(pLabel);
-            if (!pLabelWidget->get_mnemonic_widget())
-                pLabelWidget->set_mnemonic_widget(&m_aDisclosureButton);
-        }
-
         if (pChild)
             pChild->Show(m_aDisclosureButton.IsChecked());
     }
commit 83195e2821f24c182098740fb506db215185917f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 30 09:42:12 2013 +0100

    XubString->OUString for msgbox
    
    Change-Id: Ieee6547b36534d0a31b6df8e00c44f1ebbaeae9a

diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 93689f8..099bc55 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -38,12 +38,12 @@ class VCL_DLLPUBLIC MessBox : public ButtonDialog
 protected:
     VclMultiLineEdit*   mpVCLMultiLineEdit;
     FixedImage*         mpFixedImage;
-    XubString           maMessText;
+    OUString            maMessText;
     Image               maImage;
-    sal_Bool                mbHelpBtn;
+    sal_Bool            mbHelpBtn;
     CheckBox*           mpCheckBox;
-    XubString           maCheckBoxText;
-    sal_Bool                mbCheck;
+    OUString            maCheckBoxText;
+    sal_Bool            mbCheck;
 
     SAL_DLLPRIVATE void ImplInitMessBoxData();
     SAL_DLLPRIVATE void ImplInitButtons();
@@ -54,20 +54,20 @@ protected:
 
 public:
                         MessBox( Window* pParent, WinBits nStyle,
-                                 const XubString& rTitle, const XubString& rMessage );
+                                 const OUString& rTitle, const OUString& rMessage );
                         MessBox( Window* pParent, const ResId& rResId );
                         ~MessBox();
 
     virtual void        StateChanged( StateChangedType nStateChange );
 
-    void                SetMessText( const XubString& rText ) { maMessText = rText; }
-    const XubString&    GetMessText() const { return maMessText; }
+    void                SetMessText( const OUString& rText ) { maMessText = rText; }
+    const OUString&     GetMessText() const { return maMessText; }
 
     void                SetImage( const Image& rImage ) { maImage = rImage; }
     const Image&        GetImage() const { return maImage; }
 
-    void                SetCheckBoxText( const XubString& rText ) { maCheckBoxText = rText;}
-    const XubString&    GetCheckBoxText() const { return maCheckBoxText;}
+    void                SetCheckBoxText( const OUString& rText ) { maCheckBoxText = rText;}
+    const OUString&     GetCheckBoxText() const { return maCheckBoxText;}
     void                SetCheckBoxState( sal_Bool bCheck );
     sal_Bool                GetCheckBoxState() const;
 
@@ -101,7 +101,7 @@ private:
 
 public:
                         WarningBox( Window* pParent, WinBits nStyle,
-                                    const XubString& rMessage );
+                                    const OUString& rMessage );
                         WarningBox( Window* pParent, const ResId& rResId );
 
     void                SetDefaultCheckBoxText();
@@ -120,7 +120,7 @@ private:
 
 public:
                         ErrorBox( Window* pParent, WinBits nStyle,
-                                  const XubString& rMessage );
+                                  const OUString& rMessage );
                         ErrorBox( Window* pParent, const ResId& rResId );
 
     static Image        GetStandardImage();
@@ -137,7 +137,7 @@ private:
 
 public:
                         QueryBox( Window* pParent, WinBits nStyle,
-                                  const XubString& rMessage );
+                                  const OUString& rMessage );
                         QueryBox( Window* pParent, const ResId& rResId );
 
     void                SetDefaultCheckBoxText();
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 9e27767..e65c668 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -147,7 +147,7 @@ void MessBox::ImplInitButtons()
 // -----------------------------------------------------------------------
 
 MessBox::MessBox( Window* pParent, WinBits nStyle,
-                  const XubString& rTitle, const XubString& rMessage ) :
+                  const OUString& rTitle, const OUString& rMessage ) :
     ButtonDialog( WINDOW_MESSBOX ),
     maMessText( rMessage )
 {
@@ -155,7 +155,7 @@ MessBox::MessBox( Window* pParent, WinBits nStyle,
     ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
     ImplInitButtons();
 
-    if ( rTitle.Len() )
+    if (!rTitle.isEmpty())
         SetText( rTitle );
 }
 
@@ -221,7 +221,6 @@ void MessBox::ImplPosControls()
         }
     }
 
-    XubString       aMessText( maMessText );
     TextRectInfo    aTextInfo;
     Rectangle       aRect( 0, 0, 30000, 30000 );
     Rectangle       aFormatRect;
@@ -250,12 +249,8 @@ void MessBox::ImplPosControls()
         mpCheckBox = NULL;
     }
 
-
     // Message-Text um Tabs bereinigen
-    OUString   aTabStr("    ");
-    sal_uInt16      nIndex = 0;
-    while ( nIndex != STRING_NOTFOUND )
-        nIndex = aMessText.SearchAndReplace( OUString('\t'), aTabStr, nIndex );
+    OUString aMessText(maMessText.replaceAll("\t", "    "));
 
     // Wenn Fenster zu schmall, machen wir Dialog auch breiter
     if ( mpWindowImpl->mbFrame )
@@ -343,7 +338,7 @@ void MessBox::ImplPosControls()
     if ( aPageSize.Width() < nTitleWidth )
         aPageSize.Width() = nTitleWidth;
 
-    if ( maCheckBoxText.Len() )
+    if (!maCheckBoxText.isEmpty())
     {
         Size aMinCheckboxSize ( aMEditSize );
         if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH+80 )
@@ -481,7 +476,7 @@ void WarningBox::ImplInitWarningBoxData()
 // -----------------------------------------------------------------------
 
 WarningBox::WarningBox( Window* pParent, WinBits nStyle,
-                        const XubString& rMessage ) :
+                        const OUString& rMessage ) :
     MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
 {
     ImplInitWarningBoxData();
@@ -526,7 +521,7 @@ void ErrorBox::ImplInitErrorBoxData()
 // -----------------------------------------------------------------------
 
 ErrorBox::ErrorBox( Window* pParent, WinBits nStyle,
-                    const XubString& rMessage ) :
+                    const OUString& rMessage ) :
     MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
 {
     ImplInitErrorBoxData();
@@ -570,7 +565,7 @@ void QueryBox::ImplInitQueryBoxData()
 
 // -----------------------------------------------------------------------
 
-QueryBox::QueryBox( Window* pParent, WinBits nStyle, const XubString& rMessage ) :
+QueryBox::QueryBox( Window* pParent, WinBits nStyle, const OUString& rMessage ) :
     MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
 {
     ImplInitQueryBoxData();


More information about the Libreoffice-commits mailing list