Kaydet (Commit) 42f6308d authored tarafından Jack Leigh's avatar Jack Leigh Kaydeden (comit) Caolán McNamara

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
üst 20759742
......@@ -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 \
......
......@@ -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 \
......
......@@ -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)
......
......@@ -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 ;
......
......@@ -49,9 +49,21 @@ 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();
......
......@@ -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();
};
......
......@@ -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)
......
......@@ -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();
......
......@@ -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: */
/*
* 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
/*
* 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: ";
};
......@@ -19,7 +19,6 @@
#include <swtypes.hxx>
#include <globals.hrc>
#include <misc.hrc>
#include <utlui.hrc>
#include <unotools.hrc>
......
<?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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment