main/chart2/source/tools/ReferenceSizeProvider.cxx
/** Retrieves the state auto-resize from all objects that support this
    feature. If all objects return the same state, AUTO_RESIZE_YES or
    AUTO_RESIZE_NO is returned.

    If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
    returned. If there are multiple objects, some with state YES and some
    with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
*/
Retrieves the state auto-resize from all objects that support this
feature. If all objects return the same state, AUTO_RESIZE_YES or
AUTO_RESIZE_NO is returned.

If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
returned. If there are multiple objects, some with state YES and some
with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
Retrieves the state auto - resize from all objects that support this feature . If all objects return the same state AUTO_RESIZE_YES or AUTO_RESIZE_NO is returned . If no object supporting the feature is found AUTO_RESIZE_UNKNOWN is returned . If there are multiple objects some with state YES and some with state NO AUTO_RESIZE_AMBIGUOUS is returned .
ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState(
    const Reference< XChartDocument > & xChartDoc )
{
    AutoResizeState eResult = AUTO_RESIZE_UNKNOWN;
    Reference< XTitled > xDocTitled( xChartDoc, uno::UNO_QUERY );
    if( xDocTitled.is())
        impl_getAutoResizeFromTitled( xDocTitled, eResult );
    if( eResult == AUTO_RESIZE_AMBIGUOUS )
        return eResult;
    Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDoc ), uno::UNO_QUERY );
    if( ! xDiagram.is())
        return eResult;
    Reference< XTitled > xDiaTitled( xDiagram, uno::UNO_QUERY );
    if( xDiaTitled.is())
        impl_getAutoResizeFromTitled( xDiaTitled, eResult );
    if( eResult == AUTO_RESIZE_AMBIGUOUS )
        return eResult;
    Reference< beans::XPropertySet > xLegendProp( xDiagram->getLegend(), uno::UNO_QUERY );
    if( xLegendProp.is())
        getAutoResizeFromPropSet( xLegendProp, eResult );
    if( eResult == AUTO_RESIZE_AMBIGUOUS )
        return eResult;
    Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
    for( sal_Int32 i=0; i<aAxes.getLength(); ++i )
    {
        Reference< beans::XPropertySet > xProp( aAxes[i], uno::UNO_QUERY );
        if( xProp.is())
            getAutoResizeFromPropSet( xProp, eResult );
        Reference< XTitled > xTitled( aAxes[i], uno::UNO_QUERY );
        if( xTitled.is())
        {
            impl_getAutoResizeFromTitled( xTitled, eResult );
            if( eResult == AUTO_RESIZE_AMBIGUOUS )
                return eResult;
        }
    }
    ::std::vector< Reference< XDataSeries > > aSeries(
        DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
    for( ::std::vector< Reference< XDataSeries > >::const_iterator aIt( aSeries.begin());
         aIt != aSeries.end(); ++aIt )
    {
        Reference< beans::XPropertySet > xSeriesProp( *aIt, uno::UNO_QUERY );
        if( xSeriesProp.is())
        {
            getAutoResizeFromPropSet( xSeriesProp, eResult );
            if( eResult == AUTO_RESIZE_AMBIGUOUS )
                return eResult;
            Sequence< sal_Int32 > aPointIndexes;
            try
            {
                if( xSeriesProp->getPropertyValue( C2U("AttributedDataPoints")) >>= aPointIndexes )
                {
                    for( sal_Int32 i=0; i< aPointIndexes.getLength(); ++i )
                    {
                        getAutoResizeFromPropSet(
                            (*aIt)->getDataPointByIndex( aPointIndexes[i] ), eResult );
                        if( eResult == AUTO_RESIZE_AMBIGUOUS )
                            return eResult;
                    }
                }
            }
            catch( const uno::Exception & ex )
            {
                ASSERT_EXCEPTION( ex );
            }
        }
    }
    return eResult;
}
ReferenceSizeProvider :: AutoResizeState ReferenceSizeProvider :: getAutoResizeState ( const Reference < XChartDocument > & xChartDoc ) { AutoResizeState eResult = AUTO_RESIZE_UNKNOWN ; Reference < XTitled > xDocTitled ( xChartDoc , uno :: UNO_QUERY ) ; if ( xDocTitled . is ( ) ) impl_getAutoResizeFromTitled ( xDocTitled , eResult ) ; if ( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult ; Reference < XDiagram > xDiagram ( ChartModelHelper :: findDiagram ( xChartDoc ) , uno :: UNO_QUERY ) ; if ( ! xDiagram . is ( ) ) return eResult ; Reference < XTitled > xDiaTitled ( xDiagram , uno :: UNO_QUERY ) ; if ( xDiaTitled . is ( ) ) impl_getAutoResizeFromTitled ( xDiaTitled , eResult ) ; if ( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult ; Reference < beans :: XPropertySet > xLegendProp ( xDiagram -> getLegend ( ) , uno :: UNO_QUERY ) ; if ( xLegendProp . is ( ) ) getAutoResizeFromPropSet ( xLegendProp , eResult ) ; if ( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult ; Sequence < Reference < XAxis > > aAxes ( AxisHelper :: getAllAxesOfDiagram ( xDiagram ) ) ; for ( sal_Int32 i = 0 ; i < aAxes . getLength ( ) ; ++ i ) { Reference < beans :: XPropertySet > xProp ( aAxes [ i ] , uno :: UNO_QUERY ) ; if ( xProp . is ( ) ) getAutoResizeFromPropSet ( xProp , eResult ) ; Reference < XTitled > xTitled ( aAxes [ i ] , uno :: UNO_QUERY ) ; if ( xTitled . is ( ) ) { impl_getAutoResizeFromTitled ( xTitled , eResult ) ; if ( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult ; } } :: std :: vector < Reference < XDataSeries > > aSeries ( DiagramHelper :: getDataSeriesFromDiagram ( xDiagram ) ) ; for ( :: std :: vector < Reference < XDataSeries > > :: const_iterator aIt ( aSeries . begin ( ) ) ; aIt != aSeries . end ( ) ; ++ aIt ) { Reference < beans :: XPropertySet > xSeriesProp ( * aIt , uno :: UNO_QUERY ) ; if ( xSeriesProp . is ( ) ) { getAutoResizeFromPropSet ( xSeriesProp , eResult ) ; if ( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult ; Sequence < sal_Int32 > aPointIndexes ; try { if ( xSeriesProp -> getPropertyValue ( C2U ( " " ) ) >>= aPointIndexes ) { for ( sal_Int32 i = 0 ; i < aPointIndexes . getLength ( ) ; ++ i ) { getAutoResizeFromPropSet ( ( * aIt ) -> getDataPointByIndex ( aPointIndexes [ i ] ) , eResult ) ; if ( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult ; } } } catch ( const uno :: Exception & ex ) { ASSERT_EXCEPTION ( ex ) ; } } } return eResult ; }
Retrieves the state auto-resize from all objects that support this
feature.
Retrieves the state auto - resize from all objects that support this feature .
// Main Title // diagram is needed by the rest of the objects // Sub Title // Legend // Axes (incl. Axis Titles) // DataSeries/Points // data points