chart2/source/controller/dialogs/DataBrowser.cxx |   36 ++++--------
 chart2/uiconfig/ui/chartdatadialog.ui            |   68 ++++++++++++++++-------
 2 files changed, 61 insertions(+), 43 deletions(-)

New commits:
commit b70b1636b0c71dbb6f6f4f07ebdafeba94261dee
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Sep 17 19:31:53 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Sep 17 22:13:13 2020 +0200

    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/+/102972
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx 
b/chart2/source/controller/dialogs/DataBrowser.cxx
index ab967c92408d..6f7ada12cbec 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);
-    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 );
+    m_spSeriesName->set_margin_left(2);
+
+    aSize.setWidth(nSymbolHeight);
+    aSize.setHeight(12);
     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 = 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.setHeight(3);
     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 )
@@ -1346,7 +1336,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 b790f4d912c9..b696cd19847a 100644
--- a/chart2/uiconfig/ui/chartdatadialog.ui
+++ b/chart2/uiconfig/ui/chartdatadialog.ui
@@ -252,18 +252,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>
-                    <child>
-                      <placeholder/>
-                    </child>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">external</property>
+                    <property name="vscrollbar_policy">never</property>
                     <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>
@@ -273,18 +287,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>
-                    <child>
-                      <placeholder/>
-                    </child>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">external</property>
+                    <property name="vscrollbar_policy">never</property>
                     <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>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to