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

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: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst 76d9d6c9
......@@ -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);
......
......@@ -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());
......
......@@ -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)
{
......
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