Resolves: tdf#106838 icon set not visible in conditional formatting

Change-Id: Ibafaa487d39a69bc7c5c150361368614c0d9e004
This commit is contained in:
Caolán McNamara
2017-03-30 10:16:41 +01:00
parent c7442c0d49
commit 1c2dd8dc14
3 changed files with 27 additions and 11 deletions

View File

@@ -1389,11 +1389,15 @@ ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(vcl::Window* pParent, ScIconSetTy
Size ScIconSetFrmtDataEntry::calculateRequisition() const Size ScIconSetFrmtDataEntry::calculateRequisition() const
{ {
if (!maGrid) //during dispose
return Size();
return getLayoutRequisition(*maGrid); return getLayoutRequisition(*maGrid);
} }
void ScIconSetFrmtDataEntry::setAllocation(const Size &rAllocation) void ScIconSetFrmtDataEntry::setAllocation(const Size &rAllocation)
{ {
if (!maGrid) //during dispose
return;
setLayoutPosSize(*maGrid, Point(0, 0), rAllocation); setLayoutPosSize(*maGrid, Point(0, 0), rAllocation);
} }
@@ -1461,6 +1465,7 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, c
{ {
get(maLbColorFormat, "colorformat"); get(maLbColorFormat, "colorformat");
get(maLbIconSetType, "iconsettype"); get(maLbIconSetType, "iconsettype");
get(maIconParent, "iconparent");
Init(); Init();
maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, ColFormatTypeHdl ) ); 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(); for (size_t i = 0, n = pIconSetFormatData->m_Entries.size();
i < n; ++i) i < n; ++i)
{ {
maEntries.push_back( VclPtr<ScIconSetFrmtDataEntry>::Create( maEntries.push_back(VclPtr<ScIconSetFrmtDataEntry>::Create(
this, eType, pDoc, i, pIconSetFormatData->m_Entries[i].get())); maIconParent, eType, pDoc, i, pIconSetFormatData->m_Entries[i].get()));
Size aSize(maEntries[0]->get_preferred_size()); maEntries[i]->set_grid_top_attach(i);
Point aPos(0, LogicToPixel(Size(0, 35), MapMode(MapUnit::MapAppFont)).getHeight());
aPos.Y() += aSize.Height() * i * 1.2;
maEntries[i]->SetPosSizePixel(aPos, aSize);
} }
maEntries[0]->SetFirstEntry(); maEntries[0]->SetFirstEntry();
} }
@@ -1498,6 +1500,7 @@ void ScIconSetFrmtEntry::dispose()
for (auto it = maEntries.begin(); it != maEntries.end(); ++it) for (auto it = maEntries.begin(); it != maEntries.end(); ++it)
it->disposeAndClear(); it->disposeAndClear();
maEntries.clear(); maEntries.clear();
maIconParent.clear();
maLbColorFormat.clear(); maLbColorFormat.clear();
maLbIconSetType.clear(); maLbIconSetType.clear();
ScCondFrmtEntry::dispose(); ScCondFrmtEntry::dispose();
@@ -1525,11 +1528,8 @@ IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl, ListBox&, void )
for(size_t i = 0; i < nElements; ++i) for(size_t i = 0; i < nElements; ++i)
{ {
maEntries.push_back( VclPtr<ScIconSetFrmtDataEntry>::Create( this, static_cast<ScIconSetType>(nPos), mpDoc, i ) ); maEntries.push_back(VclPtr<ScIconSetFrmtDataEntry>::Create(maIconParent, static_cast<ScIconSetType>(nPos), mpDoc, i));
Size aSize(maEntries[0]->get_preferred_size()); maEntries[i]->set_grid_top_attach(i);
Point aPos(0, LogicToPixel(Size(0, 35), MapMode(MapUnit::MapAppFont)).getHeight());
aPos.Y() += aSize.Height() * i * 1.2;
maEntries[i]->SetPosSizePixel(aPos, aSize);
maEntries[i]->Show(); maEntries[i]->Show();
} }
maEntries[0]->SetFirstEntry(); maEntries[0]->SetFirstEntry();

View File

@@ -296,6 +296,8 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry
// icon set ui elements // icon set ui elements
VclPtr<ListBox> maLbIconSetType; VclPtr<ListBox> maLbIconSetType;
VclPtr<VclContainer> maIconParent;
typedef std::vector<VclPtr<ScIconSetFrmtDataEntry>> ScIconSetFrmtDataEntriesType; typedef std::vector<VclPtr<ScIconSetFrmtDataEntry>> ScIconSetFrmtDataEntriesType;
ScIconSetFrmtDataEntriesType maEntries; ScIconSetFrmtDataEntriesType maEntries;

View File

@@ -409,6 +409,20 @@
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </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> <child>
<placeholder/> <placeholder/>
</child> </child>