From f6bf1062196b7d6493bcc372f3eca1571c6aa94e Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 13 May 2008 13:30:58 +0000 Subject: [PATCH] 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. --- .../presenter/PresenterGeometryHelper.hxx | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/sdext/source/presenter/PresenterGeometryHelper.hxx b/sdext/source/presenter/PresenterGeometryHelper.hxx index 83257602fb62..bfe9fb357b05 100644 --- a/sdext/source/presenter/PresenterGeometryHelper.hxx +++ b/sdext/source/presenter/PresenterGeometryHelper.hxx @@ -8,7 +8,7 @@ * * $RCSfile: PresenterGeometryHelper.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -48,6 +48,30 @@ namespace sdext { namespace presenter { class PresenterGeometryHelper { 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 ( const css::awt::Rectangle& rBox, const sal_Int32 nXOffset, @@ -57,6 +81,10 @@ public: const css::awt::Rectangle& rBox1, const css::awt::Rectangle& rBox2); + static css::geometry::RealRectangle2D Intersection ( + const css::geometry::RealRectangle2D& rBox1, + const css::geometry::RealRectangle2D& rBox2); + static bool IsInside ( const css::awt::Rectangle& rBox, const css::awt::Point& rPoint); @@ -65,10 +93,20 @@ public: const css::geometry::RealRectangle2D& rBox, 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 ( const css::awt::Rectangle& rBox1, const css::awt::Rectangle& rBox2); + static css::geometry::RealRectangle2D Union ( + const css::geometry::RealRectangle2D& rBox1, + const css::geometry::RealRectangle2D& rBox2); + static bool AreRectanglesDisjoint ( const css::awt::Rectangle& rBox1, const css::awt::Rectangle& rBox2); @@ -84,6 +122,13 @@ public: static css::uno::Reference CreatePolygon( const ::std::vector& rBoxes, const css::uno::Reference& rxDevice); + + /** Create a polygon for a rounded rectangle. + */ + static css::uno::Reference CreatePolygon( + const css::awt::Rectangle& rBox, + const double nRadius, + const css::uno::Reference& rxDevice); }; } }