diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-04-29 10:54:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-04-29 11:01:08 +0100 |
commit | b191f53860eebf12de6b7cf0a7ddea21a17382e8 (patch) | |
tree | 204ca3ba9019785f48c8b24035be5100af54522d /sw | |
parent | 09f51181ce8120412335d4f7a76bfbbc645a8956 (diff) |
convert create author entry dialog to .ui format
Change-Id: Ia36b42be8f5caa93937e870467c95f47439d9c9e
Diffstat (limited to 'sw')
-rw-r--r-- | sw/UIConfig_swriter.mk | 1 | ||||
-rw-r--r-- | sw/inc/helpid.h | 1 | ||||
-rw-r--r-- | sw/inc/index.hrc | 1 | ||||
-rw-r--r-- | sw/source/ui/index/idxmrk.hrc | 1 | ||||
-rw-r--r-- | sw/source/ui/index/idxmrk.src | 33 | ||||
-rw-r--r-- | sw/source/ui/index/swuiidxmrk.cxx | 117 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/createauthorentry.ui | 347 |
7 files changed, 382 insertions, 119 deletions
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 6a1c63cfd0f5..b4bd3de5abc1 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -72,6 +72,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/columnpage \ sw/uiconfig/swriter/ui/columnwidth \ sw/uiconfig/swriter/ui/converttexttable \ + sw/uiconfig/swriter/ui/createauthorentry \ sw/uiconfig/swriter/ui/dropdownfielddialog \ sw/uiconfig/swriter/ui/endnotepage \ sw/uiconfig/swriter/ui/editcategories \ diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index fc5a1ca168b6..4adc14cf2375 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -186,7 +186,6 @@ #define HID_DLG_ADD_IDX_STYLES "SW_HID_DLG_ADD_IDX_STYLES" #define HID_ADD_STYLES_TLB "SW_HID_ADD_STYLES_TLB" #define HID_OLE_CHECKLB "SW_HID_OLE_CHECKLB" -#define HID_DLG_CREATE_AUTH_ENTRY "SW_HID_DLG_CREATE_AUTH_ENTRY" #define HID_TP_PRIVATE_DATA "SW_HID_TP_PRIVATE_DATA" #define HID_TP_BUSINESS_DATA "SW_HID_TP_BUSINESS_DATA" diff --git a/sw/inc/index.hrc b/sw/inc/index.hrc index ef5c22459155..c16cc544c837 100644 --- a/sw/inc/index.hrc +++ b/sw/inc/index.hrc @@ -33,7 +33,6 @@ #define STR_ALPHA (RC_INDEX_BEGIN + 7) #define STR_LEVEL (RC_INDEX_BEGIN + 8) -#define DLG_CREATE_AUTH_ENTRY (RC_INDEX_BEGIN + 10) #define DLG_EDIT_IDXMARK (RC_INDEX_BEGIN + 11) #define DLG_EDIT_AUTHMARK (RC_INDEX_BEGIN + 12) diff --git a/sw/source/ui/index/idxmrk.hrc b/sw/source/ui/index/idxmrk.hrc index 86e9bca390bf..2a748b70bd63 100644 --- a/sw/source/ui/index/idxmrk.hrc +++ b/sw/source/ui/index/idxmrk.hrc @@ -19,7 +19,6 @@ #define PB_OK 22 #define PB_CANCEL 23 #define PB_HELP 24 -#define FL_ENTRIES 25 #define FL_NAME 37 #define FT_NAME 38 #define ED_NAME 39 diff --git a/sw/source/ui/index/idxmrk.src b/sw/source/ui/index/idxmrk.src index 3797bf817bbd..3f78a53d23a1 100644 --- a/sw/source/ui/index/idxmrk.src +++ b/sw/source/ui/index/idxmrk.src @@ -85,39 +85,6 @@ String STR_IDXMRK_INSERT Text [ en-US ] = "Insert Index Entry" ; }; -ModalDialog DLG_CREATE_AUTH_ENTRY -{ - HelpId = HID_DLG_CREATE_AUTH_ENTRY; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 365 , 203 ) ; - Moveable = TRUE ; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 312 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 312 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 312 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - FixedLine FL_ENTRIES - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 300 , 8 ) ; - Text [ en-US ] = "Entry data"; - }; - Text [ en-US ] = "Define Bibliography Entry"; -}; - QueryBox DLG_CHANGE_AUTH_ENTRY { BUTTONS = WB_YES_NO ; diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 79948ae44c93..0844d5adc900 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <svl/stritem.hxx> +#include <vcl/layout.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dispatch.hxx> #include <svl/eitem.hxx> @@ -1032,16 +1033,12 @@ void SwIndexMarkModalDlg::Apply() class SwCreateAuthEntryDlg_Impl : public ModalDialog { - FixedLine aEntriesFL; - FixedText* pFixedTexts[AUTH_FIELD_END]; ListBox* pTypeListBox; ComboBox* pIdentifierBox; Edit* pEdits[AUTH_FIELD_END]; - OKButton aOKBT; - CancelButton aCancelBT; - HelpButton aHelpBT; + OKButton* m_pOKBT; Link aShortNameCheckLink; @@ -1475,77 +1472,48 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent, const String pFields[], SwWrtShell& rSh, sal_Bool bNewEntry, - bool bCreate) : - ModalDialog(pParent, SW_RES(DLG_CREATE_AUTH_ENTRY)), - aEntriesFL(this, SW_RES(FL_ENTRIES )), + bool bCreate) + : ModalDialog(pParent, "CreateAuthorEntryDialog", "modules/swriter/ui/createauthorentry.ui") + + , + pTypeListBox(0), pIdentifierBox(0), - aOKBT(this, SW_RES(PB_OK )), - aCancelBT(this, SW_RES(PB_CANCEL )), - aHelpBT(this, SW_RES(PB_HELP )), rWrtSh(rSh), m_bNewEntryMode(bNewEntry), m_bNameAllowed(sal_True) { - FreeResource(); - Point aFLPos(aEntriesFL.GetPosPixel()); - Point aTL1(aFLPos); - Size aFLSz(aEntriesFL.GetSizePixel().Width(), GetSizePixel().Height()); - long nControlSpace = aFLSz.Width() / 4; - long nControlWidth = nControlSpace - 2 * aTL1.X(); - aTL1.X() *= 2; - aTL1.Y() *= 5; - Point aTR1(aTL1); - aTR1.X() += nControlSpace; - Point aTL2(aTR1); - aTL2.X() += nControlSpace; - Point aTR2(aTL2); - aTR2.X() += nControlSpace; - Size aFixedTextSize(aFLSz); - Size aTmpSz(8,10); - aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT); - aFixedTextSize.Height() = aTmpSz.Width(); - Size aEditSize(aFixedTextSize); - aFixedTextSize.Width() = nControlWidth + aFLPos.X(); - aEditSize.Height() = aTmpSz.Height(); - aEditSize.Width() = nControlWidth; - - sal_uInt16 nOffset = static_cast< sal_uInt16 >(aTmpSz.Width() * 3 / 2); + get(m_pOKBT, "ok"); + + VclGrid *pLeft = get<VclGrid>("leftgrid"); + VclGrid *pRight = get<VclGrid>("rightgrid"); + bool bLeft = true; - Window* pRefWindow = 0; + sal_Int32 nLeftRow(0), nRightRow(0); for(sal_uInt16 nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++) { const TextInfo aCurInfo = aTextInfoArr[nIndex]; - pFixedTexts[nIndex] = new FixedText(this); - if(nIndex) - pFixedTexts[nIndex]->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND ); - else - pFixedTexts[nIndex]->SetZOrder( 0, WINDOW_ZORDER_FIRST ); - - pRefWindow = pFixedTexts[nIndex]; + pFixedTexts[nIndex] = new FixedText(bLeft ? pLeft : pRight, WB_VCENTER); - pFixedTexts[nIndex]->SetSizePixel(aFixedTextSize); - pFixedTexts[nIndex]->SetPosPixel(bLeft ? aTL1 : aTL2); + pFixedTexts[nIndex]->set_grid_left_attach(0); + pFixedTexts[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); pFixedTexts[nIndex]->SetText(SW_RES(STR_AUTH_FIELD_START + aCurInfo.nToxField)); pFixedTexts[nIndex]->Show(); pEdits[nIndex] = 0; if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField ) { - pTypeListBox = new ListBox(this, WB_DROPDOWN|WB_BORDER); - pTypeListBox->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND ); - pRefWindow = pTypeListBox; + pTypeListBox = new ListBox(bLeft ? pLeft : pRight, WB_DROPDOWN|WB_BORDER|WB_VCENTER); for(sal_uInt16 j = 0; j < AUTH_TYPE_END; j++) - pTypeListBox->InsertEntry(String(SW_RES(STR_AUTH_TYPE_START + j))); + pTypeListBox->InsertEntry(SW_RESSTR(STR_AUTH_TYPE_START + j)); if(pFields[aCurInfo.nToxField].Len()) { sal_uInt16 nIndexPos = static_cast< sal_uInt16 >(pFields[aCurInfo.nToxField].ToInt32()); pTypeListBox->SelectEntryPos(nIndexPos); } - Size aTmp(aEditSize); - aTmp.Height() *= 4; - pTypeListBox->SetSizePixel(aTmp); - pTypeListBox->SetPosPixel(bLeft ? aTR1 : aTR2); + pTypeListBox->set_grid_left_attach(1); + pTypeListBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); + pTypeListBox->set_hexpand(true); pTypeListBox->Show(); pTypeListBox->SetSelectHdl(LINK(this, SwCreateAuthEntryDlg_Impl, EnableHdl)); pTypeListBox->SetHelpId(aCurInfo.pHelpId); @@ -1553,9 +1521,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent, } else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode) { - pIdentifierBox = new ComboBox(this, WB_BORDER|WB_DROPDOWN); - pIdentifierBox->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND ); - pRefWindow = pIdentifierBox; + pIdentifierBox = new ComboBox(bLeft ? pLeft : pRight, WB_BORDER|WB_DROPDOWN|WB_VCENTER); pIdentifierBox->SetSelectHdl(LINK(this, SwCreateAuthEntryDlg_Impl, IdentifierHdl)); @@ -1571,20 +1537,19 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent, pIdentifierBox->InsertEntry(aIds[n]); } pIdentifierBox->SetText(pFields[aCurInfo.nToxField]); - Size aTmp(aEditSize); - aTmp.Height() *= 4; - pIdentifierBox->SetSizePixel(aTmp); - pIdentifierBox->SetPosPixel(bLeft ? aTR1 : aTR2); + pIdentifierBox->set_grid_left_attach(1); + pIdentifierBox->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); + pIdentifierBox->set_hexpand(true); pIdentifierBox->Show(); pIdentifierBox->SetHelpId(aCurInfo.pHelpId); } else { - pEdits[nIndex] = new Edit(this, WB_BORDER); - pEdits[nIndex]->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND ); - pRefWindow = pEdits[nIndex]; - pEdits[nIndex]->SetSizePixel(aEditSize); - pEdits[nIndex]->SetPosPixel(bLeft ? aTR1 : aTR2); + pEdits[nIndex] = new Edit(bLeft ? pLeft : pRight, WB_BORDER|WB_VCENTER); + pEdits[nIndex]->SetWidthInChars(14); + pEdits[nIndex]->set_grid_left_attach(1); + pEdits[nIndex]->set_grid_top_attach(bLeft ? nLeftRow : nRightRow); + pEdits[nIndex]->set_hexpand(true); pEdits[nIndex]->SetText(pFields[aCurInfo.nToxField]); pEdits[nIndex]->Show(); pEdits[nIndex]->SetHelpId(aCurInfo.pHelpId); @@ -1600,26 +1565,12 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent, } } if(bLeft) - { - aTL1.Y() += nOffset; - aTR1.Y() += nOffset; - } + ++nLeftRow; else - { - aTL2.Y() += nOffset; - aTR2.Y() += nOffset; - } + ++nRightRow; bLeft = !bLeft; } EnableHdl(pTypeListBox); - - long nHeightDiff = - aFLSz.Height(); - aFLSz.Height() = aTL1.Y(); - nHeightDiff += aFLSz.Height(); - Size aDlgSize(GetSizePixel()); - aDlgSize.Height() += nHeightDiff; - SetSizePixel(aDlgSize); - } SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl() @@ -1694,14 +1645,14 @@ IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, Edit*, pEdit) { sal_Bool bEnable = 0 != aShortNameCheckLink.Call(pEdit); m_bNameAllowed |= bEnable; - aOKBT.Enable(pTypeListBox->GetSelectEntryCount() && bEnable); + m_pOKBT->Enable(pTypeListBox->GetSelectEntryCount() && bEnable); } return 0; } IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, ListBox*, pBox) { - aOKBT.Enable(m_bNameAllowed && pBox->GetSelectEntryCount()); + m_pOKBT->Enable(m_bNameAllowed && pBox->GetSelectEntryCount()); return 0; }; diff --git a/sw/uiconfig/swriter/ui/createauthorentry.ui b/sw/uiconfig/swriter/ui/createauthorentry.ui new file mode 100644 index 000000000000..7a0bdde2c114 --- /dev/null +++ b/sw/uiconfig/swriter/ui/createauthorentry.ui @@ -0,0 +1,347 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="CreateAuthorEntryDialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Define Bibliography Entry</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">12</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="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="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">1</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">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="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</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="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <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="spacing">18</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkGrid" id="leftgrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">12</property> + <property name="column_spacing">6</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="rightgrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">12</property> + <property name="column_spacing">6</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <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> + </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">Entry data</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> + </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> |