summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-19 08:12:04 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-19 08:13:37 +0200
commitdd0f844728a53a337233a3c687b792e725803da5 (patch)
treea40f5621a67311363784b51f27fb8d96c1cf91fe /sc
parentfefad3715a9ca8411228d2bf4a56c210e5b598ef (diff)
add COLOR function
This function makes property mapping in charts more user friendly. Change-Id: I01cfb31edd749ee474d5078042fa5c4b4a270f86
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/helpids.h1
-rw-r--r--sc/qa/unit/ucalc.cxx1
-rw-r--r--sc/source/core/inc/interpre.hxx1
-rw-r--r--sc/source/core/tool/interpr4.cxx1
-rw-r--r--sc/source/core/tool/interpr7.cxx44
-rw-r--r--sc/source/ui/src/scfuncs.src47
6 files changed, 95 insertions, 0 deletions
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 26465041bf3a..50df627933da 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -646,6 +646,7 @@
#define HID_FUNC_BITRSHIFT "SC_HID_FUNC_BITRSHIFT"
#define HID_FUNC_FILTERXML "SC_HID_FUNC_FILTERXML"
#define HID_FUNC_WEBSERVICE "SC_HID_FUNC_WEBSERVICE"
+#define HID_FUNC_COLOR "SC_HID_FUNC_COLOR"
#define HID_FUNC_COVARIANCE_P "SC_HID_FUNC_COVARIANCE_P"
#define HID_FUNC_COVARIANCE_S "SC_HID_FUNC_COVARIANCE_S"
#define HID_FUNC_ST_DEV_P_MS "SC_HID_FUNC_ST_DEV_P_MS"
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 4dc7b1b97db5..8e65f681fb0d 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2509,6 +2509,7 @@ void Test::testFunctionLists()
"BITXOR",
"CEILING",
"CEILING.PRECISE",
+ "COLOR",
"COMBIN",
"COMBINA",
"CONVERT",
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 0c14d32d5266..6022c8ea7f6b 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -833,6 +833,7 @@ void ScMidB();
void ScFilterXML();
void ScWebservice();
+void ScColor();
void ScErf();
void ScErfc();
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index e4fb73f7e702..09ea67185b76 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4088,6 +4088,7 @@ StackVar ScInterpreter::Interpret()
case ocZins : ScZins(); break;
case ocFilterXML : ScFilterXML(); break;
case ocWebservice : ScWebservice(); break;
+ case ocColor : ScColor(); break;
case ocErf_MS : ScErf(); break;
case ocErfc_MS : ScErfc(); break;
case ocZinsZ : ScZinsZ(); break;
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 9ba8cd46f0d3..c0c9bf0715c4 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -274,4 +274,48 @@ void ScInterpreter::ScErfc()
}
}
+void ScInterpreter::ScColor()
+{
+ sal_uInt8 nParamCount = GetByte();
+ if(MustHaveParamCount(nParamCount, 3, 4))
+ {
+ double nAlpha = 0;
+ if(nParamCount == 4)
+ nAlpha = rtl::math::approxFloor(GetDouble());
+
+ if(nAlpha < 0 || nAlpha > 255)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ double nBlue = rtl::math::approxFloor(GetDouble());
+
+ if(nBlue < 0 || nBlue > 255)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ double nGreen = rtl::math::approxFloor(GetDouble());
+
+ if(nGreen < 0 || nGreen > 255)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ double nRed = rtl::math::approxFloor(GetDouble());
+
+ if(nRed < 0 || nRed > 255)
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ double nVal = 256*256*256*nAlpha + 256*256*nRed + 256*nGreen + nBlue;
+ PushDouble(nVal);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 5887ab0fbbbd..3812f6e37b20 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -11999,6 +11999,53 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
Text [ en-US ] = "String containing a valid XPath expression";
};
};
+ Resource SC_OPCODE_COLOR
+ {
+ ExtraData =
+ {
+ 0;
+ ID_FUNCTION_GRP_MATH;
+ U2S( HID_FUNC_COLOR );
+ 4; 0; 0; 0; 1;
+ 0;
+ };
+ String 1 // Description
+ {
+ Text [ en-US ] = "Returns an implementation defined value representing a RGBA color";
+ };
+ String 2 // Name of Parameter 1
+ {
+ Text [ en-US ] = "Red";
+ };
+ String 3 // Description of Parameter 1
+ {
+ Text [ en-US ] = "Value of red";
+ };
+ String 4 // Name of parameter 2
+ {
+ Text [ en-US ] = "Green";
+ };
+ String 5 // Description of Parameter 2
+ {
+ Text [ en-US ] = "Value of green";
+ };
+ String 6 // Name of Parameter 3
+ {
+ Text [ en-US ] = "Blue";
+ };
+ String 7 // Description of Parameter 3
+ {
+ Text [ en-US ] = "Value of blue";
+ };
+ String 8 // Name of parameter 4
+ {
+ Text [ en-US ] = "Alpha";
+ };
+ String 9 // Description of Parameter 4
+ {
+ Text [ en-US ] = "Value of alpha";
+ };
+ };
Resource SC_OPCODE_WEBSERVICE
{
String 1 // Description