summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorSourav <sourav.mahajan@synerzip.com>2014-03-19 18:01:45 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-19 15:53:12 +0100
commit35e190ba5bac01b47fbed1ea568dfb3456029d82 (patch)
treecec48beda78307c69a44f68a332a088d928b38f5 /oox
parent0fb498ccfd40a13bf99c3f36dd0cebebdaf55809 (diff)
fdo76201:File Corruption - Issue related with prstGeom for Hexagon shape.
There are two issues that are handled in this fix. 1)File created in MSO2K10 on RT gets corrupted.The root cause is found in CustomShapeProperties::pushToPropSet 2)File created in MSO2K7 on RT gets corrupted.There is an issue in shape import <a:gd> values for any shape (ex. circular arrow, hexagon etc).LO cannot import right <a:gd> values for any shape which is created in MSO-2007.Due to missing values of <a:gd> tag, after roundtrip the file gets corrupted.To avoid corruption a check introduced:- if(aAdjustments.size() == nLength) after http://opengrok.libreoffice.org/xref/core/oox/source/export/drawingml.cxx#1784 that will verify the number of <a:gd> tags associated with the shape during import and the number of <a:gd> tags during export.If there is a mismatch <a:gd> willnot be written.Changes made in DrawingML::WritePresetShape. I have written 2 test cases for the same. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/8657 Change-Id: Ibb1e2dc1c098b7399c06d7b4f59fac4e80887062
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx3
-rw-r--r--oox/source/export/drawingml.cxx20
2 files changed, 14 insertions, 9 deletions
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 60ef079dd7b5..52fa038c5fb2 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -170,6 +170,7 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
if ( aGeoPropSeq[ i ].Value >>= aAdjustmentSeq )
{
+ int nIndex=0;
for (std::vector< CustomShapeGuide >::const_iterator aIter( maAdjustmentGuideList.begin() ), aEnd(maAdjustmentGuideList.end());
aIter != aEnd; ++aIter)
{
@@ -189,7 +190,7 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32();
aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
aAdjustmentVal.Name = (*aIter).maName;
- aAdjustmentSeq[ 0 ] = aAdjustmentVal;
+ aAdjustmentSeq[ nIndex++ ] = aAdjustmentVal;
}
}
aGeoPropSeq[ i ].Value <<= aAdjustmentSeq;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7d8ea84f3c3c..a71ed89b4641 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1782,19 +1782,23 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bo
EscherPropertyContainer::LookForPolarHandles( eShapeType, nAdjustmentsWhichNeedsToBeConverted );
sal_Int32 nValue, nLength = aAdjustmentSeq.getLength();
- for( sal_Int32 i=0; i < nLength; i++ )
- if( EscherPropertyContainer::GetAdjustmentValue( aAdjustmentSeq[ i ], i, nAdjustmentsWhichNeedsToBeConverted, nValue ) )
- {
- // If the document model doesn't have an adjustment name (e.g. shape was created from VML), then take it from the predefined list.
- OString aAdjName;
- if (aAdjustmentSeq[i].Name.isEmpty() && static_cast<sal_uInt32>(i) < aAdjustments.size())
- aAdjName = aAdjustments[i];
+ //aAdjustments will give info about the number of adj values for a particular geomtery.For example for hexagon aAdjustments.size() will be 2 and for circular arrow it will be 5 as per ooxDrawingMLGetAdjNames.
+ if(aAdjustments.size() == static_cast<sal_uInt32>(nLength))// In case there is a mismatch do not write the XML_gd tag.
+ {
+ for( sal_Int32 i=0; i < nLength; i++ )
+ if( EscherPropertyContainer::GetAdjustmentValue( aAdjustmentSeq[ i ], i, nAdjustmentsWhichNeedsToBeConverted, nValue ) )
+ {
+ // If the document model doesn't have an adjustment name (e.g. shape was created from VML), then take it from the predefined list.
+ OString aAdjName;
+ if (aAdjustmentSeq[i].Name.isEmpty() && static_cast<sal_uInt32>(i) < aAdjustments.size())
+ aAdjName = aAdjustments[i];
- mpFS->singleElementNS( XML_a, XML_gd,
+ mpFS->singleElementNS( XML_a, XML_gd,
XML_name, aAdjustmentSeq[ i ].Name.getLength() > 0 ? USS(aAdjustmentSeq[ i ].Name) : aAdjName.getStr(),
XML_fmla, OString("val " + OString::number( nValue )).getStr(),
FSEND );
}
+ }
}
mpFS->endElementNS( XML_a, XML_avLst );