summaryrefslogtreecommitdiff
path: root/cui/source/dialogs
diff options
context:
space:
mode:
authorThomas Arnhold <thomas@arnhold.org>2014-08-17 13:34:20 +0200
committerThomas Arnhold <thomas@arnhold.org>2014-08-22 21:33:06 -0500
commitf4246fab77113147b36706a1f3d93e8724ff826b (patch)
treed0643b5165f665eaee3b32cf1555fe5728cbbb56 /cui/source/dialogs
parentc8a3b2d14c4942aa7d0d325a7b925f93b985161c (diff)
fdo#56456 fdo#75578 fdo#63271 fdo#75805 Improve hyperlink dialog
Changes made: * Rename "Back" to "Reset" like in other dialogs (eg. Writer - Format - Character). * Apply-Button, which reflects the old behavior of the dialog, and doesn't close it automatically. * Added an OK-Button, which applies the changes made and automatically closes the dialog. With this both use cases should be handled: * Inserting one single URI with simple close. * Modifying multiple URIs without closing the dialog. Hopefully all users are happy with this ;) Change-Id: I1881dee083945cd165fbb8f8444395c1b04a0607 Reviewed-on: https://gerrit.libreoffice.org/10946 Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com> Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r--cui/source/dialogs/cuihyperdlg.cxx56
-rw-r--r--cui/source/dialogs/iconcdlg.cxx23
-rw-r--r--cui/source/dialogs/iconcdlg.src26
3 files changed, 56 insertions, 49 deletions
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 5bf73b9415d8..ede512f2a248 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -113,7 +113,6 @@ SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings)
pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
// set OK/Cancel - button
- GetOKButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_APPLYBUT) );
GetCancelButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_CLOSEBUT) );
// create itemset for tabpages
@@ -151,7 +150,8 @@ SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings)
pBindings->Update( SID_READONLY_MODE );
- GetOKButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickApplyHdl_Impl ) );
+ GetOKButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickOkHdl_Impl ) );
+ GetApplyButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickApplyHdl_Impl ) );
GetCancelButton().SetClickHdl( LINK ( this, SvxHpLinkDlg, ClickCloseHdl_Impl ) );
}
@@ -178,6 +178,29 @@ bool SvxHpLinkDlg::Close()
return true;
}
+void SvxHpLinkDlg::Apply()
+{
+ SfxItemSet aItemSet( SfxGetpApp()->GetPool(), SID_HYPERLINK_GETLINK,
+ SID_HYPERLINK_SETLINK );
+
+ SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)
+ GetTabPage ( GetCurPageId() );
+
+ if ( pCurrentPage->AskApply() )
+ {
+ pCurrentPage->FillItemSet( &aItemSet );
+
+ SvxHyperlinkItem *aItem = (SvxHyperlinkItem *)
+ aItemSet.GetItem (SID_HYPERLINK_SETLINK);
+ OUString aStrEmpty;
+ if ( aItem->GetURL() != aStrEmpty )
+ GetDispatcher()->Execute( SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD, aItem, 0L);
+
+ ( (SvxHyperlinkTabPageBase*)GetTabPage ( GetCurPageId() ) )->DoApply();
+ }
+}
+
/*************************************************************************
|*
|* When extrawindow is visible and its never moved by user, then move that
@@ -231,6 +254,15 @@ void SvxHpLinkDlg::Move()
Window::Move();
}
+/// Click on OK button
+IMPL_LINK_NOARG(SvxHpLinkDlg, ClickOkHdl_Impl)
+{
+ Apply();
+ Close();
+
+ return ( 0L );
+}
+
/*************************************************************************
|*
|* Click on Apply-button
@@ -239,25 +271,7 @@ void SvxHpLinkDlg::Move()
IMPL_LINK_NOARG(SvxHpLinkDlg, ClickApplyHdl_Impl)
{
- SfxItemSet aItemSet( SfxGetpApp()->GetPool(), SID_HYPERLINK_GETLINK,
- SID_HYPERLINK_SETLINK );
-
- SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)
- GetTabPage ( GetCurPageId() );
-
- if ( pCurrentPage->AskApply() )
- {
- pCurrentPage->FillItemSet( &aItemSet );
-
- SvxHyperlinkItem *aItem = (SvxHyperlinkItem *)
- aItemSet.GetItem (SID_HYPERLINK_SETLINK);
- OUString aStrEmpty;
- if ( aItem->GetURL() != aStrEmpty )
- GetDispatcher()->Execute( SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON |
- SFX_CALLMODE_RECORD, aItem, 0L);
-
- ( (SvxHyperlinkTabPageBase*)GetTabPage ( GetCurPageId() ) )->DoApply();
- }
+ Apply();
return( 0L );
}
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index eed1d13cd671..4b1e48062e32 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -190,9 +190,10 @@ IconChoiceDialog::IconChoiceDialog ( Window* pParent, const OString& rID,
bItemsReset ( false )
{
get(m_pOKBtn, "ok");
+ get(m_pApplyBtn, "apply");
get(m_pCancelBtn, "cancel");
get(m_pHelpBtn, "help");
- get(m_pResetBtn, "back");
+ get(m_pResetBtn, "reset");
get(m_pIconCtrl, "icon_control");
get(m_pTabContainer, "tab");
@@ -213,11 +214,13 @@ IconChoiceDialog::IconChoiceDialog ( Window* pParent, const OString& rID,
// Buttons
m_pOKBtn->SetClickHdl ( LINK( this, IconChoiceDialog, OkHdl ) );
m_pOKBtn->SetHelpId( HID_ICCDIALOG_OK_BTN );
+ m_pApplyBtn->SetClickHdl ( LINK( this, IconChoiceDialog, ApplyHdl ) );
+ //m_pApplyBtn->SetHelpId( HID_ICCDIALOG_APPLY_BTN );
m_pCancelBtn->SetHelpId( HID_ICCDIALOG_CANCEL_BTN );
m_pResetBtn->SetClickHdl( LINK( this, IconChoiceDialog, ResetHdl ) );
- m_pResetBtn->SetText( CUI_RESSTR(RID_SVXSTR_ICONCHOICEDLG_RESETBUT) );
m_pResetBtn->SetHelpId( HID_ICCDIALOG_RESET_BTN );
m_pOKBtn->Show();
+ m_pApplyBtn->Show();
m_pCancelBtn->Show();
m_pHelpBtn->Show();
m_pResetBtn->Show();
@@ -392,6 +395,22 @@ IMPL_LINK_NOARG(IconChoiceDialog, OkHdl)
}
+IMPL_LINK_NOARG(IconChoiceDialog, ApplyHdl)
+{
+ bInOK = true;
+
+ if ( OK_Impl() )
+ {
+ if ( bModal )
+ EndDialog( Ok() );
+ else
+ {
+ Ok();
+ Close();
+ }
+ }
+ return 0;
+}
IMPL_LINK_NOARG(IconChoiceDialog, ResetHdl)
{
diff --git a/cui/source/dialogs/iconcdlg.src b/cui/source/dialogs/iconcdlg.src
deleted file mode 100644
index 4bcb78627515..000000000000
--- a/cui/source/dialogs/iconcdlg.src
+++ /dev/null
@@ -1,26 +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 <cuires.hrc>
-
-String RID_SVXSTR_ICONCHOICEDLG_RESETBUT
-{
- Text [ en-US ] = "~Back" ;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */