Kaydet (Commit) 4c5ce126 authored tarafından Rohan Kumar's avatar Rohan Kumar Kaydeden (comit) Katarina Behrens

Fix highlighting in sd::FuTemplate

sd::FuTemplate Highlighting tab's colors don't stick anymore.

Change-Id: Idb1701ddf1f7d47758a4ef8ebe6705ee6ff16c11
Reviewed-on: https://gerrit.libreoffice.org/35800Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst bffb5437
......@@ -31,6 +31,7 @@
#include <vcl/graph.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/numitem.hxx>
#include <editeng/colritem.hxx>
#include <svl/cjkoptions.hxx>
#include "DrawDocShell.hxx"
......@@ -63,6 +64,8 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
pOutSet ( nullptr ),
pOrgSet ( &rStyleBase.GetItemSet() )
{
const SfxPoolItem *pItem = nullptr;
if( IS_OUTLINE(ePO))
{
// Unfortunately, the Itemsets of our style sheets are not discreet..
......@@ -93,7 +96,6 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
pOutSet = new SfxItemSet( rStyleBase.GetItemSet() );
pOutSet->ClearItem();
const SfxPoolItem *pItem = nullptr;
// If there is no bullet item in this stylesheet, we get it
// from 'Outline 1' style sheet.
......@@ -110,10 +112,44 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
// preselect selected layer in dialog
aInputSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, 1<<GetOutlineLevel()));
SetInputSet( &aInputSet );
/*
* Adjusting item set since background tabpage can only work
* with SvxBrushItems, EE_CHAR_BKGCOLOR is SvxBackgroundColorItem.
*/
aInputSet.MergeRange(SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR);
pOutSet->MergeRange(SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR);
if ( aInputSet.GetItemState( EE_CHAR_BKGCOLOR, true, &pItem ) == SfxItemState::SET )
{
/* extract Color outta SvxBackColorItem */
Color aBackColor = static_cast<const SvxBackgroundColorItem*>(pItem)->GetValue();
/* make new SvxBrushItem with this Color */
SvxBrushItem aBrushItem( aBackColor, SID_ATTR_BRUSH_CHAR );
aInputSet.ClearItem( EE_CHAR_BKGCOLOR );
/* and stick it into the set */
aInputSet.Put( aBrushItem );
}
}
else
SetInputSet( pOrgSet );
else {
/*
* same here
*/
aInputSet.SetRanges(pOrgSet->GetRanges());
aInputSet.MergeRange(SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR);
aInputSet.Put(*pOrgSet, false);
if ( pOrgSet->GetItemState( EE_CHAR_BKGCOLOR, true, &pItem ) == SfxItemState::SET )
{
/* extract Color outta SvxBackColorItem */
Color aBackColor = static_cast<const SvxBackgroundColorItem*>(pItem)->GetValue();
/* make new SvxBrushItem with this Color */
SvxBrushItem aBrushItem( aBackColor, SID_ATTR_BRUSH_CHAR );
aInputSet.ClearItem( EE_CHAR_BKGCOLOR );
/* and stick it into the set */
aInputSet.Put( aBrushItem );
}
}
SetInputSet( &aInputSet );
SvxColorListItem aColorListItem(*static_cast<const SvxColorListItem*>( mpDocShell->GetItem( SID_COLOR_TABLE ) ) );
SvxGradientListItem aGradientListItem(*static_cast<const SvxGradientListItem*>( mpDocShell->GetItem( SID_GRADIENT_LIST ) ) );
......
......@@ -105,10 +105,6 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
SfxStyleSheetBase* pStyleSheet = nullptr;
const SfxPoolItem* pItem;
static const sal_uInt16 aRanges[] = {
EE_ITEMS_START, EE_ITEMS_END,
SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR
};
SfxStyleFamily nFamily = (SfxStyleFamily)USHRT_MAX;
if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY,
false, &pItem ))
......@@ -305,15 +301,6 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
ScopedVclPtr<SfxAbstractTabDialog> pPresDlg;
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
bool bOldDocInOtherLanguage = false;
SfxItemSet aNewAttr(mpViewShell->GetPool(), aRanges);
if( aNewAttr.GetItemState( XATTR_FILLBACKGROUND, true, &pItem ) == SfxItemState::SET)
{
Color aBackColor = static_cast<const SvxBackgroundColorItem*>(pItem)->GetValue();
SvxBrushItem aBrushItem(aBackColor, XATTR_FILLBACKGROUND);
aNewAttr.ClearItem(XATTR_FILLBACKGROUND);
aNewAttr.Put(aBrushItem);
}
SfxStyleFamily eFamily = pStyleSheet->GetFamily();
......@@ -412,15 +399,17 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
if (eFamily == SD_STYLE_FAMILY_PSEUDO)
{
SfxItemSet aTempSet(*pOutSet);
static_cast<SdStyleSheet*>(pStyleSheet)->AdjustToFontHeight(aTempSet);
/* Extract SvxBrushItem out of set and insert SvxBackgroundColorItem */
const SvxBrushItem* pBrushItem = aTempSet.GetItem<SvxBrushItem>( SID_ATTR_BRUSH_CHAR );
const SvxBrushItem* pBrushItem = aTempSet.GetItem<SvxBrushItem>(XATTR_FILLBACKGROUND);
if( pBrushItem )
if ( pBrushItem )
{
SvxBackgroundColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR);
aTempSet.ClearItem(XATTR_FILLBACKGROUND);
aTempSet.Put(aBackColorItem);
SvxBackgroundColorItem aBackColorItem(pBrushItem->GetColor(), EE_CHAR_BKGCOLOR);
aTempSet.ClearItem( EE_CHAR_BKGCOLOR );
aTempSet.Put( aBackColorItem );
}
static_cast<SdStyleSheet*>(pStyleSheet)->AdjustToFontHeight(aTempSet);
/* Special treatment: reset the INVALIDS to
NULL-Pointer (otherwise INVALIDs or pointer point
to DefaultItems in the template; both would
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment