[Libreoffice-commits] core.git: sd/source

Rob Snelders programming at ertai.nl
Thu Feb 27 04:28:16 PST 2014


 sd/source/ui/inc/OutlineView.hxx |    4 +++-
 sd/source/ui/view/outlnvsh.cxx   |    3 ++-
 sd/source/ui/view/outlview.cxx   |   27 +++++++++++++++------------
 3 files changed, 20 insertions(+), 14 deletions(-)

New commits:
commit 44c90b3d754faa3a0622423f4839194c85e219fa
Author: Rob Snelders <programming at ertai.nl>
Date:   Mon Feb 3 19:53:40 2014 +0100

    Improve usability of the outline
    
    If you had data in the outline and would scroll to the bottom then it would be
    an empty view at the bottom. The width of the outline was defined as a fixed
    with twice. Once in the outlnvsh and one (even smaller) in the outlview. I have
    changed the with of the outlview to take the with of the outlnvsh.
    
    Change-Id: I1376a135acd92dbe8966b29ccb075e6b74412a8c
    Reviewed-on: https://gerrit.libreoffice.org/7832
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx
index 056c8f7..bc81379 100644
--- a/sd/source/ui/inc/OutlineView.hxx
+++ b/sd/source/ui/inc/OutlineView.hxx
@@ -111,7 +111,7 @@ public:
     DECL_LINK( EndDropHdl, void * );
     DECL_LINK( PaintingFirstLineHdl, PaintFirstLineInfo* );
 
-    sal_uLong         GetPaperWidth() const { return 2*21000; }  // DIN A4 Breite
+    sal_uLong         GetPaperWidth();
 
     sal_Bool          PrepareClose(sal_Bool bUI = sal_True);
 
@@ -188,6 +188,8 @@ private:
 
     sal_Bool                mbFirstPaint;
 
+    sal_uLong               mnPaperWidth;
+
     SfxProgress*        mpProgress;
 
     /** stores the last used document color.
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index b44e1df..6e833df 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -299,7 +299,8 @@ void OutlineViewShell::ArrangeGUIElements ()
         Rectangle aText = Rectangle(Point(0,0),
             Size(pOlView->GetPaperWidth(),
                 pOlView->GetOutliner()->GetTextHeight()));
-        aText.Bottom() += aWin.GetHeight();
+        if (aWin.GetHeight() > aText.Bottom())
+            aText.Bottom() = aWin.GetHeight();
 
         if (!aWin.IsEmpty())            // not when opening
         {
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 7ddf67d..0288c16 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -73,9 +73,6 @@ using namespace ::com::sun::star::frame;
 
 namespace sd {
 
-// width: DIN A4, two margins at 1 cm each
-#define OUTLINE_PAPERWIDTH 19000
-
 // a progress bar gets displayed when more than
 // PROCESS_WITH_PROGRESS_THRESHOLD pages are concerned
 #define PROCESS_WITH_PROGRESS_THRESHOLD  5
@@ -90,9 +87,9 @@ struct SdParaAndPos
 
 TYPEINIT1( OutlineView, ::sd::View );
 
-OutlineView::OutlineView( DrawDocShell& rDocSh, ::Window* pWindow, OutlineViewShell& rOutlineViewSh)
-: ::sd::View(*rDocSh.GetDoc(), pWindow, &rOutlineViewSh)
-, mrOutlineViewShell(rOutlineViewSh)
+OutlineView::OutlineView( DrawDocShell& rDocSh, ::Window* pWindow, OutlineViewShell& rOutlineViewShell)
+: ::sd::View(*rDocSh.GetDoc(), pWindow, &rOutlineViewShell)
+, mrOutlineViewShell(rOutlineViewShell)
 , mrOutliner(*mrDoc.GetOutliner(sal_True))
 , mnPagesToProcess(0)
 , mnPagesProcessed(0)
@@ -109,8 +106,9 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, ::Window* pWindow, OutlineViewSh
         bInitOutliner = sal_True;
         mrOutliner.Init( OUTLINERMODE_OUTLINEVIEW );
         mrOutliner.SetRefDevice( SD_MOD()->GetRefDevice( rDocSh ) );
-        sal_uLong nWidth = OUTLINE_PAPERWIDTH;
-        mrOutliner.SetPaperSize(Size(nWidth, 400000000));
+        //viewsize without the width of the image and number in front
+        mnPaperWidth = (mrOutlineViewShell.GetActiveWindow()->GetViewSize().Width() - 4000);
+        mrOutliner.SetPaperSize(Size(mnPaperWidth, 400000000));
     }
 
     // insert View into Outliner
@@ -798,16 +796,16 @@ IMPL_LINK_NOARG(OutlineView, StatusEventHdl)
     ::sd::Window*   pWin = mrOutlineViewShell.GetActiveWindow();
     OutlinerView*   pOutlinerView = GetViewByWindow(pWin);
     Rectangle     aVis          = pOutlinerView->GetVisArea();
-    sal_uLong nWidth = OUTLINE_PAPERWIDTH;
     Rectangle aText = Rectangle(Point(0,0),
-                                   Size(nWidth,
-                                        mrOutliner.GetTextHeight()));
+                                Size(mnPaperWidth,
+                                     mrOutliner.GetTextHeight()));
     Rectangle aWin(Point(0,0), pWin->GetOutputSizePixel());
     aWin = pWin->PixelToLogic(aWin);
 
     if (!aVis.IsEmpty())        // not when opening
     {
-        aText.Bottom() += aWin.GetHeight();
+        if (aWin.GetHeight() > aText.Bottom())
+            aText.Bottom() = aWin.GetHeight();
 
         mrOutlineViewShell.InitWindows(Point(0,0), aText.GetSize(),
                                        Point(aVis.TopLeft()));
@@ -1044,6 +1042,11 @@ SdrTextObj* OutlineView::CreateOutlineTextObject(SdPage* pPage)
     return GetOutlineTextObject(pPage);
 }
 
+sal_uLong OutlineView::GetPaperWidth()
+{
+    return mnPaperWidth;
+}
+
 /** updates draw model with all changes from outliner model */
 sal_Bool OutlineView::PrepareClose(sal_Bool)
 {


More information about the Libreoffice-commits mailing list