summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2012-05-22 09:08:26 (GMT)
committerNoel Power <noel.power@novell.com>2012-05-22 09:20:44 (GMT)
commite623ee66dfde0d5a2705e222aaa7ce580e409506 (patch)
tree02647e6e70927e450ea5aef665ded863983df004
parent1543df470360d2e64428536a26a5996becc412d2 (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
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx15
-rw-r--r--sc/source/filter/xml/xmlstyle.cxx8
-rw-r--r--sc/source/filter/xml/xmlstyle.hxx1
-rw-r--r--xmloff/inc/xmloff/xmlaustp.hxx2
-rw-r--r--xmloff/inc/xmloff/xmltypes.hxx1
-rw-r--r--xmloff/source/style/impastp4.cxx16
-rw-r--r--xmloff/source/style/impastpl.hxx2
-rw-r--r--xmloff/source/style/prhdlfac.cxx3
-rw-r--r--xmloff/source/style/xmlaustp.cxx8
-rw-r--r--xmloff/source/style/xmlbahdl.cxx20
-rw-r--r--xmloff/source/style/xmlbahdl.hxx10
11 files changed, 86 insertions, 0 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 2c6316c..55c3cd2 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 e294311..ad965b1 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 07a4d30..5aebca1 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[];
diff --git a/xmloff/inc/xmloff/xmlaustp.hxx b/xmloff/inc/xmloff/xmlaustp.hxx
index ba77834..828ff54 100644
--- a/xmloff/inc/xmloff/xmlaustp.hxx
+++ b/xmloff/inc/xmloff/xmlaustp.hxx
@@ -89,6 +89,8 @@ public:
void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
const UniReference< SvXMLExportPropertyMapper >& rMapper,
const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
+ void SetFamilyPropSetMapper( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
+ const UniReference< SvXMLExportPropertyMapper >& rMapper );
/// Register a name that must not be used as a generated name.
void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName );
diff --git a/xmloff/inc/xmloff/xmltypes.hxx b/xmloff/inc/xmloff/xmltypes.hxx
index 9aee08b..dc790e4 100644
--- a/xmloff/inc/xmloff/xmltypes.hxx
+++ b/xmloff/inc/xmloff/xmltypes.hxx
@@ -280,6 +280,7 @@
#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 111)
#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112)
#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113)
+#define XML_TYPE_BOOL_FALSE (XML_TEXT_TYPES_START + 114)
#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT)
#define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
index 884bf0f..3fda512 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.cxx
@@ -104,6 +104,22 @@ void SvXMLAutoStylePoolP_Impl::AddFamily(
delete pFamily;
}
+void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > & rMapper )
+{
+
+ XMLFamilyData_Impl aTemporary( nFamily );
+ sal_uLong nPos;
+
+ if( maFamilyList.Seek_Entry( &aTemporary, &nPos ) )
+ {
+ XMLFamilyData_Impl* pFamily = maFamilyList.GetObject( nPos );
+ if ( pFamily )
+ pFamily-> mxMapper = rMapper;
+ }
+}
///////////////////////////////////////////////////////////////////////////////
//
// Adds a name to list
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index 9feedb5..7542046 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -185,6 +185,8 @@ public:
void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
const UniReference < SvXMLExportPropertyMapper > & rMapper,
const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
+ void SetFamilyPropSetMapper( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > & rMapper );
void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName );
void GetRegisteredNames(
com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
index a2d2ea1..ef8e99a 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -171,6 +171,9 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::CreatePropertyHandler( sal_
case XML_TYPE_BOOL :
pPropHdl = new XMLBoolPropHdl;
break;
+ case XML_TYPE_BOOL_FALSE :
+ pPropHdl = new XMLBoolFalsePropHdl;
+ break;
case XML_TYPE_MEASURE :
pPropHdl = new XMLMeasurePropHdl( 4 );
break;
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
index d0eed7a..5e428ab 100644
--- a/xmloff/source/style/xmlaustp.cxx
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -312,6 +312,14 @@ void SvXMLAutoStylePoolP::AddFamily(
pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily );
}
+void SvXMLAutoStylePoolP::SetFamilyPropSetMapper(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ const UniReference < SvXMLExportPropertyMapper > & rMapper )
+{
+ pImpl->SetFamilyPropSetMapper( nFamily, rStrName, rMapper );
+}
+
void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily,
const OUString& rName )
{
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index b34b37a..8535c0b 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -235,6 +235,26 @@ sal_Bool XMLMeasurePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue
///////////////////////////////////////////////////////////////////////////////
//
+// class XMLBoolFalsePropHdl
+//
+
+XMLBoolFalsePropHdl::~XMLBoolFalsePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLBoolFalsePropHdl::importXML( const OUString&, Any&, const SvXMLUnitConverter& ) const
+{
+ return sal_False;
+}
+
+sal_Bool XMLBoolFalsePropHdl::exportXML( OUString& rStrExpValue, const Any& /*rValue*/, const SvXMLUnitConverter& rCnv) const
+{
+ return XMLBoolPropHdl::exportXML( rStrExpValue, makeAny( sal_False ), rCnv );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
// class XMLBoolPropHdl
//
diff --git a/xmloff/source/style/xmlbahdl.hxx b/xmloff/source/style/xmlbahdl.hxx
index 83b7741..529df72 100644
--- a/xmloff/source/style/xmlbahdl.hxx
+++ b/xmloff/source/style/xmlbahdl.hxx
@@ -143,6 +143,16 @@ public:
virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
};
+class XMLBoolFalsePropHdl : public XMLBoolPropHdl
+{
+public:
+ virtual ~XMLBoolFalsePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+
+};
+
/**
PropertyHandler for the XML-data-type: XML_TYPE_COLOR
*/