instantiate Title directly in chart
which simplifies some code Change-Id: I0c9aa212334a3dedd8a54f8deda6100d93b0be70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134743 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
0c17712465
commit
8d00d5f364
4 changed files with 56 additions and 64 deletions
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include <OPropertySet.hxx>
|
||||
#include "OPropertySet.hxx"
|
||||
#include <cppuhelper/basemutex.hxx>
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
#include <comphelper/uno3.hxx>
|
||||
#include <com/sun/star/chart2/XTitle.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/util/XCloneable.hpp>
|
||||
#include <ModifyListenerHelper.hxx>
|
||||
#include "ModifyListenerHelper.hxx"
|
||||
|
||||
namespace chart
|
||||
{
|
|
@ -17,7 +17,7 @@
|
|||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include "Title.hxx"
|
||||
#include <Title.hxx>
|
||||
#include <LinePropertiesHelper.hxx>
|
||||
#include <FillProperties.hxx>
|
||||
#include <CloneHelper.hxx>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <TitleHelper.hxx>
|
||||
#include <Title.hxx>
|
||||
#include <ChartModel.hxx>
|
||||
#include <ChartModelHelper.hxx>
|
||||
#include <Axis.hxx>
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue