#ifndef _Subtitles_h
#define _Subtitles_h

/*
 *	subtitleeditor -- a tool to create or edit subtitle
 *
 *	http://home.gna.org/subtitleeditor/
 *	https://gna.org/projects/subtitleeditor/
 *
 *	Copyright @ 2005-2009, kitone
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 3 of the License, or
 *	(at your option) any later version.
 *
 *	This program 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 General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
 

#include "subtitle.h"
#include <vector>

class Document;

class Subtitles
{
public:
	Subtitles(Document &doc);
	~Subtitles();

	/*
	 *
	 */
	unsigned int size();
	
	/*
	 *
	 */
	Subtitle get(unsigned int num);

	/*
	 *
	 */
	Subtitle get_first();

	/*
	 *
	 */
	Subtitle get_last();

	/*
	 *
	 */
	Subtitle get_previous(const Subtitle &sub);

	/*
	 *
	 */
	Subtitle get_next(const Subtitle &sub);

	/*
	 *
	 */
	Subtitle append();

	/*
	 *
	 */
	Subtitle insert_before(const Subtitle &sub);

	/*
	 *
	 */
	Subtitle insert_after(const Subtitle &sub);

	/*
	 *
	 */
	void remove(std::vector<Subtitle> &subs);

	/*
	 *
	 */
	void remove(unsigned int start, unsigned int end);

	/*
	 *
	 */
	Subtitle find(const SubtitleTime &time);

	/*
	 *
	 */
	Subtitle find_in_or_after(const SubtitleTime &time);

	/*
	 * Selection
	 */

	/*
	 *
	 */
	std::vector<Subtitle> get_selection();

	/*
	 *
	 */
	Subtitle get_first_selected();

	/*
	 *
	 */
	void select(std::vector<Subtitle> &sub);

	/*
	 *
	 */
	void select(const Subtitle &sub, bool start_editing=false);

	/*
	 *
	 */
	bool is_selected(const Subtitle &sub);

	/*
	 *
	 */
	void unselect(const Subtitle &sub);

	/*
	 *
	 */
	void select_all();

	/*
	 *
	 */
	void unselect_all();

	/*
	 *
	 */
	void invert_selection();

protected:
	Document& m_document;
};


#endif//_Subtitles_h

