tdf#82504 writer table cell background color SvxColorItem uno function
Current background color function only sets table cell background when
multiple table cells are selected. Paragraph background is otherwise
set. This gives expected results for use in sidebar Paragraph panel when
multiple table cells are not selected but unexpected results when
multiple table cells are selected. For background setting from the table
tool bar unexpected paragraph background color is set when multiple
cells are not selected.
This fix creates a table cell background color uno command specific for
setting table cell background color.
Change-Id: Ic56723b635252415d932c5499f996c3e46eee13b
Reviewed-on: https://gerrit.libreoffice.org/65591
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <tietze.heiko@gmail.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0ec67bc..d407b2a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1902,6 +1902,7 @@
OUString(".uno:AlignRight"),
OUString(".uno:BackColor"),
OUString(".uno:BackgroundColor"),
OUString(".uno:TableCellBackgroundColor"),
OUString(".uno:Bold"),
OUString(".uno:CenterPara"),
OUString(".uno:CharBackColor"),
diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt
index 974c73b..24d7e14 100644
--- a/icon-themes/breeze/links.txt
+++ b/icon-themes/breeze/links.txt
@@ -579,6 +579,8 @@
cmd/sc_characterbackgroundpattern.png cmd/sc_backcolor.png
cmd/lc_characterbackgroundpattern.png cmd/lc_backcolor.png
cmd/lc_backgroundpatterncontroller.png cmd/lc_backgroundcolor.png
cmd/sc_tablecellbackgroundcolor.png cmd/sc_backgroundcolor.png
cmd/lc_tablecellbackgroundcolor.png cmd/lc_backgroundcolor.png
# Paragraph Alignment
cmd/lc_leftpara.png cmd/lc_alignleft.png
diff --git a/icon-themes/colibre/links.txt b/icon-themes/colibre/links.txt
index 1e94f81..d02b550 100644
--- a/icon-themes/colibre/links.txt
+++ b/icon-themes/colibre/links.txt
@@ -567,6 +567,8 @@
cmd/sc_characterbackgroundpattern.png cmd/sc_backcolor.png
cmd/lc_characterbackgroundpattern.png cmd/lc_backcolor.png
cmd/lc_backgroundpatterncontroller.png cmd/lc_backgroundcolor.png
cmd/sc_tablecellbackgroundcolor.png cmd/sc_backgroundcolor.png
cmd/lc_tablecellbackgroundcolor.png cmd/lc_backgroundcolor.png
# Paragraph Alignment
cmd/lc_leftpara.png cmd/lc_alignleft.png
diff --git a/icon-themes/elementary/links.txt b/icon-themes/elementary/links.txt
index 21c7cce..189a3f3 100644
--- a/icon-themes/elementary/links.txt
+++ b/icon-themes/elementary/links.txt
@@ -877,18 +877,21 @@
cmd/32/fontcolor.png cmd/32/color.png
cmd/32/formatarea.png cmd/32/backgroundcolor.png
cmd/32/settabbgcolor.png cmd/32/backgroundcolor.png
cmd/32/tablecellbackgroundcolor.png cmd/32/backgroundcolor.png
cmd/lc_backgroundpatterncontroller.png cmd/lc_backgroundcolor.png
cmd/lc_characterbackgroundpattern.png cmd/lc_backcolor.png
cmd/lc_fontcolor.png cmd/lc_color.png
cmd/lc_formatarea.png cmd/lc_backgroundcolor.png
cmd/lc_settabbgcolor.png cmd/lc_backgroundcolor.png
cmd/lc_tablecellbackgroundcolor.png cmd/lc_backgroundcolor.png
cmd/sc_backgroundpatterncontroller.png cmd/sc_backgroundcolor.png
cmd/sc_characterbackgroundpattern.png cmd/sc_backcolor.png
cmd/sc_fontcolor.png cmd/sc_color.png
cmd/sc_formatarea.png cmd/sc_backgroundcolor.png
cmd/sc_settabbgcolor.png cmd/sc_backgroundcolor.png
cmd/sc_tablecellbackgroundcolor.png cmd/sc_backgroundcolor.png
# Paragraph Alignment
cmd/32/leftpara.png cmd/32/alignleft.png
diff --git a/icon-themes/karasa_jaga/links.txt b/icon-themes/karasa_jaga/links.txt
index 3d1c124..beaa91c 100644
--- a/icon-themes/karasa_jaga/links.txt
+++ b/icon-themes/karasa_jaga/links.txt
@@ -292,6 +292,7 @@
cmd/32/stylewatercanmode cmd/32/styleapply.png
cmd/32/symbolcatalogue.png cmd/32/insertsymbol.png
cmd/32/symbolshapes.png cmd/32/symbolshapes.smiley.png
cmd/32/tablecellbackgroundcolor.png cmd/32/backgroundcolor.png
cmd/32/tableevents.png cmd/32/animationeffects.png
cmd/32/tableselectall.png cmd/32/selecttable.png
cmd/32/tablesort.png cmd/32/datasort.png
@@ -619,6 +620,7 @@
cmd/lc_stylewatercanmode cmd/lc_styleapply.png
cmd/lc_symbolcatalogue.png cmd/lc_insertsymbol.png
cmd/lc_symbolshapes.png cmd/lc_symbolshapes.smiley.png
cmd/lc_tablecellbackgroundcolor.png cmd/lc_backgroundcolor.png
cmd/lc_tableevents.png cmd/lc_animationeffects.png
cmd/lc_tableselectall.png cmd/lc_selecttable.png
cmd/lc_tablesort.png cmd/lc_datasort.png
@@ -911,6 +913,7 @@
cmd/sc_stylewatercanmode cmd/sc_styleapply.png
cmd/sc_symbolcatalogue.png cmd/sc_insertsymbol.png
cmd/sc_symbolshapes.png cmd/sc_symbolshapes.smiley.png
cmd/sc_tablecellbackgroundcolor.png cmd/sc_backgroundcolor.png
cmd/sc_tableevents.png cmd/sc_animationeffects.png
cmd/sc_tableselectall.png cmd/sc_selecttable.png
cmd/sc_tablesort.png cmd/sc_datasort.png
diff --git a/icon-themes/sifr/links.txt b/icon-themes/sifr/links.txt
index 7551f7d..474664f 100644
--- a/icon-themes/sifr/links.txt
+++ b/icon-themes/sifr/links.txt
@@ -77,6 +77,8 @@
# Colors (fontcolor is used in writer's formatting toolbar)
cmd/lc_fontcolor.png cmd/lc_color.png
cmd/sc_fontcolor.png cmd/sc_color.png
cmd/sc_tablecellbackgroundcolor.png cmd/sc_backgroundcolor.png
cmd/lc_tablecellbackgroundcolor.png cmd/lc_backgroundcolor.png
# Vertical Text Alignment (cellvert* is used in writer and align* is used in calc)
cmd/lc_cellverttop.png cmd/lc_aligntop.png
@@ -225,4 +227,4 @@
# writer text and table context menus
cmd/sc_charactermenu.png cmd/sc_fontdialog.png
cmd/sc_paragraphmenu.png cmd/sc_paragraphdialog.png
cmd/sc_numberingmenu.png cmd/sc_outlinebullet.png
cmd/sc_numberingmenu.png cmd/sc_outlinebullet.png
diff --git a/icon-themes/tango/links.txt b/icon-themes/tango/links.txt
index c28a3ac..25844ed 100644
--- a/icon-themes/tango/links.txt
+++ b/icon-themes/tango/links.txt
@@ -533,6 +533,8 @@
# text background colour Impress/Draw
cmd/sc_charbackcolor.png cmd/sc_backcolor.png
cmd/lc_charbackcolor.png cmd/lc_backcolor.png
cmd/sc_tablecellbackgroundcolor.png cmd/sc_backgroundcolor.png
cmd/lc_tablecellbackgroundcolor.png cmd/lc_backgroundcolor.png
# Toggle graphics visibility in Writer
cmd/sc_showgraphics.png cmd/sc_insertgraphic.png
@@ -631,4 +633,4 @@
# writer text and table context menus
cmd/sc_charactermenu.png cmd/sc_fontdialog.png
cmd/sc_paragraphmenu.png cmd/sc_paragraphdialog.png
cmd/sc_numberingmenu.png cmd/sc_outlinebullet.png
cmd/sc_numberingmenu.png cmd/sc_outlinebullet.png
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index da6e743..a1b063c 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -975,9 +975,11 @@
#define SID_TABLE_OPTIMAL_COLUMN_WIDTH ( SID_SVX_START + 1187 )
#define SID_TABLE_OPTIMAL_ROW_HEIGHT ( SID_SVX_START + 1188 )
#define SID_TABLE_CELL_BACKGROUND_COLOR TypedWhichId<SvxColorItem>( SID_SVX_START + 1189 )
// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
#define SID_SVX_FIRSTFREE ( SID_TABLE_OPTIMAL_ROW_HEIGHT + 1 )
#define SID_SVX_FIRSTFREE ( SID_SVX_START + 1189 + 1 )
// Overflow check for slot IDs
#if SID_SVX_FIRSTFREE > SID_SVX_END
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 3a9f152..d135a45 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1299,6 +1299,17 @@
<value>com.sun.star.comp.svx.ColorToolBoxControl</value>
</prop>
</node>
<node oor:name="TableCellBackgroundColorToolBox" oor:op="replace">
<prop oor:name="Command">
<value>.uno:TableCellBackgroundColor</value>
</prop>
<prop oor:name="Module">
<value/>
</prop>
<prop oor:name="Controller">
<value>com.sun.star.comp.svx.ColorToolBoxControl</value>
</prop>
</node>
<node oor:name="ColorToolBox" oor:op="replace">
<prop oor:name="Command">
<value>.uno:Color</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 75b5eb0..b0b8e04 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -3394,6 +3394,14 @@
<value>1</value>
</prop>
</node>
<node oor:name=".uno:TableCellBackgroundColor" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Table Cell Background Color</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
</node>
</node>
</oor:component-data>
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index d3aa153..1c956b1 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -425,6 +425,23 @@
GroupId = SfxGroupId::Format;
]
SvxColorItem TableCellBackgroundColor SID_TABLE_CELL_BACKGROUND_COLOR
[
AutoUpdate = TRUE,
FastCall = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = FALSE,
MenuConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Format;
]
SvxBrushItem BackgroundPattern SID_ATTR_BRUSH
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 24e04d1..f852d94 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1294,6 +1294,7 @@
case SID_ATTR_CHAR_COLOR_BACKGROUND:
case SID_BACKGROUND_COLOR:
case SID_ATTR_CHAR_BACK_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
{
mpButtonAutoColor->SetText( SvxResId( RID_SVXSTR_NOFILL ) );
break;
@@ -1409,6 +1410,7 @@
case SID_ATTR_CHAR_COLOR_BACKGROUND:
case SID_BACKGROUND_COLOR:
case SID_ATTR_CHAR_BACK_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
{
mxButtonAutoColor->set_label( SvxResId( RID_SVXSTR_NOFILL ) );
break;
@@ -1545,6 +1547,7 @@
case SID_ATTR_CHAR_COLOR_BACKGROUND:
case SID_BACKGROUND_COLOR:
case SID_ATTR_CHAR_BACK_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
aColor = COL_TRANSPARENT;
sColorName = SvxResId(RID_SVXSTR_NOFILL);
break;
@@ -3032,6 +3035,8 @@
return SID_ATTR_CHAR_BACK_COLOR;
else if (rCommand == ".uno:BackgroundColor")
return SID_BACKGROUND_COLOR;
else if (rCommand == ".uno:TableCellBackgroundColor")
return SID_TABLE_CELL_BACKGROUND_COLOR;
else if (rCommand == ".uno:Extrusion3DColor")
return SID_EXTRUSION_3D_COLOR;
else if (rCommand == ".uno:XLineColor")
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 45558e5..378f487 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -55,6 +55,7 @@
case SID_ATTR_CHAR_COLOR_BACKGROUND:
case SID_ATTR_CHAR_BACK_COLOR:
case SID_BACKGROUND_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
Update(NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT)));
break;
case SID_ATTR_LINE_COLOR:
diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
index bb66c461..472198c 100644
--- a/sw/sdi/_basesh.sdi
+++ b/sw/sdi/_basesh.sdi
@@ -206,6 +206,14 @@
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
SID_TABLE_CELL_BACKGROUND_COLOR
[
ExecMethod = ExecBckCol ;
StateMethod = GetBckColState ;
AutoUpdate ;
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
SID_BACKGROUND_COLOR // status()
[
ExecMethod = ExecBckCol ;
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index e6ad091..6185489 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2202,7 +2202,7 @@
SelectionType nSelType(rSh.GetSelectionType());
SvxBrushItem aBrushItem(RES_BACKGROUND);
if( SelectionType::TableCell & nSelType )
if( nWhich == SID_TABLE_CELL_BACKGROUND_COLOR )
{
rSh.GetBoxBackground( aBrushItem );
}
@@ -2230,6 +2230,7 @@
switch(nWhich)
{
case SID_BACKGROUND_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
{
SvxColorItem aColorItem(aBrushItem.GetColor(),SID_BACKGROUND_COLOR);
rSet.Put(aColorItem);
@@ -2255,14 +2256,14 @@
const SfxItemSet* pArgs = rReq.GetArgs();
sal_uInt16 nSlot(rReq.GetSlot());
if (!pArgs && nSlot != SID_BACKGROUND_COLOR)
if (!pArgs && ( nSlot != SID_BACKGROUND_COLOR || nSlot != SID_TABLE_CELL_BACKGROUND_COLOR ) )
{
return;
}
SvxBrushItem aBrushItem(RES_BACKGROUND);
if( SelectionType::TableCell & nSelType )
if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
{
rSh.GetBoxBackground( aBrushItem );
}
@@ -2288,12 +2289,13 @@
switch(nSlot)
{
case SID_BACKGROUND_COLOR:
case SID_TABLE_CELL_BACKGROUND_COLOR:
{
aBrushItem.SetGraphicPos(GPOS_NONE);
if(pArgs)
{
const SvxColorItem& rNewColorItem = pArgs->Get(SID_BACKGROUND_COLOR);
const SvxColorItem& rNewColorItem = pArgs->Get(nSlot == SID_BACKGROUND_COLOR ? SID_BACKGROUND_COLOR : SID_TABLE_CELL_BACKGROUND_COLOR );
const Color& rNewColor = rNewColorItem.GetValue();
aBrushItem.SetColor(rNewColor);
GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
@@ -2322,7 +2324,7 @@
}
}
if( SelectionType::TableCell & nSelType )
if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
{
rSh.SetBoxBackground( aBrushItem );
}
diff --git a/sw/uiconfig/swriter/toolbar/tableobjectbar.xml b/sw/uiconfig/swriter/toolbar/tableobjectbar.xml
index 75efbad..55297a1 100644
--- a/sw/uiconfig/swriter/toolbar/tableobjectbar.xml
+++ b/sw/uiconfig/swriter/toolbar/tableobjectbar.xml
@@ -42,7 +42,7 @@
<toolbar:toolbaritem xlink:href=".uno:CellVertCenter"/>
<toolbar:toolbaritem xlink:href=".uno:CellVertBottom"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:BackgroundColor"/>
<toolbar:toolbaritem xlink:href=".uno:TableCellBackgroundColor"/>
<toolbar:toolbaritem xlink:href=".uno:AutoFormat"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:SetBorderStyle"/>