Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Qt3::QStyleSheet Class Reference

#include </home/clem/local/src/opie/noncore/apps/opie-write/qstylesheet.h>

Collaboration diagram for Qt3::QStyleSheet:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QStyleSheet (QObject *parent=0, const char *name=0)
virtual ~QStyleSheet ()
QStyleSheetItemitem (const QString &name)
const QStyleSheetItemitem (const QString &name) const
void insert (QStyleSheetItem *item)
virtual QTextCustomItemtag (const QString &name, const QMap< QString, QString > &attr, const QString &context, const QMimeSourceFactory &factory, bool emptyTag, QTextDocument *doc) const
virtual void scaleFont (QFont &font, int logicalSize) const
virtual void error (const QString &) const

Static Public Member Functions

static QStyleSheetdefaultSheet ()
static void setDefaultSheet (QStyleSheet *)
static QString escape (const QString &)
static QString convertFromPlainText (const QString &, QStyleSheetItem::WhiteSpaceMode mode=QStyleSheetItem::WhiteSpacePre)
static bool mightBeRichText (const QString &)

Private Member Functions

void init ()

Private Attributes

QDict< QStyleSheetItemstyles
QStyleSheetItemnullstyle

Constructor & Destructor Documentation

QStyleSheet::QStyleSheet QObject *  parent = 0,
const char *  name = 0
 

Creates a style sheet called name, with parent parent. Like any QObject it will be deleted when its parent is destroyed (if the child still exists).

By default the style sheet has the tag definitions defined above.

Definition at line 1054 of file qstylesheet.cpp.

References init().

Referenced by defaultSheet().

QStyleSheet::~QStyleSheet  )  [virtual]
 

Destroys the style sheet. All styles inserted into the style sheet will be deleted.

Definition at line 1064 of file qstylesheet.cpp.


Member Function Documentation

QString QStyleSheet::convertFromPlainText const QString plain,
QStyleSheetItem::WhiteSpaceMode  mode = QStyleSheetItem::WhiteSpacePre
[static]
 

Auxiliary function. Converts the plain text string plain to a rich text formatted paragraph while preserving most of its look.

mode defines the whitespace mode. Possible values are QStyleSheetItem::WhiteSpacePre (no wrapping, all whitespaces preserved) and QStyleSheetItem::WhiteSpaceNormal (wrapping, simplified whitespaces).

See also:
escape()

Definition at line 1369 of file qstylesheet.cpp.

References col, i, isSpace(), QString::length(), and Qt3::QStyleSheetItem::WhiteSpacePre.

QStyleSheet * QStyleSheet::defaultSheet  )  [static]
 

Returns the application-wide default style sheet. This style sheet is used by rich text rendering classes such as QSimpleRichText, QWhatsThis and QMessageBox to define the rendering style and available tags within rich text documents. It also serves as the initial style sheet for the more complex render widgets, QTextEdit and QTextBrowser.

See also:
setDefaultSheet()

Definition at line 1259 of file qstylesheet.cpp.

References QStyleSheet(), and QSingleCleanupHandler< Type >::set().

Referenced by Qt3::QTextDocument::init(), and mightBeRichText().

void QStyleSheet::error const QString msg  )  const [virtual]
 

This virtual function is called when an error occurs when processing rich text. Reimplement it if you need to catch error messages.

Errors might occur if some rich text strings contain tags that are not understood by the stylesheet, if some tags are nested incorrectly, or if tags are not closed properly.

msg is the error message.

Definition at line 1515 of file qstylesheet.cpp.

Referenced by Qt3::QTextDocument::setRichTextInternal().

QString QStyleSheet::escape const QString plain  )  [static]
 

Auxiliary function. Converts the plain text string plain to a rich text formatted string with any HTML meta-characters escaped.

See also:
convertFromPlainText()

Definition at line 1423 of file qstylesheet.cpp.

References i, and QString::length().

void QStyleSheet::init  )  [private]
 

For internal use only.

Initialized the style sheet to the basic Qt style.

Definition at line 1072 of file qstylesheet.cpp.

References Qt::AlignCenter, Qt3::QStyleSheetItem::DisplayBlock, Qt3::QStyleSheetItem::DisplayListItem, Qt3::QStyleSheetItem::DisplayNone, FALSE, QString::fromLatin1(), Qt3::QStyleSheetItem::ListDecimal, Qt3::QStyleSheetItem::ListDisc, Qt3::QStyleSheetItem::MarginBottom, Qt3::QStyleSheetItem::MarginHorizontal, Qt3::QStyleSheetItem::MarginLeft, Qt3::QStyleSheetItem::MarginTop, Qt3::QStyleSheetItem::MarginVertical, nullstyle, Qt3::QStyleSheetItem::setAlignment(), Qt3::QStyleSheetItem::setAnchor(), QPtrCollection::setAutoDelete(), Qt3::QStyleSheetItem::setContexts(), Qt3::QStyleSheetItem::setDisplayMode(), Qt3::QStyleSheetItem::setFontFamily(), Qt3::QStyleSheetItem::setFontItalic(), Qt3::QStyleSheetItem::setFontStrikeOut(), Qt3::QStyleSheetItem::setFontUnderline(), Qt3::QStyleSheetItem::setFontWeight(), Qt3::QStyleSheetItem::setListStyle(), Qt3::QStyleSheetItem::setLogicalFontSize(), Qt3::QStyleSheetItem::setLogicalFontSizeStep(), Qt3::QStyleSheetItem::setMargin(), Qt3::QStyleSheetItem::setNumberOfColumns(), Qt3::QStyleSheetItem::setSelfNesting(), Qt3::QStyleSheetItem::setVerticalAlignment(), Qt3::QStyleSheetItem::setWhiteSpaceMode(), styles, TRUE, Qt3::QStyleSheetItem::VAlignSub, Qt3::QStyleSheetItem::VAlignSuper, Qt3::QStyleSheetItem::WhiteSpaceNoWrap, and Qt3::QStyleSheetItem::WhiteSpacePre.

Referenced by QStyleSheet().

void QStyleSheet::insert QStyleSheetItem style  ) 
 

For internal use only.

Inserts style. Any tags generated after this time will be bound to this style. Note that style becomes owned by the style sheet and will be deleted when the style sheet is destroyed.

Definition at line 1292 of file qstylesheet.cpp.

References QDict< type >::insert(), and styles.

Referenced by Qt3::QStyleSheetItem::QStyleSheetItem().

const QStyleSheetItem * QStyleSheet::item const QString name  )  const
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the style called name or 0 if there is no such style (const version)

Definition at line 1314 of file qstylesheet.cpp.

References QString::isNull(), and styles.

QStyleSheetItem * QStyleSheet::item const QString name  ) 
 

Returns the style called name or 0 if there is no such style.

Definition at line 1301 of file qstylesheet.cpp.

References QString::isNull(), and styles.

Referenced by Qt3::QTextDocument::parseTable(), Qt3::QTextDocument::setRichTextInternal(), and tag().

bool QStyleSheet::mightBeRichText const QString text  )  [static]
 

Returns TRUE if the string text is likely to be rich text; otherwise returns FALSE.

This function uses a fast and therefore simple heuristic. It mainly checks whether there is something that looks like a tag before the first line break. Although the result may be correct for common cases, there is no guarantee.

Definition at line 1470 of file qstylesheet.cpp.

References defaultSheet(), FALSE, QString::find(), i, QString::isEmpty(), isSpace(), QString::left(), QString::length(), QString::lower(), QString::mid(), tag(), and TRUE.

Referenced by Qt3::QTextEdit::append(), and Qt3::QTextDocument::setText().

void QStyleSheet::scaleFont QFont &  font,
int  logicalSize
const [virtual]
 

Scales the font font to the appropriate physical point size corresponding to the logical font size logicalSize.

When calling this function, font has a point size corresponding to the logical font size 3.

Logical font sizes range from 1 to 7, with 1 being the smallest.

See also:
QStyleSheetItem::logicalFontSize(), QStyleSheetItem::logicalFontSizeStep(), QFont::setPointSize()

Definition at line 1531 of file qstylesheet.cpp.

References FALSE, s, and TRUE.

Referenced by Qt3::QTextFormatCollection::updateDefaultFormat().

void QStyleSheet::setDefaultSheet QStyleSheet sheet  )  [static]
 

Sets the application-wide default style sheet to sheet, deleting any style sheet previously set. The ownership is transferred to QStyleSheet.

See also:
defaultSheet()

Definition at line 1275 of file qstylesheet.cpp.

References QSingleCleanupHandler< Type >::reset(), and QSingleCleanupHandler< Type >::set().

QTextCustomItem * QStyleSheet::tag const QString name,
const QMap< QString, QString > &  attr,
const QString context,
const QMimeSourceFactory &  factory,
bool  emptyTag,
QTextDocument doc
const [virtual]
 

Generates an internal object for the tag called name, given the attributes attr, and using additional information provided by the mime source factory factory.

context is the optional context of the document, i.e. the path to look for relative links. This becomes important if the text contains relative references, for example within image tags. QSimpleRichText always uses the default mime source factory (see {QMimeSourceFactory::defaultFactory()}) to resolve these references. The context will then be used to calculate the absolute path. See QMimeSourceFactory::makeAbsolute() for details.

emptyTag and doc are for internal use only.

This function should not be used in application code.

Definition at line 1341 of file qstylesheet.cpp.

References item(), and Qt3::QStyleSheetItem::name().

Referenced by mightBeRichText(), and Qt3::QTextDocument::setRichTextInternal().


Member Data Documentation

QStyleSheetItem* Qt3::QStyleSheet::nullstyle [private]
 

Definition at line 220 of file qstylesheet.h.

Referenced by init().

QDict<QStyleSheetItem> Qt3::QStyleSheet::styles [private]
 

Definition at line 219 of file qstylesheet.h.

Referenced by init(), insert(), and item().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 18:03:45 2005 for OPIE by  doxygen 1.4.2