summaryrefslogtreecommitdiff
path: root/basic/source/runtime/methods.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2006-04-07 13:03:28 +0000
committerVladimir Glazounov <vg@openoffice.org>2006-04-07 13:03:28 +0000
commitdb82dbc9975397752738e71dae8952cf892b6ccd (patch)
treeb288804f220e5329360fc39d6d0c4856413a41f4 /basic/source/runtime/methods.cxx
parent7b3cdb977858a9a9ab63cb06e7c065d7795490e9 (diff)
INTEGRATION: CWS ab19 (1.61.38); FILE MERGED
2006/03/03 10:45:40 ab 1.61.38.2: RESYNC: (1.61-1.64); FILE MERGED 2005/07/27 14:34:15 ab 1.61.38.1: #i19088# Fixed QBColor by using a table instead of the old Color class
Diffstat (limited to 'basic/source/runtime/methods.cxx')
-rw-r--r--basic/source/runtime/methods.cxx37
1 files changed, 29 insertions, 8 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index cf39a4edc728..4fd609cbf2b8 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: methods.cxx,v $
*
- * $Revision: 1.64 $
+ * $Revision: 1.65 $
*
- * last change: $Author: rt $ $Date: 2005-12-14 14:35:50 $
+ * last change: $Author: vg $ $Date: 2006-04-07 14:03:28 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -3548,18 +3548,39 @@ RTLFUNC(RGB)
RTLFUNC(QBColor)
{
+ static const INT32 pRGB[] =
+ {
+ 0x000000,
+ 0x800000,
+ 0x008000,
+ 0x808000,
+ 0x000080,
+ 0x800080,
+ 0x008080,
+ 0xC0C0C0,
+ 0x808080,
+ 0xFF0000,
+ 0x00FF00,
+ 0xFFFF00,
+ 0x0000FF,
+ 0xFF00FF,
+ 0x00FFFF,
+ 0xFFFFFF,
+ };
+
if ( rPar.Count() != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- Color aCol( (ColorData)rPar.Get(1)->GetInteger() );
-
- ULONG nRed = aCol.GetRed() >> 8;
- ULONG nGreen = aCol.GetGreen() >> 8;
- ULONG nBlue = aCol.GetBlue() >> 8;
- ULONG nRGB = (nRed << 16) | (nGreen << 8) | nBlue;
+ INT16 nCol = rPar.Get(1)->GetInteger();
+ if( nCol < 0 || nCol > 15 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ INT32 nRGB = pRGB[ nCol ];
rPar.Get(0)->PutLong( nRGB );
}