diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-10-09 21:50:55 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2016-10-09 20:52:39 +0000 |
commit | a76cb22a9a51f8815f0735e119cf614b3d08f2c8 (patch) | |
tree | 9f29c3773f4a21a83fd34adaffb3b1c72c473848 /editeng | |
parent | 5fa5fff0ac058fbd081bf010a3680207d3238e2c (diff) |
LOK: Calc: missing invalidate when ending larger-than-cell edit text
- reason: when text content goes further than the cell border the
output area of the edit view is grown (extended to an adjacent cell),
on the contrary the output area of edit views used only for
invalidating windows of other view shells is never updated, so, in
other views, only the tile where the edit cell is placed is
invalidated;
- solution: instead of adding fake edit views for invalidation porpuse
(and having to updated the output area of each of them when required),
the new solution provides each new edit view, created on cell editing,
with a set of `foreign` windows related to other views, they are added
and removed to this collection owned by an edit view still using the
ScExtraEditViewManager, which has been in turn simplified; when
EdiEngine::UpdateViews is invoked not only the window where the edit
view lives is invalidated but also all `foreign` windows in the owned
set;
- note: ScTiledRenderingTest::testTextEditViewInvalidations unit test
has been enhanced in order to test correct invalidation when text
content goes out of the starting tile.
Change-Id: Id223fb1a032d3b18d2cf70df31f704abd245b3ac
Reviewed-on: https://gerrit.libreoffice.org/29625
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 30 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 19 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 7 |
4 files changed, 50 insertions, 12 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index ee6a864f5394..ba4c4c804270 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -295,6 +295,36 @@ vcl::Window* EditView::GetWindow() const return pImpEditView->pOutWin; } +EditView::OutWindowSet& EditView::GetOtherViewWindows() +{ + return pImpEditView->aOutWindowSet; +} + +bool EditView::HasOtherViewWindow( vcl::Window* pWin ) +{ + OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet; + auto found = std::find(rOutWindowSet.begin(), rOutWindowSet.end(), pWin); + return (found != rOutWindowSet.end()); +} + +bool EditView::AddOtherViewWindow( vcl::Window* pWin ) +{ + if (HasOtherViewWindow(pWin)) + return false; + pImpEditView->aOutWindowSet.emplace_back(pWin); + return true; +} + +bool EditView::RemoveOtherViewWindow( vcl::Window* pWin ) +{ + OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet; + auto found = std::find(rOutWindowSet.begin(), rOutWindowSet.end(), pWin); + if (found == rOutWindowSet.end()) + return false; + rOutWindowSet.erase(found); + return true; +} + void EditView::SetVisArea( const Rectangle& rRect ) { pImpEditView->SetVisDocStartPos( rRect.TopLeft() ); diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 83a8e352943c..8e3b09343894 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -79,13 +79,13 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo pOutWin = pWindow; pPointer = nullptr; pBackgroundColor = nullptr; - mpViewShell = nullptr; - mpOtherShell = nullptr; + mpViewShell = nullptr; + mpOtherShell = nullptr; nScrollDiffX = 0; nExtraCursorFlags = 0; nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW; pCursor = nullptr; - pDragAndDropInfo = nullptr; + pDragAndDropInfo = nullptr; bReadOnly = false; bClickedInSelection = false; eSelectionMode = EE_SELMODE_TXTONLY; diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index a1430c601077..ee6e6d888a55 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -219,17 +219,18 @@ class ImpEditView : public vcl::unohelper::DragAndDropClient using vcl::unohelper::DragAndDropClient::dragOver; private: - EditView* pEditView; - vcl::Cursor* pCursor; - Color* pBackgroundColor; + EditView* pEditView; + vcl::Cursor* pCursor; + Color* pBackgroundColor; /// Containing view shell, if any. - OutlinerViewShell* mpViewShell; + OutlinerViewShell* mpViewShell; /// An other shell, just listening to our state, if any. - OutlinerViewShell* mpOtherShell; - EditEngine* pEditEngine; - VclPtr<vcl::Window> pOutWin; - Pointer* pPointer; - DragAndDropInfo* pDragAndDropInfo; + OutlinerViewShell* mpOtherShell; + EditEngine* pEditEngine; + VclPtr<vcl::Window> pOutWin; + EditView::OutWindowSet aOutWindowSet; + Pointer* pPointer; + DragAndDropInfo* pDragAndDropInfo; css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > mxDnDListener; diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index be42d6a8e8e6..908bf9fee19a 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -292,6 +292,13 @@ void ImpEditEngine::UpdateViews( EditView* pCurView ) // convert to window coordinates .... aClipRect = pView->pImpEditView->GetWindowPos( aClipRect ); pView->GetWindow()->Invalidate( aClipRect ); + + EditView::OutWindowSet& rOutWindowSet = pView->GetOtherViewWindows(); + for (auto pWin: rOutWindowSet) + { + if (pWin) + pWin->Invalidate(aClipRect); + } } } |