diff options
author | Noel Power <noel.power@novell.com> | 2012-01-26 11:00:15 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-02-03 12:43:42 +0000 |
commit | c07e9299bb2c8d5477669568b12708bd2ff12684 (patch) | |
tree | ad4de6430ced620df45523fdea71e1c818192e80 /oox/source | |
parent | 3364fcc5a550fae001b24f4303a978662bb7c70f (diff) |
improve xlsx shape/chart import, anchor to cell where needed fdo#45266
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | oox/source/xls/drawingbase.cxx | 30 | ||||
-rw-r--r-- | oox/source/xls/drawingfragment.cxx | 3 |
3 files changed, 33 insertions, 1 deletions
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 9127c389f5f2..94a1947842e8 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -9,6 +9,7 @@ AdjustLuminance AdjustmentValues Address Align +Anchor AnchorPosition ApplyFormDesignMode AreaLinks diff --git a/oox/source/xls/drawingbase.cxx b/oox/source/xls/drawingbase.cxx index 3369ba9f7e65..91ed337334b8 100644 --- a/oox/source/xls/drawingbase.cxx +++ b/oox/source/xls/drawingbase.cxx @@ -32,6 +32,7 @@ #include "oox/helper/attributelist.hxx" #include "oox/helper/binaryinputstream.hxx" #include "oox/xls/unitconverter.hxx" +#include "oox/helper/propertyset.hxx" namespace oox { namespace xls { @@ -281,6 +282,35 @@ Rectangle ShapeAnchor::calcAnchorRectHmm( const Size& rPageSizeHmm ) const return Rectangle( lclEmuToHmm( aAnchorRect.X ), lclEmuToHmm( aAnchorRect.Y ), lclEmuToHmm( aAnchorRect.Width ), lclEmuToHmm( aAnchorRect.Height ) ); } +::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > +ShapeAnchor::getToCell() const +{ + CellAddress aAddress; + aAddress.Sheet = getSheetIndex(); + aAddress.Row = maTo.mnRow; + aAddress.Column = maTo.mnCol; + return getCell( aAddress ); +} +::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > +ShapeAnchor::getFromCell() const +{ + CellAddress aAddress; + aAddress.Sheet = getSheetIndex(); + aAddress.Row = maFrom.mnRow; + aAddress.Column = maFrom.mnCol; + return getCell( aAddress ); +} + +void +ShapeAnchor::applyToXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape ) +{ + if ( ( meAnchorType == ANCHOR_TWOCELL || meAnchorType == ANCHOR_ONECELL ) && getFromCell().is() ) + { + PropertySet aShapeProp( rxShape ); + aShapeProp.setProperty( PROP_Anchor, getFromCell() ); + } +} + // private -------------------------------------------------------------------- EmuPoint ShapeAnchor::calcCellAnchorEmu( const CellAnchorModel& rModel ) const diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 75cf0c8d562e..1fa504c9c5f0 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -273,7 +273,8 @@ void DrawingFragment::onEndElement() basegfx::B2DHomMatrix aTransformation; mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, aTransformation, &aShapeRectEmu32 ); - + // apply Cell anchoring if necessary + mxAnchor->applyToXShape( mxShape->getXShape() ); /* Collect all shape positions in the WorksheetHelper base class. But first, scale EMUs to 1/100 mm. */ Rectangle aShapeRectHmm( |