Kaydet (Commit) c7ea9ac9 authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Luboš Luňák

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 b4845db4)

Change-Id: I5335567833ecf87e6b0ba7c73150a7b95c57f237
Reviewed-on: https://gerrit.libreoffice.org/3081Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Tested-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
üst 2511a06b
{\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 }
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <com/sun/star/text/XPageCursor.hpp> #include <com/sun/star/text/XPageCursor.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
#include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <unotools/tempfile.hxx> #include <unotools/tempfile.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
...@@ -71,6 +72,7 @@ public: ...@@ -71,6 +72,7 @@ public:
void testFdo53604(); void testFdo53604();
void testFdo52286(); void testFdo52286();
void testFdo61507(); void testFdo61507();
void testFdo30983();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -116,6 +118,7 @@ void Test::run() ...@@ -116,6 +118,7 @@ void Test::run()
{"fdo53604.odt", &Test::testFdo53604}, {"fdo53604.odt", &Test::testFdo53604},
{"fdo52286.odt", &Test::testFdo52286}, {"fdo52286.odt", &Test::testFdo52286},
{"fdo61507.rtf", &Test::testFdo61507}, {"fdo61507.rtf", &Test::testFdo61507},
{"fdo30983.rtf", &Test::testFdo30983},
}; };
// Don't test the first import of these, for some reason those tests fail // Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = { const char* aBlacklist[] = {
...@@ -488,6 +491,16 @@ void Test::testFdo61507() ...@@ -488,6 +491,16 @@ void Test::testFdo61507()
CPPUNIT_ASSERT_EQUAL(6, getLength()); 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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -27,7 +27,7 @@ class RTFVertOrient ...@@ -27,7 +27,7 @@ class RTFVertOrient
union { union {
struct { struct {
sal_uInt16 nOrient : 4; sal_uInt16 nOrient : 4;
sal_uInt16 nRelOrient : 1; sal_uInt16 nRelOrient : 4;
} Flags; } Flags;
sal_uInt16 nVal; sal_uInt16 nVal;
} Value; } Value;
...@@ -52,7 +52,7 @@ class RTFHoriOrient ...@@ -52,7 +52,7 @@ class RTFHoriOrient
struct { struct {
sal_uInt16 nOrient : 4; sal_uInt16 nOrient : 4;
sal_uInt16 nRelAnchor : 4; sal_uInt16 nRelAnchor : 4;
sal_uInt16 nRelOrient : 1; sal_uInt16 nRelOrient : 4;
} Flags; } Flags;
sal_uInt16 nVal; sal_uInt16 nVal;
} Value; } Value;
......
...@@ -2770,7 +2770,15 @@ void RtfAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert ...@@ -2770,7 +2770,15 @@ void RtfAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert
if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) 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()) switch (rFlyVert.GetVertOrient())
{ {
...@@ -2808,7 +2816,15 @@ void RtfAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori ...@@ -2808,7 +2816,15 @@ void RtfAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori
if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) 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; const char* pS = 0;
switch(rFlyHori.GetHoriOrient()) switch(rFlyHori.GetHoriOrient())
......
...@@ -99,7 +99,7 @@ namespace writerfilter { ...@@ -99,7 +99,7 @@ namespace writerfilter {
struct struct
{ {
sal_uInt16 nOrient : 4; sal_uInt16 nOrient : 4;
sal_uInt16 nRelOrient : 1; sal_uInt16 nRelOrient : 4;
} Flags; } Flags;
sal_uInt16 nVal; sal_uInt16 nVal;
} Value; } Value;
...@@ -180,7 +180,7 @@ namespace writerfilter { ...@@ -180,7 +180,7 @@ namespace writerfilter {
{ {
sal_uInt16 nOrient : 4; sal_uInt16 nOrient : 4;
sal_uInt16 nRelAnchor : 4; sal_uInt16 nRelAnchor : 4;
sal_uInt16 nRelOrient : 1; sal_uInt16 nRelOrient : 4;
} Flags; } Flags;
sal_uInt16 nVal; sal_uInt16 nVal;
} Value; } Value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment