[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/kotext/styles
From: Thomas Zander <zander () kde ! org>
Date: 2006-08-21 10:35:52
Message-ID: 1156156552.488636.29522.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 575337 by zander:
Add non breakable-lines property
Add api docs to style manager
M +1 -0 KoParagraphStyle.cpp
M +7 -0 KoParagraphStyle.h
M +76 -0 KoStyleManager.h
--- trunk/koffice/libs/kotext/styles/KoParagraphStyle.cpp #575336:575337
@@ -115,6 +115,7 @@
QTextFormat::BlockAlignment,
QTextFormat::TextIndent,
QTextFormat::BlockIndent,
+ QTextFormat::BlockNonBreakableLines,
StyleId,
FixedLineHeight,
MinimumLineHeight,
--- trunk/koffice/libs/kotext/styles/KoParagraphStyle.h #575336:575337
@@ -280,6 +280,10 @@
void setIndent (int indent) { setProperty(QTextFormat::BlockIndent, indent); }
/// duplicated property from QTextBlockFormat
int indent () const { return propertyInt(QTextFormat::BlockIndent); }
+ /// duplicated property from QTextBlockFormat
+ void setNonBreakableLines(bool on) { setProperty(QTextFormat::BlockNonBreakableLines, on); }
+ /// duplicated property from QTextBlockFormat
+ bool nonBreakableLines() const { return propertyBoolean(QTextFormat::BlockNonBreakableLines); }
/// set the parent style this one inherits its unset properties from.
void setParent(KoParagraphStyle *parent);
@@ -318,6 +322,9 @@
*/
void applyStyle(QTextBlock &block) const;
+ KoCharacterStyle *characterStyle() { return m_charStyle; }
+ const KoCharacterStyle *characterStyle() const { return m_charStyle; }
+
private:
void setProperty(int key, const QVariant &value);
void remove(int key);
--- trunk/koffice/libs/kotext/styles/KoStyleManager.h #575336:575337
@@ -29,27 +29,103 @@
class ChangeFollower;
class KoStyleManagerPrivate;
+/**
+ * Manages all character and pargraph styles for any number of documents.
+ */
class KOTEXT_EXPORT KoStyleManager : public QObject {
Q_OBJECT
public:
+ /**
+ * Create a new style manager.
+ * @param parent pass a parent to use qobject memory management
+ */
KoStyleManager(QObject *parent = 0);
+ /**
+ * Add a new style, automatically giving it a new styleId.
+ */
void add(KoCharacterStyle *style);
+ /**
+ * Add a new style, automatically giving it a new styleId.
+ */
void add(KoParagraphStyle *style);
+ /**
+ * Remove a style.
+ */
void remove(KoCharacterStyle *style);
+ /**
+ * Remove a style.
+ */
void remove(KoParagraphStyle *style);
+ /**
+ * Add a document for which the styles will be applied.
+ * Whenever a style is changed (signified by a alteredStyle() call) all
+ * registred documents will be updated to reflect that change.
+ */
void add(QTextDocument *document);
+ /**
+ * Remove a previously registred document.
+ */
void remove(QTextDocument *document);
+ /**
+ * Return a characterStyle by its id.
+ * From documents you can retrieve the id out of each QTextCharFormat
+ * by requesting the KoCharacterStyle::StyleId property.
+ * @param id the unique Id to search for.
+ * @see KoCharacterStyle::styleId()
+ */
KoCharacterStyle *characterStyle(int id) const;
+
+ /**
+ * Return a paragraphStyle by its id.
+ * From documents you can retrieve the id out of each QTextBlockFormat
+ * by requesting the KoParagraphStyle::StyleId property.
+ * @param id the unique Id to search for.
+ * @see KoParagraphStyle::styleId()
+ */
KoParagraphStyle *paragraphStyle(int id) const;
+
+ /**
+ * Return the first characterStyle with the param user-visible-name.
+ * Since the name does not have to be unique there can be multiple
+ * styles registred with that name, only the first is returned
+ * @param the name of the style.
+ * @see characterStyle(id);
+ */
KoCharacterStyle *characterStyle(const QString &name) const;
+
+ /**
+ * Return the first paragraphStyle with the param user-visible-name.
+ * Since the name does not have to be unique there can be multiple
+ * styles registred with that name, only the first is returned
+ * @param the name of the style.
+ * @see paragraphStyle(id);
+ */
KoParagraphStyle *paragraphStyle(const QString &name) const;
+
+ /**
+ * Return the default paragraph style that will always be present in each
+ * document. You can alter the style, but you can never delete it.
+ * The default is suppost to stay invisible to the user and its called
+ * i18n("[No Paragraph Style]") for that reason. Applications should not
+ * show this style in their document-level configure dialogs.
+ */
KoParagraphStyle *defaultParagraphStyle() const;
public slots:
+ /**
+ * Slot that should be called whenever a style is changed. This will update
+ * all documents with the style.
+ * Note that successive calls are aggregated.
+ */
void alteredStyle(const KoParagraphStyle *style);
+ /**
+ * Slot that should be called whenever a style is changed. This will update
+ * all documents with the style.
+ * Note that successive calls are aggregated.
+ */
void alteredStyle(const KoCharacterStyle *style);
private slots:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic