[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sfx2/source ucb/source

Oliver-Rainer Wittmann orw at apache.org
Fri Apr 5 16:31:50 PDT 2013


 sfx2/source/dialog/splitwin.cxx                    |   90 +++++++++++++++++----
 ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx |    6 -
 2 files changed, 80 insertions(+), 16 deletions(-)

New commits:
commit e50d4638e4fe64eb05b8f22006c7f04c05ec288b
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Fri Apr 5 14:07:46 2013 +0000

    #122008# - use <serf_bucket_headers_setc(..)> when header name's data need to be copied

diff --git a/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx b/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx
index fa7c5f8..d2419c5 100644
--- a/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx
+++ b/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx
@@ -99,9 +99,9 @@ void SerfRequestProcessorImpl::setRequestHeaders( serf_bucket_t* inoutSerfHeader
             bHasUserAgent = aHeaderIter->first.equalsAsciiL(
                 RTL_CONSTASCII_STRINGPARAM( "User-Agent" ) );
 
-        serf_bucket_headers_set( inoutSerfHeaderBucket,
-                                 aHeader.getStr(),
-                                 aValue.getStr() );
+        serf_bucket_headers_setc( inoutSerfHeaderBucket,
+                                  aHeader.getStr(),
+                                  aValue.getStr() );
 
         ++aHeaderIter;
     }
commit cad2fc1a82a3efb2abd4396fe2efc2231fb783e5
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Fri Apr 5 10:24:49 2013 +0000

    #121933# - some improvement to the docking area layout on a undock-dock-cycle of a window

diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 6dda801..9e9cfa2 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -51,6 +51,9 @@
 #include <sfx2/msgpool.hxx>
 #include <sfx2/viewfrm.hxx>
 
+#include <vector>
+#include <utility>
+
 using namespace ::com::sun::star::uno;
 using namespace ::rtl;
 
@@ -58,6 +61,35 @@ using namespace ::rtl;
 #define nPixel  30L
 #define USERITEM_NAME           OUString::createFromAscii( "UserItem" )
 
+namespace {
+    // helper class to deactivate UpdateMode, if needed, for the life time of an instance
+    class DeactivateUpdateMode
+    {
+    public:
+        explicit DeactivateUpdateMode( SfxSplitWindow& rSplitWindow )
+            : mrSplitWindow( rSplitWindow )
+            , mbUpdateMode( rSplitWindow.IsUpdateMode() )
+        {
+            if ( mbUpdateMode )
+            {
+                mrSplitWindow.SetUpdateMode( sal_False );
+            }
+        }
+
+        ~DeactivateUpdateMode( void )
+        {
+            if ( mbUpdateMode )
+            {
+                mrSplitWindow.SetUpdateMode( sal_True );
+            }
+        }
+
+    private:
+        SfxSplitWindow& mrSplitWindow;
+        const sal_Bool mbUpdateMode;
+    };
+}
+
 struct SfxDock_Impl
 {
     sal_uInt16              nType;
@@ -399,15 +431,17 @@ void SfxSplitWindow::Split()
 
     SplitWindow::Split();
 
+    std::vector< std::pair< sal_uInt16, long > > aNewOrgSizes;
+
     sal_uInt16 nCount = pDockArr->Count();
     for ( sal_uInt16 n=0; n<nCount; n++ )
     {
         SfxDock_Impl *pD = (*pDockArr)[n];
         if ( pD->pWin )
         {
-            sal_uInt16 nId = pD->nType;
-            long nSize    = GetItemSize( nId, SWIB_FIXED );
-            long nSetSize = GetItemSize( GetSet( nId ) );
+            const sal_uInt16 nId = pD->nType;
+            const long nSize    = GetItemSize( nId, SWIB_FIXED );
+            const long nSetSize = GetItemSize( GetSet( nId ) );
             Size aSize;
 
             if ( IsHorizontal() )
@@ -422,6 +456,18 @@ void SfxSplitWindow::Split()
             }
 
             pD->pWin->SetItemSize_Impl( aSize );
+
+            aNewOrgSizes.push_back( std::pair< sal_uInt16, long >( nId, nSize ) );
+        }
+    }
+
+    // workaround insuffiency of <SplitWindow> regarding dock layouting:
+    // apply FIXED item size as 'original' item size to improve layouting of undock-dock-cycle of a window
+    {
+        DeactivateUpdateMode aDeactivateUpdateMode( *this );
+        for ( sal_uInt16 i = 0; i < aNewOrgSizes.size(); ++i )
+        {
+            SetItemSize( aNewOrgSizes[i].first, aNewOrgSizes[i].second );
         }
     }
 
@@ -684,9 +730,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
 
     pDock->nSize = nWinSize;
 
-    sal_Bool bUpdateMode = IsUpdateMode();
-    if ( bUpdateMode )
-        SetUpdateMode( sal_False );
+    DeactivateUpdateMode* pDeactivateUpdateMode = new DeactivateUpdateMode( *this );
 
     if ( bNewLine || nLine == GetItemCount( 0 ) )
     {
@@ -759,9 +803,32 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
         pWorkWin->ShowChilds_Impl();
     }
 
-    if ( bUpdateMode )
-        SetUpdateMode( sal_True );
+    delete pDeactivateUpdateMode;
     bLocked = sal_False;
+
+    // workaround insuffiency of <SplitWindow> regarding dock layouting:
+    // apply FIXED item size as 'original' item size to improve layouting of undock-dock-cycle of a window
+    {
+        std::vector< std::pair< sal_uInt16, long > > aNewOrgSizes;
+        // get FIXED item sizes
+        sal_uInt16 nCount = pDockArr->Count();
+        for ( sal_uInt16 n=0; n<nCount; n++ )
+        {
+            SfxDock_Impl *pD = (*pDockArr)[n];
+            if ( pD->pWin )
+            {
+                const sal_uInt16 nId = pD->nType;
+                const long nSize    = GetItemSize( nId, SWIB_FIXED );
+                aNewOrgSizes.push_back( std::pair< sal_uInt16, long >( nId, nSize ) );
+            }
+        }
+        // apply new item sizes
+        DeactivateUpdateMode aDeactivateUpdateMode( *this );
+        for ( sal_uInt16 i = 0; i < aNewOrgSizes.size(); ++i )
+        {
+            SetItemSize( aNewOrgSizes[i].first, aNewOrgSizes[i].second );
+        }
+    }
 }
 
 //-------------------------------------------------------------------------
@@ -817,9 +884,7 @@ void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide )
 
     // Fenster removen, und wenn es das letzte der Zeile war, auch die Zeile
     // ( Zeile = ItemSet )
-    sal_Bool bUpdateMode = IsUpdateMode();
-    if ( bUpdateMode )
-        SetUpdateMode( sal_False );
+    DeactivateUpdateMode* pDeactivateUpdateMode = new DeactivateUpdateMode( *this );
     bLocked = sal_True;
 
     RemoveItem( pDockWin->GetType() );
@@ -827,8 +892,7 @@ void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide )
     if ( nSet && !GetItemCount( nSet ) )
         RemoveItem( nSet );
 
-    if ( bUpdateMode )
-        SetUpdateMode( sal_True );
+    delete pDeactivateUpdateMode;
     bLocked = sal_False;
 };
 


More information about the Libreoffice-commits mailing list