summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlimport/data/fdo55381.docxbin0 -> 4710 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx9
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx12
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx19
4 files changed, 33 insertions, 7 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/fdo55381.docx b/sw/qa/extras/ooxmlimport/data/fdo55381.docx
new file mode 100644
index 000000000000..ffeae1f874eb
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/fdo55381.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index f727d6f0af86..2f1f0cdb5c82 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2056,6 +2056,15 @@ DECLARE_OOXMLIMPORT_TEST(testFdo75722dml, "fdo75722-dml.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int64(3128), nRot);
}
+DECLARE_OOXMLIMPORT_TEST(testFdo55381, "fdo55381.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(4), xCursor->getPage());
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index cb2c8f73a6e5..c73e14ceb80d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2458,6 +2458,18 @@ void DomainMapper::lcl_endSectionGroup()
{
m_pImpl->CheckUnregisteredFrameConversion();
m_pImpl->ExecuteFrameConversion();
+ if(m_pImpl->GetIsFirstParagraphInSection())
+ {
+ // This section has no paragraph at all (e.g. they are all actually in a frame).
+ // If this section has a page break, there would be nothing to apply to the page
+ // style, so force a dummy paragraph.
+ lcl_startParagraphGroup();
+ lcl_startCharacterGroup();
+ sal_uInt8 sBreak[] = { 0xd };
+ lcl_text(sBreak, 1);
+ lcl_endCharacterGroup();
+ lcl_endParagraphGroup();
+ }
PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_SECTION);
SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() );
OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3a6dfef31389..88bcabddb47a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1105,12 +1105,6 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY );
CheckParaMarkerRedline( xParaEnd );
- m_bIsFirstParaInSection = false;
- m_bIsLastParaInSection = false;
- m_bParaChanged = false;
-
- // Reset the frame properties for the next paragraph
- pParaContext->ResetFrameProperties();
}
if( !bKeepLastParagraphProperties )
rAppendContext.pLastParagraphProperties = pToBeSavedProperties;
@@ -1119,11 +1113,22 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
{
OSL_FAIL( "IllegalArgumentException in DomainMapper_Impl::finishParagraph" );
}
- catch(const uno::Exception&)
+ catch(const uno::Exception& e)
{
+ SAL_WARN( "writerfilter", "finishParagraph() exception: " << e.Message );
}
}
+ m_bParaChanged = false;
+ if(!pParaContext->IsFrameMode())
+ { // If the paragraph is in a frame, it's not a paragraph of the section itself.
+ m_bIsFirstParaInSection = false;
+ m_bIsLastParaInSection = false;
+ }
+
+ // Reset the frame properties for the next paragraph
+ pParaContext->ResetFrameProperties();
+
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->endElement();
#endif