diff options
-rw-r--r-- | include/sfx2/lokhelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 14 |
5 files changed, 38 insertions, 1 deletions
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index fb2d767b7b66..c3b05b7927e5 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -119,6 +119,8 @@ public: static void notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true); /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED for all views of the same document - if @bInvalidateAll - first invalidates all parts static void notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true); + /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED for all views of the same document with the same part + static void notifyPartSizeChangedAllViews(vcl::ITiledRenderable* pDoc, int nPart); /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed. static void notifyInvalidation(SfxViewShell const* pThisView, tools::Rectangle const *); /// Notifies all views with the given type and payload. diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index df55d056f7f2..40a8311b7bf7 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -45,6 +45,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/event.hxx> #include <sfx2/docfilt.hxx> +#include <sfx2/lokhelper.hxx> #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> #include <svl/documentlockfile.hxx> diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 7830984145c9..660f17aee3f4 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -24,6 +24,7 @@ #include <sfx2/sfxmodelfactory.hxx> #include <sfx2/viewsh.hxx> #include <o3tl/deleter.hxx> +#include <comphelper/lok.hxx> #include <comphelper/servicehelper.hxx> #include <scdllapi.h> @@ -472,7 +473,8 @@ namespace HelperNotifyChanges inline ScModelObj* getMustPropagateChangesModel(const ScDocShell &rDocShell) { ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(rDocShell.GetModel()); - if (pModelObj && pModelObj->HasChangesListeners()) + const bool isLOK = comphelper::LibreOfficeKit::isActive(); // for LOK_CALLBACK_DOCUMENT_SIZE_CHANGED + if (pModelObj && (pModelObj->HasChangesListeners() || isLOK)) return pModelObj; return nullptr; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index bb8a1ce81e7b..0701cae0d9ca 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -3218,6 +3218,24 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r } } + if (comphelper::LibreOfficeKit::isActive()) + { + size_t nRangeCount = rRanges.size(); + for ( size_t nIndex = 0; nIndex < nRangeCount; ++nIndex ) + { + ScRange const & rRange = rRanges[ nIndex ]; + ScAddress const & rEnd = rRange.aEnd; + const Size aCurrentDataArea = getDataArea(rEnd.Tab()); + + SCCOL nLastCol = aCurrentDataArea.Width(); + SCROW nLastRow = aCurrentDataArea.Height(); + + // is equal -> probably we just edited last col/row + if (rEnd.Col() >= nLastCol || rEnd.Row() >= nLastRow) + SfxLokHelper::notifyPartSizeChangedAllViews(this, rEnd.Tab()); + } + } + // handle sheet events //! separate method with ScMarkData? Then change HasChangesListeners back. if ( !(rOperation == "cell-change" && pDocShell) ) diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 5f7bef16a843..794dcc00b300 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -596,6 +596,20 @@ void SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc } } +void SfxLokHelper::notifyPartSizeChangedAllViews(vcl::ITiledRenderable* pDoc, int nPart) +{ + if (DisableCallbacks::disabled()) + return; + + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + if (pViewShell->getPart() == nPart) + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pDoc, false); + pViewShell = SfxViewShell::GetNext(*pViewShell); + } +} + OString SfxLokHelper::makeVisCursorInvalidation(int nViewId, const OString& rRectangle, bool bMispelledWord, const OString& rHyperlink) { |