|
|
|
@ -177,7 +177,7 @@ bool TQTextCommandHistory::isUndoAvailable()
|
|
|
|
|
|
|
|
|
|
bool TQTextCommandHistory::isRedoAvailable()
|
|
|
|
|
{
|
|
|
|
|
return current > -1 && current < (int)history.count() - 1 || current == -1 && history.count() > 0;
|
|
|
|
|
return ( current > -1 && current < (int)history.count() - 1 ) || ( current == -1 && history.count() > 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
@ -2127,11 +2127,12 @@ void TQTextDocument::setRichTextMarginsInternal( TQPtrList< TQPtrVector<TQStyleS
|
|
|
|
|
stylesPar->utm = 0;
|
|
|
|
|
} else {
|
|
|
|
|
m = TQMAX(0, item->margin( TQStyleSheetItem::MarginTop ) );
|
|
|
|
|
if ( stylesPar->ldepth )
|
|
|
|
|
if ( stylesPar->ldepth ) {
|
|
|
|
|
if ( item->displayMode() == TQStyleSheetItem::DisplayListItem )
|
|
|
|
|
m /= stylesPar->ldepth * stylesPar->ldepth;
|
|
|
|
|
else
|
|
|
|
|
m = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for ( i = (int)curStyle->size() - 2 ; i >= 0; --i ) {
|
|
|
|
|
item = (*curStyle)[ i ];
|
|
|
|
@ -2155,11 +2156,12 @@ void TQTextDocument::setRichTextMarginsInternal( TQPtrList< TQPtrVector<TQStyleS
|
|
|
|
|
stylesPar->ubm = 0;
|
|
|
|
|
} else {
|
|
|
|
|
m = TQMAX(0, item->margin( TQStyleSheetItem::MarginBottom ) );
|
|
|
|
|
if ( stylesPar->ldepth )
|
|
|
|
|
if ( stylesPar->ldepth ) {
|
|
|
|
|
if ( item->displayMode() == TQStyleSheetItem::DisplayListItem )
|
|
|
|
|
m /= stylesPar->ldepth * stylesPar->ldepth;
|
|
|
|
|
else
|
|
|
|
|
m = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for ( i = (int)curStyle->size() - 2 ; i >= 0; --i ) {
|
|
|
|
|
item = (*curStyle)[ i ];
|
|
|
|
@ -2243,7 +2245,7 @@ void TQTextDocument::setText( const TQString &text, const TQString &context )
|
|
|
|
|
{
|
|
|
|
|
focusIndicator.parag = 0;
|
|
|
|
|
selections.clear();
|
|
|
|
|
if ( txtFormat == TQt::AutoText && TQStyleSheet::mightBeRichText( text ) ||
|
|
|
|
|
if ( ( txtFormat == TQt::AutoText && TQStyleSheet::mightBeRichText( text ) ) ||
|
|
|
|
|
txtFormat == TQt::RichText )
|
|
|
|
|
setRichText( text, context );
|
|
|
|
|
else
|
|
|
|
@ -2459,7 +2461,7 @@ TQString TQTextDocument::richText() const
|
|
|
|
|
|
|
|
|
|
TQString TQTextDocument::text() const
|
|
|
|
|
{
|
|
|
|
|
if ( txtFormat == TQt::AutoText && preferRichText || txtFormat == TQt::RichText )
|
|
|
|
|
if ( ( txtFormat == TQt::AutoText && preferRichText ) || txtFormat == TQt::RichText )
|
|
|
|
|
return richText();
|
|
|
|
|
return plainText();
|
|
|
|
|
}
|
|
|
|
@ -2470,7 +2472,7 @@ TQString TQTextDocument::text( int parag ) const
|
|
|
|
|
if ( !p )
|
|
|
|
|
return TQString::null;
|
|
|
|
|
|
|
|
|
|
if ( txtFormat == TQt::AutoText && preferRichText || txtFormat == TQt::RichText )
|
|
|
|
|
if ( ( txtFormat == TQt::AutoText && preferRichText ) || txtFormat == TQt::RichText )
|
|
|
|
|
return p->richText();
|
|
|
|
|
else
|
|
|
|
|
return p->string()->toString();
|
|
|
|
@ -2609,12 +2611,12 @@ bool TQTextDocument::setSelectionEnd( int id, const TQTextCursor &cursor )
|
|
|
|
|
hadOldEnd = TRUE;
|
|
|
|
|
|
|
|
|
|
if ( !sel.swapped &&
|
|
|
|
|
( hadEnd && !hadStart ||
|
|
|
|
|
hadEnd && hadStart && start.paragraph() == end.paragraph() && start.index() > end.index() ) )
|
|
|
|
|
( ( hadEnd && !hadStart ) ||
|
|
|
|
|
( hadEnd && hadStart && start.paragraph() == end.paragraph() && start.index() > end.index() ) ) )
|
|
|
|
|
sel.swapped = TRUE;
|
|
|
|
|
|
|
|
|
|
if ( c == end && hadStartParag ||
|
|
|
|
|
c == start && hadEndParag ) {
|
|
|
|
|
if ( ( c == end && hadStartParag ) ||
|
|
|
|
|
( c == start && hadEndParag ) ) {
|
|
|
|
|
TQTextCursor tmp = c;
|
|
|
|
|
tmp.restoreState();
|
|
|
|
|
if ( tmp.paragraph() != c.paragraph() ) {
|
|
|
|
@ -2625,7 +2627,7 @@ bool TQTextDocument::setSelectionEnd( int id, const TQTextCursor &cursor )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( inSelection &&
|
|
|
|
|
( c == end && hadStart || c == start && hadEnd ) )
|
|
|
|
|
( ( c == end && hadStart ) || ( c == start && hadEnd ) ) )
|
|
|
|
|
leftSelection = TRUE;
|
|
|
|
|
else if ( !leftSelection && !inSelection && ( hadStart || hadEnd ) )
|
|
|
|
|
inSelection = TRUE;
|
|
|
|
@ -3253,7 +3255,7 @@ void TQTextDocument::drawParagraph( TQPainter *p, TQTextParagraph *parag, int cx
|
|
|
|
|
TQTextParagraph *TQTextDocument::draw( TQPainter *p, int cx, int cy, int cw, int ch, const TQColorGroup &cg,
|
|
|
|
|
bool onlyChanged, bool drawCursor, TQTextCursor *cursor, bool resetChanged )
|
|
|
|
|
{
|
|
|
|
|
if ( withoutDoubleBuffer || par && par->withoutDoubleBuffer ) {
|
|
|
|
|
if ( withoutDoubleBuffer || ( par && par->withoutDoubleBuffer ) ) {
|
|
|
|
|
withoutDoubleBuffer = TRUE;
|
|
|
|
|
TQRect r;
|
|
|
|
|
draw( p, r, cg );
|
|
|
|
@ -4754,7 +4756,7 @@ void TQTextParagraph::drawString( TQPainter &painter, const TQString &str, int s
|
|
|
|
|
bool plainText = hasdoc ? document()->textFormat() == TQt::PlainText : FALSE;
|
|
|
|
|
TQTextFormat* format = formatChar->format();
|
|
|
|
|
|
|
|
|
|
if ( !plainText || hasdoc && format->color() != document()->formatCollection()->defaultFormat()->color() )
|
|
|
|
|
if ( !plainText || ( hasdoc && format->color() != document()->formatCollection()->defaultFormat()->color() ) )
|
|
|
|
|
painter.setPen( TQPen( format->color() ) );
|
|
|
|
|
else
|
|
|
|
|
painter.setPen( cg.text() );
|
|
|
|
@ -4848,9 +4850,9 @@ void TQTextParagraph::drawString( TQPainter &painter, const TQString &str, int s
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selStart < real_selEnd ||
|
|
|
|
|
selWrap && fullSelectionWidth && extendRight &&
|
|
|
|
|
(selWrap && fullSelectionWidth && extendRight &&
|
|
|
|
|
// don't draw the standard selection on a printer=
|
|
|
|
|
(it.key() != TQTextDocument::Standard || !is_printer( &painter))) {
|
|
|
|
|
(it.key() != TQTextDocument::Standard || !is_printer( &painter)))) {
|
|
|
|
|
int selection = it.key();
|
|
|
|
|
TQColor color;
|
|
|
|
|
setColorForSelection( color, painter, cg, selection );
|
|
|
|
@ -4904,10 +4906,10 @@ void TQTextParagraph::drawString( TQPainter &painter, const TQString &str, int s
|
|
|
|
|
|
|
|
|
|
if ( hasdoc && formatChar->isAnchor() && !formatChar->anchorHref().isEmpty() &&
|
|
|
|
|
document()->focusIndicator.parag == this &&
|
|
|
|
|
( document()->focusIndicator.start >= start &&
|
|
|
|
|
document()->focusIndicator.start + document()->focusIndicator.len <= start + len ||
|
|
|
|
|
document()->focusIndicator.start <= start &&
|
|
|
|
|
document()->focusIndicator.start + document()->focusIndicator.len >= start + len ) )
|
|
|
|
|
( ( document()->focusIndicator.start >= start &&
|
|
|
|
|
document()->focusIndicator.start + document()->focusIndicator.len <= start + len ) ||
|
|
|
|
|
( document()->focusIndicator.start <= start &&
|
|
|
|
|
document()->focusIndicator.start + document()->focusIndicator.len >= start + len ) ) )
|
|
|
|
|
painter.drawWinFocusRect( TQRect( xstart, y, w, h ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -5652,8 +5654,8 @@ int TQTextFormatterBreakInWords::format( TQTextDocument *doc,TQTextParagraph *pa
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if ( wrapEnabled &&
|
|
|
|
|
( wrapAtColumn() == -1 && x + ww > w ||
|
|
|
|
|
wrapAtColumn() != -1 && col >= wrapAtColumn() ) ) {
|
|
|
|
|
( ( wrapAtColumn() == -1 && x + ww > w ) ||
|
|
|
|
|
( wrapAtColumn() != -1 && col >= wrapAtColumn() ) ) ) {
|
|
|
|
|
x = doc ? parag->document()->flow()->adjustLMargin( y + parag->rect().y(), parag->rect().height(), left, 4 ) : left;
|
|
|
|
|
w = dw;
|
|
|
|
|
y += h;
|
|
|
|
@ -5798,7 +5800,7 @@ int TQTextFormatterBreakWords::format( TQTextDocument *doc, TQTextParagraph *par
|
|
|
|
|
x -= rb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( i > 0 && (x > curLeft || ww == 0) || lastWasNonInlineCustom ) {
|
|
|
|
|
if ( ( i > 0 && (x > curLeft || ww == 0) ) || lastWasNonInlineCustom ) {
|
|
|
|
|
c->lineStart = 0;
|
|
|
|
|
} else {
|
|
|
|
|
c->lineStart = 1;
|
|
|
|
@ -7733,7 +7735,7 @@ void TQTextTable::draw(TQPainter* p, int x, int y, int cx, int cy, int cw, int c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (TQTextTableCell* cell = cells.first(); cell; cell = cells.next() ) {
|
|
|
|
|
if ( cx < 0 && cy < 0 ||
|
|
|
|
|
if ( ( cx < 0 && cy < 0 ) ||
|
|
|
|
|
TQRect( cx, cy, cw, ch ).intersects( TQRect( x + outerborder + cell->geometry().x(),
|
|
|
|
|
y + outerborder + cell->geometry().y(),
|
|
|
|
|
cell->geometry().width(), cell->geometry().height() ) ) ) {
|
|
|
|
|