1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SC_VBA_XCOLORFORMAT_HXX
24 #define SC_VBA_XCOLORFORMAT_HXX
25 
26 #include <com/sun/star/drawing/XShape.hpp>
27 #include <ooo/vba/msforms/XColorFormat.hpp>
28 #include <ooo/vba/msforms/XFillFormat.hpp>
29 #include <vbahelper/vbahelperinterface.hxx>
30 #include "vbafillformat.hxx"
31 
32 typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE;
33 
34 class ColorFormatType
35 {
36 public:
37     const static sal_Int16 LINEFORMAT_FORECOLOR = 1;
38     const static sal_Int16 LINEFORMAT_BACKCOLOR = 2;
39     const static sal_Int16 FILLFORMAT_FORECOLOR = 3;
40     const static sal_Int16 FILLFORMAT_BACKCOLOR = 4;
41     const static sal_Int16 THREEDFORMAT_EXTRUSIONCOLOR = 5;
42 };
43 
44 struct MsoColorIndizes
45 {
46     const static sal_Int32 HAPICOLOR_BLACK = 0;
47     const static sal_Int32 HAPICOLOR_WITHE = 16777215;
48     const static sal_Int32 HAPICOLOR_RED = 16711680;
49     const static sal_Int32 HAPICOLOR_BRIGHTGREEN = 65280;
50     const static sal_Int32 HAPICOLOR_BLUE = 255;
51     const static sal_Int32 HAPICOLOR_YELLOW = 16776960;
52     const static sal_Int32 HAPICOLOR_PINK = 16711935;
53     const static sal_Int32 HAPICOLOR_TURQUOISE = 65535;
54     const static sal_Int32 HAPICOLOR_DARKRED = 8388608;
55     const static sal_Int32 HAPICOLOR_GREEN = 32768;
56     const static sal_Int32 HAPICOLOR_DARKBLUE = 128;
57     const static sal_Int32 HAPICOLOR_DARKYELLOW = 8421376;
58     const static sal_Int32 HAPICOLOR_VIOLET = 8388736;
59     const static sal_Int32 HAPICOLOR_TEAL = 32896;
60     const static sal_Int32 HAPICOLOR_GRAY_25_PERCENT = 12632256;
61     const static sal_Int32 HAPICOLOR_GRAY_50_PERCENT = 8421504;
62     const static sal_Int32 HAPICOLOR_PERIWINCKLE = 10066431;
63     const static sal_Int32 HAPICOLOR_PLUM = 10040166;
64     const static sal_Int32 HAPICOLOR_IVORY = 16777164;
65     const static sal_Int32 HAPICOLOR_LIGHTTURQUOISE = 13434879;
66     const static sal_Int32 HAPICOLOR_DARKPRUPLE = 6684774;
67     const static sal_Int32 HAPICOLOR_CORAL = 16744576;
68     const static sal_Int32 HAPICOLOR_OCEANBLUE = 26316;
69     const static sal_Int32 HAPICOLOR_ICEBLUE = 13421823;
70     const static sal_Int32 HAPICOLOR_SKYBLUE = 52479;
71     const static sal_Int32 HAPICOLOR_LIGHTGREEN = 13434828;
72     const static sal_Int32 HAPICOLOR_LIGHTYELLOW = 16777113;
73     const static sal_Int32 HAPICOLOR_PALEBLUE = 10079487;
74     const static sal_Int32 HAPICOLOR_ROSE = 16751052;
75     const static sal_Int32 HAPICOLOR_LAVENDER = 13408767;
76     const static sal_Int32 HAPICOLOR_TAN = 16764057;
77     const static sal_Int32 HAPICOLOR_LIGHTBLUE = 3368703;
78     const static sal_Int32 HAPICOLOR_AQUA = 3394764;
79     const static sal_Int32 HAPICOLOR_LIME = 10079232;
80     const static sal_Int32 HAPICOLOR_GOLD = 16763904;
81     const static sal_Int32 HAPICOLOR_LIGHTORANGE = 16750848;
82     const static sal_Int32 HAPICOLOR_ORANGE = 16737792;
83     const static sal_Int32 HAPICOLOR_BLUEGRAY = 6710937;
84     const static sal_Int32 HAPICOLOR_GRAY_40_PERCENT = 9868950;
85     const static sal_Int32 HAPICOLOR_DARKTEAL = 13158;
86     const static sal_Int32 HAPICOLOR_SEAGREEN = 3381606;
87     const static sal_Int32 HAPICOLOR_NONAME = 13056;
88     const static sal_Int32 HAPICOLOR_OLIVEGREEN = 3355392;
89     const static sal_Int32 HAPICOLOR_BROWN = 10040064;
90     const static sal_Int32 HAPICOLOR_INDIGO = 3355545;
91     const static sal_Int32 HAPICOLOR_GRAY_80_PERCENT = 3355443;
92 
93     static sal_Int32 getColorIndex( sal_Int32 nIndex );
94 
95 };
96 
97 class ScVbaColorFormat : public ScVbaColorFormat_BASE
98 {
99 private:
100     css::uno::Reference< ov::XHelperInterface > m_xInternalParent;
101     css::uno::Reference< css::drawing::XShape > m_xShape;
102     css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
103     ScVbaFillFormat *m_pFillFormat;
104     sal_Int16 m_nColorFormatType;
105     sal_Int32 m_nFillFormatBackColor;
106 protected:
107     virtual rtl::OUString& getServiceImplName();
108     virtual css::uno::Sequence<rtl::OUString> getServiceNames();
109     void setColorFormat( sal_Int16 nType );
110 public:
111     ScVbaColorFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XHelperInterface > xInternalParent, const css::uno::Reference< css::drawing::XShape > xShape, const sal_Int16 nColorFormatType );
112 
113     // Attributes
114     virtual sal_Int32 SAL_CALL getRGB() throw (css::uno::RuntimeException);
115     virtual void SAL_CALL setRGB( sal_Int32 _rgb ) throw (css::uno::RuntimeException);
116     virtual sal_Int32 SAL_CALL getSchemeColor() throw (css::uno::RuntimeException);
117     virtual void SAL_CALL setSchemeColor( sal_Int32 _schemecolor ) throw (css::uno::RuntimeException);
118 
119 };
120 
121 #endif//SC_VBA_XCOLORFORMAT_HXX
122