mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Indents fix + gitignore
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -46,3 +46,5 @@ DesktopEditor/fontengine/js/common/freetype-2.10.4
|
|||||||
|
|
||||||
.qtc_clangd
|
.qtc_clangd
|
||||||
Common/3dParty/openssl/openssl/
|
Common/3dParty/openssl/openssl/
|
||||||
|
|
||||||
|
msvc_make.bat
|
||||||
|
|||||||
@ -177,7 +177,7 @@ namespace NSDocxRenderer
|
|||||||
auto& pLastShape = m_arShapes.back();
|
auto& pLastShape = m_arShapes.back();
|
||||||
|
|
||||||
if (pLastShape->m_dLeft == left && pLastShape->m_dTop == top &&
|
if (pLastShape->m_dLeft == left && pLastShape->m_dTop == top &&
|
||||||
pLastShape->m_dWidth == right - left && pLastShape->m_dHeight == bot - top)
|
pLastShape->m_dWidth == right - left && pLastShape->m_dHeight == bot - top)
|
||||||
{
|
{
|
||||||
if (0x00 != (lType & 0x01))
|
if (0x00 != (lType & 0x01))
|
||||||
{
|
{
|
||||||
@ -236,9 +236,9 @@ namespace NSDocxRenderer
|
|||||||
if (!m_oClipVectorGraphics.IsEmpty())
|
if (!m_oClipVectorGraphics.IsEmpty())
|
||||||
{
|
{
|
||||||
CVectorGraphics new_vector_graphics = CVectorGraphics::CalcBoolean(
|
CVectorGraphics new_vector_graphics = CVectorGraphics::CalcBoolean(
|
||||||
m_oCurrVectorGraphics,
|
m_oCurrVectorGraphics,
|
||||||
m_oClipVectorGraphics,
|
m_oClipVectorGraphics,
|
||||||
m_lClipMode);
|
m_lClipMode);
|
||||||
m_oCurrVectorGraphics = std::move(new_vector_graphics);
|
m_oCurrVectorGraphics = std::move(new_vector_graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ namespace NSDocxRenderer
|
|||||||
// big white shape with page width & height skip
|
// big white shape with page width & height skip
|
||||||
if (fabs(pShape->m_dHeight - m_dHeight) <= c_dSHAPE_X_OFFSET * 2 &&
|
if (fabs(pShape->m_dHeight - m_dHeight) <= c_dSHAPE_X_OFFSET * 2 &&
|
||||||
fabs(pShape->m_dWidth - m_dWidth) <= c_dSHAPE_X_OFFSET * 2 &&
|
fabs(pShape->m_dWidth - m_dWidth) <= c_dSHAPE_X_OFFSET * 2 &&
|
||||||
pShape->m_oBrush.Color1 == c_iWhiteColor)
|
pShape->m_oBrush.Color1 == c_iWhiteColor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pShape->m_nOrder = ++m_nShapeOrder;
|
pShape->m_nOrder = ++m_nShapeOrder;
|
||||||
@ -326,9 +326,9 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
// if new text is close to current cont
|
// if new text is close to current cont
|
||||||
if (m_pCurrCont != nullptr &&
|
if (m_pCurrCont != nullptr &&
|
||||||
fabs(m_pCurrCont->m_dBaselinePos - baseline) < c_dTHE_SAME_STRING_Y_PRECISION_MM &&
|
fabs(m_pCurrCont->m_dBaselinePos - baseline) < c_dTHE_SAME_STRING_Y_PRECISION_MM &&
|
||||||
m_oPrevFont.IsEqual2(m_pFont) &&
|
m_oPrevFont.IsEqual2(m_pFont) &&
|
||||||
m_oPrevBrush.IsEqual(m_pBrush))
|
m_oPrevBrush.IsEqual(m_pBrush))
|
||||||
{
|
{
|
||||||
|
|
||||||
double avg_width = width / oText.length();
|
double avg_width = width / oText.length();
|
||||||
@ -338,8 +338,8 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
double avg_space_width = m_pCurrCont->m_pFontStyle->GetAvgSpaceWidth();
|
double avg_space_width = m_pCurrCont->m_pFontStyle->GetAvgSpaceWidth();
|
||||||
double space_width = avg_space_width != 0.0 ?
|
double space_width = avg_space_width != 0.0 ?
|
||||||
avg_space_width * c_dAVERAGE_SPACE_WIDTH_COEF :
|
avg_space_width * c_dAVERAGE_SPACE_WIDTH_COEF :
|
||||||
m_pCurrCont->CalculateSpace() * c_dSPACE_WIDTH_COEF;
|
m_pCurrCont->CalculateSpace() * c_dSPACE_WIDTH_COEF;
|
||||||
|
|
||||||
bool is_added = false;
|
bool is_added = false;
|
||||||
|
|
||||||
@ -611,8 +611,8 @@ namespace NSDocxRenderer
|
|||||||
for (size_t i = 0; i < m_arShapes.size(); ++i)
|
for (size_t i = 0; i < m_arShapes.size(); ++i)
|
||||||
{
|
{
|
||||||
if (!m_arShapes[i] || m_arShapes[i]->m_dHeight > c_dMAX_LINE_HEIGHT_MM || // рассматриваем только тонкие объекты
|
if (!m_arShapes[i] || m_arShapes[i]->m_dHeight > c_dMAX_LINE_HEIGHT_MM || // рассматриваем только тонкие объекты
|
||||||
(m_arShapes[i]->m_eGraphicsType != eGraphicsType::gtRectangle &&
|
(m_arShapes[i]->m_eGraphicsType != eGraphicsType::gtRectangle &&
|
||||||
m_arShapes[i]->m_eGraphicsType != eGraphicsType::gtCurve))
|
m_arShapes[i]->m_eGraphicsType != eGraphicsType::gtCurve))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -801,7 +801,7 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
// берем вторую линию, если символ последний - то начиная со следуюущей, иначе с той же
|
// берем вторую линию, если символ последний - то начиная со следуюущей, иначе с той же
|
||||||
for (size_t uNextLineIndex = uCurrContIndex >= pCurrLine->m_arConts.size() - 1 ?
|
for (size_t uNextLineIndex = uCurrContIndex >= pCurrLine->m_arConts.size() - 1 ?
|
||||||
uCurrLineIndex + 1 : uCurrLineIndex; uNextLineIndex < m_arTextLines.size(); ++uNextLineIndex)
|
uCurrLineIndex + 1 : uCurrLineIndex; uNextLineIndex < m_arTextLines.size(); ++uNextLineIndex)
|
||||||
{
|
{
|
||||||
auto& pNextLine = m_arTextLines[uNextLineIndex];
|
auto& pNextLine = m_arTextLines[uNextLineIndex];
|
||||||
|
|
||||||
@ -831,8 +831,8 @@ namespace NSDocxRenderer
|
|||||||
pNextLine->SetVertAlignType(pNextCont->m_eVertAlignType);
|
pNextLine->SetVertAlignType(pNextCont->m_eVertAlignType);
|
||||||
if ((pCurrLine->m_eVertAlignType == eVertAlignType::vatSuperscript &&
|
if ((pCurrLine->m_eVertAlignType == eVertAlignType::vatSuperscript &&
|
||||||
pNextLine->m_eVertAlignType == eVertAlignType::vatBase) ||
|
pNextLine->m_eVertAlignType == eVertAlignType::vatBase) ||
|
||||||
(pCurrLine->m_eVertAlignType == eVertAlignType::vatBase &&
|
(pCurrLine->m_eVertAlignType == eVertAlignType::vatBase &&
|
||||||
pNextLine->m_eVertAlignType == eVertAlignType::vatSubscript))
|
pNextLine->m_eVertAlignType == eVertAlignType::vatSubscript))
|
||||||
{
|
{
|
||||||
pCurrLine->m_pLine = pNextLine;
|
pCurrLine->m_pLine = pNextLine;
|
||||||
pNextLine->m_pLine = pCurrLine;
|
pNextLine->m_pLine = pCurrLine;
|
||||||
@ -964,20 +964,20 @@ namespace NSDocxRenderer
|
|||||||
double dTopBorder = pCont->m_dTop + pCont->m_dHeight / 3;
|
double dTopBorder = pCont->m_dTop + pCont->m_dHeight / 3;
|
||||||
|
|
||||||
bool bIf1 = pShape->m_eGraphicsType == eGraphicsType::gtRectangle &&
|
bool bIf1 = pShape->m_eGraphicsType == eGraphicsType::gtRectangle &&
|
||||||
pShape->m_eLineType != eLineType::ltUnknown;
|
pShape->m_eLineType != eLineType::ltUnknown;
|
||||||
|
|
||||||
// Условие пересечения по вертикали
|
// Условие пересечения по вертикали
|
||||||
bool bIf2 = pShape->m_dTop > dTopBorder && pShape->m_dBaselinePos < pCont->m_dBaselinePos;
|
bool bIf2 = pShape->m_dTop > dTopBorder && pShape->m_dBaselinePos < pCont->m_dBaselinePos;
|
||||||
|
|
||||||
// Условие пересечения по горизонтали
|
// Условие пересечения по горизонтали
|
||||||
bool bIf3 = h_type != eHorizontalCrossingType::hctUnknown &&
|
bool bIf3 = h_type != eHorizontalCrossingType::hctUnknown &&
|
||||||
h_type != eHorizontalCrossingType::hctCurrentLeftOfNext &&
|
h_type != eHorizontalCrossingType::hctCurrentLeftOfNext &&
|
||||||
h_type != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
h_type != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
||||||
h_type != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext;
|
h_type != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext;
|
||||||
|
|
||||||
// Условие для размеров по высоте
|
// Условие для размеров по высоте
|
||||||
bool bIf4 = pShape->m_dHeight < pCont->m_dHeight &&
|
bool bIf4 = pShape->m_dHeight < pCont->m_dHeight &&
|
||||||
pCont->m_dHeight - pShape->m_dHeight > c_dERROR_FOR_TEXT_WITH_GRAPHICS_MM;
|
pCont->m_dHeight - pShape->m_dHeight > c_dERROR_FOR_TEXT_WITH_GRAPHICS_MM;
|
||||||
|
|
||||||
return bIf1 && bIf2 && bIf3 && bIf4;
|
return bIf1 && bIf2 && bIf3 && bIf4;
|
||||||
}
|
}
|
||||||
@ -987,7 +987,7 @@ namespace NSDocxRenderer
|
|||||||
auto h_type = pCont->CBaseItem::GetHorizontalCrossingType(pShape.get());
|
auto h_type = pCont->CBaseItem::GetHorizontalCrossingType(pShape.get());
|
||||||
bool bIf1 = (pShape->m_eGraphicsType == eGraphicsType::gtRectangle ||
|
bool bIf1 = (pShape->m_eGraphicsType == eGraphicsType::gtRectangle ||
|
||||||
pShape->m_eGraphicsType == eGraphicsType::gtCurve) &&
|
pShape->m_eGraphicsType == eGraphicsType::gtCurve) &&
|
||||||
pShape->m_eLineType != eLineType::ltUnknown;
|
pShape->m_eLineType != eLineType::ltUnknown;
|
||||||
|
|
||||||
//Условие по вертикали
|
//Условие по вертикали
|
||||||
double max_diff = std::min(c_dGRAPHICS_ERROR_MM * 3, pCont->m_dHeight * 0.5);
|
double max_diff = std::min(c_dGRAPHICS_ERROR_MM * 3, pCont->m_dHeight * 0.5);
|
||||||
@ -995,13 +995,13 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
//Условие пересечения по горизонтали
|
//Условие пересечения по горизонтали
|
||||||
bool bIf3 = h_type != eHorizontalCrossingType::hctUnknown &&
|
bool bIf3 = h_type != eHorizontalCrossingType::hctUnknown &&
|
||||||
h_type != eHorizontalCrossingType::hctCurrentLeftOfNext &&
|
h_type != eHorizontalCrossingType::hctCurrentLeftOfNext &&
|
||||||
h_type != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
h_type != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
||||||
h_type != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext;
|
h_type != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext;
|
||||||
|
|
||||||
//Условие для размеров по высоте
|
//Условие для размеров по высоте
|
||||||
bool bIf4 = pShape->m_dHeight < pCont->m_dHeight * 0.5 &&
|
bool bIf4 = pShape->m_dHeight < pCont->m_dHeight * 0.5 &&
|
||||||
pCont->m_dHeight - pShape->m_dHeight > c_dERROR_FOR_TEXT_WITH_GRAPHICS_MM;
|
pCont->m_dHeight - pShape->m_dHeight > c_dERROR_FOR_TEXT_WITH_GRAPHICS_MM;
|
||||||
|
|
||||||
return bIf1 && bIf2 && bIf3 && bIf4;
|
return bIf1 && bIf2 && bIf3 && bIf4;
|
||||||
}
|
}
|
||||||
@ -1023,9 +1023,9 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
//Условие пересечения по горизонтали
|
//Условие пересечения по горизонтали
|
||||||
bool bIf3 = h_type != eHorizontalCrossingType::hctUnknown &&
|
bool bIf3 = h_type != eHorizontalCrossingType::hctUnknown &&
|
||||||
h_type != eHorizontalCrossingType::hctCurrentLeftOfNext &&
|
h_type != eHorizontalCrossingType::hctCurrentLeftOfNext &&
|
||||||
h_type != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
h_type != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
||||||
h_type != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext;
|
h_type != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext;
|
||||||
|
|
||||||
//Цвета должны быть разными
|
//Цвета должны быть разными
|
||||||
bool bIf4 = pCont->m_pFontStyle->oBrush.Color1 != pShape->m_oBrush.Color1;
|
bool bIf4 = pCont->m_pFontStyle->oBrush.Color1 != pShape->m_oBrush.Color1;
|
||||||
@ -1078,9 +1078,9 @@ namespace NSDocxRenderer
|
|||||||
eHorizontalCrossingType eHType = cont->GetHorizontalCrossingType(d_sym.get());
|
eHorizontalCrossingType eHType = cont->GetHorizontalCrossingType(d_sym.get());
|
||||||
|
|
||||||
if (eVType != eVerticalCrossingType::vctNoCrossingCurrentAboveNext &&
|
if (eVType != eVerticalCrossingType::vctNoCrossingCurrentAboveNext &&
|
||||||
eVType != eVerticalCrossingType::vctNoCrossingCurrentBelowNext &&
|
eVType != eVerticalCrossingType::vctNoCrossingCurrentBelowNext &&
|
||||||
eHType != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
eHType != eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext &&
|
||||||
eHType != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext)
|
eHType != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext)
|
||||||
{
|
{
|
||||||
bool bIf1 = eHType == eHorizontalCrossingType::hctCurrentOutsideNext;
|
bool bIf1 = eHType == eHorizontalCrossingType::hctCurrentOutsideNext;
|
||||||
bool bIf2 = eHType == eHorizontalCrossingType::hctCurrentLeftOfNext;
|
bool bIf2 = eHType == eHorizontalCrossingType::hctCurrentLeftOfNext;
|
||||||
@ -1089,7 +1089,7 @@ namespace NSDocxRenderer
|
|||||||
bool bIf5 = eHType == eHorizontalCrossingType::hctRightBorderMatch;
|
bool bIf5 = eHType == eHorizontalCrossingType::hctRightBorderMatch;
|
||||||
|
|
||||||
bool bIf6 = eVType == eVerticalCrossingType::vctCurrentBelowNext ||
|
bool bIf6 = eVType == eVerticalCrossingType::vctCurrentBelowNext ||
|
||||||
eVType == eVerticalCrossingType::vctCurrentAboveNext;
|
eVType == eVerticalCrossingType::vctCurrentAboveNext;
|
||||||
bool bIf7 = eVType == eVerticalCrossingType::vctTopAndBottomBordersMatch;
|
bool bIf7 = eVType == eVerticalCrossingType::vctTopAndBottomBordersMatch;
|
||||||
bool bIf8 = eVType == eVerticalCrossingType::vctDublicate;
|
bool bIf8 = eVType == eVerticalCrossingType::vctDublicate;
|
||||||
|
|
||||||
@ -1120,7 +1120,7 @@ namespace NSDocxRenderer
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (line->m_eVertAlignType == eVertAlignType::vatSuperscript
|
if (line->m_eVertAlignType == eVertAlignType::vatSuperscript
|
||||||
|| line->m_eVertAlignType == eVertAlignType::vatSubscript)
|
|| line->m_eVertAlignType == eVertAlignType::vatSubscript)
|
||||||
{
|
{
|
||||||
std::shared_ptr<CTextLine>& base_line = line->m_pLine;
|
std::shared_ptr<CTextLine>& base_line = line->m_pLine;
|
||||||
if (base_line)
|
if (base_line)
|
||||||
@ -1214,11 +1214,11 @@ namespace NSDocxRenderer
|
|||||||
if (pCont->m_pShape && pCont->m_pShape != pDominantShape)
|
if (pCont->m_pShape && pCont->m_pShape != pDominantShape)
|
||||||
{
|
{
|
||||||
if (pCont->m_pShape->m_dLeft < pCont->m_dLeft &&
|
if (pCont->m_pShape->m_dLeft < pCont->m_dLeft &&
|
||||||
pCont->m_pShape->m_dRight > pCont->m_dRight)
|
pCont->m_pShape->m_dRight > pCont->m_dRight)
|
||||||
{
|
{
|
||||||
if (!pDominantShape ||
|
if (!pDominantShape ||
|
||||||
(pCont->m_pShape->m_dLeft < pDominantShape->m_dLeft &&
|
(pCont->m_pShape->m_dLeft < pDominantShape->m_dLeft &&
|
||||||
pCont->m_pShape->m_dRight > pDominantShape->m_dRight))
|
pCont->m_pShape->m_dRight > pDominantShape->m_dRight))
|
||||||
{
|
{
|
||||||
pDominantShape = pCont->m_pShape;
|
pDominantShape = pCont->m_pShape;
|
||||||
}
|
}
|
||||||
@ -1283,11 +1283,11 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
const double out_of_page_coeff = 1.1;
|
const double out_of_page_coeff = 1.1;
|
||||||
bool is_out_of_page = shape->m_dTop < 0 ||
|
bool is_out_of_page = shape->m_dTop < 0 ||
|
||||||
shape->m_dBaselinePos > this->m_dHeight * out_of_page_coeff ||
|
shape->m_dBaselinePos > this->m_dHeight * out_of_page_coeff ||
|
||||||
shape->m_dLeft < 0 ||
|
shape->m_dLeft < 0 ||
|
||||||
shape->m_dRight > this->m_dWidth * out_of_page_coeff;
|
shape->m_dRight > this->m_dWidth * out_of_page_coeff;
|
||||||
bool is_too_big = ((shape->m_dWidth > c_dSHAPE_TROUGH_MAX_MM || shape->m_dHeight > c_dSHAPE_TROUGH_MAX_MM) &&
|
bool is_too_big = ((shape->m_dWidth > c_dSHAPE_TROUGH_MAX_MM || shape->m_dHeight > c_dSHAPE_TROUGH_MAX_MM) &&
|
||||||
(shape->m_eSimpleLineType == eSimpleLineType::sltUnknown));
|
(shape->m_eSimpleLineType == eSimpleLineType::sltUnknown));
|
||||||
|
|
||||||
if (is_too_big || is_out_of_page)
|
if (is_too_big || is_out_of_page)
|
||||||
continue;
|
continue;
|
||||||
@ -1298,14 +1298,14 @@ namespace NSDocxRenderer
|
|||||||
double& s_bot = shape->m_dBaselinePos;
|
double& s_bot = shape->m_dBaselinePos;
|
||||||
|
|
||||||
bool lines_condition = shape->m_eSimpleLineType != eSimpleLineType::sltUnknown &&
|
bool lines_condition = shape->m_eSimpleLineType != eSimpleLineType::sltUnknown &&
|
||||||
!((s_right < left) || (s_left > right)) &&
|
!((s_right < left) || (s_left > right)) &&
|
||||||
!((s_bot < top) || (s_top > bot));
|
!((s_bot < top) || (s_top > bot));
|
||||||
|
|
||||||
bool rectangle_condition = shape->m_eGraphicsType == eGraphicsType::gtRectangle &&
|
bool rectangle_condition = shape->m_eGraphicsType == eGraphicsType::gtRectangle &&
|
||||||
shape->m_eSimpleLineType == eSimpleLineType::sltUnknown &&
|
shape->m_eSimpleLineType == eSimpleLineType::sltUnknown &&
|
||||||
!((s_right < left) || (s_left > right)) &&
|
!((s_right < left) || (s_left > right)) &&
|
||||||
!((s_bot < top) || (s_top > bot)) &&
|
!((s_bot < top) || (s_top > bot)) &&
|
||||||
!(s_top < top && s_bot > bot && s_left < left && s_right > right);
|
!(s_top < top && s_bot > bot && s_left < left && s_right > right);
|
||||||
|
|
||||||
if (lines_condition || rectangle_condition)
|
if (lines_condition || rectangle_condition)
|
||||||
{
|
{
|
||||||
@ -1333,8 +1333,8 @@ namespace NSDocxRenderer
|
|||||||
bool is_shape_trough = IsShapeBorderTrough(line->m_arConts[i], x_crossing, y_crossing);
|
bool is_shape_trough = IsShapeBorderTrough(line->m_arConts[i], x_crossing, y_crossing);
|
||||||
|
|
||||||
if ((i != line->m_arConts.size() - 1 && line->m_arConts[i + 1]->m_bPossibleSplit && is_space)
|
if ((i != line->m_arConts.size() - 1 && line->m_arConts[i + 1]->m_bPossibleSplit && is_space)
|
||||||
|| (is_space && is_cont_wide)
|
|| (is_space && is_cont_wide)
|
||||||
|| is_shape_trough)
|
|| is_shape_trough)
|
||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<CContText>> line_conts_first;
|
std::vector<std::shared_ptr<CContText>> line_conts_first;
|
||||||
std::vector<std::shared_ptr<CContText>> line_conts_second;
|
std::vector<std::shared_ptr<CContText>> line_conts_second;
|
||||||
@ -1455,9 +1455,9 @@ namespace NSDocxRenderer
|
|||||||
{
|
{
|
||||||
auto no_crossing = [] (const eHorizontalCrossingType& h_type, const eVerticalCrossingType& v_type) {
|
auto no_crossing = [] (const eHorizontalCrossingType& h_type, const eVerticalCrossingType& v_type) {
|
||||||
return h_type == eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext ||
|
return h_type == eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext ||
|
||||||
h_type == eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext ||
|
h_type == eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext ||
|
||||||
v_type == eVerticalCrossingType::vctNoCrossingCurrentAboveNext ||
|
v_type == eVerticalCrossingType::vctNoCrossingCurrentAboveNext ||
|
||||||
v_type == eVerticalCrossingType::vctNoCrossingCurrentBelowNext;
|
v_type == eVerticalCrossingType::vctNoCrossingCurrentBelowNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
// линии из которых сделаем шейпы
|
// линии из которых сделаем шейпы
|
||||||
@ -1820,7 +1820,7 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
// 1 строчка в параграфе
|
// 1 строчка в параграфе
|
||||||
if (m_eTextAssociationType == TextAssociationType::tatPlainLine ||
|
if (m_eTextAssociationType == TextAssociationType::tatPlainLine ||
|
||||||
m_eTextAssociationType == TextAssociationType::tatShapeLine)
|
m_eTextAssociationType == TextAssociationType::tatShapeLine)
|
||||||
{
|
{
|
||||||
auto paragraph = std::make_shared<CParagraph>();
|
auto paragraph = std::make_shared<CParagraph>();
|
||||||
for (auto& curr_line : m_arTextLines)
|
for (auto& curr_line : m_arTextLines)
|
||||||
@ -1843,7 +1843,7 @@ namespace NSDocxRenderer
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (m_eTextAssociationType == TextAssociationType::tatPlainParagraph ||
|
if (m_eTextAssociationType == TextAssociationType::tatPlainParagraph ||
|
||||||
m_eTextAssociationType == TextAssociationType::tatPlainLine)
|
m_eTextAssociationType == TextAssociationType::tatPlainLine)
|
||||||
{
|
{
|
||||||
CBaseItem* prev_p = nullptr;
|
CBaseItem* prev_p = nullptr;
|
||||||
|
|
||||||
|
|||||||
@ -537,7 +537,7 @@ namespace NSDocxRenderer
|
|||||||
void CContText::AddTextBack(const NSStringUtils::CStringUTF32& oText, const std::vector<double>& arSymWidths)
|
void CContText::AddTextBack(const NSStringUtils::CStringUTF32& oText, const std::vector<double>& arSymWidths)
|
||||||
{
|
{
|
||||||
bool is_space_twice = m_oText.at(m_oText.length() - 1) == c_SPACE_SYM &&
|
bool is_space_twice = m_oText.at(m_oText.length() - 1) == c_SPACE_SYM &&
|
||||||
oText.at(0) == c_SPACE_SYM;
|
oText.at(0) == c_SPACE_SYM;
|
||||||
|
|
||||||
for (size_t i = 0; i < arSymWidths.size(); ++i)
|
for (size_t i = 0; i < arSymWidths.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -638,10 +638,10 @@ namespace NSDocxRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CContText::CheckFontEffects
|
bool CContText::CheckFontEffects
|
||||||
(std::shared_ptr<CContText>& pFirstCont,
|
(std::shared_ptr<CContText>& pFirstCont,
|
||||||
std::shared_ptr<CContText>& pSecondCont,
|
std::shared_ptr<CContText>& pSecondCont,
|
||||||
eVerticalCrossingType eVType,
|
eVerticalCrossingType eVType,
|
||||||
eHorizontalCrossingType eHType)
|
eHorizontalCrossingType eHType)
|
||||||
{
|
{
|
||||||
//Условие пересечения по вертикали
|
//Условие пересечения по вертикали
|
||||||
bool bIf1 = eVType == eVerticalCrossingType::vctCurrentAboveNext; //текущий cont выше
|
bool bIf1 = eVType == eVerticalCrossingType::vctCurrentAboveNext; //текущий cont выше
|
||||||
@ -721,24 +721,24 @@ namespace NSDocxRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CContText::CheckVertAlignTypeBetweenConts
|
bool CContText::CheckVertAlignTypeBetweenConts
|
||||||
(std::shared_ptr<CContText> pFirstCont,
|
(std::shared_ptr<CContText> pFirstCont,
|
||||||
std::shared_ptr<CContText> pSecondCont,
|
std::shared_ptr<CContText> pSecondCont,
|
||||||
eVerticalCrossingType eVType,
|
eVerticalCrossingType eVType,
|
||||||
eHorizontalCrossingType eHType)
|
eHorizontalCrossingType eHType)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool bIf1 = eVType == eVerticalCrossingType::vctCurrentAboveNext ||
|
bool bIf1 = eVType == eVerticalCrossingType::vctCurrentAboveNext ||
|
||||||
eVType == eVerticalCrossingType::vctCurrentInsideNext;
|
eVType == eVerticalCrossingType::vctCurrentInsideNext;
|
||||||
|
|
||||||
bool bIf2 = eVType == eVerticalCrossingType::vctCurrentBelowNext;
|
bool bIf2 = eVType == eVerticalCrossingType::vctCurrentBelowNext;
|
||||||
|
|
||||||
bool bIf3 = (eHType == eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext ||
|
bool bIf3 = (eHType == eHorizontalCrossingType::hctNoCrossingCurrentLeftOfNext ||
|
||||||
eHType == eHorizontalCrossingType::hctCurrentLeftOfNext) &&
|
eHType == eHorizontalCrossingType::hctCurrentLeftOfNext) &&
|
||||||
fabs(pFirstCont->m_dRight - pSecondCont->m_dLeft) < c_dTHE_STRING_X_PRECISION_MM * 3;
|
fabs(pFirstCont->m_dRight - pSecondCont->m_dLeft) < c_dTHE_STRING_X_PRECISION_MM * 3;
|
||||||
|
|
||||||
bool bIf4 = (eHType == eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext ||
|
bool bIf4 = (eHType == eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext ||
|
||||||
eHType == eHorizontalCrossingType::hctCurrentRightOfNext) &&
|
eHType == eHorizontalCrossingType::hctCurrentRightOfNext) &&
|
||||||
fabs(pFirstCont->m_dLeft - pSecondCont->m_dRight) < c_dTHE_STRING_X_PRECISION_MM * 3;
|
fabs(pFirstCont->m_dLeft - pSecondCont->m_dRight) < c_dTHE_STRING_X_PRECISION_MM * 3;
|
||||||
|
|
||||||
//Размеры шрифта должны бать разными
|
//Размеры шрифта должны бать разными
|
||||||
bool bIf5 = pFirstCont->m_pFontStyle->dFontSize * 0.7 > pSecondCont->m_pFontStyle->dFontSize;
|
bool bIf5 = pFirstCont->m_pFontStyle->dFontSize * 0.7 > pSecondCont->m_pFontStyle->dFontSize;
|
||||||
|
|||||||
@ -114,16 +114,16 @@ namespace NSDocxRenderer
|
|||||||
// check font effect and delete not needed cont
|
// check font effect and delete not needed cont
|
||||||
// return true if was deleted
|
// return true if was deleted
|
||||||
static bool CheckFontEffects
|
static bool CheckFontEffects
|
||||||
(std::shared_ptr<CContText>& pFirstCont,
|
(std::shared_ptr<CContText>& pFirstCont,
|
||||||
std::shared_ptr<CContText>& pSecondCont,
|
std::shared_ptr<CContText>& pSecondCont,
|
||||||
eVerticalCrossingType eVType,
|
eVerticalCrossingType eVType,
|
||||||
eHorizontalCrossingType eHType);
|
eHorizontalCrossingType eHType);
|
||||||
|
|
||||||
static bool CheckVertAlignTypeBetweenConts
|
static bool CheckVertAlignTypeBetweenConts
|
||||||
(std::shared_ptr<CContText> pFirstCont,
|
(std::shared_ptr<CContText> pFirstCont,
|
||||||
std::shared_ptr<CContText> pSecondCont,
|
std::shared_ptr<CContText> pSecondCont,
|
||||||
eVerticalCrossingType eVType,
|
eVerticalCrossingType eVType,
|
||||||
eHorizontalCrossingType eHType);
|
eHorizontalCrossingType eHType);
|
||||||
|
|
||||||
double CalculateSpace() const noexcept;
|
double CalculateSpace() const noexcept;
|
||||||
|
|
||||||
|
|||||||
@ -104,39 +104,39 @@ namespace NSDocxRenderer
|
|||||||
double dVerNearby = 30;
|
double dVerNearby = 30;
|
||||||
|
|
||||||
if(
|
if(
|
||||||
// только для фигур
|
// только для фигур
|
||||||
(pShape->m_eGraphicsType == eGraphicsType::gtComplicatedFigure ||
|
(pShape->m_eGraphicsType == eGraphicsType::gtComplicatedFigure ||
|
||||||
pShape->m_eGraphicsType == eGraphicsType::gtRectangle) &&
|
pShape->m_eGraphicsType == eGraphicsType::gtRectangle) &&
|
||||||
|
|
||||||
(this->m_eGraphicsType == eGraphicsType::gtComplicatedFigure ||
|
(this->m_eGraphicsType == eGraphicsType::gtComplicatedFigure ||
|
||||||
this->m_eGraphicsType == eGraphicsType::gtRectangle) &&
|
this->m_eGraphicsType == eGraphicsType::gtRectangle) &&
|
||||||
|
|
||||||
// все совпадает
|
// все совпадает
|
||||||
pShape->m_eType == this->m_eType &&
|
pShape->m_eType == this->m_eType &&
|
||||||
pShape->m_oPen.IsEqual(&m_oPen) &&
|
pShape->m_oPen.IsEqual(&m_oPen) &&
|
||||||
pShape->m_oBrush.IsEqual(&m_oBrush) &&
|
pShape->m_oBrush.IsEqual(&m_oBrush) &&
|
||||||
pShape->m_bIsNoFill == m_bIsNoFill &&
|
pShape->m_bIsNoFill == m_bIsNoFill &&
|
||||||
pShape->m_bIsNoStroke == m_bIsNoStroke &&
|
pShape->m_bIsNoStroke == m_bIsNoStroke &&
|
||||||
|
|
||||||
// не картинка
|
// не картинка
|
||||||
pShape->m_pImageInfo == nullptr &&
|
pShape->m_pImageInfo == nullptr &&
|
||||||
this->m_pImageInfo == nullptr &&
|
this->m_pImageInfo == nullptr &&
|
||||||
|
|
||||||
// недалеко друг от друга по горизонтали
|
// недалеко друг от друга по горизонтали
|
||||||
(fabs(pShape->m_dRight - this->m_dLeft) < dHorNearby ||
|
(fabs(pShape->m_dRight - this->m_dLeft) < dHorNearby ||
|
||||||
fabs(pShape->m_dLeft - this->m_dRight) < dHorNearby ||
|
fabs(pShape->m_dLeft - this->m_dRight) < dHorNearby ||
|
||||||
|
|
||||||
// друг в друге тоже учитываем
|
// друг в друге тоже учитываем
|
||||||
fabs(pShape->m_dRight - this->m_dRight) < dHorNearby ||
|
fabs(pShape->m_dRight - this->m_dRight) < dHorNearby ||
|
||||||
fabs(pShape->m_dLeft - this->m_dLeft) < dHorNearby) &&
|
fabs(pShape->m_dLeft - this->m_dLeft) < dHorNearby) &&
|
||||||
|
|
||||||
// недалеко друг от друга по вертикали
|
// недалеко друг от друга по вертикали
|
||||||
(fabs(pShape->m_dBaselinePos - this->m_dTop) < dVerNearby ||
|
(fabs(pShape->m_dBaselinePos - this->m_dTop) < dVerNearby ||
|
||||||
fabs(pShape->m_dTop - this->m_dBaselinePos) < dVerNearby ||
|
fabs(pShape->m_dTop - this->m_dBaselinePos) < dVerNearby ||
|
||||||
|
|
||||||
// друг в друге
|
// друг в друге
|
||||||
fabs(pShape->m_dBaselinePos - this->m_dBaselinePos) < dVerNearby ||
|
fabs(pShape->m_dBaselinePos - this->m_dBaselinePos) < dVerNearby ||
|
||||||
fabs(pShape->m_dTop - this->m_dTop) < dVerNearby))
|
fabs(pShape->m_dTop - this->m_dTop) < dVerNearby))
|
||||||
{
|
{
|
||||||
RecalcWithNewItem(pShape.get());
|
RecalcWithNewItem(pShape.get());
|
||||||
m_oVector.Join(std::move(pShape->m_oVector));
|
m_oVector.Join(std::move(pShape->m_oVector));
|
||||||
@ -239,7 +239,7 @@ namespace NSDocxRenderer
|
|||||||
{
|
{
|
||||||
//note параллельно для каждой текстовой строки создается шейп, который содержит цвет фона для данного текста.
|
//note параллельно для каждой текстовой строки создается шейп, который содержит цвет фона для данного текста.
|
||||||
if ((m_bIsNoStroke && m_bIsNoFill) ||
|
if ((m_bIsNoStroke && m_bIsNoFill) ||
|
||||||
(m_oBrush.Color1 == c_iWhiteColor && m_oPen.Color == c_iWhiteColor))
|
(m_oBrush.Color1 == c_iWhiteColor && m_oPen.Color == c_iWhiteColor))
|
||||||
{
|
{
|
||||||
m_eGraphicsType = eGraphicsType::gtNoGraphics;
|
m_eGraphicsType = eGraphicsType::gtNoGraphics;
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ namespace NSDocxRenderer
|
|||||||
bool CShape::IsItFitLine() const noexcept
|
bool CShape::IsItFitLine() const noexcept
|
||||||
{
|
{
|
||||||
return (m_eGraphicsType == eGraphicsType::gtRectangle && (m_eSimpleLineType == eSimpleLineType::sltHDot || m_eSimpleLineType == eSimpleLineType::sltHDash || m_eSimpleLineType == eSimpleLineType::sltHLongDash)) ||
|
return (m_eGraphicsType == eGraphicsType::gtRectangle && (m_eSimpleLineType == eSimpleLineType::sltHDot || m_eSimpleLineType == eSimpleLineType::sltHDash || m_eSimpleLineType == eSimpleLineType::sltHLongDash)) ||
|
||||||
(m_eGraphicsType == eGraphicsType::gtCurve && m_eSimpleLineType == eSimpleLineType::sltHWave);
|
(m_eGraphicsType == eGraphicsType::gtCurve && m_eSimpleLineType == eSimpleLineType::sltHWave);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CShape::IsCorrelated(std::shared_ptr<const CShape> pShape) const noexcept
|
bool CShape::IsCorrelated(std::shared_ptr<const CShape> pShape) const noexcept
|
||||||
@ -334,7 +334,7 @@ namespace NSDocxRenderer
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pFirstShape->IsItFitLine() || !pSecondShape->IsItFitLine() || !pFirstShape->IsCorrelated(pSecondShape) ||
|
if (!pFirstShape->IsItFitLine() || !pSecondShape->IsItFitLine() || !pFirstShape->IsCorrelated(pSecondShape) ||
|
||||||
fabs(pFirstShape->m_dHeight - pSecondShape->m_dHeight) > c_dGRAPHICS_ERROR_IN_LINES_MM) // линия должна быть одного размера по высоте
|
fabs(pFirstShape->m_dHeight - pSecondShape->m_dHeight) > c_dGRAPHICS_ERROR_IN_LINES_MM) // линия должна быть одного размера по высоте
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -509,7 +509,7 @@ namespace NSDocxRenderer
|
|||||||
else if (pSecondShape->m_eSimpleLineType == eSimpleLineType::sltHDash)
|
else if (pSecondShape->m_eSimpleLineType == eSimpleLineType::sltHDash)
|
||||||
{
|
{
|
||||||
if ((pFirstShape->m_eLineType == eLineType::ltDotDash || pFirstShape->m_eLineType == eLineType::ltDashDotHeavy) &&
|
if ((pFirstShape->m_eLineType == eLineType::ltDotDash || pFirstShape->m_eLineType == eLineType::ltDashDotHeavy) &&
|
||||||
pSecondShape->m_eLineType == eLineType::ltUnknown)
|
pSecondShape->m_eLineType == eLineType::ltUnknown)
|
||||||
{
|
{
|
||||||
pFirstShape->m_eSimpleLineType = eSimpleLineType::sltHDash;
|
pFirstShape->m_eSimpleLineType = eSimpleLineType::sltHDash;
|
||||||
passed = true;
|
passed = true;
|
||||||
@ -558,7 +558,7 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
case eSimpleLineType::sltHLongDash:
|
case eSimpleLineType::sltHLongDash:
|
||||||
if (fabs(pFirstShape->m_dLeft +pFirstShape->m_dWidth - pSecondShape->m_dLeft) < 0.7 ||
|
if (fabs(pFirstShape->m_dLeft +pFirstShape->m_dWidth - pSecondShape->m_dLeft) < 0.7 ||
|
||||||
pFirstShape->m_eLineType == eLineType::ltThick || pFirstShape->m_eLineType == eLineType::ltSingle)
|
pFirstShape->m_eLineType == eLineType::ltThick || pFirstShape->m_eLineType == eLineType::ltSingle)
|
||||||
{
|
{
|
||||||
pFirstShape->m_eLineType = pFirstShape->m_dHeight > 0.3 ? eLineType::ltThick : eLineType::ltSingle;
|
pFirstShape->m_eLineType = pFirstShape->m_dHeight > 0.3 ? eLineType::ltThick : eLineType::ltSingle;
|
||||||
passed = true;
|
passed = true;
|
||||||
@ -574,7 +574,7 @@ namespace NSDocxRenderer
|
|||||||
case eSimpleLineType::sltHWave:
|
case eSimpleLineType::sltHWave:
|
||||||
if ((pFirstShape->m_eLineType == eLineType::ltUnknown || pFirstShape->m_eLineType == eLineType::ltWave ||
|
if ((pFirstShape->m_eLineType == eLineType::ltUnknown || pFirstShape->m_eLineType == eLineType::ltWave ||
|
||||||
pFirstShape->m_eLineType == eLineType::ltWavyHeavy || pFirstShape->m_eLineType == eLineType::ltWavyDouble) &&
|
pFirstShape->m_eLineType == eLineType::ltWavyHeavy || pFirstShape->m_eLineType == eLineType::ltWavyDouble) &&
|
||||||
pSecondShape->m_eLineType == eLineType::ltUnknown)
|
pSecondShape->m_eLineType == eLineType::ltUnknown)
|
||||||
{
|
{
|
||||||
pFirstShape->m_eLineType = pFirstShape->m_oPen.Size > 0.3 ? eLineType::ltWavyHeavy : eLineType::ltWave;
|
pFirstShape->m_eLineType = pFirstShape->m_oPen.Size > 0.3 ? eLineType::ltWavyHeavy : eLineType::ltWave;
|
||||||
passed = true;
|
passed = true;
|
||||||
|
|||||||
@ -63,8 +63,8 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
double avg_space_width = pCurrent->m_pFontStyle->GetAvgSpaceWidth();
|
double avg_space_width = pCurrent->m_pFontStyle->GetAvgSpaceWidth();
|
||||||
double space_width = avg_space_width != 0.0 ?
|
double space_width = avg_space_width != 0.0 ?
|
||||||
avg_space_width * c_dAVERAGE_SPACE_WIDTH_COEF :
|
avg_space_width * c_dAVERAGE_SPACE_WIDTH_COEF :
|
||||||
pCurrent->CalculateSpace() * c_dSPACE_WIDTH_COEF;
|
pCurrent->CalculateSpace() * c_dSPACE_WIDTH_COEF;
|
||||||
|
|
||||||
double dDifference = pCurrent->m_dLeft - pFirst->m_dRight;
|
double dDifference = pCurrent->m_dLeft - pFirst->m_dRight;
|
||||||
|
|
||||||
|
|||||||
@ -421,9 +421,6 @@ namespace NSDocxRenderer
|
|||||||
oFormat.ulCodeRange1 = new UINT(dwCodePage1);
|
oFormat.ulCodeRange1 = new UINT(dwCodePage1);
|
||||||
oFormat.ulCodeRange2 = new UINT(dwCodePage2);
|
oFormat.ulCodeRange2 = new UINT(dwCodePage2);
|
||||||
|
|
||||||
// oFormat.shAscent = new SHORT(oFontMetrics.dAscent);
|
|
||||||
// oFormat.shDescent = new SHORT(oFontMetrics.dDescent);
|
|
||||||
|
|
||||||
if (oFormat.bBold && *(oFormat.bBold) == 1 && oFormat.pPanose && oFormat.pPanose[2] < 7)
|
if (oFormat.bBold && *(oFormat.bBold) == 1 && oFormat.pPanose && oFormat.pPanose[2] < 7)
|
||||||
oFormat.pPanose[2] = 7;
|
oFormat.pPanose[2] = 7;
|
||||||
|
|
||||||
|
|||||||
@ -41,14 +41,14 @@ namespace NSDocxRenderer
|
|||||||
for(auto it = m_arFontStyles.begin(); it != m_arFontStyles.end(); ++it)
|
for(auto it = m_arFontStyles.begin(); it != m_arFontStyles.end(); ++it)
|
||||||
{
|
{
|
||||||
if (oBrush.Type == (*it)->oBrush.Type &&
|
if (oBrush.Type == (*it)->oBrush.Type &&
|
||||||
oBrush.Color1 == (*it)->oBrush.Color1 &&
|
oBrush.Color1 == (*it)->oBrush.Color1 &&
|
||||||
oBrush.Color2 == (*it)->oBrush.Color2 &&
|
oBrush.Color2 == (*it)->oBrush.Color2 &&
|
||||||
oBrush.Alpha1 == (*it)->oBrush.Alpha1 &&
|
oBrush.Alpha1 == (*it)->oBrush.Alpha1 &&
|
||||||
oBrush.Alpha2 == (*it)->oBrush.Alpha2 &&
|
oBrush.Alpha2 == (*it)->oBrush.Alpha2 &&
|
||||||
oBrush.LinearAngle == (*it)->oBrush.LinearAngle &&
|
oBrush.LinearAngle == (*it)->oBrush.LinearAngle &&
|
||||||
dFontSize == (*it)->dFontSize &&
|
dFontSize == (*it)->dFontSize &&
|
||||||
wsFontName == (*it)->wsFontName &&
|
wsFontName == (*it)->wsFontName &&
|
||||||
(bItalic == (*it)->bItalic) && (bBold == (*it)->bBold))
|
(bItalic == (*it)->bItalic) && (bBold == (*it)->bBold))
|
||||||
{
|
{
|
||||||
auto val = *it;
|
auto val = *it;
|
||||||
|
|
||||||
|
|||||||
@ -16,10 +16,10 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
std::shared_ptr<CFontStyle> GetOrAddFontStyle(const CFontStyle& oFontStyle);
|
std::shared_ptr<CFontStyle> GetOrAddFontStyle(const CFontStyle& oFontStyle);
|
||||||
std::shared_ptr<CFontStyle> GetOrAddFontStyle(const NSStructures::CBrush& oBrush,
|
std::shared_ptr<CFontStyle> GetOrAddFontStyle(const NSStructures::CBrush& oBrush,
|
||||||
const std::wstring& wsFontName,
|
const std::wstring& wsFontName,
|
||||||
double dFontSize,
|
double dFontSize,
|
||||||
bool bItalic,
|
bool bItalic,
|
||||||
bool bBold);
|
bool bBold);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<std::shared_ptr<CFontStyle>> m_arFontStyles;
|
std::list<std::shared_ptr<CFontStyle>> m_arFontStyles;
|
||||||
|
|||||||
Reference in New Issue
Block a user