Source Code (Use browser search to find items of interest.)

Class Index

kword'KWCustomVariable (./koffice/kword/variable.h:314)

class KWCustomVariable : public KWVariable
{
public:
    KWCustomVariable( KWordDocument *_doc, const QString &name_ );
    KWCustomVariable( KWordDocument *_doc ) : KWVariable( _doc ) {}

    virtual KWVariable *copy() {
        KWCustomVariable *var = new KWCustomVariable( doc, name );
        var->setVariableFormat( varFormat );
        var->setInfo( frameSetNum, frameNum, pageNum, parag );
        return var;
    }

    virtual VariableType getType() const
    { return VT_CUSTOM; }

    virtual void recalc();

    virtual void save( ostream &out );
    virtual void load( string name, string tag, vector<KOMLAttrib>& lst );

    virtual QString getName() const;
    virtual QString getValue() const;

    virtual void setValue( const QString &v );

protected:
    QString name;

};

/******************************************************************/
/* Class: KWSerialLetterVariable                                  */
/******************************************************************/


kword'KWCustomVariable::KWCustomVariable() (./koffice/kword/variable.cc:344)

KWCustomVariable::KWCustomVariable( KWordDocument *_doc, const QString &name_ )
    : KWVariable( _doc ), name( name_ )
{
    doc->unregisterVariable( this );
    doc->registerVariable( this );
    recalc();
}

/*================================================================*/

kword'KWCustomVariable::recalc() (./koffice/kword/variable.cc:353)

void KWCustomVariable::recalc()
{
}

/*================================================================*/

kword'KWCustomVariable::save() (./koffice/kword/variable.cc:358)

void KWCustomVariable::save( ostream &out )
{
    KWVariable::save( out );
    out << indent << "<CUSTOM name=\"" << correctQString( name ).latin1() << "\" value=\""
	<< correctQString( getValue() ).latin1() << "\"/>" << endl;
}

/*================================================================*/

kword'KWCustomVariable::load() (./koffice/kword/variable.cc:366)

void KWCustomVariable::load( string name_, string tag, vector<KOMLAttrib>& lst )
{
    doc->unregisterVariable( this );
    doc->registerVariable( this );
    recalc();
    KWVariable::load( name_, tag, lst );
    if ( name_ == "CUSTOM" ) {
	KOMLParser::parseTag( tag.c_str(), name_, lst );
	vector<KOMLAttrib>::const_iterator it = lst.begin();
	for(  ; it != lst.end(); it++ ) {
	    if ( ( *it ).m_strName == "name" )
		name = ( *it ).m_strValue.c_str();
	    else if ( (*it).m_strName == "value" )
		setValue( ( *it ).m_strValue.c_str() );
	}
    }
}

/*================================================================*/

kword'KWCustomVariable::getName() (./koffice/kword/variable.cc:385)

QString KWCustomVariable::getName() const
{
    return name;
}

/*================================================================*/

kword'KWCustomVariable::getValue() (./koffice/kword/variable.cc:391)

QString KWCustomVariable::getValue() const
{
    return doc->getVariableValue( name );
}

/*================================================================*/

kword'KWCustomVariable::setValue() (./koffice/kword/variable.cc:397)

void KWCustomVariable::setValue( const QString &v )
{
    doc->setVariableValue( name, v );
}

/******************************************************************/
/* Class: KWSerialLetterVariable                                  */
/******************************************************************/

/*================================================================*/