Scribus
Open source desktop publishing at your fingertips
StyleItem Class Referenceabstract

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

#include <styleitem.h>

Inheritance diagram for StyleItem:
Collaboration diagram for StyleItem:

Public Member Functions

virtual QTabWidget * widget ()=0
 return the QWidget for editing style's properties More...
 
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 setCurrentDoc (ScribusDoc *doc)=0
 Whenever style manager is shown attached StyleItems get the current doc. More...
 
virtual QList< StyleName > styles (bool reloadFromDoc=true)=0
 existing styles in this category More...
 
virtual void reload ()=0
 Reload styles and remove all cached (and possibly changed ones). More...
 
virtual void selected (const QStringList &styleNames)=0
 Whenever this function is called StyleItem must update the main. More...
 
virtual QString fromSelection () const =0
 Return the name of the style in this category applied to the. More...
 
virtual void toSelection (const QString &styleName) const =0
 Apply style called styleName to the documents current selection. More...
 
virtual QString newStyle ()=0
 Create a new temp. style with default values and return the. More...
 
virtual QString newStyle (const QString &fromStyle)=0
 Create a new temp. style which is a clone of the style called fromStyle. More...
 
virtual void apply ()=0
 apply changes made to the currently selected style(s) More...
 
virtual void editMode (bool isOn)
 When SM switches to or away from edit mode this function is called. More...
 
virtual bool isDefaultStyle (const QString &stylename) const =0
 returns if the style is a default style
 
virtual void setDefaultStyle (bool ids)=0
 set if the style is a default style
 
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 QList< RemoveItem > &removeList)=0
 User has requested to delete all the selected styles. More...
 
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 ()
 

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

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, SMCellStyle, SMTableStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::deleteStyles ( const QList< 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, SMCellStyle, SMTableStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::editMode ( bool  isOn)
inlinevirtual

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, SMCellStyle, SMTableStyle, and SMParagraphStyle.

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, SMCellStyle, SMTableStyle, 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, SMCellStyle, SMTableStyle, 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, SMCellStyle, SMTableStyle, SMLineStyle, and SMParagraphStyle.

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, SMCellStyle, SMTableStyle, 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, SMCellStyle, SMTableStyle, SMLineStyle, and SMParagraphStyle.

virtual void StyleItem::setCurrentDoc ( ScribusDoc doc)
pure virtual

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

passed to them with this function.

Implemented in SMCharacterStyle, SMCellStyle, SMTableStyle, SMLineStyle, and SMParagraphStyle.

virtual QList<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, SMCellStyle, SMTableStyle, 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, SMCellStyle, SMTableStyle, 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, SMCellStyle, SMTableStyle, SMLineStyle, and SMParagraphStyle.


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