summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-04-19 21:23:37 +0200
committerEike Rathke <erack@redhat.com>2017-04-19 21:35:09 +0200
commitca8f4a66e44aed731646066241cf2225bb9f8c2a (patch)
tree41c9cdc423f701f02bc9dff39785c818d7f8750a
parent9b2ceeba47760dc92c7e91bea3c2d538afec25bc (diff)
Resolves: tdf#90799 generate absolute sheet for pointer-selected references
In the assumption that users who more use a pointer device to enter references are also likely less familiar with the difference between relative and absolute sheet references and its implication when copying sheets, which some other spreadsheet software doesn't offer. Change-Id: Ia1e16d1fef47429d4f4c100cac699bbc446ba6c9
-rw-r--r--sc/inc/address.hxx2
-rw-r--r--sc/source/ui/app/inputhdl.cxx6
-rw-r--r--sc/source/ui/formdlg/formula.cxx6
3 files changed, 11 insertions, 3 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index f2ac3595b6c7..9203eec2928e 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -158,6 +158,8 @@ enum class ScRefFlags : sal_uInt16
TAB2_VALID = 0x4000,
VALID = 0x8000,
+ TAB_ABS_3D = TAB_ABS | TAB_3D,
+
ADDR_ABS = VALID | COL_ABS | ROW_ABS | TAB_ABS,
RANGE_ABS = ADDR_ABS | COL2_ABS | ROW2_ABS | TAB2_ABS,
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 5e53c347a843..787835b0a4f5 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3071,7 +3071,8 @@ void ScInputHandler::SetReference( const ScRange& rRef, ScDocument* pDoc )
// Reference to other document
OSL_ENSURE(rRef.aStart.Tab()==rRef.aEnd.Tab(), "nStartTab!=nEndTab");
- OUString aTmp(rRef.Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pDoc, aAddrDetails)); // Always 3D
+ // Always 3D and absolute.
+ OUString aTmp(rRef.Format( ScRefFlags::VALID | ScRefFlags::TAB_ABS_3D, pDoc, aAddrDetails));
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
// #i75893# convert escaped URL of the document to something user friendly
@@ -3095,7 +3096,8 @@ void ScInputHandler::SetReference( const ScRange& rRef, ScDocument* pDoc )
{
if ( rRef.aStart.Tab() != aCursorPos.Tab() ||
rRef.aStart.Tab() != rRef.aEnd.Tab() )
- aRefStr = rRef.Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pDoc, aAddrDetails);
+ // pointer-selected => absolute sheet reference
+ aRefStr = rRef.Format(ScRefFlags::VALID | ScRefFlags::TAB_ABS_3D, pDoc, aAddrDetails);
else
aRefStr = rRef.Format(ScRefFlags::VALID, pDoc, aAddrDetails);
}
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index b1d4dcebfe3c..9491ee964788 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -400,7 +400,8 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc )
OSL_ENSURE(rRef.aStart.Tab()==rRef.aEnd.Tab(), "nStartTab!=nEndTab");
- OUString aTmp(rRef.Format(ScRefFlags::VALID|ScRefFlags::TAB_3D, pRefDoc)); // immer 3d
+ // Always 3D and absolute.
+ OUString aTmp( rRef.Format( ScRefFlags::VALID | ScRefFlags::TAB_ABS_3D, pRefDoc));
SfxObjectShell* pObjSh = pRefDoc->GetDocumentShell();
@@ -420,7 +421,10 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc )
aRefData.InitRangeRel(rRef, m_CursorPos);
bool bSingle = aRefData.Ref1 == aRefData.Ref2;
if (m_CursorPos.Tab() != rRef.aStart.Tab())
+ {
aRefData.Ref1.SetFlag3D(true);
+ aRefData.Ref1.SetTabRel(false); // pointer-selected => absolute sheet reference
+ }
if (bSingle)
aArray.AddSingleReference(aRefData.Ref1);
else