drawingML import: paragraph adjustment inside group shape
Change-Id: I875cb1f12c9f81d329d7fe9cd3aa32a4cd818573
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
@@ -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() );
|
||||
|
@@ -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;
|
||||
}
|
||||
|
BIN
sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx
Normal file
BIN
sw/qa/extras/ooxmlimport/data/dml-groupshape-paraadjust.docx
Normal file
Binary file not shown.
@@ -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();
|
||||
|
Reference in New Issue
Block a user