diff options
-rw-r--r-- | oox/source/drawingml/textcharacterpropertiescontext.cxx | 17 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx | bin | 0 -> 17676 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 15 |
3 files changed, 31 insertions, 1 deletions
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 36bb46536f0b..36bd255455df 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 Binary files differnew file mode 100644 index 000000000000..67fd21f64d14 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index d432f80fa2b9..d1035eb1217a 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(); |