From d70f6df911b5ec153733201cadcd077256c82980 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 12 Jun 2013 17:16:44 +0100 Subject: Fix Excel still complains about exported MorphData controls seems that writing property values that same as file defaults can cause problems ( this behaviour doesn't seem to be consistent but... ) Fix up some instances of properties that I've seen make Excel complain Change-Id: Iacf6789906f07dc35aa5dbe3e7b62f4d2090e20a --- oox/source/ole/axcontrol.cxx | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index b65d38f250af..47d21d59950e 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -1496,23 +1496,27 @@ bool AxMorphDataModelBase::importBinaryModel( BinaryInputStream& rInStrm ) void AxMorphDataModelBase::exportBinaryModel( BinaryOutputStream& rOutStrm ) { AxBinaryPropertyWriter aWriter( rOutStrm, true ); - aWriter.writeIntProperty< sal_uInt32 >( mnFlags ); + if ( mnFlags != AX_MORPHDATA_DEFFLAGS ) + aWriter.writeIntProperty< sal_uInt32 >( mnFlags ); + else + aWriter.skipProperty(); //mnFlags aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); aWriter.writeIntProperty< sal_uInt32 >( mnTextColor ); - if ( ( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX ) ) + + // only write if different from default + if ( ( ( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX ) ) && mnMaxLength != 0 ) aWriter.writeIntProperty< sal_Int32 >( mnMaxLength ); else aWriter.skipProperty(); //mnMaxLength - if ( ( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT ) ) - { + if ( ( ( mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT ) ) && mnBorderStyle != AX_BORDERSTYLE_NONE ) aWriter.writeIntProperty< sal_uInt8 >( mnBorderStyle ); - aWriter.writeIntProperty< sal_uInt8 >( mnScrollBars ); - } else - { aWriter.skipProperty(); //mnBorderStyle + + if ( ( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX || mnDisplayStyle == AX_DISPLAYSTYLE_TEXT ) && mnScrollBars != AX_SCROLLBAR_NONE ) + aWriter.writeIntProperty< sal_uInt8 >( mnScrollBars ); + else aWriter.skipProperty(); //mnScrollBars - } aWriter.writeIntProperty< sal_uInt8 >( mnDisplayStyle ); aWriter.skipProperty(); // mouse pointer aWriter.writePairProperty( maSize ); @@ -1531,7 +1535,7 @@ void AxMorphDataModelBase::exportBinaryModel( BinaryOutputStream& rOutStrm ) aWriter.skipProperty(); // mnShowDropButton ); aWriter.skipProperty(); aWriter.skipProperty(); // drop down style - if ( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX ) + if ( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX && mnMultiSelect != AX_SELCTION_SINGLE ) aWriter.writeIntProperty< sal_uInt8 >( mnMultiSelect ); // although CheckBox, ListBox, OptionButton, ToggleButton are also supported // they can only have the fileformat default @@ -1544,11 +1548,14 @@ void AxMorphDataModelBase::exportBinaryModel( BinaryOutputStream& rOutStrm ) else aWriter.skipProperty(); // mnCaption aWriter.skipProperty(); // mnPicturePos ); - if ( ( mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT ) ) - aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor ); + if ( ( mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX || mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX || mnDisplayStyle == AX_DISPLAYSTYLE_TEXT ) && mnBorderColor != AX_SYSCOLOR_WINDOWFRAME ) + aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor ); else aWriter.skipProperty(); // mnBorderColor - aWriter.writeIntProperty< sal_uInt32 >( mnSpecialEffect ); + if ( mnSpecialEffect != AX_SPECIALEFFECT_SUNKEN ) + aWriter.writeIntProperty< sal_uInt32 >( mnSpecialEffect ); + else + aWriter.skipProperty(); //mnSpecialEffect aWriter.skipProperty(); // mouse icon aWriter.skipProperty(); // maPictureData aWriter.skipProperty(); // accelerator @@ -1964,6 +1971,7 @@ void AxListBoxModel::exportCompObj( BinaryOutputStream& rOutStream ) AxComboBoxModel::AxComboBoxModel() { mnDisplayStyle = AX_DISPLAYSTYLE_COMBOBOX; + mnFlags = 0x2c80481b; } ApiControlType AxComboBoxModel::getControlType() const -- cgit