summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2020-10-31 19:20:14 +0100
committerEike Rathke <erack@redhat.com>2020-10-31 21:30:48 +0100
commit8720ccc3fb40a9e0df0b0c62d0854f744fa715f8 (patch)
treea02fbbed899cfb6d20ac43d48fbb1004fe64bde0
parentc87a70c9f66256c85df7e7d33c3ebb46782593a7 (diff)
Resolves: tdf#137896 Paste sheet-local names with sheet name prefix
Change-Id: Ib1779bb42c8b26a825899f8a93bc22b7ee441637 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105124 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/ui/inc/namepast.hxx1
-rw-r--r--sc/source/ui/namedlg/namepast.cxx9
2 files changed, 9 insertions, 1 deletions
diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx
index b5f09be8b628..cc54ed26e5d0 100644
--- a/sc/source/ui/inc/namepast.hxx
+++ b/sc/source/ui/inc/namepast.hxx
@@ -41,6 +41,7 @@ private:
std::vector<OUString> maSelectedNames;
std::map<OUString, std::unique_ptr<ScRangeName>> m_RangeMap;
+ OUString m_aSheetSep;
public:
ScNamePasteDlg(weld::Window* pParent, ScDocShell* pShell);
diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx
index 97b04395de43..491c69e0f7ba 100644
--- a/sc/source/ui/namedlg/namepast.cxx
+++ b/sc/source/ui/namedlg/namepast.cxx
@@ -24,6 +24,8 @@
#include <rangenam.hxx>
#include <viewdata.hxx>
#include <scui_def.hxx>
+#include <globstr.hrc>
+#include <scresid.hxx>
ScNamePasteDlg::ScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell)
: GenericDialogController(pParent, "modules/scalc/ui/insertname.ui", "InsertNameDialog")
@@ -32,6 +34,7 @@ ScNamePasteDlg::ScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell)
, m_xBtnClose(m_xBuilder->weld_button("close"))
{
ScDocument& rDoc = pShell->GetDocument();
+ m_aSheetSep = OUString( rDoc.GetSheetSeparator());
std::map<OUString, ScRangeName*> aCopyMap;
rDoc.GetRangeNameMap(aCopyMap);
for (const auto& [aTemp, pName] : aCopyMap)
@@ -70,10 +73,14 @@ IMPL_LINK(ScNamePasteDlg, ButtonHdl, weld::Button&, rButton, void)
}
else if (&rButton == m_xBtnPaste.get())
{
+ const OUString aGlobalScope( ScResId( STR_GLOBAL_SCOPE));
std::vector<ScRangeNameLine> aSelectedLines = m_xTable->GetSelectedEntries();
for (const auto& rLine : aSelectedLines)
{
- maSelectedNames.push_back(rLine.aName);
+ if (rLine.aScope == aGlobalScope)
+ maSelectedNames.push_back(rLine.aName);
+ else
+ maSelectedNames.push_back(rLine.aScope + m_aSheetSep + rLine.aName);
}
m_xDialog->response(BTN_PASTE_NAME);
}