Logo Search packages:      
Sourcecode: koffice version File versions

bool KDChartParams::calculateProperties ( int  startId,
KDChartPropertySet rSet 
) const

Retrieves the values that correspond to a property set by reading this set's properties and obtaining other property set's values if necessary (according to ID numbers that might be stored in the property set).

Use this function to retrieve the properties that are valid for a given data cell.

Don't use this function to retrieve the exact specification of a property set but use KDChartParams::properties() instead.

Returns:
TRUE if the property set was found, FALSE if it no property set was registred with this ID.
See also:
registerProperties, KDChartData::setPropertySet

Definition at line 567 of file KDChartParams.cpp.

References KDChartPropertySet::hasOwnBarColor(), KDChartPropertySet::hasOwnExtraLinesAlign(), KDChartPropertySet::hasOwnExtraLinesColor(), KDChartPropertySet::hasOwnExtraLinesInFront(), KDChartPropertySet::hasOwnExtraLinesLength(), KDChartPropertySet::hasOwnExtraLinesStyle(), KDChartPropertySet::hasOwnExtraLinesWidth(), KDChartPropertySet::hasOwnExtraMarkersAlign(), KDChartPropertySet::hasOwnExtraMarkersColor(), KDChartPropertySet::hasOwnExtraMarkersSize(), KDChartPropertySet::hasOwnExtraMarkersStyle(), KDChartPropertySet::hasOwnLineColor(), KDChartPropertySet::hasOwnLineStyle(), KDChartPropertySet::hasOwnLineWidth(), KDChartPropertySet::hasOwnShowBar(), KDChartPropertySet::hasOwnShowMarker(), lineColor(), lineStyle(), lineWidth(), properties(), KDChartPropertySet::setBarColor(), KDChartPropertySet::setExtraLinesAlign(), KDChartPropertySet::setExtraLinesColor(), KDChartPropertySet::setExtraLinesInFront(), KDChartPropertySet::setExtraLinesLength(), KDChartPropertySet::setExtraLinesStyle(), KDChartPropertySet::setExtraLinesWidth(), KDChartPropertySet::setExtraMarkersAlign(), KDChartPropertySet::setExtraMarkersColor(), KDChartPropertySet::setExtraMarkersSize(), KDChartPropertySet::setExtraMarkersStyle(), KDChartPropertySet::setLineColor(), KDChartPropertySet::setLineStyle(), KDChartPropertySet::setLineWidth(), KDChartPropertySet::setShowBar(), and KDChartPropertySet::setShowMarker().

Referenced by KDChartLinesPainter::specificPaintData().

{
    KDChartPropertySet startSet;

    rSet = startSet; // reset all properties of rSet to the default !!

    bool bOk = properties(startId, startSet);
    if( bOk ){
        int          lineWidth;
        QColor       lineColor;
        Qt::PenStyle lineStyle;
        bool         showMarker;
        uint         extraLinesAlign;
        bool         extraLinesInFront;
        int          extraLinesLength;
        int          extraLinesWidth;
        QColor       extraLinesColor;
        Qt::PenStyle extraLinesStyle;
        uint         extraMarkersAlign;
        QSize        extraMarkersSize;
        QColor       extraMarkersColor;
        int          extraMarkersStyle;
        bool         showBar;
        QColor       barColor;
        // c'tor sets all IDs to unknown by default
        KDChartPropertySet propSet;
        // PENDING(khz) replace the rustic depth counter i by a smart way
        // to quickly and safely recognize forbidden circular ID dependencies
        // *without* using this artificial maximal tree depth limitation.
        const int maxDepth = 1000;
        int i;
        int id;
        // retrieve lineWidth
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnLineWidth( id, lineWidth ) ){
                rSet.setLineWidth( KDChartPropertySet::OwnID, lineWidth );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve lineColor
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnLineColor( id, lineColor ) ){
                rSet.setLineColor( KDChartPropertySet::OwnID, lineColor );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve lineStyle
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnLineStyle( id, lineStyle ) ){
                rSet.setLineStyle( KDChartPropertySet::OwnID, lineStyle );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve showMarker
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnShowMarker( id, showMarker ) ){
                rSet.setShowMarker( KDChartPropertySet::OwnID, showMarker );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );

        // extra lines:

        // retrieve alignment of extra lines
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraLinesAlign( id, extraLinesAlign ) ){
                rSet.setExtraLinesAlign( KDChartPropertySet::OwnID, extraLinesAlign );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve whether the extra lines shall be printed in front of the normal lines
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraLinesInFront( id, extraLinesInFront ) ){
                rSet.setExtraLinesInFront( KDChartPropertySet::OwnID, extraLinesInFront );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve lineLength
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraLinesLength( id, extraLinesLength ) ){
                rSet.setExtraLinesLength( KDChartPropertySet::OwnID, extraLinesLength );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve lineWidth
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraLinesWidth( id, extraLinesWidth ) ){
                rSet.setExtraLinesWidth( KDChartPropertySet::OwnID, extraLinesWidth );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve lineColor
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraLinesColor( id, extraLinesColor ) ){
                rSet.setExtraLinesColor( KDChartPropertySet::OwnID, extraLinesColor );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve lineStyle
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraLinesStyle( id, extraLinesStyle ) ){
                rSet.setExtraLinesStyle( KDChartPropertySet::OwnID, extraLinesStyle );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );

        // markers at the ends of the extra lines:

        // retrieve marker alignment
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraMarkersAlign( id, extraMarkersAlign ) ){
                rSet.setExtraMarkersAlign( KDChartPropertySet::OwnID, extraMarkersAlign );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve marker size
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraMarkersSize( id, extraMarkersSize ) ){
                rSet.setExtraMarkersSize( KDChartPropertySet::OwnID, extraMarkersSize );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve marker color
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraMarkersColor( id, extraMarkersColor ) ){
                rSet.setExtraMarkersColor( KDChartPropertySet::OwnID, extraMarkersColor );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve marker style
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnExtraMarkersStyle( id, extraMarkersStyle ) ){
                rSet.setExtraMarkersStyle( KDChartPropertySet::OwnID, extraMarkersStyle );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );

        // retrieve showBar
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnShowBar( id, showBar ) ){
                rSet.setShowBar( KDChartPropertySet::OwnID, showBar );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );
        // retrieve barColor
        propSet = startSet; i=0;
        do{
            if( propSet.hasOwnBarColor( id, barColor ) ){
                rSet.setBarColor( KDChartPropertySet::OwnID, barColor );
                break;
            }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
                break;
            ++i;
        }while( properties(id, propSet) );

    }
    return bOk;
}


Generated by  Doxygen 1.6.0   Back to index