diff options
author | sk94 <eszkadev@gmail.com> | 2014-06-13 20:20:54 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-16 10:03:50 +0000 |
commit | 6154e810836a7a4bc7f417cbe16d7c84584d49e9 (patch) | |
tree | 8595d96c2baf8bee42d2cc19569cef941dc1ed64 /sw/source/ui/dbui | |
parent | 97dae845c29fad0f02cedbf0f61a1dd2c722c5b0 (diff) |
DLG_MM_SELECTDBTABLEDDIALOG conversion to .ui
Change-Id: Iaaa32bd5723ae45099d0fb670b207fc64c46d306
Reviewed-on: https://gerrit.libreoffice.org/9780
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui/dbui')
-rw-r--r-- | sw/source/ui/dbui/selectdbtabledialog.cxx | 82 | ||||
-rw-r--r-- | sw/source/ui/dbui/selectdbtabledialog.hrc | 36 | ||||
-rw-r--r-- | sw/source/ui/dbui/selectdbtabledialog.hxx | 15 | ||||
-rw-r--r-- | sw/source/ui/dbui/selectdbtabledialog.src | 78 |
4 files changed, 59 insertions, 152 deletions
diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx index 113aecf9fb10..1d6fb3f50e38 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 884ad640be4f..000000000000 --- 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 9d721a800504..d310769b7286 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 ed8f50a9827b..a5c7e403c162 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: */ |