filter/source/msfilter/escherex.cxx | 14 ++-- include/oox/drawingml/textparagraphproperties.hxx | 4 + oox/source/drawingml/textbodycontext.cxx | 1 oox/source/drawingml/textcharacterpropertiescontext.cxx | 17 ++++ oox/source/drawingml/textparagraphpropertiescontext.cxx | 21 ++++++ sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx |binary sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 35 ++++++++++ 8 files changed, 85 insertions(+), 7 deletions(-)
New commits: commit 07eb648d82a4a26b4b6c7fa78aa2d22ccbd0593d Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Tue Feb 4 18:10:03 2014 +0100 Remove some extra break Change-Id: I55405c748d67101ecef8ef8a52037a26bc52b9f6 diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 293aead..6a8ea7f 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1961,8 +1961,10 @@ PolyPolygon EscherPropertyContainer::GetPolyPolygon( const ::com::sun::star::uno switch( aSegments[ j ].Command ) { case drawing::EnhancedCustomShapeSegmentCommand::UNKNOWN: break; - case drawing::EnhancedCustomShapeSegmentCommand::MOVETO : nPointIndex++; break; - case drawing::EnhancedCustomShapeSegmentCommand::LINETO : nPointIndex++; break; + case drawing::EnhancedCustomShapeSegmentCommand::MOVETO : + case drawing::EnhancedCustomShapeSegmentCommand::LINETO : + nPointIndex++; + break; case drawing::EnhancedCustomShapeSegmentCommand::CURVETO : { aPolygon.SetFlags( nPointIndex, POLY_CONTROL); @@ -1994,10 +1996,10 @@ PolyPolygon EscherPropertyContainer::GetPolyPolygon( const ::com::sun::star::uno case drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO : nPointIndex += 2; break; - case drawing::EnhancedCustomShapeSegmentCommand::DARKEN : break; - case drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS : break; - case drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN : break; - case drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS : break; + case drawing::EnhancedCustomShapeSegmentCommand::DARKEN : + case drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS : + case drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN : + case drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS : break; } } commit a468e386695f470f65616adde4673aa43a562c51 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Wed Feb 5 10:06:40 2014 +0100 drawingML import: paragraph adjustment inside group shape Change-Id: I875cb1f12c9f81d329d7fe9cd3aa32a4cd818573 diff --git a/include/oox/drawingml/textparagraphproperties.hxx b/include/oox/drawingml/textparagraphproperties.hxx index 8014929..2ed69f9 100644 --- a/include/oox/drawingml/textparagraphproperties.hxx +++ b/include/oox/drawingml/textparagraphproperties.hxx @@ -94,6 +94,9 @@ public: boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; } boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; } + boost::optional< sal_Int16 >& getParaAdjust() { return moParaAdjust; } + void setParaAdjust( sal_Int16 nParaAdjust ) { moParaAdjust = nParaAdjust; } + void apply( const TextParagraphProperties& rSourceProps ); void pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase, const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, @@ -118,6 +121,7 @@ protected: TextSpacing maParaBottomMargin; boost::optional< sal_Int32 > moParaLeftMargin; boost::optional< sal_Int32 > moFirstLineIndentation; + boost::optional< sal_Int16 > moParaAdjust; sal_Int16 mnLevel; }; diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx index b9921e0..48cf3ec 100644 --- a/oox/source/drawingml/textbodycontext.cxx +++ b/oox/source/drawingml/textbodycontext.cxx @@ -83,6 +83,7 @@ ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken return new TextFieldContext( *this, rAttribs, *pField ); } case A_TOKEN( pPr ): + case OOX_TOKEN( doc, pPr ): return new TextParagraphPropertiesContext( *this, rAttribs, mrParagraph.getProperties() ); case A_TOKEN( endParaRPr ): return new TextCharacterPropertiesContext( *this, rAttribs, mrParagraph.getEndProperties() ); diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 4ec6b65..aca1d78 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include "oox/drawingml/colorchoicecontext.hxx" #include "oox/drawingml/textcharacterpropertiescontext.hxx" @@ -153,6 +154,9 @@ TextParagraphPropertiesContext::~TextParagraphPropertiesContext() sal_Int16 nLevel = mrTextParagraphProperties.getLevel(); rPropertyMap[ PROP_NumberingLevel ] <<= nLevel; rPropertyMap[ PROP_NumberingIsNumber ] <<= sal_True; + + if( mrTextParagraphProperties.getParaAdjust() ) + rPropertyMap[ PROP_ParaAdjust ] <<= mrTextParagraphProperties.getParaAdjust().get(); } // -------------------------------------------------------------------- @@ -238,6 +242,23 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl return new TextTabStopListContext( *this, maTabList ); case A_TOKEN( defRPr ): // CT_TextCharacterProperties return new TextCharacterPropertiesContext( *this, rAttribs, mrTextParagraphProperties.getTextCharacterProperties() ); + case OOX_TOKEN( doc, jc ): + { + OptValue< OUString > oParaAdjust = rAttribs.getString( OOX_TOKEN(doc, val) ); + if( oParaAdjust.has() && !oParaAdjust.get().isEmpty() ) + { + const OUString& sParaAdjust = oParaAdjust.get(); + if( sParaAdjust == "left" ) + mrTextParagraphProperties.setParaAdjust(ParagraphAdjust_LEFT); + else if ( sParaAdjust == "right" ) + mrTextParagraphProperties.setParaAdjust(ParagraphAdjust_RIGHT); + else if ( sParaAdjust == "center" ) + mrTextParagraphProperties.setParaAdjust(ParagraphAdjust_CENTER); + else if ( sParaAdjust == "both" ) + mrTextParagraphProperties.setParaAdjust(ParagraphAdjust_BLOCK); + } + } + break; } return this; } diff --git a/sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx b/sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx new file mode 100644 index 0000000..fc09895 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index d1035eb..3fbf9ee 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -48,6 +48,7 @@ #include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/text/XDocumentIndex.hpp> #include <com/sun/star/style/CaseMap.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <vcl/svapp.hxx> #include <unotools/fltrcfg.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -1788,6 +1789,25 @@ DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeCapitalization, "dml-groupshape-capita // 5th line has no capitalization CPPUNIT_ASSERT_EQUAL(style::CaseMap::NONE, getProperty<sal_Int16>(getRun(getParagraphOfText(5, xText), 1), "CharCaseMap")); } + +DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeParaAdjust, "dml-groupshape-paraadjust.docx") +{ + // Paragraph adjustment inside a group shape was not imported + uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText(); + // 2nd line is adjusted to the right + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), getProperty<sal_Int16>(getRun(getParagraphOfText(2, xText), 1), "ParaAdjust")); + // 3rd line has no adjustment + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getRun(getParagraphOfText(3, xText), 1), "ParaAdjust")); + // 4th line is adjusted to center + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), getProperty<sal_Int16>(getRun(getParagraphOfText(4, xText), 1), "ParaAdjust")); + // 5th line has no adjustment + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getRun(getParagraphOfText(5, xText), 1), "ParaAdjust")); + // 6th line is justified + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_BLOCK), getProperty<sal_Int16>(getRun(getParagraphOfText(6, xText), 1), "ParaAdjust")); + // 7th line has no adjustment + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getRun(getParagraphOfText(7, xText), 1), "ParaAdjust")); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); commit c53dd7ea947e0233d98edd3e5d2f07c65ea61f30 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Mon Feb 3 17:19:25 2014 +0100 drawingML import: capitalization inside group shape There are two types of capitalization in DOCX: -uppercase: <w:caps> -smallcaps: <w:smallCaps> Change-Id: I6a5d238bed68aa3fd3478a77cf1942f009480eb6 diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 36bb465..36bd255 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -63,7 +63,6 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext( mrTextCharacterProperties.moCaseMap = rAttribs.getToken( XML_cap ); /* TODO / unhandled so far: - XML_cap A_TOKEN( kern ) XML_altLang A_TOKEN( kumimoji ) @@ -155,6 +154,22 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl break; case OOX_TOKEN( doc, szCs ): break; + case OOX_TOKEN( doc, caps ): + { + if( rAttribs.getBool(OOX_TOKEN( doc, val ), true) ) + mrTextCharacterProperties.moCaseMap = XML_all; + else + mrTextCharacterProperties.moCaseMap = XML_none; + } + break; + case OOX_TOKEN( doc, smallCaps ): + { + if( rAttribs.getBool(OOX_TOKEN( doc, val ), true) ) + mrTextCharacterProperties.moCaseMap = XML_small; + else + mrTextCharacterProperties.moCaseMap = XML_none; + } + break; default: SAL_WARN("oox", "TextCharacterPropertiesContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken)); break; diff --git a/sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx b/sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx new file mode 100644 index 0000000..67fd21f Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index d432f80..d1035eb 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -47,6 +47,7 @@ #include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/text/XDocumentIndex.hpp> +#include <com/sun/star/style/CaseMap.hpp> #include <vcl/svapp.hxx> #include <unotools/fltrcfg.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -1773,6 +1774,20 @@ DECLARE_OOXMLIMPORT_TEST(testRelSizeRound, "rel-size-round.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(10), getProperty<sal_Int16>(getShape(1), "RelativeHeight")); } +DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeCapitalization, "dml-groupshape-capitalization.docx") +{ + // Capitalization inside a group shape was not imported + uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText(); + // 2nd line is written with uppercase letters + CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty<sal_Int16>(getRun(getParagraphOfText(2, xText), 1), "CharCaseMap")); + // 3rd line has no capitalization + CPPUNIT_ASSERT_EQUAL(style::CaseMap::NONE, getProperty<sal_Int16>(getRun(getParagraphOfText(3, xText), 1), "CharCaseMap")); + // 4th line has written with small capitals + CPPUNIT_ASSERT_EQUAL(style::CaseMap::SMALLCAPS, getProperty<sal_Int16>(getRun(getParagraphOfText(4, xText), 1), "CharCaseMap")); + // 5th line has no capitalization + CPPUNIT_ASSERT_EQUAL(style::CaseMap::NONE, getProperty<sal_Int16>(getRun(getParagraphOfText(5, xText), 1), "CharCaseMap")); +} #endif CPPUNIT_PLUGIN_IMPLEMENT();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits