cui/source/tabpages/tpcolor.cxx                            |    2 
 include/svx/PaletteManager.hxx                             |    5 -
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    8 ++
 svx/source/tbxctrls/PaletteManager.cxx                     |   42 ++++++-------
 svx/source/tbxctrls/tbcontrl.cxx                           |    2 
 sw/qa/core/data/rtf/fail/table-1.rtf                       |binary
 6 files changed, 34 insertions(+), 25 deletions(-)

New commits:
commit 6f11653287ad41df935bf25ffd6ffe8e7acb3bb1
Author: Caolán McNamara <caol...@redhat.com>
Date:   Wed Aug 31 09:25:34 2016 +0100

    Resolves: tdf#98097 no tooltip for colors in "Recent" colors area
    
    cause the tip is the color name and that's not stored, so store
    the name when we have one, generate a #rrggbb if there isn't one
    and on loading the names, "repair" the names if the names didnt't
    exist because this option didn't exist when the colors were last
    saved
    
    Change-Id: I33d373081e8a5a46ac585bc55fe449dba0519f99

diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 696379c..32c43f8 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -315,7 +315,7 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet )
     if( ( nDlgType != 0 ) ||
         ( *pPageType == PageType::Color && !*pbAreaTP ) )
     {
-        maPaletteManager.AddRecentColor( aCurrentColor );
+        maPaletteManager.AddRecentColor(aCurrentColor, OUString("#") + 
aCurrentColor.AsRGBHexString().toAsciiUpperCase());
         rSet->Put( XFillColorItem( OUString(), aCurrentColor ) );
         rSet->Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
     }
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index ceeea5d..c527b85 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -48,7 +48,8 @@ class SVX_DLLPUBLIC PaletteManager
 
     XColorListRef           pColorList;
     Color                   mLastColor;
-    std::deque<Color>       maRecentColors;
+    typedef std::pair<Color, OUString>  color_and_name;
+    std::deque<color_and_name> maRecentColors;
     std::vector<std::unique_ptr<Palette>> m_Palettes;
 
     std::function<void(const OUString&, const Color&)> maColorSelectFunction;
@@ -73,7 +74,7 @@ public:
 
     const Color& GetLastColor();
     void        SetLastColor(const Color& rLastColor);
-    void        AddRecentColor(const Color& rRecentColor);
+    void        AddRecentColor(const Color& rRecentColor, const OUString& 
rColorName);
 
     void        SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater);
     void        PopupColorPicker(const OUString& aCommand);
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 394b00d..117f803 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3416,6 +3416,12 @@
         </info>
         <value/>
       </prop>
+      <prop oor:name="RecentColorName" oor:type="oor:string-list" 
oor:nillable="false">
+        <info>
+          <desc>List of Recent color names</desc>
+        </info>
+        <value/>
+      </prop>
       <prop oor:name="PaletteName" oor:type="xs:string" oor:nillable="false">
         <info>
           <desc>Name of selected palette</desc>
@@ -3430,7 +3436,7 @@
       </prop>
       <prop oor:name="CustomColorName" oor:type="oor:string-list" 
oor:nillable="false">
         <info>
-          <desc>List of Custom colors</desc>
+          <desc>List of Custom color names</desc>
         </info>
         <value/>
       </prop>
diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index c2c9748..bf78e310 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -126,11 +126,10 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet 
&rColorSet)
         css::uno::Sequence< sal_Int32 > CustomColorList( 
officecfg::Office::Common::UserColors::CustomColor::get() );
         css::uno::Sequence< OUString > CustomColorNameList( 
officecfg::Office::Common::UserColors::CustomColorName::get() );
         int nIx = 1;
-        for( int i = 0;i < CustomColorList.getLength();i++ )
+        for (int i = 0; i < CustomColorList.getLength(); ++i)
         {
-            Color aColor( CustomColorList[i] );
-            OUString aColorName( CustomColorNameList[i] );
-            rColorSet.InsertItem( nIx, aColor, aColorName );
+            Color aColor(CustomColorList[i]);
+            rColorSet.InsertItem(nIx, aColor, CustomColorNameList[i]);
             ++nIx;
         }
     }
@@ -152,18 +151,17 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet 
&rColorSet)
 void PaletteManager::ReloadRecentColorSet(SvxColorValueSet& rColorSet)
 {
     maRecentColors.clear();
-    css::uno::Sequence< sal_Int32 > 
Colorlist(officecfg::Office::Common::UserColors::RecentColor::get());
-    for(int i = 0;i < Colorlist.getLength();i++)
-    {
-        Color aColor( Colorlist[i] );
-        maRecentColors.push_back( aColor );
-    }
     rColorSet.Clear();
+    css::uno::Sequence< sal_Int32 > 
Colorlist(officecfg::Office::Common::UserColors::RecentColor::get());
+    css::uno::Sequence< OUString > 
ColorNamelist(officecfg::Office::Common::UserColors::RecentColorName::get());
     int nIx = 1;
-    for(std::deque<Color>::const_iterator it = maRecentColors.begin();
-        it != maRecentColors.end(); ++it)
+    const bool bHasColorNames = Colorlist.getLength() == 
ColorNamelist.getLength();
+    for (int i = 0; i < Colorlist.getLength(); ++i)
     {
-        rColorSet.InsertItem(nIx, *it, "");
+        Color aColor(Colorlist[i]);
+        OUString sColorName = bHasColorNames ? ColorNamelist[i] : 
(OUString("#") + aColor.AsRGBHexString().toAsciiUpperCase());
+        maRecentColors.push_back(std::make_pair(aColor, sColorName));
+        rColorSet.InsertItem(nIx, aColor, sColorName);
         ++nIx;
     }
 }
@@ -255,24 +253,28 @@ void PaletteManager::SetLastColor(const Color& rLastColor)
     mLastColor = rLastColor;
 }
 
-void PaletteManager::AddRecentColor(const Color& rRecentColor)
+void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& 
rName)
 {
-    std::deque<Color>::iterator itColor =
-        std::find(maRecentColors.begin(), maRecentColors.end(), rRecentColor);
+    auto itColor = std::find_if(maRecentColors.begin(),
+                                maRecentColors.end(),
+                                [rRecentColor] (const auto &a) { return 
a.first == rRecentColor; });
     // if recent color to be added is already in list, remove it
     if( itColor != maRecentColors.end() )
         maRecentColors.erase( itColor );
 
-    maRecentColors.push_front( rRecentColor );
+    maRecentColors.push_front(std::make_pair(rRecentColor, rName));
     if( maRecentColors.size() > mnMaxRecentColors )
         maRecentColors.pop_back();
     css::uno::Sequence< sal_Int32 > aColorList(maRecentColors.size());
-    for(std::deque<Color>::size_type i = 0;i < maRecentColors.size();i++)
+    css::uno::Sequence< OUString > aColorNameList(maRecentColors.size());
+    for (size_t i = 0; i < maRecentColors.size(); ++i)
     {
-        aColorList[i] = static_cast<sal_Int32>(maRecentColors[i].GetColor());
+        aColorList[i] = 
static_cast<sal_Int32>(maRecentColors[i].first.GetColor());
+        aColorNameList[i] = maRecentColors[i].second;
     }
     std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create(m_context));
     officecfg::Office::Common::UserColors::RecentColor::set(aColorList, batch);
+    
officecfg::Office::Common::UserColors::RecentColorName::set(aColorNameList, 
batch);
     batch->commit();
 }
 
@@ -298,7 +300,7 @@ void PaletteManager::PopupColorPicker(const OUString& 
aCommand)
         if (mpBtnUpdater)
             mpBtnUpdater->Update( aColorDlg.GetColor() );
         mLastColor = aColorDlg.GetColor();
-        AddRecentColor( mLastColor );
+        AddRecentColor(mLastColor, (OUString("#") + 
mLastColor.AsRGBHexString().toAsciiUpperCase()));
         maColorSelectFunction(aCommandCopy, mLastColor);
     }
 }
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index b8a68b7..757a15b 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1397,7 +1397,7 @@ IMPL_LINK_TYPED(SvxColorWindow_Impl, SelectHdl, 
ValueSet*, pColorSet, void)
 
     if ( pColorSet != mpRecentColorSet )
     {
-         mrPaletteManager.AddRecentColor( aColor );
+         mrPaletteManager.AddRecentColor(aColor, 
pColorSet->GetItemText(pColorSet->GetSelectItemId()));
          if ( !IsInPopupMode() )
             mrPaletteManager.ReloadRecentColorSet( *mpRecentColorSet );
     }
commit 2e31a37b87397e6d77cbffc127a0998f54e7f35c
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Aug 30 20:46:52 2016 +0100

    fftester: non-contiguous cells, lets keep the test case though
    
    Change-Id: I6642961b616546da71df7c1830de1e2ebd427126

diff --git a/sw/qa/core/data/rtf/fail/table-1.rtf 
b/sw/qa/core/data/rtf/fail/table-1.rtf
new file mode 100644
index 0000000..c333a10
Binary files /dev/null and b/sw/qa/core/data/rtf/fail/table-1.rtf differ
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to