mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Refactoring
This commit is contained in:
@ -436,12 +436,13 @@ namespace NSCSS
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDigit::SetValue(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CDigit::SetValue(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
if (CHECK_CONDITIONS && !bHardMode)
|
||||
return false;
|
||||
|
||||
m_oValue = dValue;
|
||||
m_enUnitMeasure = enUnitMeasure;
|
||||
m_oValue = dValue;
|
||||
|
||||
if (UINT_MAX == unLevel)
|
||||
m_unLevel++;
|
||||
@ -1743,9 +1744,9 @@ namespace NSCSS
|
||||
return m_oWidth.SetValue(wsNewValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorderSide::SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CBorderSide::SetWidth(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oWidth.SetValue(dValue, unLevel, bHardMode);
|
||||
return m_oWidth.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorderSide::SetStyle(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
@ -1921,14 +1922,14 @@ namespace NSCSS
|
||||
return bResult;
|
||||
}
|
||||
|
||||
bool CBorder::SetWidth(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CBorder::SetWidth(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
bool bResult = false;
|
||||
|
||||
if (m_oLeft .SetWidth(dValue, unLevel, bHardMode)) bResult = true;
|
||||
if (m_oTop .SetWidth(dValue, unLevel, bHardMode)) bResult = true;
|
||||
if (m_oRight .SetWidth(dValue, unLevel, bHardMode)) bResult = true;
|
||||
if (m_oBottom.SetWidth(dValue, unLevel, bHardMode)) bResult = true;
|
||||
if (m_oLeft .SetWidth(dValue, enUnitMeasure, unLevel, bHardMode)) bResult = true;
|
||||
if (m_oTop .SetWidth(dValue, enUnitMeasure, unLevel, bHardMode)) bResult = true;
|
||||
if (m_oRight .SetWidth(dValue, enUnitMeasure, unLevel, bHardMode)) bResult = true;
|
||||
if (m_oBottom.SetWidth(dValue, enUnitMeasure, unLevel, bHardMode)) bResult = true;
|
||||
|
||||
return bResult;
|
||||
}
|
||||
@ -1972,9 +1973,9 @@ namespace NSCSS
|
||||
return m_oLeft.SetWidth(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetWidthLeftSide(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CBorder::SetWidthLeftSide(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oLeft.SetWidth(dValue, unLevel, bHardMode);
|
||||
return m_oLeft.SetWidth(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetStyleLeftSide(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
@ -1997,9 +1998,9 @@ namespace NSCSS
|
||||
return m_oTop.SetWidth(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetWidthTopSide(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CBorder::SetWidthTopSide(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oTop.SetWidth(dValue, unLevel, bHardMode);
|
||||
return m_oTop.SetWidth(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetStyleTopSide(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
@ -2022,9 +2023,9 @@ namespace NSCSS
|
||||
return m_oRight.SetWidth(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetWidthRightSide(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CBorder::SetWidthRightSide(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oRight.SetWidth(dValue, unLevel, bHardMode);
|
||||
return m_oRight.SetWidth(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetStyleRightSide(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
@ -2047,9 +2048,9 @@ namespace NSCSS
|
||||
return m_oBottom.SetWidth(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetWidthBottomSide(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CBorder::SetWidthBottomSide(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oBottom.SetWidth(dValue, unLevel, bHardMode);
|
||||
return m_oBottom.SetWidth(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CBorder::SetStyleBottomSide(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
@ -2348,39 +2349,49 @@ namespace NSCSS
|
||||
return m_oTop.SetValue(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetTop(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oTop.SetValue(dValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetRight(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oRight.SetValue(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetRight(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oRight.SetValue(dValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetBottom(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oBottom.SetValue(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetBottom(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oBottom.SetValue(dValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetLeft(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oLeft.SetValue(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetLeft(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CIndent::SetValues(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oLeft.SetValue(dValue, unLevel, bHardMode);
|
||||
const bool bTopResult = SetTop (dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
const bool bRightResult = SetRight (dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
const bool bBottomResult = SetBottom (dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
const bool bLeftResult = SetLeft (dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
|
||||
return bTopResult || bRightResult || bBottomResult || bLeftResult;
|
||||
}
|
||||
|
||||
bool CIndent::SetTop(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oTop.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetRight(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oRight.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetBottom(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oBottom.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CIndent::SetLeft(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oLeft.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
void CIndent::UpdateAll(const double& dParentFontSize, const double& dCoreFontSize)
|
||||
@ -2672,9 +2683,9 @@ namespace NSCSS
|
||||
return m_oSize.SetValue(wsNewValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CFont:: SetSize(const double& dValue, unsigned int unLevel, bool bHardMode)
|
||||
bool CFont:: SetSize(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oSize.SetValue(dValue, unLevel, bHardMode);
|
||||
return m_oSize.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CFont::SetLineHeight(const std::wstring &wsValue, unsigned int unLevel, bool bHardMode)
|
||||
@ -2999,6 +3010,31 @@ namespace NSCSS
|
||||
return m_oHeader.SetValue(wsValue, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CPage::SetWidth(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oWidth.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CPage::SetHeight(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oHeight.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CPage::SetMargin(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oMargin.SetValues(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CPage::SetFooter(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oFooter.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
bool CPage::SetHeader(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode)
|
||||
{
|
||||
return m_oHeader.SetValue(dValue, enUnitMeasure, unLevel, bHardMode);
|
||||
}
|
||||
|
||||
const CDigit &CPage::GetWidth() const
|
||||
{
|
||||
return m_oWidth;
|
||||
|
||||
@ -138,7 +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 SetValue(const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode);
|
||||
|
||||
bool Empty() const override;
|
||||
bool Zero() const;
|
||||
@ -472,7 +472,7 @@ 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 SetWidth(const double& dValue, UnitMeasure enUnitMeasure, 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);
|
||||
|
||||
@ -524,7 +524,7 @@ namespace NSCSS
|
||||
|
||||
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 SetWidth(const double& dValue, UnitMeasure enUnitMeasure, 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);
|
||||
@ -532,28 +532,28 @@ namespace NSCSS
|
||||
//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 SetWidthLeftSide (const double& dValue, UnitMeasure enUnitMeasure, 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 SetWidthTopSide (const double& dValue, UnitMeasure enUnitMeasure, 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 SetWidthRightSide (const double& dValue, UnitMeasure enUnitMeasure, 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 SetWidthBottomSide(const double& dValue, UnitMeasure enUnitMeasure, 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);
|
||||
|
||||
@ -666,13 +666,15 @@ 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);
|
||||
|
||||
bool SetValues (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetTop (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetRight (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetBottom (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetLeft (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
void UpdateAll (const double& dParentFontSize, const double& dCoreFontSize);
|
||||
void UpdateTop (const double& dParentFontSize, const double& dCoreFontSize);
|
||||
@ -685,6 +687,9 @@ namespace NSCSS
|
||||
const CDigit& GetBottom() const;
|
||||
const CDigit& GetLeft () const;
|
||||
|
||||
bool GetAfterAutospacing () const;
|
||||
bool GetBeforeAutospacing() const;
|
||||
|
||||
bool Empty() const;
|
||||
bool Zero() const;
|
||||
|
||||
@ -712,7 +717,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 SetSize (const double& dValue, UnitMeasure enUnitMeasure, 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);
|
||||
@ -762,6 +767,12 @@ namespace NSCSS
|
||||
bool SetFooter (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeader (const std::wstring& wsValue, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
bool SetWidth (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeight (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetMargin (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetFooter (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
bool SetHeader (const double& dValue, UnitMeasure enUnitMeasure, unsigned int unLevel, bool bHardMode = false);
|
||||
|
||||
const CDigit& GetWidth() const;
|
||||
const CDigit& GetHeight() const;
|
||||
const CIndent& GetMargin() const;
|
||||
|
||||
@ -341,14 +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=\"1\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"0\"";
|
||||
sSpacingValue += L"w:before=\"0\" w:beforeAutospacing=\"1\"";
|
||||
|
||||
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=\"1\"";
|
||||
else if (oStyle.m_oMargin.GetBottom().Zero() || bInTable)
|
||||
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"0\"";
|
||||
sSpacingValue += L" w:after=\"0\" w:afterAutospacing=\"1\"";
|
||||
|
||||
if (!oStyle.m_oFont.GetLineHeight().Empty() && !oStyle.m_oFont.GetLineHeight().Zero())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user