diff options
Diffstat (limited to 'kchart/kchart_params.cc')
-rw-r--r-- | kchart/kchart_params.cc | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/kchart/kchart_params.cc b/kchart/kchart_params.cc index 2eb70136..ddf3d1b4 100644 --- a/kchart/kchart_params.cc +++ b/kchart/kchart_params.cc @@ -34,7 +34,7 @@ using std::cerr; #include <KoDom.h> #include <KoOasisLoadingContext.h> -#include <qregexp.h> +#include <tqregexp.h> #include "kdchart/KDChartParams.h" #include "kdchart/KDChartAxisParams.h" @@ -73,7 +73,7 @@ KChartParams::~KChartParams() // ---------------------------------------------------------------- -QString KChartParams::chartTypeToString( ChartType _type) const +TQString KChartParams::chartTypeToString( ChartType _type) const { #if 0 if (_type == BarLines ) @@ -85,7 +85,7 @@ QString KChartParams::chartTypeToString( ChartType _type) const KChartParams::ChartType -KChartParams::stringToChartType( const QString& _string ) +KChartParams::stringToChartType( const TQString& _string ) { #if 0 if ( _string == "BarLines" ) @@ -169,7 +169,7 @@ static const unsigned int numOasisChartTypes styleStack.setTypeProperties( "graphic" ); // load graphic-properties loadingContext.fillStyleStack( chartElem, KoXmlNS::chart, "style-name" ); - const QString fillColor = styleStack.attributeNS( KoXmlNS::draw, "fill-color" ); + const TQString fillColor = styleStack.attributeNS( KoXmlNS::draw, "fill-color" ); kDebug() << "fillColor=" << fillColor << endl; styleStack.restore(); @@ -178,7 +178,7 @@ static const unsigned int numOasisChartTypes // Load the data from an OpenDocument chart:chart element. -void KChartParams::loadOasisFont( KoOasisLoadingContext& context, QFont& font, QColor& color ) +void KChartParams::loadOasisFont( KoOasisLoadingContext& context, TQFont& font, TQColor& color ) { KoStyleStack& styleStack = context.styleStack(); styleStack.setTypeProperties( "text" ); // load all style attributes from "style:text-properties" @@ -189,7 +189,7 @@ void KChartParams::loadOasisFont( KoOasisLoadingContext& context, QFont& font, Q if ( styleStack.hasAttributeNS( KoXmlNS::fo, "font-family" ) // 3.10.9 || styleStack.hasAttributeNS( KoXmlNS::style, "font-name" ) ) { // 3.10.8 // Hmm, the remove "'" could break it's in the middle of the fontname... - QString fontName = styleStack.attributeNS( KoXmlNS::fo, "font-family" ).remove( "'" ); + TQString fontName = styleStack.attributeNS( KoXmlNS::fo, "font-family" ).remove( "'" ); if ( fontName.isEmpty() ) { // ##### TODO. This is wrong. style:font-name refers to a font-decl entry. // We have to look it up there, and retrieve _all_ font attributes from it, not just the name. @@ -200,7 +200,7 @@ void KChartParams::loadOasisFont( KoOasisLoadingContext& context, QFont& font, Q if ( fontName == "Thorndale" ) fontName = "Times New Roman"; - fontName.remove( QRegExp( "\\sCE$" ) ); // Arial CE -> Arial + fontName.remove( TQRegExp( "\\sCE$" ) ); // Arial CE -> Arial font.setFamily( fontName ); } if ( styleStack.hasAttributeNS( KoXmlNS::fo, "font-size" ) ) { // 3.10.14 @@ -209,14 +209,14 @@ void KChartParams::loadOasisFont( KoOasisLoadingContext& context, QFont& font, Q kdDebug(35001) << "font size: " << pointSize << endl; } if ( styleStack.hasAttributeNS( KoXmlNS::fo, "font-weight" ) ) { // 3.10.24 - QString fontWeight = styleStack.attributeNS( KoXmlNS::fo, "font-weight" ); + TQString fontWeight = styleStack.attributeNS( KoXmlNS::fo, "font-weight" ); int boldness; if ( fontWeight == "normal" ) boldness = 50; else if ( fontWeight == "bold" ) boldness = 75; else - // XSL/CSS has 100,200,300...900. Not the same scale as Qt! + // XSL/CSS has 100,200,300...900. Not the same scale as TQt! // See http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#font-weight boldness = fontWeight.toInt() / 10; font.setWeight( boldness ); @@ -229,13 +229,13 @@ void KChartParams::loadOasisFont( KoOasisLoadingContext& context, QFont& font, Q } } -bool KChartParams::loadOasis( const QDomElement &chartElem, +bool KChartParams::loadOasis( const TQDomElement &chartElem, KoOasisLoadingContext &loadingContext, - QString &errorMessage, + TQString &errorMessage, KoStore */*store*/ ) { - const QString chartClass = chartElem.attributeNS( KoXmlNS::chart, - "class", QString::null ); + const TQString chartClass = chartElem.attributeNS( KoXmlNS::chart, + "class", TQString() ); bool knownType = false; // Find out what KChart charttype the OASIS charttype corresponds to. @@ -252,74 +252,74 @@ bool KChartParams::loadOasis( const QDomElement &chartElem, // If we can't find out what charttype it is, we might as well end here. if ( !knownType ) { - errorMessage = i18n( "Unknown chart type %1" ).arg( chartClass ); + errorMessage = i18n( "Unknown chart type %1" ).tqarg( chartClass ); kdDebug(35001) << errorMessage << endl; return false; } // Title TODO (more details, e.g. font, placement etc) - QDomElement titleElem = KoDom::namedItemNS( chartElem, + TQDomElement titleElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, "title" ); if ( !titleElem.isNull() ) { loadingContext.styleStack().save(); loadingContext.fillStyleStack( titleElem, KoXmlNS::chart, "style-name", "chart" ); - QFont font; - QColor color; + TQFont font; + TQColor color; loadOasisFont( loadingContext, font, color ); setHeaderFooterFont( KDChartParams::HdFtPosHeader, font, true, font.pointSize()*4 ); setHeaderFooterColor( KDChartParams::HdFtPosHeader, color ); loadingContext.styleStack().restore(); - QDomElement pElem = KoDom::namedItemNS( titleElem, + TQDomElement pElem = KoDom::namedItemNS( titleElem, KoXmlNS::text, "p" ); setHeader1Text( pElem.text() ); } // Subtitle TODO (more details) - QDomElement subtitleElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, + TQDomElement subtitleElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, "subtitle" ); if ( !subtitleElem.isNull() ) { loadingContext.styleStack().save(); loadingContext.fillStyleStack( subtitleElem, KoXmlNS::chart, "style-name", "chart" ); - QFont font; - QColor color; + TQFont font; + TQColor color; loadOasisFont( loadingContext, font, color ); setHeaderFooterFont( KDChartParams::HdFtPosHeader2, font, true, font.pointSize()*4 ); setHeaderFooterColor( KDChartParams::HdFtPosHeader2, color ); loadingContext.styleStack().restore(); - QDomElement pElem = KoDom::namedItemNS( subtitleElem, + TQDomElement pElem = KoDom::namedItemNS( subtitleElem, KoXmlNS::text, "p" ); setHeader2Text( pElem.text() ); } // Footer TODO (more details) - QDomElement footerElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, + TQDomElement footerElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, "footer" ); if ( !footerElem.isNull() ) { loadingContext.styleStack().save(); loadingContext.fillStyleStack( footerElem, KoXmlNS::chart, "style-name", "chart" ); - QFont font; - QColor color; + TQFont font; + TQColor color; loadOasisFont( loadingContext, font, color ); setHeaderFooterFont( KDChartParams::HdFtPosFooter, font, true, font.pointSize()*4 ); setHeaderFooterColor( KDChartParams::HdFtPosFooter, color ); loadingContext.styleStack().restore(); - QDomElement pElem = KoDom::namedItemNS( footerElem, + TQDomElement pElem = KoDom::namedItemNS( footerElem, KoXmlNS::text, "p" ); setFooterText( pElem.text() ); } // TODO: Get legend settings - QDomElement legendElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, + TQDomElement legendElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, "legend" ); if ( !legendElem.isNull() ) { loadingContext.styleStack().save(); loadingContext.fillStyleStack( legendElem, KoXmlNS::chart, "style-name", "chart" ); - QFont font; - QColor color; + TQFont font; + TQColor color; loadOasisFont( loadingContext, font, color ); //tz I didn't find that Oasis support seperate font/colors for the title and the rest of the legent setLegendFont( font, false ); @@ -329,15 +329,15 @@ bool KChartParams::loadOasis( const QDomElement &chartElem, setLegendTextColor( color ); setLegendTitleTextColor( color ); loadingContext.styleStack().restore(); - QString lp; + TQString lp; if ( legendElem.hasAttributeNS( KoXmlNS::chart, "legend-position" ) ) { - lp = legendElem.attributeNS( KoXmlNS::chart, "legend-position", QString::null ); + lp = legendElem.attributeNS( KoXmlNS::chart, "legend-position", TQString() ); } - QString lalign; + TQString lalign; if ( legendElem.hasAttributeNS( KoXmlNS::chart, "legend-align" ) ) { - lalign = legendElem.attributeNS( KoXmlNS::chart, "legend-align", QString::null ); + lalign = legendElem.attributeNS( KoXmlNS::chart, "legend-align", TQString() ); } LegendPosition lpos = NoLegend; @@ -404,7 +404,7 @@ bool KChartParams::loadOasis( const QDomElement &chartElem, //bodyWriter->addAttribute( "koffice:title", legendTitleText() ); if ( legendElem.hasAttributeNS( KoXmlNS::koffice, "title" ) ) { - setLegendTitleText( legendElem.attributeNS( KoXmlNS::koffice, "title", QString::null ) ); + setLegendTitleText( legendElem.attributeNS( KoXmlNS::koffice, "title", TQString() ) ); } } else @@ -413,7 +413,7 @@ bool KChartParams::loadOasis( const QDomElement &chartElem, } // Get the plot-area. This is where the action is. - QDomElement plotareaElem = KoDom::namedItemNS( chartElem, + TQDomElement plotareaElem = KoDom::namedItemNS( chartElem, KoXmlNS::chart, "plot-area" ); if ( !plotareaElem.isNull() ) { return loadOasisPlotarea( plotareaElem, loadingContext, errorMessage ); @@ -423,11 +423,11 @@ bool KChartParams::loadOasis( const QDomElement &chartElem, } -bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, +bool KChartParams::loadOasisPlotarea( const TQDomElement &plotareaElem, KoOasisLoadingContext &loadingContext, - QString &errorMessage ) + TQString &errorMessage ) { - QString tmp; + TQString tmp; //cerr << ">>> ==========================================================\n"; @@ -438,7 +438,7 @@ bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, // // NOTE: Only used in spreadsheets. tmp = plotareaElem.attributeNS( KoXmlNS::chart, - "data-source-has-labels", QString::null ); + "data-source-has-labels", TQString() ); m_firstRowAsLabel = false; m_firstColAsLabel = false; if ( tmp == "none" || tmp == "" ) @@ -464,7 +464,7 @@ bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, tmp = plotareaElem.attributeNS( KoXmlNS::chart, "style-name", - QString::null ); + TQString() ); //kdDebug(35001) << "Style name for the plot area: " << tmp << endl; styleStack.save(); styleStack.setTypeProperties( "chart" ); // load chart properties @@ -488,10 +488,10 @@ bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, case Bar: // Find out subtype tmp = styleStack.attributeNS( KoXmlNS::chart, "vertical" ); - // FIXME: Vertical is ignored. At least store it so we can + // FIXME:Qt::Vertical is ignored. At least store it so we can // save it again even if we don't support it. - //kdDebug(35001) << " ======> Vertical: " << tmp << " <======" << endl; + //kdDebug(35001) << " ======> Qt::Vertical: " << tmp << " <======" << endl; // Set the bar chart subtype. if ( styleStack.attributeNS( KoXmlNS::chart, "stacked" ) == "true" ) setBarChartSubType( BarStacked ); @@ -591,10 +591,10 @@ bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, // ---------------------------------------------------------------- // In the plot-area element there are two chart:axis elements - QDomElement xAxisElem; - QDomElement yAxisElem; + TQDomElement xAxisElem; + TQDomElement yAxisElem; - QDomElement axisElem; + TQDomElement axisElem; forEachElement( axisElem, plotareaElem ) { // If this element is not an axis, then continue @@ -602,7 +602,7 @@ bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, continue; tmp = axisElem.attributeNS( KoXmlNS::chart, "name", - QString::null); + TQString()); //kdDebug(35001) << "Got axis " << tmp << endl; //cerr << "Got axis " << tmp.latin1() << "\n"; if ( tmp == "primary-x" ) @@ -627,7 +627,7 @@ bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, // chart:name - either "primary-x" or "primary-y" #if 0 - const QString fillColor = styleStack.attributeNS( KoXmlNS::draw, + const TQString fillColor = styleStack.attributeNS( KoXmlNS::draw, "fill-color" ); kdDebug() << "fillColor=" << fillColor << endl; #endif @@ -638,22 +638,22 @@ bool KChartParams::loadOasisPlotarea( const QDomElement &plotareaElem, } -bool KChartParams::loadOasisAxis( const QDomElement &axisElem, +bool KChartParams::loadOasisAxis( const TQDomElement &axisElem, KoOasisLoadingContext &loadingContext, - QString &errorMessage, + TQString &errorMessage, KDChartAxisParams::AxisPos axisPos ) { Q_UNUSED( errorMessage ); - QString tmp; - QDomElement tmpElem; + TQString tmp; + TQDomElement tmpElem; KoStyleStack &styleStack = loadingContext.styleStack(); // Get the axis to manipulate. // TODO // Get the axis title (== axis label) if any. - QDomElement titleElem = KoDom::namedItemNS( axisElem, + TQDomElement titleElem = KoDom::namedItemNS( axisElem, KoXmlNS::chart, "title" ); if ( !titleElem.isNull() ) { tmpElem = KoDom::namedItemNS( titleElem, KoXmlNS::text, "p" ); @@ -664,10 +664,10 @@ bool KChartParams::loadOasisAxis( const QDomElement &axisElem, //cerr << ">>> ----------------------------------------------------------\n"; //cerr << "Loading axis " << axisElem.attributeNS( KoXmlNS::chart, "name", - // QString::null).latin1() + // TQString()).latin1() // << "\n"; - tmp = axisElem.attributeNS( KoXmlNS::chart, "style-name", QString::null ); + tmp = axisElem.attributeNS( KoXmlNS::chart, "style-name", TQString() ); //kdDebug(35001) << "Style name for the axis: " << tmp << endl; //cerr << "Style name for the axis: " << tmp.latin1() << "\n"; styleStack.save(); @@ -701,7 +701,7 @@ bool KChartParams::loadOasisAxis( const QDomElement &axisElem, // chart:visible - true if labels + ticks should be shown. - // children: + // tqchildren: // chart: // chart: // chart: @@ -733,7 +733,7 @@ void KChartParams::saveOasis( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) } bodyWriter->startElement( "chart:title" ); - QRect rect( headerFooterRect( KDChartParams::HdFtPosHeader ) ); + TQRect rect( headerFooterRect( KDChartParams::HdFtPosHeader ) ); bodyWriter->addAttributePt( "svg:x", rect.x() ); bodyWriter->addAttributePt( "svg:y", rect.y() ); bodyWriter->addAttribute( "chart:style-name", saveOasisFont( mainStyles, header1Font(), headerFooterColor( KDChartParams::HdFtPosHeader ) ) ); @@ -742,11 +742,11 @@ void KChartParams::saveOasis( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) bodyWriter->endElement(); // text:p bodyWriter->endElement(); // chart:title - QString subTitle( header2Text() ); + TQString subTitle( header2Text() ); if ( !subTitle.isEmpty() ) { kdDebug(32001) << "header rect: " << headerFooterRect( KDChartParams::HdFtPosHeader2 ) << endl; - QRect rect( headerFooterRect( KDChartParams::HdFtPosHeader2 ) ); + TQRect rect( headerFooterRect( KDChartParams::HdFtPosHeader2 ) ); bodyWriter->startElement( "chart:subtitle" ); bodyWriter->addAttributePt( "svg:x", rect.x() ); bodyWriter->addAttributePt( "svg:y", rect.y() ); @@ -762,9 +762,9 @@ void KChartParams::saveOasis( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) } - QString footer( footerText() ); + TQString footer( footerText() ); if ( !footer.isEmpty() ) { - QRect rect( headerFooterRect( KDChartParams::HdFtPosFooter ) ); + TQRect rect( headerFooterRect( KDChartParams::HdFtPosFooter ) ); bodyWriter->startElement( "chart:footer" ); bodyWriter->addAttributePt( "svg:x", rect.x() ); bodyWriter->addAttributePt( "svg:y", rect.y() ); @@ -783,8 +783,8 @@ void KChartParams::saveOasis( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) LegendPosition lpos = legendPosition(); if ( lpos != NoLegend ) { bodyWriter->startElement( "chart:legend" ); - QString lp; - QString lalign; + TQString lp; + TQString lalign; switch ( lpos ) { case LegendTop: lp = "top"; @@ -872,7 +872,7 @@ void KChartParams::saveOasis( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) void KChartParams::saveOasisPlotArea( KoXmlWriter* bodyWriter, KoGenStyles& mainStyles ) const { - QString dataSourceHasLabels; + TQString dataSourceHasLabels; if ( m_firstRowAsLabel ) if ( m_firstColAsLabel ) dataSourceHasLabels = "both"; @@ -968,7 +968,7 @@ void KChartParams::saveOasisPlotArea( KoXmlWriter* bodyWriter, KoGenStyles& main ( dataDirection() == DataRows ) ? "rows" : "columns" ); // Register the style, and get back its auto-generated name - const QString styleName = mainStyles.lookup( plotAreaStyle, "ch" ); + const TQString styleName = mainStyles.lookup( plotAreaStyle, "ch" ); bodyWriter->addAttribute( "chart:style-name", styleName ); @@ -989,7 +989,7 @@ void KChartParams::saveOasisAxis( KoXmlWriter* bodyWriter, bodyWriter->startElement( "chart:axis" ); bodyWriter->addAttribute( "chart:dimension", axisName ); - bodyWriter->addAttribute( "chart:name", QCString( "primary-" ) + axisName ); + bodyWriter->addAttribute( "chart:name", TQCString( "primary-" ) + axisName ); KoGenStyle axisStyle( KoGenStyle::STYLE_AUTO, "chart" ); @@ -997,11 +997,11 @@ void KChartParams::saveOasisAxis( KoXmlWriter* bodyWriter, axisStyle.addProperty( "chart:display-label", "true" ); // ### - const QString styleName = mainStyles.lookup( axisStyle, "ch" ); + const TQString styleName = mainStyles.lookup( axisStyle, "ch" ); bodyWriter->addAttribute( "chart:style-name", styleName ); // Write axis titles if any. - QString tmpStr = axisTitle( axisPos ); + TQString tmpStr = axisTitle( axisPos ); if ( tmpStr != "" ) { bodyWriter->startElement( "chart:title" ); // TODO: Save style, svg:x, svg:y @@ -1009,8 +1009,8 @@ void KChartParams::saveOasisAxis( KoXmlWriter* bodyWriter, // Write the text in the axis title. bodyWriter->startElement( "text:p" ); bodyWriter->addTextNode( tmpStr - .remove( QRegExp( "^<qt><center>" ) ) - .remove( QRegExp( "</center></qt>$" ) ) ); + .remove( TQRegExp( "^<qt><center>" ) ) + .remove( TQRegExp( "</center></qt>$" ) ) ); bodyWriter->endElement(); // text:p bodyWriter->endElement(); // chart:title @@ -1024,7 +1024,7 @@ void KChartParams::saveOasisAxis( KoXmlWriter* bodyWriter, } -QString KChartParams::saveOasisFont( KoGenStyles& mainStyles, const QFont& font, const QColor& color ) const +TQString KChartParams::saveOasisFont( KoGenStyles& mainStyles, const TQFont& font, const TQColor& color ) const { KoGenStyle::PropertyType tt = KoGenStyle::TextType; KoGenStyle autoStyle( KoGenStyle::STYLE_AUTO, "chart", 0 ); @@ -1032,7 +1032,7 @@ QString KChartParams::saveOasisFont( KoGenStyles& mainStyles, const QFont& font, autoStyle.addPropertyPt( "fo:font-size", font.pointSize(), tt ); autoStyle.addProperty( "fo:color", color.isValid() ? color.name() : "#000000", tt ); int w = font.weight(); - autoStyle.addProperty( "fo:font-weight", w == 50 ? "normal" : w == 75 ? "bold" : QString::number( qRound( w / 10 ) * 100 ), tt ); + autoStyle.addProperty( "fo:font-weight", w == 50 ? "normal" : w == 75 ? "bold" : TQString::number( tqRound( w / 10 ) * 100 ), tt ); autoStyle.addProperty( "fo:font-style", font.italic() ? "italic" : "normal", tt ); return mainStyles.lookup( autoStyle, "ch", KoGenStyles::ForceNumbering ); |