diff options
author | Noel Power <noel.power@novell.com> | 2012-05-22 10:08:26 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2012-05-22 10:20:44 +0100 |
commit | e623ee66dfde0d5a2705e222aaa7ce580e409506 (patch) | |
tree | 02647e6e70927e450ea5aef665ded863983df004 /sc/source/filter | |
parent | 1543df470360d2e64428536a26a5996becc412d2 (diff) |
make row heights ( incl default row height ) from excel are saved absolute
Currently default row heights imported from Excel are not adjusted Optimally ( AdjustRowHeight() is no longer called ) However to ensure correct round tripping the CR_MANUALSIZE flag *is* still set, this results in the style:use-optimal-row-height="true" being set for default row height(s) when saving as odf. So, for example absolute positions which are calculated on importing the Excel document ( where the row height is *not* optimally adjusted ) are still saved with the 'style:use-optimal-row-height' set. When the row heights are read back into calc the row sizes are changed any absolutely positioned objects are now out of place. This patch ensures *all* row heights are from an imported excel document are saved with style:use-optimal-row-height="false"
Change-Id: If898b97ddb0c8b59a401d7b3c133b0eec09cd1db
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 15 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlstyle.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlstyle.hxx | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 2c6316caa522..55c3cd2cda4d 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -137,6 +137,7 @@ #include <sfx2/objsh.hxx> #include <vector> +#include <vbahelper/vbaaccesshelper.hxx> //! not found in unonames.hxx #define SC_LAYERID "LayerID" @@ -4269,6 +4270,20 @@ sal_uInt32 ScXMLExport::exportDoc( enum XMLTokenEnum eClass ) { if (GetDocument()) { + // if source doc was Excel then + uno::Reference< frame::XModel > xModel = GetModel(); + if ( xModel.is() ) + { + uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY ); + SfxObjectShell* pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel.is() ? xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()) : NULL ); + if ( pFoundShell && ooo::vba::isAlienExcelDoc( *pFoundShell ) ) + { + xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScFromXLSRowStylesProperties, xScPropHdlFactory); + xRowStylesExportPropertySetMapper = new ScXMLRowExportPropertyMapper(xRowStylesPropertySetMapper); + GetAutoStylePool()->SetFamilyPropSetMapper( XML_STYLE_FAMILY_TABLE_ROW, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME)), + xRowStylesExportPropertySetMapper ); + } + } CollectUserDefinedNamespaces(GetDocument()->GetPool(), ATTR_USERDEF); CollectUserDefinedNamespaces(GetDocument()->GetEditPool(), EE_PARA_XMLATTRIBS); CollectUserDefinedNamespaces(GetDocument()->GetEditPool(), EE_CHAR_XMLATTRIBS); diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index e29431136f4d..ad965b1c9257 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -153,6 +153,14 @@ const XMLPropertyMapEntry aXMLScRowStylesProperties[] = MAP_END() }; +const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[] = +{ + MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT), + MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE), + MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL_FALSE, CTF_SC_ROWOPTIMALHEIGHT), + MAP_END() +}; + const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] = { // #i57869# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only. diff --git a/sc/source/filter/xml/xmlstyle.hxx b/sc/source/filter/xml/xmlstyle.hxx index 07a4d307a2c3..5aebca131915 100644 --- a/sc/source/filter/xml/xmlstyle.hxx +++ b/sc/source/filter/xml/xmlstyle.hxx @@ -41,6 +41,7 @@ extern const XMLPropertyMapEntry aXMLScCellStylesProperties[]; extern const XMLPropertyMapEntry aXMLScColumnStylesProperties[]; extern const XMLPropertyMapEntry aXMLScRowStylesProperties[]; +extern const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[]; extern const XMLPropertyMapEntry aXMLScRowStylesImportProperties[]; extern const XMLPropertyMapEntry aXMLScTableStylesProperties[]; extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties[]; |