include/sfx2/dinfdlg.hxx       |   14 +++++----
 sfx2/source/dialog/dinfdlg.cxx |   63 ++++++++++++++++++++++++++++-------------
 vcl/source/window/tabpage.cxx  |   11 ++++---
 3 files changed, 60 insertions(+), 28 deletions(-)

New commits:
commit aff263c8b814c6bf352312403d3c1e448c8013a3
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Jul 22 14:25:51 2014 +0100

    Related: fdo#81457 quadratic time required when setting a11y name
    
    when calling SetAccessibleName GetAccessibleName is called
    in order to send a name changed a11y event. Getting an Accessible
    Name is very slow in a non-layout aware widget because it scans
    for a "nearby" label and there is none in this widget, but it
    has a huge pile of other widgets to iterate over.
    
    call add_mnemonic_label before hand to cut off that entire
    branch.
    
    While we're at it, only call InitControl to adjust to a new
    width if the new width is different from the old width
    
    Change-Id: Ie4ba1276127226e49442278e46447b84bbeb1cde

diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index d433cb4..fd6f95b 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -407,6 +407,10 @@ struct CustomPropertyLine
 class CustomPropertiesWindow : public Window
 {
 private:
+    FixedText*                          m_pHeaderAccName;
+    FixedText*                          m_pHeaderAccType;
+    FixedText*                          m_pHeaderAccValue;
+
     ComboBox                            m_aNameBox;
     ListBox                             m_aTypeBox;
     Edit                                m_aValueEdit;
@@ -441,13 +445,13 @@ private:
 
 public:
     CustomPropertiesWindow(Window* pParent,
-        const OUString &rHeaderAccName,
-        const OUString &rHeaderAccType,
-        const OUString &rHeaderAccValue);
+        FixedText *pHeaderAccName,
+        FixedText *pHeaderAccType,
+        FixedText *pHeaderAccValue);
     virtual ~CustomPropertiesWindow();
 
-    void                InitControls( HeaderBar* pHeaderBar, const ScrollBar* 
pScrollBar );
-    sal_uInt16              GetVisibleLineCount() const;
+    bool                InitControls( HeaderBar* pHeaderBar, const ScrollBar* 
pScrollBar );
+    sal_uInt16          GetVisibleLineCount() const;
     inline sal_Int32    GetLineHeight() const { return m_nLineHeight; }
     void                AddLine( const OUString& sName, 
com::sun::star::uno::Any& rAny );
     bool                AreAllLinesValid() const;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 7073d5a..f0fc12e 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1354,10 +1354,13 @@ void CustomPropertyLine::SetRemoved()
 }
 
 CustomPropertiesWindow::CustomPropertiesWindow(Window* pParent,
-    const OUString &rHeaderAccName,
-    const OUString &rHeaderAccType,
-    const OUString &rHeaderAccValue) :
+    FixedText *pHeaderAccName,
+    FixedText *pHeaderAccType,
+    FixedText *pHeaderAccValue) :
     Window(pParent),
+    m_pHeaderAccName(pHeaderAccName),
+    m_pHeaderAccType(pHeaderAccType),
+    m_pHeaderAccValue(pHeaderAccValue),
     m_aNameBox      ( this, SfxResId( SFX_CB_PROPERTY_NAME ) ),
     m_aTypeBox      ( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ),
     m_aValueEdit    ( this, SfxResId( SFX_ED_PROPERTY_VALUE ) ),
@@ -1378,9 +1381,12 @@ CustomPropertiesWindow::CustomPropertiesWindow(Window* 
pParent,
     m_aBoxLoseFocusTimer.SetTimeout( 300 );
     m_aBoxLoseFocusTimer.SetTimeoutHdl( LINK( this, CustomPropertiesWindow, 
BoxTimeoutHdl ) );
 
-    m_aNameBox.SetAccessibleName(rHeaderAccName);
-    m_aTypeBox.SetAccessibleName(rHeaderAccType);
-    m_aValueEdit.SetAccessibleName(rHeaderAccValue);
+    m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
+    m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
+    m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
+    m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
+    m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
+    m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
 
     m_aNameBox.Hide();
     m_aTypeBox.Hide();
@@ -1546,8 +1552,10 @@ void CustomPropertiesWindow::ValidateLine( 
CustomPropertyLine* pLine, bool bIsFr
     }
 }
 
