[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/CppunitTest_sw_rtfimport.mk sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Sep 9 03:43:50 PDT 2013
sw/CppunitTest_sw_rtfimport.mk | 1 +
sw/qa/extras/rtfimport/data/fdo68291-paste.rtf | 17 +++++++++++++++++
sw/qa/extras/rtfimport/data/fdo68291.odt |binary
sw/qa/extras/rtfimport/rtfimport.cxx | 13 +++++++++++++
writerfilter/source/dmapper/PropertyMap.cxx | 2 +-
5 files changed, 32 insertions(+), 1 deletion(-)
New commits:
commit 2bf1604026fd4f69b4d727f931c9b33e2da30d8d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Sep 9 10:14:19 2013 +0200
fdo#68291 RTF paste: don't set PageDescName during paste
In general, paste should not deal with page styles. In this case, it
even caused an additional page break.
(cherry picked from commit b226dcb50d6728b62f39c9fa2e016724324944e3)
Change-Id: Ia7c5a9ad844821b6622babfbd94469ec3c04cf0a
Reviewed-on: https://gerrit.libreoffice.org/5883
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/CppunitTest_sw_rtfimport.mk b/sw/CppunitTest_sw_rtfimport.mk
index 8cedeeb..be6613a 100644
--- a/sw/CppunitTest_sw_rtfimport.mk
+++ b/sw/CppunitTest_sw_rtfimport.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_rtfimport,\
unotools/util/utl \
unoxml/source/service/unoxml \
writerfilter/util/writerfilter \
+ xmloff/util/xo \
))
$(eval $(call gb_CppunitTest_use_configuration,sw_rtfimport))
diff --git a/sw/qa/extras/rtfimport/data/fdo68291-paste.rtf b/sw/qa/extras/rtfimport/data/fdo68291-paste.rtf
new file mode 100644
index 0000000..cb86b60
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo68291-paste.rtf
@@ -0,0 +1,17 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Times New Roman;}{\f4\fswiss\fprq2\fcharset0 Arial;}{\f5\fnil\fprq2\fcharset0 DejaVu Sans;}}
+{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
+{\stylesheet{\s0\snext0\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\kerning1\dbch\af5\langfe2052\dbch\af5\alang1081\fs24\lang1038 Normal;}
+{\s15\sbasedon0\snext15\noline Index;}
+{\s16\sbasedon0\snext16\sb120\sa120\noline\i\afs24\ai\fs24 Caption;}
+{\s17\sbasedon18\snext17\sb0\sa120 List;}
+{\s18\sbasedon0\snext18\sb0\sa120 Text Body;}
+{\s19\sbasedon0\snext18\sb240\sa120\keepn\dbch\af5\dbch\af5\afs28\loch\f4\fs28 Heading;}
+}{\info{\comment LibreOffice}{\vern67239936}}\deftab709
+
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Default Style;}}
+\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\pgndec\pard\plain \s0\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\kerning1\dbch\af5\langfe2052\dbch\af5\alang1081\fs24\lang1038{\rtlch \ltrch\loch
+aaa}
+\par }
diff --git a/sw/qa/extras/rtfimport/data/fdo68291.odt b/sw/qa/extras/rtfimport/data/fdo68291.odt
new file mode 100644
index 0000000..ddf7d30
Binary files /dev/null and b/sw/qa/extras/rtfimport/data/fdo68291.odt differ
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 58f0594..8508909 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -158,6 +158,7 @@ public:
void testFdo63428();
void testFdo44715();
void testFdo68076();
+ void testFdo68291();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -300,6 +301,7 @@ void Test::run()
{"hello.rtf", &Test::testFdo63428},
{"fdo44715.rtf", &Test::testFdo44715},
{"fdo68076.rtf", &Test::testFdo68076},
+ {"fdo68291.odt", &Test::testFdo68291},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1451,6 +1453,17 @@ void Test::testFdo68076()
getParagraph(1, aExpected);
}
+void Test::testFdo68291()
+{
+ 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("fdo68291-paste.rtf", xEnd);
+
+ // This was "Standard", causing an unwanted page break on next paste.
+ CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "PageDescName"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 21974a4..83868d4 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1047,7 +1047,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */
if ((m_bTitlePage && m_bIsFirstSection) || !m_bTitlePage)
{
- if (xRangeProperties.is())
+ if (xRangeProperties.is() && rDM_Impl.IsNewDoc())
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
}
More information about the Libreoffice-commits
mailing list