summaryrefslogtreecommitdiffstats
path: root/kword/KWVariable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kword/KWVariable.cpp')
-rw-r--r--kword/KWVariable.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/kword/KWVariable.cpp b/kword/KWVariable.cpp
index 675f22b1b..1b4638788 100644
--- a/kword/KWVariable.cpp
+++ b/kword/KWVariable.cpp
@@ -37,8 +37,8 @@
KWVariableSettings::KWVariableSettings() : KoVariableSettings()
{
- m_footNoteCounter.setSuffix( QString::null );
- m_endNoteCounter.setSuffix( QString::null );
+ m_footNoteCounter.setSuffix( TQString() );
+ m_endNoteCounter.setSuffix( TQString() );
// By default endnotes are numbered in lowercase roman numbers, in other WPs.
m_endNoteCounter.setStyle( KoParagCounter::STYLE_ROM_NUM_L );
}
@@ -70,21 +70,21 @@ void KWVariableSettings::saveNoteConfiguration( KoXmlWriter& writer ) const
writer.endElement();
}
-void KWVariableSettings::loadNoteConfiguration( const QDomElement& parent )
+void KWVariableSettings::loadNoteConfiguration( const TQDomElement& tqparent )
{
- QDomElement e;
- forEachElement( e, parent )
+ TQDomElement e;
+ forEachElement( e, tqparent )
{
if ( e.localName() == "notes-configuration" && e.namespaceURI() == KoXmlNS::text )
{
- const QString noteClass = e.attributeNS( KoXmlNS::text, "note-class", QString::null );
+ const TQString noteClass = e.attributeNS( KoXmlNS::text, "note-class", TQString() );
if ( noteClass == "footnote" ) {
- m_footNoteCounter.loadOasisListStyle( e, QDomElement(), QDomElement(), -1, true, false, 1, false );
+ m_footNoteCounter.loadOasisListStyle( e, TQDomElement(), TQDomElement(), -1, true, false, 1, false );
m_footNoteCounter.setNumbering( KoParagCounter::NUM_FOOTNOTE );
m_footNoteCounter.setRestartCounter( false );
}
else if ( noteClass == "endnote" ) {
- m_endNoteCounter.loadOasisListStyle( e, QDomElement(), QDomElement(), -1, true, false, 1, false );
+ m_endNoteCounter.loadOasisListStyle( e, TQDomElement(), TQDomElement(), -1, true, false, 1, false );
m_endNoteCounter.setNumbering( KoParagCounter::NUM_FOOTNOTE );
m_endNoteCounter.setRestartCounter( false );
}
@@ -92,25 +92,25 @@ void KWVariableSettings::loadNoteConfiguration( const QDomElement& parent )
}
}
-void KWVariableSettings::save( QDomElement &parentElem )
+void KWVariableSettings::save( TQDomElement &tqparentElem )
{
- KoVariableSettings::save( parentElem );
- QDomDocument doc = parentElem.ownerDocument();
- QDomElement footNoteSettingElem = doc.createElement( "FOOTNOTESETTING" );
- parentElem.appendChild( footNoteSettingElem );
+ KoVariableSettings::save( tqparentElem );
+ TQDomDocument doc = tqparentElem.ownerDocument();
+ TQDomElement footNoteSettingElem = doc.createElement( "FOOTNOTESETTING" );
+ tqparentElem.appendChild( footNoteSettingElem );
m_footNoteCounter.save( footNoteSettingElem );
- QDomElement endNoteSettingElem = doc.createElement( "ENDNOTESETTING" );
- parentElem.appendChild( endNoteSettingElem );
+ TQDomElement endNoteSettingElem = doc.createElement( "ENDNOTESETTING" );
+ tqparentElem.appendChild( endNoteSettingElem );
m_endNoteCounter.save( endNoteSettingElem );
}
-void KWVariableSettings::load( QDomElement &elem )
+void KWVariableSettings::load( TQDomElement &elem )
{
KoVariableSettings::load( elem );
- QDomElement footNoteSettings = elem.namedItem( "FOOTNOTESETTING" ).toElement();
+ TQDomElement footNoteSettings = elem.namedItem( "FOOTNOTESETTING" ).toElement();
if ( !footNoteSettings.isNull() )
m_footNoteCounter.load( footNoteSettings );
- QDomElement endNoteSettings = elem.namedItem( "ENDNOTESETTING" ).toElement();
+ TQDomElement endNoteSettings = elem.namedItem( "ENDNOTESETTING" ).toElement();
if ( !endNoteSettings.isNull() )
m_endNoteCounter.load( endNoteSettings );
}
@@ -120,16 +120,16 @@ KWVariableCollection::KWVariableCollection(KWVariableSettings *_setting, KoVaria
{
}
-KoVariable* KWVariableCollection::loadOasisField( KoTextDocument* textdoc, const QDomElement& tag, KoOasisContext& context )
+KoVariable* KWVariableCollection::loadOasisField( KoTextDocument* textdoc, const TQDomElement& tag, KoOasisContext& context )
{
- const QString localName( tag.localName() );
+ const TQString localName( tag.localName() );
const bool isTextNS = tag.namespaceURI() == KoXmlNS::text;
if ( isTextNS )
{
//kdDebug()<<" localName :"<<localName<<endl;
if ( localName == "note" )
{
- QString key = "STRING";
+ TQString key = "STRING";
int type = VT_FOOTNOTE;
return loadOasisFieldCreateVariable( textdoc, tag, context, key, type );
}
@@ -145,7 +145,7 @@ KoVariable* KWVariableCollection::loadOasisField( KoTextDocument* textdoc, const
localName == "non-whitespace-character-count" ||
localName == "syllable-count")
{
- QString key = "NUMBER";
+ TQString key = "NUMBER";
int type = VT_STATISTIC;
return loadOasisFieldCreateVariable( textdoc, tag, context, key, type );
}
@@ -167,7 +167,7 @@ KoVariable *KWVariableCollection::createVariable( int type, short int subtype, K
var = new KWPgNumVariable( textdoc, subtype, varFormat, this, m_doc );
break;
case VT_MAILMERGE:
- var = new KWMailMergeVariable( textdoc, QString::null, coll->format("STRING"), this, m_doc );
+ var = new KWMailMergeVariable( textdoc, TQString(), coll->format("STRING"), this, m_doc );
break;
case VT_FOOTNOTE:
if ( !loadFootNote )
@@ -197,7 +197,7 @@ KWPgNumVariable::KWPgNumVariable( KoTextDocument *textdoc, int subtype, KoVariab
void KWPgNumVariable::recalc()
{
- if ( !m_doc->layoutViewMode()->hasPages() ) // ModeText
+ if ( !m_doc->tqlayoutViewMode()->hasPages() ) // ModeText
{
//necessary to resize it in this mode because in this mode
//we don't call KWTextFrameSet::drawFrame()
@@ -207,7 +207,7 @@ void KWPgNumVariable::recalc()
if ( m_subtype == VST_PGNUM_TOTAL )
{
- m_varValue = QVariant(m_doc->pageCount()+m_varColl->variableSetting()->startingPageNumber()-1);
+ m_varValue = TQVariant(m_doc->pageCount()+m_varColl->variableSetting()->startingPageNumber()-1);
resize();
}
// The other cases are handled by the more dynamic code in KWTextFrameSet::drawFrame()
@@ -216,12 +216,12 @@ void KWPgNumVariable::recalc()
width = 0;
}
-QString KWPgNumVariable::text(bool realValue)
+TQString KWPgNumVariable::text(bool realValue)
{
if (m_varColl->variableSetting()->displayFieldCode()&& !realValue)
return fieldCode();
// #### ??? What?
- else if ( m_subtype != VST_CURRENT_SECTION && !m_doc->layoutViewMode()->hasPages() && !realValue)
+ else if ( m_subtype != VST_CURRENT_SECTION && !m_doc->tqlayoutViewMode()->hasPages() && !realValue)
return fieldCode();
else
return m_varFormat->convert( m_varValue );
@@ -230,22 +230,22 @@ QString KWPgNumVariable::text(bool realValue)
/******************************************************************/
/* Class: KWMailMergeVariable */
/******************************************************************/
-KWMailMergeVariable::KWMailMergeVariable( KoTextDocument *textdoc, const QString &name, KoVariableFormat *varFormat,KoVariableCollection *_varColl, KWDocument *doc )
+KWMailMergeVariable::KWMailMergeVariable( KoTextDocument *textdoc, const TQString &name, KoVariableFormat *varFormat,KoVariableCollection *_varColl, KWDocument *doc )
: KoMailMergeVariable( textdoc, name, varFormat,_varColl ), m_doc(doc)
{
}
-QString KWMailMergeVariable::value() const
+TQString KWMailMergeVariable::value() const
{
return m_doc->mailMergeDataBase()->getValue( m_varValue.toString() );
}
-QString KWMailMergeVariable::text(bool realValue)
+TQString KWMailMergeVariable::text(bool realValue)
{
if (m_varColl->variableSetting()->displayFieldCode()&& !realValue)
return fieldCode();
// ## should use a format maybe
- QString v = value();
+ TQString v = value();
if ( m_doc->mailMergeDataBase()->isSampleRecord() )
return "<" + v + ">";
return v;
@@ -266,7 +266,7 @@ KWFootNoteVariable::KWFootNoteVariable( KoTextDocument *textdoc, KoVariableForma
m_num( -1 ),
m_numDisplay( -1 )
{
- m_varValue = QVariant( QString::null );
+ m_varValue = TQVariant( TQString() );
}
void KWFootNoteVariable::setNumberingType( Numbering _type )
@@ -276,15 +276,15 @@ void KWFootNoteVariable::setNumberingType( Numbering _type )
setVariableFormat(m_doc->variableFormatCollection()->format("STRING"));
}
-void KWFootNoteVariable::loadOasis( const QDomElement& footNoteTag, KoOasisContext& context )
+void KWFootNoteVariable::loadOasis( const TQDomElement& footNoteTag, KoOasisContext& context )
{
/*<text:note text:id="ftn0" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body>
<text:p text:style-name="Footnote"></text:p></text:note-body></text:note> */
- const QString id = footNoteTag.attributeNS( KoXmlNS::text, "id", QString::null );
+ const TQString id = footNoteTag.attributeNS( KoXmlNS::text, "id", TQString() );
if ( footNoteTag.hasAttributeNS( KoXmlNS::text, "note-class" ) )
{
- const QString str = footNoteTag.attributeNS( KoXmlNS::text, "note-class", QString::null );
+ const TQString str = footNoteTag.attributeNS( KoXmlNS::text, "note-class", TQString() );
if ( str == "footnote" )
m_noteType = FootNote;
else if ( str == "endnote" )
@@ -295,14 +295,14 @@ void KWFootNoteVariable::loadOasis( const QDomElement& footNoteTag, KoOasisConte
}
}
- QDomElement element;
- QDomElement bodyElement;
+ TQDomElement element;
+ TQDomElement bodyElement;
forEachElement( element, footNoteTag )
{
if ( element.namespaceURI() != KoXmlNS::text )
continue;
- const QString localName = element.localName();
+ const TQString localName = element.localName();
if( localName == "note-citation" )
{
if ( element.hasAttributeNS( KoXmlNS::text, "label" ) )
@@ -318,7 +318,7 @@ void KWFootNoteVariable::loadOasis( const QDomElement& footNoteTag, KoOasisConte
else
{
// kdDebug()<<" manual \n";
- m_varValue = QVariant( element.text() );
+ m_varValue = TQVariant( element.text() );
}
} else if ( localName == "note-body" ) {
bodyElement = element;
@@ -351,7 +351,7 @@ void KWFootNoteVariable::saveOasis( KoXmlWriter& writer, KoSavingContext& contex
writer.startElement( "text:note-citation" );
if ( m_numberingType == Auto )
- writer.addTextNode( QString( "%1" ).arg( m_numDisplay ) );
+ writer.addTextNode( TQString( "%1" ).tqarg( m_numDisplay ) );
else
{
writer.addAttribute( "text:label", m_varValue.toString() );
@@ -367,10 +367,10 @@ void KWFootNoteVariable::saveOasis( KoXmlWriter& writer, KoSavingContext& contex
writer.endElement();
}
-void KWFootNoteVariable::saveVariable( QDomElement &parentElem )
+void KWFootNoteVariable::saveVariable( TQDomElement &tqparentElem )
{
- QDomElement footnoteElem = parentElem.ownerDocument().createElement( "FOOTNOTE" );
- parentElem.appendChild( footnoteElem );
+ TQDomElement footnoteElem = tqparentElem.ownerDocument().createElement( "FOOTNOTE" );
+ tqparentElem.appendChild( footnoteElem );
//footnoteElem.setAttribute( "subtype", 0 );
if ( m_numberingType == Auto )
footnoteElem.setAttribute( "value", m_numDisplay );
@@ -383,14 +383,14 @@ void KWFootNoteVariable::saveVariable( QDomElement &parentElem )
footnoteElem.setAttribute( "frameset", m_frameset->name() );
}
-void KWFootNoteVariable::load( QDomElement &elem )
+void KWFootNoteVariable::load( TQDomElement &elem )
{
KoVariable::load( elem );
- QDomElement footnoteElem = elem.namedItem( "FOOTNOTE" ).toElement();
+ TQDomElement footnoteElem = elem.namedItem( "FOOTNOTE" ).toElement();
if (!footnoteElem.isNull())
{
//m_subtype = footnoteElem.attribute("subtype").toInt();
- QString str = footnoteElem.attribute("notetype").lower();
+ TQString str = footnoteElem.attribute("notetype").lower();
if ( str == "footnote" )
m_noteType = FootNote;
else if ( str == "endnote" )
@@ -412,7 +412,7 @@ void KWFootNoteVariable::load( QDomElement &elem )
formatedNote();
}
else
- m_varValue = QVariant(footnoteElem.attribute("value"));
+ m_varValue = TQVariant(footnoteElem.attribute("value"));
str = footnoteElem.attribute("frameset");
m_doc->addFootNoteRequest( str, this );
@@ -423,16 +423,16 @@ void KWFootNoteVariable::formatedNote()
{
if ( m_numberingType == Auto )
{
- m_varValue = QVariant(applyStyle());
+ m_varValue = TQVariant(applyStyle());
}
}
-QString KWFootNoteVariable::applyStyle()
+TQString KWFootNoteVariable::applyStyle()
{
KWVariableSettings* settings = static_cast<KWVariableSettings*>(m_varColl->variableSetting());
KoParagCounter tmpCounter = (m_noteType == FootNote) ? settings->footNoteCounter() : settings->endNoteCounter();
- QString tmp;
+ TQString tmp;
int val = m_numDisplay + tmpCounter.startNumber()-1;
Q_ASSERT( val >= 0 );
if ( val < 0 ) // let's not go into makeRomanNumber with a negative number :}
@@ -468,7 +468,7 @@ QString KWFootNoteVariable::applyStyle()
return tmp;
}
-QString KWFootNoteVariable::text(bool realValue)
+TQString KWFootNoteVariable::text(bool realValue)
{
if (m_varColl->variableSetting()->displayFieldCode()&& !realValue)
return fieldCode();
@@ -478,33 +478,33 @@ QString KWFootNoteVariable::text(bool realValue)
void KWFootNoteVariable::setNumDisplay( int val )
{
m_numDisplay = val;
- if ( val != -1 ) // -1 is used to 'invalidate so that renumberFootNotes recalcs'
+ if ( val != -1 ) // -1 is used to 'tqinvalidate so that renumberFootNotes recalcs'
formatedNote();
}
-QString KWFootNoteVariable::fieldCode()
+TQString KWFootNoteVariable::fieldCode()
{
return (noteType()==FootNote) ?i18n("Footnote"):i18n("Endnote");
}
-void KWFootNoteVariable::drawCustomItem( QPainter* p, int x, int y, int wpix, int hpix, int ascentpix, int /*cx*/, int /*cy*/, int /*cw*/, int /*ch*/, const QColorGroup& cg, bool selected, int _offset, bool drawingShadow )
+void KWFootNoteVariable::drawCustomItem( TQPainter* p, int x, int y, int wpix, int hpix, int ascentpix, int /*cx*/, int /*cy*/, int /*cw*/, int /*ch*/, const TQColorGroup& cg, bool selected, int _offset, bool drawingShadow )
{
KoTextFormat * fmt = format();
KoTextZoomHandler * zh = textDocument()->paintingZoomHandler();
// Force drawing as "superscript" - hmm, the formatting will use too big font metrics though.
- QFont font( fmt->screenFont( zh ) );
+ TQFont font( fmt->screenFont( zh ) );
int pointSize = ( ( font.pointSize() * 2 ) / 3 );
font.setPointSize( pointSize );
int offset = _offset;
if ( offset == 0 )
{
- int h = zh->layoutUnitToPixelY( /*_y HACK,*/ height );
- offset = -( h - QFontMetrics(font).height() );
+ int h = zh->tqlayoutUnitToPixelY( /*_y HACK,*/ height );
+ offset = -( h - TQFontMetrics(font).height() );
}
- QColor textColor( fmt->color() );
+ TQColor textColor( fmt->color() );
drawCustomItemHelper( p, x, y, wpix, hpix, ascentpix, cg, selected, offset, fmt, font, textColor, drawingShadow );
}
@@ -532,8 +532,8 @@ void KWFootNoteVariable::finalize()
fs->textObject()->abortFormatting();
// abortFormatting is a bool in kotextobject. So we need to return there before
- // starting text layout again.
- m_doc->delayedRecalcFrames( QMIN( pageNum, framePage ) );
+ // starting text tqlayout again.
+ m_doc->delayedRecalcFrames( TQMIN( pageNum, framePage ) );
m_doc->delayedRepaintAllViews();
}
}
@@ -543,19 +543,19 @@ void KWFootNoteVariable::resize()
if ( m_deleted )
return;
KoTextFormat *fmt = format();
- QFont font( fmt->refFont() ); // LU font
+ TQFont font( fmt->refFont() ); // LU font
if ( fmt->vAlign() == KoTextFormat::AlignNormal ) // if it's still normal...
{
int pointSize = ( ( font.pointSize() * 2 ) / 3 ); // ...force superscript
font.setPointSize( pointSize );
}
- QFontMetrics fm( font );
- QString txt = text();
+ TQFontMetrics fm( font );
+ TQString txt = text();
width = 0;
for ( int i = 0 ; i < (int)txt.length() ; ++i )
width += fm.charWidth( txt, i ); // size at 100%
// zoom to LU
- width = qRound( KoTextZoomHandler::ptToLayoutUnitPt( width ) );
+ width = tqRound( KoTextZoomHandler::ptToLayoutUnitPt( width ) );
height = fmt->height();
m_ascent = fmt->ascent();
//kdDebug() << "KWFootNoteVariable::resize text=" << txt << " width=" << width << " height=" << height << endl;
@@ -596,7 +596,7 @@ void KWFootNoteVariable::setDeleted( bool del )
m_doc->recalcFrames();
if (!del)
- m_frameset->layout(); // format its text, so that it resizes the frame
+ m_frameset->tqlayout(); // format its text, so that it resizes the frame
KoVariable::setDeleted( del );
// Does this compress? Probably not.
m_doc->delayedRepaintAllViews();
@@ -617,17 +617,17 @@ double KWFootNoteVariable::varY() const
if ( !fs->hasFramesInPageArray() ) // we need it for internalToDocument
{
kdDebug(32001) << "KWFootNoteVariable::varY too early, no updateFrames yet" << endl;
- return 0; // this happens on loading - frame layout is done before text layout
+ return 0; // this happens on loading - frame tqlayout is done before text tqlayout
}
- // What we need is "has never been formatted". Not "has just been invalidated"...
+ // What we need is "has never been formatted". Not "has just been tqinvalidated"...
//if ( !paragraph()->isValid() )
//{
// kdDebug(32001) << "KWFootNoteVariable::varY called but paragraph " << paragraph()->paragId() << " not valid" << endl;
// return 0;
//}
KoPoint dPoint;
- //kdDebug(32001) << "KWFootNoteVariable::pageNum position of variable (LU): " << QPoint( x(), paragy + y() + height ) << endl;
- KWFrame* containingFrame = fs->internalToDocument( QPoint( x(), paragy + y() + height ), dPoint );
+ //kdDebug(32001) << "KWFootNoteVariable::pageNum position of variable (LU): " << TQPoint( x(), paragy + y() + height ) << endl;
+ KWFrame* containingFrame = fs->internalToDocument( TQPoint( x(), paragy + y() + height ), dPoint );
if ( containingFrame )
{
// Ok, the (bottom of the) footnote variable is at dPoint.
@@ -663,7 +663,7 @@ void KWStatisticVariable::recalc()
m_subtype == VST_STATISTIC_NB_SENTENCE ||
m_subtype == VST_STATISTIC_NB_LINES ||
m_subtype == VST_STATISTIC_NB_CHARACTERE);
- QPtrListIterator<KWFrameSet> framesetIt( m_doc->framesetsIterator() );
+ TQPtrListIterator<KWFrameSet> framesetIt( m_doc->framesetsIterator() );
//TODO change int to ulong
for ( framesetIt.toFirst(); framesetIt.current(); ++framesetIt )
{
@@ -724,13 +724,13 @@ void KWStatisticVariable::recalc()
nb = 0;
}
}
- m_varValue = QVariant(nb);
+ m_varValue = TQVariant(nb);
resize();
if ( width == -1 )
width = 0;
}
-QString KWStatisticVariable::text(bool realValue)
+TQString KWStatisticVariable::text(bool realValue)
{
if ( m_varColl->variableSetting()->displayFieldCode() && !realValue )
return fieldCode();