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 {
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
......
......@@ -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();
};
......
......@@ -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;
......
......@@ -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 )
{
......
......@@ -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 );
......
......@@ -32,8 +32,9 @@ TextModel::~TextModel()
{
}
TitleModel::TitleModel() :
mbOverlay( false )
TitleModel::TitleModel(sal_Int32 nDefaultRotation) :
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