summaryrefslogtreecommitdiff
path: root/sc/source/ui/cctrl
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2012-12-05 09:49:08 +0000
committerNoel Power <noel.power@suse.com>2012-12-05 09:59:00 +0000
commit3bc88c4fdc2a05f816f29cb42b7d4f609214357c (patch)
tree6fb8b16ca1d3b11f62c9560d30592f6702f0a0c8 /sc/source/ui/cctrl
parent4fb4ffcc6e13b2544e0ac5578e1b52030e85a295 (diff)
fix for bnc#791731 preserve cell formatting of datapilot area (
also uses the cell formatting to set up the field buttons background & text/font attributes Change-Id: I5f5a46bfc7f0b7aabb8872c25b3c3134e90611ac
Diffstat (limited to 'sc/source/ui/cctrl')
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx31
1 files changed, 26 insertions, 5 deletions
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 5b430f87ebb1..1b18ed64c90a 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -38,6 +38,8 @@
#include "document.hxx"
#include "docpool.hxx"
#include "patattr.hxx"
+#include <editeng/brshitem.hxx>
+#include <editeng/colritem.hxx>
using rtl::OUString;
@@ -45,6 +47,7 @@ ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pSt
mpDoc(pDoc),
mpOutDev(pOutDev),
mpStyle(pStyle),
+ mpPattern(NULL),
mbBaseButton(true),
mbPopupButton(false),
mbHasHiddenMember(false),
@@ -117,8 +120,15 @@ void ScDPFieldButton::draw()
{
// Background
Rectangle aRect(maPos, maSize);
- mpOutDev->SetLineColor(mpStyle->GetFaceColor());
- mpOutDev->SetFillColor(mpStyle->GetFaceColor());
+ Color aBackCol = mpStyle->GetFaceColor();
+ if ( mpPattern )
+ {
+ const SvxBrushItem& rBrushItem = (const SvxBrushItem&)mpPattern->GetItemSet().Get( ATTR_BACKGROUND );
+ if ( rBrushItem.GetColor() != COL_TRANSPARENT )
+ aBackCol = rBrushItem.GetColor();
+ }
+ mpOutDev->SetFillColor(aBackCol);
+ mpOutDev->SetLineColor(aBackCol);
mpOutDev->DrawRect(aRect);
// Border lines
@@ -135,16 +145,27 @@ void ScDPFieldButton::draw()
// Field name.
// Get the font and size the same way as in scenario selection (lcl_DrawOneFrame in gridwin4.cxx)
Font aTextFont( mpStyle->GetAppFont() );
+ Color aButTextCol = mpStyle->GetButtonTextColor();
if ( mpDoc )
{
- // use ScPatternAttr::GetFont only for font size
Font aAttrFont;
- static_cast<const ScPatternAttr&>(mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).
+ if ( mpPattern )
+ {
+ mpPattern->GetFont( aAttrFont, SC_AUTOCOL_DISPLAY, mpOutDev, &maZoomY );
+ const SvxColorItem& rColorItem = (const SvxColorItem&)mpPattern->GetItemSet().Get( ATTR_FONT_COLOR );
+ if ( rColorItem.GetValue().GetColor() != COL_TRANSPARENT )
+ aButTextCol = rColorItem.GetValue();
+ }
+ else
+ {
+ // use ScPatternAttr::GetFont only for font size
+ static_cast<const ScPatternAttr&>(mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).
GetFont( aAttrFont, SC_AUTOCOL_BLACK, mpOutDev, &maZoomY );
+ }
aTextFont.SetSize( aAttrFont.GetSize() );
}
mpOutDev->SetFont(aTextFont);
- mpOutDev->SetTextColor(mpStyle->GetButtonTextColor());
+ mpOutDev->SetTextColor( aButTextCol );
Point aTextPos = maPos;
long nTHeight = mpOutDev->GetTextHeight();