Back to index

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

#include <smlinestyle.h>

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

List of all members.

Signals

void deleteDone ()
void selectionDirty ()

Public Member Functions

 SMLineStyle ()
 ~SMLineStyle ()
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)
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
virtual void editMode (bool isOn)
 When SM switches to or away from edit mode this function is called.
QString typeName ()

Private Slots

void slotCurrentLineChanged (int i)
void slotLineStyle (int i)
void slotSetEnd (int i)
void slotSetJoin (int i)
void slotColor (const QString &s)
void slotShade (int i)
void slotLineWidth ()
void slotAddLine ()
void slotDeleteLine ()

Private Member Functions

void setSelection (const QString &styleName)
void setMultiSelection (const QStringList &styles)
void setupConnections ()
void removeConnections ()
void updateSList ()
void updatePreview ()
void resort ()
void rebuildList ()
QColor calcFarbe (const QString &name, int shade)

Private Attributes

ScribusDoc * doc_
LineStyleWidgetwidget_
QTabWidget * twidget_
QMap< QString, multiLinetmpLines
bool selectionIsDirty_
QMap< QString, multiLine * > selection_
QValueList< RemoveItemdeleted_
int currentLine_

Friends

class StyleManager

Detailed Description

Definition at line 48 of file smlinestyle.h.


Constructor & Destructor Documentation

Definition at line 189 of file smlinestyle.cpp.

                         : StyleItem(), doc_(0), widget_(0), twidget_(0), selectionIsDirty_(false)
{
       
}

Definition at line 941 of file smlinestyle.cpp.

{
       delete widget_;
       delete twidget_;
       widget_ = 0;
       twidget_ = 0;
}

Member Function Documentation

void SMLineStyle::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 388 of file smlinestyle.cpp.

{
       if (!doc_)
              return;

       PageItem* ite;
       doc_->MLineStyles = tmpLines;
       QMap<QString, QString> replacement;
       for (uint i = 0; i < deleted_.count(); ++i)
              replacement[deleted_[i].first] = deleted_[i].second;

       deleted_.clear();

       for (uint d = 0; d < doc_->DocItems.count(); ++d)
       {
              ite = doc_->DocItems.at(d);
              if (!ite->NamedLStyle.isEmpty())
              {
                     if (!doc_->MLineStyles.contains(ite->NamedLStyle))
                            ite->NamedLStyle = replacement[ite->NamedLStyle];
              }
       }
       for (uint d1 = 0; d1 < doc_->MasterItems.count(); ++d1)
       {
              ite = doc_->MasterItems.at(d1);
              if (!ite->NamedLStyle.isEmpty())
              {
                     if (!doc_->MLineStyles.contains(ite->NamedLStyle))
                            ite->NamedLStyle = replacement[ite->NamedLStyle];
              }
       }
       for (uint d1 = 0; d1 < doc_->FrameItems.count(); ++d1)
       {
              ite = doc_->FrameItems.at(d1);
              if (!ite->NamedLStyle.isEmpty())
              {
                     if (!doc_->MLineStyles.contains(ite->NamedLStyle))
                            ite->NamedLStyle = replacement[ite->NamedLStyle];
              }
       }
       doc_->changed();
       doc_->scMW()->propertiesPalette->SetLineFormats(doc_);
       doc_->view()->DrawNew();
       selectionIsDirty_ = false;
}
QColor SMLineStyle::calcFarbe ( const QString &  name,
int  shade 
) [private]

Definition at line 881 of file smlinestyle.cpp.

{
       QColor tmpf;
       if (!doc_)
              return tmpf;
       const ScColor& color = doc_->PageColors[name];
       tmpf = ScColorEngine::getDisplayColor(color, doc_, shade);
       return tmpf;
}

Here is the caller graph for this function:

void SMLineStyle::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 216 of file smlinestyle.cpp.

{
       doc_ = doc;
       if (doc_)
       {
              tmpLines = doc_->MLineStyles;
              selection_.clear();
       }
       else
       {
              tmpLines.clear();
              selection_.clear();
       }
}
void SMLineStyle::deleteDone ( ) [signal]
void SMLineStyle::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 457 of file smlinestyle.cpp.

{
       for (uint i = 0; i < removeList.count(); ++i)
       {
              selection_.remove(selection_.find(removeList[i].first));
              tmpLines.remove(tmpLines.find(removeList[i].first));
              deleted_.append(removeList[i]);
       }
}
virtual void StyleItem::editMode ( bool  isOn) [inline, virtual, inherited]

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.

{};
QString SMLineStyle::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 298 of file smlinestyle.cpp.

{
       QString lsName(QString::null);
       if (!doc_)
              return lsName;

       for (uint i = 0; i < doc_->m_Selection->count(); ++i)
       {
              PageItem *item = doc_->m_Selection->itemAt(i);
              QString tmpName = item->customLineStyle();
              if (lsName.isNull() && !tmpName.isEmpty() && tmpName != "")
              {
                     lsName = item->customLineStyle();
              }
              else if (!lsName.isNull() && !tmpName.isEmpty() && tmpName != "" && lsName != tmpName)
              {
                     lsName = QString::null;
                     break;
              }
       }
       return lsName;
}
QString SMLineStyle::getUniqueName ( const QString &  base) [virtual]

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

Implements StyleItem.

Definition at line 371 of file smlinestyle.cpp.

{
       int id = 0;
       QString s = name;

       while (tmpLines.contains(s))
       {
              ++id;
              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);
       }

       return s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::languageChange ( ) [virtual]

reload all the gui strings whenever this method is called

Implements StyleItem.

Definition at line 498 of file smlinestyle.cpp.

{
       
}
void SMLineStyle::nameChanged ( const QString &  newName) [virtual]

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

Implements StyleItem.

Definition at line 467 of file smlinestyle.cpp.

{
       if (selection_.count() != 1)
       {
              qDebug(QString("SMLineStyle::nameChanged #selection=%1").arg(selection_.count()));
              return;
       }
       QString oldName = selection_.begin().key();
       multiLine *tmpLine = selection_.begin().data();
       multiLine newLine(*tmpLine);
       
       selection_.clear();
       tmpLines.erase(oldName);

       tmpLines.insert(newName, newLine);
       selection_[newName] = &tmpLines[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));
}
QString SMLineStyle::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 337 of file smlinestyle.cpp.

{
       if (!doc_)
              return QString::null;
       struct SingleLine sl;
//     sl.Color = "Black";
//     sl.Shade = 100;
//     sl.Dash = SolidLine;
//     sl.LineEnd = FlatCap;
//     sl.LineJoin = MiterJoin;
//     sl.Width = 1.0;
       sl.Color = doc_->toolSettings.dPenLine;
       sl.Shade = doc_->toolSettings.dShadeLine;
       sl.Dash = Qt::SolidLine;//Docu->toolSettings.;
       sl.LineEnd = Qt::FlatCap;//Docu->toolSettings.;
       sl.LineJoin = doc_->toolSettings.dLstyleLine;
       sl.Width = doc_->toolSettings.dWidthLine;
       multiLine ml;
       ml.push_back(sl);
       QString name = getUniqueName( tr("New Style"));
       tmpLines[name] = ml;
       return name;
}

Here is the call graph for this function:

QString SMLineStyle::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 361 of file smlinestyle.cpp.

{
       Q_ASSERT(tmpLines.contains(fromStyle));

       multiLine ml(tmpLines[fromStyle]);
       QString name = getUniqueName( tr("Clone of %1").arg(fromStyle));
       tmpLines[name] = ml;
       return name;
}

Here is the call graph for this function:

void SMLineStyle::rebuildList ( ) [private]

Definition at line 741 of file smlinestyle.cpp.

