diff options
author | Oliver Bolte <obo@openoffice.org> | 2006-01-19 11:50:03 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2006-01-19 11:50:03 +0000 |
commit | ca681c1b9671980134ac976ac4674886e0b950ad (patch) | |
tree | 99ca7d7e9517ed806a154ff92d14445b7b7e321c /sd/source/ui/accessibility | |
parent | 5f22829b8fcc129618c05caee91535b589183617 (diff) |
INTEGRATION: CWS impress78 (1.11.84); FILE MERGED
2005/12/15 16:42:37 af 1.11.84.1: #i57918# Added guard against missing shape tree info.
Diffstat (limited to 'sd/source/ui/accessibility')
-rw-r--r-- | sd/source/ui/accessibility/AccessiblePageShape.cxx | 109 |
1 files changed, 56 insertions, 53 deletions
diff --git a/sd/source/ui/accessibility/AccessiblePageShape.cxx b/sd/source/ui/accessibility/AccessiblePageShape.cxx index 4cd5e5369a75..f4a3460f09f9 100644 --- a/sd/source/ui/accessibility/AccessiblePageShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePageShape.cxx @@ -4,9 +4,9 @@ * * $RCSfile: AccessiblePageShape.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: rt $ $Date: 2005-09-09 03:26:55 $ + * last change: $Author: obo $ $Date: 2006-01-19 12:50:03 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -142,61 +142,64 @@ awt::Rectangle SAL_CALL AccessiblePageShape::getBounds (void) awt::Rectangle aBoundingBox; - uno::Reference<beans::XPropertySet> xSet (mxPage, uno::UNO_QUERY); - if (xSet.is()) + if (maShapeTreeInfo.GetViewForwarder() != NULL) { - uno::Any aValue; - awt::Point aPosition; - awt::Size aSize; - - aValue = xSet->getPropertyValue ( - OUString (RTL_CONSTASCII_USTRINGPARAM("BorderLeft"))); - aValue >>= aBoundingBox.X; - aValue = xSet->getPropertyValue ( - OUString (RTL_CONSTASCII_USTRINGPARAM("BorderTop"))); - aValue >>= aBoundingBox.Y; - - aValue = xSet->getPropertyValue ( - OUString (RTL_CONSTASCII_USTRINGPARAM("Width"))); - aValue >>= aBoundingBox.Width; - aValue = xSet->getPropertyValue ( - OUString (RTL_CONSTASCII_USTRINGPARAM("Height"))); - aValue >>= aBoundingBox.Height; - } + uno::Reference<beans::XPropertySet> xSet (mxPage, uno::UNO_QUERY); + if (xSet.is()) + { + uno::Any aValue; + awt::Point aPosition; + awt::Size aSize; + + aValue = xSet->getPropertyValue ( + OUString (RTL_CONSTASCII_USTRINGPARAM("BorderLeft"))); + aValue >>= aBoundingBox.X; + aValue = xSet->getPropertyValue ( + OUString (RTL_CONSTASCII_USTRINGPARAM("BorderTop"))); + aValue >>= aBoundingBox.Y; + + aValue = xSet->getPropertyValue ( + OUString (RTL_CONSTASCII_USTRINGPARAM("Width"))); + aValue >>= aBoundingBox.Width; + aValue = xSet->getPropertyValue ( + OUString (RTL_CONSTASCII_USTRINGPARAM("Height"))); + aValue >>= aBoundingBox.Height; + } - // Transform coordinates from internal to pixel. - ::Size aPixelSize = maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( - ::Size (aBoundingBox.Width, aBoundingBox.Height)); - ::Point aPixelPosition = maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( - ::Point (aBoundingBox.X, aBoundingBox.Y)); + // Transform coordinates from internal to pixel. + ::Size aPixelSize = maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( + ::Size (aBoundingBox.Width, aBoundingBox.Height)); + ::Point aPixelPosition = maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( + ::Point (aBoundingBox.X, aBoundingBox.Y)); - // Clip the shape's bounding box with the bounding box of its parent. - Reference<XAccessibleComponent> xParentComponent ( - getAccessibleParent(), uno::UNO_QUERY); - if (xParentComponent.is()) - { - // Make the coordinates relative to the parent. - awt::Point aParentLocation (xParentComponent->getLocationOnScreen()); - int x = aPixelPosition.getX() - aParentLocation.X; - int y = aPixelPosition.getY() - aParentLocation.Y; - - - // Clip with parent (with coordinates relative to itself). - ::Rectangle aBBox ( - x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight()); - awt::Size aParentSize (xParentComponent->getSize()); - ::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height); - aBBox = aBBox.GetIntersection (aParentBBox); - aBoundingBox = awt::Rectangle ( - aBBox.getX(), - aBBox.getY(), - aBBox.getWidth(), - aBBox.getHeight()); + // Clip the shape's bounding box with the bounding box of its parent. + Reference<XAccessibleComponent> xParentComponent ( + getAccessibleParent(), uno::UNO_QUERY); + if (xParentComponent.is()) + { + // Make the coordinates relative to the parent. + awt::Point aParentLocation (xParentComponent->getLocationOnScreen()); + int x = aPixelPosition.getX() - aParentLocation.X; + int y = aPixelPosition.getY() - aParentLocation.Y; + + + // Clip with parent (with coordinates relative to itself). + ::Rectangle aBBox ( + x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight()); + awt::Size aParentSize (xParentComponent->getSize()); + ::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height); + aBBox = aBBox.GetIntersection (aParentBBox); + aBoundingBox = awt::Rectangle ( + aBBox.getX(), + aBBox.getY(), + aBBox.getWidth(), + aBBox.getHeight()); + } + else + aBoundingBox = awt::Rectangle ( + aPixelPosition.getX(), aPixelPosition.getY(), + aPixelSize.getWidth(), aPixelSize.getHeight()); } - else - aBoundingBox = awt::Rectangle ( - aPixelPosition.getX(), aPixelPosition.getY(), - aPixelSize.getWidth(), aPixelSize.getHeight()); return aBoundingBox; } |