[Libreoffice-commits] core.git: sw/inc sw/source sw/uiconfig sw/UIConfig_swriter.mk

sk94 eszkadev at gmail.com
Mon Jun 16 03:04:12 PDT 2014


 sw/UIConfig_swriter.mk                      |    1 
 sw/inc/dbui.hrc                             |    5 
 sw/source/ui/dbui/selectdbtabledialog.cxx   |   82 ++++++--------
 sw/source/ui/dbui/selectdbtabledialog.hrc   |   36 ------
 sw/source/ui/dbui/selectdbtabledialog.hxx   |   15 --
 sw/source/ui/dbui/selectdbtabledialog.src   |   78 ++-----------
 sw/uiconfig/swriter/ui/selecttabledialog.ui |  163 ++++++++++++++++++++++++++++
 7 files changed, 227 insertions(+), 153 deletions(-)

New commits:
commit 6154e810836a7a4bc7f417cbe16d7c84584d49e9
Author: sk94 <eszkadev at gmail.com>
Date:   Fri Jun 13 20:20:54 2014 +0200

    DLG_MM_SELECTDBTABLEDDIALOG conversion to .ui
    
    Change-Id: Iaaa32bd5723ae45099d0fb670b207fc64c46d306
    Reviewed-on: https://gerrit.libreoffice.org/9780
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index f9763e1..f2b9eb1 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -193,6 +193,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/selectautotextdialog \
 	sw/uiconfig/swriter/ui/selectblockdialog \
 	sw/uiconfig/swriter/ui/selectindexdialog \
+	sw/uiconfig/swriter/ui/selecttabledialog \
 	sw/uiconfig/swriter/ui/sidebarpage \
 	sw/uiconfig/swriter/ui/sidebarwrap \
 	sw/uiconfig/swriter/ui/sortdialog \
diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc
index f22bb76..0e370e7 100644
--- a/sw/inc/dbui.hrc
+++ b/sw/inc/dbui.hrc
@@ -25,7 +25,6 @@
 // Dialoge --------------------------------------------------------------------
 
 #define DLG_MAILMERGEWIZARD         (RC_DBUI_BEGIN + 3)
-#define DLG_MM_SELECTDBTABLEDDIALOG (RC_DBUI_BEGIN + 12)
 #define DLG_MM_DBTABLEPREVIEWDIALOG (RC_DBUI_BEGIN + 13)
 
 #define DLG_MM_MAILBODY               (RC_DBUI_BEGIN + 24)
@@ -65,6 +64,10 @@
 #define ST_NOSUBJECT            (RC_DBUI_BEGIN + 31)
 #define ST_CONFIGUREMAIL        (RC_DBUI_BEGIN + 32)
 #define ST_FILTERNAME           (RC_DBUI_BEGIN + 33)
+#define ST_TYPE                 (RC_DBUI_BEGIN + 34)
+#define ST_NAME                 (RC_DBUI_BEGIN + 35)
+#define ST_TABLE                (RC_DBUI_BEGIN + 36)
+#define ST_QUERY                (RC_DBUI_BEGIN + 37)
 
 // Elements -----------------------------------------------------------------
 #define MM_PART_TITLE                   0
diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx
index 113aecf..1d6fb3f 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.cxx
+++ b/sw/source/ui/dbui/selectdbtabledialog.cxx
@@ -30,7 +30,6 @@
 
 #include <unomid.h>
 
-#include <selectdbtabledialog.hrc>
 #include <dbui.hrc>
 #include <helpid.h>
 #include <boost/scoped_ptr.hpp>
@@ -45,54 +44,51 @@ using namespace ::com::sun::star::beans;
 
 SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent,
         const uno::Reference< sdbc::XConnection>& rConnection) :
-    SfxModalDialog(pParent, SW_RES(DLG_MM_SELECTDBTABLEDDIALOG)),
-    m_aSelectFI( this, SW_RES(       FI_SELECT     )),
-    m_aTableHB( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
-    m_aTableLB( this, SW_RES(        LB_TABLE      )),
-    m_aPreviewPB( this, SW_RES(      PB_PREVIEW    )),
-    m_aSeparatorFL(this, SW_RES(    FL_SEPARATOR      )),
-    m_aOK( this, SW_RES(             PB_OK         )),
-    m_aCancel( this, SW_RES(         PB_CANCEL     )),
-    m_aHelp( this, SW_RES(           PB_HELP       )),
+    SfxModalDialog(pParent, "SelectTableDialog", "modules/swriter/ui/selecttabledialog.ui"),
     m_sName( SW_RES( ST_NAME )),
     m_sType( SW_RES( ST_TYPE )),
     m_sTable( SW_RES( ST_TABLE )),
     m_sQuery( SW_RES( ST_QUERY )),
     m_xConnection(rConnection)
 {
-    FreeResource();
-
-    Size aLBSize(m_aTableLB.GetSizePixel());
-    m_aTableHB.SetSizePixel(aLBSize);
-    Size aHeadSize(m_aTableHB.CalcWindowSizePixel());
+    get(m_pPreviewPB, "preview");
+    get(m_pContainer, "table");
+    m_pTableHB = new HeaderBar(m_pContainer, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
+    m_pTableHB->set_height_request(40);
+    m_pTableLB = new SvTabListBox(m_pContainer, WB_BORDER);
+
+    Size aLBSize(Size(400, 100));
+    m_pContainer->SetSizePixel(aLBSize);
+    Size aHeadSize(m_pTableHB->CalcWindowSizePixel());
     aHeadSize.Width() = aLBSize.Width();
-    m_aTableHB.SetSizePixel(aHeadSize);
-    Point aLBPos(m_aTableLB.GetPosPixel());
-    m_aTableHB.SetPosPixel(aLBPos);
+    m_pTableHB->SetSizePixel(aHeadSize);
+    Point aLBPos(0, 0);
+    m_pTableHB->SetPosPixel(aLBPos);
     aLBPos.Y() += aHeadSize.Height();
     aLBSize.Height() -= aHeadSize.Height();
-    m_aTableLB.SetPosSizePixel(aLBPos, aLBSize);
+    m_pTableLB->SetPosSizePixel(aLBPos, aLBSize);
 
-    Size aSz(m_aTableHB.GetOutputSizePixel());
-    m_aTableHB.InsertItem( 1, m_sName,
+    Size aSz(m_pTableHB->GetOutputSizePixel());
+    m_pTableHB->InsertItem( 1, m_sName,
                             aSz.Width()/2,
                             HIB_LEFT | HIB_VCENTER /*| HIB_CLICKABLE | HIB_UPARROW */);
-    m_aTableHB.InsertItem( 2, m_sType,
+    m_pTableHB->InsertItem( 2, m_sType,
                             aSz.Width()/2,
                             HIB_LEFT | HIB_VCENTER /*| HIB_CLICKABLE | HIB_UPARROW */);
-    m_aTableHB.SetHelpId(HID_MM_ADDRESSLIST_HB );
-    m_aTableHB.Show();
+    m_pTableHB->SetHelpId(HID_MM_ADDRESSLIST_HB );
+    m_pTableHB->Show();
+    m_pTableLB->Show();
 
     static long nTabs[] = {3, 0, aSz.Width()/2, aSz.Width() };
-    m_aTableLB.SetTabs(&nTabs[0], MAP_PIXEL);
-    m_aTableLB.SetHelpId(HID_MM_SELECTDBTABLEDDIALOG_LISTBOX);
-    m_aTableLB.SetStyle( m_aTableLB.GetStyle() | WB_CLIPCHILDREN );
-    m_aTableLB.SetSpaceBetweenEntries(3);
-    m_aTableLB.SetSelectionMode( SINGLE_SELECTION );
-    m_aTableLB.SetDragDropMode( 0 );
-    m_aTableLB.EnableAsyncDrag(false);
+    m_pTableLB->SetTabs(&nTabs[0], MAP_PIXEL);
+    m_pTableLB->SetHelpId(HID_MM_SELECTDBTABLEDDIALOG_LISTBOX);
+    m_pTableLB->SetStyle( m_pTableLB->GetStyle() | WB_CLIPCHILDREN );
+    m_pTableLB->SetSpaceBetweenEntries(3);
+    m_pTableLB->SetSelectionMode( SINGLE_SELECTION );
+    m_pTableLB->SetDragDropMode( 0 );
+    m_pTableLB->EnableAsyncDrag(false);
 
-    m_aPreviewPB.SetClickHdl(LINK(this, SwSelectDBTableDialog, PreviewHdl));
+    m_pPreviewPB->SetClickHdl(LINK(this, SwSelectDBTableDialog, PreviewHdl));
 
     Reference<XTablesSupplier> xTSupplier(m_xConnection, UNO_QUERY);
     if(xTSupplier.is())
@@ -105,7 +101,7 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent,
             OUString sEntry = pTbls[i];
             sEntry += "\t";
             sEntry += m_sTable;
-            SvTreeListEntry* pEntry = m_aTableLB.InsertEntry(sEntry);
+            SvTreeListEntry* pEntry = m_pTableLB->InsertEntry(sEntry);
             pEntry->SetUserData((void*)0);
         }
     }
@@ -120,7 +116,7 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent,
             OUString sEntry = pQueries[i];
             sEntry += "\t";
             sEntry += m_sQuery;
-            SvTreeListEntry* pEntry = m_aTableLB.InsertEntry(sEntry);
+            SvTreeListEntry* pEntry = m_pTableLB->InsertEntry(sEntry);
             pEntry->SetUserData((void*)1);
         }
     }
@@ -128,14 +124,16 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent,
 
 SwSelectDBTableDialog::~SwSelectDBTableDialog()
 {
+    delete m_pTableHB;
+    delete m_pTableLB;
 }
 
 IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton)
 {
-    SvTreeListEntry* pEntry = m_aTableLB.FirstSelected();
+    SvTreeListEntry* pEntry = m_pTableLB->FirstSelected();
     if(pEntry)
     {
-        OUString sTableOrQuery = m_aTableLB.GetEntryText(pEntry, 0);
+        OUString sTableOrQuery = m_pTableLB->GetEntryText(pEntry, 0);
         sal_Int32 nCommandType = 0 == pEntry->GetUserData() ? 0 : 1;
 
         OUString sDataSourceName;
@@ -169,23 +167,23 @@ IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton)
 
 OUString    SwSelectDBTableDialog::GetSelectedTable(bool& bIsTable)
 {
-    SvTreeListEntry* pEntry = m_aTableLB.FirstSelected();
+    SvTreeListEntry* pEntry = m_pTableLB->FirstSelected();
     bIsTable = pEntry->GetUserData() ? false : true;
-    return m_aTableLB.GetEntryText(pEntry, 0);
+    return m_pTableLB->GetEntryText(pEntry, 0);
 }
 
 void   SwSelectDBTableDialog::SetSelectedTable(const OUString& rTable, bool bIsTable)
 {
-    SvTreeListEntry*    pEntry = m_aTableLB.First();
+    SvTreeListEntry*    pEntry = m_pTableLB->First();
     while(pEntry)
     {
-        if((m_aTableLB.GetEntryText(pEntry, 0) == rTable) &&
+        if((m_pTableLB->GetEntryText(pEntry, 0) == rTable) &&
                  ((pEntry->GetUserData() == 0 ) == bIsTable))
         {
-            m_aTableLB.Select(pEntry);
+            m_pTableLB->Select(pEntry);
             break;
         }
-        pEntry = m_aTableLB.Next( pEntry );
+        pEntry = m_pTableLB->Next( pEntry );
     }
 }
 
diff --git a/sw/source/ui/dbui/selectdbtabledialog.hrc b/sw/source/ui/dbui/selectdbtabledialog.hrc
deleted file mode 100644
index 884ad64..0000000
--- a/sw/source/ui/dbui/selectdbtabledialog.hrc
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-#ifndef _SELECTDBTABLEDIALOG_HRC
-#define _SELECTDBTABLEDIALOG_HRC
-
-#define FI_SELECT           1
-#define LB_TABLE            2
-#define PB_PREVIEW          3
-#define PB_OK               4
-#define PB_CANCEL           5
-#define PB_HELP             6
-#define FL_SEPARATOR        7
-#define ST_TYPE             8
-#define ST_NAME             9
-#define ST_TABLE            10
-#define ST_QUERY            11
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/selectdbtabledialog.hxx b/sw/source/ui/dbui/selectdbtabledialog.hxx
index 9d721a8..d310769 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.hxx
+++ b/sw/source/ui/dbui/selectdbtabledialog.hxx
@@ -23,6 +23,7 @@
 
 #include <vcl/button.hxx>
 #include <vcl/fixed.hxx>
+#include <vcl/layout.hxx>
 #include <svtools/svtabbx.hxx>
 #include <svtools/headbar.hxx>
 namespace com{namespace sun{namespace star{
@@ -33,16 +34,10 @@ namespace com{namespace sun{namespace star{
 
 class SwSelectDBTableDialog : public SfxModalDialog
 {
-    FixedText       m_aSelectFI;
-    HeaderBar       m_aTableHB;
-    SvTabListBox    m_aTableLB;
-    PushButton      m_aPreviewPB;
-
-    FixedLine       m_aSeparatorFL;
-
-    OKButton        m_aOK;
-    CancelButton    m_aCancel;
-    HelpButton      m_aHelp;
+    HeaderBar       *m_pTableHB;
+    SvTabListBox    *m_pTableLB;
+    PushButton      *m_pPreviewPB;
+    Window          *m_pContainer;
 
     OUString        m_sName;
     OUString        m_sType;
diff --git a/sw/source/ui/dbui/selectdbtabledialog.src b/sw/source/ui/dbui/selectdbtabledialog.src
index ed8f50a..a5c7e40 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.src
+++ b/sw/source/ui/dbui/selectdbtabledialog.src
@@ -17,77 +17,27 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <selectdbtabledialog.hrc>
 #include <dbui.hrc>
 #include <helpid.h>
 
-ModalDialog DLG_MM_SELECTDBTABLEDDIALOG
+String ST_NAME
 {
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    HelpID = HID_MM_SELECTDBTABLEDDIALOG;
-    Size = MAP_APPFONT ( 250 , 135 ) ;
-    Moveable = TRUE ;
+    Text [ en-US ] = "Name";
+};
 
-    Text [ en-US ] = "Select Table";
+String ST_TYPE
+{
+    Text [ en-US ] = "Type";
+};
 
-    FixedText       FI_SELECT
-    {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 238 , 24 ) ;
-        WordBreak = TRUE;
-        Text [ en-US ] = "The file you have selected contains more than one table. Please select the table containing the address list you want to use.";
-    };
-    Control LB_TABLE
-    {
-        Pos = MAP_APPFONT ( 6 , 30 ) ;
-        Size = MAP_APPFONT ( 238 , 50 ) ;
-        Border = TRUE;
-    };
-    PushButton      PB_PREVIEW
-    {
-        HelpID = "sw:PushButton:DLG_MM_SELECTDBTABLEDDIALOG:PB_PREVIEW";
-        Pos = MAP_APPFONT ( 6 , 84 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        Text [ en-US ] = "~Preview";
-    };
-    FixedLine FL_SEPARATOR
-    {
-        Pos = MAP_APPFONT ( 6 , 104 ) ;
-        Size = MAP_APPFONT ( 238 , 8 ) ;
-    };
-    OKButton        PB_OK
-    {
-        Pos = MAP_APPFONT ( 85 , 115 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-    CancelButton    PB_CANCEL
-    {
-        Pos = MAP_APPFONT ( 138 , 115 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-    HelpButton      PB_HELP
-    {
-        Pos = MAP_APPFONT ( 194 , 115 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-    String ST_NAME
-    {
-        Text [ en-US ] = "Name";
-    };
-    String ST_TYPE
-    {
-        Text [ en-US ] = "Type";
-    };
-    String ST_TABLE
-    {
-        Text [ en-US ] = "Table";
-    };
-    String ST_QUERY
-    {
-        Text [ en-US ] = "Query";
-    };
+String ST_TABLE
+{
+    Text [ en-US ] = "Table";
+};
 
+String ST_QUERY
+{
+    Text [ en-US ] = "Query";
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/uiconfig/swriter/ui/selecttabledialog.ui b/sw/uiconfig/swriter/ui/selecttabledialog.ui
new file mode 100644
index 0000000..1095980
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/selecttabledialog.ui
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+  <requires lib="gtk+" version="3.0"/>
+  <object class="GtkDialog" id="SelectTableDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Select Table</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">12</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="use_action_appearance">False</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="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="use_action_appearance">False</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="help">
+                <property name="label">gtk-help</property>
+                <property name="use_action_appearance">False</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="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="select">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">The file you have selected contains more than one table. Please select the table containing the address list you want to use.</property>
+                <property name="use_underline">True</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">70</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="table">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButtonBox" id="buttonbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="orientation">vertical</property>
+                <property name="layout_style">start</property>
+                <child>
+                  <object class="GtkButton" id="preview">
+                    <property name="label" translatable="yes">_Preview</property>
+                    <property name="use_action_appearance">False</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">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</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">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+      <action-widget response="0">help</action-widget>
+    </action-widgets>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list