Refactoring

This commit is contained in:
Kirill Polyakov
2025-10-24 01:37:24 +03:00
parent 2bf44900de
commit 4c5259494d
4 changed files with 129 additions and 81 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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())
{

View File

@ -1513,10 +1513,11 @@ public:
CHtmlFile2_Private()
: m_nFootnoteId(1), m_nHyperlinkId(1), m_nNumberingId(1), m_nId(1), m_pFonts(NULL)
{
m_oPageData.SetSize (std::to_wstring(DEFAULT_PAGE_WIDTH) + L"tw " + std::to_wstring(DEFAULT_PAGE_HEIGHT) + L"tw", 0, true);
m_oPageData.SetMargin(L"1440tw 1440tw 1440tw 1440tw", 0, true);
m_oPageData.SetFooter(L"720tw", 0, true);
m_oPageData.SetHeader(L"720tw", 0, true);
m_oPageData.SetWidth (DEFAULT_PAGE_WIDTH, NSCSS::UnitMeasure::Twips, 0, true);
m_oPageData.SetHeight(DEFAULT_PAGE_HEIGHT, NSCSS::UnitMeasure::Twips, 0, true);
m_oPageData.SetMargin(1440, NSCSS::UnitMeasure::Twips, 0, true);
m_oPageData.SetFooter(720, NSCSS::UnitMeasure::Twips, 0, true);
m_oPageData.SetHeader(720, NSCSS::UnitMeasure::Twips, 0, true);
}
~CHtmlFile2_Private()
@ -2638,7 +2639,7 @@ private:
CTextSettings oTSR(oTS);
oTSR.oAdditionalStyle.m_oFont.SetFamily(L"Courier New", UINT_MAX, true);
oTSR.oAdditionalStyle.m_oFont.SetSize(20, UINT_MAX, true);
oTSR.oAdditionalStyle.m_oFont.SetSize(20, NSCSS::UnitMeasure::Point, UINT_MAX, true);
oTSR.oAdditionalStyle.m_oFont.SetWeight(L"bold", UINT_MAX, true);
return readStream(pXml, arSelectors, oTSR);
@ -2697,7 +2698,7 @@ private:
if (nSize < 1 || nSize > 7)
nSize = 3;
oTSR.oAdditionalStyle.m_oFont.SetSize(HTML_FONTS[nSize - 1], UINT_MAX, true);
oTSR.oAdditionalStyle.m_oFont.SetSize(HTML_FONTS[nSize - 1], NSCSS::UnitMeasure::Point, UINT_MAX, true);
}
}
m_oLightReader.MoveToElement();
@ -2797,14 +2798,14 @@ private:
{
switch(NSStringFinder::ToInt(m_oLightReader.GetText(), 3))
{
case 1: oTS.oAdditionalStyle.m_oFont.SetSize(7.5, UINT_MAX, true); break;
case 2: oTS.oAdditionalStyle.m_oFont.SetSize(10, UINT_MAX, true); break;
case 1: oTS.oAdditionalStyle.m_oFont.SetSize(7.5, NSCSS::UnitMeasure::Point, UINT_MAX, true); break;
case 2: oTS.oAdditionalStyle.m_oFont.SetSize(10, NSCSS::UnitMeasure::Point, UINT_MAX, true); break;
default:
case 3: oTS.oAdditionalStyle.m_oFont.SetSize(12, UINT_MAX, true); break;
case 4: oTS.oAdditionalStyle.m_oFont.SetSize(13.5, UINT_MAX, true); break;
case 5: oTS.oAdditionalStyle.m_oFont.SetSize(18, UINT_MAX, true); break;
case 6: oTS.oAdditionalStyle.m_oFont.SetSize(24, UINT_MAX, true); break;
case 7: oTS.oAdditionalStyle.m_oFont.SetSize(36, UINT_MAX, true); break;
case 3: oTS.oAdditionalStyle.m_oFont.SetSize(12, NSCSS::UnitMeasure::Point, UINT_MAX, true); break;
case 4: oTS.oAdditionalStyle.m_oFont.SetSize(13.5, NSCSS::UnitMeasure::Point, UINT_MAX, true); break;
case 5: oTS.oAdditionalStyle.m_oFont.SetSize(18, NSCSS::UnitMeasure::Point, UINT_MAX, true); break;
case 6: oTS.oAdditionalStyle.m_oFont.SetSize(24, NSCSS::UnitMeasure::Point, UINT_MAX, true); break;
case 7: oTS.oAdditionalStyle.m_oFont.SetSize(36, NSCSS::UnitMeasure::Point, UINT_MAX, true); break;
}
}
else if (L"color" == m_oLightReader.GetName())
@ -2824,7 +2825,7 @@ private:
return false;
CTextSettings oTSP(oTS);
oTSP.oAdditionalStyle.m_oMargin.SetLeft(720, UINT_MAX, true);
oTSP.oAdditionalStyle.m_oMargin.SetLeft(720, NSCSS::UnitMeasure::Twips, UINT_MAX, true);
return readStream(pXml, arSelectors, oTSP);
}
@ -2959,9 +2960,9 @@ private:
CTextSettings oTSPre(oTS);
oTSPre.oAdditionalStyle.m_oFont.SetFamily(L"Courier New", NEXT_LEVEL);
oTSPre.oAdditionalStyle.m_oFont.SetSize(20, NEXT_LEVEL);
oTSPre.oAdditionalStyle.m_oMargin.SetTop(0, NEXT_LEVEL);
oTSPre.oAdditionalStyle.m_oMargin.SetBottom(0, NEXT_LEVEL);
oTSPre.oAdditionalStyle.m_oFont.SetSize(20, NSCSS::UnitMeasure::Point, NEXT_LEVEL);
oTSPre.oAdditionalStyle.m_oMargin.SetTop(0, NSCSS::UnitMeasure::Twips, NEXT_LEVEL);
oTSPre.oAdditionalStyle.m_oMargin.SetBottom(0, NSCSS::UnitMeasure::Twips, NEXT_LEVEL);
oTSPre.bPre = true;
return readStream(pXml, arSelectors, oTSPre);
@ -3756,7 +3757,7 @@ private:
continue;
pStyle->m_oBorder.SetStyle(L"outset", 0, true);
pStyle->m_oBorder.SetWidth(nWidth, 0, true);
pStyle->m_oBorder.SetWidth(nWidth, NSCSS::UnitMeasure::Point, 0, true);
pStyle->m_oBorder.SetColor(L"auto", 0, true);
}
else if (pStyle->m_oBorder.Empty())
@ -3777,38 +3778,38 @@ private:
{
#define SetDefaultBorderSide(side) \
pStyle->m_oBorder.SetStyle##side(L"solid", 0, true); \
pStyle->m_oBorder.SetWidth##side(1, 0, true); \
pStyle->m_oBorder.SetColor##side(L"black", 0, true);
pStyle->m_oBorder.SetWidth##side(1, NSCSS::UnitMeasure::Point, 0, true); \
pStyle->m_oBorder.SetColor##side(L"black", 0, true)
if (NSStringFinder::Equals(L"border", wsFrame))
{
SetDefaultBorderSide()
SetDefaultBorderSide();
}
else if (NSStringFinder::Equals(L"above", wsFrame))
{
SetDefaultBorderSide(TopSide)
SetDefaultBorderSide(TopSide);
}
else if (NSStringFinder::Equals(L"below", wsFrame))
{
SetDefaultBorderSide(BottomSide)
SetDefaultBorderSide(BottomSide);
}
else if (NSStringFinder::Equals(L"hsides", wsFrame))
{
SetDefaultBorderSide(TopSide)
SetDefaultBorderSide(BottomSide)
SetDefaultBorderSide(TopSide);
SetDefaultBorderSide(BottomSide);
}
else if (NSStringFinder::Equals(L"vsides", wsFrame))
{
SetDefaultBorderSide(LeftSide)
SetDefaultBorderSide(RightSide)
SetDefaultBorderSide(LeftSide);
SetDefaultBorderSide(RightSide);
}
else if (NSStringFinder::Equals(L"rhs", wsFrame))
{
SetDefaultBorderSide(RightSide)
SetDefaultBorderSide(RightSide);
}
else if (NSStringFinder::Equals(L"lhs", wsFrame))
{
SetDefaultBorderSide(LeftSide)
SetDefaultBorderSide(LeftSide);
}
}