[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 5 10:54:40 UTC 2020
sw/inc/swtable.hxx | 4 +++-
sw/inc/tblsel.hxx | 8 ++++++--
sw/source/core/doc/gctable.cxx | 15 +++++++++++++++
sw/source/core/docnode/node.cxx | 2 ++
4 files changed, 26 insertions(+), 3 deletions(-)
New commits:
commit e65b1ba0033e1adaa4135539bb7b34b28cbedd7c
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 1 17:29:06 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Oct 5 12:54:09 2020 +0200
sw: SwTable::GCLines(): don't throw away row background
If there's a row background, and a cell in the row doesn't override it,
apply the row background to the cell.
Change-Id: I37cd33249d3ab66c898c537e3bc6bab067d6f74b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103772
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx
index 355eb70538dd..7f428dee033c 100644
--- a/sw/source/core/doc/gctable.cxx
+++ b/sw/source/core/doc/gctable.cxx
@@ -360,6 +360,21 @@ static bool lcl_MergeGCBox(SwTableBox* pTableBox, GCLinePara* pPara)
for( auto pTabBox : pCpyLine->GetTabBoxes() )
pTabBox->SetUpper( pInsLine );
+ SfxPoolItem const* pRowBrush(nullptr);
+ pCpyLine->GetFrameFormat()->GetItemState(RES_BACKGROUND, true, &pRowBrush);
+ if (pRowBrush)
+ {
+ for (auto pBox : pCpyLine->GetTabBoxes())
+ {
+ SfxPoolItem const* pCellBrush(nullptr);
+ if (pBox->GetFrameFormat()->GetItemState(RES_BACKGROUND, true, &pCellBrush) != SfxItemState::SET)
+ { // set inner row background on inner cell
+ pBox->ClaimFrameFormat();
+ pBox->GetFrameFormat()->SetFormatAttr(*pRowBrush);
+ }
+ }
+ }
+
// remove the old box from its parent line
it = pInsLine->GetTabBoxes().erase( it );
// insert the nested line's boxes in its place
commit 309868c32f00e5ca045f941deafb5216aad2538c
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Oct 1 17:26:43 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Oct 5 12:53:55 2020 +0200
sw: improve comments, dump rowspan to nodes.xml
Change-Id: Ifcd011f6d55ac534c449050d07009680dcd71d51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103771
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index bb43c2e86388..66a1795ce183 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -310,7 +310,9 @@ public:
// Search in format for registered table.
static SwTable * FindTable( SwFrameFormat const*const pFormat );
- // Clean up structure a bit.
+ // Clean up structure of subtables a bit:
+ // convert row with 1 box with subtable; box with subtable with 1 row;
+ // by removing the subtable (both recursively)
void GCLines();
// Returns the table node via m_TabSortContentBoxes or pTableNode.
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx
index 4d929ba224a7..35f88cb9bb54 100644
--- a/sw/inc/tblsel.hxx
+++ b/sw/inc/tblsel.hxx
@@ -160,8 +160,8 @@ class FndBox_
FndLines_t m_Lines;
FndLine_* m_pUpper;
- SwTableLine *m_pLineBefore; // For deleting/restoring the layout.
- SwTableLine *m_pLineBehind;
+ SwTableLine *m_pLineBefore; ///< For deleting/restoring the layout.
+ SwTableLine *m_pLineBehind; ///< For deleting/restoring the layout.
FndBox_(FndBox_ const&) = delete;
FndBox_& operator=(FndBox_ const&) = delete;
@@ -224,6 +224,10 @@ struct FndPara
: rBoxes(rPara.rBoxes), pFndLine(pFL), pFndBox(rPara.pFndBox) {}
};
+/** This creates a structure mirroring the SwTable structure that contains all
+ rows and non-leaf boxes (as pointers to SwTableBox/SwTableLine, not copies),
+ plus the leaf boxes that are selected by pFndPara->rBoxes
+ */
SW_DLLPUBLIC void ForEach_FndLineCopyCol(SwTableLines& rLines, FndPara* pFndPara );
#endif // INCLUDED_SW_INC_TBLSEL_HXX
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 94beca340c78..b65b45fe5196 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1028,6 +1028,8 @@ void SwStartNode::dumpAsXml(xmlTextWriterPtr pWriter) const
}
else if (GetStartNodeType() == SwTableBoxStartNode)
{
+ if (SwTableBox* pBox = GetTableBox())
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), BAD_CAST(OString::number(pBox->getRowSpan()).getStr()));
xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
if (SwTableBox* pBox = GetTableBox())
pBox->GetFrameFormat()->GetAttrSet().dumpAsXml(pWriter);
More information about the Libreoffice-commits
mailing list