r18524 by avox - refactor StoryText to make itemText.item(int) private, part 1
scribus-commit
scribus-commit at lists.scribus.net
Fri Oct 4 17:40:08 UTC 2013
Author: avox
Date: Fri Oct 4 17:40:08 2013
New Revision: 18524
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18524
Log:
refactor StoryText to make itemText.item(int) private, part 1
Modified:
trunk/Scribus/Scribus.pro
trunk/Scribus/scribus/canvasgesture_resize.cpp
trunk/Scribus/scribus/canvasmode.cpp
trunk/Scribus/scribus/canvasmode_edit.cpp
trunk/Scribus/scribus/documentchecker.cpp
trunk/Scribus/scribus/fileloader.cpp
trunk/Scribus/scribus/hyphenator.cpp
trunk/Scribus/scribus/marks.h
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_noteframe.cpp
trunk/Scribus/scribus/pageitem_pathtext.cpp
trunk/Scribus/scribus/pageitem_textframe.cpp
trunk/Scribus/scribus/pageitem_textframe.h
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp
trunk/Scribus/scribus/plugins/scripter/utils.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
trunk/Scribus/scribus/pslib.cpp
trunk/Scribus/scribus/pslib.h
trunk/Scribus/scribus/sampleitem.cpp
trunk/Scribus/scribus/scpageoutput.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusXml.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/sctextstruct.h
trunk/Scribus/scribus/styles/charstyle.h
trunk/Scribus/scribus/text/storytext.cpp
trunk/Scribus/scribus/text/storytext.h
trunk/Scribus/scribus/ui/contextmenu.cpp
trunk/Scribus/scribus/ui/propertiespalette.cpp
trunk/Scribus/scribus/ui/propertiespalette_group.cpp
trunk/Scribus/scribus/ui/propertiespalette_line.cpp
trunk/Scribus/scribus/ui/propertiespalette_shape.cpp
trunk/Scribus/scribus/ui/propertiespalette_text.cpp
trunk/Scribus/scribus/ui/propertiespalette_utils.cpp
trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
trunk/Scribus/scribus/ui/search.cpp
trunk/Scribus/scribus/ui/storyeditor.cpp
Modified: trunk/Scribus/Scribus.pro
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/Scribus.pro
==============================================================================
--- trunk/Scribus/Scribus.pro (original)
+++ trunk/Scribus/Scribus.pro Fri Oct 4 17:40:08 2013
@@ -539,7 +539,6 @@
scribus/tests/testStoryText.h \
scribus/text/frect.h \
scribus/text/fsize.h \
- scribus/text/nlsconfig.h \
scribus/text/sctext_shared.h \
scribus/text/specialchars.h \
scribus/text/storytext.h \
Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp Fri Oct 4 17:40:08 2013
@@ -318,21 +318,20 @@
{
for (int aa = 0; aa < currItem->itemText.length(); ++aa)
{
+ const CharStyle& oldChStyle(currItem->itemText.charStyle(aa));
+ CharStyle newChStyle;
#if 0 // hard to decide if itâs batter to scale or to change font size
- currItem->itemText.item(aa)->setScaleV(
- qMax(qMin(qRound(currItem->itemText.item(aa)->scaleV()*txtScY), 4000), 100));
- currItem->itemText.item(aa)->setScaleH(
- qMax(qMin(qRound(currItem->itemText.item(aa)->scaleH() * txtScX), 4000), 100));
+ newChStyle.setScaleV(qMax(qMin(qRound(oldChStyle.scaleV()*txtScY), 4000), 100));
+ newChStyle.setScaleH(qMax(qMin(qRound(oldChStyle.scaleH() * txtScX), 4000), 100));
#else
- currItem->itemText.item(aa)->setFontSize(
- qMax(qMin(currItem->itemText.item(aa)->fontSize() * txtScY, 4000.0), 1.0));
- currItem->itemText.item(aa)->setScaleH(
- qMax(qMin(qRound(currItem->itemText.item(aa)->scaleH() * txtScX / txtScY), 4000), 100));
+ newChStyle.setFontSize(qMax(qMin(oldChStyle.fontSize() * txtScY, 4000.0), 1.0));
+ newChStyle.setScaleH(qMax(qMin(qRound(oldChStyle.scaleH() * txtScX / txtScY), 4000), 100));
#endif
+ currItem->itemText.applyCharStyle(aa, 1, newChStyle);
// We need to scale the linespacing _only once_ per paragraph.
if((aa == 0)
- || ( SpecialChars::isBreak(currItem->itemText.itemText(aa - 1).at(0))))
+ || ( SpecialChars::isBreak(currItem->itemText.text(aa - 1))))
{
ParagraphStyle ps(currItem->itemText.paragraphStyle(aa));
double oldLS(currItem->itemText.paragraphStyle(aa).lineSpacing());
Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Fri Oct 4 17:40:08 2013
@@ -957,7 +957,7 @@
textframe->itemText.normalizeCursorPosition();
int textCursorPos ( textframe->itemText.cursorPosition() );
- if ( textframe->lastInFrame() >= signed ( textframe->itemText.nrOfItems() )
+ if ( textframe->lastInFrame() >= textframe->itemText.length()
|| textframe->itemText.length() == 0 )
{
dx = textframe->textToFrameDistLeft();
@@ -1032,7 +1032,7 @@
FRect bbox = textframe->itemText.boundingBox ( textCursorPos );
dx = bbox.x();
dy = bbox.y();
- dx += textframe->itemText.item ( textCursorPos )->glyph.wide();
+ dx += textframe->itemText.getGlyphs(textCursorPos)->wide();
if ( bbox.height() <= 2 )
dy1 = bbox.y() + textframe->itemText.charStyle ( textCursorPos ).fontSize() / 30.0;
else
@@ -1044,7 +1044,7 @@
FRect bbox = textframe->itemText.boundingBox ( textCursorPos );
dx = bbox.x();
dy = bbox.y();
- dx += textframe->itemText.item ( textCursorPos )->glyph.wide();
+ dx += textframe->itemText.getGlyphs(textCursorPos)->wide();
if ( bbox.height() <= 2 )
dy1 = bbox.y() + textframe->itemText.charStyle ( textCursorPos ).fontSize() / 30.0;
else
Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Fri Oct 4 17:40:08 2013
@@ -313,7 +313,7 @@
currItem->itemText.extendSelection(start, stop);
currItem->itemText.setCursorPosition(stop);
}
- else if ((currItem->itemText.cursorPosition() < currItem->itemText.length()) && (currItem->itemText.item(currItem->itemText.cursorPosition())->mark != NULL))
+ else if ((currItem->itemText.cursorPosition() < currItem->itemText.length()) && (currItem->itemText.hasMark(currItem->itemText.cursorPosition())))
{ //invoke edit marker dialog
m_ScMW->slotEditMark();
return;
Modified: trunk/Scribus/scribus/documentchecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/documentchecker.cpp
==============================================================================
--- trunk/Scribus/scribus/documentchecker.cpp (original)
+++ trunk/Scribus/scribus/documentchecker.cpp Fri Oct 4 17:40:08 2013
@@ -30,7 +30,6 @@
#include "scpage.h"
#include "scribusdoc.h"
#include "scribusstructs.h"
-#include "text/nlsconfig.h"
#include "util.h"
#include "util_formats.h"
@@ -336,7 +335,6 @@
}
if ((currItem->asTextFrame()) || (currItem->asPathText()))
{
- #ifndef NLS_PROTO
if ( currItem->frameOverflows() && (checkerSettings.checkOverflow) && (!((currItem->isAnnotation()) && ((currItem->annotation().Type() == Annotation::Combobox) || (currItem->annotation().Type() == Annotation::Listbox)))))
itemError.insert(TextOverflow, 0);
@@ -405,7 +403,6 @@
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, e);
}
- #endif
}
if (((currItem->fillColor() != CommonStrings::None) || (currItem->lineColor() != CommonStrings::None)) && (checkerSettings.checkNotCMYKOrSpot))
{
@@ -631,7 +628,6 @@
}
if ((currItem->asTextFrame()) || (currItem->asPathText()))
{
- #ifndef NLS_PROTO
if ( currItem->frameOverflows() && (checkerSettings.checkOverflow) && (!((currItem->isAnnotation()) && ((currItem->annotation().Type() == Annotation::Combobox) || (currItem->annotation().Type() == Annotation::Listbox)))))
itemError.insert(TextOverflow, 0);
@@ -700,7 +696,6 @@
if ((!currItem->itemText.charStyle(e).font().canRender(chr)) && (checkerSettings.checkGlyphs))
itemError.insert(MissingGlyph, e);
}
- #endif
}
if (((currItem->fillColor() != CommonStrings::None) || (currItem->lineColor() != CommonStrings::None)) && (checkerSettings.checkNotCMYKOrSpot))
{
Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp (original)
+++ trunk/Scribus/scribus/fileloader.cpp Fri Oct 4 17:40:08 2013
@@ -39,7 +39,6 @@
#include "util.h"
#include "plugins/formatidlist.h"
-#include "text/nlsconfig.h"
#include "ui/guidemanager.h"
#include "ui/fontreplacedialog.h"
#include "ui/missing.h"
Modified: trunk/Scribus/scribus/hyphenator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/hyphenator.cpp
==============================================================================
--- trunk/Scribus/scribus/hyphenator.cpp (original)
+++ trunk/Scribus/scribus/hyphenator.cpp Fri Oct 4 17:40:08 2013
@@ -40,7 +40,6 @@
#include "scribusdoc.h"
#include "prefsfile.h"
#include "prefsmanager.h"
-#include "text/nlsconfig.h"
Hyphenator::Hyphenator(QWidget* parent, ScribusDoc *dok) : QObject( parent ),
m_doc(dok),
Modified: trunk/Scribus/scribus/marks.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/marks.h
==============================================================================
--- trunk/Scribus/scribus/marks.h (original)
+++ trunk/Scribus/scribus/marks.h Fri Oct 4 17:40:08 2013
@@ -46,7 +46,7 @@
private:
Mark() : label(""), OwnPage(-1), typ(MARKNoType), data() {}
Mark(const Mark& other) : label(other.label), OwnPage(other.OwnPage), typ(other.typ), data(other.data) {}
- ~Mark() {}
+
public:
QString label;
int OwnPage;
@@ -92,6 +92,8 @@
bool isNoteType() { return ((typ == MARKNoteMasterType) || (typ==MARKNoteFrameType)); }
bool isType(const MarkType t) { return t==typ; }
+ virtual ~Mark() {}
+
protected:
MarkType typ;
MarkData data;
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Fri Oct 4 17:40:08 2013
@@ -71,7 +71,6 @@
#include "scribuswin.h"
#include "sctextstream.h"
#include "selection.h"
-#include "text/nlsconfig.h"
#include "text/storytext.h"
#include "undomanager.h"
#include "undostate.h"
@@ -839,9 +838,9 @@
{
for (int pos=0; pos < itemText.length(); ++pos)
{
- if (itemText.item(pos)->hasMark())
+ if (itemText.hasMark(pos))
{
- Mark* mrk = itemText.item(pos)->mark;
+ Mark* mrk = itemText.mark(pos);
if (!mrk->isType(MARKBullNumType))
m_Doc->eraseMark(mrk);
}
@@ -1109,7 +1108,6 @@
/// returns true if text overflows
bool PageItem::frameOverflows() const
{
-#ifndef NLS_PROTO
// Fix #6991 : "Text overflow" warning when there is a text underflow in fact
/*return NextBox == NULL && itemText.length() > static_cast<int>(MaxChars);*/
return ( NextBox == NULL )
@@ -1118,9 +1116,6 @@
/*&& ( firstChar < MaxChars )*/
&& ( firstChar <= MaxChars )
&& ( itemText.length() > static_cast<int> ( MaxChars ) );
-#else
- return false; // FIXME:NLS
-#endif
}
int PageItem::frameOverflowCount() const
@@ -1185,11 +1180,7 @@
}
int PageItem::lastInFrame() const
{
-#ifndef NLS_PROTO
return qMin(signed(MaxChars), itemText.length()) - 1;
-#else
- return itemText.length() - 1;
-#endif
}
bool PageItem::testLinkCandidate(PageItem* nxt)
@@ -1416,11 +1407,7 @@
/// tests if a character is displayed by this frame
bool PageItem::frameDisplays(int textpos) const
{
-#ifndef NLS_PROTO
return 0 <= textpos && textpos < signed(MaxChars) && textpos < itemText.length();
-#else
- return true; // FIXME:NLS
-#endif
}
@@ -2277,9 +2264,9 @@
//check for marks
else if (ch == SpecialChars::OBJECT)
{
- ScText* hl = itemText.item(base);
- if ((hl->mark != NULL) && !hl->mark->isType(MARKAnchorType) && !hl->mark->isType(MARKIndexType))
- chstr = hl->mark->getString();
+ Mark* mark = itemText.mark(base);
+ if ((mark != NULL) && !mark->isType(MARKAnchorType) && !mark->isType(MARKIndexType))
+ chstr = mark->getString();
}
return chstr;
}
@@ -2329,7 +2316,7 @@
layout.glyph = font.char2CMap(chars[0].unicode());
}
double tracking = 0.0;
- if ( (style.effects() & ScStyle_StartOfLine) == 0)
+ if ( (style.effects() & ScLayout_StartOfLine) == 0)
tracking = style.fontSize() * style.tracking() / 10000.0;
layout.xoffset = tracking;
@@ -2485,7 +2472,7 @@
points.map(chma * chma4);
p->setupPolygon(&points, true);
QColor oldBrush = p->brush();
- p->setBrush( (style.effects() & ScStyle_SuppressSpace) ? Qt::green
+ p->setBrush( (style.effects() & ScLayout_SuppressSpace) ? Qt::green
: PrefsManager::instance()->appPrefs.displayPrefs.controlCharColor);
if (stroke)
{
@@ -2514,7 +2501,7 @@
else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode()))
glyph = font.char2CMap(QChar('-'));
- if (glyph >= ScFace::CONTROL_GLYPHS || (style.effects() & ScStyle_SuppressSpace)) {
+ if (glyph >= ScFace::CONTROL_GLYPHS || (style.effects() & ScLayout_SuppressSpace)) {
// qDebug("drawGlyphs: skipping %d", glyph);
// all those are empty
if (glyphs.more)
@@ -5086,13 +5073,13 @@
void PageItem::restoreMarkString(SimpleState *state, bool isUndo)
{
ScItemState< QPair<int,QString> > *is = dynamic_cast<ScItemState< QPair<int,QString> >*>(state);
- ScText * hl = itemText.item(is->getItem().first);
- if (!hl->hasMark())
+ Mark * mark = itemText.mark(is->getItem().first);
+ if (!itemText.hasMark(is->getItem().first))
return;
if (isUndo)
- hl->mark->setString(is->getItem().second);
- else
- hl->mark->setString(QString());
+ mark->setString(is->getItem().second);
+ else
+ mark->setString(QString());
}
bool PageItem::checkGradientUndoRedo(SimpleState *ss, bool isUndo)
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Fri Oct 4 17:40:08 2013
@@ -45,7 +45,6 @@
#include "scimage.h"
#include "margins.h"
#include "sctextstruct.h"
-#include "text/nlsconfig.h"
#include "text/storytext.h"
#include "undoobject.h"
#include "vgradient.h"
Modified: trunk/Scribus/scribus/pageitem_noteframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pageitem_noteframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_noteframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_noteframe.cpp Fri Oct 4 17:40:08 2013
@@ -324,28 +324,31 @@
Mark* prevMrk = NULL;
while (pos < itemText.length())
{
- ScText* hl = itemText.item(pos);
- if (hl->hasMark() && hl->mark->isType(MARKNoteFrameType))
- {
- if (prevMrk != NULL)
- {
- note = prevMrk->getNotePtr();
- if (note != NULL)
- {
- int offset = 0;
- if (itemText.text(pos-1) == SpecialChars::PARSEP)
- ++offset;
- int len = pos - startPos -offset;
- if (len <= 0)
- note->setSaxedText("");
- else
- note->setSaxedText(getItemTextSaxed(startPos, len));
- note->textLen = len;
- itemText.deselectAll();
- }
- }
- prevMrk = hl->mark;
- startPos = pos +1;
+ if (itemText.hasMark(pos))
+ {
+ Mark* mark = itemText.mark(pos);
+ if (mark->isType(MARKNoteFrameType))
+ {
+ if (prevMrk != NULL)
+ {
+ note = prevMrk->getNotePtr();
+ if (note != NULL)
+ {
+ int offset = 0;
+ if (itemText.text(pos-1) == SpecialChars::PARSEP)
+ ++offset;
+ int len = pos - startPos -offset;
+ if (len <= 0)
+ note->setSaxedText("");
+ else
+ note->setSaxedText(getItemTextSaxed(startPos, len));
+ note->textLen = len;
+ itemText.deselectAll();
+ }
+ }
+ prevMrk = mark;
+ startPos = pos +1;
+ }
}
++pos;
}
@@ -412,10 +415,10 @@
return -1;
for (int pos=0; pos < itemText.length(); ++pos)
{
- ScText* hl = itemText.item(pos);
- if (hl->hasMark() && hl->mark->isType(MARKNoteFrameType))
- {
- if (hl->mark->getNotePtr() == note)
+ Mark* mark = itemText.mark(pos);
+ if (itemText.hasMark(pos) && mark->isType(MARKNoteFrameType))
+ {
+ if (mark->getNotePtr() == note)
return (pos);
}
}
Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp Fri Oct 4 17:40:08 2013
@@ -46,8 +46,6 @@
#include "util.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
-
using namespace std;
PageItem_PathText::PageItem_PathText(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline)
@@ -77,7 +75,6 @@
MaxChars = 0;
int a;
QString chstr, chstr2, chstr3;
- ScText *hl;
double dx;
FPoint point = FPoint(0, 0);
FPoint tangent = FPoint(0, 0);
@@ -177,11 +174,10 @@
itemRenderText.setDefaultStyle(itemText.defaultStyle());
for (a = firstChar; a < itemText.length(); ++a)
{
- hl = itemText.item(a);
CharStyle nstyle = itemText.charStyle(a);
ParagraphStyle pstyle = itemText.paragraphStyle(a);
- chstr = hl->ch;
- if ((itemText.item(a)->ch == SpecialChars::OBJECT) && (itemText.item(a)->hasObject(m_Doc)))
+ chstr = itemText.text(a, 1);
+ if ((chstr[0] == SpecialChars::OBJECT) && (itemText.hasObject(a)))
{
int pot = itemRenderText.length();
itemRenderText.insertObject(pot, itemText.object(a)->inlineCharID);
@@ -204,8 +200,8 @@
double wordExtra = 0;
for (a = firstChar; a < itemRenderText.length(); ++a)
{
- hl = itemRenderText.item(a);
- chstr = hl->ch;
+ GlyphLayout* glyphs = itemRenderText.getGlyphs(a);
+ chstr = itemRenderText.text(a, 1);
if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
|| chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK)
continue;
@@ -213,13 +209,13 @@
spaceCount++;
if (a < itemRenderText.length()-1)
chstr += itemRenderText.text(a+1, 1);
- hl->glyph.yadvance = 0;
- layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
- hl->glyph.shrink();
- if (hl->hasObject(m_Doc))
- totalTextLen += (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH;
+ glyphs->yadvance = 0;
+ layoutGlyphs(itemRenderText.charStyle(a), chstr, *glyphs);
+ glyphs->shrink();
+ if (itemRenderText.hasObject(a))
+ totalTextLen += (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * glyphs->scaleH;
else
- totalTextLen += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0;
+ totalTextLen += glyphs->wide()+itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0;
}
for (int segs = 0; segs < PoLine.size()-3; segs += 4)
{
@@ -250,7 +246,6 @@
if (itemRenderText.paragraphStyle(0).alignment() == 4)
extraOffset = (totalCurveLen - m_textDistanceMargins.Left - totalTextLen) / static_cast<double>(itemRenderText.length());
}
-#ifndef NLS_PROTO
QPainterPath guidePath = PoLine.toQPainterPath(false);
QList<QPainterPath> pathList = decomposePath(guidePath);
QPainterPath currPath = pathList[0];
@@ -258,8 +253,8 @@
for (a = firstChar; a < itemRenderText.length(); ++a)
{
CurY = 0;
- hl = itemRenderText.item(a);
- chstr = hl->ch;
+ ScText* hl = itemRenderText.item_p(a);
+ chstr = itemRenderText.text(a,1);
if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
|| chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK)
continue;
@@ -268,8 +263,8 @@
hl->glyph.yadvance = 0;
layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
hl->glyph.shrink(); // HACK
- if (hl->hasObject(m_Doc))
- dx = (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH / 2.0;
+ if (itemRenderText.hasObject(a))
+ dx = (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * hl->glyph.scaleH / 2.0;
else
dx = hl->glyph.wide() / 2.0;
CurX += dx;
@@ -358,8 +353,8 @@
p->setPen(cachedStrokeQ, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
}
p->translate(0.0, BaseOffs);
- if (hl->ch == SpecialChars::OBJECT)
- DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), hl->getItem(m_Doc));
+ if (itemRenderText.hasObject(a))
+ DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), itemRenderText.object(a));
else
drawGlyphs(p, itemRenderText.charStyle(a), hl->glyph);
}
@@ -367,14 +362,13 @@
p->restore();
MaxChars = a+1;
CurX -= dx;
- if (hl->hasObject(m_Doc))
- CurX += (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH + extraOffset;
- else if (hl->ch == SpecialChars::BLANK)
- CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + wordExtra + extraOffset;
+ if (itemRenderText.hasObject(a))
+ CurX += (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * hl->glyph.scaleH + extraOffset;
+ else if (chstr[0] == SpecialChars::BLANK)
+ CurX += hl->glyph.wide()+itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0 + wordExtra + extraOffset;
else
- CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + extraOffset;
- }
-#endif
+ CurX += hl->glyph.wide()+itemRenderText.charStyle(a).fontSize() *itemRenderText.charStyle(a).tracking() / 10000.0 + extraOffset;
+ }
}
bool PageItem_PathText::createInfoGroup(QFrame *infoGroup, QGridLayout *infoGroupLayout)
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Fri Oct 4 17:40:08 2013
@@ -5,11 +5,11 @@
for which a new license (GPL+exception) is in place.
*/
/***************************************************************************
- pageitem.cpp - description
- -------------------
- begin : Sat Apr 7 2001
- copyright : (C) 2001 by Franz Schmid
- email : Franz.Schmid at altmuehlnet.de
+ pageitem.cpp - description
+ -------------------
+ begin : Sat Apr 7 2001
+ copyright : (C) 2001 by Franz Schmid
+ email : Franz.Schmid at altmuehlnet.de
***************************************************************************/
/***************************************************************************
@@ -51,7 +51,6 @@
#include "scribusdoc.h"
#include "scribusstructs.h"
#include "selection.h"
-#include "text/nlsconfig.h"
#include "undomanager.h"
#include "undostate.h"
#include "util.h"
@@ -73,7 +72,7 @@
unicodeInputCount = 0;
unicodeInputString = "";
m_origAnnotPos = QRectF(xPos(), yPos(), width(), height());
-
+
connect(&itemText,SIGNAL(changed()), this, SLOT(slotInvalidateLayout()));
}
@@ -86,7 +85,7 @@
unicodeInputString = "";
m_notesFramesMap.clear();
m_origAnnotPos = QRectF(xPos(), yPos(), width(), height());
-
+
connect(&itemText,SIGNAL(changed()), this, SLOT(slotInvalidateLayout()));
}
@@ -287,7 +286,7 @@
}
}
} // for all docItems
- } // if(OnMasterPage.isEmpty()
+ } // if(OnMasterPage.isEmpty()
} // if(!Embedded)
else
qDebug() << "QRegion empty";
@@ -298,7 +297,7 @@
{
if (OnMasterPage.isEmpty())
return;
-
+
QString newShadow = m_Doc->masterPageMode() ? OnMasterPage : QString::number(OwnPage);
if (newShadow != currentShadow) {
if (currentShadow == OnMasterPage) {
@@ -381,8 +380,8 @@
static const bool legacy = true;
/*
-static void layoutDropCap(GlyphLayout layout, double curX, double curY, double offsetX, double offsetY, double dropCapDrop)
-{
+static void layoutDropCap(GlyphLayout layout, double curX, double curY, double offsetX, double offsetY, double dropCapDrop)
+{
}
*/
@@ -395,17 +394,17 @@
double xPos = curLine.x;
for (int ti= curLine.firstItem; ti <= curLine.lastItem; ++ti)
{
- ScText * hl = itemText.item(ti);
- if (hl->ch == SpecialChars::TAB)
- {
- GlyphLayout * tglyph = hl->glyph.more;
-
+ GlyphLayout* glyphs = itemText.getGlyphs(ti);
+ if (itemText.text(ti) == SpecialChars::TAB)
+ {
+ GlyphLayout * tglyph = glyphs->more;
+
if (!tglyph)
continue;
-
+
const CharStyle & charStyle(itemText.charStyle(ti));
double wt = charStyle.font().glyphWidth(tglyph->glyph, charStyle.fontSize() * tglyph->scaleV / 10.0);
- double len = hl->glyph.xadvance;
+ double len = glyphs->xadvance;
int count = static_cast<int>(len / wt);
double sPos = -len;
tglyph->xoffset = sPos;
@@ -420,7 +419,7 @@
tglyph->xoffset = sPos + wt * cx;
}
}
- xPos += hl->glyph.wide();
+ xPos += glyphs->wide();
}
}
@@ -485,8 +484,8 @@
double maxShrink;
double maxStretch;
-
-
+
+
/// remember frame dimensions and offsets
void init(double w, double h, const MarginStruct& extra, double lCorr)
{
@@ -496,7 +495,7 @@
frameHeight = h;
hasDropCap = false;
}
-
+
/// start at column 0
void initColumns(double width, double gap)
{
@@ -504,7 +503,7 @@
colWidth = width;
colGap = gap;
}
-
+
/// move position to next column
void nextColumn(double asce = 0.0)
{
@@ -517,7 +516,7 @@
xPos = colLeft;
yPos = asce + insets.Top + lineCorr;
}
-
+
bool isEndOfCol(double morespace = 0)
{
return yPos + morespace + insets.Bottom + lineCorr > frameHeight;
@@ -547,7 +546,7 @@
rightMargin = 0.0;
rowDesc = 0.0;
}
-
+
/// called when glyphs are placed on the line
void rememberShrinkStretch(QChar ch, double wide, const ParagraphStyle& style)
@@ -568,7 +567,7 @@
{
// only look for the first break behind the right edge
//maxShrink = 0;
-
+
// check if we already have a better break
if (breakIndex >= 0)
{
@@ -589,8 +588,8 @@
breakIndex = last;
breakXPos = line.x;
for (int j = line.firstItem; j <= last; ++j)
- if ( (itemText.item(j)->effects() & ScStyle_SuppressSpace) == 0)
- breakXPos += itemText.item(j)->glyph.wide();
+ if ( !itemText.hasFlag(j, ScLayout_SuppressSpace) )
+ breakXPos += itemText.getGlyphs(j)->wide();
// #8194, #8717 : update line ascent and descent with sensible values
// so that endOfLine() returns correct result
updateHeightMetrics(itemText);
@@ -628,7 +627,7 @@
afterOverflow = false;
return restartIndex -1;
}
-
+
bool isEndOfLine(double moreSpace = 0)
{
bool res;
@@ -638,7 +637,7 @@
res = ceil(xPos - maxShrink) + ceil(moreSpace) >= floor(colRight);
return res;
}
-
+
/// Keep old endOfLine code for reference
/*double endOfLine_old(const QRegion& shape, const QTransform& pf2, double morespace, int Yasc, int Ydesc)
{
@@ -652,7 +651,7 @@
QPoint pt12 (xPos, Yasc);
QPoint pt22 (xPos, Ydesc);
QRect pt(pt12,pt22);
- QRegion region;
+ QRegion region;
double EndX2 = StartX;
double Interval = 0.25;
@@ -693,10 +692,11 @@
{
int cPos = static_cast<int>(ceil(StartX + morespace));
QRect cRect (QPoint(cPos, yAsc), QPoint(cPos, yDesc));
- if (QRegion(cRect).subtracted(shape).isEmpty())
+ QRegion qr2 = QRegion(cRect).subtracted(shape);
+ if (qr2.isEmpty()) // qr2 == 0 <=> cRect subset of shape
{
QRect rect = lineI.rects().at(0);
- double mx = qMax(rect.left(), rect.right()) /*- pf2.dx()*/;
+ double mx = qMax(rect.left(), rect.right()) /*- pf2.dx()*/;
int steps = static_cast<int>((mx - StartX - morespace - 2) / 0.25);
if (steps > 0)
{
@@ -725,7 +725,7 @@
return qMin(EndX2, maxX);
}
-
+
double getLineAscent(const StoryText& itemText)
{
double result = 0;
@@ -793,7 +793,7 @@
}
return result;
}
-
+
double getLineHeight(const StoryText& itemText)
{
double result = 0;
@@ -842,7 +842,7 @@
asce = (itemText.object(line.firstItem+zc)->height() + itemText.object(line.firstItem+zc)->lineWidth()) * scaleV + offset;
desc = 0.0;
}
- else //if (itemText.charStyle(current.line.firstItem+zc).effects() & ScStyle_DropCap == 0)
+ else //if (itemText.charStyle(current.line.firstItem+zc).effects() & ScLayout_DropCap == 0)
{
asce = cStyle.font().realCharAscent(ch, cStyle.fontSize() / 10.0) * scaleV + offset;
desc = cStyle.font().realCharDescent(ch, cStyle.fontSize() / 10.0) * scaleV - offset;
@@ -901,7 +901,7 @@
double lineCorr;
};
-static int checkCJK(QChar ch) {
+static bool checkCJK(QChar ch) {
unsigned int code = ch.unicode();
if ( (0x2E80 < code && code < 0x2EFF) || // CJK Radicals Supplement
(0x3000 < code && code < 0x303F) || // CJK Symbols and Punctuation
@@ -923,50 +923,44 @@
(code == 0x3002) ||
(code == 0x201C) ||
(code == 0x201D))
- return 1;
+ return true;
else
- return 0;
+ return false;
}
-static int checkCJKBreakAfter(QChar ch) {
+static bool allowedCJKBreakAfter(QChar ch) {
unsigned int code[] = {0x201C, 0xFF08, 0xFF3B, 0xFF5B, 0xFF5F, 0xFF62, 0xFF0D, 0};
for (int i = 0; code[i]; ++i)
if (code[i] == ch.unicode())
- return 0;
- return 1;
+ return false;
+ return true;
}
-static int checkCJKBreakBefore(QChar ch) {
+static int allowedCJKBreakBefore(QChar ch) {
unsigned int code[] =
{0x201D, 0x3002, 0xFF01, 0xFF09, 0xFF0C, 0xFF0E, 0xFF1A,
0xFF1B, 0xFF1F, 0xFF3D, 0xFF5D, 0xFF60, 0xFF63, 0xFF64, 0};
for (int i = 0; code[i]; ++i)
if (code[i] == ch.unicode())
- return 0;
- return 1;
+ return false;
+ return true;
}
-static int implicitSpace(ScText *f, ScText *s) {
- if (checkCJK(f->ch) && checkCJK(s->ch))
- return 1;
- else
- return 0;
+static bool implicitSpace(QChar f, QChar s) {
+ return checkCJK(f) && checkCJK(s);
}
-static int implicitBreak(ScText *f, ScText *s) {
- if (checkCJK(f->ch) && checkCJK(s->ch)) {
- if (!checkCJKBreakAfter(f->ch)
- || !checkCJKBreakBefore(s->ch))
- return 0;
- return 1;
+static bool implicitBreak(QChar f, QChar s) {
+ if (checkCJK(f) && checkCJK(s)) {
+ return allowedCJKBreakAfter(f) && allowedCJKBreakBefore(s);
} else
- return 0;
+ return false;
}
/// called when line length is known and line is to be justified
static void justifyLine(StoryText& itemText, LineSpec& line)
{
-
+
double glyphNatural = 0;
double spaceNatural = 0;
double glyphExtension;
@@ -979,18 +973,19 @@
// measure natural widths for glyphs and spaces
for (int sof = line.firstItem; sof <= line.lastItem; ++sof)
{
- ScText* hl = itemText.item(sof);
- if (!SpecialChars::isExpandingSpace(hl->ch))
- {
- glyphNatural += hl->glyph.wide();
- }
- else if ( (hl->effects() & ScStyle_SuppressSpace) == 0)
- {
- spaceNatural += hl->glyph.wide();
- if (imSpace < 0.0 || imSpace > hl->glyph.wide())
- imSpace = hl->glyph.wide();
- }
- if (sof != line.firstItem && implicitSpace(itemText.item(sof - 1), hl)) {
+ GlyphLayout* glyph = itemText.getGlyphs(sof);
+ QChar ch = itemText.text(sof);
+ if (!SpecialChars::isExpandingSpace(ch))
+ {
+ glyphNatural += glyph->wide();
+ }
+ else if ( !itemText.hasFlag(sof, ScLayout_SuppressSpace) )
+ {
+ spaceNatural += glyph->wide();
+ if (imSpace < 0.0 || imSpace > glyph->wide())
+ imSpace = glyph->wide();
+ }
+ if (sof != line.firstItem && implicitSpace(itemText.text(sof - 1), ch)) {
spaceInsertion += 1;
}
}
@@ -998,7 +993,7 @@
imSpace /= 2;
// decision: prio 1: stretch glyph; prio 2: insert spaces; prio 3: stretch spaces
-
+
if (line.width < spaceNatural + glyphNatural * style.minGlyphExtension() && spaceNatural > 0)
{
glyphExtension = style.minGlyphExtension() - 1;
@@ -1035,28 +1030,28 @@
spaceExtension = 0;
}
}
-
+
double glyphScale = 1 + glyphExtension;
-
+
/*
qDebug() << QString("justify: line = %7 natural = %1 + %2 = %3 (%4); spaces + %5%%; min=%8; glyphs + %6%%; min=%9")
.arg(spaceNatural).arg(glyphNatural).arg(spaceNatural+glyphNatural).arg(line.naturalWidth)
.arg(spaceExtension).arg(glyphExtension).arg(line.width)
.arg(style.minWordTracking()).arg(style.minGlyphExtension());
*/
-
+
int startItem = line.firstItem;
- if (itemText.item(startItem)->effects() & ScStyle_DropCap)
+ if (itemText.hasFlag(startItem, ScLayout_DropCap))
startItem++;
// distribute whitespace on spaces and glyphs
for (int yof = startItem; yof <= line.lastItem; ++yof)
{
- ScText* hl = itemText.item(yof);
- double wide = hl->glyph.wide();
- if (!SpecialChars::isExpandingSpace(hl->ch))
- {
- hl->glyph.last()->xadvance += wide * glyphExtension;
- GlyphLayout* glyph = &(hl->glyph);
+ GlyphLayout* glyph = itemText.getGlyphs(yof);
+ QChar ch = itemText.text(yof);
+ double wide = glyph->wide();
+ if (!SpecialChars::isExpandingSpace(ch))
+ {
+ glyph->last()->xadvance += wide * glyphExtension;
while (glyph)
{
glyph->xoffset *= glyphScale;
@@ -1064,12 +1059,12 @@
glyph = glyph->more;
}
}
- else if ((hl->effects() & ScStyle_SuppressSpace) == 0)
- {
- hl->glyph.last()->xadvance += wide * spaceExtension;
- }
- if (yof != line.firstItem && implicitSpace(itemText.item(yof - 1), hl)) {
- itemText.item(yof - 1)->glyph.last()->xadvance += imSpace;
+ else if (!itemText.hasFlag(yof, ScLayout_SuppressSpace))
+ {
+ glyph->last()->xadvance += wide * spaceExtension;
+ }
+ if (yof != line.firstItem && implicitSpace(itemText.text(yof - 1), ch)) {
+ itemText.getGlyphs(yof - 1)->last()->xadvance += imSpace;
}
}
}
@@ -1094,9 +1089,9 @@
//static double opticalLeftMargin(const StoryText& itemText, const LineSpec& line)
//{
// int b = line.firstItem;
-// while (b < line.lastItem && (itemText.item(b)->effects() & ScStyle_SuppressSpace))
+// while (b < line.lastItem && (itemText.item(b)->effects() & ScLayout_SuppressSpace))
// ++b;
-//
+//
// double chs = itemText.charStyle(b).fontSize() * (itemText.charStyle(b).scaleH() / 1000.0);
// QChar chr = itemText.text(b);
// double leftCorr = itemText.charStyle(b).font().realCharWidth(chr, chs / 10.0);
@@ -1116,7 +1111,7 @@
// || chr == QChar(0x201d) // quote 99
// || chr == QChar(0x201e) // lower quote 99
// || chr == QChar(0x201f) // upper reversed 99
-// )
+// )
// leftCorr *= -0.5;
// else {
// leftCorr = itemText.charStyle(b).font().charWidth(QChar(' '), chs / 10.0, chr);
@@ -1132,15 +1127,15 @@
static double opticalRightMargin(const StoryText& itemText, const LineSpec& line)
{
int b = line.lastItem;
- while (b > line.firstItem &&
+ while (b > line.firstItem &&
(SpecialChars::isBreakingSpace(itemText.text(b)) || SpecialChars::isBreak(itemText.text(b)))
)
--b;
- if (b >= line.firstItem)
+ if (b >= line.firstItem)
{
const CharStyle& chStyle(itemText.charStyle(b));
double chs = chStyle.fontSize() * (chStyle.scaleH() / 1000.0);
- QChar chr = (itemText.item(b)->effects() & ScStyle_SoftHyphenVisible) ?
+ QChar chr = itemText.hasFlag(b, ScLayout_SoftHyphenVisible) ?
QChar('-') : itemText.text(b);
double rightCorr = chStyle.font().realCharWidth(chr, chs / 10.0);
if (QString("-,.`´'~").indexOf(chr) >= 0
@@ -1303,7 +1298,7 @@
}
}
-void PageItem_TextFrame::layout()
+void PageItem_TextFrame::layout()
{
// qDebug()<<"==Layout==" << itemName() ;
// printBacktrace(24);
@@ -1331,21 +1326,22 @@
}
if (invalid && BackBox == NULL)
firstChar = 0;
-
+
// qDebug() << QString("textframe(%1,%2): len=%3, start relayout at %4").arg(Xpos).arg(Ypos).arg(itemText.length()).arg(firstInFrame());
QPoint pt1, pt2;
QRect pt;
double chs, chsd = 0;
double EndX, OFs, wide, kernVal;
QString chstr;
- ScText *hl;
+ QChar currentCh;
+ GlyphLayout* glyphs;
ParagraphStyle style;
int opticalMargins = ParagraphStyle::OM_None;
-
+
bool outs = false;
bool goNoRoom = false;
bool goNextColumn = false;
-
+
TabControl tabs;
tabs.active = false; // RTab
tabs.status = TabNONE; // TabCode
@@ -1354,7 +1350,7 @@
QList<ParagraphStyle::TabRecord> tTabValues;
tTabValues.clear();
-
+
bool BulNumMode = false; //when bullet or counter should be inserted
bool DropCmode = false, FlopBaseline = false;
double desc=0, asce=0, realAsce=0, realDesc = 0, offset = 0;
@@ -1362,7 +1358,7 @@
double DropCapDrop = 0;
int DropLines = 0;
int DropLinesCount = 0;
-
+
itemText.clearLines();
incompleteLines = 0;
incompletePositions.clear();
@@ -1370,7 +1366,7 @@
double lineCorr = 0;
if (lineColor() != CommonStrings::None)
lineCorr = m_lineWidth / 2.0;
-
+
// TODO: refactor this into PageItem
MarginStruct savedTextDistanceMargins(m_textDistanceMargins);
@@ -1382,11 +1378,11 @@
//hold Y position of last computed line of text (with glyphs descent)
//for moving next line if glyphs are higher than that
double lastLineY = 0;
-
+
QMap<int, Mark*> noteMarksPosMap; //maping notes marks and its position in text
// dump styles
-/*
+/*
for (int i=0; i < itemText.nrOfParagraphs(); ++i) {
const ParagraphStyle& pstyle(itemText.paragraphStyle(itemText.endOfParagraph(i)));
qDebug("par %d:", i);
@@ -1395,7 +1391,7 @@
qDebug() << "default:";
dumpIt(itemText.defaultStyle());
*/
-
+
setShadow();
int itLen = itemText.length();
//fast validate empty frames
@@ -1432,7 +1428,7 @@
MaxChars = firstInFrame();
goto NoRoom;
}
-
+
if (imageFlippedH() || imageFlippedV())
{
QTransform matrix;
@@ -1448,7 +1444,7 @@
}
m_availableRegion = matrix.map(m_availableRegion);
}
-
+
current.nextColumn();
lastLineY = m_textDistanceMargins.Top;
@@ -1458,7 +1454,7 @@
// find start of first line
if (firstInFrame() < itLen)
{
- hl = itemText.item(firstInFrame());
+ CharStyle cstyle = itemText.charStyle(firstInFrame());
style = itemText.paragraphStyle(firstInFrame());
style.setLineSpacing (calculateLineSpacing (style, this));
@@ -1468,9 +1464,9 @@
{
chs = calculateLineSpacing (style, this) * style.dropCapLines() * 10;
}
- else
- chs = hl->fontSize();
- desc = -hl->font().descent(chs / 10.0);
+ else
+ chs = cstyle.fontSize();
+ desc = -cstyle.font().descent(chs / 10.0);
current.yPos = m_textDistanceMargins.Top + lineCorr;
// qDebug() << QString("first line at y=%1").arg(current.yPos);
}
@@ -1509,37 +1505,41 @@
for (int a = firstInFrame(); a < itLen; ++a)
{
- hl = itemText.item(a);
- bool HasObject = hl->hasObject(m_Doc);
- bool HasMark = hl->hasMark();
+ currentCh = itemText.text(a);
+ glyphs = itemText.getGlyphs(a);
+ bool HasObject = itemText.hasObject(a);
+ PageItem* currentObject = HasObject? itemText.object(a): NULL;
+ bool HasMark = itemText.hasMark(a);
+ Mark* mark = itemText.mark(a);
+
if (HasMark)
{
//show control characters for marks
- hl->glyph.glyph = SpecialChars::OBJECT.unicode() + ScFace::CONTROL_GLYPHS;
-
- hl->mark->OwnPage = OwnPage;
+ glyphs->glyph = SpecialChars::OBJECT.unicode() + ScFace::CONTROL_GLYPHS;
+
+ mark->OwnPage = OwnPage;
//itemPtr and itemName set to this frame only if mark type is different than MARK2ItemType
- if (!hl->mark->isType(MARK2ItemType))
- {
- hl->mark->setItemPtr(this);
- hl->mark->setItemName(itemName());
+ if (!mark->isType(MARK2ItemType))
+ {
+ mark->setItemPtr(this);
+ mark->setItemName(itemName());
}
//anchors and indexes has no visible inserts in text
- if (hl->mark->isType(MARKAnchorType) || hl->mark->isType(MARKIndexType))
- {
- hl->glyph.shrink();
+ if (mark->isType(MARKAnchorType) || mark->isType(MARKIndexType))
+ {
+ glyphs->shrink();
continue;
}
//store mark pointer and position in text
- if (hl->mark->isType(MARKNoteMasterType))
- noteMarksPosMap.insert(a, hl->mark);
+ if (mark->isType(MARKNoteMasterType))
+ noteMarksPosMap.insert(a, mark);
//set note marker charstyle
- if (hl->mark->isNoteType())
- {
- TextNote* note = hl->mark->getNotePtr();
+ if (mark->isNoteType())
+ {
+ TextNote* note = mark->getNotePtr();
if (note == NULL)
continue;
- hl->mark->setItemPtr(this);
+ mark->setItemPtr(this);
NotesStyle* nStyle = note->notesStyle();
Q_ASSERT(nStyle != NULL);
QString chsName = nStyle->marksChStyle();
@@ -1555,20 +1555,23 @@
}
else
itemText.eraseCharStyle(a, 1, newStyle);
- if (hl->mark->isType(MARKNoteMasterType))
+
+ CharStyle haveSuperscript;
+ if (mark->isType(MARKNoteMasterType))
{
if (nStyle->isSuperscriptInMaster())
- hl->setEffects(hl->effects() | ScStyle_Superscript);
+ haveSuperscript.setEffects(haveSuperscript.effects() | ScStyle_Superscript);
else
- hl->setEffects(hl->effects() & ~ScStyle_Superscript);
+ haveSuperscript.setEffects(haveSuperscript.effects() & ~ScStyle_Superscript);
}
else
{
if (nStyle->isSuperscriptInNote())
- hl->setEffects(hl->effects() | ScStyle_Superscript);
+ haveSuperscript.setEffects(haveSuperscript.effects() | ScStyle_Superscript);
else
- hl->setEffects(hl->effects() & ~ScStyle_Superscript);
- }
+ haveSuperscript.setEffects(haveSuperscript.effects() & ~ScStyle_Superscript);
+ }
+ itemText.applyCharStyle(a, 1, haveSuperscript);
}
}
BulNumMode = false;
@@ -1579,7 +1582,7 @@
if (style.hasBullet() || style.hasNum())
{
BulNumMode = true;
- if (hl->mark == NULL || !hl->mark->isType(MARKBullNumType))
+ if (mark == NULL || !mark->isType(MARKBullNumType))
{
BulNumMark* bnMark = new BulNumMark();
itemText.insertMark(bnMark,a);
@@ -1588,21 +1591,19 @@
continue;
}
if (style.hasBullet())
- hl->mark->setString(style.bulletStr());
+ mark->setString(style.bulletStr());
else if (style.hasNum())
{
- if (hl->mark->getString().isEmpty())
+ if (mark->getString().isEmpty())
{
- hl->mark->setString("?");
+ mark->setString("?");
m_Doc->flag_Renumber = true;
}
}
}
}
- if (!BulNumMode && hl->mark && hl->mark->isType(MARKBullNumType))
- {
- delete (BulNumMark*) hl->mark;
- hl->mark = NULL;
+ if (!BulNumMode && mark && mark->isType(MARKBullNumType))
+ {
itemText.removeChars(a,1);
a--;
itLen = itemText.length();
@@ -1610,14 +1611,13 @@
}
if (current.itemsInLine == 0)
opticalMargins = style.opticalMargins();
- CharStyle charStyle = ((hl->ch != SpecialChars::PARSEP) ? itemText.charStyle(a) : style.charStyle());
+ CharStyle charStyle = ((itemText.text(a) != SpecialChars::PARSEP) ? itemText.charStyle(a) : style.charStyle());
chstr = ExpandToken(a);
int chstrLen = chstr.length();
if (chstr.isEmpty())
chstr = SpecialChars::ZWNBSPACE;
- curStat = SpecialChars::getCJKAttr(hl->ch);
-
+ curStat = SpecialChars::getCJKAttr(currentCh);
//set style for paragraph effects
if (a == 0 || itemText.text(a-1) == SpecialChars::PARSEP)
{
@@ -1655,7 +1655,7 @@
{
if (a == 0 || itemText.text(a-1) == SpecialChars::PARSEP)
{
- if (chstr[0] != SpecialChars::PARSEP)
+ if (currentCh != SpecialChars::PARSEP)
{
DropCmode = style.hasDropCap();
if (DropCmode)
@@ -1668,43 +1668,39 @@
const ScFace font = charStyle.font();
- { // local block for 'fl'
- StyleFlag fl = hl->effects();
- fl &= ~ScStyle_DropCap;
- fl &= ~ScStyle_SoftHyphenVisible;
- hl->setEffects(fl);
- }
-
- // No space at begin of line,
+ itemText.clearFlag(a, ScLayout_DropCap);
+ itemText.clearFlag(a, ScLayout_SoftHyphenVisible);
+
+ // No space at begin of line,
if (legacy)
{
// unless at begin of par (eeks)
- if ( (current.itemsInLine == 0) && (SpecialChars::isBreakingSpace(hl->ch))
+ if ( (current.itemsInLine == 0) && (SpecialChars::isBreakingSpace(currentCh))
&& (a > 0 && ! SpecialChars::isBreak(itemText.text(a-1)))
- && ! (a > 0 && SpecialChars::isBreakingSpace(itemText.text(a-1))
- && (itemText.charStyle(a-1).effects() & ScStyle_SuppressSpace) != ScStyle_SuppressSpace))
- {
- hl->setEffects(hl->effects() | ScStyle_SuppressSpace);
- hl->glyph.xadvance = 0;
+ && ! (a > 0 && SpecialChars::isBreakingSpace(itemText.text(a-1))
+ && (!itemText.hasFlag(a-1, ScLayout_SuppressSpace))))
+ {
+ itemText.setFlag(a, ScLayout_SuppressSpace);
+ glyphs->xadvance = 0;
continue;
}
else
- hl->setEffects(hl->effects() & ~ScStyle_SuppressSpace);
+ itemText.clearFlag(a, ScLayout_SuppressSpace);
}
else // from 134 on use NBSPACE for this effect
{
- if ( current.itemsInLine == 0 && (SpecialChars::isBreakingSpace(hl->ch) || hl->ch.isSpace()))
- {
- hl->setEffects(hl->effects() | ScStyle_SuppressSpace);
- hl->glyph.xadvance = 0;
+ if ( current.itemsInLine == 0 && (SpecialChars::isBreakingSpace(currentCh) || currentCh.isSpace()))
+ {
+ itemText.setFlag(a, ScLayout_SuppressSpace);
+ glyphs->xadvance = 0;
continue;
}
else
- hl->setEffects(hl->effects() & ~ScStyle_SuppressSpace);
+ itemText.clearFlag(a, ScLayout_SuppressSpace);
}
if (current.itemsInLine == 0)
{
- if (style.rightMargin() == 0)
+ if (style.rightMargin() == 0)
{
//addLine = true;
current.rightMargin = 0.0;
@@ -1746,7 +1742,7 @@
// ScFace::realCharHeight()/Ascent() ensure font is loaded thanks to an indirect call to char2CMap()
// ScFace::ascent() can be called safely afterwards
- //text height, width, ascent and descent should be calculated for whole text provided by hl in current position
+ //text height, width, ascent and descent should be calculated for whole text provided by ScText in current position
//and that may be more than one char (variable text for example)
double realCharHeight = 0.0, realCharAscent = 0.0;
for (int i = 0; i < chstrLen; ++i)
@@ -1754,72 +1750,71 @@
realCharHeight = qMax(realCharHeight, font.realCharHeight(chstr[i], 1));
realCharAscent = qMax(realCharAscent, font.realCharAscent(chstr[i], 1));
}
- double fontAscent = font.ascent(style.charStyle().fontSize() / 10.0);
+ double fontAscent = font.ascent(style.charStyle().fontSize() / 10.0);
if (realCharHeight == 0.0)
realCharHeight = font.height(style.charStyle().fontSize() / 10.0);
if (realCharAscent == 0.0)
realCharAscent = fontAscent;
chsd = (10 * ((DropCapDrop + fontAscent) / realCharHeight));
chs = (10 * ((DropCapDrop + fontAscent) / realCharAscent));
- hl->setEffects(hl->effects() | ScStyle_DropCap);
- hl->glyph.yoffset -= DropCapDrop;
+ itemText.setFlag(a, ScLayout_DropCap);
+ glyphs->yoffset -= DropCapDrop;
if (HasObject)
{
- chs = qRound((hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * 10);
- chsd = qRound((hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * 10);
+ chs = qRound((currentObject->height() + currentObject->lineWidth()) * 10);
+ chsd = qRound((currentObject->height() + currentObject->lineWidth()) * 10);
}
}
else // ! dropCapMode
{
if (HasObject)
- chs = qRound((hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * 10);
+ chs = qRound((currentObject->height() + currentObject->lineWidth()) * 10);
else
chs = charStyle.fontSize();
}
// set StartOfLine (and find tracking?)
if (current.itemsInLine == 0)
{
- hl->setEffects(hl->effects() | ScStyle_StartOfLine);
+ itemText.setFlag(a, ScLayout_StartOfLine);
kernVal = 0;
}
else
{
kernVal = 0; // chs * charStyle.tracking() / 10000.0;
- itemText.item(a)->setEffects(itemText.item(a)->effects() & ~ScStyle_StartOfLine);
- }
- hl->glyph.yadvance = 0;
- layoutGlyphs(*hl, chstr, hl->glyph);
-
+ itemText.clearFlag(a, ScLayout_StartOfLine);
+ }
+ glyphs->yadvance = 0;
+ layoutGlyphs(charStyle, chstr, *glyphs);
+
// find out width, ascent and descent of char
if (HasObject)
{
- wide = hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth();
- hl->glyph.xadvance = wide * hl->glyph.scaleH;
+ wide = currentObject->width() + currentObject->lineWidth();
+ glyphs->xadvance = wide * glyphs->scaleH;
}
else
{
- wide = hl->glyph.wide();
+ wide = glyphs->wide();
// apply kerning
if (a+1 < itemText.length())
{
uint glyph2 = font.char2CMap(itemText.text(a+1));
- double kern= font.glyphKerning(hl->glyph.last()->glyph, glyph2, chs / 10.0) * hl->glyph.scaleH;
+ double kern= font.glyphKerning(glyphs->last()->glyph, glyph2, chs / 10.0) * glyphs->scaleH;
wide += kern;
- hl->glyph.last()->xadvance += kern;
+ glyphs->last()->xadvance += kern;
// change xadvance, xoffset according to JIS X4051
- ScText *hl2 = itemText.item(a+1);
- int nextStat = SpecialChars::getCJKAttr(hl2->ch);
+ int nextStat = SpecialChars::getCJKAttr(itemText.text(a+1));
int prevStat;
if(curStat != 0)
{ // current char is CJK
- if(nextStat == 0 && !SpecialChars::isBreakingSpace(hl2->ch)){
+ if(nextStat == 0 && !SpecialChars::isBreakingSpace(itemText.text(a+1))){
switch(curStat & SpecialChars::CJK_CHAR_MASK){
case SpecialChars::CJK_KANJI:
case SpecialChars::CJK_KANA:
case SpecialChars::CJK_NOTOP:
kern = wide / 4;
wide += kern;
- hl->glyph.last()->xadvance += kern;
+ glyphs->last()->xadvance += kern;
}
} else { // next char is CJK, too
switch(curStat & SpecialChars::CJK_CHAR_MASK){
@@ -1832,7 +1827,7 @@
case SpecialChars::CJK_MIDPOINT:
kern = -wide / 2;
wide += kern;
- hl->glyph.last()->xadvance += kern;
+ glyphs->last()->xadvance += kern;
}
break;
case SpecialChars::CJK_COMMA:
@@ -1842,7 +1837,7 @@
case SpecialChars::CJK_FENCE_END:
kern = -wide / 2;
wide += kern;
- hl->glyph.last()->xadvance += kern;
+ glyphs->last()->xadvance += kern;
}
break;
case SpecialChars::CJK_MIDPOINT:
@@ -1850,35 +1845,34 @@
case SpecialChars::CJK_FENCE_BEGIN:
kern = -wide / 2;
wide += kern;
- hl->glyph.last()->xadvance += kern;
+ glyphs->last()->xadvance += kern;
}
break;
case SpecialChars::CJK_FENCE_BEGIN:
if(a == current.line.firstItem){ // first char of the line
prevStat = SpecialChars::CJK_FENCE_BEGIN;
} else {
- hl2 = itemText.item(a-1);
- prevStat = SpecialChars::getCJKAttr(hl2->ch) & SpecialChars::CJK_CHAR_MASK;
+ prevStat = SpecialChars::getCJKAttr(itemText.text(a-1)) & SpecialChars::CJK_CHAR_MASK;
}
if(prevStat == SpecialChars::CJK_FENCE_BEGIN){
kern = -wide / 2;
wide += kern;
- hl->glyph.last()->xadvance += kern;
- hl->glyph.last()->xoffset += kern;
+ glyphs->last()->xadvance += kern;
+ glyphs->last()->xoffset += kern;
}
break;
}
}
} else { // current char is not CJK
- if(nextStat != 0 && !SpecialChars::isBreakingSpace(hl->ch)){
+ if(nextStat != 0 && !SpecialChars::isBreakingSpace(currentCh)){
switch(nextStat & SpecialChars::CJK_CHAR_MASK){
case SpecialChars::CJK_KANJI:
case SpecialChars::CJK_KANA:
case SpecialChars::CJK_NOTOP:
- kern = hl2->glyph.wide() / 4;
+ kern = itemText.getGlyphs(a+1)->wide() / 4;
wide += kern;
- hl->glyph.last()->xadvance += kern;
+ glyphs->last()->xadvance += kern;
}
}
}
@@ -1889,15 +1883,15 @@
// drop caps are wider...
if (HasObject)
{
- double itemHeight = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
+ double itemHeight = currentObject->height() + currentObject->lineWidth();
if (itemHeight == 0)
itemHeight = font.height(style.charStyle().fontSize() / 10.0);
- wide = hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth();
- asce = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
+ wide = currentObject->width() + currentObject->lineWidth();
+ asce = currentObject->height() + currentObject->lineWidth();
realAsce = calculateLineSpacing (style, this) * DropLines;
- hl->glyph.scaleH /= hl->glyph.scaleV;
- hl->glyph.scaleV = (realAsce / itemHeight);
- hl->glyph.scaleH *= hl->glyph.scaleV;
+ glyphs->scaleH /= glyphs->scaleV;
+ glyphs->scaleV = (realAsce / itemHeight);
+ glyphs->scaleH *= glyphs->scaleV;
}
else
{
@@ -1915,20 +1909,20 @@
realCharHeight = font.height(style.charStyle().fontSize() / 10.0);
asce = font.ascent(hlcsize10);
// qDebug() QString("dropcaps pre: chsd=%1 realCharHeight = %2 chstr=%3").arg(chsd).arg(asce).arg(chstr2[0]);
- hl->glyph.scaleH /= hl->glyph.scaleV;
- hl->glyph.scaleV = (realAsce / realCharHeight);
- hl->glyph.scaleH *= hl->glyph.scaleV;
- hl->glyph.xoffset -= 0.5; //drop caps are always to far from column left edge
- }
- hl->glyph.xadvance = wide;
+ glyphs->scaleH /= glyphs->scaleV;
+ glyphs->scaleV = (realAsce / realCharHeight);
+ glyphs->scaleH *= glyphs->scaleV;
+ glyphs->xoffset -= 0.5; //drop caps are always to far from column left edge
+ }
+ glyphs->xadvance = wide;
desc = realDesc =0;
}
else // !DropCMode
{
- if (SpecialChars::isExpandingSpace(hl->ch))
+ if (SpecialChars::isExpandingSpace(currentCh))
{
double wordtracking = charStyle.wordTracking();
- hl->glyph.xadvance *= wordtracking;
+ glyphs->xadvance *= wordtracking;
wide *= wordtracking;
}
// find ascent / descent
@@ -1945,11 +1939,11 @@
}
realDesc = realDesc * scaleV - offset;
desc = -font.descent(hlcsize10);
- current.rememberShrinkStretch(hl->ch, wide, style);
+ current.rememberShrinkStretch(currentCh, wide, style);
}
if (HasObject)
{
- asce = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
+ asce = currentObject->height() + currentObject->lineWidth();
realAsce = asce * scaleV + offset;
}
else
@@ -2070,10 +2064,16 @@
maxYAsc = qMax(maxYAsc, 0.0);
maxYDesc = current.yPos + realDesc;
-// regionMinY = static_cast<int>(floor(maxYAsc));
-// regionMaxY = static_cast<int>(floor(maxYDesc));
- regionMinY = qMax(0, static_cast<int>(floor(current.yPos - (asce + offset))));
- regionMaxY = static_cast<int>(floor(current.yPos + desc));
+ if (true||style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
+ {
+ regionMinY = static_cast<int>(floor(maxYAsc));
+ regionMaxY = static_cast<int>(floor(maxYDesc));
+ }
+ else // #11727, #11628, etc.
+ {
+ regionMinY = static_cast<int>(qMax(0.0, floor(current.yPos - (asce + offset))));
+ regionMaxY = static_cast<int>(floor(current.yPos + desc));
+ }
if (current.itemsInLine == 0 && !current.afterOverflow)
{
@@ -2089,11 +2089,11 @@
double Xpos, Xend;
bool done = false;
bool newColumn = false;
-
+
//FIX ME - that should be paragraph style`s properties
//if set then indent is add to possible line start point (after overflow)
//if not then indent is calculated from column left edge
- //if you dont agree that adding indent to overflow should be default behaviour
+ //if you dont agree that adding indent to overflow should be default behaviour
//then change it to false
bool addIndent2overflow = false; // should be addIndent2Overflow = style.addIndent2Overlow();
bool addFirstIndent2overflow = true; // should be addFirstIndent2Overflow = style.addFirstIndent2Overlow();
@@ -2162,10 +2162,16 @@
maxYAsc = current.yPos - realAsce;
maxYDesc = current.yPos + realDesc;
-// regionMinY = static_cast<int>(floor(maxYAsc));
-// regionMaxY = static_cast<int>(floor(maxYDesc));
- regionMinY = qMax(0,static_cast<int>(floor(current.yPos - (asce + offset))));
- regionMaxY = static_cast<int>(floor(current.yPos + desc));
+ if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
+ {
+ regionMinY = static_cast<int>(floor(maxYAsc));
+ regionMaxY = static_cast<int>(floor(maxYDesc));
+ }
+ else // #11727, #11628, etc.
+ {
+ regionMinY = static_cast<int>(qMax(0.0, floor(current.yPos - (asce + offset))));
+ regionMaxY = static_cast<int>(floor(current.yPos + desc));
+ }
pt.moveTopLeft(QPoint(static_cast<int>(floor(current.xPos)), regionMinY));
done = false;
@@ -2202,10 +2208,10 @@
}
//check if line must start at new Y position due to current glyph height or previous line descent
- if (!SpecialChars::isBreak(hl->ch, true)
- && !SpecialChars::isBreakingSpace(hl->ch)
- && !SpecialChars::isExpandingSpace(hl->ch)
- && hl->ch != SpecialChars::TAB)
+ if (!SpecialChars::isBreak(currentCh, true)
+ && !SpecialChars::isBreakingSpace(currentCh)
+ && !SpecialChars::isExpandingSpace(currentCh)
+ && currentCh != SpecialChars::TAB)
{
double diff = 0;
if (current.startOfCol || DropCmode)
@@ -2213,14 +2219,14 @@
else if (style.lineSpacingMode() != ParagraphStyle::FixedLineSpacing)
{
if (HasObject)
- diff = (hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
+ diff = (currentObject->height() + currentObject->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
else
diff = font.realCharAscent(QChar('l'), hlcsize10) * scaleV + offset - (current.yPos - lastLineY);
}
else
{
if (HasObject)
- diff = (hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
+ diff = (currentObject->height() + currentObject->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
}
if (diff >= 1 || (!DropCmode && diff > 0))
{
@@ -2265,14 +2271,14 @@
// right tab stuff
if (tabs.active)
{
- if (((hl->ch == '.') && (tabs.status == TabPOINT)) || ((hl->ch == ',') && (tabs.status == TabCOMMA)) || (hl->ch == SpecialChars::TAB))
+ if (((currentCh == '.') && (tabs.status == TabPOINT)) || ((currentCh == ',') && (tabs.status == TabCOMMA)) || (currentCh == SpecialChars::TAB))
{
tabs.active = false;
tabs.status = TabNONE;
}
}
// tab positioning
- if (hl->ch == SpecialChars::TAB)
+ if (currentCh == SpecialChars::TAB)
{
wide = 1;
if (tabs.active)
@@ -2311,36 +2317,36 @@
// remember fill char
if (!tabs.fillChar.isNull()) {
- hl->glyph.growWithTabLayout();
- TabLayout * tglyph = dynamic_cast<TabLayout*>(hl->glyph.more);
+ glyphs->growWithTabLayout();
+ TabLayout * tglyph = dynamic_cast<TabLayout*>(glyphs->more);
if (tglyph)
{
tglyph->fillChar = tabs.fillChar;
tglyph->glyph = font.char2CMap(tabs.fillChar);
- tglyph->yoffset = hl->glyph.yoffset;
+ tglyph->yoffset = glyphs->yoffset;
tglyph->scaleV = tglyph->scaleH = chs / charStyle.fontSize();
tglyph->xadvance = 0;
}
}
}
current.xPos -= (legacy ? 1.0 : 0.0);
- hl->glyph.xadvance = current.xPos + wide + kernVal - tabs.xPos;
+ glyphs->xadvance = current.xPos + wide + kernVal - tabs.xPos;
// wide = current.xPos - RTabX;
tabs.charIndex = a;
}
}
-
+
// remember y pos
if (DropCmode)
{
double yoffset = 0.0;
for (int i = 0; i < chstrLen; ++i)
yoffset = qMax(yoffset, font.realCharHeight(chstr[i], chsd / 10.0) - font.realCharAscent(chstr[i], chsd / 10.0));
- hl->glyph.yoffset -= yoffset;
+ glyphs->yoffset -= yoffset;
}
// remember x pos
double breakPos = current.xPos;
-
+
if (!tabs.active) // normal case
{
current.xPos += wide+kernVal;
@@ -2350,19 +2356,19 @@
current.xPos += (wide+kernVal) / 2;
current.xPos = qMax(current.xPos, current.colLeft);
}
- else // other tabs.active
+ else // other tabs.active
{
current.xPos = qMax(current.xPos, current.colLeft);
- }
+ }
// remember possible break
- if ( (SpecialChars::isBreakingSpace(hl->ch) || hl->ch == SpecialChars::TAB))
+ if ( (SpecialChars::isBreakingSpace(currentCh) || currentCh == SpecialChars::TAB))
{
if ( a == firstInFrame() || !SpecialChars::isBreakingSpace(itemText.text(a-1)) )
{
current.rememberBreak(a, breakPos, style.rightMargin());
}
}
- if (hl->hasObject(m_Doc))
+ if (HasObject)
current.rememberBreak(a, breakPos, style.rightMargin());
// CJK break
if(a > current.line.firstItem)
@@ -2391,15 +2397,15 @@
double overflowWidth = 0.0;
double hyphWidth = 0.0;
bool inOverflow = false;
- if (hl->effects() & ScStyle_HyphenationPossible || hl->ch == SpecialChars::SHYPHEN)
+ if (itemText.hasFlag(a,ScLayout_HyphenationPossible) || currentCh == SpecialChars::SHYPHEN)
hyphWidth = font.charWidth('-', hlcsize10) * (charStyle.scaleH() / 1000.0);
- if ((current.isEndOfLine(style.rightMargin() + hyphWidth)) || current.isEndOfCol(realDesc) || SpecialChars::isBreak(hl->ch, Cols > 1) || (current.xPos - current.maxShrink + hyphWidth) >= current.mustLineEnd)
+ if ((current.isEndOfLine(style.rightMargin() + hyphWidth)) || current.isEndOfCol(realDesc) || SpecialChars::isBreak(currentCh, Cols > 1) || (current.xPos - current.maxShrink + hyphWidth) >= current.mustLineEnd)
{
//end of row reached - right column, end of column, break char or line must end
- if (current.itemsInLine == 0 && !current.afterOverflow && !SpecialChars::isBreak(hl->ch, Cols > 1))
+ if (current.itemsInLine == 0 && !current.afterOverflow && !SpecialChars::isBreak(currentCh, Cols > 1))
{
//no glyphs in line, so start new row
- if (SpecialChars::isBreak(hl->ch, Cols > 1))
+ if (SpecialChars::isBreak(currentCh, Cols > 1))
current.restartRowIndex = a +1;
a = current.restartRow(true);
inOverflow = false;
@@ -2408,16 +2414,16 @@
}
//there we have some glyphs
if (current.breakIndex < 0)
- {
- //force break
- if (!SpecialChars::isBreak(hl->ch, Cols > 1))
+ {
+ //force break
+ if (!SpecialChars::isBreak(currentCh, Cols > 1))
{
//force line end at previouse glyph
a--;
current.mustLineEnd = current.line.x;
}
current.breakLine(itemText, style, firstLineOffset(),a);
- }
+ }
if (!current.addLine && !current.lastInRowLine && current.afterOverflow)
{
//we reach right edge of column
@@ -2459,10 +2465,10 @@
charEnd = static_cast<int>(ceil(current.xPos - current.maxShrink));
}
if (legacy &&
- (((hl->ch == '-' || (hl->effects() & ScStyle_HyphenationPossible)) && (current.hyphenCount < m_Doc->hyphConsecutiveLines() || m_Doc->hyphConsecutiveLines() == 0))
- || hl->ch == SpecialChars::SHYPHEN))
- {
- if (hl->effects() & ScStyle_HyphenationPossible || hl->ch == SpecialChars::SHYPHEN)
+ (((currentCh == '-' || itemText.hasFlag(a, ScLayout_HyphenationPossible)) && (current.hyphenCount < m_Doc->hyphConsecutiveLines() || m_Doc->hyphConsecutiveLines() == 0))
+ || currentCh == SpecialChars::SHYPHEN))
+ {
+ if (itemText.hasFlag(a, ScLayout_HyphenationPossible) || currentCh == SpecialChars::SHYPHEN)
{
pt1 = QPoint(charStart, regionMinY);
pt2 = QPoint(static_cast<int>(charEnd + hyphWidth), regionMaxY -1);
@@ -2473,10 +2479,10 @@
pt2 = QPoint(charEnd, regionMaxY -1);
}
}
- else if (!legacy && SpecialChars::isBreakingSpace(hl->ch))
- {
- pt1 = QPoint(static_cast<int>(qMax(floor(breakPos - current.maxShrink - (style.minGlyphExtension() * wide)),0.0)), static_cast<int>(floor(maxYAsc)));
- pt2 = QPoint(charEnd, static_cast<int>(floor(maxYDesc)) -1);
+ else if (!legacy && SpecialChars::isBreakingSpace(currentCh))
+ {
+ pt1 = QPoint(static_cast<int>(qMax(floor(breakPos - current.maxShrink - (style.minGlyphExtension() * wide)),0.0)), regionMinY);
+ pt2 = QPoint(charEnd, regionMaxY -1);
}
else
{
@@ -2572,48 +2578,51 @@
}
// hyphenation
- if (((hl->effects() & ScStyle_HyphenationPossible) || (hl->ch == '-') || hl->ch == SpecialChars::SHYPHEN) && (!outs) && !itemText.text(a-1).isSpace() )
+ if ((itemText.hasFlag(a, ScLayout_HyphenationPossible)
+ || currentCh == '-'
+ || currentCh == SpecialChars::SHYPHEN)
+ && (!outs) && !itemText.text(a-1).isSpace() )
{
breakPos = current.xPos;
- if (hl->ch != '-')
+ if (currentCh != '-')
{
breakPos += hyphWidth;
}
-
+
double rightHang = 0;
if (opticalMargins & ParagraphStyle::OM_RightHangingPunct) {
rightHang = 0.7 * hyphWidth;
}
-
+
if (legacy || (breakPos - rightHang < current.colRight - style.rightMargin()))
{
- if ((current.hyphenCount < m_Doc->hyphConsecutiveLines()) || (m_Doc->hyphConsecutiveLines() == 0) || hl->ch == SpecialChars::SHYPHEN)
+ if ((current.hyphenCount < m_Doc->hyphConsecutiveLines()) || (m_Doc->hyphConsecutiveLines() == 0) || currentCh == SpecialChars::SHYPHEN)
{
current.rememberBreak(a, breakPos, style.rightMargin() + hyphWidth);
}
}
}
-
- if ((hl->ch == SpecialChars::FRAMEBREAK) && (a < itemText.length()-1))
+
+ if ((currentCh == SpecialChars::FRAMEBREAK) && (a < itemText.length()-1))
goNoRoom = true;
- if ((hl->ch == SpecialChars::COLBREAK) && (Cols > 1))
+ if ((currentCh == SpecialChars::COLBREAK) && (Cols > 1))
goNextColumn = true;
- if (a != firstInFrame() && implicitBreak(itemText.item(a - 1), itemText.item(a)))
+ if (a != firstInFrame() && implicitBreak(itemText.text(a - 1), itemText.text(a)))
current.rememberBreak(a - 1, breakPos);
++current.itemsInLine;
-
+
if (tabs.active)
{
double cen = 1;
if (tabs.status == TabCENTER)
cen = 2;
-
- double newTabAdvance = itemText.item(tabs.charIndex)->glyph.xadvance - (wide+kernVal) / cen;
-
+
+ double newTabAdvance = itemText.getGlyphs(tabs.charIndex)->xadvance - (wide+kernVal) / cen;
+
if (newTabAdvance >= 0) {
- itemText.item(tabs.charIndex)->glyph.xadvance = newTabAdvance;
+ itemText.getGlyphs(tabs.charIndex)->xadvance = newTabAdvance;
}
else {
tabs.active = false;
@@ -2623,7 +2632,7 @@
if ((DropCmode || BulNumMode) && !outs)
{
current.xPos += style.parEffectOffset();
- hl->glyph.last()->xadvance += style.parEffectOffset();
+ glyphs->last()->xadvance += style.parEffectOffset();
if (DropCmode)
{
DropCmode = false;
@@ -2643,7 +2652,7 @@
{
tabs.active = false;
tabs.status = TabNONE;
- if (SpecialChars::isBreak(hl->ch, Cols > 1))
+ if (SpecialChars::isBreak(currentCh, Cols > 1))
{
// find end of line
current.breakLine(itemText, style, firstLineOffset(), a);
@@ -2653,7 +2662,7 @@
assert(current.addLine);
//current.startOfCol = false;
//addLeftIndent = true;
- if (hl->ch == SpecialChars::PARSEP)
+ if (currentCh == SpecialChars::PARSEP)
{
maxDX = 0;
if (current.hasDropCap)
@@ -2676,15 +2685,15 @@
OFs = (current.line.width - current.line.naturalWidth) / 2;
if (style.alignment() == ParagraphStyle::Justified)
OFs = 0;
-
+
if (style.alignment() == ParagraphStyle::Extended
- || (style.alignment() == ParagraphStyle::Justified
- && (hl->ch == SpecialChars::LINEBREAK ||
- hl->ch == SpecialChars::FRAMEBREAK ||
- hl->ch == SpecialChars::COLBREAK)
+ || (style.alignment() == ParagraphStyle::Justified
+ && (currentCh == SpecialChars::LINEBREAK ||
+ currentCh == SpecialChars::FRAMEBREAK ||
+ currentCh == SpecialChars::COLBREAK)
&& !itemText.text(current.line.lastItem - 1).isSpace()))
{
- justifyLine(itemText, current.line);
+ justifyLine(itemText, current.line);
}
else
{
@@ -2705,7 +2714,7 @@
a = current.breakIndex;
assert( a >= 0 );
assert( a < itemText.length() );
- hl = itemText.item(a);
+ glyphs = itemText.getGlyphs(a);
current.itemsInLine = a - current.line.firstItem + 1;
if (current.addLine)
{
@@ -2715,51 +2724,51 @@
style.setLineSpacing(font.height(hlcsize10) * autoLS);
else if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
style.setLineSpacing(m_Doc->guidesPrefs().valueBaselineGrid);
-
- if (hl->ch == ' ') {
- hl->setEffects(hl->effects() | ScStyle_SuppressSpace);
- hl->glyph.xadvance = 0;
+
+ if (itemText.text(a) == ' ') {
+ itemText.setFlag(a, ScLayout_SuppressSpace);
+ glyphs->xadvance = 0;
}
-
+
current.updateHeightMetrics(itemText);
//current.updateLineOffset(itemText, style, firstLineOffset());
//current.xPos = current.breakXPos;
EndX = current.endOfLine(m_availableRegion, current.rightMargin, regionMinY, regionMaxY);
current.finishLine(EndX);
-
+
hyphWidth = 0.0;
- if ((hl->effects() & ScStyle_HyphenationPossible) || hl->ch == SpecialChars::SHYPHEN)
+ if (itemText.hasFlag(a, ScLayout_HyphenationPossible) || itemText.text(a) == SpecialChars::SHYPHEN)
{
// insert hyphen
if (current.lastInRowLine)
//increase hyphen count only for hyphens a the end of text row, omit hyphens before overflow
current.hyphenCount++;
- hl->setEffects(hl->effects() | ScStyle_SoftHyphenVisible);
- hl->glyph.grow();
- hl->glyph.more->glyph = font.char2CMap(QChar('-'));
- hl->glyph.more->xadvance = font.charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * scaleH; //FIX ME - hyphen is not rendered with proper width - check yhis with large glyphs horizontal scaling eg. 20%
- hyphWidth = hl->glyph.more->xadvance;
+ itemText.setFlag(a, ScLayout_SoftHyphenVisible);
+ glyphs->grow();
+ glyphs->more->glyph = font.char2CMap(QChar('-'));
+ glyphs->more->xadvance = font.charWidth('-', itemText.charStyle(a).fontSize() / 10.0) * scaleH; //FIX ME - hyphen is not rendered with proper width - check yhis with large glyphs horizontal scaling eg. 20%
+ hyphWidth = glyphs->more->xadvance;
}
else
{
- if (hl->ch != '-')
+ if (itemText.text(a) != '-')
current.hyphenCount = 0;
- hl->setEffects(hl->effects() & ~ScStyle_SoftHyphenVisible);
- hl->glyph.shrink();
+ itemText.clearFlag(a, ScLayout_SoftHyphenVisible);
+ glyphs->shrink();
}
-
+
// Justification
if (opticalMargins & ParagraphStyle::OM_RightHangingPunct)
current.line.width += opticalRightMargin(itemText, current.line);
else
current.line.naturalWidth += hyphWidth;
-
+
OFs = 0;
if (style.alignment() == ParagraphStyle::Rightaligned)
OFs = current.line.width - current.line.naturalWidth;
if (style.alignment() == ParagraphStyle::Centered)
OFs = (current.line.width - current.line.naturalWidth) / 2;
-
+
if ((style.alignment() == ParagraphStyle::Justified) || (style.alignment() == ParagraphStyle::Extended))
justifyLine(itemText, current.line);
else
@@ -2776,9 +2785,9 @@
// line break and drop caps
// #11250: in case of a forced line break, we must not stop
- // the drop cap layout process. This break case such as
+ // the drop cap layout process. This break case such as
// layout of poetry.
- if (hl->ch == SpecialChars::PARSEP && current.hasDropCap)
+ if (itemText.text(a) == SpecialChars::PARSEP && current.hasDropCap)
{
current.hasDropCap = false;
if (current.yPos < maxDY)
@@ -2809,11 +2818,11 @@
{
if (current.addLine && current.breakIndex >= 0)
{
- if (itemText.charStyle(current.line.firstItem).effects() & ScStyle_DropCap)
+ if (itemText.charStyle(current.line.firstItem).effects() & ScLayout_DropCap)
{
// put line back to top
current.line.y -= DropCapDrop;
- itemText.item(current.line.firstItem)->glyph.yoffset += DropCapDrop;
+ itemText.getGlyphs(current.line.firstItem)->yoffset += DropCapDrop;
}
fillInTabLeaders(itemText, current.line);
//if right margin is set we temporally save line, not append it
@@ -2866,9 +2875,9 @@
current.mustLineEnd = current.colRight;
current.restartRowIndex = current.restartIndex;
}
- if ( SpecialChars::isBreak(hl->ch) )
- {
- if (hl->ch == SpecialChars::PARSEP)
+ if ( SpecialChars::isBreak(itemText.text(a)) )
+ {
+ if (itemText.text(a) == SpecialChars::PARSEP)
current.yPos += style.gapAfter();
current.hyphenCount = 0;
}
@@ -2911,7 +2920,7 @@
else
{
MaxChars = a; // Always a+1???
- if (hl->ch == SpecialChars::COLBREAK)
+ if (itemText.text(a) == SpecialChars::COLBREAK)
++MaxChars;
goto NoRoom;
}
@@ -2943,10 +2952,10 @@
goto NoRoom;
}
// end of itemText
+// now place the last line
if (current.itemsInLine > 0 )
{
int a = itemText.length()-1;
- hl = (a >= 0) ? itemText.item(a) : NULL;
current.breakLine(itemText, style, firstLineOffset(), a);
if (current.startOfCol)
@@ -2970,17 +2979,23 @@
maxYAsc = qMax(maxYAsc, 0.0);
maxYDesc = current.yPos + realDesc;
-// regionMinY = static_cast<int>(floor(maxYAsc));
-// regionMaxY = static_cast<int>(floor(maxYDesc));
- regionMinY = qMax(0,static_cast<int>(floor(current.yPos - (asce + offset))));
- regionMaxY = static_cast<int>(floor(current.yPos + desc));
+ if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
+ {
+ regionMinY = static_cast<int>(floor(maxYAsc));
+ regionMaxY = static_cast<int>(floor(maxYDesc));
+ }
+ else // #11727, #11628, etc.
+ {
+ regionMinY = static_cast<int>(qMax(0.0, floor(current.yPos - (asce + offset))));
+ regionMaxY = static_cast<int>(floor(current.yPos + desc));
+ }
EndX = current.endOfLine(m_availableRegion, style.rightMargin(), regionMinY, regionMaxY);
current.finishLine(EndX);
if (opticalMargins & ParagraphStyle::OM_RightHangingPunct)
current.line.width += opticalRightMargin(itemText, current.line);
-
+
OFs = 0;
if (style.alignment() == ParagraphStyle::Rightaligned)
OFs = current.line.width - current.line.naturalWidth;
@@ -2989,10 +3004,10 @@
if (style.alignment() == ParagraphStyle::Justified)
OFs = 0;
if (style.alignment() == ParagraphStyle::Extended
- || (style.alignment() == ParagraphStyle::Justified
- && (hl->ch == SpecialChars::LINEBREAK ||
- hl->ch == SpecialChars::FRAMEBREAK ||
- hl->ch == SpecialChars::COLBREAK)
+ || (style.alignment() == ParagraphStyle::Justified
+ && (itemText.text(a) == SpecialChars::LINEBREAK ||
+ itemText.text(a) == SpecialChars::FRAMEBREAK ||
+ itemText.text(a) == SpecialChars::COLBREAK)
&& !itemText.text(current.line.firstItem + current.itemsInLine-1).isSpace()))
{
justifyLine(itemText, current.line);
@@ -3003,11 +3018,11 @@
current.line.naturalWidth += opticalRightMargin(itemText, current.line);
indentLine(itemText, current.line, OFs);
}
- if ( itemText.charStyle(current.line.firstItem).effects() & ScStyle_DropCap )
+ if ( itemText.charStyle(current.line.firstItem).effects() & ScLayout_DropCap )
{
// put line back to top
current.line.y -= DropCapDrop;
- itemText.item(current.line.firstItem)->glyph.yoffset += DropCapDrop;
+ itemText.getGlyphs(current.line.firstItem)->yoffset += DropCapDrop;
}
fillInTabLeaders(itemText, current.line);
current.startOfCol = false;
@@ -3037,7 +3052,7 @@
}
UndoManager::instance()->setUndoEnabled(true);
}
- if (NextBox != NULL)
+ if (NextBox != NULL)
{
PageItem_TextFrame * nextFrame = dynamic_cast<PageItem_TextFrame*>(NextBox);
nextFrame->invalid = true;
@@ -3046,8 +3061,8 @@
itemText.blockSignals(false);
// qDebug("textframe: len=%d, done relayout", itemText.length());
return;
-
-NoRoom:
+
+NoRoom:
invalid = false;
adjustParagraphEndings ();
@@ -3173,7 +3188,7 @@
// qRound(cullingArea.width() / sc), qRound(cullingArea.height() / sc));
pf2.translate(m_xPos, m_yPos);
}
-
+
pf2.rotate(m_rotation);
if (!m_Doc->layerOutline(LayerID))
{
@@ -3610,7 +3625,7 @@
p->restore();
}
*/
-
+
if (itemText.length() != 0)
{
// qDebug("drawing textframe: len=%d", itemText.length());
@@ -3641,21 +3656,22 @@
QList<QRectF> sFList;
bool previousWasObject(false);
double selX = ls.x;
- ScText *hls = 0;
+ GlyphLayout* glyphs = 0;
int last = qMin(ls.lastItem, itemText.length() - 1);
for (int as = ls.firstItem; as <= last; ++as)
{
bool selecteds = itemText.selected(as);
- hls = itemText.item(as);
- bool HasObject = hls->hasObject(m_Doc);
- if (hls->mark != NULL && (hls->mark->isType(MARKAnchorType) || hls->mark->isType(MARKIndexType)))
+ glyphs = itemText.getGlyphs(as);
+ bool HasObject = itemText.hasObject(as);
+ Mark* mark = itemText.mark(as);
+ if (mark != NULL && (mark->isType(MARKAnchorType) || mark->isType(MARKIndexType)))
continue;
if(selecteds)
{
const CharStyle& charStyleS(itemText.charStyle(as));
if(((as > ls.firstItem) && (charStyleS != itemText.charStyle(as-1)))
|| ((!selectedFrame.isNull()) && HasObject)
- || previousWasObject)
+ || previousWasObject)
{
sFList << selectedFrame;
selectedFrame = QRectF();
@@ -3666,32 +3682,33 @@
if (((selecteds && m_isSelected) || ((NextBox != 0 || BackBox != 0) && selecteds))
&& (m_Doc->appMode == modeEdit || m_Doc->appMode == modeEditTable))
{
- double xcoZli = selX + hls->glyph.xoffset;
+ double xcoZli = selX + glyphs->xoffset;
// ugly hack to make selection correct, as xoffset is used to
// remove left-half of CJK lparen , which is blank.
- if(hls->glyph.xoffset)
+ if(glyphs->xoffset)
{
- int attr = SpecialChars::getCJKAttr(hls->ch) & SpecialChars::CJK_CHAR_MASK;
+ int attr = SpecialChars::getCJKAttr(itemText.text(as)) & SpecialChars::CJK_CHAR_MASK;
if( attr == SpecialChars::CJK_FENCE_BEGIN)
{
- xcoZli -= hls->glyph.xoffset;
+ xcoZli -= glyphs->xoffset;
}
}
const ScFace font = charStyleS.font();
double fontSize = charStyleS.fontSize() / 10.0;
desc = - font.descent(fontSize);
asce = font.ascent(fontSize);
- wide = hls->glyph.wide();
+ wide = glyphs->wide();
QRectF scr;
if (HasObject)
{
- double ww = (hls->getItem(m_Doc)->width() + hls->getItem(m_Doc)->lineWidth()) * hls->glyph.scaleH;
- double hh = (hls->getItem(m_Doc)->height() + hls->getItem(m_Doc)->lineWidth()) * hls->glyph.scaleV;
+ PageItem* obj = itemText.object(as);
+ double ww = (obj->width() + obj->lineWidth()) * glyphs->scaleH;
+ double hh = (obj->height() + obj->lineWidth()) * glyphs->scaleV;
scr = QRectF(xcoZli, ls.y - hh, ww , hh);
previousWasObject = true;
}
else
- scr = QRectF(xcoZli, ls.y + hls->glyph.yoffset - asce * hls->glyph.scaleV, wide , (asce+desc) * (hls->glyph.scaleV));
+ scr = QRectF(xcoZli, ls.y + glyphs->yoffset - asce * glyphs->scaleV, wide , (asce+desc) * (glyphs->scaleV));
selectedFrame |= scr;
}
}
@@ -3700,7 +3717,7 @@
/*if ((hls->ch == SpecialChars::OBJECT) && (hls->embedded.hasItem()))
selX += (hls->embedded.getItem()->gWidth + hls->embedded.getItem()->lineWidth()) * hls->glyph.scaleH;
else*/
- selX += hls->glyph.wide();
+ selX += glyphs->wide();
}
if(!selectedFrame.isNull())
sFList << selectedFrame;
@@ -3718,10 +3735,9 @@
// End of selection
QColor tmp;
- ScText *hl = 0;
for (int a = ls.firstItem; a <= last; ++a)
{
- hl = itemText.item(a);
+ glyphs = itemText.getGlyphs(a);
const CharStyle& charStyle(itemText.charStyle(a));
bool selected = itemText.selected(a);
@@ -3772,22 +3788,22 @@
p->setPen(cachedStrokeQ, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
}
// paint glyphs
- if (isEmbedded || cullingArea.intersects(pf2.mapRect(QRect(qRound(CurX + hl->glyph.xoffset),qRound(ls.y + hl->glyph.yoffset-asce), qRound(hl->glyph.xadvance+1), qRound(asce+desc)))))
+ if (isEmbedded || cullingArea.intersects(pf2.mapRect(QRect(qRound(CurX + glyphs->xoffset),qRound(ls.y + glyphs->yoffset-asce), qRound(glyphs->xadvance+1), qRound(asce+desc)))))
{
p->save();//SA4
p->translate(CurX, ls.y);
- if (hl->hasObject(m_Doc))
- DrawObj_Embedded(p, cullingArea, charStyle, hl->getItem(m_Doc));
+ if (itemText.hasObject(a))
+ DrawObj_Embedded(p, cullingArea, charStyle, itemText.object(a));
else
{
//control chars for marks
- if (m_Doc->guidesPrefs().showControls && hl->hasMark() && (hl->glyph.glyph != SpecialChars::OBJECT))
+ if (m_Doc->guidesPrefs().showControls && itemText.hasMark(a) && (glyphs->glyph != SpecialChars::OBJECT))
{
GlyphLayout markGlyph;
layoutGlyphs(charStyle,SpecialChars::OBJECT, markGlyph);
drawGlyphs(p, charStyle, markGlyph);
}
- drawGlyphs(p, charStyle, hl->glyph);
+ drawGlyphs(p, charStyle, *glyphs);
}
p->restore();//RE4
}
@@ -3795,7 +3811,7 @@
/*if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
CurX += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
else*/
- CurX += hl->glyph.wide();
+ CurX += glyphs->wide();
}
}
}
@@ -4084,7 +4100,7 @@
}
//>>
- ScribusView* view = m_Doc->view();
+ ScribusView* view = m_Doc->view();
switch (kk)
{
case Qt::Key_PageDown:
@@ -4186,9 +4202,9 @@
// #7430 hack : inverted selection with RTL writing enabled
if (reversed())
{ //inverting left and rigt keys
- if (kk == Qt::Key_Left)
+ if (kk == Qt::Key_Left)
kk = Qt::Key_Right;
- else if (kk == Qt::Key_Right)
+ else if (kk == Qt::Key_Right)
kk = Qt::Key_Left;
}
@@ -4258,7 +4274,7 @@
itemText.setCursorPosition (lastInFrame()+1);
ExpandSel(1, oldPos);
}
- else
+ else
if ((itemText.lines() > 0) && (oldPos >= itemText.line(itemText.lines()-1).firstItem) && (itemText.cursorPosition() >= lastInFrame()) && (NextBox != 0))
{
if (NextBox->frameDisplays(itemText.cursorPosition()))
@@ -4393,10 +4409,10 @@
if ((itemText.cursorPosition() > 0) && (itemText.cursorPosition() >= lastInFrame())) // I do not see how its possible, may be dead code - pm
{
itemText.setCursorPosition( lastInFrame() );
-// if (itemText.charStyle(CPos-1).effects() & ScStyle_SuppressSpace)
+// if (itemText.charStyle(CPos-1).effects() & ScLayout_SuppressSpace)
// {
// --CPos;
- while ((itemText.cursorPosition() > 1) && (itemText.charStyle().effects() & ScStyle_SuppressSpace) && (itemText.charStyle(itemText.cursorPosition() - 1).effects() & ScStyle_SuppressSpace))
+ while ((itemText.cursorPosition() > 1) && (itemText.charStyle().effects() & ScLayout_SuppressSpace) && (itemText.charStyle(itemText.cursorPosition() - 1).effects() & ScLayout_SuppressSpace))
{
itemText.setCursorPosition(-1, true);
if (itemText.cursorPosition() == 0)
@@ -4406,7 +4422,7 @@
}
else
{
- while ((itemText.cursorPosition() > 1) && (itemText.charStyle().effects() & ScStyle_SuppressSpace) && (itemText.charStyle(itemText.cursorPosition() - 1).effects() & ScStyle_SuppressSpace))
+ while ((itemText.cursorPosition() > 1) && (itemText.charStyle().effects() & ScLayout_SuppressSpace) && (itemText.charStyle(itemText.cursorPosition() - 1).effects() & ScLayout_SuppressSpace))
{
itemText.setCursorPosition(-1, true);
if (itemText.cursorPosition() == 0)
@@ -4617,7 +4633,7 @@
SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo());
if (ss && ss->get("ETEA") == "insert_frametext")
ss->set("TEXT_STR",ss->get("TEXT_STR") + QString(SpecialChars::TAB));
- else
+ else
{
ss = new SimpleState(Um::InsertText,"",Um::ICreate);
ss->set("INSERT_FRAMETEXT", "insert_frametext");
@@ -4645,7 +4661,7 @@
SimpleState *ss = dynamic_cast<SimpleState*>(undoManager->getLastUndo());
if (ss && ss->get("ETEA") == "insert_frametext")
ss->set("TEXT_STR",ss->get("TEXT_STR") + uc);
- else
+ else
{
ss = new SimpleState(Um::InsertText,"",Um::ICreate);
ss->set("INSERT_FRAMETEXT", "insert_frametext");
@@ -4694,7 +4710,7 @@
delete activeTransaction;
activeTransaction = NULL;
}
- // update layout immediately, we need MaxChars to be correct to detect
+ // update layout immediately, we need MaxChars to be correct to detect
// if we need to move to next frame or not
if (isAutoNoteFrame() && asNoteFrame()->notesList().isEmpty())
{
@@ -4762,9 +4778,9 @@
{
if (i == itemText.length())
break;
- ScText* hl = itemText.item(i);
- if (hl->hasMark() && hl->mark->isType(MARKNoteFrameType))
- notes2DEL.append(QPair<TextNote*, int>(hl->mark->getNotePtr(), i));
+ Mark* mark = itemText.mark(i);
+ if (itemText.hasMark(i) && mark->isType(MARKNoteFrameType))
+ notes2DEL.append(QPair<TextNote*, int>(mark->getNotePtr(), i));
}
}
else
@@ -4776,11 +4792,9 @@
//delete text
for (int i=start; i <= stop; ++i)
{
- ScText* hl = NULL;
- if (i < itemText.length())
- hl = itemText.item(i);
+ Mark* mark = i < itemText.length() && itemText.hasMark(i)? itemText.mark(i) : NULL;
const CharStyle& curParent = itemText.charStyle(i);
- if (i==stop || !curParent.equiv(lastParent) || (hl!=NULL && hl->hasMark() && hl->mark->isType(MARKNoteFrameType)))
+ if (i==stop || !curParent.equiv(lastParent) || (mark!=NULL && mark->isType(MARKNoteFrameType)))
{
added = false;
lastIsDelete = false;
@@ -4893,7 +4907,7 @@
void PageItem_TextFrame::setNewPos(int oldPos, int len, int dir)
{
-
+
bool isSpace, wasSpace;
if ( dir > 0 && oldPos < len )
{
@@ -4906,7 +4920,7 @@
break;
itemText.setCursorPosition(1, true);
wasSpace=isSpace;
-
+
}
/*
isSpace = itemText.at(oldPos)->ch.at(0).isSpace();
@@ -4994,7 +5008,7 @@
// as I do not know where it is checked for negative value, just work around by
// preventing it to be less than 0 here.
int end = qMax(0,itemText.endOfSelection());
-
+
if (oldPos >= end && itemText.cursorPosition() < start)
{
itemText.deselectAll();
@@ -5014,7 +5028,7 @@
{
//CB Replace with direct call for now //emit HasTextSel();
m_Doc->scMW()->EnableTxEdit();
-
+
}
else
{
@@ -5118,7 +5132,7 @@
p->drawSharpLine(FPoint(colLeft + colWidth, 0), FPoint(colLeft + colWidth, 0 + m_height));
++curCol;
}
-
+
}
bool PageItem_TextFrame::createInfoGroup(QFrame *infoGroup, QGridLayout *infoGroupLayout)
@@ -5129,7 +5143,7 @@
int ParagN = 0;
int WordsN = 0;
int CharaN = 0;
-
+
QLabel *infoCT = new QLabel(infoGroup);
QLabel *linesCT = new QLabel(infoGroup);
QLabel *linesT = new QLabel(infoGroup);
@@ -5139,13 +5153,13 @@
QLabel *wordT = new QLabel(infoGroup);
QLabel *charCT = new QLabel(infoGroup);
QLabel *charT = new QLabel(infoGroup);
-
+
if ((nextInChain() != 0) || (prevInChain() != 0))
infoCT->setText(tr("Linked Text"));
else
infoCT->setText(tr("Text Frame"));
infoGroupLayout->addWidget( infoCT, 0, 0, 1, 2, Qt::AlignCenter );
-
+
WordAndPara(this, &Words, &Parag, &Chara, &WordsN, &ParagN, &CharaN);
parCT->setText(tr("Paragraphs: "));
infoGroupLayout->addWidget( parCT, 1, 0, Qt::AlignRight );
@@ -5154,13 +5168,13 @@
else
parT->setText(QString::number(Parag));
infoGroupLayout->addWidget( parT, 1, 1 );
-
+
linesCT->setText(tr("Lines: "));
infoGroupLayout->addWidget( linesCT, 2, 0, Qt::AlignRight );
linesT->setText(QString::number(itemText.lines()));
infoGroupLayout->addWidget( linesT, 2, 1 );
-
-
+
+
wordCT->setText(tr("Words: "));
infoGroupLayout->addWidget( wordCT, 3, 0, Qt::AlignRight );
if (WordsN != 0)
@@ -5168,7 +5182,7 @@
else
wordT->setText(QString::number(Words));
infoGroupLayout->addWidget( wordT, 3, 1 );
-
+
charCT->setText(tr("Chars: "));
infoGroupLayout->addWidget(charCT, 4, 0, Qt::AlignRight );
if (CharaN != 0)
@@ -5192,10 +5206,9 @@
bool enableEditMark = false;
if (editMode && (itemText.cursorPosition() < itemText.length()))
{
- ScText *hl = itemText.item(itemText.cursorPosition());
- if (hl->hasMark())
- {
- Mark* mrk = hl->mark;
+ if (itemText.hasMark(itemText.cursorPosition()))
+ {
+ Mark* mrk = itemText.mark(itemText.cursorPosition());
//notes marks in note frames are not editable
if (!mrk->isType(MARKNoteFrameType))
enableEditMark = true;
@@ -5594,17 +5607,16 @@
if (!m_notesFramesMap.isEmpty())
return true;
for (int i=firstInFrame(); i <= lastInFrame(); ++i)
- if (itemText.item(i)->hasMark())
+ if (itemText.hasMark(i))
return true;
}
else
{
for (int pos = firstInFrame(); pos <= lastInFrame(); ++pos)
{
- ScText* hl = itemText.item(pos);
- if (hl->hasMark())
- {
- TextNote* note = hl->mark->getNotePtr();
+ if (itemText.hasMark(pos))
+ {
+ TextNote* note = itemText.mark(pos)->getNotePtr();
if (note != NULL && (note->notesStyle() == NS))
return true;
}
@@ -5683,7 +5695,7 @@
Mark* PageItem_TextFrame::selectedMark(bool onlySelection)
{ //return pointer to first mark in selected (or whole) text
-
+
bool omitNotes = true; //do not return notes marks (for searching notes use selectedNotesMark()
int start = 0;
int stop = 0;
@@ -5714,27 +5726,27 @@
return NULL;
}
}
-
+
}
else //in whole text
stop = itemText.length();
-
+
for (int pos = start; pos < stop; ++pos)
{
- ScText* hl = itemText.item(pos);
- if (hl->hasMark())
- {
- if (omitNotes && (hl->mark->isType(MARKNoteMasterType) || hl->mark->isType(MARKNoteFrameType)))
+ if (itemText.hasMark(pos))
+ {
+ Mark* mark = itemText.mark(pos);
+ if (omitNotes && (mark->isType(MARKNoteMasterType) || mark->isType(MARKNoteFrameType)))
continue;
- if (hl->mark->isType(MARKBullNumType))
+ if (mark->isType(MARKBullNumType))
continue;
- return hl->mark;
+ return mark;
}
}
return NULL;
}
-TextNote* PageItem_TextFrame::selectedNoteMark(ScText* &hl, bool onlySelection)
+TextNote* PageItem_TextFrame::selectedNoteMark(int &foundPos, bool onlySelection)
{
//return pointer to note from first mark found in text
int start = 0;
@@ -5752,17 +5764,19 @@
MarkType typ = isNoteFrame()? MARKNoteFrameType : MARKNoteMasterType;
for (int pos = start; pos < stop; ++pos)
{
- ScText* hl = itemText.item(pos);
- if (hl->hasMark() && hl->mark->isType(typ))
- return hl->mark->getNotePtr();
+ if (itemText.hasMark(pos) && itemText.mark(pos)->isType(typ))
+ {
+ foundPos = pos;
+ return itemText.mark(pos)->getNotePtr();
+ }
}
return NULL;
}
TextNote* PageItem_TextFrame::selectedNoteMark(bool onlySelection)
{
- ScText* hl = NULL;
- return selectedNoteMark(hl, onlySelection);
+ int dummy;
+ return selectedNoteMark(dummy, onlySelection);
}
NotesInFrameMap PageItem_TextFrame::updateNotesFrames(QMap<int, Mark*> noteMarksPosMap)
@@ -5875,7 +5889,7 @@
// QList<PageItem_NoteFrame*> curr_endNotesList;
// QList<PageItem_NoteFrame*> old_endNotesList;
-
+
// foreach(PageItem_NoteFrame* nF, notesMap.keys())
// {
// if (nF->isEndNotesFrame())
@@ -5976,7 +5990,7 @@
++num;
}
}
-
+
Mark* mrk = selectedMark(true);
while (mrk != NULL)
{
Modified: trunk/Scribus/scribus/pageitem_textframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pageitem_textframe.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.h (original)
+++ trunk/Scribus/scribus/pageitem_textframe.h Fri Oct 4 17:40:08 2013
@@ -38,15 +38,6 @@
typedef QMap<PageItem_NoteFrame*, QList<TextNote *> > NotesInFrameMap;
-#include "text/nlsconfig.h"
-
-#ifdef NLS_PROTO
-#include "text/sctextengine.h"
-#include "text/scfont.h"
-#include "sctextstruct.h"
-class ScText;
-class ScStyleRun;
-#endif
//cezaryece: I remove static statement and made it public as this function is used also by PageItem_NoteFrame
double calculateLineSpacing (const ParagraphStyle &style, PageItem *item);
@@ -88,11 +79,8 @@
void setTextAnnotationOpen(bool open);
double columnWidth();
-#ifdef NLS_PROTO
- int firstTextItem() const { return itemText.firstFrameItem; }
- int lastTextItem() const { return itemText.lastFrameItem; }
-#endif
- //enable/disable marks inserting actions depending on editMode
+
+ //enable/disable marks inserting actions depending on editMode
void togleEditModeActions();
QRegion availableRegion() { return m_availableRegion; }
@@ -105,11 +93,6 @@
//void drawOverflowMarker(ScPainter *p);
void drawUnderflowMarker(ScPainter *p);
void drawColumnBorders(ScPainter *p);
-
-#ifdef NLS_PROTO
- void DrawLineItem(ScPainter *p, double width,
- ScScriptItem *item, uint itemIndex);
-#endif
bool unicodeTextEditMode;
int unicodeInputCount;
@@ -166,7 +149,7 @@
NotesInFrameMap updateNotesFrames(QMap<int, Mark*> noteMarksPosMap); //update notes frames content
void updateNotesMarks(NotesInFrameMap notesMap);
Mark* selectedMark(bool onlySelection = true);
- TextNote* selectedNoteMark(ScText* &hl, bool onlySelection = true);
+ TextNote* selectedNoteMark(int& foundPos, bool onlySelection = true);
TextNote* selectedNoteMark(bool onlySelection = true);
protected:
// set text frame height to last line of text
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Fri Oct 4 17:40:08 2013
@@ -78,7 +78,6 @@
#include "scstreamfilter_flate.h"
#include "scstreamfilter_rc4.h"
#include "tableutils.h"
-#include "text/nlsconfig.h"
#include "util.h"
#include "util_file.h"
#include "util_formats.h"
@@ -4907,7 +4906,6 @@
ite->OwnPage = savedOwnPage;
if (ite->lineColor() != CommonStrings::None)
tabDist += ite->lineWidth() / 2.0;
-#ifndef NLS_PROTO
// Loop over each character (!) in the pageItem...
if (ite->itemType() == PageItem::TextFrame)
{
@@ -4919,16 +4917,16 @@
double CurX = ls.x;
for (int d = ls.firstItem; d <= ls.lastItem; ++d)
{
- ScText *hl = ite->itemText.item(d);
+ ScText *hl = ite->itemText.item_p(d);
const QChar ch = hl->ch;
const CharStyle& chstyle(ite->itemText.charStyle(d));
const ParagraphStyle& pstyle(ite->itemText.paragraphStyle(d));
if (SpecialChars::isBreak(ch, true) || (ch == QChar(10)))
continue;
- if (chstyle.effects() & ScStyle_SuppressSpace)
+ if (chstyle.effects() & ScLayout_SuppressSpace)
continue;
tTabValues = pstyle.tabValues();
- if (chstyle.effects() & ScStyle_StartOfLine)
+ if (chstyle.effects() & ScLayout_StartOfLine)
tabCc = 0;
if ((ch == SpecialChars::TAB) && (tTabValues.count() != 0))
{
@@ -5032,16 +5030,16 @@
double CurX = 0;
for (int d = 0; d < ite->maxCharsInFrame(); ++d)
{
- ScText *hl = ite->asPathText()->itemRenderText.item(d);
+ ScText *hl = ite->asPathText()->itemRenderText.item_p(d);
const QChar ch = hl->ch;
const CharStyle& chstyle(ite->asPathText()->itemRenderText.charStyle(d));
const ParagraphStyle& pstyle(ite->asPathText()->itemRenderText.paragraphStyle(d));
if (SpecialChars::isBreak(ch, true) || (ch == QChar(10)))
continue;
- if (chstyle.effects() & ScStyle_SuppressSpace)
+ if (chstyle.effects() & ScLayout_SuppressSpace)
continue;
tTabValues = pstyle.tabValues();
- if (chstyle.effects() & ScStyle_StartOfLine)
+ if (chstyle.effects() & ScLayout_StartOfLine)
tabCc = 0;
if ((ch == SpecialChars::TAB) && (tTabValues.count() != 0))
{
@@ -5116,7 +5114,6 @@
tabDist = CurX;
}
}
-#endif
if (ite->itemType() == PageItem::TextFrame)
tmp += "ET\n"+tmp2;
return tmp;
@@ -5124,7 +5121,6 @@
bool PDFLibCore::setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, ScText *hl, const ParagraphStyle& pstyle, const ScPage* pag)
{
-#ifndef NLS_PROTO
QString output;
QString FillColor = "";
QString StrokeColor = "";
@@ -5591,7 +5587,6 @@
hl2.glyph.more = 0;
}
return true;
-#endif
}
QString PDFLibCore::SetColor(const QString& farbe, double Shade)
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Fri Oct 4 17:40:08 2013
@@ -227,7 +227,6 @@
//
case PageItem::PathText:
case PageItem::TextFrame:
-#ifndef NLS_PROTO
if (Buffer->PType == PageItem::PathText)
z = m_Doc->itemAdd(PageItem::PathText, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Buffer->Pcolor, true);
else
@@ -353,7 +352,6 @@
currItem->itemText.setDefaultStyle(pstyle);
}
// undoManager->setUndoEnabled(true);
-#endif
break;
case PageItem::Line:
z = m_Doc->itemAdd(PageItem::Line, PageItem::Unspecified, x, y, w ,0, pw, CommonStrings::None, Buffer->Pcolor2, true);
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Fri Oct 4 17:40:08 2013
@@ -2369,17 +2369,16 @@
else if (ch == SpecialChars::SHYPHEN && pos > 0)
{
// qDebug() << QString("scribus134format: SHYPHEN at %1").arg(pos);
- ScText* lastItem = obj->itemText.item(pos-1);
- // double SHY means user provided SHY, single SHY is automatic one
- if (lastItem->effects() & ScStyle_HyphenationPossible)
- {
- lastItem->setEffects(lastItem->effects() & ~ScStyle_HyphenationPossible);
- obj->itemText.insertChars(pos, QString(ch));
- }
- else
- {
- lastItem->setEffects(lastItem->effects() | ScStyle_HyphenationPossible);
- }
+ // double SHY means user provided SHY, single SHY is automatic one
+ if (obj->itemText.hasFlag(pos-1, ScLayout_HyphenationPossible))
+ {
+ obj->itemText.clearFlag(pos-1, ScLayout_HyphenationPossible);
+ obj->itemText.insertChars(pos, QString(ch));
+ }
+ else
+ {
+ obj->itemText.setFlag(pos-1, ScLayout_HyphenationPossible);
+ }
}
else {
obj->itemText.insertChars(pos, QString(ch));
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Fri Oct 4 17:40:08 2013
@@ -4326,16 +4326,15 @@
else if (ch == SpecialChars::SHYPHEN && pos > 0)
{
// qDebug() << QString("scribus150format: SHYPHEN at %1").arg(pos);
- ScText* lastItem = obj->itemText.item(pos-1);
// double SHY means user provided SHY, single SHY is automatic one
- if (lastItem->effects() & ScStyle_HyphenationPossible)
- {
- lastItem->setEffects(lastItem->effects() & ~ScStyle_HyphenationPossible);
+ if (obj->itemText.hasFlag(pos-1, ScLayout_HyphenationPossible))
+ {
+ obj->itemText.clearFlag(pos-1, ScLayout_HyphenationPossible);
obj->itemText.insertChars(pos, QString(ch));
}
else
{
- lastItem->setEffects(lastItem->effects() | ScStyle_HyphenationPossible);
+ obj->itemText.setFlag(pos-1, ScLayout_HyphenationPossible);
}
}
else {
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Fri Oct 4 17:40:08 2013
@@ -81,8 +81,8 @@
uint chr = currItem->itemText.text(e).unicode();
if (chr == 25)
{
- if ((currItem->itemText.item(e)->hasObject(m_Doc)) && (!emF.contains(currItem->itemText.item(e)->getItem(m_Doc))))
- emF.append(currItem->itemText.item(e)->getItem(m_Doc));
+ if ((currItem->itemText.hasObject(e)) && (!emF.contains(currItem->itemText.object(e))))
+ emF.append(currItem->itemText.object(e));
}
}
}
@@ -1519,7 +1519,7 @@
int lastPos = from;
for (int i = from; i < to; ++i)
{
- if (itemText.charStyle(i).effects() & ScStyle_HyphenationPossible
+ if (itemText.hasFlag(i, ScLayout_HyphenationPossible)
// duplicate SHYPHEN if already present to indicate a user provided SHYPHEN:
|| itemText.text(i) == SpecialChars::SHYPHEN)
{
@@ -1591,9 +1591,9 @@
docu.writeAttribute("Unicode", tmpnum);
docu.writeAttribute("COBJ", item->itemText.object(k)->inlineCharID);
}
- else if (ch == SpecialChars::OBJECT && item->itemText.item(k)->mark != NULL)
- {
- Mark* mark = item->itemText.item(k)->mark;
+ else if (ch == SpecialChars::OBJECT && item->itemText.hasMark(k))
+ {
+ Mark* mark = item->itemText.mark(k);
if (!mark->isType(MARKBullNumType))
{ //dont save marks for bullets and numbering
docu.writeEmptyElement("MARK");
Modified: trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp (original)
+++ trunk/Scribus/scribus/plugins/scripter/api_textitem.cpp Fri Oct 4 17:40:08 2013
@@ -12,6 +12,34 @@
#include "hyphenator.h"
#include "scripterimpl.h"
+template<typename T>
+class ApplyCharstyleHelper {
+ PageItem* item;
+ T value;
+public:
+ ApplyCharstyleHelper(PageItem* i, T v) : item(i), value(v) {}
+
+ void apply(void (CharStyle::*f)(T), int p, int len)
+ {
+ CharStyle cs;
+ (cs.*f)(value);
+ if (item->HasSel)
+ {
+ int max = qMax(p+len, item->itemText.length());
+ for (int b = p; b < max; b++)
+ {
+ if (item->itemText.selected(b))
+ item->itemText.applyCharStyle(b, 1, cs);
+ }
+ }
+ else
+ {
+ item->itemText.applyCharStyle(p, len, cs);
+ }
+ }
+
+};
+
TextAPI::TextAPI(PageItem_TextFrame* inner) : ItemAPI(inner)
{
qDebug() << "TextItemWrapper loaded";
@@ -224,34 +252,40 @@
{
if (!checkHaveDocument())
RAISE("No document open");
- for (int b = 0; b < item->itemText.length(); b++)
- {
- //FIXME: doc method
- if (item->HasSel)
- {
- if (item->itemText.selected(b))
- item->itemText.item(b)->setFillColor(color);
- }
- else
- item->itemText.item(b)->setFillColor(color);
- }
+
+ ApplyCharstyleHelper<QString>(item, color).apply(&CharStyle::setFillColor, 0, item->itemText.length());
+
+// for (int b = 0; b < item->itemText.length(); b++)
+// {
+// //FIXME: doc method
+// if (item->HasSel)
+// {
+// if (item->itemText.selected(b))
+// item->itemText.item(b)->setFillColor(color);
+// }
+// else
+// item->itemText.item(b)->setFillColor(color);
+// }
}
void TextAPI::setTextStroke(QString color)
{
if (!checkHaveDocument())
RAISE("No document open");
- for (int b = 0; b < item->itemText.length(); b++)
- {
- //FIXME:NLS use document method for item
- if (item->HasSel)
- {
- if (item->itemText.selected(b))
- item->itemText.item(b)->setStrokeColor(color);
- }
- else
- item->itemText.item(b)->setStrokeColor(color);
- }
+
+ ApplyCharstyleHelper<QString>(item, color).apply(&CharStyle::setStrokeColor, 0, item->itemText.length());
+
+// for (int b = 0; b < item->itemText.length(); b++)
+// {
+// //FIXME:NLS use document method for item
+// if (item->HasSel)
+// {
+// if (item->itemText.selected(b))
+// item->itemText.item(b)->setStrokeColor(color);
+// }
+// else
+// item->itemText.item(b)->setStrokeColor(color);
+// }
}
void TextAPI::setTextScalingV(double value)
@@ -303,16 +337,19 @@
RAISE("value out of bound. Should be between 0 and 100");
}
//FIXME:NLS use document method for that
- for (int b = 0; b < item->itemText.length(); ++b)
- {
- if (item->HasSel)
- {
- if (item->itemText.selected(b))
- item->itemText.item(b)->setFillShade(w);
- }
- else
- item->itemText.item(b)->setFillShade(w);
- }
+
+ ApplyCharstyleHelper<double>(item, w).apply(&CharStyle::setFillShade, 0, item->itemText.length());
+
+// for (int b = 0; b < item->itemText.length(); ++b)
+// {
+// if (item->HasSel)
+// {
+// if (item->itemText.selected(b))
+// item->itemText.item(b)->setFillShade(w);
+// }
+// else
+// item->itemText.item(b)->setFillShade(w);
+// }
}
void TextAPI::selectText(int start, int selcount)
Modified: trunk/Scribus/scribus/plugins/scripter/utils.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/scripter/utils.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/utils.cpp (original)
+++ trunk/Scribus/scribus/plugins/scripter/utils.cpp Fri Oct 4 17:40:08 2013
@@ -66,6 +66,23 @@
return -1;
}
+namespace {
+ void replaceColors(StoryText& itemText, int pos, QString col, QString rep)
+ {
+ QString fill = itemText.charStyle(pos).fillColor();
+ QString stroke = itemText.charStyle(pos).strokeColor();
+ if (col == fill || col == stroke)
+ {
+ CharStyle cstyle;
+ if (col == fill)
+ cstyle.setFillColor(rep);
+ if (col == stroke)
+ cstyle.setStrokeColor(rep);
+ itemText.applyCharStyle(pos, 1, cstyle);
+ }
+ }
+}
+
void ReplaceColor(QString col, QString rep)
{
QColor tmpc;
@@ -77,10 +94,7 @@
for (int d = 0; d < ite->itemText.length(); d++)
{
//FIXME:NLS that should work on runs
- if (col == ite->itemText.charStyle(d).fillColor())
- ite->itemText.item(d)->setFillColor(rep);
- if (col == ite->itemText.charStyle(d).strokeColor())
- ite->itemText.item(d)->setStrokeColor(rep);
+ replaceColors(ite->itemText, d, col, rep);
}
}
if (col == ite->fillColor())
@@ -106,10 +120,7 @@
for (int d = 0; d < ite->itemText.length(); d++)
{
//FIXME: NLS this should work on runs
- if (col == ite->itemText.charStyle(d).fillColor())
- ite->itemText.item(d)->setFillColor(rep);
- if (col == ite->itemText.charStyle(d).strokeColor())
- ite->itemText.item(d)->setStrokeColor(rep);
+ replaceColors(ite->itemText, d, col, rep);
}
}
if (col == ite->fillColor())
@@ -224,4 +235,4 @@
ScCore->primaryMainWindow()->view->SelectItem(item);
}
return true;
-}
+}
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp Fri Oct 4 17:40:08 2013
@@ -14,6 +14,34 @@
#include "scribusdoc.h"
#include "hyphenator.h"
+template<typename T>
+class ApplyCharstyleHelper {
+ PageItem* item;
+ T value;
+public:
+ ApplyCharstyleHelper(PageItem* i, T v) : item(i), value(v) {}
+
+ void apply(void (CharStyle::*f)(T), int p, int len)
+ {
+ CharStyle cs;
+ (cs.*f)(value);
+ if (item->HasSel)
+ {
+ int max = qMax(p+len, item->itemText.length());
+ for (int b = p; b < max; b++)
+ {
+ if (item->itemText.selected(b))
+ item->itemText.applyCharStyle(b, 1, cs);
+ }
+ }
+ else
+ {
+ item->itemText.applyCharStyle(p, len, cs);
+ }
+ }
+
+};
+
PyObject *scribus_getfontsize(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
@@ -699,17 +727,18 @@
}
else
{
- for (int b = 0; b < it->itemText.length(); b++)
- {
- //FIXME: doc method
- if (it->HasSel)
- {
- if (it->itemText.selected(b))
- it->itemText.item(b)->setFillColor(QString::fromUtf8(Color));
- }
- else
- it->itemText.item(b)->setFillColor(QString::fromUtf8(Color));
- }
+ ApplyCharstyleHelper<QString>(it, QString::fromUtf8(Color)).apply(&CharStyle::setFillColor, 0, it->itemText.length());
+// for (int b = 0; b < it->itemText.length(); b++)
+// {
+// //FIXME: doc method
+// if (it->HasSel)
+// {
+// if (it->itemText.selected(b))
+// it->itemText.item(b)->setFillColor(QString::fromUtf8(Color));
+// }
+// else
+// it->itemText.item(b)->setFillColor(QString::fromUtf8(Color));
+// }
// it->TxtFill = QString::fromUtf8(Color);
}
// Py_INCREF(Py_None);
@@ -735,17 +764,18 @@
}
else
{
- for (int b = 0; b < it->itemText.length(); b++)
- {
- //FIXME:NLS use document method for this
- if (it->HasSel)
- {
- if (it->itemText.selected(b))
- it->itemText.item(b)->setStrokeColor(QString::fromUtf8(Color));
- }
- else
- it->itemText.item(b)->setStrokeColor(QString::fromUtf8(Color));
- }
+ ApplyCharstyleHelper<QString>(it, QString::fromUtf8(Color)).apply(&CharStyle::setStrokeColor, 0, it->itemText.length());
+// for (int b = 0; b < it->itemText.length(); b++)
+// {
+// //FIXME:NLS use document method for this
+// if (it->HasSel)
+// {
+// if (it->itemText.selected(b))
+// it->itemText.item(b)->setStrokeColor(QString::fromUtf8(Color));
+// }
+// else
+// it->itemText.item(b)->setStrokeColor(QString::fromUtf8(Color));
+// }
// it->TxtStroke = QString::fromUtf8(Color);
}
// Py_INCREF(Py_None);
@@ -848,17 +878,18 @@
}
else
{
- //FIXME:NLS use document method for that
- for (int b = 0; b < it->itemText.length(); ++b)
- {
- if (it->HasSel)
- {
- if (it->itemText.selected(b))
- it->itemText.item(b)->setFillShade(w);
- }
- else
- it->itemText.item(b)->setFillShade(w);
- }
+ ApplyCharstyleHelper<double>(it, w).apply(&CharStyle::setFillShade, 0, it->itemText.length());
+// //FIXME:NLS use document method for that
+// for (int b = 0; b < it->itemText.length(); ++b)
+// {
+// if (it->HasSel)
+// {
+// if (it->itemText.selected(b))
+// it->itemText.item(b)->setFillShade(w);
+// }
+// else
+// it->itemText.item(b)->setFillShade(w);
+// }
// it->ShTxtFill = w;
}
// Py_INCREF(Py_None);
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp Fri Oct 4 17:40:08 2013
@@ -75,6 +75,15 @@
void ReplaceColor(QString col, QString rep)
{
QColor tmpc;
+
+ CharStyle fill;
+ CharStyle stroke;
+ CharStyle fill_stroke;
+ fill.setFillColor(rep);
+ stroke.setStrokeColor(rep);
+ fill_stroke.setFillColor(rep);
+ fill_stroke.setStrokeColor(rep);
+
for (int c = 0; c < ScCore->primaryMainWindow()->doc->Items->count(); c++)
{
PageItem *ite = ScCore->primaryMainWindow()->doc->Items->at(c);
@@ -83,10 +92,20 @@
for (int d = 0; d < ite->itemText.length(); d++)
{
//FIXME:NLS that should work on runs
- if (col == ite->itemText.charStyle(d).fillColor())
- ite->itemText.item(d)->setFillColor(rep);
- if (col == ite->itemText.charStyle(d).strokeColor())
- ite->itemText.item(d)->setStrokeColor(rep);
+ int combi = (col == ite->itemText.charStyle(d).fillColor() ? 1 : 0) +
+ (col == ite->itemText.charStyle(d).strokeColor() ? 2 : 0);
+ switch (combi)
+ {
+ case 1:
+ ite->itemText.applyCharStyle(d, 1, fill);
+ break;
+ case 2:
+ ite->itemText.applyCharStyle(d, 1, stroke);
+ break;
+ case 3:
+ ite->itemText.applyCharStyle(d, 1, fill_stroke);
+ break;
+ }
}
}
if (col == ite->fillColor())
@@ -112,10 +131,20 @@
for (int d = 0; d < ite->itemText.length(); d++)
{
//FIXME: NLS this should work on runs
- if (col == ite->itemText.charStyle(d).fillColor())
- ite->itemText.item(d)->setFillColor(rep);
- if (col == ite->itemText.charStyle(d).strokeColor())
- ite->itemText.item(d)->setStrokeColor(rep);
+ int combi = (col == ite->itemText.charStyle(d).fillColor() ? 1 : 0) +
+ (col == ite->itemText.charStyle(d).strokeColor() ? 2 : 0);
+ switch (combi)
+ {
+ case 1:
+ ite->itemText.applyCharStyle(d, 1, fill);
+ break;
+ case 2:
+ ite->itemText.applyCharStyle(d, 1, stroke);
+ break;
+ case 3:
+ ite->itemText.applyCharStyle(d, 1, fill_stroke);
+ break;
+ }
}
}
if (col == ite->fillColor())
Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Fri Oct 4 17:40:08 2013
@@ -941,7 +941,7 @@
{
x = 0.0;
y = 0.0;
- ScText * hl = Item->itemText.item(a);
+ ScText * hl = Item->itemText.item_p(a);
const CharStyle& charStyle(Item->itemText.charStyle(a));
chstr = Item->itemText.text(a,1);
if ((chstr == QChar(13)) || (chstr == QChar(29)))
@@ -990,7 +990,7 @@
chma3.translate(-wide, 0);
}
chma4.translate(0, Item->BaseOffs - (charStyle.fontSize() / 10.0) * hl->glyph.scaleV);
- if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript | ScStyle_DropCap))
+ if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript | ScLayout_DropCap))
chma6.translate(0, hl->glyph.yoffset);
if (hl->baselineOffset() != 0)
chma6.translate(0, (-charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0));
@@ -1031,7 +1031,7 @@
y = ls.y;
double Ulen = hl->glyph.xadvance;
double Upos, lw, kern;
- if (charStyle.effects() & ScStyle_StartOfLine)
+ if (charStyle.effects() & ScLayout_StartOfLine)
kern = 0;
else
kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -1088,7 +1088,7 @@
y = ls.y;
double Ulen = hl->glyph.xadvance;
double Upos, lw, kern;
- if (charStyle.effects() & ScStyle_StartOfLine)
+ if (charStyle.effects() & ScLayout_StartOfLine)
kern = 0;
else
kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -1184,7 +1184,7 @@
QString chstr;
for (int a = 0; a < Item->asPathText()->itemRenderText.length(); ++a)
{
- ScText *hl = Item->asPathText()->itemRenderText.item(a);
+ ScText *hl = Item->asPathText()->itemRenderText.item_p(a);
const CharStyle& charStyle(Item->asPathText()->itemRenderText.charStyle(a));
chstr = Item->asPathText()->itemRenderText.text(a,1);
if ((chstr == QChar(13)) || (chstr == QChar(29)))
@@ -1254,7 +1254,7 @@
chma3.translate(-wide, 0);
}
chma4.translate(0, Item->BaseOffs - (charStyle.fontSize() / 10.0) * hl->glyph.scaleV);
- if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript | ScStyle_DropCap))
+ if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript | ScLayout_DropCap))
chma6.translate(0, hl->glyph.yoffset);
if (hl->baselineOffset() != 0)
chma6.translate(0, (-charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0));
@@ -1278,7 +1278,7 @@
}
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
- if (hl->effects() & ScStyle_StartOfLine)
+ if (hl->effects() & ScLayout_StartOfLine)
kern = 0;
else
kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -1354,7 +1354,7 @@
}
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
- if (hl->effects() & ScStyle_StartOfLine)
+ if (hl->effects() & ScLayout_StartOfLine)
kern = 0;
else
kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Fri Oct 4 17:40:08 2013
@@ -60,7 +60,6 @@
#include "util_formats.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
using namespace TableUtils;
PSLib::PSLib(PrintOptions &options, bool psart, SCFonts &AllFonts, QMap<QString, QMap<uint, FPointArray> > DocFonts, ColorList DocColors, bool pdf, bool spot)
@@ -2158,14 +2157,13 @@
PS_restore();
}
}
-#ifndef NLS_PROTO
savedOwnPage = c->OwnPage;
c->OwnPage = PNr-1;
c->asPathText()->layout();
c->OwnPage = savedOwnPage;
for (d = 0; d < c->maxCharsInFrame(); ++d)
{
- hl = c->asPathText()->itemRenderText.item(d);
+ hl = c->asPathText()->itemRenderText.item_p(d);
const CharStyle & style(c->asPathText()->itemRenderText.charStyle(d));
if ((hl->ch == QChar(13)) || (hl->ch == QChar(30)) || (hl->ch == QChar(9)) || (hl->ch == QChar(28)))
continue;
@@ -2544,7 +2542,6 @@
PS_restore();
}
}
-#endif
break;
case PageItem::Symbol:
if (m_Doc->docPatterns.contains(c->pattern()))
@@ -3265,14 +3262,13 @@
PS_restore();
}
}
- #ifndef NLS_PROTO
int savedOwnPage = ite->OwnPage;
ite->OwnPage = PNr;
ite->asPathText()->layout();
ite->OwnPage = savedOwnPage;
for (d = 0; d < ite->maxCharsInFrame(); ++d)
{
- hl = ite->asPathText()->itemRenderText.item(d);
+ hl = ite->asPathText()->itemRenderText.item_p(d);
const CharStyle & style(ite->asPathText()->itemRenderText.charStyle(d));
if ((hl->ch == QChar(13)) || (hl->ch == QChar(30)) || (hl->ch == QChar(9)) || (hl->ch == QChar(28)))
continue;
@@ -3651,7 +3647,6 @@
PS_restore();
}
}
- #endif
PS_restore();
}
if (!success)
@@ -4940,6 +4935,18 @@
}
}
+/**
+ * @brief PSLib::setTextSt
+ * @param Doc our dicument
+ * @param ite the Textitem to set
+ * @param gcr gray color removal option
+ * @param argh current page number
+ * @param pg current page
+ * @param sep separate colors option
+ * @param farb useColors option (== !grayscale)
+ * @param ic use ICC profile option
+ * @param master true if setting master page item
+ */
void PSLib::setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint argh, ScPage* pg, bool sep, bool farb, bool ic, bool master)
{
// qDebug() << QString("pslib setTextSt: ownPage=%1 pageNr=%2 OnMasterPage=%3;").arg(ite->OwnPage).arg(pg->pageNr()).arg(ite->OnMasterPage);
@@ -4951,7 +4958,6 @@
ite->OwnPage = argh;
ite->layout();
ite->OwnPage = savedOwnPage;
-#ifndef NLS_PROTO
if (ite->lineColor() != CommonStrings::None)
tabDist += ite->lineWidth() / 2.0;
@@ -4962,16 +4968,16 @@
for (int d = ls.firstItem; d <= ls.lastItem; ++d)
{
- ScText *hl = ite->itemText.item(d);
+ ScText *hl = ite->itemText.item_p(d);
const CharStyle & cstyle(ite->itemText.charStyle(d));
const ParagraphStyle& pstyle(ite->itemText.paragraphStyle(d));
// if ((hl->ch == QChar(13)) || (hl->ch == QChar(10)) || (hl->ch == QChar(28)) || (hl->ch == QChar(27)) || (hl->ch == QChar(26)))
// continue;
- if (hl->effects() & 4096)
+ if (hl->effects() & ScLayout_SuppressSpace)
continue;
tTabValues = pstyle.tabValues();
- if (hl->effects() & 16384)
+ if (hl->effects() & ScLayout_StartOfLine)
tabCc = 0;
if ((hl->ch == SpecialChars::TAB) && (tTabValues.count() != 0))
{
@@ -5059,7 +5065,6 @@
tabDist = CurX;
}
}
-#endif
}
void PSLib::setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint argh, uint doh, ScText *hl, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master)
Modified: trunk/Scribus/scribus/pslib.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/pslib.h
==============================================================================
--- trunk/Scribus/scribus/pslib.h (original)
+++ trunk/Scribus/scribus/pslib.h Fri Oct 4 17:40:08 2013
@@ -38,9 +38,6 @@
#include "colormgmt/sccolormgmtengine.h"
#include "tableborder.h"
-#ifdef NLS_PROTO
-class ScText;
-#endif
class ScPage;
class ScribusDoc;
Modified: trunk/Scribus/scribus/sampleitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/sampleitem.cpp
==============================================================================
--- trunk/Scribus/scribus/sampleitem.cpp (original)
+++ trunk/Scribus/scribus/sampleitem.cpp Fri Oct 4 17:40:08 2013
@@ -18,7 +18,6 @@
#include <QCursor>
//Added by qt3to4:
#include <QPixmap>
-#include "text/nlsconfig.h"
SampleItem::SampleItem() : QObject()
{
Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Fri Oct 4 17:40:08 2013
@@ -1105,25 +1105,25 @@
double extraOffset = 0.0;
if (itemText.length() != 0)
{
- CurX += itemText.item(0)->fontSize() * itemText.charStyle(0).tracking() / 10000.0;
+ CurX += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0;
totalTextLen += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0;
}
for (int a = 0; a < itemText.length(); ++a)
{
- hl = itemText.item(a);
- chstr = hl->ch;
+ GlyphLayout* glyphs = itemText.getGlyphs(a);
+ chstr =itemText.text(a,1);
if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
|| chstr[0] == SpecialChars::TAB || chstr == SpecialChars::LINEBREAK)
continue;
if (a < itemText.length()-1)
chstr += itemText.text(a+1, 1);
- hl->glyph.yadvance = 0;
- item->layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph);
- hl->glyph.shrink();
- if (hl->hasObject(m_doc))
- totalTextLen += (hl->getItem(m_doc)->width() + hl->getItem(m_doc)->lineWidth()) * hl->glyph.scaleH;
+ glyphs->yadvance = 0;
+ item->layoutGlyphs(itemText.charStyle(a), chstr, *glyphs);
+ glyphs->shrink();
+ if (item->itemText.hasObject(a))
+ totalTextLen += (item->itemText.object(a)->width() + item->itemText.object(a)->lineWidth()) * glyphs->scaleH;
else
- totalTextLen += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0;
+ totalTextLen += glyphs->wide()+itemText.charStyle(a).fontSize() * itemText.charStyle(a).tracking() / 10000.0;
}
for (int segs = 0; segs < item->PoLine.size()-3; segs += 4)
{
@@ -1148,21 +1148,21 @@
int currPathIndex = 0;
for (int a = item->firstInFrame(); a < itemText.length(); ++a)
{
- hl = itemText.item(a);
- chstr = hl->ch;
+ GlyphLayout* glyphs = itemText.getGlyphs(a);
+ chstr = itemText.text(a,1);
if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
|| chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK)
continue;
if (a < itemText.length()-1)
chstr += itemText.text(a+1, 1);
- hl->glyph.yadvance = 0;
- item->layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph);
- hl->glyph.shrink(); // HACK
+ glyphs->yadvance = 0;
+ item->layoutGlyphs(itemText.charStyle(a), chstr, *glyphs);
+ glyphs->shrink(); // HACK
// Unneeded now that glyph xadvance is set appropriately for inline objects by PageItem_TextFrame::layout() - JG
/*if (hl->hasObject())
dx = (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH / 2.0;
else*/
- dx = hl->glyph.wide() / 2.0;
+ dx = glyphs->wide() / 2.0;
CurX += dx;
@@ -1185,7 +1185,8 @@
tangent = FPoint(cos(currAngle * M_PI / 180.0), sin(currAngle * M_PI / 180.0));
point = FPoint(currPoint.x(), currPoint.y());
- hl->glyph.xoffset = 0;
+ hl = itemText.item_p(a);
+ glyphs->xoffset = 0;
hl->PtransX = point.x();
hl->PtransY = point.y();
hl->PRot = currAngle * M_PI / 180.0;
@@ -1228,18 +1229,18 @@
painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
}
painter->translate(0.0, item->pathTextBaseOffset());
- if (hl->ch == SpecialChars::OBJECT)
- drawItem_Embedded(hl->getItem(m_doc), painter, clip, itemText.charStyle(a), hl->getItem(m_doc));
+ if (itemText.hasObject(a))
+ drawItem_Embedded(itemText.object(a), painter, clip, itemText.charStyle(a), itemText.object(a));
else
- drawGlyphs(item, painter, itemText.charStyle(a), hl->glyph, clip);
+ drawGlyphs(item, painter, itemText.charStyle(a), *glyphs, clip);
painter->setWorldMatrix(savWM);
painter->restore();
CurX -= dx;
- if (hl->hasObject(m_doc))
- CurX += (hl->getItem(m_doc)->width() + hl->getItem(m_doc)->lineWidth()) * hl->glyph.scaleH;
+ if (itemText.hasObject(a))
+ CurX += (itemText.object(a)->width() + itemText.object(a)->lineWidth()) * glyphs->scaleH;
else
- CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + extraOffset;
+ CurX += glyphs->wide()+itemText.charStyle(a).fontSize() * itemText.charStyle(a).tracking() / 10000.0 + extraOffset;
}
}
@@ -1582,7 +1583,6 @@
FPoint ColBound;
QRegion cm;
int a;
- ScText *hl;
double desc, asce;
QRect e2;
@@ -1630,23 +1630,23 @@
double CurX = ls.x;
for (a = ls.firstItem; a <= ls.lastItem; ++a)
{
- hl = item->itemText.item(a);
+ GlyphLayout* glyphs = item->itemText.getGlyphs(a);
const CharStyle& charStyle = item->itemText.charStyle(a);
if (charStyle.fillColor() != CommonStrings::None)
{
- ScColorShade tmp(m_doc->PageColors[charStyle.fillColor()], (int) hl->fillShade());
+ ScColorShade tmp(m_doc->PageColors[charStyle.fillColor()], (int) charStyle.fillShade());
painter->setBrush(tmp);
}
if (charStyle.strokeColor() != CommonStrings::None)
{
- ScColorShade tmp(m_doc->PageColors[charStyle.strokeColor()], (int) hl->strokeShade());
+ ScColorShade tmp(m_doc->PageColors[charStyle.strokeColor()], (int) charStyle.strokeShade());
painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
}
//if (!m_doc->RePos)
{
- //double xcoZli = CurX + hl->glyph.xoffset;
+ //double xcoZli = CurX + glyphs->xoffset;
desc = - charStyle.font().descent(charStyle.fontSize() / 10.0);
asce = charStyle.font().ascent(charStyle.fontSize() / 10.0);
if (charStyle.strokeColor() != CommonStrings::None)
@@ -1654,21 +1654,21 @@
ScColorShade tmp(m_doc->PageColors[charStyle.strokeColor()], (int) charStyle.strokeShade());
painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
}
- if (e2.intersects(wm.mapRect(QRect(qRound(CurX + hl->glyph.xoffset),qRound(ls.y + hl->glyph.yoffset-asce), qRound(hl->glyph.xadvance+1), qRound(asce+desc)))))
+ if (e2.intersects(wm.mapRect(QRect(qRound(CurX + glyphs->xoffset),qRound(ls.y + glyphs->yoffset-asce), qRound(glyphs->xadvance+1), qRound(asce+desc)))))
{
painter->save();
painter->translate(CurX, ls.y);
- if (hl->ch == SpecialChars::OBJECT)
- drawItem_Embedded(item, painter, clip, charStyle, hl->getItem(m_doc));
+ if (item->itemText.hasObject(a))
+ drawItem_Embedded(item, painter, clip, charStyle, item->itemText.object(a));
else
- drawGlyphs(item, painter, charStyle, hl->glyph, clip);
+ drawGlyphs(item, painter, charStyle, *glyphs, clip);
painter->restore();
}
// Unneeded now that glyph xadvance is set appropriately for inline objects by PageItem_TextFrame::layout() - JG
/*if (hl->hasObject())
CurX += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth());
else*/
- CurX += hl->glyph.wide();
+ CurX += glyphs->wide();
}
}
}
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Fri Oct 4 17:40:08 2013
@@ -229,7 +229,6 @@
#include "ui/stylemanager.h"
#include "ui/symbolpalette.h"
#include "ui/tabmanager.h"
-#include "text/nlsconfig.h"
#include "tocgenerator.h"
#include "ui/transformdialog.h"
#include "ui/transparencypalette.h"
@@ -1200,12 +1199,12 @@
//check if mark in cursor place and enable editMark action
if (doc->appMode == modeEdit && currItem->itemText.cursorPosition() < currItem->itemText.length())
{
- ScText *hl = currItem->itemText.item(currItem->itemText.cursorPosition());
- if (hl->hasMark())
- {
+ if (currItem->itemText.hasMark(currItem->itemText.cursorPosition()))
+ {
+ Mark* mark = currItem->itemText.mark(currItem->itemText.cursorPosition());
scrActions["editMark"]->setEnabled(true);
- if ((hl->mark->isType(MARKNoteMasterType) || hl->mark->isType(MARKNoteFrameType)) && (hl->mark->getNotePtr() != NULL))
- nsEditor->setNotesStyle(hl->mark->getNotePtr()->notesStyle());
+ if ((mark->isType(MARKNoteMasterType) || mark->isType(MARKNoteFrameType)) && (mark->getNotePtr() != NULL))
+ nsEditor->setNotesStyle(mark->getNotePtr()->notesStyle());
}
else
scrActions["editMark"]->setEnabled(false);
@@ -5377,8 +5376,7 @@
story->setDoc(doc);
for (int pos=story->length() -1; pos >= 0; --pos)
{
- ScText* hl = story->item(pos);
- if (hl->hasMark() && (hl->mark->isNoteType()))
+ if (story->hasMark(pos) && (story->mark(pos)->isNoteType()))
story->removeChars(pos,1);
}
}
@@ -10959,7 +10957,7 @@
ScItemsState* is = NULL;
if (insertMarkDialog(currItem->asTextFrame(), mType, is))
{
- Mark* mrk = currItem->itemText.item(currItem->itemText.cursorPosition() -1)->mark;
+ Mark* mrk = currItem->itemText.mark(currItem->itemText.cursorPosition() -1);
view->updatesOn(false);
currItem->invalidateLayout();
currItem->layout();
@@ -10997,12 +10995,12 @@
PageItem * currItem = doc->m_Selection->itemAt(0);
if (currItem->itemText.cursorPosition() < currItem->itemText.length())
{
- ScText *hl = currItem->itemText.item(currItem->itemText.cursorPosition());
- if (hl->hasMark())
- {
- if (editMarkDlg(hl->mark, currItem->asTextFrame()))
- {
- if (hl->mark->isType(MARKVariableTextType))
+ if (currItem->itemText.hasMark(currItem->itemText.cursorPosition()))
+ {
+ Mark* mark = currItem->itemText.mark(currItem->itemText.cursorPosition());
+ if (editMarkDlg(mark, currItem->asTextFrame()))
+ {
+ if (mark->isType(MARKVariableTextType))
doc->flag_updateMarksLabels = true;
else
currItem->invalid = true;
@@ -11011,8 +11009,8 @@
doc->regionsChanged()->update(QRectF());
view->DrawNew();
}
- if (hl->mark->isNoteType())
- nsEditor->setNotesStyle(hl->mark->getNotePtr()->notesStyle());
+ if (mark->isNoteType())
+ nsEditor->setNotesStyle(mark->getNotePtr()->notesStyle());
}
}
}
@@ -11399,9 +11397,8 @@
{
if (Mrk != mrk)
{
- ScText* hl = currItem->itemText.item(currItem->itemText.cursorPosition());
- hl->mark = Mrk;
- mrk = Mrk;
+ currItem->itemText.replaceMark(currItem->itemText.cursorPosition(), Mrk);
+ mrk = Mrk;
oldMark = *mrk;
replaceMark = true;
}
@@ -11423,8 +11420,7 @@
mrk = doc->newMark();
getUniqueName(label,doc->marksLabelsList(mrk->getType()), "_"); //FIX ME here user should be warned that inserted mark`s label was changed
mrk->setValues(label, currItem->OwnPage, MARKVariableTextType, d);
- ScText* hl = currItem->itemText.item(currItem->itemText.cursorPosition());
- hl->mark = mrk;
+ currItem->itemText.replaceMark(currItem->itemText.cursorPosition(), mrk);
docWasChanged = true;
newMark = true;
}
Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp (original)
+++ trunk/Scribus/scribus/scribusXml.cpp Fri Oct 4 17:40:08 2013
@@ -40,7 +40,6 @@
#include "scpage.h"
#include "scribusdoc.h"
#include "selection.h"
-#include "text/nlsconfig.h"
#include "units.h"
#include <iostream>
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Fri Oct 4 17:40:08 2013
@@ -98,7 +98,6 @@
#include "tableborder.h"
#include "ui/tablecolumnwidthsdialog.h"
#include "ui/tablerowheightsdialog.h"
-#include "text/nlsconfig.h"
#include "undomanager.h"
#include "units.h"
#include "util.h"
@@ -2019,7 +2018,7 @@
}
else
{
- TextNote* note = master->itemText.item(is->getInt("at"))->mark->getNotePtr();
+ TextNote* note = master->itemText.mark(is->getInt("at"))->getNotePtr();
if (note->isEndNote())
flag_updateEndNotes = true;
deleteNote(note);
@@ -2070,7 +2069,7 @@
Q_ASSERT(currItem != NULL);
Q_ASSERT(mrk != NULL);
Mark* mrk = getMarkDefinied(is->get("label"), (MarkType) is->getInt("type"));
- currItem->itemText.item(pos)->mark = mrk;
+ currItem->itemText.replaceMark(pos, mrk);
if (is->contains("strtxtOLD"))
{
mrk->setString(is->get("strtxtOLD"));
@@ -2194,7 +2193,7 @@
{
Q_ASSERT(currItem != NULL);
Q_ASSERT(pos >= 0);
- currItem->itemText.item(pos)->mark = getMarkDefinied(is->get("label"), (MarkType) is->getInt("type"));
+ currItem->itemText.replaceMark(pos, getMarkDefinied(is->get("label"), (MarkType) is->getInt("type")));
if (is->contains("strtxtNEW"))
{
mrk->setString(is->get("strtxtNEW"));
@@ -4483,9 +4482,9 @@
for (int e = start; e < stop; ++e)
{
const ScFace* font = &it->itemText.charStyle(e).font();
- if (it->itemText.item(e)->mark)
- {
- QString mrkStr = it->itemText.item(e)->mark->getString();
+ if (it->itemText.hasMark(e))
+ {
+ QString mrkStr = it->itemText.mark(e)->getString();
for (int i=0;i<mrkStr.length(); ++i)
{
if (font->canRender(mrkStr[i].unicode()))
@@ -4624,7 +4623,7 @@
continue;
}
- if (it->itemText.charStyle(e).effects() & ScStyle_SoftHyphenVisible)
+ if (it->itemText.hasFlag(e, ScLayout_SoftHyphenVisible))
{
uint gl = it->itemText.charStyle(e).font().char2CMap(QChar('-'));
FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl));
@@ -5225,10 +5224,7 @@
{
if (sctextdata==NULL)
return;
-#ifndef NLS_PROTO
reinterpret_cast<CharStyle&>(*sctextdata) = currentStyle.charStyle();
-// sctextdata->cab = 0;
-#endif
}
bool ScribusDoc::copyPageToMasterPage(const int pageNumber, const int leftPage, const int maxLeftPage, const QString& masterPageName, bool copyFromAppliedMaster)
@@ -8888,7 +8884,6 @@
// currItem->setFontEffects(s);
if (currItem->itemText.length() != 0)
{
-#ifndef NLS_PROTO
if ((appMode == modeEdit) || (appMode == modeEditTable))
{
for (int a = 0; a < currItem->itemText.length(); ++a)
@@ -8912,7 +8907,6 @@
currItem->itemText.item(a)->setFeatures(fl.featureList());
}
}
-#endif
currItem->update();
}
}
@@ -9029,8 +9023,8 @@
int currItemTextCount = currItem->itemText.length();
if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
{
- int start = currItem->itemText.startOfItem(currItem->firstInFrame());
- int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
+ int start = currItem->firstInFrame();
+ int stop = currItem->lastInFrame()+1;
if ((appMode == modeEdit) || (appMode == modeEditTable))
{
start = currItem->itemText.startOfSelection();
@@ -9088,8 +9082,8 @@
int currItemTextCount = currItem->itemText.length();
if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
{
- int start = currItem->itemText.startOfItem(currItem->firstInFrame());
- int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
+ int start = currItem->firstInFrame();
+ int stop = currItem->lastInFrame()+1;
if ((appMode == modeEdit) || (appMode == modeEditTable))
{
start = currItem->itemText.startOfSelection();
@@ -9185,18 +9179,21 @@
{
for (int pos = 0; pos < currItemTextCount; ++pos)
{
- ScText* hl = currItem->itemText.item(pos);
- if (hl->hasMark() && hl->mark->isType(MARKBullNumType))
- {
- if (UndoManager::undoEnabled())
- {
- ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle);
- is->set("CLEARMARK", "clear_mark_string");
- is->setItem(qMakePair(pos, hl->mark->getString()));
- undoManager->action(currItem, is);
- }
- hl->mark->setString(QString());
- }
+ if (currItem->itemText.hasMark(pos))
+ {
+ Mark* mark = currItem->itemText.mark(pos);
+ if (mark->isType(MARKBullNumType))
+ {
+ if (UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle);
+ is->set("CLEARMARK", "clear_mark_string");
+ is->setItem(qMakePair(pos, mark->getString()));
+ undoManager->action(currItem, is);
+ }
+ mark->setString(QString());
+ }
+ }
}
}
else
@@ -9213,18 +9210,21 @@
stop = currItem->itemText.endOfParagraph(currItem->itemText.nrOfParagraph(stop));
for (int pos=start; pos < stop; ++pos)
{
- ScText* hl = currItem->itemText.item(pos);
- if (hl->hasMark() && hl->mark->isType(MARKBullNumType))
- {
- if (UndoManager::undoEnabled())
- {
- ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle);
- is->set("CLEARMARKSTRING", "clear_mark_string");
- is->setItem(qMakePair(pos, hl->mark->getString()));
- undoManager->action(currItem, is);
- }
- hl->mark->setString(QString());
- }
+ if (currItem->itemText.hasMark(pos))
+ {
+ Mark* mark = currItem->itemText.mark(pos);
+ if (mark->isType(MARKBullNumType))
+ {
+ if (UndoManager::undoEnabled())
+ {
+ ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle);
+ is->set("CLEARMARKSTRING", "clear_mark_string");
+ is->setItem(qMakePair(pos, mark->getString()));
+ undoManager->action(currItem, is);
+ }
+ mark->setString(QString());
+ }
+ }
}
}
}
@@ -9265,8 +9265,8 @@
}
if (currItemTextCount > 0)
{
- int start = currItem->asPathText() ? currItem->itemText.startOfItem(currItem->firstInFrame()) : 0;
- int stop = currItem->asPathText() ? currItem->itemText.endOfItem(currItem->lastInFrame()) : currItemTextCount;
+ int start = currItem->asPathText() ? currItem->firstInFrame() : 0;
+ int stop = currItem->asPathText() ? currItem->lastInFrame()+1 : currItemTextCount;
if ((appMode == modeEdit) || (appMode == modeEditTable))
{
start = currItem->itemText.startOfSelection();
@@ -9336,8 +9336,8 @@
int currItemTextCount = currItem->itemText.length();
if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
{
- int start = currItem->itemText.startOfItem(currItem->firstInFrame());
- int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
+ int start = currItem->firstInFrame();
+ int length = currItem->lastInFrame() - start + 1;
if ((appMode == modeEdit) || (appMode == modeEditTable))
{
if (currItem->itemText.lengthOfSelection() > 0)
@@ -9468,8 +9468,8 @@
int currItemTextCount = currItem->itemText.length();
if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
{
- int start = currItem->itemText.startOfItem(currItem->firstInFrame());
- int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
+ int start = currItem->firstInFrame();
+ int length = currItem->lastInFrame() - start + 1;
if ((appMode == modeEdit) || (appMode == modeEditTable))
{
if (currItem->itemText.lengthOfSelection() > 0)
@@ -9556,8 +9556,8 @@
int currItemTextCount = currItem->itemText.length();
if ((currItemTextCount > 0) && ((appMode == modeEdit) || (appMode == modeEditTable)))
{
- int start = currItem->itemText.startOfItem(currItem->firstInFrame());
- int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
+ int start = currItem->firstInFrame();
+ int length = currItem->lastInFrame() - start + 1;
if ((appMode == modeEdit) || (appMode == modeEditTable))
{
if (currItem->itemText.lengthOfSelection() > 0)
@@ -14725,17 +14725,19 @@
}
if (scaleText)
{
-#ifndef NLS_PROTO
// bb->setFontSize(qMax(qRound(bb->fontSize()*((scx+scy)/2)), 1));
if (bb->itemText.length() != 0)
{
// bb->setLineSpacing(((bb->fontSize() / 10.0) * static_cast<double>(Doc->typographicSettings.autoLineSpacing) / 100));
for (aa = 0; aa < bb->itemText.length(); ++aa)
- bb->itemText.item(aa)->setFontSize(qMax(qRound(bb->itemText.item(aa)->fontSize()*((scx+scy)/2)), 1));
- if (bb->asPathText())
+ {
+ CharStyle fsStyle;
+ fsStyle.setFontSize(qMax(qRound(bb->itemText.charStyle(aa).fontSize()*((scx+scy)/2)), 1));
+ bb->itemText.applyCharStyle(aa, 1, fsStyle);
+ }
+ if (bb->asPathText())
bb->updatePolyClip();
}
-#endif
}
bb->setImageXYOffset(oldLocalX, oldLocalY);
bb->OldB2 = bb->width();
@@ -16787,11 +16789,10 @@
int start = 0;
int stop = it->itemText.length();
for (int e = start; e < stop; ++e)
- {
- ScText *hl = it->itemText.item(e);
- if (hl->hasObject(this))
- {
- if (hl->getItem(this)->inlineCharID == fIndex)
+ {
+ if (it->itemText.hasObject(e))
+ {
+ if (it->itemText.object(e)->inlineCharID == fIndex)
deleteList.prepend(e);
}
}
@@ -16975,8 +16976,8 @@
{
if (pos != 0 && itemText.text(pos-1) != SpecialChars::PARSEP)
continue;
- ScText* hl = itemText.item(pos);
- if (hl->mark != NULL && hl->mark->isType(MARKBullNumType) && itemText.paragraphStyle(pos).hasNum())
+ Mark* mark = itemText.mark(pos);
+ if (mark != NULL && mark->isType(MARKBullNumType) && itemText.paragraphStyle(pos).hasNum())
{
ParagraphStyle style = itemText.paragraphStyle(pos);
if (style.numName() == "<local block>")
@@ -17028,9 +17029,9 @@
result.append(getStringFromNum(m_nums.at(i).numFormat, m_counters.at(i)));
result.append(m_nums.at(i).suffix);
}
- if (hl->mark->getString() != result)
+ if (mark->getString() != result)
{
- hl->mark->setString(result);
+ mark->setString(result);
needUpdate = true;
}
}
@@ -17107,7 +17108,7 @@
itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
continue;
}
- ScText * hl = item->itemText.item(pos);
+ Mark* mark = item->itemText.mark(pos);
bool resetNums = false;
if (numerations.value(style.numName())->m_lastlevel == -1)
resetNums = true;
@@ -17123,19 +17124,21 @@
QString prefixStr = getNumberStr(style.numName(), style.numLevel(), resetNums, style);
numerations.value(style.numName())->m_lastlevel = style.numLevel();
- if (hl->mark == NULL)
+ if (mark == NULL)
{
BulNumMark* bnMark = new BulNumMark;
item->itemText.insertMark(bnMark,pos);
- hl = item->itemText.item(pos);
- hl->applyCharStyle(item->itemText.paragraphStyle(pos).charStyle());
- hl->setEffects(ScStyle_Default);
- const StyleContext* cStyleContext = item->itemText.paragraphStyle(pos).charStyleContext();
- hl->setContext(cStyleContext);
+// hl = item->itemText.item(pos);
+// hl->applyCharStyle(item->itemText.paragraphStyle(pos).charStyle());
+// hl->setEffects(ScStyle_Default);
+// const StyleContext* cStyleContext = item->itemText.paragraphStyle(pos).charStyleContext();
+// hl->setContext(cStyleContext);
+ CharStyle emptyCS;
+ item->itemText.setCharStyle(pos, 1, emptyCS);
}
- if (hl->mark->getString() != prefixStr)
+ if (mark->getString() != prefixStr)
{
- hl->mark->setString(prefixStr);
+ mark->setString(prefixStr);
item->invalid = true;
flag_Renumber = true;
}
@@ -17226,8 +17229,7 @@
{
for (int i = item->firstInFrame(); i <= item->lastInFrame(); ++i)
{
- ScText* hl = item->itemText.item(i);
- if (hl->hasMark(mrk))
+ if (item->itemText.hasMark(i, mrk))
{
lastItem = a;
return item;
@@ -17251,8 +17253,7 @@
{
for (int pos = 0; pos < item->itemText.length(); ++pos)
{
- ScText* hl = item->itemText.item(pos);
- if (hl->hasMark(mrk))
+ if (item->itemText.hasMark(pos, mrk))
{
currItem = item;
return pos;
@@ -17269,8 +17270,7 @@
for (int i = Start; i < currItem->itemText.length(); ++i)
{
- ScText* hl = currItem->itemText.item(i);
- if (hl->hasMark(mrk))
+ if (currItem->itemText.hasMark(i, mrk))
return i;
}
return -1;
@@ -17295,8 +17295,7 @@
}
for (; i < end; ++i)
{
- ScText* hl = currItem->itemText.item(i);
- if (hl->hasMark(mrk))
+ if (currItem->itemText.hasMark(i, mrk))
return true;
}
}
@@ -17480,9 +17479,9 @@
{
for (int i = pos; i < item->itemText.length(); ++i)
{
- if (item->itemText.item(i)->hasMark() && item->itemText.item(i)->mark->isNoteType())
+ if (item->itemText.hasMark(i) && item->itemText.mark(i)->isNoteType())
{
- TextNote * note = item->itemText.item(i)->mark->getNotePtr();
+ TextNote * note = item->itemText.mark(i)->getNotePtr();
note->setNoteMark(NULL);
note->masterMark()->setItemPtr(item);
note->masterMark()->setItemName(item->itemName());
@@ -17791,26 +17790,25 @@
//update marks strings in master text and in notes frame (only numbers!)
//check if notes schould be added or removed from notes frame
int noteNum = num;
- ScText* hl;
int index = 0;
bool doUpdate = false;
for (int pos = frame->firstInFrame(); pos <= frame->lastInFrame(); ++pos)
{
- hl = frame->itemText.item(pos);
- if (hl->hasMark() && hl->mark->isType(MARKNoteMasterType))
- {
- if (hl->mark->getNotePtr() == NULL)
+ Mark* mark = frame->itemText.mark(pos);
+ if (frame->itemText.hasMark(pos) && mark->isType(MARKNoteMasterType))
+ {
+ if (mark->getNotePtr() == NULL)
continue;
- if (hl->mark->getNotePtr()->notesStyle() == nStyle)
+ if (mark->getNotePtr()->notesStyle() == nStyle)
{
QString numStr = nStyle->prefix() + nStyle->numString(noteNum) + nStyle->suffix();
- QString mStr = hl->mark->getString();
- QString label = hl->mark->label;
+ QString mStr = mark->getString();
+ QString label = mark->label;
if ((mStr != numStr) || flag_updateMarksLabels || flag_updateEndNotes)
{
doUpdate = true;
- hl->mark->setString(numStr);
+ mark->setString(numStr);
label = "NoteMark_" + nStyle->name();
if (nStyle->range() != NSRdocument)
{
@@ -17824,9 +17822,9 @@
label += " in frame " + frame->itemName();
}
label += "_" + QString::number(noteNum);
- hl->mark->label = label;
+ mark->label = label;
}
- TextNote* note = hl->mark->getNotePtr();
+ TextNote* note = mark->getNotePtr();
note->setNum(noteNum);
note->masterMark()->setItemPtr(frame);
if (note->noteMark() != NULL)
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Fri Oct 4 17:40:08 2013
@@ -101,7 +101,6 @@
#include "selection.h"
#include "selectionrubberband.h"
#include "serializer.h"
-#include "text/nlsconfig.h"
#include "ui/adjustcmsdialog.h"
#include "ui/extimageprops.h"
#include "ui/guidemanager.h"
@@ -3397,7 +3396,6 @@
void ScribusView::TextToPath()
{
-#ifndef NLS_PROTO
if (Doc->appMode == modeEditClip)
requestMode(submodeEndNodeEdit);
Selection tmpSelection(this, false);
@@ -3460,7 +3458,7 @@
pts.resize(0);
x = 0.0;
y = 0.0;
- ScText * hl = currItem->asPathText()->itemRenderText.item(a);
+ ScText * hl = currItem->asPathText()->itemRenderText.item_p(a);
const CharStyle& charStyle(currItem->asPathText()->itemRenderText.charStyle(a));
chstr = currItem->asPathText()->itemRenderText.text(a,1);
if ((chstr == SpecialChars::PARSEP) || (chstr == SpecialChars::OLD_NBSPACE))
@@ -3472,15 +3470,15 @@
if (chstr == SpecialChars::PAGENUMBER)
chstr = currItem->ExpandToken(a);
double chs = charStyle.fontSize();
- if (hl->effects() & ScStyle_SmallCaps)
+ if (charStyle.effects() & ScStyle_SmallCaps)
{
if (chstr[0].toUpper() != chstr[0])
{
- chs = qMax(static_cast<int>(hl->fontSize() * Doc->typographicPrefs().valueSmallCaps / 100), 1);
+ chs = qMax(static_cast<int>(charStyle.fontSize() * Doc->typographicPrefs().valueSmallCaps / 100), 1);
chstr = chstr[0].toUpper();
}
}
- else if (hl->effects() & ScStyle_AllCaps)
+ else if (charStyle.effects() & ScStyle_AllCaps)
chstr = chstr[0].toUpper();
// double csi = static_cast<double>(chs) / 100.0;
uint chr = chstr[0].unicode();
@@ -3519,18 +3517,18 @@
if (currItem->reversed())
{
if (a < currItem->asPathText()->itemRenderText.length()-1)
- wide = hl->font().charWidth(chstr[0], hl->fontSize(), currItem->asPathText()->itemRenderText.text(a+1));
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize(), currItem->asPathText()->itemRenderText.text(a+1));
else
- wide = hl->font().charWidth(chstr[0], hl->fontSize());
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize());
chma3.scale(-1, 1);
chma3.translate(-wide, 0);
}
chma4.translate(0, currItem->BaseOffs - (charStyle.fontSize() / 10.0) * hl->glyph.scaleV);
if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript))
chma6.translate(0, hl->glyph.yoffset);
- if (hl->baselineOffset() != 0)
+ if (charStyle.baselineOffset() != 0)
chma6.translate(0, (-charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0));
- uint gl = hl->font().char2CMap(chr);
+ uint gl = charStyle.font().char2CMap(chr);
QTransform finalMat = QTransform(chma * chma2 * chma3 * chma4 * chma6 * trafo);
if (currItem->rotation() != 0)
{
@@ -3551,7 +3549,7 @@
}
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
- if (hl->effects() & ScStyle_StartOfLine)
+ if (charStyle.effects() & ScLayout_StartOfLine)
kern = 0;
else
kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -3595,8 +3593,8 @@
bb->PoLine.resize(0);
bb->PoLine.addQuadPoint(start, start, stop, stop);
bb->PoLine.map(stro);
- bb->setLineColor(hl->fillColor());
- bb->setLineShade(hl->fillShade());
+ bb->setLineColor(charStyle.fillColor());
+ bb->setLineShade(charStyle.fillShade());
bb->setLineWidth(Uwid);
Doc->AdjustItemSize(bb);
bb->ContourLine = bb->PoLine.copy();
@@ -3610,7 +3608,7 @@
}
if ((chstr.length() > 0) && (!chstr.at(0).isSpace()))
{
- pts = hl->font().glyphOutline(gl);
+ pts = charStyle.font().glyphOutline(gl);
if (pts.size() < 4)
continue;
if ((charStyle.effects() & ScStyle_Shadowed) && (charStyle.strokeColor() != CommonStrings::None))
@@ -3629,19 +3627,19 @@
QTransform shmap;
shmap.translate(glxTr, glyTr);
bb->PoLine.map(finalMat * shmap);
- bb->setFillColor(hl->strokeColor());
- bb->setFillShade(hl->strokeShade());
+ bb->setFillColor(charStyle.strokeColor());
+ bb->setFillShade(charStyle.strokeShade());
if (currItem->asPathText()->itemRenderText.charStyle(a).effects() & ScStyle_Outline)
{
- bb->setLineColor(hl->strokeColor());
- bb->setLineShade(hl->strokeShade());
+ bb->setLineColor(charStyle.strokeColor());
+ bb->setLineShade(charStyle.strokeShade());
}
else
{
bb->setLineColor(CommonStrings::None);
bb->setLineShade(100);
}
- bb->setLineWidth(chs * hl->outlineWidth() / 10000.0);
+ bb->setLineWidth(chs * charStyle.outlineWidth() / 10000.0);
Doc->AdjustItemSize(bb);
bb->ContourLine = bb->PoLine.copy();
bb->ClipEdited = true;
@@ -3666,19 +3664,19 @@
bb->PoLine = pts.copy();
if (!currItem->asPathText())
bb->setRotation(currItem->rotation());
- bb->setFillColor(hl->fillColor());
- bb->setFillShade(hl->fillShade());
+ bb->setFillColor(charStyle.fillColor());
+ bb->setFillShade(charStyle.fillShade());
if (currItem->asPathText()->itemRenderText.charStyle(a).effects() & ScStyle_Outline)
{
- bb->setLineColor(hl->strokeColor());
- bb->setLineShade(hl->strokeShade());
+ bb->setLineColor(charStyle.strokeColor());
+ bb->setLineShade(charStyle.strokeShade());
}
else
{
bb->setLineColor(CommonStrings::None);
bb->setLineShade(100);
}
- bb->setLineWidth(chs * hl->outlineWidth() / 10000.0);
+ bb->setLineWidth(chs * charStyle.outlineWidth() / 10000.0);
Doc->AdjustItemSize(bb);
bb->ContourLine = bb->PoLine.copy();
bb->ClipEdited = true;
@@ -3700,7 +3698,7 @@
}
double Ulen = hl->glyph.xadvance;
double Upos, Uwid, kern;
- if (hl->effects() & ScStyle_StartOfLine)
+ if (charStyle.effects() & ScLayout_StartOfLine)
kern = 0;
else
kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -3735,8 +3733,8 @@
bb->PoLine.resize(0);
bb->PoLine.addQuadPoint(start, start, stop, stop);
bb->PoLine.map(stro);
- bb->setLineColor(hl->fillColor());
- bb->setLineShade(hl->fillShade());
+ bb->setLineColor(charStyle.fillColor());
+ bb->setLineShade(charStyle.fillShade());
bb->setLineWidth(Uwid);
Doc->AdjustItemSize(bb);
bb->ContourLine = bb->PoLine.copy();
@@ -3762,22 +3760,23 @@
pts.resize(0);
x = 0.0;
y = 0.0;
- ScText * hl = currItem->itemText.item(a);
+ GlyphLayout* glyphs = currItem->itemText.getGlyphs(a);
const CharStyle& charStyle(currItem->itemText.charStyle(a));
+
chstr = currItem->itemText.text(a,1);
if ((chstr == SpecialChars::PARSEP) || (chstr == SpecialChars::OLD_NBSPACE))
{
if (chstr == SpecialChars::OLD_NBSPACE)
- CurX += hl->glyph.wide();
+ CurX += glyphs->wide();
continue;
}
if (chstr == SpecialChars::OBJECT)
{
- if (hl->hasObject(Doc))
+ if (currItem->itemText.hasObject(a))
{
ScriXmlDoc ss;
Selection tempSelection(this, false);
- tempSelection.addItem(hl->getItem(Doc), true);
+ tempSelection.addItem(currItem->itemText.object(a), true);
QString dataS = ss.WriteElem(Doc, &tempSelection);
emit LoadElem(dataS, currItem->xPos(), currItem->yPos(), false, true, Doc, this);
bb = Doc->Items->last();
@@ -3787,7 +3786,7 @@
bb->setLocked(currItem->locked());
bb->setItemName(currItem->itemName()+"+"+ccounter.setNum(a));
bb->setRotation(currItem->rotation());
- double textX = CurX + hl->glyph.xoffset;
+ double textX = CurX + glyphs->xoffset;
double textY = ls.y - bb->height();
if (charStyle.baselineOffset() != 0)
textY -= (charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0);
@@ -3800,7 +3799,7 @@
Doc->setRedrawBounding(bb);
newGroupedItems.append(Doc->Items->takeAt(z));
}
- CurX += hl->glyph.wide();
+ CurX += glyphs->wide();
continue;
}
if (chstr == SpecialChars::PAGENUMBER)
@@ -3809,23 +3808,23 @@
{
chstrex = chstr[cx];
double chs = charStyle.fontSize();
- if (hl->effects() & ScStyle_SmallCaps)
+ if (currItem->itemText.charStyle(a).effects() & ScStyle_SmallCaps)
{
if (chstrex.toUpper() != chstrex)
{
- chs = qMax(static_cast<int>(hl->fontSize() * Doc->typographicPrefs().valueSmallCaps / 100), 1);
+ chs = qMax(static_cast<int>(chs * Doc->typographicPrefs().valueSmallCaps / 100), 1);
chstrex = chstrex.toUpper();
}
}
- else if (hl->effects() & ScStyle_AllCaps)
+ else if (currItem->itemText.charStyle(a).effects() & ScStyle_AllCaps)
chstrex = chstrex.toUpper();
double csi = static_cast<double>(chs) / 100.0;
uint chr = chstrex.unicode();
QTransform chma, chma6;
- uint gl = hl->font().char2CMap(chr);
- FPoint origin = hl->font().glyphOrigin(gl);
- x = origin.x() * csi * hl->glyph.scaleH;
- y = origin.y() * csi * hl->glyph.scaleV;
+ uint gl = charStyle.font().char2CMap(chr);
+ FPoint origin = charStyle.font().glyphOrigin(gl);
+ x = origin.x() * csi * glyphs->scaleH;
+ y = origin.y() * csi * glyphs->scaleV;
if ((charStyle.effects() & ScStyle_Underline) || ((charStyle.effects() & ScStyle_UnderlineWords) && chstr.toUInt() != charStyle.font().char2CMap(QChar(' '))))
{
double st, lw;
@@ -3846,7 +3845,7 @@
lw = qMax(charStyle.font().strokeWidth(charStyle.fontSize() / 10.0), 1.0);
}
if (charStyle.baselineOffset() != 0)
- st += (charStyle.fontSize() / 10.0) * hl->glyph.scaleV * (charStyle.baselineOffset() / 1000.0);
+ st += (charStyle.fontSize() / 10.0) * glyphs->scaleV * (charStyle.baselineOffset() / 1000.0);
uint z = Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), currItem->lineWidth(), currItem->lineColor(), currItem->fillColor(), true);
bb = Doc->Items->at(z);
undoManager->setUndoEnabled(false);
@@ -3856,9 +3855,9 @@
bb->NamedLStyle = currItem->NamedLStyle;
bb->setItemName(currItem->itemName()+"+U"+ccounter.setNum(a));
bb->setRotation(currItem->rotation());
- bb->PoLine.addQuadPoint(FPoint(0, 0), FPoint(0, 0), FPoint(hl->glyph.xadvance, 0), FPoint(hl->glyph.xadvance, 0));
- bb->setLineColor(hl->fillColor());
- bb->setLineShade(hl->fillShade());
+ bb->PoLine.addQuadPoint(FPoint(0, 0), FPoint(0, 0), FPoint(glyphs->xadvance, 0), FPoint(glyphs->xadvance, 0));
+ bb->setLineColor(charStyle.fillColor());
+ bb->setLineShade(charStyle.fillShade());
bb->setLineWidth(lw);
FPoint tp2(getMinClipF(&bb->PoLine));
bb->PoLine.translate(-tp2.x(), -tp2.y());
@@ -3866,15 +3865,15 @@
bb->setWidthHeight(tp.x(), tp.y());
bb->Clip = FlattenPath(bb->PoLine, bb->Segments);
double textX = CurX;
- double textY = ls.y - st; // + hl->glyph.yoffset;
+ double textY = ls.y - st; // + glyphs->yoffset;
if (charStyle.effects() & ScStyle_Subscript)
- textY += hl->glyph.yoffset;
+ textY += glyphs->yoffset;
if (charStyle.baselineOffset() != 0)
textY -= (charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0);
if (a < currItem->itemText.length()-1)
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
else
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize());
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize());
if (currItem->imageFlippedH())
textX = currItem->width() - textX - bb->width() - x;
if (currItem->imageFlippedV())
@@ -3892,11 +3891,11 @@
}
if (!chstrex.isSpace())
{
- pts = hl->font().glyphOutline(gl);
+ pts = charStyle.font().glyphOutline(gl);
if (pts.size() < 4)
continue;
chma = QTransform();
- chma.scale(hl->glyph.scaleH * charStyle.fontSize() / 100.00, hl->glyph.scaleV * charStyle.fontSize() / 100.0);
+ chma.scale(glyphs->scaleH * charStyle.fontSize() / 100.00, glyphs->scaleV * charStyle.fontSize() / 100.0);
pts.map(chma);
chma = QTransform();
if (currItem->imageFlippedH() && (!currItem->reversed()))
@@ -3919,27 +3918,27 @@
bb->setItemName(currItem->itemName()+"+Sh"+ccounter.setNum(a));
bb->PoLine = pts.copy();
bb->setRotation(currItem->rotation());
- bb->setFillColor(hl->strokeColor());
- bb->setFillShade(hl->strokeShade());
+ bb->setFillColor(charStyle.strokeColor());
+ bb->setFillShade(charStyle.strokeShade());
bb->setLineColor(CommonStrings::None);
bb->setLineShade(100);
- bb->setLineWidth(chs * hl->outlineWidth() / 10000.0);
+ bb->setLineWidth(chs * charStyle.outlineWidth() / 10000.0);
FPoint tp2(getMinClipF(&bb->PoLine));
bb->PoLine.translate(-tp2.x(), -tp2.y());
FPoint tp(getMaxClipF(&bb->PoLine));
bb->setWidthHeight(tp.x(), tp.y());
bb->Clip = FlattenPath(bb->PoLine, bb->Segments);
- double textX = CurX + hl->glyph.xoffset;
- double textY = ls.y; // + hl->glyph.yoffset;
+ double textX = CurX + glyphs->xoffset;
+ double textY = ls.y; // + glyphs->yoffset;
if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript))
- textY += hl->glyph.yoffset;
+ textY += glyphs->yoffset;
chma6 = QTransform();
if (charStyle.baselineOffset() != 0)
textY -= (charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0);
if (a < currItem->itemText.length()-1)
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
else
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize());
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize());
if (currItem->imageFlippedH())
textX = currItem->width() - textX - bb->width() - x;
if (currItem->imageFlippedV())
@@ -3966,35 +3965,35 @@
bb->setItemName(currItem->itemName()+"+"+ccounter.setNum(a));
bb->PoLine = pts.copy();
bb->setRotation(currItem->rotation());
- bb->setFillColor(hl->fillColor());
- bb->setFillShade(hl->fillShade());
+ bb->setFillColor(charStyle.fillColor());
+ bb->setFillShade(charStyle.fillShade());
if (currItem->itemText.charStyle(a).effects() & ScStyle_Outline)
{
- bb->setLineColor(hl->strokeColor());
- bb->setLineShade(hl->strokeShade());
+ bb->setLineColor(charStyle.strokeColor());
+ bb->setLineShade(charStyle.strokeShade());
}
else
{
bb->setLineColor(CommonStrings::None);
bb->setLineShade(100);
}
- bb->setLineWidth(chs * hl->outlineWidth() / 10000.0);
+ bb->setLineWidth(chs * charStyle.outlineWidth() / 10000.0);
FPoint tp2(getMinClipF(&bb->PoLine));
bb->PoLine.translate(-tp2.x(), -tp2.y());
FPoint tp(getMaxClipF(&bb->PoLine));
bb->setWidthHeight(tp.x(), tp.y());
bb->Clip = FlattenPath(bb->PoLine, bb->Segments);
- double textX = CurX + hl->glyph.xoffset;
- double textY = ls.y; // + hl->glyph.yoffset;
+ double textX = CurX + glyphs->xoffset;
+ double textY = ls.y; // + glyphs->yoffset;
if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript))
- textY += hl->glyph.yoffset;
+ textY += glyphs->yoffset;
chma6 = QTransform();
if (charStyle.baselineOffset() != 0)
textY -= (charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0);
if (a < currItem->itemText.length()-1)
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
else
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize());
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize());
if (currItem->imageFlippedH())
textX = currItem->width() - textX - bb->width() - x;
if (currItem->imageFlippedV())
@@ -4030,7 +4029,7 @@
lw = qMax(charStyle.font().strokeWidth(charStyle.fontSize() / 10.0), 1.0);
}
if (charStyle.baselineOffset() != 0)
- st += (charStyle.fontSize() / 10.0) * hl->glyph.scaleV * (charStyle.baselineOffset() / 1000.0);
+ st += (charStyle.fontSize() / 10.0) * glyphs->scaleV * (charStyle.baselineOffset() / 1000.0);
uint z = Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), currItem->lineWidth(), currItem->lineColor(), currItem->fillColor(), true);
bb = Doc->Items->at(z);
undoManager->setUndoEnabled(false);
@@ -4040,9 +4039,9 @@
bb->NamedLStyle = currItem->NamedLStyle;
bb->setItemName(currItem->itemName()+"+S"+ccounter.setNum(a));
bb->setRotation(currItem->rotation());
- bb->PoLine.addQuadPoint(FPoint(0, 0), FPoint(0, 0), FPoint(hl->glyph.xadvance, 0), FPoint(hl->glyph.xadvance, 0));
- bb->setLineColor(hl->fillColor());
- bb->setLineShade(hl->fillShade());
+ bb->PoLine.addQuadPoint(FPoint(0, 0), FPoint(0, 0), FPoint(glyphs->xadvance, 0), FPoint(glyphs->xadvance, 0));
+ bb->setLineColor(charStyle.fillColor());
+ bb->setLineShade(charStyle.fillShade());
bb->setLineWidth(lw);
FPoint tp2(getMinClipF(&bb->PoLine));
bb->PoLine.translate(-tp2.x(), -tp2.y());
@@ -4050,13 +4049,13 @@
bb->setWidthHeight(tp.x(), tp.y());
bb->Clip = FlattenPath(bb->PoLine, bb->Segments);
double textX = CurX;
- double textY = ls.y - st + hl->glyph.yoffset;
+ double textY = ls.y - st + glyphs->yoffset;
if (charStyle.baselineOffset() != 0)
textY -= (charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0);
if (a < currItem->itemText.length()-1)
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize(), currItem->itemText.text(a+1));
else
- wide = hl->font().charWidth(chstr[0], charStyle.fontSize());
+ wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize());
if (currItem->imageFlippedH())
textX = currItem->width() - textX - bb->width() - x;
if (currItem->imageFlippedV())
@@ -4072,7 +4071,7 @@
undoManager->setUndoEnabled(true);
newGroupedItems.append(Doc->Items->takeAt(z));
}
- CurX += hl->glyph.wide();
+ CurX += glyphs->wide();
}
}
}
@@ -4168,7 +4167,6 @@
Deselect(true);
trans.commit();
}
-#endif
}
void ScribusView::keyPressEvent(QKeyEvent *k)
Modified: trunk/Scribus/scribus/sctextstruct.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/sctextstruct.h
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.h (original)
+++ trunk/Scribus/scribus/sctextstruct.h Fri Oct 4 17:40:08 2013
@@ -12,13 +12,6 @@
#endif
#include "scribusapi.h"
-#include "text/nlsconfig.h"
-
-#ifdef NLS_CONFORMANCE
-#define NLS_PRIVATE private
-#else
-#define NLS_PRIVATE public
-#endif
#include <QString>
@@ -43,6 +36,15 @@
*
*/
+// from charstlye.h ScStyleFlags
+enum LayoutFlags {
+ ScLayout_None = 0,
+ ScLayout_HyphenationPossible=128, //Hyphenation possible here (Soft Hyphen)
+ ScLayout_DropCap = 2048,
+ ScLayout_SuppressSpace = 4096,//internal use in PageItem (Suppresses spaces when in Block alignment)
+ ScLayout_SoftHyphenVisible=8192, //Soft Hyphen visible at line end
+ ScLayout_StartOfLine = 16384
+};
/**
@@ -61,6 +63,9 @@
GlyphLayout() : xadvance(0.0f), yadvance(0.0f), xoffset(0.0f), yoffset(0.0f),
scaleV(1.0), scaleH(1.0), glyph(0), more(NULL)
+ { }
+ GlyphLayout(const GlyphLayout& o) : xadvance(o.xadvance), yadvance(o.yadvance), xoffset(o.xoffset), yoffset(o.yoffset),
+ scaleV(o.scaleH), scaleH(o.scaleV), glyph(o.glyph), more(NULL)
{ }
virtual ~GlyphLayout()
{ }
@@ -100,7 +105,7 @@
QChar fillChar;
};
-#ifndef NLS_PROTO
+
class SCRIBUS_API ScText : public CharStyle
{
public:
@@ -147,7 +152,6 @@
private:
void setNewMark(Mark* mrk);
};
-#endif
/** @brief First Line Offset Policy
Modified: trunk/Scribus/scribus/styles/charstyle.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/styles/charstyle.h
==============================================================================
--- trunk/Scribus/scribus/styles/charstyle.h (original)
+++ trunk/Scribus/scribus/styles/charstyle.h Fri Oct 4 17:40:08 2013
@@ -22,7 +22,8 @@
class ResourceCollection;
enum StyleFlagValue {
- ScStyle_Default = 0,
+ ScStyle_None = 0,
+ ScStyle_Default = 0,
ScStyle_Superscript = 1,
ScStyle_Subscript = 2,
ScStyle_Outline = 4,
@@ -33,13 +34,14 @@
ScStyle_HyphenationPossible=128, //Hyphenation possible here (Soft 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_SoftHyphenVisible=8192, //Soft Hyphen visible at line end
- ScStyle_StartOfLine = 16384,
+ xScStyle_Reserved01 = 1024, //free, not used in the moment
+ xScStyle_DropCap = 2048,
+ xScStyle_SuppressSpace = 4096,//internal use in PageItem (Suppresses spaces when in Block alignment)
+ xScStyle_SoftHyphenVisible=8192, //Soft Hyphen visible at line end
+ xScStyle_StartOfLine = 16384,
ScStyle_UserStyles = 1919, // == 1024 + 512 + 256 + 64 + 32 + 16 + 8 + 4 + 2 + 1
- ScStyle_None = 65535
+ ScStyle_NonUserStyles = 30848, // == 128 + 2048 + 4096 + 8192 + 16384
+ ScStyle_All = 65535
};
class SCRIBUS_API StyleFlag
Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Fri Oct 4 17:40:08 2013
@@ -416,6 +416,12 @@
if ((it->ch == SpecialChars::PARSEP)) {
removeParSep(i);
}
+ if (it->mark != NULL)
+ {
+ delete it->mark;
+ it->mark = NULL;
+ }
+
// qDebug("remove char %d at %d", (int) it->ch.unicode(), i);
d->takeAt(i);
d->len--;
@@ -685,6 +691,31 @@
return result;
}
+
+GlyphLayout* StoryText::getGlyphs(int pos)
+{
+ if (pos < 0)
+ pos += length();
+
+ assert(pos >= 0);
+ assert(pos < length());
+
+ assert((this->d->at(pos)->glyph).scaleH > 0.5);
+ return &(this->d->at(pos)->glyph);
+}
+
+const GlyphLayout* StoryText::getGlyphs(int pos) const
+{
+ if (pos < 0)
+ pos += length();
+
+ assert(pos >= 0);
+ assert(pos < length());
+
+ assert( (const_cast<StoryText *>(this)->d->at(pos)->glyph).scaleH > 0.5);
+ return &(const_cast<StoryText *>(this)->d->at(pos)->glyph);
+}
+
QChar StoryText::text() const
{
return text(d->cursorPosition);
@@ -775,7 +806,7 @@
return that->d->at(pos)->getItem(m_doc);
}
-bool StoryText::hasMark(int pos) const
+bool StoryText::hasMark(int pos, Mark* mrk) const
{
if (pos < 0)
pos += length();
@@ -785,7 +816,7 @@
StoryText* that = const_cast<StoryText *>(this);
if (that->d->at(pos)->ch == SpecialChars::OBJECT)
- return that->d->at(pos)->hasMark();
+ return that->d->at(pos)->hasMark(mrk);
return false;
}
@@ -800,6 +831,67 @@
StoryText* that = const_cast<StoryText *>(this);
return that->d->at(pos)->mark;
}
+
+
+void StoryText::replaceMark(int pos, Mark* mrk)
+{
+ if (pos < 0)
+ pos += length();
+
+ assert(pos >= 0);
+ assert(pos < length());
+
+ this->d->at(pos)->mark = mrk;
+}
+
+
+LayoutFlags StoryText::flags(int pos) const
+{
+ if (pos < 0)
+ pos += length();
+
+ assert(pos >= 0);
+ assert(pos < length());
+
+ StoryText* that = const_cast<StoryText *>(this);
+ return static_cast<LayoutFlags>((*that->d->at(pos)).effects().value & ScStyle_NonUserStyles);
+}
+
+bool StoryText::hasFlag(int pos, LayoutFlags flags) const
+{
+ if (pos < 0)
+ pos += length();
+
+ assert(pos >= 0);
+ assert(pos < length());
+ assert(flags & ScStyle_UserStyles == ScStyle_None);
+
+ return (flags & d->at(pos)->effects().value) == flags;
+}
+
+void StoryText::setFlag(int pos, LayoutFlags flags)
+{
+ if (pos < 0)
+ pos += length();
+
+ assert(pos >= 0);
+ assert(pos < length());
+ assert(flags & ScStyle_UserStyles == ScStyle_None);
+
+ d->at(pos)->setEffects(flags | d->at(pos)->effects().value);
+}
+
+void StoryText::clearFlag(int pos, LayoutFlags flags)
+{
+ if (pos < 0)
+ pos += length();
+
+ assert(pos >= 0);
+ assert(pos < length());
+
+ d->at(pos)->setEffects(~(flags & ScStyle_NonUserStyles) & d->at(pos)->effects().value);
+}
+
const CharStyle & StoryText::charStyle() const
{
@@ -1689,7 +1781,7 @@
void StoryText::invalidateAll()
{
d->pstyleContext.invalidate();
- invalidate(0, nrOfItems());
+ invalidate(0, length());
}
void StoryText::invalidate(int firstItem, int endItem)
@@ -1766,7 +1858,7 @@
continue;
if (ls.firstItem <= pos) {
/*
- if (ls.lastItem == pos && (item(pos)->effects() & ScStyle_SuppressSpace) )
+ if (ls.lastItem == pos && (item(pos)->effects() & ScLayout_SuppressSpace) )
{
if (i+1 < lines())
{
@@ -1816,18 +1908,6 @@
return result;
}
-int StoryText::layout(int startItem)
-{
- //FIXME:NLS
- return -1;
-}
-
-
-uint StoryText::nrOfItems() const
-{
- return length();
-}
-
ScText* StoryText::item(uint itm)
{
@@ -1843,36 +1923,36 @@
}
-const QString StoryText::itemText(uint itm) const
-{
-
- assert( static_cast<int>(itm) < length() );
-
- return text(itm, 1);
-}
-
-
-const CharStyle StoryText::itemStyle(uint itm) const
-{
- assert( static_cast<int>(itm) < length() );
-
- return charStyle(itm);
-}
-
-
-int StoryText::startOfItem(uint itm) const
-{
- assert( static_cast<int>(itm) < length() );
-
- return itm;
-}
-
-int StoryText::endOfItem(uint itm) const
-{
- assert( static_cast<int>(itm) < length() );
-
- return itm + 1;
-}
+//const QString StoryText::itemText(uint itm) const
+//{
+
+// assert( static_cast<int>(itm) < length() );
+
+// return text(itm, 1);
+//}
+
+
+//const CharStyle StoryText::itemStyle(uint itm) const
+//{
+// assert( static_cast<int>(itm) < length() );
+
+// return charStyle(itm);
+//}
+
+
+//int StoryText::startOfItem(uint itm) const
+//{
+// assert( static_cast<int>(itm) < length() );
+
+// return itm;
+//}
+
+//int StoryText::endOfItem(uint itm) const
+//{
+// assert( static_cast<int>(itm) < length() );
+
+// return itm + 1;
+//}
using namespace desaxe;
@@ -2065,16 +2145,15 @@
if (toInsert > 0)
obj->insertChars(obj->length(), txt.mid(lastPos, toInsert));
len = obj->length();
- ScText* lastItem = obj->item(len-1);
// qreal SHY means user provided SHY, single SHY is automatic one
- if (lastItem->effects() & ScStyle_HyphenationPossible)
+ if (obj->hasFlag(len-1, ScLayout_HyphenationPossible))
{
- lastItem->setEffects(lastItem->effects() & ~ScStyle_HyphenationPossible);
+ obj->clearFlag(len-1, ScLayout_HyphenationPossible);
obj->insertChars(len, QString(chr));
}
else
{
- lastItem->setEffects(lastItem->effects() | ScStyle_HyphenationPossible);
+ obj->setFlag(len-1, ScLayout_HyphenationPossible);
}
lastPos = i + 1;
}
Modified: trunk/Scribus/scribus/text/storytext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h (original)
+++ trunk/Scribus/scribus/text/storytext.h Fri Oct 4 17:40:08 2013
@@ -40,11 +40,6 @@
#include "styles/paragraphstyle.h"
#include "desaxe/saxio.h"
-#ifdef NLS_CONFORMANCE
-#define NLS_PRIVATE private
-#else
-#define NLS_PRIVATE public
-#endif
class CharStyle;
class ParagraphStyle;
@@ -164,18 +159,10 @@
bool hasObject(int pos) const;
PageItem* object(int pos) const;
- bool hasMark(int pos) const;
+ bool hasMark(int pos, Mark* mrk = NULL) const;
Mark *mark(int pos) const;
-
- int nextCharPos(int c);
- int prevCharPos(int c);
- int nextWordPos(int c);
- int prevWordPos(int c);
- int nextLinePos(int c, qreal oldX);
- int prevLinePos(int c, qreal oldX);
- int nextFramePos(int c);
- int prevFramePos(int c);
-
+ void replaceMark(int pos, Mark* mrk);
+
// Get charstyle at current cursor position
const CharStyle& charStyle() const;
// Get charstyle at specific position
@@ -252,6 +239,15 @@
int lengthOfSelection() const;
+// layout helpers
+
+ GlyphLayout* getGlyphs(int pos);
+ const GlyphLayout* getGlyphs(int pos) const;
+ LayoutFlags flags(int pos) const;
+ bool hasFlag(int pos, LayoutFlags flag) const;
+ void setFlag(int pos, LayoutFlags flag);
+ void clearFlag(int pos, LayoutFlags flag);
+
// when physical view doesn't match logical view any more:
/// call this if the shape of an embedded object changes (redos layout)
@@ -266,31 +262,11 @@
signals:
void changed();
-public:
-// physical view
-
- bool overflows() const;
- /// layouts the text -- FIXME: better interface for this
- int layout(int startItem);
- uint nrOfItems() const;
-//private:
+private:
ScText * item(uint index);
const ScText * item(uint index) const;
public:
ScText * item_p(uint index) { return item(index); }
-// void bidiReorder(uint firstItem, uint lastItem, uint indices[]) const;
- /** returns the Unicode string which belongs to this ScScriptItem */
- const QString itemText(uint index) const;
- /** returns the CharStyle which belongs to this ScScriptItem */
- const CharStyle itemStyle(uint index) const;
- /// returns the character postion at the start of this item
- int startOfItem(uint index) const;
- /// returns the character position after this item
- int endOfItem(uint index) const;
-// const ScTextEngine * engineForRun(uint index) const;
-// const ScTextEngine * engineForItem(uint index) const;
-
-// ParagraphLayout layouter;
int screenToPosition(FPoint coord) const;
FRect boundingBox(int pos, uint len = 1) const;
Modified: trunk/Scribus/scribus/ui/contextmenu.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/contextmenu.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/contextmenu.cpp (original)
+++ trunk/Scribus/scribus/ui/contextmenu.cpp Fri Oct 4 17:40:08 2013
@@ -188,8 +188,7 @@
}
if (currItem->itemText.cursorPosition() < currItem->itemText.length())
{
- ScText *hl = currItem->itemText.item(currItem->itemText.cursorPosition());
- if (hl->hasMark())
+ if (currItem->itemText.hasMark(currItem->itemText.cursorPosition()))
addAction(m_ScMW->scrActions["editMark"]);
}
}
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Fri Oct 4 17:40:08 2013
@@ -62,7 +62,6 @@
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
#include "dasheditor.h"
#include "fontcombo.h"
#include "colorcombo.h"
Modified: trunk/Scribus/scribus/ui/propertiespalette_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/propertiespalette_group.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_group.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_group.cpp Fri Oct 4 17:40:08 2013
@@ -57,7 +57,6 @@
#include "util_icon.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
#include "ui/autoform.h"
#include "ui/nodeeditpalette.h"
#include "ui/propertiespalette.h"
Modified: trunk/Scribus/scribus/ui/propertiespalette_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/propertiespalette_line.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_line.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_line.cpp Fri Oct 4 17:40:08 2013
@@ -28,7 +28,6 @@
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
#include "ui/propertiespalette_utils.h"
//using namespace std;
Modified: trunk/Scribus/scribus/ui/propertiespalette_shape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/propertiespalette_shape.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_shape.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_shape.cpp Fri Oct 4 17:40:08 2013
@@ -29,7 +29,6 @@
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
#include "ui/nodeeditpalette.h"
#include "ui/propertiespalette_utils.h"
Modified: trunk/Scribus/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.cpp Fri Oct 4 17:40:08 2013
@@ -41,7 +41,6 @@
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
#include "fontcombo.h"
#include "colorcombo.h"
Modified: trunk/Scribus/scribus/ui/propertiespalette_utils.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/propertiespalette_utils.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_utils.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_utils.cpp Fri Oct 4 17:40:08 2013
@@ -37,7 +37,6 @@
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
//using namespace std;
Modified: trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp Fri Oct 4 17:40:08 2013
@@ -36,7 +36,6 @@
#include "util.h"
#include "util_icon.h"
#include "util_math.h"
-#include "text/nlsconfig.h"
//using namespace std;
Modified: trunk/Scribus/scribus/ui/search.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/search.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/search.cpp (original)
+++ trunk/Scribus/scribus/ui/search.cpp Fri Oct 4 17:40:08 2013
@@ -35,7 +35,6 @@
#include "util.h"
#include "util_icon.h"
#include "util_text.h"
-#include "text/nlsconfig.h"
SearchReplace::SearchReplace( QWidget* parent, ScribusDoc *doc, PageItem* ite, bool mode )
: QDialog( parent ),
@@ -308,7 +307,7 @@
connect( RFillS, SIGNAL( clicked() ), this, SLOT( enableFillSReplace() ) );
connect( RStrokeS, SIGNAL( clicked() ), this, SLOT( enableStrokeSReplace() ) );
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
-
+
//tooltips
DoSearch->setToolTip( tr( "Search for text or formatting in the current text" ) );
DoReplace->setToolTip( tr( "Replace the searched for formatting with the replacement values" ) );
@@ -458,13 +457,13 @@
if (m_item->itemText.charStyle(a).font().scName() != sFont)
found = false;
}
-#ifndef NLS_PROTO
+
if (SStyle->isChecked())
{
if (m_item->itemText.paragraphStyle(a).parent() != m_doc->paragraphStyles()[sStyle].name())
found = false;
}
-#endif
+
if (SAlign->isChecked())
{
if (m_item->itemText.paragraphStyle(a).alignment() != sAlign)
@@ -690,7 +689,7 @@
for (cs = 0; cs < sear.length(); ++cs)
m_item->itemText.replaceChar(m_replStart+cs, repl[cs]);
for (cx = cs; cx < repl.length(); ++cx)
- m_item->itemText.insertChars(m_replStart+cx, repl.mid(cx,1), true);
+ m_item->itemText.insertChars(m_replStart+cx, repl.mid(cx,1), true);
// FIXME:NLS also replace styles!!
}
else
@@ -729,20 +728,21 @@
m_doc->itemSelection_SetFontSize(qRound(RSizeVal->value() * 10.0));
if (REffect->isChecked())
{
-#ifndef NLS_PROTO
- int s = REffVal->getStyle();
+ int s = REffVal->getStyle() & ScStyle_UserStyles;
m_doc->currentStyle.charStyle().setFeatures(static_cast<StyleFlag>(s).featureList()); // ???
for (int a = 0; a < m_item->itemText.length(); ++a)
{
if (m_item->itemText.selected(a))
{
- StyleFlag fl = m_item->itemText.item(a)->effects();
- fl &= static_cast<StyleFlag>(~1919);
- fl |= static_cast<StyleFlag>(s);
- m_item->itemText.item(a)->setFeatures(fl.featureList());
+// StyleFlag fl = m_item->itemText.charStyle(a).effects();
+// fl &= static_cast<StyleFlag>(~1919);
+// fl |= static_cast<StyleFlag>(s);
+// m_item->itemText.item(a)->setFeatures(fl.featureList());
+ CharStyle newFeatures;
+ newFeatures.setFeatures(static_cast<StyleFlag>(s).featureList());
+ m_item->itemText.applyCharStyle(a, 1, newFeatures);
}
}
-#endif
}
m_item->itemText.deselectAll();
}
Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18524&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Fri Oct 4 17:40:08 2013
@@ -78,7 +78,6 @@
#include "styleitem.h"
//#include "ui/stylemanager.h"
#include "styleselect.h"
-#include "text/nlsconfig.h"
#include "units.h"
#include "util.h"
#include "util_icon.h"
@@ -178,7 +177,7 @@
while ((pos1 <= pos2) && (pos1 < editor->StyledText.length()))
{
paraInfo.first = pos1;
- if (editor->StyledText.item(pos1)->ch == SpecialChars::PARSEP)
+ if (editor->StyledText.text(pos1) == SpecialChars::PARSEP)
{
paraInfo.second = pos1;
pos1 += 1;
More information about the scribus-commit
mailing list