summaryrefslogtreecommitdiffstats
path: root/cui
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2018-07-06 01:42:20 -0800
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-11-05 08:45:18 +0100
commit0dfb0f09f5582a33d16c5ad8659fab198d530b31 (patch)
tree8a651f0a9ad81004d85626b88c13d43e2c49aad9 /cui
parentloplugin:useuniqueptr in LocaleDataWrapper (diff)
downloadcore-0dfb0f09f5582a33d16c5ad8659fab198d530b31.tar.gz
core-0dfb0f09f5582a33d16c5ad8659fab198d530b31.zip
tdf#105225 new background tab page
This patch allows the new background/highlighting tab page and derived from area tab page to work correctly in the same tab dialog. It also provides a cleaner way to use the new background tab page by setting brush item as fill attributes to target set in the background tab page created method. Previously if the new background tab page and the area tab page were used in the same tab page dialog one would affect the other due to the same use of pool fill items. This patch makes a local copy of the attribute item set passed and then passes that set along to the parent class area tab page on each activation/deactivation. Tab page dialogs that use both the background and area tab pages are: Writer Paragraph Styles, Impress Presentations Styles and Drawing/ Graphics Styles, and Draw Drawing/Graphics Styles. All new background tab page merged patches have been reworked in this patch and remaining old background tab pages, with the exception of Report Design, have been replaced by the new tab page. Change-Id: I47f9ae10a0fd967729ff6e83c1a312aa49e1d13c Reviewed-on: https://gerrit.libreoffice.org/57102 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/backgrnd.hxx4
-rw-r--r--cui/source/inc/cuitabarea.hxx2
-rw-r--r--cui/source/tabpages/backgrnd.cxx68
3 files changed, 62 insertions, 12 deletions
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index dd0b61788e51..8f02659118b6 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -158,7 +158,10 @@ class SvxBkgTabPage : public SvxAreaTabPage
{
std::unique_ptr<weld::ComboBox> m_xTblLBox;
bool bHighlighting : 1;
+ bool bCharBackColor : 1;
+ SfxItemSet maSet;
public:
+ using SvxAreaTabPage::ActivatePage;
using SvxAreaTabPage::DeactivatePage;
SvxBkgTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
@@ -167,6 +170,7 @@ public:
static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
virtual bool FillItemSet( SfxItemSet* ) override;
+ virtual void ActivatePage( const SfxItemSet& ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PageCreated( const SfxAllItemSet& aSet ) override;
};
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index b16a7063e9b1..19c52a601f25 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -215,7 +215,6 @@ public:
class SvxAreaTabPage : public SfxTabPage
{
- using TabPage::ActivatePage;
static const sal_uInt16 pAreaRanges[];
private:
ScopedVclPtr<SfxTabPage> m_pFillTabPage;
@@ -264,6 +263,7 @@ private:
DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet );
public:
+ using TabPage::ActivatePage;
using TabPage::DeactivatePage;
SvxAreaTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 00b60945d36b..b41680e22c81 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -1346,8 +1346,10 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet)
}
SvxBkgTabPage::SvxBkgTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs)
- : SvxAreaTabPage(pParent, rInAttrs)
- , bHighlighting(false)
+ : SvxAreaTabPage(pParent, rInAttrs),
+ bHighlighting(false),
+ bCharBackColor(false),
+ maSet(rInAttrs)
{
m_xBtnGradient->hide();
m_xBtnHatch->hide();
@@ -1389,9 +1391,14 @@ void SvxBkgTabPage::dispose()
SvxAreaTabPage::dispose();
}
+void SvxBkgTabPage::ActivatePage( const SfxItemSet& )
+{
+ SvxAreaTabPage::ActivatePage( maSet );
+}
+
DeactivateRC SvxBkgTabPage::DeactivatePage( SfxItemSet* _pSet )
{
- if ( DeactivateRC::KeepPage == SvxAreaTabPage::DeactivatePage( _pSet ) )
+ if ( DeactivateRC::KeepPage == SvxAreaTabPage::DeactivatePage( &maSet ) )
return DeactivateRC::KeepPage;
if ( _pSet )
@@ -1420,26 +1427,46 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet )
}
else if ( bHighlighting )
nSlot = SID_ATTR_BRUSH_CHAR;
+ else if( bCharBackColor )
+ nSlot = SID_ATTR_CHAR_BACK_COLOR;
sal_uInt16 nWhich = GetWhich(nSlot);
- drawing::FillStyle eFillType = rCoreSet->Get( XATTR_FILLSTYLE ).GetValue();
+ drawing::FillStyle eFillType = maSet.Get( XATTR_FILLSTYLE ).GetValue();
switch( eFillType )
{
case drawing::FillStyle_NONE:
{
- rCoreSet->Put( SvxBrushItem( COL_TRANSPARENT, nWhich ) );
+ if ( SID_ATTR_CHAR_BACK_COLOR == nSlot )
+ {
+ maSet.Put( SvxBackgroundColorItem( COL_TRANSPARENT, nWhich ) );
+ rCoreSet->Put( SvxBackgroundColorItem( COL_TRANSPARENT, nWhich ) );
+ }
+ else
+ {
+ maSet.Put( SvxBrushItem( COL_TRANSPARENT, nWhich ) );
+ rCoreSet->Put( SvxBrushItem( COL_TRANSPARENT, nWhich ) );
+ }
break;
}
case drawing::FillStyle_SOLID:
{
- XFillColorItem aColorItem( rCoreSet->Get( XATTR_FILLCOLOR ) );
- rCoreSet->Put( SvxBrushItem( aColorItem.GetColorValue(), nWhich ) );
+ XFillColorItem aColorItem( maSet.Get( XATTR_FILLCOLOR ) );
+ if ( SID_ATTR_CHAR_BACK_COLOR == nSlot )
+ {
+ maSet.Put( SvxBackgroundColorItem( aColorItem.GetColorValue(), nWhich ) );
+ rCoreSet->Put( SvxBackgroundColorItem( aColorItem.GetColorValue(), nWhich ) );
+ }
+ else
+ {
+ maSet.Put( SvxBrushItem( aColorItem.GetColorValue(), nWhich ) );
+ rCoreSet->Put( SvxBrushItem( aColorItem.GetColorValue(), nWhich ) );
+ }
break;
}
case drawing::FillStyle_BITMAP:
{
- SvxBrushItem aBrushItem( getSvxBrushItemFromSourceSet( *rCoreSet, nWhich ) );
+ SvxBrushItem aBrushItem( getSvxBrushItemFromSourceSet( maSet, nWhich ) );
if ( GraphicType::NONE != aBrushItem.GetGraphicObject()->GetType() ) // no selection so use current
rCoreSet->Put( aBrushItem );
break;
@@ -1469,12 +1496,31 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet)
m_xTblLBox->set_active(0);
m_xTblLBox->show();
}
- else if (nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING)
+ if ((nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING) ||
+ (nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR))
+ {
bHighlighting = bool(nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING);
- else if (nFlags & SvxBackgroundTabFlags::SHOW_SELECTOR)
+ bCharBackColor = bool(nFlags & SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR);
+ }
+ if (nFlags & SvxBackgroundTabFlags::SHOW_SELECTOR)
m_xBtnBitmap->show();
}
- SvxAreaTabPage::PageCreated( aSet );
+
+ if ( bCharBackColor )
+ {
+ sal_uInt16 nWhich(maSet.GetPool()->GetWhich(SID_ATTR_CHAR_BACK_COLOR));
+ Color aBackColor(static_cast<const SvxBackgroundColorItem&>(maSet.Get(nWhich)).GetValue());
+ SvxBrushItem aBrushItem(SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR));
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, maSet);
+ }
+ else
+ {
+ sal_uInt16 nWhich(maSet.GetPool()->GetWhich(bHighlighting ? SID_ATTR_BRUSH_CHAR : SID_ATTR_BRUSH));
+ SvxBrushItem aBrushItem(static_cast<const SvxBrushItem&>(maSet.Get(nWhich)));
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, maSet);
+ }
+
+ SvxAreaTabPage::PageCreated(aSet);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */