[Libreoffice-commits] .: sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 6 02:10:43 PST 2012
sw/qa/extras/rtfimport/data/fdo48442.rtf | 10 ++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 11 +++++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 ++++++----
3 files changed, 27 insertions(+), 4 deletions(-)
New commits:
commit 7b7bee4ed5722ce59ffd3394a0330d71d69d66b3
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Nov 6 10:53:10 2012 +0100
fdo#48442 fix default hori/vert frame anchor during RTF import
We used to send nothing when we got nothing, but this is not correct:
\pvmrg and \phmrg is the default in RTF, but not in Writer.
Change-Id: I9f69e282e68f0828c8b5ba98657cad1dd0715eb3
diff --git a/sw/qa/extras/rtfimport/data/fdo48442.rtf b/sw/qa/extras/rtfimport/data/fdo48442.rtf
new file mode 100644
index 0000000..5b1a728
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo48442.rtf
@@ -0,0 +1,10 @@
+{\rtf1\adeflang1025\ansi\ansicpg1251\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1049\deflangfe1049\themelang1049\themelangfe0\themelangcs0
+\pard \ltrpar\qc \li0\ri0\sb40\sl-180\slmult0\nowidctlpar\phmrg\posx8900\posy11660\absh280\absw1460\wrapdefault\faauto\rin0\lin0\itap0
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid3501281
+}
+{\rtlch\fcs1 \ab\af0\afs18 \ltrch\fcs0 \b\f0\fs18\insrsid3501281
+\hich\af0\dbch\af31505\loch\f0 02.04.2012}
+{\rtlch\fcs1 \af1\afs24 \ltrch\fcs0 \f1\fs24\insrsid3501281
+\par }
+\pard\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index b0e3ab3..5d2c183 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -123,6 +123,7 @@ public:
void testDppolyline();
void testFdo56512();
void testFdo52989();
+ void testFdo48442();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -197,6 +198,7 @@ void Test::run()
{"dppolyline.rtf", &Test::testDppolyline},
{"fdo56512.rtf", &Test::testFdo56512},
{"fdo52989.rtf", &Test::testFdo52989},
+ {"fdo48442.rtf", &Test::testFdo48442},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -906,6 +908,15 @@ void Test::testFdo52989()
CPPUNIT_ASSERT_EQUAL(sal_Int32(423), xShape->getSize().Width);
}
+void Test::testFdo48442()
+{
+ // The problem was that \pvmrg is the default in RTF, but not in Writer.
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(xDraws->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4393aa0..fd00feb 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4347,12 +4347,14 @@ RTFSprms RTFFrame::getSprms()
pValue.reset(new RTFValue(nVertPadding));
break;
case NS_ooxml::LN_CT_FramePr_hAnchor:
- if ( nHoriAnchor != 0 )
- pValue.reset(new RTFValue(nHoriAnchor));
+ if ( nHoriAnchor == 0 )
+ nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin;
+ pValue.reset(new RTFValue(nHoriAnchor));
break;
case NS_ooxml::LN_CT_FramePr_vAnchor:
- if ( nVertAnchor != 0 )
- pValue.reset(new RTFValue(nVertAnchor));
+ if ( nVertAnchor == 0 )
+ nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin;
+ pValue.reset(new RTFValue(nVertAnchor));
break;
case NS_ooxml::LN_CT_FramePr_xAlign:
pValue.reset(new RTFValue(nHoriAlign));
More information about the Libreoffice-commits
mailing list