Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Private Member Functions
StyleItem Class Reference

Represents a style type that can be added to the Style Manager. More...

#include <styleitem.h>

Inheritance diagram for StyleItem:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 StyleItem ()
virtual ~StyleItem ()
virtual QTabWidget * widget ()=0
 return the QWidget for editing style's properties
virtual QString typeNamePlural ()=0
 name of the style (plural) (Paragraph Styles, Character Styles...)
virtual QString typeNameSingular ()=0
 name of the style (singular) (Paragraph Style, Character Style...)
virtual void currentDoc (ScribusDoc *doc)=0
 Whenever style manager is shown attached StyleItems get the current doc.
virtual QValueList< StyleNamestyles (bool reloadFromDoc=true)=0
 existing styles in this category
virtual void reload ()=0
 Reload styles and remove all cached (and possibly changed ones).
virtual void selected (const QStringList &styleNames)=0
 Whenever this function is called StyleItem must update the main.
virtual QString fromSelection () const =0
 Return the name of the style in this category applied to the.
virtual void toSelection (const QString &styleName) const =0
 Apply style called styleName to the documents current selection.
virtual QString newStyle ()=0
 Create a new temp.
virtual QString newStyle (const QString &fromStyle)=0
 Create a new temp.
virtual void apply ()=0
 apply changes made to the currently selected style(s)
virtual void editMode (bool isOn)
 When SM switches to or away from edit mode this function is called.
virtual QString shortcut (const QString &stylename) const =0
 returns the key combination for the style's shortcut
virtual void setShortcut (const QString &shortcut)=0
 set the key combination for the selected style's shortcut
virtual void deleteStyles (const QValueList< RemoveItem > &removeList)=0
 User has requested to delete all the selected styles.
virtual void nameChanged (const QString &newName)=0
 Called when the currently selected style's name has changed.
virtual QString getUniqueName (const QString &base)=0
 Return a unique name for a style using the base in the name.
virtual void languageChange ()=0
 reload all the gui strings whenever this method is called
virtual void unitChange ()=0
 document unit has been changed, upgrade widgets
QString typeName ()

Private Member Functions

 StyleItem (const StyleItem &)
void operator= (const StyleItem &)

Detailed Description

Represents a style type that can be added to the Style Manager.

palette.

This class is ment to be used as a parent class for any style types that are wanted to be configured using the Style Manager palette.

Author:
Riku Leino riku@.nosp@m.scri.nosp@m.bus.i.nosp@m.nfo
Date:
November 2005

Definition at line 36 of file styleitem.h.


Constructor & Destructor Documentation

Definition at line 11 of file styleitem.cpp.

                     : QObject()
{}
StyleItem::~StyleItem ( ) [virtual]

Definition at line 14 of file styleitem.cpp.

{}
StyleItem::StyleItem ( const StyleItem ) [private]

Definition at line 17 of file styleitem.cpp.

                                     : QObject()
{}

Member Function Documentation

virtual void StyleItem::apply ( ) [pure virtual]

apply changes made to the currently selected style(s)

When a user has edited a style (s)he can either cancel or apply changes. On cancel and ok button clicks no action is needed from the StyleItem but if a user chooses to press button apply StyleItem's function apply() is called and StyleItem must upgrade the style and apply it where ever that style is used in the document. (cancel will be disabled after this)

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::currentDoc ( ScribusDoc *  doc) [pure virtual]

Whenever style manager is shown attached StyleItems get the current doc.

passed to them with this function.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::deleteStyles ( const QValueList< RemoveItem > &  removeList) [pure virtual]

User has requested to delete all the selected styles.

Parameters:
removeListlist of styles to be deleted. RemoveItem::first is the style to be deleted and RemoveItem::second is the style to replace the deleted style with. If no replacement was requested RemoveItem::second has been set to QString::null.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::editMode ( bool  isOn) [inline, virtual]

When SM switches to or away from edit mode this function is called.

Parameters:
isOntrue if SM is in edit mode false if SM has just closed edit mode

Reimplemented in SMCharacterStyle, and SMParagraphStyle.

Definition at line 147 of file styleitem.h.

{};
virtual QString StyleItem::fromSelection ( ) const [pure virtual]

Return the name of the style in this category applied to the.

selected object(s) in the current document or QString::null if there is no selection in the document.

If there are multiple objects selected only return a style name if the same style is applied on all selected objects. If they doesn't share the same style then return QString::null.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual QString StyleItem::getUniqueName ( const QString &  base) [pure virtual]

Return a unique name for a style using the base in the name.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::languageChange ( ) [pure virtual]

reload all the gui strings whenever this method is called

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::nameChanged ( const QString &  newName) [pure virtual]

Called when the currently selected style's name has changed.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual QString StyleItem::newStyle ( ) [pure virtual]

Create a new temp.

style with default values and return the name of the newly created style.

Returns:
name of the created style

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual QString StyleItem::newStyle ( const QString &  fromStyle) [pure virtual]

Create a new temp.

style which is a clone of the style called fromStyle.

Parameters:
fromStylename of the style to clone
Returns:
name of the created style

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

void StyleItem::operator= ( const StyleItem ) [private]

Definition at line 20 of file styleitem.cpp.

{}
virtual void StyleItem::reload ( ) [pure virtual]

Reload styles and remove all cached (and possibly changed ones).

This function will be called whenever a user clicks on the reset button. Resetting styles means loading them from the doc replacing all cached styles and without applying changes to the previously cached styles.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::selected ( const QStringList &  styleNames) [pure virtual]

Whenever this function is called StyleItem must update the main.

widget with the corresponding data.

Whenever user selects a style from the style list in the manager this slot is called from the StyleItem. StyleItem must then update the main widget with the data related to the selected item and then just wait for apply() to apply the changes user made (with the main widget). When implementing this method one should note that there may be more than a single style selected.

Parameters:
styleNamesstyles selected for editing

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::setShortcut ( const QString &  shortcut) [pure virtual]

set the key combination for the selected style's shortcut

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual QString StyleItem::shortcut ( const QString &  stylename) const [pure virtual]

returns the key combination for the style's shortcut

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual QValueList<StyleName> StyleItem::styles ( bool  reloadFromDoc = true) [pure virtual]

existing styles in this category

return the names of cached styles (even if those are changed)

Parameters:
reloadFromDocshould the styles be loaded from the document or should function return currently cached and possibly changed styles
Returns:
Name of the styles and their parent as a QValueList. StyleName::first is the style name and StyleName::second it's parent's name. If the StyleItem has no parent StyleName::second should be set to QString::null.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::toSelection ( const QString &  styleName) const [pure virtual]

Apply style called styleName to the documents current selection.

Parameters:
styleNamename of the style to be applied to the documents current selection

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

QString StyleItem::typeName ( ) [inline]

Definition at line 177 of file styleitem.h.

{ return typeNamePlural(); };

Here is the call graph for this function:

virtual QString StyleItem::typeNamePlural ( ) [pure virtual]

name of the style (plural) (Paragraph Styles, Character Styles...)

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

Here is the caller graph for this function:

virtual QString StyleItem::typeNameSingular ( ) [pure virtual]

name of the style (singular) (Paragraph Style, Character Style...)

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::unitChange ( ) [pure virtual]

document unit has been changed, upgrade widgets

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.

virtual QTabWidget* StyleItem::widget ( ) [pure virtual]

return the QWidget for editing style's properties

This is the widget where the attributes of style are edited. It will be placed on the main tab widget's Properties page. Whenever a selected style is edited StyleItem should emit the signal selectionDirty() if it is the first time style is edited after applying previous changes.

Implemented in SMCharacterStyle, SMLineStyle, and SMParagraphStyle.


The documentation for this class was generated from the following files: