sw/source/uibase/docvw/edtwin.cxx | 6 -- sw/source/uibase/shells/textsh1.cxx | 74 +++++++---------------------------- sw/source/uibase/uiview/viewling.cxx | 2 3 files changed, 18 insertions(+), 64 deletions(-)
New commits: commit 6884550c20f95a635357ad848799a1aae555968a Author: Maxim Monastirsky <momonas...@gmail.com> Date: Wed Jan 18 23:28:16 2017 +0200 tdf#105409 Use ScopedVclPtr so disposeAndClear is called. Change-Id: I40da317ac03f815c8664e8a4648870c2066f9650 diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 2152477..0e74a3d 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -717,7 +717,7 @@ bool SwView::ExecSpellPopup(const Point& rPt) aEvent.SourceWindow = VCLUnoHelper::GetInterface( m_pEditWin ); aEvent.ExecutePosition.X = aPixPos.X(); aEvent.ExecutePosition.Y = aPixPos.Y(); - VclPtr<Menu> pMenu; + ScopedVclPtr<Menu> pMenu; OUString sMenuName = bUseGrammarContext ? OUString("private:resource/GrammarContextMenu") : OUString("private:resource/SpellContextMenu"); commit ba19b9fd5763c305569ce6ae4120c9e17de6afd4 Author: Maxim Monastirsky <momonas...@gmail.com> Date: Wed Jan 18 00:13:27 2017 +0200 sw: Unify char highlight handlers SID_ATTR_CHAR_COLOR_BACKGROUND code was mostly a copy-paste of SID_ATTR_CHAR_COLOR_BACKGROUND_EXT. Change-Id: I713bfd72a2f51f2d0ff10b36e9e0a9150b13a640 diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 60ab000..eac6d39 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4823,11 +4823,9 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) switch( m_pApplyTempl->nColor ) { case SID_ATTR_CHAR_COLOR_EXT: - case SID_ATTR_CHAR_COLOR2: nId = RES_CHRATR_COLOR; break; case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: - case SID_ATTR_CHAR_COLOR_BACKGROUND: nId = RES_CHRATR_BACKGROUND; break; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 081b3c3..350a7f1 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1192,73 +1192,21 @@ void SwTextShell::Execute(SfxRequest &rReq) } break; case SID_ATTR_CHAR_COLOR_BACKGROUND: - { - Color aSet; - if(pItem) - aSet = static_cast<const SvxColorItem*>(pItem)->GetValue(); - else - aSet = COL_TRANSPARENT; - - SwEditWin& rEdtWin = GetView().GetEditWin(); - rEdtWin.SetWaterCanTextBackColor(aSet); - SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - - if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI())) - { - rWrtSh.StartUndo( UNDO_INSATTR ); - SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND); - aBrushItem.SetColor(aSet); - rWrtSh.SetAttrItem( aBrushItem ); - - // Remove MS specific highlight when background is set - rWrtSh.SetAttrItem( SvxBrushItem(RES_CHRATR_HIGHLIGHT) ); - - // Remove shading marker - SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(), RES_CHRATR_GRABBAG, RES_CHRATR_GRABBAG ); - rWrtSh.GetCurAttr( aCoreSet ); - - const SfxPoolItem *pTmpItem; - if( SfxItemState::SET == aCoreSet.GetItemState( RES_CHRATR_GRABBAG, false, &pTmpItem ) ) - { - SfxGrabBagItem aGrabBag(*static_cast<const SfxGrabBagItem*>(pTmpItem)); - std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); - auto aIterator = rMap.find("CharShadingMarker"); - if( aIterator != rMap.end() ) - { - aIterator->second = uno::makeAny(false); - } - rWrtSh.SetAttrItem( aGrabBag ); - } - rWrtSh.EndUndo( UNDO_INSATTR ); - } - else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) - { - GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT); - } - - rReq.Done(); - } - break; case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: case SID_ATTR_CHAR_COLOR_EXT: { + Color aSet = pItem ? static_cast<const SvxColorItem*>(pItem)->GetValue() : COL_TRANSPARENT; SwEditWin& rEdtWin = GetView().GetEditWin(); - if (pItem) - { - // The reason we need this argument here is that when a toolbar is closed - // and reopened, its color resets, while SwEditWin still holds the old one. - Color aSet = static_cast<const SvxColorItem*>(pItem)->GetValue(); - if( nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT ) - rEdtWin.SetWaterCanTextBackColor(aSet); - else - rEdtWin.SetWaterCanTextColor(aSet); - } + if (nSlot != SID_ATTR_CHAR_COLOR_EXT) + rEdtWin.SetWaterCanTextBackColor(aSet); + else if (pItem) + rEdtWin.SetWaterCanTextColor(aSet); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); SwApplyTemplate aTempl; - if ( rWrtSh.HasSelection() ) + if (!pApply && (rWrtSh.HasSelection() || rReq.IsAPI())) { - if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) + if (nSlot != SID_ATTR_CHAR_COLOR_EXT) { rWrtSh.StartUndo( UNDO_INSATTR ); rWrtSh.SetAttrItem( @@ -1289,6 +1237,14 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.SetAttrItem( SvxColorItem( rEdtWin.GetWaterCanTextColor(), RES_CHRATR_COLOR) ); } + else if (nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND) + { + if (!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) + { + aTempl.nColor = SID_ATTR_CHAR_COLOR_BACKGROUND_EXT; + rEdtWin.SetApplyTemplate(aTempl); + } + } else { if(!pApply || pApply->nColor != nSlot) commit 79d2cb796a04a8cd1005313019802e63e2ec7ede Author: Maxim Monastirsky <momonas...@gmail.com> Date: Wed Jan 18 00:01:32 2017 +0200 Drop SwEditWin:: prefix Change-Id: I86b810a6ad94255a5f2a59392ba85775a488ba12 diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index c61e8d5..60ab000 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4838,9 +4838,9 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) m_pApplyTempl->nUndo = std::min(m_pApplyTempl->nUndo, rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount()); if (nId == RES_CHRATR_BACKGROUND) - rSh.SetAttrItem( SvxBrushItem( SwEditWin::m_aWaterCanTextBackColor, nId ) ); + rSh.SetAttrItem( SvxBrushItem( m_aWaterCanTextBackColor, nId ) ); else - rSh.SetAttrItem( SvxColorItem( SwEditWin::m_aWaterCanTextColor, nId ) ); + rSh.SetAttrItem( SvxColorItem( m_aWaterCanTextColor, nId ) ); rSh.UnSetVisibleCursor(); rSh.EnterStdMode(); rSh.SetVisibleCursor(aDocPt); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits