Kaydet (Commit) 41210180 authored tarafından Noel Power's avatar Noel Power

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
üst 496e8308
...@@ -770,7 +770,7 @@ void ScDPObject::Output( const ScAddress& rPos ) ...@@ -770,7 +770,7 @@ void ScDPObject::Output( const ScAddress& rPos )
// clear old output area // clear old output area
pDoc->DeleteAreaTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(), pDoc->DeleteAreaTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(),
aOutRange.aEnd.Col(), aOutRange.aEnd.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(), pDoc->RemoveFlagsTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(),
aOutRange.aEnd.Col(), aOutRange.aEnd.Row(), aOutRange.aEnd.Col(), aOutRange.aEnd.Row(),
aOutRange.aStart.Tab(), SC_MF_AUTO ); aOutRange.aStart.Tab(), SC_MF_AUTO );
......
...@@ -952,7 +952,7 @@ void ScDPOutput::Output() ...@@ -952,7 +952,7 @@ void ScDPOutput::Output()
// clear whole (new) output area // clear whole (new) output area
//! when modifying table, clear old area //! when modifying table, clear old area
//! include IDF_OBJECTS ??? //! 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 ) if ( bDoFilter )
lcl_DoFilterButton( pDoc, aStartPos.Col(), aStartPos.Row(), nTab ); lcl_DoFilterButton( pDoc, aStartPos.Col(), aStartPos.Row(), nTab );
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include "document.hxx" #include "document.hxx"
#include "docpool.hxx" #include "docpool.hxx"
#include "patattr.hxx" #include "patattr.hxx"
#include <editeng/brshitem.hxx>
#include <editeng/colritem.hxx>
using rtl::OUString; using rtl::OUString;
...@@ -33,6 +35,7 @@ ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pSt ...@@ -33,6 +35,7 @@ ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pSt
mpDoc(pDoc), mpDoc(pDoc),
mpOutDev(pOutDev), mpOutDev(pOutDev),
mpStyle(pStyle), mpStyle(pStyle),
mpPattern(NULL),
mbBaseButton(true), mbBaseButton(true),
mbPopupButton(false), mbPopupButton(false),
mbHasHiddenMember(false), mbHasHiddenMember(false),
...@@ -105,8 +108,15 @@ void ScDPFieldButton::draw() ...@@ -105,8 +108,15 @@ void ScDPFieldButton::draw()
{ {
// Background // Background
Rectangle aRect(maPos, maSize); Rectangle aRect(maPos, maSize);
mpOutDev->SetLineColor(mpStyle->GetFaceColor()); Color aBackCol = mpStyle->GetFaceColor();
mpOutDev->SetFillColor(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); mpOutDev->DrawRect(aRect);
// Border lines // Border lines
...@@ -123,16 +133,27 @@ void ScDPFieldButton::draw() ...@@ -123,16 +133,27 @@ void ScDPFieldButton::draw()
// Field name. // Field name.
// Get the font and size the same way as in scenario selection (lcl_DrawOneFrame in gridwin4.cxx) // Get the font and size the same way as in scenario selection (lcl_DrawOneFrame in gridwin4.cxx)
Font aTextFont( mpStyle->GetAppFont() ); Font aTextFont( mpStyle->GetAppFont() );
Color aButTextCol = mpStyle->GetButtonTextColor();
if ( mpDoc ) if ( mpDoc )
{ {
// use ScPatternAttr::GetFont only for font size
Font aAttrFont; 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 ); GetFont( aAttrFont, SC_AUTOCOL_BLACK, mpOutDev, &maZoomY );
}
aTextFont.SetSize( aAttrFont.GetSize() ); aTextFont.SetSize( aAttrFont.GetSize() );
} }
mpOutDev->SetFont(aTextFont); mpOutDev->SetFont(aTextFont);
mpOutDev->SetTextColor(mpStyle->GetButtonTextColor()); mpOutDev->SetTextColor( aButTextCol );
Point aTextPos = maPos; Point aTextPos = maPos;
long nTHeight = mpOutDev->GetTextHeight(); long nTHeight = mpOutDev->GetTextHeight();
......
...@@ -32,6 +32,7 @@ class Point; ...@@ -32,6 +32,7 @@ class Point;
class Size; class Size;
class StyleSettings; class StyleSettings;
class ScDocument; class ScDocument;
class ScPatternAttr;
/** /**
* This class takes care of physically drawing field button controls inside * This class takes care of physically drawing field button controls inside
...@@ -51,6 +52,7 @@ public: ...@@ -51,6 +52,7 @@ public:
void setHasHiddenMember(bool b); void setHasHiddenMember(bool b);
void setPopupPressed(bool b); void setPopupPressed(bool b);
void setPopupLeft(bool b); void setPopupLeft(bool b);
void setFieldPattern(const ScPatternAttr* pPattern){ mpPattern = pPattern; }
void draw(); void draw();
void getPopupBoundingBox(Point& rPos, Size& rSize) const; void getPopupBoundingBox(Point& rPos, Size& rSize) const;
...@@ -67,6 +69,7 @@ private: ...@@ -67,6 +69,7 @@ private:
ScDocument* mpDoc; ScDocument* mpDoc;
OutputDevice* mpOutDev; OutputDevice* mpOutDev;
const StyleSettings* mpStyle; const StyleSettings* mpStyle;
const ScPatternAttr* mpPattern;
bool mbBaseButton; bool mbBaseButton;
bool mbPopupButton; bool mbPopupButton;
bool mbHasHiddenMember; bool mbHasHiddenMember;
......
...@@ -1236,6 +1236,8 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2 ...@@ -1236,6 +1236,8 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
aCellBtn.setDrawBaseButton(true); aCellBtn.setDrawBaseButton(true);
aCellBtn.setDrawPopupButton(pInfo->bPopupButton); aCellBtn.setDrawPopupButton(pInfo->bPopupButton);
aCellBtn.setHasHiddenMember(pInfo->bFilterActive); aCellBtn.setHasHiddenMember(pInfo->bFilterActive);
aCellBtn.setFieldPattern( pDoc->GetPattern( nCol, nRow, nTab ) );
aCellBtn.draw(); aCellBtn.draw();
} }
} }
......
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