diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2017-01-01 18:02:51 +0100 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2017-03-15 09:59:10 +0000 |
commit | 1b89b61bbf66472e633ee45e05b86c4030575cf0 (patch) | |
tree | 4c29ef5c2abc4e946db62aa72a5843a56b137dfc /sc | |
parent | 57402a5c2d2ba1635c43ef2a97d71e17652b707d (diff) |
LOK: Calc: invalidation on insert image
Change-Id: Ib0ec104b14385473a2a7f7dc2a33558d998996fa
Reviewed-on: https://gerrit.libreoffice.org/32690
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/inc/tabview.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/tabvwsh.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/viewdata.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 46 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 6 |
8 files changed, 80 insertions, 4 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 0432532c7cd0..0dc9599f1cfb 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -127,6 +127,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou std::unique_ptr<sc::SpellCheckContext> mpSpellCheckCxt; + VclPtr<OutputDevice> mpLOKOutputDevice; ScViewData* pViewData; ScSplitPos eWhich; ScHSplitPos eHWhich; @@ -435,6 +436,8 @@ public: long nTileHeight); void updateLibreOfficeKitCellCursor(SfxViewShell* pOtherShell) const; + const OutputDevice* GetLOKVirtualDevice() const { return mpLOKOutputDevice.get(); } + protected: void ImpCreateOverlayObjects(); void ImpDestroyOverlayObjects(); diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index cbb26bf1e351..92bd6fef2990 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -134,6 +134,7 @@ private: ScHeaderFunctionSet aHdrFunc; ScDrawView* pDrawView; + std::unique_ptr<FmFormView> pLOKDrawView; Size aFrameSize; // passed on as for DoResize Point aBorderPos; @@ -328,6 +329,9 @@ public: // gegen CLOKs SdrView* GetSdrView() { return pDrawView; } + FmFormView* GetLOKDrawView(); + bool UseLOKOutputDevice(const OutputDevice* pOutputDevice) const; + bool IsMinimized() const { return bMinimized; } /** @@ -582,6 +586,7 @@ public: /// @see ScModelObj::getRowColumnHeaders(). OUString getRowColumnHeaders(const Rectangle& rRectangle); void OnLOKNoteStateChanged(const ScAddress& rPos); + void ForEachGridWindow(std::function<void (vcl::Window& )>& f); }; #endif diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 6d24e071d0c4..c9134a6dc66f 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -394,6 +394,12 @@ public: int getPart() const override; /// See SfxViewShell::NotifyCursor(). void NotifyCursor(SfxViewShell* pViewShell) const override; + /// See SfxViewShell:: UseLOKOutputDevice(). + virtual bool UseLOKOutputDevice(const OutputDevice* pOutputDevice) const override + { return ScTabView::UseLOKOutputDevice(pOutputDevice); } + /// See SfxViewShell::InvalidateWindows(). + virtual void InvalidateWindows(std::function<void (vcl::Window& )>& f) override + { ScTabView::ForEachGridWindow(f); } }; #endif diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index d3b80fcebbe9..8175b91f98af 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -103,6 +103,7 @@ class ScExtDocOptions; class ScViewData; class ScMarkData; class ScGridWindow; +class FmFormView; class ScViewDataTable // per-sheet data { @@ -252,6 +253,7 @@ public: const ScGridWindow* GetActiveWin() const; ScDrawView* GetScDrawView(); // from View bool IsMinimized(); // from View + FmFormView* GetLOKDrawView(); // from View void UpdateInputHandler( bool bForce = false, bool bStopEditing = true ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index bbb18e0eb666..96b3036b7e63 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -544,6 +544,7 @@ void ScGridWindow::dispose() { ImpDestroyOverlayObjects(); + mpLOKOutputDevice.disposeAndClear(); mpFilterBox.disposeAndClear(); mpFilterFloat.disposeAndClear(); mpNoteMarker.reset(); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index e9b9e67d14de..1ca15033cb0b 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1215,12 +1215,19 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, // setup the SdrPage so that drawinglayer works correctly ScDrawLayer* pModel = pDoc->GetDrawLayer(); - std::unique_ptr<FmFormView> pDrawView; + if (pModel) { - pDrawView.reset(new FmFormView(pModel, &rDevice)); - pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab)); - aOutputData.SetDrawView( pDrawView.get() ); + FmFormView* pDrawView = pViewData->GetLOKDrawView(); + if (pDrawView) + { + if (mpLOKOutputDevice) + pDrawView->DeleteWindowFromPaintView(mpLOKOutputDevice.get()); + mpLOKOutputDevice.reset(&rDevice); + pDrawView->AddWindowToPaintView(&rDevice, nullptr); + pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab)); + aOutputData.SetDrawView( pDrawView ); + } } // draw the content diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 49650b6dcd81..f743c2a3a7d5 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -268,6 +268,40 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) } } +FmFormView* ScTabView::GetLOKDrawView() +{ + if (!comphelper::LibreOfficeKit::isActive()) + return nullptr; + + if (!pLOKDrawView) + { + ScDrawLayer* pLayer = aViewData.GetDocument()->GetDrawLayer(); + OSL_ENSURE(pLayer, "no Draw Layer available"); + pLOKDrawView.reset(new FmFormView(pLayer, nullptr)); + } + + return pLOKDrawView.get(); +} + +bool ScTabView::UseLOKOutputDevice(const OutputDevice* pOutputDevice) const +{ + if (!comphelper::LibreOfficeKit::isActive()) + return false; + + if (pOutputDevice) + { + for (int i = 0; i < 4; ++i) + { + if (pGridWin[i]) + { + if (pGridWin[i]->GetLOKVirtualDevice() == pOutputDevice) + return true; + } + } + } + return false; +} + void ScTabView::DoAddWin( ScGridWindow* pWin ) { if (pDrawView) @@ -278,6 +312,7 @@ void ScTabView::DoAddWin( ScGridWindow* pWin ) } } + void ScTabView::TabChanged( bool bSameTabButMoved ) { if (pDrawView) @@ -692,4 +727,15 @@ void ScTabView::OnLOKNoteStateChanged(const ScAddress& rPos) } } +void ScTabView::ForEachGridWindow(std::function<void (vcl::Window& )>& f) +{ + for (auto& pWin: pGridWin) + { + if (pWin && pWin->IsVisible()) + { + f(*pWin); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 86814e74f7b1..b5180d46822a 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2205,6 +2205,12 @@ ScDrawView* ScViewData::GetScDrawView() return pView->GetScDrawView(); } +FmFormView* ScViewData::GetLOKDrawView() +{ + OSL_ENSURE( pView, "GetLOKDrawView() without View" ); + return pView->GetLOKDrawView(); +} + bool ScViewData::IsMinimized() { OSL_ENSURE( pView, "IsMinimized() without View" ); |