[Libreoffice-commits] .: 2 commits - cui/AllLangResTarget_cui.mk cui/source cui/uiconfig cui/UI_cui.mk vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Jan 19 13:00:04 PST 2013


 cui/AllLangResTarget_cui.mk         |    1 
 cui/UI_cui.mk                       |    1 
 cui/source/dialogs/splitcelldlg.cxx |   57 +++----
 cui/source/dialogs/splitcelldlg.hrc |   29 ---
 cui/source/dialogs/splitcelldlg.src |  118 ---------------
 cui/source/inc/splitcelldlg.hxx     |   14 -
 cui/uiconfig/ui/splitcellsdialog.ui |  275 ++++++++++++++++++++++++++++++++++++
 vcl/inc/vcl/builder.hxx             |   17 +-
 vcl/source/control/button.cxx       |    4 
 vcl/source/window/builder.cxx       |   43 ++++-
 10 files changed, 359 insertions(+), 200 deletions(-)

New commits:
commit 621d1fba84e13a28843fb7a7befb28e26a6d0a15
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 19 16:22:18 2013 +0000

    convert split cells dialog to our 99th .ui file
    
    Change-Id: If1a37074400540e3adce42de2bb7c88c2c599382

diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk
index f8a133e..967d702 100644
--- a/cui/AllLangResTarget_cui.mk
+++ b/cui/AllLangResTarget_cui.mk
@@ -73,7 +73,6 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
     cui/source/dialogs/scriptdlg.src \
     cui/source/dialogs/sdrcelldlg.src \
     cui/source/dialogs/showcols.src \
-    cui/source/dialogs/splitcelldlg.src \
     cui/source/dialogs/srchxtra.src \
     cui/source/dialogs/svuidlg.src \
     cui/source/dialogs/tbxform.src \
diff --git a/cui/UI_cui.mk b/cui/UI_cui.mk
index d041c02..e67ffac 100644
--- a/cui/UI_cui.mk
+++ b/cui/UI_cui.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\
 	cui/uiconfig/ui/select_persona_dialog \
 	cui/uiconfig/ui/specialcharacters \
 	cui/uiconfig/ui/spellingdialog \
+	cui/uiconfig/ui/splitcellsdialog \
 	cui/uiconfig/ui/thesaurus \
 	cui/uiconfig/ui/twolinespage \
 	cui/uiconfig/ui/zoomdialog \
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index d1566a5..f8d37b9 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -23,40 +23,33 @@
 #include "dialmgr.hxx"
 #include "splitcelldlg.hxx"
 #include "cuires.hrc"
-#include "splitcelldlg.hrc"
 
