[Libreoffice-commits] core.git: 3 commits - include/svx sc/inc sc/source sc/uiconfig svx/Library_svx.mk svx/source
Maxim Monastirsky
momonasmon at gmail.com
Mon Nov 3 12:38:29 PST 2014
include/svx/sidebar/ColorControl.hxx | 91 -------
include/svx/sidebar/ColorPopup.hxx | 54 ----
include/svx/tbcontrl.hxx | 15 +
sc/inc/helpids.h | 1
sc/inc/sc.hrc | 5
sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 131 -----------
sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc | 2
sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx | 20 -
sc/source/ui/sidebar/CellAppearancePropertyPanel.src | 20 -
sc/uiconfig/scalc/ui/sidebarcellappearance.ui | 4
svx/Library_svx.mk | 2
svx/source/sidebar/tools/ColorControl.cxx | 224 -------------------
svx/source/sidebar/tools/ColorPopup.cxx | 59 -----
svx/source/tbxctrls/colorwindow.hxx | 4
svx/source/tbxctrls/tbcontrl.cxx | 185 ++++++++++++---
15 files changed, 168 insertions(+), 649 deletions(-)
New commits:
commit 8e399602ea7aa11a81d704ff6ce8e660df4205b9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Nov 3 16:41:10 2014 +0200
Related: fdo#84844 Get rid of ColorControl and ColorPopup
Change-Id: Ie2d00cfbccefd69c8e46381b712620def655a798
diff --git a/include/svx/sidebar/ColorControl.hxx b/include/svx/sidebar/ColorControl.hxx
deleted file mode 100644
index 87ebf30..0000000
--- a/include/svx/sidebar/ColorControl.hxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SVX_SIDEBAR_COLORCONTROL_HXX
-#define INCLUDED_SVX_SIDEBAR_COLORCONTROL_HXX
-
-#include <svx/sidebar/PopupControl.hxx>
-
-#include <svtools/valueset.hxx>
-#include <boost/function.hpp>
-#include <svx/SvxColorValueSet.hxx>
-
-namespace vcl { class Window; }
-class SfxBindings;
-class RedId;
-class FloatingWindow;
-
-
-namespace svx { namespace sidebar {
-
-/** The ColorControl uses a ValueSet control for displaying all named
- colors in a matrix.
-*/
-class SVX_DLLPUBLIC ColorControl
- : public PopupControl
-{
-public:
- /** Create a new ColorControl object.
- @param rControlResId
- The resource id for the whole color control.
- @param rNoColorGetter
- A functor for getting the color which will be returned when the
- WB_NONEFIELD is used and got selected
- @param rColorSetter
- A functor for setting the color that is selected by the
- user.
- @param pNoColorStringResId
- Resource id of an optional string for the "no color"
- string. When a value is given then a
- field/button is created above the color matrix for
- selecting "no color" ie. transparent.
- When zero is given then no such field is created.
- */
- ColorControl (
- vcl::Window* pParent,
- SfxBindings* pBindings,
- const ResId& rControlResId,
- const ResId& rValueSetResId,
- const ::boost::function<Color(void)>& rNoColorGetter,
- const ::boost::function<void(OUString&,Color)>& rColorSetter,
- FloatingWindow* pFloatingWindow,
- const ResId* pNoColorStringResId);
- virtual ~ColorControl (void);
-
- void GetFocus (void) SAL_OVERRIDE;
- void SetCurColorSelect (
- const Color aCol,
- const bool bAvl);
-
-private:
- SvxColorValueSet maVSColor;
- FloatingWindow* mpFloatingWindow;
- const OUString msNoColorString;
- ::boost::function<Color(void)> maNoColorGetter;
- ::boost::function<void(OUString&,Color)> maColorSetter;
-
- void FillColors (void);
- DECL_LINK(VSSelectHdl, void *);
-};
-
-} } // end of namespace svx::sidebar
-
-#endif // INCLUDED_SVX_SIDEBAR_COLORCONTROL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/sidebar/ColorPopup.hxx b/include/svx/sidebar/ColorPopup.hxx
deleted file mode 100644
index 3226be0..0000000
--- a/include/svx/sidebar/ColorPopup.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SVX_SIDEBAR_COLORPOPUP_HXX
-#define INCLUDED_SVX_SIDEBAR_COLORPOPUP_HXX
-
-#include <svx/sidebar/Popup.hxx>
-
-#include <tools/color.hxx>
-
-
-namespace svx { namespace sidebar {
-
-/** Popup control that displays all named colors in a matrix.
- The number of rows and columns of the matrix are computed from
- the number of named colors so that both have roughly the same
- value.
-
- The ColorPopup uses ColorControl as control for its content.
-*/
-class SVX_DLLPUBLIC ColorPopup
- : public Popup
-{
-public :
- ColorPopup (
- vcl::Window* pParent,
- const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
- virtual ~ColorPopup (void);
-
- void SetCurrentColor (
- const Color aCurrentColor,
- const bool bIsColorAvailable);
-};
-
-} } // end of namespace svx::sidebar
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index f5e5ded..1fc78a2 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -200,8 +200,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/sidebar/line/LineWidthPopup \
svx/source/sidebar/possize/PosSizePropertyPanel \
svx/source/sidebar/possize/SidebarDialControl \
- svx/source/sidebar/tools/ColorControl \
- svx/source/sidebar/tools/ColorPopup \
svx/source/sidebar/tools/PopupControl \
svx/source/sidebar/tools/PopupContainer \
svx/source/sidebar/tools/Popup \
diff --git a/svx/source/sidebar/tools/ColorControl.cxx b/svx/source/sidebar/tools/ColorControl.cxx
deleted file mode 100644
index 68f8ce08..0000000
--- a/svx/source/sidebar/tools/ColorControl.cxx
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <svx/sidebar/ColorControl.hxx>
-#include "svx/svxids.hrc"
-#include "svx/drawitem.hxx"
-#include "svx/xtable.hxx"
-#include "svx/dialmgr.hxx"
-#include "svx/xflclit.hxx"
-#include <tools/resid.hxx>
-#include <sfx2/sidebar/Theme.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <vcl/floatwin.hxx>
-#include <unotools/pathoptions.hxx>
-#include <editeng/editrids.hrc>
-
-using ::sfx2::sidebar::Theme;
-
-namespace svx { namespace sidebar {
-
-namespace {
- short GetItemId_Imp( ValueSet& rValueSet, const Color& rCol )
- {
- if(rCol == COL_AUTO)
- return 0;
-
- bool bFound = false;
- sal_uInt16 nCount = rValueSet.GetItemCount();
- sal_uInt16 n = 1;
-
- while ( !bFound && n <= nCount )
- {
- Color aValCol = rValueSet.GetItemColor(n);
-
- bFound = ( aValCol.GetRed() == rCol.GetRed()
- && aValCol.GetGreen() == rCol.GetGreen()
- && aValCol.GetBlue() == rCol.GetBlue() );
-
- if ( !bFound )
- n++;
- }
- return bFound ? n : -1;
- }
- XColorListRef GetColorTable (void)
- {
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
- DBG_ASSERT(pDocSh!=NULL, "DocShell not found!");
- if (pDocSh != NULL)
- {
- const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE);
- if (pItem != NULL)
- {
- XColorListRef xTable = static_cast<const SvxColorListItem*>(pItem)->GetColorList();
- if (xTable.is())
- return xTable;
- }
- }
-
- return XColorList::GetStdColorList();
- }
-} // end of anonymous namespace
-
-
-
-
-ColorControl::ColorControl (
- vcl::Window* pParent,
- SfxBindings* /* pBindings */,
- const ResId& rControlResId,
- const ResId& rValueSetResId,
- const ::boost::function<Color(void)>& rNoColorGetter,
- const ::boost::function<void(OUString&,Color)>& rColorSetter,
- FloatingWindow* pFloatingWindow,
- const ResId* pNoColorStringResId) // const sal_uInt32 nNoColorStringResId)
- : PopupControl(pParent, rControlResId),
- maVSColor(this, rValueSetResId),
- mpFloatingWindow(pFloatingWindow),
- msNoColorString(
- pNoColorStringResId
- ? pNoColorStringResId->toString()
- : OUString()),
- maNoColorGetter(rNoColorGetter),
- maColorSetter(rColorSetter)
-{
- FreeResource();
- FillColors();
-}
-
-
-
-ColorControl::~ColorControl (void)
-{
-}
-
-
-
-
-void ColorControl::FillColors (void)
-{
- XColorListRef xColorTable (GetColorTable());
-
- if (xColorTable.is())
- {
- const long nColorCount(xColorTable->Count());
- if (nColorCount <= 0)
- return;
-
- const WinBits aWinBits(maVSColor.GetStyle() | WB_TABSTOP | WB_ITEMBORDER | WB_NAMEFIELD |
- WB_NO_DIRECTSELECT | WB_MENUSTYLEVALUESET);
-
- maVSColor.SetStyle(aWinBits);
-
- // neds to be done *before* layouting
- if(!msNoColorString.isEmpty())
- {
- maVSColor.SetStyle(maVSColor.GetStyle() | WB_NONEFIELD);
- maVSColor.SetText(msNoColorString);
- }
-
- const Size aNewSize(maVSColor.layoutAllVisible(nColorCount));
- maVSColor.SetOutputSizePixel(aNewSize);
- const sal_Int32 nAdd = 4;
-
- SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd));
- Link aLink = LINK(this, ColorControl, VSSelectHdl);
- maVSColor.SetSelectHdl(aLink);
-
- // Now, after all calls to SetStyle, we can change the
- // background color.
- maVSColor.SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground));
-
- // add entrties
- maVSColor.Clear();
- maVSColor.addEntriesForXColorList(*xColorTable);
- }
-
- maVSColor.Show();
-}
-
-
-
-
-void ColorControl::GetFocus (void)
-{
- maVSColor.GrabFocus();
-}
-
-
-
-
-void ColorControl::SetCurColorSelect(Color aCol,bool bAvailable)
-{
- //UUUU When transparent use transparent entry (entry 0)
- const bool bIsTransparent(0xff == aCol.GetTransparency());
- short nCol = bIsTransparent ? 0 : GetItemId_Imp(maVSColor,aCol);
-
- if(!bAvailable)
- {
- maVSColor.SetNoSelection();
- return;
- }
-
- //if not found
- if(nCol == -1)
- {
- maVSColor.SetNoSelection();
- }
- else
- {
- // remove selection first to force evtl. scroll when scroll is needed
- maVSColor.SetNoSelection();
- maVSColor.SelectItem(nCol);
- }
-}
-
-
-
-
-IMPL_LINK(ColorControl, VSSelectHdl, void *, pControl)
-{
- if(pControl == &maVSColor)
- {
- sal_uInt16 iPos = maVSColor.GetSelectItemId();
- Color aColor = maVSColor.GetItemColor( iPos );
- OUString aTmpStr = maVSColor.GetItemText( iPos );
-
- // react when the WB_NONEFIELD created entry is selected
- if (aColor.GetColor() == 0 && aTmpStr.isEmpty())
- {
- if (maNoColorGetter)
- aColor = maNoColorGetter();
- }
- if (maColorSetter)
- maColorSetter(aTmpStr, aColor);
-
- if (mpFloatingWindow!=NULL && mpFloatingWindow->IsInPopupMode())
- mpFloatingWindow->EndPopupMode();
- }
-
- return 0;
-}
-
-
-} } // end of namespace svx::sidebar
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/tools/ColorPopup.cxx b/svx/source/sidebar/tools/ColorPopup.cxx
deleted file mode 100644
index cd77830..0000000
--- a/svx/source/sidebar/tools/ColorPopup.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include <svx/sidebar/ColorPopup.hxx>
-#include <svx/sidebar/ColorControl.hxx>
-
-
-namespace svx { namespace sidebar {
-
-ColorPopup::ColorPopup (
- vcl::Window* pParent,
- const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
- : Popup(
- pParent,
- rControlCreator,
- OUString("Color"))
-{
-}
-
-
-
-
-ColorPopup::~ColorPopup (void)
-{
-}
-
-
-
-
-void ColorPopup::SetCurrentColor (
- const Color aCurrentColor,
- const bool bIsColorAvailable)
-{
- ProvideContainerAndControl();
-
- ColorControl* pColorControl = dynamic_cast<ColorControl*>(mpControl.get());
- if (pColorControl != NULL)
- pColorControl->SetCurColorSelect(aCurrentColor, bIsColorAvailable);
-}
-
-
-} } // end of namespace svx::sidebar
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a62553cb5bac29398cf445b8f068940e4085e001
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Nov 3 16:36:40 2014 +0200
fdo#84844 Use SvxColorToolBoxControl for border color
Change-Id: Id177964ec35d6b5a08c46b8ba96615c2a4729136
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 86c1c0e..6b23f9a 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -294,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_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"
#define HID_PROPERTYPANEL_SC_BORDER1_TBX "SC_HID_PROPERTYPANEL_SC_BORDER1_TBX"
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 57b7c52..0287773 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1120,9 +1120,8 @@
#define RID_PROPERTYPANEL_SC_ALIGNMENT (SC_DIALOGS_START + 161)
// defines for CellAppearancePropertyPanel
-#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)
+#define RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE (SC_DIALOGS_START + 162)
+#define RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE (SC_DIALOGS_START + 163)
#define SC_DIALOGS_END (RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE + 1)
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 2024f15..bf4e1b3 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -27,15 +27,12 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <vcl/fixed.hxx>
-#include <svx/tbxcolorupdate.hxx>
#include <svl/eitem.hxx>
#include <editeng/borderline.hxx>
#include <editeng/boxitem.hxx>
-#include <editeng/colritem.hxx>
#include <editeng/lineitem.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
-#include <svx/sidebar/ColorControl.hxx>
#include <boost/bind.hpp>
#include <svx/sidebar/PopupContainer.hxx>
#include "CellLineStyleControl.hxx"
@@ -49,44 +46,11 @@ using namespace css::uno;
const char UNO_SETBORDERSTYLE[] = ".uno:SetBorderStyle";
const char UNO_LINESTYLE[] = ".uno:LineStyle";
-const char UNO_FRAMELINECOLOR[] = ".uno:FrameLineColor";
-
-// helpers
-
-namespace
-{
- Color GetTransparentColor(void)
- {
- return COL_TRANSPARENT;
- }
-} // end of anonymous namespace
// namespace open
namespace sc { namespace sidebar {
-svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent)
-{
- return new svx::sidebar::ColorControl(
- pParent,
- mpBindings,
- ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR),
- ScResId(VS_LINECOLOR),
- ::boost::bind(GetTransparentColor),
- ::boost::bind(&CellAppearancePropertyPanel::SetLineColor, this, _1, _2),
- pParent,
- 0);
-}
-
-void CellAppearancePropertyPanel::SetLineColor(
- const OUString& /*rsColorName*/,
- const Color aColor)
-{
- const SvxColorItem aColorItem(aColor, SID_FRAME_LINECOLOR);
- mpBindings->GetDispatcher()->Execute(SID_FRAME_LINECOLOR, SfxCallMode::RECORD, &aColorItem, 0L);
- maLineColor = aColor;
-}
-
svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent)
{
return new CellLineStyleControl(pParent, *this);
@@ -119,7 +83,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
SfxBindings* pBindings)
: PanelLayout(pParent, "CellAppearancePropertyPanel", "modules/scalc/ui/sidebarcellappearance.ui", rxFrame),
- maLineColorControl(SID_FRAME_LINECOLOR, *pBindings, *this),
maLineStyleControl(SID_FRAME_LINESTYLE, *pBindings, *this),
maBorderOuterControl(SID_ATTR_BORDER_OUTER, *pBindings, *this),
maBorderInnerControl(SID_ATTR_BORDER_INNER, *pBindings, *this),
@@ -138,9 +101,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
maIMGLineStyle8(ScResId(IMG_LINE_STYLE8)),
maIMGLineStyle9(ScResId(IMG_LINE_STYLE9)),
- maLineColor(COL_BLACK),
- maTLBRColor(COL_BLACK),
- maBLTRColor(COL_BLACK),
mnIn(0),
mnOut(0),
mnDis(0),
@@ -150,7 +110,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
mnBLTRIn(0),
mnBLTROut(0),
mnBLTRDis(0),
- mbLineColorAvailable(true),
mbBorderStyleAvailable(true),
mbLeft(false),
mbRight(false),
@@ -163,7 +122,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
mbTLBR(false),
mbBLTR(false),
- maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)),
mpCellLineStylePopup(),
mpCellBorderStylePopup(),
@@ -176,9 +134,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
get(mpTBLineColor, "borderlinecolor");
get(mpCBXShowGrid, "cellgridlines");
- mpLineColorUpdater.reset( new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR,
- mpTBLineColor->GetItemId( UNO_FRAMELINECOLOR ),
- mpTBLineColor) );
mpCellBorderUpdater.reset( new CellBorderUpdater(
mpTBCellBorder->GetItemId( UNO_SETBORDERSTYLE ), *mpTBCellBorder) );
@@ -206,11 +161,6 @@ void CellAppearancePropertyPanel::Initialize()
mpTBLineStyle->SetSelectHdl ( aLink );
mpTBLineStyle->Disable();
- const sal_uInt16 nIdBorderLinecolor = mpTBLineColor->GetItemId( UNO_FRAMELINECOLOR );
- mpTBLineColor->SetItemBits( nIdBorderLinecolor, mpTBLineColor->GetItemBits( nIdBorderLinecolor ) | ToolBoxItemBits::DROPDOWNONLY );
- aLink = LINK(this, CellAppearancePropertyPanel, TbxLineColorSelectHdl);
- mpTBLineColor->SetDropdownClickHdl ( aLink );
- mpTBLineColor->SetSelectHdl ( aLink );
mpTBLineColor->Disable();
aLink = LINK(this, CellAppearancePropertyPanel, CBOXGridShowClkHdl);
@@ -220,18 +170,6 @@ void CellAppearancePropertyPanel::Initialize()
mpTBLineStyle->SetAccessibleRelationLabeledBy(mpTBLineStyle);
}
-IMPL_LINK(CellAppearancePropertyPanel, TbxLineColorSelectHdl, ToolBox*, pToolBox)
-{
- const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
-
- if(aCommand == UNO_FRAMELINECOLOR)
- {
- maLineColorPopup.Show(*pToolBox);
- maLineColorPopup.SetCurrentColor(maLineColor, mbLineColorAvailable);
- }
- return 0;
-}
-
IMPL_LINK(CellAppearancePropertyPanel, TbxCellBorderSelectHdl, ToolBox*, pToolBox)
{
const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
@@ -335,40 +273,6 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
switch(nSID)
{
- case SID_FRAME_LINECOLOR:
- if( eState == SfxItemState::DONTCARE)
- {
- mbLineColorAvailable = true;
- maLineColor.SetColor( COL_TRANSPARENT );
- UpdateControlState();
- break;
- }
-
- if(eState >= SfxItemState::DEFAULT && pState && pState->ISA(SvxColorItem) )
- {
- const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState);
-
- if(pSvxColorItem)
- {
- maLineColor = static_cast<const SvxColorItem*>(pState)->GetValue();
- if(maLineColor == COL_AUTO)
- mbLineColorAvailable = false;
- else
- {
- mbLineColorAvailable = true;
- // mpLineColorUpdater->Update(maLineColor);
- }
-
- UpdateControlState();
- break;
- }
- }
-
- mbLineColorAvailable = false;
- maLineColor.SetColor(COL_AUTO);
- // mpLineColorUpdater->Update(maLineColor);
- UpdateControlState();
- break;
case SID_FRAME_LINESTYLE:
if( eState == SfxItemState::DONTCARE )
{
@@ -486,7 +390,6 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
if( eState == SfxItemState::DONTCARE )
{
mbTLBR = true;
- maTLBRColor.SetColor(COL_TRANSPARENT);
mnTLBRIn = mnTLBROut = mnTLBRDis = 0;
UpdateControlState();
break;
@@ -507,7 +410,6 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
else
{
mbTLBR = true;
- maTLBRColor = aLine->GetColor();
mnTLBRIn = aLine->GetInWidth();
mnTLBROut = aLine->GetOutWidth();
mnTLBRDis = aLine->GetDistance();
@@ -528,7 +430,6 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
if( eState == SfxItemState::DONTCARE )
{
mbBLTR = true;
- maBLTRColor.SetColor( COL_TRANSPARENT );
mnBLTRIn = mnBLTROut = mnBLTRDis = 0;
UpdateControlState();
break;
@@ -549,7 +450,6 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
else
{
mbBLTR = true;
- maBLTRColor = aLine->GetColor();
mnBLTRIn = aLine->GetInWidth();
mnBLTROut = aLine->GetOutWidth();
mnBLTRDis = aLine->GetDistance();
@@ -619,37 +519,6 @@ void CellAppearancePropertyPanel::UpdateControlState()
mpTBLineColor->Enable();
mpTBLineStyle->Enable();
- //set line color state
- if( mbLineColorAvailable && !mbTLBR && !mbBLTR )
- mpLineColorUpdater->Update(maLineColor);
- else if( !mbLineColorAvailable && mbTLBR && !mbBLTR )
- mpLineColorUpdater->Update(maTLBRColor);
- else if ( !mbLineColorAvailable && !mbTLBR && mbBLTR )
- mpLineColorUpdater->Update(maBLTRColor);
- else if( !mbLineColorAvailable && mbTLBR && mbBLTR)
- {
- if( maTLBRColor == maBLTRColor)
- mpLineColorUpdater->Update(maBLTRColor);
- else
- mpLineColorUpdater->Update(COL_TRANSPARENT);
- }
- else if( mbLineColorAvailable && mbTLBR && !mbBLTR )
- {
- if( maTLBRColor == maLineColor)
- mpLineColorUpdater->Update(maLineColor);
- else
- mpLineColorUpdater->Update(COL_TRANSPARENT);
- }
- else if( mbLineColorAvailable && !mbTLBR && mbBLTR )
- {
- if( maBLTRColor == maLineColor)
- mpLineColorUpdater->Update(maLineColor);
- else
- mpLineColorUpdater->Update(COL_TRANSPARENT);
- }
- else
- mpLineColorUpdater->Update(COL_TRANSPARENT);
-
//set line style state
if( mbBorderStyleAvailable && !mbTLBR && !mbBLTR )
{
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
index 8a01cb2..e9adcd6 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc
@@ -72,6 +72,4 @@
#define STR_BORDER_7 47
#define STR_BORDER_8 48
-#define VS_LINECOLOR 1
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index ef92c5c..60c2a5b 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -23,10 +23,12 @@
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include <boost/scoped_ptr.hpp>
-#include <svx/sidebar/ColorPopup.hxx>
class FixedText;
-namespace svx { class ToolboxButtonColorUpdater; }
+namespace svx { namespace sidebar {
+ class PopupControl;
+ class PopupContainer;
+}}
namespace sc { namespace sidebar {
class CellLineStylePopup;
class CellBorderStylePopup;
@@ -73,11 +75,9 @@ private:
ToolBox* mpTBCellBorder;
ToolBox* mpTBLineStyle;
ToolBox* mpTBLineColor;
- ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater;
::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater;
CheckBox* mpCBXShowGrid;
- ::sfx2::sidebar::ControllerItem maLineColorControl;
::sfx2::sidebar::ControllerItem maLineStyleControl;
::sfx2::sidebar::ControllerItem maBorderOuterControl;
::sfx2::sidebar::ControllerItem maBorderInnerControl;
@@ -97,11 +97,6 @@ private:
Image maIMGLineStyle8;
Image maIMGLineStyle9;
- // cell line color(s)
- Color maLineColor;
- Color maTLBRColor;
- Color maBLTRColor;
-
// BorderStyle defines
sal_uInt16 mnIn;
sal_uInt16 mnOut;
@@ -114,7 +109,6 @@ private:
sal_uInt16 mnBLTRDis;
/// bitfield
- bool mbLineColorAvailable : 1;
bool mbBorderStyleAvailable : 1;
// CellBorder defines
@@ -132,7 +126,6 @@ private:
bool mbBLTR : 1;
// popups
- svx::sidebar::ColorPopup maLineColorPopup;
::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup;
::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup;
@@ -140,15 +133,10 @@ private:
::sfx2::sidebar::EnumContext maContext;
SfxBindings* mpBindings;
- DECL_LINK(TbxLineColorSelectHdl, ToolBox*);
DECL_LINK(TbxCellBorderSelectHdl, ToolBox*);
DECL_LINK(TbxLineStyleSelectHdl, ToolBox*);
DECL_LINK(CBOXGridShowClkHdl, void*);
- // for line color picker
- svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent);
- void SetLineColor(const OUString& rsColorName, const Color aColor);
-
// for CellLineStyle popup
svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent);
void EndCellLineStylePopupMode(void);
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
index 18ef971..4049151 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
@@ -65,26 +65,6 @@ Image IMG_LINE_STYLE9
ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750.png";};
};
-// line color popup
-
-Control RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR
-{
- OutputSize = TRUE;
- DialogControl = TRUE;
- Border = FALSE;
- Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT );
-
- Control VS_LINECOLOR
- {
- HelpID = HID_PROPERTYPANEL_LINE_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";
- };
-};
-
// cell line style popup
Control RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE
diff --git a/sc/uiconfig/scalc/ui/sidebarcellappearance.ui b/sc/uiconfig/scalc/ui/sidebarcellappearance.ui
index 26a9bb1..f82f4b6 100644
--- a/sc/uiconfig/scalc/ui/sidebarcellappearance.ui
+++ b/sc/uiconfig/scalc/ui/sidebarcellappearance.ui
@@ -157,7 +157,7 @@
</packing>
</child>
<child>
- <object class="GtkToolbar" id="borderlinecolor">
+ <object class="sfxlo-SidebarToolBox" id="borderlinecolor">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
@@ -165,7 +165,6 @@
<property name="tooltip_text" translatable="yes">Select the line color of the borders.</property>
<child>
<object class="GtkMenuToolButton" id="linecolor">
- <property name="use_action_appearance">False</property>
<property name="width_request">105</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -176,7 +175,6 @@
<property name="hexpand">True</property>
<property name="use_action_appearance">False</property>
<property name="action_name">.uno:FrameLineColor</property>
- <property name="label" translatable="no">toolbutton1</property>
<property name="use_underline">True</property>
</object>
<packing>
commit 67340db67598b80045412ff653d399782c32f21e
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Nov 3 14:48:58 2014 +0200
Related: fdo#84844 Prepare border color status update
The Sidebar button handles also the color of diagonal lines.
Change-Id: I26d75472a8c9ca482274797127994d4546b1b3e8
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 0f9db2f..2f90a13 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -42,6 +42,7 @@
SvxColorToolBoxControl
----------------------
Item type: SvxColorItem
+ SvxLineItem
SfxBoolItem
XLineColorItem
and XFillColorItem
@@ -216,6 +217,19 @@ public:
};
+class BorderColorStatus
+{
+ Color maColor;
+ Color maTLBRColor;
+ Color maBLTRColor;
+public:
+ BorderColorStatus();
+ ~BorderColorStatus();
+ void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ Color GetColor();
+};
+
+
// class SvxColorToolBoxControl --------------------------------------
class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
@@ -224,6 +238,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater;
PaletteManager mPaletteManager;
+ BorderColorStatus maBorderColorStatus;
bool bSidebarType;
DECL_LINK( SelectedHdl, Color* );
public:
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index b7f5681..6cfecdf 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -29,6 +29,8 @@
#include <svx/PaletteManager.hxx>
#include <vcl/lstbox.hxx>
+class BorderColorStatus;
+
class SvxColorWindow_Impl : public SfxPopupWindow
{
using FloatingWindow::StateChanged;
@@ -46,6 +48,7 @@ private:
Link maSelectedLink;
PaletteManager& mrPaletteManager;
+ BorderColorStatus& mrBorderColorStatus;
DECL_LINK( SelectHdl, SvxColorValueSet* );
DECL_LINK( SelectPaletteHdl, void *);
@@ -59,6 +62,7 @@ protected:
public:
SvxColorWindow_Impl( const OUString& rCommand,
PaletteManager& rPaletteManager,
+ BorderColorStatus& rBorderColorStatus,
sal_uInt16 nSlotId,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
const OUString& rWndTitle,
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index f42b853..5873589 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1126,6 +1126,7 @@ void SvxFontNameBox_Impl::Select()
SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
PaletteManager& rPaletteManager,
+ BorderColorStatus& rBorderColorStatus,
sal_uInt16 nSlotId,
const Reference< XFrame >& rFrame,
const OUString& rWndTitle,
@@ -1136,7 +1137,8 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
rFrame ),
theSlotId( nSlotId ),
maCommand( rCommand ),
- mrPaletteManager( rPaletteManager )
+ mrPaletteManager( rPaletteManager ),
+ mrBorderColorStatus( rBorderColorStatus )
{
get(mpPaletteListBox, "palette_listbox");
get(mpButtonAutoColor, "auto_color_button");
@@ -1217,6 +1219,11 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
AddStatusListener( ".uno:ColorTableState" );
AddStatusListener( maCommand );
+ if ( maCommand == ".uno:FrameLineColor" )
+ {
+ AddStatusListener( ".uno:BorderTLBR" );
+ AddStatusListener( ".uno:BorderBLTR" );
+ }
}
SvxColorWindow_Impl::~SvxColorWindow_Impl()
@@ -1230,7 +1237,7 @@ void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
SfxPopupWindow* SvxColorWindow_Impl::Clone() const
{
- return new SvxColorWindow_Impl( maCommand, mrPaletteManager, theSlotId, GetFrame(), GetText(), GetParent() );
+ return new SvxColorWindow_Impl( maCommand, mrPaletteManager, mrBorderColorStatus, theSlotId, GetFrame(), GetText(), GetParent() );
}
IMPL_LINK(SvxColorWindow_Impl, SelectHdl, SvxColorValueSet*, pColorSet)
@@ -1310,40 +1317,133 @@ bool SvxColorWindow_Impl::Close()
void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
{
- if (( SfxItemState::DISABLED != eState ) && pState )
+ if ( nSID == SID_COLOR_TABLE )
{
- if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
+ if ( SfxItemState::DEFAULT == eState && mrPaletteManager.GetPalette() == 0 )
{
- if ( mrPaletteManager.GetPalette() == 0 )
- {
- mrPaletteManager.ReloadColorSet(*mpColorSet);
- mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
- }
+ mrPaletteManager.ReloadColorSet(*mpColorSet);
+ mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
}
- else if ( SfxItemState::DEFAULT <= eState )
- {
- mpColorSet->SetNoSelection();
+ }
+ else
+ {
+ mpColorSet->SetNoSelection();
+ Color aColor( COL_TRANSPARENT );
- Color aColor;
+ if ( nSID == SID_FRAME_LINECOLOR
+ || nSID == SID_ATTR_BORDER_DIAG_TLBR
+ || nSID == SID_ATTR_BORDER_DIAG_BLTR )
+ {
+ mrBorderColorStatus.StateChanged( nSID, eState, pState );
+ aColor = mrBorderColorStatus.GetColor();
+ }
+ else if ( SfxItemState::DEFAULT <= eState && pState )
+ {
if ( pState->ISA( SvxColorItem ) )
aColor = static_cast<const SvxColorItem*>(pState)->GetValue();
else if ( pState->ISA( XLineColorItem ) )
aColor = static_cast<const XLineColorItem*>(pState)->GetColorValue();
else if ( pState->ISA( XFillColorItem ) )
aColor = static_cast<const XFillColorItem*>(pState)->GetColorValue();
+ }
+
+ if ( aColor == COL_TRANSPARENT )
+ return;
- for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i )
+ for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i )
+ {
+ if ( aColor == mpColorSet->GetItemColor(i) )
{
- if ( aColor == mpColorSet->GetItemColor(i) )
- {
- mpColorSet->SelectItem(i);
- return;
- }
+ mpColorSet->SelectItem(i);
+ break;
}
}
}
}
+
+BorderColorStatus::BorderColorStatus() :
+ maColor( COL_TRANSPARENT ),
+ maTLBRColor( COL_TRANSPARENT ),
+ maBLTRColor( COL_TRANSPARENT )
+{
+}
+
+BorderColorStatus::~BorderColorStatus()
+{
+}
+
+void BorderColorStatus::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState )
+{
+ if ( SfxItemState::DEFAULT <= eState && pState )
+ {
+ if ( nSID == SID_FRAME_LINECOLOR && pState->ISA( SvxColorItem ) )
+ {
+ maColor = static_cast< const SvxColorItem* >(pState)->GetValue();
+ }
+ else if ( pState->ISA( SvxLineItem ) )
+ {
+ const SvxBorderLine* pLine = static_cast< const SvxLineItem* >(pState)->GetLine();
+ Color aColor ( COL_TRANSPARENT );
+ if ( pLine )
+ aColor = pLine->GetColor();
+
+ if ( nSID == SID_ATTR_BORDER_DIAG_TLBR )
+ maTLBRColor = aColor;
+ else if ( nSID == SID_ATTR_BORDER_DIAG_BLTR )
+ maBLTRColor = aColor;
+ }
+ }
+ else if ( nSID == SID_FRAME_LINECOLOR )
+ maColor = COL_TRANSPARENT;
+ else if ( nSID == SID_ATTR_BORDER_DIAG_TLBR )
+ maTLBRColor = COL_TRANSPARENT;
+ else if ( nSID == SID_ATTR_BORDER_DIAG_BLTR )
+ maBLTRColor = COL_TRANSPARENT;
+}
+
+Color BorderColorStatus::GetColor()
+{
+ bool bHasColor = maColor != COL_TRANSPARENT;
+ bool bHasTLBRColor = maTLBRColor != COL_TRANSPARENT;
+ bool bHasBLTRColor = maBLTRColor != COL_TRANSPARENT;
+
+ if ( !bHasColor && bHasTLBRColor && !bHasBLTRColor )
+ return maTLBRColor;
+ else if ( !bHasColor && !bHasTLBRColor && bHasBLTRColor )
+ return maBLTRColor;
+ else if ( bHasColor && bHasTLBRColor && !bHasBLTRColor )
+ {
+ if ( maColor == maTLBRColor )
+ return maColor;
+ else
+ return maBLTRColor;
+ }
+ else if ( bHasColor && !bHasTLBRColor && bHasBLTRColor )
+ {
+ if ( maColor == maBLTRColor )
+ return maColor;
+ else
+ return maTLBRColor;
+ }
+ else if ( !bHasColor && bHasTLBRColor && bHasBLTRColor )
+ {
+ if ( maTLBRColor == maBLTRColor )
+ return maTLBRColor;
+ else
+ return maColor;
+ }
+ else if ( bHasColor && bHasTLBRColor && bHasBLTRColor )
+ {
+ if ( maColor == maTLBRColor && maColor == maBLTRColor )
+ return maColor;
+ else
+ return COL_TRANSPARENT;
+ }
+ return maColor;
+}
+
+
SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) :
SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
aFrameSet ( this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
@@ -2357,6 +2457,8 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
case SID_FRAME_LINECOLOR:
addStatusListener( OUString( ".uno:FrameLineColor" ));
+ addStatusListener( OUString( ".uno:BorderTLBR" ));
+ addStatusListener( OUString( ".uno:BorderBLTR" ));
mPaletteManager.SetLastColor( COL_BLUE );
break;
@@ -2399,6 +2501,7 @@ SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
new SvxColorWindow_Impl(
m_aCommandURL,
mPaletteManager,
+ maBorderColorStatus,
GetSlotId(),
m_xFrame,
SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ),
@@ -2435,7 +2538,8 @@ SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
pColorWin->StartSelection();
SetPopupWindow( pColorWin );
- pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) );
+ if ( !bSidebarType )
+ pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) );
return pColorWin;
}
@@ -2449,35 +2553,30 @@ IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, Color*, pColor)
void SvxColorToolBoxControl::StateChanged(
sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
{
- ToolBox& rTbx = GetToolBox();
- sal_uInt16 nId = GetId();
- rTbx.EnableItem( nId, SfxItemState::DISABLED != eState );
- rTbx.SetItemState( nId, ( SfxItemState::DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE );
-
if ( nSID == SID_ATTR_CHAR_COLOR_EXT || nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT )
+ SfxToolBoxControl::StateChanged( nSID, eState, pState );
+ else if ( bSidebarType )
{
- if ( pState && SfxItemState::DONTCARE != eState )
+ Color aColor( COL_TRANSPARENT );
+
+ if ( nSID == SID_FRAME_LINECOLOR
+ || nSID == SID_ATTR_BORDER_DIAG_TLBR
+ || nSID == SID_ATTR_BORDER_DIAG_BLTR )
{
- const SfxBoolItem* pBool = static_cast< const SfxBoolItem* >( pState );
- rTbx.CheckItem( nId, pBool && pBool->GetValue() );
+ maBorderColorStatus.StateChanged( nSID, eState, pState );
+ aColor = maBorderColorStatus.GetColor();
+ }
+ else if ( SfxItemState::DEFAULT <= eState && pState )
+ {
+ if ( pState->ISA( SvxColorItem ) )
+ aColor = static_cast< const SvxColorItem* >(pState)->GetValue();
+ else if ( pState->ISA( XLineColorItem ) )
+ aColor = static_cast< const XLineColorItem* >(pState)->GetColorValue();
+ else if ( pState->ISA( XFillColorItem ) )
+ aColor = static_cast< const XFillColorItem* >(pState)->GetColorValue();
}
- }
- else if ( bSidebarType && SfxItemState::DEFAULT <= eState )
- {
- Color aColor;
- if ( pState->ISA( SvxColorItem ) )
- aColor = static_cast< const SvxColorItem* >(pState)->GetValue();
- else if ( pState->ISA( XLineColorItem ) )
- aColor = static_cast< const XLineColorItem* >(pState)->GetColorValue();
- else if ( pState->ISA( XFillColorItem ) )
- aColor = static_cast< const XFillColorItem* >(pState)->GetColorValue();
-
pBtnUpdater->Update( aColor );
}
- else if ( bSidebarType )
- {
- pBtnUpdater->Update( COL_TRANSPARENT );
- }
}
void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
More information about the Libreoffice-commits
mailing list