// Attribute
sal_Int32 SAL_CALL
ScVbaColorFormat::getRGB()
{
sal_Int32 nRGB = 0; switch( m_nColorFormatType )
{ case ColorFormatType::LINEFORMAT_FORECOLOR:
m_xPropertySet->getPropertyValue( u"LineColor"_ustr ) >>= nRGB; break; case ColorFormatType::LINEFORMAT_BACKCOLOR: //TODO BackColor not supported // m_xPropertySet->setPropertyValue("Color", uno::makeAny( nRGB ) ); break; case ColorFormatType::FILLFORMAT_FORECOLOR:
m_xPropertySet->getPropertyValue( u"FillColor"_ustr ) >>= nRGB; break; case ColorFormatType::FILLFORMAT_BACKCOLOR:
nRGB = m_nFillFormatBackColor; break; default: throw uno::RuntimeException( u"Second parameter of ColorFormat is wrong."_ustr );
}
nRGB = OORGBToXLRGB( Color(ColorTransparency, nRGB) ); return nRGB;
}
void SAL_CALL
ScVbaColorFormat::setRGB( sal_Int32 _rgb )
{
sal_Int32 nRGB = XLRGBToOORGB( _rgb ); switch( m_nColorFormatType )
{ case ColorFormatType::LINEFORMAT_FORECOLOR:
m_xPropertySet->setPropertyValue( u"LineColor"_ustr , uno::Any( nRGB ) ); break; case ColorFormatType::LINEFORMAT_BACKCOLOR: // TODO BackColor not supported break; case ColorFormatType::FILLFORMAT_FORECOLOR:
m_xPropertySet->setPropertyValue( u"FillColor"_ustr , uno::Any( nRGB ) ); if( m_pFillFormat )
{
m_pFillFormat->setForeColorAndInternalStyle(nRGB);
} break; case ColorFormatType::FILLFORMAT_BACKCOLOR:
m_nFillFormatBackColor = nRGB; if( m_pFillFormat )
{
m_pFillFormat->setForeColorAndInternalStyle(nRGB);
} break; default: throw uno::RuntimeException( u"Second parameter of ColorFormat is wrong."_ustr );
}
}
sal_Int32 SAL_CALL
ScVbaColorFormat::getSchemeColor()
{
sal_Int32 nColor = getRGB(); // #TODO I guess the number of elements is determined by the correct scheme // the implementation here seems to be a rehash of color index ( which seems to be a // different thing ) - I would guess we need to know/import etc. the correct color scheme // or at least find out a little more
sal_Int32 i = 0; for( ; i < 56; i++ )
{ if( nColor == MsoColorIndices::getColorIndex(i) ) break;
}
if( i == 56 ) // this is most likely an error condition
--i; return i; // #TODO figure out what craziness is this, // the 56 colors seems incorrect, as in default XL ( 2003 ) there are 80 colors /* if(i==56) { i=-2; }
return(i+2);
*/
}
void SAL_CALL
ScVbaColorFormat::setSchemeColor( sal_Int32 _schemecolor )
{ // the table is 0 based
sal_Int32 nColor = MsoColorIndices::getColorIndex( _schemecolor ); // nColor is already xl RGB
setRGB( nColor );
}
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.