[Libreoffice-commits] core.git: Branch 'feature/highlighting' - 3 commits - sw/source xmloff/source
Zolnai Tamás
zolnaitamas2000 at gmail.com
Sun Feb 22 03:25:21 PST 2015
sw/source/uibase/shells/basesh.cxx | 36 ++++++++++++++++++++++++++++++++++++
sw/source/uibase/utlui/uitool.cxx | 34 +++++++++++++++++++++++++++-------
xmloff/source/text/txtexppr.cxx | 10 ++++++++--
3 files changed, 71 insertions(+), 9 deletions(-)
New commits:
commit a72faa83239aaf75f5070bd3a2cd2b79b41238c7
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Sun Feb 22 11:48:42 2015 +0100
Char highlight: ODT export: be aware of transparent highlight
Change-Id: Ic8d524375a8312f64423d3f57487bfe2a76d07f8
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 2925aec..1300c3b 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
#include <tools/debug.hxx>
+#include <tools/color.hxx>
#include <xmloff/txtprmap.hxx>
#include <xmloff/xmlexp.hxx>
#include <xmloff/maptype.hxx>
@@ -1125,10 +1126,15 @@ void XMLTextExportPropertySetMapper::ContextFilter(
if( pClipState != NULL && pClip11State != NULL )
pClip11State->mnIndex = -1;
- // When both background attributes are available export only the highlight
+ // When both background attributes are available export the visible one
if( pCharHighlight && pCharBackground )
{
- pCharBackground->mnIndex = -1;
+ sal_uInt32 nColor = COL_TRANSPARENT;
+ pCharHighlight->maValue >>= nColor;
+ if( nColor == COL_TRANSPARENT )
+ pCharHighlight->mnIndex = -1;
+ else
+ pCharBackground->mnIndex = -1;
}
SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
commit ef1a27657c9e1a394a5662a211bdb38153c4d0ba
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Sun Feb 22 11:57:31 2015 +0100
Char highlight: "Background Color" toolbar item
Extend the usage of this item to text ranges.
Change-Id: Ia7873e671b3a256f4cecb31d00e408a694332159
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 6813b0a..09f4795 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2154,6 +2154,27 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
{
rSh.GetBoxBackground( aBrushItem );
}
+ else if(nSelType & nsSelectionType::SEL_TXT && rSh.HasSelection()) // text range selected
+ {
+ SfxItemSet aCoreSet(GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1);
+
+ rSh.GetCurAttr(aCoreSet);
+
+ // Always use the visible background
+ const SfxPoolItem *pTmpBrush;
+ if( SfxItemState::SET == aCoreSet.GetItemState( RES_CHRATR_HIGHLIGHT, true, &pTmpBrush ) )
+ {
+ aBrushItem = *static_cast<const SvxBrushItem*>(pTmpBrush);
+ }
+ if( aBrushItem.GetColor() == COL_TRANSPARENT )
+ {
+ if( SfxItemState::SET == aCoreSet.GetItemState( RES_CHRATR_BACKGROUND, true, &pTmpBrush ) )
+ {
+ aBrushItem = *static_cast<const SvxBrushItem*>(pTmpBrush);
+ }
+ }
+ aBrushItem.SetWhich(RES_BACKGROUND);
+ }
else
{
//UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
@@ -2213,6 +2234,10 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
{
rSh.GetBoxBackground( aBrushItem );
}
+ else if(nSelType & nsSelectionType::SEL_TXT && rSh.HasSelection()) // text range selected
+ {
+ // This is really necessary to get the brush item before set it??
+ }
else
{
//UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
@@ -2272,6 +2297,17 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
{
rSh.SetBoxBackground( aBrushItem );
}
+ else if(nSelType & nsSelectionType::SEL_TXT && rSh.HasSelection()) // text range selected
+ {
+ SfxItemSet aCoreSet(GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1);
+
+ aBrushItem.SetWhich( RES_CHRATR_BACKGROUND );
+ aCoreSet.Put( aBrushItem );
+
+ SvxBrushItem aTransparentBrush( RES_CHRATR_HIGHLIGHT );
+ aCoreSet.Put( aTransparentBrush );
+ rSh.SetAttrSet(aCoreSet);
+ }
else
{
//UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
commit e1673e2eddcfd91e7596c80ac57d5f3964b5f7f4
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Sat Feb 21 20:24:20 2015 +0100
Char highlight: character properties dialog
Modify character highlight using character dialog's
"Background" tab.
Change-Id: I693aebe1915e6b77af9919acf223fb2c87608516
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index 86a9cb1..ffa7ed4 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,14 +177,19 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode)
void ConvertAttrGenToChar(SfxItemSet& rSet, const sal_uInt8 nMode)
{
- // Background
+ // Background / highlight
{
+ // Highlight is an MS specific thing, so remove it at the first time when LO modifies
+ // this part of the imported document.
const SfxPoolItem *pTmpBrush;
if( SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pTmpBrush ) )
{
SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) );
aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
rSet.Put( aTmpBrush );
+
+ SvxBrushItem aTransparentBrush( RES_CHRATR_HIGHLIGHT );
+ rSet.Put( aTransparentBrush );
}
rSet.ClearItem( RES_BACKGROUND );
}
More information about the Libreoffice-commits
mailing list