diff options
-rw-r--r-- | cui/source/inc/backgrnd.hxx | 3 | ||||
-rw-r--r-- | cui/source/tabpages/backgrnd.cxx | 36 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 21 |
3 files changed, 40 insertions, 20 deletions
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx index c12a33b2253a..2aefa5d2e22f 100644 --- a/cui/source/inc/backgrnd.hxx +++ b/cui/source/inc/backgrnd.hxx @@ -25,6 +25,7 @@ #include <svx/SvxColorValueSet.hxx> #include <svx/dlgctrl.hxx> #include <editeng/brushitem.hxx> +#include <memory> class BackgroundPreviewImpl; class SvxOpenGraphicDialog; @@ -110,6 +111,7 @@ private: bool bAllowShowSelector : 1; bool bIsGraphicValid : 1; bool bLinkOnly : 1; + bool bHighlighting : 1; Graphic aBgdGraphic; OUString aBgdGraphicPath; OUString aBgdGraphicFilter; @@ -119,6 +121,7 @@ private: SvxBackgroundTable_Impl* pTableBck_Impl;///< Items for Sw-Table must be corrected SvxBackgroundPara_Impl* pParaBck_Impl;///< also for the paragraph style + std::unique_ptr<SvxBrushItem> pHighlighting; void FillColorValueSets_Impl(); void ShowColorUI_Impl(); diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index bc4b6c6bbfec..2e066a35b7db 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -345,10 +345,12 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe , bAllowShowSelector(true) , bIsGraphicValid(false) , bLinkOnly(false) + , bHighlighting(false) , pPageImpl(new SvxBackgroundPage_Impl) , pImportDlg(NULL) , pTableBck_Impl(NULL) , pParaBck_Impl(NULL) + , pHighlighting(nullptr) { get(m_pAsGrid, "asgrid"); get(m_pSelectTxt, "asft"); @@ -532,6 +534,10 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) break; } } + else if( bHighlighting ) + { + nSlot = SID_ATTR_BRUSH_CHAR; + } //#111173# the destination item is missing when the parent style has been changed if(USHRT_MAX == nDestValue && (m_pParaLBox->IsVisible()||m_pTblLBox->IsVisible())) nDestValue = 0; @@ -602,7 +608,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) TblDestinationHdl_Impl(m_pTblLBox); m_pTblLBox->SaveValue(); } - else + else if (m_pParaLBox->GetData() == m_pParaLBox) { sal_Int32 nValue = m_pParaLBox->GetSelectEntryPos(); @@ -637,6 +643,15 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) ParaDestinationHdl_Impl(m_pParaLBox); m_pParaLBox->SaveValue(); } + else if( bHighlighting ) + { + nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); + if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT ) + { + pBgdAttr = static_cast<const SvxBrushItem*>(&( rSet->Get( nWhich ) )); + pHighlighting.reset(new SvxBrushItem(*pBgdAttr)); + } + } } } @@ -748,6 +763,10 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet ) break; } } + else if( bHighlighting ) + { + nSlot = SID_ATTR_BRUSH_CHAR; + } sal_uInt16 nWhich = GetWhich( nSlot ); const SfxPoolItem* pOld = GetOldItem( *rCoreSet, nSlot ); @@ -942,6 +961,20 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet ) bModified |= true; } } + else if( bHighlighting ) + { + if( nSlot != SID_ATTR_BRUSH_CHAR ) + { + const SfxPoolItem* pOldChar = + GetOldItem( *rCoreSet, SID_ATTR_BRUSH_CHAR ); + if ( pOldChar && pHighlighting && + (*pHighlighting != *pOldChar || *pHighlighting != SvxBrushItem(SID_ATTR_BRUSH_CHAR))) + { + rCoreSet->Put( *pHighlighting ); + bModified |= true; + } + } + } return bModified; } @@ -1714,6 +1747,7 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet) if ( nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING ) { m_pBackGroundColorLabelFT->SetText("Highlighting Color"); + bHighlighting = true; } } } diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index d793a99775cf..4b4344ca0840 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -127,28 +127,15 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode) { // Always use the visible background const SfxPoolItem *pTmpBrush; - bool bUseHighlight = false; if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_HIGHLIGHT, true, &pTmpBrush ) ) { SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) ); if( aTmpBrush.GetColor() != COL_TRANSPARENT ) { - aTmpBrush.SetWhich( RES_BACKGROUND ); + aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND ); rSet.Put( aTmpBrush ); - bUseHighlight = true; } } - if( !bUseHighlight ) - { - if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, true, &pTmpBrush ) ) - { - SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) ); - aTmpBrush.SetWhich( RES_BACKGROUND ); - rSet.Put( aTmpBrush ); - } - else - rSet.ClearItem(RES_BACKGROUND); - } } if( nMode == CONV_ATTR_STD ) @@ -181,12 +168,8 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, const sa // Background / highlighting { const SfxPoolItem *pTmpItem; - if( SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pTmpItem ) ) + if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, false, &pTmpItem ) ) { - SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpItem) ); - aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND ); - rSet.Put( aTmpBrush ); - // Highlight is an MS specific thing, so remove it at the first time when LO modifies // this part of the imported document. rSet.Put( SvxBrushItem(RES_CHRATR_HIGHLIGHT) ); |