diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-04-11 13:27:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-04-11 13:40:34 +0100 |
commit | 93efd7ebbad293d3729b8ea4b9726aff498f607f (patch) | |
tree | 08cbcf8a128cd6760f2abe54365117b16cb654d9 /svx/source/sdr/contact | |
parent | a2f91994dffb5945ff70de864591d594d2fe7f59 (diff) |
Resolves: tdf#98366 paste document has 10x10 sized SdPages...
so long lines in them are clipped out in the preview.
Change-Id: I355986ff4a9c9e53f8e8f5d41b63f74c633f41ee
Diffstat (limited to 'svx/source/sdr/contact')
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 358d5de18310..2b0e78ad391e 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -90,30 +90,32 @@ namespace sdr if(bIsLine) { + //tdf#63955 if we have an extremely long line then clip it to a + //very generous range of -1 page width/height vs +1 page + //width/height to avoid oom and massive churn generating a huge + //polygon chain to cover the length in applyLineDashing if this + //line is dashed const SdrPage* pPage = GetPathObj().GetPage(); - double fPageWidth = pPage ? pPage->GetWdt() : 0.0; - double fPageHeight = pPage ? pPage->GetHgt() : 0.0; - if (fPageWidth && fPageHeight) - { - //tdf#63955 if we have an extremely long line then clip it - //to a very generous range of -1 page width/height vs +1 - //page width/height to avoid oom and massive churn - //generating a huge polygon chain to cover the length in - //applyLineDashing if this line is dashed - //tdf#97276 don't clip if the underlying page dimension - //is unknown - basegfx::B2DRange aClipRange(-fPageWidth, -fPageHeight, - fPageWidth*2, fPageHeight*2); - aUnitPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(aUnitPolyPolygon, - aClipRange, true, true); - nPolyCount = ensureGeometry(aUnitPolyPolygon); - - // re-check that we have't been clipped out to oblivion - bIsLine = - !aUnitPolyPolygon.areControlPointsUsed() - && 1 == nPolyCount - && 2 == aUnitPolyPolygon.getB2DPolygon(0).count(); - } + sal_Int32 nPageWidth = pPage ? pPage->GetWdt() : 0; + sal_Int32 nPageHeight = pPage ? pPage->GetHgt() : 0; + + //But, see tdf#97276 and tdf#98366. Don't clip too much if the + //underlying page dimension is unknown or a paste document + //where the page sizes use the odd default of 10x10 + nPageWidth = std::max<sal_Int32>(21000, nPageWidth); + nPageHeight = std::max<sal_Int32>(29700, nPageHeight); + basegfx::B2DRange aClipRange(-nPageWidth, -nPageHeight, + nPageWidth*2, nPageHeight*2); + + aUnitPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(aUnitPolyPolygon, + aClipRange, true, true); + nPolyCount = ensureGeometry(aUnitPolyPolygon); + + // re-check that we have't been clipped out to oblivion + bIsLine = + !aUnitPolyPolygon.areControlPointsUsed() + && 1 == nPolyCount + && 2 == aUnitPolyPolygon.getB2DPolygon(0).count(); } if(bIsLine) |