Kaydet (Commit) 07e3155a authored tarafından Markus Mohrhard's avatar Markus Mohrhard

inherit default title rotation from parent, tdf#75316

Change-Id: I2cf609a3f2c5eb1f9d7716b3ee89d4131d942ffb
üst 8a051cb9
...@@ -34,8 +34,6 @@ namespace oox { ...@@ -34,8 +34,6 @@ namespace oox {
namespace drawingml { namespace drawingml {
namespace chart { namespace chart {
/** Enumerates different object types for specific automatic formatting behaviour. */ /** Enumerates different object types for specific automatic formatting behaviour. */
enum ObjectType enum ObjectType
{ {
...@@ -67,8 +65,6 @@ enum ObjectType ...@@ -67,8 +65,6 @@ enum ObjectType
OBJECTTYPE_DATATABLE /// Data table. OBJECTTYPE_DATATABLE /// Data table.
}; };
struct ChartSpaceModel; struct ChartSpaceModel;
struct ObjectFormatterData; struct ObjectFormatterData;
struct PictureOptionsModel; struct PictureOptionsModel;
...@@ -125,7 +121,7 @@ public: ...@@ -125,7 +121,7 @@ public:
static void convertTextRotation( static void convertTextRotation(
PropertySet& rPropSet, PropertySet& rPropSet,
const ModelRef< TextBody >& rxTextProp, const ModelRef< TextBody >& rxTextProp,
bool bSupportsStacked ); bool bSupportsStacked, sal_Int32 nDefaultRotation = 0);
/** Sets number format properties to the passed property set. */ /** Sets number format properties to the passed property set. */
void convertNumberFormat( void convertNumberFormat(
...@@ -147,8 +143,6 @@ private: ...@@ -147,8 +143,6 @@ private:
std::shared_ptr< ObjectFormatterData > mxData; std::shared_ptr< ObjectFormatterData > mxData;
}; };
} // namespace chart } // namespace chart
} // namespace drawingml } // namespace drawingml
} // namespace oox } // namespace oox
......
...@@ -51,8 +51,9 @@ struct TitleModel ...@@ -51,8 +51,9 @@ struct TitleModel
LayoutRef mxLayout; /// Layout/position of the frame. LayoutRef mxLayout; /// Layout/position of the frame.
TextRef mxText; /// Text source of the title. TextRef mxText; /// Text source of the title.
bool mbOverlay; /// True = title may overlay other objects. bool mbOverlay; /// True = title may overlay other objects.
sal_Int32 mnDefaultRotation;
explicit TitleModel(); explicit TitleModel(sal_Int32 nDefaultRotation = 0);
~TitleModel(); ~TitleModel();
}; };
......
...@@ -115,6 +115,9 @@ ContextHandlerRef AxisContextBase::onCreateContext( sal_Int32 nElement, const At ...@@ -115,6 +115,9 @@ ContextHandlerRef AxisContextBase::onCreateContext( sal_Int32 nElement, const At
case C_TOKEN( majorTickMark ): case C_TOKEN( majorTickMark ):
mrModel.mnMajorTickMark = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_out : XML_cross ); mrModel.mnMajorTickMark = rAttribs.getToken( XML_val, bMSO2007Doc ? XML_out : XML_cross );
return 0; return 0;
case C_TOKEN(axPos):
mrModel.mnAxisPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
return 0;
case C_TOKEN( minorGridlines ): case C_TOKEN( minorGridlines ):
return new ShapePrWrapperContext( *this, mrModel.mxMinorGridLines.create() ); return new ShapePrWrapperContext( *this, mrModel.mxMinorGridLines.create() );
case C_TOKEN( minorTickMark ): case C_TOKEN( minorTickMark ):
...@@ -131,7 +134,11 @@ ContextHandlerRef AxisContextBase::onCreateContext( sal_Int32 nElement, const At ...@@ -131,7 +134,11 @@ ContextHandlerRef AxisContextBase::onCreateContext( sal_Int32 nElement, const At
mrModel.mnTickLabelPos = rAttribs.getToken( XML_val, XML_nextTo ); mrModel.mnTickLabelPos = rAttribs.getToken( XML_val, XML_nextTo );
return 0; return 0;
case C_TOKEN( title ): 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 ): case C_TOKEN( txPr ):
return new TextBodyContext( *this, mrModel.mxTextProp.create() ); return new TextBodyContext( *this, mrModel.mxTextProp.create() );
} }
...@@ -175,9 +182,6 @@ ContextHandlerRef CatAxisContext::onCreateContext( sal_Int32 nElement, const Att ...@@ -175,9 +182,6 @@ ContextHandlerRef CatAxisContext::onCreateContext( sal_Int32 nElement, const Att
case C_TOKEN( auto ): case C_TOKEN( auto ):
mrModel.mbAuto = rAttribs.getBool( XML_val, !bMSO2007Doc ); mrModel.mbAuto = rAttribs.getBool( XML_val, !bMSO2007Doc );
return 0; return 0;
case C_TOKEN( axPos ):
mrModel.mnAxisPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
return 0;
case C_TOKEN( lblAlgn ): case C_TOKEN( lblAlgn ):
mrModel.mnLabelAlign = rAttribs.getToken( XML_val, XML_ctr ); mrModel.mnLabelAlign = rAttribs.getToken( XML_val, XML_ctr );
return 0; return 0;
......
...@@ -1067,7 +1067,7 @@ void ObjectFormatter::convertTextFormatting( PropertySet& rPropSet, const TextCh ...@@ -1067,7 +1067,7 @@ void ObjectFormatter::convertTextFormatting( PropertySet& rPropSet, const TextCh
pFormat->convertTextFormatting( rPropSet, rTextProps ); 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() ) if( rxTextProp.is() )
{ {
...@@ -1081,7 +1081,7 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef ...@@ -1081,7 +1081,7 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef
/* Chart2 expects rotation angle as double value in range of [0,360). /* Chart2 expects rotation angle as double value in range of [0,360).
OOXML counts clockwise, Chart2 counts counterclockwise. */ 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]. // MS Office UI allows values only in range of [-90,90].
if ( fAngle < -5400000.0 || fAngle > 5400000.0 ) if ( fAngle < -5400000.0 || fAngle > 5400000.0 )
{ {
......
...@@ -162,7 +162,7 @@ void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, con ...@@ -162,7 +162,7 @@ void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, con
// frame rotation // frame rotation
OSL_ENSURE( !mrModel.mxTextProp || !rText.mxTextBody, "TitleConverter::convertFromModel - multiple text properties" ); OSL_ENSURE( !mrModel.mxTextProp || !rText.mxTextBody, "TitleConverter::convertFromModel - multiple text properties" );
ModelRef< TextBody > xTextProp = mrModel.mxTextProp.is() ? mrModel.mxTextProp : rText.mxTextBody; 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 // register the title and layout data for conversion of position
registerTitleLayout( xTitle, mrModel.mxLayout, eObjType, nMainIdx, nSubIdx ); registerTitleLayout( xTitle, mrModel.mxLayout, eObjType, nMainIdx, nSubIdx );
......
...@@ -32,8 +32,9 @@ TextModel::~TextModel() ...@@ -32,8 +32,9 @@ TextModel::~TextModel()
{ {
} }
TitleModel::TitleModel() : TitleModel::TitleModel(sal_Int32 nDefaultRotation) :
mbOverlay( false ) mbOverlay( false ),
mnDefaultRotation(nDefaultRotation)
{ {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment