[Libreoffice-commits] .: Branch 'feature/improvexlsximport' - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 10 19:29:51 PST 2012


 sc/source/core/tool/address.cxx |   17 +++++++++++++++++
 sc/source/ui/view/gridwin.cxx   |   15 ++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit c7239b29c9a6d27572e943c285f397c1a67b795b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Dec 10 22:30:31 2012 -0500

    Get HYPERLINK to work with Excel reference syntax.
    
    Change-Id: Ia19d77481ced3fc4a61e3dc895e4547054c3395c

diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 8af1314..8307d06 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 88f7ab3..78da78e 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();


More information about the Libreoffice-commits mailing list