summaryrefslogtreecommitdiff
path: root/oox
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 /oox
parentc73cb50cdd7dffe809d3e66e5acdfab2bd521f62 (diff)
fdo#80897: Preservation of text warp properties.
- Generic fix for all warp properties Change-Id: I77c37759aa49706fc3cd1a80770a85face53f0a2
Diffstat (limited to 'oox')
-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
5 files changed, 48 insertions, 8 deletions
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