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

Caolán McNamara caolanm at redhat.com
Thu Mar 30 09:17:52 UTC 2017


 sc/source/ui/condformat/condformatdlgentry.cxx |   22 +++++++++++-----------
 sc/source/ui/inc/condformatdlgentry.hxx        |    2 ++
 sc/uiconfig/scalc/ui/conditionalentry.ui       |   14 ++++++++++++++
 3 files changed, 27 insertions(+), 11 deletions(-)

New commits:
commit 1c2dd8dc14effe739bd826cf4fe77145d5b751bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 30 10:16:41 2017 +0100

    Resolves: tdf#106838 icon set not visible in conditional formatting
    
    Change-Id: Ibafaa487d39a69bc7c5c150361368614c0d9e004

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index c1a92ff7475a..c9cacdb323be 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1389,11 +1389,15 @@ ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(vcl::Window* pParent, ScIconSetTy
 
 Size ScIconSetFrmtDataEntry::calculateRequisition() const
 {
+    if (!maGrid) //during dispose
+        return Size();
     return getLayoutRequisition(*maGrid);
 }
 
 void ScIconSetFrmtDataEntry::setAllocation(const Size &rAllocation)
 {
+    if (!maGrid) //during dispose
+        return;
     setLayoutPosSize(*maGrid, Point(0, 0), rAllocation);
 }
 
@@ -1461,6 +1465,7 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, c
 {
     get(maLbColorFormat, "colorformat");
     get(maLbIconSetType, "iconsettype");
+    get(maIconParent, "iconparent");
 
     Init();
     maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) );
@@ -1475,12 +1480,9 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, c
         for (size_t i = 0, n = pIconSetFormatData->m_Entries.size();
                 i < n; ++i)
         {
-            maEntries.push_back( VclPtr<ScIconSetFrmtDataEntry>::Create(
-                this, eType, pDoc, i, pIconSetFormatData->m_Entries[i].get()));
-            Size aSize(maEntries[0]->get_preferred_size());
-            Point aPos(0, LogicToPixel(Size(0, 35), MapMode(MapUnit::MapAppFont)).getHeight());
-            aPos.Y() += aSize.Height() * i * 1.2;
-            maEntries[i]->SetPosSizePixel(aPos, aSize);
+            maEntries.push_back(VclPtr<ScIconSetFrmtDataEntry>::Create(
+                maIconParent, eType, pDoc, i, pIconSetFormatData->m_Entries[i].get()));
+            maEntries[i]->set_grid_top_attach(i);
         }
         maEntries[0]->SetFirstEntry();
     }
@@ -1498,6 +1500,7 @@ void ScIconSetFrmtEntry::dispose()
     for (auto it = maEntries.begin(); it != maEntries.end(); ++it)
         it->disposeAndClear();
     maEntries.clear();
+    maIconParent.clear();
     maLbColorFormat.clear();
     maLbIconSetType.clear();
     ScCondFrmtEntry::dispose();
@@ -1525,11 +1528,8 @@ IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl, ListBox&, void )
 
     for(size_t i = 0; i < nElements; ++i)
     {
-        maEntries.push_back( VclPtr<ScIconSetFrmtDataEntry>::Create( this, static_cast<ScIconSetType>(nPos), mpDoc, i ) );
-        Size aSize(maEntries[0]->get_preferred_size());
-        Point aPos(0, LogicToPixel(Size(0, 35), MapMode(MapUnit::MapAppFont)).getHeight());
-        aPos.Y() += aSize.Height() * i * 1.2;
-        maEntries[i]->SetPosSizePixel(aPos, aSize);
+        maEntries.push_back(VclPtr<ScIconSetFrmtDataEntry>::Create(maIconParent, static_cast<ScIconSetType>(nPos), mpDoc, i));
+        maEntries[i]->set_grid_top_attach(i);
         maEntries[i]->Show();
     }
     maEntries[0]->SetFirstEntry();
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx
index 27a4fbc2e468..5b23e6ec12fb 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -296,6 +296,8 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry
     // icon set ui elements
     VclPtr<ListBox> maLbIconSetType;
 
+    VclPtr<VclContainer> maIconParent;
+
     typedef std::vector<VclPtr<ScIconSetFrmtDataEntry>> ScIconSetFrmtDataEntriesType;
     ScIconSetFrmtDataEntriesType maEntries;
 
diff --git a/sc/uiconfig/scalc/ui/conditionalentry.ui b/sc/uiconfig/scalc/ui/conditionalentry.ui
index c5803074e635..88ec9b39069a 100644
--- a/sc/uiconfig/scalc/ui/conditionalentry.ui
+++ b/sc/uiconfig/scalc/ui/conditionalentry.ui
@@ -410,6 +410,20 @@
           </packing>
         </child>
         <child>
+          <object class="GtkGrid" id="iconparent">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">7</property>
+            <property name="width">3</property>
+          </packing>
+        </child>
+        <child>
           <placeholder/>
         </child>
         <child>


More information about the Libreoffice-commits mailing list