-void CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const 
ScrollBar* pScrollBar )
+bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const 
ScrollBar* pScrollBar )
 {
+    bool bChanged = false;
+
     DBG_ASSERT( pHeaderBar, "CustomPropertiesWindow::InitControls(): invalid 
headerbar" );
     DBG_ASSERT( pScrollBar, "CustomPropertiesWindow::InitControls(): invalid 
scrollbar" );
 
@@ -1568,14 +1576,21 @@ void CustomPropertiesWindow::InitControls( HeaderBar* 
pHeaderBar, const ScrollBa
     while ( *pCurrent )
     {
         Rectangle aRect = pHeaderBar->GetItemRect( pHeaderBar->GetItemId( 
nPos++ ) );
-        Size aSize = (*pCurrent)->GetSizePixel();
-        Point aPos = (*pCurrent)->GetPosPixel();
+        Size aOrigSize = (*pCurrent)->GetSizePixel();
+        Point aOrigPos = (*pCurrent)->GetPosPixel();
+        Size aSize(aOrigSize);
+        Point aPos(aOrigPos);
         long nWidth = aRect.GetWidth() - nOffset;
         if ( *pCurrent == &m_aRemoveButton )
             nWidth -= pScrollBar->GetSizePixel().Width();
         aSize.Width() = nWidth;
         aPos.X() = aRect.getX() + ( nOffset / 2 );
-        (*pCurrent)->SetPosSizePixel( aPos, aSize );
+
+        if (aOrigSize != aSize || aOrigPos != aPos)
+        {
+            (*pCurrent)->SetPosSizePixel(aPos, aSize);
+            bChanged = true;
+        }
 
         if ( *pCurrent == &m_aValueEdit )
         {
@@ -1600,6 +1615,7 @@ void CustomPropertiesWindow::InitControls( HeaderBar* 
pHeaderBar, const ScrollBa
 
         pCurrent++;
     }
+    return bChanged;
 }
 
 sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const
@@ -1659,9 +1675,12 @@ void CustomPropertiesWindow::AddLine( const OUString& 
sName, Any& rAny )
 
     pNewLine->m_aTypeBox.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, 
BoxLoseFocusHdl ) );
 
-    pNewLine->m_aNameBox.SetAccessibleName(m_aNameBox.GetAccessibleName());
-    pNewLine->m_aTypeBox.SetAccessibleName(m_aTypeBox.GetAccessibleName());
-    pNewLine->m_aValueEdit.SetAccessibleName(m_aValueEdit.GetAccessibleName());
+    pNewLine->m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
+    pNewLine->m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
+    pNewLine->m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
+    pNewLine->m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
+    pNewLine->m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
+    pNewLine->m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
 
     sal_Int32 nPos = GetVisibleLineCount() * GetLineHeight();
     m_aCustomPropertiesLines.push_back( pNewLine );
@@ -1925,10 +1944,13 @@ void CustomPropertiesControl::Init(VclBuilderContainer& 
rBuilder)
 {
     m_pHeaderBar = new HeaderBar(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
     m_pBody = new VclHBox(this);
-    OUString sName = rBuilder.get<FixedText>("name")->GetText();
-    OUString sType = rBuilder.get<FixedText>("type")->GetText();
-    OUString sValue = rBuilder.get<FixedText>("value")->GetText();
-    m_pPropertiesWin = new CustomPropertiesWindow(m_pBody, sName, sType, 
sValue);
+    FixedText* pName = rBuilder.get<FixedText>("name");
+    FixedText* pType = rBuilder.get<FixedText>("type");
+    FixedText* pValue = rBuilder.get<FixedText>("value");
+    OUString sName = pName->GetText();
+    OUString sType = pType->GetText();
+    OUString sValue = pValue->GetText();
+    m_pPropertiesWin = new CustomPropertiesWindow(m_pBody, pName, pType, 
pValue);
     m_pVertScroll = new ScrollBar(m_pBody, WB_VERT);
 
     set_hexpand(true);
@@ -1976,12 +1998,15 @@ void CustomPropertiesControl::setAllocation(const Size 
&rAllocation)
 {
     VclVBox::setAllocation(rAllocation);
 
-    m_pPropertiesWin->InitControls( m_pHeaderBar, m_pVertScroll );
+    bool bWidgetsResized = m_pPropertiesWin->InitControls( m_pHeaderBar, 
m_pVertScroll );
     sal_Int32 nScrollOffset = m_pPropertiesWin->GetLineHeight();
     sal_Int32 nVisibleEntries = m_pPropertiesWin->GetSizePixel().Height() / 
nScrollOffset;
     m_pVertScroll->SetPageSize( nVisibleEntries - 1 );
     m_pVertScroll->SetVisibleSize( nVisibleEntries );
-    m_pPropertiesWin->updateLineWidth();
+    if (bWidgetsResized)
+    {
+        m_pPropertiesWin->updateLineWidth();
+    }
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL 
makeCustomPropertiesControl(Window *pParent,
commit 13807fbf9f3a4aae6767da8bcf796bea4b065159
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Jul 22 14:20:33 2014 +0100

    Related: fdo#81457 skip setting an empty allocation
    
    if the dimension is 0, don't bother calculating
    a bunch of <= 0 sizes, rely on the parents clipping
    to hide the lot instead
    
    Change-Id: I5b593a5b6b6c3614beb7f9bf3328fa469b700972

diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index 5e5526d..f69258e 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -199,22 +199,25 @@ Size TabPage::GetOptimalSize() const
 void TabPage::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation)
 {
     Window::SetPosSizePixel(rAllocPos, rAllocation);
-    if (isLayoutEnabled(this))
+    if (isLayoutEnabled(this) && rAllocation.Width() && rAllocation.Height())
         VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), 
Point(0, 0), rAllocation);
 }
 
 void TabPage::SetSizePixel(const Size& rAllocation)
 {
     Window::SetSizePixel(rAllocation);
-    if (isLayoutEnabled(this))
+    if (isLayoutEnabled(this) && rAllocation.Width() && rAllocation.Height())
         VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), 
Point(0, 0), rAllocation);
 }
 
 void TabPage::SetPosPixel(const Point& rAllocPos)
 {
     Window::SetPosPixel(rAllocPos);
-    if (isLayoutEnabled(this))
-        VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), 
Point(0, 0), GetOutputSizePixel());
+    Size aAllocation(GetOutputSizePixel());
+    if (isLayoutEnabled(this) && aAllocation.Width() && aAllocation.Height())
+    {
+        VclContainer::setLayoutAllocation(*GetWindow(WINDOW_FIRSTCHILD), 
Point(0, 0), aAllocation);
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to