drawingML import: capitalization inside group shape
There are two types of capitalization in DOCX: -uppercase: <w:caps> -smallcaps: <w:smallCaps> Change-Id: I6a5d238bed68aa3fd3478a77cf1942f009480eb6
This commit is contained in:
@@ -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;
|
||||
|
BIN
sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx
Normal file
BIN
sw/qa/extras/ooxmlimport/data/dml-groupshape-capitalization.docx
Normal file
Binary file not shown.
@@ -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();
|
||||
|
Reference in New Issue
Block a user