summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-13 15:54:56 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-13 16:42:41 +0200
commitf7764214f2ab8aff030aaeb29efd693275822761 (patch)
tree31678334a77fb53e5d788d304eff9261f38786e4 /editeng
parent2e0b9891764bb4cae6ed9a1b111d9b6dafeee92d (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
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx5
-rw-r--r--editeng/source/editeng/impedit.cxx22
-rw-r--r--editeng/source/editeng/impedit.hxx1
-rw-r--r--editeng/source/outliner/outlvw.cxx5
4 files changed, 28 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 );