summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2017-03-16 18:09:20 +0100
committerMichael Stahl <mstahl@redhat.com>2017-04-18 16:24:37 +0200
commite2d3e936ab03274696f235c9d74e247380070f6f (patch)
tree2737c6251ab44f4b5c772429b7d42a3414d9fb89 /sfx2/source
parentf3ab7e1403f60ad4f9137e68241e68aa06b2fb1e (diff)
tdf#95992 "Edit" > "Compare Document..." opens dialog that is...
misnamed "Insert" Issue is that the caption of the dialog is handled by generic code, which was not designed with comparison in mind. This fix extends the captions that can be used by such generic codes, without modifying the underlaying architecture. Letting callers directly provide caption text might be more versatile, though. The fix is extended to: * Writer Merge functionality * Calc Compare/Merge functionalities which use the same dialog (and thus were also displaying "Insert"). Change-Id: I452b37bf7d0024924c87316cd47572c09b373b65 Reviewed-on: https://gerrit.libreoffice.org/35285 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx17
-rw-r--r--sfx2/source/dialog/filedlghelper.src10
-rw-r--r--sfx2/source/doc/docinsert.cxx32
3 files changed, 53 insertions, 6 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 75f6c16ca182..5782802cf201 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -887,7 +887,9 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
mbHasPreview = false;
mbShowPreview = false;
mbDeleteMatcher = false;
- mbInsert = bool(nFlags & FileDialogFlags::Insert);
+ mbInsert = bool(nFlags & (FileDialogFlags::Insert|
+ FileDialogFlags::InsertCompare|
+ FileDialogFlags::InsertMerge));
mbExport = bool(nFlags & FileDialogFlags::Export);
mbIsSaveDlg = false;
mbPwdCheckBoxState = false;
@@ -1106,7 +1108,18 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
// the "insert file" dialog needs another title
if ( mbInsert )
{
- mxFileDlg->setTitle( SfxResId( STR_SFX_EXPLORERFILE_INSERT ).toString() );
+ if ( nFlags & FileDialogFlags::InsertCompare )
+ {
+ mxFileDlg->setTitle( SfxResId( STR_PB_COMPAREDOC ).toString() );
+ }
+ else if ( nFlags & FileDialogFlags::InsertMerge )
+ {
+ mxFileDlg->setTitle( SfxResId( STR_PB_MERGEDOC ).toString() );
+ }
+ else
+ {
+ mxFileDlg->setTitle( SfxResId( STR_SFX_EXPLORERFILE_INSERT ).toString() );
+ }
uno::Reference < XFilePickerControlAccess > xExtDlg( mxFileDlg, UNO_QUERY );
if ( xExtDlg.is() )
{
diff --git a/sfx2/source/dialog/filedlghelper.src b/sfx2/source/dialog/filedlghelper.src
index a8bb9888600b..1e777e20353a 100644
--- a/sfx2/source/dialog/filedlghelper.src
+++ b/sfx2/source/dialog/filedlghelper.src
@@ -50,6 +50,16 @@ String STR_PB_SAVEACOPY
Text [ en-US ] = "Save a Copy" ;
};
+String STR_PB_COMPAREDOC
+{
+ Text [ en-US ] = "Compare to" ;
+};
+
+String STR_PB_MERGEDOC
+{
+ Text [ en-US ] = "Merge with" ;
+};
+
//******************************************************************** EOF
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index 6288d5ce765c..29cd9ee68808 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -46,15 +46,39 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
+namespace
+{
+
+FileDialogFlags lcl_map_mode_to_flags(const sfx2::DocumentInserter::Mode mode)
+{
+ FileDialogFlags f {FileDialogFlags::NONE};
+ switch (mode)
+ {
+ case sfx2::DocumentInserter::Mode::Insert:
+ f = FileDialogFlags::Insert;
+ break;
+ case sfx2::DocumentInserter::Mode::InsertMulti:
+ f = FileDialogFlags::Insert|FileDialogFlags::MultiSelection;
+ break;
+ case sfx2::DocumentInserter::Mode::Compare:
+ f = FileDialogFlags::InsertCompare;
+ break;
+ case sfx2::DocumentInserter::Mode::Merge:
+ f = FileDialogFlags::InsertMerge;
+ break;
+ }
+ return f;
+}
+
+}
+
namespace sfx2 {
DocumentInserter::DocumentInserter(
- const OUString& rFactory, bool const bEnableMultiSelection) :
+ const OUString& rFactory, const Mode mode) :
m_sDocFactory ( rFactory )
- , m_nDlgFlags ( (bEnableMultiSelection)
- ? (FileDialogFlags::Insert|FileDialogFlags::MultiSelection)
- : FileDialogFlags::Insert )
+ , m_nDlgFlags ( lcl_map_mode_to_flags(mode) )
, m_nError ( ERRCODE_NONE )
, m_pFileDlg ( nullptr )
, m_pItemSet ( nullptr )