summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-10-04 11:02:59 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-10-09 13:23:32 +0000
commit168b5a95bd0a030e4c781f7d00bec47eb706ec09 (patch)
treec09f09f45a19cfaa4cee3b4fa1ed7056ce86748f
parent0326b8d262a83998b8f2ad8c4e1bbc20a7371d91 (diff)
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. (cherry picked from commit 5ebe826caf75e8d00656b3333385bf0bbc05cb27) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx writerfilter/source/dmapper/StyleSheetTable.cxx Change-Id: I83adaf9fe6b8a578fa60c21b9463fabde7707d7e Reviewed-on: https://gerrit.libreoffice.org/6129 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 68fc31104299588f92cac3169a01ec926826f95a) Reviewed-on: https://gerrit.libreoffice.org/6133 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/qa/extras/rtfimport/data/fdo69384-paste.rtf17
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx14
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx11
3 files changed, 40 insertions, 2 deletions
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 000000000000..cbdca5be6e9c
--- /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 219024393c13..ef262fb54121 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -151,6 +151,7 @@ public:
void testFdo64671();
void testFdo62044();
void testFdo68076();
+ void testFdo69384();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -272,6 +273,7 @@ void Test::run()
{"fdo64671.rtf", &Test::testFdo64671},
{"fdo62044.rtf", &Test::testFdo62044},
{"fdo68076.rtf", &Test::testFdo68076},
+ {"hello.rtf", &Test::testFdo69384},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -1253,6 +1255,18 @@ void Test::testFdo68076()
getParagraph(1, aExpected);
}
+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 325c9a45e935..e0000c96b1b9 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -712,9 +712,16 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
uno::Reference< container::XNameContainer > xStyles = bParaStyle ? xParaStyles : xCharStyles;
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;