INTEGRATION: CWS presenterscreen (1.2.4); FILE MERGED

2008/04/22 08:26:07 af 1.2.4.2: RESYNC: (1.2-1.3); FILE MERGED
2008/04/16 15:34:13 af 1.2.4.1: #i18486# Added support for rounded rectangles, rounding.
This commit is contained in:
Vladimir Glazounov 2008-05-13 13:30:58 +00:00
parent cc0ff86d47
commit f6bf106219

View file

@ -8,7 +8,7 @@
* *
* $RCSfile: PresenterGeometryHelper.hxx,v $ * $RCSfile: PresenterGeometryHelper.hxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* This file is part of OpenOffice.org. * This file is part of OpenOffice.org.
* *
@ -48,6 +48,30 @@ namespace sdext { namespace presenter {
class PresenterGeometryHelper class PresenterGeometryHelper
{ {
public: public:
static sal_Int32 Round (const double nValue);
static sal_Int32 Floor (const double nValue);
static sal_Int32 Ceil (const double nValue);
/** Return the bounding box with integer coordinates of the given
rectangle. Note that due to different rounding of the left/top and
the right/bottom border the width of the resulting rectangle may
differ for different positions but constant width and height.
*/
static css::awt::Rectangle ConvertRectangle (
const css::geometry::RealRectangle2D& rBox);
/** Convert the given rectangle to integer coordinates so that width and
height remain constant when only the position changes.
*/
static css::awt::Rectangle ConvertRectangleWithConstantSize (
const css::geometry::RealRectangle2D& rBox);
static css::geometry::RealRectangle2D ConvertRectangle (
const css::awt::Rectangle& rBox);
static css::awt::Size ConvertSize (
const css::geometry::RealSize2D& rSize);
static css::awt::Rectangle TranslateRectangle ( static css::awt::Rectangle TranslateRectangle (
const css::awt::Rectangle& rBox, const css::awt::Rectangle& rBox,
const sal_Int32 nXOffset, const sal_Int32 nXOffset,
@ -57,6 +81,10 @@ public:
const css::awt::Rectangle& rBox1, const css::awt::Rectangle& rBox1,
const css::awt::Rectangle& rBox2); const css::awt::Rectangle& rBox2);
static css::geometry::RealRectangle2D Intersection (
const css::geometry::RealRectangle2D& rBox1,
const css::geometry::RealRectangle2D& rBox2);
static bool IsInside ( static bool IsInside (
const css::awt::Rectangle& rBox, const css::awt::Rectangle& rBox,
const css::awt::Point& rPoint); const css::awt::Point& rPoint);
@ -65,10 +93,20 @@ public:
const css::geometry::RealRectangle2D& rBox, const css::geometry::RealRectangle2D& rBox,
const css::geometry::RealPoint2D& rPoint); const css::geometry::RealPoint2D& rPoint);
/** Return whether rBox1 is completly inside rBox2.
*/
static bool IsInside (
const css::awt::Rectangle& rBox1,
const css::awt::Rectangle& rBox2);
static css::awt::Rectangle Union ( static css::awt::Rectangle Union (
const css::awt::Rectangle& rBox1, const css::awt::Rectangle& rBox1,
const css::awt::Rectangle& rBox2); const css::awt::Rectangle& rBox2);
static css::geometry::RealRectangle2D Union (
const css::geometry::RealRectangle2D& rBox1,
const css::geometry::RealRectangle2D& rBox2);
static bool AreRectanglesDisjoint ( static bool AreRectanglesDisjoint (
const css::awt::Rectangle& rBox1, const css::awt::Rectangle& rBox1,
const css::awt::Rectangle& rBox2); const css::awt::Rectangle& rBox2);
@ -84,6 +122,13 @@ public:
static css::uno::Reference<css::rendering::XPolyPolygon2D> CreatePolygon( static css::uno::Reference<css::rendering::XPolyPolygon2D> CreatePolygon(
const ::std::vector<css::awt::Rectangle>& rBoxes, const ::std::vector<css::awt::Rectangle>& rBoxes,
const css::uno::Reference<css::rendering::XGraphicDevice>& rxDevice); const css::uno::Reference<css::rendering::XGraphicDevice>& rxDevice);
/** Create a polygon for a rounded rectangle.
*/
static css::uno::Reference<css::rendering::XPolyPolygon2D> CreatePolygon(
const css::awt::Rectangle& rBox,
const double nRadius,
const css::uno::Reference<css::rendering::XGraphicDevice>& rxDevice);
}; };
} } } }