[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - include/svx svx/source sw/source
Maxim Monastirsky
momonasmon at gmail.com
Mon Jun 25 13:15:49 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 415368daf3047a6dfb2577822a72f65df7374df8
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>
(cherry picked from commit 2fd31c75b677b145cf56404348857e60befcabff)
Reviewed-on: https://gerrit.libreoffice.org/56375
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 1f5079f69a22..57d1dcba5f22 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 9b67a77d87ba..f73b61cc77ba 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2773,7 +2773,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)
{
@@ -2898,9 +2897,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);
@@ -2963,11 +2959,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 ae9eff3704e9..96fe601d5546 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1228,16 +1228,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 ) )
{
@@ -1254,7 +1261,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