[Libreoffice-commits] core.git: 5 commits - sc/source vcl/unx

Caolán McNamara caolanm at redhat.com
Mon Aug 8 13:29:43 UTC 2016


 sc/source/ui/inc/hintwin.hxx       |   45 ---------
 sc/source/ui/inc/overlayobject.hxx |   23 ++++
 sc/source/ui/inc/tabview.hxx       |    3 
 sc/source/ui/view/hintwin.cxx      |  171 +++++++++++++++++++++++++++----------
 sc/source/ui/view/tabview.cxx      |    3 
 sc/source/ui/view/tabview3.cxx     |   59 +++++++++---
 sc/source/ui/view/tabview5.cxx     |    4 
 vcl/unx/gtk/a11y/atklistener.cxx   |    4 
 8 files changed, 201 insertions(+), 111 deletions(-)

New commits:
commit 9b5f03189c2e3919aeb9ad1a2d5bbb9a8d54abae
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 8 14:28:17 2016 +0100

    gtk: a11y: quieten warnings
    
    Change-Id: I4b4c7c22482ca0ee45a114798fcab65a9dc69789

diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx
index da4ce0e..e222466 100644
--- a/vcl/unx/gtk/a11y/atklistener.cxx
+++ b/vcl/unx/gtk/a11y/atklistener.cxx
@@ -589,6 +589,10 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven
             break;
         }
 
+        case accessibility::AccessibleEventId::SELECTION_CHANGED_REMOVE:
+            /* unknown what to do with this */
+            break;
+
         default:
             SAL_WARN("vcl.gtk", "Unknown event notification: " << aEvent.EventId);
             break;
commit de7a230bc2c560db2712d77e6588e446797c8998
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 8 13:15:29 2016 +0100

    Resolves: tdf#92530 put the rest of missing validity tips into the other grids
    
    this stems from...
    
    commit c43a4cb4ffc80c49b8e51ae0796321a6b73b5e99
    Author: Kohei Yoshida <kohei.yoshida at suse.com>
    Date:   Thu Jan 5 22:13:52 2012 -0500
    
        fdo#36851, bnc#737190: Make the data validation popup more reliable.
    
        Previously, the data validation message popup was not sticking on
        reliably on Linux, and flickers very bad on Windows.  That was due to
        the painting conflict between the top-most frame window and the grid
        window.  By making the message popup window a child window of the
        grid window, it paints more reliably.
    
    where the tip was resticted to the current grid because of problems from
    
    svx/source/sdr/overlay/overlaymanagerbuffered.cxx and
    OverlayManagerBuffered where the original flickering window isn't handled
    nicely by the background save/restore stuff there.
    
    So here its all been reimplemented as an overlay which plays better
    with that code, and if it doesn't fit, then its in all grid windows,
    so visually it appears as a single note that floats underneath the
    split window lines.
    
    Change-Id: I18ac42c2a0686ab509252830741d36fb17cae629

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index b265305..99e6cad 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -677,27 +677,49 @@ void ScTabView::TestHintWindow()
                  nRow >= aViewData.GetPosY(WhichV(eWhich)) &&
                  aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() )
             {
-                rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pWin->getOverlayManager();
-                if (xOverlayManager.is())
-                {
-                    const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
-                    Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
-                    // create HintWindow, determines its size by itself
-                    ScOverlayHint* pOverlay = new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont());
+                const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
+                Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
+                // create HintWindow, determines its size by itself
+                ScOverlayHint* pOverlay = new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont());
 
-                    Size aHintWndSize = pOverlay->GetSizePixel();
-                    long nCellSizeX = 0;
-                    long nCellSizeY = 0;
-                    aViewData.GetMergeSizePixel(nCol, nRow, nCellSizeX, nCellSizeY);
+                mxInputHintOO.reset(new sdr::overlay::OverlayObjectList);
+                mxInputHintOO->append(*pOverlay);
 
-                    Point aHintPos = calcHintWindowPosition(
-                        aPos, Size(nCellSizeX,nCellSizeY), aWinSize, aHintWndSize);
+                Size aHintWndSize = pOverlay->GetSizePixel();
+                long nCellSizeX = 0;
+                long nCellSizeY = 0;
+                aViewData.GetMergeSizePixel(nCol, nRow, nCellSizeX, nCellSizeY);
 
-                    pOverlay->SetPos(pWin->PixelToLogic(aHintPos, pWin->GetDrawMapMode()), pWin->GetDrawMapMode());
+                Point aHintPos = calcHintWindowPosition(
+                    aPos, Size(nCellSizeX,nCellSizeY), aWinSize, aHintWndSize);
 
-                    xOverlayManager->add(*pOverlay);
-                    mxInputHintOO.reset(new sdr::overlay::OverlayObjectList);
-                    mxInputHintOO->append(*pOverlay);
+                pOverlay->SetPos(pWin->PixelToLogic(aHintPos, pWin->GetDrawMapMode()), pWin->GetDrawMapMode());
+                for (VclPtr<ScGridWindow> & pWindow : pGridWin)
+                {
+                    if (!pWindow)
+                        continue;
+                    if (!pWindow->IsVisible())
+                        continue;
+                    rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pWindow->getOverlayManager();
+                    if (!xOverlayManager.is())
+                        continue;
+                    if (pWindow == pWin)
+                    {
+                        xOverlayManager->add(*pOverlay);
+                    }
+                    else
+                    {
+                        //tdf#92530 if the help tip doesn't fit into its allocated area in a split window
+                        //scenario, then because here we place it into the other split windows as well the
+                        //missing portions will be displayed in the other split windows to form an apparent
+                        //single tip, albeit "under" the split lines
+                        Point aOtherPos(pWindow->ScreenToOutputPixel(pWin->OutputToScreenPixel(aHintPos)));
+                        ScOverlayHint* pOtherOverlay = new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont());
+                        Point aFooPos(pWindow->PixelToLogic(aOtherPos, pWindow->GetDrawMapMode()));
+                        pOtherOverlay->SetPos(aFooPos, pWindow->GetDrawMapMode());
+                        mxInputHintOO->append(*pOtherOverlay);
+                        xOverlayManager->add(*pOtherOverlay);
+                    }
                 }
             }
         }
commit d07184581894740f08bdcaa4c06f39ed32b73874
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Aug 7 16:55:33 2016 +0100

    Related: tdf#92530 turn the HintWindow into an Overlay
    
    Change-Id: I4cde152cfb4a3ec4127442a6ced9a80ef6235c8f

diff --git a/sc/source/ui/inc/hintwin.hxx b/sc/source/ui/inc/hintwin.hxx
deleted file mode 100644
index 386e340..0000000
--- a/sc/source/ui/inc/hintwin.hxx
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SC_SOURCE_UI_INC_HINTWIN_HXX
-#define INCLUDED_SC_SOURCE_UI_INC_HINTWIN_HXX
-
-#include <vcl/window.hxx>
-
-class ScHintWindow : public vcl::Window
-{
-private:
-    OUString  m_aTitle;
-    OUString  m_aMessage;
-    Point     m_aTextStart;
-    long      m_nTextHeight;
-    vcl::Font m_aTextFont;
-    vcl::Font m_aHeadFont;
-
-protected:
-    virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
-
-public:
-    ScHintWindow(vcl::Window* pParent, const OUString& rTit, const OUString& rMsg);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/overlayobject.hxx b/sc/source/ui/inc/overlayobject.hxx
index 559a868..64746bf 100644
--- a/sc/source/ui/inc/overlayobject.hxx
+++ b/sc/source/ui/inc/overlayobject.hxx
@@ -21,6 +21,8 @@
 #define INCLUDED_SC_SOURCE_UI_INC_OVERLAYOBJECT_HXX
 
 #include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/font.hxx>
+#include <vcl/mapmod.hxx>
 
 class ScOverlayDashedBorder : public sdr::overlay::OverlayObject
 {
@@ -40,23 +42,25 @@ private:
     bool mbToggle;
 };
 
-namespace vcl
-{
-    class Font;
-}
-
 class ScOverlayHint : public sdr::overlay::OverlayObject
 {
 public:
     ScOverlayHint(const OUString& rTit, const OUString& rMsg, const Color& rColor, const vcl::Font& rFont);
+    Size GetSizePixel() const;
+    void SetPos(const Point& rPos, const MapMode& rMode);
 
 public:
     virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
 
 private:
+    drawinglayer::primitive2d::Primitive2DContainer createOverlaySequence(sal_Int32 nLeft, sal_Int32 nTop, const MapMode &rMapMode, basegfx::B2DRange &rRange) const;
+
     const OUString m_aTitle;
     const OUString m_aMessage;
-    const vcl::Font& m_rTextFont;
+    const vcl::Font m_aTextFont;
+    MapMode m_aMapMode;
+    sal_Int32 m_nLeft;
+    sal_Int32 m_nTop;
 };
 
 #endif
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 685de7d..c068063 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -48,7 +48,6 @@ class Splitter;
 class ScTabSplitter;
 class SdrView;
 class SdrObject;
-class ScHintWindow;
 class ScPageBreakData;
 class SdrHdlList;
 class TabBar;
@@ -116,7 +115,7 @@ private:
     VclPtr<ScCornerButton>      aTopButton;
     VclPtr<ScrollBarBox>        aScrollBarBox;
 
-    VclPtr<ScHintWindow>        mpInputHintWindow; // popup window for data validation
+    std::unique_ptr<sdr::overlay::OverlayObjectList> mxInputHintOO; // help hint for data validation
 
     ScPageBreakData*    pPageBreakData;
     std::vector<ScHighlightEntry>   maHighlightRanges;
diff --git a/sc/source/ui/view/hintwin.cxx b/sc/source/ui/view/hintwin.cxx
index c078759..41bce23 100644
--- a/sc/source/ui/view/hintwin.cxx
+++ b/sc/source/ui/view/hintwin.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "hintwin.hxx"
 #include "global.hxx"
 #include "overlayobject.hxx"
 #include "scmod.hxx"
@@ -40,55 +39,30 @@
 #define HINT_INDENT     3
 #define HINT_MARGIN     4
 
-ScHintWindow::ScHintWindow( vcl::Window* pParent, const OUString& rTit, const OUString& rMsg ) :
-    Window( pParent, 0 ),
-    m_aTitle( rTit ),
-    m_aMessage( convertLineEnd(rMsg, LINEEND_CR) )
-{
-    m_aTextFont = GetFont();
-    m_aTextFont.SetTransparent( true );
-    m_aTextFont.SetWeight( WEIGHT_NORMAL );
-    m_aHeadFont = m_aTextFont;
-    m_aHeadFont.SetWeight( WEIGHT_BOLD );
-
-    SetFont( m_aHeadFont );
-    Size aHeadSize( GetTextWidth( m_aTitle ), GetTextHeight() );
-    SetFont( m_aTextFont );
-
-    Size aTextSize;
-    sal_Int32 nIndex = 0;
-    while ( nIndex != -1 )
-    {
-        OUString aLine = m_aMessage.getToken( 0, '\r', nIndex );
-        Size aLineSize( GetTextWidth( aLine ), GetTextHeight() );
-        m_nTextHeight = aLineSize.Height();
-        aTextSize.Height() += m_nTextHeight;
-        if ( aLineSize.Width() > aTextSize.Width() )
-            aTextSize.Width() = aLineSize.Width();
-    }
-    aTextSize.Width() += HINT_INDENT;
-
-    m_aTextStart = Point( HINT_MARGIN + HINT_INDENT,
-                        aHeadSize.Height() + HINT_MARGIN + HINT_LINESPACE );
-
-    Size aWinSize( std::max( aHeadSize.Width(), aTextSize.Width() ) + 2 * HINT_MARGIN + 1,
-                    aHeadSize.Height() + aTextSize.Height() + HINT_LINESPACE + 2 * HINT_MARGIN + 1 );
-    SetOutputSizePixel( aWinSize );
-}
-
 ScOverlayHint::ScOverlayHint(const OUString& rTit, const OUString& rMsg, const Color& rColor, const vcl::Font& rFont)
     : OverlayObject(rColor)
     , m_aTitle(rTit)
     , m_aMessage(convertLineEnd(rMsg, LINEEND_CR))
-    , m_rTextFont(rFont)
+    , m_aTextFont(rFont)
+    , m_aMapMode(MAP_PIXEL)
+    , m_nLeft(0)
+    , m_nTop(0)
 {
 }
 
-drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlayObjectPrimitive2DSequence()
+drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequence(sal_Int32 nLeft, sal_Int32 nTop,
+                                                                                     const MapMode &rMapMode,
+                                                                                     basegfx::B2DRange &rRange) const
 {
+    OutputDevice* pDefaultDev = Application::GetDefaultDevice();
+    MapMode aOld = pDefaultDev->GetMapMode();
+    pDefaultDev->SetMapMode(rMapMode);
+
     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-    const Color& rColor = rStyleSettings.GetWindowTextColor();
-    vcl::Font aHeadFont = m_rTextFont;
+    const Color& rColor = rStyleSettings.GetLabelTextColor();
+    vcl::Font aTextFont = m_aTextFont;
+    aTextFont.SetFontSize(pDefaultDev->PixelToLogic(aTextFont.GetFontSize(), rMapMode));
+    vcl::Font aHeadFont = aTextFont;
     aHeadFont.SetWeight(WEIGHT_BOLD);
 
     // Create the text primitive for the title
@@ -96,16 +70,16 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlayObje
     drawinglayer::attribute::FontAttribute aFontAttr =
         drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, aHeadFont, false, false);
 
-    OutputDevice* pDefaultDev = Application::GetDefaultDevice();
-
     FontMetric aFontMetric = pDefaultDev->GetFontMetric(aHeadFont);
-    double nTextOffsetY = HINT_MARGIN + aFontMetric.GetAscent();
-    Point aTextPos(HINT_MARGIN, nTextOffsetY);
-    basegfx::B2DRange aRange(0, 0, HINT_MARGIN, nTextOffsetY);
+    Size aHintMargin = pDefaultDev->PixelToLogic(Size(HINT_MARGIN, HINT_MARGIN), rMapMode);
+    Size aIndent = pDefaultDev->PixelToLogic(Size(HINT_INDENT, HINT_LINESPACE), rMapMode);
+    double nTextOffsetY = nTop + aHintMargin.Height() + aFontMetric.GetAscent();
+    Point aTextPos(nLeft + aHintMargin.Width() , nTextOffsetY);
+    rRange = basegfx::B2DRange(nLeft, nTop, nLeft + aHintMargin.Width(), nTop + aHintMargin.Height());
 
     basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
                                             aFontSize.getX(), aFontSize.getY(),
-                                            double(aTextPos.X()), double(aTextPos.Y())));
+                                            aTextPos.X(), aTextPos.Y()));
 
     drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pTitle =
         new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
@@ -115,21 +89,24 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlayObje
 
     const drawinglayer::primitive2d::Primitive2DReference aTitle(pTitle);
 
-    Point m_aTextStart(HINT_MARGIN + HINT_INDENT, HINT_MARGIN + aFontMetric.GetLineHeight() + HINT_LINESPACE);
+    Point aTextStart(nLeft + aHintMargin.Width() + aIndent.Width(),
+                     nTop + aHintMargin.Height() + aFontMetric.GetLineHeight() + aIndent.Height());
 
     drawinglayer::geometry::ViewInformation2D aDummy;
-    aRange.expand(pTitle->getB2DRange(aDummy));
+    rRange.expand(pTitle->getB2DRange(aDummy));
 
     drawinglayer::primitive2d::Primitive2DContainer aSeq { aTitle };
 
-    aFontMetric = pDefaultDev->GetFontMetric(m_rTextFont);
+    aFontMetric = pDefaultDev->GetFontMetric(aTextFont);
+    pDefaultDev->SetMapMode(aOld);
 
     nTextOffsetY = aFontMetric.GetAscent();
+    sal_Int32 nLineHeight = aFontMetric.GetLineHeight();
 
-    aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_rTextFont, false, false);
+    aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, aTextFont, false, false);
 
     sal_Int32 nIndex = 0;
-    Point aLineStart = m_aTextStart;
+    Point aLineStart = aTextStart;
     while (nIndex != -1)
     {
         OUString aLine = m_aMessage.getToken( 0, '\r', nIndex );
@@ -145,17 +122,18 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlayObje
                                                 std::vector<double>(), aFontAttr, css::lang::Locale(),
                                                 rColor.getBColor());
 
-        aRange.expand(pMessage->getB2DRange(aDummy));
+        rRange.expand(pMessage->getB2DRange(aDummy));
 
         const drawinglayer::primitive2d::Primitive2DReference aMessage(pMessage);
         aSeq.push_back(aMessage);
 
-        aLineStart.Y() += aFontMetric.GetLineHeight();
+        aLineStart.Y() += nLineHeight;
     }
 
-    aRange.grow(HINT_MARGIN);
+    rRange.expand(basegfx::B2DTuple(rRange.getMaxX() + aHintMargin.Width(),
+                                    rRange.getMaxY() + aHintMargin.Height()));
 
-    basegfx::B2DPolygon aPoly(basegfx::tools::createPolygonFromRect(aRange));
+    basegfx::B2DPolygon aPoly(basegfx::tools::createPolygonFromRect(rRange));
 
     const drawinglayer::primitive2d::Primitive2DReference aBg(
         new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPoly), getBaseColor().getBColor()));
@@ -165,30 +143,30 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlayObje
         new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
             aPoly, aBorderColor));
 
-
     aSeq.insert(aSeq.begin(), aBorder);
     aSeq.insert(aSeq.begin(), aBg);
 
     return aSeq;
 }
 
-void ScHintWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /* rRect */)
+drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlayObjectPrimitive2DSequence()
 {
-    // Create the processor and process the primitives
-    const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
-    std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> xProcessor(
-        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos));
-
-    const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
-    Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
-
-    ScOverlayHint* pHint = new ScOverlayHint(m_aTitle, m_aMessage, aCommentColor, GetFont());
-
-    drawinglayer::primitive2d::Primitive2DContainer aSeq = pHint->createOverlayObjectPrimitive2DSequence();
+    basegfx::B2DRange aRange;
+    return createOverlaySequence(m_nLeft, m_nTop, m_aMapMode, aRange);
+}
 
-    delete pHint;
+Size ScOverlayHint::GetSizePixel() const
+{
+    basegfx::B2DRange aRange;
+    createOverlaySequence(0, 0, MAP_PIXEL, aRange);
+    return Size(aRange.getWidth(), aRange.getHeight());
+}
 
-    xProcessor->process(aSeq);
+void ScOverlayHint::SetPos(const Point& rPos, const MapMode& rMode)
+{
+    m_nLeft = rPos.X();
+    m_nTop = rPos.Y();
+    m_aMapMode = rMode;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 79f2ada..aa81b31 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -44,7 +44,6 @@
 #include "AccessibilityHints.hxx"
 #include "appoptio.hxx"
 #include "attrib.hxx"
-#include "hintwin.hxx"
 
 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
 
@@ -204,7 +203,7 @@ ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell*
     aCornerButton( VclPtr<ScCornerButton>::Create( pFrameWin, &aViewData, false ) ),
     aTopButton( VclPtr<ScCornerButton>::Create( pFrameWin, &aViewData, true ) ),
     aScrollBarBox( VclPtr<ScrollBarBox>::Create( pFrameWin, WB_SIZEABLE ) ),
-    mpInputHintWindow( nullptr ),
+    mxInputHintOO(),
     pPageBreakData( nullptr ),
     pBrushDocument( nullptr ),
     pDrawBrushSet( nullptr ),
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 459ab62..b265305 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -24,6 +24,7 @@
 #include <editeng/brushitem.hxx>
 #include <editeng/editview.hxx>
 #include <svx/fmshell.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
 #include <svx/svdoole2.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/viewfrm.hxx>
@@ -34,6 +35,7 @@
 #include "docsh.hxx"
 #include "gridwin.hxx"
 #include "olinewin.hxx"
+#include "overlayobject.hxx"
 #include "colrowba.hxx"
 #include "tabcont.hxx"
 #include "scmod.hxx"
@@ -44,7 +46,6 @@
 #include "inputhdl.hxx"
 #include "inputwin.hxx"
 #include "validat.hxx"
-#include "hintwin.hxx"
 #include "inputopt.hxx"
 #include "rfindlst.hxx"
 #include "hiranges.hxx"
@@ -646,6 +647,8 @@ void ScTabView::TestHintWindow()
 {
     //  show input help window and list drop-down button for validity
 
+    mxInputHintOO.reset();
+
     bool bListValButton = false;
     ScAddress aListValPos;
 
@@ -660,12 +663,9 @@ void ScTabView::TestHintWindow()
         const ScValidationData* pData = pDoc->GetValidationEntry( pItem->GetValue() );
         OSL_ENSURE(pData,"ValidationData not found");
         OUString aTitle, aMessage;
+
         if ( pData && pData->GetInput( aTitle, aMessage ) && !aMessage.isEmpty() )
         {
-            //! check if on the same spot !!!!
-
-            mpInputHintWindow.disposeAndClear();
-
             ScSplitPos eWhich = aViewData.GetActivePart();
             ScGridWindow* pWin = pGridWin[eWhich];
             SCCOL nCol = aViewData.GetCurX();
@@ -677,23 +677,30 @@ void ScTabView::TestHintWindow()
                  nRow >= aViewData.GetPosY(WhichV(eWhich)) &&
                  aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() )
             {
-                // create HintWindow, determines its size by itself
-                mpInputHintWindow.reset(VclPtr<ScHintWindow>::Create(pWin, aTitle, aMessage));
-                Size aHintWndSize = mpInputHintWindow->GetSizePixel();
-                long nCellSizeX = 0;
-                long nCellSizeY = 0;
-                aViewData.GetMergeSizePixel(nCol, nRow, nCellSizeX, nCellSizeY);
-
-                Point aHintPos = calcHintWindowPosition(
-                    aPos, Size(nCellSizeX,nCellSizeY), aWinSize, aHintWndSize);
-
-                mpInputHintWindow->SetPosPixel( aHintPos );
-                mpInputHintWindow->ToTop();
-                mpInputHintWindow->Show();
+                rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pWin->getOverlayManager();
+                if (xOverlayManager.is())
+                {
+                    const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
+                    Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
+                    // create HintWindow, determines its size by itself
+                    ScOverlayHint* pOverlay = new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont());
+
+                    Size aHintWndSize = pOverlay->GetSizePixel();
+                    long nCellSizeX = 0;
+                    long nCellSizeY = 0;
+                    aViewData.GetMergeSizePixel(nCol, nRow, nCellSizeX, nCellSizeY);
+
+                    Point aHintPos = calcHintWindowPosition(
+                        aPos, Size(nCellSizeX,nCellSizeY), aWinSize, aHintWndSize);
+
+                    pOverlay->SetPos(pWin->PixelToLogic(aHintPos, pWin->GetDrawMapMode()), pWin->GetDrawMapMode());
+
+                    xOverlayManager->add(*pOverlay);
+                    mxInputHintOO.reset(new sdr::overlay::OverlayObjectList);
+                    mxInputHintOO->append(*pOverlay);
+                }
             }
         }
-        else
-            mpInputHintWindow.disposeAndClear();
 
         // list drop-down button
         if ( pData && pData->HasSelectionList() )
@@ -702,8 +709,6 @@ void ScTabView::TestHintWindow()
             bListValButton = true;
         }
     }
-    else
-        mpInputHintWindow.disposeAndClear();
 
     for (VclPtr<ScGridWindow> & pWin : pGridWin)
         if ( pWin && pWin->IsVisible() )
@@ -712,12 +717,12 @@ void ScTabView::TestHintWindow()
 
 bool ScTabView::HasHintWindow() const
 {
-    return mpInputHintWindow.get() != nullptr;
+    return mxInputHintOO.get() != nullptr;
 }
 
 void ScTabView::RemoveHintWindow()
 {
-    mpInputHintWindow.disposeAndClear();
+    mxInputHintOO.reset();
 }
 
 // find window that should not be over the cursor
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index ee9c6fd..6a7b796 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -35,7 +35,6 @@
 #include "tabsplit.hxx"
 #include "colrowba.hxx"
 #include "tabcont.hxx"
-#include "hintwin.hxx"
 #include "sc.hrc"
 #include "pagedata.hxx"
 #include "hiranges.hxx"
@@ -176,8 +175,7 @@ ScTabView::~ScTabView()
 
     delete pSelEngine;
 
-    // Delete this before the grid windows, since it's a child window of one of them.
-    mpInputHintWindow.disposeAndClear();
+    mxInputHintOO.reset();
     for (i=0; i<4; i++)
         pGridWin[i].disposeAndClear();
 
commit 0ccf1e3bab080a74c4aea96dd3bb9ad29aac81e4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 5 16:04:39 2016 +0100

    refactor in terms of a OverlayObject
    
    Change-Id: Iab1cc096b6020cbb106cece89349f479f7cb33cf

diff --git a/sc/source/ui/inc/overlayobject.hxx b/sc/source/ui/inc/overlayobject.hxx
index ffa97ff..559a868 100644
--- a/sc/source/ui/inc/overlayobject.hxx
+++ b/sc/source/ui/inc/overlayobject.hxx
@@ -40,6 +40,25 @@ private:
     bool mbToggle;
 };
 
