diff options
author | Jack Leigh <leighman@gmx.se> | 2012-11-29 21:44:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-11-30 16:22:45 +0000 |
commit | 42f6308d1b4c352b8949a4ab8c2c77388d4a29e9 (patch) | |
tree | e265f314dbcb02ea0b8d1e951191f92dcf2167b8 /sw | |
parent | 20759742222c18ba507b31986622530904efc943 (diff) |
migrate 'Insert Bookmark' dialog to .ui file
STR_REMOVE_WARNING moved to globals.hrc so also misc.hrc no longer
required in swrenamexnameddlg.cxx
Conflicts:
sw/source/ui/misc/bookmark.src
Change-Id: I5c34c14df36a78133ff08c0f2f0ce1a01292067f
Diffstat (limited to 'sw')
-rw-r--r-- | sw/AllLangResTarget_sw.mk | 1 | ||||
-rw-r--r-- | sw/UI_swriter.mk | 1 | ||||
-rw-r--r-- | sw/inc/globals.hrc | 2 | ||||
-rw-r--r-- | sw/source/ui/app/app.src | 5 | ||||
-rw-r--r-- | sw/source/ui/cctrl/swlbox.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/inc/bookmark.hxx | 13 | ||||
-rw-r--r-- | sw/source/ui/inc/misc.hrc | 1 | ||||
-rw-r--r-- | sw/source/ui/inc/swlbox.hxx | 7 | ||||
-rw-r--r-- | sw/source/ui/misc/bookmark.cxx | 68 | ||||
-rw-r--r-- | sw/source/ui/misc/bookmark.hrc | 25 | ||||
-rw-r--r-- | sw/source/ui/misc/bookmark.src | 73 | ||||
-rw-r--r-- | sw/source/ui/utlui/swrenamexnameddlg.cxx | 1 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/insertbookmark.ui | 91 |
13 files changed, 159 insertions, 143 deletions
diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk index bf8ba798a106..fbd038fd98c3 100644 --- a/sw/AllLangResTarget_sw.mk +++ b/sw/AllLangResTarget_sw.mk @@ -141,7 +141,6 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\ sw/source/ui/index/multmrk.src \ sw/source/ui/lingu/olmenu.src \ sw/source/ui/misc/autocorr.src \ - sw/source/ui/misc/bookmark.src \ sw/source/ui/misc/docfnote.src \ sw/source/ui/misc/glosbib.src \ sw/source/ui/misc/glossary.src \ diff --git a/sw/UI_swriter.mk b/sw/UI_swriter.mk index ca8535f6890a..890ae28e1c7d 100644 --- a/sw/UI_swriter.mk +++ b/sw/UI_swriter.mk @@ -18,6 +18,7 @@ $(eval $(call gb_UI_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/endnotepage \ sw/uiconfig/swriter/ui/footnotepage \ sw/uiconfig/swriter/ui/indexentry \ + sw/uiconfig/swriter/ui/insertbookmark \ sw/uiconfig/swriter/ui/insertbreak \ sw/uiconfig/swriter/ui/insertfootnote \ sw/uiconfig/swriter/ui/insertscript \ diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index e0f55ae0dab1..a7ed844a4afb 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -65,6 +65,8 @@ #define STR_FOOTNOTE_DIALOG_CHAR (RC_GLOBALS_BEGIN + 39) +#define STR_REMOVE_WARNING (RC_GLOBALS_BEGIN + 40) + // DIALOGS ----------------------------------------------------------- #define DLG_THESAURUS (RC_GLOBALS_BEGIN + 2) diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src index c730e9fec5ee..d56012d7df65 100644 --- a/sw/source/ui/app/app.src +++ b/sw/source/ui/app/app.src @@ -225,6 +225,11 @@ String STR_FOOTNOTE_DIALOG_CHAR Text [ en-US ] = "Character" ; }; +String STR_REMOVE_WARNING +{ + Text [ en-US ] = "The following characters are not valid and have been removed: "; +}; + InfoBox MSG_ERROR_SEND_MAIL { BUTTONS = WB_OK ; diff --git a/sw/source/ui/cctrl/swlbox.cxx b/sw/source/ui/cctrl/swlbox.cxx index 939ac31257be..6e6a85b6fea3 100644 --- a/sw/source/ui/cctrl/swlbox.cxx +++ b/sw/source/ui/cctrl/swlbox.cxx @@ -49,10 +49,22 @@ SwBoxEntry::SwBoxEntry(const SwBoxEntry& rOld) : { } -SwComboBox::SwComboBox(Window* pParent, const ResId& rId, sal_uInt16 nStyleBits ): +SwComboBox::SwComboBox(Window* pParent, sal_uInt16 nStyleBits) : + ComboBox(pParent), + nStyle(nStyleBits) +{ + Init(); +} + +SwComboBox::SwComboBox(Window* pParent, const ResId& rId, sal_uInt16 nStyleBits) : ComboBox(pParent, rId), nStyle(nStyleBits) { + Init(); +} + +void SwComboBox::Init() +{ // create administration for the resource's Stringlist sal_uInt16 nSize = GetEntryCount(); for( sal_uInt16 i=0; i < nSize; ++i ) diff --git a/sw/source/ui/inc/bookmark.hxx b/sw/source/ui/inc/bookmark.hxx index d7fc9c56ebe4..80cf41bd2a10 100644 --- a/sw/source/ui/inc/bookmark.hxx +++ b/sw/source/ui/inc/bookmark.hxx @@ -37,6 +37,7 @@ class BookmarkCombo : public SwComboBox virtual long PreNotify(NotifyEvent& rNEvt); public: + BookmarkCombo( Window* pWin ); BookmarkCombo( Window* pWin, const ResId& rResId ); sal_uInt16 GetSelectEntryCount() const; @@ -47,23 +48,21 @@ public: class SwInsertBookmarkDlg: public SvxStandardDialog { - FixedLine aBookmarkFl; - BookmarkCombo aBookmarkBox; - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aDeleteBtn; + BookmarkCombo* m_pBookmarkBox; + OKButton* m_pOkBtn; + PushButton* m_pDeleteBtn; String sRemoveWarning; SwWrtShell &rSh; SfxRequest& rReq; - DECL_LINK( ModifyHdl, BookmarkCombo * ); + DECL_LINK(ModifyHdl, BookmarkCombo *); DECL_LINK(DeleteHdl, void *); virtual void Apply(); public: - SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rSh, SfxRequest& rReq ); + SwInsertBookmarkDlg(Window *pParent, SwWrtShell &rSh, SfxRequest& rReq); ~SwInsertBookmarkDlg(); }; diff --git a/sw/source/ui/inc/misc.hrc b/sw/source/ui/inc/misc.hrc index ebaae1552d8a..ac8c0cff42af 100644 --- a/sw/source/ui/inc/misc.hrc +++ b/sw/source/ui/inc/misc.hrc @@ -51,7 +51,6 @@ #define STR_SAVE_GLOSSARY (RC_MISC_BEGIN + 46) #define MN_REDLINE_POPUP (RC_MISC_BEGIN + 61) -#define STR_REMOVE_WARNING (RC_MISC_BEGIN + 62) #define STRRES_NUMTYPES (RC_MISC_BEGIN + 63) #define STR_MY_AUTOTEXT (RC_MISC_BEGIN + 64) diff --git a/sw/source/ui/inc/swlbox.hxx b/sw/source/ui/inc/swlbox.hxx index 4caac938ce06..3aca77b8afe7 100644 --- a/sw/source/ui/inc/swlbox.hxx +++ b/sw/source/ui/inc/swlbox.hxx @@ -71,8 +71,9 @@ class SW_DLLPUBLIC SwComboBox : public ComboBox SwBoxEntry aDefault; sal_uInt16 nStyle; - SW_DLLPRIVATE void InitComboBox(); - SW_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry); + SW_DLLPRIVATE void InitComboBox(); + SW_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry); + SW_DLLPRIVATE void Init(); using ComboBox::InsertEntry; using ComboBox::RemoveEntry; @@ -82,6 +83,8 @@ public: using ComboBox::GetEntryPos; + SwComboBox(Window* pParent, + sal_uInt16 nStyleBits = nsSwComboBoxStyle::CBS_ALL); SwComboBox(Window* pParent, const ResId& rId, sal_uInt16 nStyleBits = nsSwComboBoxStyle::CBS_ALL); ~SwComboBox(); diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 9c76188b147e..06411f97c469 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -29,8 +29,7 @@ #include "cmdid.h" #include "bookmark.hxx" // SwInsertBookmarkDlg #include "IMark.hxx" -#include "bookmark.hrc" -#include "misc.hrc" +#include "globals.hrc" const String BookmarkCombo::aForbiddenChars = rtl::OUString("/\\@:*?\";,.#"); @@ -62,8 +61,8 @@ IMPL_LINK( SwInsertBookmarkDlg, ModifyHdl, BookmarkCombo *, pBox ) } - aOkBtn.Enable(!bSelEntries); // new text mark - aDeleteBtn.Enable(bSelEntries); // deletable? + m_pOkBtn->Enable(!bSelEntries); // new text mark + m_pDeleteBtn->Enable(bSelEntries); // deletable? return 0; } @@ -75,13 +74,13 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, DeleteHdl) { // remove text marks from the ComboBox - for (sal_uInt16 i = aBookmarkBox.GetSelectEntryCount(); i; i-- ) - aBookmarkBox.RemoveEntry(aBookmarkBox.GetSelectEntryPos(i - 1)); + for (sal_uInt16 i = m_pBookmarkBox->GetSelectEntryCount(); i; i-- ) + m_pBookmarkBox->RemoveEntry(m_pBookmarkBox->GetSelectEntryPos(i - 1)); - aBookmarkBox.SetText(aEmptyStr); - aDeleteBtn.Enable(sal_False); // no further entries there + m_pBookmarkBox->SetText(aEmptyStr); + m_pDeleteBtn->Enable(sal_False); // no further entries there - aOkBtn.Enable(); // the OK handler deletes + m_pOkBtn->Enable(); // the OK handler deletes return 0; } @@ -93,9 +92,9 @@ void SwInsertBookmarkDlg::Apply() { //at first remove deleted bookmarks to prevent multiple bookmarks with the same //name - for (sal_uInt16 nCount = aBookmarkBox.GetRemovedCount(); nCount > 0; nCount--) + for (sal_uInt16 nCount = m_pBookmarkBox->GetRemovedCount(); nCount > 0; nCount--) { - String sRemoved = aBookmarkBox.GetRemovedEntry( nCount -1 ).GetName(); + String sRemoved = m_pBookmarkBox->GetRemovedEntry( nCount -1 ).GetName(); IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); pMarkAccess->deleteMark( pMarkAccess->findMark(sRemoved) ); SfxRequest aReq( rSh.GetView().GetViewFrame(), FN_DELETE_BOOKMARK ); @@ -104,13 +103,13 @@ void SwInsertBookmarkDlg::Apply() } // insert text mark - sal_uInt16 nLen = aBookmarkBox.GetText().Len(); - SwBoxEntry aTmpEntry(aBookmarkBox.GetText(), 0 ); + sal_uInt16 nLen = m_pBookmarkBox->GetText().Len(); + SwBoxEntry aTmpEntry(m_pBookmarkBox->GetText(), 0 ); - if ( nLen && (aBookmarkBox.GetEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND) ) + if ( nLen && (m_pBookmarkBox->GetEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND) ) { - String sEntry(comphelper::string::remove(aBookmarkBox.GetText(), - aBookmarkBox.GetMultiSelectionSeparator())); + String sEntry(comphelper::string::remove(m_pBookmarkBox->GetText(), + m_pBookmarkBox->GetMultiSelectionSeparator())); rSh.SetBookmark( KeyCode(), sEntry, aEmptyStr ); rReq.AppendItem( SfxStringItem( FN_INSERT_BOOKMARK, sEntry ) ); @@ -122,25 +121,20 @@ void SwInsertBookmarkDlg::Apply() } -/*------------------------------------------------------------------------ - Description: CTOR - -----------------------------------------------------------------------*/ SwInsertBookmarkDlg::SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rS, SfxRequest& rRequest ) : - - SvxStandardDialog(pParent,SW_RES(DLG_INSERT_BOOKMARK)), - aBookmarkFl(this,SW_RES(FL_BOOKMARK)), - aBookmarkBox(this,SW_RES(CB_BOOKMARK)), - aOkBtn(this,SW_RES(BT_OK)), - aCancelBtn(this,SW_RES(BT_CANCEL)), - aDeleteBtn(this,SW_RES(BT_DELETE)), + SvxStandardDialog(pParent, "InsertBookmarkDialog", "modules/swriter/ui/insertbookmark.ui"), rSh( rS ), rReq( rRequest ) { - aBookmarkBox.SetModifyHdl(LINK(this, SwInsertBookmarkDlg, ModifyHdl)); - aBookmarkBox.EnableMultiSelection(sal_True); - aBookmarkBox.EnableAutocomplete( sal_True, sal_True ); + get(m_pBookmarkBox, "bookmarks"); + get(m_pOkBtn, "ok"); + get(m_pDeleteBtn, "delete"); - aDeleteBtn.SetClickHdl(LINK(this, SwInsertBookmarkDlg, DeleteHdl)); + m_pBookmarkBox->SetModifyHdl(LINK(this, SwInsertBookmarkDlg, ModifyHdl)); + m_pBookmarkBox->EnableMultiSelection(sal_True); + m_pBookmarkBox->EnableAutocomplete( sal_True, sal_True ); + + m_pDeleteBtn->SetClickHdl(LINK(this, SwInsertBookmarkDlg, DeleteHdl)); // fill Combobox with existing bookmarks IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); @@ -150,9 +144,9 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rS, SfxRe ++ppBookmark) { if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark)) - aBookmarkBox.InsertEntry( SwBoxEntry( ppBookmark->get()->GetName(), nId++ ) ); + m_pBookmarkBox->InsertEntry( SwBoxEntry( ppBookmark->get()->GetName(), nId++ ) ); } - FreeResource(); + sRemoveWarning = String(SW_RES(STR_REMOVE_WARNING)); } @@ -160,6 +154,11 @@ SwInsertBookmarkDlg::~SwInsertBookmarkDlg() { } +BookmarkCombo::BookmarkCombo(Window* pWin) : + SwComboBox(pWin) +{ +} + BookmarkCombo::BookmarkCombo( Window* pWin, const ResId& rResId ) : SwComboBox(pWin, rResId) { @@ -243,4 +242,9 @@ long BookmarkCombo::PreNotify( NotifyEvent& rNEvt ) return nHandled; } +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeBookmarkCombo(Window* pParent) +{ + return new BookmarkCombo(pParent); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/bookmark.hrc b/sw/source/ui/misc/bookmark.hrc deleted file mode 100644 index 85414ef24486..000000000000 --- a/sw/source/ui/misc/bookmark.hrc +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 CB_BOOKMARK 1 -#define FL_BOOKMARK 2 - -#define BT_OK 20 -#define BT_CANCEL 21 -#define BT_DELETE 22 diff --git a/sw/source/ui/misc/bookmark.src b/sw/source/ui/misc/bookmark.src deleted file mode 100644 index f9fe03915c11..000000000000 --- a/sw/source/ui/misc/bookmark.src +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 "misc.hrc" -#include "bookmark.hrc" -#include "cmdid.h" -#include "helpid.h" -ModalDialog DLG_INSERT_BOOKMARK -{ - HelpID = CMD_FN_INSERT_BOOKMARK ; - OUTPUTSIZE = TRUE ; - Size = MAP_APPFONT ( 179 , 96 ) ; - Text [ en-US ] = "Insert Bookmark" ; - MOVEABLE = TRUE ; - SVLOOK = TRUE ; - OkButton BT_OK - { - DISABLE = TRUE ; - Pos = MAP_APPFONT ( 123 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TABSTOP = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 123 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TABSTOP = TRUE ; - }; - ComboBox CB_BOOKMARK - { - HelpID = "sw:ComboBox:DLG_INSERT_BOOKMARK:CB_BOOKMARK"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 99 , 76 ) ; - TABSTOP = TRUE ; - AutoHScroll = TRUE ; - SORT = TRUE ; - }; - PushButton BT_DELETE - { - HelpID = "sw:PushButton:DLG_INSERT_BOOKMARK:BT_DELETE"; - Pos = MAP_APPFONT ( 123 , 40 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TABSTOP = TRUE ; - DISABLE = TRUE ; - }; - FixedLine FL_BOOKMARK - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 111 , 8 ) ; - Text [ en-US ] = "Bookmarks" ; - }; -}; -String STR_REMOVE_WARNING -{ - Text [ en-US ] = "The following characters are not valid and have been removed: "; -}; diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 578d104797f0..1b18b30b21ec 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -19,7 +19,6 @@ #include <swtypes.hxx> #include <globals.hrc> -#include <misc.hrc> #include <utlui.hrc> #include <unotools.hrc> diff --git a/sw/uiconfig/swriter/ui/insertbookmark.ui b/sw/uiconfig/swriter/ui/insertbookmark.ui new file mode 100644 index 000000000000..86793d5652a5 --- /dev/null +++ b/sw/uiconfig/swriter/ui/insertbookmark.ui @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="InsertBookmarkDialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">Insert Bookmark</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">2</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="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_action_appearance">False</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_action_appearance">False</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="delete"> + <property name="label" translatable="yes">Delete</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_action_appearance">False</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="swuilo:BookmarkCombo" id="bookmarks"> + <property name="width_request">150</property> + <property name="height_request">200</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">delete</action-widget> + </action-widgets> + </object> +</interface> |