diff options
author | Sascha Ballach <sab@openoffice.org> | 2001-12-10 16:37:31 +0000 |
---|---|---|
committer | Sascha Ballach <sab@openoffice.org> | 2001-12-10 16:37:31 +0000 |
commit | eb380dda1e2c03fb6514f8f4c74d3f896ca62bd0 (patch) | |
tree | 7480e7764a5de530975766131453d9c7a86b73a7 /sc/source/filter/xml/XMLTableShapeResizer.cxx | |
parent | 5bc1e5df631bd8b1851802f82880ba64c2b086a7 (diff) |
#88491#; handle the referenced caption point
Diffstat (limited to 'sc/source/filter/xml/XMLTableShapeResizer.cxx')
-rw-r--r-- | sc/source/filter/xml/XMLTableShapeResizer.cxx | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx index 31e86f886373..0eaeff6e5484 100644 --- a/sc/source/filter/xml/XMLTableShapeResizer.cxx +++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLTableShapeResizer.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: sab $ $Date: 2001-11-23 12:03:05 $ + * last change: $Author: sab $ $Date: 2001-12-10 17:37:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -164,6 +164,7 @@ void ScMyShapeResizer::ResizeShapes() { rtl::OUString sRowHeight(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLHGT)); rtl::OUString sPersistName (RTL_CONSTASCII_USTRINGPARAM("PersistName")); + rtl::OUString sCaptionPoint( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" )); uno::Reference<table::XCellRange> xTableRow; uno::Reference<sheet::XSpreadsheet> xSheet; uno::Reference<table::XTableRows> xTableRows; @@ -245,16 +246,31 @@ void ScMyShapeResizer::ResizeShapes() "no end address of this shape"); Rectangle aRec = pDoc->GetMMRect(static_cast<USHORT>(aItr->aStartCell.Column), static_cast<USHORT>(aItr->aStartCell.Row), static_cast<USHORT>(aItr->aStartCell.Column), static_cast<USHORT>(aItr->aStartCell.Row), aItr->aStartCell.Sheet); - awt::Point aRefPoint; - aRefPoint.X = aRec.Left(); - aRefPoint.Y = aRec.Top(); - awt::Point aPoint = aItr->xShape->getPosition(); - aPoint.X += aRefPoint.X; - if (aPoint.X > aRec.Right()) - aPoint.X = aRec.Right() - 1; - aPoint.Y += aRefPoint.Y; - if (aPoint.Y > aRec.Bottom()) - aPoint.Y = aRec.Bottom() - 1; + awt::Point aPoint(aItr->xShape->getPosition()); + awt::Size aSize(aItr->xShape->getSize()); + Rectangle aRectangle(aPoint.X, aPoint.Y, aPoint.X + aSize.Width, aPoint.Y + aSize.Height); + + awt::Point aCaptionPoint; + uno::Reference< beans::XPropertySet > xShapeProps(aItr->xShape, uno::UNO_QUERY); + if (xShapeProps.is()) + xShapeProps->getPropertyValue( sCaptionPoint ) >>= aCaptionPoint; + Point aCorePoint(aPoint.X, aPoint.Y); + Point aCoreCaptionPoint(aCaptionPoint.X, aCaptionPoint.Y); + aCoreCaptionPoint += aCorePoint; + aRectangle.Union(Rectangle(aCoreCaptionPoint, aCoreCaptionPoint)); + + Point aBeforeRightBottomPoint(aRectangle.BottomRight()); + + aRectangle += aRec.TopLeft(); + if (aRectangle.Left() > aRec.Right()) + aRectangle -= (Point(aRectangle.Left() - aRec.Right() + 2, 0)); + if (aRectangle.Top() > aRec.Bottom()) + aRectangle -= (Point(0, aRectangle.Top() - aRec.Bottom() + 2)); + + Point aDifferencePoint(aRectangle.BottomRight() - aBeforeRightBottomPoint); + aPoint.X += aDifferencePoint.X(); + aPoint.Y += aDifferencePoint.Y(); + aItr->xShape->setPosition(aPoint); } } |