diff options
-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 | ||||
-rw-r--r-- | include/editeng/editview.hxx | 2 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 1 |
6 files changed, 31 insertions, 5 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 4e365737ec71..45790d1ef255 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 83e30ffce918..4b41e79983bb 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 ) @@ -326,7 +324,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; @@ -378,6 +376,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 29c0a993c59d..01606191d101 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 e2399dddc3da..902d6a0f518a 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1222,6 +1222,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 ); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 835e540ec5fc..d6b21f2960d4 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -122,6 +122,8 @@ public: ESelection GetSelection() const; void SetSelection( const ESelection& rNewSel ); bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + /// Returns the rectangles of the current selection in TWIPs. + void GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) const; bool IsInsertMode() const; void SetInsertMode( bool bInsert ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index b996ef2cd08e..d797f9d462c3 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -314,6 +314,7 @@ public: void SetVisArea( const Rectangle& rRect ); void SetSelection( const ESelection& ); + void GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) const; void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0, bool bKeepLanguages = false ); void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ); |