diff --git a/bnc1083525.patch b/bnc1083525.patch new file mode 100644 index 0000000..fe06623 --- /dev/null +++ b/bnc1083525.patch @@ -0,0 +1,294 @@ +diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx +index 708b80a..af4133a 100644 +--- a/writerfilter/source/dmapper/PropertyMap.cxx ++++ b/writerfilter/source/dmapper/PropertyMap.cxx +@@ -1148,6 +1148,10 @@ + std::vector& rAnchoredObjectAnchors = rDM_Impl.m_aAnchoredObjectAnchors; + for (auto& rAnchor : rAnchoredObjectAnchors) + { ++ // Ignore this paragraph when there is a single shape only. ++ if (rAnchor.m_aAnchoredObjects.size() < 2) ++ continue; ++ + // Analyze the anchored objects of this paragraph, now that we know the + // page width. + sal_Int32 nShapesWidth = 0; +diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx +index 9ace671..80d12a5 100644 +--- a/sw/source/core/layout/paintfrm.cxx ++++ b/sw/source/core/layout/paintfrm.cxx +@@ -6412,7 +6412,9 @@ + if( IsTextFrame() || IsSctFrame() ) + aPaintRect = UnionFrame( true ); + +- if ( (!bOnlyTextBackground || IsTextFrame()) && aPaintRect.IsOver( rRect ) ) ++ // bOnlyTextBackground means background that's on top of background shapes, ++ // this includes both text and cell frames. ++ if ( (!bOnlyTextBackground || IsTextFrame() || IsCellFrame()) && aPaintRect.IsOver( rRect ) ) + { + if ( bBack || bPageFrame || !bLowerMode ) + { +diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx +index 80d12a5..4c54017 100644 +--- a/sw/source/core/layout/paintfrm.cxx ++++ b/sw/source/core/layout/paintfrm.cxx +@@ -100,6 +100,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -7347,7 +7348,30 @@ + return false; + + if (pFrame->supportsFullDrawingLayerFillAttributeSet()) +- rFillAttributes = pFrame->getSdrAllFillAttributesHelper(); ++ { ++ bool bTextBox = false; ++ if (pFrame->IsFlyFrame()) ++ { ++ const SwFlyFrame* pFlyFrame = static_cast(pFrame); ++ SwFrameFormat* pShape ++ = SwTextBoxHelper::getOtherTextBoxFormat(pFlyFrame->GetFormat(), RES_FLYFRMFMT); ++ if (pShape) ++ { ++ SdrObject* pObject = pShape->FindRealSdrObject(); ++ if (pObject) ++ { ++ // Work with the fill attributes of the shape of the fly frame. ++ rFillAttributes.reset( ++ new drawinglayer::attribute::SdrAllFillAttributesHelper( ++ pObject->GetMergedItemSet())); ++ bTextBox = true; ++ } ++ } ++ } ++ ++ if (!bTextBox) ++ rFillAttributes = pFrame->getSdrAllFillAttributesHelper(); ++ } + const SvxBrushItem &rBack = pFrame->GetAttrSet()->GetBackground(); + + if( pFrame->IsSctFrame() ) +diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx +index b6c11b5..6830e9d 100644 +--- a/writerfilter/source/dmapper/GraphicImport.cxx ++++ b/writerfilter/source/dmapper/GraphicImport.cxx +@@ -1065,10 +1065,12 @@ + break; + case NS_ooxml::LN_CT_SizeRelH_pctWidth: + case NS_ooxml::LN_CT_SizeRelV_pctHeight: +- if (m_xShape.is() && !m_pImpl->m_rPositivePercentages.empty()) ++ if (m_pImpl->m_rPositivePercentages.empty()) ++ break; ++ ++ if (m_xShape.is()) + { + sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / oox::drawingml::PER_PERCENT); +- m_pImpl->m_rPositivePercentages.pop(); + + if (nPositivePercentage) + { +@@ -1077,6 +1079,10 @@ + xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage)); + } + } ++ ++ // Make sure the token is consumed even if xShape is an empty ++ // reference. ++ m_pImpl->m_rPositivePercentages.pop(); + break; + case NS_ooxml::LN_EG_WrapType_wrapNone: // 90944; - doesn't contain attributes + //depending on the behindDoc attribute text wraps through behind or in front of the object +diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx +index dfbdce3..ca5014f 100644 +--- a/sw/source/core/layout/anchoreddrawobject.cxx ++++ b/sw/source/core/layout/anchoreddrawobject.cxx +@@ -32,6 +32,8 @@ + #include + #include + #include ++#include ++#include + + using namespace ::com::sun::star; + +@@ -661,9 +663,22 @@ + + bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified(); + pDoc->getIDocumentState().SetEnableSetModified(false); +- const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(), ++ auto pObject = const_cast(GetDrawObj()); ++ pObject->Resize( aCurrObjRect.TopLeft(), + Fraction( nTargetWidth, aCurrObjRect.GetWidth() ), + Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false ); ++ ++ if (SwFrameFormat* pFrameFormat = FindFrameFormat(pObject)) ++ { ++ if (SwTextBoxHelper::isTextBox(pFrameFormat, RES_DRAWFRMFMT)) ++ { ++ // Shape has relative size and also a textbox, update its text area as well. ++ uno::Reference xShape(pObject->getUnoShape(), uno::UNO_QUERY); ++ SwTextBoxHelper::syncProperty(pFrameFormat, RES_FRM_SIZE, MID_FRMSIZE_SIZE, ++ uno::makeAny(xShape->getSize())); ++ } ++ } ++ + pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified); + } + } +diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx +index 0d60a9d..83527b5 100644 +--- a/sw/source/core/access/accpara.cxx ++++ b/sw/source/core/access/accpara.cxx +@@ -998,7 +998,7 @@ + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; + + if ( pFrame && +- pFrame->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false ) ) ++ pFrame->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false, /*bConsiderTextBox=*/false ) ) + { + if ( pSectionTOXColor ) + { +diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx +index 4a5176d..fd21b43 100644 +--- a/sw/source/core/doc/notxtfrm.cxx ++++ b/sw/source/core/doc/notxtfrm.cxx +@@ -187,7 +187,7 @@ + SwRect aOrigRect; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; + +- if ( rFrame.GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigRect, false ) ) ++ if ( rFrame.GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigRect, false, /*bConsiderTextBox=*/false ) ) + { + SwRegionRects const region(rPtArea); + basegfx::utils::B2DClipState aClipState; +diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx +index 25b65a9..bb5d731 100644 +--- a/sw/source/core/inc/frame.hxx ++++ b/sw/source/core/inc/frame.hxx +@@ -555,7 +555,8 @@ + const SvxBrushItem*& rpBrush, + const Color*& rpColor, + SwRect &rOrigRect, +- bool bLowerMode ) const; ++ bool bLowerMode, ++ bool bConsiderTextBox ) const; + + inline void SetCompletePaint() const; + inline void ResetCompletePaint() const; +diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx +index 4c54017..fedcd36 100644 +--- a/sw/source/core/layout/paintfrm.cxx ++++ b/sw/source/core/layout/paintfrm.cxx +@@ -3783,7 +3783,7 @@ + SwRect aDummyRect; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; + +- if ( GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false) ) ++ if ( GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false, /*bConsiderTextBox=*/false) ) + { + if ( pSectionTOXColor && + (pSectionTOXColor->GetTransparency() != 0) && +@@ -6364,7 +6364,7 @@ + bool bLowMode = true; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; + +- bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode ); ++ bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode, /*bConsiderTextBox=*/false ); + //- Output if a separate background is used. + bool bNoFlyBackground = !gProp.bSFlyMetafile && !bBack && IsFlyFrame(); + if ( bNoFlyBackground ) +@@ -6374,7 +6374,7 @@ + // disabled this option with the parameter + if ( bLowerMode ) + { +- bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false ); ++ bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false, /*bConsiderTextBox=*/false ); + } + // If still no background found for the fly frame, initialize the + // background brush with global retouche color and set +@@ -7164,7 +7164,7 @@ + SwRect aDummyRect; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; + +- if ( GetBackgroundBrush( aFillAttributes, pBrushItem, pDummyColor, aDummyRect, true) ) ++ if ( GetBackgroundBrush( aFillAttributes, pBrushItem, pDummyColor, aDummyRect, true, /*bConsiderTextBox=*/false) ) + { + if(aFillAttributes.get() && aFillAttributes->isUsed()) + { +@@ -7328,6 +7328,10 @@ + * input parameter - boolean indicating, if background brush should *not* be + * taken from parent. + * ++ * @param bConsiderTextBox ++ * consider the TextBox of this fly frame (if there is any) when determining ++ * the background color, useful for automatic font color. ++ * + * @return true, if a background brush for the frame is found + */ + bool SwFrame::GetBackgroundBrush( +@@ -7335,7 +7339,8 @@ + const SvxBrushItem* & rpBrush, + const Color*& rpCol, + SwRect &rOrigRect, +- bool bLowerMode ) const ++ bool bLowerMode, ++ bool bConsiderTextBox ) const + { + const SwFrame *pFrame = this; + SwViewShell *pSh = getRootFrame()->GetCurrShell(); +@@ -7349,8 +7354,8 @@ + + if (pFrame->supportsFullDrawingLayerFillAttributeSet()) + { +- bool bTextBox = false; +- if (pFrame->IsFlyFrame()) ++ bool bHandledTextBox = false; ++ if (pFrame->IsFlyFrame() && bConsiderTextBox) + { + const SwFlyFrame* pFlyFrame = static_cast(pFrame); + SwFrameFormat* pShape +@@ -7364,12 +7369,12 @@ + rFillAttributes.reset( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + pObject->GetMergedItemSet())); +- bTextBox = true; ++ bHandledTextBox = true; + } + } + } + +- if (!bTextBox) ++ if (!bHandledTextBox) + rFillAttributes = pFrame->getSdrAllFillAttributesHelper(); + } + const SvxBrushItem &rBack = pFrame->GetAttrSet()->GetBackground(); +diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx +index de13147..8001e94 100644 +--- a/sw/source/core/text/inftxt.cxx ++++ b/sw/source/core/text/inftxt.cxx +@@ -534,7 +534,7 @@ + // See implementation in /core/layout/paintfrm.cxx + // There is a background color, if there is a background brush and + // its color is *not* "no fill"/"auto fill". +- if( rInf.GetTextFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false ) ) ++ if( rInf.GetTextFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false, /*bConsiderTextBox=*/false ) ) + { + if ( !pCol ) + pCol = &pItem->GetColor(); +diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx +index a7484a5..a6d89f1 100644 +--- a/sw/source/core/txtnode/fntcache.cxx ++++ b/sw/source/core/txtnode/fntcache.cxx +@@ -2510,7 +2510,7 @@ + /// OD 21.08.2002 #99657# + /// There is a user defined setting for the background, if there + /// is a background brush and its color is *not* "no fill"/"auto fill". +- if( GetFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false ) ) ++ if( GetFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false, /*bConsiderTextBox=*/true ) ) + { + if (aFillAttributes.get() && aFillAttributes->isUsed()) + { diff --git a/libreoffice.changes b/libreoffice.changes index b29edbd..7169f0f 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -10,6 +10,12 @@ Fri Apr 20 08:52:11 UTC 2018 - tchvatal@suse.com - Version update to 6.0.4.1: * Another bugfix update containing >60 bugfixes +------------------------------------------------------------------- +Tue Apr 17 10:32:11 UTC 2018 - andras.timar@collabora.com + +- LO-L3: DOCX import: missing table background color + * bnc1083525.patch + ------------------------------------------------------------------- Tue Apr 17 09:26:37 UTC 2018 - tchvatal@suse.com @@ -115,7 +121,7 @@ Thu Mar 22 11:46:48 UTC 2018 - tchvatal@suse.com Wed Mar 14 09:30:47 UTC 2018 - tchvatal@suse.com - Require liberation-fonts instead of Recommends wrt bsc#1083213 - * Basically we need ANY font, but liberation-fonts are the + * Basically we need ANY font, but liberation-fonts are the Arial/etc. compatible and thus you can view the MS Word documents - Drop Build/Require on xorg-x11-fonts diff --git a/libreoffice.spec b/libreoffice.spec index 159c5a8..3324beb 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -107,8 +107,10 @@ Patch5: 0001-Use-PYTHON_FOR_BUILD-instead-of-calling-python-direc.patch Patch7: bnc1039203.patch # LO-L3: Slide with chart has some strange (too large?) elements (PPTX) Patch8: bnc1060128.patch +# LO-L3: DOCX import: missing table background color +Patch9: bnc1083525.patch # PATCH-FROM-UPSTREAM fix build with new icu -Patch9: libreoffice-icu61.patch +Patch10: libreoffice-icu61.patch # try to save space by using hardlinks Patch990: install-with-hardlinks.diff BuildRequires: %{name}-share-linker @@ -911,6 +913,7 @@ Provides additional %{langname} translations and resources for %{project}. \ %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %patch990 -p1 # Disable some of the failing tests (some are random)