LibreOffice Module sw (master) 1
vbapalette.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "vbapalette.hxx"
22#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
23#include <ooo/vba/word/WdColor.hpp>
24#include <sal/macros.h>
25
26using namespace ::ooo::vba;
27using namespace ::ooo::vba::word;
28using namespace ::com::sun::star;
29
30const sal_Int32 ColorTable[] =
31{
32WdColor::wdColorAutomatic, // 0
33WdColor::wdColorBlack, // 1
34WdColor::wdColorBlue, // 2
35WdColor::wdColorTurquoise, // 3
36WdColor::wdColorBrightGreen, // 4
37WdColor::wdColorPink, // 5
38WdColor::wdColorRed, // 6
39WdColor::wdColorYellow, // 7
40WdColor::wdColorWhite, // 8
41WdColor::wdColorDarkBlue, // 9
42WdColor::wdColorTeal, // 10
43WdColor::wdColorGreen, // 11
44WdColor::wdColorViolet, // 12
45WdColor::wdColorDarkRed, // 13
46WdColor::wdColorDarkYellow, // 14
47WdColor::wdColorGray50, // 15
48WdColor::wdColorGray25, // 16
49};
50
51typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE;
52
53namespace {
54
55class DefaultPalette : public XIndexAccess_BASE
56{
57public:
58 DefaultPalette(){}
59
60 // Methods XIndexAccess
61 virtual ::sal_Int32 SAL_CALL getCount() override
62 {
64 }
65
66 virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override
67 {
68 if ( Index < 0 || Index >= getCount() )
69 throw lang::IndexOutOfBoundsException();
70 return uno::Any( sal_Int32( ColorTable[ Index ] ) );
71 }
72
73 // Methods XElementAccess
74 virtual uno::Type SAL_CALL getElementType() override
75 {
77 }
78 virtual sal_Bool SAL_CALL hasElements() override
79 {
80 return true;
81 }
82
83};
84
85}
86
88 : mxPalette(new DefaultPalette())
89{
90}
91
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
#define SAL_N_ELEMENTS(arr)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
unsigned char sal_Bool
const sal_Int32 ColorTable[]
Definition: vbapalette.cxx:30
::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE
Definition: vbapalette.cxx:51
::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE