diff --git a/chart2/source/model/main/Title.hxx b/chart2/source/inc/Title.hxx similarity index 98% rename from chart2/source/model/main/Title.hxx rename to chart2/source/inc/Title.hxx index 426fd5ef4219..091c558dba44 100644 --- a/chart2/source/model/main/Title.hxx +++ b/chart2/source/inc/Title.hxx @@ -18,14 +18,14 @@ */ #pragma once -#include +#include "OPropertySet.hxx" #include #include #include #include #include #include -#include +#include "ModifyListenerHelper.hxx" namespace chart { diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx index ab32d7a306e6..98004e30a2d4 100644 --- a/chart2/source/model/main/Title.cxx +++ b/chart2/source/model/main/Title.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Title.hxx" +#include #include #include #include diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index ece3ec239d1b..943adace7913 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -197,7 +198,7 @@ uno::Reference< XTitle > TitleHelper::createTitle( , const uno::Reference< uno::XComponentContext > & xContext , ReferenceSizeProvider * pRefSizeProvider ) { - uno::Reference< XTitle > xTitle; + rtl::Reference< ::chart::Title > xTitle; uno::Reference< XTitled > xTitled( lcl_getTitleParent( eTitleType, xModel ) ); if( !xTitled.is() ) @@ -226,70 +227,61 @@ uno::Reference< XTitle > TitleHelper::createTitle( { rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xModel ) ); - xTitle.set( xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.chart2.Title", - xContext ), uno::UNO_QUERY ); + xTitle = new ::chart::Title(); - if(xTitle.is()) + // default char height (main: 13.0 == default) + float fDefaultCharHeightSub = 11.0; + float fDefaultCharHeightAxis = 9.0; + switch( eTitleType ) { - // 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 ); + + 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 ) + + { + try { - 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; + 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) ) + { + xTitle->setPropertyValue( "TextRotation", uno::Any( 90.0 )); + } } - - // set/clear autoscale - if( pRefSizeProvider ) - pRefSizeProvider->setValuesAtTitle( 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 ) - + catch( const uno::Exception & ) { - try - { - 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) ) - { - xTitleProps->setPropertyValue( "TextRotation", uno::Any( 90.0 )); - } - } - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + DBG_UNHANDLED_EXCEPTION("chart2"); } } } diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 4311ce590973..9b8a5d679aac 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -1067,6 +1067,7 @@ chart2/source/inc/Scaling.hxx chart2/source/inc/SceneProperties.hxx chart2/source/inc/StatisticsHelper.hxx chart2/source/inc/ThreeDHelper.hxx +chart2/source/inc/Title.hxx chart2/source/inc/TitleHelper.hxx chart2/source/inc/UncachedDataSequence.hxx chart2/source/inc/UserDefinedProperties.hxx @@ -1107,7 +1108,6 @@ chart2/source/model/main/PageBackground.hxx chart2/source/model/main/PolarCoordinateSystem.cxx chart2/source/model/main/StockBar.cxx chart2/source/model/main/Title.cxx -chart2/source/model/main/Title.hxx chart2/source/model/main/UndoManager.cxx chart2/source/model/main/UndoManager.hxx chart2/source/model/main/Wall.cxx