LCOV - code coverage report
Current view: top level - include/svtools - colorcfg.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 3 5 60.0 %
Date: 2014-04-11 Functions: 2 4 50.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             : #ifndef INCLUDED_SVTOOLS_COLORCFG_HXX
      20             : #define INCLUDED_SVTOOLS_COLORCFG_HXX
      21             : 
      22             : #include <svtools/svtdllapi.h>
      23             : #include <rtl/ustring.hxx>
      24             : #include <tools/color.hxx>
      25             : #include <com/sun/star/uno/Sequence.h>
      26             : #include <svl/brdcst.hxx>
      27             : #include <svl/lstner.hxx>
      28             : #include <unotools/options.hxx>
      29             : 
      30             : 
      31             : namespace svtools{
      32             : enum ColorConfigEntry
      33             : {
      34             :     DOCCOLOR            ,
      35             :     DOCBOUNDARIES       ,
      36             :     APPBACKGROUND       ,
      37             :     OBJECTBOUNDARIES    ,
      38             :     TABLEBOUNDARIES     ,
      39             :     FONTCOLOR           ,
      40             :     LINKS               ,
      41             :     LINKSVISITED        ,
      42             :     SPELL         ,
      43             :     SMARTTAGS     ,
      44             :     SHADOWCOLOR         ,
      45             :     WRITERTEXTGRID      ,
      46             :     WRITERFIELDSHADINGS ,
      47             :     WRITERIDXSHADINGS         ,
      48             :     WRITERDIRECTCURSOR        ,
      49             :     WRITERSCRIPTINDICATOR,
      50             :     WRITERSECTIONBOUNDARIES,
      51             :     WRITERHEADERFOOTERMARK,
      52             :     WRITERPAGEBREAKS,
      53             :     HTMLSGML            ,
      54             :     HTMLCOMMENT         ,
      55             :     HTMLKEYWORD         ,
      56             :     HTMLUNKNOWN         ,
      57             :     CALCGRID            ,
      58             :     CALCPAGEBREAK       ,
      59             :     CALCPAGEBREAKMANUAL,
      60             :     CALCPAGEBREAKAUTOMATIC,
      61             :     CALCDETECTIVE       ,
      62             :     CALCDETECTIVEERROR       ,
      63             :     CALCREFERENCE       ,
      64             :     CALCNOTESBACKGROUND     ,
      65             :     DRAWGRID            ,
      66             :     BASICIDENTIFIER,
      67             :     BASICCOMMENT   ,
      68             :     BASICNUMBER    ,
      69             :     BASICSTRING    ,
      70             :     BASICOPERATOR  ,
      71             :     BASICKEYWORD   ,
      72             :     BASICERROR   ,
      73             :     SQLIDENTIFIER,
      74             :     SQLNUMBER,
      75             :     SQLSTRING,
      76             :     SQLOPERATOR,
      77             :     SQLKEYWORD,
      78             :     SQLPARAMETER,
      79             :     SQLCOMMENT,
      80             :     ColorConfigEntryCount
      81             : };
      82             : 
      83             : class ColorConfig_Impl;
      84             : struct ColorConfigValue
      85             : {
      86             : 
      87             :     bool        bIsVisible; //validity depends on the element type
      88             :     sal_Int32   nColor;
      89        4140 :     ColorConfigValue() : bIsVisible(false), nColor(0) {}
      90          12 :     bool operator !=(const ColorConfigValue& rCmp) const
      91          12 :         { return nColor != rCmp.nColor || bIsVisible != rCmp.bIsVisible;}
      92             : };
      93             : 
      94             : class SVT_DLLPUBLIC ColorConfig:
      95             :     public utl::detail::Options
      96             : {
      97             :     friend class ColorConfig_Impl;
      98             : private:
      99             :     static ColorConfig_Impl* m_pImpl;
     100             : public:
     101             :     ColorConfig();
     102             :     virtual ~ColorConfig();
     103             : 
     104             :     // get the configured value - if bSmart is set the default color setting is provided
     105             :     // instead of the automatic color
     106             :     ColorConfigValue        GetColorValue(ColorConfigEntry eEntry, bool bSmart = true) const;
     107             :     static Color            GetDefaultColor(ColorConfigEntry eEntry);
     108             :     void Reload();
     109             : };
     110             : 
     111             : class SVT_DLLPUBLIC EditableColorConfig
     112             : {
     113             :     ColorConfig_Impl*   m_pImpl;
     114             :     bool                m_bModified;
     115             : public:
     116             :     EditableColorConfig();
     117             :     ~EditableColorConfig();
     118             : 
     119             :     ::css::uno::Sequence< OUString >  GetSchemeNames() const;
     120             :     void                        DeleteScheme(const OUString& rScheme );
     121             :     void                        AddScheme(const OUString& rScheme );
     122             :     bool                        LoadScheme(const OUString& rScheme );
     123             :     const OUString&             GetCurrentSchemeName() const;
     124             :     void                        SetCurrentSchemeName(const OUString& rScheme);
     125             : 
     126             :     const ColorConfigValue&     GetColorValue(ColorConfigEntry eEntry) const;
     127             :     void                        SetColorValue(ColorConfigEntry eEntry, const ColorConfigValue& rValue);
     128             :     void                        SetModified();
     129           0 :     void                        ClearModified() {m_bModified = false;}
     130           0 :     bool                        IsModified() const {return m_bModified;}
     131             :     void                        Commit();
     132             : 
     133             :     void                        DisableBroadcast();
     134             :     void                        EnableBroadcast();
     135             : };
     136             : }//namespace svtools
     137             : #endif
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10