Kaydet (Commit) b20dd576 authored tarafından Miklos Vajna's avatar Miklos Vajna

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 f7764214)
üst a778dc1e
...@@ -264,6 +264,11 @@ SvtScriptType EditView::GetSelectedScriptType() const ...@@ -264,6 +264,11 @@ SvtScriptType EditView::GetSelectedScriptType() const
return pImpEditView->pEditEngine->GetScriptType( pImpEditView->GetEditSelection() ); 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 ) void EditView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice )
{ {
pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView, rRect, pTargetDevice ); pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView, rRect, pTargetDevice );
......
...@@ -185,12 +185,10 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou ...@@ -185,12 +185,10 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
// pRegion: When not NULL, then only calculate Region. // pRegion: When not NULL, then only calculate Region.
vcl::Region* pOldRegion = pRegion;
vcl::Region aRegion; vcl::Region aRegion;
if (isTiledRendering()) if (isTiledRendering() && !pRegion)
{
assert(!pRegion);
pRegion = &aRegion; pRegion = &aRegion;
}
tools::PolyPolygon* pPolyPoly = NULL; tools::PolyPolygon* pPolyPoly = NULL;
if ( pRegion ) if ( pRegion )
...@@ -327,7 +325,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou ...@@ -327,7 +325,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
{ {
*pRegion = vcl::Region( *pPolyPoly ); *pRegion = vcl::Region( *pPolyPoly );
if (isTiledRendering()) if (isTiledRendering() && !pOldRegion)
{ {
bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM; bool bMm100ToTwip = pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM;
OString sRectangle; OString sRectangle;
...@@ -379,6 +377,20 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou ...@@ -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 ) void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly )
{ {
if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() ) if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() )
......
...@@ -319,6 +319,7 @@ public: ...@@ -319,6 +319,7 @@ public:
void DrawSelection() { DrawSelection( aEditSelection ); } void DrawSelection() { DrawSelection( aEditSelection ); }
void DrawSelection( EditSelection, vcl::Region* pRegion = NULL, OutputDevice* pTargetDevice = NULL ); void DrawSelection( EditSelection, vcl::Region* pRegion = NULL, OutputDevice* pTargetDevice = NULL );
void GetSelectionRectangles(std::vector<Rectangle>& rLogicRects);
vcl::Window* GetWindow() const { return pOutWin; } vcl::Window* GetWindow() const { return pOutWin; }
......
...@@ -1213,6 +1213,11 @@ void OutlinerView::SetSelection( const ESelection& rSel ) ...@@ -1213,6 +1213,11 @@ void OutlinerView::SetSelection( const ESelection& rSel )
pEditView->SetSelection( rSel ); pEditView->SetSelection( rSel );
} }
void OutlinerView::GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) const
{
pEditView->GetSelectionRectangles(rLogicRects);
}
void OutlinerView::SetReadOnly( bool bReadOnly ) void OutlinerView::SetReadOnly( bool bReadOnly )
{ {
pEditView->SetReadOnly( bReadOnly ); pEditView->SetReadOnly( bReadOnly );
......
...@@ -114,6 +114,8 @@ public: ...@@ -114,6 +114,8 @@ public:
ESelection GetSelection() const; ESelection GetSelection() const;
void SetSelection( const ESelection& rNewSel ); void SetSelection( const ESelection& rNewSel );
bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); 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; bool IsInsertMode() const;
void SetInsertMode( bool bInsert ); void SetInsertMode( bool bInsert );
......
...@@ -310,6 +310,7 @@ public: ...@@ -310,6 +310,7 @@ public:
void SetVisArea( const Rectangle& rRect ); void SetVisArea( const Rectangle& rRect );
void SetSelection( const ESelection& ); void SetSelection( const ESelection& );
void GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) const;
void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0, bool bKeepLanguages = false ); void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0, bool bKeepLanguages = false );
void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ); void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment