[ooo-build-commit] .: oox/inc oox/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Oct 6 14:42:41 PDT 2010


 oox/inc/oox/xls/stylesbuffer.hxx |    3 +++
 oox/source/xls/stylesbuffer.cxx  |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

New commits:
commit 4fb125be47d6849c7c819e91cc46f7ee5d317829
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Oct 6 17:41:44 2010 -0400

    Ported calc-xls-import-slanted-border-oox.diff from ooo-build.
    
    Sets correct reference point when importing cell contents that are
    angled.

diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx
index e49df00..3a5efc7 100644
--- a/oox/inc/oox/xls/stylesbuffer.hxx
+++ b/oox/inc/oox/xls/stylesbuffer.hxx
@@ -575,6 +575,8 @@ public:
     /** Writes all border attributes to the passed property map. */
     void                writeToPropertyMap( PropertyMap& rPropMap ) const;
 
+    bool                hasBorder() const;
+
 private:
     /** Returns the border line struct specified by the passed XML token identifier. */
     BorderLineModel*    getBorderLine( sal_Int32 nElement );
@@ -1050,6 +1052,7 @@ public:
     /** Writes the cell formatting attributes of the specified style XF to the passed property set. */
     void                writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const;
 
+    bool                hasBorder( sal_Int32 nBorderId ) const;
 private:
     typedef RefVector< Font >                           FontVector;
     typedef RefVector< Border >                         BorderVector;
diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx
index 4b10200..f9e78c0 100644
--- a/oox/source/xls/stylesbuffer.cxx
+++ b/oox/source/xls/stylesbuffer.cxx
@@ -1787,6 +1787,34 @@ void Border::writeToPropertyMap( PropertyMap& rPropMap ) const
     }
 }
 
+namespace {
+
+bool lcl_isBorder(const ::com::sun::star::table::BorderLine& rBorder)
+{
+    return (rBorder.InnerLineWidth > 0) || (rBorder.OuterLineWidth > 0);
+}
+
+}
+
+bool Border::hasBorder() const
+{
+    const ApiBorderData::ApiTableBorder& rTabBorder = maApiData.maBorder;
+
+    if (rTabBorder.IsBottomLineValid && lcl_isBorder(rTabBorder.BottomLine))
+        return true;
+
+    if (rTabBorder.IsTopLineValid && lcl_isBorder(rTabBorder.TopLine))
+        return true;
+
+    if (rTabBorder.IsLeftLineValid && lcl_isBorder(rTabBorder.LeftLine))
+        return true;
+
+    if (rTabBorder.IsRightLineValid && lcl_isBorder(rTabBorder.RightLine))
+        return true;
+
+    return false;
+}
+
 BorderLineModel* Border::getBorderLine( sal_Int32 nElement )
 {
     switch( nElement )
@@ -2482,6 +2510,11 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const
         rStyles.writeFillToPropertyMap( rPropMap, maModel.mnFillId );
     if( maModel.mbAlignUsed || maModel.mbBorderUsed )
         rPropMap[ PROP_RotateReference ] <<= meRotationRef;
+
+    ::com::sun::star::table::CellVertJustify eRotRef = ::com::sun::star::table::CellVertJustify_STANDARD;
+    if (maModel.mbBorderUsed && rStyles.hasBorder(maModel.mnBorderId) && maAlignment.getApiData().mnRotation)
+        eRotRef = ::com::sun::star::table::CellVertJustify_BOTTOM;
+    rPropMap[ PROP_RotateReference ] <<= eRotRef;
 }
 
 void Xf::writeToPropertySet( PropertySet& rPropSet ) const
@@ -3461,6 +3494,12 @@ void StylesBuffer::writeCellXfToPropertySet( PropertySet& rPropSet, sal_Int32 nX
         pXf->writeToPropertySet( rPropSet );
 }
 
+bool StylesBuffer::hasBorder( sal_Int32 nBorderId ) const
+{
+    Border* pBorder = maBorders.get( nBorderId ).get();
+    return pBorder && pBorder->hasBorder();
+}
+
 void StylesBuffer::writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const
 {
     if( Xf* pXf = maStyleXfs.get( nXfId ).get() )


More information about the ooo-build-commit mailing list