tdf#115015: make crypto settings better fit allocated space

Oh dear how much do I dislike fixed size dialogs. Everytime they
are enlarged to fit new content (esp. gtk3 is rather space-greedy
there) someone starts to whine the dialog is now too large

Doing what e6d7d7375221 does is not really an option, since there
are some 30+ tabpages to try and test for optimal size here.

Change-Id: I3ffb2d794f76781eb62186093b928289593585cf
Reviewed-on: https://gerrit.libreoffice.org/50032
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 1b160fb..872001b 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -302,7 +302,7 @@ void SvxGeneralTabPage::InitCryptography()
{
#if HAVE_FEATURE_GPGME
    m_pCryptoFrame->Show();
    // unused yet, I just wanted to see if this delivers the desired results

    uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
    try
    {
@@ -321,6 +321,17 @@ void SvxGeneralTabPage::InitCryptography()
                    m_pEncryptionKeyLB->InsertEntry( xCert->getIssuerName());
                }
            }

             //tdf#115015: wrap checkbox text and listboxes if necessary
             Size aPrefSize(m_pEncryptToSelfCB->get_preferred_size());
             Size aSize(m_pEncryptToSelfCB->CalcMinimumSize(40*approximate_char_width()));
             if (aPrefSize.Width() > aSize.Width())
             {
                 m_pSigningKeyLB->set_width_request(aSize.Width());
                 m_pEncryptionKeyLB->set_width_request(aSize.Width());
                 m_pEncryptToSelfCB->set_width_request(aSize.Width());
             }

        }
    }
    catch ( uno::Exception const & )
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index fb01bfe..877f2cf 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -489,10 +489,9 @@ void OfaTreeOptionsDialog::InitWidgets()
    get(pTreeLB, "pages");
    get(pTabBox, "box");
    Size aSize(pTabBox->LogicToPixel(Size(278, 259), MapMode(MapUnit::MapAppFont)));
    pTabBox->set_width_request(aSize.Width());
    pTabBox->set_height_request(aSize.Height() - get_action_area()->get_preferred_size().Height());
    pTreeLB->set_width_request(pTreeLB->approximate_char_width() * 25);
    pTreeLB->set_height_request(pTabBox->get_height_request());
    pTreeLB->set_height_request(pTreeLB->GetTextHeight() *  32);
    pTabBox->set_width_request(aSize.Width());
}

// Ctor() with Frame -----------------------------------------------------
diff --git a/cui/uiconfig/ui/optuserpage.ui b/cui/uiconfig/ui/optuserpage.ui
index 96c0a77..ac080f4 100644
--- a/cui/uiconfig/ui/optuserpage.ui
+++ b/cui/uiconfig/ui/optuserpage.ui
@@ -883,8 +883,9 @@
                </child>
                <child>
                  <object class="GtkComboBox" id="encryptionkey">
                    <property name="can_focus">False</property>
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="hexpand">True</property>
                    <property name="model">liststore1</property>
                  </object>
                  <packing>
@@ -896,6 +897,7 @@
                  <object class="GtkComboBox" id="signingkey">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="hexpand">True</property>
                    <property name="model">liststore1</property>
                  </object>
                  <packing>
@@ -904,10 +906,11 @@
                  </packing>
                </child>
                <child>
                  <object class="GtkCheckButton" id="encrypttoself">
                  <object class="GtkCheckButton" id="encrypttoself:wrap">
                    <property name="label" translatable="yes" context="optuserpage|encrypttoself">When encrypting documents, always encrypt to self</property>
                    <property name="can_focus">True</property>
                    <property name="visible">True</property>
                    <property name="xalign">0</property>
                    <property name="receives_default">False</property>
                    <property name="draw_indicator">True</property>
                  </object>