diff options
author | Noel Power <noel.power@suse.com> | 2012-12-05 09:49:08 +0000 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2012-12-05 09:51:46 +0000 |
commit | 307ac3f53d670a28e60471859aed03e4e13519d6 (patch) | |
tree | 063b99c9c769394ac2b1eb463a36441ca8559108 | |
parent | 34a5932cd29bcc48859aed501eb8b262c949e45e (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
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dpoutput.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/cctrl/dpcontrol.cxx | 31 | ||||
-rw-r--r-- | sc/source/ui/inc/dpcontrol.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 2 |
5 files changed, 33 insertions, 7 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 40c3df9de41f..529de6b21dea 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -770,7 +770,7 @@ void ScDPObject::Output( const ScAddress& rPos ) // clear old output area pDoc->DeleteAreaTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(), aOutRange.aEnd.Col(), aOutRange.aEnd.Row(), - aOutRange.aStart.Tab(), IDF_ALL ); + aOutRange.aStart.Tab(), IDF_CONTENTS | IDF_OBJECTS ); pDoc->RemoveFlagsTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(), aOutRange.aEnd.Col(), aOutRange.aEnd.Row(), aOutRange.aStart.Tab(), SC_MF_AUTO ); diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 5038d43c65f6..7c38ee34a8d9 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -952,7 +952,7 @@ void ScDPOutput::Output() // clear whole (new) output area //! when modifying table, clear old area //! include IDF_OBJECTS ??? - pDoc->DeleteAreaTab( aStartPos.Col(), aStartPos.Row(), nTabEndCol, nTabEndRow, nTab, IDF_ALL ); + pDoc->DeleteAreaTab( aStartPos.Col(), aStartPos.Row(), nTabEndCol, nTabEndRow, nTab, IDF_CONTENTS | IDF_OBJECTS); if ( bDoFilter ) lcl_DoFilterButton( pDoc, aStartPos.Col(), aStartPos.Row(), nTab ); diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index c866dedf3ce1..e57a7a56f80c 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -26,6 +26,8 @@ #include "document.hxx" #include "docpool.hxx" #include "patattr.hxx" +#include <editeng/brshitem.hxx> +#include <editeng/colritem.hxx> using rtl::OUString; @@ -33,6 +35,7 @@ ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pSt mpDoc(pDoc), mpOutDev(pOutDev), mpStyle(pStyle), + mpPattern(NULL), mbBaseButton(true), mbPopupButton(false), mbHasHiddenMember(false), @@ -105,8 +108,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 @@ -123,16 +133,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(); diff --git a/sc/source/ui/inc/dpcontrol.hxx b/sc/source/ui/inc/dpcontrol.hxx index e571adb31e06..311d2cf889dc 100644 --- a/sc/source/ui/inc/dpcontrol.hxx +++ b/sc/source/ui/inc/dpcontrol.hxx @@ -32,6 +32,7 @@ class Point; class Size; class StyleSettings; class ScDocument; +class ScPatternAttr; /** * This class takes care of physically drawing field button controls inside @@ -51,6 +52,7 @@ public: void setHasHiddenMember(bool b); void setPopupPressed(bool b); void setPopupLeft(bool b); + void setFieldPattern(const ScPatternAttr* pPattern){ mpPattern = pPattern; } void draw(); void getPopupBoundingBox(Point& rPos, Size& rSize) const; @@ -67,6 +69,7 @@ private: ScDocument* mpDoc; OutputDevice* mpOutDev; const StyleSettings* mpStyle; + const ScPatternAttr* mpPattern; bool mbBaseButton; bool mbPopupButton; bool mbHasHiddenMember; diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index aedcf22225f5..745e444dd962 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1236,6 +1236,8 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2 aCellBtn.setDrawBaseButton(true); aCellBtn.setDrawPopupButton(pInfo->bPopupButton); aCellBtn.setHasHiddenMember(pInfo->bFilterActive); + + aCellBtn.setFieldPattern( pDoc->GetPattern( nCol, nRow, nTab ) ); aCellBtn.draw(); } } |