Kaydet (Commit) c10aaf94 authored tarafından Regina Henschel's avatar Regina Henschel Kaydeden (comit) Thorsten Behrens

tdf#105545 Allow closed paths having 2 points

Closed paths with 2 points can be created from scratch,
therefore allow them too, if a point is deleted.
Remove now unused member mbIsClosed

Change-Id: Iac2a08df52f734c99c6ac14d9f1a16d8b943d399
Reviewed-on: https://gerrit.libreoffice.org/33654Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 7a64ad57
...@@ -34,7 +34,7 @@ namespace sdr ...@@ -34,7 +34,7 @@ namespace sdr
class SVX_DLLPUBLIC PolyPolygonEditor class SVX_DLLPUBLIC PolyPolygonEditor
{ {
public: public:
PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed ); PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon);
const basegfx::B2DPolyPolygon& GetPolyPolygon() const { return maPolyPolygon; } const basegfx::B2DPolyPolygon& GetPolyPolygon() const { return maPolyPolygon; }
...@@ -58,7 +58,6 @@ public: ...@@ -58,7 +58,6 @@ public:
private: private:
basegfx::B2DPolyPolygon maPolyPolygon; basegfx::B2DPolyPolygon maPolyPolygon;
bool mbIsClosed;
}; };
} }
......
...@@ -1036,7 +1036,7 @@ void MotionPathTag::DeleteMarkedPoints() ...@@ -1036,7 +1036,7 @@ void MotionPathTag::DeleteMarkedPoints()
mrView.BrkAction(); mrView.BrkAction();
SdrUShortCont& rPts = mpMark->GetMarkedPoints(); SdrUShortCont& rPts = mpMark->GetMarkedPoints();
PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() ); PolyPolygonEditor aEditor( mpPathObj->GetPathPoly());
if (aEditor.DeletePoints(rPts)) if (aEditor.DeletePoints(rPts))
{ {
if( aEditor.GetPolyPolygon().count() ) if( aEditor.GetPolyPolygon().count() )
...@@ -1088,7 +1088,7 @@ void MotionPathTag::SetMarkedSegmentsKind(SdrPathSegmentKind eKind) ...@@ -1088,7 +1088,7 @@ void MotionPathTag::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
if(mpPathObj && isSelected() && (GetMarkedPointCount() != 0)) if(mpPathObj && isSelected() && (GetMarkedPointCount() != 0))
{ {
SdrUShortCont& rPts = mpMark->GetMarkedPoints(); SdrUShortCont& rPts = mpMark->GetMarkedPoints();
PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() ); PolyPolygonEditor aEditor( mpPathObj->GetPathPoly() );
if (aEditor.SetSegmentsKind(eKind, rPts)) if (aEditor.SetSegmentsKind(eKind, rPts))
{ {
mpPathObj->SetPathPoly(aEditor.GetPolyPolygon()); mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
...@@ -1138,7 +1138,7 @@ void MotionPathTag::SetMarkedPointsSmooth(SdrPathSmoothKind eKind) ...@@ -1138,7 +1138,7 @@ void MotionPathTag::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
if(mpPathObj && mpMark && isSelected() && (GetMarkedPointCount() != 0)) if(mpPathObj && mpMark && isSelected() && (GetMarkedPointCount() != 0))
{ {
SdrUShortCont& rPts = mpMark->GetMarkedPoints(); SdrUShortCont& rPts = mpMark->GetMarkedPoints();
PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() ); PolyPolygonEditor aEditor( mpPathObj->GetPathPoly());
if (aEditor.SetPointsSmooth(eFlags, rPts)) if (aEditor.SetPointsSmooth(eFlags, rPts))
{ {
mpPathObj->SetPathPoly(aEditor.GetPolyPolygon()); mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
......
...@@ -25,9 +25,8 @@ ...@@ -25,9 +25,8 @@
namespace sdr { namespace sdr {
PolyPolygonEditor::PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed ) PolyPolygonEditor::PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon)
: maPolyPolygon( rPolyPolygon ) : maPolyPolygon( rPolyPolygon )
, mbIsClosed( bClosed )
{ {
} }
...@@ -46,7 +45,8 @@ bool PolyPolygonEditor::DeletePoints( const std::set< sal_uInt16 >& rAbsPoints ) ...@@ -46,7 +45,8 @@ bool PolyPolygonEditor::DeletePoints( const std::set< sal_uInt16 >& rAbsPoints )
aCandidate.remove(nPnt); aCandidate.remove(nPnt);
if( ( mbIsClosed && aCandidate.count() < 3L) || (aCandidate.count() < 2L) )
if( aCandidate.count() < 2L )
{ {
maPolyPolygon.remove(nPoly); maPolyPolygon.remove(nPoly);
} }
......
...@@ -207,7 +207,7 @@ void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind) ...@@ -207,7 +207,7 @@ void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
continue; continue;
SdrUShortCont& rPts = pM->GetMarkedPoints(); SdrUShortCont& rPts = pM->GetMarkedPoints();
PolyPolygonEditor aEditor(pPath->GetPathPoly(), pPath->IsClosed()); PolyPolygonEditor aEditor(pPath->GetPathPoly());
if (aEditor.SetPointsSmooth(eFlags, rPts)) if (aEditor.SetPointsSmooth(eFlags, rPts))
{ {
if( bUndo ) if( bUndo )
...@@ -240,7 +240,7 @@ void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind) ...@@ -240,7 +240,7 @@ void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
if (!pPath) if (!pPath)
continue; continue;
SdrUShortCont& rPts = pM->GetMarkedPoints(); SdrUShortCont& rPts = pM->GetMarkedPoints();
PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() ); PolyPolygonEditor aEditor( pPath->GetPathPoly());
if (aEditor.SetSegmentsKind(eKind, rPts)) if (aEditor.SetSegmentsKind(eKind, rPts))
{ {
if( bUndo ) if( bUndo )
...@@ -307,7 +307,7 @@ void SdrPolyEditView::DeleteMarkedPoints() ...@@ -307,7 +307,7 @@ void SdrPolyEditView::DeleteMarkedPoints()
continue; continue;
SdrUShortCont& rPts = pM->GetMarkedPoints(); SdrUShortCont& rPts = pM->GetMarkedPoints();
PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() ); PolyPolygonEditor aEditor( pPath->GetPathPoly());
if (aEditor.DeletePoints(rPts)) if (aEditor.DeletePoints(rPts))
{ {
if( aEditor.GetPolyPolygon().count() ) if( aEditor.GetPolyPolygon().count() )
......
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