Resolves: tdf#126781 force comboboxes to take 1/3 avail space

and not their natural size as this dialog is fixed width so we need
to make do. This brings the right border of the entry inside the
scrolled window area as expected

Change-Id: I60d6078436cbfacbbfda55838e4b0584da4bab1e
Reviewed-on: https://gerrit.libreoffice.org/79872
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2019-09-30 16:27:24 +01:00
parent eac301701e
commit 0ff8140676

View File

@@ -41,6 +41,10 @@
#include <set>
// set the widget width to something to override their auto-width calc and
// force them to take a 1/3 of the available space
#define CommonWidgetWidth 10
ScCondFrmtEntry::ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, const ScAddress& rPos)
: mpParent(pParent)
, mxBuilder(Application::CreateBuilder(pParent->GetContainer(), (comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView())?OUString("modules/scalc/ui/conditionalentrymobile.ui"):OUString("modules/scalc/ui/conditionalentry.ui"))))
@@ -54,6 +58,7 @@ ScCondFrmtEntry::ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, co
, mpDoc(pDoc)
, maPos(rPos)
{
mxLbType->set_size_request(CommonWidgetWidth, -1);
mxLbType->connect_changed(LINK(pParent, ScCondFormatList, TypeListHdl));
mxGrid->connect_mouse_press(LINK(this, ScCondFrmtEntry, EntrySelectHdl));
maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl );
@@ -154,6 +159,8 @@ ScConditionFrmtEntry::ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument
, mxWdPreview(new weld::CustomWeld(*mxBuilder, "preview", maWdPreview))
, mbIsInStyleCreate(false)
{
mxLbCondType->set_size_request(CommonWidgetWidth, -1);
mxLbType->set_size_request(CommonWidgetWidth, -1);
mxWdPreview->set_size_request(-1, mxLbStyle->get_preferred_size().Height());
mxLbType->set_active(1);
@@ -493,6 +500,7 @@ ScFormulaFrmtEntry::ScFormulaFrmtEntry(ScCondFormatList* pParent, ScDocument* pD
, mxWdPreview(new weld::CustomWeld(*mxBuilder, "preview", maWdPreview))
, mxEdFormula(new formula::RefEdit(mxBuilder->weld_entry("formula")))
{
mxLbType->set_size_request(CommonWidgetWidth, -1);
mxWdPreview->set_size_request(-1, mxLbStyle->get_preferred_size().Height());
Init(pDialogParent);
@@ -722,6 +730,10 @@ ScColorScale2FrmtEntry::ScColorScale2FrmtEntry(ScCondFormatList* pParent, ScDocu
, mxFtMin(mxBuilder->weld_label("Label_minimum"))
, mxFtMax(mxBuilder->weld_label("Label_maximum"))
{
mxLbColorFormat->set_size_request(CommonWidgetWidth, -1);
mxLbEntryTypeMin->set_size_request(CommonWidgetWidth, -1);
mxLbEntryTypeMax->set_size_request(CommonWidgetWidth, -1);
mxFtMin->show();
mxFtMax->show();
@@ -854,6 +866,10 @@ ScColorScale3FrmtEntry::ScColorScale3FrmtEntry(ScCondFormatList* pParent, ScDocu
, mxFtMin(mxBuilder->weld_label("Label_minimum"))
, mxFtMax(mxBuilder->weld_label("Label_maximum"))
{
mxLbColorFormat->set_size_request(CommonWidgetWidth, -1);
mxLbEntryTypeMin->set_size_request(CommonWidgetWidth, -1);
mxLbEntryTypeMiddle->set_size_request(CommonWidgetWidth, -1);
mxLbEntryTypeMax->set_size_request(CommonWidgetWidth, -1);
mxFtMin->show();
mxFtMax->show();
@@ -1056,6 +1072,10 @@ ScDataBarFrmtEntry::ScDataBarFrmtEntry(ScCondFormatList* pParent, ScDocument* pD
, mxFtMin(mxBuilder->weld_label("Label_minimum"))
, mxFtMax(mxBuilder->weld_label("Label_maximum"))
{
mxLbColorFormat->set_size_request(CommonWidgetWidth, -1);
mxLbDataBarMinType->set_size_request(CommonWidgetWidth, -1);
mxLbDataBarMaxType->set_size_request(CommonWidgetWidth, -1);
// "min" selector doesn't need "max" entry, and vice versa
removeType(*mxLbDataBarMinType, COLORSCALE_MAX);
removeType(*mxLbDataBarMaxType, COLORSCALE_MIN);
@@ -1190,6 +1210,9 @@ ScDateFrmtEntry::ScDateFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, co
, mxWdPreview(new weld::CustomWeld(*mxBuilder, "preview", maWdPreview))
, mbIsInStyleCreate(false)
{
mxLbDateEntry->set_size_request(CommonWidgetWidth, -1);
mxLbStyle->set_size_request(CommonWidgetWidth, -1);
mxWdPreview->set_size_request(mxLbStyle->get_preferred_size().Height(), -1);
Init();
@@ -1309,6 +1332,8 @@ ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(weld::Container* pParent, ScIconS
, mxLbEntryType(mxBuilder->weld_combo_box("listbox"))
, mpContainer(pParent)
{
mxLbEntryType->set_size_request(CommonWidgetWidth, -1);
mxImgIcon->set_from_icon_name(ScIconSetFormat::getIconName(eType, i));
if(pEntry)
{
@@ -1394,6 +1419,9 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry(ScCondFormatList* pParent, ScDocument* pD
, mxLbIconSetType(mxBuilder->weld_combo_box("iconsettype"))
, mxIconParent(mxBuilder->weld_container("iconparent"))
{
mxLbColorFormat->set_size_request(CommonWidgetWidth, -1);
mxLbIconSetType->set_size_request(CommonWidgetWidth, -1);
Init();
mxLbColorFormat->connect_changed(LINK(pParent, ScCondFormatList, ColFormatTypeHdl));