sw/qa/extras/rtfimport/data/fdo69384-paste.rtf | 17 +++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 14 ++++++++++++++ writerfilter/source/dmapper/StyleSheetTable.cxx | 11 +++++++++-- 3 files changed, 40 insertions(+), 2 deletions(-)
New commits: commit 5ebe826caf75e8d00656b3333385bf0bbc05cb27 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Oct 4 11:02:59 2013 +0200 fdo#69384 fix impress -> writer copy&paste Regression from 2ade07126971b79c92f729fae5709f2e2e2b495c (fdo#62044 RTF import: don't overwrite existing styles when pasting, 2013-06-04), during paste, if existing style was found, then the intention was to skip that style, but instead we tried to create one. Change-Id: I83adaf9fe6b8a578fa60c21b9463fabde7707d7e diff --git a/sw/qa/extras/rtfimport/data/fdo69384-paste.rtf b/sw/qa/extras/rtfimport/data/fdo69384-paste.rtf new file mode 100644 index 0000000..cbdca5b --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo69384-paste.rtf @@ -0,0 +1,17 @@ +{\rtf\ansi +{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fprq2\fcharset0 Segoe UI;}{\f2\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Arial;}{\f4\fprq2\fcharset0 Droid Sans Fallback;}} +{\colortbl\red255\green255\blue255;;} +{\stylesheet +{\s1\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\snext1 Default;} +{\s2\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext2 Object with arrow;} +{\s3\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext3 Object with shadow;} +{\s4\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext4 Object without fill;} +{\s5\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext5 Object with no fill and no line;} +{\s6\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext6 Text;} +{\s7\fi0\li0\ri0\sb0\sa0\sl200\slmult0\cf0\f3\fs32\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext7 Text body;} +{\s8\fi0\li0\ri0\sb0\sa0\sl200\slmult0\ql\cf0\f3\fs36\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs36\fs36\b0\b0\i0\i0\accnone\olnone\sbasedon1\snext8 Text body justified;}} +{\*\EditEnginePoolDefaults\ltrpar\fi0\li0\ri0\fi0\li0\ri0\sb0\sa0\sl0\slmult0\ql\cf0\f0\fs48\b0\ulnone\strike0\i0\outl0\shad0\kerning0\expndtw0\f1\f2\fs48\fs48\b0\b0\i0\i0\accnone\olnone} +\deftab709 +{ +\s27\fi0\li0\ri0\qc\cf0\f3\fs64\b0\ulnone\strike0\i0\outl0\shad0\kerning1\f4\f2\fs64\fs64\b0\b0\i0\i0\accnone\olnone {\f3\fs64\b0\i0 sss}\par\pard\plain +}} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index c5dfd25..8622d40 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -166,6 +166,7 @@ public: void testFdo44715(); void testFdo68076(); void testFdo68291(); + void testFdo69384(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -317,6 +318,7 @@ void Test::run() {"fdo44715.rtf", &Test::testFdo44715}, {"fdo68076.rtf", &Test::testFdo68076}, {"fdo68291.odt", &Test::testFdo68291}, + {"hello.rtf", &Test::testFdo69384}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1525,6 +1527,18 @@ void Test::testFdo68291() CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "PageDescName")); } +void Test::testFdo69384() +{ + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xEnd = xText->getEnd(); + paste("fdo69384-paste.rtf", xEnd); + + // Import got interrupted in the middle of style sheet table import, + // resuling in missing styles and text. + getStyles("ParagraphStyles")->getByName("Text body justified"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 44828b7..0a232f0 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -725,9 +725,16 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable ) uno::Reference< style::XStyle > xStyle; OUString sConvertedStyleName = ConvertStyleName( pEntry->sStyleName ); - // When pasting, don't update existing styles. - if(xStyles->hasByName( sConvertedStyleName ) && m_pImpl->m_bIsNewDoc) + if(xStyles->hasByName( sConvertedStyleName )) + { + // When pasting, don't update existing styles. + if (!m_pImpl->m_bIsNewDoc) + { + ++aIt; + continue; + } xStyles->getByName( sConvertedStyleName ) >>= xStyle; + } else { bInsert = true; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits