[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Nov 12 20:13:59 PST 2009


 patches/dev300/apply                                   |    4 
 patches/dev300/calc-xls-import-slanted-border-oox.diff |   94 +++++++++++++++++
 patches/dev300/calc-xls-import-slanted-border-sc.diff  |   76 +++++++++++++
 3 files changed, 174 insertions(+)

New commits:
commit 758f21618e2464831a4d6efdf5ff53120644ea5d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Nov 12 23:10:58 2009 -0500

    Set rotate reference to bottom in presence of rotated text and border.
    
    This fixes i#38709 and n#549728.  dr already fixed this for 3.3 in the
    upstream build.
    
    * patches/dev300/apply:
    * patches/dev300/calc-xls-import-slanted-border-oox.diff:
    * patches/dev300/calc-xls-import-slanted-border-sc.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 7be3970..c357276 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -835,6 +835,10 @@ calc-xls-export-encryption-condfmt-fix-m60.diff, n#541058, i#105933, kohei
 # Excel compatibility for handling of "string numbers".
 calc-string-number-decimal.diff, kohei
 
+# Set reference edge to bottom when importing cells with slanted text.
+calc-xls-import-slanted-border-sc.diff,  n#549728, i#38709, kohei
+calc-xls-import-slanted-border-oox.diff, n#549728, i#38709, kohei
+
 # Support PHONETIC function to display asian phonetic guide.
 # LATER: I'll take care of this later.  --kohei
 # calc-formula-asian-phonetic.diff, i#80764, i#80765, i#80766, kohei
diff --git a/patches/dev300/calc-xls-import-slanted-border-oox.diff b/patches/dev300/calc-xls-import-slanted-border-oox.diff
new file mode 100644
index 0000000..64aa417
--- /dev/null
+++ b/patches/dev300/calc-xls-import-slanted-border-oox.diff
@@ -0,0 +1,94 @@
+diff --git oox/inc/oox/xls/stylesbuffer.hxx oox/inc/oox/xls/stylesbuffer.hxx
+index e9d17db..4f288f5 100644
+--- oox/inc/oox/xls/stylesbuffer.hxx
++++ oox/inc/oox/xls/stylesbuffer.hxx
+@@ -552,6 +552,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 );
+@@ -1009,6 +1011,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 oox/source/xls/stylesbuffer.cxx oox/source/xls/stylesbuffer.cxx
+index 5627c78..00411bb 100644
+--- oox/source/xls/stylesbuffer.cxx
++++ oox/source/xls/stylesbuffer.cxx
+@@ -40,6 +40,7 @@
+ #include <com/sun/star/style/XStyle.hpp>
+ #include <com/sun/star/text/WritingMode2.hpp>
+ #include <com/sun/star/text/XText.hpp>
++#include <com/sun/star/table/CellVertJustify.hpp>
+ #include <rtl/tencinfo.h>
+ #include <rtl/ustrbuf.hxx>
+ #include "oox/helper/attributelist.hxx"
+@@ -1699,7 +1700,35 @@ void Border::writeToPropertyMap( PropertyMap& rPropMap ) const
+         rPropMap[ PROP_DiagonalBLTR ] <<= maApiData.maBLtoTR;
+     }
+ }
+ 
++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 )
+@@ -2325,6 +2354,11 @@ void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const
+         rStyles.writeBorderToPropertyMap( rPropMap, maModel.mnBorderId );
+     if( maModel.mbAreaUsed )
+         rStyles.writeFillToPropertyMap( rPropMap, maModel.mnFillId );
++
++    ::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
+@@ -3150,6 +3184,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() )
diff --git a/patches/dev300/calc-xls-import-slanted-border-sc.diff b/patches/dev300/calc-xls-import-slanted-border-sc.diff
new file mode 100644
index 0000000..326c5c3
--- /dev/null
+++ b/patches/dev300/calc-xls-import-slanted-border-sc.diff
@@ -0,0 +1,76 @@
+diff --git sc/source/filter/excel/xistyle.cxx sc/source/filter/excel/xistyle.cxx
+index 9f38dda..ac5e956 100644
+--- sc/source/filter/excel/xistyle.cxx
++++ sc/source/filter/excel/xistyle.cxx
+@@ -765,7 +765,6 @@ void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFo
+     sal_uInt8 nXclRot = (mnOrient == EXC_ORIENT_NONE) ? mnRotation : XclTools::GetXclRotFromOrient( mnOrient );
+     bool bStacked = (nXclRot == EXC_ROT_STACKED);
+     ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_STACKED, bStacked ), bSkipPoolDefs );
+-    ScfTools::PutItem( rItemSet, SvxRotateModeItem( SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE ), bSkipPoolDefs );
+     // set an angle in the range from -90 to 90 degrees
+     sal_Int32 nAngle = XclTools::GetScRotation( nXclRot, 0 );
+     ScfTools::PutItem( rItemSet, SfxInt32Item( ATTR_ROTATE_VALUE, nAngle ), bSkipPoolDefs );
+@@ -863,6 +862,15 @@ void XclImpCellBorder::FillFromCF8( sal_uInt16 nLineStyle, sal_uInt32 nLineColor
+     mbDiagUsed    = false;
+ }
+ 
++bool XclImpCellBorder::HasAnyOuterBorder() const
++{
++    return
++        (mbLeftUsed   && (mnLeftLine != EXC_LINE_NONE)) ||
++        (mbRightUsed  && (mnRightLine != EXC_LINE_NONE)) ||
++        (mbTopUsed    && (mnTopLine != EXC_LINE_NONE)) ||
++        (mbBottomUsed && (mnBottomLine != EXC_LINE_NONE));
++}
++
+ namespace {
+ 
+ /** Converts the passed line style to a SvxBorderLine, or returns false, if style is "no line". */
+@@ -1094,11 +1102,12 @@ const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs )
+     // create new pattern attribute set
+     mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) );
+     SfxItemSet& rItemSet = mpPattern->GetItemSet();
++    XclImpXF* pParentXF = IsCellXF() ? GetXFBuffer().GetXF( mnParent ) : 0;
+ 
+     // parent cell style
+     if( IsCellXF() && !mpStyleSheet )
+     {
+         mpStyleSheet = GetXFBuffer().CreateStyleSheet( mnParent );
+         if( XclImpXF* pParentXF = GetXFBuffer().GetXF( mnParent ) )
+             UpdateUsedFlags( *pParentXF );
+     }
+@@ -1292,6 +1301,20 @@ const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs )
+             maArea.mnPattern != EXC_PATT_SOLID);
+     }
+ 
++    /*  #i38709# Decide which rotation reference mode to use. If any outer
++        border line of the cell is set (either explicitly or via cell style),
++        and the cell contents are rotated, set rotation reference to bottom of
++        cell. This causes the borders to be painted rotated with the text. */
++    if( mbAlignUsed || mbBorderUsed )
++    {
++        SvxRotateMode eRotateMode = SVX_ROTATE_MODE_STANDARD;
++        const XclImpCellAlign* pAlign = mbAlignUsed ? &maAlignment : (pParentXF ? &pParentXF->maAlignment : 0);
++        const XclImpCellBorder* pBorder = mbBorderUsed ? &maBorder : (pParentXF ? &pParentXF->maBorder : 0);
++        if( pAlign && pBorder && (0 < pAlign->mnRotation) && (pAlign->mnRotation <= 180) && pBorder->HasAnyOuterBorder() )
++            eRotateMode = SVX_ROTATE_MODE_BOTTOM;
++        ScfTools::PutItem( rItemSet, SvxRotateModeItem( eRotateMode, ATTR_ROTATE_MODE ), bSkipPoolDefs );
++    }
++
+     return *mpPattern;
+ }
+ 
+diff --git sc/source/filter/inc/xistyle.hxx sc/source/filter/inc/xistyle.hxx
+index 91d9265..92ceca6 100644
+--- sc/source/filter/inc/xistyle.hxx
++++ sc/source/filter/inc/xistyle.hxx
+@@ -321,6 +321,9 @@ struct XclImpCellBorder : public XclCellBorder
+     /** Fills this struct with BIFF8 CF (conditional format) record data. */
+     void                FillFromCF8( sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags );
+ 
++    /** Returns true, if any of the outer border lines is visible. */
++    bool                HasAnyOuterBorder() const;
++
+     /** Inserts a box item representing this border style into the item set.
+         @param bSkipPoolDefs  true = Do not put items equal to pool default; false = Put all items. */
+     void                FillToItemSet(


More information about the ooo-build-commit mailing list