fdo#52208 DOCX import: don't always ignore cont sect break at the doc end
Regression from commit 1fdd61db15
,
continuous section break does make sense at the end of the doc, if the
previous type was a non-continuous.
Change-Id: I6d82c67e068d8dc3ce1edb1a5fe6ad293afd805d
This commit is contained in:
BIN
sw/qa/extras/ooxmlimport/data/fdo52208.docx
Normal file
BIN
sw/qa/extras/ooxmlimport/data/fdo52208.docx
Normal file
Binary file not shown.
@@ -105,6 +105,7 @@ public:
|
|||||||
void testN782061();
|
void testN782061();
|
||||||
void testN782345();
|
void testN782345();
|
||||||
void testN783638();
|
void testN783638();
|
||||||
|
void testFdo52208();
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(Test);
|
CPPUNIT_TEST_SUITE(Test);
|
||||||
#if !defined(MACOSX) && !defined(WNT)
|
#if !defined(MACOSX) && !defined(WNT)
|
||||||
@@ -152,6 +153,7 @@ public:
|
|||||||
CPPUNIT_TEST(testN782061);
|
CPPUNIT_TEST(testN782061);
|
||||||
CPPUNIT_TEST(testN782345);
|
CPPUNIT_TEST(testN782345);
|
||||||
CPPUNIT_TEST(testN783638);
|
CPPUNIT_TEST(testN783638);
|
||||||
|
CPPUNIT_TEST(testFdo52208);
|
||||||
#endif
|
#endif
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
@@ -1090,6 +1092,17 @@ void Test::testN783638()
|
|||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPropertySet, "LeftMargin"));
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPropertySet, "LeftMargin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Test::testFdo52208()
|
||||||
|
{
|
||||||
|
// The problem was that the document had 2 pages instead of 1.
|
||||||
|
load("fdo52208.docx");
|
||||||
|
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
|
||||||
|
uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
|
||||||
|
uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
|
||||||
|
xCursor->jumpToLastPage();
|
||||||
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
|
||||||
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
@@ -2392,9 +2392,17 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
|
|||||||
OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
|
OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
|
||||||
if(pSectionContext)
|
if(pSectionContext)
|
||||||
{
|
{
|
||||||
// Ignore continous section break at the end of the document
|
// Ignore continous section break at the end of the document, if the previous section had the same type as well
|
||||||
// It makes the importer loose margin settings with no benefit
|
// It makes the importer loose margin settings with no benefit
|
||||||
if (m_pImpl->GetParaSectpr() || nIntValue != 0)
|
SectionPropertyMap* pLastContext = m_pImpl->GetLastSectionContext();
|
||||||
|
int nPrevBreakType = 0;
|
||||||
|
bool bHasPrevSection = false;
|
||||||
|
if (pLastContext)
|
||||||
|
{
|
||||||
|
bHasPrevSection = true;
|
||||||
|
nPrevBreakType = pLastContext->GetBreakType();
|
||||||
|
}
|
||||||
|
if (m_pImpl->GetParaSectpr() || nIntValue != 0 || (bHasPrevSection && nPrevBreakType != nIntValue))
|
||||||
pSectionContext->SetBreakType( nIntValue );
|
pSectionContext->SetBreakType( nIntValue );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -235,6 +235,7 @@ public:
|
|||||||
void SetPageNoRestart( bool bSet ) { m_bPageNoRestart = bSet; }
|
void SetPageNoRestart( bool bSet ) { m_bPageNoRestart = bSet; }
|
||||||
void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; }
|
void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; }
|
||||||
void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; }
|
void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; }
|
||||||
|
sal_Int32 GetBreakType( ) { return m_nBreakType; }
|
||||||
void SetPaperBin( sal_Int32 nSet );
|
void SetPaperBin( sal_Int32 nSet );
|
||||||
void SetFirstPaperBin( sal_Int32 nSet );
|
void SetFirstPaperBin( sal_Int32 nSet );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user