diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2017-03-16 18:09:20 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-04-18 16:24:37 +0200 |
commit | e2d3e936ab03274696f235c9d74e247380070f6f (patch) | |
tree | 2737c6251ab44f4b5c772429b7d42a3414d9fb89 /sfx2/source/doc/docinsert.cxx | |
parent | f3ab7e1403f60ad4f9137e68241e68aa06b2fb1e (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/doc/docinsert.cxx')
-rw-r--r-- | sfx2/source/doc/docinsert.cxx | 32 |
1 files changed, 28 insertions, 4 deletions
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 ) |