diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-03-27 10:58:53 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-03-27 11:02:59 +0100 |
commit | b4845db4260db70cb3aaf03758cb4a1ca5fa88ed (patch) | |
tree | 167b22ef25f823da938c1641267ff99de8d0c760 /sw | |
parent | WaE: macro is not used (diff) | |
download | core-b4845db4260db70cb3aaf03758cb4a1ca5fa88ed.tar.gz core-b4845db4260db70cb3aaf03758cb4a1ca5fa88ed.zip |
fdo#30983 RTF filter: fix handling of RTF_PVPG and RTF_PHPG
There were two issues here:
1) The export filter never exported these keywords.
2) The "flymaincnt" RTF extension we inherited from OOo actually never
worked (i.e. it's like this since 7b0b5cdf, the initial import...), as
RTFVertOrient / RTFHoriOrient's second parameter was stored in 1 bit, so
text::RelOrientation::PAGE_FRAME (7) was read back as 1 instead.
Note that I want to get rid of this flymaincnt extension in the exporter
anyway soon, so killing the RTFVertOrient / RTFHoriOrient duplication is
pointless: the sw version will go away.
Change-Id: I5335567833ecf87e6b0ba7c73150a7b95c57f237
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/data/fdo30983.rtf | 43 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/inc/rtf.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 20 |
4 files changed, 76 insertions, 4 deletions
diff --git a/sw/qa/extras/rtfexport/data/fdo30983.rtf b/sw/qa/extras/rtfexport/data/fdo30983.rtf new file mode 100644 index 000000000000..bd4dd96e1083 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo30983.rtf @@ -0,0 +1,43 @@ +{\rtf1\ansi\deff4\adeflang1025 +\paperh15840\paperw12240\margl902\margr958\margt1440\margb735\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn902\margrsxn958\margtsxn1440\margbsxn735\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc +\absw2380\absh-1244\pvpg\posy465\phpg\posx8437 +{\*\flymaincnt96\flyvert29040\flyhorz30464\flyanchor4\pgndec} +\s111\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\loch\f1\rtlch \ltrch\loch\loch\f5 +5983 Red Pine Blvd} +\par \s111\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +White Bear Township, MN 55110} +\par \s110\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +Home 651-426-9645} +\par \s110\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +Cell 651-245-1843} +\par \s110\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +E-mail dadsouch@gmail.com} +\par \pard +\pard\plain \s123\sl240\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\li2160\ri0\lin2160\rin0\fi0\sb0\sa440\ltrpar\cf0\expnd-4\expndtw-20\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs48\lang1033\li-11\ri0\lin-11\rin0\fi0\sb0\sa144 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +M} +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +ichael P. Soucheray} +\par \pard\plain \s114\sl220\slmult0\ql\widctlpar\tx2160\tqr\tx6480 +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\li0\ri-360\lin0\rin-360\fi0\sb220\sa40\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs20\lang1033\li-11\ri0\lin-11\rin0\fi0\sb0\sa144 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +Experienced general} +\par } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 529467092a8c..fffb9591af30 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/text/XPageCursor.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/text/RelOrientation.hpp> #include <vcl/svapp.hxx> #include <swmodeltestbase.hxx> @@ -70,6 +71,7 @@ public: void testFdo53604(); void testFdo52286(); void testFdo61507(); + void testFdo30983(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -115,6 +117,7 @@ void Test::run() {"fdo53604.odt", &Test::testFdo53604}, {"fdo52286.odt", &Test::testFdo52286}, {"fdo61507.rtf", &Test::testFdo61507}, + {"fdo30983.rtf", &Test::testFdo30983}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -482,6 +485,16 @@ void Test::testFdo61507() CPPUNIT_ASSERT_EQUAL(6, getLength()); } +void Test::testFdo30983() +{ + // These were 'page text area', not 'entire page', i.e. both the horizontal + // and vertical positions were incorrect. + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(0), "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrientRelation")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/inc/rtf.hxx b/sw/source/filter/inc/rtf.hxx index f2fc54f7c226..f82780af9e92 100644 --- a/sw/source/filter/inc/rtf.hxx +++ b/sw/source/filter/inc/rtf.hxx @@ -27,7 +27,7 @@ class RTFVertOrient union { struct { sal_uInt16 nOrient : 4; - sal_uInt16 nRelOrient : 1; + sal_uInt16 nRelOrient : 4; } Flags; sal_uInt16 nVal; } Value; @@ -52,7 +52,7 @@ class RTFHoriOrient struct { sal_uInt16 nOrient : 4; sal_uInt16 nRelAnchor : 4; - sal_uInt16 nRelOrient : 1; + sal_uInt16 nRelOrient : 4; } Flags; sal_uInt16 nVal; } Value; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 39fd23b924b0..6d9320ee995b 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2770,7 +2770,15 @@ void RtfAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) { - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PVPARA); + switch (rFlyVert.GetRelationOrient()) + { + case text::RelOrientation::PAGE_FRAME: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PVPG); + break; + default: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PVPARA); + break; + } switch (rFlyVert.GetVertOrient()) { @@ -2808,7 +2816,15 @@ void RtfAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) { - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PHCOL); + switch (rFlyHori.GetRelationOrient()) + { + case text::RelOrientation::PAGE_FRAME: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PHPG); + break; + default: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PHCOL); + break; + } const char* pS = 0; switch(rFlyHori.GetHoriOrient()) |