diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-05-23 10:11:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-05-23 10:39:21 +0200 |
commit | f30399c540f01f16f097b86ff518251324d558d7 (patch) | |
tree | df07a63621fc81cb3824d3f8b6a00b50dd596387 /chart2/source/tools | |
parent | SwModelTestBase: avoid not needed SAL_PRIuUINT32 (diff) | |
download | core-f30399c540f01f16f097b86ff518251324d558d7.tar.gz core-f30399c540f01f16f097b86ff518251324d558d7.zip |
Revert "fdo#46808, Convert chart2::Title service to new style"
This reverts commit d256dbede60533369d1aac64cca34721183f6a8a:
For one, the new css.chart2.XTitle2 looked unfinished, in that it transfered the
direct properties of the old-style css.chart2.Title service into attributes, but
left out all the properties inherited by the old-style service from
css.style.ParagraphProperties, css.drawing.FillProperties,
css.drawing.LineProperties (and that missing FIXME css.layout.LayoutElement,
whatever that is supposed to be). This needs more thought, to either make
available all propertiers as attributes, or none.
For another, this broke JunitTest_chart2_unoapi (sch.ChXChartDocument,
sch.ChartTitle), for hard-to-debug reasons.
Conflicts:
chart2/source/model/main/Title.cxx
chart2/source/model/main/Title.hxx
offapi/com/sun/star/chart2/XTitle2.idl
sc/source/filter/inc/xlchart.hxx
Change-Id: I4747208a13984904d0e409ea49a73b0f667c86c7
Diffstat (limited to 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/TitleHelper.cxx | 125 |
2 files changed, 69 insertions, 58 deletions
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 135227774289..9dc31b17363a 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -344,7 +344,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject( try { //title - Reference< XTitle2 > xTitle( xObject, uno::UNO_QUERY ); + Reference< XTitle > xTitle( xObject, uno::UNO_QUERY ); if( xTitle.is() ) { TitleHelper::eTitleType aTitleType; diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index dda05135c7f2..a8a0b0074990 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -23,7 +23,6 @@ #include "AxisHelper.hxx" #include "DiagramHelper.hxx" #include <com/sun/star/chart2/FormattedString.hpp> -#include <com/sun/star/chart2/Title.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <rtl/ustrbuf.hxx> @@ -123,23 +122,23 @@ uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleInde return xResult; } -uno::Reference< XTitle2 > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex +uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex , const uno::Reference< frame::XModel >& xModel ) { uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) ); if( xTitled.is()) - xTitled->getTitleObject(); + return xTitled->getTitleObject(); return NULL; } -uno::Reference< XTitle2 > TitleHelper::createTitle( +uno::Reference< XTitle > TitleHelper::createTitle( TitleHelper::eTitleType eTitleType , const OUString& rTitleText , const uno::Reference< frame::XModel >& xModel , const uno::Reference< uno::XComponentContext > & xContext , ReferenceSizeProvider * pRefSizeProvider ) { - uno::Reference< XTitle2 > xTitle; + uno::Reference< XTitle > xTitle; uno::Reference< XTitled > xTitled( lcl_getTitleParent( eTitleType, xModel ) ); if( !xTitled.is() ) @@ -169,62 +168,71 @@ uno::Reference< XTitle2 > TitleHelper::createTitle( { uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) ); - xTitle = chart2::Title::create( xContext ); + xTitle.set( xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.chart2.Title", + xContext ), uno::UNO_QUERY ); - // default char height (main: 13.0 == default) - float fDefaultCharHeightSub = 11.0; - float fDefaultCharHeightAxis = 9.0; - switch( eTitleType ) + if(xTitle.is()) { - case TitleHelper::SUB_TITLE: - TitleHelper::setCompleteString( - rTitleText, xTitle, xContext, & fDefaultCharHeightSub ); - break; - case TitleHelper::X_AXIS_TITLE: - case TitleHelper::Y_AXIS_TITLE: - case TitleHelper::Z_AXIS_TITLE: - case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION: - case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION: - case TitleHelper::SECONDARY_X_AXIS_TITLE: - case TitleHelper::SECONDARY_Y_AXIS_TITLE: - TitleHelper::setCompleteString( - rTitleText, xTitle, xContext, & fDefaultCharHeightAxis ); - break; - default: - TitleHelper::setCompleteString( rTitleText, xTitle, xContext ); - break; - } + // default char height (main: 13.0 == default) + float fDefaultCharHeightSub = 11.0; + float fDefaultCharHeightAxis = 9.0; + switch( eTitleType ) + { + case TitleHelper::SUB_TITLE: + TitleHelper::setCompleteString( + rTitleText, xTitle, xContext, & fDefaultCharHeightSub ); + break; + case TitleHelper::X_AXIS_TITLE: + case TitleHelper::Y_AXIS_TITLE: + case TitleHelper::Z_AXIS_TITLE: + case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION: + case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION: + case TitleHelper::SECONDARY_X_AXIS_TITLE: + case TitleHelper::SECONDARY_Y_AXIS_TITLE: + TitleHelper::setCompleteString( + rTitleText, xTitle, xContext, & fDefaultCharHeightAxis ); + break; + default: + TitleHelper::setCompleteString( rTitleText, xTitle, xContext ); + break; + } - // set/clear autoscale - if( pRefSizeProvider ) - pRefSizeProvider->setValuesAtTitle( xTitle ); + // set/clear autoscale + if( pRefSizeProvider ) + pRefSizeProvider->setValuesAtTitle( xTitle ); - xTitled->setTitleObject( xTitle ); + xTitled->setTitleObject( xTitle ); - //default rotation 90 degree for y axis title in normal coordinatesystems or for x axis title for swapped coordinatesystems - if( eTitleType == TitleHelper::X_AXIS_TITLE || - eTitleType == TitleHelper::Y_AXIS_TITLE || - eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE || - eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE ) + //default rotation 90 degree for y axis title in normal coordinatesystems or for x axis title for swapped coordinatesystems + if( eTitleType == TitleHelper::X_AXIS_TITLE || + eTitleType == TitleHelper::Y_AXIS_TITLE || + eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE || + eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE ) - { - try { - bool bDummy = false; - bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy ); - - if( (!bIsVertical && eTitleType == TitleHelper::Y_AXIS_TITLE) - || (bIsVertical && eTitleType == TitleHelper::X_AXIS_TITLE) - || (!bIsVertical && eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE) - || (bIsVertical && eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE) ) + try { - double fNewAngleDegree = 90.0; - xTitle->setTextRotation( fNewAngleDegree ); + bool bDummy = false; + bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy ); + + Reference< beans::XPropertySet > xTitleProps( xTitle, uno::UNO_QUERY ); + if( xTitleProps.is() ) + { + if( (!bIsVertical && eTitleType == TitleHelper::Y_AXIS_TITLE) + || (bIsVertical && eTitleType == TitleHelper::X_AXIS_TITLE) + || (!bIsVertical && eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE) + || (bIsVertical && eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE) ) + { + double fNewAngleDegree = 90.0; + xTitleProps->setPropertyValue( "TextRotation", uno::makeAny( fNewAngleDegree )); + } + } + } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); } - } - catch( const uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); } } } @@ -232,7 +240,7 @@ uno::Reference< XTitle2 > TitleHelper::createTitle( } -OUString TitleHelper::getCompleteString( const uno::Reference< XTitle2 >& xTitle ) +OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle ) { OUString aRet; if(!xTitle.is()) @@ -244,7 +252,7 @@ OUString TitleHelper::getCompleteString( const uno::Reference< XTitle2 >& xTitle } void TitleHelper::setCompleteString( const OUString& rNewText - , const uno::Reference< XTitle2 >& xTitle + , const uno::Reference< XTitle >& xTitle , const uno::Reference< uno::XComponentContext > & xContext , float * pDefaultCharHeight /* = 0 */ ) { @@ -254,7 +262,10 @@ void TitleHelper::setCompleteString( const OUString& rNewText OUString aNewText = rNewText; - bool bStacked = xTitle->getStackCharacters(); + bool bStacked = false; + uno::Reference< beans::XPropertySet > xTitleProperties( xTitle, uno::UNO_QUERY ); + if( xTitleProperties.is() ) + xTitleProperties->getPropertyValue( "StackCharacters" ) >>= bStacked; if( bStacked ) { @@ -326,14 +337,14 @@ void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex bool TitleHelper::getTitleType( eTitleType& rType , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle2 >& xTitle + ::com::sun::star::chart2::XTitle >& xTitle , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ) { if( !xTitle.is() || !xModel.is() ) return false; - Reference< chart2::XTitle2 > xCurrentTitle; + Reference< chart2::XTitle > xCurrentTitle; for( sal_Int32 nTitleType = TITLE_BEGIN; nTitleType < NORMAL_TITLE_END; nTitleType++ ) { xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), xModel ); |