[Libreoffice-commits] .: 5 commits - sw/qa test/source writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Thu Aug 2 00:21:28 PDT 2012
sw/qa/extras/rtfimport/data/fdo49892.rtf | 238 +++++++++++++++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 24 ++
test/source/bootstrapfixture.cxx | 21 +-
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 16 +
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 3
writerfilter/source/rtftok/rtfsdrimport.cxx | 24 +-
6 files changed, 307 insertions(+), 19 deletions(-)
New commits:
commit 8a59191c15c6b22f825f999f633e1bbe2a7698b2
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Aug 1 21:35:08 2012 +0200
test: string cleanup in BootstrapFixture
Change-Id: I468c295713fc34b64403a1c31f802820e6608b07
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index 86e2acb..b560913 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -48,10 +48,10 @@ using namespace ::com::sun::star;
static void aBasicErrorFunc( const String &rErr, const String &rAction )
{
- rtl::OStringBuffer aErr( "Unexpected dialog: " );
- aErr.append( rtl::OUStringToOString( rAction, RTL_TEXTENCODING_ASCII_US ) );
+ OStringBuffer aErr( "Unexpected dialog: " );
+ aErr.append( OUStringToOString( rAction, RTL_TEXTENCODING_ASCII_US ) );
aErr.append( " Error: " );
- aErr.append( rtl::OUStringToOString( rErr, RTL_TEXTENCODING_ASCII_US ) );
+ aErr.append( OUStringToOString( rErr, RTL_TEXTENCODING_ASCII_US ) );
CPPUNIT_ASSERT_MESSAGE( aErr.getStr(), false);
}
@@ -72,29 +72,28 @@ void test::BootstrapFixture::setUp()
// force locale (and resource files loaded) to en-US
const LanguageType eLang=LANGUAGE_ENGLISH_US;
- rtl::OUString aLang, aCountry;
+ OUString aLang, aCountry;
MsLangId::convertLanguageToIsoNames(eLang, aLang, aCountry);
- lang::Locale aLocale(aLang, aCountry, rtl::OUString());
+ lang::Locale aLocale(aLang, aCountry, OUString());
ResMgr::SetDefaultLocale( aLocale );
if (m_bNeedUCB)
{
// initialise UCB-Broker
uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local"));
- aUcbInitSequence[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office"));
+ aUcbInitSequence[0] <<= OUString("Local");
+ aUcbInitSequence[1] <<= OUString("Office");
bool bInitUcb = ucbhelper::ContentBroker::initialize(m_xSFactory, aUcbInitSequence);
CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb);
uno::Reference<ucb::XContentProviderManager> xUcb =
ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
- uno::Reference<ucb::XContentProvider> xFileProvider(m_xSFactory->createInstance(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY);
- xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True);
+ uno::Reference<ucb::XContentProvider> xFileProvider(m_xSFactory->createInstance("com.sun.star.ucb.FileContentProvider"), uno::UNO_QUERY);
+ xUcb->registerContentProvider(xFileProvider, "file", sal_True);
}
SvtSysLocaleOptions aLocalOptions;
- rtl::OUString aLangISO = MsLangId::convertLanguageToIsoString( LANGUAGE_ENGLISH_US );
+ OUString aLangISO = MsLangId::convertLanguageToIsoString( LANGUAGE_ENGLISH_US );
aLocalOptions.SetLocaleConfigString( aLangISO );
aLocalOptions.SetUILocaleConfigString( aLangISO );
commit 881a08079cee9363abd9c1d8e6b86465a2868a30
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Aug 1 21:03:58 2012 +0200
fdo#49892 testcase
Change-Id: I22cae445e5a75563e3c69ac890126292358b9749
diff --git a/sw/qa/extras/rtfimport/data/fdo49892.rtf b/sw/qa/extras/rtfimport/data/fdo49892.rtf
new file mode 100644
index 0000000..29cd4f0
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo49892.rtf
@@ -0,0 +1,238 @@
+{\rtf1\ansi\ansicpg1251\deff0\deflang1033
+{\fonttbl
+{\f0\froman\fcharset204 Times New Roman;}
+}
+{\colortbl;\red0\green0\blue0;}
+\landscape\paperw16836\paperh11904\margl360\margr360\margt360\margb360\gutter0\windowctrl\ftnbj\viewkind1\viewscale100\sectd\linex0\sbknone
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid14249094
+{\shp
+{\*\shpinst\shpleft1275\shptop-135\shpright3045\shpbottom720\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz2\shplid1026
+{\sp{\sn wzDescription}{\sv blue}}
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 0}
+}
+{\sp
+{\sn fillColor}
+{\sv 12419407}
+}
+{\sp
+{\sn lineColor}
+{\sv 15921906}
+}
+{\sp
+{\sn lineWidth}
+{\sv 38100}
+}
+{\sp
+{\sn shadowType}
+{\sv 2}
+}
+{\sp
+{\sn shadowColor}
+{\sv 6307620}
+}
+{\sp
+{\sn shadowOpacity}
+{\sv 32768}
+}
+{\sp
+{\sn shadowOffsetX}
+{\sv 12700}
+}
+{\sp
+{\sn shadowSecondOffsetX}
+{\sv -12700}
+}
+{\sp
+{\sn fShadow}
+{\sv 1}
+}
+{\sp
+{\sn dhgt}
+{\sv 251658240}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+}
+}
+}
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid12526335
+{\shp
+{\*\shpinst\shpleft2475\shptop150\shpright4500\shpbottom1230\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz1\shplid1028
+{\sp{\sn wzDescription}{\sv green}}
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 0}
+}
+{\sp
+{\sn fillColor}
+{\sv 5880731}
+}
+{\sp
+{\sn lineColor}
+{\sv 15921906}
+}
+{\sp
+{\sn lineWidth}
+{\sv 38100}
+}
+{\sp
+{\sn shadowType}
+{\sv 2}
+}
+{\sp
+{\sn shadowColor}
+{\sv 2646350}
+}
+{\sp
+{\sn shadowOpacity}
+{\sv 32768}
+}
+{\sp
+{\sn shadowOffsetX}
+{\sv 12700}
+}
+{\sp
+{\sn shadowSecondOffsetX}
+{\sv -12700}
+}
+{\sp
+{\sn fShadow}
+{\sv 1}
+}
+{\sp
+{\sn dhgt}
+{\sv 251657727}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+}
+}
+{\shp
+{\*\shpinst\shpleft1560\shptop420\shpright3885\shpbottom1785\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1027
+{\sp{\sn wzDescription}{\sv red}}
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 0}
+}
+{\sp
+{\sn fillColor}
+{\sv 5066944}
+}
+{\sp
+{\sn lineColor}
+{\sv 15921906}
+}
+{\sp
+{\sn lineWidth}
+{\sv 38100}
+}
+{\sp
+{\sn shadowType}
+{\sv 2}
+}
+{\sp
+{\sn shadowColor}
+{\sv 2303074}
+}
+{\sp
+{\sn shadowOpacity}
+{\sv 32768}
+}
+{\sp
+{\sn shadowOffsetX}
+{\sv 12700}
+}
+{\sp
+{\sn shadowSecondOffsetX}
+{\sv -12700}
+}
+{\sp
+{\sn fShadow}
+{\sv 1}
+}
+{\sp
+{\sn dhgt}
+{\sv 251657215}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+}
+}
+}
+{\shp
+{\*\shpinst\shpleft644\shptop2916\shpright5188\shpbottom3481\shpfhdr0\shpbxpage\shpbypage\shpwr3\shpwrk0\shpfblwtxt1
+{\sp{\sn wzDescription}{\sv rect}}
+{\sp
+{\sn txflTextFlow}
+{\sv 0}
+}
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fBehindDocument}
+{\sv 1}
+}
+{\sp
+{\sn fLine}
+{\sv 1}
+}
+{\sp
+{\sn lineColor}
+{\sv 0}
+}
+{\sp
+{\sn lineWidth}
+{\sv 12700}
+}
+{\sp
+{\sn lineDashing}
+{\sv 0}
+}
+{\sp
+{\sn lineStyle}
+{\sv 0}
+}
+{\sp
+{\sn fFilled}
+{\sv 0}
+}
+}
+}
+{\pard \pvpg\phpg\posx644\posy2916\absw4544\absh-284\fi0 \qc\tx360\tx720\tx1080\tx1440\tx1800\tx2160\tx2520\tx2880\tx3240\tx3600\tx3960\tx4320
+{\f0 \b0\i0\ul0\strike0\fs20 \cf1 hello}
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 753505e..b185635 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -101,6 +101,7 @@ public:
void testFdo52066();
void testFdo48033();
void testFdo36089();
+ void testFdo49892();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -144,6 +145,7 @@ public:
CPPUNIT_TEST(testFdo52066);
CPPUNIT_TEST(testFdo48033);
CPPUNIT_TEST(testFdo36089);
+ CPPUNIT_TEST(testFdo49892);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -862,6 +864,28 @@ void Test::testFdo36089()
CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement"));
}
+void Test::testFdo49892()
+{
+ load("fdo49892.rtf");
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ for (int i = 0; i < xDraws->getCount(); ++i)
+ {
+ OUString aDescription = getProperty<OUString>(xDraws->getByIndex(i), "Description");
+ if (aDescription == "red")
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
+ else if (aDescription == "green")
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
+ else if (aDescription == "blue")
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
+ else if (aDescription == "rect")
+ {
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "HoriOrientRelation"));
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(i), "VertOrientRelation"));
+ }
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 690808bbf726f3e712e1d452999eb3f2b81251f6
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Aug 1 20:55:16 2012 +0200
no need to invoke dmapper here
Change-Id: Ie005d0ae0ed6e2f055f03015162edaa10ed78897
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 2f765ec..7fe19e5 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -107,15 +107,9 @@ void RTFSdrImport::resolve(RTFShape& rShape)
xPropertySet->setPropertyValue("FillColor", aAny);
}
else if ( i->first == "wzName" )
- {
- RTFValue::Pointer_t pValue(new RTFValue(i->second));
- m_rImport.getState().aCharacterAttributes.set(NS_ooxml::LN_CT_NonVisualDrawingProps_name, pValue);
- }
+ xPropertySet->setPropertyValue("Name", uno::makeAny(i->second));
else if ( i->first == "wzDescription" )
- {
- RTFValue::Pointer_t pValue(new RTFValue(i->second));
- m_rImport.getState().aCharacterAttributes.set(NS_ooxml::LN_CT_NonVisualDrawingProps_descr, pValue);
- }
+ xPropertySet->setPropertyValue("Description", uno::makeAny(i->second));
else if ( i->first == "pib" )
{
m_rImport.setDestinationText(i->second);
commit c2e2ca29ccc8efe1957ac770c6b818c56a37d532
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Aug 1 20:30:40 2012 +0200
fdo#49892 import RTF_SHPB{X,Y}PAGE
Change-Id: I8fe2b28f44ee61fc0f1438de3681fd86b16d29ae
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e6758f1..1e67616 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2318,6 +2318,12 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_FACINGP:
m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, RTFValue::Pointer_t(new RTFValue(1)));
break;
+ case RTF_SHPBXPAGE:
+ m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
+ break;
+ case RTF_SHPBYPAGE:
+ m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
+ break;
default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false);
@@ -3989,6 +3995,16 @@ RTFPicture::RTFPicture()
{
}
+RTFShape::RTFShape()
+ : nLeft(0),
+ nTop(0),
+ nRight(0),
+ nBottom(0),
+ nHoriOrientRelation(0),
+ nVertOrientRelation(0)
+{
+}
+
RTFDrawingObject::RTFDrawingObject()
: nLineColorR(0),
nLineColorG(0),
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 1de7c6e..c05a0f5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -249,11 +249,14 @@ namespace writerfilter {
class RTFShape
{
public:
+ RTFShape();
std::vector< std::pair<rtl::OUString, rtl::OUString> > aProperties;
int nLeft;
int nTop;
int nRight;
int nBottom;
+ sal_Int16 nHoriOrientRelation;
+ sal_Int16 nVertOrientRelation;
};
/// Stores the properties of a drawing object.
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index f5b7555..2f765ec 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -338,6 +338,10 @@ void RTFSdrImport::resolve(RTFShape& rShape)
{
xShape->setPosition(awt::Point(rShape.nLeft, rShape.nTop));
xShape->setSize(awt::Size(rShape.nRight - rShape.nLeft, rShape.nBottom - rShape.nTop));
+ if (rShape.nHoriOrientRelation != 0)
+ xPropertySet->setPropertyValue("HoriOrientRelation", uno::makeAny(rShape.nHoriOrientRelation));
+ if (rShape.nVertOrientRelation != 0)
+ xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation));
}
// Send it to dmapper
commit ecda5eadaf497f8eb1ec8fb7e73c4e5e6d717da9
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Aug 1 15:37:45 2012 +0200
fdo#49892 implement RTF import of dhgt shape property
Change-Id: I36d574c5f7915d732c6c158fadb91b6032370a01
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index ae7b144..f5b7555 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -37,6 +37,8 @@
#include <filter/msfilter/escherex.hxx>
#include <filter/msfilter/util.hxx>
+#include <dmapper/DomainMapper.hxx>
+#include "../dmapper/GraphicHelpers.hxx"
#include <rtfsdrimport.hxx>
using rtl::OString;
@@ -275,6 +277,14 @@ void RTFSdrImport::resolve(RTFShape& rShape)
aViewBox.Width = i->second.toInt32();
else if ( i->first == "geoBottom" )
aViewBox.Height = i->second.toInt32();
+ else if ( i->first == "dhgt" )
+ {
+ writerfilter::dmapper::DomainMapper& rMapper = (writerfilter::dmapper::DomainMapper&)m_rImport.Mapper();
+ writerfilter::dmapper::GraphicZOrderHelper* pHelper = rMapper.graphicZOrderHelper();
+ sal_Int32 nZOrder = i->second.toInt32();
+ xPropertySet->setPropertyValue("ZOrder", uno::makeAny(pHelper->findZOrder(nZOrder)));
+ pHelper->addItem(xPropertySet, nZOrder);
+ }
else
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle shape property '" <<
OUStringToOString( i->first, RTL_TEXTENCODING_UTF8 ).getStr() << "':'" <<
More information about the Libreoffice-commits
mailing list