[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 2 commits - sd/source

Jan Holesovsky kendy at collabora.com
Thu Mar 31 10:29:17 UTC 2016


 sd/source/ui/table/tablefunction.cxx |   36 ++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

New commits:
commit 686dda325635ed55773ac8afdf6ff6984db8256e
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 31 12:26:54 2016 +0200

    sd lok bccu#1525: Don't rely on the window size in the LOK case.
    
    Otherwise the table is inserted in the top left corner.
    
    Change-Id: Ia5d7099d4bace6f18cd7e8d3409427119240b756

diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index f24b0f9..38dd27f 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/awt/KeyModifier.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 
+#include <comphelper/lok.hxx>
 #include <cppuhelper/compbase2.hxx>
 #include <cppuhelper/basemutex.hxx>
 
@@ -151,16 +152,25 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
             Size aSize( 14100, 2000 );
 
             Point aPos;
-            Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+            Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel());
             aWinRect = GetActiveWindow()->PixelToLogic(aWinRect);
 
             // make sure that the default size of the table fits on the paper and is inside the viewing area.
             // if zoomed in close, don't make the table bigger than the viewing window.
             Size aMaxSize = getCurrentPage()->GetSize();
-            if( aMaxSize.Height() > aWinRect.getHeight() )
-                aMaxSize.setHeight( aWinRect.getHeight() );
-            if( aMaxSize.Width() > aWinRect.getWidth() )
-                aMaxSize.setWidth( aWinRect.getWidth() );
+
+            if (comphelper::LibreOfficeKit::isActive())
+            {
+                // aWinRect is nonsensical in the LOK case
+                aWinRect = Rectangle(aPos, aMaxSize);
+            }
+            else
+            {
+                if( aMaxSize.Height() > aWinRect.getHeight() )
+                    aMaxSize.setHeight( aWinRect.getHeight() );
+                if( aMaxSize.Width() > aWinRect.getWidth() )
+                    aMaxSize.setWidth( aWinRect.getWidth() );
+            }
 
             if( aSize.Width() > aMaxSize.getWidth() )
                 aSize.setWidth( aMaxSize.getWidth() );
commit e5418bf8983b7811fd3372bb184d950ebe87e217
Author: Justin Luth <justin_luth at sil.org>
Date:   Wed Jan 6 21:23:47 2016 +0300

    set reasonable default size for new draw/impress tables
    
    The width was decent, except that on small paper (A6) it was
    wider than the paper size.
    
    The height was terrible - the minimum size possible. It was too small
    for even a single line of text. That made it hard to grab the table edge
    (instead grabbing a row edge) when trying to resize.
    
    Now the height and width are limited to the page/view size,
    and based on the number of rows created.  One possible enhancement
    would be to use the border width instead of the page width.
    
    Change-Id: I4e106a7bc34f65886e3c80d308499242c0fdd7d8
    Reviewed-on: https://gerrit.libreoffice.org/21171
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index c0c4aef..f24b0f9 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -148,12 +148,32 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
         }
         else
         {
-            Size aSize( 14100, 200 );
+            Size aSize( 14100, 2000 );
 
             Point aPos;
             Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+            aWinRect = GetActiveWindow()->PixelToLogic(aWinRect);
+
+            // make sure that the default size of the table fits on the paper and is inside the viewing area.
+            // if zoomed in close, don't make the table bigger than the viewing window.
+            Size aMaxSize = getCurrentPage()->GetSize();
+            if( aMaxSize.Height() > aWinRect.getHeight() )
+                aMaxSize.setHeight( aWinRect.getHeight() );
+            if( aMaxSize.Width() > aWinRect.getWidth() )
+                aMaxSize.setWidth( aWinRect.getWidth() );
+
+            if( aSize.Width() > aMaxSize.getWidth() )
+                aSize.setWidth( aMaxSize.getWidth() );
+
+            // adjust height based on # of rows.
+            if( nRows > 0 )
+            {
+                aSize.setHeight( aSize.Height() * nRows );
+                if( aSize.Height() > aMaxSize.getHeight() )
+                    aSize.setHeight( aMaxSize.getHeight() );
+            }
+
             aPos = aWinRect.Center();
-            aPos = GetActiveWindow()->PixelToLogic(aPos);
             aPos.X() -= aSize.Width() / 2;
             aPos.Y() -= aSize.Height() / 2;
             aRect = Rectangle(aPos, aSize);


More information about the Libreoffice-commits mailing list