sw/qa/extras/ooxmlimport/data/fdo68607.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 ++++++++++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 15 ++++++++++++++- writerfilter/source/dmapper/PropertyMap.cxx | 5 +++++ writerfilter/source/dmapper/PropertyMap.hxx | 3 +++ 5 files changed, 32 insertions(+), 1 deletion(-)
New commits: commit 45ea0b563bbc3e8830c485e7d04aa98a52a1e2fc Author: Miklos Vajna <vmik...@suse.cz> Date: Tue Sep 3 11:52:51 2013 +0200 fdo#68607 bnc#816593 DomainMapperTableHandler: don't always start a frame This is a port of commit 8fe8bd6c3b5b1a539b7370f8c457fa69c061d2de "Related: fdo#61594 SwWW8ImplReader::StartApo: don't always start a frame" from the WW8 filter to the DOCX one. (regression from edc4861a68e0269b83b17e0ec57912a1ce4220ad) (cherry picked from commit 78d1f1c2835b9fae0f91ed771fc1d594c7817502) Change-Id: If1bb4a8a3786aacd618585cf859b57ce9be85c51 Reviewed-on: https://gerrit.libreoffice.org/5788 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/ooxmlimport/data/fdo68607.docx b/sw/qa/extras/ooxmlimport/data/fdo68607.docx new file mode 100644 index 0000000..11f5706 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo68607.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 5223c87..af5a3f2 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -131,6 +131,7 @@ public: void testTableAutoNested(); void testTableStyleParprop(); void testTablePagebreak(); + void testFdo68607(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -227,6 +228,7 @@ void Test::run() {"table-auto-nested.docx", &Test::testTableAutoNested}, {"table-style-parprop.docx", &Test::testTableStyleParprop}, {"table-pagebreak.docx", &Test::testTablePagebreak}, + {"fdo68607.docx", &Test::testFdo68607}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1605,6 +1607,14 @@ void Test::testTablePagebreak() CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, getProperty<style::BreakType>(getParagraph(3), "BreakType")); } +void Test::testFdo68607() +{ + // Bugdoc was 8 pages in Word, 1 in Writer due to pointlessly wrapping the + // table in a frame. Exact layout may depend on fonts available, etc. -- + // but at least make sure that our table spans over multiple pages now. + CPPUNIT_ASSERT(getPages() > 1); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index d7d498a..7d5c44e 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -816,7 +816,20 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) { uno::Reference<text::XTextRange> xStart; uno::Reference<text::XTextRange> xEnd; - bool bFloating = aFrameProperties.hasElements(); + + bool bNoFly = false; + if (SectionPropertyMap* pSectionContext = m_rDMapper_Impl.GetSectionContext()) + { + sal_Int32 nTextAreaWidth = pSectionContext->GetPageWidth() - pSectionContext->GetLeftMargin() - pSectionContext->GetRightMargin(); + sal_Int32 nTableWidth = 0; + m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); + // If the table is wider than the text area, then don't create a fly + // for the table: no wrapping will be performed anyway, but multi-page + // tables will be broken. + bNoFly = nTableWidth >= nTextAreaWidth; + } + + bool bFloating = aFrameProperties.hasElements() && !bNoFly; // Additional checks: if we can do this. if (bFloating && (*m_pTableSeq)[0].getLength() > 0 && (*m_pTableSeq)[0][0].getLength() > 0) { diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 623c20c8..21974a4 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1169,6 +1169,11 @@ void SectionPropertyMap::SetFirstPaperBin( sal_Int32 nSet ) } +sal_Int32 SectionPropertyMap::GetPageWidth() +{ + return operator[](PropertyDefinition(PROP_WIDTH, false)).get<sal_Int32>(); +} + StyleSheetPropertyMap::StyleSheetPropertyMap() : mnCT_Spacing_line( 0 ), mnCT_Spacing_lineRule( 0 ), diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index a79c2c2..fb4e4ad 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -240,11 +240,14 @@ public: void SetFirstPaperBin( sal_Int32 nSet ); void SetLeftMargin( sal_Int32 nSet ) { m_nLeftMargin = nSet; } + sal_Int32 GetLeftMargin() { return m_nLeftMargin; } void SetRightMargin( sal_Int32 nSet ) { m_nRightMargin = nSet; } + sal_Int32 GetRightMargin() { return m_nRightMargin; } void SetTopMargin( sal_Int32 nSet ) { m_nTopMargin = nSet; } void SetBottomMargin( sal_Int32 nSet ) { m_nBottomMargin = nSet; } void SetHeaderTop( sal_Int32 nSet ) { m_nHeaderTop = nSet; } void SetHeaderBottom( sal_Int32 nSet ) { m_nHeaderBottom = nSet; } + sal_Int32 GetPageWidth(); void SetGutterRTL( bool bSet ) { m_bGutterRTL = bSet;} void SetDzaGutter( sal_Int32 nSet ) {m_nDzaGutter = nSet; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits