[Libreoffice-commits] core.git: cui/source cui/uiconfig

Rishabh Kumar kris.kr296 at gmail.com
Tue Jul 19 18:25:39 UTC 2016


 cui/source/inc/cuitabarea.hxx    |    2 +
 cui/source/tabpages/tpgradnt.cxx |   52 +++++++++++++++++++++++++++++++++------
 cui/uiconfig/ui/gradientpage.ui  |   52 +++++++++++++++++++++++++++++----------
 3 files changed, 86 insertions(+), 20 deletions(-)

New commits:
commit 1d602088136828cdf1114901587beeec95afea2c
Author: Rishabh Kumar <kris.kr296 at gmail.com>
Date:   Sun Jul 17 21:39:52 2016 +0530

    Fix regression : Automatic gradient steps in gradient tab
    
    Adds a checkbox for enabling/disabling automatic gradient steps.
    
    Change-Id: I223279ec0f23f20f3ff544072cc7fd8662946296
    Reviewed-on: https://gerrit.libreoffice.org/27269
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 38b85eb..2fa662d 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -401,6 +401,7 @@ private:
     VclPtr<GradientLB>         m_pLbGradients;
     VclPtr<SvxPresetListBox>   m_pGradientLB;
     VclPtr<NumericField>       m_pMtrIncrement;
+    VclPtr<CheckBox>           m_pCbIncrement;
     VclPtr<Slider>             m_pSliderIncrement;
     VclPtr<SvxXRectPreview>    m_pCtlPreview;
     VclPtr<PushButton>         m_pBtnAdd;
@@ -430,6 +431,7 @@ private:
     DECL_LINK_TYPED( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
     DECL_LINK_TYPED( ModifiedEditHdl_Impl, Edit&, void );
     DECL_LINK_TYPED( ModifiedListBoxHdl_Impl, ListBox&, void );
+    DECL_LINK_TYPED( ChangeAutoStepHdl_Impl, CheckBox&, void );
     DECL_LINK_TYPED( ModifiedSliderHdl_Impl, Slider*, void );
     void ModifiedHdl_Impl(void*);
 
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index 71c71b5..0f3d0f5 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -66,6 +66,7 @@ SvxGradientTabPage::SvxGradientTabPage
     m_aXFillAttr          ( rInAttrs.GetPool() ),
     m_rXFSet              ( m_aXFillAttr.GetItemSet() )
 {
+    get(m_pCbIncrement,    "autoincrement");
     get(m_pMtrIncrement,   "incrementmtr");
     get(m_pSliderIncrement,"incrementslider");
     get(m_pLbGradientType, "gradienttypelb");
@@ -113,8 +114,9 @@ SvxGradientTabPage::SvxGradientTabPage
     Link<Edit&,void> aLink = LINK( this, SvxGradientTabPage, ModifiedEditHdl_Impl );
     Link<ListBox&,void> aLink2 = LINK( this, SvxGradientTabPage, ModifiedListBoxHdl_Impl );
     m_pLbGradientType->SetSelectHdl( aLink2 );
+    m_pCbIncrement->SetToggleHdl( LINK( this, SvxGradientTabPage, ChangeAutoStepHdl_Impl ) );
     m_pMtrIncrement->SetModifyHdl( aLink );
-    m_pSliderIncrement->SetSlideHdl( LINK( this, SvxGradientTabPage, ModifiedSliderHdl_Impl )  );
+    m_pSliderIncrement->SetSlideHdl( LINK( this, SvxGradientTabPage, ModifiedSliderHdl_Impl ) );
     m_pMtrCenterX->SetModifyHdl( aLink );
     m_pMtrCenterY->SetModifyHdl( aLink );
     m_pMtrAngle->SetModifyHdl( aLink );
@@ -138,6 +140,7 @@ SvxGradientTabPage::~SvxGradientTabPage()
 
 void SvxGradientTabPage::dispose()
 {
+    m_pCbIncrement.clear();
     m_pMtrIncrement.clear();
     m_pSliderIncrement.clear();
     m_pLbGradientType.clear();
@@ -329,7 +332,6 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
         std::unique_ptr<XGradient> pXGradient;
         OUString      aString;
         size_t        nPos = m_pGradientLB->GetSelectItemPos();
-        sal_uInt16     nValue = m_pMtrIncrement->GetValue();
         if( nPos != VALUESET_ITEM_NOTFOUND )
         {
             pXGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() ));
@@ -348,6 +350,11 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
                         (sal_uInt16) m_pMtrColorFrom->GetValue(),
                         (sal_uInt16) m_pMtrColorTo->GetValue() ));
         }
+
+        sal_uInt16 nValue = 0;
+        if( !m_pCbIncrement->IsChecked() )
+            nValue = m_pMtrIncrement->GetValue();
+
         assert( pXGradient && "XGradient could not be created" );
         rSet->Put( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
         rSet->Put( XFillGradientItem( aString, *pXGradient ) );
@@ -359,6 +366,8 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
 
 void SvxGradientTabPage::Reset( const SfxItemSet* )
 {
+    m_pMtrIncrement->SetValue(DEFAULT_GRADIENTSTEP);
+    m_pSliderIncrement->SetThumbPos(DEFAULT_GRADIENTSTEP);
     ChangeGradientHdl_Impl();
 
     // determine state of the buttons
@@ -380,14 +389,32 @@ IMPL_LINK_TYPED( SvxGradientTabPage, ModifiedListBoxHdl_Impl, ListBox&, rListBox
 {
     ModifiedHdl_Impl(&rListBox);
 }
+
 IMPL_LINK_TYPED( SvxGradientTabPage, ModifiedEditHdl_Impl, Edit&, rBox, void )
 {
     ModifiedHdl_Impl(&rBox);
 }
+
 IMPL_LINK_TYPED( SvxGradientTabPage, ModifiedSliderHdl_Impl, Slider*, rSlider, void )
 {
     ModifiedHdl_Impl(rSlider);
 }
+
+IMPL_LINK_NOARG_TYPED( SvxGradientTabPage, ChangeAutoStepHdl_Impl, CheckBox&, void )
+{
+    if(m_pCbIncrement->IsChecked())
+    {
+        m_pSliderIncrement->Disable();
+        m_pMtrIncrement->Disable();
+    }
+    else
+    {
+        m_pSliderIncrement->Enable();
+        m_pMtrIncrement->Enable();
+    }
+    ModifiedHdl_Impl(m_pMtrIncrement);
+}
+
 void SvxGradientTabPage::ModifiedHdl_Impl( void* pControl )
 {
     if( pControl == m_pMtrBorder )
@@ -415,7 +442,9 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void* pControl )
     if( pControl == m_pLbGradientType || pControl == this )
         SetControlState_Impl( eXGS );
 
-    sal_uInt16 nValue = (sal_uInt16)m_pMtrIncrement->GetValue();
+    sal_uInt16 nValue = 0;
+    if(!m_pCbIncrement->IsChecked())
+        nValue = (sal_uInt16)m_pMtrIncrement->GetValue();
     m_rXFSet.Put( XGradientStepCountItem( nValue ) );
 
     // displaying in XOutDev
@@ -644,10 +673,19 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl()
         css::awt::GradientStyle eXGS = pGradient->GetGradientStyle();
         sal_uInt16 nValue = static_cast<const XGradientStepCountItem&>( m_rOutAttrs.Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue();
         if(nValue == 0)
-            nValue = DEFAULT_GRADIENTSTEP;
-
-        m_pMtrIncrement->SetValue( nValue );
-        m_pSliderIncrement->SetThumbPos( nValue );
+        {
+            m_pCbIncrement->SetState(TRISTATE_TRUE);
+            m_pMtrIncrement->Disable();
+            m_pSliderIncrement->Disable();
+        }
+        else
+        {
+            m_pCbIncrement->SetState(TRISTATE_FALSE);
+            m_pMtrIncrement->Enable();
+            m_pMtrIncrement->SetValue( nValue );
+            m_pSliderIncrement->Enable();
+            m_pSliderIncrement->SetThumbPos( nValue );
+        }
         m_pLbGradientType->SelectEntryPos(
             sal::static_int_cast< sal_Int32 >( eXGS ) );
         // if the entry is not in the listbox,
diff --git a/cui/uiconfig/ui/gradientpage.ui b/cui/uiconfig/ui/gradientpage.ui
index c1f225c..0be7fbd 100644
--- a/cui/uiconfig/ui/gradientpage.ui
+++ b/cui/uiconfig/ui/gradientpage.ui
@@ -132,14 +132,16 @@
               <object class="GtkBox" id="box2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="valign">start</property>
                 <property name="orientation">vertical</property>
-                <property name="spacing">12</property>
+                <property name="spacing">6</property>
                 <child>
                   <object class="GtkBox" id="box6">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="valign">start</property>
                     <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
+                    <property name="spacing">3</property>
                     <child>
                       <object class="GtkLabel" id="typeft">
                         <property name="visible">True</property>
@@ -184,8 +186,9 @@
                   <object class="GtkGrid" id="grid6">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">6</property>
+                    <property name="valign">start</property>
+                    <property name="row_spacing">3</property>
+                    <property name="column_spacing">3</property>
                     <child>
                       <object class="GtkLabel" id="incrementft">
                         <property name="visible">True</property>
@@ -211,7 +214,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="top_attach">2</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
@@ -225,6 +228,22 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="autoincrement">
+                        <property name="label" translatable="yes">Automatic</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
@@ -233,6 +252,9 @@
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -244,8 +266,9 @@
                   <object class="GtkGrid" id="grid5">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">6</property>
+                    <property name="valign">start</property>
+                    <property name="row_spacing">3</property>
+                    <property name="column_spacing">3</property>
                     <child>
                       <object class="GtkLabel" id="angleft">
                         <property name="visible">True</property>
@@ -345,8 +368,9 @@
                   <object class="GtkGrid" id="grid3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">6</property>
+                    <property name="valign">start</property>
+                    <property name="row_spacing">3</property>
+                    <property name="column_spacing">3</property>
                     <child>
                       <object class="GtkLabel" id="borderft">
                         <property name="visible">True</property>
@@ -407,8 +431,9 @@
                   <object class="GtkGrid" id="grid2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">6</property>
+                    <property name="valign">start</property>
+                    <property name="row_spacing">3</property>
+                    <property name="column_spacing">3</property>
                     <child>
                       <object class="GtkLabel" id="colorfromft">
                         <property name="visible">True</property>
@@ -466,8 +491,9 @@
                   <object class="GtkGrid" id="grid1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">6</property>
+                    <property name="valign">start</property>
+                    <property name="row_spacing">3</property>
+                    <property name="column_spacing">3</property>
                     <child>
                       <object class="svxlo-ColorLB" id="colortolb">
                         <property name="visible">True</property>


More information about the Libreoffice-commits mailing list