ODF export/import: text vertical adjustment attribute of text frames
ODF standard handle 'textarea-vertical-align' as a 'graphic-property' which "specifies formatting properties for chart, draw, graphic, and frame elements". So this change fit to the standard. Change-Id: I956f512953380983c2c882e943178335fd4dbfeb
This commit is contained in:
@@ -276,6 +276,7 @@
|
||||
|
||||
#define XML_TYPE_CHAR_SCRIPT (XML_TEXT_TYPES_START + 116)
|
||||
#define XML_TYPE_CHAR_RFC_LANGUAGE_TAG (XML_TEXT_TYPES_START + 117)
|
||||
#define XML_TYPE_VERTICAL_ALIGN (XML_TEXT_TYPES_START + 118)
|
||||
|
||||
#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT)
|
||||
#define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master
|
||||
|
BIN
sw/qa/extras/odfexport/data/textframe-vertadjust.odt
Normal file
BIN
sw/qa/extras/odfexport/data/textframe-vertadjust.odt
Normal file
Binary file not shown.
@@ -14,6 +14,7 @@
|
||||
#include <com/sun/star/drawing/FillStyle.hpp>
|
||||
#include <com/sun/star/table/ShadowFormat.hpp>
|
||||
#include <com/sun/star/text/RelOrientation.hpp>
|
||||
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
|
||||
|
||||
class Test : public SwModelTestBase
|
||||
{
|
||||
@@ -335,6 +336,20 @@ DECLARE_ODFEXPORT_TEST(testRelwPage, "relw-page.odt")
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(4896), parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "width").toInt32());
|
||||
}
|
||||
|
||||
DECLARE_ODFEXPORT_TEST(testTextFrameVertAdjust, "textframe-vertadjust.odt")
|
||||
{
|
||||
// Test import/export of new frame attribute called TextVerticalAdjust
|
||||
|
||||
// 1st frame's context is adjusted to the top
|
||||
uno::Reference<beans::XPropertySet> xFrame(getTextFrameByName("Rectangle 1"), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
|
||||
// 2nd frame's context is adjusted to the center
|
||||
xFrame.set(getTextFrameByName("Rectangle 2"), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
|
||||
// 3rd frame's context is adjusted to the bottom
|
||||
xFrame.set(getTextFrameByName("Rectangle 3"), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
|
||||
}
|
||||
#endif
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include "txtprhdl.hxx"
|
||||
// OD 2004-05-05 #i28701#
|
||||
#include <com/sun/star/text/WrapInfluenceOnPosition.hpp>
|
||||
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
@@ -211,7 +212,7 @@ static SvXMLEnumMapEntry const pXML_FontRelief_Enum[] =
|
||||
{ XML_TOKEN_INVALID, 0 }
|
||||
};
|
||||
|
||||
static SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] =
|
||||
static SvXMLEnumMapEntry const pXML_ParaVerticalAlign_Enum[] =
|
||||
{
|
||||
{ XML_TOP, ParagraphVertAlign::TOP },
|
||||
{ XML_MIDDLE, ParagraphVertAlign::CENTER },
|
||||
@@ -231,6 +232,15 @@ static SvXMLEnumMapEntry const pXML_WrapInfluenceOnPosition_Enum[] =
|
||||
{ XML_TOKEN_INVALID, 0 }
|
||||
};
|
||||
|
||||
static SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] =
|
||||
{
|
||||
{ XML_TOP, drawing::TextVerticalAdjust_TOP },
|
||||
{ XML_MIDDLE, drawing::TextVerticalAdjust_CENTER },
|
||||
{ XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM },
|
||||
{ XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK },
|
||||
{ XML_TOKEN_INVALID, 0 }
|
||||
};
|
||||
|
||||
static SvXMLEnumMapEntry const pXML_FillStyle_Enum[] =
|
||||
{
|
||||
{ XML_NONE, drawing::FillStyle_NONE },
|
||||
@@ -1347,7 +1357,7 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
|
||||
GetXMLToken( XML_LINE_HEIGHT ) );
|
||||
break;
|
||||
case XML_TYPE_TEXT_VERTICAL_ALIGN:
|
||||
pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, XML_TOKEN_INVALID );
|
||||
pHdl = new XMLConstantsPropertyHandler( pXML_ParaVerticalAlign_Enum, XML_TOKEN_INVALID );
|
||||
break;
|
||||
case XML_TYPE_TEXT_RUBY_POSITION:
|
||||
pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_ABOVE,
|
||||
@@ -1383,6 +1393,9 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
|
||||
case XML_TYPE_FILLSTYLE:
|
||||
pHdl = new XMLConstantsPropertyHandler( pXML_FillStyle_Enum, XML_TOKEN_INVALID );
|
||||
break;
|
||||
case XML_TYPE_VERTICAL_ALIGN:
|
||||
pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, XML_TOKEN_INVALID );
|
||||
break;
|
||||
}
|
||||
|
||||
return pHdl;
|
||||
|
@@ -786,6 +786,7 @@ XMLPropertyMapEntry aXMLFramePropMap[] =
|
||||
MG_E( "UserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
|
||||
MAP_EXT("RelativeWidthRelation", XML_NAMESPACE_LO_EXT, XML_REL_WIDTH_REL, XML_TYPE_TEXT_HORIZONTAL_REL|XML_TYPE_PROP_GRAPHIC, CTF_RELWIDTHREL),
|
||||
MAP_EXT("RelativeHeightRelation", XML_NAMESPACE_LO_EXT, XML_REL_HEIGHT_REL, XML_TYPE_TEXT_VERTICAL_REL|XML_TYPE_PROP_GRAPHIC, CTF_RELHEIGHTREL),
|
||||
MG_E("TextVerticalAdjust", DRAW, TEXTAREA_VERTICAL_ALIGN, XML_TYPE_VERTICAL_ALIGN, 0),
|
||||
|
||||
M_END()
|
||||
};
|
||||
|
Reference in New Issue
Block a user