swpagerelsize: implement ODF import/export
Export rel-height-rel / rel-width-rel only in case rel-height / rel-width is non-zero, though. Change-Id: I36120cbd8679ac4fc072d1e7cf4dfc024836b5ac
This commit is contained in:
@@ -194,6 +194,8 @@
|
|||||||
#define CTF_CHARRIGHTBORDER (XML_TEXT_CTF_START + 165)
|
#define CTF_CHARRIGHTBORDER (XML_TEXT_CTF_START + 165)
|
||||||
#define CTF_CHARTOPBORDER (XML_TEXT_CTF_START + 166)
|
#define CTF_CHARTOPBORDER (XML_TEXT_CTF_START + 166)
|
||||||
#define CTF_CHARBOTTOMBORDER (XML_TEXT_CTF_START + 167)
|
#define CTF_CHARBOTTOMBORDER (XML_TEXT_CTF_START + 167)
|
||||||
|
#define CTF_RELWIDTHREL (XML_TEXT_CTF_START + 168)
|
||||||
|
#define CTF_RELHEIGHTREL (XML_TEXT_CTF_START + 169)
|
||||||
|
|
||||||
|
|
||||||
#define TEXT_PROP_MAP_TEXT 0
|
#define TEXT_PROP_MAP_TEXT 0
|
||||||
|
@@ -1495,7 +1495,9 @@ namespace xmloff { namespace token {
|
|||||||
XML_REJECTION,
|
XML_REJECTION,
|
||||||
XML_REL_COLUMN_WIDTH,
|
XML_REL_COLUMN_WIDTH,
|
||||||
XML_REL_HEIGHT,
|
XML_REL_HEIGHT,
|
||||||
|
XML_REL_HEIGHT_REL,
|
||||||
XML_REL_WIDTH,
|
XML_REL_WIDTH,
|
||||||
|
XML_REL_WIDTH_REL,
|
||||||
XML_RELATIVE,
|
XML_RELATIVE,
|
||||||
XML_RELATIVE_TAB_STOP_POSITION,
|
XML_RELATIVE_TAB_STOP_POSITION,
|
||||||
XML_RELN,
|
XML_RELN,
|
||||||
|
BIN
sw/qa/extras/odfexport/data/relh-page.odt
Normal file
BIN
sw/qa/extras/odfexport/data/relh-page.odt
Normal file
Binary file not shown.
BIN
sw/qa/extras/odfexport/data/relw-page.odt
Normal file
BIN
sw/qa/extras/odfexport/data/relw-page.odt
Normal file
Binary file not shown.
@@ -13,6 +13,7 @@
|
|||||||
#include <com/sun/star/awt/Gradient.hpp>
|
#include <com/sun/star/awt/Gradient.hpp>
|
||||||
#include <com/sun/star/drawing/FillStyle.hpp>
|
#include <com/sun/star/drawing/FillStyle.hpp>
|
||||||
#include <com/sun/star/table/ShadowFormat.hpp>
|
#include <com/sun/star/table/ShadowFormat.hpp>
|
||||||
|
#include <com/sun/star/text/RelOrientation.hpp>
|
||||||
|
|
||||||
class Test : public SwModelTestBase
|
class Test : public SwModelTestBase
|
||||||
{
|
{
|
||||||
@@ -310,6 +311,24 @@ DECLARE_ODFEXPORT_TEST(testTextframeTransparentShadow, "textframe-transparent-sh
|
|||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<sal_Int32>(xPicture, "ShadowTransparence"));
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<sal_Int32>(xPicture, "ShadowTransparence"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_ODFEXPORT_TEST(testRelhPage, "relh-page.odt")
|
||||||
|
{
|
||||||
|
uno::Reference<drawing::XShape> xTextFrame = getShape(1);
|
||||||
|
// This was text::RelOrientation::FRAME (the default), RelativeHeightRelation was not handled in xmloff.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
|
||||||
|
// Make sure rel-height-rel doesn't affect width.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLARE_ODFEXPORT_TEST(testRelwPage, "relw-page.odt")
|
||||||
|
{
|
||||||
|
uno::Reference<drawing::XShape> xTextFrame = getShape(1);
|
||||||
|
// This was text::RelOrientation::FRAME (the default), RelativeWidthRelation was not handled in xmloff.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
|
||||||
|
// Make sure rel-width-rel doesn't affect height.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
@@ -1500,7 +1500,9 @@ namespace xmloff { namespace token {
|
|||||||
TOKEN( "rejection", XML_REJECTION ),
|
TOKEN( "rejection", XML_REJECTION ),
|
||||||
TOKEN( "rel-column-width", XML_REL_COLUMN_WIDTH ),
|
TOKEN( "rel-column-width", XML_REL_COLUMN_WIDTH ),
|
||||||
TOKEN( "rel-height", XML_REL_HEIGHT ),
|
TOKEN( "rel-height", XML_REL_HEIGHT ),
|
||||||
|
TOKEN( "rel-height-rel", XML_REL_HEIGHT_REL ),
|
||||||
TOKEN( "rel-width", XML_REL_WIDTH ),
|
TOKEN( "rel-width", XML_REL_WIDTH ),
|
||||||
|
TOKEN( "rel-width-rel", XML_REL_WIDTH_REL ),
|
||||||
TOKEN( "relative", XML_RELATIVE ),
|
TOKEN( "relative", XML_RELATIVE ),
|
||||||
TOKEN( "relative-tab-stop-position", XML_RELATIVE_TAB_STOP_POSITION ),
|
TOKEN( "relative-tab-stop-position", XML_RELATIVE_TAB_STOP_POSITION ),
|
||||||
TOKEN( "reln", XML_RELN ),
|
TOKEN( "reln", XML_RELN ),
|
||||||
|
@@ -626,6 +626,8 @@ void XMLTextExportPropertySetMapper::ContextFilter(
|
|||||||
XMLPropertyState* pVertOrientRelPageState = NULL;
|
XMLPropertyState* pVertOrientRelPageState = NULL;
|
||||||
XMLPropertyState* pVertOrientRelFrameState = NULL;
|
XMLPropertyState* pVertOrientRelFrameState = NULL;
|
||||||
XMLPropertyState* pVertOrientRelAsCharState = NULL;
|
XMLPropertyState* pVertOrientRelAsCharState = NULL;
|
||||||
|
XMLPropertyState* pRelWidthRel = NULL;
|
||||||
|
XMLPropertyState* pRelHeightRel = NULL;
|
||||||
|
|
||||||
// Vertical position and relation for shapes (#i28749#)
|
// Vertical position and relation for shapes (#i28749#)
|
||||||
XMLPropertyState* pShapeVertOrientState = NULL;
|
XMLPropertyState* pShapeVertOrientState = NULL;
|
||||||
@@ -738,12 +740,14 @@ void XMLTextExportPropertySetMapper::ContextFilter(
|
|||||||
case CTF_HORIZONTALREL: pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_HORIZONTALREL: pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
case CTF_HORIZONTALREL_FRAME: pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_HORIZONTALREL_FRAME: pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
case CTF_HORIZONTALMIRROR: pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_HORIZONTALMIRROR: pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
|
case CTF_RELWIDTHREL: pRelWidthRel = propertie; break;
|
||||||
case CTF_VERTICALPOS: pVertOrientState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_VERTICALPOS: pVertOrientState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
case CTF_VERTICALPOS_ATCHAR: pVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_VERTICALPOS_ATCHAR: pVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
case CTF_VERTICALREL: pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_VERTICALREL: pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
|
case CTF_RELHEIGHTREL: pRelHeightRel = propertie; break;
|
||||||
|
|
||||||
// Handle new CTFs for shape positioning properties (#i28749#)
|
// Handle new CTFs for shape positioning properties (#i28749#)
|
||||||
case CTF_SHAPE_HORIZONTALPOS: pShapeHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
|
case CTF_SHAPE_HORIZONTALPOS: pShapeHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
|
||||||
@@ -975,6 +979,13 @@ void XMLTextExportPropertySetMapper::ContextFilter(
|
|||||||
pHoriOrientRelState->mnIndex = -1;
|
pHoriOrientRelState->mnIndex = -1;
|
||||||
if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
|
if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
|
||||||
pHoriOrientRelFrameState->mnIndex = -1;
|
pHoriOrientRelFrameState->mnIndex = -1;
|
||||||
|
if (pRelWidthRel)
|
||||||
|
{
|
||||||
|
sal_Int16 nRelWidth = 0;
|
||||||
|
rPropSet->getPropertyValue("RelativeWidth") >>= nRelWidth;
|
||||||
|
if (!nRelWidth)
|
||||||
|
pRelWidthRel->mnIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if( pVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
|
if( pVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
|
||||||
pVertOrientState->mnIndex = -1;
|
pVertOrientState->mnIndex = -1;
|
||||||
@@ -989,6 +1000,13 @@ void XMLTextExportPropertySetMapper::ContextFilter(
|
|||||||
pVertOrientRelFrameState->mnIndex = -1;
|
pVertOrientRelFrameState->mnIndex = -1;
|
||||||
if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
|
if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
|
||||||
pVertOrientRelAsCharState->mnIndex = -1;
|
pVertOrientRelAsCharState->mnIndex = -1;
|
||||||
|
if (pRelHeightRel)
|
||||||
|
{
|
||||||
|
sal_Int16 nRelHeight = 0;
|
||||||
|
rPropSet->getPropertyValue("RelativeHeight") >>= nRelHeight;
|
||||||
|
if (!nRelHeight)
|
||||||
|
pRelHeightRel->mnIndex = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// States for shape positioning properties (#i28749#)
|
// States for shape positioning properties (#i28749#)
|
||||||
|
@@ -784,6 +784,8 @@ XMLPropertyMapEntry aXMLFramePropMap[] =
|
|||||||
MG_E( "", DRAW, VISIBLE_AREA_HEIGHT, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_VIS_AREA_HEIGHT ),
|
MG_E( "", DRAW, VISIBLE_AREA_HEIGHT, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_VIS_AREA_HEIGHT ),
|
||||||
MG_E( "", DRAW, DRAW_ASPECT, XML_TYPE_TEXT_DRAW_ASPECT|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_DRAW_ASPECT ),
|
MG_E( "", DRAW, DRAW_ASPECT, XML_TYPE_TEXT_DRAW_ASPECT|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_OLE_DRAW_ASPECT ),
|
||||||
MG_E( "UserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
|
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),
|
||||||
|
|
||||||
M_END()
|
M_END()
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user