[Libreoffice-commits] core.git: 2 commits - sc/source sw/source

Jan Holesovsky kendy at collabora.com
Wed Sep 17 03:49:00 PDT 2014


 sc/source/core/data/document10.cxx |   24 +++++++++++++++---------
 sw/source/core/doc/docfmt.cxx      |   25 ++++++++++++++++---------
 2 files changed, 31 insertions(+), 18 deletions(-)

New commits:
commit cc6c01632dda28db0da8d007f2fcac63f1c85e38
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Sep 17 12:46:01 2014 +0200

    Fix Windows build - the same thing in Writer.
    
    Change-Id: Iba40d99dd6c162f20ca35e5a937b7c5ee3d2e126

diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 4cd06b2..1283e4a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1915,8 +1915,6 @@ 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)
@@ -1937,14 +1935,23 @@ std::vector<Color> SwDoc::GetDocColors()
             if( SfxItemState::SET == pItemSet->GetItemState( nWhich, false, &pItem ) )
             {
                 sal_uInt16 aWhich = pItem->Which();
-                if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() )
+                switch (aWhich)
                 {
-                    Color aColor( ((SvxColorItem*)pItem)->GetValue() );
-                    if( COL_AUTO != aColor.GetColor() &&
-                        std::find(docColors.begin(), docColors.end(), aColor) == docColors.end() )
-                    {
-                        docColors.push_back( aColor );
-                    }
+                    // list of color attributes to collect
+                    case RES_CHRATR_COLOR:
+                    case RES_CHRATR_HIGHLIGHT:
+                    case RES_BACKGROUND:
+                        {
+                            Color aColor( ((SvxColorItem*)pItem)->GetValue() );
+                            if( COL_AUTO != aColor.GetColor() &&
+                                    std::find(docColors.begin(), docColors.end(), aColor) == docColors.end() )
+                            {
+                                docColors.push_back( aColor );
+                            }
+                        }
+                        break;
+                    default:
+                        break;
                 }
             }
 
commit 2d9cdbd9d9a43e41a7242f9c5bc843fde9362920
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Sep 17 12:37:23 2014 +0200

    Another Windows build fix - too much C++11 for MSVC 2012...
    
    Change-Id: I2ae08bd7b850e26bd58d8cb9fad830edb0395259

diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
index 8702e4c..51b85ec 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -248,8 +248,6 @@ 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 )
@@ -273,14 +271,22 @@ std::vector<Color> ScDocument::GetDocColors()
                 if( SfxItemState::SET == rItemSet.GetItemState( nWhich, false, &pItem ) )
                 {
                     sal_uInt16 aWhich = pItem->Which();
-                    if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() )
+                    switch (aWhich)
                     {
-                        Color aColor( ((SvxColorItem*)pItem)->GetValue() );
-                        if( COL_AUTO != aColor.GetColor() &&
-                            std::find(docColors.begin(), docColors.end(), aColor) == docColors.end() )
-                        {
-                            docColors.push_back( aColor );
-                        }
+                        // attributes we want to collect
+                        case ATTR_FONT_COLOR:
+                        case ATTR_BACKGROUND:
+                            {
+                                Color aColor( ((SvxColorItem*)pItem)->GetValue() );
+                                if( COL_AUTO != aColor.GetColor() &&
+                                        std::find(docColors.begin(), docColors.end(), aColor) == docColors.end() )
+                                {
+                                    docColors.push_back( aColor );
+                                }
+                            }
+                            break;
+                        default:
+                            break;
                     }
                 }
 


More information about the Libreoffice-commits mailing list