Kaydet (Commit) c53dd7ea authored tarafından Zolnai Tamás's avatar Zolnai Tamás

drawingML import: capitalization inside group shape

There are two types of capitalization in DOCX:
-uppercase: <w:caps>
-smallcaps: <w:smallCaps>

Change-Id: I6a5d238bed68aa3fd3478a77cf1942f009480eb6
üst 51a68b49
......@@ -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;
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment