1 #include "vbapalette.hxx"
2 #include <cppuhelper/implbase1.hxx>
3 #include <com/sun/star/beans/XPropertySet.hpp>
4 #include <ooo/vba/word/WdColor.hpp>
5 #include <ooo/vba/word/WdColorIndex.hpp>
7 using namespace ::ooo::vba
;
8 using namespace ::ooo::vba::word
;
9 using namespace ::com::sun::star
;
11 static const sal_Int32 ColorTable
[] =
13 WdColor::wdColorAutomatic
, // 0
14 WdColor::wdColorBlack
, // 1
15 WdColor::wdColorBlue
, // 2
16 WdColor::wdColorTurquoise
, // 3
17 WdColor::wdColorBrightGreen
, // 4
18 WdColor::wdColorPink
, // 5
19 WdColor::wdColorRed
, // 6
20 WdColor::wdColorYellow
, // 7
21 WdColor::wdColorWhite
, // 8
22 WdColor::wdColorDarkBlue
, // 9
23 WdColor::wdColorTeal
, // 10
24 WdColor::wdColorGreen
, // 11
25 WdColor::wdColorViolet
, // 12
26 WdColor::wdColorDarkRed
, // 13
27 WdColor::wdColorDarkYellow
, // 14
28 WdColor::wdColorGray50
, // 15
29 WdColor::wdColorGray25
, // 16
32 typedef ::cppu::WeakImplHelper1
< container::XIndexAccess
> XIndexAccess_BASE
;
34 class DefaultPalette
: public XIndexAccess_BASE
39 // Methods XIndexAccess
40 virtual ::sal_Int32 SAL_CALL
getCount() throw (uno::RuntimeException
)
42 return sizeof(ColorTable
) / sizeof(ColorTable
[0]);
45 virtual uno::Any SAL_CALL
getByIndex( ::sal_Int32 Index
) throw (lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
47 if ( Index
< 0 || Index
>= getCount() )
48 throw lang::IndexOutOfBoundsException();
49 return uno::makeAny( sal_Int32( ColorTable
[ Index
] ) );
52 // Methods XElementAcess
53 virtual uno::Type SAL_CALL
getElementType() throw (uno::RuntimeException
)
55 return ::getCppuType( (sal_Int32
*)0 );
57 virtual ::sal_Bool SAL_CALL
hasElements() throw (uno::RuntimeException
)
64 VbaPalette::VbaPalette()
66 mxPalette
= new DefaultPalette();
69 uno::Reference
< container::XIndexAccess
>
70 VbaPalette::getPalette() const