diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-06 06:08:47 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-08 14:56:41 +0200 |
commit | 07e3155a666e85b8213608423ae84dbd2b30c3dc (patch) | |
tree | 560bf3f1389f16721f71de406827c5ff975cb32d /oox | |
parent | 8a051cb9543b49cc70f5e6728df3387b128d3daf (diff) |
inherit default title rotation from parent, tdf#75316
Change-Id: I2cf609a3f2c5eb1f9d7716b3ee89d4131d942ffb
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/chart/objectformatter.hxx | 8 | ||||
-rw-r--r-- | oox/inc/drawingml/chart/titlemodel.hxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/chart/axiscontext.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/chart/objectformatter.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/chart/titleconverter.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/chart/titlemodel.cxx | 5 |
6 files changed, 17 insertions, 17 deletions
diff --git a/oox/inc/drawingml/chart/objectformatter.hxx b/oox/inc/drawingml/chart/objectformatter.hxx index 1e8d7807095c..c84afc66b5f1 100644 --- a/oox/inc/drawingml/chart/objectformatter.hxx +++ b/oox/inc/drawingml/chart/objectformatter.hxx @@ -34,8 +34,6 @@ namespace oox { namespace drawingml { namespace chart { - - /** Enumerates different object types for specific automatic formatting behaviour. */ enum ObjectType { @@ -67,8 +65,6 @@ enum ObjectType OBJECTTYPE_DATATABLE /// Data table. }; - - struct ChartSpaceModel; struct ObjectFormatterData; struct PictureOptionsModel; @@ -125,7 +121,7 @@ public: static void convertTextRotation( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp, - bool bSupportsStacked ); + bool bSupportsStacked, sal_Int32 nDefaultRotation = 0); /** Sets number format properties to the passed property set. */ void convertNumberFormat( @@ -147,8 +143,6 @@ private: std::shared_ptr< ObjectFormatterData > mxData; }; - - } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/inc/drawingml/chart/titlemodel.hxx b/oox/inc/drawingml/chart/titlemodel.hxx index dad4914e8af7..9e09c44a9090 100644 --- a/oox/inc/drawingml/chart/titlemodel.hxx +++ b/oox/inc/drawingml/chart/titlemodel.hxx @@ -51,8 +51,9 @@ struct TitleModel LayoutRef mxLayout; /// Layout/position of the frame. TextRef mxText; /// Text source of the title. bool mbOverlay; /// True = title may overlay other objects. + sal_Int32 mnDefaultRotation; - explicit TitleModel(); + explicit TitleModel(sal_Int32 nDefaultRotation = 0); ~TitleModel(); }; diff --git a/oox/source/drawingml/chart/axiscontext.cxx b/oox/source/drawingml/chart/axiscontext.cxx index 618e3e8bce40..058f75966ce5 100644 --- a/oox/source/drawingml/chart/axiscontext.cxx +++ b/oox/source/drawingml/chart/axiscontext.cxx @@ -115,6 +115,9 @@ ContextHandlerRef AxisContextBase::onCreateContext( sal_Int32 nElement, const At case C_TOKEN( majorTickMark ): mrModel.mnMajorTickMark = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_out : XML_cross ); return 0; + case C_TOKEN(axPos): + mrModel.mnAxisPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID ); + return 0; case C_TOKEN( minorGridlines ): return new ShapePrWrapperContext( *this, mrModel.mxMinorGridLines.create() ); case C_TOKEN( minorTickMark ): @@ -131,7 +134,11 @@ ContextHandlerRef AxisContextBase::onCreateContext( sal_Int32 nElement, const At mrModel.mnTickLabelPos = rAttribs.getToken( XML_val, XML_nextTo ); return 0; case C_TOKEN( title ): - return new TitleContext( *this, mrModel.mxTitle.create() ); + { + bool bVerticalDefault = mrModel.mnAxisPos == XML_l; + sal_Int32 nDefaultRotation = bVerticalDefault ? -5400000 : 0; + return new TitleContext( *this, mrModel.mxTitle.create(nDefaultRotation) ); + } case C_TOKEN( txPr ): return new TextBodyContext( *this, mrModel.mxTextProp.create() ); } @@ -175,9 +182,6 @@ ContextHandlerRef CatAxisContext::onCreateContext( sal_Int32 nElement, const Att case C_TOKEN( auto ): mrModel.mbAuto = rAttribs.getBool( XML_val, !bMSO2007Doc ); return 0; - case C_TOKEN( axPos ): - mrModel.mnAxisPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID ); - return 0; case C_TOKEN( lblAlgn ): mrModel.mnLabelAlign = rAttribs.getToken( XML_val, XML_ctr ); return 0; diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index b61b991ea8fd..fae82492d1d5 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1067,7 +1067,7 @@ void ObjectFormatter::convertTextFormatting( PropertySet& rPropSet, const TextCh pFormat->convertTextFormatting( rPropSet, rTextProps ); } -void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp, bool bSupportsStacked ) +void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp, bool bSupportsStacked, sal_Int32 nDefaultRotation ) { if( rxTextProp.is() ) { @@ -1081,7 +1081,7 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef /* Chart2 expects rotation angle as double value in range of [0,360). OOXML counts clockwise, Chart2 counts counterclockwise. */ - double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( 0 ) ); + double fAngle = static_cast< double >( bStacked ? 0 : rxTextProp->getTextProperties().moRotation.get( nDefaultRotation ) ); // MS Office UI allows values only in range of [-90,90]. if ( fAngle < -5400000.0 || fAngle > 5400000.0 ) { diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index 34cc4d7e59f6..743fe1fe4660 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -162,7 +162,7 @@ void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, con // frame rotation OSL_ENSURE( !mrModel.mxTextProp || !rText.mxTextBody, "TitleConverter::convertFromModel - multiple text properties" ); ModelRef< TextBody > xTextProp = mrModel.mxTextProp.is() ? mrModel.mxTextProp : rText.mxTextBody; - ObjectFormatter::convertTextRotation( aPropSet, xTextProp, true ); + ObjectFormatter::convertTextRotation( aPropSet, xTextProp, true, mrModel.mnDefaultRotation ); // register the title and layout data for conversion of position registerTitleLayout( xTitle, mrModel.mxLayout, eObjType, nMainIdx, nSubIdx ); diff --git a/oox/source/drawingml/chart/titlemodel.cxx b/oox/source/drawingml/chart/titlemodel.cxx index 1f7153304db2..c9c8eec2874b 100644 --- a/oox/source/drawingml/chart/titlemodel.cxx +++ b/oox/source/drawingml/chart/titlemodel.cxx @@ -32,8 +32,9 @@ TextModel::~TextModel() { } -TitleModel::TitleModel() : - mbOverlay( false ) +TitleModel::TitleModel(sal_Int32 nDefaultRotation) : + mbOverlay( false ), + mnDefaultRotation(nDefaultRotation) { } |