summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx6
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h2
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx4
-rw-r--r--include/vcl/ITiledRenderable.hxx2
-rw-r--r--sc/inc/docuno.hxx2
-rw-r--r--sc/source/ui/app/inputhdl.cxx16
-rw-r--r--sc/source/ui/inc/inputhdl.hxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
8 files changed, 22 insertions, 18 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 648e7421c54f..060a36581223 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1143,7 +1143,7 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
const int nWidth, const int nHeight);
-static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex);
+static void doc_completeFunction(LibreOfficeKitDocument* pThis, const char*);
static void doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis,
@@ -5529,7 +5529,7 @@ static void doc_resizeWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWin
pWindow->SetSizePixel(Size(nWidth, nHeight));
}
-static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex)
+static void doc_completeFunction(LibreOfficeKitDocument* pThis, const char* pFunctionName)
{
SolarMutexGuard aGuard;
SetLastExceptionMsg();
@@ -5541,7 +5541,7 @@ static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex)
return;
}
- pDoc->completeFunction(nIndex);
+ pDoc->completeFunction(OUString::fromUtf8(pFunctionName));
}
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 309744522004..8b68452697b3 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -437,7 +437,7 @@ struct _LibreOfficeKitDocumentClass
int viewId);
/// @see lok::Document::completeFunction().
- void (*completeFunction) (LibreOfficeKitDocument* pThis, int nIndex);
+ void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* pFunctionName);
/// @see lok::Document::setWindowTextSelection
void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 8be29ff1e192..91ece38c96a4 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -762,9 +762,9 @@ public:
*
* @param nIndex is the index of the selected function
*/
- void completeFunction(int nIndex)
+ void completeFunction(const char* pFunctionName)
{
- mpDoc->pClass->completeFunction(mpDoc, nIndex);
+ mpDoc->pClass->completeFunction(mpDoc, pFunctionName);
}
/**
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 5bd83d5ef2d4..833f76c0dcde 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -287,7 +287,7 @@ public:
virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
/// @see lok::Document::completeFunction().
- virtual void completeFunction(int /*nIndex*/)
+ virtual void completeFunction(const OUString& /*rFunctionName*/)
{
}
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index f2adcda7a80f..0f74bd9451b5 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -385,7 +385,7 @@ public:
OUString getPostItsPos() override;
/// @see vcl::ITiledRenderable::completeFunction().
- virtual void completeFunction(int nIndex) override;
+ virtual void completeFunction(const OUString& rFunctionName) override;
};
class ScDrawPagesObj final : public cppu::WeakImplHelper<
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2e47b1205025..7547a5240dfe 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1625,7 +1625,7 @@ void ScInputHandler::PasteFunctionData()
pActiveView->ShowCursor();
}
-void ScInputHandler::LOKPasteFunctionData( sal_uInt32 nIndex )
+void ScInputHandler::LOKPasteFunctionData(const OUString& rFunctionName)
{
if (pActiveViewSh && (pTopView || pTableView))
{
@@ -1648,12 +1648,16 @@ void ScInputHandler::LOKPasteFunctionData( sal_uInt32 nIndex )
InputReplaceSelection( aNewFormula );
}
- if (pFormulaData && nIndex < pFormulaData->size())
+ if (pFormulaData)
{
- auto aPos = pFormulaData->begin();
- std::advance(aPos, nIndex);
- miAutoPosFormula = aPos;
- PasteFunctionData();
+ OUString aNew;
+ ScTypedCaseStrSet::const_iterator aPos = findText(*pFormulaData, pFormulaData->begin(), rFunctionName, aNew, /* backward = */false);
+
+ if (aPos != pFormulaData->end())
+ {
+ miAutoPosFormula = aPos;
+ PasteFunctionData();
+ }
}
}
}
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 71dfec832de5..6faee3c8f646 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -288,7 +288,7 @@ public:
long nX1, long nX2, long nY1, long nY2,
long nTab, const Color& rColor );
- void LOKPasteFunctionData( sal_uInt32 nIndex );
+ void LOKPasteFunctionData(const OUString& rFunctionName);
};
// ScInputHdlState
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index e64bf7052b30..a1256c17f0b2 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1077,13 +1077,13 @@ OUString ScModelObj::getPostItsPos()
return OUString::fromUtf8(aStream.str().c_str());
}
-void ScModelObj::completeFunction(int nIndex)
+void ScModelObj::completeFunction(const OUString& rFunctionName)
{
ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
if (pHdl)
{
- assert(nIndex >= 0);
- pHdl->LOKPasteFunctionData(nIndex);
+ assert(!rFunctionName.isEmpty());
+ pHdl->LOKPasteFunctionData(rFunctionName);
}
}