+namespace vcl
+{
+    class Font;
+}
+
+class ScOverlayHint : public sdr::overlay::OverlayObject
+{
+public:
+    ScOverlayHint(const OUString& rTit, const OUString& rMsg, const Color& rColor, const vcl::Font& rFont);
+
+public:
+    virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override;
+
+private:
+    const OUString m_aTitle;
+    const OUString m_aMessage;
+    const vcl::Font& m_rTextFont;
+};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/hintwin.cxx b/sc/source/ui/view/hintwin.cxx
index 7e3fbe2..c078759 100644
--- a/sc/source/ui/view/hintwin.cxx
+++ b/sc/source/ui/view/hintwin.cxx
@@ -19,6 +19,7 @@
 
 #include "hintwin.hxx"
 #include "global.hxx"
+#include "overlayobject.hxx"
 #include "scmod.hxx"
 
 #include <drawinglayer/attribute/fillgradientattribute.hxx>
@@ -75,56 +76,61 @@ ScHintWindow::ScHintWindow( vcl::Window* pParent, const OUString& rTit, const OU
     SetOutputSizePixel( aWinSize );
 }
 
-void ScHintWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /* rRect */)
+ScOverlayHint::ScOverlayHint(const OUString& rTit, const OUString& rMsg, const Color& rColor, const vcl::Font& rFont)
+    : OverlayObject(rColor)
+    , m_aTitle(rTit)
+    , m_aMessage(convertLineEnd(rMsg, LINEEND_CR))
+    , m_rTextFont(rFont)
 {
-    // Create the processor and process the primitives
-    const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
-    std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> xProcessor(
-        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos));
-
-    const Rectangle aRect(Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
-    basegfx::B2DPolygon aPoly(basegfx::tools::createPolygonFromRect(basegfx::B2DRectangle(aRect.Left(), aRect.Top(),
-                                                                                          aRect.Right(), aRect.Bottom())));
-
-    const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
-    Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
-    const drawinglayer::primitive2d::Primitive2DReference aBg(
-        new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPoly), aCommentColor.getBColor()));
+}
 
-    basegfx::BColor aBorder(0.5, 0.5, 0.5);
-    const drawinglayer::primitive2d::Primitive2DReference aReference(
-        new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
-            aPoly, aBorder));
+drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlayObjectPrimitive2DSequence()
+{
+    const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+    const Color& rColor = rStyleSettings.GetWindowTextColor();
+    vcl::Font aHeadFont = m_rTextFont;
+    aHeadFont.SetWeight(WEIGHT_BOLD);
 
     // Create the text primitive for the title
     basegfx::B2DVector aFontSize;
     drawinglayer::attribute::FontAttribute aFontAttr =
-        drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_aHeadFont, false, false);
+        drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, aHeadFont, false, false);
+
+    OutputDevice* pDefaultDev = Application::GetDefaultDevice();
 
-    FontMetric aFontMetric = rRenderContext.GetFontMetric(m_aHeadFont);
-    double nTextOffsetY = aFontMetric.GetAscent() + HINT_MARGIN;
+    FontMetric aFontMetric = pDefaultDev->GetFontMetric(aHeadFont);
+    double nTextOffsetY = HINT_MARGIN + aFontMetric.GetAscent();
     Point aTextPos(HINT_MARGIN, nTextOffsetY);
+    basegfx::B2DRange aRange(0, 0, HINT_MARGIN, nTextOffsetY);
 
     basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
                                             aFontSize.getX(), aFontSize.getY(),
                                             double(aTextPos.X()), double(aTextPos.Y())));
 
-    const drawinglayer::primitive2d::Primitive2DReference aTitle(
-                    new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+    drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pTitle =
+        new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
                         aTextMatrix, m_aTitle, 0, m_aTitle.getLength(),
                         std::vector<double>(), aFontAttr, css::lang::Locale(),
-                        GetLineColor().getBColor()));
+                        rColor.getBColor());
+
+    const drawinglayer::primitive2d::Primitive2DReference aTitle(pTitle);
+
+    Point m_aTextStart(HINT_MARGIN + HINT_INDENT, HINT_MARGIN + aFontMetric.GetLineHeight() + HINT_LINESPACE);
+
+    drawinglayer::geometry::ViewInformation2D aDummy;
+    aRange.expand(pTitle->getB2DRange(aDummy));
 
-    drawinglayer::primitive2d::Primitive2DContainer aSeq { aBg, aReference, aTitle };
+    drawinglayer::primitive2d::Primitive2DContainer aSeq { aTitle };
+
+    aFontMetric = pDefaultDev->GetFontMetric(m_rTextFont);
 
-    aFontMetric = rRenderContext.GetFontMetric(m_aTextFont);
     nTextOffsetY = aFontMetric.GetAscent();
 
-    aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_aTextFont, false, false);
+    aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_rTextFont, false, false);
 
     sal_Int32 nIndex = 0;
     Point aLineStart = m_aTextStart;
-    while ( nIndex != -1 )
+    while (nIndex != -1)
     {
         OUString aLine = m_aMessage.getToken( 0, '\r', nIndex );
 
@@ -133,17 +139,55 @@ void ScHintWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*
                                 aLineStart.X(), aLineStart.Y() + nTextOffsetY);
 
         // Create the text primitive for each line of text
-        const drawinglayer::primitive2d::Primitive2DReference aMessage(
+        drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pMessage =
                                         new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
                                                 aTextMatrix, aLine, 0, aLine.getLength(),
                                                 std::vector<double>(), aFontAttr, css::lang::Locale(),
-                                                GetLineColor().getBColor()));
+                                                rColor.getBColor());
+
+        aRange.expand(pMessage->getB2DRange(aDummy));
 
+        const drawinglayer::primitive2d::Primitive2DReference aMessage(pMessage);
         aSeq.push_back(aMessage);
 
-        aLineStart.Y() += m_nTextHeight;
+        aLineStart.Y() += aFontMetric.GetLineHeight();
     }
 
+    aRange.grow(HINT_MARGIN);
+
+    basegfx::B2DPolygon aPoly(basegfx::tools::createPolygonFromRect(aRange));
+
+    const drawinglayer::primitive2d::Primitive2DReference aBg(
+        new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPoly), getBaseColor().getBColor()));
+
+    basegfx::BColor aBorderColor(0.5, 0.5, 0.5);
+    const drawinglayer::primitive2d::Primitive2DReference aBorder(
+        new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+            aPoly, aBorderColor));
+
+
+    aSeq.insert(aSeq.begin(), aBorder);
+    aSeq.insert(aSeq.begin(), aBg);
+
+    return aSeq;
+}
+
+void ScHintWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /* rRect */)
+{
+    // Create the processor and process the primitives
+    const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
+    std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> xProcessor(
+        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos));
+
+    const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
+    Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
+
+    ScOverlayHint* pHint = new ScOverlayHint(m_aTitle, m_aMessage, aCommentColor, GetFont());
+
+    drawinglayer::primitive2d::Primitive2DContainer aSeq = pHint->createOverlayObjectPrimitive2DSequence();
+
+    delete pHint;
+
     xProcessor->process(aSeq);
 }
 
commit f045b7610e7a014f17f848140f877f4819ab5c54
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 5 14:21:39 2016 +0100

    Reimplement ScHintWindow::Paint using drawinglayer primitives
    
    they are very verbose and very unpleasant to work with, surely
    it doesn't need to be this horrific
    
    Change-Id: I6ad43eb73c94881cca594863f6637302ddc7f1df

diff --git a/sc/source/ui/inc/hintwin.hxx b/sc/source/ui/inc/hintwin.hxx
index 801a7b16..386e340 100644
--- a/sc/source/ui/inc/hintwin.hxx
+++ b/sc/source/ui/inc/hintwin.hxx
@@ -25,19 +25,18 @@
 class ScHintWindow : public vcl::Window
 {
 private:
-    OUString  aTitle;
-    OUString  aMessage;
-    Point     aTextStart;
-    long      nTextHeight;
-    vcl::Font aTextFont;
-    vcl::Font aHeadFont;
+    OUString  m_aTitle;
+    OUString  m_aMessage;
+    Point     m_aTextStart;
+    long      m_nTextHeight;
+    vcl::Font m_aTextFont;
+    vcl::Font m_aHeadFont;
 
 protected:
-    virtual void    Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) override;
+    virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
 
 public:
-            ScHintWindow( vcl::Window* pParent, const OUString& rTit, const OUString& rMsg );
-            virtual ~ScHintWindow();
+    ScHintWindow(vcl::Window* pParent, const OUString& rTit, const OUString& rMsg);
 };
 
 #endif
diff --git a/sc/source/ui/view/hintwin.cxx b/sc/source/ui/view/hintwin.cxx
index d2ebcae..7e3fbe2 100644
--- a/sc/source/ui/view/hintwin.cxx
+++ b/sc/source/ui/view/hintwin.cxx
@@ -19,44 +19,55 @@
 
 #include "hintwin.hxx"
 #include "global.hxx"
+#include "scmod.hxx"
+
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svtools/colorcfg.hxx>
 
 #define HINT_LINESPACE  2
 #define HINT_INDENT     3
 #define HINT_MARGIN     4
 
 ScHintWindow::ScHintWindow( vcl::Window* pParent, const OUString& rTit, const OUString& rMsg ) :
