WPSList.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwps
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwps.sourceforge.net
*/
#ifndef WPS_LIST_H
# define WPS_LIST_H
#include <iostream>
#include <vector>
#include <libwpd/libwpd.h>
#include "libwps_internal.h"
class WPXPropertyList;
class WPXDocumentInterface;
class WPSList
{
public:
struct Level
{
Level() : m_labelIndent(0.0), m_labelWidth(0.0), m_startValue(-1), m_type(libwps::NONE),
m_prefix(""), m_suffix(""), m_bullet(""), m_sendToInterface(false) { }
bool isDefault() const
{
return m_type ==libwps::NONE;
}
bool isNumeric() const
{
return m_type !=libwps::NONE && m_type != libwps::BULLET;
}
void addTo(WPXPropertyList &propList, int startVal) const;
bool isSendToInterface() const
{
return m_sendToInterface;
}
void resetSendToInterface() const
{
m_sendToInterface = false;
}
int getStartValue() const
{
return m_startValue <= -1 ? 1 : m_startValue;
}
int cmp(Level const &levl) const;
int cmpType(Level const &levl) const;
friend std::ostream &operator<<(std::ostream &o, Level const &ft);
double m_labelIndent ;
double m_labelWidth ;
int m_startValue;
libwps::NumberingType m_type;
WPXString m_prefix ,
m_suffix,
m_bullet ;
protected:
mutable bool m_sendToInterface;
};
WPSList() : m_levels(), m_actLevel(-1), m_actualIndices(), m_nextIndices(),
m_id(-1), m_previousId (-1) {}
int getId() const
{
return m_id;
}
int getPreviousId() const
{
return m_previousId;
}
void setId(int newId);
int numLevels() const
{
return int(m_levels.size());
}
void set(int levl, Level const &level);
void setLevel(int levl) const;
void openElement() const;
void closeElement() const {}
bool isNumeric(int levl) const;
bool mustSendLevel(int level) const;
void sendTo(WPXDocumentInterface &docInterface, int level) const;
protected:
std::vector<Level> m_levels;
mutable int m_actLevel;
mutable std::vector<int> m_actualIndices, m_nextIndices;
mutable int m_id, m_previousId;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */