tdf#133482 don't increase dialog width when new columns added

gtk will expand to fit all children, while vcl will clip.
insert a borderless ScrolledWindow with "external" scrolling
to allow the dialog to clip the children (same thing we do
for our menubar to shrink down past its natural size)

adjust the width calculation to avoid logictopixel rounding

Change-Id: Id2e4f92959f1827c6960360d1530a9c63a4d0c00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102931
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 0aaccde..d772905 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -102,9 +102,6 @@ public:

    bool HasFocus() const { return m_xControl->has_focus(); }

    void Hide() { m_xControl->hide(); }
    void Show() { m_xControl->show(); }

    void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
    void set_margin_left(int nLeft) { m_xControl->set_margin_left(nLeft); }

@@ -296,23 +293,18 @@ void SeriesHeader::SetPos()
    m_spSymbol->set_size_request(aSize.Width(), aSize.Height());

    // series name edit field
    aSize.setWidth(nSymbolDistance);
    m_spSeriesName->set_margin_left(2);

    aSize.setWidth(nSymbolHeight);
    aSize.setHeight(12);
    aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
    m_spSeriesName->set_margin_left(aSize.Width() + 2);
    aSize.setWidth( m_nWidth - nSymbolHeight - nSymbolDistance );
    sal_Int32 nHeight = 12;
    aSize.setHeight( nHeight );
    aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
    aSize.setWidth(m_nWidth - aSize.Width() - 2);
    m_spSeriesName->set_size_request(aSize.Width(), aSize.Height());

    // color bar
    aSize.setWidth(1);
    aSize.setHeight(3);
    aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
    m_spColorBar->set_margin_left(aSize.Width() + 2);
    nHeight = 3;
    aSize.setWidth( m_nWidth - 1 );
    aSize.setHeight( nHeight );
    aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
    aSize.setWidth(m_nWidth);
    m_spColorBar->set_size_request(aSize.Width(), aSize.Height());

    auto xVirDev(m_spColorBar->create_virtual_device());
@@ -331,7 +323,7 @@ void SeriesHeader::SetWidth( sal_Int32 nWidth )

void SeriesHeader::SetPixelWidth( sal_Int32 nWidth )
{
    SetWidth( m_xDevice->PixelToLogic(Size(nWidth, 0), MapMode(MapUnit::MapAppFont)).getWidth());
    SetWidth(nWidth);
}

void SeriesHeader::SetChartType(
@@ -356,16 +348,14 @@ void SeriesHeader::SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol )

void SeriesHeader::Show()
{
    m_spSymbol->show();
    m_spSeriesName->Show();
    m_spColorBar->show();
    m_xContainer1->show();
    m_xContainer2->show();
}

void SeriesHeader::Hide()
{
    m_spSymbol->hide();
    m_spSeriesName->Hide();
    m_spColorBar->hide();
    m_xContainer1->hide();
    m_xContainer2->hide();
}

void SeriesHeader::SetEditChangedHdl( const Link<SeriesHeaderEdit&,void> & rLink )
@@ -1338,7 +1328,7 @@ void DataBrowser::ImplAdjustHeaderControls()
        {
            if( nStartPos < nMaxPos )
            {
                (*aIt)->SetPixelWidth( nCurrentPos - nStartPos - 3 );
                (*aIt)->SetPixelWidth( nCurrentPos - nStartPos );
                (*aIt)->Show();

                if (pWin)
diff --git a/chart2/uiconfig/ui/chartdatadialog.ui b/chart2/uiconfig/ui/chartdatadialog.ui
index c48c8f2..c8337d3 100644
--- a/chart2/uiconfig/ui/chartdatadialog.ui
+++ b/chart2/uiconfig/ui/chartdatadialog.ui
@@ -210,18 +210,32 @@
                <property name="orientation">vertical</property>
                <property name="spacing">6</property>
                <child>
                  <object class="GtkBox" id="columns">
                  <object class="GtkScrolledWindow">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="hexpand">True</property>
                    <property name="can_focus">True</property>
                    <property name="hscrollbar_policy">external</property>
                    <property name="vscrollbar_policy">never</property>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                      <object class="GtkViewport">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                          <object class="GtkBox" id="columns">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="hexpand">True</property>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                  <packing>
@@ -231,18 +245,32 @@
                  </packing>
                </child>
                <child>
                  <object class="GtkBox" id="colorcolumns">
                  <object class="GtkScrolledWindow">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="hexpand">True</property>
                    <property name="can_focus">True</property>
                    <property name="hscrollbar_policy">external</property>
                    <property name="vscrollbar_policy">never</property>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                    </child>
                    <child>
                      <placeholder/>
                      <object class="GtkViewport">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                          <object class="GtkBox" id="colorcolumns">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="hexpand">True</property>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                  <packing>