summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohit Deshmukh <rohit.deshmukh@synerzip.com>2014-07-18 12:27:25 +0530
committerLuboš Luňák <l.lunak@collabora.com>2014-07-21 16:29:06 +0200
commitacd2c90978052723475a41144dd5d92090fbf6b4 (patch)
tree7fb411d4a0f8d3f230f7fff9b010971cca79d5f8
parentc73cb50cdd7dffe809d3e66e5acdfab2bd521f62 (diff)
fdo#80897: Preservation of text warp properties.
- Generic fix for all warp properties Change-Id: I77c37759aa49706fc3cd1a80770a85face53f0a2
-rw-r--r--include/oox/export/drawingml.hxx2
-rw-r--r--include/oox/export/shapes.hxx1
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx27
-rw-r--r--oox/source/export/drawingml.cxx7
-rw-r--r--oox/source/export/shapes.cxx10
-rw-r--r--oox/source/shape/WpsContext.cxx11
-rw-r--r--oox/source/token/properties.txt1
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/fdo80897.docxbin0 -> 16332 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx10
9 files changed, 60 insertions, 9 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index bf46326b3ca4..db685b140068 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -166,7 +166,7 @@ public:
void WriteTransformation( const Rectangle& rRectangle,
sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0 );
- void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface, bool bBodyPr = true, bool bText = true, sal_Int32 nXmlNamespace = 0);
+ void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface, OUString presetWarp, bool bBodyPr = true, bool bText = true, sal_Int32 nXmlNamespace = 0);
void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index c7f8d159eb04..925ba72d022f 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -73,6 +73,7 @@ private:
ShapeHashMap maShapeMap;
ShapeHashMap* mpShapeMap;
+ OUString m_presetWarp;
public:
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 5dcc12202bf1..efaddba265a5 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -151,15 +151,34 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
+ const OUString sCustomShapeGeometry("CustomShapeGeometry");
+ uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
+ uno::Sequence< beans::PropertyValue > aGeoPropSeq;
+
+ sal_Int32 i, nCount = 0;
+ if (aGeoPropSet >>= aGeoPropSeq)
+ {
+ nCount = aGeoPropSeq.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ const OUString sAdjustmentValues("AdjustmentValues");
+ if ( aGeoPropSeq[ i ].Name.equals( sAdjustmentValues ) )
+ {
+ OUString presetTextWarp;
+ if ( aGeoPropSeq[ i ].Value >>= presetTextWarp )
+ {
+ aPropertyMap.setProperty( PROP_PresetTextWarp, Any( presetTextWarp ) );
+ }
+ }
+ }
+ }
+
if ( maAdjustmentGuideList.size() )
{
const OUString sType = "Type";
- const OUString sCustomShapeGeometry("CustomShapeGeometry");
- uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
- uno::Sequence< beans::PropertyValue > aGeoPropSeq;
if ( aGeoPropSet >>= aGeoPropSeq )
{
- sal_Int32 i, nCount = aGeoPropSeq.getLength();
+ nCount = aGeoPropSeq.getLength();
for ( i = 0; i < nCount; i++ )
{
const OUString sAdjustmentValues("AdjustmentValues");
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 75b6cfe7dd23..a303365a7874 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1690,7 +1690,7 @@ void DrawingML::WriteParagraph( Reference< XTextContent > rParagraph )
mpFS->endElementNS( XML_a, XML_p );
}
-void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool bText, sal_Int32 nXmlNamespace )
+void DrawingML::WriteText( Reference< XInterface > rXIface, OUString presetWarp, bool bBodyPr, bool bText, sal_Int32 nXmlNamespace )
{
Reference< XText > xXText( rXIface, UNO_QUERY );
Reference< XPropertySet > rXPropSet( rXIface, UNO_QUERY );
@@ -1792,6 +1792,11 @@ void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool b
XML_anchorCtr, bHorizontalCenter ? "1" : NULL,
XML_vert, sWritingMode,
FSEND );
+ if( presetWarp != NULL && !presetWarp.isEmpty())
+ {
+ mpFS->singleElementNS(XML_a, XML_prstTxWarp, XML_prst,OUStringToOString(presetWarp, RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+ }
if (GetDocumentType() == DOCUMENT_DOCX)
{
sal_Bool bTextAutoGrowHeight = sal_False;
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 02b005baeed8..4389e3e9418f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -328,6 +328,10 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
bPredefinedHandlesUsed = false;
// TODO: update nAdjustmentsWhichNeedsToBeConverted here
}
+ else if ( rProp.Name == "PresetTextWarp" )
+ {
+ rProp.Value >>= m_presetWarp;
+ }
}
}
}
@@ -822,7 +826,7 @@ ShapeExport& ShapeExport::WriteTextBox( Reference< XInterface > xIface, sal_Int3
if (xPropertySetInfo->hasPropertyByName("TextBox") && xPropertySet->getPropertyValue("TextBox").get<bool>())
{
GetTextExport()->WriteTextBox(uno::Reference<drawing::XShape>(xIface, uno::UNO_QUERY_THROW));
- WriteText( xIface, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace );
+ WriteText( xIface, m_presetWarp, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace );
return *this;
}
}
@@ -833,10 +837,10 @@ ShapeExport& ShapeExport::WriteTextBox( Reference< XInterface > xIface, sal_Int3
FSHelperPtr pFS = GetFS();
pFS->startElementNS( nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx), FSEND );
- WriteText( xIface, /*bBodyPr=*/(GetDocumentType() != DOCUMENT_DOCX), /*bText=*/true );
+ WriteText( xIface, m_presetWarp, /*bBodyPr=*/(GetDocumentType() != DOCUMENT_DOCX), /*bText=*/true );
pFS->endElementNS( nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_txBody : XML_txbx) );
if (GetDocumentType() == DOCUMENT_DOCX)
- WriteText( xIface, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace );
+ WriteText( xIface, m_presetWarp, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace );
}
else if (GetDocumentType() == DOCUMENT_DOCX)
mpFS->singleElementNS(nXmlNamespace, XML_bodyPr, FSEND);
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index d79d1c208709..89ed32059b4a 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -127,6 +127,17 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
}
}
break;
+ case XML_prstTxWarp:
+ if( rAttribs.hasAttribute( XML_prst ) )
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
+ oox::OptValue<OUString> presetShapeName = rAttribs.getString( XML_prst );
+ OUString preset = presetShapeName.get();
+ comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
+ aCustomShapeGeometry["PresetTextWarp"] = uno::makeAny(preset);
+ xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
+ }
+ break;
case XML_txbx:
{
mpShape->getCustomShapeProperties()->setShapeTypeOverride(true);
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 44c759715975..4735ccfb6637 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -366,6 +366,7 @@ PositionX
PositionY
PositiveError
Prefix
+PresetTextWarp
PrintAnnotations
PrintBorder
PrintDownFirst
diff --git a/sw/qa/extras/ooxmlexport/data/fdo80897.docx b/sw/qa/extras/ooxmlexport/data/fdo80897.docx
new file mode 100755
index 000000000000..2f0957e692a1
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo80897.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 87fdbd635418..02a4d4e98341 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3397,6 +3397,16 @@ DECLARE_OOXMLEXPORT_TEST(testPlausableBorder, "plausable-border.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1);
}
+DECLARE_OOXMLEXPORT_TEST(testfdo80897 , "fdo80897.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport();
+ if (!pXmlDoc)
+ return;
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr/a:prstTxWarp", "prst", "textTriangle");
+}
+
+
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */