vcl/source/window/paint.cxx |   77 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

New commits:
commit b5f1e2fc89f7c82107378e9c0223a5fdfb0ee86e
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon Aug 13 13:27:21 2018 +0200
Commit:     Jan Holesovsky <[email protected]>
CommitDate: Sun Feb 10 11:02:44 2019 +0100

    lokit: Draw dialogs without using a MetaFile
    
    A native widgets aren't part of a VCL metafile so they are ignored
    when the metafile is replayed. When drawing a dialog to a custom
    device, the first draw goes to the metafile, which is then replayed
    to the final device, but no native widgets get drawn. This commit
    changes this behavior for LOKit where it draws without using the
    intermediate VCL metafile.
    
    Change-Id: I823db30c8bceb83830c6c993d4238b39e1331c09

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 8d10d77513e4..7da91892fc4d 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1343,6 +1343,83 @@ void Window::Update()
 
 void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& 
i_rPos )
 {
+    // Special drawing when called through LOKit
+    // TODO: Move to it's own method
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        VclPtrInstance<VirtualDevice> pDevice(*i_pTargetOutDev);
+
+        Size aSize(GetOutputSizePixel());
+        pDevice->SetOutputSizePixel(aSize);
+
+        vcl::Font aCopyFont = GetFont();
+        pDevice->SetFont(aCopyFont);
+
+        pDevice->SetTextColor(GetTextColor());
+        if (IsLineColor())
+            pDevice->SetLineColor(GetLineColor());
+        else
+            pDevice->SetLineColor();
+
+        if (IsFillColor())
+            pDevice->SetFillColor(GetFillColor());
+        else
+            pDevice->SetFillColor();
+
+        if (IsTextLineColor())
+            pDevice->SetTextLineColor(GetTextLineColor());
+        else
+            pDevice->SetTextLineColor();
+
+        if (IsOverlineColor())
+            pDevice->SetOverlineColor(GetOverlineColor());
+        else
+            pDevice->SetOverlineColor();
+
+        if (IsTextFillColor())
+            pDevice->SetTextFillColor(GetTextFillColor());
+        else
+            pDevice->SetTextFillColor();
+
+        pDevice->SetTextAlign(GetTextAlign());
+        pDevice->SetRasterOp(GetRasterOp());
+
+        tools::Rectangle aPaintRect;
+        aPaintRect = tools::Rectangle(Point(), GetOutputSizePixel());
+
+        vcl::Region aClipRegion(GetClipRegion());
+        pDevice->SetClipRegion();
+        aClipRegion.Intersect(aPaintRect);
+        pDevice->SetClipRegion(aClipRegion);
+
+        if (!IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() 
& ParentClipMode::NoClip))
+            Erase(*pDevice);
+
+        Paint(*pDevice, tools::Rectangle(Point(), GetOutputSizePixel()));
+
+        i_pTargetOutDev->DrawOutDev(i_rPos, aSize, Point(), aSize, *pDevice);
+
+        // get rid of virtual device now so they don't pile up during 
recursive calls
+        pDevice.disposeAndClear();
+
+
+        for( vcl::Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild 
= pChild->mpWindowImpl->mpNext )
+        {
+            if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && 
pChild->IsVisible() )
+            {
+                long nDeltaX = pChild->mnOutOffX - mnOutOffX;
+                long nDeltaY = pChild->mnOutOffY - mnOutOffY;
+
+                Point aPos( i_rPos );
+                aPos += Point(nDeltaX, nDeltaY);
+
+                pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
+            }
+        }
+        return;
+    }
+
+
     bool bRVisible = mpWindowImpl->mbReallyVisible;
     mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible;
     bool bDevOutput = mbDevOutput;
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to