Kaydet (Commit) b904b9a4 authored tarafından Piao Jing Nan's avatar Piao Jing Nan Kaydeden (comit) Miklos Vajna

fdo#44689: fix for DOCX import+export of page number start value

Change-Id: If4940b17bcee0d06fa8dc9bf9faa708cf6d0db1c
Signed-off-by: 's avatarAdam Co <rattles2013@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/5528Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst 7015a34a
...@@ -108,6 +108,7 @@ public: ...@@ -108,6 +108,7 @@ public:
void testFdo67013(); void testFdo67013();
void testParaShadow(); void testParaShadow();
void testTableFloatingMargins(); void testTableFloatingMargins();
void testFdo44689_start_page_7();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -192,6 +193,7 @@ void Test::run() ...@@ -192,6 +193,7 @@ void Test::run()
{"fdo67013.docx", &Test::testFdo67013}, {"fdo67013.docx", &Test::testFdo67013},
{"para-shadow.docx", &Test::testParaShadow}, {"para-shadow.docx", &Test::testParaShadow},
{"table-floating-margins.docx", &Test::testTableFloatingMargins}, {"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 // Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = { const char* aBlacklist[] = {
...@@ -1163,6 +1165,13 @@ void Test::testTableFloatingMargins() ...@@ -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"); 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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -344,10 +344,9 @@ namespace sw ...@@ -344,10 +344,9 @@ namespace sw
namespace util namespace util
{ {
bool IsPlausableSingleWordSection(const SwFrmFmt &rTitleFmt, bool IsPlausableSingleWordSection(const SwFrmFmt &rTitleFmt, const SwFrmFmt &rFollowFmt)
const SwFrmFmt &rFollowFmt)
{ {
bool bPlausableTitlePage = true; bool bPlausableSingleWordSection = true;
const SwFmtCol& rFirstCols = rTitleFmt.GetCol(); const SwFmtCol& rFirstCols = rTitleFmt.GetCol();
const SwFmtCol& rFollowCols = rFollowFmt.GetCol(); const SwFmtCol& rFollowCols = rFollowFmt.GetCol();
...@@ -361,21 +360,21 @@ namespace sw ...@@ -361,21 +360,21 @@ namespace sw
if (rFirstColumns.size() != rFollowColumns.size()) if (rFirstColumns.size() != rFollowColumns.size())
{ {
//e.g. #i4320# //e.g. #i4320#
bPlausableTitlePage = false; bPlausableSingleWordSection = false;
} }
else if (rOneLR != rTwoLR) else if (rOneLR != rTwoLR)
bPlausableTitlePage = false; bPlausableSingleWordSection = false;
else if (rFirstFrmSize != rFollowFrmSize) else if (rFirstFrmSize != rFollowFrmSize)
bPlausableTitlePage = false; bPlausableSingleWordSection = false;
else else
{ {
HdFtDistanceGlue aOne(rTitleFmt.GetAttrSet()); HdFtDistanceGlue aOne(rTitleFmt.GetAttrSet());
HdFtDistanceGlue aTwo(rFollowFmt.GetAttrSet()); HdFtDistanceGlue aTwo(rFollowFmt.GetAttrSet());
//e.g. #i14509# //e.g. #i14509#
if (!aOne.EqualTopBottom(aTwo)) if (!aOne.EqualTopBottom(aTwo))
bPlausableTitlePage = false; bPlausableSingleWordSection = false;
} }
return bPlausableTitlePage; return bPlausableSingleWordSection;
} }
HdFtDistanceGlue::HdFtDistanceGlue(const SfxItemSet &rPage) HdFtDistanceGlue::HdFtDistanceGlue(const SfxItemSet &rPage)
......
...@@ -1460,6 +1460,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) ...@@ -1460,6 +1460,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Background_color: case NS_ooxml::LN_CT_Background_color:
m_pImpl->m_oBackgroundColor.reset(nIntValue); m_pImpl->m_oBackgroundColor.reset(nIntValue);
break; break;
case NS_ooxml::LN_CT_PageNumber_start:
if (pSectionContext != NULL)
pSectionContext->SetPageNumber(nIntValue);
break;
default: default:
{ {
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
...@@ -3389,6 +3393,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType ...@@ -3389,6 +3393,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
} }
} }
break; break;
case NS_ooxml::LN_EG_SectPrContents_pgNumType:
{
writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
if( pProperties.get())
{
pProperties->resolve(*this);
}
}
break;
default: default:
{ {
#ifdef DEBUG_DOMAINMAPPER #ifdef DEBUG_DOMAINMAPPER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment