diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-09-03 11:52:51 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-09-03 12:13:03 +0200 |
commit | 78d1f1c2835b9fae0f91ed771fc1d594c7817502 (patch) | |
tree | 0b968a1e9f0b8d3180ac229ab3d42a445e28133f /writerfilter | |
parent | warning C4702: unreachable code (diff) | |
download | core-78d1f1c2835b9fae0f91ed771fc1d594c7817502.tar.gz core-78d1f1c2835b9fae0f91ed771fc1d594c7817502.zip |
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)
Change-Id: If1bb4a8a3786aacd618585cf859b57ce9be85c51
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 15 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 3 |
3 files changed, 22 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 250ea42ad0c5..b32351ac3c80 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -823,7 +823,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 5507109e1913..d4cbbf2d89cb 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1203,6 +1203,11 @@ void SectionPropertyMap::SetFirstPaperBin( sal_Int32 nSet ) } +sal_Int32 SectionPropertyMap::GetPageWidth() +{ + return operator[](PropertyDefinition(PROP_WIDTH)).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 da597287dbd3..f8a4a3fd8bb6 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -241,11 +241,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; } |