-SvxSplitTableDlg::SvxSplitTableDlg( Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal )
-: SvxStandardDialog(pParent, CUI_RES(RID_SVX_SPLITCELLDLG))
-, maCountFL(this, CUI_RES(FL_COUNT))
-, maCountLbl(this, CUI_RES(FT_COUNT))
-, maCountEdit(this, CUI_RES(ED_COUNT))
-, maDirFL(this, CUI_RES(FL_DIR))
-, maHorzBox(this, CUI_RES(RB_HORZ))
-, maVertBox(this, CUI_RES(RB_VERT))
-, maPropCB(this, CUI_RES(CB_PROP))
-, maOKBtn(this, CUI_RES(BT_OK))
-, maCancelBtn(this, CUI_RES(BT_CANCEL))
-, maHelpBtn( this, CUI_RES( BT_HELP ) )
-, mnMaxVertical( nMaxVertical )
-, mnMaxHorizontal( nMaxHorizontal )
+SvxSplitTableDlg::SvxSplitTableDlg( Window *pParent, bool bIsTableVertical,
+    long nMaxVertical, long nMaxHorizontal )
+    : SvxStandardDialog(pParent, "SplitCellsDialog", "cui/ui/splitcellsdialog.ui")
+    , mnMaxVertical(nMaxVertical)
+    , mnMaxHorizontal(nMaxHorizontal)
 {
-    FreeResource();
-    maHorzBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
-    maPropCB.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
-    maVertBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+    get(m_pCountEdit, "countnf");
+    get(m_pHorzBox, "hori");
+    get(m_pVertBox, "vert");
+    get(m_pPropCB, "prop");
+    m_pHorzBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+    m_pPropCB->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+    m_pVertBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
 
     if( mnMaxVertical < 2 )
-        maVertBox.Enable(sal_False);
+        m_pVertBox->Enable(sal_False);
 
     //exchange the meaning of horizontal and vertical for vertical text
     if(bIsTableVertical)
     {
-        Image aTmpImg(maHorzBox.GetModeRadioImage());
-        String sTmp(maHorzBox.GetText());
-        maHorzBox.SetText(maVertBox.GetText());
-        maHorzBox.SetModeRadioImage(maVertBox.GetModeRadioImage());
-        maVertBox.SetText(sTmp);
-        maVertBox.SetModeRadioImage(aTmpImg);
+        Image aTmpImg(m_pHorzBox->GetModeRadioImage());
+        String sTmp(m_pHorzBox->GetText());
+        m_pHorzBox->SetText(m_pVertBox->GetText());
+        m_pHorzBox->SetModeRadioImage(m_pVertBox->GetModeRadioImage());
+        m_pVertBox->SetText(sTmp);
+        m_pVertBox->SetModeRadioImage(aTmpImg);
     }
 }
 
@@ -66,26 +59,26 @@ SvxSplitTableDlg::~SvxSplitTableDlg()
 
 IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton )
 {
-    const bool bIsVert =  pButton == &maVertBox ;
+    const bool bIsVert =  pButton == m_pVertBox ;
     long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
-    maPropCB.Enable(!bIsVert);
-    maCountEdit.SetMax( nMax );
+    m_pPropCB->Enable(!bIsVert);
+    m_pCountEdit->SetMax( nMax );
     return 0;
 }
 
 bool SvxSplitTableDlg::IsHorizontal() const
 {
-    return maHorzBox.IsChecked();
+    return m_pHorzBox->IsChecked();
 }
 
 bool SvxSplitTableDlg::IsProportional() const
 {
-    return maPropCB.IsChecked() && maHorzBox.IsChecked();
+    return m_pPropCB->IsChecked() && m_pHorzBox->IsChecked();
 }
 
 long SvxSplitTableDlg::GetCount() const
 {
-    return sal::static_int_cast<long>( maCountEdit.GetValue() );
+    return sal::static_int_cast<long>( m_pCountEdit->GetValue() );
 }
 
 short SvxSplitTableDlg::Execute()
diff --git a/cui/source/dialogs/splitcelldlg.hrc b/cui/source/dialogs/splitcelldlg.hrc
deleted file mode 100644
index 5ce4984..0000000
--- a/cui/source/dialogs/splitcelldlg.hrc
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#define FT_COUNT    1
-#define ED_COUNT    2
-#define FL_COUNT    3
-
-#define RB_HORZ     10
-#define CB_PROP     11
-#define RB_VERT     12
-#define FL_DIR      12
-
-#define BT_OK       100
-#define BT_CANCEL   101
-#define BT_HELP     102
diff --git a/cui/source/dialogs/splitcelldlg.src b/cui/source/dialogs/splitcelldlg.src
deleted file mode 100644
index 86fd9b0..0000000
--- a/cui/source/dialogs/splitcelldlg.src
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cuires.hrc>
-#include "splitcelldlg.hrc"
-
-ModalDialog RID_SVX_SPLITCELLDLG
-{
-    HelpID = "cui:ModalDialog:RID_SVX_SPLITCELLDLG";
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    Size = MAP_APPFONT ( 169 , 108 ) ;
-    Text [ en-US ] = "Split Cells" ;
-    Moveable = TRUE ;
-
-    OKButton BT_OK
-    {
-        Pos = MAP_APPFONT ( 115 , 6 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-    };
-    CancelButton BT_CANCEL
-    {
-        Pos = MAP_APPFONT ( 115 , 23 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    HelpButton BT_HELP
-    {
-        Pos = MAP_APPFONT ( 115 , 43 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    FixedText FT_COUNT
-    {
-        Pos = MAP_APPFONT ( 12 , 16 ) ;
-        Size = MAP_APPFONT ( 67 , 8 ) ;
-        Text [ en-US ] = "~Split cell into" ;
-        Left = TRUE ;
-    };
-    NumericField ED_COUNT
-    {
-        HelpID = "cui:NumericField:RID_SVX_SPLITCELLDLG:ED_COUNT";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 82 , 14 ) ;
-        Size = MAP_APPFONT ( 21 , 12 ) ;
-        TabStop = TRUE ;
-        Left = TRUE ;
-        Right = TRUE ;
-        Repeat = TRUE ;
-        Spin = TRUE ;
-        Minimum = 2 ;
-        Maximum = 20 ;
-        First = 2 ;
-        Last = 5 ;
-    };
-    FixedLine FL_COUNT
-    {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 103 , 8 ) ;
-        Text [ en-US ] = "Split" ;
-    };
-    ImageRadioButton RB_HORZ
-    {
-        HelpID = "cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_HORZ";
-        Pos = MAP_APPFONT ( 12 , 47 ) ;
-        Size = MAP_APPFONT ( 90 , 18 ) ;
-        Group = TRUE;
-        Text [ en-US ] = "H~orizontally" ;
-        RadioButtonImage = Image
-        {
-            ImageBitmap = Bitmap { File = "zetlhor2.bmp" ; };
-        };
-        TabStop = TRUE ;
-        Check = TRUE ;
-    };
-    CheckBox CB_PROP
-    {
-        HelpID = "cui:CheckBox:RID_SVX_SPLITCELLDLG:CB_PROP";
-        Pos = MAP_APPFONT ( 18 , 68 ) ;
-        Size = MAP_APPFONT ( 91 , 12 ) ;
-        Text [ en-US ] = "~Into equal proportions";
-    };
-    ImageRadioButton RB_VERT
-    {
-        HelpID = "cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_VERT";
-        Pos = MAP_APPFONT ( 12 , 84 ) ;
-        Size = MAP_APPFONT ( 90 , 18 ) ;
-        Text [ en-US ] = "~Vertically" ;
-        RadioButtonImage = Image
-        {
-            ImageBitmap = Bitmap { File = "zetlver2.bmp" ; };
-        };
-        TabStop = TRUE ;
-    };
-    FixedLine FL_DIR
-    {
-        Pos = MAP_APPFONT ( 6 , 36 ) ;
-        Size = MAP_APPFONT ( 103 , 8 ) ;
-        Text [ en-US ] = "Direction" ;
-    };
-};
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index d1c1ba9..0cf0351 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -28,16 +28,10 @@
 
 class SvxSplitTableDlg : public SvxAbstractSplittTableDialog, public SvxStandardDialog
 {
-    FixedLine           maCountFL;
-    FixedText           maCountLbl;
-    NumericField        maCountEdit;
-    FixedLine           maDirFL;
-    ImageRadioButton    maHorzBox;
-    ImageRadioButton    maVertBox;
-    CheckBox            maPropCB;
-    OKButton            maOKBtn;
-    CancelButton        maCancelBtn;
-    HelpButton          maHelpBtn;
+    NumericField* m_pCountEdit;
+    RadioButton*  m_pHorzBox;
+    RadioButton*  m_pVertBox;
+    CheckBox*     m_pPropCB;
 
     long                mnMaxVertical;
     long                mnMaxHorizontal;
diff --git a/cui/uiconfig/ui/splitcellsdialog.ui b/cui/uiconfig/ui/splitcellsdialog.ui
new file mode 100644
index 0000000..cf08eae
--- /dev/null
+++ b/cui/uiconfig/ui/splitcellsdialog.ui
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">2</property>
+    <property name="upper">20</property>
+    <property name="value">2</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">5</property>
+  </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="pixbuf">svx/res/zetlhor2.png</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="pixbuf">svx/res/zetlver2.png</property>
+  </object>
+  <object class="GtkDialog" id="SplitCellsDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Split Cells</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="layout_style">start</property>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button3">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkFrame" id="frame1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkGrid" id="grid1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="column_spacing">12</property>
+                        <child>
+                          <object class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">_Split cell into</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkSpinButton" id="countnf">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">●</property>
+                            <property name="adjustment">adjustment1</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Split</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkGrid" id="grid2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="row_spacing">12</property>
+                        <child>
+                          <object class="GtkRadioButton" id="hori">
+                            <property name="label" translatable="yes">H_orizontally</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="image">image1</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">vert</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="vert">
+                            <property name="label" translatable="yes">_Vertically</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="image">image2</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">hori</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">2</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkAlignment" id="alignment3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkCheckButton" id="prop">
+                                <property name="label" translatable="yes">_Into equal proportions</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">1</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Direction</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">button1</action-widget>
+      <action-widget response="0">button2</action-widget>
+      <action-widget response="0">button3</action-widget>
+    </action-widgets>
+  </object>
+</interface>
commit 253e439c347fae54e6c4731d432eef842a889c9d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 19 17:14:21 2013 +0000

    implement custom images for radiobuttons via VclBuilder
    
    Change-Id: I17e1956d0ff50e027c83ee7dbb85e3316bb88bd3

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 96f5880..3bc9642 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -81,7 +81,20 @@ private:
     };
 
     typedef StringPair RadioButtonGroupMap;
-    typedef StringPair ButtonImageWidgetMap;
+
+    struct ButtonImageWidgetMap
+    {
+        OString m_sID;
+        OString m_sValue;
+        bool m_bRadio;
+        ButtonImageWidgetMap(const OString &rId, const OString &rValue, bool bRadio)
+            : m_sID(rId)
+            , m_sValue(rValue)
+            , m_bRadio(bRadio)
+        {
+        }
+    };
+
     typedef StringPair TextBufferMap;
     typedef StringPair WidgetAdjustmentMap;
     typedef StringPair ButtonMenuMap;
@@ -242,7 +255,7 @@ private:
     bool extractBuffer(const OString &id, stringmap &rVec);
     bool extractSpinAdjustment(const OString &id, stringmap &rVec);
     bool extractScrollAdjustment(const OString &id, stringmap &rVec);
-    bool extractImage(const OString &id, stringmap &rMap);
+    bool extractButtonImage(const OString &id, stringmap &rMap, bool bRadio);
     bool extractStock(const OString &id, stringmap &rMap);
 
     void handleTranslations(xmlreader::XmlReader &reader);
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 16190b4..d99c6cc 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -166,14 +166,15 @@ XubString Button::GetStandardHelpText( StandardButtonType /* eButton */ )
     XubString aHelpText;
     return aHelpText;
 }
+
 // -----------------------------------------------------------------------
 sal_Bool Button::SetModeImage( const Image& rImage )
 {
     if ( rImage != mpButtonData->maImage )
     {
         mpButtonData->maImage = rImage;
-
         StateChanged( STATE_CHANGE_DATA );
+        queue_resize();
     }
     return sal_True;
 }
@@ -2815,6 +2816,7 @@ sal_Bool RadioButton::SetModeRadioImage( const Image& rImage )
     {
         maImage = rImage;
         StateChanged( STATE_CHANGE_DATA );
+        queue_resize();
     }
     return sal_True;
 }
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 79a6204..a18d0b2 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -242,7 +242,21 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
     for (std::vector<ButtonImageWidgetMap>::iterator aI = m_pParserState->m_aButtonImageWidgetMaps.begin(),
          aEnd = m_pParserState->m_aButtonImageWidgetMaps.end(); aI != aEnd; ++aI)
     {
-        PushButton *pTarget = get<PushButton>(aI->m_sID);
+        PushButton *pTargetButton = NULL;
+        RadioButton *pTargetRadio = NULL;
+        Button *pTarget = NULL;
+
+        if (!aI->m_bRadio)
+        {
+            pTargetButton = get<PushButton>(aI->m_sID);
+            pTarget = pTargetButton;
+        }
+        else
+        {
+            pTargetRadio = get<RadioButton>(aI->m_sID);
+            pTarget = pTargetRadio;
+        }
+
         FixedImage *pImage = get<FixedImage>(aI->m_sValue);
         SAL_WARN_IF(!pTarget || !pImage,
             "vcl", "missing elements of button/image/stock");
@@ -252,7 +266,12 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
 
         VclBuilder::StockMap::iterator aFind = m_pParserState->m_aStockMap.find(aI->m_sValue);
         if (aFind == m_pParserState->m_aStockMap.end())
-            pTarget->SetModeImage(pImage->GetImage());
+        {
+            if (!aI->m_bRadio)
+                pTargetButton->SetModeImage(pImage->GetImage());
+            else
+                pTargetRadio->SetModeRadioImage(pImage->GetImage());
+        }
         else
         {
             const stockinfo &rImageInfo = aFind->second;
@@ -260,9 +279,18 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
             SAL_WARN_IF(eType == SYMBOL_NOSYMBOL, "vcl", "missing stock image element for button");
             if (eType == SYMBOL_NOSYMBOL)
                 continue;
-            pTarget->SetSymbol(eType);
+            if (!aI->m_bRadio)
+                pTargetButton->SetSymbol(eType);
+            else
+                SAL_WARN_IF(eType != SYMBOL_IMAGE, "vcl.layout", "inimplemented symbol type for radiobuttons");
             if (eType == SYMBOL_IMAGE)
-                pTarget->SetModeImage(Bitmap(VclResId(mapStockToImageResource(rImageInfo.m_sStock))));
+            {
+                Bitmap aBitmap(VclResId(mapStockToImageResource(rImageInfo.m_sStock)));
+                if (!aI->m_bRadio)
+                    pTargetButton->SetModeImage(aBitmap);
+                else
+                    pTargetRadio->SetModeRadioImage(aBitmap);
+            }
             switch (rImageInfo.m_nSize)
             {
                 case 1:
@@ -712,12 +740,12 @@ bool VclBuilder::extractStock(const OString &id, stringmap &rMap)
     return false;
 }
 
-bool VclBuilder::extractImage(const OString &id, stringmap &rMap)
+bool VclBuilder::extractButtonImage(const OString &id, stringmap &rMap, bool bRadio)
 {
     VclBuilder::stringmap::iterator aFind = rMap.find(OString("image"));
     if (aFind != rMap.end())
     {
-        m_pParserState->m_aButtonImageWidgetMaps.push_back(ButtonImageWidgetMap(id, aFind->second));
+        m_pParserState->m_aButtonImageWidgetMaps.push_back(ButtonImageWidgetMap(id, aFind->second, bRadio));
         rMap.erase(aFind);
         return true;
     }
@@ -841,7 +869,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
         pWindow = new VclAlignment(pParent);
     else if (name == "GtkButton")
     {
-        extractImage(id, rMap);
+        extractButtonImage(id, rMap, false);
         OString sMenu = extractCustomProperty(rMap);
         if (sMenu.isEmpty())
             pWindow = extractStockAndBuildPushButton(pParent, rMap);
@@ -854,6 +882,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
     else if (name == "GtkRadioButton")
     {
         extractGroup(id, rMap);
+        extractButtonImage(id, rMap, true);
         pWindow = new RadioButton(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
     }
     else if (name == "GtkCheckButton")


More information about the Libreoffice-commits mailing list