diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-10-19 22:00:04 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2017-01-17 13:46:10 +0000 |
commit | ffb1fe4f434a48358a18c0af2c44a112d9ad04be (patch) | |
tree | 7cf42dc9d58f8a3697d3a3464eaa89aa6b1fd0f2 /sc | |
parent | 63c40ba180a584646a69d4c95e20c8580db61211 (diff) |
LOK: Calc: show/hide a note does not perform any tile invalidation
Change-Id: Ia904b6bbe82c395299b269ddbde523d19bf486bc
Reviewed-on: https://gerrit.libreoffice.org/30099
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/tabview.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 45 |
3 files changed, 48 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 3a5eaee43c94..7dab24bc113f 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1221,6 +1221,8 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow ) if (rDoc.IsStreamValid(rPos.Tab())) rDoc.SetStreamValid(rPos.Tab(), false); + ScTabView::OnLOKNoteStateChanged(pNote); + rDocShell.SetDocumentModified(); return true; diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 948f599a30df..5afc3d3920eb 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -584,6 +584,7 @@ public: void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges ); /// @see ScModelObj::getRowColumnHeaders(). OUString getRowColumnHeaders(const Rectangle& rRectangle); + static void OnLOKNoteStateChanged(const ScPostIt* pNote); }; #endif diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index a528e511e479..fe837a7794d8 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -22,6 +22,7 @@ #include <svx/fmshell.hxx> #include <svx/svdobj.hxx> +#include <svx/svdocapt.hxx> #include <svx/svdoutl.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> @@ -47,6 +48,7 @@ #include "AccessibilityHints.hxx" #include "docsh.hxx" #include "viewuno.hxx" +#include "postit.hxx" #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -645,4 +647,47 @@ void ScTabView::ResetBrushDocument() } } +void ScTabView::OnLOKNoteStateChanged(const ScPostIt* pNote) +{ + if (!comphelper::LibreOfficeKit::isActive()) + return; + + const SdrCaptionObj* pCaption = pNote->GetCaption(); + if (!pCaption) return; + + Rectangle aRect = pCaption->GetLogicRect(); + basegfx::B2DRange aTailRange = pCaption->getTailPolygon().getB2DRange(); + Rectangle aTailRect(aTailRange.getMinX(), aTailRange.getMinY(), + aTailRange.getMaxX(), aTailRange.getMaxY()); + aRect.Union( aTailRect ); + + // This is a temporary workaround: sometime in tiled rendering mode + // the tip of the note arrow is misplaced by a fixed offset. + // The value used below is enough to get the tile, where the arrow tip is + // placed, invalidated. + const int nBorderSize = 200; + Rectangle aInvalidRect = aRect; + aInvalidRect.Left() -= nBorderSize; + aInvalidRect.Right() += nBorderSize; + aInvalidRect.Top() -= nBorderSize; + aInvalidRect.Bottom() += nBorderSize; + + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell); + if (pTabViewShell) + { + for (auto& pWin: pTabViewShell->pGridWin) + { + if (pWin && pWin->IsVisible()) + { + pWin->Invalidate(aInvalidRect); + } + } + } + pViewShell = SfxViewShell::GetNext(*pViewShell); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |