diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-10-09 21:50:55 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2016-10-14 15:01:36 +0000 |
commit | 6c9337866d9b4fe4870c3ab2729c6837d07473ff (patch) | |
tree | 5e955cecfe583cb4c8f5595feeb658bdd0436dc2 /editeng | |
parent | a6c008b12cd2c2daf95a18eff0d72239588a5321 (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>
Reviewed-on: https://gerrit.libreoffice.org/29658
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 3c256baa5c4f..63b7b30c57cc 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -294,6 +294,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 84491febf354..7426862afabd 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 6143dfaea7fd..0a9dfb547bb8 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -218,17 +218,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 ad5ba382fd1f..7d30eda43478 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -289,6 +289,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); + } } } |