LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbapalette.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 17 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10