/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ #include"vbaborders.hxx"
// #TODO sort these indexes to match the order in which Excel iterates over the // borders, the enumeration will match the order in this list const sal_Int16 supportedIndexTable[] = { XlBordersIndex::xlEdgeLeft, XlBordersIndex::xlEdgeTop, XlBordersIndex::xlEdgeBottom, XlBordersIndex::xlEdgeRight, XlBordersIndex::xlDiagonalDown, XlBordersIndex::xlDiagonalUp, XlBordersIndex::xlInsideVertical, XlBordersIndex::xlInsideHorizontal };
case XlBordersIndex::xlEdgeBottom:
aTableBorder.IsBottomLineValid = true;
aTableBorder.BottomLine = rBorderLine; break; case XlBordersIndex::xlEdgeRight:
aTableBorder.IsRightLineValid = true;
aTableBorder.RightLine = rBorderLine; break; case XlBordersIndex::xlInsideVertical:
aTableBorder.IsVerticalLineValid = true;
aTableBorder.VerticalLine = rBorderLine; break; case XlBordersIndex::xlInsideHorizontal:
aTableBorder.IsHorizontalLineValid = true;
aTableBorder.HorizontalLine = rBorderLine; break; case XlBordersIndex::xlDiagonalDown: case XlBordersIndex::xlDiagonalUp: // #TODO have to ignore at the moment, would be // nice to investigate what we can do here break; default: return;
}
m_xProps->setPropertyValue( sTableBorder, uno::Any(aTableBorder) );
}
bool getBorderLine( table::BorderLine& rBorderLine )
{
table::TableBorder aTableBorder;
m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; switch ( m_LineType )
{ case XlBordersIndex::xlEdgeLeft: if ( aTableBorder.IsLeftLineValid )
rBorderLine = aTableBorder.LeftLine; break; case XlBordersIndex::xlEdgeTop: if ( aTableBorder.IsTopLineValid )
rBorderLine = aTableBorder.TopLine; break;
case XlBordersIndex::xlEdgeBottom: if ( aTableBorder.IsBottomLineValid )
rBorderLine = aTableBorder.BottomLine; break; case XlBordersIndex::xlEdgeRight: if ( aTableBorder.IsRightLineValid )
rBorderLine = aTableBorder.RightLine; break; case XlBordersIndex::xlInsideVertical: if ( aTableBorder.IsVerticalLineValid )
rBorderLine = aTableBorder.VerticalLine; break; case XlBordersIndex::xlInsideHorizontal: if ( aTableBorder.IsHorizontalLineValid )
rBorderLine = aTableBorder.HorizontalLine; break;
case XlBordersIndex::xlDiagonalDown: case XlBordersIndex::xlDiagonalUp: // #TODO have to ignore at the moment, would be // nice to investigate what we can do here break; default: returnfalse;
} returntrue;
}
uno::Any SAL_CALL getLineStyle() override
{ // always return xlContinuous; return uno::Any( XlLineStyle::xlContinuous );
} void SAL_CALL setLineStyle( const uno::Any& _linestyle ) override
{ // Urk no choice but to silently ignore we don't support this attribute // #TODO would be nice to support the excel line styles
sal_Int32 nLineStyle = 0;
_linestyle >>= nLineStyle;
table::BorderLine aBorderLine; if ( !getBorderLine( aBorderLine ) ) throw uno::RuntimeException(u"Method failed"_ustr );
switch ( nLineStyle )
{ case XlLineStyle::xlContinuous: case XlLineStyle::xlDash: case XlLineStyle::xlDashDot: case XlLineStyle::xlDashDotDot: case XlLineStyle::xlDot: case XlLineStyle::xlDouble: case XlLineStyle::xlLineStyleNone: case XlLineStyle::xlSlantDashDot: break; default: throw uno::RuntimeException(u"Bad param"_ustr );
}
setBorderLine( aBorderLine );
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.