summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-10-19 22:00:04 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2016-10-20 11:40:12 +0000
commitec32631e7cf8442dc4a7f1f8a361787eeefcbfdf (patch)
tree29d956113b143a0aabbb206d4af38937862186b8
parent02bf72f7513aa4e28e2d544a34a8c8b3465b9e39 (diff)
LOK: Calc: show/hide a note does not perform any tile invalidation
Change-Id: Ia904b6bbe82c395299b269ddbde523d19bf486bc Reviewed-on: https://gerrit.libreoffice.org/30093 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
-rw-r--r--sc/source/ui/docshell/docfunc.cxx1
-rw-r--r--sc/source/ui/inc/tabview.hxx1
-rw-r--r--sc/source/ui/view/tabview5.cxx44
3 files changed, 46 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 604af857cbea..5305b7483365 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1226,6 +1226,7 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
if (rDoc.IsStreamValid(rPos.Tab()))
rDoc.SetStreamValid(rPos.Tab(), false);
+ rDocShell.GetViewData()->GetViewShell()->OnLOKNoteStateChanged(rPos);
rDocShell.SetDocumentModified();
return true;
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 43aaf7d0c471..cbb26bf1e351 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -581,6 +581,7 @@ public:
void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
/// @see ScModelObj::getRowColumnHeaders().
OUString getRowColumnHeaders(const Rectangle& rRectangle);
+ void OnLOKNoteStateChanged(const ScAddress& rPos);
};
#endif
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 83d9094be120..49650b6dcd81 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>
@@ -48,6 +49,7 @@
#include "AccessibilityHints.hxx"
#include "docsh.hxx"
#include "viewuno.hxx"
+#include "postit.hxx"
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -648,4 +650,46 @@ void ScTabView::ResetBrushDocument()
}
}
+void ScTabView::OnLOKNoteStateChanged(const ScAddress& rPos)
+{
+ ScDocument* pDoc = GetViewData().GetDocument();
+ if (!pDoc) return;
+ ScPostIt* pNote = pDoc->GetNote(rPos);
+ if (!pNote) return;
+ SdrCaptionObj* pCaption = pNote->GetCaption();
+ if (!pCaption) return;
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ Rectangle aRect = pCaption->GetLogicRect();
+ basegfx::B2DRange aTailRange = pCaption->getTailPolygon().getB2DRange();
+ Rectangle aTailRect(aTailRange.getMinX(), aTailRange.getMinY(),
+ aTailRange.getMaxX(), aTailRange.getMaxY());
+ aRect.Union( aTailRect );
+ static const int nBorderSize = 200;
+
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+ if (pTabViewShell)
+ {
+ for (auto& pWin: pTabViewShell->pGridWin)
+ {
+ if (pWin && pWin->IsVisible())
+ {
+ Rectangle aInvalidRect = aRect;
+ aInvalidRect.Left() -= nBorderSize;
+ aInvalidRect.Right() += nBorderSize;
+ aInvalidRect.Top() -= nBorderSize;
+ aInvalidRect.Bottom() += nBorderSize;
+ pWin->Invalidate(aInvalidRect);
+ }
+ }
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */