[Libreoffice-commits] .: 2 commits - sw/inc sw/source sw/uiconfig sw/UI_swriter.mk vcl/inc vcl/source

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


 sw/UI_swriter.mk                           |    1 
 sw/inc/globals.hrc                         |    3 
 sw/inc/helpid.h                            |    4 
 sw/source/ui/inc/outline.hxx               |    5 
 sw/source/ui/misc/outline.cxx              |  124 +++++++--------
 sw/source/ui/misc/outline.hrc              |   14 -
 sw/source/ui/misc/outline.src              |  101 ------------
 sw/uiconfig/swriter/ui/outlinenumbering.ui |  238 +++++++++++++++++++++++++++++
 vcl/inc/vcl/builder.hxx                    |   20 ++
 vcl/source/window/builder.cxx              |    4 
 10 files changed, 323 insertions(+), 191 deletions(-)

New commits:
commit 55786395b56e365cb0d6663f4d375b37aaf79228
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 19 12:08:26 2013 +0000

    convert outline numbering tabdialog to .ui
    
    Change-Id: I233c43132fe82f65f2f2dda9fc1afee0237610bd

diff --git a/sw/UI_swriter.mk b/sw/UI_swriter.mk
index f3a3735..a35b38f 100644
--- a/sw/UI_swriter.mk
+++ b/sw/UI_swriter.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_UI_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/insertscript \
 	sw/uiconfig/swriter/ui/inserttable \
 	sw/uiconfig/swriter/ui/linenumbering \
+	sw/uiconfig/swriter/ui/outlinenumbering \
 	sw/uiconfig/swriter/ui/outlinenumberingpage \
 	sw/uiconfig/swriter/ui/outlinepositionpage \
 	sw/uiconfig/swriter/ui/printoptionspage \
diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc
index 5e1a49c..e70f6e4 100644
--- a/sw/inc/globals.hrc
+++ b/sw/inc/globals.hrc
@@ -178,13 +178,10 @@
 #define TP_FLD_REF                  (RC_GLOBALS_BEGIN +  69)
 
 #define TP_OPTSHDWCRSR              (RC_GLOBALS_BEGIN +  70)
-#define TP_NUM_POSITION             (RC_GLOBALS_BEGIN +  72)
 #define TP_NUMPARA                  (RC_GLOBALS_BEGIN +  73)
 
 #define TP_REDLINE_OPT              (RC_GLOBALS_BEGIN +  74)
 
-#define TP_OUTLINE_NUM              (RC_GLOBALS_BEGIN +  76)
-
 #define TP_OPTCAPTION_PAGE          (RC_GLOBALS_BEGIN +  78)
 #define DLG_SVXTEST_NUM_BULLET      (RC_GLOBALS_BEGIN +  79)
 #define TP_OPTLOAD_PAGE             (RC_GLOBALS_BEGIN +  80)
diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h
index ad87626..a09ad84 100644
--- a/sw/inc/helpid.h
+++ b/sw/inc/helpid.h
@@ -114,9 +114,6 @@
 #define HID_GLBLTREE_UPD_IDX                                    "SW_HID_GLBLTREE_UPD_IDX"
 #define HID_GLBLTREE_UPD_LINK                                   "SW_HID_GLBLTREE_UPD_LINK"
 #define HID_GLBLTREEUPD_ALL                                     "SW_HID_GLBLTREEUPD_ALL"
-#define HID_NUM_OUTL_NAMED_NUMS                                 "SW_HID_NUM_OUTL_NAMED_NUMS"
-#define HID_NUM_OUTL_NUM_SAVEAS                                 "SW_HID_NUM_OUTL_NUM_SAVEAS"
-#define HID_NUM_NAMED_NUMS                                      "SW_HID_NUM_NAMED_NUMS"
 #define HID_NAVI_CONTENT                                        "SW_HID_NAVI_CONTENT"
 #define HID_NAVI_GLOBAL                                         "SW_HID_NAVI_GLOBAL"
 #define HID_LTEMPL_NUMBERING                                    "SW_HID_LTEMPL_NUMBERING"
@@ -355,7 +352,6 @@
 #define HID_SELECT_TEMPLATE                                     "SW_HID_SELECT_TEMPLATE"
 
 #define HID_AP_INSERT_DB_SEL                                    "SW_HID_AP_INSERT_DB_SEL"
-#define HID_OUTLINE_FORM                                        "SW_HID_OUTLINE_FORM"
 #define HID_NUM_RESET                                           "SW_HID_NUM_RESET"
 
 #define HID_AUTOFORMAT_REJECT                                   "SW_HID_AUTOFORMAT_REJECT"
diff --git a/sw/source/ui/inc/outline.hxx b/sw/source/ui/inc/outline.hxx
index 8ffadb3..0e2fa18 100644
--- a/sw/source/ui/inc/outline.hxx
+++ b/sw/source/ui/inc/outline.hxx
@@ -47,9 +47,10 @@ class SwOutlineTabDialog : public SfxTabDialog
 {
     static     sal_uInt16    nNumLevel;
 
-    String              aNullStr;
+    sal_uInt16 m_nNumPosId;
+    sal_uInt16 m_nOutlineId;
+
     String              aCollNames[MAXLEVEL];
-    PopupMenu           aFormMenu;
 
     SwWrtShell&         rWrtSh;
     SwNumRule*          pNumRule;
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index b146b97..5a4d9e3 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -160,31 +160,23 @@ static sal_uInt16 lcl_BitToLevel(sal_uInt16 nActLevel)
 }
 
 sal_uInt16 SwOutlineTabDialog::nNumLevel = 1;
-SwOutlineTabDialog::SwOutlineTabDialog(Window* pParent,
-                    const SfxItemSet* pSwItemSet,
-                    SwWrtShell &rSh) :
-                                    // the UserString is set correctly afterwards
-        SfxTabDialog(pParent, SW_RES(DLG_TAB_OUTLINE), pSwItemSet, sal_False, &aEmptyStr),
-        aNullStr(rtl::OUString("____")),
-        aFormMenu(SW_RES(MN_FORM)),
-        rWrtSh(rSh),
-        pChapterNumRules(SW_MOD()->GetChapterNumRules()),
-        bModified(rWrtSh.IsModified())
+SwOutlineTabDialog::SwOutlineTabDialog(Window* pParent, const SfxItemSet* pSwItemSet,
+    SwWrtShell &rSh)
+    : SfxTabDialog(pParent, "OutlineNumberingDialog",
+        "modules/swriter/ui/outlinenumbering.ui", pSwItemSet)
+    , rWrtSh(rSh)
+    , pChapterNumRules(SW_MOD()->GetChapterNumRules())
+    , bModified(rWrtSh.IsModified())
 {
-    // --> OD 2008-04-14 #outlinelevel#
-    SetText( SW_RES( STR_OUTLINE_NUMBERING ) );
     PushButton* pUserButton = GetUserButton();
-    pUserButton->SetText(SW_RES(ST_FORM));
-    pUserButton->SetHelpId(HID_OUTLINE_FORM);
     pUserButton->SetClickHdl(LINK(this, SwOutlineTabDialog, FormHdl));
     pUserButton->SetAccessibleRole( com::sun::star::accessibility::AccessibleRole::BUTTON_MENU );
 
-    FreeResource();
     pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() );
     GetCancelButton().SetClickHdl(LINK(this, SwOutlineTabDialog, CancelHdl));
 
-    AddTabPage(TP_NUM_POSITION   , &SwNumPositionTabPage::Create, 0);
-    AddTabPage(TP_OUTLINE_NUM    , &SwOutlineSettingsTabPage::Create, 0);
+    m_nNumPosId = AddTabPage("position", &SwNumPositionTabPage::Create, 0);
+    m_nOutlineId = AddTabPage("numbering", &SwOutlineSettingsTabPage::Create, 0);
 
     String sHeadline;
     sal_uInt16 i;
@@ -221,17 +213,16 @@ SwOutlineTabDialog::~SwOutlineTabDialog()
     delete pNumRule;
 }
 
-void    SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
+void SwOutlineTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
 {
-    switch ( nPageId )
+    if (nPageId == m_nNumPosId)
+    {
+        ((SwNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
+        ((SwNumPositionTabPage&)rPage).SetOutlineTabDialog(this);
+    }
+    else if (nPageId == m_nOutlineId)
     {
-        case TP_NUM_POSITION:
-                ((SwNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
-                ((SwNumPositionTabPage&)rPage).SetOutlineTabDialog(this);
-        break;
-        case TP_OUTLINE_NUM:
-                ((SwOutlineSettingsTabPage&)rPage).SetWrtShell(&rWrtSh);
-        break;
+        ((SwOutlineSettingsTabPage&)rPage).SetWrtShell(&rWrtSh);
     }
 }
 
@@ -245,60 +236,67 @@ IMPL_LINK_NOARG(SwOutlineTabDialog, CancelHdl)
 
 IMPL_LINK( SwOutlineTabDialog, FormHdl, Button *, pBtn )
 {
+    PopupMenu *pFormMenu = get_menu("form");
     // fill PopupMenu
     for( sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i )
     {
         const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
         if( pRules )
-            aFormMenu.SetItemText(i + MN_FORMBASE, pRules->GetName());
+            pFormMenu->SetItemText(pFormMenu->GetItemId(i), pRules->GetName());
     }
-    aFormMenu.SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl));
-    aFormMenu.Execute(pBtn, Rectangle(Point(0,0), pBtn->GetSizePixel()), POPUPMENU_EXECUTE_DOWN);
+    pFormMenu->SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl));
+    pFormMenu->Execute(pBtn, Rectangle(Point(0,0), pBtn->GetSizePixel()), POPUPMENU_EXECUTE_DOWN);
     return 0;
 }
 
 IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu )
 {
     sal_uInt8 nLevelNo = 0;
-    switch(pMenu->GetCurItemId())
+    OString sIdent = pMenu->GetCurItemIdent();
+
+    if (sIdent == "form1")
+        nLevelNo = 1;
+    else if (sIdent == "form2")
+        nLevelNo = 2;
+    else if (sIdent == "form3")
+        nLevelNo = 3;
+    else if (sIdent == "form4")
+        nLevelNo = 4;
+    else if (sIdent == "form5")
+        nLevelNo = 5;
+    else if (sIdent == "form6")
+        nLevelNo = 6;
+    else if (sIdent == "form7")
+        nLevelNo = 7;
+    else if (sIdent == "form8")
+        nLevelNo = 8;
+    else if (sIdent == "form9")
+        nLevelNo = 9;
+    else if (sIdent == "saveas")
     {
-        case MN_FORM1: nLevelNo = 1;    break;
-        case MN_FORM2: nLevelNo = 2;    break;
-        case MN_FORM3: nLevelNo = 3;    break;
-        case MN_FORM4: nLevelNo = 4;    break;
-        case MN_FORM5: nLevelNo = 5;    break;
-        case MN_FORM6: nLevelNo = 6;    break;
-        case MN_FORM7: nLevelNo = 7;    break;
-        case MN_FORM8: nLevelNo = 8;    break;
-        case MN_FORM9: nLevelNo = 9;    break;
-
-        case MN_SAVE:
+        SwNumNamesDlg *pDlg = new SwNumNamesDlg(this);
+        const String *aStrArr[SwChapterNumRules::nMaxRules];
+        for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i)
         {
-            SwNumNamesDlg *pDlg = new SwNumNamesDlg(this);
-            const String *aStrArr[SwChapterNumRules::nMaxRules];
-            for(sal_uInt16 i = 0; i < SwChapterNumRules::nMaxRules; ++i)
-            {
-                const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
-                if(pRules)
-                    aStrArr[i] = &pRules->GetName();
-                else
-                    aStrArr[i] = 0;
-            }
-            pDlg->SetUserNames(aStrArr);
-            if(RET_OK == pDlg->Execute())
-            {
-                const String aName(pDlg->GetName());
-                pChapterNumRules->ApplyNumRules( SwNumRulesWithName(
-                        *pNumRule, aName ), pDlg->GetCurEntryPos() );
-                pMenu->SetItemText(
-                        pDlg->GetCurEntryPos() + MN_FORMBASE, aName);
-            }
-            delete pDlg;
-            return 0;
-
+            const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
+            if(pRules)
+                aStrArr[i] = &pRules->GetName();
+            else
+                aStrArr[i] = 0;
         }
+        pDlg->SetUserNames(aStrArr);
+        if(RET_OK == pDlg->Execute())
+        {
+            const String aName(pDlg->GetName());
+            pChapterNumRules->ApplyNumRules( SwNumRulesWithName(
+                    *pNumRule, aName ), pDlg->GetCurEntryPos() );
+            pMenu->SetItemText(pMenu->GetItemId(pDlg->GetCurEntryPos()), aName);
+        }
+        delete pDlg;
+        return 0;
 
     }
+
     if( nLevelNo-- )
     {
         const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo );
diff --git a/sw/source/ui/misc/outline.hrc b/sw/source/ui/misc/outline.hrc
index 3c9375b..0603ded 100644
--- a/sw/source/ui/misc/outline.hrc
+++ b/sw/source/ui/misc/outline.hrc
@@ -42,17 +42,3 @@
 #define ED_FORM         107
 #define FT_ALL_LEVEL    108
 #define NF_ALL_LEVEL    109
-
-#define MN_FORM     110
-#define MN_FORM1        111
-#define MN_FORMBASE     MN_FORM1
-#define MN_FORM2        112
-#define MN_FORM3        113
-#define MN_FORM4        114
-#define MN_FORM5        115
-#define MN_FORM6        116
-#define MN_FORM7        117
-#define MN_FORM8        118
-#define MN_FORM9        119
-#define MN_SAVE         120
-#define ST_FORM         121
diff --git a/sw/source/ui/misc/outline.src b/sw/source/ui/misc/outline.src
index 43e756c..184b0f0 100644
--- a/sw/source/ui/misc/outline.src
+++ b/sw/source/ui/misc/outline.src
@@ -85,104 +85,3 @@ ModalDialog DLG_NUM_NAMES
         Left = TRUE ;
     };
 };
-
-TabDialog DLG_TAB_OUTLINE
-{
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    // --> OD 2008-04-14 #outlinelevel#
-    // dialog title is now given by resource STR_OUTLINE_NUMBERING
-//    Text [ en-US ] = "Outline Numbering" ;
-    Moveable = TRUE ;
-    TabControl 1
-    {
-        SVLook = TRUE ;
-        PageList =
-        {
-            PageItem
-            {
-                Identifier = TP_OUTLINE_NUM ;
-                Text [ en-US ] = "Numbering" ;
-            };
-            PageItem
-            {
-                Identifier = TP_NUM_POSITION ;
-                Text [ en-US ] = "Position" ;
-            };
-        };
-    };
-    String ST_FORM
-    {
-        Text [ en-US ] = "~Format" ;
-    };
-    Menu MN_FORM
-    {
-        ItemList =
-        {
-            MenuItem
-            {
-                Identifier = MN_FORM1 ;
-                Text [ en-US ] = "Untitled 1" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM2 ;
-                Text [ en-US ] = "Untitled 2" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM3 ;
-                Text [ en-US ] = "Untitled 3" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM4 ;
-                Text [ en-US ] = "Untitled 4" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM5 ;
-                Text [ en-US ] = "Untitled 5" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM6 ;
-                Text [ en-US ] = "Untitled 6" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM7 ;
-                Text [ en-US ] = "Untitled 7" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM8 ;
-                Text [ en-US ] = "Untitled 8" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Identifier = MN_FORM9 ;
-                Text [ en-US ] = "Untitled 9" ;
-                HelpID = HID_NUM_OUTL_NAMED_NUMS ;
-            };
-            MenuItem
-            {
-                Separator = TRUE ;
-            };
-            MenuItem
-            {
-                Identifier = MN_SAVE ;
-                Text [ en-US ] = "Save ~As...";
-                HelpID = HID_NUM_OUTL_NUM_SAVEAS ;
-            };
-        };
-    };
-};
diff --git a/sw/uiconfig/swriter/ui/outlinenumbering.ui b/sw/uiconfig/swriter/ui/outlinenumbering.ui
new file mode 100644
index 0000000..ea48a3c
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/outlinenumbering.ui
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="OutlineNumberingDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Character</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="orientation">vertical</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="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <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="user">
+                <property name="label" translatable="yes">_Format</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">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="cancel">
+                <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">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <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">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="reset">
+                <property name="label">gtk-revert-to-saved</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">4</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="GtkNotebook" id="tabcontrol">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="numbering">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Numbering</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="position">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Position</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">user</action-widget>
+      <action-widget response="0">cancel</action-widget>
+      <action-widget response="0">help</action-widget>
+      <action-widget response="0">reset</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkMenu" id="form">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="form1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 1</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 2</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form3">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 3</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form4">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 4</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form5">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 5</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form6">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 6</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form7">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 7</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form8">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 8</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="form9">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Untitled 9</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem10">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="saveas">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Save _As...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+</interface>
commit b12a629ca43673b1e7dd440f36cb493a833293ee
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 19 13:23:57 2013 +0000

    allow access to menus via VclBuilder
    
    Change-Id: I02c1d46f5c111a2256b2f90837097666dfc49edc

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 0942667..96f5880 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -179,8 +179,6 @@ private:
     Window *get_by_name(OString sID);
     void delete_by_name(OString sID);
 
-    PopupMenu *get_menu_by_name(OString sID);
-
     class sortIntoBestTabTraversalOrder
         : public std::binary_function<const Window*, const Window*, bool>
     {
@@ -207,6 +205,13 @@ public:
         ret = static_cast<T*>(w);
         return ret;
     }
+    PopupMenu* get_menu(PopupMenu*& ret, OString sID)
+    {
+        ret = get_menu(sID);
+        SAL_WARN_IF(!ret, "vcl.layout", "menu \"" << sID.getStr() << "\" not found in .ui");
+        assert(ret);
+        return ret;
+    }
     //sID may not exist, but must be of type T if it does
     template <typename T /*=Window if we had c++11*/> T* get(OString sID)
     {
@@ -216,6 +221,9 @@ public:
         assert(!w || dynamic_cast<T*>(w));
         return static_cast<T*>(w);
     }
+    //sID may not exist
+    PopupMenu* get_menu(OString sID);
+
     OString get_by_window(const Window *pWindow) const;
     void delete_by_window(const Window *pWindow);
 
@@ -300,6 +308,14 @@ public:
     {
         return m_pUIBuilder->get<T>(sID);
     }
+    PopupMenu* get_menu(PopupMenu*& ret, OString sID)
+    {
+        return m_pUIBuilder->get_menu(ret, sID);
+    }
+    PopupMenu* get_menu(OString sID)
+    {
+        return m_pUIBuilder->get_menu(sID);
+    }
 };
 
 /*
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 08f2115..79a6204 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -290,7 +290,7 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
          aEnd = m_pParserState->m_aButtonMenuMaps.end(); aI != aEnd; ++aI)
     {
         MenuButton *pTarget = get<MenuButton>(aI->m_sID);
-        PopupMenu *pMenu = get_menu_by_name(aI->m_sValue);
+        PopupMenu *pMenu = get_menu(aI->m_sValue);
         SAL_WARN_IF(!pTarget || !pMenu,
             "vcl", "missing elements of button/menu");
         if (!pTarget || !pMenu)
@@ -2148,7 +2148,7 @@ Window *VclBuilder::get_by_name(OString sID)
     return NULL;
 }
 
-PopupMenu *VclBuilder::get_menu_by_name(OString sID)
+PopupMenu *VclBuilder::get_menu(OString sID)
 {
     for (std::vector<MenuAndId>::iterator aI = m_aMenus.begin(),
          aEnd = m_aMenus.end(); aI != aEnd; ++aI)


More information about the Libreoffice-commits mailing list