Kaydet (Commit) bf87e743 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

fdo#84844 Sidebar: Use SvxColorToolBoxControl for cell fill color

Change-Id: I4a067b31b4b518c56a0d18c6e6709955562d77fa
üst bb214c32
......@@ -287,8 +287,6 @@
// CellAppearancePropertyPanel -----------------------------------------
#define HID_PROPERTYPANEL_SC_CELL_SECTION "SC_HID_PROPERTYPANEL_SC_CELL_SECTION"
#define HID_PROPERTYPANEL_SC_TBX_BKCOLOR "SC_HID_PROPERTYPANEL_SC_TBX_BKCOLOR"
#define HID_PROPERTYPANEL_SC_TBI_BKCOLOR "SC_HID_PROPERTYPANEL_SC_TBI_BKCOLOR"
#define HID_PROPERTYPANEL_SC_TBX_BORDER "SC_HID_PROPERTYPANEL_SC_TBX_BORDER"
#define HID_PROPERTYPANEL_SC_TBI_BORDER "SC_HID_PROPERTYPANEL_SC_TBI_BORDER"
#define HID_PROPERTYPANEL_SC_TBX_STYLE "SC_HID_PROPERTYPANEL_SC_TBX_STYLE"
......@@ -296,7 +294,6 @@
#define HID_PROPERTYPANEL_SC_TBX_LINECOLOR "SC_HID_PROPERTYPANEL_SC_TBX_LINECOLOR"
#define HID_PROPERTYPANEL_SC_TBI_LINECOLOR "SC_HID_PROPERTYPANEL_SC_TBI_LINECOLOR"
#define HID_PROPERTYPANEL_SC_CBOX_SHOWGRID "SC_HID_PROPERTYPANEL_SC_CBOX_SHOWGRID"
#define HID_PROPERTYPANEL_FILL_COLOR_VS "SC_HID_PROPERTYPANEL_FILL_COLOR_VS"
#define HID_PROPERTYPANEL_LINE_COLOR_VS "SC_HID_PROPERTYPANEL_LINE_COLOR_VS"
#define HID_PROPERTYPANEL_SC_STYLE_VS "SC_HID_PROPERTYPANEL_SC_STYLE_VS"
#define HID_PROPERTYPANEL_SC_STYLE_PB "SC_HID_PROPERTYPANEL_SC_STYLE_PB"
......
......@@ -1120,7 +1120,6 @@
#define RID_PROPERTYPANEL_SC_ALIGNMENT (SC_DIALOGS_START + 161)
// defines for CellAppearancePropertyPanel
#define RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR (SC_DIALOGS_START + 162)
#define RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR (SC_DIALOGS_START + 163)
#define RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE (SC_DIALOGS_START + 164)
#define RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE (SC_DIALOGS_START + 165)
......
......@@ -47,7 +47,6 @@
using namespace css;
using namespace css::uno;
const char UNO_BACKGROUNDCOLOR[] = ".uno:BackgroundColor";
const char UNO_SETBORDERSTYLE[] = ".uno:SetBorderStyle";
const char UNO_LINESTYLE[] = ".uno:LineStyle";
const char UNO_FRAMELINECOLOR[] = ".uno:FrameLineColor";
......@@ -66,30 +65,6 @@ namespace
namespace sc { namespace sidebar {
svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent)
{
const ScResId aResId(VS_NOFILLCOLOR);
return new svx::sidebar::ColorControl(
pParent,
mpBindings,
ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR),
ScResId(VS_FILLCOLOR),
::boost::bind(GetTransparentColor),
::boost::bind(&CellAppearancePropertyPanel::SetFillColor, this, _1, _2),
pParent,
&aResId);
}
void CellAppearancePropertyPanel::SetFillColor(
const OUString& /*rsColorName*/,
const Color aColor)
{
const SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SfxCallMode::RECORD, &aColorItem, 0L);
maBackColor = aColor;
}
svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent)
{
return new svx::sidebar::ColorControl(
......@@ -144,7 +119,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
SfxBindings* pBindings)
: PanelLayout(pParent, "CellAppearancePropertyPanel", "modules/scalc/ui/sidebarcellappearance.ui", rxFrame),
maBackColorControl(SID_BACKGROUND_COLOR, *pBindings, *this),
maLineColorControl(SID_FRAME_LINECOLOR, *pBindings, *this),
maLineStyleControl(SID_FRAME_LINESTYLE, *pBindings, *this),
maBorderOuterControl(SID_ATTR_BORDER_OUTER, *pBindings, *this),
......@@ -164,7 +138,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
maIMGLineStyle8(ScResId(IMG_LINE_STYLE8)),
maIMGLineStyle9(ScResId(IMG_LINE_STYLE9)),
maBackColor(COL_TRANSPARENT),
maLineColor(COL_BLACK),
maTLBRColor(COL_BLACK),
maBLTRColor(COL_BLACK),
......@@ -177,7 +150,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
mnBLTRIn(0),
mnBLTROut(0),
mnBLTRDis(0),
mbBackColorAvailable(true),
mbLineColorAvailable(true),
mbBorderStyleAvailable(true),
mbLeft(false),
......@@ -191,7 +163,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
mbTLBR(false),
mbBLTR(false),
maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl, this, _1)),
maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)),
mpCellLineStylePopup(),
mpCellBorderStylePopup(),
......@@ -200,15 +171,11 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
maContext(),
mpBindings(pBindings)
{
get(mpTBFillColor, "cellbackgroundcolor");
get(mpTBCellBorder, "cellbordertype");
get(mpTBLineStyle, "borderlinestyle");
get(mpTBLineColor, "borderlinecolor");
get(mpCBXShowGrid, "cellgridlines");
mpFillColorUpdater.reset( new ::svx::ToolboxButtonColorUpdater(SID_ATTR_BRUSH,
mpTBFillColor->GetItemId( UNO_BACKGROUNDCOLOR ),
mpTBFillColor) );
mpLineColorUpdater.reset( new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR,
mpTBLineColor->GetItemId( UNO_FRAMELINECOLOR ),
mpTBLineColor) );
......@@ -224,16 +191,10 @@ CellAppearancePropertyPanel::~CellAppearancePropertyPanel()
void CellAppearancePropertyPanel::Initialize()
{
const sal_uInt16 nIdBkColor = mpTBFillColor->GetItemId( UNO_BACKGROUNDCOLOR );
mpTBFillColor->SetItemBits( nIdBkColor, mpTBFillColor->GetItemBits( nIdBkColor ) | ToolBoxItemBits::DROPDOWNONLY );
Link aLink = LINK(this, CellAppearancePropertyPanel, TbxBKColorSelectHdl);
mpTBFillColor->SetDropdownClickHdl ( aLink );
mpTBFillColor->SetSelectHdl ( aLink );
const sal_uInt16 nIdBorderType = mpTBCellBorder->GetItemId( UNO_SETBORDERSTYLE );
mpTBCellBorder->SetItemImage( nIdBorderType, maIMGCellBorder );
mpTBCellBorder->SetItemBits( nIdBorderType, mpTBCellBorder->GetItemBits( nIdBorderType ) | ToolBoxItemBits::DROPDOWNONLY );
aLink = LINK(this, CellAppearancePropertyPanel, TbxCellBorderSelectHdl);
Link aLink = LINK(this, CellAppearancePropertyPanel, TbxCellBorderSelectHdl);
mpTBCellBorder->SetDropdownClickHdl ( aLink );
mpTBCellBorder->SetSelectHdl ( aLink );
......@@ -259,18 +220,6 @@ void CellAppearancePropertyPanel::Initialize()
mpTBLineStyle->SetAccessibleRelationLabeledBy(mpTBLineStyle);
}
IMPL_LINK(CellAppearancePropertyPanel, TbxBKColorSelectHdl, ToolBox*, pToolBox)
{
const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
if(aCommand == UNO_BACKGROUNDCOLOR)
{
maFillColorPopup.Show(*pToolBox);
maFillColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
}
return 0;
}
IMPL_LINK(CellAppearancePropertyPanel, TbxLineColorSelectHdl, ToolBox*, pToolBox)
{
const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
......@@ -386,24 +335,6 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
switch(nSID)
{
case SID_BACKGROUND_COLOR:
if(eState >= SfxItemState::DEFAULT)
{
const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState);
if(pSvxColorItem)
{
maBackColor = ((const SvxColorItem*)pState)->GetValue();
mbBackColorAvailable = true;
mpFillColorUpdater->Update(maBackColor);
break;
}
}
mbBackColorAvailable = false;
maBackColor.SetColor(COL_TRANSPARENT);
mpFillColorUpdater->Update(COL_TRANSPARENT);
break;
case SID_FRAME_LINECOLOR:
if( eState == SfxItemState::DONTCARE)
{
......
......@@ -17,9 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
//BACK_COLOR PAGE
#define STR_AUTOMATICE 2
//line style page
#define VS_STYLE 1
#define PB_OPTIONS 2
......@@ -75,8 +72,6 @@
#define STR_BORDER_7 47
#define STR_BORDER_8 48
#define VS_FILLCOLOR 1
#define VS_NOFILLCOLOR 2
#define VS_LINECOLOR 1
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -70,16 +70,13 @@ public:
private:
//ui controls
ToolBox* mpTBFillColor;
ToolBox* mpTBCellBorder;
ToolBox* mpTBLineStyle;
ToolBox* mpTBLineColor;
::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater;
::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater;
::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater;
CheckBox* mpCBXShowGrid;
::sfx2::sidebar::ControllerItem maBackColorControl;
::sfx2::sidebar::ControllerItem maLineColorControl;
::sfx2::sidebar::ControllerItem maLineStyleControl;
::sfx2::sidebar::ControllerItem maBorderOuterControl;
......@@ -100,9 +97,6 @@ private:
Image maIMGLineStyle8;
Image maIMGLineStyle9;
// cell background color
Color maBackColor;
// cell line color(s)
Color maLineColor;
Color maTLBRColor;
......@@ -120,7 +114,6 @@ private:
sal_uInt16 mnBLTRDis;
/// bitfield
bool mbBackColorAvailable : 1;
bool mbLineColorAvailable : 1;
bool mbBorderStyleAvailable : 1;
......@@ -139,7 +132,6 @@ private:
bool mbBLTR : 1;
// popups
svx::sidebar::ColorPopup maFillColorPopup;
svx::sidebar::ColorPopup maLineColorPopup;
::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup;
::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
......@@ -148,16 +140,11 @@ private:
::sfx2::sidebar::EnumContext maContext;
SfxBindings* mpBindings;
DECL_LINK(TbxBKColorSelectHdl, ToolBox*);
DECL_LINK(TbxLineColorSelectHdl, ToolBox*);
DECL_LINK(TbxCellBorderSelectHdl, ToolBox*);
DECL_LINK(TbxLineStyleSelectHdl, ToolBox*);
DECL_LINK(CBOXGridShowClkHdl, void*);
// for fill color picker
svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent);
void SetFillColor(const OUString& rsColorName, const Color aColor);
// for line color picker
svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent);
void SetLineColor(const OUString& rsColorName, const Color aColor);
......
......@@ -65,31 +65,6 @@ Image IMG_LINE_STYLE9
ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750.png";};
};
// fill color popup
Control RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR
{
OutputSize = TRUE;
DialogControl = TRUE;
Border = FALSE;
Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT );
Control VS_FILLCOLOR
{
HelpID = HID_PROPERTYPANEL_FILL_COLOR_VS;
Hide = TRUE ;
Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
TabStop = TRUE ;
Text [ en-US ] = "Color";
};
String VS_NOFILLCOLOR
{
Text [ en-US ] = "No Color" ;
};
};
// line color popup
Control RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR
......
......@@ -32,14 +32,13 @@
</packing>
</child>
<child>
<object class="GtkToolbar" id="cellbackgroundcolor">
<object class="sfxlo-SidebarToolBox" id="cellbackgroundcolor">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Select the background color of the selected cells.</property>
<child>
<object class="GtkMenuToolButton" id="cellbackground">
<property name="use_action_appearance">False</property>
<property name="width_request">105</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -48,7 +47,6 @@
<property name="halign">start</property>
<property name="use_action_appearance">False</property>
<property name="action_name">.uno:BackgroundColor</property>
<property name="label" translatable="no">toolbutton1</property>
<property name="use_underline">True</property>
</object>
<packing>
......
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