1/*
2 * Copyright 2008, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Fran��ois Revol <revol@free.fr>
7 */
8#ifndef STYLED_TEXT_IMPORTER_H
9#define STYLED_TEXT_IMPORTER_H
10
11
12#include "Importer.h"
13#include <Entry.h>
14
15class BMessage;
16class BShape;
17struct text_run;
18struct text_run_array;
19
20_BEGIN_ICON_NAMESPACE
21	class Icon;
22	class Style;
23_END_ICON_NAMESPACE
24
25struct style_map {
26	text_run *run;
27	Style *style;
28};
29
30/*! Turns text into its associated paths and shapes.
31	Coloring can also be imported from applications, such as StyledEdit, that
32	specify it in a supported format.
33*/
34class StyledTextImporter : public Importer {
35 public:
36								StyledTextImporter();
37	virtual						~StyledTextImporter();
38
39			status_t			Import(Icon* icon,
40									   BMessage* clipping);
41			status_t			Import(Icon* icon,
42									   const entry_ref* ref);
43
44 private:
45			status_t			_Import(Icon* icon, const char *text,
46										text_run_array *runs);
47
48			status_t			_AddStyle(Icon *icon, text_run *run);
49			status_t			_AddPaths(Icon *icon, BShape *shape);
50			status_t			_AddShape(Icon *icon, BShape *shape, text_run *run);
51
52			struct style_map	*fStyleMap;
53			int32				fStyleCount;
54};
55
56#endif // STYLED_TEXT_IMPORTER_H
57