{
       QString tmp, tmp2;
       widget_->lineStyles->clear();
       QPixmap * pm2;
       multiLine *tmpLine = selection_.begin().data();
       for (multiLine::iterator it = (*tmpLine).begin(); it != (*tmpLine).end(); ++it)
       {
              pm2 = getWidePixmap(calcFarbe((*it).Color, (*it).Shade));
              tmp2 = " "+tmp.setNum((*it).Width)+ tr(" pt")+" ";
              switch (static_cast<PenStyle>((*it).Dash))
              {
                     case SolidLine:
                            tmp2 += tr("Solid Line");
                            break;
                     case DashLine:
                            tmp2 += tr("Dashed Line");
                            break;
                     case DotLine:
                            tmp2 += tr("Dotted Line");
                            break;
                     case DashDotLine:
                            tmp2 += tr("Dash Dot Line");
                            break;
                     case DashDotDotLine:
                            tmp2 += tr("Dash Dot Dot Line");
                            break;
                     default:
                            tmp2 += tr("Solid Line");
                            break;
              }
              tmp2 += " ";
              widget_->lineStyles->insertItem(*pm2, tmp2);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::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 246 of file smlinestyle.cpp.

{
       if (!doc_)
              return;

       selection_.clear();
       tmpLines = doc_->MLineStyles;
}
void SMLineStyle::removeConnections ( ) [private]

Definition at line 520 of file smlinestyle.cpp.

{
       disconnect(widget_->addButton, SIGNAL(clicked()), this, SLOT(slotAddLine()));
       disconnect(widget_->removeButton, SIGNAL(clicked()), this, SLOT(slotDeleteLine()));
       disconnect(widget_->endCombo, SIGNAL(activated(int)), this, SLOT(slotSetEnd(int)));
       disconnect(widget_->joinCombo, SIGNAL(activated(int)), this, SLOT(slotSetJoin(int)));
       disconnect(widget_->colorCombo, SIGNAL(activated(const QString&)), this, SLOT(slotColor(const QString&)));
       disconnect(widget_->dashCombo, SIGNAL(activated(int)), this, SLOT(slotLineStyle(int)));
       disconnect(widget_->shadeBox, SIGNAL(valueChanged(int)), this, SLOT(slotShade(int)));
       disconnect(widget_->lineWidth, SIGNAL(valueChanged(int)), this, SLOT(slotLineWidth()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::resort ( ) [private]

Definition at line 896 of file smlinestyle.cpp.

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

       int cc = 0;
       struct SingleLine sl;
       multiLine *tmpLine = selection_.begin().data();

       sl.Color = (*tmpLine)[currentLine_].Color;
       sl.Shade = (*tmpLine)[currentLine_].Shade;
       sl.Dash = (*tmpLine)[currentLine_].Dash;
       sl.LineEnd = (*tmpLine)[currentLine_].LineEnd;
       sl.LineJoin = (*tmpLine)[currentLine_].LineJoin;
       sl.Width = (*tmpLine)[currentLine_].Width;
       multiLine::iterator it3;
       for (it3 = (*tmpLine).begin(); it3 != (*tmpLine).end(); ++it3)
       {
              if (cc == currentLine_)
              {
                     (*tmpLine).erase(it3);
                     break;
              }
              cc++;
       }
       cc = 0;
       bool fo = false;
       for (multiLine::iterator it2 = (*tmpLine).begin(); it2 != (*tmpLine).end(); ++it2)
       {
              if (sl.Width < (*it2).Width)
              {
                     (*tmpLine).insert(it2, sl);
                     fo = true;
                     break;
              }
              cc++;
       }
       if (!fo)
              (*tmpLine).push_back(sl);
       currentLine_ = cc;
       rebuildList();
       widget_->showStyle(*tmpLine, doc_->PageColors, cc);
       updatePreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::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 255 of file smlinestyle.cpp.

{
       selection_.clear();
       selectionIsDirty_ = false;

       removeConnections();

       if (styleNames.count() > 1)
              setMultiSelection(styleNames);
       else if (styleNames.count() == 1)
              setSelection(styleNames[0]);

       updatePreview();
       setupConnections();
}

Here is the call graph for this function:

void SMLineStyle::selectionDirty ( ) [signal]

Here is the caller graph for this function:

void SMLineStyle::setMultiSelection ( const QStringList &  styles) [private]

Definition at line 285 of file smlinestyle.cpp.

{
       selection_.clear();
       for (uint i = 0; i < styles.count(); ++i)
       {
              if (!tmpLines.contains(styles[i]))
                     continue;
              selection_[styles[i]] = &tmpLines[styles[i]];
       }
       currentLine_ = 0;
       // todo do the tricks for clever showing of multiple styles
}

Here is the caller graph for this function:

void SMLineStyle::setSelection ( const QString &  styleName) [private]

Definition at line 271 of file smlinestyle.cpp.

{
       if (!doc_)
              return;

       if (!tmpLines.contains(styleName))
              return; // something's wrong here

       selection_.clear();
       selection_[styleName] = &tmpLines[styleName];
       widget_->showStyle(tmpLines[styleName], doc_->PageColors);
       currentLine_ = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

set the key combination for the selected style's shortcut

Implements StyleItem.

Definition at line 440 of file smlinestyle.cpp.

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

       QMap<QString, multiLine*>::iterator it;
       for (it = selection_.begin(); it != selection_.end(); ++it)
              (*it)->shortcut = shortcut;

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

Here is the call graph for this function:

void SMLineStyle::setupConnections ( ) [private]

Definition at line 508 of file smlinestyle.cpp.

{
       connect(widget_->addButton, SIGNAL(clicked()), this, SLOT(slotAddLine()));
       connect(widget_->removeButton, SIGNAL(clicked()), this, SLOT(slotDeleteLine()));
       connect(widget_->endCombo, SIGNAL(activated(int)), this, SLOT(slotSetEnd(int)));
       connect(widget_->joinCombo, SIGNAL(activated(int)), this, SLOT(slotSetJoin(int)));
       connect(widget_->colorCombo, SIGNAL(activated(const QString&)), this, SLOT(slotColor(const QString&)));
       connect(widget_->dashCombo, SIGNAL(activated(int)), this, SLOT(slotLineStyle(int)));
       connect(widget_->shadeBox, SIGNAL(valueChanged(int)), this, SLOT(slotShade(int)));
       connect(widget_->lineWidth, SIGNAL(valueChanged(int)), this, SLOT(slotLineWidth()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

returns the key combination for the style's shortcut

Implements StyleItem.

Definition at line 434 of file smlinestyle.cpp.

{
       Q_ASSERT(tmpLines.contains(stylename));
       return tmpLines[stylename].shortcut;
}
void SMLineStyle::slotAddLine ( ) [private, slot]

Definition at line 702 of file smlinestyle.cpp.

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

       multiLine *tmpLine = selection_.begin().data();
       struct SingleLine sl;
       sl.Color = (*tmpLine)[currentLine_].Color;
       sl.Shade = (*tmpLine)[currentLine_].Shade;
       sl.Dash = (*tmpLine)[currentLine_].Dash;
       sl.LineEnd = (*tmpLine)[currentLine_].LineEnd;
       sl.LineJoin = (*tmpLine)[currentLine_].LineJoin;
       sl.Width = (*tmpLine)[currentLine_].Width;
       int cc = 0;
       bool fo = false;
       for (multiLine::iterator it2 = (*tmpLine).begin(); it2 != (*tmpLine).end(); ++it2)
       {
              if (sl.Width < (*it2).Width)
              {
                     (*tmpLine).insert(it2, sl);
                     fo = true;
                     break;
              }
              cc++;
       }
       if (!fo)
              (*tmpLine).push_back(sl);
       currentLine_ = cc;
       rebuildList();
       widget_->showStyle(*tmpLine, doc_->PageColors, cc);
       updatePreview();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::slotColor ( const QString &  s) [private, slot]

Definition at line 645 of file smlinestyle.cpp.

{
       QMap<QString, multiLine*>::iterator it;
       for (it = selection_.begin(); it != selection_.end(); ++it)
       {
              multiLine *tmp = it.data();
              (*tmp)[currentLine_].Color = s;
       }

       updateSList();
       updatePreview();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::slotCurrentLineChanged ( int  i) [private, slot]

Definition at line 891 of file smlinestyle.cpp.

{
       currentLine_ = i;
}

Here is the caller graph for this function:

void SMLineStyle::slotDeleteLine ( ) [private, slot]

Definition at line 777 of file smlinestyle.cpp.

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

       multiLine *tmpLine = selection_.begin().data();

       if ((*tmpLine).size() == 1)
              return;

       int cc = 0;
       for (multiLine::iterator it3 = (*tmpLine).begin(); it3 != (*tmpLine).end(); ++it3)
       {
              if (cc == currentLine_)
              {
                     (*tmpLine).erase(it3);
                     break;
              }
              cc++;
       }

       currentLine_ = 0;
       rebuildList();
       widget_->showStyle(*tmpLine, doc_->PageColors);
       updatePreview();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::slotLineStyle ( int  i) [private, slot]

Definition at line 532 of file smlinestyle.cpp.

{
       PenStyle c = SolidLine;
       switch (i)
       {
              case 0:
                     c = SolidLine;
                     break;
              case 1:
                     c = DashLine;
                     break;
              case 2:
                     c = DotLine;
                     break;
              case 3:
                     c = DashDotLine;
                     break;
              case 4:
                     c = DashDotDotLine;
                     break;
       }

       Q_ASSERT(currentLine_ >= 0);
       if (currentLine_ < 0)
              return;

       QMap<QString, multiLine*>::iterator it;
       for (it = selection_.begin(); it != selection_.end(); ++it)
       {
              multiLine *tmp = it.data();
              (*tmp)[currentLine_].Dash = static_cast<int>(c);
       }

       updateSList();
       updatePreview();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::slotLineWidth ( ) [private, slot]

Definition at line 683 of file smlinestyle.cpp.

{
       QMap<QString, multiLine*>::iterator it;
       for (it = selection_.begin(); it != selection_.end(); ++it)
       {
              multiLine *tmp = it.data();
              (*tmp)[currentLine_].Width = widget_->lineWidth->value();
       }

       updatePreview();
       resort();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::slotSetEnd ( int  i) [private, slot]

Definition at line 575 of file smlinestyle.cpp.

{
       PenCapStyle c = FlatCap;
       switch (i)
       {
              case 0:
                     c = FlatCap;
                     break;
              case 1:
                     c = SquareCap;
                     break;
              case 2:
                     c = RoundCap;
                     break;
       }

       QMap<QString, multiLine*>::iterator it;
       for (it = selection_.begin(); it != selection_.end(); ++it)
       {
              multiLine *tmp = it.data();
              (*tmp)[currentLine_].LineEnd = static_cast<int>(c);
       }

       updateSList();
       updatePreview();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::slotSetJoin ( int  i) [private, slot]

Definition at line 608 of file smlinestyle.cpp.

{
       Q_ASSERT(currentLine_ >= 0);
       if (currentLine_ < 0)
              return;

       PenJoinStyle c = MiterJoin;
       switch (i)
       {
              case 0:
                     c = MiterJoin;
                     break;
              case 1:
                     c = BevelJoin;
                     break;
              case 2:
                     c = RoundJoin;
                     break;
       }

       QMap<QString, multiLine*>::iterator it;
       for (it = selection_.begin(); it != selection_.end(); ++it)
       {
              multiLine *tmp = it.data();
              (*tmp)[currentLine_].LineJoin = static_cast<int>(c);
       }

       updateSList();
       updatePreview();

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

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::slotShade ( int  i) [private, slot]

Definition at line 664 of file smlinestyle.cpp.

{
       QMap<QString, multiLine*>::iterator it;
       for (it = selection_.begin(); it != selection_.end(); ++it)
       {
              multiLine *tmp = it.data();
              (*tmp)[currentLine_].Shade = i;
       }

       updateSList();
       updatePreview();

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

Here is the call graph for this function:

Here is the caller graph for this function:

QValueList< StyleName > SMLineStyle::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 231 of file smlinestyle.cpp.

{
       if (doc_ && reloadFromDoc) {
              tmpLines = doc_->MLineStyles;
       }

       QValueList<StyleName> tmp;
       QMap<QString,multiLine>::Iterator it;

       for (it = tmpLines.begin(); it != tmpLines.end(); ++it)
              tmp << StyleName(it.key(), QString::null);

       return tmp;
}
void SMLineStyle::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 321 of file smlinestyle.cpp.

{
       if (!doc_)
              return;

       for (uint i = 0; i < doc_->m_Selection->count(); ++i)
       {
              if (styleName.isNull())
                     doc_->m_Selection->itemAt(i)->setCustomLineStyle("");
              else
                     doc_->m_Selection->itemAt(i)->setCustomLineStyle(styleName);

              doc_->view()->RefreshItem(doc_->m_Selection->itemAt(i));
       }
}
QString StyleItem::typeName ( ) [inline, inherited]

Definition at line 177 of file styleitem.h.

{ return typeNamePlural(); };

Here is the call graph for this function:

QString SMLineStyle::typeNamePlural ( ) [virtual]

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

Implements StyleItem.

Definition at line 206 of file smlinestyle.cpp.

{
       return tr("Line Styles");
}

Here is the call graph for this function:

QString SMLineStyle::typeNameSingular ( ) [virtual]

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

Implements StyleItem.

Definition at line 211 of file smlinestyle.cpp.

{
       return tr("Line Style");
}

Here is the call graph for this function:

void SMLineStyle::unitChange ( ) [virtual]

document unit has been changed, upgrade widgets

Implements StyleItem.

Definition at line 503 of file smlinestyle.cpp.

{

}
void SMLineStyle::updatePreview ( ) [private]

Definition at line 857 of file smlinestyle.cpp.

{
    if (selection_.count() < 1)
              return;
       
       QPixmap pm = QPixmap(200, 37);
       pm.fill(white);
       QPainter p;
       p.begin(&pm);
       multiLine *tmpLine = selection_.begin().data();

       for (int it = (*tmpLine).size()-1; it > -1; it--)
       {
              p.setPen(QPen(calcFarbe((*tmpLine)[it].Color, (*tmpLine)[it].Shade),
                             QMAX(static_cast<int>((*tmpLine)[it].Width), 1),
                             static_cast<PenStyle>((*tmpLine)[it].Dash),
                             static_cast<PenCapStyle>((*tmpLine)[it].LineEnd),
                             static_cast<PenJoinStyle>((*tmpLine)[it].LineJoin)));
              p.drawLine(17, 18, 183, 18);
       }
       p.end();
       widget_->previewLabel->setPixmap(pm);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SMLineStyle::updateSList ( ) [private]

Definition at line 810 of file smlinestyle.cpp.

{
       if (selection_.count() < 1)
              return;

       Q_ASSERT(currentLine_ >= 0);
       if  (currentLine_ < 0)
              return;


       QString tmp, tmp2;
       QPixmap * pm;
       multiLine *tmpLine = selection_.begin().data();
       
       pm = getWidePixmap(calcFarbe((*tmpLine)[currentLine_].Color, (*tmpLine)[currentLine_].Shade));
       tmp2 = " "+tmp.setNum((*tmpLine)[currentLine_].Width)+ tr(" pt ");
       switch (static_cast<PenStyle>((*tmpLine)[currentLine_].Dash))
       {
              case SolidLine:
                     tmp2 += tr("Solid Line");
                     break;
              case DashLine:
                     tmp2 += tr("Dashed Line");
                     break;
              case DotLine:
                     tmp2 += tr("Dotted Line");
                     break;
              case DashDotLine:
                     tmp2 += tr("Dash Dot Line");
                     break;
              case DashDotDotLine:
                     tmp2 += tr("Dash Dot Dot Line");
                     break;
              default:
                     tmp2 += tr("Solid Line");
                     break;
       }
       tmp2 += " ";
       if (widget_->lineStyles->count() == 1)  // to avoid Bug in Qt-3.1.2
       {
              widget_->lineStyles->clear();
              widget_->lineStyles->insertItem(*pm, tmp2);
       }
       else
              widget_->lineStyles->changeItem(*pm, tmp2, currentLine_);
}

Here is the call graph for this function:

Here is the caller graph for this function:

QTabWidget * SMLineStyle::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 194 of file smlinestyle.cpp.

{
       if (!twidget_)
       {
              twidget_ = new QTabWidget();
              widget_ = new LineStyleWidget();
              twidget_->addTab(widget_, tr("Properties"));
              connect(widget_->lineStyles, SIGNAL(highlighted(int)), this, SLOT(slotCurrentLineChanged(int)));
       }
       return twidget_;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class StyleManager [friend]

Definition at line 111 of file smlinestyle.h.


Member Data Documentation

Definition at line 86 of file smlinestyle.h.

QValueList<RemoveItem> SMLineStyle::deleted_ [private]

Definition at line 85 of file smlinestyle.h.

ScribusDoc* SMLineStyle::doc_ [private]

Definition at line 79 of file smlinestyle.h.

QMap<QString, multiLine*> SMLineStyle::selection_ [private]

Definition at line 84 of file smlinestyle.h.

Definition at line 83 of file smlinestyle.h.

QMap<QString, multiLine> SMLineStyle::tmpLines [private]

Definition at line 82 of file smlinestyle.h.

QTabWidget* SMLineStyle::twidget_ [private]

Definition at line 81 of file smlinestyle.h.

Definition at line 80 of file smlinestyle.h.


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