summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-03-27 10:58:53 +0100
committerLuboš Luňák <l.lunak@suse.cz>2013-03-29 14:26:33 +0000
commitc7ea9ac9d5f572b647f7e83ce9ae109b773052ba (patch)
treee9350a9719bf747464cb8ae44c2cdbeacde72035
parent2511a06b5eaf831193936177a708b283849fdbcf (diff)
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. (cherry picked from commit b4845db4260db70cb3aaf03758cb4a1ca5fa88ed) Change-Id: I5335567833ecf87e6b0ba7c73150a7b95c57f237 Reviewed-on: https://gerrit.libreoffice.org/3081 Reviewed-by: Luboš Luňák <l.lunak@suse.cz> Tested-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r--sw/qa/extras/rtfexport/data/fdo30983.rtf43
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx13
-rw-r--r--sw/source/filter/inc/rtf.hxx4
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx20
-rw-r--r--writerfilter/source/rtftok/rtffly.hxx4
5 files changed, 78 insertions, 6 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 18ddf1bdf326..0610516b6349 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 <unotools/tempfile.hxx>
#include <vcl/svapp.hxx>
@@ -71,6 +72,7 @@ public:
void testFdo53604();
void testFdo52286();
void testFdo61507();
+ void testFdo30983();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -116,6 +118,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[] = {
@@ -488,6 +491,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 36dc481e9038..33032b1905c2 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())
diff --git a/writerfilter/source/rtftok/rtffly.hxx b/writerfilter/source/rtftok/rtffly.hxx
index 9e2141c146aa..918f800f9047 100644
--- a/writerfilter/source/rtftok/rtffly.hxx
+++ b/writerfilter/source/rtftok/rtffly.hxx
@@ -99,7 +99,7 @@ namespace writerfilter {
struct
{
sal_uInt16 nOrient : 4;
- sal_uInt16 nRelOrient : 1;
+ sal_uInt16 nRelOrient : 4;
} Flags;
sal_uInt16 nVal;
} Value;
@@ -180,7 +180,7 @@ namespace writerfilter {
{
sal_uInt16 nOrient : 4;
sal_uInt16 nRelAnchor : 4;
- sal_uInt16 nRelOrient : 1;
+ sal_uInt16 nRelOrient : 4;
} Flags;
sal_uInt16 nVal;
} Value;