Kaydet (Commit) 1f6cce7e authored tarafından Noel Grandin's avatar Noel Grandin

Revert "remove unused code in basegfx"

Some of this code is used by Windows.

This reverts commit b96724560f119b1b9ab8b5e1ee1759fd9b2db203.
üst 8c443f5c
...@@ -3134,6 +3134,49 @@ namespace basegfx ...@@ -3134,6 +3134,49 @@ namespace basegfx
} }
// comparators with tolerance for 2D Polygons
bool equal(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, const double& rfSmallValue)
{
const sal_uInt32 nPointCount(rCandidateA.count());
if(nPointCount != rCandidateB.count())
return false;
const bool bClosed(rCandidateA.isClosed());
if(bClosed != rCandidateB.isClosed())
return false;
const bool bAreControlPointsUsed(rCandidateA.areControlPointsUsed());
if(bAreControlPointsUsed != rCandidateB.areControlPointsUsed())
return false;
for(sal_uInt32 a(0); a < nPointCount; a++)
{
const B2DPoint aPoint(rCandidateA.getB2DPoint(a));
if(!aPoint.equal(rCandidateB.getB2DPoint(a), rfSmallValue))
return false;
if(bAreControlPointsUsed)
{
const basegfx::B2DPoint aPrev(rCandidateA.getPrevControlPoint(a));
if(!aPrev.equal(rCandidateB.getPrevControlPoint(a), rfSmallValue))
return false;
const basegfx::B2DPoint aNext(rCandidateA.getNextControlPoint(a));
if(!aNext.equal(rCandidateB.getNextControlPoint(a), rfSmallValue))
return false;
}
}
return true;
}
// snap points of horizontal or vertical edges to discrete values // snap points of horizontal or vertical edges to discrete values
B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate) B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate)
{ {
......
...@@ -497,6 +497,24 @@ namespace basegfx ...@@ -497,6 +497,24 @@ namespace basegfx
return aRetval; return aRetval;
} }
bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate)
{
if(rCandidate.areControlPointsUsed())
{
return false;
}
for(sal_uInt32 a(0); a < rCandidate.count(); a++)
{
if(!containsOnlyHorizontalAndVerticalEdges(rCandidate.getB2DPolygon(a)))
{
return false;
}
}
return true;
}
B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char nNumber, bool bLitSegments) B2DPolyPolygon createSevenSegmentPolyPolygon(sal_Char nNumber, bool bLitSegments)
{ {
// config here // config here
......
...@@ -505,6 +505,13 @@ namespace basegfx ...@@ -505,6 +505,13 @@ namespace basegfx
return true; return true;
} }
bool equal(const B3DPolyPolygon& rCandidateA, const B3DPolyPolygon& rCandidateB)
{
const double fSmallValue(fTools::getSmallValue());
return equal(rCandidateA, rCandidateB, fSmallValue);
}
/// converters for com::sun::star::drawing::PolyPolygonShape3D /// converters for com::sun::star::drawing::PolyPolygonShape3D
B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon( B3DPolyPolygon UnoPolyPolygonShape3DToB3DPolyPolygon(
const com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource, const com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygonShape3DSource,
......
...@@ -287,6 +287,11 @@ namespace basegfx ...@@ -287,6 +287,11 @@ namespace basegfx
*/ */
BASEGFX_DLLPUBLIC B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate); BASEGFX_DLLPUBLIC B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate);
/** returns true if the Polygon only contains horizontal or vertical edges
so that it could be represented by RegionBands
*/
BASEGFX_DLLPUBLIC bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate);
/// converters for com::sun::star::drawing::PointSequence /// converters for com::sun::star::drawing::PointSequence
BASEGFX_DLLPUBLIC B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon( BASEGFX_DLLPUBLIC B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(
const com::sun::star::drawing::PointSequenceSequence& rPointSequenceSequenceSource, const com::sun::star::drawing::PointSequenceSequence& rPointSequenceSequenceSource,
......
...@@ -163,6 +163,9 @@ apitest::XText::testInsertRemoveTextContent() ...@@ -163,6 +163,9 @@ apitest::XText::testInsertRemoveTextContent()
apitest::XTextContent::testAttach() apitest::XTextContent::testAttach()
apitest::XTextContent::testGetAnchor() apitest::XTextContent::testGetAnchor()
apitest::XTextField::testGetPresentation() apitest::XTextField::testGetPresentation()
basegfx::tools::containsOnlyHorizontalAndVerticalEdges(basegfx::B2DPolyPolygon const&)
basegfx::tools::equal(basegfx::B2DPolygon const&, basegfx::B2DPolygon const&, double const&)
basegfx::tools::equal(basegfx::B3DPolyPolygon const&, basegfx::B3DPolyPolygon const&)
canvas::createSurfaceProxyManager(boost::shared_ptr<canvas::IRenderModule> const&) canvas::createSurfaceProxyManager(boost::shared_ptr<canvas::IRenderModule> const&)
comphelper::detail::ConfigurationWrapper::getGroupReadWrite(boost::shared_ptr<comphelper::ConfigurationChanges> const&, rtl::OUString const&) const comphelper::detail::ConfigurationWrapper::getGroupReadWrite(boost::shared_ptr<comphelper::ConfigurationChanges> const&, rtl::OUString const&) const
comphelper::detail::ConfigurationWrapper::getLocalizedPropertyValue(rtl::OUString const&) const comphelper::detail::ConfigurationWrapper::getLocalizedPropertyValue(rtl::OUString const&) const
......
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