diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2015-03-18 10:27:56 +0100 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2015-03-21 16:19:08 +0100 |
commit | 15931deb7e4689cd885ff05439bab381f0478b2f (patch) | |
tree | 7019776aafcff9b1068cfe7666244a4399dcb03f | |
parent | f880962f5bf26bfaef06bd3f9e67e2d901a2e74c (diff) |
Char highlight: editing by Character Properties dialog
Modify character highlight using character dialog's
"Background" tab.
Change-Id: I693aebe1915e6b77af9919acf223fb2c87608516
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 86a9cb190772..a105aae3aa8b 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -122,17 +122,32 @@ void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh) void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode) { - // Background + // Background / highlight { + // Always use the visible background const SfxPoolItem *pTmpBrush; - if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, true, &pTmpBrush ) ) + bool bUseHighlight = false; + if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_HIGHLIGHT, true, &pTmpBrush ) ) { SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) ); - aTmpBrush.SetWhich( RES_BACKGROUND ); - rSet.Put( aTmpBrush ); + if( aTmpBrush.GetColor() != COL_TRANSPARENT ) + { + aTmpBrush.SetWhich( RES_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); } - else - rSet.ClearItem(RES_BACKGROUND); } if( nMode == CONV_ATTR_STD ) @@ -162,7 +177,7 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode) void ConvertAttrGenToChar(SfxItemSet& rSet, const sal_uInt8 nMode) { - // Background + // Background / highlighting { const SfxPoolItem *pTmpBrush; if( SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pTmpBrush ) ) @@ -170,6 +185,10 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const sal_uInt8 nMode) SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) ); 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) ); } rSet.ClearItem( RES_BACKGROUND ); } |