mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 07:23:34 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63478 954022d7-b5bf-4e40-9824-e11837661b57
107 lines
3.0 KiB
C++
107 lines
3.0 KiB
C++
#ifndef _XPS_XPSLIB_UTILS_H
|
|
#define _XPS_XPSLIB_UTILS_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace XmlUtils
|
|
{
|
|
class CXmlLiteReader;
|
|
}
|
|
|
|
class IRenderer;
|
|
|
|
namespace XPS
|
|
{
|
|
class CWStringBuffer;
|
|
class CWString
|
|
{
|
|
public:
|
|
CWString();
|
|
CWString(const wchar_t* wsString);
|
|
CWString(const CWString& wsString);
|
|
CWString(wchar_t* wsString, bool bCopy, int nLen = -1);
|
|
~CWString();
|
|
void create(const wchar_t*, bool bCopy, int nLen = -1);
|
|
void operator=(const wchar_t* wsString);
|
|
void operator=(const CWString& wsString);
|
|
bool operator<(const CWString& wsString) const;
|
|
bool operator>(const CWString& wsString) const;
|
|
bool operator==(const CWString& wsString) const;
|
|
bool operator==(const wchar_t* wsString) const;
|
|
unsigned int size() const;
|
|
bool empty() const;
|
|
wchar_t operator[](const unsigned int& unIndex) const;
|
|
const wchar_t* c_str() const;
|
|
void clear();
|
|
|
|
private:
|
|
|
|
void* m_pBuffer;
|
|
unsigned int m_unLen;
|
|
bool m_bOwnBuffer;
|
|
};
|
|
struct TIndicesEntry
|
|
{
|
|
public:
|
|
|
|
TIndicesEntry() : nUnicode(0), nGid(0), dAdvance(0.0), dHorOffset(0.0), dVerOffset(0.0),
|
|
bUnicode(false), bGid(false), bAdvance(false), bHorOffset(false), bVerOffset(false)
|
|
{
|
|
}
|
|
void Reset()
|
|
{
|
|
bUnicode = false;
|
|
bGid = false;
|
|
bAdvance = false;
|
|
bHorOffset = false;
|
|
bVerOffset = false;
|
|
|
|
nUnicode = 0;
|
|
nGid = 0;
|
|
dAdvance = 0;
|
|
dHorOffset = 0;
|
|
dVerOffset = 0;
|
|
}
|
|
|
|
public:
|
|
|
|
unsigned int nUnicode;
|
|
unsigned short nGid;
|
|
double dAdvance;
|
|
double dHorOffset;
|
|
double dVerOffset;
|
|
|
|
bool bUnicode;
|
|
bool bGid;
|
|
bool bAdvance;
|
|
bool bHorOffset;
|
|
bool bVerOffset;
|
|
|
|
std::vector<unsigned int> vRemainUnicodes;
|
|
};
|
|
|
|
|
|
bool IsAlpha(wchar_t wChar);
|
|
double GetDouble(const std::wstring& wsString);
|
|
int GetInteger(const std::wstring& wsString);
|
|
bool GetBool(const std::wstring& wsString);
|
|
void GetBgra(const std::wstring& wsString, int& nBgr, int& nAlpha);
|
|
|
|
unsigned char GetCapStyle(const wchar_t* wsCapStyle);
|
|
|
|
std::wstring NormalizePath(const std::wstring& wsPath);
|
|
std::wstring GetPath(const std::wstring& wsPath);
|
|
std::wstring GetFileName(const std::wstring& wsPath);
|
|
std::wstring GetFileExtension(const std::wstring& wsPath);
|
|
std::wstring RemoveNamespace(const std::wstring& wsString);
|
|
|
|
std::vector<std::vector<std::wstring>> Split(const std::wstring& wsString, wchar_t wDelim1, wchar_t wDelim2);
|
|
|
|
void ReadAttribute(XmlUtils::CXmlLiteReader& oReader, const wchar_t* wsAttrName, std::wstring& wsAttr);
|
|
void ReadAttribute(XmlUtils::CXmlLiteReader& oReader, const wchar_t* wsAttrName, CWString& wsAttr);
|
|
bool VmlToRenderer(const wchar_t* wsString, IRenderer* pRenderer);
|
|
bool GetNextGlyph(const wchar_t* wsIndices, int& nIndicesPos, const int& nIndicesLen, unsigned short* pUtf16, int& nUtf16Pos, const int& nUtf16Len, TIndicesEntry& oEntry);
|
|
}
|
|
|
|
#endif // _XPS_XPSLIB_UTILS_H
|