Kaydet (Commit) 47e9db9c authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Heiko Tietze

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: 's avatarHeiko Tietze <tietze.heiko@gmail.com>
üst 2e189c24
......@@ -1902,6 +1902,7 @@ static void doc_iniUnoCommands ()
OUString(".uno:AlignRight"),
OUString(".uno:BackColor"),
OUString(".uno:BackgroundColor"),
OUString(".uno:TableCellBackgroundColor"),
OUString(".uno:Bold"),
OUString(".uno:CenterPara"),
OUString(".uno:CharBackColor"),
......
......@@ -579,6 +579,8 @@ cmd/sc_fontcolor.png cmd/sc_color.png
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
......
......@@ -567,6 +567,8 @@ cmd/sc_fontcolor.png cmd/sc_color.png
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
......
......@@ -877,18 +877,21 @@ cmd/32/characterbackgroundpattern.png cmd/32/backcolor.png
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
......
......@@ -292,6 +292,7 @@ cmd/32/starshapes.png cmd/32/starshapes.star5.png
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_starshapes.png cmd/lc_starshapes.star5.png
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_starshapes.png cmd/sc_starshapes.star5.png
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
......
......@@ -77,6 +77,8 @@ cmd/sc_closepreview.png cmd/sc_exitsearch.png
# 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 @@ cmd/sc_viewsidebarstyles.png cmd/sc_designerdialog.png
# 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
\ No newline at end of file
cmd/sc_numberingmenu.png cmd/sc_outlinebullet.png
......@@ -533,6 +533,8 @@ cmd/sc_sheetcommentmenu.png cmd/sc_insertannotation.png
# 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 @@ cmd/sc_viewsidebarstyles.png cmd/sc_designerdialog.png
# 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
\ No newline at end of file
cmd/sc_numberingmenu.png cmd/sc_outlinebullet.png
......@@ -975,9 +975,11 @@ class SfxStringItem;
#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
......
......@@ -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>
......
......@@ -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>
......@@ -425,6 +425,23 @@ SvxColorItem BackgroundColor SID_BACKGROUND_COLOR
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
......
......@@ -1294,6 +1294,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
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 @@ ColorWindow::ColorWindow(std::shared_ptr<PaletteManager> const & rPaletteManager
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 @@ namespace
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 @@ sal_uInt16 MapCommandToSlotId(const OUString& rCommand)
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")
......
......@@ -55,6 +55,7 @@ namespace svx
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:
......
......@@ -206,6 +206,14 @@ interface BaseTextSelection
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
SID_TABLE_CELL_BACKGROUND_COLOR
[
ExecMethod = ExecBckCol ;
StateMethod = GetBckColState ;
AutoUpdate ;
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
SID_BACKGROUND_COLOR // status()
[
ExecMethod = ExecBckCol ;
......
......@@ -2202,7 +2202,7 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
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 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
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 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
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 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
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 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
}
}
if( SelectionType::TableCell & nSelType )
if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
{
rSh.SetBoxBackground( aBrushItem );
}
......
......@@ -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"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment