diff options
author | Noel Power <noel.power@novell.com> | 2012-06-04 14:49:31 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-06-04 18:04:58 +0100 |
commit | d59a707f6e9308c2b89ebf4e71693175c37b7ed6 (patch) | |
tree | b1efd89b16aa1e02a788e497fc43f0cc29c726a7 | |
parent | 293f6a7a24c30f4d4234d973dba1d90005165455 (diff) |
remove anchor to cell shape (re)position hack
this change manaully reverts c07e9299bb2c8d5477669568b12708bd2ff12684 & 4908c16a73b397f83c327789f113658c1ea4d904
Change-Id: Ia8656631f84709430c8e94e8d9dfa961e81d5746
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | sc/source/filter/inc/drawingbase.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/oox/drawingbase.cxx | 28 | ||||
-rw-r--r-- | sc/source/filter/oox/drawingfragment.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 60 |
5 files changed, 1 insertions, 95 deletions
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 73302037788c..f2442e678819 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -9,7 +9,6 @@ AdjustLuminance AdjustmentValues Address Align -Anchor AnchorPosition ApplyFormDesignMode AreaLinks diff --git a/sc/source/filter/inc/drawingbase.hxx b/sc/source/filter/inc/drawingbase.hxx index 339d1b52b3f4..9da098568b62 100644 --- a/sc/source/filter/inc/drawingbase.hxx +++ b/sc/source/filter/inc/drawingbase.hxx @@ -109,10 +109,6 @@ public: /** Calculates the resulting shape anchor in 1/100 mm. */ ::com::sun::star::awt::Rectangle calcAnchorRectHmm( const ::com::sun::star::awt::Size& rPageSizeHmm ) const; - /** Returns the 'from' cell if it exists */ - ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > getFromCell() const; - /** Applies Cell Anchor to an XShape if needed*/ - void applyToXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape ); private: /** Converts the passed anchor to an absolute position in EMUs. */ ::oox::drawingml::EmuPoint calcCellAnchorEmu( const CellAnchorModel& rModel ) const; diff --git a/sc/source/filter/oox/drawingbase.cxx b/sc/source/filter/oox/drawingbase.cxx index 1cf511ce4d76..98b61a260c32 100644 --- a/sc/source/filter/oox/drawingbase.cxx +++ b/sc/source/filter/oox/drawingbase.cxx @@ -266,34 +266,6 @@ 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::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() ); - CellAnchorModel offSets; - offSets.mnColOffset = maFrom.mnColOffset; - offSets.mnRowOffset = maFrom.mnRowOffset; - EmuPoint aPos = calcCellAnchorEmu( offSets ); - aShapeProp.setProperty( PROP_HoriOrientPosition, lclEmuToHmm( aPos.X ) ); - aShapeProp.setProperty( PROP_VertOrientPosition, lclEmuToHmm( aPos.Y ) ); - } -} - -// private -------------------------------------------------------------------- - EmuPoint ShapeAnchor::calcCellAnchorEmu( const CellAnchorModel& rModel ) const { // calculate position of top-left edge of the cell diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 9b7d07aa7fc5..73e6b47eb7c1 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -277,8 +277,7 @@ 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( diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a1e7a1e2fe97..a7589d807089 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -194,55 +194,6 @@ const SfxItemPropertyMapEntry* lcl_GetRowsPropertyMap() return aRowsPropertyMap_Impl; } -struct OrientationInfo -{ - OrientationInfo() : mnVert( 0 ), mnHori( 0 ) {} - uno::Reference< beans::XPropertySet > mxShape; - sal_Int32 mnVert; - sal_Int32 mnHori; -}; - -void lcl_captureShapeOrientationInfo( std::vector< OrientationInfo >& infos, ScModelObj& rModel ) -{ - rtl::OUString sHori( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_HORIPOS ) ); - rtl::OUString sVert( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_VERTPOS ) ); - - uno::Reference<container::XIndexAccess> xPages( rModel.getDrawPages(), uno::UNO_QUERY ); - if ( xPages.is() ) - { - for ( sal_Int32 nIndex = 0, nPages = xPages->getCount(); nIndex < nPages; ++nIndex ) - { - uno::Reference<container::XIndexAccess> xShapes( xPages->getByIndex( nIndex ), uno::UNO_QUERY ); - for ( sal_Int32 nShapeIndex = 0, nShapes = xShapes->getCount(); nShapeIndex < nShapes; ++nShapeIndex ) - { - uno::Reference< beans::XPropertySet > xShape( xShapes->getByIndex( nShapeIndex ), uno::UNO_QUERY ); - uno::Reference< table::XCell > xCell( xShape->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ANCHOR ) ) ), uno::UNO_QUERY ); - // only capture orientation if the shape is anchored to cell - if ( xShape.is() && xCell.is() ) - { - uno::Reference< beans::XPropertySetInfo > xPropInfo = xShape->getPropertySetInfo(); - if ( xPropInfo.is() && xPropInfo->hasPropertyByName( sHori ) && xPropInfo->hasPropertyByName( sVert ) ) - { - OrientationInfo aShape; - aShape.mxShape = xShape; - xShape->getPropertyValue( sHori ) >>= aShape.mnHori; - xShape->getPropertyValue( sVert ) >>= aShape.mnVert; - infos.push_back( aShape ); - } - } - } - } - } -} - -void lcl_applyShapeOrientationInfo( std::vector< OrientationInfo >& infos ) -{ - for ( std::vector< OrientationInfo >::iterator it = infos.begin(), it_end = infos.end(); it != it_end; ++it ) - { - it->mxShape->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_HORIPOS ) ), uno::makeAny( it->mnHori ) ); - it->mxShape->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_VERTPOS ) ), uno::makeAny( it->mnVert ) ); - } -} using sc::HMMToTwips; using sc::TwipsToHMM; @@ -1735,18 +1686,7 @@ void SAL_CALL ScModelObj::setPropertyValue( { pDoc->EnableAdjustHeight( bAdjustHeightEnabled ); if( bAdjustHeightEnabled ) - { - // during import ( e.g. oox ) shapes anchored by cell lose - // any additional Hori/Vert orientation ( which offsets the - // shape position relative to the cell ) when - // UpdateAllRowHeights is called. Save Hori/Vert values - // before calling UpdateAllRowHeights and re-apply them - // after - std::vector< OrientationInfo > savedOrientations; - lcl_captureShapeOrientationInfo( savedOrientations, *this ); pDocShell->UpdateAllRowHeights(); - lcl_applyShapeOrientationInfo( savedOrientations ); - } } } else if ( aString.EqualsAscii( SC_UNO_ISEXECUTELINKENABLED ) ) |