diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-13 15:54:56 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-14 15:43:02 +0200 |
commit | b20dd57672d7fa54fcd7b507ea8ccec744d751a8 (patch) | |
tree | 48b823df9bf66ab8e463b3ded13cd7779f95f3bf /editeng | |
parent | a778dc1e24ba5581b91f833871d1f000fb73d9dc (diff) |
editeng: add EditView::GetSelectionRectangles()
This gives sd access to the selection rectangles as well (as opposed
only to the document model positions of selections).
Change-Id: Icb903e91f9e868573403b360bbe839705ddf2916
(cherry picked from commit f7764214f2ab8aff030aaeb29efd693275822761)
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 22 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 1 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 5 |
4 files changed, 28 insertions, 5 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 049c5a1eb256..66a49ed925de 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -264,6 +264,11 @@ SvtScriptType EditView::GetSelectedScriptType() const return pImpEditView->pEditEngine->GetScriptType( pImpEditView->GetEditSelection() ); } +void EditView::GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) const +{ + return pImpEditView->GetSelectionRectangles(rLogicRects); +} + void EditView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice ) { pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView, rRect, pTargetDevice ); diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 7fac1135499d..f78cfab12566 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -185,12 +185,10 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou // pRegion: When not NULL, then only calculate Region. + vcl::Region* pOldRegion = pRegion; vcl::Region aRegion; - if (isTiledRendering()) - { - assert(!pRegion); + if (isTiledRendering() && !pRegion) pRegion = &aRegion; - } tools::PolyPolygon* pPolyPoly = NULL; if ( pRegion ) @@ -327,7 +325,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou { *pRegion = vcl::Region( *pPolyPoly ); - if (isTiledRendering()) + if (isTiledRendering() && !pOldRegion) { bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; OString sRectangle; @@ -379,6 +377,20 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou } } +void ImpEditView::GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) +{ + bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; + vcl::Region aRegion; + DrawSelection(aEditSelection, &aRegion); + aRegion.GetRegionRectangles(rLogicRects); + + for (Rectangle& rRectangle : rLogicRects) + { + if (bMm100ToTwip) + rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP); + } +} + void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly ) { if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() ) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 4866523f5171..7b24e6e790b7 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -319,6 +319,7 @@ public: void DrawSelection() { DrawSelection( aEditSelection ); } void DrawSelection( EditSelection, vcl::Region* pRegion = NULL, OutputDevice* pTargetDevice = NULL ); + void GetSelectionRectangles(std::vector<Rectangle>& rLogicRects); vcl::Window* GetWindow() const { return pOutWin; } diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 92f967877e24..329b5f3c0ed4 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1213,6 +1213,11 @@ void OutlinerView::SetSelection( const ESelection& rSel ) pEditView->SetSelection( rSel ); } +void OutlinerView::GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) const +{ + pEditView->GetSelectionRectangles(rLogicRects); +} + void OutlinerView::SetReadOnly( bool bReadOnly ) { pEditView->SetReadOnly( bReadOnly ); |