diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index c67714310cba..ce96dc5ad008 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -278,6 +278,18 @@ public: typedef std::vector< PolyPolygon > PolyPolyVector; + +template +inline std::basic_ostream & operator <<( + std::basic_ostream & stream, const PolyPolygon& rPolyPoly) +{ + if (!rPolyPoly.Count()) + stream << "EMPTY"; + for (sal_uInt16 i = 0; i < rPolyPoly.Count(); ++i) + stream << "[" << i << "] " << rPolyPoly.GetObject(i); + return stream; +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/region.hxx b/include/vcl/region.hxx index d3eec642c8aa..3a3a64b78dcd 100644 --- a/include/vcl/region.hxx +++ b/include/vcl/region.hxx @@ -126,6 +126,35 @@ public: static Region GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly ); }; + +template< typename charT, typename traits > +inline std::basic_ostream & operator <<( + std::basic_ostream & stream, const Region& rRegion) +{ + if (rRegion.IsEmpty()) + return stream << "EMPTY"; + if (rRegion.getB2DPolyPolygon()) + return stream << "B2DPolyPolygon(" + << *rRegion.getB2DPolyPolygon() + << ")"; + if (rRegion.getPolyPolygon()) + return stream << "PolyPolygon(" + << *rRegion.getPolyPolygon() + << ")"; + if (rRegion.getRegionBand()) + { // inlined because RegionBand is private to vcl + stream << "RegionBand("; + RectangleVector rects; + rRegion.GetRegionRectangles(rects); + if (rects.empty()) + stream << "EMPTY"; + for (size_t i = 0; i < rects.size(); ++i) + stream << "[" << i << "] " << rects[i]; + stream << ")"; + } + return stream; +} + #endif // INCLUDED_VCL_REGION_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */