/***************************************************************************
                          SIMPLY POWERFUL TOOLKIT (SPTK)
                          CExcelStyle.h  -  description
                             -------------------
    begin                : Mon Jan 19 2004
    copyright            : (C) 2004 by Alexey S.Parshin
    email                : alexeyp@gmail.com
 ***************************************************************************/

/***************************************************************************
   This library is free software; you can redistribute it and/or modify it 
   under the terms of the GNU Library General Public License as published by
   the Free Software Foundation; either version 2 of the License, or (at 
   your option) any later version.

   This library is distributed in the hope that it will be useful, but 
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
   General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; if not, write to the Free Software Foundation, 
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

   Please report all bugs and problems to "alexeyp@gmail.com"
 ***************************************************************************/

#ifndef __CEXCELSTYLE_H__
#define __CEXCELSTYLE_H__

namespace sptk {
   /// @addtogroup excel Excel Classes
   /// @{

   /// Represents Excel Style record
	class CExcelStyle {
		char   m_buffer[4];
	public:
      /// Constructor 
      /// @param buffer const char *, Excel STYLE record data (4 bytes)
		CExcelStyle(const char *buffer=0L);

      /// Copy constructor 
      /// @param buffer const CExcelStyle&, Excel STYLE record
		CExcelStyle(const CExcelStyle& buffer);

      /// Set the style directly, from the buffer
      /// @param buffer const char *, buffer with the Excel style
		void set(const char *buffer);

      /// Set index to style XF record
      /// @param index unsigned, index to style XF record
		void ixfe(unsigned index);

      /// Get index to style XF record
		unsigned ixfe() const;

      /// Set built-in style number.
      /// @param biStyle unsigned, built-in style number
		void builtInStyle(unsigned biStyle) { m_buffer[2] = biStyle; }

      /// Get built-in style number.
		unsigned builtInStyle() const { return m_buffer[2]; }

      /// Set the level of outline style (Row or Column)
      /// @see builtInStyle
		void outlineStyleLevel(unsigned osLevel) { m_buffer[3] = osLevel; }

      /// Get the level of outline style (Row or Column) 
      /// @see builtInStyle
		unsigned outlineStyleLevel() const { return m_buffer[3]; }

      /// Returns pointer to the internal data buffer
		const char *data() const { return m_buffer; }
	};

   /// The simple list of the STYLE records
	class CExcelStyles : public std::vector<CExcelStyle> {
	public:
      /// Default constructor
		CExcelStyles() {}

      /// Creates a list of the minimal set of styles
		void init();
	};
   /// @}
}
#endif
