include/vcl/layout.hxx | 1 sw/AllLangResTarget_sw.mk | 1 sw/UIConfig_swriter.mk | 3 sw/inc/dochdl.hrc | 1 sw/inc/envelp.hrc | 1 sw/inc/helpid.h | 1 sw/inc/swabstdlg.hxx | 2 sw/source/ui/dialog/swdlgfact.cxx | 18 -- sw/source/ui/dialog/swdlgfact.hxx | 2 sw/source/ui/dochdl/gloshdl.cxx | 2 sw/source/ui/dochdl/selglos.cxx | 28 +-- sw/source/ui/dochdl/selglos.hrc | 25 --- sw/source/ui/dochdl/selglos.src | 69 --------- sw/source/ui/envelp/labfmt.cxx | 65 +++----- sw/source/ui/envelp/labfmt.hrc | 10 - sw/source/ui/envelp/labfmt.hxx | 24 +-- sw/source/ui/envelp/labfmt.src | 73 --------- sw/source/ui/inc/selglos.hxx | 34 +--- sw/uiconfig/swriter/ui/insertautotextdialog.ui | 122 ++++++++++++++++ sw/uiconfig/swriter/ui/querysavelabeldialog.ui | 34 ++++ sw/uiconfig/swriter/ui/savelabeldialog.ui | 184 +++++++++++++++++++++++++ vcl/source/window/layout.cxx | 12 + 22 files changed, 421 insertions(+), 291 deletions(-)
New commits: commit 087a610fcd5c0c354a9ed6bfccd3451b667d62a3 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Aug 4 21:32:26 2013 +0200 convert insert autotext dialog to .ui Change-Id: Ia57a5e74300fb52d2618b086fe51a8b33547101b diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk index e3af1f2..0916793 100644 --- a/sw/AllLangResTarget_sw.mk +++ b/sw/AllLangResTarget_sw.mk @@ -93,7 +93,6 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\ sw/source/ui/dialog/dialog.src \ sw/source/ui/dialog/regionsw.src \ sw/source/ui/dochdl/dochdl.src \ - sw/source/ui/dochdl/selglos.src \ sw/source/ui/docvw/annotation.src \ sw/source/ui/docvw/access.src \ sw/source/ui/docvw/docvw.src \ diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index b0105bc..b123a7e 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -93,6 +93,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/indexentry \ sw/uiconfig/swriter/ui/inputfielddialog \ sw/uiconfig/swriter/ui/indentpage \ + sw/uiconfig/swriter/ui/insertautotextdialog \ sw/uiconfig/swriter/ui/insertbookmark \ sw/uiconfig/swriter/ui/insertbreak \ sw/uiconfig/swriter/ui/insertcaption \ diff --git a/sw/inc/dochdl.hrc b/sw/inc/dochdl.hrc index fc1c10a..c37def0 100644 --- a/sw/inc/dochdl.hrc +++ b/sw/inc/dochdl.hrc @@ -27,7 +27,6 @@ #define MSG_CLPBRD_FORMAT_ERROR (RC_DOCHDL_BEGIN + 4) #define MSG_UPDATE_NEW_GLOS_FMT (RC_DOCHDL_BEGIN + 5) -#define DLG_SEL_GLOS (RC_DOCHDL_BEGIN + 6) #define STR_NO_TABLE (RC_DOCHDL_BEGIN + 7) #define STR_PRIVATETEXT (RC_DOCHDL_BEGIN + 8) diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index b2a73e3..3cdb1bb 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -369,7 +369,7 @@ public: sal_Bool bDraw = sal_False, sal_uInt16 nDefPage = 0) = 0; - virtual AbstractSwSelGlossaryDlg * CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId ) = 0; //add for SwSelGlossaryDlg + virtual AbstractSwSelGlossaryDlg * CreateSwSelGlossaryDlg(Window * pParent, const String &rShortName) = 0; //add for SwSelGlossaryDlg virtual VclAbstractDialog * CreateVclAbstractDialog ( Window * pParent, SwWrtShell &rSh, int nResId ) = 0; //add for SwTableHeightDlg SwSortDlg virtual AbstractSplitTableDialog * CreateSplitTblDialog ( Window * pParent, SwWrtShell &rSh ) = 0; //add for SwSplitTblDlg diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 7d220dd..74d6453 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -859,22 +859,10 @@ AbstractSplitTableDialog * SwAbstractDialogFactory_Impl::CreateSplitTblDialog ( return new AbstractSplitTableDialog_Impl( new SwSplitTblDlg( pParent, rSh) ); } -AbstractSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId ) +AbstractSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(Window * pParent, const String &rShortName) { - SwSelGlossaryDlg* pDlg=NULL; - switch ( nResId ) - { - case DLG_SEL_GLOS : - pDlg = new SwSelGlossaryDlg( pParent, rShortName); - break; - - default: - break; - } - - if ( pDlg ) - return new AbstractSwSelGlossaryDlg_Impl( pDlg ); - return 0; + SwSelGlossaryDlg* pDlg = new SwSelGlossaryDlg(pParent, rShortName); + return new AbstractSwSelGlossaryDlg_Impl(pDlg); } AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(Window* pParent, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 060abef..9efa6e4 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -470,7 +470,7 @@ public: sal_Bool bDraw = sal_False, sal_uInt16 nDefPage = 0); - virtual AbstractSwSelGlossaryDlg * CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId ); //add for SwSelGlossaryDlg + virtual AbstractSwSelGlossaryDlg * CreateSwSelGlossaryDlg(Window * pParent, const String &rShortName); //add for SwSelGlossaryDlg virtual VclAbstractDialog * CreateVclAbstractDialog ( Window * pParent, SwWrtShell &rSh, int nResId ); //add for SwTableHeightDlg SwSortDlg virtual AbstractSplitTableDialog * CreateSplitTblDialog ( Window * pParent, SwWrtShell &rSh ); //add for SwSplitTblDlg diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index 8e852fb..4c4edef 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -454,7 +454,7 @@ sal_Bool SwGlossaryHdl::Expand( const OUString& rShortName, SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - AbstractSwSelGlossaryDlg* pDlg = pFact->CreateSwSelGlossaryDlg( 0, aShortName, DLG_SEL_GLOS ); + AbstractSwSelGlossaryDlg* pDlg = pFact->CreateSwSelGlossaryDlg(0, aShortName); OSL_ENSURE(pDlg, "Dialogdiet fail!"); for(sal_uInt16 i = 0; i < aFoundArr.size(); ++i) { diff --git a/sw/source/ui/dochdl/selglos.cxx b/sw/source/ui/dochdl/selglos.cxx index 930fb82..484787d 100644 --- a/sw/source/ui/dochdl/selglos.cxx +++ b/sw/source/ui/dochdl/selglos.cxx @@ -21,32 +21,20 @@ #include "selglos.hxx" -#include "selglos.hrc" #include "dochdl.hrc" -#include <vcl/msgbox.hxx> - -// STATIC DATA ----------------------------------------------------------- - - -// CTOR / DTOR ----------------------------------------------------------- +#include <vcl/layout.hxx> SwSelGlossaryDlg::SwSelGlossaryDlg(Window * pParent, const OUString &rShortName) - : ModalDialog(pParent, SW_RES(DLG_SEL_GLOS)), - aGlosBox(this, SW_RES( LB_GLOS)), - aGlosFL(this, SW_RES( FL_GLOS)), - aOKBtn(this, SW_RES( BT_OK)), - aCancelBtn(this, SW_RES( BT_CANCEL)), - aHelpBtn(this, SW_RES(BT_HELP)) + : ModalDialog(pParent, "InsertAutoTextDialog", + "modules/swriter/ui/insertautotextdialog.ui") { - aGlosFL.SetText(aGlosFL.GetText() + rShortName); - FreeResource(); - - aGlosBox.SetDoubleClickHdl(LINK(this, SwSelGlossaryDlg, DoubleClickHdl)); + VclFrame *pFrame(get<VclFrame>("frame")); + pFrame->set_label(pFrame->get_label() + rShortName); + get(m_pGlosBox, "treeview"); + m_pGlosBox->set_height_request(m_pGlosBox->GetTextHeight() * 10); + m_pGlosBox->SetDoubleClickHdl(LINK(this, SwSelGlossaryDlg, DoubleClickHdl)); } -// overload dtor -SwSelGlossaryDlg::~SwSelGlossaryDlg() {} - IMPL_LINK(SwSelGlossaryDlg, DoubleClickHdl, ListBox*, /*pBox*/) { EndDialog(RET_OK); diff --git a/sw/source/ui/dochdl/selglos.hrc b/sw/source/ui/dochdl/selglos.hrc deleted file mode 100644 index 9513d3a..0000000 --- a/sw/source/ui/dochdl/selglos.hrc +++ /dev/null @@ -1,25 +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 . - */ -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 -#define LB_GLOS 1 -#define FL_GLOS 2 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dochdl/selglos.src b/sw/source/ui/dochdl/selglos.src deleted file mode 100644 index 2a27214..0000000 --- a/sw/source/ui/dochdl/selglos.src +++ /dev/null @@ -1,69 +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 . - */ - -#include "selglos.hrc" -#include "dochdl.hrc" -#include "cmdid.h" -#include "helpid.h" - -ModalDialog DLG_SEL_GLOS -{ - HelpID = CMD_FN_EXPAND_GLOSSARY ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 220 , 100 ) ; - Text [ en-US ] = "Insert AutoText" ; - Moveable = TRUE ; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 164 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 164 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 164 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine FL_GLOS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 152 , 8 ) ; - Text [ en-US ] = "AutoTexts for shortcut " ; - }; - ListBox LB_GLOS - { - HelpID = "sw:ListBox:DLG_SEL_GLOS:LB_GLOS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 140 , 74 ) ; - TabStop = TRUE ; - AutoHScroll = TRUE ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/inc/selglos.hxx b/sw/source/ui/inc/selglos.hxx index 88da014..d86d4d5 100644 --- a/sw/source/ui/inc/selglos.hxx +++ b/sw/source/ui/inc/selglos.hxx @@ -29,32 +29,26 @@ class SwSelGlossaryDlg : public ModalDialog { protected: - ListBox aGlosBox; - FixedLine aGlosFL; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; + ListBox* m_pGlosBox; DECL_LINK(DoubleClickHdl, ListBox*); public: SwSelGlossaryDlg(Window * pParent, const OUString &rShortName); - ~SwSelGlossaryDlg(); - void InsertGlos(const OUString &rRegion, const OUString &rGlosName); // inline - sal_uInt16 GetSelectedIdx() const; // inline - void SelectEntryPos(sal_uInt16 nIdx); // inline + void InsertGlos(const OUString &rRegion, const OUString &rGlosName) + { + const OUString aTmp = rRegion + ":" + rGlosName; + m_pGlosBox->InsertEntry(aTmp); + } + sal_uInt16 GetSelectedIdx() const + { + return m_pGlosBox->GetSelectEntryPos(); + } + void SelectEntryPos(sal_uInt16 nIdx) + { + m_pGlosBox->SelectEntryPos(nIdx); + } }; -inline void SwSelGlossaryDlg::InsertGlos(const OUString &rRegion, - const OUString &rGlosName) -{ - const OUString aTmp = rRegion + ":" + rGlosName; - aGlosBox.InsertEntry( aTmp ); -} -inline sal_uInt16 SwSelGlossaryDlg::GetSelectedIdx() const -{ return aGlosBox.GetSelectEntryPos(); } -inline void SwSelGlossaryDlg::SelectEntryPos(sal_uInt16 nIdx) -{ aGlosBox.SelectEntryPos(nIdx); } - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/uiconfig/swriter/ui/insertautotextdialog.ui b/sw/uiconfig/swriter/ui/insertautotextdialog.ui new file mode 100644 index 0000000..28a6328 --- /dev/null +++ b/sw/uiconfig/swriter/ui/insertautotextdialog.ui @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="InsertAutoTextDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Insert AutoText</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="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="frame"> + <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="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkTreeView" id="treeview:border"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </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">AutoTexts for shortcut </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> commit 3e65dc7fca392489cd2ed2ed17da70cae39da89b Author: Caolán McNamara <caol...@redhat.com> Date: Sun Aug 4 22:05:11 2013 +0200 add a VclFrame::get_label Change-Id: I1fd7dd198345167e587353d370a0ef055221962f diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 9c46acd..e5fd0043 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -463,6 +463,7 @@ public: { } void set_label(const OUString &rLabel); + OUString get_label() const; virtual Window *get_child(); virtual const Window *get_child() const; Window *get_label_widget(); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index dfdef8f..bdae0fc 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1323,6 +1323,13 @@ void VclFrame::set_label(const OUString &rLabel) pLabel->SetText(rLabel); } +OUString VclFrame::get_label() const +{ + const Window *pLabel = get_label_widget(); + assert(pLabel); + return pLabel->GetText(); +} + OUString VclFrame::getDefaultAccessibleName() const { const Window *pLabel = get_label_widget(); commit b83719abf070626357646e77d96e61bd8d6cdce9 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Aug 4 16:53:39 2013 +0200 convert save label dialog to .ui Change-Id: I103ddf69f61608a1dd7930a8c3046e8916dee171 diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 4b2c422..b0105bc 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -126,6 +126,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/renameobjectdialog \ sw/uiconfig/swriter/ui/rowheight \ sw/uiconfig/swriter/ui/saveashtmldialog \ + sw/uiconfig/swriter/ui/savelabeldialog \ sw/uiconfig/swriter/ui/sidebarpage \ sw/uiconfig/swriter/ui/sidebarwrap \ sw/uiconfig/swriter/ui/sortdialog \ diff --git a/sw/inc/envelp.hrc b/sw/inc/envelp.hrc index b33d533..6fb5624 100644 --- a/sw/inc/envelp.hrc +++ b/sw/inc/envelp.hrc @@ -40,7 +40,6 @@ #define DLG_MAILMERGE (RC_ENVELP_BEGIN + 8) #define DLG_SYNC_BTN (RC_ENVELP_BEGIN + 9) -#define DLG_SAVE_LABEL (RC_ENVELP_BEGIN + 10) // Bereiche ------------------------------------------------------------------- diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 5fd9d4a..d66894c 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -402,7 +402,6 @@ #define HID_INSERT_INDEX_ENTRY_LEVEL_LB "SW_HID_INSERT_INDEX_ENTRY_LEVEL_LB" #define HID_BUSINESS_CARD_CONTENT "SW_HID_BUSINESS_CARD_CONTENT" -#define HID_SAVE_LABEL_DLG "SW_HID_SAVE_LABEL_DLG" #define HID_BUSINESS_FMT_PAGE "SW_HID_BUSINESS_FMT_PAGE" #define HID_BUSINESS_FMT_PAGE_CONT "SW_HID_BUSINESS_FMT_PAGE_CONT" #define HID_BUSINESS_FMT_PAGE_SHEET "SW_HID_BUSINESS_FMT_PAGE_SHEET" diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index cdba7ed..947ee59 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -589,42 +589,35 @@ IMPL_LINK_NOARG(SwLabFmtPage, SaveHdl) return 0; } -SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) : - ModalDialog(pParent, SW_RES(DLG_SAVE_LABEL)), - aOptionsFL(this,SW_RES(FL_OPTIONS )), - aMakeFT(this, SW_RES(FT_MAKE )), - aMakeCB(this, SW_RES(CB_MAKE )), - aTypeFT(this, SW_RES(FT_TYPE )), - aTypeED(this, SW_RES(ED_TYPE )), - - aOKPB(this, SW_RES(PB_OK )), - aCancelPB(this, SW_RES(PB_CANCEL )), - aHelpPB(this, SW_RES(PB_HELP )), - - bSuccess(false), - pLabPage(pParent), - rLabRec(rRec) +SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) + : ModalDialog(pParent, "SaveLabelDialog", + "modules/swriter/ui/savelabeldialog.ui") + , bSuccess(false) + , pLabPage(pParent) + , rLabRec(rRec) { - FreeResource(); + get(m_pMakeCB, "brand"); + get(m_pTypeED, "type"); + get(m_pOKPB, "ok"); - aOKPB.SetClickHdl(LINK(this, SwSaveLabelDlg, OkHdl)); + m_pOKPB->SetClickHdl(LINK(this, SwSaveLabelDlg, OkHdl)); Link aLk(LINK(this, SwSaveLabelDlg, ModifyHdl)); - aMakeCB.SetModifyHdl(aLk); - aTypeED.SetModifyHdl(aLk); + m_pMakeCB->SetModifyHdl(aLk); + m_pTypeED->SetModifyHdl(aLk); SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig(); const std::vector<OUString>& rMan = rCfg.GetManufacturers(); for (sal_uInt16 i = 0; i < rMan.size(); i++) { - aMakeCB.InsertEntry(rMan[i]); + m_pMakeCB->InsertEntry(rMan[i]); } } IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) { SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig(); - String sMake(aMakeCB.GetText()); - String sType(aTypeED.GetText()); + String sMake(m_pMakeCB->GetText()); + String sType(m_pTypeED->GetText()); if(rCfg.HasLabel(sMake, sType)) { if ( rCfg.IsPredefinedLabel(sMake, sType) ) @@ -655,7 +648,7 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) IMPL_LINK_NOARG(SwSaveLabelDlg, ModifyHdl) { - aOKPB.Enable(!aMakeCB.GetText().isEmpty() && !aTypeED.GetText().isEmpty()); + m_pOKPB->Enable(!m_pMakeCB->GetText().isEmpty() && !m_pTypeED->GetText().isEmpty()); return 0; } @@ -663,8 +656,8 @@ bool SwSaveLabelDlg::GetLabel(SwLabItem& rItem) { if(bSuccess) { - rItem.aMake = aMakeCB.GetText(); - rItem.aType = aTypeED.GetText(); + rItem.aMake = m_pMakeCB->GetText(); + rItem.aType = m_pTypeED->GetText(); rItem.lHDist = rLabRec.lHDist; rItem.lVDist = rLabRec.lVDist; rItem.lWidth = rLabRec.lWidth; diff --git a/sw/source/ui/envelp/labfmt.hrc b/sw/source/ui/envelp/labfmt.hrc index dee5344..f9b1d80 100644 --- a/sw/source/ui/envelp/labfmt.hrc +++ b/sw/source/ui/envelp/labfmt.hrc @@ -50,15 +50,6 @@ #define FI_MAKE 24 #define FI_TYPE 25 -#define FL_OPTIONS 1 -#define FT_MAKE 2 -#define CB_MAKE 3 -#define FT_TYPE 4 -#define ED_TYPE 5 -#define PB_OK 6 -#define PB_CANCEL 7 -#define PB_HELP 8 - // global resources ******************************************************** #define STR_HDIST (RC_LABFMT_BEGIN + 1) diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx index d6a0177..1359e0f 100644 --- a/sw/source/ui/envelp/labfmt.hxx +++ b/sw/source/ui/envelp/labfmt.hxx @@ -139,15 +139,9 @@ public: class SwSaveLabelDlg : public ModalDialog { - FixedLine aOptionsFL; - FixedText aMakeFT; - ComboBox aMakeCB; - FixedText aTypeFT; - Edit aTypeED; - - OKButton aOKPB; - CancelButton aCancelPB; - HelpButton aHelpPB; + ComboBox* m_pMakeCB; + Edit* m_pTypeED; + OKButton* m_pOKPB; bool bSuccess; SwLabFmtPage* pLabPage; @@ -159,11 +153,11 @@ class SwSaveLabelDlg : public ModalDialog public: SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec); - void SetLabel(const OUString& rMake, const OUString& rType) - { - aMakeCB.SetText(String(rMake)); - aTypeED.SetText(String(rType)); - } + void SetLabel(const OUString& rMake, const OUString& rType) + { + m_pMakeCB->SetText(rMake); + m_pTypeED->SetText(rType); + } bool GetLabel(SwLabItem& rItem); }; #endif diff --git a/sw/source/ui/envelp/labfmt.src b/sw/source/ui/envelp/labfmt.src index aeabd0c..a18b61e 100644 --- a/sw/source/ui/envelp/labfmt.src +++ b/sw/source/ui/envelp/labfmt.src @@ -303,71 +303,4 @@ String STR_PHEIGHT { Text [ en-US ] = "Page Height" ; }; -ModalDialog DLG_SAVE_LABEL -{ - HelpID = HID_SAVE_LABEL_DLG ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 230 , 60 ) ; - Moveable = TRUE ; - FixedText FT_MAKE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "Brand" ; - Left = TRUE ; - }; - ComboBox CB_MAKE - { - HelpID = "sw:ComboBox:DLG_SAVE_LABEL:CB_MAKE"; - Pos = MAP_APPFONT ( 65 , 15 ) ; - Size = MAP_APPFONT ( 100 , 50 ) ; - Border = TRUE; - DropDown = TRUE; - }; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "T~ype" ; - Left = TRUE ; - }; - Edit ED_TYPE - { - HelpID = "sw:Edit:DLG_SAVE_LABEL:ED_TYPE"; - Pos = MAP_APPFONT ( 65 , 30 ) ; - Size = MAP_APPFONT ( 100 , 12 ) ; - Border = TRUE; - }; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 165 , 8 ) ; - Text [ en-US ] = "Options"; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 174 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 174 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 174 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - Text [ en-US ] = "Save Label Format"; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/uiconfig/swriter/ui/savelabeldialog.ui b/sw/uiconfig/swriter/ui/savelabeldialog.ui new file mode 100644 index 0000000..bd3bfd7 --- /dev/null +++ b/sw/uiconfig/swriter/ui/savelabeldialog.ui @@ -0,0 +1,184 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="SaveLabelDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Save Label Format</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="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="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Brand</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">T_ype</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="type"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">â</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="brand"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="has_entry">True</property> + <property name="entry_text_column">0</property> + <property name="id_column">1</property> + <child internal-child="entry"> + <object class="GtkEntry" id="comboboxtext-entry"> + <property name="can_focus">False</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">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">Options</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> commit 278f5da01fb5d84cde9e2109010fd2cb3e4da4b6 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Aug 4 16:16:15 2013 +0200 convert query overwrite label dialog to .ui Change-Id: I1c558b965cfee8cd49061d86661bb4251214b76d diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index d259830..4b2c422 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -116,6 +116,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/outlinenumbering \ sw/uiconfig/swriter/ui/outlinenumberingpage \ sw/uiconfig/swriter/ui/outlinepositionpage \ + sw/uiconfig/swriter/ui/querysavelabeldialog \ sw/uiconfig/swriter/ui/queryshowchangesdialog \ sw/uiconfig/swriter/ui/paradialog \ sw/uiconfig/swriter/ui/previewzoomdialog \ diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 89d12f4..cdba7ed 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -601,8 +601,6 @@ SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) : aCancelPB(this, SW_RES(PB_CANCEL )), aHelpPB(this, SW_RES(PB_HELP )), - aQueryMB(this, SW_RES(MB_QUERY )), - bSuccess(false), pLabPage(pParent), rLabRec(rRec) @@ -635,15 +633,17 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) MessageDialog(this, "CannotSaveLabelDialog", "modules/swriter/ui/cannotsavelabeldialog.ui").Execute(); return 0; } - String sTmp(aQueryMB.GetMessText()); - String sQuery(sTmp); - sQuery.SearchAndReplace(OUString("%1"), sMake); - sQuery.SearchAndReplace(OUString("%2"), sType); - aQueryMB.SetMessText(sQuery); - - short eRet = aQueryMB.Execute(); - aQueryMB.SetMessText(sTmp); - if(RET_YES != eRet) + + MessageDialog aQuery(this, "QuerySaveLabelDialog", + "modules/swriter/ui/querysavelabeldialog.ui"); + + aQuery.set_primary_text(aQuery.get_primary_text(). + replaceAll("%1", sMake).replaceAll("%2", sType)); + aQuery.set_secondary_text(aQuery.get_secondary_text(). + replaceAll("%1", sMake).replaceAll("%2", sType)); + sal_uInt16 eRet = aQuery.Execute(); + + if (RET_YES != eRet) return 0; } rLabRec.aType = sType; diff --git a/sw/source/ui/envelp/labfmt.hrc b/sw/source/ui/envelp/labfmt.hrc index 00c5eca..dee5344 100644 --- a/sw/source/ui/envelp/labfmt.hrc +++ b/sw/source/ui/envelp/labfmt.hrc @@ -58,7 +58,6 @@ #define PB_OK 6 #define PB_CANCEL 7 #define PB_HELP 8 -#define MB_QUERY 9 // global resources ******************************************************** diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx index 2ecf067..d6a0177 100644 --- a/sw/source/ui/envelp/labfmt.hxx +++ b/sw/source/ui/envelp/labfmt.hxx @@ -149,8 +149,6 @@ class SwSaveLabelDlg : public ModalDialog CancelButton aCancelPB; HelpButton aHelpPB; - QueryBox aQueryMB; - bool bSuccess; SwLabFmtPage* pLabPage; SwLabRec& rLabRec; diff --git a/sw/source/ui/envelp/labfmt.src b/sw/source/ui/envelp/labfmt.src index 2be92d7..aeabd0c 100644 --- a/sw/source/ui/envelp/labfmt.src +++ b/sw/source/ui/envelp/labfmt.src @@ -367,12 +367,6 @@ ModalDialog DLG_SAVE_LABEL TabStop = TRUE ; Group = TRUE ; }; - QueryBox MB_QUERY - { - Buttons = WB_YES_NO ; - DefButton = WB_DEF_CANCEL ; - Message [ en-US ] = "The label \"%1 / %2\" already exists.\nDo you want to overwrite it?"; - }; Text [ en-US ] = "Save Label Format"; }; diff --git a/sw/uiconfig/swriter/ui/querysavelabeldialog.ui b/sw/uiconfig/swriter/ui/querysavelabeldialog.ui new file mode 100644 index 0000000..af409c09 --- /dev/null +++ b/sw/uiconfig/swriter/ui/querysavelabeldialog.ui @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.6 --> + <object class="GtkMessageDialog" id="QuerySaveLabelDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Save label?</property> + <property name="type_hint">dialog</property> + <property name="skip_taskbar_hint">True</property> + <property name="message_type">question</property> + <property name="buttons">yes-no</property> + <property name="text" translatable="yes">A label named "%1 / %2" already exists. Do you want to replace it?</property> + <property name="secondary_text" translatable="yes">A label already exists with brand "%1" and type "%2". Replacing it will overwrite its contents.</property> + <child internal-child="vbox"> + <object class="GtkBox" id="messagedialog-vbox"> + <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="messagedialog-action_area"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + </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> + </object> + </child> + </object> +</interface> commit 0cbfa8f97d0c6abdec829718eaf97486447a96cf Author: Caolán McNamara <caol...@redhat.com> Date: Sun Aug 4 18:49:06 2013 +0200 set default buttons for various messagebox button combinations Change-Id: I4d6fc4313014a2478d0838766e09df743212991d diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 513dab4..dfdef8f 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1871,18 +1871,21 @@ short MessageDialog::Execute() break; case VCL_BUTTONS_OK: pBtn = new OKButton(pButtonBox); + pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_OK; break; case VCL_BUTTONS_CLOSE: pBtn = new CloseButton(pButtonBox); + pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_CLOSE; break; case VCL_BUTTONS_CANCEL: pBtn = new CancelButton(pButtonBox); + pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_CANCEL; break; @@ -1894,6 +1897,7 @@ short MessageDialog::Execute() m_aResponses[pBtn] = RET_YES; pBtn = new PushButton(pButtonBox); + pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->SetText(Button::GetStandardText(BUTTON_NO)); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); @@ -1906,6 +1910,7 @@ short MessageDialog::Execute() m_aResponses[pBtn] = RET_OK; pBtn = new CancelButton(pButtonBox); + pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_CANCEL;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits