Ki18n
kuitmarkup.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2012 Chusslove Illich <caslav.ilic@gmx.net>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef KUITMARKUP_H
21 #define KUITMARKUP_H
22 
23 #include <ki18n_export.h>
24 
25 #include <QtCore/QString>
26 #include <QtCore/QStringList>
27 #include <QtCore/QHash>
28 
29 class KUITSetup;
30 
34 namespace KUIT
35 {
39  enum VisualFormat {
51  PlainText = 10,
55  RichText = 20,
59  TermText = 30
60  };
61 
65  enum TagClass {
69  PhraseTag = 0,
73  StructTag = 1,
74  };
75 
86  typedef QString (*TagFormatter) (const QString &tagName,
87  const QHash &attributes,
88  const QString &text,
89  const QStringList &tagPath,
90  KUIT::VisualFormat format);
91 
98  KUITSetup &setupForCatalog (const QString &domain);
99 }
100 
101 
102 class KUITSetupPrivate;
103 class KLocalizedString;
104 
110 class KI18N_EXPORT KUITSetup
111 {
112  friend KUIT::setupForCatalog;
113 
114 public:
115 
119  ~KUITSetup ();
120 
139  void setTagPattern (const QString &tagName,
140  const QStringList &attrNames,
141  KUIT::VisualFormat format,
142  const KLocalizedString &pattern);
143 
156  void setTagPattern (const QString &tagName,
157  const QStringList &attrNames,
158  KUIT::VisualFormat format,
159  const KUIT::TagFormatter formatter);
160 
167  void setTagClass (const QString &tagName, KUIT::TagClass aClass);
168 
183  void setFormatForMarker (const QString &marker, KUIT::VisualFormat format);
184 
185 private:
186 
187  KUITSetup (const QString &domain);
188  KUITSetup (const KUITSetup &);
189 
190  const KUITSetupPrivate *d;
191 };
192 
193 #endif // KUITMARKUP_H