summaryrefslogtreecommitdiffstats
path: root/sc/source/filter/excel/xlescher.cxx
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2009-08-06 13:44:14 +0000
committerDaniel Rentz <dr@openoffice.org>2009-08-06 13:44:14 +0000
commit7126ee64eca228d79c5fde3a1c573d2aacb3e672 (patch)
treeff0136e69670932ac7410882a125ccc8e4837e08 /sc/source/filter/excel/xlescher.cxx
parent#i12587# warning (diff)
downloadcore-7126ee64eca228d79c5fde3a1c573d2aacb3e672.tar.gz
core-7126ee64eca228d79c5fde3a1c573d2aacb3e672.zip
#i12587# reorg of svx/EscherEx class (separate class EscherExGlobal for global stuff shared through multiple instances of EscherEx), export of shapes embedded in Calc charts to BIFF8; #i55183# write child anchor instead of client anchor for charts/OLE/controls embedded in shape groups
Diffstat (limited to 'sc/source/filter/excel/xlescher.cxx')
-rw-r--r--sc/source/filter/excel/xlescher.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xlescher.cxx b/sc/source/filter/excel/xlescher.cxx
index a90d379e14c1..491e34408d94 100644
--- a/sc/source/filter/excel/xlescher.cxx
+++ b/sc/source/filter/excel/xlescher.cxx
@@ -162,6 +162,11 @@ void lclMirrorRectangle( Rectangle& rRect )
rRect.Right() = -nLeft;
}
+sal_uInt16 lclGetEmbeddedScale( long nPageSize, sal_Int32 nPageScale, long nPos, double fPosScale )
+{
+ return static_cast< sal_uInt16 >( nPos * fPosScale / nPageSize * nPageScale + 0.5 );
+}
+
} // namespace
// ----------------------------------------------------------------------------
@@ -205,6 +210,32 @@ void XclObjAnchor::SetRect( ScDocument& rDoc, SCTAB nScTab, const Rectangle& rRe
lclGetRowFromY( rDoc, nScTab, maLast.mnRow, mnBY, maFirst.mnRow, nDummy, aRect.Bottom(), fScale );
}
+void XclObjAnchor::SetRect( const Size& rPageSize, sal_Int32 nScaleX, sal_Int32 nScaleY,
+ const Rectangle& rRect, MapUnit eMapUnit, bool bDffAnchor )
+{
+ double fScale = 1.0;
+ switch( eMapUnit )
+ {
+ case MAP_TWIP: fScale = HMM_PER_TWIPS; break; // Calc twips -> 1/100mm
+ case MAP_100TH_MM: fScale = 1.0; break; // Calc 1/100mm -> 1/100mm
+ default: DBG_ERRORFILE( "XclObjAnchor::SetRect - map unit not implemented" );
+ }
+
+ /* In objects with DFF client anchor, the position of the shape is stored
+ in the cell address components of the client anchor. In old BIFF3-BIFF5
+ objects, the position is stored in the offset components of the anchor. */
+ (bDffAnchor ? maFirst.mnCol : mnLX) = lclGetEmbeddedScale( rPageSize.Width(), nScaleX, rRect.Left(), fScale );
+ (bDffAnchor ? maFirst.mnRow : mnTY) = lclGetEmbeddedScale( rPageSize.Height(), nScaleY, rRect.Top(), fScale );
+ (bDffAnchor ? maLast.mnCol : mnRX) = lclGetEmbeddedScale( rPageSize.Width(), nScaleX, rRect.Right(), fScale );
+ (bDffAnchor ? maLast.mnRow : mnBY) = lclGetEmbeddedScale( rPageSize.Height(), nScaleY, rRect.Bottom(), fScale );
+
+ // for safety, clear the other members
+ if( bDffAnchor )
+ mnLX = mnTY = mnRX = mnBY = 0;
+ else
+ Set( 0, 0, 0, 0 );
+}
+
// ----------------------------------------------------------------------------
XclObjLineData::XclObjLineData() :