RTF filter: import posh/posv property of shapes
Change-Id: I55eccccf7f9ed06bba1ada18574890b5bee296f4
This commit is contained in:
parent
16613995dd
commit
9d640dc6ad
24
sw/qa/extras/rtfimport/data/posh-posv.rtf
Normal file
24
sw/qa/extras/rtfimport/data/posh-posv.rtf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{\rtf1
|
||||||
|
{\shp
|
||||||
|
{\*\shpinst\shpleft0\shptop0\shpright3727\shpbottom2212\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026
|
||||||
|
{\sp
|
||||||
|
{\sn shapeType}
|
||||||
|
{\sv 202}
|
||||||
|
}
|
||||||
|
{\shptxt test}
|
||||||
|
{\sp
|
||||||
|
{\sn fFitShapeToText}
|
||||||
|
{\sv 1}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn posh}
|
||||||
|
{\sv 2}
|
||||||
|
}
|
||||||
|
{\sp
|
||||||
|
{\sn posv}
|
||||||
|
{\sv 2}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\par
|
||||||
|
}
|
@ -32,6 +32,8 @@
|
|||||||
#include <com/sun/star/text/XTextTable.hpp>
|
#include <com/sun/star/text/XTextTable.hpp>
|
||||||
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
|
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
|
||||||
#include <com/sun/star/text/WrapTextMode.hpp>
|
#include <com/sun/star/text/WrapTextMode.hpp>
|
||||||
|
#include <com/sun/star/text/HoriOrientation.hpp>
|
||||||
|
#include <com/sun/star/text/VertOrientation.hpp>
|
||||||
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
|
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
|
||||||
|
|
||||||
#include <rtl/ustring.hxx>
|
#include <rtl/ustring.hxx>
|
||||||
@ -139,6 +141,7 @@ public:
|
|||||||
void testFdo64671();
|
void testFdo64671();
|
||||||
void testPageBackground();
|
void testPageBackground();
|
||||||
void testFdo62044();
|
void testFdo62044();
|
||||||
|
void testPoshPosv();
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(Test);
|
CPPUNIT_TEST_SUITE(Test);
|
||||||
#if !defined(MACOSX) && !defined(WNT)
|
#if !defined(MACOSX) && !defined(WNT)
|
||||||
@ -267,6 +270,7 @@ void Test::run()
|
|||||||
{"fdo64671.rtf", &Test::testFdo64671},
|
{"fdo64671.rtf", &Test::testFdo64671},
|
||||||
{"page-background.rtf", &Test::testPageBackground},
|
{"page-background.rtf", &Test::testPageBackground},
|
||||||
{"fdo62044.rtf", &Test::testFdo62044},
|
{"fdo62044.rtf", &Test::testFdo62044},
|
||||||
|
{"posh-posv.rtf", &Test::testPoshPosv},
|
||||||
};
|
};
|
||||||
header();
|
header();
|
||||||
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
|
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
|
||||||
@ -1271,6 +1275,14 @@ void Test::testFdo62044()
|
|||||||
CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value.
|
CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Test::testPoshPosv()
|
||||||
|
{
|
||||||
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
||||||
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
||||||
|
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "HoriOrient"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrient"));
|
||||||
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
@ -4750,7 +4750,9 @@ RTFShape::RTFShape()
|
|||||||
nTop(0),
|
nTop(0),
|
||||||
nRight(0),
|
nRight(0),
|
||||||
nBottom(0),
|
nBottom(0),
|
||||||
|
nHoriOrient(0),
|
||||||
nHoriOrientRelation(0),
|
nHoriOrientRelation(0),
|
||||||
|
nVertOrient(0),
|
||||||
nVertOrientRelation(0),
|
nVertOrientRelation(0),
|
||||||
nWrap(-1)
|
nWrap(-1)
|
||||||
{
|
{
|
||||||
|
@ -244,7 +244,9 @@ namespace writerfilter {
|
|||||||
sal_Int32 nRight;
|
sal_Int32 nRight;
|
||||||
sal_Int32 nBottom;
|
sal_Int32 nBottom;
|
||||||
boost::optional<sal_Int32> oZ; ///< Z-Order of the shape.
|
boost::optional<sal_Int32> oZ; ///< Z-Order of the shape.
|
||||||
|
sal_Int16 nHoriOrient;
|
||||||
sal_Int16 nHoriOrientRelation;
|
sal_Int16 nHoriOrientRelation;
|
||||||
|
sal_Int16 nVertOrient;
|
||||||
sal_Int16 nVertOrientRelation;
|
sal_Int16 nVertOrientRelation;
|
||||||
int nWrap;
|
int nWrap;
|
||||||
};
|
};
|
||||||
|
@ -393,6 +393,46 @@ void RTFSdrImport::resolve(RTFShape& rShape)
|
|||||||
else if (i->first == "shadowOffsetX")
|
else if (i->first == "shadowOffsetX")
|
||||||
// EMUs to points
|
// EMUs to points
|
||||||
aShadowModel.moOffset.set(OUString::number(i->second.toDouble() / 12700) + "pt");
|
aShadowModel.moOffset.set(OUString::number(i->second.toDouble() / 12700) + "pt");
|
||||||
|
else if (i->first == "posh")
|
||||||
|
{
|
||||||
|
switch(i->second.toInt32())
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
rShape.nHoriOrient = text::HoriOrientation::LEFT;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
rShape.nHoriOrient = text::HoriOrientation::CENTER;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
rShape.nHoriOrient = text::HoriOrientation::RIGHT;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
rShape.nHoriOrient = text::HoriOrientation::INSIDE;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
rShape.nHoriOrient = text::HoriOrientation::OUTSIDE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (i->first == "posv")
|
||||||
|
{
|
||||||
|
switch(i->second.toInt32())
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
rShape.nVertOrient = text::VertOrientation::TOP;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
rShape.nVertOrient = text::VertOrientation::CENTER;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
rShape.nVertOrient = text::VertOrientation::BOTTOM;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (i->first == "posrelh")
|
else if (i->first == "posrelh")
|
||||||
{
|
{
|
||||||
switch (i->second.toInt32())
|
switch (i->second.toInt32())
|
||||||
@ -503,8 +543,12 @@ void RTFSdrImport::resolve(RTFShape& rShape)
|
|||||||
else
|
else
|
||||||
xShape->setPosition(awt::Point(rShape.nLeft, rShape.nTop));
|
xShape->setPosition(awt::Point(rShape.nLeft, rShape.nTop));
|
||||||
xShape->setSize(awt::Size(rShape.nRight - rShape.nLeft, rShape.nBottom - rShape.nTop));
|
xShape->setSize(awt::Size(rShape.nRight - rShape.nLeft, rShape.nBottom - rShape.nTop));
|
||||||
|
if (rShape.nHoriOrient != 0)
|
||||||
|
xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(rShape.nHoriOrient));
|
||||||
if (rShape.nHoriOrientRelation != 0)
|
if (rShape.nHoriOrientRelation != 0)
|
||||||
xPropertySet->setPropertyValue("HoriOrientRelation", uno::makeAny(rShape.nHoriOrientRelation));
|
xPropertySet->setPropertyValue("HoriOrientRelation", uno::makeAny(rShape.nHoriOrientRelation));
|
||||||
|
if (rShape.nVertOrient != 0)
|
||||||
|
xPropertySet->setPropertyValue("VertOrient", uno::makeAny(rShape.nVertOrient));
|
||||||
if (rShape.nVertOrientRelation != 0)
|
if (rShape.nVertOrientRelation != 0)
|
||||||
xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation));
|
xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation));
|
||||||
if (rShape.nWrap != -1)
|
if (rShape.nWrap != -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user