Kaydet (Commit) d5109b2f authored tarafından Krisztian Pinter's avatar Krisztian Pinter Kaydeden (comit) Tomaž Vajngerl

Make it easier to add new color attributes to GetDocColors

Change-Id: I2098892fc44c7a8bde1eb30f6db1709e58925577
üst 78afbfa1
......@@ -248,6 +248,8 @@ void ScDocument::CopyCellValuesFrom( const ScAddress& rTopPos, const sc::CellVal
std::vector<Color> ScDocument::GetDocColors()
{
// list of color attributes to collect
const std::vector<sal_uInt16> aColAttrs({ATTR_FONT_COLOR, ATTR_BACKGROUND});
std::vector<Color> docColors;
for( unsigned int nTabIx = 0; nTabIx < maTabs.size(); ++nTabIx )
......@@ -271,8 +273,7 @@ std::vector<Color> ScDocument::GetDocColors()
if( SFX_ITEM_SET == rItemSet.GetItemState( nWhich, false, &pItem ) )
{
sal_uInt16 aWhich = pItem->Which();
if( ATTR_FONT_COLOR == aWhich ||
ATTR_BACKGROUND == aWhich )
if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() )
{
Color aColor( ((SvxColorItem*)pItem)->GetValue() );
if( COL_AUTO != aColor.GetColor() &&
......
......@@ -1915,6 +1915,8 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const OUString & sNewName,
std::vector<Color> SwDoc::GetDocColors()
{
// list of color attributes to collect
const std::vector<sal_uInt16> aColAttrs({RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, RES_BACKGROUND});
std::vector<Color> docColors;
for(unsigned int i = 0; i < m_pNodes->Count(); ++i)
......@@ -1935,9 +1937,7 @@ std::vector<Color> SwDoc::GetDocColors()
if( SFX_ITEM_SET == pItemSet->GetItemState( nWhich, false, &pItem ) )
{
sal_uInt16 aWhich = pItem->Which();
if( RES_CHRATR_COLOR == aWhich ||
RES_CHRATR_HIGHLIGHT == aWhich ||
RES_BACKGROUND == aWhich )
if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() )
{
Color aColor( ((SvxColorItem*)pItem)->GetValue() );
if( COL_AUTO != aColor.GetColor() &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment