mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-17 13:02:41 +08:00
Compare commits
254 Commits
v8.1.3.3
...
feature/pd
| Author | SHA1 | Date | |
|---|---|---|---|
| 447e1f5ccc | |||
| 06ee659edc | |||
| fe35178e26 | |||
| 13590d4c2e | |||
| 84fc9f876e | |||
| c4530caac1 | |||
| c018d57081 | |||
| 43f49b7a9d | |||
| f8e19a7f0b | |||
| f245985bbd | |||
| 68171df991 | |||
| bbf4003ec7 | |||
| 75cc7d8457 | |||
| 7018402a58 | |||
| 6ce30ccaad | |||
| 670677c23b | |||
| 208f6efcc5 | |||
| 685165d270 | |||
| f18eb2ef5b | |||
| facdff46fe | |||
| 8843c3dd36 | |||
| 2708479152 | |||
| f3facfa8e8 | |||
| 1e26e1723a | |||
| 6d9242e1dd | |||
| e8de8dc03b | |||
| 57447f757f | |||
| 46d6eaa793 | |||
| def502c7eb | |||
| 1e5e43cbe5 | |||
| 60a888fc19 | |||
| 01ca25d798 | |||
| 6812ebaa42 | |||
| aacb2842f7 | |||
| 27a2a47cbe | |||
| 02f8178c01 | |||
| a0e2384409 | |||
| 56088e9eff | |||
| 1d6b895496 | |||
| fa4b8c8d76 | |||
| 2db2b98c8f | |||
| f45fb3c6be | |||
| 6f60d75863 | |||
| d1acdf35d8 | |||
| a1bf6a76ed | |||
| 3634d59ece | |||
| 1b21e8f136 | |||
| 554ca5ec7c | |||
| dc2e0edf80 | |||
| e38fa336d2 | |||
| 357450f242 | |||
| 4ed9925aff | |||
| 796537565b | |||
| fcf8e28ae8 | |||
| de949afbb6 | |||
| fb7bb041c1 | |||
| 8d6e15627b | |||
| 0583cbb5cc | |||
| a68bec86df | |||
| 6554185ec7 | |||
| 22bbde155d | |||
| 4a123d33ea | |||
| c7d0f27f6b | |||
| f1ddd51164 | |||
| 1d636b717f | |||
| c026f33aa7 | |||
| 29e5769d6d | |||
| 6586fc39ee | |||
| e8c7a4f670 | |||
| ead6b305b2 | |||
| 2de6a6d199 | |||
| c6ca99994b | |||
| b707510c88 | |||
| 7171dcb9f0 | |||
| 49dedc7a6d | |||
| 431fa060c4 | |||
| 0fc5133d98 | |||
| 8d5fc7d6ca | |||
| 3221d20d81 | |||
| 9fdb81554a | |||
| 95a1983e75 | |||
| c27aa4d807 | |||
| c4f8c524b5 | |||
| f7d55c08d8 | |||
| 4cfb8cc97a | |||
| a41ecb0715 | |||
| faa9e5e640 | |||
| ac2ee1b56d | |||
| b722238d21 | |||
| 83e20057f4 | |||
| 373786fca6 | |||
| 0fa1b4feec | |||
| 6a6204ae33 | |||
| f02147b97c | |||
| 88b1660735 | |||
| f5f7cb1aec | |||
| af01306997 | |||
| ef30a30e00 | |||
| 16ae48ef4e | |||
| 0eb8c93cf9 | |||
| c98285ffef | |||
| 4b99c4179b | |||
| e98dec952f | |||
| 8b2d7035c1 | |||
| 234def9cd7 | |||
| ce92766ef6 | |||
| 59c95c5039 | |||
| a23002225a | |||
| cb64a5a266 | |||
| 65483d0460 | |||
| 41758f0552 | |||
| bfd790ba11 | |||
| 81d9e3cfd7 | |||
| 2920527898 | |||
| 7013fdcb8d | |||
| 0d84e22e79 | |||
| f2acef6bb2 | |||
| 84b8850a52 | |||
| b2a3de852a | |||
| a8fa59d64d | |||
| 59b84f26ee | |||
| 5b17009fb9 | |||
| a5827f187c | |||
| 6ae25ca4c4 | |||
| ff4425e977 | |||
| 06edc93c7b | |||
| 8f9b35d94a | |||
| 14c06e4e7b | |||
| abaaa54bc2 | |||
| 7d0683e338 | |||
| f9d6b49a05 | |||
| 01916b7de6 | |||
| 666d62239e | |||
| 2e25f5dc64 | |||
| cc61536a90 | |||
| 58b5417ab4 | |||
| c056c14303 | |||
| 1b975c7048 | |||
| 3fd5b5612b | |||
| b8a8d36b8b | |||
| ccbeb28f8a | |||
| 6ab0d9d106 | |||
| 79309d3f02 | |||
| c8c4edf592 | |||
| 64afe55078 | |||
| 967a5728c7 | |||
| 8a105d35d5 | |||
| eaf2c02b86 | |||
| 46f30b980f | |||
| ac4f15b999 | |||
| 918a940e05 | |||
| 47961709ad | |||
| a47e72cf2f | |||
| 472c9ecd0d | |||
| 7b8aa38c37 | |||
| 5c87955ae2 | |||
| c37aa9d9dc | |||
| d699c30bda | |||
| 9db017b9f4 | |||
| 70fe676300 | |||
| e73d4455c2 | |||
| 3158e830ff | |||
| 33daee696c | |||
| 305492ec7b | |||
| 2d213df8af | |||
| 4bb3953171 | |||
| f8e894af67 | |||
| 777be23513 | |||
| b8af955fcd | |||
| 176290adaf | |||
| b3868ff146 | |||
| f30aba8bf1 | |||
| b039eeca38 | |||
| 450cbf0ab1 | |||
| 2e33e7d097 | |||
| e9af537e63 | |||
| fb209c6c8a | |||
| d4af1308c0 | |||
| 824d9c59cf | |||
| d4f3cd3801 | |||
| c7fc2bc3a7 | |||
| a8c815d7bd | |||
| 685434b2ab | |||
| 4559d53a97 | |||
| 5e5fec1666 | |||
| 74d7bbca7c | |||
| 6eba82f433 | |||
| d1460a057e | |||
| 21ba3ac0c9 | |||
| b1ff8b79d3 | |||
| 3aab7fd183 | |||
| 82c06b5aaa | |||
| efa4433195 | |||
| e9c9530d66 | |||
| 6c36fc7146 | |||
| 5770551ed4 | |||
| 73fc80aa7d | |||
| 84836a3e8b | |||
| 6dc7ff0874 | |||
| eec0fa47ce | |||
| 7d3bf0c328 | |||
| 7e7ed8d746 | |||
| 92a3c6cfce | |||
| f3e6b5bc21 | |||
| fe489b9da0 | |||
| 6ae6c37ef1 | |||
| b1810af6f0 | |||
| 263b48dea0 | |||
| 128e09f839 | |||
| 5b16ea0693 | |||
| be821d6b45 | |||
| e55101141c | |||
| e7751e891a | |||
| d9269bcd33 | |||
| df6c20b57d | |||
| 59b3862d89 | |||
| 91b82d9dcb | |||
| 142ed45a1b | |||
| a72b42bd6d | |||
| 7a4cebb89c | |||
| 3a8c941649 | |||
| 32464cb685 | |||
| af9a69d0f2 | |||
| f39355156c | |||
| 29115060b4 | |||
| f665afc1ad | |||
| e18fc06c7b | |||
| 4cd6e99531 | |||
| 2d3cd6bd3a | |||
| 56a08867db | |||
| 85be8041b1 | |||
| f86548c873 | |||
| be64e3e624 | |||
| 2f6a542d02 | |||
| f69b52e232 | |||
| ce15265d5a | |||
| 370e317b79 | |||
| 4be711c0bf | |||
| 3bf80a74fe | |||
| de31b16f91 | |||
| f4ec536794 | |||
| fb12bfa57f | |||
| 1a5af05024 | |||
| 5c495dcf8d | |||
| 63c9185fd2 | |||
| 51c6fe496b | |||
| 283f21de86 | |||
| 0700038802 | |||
| 3e4c531538 | |||
| 29afb2aed9 | |||
| 86b53b7ede | |||
| 21e3293895 | |||
| cd86a8a3c7 | |||
| 9e1e641218 |
@ -34,6 +34,9 @@ namespace NSCSS
|
||||
|
||||
CCompiledStyle& CCompiledStyle::operator+= (const CCompiledStyle &oElement)
|
||||
{
|
||||
if (oElement.Empty())
|
||||
return *this;
|
||||
|
||||
m_oBackground += oElement.m_oBackground;
|
||||
m_oBorder += oElement.m_oBorder;
|
||||
m_oFont += oElement.m_oFont;
|
||||
@ -42,6 +45,9 @@ namespace NSCSS
|
||||
m_oText += oElement.m_oText;
|
||||
m_oDisplay += oElement.m_oDisplay;
|
||||
|
||||
if (!oElement.m_sId.empty())
|
||||
m_sId += L'+' + oElement.m_sId;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,11 @@ namespace NSCSS
|
||||
return m_pInternal->GetCompiledStyle(oStyle, arSelectors, bIsSettings, unitMeasure);
|
||||
}
|
||||
|
||||
std::wstring CCssCalculator::CalculateStyleId(const CNode& oNode)
|
||||
{
|
||||
return m_pInternal->CalculateStyleId(oNode);
|
||||
}
|
||||
|
||||
bool CCssCalculator::CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors)
|
||||
{
|
||||
return m_pInternal->CalculatePageStyle(oPageData, arSelectors);
|
||||
|
||||
@ -22,6 +22,7 @@ namespace NSCSS
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point) const;
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point) const;
|
||||
|
||||
std::wstring CalculateStyleId(const CNode& oNode);
|
||||
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
|
||||
|
||||
// void AddStyle(const std::vector<std::string>& sSelectors, const std::string& sStyle);
|
||||
|
||||
@ -157,28 +157,34 @@ namespace NSCSS
|
||||
|
||||
std::vector<CElement*> CCssCalculator_Private::FindElements(std::vector<std::wstring> &arNodes, std::vector<std::wstring> &arNextNodes, bool bIsSettings)
|
||||
{
|
||||
if (arNodes.empty())
|
||||
return {};
|
||||
|
||||
std::vector<CElement*> arFindedElements;
|
||||
|
||||
std::wstring wsName, wsId;
|
||||
std::vector<std::wstring> arClasses;
|
||||
|
||||
if (arNodes.back()[0] == L'#')
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'#')
|
||||
{
|
||||
wsId = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsId);
|
||||
}
|
||||
|
||||
if (arNodes.back()[0] == L'.')
|
||||
if (!arNodes.empty() && arNodes.back()[0] == L'.')
|
||||
{
|
||||
arClasses = NS_STATIC_FUNCTIONS::GetWordsW(arNodes.back(), false, L" ");
|
||||
arNextNodes.push_back(arNodes.back());
|
||||
arNodes.pop_back();
|
||||
}
|
||||
|
||||
wsName = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsName);
|
||||
if (!arNodes.empty())
|
||||
{
|
||||
wsName = arNodes.back();
|
||||
arNodes.pop_back();
|
||||
arNextNodes.push_back(wsName);
|
||||
}
|
||||
|
||||
const std::map<std::wstring, CElement*>::const_iterator oFindName = m_mData.find(wsName);
|
||||
std::map<std::wstring, CElement*>::const_iterator oFindId;
|
||||
@ -561,7 +567,7 @@ namespace NSCSS
|
||||
}
|
||||
}
|
||||
|
||||
oStyle.SetID(arSelectors.back().m_wsName + ((!arSelectors.back().m_wsClass.empty()) ? L'.' + arSelectors.back().m_wsClass : L"") + ((arSelectors.back().m_wsId.empty()) ? L"" : L'#' + arSelectors.back().m_wsId) + L'-' + std::to_wstring(++m_nCountNodes));
|
||||
oStyle.SetID(CalculateStyleId(arSelectors.back()));
|
||||
|
||||
if (!bIsSettings && !oStyle.Empty())
|
||||
m_mUsedStyles[arSelectors] = oStyle;
|
||||
@ -569,6 +575,11 @@ namespace NSCSS
|
||||
return true;
|
||||
}
|
||||
|
||||
std::wstring CCssCalculator_Private::CalculateStyleId(const CNode& oNode)
|
||||
{
|
||||
return oNode.m_wsName + ((!oNode.m_wsClass.empty()) ? L'.' + oNode.m_wsClass : L"") + ((oNode.m_wsId.empty()) ? L"" : L'#' + oNode.m_wsId) + L'-' + std::to_wstring(++m_nCountNodes);
|
||||
}
|
||||
|
||||
bool CCssCalculator_Private::CalculatePageStyle(NSProperties::CPage &oPageData, const std::vector<CNode> &arSelectors)
|
||||
{
|
||||
if (arSelectors.empty())
|
||||
|
||||
@ -75,6 +75,7 @@ namespace NSCSS
|
||||
CCompiledStyle GetCompiledStyle(const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point);
|
||||
bool GetCompiledStyle(CCompiledStyle& oStyle, const std::vector<CNode> &arSelectors, const bool& bIsSettings = false, const UnitMeasure& unitMeasure = Point);
|
||||
|
||||
std::wstring CalculateStyleId(const CNode& oNode);
|
||||
bool CalculatePageStyle(NSProperties::CPage& oPageData, const std::vector<CNode> &arSelectors);
|
||||
#endif
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ namespace NSCSS
|
||||
CNode::CNode()
|
||||
{}
|
||||
|
||||
CNode::CNode(std::wstring wsName, std::wstring wsClass, std::wstring wsId)
|
||||
CNode::CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId)
|
||||
: m_wsName(wsName), m_wsClass(wsClass), m_wsId(wsId)
|
||||
{}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ namespace NSCSS
|
||||
|
||||
public:
|
||||
CNode();
|
||||
CNode(std::wstring wsName, std::wstring wsClass, std::wstring wsId);
|
||||
CNode(const std::wstring& wsName, const std::wstring& wsClass, const std::wstring& wsId);
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
|
||||
@ -141,7 +141,9 @@ namespace NS_STATIC_FUNCTIONS
|
||||
|
||||
while (std::wstring::npos != unEnd)
|
||||
{
|
||||
arWords.emplace_back(wsLine.data() + unStart, unEnd - unStart + ((bWithSigns) ? 1 : 0));
|
||||
if (unStart != unEnd)
|
||||
arWords.emplace_back(wsLine.data() + unStart, unEnd - unStart + ((bWithSigns) ? 1 : 0));
|
||||
|
||||
unStart = wsLine.find_first_not_of(wsDelimiters, unEnd);
|
||||
unEnd = wsLine.find_first_of(wsDelimiters, unStart);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,8 @@ namespace NSCSS
|
||||
{
|
||||
namespace NSProperties
|
||||
{
|
||||
#define NEXT_LEVEL UINT_MAX, true
|
||||
|
||||
template<typename T>
|
||||
class CValue
|
||||
{
|
||||
@ -21,6 +23,7 @@ namespace NSCSS
|
||||
friend class CDigit;
|
||||
friend class CColor;
|
||||
friend class CEnum;
|
||||
friend class CURL;
|
||||
|
||||
T m_oValue;
|
||||
unsigned int m_unLevel;
|
||||
@ -74,13 +77,13 @@ namespace NSCSS
|
||||
return *this;
|
||||
}
|
||||
|
||||
CValue& operator =(const T& oValue)
|
||||
virtual CValue& operator =(const T& oValue)
|
||||
{
|
||||
//m_oValue = oValue.m_oValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CValue& operator+=(const CValue& oValue)
|
||||
virtual CValue& operator+=(const CValue& oValue)
|
||||
{
|
||||
if (m_unLevel > oValue.m_unLevel || (m_bImportant && !oValue.m_bImportant) || oValue.Empty())
|
||||
return *this;
|
||||
@ -92,10 +95,15 @@ namespace NSCSS
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const CValue& oValue) const
|
||||
virtual bool operator==(const CValue& oValue) const
|
||||
{
|
||||
return m_oValue == oValue.m_oValue;
|
||||
}
|
||||
|
||||
virtual bool operator!=(const CValue& oValue) const
|
||||
{
|
||||
return m_oValue != oValue.m_oValue;
|
||||
}
|
||||
};
|
||||
|
||||
class CString : public CValue<std::wstring>
|
||||
@ -130,6 +138,7 @@ namespace NSCSS
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel = 0, bool bHardMode = true) override;
|
||||
bool SetValue(const CDigit& oValue);
|
||||
bool SetValue(const double& dValue, unsigned int unLevel, bool bHardMode);
|
||||
|
||||
bool Empty() const override;
|
||||
bool Zero() const;
|
||||
@ -178,8 +187,28 @@ namespace NSCSS
|
||||
bool Empty() const;
|
||||
|
||||
bool operator==(const TRGB& oRGB) const;
|
||||
bool operator!=(const TRGB& oRGB) const;
|
||||
};
|
||||
|
||||
class CURL
|
||||
{
|
||||
public:
|
||||
CURL();
|
||||
|
||||
bool Empty() const;
|
||||
bool LinkToId() const;
|
||||
|
||||
void Clear();
|
||||
|
||||
bool SetValue(const std::wstring& wsValue);
|
||||
std::wstring GetValue() const;
|
||||
|
||||
bool operator==(const CURL& oValue) const;
|
||||
bool operator!=(const CURL& oValue) const;
|
||||
private:
|
||||
std::wstring m_wsValue;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ColorEmpty,
|
||||
@ -189,39 +218,8 @@ namespace NSCSS
|
||||
ColorUrl
|
||||
} ColorType;
|
||||
|
||||
class Q_DECL_EXPORT CColorValue
|
||||
class CColor : public CValue<void*>
|
||||
{
|
||||
public:
|
||||
CColorValue();
|
||||
CColorValue(const CColorValue& oColorValue);
|
||||
~CColorValue();
|
||||
|
||||
void SetRGB(unsigned char uchR, unsigned char uchG, unsigned char uchB);
|
||||
void SetRGB(const TRGB& oRGB);
|
||||
void SetHEX(const std::wstring& wsValue);
|
||||
void SetUrl(const std::wstring& wsValue);
|
||||
void SetNone();
|
||||
|
||||
void Clear();
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
ColorType m_enType;
|
||||
void* m_pColor = NULL;
|
||||
|
||||
std::wstring GetColor() const;
|
||||
|
||||
bool operator==(const CColorValue& oColorValue) const;
|
||||
CColorValue& operator= (const CColorValue& oColorValue);
|
||||
};
|
||||
|
||||
class CColor : public CValue<CColorValue>
|
||||
{
|
||||
CDigit m_oOpacity;
|
||||
static TRGB ConvertHEXtoRGB(const std::wstring& wsValue);
|
||||
static std::wstring ConvertRGBtoHEX(const TRGB& oValue);
|
||||
static std::wstring CutURL(const std::wstring& wsValue);
|
||||
void SetEmpty(unsigned int unLevel = 0);
|
||||
public:
|
||||
CColor();
|
||||
|
||||
@ -242,6 +240,25 @@ namespace NSCSS
|
||||
std::wstring ToWString() const override;
|
||||
std::wstring EquateToColor(const std::vector<std::pair<TRGB, std::wstring>>& arColors) const;
|
||||
TRGB ToRGB() const;
|
||||
|
||||
static TRGB ConvertHEXtoRGB(const std::wstring& wsValue);
|
||||
static std::wstring ConvertRGBtoHEX(const TRGB& oValue);
|
||||
|
||||
bool operator==(const CColor& oColor) const;
|
||||
bool operator!=(const CColor& oColor) const;
|
||||
|
||||
CColor& operator =(const CColor& oColor);
|
||||
CColor& operator+=(const CColor& oColor);
|
||||
private:
|
||||
CDigit m_oOpacity;
|
||||
ColorType m_enType;
|
||||
|
||||
void SetEmpty(unsigned int unLevel = 0);
|
||||
void SetRGB(unsigned char uchR, unsigned char uchG, unsigned char uchB);
|
||||
void SetRGB(const TRGB& oRGB);
|
||||
void SetHEX(const std::wstring& wsValue);
|
||||
void SetUrl(const std::wstring& wsValue);
|
||||
void SetNone();
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@ -427,6 +444,7 @@ namespace NSCSS
|
||||
{
|
||||
public:
|
||||
CBorderSide();
|
||||
CBorderSide(const CBorderSide& oBorderSide);
|
||||
|
||||
void Clear();
|
||||
|
||||
@ -434,9 +452,12 @@ namespace NSCSS
|
||||
|
||||
bool SetValue(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
void SetNone(unsigned int unLevel, bool bHardMode);
|
||||
|
||||
void Block();
|
||||
void Unblock();
|
||||
|
||||
@ -452,6 +473,7 @@ namespace NSCSS
|
||||
|
||||
CBorderSide& operator+=(const CBorderSide& oBorderSide);
|
||||
bool operator==(const CBorderSide& oBorderSide) const;
|
||||
bool operator!=(const CBorderSide& oBorderSide) const;
|
||||
CBorderSide& operator =(const CBorderSide& oBorderSide);
|
||||
private:
|
||||
CDigit m_oWidth;
|
||||
@ -473,39 +495,50 @@ namespace NSCSS
|
||||
CBorder();
|
||||
|
||||
void Clear();
|
||||
void ClearLeftSide();
|
||||
void ClearTopSide();
|
||||
void ClearRightSide();
|
||||
void ClearBottomSide();
|
||||
|
||||
static void Equation(CBorder &oFirstBorder, CBorder &oSecondBorder);
|
||||
|
||||
bool SetSides(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSides(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyle(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetCollapse(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Left Side
|
||||
bool SetLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthLeftSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorLeftSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Top Side
|
||||
bool SetTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthTopSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorTopSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Right Side
|
||||
bool SetRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthRightSide (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorRightSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
//Bottom Side
|
||||
bool SetBottomSide (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetWidthBottomSide(const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStyleBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColorBottomSide(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
void SetNone(unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
void Block();
|
||||
void Unblock();
|
||||
|
||||
@ -522,7 +555,7 @@ namespace NSCSS
|
||||
|
||||
CBorder& operator+=(const CBorder& oBorder);
|
||||
bool operator==(const CBorder& oBorder) const;
|
||||
|
||||
bool operator!=(const CBorder& oBorder) const;
|
||||
CBorder& operator =(const CBorder& oBorder);
|
||||
private:
|
||||
CBorderSide m_oLeft;
|
||||
@ -574,11 +607,13 @@ namespace NSCSS
|
||||
bool SetAlign (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetDecoration(const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetColor (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHighlight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
const CDigit& GetIndent() const;
|
||||
const CString& GetAlign() const;
|
||||
const TTextDecoration& GetDecoration() const;
|
||||
const CColor& GetColor() const;
|
||||
const CColor& GetHighlight() const;
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
@ -593,6 +628,7 @@ namespace NSCSS
|
||||
CDigit m_oIndent;
|
||||
CString m_oAlign;
|
||||
CColor m_oColor;
|
||||
CColor m_oHighlight;
|
||||
};
|
||||
|
||||
class CIndent
|
||||
@ -610,9 +646,13 @@ namespace NSCSS
|
||||
|
||||
bool SetValues (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
void UpdateAll (double dFontSize);
|
||||
void UpdateTop (double dFontSize);
|
||||
@ -652,6 +692,7 @@ namespace NSCSS
|
||||
|
||||
bool SetValue (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetSize (const double& dValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLineHeight (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetFamily (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetStretch (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
@ -341,12 +341,14 @@ namespace NSCSS
|
||||
sSpacingValue.reserve(128);
|
||||
|
||||
if (!oStyle.m_oMargin.GetTop().Empty() && !oStyle.m_oMargin.GetTop().Zero())
|
||||
sSpacingValue += L"w:before=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetTop(), NSCSS::Twips)) + L"\" w:beforeAutospacing=\"0\" ";
|
||||
sSpacingValue += L"w:before=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetTop(), NSCSS::Twips)) + L"\" w:beforeAutospacing=\"0\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"0\"";
|
||||
|
||||
if (!oStyle.m_oMargin.GetBottom().Empty() && !oStyle.m_oMargin.GetBottom().Zero())
|
||||
sSpacingValue += L"w:after=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetBottom(), NSCSS::Twips)) + L"\" w:afterAutospacing=\"0\" ";
|
||||
sSpacingValue += L" w:after=\"" + std::to_wstring(VALUE_TO_INT(oStyle.m_oMargin.GetBottom(), NSCSS::Twips)) + L"\" w:afterAutospacing=\"0\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L"w:after=\"0\" ";
|
||||
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"0\"";
|
||||
|
||||
if (!oStyle.m_oFont.GetLineHeight().Empty() && !oStyle.m_oFont.GetLineHeight().Zero())
|
||||
{
|
||||
@ -356,7 +358,7 @@ namespace NSCSS
|
||||
sSpacingValue += L" w:line=\"" + wsLine + L"\" w:lineRule=\"" + wsLineRule + L"\"";
|
||||
}
|
||||
else if (oStyle.m_oFont.GetLineHeight().Zero() || bInTable)
|
||||
sSpacingValue += L"w:lineRule=\"auto\" w:line=\"240\"";
|
||||
sSpacingValue += L" w:lineRule=\"auto\" w:line=\"240\"";
|
||||
|
||||
if (!sSpacingValue.empty())
|
||||
oXmlElement.AddPropertiesInP(PProperties::P_Spacing, sSpacingValue);
|
||||
@ -491,17 +493,15 @@ namespace NSCSS
|
||||
if (!oStyle.m_oBackground.GetColor().Empty() && !oStyle.m_oBackground.GetColor().None() && !oStyle.m_oBackground.GetColor().Url())
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Shd, oStyle.m_oBackground.GetColor().ToWString());
|
||||
|
||||
/*
|
||||
const std::wstring wsHighlight{oStyle.m_oBackground.GetColor().EquateToColor({{{0, 0, 0}, L"black"}, {{0, 0, 255}, L"blue"}, {{0, 255, 255}, L"cyan"},
|
||||
{{0, 255, 0}, L"green"}, {{255, 0, 255}, L"magenta"}, {{255, 0, 0}, L"red"},
|
||||
{{255, 255, 0}, L"yellow"}, {{255, 255, 255}, L"white"}, {{0, 0, 139}, L"darkBlue"},
|
||||
{{0, 139, 139}, L"darkCyan"}, {{0, 100, 0}, L"darkGreen"}, {{139, 0, 139}, L"darkMagenta"},
|
||||
{{139, 0, 0}, L"darkRed"}, {{128, 128, 0}, L"darkYellow"},{{169, 169, 169}, L"darkGray"},
|
||||
{{211, 211, 211}, L"lightGray"}})};
|
||||
const std::wstring wsHighlight{oStyle.m_oText.GetHighlight().EquateToColor({{{0, 0, 0}, L"black"}, {{0, 0, 255}, L"blue"}, {{0, 255, 255}, L"cyan"},
|
||||
{{0, 255, 0}, L"green"}, {{255, 0, 255}, L"magenta"}, {{255, 0, 0}, L"red"},
|
||||
{{255, 255, 0}, L"yellow"}, {{255, 255, 255}, L"white"}, {{0, 0, 139}, L"darkBlue"},
|
||||
{{0, 139, 139}, L"darkCyan"}, {{0, 100, 0}, L"darkGreen"}, {{139, 0, 139}, L"darkMagenta"},
|
||||
{{139, 0, 0}, L"darkRed"}, {{128, 128, 0}, L"darkYellow"},{{169, 169, 169}, L"darkGray"},
|
||||
{{211, 211, 211}, L"lightGray"}})};
|
||||
|
||||
if (L"none" != wsHighlight)
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Highlight, wsHighlight);
|
||||
*/
|
||||
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Color, oStyle.m_oText.GetColor().ToWString());
|
||||
|
||||
@ -523,10 +523,7 @@ namespace NSCSS
|
||||
Clear();
|
||||
|
||||
if(oStyle.GetId().empty())
|
||||
{
|
||||
m_sId = L"normal";
|
||||
return false;
|
||||
}
|
||||
|
||||
CStyleUsed structStyle(oStyle, false);
|
||||
|
||||
@ -589,10 +586,7 @@ namespace NSCSS
|
||||
Clear();
|
||||
|
||||
if(oStyle.GetId().empty())
|
||||
{
|
||||
m_sId = L"normal";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
CStyleUsed structStyle(oStyle, true);
|
||||
std::vector<CStyleUsed>::iterator oItem = std::find(m_arStyleUsed.begin(), m_arStyleUsed.end(), structStyle);
|
||||
|
||||
@ -27,7 +27,7 @@ CXmlElement::CXmlElement(const std::wstring& sNameDefaultElement)
|
||||
|
||||
bool CXmlElement::Empty() const
|
||||
{
|
||||
return m_mPStyleValues.empty() && m_mRStyleValues.empty() && m_mBasicValues.find(CSSProperties::BasicProperties::B_BasedOn) == m_mBasicValues.end();
|
||||
return m_mPStyleValues.empty() && m_mRStyleValues.empty() && GetBasedOn().empty();
|
||||
}
|
||||
|
||||
void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
@ -35,7 +35,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
if (!Empty())
|
||||
Clear();
|
||||
|
||||
if (sNameDefaultElement == L"p")
|
||||
/* if (sNameDefaultElement == L"p")
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"paragraph");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"p");
|
||||
@ -47,7 +47,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
|
||||
// AddPropertiesInP(CSSProperties::ParagraphProperties::P_Spacing, L"w:before=\"100\" w:beforeAutospacing=\"1\" w:after=\"100\" w:afterAutospacing=\"1\"");
|
||||
}
|
||||
else if (sNameDefaultElement == L"li")
|
||||
else */if (sNameDefaultElement == L"li")
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"paragraph");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"li");
|
||||
@ -203,7 +203,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddPropertiesInR(CSSProperties::RunnerProperties::R_Sz, L"15");
|
||||
AddPropertiesInR(CSSProperties::RunnerProperties::R_B, L"bold");
|
||||
}
|
||||
else if (sNameDefaultElement == L"div-c")
|
||||
/*else if (sNameDefaultElement == L"div-c")
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_StyleId, L"div-c");
|
||||
@ -219,7 +219,7 @@ void CXmlElement::CreateDefaultElement(const std::wstring& sNameDefaultElement)
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Name, L"Div paragraph");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_BasedOn, L"normal");
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Link, L"div-c");
|
||||
}
|
||||
}*/
|
||||
else if (sNameDefaultElement == L"a-c")
|
||||
{
|
||||
AddBasicProperties(CSSProperties::BasicProperties::B_Type, L"character");
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "../../../../Common/3dParty/hunspell/hunspell/src/hunspell/hunspell.h"
|
||||
#include "../../../../DesktopEditor/common/StringExt.h"
|
||||
#include "../../../../DesktopEditor/common/Directory.h"
|
||||
#include <iostream>
|
||||
|
||||
bool CheckCaret(std::vector<std::wstring>& words)
|
||||
{
|
||||
@ -85,11 +86,36 @@ std::wstring CheckWord(Hunhandle* pDic, const std::wstring& sWord, const bool& b
|
||||
return sResult;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define USE_WCHAR_ARGC
|
||||
#endif
|
||||
|
||||
#ifdef USE_WCHAR_ARGC
|
||||
std::wstring GetParam(wchar_t* arg)
|
||||
{
|
||||
return std::wstring(arg);
|
||||
}
|
||||
#else
|
||||
std::wstring GetParam(char* arg)
|
||||
{
|
||||
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE *)arg, (LONG)strlen(arg));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_WCHAR_ARGC
|
||||
int wmain(int argc, wchar_t *argv[])
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
std::wstring sSrcDir = NSFile::GetProcessDirectory() + L"/../src";
|
||||
std::wstring sDstDir = NSFile::GetProcessDirectory() + L"/../dst";
|
||||
std::wstring sDictionariesDir = NSFile::GetProcessDirectory() + L"/../../../../../../dictionaries";
|
||||
|
||||
if (argc > 1) sSrcDir = GetParam(argv[1]);
|
||||
if (argc > 2) sDstDir = GetParam(argv[2]);
|
||||
if (argc > 3) sDictionariesDir = GetParam(argv[3]);
|
||||
|
||||
std::vector<std::wstring> arSrcFiles = NSDirectory::GetFiles(sSrcDir);
|
||||
|
||||
for (int i = 0, len = (int)arSrcFiles.size(); i < len; ++i)
|
||||
@ -125,6 +151,8 @@ int main(int argc, char *argv[])
|
||||
Hunspell_destroy(pDictionary);
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sFileDst, sResult, true);
|
||||
|
||||
std::cout << "[" << (i + 1) << " of " << (int)arSrcFiles.size() << "] " << U_TO_UTF8(sName) << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
QT -= core gui
|
||||
|
||||
TARGET = test
|
||||
TARGET = dictionariestester
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
@ -22,8 +22,7 @@ include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
|
||||
ADD_DEPENDENCY(UnicodeConverter kernel hunspell)
|
||||
|
||||
core_windows:LIBS += -lgdi32 -ladvapi32 -luser32 -lshell32
|
||||
core_linux:LIBS += -lz
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
DESTDIR = $$PWD/build
|
||||
DESTDIR = $$CORE_BUILDS_BINARY_PATH
|
||||
|
||||
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-drm.so
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-drm.so
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-drm.so.2
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-drm.so.2
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-drm.so.2.2100.0
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-drm.so.2.2100.0
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-glx.so
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-glx.so
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-glx.so.2
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-glx.so.2
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-glx.so.2.2100.0
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-glx.so.2.2100.0
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-wayland.so
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-wayland.so
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-wayland.so.2
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-wayland.so.2
Normal file
Binary file not shown.
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-x11.so
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-x11.so
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-x11.so.2
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-x11.so.2
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-x11.so.2.2100.0
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva-x11.so.2.2100.0
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva.so
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva.so
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva.so.2
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva.so.2
Normal file
Binary file not shown.
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva.so.2.2100.0
Normal file
BIN
Common/3dParty/libvlc/build/linux_64/lib/libva.so.2.2100.0
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user