Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : #include "vbapalette.hxx"
3 : : #include <cppuhelper/implbase1.hxx>
4 : : #include <com/sun/star/beans/XPropertySet.hpp>
5 : : #include <ooo/vba/word/WdColor.hpp>
6 : : #include <ooo/vba/word/WdColorIndex.hpp>
7 : : #include <sal/macros.h>
8 : :
9 : : using namespace ::ooo::vba;
10 : : using namespace ::ooo::vba::word;
11 : : using namespace ::com::sun::star;
12 : :
13 : : static const sal_Int32 ColorTable[] =
14 : : {
15 : : WdColor::wdColorAutomatic, // 0
16 : : WdColor::wdColorBlack, // 1
17 : : WdColor::wdColorBlue, // 2
18 : : WdColor::wdColorTurquoise, // 3
19 : : WdColor::wdColorBrightGreen, // 4
20 : : WdColor::wdColorPink, // 5
21 : : WdColor::wdColorRed, // 6
22 : : WdColor::wdColorYellow, // 7
23 : : WdColor::wdColorWhite, // 8
24 : : WdColor::wdColorDarkBlue, // 9
25 : : WdColor::wdColorTeal, // 10
26 : : WdColor::wdColorGreen, // 11
27 : : WdColor::wdColorViolet, // 12
28 : : WdColor::wdColorDarkRed, // 13
29 : : WdColor::wdColorDarkYellow, // 14
30 : : WdColor::wdColorGray50, // 15
31 : : WdColor::wdColorGray25, // 16
32 : : };
33 : :
34 : : typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
35 : :
36 [ # # ]: 0 : class DefaultPalette : public XIndexAccess_BASE
37 : : {
38 : : public:
39 : 0 : DefaultPalette(){}
40 : :
41 : : // Methods XIndexAccess
42 : 0 : virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
43 : : {
44 : 0 : return SAL_N_ELEMENTS(ColorTable);
45 : : }
46 : :
47 : 0 : virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
48 : : {
49 [ # # ][ # # ]: 0 : if ( Index < 0 || Index >= getCount() )
[ # # ]
50 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
51 [ # # ]: 0 : return uno::makeAny( sal_Int32( ColorTable[ Index ] ) );
52 : : }
53 : :
54 : : // Methods XElementAcess
55 : 0 : virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
56 : : {
57 : 0 : return ::getCppuType( (sal_Int32*)0 );
58 : : }
59 : 0 : virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
60 : : {
61 : 0 : return sal_True;
62 : : }
63 : :
64 : : };
65 : :
66 : 0 : VbaPalette::VbaPalette()
67 : : {
68 [ # # ][ # # ]: 0 : mxPalette = new DefaultPalette();
[ # # ]
69 : 0 : }
70 : :
71 : : uno::Reference< container::XIndexAccess >
72 : 0 : VbaPalette::getPalette() const
73 : : {
74 : :
75 : 0 : return mxPalette;
76 : : }
77 : :
78 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|