[Libreoffice-commits] .: 2 commits - sc/inc sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Sun May 20 16:25:45 PDT 2012
sc/inc/colorscale.hxx | 8 +++++++-
sc/inc/fillinfo.hxx | 1 +
sc/source/core/data/colorscale.cxx | 1 +
sc/source/filter/inc/condformatbuffer.hxx | 1 +
sc/source/filter/oox/condformatbuffer.cxx | 5 +++++
sc/source/filter/oox/condformatcontext.cxx | 3 +++
sc/source/ui/view/output.cxx | 14 +++++++++-----
sc/source/ui/view/output2.cxx | 7 +++++++
8 files changed, 34 insertions(+), 6 deletions(-)
New commits:
commit 67ff63988f3b8eef2cc2b5bdf917918b93c3f070
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon May 21 01:19:19 2012 +0200
support to suppress values in data bar cells
Change-Id: Ia292edd73408eed19cd6bc824e9621992c33ac97
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 0dbb876..997c2a0 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -89,7 +89,8 @@ struct ScDataBarFormatData
ScDataBarFormatData():
mbGradient(true),
mbNeg(true),
- meAxisPosition(databar::AUTOMATIC) {}
+ meAxisPosition(databar::AUTOMATIC),
+ mbOnlyBar(false){}
/**
* Color for all Positive Values and if mbNeg == false also for negative ones
@@ -124,6 +125,11 @@ struct ScDataBarFormatData
*/
databar::ScAxisPostion meAxisPosition;
+ /**
+ * If TRUE we only show the bar and not the value
+ */
+ bool mbOnlyBar;
+
boost::scoped_ptr<ScColorScaleEntry> mpUpperLimit;
boost::scoped_ptr<ScColorScaleEntry> mpLowerLimit;
};
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index c2fa4a7..842ef1b 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -68,6 +68,7 @@ struct ScDataBarInfo
Color maColor;
double mnLength; // -100 to 100
bool mbGradient;
+ bool mbShowValue;
bool operator==(const ScDataBarInfo& r) const
{
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 70b4872..3361d72 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -765,6 +765,7 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
pInfo->maColor = mpFormatData->maPositiveColor;
pInfo->mbGradient = mpFormatData->mbGradient;
+ pInfo->mbShowValue = !mpFormatData->mbOnlyBar;
return pInfo;
}
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index 09b9a83..60f24d7 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -120,6 +120,7 @@ public:
DataBarRule( const CondFormat& rFormat );
void importCfvo( const AttributeList& rAttribs );
void importColor( const AttributeList& rAttribs );
+ void importAttribs( const AttributeList& rAttribs );
void SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr );
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 655b264..8792546 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -328,6 +328,11 @@ void DataBarRule::importCfvo( const AttributeList& rAttribs )
}
}
+void DataBarRule::importAttribs( const AttributeList& rAttribs )
+{
+ mpFormat->mbOnlyBar = !rAttribs.getBool( XML_showValue, true );
+}
+
void DataBarRule::SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr )
{
ScColorScaleEntry* pUpperEntry = ConvertToModel( *mpUpperLimit.get(), pDoc, rAddr);
diff --git a/sc/source/filter/oox/condformatcontext.cxx b/sc/source/filter/oox/condformatcontext.cxx
index 81d56fb..4e01d47 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -109,6 +109,9 @@ void DataBarContext::onStartElement( const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
+ case XLS_TOKEN( dataBar ):
+ mxRule->getDataBar()->importAttribs( rAttribs );
+ break;
case XLS_TOKEN( cfvo ):
mxRule->getDataBar()->importCfvo( rAttribs );
break;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index a91a7fe..26aeadb 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1537,6 +1537,13 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
if ( bDoCell && bEditMode && nCellX == nEditCol && nCellY == nEditRow )
bDoCell = false;
+ // skip text in cell if data bar is set and only value selected
+ if ( bDoCell )
+ {
+ if(pInfo->pDataBar && !pInfo->pDataBar->mbShowValue)
+ bDoCell = false;
+ }
+
//
// output the cell text
//
commit d4b94e9eb96f24411ac0dcebe92ac878a8fae91f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon May 21 01:08:25 2012 +0200
some smalll data bar rendering improvements
Change-Id: I068565f21b6bda67e6a3b39eb3bbd248e1b48efe
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 0cb0f00..ba530de 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -804,17 +804,21 @@ namespace {
void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, const Rectangle& rRect)
{
long nPosZero = 0;
+ Rectangle aPaintRect = rRect;
+ //aPaintRect.Top() += 2;
+ //aPaintRect.Bottom() -= 2;
+ //aPaintRect.Left() += 2;
+ //aPaintRect.Right() -= 2;
if(pOldDataBarInfo->mnZero)
{
//need to calculate null point in cell
- long nLength = rRect.Right() - rRect.Left();
- nPosZero = static_cast<long>(rRect.Left() + nLength*pOldDataBarInfo->mnZero/100.0);
+ long nLength = aPaintRect.Right() - aPaintRect.Left();
+ nPosZero = static_cast<long>(aPaintRect.Left() + nLength*pOldDataBarInfo->mnZero/100.0);
}
else
{
- nPosZero = rRect.Left();
+ nPosZero = aPaintRect.Left();
}
- Rectangle aPaintRect = rRect;
if(pOldDataBarInfo->mnLength < 0)
{
@@ -852,7 +856,7 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con
}
//draw axis
- if(pOldDataBarInfo->mnZero)
+ if(pOldDataBarInfo->mnZero && pOldDataBarInfo->mnZero != 100)
{
Point aPoint1(nPosZero, rRect.Top());
Point aPoint2(nPosZero, rRect.Bottom());
More information about the Libreoffice-commits
mailing list