diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-22 14:49:41 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-04-22 16:20:40 +0000 |
commit | f0a169c8c7173d469ff628b3bd32ff0020a269e2 (patch) | |
tree | 44a0537783f5840154dcfa702aa4e588f53e899d | |
parent | 0e689d0d31c93012a375fa86f1ce9e91128db8e5 (diff) |
fdo#77600 RTF export: always close URL's before the end of run
In case the URL text has multiple portions, then MSWordExportBase
generates multiple URL's anyway, and this helps to avoid loosing some
direct formatting of the remaining portions of the paragraph.
(cherry picked from commit 55c832d86e6cb06e9d6423ce5e6245189bc80da1)
Conflicts:
sw/source/filter/ww8/rtfattributeoutput.cxx
sw/source/filter/ww8/rtfattributeoutput.hxx
Change-Id: Ifd72741de610ce69b9ae0978aa8f9a532a3aeed2
Reviewed-on: https://gerrit.libreoffice.org/9124
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/qa/extras/rtfexport/data/fdo77600.rtf | 25 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.hxx | 2 |
4 files changed, 42 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/fdo77600.rtf b/sw/qa/extras/rtfexport/data/fdo77600.rtf new file mode 100644 index 000000000000..5c6a488eb92f --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo77600.rtf @@ -0,0 +1,25 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0 +{\fonttbl +{\f0\fbidi \froman\fcharset238\fprq2 +Times New Roman;} +{\f1\fbidi \fswiss\fcharset238\fprq2 +Arial;} +} +\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid6446855 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 +{\rtlch\fcs1 \af1 \ltrch\fcs0 +\f1\fs20\insrsid6446855 Before } +{\field\fldedit +{\*\fldinst +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid1260577 HYPERLINK "http://www.microsoft.com/en-us/news/press/2013/jul13/07-11onemicrosoft.aspx" } +} +{\fldrslt +{\rtlch\fcs1 \af1 \ltrch\fcs0 +\cs61\f1\fs20\ul\cf17\insrsid6446855\charrsid4592903 href} +} +} +\sectd \ltrsect\psz1\linex0\endnhere\sectdefaultcl\sectrsid6897289\sftnbj +{\rtlch\fcs1 \af1 \ltrch\fcs0 \f1\fs20\insrsid6446855 after.} +{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6446855 +\par } +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 225ab3a5b805..d58e20088b46 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -586,6 +586,12 @@ DECLARE_RTFEXPORT_TEST(testFdo74709, "fdo74709.rtf") CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(360)), getProperty<sal_Int32>(xCell, "RightBorderDistance")); } +DECLARE_RTFEXPORT_TEST(testFdo77600, "fdo77600.rtf") +{ + // This was 'Liberation Serif'. + CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty<OUString>(getRun(getParagraph(1), 3), "CharFontName")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 3415be73901c..3cf3b6982e20 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -413,6 +413,8 @@ void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSing void RtfAttributeOutput::EndRun() { SAL_INFO("sw.rtf", OSL_THIS_FUNC); + if (m_bInURL) + EndURL(); m_aRun->append(SAL_NEWLINE_STRING); m_aRun.appendAndClear(m_aRunText); if (!m_bSingleEmptyRun && m_bInRun) @@ -493,6 +495,7 @@ bool RtfAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarget m_aStyles.append("}"); m_bHadFieldResult = false; + m_bInURL = true; return true; } @@ -500,6 +503,11 @@ bool RtfAttributeOutput::EndURL() { SAL_INFO("sw.rtf", OSL_THIS_FUNC); + if (m_bInURL) + m_bInURL = false; + else + return true; + // close the fldrslt group if (m_bHadFieldResult) m_aRunText->append('}'); @@ -3242,6 +3250,7 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport ) m_bSingleEmptyRun(false), m_bInRun(false), m_nPostitFieldsMaxId(0), + m_bInURL(false), m_pFlyFrameSize(0), m_pPrevPageDesc(0) { diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 60de3e4febaf..b5b19a982463 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -575,6 +575,8 @@ private: unsigned int m_nPostitFieldsMaxId; + bool m_bInURL; + /// When exporting fly frames, this holds the real size of the frame. const Size* m_pFlyFrameSize; |