Lines 124-139
void lclSaveRecord( XclExpStream& rStrm, XclExpRecordRef xRec, sal_uInt16 nRecId
Link Here
|
124 |
} |
124 |
} |
125 |
|
125 |
|
126 |
template< typename Type > |
126 |
template< typename Type > |
127 |
inline bool lclIsAutoAnyOrGetValue( Type& rValue, const Any& rAny ) |
127 |
inline bool lclIsAutoAnyOrGetValue( Type& rValue, const Any& rAny, bool bPercent ) |
128 |
{ |
128 |
{ |
129 |
return !rAny.hasValue() || !(rAny >>= rValue); |
129 |
if (!rAny.hasValue()) |
|
|
130 |
return true; |
131 |
|
132 |
if (rAny >>= rValue) |
133 |
{ |
134 |
if (bPercent) |
135 |
rValue *= 100.0; |
136 |
return false; |
137 |
} |
138 |
else |
139 |
return true; |
130 |
} |
140 |
} |
131 |
|
141 |
|
132 |
bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, Reference< XScaling > xScaling ) |
142 |
bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, Reference< XScaling > xScaling, bool bPercent ) |
133 |
{ |
143 |
{ |
134 |
bool bIsAuto = lclIsAutoAnyOrGetValue( rfValue, rAny ); |
144 |
bool bIsAuto = lclIsAutoAnyOrGetValue( rfValue, rAny, bPercent ); |
135 |
if( !bIsAuto && xScaling.is() ) |
145 |
if( !bIsAuto && xScaling.is() ) |
136 |
rfValue = xScaling->doScaling( rfValue ); |
146 |
rfValue = xScaling->doScaling( rfValue ); |
|
|
147 |
|
137 |
return bIsAuto; |
148 |
return bIsAuto; |
138 |
} |
149 |
} |
139 |
|
150 |
|
Lines 2147-2153
void XclExpChLabelRange::Convert( const ScaleData& rScaleData, bool bMirrorOrien
Link Here
|
2147 |
{ |
2158 |
{ |
2148 |
// origin |
2159 |
// origin |
2149 |
double fOrigin = 0.0; |
2160 |
double fOrigin = 0.0; |
2150 |
if( !lclIsAutoAnyOrGetValue( fOrigin, rScaleData.Origin ) ) |
2161 |
if( !lclIsAutoAnyOrGetValue( fOrigin, rScaleData.Origin, false ) ) |
2151 |
maData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 32767 ); |
2162 |
maData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 32767 ); |
2152 |
|
2163 |
|
2153 |
// reverse order |
2164 |
// reverse order |
Lines 2171-2177
XclExpChValueRange::XclExpChValueRange( const XclExpChRoot& rRoot ) :
Link Here
|
2171 |
{ |
2182 |
{ |
2172 |
} |
2183 |
} |
2173 |
|
2184 |
|
2174 |
void XclExpChValueRange::Convert( const ScaleData& rScaleData ) |
2185 |
void XclExpChValueRange::Convert( const ScaleData& rScaleData, bool bPercent ) |
2175 |
{ |
2186 |
{ |
2176 |
// scaling algorithm |
2187 |
// scaling algorithm |
2177 |
bool bLogScale = ScfApiHelper::GetServiceName( rScaleData.Scaling ) == SERVICE_CHART2_LOGSCALING; |
2188 |
bool bLogScale = ScfApiHelper::GetServiceName( rScaleData.Scaling ) == SERVICE_CHART2_LOGSCALING; |
Lines 2181-2204
void XclExpChValueRange::Convert( const ScaleData& rScaleData )
Link Here
|
2181 |
xLogScaling = rScaleData.Scaling; |
2192 |
xLogScaling = rScaleData.Scaling; |
2182 |
|
2193 |
|
2183 |
// min/max |
2194 |
// min/max |
2184 |
bool bAutoMin = lclIsAutoAnyOrGetScaledValue( maData.mfMin, rScaleData.Minimum, xLogScaling ); |
2195 |
bool bAutoMin = lclIsAutoAnyOrGetScaledValue( maData.mfMin, rScaleData.Minimum, xLogScaling, bPercent ); |
2185 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMIN, bAutoMin ); |
2196 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMIN, bAutoMin ); |
2186 |
bool bAutoMax = lclIsAutoAnyOrGetScaledValue( maData.mfMax, rScaleData.Maximum, xLogScaling ); |
2197 |
bool bAutoMax = lclIsAutoAnyOrGetScaledValue( maData.mfMax, rScaleData.Maximum, xLogScaling, bPercent ); |
2187 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAX, bAutoMax ); |
2198 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAX, bAutoMax ); |
2188 |
|
2199 |
|
2189 |
// origin |
2200 |
// origin |
2190 |
bool bAutoCross = lclIsAutoAnyOrGetScaledValue( maData.mfCross, rScaleData.Origin, xLogScaling ); |
2201 |
bool bAutoCross = lclIsAutoAnyOrGetScaledValue( maData.mfCross, rScaleData.Origin, xLogScaling, bPercent ); |
2191 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS, bAutoCross ); |
2202 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOCROSS, bAutoCross ); |
2192 |
|
2203 |
|
2193 |
// major increment |
2204 |
// major increment |
2194 |
const IncrementData& rIncrementData = rScaleData.IncrementData; |
2205 |
const IncrementData& rIncrementData = rScaleData.IncrementData; |
2195 |
bool bAutoMajor = lclIsAutoAnyOrGetValue( maData.mfMajorStep, rIncrementData.Distance ) || (maData.mfMajorStep <= 0.0); |
2206 |
bool bAutoMajor = lclIsAutoAnyOrGetValue( maData.mfMajorStep, rIncrementData.Distance, bPercent ) || (maData.mfMajorStep <= 0.0); |
2196 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAJOR, bAutoMajor ); |
2207 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMAJOR, bAutoMajor ); |
2197 |
// minor increment |
2208 |
// minor increment |
2198 |
const Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements; |
2209 |
const Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements; |
2199 |
sal_Int32 nCount = 0; |
2210 |
sal_Int32 nCount = 0; |
2200 |
bool bAutoMinor = bAutoMajor || (rSubIncrementSeq.getLength() < 1) || |
2211 |
bool bAutoMinor = bAutoMajor || (rSubIncrementSeq.getLength() < 1) || |
2201 |
lclIsAutoAnyOrGetValue( nCount, rSubIncrementSeq[ 0 ].IntervalCount ) || (nCount < 1); |
2212 |
lclIsAutoAnyOrGetValue( nCount, rSubIncrementSeq[ 0 ].IntervalCount, false ) || (nCount < 1); |
2202 |
if( !bAutoMinor ) |
2213 |
if( !bAutoMinor ) |
2203 |
maData.mfMinorStep = maData.mfMajorStep / nCount; |
2214 |
maData.mfMinorStep = maData.mfMajorStep / nCount; |
2204 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMINOR, bAutoMinor ); |
2215 |
::set_flag( maData.mnFlags, EXC_CHVALUERANGE_AUTOMINOR, bAutoMinor ); |
Lines 2320-2326
void XclExpChAxis::SetRotation( sal_uInt16 nRotation )
Link Here
|
2320 |
mxTick->SetRotation( nRotation ); |
2331 |
mxTick->SetRotation( nRotation ); |
2321 |
} |
2332 |
} |
2322 |
|
2333 |
|
2323 |
void XclExpChAxis::Convert( Reference< XAxis > xAxis, const XclChExtTypeInfo& rTypeInfo, sal_Int32 nApiAxesSetIdx ) |
2334 |
void XclExpChAxis::Convert( Reference< XAxis > xAxis, const XclChExtTypeInfo& rTypeInfo, sal_Int32 nApiAxesSetIdx, |
|
|
2335 |
bool bPercent ) |
2324 |
{ |
2336 |
{ |
2325 |
ScfPropertySet aAxisProp( xAxis ); |
2337 |
ScfPropertySet aAxisProp( xAxis ); |
2326 |
bool bCategoryAxis = ((GetAxisType() == EXC_CHAXIS_X) && rTypeInfo.mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z); |
2338 |
bool bCategoryAxis = ((GetAxisType() == EXC_CHAXIS_X) && rTypeInfo.mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z); |
Lines 2349-2355
void XclExpChAxis::Convert( Reference< XAxis > xAxis, const XclChExtTypeInfo& rT
Link Here
|
2349 |
{ |
2361 |
{ |
2350 |
mxValueRange.reset( new XclExpChValueRange( GetChRoot() ) ); |
2362 |
mxValueRange.reset( new XclExpChValueRange( GetChRoot() ) ); |
2351 |
if( xAxis.is() ) |
2363 |
if( xAxis.is() ) |
2352 |
mxValueRange->Convert( xAxis->getScaleData() ); |
2364 |
mxValueRange->Convert( xAxis->getScaleData(), bPercent ); |
2353 |
} |
2365 |
} |
2354 |
|
2366 |
|
2355 |
// axis caption text ------------------------------------------------------ |
2367 |
// axis caption text ------------------------------------------------------ |
Lines 2523-2532
sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16
Link Here
|
2523 |
// create axes according to chart type (no axes for pie and donut charts) |
2535 |
// create axes according to chart type (no axes for pie and donut charts) |
2524 |
if( rTypeInfo.meTypeCateg != EXC_CHTYPECATEG_PIE ) |
2536 |
if( rTypeInfo.meTypeCateg != EXC_CHTYPECATEG_PIE ) |
2525 |
{ |
2537 |
{ |
2526 |
ConvertAxis( mxXAxis, EXC_CHAXIS_X, mxXAxisTitle, EXC_CHOBJLINK_XAXIS, xCoordSystem, rTypeInfo ); |
2538 |
ConvertAxis( mxXAxis, EXC_CHAXIS_X, mxXAxisTitle, EXC_CHOBJLINK_XAXIS, xCoordSystem, rTypeInfo, bPercent ); |
2527 |
ConvertAxis( mxYAxis, EXC_CHAXIS_Y, mxYAxisTitle, EXC_CHOBJLINK_YAXIS, xCoordSystem, rTypeInfo ); |
2539 |
ConvertAxis( mxYAxis, EXC_CHAXIS_Y, mxYAxisTitle, EXC_CHOBJLINK_YAXIS, xCoordSystem, rTypeInfo, bPercent ); |
2528 |
if( pGroup->Is3dDeepChart() ) |
2540 |
if( pGroup->Is3dDeepChart() ) |
2529 |
ConvertAxis( mxZAxis, EXC_CHAXIS_Z, mxZAxisTitle, EXC_CHOBJLINK_ZAXIS, xCoordSystem, rTypeInfo ); |
2541 |
ConvertAxis( mxZAxis, EXC_CHAXIS_Z, mxZAxisTitle, EXC_CHOBJLINK_ZAXIS, xCoordSystem, rTypeInfo, bPercent ); |
2530 |
} |
2542 |
} |
2531 |
|
2543 |
|
2532 |
// X axis category ranges |
2544 |
// X axis category ranges |
Lines 2610-2623
XclExpChTypeGroupRef XclExpChAxesSet::GetLastTypeGroup() const
Link Here
|
2610 |
void XclExpChAxesSet::ConvertAxis( |
2622 |
void XclExpChAxesSet::ConvertAxis( |
2611 |
XclExpChAxisRef& rxChAxis, sal_uInt16 nAxisType, |
2623 |
XclExpChAxisRef& rxChAxis, sal_uInt16 nAxisType, |
2612 |
XclExpChTextRef& rxChAxisTitle, sal_uInt16 nTitleTarget, |
2624 |
XclExpChTextRef& rxChAxisTitle, sal_uInt16 nTitleTarget, |
2613 |
Reference< XCoordinateSystem > xCoordSystem, const XclChExtTypeInfo& rTypeInfo ) |
2625 |
Reference< XCoordinateSystem > xCoordSystem, const XclChExtTypeInfo& rTypeInfo, |
|
|
2626 |
bool bPercent ) |
2614 |
{ |
2627 |
{ |
2615 |
// create and convert axis object |
2628 |
// create and convert axis object |
2616 |
rxChAxis.reset( new XclExpChAxis( GetChRoot(), nAxisType ) ); |
2629 |
rxChAxis.reset( new XclExpChAxis( GetChRoot(), nAxisType ) ); |
2617 |
sal_Int32 nApiAxisDim = rxChAxis->GetApiAxisDimension(); |
2630 |
sal_Int32 nApiAxisDim = rxChAxis->GetApiAxisDimension(); |
2618 |
sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex(); |
2631 |
sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex(); |
2619 |
Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx ); |
2632 |
Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx ); |
2620 |
rxChAxis->Convert( xAxis, rTypeInfo, nApiAxesSetIdx ); |
2633 |
rxChAxis->Convert( xAxis, rTypeInfo, nApiAxesSetIdx, bPercent ); |
2621 |
|
2634 |
|
2622 |
// create and convert axis title |
2635 |
// create and convert axis title |
2623 |
Reference< XTitled > xTitled( xAxis, UNO_QUERY ); |
2636 |
Reference< XTitled > xTitled( xAxis, UNO_QUERY ); |