Blob Blame History Raw
From 0709713ad7ee0fa26b2a4f12720834e47e5dd681 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 6 May 2014 15:56:23 +0100
Subject: [PATCH] Related: fdo#36815 clip overlarge comment contents

and add an indicator that the comment won't fit in the space available

Change-Id: I8dce7dfa678a606e8c4532addc4ba70c2a43644e
---
 sw/source/ui/docvw/SidebarTxtControl.cxx | 23 ++++-------------------
 sw/source/ui/docvw/SidebarWin.cxx        | 31 ++++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx
index 15af740..889c3bb 100644
--- a/sw/source/ui/docvw/SidebarTxtControl.cxx
+++ b/sw/source/ui/docvw/SidebarTxtControl.cxx
@@ -120,28 +120,13 @@ void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt)
 
 void SidebarTxtControl::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, sal_uLong)
 {
-    if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
-    {
-        if ( mrSidebarWin.IsMouseOverSidebarWin() ||
-             HasFocus() )
-        {
-            pDev->DrawGradient( Rectangle( Point(0,0) + rPt, PixelToLogic(GetSizePixel()) ),
-                          Gradient( GradientStyle_LINEAR,
-                                    mrSidebarWin.ColorDark(),
-                                    mrSidebarWin.ColorDark() ) );
-        }
-        else
-        {
-            pDev->DrawGradient( Rectangle( Point(0,0) + rPt, PixelToLogic(GetSizePixel()) ),
-                          Gradient( GradientStyle_LINEAR,
-                                    mrSidebarWin.ColorLight(),
-                                    mrSidebarWin.ColorDark()));
-        }
-    }
+    //Take the control's height, but overwrite the scrollbar area if there was one
+    Size aSize(PixelToLogic(GetSizePixel()));
+    aSize.Width() = rSz.Width();
 
     if ( GetTextView() )
     {
-        GetTextView()->GetOutliner()->Draw(pDev, Rectangle(rPt, rSz));
+        GetTextView()->GetOutliner()->Draw(pDev, Rectangle(rPt, aSize));
     }
 
     if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED )
diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
index c3aa5b0..ebc4d4c 100644
--- a/sw/source/ui/docvw/SidebarWin.cxx
+++ b/sw/source/ui/docvw/SidebarWin.cxx
@@ -218,15 +218,7 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, s
 {
     if (mpMetadataAuthor->IsVisible() )
     {
-        //draw left over space
-        if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
-        {
-            pDev->SetFillColor(COL_BLACK);
-        }
-        else
-        {
-            pDev->SetFillColor(mColorDark);
-        }
+        pDev->SetFillColor(mColorDark);
         pDev->SetLineColor();
         pDev->DrawRect( Rectangle( rPt, rSz ) );
     }
@@ -265,6 +257,27 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, s
 
     pProcessor->process(rSequence);
     delete pProcessor;
+
+    if (mpVScrollbar->IsVisible())
+    {
+        Font aOrigFont(mpMetadataDate->GetControlFont());
+        Color aOrigBg( mpMetadataDate->GetControlBackground() );
+        OUString sOrigText(mpMetadataDate->GetText());
+
+        Size aSize(PixelToLogic(mpMenuButton->GetSizePixel()));
+        Point aPos(PixelToLogic(mpMenuButton->GetPosPixel()));
+        aPos += rPt;
+
+        Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
+        mpMetadataDate->SetControlFont( aFont );
+        mpMetadataDate->SetControlBackground( 0xFFFFFF );
+        mpMetadataDate->SetText("...");
+        mpMetadataDate->Draw(pDev, aPos, aSize, nInFlags);
+
+        mpMetadataDate->SetText(sOrigText);
+        mpMetadataDate->SetControlFont( aOrigFont );
+        mpMetadataDate->SetControlBackground( aOrigBg );
+    }
 }
 
 void SwSidebarWin::SetPosSizePixelRect( long nX,
-- 
1.9.0