diff options
author | Justin Luth <justin_luth@sil.org> | 2021-12-16 15:36:59 +0200 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2021-12-16 16:26:43 +0100 |
commit | 6ce377a649c8db7576dbb7a30949d0f89c08439f (patch) | |
tree | 3bfdec962775f4c3ddf5fff57382354318ba12c6 /sw/source | |
parent | 672c6d74b027fc7731afb959599ffea77d6ae2ba (diff) |
related tdf#90805 sw table: ensure border when setting border color
When using uno:FrameLineColor to set a table's border color,
add hairline borders if there are none at all.
Change-Id: Ib2b2f8aff0052dc32b38486c98670ebff3bd6a4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126923
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/docnode/ndtbl1.cxx | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 964b2cb610f2..d7f3c5419590 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -928,6 +928,8 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoAttrTable>(*pTableNd)); } + const SvxBorderLine aHairlineBorder(pColor, SvxBorderLineWidth::Hairline); + for( auto &rU : aUnions ) { SwSelUnion *pUnion = &rU; @@ -946,24 +948,32 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, SwFrameFormat *pFormat = pCell->GetFormat(); std::unique_ptr<SvxBoxItem> aBox(pFormat->GetBox().Clone()); + SvxBorderLine* pTop = const_cast<SvxBorderLine*>(aBox->GetTop()); + SvxBorderLine* pBot = const_cast<SvxBorderLine*>(aBox->GetBottom()); + SvxBorderLine* pLeft = const_cast<SvxBorderLine*>(aBox->GetLeft()); + SvxBorderLine* pRight = const_cast<SvxBorderLine*>(aBox->GetRight()); + if ( !pBorderLine && bSetLine ) { aBox.reset(::GetDfltAttr(RES_BOX)->Clone()); } + else if (pColor && !pBorderLine && !pTop && !pBot && !pLeft && !pRight) + { + aBox->SetLine(&aHairlineBorder, SvxBoxItemLine::TOP); + aBox->SetLine(&aHairlineBorder, SvxBoxItemLine::BOTTOM); + aBox->SetLine(&aHairlineBorder, SvxBoxItemLine::LEFT); + aBox->SetLine(&aHairlineBorder, SvxBoxItemLine::RIGHT); + } else { - if ( aBox->GetTop() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetTop()), - pColor, pBorderLine ); - if ( aBox->GetBottom() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetBottom()), - pColor, pBorderLine ); - if ( aBox->GetLeft() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetLeft()), - pColor, pBorderLine ); - if ( aBox->GetRight() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetRight()), - pColor, pBorderLine ); + if (pTop) + ::lcl_SetLineStyle(pTop, pColor, pBorderLine); + if (pBot) + ::lcl_SetLineStyle(pBot, pColor, pBorderLine); + if (pLeft) + ::lcl_SetLineStyle(pLeft, pColor, pBorderLine); + if (pRight) + ::lcl_SetLineStyle(pRight, pColor, pBorderLine); } pFormat->SetFormatAttr( *aBox ); } |