Kaydet (Commit) 48f2cc5a authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Set rotation reference directly via internal API.

Note that the original code would first set the rotation reference value
stored in the Xf, then later unconditionally overwrite it according to
the border setting.  The new code only ports the second part.  Perhaps
there was a bug in the original code....

Change-Id: I15b6839e9a58e8070a43db70e1a88b42ed99f2d8
üst cfcfd1a8
...@@ -2194,7 +2194,7 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const ...@@ -2194,7 +2194,7 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const
// create and set cell style. // create and set cell style.
// TODO : We should gradually move things to writeToDoc, to set cell // TODO : We should gradually move things to writeToDoc(), to set cell
// styles to the document directly. // styles to the document directly.
if( maModel.mbFontUsed ) if( maModel.mbFontUsed )
...@@ -2209,13 +2209,6 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const ...@@ -2209,13 +2209,6 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const
rStyles.writeBorderToPropertyMap( rPropMap, maModel.mnBorderId ); rStyles.writeBorderToPropertyMap( rPropMap, maModel.mnBorderId );
if( maModel.mbAreaUsed ) if( maModel.mbAreaUsed )
rStyles.writeFillToPropertyMap( rPropMap, maModel.mnFillId ); rStyles.writeFillToPropertyMap( rPropMap, maModel.mnFillId );
if( maModel.mbAlignUsed || maModel.mbBorderUsed )
rPropMap.setProperty( PROP_RotateReference, meRotationRef);
sal_Int32 eRotRef = ::com::sun::star::table::CellVertJustify2::STANDARD;
if (maModel.mbBorderUsed && rStyles.hasBorder(maModel.mnBorderId) && maAlignment.getApiData().mnRotation)
eRotRef = ::com::sun::star::table::CellVertJustify2::BOTTOM;
rPropMap.setProperty( PROP_RotateReference, eRotRef);
} }
void Xf::writeToPropertySet( PropertySet& rPropSet ) const void Xf::writeToPropertySet( PropertySet& rPropSet ) const
...@@ -2227,9 +2220,11 @@ void Xf::writeToPropertySet( PropertySet& rPropSet ) const ...@@ -2227,9 +2220,11 @@ void Xf::writeToPropertySet( PropertySet& rPropSet ) const
void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& rRange ) const void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& rRange ) const
{ {
const StylesBuffer& rStyles = getStyles();
if (isCellXf()) if (isCellXf())
{ {
const StylesBuffer& rStyles = getStyles(); // Cell style name.
OUString aStyleName = rStyles.createCellStyle(maModel.mnStyleXfId); OUString aStyleName = rStyles.createCellStyle(maModel.mnStyleXfId);
ScStyleSheet* pStyleSheet = ScStyleSheet* pStyleSheet =
...@@ -2243,6 +2238,23 @@ void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& rRan ...@@ -2243,6 +2238,23 @@ void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& rRan
*pStyleSheet); *pStyleSheet);
} }
} }
boost::scoped_ptr<ScPatternAttr> pAttr(new ScPatternAttr(rDoc.getDoc().GetPool()));
{
SvxRotateMode eRotateMode = SVX_ROTATE_MODE_STANDARD;
if (maModel.mbBorderUsed && rStyles.hasBorder(maModel.mnBorderId) && maAlignment.getApiData().mnRotation)
eRotateMode = SVX_ROTATE_MODE_BOTTOM;
SvxRotateModeItem aItem(eRotateMode, ATTR_ROTATE_MODE);
ScfTools::PutItem(pAttr->GetItemSet(), aItem, false);
}
// TODO : Move more properties from writeToPropertyMap().
rDoc.getDoc().ApplyPatternAreaTab(
rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow, rRange.Sheet, *pAttr);
} }
const ::ScPatternAttr& const ::ScPatternAttr&
......
...@@ -834,9 +834,11 @@ void WorksheetGlobals::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLast ...@@ -834,9 +834,11 @@ void WorksheetGlobals::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLast
{ {
const StylesBuffer& rStyles = getStyles(); const StylesBuffer& rStyles = getStyles();
// Set cell styles via UNO API. We should move these to the direct API.
PropertySet aPropSet( getCellRange( aRange ) ); PropertySet aPropSet( getCellRange( aRange ) );
rStyles.writeCellXfToPropertySet(aPropSet, nXfId); rStyles.writeCellXfToPropertySet(aPropSet, nXfId);
// Set cell styles via direct API - the preferred approach.
ScDocumentImport& rDoc = getDocImport(); ScDocumentImport& rDoc = getDocImport();
rStyles.writeCellXfToDoc(rDoc, aRange, nXfId); rStyles.writeCellXfToDoc(rDoc, aRange, nXfId);
} }
......
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