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.
17 #include "lyxlength.h"
18 //#include "lengthcombo.h"
20 #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 lyx::docstring const formatted(lyx::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 ucs2 (a.k.a utf16) internally.
70 QString const toqstr(lyx::docstring const & ucs4);
72 void ucs4_to_qstring(lyx::char_type const * str, size_t ls, QString & s);
74 void ucs4_to_qstring(lyx::docstring const & str, QString & s);
76 lyx::docstring const qstring_to_ucs4(QString const & qstr);
78 void qstring_to_ucs4(QString const & qstr, std::vector<lyx::char_type> & ucs4);
80 inline lyx::char_type const qchar_to_ucs4(QChar const & qchar) {
81 return static_cast<lyx::char_type>(qchar.unicode());
84 inline QChar const ucs4_to_qchar(lyx::char_type const ucs4) {
85 return QChar(static_cast<unsigned short>(ucs4));
89 * qt_ - i18nize string and convert to unicode
91 * Use this in qt4/ instead of qt_()
93 QString const qt_(char const * str);
97 * qt_ - i18nize string and convert to unicode
99 * Use this in qt4/ instead of qt_()
101 QString const qt_(std::string const & str);
105 * fromqstr - convert QString into std::string in locale
107 * Return the QString encoded in the locale
109 std::string const fromqstr(QString const & str);
111 #endif // QTHELPERS_H