summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2012-05-22 10:08:26 +0100
committerNoel Power <noel.power@novell.com>2012-05-22 10:20:44 +0100
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 2c6316caa522..55c3cd2cda4d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -137,6 +137,7 @@
137#include <sfx2/objsh.hxx> 137#include <sfx2/objsh.hxx>
138 138
139#include <vector> 139#include <vector>
140#include <vbahelper/vbaaccesshelper.hxx>
140 141
141//! not found in unonames.hxx 142//! not found in unonames.hxx
142#define SC_LAYERID "LayerID" 143#define SC_LAYERID "LayerID"
@@ -4269,6 +4270,20 @@ sal_uInt32 ScXMLExport::exportDoc( enum XMLTokenEnum eClass )
4269 { 4270 {
4270 if (GetDocument()) 4271 if (GetDocument())
4271 { 4272 {
4273 // if source doc was Excel then
4274 uno::Reference< frame::XModel > xModel = GetModel();
4275 if ( xModel.is() )
4276 {
4277 uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY );
4278 SfxObjectShell* pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel.is() ? xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()) : NULL );
4279 if ( pFoundShell && ooo::vba::isAlienExcelDoc( *pFoundShell ) )
4280 {
4281 xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScFromXLSRowStylesProperties, xScPropHdlFactory);
4282 xRowStylesExportPropertySetMapper = new ScXMLRowExportPropertyMapper(xRowStylesPropertySetMapper);
4283 GetAutoStylePool()->SetFamilyPropSetMapper( XML_STYLE_FAMILY_TABLE_ROW, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME)),
4284 xRowStylesExportPropertySetMapper );
4285 }
4286 }
4272 CollectUserDefinedNamespaces(GetDocument()->GetPool(), ATTR_USERDEF); 4287 CollectUserDefinedNamespaces(GetDocument()->GetPool(), ATTR_USERDEF);
4273 CollectUserDefinedNamespaces(GetDocument()->GetEditPool(), EE_PARA_XMLATTRIBS); 4288 CollectUserDefinedNamespaces(GetDocument()->GetEditPool(), EE_PARA_XMLATTRIBS);
4274 CollectUserDefinedNamespaces(GetDocument()->GetEditPool(), EE_CHAR_XMLATTRIBS); 4289 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[] =
153 MAP_END() 153 MAP_END()
154}; 154};
155 155
156const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[] =
157{
158 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
159 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
160 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL_FALSE, CTF_SC_ROWOPTIMALHEIGHT),
161 MAP_END()
162};
163
156const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] = 164const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] =
157{ 165{
158 // #i57869# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only. 166 // #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 @@
41extern const XMLPropertyMapEntry aXMLScCellStylesProperties[]; 41extern const XMLPropertyMapEntry aXMLScCellStylesProperties[];
42extern const XMLPropertyMapEntry aXMLScColumnStylesProperties[]; 42extern const XMLPropertyMapEntry aXMLScColumnStylesProperties[];
43extern const XMLPropertyMapEntry aXMLScRowStylesProperties[]; 43extern const XMLPropertyMapEntry aXMLScRowStylesProperties[];
44extern const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[];
44extern const XMLPropertyMapEntry aXMLScRowStylesImportProperties[]; 45extern const XMLPropertyMapEntry aXMLScRowStylesImportProperties[];
45extern const XMLPropertyMapEntry aXMLScTableStylesProperties[]; 46extern const XMLPropertyMapEntry aXMLScTableStylesProperties[];
46extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties[]; 47extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties[];
diff --git a/xmloff/inc/xmloff/xmlaustp.hxx b/xmloff/inc/xmloff/xmlaustp.hxx
index ba7783476d94..828ff54d7d3a 100644
--- a/xmloff/inc/xmloff/xmlaustp.hxx
+++ b/xmloff/inc/xmloff/xmlaustp.hxx
@@ -89,6 +89,8 @@ public:
89 void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName, 89 void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
90 const UniReference< SvXMLExportPropertyMapper >& rMapper, 90 const UniReference< SvXMLExportPropertyMapper >& rMapper,
91 const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True ); 91 const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
92 void SetFamilyPropSetMapper( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
93 const UniReference< SvXMLExportPropertyMapper >& rMapper );
92 94
93 /// Register a name that must not be used as a generated name. 95 /// Register a name that must not be used as a generated name.
94 void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName ); 96 void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName );
diff --git a/xmloff/inc/xmloff/xmltypes.hxx b/xmloff/inc/xmloff/xmltypes.hxx
index 9aee08b6fc59..dc790e4ca51a 100644
--- a/xmloff/inc/xmloff/xmltypes.hxx
+++ b/xmloff/inc/xmloff/xmltypes.hxx
@@ -280,6 +280,7 @@
280#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 111) 280#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 111)
281#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112) 281#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112)
282#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113) 282#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113)
283#define XML_TYPE_BOOL_FALSE (XML_TEXT_TYPES_START + 114)
283 284
284#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT) 285#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT)
285#define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master 286#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 884bf0f09075..3fda5126ee50 100644
--- a/xmloff/source/style/impastp4.cxx
+++ b/xmloff/source/style/impastp4.cxx
@@ -104,6 +104,22 @@ void SvXMLAutoStylePoolP_Impl::AddFamily(
104 delete pFamily; 104 delete pFamily;
105} 105}
106 106
107void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper(
108 sal_Int32 nFamily,
109 const OUString& rStrName,
110 const UniReference < SvXMLExportPropertyMapper > & rMapper )
111{
112
113 XMLFamilyData_Impl aTemporary( nFamily );
114 sal_uLong nPos;
115
116 if( maFamilyList.Seek_Entry( &aTemporary, &nPos ) )
117 {
118 XMLFamilyData_Impl* pFamily = maFamilyList.GetObject( nPos );
119 if ( pFamily )
120 pFamily-> mxMapper = rMapper;
121 }
122}
107/////////////////////////////////////////////////////////////////////////////// 123///////////////////////////////////////////////////////////////////////////////
108// 124//
109// Adds a name to list 125// Adds a name to list
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
index 9feedb51ae5d..75420461e1a6 100644
--- a/xmloff/source/style/impastpl.hxx
+++ b/xmloff/source/style/impastpl.hxx
@@ -185,6 +185,8 @@ public:
185 void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName, 185 void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
186 const UniReference < SvXMLExportPropertyMapper > & rMapper, 186 const UniReference < SvXMLExportPropertyMapper > & rMapper,
187 const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True ); 187 const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True );
188 void SetFamilyPropSetMapper( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
189 const UniReference < SvXMLExportPropertyMapper > & rMapper );
188 void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName ); 190 void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName );
189 void GetRegisteredNames( 191 void GetRegisteredNames(
190 com::sun::star::uno::Sequence<sal_Int32>& aFamilies, 192 com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
index a2d2ea18762c..ef8e99aa1d09 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -171,6 +171,9 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::CreatePropertyHandler( sal_
171 case XML_TYPE_BOOL : 171 case XML_TYPE_BOOL :
172 pPropHdl = new XMLBoolPropHdl; 172 pPropHdl = new XMLBoolPropHdl;
173 break; 173 break;
174 case XML_TYPE_BOOL_FALSE :
175 pPropHdl = new XMLBoolFalsePropHdl;
176 break;
174 case XML_TYPE_MEASURE : 177 case XML_TYPE_MEASURE :
175 pPropHdl = new XMLMeasurePropHdl( 4 ); 178 pPropHdl = new XMLMeasurePropHdl( 4 );
176 break; 179 break;
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
index d0eed7a50475..5e428abb01ba 100644
--- a/xmloff/source/style/xmlaustp.cxx
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -312,6 +312,14 @@ void SvXMLAutoStylePoolP::AddFamily(
312 pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily ); 312 pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily );
313} 313}
314 314
315void SvXMLAutoStylePoolP::SetFamilyPropSetMapper(
316 sal_Int32 nFamily,
317 const OUString& rStrName,
318 const UniReference < SvXMLExportPropertyMapper > & rMapper )
319{
320 pImpl->SetFamilyPropSetMapper( nFamily, rStrName, rMapper );
321}
322
315void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily, 323void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily,
316 const OUString& rName ) 324 const OUString& rName )
317{ 325{
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index b34b37a166fd..8535c0b818d0 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
235 235
236/////////////////////////////////////////////////////////////////////////////// 236///////////////////////////////////////////////////////////////////////////////
237// 237//
238// class XMLBoolFalsePropHdl
239//
240
241XMLBoolFalsePropHdl::~XMLBoolFalsePropHdl()
242{
243 // nothing to do
244}
245
246sal_Bool XMLBoolFalsePropHdl::importXML( const OUString&, Any&, const SvXMLUnitConverter& ) const
247{
248 return sal_False;
249}
250
251sal_Bool XMLBoolFalsePropHdl::exportXML( OUString& rStrExpValue, const Any& /*rValue*/, const SvXMLUnitConverter& rCnv) const
252{
253 return XMLBoolPropHdl::exportXML( rStrExpValue, makeAny( sal_False ), rCnv );
254}
255
256///////////////////////////////////////////////////////////////////////////////
257//
238// class XMLBoolPropHdl 258// class XMLBoolPropHdl
239// 259//
240 260
diff --git a/xmloff/source/style/xmlbahdl.hxx b/xmloff/source/style/xmlbahdl.hxx
index 83b7741b5758..529df72e2d22 100644
--- a/xmloff/source/style/xmlbahdl.hxx
+++ b/xmloff/source/style/xmlbahdl.hxx
@@ -143,6 +143,16 @@ public:
143 virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; 143 virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
144}; 144};
145 145
146class XMLBoolFalsePropHdl : public XMLBoolPropHdl
147{
148public:
149 virtual ~XMLBoolFalsePropHdl();
150
151 virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
152 virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
153
154};
155
146/** 156/**
147 PropertyHandler for the XML-data-type: XML_TYPE_COLOR 157 PropertyHandler for the XML-data-type: XML_TYPE_COLOR
148*/ 158*/