[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 3 commits - oox/source sc/inc sc/source xmloff/inc xmloff/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Tue Jun 26 21:04:44 PDT 2012


 oox/source/token/tokens.txt             |    1 +
 sc/inc/colorscale.hxx                   |    7 +++++++
 sc/inc/fillinfo.hxx                     |    1 +
 sc/source/core/data/colorscale.cxx      |    1 +
 sc/source/filter/inc/extlstcontext.hxx  |    1 +
 sc/source/filter/oox/extlstcontext.cxx  |   13 +++++++++++++
 sc/source/filter/xml/xmlcondformat.cxx  |   11 +++++++++++
 sc/source/filter/xml/xmlexprt.cxx       |    4 ++++
 sc/source/filter/xml/xmlimprt.cxx       |    1 +
 sc/source/filter/xml/xmlimprt.hxx       |    3 ++-
 sc/source/ui/condformat/colorformat.cxx |    2 ++
 sc/source/ui/view/output.cxx            |    5 +++--
 xmloff/inc/xmloff/xmltoken.hxx          |    1 +
 xmloff/source/core/xmltoken.cxx         |    1 +
 14 files changed, 49 insertions(+), 3 deletions(-)

New commits:
commit eee54a502d5279fe1f4e38a384e7182e88d34f34
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jun 27 05:53:29 2012 +0200

    add import of axis color for data bars from xlsx
    
    Change-Id: I2a15f8787afceaea1cb8e1c2902c05367d3e5b15

diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 5bbaa62..fee78ee 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -713,6 +713,7 @@ axId
 axPos
 axis
 axisCol
+axisColor
 axisPage
 axisPosition
 axisRow
diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx
index 2ed742d..a76109c 100644
--- a/sc/source/filter/inc/extlstcontext.hxx
+++ b/sc/source/filter/inc/extlstcontext.hxx
@@ -43,6 +43,7 @@ public:
 private:
     void importDataBar( const AttributeList& rAttribs );
     void importNegativeFillColor( const AttributeList& rAttribs );
+    void importAxisColor( const AttributeList& rAttribs );
     void* mpTarget;
 
 };
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 3f6991e..6435128 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -58,6 +58,10 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs )
             break;
         case XLS_EXT_TOKEN( negativeFillColor ):
             importNegativeFillColor( rAttribs );
+            break;
+        case XLS_EXT_TOKEN( axisColor ):
+            importAxisColor( rAttribs );
+            break;
 
         default:
             break;
@@ -93,6 +97,15 @@ namespace {
 
 }
 
+void ExtCfRuleContext::importAxisColor( const AttributeList& rAttribs )
+{
+    ScDataBarFormatData* pDataBar = static_cast<ScDataBarFormatData*>(mpTarget);
+
+    sal_Int32 nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
+    ::Color aColor = RgbToRgbComponents(nColor);
+    pDataBar->maAxisColor = aColor;
+}
+
 void ExtCfRuleContext::importNegativeFillColor( const AttributeList& rAttribs )
 {
     sal_Int32 nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
commit d09e1505086ec775b5521f58927def50fabd0865
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jun 26 16:42:33 2012 +0200

    add support for axis color import/export
    
    Change-Id: I713981b9ae1a82ca0b014cde88abdc32af1f9975

diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index 6aa55cc..a8fc8bb 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -193,6 +193,7 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_
     rtl::OUString sGradient;
     rtl::OUString sAxisPosition;
     rtl::OUString sShowValue;
+    rtl::OUString sAxisColor;
 
     sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
     const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDataBarAttrMap();
@@ -221,6 +222,9 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_
             case XML_TOK_DATABAR_SHOWVALUE:
                 sShowValue = sValue;
                 break;
+            case XML_TOK_DATABAR_AXISCOLOR:
+                sAxisColor = sValue;
+                break;
             default:
                 break;
         }
@@ -253,6 +257,13 @@ ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_
     else
         mpFormatData->mbNeg = false;
 
+    if(!sAxisColor.isEmpty())
+    {
+        sal_Int32 nColor = 0;
+        sax::Converter::convertColor( nColor, sAxisColor );
+        mpFormatData->maAxisColor = Color(nColor);
+    }
+
     if(!sShowValue.isEmpty())
     {
         bool bShowValue = true;
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index ab01286..6b91c2e 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3971,6 +3971,10 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab)
                         rtl::OUStringBuffer aBuffer;
                         ::sax::Converter::convertColor(aBuffer, pFormatData->maPositiveColor.GetColor());
                         AddAttribute(XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear());
+
+                        aBuffer = rtl::OUStringBuffer();
+                        ::sax::Converter::convertColor(aBuffer, pFormatData->maAxisColor.GetColor());
+                        AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_COLOR, aBuffer.makeStringAndClear());
                         SvXMLElementExport aElementDataBar(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, true, true);
 
                         {
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 32e3e94..bf7c18b 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -726,6 +726,7 @@ const SvXMLTokenMap& ScXMLImport::GetDataBarAttrMap()
             { XML_NAMESPACE_CALC_EXT, XML_GRADIENT, XML_TOK_DATABAR_GRADIENT },
             { XML_NAMESPACE_CALC_EXT, XML_AXIS_POSITION, XML_TOK_DATABAR_AXISPOSITION },
             { XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_TOK_DATABAR_SHOWVALUE },
+            { XML_NAMESPACE_CALC_EXT, XML_AXIS_COLOR, XML_TOK_DATABAR_AXISCOLOR },
             XML_TOKEN_MAP_END
         };
 
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 541987b..3e9bd2d 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -198,7 +198,8 @@ enum ScXMLDataBarAttrTokens
     XML_TOK_DATABAR_NEGATIVE_COLOR,
     XML_TOK_DATABAR_GRADIENT,
     XML_TOK_DATABAR_AXISPOSITION,
-    XML_TOK_DATABAR_SHOWVALUE
+    XML_TOK_DATABAR_SHOWVALUE,
+    XML_TOK_DATABAR_AXISCOLOR
 };
 
 enum ScXMLDataBarEntryAttrTokens
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index b850e3e..e45091e 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -288,6 +288,7 @@ namespace xmloff { namespace token {
         XML_AUTOSIZE,
         XML_AVERAGE,
         XML_AXIS,
+        XML_AXIS_COLOR,
         XML_BACK_SCALE,
         XML_BACKFACE_CULLING,
         XML_BACKGROUND,
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 5296cae..875d0d9 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -292,6 +292,7 @@ namespace xmloff { namespace token {
         TOKEN( "autosize",                        XML_AUTOSIZE ),
         TOKEN( "average",                         XML_AVERAGE ),
         TOKEN( "axis",                            XML_AXIS ),
+        TOKEN( "axis-color",                      XML_AXIS_COLOR ),
         TOKEN( "back-scale",                      XML_BACK_SCALE ),
         TOKEN( "backface-culling",                XML_BACKFACE_CULLING ),
         TOKEN( "background",                      XML_BACKGROUND ),
commit cd8cb0df5f10405b514597404d9d5455d4f7c5db
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jun 26 16:18:52 2012 +0200

    support colored axis in data bars
    
    Change-Id: Ie74404b35e31a2f96641abb18a9aaf46467e31c0

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 72349dc..24aa2ea 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -99,6 +99,7 @@ enum ScAxisPostion
 struct SC_DLLPUBLIC ScDataBarFormatData
 {
     ScDataBarFormatData():
+        maAxisColor(COL_BLACK),
         mbGradient(true),
         mbNeg(true),
         meAxisPosition(databar::AUTOMATIC),
@@ -106,6 +107,7 @@ struct SC_DLLPUBLIC ScDataBarFormatData
 
     ScDataBarFormatData(const ScDataBarFormatData& r):
         maPositiveColor(r.maPositiveColor),
+        maAxisColor(r.maAxisColor),
         mbGradient(r.mbGradient),
         mbNeg(r.mbNeg),
         meAxisPosition(r.meAxisPosition),
@@ -131,6 +133,11 @@ struct SC_DLLPUBLIC ScDataBarFormatData
      */
     boost::scoped_ptr<Color> mpNegativeColor;
     /**
+     * Color of the axis if used
+     * Default color is black
+     */
+    Color maAxisColor;
+    /**
      * Paint the bars with gradient. If this is used the default is to draw with
      * borders.
      *
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index 842ef1b..838255e 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -69,6 +69,7 @@ struct ScDataBarInfo
     double mnLength; // -100 to 100
     bool mbGradient;
     bool mbShowValue;
+    Color maAxisColor;
 
     bool operator==(const ScDataBarInfo& r) const
     {
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index c677397..38f061a 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -842,6 +842,7 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
 
     pInfo->mbGradient = mpFormatData->mbGradient;
     pInfo->mbShowValue = !mpFormatData->mbOnlyBar;
+    pInfo->maAxisColor = mpFormatData->maAxisColor;
 
     return pInfo;
 }
diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx
index 7093bb1..71b88c9 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -176,6 +176,7 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarForma
     ::SetType(rData.mpUpperLimit.get(), maLbTypeMax);
     SetValue(rData.mpLowerLimit.get(), maEdMin);
     SetValue(rData.mpUpperLimit.get(), maEdMax);
+    maLbAxisCol.SelectEntry(rData.maAxisColor);
 
     TypeSelectHdl(NULL);
 }
@@ -259,6 +260,7 @@ ScDataBarFormatData* ScDataBarSettingsDlg::GetData()
     pData->mbGradient = true; //FIXME
     pData->mpUpperLimit.reset(new ScColorScaleEntry());
     pData->mpLowerLimit.reset(new ScColorScaleEntry());
+    pData->maAxisColor = maLbAxisCol.GetSelectEntryColor();
 
     ::GetType(maLbTypeMin, maEdMin, pData->mpLowerLimit.get(), mpNumberFormatter);
     ::GetType(maLbTypeMax, maEdMax, pData->mpUpperLimit.get(), mpNumberFormatter);
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index cd9c7a9..be876ee 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -864,10 +864,11 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con
         aLineInfo.SetDashCount( 4 );
         aLineInfo.SetDistance( 3 );
         aLineInfo.SetDashLen( 3 );
-        pDev->SetFillColor(COL_BLACK);
-        pDev->SetLineColor(COL_BLACK);
+        pDev->SetFillColor(pOldDataBarInfo->maAxisColor);
+        pDev->SetLineColor(pOldDataBarInfo->maAxisColor);
         pDev->DrawLine(aPoint1, aPoint2, aLineInfo);
         pDev->SetLineColor();
+        pDev->SetFillColor();
     }
 }
 


More information about the Libreoffice-commits mailing list