[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Piao Jing Nan
sweetdream201 at 163.com
Thu Aug 22 06:53:04 PDT 2013
sw/qa/extras/ooxmlexport/data/fdo44689_start_page_7.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 +++++++++
sw/source/filter/ww8/writerwordglue.cxx | 15 +++++++--------
writerfilter/source/dmapper/DomainMapper.cxx | 13 +++++++++++++
4 files changed, 29 insertions(+), 8 deletions(-)
New commits:
commit b904b9a4875a023b430f013e62b81bc90ea8a592
Author: Piao Jing Nan <sweetdream201 at 163.com>
Date: Sun Jul 28 14:43:29 2013 +0200
fdo#44689: fix for DOCX import+export of page number start value
Change-Id: If4940b17bcee0d06fa8dc9bf9faa708cf6d0db1c
Signed-off-by: Adam Co <rattles2013 at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/5528
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
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 0000000..25e58d3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo44689_start_page_7.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 47cd3a0..2129d9c 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 e34b16c..5e3215e 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 d4061aa..59a3958 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
More information about the Libreoffice-commits
mailing list