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