diff --git a/DocxRenderer/DocxRenderer.h b/DocxRenderer/DocxRenderer.h
index 0c3a129e52..0972389254 100644
--- a/DocxRenderer/DocxRenderer.h
+++ b/DocxRenderer/DocxRenderer.h
@@ -50,10 +50,10 @@ namespace NSDocxRenderer
{
enum TextAssociationType
{
- TextAssociationTypeDefault = 0,
- TextAssociationTypeLine = 1,
- TextAssociationTypeNoFrames = 2,
- TextAssociationTypeBlock = 3
+ TextAssociationTypeBlockChar = 0, // Каждый символ во фрейме
+ TextAssociationTypeBlockLine = 1, // Каждая линия - параграф во фрейме. Линии могут объединяться в рамках одного блока.
+ TextAssociationTypePlainLine = 2, // Каждая линия - параграф обычный
+ TextAssociationTypePlainParagraph = 3 // Линии объединяются в параграфы
};
}
diff --git a/DocxRenderer/src/logic/ElementParagraph.h b/DocxRenderer/src/logic/ElementParagraph.h
index d6707c5aaa..aebf0e605c 100644
--- a/DocxRenderer/src/logic/ElementParagraph.h
+++ b/DocxRenderer/src/logic/ElementParagraph.h
@@ -585,8 +585,7 @@ namespace NSDocxRenderer
switch (m_eTextAssociationType)
{
- case TextAssociationTypeDefault:
- case TextAssociationTypeLine:
+ case TextAssociationTypeBlockChar:
{
oWriter.WriteString(L"");
break;
}
- case TextAssociationTypeBlock:
+ case TextAssociationTypeBlockLine:
{
oWriter.WriteString(L"");
break;
}
- case TextAssociationTypeNoFrames:
+ case TextAssociationTypePlainLine:
{
oWriter.WriteString(L"m_dBaselinePos = dBaseLinePos;
@@ -548,8 +548,7 @@ namespace NSDocxRenderer
switch (m_eTextAssociationType)
{
- case TextAssociationTypeDefault:
- case TextAssociationTypeLine:
+ case TextAssociationTypeBlockChar:
{
size_t nCount = m_arTextLine.size();
for (size_t i = 0; i < nCount; ++i)
@@ -572,59 +571,59 @@ namespace NSDocxRenderer
m_arTextLine.clear();
break;
}
- case TextAssociationTypeBlock:
+ case TextAssociationTypeBlockLine:
+ {
+ size_t nCount = m_arTextLine.size();
+
+ if (0 == nCount)
+ break;
+
+ CTextLine* pFirstLine = m_arTextLine[0];
+
+ CParagraph* pParagraph = new CParagraph(m_eTextAssociationType);
+ pParagraph->m_pManagerLight = &m_oManagerLight;
+ pParagraph->m_bIsTextFrameProperties = true;
+
+ pParagraph->m_dLeft = pFirstLine->m_dX;
+ pParagraph->m_dTop = pFirstLine->m_dBaselinePos - pFirstLine->m_dHeight + pFirstLine->m_dBaselineOffset;
+ double dCurrentTop = pParagraph->m_dTop;
+
+ pParagraph->m_arLines.push_back(pFirstLine);
+
+ m_arParagraphs.push_back(pParagraph);
+
+ for (size_t i = 1; i < nCount; ++i)
{
- size_t nCount = m_arTextLine.size();
-
- if (0 == nCount)
- break;
-
- CTextLine* pFirstLine = m_arTextLine[0];
+ CTextLine* pTextLine = m_arTextLine[i];
CParagraph* pParagraph = new CParagraph(m_eTextAssociationType);
pParagraph->m_pManagerLight = &m_oManagerLight;
pParagraph->m_bIsTextFrameProperties = true;
- pParagraph->m_dLeft = pFirstLine->m_dX;
- pParagraph->m_dTop = pFirstLine->m_dBaselinePos - pFirstLine->m_dHeight + pFirstLine->m_dBaselineOffset;
- double dCurrentTop = pParagraph->m_dTop;
-
- pParagraph->m_arLines.push_back(pFirstLine);
-
- m_arParagraphs.push_back(pParagraph);
-
- for (size_t i = 1; i < nCount; ++i)
+ if (((fabs(pTextLine->m_dBaselinePos - pTextLine->m_dHeight - pFirstLine->m_dBaselinePos) > STANDART_STRING_HEIGHT_MM) && (pTextLine->m_dX == pFirstLine->m_dX)) ||
+ ((pTextLine->m_dX != pFirstLine->m_dX) && (pTextLine->m_dBaselinePos != pFirstLine->m_dBaselinePos)))
{
- CTextLine* pTextLine = m_arTextLine[i];
-
- CParagraph* pParagraph = new CParagraph(m_eTextAssociationType);
- pParagraph->m_pManagerLight = &m_oManagerLight;
- pParagraph->m_bIsTextFrameProperties = true;
-
- if (((fabs(pTextLine->m_dBaselinePos - pTextLine->m_dHeight - pFirstLine->m_dBaselinePos) > STANDART_STRING_HEIGHT_MM) && (pTextLine->m_dX == pFirstLine->m_dX)) ||
- ((pTextLine->m_dX != pFirstLine->m_dX) && (pTextLine->m_dBaselinePos != pFirstLine->m_dBaselinePos)))
- {
- pParagraph->m_dLeft = pTextLine->m_dX;
- pParagraph->m_dTop = pTextLine->m_dBaselinePos - pTextLine->m_dHeight + pTextLine->m_dBaselineOffset;
- dCurrentTop = pParagraph->m_dTop;
- }
- else
- {
- pParagraph->m_dLeft = pFirstLine->m_dX;
- pParagraph->m_dTop = dCurrentTop;
- }
-
- pFirstLine = pTextLine;
-
- pParagraph->m_arLines.push_back(pTextLine);
- m_arParagraphs.push_back(pParagraph);
+ pParagraph->m_dLeft = pTextLine->m_dX;
+ pParagraph->m_dTop = pTextLine->m_dBaselinePos - pTextLine->m_dHeight + pTextLine->m_dBaselineOffset;
+ dCurrentTop = pParagraph->m_dTop;
+ }
+ else
+ {
+ pParagraph->m_dLeft = pFirstLine->m_dX;
+ pParagraph->m_dTop = dCurrentTop;
}
- // удалим все линии
- m_arTextLine.clear();
- break;
+ pFirstLine = pTextLine;
+
+ pParagraph->m_arLines.push_back(pTextLine);
+ m_arParagraphs.push_back(pParagraph);
}
- case TextAssociationTypeNoFrames:
+
+ // удалим все линии
+ m_arTextLine.clear();
+ break;
+ }
+ case TextAssociationTypePlainLine:
{
SortElements(m_arTextLine);
Merge(STANDART_STRING_HEIGHT_MM / 3);
diff --git a/X2tConverter/src/ASCConverters.cpp b/X2tConverter/src/ASCConverters.cpp
index 3f972213a4..39205fbd84 100644
--- a/X2tConverter/src/ASCConverters.cpp
+++ b/X2tConverter/src/ASCConverters.cpp
@@ -4500,7 +4500,7 @@ namespace NExtractTools
CDocxRenderer oDocxRenderer(pApplicationFonts);
- NSDocxRenderer::TextAssociationType taType = NSDocxRenderer::TextAssociationTypeNoFrames;
+ NSDocxRenderer::TextAssociationType taType = NSDocxRenderer::TextAssociationTypePlainLine;
if (params.m_oTextParams)
{
InputParamsText* oTextParams = params.m_oTextParams;
@@ -4510,16 +4510,16 @@ namespace NExtractTools
switch (*oTextParams->m_nTextAssociationType)
{
case 0:
- taType = NSDocxRenderer::TextAssociationTypeDefault;
+ taType = NSDocxRenderer::TextAssociationTypeBlockChar;
break;
case 1:
- taType = NSDocxRenderer::TextAssociationTypeLine;
+ taType = NSDocxRenderer::TextAssociationTypeBlockLine;
break;
case 2:
- taType = NSDocxRenderer::TextAssociationTypeNoFrames;
+ taType = NSDocxRenderer::TextAssociationTypePlainLine;
break;
case 3:
- taType = NSDocxRenderer::TextAssociationTypeBlock;
+ taType = NSDocxRenderer::TextAssociationTypePlainParagraph;
break;
default:
break;