summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-08-13 13:27:21 +0200
committerJan Holesovsky <kendy@collabora.com>2018-11-08 09:14:29 +0100
commit8e8d4d36aa05959b36ce43b11d4a62ad2eac42bc (patch)
treeba611035ba0cd38fe86fcf4eddecd29d840860fb /vcl
parent7af710953ca8e1b3a1615e3aaa7e02e7697e4599 (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/paint.cxx77
1 files changed, 77 insertions, 0 deletions
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;