r18047 by craig - #11277: Apply numeration/bullets patch. Some issues noted but they can be fixed after main patch is in SVN
scribus-commit
scribus-commit at lists.scribus.net
Sat Jan 5 09:26:28 UTC 2013
Author: craig
Date: Sat Jan 5 09:26:28 2013
New Revision: 18047
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18047
Log:
#11277: Apply numeration/bullets patch. Some issues noted but they can be fixed after main patch is in SVN
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/actionmanager.cpp
trunk/Scribus/scribus/fileloader.cpp
trunk/Scribus/scribus/gtaction.cpp
trunk/Scribus/scribus/gtparagraphstyle.cpp
trunk/Scribus/scribus/gtparagraphstyle.h
trunk/Scribus/scribus/marks.h
trunk/Scribus/scribus/notesstyles.h
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_textframe.cpp
trunk/Scribus/scribus/pageitem_textframe.h
trunk/Scribus/scribus/pagestructs.h
trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp
trunk/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp
trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
trunk/Scribus/scribus/sampleitem.cpp
trunk/Scribus/scribus/sampleitem.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribus.h
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/scribusstructs.h
trunk/Scribus/scribus/styles/charstyle.cpp
trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
trunk/Scribus/scribus/styles/paragraphstyle.cpp
trunk/Scribus/scribus/text/storytext.cpp
trunk/Scribus/scribus/ui/notesstyleseditor.cpp
trunk/Scribus/scribus/ui/prefs_documentsections.cpp
trunk/Scribus/scribus/ui/propertiespalette_text.cpp
trunk/Scribus/scribus/ui/propertiespalette_text.h
trunk/Scribus/scribus/ui/smpstylewidget.cpp
trunk/Scribus/scribus/ui/smpstylewidget.h
trunk/Scribus/scribus/ui/smpstylewidget.ui
trunk/Scribus/scribus/ui/smtextstyles.cpp
trunk/Scribus/scribus/ui/smtextstyles.h
trunk/Scribus/scribus/util.cpp
trunk/Scribus/scribus/util.h
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Sat Jan 5 09:26:28 2013
@@ -143,7 +143,7 @@
ui/propertiespalette_xyzbase.ui
ui/propertywidget_advancedbase.ui
ui/propertywidget_distancebase.ui
- ui/propertywidget_dropcapbase.ui
+ ui/propertywidget_pareffectbase.ui
ui/propertywidget_flopbase.ui
ui/propertywidget_optmarginsbase.ui
ui/propertywidget_orphansbase.ui
@@ -216,6 +216,7 @@
latexhelpers.h
loadsaveplugin.h
menumanager.h
+ numeration.h
navigator.h
notesstyles.h
observable.h
@@ -409,7 +410,7 @@
ui/propertiespalette_xyz.h
ui/propertywidget_advanced.h
ui/propertywidget_distance.h
- ui/propertywidget_dropcap.h
+ ui/propertywidget_pareffect.h
ui/propertywidget_flop.h
ui/propertywidget_optmargins.h
ui/propertywidget_orphans.h
@@ -579,6 +580,7 @@
menumanager.cpp
mesh.cpp
navigator.cpp
+ numeration.cpp
observable.cpp
nftrcreader.cpp
nftsettings.cpp
@@ -852,7 +854,7 @@
ui/propertiespalette_xyz.cpp
ui/propertywidget_advanced.cpp
ui/propertywidget_distance.cpp
- ui/propertywidget_dropcap.cpp
+ ui/propertywidget_pareffect.cpp
ui/propertywidget_flop.cpp
ui/propertywidget_optmargins.cpp
ui/propertywidget_orphans.cpp
Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Sat Jan 5 09:26:28 2013
@@ -910,9 +910,12 @@
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="extrasGenerateTableOfContents";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+ name="extrasUpdateDocument";
+ scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
connect( (*scrActions)["extrasManageImages"], SIGNAL(triggered()), mainWindow, SLOT(StatusPic()) );
connect( (*scrActions)["extrasGenerateTableOfContents"], SIGNAL(triggered()), mainWindow, SLOT(generateTableOfContents()) );
+ connect( (*scrActions)["extrasUpdateDocument"], SIGNAL(triggered()), mainWindow, SLOT(updateDocument()) );
}
@@ -1667,6 +1670,7 @@
(*scrActions)["extrasHyphenateText"]->setTexts( tr("&Hyphenate Text"));
(*scrActions)["extrasDeHyphenateText"]->setTexts( tr("Dehyphenate Text"));
(*scrActions)["extrasGenerateTableOfContents"]->setTexts( tr("&Generate Table Of Contents"));
+ (*scrActions)["extrasUpdateDocument"]->setTexts( tr("&Update Document"));
//Windows Menu
(*scrActions)["windowsCascade"]->setText( tr("&Cascade"));
@@ -2194,7 +2198,8 @@
<< "extrasManageImages"
<< "extrasHyphenateText"
<< "extrasDeHyphenateText"
- << "extrasGenerateTableOfContents";
+ << "extrasGenerateTableOfContents"
+ << "extrasUpdateDocument";
//Windows
++itmenu;
itmenu->second
Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp (original)
+++ trunk/Scribus/scribus/fileloader.cpp Sat Jan 5 09:26:28 2013
@@ -320,9 +320,11 @@
vg.charStyle().setFont((*currDoc->AllFonts)[tmpf]);
vg.charStyle().setFontSize(qRound(ScCLocale::toDoubleC(pg.attribute("FONTSIZE"), 12.0) * 10.0));
vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt()));
- vg.setDcCharStyleName(pg.attribute("DROPCHSTYLE", ""));
+ vg.setPeCharStyleName(pg.attribute("DROPCHSTYLE", ""));
+ vg.setPeCharStyleName(pg.attribute("PECHSTYLE", ""));
vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt());
- vg.setDropCapOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0));
+ vg.setParEffectOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0));
+ vg.setParEffectOffset(ScCLocale::toDoubleC(pg.attribute("PEDIST"), 0.0));
vg.charStyle().setFeatures(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()).featureList());
vg.charStyle().setFillColor(pg.attribute("FCOLOR", currDoc->itemToolPrefs().shapeFillColor));
vg.charStyle().setFillShade(pg.attribute("FSHADE", "100").toInt());
Modified: trunk/Scribus/scribus/gtaction.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/gtaction.cpp
==============================================================================
--- trunk/Scribus/scribus/gtaction.cpp (original)
+++ trunk/Scribus/scribus/gtaction.cpp Sat Jan 5 09:26:28 2013
@@ -394,6 +394,10 @@
fstyle->setDropCap(vg.hasDropCap());
if (!vg.isInhDropCapLines())
fstyle->setDropCapHeight(vg.dropCapLines());
+ if (!vg.isInhHasBullet())
+ fstyle->setBullet(vg.hasBullet(), vg.bulletStr());
+ if (!vg.isInhHasNum())
+ fstyle->setNum(vg.hasNum(),vg.numFormat(),vg.numLevel(), vg.numStart(), vg.numPrefix(), vg.numSuffix());
gtFont font;
getFrameFont(&font);
@@ -490,6 +494,24 @@
style.setHasDropCap(pstyle->hasDropCap());
if (flags & gtParagraphStyle::dropCapHeightWasSet)
style.setDropCapLines(pstyle->getDropCapHeight());
+ if (flags & gtParagraphStyle::bulletWasSet)
+ {
+ style.setHasBullet(pstyle->hasBullet());
+ style.setBulletStr(pstyle->getBullet());
+ }
+ if (flags & gtParagraphStyle::numWasSet)
+ {
+ style.setHasNum(pstyle->hasNum());
+ style.setNumName(pstyle->getName());
+ style.setNumFormat(pstyle->getNumFormat());
+ style.setNumLevel(pstyle->getNumLevel());
+ style.setNumStart(pstyle->getNumStart());
+ style.setNumHigher(true);
+ style.setNumOther(true);
+ style.setNumPrefix(pstyle->getNumPrefix());
+ style.setNumSuffix(pstyle->getNumSuffix());
+ }
+
/*vg.setDropCapOffset(0);*/
}
Modified: trunk/Scribus/scribus/gtparagraphstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/gtparagraphstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/gtparagraphstyle.cpp (original)
+++ trunk/Scribus/scribus/gtparagraphstyle.cpp Sat Jan 5 09:26:28 2013
@@ -42,7 +42,15 @@
spaceAbove = p.spaceAbove;
spaceBelow = p.spaceBelow;
dropCap = p.dropCap;
+ m_bullet = p.m_bullet;
+ m_bulletStr = p.m_bulletStr;
dropCapHeight = p.dropCapHeight;
+ m_numeration = p.m_numeration;
+ m_numFormat = p.m_numFormat;
+ m_numLevel = p.m_numLevel;
+ m_numStart = p.m_numStart;
+ m_numPrefix = p.m_numPrefix;
+ m_numSuffix = p.m_numSuffix;
adjToBaseline = p.adjToBaseline;
autoLineSpacing = p.autoLineSpacing;
isVisible = p.isVisible;
@@ -65,6 +73,14 @@
spaceBelow = 0;
dropCap = false;
dropCapHeight = 2;
+ m_bullet = false;
+ m_bulletStr = QString(QChar(0x2022));
+ m_numeration = false;
+ m_numFormat = 0;
+ m_numLevel = 0;
+ m_numStart = 1;
+ m_numPrefix = QString();
+ m_numSuffix = QString();
adjToBaseline = false;
autoLineSpacing = false;
isVisible = true;
@@ -221,6 +237,67 @@
flags |= dropCapHeightWasSet;
}
+bool gtParagraphStyle::hasBullet()
+{
+ return m_bullet;
+}
+
+QString gtParagraphStyle::getBullet()
+{
+ return m_bulletStr;
+}
+
+void gtParagraphStyle::setBullet(bool newBullet, QString str)
+{
+ m_bullet = newBullet;
+ m_bulletStr = str;
+ flags |= bulletWasSet;
+}
+
+bool gtParagraphStyle::hasNum()
+{
+ return m_numeration;
+}
+
+void gtParagraphStyle::setNum(bool newNum, int format, int level, int start, QString prefix, QString suffix)
+{
+ m_numeration = newNum;
+ if (newNum)
+ {
+ m_numFormat = format;
+ m_numLevel = level;
+ m_numStart = start;
+ m_numPrefix = prefix;
+ m_numSuffix = suffix;
+ }
+ flags |= numWasSet;
+}
+
+int gtParagraphStyle::getNumLevel()
+{
+ return m_numLevel;
+}
+
+int gtParagraphStyle::getNumFormat()
+{
+ return m_numFormat;
+}
+
+int gtParagraphStyle::getNumStart()
+{
+ return m_numStart;
+}
+
+QString gtParagraphStyle::getNumPrefix()
+{
+ return m_numPrefix;
+}
+
+QString gtParagraphStyle::getNumSuffix()
+{
+ return m_numSuffix;
+}
+
bool gtParagraphStyle::isAdjToBaseline()
{
return adjToBaseline;
Modified: trunk/Scribus/scribus/gtparagraphstyle.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/gtparagraphstyle.h
==============================================================================
--- trunk/Scribus/scribus/gtparagraphstyle.h (original)
+++ trunk/Scribus/scribus/gtparagraphstyle.h Sat Jan 5 09:26:28 2013
@@ -64,6 +64,14 @@
QList<ParagraphStyle::TabRecord> tabValues;
bool dropCap;
int dropCapHeight;
+ bool m_bullet; ///< Is style using bullet?
+ QString m_bulletStr; ///< String used as bullet
+ bool m_numeration; ///< Is style using numeration?
+ int m_numLevel; ///< Level in hierarchical numbering
+ int m_numFormat; ///< 1_2_3, i_ii_ii, a_b_c
+ int m_numStart; ///< Numeration starts at number
+ QString m_numPrefix; ///< Numeration prefix of style
+ QString m_numSuffix; ///< Numeration sufffix of style
bool adjToBaseline;
bool autoLineSpacing;
bool isVisible;
@@ -83,6 +91,8 @@
dropCapHeightWasSet = 512,
adjToBaselineWasSet = 1024,
autoLineSpacingWasSet = 2048,
+ bulletWasSet = 4096,
+ numWasSet = 8192
} wasSetFlags;
int getFlags();
@@ -118,6 +128,16 @@
gtParagraphStyle(const gtStyle& s);
~gtParagraphStyle();
QString target();
+ bool hasBullet();
+ void setBullet(bool newBullet, QString str = QString(QChar(0x2022)));
+ QString getBullet();
+ bool hasNum();
+ void setNum(bool newNum, int format=0, int level=0, int start = 1, QString prefix = "", QString suffix = "");
+ int getNumLevel();
+ int getNumFormat();
+ int getNumStart();
+ QString getNumPrefix();
+ QString getNumSuffix();
};
#endif // GTPARAGRAPHSTYLE_H
Modified: trunk/Scribus/scribus/marks.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/marks.h
==============================================================================
--- trunk/Scribus/scribus/marks.h (original)
+++ trunk/Scribus/scribus/marks.h Sat Jan 5 09:26:28 2013
@@ -19,7 +19,8 @@
MARKVariableTextType = 3,//mark contain dynamic text
MARKNoteMasterType = 4, //mark contain footnote reference
MARKNoteFrameType = 5, //mark used internally in note frame at beginning of note`s text
- MARKIndexType = 6 // index entry
+ MARKIndexType = 6, // index entry
+ MARKBullNumType = 7
};
struct MarkData
@@ -40,6 +41,7 @@
{
friend class ScribusDoc;
friend class ScribusMainWindow;
+ friend class BulNumMark;
//only ScribusDoc && ScribusMainWindow can create and delete marks
private:
Mark() : label(""), OwnPage(-1), typ(MARKNoType), data() {}
@@ -86,7 +88,7 @@
bool hasItemPtr() { return data.itemPtr != NULL; }
bool hasString() { return !data.strtxt.isEmpty(); }
bool hasMark() { return data.destmarkName != ""; }
- bool isUnique() { return ((typ != MARKVariableTextType) && (typ != MARKIndexType)); }
+ bool isUnique() { return ((typ != MARKVariableTextType) && (typ != MARKIndexType) && (typ != MARKBullNumType)); }
bool isNoteType() { return ((typ == MARKNoteMasterType) || (typ==MARKNoteFrameType)); }
bool isType(const MarkType t) { return t==typ; }
@@ -95,4 +97,11 @@
MarkData data;
};
+class SCRIBUS_API BulNumMark : public Mark
+{
+public:
+ BulNumMark() : Mark() { label = "BullNumMark"; typ = MARKBullNumType; }
+ ~BulNumMark() {}
+};
+
#endif // MARKS_H
Modified: trunk/Scribus/scribus/notesstyles.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/notesstyles.h
==============================================================================
--- trunk/Scribus/scribus/notesstyles.h (original)
+++ trunk/Scribus/scribus/notesstyles.h Sat Jan 5 09:26:28 2013
@@ -5,6 +5,7 @@
#include <QObject>
#include <QString>
#include <QList>
+#include "numeration.h"
#include "pagestructs.h"
#include "scpage.h"
#include "styles/charstyle.h"
@@ -15,25 +16,6 @@
class ScribusDoc;
class PageItem_NoteFrame;
class PageItem_TextFrame;
-
-class Numeration
-{
-public:
- Numeration() : numType(Type_1_2_3) {}
- void setType(NumerationType type) { numType = type; }
- const NumerationType type() { return numType; }
- const QString numString(const int num) { return getStringFromSequence(numType, num); }
-private:
- NumerationType numType;
-};
-
-typedef enum {
- NSRdocument,
- NSRsection,
- NSRstory,
- NSRpage,
- NSRframe
-} NumerationRange;
//used for map with endnotes frames maped with range item
typedef union
@@ -65,8 +47,8 @@
void setSuffix (const QString str) { suffixStr = str; }
const QString numString(const int num) { return numeration.numString(num); }
- void setType(const NumerationType type) { numeration.setType(type); }
- const NumerationType getType() { return numeration.type(); }
+ void setType(const NumFormat type) { numeration.numFormat = type; }
+ const NumFormat getType() { return numeration.numFormat; }
bool isEndNotes() { return m_endNotesStyle; }
bool isAutoNotesHeight() { return autoNotesHeight; }
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sat Jan 5 09:26:28 2013
@@ -48,9 +48,9 @@
#include "pageitem_group.h"
#include "pageitem_regularpolygon.h"
#include "pageitem_arc.h"
-#include "pageitem_noteframe.h"
#include "pageitem_spiral.h"
#include "pageitem_textframe.h"
+#include "pageitem_noteframe.h"
#include "pageitem_latexframe.h"
#include "prefsmanager.h"
@@ -841,7 +841,8 @@
if (itemText.item(pos)->hasMark())
{
Mark* mrk = itemText.item(pos)->mark;
- m_Doc->eraseMark(mrk);
+ if (!mrk->isType(MARKBullNumType))
+ m_Doc->eraseMark(mrk);
}
}
}
@@ -5026,6 +5027,8 @@
restoreWeldItems(ss, isUndo);
else if (ss->contains("UNWELD_ITEM"))
restoreUnWeldItem(ss, isUndo);
+ else if (ss->contains("CLEARMARKSTRING"))
+ restoreMarkString(ss, isUndo);
}
if (!OnMasterPage.isEmpty())
m_Doc->setCurrentPage(oldCurrentPage);
@@ -5099,6 +5102,18 @@
}
m_Doc->changed();
m_Doc->regionsChanged()->update(QRectF());
+}
+
+void PageItem::restoreMarkString(SimpleState *state, bool isUndo)
+{
+ ScItemState< QPair<int,QString> > *is = dynamic_cast<ScItemState< QPair<int,QString> >*>(state);
+ ScText * hl = itemText.item(is->getItem().first);
+ if (!hl->hasMark())
+ return;
+ if (isUndo)
+ hl->mark->setString(is->getItem().second);
+ else
+ hl->mark->setString(QString());
}
bool PageItem::checkGradientUndoRedo(SimpleState *ss, bool isUndo)
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Sat Jan 5 09:26:28 2013
@@ -1525,6 +1525,7 @@
void restoreWeldItems(SimpleState *state, bool isUndo);
void restoreUnWeldItem(SimpleState *state, bool isUndo);
+ void restoreMarkString(SimpleState *state, bool isUndo);
/*@}*/
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sat Jan 5 09:26:28 2013
@@ -35,12 +35,13 @@
#include "canvas.h"
#include "commonstrings.h"
#include "hyphenator.h"
+#include "numeration.h"
#include "marks.h"
#include "notesstyles.h"
#include "pageitem.h"
#include "pageitem_group.h"
+#include "pageitem_textframe.h"
#include "pageitem_noteframe.h"
-#include "pageitem_textframe.h"
#include "prefsmanager.h"
#include "scpage.h"
#include "scpainter.h"
@@ -1354,6 +1355,7 @@
QList<ParagraphStyle::TabRecord> tTabValues;
tTabValues.clear();
+ bool BulNumMode = false; //when bullet or counter should be inserted
bool DropCmode = false, FlopBaseline = false;
double desc=0, asce=0, realAsce=0, realDesc = 0, offset = 0;
double maxDY=0, maxDX=0;
@@ -1501,6 +1503,7 @@
itemText.blockSignals(true);
setMaxY(-1);
double maxYAsc = 0.0, maxYDesc = 0.0;
+ double autoLeftIndent = 0.0;
for (int a = firstInFrame(); a < itLen; ++a)
{
@@ -1566,17 +1569,78 @@
}
}
}
+ BulNumMode = false;
+ if (a==0 || itemText.text(a-1) == SpecialChars::PARSEP)
+ {
+ autoLeftIndent = 0.0;
+ style = itemText.paragraphStyle(a);
+ if (style.hasBullet() || style.hasNum())
+ {
+ BulNumMode = true;
+ if (hl->mark == NULL || !hl->mark->isType(MARKBullNumType))
+ {
+ BulNumMark* bnMark = new BulNumMark();
+ itemText.insertMark(bnMark,a);
+ a--;
+ itLen = itemText.length();
+ continue;
+ }
+ if (style.hasBullet())
+ hl->mark->setString(style.bulletStr());
+ else if (style.hasNum())
+ {
+ if (hl->mark->getString().isEmpty())
+ {
+ hl->mark->setString("?");
+ m_Doc->flag_Renumber = true;
+ }
+ }
+ }
+ }
+ if (!BulNumMode && hl->mark && hl->mark->isType(MARKBullNumType))
+ {
+ delete (BulNumMark*) hl->mark;
+ hl->mark = NULL;
+ itemText.removeChars(a,1);
+ a--;
+ itLen = itemText.length();
+ continue;
+ }
+ if (current.itemsInLine == 0)
+ opticalMargins = style.opticalMargins();
+ CharStyle charStyle = ((hl->ch != SpecialChars::PARSEP) ? itemText.charStyle(a) : style.charStyle());
chstr = ExpandToken(a);
int chstrLen = chstr.length();
if (chstr.isEmpty())
chstr = SpecialChars::ZWNBSPACE;
curStat = SpecialChars::getCJKAttr(hl->ch);
- if (a > 0 && itemText.text(a-1) == SpecialChars::PARSEP)
- style = itemText.paragraphStyle(a);
- if (current.itemsInLine == 0)
- opticalMargins = style.opticalMargins();
- CharStyle charStyle = (hl->ch != SpecialChars::PARSEP? itemText.charStyle(a) : style.charStyle());
+
+ //set style for paragraph effects
+ if (a == 0 || itemText.text(a-1) == SpecialChars::PARSEP)
+ {
+ if (style.hasDropCap() || style.hasBullet() || style.hasNum())
+ {
+ const QString& curParent(style.hasParent() ? style.parent() : style.name());
+ CharStyle newStyle;
+ if (style.peCharStyleName() == tr("No Style") || style.peCharStyleName().isEmpty())
+ newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name());
+ else if (charStyle.name() != style.peCharStyleName())
+ newStyle.setParent(m_Doc->charStyle(style.peCharStyleName()).name());
+ newStyle.applyCharStyle(charStyle);
+ charStyle.setStyle(newStyle);
+ itemText.setCharStyle(a, 1 , charStyle);
+ }
+ else if (style.peCharStyleName() != tr("No Style") && !style.peCharStyleName().isEmpty())
+ //par effect is cleared but is set dcCharStyleName = clear drop cap char style
+ {
+ const QString& curParent(style.hasParent() ? style.parent() : style.name());
+ charStyle.eraseCharStyle(m_Doc->charStyle(style.peCharStyleName()));
+ charStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name());
+ itemText.setCharStyle(a, 1,charStyle);
+ }
+ }
+
double hlcsize10 = charStyle.fontSize() / 10.0;
double scaleV = charStyle.scaleV() / 1000.0;
double scaleH = charStyle.scaleH() / 1000.0;
@@ -1597,31 +1661,6 @@
}
else
DropCmode = false;
- }
- }
- if (a == 0 || itemText.text(a-1) == SpecialChars::PARSEP)
- {
- if (style.hasDropCap())
- {
- if (style.dcCharStyleName() == tr("No Style") || style.dcCharStyleName().isEmpty())
- {
- const QString& curParent(style.hasParent() ? style.parent() : style.name());
- CharStyle newStyle;
- newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name());
- charStyle.setStyle(newStyle);
- }
- else if (charStyle.name() != style.dcCharStyleName())
- charStyle.setStyle(m_Doc->charStyle(style.dcCharStyleName()));
- itemText.setCharStyle(a, chstrLen ,charStyle);
- }
- else if (style.dcCharStyleName() != tr("No Style") && !style.dcCharStyleName().isEmpty())
- //hasDropCap is cleared but is set dcCharStyleName = clear drop cap char style
- {
- const QString& curParent(style.hasParent() ? style.parent() : style.name());
- CharStyle newStyle;
- newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name());
- charStyle.setStyle(newStyle);
- itemText.setCharStyle(a, chstr.length(),charStyle);
}
}
@@ -1699,7 +1738,7 @@
// find charsize factors
if (DropCmode)
{
- DropCapDrop = calculateLineSpacing (style, this) * (DropLines - 1);
+// DropCapDrop = calculateLineSpacing (style, this) * (DropLines - 1);
// FIXME : we should ensure that fonts are loaded before calls to layout()
// ScFace::realCharHeight()/Ascent() ensure font is loaded thanks to an indirect call to char2CMap()
@@ -1738,7 +1777,7 @@
// set StartOfLine (and find tracking?)
if (current.itemsInLine == 0)
{
- itemText.item(a)->setEffects(itemText.item(a)->effects() | ScStyle_StartOfLine);
+ hl->setEffects(hl->effects() | ScStyle_StartOfLine);
kernVal = 0;
}
else
@@ -1748,6 +1787,7 @@
}
hl->glyph.yadvance = 0;
layoutGlyphs(*hl, chstr, hl->glyph);
+
// find out width, ascent and descent of char
if (HasObject)
{
@@ -1761,9 +1801,9 @@
if (a+1 < itemText.length())
{
uint glyph2 = font.char2CMap(itemText.text(a+1));
- double kern= font.glyphKerning(hl->glyph.glyph, glyph2, chs / 10.0) * hl->glyph.scaleH;
+ double kern= font.glyphKerning(hl->glyph.last()->glyph, glyph2, chs / 10.0) * hl->glyph.scaleH;
wide += kern;
- hl->glyph.xadvance += kern;
+ hl->glyph.last()->xadvance += kern;
// change xadvance, xoffset according to JIS X4051
ScText *hl2 = itemText.item(a+1);
int nextStat = SpecialChars::getCJKAttr(hl2->ch);
@@ -1777,7 +1817,7 @@
case SpecialChars::CJK_NOTOP:
kern = wide / 4;
wide += kern;
- hl->glyph.xadvance += kern;
+ hl->glyph.last()->xadvance += kern;
}
} else { // next char is CJK, too
switch(curStat & SpecialChars::CJK_CHAR_MASK){
@@ -1790,7 +1830,7 @@
case SpecialChars::CJK_MIDPOINT:
kern = -wide / 2;
wide += kern;
- hl->glyph.xadvance += kern;
+ hl->glyph.last()->xadvance += kern;
}
break;
case SpecialChars::CJK_COMMA:
@@ -1800,7 +1840,7 @@
case SpecialChars::CJK_FENCE_END:
kern = -wide / 2;
wide += kern;
- hl->glyph.xadvance += kern;
+ hl->glyph.last()->xadvance += kern;
}
break;
case SpecialChars::CJK_MIDPOINT:
@@ -1808,7 +1848,7 @@
case SpecialChars::CJK_FENCE_BEGIN:
kern = -wide / 2;
wide += kern;
- hl->glyph.xadvance += kern;
+ hl->glyph.last()->xadvance += kern;
}
break;
case SpecialChars::CJK_FENCE_BEGIN:
@@ -1821,8 +1861,8 @@
if(prevStat == SpecialChars::CJK_FENCE_BEGIN){
kern = -wide / 2;
wide += kern;
- hl->glyph.xadvance += kern;
- hl->glyph.xoffset += kern;
+ hl->glyph.last()->xadvance += kern;
+ hl->glyph.last()->xoffset += kern;
}
break;
}
@@ -1836,7 +1876,7 @@
case SpecialChars::CJK_NOTOP:
kern = hl2->glyph.wide() / 4;
wide += kern;
- hl->glyph.xadvance += kern;
+ hl->glyph.last()->xadvance += kern;
}
}
}
@@ -1861,7 +1901,6 @@
{
double realCharHeight = 0.0;
wide = 0.0; realAsce = 0.0;
- //
for (int i = 0; i < chstrLen; ++i)
{
realCharHeight = qMax(realCharHeight, font.realCharHeight(chstr[i], charStyle.fontSize() / 10.0));
@@ -1914,7 +1953,7 @@
else
{
asce = font.ascent(hlcsize10);
- if (HasMark)
+ if (HasMark && !BulNumMode)
realAsce = asce * scaleV + offset;
else
{
@@ -1923,7 +1962,8 @@
}
}
}
-
+// if (BulNumMode)
+// hl->glyph.last()->xadvance += style.parEffectOffset();
//check for Y position at beginning of line
if (current.itemsInLine == 0 && !current.afterOverflow)
{
@@ -1982,21 +2022,33 @@
}
//set left indentation
current.leftIndent = 0.0;
- if (current.addLeftIndent && (maxDX == 0 || DropCmode))
- {
- current.leftIndent = style.leftMargin();
- if (current.hasDropCap)
- current.leftIndent = 0;
+ if (current.addLeftIndent && (maxDX == 0 || DropCmode || BulNumMode))
+ {
+ current.leftIndent = style.leftMargin() + autoLeftIndent;
if (a==0 || (a > 0 && (itemText.text(a-1) == SpecialChars::PARSEP)))
+ {
current.leftIndent += style.firstIndent();
+ if (BulNumMode || DropCmode)
+ {
+ if(style.parEffectIndent())
+ {
+ current.leftIndent -= style.parEffectOffset() + wide;
+ if (current.leftIndent < 0.0)
+ {
+ autoLeftIndent = abs(current.leftIndent);
+ current.leftIndent = 0.0;
+ }
+ }
+ }
+ }
current.addLeftIndent = false;
}
}
current.recalculateY = true;
maxYAsc = 0.0, maxYDesc = 0.0;
+ double addAsce = 0.0;
if (current.startOfCol)
{
- double addAsce;
if (DropCmode)
addAsce = qMax(realAsce, asce + offset);
else
@@ -2085,18 +2137,18 @@
lastLineY = maxYAsc;
if (current.startOfCol)
{
- double addAsce;
- if (DropCmode)
- addAsce = qMax(realAsce, asce + offset);
- else
- addAsce = asce + offset;
- if (style.lineSpacingMode() != ParagraphStyle::BaselineGridLineSpacing)
- {
- if (firstLineOffset() == FLOPRealGlyphHeight)
- addAsce = realAsce;
- else if (firstLineOffset() == FLOPLineSpacing)
- addAsce = style.lineSpacing() + offset;
- }
+// double addAsce;
+// if (DropCmode)
+// addAsce = qMax(realAsce, asce + offset);
+// else
+// addAsce = asce + offset;
+// if (style.lineSpacingMode() != ParagraphStyle::BaselineGridLineSpacing)
+// {
+// if (firstLineOffset() == FLOPRealGlyphHeight)
+// addAsce = realAsce;
+// else if (firstLineOffset() == FLOPLineSpacing)
+// addAsce = style.lineSpacing() + offset;
+// }
maxYAsc = current.yPos - addAsce;
}
else
@@ -2298,7 +2350,7 @@
current.rememberBreak(a, breakPos, style.rightMargin());
}
}
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ if (hl->hasObject(m_Doc))
current.rememberBreak(a, breakPos, style.rightMargin());
// CJK break
if(a > current.line.firstItem)
@@ -2556,21 +2608,23 @@
tabs.status = TabNONE;
}
}
-
- if (DropCmode && !outs)
- {
- DropCmode = false;
- DropLinesCount = 0;
- maxDY = current.yPos;
- current.hasDropCap = true;
- current.xPos += style.dropCapOffset();
- hl->glyph.xadvance += style.dropCapOffset();
- maxDX = current.xPos;
- double spacing = calculateLineSpacing (style, this);
- current.yPos -= spacing * (DropLines-1);
- if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
- current.yPos = adjustToBaselineGrid (current, this, OwnPage);
- current.recalculateY = false;
+ if ((DropCmode || BulNumMode) && !outs)
+ {
+ current.xPos += style.parEffectOffset();
+ hl->glyph.last()->xadvance += style.parEffectOffset();
+ if (DropCmode)
+ {
+ DropCmode = false;
+ DropLinesCount = 0;
+ maxDY = current.yPos;
+ current.hasDropCap = true;
+ maxDX = current.xPos;
+ double spacing = calculateLineSpacing (style, this);
+ current.yPos -= spacing * (DropLines-1);
+ if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
+ current.yPos = adjustToBaselineGrid (current, this, OwnPage);
+ current.recalculateY = false;
+ }
}
// end of line
if (outs)
@@ -5523,7 +5577,7 @@
return QString();
}
-bool PageItem_TextFrame::hasMark(NotesStyle *NS)
+bool PageItem_TextFrame::hasNoteMark(NotesStyle *NS)
{
if (isNoteFrame())
return (asNoteFrame()->notesStyle() == NS);
@@ -5665,6 +5719,8 @@
if (hl->hasMark())
{
if (omitNotes && (hl->mark->isType(MARKNoteMasterType) || hl->mark->isType(MARKNoteFrameType)))
+ continue;
+ if (hl->mark->isType(MARKBullNumType))
continue;
return hl->mark;
}
@@ -5918,12 +5974,14 @@
Mark* mrk = selectedMark(true);
while (mrk != NULL)
{
- Q_ASSERT(!mrk->isNoteType());
- if (doUndo)
- m_Doc->setUndoDelMark(mrk);
- m_Doc->eraseMark(mrk, true, this);
+ if (!mrk->isType(MARKBullNumType))
+ {
+ if (doUndo)
+ m_Doc->setUndoDelMark(mrk);
+ m_Doc->eraseMark(mrk, true, this);
+ ++num;
+ }
mrk = selectedMark(true);
- ++num;
}
return num;
}
Modified: trunk/Scribus/scribus/pageitem_textframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/pageitem_textframe.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.h (original)
+++ trunk/Scribus/scribus/pageitem_textframe.h Sat Jan 5 09:26:28 2013
@@ -142,7 +142,7 @@
public:
//for footnotes/endnotes
- bool hasMark(NotesStyle* NS = NULL);
+ bool hasNoteMark(NotesStyle* NS = NULL);
bool hasNoteFrame(NotesStyle* NS, bool inChain = false);
//bool hasNoteFrame(PageItem_NoteFrame* nF) { return m_notesFramesMap.contains(nF); }
void delAllNoteFrames(bool doUpdate = false);
Modified: trunk/Scribus/scribus/pagestructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/pagestructs.h
==============================================================================
--- trunk/Scribus/scribus/pagestructs.h (original)
+++ trunk/Scribus/scribus/pagestructs.h Sat Jan 5 09:26:28 2013
@@ -10,6 +10,7 @@
#include <QMap>
#include <QList>
#include <QString>
+#include "numeration.h"
struct ObjectAttribute
{
@@ -40,27 +41,13 @@
typedef QList<ToCSetup> ToCSetupVector;
-
-typedef enum
-{
- Type_1_2_3,
- Type_i_ii_iii,
- Type_I_II_III,
- Type_a_b_c,
- Type_A_B_C,
- Type_asterix,
- Type_None=99
-} DocumentSectionType;
-
-typedef DocumentSectionType NumerationType;
-
struct DocumentSection
{
uint number; //Just an index in the section list
QString name; //User defined name for the section
uint fromindex; //First page _index_ of the section in the document (old page number)
uint toindex; //Last page _index_ of the section in the document (old page number)
- DocumentSectionType type; //Type of section numbering, ie i,ii,iii or a,b,c or 1,2,3, etc
+ NumFormat type; //Type of section numbering, ie i,ii,iii or a,b,c or 1,2,3, etc
uint sectionstartindex; // Start of section, an index in the range of type, eg for type i,ii,iii, this would be 2 for "ii".
bool reversed; // Counting 10-1 ?
bool active; // Is the section active, ie, if the fromindex is 10, and theres 5 pages, this should be inactive.
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Sat Jan 5 09:26:28 2013
@@ -2218,7 +2218,7 @@
vg->charStyle().setFontSize(qRound(ScCLocale::toDoubleC(pg->attribute("FONTSIZE"), 12.0) * 10.0));
vg->setHasDropCap(static_cast<bool>(pg->attribute("DROP", "0").toInt()));
vg->setDropCapLines(pg->attribute("DROPLIN", "2").toInt());
- vg->setDropCapOffset(ScCLocale::toDoubleC(pg->attribute("DROPDIST"), 0.0));
+ vg->setParEffectOffset(ScCLocale::toDoubleC(pg->attribute("DROPDIST"), 0.0));
vg->charStyle().setFeatures(static_cast<StyleFlag>((pg->attribute("EFFECT", "0").toInt())).featureList());
fColor = pg->attribute("FCOLOR", doc->itemToolPrefs().shapeFillColor);
fShade = pg->attribute("FSHADE", "100").toInt();
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sat Jan 5 09:26:28 2013
@@ -813,8 +813,8 @@
pstyle.resetGapAfter();
if (pstyle.dropCapLines() < 0)
pstyle.resetDropCapLines();
- if (pstyle.dropCapOffset() <= -16000)
- pstyle.resetDropCapOffset();
+ if (pstyle.parEffectOffset() <= -16000)
+ pstyle.resetParEffectOffset();
fixLegacyCharStyle(pstyle.charStyle());
}
@@ -1324,7 +1324,7 @@
static const QString DROPDIST("DROPDIST");
if (attrs.hasAttribute(DROPDIST))
- newStyle.setDropCapOffset(attrs.valueAsDouble(DROPDIST));
+ newStyle.setParEffectOffset(attrs.valueAsDouble(DROPDIST));
static const QString PSHORTCUT("PSHORTCUT");
if (attrs.hasAttribute(PSHORTCUT))
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Sat Jan 5 09:26:28 2013
@@ -1173,7 +1173,7 @@
if (m_Doc->autoSave() && ScCore->usingGUI())
m_Doc->restartAutoSaveTimer();
// m_Doc->autoSaveTimer->start(m_Doc->autoSaveTime());
-
+
if (m_mwProgressBar!=0)
m_mwProgressBar->setValue(DOC.childNodes().count());
@@ -1384,7 +1384,7 @@
vg.charStyle().setFontSize(qRound(ScCLocale::toDoubleC(pg.attribute("FONTSIZE"), 12.0) * 10.0));
vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt()));
vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt());
- vg.setDropCapOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0));
+ vg.setParEffectOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0));
vg.charStyle().setFeatures(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()).featureList());
QString fColor = pg.attribute("FCOLOR", doc->itemToolPrefs().shapeFillColor);
int fShade = pg.attribute("FSHADE", "100").toInt();
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sat Jan 5 09:26:28 2013
@@ -1886,9 +1886,9 @@
}
// start auto save timer if needed
- if (m_Doc->autoSave() && ScCore->usingGUI())
+ if (m_Doc->autoSave() && ScCore->usingGUI())
m_Doc->restartAutoSaveTimer();
-// m_Doc->autoSaveTimer->start(m_Doc->autoSaveTime());
+// m_Doc->autoSaveTimer->start(m_Doc->autoSaveTime());
if (m_mwProgressBar!=0)
m_mwProgressBar->setValue(reader.characterOffset());
@@ -1977,8 +1977,8 @@
pstyle.resetGapAfter();
if (pstyle.dropCapLines() < 0)
pstyle.resetDropCapLines();
- if (pstyle.dropCapOffset() <= -16000)
- pstyle.resetDropCapOffset();
+ if (pstyle.parEffectOffset() <= -16000)
+ pstyle.resetParEffectOffset();
fixLegacyCharStyle(pstyle.charStyle());
}
@@ -2556,13 +2556,25 @@
if (attrs.hasAttribute(NACH))
newStyle.setGapAfter(attrs.valueAsDouble(NACH));
+ static const QString ParagraphEffectCharStyle("ParagraphEffectCharStyle");
+ if (attrs.hasAttribute(ParagraphEffectCharStyle))
+ newStyle.setPeCharStyleName(attrs.valueAsString(ParagraphEffectCharStyle));
+
+ static const QString ParagraphEffectOffset("ParagraphEffectOffset");
+ if (attrs.hasAttribute(ParagraphEffectOffset))
+ newStyle.setParEffectOffset(attrs.valueAsDouble(ParagraphEffectOffset));
+
+ static const QString ParagraphEffectIndent("ParagraphEffectIndent");
+ if (attrs.hasAttribute(ParagraphEffectIndent))
+ newStyle.setParEffectIndent(attrs.valueAsDouble(ParagraphEffectIndent));
+
static const QString DROP("DROP");
if (attrs.hasAttribute(DROP))
newStyle.setHasDropCap(static_cast<bool>(attrs.valueAsInt(DROP)));
static const QString DROPCHSTYLE("DROPCHSTYLE");
if (attrs.hasAttribute(DROPCHSTYLE))
- newStyle.setDcCharStyleName(attrs.valueAsString(DROPCHSTYLE));
+ newStyle.setPeCharStyleName(attrs.valueAsString(DROPCHSTYLE));
static const QString DROPLIN("DROPLIN");
if (attrs.hasAttribute(DROPLIN))
@@ -2570,7 +2582,55 @@
static const QString DROPDIST("DROPDIST");
if (attrs.hasAttribute(DROPDIST))
- newStyle.setDropCapOffset(attrs.valueAsDouble(DROPDIST));
+ newStyle.setParEffectOffset(attrs.valueAsDouble(DROPDIST));
+
+ static const QString Bullet("Bullet");
+ if (attrs.hasAttribute(Bullet))
+ newStyle.setHasBullet(static_cast<bool>(attrs.valueAsInt(Bullet)));
+
+ static const QString BulletStr("BulletStr");
+ if (attrs.hasAttribute(BulletStr))
+ newStyle.setBulletStr(attrs.valueAsString(BulletStr));
+
+ static const QString Numeration("Numeration");
+ if (attrs.hasAttribute(Numeration))
+ newStyle.setHasNum(static_cast<bool>(attrs.valueAsInt(Numeration)));
+
+ static const QString NumerationName("NumerationName");
+ if (attrs.hasAttribute(NumerationName))
+ newStyle.setNumName(attrs.valueAsString(NumerationName));
+
+ static const QString NumerationFormat("NumerationFormat");
+ if (attrs.hasAttribute(NumerationFormat))
+ newStyle.setNumFormat(attrs.valueAsInt(NumerationFormat));
+
+ static const QString NumerationLevel("NumerationLevel");
+ if (attrs.hasAttribute(NumerationLevel))
+ newStyle.setNumLevel(attrs.valueAsInt(NumerationLevel));
+
+ static const QString NumerationStart("NumerationStart");
+ if (attrs.hasAttribute(NumerationStart))
+ newStyle.setNumStart(attrs.valueAsInt(NumerationStart));
+
+ static const QString NumearationPrefix("NumerationPrefix");
+ if (attrs.hasAttribute(NumearationPrefix))
+ newStyle.setNumPrefix(attrs.valueAsString(NumearationPrefix));
+
+ static const QString NumerationSuffix("NumerationSuffix");
+ if (attrs.hasAttribute(NumerationSuffix))
+ newStyle.setNumSuffix(attrs.valueAsString(NumerationSuffix));
+
+ static const QString NumerationRestart("NumerationRestart");
+ if (attrs.hasAttribute(NumerationRestart))
+ newStyle.setNumRestart(attrs.valueAsInt(NumerationRestart));
+
+ static const QString NumerationOther("NumeartionOther");
+ if (attrs.hasAttribute(NumerationOther))
+ newStyle.setNumOther(static_cast<bool>(attrs.valueAsInt(NumerationOther)));
+
+ static const QString NumearationHigher("NumerationHigher");
+ if (attrs.hasAttribute(NumearationHigher))
+ newStyle.setNumHigher(static_cast<bool>(attrs.valueAsInt(NumearationHigher)));
static const QString PSHORTCUT("PSHORTCUT");
if (attrs.hasAttribute(PSHORTCUT))
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Sat Jan 5 09:26:28 2013
@@ -639,14 +639,40 @@
docu.writeAttribute("VOR", style.gapBefore());
if ( ! style.isInhGapAfter())
docu.writeAttribute("NACH", style.gapAfter());
+ if ( ! style.isInhPeCharStyleName())
+ docu.writeAttribute("ParagraphEffectCharStyle", style.peCharStyleName());
+ if ( ! style.isInhParEffectOffset())
+ docu.writeAttribute("ParagraphEffectOffset", style.parEffectOffset());
+ if ( ! style.isInhParEffectIndent())
+ docu.writeAttribute("ParagraphEffectIndent", static_cast<int>(style.parEffectIndent()));
if ( ! style.isInhHasDropCap())
docu.writeAttribute("DROP", static_cast<int>(style.hasDropCap()));
- if ( ! style.isInhDcCharStyleName())
- docu.writeAttribute("DROPCHSTYLE", style.dcCharStyleName());
if ( ! style.isInhDropCapLines())
docu.writeAttribute("DROPLIN", style.dropCapLines());
- if ( ! style.isInhDropCapOffset())
- docu.writeAttribute("DROPDIST", style.dropCapOffset());
+ if ( ! style.isInhHasBullet())
+ docu.writeAttribute("Bullet", static_cast<int>(style.hasBullet()));
+ if ( ! style.isInhBulletStr())
+ docu.writeAttribute("BulletStr", style.bulletStr());
+ if ( ! style.isInhHasNum())
+ docu.writeAttribute("Numeration", static_cast<int>(style.hasNum()));
+ if ( ! style.isInhNumFormat())
+ docu.writeAttribute("NumerationFormat", style.numFormat());
+ if ( ! style.isInhNumName())
+ docu.writeAttribute("NumerationName", style.numName());
+ if ( ! style.isInhNumLevel())
+ docu.writeAttribute("NumerationLevel", style.numLevel());
+ if ( ! style.isInhNumPrefix())
+ docu.writeAttribute("NumerationPrefix", style.numPrefix());
+ if ( ! style.isInhNumSuffix())
+ docu.writeAttribute("NumerationSuffix", style.numSuffix());
+ if ( ! style.isInhNumStart())
+ docu.writeAttribute("NumerationStart", style.numStart());
+ if ( ! style.isInhNumRestart())
+ docu.writeAttribute("NumerationRestart", style.numRestart());
+ if ( ! style.isInhNumOther())
+ docu.writeAttribute("NumerationOther", static_cast<int>(style.numOther()));
+ if ( ! style.isInhNumHigher())
+ docu.writeAttribute("NumerationHigher", static_cast<int>(style.numHigher()));
if ( ! style.isInhOpticalMargins())
docu.writeAttribute("OpticalMargins", style.opticalMargins());
if ( ! style.isInhHyphenationMode())
@@ -1566,9 +1592,12 @@
else if (ch == SpecialChars::OBJECT && item->itemText.item(k)->mark != NULL)
{
Mark* mark = item->itemText.item(k)->mark;
- docu.writeEmptyElement("MARK");
- docu.writeAttribute("label", mark->label);
- docu.writeAttribute("type", mark->getType());
+ if (!mark->isType(MARKBullNumType))
+ { //dont save marks for bullets and numbering
+ docu.writeEmptyElement("MARK");
+ docu.writeAttribute("label", mark->label);
+ docu.writeAttribute("type", mark->getType());
+ }
}
else if (ch == SpecialChars::PARSEP) // stores also the paragraphstyle for preceding chars
putPStyle(docu, item->itemText.paragraphStyle(k), "para");
Modified: trunk/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp Sat Jan 5 09:26:28 2013
@@ -130,7 +130,7 @@
if (currentListStyle)
{
currentListStyle->advance();
- write(currentListStyle->bullet());
+ //write(currentListStyle->bullet());
}
}
else if (name == "office:annotation")
Modified: trunk/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp Sat Jan 5 09:26:28 2013
@@ -167,6 +167,16 @@
ListLevel *llevel = new ListLevel(ulevel, bstyle, prefix, suffix, bullet, displayLevels, startAt);
currentListStyle->addLevel(ulevel, llevel);
readProperties = true;
+
+ gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
+ assert(s != NULL);
+ if (bstyle == Bullet || bstyle == Graphic)
+ s->setBullet(true);
+ else
+ {
+ Q_ASSERT(((int) bstyle > 0) && ((int) bstyle < 6));
+ s->setNum(true, (int) bstyle -1, 0, startAt+1, prefix, suffix);
+ }
}
else if ((name == "style:drop-cap") && (readProperties))
{
@@ -498,6 +508,18 @@
(name == "text:list-level-style-number") ||
(name == "text:list-level-style-image")) && (currentStyle != NULL))
{
+// if ((name == "text:list-level-style-bullet"))
+// {
+// gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
+// if (s)
+// s->setBullet(true);
+// }
+// else if ((name == "text:list-level-style-number"))
+// {
+// gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle);
+// if (s)
+// s->setNum(true);
+// }
setStyle(currentStyle->getName(), currentStyle);
currentStyle = NULL;
parentStyle = NULL;
@@ -572,6 +594,7 @@
nameByAttrs += QString("%1-").arg(s->getFirstLineIndent());
nameByAttrs += QString("%1-").arg(s->getAlignment());
nameByAttrs += QString("%1-").arg(s->hasDropCap());
+ nameByAttrs += QString("%1-").arg(s->hasBullet());
nameByAttrs += QString("%1-").arg(s->getFont()->getColor());
nameByAttrs += QString("%1-").arg(s->getFont()->getStrokeColor());
// TODO is this important ??
Modified: trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp Sat Jan 5 09:26:28 2013
@@ -731,7 +731,7 @@
{
flushText();
currentParagraphStyle.setDropCapLines(lineCount);
- currentParagraphStyle.setDropCapOffset(charCount);
+ currentParagraphStyle.setParEffectOffset(charCount);
currentParagraphStyle.setHasDropCap(true);
writer->setStyle(currentParagraphStyle);
currentParagraphStyle = writer->getCurrentStyle();
@@ -741,7 +741,7 @@
if (define == 2)
{
defParagraphStyle.setDropCapLines(lineCount);
- defParagraphStyle.setDropCapOffset(charCount);
+ defParagraphStyle.setParEffectOffset(charCount);
defParagraphStyle.setHasDropCap(true);
}
}
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp Sat Jan 5 09:26:28 2013
@@ -22,6 +22,7 @@
Special thanks go to avox for helping me! */
PyObject *scribus_createparagraphstyle(PyObject* /* self */, PyObject* args, PyObject* keywords)
{
+ //TODO - new paragraph properties for bullets and numbering
char* keywordargs[] = {
const_cast<char*>("name"),
const_cast<char*>("linespacingmode"),
@@ -40,11 +41,11 @@
char *Name = const_cast<char*>(""), *CharStyle = const_cast<char*>("");
int LineSpacingMode = 0, Alignment = 0, DropCapLines = 2, HasDropCap = 0;
double LineSpacing = 15.0, LeftMargin = 0.0, RightMargin = 0.0;
- double GapBefore = 0.0, GapAfter = 0.0, FirstIndent = 0.0, DropCapOffset = 0;
+ double GapBefore = 0.0, GapAfter = 0.0, FirstIndent = 0.0, PEOffset = 0;
if (!PyArg_ParseTupleAndKeywords(args, keywords, "es|ididddddiides",
keywordargs, "utf-8", &Name, &LineSpacingMode, &LineSpacing, &Alignment,
&LeftMargin, &RightMargin, &GapBefore, &GapAfter, &FirstIndent,
- &HasDropCap, &DropCapLines, &DropCapOffset, "utf-8", &CharStyle))
+ &HasDropCap, &DropCapLines, &PEOffset, "utf-8", &CharStyle))
return NULL;
if(!checkHaveDocument())
return NULL;
@@ -74,7 +75,7 @@
return NULL;
}
TmpParagraphStyle.setDropCapLines(DropCapLines);
- TmpParagraphStyle.setDropCapOffset(DropCapOffset);
+ TmpParagraphStyle.setParEffectOffset(PEOffset);
TmpParagraphStyle.charStyle().setParent(CharStyle);
StyleSet<ParagraphStyle> TmpStyleSet;
Modified: trunk/Scribus/scribus/sampleitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/sampleitem.cpp
==============================================================================
--- trunk/Scribus/scribus/sampleitem.cpp (original)
+++ trunk/Scribus/scribus/sampleitem.cpp Sat Jan 5 09:26:28 2013
@@ -47,8 +47,10 @@
tmpStyle.charStyle().setFontSize(m_Doc->itemToolPrefs().textSize);
// tmpStyle.tabValues().clear();
tmpStyle.setHasDropCap(false);
+ tmpStyle.setHasBullet(false);
+ tmpStyle.setHasNum(false);
tmpStyle.setDropCapLines(0);//2;
- tmpStyle.setDropCapOffset(0);
+ tmpStyle.setParEffectOffset(0);
tmpStyle.charStyle().setFeatures(QStringList(CharStyle::INHERIT));
tmpStyle.charStyle().setFillColor("__blackforpreview__");
tmpStyle.charStyle().setFillShade(100); //m_Doc->toolSettings.dShade;
@@ -178,9 +180,19 @@
tmpStyle.setDropCapLines(dropLin);
}
-void SampleItem::setDropDist(double dropDist)
-{
- tmpStyle.setDropCapOffset(dropDist);
+void SampleItem::setParEffectDist(double dist)
+{
+ tmpStyle.setParEffectOffset(dist);
+}
+
+void SampleItem::setBullet(bool bul)
+{
+ tmpStyle.setHasBullet(bul);
+}
+
+void SampleItem::setNum(bool num)
+{
+ tmpStyle.setHasNum(num);
}
void SampleItem::setFontEffect(int fontEffect)
Modified: trunk/Scribus/scribus/sampleitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/sampleitem.h
==============================================================================
--- trunk/Scribus/scribus/sampleitem.h (original)
+++ trunk/Scribus/scribus/sampleitem.h Sat Jan 5 09:26:28 2013
@@ -67,8 +67,10 @@
void setFontSize(int fontSize, bool autoLineSpa=false);
//void setTabValues(QValueList<PageItem::TabRecord> tabValues);
void setDrop(bool drop);
+ void setBullet(bool bul);
+ void setNum(bool num);
void setDropLin(int dropLin);
- void setDropDist(double dropDist);
+ void setParEffectDist(double dropDist);
void setFontEffect(int fontEffect);
void setFColor(QString fColor);
void setFShade(int fShade);
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Jan 5 09:26:28 2013
@@ -105,9 +105,9 @@
#include "pageitem_group.h"
#include "pageitem_imageframe.h"
#include "pageitem_latexframe.h"
-#include "pageitem_noteframe.h"
#include "pageitem_table.h"
#include "pageitem_textframe.h"
+#include "pageitem_noteframe.h"
#include "pagesize.h"
#include "pdflib.h"
#include "pdfoptions.h"
@@ -1081,6 +1081,7 @@
scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras", false);
scrMenuMgr->addMenuItem(scrActions["extrasDeHyphenateText"], "Extras", false);
scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras", false);
+ scrMenuMgr->addMenuItem(scrActions["extrasUpdateDocument"], "Extras", false);
connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow()));
//Window menu
@@ -1697,7 +1698,7 @@
currItem->handleModeEditKey(k, keyrep);
}
//FIXME:av view->oldCp = currItem->CPos;
- if (currItem->itemType() == PageItem::TextFrame)
+ if (currItem->isTextFrame())
{
bool kr=keyrep;
view->canvasMode()->keyPressEvent(k); //Hack for 1.4.x for stopping the cursor blinking while moving about
@@ -1712,7 +1713,8 @@
}
keyrep=kr;
}
- slotDocCh(false);
+ if (!currItem->isTextFrame() || (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty()))
+ slotDocCh(false);
doc->regionsChanged()->update(QRectF());
}
}
@@ -2353,6 +2355,7 @@
scrActions["viewShowRulers"]->setChecked(doc->guidesPrefs().rulersShown);
scrActions["viewRulerMode"]->setChecked(doc->guidesPrefs().rulerMode);
scrActions["extrasGenerateTableOfContents"]->setEnabled(doc->hasTOCSetup());
+ scrActions["extrasUpdateDocument"]->setEnabled(true);
if (!doc->masterPageMode())
pagePalette->Rebuild();
outlinePalette->setDoc(doc);
@@ -3431,6 +3434,17 @@
Q_ASSERT(plugin); // all the returned names should represent loaded plugins
plugin->changedDoc(doc);
}
+ if (doc->flag_NumUpdateRequest)
+ {
+ doc->setupNumerations();
+ emit UpdateRequest(reqNumUpdate);
+ }
+ while (doc->flag_Renumber)
+ {
+ doc->updateNumbers();
+ if (!doc->flag_Renumber)
+ doc->regionsChanged()->update(QRect());
+ }
if (m_marksCount != doc->marksList().count() || doc->notesChanged() || doc->flag_updateEndNotes || doc->flag_updateMarksLabels)
{
bool sendUpdateReqest = false;
@@ -4264,6 +4278,7 @@
/*QTime t;
t.start();*/
int docItemsCount=doc->Items->count();
+ doc->flag_Renumber = false;
for (int azz=0; azz<docItemsCount; ++azz)
{
PageItem *ite = doc->Items->at(azz);
@@ -4310,6 +4325,8 @@
// Seems to fix crash on loading
ActWin = NULL;
newActWin(w->getSubWin());
+ doc->updateNumbers(true);
+ emit UpdateRequest(reqNumUpdate);
doc->setCurrentPage(doc->DocPages.at(0));
view->cmsToolbarButton->setChecked(doc->HasCMS);
view->zoom();
@@ -4417,6 +4434,8 @@
if (doc->Items->at(a)->isBookmark)
bookmarkPalette->BView->ChangeText(doc->Items->at(a));
}
+ if (!impsetup.textOnly)
+ doc->flag_NumUpdateRequest = true;
view->DrawNew();
slotDocCh();
styleManager->setDoc(doc);
@@ -8053,6 +8072,7 @@
scrActions["viewShowRulers"]->setChecked(doc->guidesPrefs().rulersShown);
scrActions["viewRulerMode"]->setChecked(doc->guidesPrefs().rulerMode);
scrActions["extrasGenerateTableOfContents"]->setEnabled(doc->hasTOCSetup());
+ scrActions["extrasUpdateDocument"]->setEnabled(true);
view->cmsToolbarButton->setChecked(doc->HasCMS);
//doc emits changed() via this
doc->setMasterPageMode(true);
@@ -9985,6 +10005,17 @@
{
if (HaveDoc)
tocGenerator->generateDefault();
+}
+
+void ScribusMainWindow::updateDocument()
+{
+ if (HaveDoc)
+ {
+ doc->updateNumbers(true);
+ doc->updateMarks(true);
+ doc->regionsChanged()->update(QRect());
+ emit UpdateRequest(reqNumUpdate);
+ }
}
void ScribusMainWindow::insertSampleText()
Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Sat Jan 5 09:26:28 2013
@@ -446,6 +446,7 @@
void objectAttributes();
void getImageInfo();
void generateTableOfContents();
+ void updateDocument();
// void saveStyles(StilFormate *dia); //still required for style save from SE
void setNewAlignment(int a);
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Jan 5 09:26:28 2013
@@ -55,6 +55,7 @@
#include "ui/inserttablecolumnsdialog.h"
#include "ui/inserttablerowsdialog.h"
#include "notesstyles.h"
+#include "numeration.h"
#include "ui/notesstyleseditor.h"
#include "pageitem.h"
#include "pageitem_imageframe.h"
@@ -276,7 +277,9 @@
flag_restartMarksRenumbering(false),
flag_updateMarksLabels(false),
flag_updateEndNotes(false),
- flag_layoutNotesFrames(true)
+ flag_layoutNotesFrames(true),
+ flag_Renumber(false),
+ flag_NumUpdateRequest(false)
{
docUnitRatio=unitGetRatioFromIndex(docPrefsData.docSetupPrefs.docUnitIndex);
docPrefsData.docSetupPrefs.pageHeight=0;
@@ -292,6 +295,15 @@
editOnPreview = false;
previewVisual = -1;
dontResize = false;
+ //create default numeration
+ NumStruct * numS = new NumStruct;
+ numS->m_name = "default";
+ Numeration newNum;
+ numS->m_nums.insert(0, newNum);
+ numS->m_counters.insert(0, 0);
+ numS->m_lastlevel = -1;
+ numerations.insert("default", numS);
+
currentEditedTextframe = NULL;
}
@@ -380,7 +392,9 @@
flag_restartMarksRenumbering(false),
flag_updateMarksLabels(false),
flag_updateEndNotes(false),
- flag_layoutNotesFrames(true)
+ flag_layoutNotesFrames(true),
+ flag_Renumber(false),
+ flag_NumUpdateRequest(false)
{
docPrefsData.docSetupPrefs.docUnitIndex=unitindex;
docPrefsData.docSetupPrefs.pageHeight=pagesize.height();
@@ -489,8 +503,10 @@
pstyle.setGapBefore(0);
pstyle.setGapAfter(0);
pstyle.setHasDropCap(false);
+ pstyle.setHasBullet(false);
+ pstyle.setHasNum(false);
pstyle.setDropCapLines(2);
- pstyle.setDropCapOffset(0);
+ pstyle.setParEffectOffset(0);
pstyle.charStyle().setParent("");
CharStyle cstyle;
@@ -688,6 +704,9 @@
delete m_docNotesStylesList.takeFirst();
docPatterns.clear();
docGradients.clear();
+ foreach (NumStruct* ns, numerations.values())
+ delete ns;
+ numerations.clear();
while (!DocItems.isEmpty())
{
delete DocItems.takeFirst();
@@ -1487,6 +1506,11 @@
}
}
docParagraphStyles.invalidate();
+ if (!isLoading())
+ {
+ flag_Renumber = true;
+ flag_NumUpdateRequest = true;
+ }
}
void ScribusDoc::redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused)
@@ -1867,7 +1891,7 @@
NS->setName(ss->get("name"));
NS->setStart(ss->getInt("start"));
NS->setEndNotes(ss->getBool("endNotes"));
- NS->setType((NumerationType) ss->getInt("numStyle"));
+ NS->setType((NumFormat) ss->getInt("numFormat"));
NS->setRange((NumerationRange) ss->getInt("range"));
NS->setPrefix(ss->get("prefix"));
NS->setSuffix(ss->get("suffix"));
@@ -1908,7 +1932,7 @@
NS->setStart(ss->getInt("start"));
NS->setRange((NumerationRange) ss->getInt("range"));
NS->setEndNotes(ss->getBool("endNotes"));
- NS->setType((NumerationType) ss->getInt("numStyle"));
+ NS->setType((NumFormat) ss->getInt("numFormat"));
NS->setPrefix(ss->get("prefix"));
NS->setSuffix(ss->get("suffix"));
NS->setAutoNotesHeight(ss->getBool("autoH"));
@@ -1926,7 +1950,7 @@
NS->setStart(ss->getInt("NEWstart"));
NS->setRange((NumerationRange) ss->getInt("NEWrange"));
NS->setEndNotes(ss->getBool("NEWendNotes"));
- NS->setType((NumerationType) ss->getInt("NEWnumStyle"));
+ NS->setType((NumFormat) ss->getInt("NEWnumFormat"));
NS->setPrefix(ss->get("NEWprefix"));
NS->setSuffix(ss->get("NEWsuffix"));
NS->setAutoNotesHeight(ss->getBool("NEWautoH"));
@@ -4446,10 +4470,25 @@
int stop = it->isTextFrame() ? it->lastInFrame() + 1 : it->itemText.length();
for (int e = start; e < stop; ++e)
{
- if (! Really.contains(it->itemText.charStyle(e).font().replacementName()) )
- {
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really.insert(it->itemText.charStyle(e).font().replacementName(), QMap<uint, FPointArray>());
+ const ScFace* font = &it->itemText.charStyle(e).font();
+ if (it->itemText.item(e)->mark)
+ {
+ QString mrkStr = it->itemText.item(e)->mark->getString();
+ for (int i=0;i<mrkStr.length(); ++i)
+ {
+ if (font->canRender(mrkStr[i].unicode()))
+ {
+ uint gl = font->char2CMap(mrkStr[i]);
+ FPointArray gly(font->glyphOutline(gl));
+ if (!font->replacementName().isEmpty())
+ Really[font->replacementName()].insert(gl, gly);
+ }
+ }
+ }
+ if (! Really.contains(font->replacementName()) )
+ {
+ if (!font->replacementName().isEmpty())
+ Really.insert(font->replacementName(), QMap<uint, FPointArray>());
}
uint chr = it->itemText.text(e).unicode();
if ((chr == 13) || (chr == 32) || ((chr >= 26) && (chr <= 29)))
@@ -4467,10 +4506,10 @@
chstr = chstr.toUpper();
}
chr = chstr.unicode();
- uint gl = it->itemText.charStyle(e).font().char2CMap(chstr);
- gly = it->itemText.charStyle(e).font().glyphOutline(gl);
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ uint gl = font->char2CMap(chstr);
+ gly = font->glyphOutline(gl);
+ if (!font->replacementName().isEmpty())
+ Really[font->replacementName()].insert(gl, gly);
}
for (int t1 = 0; t1 < it->itemText.defaultStyle().tabValues().count(); t1++)
{
@@ -4483,10 +4522,10 @@
chstr = chstr.toUpper();
}
chr = chstr.unicode();
- uint gl = it->itemText.charStyle(e).font().char2CMap(chstr);
- gly = it->itemText.charStyle(e).font().glyphOutline(gl);
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ uint gl = font->char2CMap(chstr);
+ gly = font->glyphOutline(gl);
+ if (!font->replacementName().isEmpty())
+ Really[font->replacementName()].insert(gl, gly);
}
continue;
}
@@ -4562,16 +4601,17 @@
for (int pnti=0;pnti<pageNumberText.length(); ++pnti)
{
uint chr = pageNumberText[pnti].unicode();
- if (it->itemText.charStyle(e).font().canRender(chr))
+ if (font->canRender(chr))
{
- uint gl = it->itemText.charStyle(e).font().char2CMap(pageNumberText[pnti]);
- FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl));
- if (!it->itemText.charStyle(e).font().replacementName().isEmpty())
- Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly);
+ uint gl = font->char2CMap(pageNumberText[pnti]);
+ FPointArray gly(font->glyphOutline(gl));
+ if (!font->replacementName().isEmpty())
+ Really[font->replacementName()].insert(gl, gly);
}
}
continue;
}
+
if (it->itemText.charStyle(e).effects() & ScStyle_SoftHyphenVisible)
{
uint gl = it->itemText.charStyle(e).font().char2CMap(QChar('-'));
@@ -6821,7 +6861,7 @@
}
}
-void ScribusDoc::addSection(const int number, const QString& name, const uint fromindex, const uint toindex, const DocumentSectionType type, const uint sectionstartindex, const bool reversed, const bool active, const QChar fillChar, int fieldWidth)
+void ScribusDoc::addSection(const int number, const QString& name, const uint fromindex, const uint toindex, const NumFormat type, const uint sectionstartindex, const bool reversed, const bool active, const QChar fillChar, int fieldWidth)
{
struct DocumentSection newSection;
uint docPageCount=DocPages.count();
@@ -9096,13 +9136,77 @@
regionsChanged()->update(QRectF());
}
-void ScribusDoc::itemSelection_ApplyParagraphStyle(const ParagraphStyle & newStyle, Selection* customSelection, bool rmDirectFormatting)
+void ScribusDoc::itemSelection_ClearBulNumStrings(Selection* customSelection)
{
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
assert(itemSelection!=0);
uint selectedItemCount=itemSelection->count();
if (selectedItemCount == 0)
return;
+ for (uint aa = 0; aa < selectedItemCount; ++aa)
+ {
+ PageItem *currItem = itemSelection->itemAt(aa);
+ if (currItem->itemText.length() == 0)
+ continue;
+ int currItemTextCount = currItem->itemText.length();
+ if ((appMode != modeEdit) && (appMode != modeEditTable))
+ {
+ for (int pos = 0; pos < currItemTextCount; ++pos)
+ {
+ ScText* hl = currItem->itemText.item(pos);
+ if (hl->hasMark() && hl->mark->isType(MARKBullNumType))
+ {
+ if (UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle);
+ is->set("CLEARMARK", "clear_mark_string");
+ is->setItem(qMakePair(pos, hl->mark->getString()));
+ undoManager->action(currItem, is);
+ }
+ hl->mark->setString(QString());
+ }
+ }
+ }
+ else
+ {
+ int start;
+ int stop;
+ start = stop = currItem->itemText.normalizedCursorPosition();
+ if (currItem->HasSel)
+ {
+ start = currItem->itemText.startOfSelection();
+ stop = currItem->itemText.endOfSelection();
+ }
+ start = currItem->itemText.startOfParagraph(currItem->itemText.nrOfParagraph(start));
+ stop = currItem->itemText.endOfParagraph(currItem->itemText.nrOfParagraph(stop));
+ for (int pos=start; pos < stop; ++pos)
+ {
+ ScText* hl = currItem->itemText.item(pos);
+ if (hl->hasMark() && hl->mark->isType(MARKBullNumType))
+ {
+ if (UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle);
+ is->set("CLEARMARKSTRING", "clear_mark_string");
+ is->setItem(qMakePair(pos, hl->mark->getString()));
+ undoManager->action(currItem, is);
+ }
+ hl->mark->setString(QString());
+ }
+ }
+ }
+ }
+ flag_Renumber = true;
+}
+
+void ScribusDoc::itemSelection_ApplyParagraphStyle(const ParagraphStyle & newStyle, Selection* customSelection, bool rmDirectFormatting)
+{
+ Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+ assert(itemSelection!=0);
+ uint selectedItemCount=itemSelection->count();
+ if (selectedItemCount == 0)
+ return;
+ itemSelection_ClearBulNumStrings(itemSelection);
UndoTransaction* activeTransaction = NULL;
if (UndoManager::undoEnabled() && selectedItemCount > 1)
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle, newStyle.displayName(), Um::IFont));
@@ -16250,6 +16354,7 @@
return m_tserializer;
}
+
void ScribusDoc::RotMode(const int& val)
{
rotMode = val;
@@ -16288,7 +16393,7 @@
*/
docHyphenator->slotNewSettings(docPrefsData.hyphPrefs.MinWordLen,
- docPrefsData.hyphPrefs.Automatic,
+ !docPrefsData.hyphPrefs.Automatic,
docPrefsData.hyphPrefs.AutoCheck,
docPrefsData.hyphPrefs.HyCount);
docHyphenator->ignoredWords = docPrefsData.hyphPrefs.ignoredWords;
@@ -16643,7 +16748,7 @@
for (int e = start; e < stop; ++e)
{
ScText *hl = it->itemText.item(e);
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(this)))
+ if (hl->hasObject(this))
{
if (hl->getItem(this)->inlineCharID == fIndex)
deleteList.prepend(e);
@@ -16706,6 +16811,314 @@
if (docPrefsData.docSetupPrefs.AutoSave)
autoSaveTimer->start(docPrefsData.docSetupPrefs.AutoSaveTime);
emit updateAutoSaveClock();
+}
+
+void ScribusDoc::setupNumerations()
+{
+ QList<NumStruct*> numList = numerations.values();
+ while (!numList.isEmpty())
+ delete numList.takeFirst();
+ numerations.clear();
+
+ Numeration num;
+ NumStruct * numS = NULL;
+ for (int i=0; i < docParagraphStyles.count(); ++i)
+ {
+ if (docParagraphStyles[i].hasNum())
+ {
+ ParagraphStyle &style = docParagraphStyles[i];
+ QString name = style.numName();
+ if (numerations.contains(name))
+ numS = numerations.value(name);
+ else
+ {
+ numS = new NumStruct;
+ numS->m_name = name;
+ }
+ num.numFormat = (NumFormat) style.numFormat();
+ num.prefix = style.numPrefix();
+ num.suffix = style.numSuffix();
+ num.start = style.numStart();
+ int level = style.numLevel();
+ if (level >= numS->m_counters.count())
+ {
+ for (int i=numS->m_counters.count(); i <= level; ++i)
+ {
+ numS->m_nums.insert(i,num);
+ numS->m_counters.insert(i, 0);
+ }
+ }
+ numS->m_nums.replace(level, num);
+ numS->m_counters.replace(level, num.start -1);
+ numS->m_lastlevel = -1;
+ numerations.insert(numS->m_name, numS);
+ }
+ }
+
+ if (!numerations.contains("default"))
+ {
+ //create default numeration
+ numS = new NumStruct;
+ numS->m_name = "default";
+ Numeration newNum;
+ numS->m_nums.insert(0, newNum);
+ numS->m_counters.insert(0, 0);
+ numS->m_lastlevel = -1;
+ numerations.insert("default", numS);
+ }
+
+ flag_NumUpdateRequest = false;
+ if (orgNumNames != numerations.keys())
+ {
+ orgNumNames = numerations.keys();
+ flag_NumUpdateRequest = true;
+ }
+ flag_Renumber = true;
+}
+
+QString ScribusDoc::getNumberStr(QString numName, int level, bool reset, ParagraphStyle &style)
+{
+ Q_ASSERT(numerations.contains(numName));
+ NumStruct * numS = numerations.value(numName);
+ numS->m_lastlevel = level;
+
+ Numeration num = numS->m_nums[level];
+ num.numFormat = (NumFormat) style.numFormat();
+ num.start = style.numStart();
+ num.prefix = style.numPrefix();
+ num.suffix = style.numSuffix();
+ numS->m_nums.replace(level, num);
+
+ int currNum = numS->m_counters.at(level);
+ if (reset)
+ currNum = numS->m_nums[level].start -1;
+ ++currNum;
+ setNumerationCounter(numName, level, currNum);
+
+ QString result = QString();
+ for (int i=0; i <= level; ++i)
+ {
+ Numeration num = numS->m_nums[i];
+ result.append(num.prefix);
+ result.append(num.numString(numS->m_counters.at(i)));
+ result.append(num.suffix);
+ }
+ return result;
+}
+
+void ScribusDoc::setNumerationCounter(QString numName, int level, int number)
+{
+ NumStruct * numS = numerations.value(numName);
+ if (level > numS->m_counters.count())
+ numS->m_counters.insert(level, number);
+ else
+ numS->m_counters.replace(level, number);
+}
+
+bool ScribusDoc::updateLocalNums(StoryText& itemText)
+{
+ QList<Numeration> m_nums;
+ QList<int> m_counters;
+ bool needUpdate = false;
+ for (int pos = 0; pos < itemText.length(); ++pos)
+ {
+ if (pos != 0 && itemText.text(pos-1) != SpecialChars::PARSEP)
+ continue;
+ ScText* hl = itemText.item(pos);
+ if (hl->mark != NULL && hl->mark->isType(MARKBullNumType) && itemText.paragraphStyle(pos).hasNum())
+ {
+ ParagraphStyle style = itemText.paragraphStyle(pos);
+ if (style.numName() == "<local block>")
+ {
+ int level = style.numLevel();
+ while (m_counters.count() < (level + 1))
+ {
+ m_counters.append(0);
+ Numeration num((NumFormat) style.numFormat());
+ m_nums.append(num);
+ }
+ Numeration num = m_nums.at(level);
+ num.prefix = style.numPrefix();
+ num.suffix = style.numSuffix();
+ num.start = style.numStart();
+ num.numFormat = (NumFormat) style.numFormat();
+ m_nums.replace(level, num);
+ int count = m_counters.at(level);
+ bool reset = false;
+ if (pos == 0)
+ reset = true;
+ else if (pos > 0)
+ {
+ ParagraphStyle prevStyle;
+ prevStyle = itemText.paragraphStyle(pos -1);
+ reset = !prevStyle.hasNum()
+ || prevStyle.numName() != "<local block>"
+ || prevStyle.numLevel() < level
+ || prevStyle.numFormat() != style.numFormat();
+ }
+ if ((level == 0) && (style.numFormat() != (int) num.numFormat))
+ {
+ reset = true;
+ m_counters.clear();
+ m_counters.append(0);
+ m_nums.clear();
+ m_nums.append(num);
+ }
+ if (reset)
+ count = style.numStart();
+ else
+ count++;
+ m_counters.replace(level, count);
+ //m_nums.insert(level, num);
+ QString result = QString();
+ for (int i=0; i <= level; ++i)
+ {
+ result.append(m_nums.at(i).prefix);
+ result.append(getStringFromNum(m_nums.at(i).numFormat, m_counters.at(i)));
+ result.append(m_nums.at(i).suffix);
+ }
+ if (hl->mark->getString() != result)
+ {
+ hl->mark->setString(result);
+ needUpdate = true;
+ }
+ }
+ }
+ }
+ return needUpdate;
+}
+
+void ScribusDoc::updateNumbers(bool updateNumerations)
+{
+ if (updateNumerations)
+ //after styles change reset all numerations settings
+ setupNumerations();
+ //reset ALL counters
+ foreach (NumStruct * numS, numerations.values())
+ for (int l = 0; l < numS->m_nums.count(); ++l)
+ numS->m_counters[l] = numS->m_nums[l].start -1;
+
+ flag_Renumber = false;
+ //renumbering for doc, sections, page and frame range
+ for (int sec = 0; sec < sections().count(); ++sec)
+ {
+ //reset section range counters
+ foreach (NumStruct * numS, numerations.values())
+ for (int l = 0; l < numS->m_nums.count(); ++l)
+ if (numS->m_nums[l].range == NSRsection)
+ numS->m_counters[l] = numS->m_nums[l].start -1;
+
+ int start = sections().value(sec).fromindex;
+ int stop = sections().value(sec).toindex;
+ for (int page = start; page <= stop; ++page)
+ {
+ //reset page range counters
+ foreach (NumStruct * numS, numerations.values())
+ for (int l = 0; l < numS->m_nums.count(); ++l)
+ if (numS->m_nums[l].range == NSRpage)
+ numS->m_counters[l] = numS->m_nums[l].start -1;
+ for (int i=0; i < DocItems.count(); ++i)
+ {
+ PageItem* item = DocItems.at(i);
+ if (item->OwnPage != page)
+ continue;
+ if (!item->isTextFrame())
+ continue;
+ if (item->invalid)
+ continue;
+
+ //reset items and stories range counters
+ foreach (NumStruct * numS, numerations.values())
+ for (int l = 0; l < numS->m_nums.count(); ++l)
+ if ((numS->m_nums[l].range == NSRframe) || ((numS->m_nums[l].range == NSRstory) && (item->prevInChain() == NULL)))
+ numS->m_counters[l] = numS->m_nums[l].start -1;
+
+ int pos = item->firstInFrame();
+ if ((pos != 0) && (item->itemText.text(pos-1) != SpecialChars::PARSEP))
+ pos = item->itemText.nextParagraph(pos)+1;
+ int last = item->lastInFrame();
+ int len = item->itemText.length();
+ while (pos <= last)
+ {
+ if ((pos == 0) || (item->itemText.text(pos - 1) == SpecialChars::PARSEP))
+ {
+ ParagraphStyle style = item->itemText.paragraphStyle(pos);
+ if (style.hasNum() && style.numName() != "<local block>")
+ {
+ if (!numerations.contains(style.numName()))
+ {
+ ParagraphStyle newStyle;
+ newStyle.setNumName("<local block>");
+ Selection tempSelection(this, false);
+ tempSelection.addItem(item, true);
+ itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+ continue;
+ }
+ ScText * hl = item->itemText.item(pos);
+ bool resetNums = false;
+ if (numerations.value(style.numName())->m_lastlevel == -1)
+ resetNums = true;
+ else if (style.numOther())
+ {
+ ParagraphStyle preStyle = item->itemText.paragraphStyle(pos -1);
+ //reset counter if prev style hasnt numeration or has other numeration
+ if (!preStyle.hasNum() || (preStyle.numName() != style.numName()))
+ resetNums = true;
+ }
+ else if (style.numHigher() && (style.numLevel() > numerations.value(style.numName())->m_lastlevel))
+ resetNums = true;
+
+ QString prefixStr = getNumberStr(style.numName(), style.numLevel(), resetNums, style);
+ numerations.value(style.numName())->m_lastlevel = style.numLevel();
+ if (hl->mark == NULL)
+ {
+ BulNumMark* bnMark = new BulNumMark;
+ item->itemText.insertMark(bnMark,pos);
+ hl = item->itemText.item(pos);
+ hl->applyCharStyle(item->itemText.paragraphStyle(pos).charStyle());
+ hl->setEffects(ScStyle_Default);
+ const StyleContext* cStyleContext = item->itemText.paragraphStyle(pos).charStyleContext();
+ hl->setContext(cStyleContext);
+ }
+ if (hl->mark->getString() != prefixStr)
+ {
+ hl->mark->setString(prefixStr);
+ item->invalid = true;
+ flag_Renumber = true;
+ }
+ }
+ if (pos == last)
+ break;
+ if (item->itemText.text(pos) == SpecialChars::PARSEP)
+ ++pos;
+ else
+ {
+ pos = item->itemText.nextParagraph(pos)+1;
+ if (pos == len)
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //update local numbering
+ foreach (PageItem* item, DocItems)
+ {
+ if (item->itemText.length() > 0)
+ {
+ PageItem* itemFirst = item->firstInChain();
+ if (updateLocalNums(itemFirst->itemText))
+ {
+ if (itemFirst->isTextFrame())
+ itemFirst->asTextFrame()->invalidateLayout(true);
+ else
+ itemFirst->invalidateLayout();
+ }
+ }
+ }
+
}
QStringList ScribusDoc::marksLabelsList(MarkType type)
@@ -17051,7 +17464,7 @@
{
PageItem* mItem = findFirstMarkItem(mrk);
mrk->OwnPage =(mItem != NULL) ? mItem->OwnPage : -1;
- mrk->setItemName((mItem != NULL) ? mItem->itemName() : "");
+ mrk->setItemName((mItem != NULL) ? mItem->itemName() : QString(""));
}
}
}
@@ -17241,7 +17654,7 @@
ss->set("name", NS->name());
ss->set("start", NS->start());
ss->set("endNotes", NS->isEndNotes());
- ss->set("numStyle", (int) NS->getType());
+ ss->set("numFormat", (int) NS->getType());
ss->set("range", (int) NS->range());
ss->set("prefix", NS->prefix());
ss->set("suffix", NS->suffix());
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sat Jan 5 09:26:28 2013
@@ -41,6 +41,7 @@
#include "scribusapi.h"
#include "colormgmt/sccolormgmtengine.h"
#include "documentinformation.h"
+#include "numeration.h"
#include "marks.h"
#include "notesstyles.h"
#include "observable.h"
@@ -938,7 +939,7 @@
* @brief Add a section to the document sections list
* Set number to -1 to add in the default section if the map is empty
*/
- void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const DocumentSectionType type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true, const QChar fillChar=QChar(), int fieldWidth=0);
+ void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const NumFormat type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true, const QChar fillChar=QChar(), int fieldWidth=0);
/**
* @brief Delete a section from the document sections list
*/
@@ -1773,6 +1774,19 @@
void itemSelection_EditWeld();
void restartAutoSaveTimer();
+//auto-numerations
+public:
+ QMap<QString, NumStruct*> numerations;
+ QStringList orgNumNames; //orgNumerations keeps original settings read from paragraph styles for reset settings overrided localy
+ void setupNumerations(); //read styles for used auto-numerations, initialize numCounters
+ QString getNumberStr(QString numName, int level, bool reset, ParagraphStyle &style);
+ void setNumerationCounter(QString numName, int level, int number);
+ bool flag_Renumber;
+ bool flag_NumUpdateRequest;
+ // for local numeration of paragraphs
+ bool updateLocalNums(StoryText& itemText); //return true if any num strings were updated and item need s invalidation
+ void updateNumbers(bool updateNumerations = false);
+ void itemSelection_ClearBulNumStrings(Selection *customSelection);
/* Functions for PDF Form Actions */
public:
Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Sat Jan 5 09:26:28 2013
@@ -147,6 +147,20 @@
{
return !(*this == other);
}
+};
+
+struct Bullet //used by style reader while importing ODT files
+{
+ QString name;
+ QString charStr;
+ double indent;
+ double firstLineIndent;
+ double tabPosition;
+ CharStyle* style;
+ Bullet() : name(""), charStr(""), indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(NULL) {}
+ Bullet(QString n, QString ch) : name(n), charStr(ch), indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(NULL) {}
+ Bullet(QString n, QString ch, double first, double ind, double tab, CharStyle* chStyle)
+ { name = n; charStr = ch, firstLineIndent = first; indent = ind; tabPosition = tab; style = chStyle; }
};
struct ArrowDesc
@@ -348,6 +362,7 @@
reqCustomShapeUpdate = 1024,
reqInlinePalUpdate = 2048,
reqMarksUpdate = 4096,
+ reqNumUpdate = 8192,
reqUpdateAll = 65535
};
Modified: trunk/Scribus/scribus/styles/charstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/styles/charstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/charstyle.cpp (original)
+++ trunk/Scribus/scribus/styles/charstyle.cpp Sat Jan 5 09:26:28 2013
@@ -148,7 +148,7 @@
bool CharStyle::equiv(const Style & other) const
{
other.validate();
- const CharStyle * oth = dynamic_cast<const CharStyle*> ( & other );
+ const CharStyle * oth = reinterpret_cast<const CharStyle*> ( & other );
return oth &&
parent() == oth->parent()
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
@@ -267,7 +267,7 @@
void CharStyle::updateFeatures()
{
m_Effects &= ~ScStyle_UserStyles;
- runFeatures(m_Features, dynamic_cast<const CharStyle*>(parentStyle()));
+ runFeatures(m_Features, reinterpret_cast<const CharStyle*>(parentStyle()));
/* need to access global fontlist :-/
if (!font().name().endsWith(fontVariant()))
{
@@ -280,13 +280,14 @@
void CharStyle::runFeatures(const QStringList& featureList, const CharStyle* parent)
{
QStringList::ConstIterator it;
- for (it = featureList.begin(); it != featureList.end(); ++it)
+ QStringList::ConstIterator itEnd = featureList.end();
+ for (it = featureList.begin(); it != itEnd; ++it)
{
QString feature = it->trimmed();
if (feature == INHERIT)
{
if (parent)
- runFeatures(parent->features(), dynamic_cast<const CharStyle*>(parent->parentStyle()));
+ runFeatures(parent->features(), reinterpret_cast<const CharStyle*>(parent->parentStyle()));
continue;
}
int set = feature.startsWith('-') ? 0 : 1;
@@ -294,15 +295,16 @@
if (invert)
feature = feature.mid(1);
- if (feature == BOLD)
- {
- // (de)select bolder font
- }
- else if (feature == ITALIC)
- {
- // (de)select italic font
- }
- else if (feature == UNDERLINE)
+// if (feature == BOLD)
+// {
+// // (de)select bolder font
+// }
+// else if (feature == ITALIC)
+// {
+// // (de)select italic font
+// }
+// else
+ if (feature == UNDERLINE)
{
m_Effects &= ~(invert * ScStyle_Underline);
m_Effects |= set * ScStyle_Underline;
Modified: trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
==============================================================================
--- trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx (original)
+++ trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx Sat Jan 5 09:26:28 2013
@@ -31,13 +31,26 @@
ATTRDEF(double, gapBefore, GapBefore, 0.0)
ATTRDEF(double, gapAfter, GapAfter, 0.0)
ATTRDEF(QList<TabRecord>, tabValues, TabValues, QList<TabRecord>())
-ATTRDEF(int, dropCapLines, DropCapLines, 0)
-ATTRDEF(bool, hasDropCap, HasDropCap, false)
-ATTRDEF(double, dropCapOffset, DropCapOffset, 0.0)
ATTRDEF(bool, useBaselineGrid, UseBaselineGrid, false)
ATTRDEF(int, keepLinesStart, KeepLinesStart, 0)
ATTRDEF(int, keepLinesEnd, KeepLinesEnd, 0)
ATTRDEF(bool, keepWithNext, KeepWithNext, false)
ATTRDEF(bool, keepTogether, KeepTogether, false)
-ATTRDEF(QString, dcCharStyleName, DcCharStyleName,"")
+ATTRDEF(bool, hasDropCap, HasDropCap, false)
+ATTRDEF(int, dropCapLines, DropCapLines, 2)
+ATTRDEF(double, parEffectOffset, ParEffectOffset, 0.0)
+ATTRDEF(bool, parEffectIndent, ParEffectIndent, false)
+ATTRDEF(QString, peCharStyleName, PeCharStyleName,"")
+ATTRDEF(bool, hasBullet, HasBullet, false)
+ATTRDEF(QString, bulletStr, BulletStr, QString(QChar(0x2022)))
+ATTRDEF(bool, hasNum, HasNum, false)
+ATTRDEF(QString, numName, NumName, "")
+ATTRDEF(int, numFormat, NumFormat, 0)
+ATTRDEF(QString, numPrefix, NumPrefix, "")
+ATTRDEF(QString, numSuffix, NumSuffix, ".")
+ATTRDEF(int, numLevel, NumLevel, 0)
+ATTRDEF(int, numStart, NumStart, 1)
+ATTRDEF(int, numRestart, NumRestart, 0)
+ATTRDEF(bool, numOther, NumOther, false)
+ATTRDEF(bool, numHigher, NumHigher, true)
Modified: trunk/Scribus/scribus/styles/paragraphstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/styles/paragraphstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/paragraphstyle.cpp (original)
+++ trunk/Scribus/scribus/styles/paragraphstyle.cpp Sat Jan 5 09:26:28 2013
@@ -81,7 +81,7 @@
bool ParagraphStyle::equiv(const Style& other) const
{
other.validate();
- const ParagraphStyle* oth = dynamic_cast<const ParagraphStyle*> ( & other );
+ const ParagraphStyle* oth = reinterpret_cast<const ParagraphStyle*> ( & other );
return oth &&
parent() == oth->parent() && cstyle.equiv(oth->charStyle())
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
@@ -123,7 +123,7 @@
if (cstyleContextIsInh)
{
- const ParagraphStyle * parent = dynamic_cast<const ParagraphStyle*> ( parentStyle() );
+ const ParagraphStyle * parent = reinterpret_cast<const ParagraphStyle*> ( parentStyle() );
cstyle.setContext(parent ? parent->charStyleContext() : NULL);
}
else
@@ -150,7 +150,7 @@
void ParagraphStyle::repairImplicitCharStyleInheritance()
{
if (cstyleContextIsInh) {
- const ParagraphStyle * newParent = dynamic_cast<const ParagraphStyle*> ( parentStyle() );
+ const ParagraphStyle * newParent = reinterpret_cast<const ParagraphStyle*> ( parentStyle() );
cstyle.setContext(newParent ? newParent->charStyleContext() : NULL);
}
}
@@ -172,7 +172,7 @@
cstyle.validate();
cstyleContext.invalidate();
- const ParagraphStyle * oth = dynamic_cast<const ParagraphStyle*> ( parentStyle() );
+ const ParagraphStyle * oth = reinterpret_cast<const ParagraphStyle*> ( parentStyle() );
// qDebug() << QString("ParagraphStyle::update(%1) parent=%2").arg((unsigned long int)context).arg((unsigned long int)oth);
if (oth) {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
@@ -248,6 +248,8 @@
setParent(it.value());
repairImplicitCharStyleInheritance();
}
+ if ((it = (newNames.charStyles().find(peCharStyleName()))) != newNames.charStyles().end())
+ setPeCharStyleName(it.value());
cstyle.replaceNamedResources(newNames);
}
Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Sat Jan 5 09:26:28 2013
@@ -1939,11 +1939,32 @@
{
Mark* mrk = mark(i);
if ((doc->m_Selection->itemAt(0)->isNoteFrame() && mrk->isType(MARKNoteMasterType))
- || (!doc->m_Selection->itemAt(0)->isTextFrame() && mrk->isType(MARKNoteFrameType)))
+ || (!doc->m_Selection->itemAt(0)->isTextFrame() && mrk->isType(MARKNoteFrameType))
+ || mrk->isType(MARKBullNumType))
continue; //do not insert notes marks into text frames nad vice versa
Xml_attr mark_attr;
mark_attr.insert("label", mrk->label);
mark_attr.insert("typ", QString::number((int )mrk->getType()));
+// if (!mrk->isType(MARKBullNumType))
+// {
+// mark_attr.insert("strtxt", mrk->getString());
+// ParagraphStyle pstyle = this->paragraphStyle(i);
+// mark_attr.insert("style_peoffset", QString::number(pstyle.parEffectOffset(),'f',2));
+// mark_attr.insert("style_peindent", QString::number(pstyle.parEffectIndent(),'f',2));
+// mark_attr.insert("style_pecharstyle", pstyle.peCharStyleName());
+// mark_attr.insert("style_hasbul", pstyle.hasBullet() ? "1" : "0");
+// mark_attr.insert("style_bulletstr", pstyle.bulletStr());
+// mark_attr.insert("style_hasnum", pstyle.hasNum() ? "1" : "0");
+// mark_attr.insert("style_numname", pstyle.numName());
+// mark_attr.insert("style_numformat", QString::number( (int)pstyle.numFormat()));
+// mark_attr.insert("style_numprefix", pstyle.numPrefix());
+// mark_attr.insert("style_numsuffix", pstyle.numSuffix());
+// mark_attr.insert("style_numlevel", QString::number(pstyle.numLevel()));
+// mark_attr.insert("style_numstart", QString::number(pstyle.numStart()));
+// mark_attr.insert("style_numrestart", QString::number((int) pstyle.numRestart()));
+// mark_attr.insert("style_numother", pstyle.numOther() ? "1" : "0");
+// mark_attr.insert("style_numhigher", pstyle.numHigher() ? "1" : "0");
+// }
if (mrk->isType(MARK2ItemType) && (mrk->getItemPtr() != NULL))
mark_attr.insert("item", mrk->getItemPtr()->itemName());
else if (mrk->isType(MARK2MarkType))
@@ -2145,69 +2166,136 @@
{
Xml_attr::iterator lIt = attr.find("label");
Xml_attr::iterator tIt = attr.find("typ");
- Xml_attr::iterator iIt = attr.find("item");
- Xml_attr::iterator m_lIt = attr.find("mark_l");
- Xml_attr::iterator m_tIt = attr.find("mark_t");
- Xml_attr::iterator nf_It = attr.find("noteframe");
+ // Xml_attr::iterator nf_It = attr.find("noteframe");
if (lIt != attr.end())
l = Xml_data(lIt);
if (tIt != attr.end())
t = (MarkType) parseInt(Xml_data(tIt));
- ScribusDoc* doc = this->dig->lookup<ScribusDoc>("<scribusdoc>");
- if (t == MARKVariableTextType)
- mrk = doc->getMarkDefinied(l,t);
- else
+ if (t != MARKBullNumType)
{
- mrk = doc->newMark();
- getUniqueName(l,doc->marksLabelsList(t), "_");
- mrk->label = l;
- mrk->OwnPage = doc->currentPage()->pageNr();
- mrk->setType(t);
- if (mrk->isType(MARK2ItemType) && (iIt != attr.end()))
+ ScribusDoc* doc = this->dig->lookup<ScribusDoc>("<scribusdoc>");
+ // ParagraphStyle* pstyle = NULL;
+ if (t == MARKVariableTextType)
+ mrk = doc->getMarkDefinied(l,t);
+ // else if (t == MARKBullNumType)
+ // {
+ // mrk = (Mark*) new BulNumMark();
+ // Xml_attr::iterator str_It = attr.find("strtxt");
+ // mrk->setString(Xml_data(str_It));
+ // pstyle = new ParagraphStyle();
+ // Xml_attr::iterator ite;
+ // ite = attr.find("style_peoffset");
+ // if (ite != attr.end())
+ // pstyle->setParEffectOffset(parseDouble(Xml_data(ite)));
+ // ite = attr.find("style_peindent");
+ // if (ite != attr.end())
+ // pstyle->setParEffectIndent(parseDouble(Xml_data(ite)));
+ // ite = attr.find("style_pecharstyle");
+ // if (ite != attr.end())
+ // pstyle->setPeCharStyleName(Xml_data(ite));
+ // ite = attr.find("style_hasbul");
+ // if (ite != attr.end())
+ // pstyle->setHasBullet(parseInt(Xml_data(ite)) == 1);
+ // ite = attr.find("style_bulletstr");
+ // if (ite != attr.end())
+ // pstyle->setBulletStr(Xml_data(ite));
+ // ite = attr.find("style_hasnum");
+ // if (ite != attr.end())
+ // pstyle->setHasNum(parseInt(Xml_data(ite)) == 1);
+ // ite = attr.find("style_numname");
+ // if (ite != attr.end())
+ // pstyle->setNumName(Xml_data(ite));
+ // ite = attr.find("style_numformat");
+ // if (ite != attr.end())
+ // pstyle->setNumFormat(parseInt(Xml_data(ite)));
+ // ite = attr.find("style_numprefix");
+ // if (ite != attr.end())
+ // pstyle->setNumPrefix(Xml_data(ite));
+ // ite = attr.find("style_numsuffix");
+ // if (ite != attr.end())
+ // pstyle->setNumSuffix(Xml_data(ite));
+ // ite = attr.find("style_numlevel");
+ // if (ite != attr.end())
+ // pstyle->setNumLevel(parseInt(Xml_data(ite)));
+ // ite = attr.find("style_numstart");
+ // if (ite != attr.end())
+ // pstyle->setNumStart(parseInt(Xml_data(ite)));
+ // ite = attr.find("style_numrestart");
+ // if (ite != attr.end())
+ // pstyle->setNumRestart(parseInt(Xml_data(ite)));
+ // ite = attr.find("style_numother");
+ // if (ite != attr.end())
+ // pstyle->setNumOther(parseInt(Xml_data(ite)) == 1);
+ // ite = attr.find("style_numhigher");
+ // if (ite != attr.end())
+ // pstyle->setNumHigher(parseInt(Xml_data(ite)) == 1);
+ // }
+ else
{
- PageItem* item = doc->getItemFromName(Xml_data(iIt));
- mrk->setItemPtr(item);
- if (item == NULL)
- mrk->setString("0");
- else
- mrk->setString(QString::number(item->OwnPage));
- mrk->setItemName(Xml_data(iIt));
+ mrk = doc->newMark();
+ getUniqueName(l,doc->marksLabelsList(t), "_");
+ mrk->label = l;
+ mrk->OwnPage = doc->currentPage()->pageNr();
+ mrk->setType(t);
+ Xml_attr::iterator iIt = attr.find("item");
+ Xml_attr::iterator m_lIt = attr.find("mark_l");
+ Xml_attr::iterator m_tIt = attr.find("mark_t");
+ if (mrk->isType(MARK2ItemType) && (iIt != attr.end()))
+ {
+ PageItem* item = doc->getItemFromName(Xml_data(iIt));
+ mrk->setItemPtr(item);
+ if (item == NULL)
+ mrk->setString("0");
+ else
+ mrk->setString(QString::number(item->OwnPage));
+ mrk->setItemName(Xml_data(iIt));
+ }
+ if (mrk->isType(MARK2MarkType) && (m_lIt != attr.end()) && (m_tIt != attr.end()))
+ {
+ Mark* targetMark = doc->getMarkDefinied(Xml_data(m_lIt), (MarkType) parseInt(Xml_data(m_tIt)));
+ mrk->setMark(targetMark);
+ if (targetMark == NULL)
+ mrk->setString("0");
+ else
+ mrk->setString(QString::number(targetMark->OwnPage));
+ mrk->setItemName(Xml_data(m_lIt));
+ }
+ if (mrk->isType(MARKNoteMasterType))
+ {
+ Xml_attr::iterator nIt = attr.find("note");
+ Xml_attr::iterator nsIt = attr.find("nStyle");
+ NotesStyle* NS;
+ if (nsIt == attr.end())
+ NS = doc->m_docNotesStylesList.at(0);
+ else
+ NS = doc->getNotesStyle(Xml_data(nsIt));
+ TextNote* note = doc->newNote(NS);
+ note->setMasterMark(mrk);
+ if (nIt != attr.end())
+ note->setSaxedText(Xml_data(nIt));
+ // if (!NS->isAutoRemoveEmptyNotesFrames() && (nf_It != attr.end()))
+ // {
+ // PageItem_NoteFrame* nF = (PageItem_NoteFrame*) doc->getItemFromName(Xml_data(nf_It));
+ // if (nF != NULL)
+ // doc->m_Selection->itemAt(0)->asTextFrame()->setNoteFrame(nF);
+ // }
+ mrk->setNotePtr(note);
+ doc->setNotesChanged(true);
+ }
+ doc->newMark(mrk);
}
- if (mrk->isType(MARK2MarkType) && (m_lIt != attr.end()) && (m_tIt != attr.end()))
- {
- Mark* targetMark = doc->getMarkDefinied(Xml_data(m_lIt), (MarkType) parseInt(Xml_data(m_tIt)));
- mrk->setMark(targetMark);
- if (targetMark == NULL)
- mrk->setString("0");
- else
- mrk->setString(QString::number(targetMark->OwnPage));
- mrk->setItemName(Xml_data(m_lIt));
- }
- if (mrk->isType(MARKNoteMasterType))
- {
- Xml_attr::iterator nIt = attr.find("note");
- Xml_attr::iterator nsIt = attr.find("nStyle");
- NotesStyle* NS;
- if (nsIt == attr.end())
- NS = doc->m_docNotesStylesList.at(0);
- else
- NS = doc->getNotesStyle(Xml_data(nsIt));
- TextNote* note = doc->newNote(NS);
- note->setMasterMark(mrk);
- if (nIt != attr.end())
- note->setSaxedText(Xml_data(nIt));
-// if (!NS->isAutoRemoveEmptyNotesFrames() && (nf_It != attr.end()))
-// {
-// PageItem_NoteFrame* nF = (PageItem_NoteFrame*) doc->getItemFromName(Xml_data(nf_It));
-// if (nF != NULL)
-// doc->m_Selection->itemAt(0)->asTextFrame()->setNoteFrame(nF);
-// }
- mrk->setNotePtr(note);
- doc->setNotesChanged(true);
- }
- doc->newMark(mrk);
+ story->insertMark(mrk);
+ // if (pstyle != NULL)
+ // {
+ // int i = story->cursorPosition() -1;
+ // if (story->item(i)->parstyle == NULL) {
+ // story->item(i)->parstyle = new ParagraphStyle(*pstyle);
+ // story->item(i)->parstyle->setContext( &doc->paragraphStyles());
+ // }
+ // else
+ // story->item(i)->parstyle->applyStyle(*pstyle);
+ // }
}
- story->insertMark(mrk);
}
}
};
Modified: trunk/Scribus/scribus/ui/notesstyleseditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/notesstyleseditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/notesstyleseditor.cpp (original)
+++ trunk/Scribus/scribus/ui/notesstyleseditor.cpp Sat Jan 5 09:26:28 2013
@@ -314,7 +314,7 @@
ss->set("NEWname", NS->name());
ss->set("NEWstart", NS->start());
ss->set("NEWendNotes", NS->isEndNotes());
- ss->set("NEWnumStyle", (int) NS->getType());
+ ss->set("NEWnumFormat", (int) NS->getType());
ss->set("NEWrange", (int) NS->range());
ss->set("NEWprefix", NS->prefix());
ss->set("NEWsuffix", NS->suffix());
@@ -331,7 +331,7 @@
//invalidate all text frames with marks from current changed notes style
foreach (PageItem* item, m_Doc->DocItems)
{
- if (item->isTextFrame() && !item->isNoteFrame() && item->asTextFrame()->hasMark(NS))
+ if (item->isTextFrame() && !item->isNoteFrame() && item->asTextFrame()->hasNoteMark(NS))
item->invalid = true;
}
m_Doc->updateNotesNums(NS);
@@ -479,7 +479,7 @@
void NotesStylesEditor::on_NumberingBox_currentIndexChanged(int index)
{
NotesStyle ns = changesMap.value(NSlistBox->currentText());
- ns.setType((NumerationType) index);
+ ns.setType((NumFormat) index);
changesMap.insert(NSlistBox->currentText(), ns);
ApplyButton->setEnabled(true);
Modified: trunk/Scribus/scribus/ui/prefs_documentsections.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/prefs_documentsections.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_documentsections.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_documentsections.cpp Sat Jan 5 09:26:28 2013
@@ -148,7 +148,7 @@
{
int index=qcti->currentIndex();
if (index<styles.count()-1)
- localSections[row].type=(DocumentSectionType)index;
+ localSections[row].type=(NumFormat)index;
else
if (index==styles.count()-1)
localSections[row].type=Type_None;
Modified: trunk/Scribus/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.cpp Sat Jan 5 09:26:28 2013
@@ -20,7 +20,7 @@
#include "propertiespalette_utils.h"
#include "propertywidget_advanced.h"
#include "propertywidget_distance.h"
-#include "propertywidget_dropcap.h"
+#include "propertywidget_pareffect.h"
#include "propertywidget_flop.h"
#include "propertywidget_optmargins.h"
#include "propertywidget_orphans.h"
@@ -77,8 +77,8 @@
orphanBox = new PropertyWidget_Orphans(textTree);
orphanItem = textTree->addWidget( tr("Orphans and Widows"), orphanBox);
- dropcapsBox = new PropertyWidget_DropCap(textTree);
- dropcapsItem = textTree->addWidget( tr("Drop Cap"), dropcapsBox);
+ parEffectWidgets = new PropertyWidget_ParEffect(textTree);
+ parEffectItem = textTree->addWidget( tr("Paragraph Effects"), parEffectWidgets);
distanceWidgets = new PropertyWidget_Distance(textTree);
distanceItem = textTree->addWidget( tr("Columns && Text Distances"), distanceWidgets);
@@ -120,7 +120,7 @@
advancedWidgets->setMainWindow(mw);
colorWidgets->setMainWindow(mw);
distanceWidgets->setMainWindow(mw);
- dropcapsBox->setMainWindow(mw);
+ parEffectWidgets->setMainWindow(mw);
optMargins->setMainWindow(mw);
pathTextWidgets->setMainWindow(mw);
@@ -156,7 +156,7 @@
advancedWidgets->setDoc(m_doc);
colorWidgets->setDoc(m_doc);
distanceWidgets->setDoc(m_doc);
- dropcapsBox->setDoc(m_doc);
+ parEffectWidgets->setDoc(m_doc);
flopBox->setDoc(m_doc);
optMargins->setDoc(m_doc);
orphanBox->setDoc(m_doc);
@@ -192,7 +192,7 @@
flopBox->setDoc(0);
optMargins->setDoc(0);
orphanBox->setDoc(0);
- dropcapsBox->setDoc(0);
+ parEffectWidgets->setDoc(0);
pathTextWidgets->setDoc(0);
m_haveItem = false;
@@ -276,7 +276,7 @@
if (updateFlags & reqCharStylesUpdate)
{
charStyleCombo->updateFormatList();
- dropcapsBox->updateCharStyles();
+ parEffectWidgets->updateCharStyles();
}
if (updateFlags & reqParaStylesUpdate)
paraStyleCombo->updateFormatList();
@@ -288,7 +288,7 @@
{
paraStyleCombo->setDoc(m_haveDoc ? m_doc : 0);
charStyleCombo->setDoc(m_haveDoc ? m_doc : 0);
- dropcapsBox->setDoc(m_haveDoc ? m_doc : 0);
+ parEffectWidgets->setDoc(m_haveDoc ? m_doc : 0);
}
}
@@ -320,7 +320,7 @@
flopItem->setHidden(true);
distanceItem->setHidden(true);
orphanItem->setHidden(true);
- dropcapsItem->setHidden(true);
+ parEffectItem->setHidden(true);
pathTextItem->setHidden(false);
}
else if (m_item->asTextFrame() || m_item->asTable())
@@ -328,7 +328,7 @@
flopItem->setHidden(false);
distanceItem->setHidden(false);
orphanItem->setHidden(false);
- dropcapsItem->setHidden(false);
+ parEffectItem->setHidden(false);
pathTextItem->setHidden(true);
}
else
@@ -336,7 +336,7 @@
flopItem->setHidden(false);
distanceItem->setHidden(false);
orphanItem->setHidden(false);
- dropcapsItem->setHidden(false);
+ parEffectItem->setHidden(false);
pathTextItem->setHidden(true);
}
@@ -374,7 +374,7 @@
flopBox->unitChange();
optMargins->unitChange();
pathTextWidgets->unitChange();
- dropcapsBox->unitChange();
+ parEffectWidgets->unitChange();
m_haveItem = tmp;
}
@@ -496,7 +496,7 @@
colorWidgets->updateStyle(newCurrent);
optMargins->updateStyle(newCurrent);
orphanBox->updateStyle (newCurrent);
- dropcapsBox->updateStyle(newCurrent);
+ parEffectWidgets->updateStyle(newCurrent);
displayFontFace(charStyle.font().scName());
displayFontSize(charStyle.fontSize());
@@ -514,14 +514,14 @@
void PropertiesPalette_Text::updateCharStyles()
{
charStyleCombo->updateFormatList();
- dropcapsBox->updateCharStyles();
+ parEffectWidgets->updateCharStyles();
}
void PropertiesPalette_Text::updateParagraphStyles()
{
paraStyleCombo->updateFormatList();
charStyleCombo->updateFormatList();
- dropcapsBox->updateCharStyles();
+ parEffectWidgets->updateCharStyles();
}
void PropertiesPalette_Text::updateTextStyles()
@@ -643,6 +643,7 @@
{
Selection tempSelection(this, false);
tempSelection.addItem(i2, true);
+ m_doc->itemSelection_ClearBulNumStrings(&tempSelection);
m_doc->itemSelection_EraseParagraphStyle(&tempSelection);
CharStyle emptyCStyle;
m_doc->itemSelection_SetCharStyle(emptyCStyle, &tempSelection);
Modified: trunk/Scribus/scribus/ui/propertiespalette_text.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/propertiespalette_text.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.h Sat Jan 5 09:26:28 2013
@@ -25,7 +25,7 @@
class PageItem;
class PropertyWidget_Advanced;
class PropertyWidget_Distance;
-class PropertyWidget_DropCap;
+class PropertyWidget_ParEffect;
class PropertyWidget_Flop;
class PropertyWidget_OptMargins;
class PropertyWidget_Orphans;
@@ -134,8 +134,8 @@
PropertyWidget_Orphans* orphanBox;
QTreeWidgetItem* orphanItem;
- PropertyWidget_DropCap* dropcapsBox;
- QTreeWidgetItem* dropcapsItem;
+ PropertyWidget_ParEffect* parEffectWidgets;
+ QTreeWidgetItem* parEffectItem;
PropertyWidget_PathText* pathTextWidgets;
QTreeWidgetItem* pathTextItem;
Modified: trunk/Scribus/scribus/ui/smpstylewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/smpstylewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.cpp Sat Jan 5 09:26:28 2013
@@ -7,11 +7,13 @@
#include <QEvent>
+#include "numeration.h"
#include "smpstylewidget.h"
+#include "scribus.h"
#include "units.h"
#include "util.h"
#include "util_icon.h"
-
+#include "ui/charselectenhanced.h"
static bool isEqual(double a, double b)
{
@@ -22,8 +24,9 @@
}
-SMPStyleWidget::SMPStyleWidget() : QWidget()
-{
+SMPStyleWidget::SMPStyleWidget(ScribusDoc* doc) : QWidget()
+{
+ m_Doc = doc;
setupUi(this);
//Not used yet
// optMarginCheckLeftProtruding->setVisible(false);
@@ -47,14 +50,27 @@
// optMarginCombo->addItem(tr("Right Hanging Punctuation"), ParagraphStyle::OM_RightHangingPunct);
// optMarginCombo->addItem(tr("Default"), ParagraphStyle::OM_Default);
- dropCapOffset_->setSuffix(unitGetSuffixFromIndex(0));
-
+ parEffectOffset_->setSuffix(unitGetSuffixFromIndex(0));
+
+ fillBulletStrEditCombo();
+ bulletCharTableButton_->setIcon(loadIcon("22/insert-table.png"));
+ fillNumFormatCombo();
+ numStartSpin->setMinimum(1);
+ numStartSpin->setMaximum(9999);
+ numLevelSpin->setMinimum(1);
+ numLevelSpin->setMaximum(1);
+ fillNumRestartCombo();
+ dropCapLines_->setMinimum(2);
+ dropCapLines_->setMaximum(99);
+
minSpaceSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT));
minGlyphExtSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT));
maxGlyphExtSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT));
connect(optMarginDefaultButton, SIGNAL(clicked()), this, SLOT(slotDefaultOpticalMargins()));
-
+ if (m_Doc)
+ connect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int)));
+ m_enhanced = NULL;
}
void SMPStyleWidget::slotLineSpacingModeChanged(int i)
@@ -92,8 +108,10 @@
//CB Unneeded, gets in the way of single widget tooltips
//dropCapsBox->setToolTip( tr("Enable or disable drop cap"));
dropCapLines_->setToolTip( tr("Drop Cap Lines"));
- dropCapOffset_->setToolTip( tr("Drop Cap Offset"));
- dropCapCharStyleCombo->setToolTip("<qt>" + tr("Choose chracter style or leave blank for use default paragraph style"));
+ bulletCharTableButton_->setToolTip(tr("Enhanced Char Table for inserting customs chars as bullets"));
+ parEffectOffset_->setToolTip( tr("Paragraph Effects Chars Offset"));
+ parEffectIndentBox->setToolTip( tr("Hang Paragraph Effect before paragraph indent"));
+ parEffectCharStyleCombo->setToolTip("<qt>" + tr("Choose chracter style or leave blank for use default paragraph style"));
alignement_->setToolTip( tr("Alignment"));
tabList_->first_->setToolTip( tr("First Line Indent"));
tabList_->left_->setToolTip( tr("Left Indent"));
@@ -114,7 +132,6 @@
keepLabelEnd->setToolTip (keepLinesEnd->toolTip());
keepTogether->setToolTip ("<qt>" + tr ("If checked, ensures that the paragraph won't be split across multiple pages or columns") + "</qt>");
keepWithNext->setToolTip ("<qt>" + tr ("If checked, automatically moves the paragraph to the next column or page if the next paragraph isn't on the same page or column") + "</qt>");
-
/***********************************/
/* End Tooltips */
@@ -135,14 +152,39 @@
//
// optMarginLabel->setText(tr("Optical Margins:"));
- dropCapsLineLabel->setText( tr("Lines:"));
- distFromTextLabel->setText( tr("Distance from Text:"));
lineSpacing_->setSuffix(unitGetSuffixFromIndex(0));
spaceAbove_->setSuffix(unitGetSuffixFromIndex(0));
spaceBelow_->setSuffix(unitGetSuffixFromIndex(0));
parentLabel->setText( tr("Based On:"));
distancesBox->setTitle( tr("Distances and Alignment"));
+
+ parEffectsBox->setTitle(tr("Paragraph Effects"));
dropCapsBox->setTitle( tr("Drop Caps"));
+ bulletBox->setTitle(tr("Bullets"));
+ numBox->setTitle(tr("Numeration"));
+ dropCapsLineLabel->setText( tr("Lines:"));
+ bulletCharLabel->setText(tr("Bullet Char/String"));
+ bulletCharTableButton_->setText(tr("Char Table"));
+ numFormatLabel->setText(tr("Numbering Style"));
+ numLevelLabel->setText(tr("Level"));
+ numPrefixLabel->setText(tr("Prefix"));
+ numSuffixLabel->setText(tr("Suffix"));
+ numStartLabel->setText(tr("Start with"));
+ numRestartOtherBox->setText(tr("Restart after other format"));
+ numRestartHigherBox->setText(tr("Restart after higher level"));
+
+ parEffectCharStyleComboLabel->setText(tr("Character Style for Effect:"));
+ distFromTextLabel->setText(tr("Distance from Text:"));
+ parentParEffectsButton->setText(tr("Use Parent`s Values"));
+
+ QFont font1;
+ if (font1.pointSize())
+ font1.setPointSize(font1.pointSize() *2);
+ else if (font1.pixelSize())
+ font1.setPixelSize(font1.pixelSize() *2);
+ ((QComboBox*) bulletStrEdit_)->setFont(font1);
+ (bulletStrEdit_->lineEdit())->setFont(font1);
+
tabsBox->setTitle( tr("Tabulators and Indentation"));
tabWidget->setTabText(0, tr("Properties"));
tabWidget->setTabText(1, tr("Character Style"));
@@ -165,12 +207,74 @@
void SMPStyleWidget::unitChange(double oldRatio, double newRatio, int unitIndex)
{
- dropCapOffset_->setNewUnit(unitIndex);
+ parEffectOffset_->setNewUnit(unitIndex);
tabList_->unitChange(unitIndex);
}
+void SMPStyleWidget::setDoc(ScribusDoc *doc)
+{
+ if (m_Doc)
+ disconnect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int)));
+ m_Doc = doc;
+ if (m_Doc)
+ {
+ connect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int)));
+ fillNumerationsCombo();
+ }
+}
+
+void SMPStyleWidget::fillBulletStrEditCombo()
+{
+ bulletStrEdit_->clear();
+ bulletStrEdit_->addItem(QChar(0x2022));
+ bulletStrEdit_->addItem("*");
+ bulletStrEdit_->addItem(QChar(0x2013));
+ bulletStrEdit_->setMinimumWidth(50);
+ if (bulletStrEdit_->currentText().isEmpty())
+ bulletStrEdit_->setEditText(QChar(0x2022));
+}
+
+void SMPStyleWidget::fillNumFormatCombo()
+{
+ numFormatCombo->clear();
+ numFormatCombo->addItems(getFormatList());
+}
+
+void SMPStyleWidget::fillNumerationsCombo()
+{
+ QStringList numNames;
+ foreach (QString numName, m_Doc->numerations.keys())
+ numNames.append(numName);
+ numNames.sort();
+ numComboBox->clear();
+ numComboBox->insertItems(0, numNames);
+ numComboBox->setCurrentItem(0);
+}
+
+void SMPStyleWidget::fillNumRestartCombo()
+{
+ numRestartCombo->clear();
+ numRestartCombo->addItem(tr("Document"));
+ numRestartCombo->addItem(tr("Section"));
+ numRestartCombo->addItem(tr("Story"));
+ numRestartCombo->addItem(tr("Page"));
+ numRestartCombo->addItem(tr("Frame"));
+}
+
+void SMPStyleWidget::checkParEffectState()
+{
+ bool enable = false;
+ if (dropCapsBox->isChecked() || bulletBox->isChecked() || numBox->isChecked())
+ enable = true;
+
+ parEffectCharStyleCombo->setEnabled(enable);
+ parEffectOffset_->setEnabled(enable);
+ parEffectIndentBox->setEnabled(enable);
+}
+
void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang)
{
+ currPStyle = pstyle;
double unitRatio = unitGetRatioFromIndex(unitIndex);
parentCombo->setEnabled(!pstyle->isDefaultStyle());
const ParagraphStyle *parent = dynamic_cast<const ParagraphStyle*>(pstyle->parentStyle());
@@ -194,6 +298,10 @@
minGlyphExtSpin->setRange(90.0,100.0);
maxGlyphExtSpin->setRange(100.0,110.0);
+ //fillBulletStrEditCombo();
+ //fillNumFormatCombo();
+ //fillNumerationsCombo();
+ //fillNumRestartCombo();
if (hasParent_)
{
@@ -221,20 +329,6 @@
spaceBelow_->setValue(pstyle->gapAfter(), pstyle->isInhGapAfter());
spaceBelow_->setParentValue(parent->gapAfter());
- dropCapsBox->setChecked(pstyle->hasDropCap());;
- parentDropCap_ = parent->hasDropCap();
- if (pstyle->isInhHasDropCap())
- parentDropCapButton->hide();
- else
- parentDropCapButton->show();
-
- connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
-
- dropCapLines_->setValue(pstyle->dropCapLines(), pstyle->isInhDropCapLines());
- dropCapLines_->setParentValue(parent->dropCapLines());
-
- dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio, pstyle->isInhDropCapOffset());
- dropCapOffset_->setParentValue(parent->dropCapOffset() * unitRatio);
alignement_->setStyle(pstyle->alignment(), pstyle->isInhAlignment());
alignement_->setParentItem(parent->alignment());
@@ -266,6 +360,71 @@
keepLinesEnd->setParentValue (parent->keepLinesEnd());
keepTogether->setParentValue (parent->keepTogether());
keepWithNext->setParentValue (parent->keepWithNext());
+
+//Effects Gropup Box
+ parentDC_ = parent->hasDropCap();
+ parentBul_ = parent->hasBullet();
+ parentNum_ = parent->hasNum();
+ //parentParEffects_ = (parentDC_ || parentBul_ || parentNum_);
+ if (pstyle->isInhHasDropCap() && pstyle->isInhHasBullet() && pstyle->isInhHasNum())
+ {
+ parentParEffectsButton->hide();
+ disconnect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects()));
+ }
+ else
+ {
+ parentParEffectsButton->show();
+ QFont f(font());
+ f.setBold(true);
+ parentParEffectsButton->setFont(f);
+ }
+ connect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects()));
+
+ dropCapsBox->setChecked(pstyle->hasDropCap());
+ setWidgetBoldFont(dropCapsBox, !pstyle->isInhHasDropCap());
+ dropCapLines_->setValue(pstyle->dropCapLines(), pstyle->isInhDropCapLines());
+ dropCapLines_->setParentValue(parent->dropCapLines());
+
+ parEffectOffset_->setValue(pstyle->parEffectOffset() * unitRatio, pstyle->isInhParEffectOffset());
+ parEffectOffset_->setParentValue(parent->parEffectOffset() * unitRatio);
+ parEffectIndentBox->setChecked(pstyle->parEffectIndent(),pstyle->isInhParEffectIndent());
+ parEffectIndentBox->setParentValue(parent->parEffectIndent());
+
+ bulletBox->setChecked(pstyle->hasBullet());
+ setWidgetBoldFont(bulletBox, !pstyle->isInhHasBullet());
+ bulletStrEdit_->setEditText(pstyle->bulletStr());
+ setWidgetBoldFont(bulletCharLabel, !pstyle->isInhBulletStr());
+ numBox->setChecked(pstyle->hasNum());
+ setWidgetBoldFont(numBox, !pstyle->isInhHasNum());
+ QString numName = pstyle->numName();
+ if (numName.isEmpty())
+ numName = "default";
+ numComboBox->setCurrentItem(numComboBox->findText(numName), pstyle->isInhNumName());
+ if (!parent->numName().isEmpty())
+ numComboBox->setParentItem(numComboBox->findText(parent->numName()));
+ else
+ numComboBox->setParentItem(0);
+ numFormatCombo->setCurrentItem(pstyle->numFormat());
+ numFormatCombo->setParentItem(parent->numFormat());
+ numLevelSpin->setValue(pstyle->numLevel() +1, pstyle->isInhNumLevel());
+ NumStruct * numS = m_Doc->numerations.value(pstyle->numName());
+ if (numS)
+ numLevelSpin->setMaximum(numS->m_counters.count()+1);
+ else
+ numLevelSpin->setMaximum(1);
+ numLevelSpin->setParentValue(parent->numLevel()+1);
+ numPrefix->setText(pstyle->numPrefix());
+ setWidgetBoldFont(numPrefixLabel, !pstyle->isInhNumPrefix());
+ numSuffix->setText(pstyle->numSuffix());
+ setWidgetBoldFont(numSuffixLabel, !pstyle->isInhNumSuffix());
+ numStartSpin->setValue(pstyle->numStart(), pstyle->isInhNumStart());
+ numStartSpin->setParentValue(parent->numStart());
+ numRestartCombo->setCurrentItem(pstyle->numRestart(), pstyle->isInhNumRestart());
+ numRestartCombo->setParentItem(parent->numRestart());
+ numRestartOtherBox->setChecked(pstyle->numOther(), pstyle->isInhNumOther());
+ numRestartOtherBox->setParentValue(parent->numOther());
+ numRestartHigherBox->setChecked(pstyle->numHigher(), pstyle->isInhNumHigher());
+ numRestartHigherBox->setParentValue(parent->numHigher());
}
else
{
@@ -279,12 +438,41 @@
minSpaceSpin->setValue(pstyle->minWordTracking() * 100.0);
minGlyphExtSpin->setValue(pstyle->minGlyphExtension() * 100.0);
maxGlyphExtSpin->setValue(pstyle->maxGlyphExtension() * 100.0);
+
+ parEffectOffset_->setValue(pstyle->parEffectOffset() * unitRatio);
+ parEffectIndentBox->setChecked(pstyle->parEffectIndent());
+ parentParEffectsButton->hide();
+ disconnect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects()));
dropCapsBox->setChecked(pstyle->hasDropCap());
- parentDropCapButton->hide();
- disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
+ setWidgetBoldFont(dropCapsBox, false);
dropCapLines_->setValue(pstyle->dropCapLines());
- dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio);
- parentDropCapButton->hide();
+ bulletBox->setChecked(pstyle->hasBullet());
+ setWidgetBoldFont(bulletBox, false);
+ bulletStrEdit_->setEditText(pstyle->bulletStr());
+ setWidgetBoldFont(bulletCharLabel, false);
+ numBox->setChecked(pstyle->hasNum());
+ setWidgetBoldFont(numBox, false);
+ QString numName = pstyle->numName();
+ if (numName.isEmpty())
+ numName = "default";
+ numComboBox->setCurrentItem(numComboBox->findText(numName));
+ numNewLineEdit->clear();
+ numFormatCombo->setCurrentIndex(pstyle->numFormat());
+ numLevelSpin->setValue(pstyle->numLevel()+1);
+ NumStruct * numS = m_Doc->numerations.value(pstyle->numName());
+ if (numS)
+ numLevelSpin->setMaximum(numS->m_counters.count()+1);
+ else
+ numLevelSpin->setMaximum(1);
+ numPrefix->setText(pstyle->numPrefix());
+ setWidgetBoldFont(numPrefixLabel, false);
+ numSuffix->setText(pstyle->numSuffix());
+ setWidgetBoldFont(numSuffixLabel, false);
+ numStartSpin->setValue(pstyle->numStart());
+ numRestartCombo->setCurrentItem(pstyle->numRestart());
+ numRestartOtherBox->setChecked(pstyle->numOther());
+ numRestartHigherBox->setChecked(pstyle->numHigher());
+
alignement_->setStyle(pstyle->alignment());
tabList_->setTabs(pstyle->tabValues(), unitIndex);
tabList_->setLeftIndentValue(pstyle->leftMargin() * unitRatio);
@@ -299,17 +487,13 @@
lineSpacing_->setEnabled(pstyle->lineSpacingMode() == ParagraphStyle::FixedLineSpacing);
dropCapLines_->setEnabled(pstyle->hasDropCap());
- dropCapOffset_->setEnabled(pstyle->hasDropCap());
- dropCapCharStyleCombo->setEnabled(pstyle->hasDropCap());
- dropCapCharStyleCombo->clear();
- dropCapCharStyleCombo->addItem(tr("No Style"));
+
+ checkParEffectState();
+ parEffectCharStyleCombo->clear();
+ parEffectCharStyleCombo->addItem(tr("No Style"));
for (int i =0; i < cstyles.count(); i++)
- dropCapCharStyleCombo->addItem(cstyles.at(i).name());
- setCurrentComboItem(dropCapCharStyleCombo, pstyle->dcCharStyleName().isEmpty() ? tr("No Style") : pstyle->dcCharStyleName());
-
- QFont f(font());
- f.setBold(true);
- parentDropCapButton->setFont(f);
+ parEffectCharStyleCombo->addItem(cstyles.at(i).name());
+ setCurrentComboItem(parEffectCharStyleCombo, pstyle->peCharStyleName().isEmpty() ? tr("No Style") : pstyle->peCharStyleName());
cpage->parentLabel->setText( tr("Based On:"));
cpage->show(&pstyle->charStyle(), cstyles, defLang, unitIndex);
@@ -341,6 +525,8 @@
}
connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
+ connect(bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullets(bool)));
+ connect(numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumbering(bool)));
}
void SMPStyleWidget::show(QList<ParagraphStyle*> &pstyles, QList<ParagraphStyle> &pstylesAll, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang)
@@ -349,9 +535,12 @@
show(pstyles[0], pstylesAll, cstyles, unitIndex, defLang);
else if (pstyles.count() > 1)
{
+ currPStyle = pstyles[0];
showLineSpacing(pstyles);
showSpaceAB(pstyles, unitIndex);
showDropCap(pstyles, cstyles, unitIndex);
+ showBullet(pstyles, cstyles, unitIndex);
+ showNumeration(pstyles, cstyles, unitIndex);
showAlignment(pstyles);
showOpticalMargin(pstyles);
showMinSpace(pstyles);
@@ -360,6 +549,7 @@
showTabs(pstyles, unitIndex);
showCStyle(pstyles, cstyles, defLang, unitIndex);
showParent(pstyles);
+ checkParEffectState();
}
}
@@ -447,10 +637,7 @@
void SMPStyleWidget::showDropCap(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex)
{
- double unitRatio = unitGetRatioFromIndex(unitIndex);
- parentDropCapButton->hide();
- disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
-
+ disconnectPESignals();
bool dc = pstyles[0]->hasDropCap();
for (int i = 0; i < pstyles.count(); ++i)
{
@@ -478,33 +665,76 @@
else
dropCapLines_->setValue(lines);
- double dco = -4000.0;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (dco > -3980.0 && !isEqual(pstyles[i]->dropCapOffset(), dco))
- {
- dco = -4000.0;
- break;
- }
- else
- dco = pstyles[i]->dropCapOffset();
- }
-
- if (dco < -3800.0)
- dropCapOffset_->clear();
- else
- dropCapOffset_->setValue(dco * unitRatio);
-
- dropCapCharStyleCombo->clear();
- dropCapCharStyleCombo->addItem(tr("No Style"));
- for (int i=0; i < cstyles.count(); i++)
- dropCapCharStyleCombo->addItem(cstyles.at(i).name());
-
- connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
dropCapsBox->setEnabled(true);
dropCapLines_->setEnabled(true);
- dropCapOffset_->setEnabled(true);
- dropCapCharStyleCombo->setEnabled(true);
+ connectPESignals();
+}
+
+void SMPStyleWidget::showBullet(QList<ParagraphStyle *> &pstyles, QList<CharStyle> &cstyles, int unitIndex)
+{
+// double unitRatio = unitGetRatioFromIndex(unitIndex);
+
+ disconnectPESignals();
+ bool hb = pstyles[0]->hasBullet();
+ for (int i = 0; i < pstyles.count(); ++i)
+ {
+ if (hb != pstyles[i]->hasBullet())
+ {
+ hb = false;
+ break;
+ }
+ }
+ bulletBox->setChecked(hb);
+
+ QString chStr = pstyles[0]->bulletStr();
+ for (int i = 0; i < pstyles.count(); ++i)
+ {
+ if (chStr != pstyles[i]->bulletStr())
+ {
+ chStr.clear();
+ break;
+ }
+ else
+ chStr = pstyles[i]->bulletStr();
+ }
+ bulletStrEdit_->setEditText(chStr);
+
+ connectPESignals();
+ bulletCharTableButton_->setEnabled(true);
+}
+
+void SMPStyleWidget::showNumeration(QList<ParagraphStyle *> &pstyles, QList<CharStyle> &cstyles, int unitIndex)
+{
+ disconnectPESignals();
+ QString prefix = pstyles[0]->numPrefix();
+ for (int i = 0; i < pstyles.count(); ++i)
+ {
+ if (prefix != pstyles[i]->numPrefix())
+ {
+ prefix.clear();
+ break;
+ }
+ else
+ prefix = pstyles[i]->numPrefix();
+ }
+ numPrefix->setText(prefix);
+
+ QString suffix = pstyles[0]->numSuffix();
+ for (int i = 0; i < pstyles.count(); ++i)
+ {
+ if (suffix != pstyles[i]->numSuffix())
+ {
+ suffix.clear();
+ break;
+ }
+ else
+ suffix = pstyles[i]->numSuffix();
+ }
+ numSuffix->setText(suffix);
+
+ numFormatCombo->setEnabled(true);
+ numLevelSpin->setEnabled(true);
+ connectPESignals();
}
void SMPStyleWidget::showAlignment(QList<ParagraphStyle*> &pstyles)
@@ -771,45 +1001,12 @@
optMarginRadioLeft->setParentValue(parent->opticalMargins() == ParagraphStyle::OM_LeftHangingPunct);
optMarginRadioRight->setParentValue(parent->opticalMargins() == ParagraphStyle::OM_RightHangingPunct);
optMarginRadioNone->setParentValue(parent->opticalMargins() == ParagraphStyle::OM_None);
-// optMarginCheckLeftProtruding->setChecked(om & ParagraphStyle::OM_LeftProtruding, (om & ParagraphStyle::OM_LeftProtruding)==(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding));
-// optMarginCheckRightProtruding->setChecked(om & ParagraphStyle::OM_RightProtruding, (om & ParagraphStyle::OM_RightProtruding)==(parent->opticalMargins() & ParagraphStyle::OM_RightProtruding));
-// optMarginCheckLeftHangPunct->setChecked(om & ParagraphStyle::OM_LeftHangingPunct, (om & ParagraphStyle::OM_LeftHangingPunct)==(parent->opticalMargins() & ParagraphStyle::OM_LeftHangingPunct));
-// optMarginCheckRightHangPunct->setChecked(om & ParagraphStyle::OM_RightHangingPunct, (om & ParagraphStyle::OM_RightHangingPunct)==(parent->opticalMargins() & ParagraphStyle::OM_RightHangingPunct));
-//
-// optMarginCheckLeftProtruding->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding);
-// optMarginCheckRightProtruding->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_RightProtruding);
-// optMarginCheckLeftHangPunct->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_LeftHangingPunct);
-// optMarginCheckRightHangPunct->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_RightHangingPunct);
-// optMarginCheckLeftProtruding->setFont(false);
-// optMarginCheckRightProtruding->setFont(false);
-// optMarginCheckLeftHangPunct->setFont(false);
-// optMarginCheckRightHangPunct->setFont(false);
-//
-// if ((om & ParagraphStyle::OM_LeftProtruding)!=(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding))
-// {
-// optMarginCheckLeftProtruding->setFont(true);
-// }
-// if ((om & ParagraphStyle::OM_RightProtruding)!=(parent->opticalMargins() & ParagraphStyle::OM_RightProtruding))
-// {
-// optMarginCheckRightProtruding->setFont(true);
-// }
-// if ((om & ParagraphStyle::OM_LeftHangingPunct)!=(parent->opticalMargins() & ParagraphStyle::OM_LeftHangingPunct))
-// {
-// optMarginCheckLeftHangPunct->setFont(true);
-// }
-// if ((om & ParagraphStyle::OM_RightHangingPunct)!=(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding))
-// {
-// optMarginCheckRightHangPunct->setFont(true);
-// }
- }
-}
+ }
+}
+
void SMPStyleWidget::slotDefaultOpticalMargins()
{
-// optMarginCheckLeftProtruding->setChecked(false);
-// optMarginCheckRightProtruding->setChecked(true);
-// optMarginCheckLeftHangPunct->setChecked(true);
-// optMarginCheckRightHangPunct->setChecked(true);
optMarginRadioNone->setChecked(true);
if (hasParent_)
optMarginParentButton->show();
@@ -818,12 +1015,9 @@
void SMPStyleWidget::slotParentOpticalMargins()
{
disconnect(optMarginParentButton, SIGNAL(clicked()), this, SLOT(slotParentOpticalMargins()));
-// disconnect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
optMarginParentButton->hide();
-// dropCapsBox->setChecked(parentDropCap_);
emit useParentOptMargins();
connect(optMarginParentButton, SIGNAL(clicked()), this, SLOT(slotParentOpticalMargins()));
-// connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
}
void SMPStyleWidget::clearAll()
@@ -833,39 +1027,175 @@
void SMPStyleWidget::slotDropCap(bool isOn)
{
+ disconnectPESignals();
if (isOn)
{
- dropCapsBox->setEnabled(true);
dropCapLines_->setEnabled(true);
- dropCapOffset_->setEnabled(true);
- dropCapCharStyleCombo->setEnabled(true);
- }
- else
- {
- dropCapsBox->setEnabled(true);
+
+ bulletBox->setChecked(false);
+ bulletStrEdit_->setEnabled(false);
+ bulletCharTableButton_->setEnabled(false);
+
+ numBox->setChecked(false);
+ numFormatCombo->setEnabled(false);
+ numLevelSpin->setEnabled(false);
+ numComboBox->setEnabled(false);
+ numRestartCombo->setEnabled(false);
+ numNewLineEdit->setEnabled(false);
+ }
+ else
dropCapLines_->setEnabled(false);
- dropCapOffset_->setEnabled(false);
- dropCapCharStyleCombo->setEnabled(false);
- }
if (hasParent_)
- parentDropCapButton->show();
-}
-
-void SMPStyleWidget::slotParentDropCap()
-{
- disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
+ parentParEffectsButton->show();
+ checkParEffectState();
+ connectPESignals();
+}
+
+void SMPStyleWidget::slotBullets(bool isOn)
+{
+ disconnectPESignals();
+ if (isOn)
+ {
+ bulletStrEdit_->setEnabled(true);
+ if (bulletStrEdit_->currentText().isEmpty())
+ bulletStrEdit_->setEditText(bulletStrEdit_->itemText(0));
+ bulletCharTableButton_->setEnabled(true);
+
+ numBox->setChecked(false);
+ numFormatCombo->setEnabled(false);
+ numLevelSpin->setEnabled(false);
+ numComboBox->setEnabled(false);
+ numRestartCombo->setEnabled(false);
+ numNewLineEdit->setEnabled(false);
+
+ dropCapsBox->setChecked(false);
+ dropCapLines_->setEnabled(false);
+ }
+ else
+ {
+ bulletStrEdit_->setEnabled(false);
+ bulletCharTableButton_->setEnabled(false);
+ }
+ if (hasParent_)
+ parentParEffectsButton->show();
+ checkParEffectState();
+ connectPESignals();
+}
+
+void SMPStyleWidget::insertSpecialChars(const QString &chars)
+{
+ bulletStrEdit_->lineEdit()->setText(chars);
+}
+
+void SMPStyleWidget::slotNumbering(bool isOn)
+{
+ disconnectPESignals();
+ if (isOn)
+ {
+ numFormatCombo->setEnabled(true);
+ numLevelSpin->setEnabled(true);
+ numComboBox->setEnabled(true);
+ if (numComboBox->currentIndex() < 0)
+ numComboBox->setCurrentIndex(0);
+ numRestartCombo->setEnabled(true);
+ numNewLineEdit->setEnabled(true);
+
+ bulletBox->setChecked(false);
+ bulletStrEdit_->setEnabled(false);
+ bulletCharTableButton_->setEnabled(false);
+
+ dropCapsBox->setChecked(false);
+ dropCapLines_->setEnabled(false);
+ }
+ else
+ {
+ numFormatCombo->setEnabled(false);
+ numLevelSpin->setEnabled(false);
+ }
+ if (hasParent_)
+ parentParEffectsButton->show();
+ checkParEffectState();
+ connectPESignals();
+}
+
+void SMPStyleWidget::slotParentParEffects()
+{
+ disconnectPESignals();
+ parentParEffectsButton->hide();
+ dropCapsBox->setChecked(parentDC_);
+ bulletBox->setChecked(parentBul_);
+ numBox->setChecked(parentNum_);
+ emit useParentParaEffects();
+ connectPESignals();
+}
+
+SMPStyleWidget::~SMPStyleWidget()
+{
+
+}
+
+void SMPStyleWidget::openEnhanced()
+{
+ if (m_enhanced)
+ return;
+
+ QApplication::changeOverrideCursor(QCursor(Qt::WaitCursor));
+ m_enhanced = new CharSelectEnhanced(this);
+ m_enhanced->setModal(true);
+ connect(m_enhanced, SIGNAL(insertSpecialChars(const QString &)), this, SLOT(insertSpecialChars(const QString &)));
+ connect(m_enhanced, SIGNAL(paletteShown(bool)), bulletCharTableButton_, SLOT(setChecked(bool)));
+ m_enhanced->setDoc(m_Doc);
+ m_enhanced->setEnabled(true);
+ QString styleName = parEffectCharStyleCombo->currentText();
+ if (styleName != tr("No Style") && !styleName.isEmpty())
+ {
+ CharStyle chStyle = m_Doc->charStyle(styleName);
+ setCurrentComboItem(m_enhanced->fontSelector, chStyle.font().scName());
+ }
+ else if (currPStyle)
+ setCurrentComboItem(m_enhanced->fontSelector, currPStyle->charStyle().font().scName());
+ m_enhanced->newFont(m_enhanced->fontSelector->currentIndex());
+ m_enhanced->show();
+ QApplication::changeOverrideCursor(Qt::ArrowCursor);
+}
+
+void SMPStyleWidget::closeEnhanced(bool show)
+{
+ if (!m_enhanced || show)
+ return;
+ disconnect(m_enhanced, SIGNAL(insertSpecialChars(const QString &)), this, SLOT(insertSpecialChars(const QString &)));
+ disconnect(m_enhanced, SIGNAL(paletteShown(bool)), bulletCharTableButton_, SLOT(setChecked(bool)));
+ m_enhanced->close();
+ delete m_enhanced;
+ m_enhanced = NULL;
+}
+
+void SMPStyleWidget::connectPESignals()
+{
+ connect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects()));
+ connect(bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullets(bool)));
+ connect(numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumbering(bool)));
+ connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
+}
+
+void SMPStyleWidget::disconnectPESignals()
+{
+ disconnect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects()));
+ disconnect(bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullets(bool)));
+ disconnect(numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumbering(bool)));
disconnect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
- parentDropCapButton->hide();
- dropCapsBox->setChecked(parentDropCap_);
- emit useParentDropCap();
- connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
- connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
-}
-
-SMPStyleWidget::~SMPStyleWidget()
-{
-
-}
-
-
-
+}
+
+void SMPStyleWidget::on_bulletCharTableButton__toggled(bool checked)
+{
+ if (m_enhanced && !checked)
+ closeEnhanced();
+ else if (!m_enhanced && checked)
+ openEnhanced();
+}
+
+void SMPStyleWidget::handleUpdateRequest(int updateFlags)
+{
+ if (updateFlags & reqNumUpdate)
+ fillNumerationsCombo();
+}
Modified: trunk/Scribus/scribus/ui/smpstylewidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/smpstylewidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.h (original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.h Sat Jan 5 09:26:28 2013
@@ -9,9 +9,9 @@
#define SMPSTYLEWIDGET_H
class QEvent;
-
#include "ui_smpstylewidget.h"
+#include "ui/charselectenhanced.h"
// #include "styles/styleset.h"
@@ -19,7 +19,7 @@
{
Q_OBJECT
public:
- SMPStyleWidget();
+ SMPStyleWidget(ScribusDoc *doc);
~SMPStyleWidget();
virtual void changeEvent(QEvent *e);
@@ -30,14 +30,27 @@
void clearAll();
void languageChange();
void unitChange(double oldRatio, double newRatio, int unitIndex);
+ void setDoc(ScribusDoc* doc);
private:
bool hasParent_;
- bool parentDropCap_;
+ //bool parentParEffects_;
+ bool parentDC_, parentBul_, parentNum_;
+ CharSelectEnhanced * m_enhanced;
+ ScribusDoc * m_Doc;
+ QString currFontName;
+ ParagraphStyle* currPStyle;
+ void fillBulletStrEditCombo();
+ void fillNumFormatCombo();
+ void fillNumerationsCombo();
+ void fillNumRestartCombo();
+ void checkParEffectState();
void showLineSpacing(QList<ParagraphStyle*> &pstyles);
void showSpaceAB(QList<ParagraphStyle*> &pstyles, int unitIndex);
void showDropCap(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex);
+ void showBullet(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex);
+ void showNumeration(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex);
void showAlignment(QList<ParagraphStyle*> &pstyles);
void showOpticalMargin(QList<ParagraphStyle*> &pstyles);
void showMinSpace(QList<ParagraphStyle*> &pstyles);
@@ -48,19 +61,28 @@
void showParent(QList<ParagraphStyle*> &pstyles);
void setOpticalMargins(int o, bool inhO=false, const ParagraphStyle *parent=NULL);
+ void openEnhanced();
+ void closeEnhanced(bool show = false);
+ void connectPESignals();
+ void disconnectPESignals();
+
friend class SMParagraphStyle;
private slots:
void slotLineSpacingModeChanged(int);
void slotDropCap(bool isOn);
- void slotParentDropCap();
+ void slotBullets(bool isOn);
+ void insertSpecialChars(const QString &);
+ void slotNumbering(bool isOn);
+ void slotParentParEffects();
void slotDefaultOpticalMargins();
void slotParentOpticalMargins();
// void slotUpdateOpticalMarginsFromCheckBoxes(int);
-
+ void on_bulletCharTableButton__toggled(bool checked);
+ void handleUpdateRequest(int);
signals:
- void useParentDropCap();
+ void useParentParaEffects();
void useParentOptMargins();
};
Modified: trunk/Scribus/scribus/ui/smpstylewidget.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/smpstylewidget.ui
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.ui (original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.ui Sat Jan 5 09:26:28 2013
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>792</width>
- <height>717</height>
+ <width>798</width>
+ <height>755</height>
</rect>
</property>
<layout class="QVBoxLayout">
@@ -234,47 +234,25 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="dropCapsBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <widget class="QGroupBox" name="parEffectsBox">
<property name="title">
- <string>Drop Caps</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout">
+ <string>Paragraph Effects</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
<item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel" name="dropCapsLineLabel">
+ <layout class="QHBoxLayout" name="horizontalLayout_13">
+ <item>
+ <widget class="QLabel" name="parEffectCharStyleComboLabel">
<property name="text">
- <string>&Lines:</string>
- </property>
- <property name="buddy">
- <cstring>dropCapLines_</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMSpinBox" name="dropCapLines_">
- <property name="minimum">
- <number>2</number>
- </property>
- <property name="maximum">
- <number>20</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
+ <string>Character Style for Effect:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMScComboBox" name="parEffectCharStyleCombo"/>
+ </item>
+ <item>
+ <spacer name="spacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -292,12 +270,12 @@
<string>Distance from Text:</string>
</property>
<property name="buddy">
- <cstring>dropCapOffset_</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMScrSpinBox" name="dropCapOffset_">
+ <cstring>parEffectOffset_</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMScrSpinBox" name="parEffectOffset_">
<property name="minimum">
<number>-3000</number>
</property>
@@ -319,86 +297,368 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="SMCheckBox" name="parEffectIndentBox">
+ <property name="text">
+ <string>AutoIndent</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
- <widget class="QLabel" name="dropCapCharStyleComboLabel">
- <property name="text">
- <string>Character Style for Drop Cap:</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
+ <item>
+ <spacer name="spacer_10">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="parentParEffectsButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Use Parent`s Values</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
- <widget class="SMScComboBox" name="dropCapCharStyleCombo"/>
+ <widget class="QGroupBox" name="bulletBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Bullets</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QLabel" name="bulletCharLabel">
+ <property name="text">
+ <string>Bullet Char/String</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMScComboBox" name="bulletStrEdit_">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="bulletCharTableButton_">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Char Table</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="spacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
</item>
<item>
- <widget class="QToolButton" name="parentDropCapButton">
- <property name="enabled">
+ <widget class="QGroupBox" name="numBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Numeration</string>
+ </property>
+ <property name="checkable">
<bool>true</bool>
</property>
- <property name="text">
- <string>Use Parent Value</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="textFlowBox">
- <property name="title">
- <string>Orphans and Widows</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="keepLabelStart">
- <property name="toolTip">
- <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string>
- </property>
- <property name="text">
- <string>Don't separate first</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="SMSpinBox" name="keepLinesStart">
- <property name="suffix">
- <string> lines</string>
- </property>
- <property name="maximum">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="keepLabelEnd">
- <property name="text">
- <string>Don't separate last</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="SMSpinBox" name="keepLinesEnd">
- <property name="suffix">
- <string> lines</string>
- </property>
- <property name="maximum">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="SMCheckBox" name="keepTogether">
- <property name="text">
- <string>Do not split paragraph</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="SMCheckBox" name="keepWithNext">
- <property name="text">
- <string>Keep with next paragraph</string>
- </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <widget class="QLabel" name="numComboLabel">
+ <property name="text">
+ <string>Set:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMScComboBox" name="numComboBox">
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="numLevelLabel">
+ <property name="text">
+ <string>Level</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMSpinBox" name="numLevelSpin"/>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="numNewLabel">
+ <property name="text">
+ <string>Create New Set:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="numNewLineEdit"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_10">
+ <item>
+ <widget class="QLabel" name="numFormatLabel">
+ <property name="text">
+ <string>Nums Format</string>
+ </property>
+ <property name="buddy">
+ <cstring>numFormatCombo</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMScComboBox" name="numFormatCombo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="numStartLabel">
+ <property name="text">
+ <string>Start with</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMSpinBox" name="numStartSpin">
+ <property name="maximum">
+ <number>99999</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="numPrefixLabel">
+ <property name="text">
+ <string>Prefix</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="numPrefix"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="numSuffixLabel">
+ <property name="text">
+ <string>Suffix</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="numSuffix"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QLabel" name="numRestartLabel">
+ <property name="text">
+ <string>Restart</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMScComboBox" name="numRestartCombo"/>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="SMCheckBox" name="numRestartOtherBox">
+ <property name="text">
+ <string>Restart after other format</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMCheckBox" name="numRestartHigherBox">
+ <property name="text">
+ <string>Restart after higher level</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="dropCapsBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Drop Caps</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="dropCapsLineLabel">
+ <property name="text">
+ <string>&Lines:</string>
+ </property>
+ <property name="buddy">
+ <cstring>dropCapLines_</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMSpinBox" name="dropCapLines_">
+ <property name="minimum">
+ <number>2</number>
+ </property>
+ <property name="maximum">
+ <number>20</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
</layout>
@@ -415,7 +675,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>272</width>
- <height>0</height>
+ <height>13</height>
</size>
</property>
</spacer>
@@ -622,6 +882,79 @@
</layout>
</item>
</layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="textFlowBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Orphans and Widows</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="1">
+ <widget class="SMSpinBox" name="keepLinesEnd">
+ <property name="suffix">
+ <string> lines</string>
+ </property>
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="keepLabelEnd">
+ <property name="text">
+ <string>Don't separate last</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="SMSpinBox" name="keepLinesStart">
+ <property name="suffix">
+ <string> lines</string>
+ </property>
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="keepLabelStart">
+ <property name="toolTip">
+ <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string>
+ </property>
+ <property name="text">
+ <string>Don't separate first</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="SMCheckBox" name="keepTogether">
+ <property name="text">
+ <string>Do not split paragraph</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="SMCheckBox" name="keepWithNext">
+ <property name="text">
+ <string>Keep with next paragraph</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
@@ -749,6 +1082,16 @@
<header>ui/smsccombobox.h</header>
</customwidget>
<customwidget>
+ <class>SMRadioButton</class>
+ <extends>QRadioButton</extends>
+ <header>ui/smradiobutton.h</header>
+ </customwidget>
+ <customwidget>
+ <class>SMCheckBox</class>
+ <extends>QCheckBox</extends>
+ <header>ui/smcheckbox.h</header>
+ </customwidget>
+ <customwidget>
<class>SMScrSpinBox</class>
<extends>QSpinBox</extends>
<header>ui/smscrspinbox.h</header>
@@ -776,16 +1119,6 @@
<header>ui/smcstylewidget.h</header>
<container>1</container>
</customwidget>
- <customwidget>
- <class>SMRadioButton</class>
- <extends>QRadioButton</extends>
- <header>ui/smradiobutton.h</header>
- </customwidget>
- <customwidget>
- <class>SMCheckBox</class>
- <extends>QCheckBox</extends>
- <header>ui/smcheckbox.h</header>
- </customwidget>
</customwidgets>
<resources/>
<connections/>
Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp (original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp Sat Jan 5 09:26:28 2013
@@ -45,7 +45,7 @@
pwidget_(0), doc_(0), selectionIsDirty_(false), unitRatio_(1.0), cstyles_(cstyles)
{
Q_ASSERT(cstyles_);
- pwidget_ = new SMPStyleWidget();
+ pwidget_ = new SMPStyleWidget(doc_);
Q_CHECK_PTR(pwidget_);
}
@@ -87,6 +87,8 @@
tmpStyles_.clear();
deleted_.clear();
}
+ if (pwidget_)
+ pwidget_->setDoc(doc);
}
StyleSet<ParagraphStyle>* SMParagraphStyle::tmpStyles()
@@ -512,11 +514,27 @@
connect(pwidget_->minGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMinGlyphExt()));
connect(pwidget_->maxGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMaxGlyphExt()));
- connect(pwidget_, SIGNAL(useParentDropCap()), this, SLOT(slotParentDropCap()));
+ connect(pwidget_, SIGNAL(useParentParaEffects()), this, SLOT(slotParentParaEffects()));
connect(pwidget_->dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
connect(pwidget_->dropCapLines_, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int)));
- connect(pwidget_->dropCapOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotDropCapOffset()));
- connect(pwidget_->dropCapCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotDropCapCharStyle(const QString&)));
+ connect(pwidget_->parEffectOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset()));
+ connect(pwidget_->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool)));
+ connect(pwidget_->parEffectCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParEffectCharStyle(const QString&)));
+
+ connect(pwidget_->bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullet(bool)));
+ connect(pwidget_->bulletStrEdit_, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString)));
+ connect(pwidget_->numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumeration(bool)));
+ connect(pwidget_->numComboBox, SIGNAL(activated(QString)), this, SLOT(slotNumName(QString)));
+ connect(pwidget_->numLevelSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumLevel(int)));
+ connect(pwidget_->numFormatCombo, SIGNAL(activated(int)), this, SLOT(slotNumFormat(int)));
+ connect(pwidget_->numStartSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumStart(int)));
+ connect(pwidget_->numRestartCombo, SIGNAL(activated(int)), this, SLOT(slotNumRestart(int)));
+ connect(pwidget_->numRestartOtherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumOther(bool)));
+ connect(pwidget_->numRestartHigherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumHigher(bool)));
+ connect(pwidget_->numPrefix, SIGNAL(textChanged(QString)), this, SLOT(slotNumPrefix(QString)));
+ connect(pwidget_->numSuffix, SIGNAL(textChanged(QString)), this, SLOT(slotNumSuffix(QString)));
+ connect(pwidget_->numNewLineEdit, SIGNAL(editingFinished()), this, SLOT(slotNumNew()));
+ connect(pwidget_->numNewLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSelectionDirty()));
connect(pwidget_->keepLinesStart, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesStart()));
connect(pwidget_->keepLinesEnd, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesEnd()));
@@ -529,26 +547,18 @@
connect(pwidget_->tabList_->right_, SIGNAL(valueChanged(double)), this, SLOT(slotRightIndent()));
connect(pwidget_->tabList_->first_, SIGNAL(valueChanged(double)), this, SLOT(slotFirstLine()));
- connect(pwidget_->parentCombo, SIGNAL(activated(const QString&)),
- this, SLOT(slotParentChanged(const QString&)));
+ connect(pwidget_->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParentChanged(const QString&)));
// character attributes
connect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
connect(pwidget_->cpage->effects_, SIGNAL(State(int)), this, SLOT(slotEffects(int)));
- connect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- connect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- connect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- connect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- connect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- connect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- connect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
+ connect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ connect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ connect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ connect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ connect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ connect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ connect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
connect(pwidget_->cpage->fillColor_, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor()));
connect(pwidget_->cpage->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade()));
connect(pwidget_->cpage->strokeColor_, SIGNAL(activated(const QString&)), this, SLOT(slotStrokeColor()));
@@ -561,8 +571,7 @@
connect(pwidget_->cpage->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking()));
connect(pwidget_->cpage->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset()));
connect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
- connect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)),
- this, SLOT(slotCharParentChanged(const QString&)));
+ connect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotCharParentChanged(const QString&)));
}
void SMParagraphStyle::removeConnections()
@@ -590,14 +599,29 @@
disconnect(pwidget_->minGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMinGlyphExt()));
disconnect(pwidget_->maxGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMaxGlyphExt()));
- disconnect(pwidget_, SIGNAL(useParentDropCap()), this, SLOT(slotParentDropCap()));
+ disconnect(pwidget_, SIGNAL(useParentParaEffects()), this, SLOT(slotParentParaEffects()));
disconnect(pwidget_->dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
disconnect(pwidget_->dropCapLines_, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int)));
- disconnect(pwidget_->dropCapOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotDropCapOffset()));
- disconnect(pwidget_->dropCapCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotDropCapCharStyle(const QString&)));
-
- disconnect(pwidget_->parentCombo, SIGNAL(activated(const QString&)),
- this, SLOT(slotParentChanged(const QString&)));
+ disconnect(pwidget_->parEffectOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset()));
+ disconnect(pwidget_->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool)));
+ disconnect(pwidget_->parEffectCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParEffectCharStyle(const QString&)));
+
+ disconnect(pwidget_->bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullet(bool)));
+ disconnect(pwidget_->bulletStrEdit_, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString)));
+ disconnect(pwidget_->numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumeration(bool)));
+ disconnect(pwidget_->numComboBox, SIGNAL(activated(QString)), this, SLOT(slotNumName(QString)));
+ disconnect(pwidget_->numFormatCombo, SIGNAL(activated(int)), this, SLOT(slotNumFormat(int)));
+ disconnect(pwidget_->numLevelSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumLevel(int)));
+ disconnect(pwidget_->numStartSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumStart(int)));
+ disconnect(pwidget_->numRestartCombo, SIGNAL(activated(int)), this, SLOT(slotNumRestart(int)));
+ disconnect(pwidget_->numRestartOtherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumOther(bool)));
+ disconnect(pwidget_->numRestartHigherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumHigher(bool)));
+ disconnect(pwidget_->numPrefix, SIGNAL(textChanged(QString)), this, SLOT(slotNumPrefix(QString)));
+ disconnect(pwidget_->numSuffix, SIGNAL(textChanged(QString)), this, SLOT(slotNumSuffix(QString)));
+ disconnect(pwidget_->numNewLineEdit, SIGNAL(editingFinished()), this, SLOT(slotNumNew()));
+ disconnect(pwidget_->numNewLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSelectionDirty()));
+
+ disconnect(pwidget_->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParentChanged(const QString&)));
disconnect(pwidget_->keepLinesStart, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesStart()));
disconnect(pwidget_->keepLinesEnd, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesEnd()));
@@ -611,20 +635,13 @@
disconnect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
disconnect(pwidget_->cpage->effects_, SIGNAL(State(int)), this, SLOT(slotEffects(int)));
- disconnect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- disconnect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- disconnect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- disconnect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- disconnect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- disconnect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
- disconnect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)),
- this, SLOT(slotEffectProperties()));
+ disconnect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ disconnect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ disconnect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ disconnect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ disconnect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ disconnect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
+ disconnect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties()));
disconnect(pwidget_->cpage->fillColor_, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor()));
disconnect(pwidget_->cpage->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade()));
disconnect(pwidget_->cpage->strokeColor_, SIGNAL(activated(const QString&)), this, SLOT(slotStrokeColor()));
@@ -637,8 +654,7 @@
disconnect(pwidget_->cpage->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking()));
disconnect(pwidget_->cpage->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset()));
disconnect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString)));
- disconnect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)),
- this, SLOT(slotCharParentChanged(const QString&)));
+ disconnect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotCharParentChanged(const QString&)));
}
void SMParagraphStyle::slotLineSpacingMode(int mode)
@@ -854,20 +870,31 @@
void SMParagraphStyle::slotDropCap(bool isOn)
{
for (int i = 0; i < selection_.count(); ++i)
+ {
selection_[i]->setHasDropCap(isOn);
-
- if (!selectionIsDirty_)
- {
- selectionIsDirty_ = true;
- emit selectionDirty();
- }
-}
-
-void SMParagraphStyle::slotParentDropCap()
+ if (isOn)
+ {
+ selection_[i]->setHasBullet(false);
+ selection_[i]->setHasNum(false);
+ }
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotParentParaEffects()
{
for (int i = 0; i < selection_.count(); ++i)
+ {
selection_[i]->resetHasDropCap();
-
+ selection_[i]->resetHasBullet();
+ selection_[i]->resetHasNum();
+ }
+
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
@@ -891,38 +918,291 @@
}
}
-void SMParagraphStyle::slotDropCapOffset()
-{
- if (pwidget_->dropCapOffset_->useParentValue())
- for (int i = 0; i < selection_.count(); ++i)
- selection_[i]->resetDropCapOffset();
+void SMParagraphStyle::slotParEffectOffset()
+{
+ if (pwidget_->parEffectOffset_->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetParEffectOffset();
else
{
double a, b, value;
int c;
- pwidget_->dropCapOffset_->getValues(&a, &b, &c, &value);
+ pwidget_->parEffectOffset_->getValues(&a, &b, &c, &value);
value = value / unitRatio_;
for (int i = 0; i < selection_.count(); ++i)
- selection_[i]->setDropCapOffset(value);
- }
-
- if (!selectionIsDirty_)
- {
- selectionIsDirty_ = true;
- emit selectionDirty();
- }
-}
-
-void SMParagraphStyle::slotDropCapCharStyle(const QString& name)
-{
- if (pwidget_->dropCapCharStyleCombo->useParentValue())
- for (int i = 0; i < selection_.count(); ++i)
- selection_[i]->resetDcCharStyleName();
- else
- for (int i = 0; i < selection_.count(); ++i)
- selection_[i]->setDcCharStyleName(name);
-
+ selection_[i]->setParEffectOffset(value);
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotParEffectIndent(bool isOn)
+{
+ if (pwidget_->parEffectIndentBox->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetParEffectIndent();
+ else
+ {
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setParEffectIndent(isOn);
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotParEffectCharStyle(const QString& name)
+{
+ if (pwidget_->parEffectCharStyleCombo->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetPeCharStyleName();
+ else
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setPeCharStyleName(name);
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotBullet(bool isOn)
+{
+ for (int i = 0; i < selection_.count(); ++i)
+ {
+ selection_[i]->setHasBullet(isOn);
+ if (isOn)
+ {
+ selection_[i]->setBulletStr(pwidget_->bulletStrEdit_->currentText());
+ selection_[i]->setHasDropCap(false);
+ selection_[i]->setHasNum(false);
+ }
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotBulletStr(const QString &str)
+{
+ QString bstr(str);
+ if (bstr.isEmpty())
+ {
+ bstr = pwidget_->bulletStrEdit_->itemText(0);
+ pwidget_->bulletStrEdit_->setEditText(bstr);
+ }
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setBulletStr(bstr);
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumeration(bool isOn)
+{
+ for (int i = 0; i < selection_.count(); ++i)
+ {
+ selection_[i]->setHasNum(isOn);
+ if (isOn)
+ {
+ selection_[i]->setHasDropCap(false);
+ selection_[i]->setHasBullet(false);
+ }
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumName(const QString &str)
+{
+ QString bstr(str);
+ if (!str.isEmpty())
+ {
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumName(bstr);
+ pwidget_->numComboBox->setCurrentItem(pwidget_->numComboBox->findText(selection_[0]->numName()));
+ pwidget_->numLevelSpin->setValue(selection_[0]->numLevel()+1);
+ NumStruct * numS = doc_->numerations.value(selection_[0]->numName());
+ if (numS)
+ pwidget_->numLevelSpin->setMaximum(numS->m_counters.count()+1);
+ else
+ pwidget_->numLevelSpin->setMaximum(1);
+ doc_->flag_NumUpdateRequest = true;
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumNew()
+{
+ QString newName = pwidget_->numNewLineEdit->text();
+ if (!newName.isEmpty())
+ {
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumName(newName);
+ doc_->flag_NumUpdateRequest = true;
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotSelectionDirty()
+{
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumFormat(int numFormat)
+{
+ if (pwidget_->numFormatCombo->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetNumFormat();
+ else
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumFormat(numFormat);
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumLevel(int level)
+{
+ if (pwidget_->numLevelSpin->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetNumLevel();
+ else
+ for (int i = 0; i < selection_.count(); ++i)
+ {
+ selection_[i]->setNumLevel(level-1);
+ }
+
+ if (level == 0)
+ slotNumHigher(false);
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumPrefix(const QString &str)
+{
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumPrefix(str);
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumSuffix(const QString &str)
+{
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumSuffix(str);
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumStart(int start)
+{
+ if (pwidget_->numStartSpin->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetNumStart();
+ else
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumStart(start);
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumRestart(int restart)
+{
+ if (pwidget_->numRestartCombo->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetNumRestart();
+ else
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumRestart(restart);
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumOther(bool isOn)
+{
+ if (pwidget_->numRestartOtherBox->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetNumOther();
+ else
+ {
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumOther(isOn);
+ }
+
+ if (!selectionIsDirty_)
+ {
+ selectionIsDirty_ = true;
+ emit selectionDirty();
+ }
+}
+
+void SMParagraphStyle::slotNumHigher(bool isOn)
+{
+ if (pwidget_->numRestartHigherBox->useParentValue())
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->resetNumHigher();
+ else
+ {
+ for (int i = 0; i < selection_.count(); ++i)
+ selection_[i]->setNumHigher(isOn);
+ }
+
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
Modified: trunk/Scribus/scribus/ui/smtextstyles.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/ui/smtextstyles.h
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.h (original)
+++ trunk/Scribus/scribus/ui/smtextstyles.h Sat Jan 5 09:26:28 2013
@@ -71,11 +71,26 @@
// pstyle
void slotLineSpacingMode(int mode);
void slotLineSpacing();
- void slotParentDropCap();
+ void slotParentParaEffects();
void slotDropCap(bool isOn);
void slotDropCapLines(int lines);
- void slotDropCapOffset();
- void slotDropCapCharStyle(const QString &name);
+ void slotParEffectOffset();
+ void slotParEffectIndent(bool);
+ void slotParEffectCharStyle(const QString &name);
+ void slotBullet(bool isOn);
+ void slotBulletStr(const QString &str);
+ void slotNumeration(bool isOn);
+ void slotNumName(const QString &str);
+ void slotNumNew();
+ void slotSelectionDirty();
+ void slotNumFormat(int numFormat);
+ void slotNumLevel(int level);
+ void slotNumPrefix(const QString &str);
+ void slotNumSuffix(const QString &str);
+ void slotNumStart(int start);
+ void slotNumRestart(int restart);
+ void slotNumOther(bool isOn);
+ void slotNumHigher(bool isOn);
void slotSpaceAbove();
void slotSpaceBelow();
void slotAlignment();
Modified: trunk/Scribus/scribus/util.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/util.cpp
==============================================================================
--- trunk/Scribus/scribus/util.cpp (original)
+++ trunk/Scribus/scribus/util.cpp Sat Jan 5 09:26:28 2013
@@ -539,7 +539,7 @@
return QString("%1-%2%3.%4").arg(defaultName).arg(QObject::tr("page", "page export")).arg(number, 3, 10, QChar('0')).arg(extension);
}
-const QString getStringFromSequence(DocumentSectionType type, uint position, QString asterix)
+const QString getStringFromSequence(NumFormat type, uint position, QString asterix)
{
QString retVal("");
switch( type )
@@ -1131,6 +1131,13 @@
delete gItem;
}
+void setWidgetBoldFont(QWidget* w, bool wantBold)
+{
+ QFont f(w->font());
+ f.setBold(wantBold);
+ w->setFont(f);
+}
+
void getUniqueName(QString &name, QStringList list, QString separator, bool prepend)
{
if (!list.contains(name))
Modified: trunk/Scribus/scribus/util.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18047&path=/trunk/Scribus/scribus/util.h
==============================================================================
--- trunk/Scribus/scribus/util.h (original)
+++ trunk/Scribus/scribus/util.h Sat Jan 5 09:26:28 2013
@@ -131,7 +131,7 @@
void SCRIBUS_API sDebug(QString message);
//asterix is QString used in numeration when number is presented as few chars, like *, **, *** etc
//default is '*' but can be used any string
-const QString SCRIBUS_API getStringFromSequence(DocumentSectionType type, uint position, QString asterix="*");
+const QString SCRIBUS_API getStringFromSequence(NumFormat type, uint position, QString asterix="*");
const QString SCRIBUS_API arabicToRoman(uint i);
const QString SCRIBUS_API numberToLetterSequence(uint i);
void SCRIBUS_API parsePagesString(QString pages, std::vector<int>* pageNs, int sourcePageCount);
@@ -154,6 +154,7 @@
void SCRIBUS_API printBacktrace(int nFrames);
void SCRIBUS_API convertOldTable(ScribusDoc *m_Doc, PageItem* gItem, QList<PageItem*> &gpL, QStack< QList<PageItem*> > *groupStackT = NULL, QList<PageItem *> *target = NULL);
+void SCRIBUS_API setWidgetBoldFont(QWidget* w, bool wantBold);
/*!
*\brief
* check if name exists in list
More information about the scribus-commit
mailing list