Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes
SMCharacterStyle Class Reference

#include <smtextstyles.h>

Inheritance diagram for SMCharacterStyle:
Inheritance graph
[legend]
Collaboration diagram for SMCharacterStyle:
Collaboration graph
[legend]

List of all members.

Signals

void selectionDirty ()

Public Member Functions

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

Private Slots

void slotFontSize ()
void slotEffects (int e)
void slotEffectProperties ()
void slotFillColor ()
void slotFillShade ()
void slotStrokeColor ()
void slotStrokeShade ()
void slotLanguage ()
void slotScaleH ()
void slotScaleV ()
void slotTracking ()
void slotBaselineOffset ()
void slotFont (QString s)
void slotParentChanged (const QString &parent)

Private Member Functions

void reloadTmpStyles ()
void setupConnections ()
void removeConnections ()

Private Attributes

QTabWidget * widget_
SMCStylePagepage_
ScribusDoc * doc_
StyleSet< CharStyle > tmpStyles_
QValueList< CharStyle * > selection_
QValueList< RemoveItemdeleted_
bool selectionIsDirty_

Detailed Description

Definition at line 101 of file smtextstyles.h.


Constructor & Destructor Documentation

Definition at line 1178 of file smtextstyles.cpp.

                                   : StyleItem(), widget_(0), page_(0), doc_(0), selectionIsDirty_(false)
{
       widget_ = new QTabWidget();
       Q_CHECK_PTR(widget_);
       widget_->setMargin(5);//CB the SMCStylePage parent has a 0 value to fit properly onto the pstyle page, so add it here
       page_ = new SMCStylePage();
       Q_CHECK_PTR(page_);
       widget_->addTab(page_, tr("Properties"));
}

Here is the call graph for this function:

Definition at line 1954 of file smtextstyles.cpp.

{
       delete page_;
       delete widget_;
       page_ = 0;
       widget_ = 0;
}

Member Function Documentation

void SMCharacterStyle::apply ( ) [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)

Implements StyleItem.

Definition at line 1372 of file smtextstyles.cpp.

{
       if (!doc_)
              return;

       QMap<QString, QString> replacement;
       for (uint i = 0; i < deleted_.count(); ++i)
              replacement[deleted_[i].first] = deleted_[i].second;

       doc_->redefineCharStyles(tmpStyles_, false);
       doc_->replaceCharStyles(replacement);

       deleted_.clear(); // deletion done at this point

       doc_->scMW()->propertiesPalette->paraStyleCombo->updateFormatList();
       doc_->scMW()->propertiesPalette->charStyleCombo->updateFormatList();
       doc_->scMW()->view->DrawNew();
       doc_->changed();
}
void SMCharacterStyle::currentDoc ( ScribusDoc *  doc) [virtual]

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

passed to them with this function.

Implements StyleItem.

Definition at line 1203 of file smtextstyles.cpp.

{
       doc_ = doc;
       if (doc_)
       {
              if (page_)
              {
                     page_->fillLangCombo(doc_->scMW()->LangTransl);
                     page_->fillColorCombo(doc_->PageColors);
                     page_->fontFace_->RebuildList(doc_);
              }
       }
       else
       {
              removeConnections();
              selection_.clear();
              tmpStyles_.clear();
       }

}

Here is the call graph for this function:

void SMCharacterStyle::deleteStyles ( const QValueList< RemoveItem > &  removeList) [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.

Implements StyleItem.

Definition at line 1423 of file smtextstyles.cpp.

{
       for (uint i = 0; i < removeList.count(); ++i)
       {
              for (uint k = 0; k < selection_.count(); ++k)
              {
                     if (selection_[k]->name() == removeList[i].first)
                     {
                            selection_.erase(selection_.at(k));
                            break;
                     }
              }

              int index = tmpStyles_.find(removeList[i].first);
              if (index > -1)
                     tmpStyles_.remove(index);
              deleted_ << removeList[i];
       }
}

Here is the call graph for this function:

void SMCharacterStyle::editMode ( bool  isOn) [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 from StyleItem.

Definition at line 1392 of file smtextstyles.cpp.

{
       if (isOn)
              reloadTmpStyles();
}

Here is the call graph for this function:

QString SMCharacterStyle::fromSelection ( ) const [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.

Implements StyleItem.

Definition at line 1285 of file smtextstyles.cpp.

{
       QString lsName(QString::null);
       if (!doc_)
              return lsName; // no doc available

       for (uint i = 0; i < doc_->m_Selection->count(); ++i)
       {
              // wth is going on here
              PageItem *item = doc_->m_Selection->itemAt(i);

              QString tmpName = item->itemText.defaultStyle().charStyle().parent();

              if (lsName.isNull() && !tmpName.isEmpty() && tmpName != "")
              {
                     lsName = tmpName;
              }
              else if (!lsName.isNull() && !tmpName.isEmpty() && tmpName != "" && lsName != tmpName)
              {
                     lsName = QString::null;
                     break;
              }
       }
       return lsName;
}
QString SMCharacterStyle::getUniqueName ( const QString &  base) [virtual]

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

Implements StyleItem.

Definition at line 1345 of file smtextstyles.cpp.

{
       int id = 0;
       bool done = false;
       QString s(name);

       while (!done)
       {
start:
              ++id;
              for (uint i = 0; i < tmpStyles_.count(); ++i)
              {
                     if (tmpStyles_[i].name() == s)
                     {
                            s = tr("%1 (%2)", "This for unique name when creating "
                                          "a new character style. %1 will be the name "
                                                        "of the style and %2 will be a number forming "
                                                        "a style name like: New Style (2)").arg(name).arg(id);
                            goto start;
                     }
              }
              done = true;
       }

       return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

reload all the gui strings whenever this method is called

Implements StyleItem.

Definition at line 1490 of file smtextstyles.cpp.

{
       if (widget_ && page_)
       {
              widget_->setTabLabel(page_, tr("Properties"));
              page_->languageChange();
       }
}

Here is the call graph for this function:

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

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

Implements StyleItem.

Definition at line 1443 of file smtextstyles.cpp.

{
//     for (uint i = 0; i < selection_.count(); ++i)
//            selection_[i]->setName(newName);

       QString oldName(selection_[0]->name());
       CharStyle c(*selection_[0]);
       c.setName(newName);
       tmpStyles_.create(c);
       selection_.clear();
       selection_.append(&tmpStyles_[tmpStyles_.find(newName)]);
       for (uint j = 0; j < tmpStyles_.count(); ++j)
       {
              int index = tmpStyles_.find(oldName);
              if (index > -1)
              {
                     tmpStyles_.remove(index);
                     break;
              }
       }

       for (uint j = 0; j < tmpStyles_.count(); ++j)
       {
              if (tmpStyles_[j].parent() == oldName)
                     tmpStyles_[j].setParent(newName);
       }

       QValueList<RemoveItem>::iterator it;
       for (it = deleted_.begin(); it != deleted_.end(); ++it)
       {
              if ((*it).second == oldName)
              {
                     oldName = (*it).first;
                     deleted_.remove(it);
                     break;
              }
       }

       deleted_.append(RemoveItem(oldName, newName));

       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

QString SMCharacterStyle::newStyle ( ) [virtual]

Create a new temp.

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

Returns:
name of the created style

Implements StyleItem.

Definition at line 1319 of file smtextstyles.cpp.

{
       Q_ASSERT(doc_ && doc_->paragraphStyles().count() > 0);

       QString s = getUniqueName( tr("New Style"));
       CharStyle c;
       c.setName(s);
       tmpStyles_.create(c);
       return s;
}

Here is the call graph for this function:

QString SMCharacterStyle::newStyle ( const QString &  fromStyle) [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

Implements StyleItem.

Definition at line 1330 of file smtextstyles.cpp.

{
       Q_ASSERT(tmpStyles_.resolve(fromStyle));
       if (!tmpStyles_.resolve(fromStyle))
              return QString::null;

       QString s = getUniqueName( tr("Clone of %1").arg(fromStyle));
       CharStyle c(tmpStyles_[fromStyle]);
       c.setName(s);
       c.setShortcut(QString::null);
       tmpStyles_.create(c);

       return s;
}

Here is the call graph for this function:

void SMCharacterStyle::reload ( ) [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.

Implements StyleItem.

Definition at line 1256 of file smtextstyles.cpp.

Here is the call graph for this function:

Definition at line 1504 of file smtextstyles.cpp.

{
       if (!doc_)
              return;

       selection_.clear();
       tmpStyles_.clear();
       tmpStyles_.redefine(doc_->charStyles(), true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1550 of file smtextstyles.cpp.

{
       if (!page_)
              return;

       disconnect(page_->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
       disconnect(page_->effects_, SIGNAL(State(int)), this, SLOT(slotEffects(int)));
       disconnect(page_->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       disconnect(page_->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       disconnect(page_->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       disconnect(page_->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       disconnect(page_->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       disconnect(page_->effects_->StrikeVal->LPos, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       disconnect(page_->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       disconnect(page_->fillColor_, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor()));
       disconnect(page_->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade()));
       disconnect(page_->strokeColor_, SIGNAL(activated(const QString&)), this, SLOT(slotStrokeColor()));
       disconnect(page_->strokeShade_, SIGNAL(clicked()), this, SLOT(slotStrokeShade()));
       disconnect(page_->language_, SIGNAL(activated(int)), this, SLOT(slotLanguage()));
       disconnect(page_->fontSize_, SIGNAL(valueChanged(int)), this, SLOT(slotFontSize()));
       disconnect(page_->fontHScale_, SIGNAL(valueChanged(int)), this, SLOT(slotScaleH()));
       disconnect(page_->fontVScale_, SIGNAL(valueChanged(int)), this, SLOT(slotScaleV()));
       disconnect(page_->tracking_, SIGNAL(valueChanged(int)), this, SLOT(slotTracking()));
       disconnect(page_->baselineOffset_, SIGNAL(valueChanged(int)), this, SLOT(slotBaselineOffset()));
       disconnect(page_->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
       disconnect(page_->parentCombo, SIGNAL(activated(const QString&)),
                     this, SLOT(slotParentChanged(const QString&)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::selected ( const QStringList &  styleNames) [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

Implements StyleItem.

Definition at line 1261 of file smtextstyles.cpp.

{
       selection_.clear();
       selectionIsDirty_ = false;
       removeConnections();
       QValueList<CharStyle> cstyles;

       tmpStyles_.invalidate();

       for (uint i = 0; i < tmpStyles_.count(); ++i)
              cstyles << tmpStyles_[i];

       for (uint i = 0; i < styleNames.count(); ++i)
       {
              int index = tmpStyles_.find(styleNames[i]);
              if (index > -1)
                     selection_.append(&tmpStyles_[index]);

       }

       page_->show(selection_, cstyles, doc_->paragraphStyle("").charStyle().language(), doc_->unitIndex());
       setupConnections();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

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

set the key combination for the selected style's shortcut

Implements StyleItem.

Definition at line 1408 of file smtextstyles.cpp.

{
       Q_ASSERT(selection_.count() == 1);
       if (selection_.count() != 1)
              return;

       selection_[0]->setShortcut(shortcut);

       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Definition at line 1514 of file smtextstyles.cpp.

{
       if (!page_)
              return;

       connect(page_->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
       connect(page_->effects_, SIGNAL(State(int)), this, SLOT(slotEffects(int)));
       connect(page_->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       connect(page_->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       connect(page_->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       connect(page_->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       connect(page_->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       connect(page_->effects_->StrikeVal->LPos, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       connect(page_->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(int)),
                        this, SLOT(slotEffectProperties()));
       connect(page_->fillColor_, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor()));
       connect(page_->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade()));
       connect(page_->strokeColor_, SIGNAL(activated(const QString&)), this, SLOT(slotStrokeColor()));
       connect(page_->strokeShade_, SIGNAL(clicked()), this, SLOT(slotStrokeShade()));
       connect(page_->language_, SIGNAL(activated(int)), this, SLOT(slotLanguage()));
       connect(page_->fontSize_, SIGNAL(valueChanged(int)), this, SLOT(slotFontSize()));
       connect(page_->fontHScale_, SIGNAL(valueChanged(int)), this, SLOT(slotScaleH()));
       connect(page_->fontVScale_, SIGNAL(valueChanged(int)), this, SLOT(slotScaleV()));
       connect(page_->tracking_, SIGNAL(valueChanged(int)), this, SLOT(slotTracking()));
       connect(page_->baselineOffset_, SIGNAL(valueChanged(int)), this, SLOT(slotBaselineOffset()));
       connect(page_->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
       connect(page_->parentCombo, SIGNAL(activated(const QString&)),
               this, SLOT(slotParentChanged(const QString&)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

QString SMCharacterStyle::shortcut ( const QString &  stylename) const [virtual]

returns the key combination for the style's shortcut

Implements StyleItem.

Definition at line 1398 of file smtextstyles.cpp.

{
       QString s = QString::null;
       int index = tmpStyles_.find(stylename);
       if (index > -1)
              s = tmpStyles_[index].shortcut();

       return s;
}

Here is the call graph for this function:

void SMCharacterStyle::slotBaselineOffset ( ) [private, slot]

Definition at line 1889 of file smtextstyles.cpp.

{
       if (page_->baselineOffset_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetBaselineOffset();
       else
       {
              double a, b, value;
              int c;
              
              page_->baselineOffset_->getValues(&a, &b, &c, &value);
              value = value * 10;
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setBaselineOffset(qRound(value));
       }

       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotEffectProperties ( ) [private, slot]

Definition at line 1671 of file smtextstyles.cpp.

{
       double a, b, sxo, syo, olw, ulp, ulw, slp, slw;
       int c;

       page_->effects_->ShadowVal->Xoffset->getValues(&a, &b, &c, &sxo);
       sxo *= 10;
       page_->effects_->ShadowVal->Yoffset->getValues(&a, &b, &c, &syo);
       syo *= 10;

       page_->effects_->OutlineVal->LWidth->getValues(&a, &b, &c, &olw);
       olw *= 10;

       page_->effects_->UnderlineVal->LPos->getValues(&a, &b, &c, &ulp);
       ulp *= 10;
       page_->effects_->UnderlineVal->LWidth->getValues(&a, &b, &c, &ulw);
       ulw *= 10;

       page_->effects_->StrikeVal->LPos->getValues(&a, &b, &c, &slp);
       slp *= 10;
       page_->effects_->StrikeVal->LWidth->getValues(&a, &b, &c, &slw);
       slw *= 10;
       
       for (uint i = 0; i < selection_.count(); ++i)
       {
              selection_[i]->setShadowXOffset(qRound(sxo));
              selection_[i]->setShadowYOffset(qRound(syo));
              selection_[i]->setOutlineWidth(qRound(olw));
              selection_[i]->setUnderlineOffset(qRound(ulp));
              selection_[i]->setUnderlineWidth(qRound(ulw));
              selection_[i]->setStrikethruOffset(qRound(slp));
              selection_[i]->setStrikethruWidth(qRound(slw));
       }

       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotEffects ( int  e) [private, slot]

Definition at line 1609 of file smtextstyles.cpp.

{
       StyleFlag s = ScStyle_None;
       if (page_->effects_->useParentValue())
       {
              for (uint i = 0; i < selection_.count(); ++i)
              {
                     selection_[i]->resetFeatures();
                     selection_[i]->resetShadowXOffset();
                     selection_[i]->resetShadowYOffset();
                     selection_[i]->resetOutlineWidth();
                     selection_[i]->resetUnderlineOffset();
                     selection_[i]->resetUnderlineWidth();
                     selection_[i]->resetStrikethruOffset();
                     selection_[i]->resetStrikethruWidth();
              }
       }
       else
       {
              s = static_cast<StyleFlag>(e);
              double a, b, sxo, syo, olw, ulp, ulw, slp, slw;
              int c;

              page_->effects_->ShadowVal->Xoffset->getValues(&a, &b, &c, &sxo);
              sxo *= 10;
              page_->effects_->ShadowVal->Yoffset->getValues(&a, &b, &c, &syo);
              syo *= 10;

              page_->effects_->OutlineVal->LWidth->getValues(&a, &b, &c, &olw);
              olw *= 10;

              page_->effects_->UnderlineVal->LPos->getValues(&a, &b, &c, &ulp);
              ulp *= 10;
              page_->effects_->UnderlineVal->LWidth->getValues(&a, &b, &c, &ulw);
              ulw *= 10;

              page_->effects_->StrikeVal->LPos->getValues(&a, &b, &c, &slp);
              slp *= 10;
              page_->effects_->StrikeVal->LWidth->getValues(&a, &b, &c, &slw);
              slw *= 10;

              for (uint i = 0; i < selection_.count(); ++i)
              {
                     selection_[i]->setFeatures(s.featureList());
                     selection_[i]->setShadowXOffset(qRound(sxo));
                     selection_[i]->setShadowYOffset(qRound(syo));
                     selection_[i]->setOutlineWidth(qRound(olw));
                     selection_[i]->setUnderlineOffset(qRound(ulp));
                     selection_[i]->setUnderlineWidth(qRound(ulw));
                     selection_[i]->setStrikethruOffset(qRound(slp));
                     selection_[i]->setStrikethruWidth(qRound(slw));
              }
       }


       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotFillColor ( ) [private, slot]

Definition at line 1712 of file smtextstyles.cpp.

{
       if (page_->fillColor_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetFillColor();
       else {        
              QString col(page_->fillColor_->currentText());
              
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setFillColor(col);
       }
       
       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotFillShade ( ) [private, slot]

Definition at line 1731 of file smtextstyles.cpp.

{
       if (page_->fillShade_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetFillShade();
       else {
              int fs = page_->fillShade_->getValue();

              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setFillShade(fs);
       }
       
       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotFont ( QString  s) [private, slot]

Definition at line 1912 of file smtextstyles.cpp.

{
       ScFace sf;
       if (page_->fontFace_->useParentFont())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetFont();
       else {
              sf = PrefsManager::instance()->appPrefs.AvailFonts[s];

              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setFont(sf);
       }
       
       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotFontSize ( ) [private, slot]

Definition at line 1586 of file smtextstyles.cpp.

{
       if (page_->fontSize_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetFontSize();
       else
       {
              double a, b, value;
              int c;

              page_->fontSize_->getValues(&a, &b, &c, &value);
              value = value * 10;
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setFontSize(qRound(value));
       }

       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotLanguage ( ) [private, slot]

Definition at line 1788 of file smtextstyles.cpp.

{
       QMap<QString,QString>::Iterator it;
       QString language = doc_->paragraphStyle("").charStyle().language();

       if (page_->language_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetLanguage();
       else
       {
              for (it = doc_->scMW()->LangTransl.begin(); it != doc_->scMW()->LangTransl.end(); ++it)
              {
                     if (it.data() == page_->language_->currentText())
                     {
                            language = it.key();
                            break;
                     }
              }
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setLanguage(language);
       }


       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotParentChanged ( const QString &  parent) [private, slot]

Definition at line 1932 of file smtextstyles.cpp.

{
       Q_ASSERT(!parent.isNull());

       QStringList sel;

       for (uint i = 0; i < selection_.count(); ++i)
       {
              selection_[i]->erase();
              selection_[i]->setParent(parent);
              sel << selection_[i]->name();
       }

       selected(sel);

       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotScaleH ( ) [private, slot]

Definition at line 1818 of file smtextstyles.cpp.

{
       if (page_->fontHScale_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetScaleH();
       else
       {
              double a, b, value;
              int c;

              page_->fontHScale_->getValues(&a, &b, &c, &value);
              value = value * 10;
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setScaleH(qRound(value));
       }


       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotScaleV ( ) [private, slot]

Definition at line 1842 of file smtextstyles.cpp.

{
       if (page_->fontVScale_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetScaleV();
       else
       {
              double a, b, value;
              int c;

              page_->fontVScale_->getValues(&a, &b, &c, &value);
              value = value * 10;
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setScaleV(qRound(value));
       }


       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotStrokeColor ( ) [private, slot]

Definition at line 1750 of file smtextstyles.cpp.

{
       if (page_->strokeColor_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetStrokeColor();
       else {
              QString c(page_->strokeColor_->currentText());

              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setStrokeColor(c);
       }
       
       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotStrokeShade ( ) [private, slot]

Definition at line 1769 of file smtextstyles.cpp.

{
       if (page_->strokeShade_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetStrokeShade();
       else {
              int ss = page_->strokeShade_->getValue();
              
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setStrokeShade(ss);
       }
       
       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMCharacterStyle::slotTracking ( ) [private, slot]

Definition at line 1866 of file smtextstyles.cpp.

{
       if (page_->tracking_->useParentValue())
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->resetTracking();
       else
       {
              double a, b, value;
              int c;

              page_->tracking_->getValues(&a, &b, &c, &value);
              value = value * 10;
              for (uint i = 0; i < selection_.count(); ++i)
                     selection_[i]->setTracking(qRound(value));
       }

       if (!selectionIsDirty_)
       {
              selectionIsDirty_ = true;
              emit selectionDirty();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

QValueList< StyleName > SMCharacterStyle::styles ( bool  reloadFromDoc = true) [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.

Implements StyleItem.

Definition at line 1229 of file smtextstyles.cpp.

{
       QValueList<StyleName> tmpList;

       if (!doc_)
              return tmpList; // no doc available

       if (reloadFromDoc)
              reloadTmpStyles();

       for (uint i = 0; i < tmpStyles_.count(); ++i)
       {
              if (tmpStyles_[i].hasName())
              {
                     QString styleName(tmpStyles_[i].name());
                     QString parentName(QString::null);

                     if (tmpStyles_[i].hasParent())
                            parentName = tmpStyles_[i].parent();

                     tmpList << StyleName(styleName, parentName);
              }
       }

       return tmpList;
}

Here is the call graph for this function:

Definition at line 1224 of file smtextstyles.cpp.

{
       return &tmpStyles_;
}
void SMCharacterStyle::toSelection ( const QString &  styleName) const [virtual]

Apply style called styleName to the documents current selection.

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

Implements StyleItem.

Definition at line 1311 of file smtextstyles.cpp.

{
       if (!doc_)
              return; // nowhere to apply or no doc

       doc_->itemSelection_SetNamedCharStyle(styleName);
}
QString StyleItem::typeName ( ) [inline, inherited]

Definition at line 177 of file styleitem.h.

{ return typeNamePlural(); };

Here is the call graph for this function:

QString SMCharacterStyle::typeNamePlural ( ) [virtual]

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

Implements StyleItem.

Definition at line 1193 of file smtextstyles.cpp.

{
       return tr("Character Styles");
}

Here is the call graph for this function:

QString SMCharacterStyle::typeNameSingular ( ) [virtual]

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

Implements StyleItem.

Definition at line 1198 of file smtextstyles.cpp.

{
       return tr("Character Style");
}

Here is the call graph for this function:

void SMCharacterStyle::unitChange ( ) [virtual]

document unit has been changed, upgrade widgets

Implements StyleItem.

Definition at line 1499 of file smtextstyles.cpp.

{

}
QTabWidget * SMCharacterStyle::widget ( ) [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.

Implements StyleItem.

Definition at line 1188 of file smtextstyles.cpp.

{
       return widget_;
}

Member Data Documentation

QValueList<RemoveItem> SMCharacterStyle::deleted_ [private]

Definition at line 139 of file smtextstyles.h.

ScribusDoc* SMCharacterStyle::doc_ [private]

Definition at line 136 of file smtextstyles.h.

Definition at line 135 of file smtextstyles.h.

QValueList<CharStyle*> SMCharacterStyle::selection_ [private]

Definition at line 138 of file smtextstyles.h.

Definition at line 140 of file smtextstyles.h.

StyleSet<CharStyle> SMCharacterStyle::tmpStyles_ [private]

Definition at line 137 of file smtextstyles.h.

QTabWidget* SMCharacterStyle::widget_ [private]

Definition at line 134 of file smtextstyles.h.


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