summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-10-06 17:41:44 -0400
committerKohei Yoshida <kyoshida@novell.com>2010-10-06 17:42:37 -0400
commit72c9c9b3aa5cf2ffc61cf4eadbc819922723a356 (patch)
tree5aba266bad018247ccc9a1d7a532226f3b1edd9a /oox
parent3d9ebded1358395ed81db7a63629b046aec2aeac (diff)
Ported calc-xls-import-slanted-border-oox.diff from ooo-build.
Sets correct reference point when importing cell contents that are angled.
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/xls/stylesbuffer.hxx3
-rw-r--r--oox/source/xls/stylesbuffer.cxx39
2 files changed, 42 insertions, 0 deletions
diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx
index 7fff57244b02..b47d9d00efc4 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 8388507fded9..922ea548afed 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() )