diff options
Diffstat (limited to 'filters/kspread/opencalc')
-rw-r--r-- | filters/kspread/opencalc/opencalcimport.cc | 188 | ||||
-rw-r--r-- | filters/kspread/opencalc/opencalcimport.h | 8 | ||||
-rw-r--r-- | filters/kspread/opencalc/status.html | 4 |
3 files changed, 100 insertions, 100 deletions
diff --git a/filters/kspread/opencalc/opencalcimport.cc b/filters/kspread/opencalc/opencalcimport.cc index 8e0327c9..60412181 100644 --- a/filters/kspread/opencalc/opencalcimport.cc +++ b/filters/kspread/opencalc/opencalcimport.cc @@ -168,7 +168,7 @@ bool OpenCalcImport::readRowFormat( TQDomElement & rowNode, TQDomElement * rowSt double height = -1.0; bool insertPageBreak = false; - Format tqlayout( table, table->doc()->styleManager()->defaultStyle() ); + Format layout( table, table->doc()->styleManager()->defaultStyle() ); while( !node.isNull() ) { @@ -190,7 +190,7 @@ bool OpenCalcImport::readRowFormat( TQDomElement & rowNode, TQDomElement * rowSt } } - loadStyleProperties( &tqlayout, property ); + loadStyleProperties( &layout, property ); } node = node.nextSibling(); @@ -219,7 +219,7 @@ bool OpenCalcImport::readRowFormat( TQDomElement & rowNode, TQDomElement * rowSt for ( int i = 0; i < number; ++i ) { RowFormat * rowL = table->nonDefaultRowFormat( row ); - rowL->copy( tqlayout ); + rowL->copy( layout ); if ( height != -1 ) { @@ -480,10 +480,10 @@ bool OpenCalcImport::readCells( TQDomElement & rowNode, Sheet * table, int row, psName = e.attributeNS( ooNS::style, "parent-style-name", TQString() ); kdDebug(30518) << "Default style: " << psName << endl; - Format * tqlayout = m_defaultStyles[psName]; + Format * layout = m_defaultStyles[psName]; - if ( tqlayout ) - cell->format()->copy( *tqlayout ); + if ( layout ) + cell->format()->copy( *layout ); TQDomElement * st = 0; if ( e.hasAttributeNS( ooNS::table, "style-name" ) ) @@ -548,10 +548,10 @@ bool OpenCalcImport::readCells( TQDomElement & rowNode, Sheet * table, int row, TQString psName( "Default" ); kdDebug(30518) << "Default style: " << psName << endl; - Format * tqlayout = m_defaultStyles[psName]; + Format * layout = m_defaultStyles[psName]; - if ( tqlayout ) - cell->format()->copy( *tqlayout ); + if ( layout ) + cell->format()->copy( *layout ); } if ( e.hasAttributeNS( ooNS::table, "formula" ) ) { @@ -959,16 +959,16 @@ bool OpenCalcImport::readRowsAndCells( TQDomElement & content, Sheet * table ) return false; RowFormat * srcLayout = table->nonDefaultRowFormat( backupRow ); - RowFormat * tqlayout = 0; + RowFormat * layout = 0; if ( collapsed ) srcLayout->setHide( true ); for ( i = 1; i < number; ++i ) { - tqlayout = table->nonDefaultRowFormat( backupRow + i ); + layout = table->nonDefaultRowFormat( backupRow + i ); - tqlayout->copy( *srcLayout ); + layout->copy( *srcLayout ); /* * TODO: Test: do we need to copy the cells, too? @@ -1047,14 +1047,14 @@ bool OpenCalcImport::readColLayouts( TQDomElement & content, Sheet * table ) if ( st && !st->isNull() ) { - Format * tqlayout = new Format( 0, m_doc->styleManager()->defaultStyle() ); + Format * layout = new Format( 0, m_doc->styleManager()->defaultStyle() ); - readInStyle( tqlayout, *st ); + readInStyle( layout, *st ); - m_defaultStyles.insert( name, tqlayout ); + m_defaultStyles.insert( name, layout ); kdDebug(30518) << "Insert default cell style: " << name << endl; - defaultStyle = tqlayout; + defaultStyle = layout; } } @@ -1281,7 +1281,7 @@ void OpenCalcImport::loadOasisMasterLayoutPage( Sheet * table,KoStyleStack &styl TQString orientation = "Portrait"; TQString format; - // Laurent : Why we stored tqlayout information as Millimeter ?!!!!! + // Laurent : Why we stored layout information as Millimeter ?!!!!! // kspread used point for all other attribute // I don't understand :( if ( styleStack.hasAttributeNS( ooNS::fo, "page-width" ) ) @@ -1962,32 +1962,32 @@ TQString * OpenCalcImport::loadFormat( TQDomElement * element, return format; } -void OpenCalcImport::loadFontStyle( Format * tqlayout, TQDomElement const * font ) const +void OpenCalcImport::loadFontStyle( Format * layout, TQDomElement const * font ) const { - if ( !font || !tqlayout ) + if ( !font || !layout ) return; - kdDebug(30518) << "Copy font style from the tqlayout " << font->tagName() << ", " << font->nodeName() << endl; + kdDebug(30518) << "Copy font style from the layout " << font->tagName() << ", " << font->nodeName() << endl; if ( font->hasAttributeNS( ooNS::fo, "font-family" ) ) - tqlayout->setTextFontFamily( font->attributeNS( ooNS::fo, "font-family", TQString() ) ); + layout->setTextFontFamily( font->attributeNS( ooNS::fo, "font-family", TQString() ) ); if ( font->hasAttributeNS( ooNS::fo, "color" ) ) - tqlayout->setTextColor( TQColor( font->attributeNS( ooNS::fo, "color", TQString() ) ) ); + layout->setTextColor( TQColor( font->attributeNS( ooNS::fo, "color", TQString() ) ) ); if ( font->hasAttributeNS( ooNS::fo, "font-size" ) ) - tqlayout->setTextFontSize( int( KoUnit::parseValue( font->attributeNS( ooNS::fo, "font-size", TQString() ), 10 ) ) ); + layout->setTextFontSize( int( KoUnit::parseValue( font->attributeNS( ooNS::fo, "font-size", TQString() ), 10 ) ) ); else - tqlayout->setTextFontSize( 10 ); + layout->setTextFontSize( 10 ); if ( font->hasAttributeNS( ooNS::fo, "font-style" ) ) { kdDebug(30518) << "italic" << endl; - tqlayout->setTextFontItalic( true ); // only thing we support + layout->setTextFontItalic( true ); // only thing we support } if ( font->hasAttributeNS( ooNS::fo, "font-weight" ) ) - tqlayout->setTextFontBold( true ); // only thing we support + layout->setTextFontBold( true ); // only thing we support if ( font->hasAttributeNS( ooNS::fo, "text-underline" ) || font->hasAttributeNS( ooNS::style, "text-underline" ) ) - tqlayout->setTextFontUnderline( true ); // only thing we support + layout->setTextFontUnderline( true ); // only thing we support if ( font->hasAttributeNS( ooNS::style, "text-crossing-out" ) ) - tqlayout->setTextFontStrike( true ); // only thing we support + layout->setTextFontStrike( true ); // only thing we support if ( font->hasAttributeNS( ooNS::style, "font-pitch" ) ) { // TODO: possible values: fixed, variable @@ -1996,7 +1996,7 @@ void OpenCalcImport::loadFontStyle( Format * tqlayout, TQDomElement const * font // text-underline-color } -void OpenCalcImport::loadBorder( Format * tqlayout, TQString const & borderDef, bPos pos ) const +void OpenCalcImport::loadBorder( Format * layout, TQString const & borderDef, bPos pos ) const { if ( borderDef == "none" ) return; @@ -2038,24 +2038,24 @@ void OpenCalcImport::loadBorder( Format * tqlayout, TQString const & borderDef, pen.setColor( TQColor( borderDef.right( p - p2 ) ) ); if ( pos == Left ) - tqlayout->setLeftBorderPen( pen ); + layout->setLeftBorderPen( pen ); else if ( pos == Top ) - tqlayout->setTopBorderPen( pen ); + layout->setTopBorderPen( pen ); else if ( pos == Right ) - tqlayout->setRightBorderPen( pen ); + layout->setRightBorderPen( pen ); else if ( pos == Bottom ) - tqlayout->setBottomBorderPen( pen ); + layout->setBottomBorderPen( pen ); else if ( pos == Border ) { - tqlayout->setLeftBorderPen( pen ); - tqlayout->setTopBorderPen( pen ); - tqlayout->setRightBorderPen( pen ); - tqlayout->setBottomBorderPen( pen ); + layout->setLeftBorderPen( pen ); + layout->setTopBorderPen( pen ); + layout->setRightBorderPen( pen ); + layout->setBottomBorderPen( pen ); } // TODO Diagonals not supported by oocalc } -void OpenCalcImport::loadStyleProperties( Format * tqlayout, TQDomElement const & property ) const +void OpenCalcImport::loadStyleProperties( Format * layout, TQDomElement const & property ) const { kdDebug(30518) << "*** Loading style properties *****" << endl; @@ -2064,16 +2064,16 @@ void OpenCalcImport::loadStyleProperties( Format * tqlayout, TQDomElement const bool ok = false; int p = property.attributeNS( ooNS::style, "decimal-places", TQString() ).toInt( &ok ); if (ok ) - tqlayout->setPrecision( p ); + layout->setPrecision( p ); } if ( property.hasAttributeNS( ooNS::style, "font-name" ) ) { TQDomElement * font = m_styles[ property.attributeNS( ooNS::style, "font-name", TQString() ) ]; - loadFontStyle( tqlayout, font ); // generell font style + loadFontStyle( layout, font ); // generell font style } - loadFontStyle( tqlayout, &property ); // specific font style + loadFontStyle( layout, &property ); // specific font style // TODO: // diagonal: fall + goup @@ -2090,133 +2090,133 @@ void OpenCalcImport::loadStyleProperties( Format * tqlayout, TQDomElement const bool ok = false; int a = property.attributeNS( ooNS::style, "rotation-angle", TQString() ).toInt( &ok ); if ( ok ) - tqlayout->setAngle( -a + 1 ); + layout->setAngle( -a + 1 ); } if ( property.hasAttributeNS( ooNS::fo, "direction" ) ) { - tqlayout->setVerticalText( true ); + layout->setVerticalText( true ); } if ( property.hasAttributeNS( ooNS::fo, "text-align" ) ) { TQString s = property.attributeNS( ooNS::fo, "text-align", TQString() ); if ( s == "center" ) - tqlayout->setAlign( Format::Center ); + layout->setAlign( Format::Center ); else if ( s == "end" ) - tqlayout->setAlign( Format::Right ); + layout->setAlign( Format::Right ); else if ( s == "start" ) - tqlayout->setAlign( Format::Left ); + layout->setAlign( Format::Left ); else if ( s == "justify" ) // TODO in KSpread! - tqlayout->setAlign( Format::Center ); + layout->setAlign( Format::Center ); } if ( property.hasAttributeNS( ooNS::fo, "margin-left" ) ) { kdDebug(30518)<<"margin-left :"<<KoUnit::parseValue( property.attributeNS( ooNS::fo, "margin-left", TQString() ),0.0 )<<endl; - tqlayout->setIndent( KoUnit::parseValue( property.attributeNS( ooNS::fo, "margin-left", TQString() ),0.0 ) ); + layout->setIndent( KoUnit::parseValue( property.attributeNS( ooNS::fo, "margin-left", TQString() ),0.0 ) ); } if ( property.hasAttributeNS( ooNS::fo, "background-color" ) ) - tqlayout->setBgColor( TQColor( property.attributeNS( ooNS::fo, "background-color", TQString() ) ) ); + layout->setBgColor( TQColor( property.attributeNS( ooNS::fo, "background-color", TQString() ) ) ); if ( property.hasAttributeNS( ooNS::style, "print-content" ) ) { if ( property.attributeNS( ooNS::style, "print-content", TQString() ) == "false" ) - tqlayout->setDontPrintText( false ); + layout->setDontPrintText( false ); } if ( property.hasAttributeNS( ooNS::style, "cell-protect" ) ) { TQString prot( property.attributeNS( ooNS::style, "cell-protect", TQString() ) ); if ( prot == "none" ) { - tqlayout->setNotProtected( true ); - tqlayout->setHideFormula( false ); - tqlayout->setHideAll( false ); + layout->setNotProtected( true ); + layout->setHideFormula( false ); + layout->setHideAll( false ); } else if ( prot == "formula-hidden" ) { - tqlayout->setNotProtected( true ); - tqlayout->setHideFormula( true ); - tqlayout->setHideAll( false ); + layout->setNotProtected( true ); + layout->setHideFormula( true ); + layout->setHideAll( false ); } else if ( prot == "protected formula-hidden" ) { - tqlayout->setNotProtected( false ); - tqlayout->setHideFormula( true ); - tqlayout->setHideAll( false ); + layout->setNotProtected( false ); + layout->setHideFormula( true ); + layout->setHideAll( false ); } else if ( prot == "hidden-and-protected" ) { - tqlayout->setNotProtected( false ); - tqlayout->setHideFormula( false ); - tqlayout->setHideAll( true ); + layout->setNotProtected( false ); + layout->setHideFormula( false ); + layout->setHideAll( true ); } else if ( prot == "protected" ) { - tqlayout->setNotProtected( false ); - tqlayout->setHideFormula( false ); - tqlayout->setHideAll( false ); + layout->setNotProtected( false ); + layout->setHideFormula( false ); + layout->setHideAll( false ); } kdDebug(30518) << "Cell " << prot << endl; } if ( property.hasAttributeNS( ooNS::fo, "padding-left" ) ) - tqlayout->setIndent( KoUnit::parseValue(property.attributeNS( ooNS::fo, "padding-left", TQString() ) ) ); + layout->setIndent( KoUnit::parseValue(property.attributeNS( ooNS::fo, "padding-left", TQString() ) ) ); if ( property.hasAttributeNS( ooNS::fo, "vertical-align" ) ) { TQString s = property.attributeNS( ooNS::fo, "vertical-align", TQString() ); if ( s == "middle" ) - tqlayout->setAlignY( Format::Middle ); + layout->setAlignY( Format::Middle ); else if ( s == "bottom" ) - tqlayout->setAlignY( Format::Bottom ); + layout->setAlignY( Format::Bottom ); else - tqlayout->setAlignY( Format::Top ); + layout->setAlignY( Format::Top ); } else - tqlayout->setAlignY( Format::Bottom ); + layout->setAlignY( Format::Bottom ); if ( property.hasAttributeNS( ooNS::fo, "wrap-option" ) ) { - tqlayout->setMultiRow( true ); + layout->setMultiRow( true ); /* we do not support anything else yet TQString s = property.attributeNS( ooNS::fo, "wrap-option", TQString() ); if ( s == "wrap" ) - tqlayout->setMultiRow( true ); + layout->setMultiRow( true ); */ } if ( property.hasAttributeNS( ooNS::fo, "border-bottom" ) ) { - loadBorder( tqlayout, property.attributeNS( ooNS::fo, "border-bottom", TQString() ), Bottom ); + loadBorder( layout, property.attributeNS( ooNS::fo, "border-bottom", TQString() ), Bottom ); // TODO: style:border-line-width-bottom if double! } if ( property.hasAttributeNS( ooNS::fo, "border-right" ) ) { - loadBorder( tqlayout, property.attributeNS( ooNS::fo, "border-right", TQString() ), Right ); + loadBorder( layout, property.attributeNS( ooNS::fo, "border-right", TQString() ), Right ); // TODO: style:border-line-width-right } if ( property.hasAttributeNS( ooNS::fo, "border-top" ) ) { - loadBorder( tqlayout, property.attributeNS( ooNS::fo, "border-top", TQString() ), Top ); + loadBorder( layout, property.attributeNS( ooNS::fo, "border-top", TQString() ), Top ); // TODO: style:border-line-width-top } if ( property.hasAttributeNS( ooNS::fo, "border-left" ) ) { - loadBorder( tqlayout, property.attributeNS( ooNS::fo, "border-left", TQString() ), Left ); + loadBorder( layout, property.attributeNS( ooNS::fo, "border-left", TQString() ), Left ); // TODO: style:border-line-width-left } if ( property.hasAttributeNS( ooNS::fo, "border" ) ) { - loadBorder( tqlayout, property.attributeNS( ooNS::fo, "border", TQString() ), Border ); + loadBorder( layout, property.attributeNS( ooNS::fo, "border", TQString() ), Border ); // TODO: style:border-line-width-left } } -void OpenCalcImport::readInStyle( Format * tqlayout, TQDomElement const & style ) +void OpenCalcImport::readInStyle( Format * layout, TQDomElement const & style ) { kdDebug(30518) << "** Reading Style: " << style.tagName() << "; " << style.attributeNS( ooNS::style, "name", TQString()) << endl; if ( style.localName() == "style" && style.namespaceURI()==ooNS::style) @@ -2225,20 +2225,20 @@ void OpenCalcImport::readInStyle( Format * tqlayout, TQDomElement const & style { Format * cp = m_defaultStyles.find( style.attributeNS( ooNS::style, "parent-style-name", TQString() ) ); - kdDebug(30518) << "Copying tqlayout from " << style.attributeNS( ooNS::style, "parent-style-name", TQString() ) << endl; + kdDebug(30518) << "Copying layout from " << style.attributeNS( ooNS::style, "parent-style-name", TQString() ) << endl; if ( cp != 0 ) - tqlayout->copy( *cp ); + layout->copy( *cp ); } else if ( style.hasAttributeNS( ooNS::style, "family") ) { TQString name = style.attribute( "style-family" ) + "default"; Format * cp = m_defaultStyles.find( name ); - kdDebug(30518) << "Copying tqlayout from " << name << ", " << !cp << endl; + kdDebug(30518) << "Copying layout from " << name << ", " << !cp << endl; if ( cp != 0 ) - tqlayout->copy( *cp ); + layout->copy( *cp ); } if ( style.hasAttributeNS( ooNS::style, "data-style-name" ) ) @@ -2255,8 +2255,8 @@ void OpenCalcImport::readInStyle( Format * tqlayout, TQDomElement const & style if ( format ) { - tqlayout->setFormatString( *format ); - tqlayout->setFormatType( formatType ); + layout->setFormatString( *format ); + layout->setFormatType( formatType ); } // <number:currency-symbol number:language="de" number:country="DE">€</number:currency-symbol> @@ -2267,9 +2267,9 @@ void OpenCalcImport::readInStyle( Format * tqlayout, TQDomElement const & style forEachElement( property, style ) { if ( property.localName() == "properties" && property.namespaceURI() == ooNS::style ) - loadStyleProperties( tqlayout, property ); + loadStyleProperties( layout, property ); - kdDebug(30518) << tqlayout->textFontFamily( 0, 0 ) << endl; + kdDebug(30518) << layout->textFontFamily( 0, 0 ) << endl; } } @@ -2358,13 +2358,13 @@ bool OpenCalcImport::createStyleMap( TQDomDocument const & styles ) if ( !e.isNull() ) { - Format * tqlayout = new Format( 0, m_doc->styleManager()->defaultStyle() ); + Format * layout = new Format( 0, m_doc->styleManager()->defaultStyle() ); - readInStyle( tqlayout, e ); + readInStyle( layout, e ); kdDebug(30518) << "Default style " << e.attributeNS( ooNS::style, "family", TQString() ) << "default" << " loaded " << endl; - m_defaultStyles.insert( e.attributeNS( ooNS::style, "family", TQString() ) + "default", tqlayout ); - // TQFont font = tqlayout->font(); + m_defaultStyles.insert( e.attributeNS( ooNS::style, "family", TQString() ) + "default", layout ); + // TQFont font = layout->font(); // kdDebug(30518) << "Font: " << font.family() << ", " << font.toString() << endl; } @@ -2384,12 +2384,12 @@ bool OpenCalcImport::createStyleMap( TQDomDocument const & styles ) continue; } - Format * tqlayout = new Format( 0, m_doc->styleManager()->defaultStyle() ); - readInStyle( tqlayout, defs ); + Format * layout = new Format( 0, m_doc->styleManager()->defaultStyle() ); + readInStyle( layout, defs ); kdDebug(30518) << "Default style " << defs.attributeNS( ooNS::style, "name", TQString() ) << " loaded " << endl; - m_defaultStyles.insert( defs.attributeNS( ooNS::style, "name", TQString() ), tqlayout ); - // kdDebug(30518) << "Font: " << tqlayout->font().family() << ", " << tqlayout->font().toString() << endl; + m_defaultStyles.insert( defs.attributeNS( ooNS::style, "name", TQString() ), layout ); + // kdDebug(30518) << "Font: " << layout->font().family() << ", " << layout->font().toString() << endl; defs = defs.nextSibling().toElement(); } diff --git a/filters/kspread/opencalc/opencalcimport.h b/filters/kspread/opencalc/opencalcimport.h index 071a87ff..8965dae5 100644 --- a/filters/kspread/opencalc/opencalcimport.h +++ b/filters/kspread/opencalc/opencalcimport.h @@ -90,10 +90,10 @@ class OpenCalcImport : public KoFilter bool readRowsAndCells( TQDomElement & content, KSpread::Sheet * table ); bool readCells( TQDomElement & rowNode, KSpread::Sheet * table, int row, int & columns ); void convertFormula( TQString & text, TQString const & f ) const; - void loadFontStyle( KSpread::Format * tqlayout, TQDomElement const * font ) const; - void readInStyle( KSpread::Format * tqlayout, TQDomElement const & style ); - void loadStyleProperties( KSpread::Format * tqlayout, TQDomElement const & property ) const; - void loadBorder( KSpread::Format * tqlayout, TQString const & borderDef, bPos pos ) const; + void loadFontStyle( KSpread::Format * layout, TQDomElement const * font ) const; + void readInStyle( KSpread::Format * layout, TQDomElement const & style ); + void loadStyleProperties( KSpread::Format * layout, TQDomElement const & property ) const; + void loadBorder( KSpread::Format * layout, TQString const & borderDef, bPos pos ) const; void loadTableMasterStyle( KSpread::Sheet * table, TQString const & stylename ); TQString * loadFormat( TQDomElement * element, KSpread::FormatType & formatType, diff --git a/filters/kspread/opencalc/status.html b/filters/kspread/opencalc/status.html index 2bd1fc05..b23f6ae9 100644 --- a/filters/kspread/opencalc/status.html +++ b/filters/kspread/opencalc/status.html @@ -51,7 +51,7 @@ KOffice filters status: OpenOffice.org Calc</h1></center> Borders, background colors<br> column width, row width<br> column layouts, row layouts<br> - page tqlayout (size, border)<br> + page layout (size, border)<br> OpenCalc style import, default style<br> format string translating (not supported by KSpread yet, but this filter produces these strings => needs enhancements in KSpread)<br> header, footer (including macros)<br> @@ -169,7 +169,7 @@ KOffice filters status: OpenOffice.org Calc</h1></center> <td> Jan 12, 2003 - Initial Revision<br> - Jan 18, 2003 - page tqlayout, header, footer<br> + Jan 18, 2003 - page layout, header, footer<br> Jan 19, 2003 - Added support for fonts, text color, background color, formula conversion<br> Jan 19, 2003 - text alignment, indents, comments, NoPrint, Merged Cells<br> |