Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 6732 → Rev 6733

/branches/Version13x/Scribus/scribus/style.cpp
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/fileloader.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/fileloader.cpp (revision 6732)
+++ branches/Version13x/Scribus/scribus/fileloader.cpp (revision 6733)
@@ -354,7 +354,7 @@
else
vg.setRightMargin(0);
vg.setFirstIndent(pg.attribute("FIRST", "0").toDouble());
- vg.setAlignment(pg.attribute("ALIGN").toInt());
+ vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg.attribute("ALIGN").toInt()));
vg.setGapBefore(pg.attribute("VOR", "0").toDouble());
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
@@ -400,9 +400,9 @@
vg.charStyle().setScaleV(qRound(pg.attribute("SCALEV", "100").toDouble() * 10));
vg.charStyle().setBaselineOffset(qRound(pg.attribute("BASEO", "0").toDouble() * 10));
vg.charStyle().setTracking(qRound(pg.attribute("KERN", "0").toDouble() * 10));
- vg.tabValues().clear();
if ((pg.hasAttribute("NUMTAB")) && (pg.attribute("NUMTAB", "0").toInt() != 0))
{
+ QValueList<ParagraphStyle::TabRecord> tbs;
ParagraphStyle::TabRecord tb;
QString tmp = pg.attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
@@ -414,12 +414,14 @@
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
- vg.tabValues().append(tb);
+ tbs.append(tb);
}
+ vg.setTabValues(tbs);
tmp = "";
}
else
{
+ QValueList<ParagraphStyle::TabRecord> tbs;
QDomNode IT = pg.firstChild();
while(!IT.isNull())
{
@@ -435,10 +437,11 @@
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
- vg.tabValues().append(tb);
+ tbs.append(tb);
}
IT=IT.nextSibling();
}
+ vg.setTabValues(tbs);
}
}
/branches/Version13x/Scribus/scribus/gtaction.cpp
325,13 → 325,10
void gtAction::createParagraphStyle(gtParagraphStyle* pstyle)
{
ScribusDoc* currDoc=textFrame->doc();
if (currDoc->docParagraphStyles.count() > 5)
for (uint i = 0; i < currDoc->docParagraphStyles.count(); ++i)
{
for (uint i = 5; i < currDoc->docParagraphStyles.count(); ++i)
{
if (currDoc->docParagraphStyles[i].name() == pstyle->getName())
return;
}
if (currDoc->docParagraphStyles[i].name() == pstyle->getName())
return;
}
gtFont* font = pstyle->getFont();
ParagraphStyle vg;
343,7 → 340,7
linesp = pstyle->getLineSpacing();
vg.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
vg.setLineSpacing(linesp);
vg.setAlignment(pstyle->getAlignment());
vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pstyle->getAlignment()));
vg.setLeftMargin(pstyle->getIndent());
vg.setFirstIndent(pstyle->getFirstLineIndent());
vg.setGapBefore(pstyle->getSpaceAbove());
350,13 → 347,7
vg.setGapAfter(pstyle->getSpaceBelow());
vg.charStyle().setFont(validateFont(font));
vg.charStyle().setFontSize(font->getSize());
vg.tabValues().clear();
QValueList<ParagraphStyle::TabRecord> *tabs = pstyle->getTabValues();
for (uint i = 0; i < tabs->size(); ++i)
{
ParagraphStyle::TabRecord tmp = (*tabs)[i];
vg.tabValues().append(tmp);
}
vg.setTabValues(*pstyle->getTabValues());
vg.setHasDropCap(pstyle->hasDropCap());
vg.setDropCapLines(pstyle->getDropCapHeight());
vg.setDropCapOffset(0);
412,7 → 403,7
linesp = pstyle->getLineSpacing();
vg.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
vg.setLineSpacing(linesp);
vg.setAlignment(pstyle->getAlignment());
vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pstyle->getAlignment()));
vg.setLeftMargin(pstyle->getIndent());
vg.setFirstIndent(pstyle->getFirstLineIndent());
vg.setGapBefore(pstyle->getSpaceAbove());
419,13 → 410,7
vg.setGapAfter(pstyle->getSpaceBelow());
vg.charStyle().setFont(validateFont(font));
vg.charStyle().setFontSize(font->getSize());
vg.tabValues().clear();
QValueList<ParagraphStyle::TabRecord> *tabs = pstyle->getTabValues();
for (uint i = 0; i < tabs->size(); ++i)
{
ParagraphStyle::TabRecord tmp = (*tabs)[i];
vg.tabValues().append(tmp);
}
vg.setTabValues(*pstyle->getTabValues());
vg.setHasDropCap(pstyle->hasDropCap());
vg.setDropCapLines(pstyle->getDropCapHeight());
vg.setDropCapOffset(0);
/branches/Version13x/Scribus/scribus/smtextstylewidgets.cpp
152,8 → 152,8
 
void SMPStyleWidget::show(ParagraphStyle &pstyle, QValueList<ParagraphStyle> &pstyles, QValueList<CharStyle> &cstyles, int unitIndex)
{
bool hasParent = pstyle.hasParent();
const ParagraphStyle *parent = dynamic_cast<const ParagraphStyle*>(pstyle.parent());
const ParagraphStyle *parent = dynamic_cast<const ParagraphStyle*>(pstyle.parentStyle());
bool hasParent = parent != NULL;
 
lineSpacingMode_->clear();
lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
164,21 → 164,21
 
if (hasParent)
{
lineSpacingMode_->setCurrentItem(pstyle.lineSpacingMode(), pstyle.isPlineSpacingMode());
lineSpacingMode_->setCurrentItem(pstyle.lineSpacingMode(), pstyle.isInhLineSpacingMode());
lineSpacingMode_->setParentItem(parent->lineSpacingMode());
 
lineSpacing_->setValue(pstyle.lineSpacing(), pstyle.isPlineSpacing());
lineSpacing_->setValue(pstyle.lineSpacing(), pstyle.isInhLineSpacing());
lineSpacing_->setParentValue(parent->lineSpacing());
 
spaceAbove_->setValue(pstyle.gapBefore(), pstyle.isPgapBefore());
spaceAbove_->setValue(pstyle.gapBefore(), pstyle.isInhGapBefore());
spaceAbove_->setParentValue(parent->gapBefore());
 
spaceBelow_->setValue(pstyle.gapAfter(), pstyle.isPgapAfter());
spaceBelow_->setValue(pstyle.gapAfter(), pstyle.isInhGapAfter());
spaceBelow_->setParentValue(parent->gapAfter());
 
dropCapsBox->setChecked(pstyle.hasDropCap());;
parentDropCap_ = parent->hasDropCap();
if (pstyle.isPhasDropCap())
if (pstyle.isInhHasDropCap())
parentDropCapButton->hide();
else
parentDropCapButton->show();
186,16 → 186,16
connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap()));
 
dropCapLines_->setValue(pstyle.dropCapLines(), pstyle.isPdropCapLines());
dropCapLines_->setValue(pstyle.dropCapLines(), pstyle.isInhDropCapLines());
dropCapLines_->setParentValue(parent->dropCapLines());
 
dropCapOffset_->setValue(pstyle.dropCapOffset(), pstyle.isPdropCapOffset());
dropCapOffset_->setValue(pstyle.dropCapOffset(), pstyle.isInhDropCapOffset());
dropCapOffset_->setParentValue(parent->dropCapOffset());
 
alignement_->setStyle(pstyle.alignment(), pstyle.isPalignment());
alignement_->setStyle(pstyle.alignment(), pstyle.isInhAlignment());
alignement_->setParentItem(parent->alignment());
 
bool hasParentTabs = pstyle.isPtabValues();
bool hasParentTabs = pstyle.isInhTabValues();
QValueList<ParagraphStyle::TabRecord> tabs;
if (hasParentTabs)
tabs = QValueList<ParagraphStyle::TabRecord>(parent->tabValues());
205,13 → 205,13
tabList_->setTabs(tabs, unitIndex, hasParentTabs);
tabList_->setParentTabs(parent->tabValues());
 
tabList_->setLeftIndentValue(pstyle.leftMargin(),pstyle.isPleftMargin());
tabList_->setLeftIndentValue(pstyle.leftMargin(),pstyle.isInhLeftMargin());
tabList_->setParentLeftIndent(parent->leftMargin());
 
tabList_->setFirstLineValue(pstyle.firstIndent(), pstyle.isPfirstIndent());
tabList_->setFirstLineValue(pstyle.firstIndent(), pstyle.isInhFirstIndent());
tabList_->setParentFirstLine(parent->firstIndent());
 
tabList_->setRightIndentValue(pstyle.rightMargin(), pstyle.isPrightMargin());
tabList_->setRightIndentValue(pstyle.rightMargin(), pstyle.isInhRightMargin());
tabList_->setParentRightIndent(parent->rightMargin());
}
else
249,9 → 249,9
if (hasParent)
{
cpage->parentCombo->insertItem( tr("Parent's Character Style"), 1);
if (pstyle.charStyle().hasParent() && pstyle.charStyle().parent()->hasName())
if (pstyle.charStyle().hasParent() && pstyle.charStyle().parentStyle()->hasName())
{
QString pname = pstyle.charStyle().parent()->name();
QString pname = pstyle.charStyle().parentStyle()->name();
for (int i = 2; i < cpage->parentCombo->count(); ++i)
{
if (cpage->parentCombo->text(i) == pname)
268,9 → 268,9
}
else
{
if (pstyle.charStyle().hasParent() && pstyle.charStyle().parent()->hasName())
if (pstyle.charStyle().hasParent() && pstyle.charStyle().parentStyle()->hasName())
{
QString pname = pstyle.charStyle().parent()->name();
QString pname = pstyle.charStyle().parentStyle()->name();
for (int i = 1; i < cpage->parentCombo->count(); ++i)
{
if (cpage->parentCombo->text(i) == pname)
544,41 → 544,41
{
disconnect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
bool hasParent = cstyle.hasParent();
const CharStyle *parent = dynamic_cast<const CharStyle*>(cstyle.parent());
const CharStyle *parent = dynamic_cast<const CharStyle*>(cstyle.parentStyle());
 
if (hasParent)
{
fontSize_->setValue(cstyle.fontSize() / 10.0, cstyle.isPfontSize());
fontSize_->setValue(cstyle.fontSize() / 10.0, cstyle.isInhFontSize());
fontSize_->setParentValue(parent->fontSize() / 10.0);
 
fontHScale_->setValue(cstyle.scaleH() / 10.0, cstyle.isPscaleH());
fontHScale_->setValue(cstyle.scaleH() / 10.0, cstyle.isInhScaleH());
fontHScale_->setParentValue(parent->scaleH() / 10.0);
 
fontVScale_->setValue(cstyle.scaleV() / 10.0, cstyle.isPscaleV());
fontVScale_->setValue(cstyle.scaleV() / 10.0, cstyle.isInhScaleV());
fontVScale_->setParentValue(parent->scaleV() / 10.0);
 
baselineOffset_->setValue(cstyle.baselineOffset() / 10.0, cstyle.isPbaselineOffset());
baselineOffset_->setValue(cstyle.baselineOffset() / 10.0, cstyle.isInhBaselineOffset());
baselineOffset_->setParentValue(parent->baselineOffset() / 10.0);
 
tracking_->setValue(cstyle.tracking() / 10.0, cstyle.isPtracking());
tracking_->setValue(cstyle.tracking() / 10.0, cstyle.isInhTracking());
tracking_->setParentValue(parent->tracking() / 10.0);
 
effects_->setStyle(static_cast<int>(cstyle.effects()), cstyle.isPeffects());
effects_->setStyle(static_cast<int>(cstyle.effects()), cstyle.isInhEffects());
effects_->setParentItem(static_cast<int>(parent->effects()));
 
fillShade_->setValue(cstyle.fillShade(), cstyle.isPfillShade());
fillShade_->setValue(cstyle.fillShade(), cstyle.isInhFillShade());
fillShade_->setParentValue(parent->fillShade());
 
strokeShade_->setValue(cstyle.strokeShade(), cstyle.isPstrokeShade());
strokeShade_->setValue(cstyle.strokeShade(), cstyle.isInhStrokeShade());
strokeShade_->setParentValue(parent->strokeShade());
 
fillColor_->setCurrentText(cstyle.fillColor(), cstyle.isPfillColor());
fillColor_->setCurrentText(cstyle.fillColor(), cstyle.isInhFillColor());
fillColor_->setParentText(parent->fillColor());
 
strokeColor_->setCurrentText(cstyle.strokeColor(), cstyle.isPstrokeColor());
strokeColor_->setCurrentText(cstyle.strokeColor(), cstyle.isInhStrokeColor());
strokeColor_->setParentText(parent->strokeColor());
 
fontFace_->setCurrentFont(cstyle.font().scName(), cstyle.isPfont());
fontFace_->setCurrentFont(cstyle.font().scName(), cstyle.isInhFont());
fontFace_->setParentFont(parent->font().scName());
}
else
620,7 → 620,7
int index = 0;
for (int i = 0; i < parentCombo->count(); ++i)
{
if (parentCombo->text(i) == cstyle.parent()->displayName())
if (parentCombo->text(i) == cstyle.parentStyle()->displayName())
{
index = i;
break;
649,7 → 649,7
 
if (hasParent)
{
language_->setCurrentItem(ci, cstyle.isPlanguage());
language_->setCurrentItem(ci, cstyle.isInhLanguage());
language_->setParentItem(pi);
}
else
/branches/Version13x/Scribus/scribus/fonts/scface.cpp
82,7 → 82,7
unicode emulate: spaces, hyphen, ligatures?, diacritics?
*****/
 
ScFace::ScFace()
ScFace::ScFace() : replacedName(), replacedInDoc()
{
m = new ScFaceData();
m->refs = 1;
108,7 → 108,7
}
 
 
ScFace::ScFace(ScFaceData* data)
ScFace::ScFace(ScFaceData* data) : replacedName(), replacedInDoc()
{
m = data;
m->refs = 1;
115,7 → 115,7
m->cachedStatus = ScFace::UNKNOWN;
}
 
ScFace::ScFace(const ScFace& other)
ScFace::ScFace(const ScFace& other) : replacedName(other.replacedName), replacedInDoc(other.replacedInDoc)
{
m = other.m;
++(m->refs);
139,6 → 139,7
delete m;
}
m = other.m;
replacedName = other.replacedName;
return *this;
}
 
148,7 → 149,8
*/
bool ScFace::operator==(const ScFace& other) const
{
return ( (isNone() && other.isNone() )
return replacedName == other.replacedName &&
( (isNone() && other.isNone() )
|| (m == other.m)
|| (m->family == other.m->family
&& m->style == other.m->style
/branches/Version13x/Scribus/scribus/fonts/scface.h
211,8 → 211,24
void unload() const;
/// the name Scribus uses for this font
QString scName() const { return m->scName; }
QString scName() const { return replacedName.isEmpty() ? m->scName : replacedName; }
/// the name of the font which was used for replacement
QString replacementName() const { return m->scName; }
/// the name of the font which was used for replacement
QString replacementForDoc() const { return replacedInDoc; }
/// check if this is a replacement font
bool isReplacement() const { return !replacedName.isEmpty(); }
/// makes a repalcement font for font "name" using this fonts data
ScFace mkReplacementFor(QString name, QString doc) {
ScFace result(m);
result.replacedName = name;
result.replacedInDoc = doc;
return result; }
 
/// the name PostScript uses for this font
QString psName() const { return m->psName; }
344,6 → 360,8
ScFace(ScFaceData* md);
ScFaceData* m;
QString replacedName;
QString replacedInDoc;
void initFaceData();
void checkAllGlyphs();
/branches/Version13x/Scribus/scribus/scribusXml.cpp
479,7 → 479,7
vg->setLineSpacing(pg->attribute("LINESP").toDouble());
vg->setLeftMargin(pg->attribute("INDENT", "0").toDouble());
vg->setFirstIndent(pg->attribute("FIRST", "0").toDouble());
vg->setAlignment(pg->attribute("ALIGN").toInt());
vg->setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg->attribute("ALIGN").toInt()));
vg->setGapBefore(pg->attribute("VOR", "0").toDouble());
vg->setGapAfter(pg->attribute("NACH", "0").toDouble());
tmpf = pg->attribute("FONT", doc->toolSettings.defFont);
512,13 → 512,14
vg->charStyle().setScaleV(qRound(pg->attribute("SCALEV", "100").toDouble() * 10));
vg->charStyle().setBaselineOffset(qRound(pg->attribute("BASEO", "0").toDouble() * 10));
vg->charStyle().setTracking(qRound(pg->attribute("KERN", "0").toDouble() * 10));
vg->tabValues().clear();
// vg->tabValues().clear();
if ((pg->hasAttribute("NUMTAB")) && (pg->attribute("NUMTAB", "0").toInt() != 0))
{
QValueList<ParagraphStyle::TabRecord> tbs;
ParagraphStyle::TabRecord tb;
QString tmp = pg->attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
vg->tabValues().clear();
tbs.clear();
for (int cxv = 0; cxv < pg->attribute("NUMTAB", "0").toInt(); cxv += 2)
{
tgv >> xf;
526,12 → 527,14
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
vg->tabValues().append(tb);
tbs.append(tb);
}
vg->setTabValues(tbs);
tmp = "";
}
else
{
QValueList<ParagraphStyle::TabRecord> tbs;
QDomNode IT = pg->firstChild();
while(!IT.isNull())
{
547,10 → 550,11
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
vg->tabValues().append(tb);
tbs.append(tb);
}
IT=IT.nextSibling();
}
vg->setTabValues(tbs);
}
for (uint xx=0; xx<docParagraphStyles.count(); ++xx)
{
1170,7 → 1174,7
UsedStyles.clear();
UsedMapped2Saved.clear();
ParagraphStyle vg;
if (doc->docParagraphStyles.count() > 5)
// if (doc->docParagraphStyles.count() > 5)
{
//for (uint co=0; co<Selitems->count(); ++co)
for (uint co=0; co<selection->count(); ++co)
/branches/Version13x/Scribus/scribus/edit1format.cpp
512,7 → 512,7
{
CharStyle charstyle;
charstyle.setEffects(static_cast<StyleFlag>(EffeS->getStyle()));
parstyle.setAlignment(AligS->getStyle());
parstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(AligS->getStyle()));
for (uint al = 0; al < lineSpacingPop->count(); ++al)
{
if (lineSpacingPop->isItemChecked(lineSpacingPop->idAt(al)))
537,7 → 537,7
charstyle.setFillShade(PM2->getValue());
charstyle.setStrokeColor(TxStroke->currentText());
charstyle.setStrokeShade(PM1->getValue());
parstyle.tabValues() = TabList->getTabVals();
parstyle.setTabValues(TabList->getTabVals());
charstyle.setShadowXOffset(qRound(EffeS->ShadowVal->Xoffset->value() * 10.0));
charstyle.setShadowYOffset(qRound(EffeS->ShadowVal->Yoffset->value() * 10.0));
charstyle.setOutlineWidth(qRound(EffeS->OutlineVal->LWidth->value() * 10.0));
/branches/Version13x/Scribus/scribus/pageitem.cpp
2893,7 → 2893,8
int styleid = state->getInt("OLD_STYLE");
if (!isUndo)
styleid = state->getInt("NEW_STYLE");
m_Doc->chAbStyle(this, styleid);
//will be done later with other text-undo:
// m_Doc->chAbStyle(this, styleid);
}
 
 
/branches/Version13x/Scribus/scribus/scribusview.cpp
5507,10 → 5507,10
Serializer *ss = new Serializer("");
ss->Objekt = cc;
int st = findParagraphStyle(Doc, Doc->currentStyle);
if (st > 5)
// if (st > 5)
ss->GetText(currItem, st, Doc->docParagraphStyles[st].charStyle().font().scName(), Doc->docParagraphStyles[st].charStyle().fontSize(), true);
else
ss->GetText(currItem, st, currItem->itemText.defaultStyle().charStyle().font().scName(), currItem->itemText.defaultStyle().charStyle().fontSize(), true);
// else
// ss->GetText(currItem, st, currItem->itemText.defaultStyle().charStyle().font().scName(), currItem->itemText.defaultStyle().charStyle().fontSize(), true);
delete ss;
ss=NULL;
if (Doc->docHyphenator->AutoCheck)
/branches/Version13x/Scribus/scribus/pageitem_textframe.cpp
194,14 → 194,14
{
qDebug(QString("%6%1/%2 @ %3: %4--%5")
.arg(pstyle.name())
.arg(pstyle.parent()? pstyle.parent()->name() : "-")
.arg(pstyle.parent())
.arg( (unsigned long int) &pstyle)
.arg(pstyle.leftMargin())
.arg(pstyle.rightMargin())
.arg(indent));
static QString more(" ");
if (pstyle.parent())
dumpIt(*dynamic_cast<const ParagraphStyle*>(pstyle.parent()), more + indent);
if (pstyle.hasParent())
dumpIt(*dynamic_cast<const ParagraphStyle*>(pstyle.parentStyle()), more + indent);
}
 
static const bool opticalMargins = true;
1724,7 → 1724,7
if ((m_Doc->appMode == modeEdit) && (Tinput))
{
// OwnPage->Deselect(true);
next->CPos = QMAX(nCP, nrc);
next->CPos = QMAX(nCP, signed(nrc));
// Doc->currentPage = NextBox->OwnPage;
// NextBox->OwnPage->SelectItemNr(NextBox->ItemNr);
// qDebug("textframe: len=%d, leaving relayout in editmode && Tinput", itemText.length());
4179,7 → 4179,7
Tinput = false;
if ((cr == QChar(13)) && (itemText.length() != 0))
{
m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(QMAX(CPos-1,0))));
// m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(QMAX(CPos-1,0))));
Tinput = false;
}
m_Doc->scMW()->setTBvals(this);
4208,7 → 4208,7
Tinput = false;
if ((cr == QChar(13)) && (itemText.length() != 0))
{
m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(QMAX(CPos-1,0))));
// m_Doc->chAbStyle(this, findParagraphStyle(m_Doc, itemText.paragraphStyle(QMAX(CPos-1,0))));
Tinput = false;
}
m_Doc->scMW()->setTBvals(this);
/branches/Version13x/Scribus/scribus/styles/charstyle.cpp
10,9 → 10,9
#include <qobject.h>
#include "sctextstruct.h"
#include "scfonts.h"
#include "style.h"
 
 
 
StyleFlag& operator&= (StyleFlag& left, StyleFlag right){
int result = static_cast<int>(left) & static_cast<int>(right);
left = static_cast<StyleFlag>(result);
65,7 → 65,7
{
Style::eraseStyle(other);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && m_##attr_NAME == other.##attr_GETTER()) \
if (!inh_##attr_NAME && m_##attr_NAME == other.attr_GETTER()) \
reset##attr_NAME();
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
75,10 → 75,10
{
const CharStyle * oth = dynamic_cast<const CharStyle*> ( & other );
return oth &&
parent == oth->parent() &&
parent() == oth->parent()
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
inh_##attr_NAME == oth->inh_##attr_NAME &&\
(inh_##attr_NAME || m_##attr_NAME == oth->m_##attr_NAME) &&
&& (inh_##attr_NAME == oth->inh_##attr_NAME) \
&& (inh_##attr_NAME || m_##attr_NAME == oth->m_##attr_NAME)
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
;
110,10 → 110,10
result += QObject::tr("+color ");
if ( !inh_UnderlineWidth || !inh_UnderlineOffset )
result += underlineWidth() > 0 ? QObject::tr("+underline ") : QObject::tr("-underline ");
if ( !inh_StrikethruWidth || !inh_StrikethruPos )
if ( !inh_StrikethruWidth || !inh_StrikethruOffset )
result += strikethruWidth() > 0 ? QObject::tr("+strikeout ") : QObject::tr("-strikeout ");
if ( !inh_ShadowXOffset || !inh_ShadowYOffset )
result += shadowXOffset() != 0 || shadowYOffset != 0 ? QObject::tr("+shadow ") : QObject::tr("-shadow ");
result += shadowXOffset() != 0 || shadowYOffset() != 0 ? QObject::tr("+shadow ") : QObject::tr("-shadow ");
if ( !inh_OutlineWidth )
result += outlineWidth() > 0 ? QObject::tr("+outline ") : QObject::tr("-outline ");
if ( !inh_Tracking )
135,7 → 135,7
if (oth) {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (inh_##attr_NAME) \
m_##attr_NAME = oth->##attr_GETTER;
m_##attr_NAME = oth->attr_GETTER();
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
}
/branches/Version13x/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
1,4 → 1,19
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
 
//Syntax: ATTRDEF( datatype, gettername, name, defaultvalue)
 
ATTRDEF(ParagraphStyle::LineSpacingMode, lineSpacingMode, LineSpacingMode, ParagraphStyle::FixedLineSpacing)
13,4 → 28,6
ATTRDEF(int, dropCapLines, DropCapLines, 0)
ATTRDEF(bool, hasDropCap, HasDropCap, false)
ATTRDEF(double, dropCapOffset, DropCapOffset, 0.0)
ATTRDEF(bool, useBaselineGrid, UseBaselineGrid, false)
ATTRDEF(bool, useBaselineGrid, UseBaselineGrid, false)
 
 
/branches/Version13x/Scribus/scribus/styles/styleset.h
5,24 → 5,32
 
#include <assert.h>
#include <qvaluelist.h>
#include "style.h"
 
template<class STYLE>
class StyleSet {
class StyleSet : public StyleBase {
public:
STYLE& operator[] (uint index) { assert(index < styles.count()); return * styles[index]; }
const STYLE& operator[] (size_t index) const { assert(index < styles.count()); return * styles[index]; }
const STYLE& operator[] (uint index) const { assert(index < styles.count()); return * styles[index]; }
inline int find(QString name);
inline const Style* resolve(QString name) const;
uint count() const { return (uint) styles.count(); }
void append(STYLE* style) { styles.append(style); }
inline void remove(uint index, const STYLE* with = NULL);
inline void redefine(QValueList<STYLE> defs, bool removeUnused=false);
void create(const STYLE& proto) { styles.append(new STYLE(proto)); }
StyleSet() : styles() {}
StyleSet() : styles(), m_base(NULL), m_baseversion(-1) {}
~StyleSet() { while(styles.count()>0) { delete styles.front(); styles.pop_front(); } }
 
void setBase(StyleBase* base) { m_base = base; m_baseversion = -1; }
StyleBase* base() { return m_base; }
private:
StyleSet(const StyleSet&) {}
StyleSet& operator= (const StyleSet&) { return *this; }
QValueList<STYLE*> styles;
StyleBase* m_base;
int m_baseversion;
};
 
template<class STYLE>
30,10 → 38,9
{
assert(index < styles.count());
typename QValueList<STYLE*>::Iterator it = styles.at(index);
if (!with)
with = dynamic_cast<const STYLE*>((*it)->parent());
(*it)->erase();
(*it)->setParent(with);
if (with)
(*it)->setParent(with->name());
}
 
template<class STYLE>
46,6 → 53,15
}
 
template<class STYLE>
inline const Style* StyleSet<STYLE>::resolve(QString name) const
{
for (uint i=0; i < styles.count(); ++i)
if (styles[i]->name() == name)
return styles[i];
return m_base ? m_base->resolve(name) : NULL;
}
 
template<class STYLE>
inline void StyleSet<STYLE>::redefine(QValueList<STYLE> defs, bool removeUnused)
{
for (int i=signed(styles.count())-1; i >=0; --i) {
/branches/Version13x/Scribus/scribus/styles/charstyle.h
113,13 → 113,24
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
/** isInherited: returns true if the attriute is inherited */
/** isInherited: returns true if the attribute is inherited */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
bool isInh##attr_NAME() { return inh_##attr_NAME; }
bool isInh##attr_NAME() const { return inh_##attr_NAME; }
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
/** isDefined: returns true if the attribute is defined in this style or any parent */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
bool isDef##attr_NAME() const { \
if (inh_##attr_NAME) return true; \
const CharStyle * par = dynamic_cast<const CharStyle*>(parentStyle()); \
return par && par->isDef##attr_NAME(); \
}
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
private:
 
// member declarations:
/branches/Version13x/Scribus/scribus/styles/paragraphstyle.cpp
1,7 → 1,27
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
 
ParagraphStyle::ParagraphStyle() : Style(), cstyle()
 
 
#include "style.h"
 
ParagraphStyle::ParagraphStyle() : Style(), StyleBaseProxy(PAR_LEVEL, &cstyle), cstyle()
{
const Style* cdefault = resolve("");
qDebug(QString("ParagraphStyle() %1 pbase %2 cbase %3").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(base())).arg(reinterpret_cast<uint>(cdefault->base())));
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
m_##attr_NAME = attr_DEFAULT; \
inh_##attr_NAME = true;
10,8 → 30,10
}
 
 
ParagraphStyle::ParagraphStyle(const ParagraphStyle& other) : Style(other), cstyle(other.charStyle())
ParagraphStyle::ParagraphStyle(const ParagraphStyle& other) : Style(other), StyleBaseProxy(PAR_LEVEL, &cstyle), cstyle(other.charStyle())
{
qDebug(QString("ParagraphStyle(%2) %1").arg(reinterpret_cast<uint>(&other)).arg(reinterpret_cast<uint>(this)));
 
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
m_##attr_NAME = other.m_##attr_NAME; \
inh_##attr_NAME = other.inh_##attr_NAME;
31,7 → 53,7
}
 
namespace {
bool operator==(const QValueList<ParagraphStyle::TabRecord>& tabs, const QValueList<ParagraphStyle::TabRecord>& other)
bool sametabs(const QValueList<ParagraphStyle::TabRecord>& tabs, const QValueList<ParagraphStyle::TabRecord>& other)
{
ParagraphStyle::TabRecord tb;
bool tabEQ = false;
44,6 → 66,7
tb.tabPosition = other[t1].tabPosition;
tb.tabType = other[t1].tabType;
tb.tabFillChar = other[t1].tabFillChar;
tabEQ = false;
for (uint t2 = 0; t2 < tabs.count(); t2++)
{
ParagraphStyle::TabRecord tb2;
56,7 → 79,7
break;
}
}
if (tabEQ)
if (!tabEQ)
break;
}
}
69,10 → 92,10
{
const ParagraphStyle* oth = dynamic_cast<const ParagraphStyle*> ( & other );
return oth &&
parent == oth->parent() &&
parent() == oth->parent()
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
inh_##attr_NAME == oth->inh_##attr_NAME &&\
(inh_##attr_NAME || m_##attr_NAME == oth->m_##attr_NAME) &&
&& (inh_##attr_NAME == oth->inh_##attr_NAME) \
&& (inh_##attr_NAME || m_##attr_NAME == oth->m_##attr_NAME)
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
;
82,13 → 105,14
 
ParagraphStyle& ParagraphStyle::operator=(const ParagraphStyle& other)
{
static_cast<Style&>(*this) = static_cast<const Style&>(other);
static_cast<StyleBaseProxy&>(*this) = static_cast<const StyleBaseProxy&>(other);
cstyle = other.charStyle();
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
m_##attr_NAME = oth->m_##attr_NAME; \
inh_##attr_NAME = oth->inh_##attr_NAME);
m_##attr_NAME = other.m_##attr_NAME; \
inh_##attr_NAME = other.inh_##attr_NAME;
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
static_cast<Style&>(*this) = static_cast<const Style&>(other);
return *this;
}
 
101,7 → 125,7
if (oth) {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (inh_##attr_NAME) \
m_##attr_NAME = oth->##attr_GETTER;
m_##attr_NAME = oth->attr_GETTER();
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
}
126,7 → 150,7
Style::eraseStyle(other);
cstyle.eraseCharStyle(other.charStyle());
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && m_##attr_NAME == other.##attr_GETTER()) \
if (!inh_##attr_NAME && m_##attr_NAME == other.attr_GETTER()) \
reset##attr_NAME();
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
/branches/Version13x/Scribus/scribus/styles/charstyle.attrdefs.cxx
1,4 → 1,19
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
 
 
//Syntax: ATTRDEF( datatype, gettername, name, defaultvalue)
 
ATTRDEF(int, fontSize, FontSize, 10)
20,3 → 35,4
ATTRDEF(QString, strokeColor, StrokeColor, "black")
ATTRDEF(QString, language, Language, "")
ATTRDEF(ScFace, font, Font, ScFace::none())
 
/branches/Version13x/Scribus/scribus/styles/paragraphstyle.h
16,7 → 16,7
 
// DONT INCLUDE this file directly, include "style.h" instead!
 
class SCRIBUS_API ParagraphStyle : public virtual Style
class SCRIBUS_API ParagraphStyle : public virtual Style, public StyleBaseProxy
{
public:
enum LineSpacingMode {
36,6 → 36,13
double tabPosition;
int tabType;
QChar tabFillChar;
bool operator==(const TabRecord& other) const {
return tabPosition==other.tabPosition && tabType==other.tabType && tabFillChar == other.tabFillChar;
}
bool operator<(const TabRecord& other) const { return tabPosition < other.tabPosition; }
bool operator<=(const TabRecord& other) const { return tabPosition <= other.tabPosition; }
bool operator>(const TabRecord& other) const { return tabPosition > other.tabPosition; }
bool operator>=(const TabRecord& other) const { return tabPosition >= other.tabPosition; }
};
 
ParagraphStyle();
79,11 → 86,22
/** isInherited: returns true if the attriute is inherited */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
bool isInh##attr_NAME() { return inh_##attr_NAME; }
bool isInh##attr_NAME() const { return inh_##attr_NAME; }
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
/** isDefined: returns true if the attribute is defined in this style or any parent */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
bool isDef##attr_NAME() const { \
if (inh_##attr_NAME) return true; \
const ParagraphStyle * par = dynamic_cast<const ParagraphStyle*>(parentStyle()); \
return par && par->isDef##attr_NAME(); \
}
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
private:
// member declarations:
/branches/Version13x/Scribus/scribus/styles/CMakeLists.txt
0,0 → 1,13
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/scribus
)
 
 
SET(SCRIBUS_STYLES_LIB_SOURCES
charstyle.cpp
paragraphstyle.cpp
)
 
SET(SCRIBUS_STYLES_LIB "scribus_styles_lib")
ADD_LIBRARY(${SCRIBUS_STYLES_LIB} STATIC ${SCRIBUS_STYLES_LIB_SOURCES})
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/text/storytext.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/text/storytext.cpp (revision 6732)
+++ branches/Version13x/Scribus/scribus/text/storytext.cpp (revision 6733)
@@ -24,18 +24,30 @@
//QChar SpecialChars::SPACE = QChar(32);
+
class ScText_Shared : public QPtrList<ScText>
{
public:
ParagraphStyle defaultStyle;
+ StyleBaseProxy pstyleBase;
uint refs;
uint len;
- ScText_Shared() : QPtrList<ScText>(), defaultStyle(), refs(1), len(0)
- {
- setAutoDelete(true);
+ ScText_Shared(StyleBase* pstyles, StyleBase* cstyles) : QPtrList<ScText>(),
+ defaultStyle(),
+ pstyleBase(StyleBase::STORY_LEVEL, & defaultStyle),
+ refs(1), len(0)
+ {
+ setAutoDelete(true);
+ defaultStyle.setBase( pstyles );
+ defaultStyle.charStyle().setBase( cstyles );
+ qDebug(QString("ScText_Shared() %1 %2 %3 %4").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(&defaultStyle)).arg(reinterpret_cast<uint>(pstyles)).arg(reinterpret_cast<uint>(cstyles)));
}
+
+
ScText_Shared(const ScText_Shared& other) : QPtrList<ScText>(),
- defaultStyle(other.defaultStyle), refs(1), len(0)
+ defaultStyle(other.defaultStyle),
+ pstyleBase(other.pstyleBase),
+ refs(1), len(0)
{
setAutoDelete(true);
QPtrListIterator<ScText> it( other );
@@ -44,12 +56,17 @@
++it;
ScText* elem2 = new ScText(*elem);
append(elem2);
- if (elem->parstyle)
- replaceParentStyle(count()-1, & elem->parstyle->charStyle(), & elem2->parstyle->charStyle());
+ if (elem2->parstyle) {
+ elem2->parstyle->setBase( & pstyleBase);
+ elem2->parstyle->charStyle().setBase( & defaultStyle);
+ replaceCharStyleBaseInParagraph(count()-1, elem2->parstyle);
+ }
}
len = count();
- replaceParentStyle(len, & other.defaultStyle.charStyle(), & defaultStyle.charStyle());
+ replaceCharStyleBaseInParagraph(len, & defaultStyle);
+ qDebug(QString("ScText_Shared(%2) %1").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(&other)));
}
+
ScText_Shared& operator= (const ScText_Shared& other)
{
clear();
@@ -59,21 +76,30 @@
++it;
ScText* elem2 = new ScText(*elem);
append(elem2);
- if (elem->parstyle)
- replaceParentStyle(count()-1, & elem->parstyle->charStyle(), & elem2->parstyle->charStyle());
+ if (elem2->parstyle) {
+ elem2->parstyle->setBase( & pstyleBase);
+ elem2->parstyle->charStyle().setBase( & defaultStyle);
+ replaceCharStyleBaseInParagraph(count()-1, elem2->parstyle);
+ }
}
len = count();
defaultStyle = other.defaultStyle;
- replaceParentStyle(len, & other.defaultStyle.charStyle(), & defaultStyle.charStyle());
+ replaceCharStyleBaseInParagraph(len, & defaultStyle);
refs = 1;
+ qDebug(QString("ScText_Shared: %1 = %2").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(&other)));
return *this;
}
+
+ ~ScText_Shared() {
+ qDebug(QString("~ScText_Shared() %1").arg(reinterpret_cast<uint>(this)));
+ }
+
/**
- A CharStyle's parent is usually the charstyle of default paragraphstyle,
- unless explicitly changed. This routines makes sure that all parent pointers
- to the default paragraphStyle's charstyle are up-to-date
+ A char's stylebase is the containing paragraph's style,
+ This routines makes sure that all charstyles look for defaults
+ in the parstyle first.
*/
- void replaceParentStyle(int pos, const CharStyle* oldP, const CharStyle* newP)
+ void replaceCharStyleBaseInParagraph(int pos, const StyleBase* newBase)
{
QPtrListIterator<ScText> it( *this );
it += (pos-1);
@@ -81,8 +107,7 @@
while ( (elem = it.current()) != NULL ) {
if (elem->ch[0] == SpecialChars::PARSEP)
break;
- else if (elem->parent() == NULL || elem->parent() == oldP)
- elem->setParent(newP);
+ elem->setBase(newBase);
--it;
}
}
@@ -91,13 +116,18 @@
StoryText::StoryText(ScribusDoc * doc_) : doc(doc_)
{
- d = new ScText_Shared();
+ if (doc_) {
+ d = new ScText_Shared(&doc_->docParagraphStyles, &doc_->docCharStyles);
+ }
+ else {
+ d = new ScText_Shared(NULL, NULL);
+ }
clear();
}
StoryText::StoryText() : doc(NULL)
{
- d = new ScText_Shared();
+ d = new ScText_Shared(NULL, NULL);
}
StoryText::StoryText(const StoryText & other) : doc(other.doc)
@@ -185,11 +215,7 @@
firstFrameItem = 0;
lastFrameItem = -1;
- d->defaultStyle = ParagraphStyle();
- if (doc) {
- d->defaultStyle.setParent( & doc->docParagraphStyles[0]);
- d->defaultStyle.charStyle().setParent( & doc->docParagraphStyles[0].charStyle());
- }
+ d->defaultStyle.erase();
for (ScText *it = d->first(); it != 0; it = d->next())
{
@@ -250,12 +276,12 @@
static void insertParSep(StoryText* that, ScText_Shared* d, int pos)
{
ScText* it = that->item(pos);
- const ParagraphStyle& pstyle(that->paragraphStyle(pos));
- if(!it->parstyle)
- it->parstyle = new ParagraphStyle(pstyle);
- const CharStyle* oldP = & pstyle.charStyle();
- const CharStyle* newP = & it->parstyle->charStyle();
- d->replaceParentStyle(pos, oldP, newP);
+ if(!it->parstyle) {
+ it->parstyle = new ParagraphStyle();
+ it->parstyle->setBase( & d->pstyleBase);
+ it->parstyle->charStyle().setBase( & d->defaultStyle);
+ }
+ d->replaceCharStyleBaseInParagraph(pos, it->parstyle);
}
/**
need to remove the ParagraphStyle structure and replace all pointers
@@ -265,12 +291,13 @@
{
ScText* it = that->item(pos);
if (it->parstyle) {
- const CharStyle* oldP = & it->parstyle->charStyle();
- const CharStyle* newP = & that->paragraphStyle(pos+1).charStyle();
- d->replaceParentStyle(pos, oldP, newP);
+// const CharStyle* oldP = & it->parstyle->charStyle();
+// const CharStyle* newP = & that->paragraphStyle(pos+1).charStyle();
+// d->replaceParentStyle(pos, oldP, newP);
delete it->parstyle;
it->parstyle = 0;
}
+ d->replaceCharStyleBaseInParagraph(pos, & that->paragraphStyle(pos+1));
}
void StoryText::removeChars(int pos, uint len)
@@ -314,7 +341,7 @@
return;
const CharStyle style = pos == 0 ? defaultStyle().charStyle() : charStyle(pos - 1);
- assert( !style.font().isNone() );
+// assert( !style.font().isNone() );
// const int paraStyle = pos == 0 ? 0 : at(pos - 1)->cab;
@@ -325,7 +352,7 @@
d->insert(pos + i, item);
d->len++;
if (item->ch[0] == SpecialChars::PARSEP) {
-// qDebug(QString("new PARSEP %2 at %1").arg(pos).arg(paragraphStyle(pos).name()));
+ qDebug(QString("new PARSEP %2 at %1").arg(pos).arg(paragraphStyle(pos).name()));
insertParSep(this, this->d, pos + i);
}
}
@@ -462,6 +489,8 @@
assert(pos >= 0);
assert(pos <= length());
+ assert(d);
+
StoryText * that = const_cast<StoryText *> (this);
// assert( that->at(pos)->cab >= 0 );
// assert( that->at(pos)->cab < doc->docParagraphStyles.count() );
@@ -479,17 +508,19 @@
else if ( !that->d->current()->parstyle ) {
qDebug(QString("inserting default parstyle at %1").arg(pos));
that->d->current()->parstyle = new ParagraphStyle();
- that->d->current()->parstyle->setParent( & that->d->defaultStyle);
- that->d->current()->parstyle->charStyle().setParent( & that->d->defaultStyle.charStyle() );
+ that->d->current()->parstyle->setBase( & d->pstyleBase);
+ that->d->current()->parstyle->charStyle().setBase( & d->defaultStyle);
}
else {
// qDebug(QString("using parstyle at %1").arg(pos));
}
+ assert (that->d->current()->parstyle);
return *that->d->current()->parstyle;
}
const ParagraphStyle& StoryText::defaultStyle() const
{
+ assert(d);
return d->defaultStyle;
}
@@ -496,13 +527,11 @@
void StoryText::setDefaultStyle(const ParagraphStyle& style)
{
+ const StyleBase * oldPBase = d->defaultStyle.base();
+ const StyleBase * oldCBase = d->defaultStyle.charStyle().base();
d->defaultStyle = style;
- if (doc) {
- if (!d->defaultStyle.parent())
- d->defaultStyle.setParent( & doc->docParagraphStyles[0] );
- if (!d->defaultStyle.charStyle().parent())
- d->defaultStyle.charStyle().setParent( & doc->docParagraphStyles[0].charStyle() );
- }
+ d->defaultStyle.setBase( oldPBase );
+ d->defaultStyle.charStyle().setBase( oldCBase );
}
@@ -581,15 +610,11 @@
if (!d->at(i)->parstyle) {
qDebug(QString("PARSEP without style at pos %1").arg(i));
d->at(i)->parstyle = new ParagraphStyle();
+ d->at(i)->parstyle->setBase( & d->pstyleBase);
+ d->at(i)->parstyle->charStyle().setBase( & d->defaultStyle);
}
// qDebug(QString("applying parstyle %2 at %1 for %3").arg(i).arg(paragraphStyle(pos).name()).arg(pos));
d->at(i)->parstyle->applyStyle(style);
- if (!d->at(i)->parstyle->parent()) {
- d->at(i)->parstyle->setParent( & d->defaultStyle );
- }
- if (!d->at(i)->parstyle->charStyle().parent()) {
- d->at(i)->parstyle->charStyle().setParent( & d->defaultStyle.charStyle() );
- }
}
else {
// not happy about this but inserting a new PARSEP makes more trouble
@@ -614,15 +639,11 @@
if (!d->at(i)->parstyle) {
qDebug(QString("PARSEP without style at pos %1").arg(i));
d->at(i)->parstyle = new ParagraphStyle();
+ d->at(i)->parstyle->setBase( & d->pstyleBase);
+ d->at(i)->parstyle->charStyle().setBase( & d->defaultStyle);
}
// qDebug(QString("applying parstyle %2 at %1 for %3").arg(i).arg(paragraphStyle(pos).name()).arg(pos));
d->at(i)->parstyle->eraseStyle(style);
- if (!d->at(i)->parstyle->parent()) {
- d->at(i)->parstyle->setParent( & d->defaultStyle );
- }
- if (!d->at(i)->parstyle->charStyle().parent()) {
- d->at(i)->parstyle->charStyle().setParent( & d->defaultStyle.charStyle() );
- }
}
else {
// not happy about this but inserting a new PARSEP makes more trouble
@@ -632,6 +653,21 @@
}
+void StoryText::setStyle(int pos, const ParagraphStyle& style)
+{
+ eraseStyle(pos, paragraphStyle(pos));
+ applyStyle(pos, style);
+}
+
+
+void StoryText::setCharStyle(int pos, uint len, const CharStyle& style)
+{
+ // FIXME
+ eraseCharStyle(pos, len, charStyle(pos));
+ applyCharStyle(pos, len, style);
+}
+
+
uint StoryText::nrOfParagraphs() const
{
uint result = 0;
/branches/Version13x/Scribus/scribus/text/storytext.h
107,6 → 107,8
const ParagraphStyle& paragraphStyle(int pos) const;
const ParagraphStyle& defaultStyle() const;
void setDefaultStyle(const ParagraphStyle& style);
void setCharStyle(int pos, uint len, const CharStyle& style);
void setStyle(int pos, const ParagraphStyle& style);
void applyCharStyle(int pos, uint len, const CharStyle& style);
void applyStyle(int pos, const ParagraphStyle& style);
void eraseCharStyle(int pos, uint len, const CharStyle& style);
/branches/Version13x/Scribus/scribus/style.h
17,6 → 17,7
#ifndef STYLE_H
#define STYLE_H
 
#include <cassert>
#include <qstring.h>
#include <qvaluelist.h>
#include "scfonts.h"
23,417 → 24,222
#include "scribusapi.h"
 
 
 
class Style;
 
 
/**
* This as a virtual base class for all style-like objects: CharStyles,
* ParagraphStyles(indirectly), LineStyles, FrameStyles, CellStyles,
* FlowStyles,...
* It provides a name and an inheritance mechanism.
*/
class Style {
private:
QString name_;
const Style* parent_;
Style inheritance works with names. A StyleBase finds the Style to a given name.
If there are changes to the Styles contained in a StyleBase, you have to call
invalidate() to increase the version info. Styles using this StyleBase will then
update their cached values the next time they are used.
*/
class StyleBase {
public:
static const short NOVALUE = -16000;
static const int DOC_LEVEL = 1;
static const int STORY_LEVEL = 1024;
static const int PAR_LEVEL = 1024 * 1024;
 
Style(): name_(""),parent_(NULL) {}
Style(QString n): name_(n), parent_(NULL) {}
Style& operator=(const Style& o)
{ //assert(typeinfo() == o.typeinfo());
name_ = o.name_; parent_ = o.parent_; return *this;
StyleBase(int level = DOC_LEVEL)
: m_version(0), m_level(level)
{
qDebug(QString("constr. %1 /%2").arg(reinterpret_cast<uint>(this),16).arg(m_level));
}
Style(const Style& o) : name_(o.name_), parent_(o.parent_) {}
StyleBase(const StyleBase& o)
: m_version(o.m_version), m_level(o.m_level)
{
qDebug(QString("constr. cp %1 /%2").arg(reinterpret_cast<uint>(this),16).arg(m_level));
}
QString name() const { return name_; }
void setName(QString n) { name_ = n; }
bool hasName() const { return ! name_.isEmpty(); }
const Style* parent() const { return parent_; }
void setParent(const Style* p) { parent_ = p; }
bool hasParent() const { return parent_ != NULL; }
virtual ~Style() {}
virtual QString displayName() const { return name(); }
// virtual bool definesAll() const = 0;
// virtual bool inheritsAll() const = 0;
virtual bool equiv(const Style& other) const = 0;
virtual bool operator==(const Style& other) const { return name() == other.name() && equiv(other); }
virtual bool operator!=(const Style& other) const { return ! ( (*this) == other ); }
virtual void erase() = 0;
// applyStyle(const SubStyle& other)
// eraseStyle(const SubStyle& other)
// assign(const SubStyle& other)
};
 
StyleBase& operator= (const StyleBase& o)
{
m_version = o.m_version;
m_level = o.m_level;
return *this;
}
virtual int version() const { return m_version; }
void invalidate() { m_version += m_level; }
virtual const Style* resolve(QString name) const = 0;
virtual ~StyleBase()
{
qDebug(QString("destr. %1").arg(reinterpret_cast<uint>(this),16));
}
 
 
 
enum StyleFlag {
ScStyle_Default = 0,
ScStyle_Superscript = 1,
ScStyle_Subscript = 2,
ScStyle_Outline = 4,
ScStyle_Underline = 8,
ScStyle_Strikethrough = 16,
ScStyle_AllCaps = 32,
ScStyle_SmallCaps = 64,
ScStyle_HyphenationPossible=128, //Hyphenation possible here (Smart Hyphen)
ScStyle_Shadowed = 256,
ScStyle_UnderlineWords= 512,
ScStyle_Reserved01 = 1024, //free, not used in the moment
ScStyle_DropCap = 2048,
ScStyle_SuppressSpace = 4096,//internal use in PageItem (Suppresses spaces when in Block alignment)
ScStyle_SmartHyphenVisible=8192, //Smart Hyphen visible at line end
ScStyle_StartOfLine = 16384,
ScStyle_UserStyles = 2047, // 1919, // == 1024 + 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
ScStyle_None = 65535
protected:
int m_version;
int m_level;
};
 
SCRIBUS_API StyleFlag& operator&= (StyleFlag& left, StyleFlag right);
 
SCRIBUS_API StyleFlag& operator|= (StyleFlag& left, StyleFlag right);
 
SCRIBUS_API StyleFlag operator& (StyleFlag left, StyleFlag right);
/**
* This as a virtual base class for all style-like objects: CharStyles,
* ParagraphStyles(indirectly), LineStyles, FrameStyles, CellStyles,
* FlowStyles,...
* It provides a name and an inheritance mechanism which uses a StyleBase.
* Before any attribute is queried, you have to call validate(), which checks
* the stored m_baseversion against the StyleBase's version and updates all
* attributes if they are different.
*/
class Style {
protected:
QString m_name;
const StyleBase* m_base;
int m_baseversion;
QString m_parent;
public:
// static const short NOVALUE = -16000;
 
SCRIBUS_API StyleFlag operator| (StyleFlag left, StyleFlag right);
Style(): m_name(""), m_base(NULL), m_baseversion(-1), m_parent() {}
 
SCRIBUS_API StyleFlag operator^ (StyleFlag left, StyleFlag right);
 
SCRIBUS_API StyleFlag operator~ (StyleFlag arg);
 
 
 
 
class SCRIBUS_API CharStyle : public virtual Style {
public:
static const QString NOCOLOR;
static const QString NOLANG;
Style(StyleBase* b, QString n): m_name(n), m_base(b), m_baseversion(-1), m_parent() {}
CharStyle() : Style(), cfont(ScFace::none()) {
csize = NOVALUE;
cshade = NOVALUE;
cshade2 = NOVALUE;
cstyle = ScStyle_None;
cscale = NOVALUE;
cscalev = NOVALUE;
cbase = NOVALUE;
cshadowx = NOVALUE;
cshadowy = NOVALUE;
coutline = NOVALUE;
cunderpos = NOVALUE;
cunderwidth = NOVALUE;
cstrikepos = NOVALUE;
cstrikewidth = NOVALUE;
cextra = NOVALUE;
ccolor = NOCOLOR;
cstroke = NOCOLOR;
language_ = NOLANG;
};
Style& operator=(const Style& o)
{ //assert(typeinfo() == o.typeinfo());
m_name = o.m_name;
m_base = o.m_base;
m_baseversion = o.m_baseversion;
m_parent = o.m_parent;
return *this;
}
CharStyle(const ScFace& font, int size, StyleFlag style = ScStyle_Default) : Style(), cfont(font) {
csize = size;
cshade = 1;
cshade2 = 1;
cstyle = style;
cscale = 1000;
cscalev = 1000;
cbase = 0;
cshadowx = 0;
cshadowy = 0;
coutline = 0;
cunderpos = 0;
cunderwidth = 0;
cstrikepos = 0;
cstrikewidth = 0;
cextra = 0;
ccolor = "Black";
cstroke = "Black";
language_ = "";
};
Style(const Style& o) : m_name(o.m_name),
m_base(o.m_base), m_baseversion(o.m_baseversion), m_parent(o.m_parent) {}
CharStyle(const CharStyle & other);
virtual ~Style() {}
 
QString name() const { return m_name; }
void setName(QString n) { m_name = n; }
bool hasName() const { return ! m_name.isEmpty(); }
 
virtual QString displayName() const {
if ( hasName() || !hasParent() || !m_base)
return name();
// else if ( inheritsAll() )
// return parent()->displayName();
else
return parentStyle()->displayName();
}
CharStyle & operator=(const CharStyle & other);
QString parent() const { return m_parent; }
void setParent(QString p) { m_parent = p; }
bool hasParent() const { return ! m_parent.isEmpty(); }
const Style* parentStyle() const { qDebug(QString("follow %1").arg(reinterpret_cast<uint>(m_base),16));
return m_base ? m_base->resolve(m_parent) : NULL; }
void applyCharStyle(const CharStyle & other);
void eraseCharStyle(const CharStyle & other);
void erase() { eraseCharStyle(*this); }
QString displayName() const;
// bool definesAll() const;
// bool inheritsAll() const;
bool equiv(const Style& other) const;
QString asString() const;
void setBase(const StyleBase* base) { m_base = base; m_baseversion = -1;
qDebug(QString("setBase of %2 base %1").arg(reinterpret_cast<uint>(m_base),16).arg(reinterpret_cast<uint>(this),16));
}
const StyleBase* base() const { return m_base; }
int fontSize() const { return csize==NOVALUE && parent()? inh().fontSize() : csize; }
int fillShade() const { return cshade==NOVALUE && parent()? inh().fillShade() : cshade; }
int strokeShade() const { return cshade2==NOVALUE && parent()? inh().strokeShade() : cshade2; }
StyleFlag effects() const { return cstyle==ScStyle_None && parent()? inh().effects() : cstyle; }
int scaleH() const { return cscale==NOVALUE && parent()? inh().scaleH() : cscale; }
int scaleV() const { return cscalev==NOVALUE && parent()? inh().scaleV() : cscalev; }
int baselineOffset() const { return cbase==NOVALUE && parent()? inh().baselineOffset() : cbase; }
int shadowXOffset() const { return cshadowx==NOVALUE && parent()? inh().shadowXOffset() : cshadowx; }
int shadowYOffset() const { return cshadowy==NOVALUE && parent()? inh().shadowYOffset() : cshadowy; }
int outlineWidth() const { return coutline==NOVALUE && parent()? inh().outlineWidth() : coutline; }
int underlineOffset() const { return cunderpos==NOVALUE && parent()? inh().underlineOffset() : cunderpos; }
int underlineWidth() const { return cunderwidth==NOVALUE && parent()? inh().underlineWidth() : cunderwidth; }
int strikethruOffset() const { return cstrikepos==NOVALUE && parent()? inh().strikethruOffset() : cstrikepos; }
int strikethruWidth() const { return cstrikewidth==NOVALUE && parent()? inh().strikethruWidth() : cstrikewidth; }
int tracking() const { return cextra==NOVALUE && parent()? inh().tracking() : cextra; }
/**
sets a new StyleBase if b is not NULL and then uses the StyleBase
to set all inherited attributes to their valid value.
*/
virtual void update(const StyleBase* b = NULL)
{
qDebug(QString("update %2 base %1").arg(reinterpret_cast<uint>(m_base),16).arg(reinterpret_cast<uint>(this),16));
if (b)
m_base = b;
if (m_base)
m_baseversion = m_base->version();
}
QString fillColor() const { return ccolor==NOCOLOR && parent()? inh().fillColor() : ccolor; }
QString strokeColor() const { return cstroke==NOCOLOR && parent()? inh().strokeColor() : cstroke; }
QString language() const { return language_==NOLANG && parent()? inh().language() : language_; }
/**
Checks if this Style needs an update
*/
void validate() const
{
qDebug(QString("validate %2 base %1").arg(reinterpret_cast<uint>(m_base),16).arg(reinterpret_cast<uint>(this),16));
if (m_base && m_baseversion != m_base->version())
const_cast<Style*>(this)->update(m_base);
}
 
const ScFace& font() const { return cfont.isNone() && parent()? inh().font() : cfont; }
void setFontSize(int s) { csize = s; }
void setFillShade(int s) { cshade = s; }
void setStrokeShade(int s) { cshade2 = s; }
void setEffects(StyleFlag e) { cstyle = e; }
void setScaleH(int s) { cscale = s; }
void setScaleV(int s) { cscalev = s; }
void setBaselineOffset(int o) { cbase = o; }
void setShadowXOffset(int o) { cshadowx = o; }
void setShadowYOffset(int o) { cshadowy = o; }
void setOutlineWidth(int w) { coutline = w; }
void setUnderlineOffset(int o) { cunderpos = o; }
void setUnderlineWidth(int w) { cunderwidth = w; }
void setStrikethruOffset(int o) { cstrikepos = o; }
void setStrikethruWidth(int w) { cstrikewidth = w; }
void setTracking(int t) { cextra = t; }
void setFillColor(QString c) { ccolor = c; }
void setStrokeColor(QString c) { cstroke = c; }
void setLanguage(QString l) { language_ = l; }
void setFont(const ScFace& f) { cfont = f; }
/**
returns true if both Styles are of the same type, inherit the same attributes,
have the same parent, and agree on all attributes which are not inherited.
The StyleBase, the name and any inherited attrinutes may be different.
*/
virtual bool equiv(const Style& other) const = 0;
/**
returns true if both Styles are equivalent and have the same name.
Since the base is not tested, this does *not* ensure they will return
the same values for all attributes.
*/
virtual bool operator==(const Style& other) const { return name() == other.name() && equiv(other); }
virtual bool operator!=(const Style& other) const { return ! ( (*this) == other ); }
 
bool isPfontSize() const { return csize==NOVALUE && parent(); }
bool isPfillShade() const { return cshade==NOVALUE && parent(); }
bool isPstrokeShade() const { return cshade2==NOVALUE && parent(); }
bool isPeffects() const { return cstyle==ScStyle_None && parent(); }
bool isPscaleH() const { return cscale==NOVALUE && parent(); }
bool isPscaleV() const { return cscalev==NOVALUE && parent(); }
bool isPbaselineOffset() const { return cbase==NOVALUE && parent(); }
bool isPshadowXOffset() const { return cshadowx==NOVALUE && parent(); }
bool isPshadowYOffset() const { return cshadowy==NOVALUE && parent(); }
bool isPoutlineWidth() const { return coutline==NOVALUE && parent(); }
bool isPunderlineOffset() const { return cunderpos==NOVALUE && parent(); }
bool isPunderlineWidth() const { return cunderwidth==NOVALUE && parent(); }
bool isPstrikethruOffset() const { return cstrikepos==NOVALUE && parent(); }
bool isPstrikethruWidth() const { return cstrikewidth==NOVALUE && parent(); }
bool isPtracking() const { return cextra==NOVALUE && parent(); }
bool isPfillColor() const { return ccolor==NOCOLOR && parent(); }
bool isPstrokeColor() const { return cstroke==NOCOLOR && parent(); }
bool isPlanguage() const { return language_==NOLANG && parent(); }
bool isPfont() const { return cfont.isNone() && parent(); }
private:
// shorthand:
const CharStyle& inh() const { return *dynamic_cast<const CharStyle*>(parent()); };
int csize;
short cshade;
short cshade2;
StyleFlag cstyle;
short cscale;
short cscalev;
short cbase;
short cshadowx;
short cshadowy;
short coutline;
short cunderpos;
short cunderwidth;
short cstrikepos;
short cstrikewidth;
short cextra;
ScFace cfont;
QString ccolor;
QString cstroke;
QString language_;
/**
resets all attributes to their defaults and makes them inherited.
name and parent are not affected.
*/
virtual void erase() = 0;
/**
if other has a parent, replace this parent with the other ones
*/
void applyStyle(const Style& other) {
if (other.hasParent())
setParent(other.parent());
}
/**
if other has the same parent, remove this parent
*/
void eraseStyle(const Style& other) {
if (other.parent() == parent())
setParent("");
}
};
 
 
inline CharStyle & CharStyle::operator=(const CharStyle & other)
/** This class turns a style into a new stylebase:
* it maps the empty name "" to the given default style and uses
* the style's base to resolve all other names.
*/
class StyleBaseProxy: public StyleBase
{
static_cast<Style&>(*this) = static_cast<const Style&>(other);
csize = other.csize;
cshade = other.cshade;
cshade2 = other.cshade2;
cstyle = other.cstyle;
cscale = other.cscale;
cscalev = other.cscalev;
cbase = other.cbase;
cshadowx = other.cshadowx;
cshadowy = other.cshadowy;
coutline = other.coutline;
cunderpos = other.cunderpos;
cunderwidth = other.cunderwidth;
cstrikepos = other.cstrikepos;
cstrikewidth = other.cstrikewidth;
cextra = other.cextra;
cfont = other.cfont;
ccolor = other.ccolor;
cstroke = other.cstroke;
language_ = other.language_;
return *this;
}
 
inline CharStyle::CharStyle(const CharStyle & other) : Style(other), cfont(other.cfont)
{
csize = other.csize;
cshade = other.cshade;
cshade2 = other.cshade2;
cstyle = other.cstyle;
cscale = other.cscale;
cscalev = other.cscalev;
cbase = other.cbase;
cshadowx = other.cshadowx;
cshadowy = other.cshadowy;
coutline = other.coutline;
cunderpos = other.cunderpos;
cunderwidth = other.cunderwidth;
cstrikepos = other.cstrikepos;
cstrikewidth = other.cstrikewidth;
cextra = other.cextra;
ccolor = other.ccolor;
cstroke = other.cstroke;
language_ = other.language_;
}
 
 
class SCRIBUS_API ParagraphStyle : public virtual Style
{
public:
enum LineSpacingMode {
FixedLineSpacing = 0,
AutomaticLineSpacing = 1,
BaselineGridLineSpacing = 2
};
struct TabRecord
{
double tabPosition;
int tabType;
QChar tabFillChar;
};
const Style* resolve(QString name) const {
if (name.isEmpty() || ! m_default->base())
return m_default;
else
return m_default->base()->resolve(name);
}
private:
// shorthand
const ParagraphStyle& inh() const { return *dynamic_cast<const ParagraphStyle*>(parent()); }
CharStyle cstyle;
LineSpacingMode LineSpaMode;
double LineSpa;
int textAlignment;
double Indent;
double rightMargin_;
double First;
double gapBefore_;
double gapAfter_;
QValueList<TabRecord> TabValues;
bool haveTabs;
int Drop;
int DropLin;
double DropDist;
int BaseAdj;
StyleBaseProxy(int level, const Style* style)
: StyleBase(level), m_default(style) {}
public:
ParagraphStyle();
ParagraphStyle(const ParagraphStyle& other);
int lineSpacingMode() const { return LineSpaMode==NOVALUE && parent()? inh().lineSpacingMode() : LineSpaMode; }
double lineSpacing() const { return LineSpa<=NOVALUE && parent()? inh().lineSpacing() : LineSpa; }
int alignment() const { return textAlignment==NOVALUE && parent()? inh().alignment() : textAlignment; }
double firstIndent() const { return First<=NOVALUE && parent()? inh().firstIndent() : First; }
double leftMargin() const { return Indent<=NOVALUE && parent()? inh().leftMargin() : Indent; }
double rightMargin() const { return rightMargin_<=NOVALUE && parent()? inh().rightMargin() : rightMargin_; }
double gapBefore() const { return gapBefore_<=NOVALUE && parent()? inh().gapBefore() : gapBefore_; }
double gapAfter() const { return gapAfter_<=NOVALUE && parent()? inh().gapAfter() : gapAfter_; }
bool hasDropCap() const { return Drop==NOVALUE && parent()? inh().hasDropCap() : Drop > 0; }
int dropCapLines() const { return DropLin==NOVALUE && parent()? inh().dropCapLines() : DropLin; }
double dropCapOffset() const { return DropDist<=NOVALUE && parent()? inh().dropCapOffset() : DropDist; }
bool useBaselineGrid() const { return BaseAdj==NOVALUE && parent()? inh().useBaselineGrid() : BaseAdj > 0; }
StyleBaseProxy(const StyleBaseProxy& other)
: StyleBase(other), m_default(other.m_default) {}
void setLineSpacingMode(LineSpacingMode p) {
LineSpaMode = p;
StyleBaseProxy& operator= (const StyleBaseProxy& other)
{
static_cast<StyleBase&>(*this) = static_cast<const StyleBase&>(other);
m_default = other.m_default;
return *this;
}
void setLineSpacing(double p) {
LineSpa = p;
}
void setAlignment(int p) {
textAlignment = p;
}
void setFirstIndent(double p) {
First = p;
}
void setLeftMargin(double p) {
Indent = p;
}
void setRightMargin(double p) {
rightMargin_ = p;
}
void setGapBefore(double p) {
gapBefore_ = p;
}
void setGapAfter(double p) {
gapAfter_ = p;
}
void setHasDropCap(bool p) {
Drop = p? 1 : 0;
}
void useParentDropCap() {
if (parent())
Drop = NOVALUE;
}
void setDropCapLines(int p) {
DropLin = p;
}
void setDropCapOffset(double p) {
DropDist = p;
}
void setUseBaselineGrid(bool p) {
BaseAdj = p? 1 : 0;
int version() const {
assert (this != m_default->base());
qDebug(QString("version? %1 default %2 base %3").arg(reinterpret_cast<int>(this)).arg(reinterpret_cast<int>(m_default)).arg(reinterpret_cast<int>(m_default->base())));
return m_default->base() ? m_version ^ m_default->base()->version() : m_version;
}
private:
const Style* m_default;
};
 
bool isPlineSpacingMode() const { return LineSpaMode==NOVALUE && parent(); }
bool isPlineSpacing() const { return LineSpa<=NOVALUE && parent(); }
bool isPalignment() const { return textAlignment==NOVALUE && parent(); }
bool isPfirstIndent() const { return First<=NOVALUE && parent(); }
bool isPleftMargin() const { return Indent<=NOVALUE && parent(); }
bool isPrightMargin() const { return rightMargin_<=NOVALUE && parent(); }
bool isPgapBefore() const { return gapBefore_<=NOVALUE && parent(); }
bool isPgapAfter() const { return gapAfter_<=NOVALUE && parent(); }
bool isPhasDropCap() const { return Drop==NOVALUE && parent(); }
bool isPdropCapLines() const { return DropLin==NOVALUE && parent(); }
bool isPdropCapOffset() const { return DropDist<=NOVALUE && parent(); }
bool isPuseBaselineGrid() const { return BaseAdj==NOVALUE && parent(); }
bool isPtabValues() const { return !haveTabs && parent(); };
 
// these return writeable references for now:
QValueList<TabRecord> & tabValues() { haveTabs = true; return TabValues; }
const QValueList<TabRecord> & tabValues() const { return !haveTabs && parent()? inh().tabValues() : TabValues; }
void useParentTabs() {
if (haveTabs && parent())
{
TabValues.clear();
haveTabs = false;
}
}
 
CharStyle & charStyle() { return cstyle; }
const CharStyle& charStyle() const { return cstyle; }
void applyStyle(const ParagraphStyle& other);
void eraseStyle(const ParagraphStyle& other);
void erase() { eraseStyle(*this); }
QString displayName() const;
// bool definesAll() const;
// bool inheritsAll() const;
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
 
ParagraphStyle& operator=(const ParagraphStyle& other);
 
bool equiv(const Style& other) const;
};
 
#endif
/branches/Version13x/Scribus/scribus/scribus.cpp
994,7 → 994,7
{
// int ChPos = QMIN(currItem->CPos, static_cast<int>(currItem->itemText.length()-1));
const ParagraphStyle currPStyle(currItem->currentStyle());
int currentParaStyle = currPStyle.parent()? findParagraphStyle(doc, *dynamic_cast<const ParagraphStyle*>(currPStyle.parent())) : 0;
int currentParaStyle = currPStyle.parentStyle()? findParagraphStyle(doc, *dynamic_cast<const ParagraphStyle*>(currPStyle.parentStyle())) : 0;
setAbsValue(currPStyle.alignment());
propertiesPalette->setParStyle(currentParaStyle);
doc->currentStyle.charStyle() = currItem->currentCharStyle();
2698,9 → 2698,9
else
view->horizRuler->Revers = false;
view->horizRuler->ItemPosValid = true;
if (findParagraphStyle(doc, doc->currentStyle) < 5)
view->horizRuler->TabValues = currItem->TabValues;
else
// if (findParagraphStyle(doc, doc->currentStyle) < 5)
// view->horizRuler->TabValues = currItem->TabValues;
// else
view->horizRuler->TabValues = doc->currentStyle.tabValues();
view->horizRuler->repaint();
}
3639,7 → 3639,7
ite->updatePolyClip();
ite->DrawObj(painter, rd);
}
else if (ite->asTextFrame())
else if (ite->asTextFrame() && ite->asTextFrame()->itemText.length() > 0)
{
if ( ite->BackBox == 0 )
ite->asTextFrame()->layout();
4856,10 → 4856,10
ss->Objekt = Buffer2;
//FIXME: that st business doesn't look right
int st = findParagraphStyle(doc, doc->currentStyle);
if (st > 5)
// if (st > 5)
ss->GetText(currItem, st, doc->docParagraphStyles[st].charStyle().font().scName(), doc->docParagraphStyles[st].charStyle().fontSize(), true);
else
ss->GetText(currItem, st, currItem->currentCharStyle().font().scName(), currItem->currentCharStyle().fontSize(), true);
// else
// ss->GetText(currItem, st, currItem->currentCharStyle().font().scName(), currItem->currentCharStyle().fontSize(), true);
delete ss;
}
view->RefreshItem(currItem);
5992,7 → 5992,7
{
doc->currentStyle.charStyle().setEffects(static_cast<StyleFlag>(h));
setStilvalue(h);
doc->chTyStyle(h);
doc->itemSelection_SetEffects(h);
}
}
 
6274,7 → 6274,7
}
}
AdjustFontMenu(nf2);
doc->ItemFont(nf2);
doc->itemSelection_SetFont(nf2);
doc->currentStyle.charStyle().setFont((*doc->AllFonts)[nf2]);
slotDocCh();
}
6295,7 → 6295,7
{
int c = id;
if (c != -1)
doc->chFSize(c*10);
doc->itemSelection_SetFontSize(c*10);
else
{
bool ok = false;
6304,7 → 6304,7
{
c = qRound(dia->getEditText().toDouble(&ok));
if ((ok) && (c < 1025) && (c > 0))
doc->chFSize(c*10);
doc->itemSelection_SetFontSize(c*10);
}
delete dia;
}
6325,7 → 6325,7
{
PageItem *currItem = doc->m_Selection->itemAt(0);
if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText))
doc->ItemTextBrush(ColorMenC->text(id));
doc->itemSelection_SetFillColor(ColorMenC->text(id));
else
doc->ItemBrush(ColorMenC->text(id));
}
6344,7 → 6344,7
if (c != -1)
{
if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText))
doc->ItemTextBrushS(c);
doc->itemSelection_SetFillShade(c);
else
doc->ItemBrushShade(c);
}
6357,7 → 6357,7
if (ok)
{
if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText))
doc->ItemTextBrushS(c);
doc->itemSelection_SetFillShade(c);
else
doc->ItemBrushShade(c);
}
6480,6 → 6480,7
bool ff;
uint nr;
ers.clear();
/*FIXME:NLS
ers.append(0);
ers.append(1);
ers.append(2);
6486,6 → 6487,8
ers.append(3);
ers.append(4);
for (uint a=5; a<doc->docParagraphStyles.count(); ++a)
*/
for (uint a=0; a<doc->docParagraphStyles.count(); ++a)
{
ff = false;
nn = doc->docParagraphStyles[a].name();
6776,8 → 6779,8
{
if (HaveDoc)
{
doc->currentStyle = doc->docParagraphStyles[a];
doc->itemSelection_SetParagraphStyle(a);
// doc->currentStyle = doc->docParagraphStyles[a];
doc->itemSelection_SetAlignment(a);
propertiesPalette->setAli(a);
PageItem *currItem = doc->m_Selection->itemAt(0);
setTBvals(currItem);
6788,8 → 6791,8
{
if (HaveDoc)
{
doc->currentStyle = doc->docParagraphStyles[a];
doc->itemSelection_SetParagraphStyle(a);
// doc->currentStyle = doc->docParagraphStyles[a];
doc->itemSelection_ApplyParagraphStyle(doc->docParagraphStyles[a]);
PageItem *currItem = doc->m_Selection->itemAt(0);
setTBvals(currItem);
}
6798,7 → 6801,7
void ScribusMainWindow::setAbsValue(int a)
{
// doc->currentStyle = doc->docParagraphStyles[a];
doc->currentStyle.setAlignment(a<5 ? a : 0);
doc->currentStyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(a<5 ? a : 0));
propertiesPalette->setAli(a);
QString alignment[] = {"Left", "Center", "Right", "Block", "Forced"};
for (int b=0; b<5; ++b)
8899,7 → 8902,7
if (currItem!=NULL)
{
if ((m->stateAfter() & Qt::ControlButton) && (currItem->asTextFrame() || currItem->asPathText()))
doc->ItemTextBrush(colorName); //Text colour
doc->itemSelection_SetFillColor(colorName); //Text colour
else
if (m->stateAfter() & Qt::AltButton) //Line colour
doc->ItemPen(colorName);
/branches/Version13x/Scribus/scribus/desaxe/digester_parse.cpp
22,7 → 22,7
DigesterParser(Digester* digester) : dig(digester) {}
bool startDocument()
{
dig->reset();
dig->beginDoc();
return true;
}
bool startElement( const QString& nsURI, const QString& locName, const QString& qName,
/branches/Version13x/Scribus/scribus/desaxe/digester.cpp
129,12 → 129,15
}
 
 
void Digester::reset()
void Digester::beginDoc()
{
state->reset();
state->dump();
}
 
void Digester::endDoc()
{
}
 
void Digester::begin(Xml_string tag, Xml_attr attr)
{
/branches/Version13x/Scribus/scribus/desaxe/digester.h
19,6 → 19,7
#include <string>
 
#include "desaxe_conf.h"
#include "saxhandler.h"
 
namespace desaxe {
33,7 → 34,7
attributes, or call methods. Actions operate on intermediate objects which
are hold on a stack maintained by Digester.
*/
class Digester {
class Digester : public SaxHandler {
public:
Digester();
Digester& operator=(const Digester& other);
49,7 → 50,8
const Xml_string getError(int i) const;
// called by SAX parser:
void reset();
void beginDoc();
void endDoc();
void begin(Xml_string tag, Xml_attr attr);
void end(Xml_string tag);
void chars(Xml_string text);
/branches/Version13x/Scribus/scribus/mpalette.cpp
2052,11 → 2052,12
HaveItem = tmp;
}
 
// NewLspMode?
void Mpalette::setLspMode(int id)
{
if ((HaveDoc) && (HaveItem))
{
doc->ChLineSpaMode(lineSpacingPop->indexOf(id));
doc->itemSelection_SetLineSpacingMode(lineSpacingPop->indexOf(id));
emit DocChanged();
}
}
2320,8 → 2321,8
{
if ((HaveDoc) && (HaveItem))
{
doc->ItemTextScaleV(qRound(ChScaleV->value() * 10));
doc->currentStyle.charStyle().setScaleV(qRound(ChScaleV->value() * 10));
doc->itemSelection_SetScaleV(qRound(ChScaleV->value() * 10));
// doc->currentStyle.charStyle().setScaleV(qRound(ChScaleV->value() * 10));
emit DocChanged();
}
}
2330,8 → 2331,8
{
if ((HaveDoc) && (HaveItem))
{
doc->setItemTextBase(qRound(ChBase->value() * 10));
doc->currentStyle.charStyle().setBaselineOffset(qRound(ChBase->value() * 10));
doc->itemSelection_SetBaselineOffset(qRound(ChBase->value() * 10));
// doc->currentStyle.charStyle().setBaselineOffset(qRound(ChBase->value() * 10));
emit DocChanged();
}
}
2360,8 → 2361,8
{
if ((HaveDoc) && (HaveItem))
{
doc->ItemTextScale(qRound(ChScale->value() * 10));
doc->currentStyle.charStyle().setScaleH(qRound(ChScale->value() * 10));
doc->itemSelection_SetScaleH(qRound(ChScale->value() * 10));
// doc->currentStyle.charStyle().setScaleH(qRound(ChScale->value() * 10));
emit DocChanged();
}
}
2756,7 → 2757,7
return;
if ((HaveDoc) && (HaveItem))
{
doc->ChLineSpa(LineSp->value());
doc->itemSelection_SetLineSpacing(LineSp->value());
emit DocChanged();
}
}
2819,7 → 2820,7
return;
if ((HaveDoc) && (HaveItem))
{
doc->chFSize(qRound(Size->value()*10.0));
doc->itemSelection_SetFontSize(qRound(Size->value()*10.0));
emit DocChanged();
}
}
2830,22 → 2831,8
return;
if ((HaveDoc) && (HaveItem))
{
if ((CurItem->HasSel) || (doc->appMode == modeNormal))
{
doc->chKerning(qRound(Extra->value() * 10.0));
emit DocChanged();
}
else
{
if (CurItem->CPos != CurItem->itemText.length())
{
#ifndef NLS_PROTO
CurItem->itemText.item(CurItem->CPos)->setTracking(qRound(Extra->value() * 10.0));
#endif
m_ScMW->view->RefreshItem(CurItem);
emit DocChanged();
}
}
doc->itemSelection_SetTracking(qRound(Extra->value() * 10.0));
emit DocChanged();
}
}
 
3148,8 → 3135,11
return;
if ((HaveDoc) && (HaveItem))
{
if (findParagraphStyle(doc, doc->currentStyle) < 5)
emit NewAlignment(a);
doc->itemSelection_SetAlignment(a);
emit DocChanged();
 
//old: if (findParagraphStyle(doc, doc->currentStyle) < 5)
// emit NewAlignment(a);
}
}
 
3166,9 → 3156,9
int y = qRound(SeStyle->ShadowVal->Yoffset->value() * 10.0);
if ((HaveDoc) && (HaveItem))
{
doc->setItemTextShadow(x, y);
doc->currentStyle.charStyle().setShadowXOffset(x);
doc->currentStyle.charStyle().setShadowYOffset(y);
doc->itemSelection_SetShadowOffsets(x, y);
// doc->currentStyle.charStyle().setShadowXOffset(x);
// doc->currentStyle.charStyle().setShadowYOffset(y);
emit DocChanged();
}
}
3191,9 → 3181,9
int y = qRound(SeStyle->UnderlineVal->LWidth->value() * 10.0);
if ((HaveDoc) && (HaveItem))
{
doc->setItemTextUnderline(x, y);
doc->currentStyle.charStyle().setUnderlineOffset(x);
doc->currentStyle.charStyle().setUnderlineWidth(y);
doc->itemSelection_SetUnderline(x, y);
// doc->currentStyle.charStyle().setUnderlineOffset(x);
// doc->currentStyle.charStyle().setUnderlineWidth(y);
emit DocChanged();
}
}
3216,9 → 3206,9
int y = qRound(SeStyle->StrikeVal->LWidth->value() * 10.0);
if ((HaveDoc) && (HaveItem))
{
doc->setItemTextStrike(x, y);
doc->currentStyle.charStyle().setStrikethruOffset(x);
doc->currentStyle.charStyle().setStrikethruWidth(y);
doc->itemSelection_SetStrikethru(x, y);
// doc->currentStyle.charStyle().setStrikethruOffset(x);
// doc->currentStyle.charStyle().setStrikethruWidth(y);
emit DocChanged();
}
}
3249,8 → 3239,8
int x = qRound(SeStyle->OutlineVal->LWidth->value() * 10.0);
if ((HaveDoc) && (HaveItem))
{
doc->setItemTextOutline(x);
doc->currentStyle.charStyle().setOutlineWidth(x);
doc->itemSelection_SetOutlineWidth(x);
// doc->currentStyle.charStyle().setOutlineWidth(x);
emit DocChanged();
}
}
3684,8 → 3674,8
{
if ((HaveDoc) && (HaveItem))
{
doc->ItemTextBrush(TxFill->currentText());
doc->currentStyle.charStyle().setFillColor(TxFill->currentText());
doc->itemSelection_SetFillColor(TxFill->currentText());
// doc->currentStyle.charStyle().setFillColor(TxFill->currentText());
emit DocChanged();
}
}
3694,8 → 3684,8
{
if ((HaveDoc) && (HaveItem))
{
doc->ItemTextPen(TxStroke->currentText());
doc->currentStyle.charStyle().setStrokeColor(TxStroke->currentText());
doc->itemSelection_SetStrokeColor(TxStroke->currentText());
// doc->currentStyle.charStyle().setStrokeColor(TxStroke->currentText());
emit DocChanged();
}
}
3708,14 → 3698,14
if (PM1 == sender())
{
b = PM1->getValue();
doc->ItemTextPenS(b);
doc->currentStyle.charStyle().setFillShade(b);
doc->itemSelection_SetFillShade(b);
// doc->currentStyle.charStyle().setFillShade(b);
}
else
{
b = PM2->getValue();
doc->ItemTextBrushS(b);
doc->currentStyle.charStyle().setStrokeShade(b);
doc->itemSelection_SetStrokeShade(b);
// doc->currentStyle.charStyle().setStrokeShade(b);
}
emit DocChanged();
}
/branches/Version13x/Scribus/scribus/sctextstruct.cpp
11,37 → 11,7
#include "scfonts.h"
 
 
QString CharStyle::asString() const
{
QString result;
if (!cfont.isNone())
result += QObject::tr("font %1 ").arg(cfont.scName());
if (csize != NOVALUE)
result += QObject::tr("size %1 ").arg(csize);
if (cstyle != NOVALUE)
result += QObject::tr("+style ");
if (ccolor != NOCOLOR || cstroke != NOCOLOR || cshade != NOVALUE || cshade2 != NOVALUE)
result += QObject::tr("+color ");
if (cunderwidth != NOVALUE || cunderpos != NOVALUE)
result += cunderwidth > 0 ? QObject::tr("+underline ") : QObject::tr("-underline ");
if (cstrikewidth != NOVALUE || cstrikepos != NOVALUE)
result += cstrikewidth > 0 ? QObject::tr("+strikeout ") : QObject::tr("-strikeout ");
if (cshadowx != NOVALUE || cshadowy != NOVALUE)
result += cshadowx != 0 && cshadowy != 0? QObject::tr("+shadow ") : QObject::tr("-shadow ");
if (coutline != NOVALUE)
result += coutline > 0 ? QObject::tr("+outline ") : QObject::tr("-outline ");
if (cextra != NOVALUE)
result += cextra > 0 ? QObject::tr("+tracking %1").arg(cextra) : QObject::tr("-tracking ");
if (cbase != NOVALUE)
result += QObject::tr("+baseline %1").arg(cbase);
if (cscale != NOVALUE || cscalev != NOVALUE)
result += QObject::tr("+stretch ");
if (parent() != NULL)
result += QObject::tr("parent= %1").arg(parent()->name()=="" ? QObject::tr("unnamed") : parent()->name());
return result.stripWhiteSpace();
}
 
 
ScText::~ScText()
{
// delete the linked list if present
/branches/Version13x/Scribus/scribus/spalette.cpp
47,9 → 47,9
 
void Spalette::setFormat(int e)
{
if (e < 5)
setCurrentItem(0);
else
// if (e < 5)
// setCurrentItem(0);
// else
setCurrentText(currentDoc->docParagraphStyles[e].name());
}
 
62,7 → 62,7
QStringList st;
st.clear();
insertItem( tr("No Style"));
for (uint x = 5; x < currentDoc->docParagraphStyles.count(); ++x)
for (uint x = 0; x < currentDoc->docParagraphStyles.count(); ++x)
st.append(currentDoc->docParagraphStyles[x].name());
st.sort();
insertStringList(st);
78,7 → 78,7
emit newStyle(0);
return;
}
for (uint x = 5; x < currentDoc->docParagraphStyles.count(); ++x)
for (uint x = 0; x < currentDoc->docParagraphStyles.count(); ++x)
{
if (currentDoc->docParagraphStyles[x].name() == currentText())
{
/branches/Version13x/Scribus/scribus/hruler.cpp
222,7 → 222,7
TabValues[ActTab].tabType = 0;
}
// if (currDoc->currentParaStyle > 4)
currItem->changeCurrentStyle().tabValues() = TabValues;
currItem->changeCurrentStyle().setTabValues(TabValues);
// else
// currDoc->m_Selection->itemAt(0)->TabValues = TabValues;
emit DocChanged(false);
240,7 → 240,7
TabValues.remove(it);
ActTab = 0;
// if (currDoc->currentParaStyle > 4)
currItem->changeCurrentStyle().tabValues() = TabValues;
currItem->changeCurrentStyle().setTabValues(TabValues);
// else
// currDoc->m_Selection->itemAt(0)->TabValues = TabValues;
emit DocChanged(false);
/branches/Version13x/Scribus/scribus/search.cpp
95,9 → 95,9
size_t ar_sty = sizeof(tmp_sty) / sizeof(*tmp_sty);
for (uint a = 0; a < ar_sty; ++a)
SStyleVal->insertItem(tmp_sty[a]);
if (doc->docParagraphStyles.count() > 5)
// if (doc->docParagraphStyles.count() >5)
{
for (uint x = 5; x < doc->docParagraphStyles.count(); ++x)
for (uint x = 0; x < doc->docParagraphStyles.count(); ++x)
SStyleVal->insertItem(doc->docParagraphStyles[x].name());
}
SStyleVal->listBox()->setMinimumWidth(SStyleVal->listBox()->maxItemWidth()+24);
183,7 → 183,7
RStyleVal->setEditable(false);
for (uint a = 0; a < ar_sty; ++a)
RStyleVal->insertItem(tmp_sty[a]);
if (doc->docParagraphStyles.count() > 5)
// if (doc->docParagraphStyles.count() > 5)
{
for (uint x = 5; x < doc->docParagraphStyles.count(); ++x)
RStyleVal->insertItem(doc->docParagraphStyles[x].name());
740,19 → 740,19
}
}
if (RStyle->isChecked())
emit NewAbs(RStyleVal->currentItem());
Doc->itemSelection_ApplyParagraphStyle(Doc->docParagraphStyles[RStyleVal->currentItem()]);
if (RFill->isChecked())
Doc->ItemTextBrush(RFillVal->currentText());
Doc->itemSelection_SetFillColor(RFillVal->currentText());
if (RFillS->isChecked())
Doc->ItemTextBrushS(RFillSVal->getValue());
Doc->itemSelection_SetFillShade(RFillSVal->getValue());
if (RStroke->isChecked())
Doc->ItemTextPen(RStrokeVal->currentText());
Doc->itemSelection_SetStrokeColor(RStrokeVal->currentText());
if (RStrokeS->isChecked())
Doc->ItemTextPenS(RStrokeSVal->getValue());
Doc->itemSelection_SetStrokeShade(RStrokeSVal->getValue());
if (RFont->isChecked())
emit NewFont(RFontVal->currentText());
Doc->itemSelection_SetFont(RFontVal->currentText());
if (RSize->isChecked())
Doc->chFSize(qRound(RSizeVal->value() * 10.0));
Doc->itemSelection_SetFontSize(qRound(RSizeVal->value() * 10.0));
if (REffect->isChecked())
{
#ifndef NLS_PROTO
/branches/Version13x/Scribus/scribus/scribusdoc.cpp
335,43 → 335,51
toolSettings.dTextBackGround = prefsData.toolSettings.dTextBackGround;
if (prefsData.toolSettings.dTextLineColor != CommonStrings::None)
PageColors.insert(prefsData.toolSettings.dTextLineColor, prefsData.DColors[prefsData.toolSettings.dTextLineColor]);
 
ParagraphStyle vg;
vg.setName("Normal Internal");
// vg.setName("Normal Internal");
vg.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
vg.setLineSpacing(15);
vg.setAlignment(0);
vg.setAlignment(ParagraphStyle::Leftaligned);
vg.setLeftMargin(0);
vg.setFirstIndent(0);
vg.setRightMargin(0);
vg.setGapBefore(0);
vg.setGapAfter(0);
vg.charStyle().setFont(prefsData.AvailFonts[toolSettings.defFont]);
vg.charStyle().setFontSize(toolSettings.defSize);
vg.tabValues().clear();
// vg.tabValues().clear();
vg.setHasDropCap(false);
vg.setDropCapLines(2);
vg.setDropCapOffset(0);
vg.setUseBaselineGrid(false);
vg.charStyle().setEffects(ScStyle_Default);
vg.charStyle().setFillColor(toolSettings.dBrush);
vg.charStyle().setFillShade(toolSettings.dShade);
vg.charStyle().setStrokeColor(toolSettings.dPen);
vg.charStyle().setStrokeShade(toolSettings.dShade2);
vg.charStyle().setBaselineOffset(0);
vg.charStyle().setShadowXOffset(50);
vg.charStyle().setShadowYOffset(-50);
vg.charStyle().setOutlineWidth(10);
vg.charStyle().setUnderlineOffset(typographicSettings.valueUnderlinePos);
vg.charStyle().setUnderlineWidth(typographicSettings.valueUnderlineWidth);
vg.charStyle().setStrikethruOffset(typographicSettings.valueStrikeThruPos);
vg.charStyle().setStrikethruWidth(typographicSettings.valueStrikeThruPos);
vg.charStyle().setScaleH(1000);
vg.charStyle().setScaleV(1000);
vg.charStyle().setTracking(0);
vg.charStyle().setBase( & docCharStyles );
 
CharStyle& cstyle(vg.charStyle());
cstyle.setFont(prefsData.AvailFonts[toolSettings.defFont]);
cstyle.setFontSize(toolSettings.defSize);
cstyle.setEffects(ScStyle_Default);
cstyle.setFillColor(toolSettings.dBrush);
cstyle.setFillShade(toolSettings.dShade);
cstyle.setStrokeColor(toolSettings.dPen);
cstyle.setStrokeShade(toolSettings.dShade2);
cstyle.setBaselineOffset(0);
cstyle.setShadowXOffset(50);
cstyle.setShadowYOffset(-50);
cstyle.setOutlineWidth(10);
cstyle.setUnderlineOffset(typographicSettings.valueUnderlinePos);
cstyle.setUnderlineWidth(typographicSettings.valueUnderlineWidth);
cstyle.setStrikethruOffset(typographicSettings.valueStrikeThruPos);
cstyle.setStrikethruWidth(typographicSettings.valueStrikeThruPos);
cstyle.setScaleH(1000);
cstyle.setScaleV(1000);
cstyle.setTracking(0);
docParagraphStyles.create(vg);
docCharStyles.setBase( &docParagraphStyles[0] );
currentStyle = vg;
#if 0
vg.setName("Center Internal");
vg.setAlignment(1);
docParagraphStyles.create(vg);
384,6 → 392,8
vg.setName("EBlock Internal");
vg.setAlignment(4);
docParagraphStyles.create(vg);
#endif
struct Layer ll;
ll.LNr = 0;
ll.Level = 0;
4549,7 → 4559,7
}
}
 
void ScribusDoc::ChLineSpa(double w)
void ScribusDoc::itemSelection_SetLineSpacing(double w)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4568,7 → 4578,7
}
}
 
void ScribusDoc::ItemFont(QString fon)
void ScribusDoc::itemSelection_SetFont(QString fon)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4651,7 → 4661,7
changed();
}
 
void ScribusDoc::ItemTextBrush(QString farbe)
void ScribusDoc::itemSelection_SetFillColor(QString farbe)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4689,7 → 4699,7
}
}
 
void ScribusDoc::ItemTextBrushS(int sha)
void ScribusDoc::itemSelection_SetFillShade(int sha)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4725,7 → 4735,7
}
}
 
void ScribusDoc::ItemTextPen(QString farbe)
void ScribusDoc::itemSelection_SetStrokeColor(QString farbe)
{
if (farbe == CommonStrings::NoneColor)
farbe = CommonStrings::None;
4763,7 → 4773,7
}
}
 
void ScribusDoc::ItemTextPenS(int sha)
void ScribusDoc::itemSelection_SetStrokeShade(int sha)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4799,7 → 4809,7
}
}
 
void ScribusDoc::ItemTextScaleV(int sha)
void ScribusDoc::itemSelection_SetScaleV(int sha)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4834,7 → 4844,7
}
}
 
void ScribusDoc::ItemTextScale(int sha)
void ScribusDoc::itemSelection_SetScaleH(int sha)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4870,7 → 4880,7
}
}
 
void ScribusDoc::setItemTextShadow(int shx, int shy)
void ScribusDoc::itemSelection_SetShadowOffsets(int shx, int shy)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4911,7 → 4921,7
}
}
 
void ScribusDoc::setItemTextUnderline(int pos, int wid)
void ScribusDoc::itemSelection_SetUnderline(int pos, int wid)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4952,7 → 4962,7
}
}
 
void ScribusDoc::setItemTextStrike(int pos, int wid)
void ScribusDoc::itemSelection_SetStrikethru(int pos, int wid)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
4993,7 → 5003,7
}
}
 
void ScribusDoc::setItemTextBase(int sha)
void ScribusDoc::itemSelection_SetBaselineOffset(int sha)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
5024,7 → 5034,7
}
}
 
void ScribusDoc::setItemTextOutline(int sha)
void ScribusDoc::itemSelection_SetOutlineWidth(int sha)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
5171,7 → 5181,7
}
}
 
void ScribusDoc::chTyStyle(int s)
void ScribusDoc::itemSelection_SetEffects(int s)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0 && s != ScStyle_None)
5218,7 → 5228,7
changed();
}
}
 
#if 0
void ScribusDoc::chAbStyle(PageItem *currItem, int s)
{
#if 0
5507,8 → 5517,9
m_View->horizRuler->repaint();
}
}
#endif
 
void ScribusDoc::chKerning(int us)
void ScribusDoc::itemSelection_SetTracking(int us)
{
uint docSelectionCount=m_Selection->count();
if (docSelectionCount != 0)
5554,7 → 5565,7
}
}
 
void ScribusDoc::ChLineSpaMode(int w)
void ScribusDoc::itemSelection_SetLineSpacingMode(int w)
{
if (appMode != modeEdit)
{
5587,7 → 5598,7
}
}
 
void ScribusDoc::chFSize(int size)
void ScribusDoc::itemSelection_SetFontSize(int size)
{
uint docSelectionCount=m_Selection->count();
if (docSelectionCount != 0)
5652,7 → 5663,7
}
}
 
void ScribusDoc::itemSelection_ApplyTextStyle(const CharStyle & newstyle)
void ScribusDoc::itemSelection_SetParagraphStyle(const ParagraphStyle & newStyle)
{
uint docSelectionCount=m_Selection->count();
if (docSelectionCount != 0)
5659,6 → 5670,87
{
if (docSelectionCount > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle,
newStyle.displayName(), Um::IFont);
for (uint aa = 0; aa < docSelectionCount; ++aa)
{
PageItem *currItem = m_Selection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0)
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
if (appMode == modeEdit)
{
start = currItem->itemText.startOfSelection();
stop = currItem->itemText.endOfSelection();
}
for (int pos=start; pos < stop; ++pos) {
if (currItem->itemText.text(pos) == SpecialChars::PARSEP) {
currItem->itemText.setStyle(pos, newStyle);
}
}
if (currItem->asPathText())
{
currItem->updatePolyClip();
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
}
if (docSelectionCount > 1)
undoManager->commit();
emit updateContents();
}
}
 
 
void ScribusDoc::itemSelection_ApplyParagraphStyle(const ParagraphStyle & newStyle)
{
uint docSelectionCount=m_Selection->count();
if (docSelectionCount != 0)
{
if (docSelectionCount > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle,
newStyle.displayName(), Um::IFont);
for (uint aa = 0; aa < docSelectionCount; ++aa)
{
PageItem *currItem = m_Selection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0)
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
if (appMode == modeEdit)
{
start = currItem->itemText.startOfSelection();
stop = currItem->itemText.endOfSelection();
}
for (int pos=start; pos < stop; ++pos) {
if (currItem->itemText.text(pos) == SpecialChars::PARSEP) {
currItem->itemText.applyStyle(pos, newStyle);
}
}
if (currItem->asPathText())
{
currItem->updatePolyClip();
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
}
if (docSelectionCount > 1)
undoManager->commit();
emit updateContents();
}
}
 
void ScribusDoc::itemSelection_ApplyCharStyle(const CharStyle & newstyle)
{
uint docSelectionCount=m_Selection->count();
if (docSelectionCount != 0)
{
if (docSelectionCount > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle,
newstyle.asString(), Um::IFont);
for (uint aa = 0; aa < docSelectionCount; ++aa)
{
5666,23 → 5758,60
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0)
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
if (appMode == modeEdit)
{
int start = currItem->itemText.startOfSelection();
int length = currItem->itemText.endOfSelection();
if (length > 0)
currItem->itemText.applyCharStyle(start, length, newstyle);
start = currItem->itemText.startOfSelection();
length = currItem->itemText.endOfSelection() - start;
}
else
currItem->itemText.applyCharStyle(start, length, newstyle);
if (currItem->asPathText())
{
currItem->itemText.applyCharStyle(0, currItemTextCount, newstyle);
currItem->updatePolyClip();
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
}
}
if (docSelectionCount > 1)
undoManager->commit();
emit updateContents();
}
}
 
 
 
void ScribusDoc::itemSelection_SetCharStyle(const CharStyle & newstyle)
{
uint docSelectionCount=m_Selection->count();
if (docSelectionCount != 0)
{
if (docSelectionCount > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle,
newstyle.asString(), Um::IFont);
for (uint aa = 0; aa < docSelectionCount; ++aa)
{
PageItem *currItem = m_Selection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0)
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
if (appMode == modeEdit)
{
start = currItem->itemText.startOfSelection();
length = currItem->itemText.endOfSelection() - start;
}
currItem->itemText.setCharStyle(start, length, newstyle);
if (currItem->asPathText())
{
currItem->updatePolyClip();
view()->AdjustItemSize(currItem);
}
// emit refreshItem(currItem);
// emit refreshItem(currItem);
}
}
if (docSelectionCount > 1)
5690,6 → 5819,8
emit updateContents();
}
}
 
 
/*
template<typename Arg, void (PageItem::*Fun)(Arg)>
void ScribusDoc::itemSelection_forall(Arg newVal)
6811,7 → 6942,7
}
 
 
void ScribusDoc::itemSelection_SetParagraphStyle(int s)
void ScribusDoc::itemSelection_SetAlignment(int s)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
6824,14 → 6955,17
PageItem *currItem = m_Selection->itemAt(a);
if (currItem!=NULL)
{
chAbStyle(currItem, s);
// chAbStyle(currItem, s);
tooltip += "\t" + currItem->getUName() + "\n";
}
}
ParagraphStyle pstyle;
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(s));
itemSelection_ApplyParagraphStyle(pstyle);
if (UndoManager::undoEnabled() && selectedItemCount > 1)
undoManager->commit(Um::Selection,
Um::IGroup,
s > 4 ? Um::SetStyle : Um::AlignText,
Um::AlignText,
tooltip,
Um::IFont);
view()->DrawNew(); //CB draw new until NLS for redraw through text chains
/branches/Version13x/Scribus/scribus/editformats.cpp
263,7 → 263,7
sty.setDropCapLines(TempVorl[sFnumber].dropCapLines());
sty.setDropCapOffset(TempVorl[sFnumber].dropCapOffset());
sty.setUseBaselineGrid(TempVorl[sFnumber].useBaselineGrid());
sty.tabValues() = TempVorl[sFnumber].tabValues();
sty.setTabValues(TempVorl[sFnumber].tabValues());
sty.charStyle() = TempVorl[sFnumber].charStyle();
TempVorl.append(sty);
sFnumber = TempVorl.count()-1;
285,7 → 285,7
sty.setLineSpacing(((Docu->toolSettings.defSize / 10.0) *
static_cast<double>(Docu->typographicSettings.autoLineSpacing) / 100)
+ (Docu->toolSettings.defSize / 10.0));
sty.setAlignment(0);
sty.setAlignment(ParagraphStyle::Leftaligned);
sty.setLeftMargin(0);
sty.setRightMargin(0);
sty.setFirstIndent(0);
293,7 → 293,7
sty.setGapAfter(0);
sty.charStyle() = CharStyle(PrefsManager::instance()->appPrefs.AvailFonts[Docu->toolSettings.defFont],
Docu->toolSettings.defSize);
sty.tabValues().clear();
// sty.tabValues().clear();
sty.setHasDropCap(false);
sty.setDropCapLines(2);
sty.setDropCapOffset(0);
/branches/Version13x/Scribus/scribus/sampleitem.cpp
56,7 → 56,7
tmpStyle.setLineSpacing((m_Doc->toolSettings.defSize / 10.0)
* static_cast<double>(m_Doc->typographicSettings.autoLineSpacing) / 100
+ (m_Doc->toolSettings.defSize / 10.0));
tmpStyle.setAlignment(0);
tmpStyle.setAlignment(ParagraphStyle::Leftaligned);
tmpStyle.setLeftMargin(0);
tmpStyle.setFirstIndent(0);
tmpStyle.setRightMargin(0);
64,7 → 64,7
tmpStyle.setGapAfter(0);
tmpStyle.charStyle().setFont(PrefsManager::instance()->appPrefs.AvailFonts[m_Doc->toolSettings.defFont]);
tmpStyle.charStyle().setFontSize(m_Doc->toolSettings.defSize);
tmpStyle.tabValues().clear();
// tmpStyle.tabValues().clear();
tmpStyle.setHasDropCap(false);
tmpStyle.setDropCapLines(0);//2;
tmpStyle.setDropCapOffset(0);
155,7 → 155,7
 
void SampleItem::setTextAlignment(int textAlignment)
{
tmpStyle.setAlignment(textAlignment);
tmpStyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(textAlignment));
}
 
void SampleItem::setIndent(double indent)
323,8 → 323,8
previouslyUsedFont = true;
 
m_Doc->AddFont(tmpStyle.charStyle().font().scName(), qRound(m_Doc->toolSettings.defSize / 10.0));
m_Doc->docParagraphStyles.create(tmpStyle);
int tmpIndex = m_Doc->docParagraphStyles.count() - 1;
// m_Doc->docParagraphStyles.create(tmpStyle);
// int tmpIndex = m_Doc->docParagraphStyles.count() - 1;
 
previewItem->FrameType = PageItem::TextFrame;
previewItem->itemText.clear();
332,7 → 332,11
previewItem->Cols = 1;
text.replace(QChar(10),QChar(13)).replace(QChar(5),QChar(13));
previewItem->itemText.insertChars(0, text);
m_Doc->chAbStyle(previewItem, tmpIndex);
for (int pos=0; pos < text.length(); ++pos) {
if (previewItem->itemText.text(pos) == SpecialChars::PARSEP) {
previewItem->itemText.applyStyle(pos, tmpStyle);
}
}
previewItem->itemText.applyCharStyle(0, text.length(), tmpStyle.charStyle());
previewItem->setFillColor("__whiteforpreviewbg__");
previewItem->setFillShade(bgShade);
349,7 → 353,7
if (m_Doc->view() != NULL)
m_Doc->view()->setScale(sca);
m_Doc->appMode = userAppMode;
m_Doc->docParagraphStyles.remove(tmpIndex);
// m_Doc->docParagraphStyles.remove(tmpIndex);
UndoManager::instance()->setUndoEnabled(true);
return pm;
}
/branches/Version13x/Scribus/scribus/story.cpp
133,17 → 133,17
st = editor->StyledText.at(pa)->at(0)->cab;
else
st = editor->ParagStyles[pa];
if (st < 5)
p.drawText(re, Qt::AlignLeft | Qt::AlignTop, tr("No Style"));
else
// if (st < 5)
// p.drawText(re, Qt::AlignLeft | Qt::AlignTop, tr("No Style"));
// else
p.drawText(re, Qt::AlignLeft | Qt::AlignTop, editor->doc->docParagraphStyles[st].name());
}
else
{
st = editor->currentParaStyle;
if (st < 5)
p.drawText(re, Qt::AlignLeft | Qt::AlignTop, tr("No Style"));
else
// if (st < 5)
// p.drawText(re, Qt::AlignLeft | Qt::AlignTop, tr("No Style"));
// else
p.drawText(re, Qt::AlignLeft | Qt::AlignTop, editor->doc->docParagraphStyles[st].name());
}
}
2766,7 → 2766,7
Editor->currentParaStyle = Editor->ParagStyles[p];
if (chars->count() == 0)
{
if (Editor->currentParaStyle > 4)
// if (Editor->currentParaStyle > 4)
{
Editor->prevFont = Editor->CurrFont;
Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().scName();
3284,7 → 3284,7
chars = Editor->StyledText.at(pa);
for (uint s = 0; s < chars->count(); ++s)
{
if (Editor->currentParaStyle > 4)
// if (Editor->currentParaStyle > 4)
{
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
3291,10 → 3291,10
chars->at(s)->charStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle();
}
}
if ((Editor->currentParaStyle < 5) && (chars->at(s)->cab > 4))
{
chars->at(s)->charStyle = currItem->itemText.defaultStyle().charStyle();
}
// if ((Editor->currentParaStyle < 5) && (chars->at(s)->cab > 4))
// {
// chars->at(s)->charStyle = currItem->itemText.defaultStyle().charStyle();
// }
chars->at(s)->cab = Editor->currentParaStyle;
}
Editor->updateFromChars(pa);
3306,7 → 3306,7
}
else
{
if (Editor->currentParaStyle > 4)
// if (Editor->currentParaStyle > 4)
{
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
3327,7 → 3327,7
Editor->CurrTextStrikeWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().strikethruWidth();
}
}
else
/* else
{
Editor->CurrTextFill = currItem->itemText.defaultStyle().charStyle().fillColor();
Editor->CurrTextFillSh = currItem->itemText.defaultStyle().charStyle().fillShade();
3349,6 → 3349,7
Editor->CurrTextStrikePos = currItem->itemText.defaultStyle().charStyle().strikethruOffset();
Editor->CurrTextStrikeWidth = currItem->itemText.defaultStyle().charStyle().strikethruWidth();
}
*/
Editor->setStyle(Editor->CurrentStyle);
if (Editor->CurrentStyle & 4)
{
3401,7 → 3402,7
chars = Editor->StyledText.at(pa);
for (uint s = 0; s < chars->count(); ++s)
{
if (Editor->currentParaStyle > 4)
// if (Editor->currentParaStyle > 4)
{
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
3408,10 → 3409,10
chars->at(s)->charStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle();
}
}
if ((Editor->currentParaStyle < 5) && (chars->at(s)->cab > 4))
{
chars->at(s)->charStyle = currItem->itemText.defaultStyle().charStyle();
}
// if ((Editor->currentParaStyle < 5) && (chars->at(s)->cab > 4))
// {
// chars->at(s)->charStyle = currItem->itemText.defaultStyle().charStyle();
// }
chars->at(s)->cab = Editor->currentParaStyle;
}
Editor->updateFromChars(pa);
3426,7 → 3427,7
}
else
{
if (Editor->currentParaStyle > 4)
// if (Editor->currentParaStyle > 4)
{
if (!currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().font().isNone())
{
3447,7 → 3448,7
Editor->CurrTextStrikeWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].charStyle().strikethruWidth();
}
}
else
/* else
{
const CharStyle& currStyle = currItem->itemText.defaultStyle().charStyle();
Editor->CurrTextFill = currStyle.fillColor();
3470,6 → 3471,7
Editor->CurrTextStrikePos = currStyle.strikethruOffset();
Editor->CurrTextStrikeWidth = currStyle.strikethruWidth();
}
*/
Editor->setStyle(Editor->CurrentStyle);
if (Editor->CurrentStyle & 4)
{
/branches/Version13x/Scribus/scribus/scpainter.cpp
25,12 → 25,13
/* Adapted for Scribus 22.08.2003 by Franz Schmid */
// kopainter/libart wrapper
 
#include "scpainter.h"
#include <qpaintdevice.h>
#include <qpixmap.h>
#include <qpointarray.h>
#include <qimage.h>
 
#include "scpainter.h"
 
#ifdef HAVE_CAIRO
#include <cairo.h>
#include "colorutil.h"
39,7 → 40,7
#elif defined(Q_WS_X11)
#include <cairo-xlib.h>
#elif defined(Q_WS_MAC)
#include <cairo-quartz.h>
// #include <cairo-quartz.h>
#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 6)
#include <cairo-svg.h>
83,6 → 84,7
 
#include <math.h>
 
 
/// screen painter
ScPainter::ScPainter( QPaintDevice *target, unsigned int w, unsigned int h, unsigned int x, unsigned int y )
{
/branches/Version13x/Scribus/scribus/scribusdoc.h
677,33 → 677,38
bool sendItemSelectionToBack();
bool bringItemSelectionToFront();
 
/** Workhorse for the following methods */
void itemSelection_ApplyTextStyle(const CharStyle & newstyle);
void itemSelection_ApplyParagraphStyle(const ParagraphStyle & newstyle);
void itemSelection_SetParagraphStyle(const ParagraphStyle & newstyle);
void itemSelection_ApplyCharStyle(const CharStyle & newstyle);
void itemSelection_SetCharStyle(const CharStyle & newstyle);
 
void ChLineWidth(double w);
void ChLineArt(Qt::PenStyle w);
void ChLineJoin(Qt::PenJoinStyle w);
void ChLineEnd(Qt::PenCapStyle w);
void ChLineSpa(double w);
void ChLineSpaMode(int w);
void itemSelection_SetAlignment(int w);
void itemSelection_SetLineSpacing(double w);
void itemSelection_SetLineSpacingMode(int w);
//void ChLocalXY(double x, double y);
//void ChLocalSc(double x, double y);
void ItemFont(QString fon);
void ItemTextBrush(QString farbe);
void ItemTextBrushS(int sha);
void ItemTextPen(QString farbe);
void ItemTextPenS(int sha);
void ItemTextScaleV(int sha);
void ItemTextScale(int sha);
void setItemTextBase(int sha);
void setItemTextOutline(int sha);
void setItemTextShadow(int shx, int shy);
void setItemTextUnderline(int pos, int wid);
void setItemTextStrike(int pos, int wid);
void chTyStyle(int s);
void chAbStyle(PageItem *currItem, int s);
void chKerning(int us);
void chFSize(int size);
void itemSelection_SetFont(QString fon);
void itemSelection_SetFillColor(QString farbe);
void itemSelection_SetFillShade(int sha);
void itemSelection_SetStrokeColor(QString farbe);
void itemSelection_SetStrokeShade(int sha);
void itemSelection_SetScaleV(int);
void itemSelection_SetScaleH(int);
void itemSelection_SetBaselineOffset(int);
void itemSelection_SetOutlineWidth(int);
void itemSelection_SetShadowOffsets(int shx, int shy);
void itemSelection_SetUnderline(int pos, int wid);
void itemSelection_SetStrikethru(int pos, int wid);
void itemSelection_SetEffects(int s);
// void chAbStyle(PageItem *currItem, int s);
 
void itemSelection_SetTracking(int us);
void itemSelection_SetFontSize(int size);
//void FlipImageH();
//void FlipImageV();
void MirrorPolyH(PageItem *currItem);
960,7 → 965,6
void itemSelection_DoHyphenate();
void itemSelection_DoDeHyphenate();
void itemSelection_SendToLayer(int layerNumber);
void itemSelection_SetParagraphStyle(int s);
void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0);
void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0);
void itemSelection_SetImageScaleAndOffset(double ox, double oy, double sx, double sy, Selection* customSelection=0);
/branches/Version13x/Scribus/scribus/tocindexprefs.cpp
274,9 → 274,9
paragraphStyleList.clear();
paragraphStyleList.append(trStrNone);
 
if(currDoc!=NULL && currDoc->docParagraphStyles.count()>5)
if(currDoc!=NULL) // && currDoc->docParagraphStyles.count()>5)
{
for (uint i = 5; i < currDoc->docParagraphStyles.count(); ++i)
for (uint i = 0; i < currDoc->docParagraphStyles.count(); ++i)
paragraphStyleList.append(currDoc->docParagraphStyles[i].name());
}
itemParagraphStyleComboBox->clear();
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
576,9 → 576,8
else // for multiple selection
{
int mode = ScCore->primaryMainWindow()->doc->appMode;
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
for (uint i = 0; i < ScCore->primaryMainWindow()->doc->m_Selection->count(); ++i)
ScCore->primaryMainWindow()->doc->chAbStyle(ScCore->primaryMainWindow()->doc->m_Selection->itemAt(i), styleid);
ScCore->primaryMainWindow()->doc->appMode = modeNormal;
ScCore->primaryMainWindow()->doc->itemSelection_ApplyParagraphStyle(ScCore->primaryMainWindow()->doc->docParagraphStyles[styleid]);
ScCore->primaryMainWindow()->doc->appMode = mode;
}
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
346,7 → 346,7
ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
if (i->HasSel)
ScCore->primaryMainWindow()->doc->appMode = modeEdit;
ScCore->primaryMainWindow()->doc->chFSize(qRound(size * 10.0));
ScCore->primaryMainWindow()->doc->itemSelection_SetFontSize(qRound(size * 10.0));
ScCore->primaryMainWindow()->doc->appMode = Apm;
ScCore->primaryMainWindow()->view->Deselect();
Py_INCREF(Py_None);
/branches/Version13x/Scribus/scribus/plugins/svgimplugin/svgplugin.cpp
2031,14 → 2031,16
double xoffset = 0.0, yoffset = 0.0;
if( gc->textAnchor == "middle" )
{
m_Doc->currentStyle = m_Doc->docParagraphStyles[1];
m_Doc->chAbStyle(ite, 1);
m_Doc->m_Selection->clear();
m_Doc->m_Selection->addItem(ite, true);
m_Doc->itemSelection_SetAlignment(1);
xoffset = -ite->width() / 2;
}
else if( gc->textAnchor == "end")
{
m_Doc->currentStyle = m_Doc->docParagraphStyles[2];
m_Doc->chAbStyle(ite, 2);
m_Doc->m_Selection->clear();
m_Doc->m_Selection->addItem(ite, true);
m_Doc->itemSelection_SetAlignment(2);
xoffset = -ite->width();
}
double rotation = getRotationFromMatrix(gc->matrix, 0.0);
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
434,12 → 434,13
}
if(pg.tagName()=="STYLE")
{
vg.erase();
vg.setName(pg.attribute("NAME"));
vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(pg.attribute("LINESPMode", "0").toInt()));
vg.setLineSpacing(pg.attribute("LINESP").toDouble());
vg.setLeftMargin(pg.attribute("INDENT", "0").toDouble());
vg.setFirstIndent(pg.attribute("FIRST", "0").toDouble());
vg.setAlignment(pg.attribute("ALIGN").toInt());
vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg.attribute("ALIGN").toInt()));
vg.setGapBefore(pg.attribute("VOR", "0").toDouble());
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
tmpf = pg.attribute("FONT", m_Doc->toolSettings.defFont);
488,7 → 489,8
{
tmp = pg.attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
vg.tabValues().clear();
// vg.tabValues().clear();
QValueList<ParagraphStyle::TabRecord> tbs;
ParagraphStyle::TabRecord tb;
for (int cxv = 0; cxv < pg.attribute("NUMTAB", "0").toInt(); cxv += 2)
{
497,13 → 499,14
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
vg.tabValues().append(tb);
tbs.append(tb);
}
vg.setTabValues(tbs);
tmp = "";
}
else
vg.tabValues().clear();
m_Doc->docParagraphStyles.append(new ParagraphStyle(vg));
// else
// vg.tabValues().clear();
m_Doc->docParagraphStyles.create(vg);
}
if(pg.tagName()=="JAVA")
m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
1094,6 → 1097,16
int pos = obj->itemText.length();
obj->itemText.insertChars(pos, QString(ch));
obj->itemText.applyCharStyle(pos, 1, style); // FIXME:NLS
if (ch == SpecialChars::PARSEP) {
ParagraphStyle pstyle;
if (ab < 5) {
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(ab));
}
else {
pstyle.setParent( doc->docParagraphStyles[ab-5].name());
}
obj->itemText.applyStyle(pos, pstyle);
}
}
#endif
return;
1487,7 → 1500,7
vg->setLineSpacing(pg->attribute("LINESP").toDouble());
vg->setLeftMargin(pg->attribute("INDENT", "0").toDouble());
vg->setFirstIndent(pg->attribute("FIRST", "0").toDouble());
vg->setAlignment(pg->attribute("ALIGN").toInt());
vg->setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg->attribute("ALIGN").toInt()));
vg->setGapBefore(pg->attribute("VOR", "0").toDouble());
vg->setGapAfter(pg->attribute("NACH", "0").toDouble());
tmpf = pg->attribute("FONT", doc->toolSettings.defFont);
1521,13 → 1534,13
vg->charStyle().setScaleV(qRound(pg->attribute("SCALEV", "100").toDouble() * 10));
vg->charStyle().setBaselineOffset(qRound(pg->attribute("BASEO", "0").toDouble() * 10));
vg->charStyle().setTracking(qRound(pg->attribute("KERN", "0").toDouble() * 10));
vg->tabValues().clear();
// vg->tabValues().clear();
if ((pg->hasAttribute("NUMTAB")) && (pg->attribute("NUMTAB", "0").toInt() != 0))
{
QValueList<ParagraphStyle::TabRecord> tbs;
ParagraphStyle::TabRecord tb;
QString tmp = pg->attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
vg->tabValues().clear();
for (int cxv = 0; cxv < pg->attribute("NUMTAB", "0").toInt(); cxv += 2)
{
tgv >> xf;
1535,12 → 1548,14
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
vg->tabValues().append(tb);
tbs.append(tb);
}
vg->setTabValues(tbs);
tmp = "";
}
else
{
QValueList<ParagraphStyle::TabRecord> tbs;
QDomNode IT = pg->firstChild();
while(!IT.isNull())
{
1556,8 → 1571,9
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
vg->tabValues().append(tb);
tbs.append(tb);
}
vg->setTabValues(tbs);
IT=IT.nextSibling();
}
}
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
219,7 → 219,7
{
getNewReplacement=newReplacement;
getReplacedFonts=ReplacedFonts;
getDummyScFaces=dummyScFaces;
// getDummyScFaces=dummyScFaces;
}
 
bool Scribus13Format::loadFile(const QString & fileName, const FileFormat & /* fmt */, int /* flags */, int /* index */)
561,7 → 561,7
if(pg.tagName()=="STYLE")
{
readParagraphStyle(vg, pg, *m_AvailableFonts, m_Doc);
m_Doc->docParagraphStyles.append(new ParagraphStyle(vg));
m_Doc->docParagraphStyles.create(vg);
}
if(pg.tagName()=="JAVA")
m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
1030,7 → 1030,7
Neu->gWidth = pg.attribute("gWidth",defaultVal).toDouble();
defaultVal.setNum(Neu->height());
Neu->gHeight = pg.attribute("gHeight",defaultVal).toDouble();
/*FIXME if (Neu->lineSpacingMode() == 3)
/* if (Neu->lineSpacingMode() == 3)
{
m_Doc->docParagraphStyles[0].setUseBaselineGrid(true);
Neu->setLineSpacing(m_Doc->typographicSettings.valueBaseGrid-1);
1415,9 → 1415,9
co.setAttribute("Register",static_cast<int>(m_Doc->PageColors[itc.key()].isRegistrationColor()));
dc.appendChild(co);
}
if (m_Doc->docParagraphStyles.count() > 5)
// if (m_Doc->docParagraphStyles.count() > 5)
{
for (uint ff = 5; ff < m_Doc->docParagraphStyles.count(); ++ff)
for (uint ff = 0; ff < m_Doc->docParagraphStyles.count(); ++ff)
{
QDomElement fo=docu.createElement("STYLE");
fo.setAttribute("NAME",m_Doc->docParagraphStyles[ff].name());
1425,6 → 1425,7
fo.setAttribute("LINESPMode",m_Doc->docParagraphStyles[ff].lineSpacingMode());
fo.setAttribute("LINESP",m_Doc->docParagraphStyles[ff].lineSpacing());
fo.setAttribute("INDENT",m_Doc->docParagraphStyles[ff].leftMargin());
fo.setAttribute("RMARGIN",m_Doc->docParagraphStyles[ff].rightMargin());
fo.setAttribute("FIRST",m_Doc->docParagraphStyles[ff].firstIndent());
fo.setAttribute("VOR",m_Doc->docParagraphStyles[ff].gapBefore());
fo.setAttribute("NACH",m_Doc->docParagraphStyles[ff].gapAfter());
1739,15 → 1740,17
ScFace dummy = ScFace::none();
bool unknown = false;
QString tmp2, tmpf;
CharStyle newStyle;
 
tmp2 = it->attribute("CH");
tmp2.replace(QRegExp("\r"), QChar(13));
tmp2.replace(QRegExp("\n"), QChar(13));
tmp2.replace(QRegExp("\t"), QChar(9));
tmpf = it->attribute("CFONT", doc->toolSettings.defFont);
tmpf = it->attribute("CFONT", "");
PrefsManager* prefsManager=PrefsManager::instance();
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
if (!tmpf.isEmpty() && (!prefsManager->appPrefs.AvailFonts.contains(tmpf) || !prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
bool isThere = false;
/* bool isThere = false;
for (uint dl = 0; dl < dummyScFaces.count(); ++dl)
{
if ((*dummyScFaces.at(dl)).scName() == tmpf)
1762,7 → 1765,7
// dummy = ScFace(tmpf, "", tmpf, "", "", 1, false);
dummyScFaces.append(dummy);
}
unknown = true;
*/ unknown = true;
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
1770,81 → 1773,104
}
else
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.GFontSub[tmpf]);
dummy = prefsManager->appPrefs.AvailFonts[ReplacedFonts[tmpf]].mkReplacementFor(tmpf, doc->DocName);
prefsManager->appPrefs.AvailFonts.insert(tmpf, dummy);
}
else
{
if (!doc->UsedFonts.contains(tmpf))
if (! tmpf.isEmpty() && !doc->UsedFonts.contains(tmpf))
{
doc->AddFont(tmpf, qRound(doc->toolSettings.defSize / 10.0));
}
}
int size = qRound(it->attribute("CSIZE").toDouble() * 10);
QString fcolor = it->attribute("CCOLOR");
int extra;
 
if (! tmpf.isEmpty() )
newStyle.setFont((*doc->AllFonts)[tmpf]);
 
if (it->hasAttribute("CSIZE"))
newStyle.setFontSize(qRound(it->attribute("CSIZE").toDouble() * 10));
if (it->hasAttribute("CCOLOR"))
newStyle.setFillColor(it->attribute("CCOLOR"));
if (it->hasAttribute("CEXTRA"))
extra = qRound(it->attribute("CEXTRA").toDouble() / it->attribute("CSIZE").toDouble() * 1000.0);
else
extra = it->attribute("CKERN").toInt();
int shade = it->attribute("CSHADE").toInt();
int style = it->attribute("CSTYLE").toInt();
int ab = it->attribute("CAB", "0").toInt();
QString stroke = it->attribute("CSTROKE", CommonStrings::None);
int shade2 = it->attribute("CSHADE2", "100").toInt();
int scale = qRound(it->attribute("CSCALE", "100").toDouble() * 10);
int scalev = qRound(it->attribute("CSCALEV", "100").toDouble() * 10);
int base = qRound(it->attribute("CBASE", "0").toDouble() * 10);
int shX = qRound(it->attribute("CSHX", "5").toDouble() * 10);
int shY = qRound(it->attribute("CSHY", "-5").toDouble() * 10);
int outL = qRound(it->attribute("COUT", "1").toDouble() * 10);
int ulp = qRound(it->attribute("CULP", "-0.1").toDouble() * 10);
int ulw = qRound(it->attribute("CULW", "-0.1").toDouble() * 10);
int stp = qRound(it->attribute("CSTP", "-0.1").toDouble() * 10);
int stw = qRound(it->attribute("CSTW", "-0.1").toDouble() * 10);
newStyle.setTracking(qRound(it->attribute("CEXTRA").toDouble() / it->attribute("CSIZE").toDouble() * 1000.0));
else if (it->hasAttribute("CKERN"))
newStyle.setTracking(it->attribute("CKERN").toInt());
if (it->hasAttribute("CSHADE"))
newStyle.setFillShade(it->attribute("CSHADE").toInt());
if (it->hasAttribute("CSTYLE"))
newStyle.setEffects(static_cast<StyleFlag>(it->attribute("CSTYLE").toInt()));
 
QString pstylename = it->attribute("PSTYLE", "");
int calign = it->attribute("CALIGN", "-1").toInt();
int ab = it->attribute("CAB", "-1").toInt();
if (ab >= 5) {
pstylename = doc->docParagraphStyles[ab-5].name();
calign = -1;
}
else if (ab >= 0) {
pstylename = "";
calign = ab;
}
if (it->hasAttribute("CSTROKE"))
newStyle.setStrokeColor(it->attribute("CSTROKE", CommonStrings::None));
if (it->hasAttribute("CSHADE2"))
newStyle.setStrokeShade(it->attribute("CSHADE2", "100").toInt());
if (it->hasAttribute("CSCALE"))
newStyle.setScaleH(QMIN(QMAX(qRound(it->attribute("CSCALE", "100").toDouble() * 10), 100), 4000));
if (it->hasAttribute("CSCALEV"))
newStyle.setScaleV(QMIN(QMAX(qRound(it->attribute("CSCALEV", "100").toDouble() * 10), 100), 4000));
if (it->hasAttribute("CBASE"))
newStyle.setBaselineOffset(qRound(it->attribute("CBASE", "0").toDouble() * 10));
 
if (it->hasAttribute("CSHX"))
newStyle.setShadowXOffset(qRound(it->attribute("CSHX", "5").toDouble() * 10));
 
if (it->hasAttribute("CSHY"))
newStyle.setShadowYOffset(qRound(it->attribute("CSHY", "-5").toDouble() * 10));
if (it->hasAttribute("COUT"))
newStyle.setOutlineWidth(qRound(it->attribute("COUT", "1").toDouble() * 10));
 
if (it->hasAttribute("CULP"))
newStyle.setUnderlineOffset(qRound(it->attribute("CULP", "-0.1").toDouble() * 10));
 
if (it->hasAttribute("CULW"))
newStyle.setUnderlineWidth(qRound(it->attribute("CULW", "-0.1").toDouble() * 10));
 
if (it->hasAttribute("CSTP"))
newStyle.setStrikethruOffset(qRound(it->attribute("CSTP", "-0.1").toDouble() * 10));
if (it->hasAttribute("CSTW"))
newStyle.setStrikethruWidth(qRound(it->attribute("CSTW", "-0.1").toDouble() * 10));
 
int iobj = it->attribute("COBJ", "-1").toInt();
for (uint cxx=0; cxx<tmp2.length(); ++cxx)
{
CharStyle newStyle;
QChar ch = tmp2.at(cxx);
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
if (ch == QChar(4))
ch = SpecialChars::TAB;
if (unknown)
newStyle.setFont(dummy);
else
newStyle.setFont((*doc->AllFonts)[tmpf]);
newStyle.setFontSize(size);
newStyle.setFillColor(fcolor);
newStyle.setTracking(extra);
newStyle.setFillShade(shade);
newStyle.setEffects(static_cast<StyleFlag>(style));
if (ab >= 5) breakPoint();
if (impo)
{
if (VorLFound)
last->ParaStyle = DoVorl[ab].toUInt();
else
{
if (ab < 5)
last->ParaStyle = ab;
else
last->ParaStyle = 0;
}
QChar ch = tmp2.at(cxx);
{ // Legacy mode
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
if (ch == QChar(4))
ch = SpecialChars::TAB;
}
if (impo && ab >= 0 && VorLFound)
last->ParaStyle = DoVorl[ab].toInt();
else
last->ParaStyle = ab;
newStyle.setStrokeColor(stroke);
newStyle.setStrokeShade(shade2);
newStyle.setScaleH(QMIN(QMAX(scale, 100), 4000));
newStyle.setScaleV(QMIN(QMAX(scalev, 100), 4000));
newStyle.setBaselineOffset(base);
newStyle.setShadowXOffset(shX);
newStyle.setShadowYOffset(shY);
newStyle.setOutlineWidth(outL);
newStyle.setUnderlineOffset(ulp);
newStyle.setUnderlineWidth(ulw);
newStyle.setStrikethruOffset(stp);
newStyle.setStrikethruWidth(stw);
last->ParaStyle = doc->docParagraphStyles.find(pstylename);
 
int pos = obj->itemText.length();
if (ch == SpecialChars::OBJECT) {
if (iobj != -1) {
1864,28 → 1890,27
}
if (ch == SpecialChars::PARSEP) {
ParagraphStyle pstyle;
if (last->ParaStyle < 5) {
pstyle.setAlignment(QMAX(0, last->ParaStyle));
if (last->ParaStyle >= 0) {
pstyle.setParent( doc->docParagraphStyles[last->ParaStyle].name());
}
else {
pstyle.setParent( & doc->docParagraphStyles[last->ParaStyle]);
}
qDebug(QString("par style at %1: %2/%3 (%4)").arg(pos).arg(pstyle.name()).arg(pstyle.parent()?pstyle.parent()->name():"").arg(last->ParaStyle));
if (calign >= 0)
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(calign));
qDebug(QString("par style at %1: %2/%3 (%4) calign %5").arg(pos).arg(pstyle.name()).arg(pstyle.parent()).arg(last->ParaStyle).arg(calign));
obj->itemText.applyStyle(pos, pstyle);
}
}
obj->itemText.applyCharStyle(last->StyleStart, obj->itemText.length()-last->StyleStart, last->Style);
ParagraphStyle pstyle;
if (last->ParaStyle < 5) {
pstyle.setAlignment(QMAX(0, last->ParaStyle));
if (last->ParaStyle >= 0) {
pstyle.setParent( doc->docParagraphStyles[last->ParaStyle].name());
}
else {
pstyle.setParent( & doc->docParagraphStyles[last->ParaStyle]);
}
if (calign >= 0)
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(calign));
obj->itemText.applyStyle(obj->itemText.length()-1, pstyle);
return;
}
 
 
void Scribus13Format::readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc)
{
vg.setName(pg.attribute("NAME"));
1897,7 → 1922,7
else
vg.setRightMargin(0);
vg.setFirstIndent(pg.attribute("FIRST", "0").toDouble());
vg.setAlignment(pg.attribute("ALIGN").toInt());
vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg.attribute("ALIGN").toInt()));
vg.setGapBefore(pg.attribute("VOR", "0").toDouble());
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
1945,9 → 1970,10
vg.charStyle().setScaleV(qRound(pg.attribute("SCALEV", "100").toDouble() * 10));
vg.charStyle().setBaselineOffset(qRound(pg.attribute("BASEO", "0").toDouble() * 10));
vg.charStyle().setTracking(qRound(pg.attribute("KERN", "0").toDouble() * 10));
vg.tabValues().clear();
// vg.tabValues().clear();
if ((pg.hasAttribute("NUMTAB")) && (pg.attribute("NUMTAB", "0").toInt() != 0))
{
QValueList<ParagraphStyle::TabRecord> tbs;
ParagraphStyle::TabRecord tb;
QString tmp = pg.attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
1959,12 → 1985,14
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
vg.tabValues().append(tb);
tbs.append(tb);
}
vg.setTabValues(tbs);
tmp = "";
}
else
{
QValueList<ParagraphStyle::TabRecord> tbs;
QDomNode IT = pg.firstChild();
while(!IT.isNull())
{
1980,8 → 2008,9
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
vg.tabValues().append(tb);
tbs.append(tb);
}
vg.setTabValues(tbs);
IT=IT.nextSibling();
}
}
2174,7 → 2203,7
// for some reason IFONT is set later, check at the place where PasteItem() is called.
pstyle.setLineSpacing(obj->attribute("LINESP").toDouble());
pstyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(obj->attribute("LINESPMode", "0").toInt()));
pstyle.setAlignment(obj->attribute("ALIGN", "0").toInt());
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(obj->attribute("ALIGN", "0").toInt()));
pstyle.charStyle().setFontSize(qRound(obj->attribute("ISIZE", "12").toDouble() * 10));
pstyle.charStyle().setStrokeColor(obj->attribute("TXTSTROKE", CommonStrings::None));
pstyle.charStyle().setFillColor(obj->attribute("TXTFILL", "Black"));
2810,12 → 2839,13
Neu->gWidth = pg.attribute("gWidth",defaultVal).toDouble();
defaultVal.setNum(Neu->height());
Neu->gHeight = pg.attribute("gHeight",defaultVal).toDouble();
/*FIXME if (Neu->lineSpacingMode() == 3)
/* if (Neu->lineSpacingMode() == 3)
{
m_Doc->docParagraphStyles[0].setUseBaselineGrid(true);
Neu->setLineSpacing(m_Doc->typographicSettings.valueBaseGrid-1);
}
*/ if (Neu->isAutoText)
*/
if (Neu->isAutoText)
m_Doc->LastAuto = Neu;
Neu->NextIt = baseobj + pg.attribute("NEXTITEM").toInt();
if (Neu->isTableItem)
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
54,6 → 54,21
void GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> &docParagraphStyles, ScribusDoc* doc, bool fl);
QString readSLA(const QString & fileName);
QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
void writeCheckerProfiles(QDomDocument & docu);
void writeLinestyles(QDomDocument & docu);
void writeJavascripts(QDomDocument & docu);
void writeBookmarks(QDomDocument & docu);
void writeColors(QDomDocument & docu);
void writePStyles(QDomDocument & docu);
void writeCStyles(QDomDocument & docu);
void writeLayers(QDomDocument & docu);
void writePdfOptions(QDomDocument & docu);
void writeDocItemAttributes(QDomDocument & docu);
void writeTOC(QDomDocument & docu);
void writePageSets(QDomDocument & docu);
void writeSections(QDomDocument & docu);
void writePatterns(QDomDocument & docu);
void writeContent(QDomDocument & docu);
void WritePages(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, bool master);
void WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master, QPtrList<PageItem> *items = 0);
void SetItemProps(QDomElement *ob, PageItem* item, bool newFormat);
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
181,6 → 181,56
dc.setAttribute("MARGC",m_Doc->guidesSettings.margColor.name());
dc.setAttribute("RANDF", static_cast<int>(m_Doc->marginColored));
dc.setAttribute("currentProfile", m_Doc->curCheckProfile);
elem.appendChild(dc);
writeCheckerProfiles(docu);
writeLinestyles(docu);
writeJavascripts(docu);
writeBookmarks(docu);
writeColors(docu);
writePStyles(docu);
writeCStyles(docu);
writeLayers(docu);
writePdfOptions(docu);
writeDocItemAttributes(docu);
writeTOC(docu);
writePageSets(docu);
writeSections(docu);
writeContent(docu);
/**
* changed to enable saving
* of *.gz documents
* 2.7.2002 C.Toepp
* <c.toepp@gmx.de>
*/
QCString cs = docu.toCString(); // UTF-8 QCString
#ifdef HAVE_LIBZ
if(fileName.right(2) == "gz")
{
// zipped saving
// XXX: latin1() should probably be local8Bit()
gzFile gzDoc = gzopen(fileName.latin1(),"wb");
if(gzDoc == NULL)
return false;
gzputs(gzDoc, cs.data());
gzclose(gzDoc);
}
else
#endif
{
QFile f(fileName);
if(!f.open(IO_WriteOnly))
return false;
QTextStream s(&f);
s.writeRawBytes(cs, cs.length());
f.close();
}
return true;
}
 
void Scribus134Format::writeCheckerProfiles(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
CheckerPrefsList::Iterator itcp;
CheckerPrefsList::Iterator itcpend=m_Doc->checkerProfiles.end();
for (itcp = m_Doc->checkerProfiles.begin(); itcp != itcpend; ++itcp)
200,9 → 250,15
dc79a.setAttribute("checkAnnotations", static_cast<int>(itcp.data().checkAnnotations));
dc79a.setAttribute("checkRasterPDF", static_cast<int>(itcp.data().checkRasterPDF));
dc79a.setAttribute("checkForGIF", static_cast<int>(itcp.data().checkForGIF));
dc79a.setAttribute("ignoreOffLayers", static_cast<int>(itcp.data().ignoreOffLayers));
dc79a.setAttribute("ignoreOffLayers", static_cast<int>(itcp.data().ignoreOffLayers));
dc.appendChild(dc79a);
}
}
 
void Scribus134Format::writeLinestyles(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QMap<QString,multiLine>::Iterator itMU;
for (itMU = m_Doc->MLineStyles.begin(); itMU != m_Doc->MLineStyles.end(); ++itMU)
{
243,6 → 299,13
dc.appendChild(ar);
}
}
}
 
 
void Scribus134Format::writeJavascripts(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QMap<QString,QString>::Iterator itja;
for (itja = m_Doc->JavaScripts.begin(); itja != m_Doc->JavaScripts.end(); ++itja)
{
251,6 → 314,14
jav.setAttribute("SCRIPT",itja.data());
dc.appendChild(jav);
}
}
 
 
void Scribus134Format::writeBookmarks(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QValueList<ScribusDoc::BookMa>::Iterator itbm;
for (itbm = m_Doc->BookMarks.begin(); itbm != m_Doc->BookMarks.end(); ++itbm)
{
267,6 → 338,13
fn.setAttribute("Parent", (*itbm).Parent);
dc.appendChild(fn);
}
}
 
 
void Scribus134Format::writeColors(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
ColorList::Iterator itc;
for (itc = m_Doc->PageColors.begin(); itc != m_Doc->PageColors.end(); ++itc)
{
280,26 → 358,48
co.setAttribute("Register",static_cast<int>(m_Doc->PageColors[itc.key()].isRegistrationColor()));
dc.appendChild(co);
}
if (m_Doc->docParagraphStyles.count() > 5)
}
 
void Scribus134Format::writePStyles(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
// if (m_Doc->docParagraphStyles.count() > 5)
{
for (uint ff = 5; ff < m_Doc->docParagraphStyles.count(); ++ff)
for (uint ff = 0; ff < m_Doc->docParagraphStyles.count(); ++ff)
{
QDomElement fo=docu.createElement("STYLE");
fo.setAttribute("NAME",m_Doc->docParagraphStyles[ff].name());
fo.setAttribute("ALIGN",m_Doc->docParagraphStyles[ff].alignment());
fo.setAttribute("LINESPMode",m_Doc->docParagraphStyles[ff].lineSpacingMode());
fo.setAttribute("LINESP",m_Doc->docParagraphStyles[ff].lineSpacing());
fo.setAttribute("INDENT",m_Doc->docParagraphStyles[ff].leftMargin());
fo.setAttribute("FIRST",m_Doc->docParagraphStyles[ff].firstIndent());
fo.setAttribute("VOR",m_Doc->docParagraphStyles[ff].gapBefore());
fo.setAttribute("NACH",m_Doc->docParagraphStyles[ff].gapAfter());
fo.setAttribute("FONT",m_Doc->docParagraphStyles[ff].charStyle().font().scName());
fo.setAttribute("FONTSIZE",m_Doc->docParagraphStyles[ff].charStyle().fontSize() / 10.0);
fo.setAttribute("DROP", static_cast<int>(m_Doc->docParagraphStyles[ff].hasDropCap()));
fo.setAttribute("DROPLIN", m_Doc->docParagraphStyles[ff].dropCapLines());
fo.setAttribute("DROPDIST", m_Doc->docParagraphStyles[ff].dropCapOffset());
fo.setAttribute("EFFECT", m_Doc->docParagraphStyles[ff].charStyle().effects());
if (m_Doc->docParagraphStyles[ff].tabValues().count() != 0)
const Style * parent = m_Doc->docParagraphStyles[ff].parentStyle();
if ( parent != NULL)
fo.setAttribute("PARENT", m_Doc->docParagraphStyles[ff].parent());
 
if ( ! m_Doc->docParagraphStyles[ff].isInhAlignment())
fo.setAttribute("ALIGN",m_Doc->docParagraphStyles[ff].alignment());
if ( ! m_Doc->docParagraphStyles[ff].isInhLineSpacingMode())
fo.setAttribute("LINESPMode",m_Doc->docParagraphStyles[ff].lineSpacingMode());
if ( ! m_Doc->docParagraphStyles[ff].isInhLineSpacing())
fo.setAttribute("LINESP",m_Doc->docParagraphStyles[ff].lineSpacing());
if ( ! m_Doc->docParagraphStyles[ff].isInhUseBaselineGrid())
fo.setAttribute("BASE", static_cast<int>(m_Doc->docParagraphStyles[ff].useBaselineGrid()));
if ( ! m_Doc->docParagraphStyles[ff].isInhLeftMargin())
fo.setAttribute("INDENT",m_Doc->docParagraphStyles[ff].leftMargin());
if ( ! m_Doc->docParagraphStyles[ff].isInhRightMargin())
fo.setAttribute("RMARGIN",m_Doc->docParagraphStyles[ff].rightMargin());
if ( ! m_Doc->docParagraphStyles[ff].isInhFirstIndent())
fo.setAttribute("FIRST",m_Doc->docParagraphStyles[ff].firstIndent());
if ( ! m_Doc->docParagraphStyles[ff].isInhGapBefore())
fo.setAttribute("VOR",m_Doc->docParagraphStyles[ff].gapBefore());
if ( ! m_Doc->docParagraphStyles[ff].isInhGapAfter())
fo.setAttribute("NACH",m_Doc->docParagraphStyles[ff].gapAfter());
if ( ! m_Doc->docParagraphStyles[ff].isInhHasDropCap())
fo.setAttribute("DROP", static_cast<int>(m_Doc->docParagraphStyles[ff].hasDropCap()));
if ( ! m_Doc->docParagraphStyles[ff].isInhDropCapLines())
fo.setAttribute("DROPLIN", m_Doc->docParagraphStyles[ff].dropCapLines());
if ( ! m_Doc->docParagraphStyles[ff].isInhDropCapOffset())
fo.setAttribute("DROPDIST", m_Doc->docParagraphStyles[ff].dropCapOffset());
if ( ! m_Doc->docParagraphStyles[ff].isInhTabValues())
{
for (uint a = 0; a < m_Doc->docParagraphStyles[ff].tabValues().count(); ++a)
{
313,25 → 413,103
fo.appendChild(tabs);
}
}
fo.setAttribute("FCOLOR",m_Doc->docParagraphStyles[ff].charStyle().fillColor());
fo.setAttribute("FSHADE",m_Doc->docParagraphStyles[ff].charStyle().fillShade());
fo.setAttribute("SCOLOR",m_Doc->docParagraphStyles[ff].charStyle().strokeColor());
fo.setAttribute("SSHADE",m_Doc->docParagraphStyles[ff].charStyle().strokeShade());
fo.setAttribute("BASE", static_cast<int>(m_Doc->docParagraphStyles[ff].useBaselineGrid()));
fo.setAttribute("TXTSHX",m_Doc->docParagraphStyles[ff].charStyle().shadowXOffset() / 10.0);
fo.setAttribute("TXTSHY",m_Doc->docParagraphStyles[ff].charStyle().shadowYOffset() / 10.0);
fo.setAttribute("TXTOUT",m_Doc->docParagraphStyles[ff].charStyle().outlineWidth() / 10.0);
fo.setAttribute("TXTULP",m_Doc->docParagraphStyles[ff].charStyle().underlineOffset() / 10.0);
fo.setAttribute("TXTULW",m_Doc->docParagraphStyles[ff].charStyle().underlineWidth() / 10.0);
fo.setAttribute("TXTSTP",m_Doc->docParagraphStyles[ff].charStyle().strikethruOffset() / 10.0);
fo.setAttribute("TXTSTW",m_Doc->docParagraphStyles[ff].charStyle().strikethruWidth() / 10.0);
fo.setAttribute("SCALEH",m_Doc->docParagraphStyles[ff].charStyle().scaleH() / 10.0);
fo.setAttribute("SCALEV",m_Doc->docParagraphStyles[ff].charStyle().scaleV() / 10.0);
fo.setAttribute("BASEO",m_Doc->docParagraphStyles[ff].charStyle().baselineOffset() / 10.0);
fo.setAttribute("KERN",m_Doc->docParagraphStyles[ff].charStyle().tracking() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhFont())
fo.setAttribute("FONT",m_Doc->docParagraphStyles[ff].charStyle().font().scName());
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhFontSize())
fo.setAttribute("FONTSIZE",m_Doc->docParagraphStyles[ff].charStyle().fontSize() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhFillColor())
fo.setAttribute("FCOLOR",m_Doc->docParagraphStyles[ff].charStyle().fillColor());
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhFillShade())
fo.setAttribute("FSHADE",m_Doc->docParagraphStyles[ff].charStyle().fillShade());
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhStrokeColor())
fo.setAttribute("SCOLOR",m_Doc->docParagraphStyles[ff].charStyle().strokeColor());
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhStrokeShade())
fo.setAttribute("SSHADE",m_Doc->docParagraphStyles[ff].charStyle().strokeShade());
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhEffects())
fo.setAttribute("EFFECT", m_Doc->docParagraphStyles[ff].charStyle().effects());
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhShadowXOffset())
fo.setAttribute("TXTSHX",m_Doc->docParagraphStyles[ff].charStyle().shadowXOffset() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhShadowYOffset())
fo.setAttribute("TXTSHY",m_Doc->docParagraphStyles[ff].charStyle().shadowYOffset() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhOutlineWidth())
fo.setAttribute("TXTOUT",m_Doc->docParagraphStyles[ff].charStyle().outlineWidth() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhUnderlineOffset())
fo.setAttribute("TXTULP",m_Doc->docParagraphStyles[ff].charStyle().underlineOffset() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhUnderlineWidth())
fo.setAttribute("TXTULW",m_Doc->docParagraphStyles[ff].charStyle().underlineWidth() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhStrikethruOffset())
fo.setAttribute("TXTSTP",m_Doc->docParagraphStyles[ff].charStyle().strikethruOffset() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhStrikethruWidth())
fo.setAttribute("TXTSTW",m_Doc->docParagraphStyles[ff].charStyle().strikethruWidth() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhScaleH())
fo.setAttribute("SCALEH",m_Doc->docParagraphStyles[ff].charStyle().scaleH() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhScaleV())
fo.setAttribute("SCALEV",m_Doc->docParagraphStyles[ff].charStyle().scaleV() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhBaselineOffset())
fo.setAttribute("BASEO",m_Doc->docParagraphStyles[ff].charStyle().baselineOffset() / 10.0);
if ( ! m_Doc->docParagraphStyles[ff].charStyle().isInhTracking())
fo.setAttribute("KERN",m_Doc->docParagraphStyles[ff].charStyle().tracking() / 10.0);
dc.appendChild(fo);
}
}
}
 
void Scribus134Format::writeCStyles(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
for (uint ff = 0; ff < m_Doc->docCharStyles.count(); ++ff)
{
QDomElement fo=docu.createElement("CHARSTYLE");
fo.setAttribute("NAME",m_Doc->docCharStyles[ff].name());
const Style * parent = m_Doc->docCharStyles[ff].parentStyle();
if ( parent != NULL)
fo.setAttribute("PARENT", m_Doc->docCharStyles[ff].parent());
if ( ! m_Doc->docCharStyles[ff].isInhFont())
fo.setAttribute("FONT",m_Doc->docCharStyles[ff].font().scName());
if ( ! m_Doc->docCharStyles[ff].isInhFontSize())
fo.setAttribute("FONTSIZE",m_Doc->docCharStyles[ff].fontSize() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhEffects())
fo.setAttribute("EFFECT", m_Doc->docCharStyles[ff].effects());
if ( ! m_Doc->docCharStyles[ff].isInhFillColor())
fo.setAttribute("FCOLOR",m_Doc->docCharStyles[ff].fillColor());
if ( ! m_Doc->docCharStyles[ff].isInhFillShade())
fo.setAttribute("FSHADE",m_Doc->docCharStyles[ff].fillShade());
if ( ! m_Doc->docCharStyles[ff].isInhStrokeColor())
fo.setAttribute("SCOLOR",m_Doc->docCharStyles[ff].strokeColor());
if ( ! m_Doc->docCharStyles[ff].isInhStrokeShade())
fo.setAttribute("SSHADE",m_Doc->docCharStyles[ff].strokeShade());
if ( ! m_Doc->docCharStyles[ff].isInhShadowXOffset())
fo.setAttribute("TXTSHX",m_Doc->docCharStyles[ff].shadowXOffset() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhShadowYOffset())
fo.setAttribute("TXTSHY",m_Doc->docCharStyles[ff].shadowYOffset() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhOutlineWidth())
fo.setAttribute("TXTOUT",m_Doc->docCharStyles[ff].outlineWidth() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhUnderlineOffset())
fo.setAttribute("TXTULP",m_Doc->docCharStyles[ff].underlineOffset() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhUnderlineWidth())
fo.setAttribute("TXTULW",m_Doc->docCharStyles[ff].underlineWidth() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhStrikethruOffset())
fo.setAttribute("TXTSTP",m_Doc->docCharStyles[ff].strikethruOffset() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhStrikethruWidth())
fo.setAttribute("TXTSTW",m_Doc->docCharStyles[ff].strikethruWidth() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhScaleH())
fo.setAttribute("SCALEH",m_Doc->docCharStyles[ff].scaleH() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhScaleV())
fo.setAttribute("SCALEV",m_Doc->docCharStyles[ff].scaleV() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhBaselineOffset())
fo.setAttribute("BASEO",m_Doc->docCharStyles[ff].baselineOffset() / 10.0);
if ( ! m_Doc->docCharStyles[ff].isInhTracking())
fo.setAttribute("KERN",m_Doc->docCharStyles[ff].tracking() / 10.0);
 
dc.appendChild(fo);
}
}
 
void Scribus134Format::writeLayers(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
uint layerCount=m_Doc->layerCount();
for (uint lay = 0; lay < layerCount; ++lay)
{
349,6 → 527,13
la.setAttribute("LAYERC",m_Doc->Layers[lay].markerColor.name());
dc.appendChild(la);
}
}
 
 
void Scribus134Format::writePdfOptions(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QDomElement pdf = docu.createElement("PDF");
pdf.setAttribute("firstUse", static_cast<int>(m_Doc->PDF_Options.firstUse));
pdf.setAttribute("Thumbnails", static_cast<int>(m_Doc->PDF_Options.Thumbnails));
434,6 → 619,12
pdf.appendChild(pdf4);
}
dc.appendChild(pdf);
}
 
void Scribus134Format::writeDocItemAttributes(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QDomElement docItemAttrs = docu.createElement("DocItemAttributes");
for(ObjAttrVector::Iterator objAttrIt = m_Doc->docItemAttributes.begin() ; objAttrIt != m_Doc->docItemAttributes.end(); ++objAttrIt )
{
448,6 → 639,13
docItemAttrs.appendChild(itemAttr);
}
dc.appendChild(docItemAttrs);
}
 
 
void Scribus134Format::writeTOC(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QDomElement tocElem = docu.createElement("TablesOfContents");
for(ToCSetupVector::Iterator tocSetupIt = m_Doc->docToCSetups.begin() ; tocSetupIt != m_Doc->docToCSetups.end(); ++tocSetupIt )
{
472,6 → 670,13
tocElem.appendChild(tocsetup);
}
dc.appendChild(tocElem);
}
 
 
void Scribus134Format::writeSections(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QDomElement sectionElem = docu.createElement("Sections");
for(DocumentSectionMap::Iterator it = m_Doc->sections.begin() ; it != m_Doc->sections.end(); ++it )
{
504,7 → 709,13
sectionElem.appendChild(currsection);
}
dc.appendChild(sectionElem);
}
 
 
void Scribus134Format::writePageSets(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
QDomElement pageSetAttr = docu.createElement("PageSets");
QValueList<PageSet>::Iterator itpgset;
for(itpgset = m_Doc->pageSets.begin(); itpgset != m_Doc->pageSets.end(); ++itpgset )
528,6 → 739,12
pageSetAttr.appendChild(pgst);
}
dc.appendChild(pageSetAttr);
}
 
void Scribus134Format::writePatterns(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
QMap<QString, ScPattern>::Iterator itPat;
for (itPat = m_Doc->docPatterns.begin(); itPat != m_Doc->docPatterns.end(); ++itPat)
{
540,7 → 757,13
pat.setAttribute("scaleY", pa.scaleY);
WriteObjects(m_Doc, &docu, &pat, 0, 0, 3, &pa.items);
dc.appendChild(pat);
}
}
}
 
void Scribus134Format::writeContent(QDomDocument & docu)
{
QDomElement dc=docu.documentElement().firstChild().toElement();
 
if (m_mwProgressBar != 0)
{
m_mwProgressBar->setTotalSteps(m_Doc->DocPages.count()+m_Doc->MasterPages.count()+m_Doc->DocItems.count()+m_Doc->MasterItems.count()+m_Doc->FrameItems.count());
551,47 → 774,8
WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count(), 2);
WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count()+m_Doc->FrameItems.count(), 0);
WriteObjects(m_Doc, &docu, &dc, m_mwProgressBar, m_Doc->MasterPages.count()+m_Doc->DocPages.count()+m_Doc->MasterItems.count()+m_Doc->FrameItems.count(), 1);
elem.appendChild(dc);
/**
* changed to enable saving
* of *.gz documents
* 2.7.2002 C.Toepp
* <c.toepp@gmx.de>
*/
#ifdef HAVE_LIBZ
QCString cs = docu.toCString(); // UTF-8 QCString
if(fileName.right(2) == "gz")
{
// zipped saving
// XXX: latin1() should probably be local8Bit()
gzFile gzDoc = gzopen(fileName.latin1(),"wb");
if(gzDoc == NULL)
return false;
gzputs(gzDoc, cs.data());
gzclose(gzDoc);
}
else
{
QFile f(fileName);
if(!f.open(IO_WriteOnly))
return false;
QTextStream s(&f);
s.writeRawBytes(cs, cs.length());
f.close();
}
#else
QFile f(fileName);
if(!f.open(IO_WriteOnly))
return false;
QTextStream s(&f);
QCString cs = docu.toCString();
s.writeRawBytes(cs, cs.length());
f.close();
#endif
return true;
}
 
 
void Scribus134Format::WritePages(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, bool master)
{
uint ObCount = maxC;
645,11 → 829,201
}
}
 
void Scribus134Format::WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master, QPtrList<PageItem> *items)
void writeITEXTs(ScribusDoc *doc, QDomDocument *docu, QDomElement ob, PageItem* item)
{
int te, te2, tsh, tsh2, tst, tst2, tsb, tsb2, tshs, tshs2, tobj, tobj2;
QString text, tf, tf2, tc, tc2, tcs, tcs2, tmp, tmpy, Ndir;
double ts, ts2, tsc, tsc2, tscv, tscv2, tb, tb2, tsx, tsx2, tsy, tsy2, tout, tout2, tulp, tulp2, tulw, tulw2, tstp, tstp2, tstw, tstw2;
for(int k = 0; k < item->itemText.length(); ++k)
{
const CharStyle& style1(item->itemText.charStyle(k));
QChar ch = item->itemText.text(k);
QDomElement it=docu->createElement("ITEXT");
ts = style1.fontSize() / 10.0;
tf = style1.font().scName();
tc = style1.fillColor();
te = style1.tracking();
tsh = style1.fillShade();
tst = style1.effects() & 2047;
#ifndef NLS_PROTO
tsb = findParagraphStyle(doc, item->itemText.paragraphStyle(k));
#else
tsb = 0;
#endif
tcs = style1.strokeColor();
tshs = style1.strokeShade();
tsc = style1.scaleH() / 10.0;
tscv = style1.scaleV() / 10.0;
tb = style1.baselineOffset() / 10.0;
tsx = style1.shadowXOffset() / 10.0;
tsy = style1.shadowYOffset() / 10.0;
tout = style1.outlineWidth() / 10.0;
tulp = style1.underlineOffset() / 10.0;
tulw = style1.underlineWidth() / 10.0;
tstp = style1.strikethruOffset() / 10.0;
tstw = style1.strikethruWidth() / 10.0;
#ifndef NLS_PROTO
if ((ch == SpecialChars::OBJECT) && (item->itemText.item(k)->cembedded != 0))
tobj = item->itemText.item(k)->cembedded->ItemNr;
else
#endif
tobj = -1;
if (ch == QChar(13))
text = QChar(5);
else if (ch == QChar(9))
text = QChar(4);
else
text = ch;
++k;
if (k == item->itemText.length())
{
it.setAttribute("CH",text);
it.setAttribute("CSIZE",ts);
it.setAttribute("CFONT",tf);
it.setAttribute("CCOLOR",tc);
it.setAttribute("CKERN",te);
it.setAttribute("CSHADE",tsh);
it.setAttribute("CSTYLE",tst);
it.setAttribute("CAB",tsb);
it.setAttribute("CSTROKE",tcs);
it.setAttribute("CSHADE2",tshs);
it.setAttribute("CSCALE",tsc);
it.setAttribute("CSCALEV",tscv);
it.setAttribute("CBASE",tb);
it.setAttribute("CSHX",tsx);
it.setAttribute("CSHY",tsy);
it.setAttribute("COUT",tout);
it.setAttribute("CULP",tulp);
it.setAttribute("CULW",tulw);
it.setAttribute("CSTP",tstp);
it.setAttribute("CSTW",tstw);
if (tobj != -1)
it.setAttribute("COBJ", tobj);
ob.appendChild(it);
break;
}
const CharStyle& style2(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style2.fontSize() / 10.0;
tf2 = style2.font().scName();
tc2 = style2.fillColor();
te2 = style2.tracking();
tsh2 = style2.fillShade();
tst2 = style2.effects() & 2047;
#ifndef NLS_PROTO
tsb2 = findParagraphStyle(doc, item->itemText.paragraphStyle(k));
#else
tsb2 = 0;
#endif
tcs2 = style2.strokeColor();
tshs2 = style2.strokeShade();
tsc2 = style2.scaleH() / 10.0;
tscv2 = style2.scaleV() / 10.0;
tb2 = style2.baselineOffset() / 10.0;
tsx2 = style2.shadowXOffset() / 10.0;
tsy2 = style2.shadowYOffset() / 10.0;
tout2 = style2.outlineWidth() / 10.0;
tulp2 = style2.underlineOffset() / 10.0;
tulw2 = style2.underlineWidth() / 10.0;
tstp2 = style2.strikethruOffset() / 10.0;
tstw2 = style2.strikethruWidth() / 10.0;
#ifndef NLS_PROTO
if ((ch == QChar(25)) && (item->itemText.item(k)->cembedded != 0))
tobj2 = item->itemText.item(k)->cembedded->ItemNr;
else
#endif
tobj2 = -1;
while ((ts2 == ts)
&& (tsb2 == tsb)
&& (tf2 == tf)
&& (tc2 == tc)
&& (te2 == te)
&& (tsh2 == tsh)
&& (tshs2 == tshs)
&& (tsc2 == tsc)
&& (tscv2 == tscv)
&& (tcs2 == tcs)
&& (tb2 == tb)
&& (tsx2 == tsx)
&& (tsy2 == tsy)
&& (tout2 == tout)
&& (tulp2 == tulp)
&& (tulw2 == tulw)
&& (tstp2 == tstp)
&& (tstw2 == tstw)
&& (tobj2 == tobj)
&& (tst2 == tst))
{
if (ch == QChar(13))
text += QChar(5);
else if (ch == QChar(9))
text += QChar(4);
else
text += ch;
++k;
if (k == item->itemText.length())
break;
const CharStyle& style3(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style3.fontSize() / 10.0;
tf2 = style3.font().scName();
tc2 = style3.fillColor();
te2 = style3.tracking();
tsh2 = style3.fillShade();
tst2 = style3.effects() & 2047;
#ifndef NLS_PROTO
tsb2 = findParagraphStyle(doc, item->itemText.paragraphStyle(k));
#else
tsb2 = 0;
#endif
tcs2 = style3.strokeColor();
tshs2 = style3.strokeShade();
tsc2 = style3.scaleH() / 10.0;
tscv2 = style3.scaleV() / 10.0;
tb2 = style3.baselineOffset() / 10.0;
tsx2 = style3.shadowXOffset() / 10.0;
tsy2 = style3.shadowYOffset() / 10.0;
tout2 = style3.outlineWidth() / 10.0;
tulp2 = style3.underlineOffset() / 10.0;
tulw2 = style3.underlineWidth() / 10.0;
tstp2 = style3.strikethruOffset() / 10.0;
tstw2 = style3.strikethruWidth() / 10.0;
#ifndef NLS_PROTO
if ((ch == QChar(25)) && (item->itemText.item(k)->cembedded != 0))
tobj2 = item->itemText.item(k)->cembedded->ItemNr;
else
#endif
tobj2 = -1;
}
it.setAttribute("CH",text);
it.setAttribute("CSIZE",ts);
it.setAttribute("CFONT",tf);
it.setAttribute("CCOLOR",tc);
it.setAttribute("CKERN",te);
it.setAttribute("CSHADE",tsh);
it.setAttribute("CSTYLE",tst);
it.setAttribute("CAB",tsb);
it.setAttribute("CSTROKE",tcs);
it.setAttribute("CSHADE2",tshs);
it.setAttribute("CSCALE",tsc);
it.setAttribute("CSCALEV",tscv);
it.setAttribute("CBASE",tb);
it.setAttribute("CSHX",tsx);
it.setAttribute("CSHY",tsy);
it.setAttribute("COUT",tout);
it.setAttribute("CULP",tulp);
it.setAttribute("CULW",tulw);
it.setAttribute("CSTP",tstp);
it.setAttribute("CSTW",tstw);
if (tobj != -1)
it.setAttribute("COBJ", tobj);
k--;
ob.appendChild(it);
}
}
 
void Scribus134Format::WriteObjects(ScribusDoc *doc, QDomDocument *docu, QDomElement *dc, QProgressBar *dia2, uint maxC, int master, QPtrList<PageItem> *items)
{
uint ObCount = maxC;
PageItem *item;
QDomElement ob;
775,192 → 1149,8
}
ob.setAttribute("ALIGN",findParagraphStyle(doc, item->itemText.defaultStyle()));
ob.setAttribute("BOOKMARK", item->isBookmark ? 1 : 0);
for(int k = 0; k < item->itemText.length(); ++k)
{
const CharStyle& style1(item->itemText.charStyle(k));
QChar ch = item->itemText.text(k);
QDomElement it=docu->createElement("ITEXT");
ts = style1.fontSize() / 10.0;
tf = style1.font().scName();
tc = style1.fillColor();
te = style1.tracking();
tsh = style1.fillShade();
tst = style1.effects() & 2047;
#ifndef NLS_PROTO
tsb = findParagraphStyle(doc, item->itemText.paragraphStyle(k));
#else
tsb = 0;
#endif
tcs = style1.strokeColor();
tshs = style1.strokeShade();
tsc = style1.scaleH() / 10.0;
tscv = style1.scaleV() / 10.0;
tb = style1.baselineOffset() / 10.0;
tsx = style1.shadowXOffset() / 10.0;
tsy = style1.shadowYOffset() / 10.0;
tout = style1.outlineWidth() / 10.0;
tulp = style1.underlineOffset() / 10.0;
tulw = style1.underlineWidth() / 10.0;
tstp = style1.strikethruOffset() / 10.0;
tstw = style1.strikethruWidth() / 10.0;
#ifndef NLS_PROTO
if ((ch == QChar(25)) && (item->itemText.item(k)->cembedded != 0))
tobj = item->itemText.item(k)->cembedded->ItemNr;
else
#endif
tobj = -1;
if (ch == QChar(13))
text = QChar(5);
else if (ch == QChar(9))
text = QChar(4);
else
text = ch;
++k;
if (k == item->itemText.length())
{
it.setAttribute("CH",text);
it.setAttribute("CSIZE",ts);
it.setAttribute("CFONT",tf);
it.setAttribute("CCOLOR",tc);
it.setAttribute("CKERN",te);
it.setAttribute("CSHADE",tsh);
it.setAttribute("CSTYLE",tst);
it.setAttribute("CAB",tsb);
it.setAttribute("CSTROKE",tcs);
it.setAttribute("CSHADE2",tshs);
it.setAttribute("CSCALE",tsc);
it.setAttribute("CSCALEV",tscv);
it.setAttribute("CBASE",tb);
it.setAttribute("CSHX",tsx);
it.setAttribute("CSHY",tsy);
it.setAttribute("COUT",tout);
it.setAttribute("CULP",tulp);
it.setAttribute("CULW",tulw);
it.setAttribute("CSTP",tstp);
it.setAttribute("CSTW",tstw);
if (tobj != -1)
it.setAttribute("COBJ", tobj);
ob.appendChild(it);
break;
}
const CharStyle& style2(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style2.fontSize() / 10.0;
tf2 = style2.font().scName();
tc2 = style2.fillColor();
te2 = style2.tracking();
tsh2 = style2.fillShade();
tst2 = style2.effects() & 2047;
#ifndef NLS_PROTO
tsb2 = findParagraphStyle(doc, item->itemText.paragraphStyle(k));
#else
tsb2 = 0;
#endif
tcs2 = style2.strokeColor();
tshs2 = style2.strokeShade();
tsc2 = style2.scaleH() / 10.0;
tscv2 = style2.scaleV() / 10.0;
tb2 = style2.baselineOffset() / 10.0;
tsx2 = style2.shadowXOffset() / 10.0;
tsy2 = style2.shadowYOffset() / 10.0;
tout2 = style2.outlineWidth() / 10.0;
tulp2 = style2.underlineOffset() / 10.0;
tulw2 = style2.underlineWidth() / 10.0;
tstp2 = style2.strikethruOffset() / 10.0;
tstw2 = style2.strikethruWidth() / 10.0;
#ifndef NLS_PROTO
if ((ch == QChar(25)) && (item->itemText.item(k)->cembedded != 0))
tobj2 = item->itemText.item(k)->cembedded->ItemNr;
else
#endif
tobj2 = -1;
while ((ts2 == ts)
&& (tsb2 == tsb)
&& (tf2 == tf)
&& (tc2 == tc)
&& (te2 == te)
&& (tsh2 == tsh)
&& (tshs2 == tshs)
&& (tsc2 == tsc)
&& (tscv2 == tscv)
&& (tcs2 == tcs)
&& (tb2 == tb)
&& (tsx2 == tsx)
&& (tsy2 == tsy)
&& (tout2 == tout)
&& (tulp2 == tulp)
&& (tulw2 == tulw)
&& (tstp2 == tstp)
&& (tstw2 == tstw)
&& (tobj2 == tobj)
&& (tst2 == tst))
{
if (ch == QChar(13))
text += QChar(5);
else if (ch == QChar(9))
text += QChar(4);
else
text += ch;
++k;
if (k == item->itemText.length())
break;
const CharStyle& style3(item->itemText.charStyle(k));
ch = item->itemText.text(k);
ts2 = style3.fontSize() / 10.0;
tf2 = style3.font().scName();
tc2 = style3.fillColor();
te2 = style3.tracking();
tsh2 = style3.fillShade();
tst2 = style3.effects() & 2047;
#ifndef NLS_PROTO
tsb2 = findParagraphStyle(doc, item->itemText.paragraphStyle(k));
#else
tsb2 = 0;
#endif
tcs2 = style3.strokeColor();
tshs2 = style3.strokeShade();
tsc2 = style3.scaleH() / 10.0;
tscv2 = style3.scaleV() / 10.0;
tb2 = style3.baselineOffset() / 10.0;
tsx2 = style3.shadowXOffset() / 10.0;
tsy2 = style3.shadowYOffset() / 10.0;
tout2 = style3.outlineWidth() / 10.0;
tulp2 = style3.underlineOffset() / 10.0;
tulw2 = style3.underlineWidth() / 10.0;
tstp2 = style3.strikethruOffset() / 10.0;
tstw2 = style3.strikethruWidth() / 10.0;
#ifndef NLS_PROTO
if ((ch == QChar(25)) && (item->itemText.item(k)->cembedded != 0))
tobj2 = item->itemText.item(k)->cembedded->ItemNr;
else
#endif
tobj2 = -1;
}
it.setAttribute("CH",text);
it.setAttribute("CSIZE",ts);
it.setAttribute("CFONT",tf);
it.setAttribute("CCOLOR",tc);
it.setAttribute("CKERN",te);
it.setAttribute("CSHADE",tsh);
it.setAttribute("CSTYLE",tst);
it.setAttribute("CAB",tsb);
it.setAttribute("CSTROKE",tcs);
it.setAttribute("CSHADE2",tshs);
it.setAttribute("CSCALE",tsc);
it.setAttribute("CSCALEV",tscv);
it.setAttribute("CBASE",tb);
it.setAttribute("CSHX",tsx);
it.setAttribute("CSHY",tsy);
it.setAttribute("COUT",tout);
it.setAttribute("CULP",tulp);
it.setAttribute("CULW",tulw);
it.setAttribute("CSTP",tstp);
it.setAttribute("CSTW",tstw);
if (tobj != -1)
it.setAttribute("COBJ", tobj);
k--;
ob.appendChild(it);
}
 
writeITEXTs(doc, docu, ob, item);
if (item->BackBox != 0)
ob.setAttribute("BACKITEM", item->BackBox->ItemNr);
else
/branches/Version13x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
219,7 → 219,7
{
getNewReplacement=newReplacement;
getReplacedFonts=ReplacedFonts;
getDummyScFaces=dummyScFaces;
// getDummyScFaces=dummyScFaces;
}
 
bool Scribus134Format::loadFile(const QString & fileName, const FileFormat & /* fmt */, int /* flags */, int /* index */)
565,7 → 565,7
if(pg.tagName()=="STYLE")
{
readParagraphStyle(vg, pg, *m_AvailableFonts, m_Doc);
m_Doc->docParagraphStyles.append(new ParagraphStyle(vg));
m_Doc->docParagraphStyles.create(vg);
}
if(pg.tagName()=="JAVA")
m_Doc->JavaScripts[pg.attribute("NAME")] = pg.attribute("SCRIPT");
1043,12 → 1043,13
Neu->gWidth = pg.attribute("gWidth",defaultVal).toDouble();
defaultVal.setNum(Neu->height());
Neu->gHeight = pg.attribute("gHeight",defaultVal).toDouble();
/*FIXME if (Neu->lineSpacingMode() == 3)
/* if (Neu->lineSpacingMode() == 3)
{
m_Doc->docParagraphStyles[0].setUseBaselineGrid(true);
Neu->setLineSpacing(m_Doc->typographicSettings.valueBaseGrid-1);
}
*/ if (Neu->isAutoText)
*/
if (Neu->isAutoText)
m_Doc->LastAuto = Neu;
Neu->NextIt = pg.attribute("NEXTITEM").toInt();
if (Neu->isTableItem)
1335,13 → 1336,82
delete plug;
}
 
void breakPoint() {}
 
namespace {
const int NOVLAUE = -16000;
void fixLegacyCharStyle(CharStyle& cstyle)
{
if (! cstyle.font().usable())
cstyle.resetFont();
if (cstyle.fontSize() <= -16000 / 10)
cstyle.resetFontSize();
if (cstyle.fontSize() == 65535)
cstyle.resetEffects();
if (cstyle.fillColor().isEmpty())
cstyle.resetFillColor();
if (cstyle.fillShade() <= -16000)
cstyle.resetFillShade();
if (cstyle.strokeColor().isEmpty())
cstyle.resetStrokeColor();
if (cstyle.strokeShade() <= -16000)
cstyle.resetStrokeShade();
if (cstyle.shadowXOffset() <= -16000 / 10)
cstyle.resetShadowXOffset();
if (cstyle.shadowYOffset() <= -16000 / 10)
cstyle.resetShadowYOffset();
if (cstyle.outlineWidth() <= -16000 / 10)
cstyle.resetOutlineWidth();
if (cstyle.underlineOffset() <= -16000 / 10)
cstyle.resetUnderlineOffset();
if (cstyle.underlineWidth() <= -16000 / 10)
cstyle.resetUnderlineWidth();
if (cstyle.strikethruOffset() <= -16000 / 10)
cstyle.resetStrikethruOffset();
if (cstyle.strikethruWidth() <= -16000 / 10)
cstyle.resetStrikethruWidth();
if (cstyle.scaleH() <= -16000 / 10)
cstyle.resetScaleH();
if (cstyle.scaleV() <= -16000 / 10)
cstyle.resetScaleV();
if (cstyle.baselineOffset() <= -16000 / 10)
cstyle.resetBaselineOffset();
if (cstyle.tracking() <= -16000 / 10)
cstyle.resetTracking();
}
void fixLegacyParStyle(ParagraphStyle& pstyle)
{
pstyle.resetLineSpacing();
if (pstyle.leftMargin() <= -16000)
pstyle.resetLeftMargin();
if (pstyle.rightMargin() <= -16000)
pstyle.resetRightMargin();
if (pstyle.firstIndent() <= -16000)
pstyle.resetFirstIndent();
if (pstyle.alignment() < 0)
pstyle.resetAlignment();
if (pstyle.gapBefore() <= -16000)
pstyle.resetGapBefore();
if (pstyle.gapAfter() <= -16000)
pstyle.resetGapAfter();
if (pstyle.dropCapLines() < 0)
pstyle.resetDropCapLines();
if (pstyle.dropCapOffset() <= -16000)
pstyle.resetDropCapOffset();
fixLegacyCharStyle(pstyle.charStyle());
}
}// namespace
 
 
 
void Scribus134Format::GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo, bool VorLFound)
{
ScFace dummy = ScFace::none();
bool unknown = false;
QString tmp2, tmpf;
CharStyle newStyle;
tmp2 = it->attribute("CH");
tmp2.replace(QRegExp("\r"), QChar(13));
tmp2.replace(QRegExp("\n"), QChar(13));
1350,7 → 1420,7
PrefsManager* prefsManager=PrefsManager::instance();
if ((!prefsManager->appPrefs.AvailFonts.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[tmpf].usable()))
{
bool isThere = false;
/* bool isThere = false;
for (uint dl = 0; dl < dummyScFaces.count(); ++dl)
{
if ((*dummyScFaces.at(dl)).scName() == tmpf)
1365,10 → 1435,13
// dummy = ScFace(tmpf, "", tmpf, "", "", 1, false);
dummyScFaces.append(dummy);
}
*/
unknown = true;
if ((!prefsManager->appPrefs.GFontSub.contains(tmpf)) || (!prefsManager->appPrefs.AvailFonts[prefsManager->appPrefs.GFontSub[tmpf]].usable()))
{
newReplacement = true;
dummy = prefsManager->appPrefs.AvailFonts[ReplacedFonts[tmpf]].mkReplacementFor(tmpf, doc->DocName);
prefsManager->appPrefs.AvailFonts.insert(tmpf, dummy);
ReplacedFonts.insert(tmpf, prefsManager->appPrefs.toolSettings.defFont);
}
else
1381,73 → 1454,97
doc->AddFont(tmpf, qRound(doc->toolSettings.defSize / 10.0));
}
}
int size = qRound(it->attribute("CSIZE").toDouble() * 10);
QString fcolor = it->attribute("CCOLOR");
int extra;
if (! tmpf.isEmpty() )
newStyle.setFont((*doc->AllFonts)[tmpf]);
if (it->hasAttribute("CSIZE"))
newStyle.setFontSize(qRound(it->attribute("CSIZE").toDouble() * 10));
if (it->hasAttribute("CCOLOR"))
newStyle.setFillColor(it->attribute("CCOLOR"));
if (it->hasAttribute("CEXTRA"))
extra = qRound(it->attribute("CEXTRA").toDouble() / it->attribute("CSIZE").toDouble() * 1000.0);
newStyle.setTracking(qRound(it->attribute("CEXTRA").toDouble() / it->attribute("CSIZE").toDouble() * 1000.0));
else if (it->hasAttribute("CKERN"))
newStyle.setTracking(it->attribute("CKERN").toInt());
if (it->hasAttribute("CSHADE"))
newStyle.setFillShade(it->attribute("CSHADE").toInt());
if (it->hasAttribute("CSTYLE"))
newStyle.setEffects(static_cast<StyleFlag>(it->attribute("CSTYLE").toInt()));
 
QString pstylename = it->attribute("PSTYLE", "");
int calign = it->attribute("CALIGN", "-1").toInt();
int ab = it->attribute("CAB", "-1").toInt();
if (ab >= 5) {
pstylename = doc->docParagraphStyles[ab-5].name();
calign = -1;
}
else if (ab >= 0) {
pstylename = "";
calign = ab;
}
if (it->hasAttribute("CSTROKE"))
newStyle.setStrokeColor(it->attribute("CSTROKE", CommonStrings::None));
if (it->hasAttribute("CSHADE2"))
newStyle.setStrokeShade(it->attribute("CSHADE2", "100").toInt());
if (it->hasAttribute("CSCALE"))
newStyle.setScaleH(QMIN(QMAX(qRound(it->attribute("CSCALE", "100").toDouble() * 10), 100), 4000));
if (it->hasAttribute("CSCALEV"))
newStyle.setScaleV(QMIN(QMAX(qRound(it->attribute("CSCALEV", "100").toDouble() * 10), 100), 4000));
if (it->hasAttribute("CBASE"))
newStyle.setBaselineOffset(qRound(it->attribute("CBASE", "0").toDouble() * 10));
if (it->hasAttribute("CSHX"))
newStyle.setShadowXOffset(qRound(it->attribute("CSHX", "5").toDouble() * 10));
if (it->hasAttribute("CSHY"))
newStyle.setShadowYOffset(qRound(it->attribute("CSHY", "-5").toDouble() * 10));
if (it->hasAttribute("COUT"))
newStyle.setOutlineWidth(qRound(it->attribute("COUT", "1").toDouble() * 10));
if (it->hasAttribute("CULP"))
newStyle.setUnderlineOffset(qRound(it->attribute("CULP", "-0.1").toDouble() * 10));
if (it->hasAttribute("CULW"))
newStyle.setUnderlineWidth(qRound(it->attribute("CULW", "-0.1").toDouble() * 10));
if (it->hasAttribute("CSTP"))
newStyle.setStrikethruOffset(qRound(it->attribute("CSTP", "-0.1").toDouble() * 10));
if (it->hasAttribute("CSTW"))
newStyle.setStrikethruWidth(qRound(it->attribute("CSTW", "-0.1").toDouble() * 10));
fixLegacyCharStyle(newStyle);
if (impo && ab >= 0 && VorLFound)
last->ParaStyle = DoVorl[ab].toInt();
else
extra = it->attribute("CKERN").toInt();
int shade = it->attribute("CSHADE").toInt();
int style = it->attribute("CSTYLE").toInt();
int ab = it->attribute("CAB", "0").toInt();
QString stroke = it->attribute("CSTROKE", CommonStrings::None);
int shade2 = it->attribute("CSHADE2", "100").toInt();
int scale = qRound(it->attribute("CSCALE", "100").toDouble() * 10);
int scalev = qRound(it->attribute("CSCALEV", "100").toDouble() * 10);
int base = qRound(it->attribute("CBASE", "0").toDouble() * 10);
int shX = qRound(it->attribute("CSHX", "5").toDouble() * 10);
int shY = qRound(it->attribute("CSHY", "-5").toDouble() * 10);
int outL = qRound(it->attribute("COUT", "1").toDouble() * 10);
int ulp = qRound(it->attribute("CULP", "-0.1").toDouble() * 10);
int ulw = qRound(it->attribute("CULW", "-0.1").toDouble() * 10);
int stp = qRound(it->attribute("CSTP", "-0.1").toDouble() * 10);
int stw = qRound(it->attribute("CSTW", "-0.1").toDouble() * 10);
{
last->ParaStyle = doc->docParagraphStyles.find(pstylename);
}
int iobj = it->attribute("COBJ", "-1").toInt();
for (uint cxx=0; cxx<tmp2.length(); ++cxx)
{
CharStyle newStyle;
QChar ch = tmp2.at(cxx);
if (ch == QChar(5))
ch = QChar(13);
if (ch == QChar(4))
ch = QChar(9);
if (unknown)
newStyle.setFont(dummy);
else
newStyle.setFont((*doc->AllFonts)[tmpf]);
newStyle.setFontSize(size);
newStyle.setFillColor(fcolor);
newStyle.setTracking(extra);
newStyle.setFillShade(shade);
newStyle.setEffects(static_cast<StyleFlag>(style));
if (ab >= 5) breakPoint();
if (impo)
{
if (VorLFound)
last->ParaStyle = DoVorl[ab].toUInt();
else
{
if (ab < 5)
last->ParaStyle = ab;
else
last->ParaStyle = 0;
}
QChar ch = tmp2.at(cxx);
{ // Legacy mode
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
if (ch == QChar(4))
ch = SpecialChars::TAB;
}
else
last->ParaStyle = ab;
newStyle.setStrokeColor(stroke);
newStyle.setStrokeShade(shade2);
newStyle.setScaleH(QMIN(QMAX(scale, 100), 4000));
newStyle.setScaleV(QMIN(QMAX(scalev, 100), 4000));
newStyle.setBaselineOffset(base);
newStyle.setShadowXOffset(shX);
newStyle.setShadowYOffset(shY);
newStyle.setOutlineWidth(outL);
newStyle.setUnderlineOffset(ulp);
newStyle.setUnderlineWidth(ulw);
newStyle.setStrikethruOffset(stp);
newStyle.setStrikethruWidth(stw);
int pos = obj->itemText.length();
if (ch == SpecialChars::OBJECT) {
if (iobj != -1) {
1466,17 → 1563,29
last->StyleStart = pos;
}
if (ch == SpecialChars::PARSEP) {
const ParagraphStyle& pstyle( doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
qDebug(QString("par style134 at %1: %2/%3 (%4)").arg(pos).arg(pstyle.name()).arg(pstyle.parent()? pstyle.parent()->name():"").arg(last->ParaStyle));
ParagraphStyle pstyle;
if (last->ParaStyle >= 0) {
pstyle.setParent( doc->docParagraphStyles[last->ParaStyle].name());
}
if (calign >= 0)
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(calign));
qDebug(QString("par style at %1: %2/%3 (%4) calign %5").arg(pos).arg(pstyle.name()).arg(pstyle.parent()).arg(last->ParaStyle).arg(calign));
obj->itemText.applyStyle(pos, pstyle);
obj->itemText.applyStyle(pos, doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
}
}
obj->itemText.applyCharStyle(last->StyleStart, obj->itemText.length()-last->StyleStart, last->Style);
obj->itemText.applyStyle(obj->itemText.length()-1, doc->docParagraphStyles[QMAX(0,last->ParaStyle)]);
ParagraphStyle pstyle;
if (last->ParaStyle >= 0) {
pstyle.setParent( doc->docParagraphStyles[last->ParaStyle].name());
}
if (calign >= 0)
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(calign));
obj->itemText.applyStyle(obj->itemText.length()-1, pstyle);
return;
}
 
 
 
void Scribus134Format::readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc)
{
vg.setName(pg.attribute("NAME"));
1488,7 → 1597,7
else
vg.setRightMargin(0);
vg.setFirstIndent(pg.attribute("FIRST", "0").toDouble());
vg.setAlignment(pg.attribute("ALIGN").toInt());
vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg.attribute("ALIGN").toInt()));
vg.setGapBefore(pg.attribute("VOR", "0").toDouble());
vg.setGapAfter(pg.attribute("NACH", "0").toDouble());
PrefsManager * prefsManager = PrefsManager::instance();
1514,69 → 1623,76
}
vg.charStyle().setFont(avail[tmpf]);
}
vg.charStyle().setFontSize(qRound(pg.attribute("FONTSIZE", "12").toDouble() * 10.0));
vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt()));
vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt());
vg.setDropCapOffset(pg.attribute("DROPDIST", "0").toDouble());
vg.charStyle().setEffects(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()));
vg.charStyle().setFillColor(pg.attribute("FCOLOR", doc->toolSettings.dBrush));
vg.charStyle().setFillShade(pg.attribute("FSHADE", "100").toInt());
vg.charStyle().setStrokeColor(pg.attribute("SCOLOR", doc->toolSettings.dPen));
vg.charStyle().setStrokeShade(pg.attribute("SSHADE", "100").toInt());
vg.setUseBaselineGrid(static_cast<bool>(pg.attribute("BASE", "0").toInt()));
vg.charStyle().setShadowXOffset(qRound(pg.attribute("TXTSHX", "5").toDouble() * 10));
vg.charStyle().setShadowYOffset(qRound(pg.attribute("TXTSHY", "-5").toDouble() * 10));
vg.charStyle().setOutlineWidth(qRound(pg.attribute("TXTOUT", "1").toDouble() * 10));
vg.charStyle().setUnderlineOffset(qRound(pg.attribute("TXTULP", "-0.1").toDouble() * 10));
vg.charStyle().setUnderlineWidth(qRound(pg.attribute("TXTULW", "-0.1").toDouble() * 10));
vg.charStyle().setStrikethruOffset(qRound(pg.attribute("TXTSTP", "-0.1").toDouble() * 10));
vg.charStyle().setStrikethruWidth(qRound(pg.attribute("TXTSTW", "-0.1").toDouble() * 10));
vg.charStyle().setScaleH(qRound(pg.attribute("SCALEH", "100").toDouble() * 10));
vg.charStyle().setScaleV(qRound(pg.attribute("SCALEV", "100").toDouble() * 10));
vg.charStyle().setBaselineOffset(qRound(pg.attribute("BASEO", "0").toDouble() * 10));
vg.charStyle().setTracking(qRound(pg.attribute("KERN", "0").toDouble() * 10));
vg.tabValues().clear();
if ((pg.hasAttribute("NUMTAB")) && (pg.attribute("NUMTAB", "0").toInt() != 0))
vg.charStyle().setFontSize(qRound(pg.attribute("FONTSIZE", "12").toDouble() * 10.0));
vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt()));
vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt());
vg.setDropCapOffset(pg.attribute("DROPDIST", "0").toDouble());
vg.charStyle().setEffects(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()));
vg.charStyle().setFillColor(pg.attribute("FCOLOR", doc->toolSettings.dBrush));
vg.charStyle().setFillShade(pg.attribute("FSHADE", "100").toInt());
vg.charStyle().setStrokeColor(pg.attribute("SCOLOR", doc->toolSettings.dPen));
vg.charStyle().setStrokeShade(pg.attribute("SSHADE", "100").toInt());
vg.setUseBaselineGrid(static_cast<bool>(pg.attribute("BASE", "0").toInt()));
vg.charStyle().setShadowXOffset(qRound(pg.attribute("TXTSHX", "5").toDouble() * 10));
vg.charStyle().setShadowYOffset(qRound(pg.attribute("TXTSHY", "-5").toDouble() * 10));
vg.charStyle().setOutlineWidth(qRound(pg.attribute("TXTOUT", "1").toDouble() * 10));
vg.charStyle().setUnderlineOffset(qRound(pg.attribute("TXTULP", "-0.1").toDouble() * 10));
vg.charStyle().setUnderlineWidth(qRound(pg.attribute("TXTULW", "-0.1").toDouble() * 10));
vg.charStyle().setStrikethruOffset(qRound(pg.attribute("TXTSTP", "-0.1").toDouble() * 10));
vg.charStyle().setStrikethruWidth(qRound(pg.attribute("TXTSTW", "-0.1").toDouble() * 10));
vg.charStyle().setScaleH(qRound(pg.attribute("SCALEH", "100").toDouble() * 10));
vg.charStyle().setScaleV(qRound(pg.attribute("SCALEV", "100").toDouble() * 10));
vg.charStyle().setBaselineOffset(qRound(pg.attribute("BASEO", "0").toDouble() * 10));
vg.charStyle().setTracking(qRound(pg.attribute("KERN", "0").toDouble() * 10));
// vg.tabValues().clear();
if ((pg.hasAttribute("NUMTAB")) && (pg.attribute("NUMTAB", "0").toInt() != 0))
{
QValueList<ParagraphStyle::TabRecord> tbs;
ParagraphStyle::TabRecord tb;
QString tmp = pg.attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
double xf, xf2;
for (int cxv = 0; cxv < pg.attribute("NUMTAB", "0").toInt(); cxv += 2)
{
ParagraphStyle::TabRecord tb;
QString tmp = pg.attribute("TABS");
QTextStream tgv(&tmp, IO_ReadOnly);
double xf, xf2;
for (int cxv = 0; cxv < pg.attribute("NUMTAB", "0").toInt(); cxv += 2)
{
tgv >> xf;
tgv >> xf2;
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
vg.tabValues().append(tb);
}
tmp = "";
tgv >> xf;
tgv >> xf2;
tb.tabPosition = xf2;
tb.tabType = static_cast<int>(xf);
tb.tabFillChar = QChar();
tbs.append(tb);
}
else
vg.setTabValues(tbs);
tmp = "";
}
else
{
QValueList<ParagraphStyle::TabRecord> tbs;
QDomNode IT = pg.firstChild();
while(!IT.isNull())
{
QDomNode IT = pg.firstChild();
while(!IT.isNull())
QDomElement it = IT.toElement();
if (it.tagName()=="Tabs")
{
QDomElement it = IT.toElement();
if (it.tagName()=="Tabs")
{
ParagraphStyle::TabRecord tb;
tb.tabPosition = it.attribute("Pos").toDouble();
tb.tabType = it.attribute("Type").toInt();
QString tbCh = "";
tbCh = it.attribute("Fill","");
if (tbCh.isEmpty())
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
vg.tabValues().append(tb);
}
IT=IT.nextSibling();
ParagraphStyle::TabRecord tb;
tb.tabPosition = it.attribute("Pos").toDouble();
tb.tabType = it.attribute("Type").toInt();
QString tbCh = "";
tbCh = it.attribute("Fill","");
if (tbCh.isEmpty())
tb.tabFillChar = QChar();
else
tb.tabFillChar = tbCh[0];
tbs.append(tb);
}
vg.setTabValues(tbs);
IT=IT.nextSibling();
}
}
fixLegacyParStyle(vg);
}
 
 
PageItem* Scribus134Format::PasteItem(QDomElement *obj, ScribusDoc *doc)
{
struct ImageLoadRequest loadingInfo;
1763,7 → 1879,7
ParagraphStyle pstyle;
pstyle.setLineSpacing(obj->attribute("LINESP").toDouble());
pstyle.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(obj->attribute("LINESPMode", "0").toInt()));
pstyle.setAlignment(obj->attribute("ALIGN", "0").toInt());
pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(obj->attribute("ALIGN", "0").toInt()));
pstyle.charStyle().setFontSize(qRound(obj->attribute("ISIZE", "12").toDouble() * 10));
pstyle.charStyle().setStrokeColor(obj->attribute("TXTSTROKE", CommonStrings::None));
pstyle.charStyle().setFillColor(obj->attribute("TXTFILL", "Black"));
2418,7 → 2534,7
Neu->gWidth = pg.attribute("gWidth",defaultVal).toDouble();
defaultVal.setNum(Neu->height());
Neu->gHeight = pg.attribute("gHeight",defaultVal).toDouble();
/*FIXME if (Neu->lineSpacingMode() == 3)
/* if (Neu->lineSpacingMode() == 3)
{
m_Doc->docParagraphStyles[0].setUseBaselineGrid(true);
Neu->setLineSpacing(m_Doc->typographicSettings.valueBaseGrid-1);
/branches/Version13x/Scribus/scribus/CMakeLists.txt
17,6 → 17,7
ADD_SUBDIRECTORY(swatches)
ADD_SUBDIRECTORY(templates)
ADD_SUBDIRECTORY(text)
ADD_SUBDIRECTORY(styles)
ADD_SUBDIRECTORY(fonts)
ADD_SUBDIRECTORY(desaxe)
 
432,7 → 433,6
splash.cpp
stencilreader.cpp
story.cpp
style.cpp
styleitem.cpp
stylemanager.cpp
styleselect.cpp
480,6 → 480,7
LINK_DIRECTORIES(
desaxe
text
styles
fonts
pixbuf
)
491,6 → 492,7
SET(SCRIBUS_LIBART_LIB "scribus_libart_lib")
SET(SCRIBUS_PIXBUF_LIB "scribus_pixbuf_lib")
SET(SCRIBUS_TEXT_LIB "scribus_text_lib")
SET(SCRIBUS_STYLES_LIB "scribus_styles_lib")
SET(SCRIBUS_FONTS_LIB "scribus_fonts_lib")
SET(SCRIBUS_DESAXE_LIB "scribus_desaxe_lib")
 
497,9 → 499,6
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/text"
"${CMAKE_CURRENT_SOURCE_DIR}/fonts"
"${CMAKE_CURRENT_SOURCE_DIR}/desaxe"
)
 
SET(EXE_NAME "scribus${TAG_VERSION}")
509,6 → 508,7
${SCRIBUS_SOURCES}
${SCRIBUS_UI_CPP}
${SCRIBUS_TEXT_SOURCES}
${SCRIBUS_STYLES_SOURCES}
${SCRIBUS_FONTS_SOURCES}
${SCRIBUS_DESAXE_SOURCES}
)
516,6 → 516,7
TARGET_LINK_LIBRARIES(${EXE_NAME}
${SCRIBUS_DESAXE_LIB}
${SCRIBUS_TEXT_LIB}
${SCRIBUS_STYLES_LIB}
${SCRIBUS_FONTS_LIB}
${SCRIBUS_PIXBUF_LIB}
)
/branches/Version13x/Scribus/scribus/smtextstyles.cpp
85,7 → 85,7
reloadTmpStyles();
}
 
for (uint i = 5 /* err */; i < tmpStyles_.count(); ++i)
for (uint i = 0; i < tmpStyles_.count(); ++i)
{
if (tmpStyles_[i].hasName())
{
92,8 → 92,8
QString styleName = tmpStyles_[i].name();
QString parentName = QString::null;
 
if (tmpStyles_[i].hasParent() && tmpStyles_[i].parent()->hasName())
parentName = tmpStyles_[i].parent()->displayName();
if (tmpStyles_[i].hasParent() && tmpStyles_[i].parentStyle()->hasName())
parentName = tmpStyles_[i].parentStyle()->displayName();
 
tmpList << StyleName(styleName, parentName);
}
164,8 → 164,8
// wth is going on here
PageItem *item = doc_->m_Selection->itemAt(i);
ParagraphStyle pstyle(item->currentStyle());
int index = pstyle.parent() ?
findParagraphStyle(doc_, *dynamic_cast<const ParagraphStyle*>(pstyle.parent())) : 0;
int index = pstyle.hasParent() ?
findParagraphStyle(doc_, *dynamic_cast<const ParagraphStyle*>(pstyle.parentStyle())) : 0;
 
QString tmpName = doc_->docParagraphStyles[index].name();
 
193,7 → 193,7
return;
 
doc_->currentStyle = doc_->docParagraphStyles[index];
doc_->itemSelection_SetParagraphStyle(index);
doc_->itemSelection_SetParagraphStyle(doc_->docParagraphStyles[index]);
 
PageItem *currItem = doc_->m_Selection->itemAt(0);
 
208,7 → 208,7
 
QString s = getUniqueName( tr("New Style"));
// i suppose this is the default style to get the default attributes in
tmpStyles_.append(ParagraphStyle(doc_->docParagraphStyles[0]));
tmpStyles_.append(doc_->docParagraphStyles[0]);
tmpStyles_.last().setName(s);
return s;
}
270,11 → 270,6
bool ff;
uint nr;
ers.clear();
ers.append(0);
ers.append(1);
ers.append(2);
ers.append(3);
ers.append(4);
 
