14#include <rtl/strbuf.hxx>
15#include <rtl/character.hxx>
21#include <officecfg/Office/Common.hxx>
22#include <libxml/xpath.h>
25#include <document.hxx>
26#include <tokenarray.hxx>
45 SCSIZE nMatCols = 1, nMatRows = 1, nNode = 0;
56 SCSIZE nCurCol = 0, nCurRow = 0;
91 if (!nMatCols || !nMatRows)
99 if(aString.isEmpty() || aXPathExpression.isEmpty())
105 OString aOXPathExpression =
OUStringToOString( aXPathExpression, RTL_TEXTENCODING_UTF8 );
106 const char* pXPathExpr = aOXPathExpression.getStr();
108 const char* pXML = aOString.getStr();
110 std::shared_ptr<xmlParserCtxt> pContext(
111 xmlNewParserCtxt(), xmlFreeParserCtxt );
113 std::shared_ptr<xmlDoc> pDoc( xmlParseMemory( pXML, aOString.getLength() ),
122 std::shared_ptr<xmlXPathContext> pXPathCtx( xmlXPathNewContext(pDoc.get()),
123 xmlXPathFreeContext );
125 std::shared_ptr<xmlXPathObject> pXPathObj( xmlXPathEvalExpression(BAD_CAST(pXPathExpr), pXPathCtx.get()),
126 xmlXPathFreeObject );
134 switch(pXPathObj->type)
136 case XPATH_UNDEFINED:
141 xmlNodeSetPtr pNodeSet = pXPathObj->nodesetval;
148 const size_t nSize = pNodeSet->nodeNr;
172 for ( ; nNode < nMatRows; ++nNode)
177 if(pNodeSet->nodeTab[nNode]->type == XML_NAMESPACE_DECL)
179 xmlNsPtr
ns =
reinterpret_cast<xmlNsPtr
>(pNodeSet->nodeTab[nNode]);
180 xmlNodePtr cur =
reinterpret_cast<xmlNodePtr
>(
ns->next);
181 std::shared_ptr<xmlChar> pChar2(xmlNodeGetContent(cur), xmlFree);
182 aResult = OStringToOUString(std::string_view(
reinterpret_cast<char*
>(pChar2.get())), RTL_TEXTENCODING_UTF8);
186 xmlNodePtr cur = pNodeSet->nodeTab[nNode];
187 std::shared_ptr<xmlChar> pChar2(xmlNodeGetContent(cur), xmlFree);
188 aResult = OStringToOUString(std::string_view(
reinterpret_cast<char*
>(pChar2.get())), RTL_TEXTENCODING_UTF8);
198 xResMat->PutError( FormulaError::NotAvailable, 0, nNode);
209 bool bVal = pXPathObj->boolval != 0;
215 double fVal = pXPathObj->floatval;
220 PushString(OUString::createFromAscii(
reinterpret_cast<char*
>(pXPathObj->stringval)));
222#if LIBXML_VERSION < 21000 || defined(LIBXML_XPTR_LOCS_ENABLED)
229 case XPATH_LOCATIONSET:
236 case XPATH_XSLT_TREE:
251 if (
pLink->GetURL() == rURL)
263 if (aLink.
DataChanged( OUString(), css::uno::Any()) != sfx2::SvBaseLink::UpdateResult::SUCCESS)
290 if (eProtocol != INetProtocol::Http && eProtocol != INetProtocol::Https)
361 if (
pLink->HasResult())
390 PushError(FormulaError::LinkFormulaNeedingCheck);
393 PushError(FormulaError::LinkFormulaNeedingCheck);
396 PushError(FormulaError::LinkFormulaNeedingCheck);
422 if (
aStr.isEmpty() )
428 OString aUtf8Str(
aStr.toUtf8());
429 const sal_Int32 nLen = aUtf8Str.getLength();
430 OStringBuffer aUrlBuf( nLen );
431 for (
int i = 0;
i < nLen;
i++ )
433 char c = aUtf8Str[
i ];
434 if ( rtl::isAsciiAlphanumeric(
static_cast<unsigned char>( c ) ) || c ==
'-' || c ==
'_' )
438 aUrlBuf.append(
'%' );
439 OString convertedChar = OString::number(
static_cast<unsigned char>( c ), 16 ).toAsciiUpperCase();
444 if (convertedChar.getLength() == 1)
446 aUrlBuf.append(convertedChar);
458 if (!officecfg::Office::Common::Misc::ExperimentalMode::get())
474 OUString aStrUpper(
p);
476 if (aStrUpper ==
"PIVOTCOUNT")
488 else if (aStrUpper ==
"DATASTREAM_IMPORT")
490 else if (aStrUpper ==
"DATASTREAM_RECALC")
492 else if (aStrUpper ==
"DATASTREAM_RENDER")
520 nAlpha = rtl::math::approxFloor(
GetDouble());
522 if(nAlpha < 0 || nAlpha > 255)
528 double nBlue = rtl::math::approxFloor(
GetDouble());
530 if(nBlue < 0 || nBlue > 255)
536 double nGreen = rtl::math::approxFloor(
GetDouble());
538 if(nGreen < 0 || nGreen > 255)
544 double nRed = rtl::math::approxFloor(
GetDouble());
546 if(nRed < 0 || nRed > 255)
552 double nVal = 256*256*256*nAlpha + 256*256*nRed + 256*nGreen + nBlue;
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
INetProtocol GetProtocol() const
SC_DLLPUBLIC size_t GetCount() const
bool IsIdleEnabled() const
SC_DLLPUBLIC bool HasPivotTable() const
SfxBindings * GetViewBindings()
bool HasLinkFormulaNeedingCheck() const
bool IsFunctionAccess() const
void EnableIdle(bool bDo)
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
svl::SharedString GetString()
bool IsInArrayContext() const
bool MustHaveParamCount(short nAct, short nMust)
void PushIllegalParameter()
void PushIllegalArgument()
void ScEncodeURL()
Returns a string in which all non-alphanumeric characters except stroke and underscore (-_) have been...
void PushError(FormulaError nError)
sal_uInt8 GetByte() const
ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty=false)
void PushDouble(double nVal)
const formula::FormulaToken ** pStack
ScJumpMatrix * pJumpMatrix
sfx2::LinkManager * mpLinkManager
void PushMatrix(const sc::RangeMatrix &rMat)
ScFormulaCell * pMyFormulaCell
formula::StackVar GetStackType()
Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formu...
svl::SharedStringPool & mrStrPool
void PushString(const OUString &rStr)
void GetPos(SCSIZE &rCol, SCSIZE &rRow) const
Matrix data type that can store values of mixed types.
void GetDimensions(SCSIZE &rC, SCSIZE &rR) const
const OUString & GetResult() const
virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(const OUString &rMimeType, const css::uno::Any &rValue) override
void Invalidate(sal_uInt16 nId)
bool StartListening(SvtBroadcaster &rBroadcaster)
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
const SvBaseLinks & GetLinks() const
SharedString intern(const OUString &rStr)
const OUString & getString() const
rtl_uString * getDataIgnoreCase()
static bool lcl_FunctionAccessLoadWebServiceLink(OUString &rResult, ScDocument *pDoc, const OUString &rURI)
static ScWebServiceLink * lcl_GetWebServiceLink(const sfx2::LinkManager *pLinkMgr, std::u16string_view rURL)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
double datastream_get_time(DebugTime nIdx)
::boost::intrusive_ptr< ScMatrix > ScMatrixRef