Accepting request 613639 from LibreOffice:Factory

OBS-URL: https://build.opensuse.org/request/show/613639
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libreoffice?expand=0&rev=157
This commit is contained in:
Dominique Leuenberger 2018-06-05 10:50:16 +00:00 committed by Git OBS Bridge
commit 0aba88a083
3 changed files with 271 additions and 0 deletions

262
bnc1094359.patch Normal file
View File

@ -0,0 +1,262 @@
From 68dc10a1767d8c555d48699ad6349799b4aea286 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Mon, 16 Apr 2018 10:11:26 +0200
Subject: [PATCH] tdf#117028 sw: conditionally consider fill of shape for
in-textbox auto color
Commit f966767e1ccfa432da33e1a0fd6de69e17a36bc3 (tdf#116925 sw: consider
fill styles of shape for in-textbox auto color, 2018-04-10) did this
unconditionally, but there are two cases:
1) Shape (with textbox) has a fill, in that case auto text color of
textbox should consider the shape fill.
2) Shape has no fill, in that case the shape fill should not be
considered when counting the background of a transparent fly frame.
Fix 2) without breaking 1) by making the change to
SwFrame::GetBackgroundBrush() opt-in, and only use it for auto font
color, not in other cases.
Change-Id: I761a1b7d6ecf47586edbe5641ec012f22f6a53d7
Reviewed-on: https://gerrit.libreoffice.org/52941
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit d9420a64fbb288020d33b681f40a858db49afca7)
Reviewed-on: https://gerrit.libreoffice.org/52972
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 15593a5421a7f14ac8a4056aa233443130bcda6f)
---
sw/qa/extras/layout/data/tdf117028.docx | Bin 0 -> 13619 bytes
sw/qa/extras/layout/layout.cxx | 24 ++++++++++++++++++++++++
sw/source/core/access/accpara.cxx | 2 +-
sw/source/core/doc/notxtfrm.cxx | 2 +-
sw/source/core/inc/frame.hxx | 3 ++-
sw/source/core/layout/paintfrm.cxx | 23 ++++++++++++++---------
sw/source/core/text/inftxt.cxx | 2 +-
sw/source/core/txtnode/fntcache.cxx | 2 +-
8 files changed, 44 insertions(+), 14 deletions(-)
create mode 100644 sw/qa/extras/layout/data/tdf117028.docx
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 0d60a9d09af3..83527b5102c3 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -998,7 +998,7 @@ static bool lcl_GetBackgroundColor( Color & rColor,
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 4a5176d50e6b..fd21b43bb3c7 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -187,7 +187,7 @@ static void lcl_ClearArea( const SwFrame &rFrame,
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 ca26c68bcc15..71363e95e2b1 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -555,7 +555,8 @@ public:
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 4c54017b14b7..fedcd36f2266 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3783,7 +3783,7 @@ bool SwFlyFrame::IsBackgroundTransparent() const
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 @@ void SwFrame::PaintBackground( const SwRect &rRect, const SwPageFrame *pPage,
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 @@ void SwFrame::PaintBackground( const SwRect &rRect, const SwPageFrame *pPage,
// <GetBackgroundBrush> disabled this option with the parameter <bLowerMode>
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 <pItem> with global retouche color and set <bBack>
@@ -7164,7 +7164,7 @@ const Color SwPageFrame::GetDrawBackgrdColor() const
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 @@ void SwFrame::Retouch( const SwPageFrame * pPage, const SwRect &rRect ) const
* 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 @@ bool SwFrame::GetBackgroundBrush(
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 @@ bool SwFrame::GetBackgroundBrush(
if (pFrame->supportsFullDrawingLayerFillAttributeSet())
{
- bool bTextBox = false;
- if (pFrame->IsFlyFrame())
+ bool bHandledTextBox = false;
+ if (pFrame->IsFlyFrame() && bConsiderTextBox)
{
const SwFlyFrame* pFlyFrame = static_cast<const SwFlyFrame*>(pFrame);
SwFrameFormat* pShape
@@ -7364,12 +7369,12 @@ bool SwFrame::GetBackgroundBrush(
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 de131470c958..8001e94143c4 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -534,7 +534,7 @@ static bool lcl_IsDarkBackground( const SwTextPaintInfo& rInf )
// 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 a7484a5ac4a7..a6d89f1add2a 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2510,7 +2510,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
/// 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/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index b6c11b58c603..6830e9db71b1 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1065,10 +1065,12 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
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 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
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 dfbdce3021bb..ca5014f7e9b5 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -32,6 +32,8 @@
#include <IDocumentState.hxx>
#include <txtfly.hxx>
#include <viewimp.hxx>
+#include <textboxhelper.hxx>
+#include <unomid.h>
using namespace ::com::sun::star;
@@ -661,9 +663,22 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified();
pDoc->getIDocumentState().SetEnableSetModified(false);
- const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(),
+ auto pObject = const_cast<SdrObject*>(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<drawing::XShape> xShape(pObject->getUnoShape(), uno::UNO_QUERY);
+ SwTextBoxHelper::syncProperty(pFrameFormat, RES_FRM_SIZE, MID_FRMSIZE_SIZE,
+ uno::makeAny(xShape->getSize()));
+ }
+ }
+
pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
}
}

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu May 31 10:29:55 UTC 2018 - andras.timar@collabora.com
- bnc#1094359 LO-L3: LO Writer: Text in boxes not visible
* bnc1094359.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu May 17 05:25:15 UTC 2018 - bosim@opensuse.org Thu May 17 05:25:15 UTC 2018 - bosim@opensuse.org

View File

@ -109,6 +109,8 @@ Patch7: bnc1039203.patch
Patch8: bnc1060128.patch Patch8: bnc1060128.patch
# PATCH-FROM-UPSTREAM fix build with new icu # PATCH-FROM-UPSTREAM fix build with new icu
Patch9: libreoffice-icu61.patch Patch9: libreoffice-icu61.patch
# LO-L3: LO Writer: Text in boxes not visible
Patch10: bnc1094359.patch
# try to save space by using hardlinks # try to save space by using hardlinks
Patch990: install-with-hardlinks.diff Patch990: install-with-hardlinks.diff
BuildRequires: %{name}-share-linker BuildRequires: %{name}-share-linker
@ -916,6 +918,7 @@ Provides additional %{langname} translations and resources for %{project}. \
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
%patch9 -p1 %patch9 -p1
%patch10 -p1
%patch990 -p1 %patch990 -p1
# Disable some of the failing tests (some are random) # Disable some of the failing tests (some are random)