-    Window( pParent, WinBits( WB_BORDER ) ),
-    aTitle( rTit ),
-    aMessage( convertLineEnd(rMsg, LINEEND_CR) )
+    Window( pParent, 0 ),
+    m_aTitle( rTit ),
+    m_aMessage( convertLineEnd(rMsg, LINEEND_CR) )
 {
-    // pale yellow, the same as for notes in detfunc.cxx
-    Color aYellow( 255,255,192 );           // pale yellow
-    SetBackground( aYellow );
-
-    aTextFont = GetFont();
-    aTextFont.SetTransparent( true );
-    aTextFont.SetWeight( WEIGHT_NORMAL );
-    aHeadFont = aTextFont;
-    aHeadFont.SetWeight( WEIGHT_BOLD );
+    m_aTextFont = GetFont();
+    m_aTextFont.SetTransparent( true );
+    m_aTextFont.SetWeight( WEIGHT_NORMAL );
+    m_aHeadFont = m_aTextFont;
+    m_aHeadFont.SetWeight( WEIGHT_BOLD );
 
-    SetFont( aHeadFont );
-    Size aHeadSize( GetTextWidth( aTitle ), GetTextHeight() );
-    SetFont( aTextFont );
+    SetFont( m_aHeadFont );
+    Size aHeadSize( GetTextWidth( m_aTitle ), GetTextHeight() );
+    SetFont( m_aTextFont );
 
     Size aTextSize;
     sal_Int32 nIndex = 0;
     while ( nIndex != -1 )
     {
-        OUString aLine = aMessage.getToken( 0, '\r', nIndex );
+        OUString aLine = m_aMessage.getToken( 0, '\r', nIndex );
         Size aLineSize( GetTextWidth( aLine ), GetTextHeight() );
-        nTextHeight = aLineSize.Height();
-        aTextSize.Height() += nTextHeight;
+        m_nTextHeight = aLineSize.Height();
+        aTextSize.Height() += m_nTextHeight;
         if ( aLineSize.Width() > aTextSize.Width() )
             aTextSize.Width() = aLineSize.Width();
     }
     aTextSize.Width() += HINT_INDENT;
 
-    aTextStart = Point( HINT_MARGIN + HINT_INDENT,
+    m_aTextStart = Point( HINT_MARGIN + HINT_INDENT,
                         aHeadSize.Height() + HINT_MARGIN + HINT_LINESPACE );
 
     Size aWinSize( std::max( aHeadSize.Width(), aTextSize.Width() ) + 2 * HINT_MARGIN + 1,
@@ -64,24 +75,76 @@ ScHintWindow::ScHintWindow( vcl::Window* pParent, const OUString& rTit, const OU
     SetOutputSizePixel( aWinSize );
 }
 
-ScHintWindow::~ScHintWindow()
+void ScHintWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /* rRect */)
 {
-}
+    // Create the processor and process the primitives
+    const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
+    std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> xProcessor(
+        drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos));
 
-void ScHintWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& /* rRect */ )
-{
-    SetFont( aHeadFont );
-    DrawText( Point(HINT_MARGIN,HINT_MARGIN), aTitle );
+    const Rectangle aRect(Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
+    basegfx::B2DPolygon aPoly(basegfx::tools::createPolygonFromRect(basegfx::B2DRectangle(aRect.Left(), aRect.Top(),
+                                                                                          aRect.Right(), aRect.Bottom())));
+
+    const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
+    Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
+    const drawinglayer::primitive2d::Primitive2DReference aBg(
+        new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPoly), aCommentColor.getBColor()));
+
+    basegfx::BColor aBorder(0.5, 0.5, 0.5);
+    const drawinglayer::primitive2d::Primitive2DReference aReference(
+        new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+            aPoly, aBorder));
+
+    // Create the text primitive for the title
+    basegfx::B2DVector aFontSize;
+    drawinglayer::attribute::FontAttribute aFontAttr =
+        drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_aHeadFont, false, false);
+
+    FontMetric aFontMetric = rRenderContext.GetFontMetric(m_aHeadFont);
+    double nTextOffsetY = aFontMetric.GetAscent() + HINT_MARGIN;
+    Point aTextPos(HINT_MARGIN, nTextOffsetY);
+
+    basegfx::B2DHomMatrix aTextMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
+                                            aFontSize.getX(), aFontSize.getY(),
+                                            double(aTextPos.X()), double(aTextPos.Y())));
+
+    const drawinglayer::primitive2d::Primitive2DReference aTitle(
+                    new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+                        aTextMatrix, m_aTitle, 0, m_aTitle.getLength(),
+                        std::vector<double>(), aFontAttr, css::lang::Locale(),
+                        GetLineColor().getBColor()));
+
+    drawinglayer::primitive2d::Primitive2DContainer aSeq { aBg, aReference, aTitle };
+
+    aFontMetric = rRenderContext.GetFontMetric(m_aTextFont);
+    nTextOffsetY = aFontMetric.GetAscent();
+
+    aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_aTextFont, false, false);
 
-    SetFont( aTextFont );
     sal_Int32 nIndex = 0;
-    Point aLineStart = aTextStart;
+    Point aLineStart = m_aTextStart;
     while ( nIndex != -1 )
     {
-        OUString aLine = aMessage.getToken( 0, '\r', nIndex );
-        DrawText( aLineStart, aLine );
-        aLineStart.Y() += nTextHeight;
+        OUString aLine = m_aMessage.getToken( 0, '\r', nIndex );
+
+        aTextMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(
+                                aFontSize.getX(), aFontSize.getY(),
+                                aLineStart.X(), aLineStart.Y() + nTextOffsetY);
+
+        // Create the text primitive for each line of text
+        const drawinglayer::primitive2d::Primitive2DReference aMessage(
+                                        new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+                                                aTextMatrix, aLine, 0, aLine.getLength(),
+                                                std::vector<double>(), aFontAttr, css::lang::Locale(),
+                                                GetLineColor().getBColor()));
+
+        aSeq.push_back(aMessage);
+
+        aLineStart.Y() += m_nTextHeight;
     }
+
+    xProcessor->process(aSeq);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list