26#include <dcopobject.h>
31#include <KoGenStyles.h>
33#include <KoStyleStack.h>
34#include <KoOasisLoadingContext.h>
35#include <KoOasisStyles.h>
37#include "kspread_canvas.h"
38#include "kspread_doc.h"
39#include "kspread_global.h"
40#include "kspread_sheet.h"
41#include "kspread_sheetprint.h"
42#include "kspread_style.h"
43#include "kspread_style_manager.h"
44#include "KSpreadColumnIface.h"
45#include "KSpreadLayoutIface.h"
46#include "KSpreadRowIface.h"
48#include "kspread_format.h"
61double Format::s_columnWidth = 100.0;
62double Format::s_rowHeight = 20.0;
64Format::Format( Sheet * _sheet, Style * _style )
77 if ( m_pStyle->release() )
81void Format::defaultStyleFormat()
83 if ( m_pStyle->release() )
87 m_pStyle = m_pSheet->doc()->styleManager()->defaultStyle();
93void Format::setGlobalColWidth( double width )
95 s_columnWidth = width;
98void Format::setGlobalRowHeight( double height )
100 s_rowHeight = height;
103double Format::globalRowHeight()
108double Format::globalColWidth()
110 return s_columnWidth;
113void Format::copy( const Format & _l )
117 setStyle( _l.m_pStyle );
120 m_flagsMask = _l.m_flagsMask;
121 m_bNoFallBack = _l.m_bNoFallBack;
123 if ( _l.m_strComment )
127 m_strComment = new TQString( *_l.m_strComment );
131void Format::setStyle( Style * style )
133 if ( style == m_pStyle )
136 if ( m_pStyle && m_pStyle->release() )
145 kdDebug() << "Style name: " << (( CustomStyle *) m_pStyle)->name() << endl;
148void Format::clearFlag( FormatFlags flag )
150 m_flagsMask &= ~(TQ_UINT32)flag;
153void Format::setFlag( FormatFlags flag )
155 m_flagsMask |= (TQ_UINT32)flag;
158bool Format::testFlag( FormatFlags flag ) const
160 return ( m_flagsMask & (TQ_UINT32)flag );
163void Format::clearProperties()
170void Format::clearProperty( Properties p )
179bool Format::hasProperty( Properties p, bool withoutParent ) const
184 return ( m_mask & (uint)p );
187void Format::setProperty( Properties p )
192void Format::clearNoFallBackProperties()
199void Format::clearNoFallBackProperties( Properties p )
201 m_bNoFallBack &= ~(uint)p;
206bool Format::hasNoFallBackProperties( Properties p ) const
208 return ( m_bNoFallBack & (uint)p );
211void Format::setNoFallBackProperties( Properties p )
213 m_bNoFallBack |= (uint)p;
224TQString Format::saveOasisCellStyle( KoGenStyle ¤tCellStyle, KoGenStyles &mainStyles )
227 styleName = m_pStyle->saveOasis( currentCellStyle, mainStyles );
230 if ( currentCellStyle.type() == Doc::STYLE_CELL_AUTO )
232 styleName = mainStyles.lookup( currentCellStyle, "ce" );
238TQDomElement Format::saveFormat( TQDomDocument & doc, int _col, int _row, bool force, bool copy ) const
240 TQDomElement format( doc.createElement( "format" ) );
244 format.setAttribute( "style-name", (( CustomStyle *) m_pStyle)->name() );
251 if ( m_pStyle->parent() && m_pStyle->parent()->name().length() > 0 )
252 format.setAttribute( "parent", m_pStyle->parent()->name() );
255 if ( hasProperty( PAlign, true ) || hasNoFallBackProperties( PAlign ) || force )
256 format.setAttribute( "align", ( int) align( _col, _row ) );
257 if ( hasProperty( PAlignY, true ) || hasNoFallBackProperties( PAlignY ) || force )
258 format.setAttribute( "alignY", ( int)alignY( _col, _row ) );
259 if ( ( hasProperty( PBackgroundColor, false ) || hasNoFallBackProperties( PBackgroundColor)
260 || force ) && bgColor( _col, _row ).isValid() )
261 format.setAttribute( "bgcolor", bgColor( _col, _row ).name() );
262 if ( ( hasProperty( PMultiRow, true ) || hasNoFallBackProperties( PMultiRow )
263 || force ) && multiRow( _col, _row ) )
264 format.setAttribute( "multirow", "yes" );
265 if ( ( hasProperty( PVerticalText, true ) || hasNoFallBackProperties( PVerticalText )
266 || force ) && verticalText( _col, _row ) )
267 format.setAttribute( "verticaltext", "yes" );
268 if ( hasProperty( PPrecision, true ) || hasNoFallBackProperties( PPrecision ) || force )
269 format.setAttribute( "precision", precision( _col, _row ) );
270 if ( ( hasProperty( PPrefix, true ) || hasNoFallBackProperties( PPrefix ) || force )
271 && !prefix( _col, _row ).isEmpty() )
272 format.setAttribute( "prefix", prefix( _col, _row ) );
273 if ( ( hasProperty( PPostfix, true ) || hasNoFallBackProperties( PPostfix ) || force )
274 && !postfix( _col, _row ).isEmpty() )
275 format.setAttribute( "postfix", postfix( _col, _row ) );
276 if ( hasProperty( PFloatFormat, true ) || hasNoFallBackProperties( PFloatFormat ) || force )
277 format.setAttribute( "float", ( int) floatFormat( _col, _row ) );
278 if ( hasProperty( PFloatColor, true ) || hasNoFallBackProperties( PFloatColor ) || force )
279 format.setAttribute( "floatcolor", ( int) floatColor( _col, _row ) );
280 if ( hasProperty( PFormatType, true ) || hasNoFallBackProperties( PFormatType ) || force )
281 format.setAttribute( "format", ( int)getFormatType( _col, _row ));
282 if ( hasProperty( PCustomFormat, true ) || hasNoFallBackProperties( PCustomFormat ) || force )
284 TQString s( getFormatString( _col, _row ) );
285 if ( s.length() > 0 )
286 format.setAttribute( "custom", s );
288 if ( getFormatType( _col, _row ) == Money_format )
290 format.setAttribute( "type", ( int) m_pStyle->currency().type );
291 format.setAttribute( "symbol", m_pStyle->currency().symbol );
293 if ( hasProperty( PAngle, true ) || hasNoFallBackProperties( PAngle ) || force )
294 format.setAttribute( "angle", getAngle( _col, _row ) );
295 if ( hasProperty( PIndent, true ) || hasNoFallBackProperties( PIndent ) || force )
296 format.setAttribute( "indent", getIndent( _col, _row ) );
297 if( ( hasProperty( PDontPrintText, true ) || hasNoFallBackProperties( PDontPrintText )
298 || force ) && getDontprintText( _col, _row ) )
299 format.setAttribute( "dontprinttext", "yes" );
300 if( ( hasProperty( PNotProtected, true ) || hasNoFallBackProperties( PNotProtected )
301 || force ) && notProtected( _col, _row ) )
302 format.setAttribute( "noprotection", "yes" );
303 if( ( hasProperty( PHideAll, true ) || hasNoFallBackProperties( PHideAll )
304 || force ) && isHideAll( _col, _row ) )
305 format.setAttribute( "hideall", "yes" );
306 if( ( hasProperty( PHideFormula, true ) || hasNoFallBackProperties( PHideFormula )
307 || force ) && isHideFormula( _col, _row ) )
308 format.setAttribute( "hideformula", "yes" );
309 if ( hasProperty( PFont, true ) || hasNoFallBackProperties( PFont ) || force )
310 format.appendChild( util_createElement( "font", textFont( _col, _row ), doc ) );
311 if ( ( hasProperty( PTextPen, true ) || hasNoFallBackProperties( PTextPen ) || force )
312 && textPen( _col, _row ).color().isValid() )
313 format.appendChild( util_createElement( "pen", textPen( _col, _row ), doc ) );
314 if ( hasProperty( PBackgroundBrush, true ) || hasNoFallBackProperties( PBackgroundBrush ) || force )
316 format.setAttribute( "brushcolor", backGroundBrushColor( _col, _row ).name() );
317 format.setAttribute( "brushstyle", ( int)backGroundBrushStyle( _col, _row ) );
319 if ( hasProperty( PLeftBorder, true ) || hasNoFallBackProperties( PLeftBorder ) || force )
321 TQDomElement left = doc.createElement( "left-border" );
322 left.appendChild( util_createElement( "pen", leftBorderPen( _col, _row ), doc ) );
323 format.appendChild( left );
325 if ( hasProperty( PTopBorder, true ) || hasNoFallBackProperties( PTopBorder ) || force )
327 TQDomElement top = doc.createElement( "top-border" );
328 top.appendChild( util_createElement( "pen", topBorderPen( _col, _row ), doc ) );
329 format.appendChild( top );
331 if ( hasProperty( PRightBorder, true ) || hasNoFallBackProperties( PRightBorder ) || force )
333 TQDomElement right = doc.createElement( "right-border" );
334 right.appendChild( util_createElement( "pen", rightBorderPen( _col, _row ), doc ) );
335 format.appendChild( right );
337 if ( hasProperty( PBottomBorder, true ) || hasNoFallBackProperties( PBottomBorder ) || force )
339 TQDomElement bottom = doc.createElement( "bottom-border" );
340 bottom.appendChild( util_createElement( "pen", bottomBorderPen( _col, _row ), doc ) );
341 format.appendChild( bottom );
343 if ( hasProperty( PFallDiagonal, true ) || hasNoFallBackProperties( PFallDiagonal ) || force )
345 TQDomElement fallDiagonal = doc.createElement( "fall-diagonal" );
346 fallDiagonal.appendChild( util_createElement( "pen", fallDiagonalPen( _col, _row ), doc ) );
347 format.appendChild( fallDiagonal );
349 if ( hasProperty( PGoUpDiagonal, true ) || hasNoFallBackProperties( PGoUpDiagonal ) || force )
351 TQDomElement goUpDiagonal = doc.createElement( "up-diagonal" );
352 goUpDiagonal.appendChild( util_createElement( "pen", goUpDiagonalPen( _col, _row ), doc ) );
353 format.appendChild( goUpDiagonal );
359TQDomElement Format::saveFormat( TQDomDocument& doc, bool force, bool copy ) const
361 TQDomElement format( doc.createElement( "format" ) );
365 format.setAttribute( "style-name", (( CustomStyle *) m_pStyle)->name() );
372 if ( m_pStyle->parent() && m_pStyle->parentName().length() > 0 )
373 format.setAttribute( "parent", m_pStyle->parentName() );
376 if ( hasProperty( PAlign, true ) || hasNoFallBackProperties( PAlign ) || force )
377 format.setAttribute( "align", ( int)m_pStyle->alignX() );
378 if ( hasProperty( PAlignY, true ) || hasNoFallBackProperties( PAlignY ) || force )
379 format.setAttribute( "alignY", ( int)m_pStyle->alignY() );
380 if ( ( hasProperty( PBackgroundColor, true ) || hasNoFallBackProperties( PBackgroundColor )
381 || force ) && m_pStyle->bgColor().isValid() )
382 format.setAttribute( "bgcolor", m_pStyle->bgColor().name() );
384 if ( ( hasProperty( PMultiRow, true ) || hasNoFallBackProperties( PMultiRow ) || force )
385 && m_pStyle->hasProperty( Style::PMultiRow ) )
386 format.setAttribute( "multirow", "yes" );
387 if ( ( hasProperty( PVerticalText, true ) || hasNoFallBackProperties( PVerticalText ) || force )
388 && m_pStyle->hasProperty( Style::PVerticalText ) )
389 format.setAttribute( "verticaltext", "yes" );
391 if ( hasProperty( PPrecision, true ) || hasNoFallBackProperties( PPrecision ) || force )
392 format.setAttribute( "precision", m_pStyle->precision() );
393 if ( ( hasProperty( PPrefix, true ) || hasNoFallBackProperties( PPrefix ) || force )
394 && !m_pStyle->prefix().isEmpty() )
395 format.setAttribute( "prefix", m_pStyle->prefix() );
396 if ( ( hasProperty( PPostfix, true ) || hasNoFallBackProperties( PPostfix ) || force )
397 && !m_pStyle->postfix().isEmpty() )
398 format.setAttribute( "postfix", m_pStyle->postfix() );
400 if ( hasProperty( PFloatFormat, true ) || hasNoFallBackProperties( PFloatFormat ) || force )
401 format.setAttribute( "float", ( int) m_pStyle->floatFormat() );
402 if ( hasProperty( PFloatColor, true ) || hasNoFallBackProperties( PFloatColor ) || force )
403 format.setAttribute( "floatcolor", ( int) m_pStyle->floatColor() );
404 if ( hasProperty( PFormatType, true ) || hasNoFallBackProperties( PFormatType ) || force )
405 format.setAttribute( "format", ( int) m_pStyle->formatType() );
406 if ( hasProperty( PCustomFormat, true ) || hasNoFallBackProperties( PCustomFormat ) || force )
407 if ( m_pStyle->strFormat().length() > 0 )
408 format.setAttribute( "custom", m_pStyle->strFormat() );
409 if ( m_pStyle->formatType() == Money_format )
411 format.setAttribute( "type", ( int) m_pStyle->currency().type );
412 format.setAttribute( "symbol", m_pStyle->currency().symbol );
414 if ( hasProperty( PAngle, true ) || hasNoFallBackProperties( PAngle ) || force )
415 format.setAttribute( "angle", m_pStyle->rotateAngle() );
416 if ( hasProperty( PIndent, true ) || hasNoFallBackProperties( PIndent ) || force )
417 format.setAttribute( "indent", m_pStyle->indent() );
418 if ( ( hasProperty( PDontPrintText, true ) || hasNoFallBackProperties( PDontPrintText ) || force )
419 && m_pStyle->hasProperty( Style::PDontPrintText ) )
420 format.setAttribute( "dontprinttext", "yes" );
421 if ( ( hasProperty( PNotProtected, true ) || hasNoFallBackProperties( PNotProtected )
422 || force ) && m_pStyle->hasProperty( Style::PNotProtected ) )
423 format.setAttribute( "noprotection", "yes" );
424 if( ( hasProperty( PHideAll, true ) || hasNoFallBackProperties( PHideAll )
425 || force ) && m_pStyle->hasProperty( Style::PHideAll ) )
426 format.setAttribute( "hideall", "yes" );
427 if( ( hasProperty( PHideFormula, true ) || hasNoFallBackProperties( PHideFormula )
428 || force ) && m_pStyle->hasProperty( Style::PHideFormula ) )
429 format.setAttribute( "hideformula", "yes" );
430 if ( hasProperty( PFont, true ) || hasNoFallBackProperties( PFont ) || force )
431 format.appendChild( util_createElement( "font", m_pStyle->font(), doc ) );
432 if ( ( hasProperty( PTextPen, true ) || hasNoFallBackProperties( PTextPen ) || force )
433 && m_pStyle->pen().color().isValid() )
434 format.appendChild( util_createElement( "pen", m_pStyle->pen(), doc ) );
435 if ( hasProperty( PBackgroundBrush, true ) || hasNoFallBackProperties( PBackgroundBrush ) || force )
437 format.setAttribute( "brushcolor", m_pStyle->backGroundBrush().color().name() );
438 format.setAttribute( "brushstyle", ( int) m_pStyle->backGroundBrush().style() );
440 if ( hasProperty( PLeftBorder, true ) || hasNoFallBackProperties( PLeftBorder ) || force )
442 TQDomElement left = doc.createElement( "left-border" );
443 left.appendChild( util_createElement( "pen", m_pStyle->leftBorderPen(), doc ) );
444 format.appendChild( left );
446 if ( hasProperty( PTopBorder, true ) || hasNoFallBackProperties( PTopBorder ) || force )
448 TQDomElement top = doc.createElement( "top-border" );
449 top.appendChild( util_createElement( "pen", m_pStyle->topBorderPen(), doc ) );
450 format.appendChild( top );
452 if ( hasProperty( PRightBorder, true ) || hasNoFallBackProperties( PRightBorder ) || force )
454 TQDomElement right = doc.createElement( "right-border" );
455 right.appendChild( util_createElement( "pen", m_pStyle->rightBorderPen(), doc ) );
456 format.appendChild( right );
458 if ( hasProperty( PBottomBorder, true ) || hasNoFallBackProperties( PBottomBorder ) || force )
460 TQDomElement bottom = doc.createElement( "bottom-border" );
461 bottom.appendChild( util_createElement( "pen", m_pStyle->bottomBorderPen(), doc ) );
462 format.appendChild( bottom );
464 if ( hasProperty( PFallDiagonal, true ) || hasNoFallBackProperties( PFallDiagonal ) || force )
466 TQDomElement fallDiagonal = doc.createElement( "fall-diagonal" );
467 fallDiagonal.appendChild( util_createElement( "pen", m_pStyle->fallDiagonalPen(), doc ) );
468 format.appendChild( fallDiagonal );
470 if ( hasProperty( PGoUpDiagonal, true ) || hasNoFallBackProperties( PGoUpDiagonal ) || force )
472 TQDomElement goUpDiagonal = doc.createElement( "up-diagonal" );
473 goUpDiagonal.appendChild( util_createElement( "pen", m_pStyle->goUpDiagonalPen(), doc ) );
474 format.appendChild( goUpDiagonal );
479TQDomElement Format::save( TQDomDocument & doc, int _col, int _row, bool force, bool copy ) const
481 TQDomElement format = saveFormat( doc, _col, _row, force, copy );
485bool Format::loadFormat( const TQDomElement & f, Paste::Mode pm, bool paste )
487 if ( f.hasAttribute( "style-name" ) )
489 Style * s = m_pSheet->doc()->styleManager()->style( f.attribute( "style-name" ) );
502 if ( f.hasAttribute( "parent" ) )
504 CustomStyle* s = static_cast<CustomStyle* >( m_pSheet->doc()->styleManager()->style( f.attribute( "parent" ) ) );
509 if ( m_pStyle && m_pStyle-> release() )
512 m_pStyle = new Style();
513 m_pStyle->setParent( s );
518 if ( f.hasAttribute( "align" ) )
520 Align a = (Align) f.attribute( "align" ).toInt( &ok );
524 if ( ( unsigned int) a >= 1 || ( unsigned int) a <= 4 )
529 if ( f.hasAttribute( "alignY" ) )
531 AlignY a = (AlignY) f.attribute( "alignY" ).toInt( &ok );
535 if ( ( unsigned int) a >= 1 || ( unsigned int) a <= 4 )
541 if ( f.hasAttribute( "bgcolor" ) ) {
542 TQColor col( f.attribute( "bgcolor" ) );
543 if ( col != TQt::white )
547 if ( f.hasAttribute( "multirow" ) )
550 if ( f.hasAttribute( "verticaltext" ) )
551 setVerticalText( true );
553 if ( f.hasAttribute( "precision" ) )
555 int i = f.attribute( "precision" ).toInt( &ok );
558 kdDebug(36001) << "Value out of range Cell::precision=" << i << endl;
565 if ( f.hasAttribute( "float" ) )
567 FloatFormat a = (FloatFormat) f.attribute( "float" ).toInt( &ok );
568 if ( !ok ) return false;
569 if ( ( unsigned int) a >= 1 && ( unsigned int) a <= 3 )
575 if ( f.hasAttribute( "floatcolor" ) )
577 FloatColor a = (FloatColor) f.attribute( "floatcolor" ).toInt( &ok );
578 if ( !ok ) return false;
579 if ( ( unsigned int) a >= 1 && ( unsigned int) a <= 4 )
585 if ( f.hasAttribute( "format" ) )
587 int fo = f.attribute( "format" ).toInt( &ok );
590 setFormatType( ( FormatType ) fo );
592 if ( f.hasAttribute( "custom" ) )
594 setFormatString( f.attribute( "custom" ) );
596 if ( m_pStyle->formatType() == Money_format )
600 if ( f.hasAttribute( "type" ) )
602 c.type = f.attribute( "type" ).toInt( &ok );
606 if ( f.hasAttribute( "symbol" ) )
608 c.symbol = f.attribute( "symbol" );
613 if ( f.hasAttribute( "angle" ) )
615 setAngle( f.attribute( "angle" ).toInt( &ok ) );
619 if ( f.hasAttribute( "indent" ) )
621 setIndent( f.attribute( "indent" ).toDouble( &ok ) );
625 if ( f.hasAttribute( "dontprinttext" ) )
626 setDontPrintText( true );
628 if ( f.hasAttribute( "noprotection" ) )
629 setNotProtected( true );
631 if ( f.hasAttribute( "hideall" ) )
634 if ( f.hasAttribute( "hideformula" ) )
635 setHideFormula( true );
637 if ( f.hasAttribute( "brushstyle" ) )
639 setBackGroundBrushStyle( (TQt::BrushStyle) f.attribute( "brushstyle" ).toInt( &ok ) );
644 if ( f.hasAttribute( "brushcolor" ) )
645 setBackGroundBrushColor( TQColor( f.attribute( "brushcolor" ) ) );
647 TQDomElement pen( f.namedItem( "pen" ).toElement() );
649 setTextPen( util_toPen( pen ) );
651 TQDomElement font( f.namedItem( "font" ).toElement() );
652 if ( !font.isNull() )
653 setTextFont( util_toFont( font ) );
657 TQDomElement left( f.namedItem( "left-border" ).toElement() );
658 if ( !left.isNull() )
660 TQDomElement pen( left.namedItem( "pen" ).toElement() );
662 setLeftBorderPen( util_toPen( pen ) );
665 TQDomElement top( f.namedItem( "top-border" ).toElement() );
668 TQDomElement pen( top.namedItem( "pen" ).toElement() );
670 setTopBorderPen( util_toPen( pen ) );
673 TQDomElement right( f.namedItem( "right-border" ).toElement() );
674 if ( !right.isNull() )
676 TQDomElement pen( right.namedItem( "pen" ).toElement() );
678 setRightBorderPen( util_toPen( pen ) );
681 TQDomElement bottom( f.namedItem( "bottom-border" ).toElement() );
682 if ( !bottom.isNull() )
684 TQDomElement pen( bottom.namedItem( "pen" ).toElement() );
686 setBottomBorderPen( util_toPen( pen ) );
689 TQDomElement fallDiagonal( f.namedItem( "fall-diagonal" ).toElement() );
690 if ( !fallDiagonal.isNull() )
692 TQDomElement pen( fallDiagonal.namedItem( "pen" ).toElement() );
694 setFallDiagonalPen( util_toPen( pen ) );
697 TQDomElement goUpDiagonal( f.namedItem( "up-diagonal" ).toElement() );
698 if ( !goUpDiagonal.isNull() )
700 TQDomElement pen( goUpDiagonal.namedItem( "pen" ).toElement() );
702 setGoUpDiagonalPen( util_toPen( pen ) );
706 if ( f.hasAttribute( "prefix" ) )
707 setPrefix( f.attribute( "prefix" ) );
708 if ( f.hasAttribute( "postfix" ) )
709 setPostfix( f.attribute( "postfix" ) );
714bool Format::load( const TQDomElement & f, Paste::Mode pm, bool paste )
716 if ( !loadFormat( f, pm, paste ) )
723bool Format::loadFontOasisStyle( KoStyleStack & font )
725 font.setTypeProperties( "text" );
728 if ( font.hasAttributeNS( KoXmlNS::fo, "font-family" ) )
729 setTextFontFamily( font.attributeNS( KoXmlNS::fo, "font-family" ) );
731 if ( font.hasAttributeNS( KoXmlNS::fo, "color" ) )
732 setTextColor( TQColor( font.attributeNS( KoXmlNS::fo, "color" ) ) );
734 if ( font.hasAttributeNS( KoXmlNS::fo, "font-size" ) )
735 setTextFontSize( ( int) KoUnit::parseValue( font.attributeNS( KoXmlNS::fo, "font-size" ), 10.0 ) );
737 if ( font.hasAttributeNS( KoXmlNS::fo, "font-style" ) && ( font.attributeNS( KoXmlNS::fo, "font-style" )== "italic" ))
739 kdDebug(30518) << "italic" << endl;
740 setTextFontItalic( true );
742 if ( font.hasAttributeNS( KoXmlNS::fo, "font-weight" )
743 && ( font.attributeNS( KoXmlNS::fo, "font-weight" ) == "bold") )
744 setTextFontBold( true );
747 if ( ( font.hasAttributeNS( KoXmlNS::fo, "text-underline-style" ) && font.attributeNS( KoXmlNS::fo, "text-underline-style" ) != "none" )
748 || ( font.hasAttributeNS( KoXmlNS::style, "text-underline-style" ) && font.attributeNS( KoXmlNS::style, "text-underline-style" )!= "none" ) )
749 setTextFontUnderline( true );
751 if ( font.hasAttributeNS( KoXmlNS::style, "text-line-through-style" )
752 && font.attributeNS( KoXmlNS::style, "text-line-through-style" ) != "none"
754 setTextFontStrike( true );
756 if ( font.hasAttributeNS( KoXmlNS::style, "font-pitch" ) )
766void Format::loadOasisStyle( KoOasisLoadingContext& context )
769 KoOasisStyles& oasisStyles = context.oasisStyles();
777 KoStyleStack& styleStack = context.styleStack();
778 loadOasisStyleProperties( styleStack, context.oasisStyles() );
782 kdDebug() << "*** Loading style attributes *****" << endl;
784 if ( styleStack.hasAttributeNS( KoXmlNS::style, "data-style-name" ) )
786 str = styleStack.attributeNS( KoXmlNS::style, "data-style-name" );
787 kdDebug() << " style:data-style-name: " << str << endl << endl;
789 if ( !str.isEmpty() )
791 TQString tmp = oasisStyles.dataFormats()[str].prefix;
792 if ( !tmp.isEmpty() )
796 tmp = oasisStyles.dataFormats()[str].suffix;
797 if ( !tmp.isEmpty() )
801 tmp = oasisStyles.dataFormats()[str].formatStr;
802 if ( !tmp.isEmpty() )
804 setFormatType( Style::formatType( tmp ) );
809 if ( styleStack.hasAttributeNS( KoXmlNS::style, "decimal-places" ) )
812 int p = styleStack.attributeNS( KoXmlNS::style, "decimal-places" ).toInt( &ok );
813 kdDebug() << " style:decimal-places: " << p << endl;
819bool Format::loadOasisStyleProperties( KoStyleStack & styleStack, const KoOasisStyles& oasisStyles )
821 kdDebug() << "*** Loading style properties *****" << endl;
823 if ( f.hasAttribute( "style-name" ) )
825 Style * s = m_pSheet->doc()->styleManager()->style( f.attribute( "style-name" ) );
838 if ( f.hasAttribute( "parent" ) )
845 if ( m_pStyle && m_pStyle-> release() )
848 m_pStyle = new Style();
849 m_pStyle->setParent( s );
853 if ( styleStack.hasAttributeNS( KoXmlNS::style, "parent-style-name" ) )
855 Style * s = m_pSheet->doc()->styleManager()->style( styleStack.attributeNS( KoXmlNS::style, "parent-style-name" ) );
865 setStyle( m_pSheet->doc()->styleManager()->defaultStyle() );
869 if ( styleStack.hasAttributeNS( KoXmlNS::style, "font-name" ) )
871 const TQDomElement * font = oasisStyles.findStyle( styleStack.attributeNS( KoXmlNS::style, "font-name" ) );
875 styleStack.push( *font );
876 loadFontOasisStyle( styleStack );
877 styleStack.restore();
881 kdDebug() << " [text properties]" << endl;
883 loadFontOasisStyle( styleStack );
886 kdDebug() << " [paragraph properties]" << endl;
888 styleStack.setTypeProperties( "paragraph" );
889 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "margin-left" ) )
891 kdDebug()<< " margin-left:"<<KoUnit::parseValue( styleStack.attributeNS( KoXmlNS::fo, "margin-left" ),0.0 )<<endl;
892 setIndent( KoUnit::parseValue( styleStack.attributeNS( KoXmlNS::fo, "margin-left" ),0.0 ) );
895 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "text-align" ) )
897 TQString s = styleStack.attributeNS( KoXmlNS::fo, "text-align" );
899 setAlign( Format::Center );
900 else if ( s == "end" )
901 setAlign( Format::Right );
902 else if ( s == "start" )
903 setAlign( Format::Left );
904 else if ( s == "justify" )
905 setAlign( Format::Center );
909 kdDebug() << " [cell properties]" << endl;
910 styleStack.setTypeProperties( "table-cell" );
922 if ( styleStack.hasAttributeNS( KoXmlNS::style, "rotation-angle" ) )
925 int a = styleStack.attributeNS( KoXmlNS::style, "rotation-angle" ).toInt( &ok );
926 if ( ok && ( a != 0 ))
929 if ( styleStack.hasAttributeNS( KoXmlNS::style, "direction" ) )
931 TQString dir = styleStack.attributeNS( KoXmlNS::fo, "direction" );
933 setVerticalText( true );
934 else if ( dir == "ltr" )
935 setVerticalText( false );
938 kdDebug()<< "property.hasAttribute( fo:background-color ) :"<<styleStack.hasAttributeNS( KoXmlNS::fo, "background-color" )<<endl;
940 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "background-color" ) )
941 setBgColor( TQColor( styleStack.attributeNS( KoXmlNS::fo, "background-color" ) ) );
943 if ( styleStack.hasAttributeNS( KoXmlNS::style, "print-content" ) )
945 if ( styleStack.attributeNS( KoXmlNS::style, "print-content" ) == "false" )
946 setDontPrintText( false );
948 if ( styleStack.hasAttributeNS( KoXmlNS::style, "cell-protect" ) )
950 TQString prot( styleStack.attributeNS( KoXmlNS::style, "cell-protect" ) );
951 if ( prot == "none" )
953 setNotProtected( true );
954 setHideFormula( false );
957 else if ( prot == "formula-hidden" )
959 setNotProtected( true );
960 setHideFormula( true );
963 else if ( prot == "protected formula-hidden" )
965 setNotProtected( false );
966 setHideFormula( true );
969 else if ( prot == "hidden-and-protected" )
971 setNotProtected( false );
972 setHideFormula( false );
975 else if ( prot == "protected" )
977 setNotProtected( false );
978 setHideFormula( false );
982 kdDebug()<< " Protected cell not supported :"<<prot<<endl;
983 kdDebug() << " cell-protect: " << prot << endl;
986 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "padding-left" ) )
987 setIndent( KoUnit::parseValue( styleStack.attributeNS( KoXmlNS::fo, "padding-left" ) ) );
989 if ( styleStack.hasAttributeNS( KoXmlNS::style, "vertical-align" ) )
991 TQString s = styleStack.attributeNS( KoXmlNS::style, "vertical-align" );
993 setAlignY( Format::Middle );
994 else if ( s == "bottom" )
995 setAlignY( Format::Bottom );
996 else if ( s == "top" )
997 setAlignY( Format::Top );
1000 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "wrap-option" ) )
1003 TQString wrapOpt = styleStack.attributeNS( KoXmlNS::fo, "wrap-option" );
1004 if ( wrapOpt == "wrap" )
1005 setMultiRow( true );
1006 else if ( wrapOpt == "no-wrap" )
1007 setMultiRow( false );
1009 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "border-bottom" ) )
1011 setBottomBorderPen( convertOasisStringToPen( styleStack.attributeNS( KoXmlNS::fo, "border-bottom" ) ) );
1015 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "border-right" ) )
1017 setRightBorderPen( convertOasisStringToPen( styleStack.attributeNS( KoXmlNS::fo, "border-right" ) ) );
1021 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "border-top" ) )
1023 setTopBorderPen( convertOasisStringToPen( styleStack.attributeNS( KoXmlNS::fo, "border-top" ) ) );
1027 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "border-left" ) )
1029 setLeftBorderPen( convertOasisStringToPen( styleStack.attributeNS( KoXmlNS::fo, "border-left" ) ) );
1033 if ( styleStack.hasAttributeNS( KoXmlNS::fo, "border" ) )
1035 TQPen pen = convertOasisStringToPen( styleStack.attributeNS( KoXmlNS::fo, "border" ) );
1036 setLeftBorderPen( pen );
1037 setRightBorderPen( pen );
1038 setTopBorderPen( pen );
1039 setBottomBorderPen( pen );
1043 if ( styleStack.hasAttributeNS( KoXmlNS::style, "diagonal-tl-br" ) )
1045 setFallDiagonalPen( convertOasisStringToPen( styleStack.attributeNS( KoXmlNS::style, "diagonal-tl-br" ) ) );
1047 if ( styleStack.hasAttributeNS( KoXmlNS::style, "diagonal-bl-tr" ) )
1049 setGoUpDiagonalPen( convertOasisStringToPen( styleStack.attributeNS( KoXmlNS::style, "diagonal-bl-tr" ) ) );
1052 if ( styleStack.hasAttributeNS( KoXmlNS::draw, "style-name" ) )
1056 const TQDomElement * style = oasisStyles.findStyle( styleStack.attributeNS( KoXmlNS::draw, "style-name" ), "graphic" );
1060 KoStyleStack drawStyleStack;
1061 drawStyleStack.push( *style );
1062 drawStyleStack.setTypeProperties( "graphic" );
1063 if ( drawStyleStack.hasAttributeNS( KoXmlNS::draw, "fill" ) )
1065 const TQString fill = drawStyleStack.attributeNS( KoXmlNS::draw, "fill" );
1066 kdDebug()<< " load object gradient fill type :"<<fill<<endl;
1068 if ( fill == "solid" || fill == "hatch" )
1070 TQBrush brush=KoOasisStyles::loadOasisFillStyle( drawStyleStack, fill, oasisStyles );
1071 setBackGroundBrushStyle( brush.style() );
1072 setBackGroundBrushColor( brush.color() );
1075 kdDebug()<< " fill style not supported by kspread : "<<fill<<endl;
1091void Format::setFormatString( TQString const & format )
1093 if ( format.isEmpty() )
1095 clearProperty( PCustomFormat );
1096 setNoFallBackProperties( PCustomFormat );
1100 setProperty( PCustomFormat );
1101 clearNoFallBackProperties( PCustomFormat );
1104 clearProperty( PPrefix );
1105 clearProperty( PPostfix );
1106 clearProperty( PPrecision );
1107 clearProperty( PFloatColor );
1108 clearProperty( PFloatFormat );
1110 setNoFallBackProperties( PPrecision );
1111 setNoFallBackProperties( PPrefix );
1112 setNoFallBackProperties( PPostfix );
1115 m_pStyle = m_pStyle->setStrFormat( format );
1119void Format::setAlign( Align _align )
1121 if ( _align == Format::Undefined )
1123 clearProperty( PAlign );
1124 setNoFallBackProperties(PAlign );
1128 setProperty( PAlign );
1129 clearNoFallBackProperties(PAlign );
1132 m_pStyle = m_pStyle->setAlignX( _align );
1136void Format::setAlignY( AlignY _alignY)
1139 if ( _alignY == Format::Middle )
1142 clearProperty( PAlignY );
1143 setNoFallBackProperties(PAlignY );
1148 setProperty( PAlignY );
1149 clearNoFallBackProperties( PAlignY );
1152 m_pStyle = m_pStyle->setAlignY( _alignY );
1156void Format::setPrefix( const TQString& _prefix )
1158 if ( _prefix.isEmpty() )
1160 clearProperty( PPrefix );
1161 setNoFallBackProperties( PPrefix );
1165 setProperty( PPrefix );
1166 clearNoFallBackProperties( PPrefix );
1169 m_pStyle = m_pStyle->setPrefix( _prefix );
1173void Format::setPostfix( const TQString& _postfix )
1175 if ( _postfix.isEmpty() )
1177 clearProperty( PPostfix );
1178 setNoFallBackProperties( PPostfix );
1182 setProperty( PPostfix );
1183 clearNoFallBackProperties( PPostfix );
1186 m_pStyle = m_pStyle->setPostfix( _postfix );
1190void Format::setPrecision( int _p )
1194 clearProperty( PPrecision );
1195 setNoFallBackProperties( PPrecision );
1199 setProperty( PPrecision );
1200 clearNoFallBackProperties( PPrecision );
1203 m_pStyle = m_pStyle->setPrecision( _p );
1207void Format::setLeftBorderPen( const TQPen & _p )
1209 if ( _p.style() == TQt::NoPen )
1211 clearProperty( PLeftBorder );
1212 setNoFallBackProperties( PLeftBorder );
1216 setProperty( PLeftBorder );
1217 clearNoFallBackProperties( PLeftBorder );
1220 m_pStyle = m_pStyle->setLeftBorderPen( _p );
1224void Format::setLeftBorderStyle( TQt::PenStyle s )
1226 TQPen p( m_pStyle->leftBorderPen() );
1228 setLeftBorderPen( p );
1231void Format::setLeftBorderColor( const TQColor & c )
1233 TQPen p( m_pStyle->leftBorderPen() );
1235 setLeftBorderPen( p );
1238void Format::setLeftBorderWidth( int _w )
1240 TQPen p( m_pStyle->leftBorderPen() );
1242 setLeftBorderPen( p );
1245void Format::setTopBorderPen( const TQPen & _p )
1247 if ( _p.style() == TQt::NoPen )
1249 clearProperty( PTopBorder );
1250 setNoFallBackProperties( PTopBorder );
1254 setProperty( PTopBorder );
1255 clearNoFallBackProperties( PTopBorder );
1258 m_pStyle = m_pStyle->setTopBorderPen( _p );
1262void Format::setTopBorderStyle( TQt::PenStyle s )
1264 TQPen p( m_pStyle->topBorderPen() );
1266 setTopBorderPen( p );
1269void Format::setTopBorderColor( const TQColor& c )
1271 TQPen p( m_pStyle->topBorderPen() );
1273 setTopBorderPen( p );
1276void Format::setTopBorderWidth( int _w )
1278 TQPen p( m_pStyle->topBorderPen() );
1280 setTopBorderPen( p );
1283void Format::setRightBorderPen( const TQPen& p )
1285 if ( p.style() == TQt::NoPen )
1287 clearProperty( PRightBorder );
1288 setNoFallBackProperties( PRightBorder );
1292 setProperty( PRightBorder );
1293 clearNoFallBackProperties( PRightBorder );
1296 m_pStyle = m_pStyle->setRightBorderPen( p );
1300void Format::setRightBorderStyle( TQt::PenStyle _s )
1302 TQPen p( m_pStyle->rightBorderPen() );
1304 setRightBorderPen( p );
1307void Format::setRightBorderColor( const TQColor & _c )
1309 TQPen p( m_pStyle->rightBorderPen() );
1311 setRightBorderPen( p );
1314void Format::setRightBorderWidth( int _w )
1316 TQPen p( m_pStyle->rightBorderPen() );
1318 setRightBorderPen( p );
1321void Format::setBottomBorderPen( const TQPen& p )
1323 if ( p.style() == TQt::NoPen )
1325 clearProperty( PBottomBorder );
1326 setNoFallBackProperties( PBottomBorder );
1330 setProperty( PBottomBorder );
1331 clearNoFallBackProperties( PBottomBorder );
1334 m_pStyle = m_pStyle->setBottomBorderPen( p );
1338void Format::setBottomBorderStyle( TQt::PenStyle _s )
1340 TQPen p( m_pStyle->bottomBorderPen() );
1342 setBottomBorderPen( p );
1345void Format::setBottomBorderColor( const TQColor & _c )
1347 TQPen p( m_pStyle->bottomBorderPen() );
1349 setBottomBorderPen( p );
1352void Format::setBottomBorderWidth( int _w )
1354 TQPen p( m_pStyle->bottomBorderPen() );
1356 setBottomBorderPen( p );
1359void Format::setFallDiagonalPen( const TQPen & _p )
1361 if ( _p.style() == TQt::NoPen )
1363 clearProperty( PFallDiagonal );
1364 setNoFallBackProperties( PFallDiagonal );
1368 setProperty( PFallDiagonal );
1369 clearNoFallBackProperties( PFallDiagonal );
1372 m_pStyle = m_pStyle->setFallDiagonalPen( _p );
1376void Format::setFallDiagonalStyle( TQt::PenStyle s )
1378 TQPen p( m_pStyle->fallDiagonalPen() );
1380 setFallDiagonalPen( p );
1383void Format::setFallDiagonalColor( const TQColor& c )
1385 TQPen p( m_pStyle->fallDiagonalPen() );
1387 setFallDiagonalPen( p );
1390void Format::setFallDiagonalWidth( int _w )
1392 TQPen p( m_pStyle->fallDiagonalPen() );
1394 setFallDiagonalPen( p );
1397void Format::setGoUpDiagonalPen( const TQPen & _p )
1399 if ( _p.style() == TQt::NoPen )
1401 clearProperty( PGoUpDiagonal );
1402 setNoFallBackProperties( PGoUpDiagonal );
1406 setProperty( PGoUpDiagonal );
1407 clearNoFallBackProperties( PGoUpDiagonal );
1410 m_pStyle = m_pStyle->setGoUpDiagonalPen( _p );
1414void Format::setGoUpDiagonalStyle( TQt::PenStyle s )
1416 TQPen p( m_pStyle->goUpDiagonalPen() );
1418 setGoUpDiagonalPen( p );
1421void Format::setGoUpDiagonalColor( const TQColor& c )
1423 TQPen p( m_pStyle->goUpDiagonalPen() );
1425 setGoUpDiagonalPen( p );
1428void Format::setGoUpDiagonalWidth( int _w )
1430 TQPen p( m_pStyle->goUpDiagonalPen() );
1432 setGoUpDiagonalPen( p );
1435void Format::setBackGroundBrush( const TQBrush & _p)
1437 if ( _p.style() == TQt::NoBrush )
1439 clearProperty( PBackgroundBrush );
1440 setNoFallBackProperties( PBackgroundBrush );
1444 setProperty( PBackgroundBrush );
1445 clearNoFallBackProperties( PBackgroundBrush );
1448 m_pStyle = m_pStyle->setBackGroundBrush( _p );
1452void Format::setBackGroundBrushStyle( TQt::BrushStyle s )
1454 TQBrush b( m_pStyle->backGroundBrush() );
1456 setBackGroundBrush( b );
1459void Format::setBackGroundBrushColor( const TQColor & c )
1461 TQBrush b( m_pStyle->backGroundBrush() );
1463 setBackGroundBrush( b );
1466void Format::setTextFont( const TQFont & _f )
1468 if( m_pStyle->parent() && _f == m_pStyle->parent()->font())
1470 clearProperty( PFont );
1471 setNoFallBackProperties( PFont );
1473 else if( !m_pStyle->parent() && _f == KoGlobal::defaultFont() )
1475 clearProperty( PFont );
1476 setNoFallBackProperties( PFont );
1480 setProperty( PFont );
1481 clearNoFallBackProperties( PFont );
1485 m_pStyle = m_pStyle->setFont( _f );
1489void Format::setTextFontSize( int _s )
1491 TQFont f( m_pStyle->font() );
1492 f.setPointSize( _s );
1496void Format::setTextFontFamily( const TQString & _f )
1498 TQFont f( m_pStyle->font() );
1503void Format::setTextFontBold( bool _b )
1505 TQFont f( m_pStyle->font() );
1510void Format::setTextFontItalic( bool _i )
1512 TQFont f( m_pStyle->font() );
1517void Format::setTextFontUnderline( bool _i )
1519 TQFont f( m_pStyle->font() );
1520 f.setUnderline( _i );
1524void Format::setTextFontStrike( bool _i )
1526 TQFont f( m_pStyle->font() );
1527 f.setStrikeOut( _i );
1531void Format::setTextPen( const TQPen & _p )
1543 setProperty( PTextPen );
1544 clearNoFallBackProperties( PTextPen );
1548 m_pStyle = m_pStyle->setPen( _p );
1553void Format::setTextColor( const TQColor & _c )
1555 TQPen p( m_pStyle->pen() );
1560void Format::setBgColor( const TQColor & _c )
1562 if ( !_c.isValid() )
1564 clearProperty( PBackgroundColor );
1565 setNoFallBackProperties( PBackgroundColor );
1569 setProperty( PBackgroundColor );
1570 clearNoFallBackProperties( PBackgroundColor );
1573 m_pStyle = m_pStyle->setBgColor( _c );
1577void Format::setFloatFormat( FloatFormat _f )
1579 setProperty( PFloatFormat );
1581 m_pStyle = m_pStyle->setFloatFormat( _f );
1585void Format::setFloatColor( FloatColor _c )
1587 setProperty( PFloatColor );
1589 m_pStyle = m_pStyle->setFloatColor( _c );
1593void Format::setMultiRow( bool _b )
1597 m_pStyle = m_pStyle->clearProperty( Style::PMultiRow );
1598 clearProperty( PMultiRow );
1599 setNoFallBackProperties( PMultiRow );
1603 m_pStyle = m_pStyle->setProperty( Style::PMultiRow );
1604 setProperty( PMultiRow );
1605 clearNoFallBackProperties( PMultiRow );
1610void Format::setVerticalText( bool _b )
1614 m_pStyle = m_pStyle->clearProperty( Style::PVerticalText );
1615 setNoFallBackProperties( PVerticalText);
1616 clearFlag( Flag_VerticalText );
1620 m_pStyle = m_pStyle->setProperty( Style::PVerticalText );
1621 clearNoFallBackProperties( PVerticalText);
1622 setFlag( Flag_VerticalText );
1627void Format::setFormatType( FormatType _format )
1629 if ( _format == Number_format )
1631 clearProperty( PFormatType );
1632 setNoFallBackProperties( PFormatType);
1636 setProperty( PFormatType );
1637 clearNoFallBackProperties( PFormatType);
1640 m_pStyle = m_pStyle->setFormatType( _format );
1644void Format::setAngle( int _angle )
1648 clearProperty( PAngle );
1649 setNoFallBackProperties( PAngle);
1653 setProperty( PAngle );
1654 clearNoFallBackProperties( PAngle);
1657 m_pStyle = m_pStyle->setRotateAngle( _angle );
1661void Format::setIndent( double _indent )
1663 if ( _indent == 0.0 )
1665 clearProperty( PIndent );
1666 setNoFallBackProperties( PIndent );
1670 setProperty( PIndent );
1671 clearNoFallBackProperties( PIndent );
1674 m_pStyle = m_pStyle->setIndent( _indent );
1678void Format::setComment( const TQString & _comment )
1680 if ( _comment.isEmpty() )
1682 clearProperty( PComment );
1683 setNoFallBackProperties( PComment );
1687 setProperty( PComment );
1688 clearNoFallBackProperties( PComment );
1692 delete m_strComment;
1693 if ( !_comment.isEmpty() )
1694 m_strComment = new TQString( _comment );
1700void Format::setNotProtected( bool _b)
1704 m_pStyle = m_pStyle->clearProperty( Style::PNotProtected );
1705 setNoFallBackProperties( PNotProtected );
1706 clearFlag( Flag_NotProtected );
1710 m_pStyle = m_pStyle->setProperty( Style::PNotProtected );
1711 clearNoFallBackProperties( PNotProtected );
1712 setFlag( Flag_NotProtected );
1717void Format::setDontPrintText( bool _b )
1721 m_pStyle = m_pStyle->clearProperty( Style::PDontPrintText );
1722 setNoFallBackProperties(PDontPrintText);
1723 clearFlag( Flag_DontPrintText );
1727 m_pStyle = m_pStyle->setProperty( Style::PDontPrintText );
1728 clearNoFallBackProperties( PDontPrintText);
1729 setFlag( Flag_DontPrintText );
1734void Format::setHideAll( bool _b )
1738 m_pStyle = m_pStyle->clearProperty( Style::PHideAll );
1739 setNoFallBackProperties(PHideAll);
1740 clearFlag( Flag_HideAll );
1744 m_pStyle = m_pStyle->setProperty( Style::PHideAll );
1745 clearNoFallBackProperties( PHideAll);
1746 setFlag( Flag_HideAll );
1751void Format::setHideFormula( bool _b )
1755 m_pStyle = m_pStyle->clearProperty( Style::PHideFormula );
1756 setNoFallBackProperties( PHideFormula );
1757 clearFlag( Flag_HideFormula );
1761 m_pStyle = m_pStyle->setProperty( Style::PHideFormula );
1762 clearNoFallBackProperties( PHideFormula );
1763 setFlag( Flag_HideFormula );
1768void Format::setCurrency( Currency const & c )
1770 m_pStyle = m_pStyle->setCurrency( c );
1773void Format::setCurrency( int type, TQString const & symbol )
1777 c.symbol = symbol.simplifyWhiteSpace();
1780 if (c.symbol.length() == 0)
1783 c.symbol = sheet()->doc()->locale()->currencySymbol();
1786 m_pStyle = m_pStyle->setCurrency( c );
1795TQString const & Format::getFormatString( int col, int row ) const
1797 if ( !hasProperty( PCustomFormat, false ) && !hasNoFallBackProperties( PCustomFormat ))
1799 const Format * l = fallbackFormat( col, row );
1801 return l->getFormatString( col, row );
1803 return m_pStyle->strFormat();
1806TQString Format::prefix( int col, int row ) const
1808 if ( !hasProperty( PPrefix, false ) && !hasNoFallBackProperties(PPrefix ))
1810 const Format * l = fallbackFormat( col, row );
1812 return l->prefix( col, row );
1814 return m_pStyle->prefix();
1817TQString Format::postfix( int col, int row ) const
1819 if ( !hasProperty( PPostfix, false ) && !hasNoFallBackProperties(PPostfix ))
1821 const Format * l = fallbackFormat( col, row );
1823 return l->postfix( col, row );
1825 return m_pStyle->postfix();
1828const TQPen& Format::fallDiagonalPen( int col, int row ) const
1830 if ( !hasProperty( PFallDiagonal, false ) && !hasNoFallBackProperties(PFallDiagonal ))
1832 const Format* l = fallbackFormat( col, row );
1834 return l->fallDiagonalPen( col, row );
1836 return m_pStyle->fallDiagonalPen();
1839int Format::fallDiagonalWidth( int col, int row ) const
1841 return fallDiagonalPen( col, row ).width();
1844TQt::PenStyle Format::fallDiagonalStyle( int col, int row ) const
1846 return fallDiagonalPen( col, row ).style();
1849const TQColor & Format::fallDiagonalColor( int col, int row ) const
1851 return fallDiagonalPen( col, row ).color();
1854const TQPen & Format::goUpDiagonalPen( int col, int row ) const
1856 if ( !hasProperty( PGoUpDiagonal, false ) && !hasNoFallBackProperties( PGoUpDiagonal ) )
1858 const Format* l = fallbackFormat( col, row );
1860 return l->goUpDiagonalPen( col, row );
1862 return m_pStyle->goUpDiagonalPen();
1865int Format::goUpDiagonalWidth( int col, int row ) const
1867 return goUpDiagonalPen( col, row ).width();
1870TQt::PenStyle Format::goUpDiagonalStyle( int col, int row ) const
1872 return goUpDiagonalPen( col, row ).style();
1875const TQColor& Format::goUpDiagonalColor( int col, int row ) const
1877 return goUpDiagonalPen( col, row ).color();
1880uint Format::bottomBorderValue( int col, int row ) const
1882 if ( !hasProperty( PBottomBorder, false ) && !hasNoFallBackProperties( PBottomBorder ) )
1884 const Format * l = fallbackFormat( col, row );
1886 return l->bottomBorderValue( col, row );
1891 return m_pStyle->bottomPenValue();
1894uint Format::rightBorderValue( int col, int row ) const
1896 if ( !hasProperty( PRightBorder, false ) && !hasNoFallBackProperties( PRightBorder ) )
1898 const Format * l = fallbackFormat( col, row );
1900 return l->rightBorderValue( col, row );
1905 return m_pStyle->rightPenValue();
1908uint Format::leftBorderValue( int col, int row ) const
1910 if ( !hasProperty( PLeftBorder, false ) && !hasNoFallBackProperties( PLeftBorder ) )
1912 const Format * l = fallbackFormat( col, row );
1914 return l->leftBorderValue( col, row );
1919 return m_pStyle->leftPenValue();
1922uint Format::topBorderValue( int col, int row ) const
1924 if ( !hasProperty( PTopBorder, false ) && !hasNoFallBackProperties( PTopBorder ) )
1926 const Format * l = fallbackFormat( col, row );
1928 return l->topBorderValue( col, row );
1933 return m_pStyle->topPenValue();
1936const TQPen& Format::leftBorderPen( int col, int row ) const
1938 if ( !hasProperty( PLeftBorder, false ) && !hasNoFallBackProperties( PLeftBorder ) )
1940 const Format * l = fallbackFormat( col, row );
1942 return l->leftBorderPen( col, row );
1943 return sheet()->emptyPen();
1946 return m_pStyle->leftBorderPen();
1949TQt::PenStyle Format::leftBorderStyle( int col, int row ) const
1951 return leftBorderPen( col, row ).style();
1954const TQColor& Format::leftBorderColor( int col, int row ) const
1956 return leftBorderPen( col, row ).color();
1959int Format::leftBorderWidth( int col, int row ) const
1961 return leftBorderPen( col, row ).width();
1964const TQPen& Format::topBorderPen( int col, int row ) const
1966 if ( !hasProperty( PTopBorder, false ) && !hasNoFallBackProperties( PTopBorder ) )
1968 const Format* l = fallbackFormat( col, row );
1970 return l->topBorderPen( col, row );
1971 return sheet()->emptyPen();
1974 return m_pStyle->topBorderPen();
1977const TQColor& Format::topBorderColor( int col, int row ) const
1979 return topBorderPen( col, row ).color();
1982TQt::PenStyle Format::topBorderStyle( int col, int row ) const
1984 return topBorderPen( col, row ).style();
1987int Format::topBorderWidth( int col, int row ) const
1989 return topBorderPen( col, row ).width();
1992const TQPen& Format::rightBorderPen( int col, int row ) const
1994 if ( !hasProperty( PRightBorder, false ) && !hasNoFallBackProperties( PRightBorder ) )
1996 const Format * l = fallbackFormat( col, row );
1998 return l->rightBorderPen( col, row );
1999 return sheet()->emptyPen();
2002 return m_pStyle->rightBorderPen();
2005int Format::rightBorderWidth( int col, int row ) const
2007 return rightBorderPen( col, row ).width();
2010TQt::PenStyle Format::rightBorderStyle( int col, int row ) const
2012 return rightBorderPen( col, row ).style();
2015const TQColor& Format::rightBorderColor( int col, int row ) const
2017 return rightBorderPen( col, row ).color();
2020const TQPen& Format::bottomBorderPen( int col, int row ) const
2022 if ( !hasProperty( PBottomBorder, false )&& !hasNoFallBackProperties( PBottomBorder ) )
2024 const Format * l = fallbackFormat( col, row );
2026 return l->bottomBorderPen( col, row );
2027 return sheet()->emptyPen();
2030 return m_pStyle->bottomBorderPen();
2033int Format::bottomBorderWidth( int col, int row ) const
2035 return bottomBorderPen( col, row ).width();
2038TQt::PenStyle Format::bottomBorderStyle( int col, int row ) const
2040 return bottomBorderPen( col, row ).style();
2043const TQColor& Format::bottomBorderColor( int col, int row ) const
2045 return bottomBorderPen( col, row ).color();
2048const TQBrush& Format::backGroundBrush( int col, int row ) const
2050 if ( !hasProperty( PBackgroundBrush, false ) && !hasNoFallBackProperties(PBackgroundBrush ))
2052 const Format* l = fallbackFormat( col, row );
2054 return l->backGroundBrush( col, row );
2056 return m_pStyle->backGroundBrush();
2059TQt::BrushStyle Format::backGroundBrushStyle( int col, int row ) const
2061 return backGroundBrush( col, row ).style();
2064const TQColor& Format::backGroundBrushColor( int col, int row ) const
2066 return backGroundBrush( col, row ).color();
2069int Format::precision( int col, int row ) const
2071 if ( !hasProperty( PPrecision, false )&& !hasNoFallBackProperties( PPrecision ) )
2073 const Format * l = fallbackFormat( col, row );
2075 return l->precision( col, row );
2077 return m_pStyle->precision();
2080Format::FloatFormat Format::floatFormat( int col, int row ) const
2082 if ( !hasProperty( PFloatFormat, false ) && !hasNoFallBackProperties( PFloatFormat ) )
2084 const Format * l = fallbackFormat( col, row );
2086 return l->floatFormat( col, row );
2088 return m_pStyle->floatFormat();
2091Format::FloatColor Format::floatColor( int col, int row ) const
2093 if ( !hasProperty( PFloatColor, false ) && !hasNoFallBackProperties( PFloatColor ) )
2095 const Format * l = fallbackFormat( col, row );
2097 return l->floatColor( col, row );
2099 return m_pStyle->floatColor();
2102const TQColor& Format::bgColor( int col, int row ) const
2104 if ( !hasProperty( PBackgroundColor, false ) && !hasNoFallBackProperties( PBackgroundColor ) )
2106 const Format * l = fallbackFormat( col, row );
2108 return l->bgColor( col, row );
2111 return m_pStyle->bgColor();
2114const TQPen& Format::textPen( int col, int row ) const
2116 if ( !hasProperty( PTextPen, false ) && !hasNoFallBackProperties( PTextPen ) )
2118 const Format * l = fallbackFormat( col, row );
2120 return l->textPen( col, row );
2122 return m_pStyle->pen();
2125const TQColor& Format::textColor( int col, int row ) const
2127 return textPen( col, row ).color();
2130const TQFont Format::textFont( int col, int row ) const
2132 if ( !hasProperty( PFont, false ) && !hasNoFallBackProperties( PFont ) )
2134 const Format * l = fallbackFormat( col, row );
2136 return l->textFont( col, row );
2139 return m_pStyle->font();
2142int Format::textFontSize( int col, int row ) const
2144 if ( !hasProperty( PFont, false ) && !hasNoFallBackProperties( PFont ) )
2146 const Format * l = fallbackFormat( col, row );
2148 return l->textFontSize( col, row );
2151 return m_pStyle->fontSize();
2154TQString const & Format::textFontFamily( int col, int row ) const
2156 if ( !hasProperty( PFont, false ) && !hasNoFallBackProperties( PFont ) )
2158 const Format * l = fallbackFormat( col, row );
2160 return l->textFontFamily( col, row );
2163 return m_pStyle->fontFamily();
2166bool Format::textFontBold( int col, int row ) const
2168 if ( !hasProperty( PFont, false ) && !hasNoFallBackProperties( PFont ) )
2170 const Format * l = fallbackFormat( col, row );
2172 return l->textFontBold( col, row );
2175 return ( m_pStyle->fontFlags() & Style::FBold );
2178bool Format::textFontItalic( int col, int row ) const
2180 if ( !hasProperty( PFont, false ) && !hasNoFallBackProperties( PFont ) )
2182 const Format * l = fallbackFormat( col, row );
2184 return l->textFontItalic( col, row );
2187 return ( m_pStyle->fontFlags() & Style::FItalic );
2190bool Format::textFontUnderline( int col, int row ) const
2192 if ( !hasProperty( PFont, false ) && !hasNoFallBackProperties( PFont ) )
2194 const Format * l = fallbackFormat( col, row );
2196 return l->textFontUnderline( col, row );
2199 return ( m_pStyle->fontFlags() & Style::FUnderline );
2202bool Format::textFontStrike( int col, int row ) const
2204 if ( !hasProperty( PFont, false ) && !hasNoFallBackProperties( PFont ) )
2206 const Format * l = fallbackFormat( col, row );
2208 return l->textFontStrike( col, row );
2211 return ( m_pStyle->fontFlags() & Style::FStrike );
2214Format::Align Format::align( int col, int row ) const
2216 if ( !hasProperty( PAlign, false ) && !hasNoFallBackProperties( PAlign ) )
2218 const Format * l = fallbackFormat( col, row );
2220 return l->align( col, row );
2223 return m_pStyle->alignX();
2226Format::AlignY Format::alignY( int col, int row ) const
2228 if ( !hasProperty( PAlignY, false )&& !hasNoFallBackProperties( PAlignY ) )
2230 const Format * l = fallbackFormat( col, row );
2232 return l->alignY( col, row );
2235 return m_pStyle->alignY();
2238bool Format::multiRow( int col, int row ) const
2240 if ( !hasProperty( PMultiRow, false ) && !hasNoFallBackProperties( PMultiRow ) )
2242 const Format * l = fallbackFormat( col, row );
2244 return l->multiRow( col, row );
2247 return m_pStyle->hasProperty( Style::PMultiRow );
2250bool Format::verticalText( int col, int row ) const
2252 if ( !hasProperty( PVerticalText, false )&& !hasNoFallBackProperties( PVerticalText ) )
2254 const Format * l = fallbackFormat( col, row );
2256 return l->verticalText( col, row );
2259 return m_pStyle->hasProperty( Style::PVerticalText );
2262FormatType Format::getFormatType( int col, int row ) const
2264 if ( !hasProperty( PFormatType, false ) && !hasNoFallBackProperties( PFormatType ) )
2266 const Format* l = fallbackFormat( col, row );
2268 return l->getFormatType( col, row );
2271 return m_pStyle->formatType();
2274int Format::getAngle( int col, int row ) const
2276 if ( !hasProperty( PAngle, false ) && !hasNoFallBackProperties( PAngle ) )
2278 const Format* l = fallbackFormat( col, row );
2280 return l->getAngle( col, row );
2283 return m_pStyle->rotateAngle();
2286TQString Format::comment( int col, int row ) const
2288 if ( !hasProperty( PComment, false ) && !hasNoFallBackProperties( PComment ))
2290 const Format* l = fallbackFormat( col, row );
2292 return l->comment( col, row );
2295 if ( !m_strComment )
2299 return *m_strComment;
2302TQString * Format::commentP( int col, int row ) const
2304 if ( !hasProperty( PComment, false ) && !hasNoFallBackProperties( PComment ))
2306 const Format* l = fallbackFormat( col, row );
2308 return l->commentP( col, row );
2311 return m_strComment;
2314double Format::getIndent( int col, int row ) const
2316 if ( !hasProperty( PIndent, false ) && !hasNoFallBackProperties( PIndent ) )
2318 const Format* l = fallbackFormat( col, row );
2320 return l->getIndent( col, row );
2323 return m_pStyle->indent();
2326bool Format::getDontprintText( int col, int row ) const
2328 if ( !hasProperty( PDontPrintText, false )&& !hasNoFallBackProperties( PDontPrintText ) )
2330 const Format* l = fallbackFormat( col, row );
2332 return l->getDontprintText( col, row );
2335 return m_pStyle->hasProperty( Style::PDontPrintText );
2338bool Format::isProtected( int col, int row ) const
2340 return ( m_pSheet->isProtected() && !notProtected( col, row ) );
2344bool Format::notProtected( int col, int row) const
2346 if ( !hasProperty( PNotProtected, false )&& !hasNoFallBackProperties( PNotProtected ) )
2348 const Format * l = fallbackFormat( col, row );
2350 return l->notProtected( col, row );
2353 return m_pStyle->hasProperty( Style::PNotProtected );
2356bool Format::isHideAll( int col, int row) const
2358 if ( !hasProperty( PHideAll, false )&& !hasNoFallBackProperties( PHideAll ) )
2360 const Format * l = fallbackFormat( col, row );
2362 return l->isHideAll( col, row );
2365 return m_pStyle->hasProperty( Style::PHideAll );
2368bool Format::isHideFormula( int col, int row) const
2370 if ( !hasProperty( PHideFormula, false )&& !hasNoFallBackProperties( PHideFormula ) )
2372 const Format * l = fallbackFormat( col, row );
2374 return l->isHideFormula( col, row );
2377 return m_pStyle->hasProperty( Style::PHideFormula );
2380bool Format::currencyInfo( Currency & currency) const
2383 if ( m_pStyle->formatType() != Money_format )
2386 currency.symbol = m_pStyle->currency().symbol;
2387 currency.type = m_pStyle->currency().type;
2392TQString Format::getCurrencySymbol() const
2395 return m_pStyle->currency().symbol;
2398TQFont Format::font() const
2400 return m_pStyle->font();
2410const TQPen & Format::leftBorderPen() const
2412 return m_pStyle->leftBorderPen();
2415const TQPen & Format::topBorderPen() const
2417 return m_pStyle->topBorderPen();
2420const TQPen & Format::rightBorderPen() const
2422 return m_pStyle->rightBorderPen();
2425const TQPen & Format::bottomBorderPen() const
2427 return m_pStyle->bottomBorderPen();
2430const TQPen & Format::fallDiagonalPen() const
2432 return m_pStyle->fallDiagonalPen();
2435const TQPen & Format::goUpDiagonalPen() const
2437 return m_pStyle->goUpDiagonalPen();
2440const TQBrush & Format::backGroundBrush() const
2442 return m_pStyle->backGroundBrush();
2445const TQFont Format::textFont() const
2447 return m_pStyle->font();
2450const TQPen & Format::textPen() const
2452 return m_pStyle->pen();
2461void Format::formatChanged()
2465 m_pCell->setFlag(Cell::Flag_LayoutDirty);
2466 m_pCell->setFlag(Cell::Flag_TextFormatDirty);
2470Format* Format::fallbackFormat( int, int row )
2472 return m_pCell ? m_pSheet->rowFormat( row ) : 0;
2475const Format* Format::fallbackFormat( int, int row ) const
2477 return m_pCell ? m_pSheet->rowFormat( row ) : 0;
2480bool Format::isDefault() const
2484 if ( ( m_mask & PComment ) && m_strComment != 0 )
2489 if ( m_flagsMask != 0 )
2492 if ( m_bNoFallBack != 0 )
2494 return ( *m_pStyle == *m_pSheet->doc()->styleManager()->defaultStyle() );
2497bool Format::operator==( const Format& other ) const
2501 if ( ( m_mask & other.m_mask & PComment ) && m_strComment != other.m_strComment )
2504 if ( m_mask != other.m_mask )
2506 if ( m_flagsMask != other.m_flagsMask )
2509 if ( m_bNoFallBack != other.m_bNoFallBack )
2511 return ( *m_pStyle == *other.m_pStyle );
2523RowFormat::RowFormat( Sheet * _sheet, int _row )
2524 : Format( _sheet, _sheet->doc()->styleManager()->defaultStyle() )
2529 m_bDisplayDirtyFlag = false;
2530 m_fHeight = s_rowHeight;
2537RowFormat::~RowFormat()
2540 m_next->setPrevious( m_prev );
2542 m_prev->setNext( m_next );
2546DCOPObject * RowFormat::dcopObject()
2549 m_dcop = new RowIface( this );
2554void RowFormat::setMMHeight( double _h )
2556 setDblHeight( MM_TO_POINT ( _h ) );
2559void RowFormat::setHeight( int _h, const Canvas * _canvas )
2561 setDblHeight( ( double) _h, _canvas );
2564void RowFormat::setDblHeight( double _h, const Canvas * _canvas )
2566 Sheet *_sheet = _canvas ? _canvas-> activeSheet() : m_pSheet;
2569 if ( kAbs( _h - dblHeight( _canvas ) ) < DBL_EPSILON )
2575 _sheet->adjustSizeMaxY ( - dblHeight() );
2578 m_fHeight = ( _h / _canvas-> zoom() );
2583 _sheet->adjustSizeMaxY ( dblHeight() );
2584 _sheet->print()->updatePrintRepeatRowsHeight();
2585 _sheet->print()->updateNewPageListY ( row() );
2587 _sheet->emit_updateRow( this,m_iRow);
2591int RowFormat::height( const Canvas *_canvas ) const
2593 return ( int) dblHeight( _canvas );
2596double RowFormat::dblHeight( const Canvas *_canvas ) const
2602 return _canvas-> zoom() * (m_iRow == 0) ? s_rowHeight : m_fHeight;
2604 return (m_iRow == 0) ? s_rowHeight : m_fHeight;
2607double RowFormat::mmHeight() const
2609 return POINT_TO_MM ( dblHeight() );
2612TQDomElement RowFormat::save( TQDomDocument& doc, int yshift, bool copy ) const
2614 TQDomElement row = doc.createElement( "row" );
2615 row.setAttribute( "height", m_fHeight );
2616 row.setAttribute( "row", m_iRow - yshift );
2618 row.setAttribute( "hide", ( int) m_bHide );
2620 TQDomElement format( saveFormat( doc, false, copy ) );
2621 row.appendChild( format );
2626bool RowFormat::loadOasis( const TQDomElement& , TQDomElement * )
2632bool RowFormat::load( const TQDomElement & row, int yshift, Paste::Mode sp, bool paste )
2636 m_iRow = row.attribute( "row" ).toInt( &ok ) + yshift;
2640 if ( row.hasAttribute( "height" ) )
2642 if ( m_pSheet->doc()->syntaxVersion() < 1 )
2643 m_fHeight = tqRound( MM_TO_POINT( row.attribute( "height" ).toDouble( &ok ) ) );
2645 m_fHeight = row.attribute( "height" ).toDouble( &ok );
2647 if ( !ok ) return false;
2651 if ( m_fHeight < 0 )
2653 kdDebug(36001) << "Value height=" << m_fHeight << " out of range" << endl;
2656 if ( m_iRow < 1 || m_iRow > KS_rowMax )
2658 kdDebug(36001) << "Value row=" << m_iRow << " out of range" << endl;
2662 if ( row.hasAttribute( "hide" ) )
2664 setHide( ( int) row.attribute( "hide" ).toInt( &ok ) );
2669 TQDomElement f( row.namedItem( "format" ).toElement() );
2673 if ( !loadFormat( f, sp, paste ) )
2681const TQPen & RowFormat::topBorderPen( int _col, int _row ) const
2684 if ( !hasProperty( PTopBorder, false ) )
2686 const RowFormat * rl = sheet()->rowFormat( _row - 1 );
2687 if ( rl->hasProperty( PBottomBorder ) )
2688 return rl->bottomBorderPen( _col, _row - 1 );
2691 return Format::topBorderPen( _col, _row );
2694void RowFormat::setTopBorderPen( const TQPen & p )
2696 RowFormat * cl = sheet()->nonDefaultRowFormat( row() - 1, false );
2698 cl->clearProperty( PBottomBorder );
2700 Format::setTopBorderPen( p );
2703const TQPen & RowFormat::bottomBorderPen( int _col, int _row ) const
2706 if ( !hasProperty( PBottomBorder, false ) && ( _row < KS_rowMax ) )
2708 const RowFormat * rl = sheet()->rowFormat( _row + 1 );
2709 if ( rl->hasProperty( PTopBorder ) )
2710 return rl->topBorderPen( _col, _row + 1 );
2713 return Format::bottomBorderPen( _col, _row );
2716void RowFormat::setBottomBorderPen( const TQPen & p )
2718 if ( row() < KS_rowMax )
2720 RowFormat * cl = sheet()->nonDefaultRowFormat( row() + 1, false );
2722 cl->clearProperty( PTopBorder );
2725 Format::setBottomBorderPen( p );
2728void RowFormat::setHide( bool _hide, bool repaint )
2730 if ( _hide != m_bHide )
2735 m_pSheet->adjustSizeMaxY ( - dblHeight() );
2737 m_pSheet->emit_updateRow( this, m_iRow, repaint );
2743 m_pSheet->adjustSizeMaxY ( dblHeight() );
2744 m_pSheet->emit_updateRow( this, m_iRow, repaint );
2749Format* RowFormat::fallbackFormat( int col, int )
2751 return sheet()->columnFormat( col );
2754const Format* RowFormat::fallbackFormat( int col, int ) const
2756 return sheet()->columnFormat( col );
2759bool RowFormat::isDefault() const
2761 if ( m_fHeight != s_rowHeight )
2763 if ( m_bHide == true )
2765 return Format::isDefault();
2768bool RowFormat::operator==( const RowFormat& other ) const
2771 if ( m_fHeight != other.m_fHeight )
2773 if ( m_bHide != other.m_bHide )
2775 return Format::operator==( other );
2787#define UPDATE_BEGIN bool b_update_begin = m_bDisplayDirtyFlag; m_bDisplayDirtyFlag = true;
2788#define UPDATE_END if ( !b_update_begin && m_bDisplayDirtyFlag ) m_pSheet->emit_updateColumn( this, m_iColumn );
2790ColumnFormat::ColumnFormat( Sheet * _sheet, int _column )
2791 : Format( _sheet, _sheet->doc()->styleManager()->defaultStyle() )
2793 m_bDisplayDirtyFlag = false;
2794 m_fWidth = s_columnWidth;
2795 m_iColumn = _column;
2803ColumnFormat::~ColumnFormat()
2806 m_next->setPrevious( m_prev );
2808 m_prev->setNext( m_next );
2812DCOPObject * ColumnFormat::dcopObject()
2815 m_dcop = new ColumnIface( this );
2819void ColumnFormat::setMMWidth( double _w )
2821 setDblWidth( MM_TO_POINT ( _w ) );
2824void ColumnFormat::setWidth( int _w, const Canvas * _canvas )
2826 setDblWidth( ( double)_w, _canvas );
2829void ColumnFormat::setDblWidth( double _w, const Canvas * _canvas )
2831 Sheet *_sheet = _canvas ? _canvas-> activeSheet() : m_pSheet;
2834 if ( kAbs( _w - dblWidth( _canvas ) ) < DBL_EPSILON )
2840 _sheet->adjustSizeMaxX ( - dblWidth() );
2843 m_fWidth = ( _w / _canvas-> zoom() );
2848 _sheet->adjustSizeMaxX ( dblWidth() );
2849 _sheet->print()->updatePrintRepeatColumnsWidth();
2850 _sheet->print()->updateNewPageListX ( column() );
2852 _sheet->emit_updateColumn( this,m_iColumn);
2856int ColumnFormat::width( const Canvas * _canvas ) const
2858 return ( int) dblWidth( _canvas );
2861double ColumnFormat::dblWidth( const Canvas * _canvas ) const
2867 return _canvas-> zoom() * (m_iColumn == 0) ? s_columnWidth : m_fWidth;
2869 return (m_iColumn == 0) ? s_columnWidth : m_fWidth;
2872double ColumnFormat::mmWidth() const
2874 return POINT_TO_MM( dblWidth() );
2878TQDomElement ColumnFormat::save( TQDomDocument& doc, int xshift, bool copy ) const
2880 TQDomElement col( doc.createElement( "column" ) );
2881 col.setAttribute( "width", m_fWidth );
2882 col.setAttribute( "column", m_iColumn - xshift );
2885 col.setAttribute( "hide", ( int) m_bHide );
2887 TQDomElement format( saveFormat( doc, false, copy ) );
2888 col.appendChild( format );
2893bool ColumnFormat::load( const TQDomElement & col, int xshift, Paste::Mode sp, bool paste )
2896 if ( col.hasAttribute( "width" ) )
2898 if ( m_pSheet->doc()->syntaxVersion() < 1 )
2899 m_fWidth = tqRound( MM_TO_POINT ( col.attribute( "width" ).toDouble( &ok ) ) );
2901 m_fWidth = col.attribute( "width" ).toDouble( &ok );
2907 m_iColumn = col.attribute( "column" ).toInt( &ok ) + xshift;
2915 kdDebug(36001) << "Value width=" << m_fWidth << " out of range" << endl;
2918 if ( m_iColumn < 1 || m_iColumn > KS_colMax )
2920 kdDebug(36001) << "Value col=" << m_iColumn << " out of range" << endl;
2923 if ( col.hasAttribute( "hide" ) )
2925 setHide( ( int) col.attribute( "hide" ).toInt( &ok ) );
2930 TQDomElement f( col.namedItem( "format" ).toElement() );
2934 if ( !loadFormat( f, sp, paste ) )
2942const TQPen & ColumnFormat::leftBorderPen( int _col, int _row ) const
2945 if ( !hasProperty( PLeftBorder, false ) )
2947 const ColumnFormat * cl = sheet()->columnFormat( _col - 1 );
2948 if ( cl->hasProperty( PRightBorder ) )
2949 return cl->rightBorderPen( _col - 1, _row );
2952 return Format::leftBorderPen( _col, _row );
2955void ColumnFormat::setLeftBorderPen( const TQPen & p )
2957 ColumnFormat * cl = sheet()->nonDefaultColumnFormat( column() - 1, false );
2959 cl->clearProperty( PRightBorder );
2961 Format::setLeftBorderPen( p );
2964const TQPen & ColumnFormat::rightBorderPen( int _col, int _row ) const
2967 if ( !hasProperty( PRightBorder, false ) && ( _col < KS_colMax ) )
2969 const ColumnFormat * cl = sheet()->columnFormat( _col + 1 );
2970 if ( cl->hasProperty( PLeftBorder ) )
2971 return cl->leftBorderPen( _col + 1, _row );
2974 return Format::rightBorderPen( _col, _row );
2977void ColumnFormat::setRightBorderPen( const TQPen & p )
2979 if ( column() < KS_colMax )
2981 ColumnFormat * cl = sheet()->nonDefaultColumnFormat( column() + 1, false );
2983 cl->clearProperty( PLeftBorder );
2986 Format::setRightBorderPen( p );
2989Format * ColumnFormat::fallbackFormat( int, int )
2991 return sheet()->defaultFormat();
2994void ColumnFormat::setHide( bool _hide )
2996 if ( _hide != m_bHide )
3001 m_pSheet->adjustSizeMaxX ( - dblWidth() );
3009 m_pSheet->adjustSizeMaxX ( dblWidth() );
3015const Format * ColumnFormat::fallbackFormat( int, int ) const
3017 return sheet()->defaultFormat();
3020bool ColumnFormat::isDefault() const
3022 if ( m_fWidth != s_columnWidth )
3024 if ( m_bHide == true )
3026 return Format::isDefault();
3029bool ColumnFormat::operator==( const ColumnFormat& other ) const
3032 if ( m_fWidth != other.m_fWidth )
3034 if ( m_bHide != other.m_bHide )
3036 return Format::operator==( other );
3041namespace Currency_LNS
3046 char const * country;
3048 char const * display;
3058 static const Money lMoney[] = {
3061 { "$", "", "Dollar", "$" },
3062 { "$", I18N_NOOP( "Australia"), I18N_NOOP( "Dollar"), "$" },
3063 { "$", I18N_NOOP( "Canada"), I18N_NOOP( "Dollar"), "$" },
3064 { "$", I18N_NOOP( "Caribbea"), I18N_NOOP( "Dollar"), "$" },
3065 { "$", I18N_NOOP( "New Zealand"), I18N_NOOP( "Dollar"), "$" },
3066 { "$", I18N_NOOP( "United States"), I18N_NOOP( "Dollar"), "$" },
3069 { "€", "", "€", "€" },
3070 { "€", I18N_NOOP( "Austria"), I18N_NOOP( "Euro"), "€" },
3071 { "€", I18N_NOOP( "Belgium"), I18N_NOOP( "Euro"), "€" },
3072 { "€", I18N_NOOP( "Finland"), I18N_NOOP( "Euro"), "€" },
3073 { "€", I18N_NOOP( "France"), I18N_NOOP( "Euro"), "€" },
3074 { "€", I18N_NOOP( "Germany"), I18N_NOOP( "Euro"), "€" },
3075 { "€", I18N_NOOP( "Greece"), I18N_NOOP( "Euro"), "€" },
3076 { "€", I18N_NOOP( "Ireland"), I18N_NOOP( "Euro"), "€" },
3077 { "€", I18N_NOOP( "Italy"), I18N_NOOP( "Euro"), "€" },
3078 { "€", I18N_NOOP( "Luxembourg"), I18N_NOOP( "Euro"), "€" },
3079 { "€", I18N_NOOP( "Monaco"), I18N_NOOP( "Euro"), "€" },
3080 { "€", I18N_NOOP( "Netherlands"), I18N_NOOP( "Euro"), "€" },
3081 { "€", I18N_NOOP( "Portugal"), I18N_NOOP( "Euro"), "€" },
3082 { "€", I18N_NOOP( "Spain"), I18N_NOOP( "Euro"), "€" },
3084 { "£", I18N_NOOP( "United Kingdom"), I18N_NOOP( "Pound"), "£" },
3086 { "Â¥", I18N_NOOP( "Japan"), I18N_NOOP( "Yen"), "Â¥" },
3088 { "AFA", I18N_NOOP( "Afghanistan"), I18N_NOOP( "Afghani"), I18N_NOOP( "AFA") },
3089 { "ALL", I18N_NOOP( "Albania"), I18N_NOOP( "Lek"), I18N_NOOP( "Lek") },
3090 { "DZD", I18N_NOOP( "Algeria"), I18N_NOOP( "Algerian Dinar"), I18N_NOOP( "DZD") },
3091 { "USD", I18N_NOOP( "American Samoa"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3092 { "EUR", I18N_NOOP( "Andorra"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3093 { "ADP", I18N_NOOP( "Andorra"), I18N_NOOP( "Andorran Peseta"), I18N_NOOP( "ADP") },
3094 { "AOA", I18N_NOOP( "Angola"), I18N_NOOP( "Kwanza"), I18N_NOOP( "AOA") },
3095 { "XCD", I18N_NOOP( "Anguilla"), I18N_NOOP( "East Caribbean Dollar"), I18N_NOOP( "XCD") },
3096 { "XCD", I18N_NOOP( "Antigua And Barbuda"), I18N_NOOP( "East Carribean Dollar"), I18N_NOOP( "XCD") },
3097 { "ARS", I18N_NOOP( "Argentina"), I18N_NOOP( "Argentine Peso"), I18N_NOOP( "ARS") },
3098 { "AMD", I18N_NOOP( "Armenia"), I18N_NOOP( "Armenian Dram"), I18N_NOOP( "AMD") },
3099 { "AWG", I18N_NOOP( "Aruba"), I18N_NOOP( "Aruban Guilder"), I18N_NOOP( "AWG") },
3100 { "AUD", I18N_NOOP( "Australia"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3101 { "EUR", I18N_NOOP( "Austria"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3102 { "ATS", I18N_NOOP( "Austria"), I18N_NOOP( "Schilling"), I18N_NOOP( "S") },
3103 { "AZM", I18N_NOOP( "Azerbaijan"), I18N_NOOP( "Azerbaijanian Manat"), I18N_NOOP( "AZM") },
3104 { "BSD", I18N_NOOP( "Bahamas"), I18N_NOOP( "Bahamian Dollar"), I18N_NOOP( "BSD") },
3105 { "BHD", I18N_NOOP( "Bahrain"), I18N_NOOP( "Bahraini Dinar"), I18N_NOOP( "BHD") },
3106 { "BDT", I18N_NOOP( "Bangladesh"), I18N_NOOP( "Taka"), I18N_NOOP( "BDT") },
3107 { "BBD", I18N_NOOP( "Barbados"), I18N_NOOP( "Barbados Dollar"), I18N_NOOP( "BBD") },
3108 { "BYR", I18N_NOOP( "Belarus"), I18N_NOOP( "Belarussian Ruble"), I18N_NOOP( "p.") },
3109 { "EUR", I18N_NOOP( "Belgium"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3110 { "BEF", I18N_NOOP( "Belgium"), I18N_NOOP( "Franc"), I18N_NOOP( "BF") },
3111 { "BZD", I18N_NOOP( "Belize"), I18N_NOOP( "Belize Dollar"), I18N_NOOP( "BZ$") },
3112 { "XOF", I18N_NOOP( "Benin"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3113 { "BMD", I18N_NOOP( "Bermuda"), I18N_NOOP( "Bermudian Dollar"), I18N_NOOP( "BMD") },
3114 { "INR", I18N_NOOP( "Bhutan"), I18N_NOOP( "Indian Rupee"), I18N_NOOP( "INR") },
3115 { "BTN", I18N_NOOP( "Bhutan"), I18N_NOOP( "Ngultrum"), I18N_NOOP( "BTN") },
3116 { "BOB", I18N_NOOP( "Bolivia"), I18N_NOOP( "Boliviano"), I18N_NOOP( "Bs") },
3117 { "BOV", I18N_NOOP( "Bolivia"), I18N_NOOP( "Mvdol"), I18N_NOOP( "BOV") },
3118 { "BAM", I18N_NOOP( "Bosnia And Herzegovina"), I18N_NOOP( "Convertible Marks"), I18N_NOOP( "BAM") },
3119 { "BWP", I18N_NOOP( "Botswana"), I18N_NOOP( "Pula"), I18N_NOOP( "BWP") },
3120 { "NOK", I18N_NOOP( "Bouvet Island"), I18N_NOOP( "Norvegian Krone"), I18N_NOOP( "NOK") },
3121 { "BRL", I18N_NOOP( "Brazil"), I18N_NOOP( "Brazilian Real"), I18N_NOOP( "R$") },
3122 { "USD", I18N_NOOP( "British Indian Ocean Territory"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3123 { "BND", I18N_NOOP( "Brunei Darussalam"), I18N_NOOP( "Brunei Dollar"), I18N_NOOP( "BND") },
3124 { "BGL", I18N_NOOP( "Bulgaria"), I18N_NOOP( "Lev"), I18N_NOOP( "BGL") },
3125 { "BGN", I18N_NOOP( "Bulgaria"), I18N_NOOP( "Bulgarian Lev"), I18N_NOOP( "BGN") },
3126 { "XOF", I18N_NOOP( "Burkina Faso"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3127 { "BIF", I18N_NOOP( "Burundi"), I18N_NOOP( "Burundi Franc"), I18N_NOOP( "BIF") },
3128 { "KHR", I18N_NOOP( "Cambodia"), I18N_NOOP( "Riel"), I18N_NOOP( "KHR") },
3129 { "XAF", I18N_NOOP( "Cameroon"), I18N_NOOP( "CFA Franc BEAC"), I18N_NOOP( "XAF") },
3130 { "CAD", I18N_NOOP( "Canada"), I18N_NOOP( "Canadian Dollar"), I18N_NOOP( "CAD") },
3131 { "CVE", I18N_NOOP( "Cape Verde"), I18N_NOOP( "Cape Verde Escudo"), I18N_NOOP( "CVE") },
3132 { "KYD", I18N_NOOP( "Cayman Islands"), I18N_NOOP( "Cayman Islands Dollar"), I18N_NOOP( "KYD") },
3133 { "XAF", I18N_NOOP( "Central African Republic"), I18N_NOOP( "CFA Franc BEAC"), I18N_NOOP( "XAF") },
3134 { "XAF", I18N_NOOP( "Chad"), I18N_NOOP( "CFA Franc BEAC"), I18N_NOOP( "XAF") },
3135 { "CLP", I18N_NOOP( "Chile"), I18N_NOOP( "Chilean Peso"), I18N_NOOP( "Ch$") },
3136 { "CLF", I18N_NOOP( "Chile"), I18N_NOOP( "Unidades de fomento"), I18N_NOOP( "CLF") },
3137 { "CNY", I18N_NOOP( "China"), I18N_NOOP( "Yuan Renminbi"), I18N_NOOP( "CNY") },
3138 { "AUD", I18N_NOOP( "Christmas Island"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3139 { "AUD", I18N_NOOP( "Cocos (Keeling) Islands"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3140 { "COP", I18N_NOOP( "Colombia"), I18N_NOOP( "Colombian Peso"), I18N_NOOP( "C$") },
3141 { "KMF", I18N_NOOP( "Comoros"), I18N_NOOP( "Comoro Franc"), I18N_NOOP( "KMF") },
3142 { "XAF", I18N_NOOP( "Congo"), I18N_NOOP( "CFA Franc BEAC"), I18N_NOOP( "XAF") },
3143 { "CDF", I18N_NOOP( "Congo, The Democratic Republic Of"), I18N_NOOP( "Franc Congolais"), I18N_NOOP( "CDF") },
3144 { "NZD", I18N_NOOP( "Cook Islands"), I18N_NOOP( "New Zealand Dollar"), I18N_NOOP( "NZD") },
3145 { "CRC", I18N_NOOP( "Costa Rica"), I18N_NOOP( "Costa Rican Colon"), I18N_NOOP( "C") },
3146 { "XOF", I18N_NOOP( "Cote D'Ivoire"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3147 { "HRK", I18N_NOOP( "Croatia"), I18N_NOOP( "Croatian kuna"), I18N_NOOP( "kn") },
3148 { "CUP", I18N_NOOP( "Cuba"), I18N_NOOP( "Cuban Peso"), I18N_NOOP( "CUP") },
3149 { "CYP", I18N_NOOP( "Cyprus"), I18N_NOOP( "Cyprus Pound"), I18N_NOOP( "CYP") },
3150 { "CZK", I18N_NOOP( "Czech Republic"), I18N_NOOP( "Czech Koruna"), I18N_NOOP( "Kc") },
3151 { "DKK", I18N_NOOP( "Denmark"), I18N_NOOP( "Danish Krone"), I18N_NOOP( "kr") },
3152 { "DJF", I18N_NOOP( "Djibouti"), I18N_NOOP( "Djibouti Franc"), I18N_NOOP( "DJF") },
3153 { "XCD", I18N_NOOP( "Dominica"), I18N_NOOP( "East Caribbean Dollar"), I18N_NOOP( "RD$") },
3154 { "DOP", I18N_NOOP( "Dominican Republic"), I18N_NOOP( "Dominican Peso"), I18N_NOOP( "DOP") },
3155 { "TPE", I18N_NOOP( "East Timor"), I18N_NOOP( "Timor Escudo"), I18N_NOOP( "TPE") },
3156 { "USD", I18N_NOOP( "East Timor"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3157 { "USD", I18N_NOOP( "Ecuador"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3158 { "EGP", I18N_NOOP( "Egypt"), I18N_NOOP( "Egyptian Pound"), I18N_NOOP( "EGP") },
3159 { "SVC", I18N_NOOP( "El Salvador"), I18N_NOOP( "El Salvador Colon"), I18N_NOOP( "C") },
3160 { "USD", I18N_NOOP( "El Salvador"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3161 { "XAF", I18N_NOOP( "Equatorial Guinea"), I18N_NOOP( "CFA Franc BEAC"), I18N_NOOP( "XAF") },
3162 { "ERN", I18N_NOOP( "Eritrea"), I18N_NOOP( "Nakfa"), I18N_NOOP( "ERN") },
3163 { "EEK", I18N_NOOP( "Estonia"), I18N_NOOP( "Kroon"), I18N_NOOP( "kr") },
3164 { "ETB", I18N_NOOP( "Ethiopia"), I18N_NOOP( "Ethiopian Birr"), I18N_NOOP( "ETB") },
3165 { "FKP", I18N_NOOP( "Falkland Island (Malvinas)"), I18N_NOOP( "Falkland Islands Pound"), I18N_NOOP( "FKP") },
3166 { "DKK", I18N_NOOP( "Faeroe Islands"), I18N_NOOP( "Danish Krone"), I18N_NOOP( "kr") },
3167 { "FJD", I18N_NOOP( "Fiji"), I18N_NOOP( "Fiji Dollar"), I18N_NOOP( "FJD") },
3168 { "EUR", I18N_NOOP( "Finland"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3169 { "FIM", I18N_NOOP( "Finland"), I18N_NOOP( "Markka"), I18N_NOOP( "mk") },
3170 { "EUR", I18N_NOOP( "France"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3171 { "FRF", I18N_NOOP( "France"), I18N_NOOP( "Franc"), I18N_NOOP( "F") },
3172 { "EUR", I18N_NOOP( "French Guiana"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3173 { "XPF", I18N_NOOP( "French Polynesia"), I18N_NOOP( "CFP Franc"), I18N_NOOP( "XPF") },
3174 { "EUR", I18N_NOOP( "Franc Southern Territories"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3175 { "XAF", I18N_NOOP( "Gabon"), I18N_NOOP( "CFA Franc BEAC"), I18N_NOOP( "XAF") },
3176 { "GMD", I18N_NOOP( "Gambia"), I18N_NOOP( "Dalasi"), I18N_NOOP( "GMD") },
3177 { "GEL", I18N_NOOP( "Georgia"), I18N_NOOP( "Lari"), I18N_NOOP( "GEL") },
3178 { "EUR", I18N_NOOP( "Germany"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3179 { "DEM", I18N_NOOP( "Germany"), I18N_NOOP( "German Mark"), I18N_NOOP( "DM") },
3180 { "GHC", I18N_NOOP( "Ghana"), I18N_NOOP( "Cedi"), I18N_NOOP( "GHC") },
3181 { "GIP", I18N_NOOP( "Gibraltar"), I18N_NOOP( "Gibraltar Pound"), I18N_NOOP( "GIP") },
3182 { "EUR", I18N_NOOP( "Greece"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3183 { "GRD", I18N_NOOP( "Greece"), I18N_NOOP( "Drachma"), I18N_NOOP( "GRD") },
3184 { "DKK", I18N_NOOP( "Greenland"), I18N_NOOP( "Danish Krone"), I18N_NOOP( "DKK") },
3185 { "XCD", I18N_NOOP( "Grenada"), I18N_NOOP( "East Caribbean Dollar"), I18N_NOOP( "XCD") },
3186 { "EUR", I18N_NOOP( "Guadeloupe"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3187 { "USD", I18N_NOOP( "Guam"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3188 { "GTQ", I18N_NOOP( "Guatemala"), I18N_NOOP( "Quetzal"), I18N_NOOP( "Q") },
3189 { "GNF", I18N_NOOP( "Guinea"), I18N_NOOP( "Guinea Franc"), I18N_NOOP( "GNF") },
3190 { "GWP", I18N_NOOP( "Guinea-Bissau"), I18N_NOOP( "Guinea-Bissau Peso"), I18N_NOOP( "GWP") },
3191 { "XOF", I18N_NOOP( "Guinea-Bissau"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3192 { "GYD", I18N_NOOP( "Guyana"), I18N_NOOP( "Guyana Dollar"), I18N_NOOP( "GYD") },
3193 { "HTG", I18N_NOOP( "Haiti"), I18N_NOOP( "Gourde"), I18N_NOOP( "HTG") },
3194 { "USD", I18N_NOOP( "Haiti"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3195 { "AUD", I18N_NOOP( "Heard Island And McDonald Islands"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3196 { "EUR", I18N_NOOP( "Holy See (Vatican City State)"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3197 { "HNL", I18N_NOOP( "Honduras"), I18N_NOOP( "Lempira"), I18N_NOOP( "L") },
3198 { "HKD", I18N_NOOP( "Hong Kong"), I18N_NOOP( "Hong Kong Dollar"), I18N_NOOP( "HKD") },
3199 { "HUF", I18N_NOOP( "Hungary"), I18N_NOOP( "Forint"), I18N_NOOP( "Ft") },
3200 { "ISK", I18N_NOOP( "Iceland"), I18N_NOOP( "Iceland Krona"), I18N_NOOP( "kr.") },
3201 { "INR", I18N_NOOP( "India"), I18N_NOOP( "Indian Rupee"), I18N_NOOP( "INR") },
3202 { "IDR", I18N_NOOP( "Indonesia"), I18N_NOOP( "Rupiah"), I18N_NOOP( "Rp") },
3203 { "IRR", I18N_NOOP( "Iran, Islamic Republic Of"), I18N_NOOP( "Iranian Rial"), I18N_NOOP( "IRR") },
3204 { "IQD", I18N_NOOP( "Iraq"), I18N_NOOP( "Iraqi Dinar"), I18N_NOOP( "IQD") },
3205 { "EUR", I18N_NOOP( "Ireland"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3206 { "IEP", I18N_NOOP( "Ireland"), I18N_NOOP( "Punt"), I18N_NOOP( "IR----") },
3207 { "IEX", I18N_NOOP( "Ireland"), I18N_NOOP( "Pence"), I18N_NOOP( "IEX") },
3208 { "ILS", I18N_NOOP( "Israel"), I18N_NOOP( "New Israeli Sheqel"), I18N_NOOP( "ILS") },
3209 { "EUR", I18N_NOOP( "Italy"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3210 { "ITL", I18N_NOOP( "Italy"), I18N_NOOP( "Lira"), I18N_NOOP( "L.") },
3211 { "JMD", I18N_NOOP( "Jamaica"), I18N_NOOP( "Jamaican Dollar"), I18N_NOOP( "J$") },
3212 { "JPY", I18N_NOOP( "Japan"), I18N_NOOP( "Yen"), I18N_NOOP( "JPY") },
3213 { "JOD", I18N_NOOP( "Jordan"), I18N_NOOP( "Jordanian Dinar"), I18N_NOOP( "JOD") },
3214 { "KZT", I18N_NOOP( "Kazakhstan"), I18N_NOOP( "Tenge"), I18N_NOOP( "KZT") },
3215 { "KES", I18N_NOOP( "Kenya"), I18N_NOOP( "Kenyan Shilling"), I18N_NOOP( "KES") },
3216 { "AUD", I18N_NOOP( "Kiribati"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3217 { "KPW", I18N_NOOP( "Korea, Democratic People's Republic Of"), I18N_NOOP( "North Korean Won"), I18N_NOOP( "KPW") },
3218 { "KRW", I18N_NOOP( "Korea, Republic Of"), I18N_NOOP( "Won"), I18N_NOOP( "KRW") },
3219 { "KWD", I18N_NOOP( "Kuwait"), I18N_NOOP( "Kuwaiti Dinar"), I18N_NOOP( "KWD") },
3220 { "KGS", I18N_NOOP( "Kyrgyzstan"), I18N_NOOP( "Som"), I18N_NOOP( "KGS") },
3221 { "LAK", I18N_NOOP( "Lao People's Democratic Republic"), I18N_NOOP( "Kip"), I18N_NOOP( "LAK") },
3222 { "LVL", I18N_NOOP( "Latvia"), I18N_NOOP( "Latvian Lats"), I18N_NOOP( "Ls") },
3223 { "LBP", I18N_NOOP( "Lebanon"), I18N_NOOP( "Lebanese Pound"), I18N_NOOP( "LBP") },
3224 { "ZAR", I18N_NOOP( "Lesotho"), I18N_NOOP( "Rand"), I18N_NOOP( "ZAR") },
3225 { "LSL", I18N_NOOP( "Lesotho"), I18N_NOOP( "Loti"), I18N_NOOP( "LSL") },
3226 { "LRD", I18N_NOOP( "Liberia"), I18N_NOOP( "Liberian Dollar"), I18N_NOOP( "LRD") },
3227 { "LYD", I18N_NOOP( "Libyan Arab Jamahiriya"), I18N_NOOP( "Lybian Dinar"), I18N_NOOP( "LYD") },
3228 { "CHF", I18N_NOOP( "Liechtenstein"), I18N_NOOP( "Swiss Franc"), I18N_NOOP( "CHF") },
3229 { "LTL", I18N_NOOP( "Lithuania"), I18N_NOOP( "Lithuanian Litus"), I18N_NOOP( "Lt") },
3230 { "EUR", I18N_NOOP( "Luxembourg"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3231 { "LUF", I18N_NOOP( "Luxembourg"), I18N_NOOP( "Franc"), I18N_NOOP( "F") },
3232 { "MOP", I18N_NOOP( "Macao"), I18N_NOOP( "Pataca"), I18N_NOOP( "MOP") },
3233 { "MKD", I18N_NOOP( "Macedonia, The Former Yugoslav Republic Of"), I18N_NOOP( "Denar"), I18N_NOOP( "MKD") },
3234 { "MGF", I18N_NOOP( "Madagascar"), I18N_NOOP( "Malagasy Franc"), I18N_NOOP( "MGF") },
3235 { "MWK", I18N_NOOP( "Malawi"), I18N_NOOP( "Kwacha"), I18N_NOOP( "MWK") },
3236 { "MYR", I18N_NOOP( "Malaysia"), I18N_NOOP( "Malaysian Ringgit"), I18N_NOOP( "MYR") },
3237 { "MVR", I18N_NOOP( "Maldives"), I18N_NOOP( "Rufiyaa"), I18N_NOOP( "MVR") },
3238 { "XOF", I18N_NOOP( "Mali"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3239 { "MTL", I18N_NOOP( "Malta"), I18N_NOOP( "Maltese Lira"), I18N_NOOP( "MTL") },
3240 { "USD", I18N_NOOP( "Marshall Islands"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3241 { "EUR", I18N_NOOP( "Martinique"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3242 { "MRO", I18N_NOOP( "Mauritania"), I18N_NOOP( "Ouguiya"), I18N_NOOP( "MRO") },
3243 { "MUR", I18N_NOOP( "Mauritius"), I18N_NOOP( "Mauritius Rupee"), I18N_NOOP( "MUR") },
3244 { "EUR", I18N_NOOP( "Mayotte"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3245 { "MXN", I18N_NOOP( "Mexico"), I18N_NOOP( "Mexican Peso"), I18N_NOOP( "MXN") },
3246 { "MXV", I18N_NOOP( "Mexico"), I18N_NOOP( "Mexican Unidad de Inversion (UDI)"), I18N_NOOP( "MXV") },
3247 { "USD", I18N_NOOP( "Micronesia, Federated States Of"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3248 { "MDL", I18N_NOOP( "Moldova, Republic Of"), I18N_NOOP( "Moldovan Leu"), I18N_NOOP( "MDL") },
3249 { "EUR", I18N_NOOP( "Monaco"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3250 { "MNT", I18N_NOOP( "Mongolia"), I18N_NOOP( "Tugrik"), I18N_NOOP( "MNT") },
3251 { "XCD", I18N_NOOP( "Montserrat"), I18N_NOOP( "East Caribbean Dollar"), I18N_NOOP( "XCD") },
3252 { "MAD", I18N_NOOP( "Morocco"), I18N_NOOP( "Moroccan Dirham"), I18N_NOOP( "MAD") },
3253 { "MZM", I18N_NOOP( "Mozambique"), I18N_NOOP( "Metical"), I18N_NOOP( "MZM") },
3254 { "MMK", I18N_NOOP( "Myanmar"), I18N_NOOP( "Kyat"), I18N_NOOP( "MMK") },
3255 { "ZAR", I18N_NOOP( "Namibia"), I18N_NOOP( "Rand"), I18N_NOOP( "ZAR") },
3256 { "NAD", I18N_NOOP( "Namibia"), I18N_NOOP( "Namibia Dollar"), I18N_NOOP( "NAD") },
3257 { "AUD", I18N_NOOP( "Nauru"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3258 { "NPR", I18N_NOOP( "Nepal"), I18N_NOOP( "Nepalese Rupee"), I18N_NOOP( "NPR") },
3259 { "EUR", I18N_NOOP( "Netherlands"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3260 { "NLG", I18N_NOOP( "Netherlands"), I18N_NOOP( "Guilder"), I18N_NOOP( "fl") },
3261 { "ANG", I18N_NOOP( "Netherlands Antilles"), I18N_NOOP( "Netherlands Antillan Guilder"), I18N_NOOP( "ANG") },
3262 { "XPF", I18N_NOOP( "New Caledonia"), I18N_NOOP( "CFP Franc"), I18N_NOOP( "XPF") },
3263 { "NZD", I18N_NOOP( "New Zealand"), I18N_NOOP( "New Zealand Dollar"), I18N_NOOP( "NZD") },
3264 { "NIO", I18N_NOOP( "Nicaragua"), I18N_NOOP( "Cordoba Oro"), I18N_NOOP( "NIO") },
3265 { "XOF", I18N_NOOP( "Niger"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3266 { "NGN", I18N_NOOP( "Nigeria"), I18N_NOOP( "Naira"), I18N_NOOP( "NGN") },
3267 { "NZD", I18N_NOOP( "Niue"), I18N_NOOP( "New Zealand Dollar"), I18N_NOOP( "NZD") },
3268 { "AUD", I18N_NOOP( "Norfolk Islands"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3269 { "USD", I18N_NOOP( "Northern Mariana Islands"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3270 { "NOK", I18N_NOOP( "Norway"), I18N_NOOP( "Norwegian Krone"), I18N_NOOP( "kr") },
3271 { "OMR", I18N_NOOP( "Oman"), I18N_NOOP( "Rial Omani"), I18N_NOOP( "OMR") },
3272 { "PKR", I18N_NOOP( "Pakistan"), I18N_NOOP( "Pakistan Rupee"), I18N_NOOP( "PKR") },
3273 { "USD", I18N_NOOP( "Palau"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3274 { "PAB", I18N_NOOP( "Panama"), I18N_NOOP( "Balboa"), I18N_NOOP( "PAB") },
3275 { "USD", I18N_NOOP( "Panama"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3276 { "PGK", I18N_NOOP( "Papua New Guinea"), I18N_NOOP( "Kina"), I18N_NOOP( "PGK") },
3277 { "PYG", I18N_NOOP( "Paraguay"), I18N_NOOP( "Guarani"), I18N_NOOP( "G") },
3278 { "PEN", I18N_NOOP( "Peru"), I18N_NOOP( "Nuevo Sol"), I18N_NOOP( "PEN") },
3279 { "PHP", I18N_NOOP( "Philippines"), I18N_NOOP( "Philippine Peso"), I18N_NOOP( "PHP") },
3280 { "NZD", I18N_NOOP( "Pitcairn"), I18N_NOOP( "New Zealand Dollar"), I18N_NOOP( "NZD") },
3281 { "PLN", I18N_NOOP( "Poland"), I18N_NOOP( "Zloty"), I18N_NOOP( "zt") },
3282 { "EUR", I18N_NOOP( "Portugal"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3283 { "PTE", I18N_NOOP( "Portugal"), I18N_NOOP( "Escudo"), I18N_NOOP( "Esc.") },
3284 { "USD", I18N_NOOP( "Puerto Rico"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3285 { "QAR", I18N_NOOP( "Qatar"), I18N_NOOP( "Qatari Rial"), I18N_NOOP( "QAR") },
3286 { "ROL", I18N_NOOP( "Romania"), I18N_NOOP( "Leu"), I18N_NOOP( "LEI") },
3287 { "RUR", I18N_NOOP( "Russian Federation"), I18N_NOOP( "Russian Ruble"), I18N_NOOP( "RUR") },
3288 { "RUB", I18N_NOOP( "Russian Federation"), I18N_NOOP( "Russian Ruble"), I18N_NOOP( "RUB") },
3289 { "RWF", I18N_NOOP( "Rwanda"), I18N_NOOP( "Rwanda Franc"), I18N_NOOP( "RWF") },
3290 { "SHP", I18N_NOOP( "Saint Helena"), I18N_NOOP( "Saint Helena Pound"), I18N_NOOP( "SHP") },
3291 { "XCD", I18N_NOOP( "Saint Kitts And Nevis"), I18N_NOOP( "East Caribbean Dollar"), I18N_NOOP( "XCD") },
3292 { "XCD", I18N_NOOP( "Saint Lucia"), I18N_NOOP( "East Caribbean Dollar"), I18N_NOOP( "XCD") },
3293 { "EUR", I18N_NOOP( "Saint Pierre And Miquelon"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3294 { "XCD", I18N_NOOP( "Saint Vincent And The Grenadines"), I18N_NOOP( "East Caribbean Dollar"), I18N_NOOP( "XCD") },
3295 { "WST", I18N_NOOP( "Samoa"), I18N_NOOP( "Tala"), I18N_NOOP( "WST") },
3296 { "EUR", I18N_NOOP( "San Marino"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3297 { "STD", I18N_NOOP( "Sao Tome And Principe"), I18N_NOOP( "Dobra"), I18N_NOOP( "STD") },
3298 { "SAR", I18N_NOOP( "Saudi Arabia"), I18N_NOOP( "Saudi Riyal"), I18N_NOOP( "SAR") },
3299 { "XOF", I18N_NOOP( "Senegal"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3300 { "SCR", I18N_NOOP( "Seychelles"), I18N_NOOP( "Seychelles Rupee"), I18N_NOOP( "SCR") },
3301 { "SLL", I18N_NOOP( "Sierra Leone"), I18N_NOOP( "Leone"), I18N_NOOP( "SLL") },
3302 { "SGD", I18N_NOOP( "Singapore"), I18N_NOOP( "Singapore Dollar"), I18N_NOOP( "SGD") },
3303 { "SKK", I18N_NOOP( "Slovakia"), I18N_NOOP( "Slovak Koruna"), I18N_NOOP( "Sk") },
3304 { "EUR", I18N_NOOP( "Slovenia"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3305 { "SBD", I18N_NOOP( "Solomon Islands"), I18N_NOOP( "Solomon Islands Dollar"), I18N_NOOP( "SBD") },
3306 { "SOS", I18N_NOOP( "Somalia"), I18N_NOOP( "Somali Shilling"), I18N_NOOP( "SOS") },
3307 { "ZAR", I18N_NOOP( "South Africa"), I18N_NOOP( "Rand"), I18N_NOOP( "R") },
3308 { "EUR", I18N_NOOP( "Spain"), I18N_NOOP( "Euro"), I18N_NOOP( "EUR") },
3309 { "ESP", I18N_NOOP( "Spain"), I18N_NOOP( "Peseta"), I18N_NOOP( "Pts") },
3310 { "LKR", I18N_NOOP( "Sri Lanka"), I18N_NOOP( "Sri Lanka Rupee"), I18N_NOOP( "LKR") },
3311 { "SDD", I18N_NOOP( "Sudan"), I18N_NOOP( "Sudanese Dinar"), I18N_NOOP( "SDD") },
3312 { "SRG", I18N_NOOP( "Suriname"), I18N_NOOP( "Suriname Guilder"), I18N_NOOP( "SRG") },
3313 { "NOK", I18N_NOOP( "Svalbard And Jan Mayen"), I18N_NOOP( "Norwegian Krone"), I18N_NOOP( "NOK") },
3314 { "SZL", I18N_NOOP( "Swaziland"), I18N_NOOP( "Lilangeni"), I18N_NOOP( "SZL") },
3315 { "SEK", I18N_NOOP( "Sweden"), I18N_NOOP( "Swedish Krona"), I18N_NOOP( "kr") },
3316 { "CHF", I18N_NOOP( "Switzerland"), I18N_NOOP( "Swiss Franc"), I18N_NOOP( "SFr.") },
3317 { "SYP", I18N_NOOP( "Syrian Arab Republic"), I18N_NOOP( "Syrian Pound"), I18N_NOOP( "SYP") },
3318 { "TWD", I18N_NOOP( "Taiwan, Province Of China"), I18N_NOOP( "New Taiwan Dollar"), I18N_NOOP( "TWD") },
3319 { "TJS", I18N_NOOP( "Tajikistan"), I18N_NOOP( "Somoni"), I18N_NOOP( "TJS") },
3320 { "TZS", I18N_NOOP( "Tanzania, United Republic Of"), I18N_NOOP( "Tanzanian Shilling"), I18N_NOOP( "TZS") },
3321 { "THB", I18N_NOOP( "Thailand"), I18N_NOOP( "Baht"), I18N_NOOP( "THB") },
3322 { "XOF", I18N_NOOP( "Togo"), I18N_NOOP( "CFA Franc BCEAO"), I18N_NOOP( "XOF") },
3323 { "NZD", I18N_NOOP( "Tokelau"), I18N_NOOP( "New Zealand Dollar"), I18N_NOOP( "NZD") },
3324 { "TOP", I18N_NOOP( "Tonga"), I18N_NOOP( "Pa'anga"), I18N_NOOP( "TOP") },
3325 { "TTD", I18N_NOOP( "Trinidad And Tobago"), I18N_NOOP( "Trinidad and Tobago Dollar"), I18N_NOOP( "TT$") },
3326 { "TND", I18N_NOOP( "Tunisia"), I18N_NOOP( "Tunisian Dinar"), I18N_NOOP( "TND") },
3327 { "TRL", I18N_NOOP( "Turkey"), I18N_NOOP( "Turkish Lira"), I18N_NOOP( "TL") },
3328 { "TMM", I18N_NOOP( "Turkmenistan"), I18N_NOOP( "Manat"), I18N_NOOP( "TMM") },
3329 { "USD", I18N_NOOP( "Turks And Caicos Islands"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3330 { "AUD", I18N_NOOP( "Tuvalu"), I18N_NOOP( "Australian Dollar"), I18N_NOOP( "AUD") },
3331 { "UGX", I18N_NOOP( "Uganda"), I18N_NOOP( "Uganda Shilling"), I18N_NOOP( "UGX") },
3332 { "UAH", I18N_NOOP( "Ukraine"), I18N_NOOP( "Hryvnia"), I18N_NOOP( "UAH") },
3333 { "AED", I18N_NOOP( "United Arab Emirates"), I18N_NOOP( "UAE Dirham"), I18N_NOOP( "AED") },
3334 { "GBP", I18N_NOOP( "United Kingdom"), I18N_NOOP( "Pound Sterling"), I18N_NOOP( "GBP") },
3335 { "USD", I18N_NOOP( "United States"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3336 { "USN", I18N_NOOP( "United States"), I18N_NOOP( "US Dollar (Next day)"), I18N_NOOP( "USN") },
3337 { "USS", I18N_NOOP( "United States"), I18N_NOOP( "US Dollar (Same day)"), I18N_NOOP( "USS") },
3338 { "UYU", I18N_NOOP( "Uruguay"), I18N_NOOP( "Peso Uruguayo"), I18N_NOOP( "NU$") },
3339 { "UZS", I18N_NOOP( "Uzbekistan"), I18N_NOOP( "Uzbekistan Sum"), I18N_NOOP( "UZS") },
3340 { "VUV", I18N_NOOP( "Vanuatu"), I18N_NOOP( "Vatu"), I18N_NOOP( "VUV") },
3341 { "VEB", I18N_NOOP( "Venezuela"), I18N_NOOP( "Bolivar"), I18N_NOOP( "Bs") },
3342 { "VND", I18N_NOOP( "Viet Nam"), I18N_NOOP( "Dong"), I18N_NOOP( "VND") },
3343 { "USD", I18N_NOOP( "Virgin Islands"), I18N_NOOP( "US Dollar"), I18N_NOOP( "USD") },
3344 { "XPF", I18N_NOOP( "Wallis And Futuna"), I18N_NOOP( "CFP Franc"), I18N_NOOP( "XPF") },
3345 { "MAD", I18N_NOOP( "Western Sahara"), I18N_NOOP( "Moroccan Dirham"), I18N_NOOP( "MAD") },
3346 { "YER", I18N_NOOP( "Yemen"), I18N_NOOP( "Yemeni Rial"), I18N_NOOP( "YER") },
3347 { "YUM", I18N_NOOP( "Yugoslavia"), I18N_NOOP( "Yugoslavian Dinar"), I18N_NOOP( "YUM") },
3348 { "ZMK", I18N_NOOP( "Zambia"), I18N_NOOP( "Kwacha"), I18N_NOOP( "ZMK") },
3349 { "ZWD", I18N_NOOP( "Zimbabwe"), I18N_NOOP( "Zimbabwe Dollar"), I18N_NOOP( "ZWD") },
3363 TQString getCode( int t) const
3365 return TQString::fromUtf8( m_List[t].code );
3368 TQString getCountry( int t) const
3370 return TQString::fromUtf8( m_List[t].country );
3373 TQString getName( int t) const
3375 return TQString::fromUtf8( m_List[t].name );
3378 TQString getDisplayCode( int t) const
3380 return TQString::fromUtf8( m_List[t].display );
3383 int getIndex( const TQString& code) const
3386 while (m_List[index].code != 0 && m_List[index].code != code)
3388 return (m_List[index].code != 0) ? index : 1 ;
3392 const Money * m_List;
3395 const CurrencyMap gCurrencyMap;
3396 const Money * gMoneyList(lMoney);
3400using namespace Currency_LNS;
3407Currency::~Currency()
3411Currency::Currency( int index)
3413 m_code( gCurrencyMap.getCode( index ) )
3417Currency::Currency( int index, TQString const & code)
3421 if ( gCurrencyMap.getCode( index ) == code )
3425Currency::Currency(TQString const & code, currencyFormat format)
3429 if ( format == Gnumeric )
3432 if ( code.find( TQChar( 172, 32 ) ) != -1 )
3433 m_code = TQChar( 172, 32 );
3434 else if ( code.find( TQChar( 163, 0 ) ) != -1 )
3435 m_code = TQChar( 163, 0 );
3436 else if ( code.find( TQChar( 165, 0 ) ) != -1 )
3437 m_code = TQChar( 165, 0 );
3438 else if ( code[0] == '[' && code[1] == '$' )
3440 int n = code.find( ']');
3443 m_code = code.mid( 2, n - 2 );
3450 else if ( code.find( '$' ) != -1 )
3453 m_type = gCurrencyMap.getIndex( m_code );
3456Currency & Currency::operator=( int type)
3459 m_code = gCurrencyMap.getCode( m_type );
3464Currency & Currency::operator=( char const * code)
3472bool Currency::operator==(Currency const & cur) const
3474 if ( m_type == cur.m_type )
3477 if ( m_code == cur.m_code )
3483bool Currency::operator==( int type) const
3485 if ( m_type == type )
3491Currency::operator int() const
3496TQString Currency::getCode() const
3501TQString Currency::getCountry() const
3503 return gCurrencyMap.getCountry( m_type );
3506TQString Currency::getName() const
3508 return gCurrencyMap.getName( m_type );
3511TQString Currency::getDisplayCode() const
3513 return gMoneyList[m_type].display;
3516int Currency::getIndex() const
3521TQString Currency::getExportCode( currencyFormat format ) const
3523 if ( format == Gnumeric )
3525 if ( m_code.length() == 1 )
3528 TQString ret( "[$");
3538TQString Currency::getChooseString( int type, bool & ok )
3540 if ( !gMoneyList[type].country )
3547 TQString ret( i18n( gMoneyList[type].name ) );
3548 if ( gMoneyList[type].country[0] )
3551 ret += i18n( gMoneyList[type].country );
3558 TQString ret( i18n( gMoneyList[type].country ) );
3559 if ( gMoneyList[type].name[0] )
3562 ret += i18n( gMoneyList[type].name );
3569TQString Currency::getDisplaySymbol( int type )
3571 return i18n( gMoneyList[type].display );
3575TQString Currency::getCurrencyCode( int type )
3577 return TQString::fromUtf8( gMoneyList[type].code );
The canvas builds a part of the GUI of KSpread.
double zoom() const convenience function
Sheet * activeSheet() const
Built-in or custom style defined in StyleManager dialog.
The Style class represents a cell style.
void addRef() Marks this style as used.
bool release() Releases this style.
@ BUILTIN built-in style (the default style)
@ CUSTOM custom style (defined in the StyleManager dialog)
@ NoBorder not the borders
|