4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include "lyxlength.h"
16 #include "support/docstring.h"
31 std::string makeFontName(std::string const & family, std::string const & foundry);
33 std::pair<std::string,std::string> parseFontName(std::string const & name);
35 /// method to get a LyXLength from widgets (LengthCombo)
36 std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
37 /// method to get a LyXLength from widgets (QComboBox)
38 LyXLength widgetsToLength(QLineEdit const * input, QComboBox const * combo);
40 /// method to set widgets from a LyXLength
41 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
42 std::string const & len, LyXLength::UNIT default_unit);
44 /// format a string to the given width
45 docstring const formatted(docstring const & text, int w = 80);
48 * toqstr - convert char * into unicode
50 * Use this whenever there's a user-visible string that is encoded
51 * for the locale (menus, dialogs etc.)
53 QString const toqstr(char const * str);
57 * toqstr - convert string into unicode
59 * Use this whenever there's a user-visible string that is encoded
60 * for the locale (menus, dialogs etc.)
62 QString const toqstr(std::string const & str);
66 * toqstr - convert ucs4 into QString
68 * QString uses utf16 internally.
70 QString const toqstr(docstring const & ucs4);
72 void ucs4_to_qstring(char_type const * str, size_t ls, QString & s);
74 void ucs4_to_qstring(docstring const & str, QString & s);
76 QString ucs4_to_qstring(docstring const & str);
78 docstring const qstring_to_ucs4(QString const & qstr);
80 void qstring_to_ucs4(QString const & qstr, std::vector<char_type> & ucs4);
82 inline char_type const qchar_to_ucs4(QChar const & qchar) {
83 return static_cast<char_type>(qchar.unicode());
86 inline QChar const ucs4_to_qchar(char_type const ucs4) {
87 return QChar(static_cast<unsigned short>(ucs4));
91 * qt_ - i18nize string and convert to unicode
93 * Use this in qt4/ instead of qt_()
95 QString const qt_(char const * str);
99 * qt_ - i18nize string and convert to unicode
101 * Use this in qt4/ instead of qt_()
103 QString const qt_(std::string const & str);
107 * fromqstr - convert QString into std::string in locale
109 * Return the QString encoded in the locale
111 std::string const fromqstr(QString const & str);
116 #endif // QTHELPERS_H