sc/source/filter/oox/stylesbuffer.cxx    |   30 +++++++++++++++++++++---------
 sc/source/filter/oox/worksheethelper.cxx |    2 ++
 2 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 198796205b60bc3662a7805276f4497b6fa0c8f7
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Fri Sep 26 11:13:43 2014 -0400

    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

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 2afedcc..210dec2 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2194,7 +2194,7 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const
 
     // 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.
 
     if( maModel.mbFontUsed )
@@ -2209,13 +2209,6 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) 
const
         rStyles.writeBorderToPropertyMap( rPropMap, maModel.mnBorderId );
     if( maModel.mbAreaUsed )
         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
@@ -2227,9 +2220,11 @@ void Xf::writeToPropertySet( PropertySet& rPropSet ) 
const
 
 void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& 
rRange ) const
 {
+    const StylesBuffer& rStyles = getStyles();
+
     if (isCellXf())
     {
-        const StylesBuffer& rStyles = getStyles();
+        // Cell style name.
         OUString aStyleName = rStyles.createCellStyle(maModel.mnStyleXfId);
 
         ScStyleSheet* pStyleSheet =
@@ -2243,6 +2238,23 @@ void Xf::writeToDoc( ScDocumentImport& rDoc, const 
table::CellRangeAddress& rRan
                 *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&
diff --git a/sc/source/filter/oox/worksheethelper.cxx 
b/sc/source/filter/oox/worksheethelper.cxx
index 9aa8abd..de9a644 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -836,9 +836,11 @@ void WorksheetGlobals::convertColumnFormat( sal_Int32 
nFirstCol, sal_Int32 nLast
     {
         const StylesBuffer& rStyles = getStyles();
 
+        // Set cell styles via UNO API.  We should move these to the direct 
API.
         PropertySet aPropSet( getCellRange( aRange ) );
         rStyles.writeCellXfToPropertySet(aPropSet, nXfId);
 
+        // Set cell styles via direct API - the preferred approach.
         ScDocumentImport& rDoc = getDocImport();
         rStyles.writeCellXfToDoc(rDoc, aRange, nXfId);
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to