diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2018-06-24 17:38:05 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2018-06-25 01:54:27 +0200 |
commit | 2fd31c75b677b145cf56404348857e60befcabff (patch) | |
tree | 4afc27f939582d8b38f89da5f41d8a6d1291bf2a /sw/source/uibase/shells | |
parent | 76d9d6c9bf0167d4203d7e2f6867254687915caa (diff) |
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@gmail.com>
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
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) { |