From f03e95da68138a48ba2d4b6ab382b839577f0a1d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 17 Feb 2014 09:27:25 +0000 Subject: convert biblio choose data source dialog to .ui Change-Id: Ia94c417be95f5cd8c1d694a61c5004b0e8486416 --- extensions/UIConfig_sbibliography.mk | 4 + extensions/inc/bibliography.hrc | 2 - extensions/source/bibliography/bib.hrc | 1 - extensions/source/bibliography/datman.cxx | 70 ++++--------- extensions/source/bibliography/datman.hrc | 5 - extensions/source/bibliography/datman.src | 47 --------- .../sbibliography/ui/choosedatasourcedialog.ui | 110 +++++++++++++++++++++ 7 files changed, 134 insertions(+), 105 deletions(-) create mode 100644 extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui (limited to 'extensions') diff --git a/extensions/UIConfig_sbibliography.mk b/extensions/UIConfig_sbibliography.mk index 1517d1d98224..717c1aefd76c 100644 --- a/extensions/UIConfig_sbibliography.mk +++ b/extensions/UIConfig_sbibliography.mk @@ -13,4 +13,8 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/sbibliography,\ extensions/uiconfig/sbibliography/menubar/menubar \ )) +$(eval $(call gb_UIConfig_add_uifiles,modules/sbibliography,\ + extensions/uiconfig/sbibliography/ui/choosedatasourcedialog \ +)) + # vim: set noet sw=4 ts=4: diff --git a/extensions/inc/bibliography.hrc b/extensions/inc/bibliography.hrc index a7b22b1475bf..ec420e9ce620 100644 --- a/extensions/inc/bibliography.hrc +++ b/extensions/inc/bibliography.hrc @@ -62,8 +62,6 @@ #define UID_BIB_FRAME_WINDOW "EXTENSIONS_UID_BIB_FRAME_WINDOW" #define HID_BIB_DB_GRIDCTRL "EXTENSIONS_HID_BIB_DB_GRIDCTRL" #define HID_DLG_MAPPING "EXTENSIONS_HID_DLG_MAPPING" -#define HID_DLG_DBCHANGE "EXTENSIONS_HID_DLG_DBCHANGE" -#define HID_SELECTION_TLB "EXTENSIONS_HID_SELECTION_TLB" #endif // EXTENSIONS_BIBLIOGRAPHY_HRC diff --git a/extensions/source/bibliography/bib.hrc b/extensions/source/bibliography/bib.hrc index a464de773161..7b2fd1016b60 100644 --- a/extensions/source/bibliography/bib.hrc +++ b/extensions/source/bibliography/bib.hrc @@ -29,7 +29,6 @@ #define RID_BIB_DIALOG (RID_BIB_START) #define RID_TP_GENERAL (RID_BIB_DIALOG) #define RID_DLG_MAPPING (RID_BIB_DIALOG + 1) -#define RID_DLG_DBCHANGE (RID_BIB_DIALOG + 2) //Controls(100) #define RID_BIB_CONTROLS (RID_BIB_START + 100) diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 0baaf88c536b..49f020190c38 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -528,14 +528,8 @@ IMPL_LINK_NOARG(MappingDialog_Impl, OkHdl) class DBChangeDialog_Impl : public ModalDialog { - OKButton aOKBT; - CancelButton aCancelBT; - HelpButton aHelpBT; - FixedLine aSelectionGB; - SvTabListBox aSelectionLB; - HeaderBar aSelectionHB; + ListBox* m_pSelectionLB; DBChangeDialogConfig_Impl aConfig; - OUString aEntryST; BibDataManager* pDatMan; @@ -547,51 +541,33 @@ public: OUString GetCurrentURL()const; }; -DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ) : - ModalDialog(pParent, BibResId(RID_DLG_DBCHANGE) ), - aOKBT(this, BibResId( BT_OK )), - aCancelBT(this, BibResId( BT_CANCEL )), - aHelpBT(this, BibResId( BT_HELP )), - aSelectionGB(this, BibResId( GB_SELECTION )), - aSelectionLB(this, BibResId( LB_SELECTION )), - aSelectionHB(this, BibResId( HB_SELECTION )), - aEntryST(BIB_RESSTR(ST_ENTRY)), +DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ) + : ModalDialog(pParent, "ChooseDataSourceDialog", + "modules/sbibliography/ui/choosedatasourcedialog.ui") + , pDatMan(pMan) { - FreeResource(); - aSelectionLB.SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl)); - try - { - ::Size aSize = aSelectionHB.GetSizePixel(); - long nTabs[2]; - nTabs[0] = 1;// Number of Tabs - nTabs[1] = aSize.Width() / 4; - - aSelectionHB.SetStyle(aSelectionHB.GetStyle()|WB_STDHEADERBAR); - aSelectionHB.InsertItem( 1, aEntryST, aSize.Width()); - aSelectionHB.SetSizePixel(aSelectionHB.CalcWindowSizePixel()); - aSelectionHB.Show(); + get(m_pSelectionLB, "treeview"); + m_pSelectionLB->set_height_request(m_pSelectionLB->GetTextHeight() * 6); - aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL ); - aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_CLIPCHILDREN|WB_SORT); - aSelectionLB.GetModel()->SetSortMode(SortAscending); + m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle() | WB_SORT); + m_pSelectionLB->SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl)); + try + { OUString sActiveSource = pDatMan->getActiveDataSource(); const Sequence< OUString >& rSources = aConfig.GetDataSourceNames(); const OUString* pSourceNames = rSources.getConstArray(); - for(int i = 0; i < rSources.getLength(); i++) - { - SvTreeListEntry* pEntry = aSelectionLB.InsertEntry(pSourceNames[i]); - if(pSourceNames[i] == sActiveSource) - { - aSelectionLB.Select(pEntry); - } - } - aSelectionLB.GetModel()->Resort(); + for (sal_Int32 i = 0; i < rSources.getLength(); ++i) + m_pSelectionLB->InsertEntry(pSourceNames[i]); + + m_pSelectionLB->SelectEntry(sActiveSource); } - catch (const Exception&) + catch (const Exception& e) { - OSL_FAIL("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl"); + SAL_WARN("extensions.biblio", + "Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl " + << e.Message); } } @@ -607,13 +583,7 @@ DBChangeDialog_Impl::~DBChangeDialog_Impl() OUString DBChangeDialog_Impl::GetCurrentURL()const { - OUString sRet; - SvTreeListEntry* pEntry = aSelectionLB.FirstSelected(); - if(pEntry) - { - sRet = aSelectionLB.GetEntryText(pEntry, 0); - } - return sRet; + return m_pSelectionLB->GetSelectEntry(); } // XDispatchProvider diff --git a/extensions/source/bibliography/datman.hrc b/extensions/source/bibliography/datman.hrc index 42fb77aed33f..b7515baafca4 100644 --- a/extensions/source/bibliography/datman.hrc +++ b/extensions/source/bibliography/datman.hrc @@ -87,9 +87,4 @@ #define FT_CUSTOM5 66 #define LB_CUSTOM5 67 -#define GB_SELECTION 68 -#define ST_ENTRY 69 -#define LB_SELECTION 71 -#define HB_SELECTION 72 - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.src b/extensions/source/bibliography/datman.src index 555e1e8dd8c4..ef862d1919d1 100644 --- a/extensions/source/bibliography/datman.src +++ b/extensions/source/bibliography/datman.src @@ -425,52 +425,5 @@ ModalDialog RID_DLG_MAPPING }; Text [ en-US ] = "Column Layout for Table %1"; }; -ModalDialog RID_DLG_DBCHANGE -{ - HelpID = HID_DLG_DBCHANGE; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 291 , 131 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Choose Data Source"; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 238 , 3 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 238 , 18 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 238 , 36 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - FixedLine GB_SELECTION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 229 , 8 ) ; - }; - String ST_ENTRY - { - Text [ en-US ] = "Entry"; - }; - Control LB_SELECTION - { - Pos = MAP_APPFONT ( 9 , 24 ) ; - Size = MAP_APPFONT ( 223 , 100 ) ; - Border = TRUE; - TabStop = TRUE; - HelpId = HID_SELECTION_TLB; - }; - Window HB_SELECTION - { - Pos = MAP_APPFONT ( 9 , 12 ) ; - Size = MAP_APPFONT ( 223 , 12 ) ; - Border = TRUE; - }; -}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui b/extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui new file mode 100644 index 000000000000..ff8c99ddb440 --- /dev/null +++ b/extensions/uiconfig/sbibliography/ui/choosedatasourcedialog.ui @@ -0,0 +1,110 @@ + + + + + + False + 6 + Choose Data Source + dialog + + + False + vertical + 12 + + + False + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + False + True + end + 0 + + + + + True + False + True + True + 0 + none + + + True + False + True + True + 6 + 12 + + + True + True + True + True + + + + + + + + + + True + False + Entry + + + + + + + + False + True + 1 + + + + + + ok + cancel + + + -- cgit