[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - oox/source sw/qa

2015-03-31 Thread Gary Houston
 oox/source/drawingml/shape.cxx |5 +++-
 oox/source/drawingml/textbodypropertiescontext.cxx |   11 +
 oox/source/drawingml/transform2dcontext.cxx|2 -
 sw/qa/extras/ooxmlimport/data/fdo87488.docx|binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |   25 +++--
 5 files changed, 35 insertions(+), 8 deletions(-)

New commits:
commit 89032c4b7344139b7e3608d09e8c63b3eafd534b
Author: Gary Houston ghous...@arglist.com
Date:   Sat Dec 20 15:41:15 2014 +1100

fdo#87488 Wrong text rotation inside a preset shape from docx

Preset shape text rotation values are read in a few places and stored in
moRotation. With these changes, moRotation is always read unchanged, but
multiplied by -1 when it's used.

Change-Id: I633d665c21daa69e15fa828a43300f10d2bf2054
Reviewed-on: https://gerrit.libreoffice.org/13561
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk
(cherry picked from commit 921cea89da8adbe714ea8f71169dd6afc42354c4)
Signed-off-by: Andras Timar andras.ti...@collabora.com
Reviewed-on: https://gerrit.libreoffice.org/15084

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index ef0feb7..7fea778 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -999,7 +999,10 @@ Reference XShape  Shape::createAndInsert(
 if( getTextBody() )
 {
 sal_Int32 nTextRotateAngle = static_cast sal_Int32 ( 
getTextBody()-getTextProperties().moRotation.get( 0 ) );
-mpCustomShapePropertiesPtr-setTextRotateAngle( 
nTextRotateAngle / 6 );
+/* OOX measures text rotation clockwise in 1/6th degrees,
+   relative to the containing shape. setTextRotateAngle wants
+   degrees anticlockwise. */
+mpCustomShapePropertiesPtr-setTextRotateAngle( -1 * 
nTextRotateAngle / 6 );
 }
 
 SAL_INFO(oox.cscode, ==cscode== shape name: '  msName  
');
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx 
b/oox/source/drawingml/textbodypropertiescontext.cxx
index 80d82a0..f0208b5 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -84,13 +84,16 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( 
ContextHandler2Helper rPa
 // ST_TextVerticalType
 if( rAttribs.hasAttribute( XML_vert ) ) {
 mrTextBodyProp.moVert = rAttribs.getToken( XML_vert );
-bool bRtl = rAttribs.getBool( XML_rtl, false );
 sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz );
-if( tVert == XML_vert || tVert == XML_eaVert || tVert == XML_vert270 
|| tVert == XML_mongolianVert )
-mrTextBodyProp.moRotation = -540*(tVert==XML_vert270?3:1);
-else
+if (tVert == XML_vert || tVert == XML_eaVert || tVert == 
XML_mongolianVert)
+mrTextBodyProp.moRotation = 540;
+else if (tVert == XML_vert270)
+mrTextBodyProp.moRotation = 540 * 3;
+else {
+bool bRtl = rAttribs.getBool( XML_rtl, false );
 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextWritingMode,
 ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB ));
+}
 }
 
 // ST_TextAnchoringType
diff --git a/oox/source/drawingml/transform2dcontext.cxx 
b/oox/source/drawingml/transform2dcontext.cxx
index d3f7f5e..97015f3 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -47,7 +47,7 @@ Transform2DContext::Transform2DContext( 
ContextHandler2Helper rParent, const At
 else
 {
 if( rAttribs.hasAttribute( XML_rot ) )
-mrShape.getTextBody()-getTextProperties().moRotation = 
-rAttribs.getInteger( XML_rot ).get();
+mrShape.getTextBody()-getTextProperties().moRotation = 
rAttribs.getInteger( XML_rot ).get();
 }
 }
 
diff --git a/sw/qa/extras/ooxmlimport/data/fdo87488.docx 
b/sw/qa/extras/ooxmlimport/data/fdo87488.docx
new file mode 100644
index 000..2bd51b6
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo87488.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 44876b9..c4bc13a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -73,13 +73,13 @@ public:
 
 virtual void preTest(const char* filename) SAL_OVERRIDE
 {
-if (OString(filename) == smartart.docx || OString(filename) == 
strict-smartart.docx)
+if (OString(filename) == smartart.docx || OString(filename) == 
strict-smartart.docx || OString(filename) == fdo87488.docx)
 SvtFilterOptions::Get().SetSmartArt2Shape(true);
 }
 
 virtual void postTest(const char* filename) SAL_OVERRIDE
 {
-if 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - oox/source sw/qa sw/source

2014-10-01 Thread Luboš Luňák
 oox/source/token/properties.txt   |1 
 oox/source/vml/vmlshape.cxx   |   27 ++
 sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   37 +++
 sw/source/filter/ww8/docxattributeoutput.cxx  |  168 +++---
 5 files changed, 151 insertions(+), 82 deletions(-)

New commits:
commit bccb5eff14b2aebd18fd933c2790d78a2fa940e9
Author: Luboš Luňák l.lu...@collabora.com
Date:   Sat Sep 27 16:59:48 2014 +0200

fix/improve handling of mso-position-(horizontal|vertical)(-relative)

This is a squash of commits f6fa787 to e5bbc721 .

Change-Id: Ieb76ccb2fe8a425af3204de144021b7a731d0778
Reviewed-on: https://gerrit.libreoffice.org/11701
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 988857b..f1b237b 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -339,6 +339,7 @@ OutputPosition
 OverlapSequence
 PageScale
 PageStyle
+PageToggle
 PageViewZoomValue
 PaintTransparent
 ParaAdjust
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d7783d8..3adf5c8 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -482,12 +482,38 @@ void lcl_SetAnchorType(PropertySet rPropSet, const 
ShapeTypeModel rTypeModel)
 {
 if ( rTypeModel.maPositionHorizontal == center )
 rPropSet.setAnyProperty(PROP_HoriOrient, 
makeAny(text::HoriOrientation::CENTER));
+else if ( rTypeModel.maPositionHorizontal == left )
+rPropSet.setAnyProperty(PROP_HoriOrient, 
makeAny(text::HoriOrientation::LEFT));
+else if ( rTypeModel.maPositionHorizontal == right )
+rPropSet.setAnyProperty(PROP_HoriOrient, 
makeAny(text::HoriOrientation::RIGHT));
+else if ( rTypeModel.maPositionHorizontal == inside )
+{
+rPropSet.setAnyProperty(PROP_HoriOrient, 
makeAny(text::HoriOrientation::LEFT));
+rPropSet.setAnyProperty(PROP_PageToggle, makeAny(sal_True));
+}
+else if ( rTypeModel.maPositionHorizontal == outside )
+{
+rPropSet.setAnyProperty(PROP_HoriOrient, 
makeAny(text::HoriOrientation::RIGHT));
+rPropSet.setAnyProperty(PROP_PageToggle, makeAny(sal_True));
+}
 
 if ( rTypeModel.maPositionHorizontalRelative == page )
 rPropSet.setAnyProperty(PROP_HoriOrientRelation, 
makeAny(text::RelOrientation::PAGE_FRAME));
+else if ( rTypeModel.maPositionVerticalRelative == margin )
+rPropSet.setProperty(PROP_VertOrientRelation, 
text::RelOrientation::PAGE_PRINT_AREA);
+else if ( rTypeModel.maPositionVerticalRelative == text )
+rPropSet.setProperty(PROP_VertOrientRelation, 
text::RelOrientation::FRAME);
 
 if ( rTypeModel.maPositionVertical == center )
 rPropSet.setAnyProperty(PROP_VertOrient, 
makeAny(text::VertOrientation::CENTER));
+else if ( rTypeModel.maPositionVertical == top )
+rPropSet.setAnyProperty(PROP_VertOrient, 
makeAny(text::VertOrientation::TOP));
+else if ( rTypeModel.maPositionVertical == bottom )
+rPropSet.setAnyProperty(PROP_VertOrient, 
makeAny(text::VertOrientation::BOTTOM));
+else if ( rTypeModel.maPositionVertical == inside )
+rPropSet.setAnyProperty(PROP_VertOrient, 
makeAny(text::VertOrientation::LINE_TOP));
+else if ( rTypeModel.maPositionVertical == outside )
+rPropSet.setAnyProperty(PROP_VertOrient, 
makeAny(text::VertOrientation::LINE_BOTTOM));
 
 if ( rTypeModel.maPosition == absolute )
 {
@@ -504,7 +530,6 @@ void lcl_SetAnchorType(PropertySet rPropSet, const 
ShapeTypeModel rTypeModel)
 }
 else
 {
-// Vertical placement relative to margin, because parent style 
must not modify vertical position
 rPropSet.setProperty(PROP_VertOrientRelation, 
text::RelOrientation::FRAME);
 }
 }
diff --git a/sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docx 
b/sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docx
new file mode 100644
index 000..2fb28ec
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/bnc884615-mso-position.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5590246..18c15fa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3658,6 +3658,43 @@ DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, 
footer-body-distance.docx)
 
 #endif
 
+DECLARE_OOXMLEXPORT_TEST(testMsoPosition, bnc884615-mso-position.docx)
+{
+if(xmlDocPtr doc = parseExport(word/footer1.xml))
+{
+// We write the frames out in different order than they were read, so 
check it's the correct
+// textbox first by checking width. These tests may need reordering if 
that gets fixed.
+

[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - oox/source sw/qa

2014-10-01 Thread Caolán McNamara
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   10 +-
 sw/qa/core/data/ooxml/pass/fdo79129.docx|binary
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 97291b92b70249c1bcdca33425585b201a1822db
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Sep 30 10:43:37 2014 +0100

Resolves: fdo#79129 Crash in oox::drawingml::LayoutNode::setupShape

Change-Id: I0bafd2c43d29806eea0ff0cb165e67aece53488f
Reviewed-on: https://gerrit.libreoffice.org/11726
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index ba1f857..fc07a90 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -400,7 +400,15 @@ bool LayoutNode::setupShape( const ShapePtr rShape, const 
Diagram rDgm, sal_uI
 const 
DiagramData::StringMap::value_type::second_type::const_iterator 
aVecEnd=aNodeName-second.end();
 while( aVecIter != aVecEnd )
 {
-DiagramData::PointNameMap::const_iterator 
aDataNode2=rDgm.getData()-getPointNameMap().find(aVecIter-first);
+DiagramData::PointNameMap rMap = 
rDgm.getData()-getPointNameMap();
+DiagramData::PointNameMap::const_iterator aDataNode2 = 
rMap.find(aVecIter-first);
+if (aDataNode2 == rMap.end())
+{
+//busted, skip it
+++aVecIter;
+continue;
+}
+
 if( aVecIter-second == 0 )
 {
 // grab shape attr from topmost element(s)
diff --git a/sw/qa/core/data/ooxml/pass/fdo79129.docx 
b/sw/qa/core/data/ooxml/pass/fdo79129.docx
new file mode 100644
index 000..46ff0f5
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/fdo79129.docx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits