[Libreoffice-commits] core.git: include/svx svx/source sw/source
Maxim Monastirsky
momonasmon at gmail.com
Sun Jun 24 23:54:48 UTC 2018
include/svx/tbcontrl.hxx | 1 -
svx/source/tbxctrls/tbcontrl.cxx | 9 +--------
sw/source/uibase/shells/textsh1.cxx | 19 +++++++++++++------
3 files changed, 14 insertions(+), 15 deletions(-)
New commits:
commit 2fd31c75b677b145cf56404348857e60befcabff
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Jun 24 17:38:05 2018 +0300
tdf#117987 tdf#118138 Compare with the currently used color
... when deciding whether to toggle highlighting. Had to move
the whole thing into sw, as otherwise there is no way to
correctly handle the "brush" mode (as the toolbox controller
in svx has no way to know in advance which text will be
selected by the user).
Change-Id: Id2dec4c3647332e82260d12da1311b249f5b9c12
Reviewed-on: https://gerrit.libreoffice.org/56358
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index bf089f87153a..ded664983f21 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -212,7 +212,6 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public cppu::ImplInheritanceHelper<
std::shared_ptr<PaletteManager> m_xPaletteManager;
BorderColorStatus m_aBorderColorStatus;
bool m_bSplitButton;
- bool m_bIsNoFill;
sal_uInt16 m_nSlotId;
ColorSelectFunction m_aColorSelectFunction;
DECL_LINK(SelectedHdl, const NamedColor&, void);
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 5a9b89af6551..e8694d85d223 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2767,7 +2767,6 @@ com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation(
SvxColorToolBoxControl::SvxColorToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext ) :
ImplInheritanceHelper( rContext, nullptr, OUString() ),
m_bSplitButton(true),
- m_bIsNoFill(false),
m_nSlotId(0),
m_aColorSelectFunction(PaletteManager::DispatchColorCommand)
{
@@ -2892,9 +2891,6 @@ VclPtr<vcl::Window> SvxColorToolBoxControl::createPopupWindow( vcl::Window* pPar
IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const NamedColor&, rColor, void)
{
- if (m_xBtnUpdater->GetCurrentColor() != rColor.first)
- m_bIsNoFill = false;
-
m_xBtnUpdater->Update(rColor.first);
if (m_xPaletteManager)
m_xPaletteManager->SetLastColor(rColor.first);
@@ -2957,11 +2953,8 @@ void SvxColorToolBoxControl::execute(sal_Int16 /*nSelectModifier*/)
Color aColor = m_xPaletteManager->GetLastColor();
auto aArgs( comphelper::InitPropertySequence( {
- { m_aCommandURL.copy(5), css::uno::makeAny( COL_TRANSPARENT ) }
+ { m_aCommandURL.copy(5), css::uno::makeAny(aColor) }
} ) );
- if (!m_bIsNoFill)
- aArgs[0].Value <<= sal_Int32( m_xPaletteManager->GetLastColor() );
- m_bIsNoFill = !m_bIsNoFill;
dispatchCommand( aCommand, aArgs );
OUString sColorName = ("#" + aColor.AsRGBHexString().toAsciiUpperCase());
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 5495f890566c..e905d9667913 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1205,16 +1205,23 @@ void SwTextShell::Execute(SfxRequest &rReq)
if (nSlot != SID_ATTR_CHAR_COLOR_EXT)
{
rWrtSh.StartUndo( SwUndoId::INSATTR );
- rWrtSh.SetAttrItem(
- SvxBrushItem( rEdtWin.GetWaterCanTextBackColor(), RES_CHRATR_BACKGROUND) );
+
+ SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(), svl::Items<
+ RES_CHRATR_BACKGROUND, RES_CHRATR_BACKGROUND,
+ RES_CHRATR_GRABBAG, RES_CHRATR_GRABBAG>{} );
+ rWrtSh.GetCurAttr( aCoreSet );
+
+ // Remove highlight if already set of the same color
+ const SvxBrushItem& rBrushItem = aCoreSet.Get(RES_CHRATR_BACKGROUND);
+ if ( aSet == rBrushItem.GetColor() )
+ aSet = COL_TRANSPARENT;
+
+ rWrtSh.SetAttrItem( SvxBrushItem(aSet, RES_CHRATR_BACKGROUND) );
// Remove MS specific highlight when background is set
rWrtSh.SetAttrItem( SvxBrushItem(RES_CHRATR_HIGHLIGHT) );
// Remove shading marker
- SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(), svl::Items<RES_CHRATR_GRABBAG, RES_CHRATR_GRABBAG>{} );
- rWrtSh.GetCurAttr( aCoreSet );
-
const SfxPoolItem *pTmpItem;
if( SfxItemState::SET == aCoreSet.GetItemState( RES_CHRATR_GRABBAG, false, &pTmpItem ) )
{
@@ -1231,7 +1238,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
}
else
rWrtSh.SetAttrItem(
- SvxColorItem( rEdtWin.GetWaterCanTextColor(), RES_CHRATR_COLOR) );
+ SvxColorItem(aSet, RES_CHRATR_COLOR) );
}
else if (nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND)
{
More information about the Libreoffice-commits
mailing list