diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-06 16:05:45 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-06 20:55:25 +0100 |
commit | 3547424b9fa9c335e4e0c80fae8c5ac928403045 (patch) | |
tree | 25198c55caf609764155fd9ad2ddfaa8dbd24704 /sw/source | |
parent | d9997df11fb353aa0d6856554e4f845abc315d4f (diff) |
sw: notify LOK clients about invalidations
So that when the document changes, they can know what tiles to throw
away.
Change-Id: I1f00585e7691a40af8fe5de71ac1a4225bc4e67f
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/view/vnew.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/inc/edtwin.hxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 7 |
5 files changed, 44 insertions, 0 deletions
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 14a4ade90ca5..27ec8a394605 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -117,6 +117,18 @@ void SwViewShell::ToggleHeaderFooterEdit() GetWin()->Invalidate(); } +void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + mpLibreOfficeKitCallback = pCallback; + mpLibreOfficeKitData = pData; +} + +void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) +{ + if (mpLibreOfficeKitCallback) + mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); +} + static void lcl_PaintTransparentFormControls(SwViewShell & rShell, SwRect const& rRect) { diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 3cfe6798e6d5..6fef15854c5c 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -169,6 +169,8 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, mnStartAction( 0 ), mnLockPaint( 0 ), mbSelectAll(false), + mpLibreOfficeKitCallback(0), + mpLibreOfficeKitData(0), mpPrePostOutDev(0), // #i72754# maPrePostMapMode() { @@ -245,6 +247,8 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, mnStartAction( 0 ), mnLockPaint( 0 ), mbSelectAll(false), + mpLibreOfficeKitCallback(0), + mpLibreOfficeKitData(0), mpPrePostOutDev(0), // #i72754# maPrePostMapMode() { diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index dfa4306a5177..b51d56b32506 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6235,4 +6235,19 @@ void SwEditWin::SwitchView() #endif } +void SwEditWin::LogicInvalidate(const vcl::Region* pRegion) +{ + OString sRectangle; + if (!pRegion) + sRectangle = "EMPTY"; + else + { + std::stringstream ss; + Rectangle aRectangle = pRegion->GetBoundRect(); + ss << aRectangle.getWidth() << ", " << aRectangle.getHeight() << ", " << aRectangle.getX() << ", " << aRectangle.getY(); + sRectangle = ss.str().c_str(); + } + m_rView.GetWrtShell().libreOfficeKitCallback(0, sRectangle.getStr()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index e08e23750cdc..ff049097c950 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -296,6 +296,12 @@ public: SwEditWin(vcl::Window *pParent, SwView &); virtual ~SwEditWin(); virtual void SwitchView(); + /** + * Notification about some region of the output device got invalidated. + * + * @param pRegion If 0, that means the whole area, otherwise the area in logic coordinates. + */ + void LogicInvalidate(const vcl::Region* pRegion) SAL_OVERRIDE; }; #endif diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index a3493bfd79c6..4bba53506e77 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3157,6 +3157,13 @@ void SwXTextDocument::initializeForTiledRendering() pView->SetViewLayout(nColumns, bBookMode, true); } +void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + SwDoc* pDoc = pDocShell->GetDoc(); + SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); + pViewShell->registerLibreOfficeKitCallback(pCallback, pData); +} + void * SAL_CALL SwXTextDocument::operator new( size_t t) throw() { return SwXTextDocumentBaseClass::operator new(t); |