summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiao Jing Nan <sweetdream201@163.com>2013-07-28 14:43:29 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-22 13:52:37 +0000
commitb904b9a4875a023b430f013e62b81bc90ea8a592 (patch)
tree3fc6b2a9b99ab4e5f1e9d031166ec051a3d37c5a
parent7015a34a1455b100f0c7d324c68930823da22bd8 (diff)
fdo#44689: fix for DOCX import+export of page number start value
Change-Id: If4940b17bcee0d06fa8dc9bf9faa708cf6d0db1c Signed-off-by: Adam Co <rattles2013@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/5528 Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo44689_start_page_7.docxbin0 -> 16849 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx9
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx15
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx13
4 files changed, 29 insertions, 8 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo44689_start_page_7.docx b/sw/qa/extras/ooxmlexport/data/fdo44689_start_page_7.docx
new file mode 100644
index 000000000000..25e58d395220
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo44689_start_page_7.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 47cd3a099b6a..2129d9cd460b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -108,6 +108,7 @@ public:
void testFdo67013();
void testParaShadow();
void testTableFloatingMargins();
+ void testFdo44689_start_page_7();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -192,6 +193,7 @@ void Test::run()
{"fdo67013.docx", &Test::testFdo67013},
{"para-shadow.docx", &Test::testParaShadow},
{"table-floating-margins.docx", &Test::testTableFloatingMargins},
+ {"fdo44689_start_page_7.docx", &Test::testFdo44689_start_page_7},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -1163,6 +1165,13 @@ void Test::testTableFloatingMargins()
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:pict/v:rect/v:textbox/w:txbxContent/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0");
}
+void Test::testFdo44689_start_page_7()
+{
+ // The problem was that the import & export process did not analyze the 'start from page' attribute of a section
+ uno::Reference<beans::XPropertySet> xPara(getParagraph(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(7), getProperty<sal_Int16>(xPara, "PageNumberOffset"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index e34b16cc539f..5e3215e7b3c0 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -344,10 +344,9 @@ namespace sw
namespace util
{
- bool IsPlausableSingleWordSection(const SwFrmFmt &rTitleFmt,
- const SwFrmFmt &rFollowFmt)
+ bool IsPlausableSingleWordSection(const SwFrmFmt &rTitleFmt, const SwFrmFmt &rFollowFmt)
{
- bool bPlausableTitlePage = true;
+ bool bPlausableSingleWordSection = true;
const SwFmtCol& rFirstCols = rTitleFmt.GetCol();
const SwFmtCol& rFollowCols = rFollowFmt.GetCol();
@@ -361,21 +360,21 @@ namespace sw
if (rFirstColumns.size() != rFollowColumns.size())
{
//e.g. #i4320#
- bPlausableTitlePage = false;
+ bPlausableSingleWordSection = false;
}
else if (rOneLR != rTwoLR)
- bPlausableTitlePage = false;
+ bPlausableSingleWordSection = false;
else if (rFirstFrmSize != rFollowFrmSize)
- bPlausableTitlePage = false;
+ bPlausableSingleWordSection = false;
else
{
HdFtDistanceGlue aOne(rTitleFmt.GetAttrSet());
HdFtDistanceGlue aTwo(rFollowFmt.GetAttrSet());
//e.g. #i14509#
if (!aOne.EqualTopBottom(aTwo))
- bPlausableTitlePage = false;
+ bPlausableSingleWordSection = false;
}
- return bPlausableTitlePage;
+ return bPlausableSingleWordSection;
}
HdFtDistanceGlue::HdFtDistanceGlue(const SfxItemSet &rPage)
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index d4061aa1aee7..59a39586953f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1460,6 +1460,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Background_color:
m_pImpl->m_oBackgroundColor.reset(nIntValue);
break;
+ case NS_ooxml::LN_CT_PageNumber_start:
+ if (pSectionContext != NULL)
+ pSectionContext->SetPageNumber(nIntValue);
+ break;
default:
{
#if OSL_DEBUG_LEVEL > 0
@@ -3389,6 +3393,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
}
}
break;
+ case NS_ooxml::LN_EG_SectPrContents_pgNumType:
+ {
+ writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
+ if( pProperties.get())
+ {
+ pProperties->resolve(*this);
+ }
+ }
+ break;
default:
{
#ifdef DEBUG_DOMAINMAPPER