summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-10-19 22:00:04 +0200
committerAndras Timar <andras.timar@collabora.com>2017-02-17 21:44:00 +0100
commit5c31a7baccc028163176b37b17cfaa8f5b315627 (patch)
treede0fd9080025ce803e182e6c08c387d55bdeb5f1 /sc/source/ui
parent4d4ad1ef765ab2b1ef75e20281195b2b460c2ccf (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> (cherry picked from commit ffb1fe4f434a48358a18c0af2c44a112d9ad04be)
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/docshell/docfunc.cxx2
-rw-r--r--sc/source/ui/inc/tabview.hxx1
-rw-r--r--sc/source/ui/view/tabview5.cxx45
3 files changed, 48 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index d84c47da3c90..fb7fd67b78c3 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 fdb0823baa8e..3baf60693a01 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: */