summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-12-10 22:30:31 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-12-10 22:30:31 -0500
commitc7239b29c9a6d27572e943c285f397c1a67b795b (patch)
tree0e2f26276a8bacdf18cc6c420134f18e20c5ed65
parentf76b185817308f3be5b704fa779fe919d4395dd7 (diff)
Get HYPERLINK to work with Excel reference syntax.
Change-Id: Ia19d77481ced3fc4a61e3dc895e4547054c3395c
-rw-r--r--sc/source/core/tool/address.cxx17
-rw-r--r--sc/source/ui/view/gridwin.cxx15
2 files changed, 31 insertions, 1 deletions
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 8af1314af2e4..8307d0632ed8 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -165,7 +165,24 @@ static bool lcl_ScRange_External_TabSpan(
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
if (pRefMgr->isOwnDocument( rExternDocName))
+ {
+ // This is an internal document. Get the sheet positions from the
+ // ScDocument instance.
+ if (rStartTabName.Len())
+ {
+ SCTAB nTab;
+ if (pDoc->GetTable(rStartTabName, nTab))
+ rRange.aStart.SetTab(nTab);
+ }
+
+ if (rEndTabName.Len())
+ {
+ SCTAB nTab;
+ if (pDoc->GetTable(rEndTabName, nTab))
+ rRange.aEnd.SetTab(nTab);
+ }
return !pExtInfo || !pExtInfo->mbExternal;
+ }
sal_uInt16 nFileId = pRefMgr->getExternalFileId( rExternDocName);
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 88f7ab37c69c..78da78e4f5d5 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2386,7 +2386,20 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
if ( GetEditUrl( rMEvt.GetPosPixel(), &aName, &aUrl, &aTarget ) )
{
nMouseStatus = SC_GM_NONE; // keinen Doppelklick anfangen
- ScGlobal::OpenURL( aUrl, aTarget );
+ ScAddress aTempAddr;
+ if (pDoc->GetAddressConvention() == formula::FormulaGrammar::CONV_OOO)
+ ScGlobal::OpenURL(aUrl, aTarget);
+ else
+ {
+ // Formula syntax is not Calc A1. Convert it to Calc A1 before calling OpenURL().
+ aTempAddr.Parse(aUrl, pDoc, pDoc->GetAddressConvention());
+ rtl::OUString aUrlCalcA1;
+ aTempAddr.Format(aUrlCalcA1, SCA_ABS_3D, pDoc, formula::FormulaGrammar::CONV_OOO);
+ rtl::OUStringBuffer aBuf;
+ aBuf.append('#').append(aUrlCalcA1);
+ aUrlCalcA1 = aBuf.makeStringAndClear();
+ ScGlobal::OpenURL(aUrlCalcA1, aTarget);
+ }
// fire worksheet_followhyperlink event
uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();