/branches/Version15x/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp |
---|
5686,10 → 5686,10 |
{ |
doc->dontResize = true; |
PageItem_Table *tableitem = currItem->asTable(); |
int rows=attrs.valueAsInt("Rows",1); |
int cols=attrs.valueAsInt("Columns",1); |
tableitem->insertRows(1,rows-1); |
tableitem->insertColumns(1,cols-1); |
int rows = attrs.valueAsInt("Rows", 1); |
int cols = attrs.valueAsInt("Columns", 1); |
tableitem->insertRows(1, rows - 1); |
tableitem->insertColumns(1, cols - 1); |
tableitem->setStyle(attrs.valueAsString("TableStyle")); |
// QString rowPositions(attrs.valueAsString("RowPositions")); |
// QStringList slRowPositions=rowPositions.split(" "); |
5699,7 → 5699,7 |
QString rowHeights(attrs.valueAsString("RowHeights","")); |
if (!rowHeights.isEmpty()) |
{ |
QStringList slRowHeights=rowHeights.split(" "); |
QStringList slRowHeights = rowHeights.split(" "); |
int i=0; |
foreach(const QString& pos, slRowHeights) |
tableitem->resizeRow(i++, pos.toDouble()); |
5709,8 → 5709,8 |
QString colWidths(attrs.valueAsString("ColumnWidths","")); |
if (!colWidths.isEmpty()) |
{ |
QStringList slColWidths=colWidths.split(" "); |
int i=0; |
QStringList slColWidths = colWidths.split(" "); |
int i = 0; |
foreach(const QString& pos, slColWidths) |
tableitem->resizeColumn(i++, pos.toDouble()); |
} |
5717,16 → 5717,16 |
QString cellAreas(attrs.valueAsString("CellAreas")); |
if (!cellAreas.isEmpty()) |
{ |
QStringList slCellAreas=cellAreas.split(" "); |
if (slCellAreas.count()%4!=0) |
qDebug()<<"Cell Area Count on load ! % 4"; |
QStringList slCellAreas = cellAreas.split(" "); |
if (slCellAreas.count() % 4 != 0) |
qDebug() << "Cell Area Count on load ! % 4"; |
for (int i = 0; i < slCellAreas.size(); i+=4) |
{ |
int rows=slCellAreas.at(i).toInt(); |
int columns=slCellAreas.at(i+1).toInt(); |
int height=slCellAreas.at(i+2).toInt(); |
int width=slCellAreas.at(i+3).toInt(); |
tableitem->mergeCells(rows,columns,height,width); |
int rows = slCellAreas.at(i).toInt(); |
int columns = slCellAreas.at(i + 1).toInt(); |
int height = slCellAreas.at(i + 2).toInt(); |
int width = slCellAreas.at(i + 3).toInt(); |
tableitem->mergeCells(rows, columns, height, width); |
} |
} |
doc->dontResize = false; |
/branches/Version15x/Scribus/scribus/scribusdoc.cpp |
---|
1012,9 → 1012,9 |
const QList<PageItem*> * itemlist = & MasterItems; |
while (itemlist != nullptr) |
{ |
for (int i=0; i < itemlist->count(); ++i) |
for (int i = 0; i < itemlist->count(); ++i) |
{ |
const PageItem * currItem = const_cast<QList<PageItem*>*>(itemlist)->at(i); |
const PageItem * currItem = itemlist->at(i); |
if (currItem) |
currItem->getNamedResources(lists); |
} |
1672,7 → 1672,7 |
{ |
int layerID = addLayer(ss->get("NAME"), false); |
int newLayerID = ss->getInt("LAYER_NR"); |
bool renumberedOk=renumberLayer(layerID, newLayerID); |
bool renumberedOk = renumberLayer(layerID, newLayerID); |
Q_ASSERT(renumberedOk); |
} |
layersUndo = true; |
1683,7 → 1683,7 |
{ |
int layerID = addLayer(ss->get("NAME"), false); |
int newLayerID = ss->getInt("LAYER_NR"); |
bool renumberedOk=renumberLayer(layerID, newLayerID); |
bool renumberedOk = renumberLayer(layerID, newLayerID); |
Q_ASSERT(renumberedOk); |
layerID = newLayerID; |
//Layer is at the top now, lower it until it reaches the old level |
2908,7 → 2908,7 |
const ScLayer* ll = Layers.layerByName(layerNameToActivate); |
Q_ASSERT(ll); |
if (ll) |
m_ActiveLayer=ll->ID; |
m_ActiveLayer = ll->ID; |
return (ll != nullptr); |
} |
2921,7 → 2921,7 |
{ |
if (it->ID == layerID) |
{ |
if (it->isPrintable!=isPrintable && UndoManager::undoEnabled()) |
if (it->isPrintable != isPrintable && UndoManager::undoEnabled()) |
{ |
auto *ss = new SimpleState(isPrintable ? Um::PrintLayer : Um::DoNotPrintLayer, "", Um::IPrint); |
ss->set("PRINT_LAYER"); |
2930,7 → 2930,7 |
m_undoManager->action(this, ss, it->Name, Um::ILayer); |
} |
it->isPrintable = isPrintable; |
found=true; |
found = true; |
break; |
} |
} |
3506,24 → 3506,23 |
bool ScribusDoc::renumberLayer(int layerID, int newLayerID) |
{ |
int layerCount=Layers.count(); |
int layerCount = Layers.count(); |
int foundIndex = 0; |
bool found=false; |
bool found = false; |
//Find layer to renumber, if found the new number, return as it exists already. |
for (int i=0; i < layerCount; ++i) |
for (int i = 0; i < layerCount; ++i) |
{ |
if (Layers[i].ID == layerID) |
{ |
foundIndex=i; |
found=true; |
foundIndex = i; |
found = true; |
} |
else |
if (Layers[i].ID == newLayerID) |
else if (Layers[i].ID == newLayerID) |
return false; |
} |
if (!found) |
return false; |
Layers[foundIndex].ID=newLayerID; |
Layers[foundIndex].ID = newLayerID; |
return true; |
} |
5871,12 → 5870,12 |
if (res != -1) |
On_Page = qMin(On_Page, res); |
} |
int final = -1; |
int finalPage = -1; |
if (Off_Page != -1) |
final = On_Page; |
finalPage = On_Page; |
for (uint a = 0; a < objectCount; ++a) |
{ |
Objects.at(a)->OwnPage = final; |
Objects.at(a)->OwnPage = finalPage; |
} |
currItem->OwnPage = OnPage(currItem); |
} |
11930,7 → 11929,7 |
break; |
case alignLast: |
newX = AObjects[alignObjectsCount-1].x1; |
loopEnd = alignObjectsCount-2; |
loopEnd = alignObjectsCount - 2; |
break; |
case alignPage: |
newX = m_currentPage->xOffset(); |
16256,8 → 16255,7 |
pp->initialMargins = m_docPrefsData.docSetupPrefs.margins; |
pp->marginPreset = m_docPrefsData.docSetupPrefs.marginPreset; |
} |
else |
if (resizeMasterPageMargins) |
else if (resizeMasterPageMargins) |
{ |
//CB #6796: find the master page (*mp) for the current page (*pp) |
//check if *pp's margins are the same as the *mp's current margins |
/branches/Version15x/Scribus/scribus/scstreamfilter_ascii85.cpp |
---|
70,7 → 70,8 |
quint32 value; |
int maxWrite = m_buffer.size() - (m_buffer.size() % 5) - 5; |
if (maxWrite <= 5) return 0; |
if (maxWrite <= 5) |
return false; |
const unsigned char *ptr = (const unsigned char*) data; |
unsigned char* writeBuffer = (unsigned char*) m_buffer.data(); |
/branches/Version15x/Scribus/scribus/scstreamfilter_jpeg.cpp |
---|
46,12 → 46,11 |
struct ScJpegDestinationMgr : public jpeg_destination_mgr |
{ |
ScJpegDestinationMgr(ScJpegEncodeFilter*); |
ScJpegEncodeFilter* filter { nullptr }; |
JOCTET buffer[BUFFER_SIZE]; |
JOCTET buffer[BUFFER_SIZE] { 0 }; |
public: |
ScJpegDestinationMgr(ScJpegEncodeFilter *); |
static boolean jpegEmptyBuffer(j_compress_ptr cinfo); |
static void jpegDestinationInit(j_compress_ptr); |
static void jpegDestinationTerm(j_compress_ptr cinfo); |
97,17 → 96,17 |
struct ScJpegEncodeFilterData |
{ |
struct jpeg_compress_struct cinfo; |
struct ScJpegDestinationMgr* cdest { nullptr }; |
JSAMPROW row_pointer[1]; |
ScJpegEncodeFilterData(); |
~ScJpegEncodeFilterData(); |
jpeg_compress_struct cinfo; |
ScJpegDestinationMgr* cdest { nullptr }; |
JSAMPROW row_pointer[1] { nullptr }; |
}; |
ScJpegEncodeFilterData::ScJpegEncodeFilterData() |
{ |
row_pointer[0] = nullptr; |
memset(&cinfo, 0, sizeof(jpeg_compress_struct)); |
} |
ScJpegEncodeFilterData::~ScJpegEncodeFilterData() |
/branches/Version15x/Scribus/scribus/sctextstruct.cpp |
---|
11,7 → 11,7 |
#include "scribusdoc.h" |
PageItem* InlineFrame::getPageItem(ScribusDoc* doc) const |
PageItem* InlineFrame::getPageItem(const ScribusDoc* doc) const |
{ |
if (doc->FrameItems.contains(m_object_id)) |
return doc->FrameItems[m_object_id]; |
26,7 → 26,7 |
mark = nullptr; |
} |
bool ScText::hasObject(ScribusDoc *doc) const |
bool ScText::hasObject(const ScribusDoc *doc) const |
{ |
if (this->ch == SpecialChars::OBJECT) |
return ((embedded > 0) && (doc->FrameItems.contains(embedded))); |
44,7 → 44,7 |
return false; |
} |
QList<PageItem*> ScText::getGroupedItems(ScribusDoc *doc) |
QList<PageItem*> ScText::getGroupedItems(const ScribusDoc *doc) const |
{ |
QList<PageItem*> result; |
if ((embedded > 0) && (doc->FrameItems.contains(embedded))) |
57,7 → 57,7 |
return result; |
} |
PageItem* ScText::getItem(ScribusDoc *doc) |
PageItem* ScText::getItem(const ScribusDoc *doc) const |
{ |
if ((embedded > 0) && (doc->FrameItems.contains(embedded))) |
return doc->FrameItems[embedded]; |
/branches/Version15x/Scribus/scribus/sctextstruct.h |
---|
67,11 → 67,13 |
*/ |
class SCRIBUS_API InlineFrame |
{ |
int m_object_id; |
public: |
InlineFrame(int id) : m_object_id(id) {} |
explicit InlineFrame(int id) : m_object_id(id) {} |
int getInlineCharID() const { return m_object_id; } |
PageItem* getPageItem(ScribusDoc* doc) const; |
PageItem* getPageItem(const ScribusDoc* doc) const; |
private: |
int m_object_id; |
}; |
95,17 → 97,18 |
MarkCE // deprecated |
} ; |
ExpansionPoint(ExpansionType t) : m_type(t), m_name(), m_mark(0) {} |
ExpansionPoint(ExpansionType t, QString name) : m_type(t), m_name(name), m_mark(0) {} |
ExpansionPoint(Mark* mrk) : m_type(MarkCE), m_name(), m_mark(mrk) {} |
ExpansionPoint(ExpansionType t) : m_type(t) {} |
ExpansionPoint(ExpansionType t, QString name) : m_type(t), m_name(name) {} |
ExpansionPoint(Mark* mrk) : m_type(MarkCE), m_mark(mrk) {} |
ExpansionType getType() const { return m_type; } |
QString getName() const { return m_name; } |
Mark* getMark() const { return m_mark; } |
private: |
ExpansionType m_type; |
ExpansionType m_type { Invalid }; |
QString m_name; |
Mark* m_mark; |
Mark* m_mark { nullptr }; |
}; |
112,35 → 115,28 |
/** |
* This struct stores a positioned glyph. This is the result of the layout process. |
*/ |
struct SCRIBUS_API GlyphLayout { |
float xadvance; |
float yadvance; |
float xoffset; |
float yoffset; |
double scaleV; |
double scaleH; |
uint glyph; |
GlyphLayout() : xadvance(0.0f), yadvance(0.0f), xoffset(0.0f), yoffset(0.0f), |
scaleV(1.0), scaleH(1.0), glyph(0) |
{ } |
struct SCRIBUS_API GlyphLayout |
{ |
GlyphLayout() = default; |
float xadvance { 0.0f }; |
float yadvance { 0.0f }; |
float xoffset { 0.0f }; |
float yoffset { 0.0f }; |
double scaleV { 1.0 }; |
double scaleH { 1.0 }; |
uint glyph { 0 }; |
}; |
class SCRIBUS_API ScText : public CharStyle |
{ |
public: |
ParagraphStyle* parstyle; // only for parseps |
int embedded; |
Mark* mark; |
QChar ch; |
ScText() : |
CharStyle(), |
parstyle(nullptr), |
embedded(0), mark(nullptr), ch() {} |
ScText() : CharStyle() {} |
ScText(const ScText& other) : |
CharStyle(other), |
parstyle(nullptr), |
embedded(other.embedded), mark(nullptr), ch(other.ch) |
embedded(other.embedded), |
ch(other.ch) |
{ |
if (other.parstyle) |
parstyle = new ParagraphStyle(*other.parstyle); |
147,13 → 143,20 |
if (other.mark) |
setNewMark(other.mark); |
} |
~ScText(); |
bool hasObject(ScribusDoc *doc) const; |
~ScText() override; |
ParagraphStyle* parstyle { nullptr }; // only for parseps |
int embedded { 0 }; |
Mark* mark { nullptr }; |
QChar ch; |
bool hasObject(const ScribusDoc *doc) const; |
//returns true if given MRK is found, if MRK is nullptr then any mark returns true |
bool hasMark(const Mark * mrk = nullptr) const; |
QList<PageItem*> getGroupedItems(ScribusDoc *doc); |
PageItem* getItem(ScribusDoc *doc); |
QList<PageItem*> getGroupedItems(const ScribusDoc *doc) const; |
PageItem* getItem(const ScribusDoc *doc) const; |
private: |
void setNewMark(Mark* mrk); |
}; |
/branches/Version15x/Scribus/scribus/text/boxes.cpp |
---|
24,7 → 24,7 |
using namespace icu; |
int GroupBox::pointToPosition(QPointF coord, const StoryText &story) const |
int GroupBox::pointToPosition(const QPointF& coord, const StoryText &story) const |
{ |
QPointF rel = coord - QPointF(m_x, m_y); |
for (const Box *box : boxes()) |
102,7 → 102,8 |
double GroupBox::naturalHeight() const |
{ |
double nH = 0; |
for (const Box* box : boxes()) { |
for (const Box* box : boxes()) |
{ |
if (m_direction == D_Horizontal) |
nH = qMax(m_naturalHeight, box->naturalHeight()); |
else |
158,7 → 159,7 |
} |
#endif |
int LineBox::pointToPosition(QPointF coord, const StoryText &story) const |
int LineBox::pointToPosition(const QPointF& coord, const StoryText &story) const |
{ |
int position = GroupBox::pointToPosition(coord, story); |
if (position < 0 && containsPoint(coord)) |
205,7 → 206,7 |
return result; |
} |
bool LineBox::containsPoint(QPointF coord) const |
bool LineBox::containsPoint(const QPointF& coord) const |
{ |
return QRectF(0, m_y, m_width, height()).contains(coord); |
} |
748,7 → 749,7 |
p->restore(); |
} |
int GlyphBox::pointToPosition(QPointF coord, const StoryText& story) const |
int GlyphBox::pointToPosition(const QPointF& coord, const StoryText& story) const |
{ |
if (firstChar() != lastChar()) |
{ |
/branches/Version15x/Scribus/scribus/text/boxes.h |
---|
83,12 → 83,12 |
QRectF bbox() const { return QRectF(m_x, m_y, m_width, height()); } |
/// Whether the coordinate is inside the box or not. |
virtual bool containsPoint(QPointF coord) const { return bbox().contains(coord); } |
virtual bool containsPoint(const QPointF& coord) const { return bbox().contains(coord); } |
/// Whether the character at index pos is inside the box or not. |
bool containsPos(int pos) const { return firstChar() <= pos && pos <= lastChar(); } |
/// Returns the character index at coorddinate. |
virtual int pointToPosition(QPointF coord, const StoryText &story) const = 0; |
virtual int pointToPosition(const QPointF& coord, const StoryText &story) const = 0; |
/// Returns the position of cursor before the character at index pos. |
virtual QLineF positionToPoint(int, const StoryText&) const { return QLineF(); } |
162,7 → 162,7 |
m_naturalWidth = m_naturalHeight = 0; |
} |
int pointToPosition(QPointF coord, const StoryText &story) const override; |
int pointToPosition(const QPointF& coord, const StoryText &story) const override; |
QLineF positionToPoint(int pos, const StoryText& story) const override; |
void render(TextLayoutPainter *p) const override; |
197,10 → 197,10 |
m_type = T_Line; |
} |
int pointToPosition(QPointF coord, const StoryText &story) const override; |
int pointToPosition(const QPointF& coord, const StoryText &story) const override; |
QLineF positionToPoint(int pos, const StoryText& story) const override; |
bool containsPoint(QPointF coord) const override; |
bool containsPoint(const QPointF& coord) const override; |
void render(TextLayoutPainter *p) const override; |
void render(ScreenPainter *p, ITextContext *ctx) const override; |
247,7 → 247,7 |
m_naturalDescent = run.descent(); |
} |
int pointToPosition(QPointF coord, const StoryText &story) const override; |
int pointToPosition(const QPointF& coord, const StoryText &story) const override; |
QLineF positionToPoint(int pos, const StoryText& story) const override; |
void render(TextLayoutPainter *p) const override; |
/branches/Version15x/Scribus/scribus/text/storytext.cpp |
---|
389,7 → 389,8 |
} |
else |
{ |
bool qCharIsDiacritic, curCharIsDiacritic; |
bool qCharIsDiacritic; |
bool curCharIsDiacritic; |
int i = indexOf(ch, from, cs); |
while (i >= 0 && i < (int) d->len) |
{ |
399,8 → 400,8 |
{ |
const QChar &qChar = qStr.at(index); |
const QChar &curChar = d->at(index + diacriticsCounter + i)->ch; |
qCharIsDiacritic = SpecialChars::isArabicModifierLetter(qChar.unicode()) | (qChar.category() == QChar::Mark_NonSpacing); |
curCharIsDiacritic = SpecialChars::isArabicModifierLetter(curChar.unicode()) | (curChar.category() == QChar::Mark_NonSpacing); |
qCharIsDiacritic = SpecialChars::isArabicModifierLetter(qChar.unicode()) || (qChar.category() == QChar::Mark_NonSpacing); |
curCharIsDiacritic = SpecialChars::isArabicModifierLetter(curChar.unicode()) || (curChar.category() == QChar::Mark_NonSpacing); |
if (qCharIsDiacritic || curCharIsDiacritic) |
{ |
if (qCharIsDiacritic) |
656,10 → 657,10 |
if (length() < 2) |
return; |
int posCount = 0; |
int pos = static_cast<int>(length()) - 1; |
for ( int i = static_cast<int>(length()) - 1; i >= 0; --i ) |
int pos = length() - 1; |
for ( int i = length() - 1; i >= 0; --i ) |
{ |
ScText *it = d->at(i); |
const ScText *it = d->at(i); |
if ((it->ch == SpecialChars::PARSEP) || (it->ch.isSpace())) |
{ |
pos--; |
672,7 → 673,7 |
{ |
ParagraphStyle pst = paragraphStyle(pos); |
if (posCount > 1) |
removeChars(pos+1, posCount-1); |
removeChars(pos + 1, posCount - 1); |
applyStyle(pos, pst); |
} |
} |
905,7 → 906,7 |
pos += length()+1; |
insertChars(pos, SpecialChars::OBJECT); |
const_cast<StoryText *>(this)->d->at(pos)->embedded = ob; |
this->d->at(pos)->embedded = ob; |
m_doc->FrameItems[ob]->isEmbedded = true; // this might not be enough... |
m_doc->FrameItems[ob]->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object |
} |
932,7 → 933,7 |
pos += length()+1; |
replaceChar(pos, SpecialChars::OBJECT); |
const_cast<StoryText *>(this)->d->at(pos)->embedded = ob; |
this->d->at(pos)->embedded = ob; |
m_doc->FrameItems[ob]->isEmbedded = true; // this might not be enough... |
m_doc->FrameItems[ob]->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object |
} |
954,9 → 955,8 |
int len = length(); |
result.reserve(len); |
StoryText* that(const_cast<StoryText*>(this)); |
for (int i = 0; i < len; ++i) { |
ch = that->d->at(i)->ch; |
ch = d->at(i)->ch; |
if (ch == SpecialChars::PARSEP) |
ch = QLatin1Char('\n'); |
result += ch; |
979,7 → 979,7 |
assert(pos >= 0); |
assert(pos < length()); |
return const_cast<StoryText *>(this)->d->at(pos)->ch; |
return d->at(pos)->ch; |
} |
QString StoryText::text(int pos, uint len) const |
991,9 → 991,8 |
assert(pos + signed(len) <= length()); |
QString result; |
StoryText* that(const_cast<StoryText*>(this)); |
for (int i = pos; i < pos+signed(len); ++i) |
result += that->d->at(i)->ch; |
for (int i = pos; i < pos + signed(len); ++i) |
result += d->at(i)->ch; |
return result; |
} |
1027,8 → 1026,7 |
assert(pos >= 0); |
assert(pos < length()); |
StoryText* that = const_cast<StoryText *>(this); |
return InlineFrame(that->d->at(pos)->embedded); |
return InlineFrame(d->at(pos)->embedded); |
} |
1110,9 → 1108,8 |
assert(pos >= 0); |
assert(pos < length()); |
StoryText* that = const_cast<StoryText *>(this); |
if (that->d->at(pos)->ch == SpecialChars::OBJECT) |
return that->d->at(pos)->hasObject(m_doc); |
if (d->at(pos)->ch == SpecialChars::OBJECT) |
return d->at(pos)->hasObject(m_doc); |
return false; |
} |
1125,8 → 1122,7 |
assert(pos >= 0); |
assert(pos < length()); |
StoryText* that = const_cast<StoryText *>(this); |
return that->d->at(pos)->getItem(m_doc); |
return d->at(pos)->getItem(m_doc); |
} |
int StoryText::findMark(const Mark* mrk, int startPos) const |
1278,8 → 1274,7 |
assert(pos >= 0); |
assert(pos < length()); |
StoryText* that = const_cast<StoryText *>(this); |
return static_cast<LayoutFlags>((*that->d->at(pos)).effects().value & ScStyle_NonUserStyles); |
return static_cast<LayoutFlags>(d->at(pos)->effects().value & ScStyle_NonUserStyles); |
} |
bool StoryText::hasFlag(int pos, LayoutFlags flags) const |
1391,7 → 1386,8 |
// current->parstyle->charStyle().setName( "cpara(paragraphStyle)" ); // DON'T TRANSLATE |
// current->parstyle->charStyle().setContext( d->defaultStyle.charStyleContext()); |
} |
else { |
else |
{ |
// qDebug() << QString("using parstyle at %1").arg(pos); |
} |
assert (that->d->at(pos)->parstyle); |
1707,12 → 1703,11 |
uint StoryText::nrOfParagraph(int pos) const |
{ |
uint result = 0; |
StoryText* that = const_cast<StoryText *>(this); |
bool lastWasPARSEP = true; |
pos = qMin(pos, that->length()); |
for (int i=0; i < pos; ++i) |
pos = qMin(pos, length()); |
for (int i = 0; i < pos; ++i) |
{ |
lastWasPARSEP = that->d->at(i)->ch == SpecialChars::PARSEP; |
lastWasPARSEP = d->at(i)->ch == SpecialChars::PARSEP; |
if (lastWasPARSEP) |
++result; |
} |
1722,11 → 1717,10 |
uint StoryText::nrOfParagraphs() const |
{ |
uint result = 0; |
StoryText* that = const_cast<StoryText *>(this); |
bool lastWasPARSEP = true; |
for (int i=0; i < length(); ++i) |
for (int i = 0; i < length(); ++i) |
{ |
lastWasPARSEP = that->d->at(i)->ch == SpecialChars::PARSEP; |
lastWasPARSEP = d->at(i)->ch == SpecialChars::PARSEP; |
if (lastWasPARSEP) |
++result; |
} |
1743,10 → 1737,9 |
if (index == 0) |
return 0; |
StoryText* that = const_cast<StoryText *>(this); |
for (int i=0; i < length(); ++i) |
{ |
if (that->d->at(i)->ch == SpecialChars::PARSEP && ! --index) |
if (d->at(i)->ch == SpecialChars::PARSEP && ! --index) |
return i + 1; |
} |
return length(); |
1760,10 → 1753,9 |
int StoryText::endOfParagraph(uint index) const |
{ |
++index; |
StoryText* that = const_cast<StoryText *>(this); |
for (int i=0; i < length(); ++i) |
{ |
if (that->d->at(i)->ch == SpecialChars::PARSEP && ! --index) |
if (d->at(i)->ch == SpecialChars::PARSEP && ! --index) |
return i; |
} |
return length(); |
2125,13 → 2117,6 |
void StoryText::selectAll() |
{ |
/* StoryText* that = const_cast<StoryText *>(this); |
that->at(0); |
for (int i=0; i < length(); ++i) { |
that->current()->cselect = true; |
that->next(); |
} |
*/ |
d->selFirst = 0; |
d->selLast = length() - 1; |
} |
2138,13 → 2123,6 |
void StoryText::deselectAll() |
{ |
/* StoryText* that = const_cast<StoryText *>(this); |
that->at(0); |
for (int i=0; i < length(); ++i) { |
that->current()->cselect = false; |
that->next(); |
} |
*/ |
d->selFirst = 0; |
d->selLast = -1; |
} |
2207,13 → 2185,13 |
ScText* StoryText::item(int index) |
{ |
assert( index < length() ); |
return const_cast<StoryText *>(this)->d->at(index); |
return this->d->at(index); |
} |
const ScText* StoryText::item(int index) const |
{ |
assert( index < length() ); |
return const_cast<StoryText *>(this)->d->at(index); |
return d->at(index); |
} |
2391,7 → 2369,7 |
class AppendText_body : public Action_body |
{ |
public: |
void chars(const Xml_string& txt) |
void chars(const Xml_string& txt) override |
{ |
QChar chr; |
int lastPos = 0, len; |
2434,9 → 2412,9 |
class AppendSpecial_body : public Action_body |
{ |
public: |
AppendSpecial_body(QChar sp) : chr(sp) {} |
explicit AppendSpecial_body(QChar sp) : chr(sp) {} |
void begin(const Xml_string& tag, Xml_attr attr) |
void begin(const Xml_string& tag, Xml_attr attr) override |
{ |
StoryText* obj = this->dig->top<StoryText>(); |
Xml_attr::iterator code = attr.find("code"); |
2459,8 → 2437,8 |
struct AppendSpecial : public MakeAction<AppendSpecial_body, QChar> |
{ |
AppendSpecial(QChar sp) : MakeAction<AppendSpecial_body, QChar>(sp) {} |
AppendSpecial() : MakeAction<AppendSpecial_body, QChar>(SpecialChars::BLANK) {} |
explicit AppendSpecial(QChar sp) : MakeAction<AppendSpecial_body, QChar>(sp) {} |
}; |
2467,7 → 2445,7 |
class AppendInlineFrame_body : public Action_body |
{ |
public: |
void end(const Xml_string& tag) // this could be a setter if we had StoryText::appendObject() ... |
void end(const Xml_string& tag) override // this could be a setter if we had StoryText::appendObject() ... |
{ |
StoryText* story = this->dig->top<StoryText>(1); |
PageItem* obj = this->dig->top<PageItem>(0); |
2493,7 → 2471,7 |
class AppendMark_body : public Action_body |
{ |
public: |
void begin(const Xml_string& tag, Xml_attr attr) |
void begin(const Xml_string& tag, Xml_attr attr) override |
{ |
StoryText* story = this->dig->top<StoryText>(); |
QString l = ""; |
2709,20 → 2687,20 |
class Paragraph_body : public Action_body |
{ |
public: |
Paragraph_body() : lastPos(0), numPara(0), lastStyle(nullptr) |
Paragraph_body() |
{} |
~Paragraph_body() |
~Paragraph_body() override |
{ |
delete lastStyle; |
} |
virtual void reset() |
void reset() override |
{ |
numPara = 0; |
} |
void begin(const Xml_string& tag, Xml_attr attr) |
void begin(const Xml_string& tag, Xml_attr attr) override |
{ |
if (tag == "text-content") |
{ |
2742,7 → 2720,7 |
} |
} |
void end(const Xml_string& tag) |
void end(const Xml_string& tag) override |
{ |
if (tag == ParagraphStyle::saxxDefaultElem) |
{ |
2763,9 → 2741,9 |
} |
} |
private: |
int lastPos; |
int numPara; |
ParagraphStyle* lastStyle; |
int lastPos { 0 }; |
int numPara { 0 }; |
ParagraphStyle* lastStyle { nullptr }; |
}; |
struct Paragraph : public MakeAction<Paragraph_body> |
2777,15 → 2755,15 |
class SpanAction_body : public Action_body |
{ |
public: |
SpanAction_body() : lastPos(0), lastStyle(nullptr) |
SpanAction_body() |
{} |
~SpanAction_body() |
~SpanAction_body() override |
{ |
delete lastStyle; |
} |
void begin(const Xml_string& tag, Xml_attr attr) |
void begin(const Xml_string& tag, Xml_attr attr) override |
{ |
// qDebug() << QString("spanaction: begin %1").arg(tag); |
if (tag == "span") |
2797,7 → 2775,7 |
} |
} |
void end(const Xml_string& tag) |
void end(const Xml_string& tag) override |
{ |
if (tag == CharStyle::saxxDefaultElem) |
// qDebug() << QString("spanaction: end %1").arg(tag); |
2816,8 → 2794,8 |
} |
} |
private: |
int lastPos; |
CharStyle* lastStyle; |
int lastPos { 0 }; |
CharStyle* lastStyle { nullptr }; |
}; |
struct SpanAction : public MakeAction<SpanAction_body> |
/branches/Version15x/Scribus/scribus/text/textlayout.cpp |
---|
27,17 → 27,10 |
#include "boxes.h" |
#include "itextcontext.h" |
TextLayout::TextLayout(StoryText* text, ITextContext* frame) |
: m_story(text), |
m_frame(frame) |
{ |
m_story = text; |
m_frame = frame; |
m_validLayout = false; |
m_magicX = 0.0; |
m_lastMagicPos = -1; |
m_box = new GroupBox(Box::D_Horizontal); |
} |
99,7 → 92,7 |
// Remove the last line from the list. Used when we need to backtrack on the layouting. |
void TextLayout::removeLastLine () |
{ |
QList<Box*>& boxes = m_box->boxes(); |
const QList<Box*>& boxes = m_box->boxes(); |
if (boxes.isEmpty()) |
return; |
362,7 → 355,7 |
} |
int TextLayout::pointToPosition(QPointF coord) const |
int TextLayout::pointToPosition(const QPointF& coord) const |
{ |
int position = m_box->pointToPosition(coord, *m_story); |
return position; |
385,8 → 378,8 |
Box* column = m_box->boxes().last(); |
if (column->boxes().count() > 0) |
{ |
Box* line = column->boxes().last(); |
Box* glyph = line->boxes().empty() ? nullptr : line->boxes().last(); |
const Box* line = column->boxes().last(); |
const Box* glyph = line->boxes().empty() ? nullptr : line->boxes().last(); |
QChar ch = story()->text(line->lastChar()); |
if (ch == SpecialChars::PARSEP || ch == SpecialChars::LINEBREAK) |
{ |
/branches/Version15x/Scribus/scribus/text/textlayout.h |
---|
42,8 → 42,6 |
public: |
TextLayout(StoryText* text, ITextContext* frame); |
~TextLayout(); |
bool overflows() const; |
StoryText* story() { return m_story; } |
ITextContext* frame() { return m_frame; } |
59,7 → 57,7 |
int startOfFrame() const; |
int endOfFrame() const; |
int pointToPosition(QPointF coord) const; |
int pointToPosition(const QPointF& coord) const; |
QLineF positionToPoint(int pos) const; |
uint lines() const; |
77,14 → 75,13 |
protected: |
friend class FrameControl; |
StoryText* m_story; |
ITextContext* m_frame; |
GroupBox* m_box; |
StoryText* m_story { nullptr }; |
ITextContext* m_frame { nullptr }; |
GroupBox* m_box { nullptr }; |
bool m_validLayout; |
mutable qreal m_magicX; |
mutable int m_lastMagicPos; |
bool m_validLayout { false }; |
mutable qreal m_magicX { 0.0 }; |
mutable int m_lastMagicPos { -1 }; |
}; |
#endif |
/branches/Version15x/Scribus/win32/msvc2022/Scribus-build-props.props |
---|
10,10 → 10,10 |
<!-- Import Qt5 --> |
<PropertyGroup Label="UserMacros"> |
<!-- Qt5 --> |
<QT5_DIR Condition="'$(Platform)' == 'Win32' and '$(PlatformToolset)' == 'v142'" >F:\Libraries\Qt\5.15.2\msvc2019</QT5_DIR> |
<QT5_DIR Condition="'$(Platform)' == 'x64' and '$(PlatformToolset)' == 'v142'" >F:\Libraries\Qt\5.15.2\msvc2019_64</QT5_DIR> |
<QT5_DIR Condition="'$(Platform)' == 'Win32' and '$(PlatformToolset)' == 'v143'" >F:\Libraries\Qt\5.15.2\msvc2019</QT5_DIR> |
<QT5_DIR Condition="'$(Platform)' == 'x64' and '$(PlatformToolset)' == 'v143'" >F:\Libraries\Qt\5.15.2\msvc2019_64</QT5_DIR> |
<QT5_DIR Condition="'$(Platform)' == 'Win32' and '$(PlatformToolset)' == 'v142'" >F:\Libraries\Qt-5.15.7\msvc2019</QT5_DIR> |
<QT5_DIR Condition="'$(Platform)' == 'x64' and '$(PlatformToolset)' == 'v142'" >F:\Libraries\Qt-5.15.7\msvc2019_64</QT5_DIR> |
<QT5_DIR Condition="'$(Platform)' == 'Win32' and '$(PlatformToolset)' == 'v143'" >F:\Libraries\Qt-5.15.7\msvc2019</QT5_DIR> |
<QT5_DIR Condition="'$(Platform)' == 'x64' and '$(PlatformToolset)' == 'v143'" >F:\Libraries\Qt-5.15.7\msvc2019_64</QT5_DIR> |
<QT5CORE_LIB Condition="'$(Configuration)' == 'Debug'">Qt5Cored.lib</QT5CORE_LIB> |
<QT5CORE_LIB Condition="'$(Configuration)' == 'Release'">Qt5Core.lib</QT5CORE_LIB> |
<QT5GUI_LIB Condition="'$(Configuration)' == 'Debug'">Qt5Guid.lib</QT5GUI_LIB> |