diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-03-31 18:17:23 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-03-31 19:25:35 +0200 |
commit | 437612237aa31437dfcb639c72e349edd3ccef27 (patch) | |
tree | e57e8a4886cde45b7f2660784d8477a5cf26d27c /svx | |
parent | 9281ae9c1e26316d6a6b5ab329bfad50d6e08fff (diff) |
lok sc: Don't depend on the OutputDevice existence when invalidating.
We know that the drawinglayer operates in 100th of millimetre, and that we
need twips for LOK.
Change-Id: I8813f936ab66eaca4d6b9c03341e090d703decb8
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/sdrpagewindow.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index e6db45293c4a..fcd8cbc678a1 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -36,7 +36,7 @@ #include <osl/mutex.hxx> #include <svx/fmview.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> - +#include <sfx2/lokhelper.hxx> using namespace ::com::sun::star; @@ -406,7 +406,23 @@ void SdrPageWindow::RedrawLayer( const SdrLayerID* pId, sdr::contact::ViewObject // Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...) void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange) { - if(GetPageView().IsVisible() && GetPaintWindow().OutputToWindow()) + if (comphelper::LibreOfficeKit::isActive()) + { + // we don't really have a paint window with LOK; OTOH we know that the + // drawinglayer units are 100ths of mm, so they are easy to convert to + // twips + const Rectangle aRect100thMM( + static_cast<long>(floor(rRange.getMinX())), + static_cast<long>(floor(rRange.getMinY())), + static_cast<long>(ceil(rRange.getMaxX())), + static_cast<long>(ceil(rRange.getMaxY()))); + + const Rectangle aRectTwips = OutputDevice::LogicToLogic(aRect100thMM, MapUnit::Map100thMM, MapUnit::MapTwip); + + if (SfxViewShell* pViewShell = SfxViewShell::Current()) + SfxLokHelper::notifyInvalidation(pViewShell, aRectTwips.toString()); + } + else if (GetPageView().IsVisible() && GetPaintWindow().OutputToWindow()) { const SvtOptionsDrawinglayer aDrawinglayerOpt; vcl::Window& rWindow(static_cast< vcl::Window& >(GetPaintWindow().GetOutputDevice())); |