Rev 4645 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
3 | paul | 7 | #ifndef HYPLUG_H |
8 | #define HYPLUG_H |
||
9 | |||
10 | #include <qobject.h> |
||
106 | Franz | 11 | #include <qtextcodec.h> |
2969 | craig | 12 | |
13 | #include "scribusapi.h" |
||
3 | paul | 14 | #include "hyphen.h" |
15 | class ScribusDoc; |
||
4026 | craig | 16 | class ScribusMainWindow; |
3 | paul | 17 | class PageItem; |
18 | |||
159 | Franz | 19 | /*! |
20 | This class is the core of the Scribus hyphenation system. |
||
21 | */ |
||
22 | |||
2969 | craig | 23 | class SCRIBUS_API Hyphenator : public QObject |
3 | paul | 24 | { |
4645 | subik | 25 | Q_OBJECT |
3 | paul | 26 | |
27 | public: |
||
4645 | subik | 28 | /*! |
29 | \brief Constructor reads user configuration and sets hyphenator properties. |
||
30 | \date |
||
31 | \author Franz Schmid |
||
32 | \param parent unused |
||
33 | \param dok ScribusDoc reference. It's used for preferences accessing. |
||
34 | */ |
||
35 | Hyphenator(QWidget* parent, ScribusDoc *dok); |
||
36 | /*! |
||
37 | \fn Hyphenator::~Hyphenator() |
||
38 | \brief Safely cleans hyphen. |
||
39 | \date |
||
40 | \author Franz Schmid |
||
41 | */ |
||
42 | ~Hyphenator(); |
||
6931 | avox | 43 | |
44 | private: |
||
45 | |||
4645 | subik | 46 | /*! Embeded reference to the \see ScribusDoc filled by \a dok */ |
3987 | craig | 47 | ScribusDoc *doc; |
6931 | avox | 48 | /*! Reference to the hyphen dictionary structure. */ |
49 | HyphenDict *hdict; |
||
50 | /*! Flag - if is the dictionary without errors etc. If is it 'false' |
||
51 | hyphen aborted. */ |
||
52 | bool useAble; |
||
53 | /*! Qt text codec which handles local characters. */ |
||
54 | QTextCodec *codec; |
||
55 | |||
56 | /*! |
||
57 | \brief Loads dictionary and fills parameters like \a useAble, \a codec, \a hdict. |
||
58 | \date |
||
59 | \author Franz Schmid |
||
60 | \param name is the name of specified language - filename. |
||
61 | */ |
||
62 | void NewDict(const QString& name); |
||
63 | |||
64 | public: |
||
4645 | subik | 65 | /*! There are languages having rule not to hyphen word shorter than |
6931 | avox | 66 | MinWordLen */ |
168 | Franz | 67 | int MinWordLen; |
249 | Franz | 68 | /*! Maximum number of hyphenations allowed following each other */ |
69 | int HyCount; |
||
4645 | subik | 70 | /*! Language in use */ |
168 | Franz | 71 | QString Language; |
4645 | subik | 72 | /*! Flag - if user set auto hyphen processing.*/ |
168 | Franz | 73 | bool Automatic; |
4645 | subik | 74 | /*! Flag - obsolete? */ |
168 | Franz | 75 | bool AutoCheck; |
6931 | avox | 76 | |
3 | paul | 77 | public slots: |
4645 | subik | 78 | /*! |
79 | \brief Writes actual hyphen configuration into \a doc object. |
||
80 | \date |
||
81 | \author Franz Schmid |
||
82 | \param Wordlen lenght of the word. |
||
83 | \param Autom is automatic flag. |
||
84 | \param ACheck AutoCheck flag. |
||
85 | \param Num HyCount |
||
86 | */ |
||
249 | Franz | 87 | void slotNewSettings(int Wordlen, bool Autom, bool ACheck, int Num); |
4645 | subik | 88 | /*! |
89 | \brief Make hyphenation when user edits text in text frame manually. |
||
90 | If is everything set correctly and textframe selected language fits the |
||
91 | dictionary language. At first removes any old hyphens then sets new one. |
||
92 | \param it references \see PageItem - text frame. |
||
93 | \param text is a word to hyphenate. |
||
94 | \param firstC is the first character of the word in \a it item. |
||
95 | */ |
||
6931 | avox | 96 | void slotHyphenateWord(PageItem* it, const QString& text, int firstC); |
4645 | subik | 97 | /*! |
98 | \brief Make hyphenation as described in \see slotHyphenateWord for the whole text frame. |
||
99 | \date |
||
100 | \author Franz Schmid |
||
101 | \param it references \see PageItem - text frame. |
||
102 | */ |
||
168 | Franz | 103 | void slotHyphenate(PageItem *it); |
4645 | subik | 104 | /*! |
105 | \fn void Hyphenator::slotDeHyphenate(PageItem* it) |
||
106 | \brief Removes hyphenation either for the whole text frame or the selected text if there is a selection. |
||
107 | \date |
||
108 | \author Franz Schmid |
||
109 | \param it references \see PageItem - text frame. |
||
110 | */ |
||
2621 | fschmid | 111 | void slotDeHyphenate(PageItem *it); |
3 | paul | 112 | }; |
4645 | subik | 113 | |
3 | paul | 114 | #endif |