From cac80ccacf917e7e80f75c3574cc2a300f1d775a Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Fri, 26 Jan 2018 17:31:35 -0900 Subject: tdf#105225 A character highlighting tab page based on the area tab page Change-Id: Icd76af14129ff742c77d7f19582c3cbc0520525e Reviewed-on: https://gerrit.libreoffice.org/48737 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- cui/source/inc/backgrnd.hxx | 5 +++-- cui/source/tabpages/backgrnd.cxx | 11 ++++++++--- sw/source/ui/chrdlg/chardlg.cxx | 2 +- sw/source/uibase/shells/textsh1.cxx | 12 ++++++++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx index 88131fa61b80..e25b2043cbc5 100644 --- a/cui/source/inc/backgrnd.hxx +++ b/cui/source/inc/backgrnd.hxx @@ -26,6 +26,8 @@ #include #include +#include "cuitabarea.hxx" + class BackgroundPreviewImpl; class SvxOpenGraphicDialog; struct SvxBackgroundTable_Impl; @@ -139,11 +141,10 @@ private: DECL_LINK( TblDestinationHdl_Impl, ListBox&, void ); }; -#include "cuitabarea.hxx" - class SvxBkgTabPage : public SvxAreaTabPage { VclPtr m_pTblLBox; + bool bHighlighting : 1; public: using SvxAreaTabPage::DeactivatePage; diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 6ef959108360..448599bebb2f 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -53,6 +53,8 @@ #include #include +#include + using namespace css; // table background @@ -1442,11 +1444,10 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet) } } -#include - SvxBkgTabPage::SvxBkgTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : SvxAreaTabPage( pParent, rInAttrs ), - m_pTblLBox(nullptr) + m_pTblLBox(nullptr), + bHighlighting(false) { VclPtr pBtn; get(pBtn, "btngradient"); pBtn->Hide(); @@ -1516,6 +1517,8 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet ) break; } } + else if ( bHighlighting ) + nSlot = SID_ATTR_BRUSH_CHAR; sal_uInt16 nWhich = GetWhich(nSlot); @@ -1568,6 +1571,8 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) m_pTblLBox->SelectEntryPos(0); m_pTblLBox->Show(); } + else if (nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING) + bHighlighting = bool(nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING); } SvxAreaTabPage::PageCreated( aSet ); } diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index c0c70d3743cc..7f7007d732ab 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -76,7 +76,7 @@ SwCharDlg::SwCharDlg(vcl::Window* pParent, SwView& rVw, const SfxItemSet& rCoreS m_nCharPosId = AddTabPage("position", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), nullptr ); m_nCharTwoId = AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), nullptr ); m_nCharUrlId = AddTabPage("hyperlink", SwCharURLPage::Create, nullptr); - m_nCharBgdId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), nullptr ); + m_nCharBgdId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), nullptr ); m_nCharBrdId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), nullptr ); SvtCJKOptions aCJKOptions; diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index cac6f2f6363f..65f4b25ce6d2 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -120,6 +120,9 @@ #include #include +#include +#include + using namespace ::com::sun::star; using namespace com::sun::star::beans; using namespace ::com::sun::star::container; @@ -138,6 +141,7 @@ void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const RES_CHRATR_BEGIN, RES_CHRATR_END - 1, RES_TXTATR_INETFMT, RES_TXTATR_INETFMT, RES_BACKGROUND, RES_SHADOW, + XATTR_FILLSTYLE, XATTR_FILLCOLOR, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, SID_HTML_MODE, SID_HTML_MODE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, @@ -174,6 +178,10 @@ void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const VclPtr pDlg; if ( bUseDialog && GetActiveView() ) { + sal_uInt16 nWhich = rWrtSh.GetView().GetPool().GetWhich( SID_ATTR_BRUSH_CHAR ); + SvxBrushItem aBrushItem(static_cast(pCoreSet->Get(nWhich))); + setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, *pCoreSet); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); @@ -224,6 +232,10 @@ static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std: SfxItemSet aTmpSet( *pSet ); ::ConvertAttrGenToChar(aTmpSet, *pCoreSet); + // Clear these to prevent paragraph background being set. + aTmpSet.ClearItem( rWrtSh.GetView().GetPool().GetWhich( XATTR_FILLSTYLE ) ); + aTmpSet.ClearItem( rWrtSh.GetView().GetPool().GetWhich( XATTR_FILLCOLOR ) ); + const SfxPoolItem* pSelectionItem; bool bInsert = false; sal_Int32 nInsert = 0; -- cgit