[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - framework/source instsetoo_native/util

Oliver-Rainer Wittmann orw at apache.org
Mon Mar 10 03:07:28 PDT 2014


 framework/source/layoutmanager/toolbarlayoutmanager.cxx |  235 +++++++---------
 framework/source/layoutmanager/toolbarlayoutmanager.hxx |    1 
 instsetoo_native/util/openoffice.lst                    |    8 
 3 files changed, 118 insertions(+), 126 deletions(-)

New commits:
commit 69dbe9b758a4b095d878e76d58300ee3ec4f9584
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Mon Mar 10 09:45:00 2014 +0000

    provide intermediate UpdateURL for current trunk

diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst
old mode 100644
new mode 100755
index 2017ef0..e2e8401
--- a/instsetoo_native/util/openoffice.lst
+++ b/instsetoo_native/util/openoffice.lst
@@ -70,7 +70,7 @@ Apache_OpenOffice
             ABOUTBOXPRODUCTVERSION 4.1.0
             BASEPRODUCTVERSION 4.1
             PCPFILENAME openoffice.pcp
-            UPDATEURL https://ooo-updates.apache.org/aoo410/check.Update
+            UPDATEURL https://ooo-updates.apache.org/aoonext/check.Update
             ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,userland.txt,version.lst
             REMOVE_UPGRADE_CODE_FILE upgradecode_remove_ooo.txt
             ADDSYSTEMINTEGRATION 1
@@ -129,7 +129,7 @@ Apache_OpenOffice_wJRE
             USERDIRPRODUCTVERSION 4
             ABOUTBOXPRODUCTVERSION 4.1.0
             BASEPRODUCTVERSION 4.1
-            UPDATEURL https://ooo-updates.apache.org/aoo410/check.Update
+            UPDATEURL https://ooo-updates.apache.org/aoonext/check.Update
             ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,javaversion2.dat,userland.txt,version.lst
             REMOVE_UPGRADE_CODE_FILE upgradecode_remove_ooo.txt
             ADDSYSTEMINTEGRATION 1
@@ -196,7 +196,7 @@ Apache_OpenOffice_Dev
             UREPACKAGEPREFIX aoodev
             SOLSUREPACKAGEPREFIX aoodev
             REGISTRYLAYERNAME LayerDev
-            UPDATEURL https://ooo-updates.apache.org/aoo410/check.Update
+            UPDATEURL https://ooo-updates.apache.org/aoonextdev/check.Update
             ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,javaversion2.dat,userland.txt,version.lst
             EVAL
             PACKAGEVERSION 4.1.0
@@ -409,7 +409,7 @@ Apache_OpenOffice_Beta
             USERDIRPRODUCTVERSION 4
             ABOUTBOXPRODUCTVERSION 4.1.0
             BASEPRODUCTVERSION 4.1
-            UPDATEURL https://ooo-updates.apache.org/aoo410/check.Update
+            UPDATEURL https://ooo-updates.apache.org/aoonextbeta/check.Update
             ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,userland.txt,version.lst
             REMOVE_UPGRADE_CODE_FILE upgradecode_remove_ooo.txt
             ADDSYSTEMINTEGRATION 0
commit bf8d8d38c88ca16e7156c81c9ec4fce4adb791e0
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Mon Mar 10 09:37:02 2014 +0000

    124355: Toolbarmanager: correct show/hide of toolbars; correct calculation of docking area sizes

diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 2e25588..f267684 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -266,103 +266,100 @@ bool ToolbarLayoutManager::implts_isParentWindowVisible() const
     return bVisible;
 }
 
-Rectangle ToolbarLayoutManager::implts_calcDockingArea()
+namespace
 {
-    ReadGuard aReadLock( m_aLock );
-    UIElementVector aWindowVector( m_aUIElements );
-    aReadLock.unlock();
+    void insertDockingAreaSize(
+        const UIElement& rUIElement,
+        const awt::Rectangle& rUIElementPosSize,
+        std::vector< sal_Int32 >& rDockingAreaData )
+    {
+        sal_Int32 nAreaPos = 0;
+        sal_Int32 nSize = 0;
+        if ( isHorizontalDockingArea( rUIElement.m_aDockedData.m_nDockedArea ) )
+        {
+            nAreaPos = rUIElement.m_aDockedData.m_aPos.Y();
+            nSize = rUIElementPosSize.Height;
+        }
+        else
+        {
+            nAreaPos = rUIElement.m_aDockedData.m_aPos.X();
+            nSize = rUIElementPosSize.Width;
+        }
 
-    Rectangle                aBorderSpace;
-    sal_Int32                nCurrRowColumn( 0 );
-    sal_Int32                nCurrPos( 0 );
-    sal_Int32                nCurrDockingArea( ui::DockingArea_DOCKINGAREA_TOP );
-    std::vector< sal_Int32 > aRowColumnSizes[DOCKINGAREAS_COUNT];
-    UIElementVector::const_iterator pConstIter;
+        const sal_uInt32 nIndexPos = nAreaPos >= 0 ? static_cast< sal_uInt32 >(nAreaPos) : 0;
+        if ( rDockingAreaData.size() < nIndexPos + 1 )
+        {
+            rDockingAreaData.resize( nIndexPos + 1, 0 );
+        }
 
-    // initialize rectangle with zero values!
-    aBorderSpace.setWidth(0);
-    aBorderSpace.setHeight(0);
+        if ( rDockingAreaData[nIndexPos] < nSize )
+        {
+            rDockingAreaData[nIndexPos] = nSize;
+        }
+    }
 
-    aRowColumnSizes[nCurrDockingArea].clear();
-    aRowColumnSizes[nCurrDockingArea].push_back( 0 );
 
-    for ( pConstIter = aWindowVector.begin(); pConstIter != aWindowVector.end(); pConstIter++ )
+    sal_Int32 calcDockingAreaSize( const std::vector< sal_Int32 >& rDockingAreaData )
     {
-        uno::Reference< ui::XUIElement > xUIElement( pConstIter->m_xUIElement, uno::UNO_QUERY );
-        if ( xUIElement.is() )
+        sal_Int32 nDockingAreaSize = 0;
+
+        std::vector< sal_Int32 >::const_iterator iDockingAreaDataEnd = rDockingAreaData.end();
+        for ( std::vector< sal_Int32 >::const_iterator iDockingAreaData = rDockingAreaData.begin();
+              iDockingAreaData != iDockingAreaDataEnd;
+              ++iDockingAreaData )
         {
-            uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
-            uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
-            if ( xWindow.is() && xDockWindow.is() )
-            {
-                vos::OGuard aGuard( Application::GetSolarMutex() );
+                nDockingAreaSize += *(iDockingAreaData);
+        }
 
-                Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
-                if ( pWindow && !xDockWindow->isFloating() && pConstIter->m_bVisible )
-                {
-                    awt::Rectangle aPosSize = xWindow->getPosSize();
-                    if ( pConstIter->m_aDockedData.m_nDockedArea != nCurrDockingArea )
-                    {
-                        nCurrDockingArea = pConstIter->m_aDockedData.m_nDockedArea;
-                        nCurrRowColumn   = 0;
-                        nCurrPos         = 0;
-                        aRowColumnSizes[nCurrDockingArea].clear();
-                        aRowColumnSizes[nCurrDockingArea].push_back( 0 );
-                    }
+        return nDockingAreaSize;
+    }
+}
 
-                    if ( pConstIter->m_aDockedData.m_nDockedArea == nCurrDockingArea )
-                    {
-                        if ( isHorizontalDockingArea( pConstIter->m_aDockedData.m_nDockedArea ))
-                        {
-                            if ( pConstIter->m_aDockedData.m_aPos.Y() > nCurrPos )
-                            {
-                                ++nCurrRowColumn;
-                                nCurrPos = pConstIter->m_aDockedData.m_aPos.Y();
-                                aRowColumnSizes[nCurrDockingArea].push_back( 0 );
-                            }
 
-                            if ( aPosSize.Height > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] )
-                                aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Height;
-                        }
-                        else
-                        {
-                            if ( pConstIter->m_aDockedData.m_aPos.X() > nCurrPos )
-                            {
-                                ++nCurrRowColumn;
-                                nCurrPos = pConstIter->m_aDockedData.m_aPos.X();
-                                aRowColumnSizes[nCurrDockingArea].push_back( 0 );
-                            }
+Rectangle ToolbarLayoutManager::implts_calcDockingArea()
+{
+    Rectangle aBorderSpace( 0, 0, 0, 0 );
 
-                            if ( aPosSize.Width > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] )
-                                aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Width;
-                        }
+    // For each docking area one container of UIElement sizes.
+    std::vector< std::vector< sal_Int32 > >aDockingAreaSizeDatas( DOCKINGAREAS_COUNT );
+
+    {
+        ReadGuard aReadLock( m_aLock );
+        vos::OGuard aGuard( Application::GetSolarMutex() );
+
+        // Iterate over the UIElements and collect corresponding docking area data
+        // for non-floating and visible ones separated for the each docking area.
+        // Note: For each docking area row resp. column only the size of largest UIElement is collected.
+        for ( UIElementVector::const_iterator pConstIter = m_aUIElements.begin(); pConstIter != m_aUIElements.end(); ++pConstIter )
+        {
+            uno::Reference< ui::XUIElement > xUIElement( pConstIter->m_xUIElement, uno::UNO_QUERY );
+            if ( xUIElement.is() )
+            {
+                uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
+                uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
+                if ( xWindow.is() && xDockWindow.is() )
+                {
+                    Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+                    if ( pWindow && !xDockWindow->isFloating() && pConstIter->m_bVisible )
+                    {
+                        const awt::Rectangle aPosSize = xWindow->getPosSize();
+                        insertDockingAreaSize(
+                            *(pConstIter),
+                            aPosSize,
+                            aDockingAreaSizeDatas[pConstIter->m_aDockedData.m_nDockedArea] );
                     }
                 }
             }
         }
-    }
 
-    // Sum up max heights from every row/column
-    if ( !aWindowVector.empty() )
-    {
-        for ( sal_Int32 i = 0; i <= ui::DockingArea_DOCKINGAREA_RIGHT; i++ )
-        {
-            sal_Int32 nSize( 0 );
-            const sal_uInt32 nCount = aRowColumnSizes[i].size();
-            for ( sal_uInt32 j = 0; j < nCount; j++ )
-                nSize += aRowColumnSizes[i][j];
-
-            if ( i == ui::DockingArea_DOCKINGAREA_TOP )
-                aBorderSpace.Top() = nSize;
-            else if ( i == ui::DockingArea_DOCKINGAREA_BOTTOM )
-                aBorderSpace.Bottom() = nSize;
-            else if ( i == ui::DockingArea_DOCKINGAREA_LEFT )
-                aBorderSpace.Left() = nSize;
-            else
-                aBorderSpace.Right() = nSize;
-        }
+        aReadLock.unlock();
     }
 
+    aBorderSpace.Top() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_TOP] );
+    aBorderSpace.Bottom() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_BOTTOM] );
+    aBorderSpace.Left() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_LEFT] );
+    aBorderSpace.Right() = calcDockingAreaSize( aDockingAreaSizeDatas[ui::DockingArea_DOCKINGAREA_RIGHT] );
+
     return aBorderSpace;
 }
 
@@ -553,60 +550,65 @@ void ToolbarLayoutManager::destroyToolbars()
     }
 }
 
-bool ToolbarLayoutManager::showToolbar( const ::rtl::OUString& rResourceURL )
+bool ToolbarLayoutManager::implts_setToolbarVisibility(
+    bool bVisible,
+    UIElement aUIElement )
 {
-    UIElement aUIElement = implts_findToolbar( rResourceURL );
+    bool bRet = false;
 
     vos::OGuard aGuard( Application::GetSolarMutex() );
     Window* pWindow = getWindowFromXUIElement( aUIElement.m_xUIElement );
     if ( pWindow )
     {
+        if ( bVisible )
+        {
+            pWindow->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+        }
+        else
+        {
+            pWindow->Show( sal_False );
+        }
         if ( !aUIElement.m_bFloating )
+        {
             implts_setLayoutDirty();
-        else
-            pWindow->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
-
-        aUIElement.m_bVisible = true;
+        }
+        aUIElement.m_bVisible = bVisible;
         implts_writeWindowStateData( aUIElement );
         implts_setToolbar( aUIElement );
-        return true;
+
+        bRet = true;
     }
 
-    return false;
+    return bRet;
 }
 
-bool ToolbarLayoutManager::hideToolbar( const ::rtl::OUString& rResourceURL )
+bool ToolbarLayoutManager::showToolbar( const ::rtl::OUString& rResourceURL )
 {
     UIElement aUIElement = implts_findToolbar( rResourceURL );
+    const bool bRet = implts_setToolbarVisibility( true, aUIElement );
+    implts_sortUIElements();
+    return bRet;
+}
 
-    vos::OGuard aGuard( Application::GetSolarMutex() );
-    Window* pWindow = getWindowFromXUIElement( aUIElement.m_xUIElement );
-    if ( pWindow )
-    {
-        pWindow->Show( sal_False );
-        if ( !aUIElement.m_bFloating )
-            implts_setLayoutDirty();
-
-        aUIElement.m_bVisible = false;
-        implts_writeWindowStateData( aUIElement );
-        implts_setToolbar( aUIElement );
-        return true;
-    }
-
-    return false;
+bool ToolbarLayoutManager::hideToolbar( const ::rtl::OUString& rResourceURL )
+{
+    UIElement aUIElement = implts_findToolbar( rResourceURL );
+    const bool bRet = implts_setToolbarVisibility( false, aUIElement );
+    implts_sortUIElements();
+    return bRet;
 }
 
 void ToolbarLayoutManager::refreshToolbarsVisibility( bool bAutomaticToolbars )
 {
-    UIElementVector aUIElementVector;
+    if ( !bAutomaticToolbars )
+        return;
 
     ReadGuard aReadLock( m_aLock );
-    bool bVisible( m_bVisible );
-    aReadLock.unlock();
-
-    if ( !bVisible || !bAutomaticToolbars )
+    if ( !m_bVisible )
         return;
+    aReadLock.unlock();
 
+    UIElementVector aUIElementVector;
     implts_getUIElementVectorCopy( aUIElementVector );
 
     UIElement aUIElement;
@@ -661,22 +663,11 @@ void ToolbarLayoutManager::setVisible( bool bVisible )
     for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
     {
         pIter->m_bMasterHide = !bVisible;
-        Window* pWindow = getWindowFromXUIElement( pIter->m_xUIElement );
-        if ( pWindow )
-        {
-            bool bSetVisible( pIter->m_bVisible & bVisible );
-            if ( !bSetVisible )
-                pWindow->Hide();
-            else
-            {
-                if ( pIter->m_bFloating )
-                    pWindow->Show(true, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
-                else
-                    implts_setLayoutDirty();
-            }
-        }
+        implts_setToolbarVisibility( bVisible, *pIter );
     }
 
+    implts_sortUIElements();
+
     if ( !bVisible )
         resetDockingArea();
 }
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index 3dd0770..7621e56 100755
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -219,6 +219,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a
         rtl::OUString    implts_generateGenericAddonToolbarTitle( sal_Int32 nNumber ) const;
         void             implts_setElementData( UIElement& rUIElement, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow >& rDockWindow );
         void             implts_destroyDockingAreaWindows();
+        bool             implts_setToolbarVisibility( bool bVisible, UIElement aUIElement );
 
         //---------------------------------------------------------------------------------------------------------
         // layout methods


More information about the Libreoffice-commits mailing list