diff options
Diffstat (limited to 'oox/source/xls/stylesbuffer.cxx')
-rw-r--r-- | oox/source/xls/stylesbuffer.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx index 56c26d8b9f67..eddb5463be4e 100644 --- a/oox/source/xls/stylesbuffer.cxx +++ b/oox/source/xls/stylesbuffer.cxx @@ -2484,6 +2484,41 @@ void Xf::writeToPropertySet( PropertySet& rPropSet ) const rPropSet.setProperties( aPropMap ); } +/*static*/ void Xf::writeBiff2CellFormatToPropertySet( const WorkbookHelper& rHelper, + PropertySet& rPropSet, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 ) +{ + /* Create an XF object and let it do the work. We will have access to its + private members here. Also, create temporary border and fill objects, + this prevents polluting the border and fill buffers with new temporary + objects per imported cell. */ + Xf aXf( rHelper ); + Border aBorder( rHelper, false ); + Fill aFill( rHelper, false ); + + // no used flags available in BIFF2 (always true) + aXf.setAllUsedFlags( true ); + + // set the attributes + aXf.maModel.mnFontId = extractValue< sal_Int32 >( nFlags2, 6, 2 ); + aXf.maModel.mnNumFmtId = extractValue< sal_Int32 >( nFlags2, 0, 6 ); + aXf.maAlignment.setBiff2Data( nFlags3 ); + aXf.maProtection.setBiff2Data( nFlags1 ); + aBorder.setBiff2Data( nFlags3 ); + aFill.setBiff2Data( nFlags3 ); + + // finalize the objects (convert model to API attributes) + aXf.finalizeImport(); + aBorder.finalizeImport(); + aFill.finalizeImport(); + + // write the properties to the property set + PropertyMap aPropMap; + aXf.writeToPropertyMap( aPropMap ); + aBorder.writeToPropertyMap( aPropMap ); + aFill.writeToPropertyMap( aPropMap ); + rPropSet.setProperties( aPropMap ); +} + void Xf::setBiffUsedFlags( sal_uInt8 nUsedFlags ) { /* Notes about finding the used flags: |