Пример #1
0
  /*
   * \author Anders Fernström
   * \date 2005-10-26
   *
   * \brief loop through the DOM tree and creates CellStyle after
   * specified styles.
   */
  void Stylesheet::initializeStyle()
  {
    QDomElement root = doc_->documentElement();
    QDomNode n = root.firstChild();

    // loop through the DOM tree
    while( !n.isNull() )
    {
      QDomElement e = n.toElement();
      if( !e.isNull() )
      {
        if( e.tagName() == "style" )
        {
          CellStyle style;
          style.setName( e.attribute( "name" ));

          // get visibility
          if( e.attribute( "visible", "true" ).indexOf( "false", 0, Qt::CaseInsensitive ) < 0 )
                        style.setVisible( true );
          else
            style.setVisible( false );

          QDomNode node = e.firstChild();
          traverseStyleSettings(node, &style);

          styles_.insert( style.name(), style );

          // 2006-03-02 AF, only add styles that are visible
          if( style.visible() )
            styleNames_.push_back( style.name() );
        }
      }
      n = n.nextSibling();
    }
  }
Пример #2
0
 /*
  * \author Anders Fernström
  * \date 2005-10-26
  *
  * \brief Returns the CellStyle that correspondence with the
  * style name. The function retuns a CellStyle with the name
  * null if no CellStyle is found with the style name.
  *
  * \param style The name of the style you looking for
  * \return A CellStyle
  */
 CellStyle Stylesheet::getStyle( const QString &style )
 {
   if( styles_.contains( style ))
     return styles_.value( style );
   else
   {
     CellStyle tmp;
     tmp.setName( "null" );
     return tmp;
   }
 }