QMap<QString, QString> replacement;
for (uint i = 0; i < deleted_.count(); ++i)
287,7 → 282,7
doc_->docParagraphStyles.create(tmpStyles_[i]);
}
 
for (uint a=5; a<doc_->docParagraphStyles.count(); ++a)
for (uint a=0; a<doc_->docParagraphStyles.count(); ++a)
{
ff = false;
nn = doc_->docParagraphStyles[a].name();
587,15 → 582,15
 
void SMParagraphStyle::slotLineSpacingMode(int mode)
{
ParagraphStyle::LineSpacingMode lsm;
ParagraphStyle::LineSpacingMode lsm = static_cast<ParagraphStyle::LineSpacingMode>(mode);
 
if (pwidget_->lineSpacingMode_->useParentValue())
lsm = static_cast<ParagraphStyle::LineSpacingMode>(Style::NOVALUE);
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetLineSpacingMode();
else
lsm = static_cast<ParagraphStyle::LineSpacingMode>(mode);
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLineSpacingMode(lsm);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLineSpacingMode(lsm);
 
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
609,13 → 604,15
int c;
 
if (pwidget_->lineSpacing_->useParentValue())
value = Style::NOVALUE;
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetLineSpacing();
else {
pwidget_->lineSpacing_->getValues(&a, &b, &c, &value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLineSpacing(value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLineSpacing(value);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
629,13 → 626,15
int c;
 
if (pwidget_->spaceAbove_->useParentValue())
value = Style::NOVALUE;
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetGapBefore();
else {
pwidget_->spaceAbove_->getValues(&a, &b, &c, &value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setGapBefore(value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setGapBefore(value);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
649,13 → 648,15
int c;
 
if (pwidget_->spaceBelow_->useParentValue())
value = Style::NOVALUE;
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetGapAfter();
else {
pwidget_->spaceBelow_->getValues(&a, &b, &c, &value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setGapAfter(value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setGapAfter(value);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
665,13 → 666,14
 
void SMParagraphStyle::slotAlignment()
{
int style = pwidget_->alignement_->getStyle();
ParagraphStyle::AlignmentType style = static_cast<ParagraphStyle::AlignmentType>(pwidget_->alignement_->getStyle());
if (pwidget_->alignement_->useParentValue())
style = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetAlignment();
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setAlignment(style);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setAlignment(style);
 
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
694,7 → 696,7
void SMParagraphStyle::slotParentDropCap()
{
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->useParentDropCap();
selection_[i]->resetHasDropCap();
 
if (!selectionIsDirty_)
{
705,11 → 707,13
 
void SMParagraphStyle::slotDropCapLines(int lines)
{
int l = pwidget_->dropCapLines_->useParentValue() ? Style::NOVALUE : lines;
if (pwidget_->dropCapLines_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetDropCapLines();
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setDropCapLines(lines);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setDropCapLines(l);
 
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
723,13 → 727,15
int c;
 
if (pwidget_->dropCapOffset_->useParentValue())
value = Style::NOVALUE;
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetDropCapOffset();
else {
pwidget_->dropCapOffset_->getValues(&a, &b, &c, &value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setDropCapOffset(value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setDropCapOffset(value);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
742,13 → 748,13
if (pwidget_->tabList_->useParentTabs())
{
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->useParentTabs();
selection_[i]->resetTabValues();
}
else
{
QValueList<ParagraphStyle::TabRecord> newTabs = pwidget_->tabList_->getTabVals();
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->tabValues() = newTabs;
selection_[i]->setTabValues(newTabs);
}
 
if (!selectionIsDirty_)
764,13 → 770,15
int c;
 
if (pwidget_->tabList_->useParentLeftIndent())
value = Style::NOVALUE;
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetLeftMargin();
else {
pwidget_->tabList_->left_->getValues(&a, &b, &c, &value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLeftMargin(value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLeftMargin(value);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
784,13 → 792,15
int c;
 
if (pwidget_->tabList_->useParentRightIndent())
value = Style::NOVALUE;
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetRightMargin();
else {
pwidget_->tabList_->right_->getValues(&a, &b, &c, &value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setRightMargin(value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setRightMargin(value);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
804,13 → 814,15
int c;
 
if (pwidget_->tabList_->useParentFirstLine())
value = Style::NOVALUE;
else
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetFirstIndent();
else {
pwidget_->tabList_->first_->getValues(&a, &b, &c, &value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFirstIndent(value);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFirstIndent(value);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
824,15 → 836,16
int c;
 
if (pwidget_->cpage->fontSize_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetFontSize();
else
{
pwidget_->cpage->fontSize_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFontSize(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFontSize(qRound(value));
 
if (!selectionIsDirty_)
{
849,7 → 862,17
StyleFlag s = ScStyle_None;
if (pwidget_->cpage->effects_->useParentValue())
{
sxo = syo = olw = ulp = ulw = slp = slw = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
{
selection_[i]->charStyle().resetEffects();
selection_[i]->charStyle().resetShadowXOffset();
selection_[i]->charStyle().resetShadowYOffset();
selection_[i]->charStyle().resetOutlineWidth();
selection_[i]->charStyle().resetUnderlineOffset();
selection_[i]->charStyle().resetUnderlineWidth();
selection_[i]->charStyle().resetStrikethruOffset();
selection_[i]->charStyle().resetStrikethruWidth();
}
}
else
{
871,20 → 894,21
slp = slp * 10;
pwidget_->cpage->effects_->StrikeVal->LWidth->getValues(&a, &b, &c, &slw);
slw = slw * 10;
}
 
for (uint i = 0; i < selection_.count(); ++i)
{
selection_[i]->charStyle().setEffects(s);
selection_[i]->charStyle().setShadowXOffset(qRound(sxo));
selection_[i]->charStyle().setShadowYOffset(qRound(syo));
selection_[i]->charStyle().setOutlineWidth(qRound(olw));
selection_[i]->charStyle().setUnderlineOffset(qRound(ulp));
selection_[i]->charStyle().setUnderlineWidth(qRound(ulw));
selection_[i]->charStyle().setStrikethruOffset(qRound(slp));
selection_[i]->charStyle().setStrikethruWidth(qRound(slw));
for (uint i = 0; i < selection_.count(); ++i)
{
selection_[i]->charStyle().setEffects(s);
selection_[i]->charStyle().setShadowXOffset(qRound(sxo));
selection_[i]->charStyle().setShadowYOffset(qRound(syo));
selection_[i]->charStyle().setOutlineWidth(qRound(olw));
selection_[i]->charStyle().setUnderlineOffset(qRound(ulp));
selection_[i]->charStyle().setUnderlineWidth(qRound(ulw));
selection_[i]->charStyle().setStrikethruOffset(qRound(slp));
selection_[i]->charStyle().setStrikethruWidth(qRound(slw));
}
}
 
 
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
935,14 → 959,17
 
void SMParagraphStyle::slotFillColor()
{
QString c = CharStyle::NOCOLOR;
QString c;
 
if (!pwidget_->cpage->fillColor_->useParentValue())
if (pwidget_->cpage->fillColor_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetFillColor();
else {
c = pwidget_->cpage->fillColor_->currentText();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFillColor(c);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFillColor(c);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
952,13 → 979,17
 
void SMParagraphStyle::slotFillShade()
{
int fs = Style::NOVALUE;
if (!pwidget_->cpage->fillShade_->useParentValue())
int fs;
if (pwidget_->cpage->fillShade_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetFillShade();
else {
fs = pwidget_->cpage->fillShade_->getValue();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFillShade(fs);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFillShade(fs);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
968,14 → 999,18
 
void SMParagraphStyle::slotStrokeColor()
{
QString c = CharStyle::NOCOLOR;
QString c;
 
if (!pwidget_->cpage->strokeColor_->useParentValue())
if (pwidget_->cpage->strokeColor_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetStrokeColor();
else {
c = pwidget_->cpage->strokeColor_->currentText();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setStrokeColor(c);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setStrokeColor(c);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
985,13 → 1020,17
 
void SMParagraphStyle::slotStrokeShade()
{
int ss = Style::NOVALUE;
if (!pwidget_->cpage->strokeShade_->useParentValue())
int ss;
if (pwidget_->cpage->strokeShade_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetStrokeShade();
else {
ss = pwidget_->cpage->strokeShade_->getValue();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setStrokeShade(ss);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setStrokeShade(ss);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1005,7 → 1044,8
QString language = doc_->Language;
 
if (pwidget_->cpage->language_->useParentValue())
language = CharStyle::NOLANG;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetLanguage();
else
{
for (it = doc_->scMW()->LangTransl.begin(); it != doc_->scMW()->LangTransl.end(); ++it)
1016,10 → 1056,10
break;
}
}
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setLanguage(language);
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setLanguage(language);
 
if (!selectionIsDirty_)
{
1034,15 → 1074,16
int c;
 
if (pwidget_->cpage->fontHScale_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetScaleH();
else
{
pwidget_->cpage->fontHScale_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setScaleH(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setScaleH(qRound(value));
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1056,15 → 1097,16
int c;
 
if (pwidget_->cpage->fontVScale_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetScaleV();
else
{
pwidget_->cpage->fontVScale_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setScaleV(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setScaleV(qRound(value));
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1078,15 → 1120,16
int c;
 
if (pwidget_->cpage->tracking_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetTracking();
else
{
pwidget_->cpage->tracking_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setTracking(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setTracking(qRound(value));
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1100,15 → 1143,16
int c;
 
if (pwidget_->cpage->baselineOffset_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetBaselineOffset();
else
{
pwidget_->cpage->baselineOffset_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setBaselineOffset(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setBaselineOffset(qRound(value));
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1119,12 → 1163,16
void SMParagraphStyle::slotFont(QString s)
{
ScFace sf;
if (!pwidget_->cpage->fontFace_->useParentFont())
if (pwidget_->cpage->fontFace_->useParentFont())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().resetFont();
else {
sf = PrefsManager::instance()->appPrefs.AvailFonts[s];
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFont(sf);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->charStyle().setFont(sf);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1134,6 → 1182,7
 
void SMParagraphStyle::slotParentChanged(const QString &parent)
{
//FIXME:av
QStringList sel;
ParagraphStyle *p = 0;
bool setParent = false;
1152,9 → 1201,9
{
if (setParent)
{
selection_[i]->eraseStyle(*selection_[i]); // reset everything to NOVALUE
selection_[i]->setParent(p);
selection_[i]->charStyle().setParent(&(p->charStyle()));
selection_[i]->erase(); // reset everything to NOVALUE
selection_[i]->setParent(parent);
selection_[i]->charStyle().setParent("");
}
else
{
1185,7 → 1234,7
 
if (selection_[0]->hasParent() && cItem == 1) // from parent
{
const Style *s = selection_[0]->parent();
const Style *s = selection_[0]->parentStyle();
const ParagraphStyle *tmp = dynamic_cast<const ParagraphStyle*>(s);
c = &(tmp->charStyle());
}
1205,8 → 1254,8
if (setParent)
{
// reset everything to NOVALUE
selection_[i]->charStyle().eraseCharStyle(selection_[i]->charStyle());
selection_[i]->charStyle().setParent(c);
selection_[i]->charStyle().erase();
selection_[i]->charStyle().setParent(parent);
}
else
selection_[i]->charStyle() = doc_->docParagraphStyles[0].charStyle();
1293,8 → 1342,8
QString styleName = tmpStyles_[i].name();
QString parentName = QString::null;
 
if (tmpStyles_[i].hasParent() && tmpStyles_[i].parent()->hasName())
parentName = tmpStyles_[i].parent()->displayName();
if (tmpStyles_[i].hasParent() && tmpStyles_[i].parentStyle()->hasName())
parentName = tmpStyles_[i].parentStyle()->displayName();
 
tmpList << StyleName(styleName, parentName);
}
1561,15 → 1610,16
int c;
 
if (page_->fontSize_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetFontSize();
else
{
page_->fontSize_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFontSize(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFontSize(qRound(value));
 
if (!selectionIsDirty_)
{
1586,7 → 1636,17
StyleFlag s = ScStyle_None;
if (page_->effects_->useParentValue())
{
sxo = syo = olw = ulp = ulw = slp = slw = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
{
selection_[i]->resetEffects();
selection_[i]->resetShadowXOffset();
selection_[i]->resetShadowYOffset();
selection_[i]->resetOutlineWidth();
selection_[i]->resetUnderlineOffset();
selection_[i]->resetUnderlineWidth();
selection_[i]->resetStrikethruOffset();
selection_[i]->resetStrikethruWidth();
}
}
else
{
1608,20 → 1668,21
slp = slp * 10;
page_->effects_->StrikeVal->LWidth->getValues(&a, &b, &c, &slw);
slw = slw * 10;
}
 
for (uint i = 0; i < selection_.count(); ++i)
{
selection_[i]->setEffects(s);
selection_[i]->setShadowXOffset(qRound(sxo));
selection_[i]->setShadowYOffset(qRound(syo));
selection_[i]->setOutlineWidth(qRound(olw));
selection_[i]->setUnderlineOffset(qRound(ulp));
selection_[i]->setUnderlineWidth(qRound(ulw));
selection_[i]->setStrikethruOffset(qRound(slp));
selection_[i]->setStrikethruWidth(qRound(slw));
for (uint i = 0; i < selection_.count(); ++i)
{
selection_[i]->setEffects(s);
selection_[i]->setShadowXOffset(qRound(sxo));
selection_[i]->setShadowYOffset(qRound(syo));
selection_[i]->setOutlineWidth(qRound(olw));
selection_[i]->setUnderlineOffset(qRound(ulp));
selection_[i]->setUnderlineWidth(qRound(ulw));
selection_[i]->setStrikethruOffset(qRound(slp));
selection_[i]->setStrikethruWidth(qRound(slw));
}
}
 
 
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1672,14 → 1733,18
 
void SMCharacterStyle::slotFillColor()
{
QString col = CharStyle::NOCOLOR;
QString col;
 
if (!page_->fillColor_->useParentValue())
if (page_->fillColor_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetFillColor();
else {
col = page_->fillColor_->currentText();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFillColor(col);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFillColor(col);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1689,13 → 1754,17
 
void SMCharacterStyle::slotFillShade()
{
int fs = Style::NOVALUE;
if (!page_->fillShade_->useParentValue())
int fs;
if (page_->fillShade_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetFillShade();
else {
fs = page_->fillShade_->getValue();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFillShade(fs);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFillShade(fs);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1705,14 → 1774,18
 
void SMCharacterStyle::slotStrokeColor()
{
QString c = CharStyle::NOCOLOR;
QString c;
 
if (!page_->strokeColor_->useParentValue())
if (page_->strokeColor_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetStrokeColor();
else {
c = page_->strokeColor_->currentText();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setStrokeColor(c);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setStrokeColor(c);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1722,13 → 1795,17
 
void SMCharacterStyle::slotStrokeShade()
{
int ss = Style::NOVALUE;
if (!page_->strokeShade_->useParentValue())
int ss;
if (page_->strokeShade_->useParentValue())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetStrokeShade();
else {
ss = page_->strokeShade_->getValue();
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setStrokeShade(ss);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setStrokeShade(ss);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1742,7 → 1819,8
QString language = doc_->Language;
 
if (page_->language_->useParentValue())
language = CharStyle::NOLANG;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetLanguage();
else
{
for (it = doc_->scMW()->LangTransl.begin(); it != doc_->scMW()->LangTransl.end(); ++it)
1752,11 → 1830,11
language = it.key();
break;
}
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLanguage(language);
}
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setLanguage(language);
 
if (!selectionIsDirty_)
{
1771,15 → 1849,16
int c;
 
if (page_->fontHScale_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetScaleH();
else
{
page_->fontHScale_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setScaleH(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setScaleH(qRound(value));
 
if (!selectionIsDirty_)
{
1794,15 → 1873,16
int c;
 
if (page_->fontVScale_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetScaleV();
else
{
page_->fontVScale_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setScaleV(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setScaleV(qRound(value));
 
if (!selectionIsDirty_)
{
1817,15 → 1897,16
int c;
 
if (page_->tracking_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetTracking();
else
{
page_->tracking_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setTracking(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setTracking(qRound(value));
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1839,15 → 1920,16
int c;
 
if (page_->baselineOffset_->useParentValue())
value = Style::NOVALUE;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetBaselineOffset();
else
{
page_->baselineOffset_->getValues(&a, &b, &c, &value);
value = value * 10;
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setBaselineOffset(qRound(value));
}
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setBaselineOffset(qRound(value));
 
if (!selectionIsDirty_)
{
1859,12 → 1941,16
void SMCharacterStyle::slotFont(QString s)
{
ScFace sf;
if (!page_->fontFace_->useParentFont())
if (page_->fontFace_->useParentFont())
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->resetFont();
else {
sf = PrefsManager::instance()->appPrefs.AvailFonts[s];
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFont(sf);
 
for (uint i = 0; i < selection_.count(); ++i)
selection_[i]->setFont(sf);
}
if (!selectionIsDirty_)
{
selectionIsDirty_ = true;
1894,8 → 1980,8
if (setParent)
{
// reset everything to NOVALUE
selection_[i]->eraseCharStyle(*selection_[i]);
selection_[i]->setParent(c);
selection_[i]->erase();
selection_[i]->setParent(parent);
}
else
{