Rotates 555
This commit is contained in:
@@ -540,14 +540,15 @@ internal static class MultiReplaceExt
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(item.Text))
|
if (!string.IsNullOrEmpty(item.Text))
|
||||||
{
|
{
|
||||||
// Если есть отложенная ориентация — применяем её
|
// Если есть отложенная ориентация — применяем её к этому тексту
|
||||||
if (pendingOrientation.HasValue)
|
if (pendingOrientation.HasValue)
|
||||||
{
|
{
|
||||||
var newPara = CloneParagraphWithoutSection(original);
|
var newPara = CloneParagraphWithoutSection(original);
|
||||||
resultParas.Add(newPara);
|
resultParas.Add(newPara);
|
||||||
currentPara = newPara;
|
currentPara = newPara;
|
||||||
|
|
||||||
bool addPageSize = (pendingOrientation.Value == BreakType.NewLandscapeSection);
|
// Для маркера перед текстом всегда addPageSize = true
|
||||||
|
bool addPageSize = true;
|
||||||
AddSectionProperties(currentPara, pendingOrientation.Value, addPageSize, sourceSection, portraitSection);
|
AddSectionProperties(currentPara, pendingOrientation.Value, addPageSize, sourceSection, portraitSection);
|
||||||
lastOrientation = pendingOrientation;
|
lastOrientation = pendingOrientation;
|
||||||
sectionChangeInsideGroup = true;
|
sectionChangeInsideGroup = true;
|
||||||
@@ -604,21 +605,16 @@ internal static class MultiReplaceExt
|
|||||||
{
|
{
|
||||||
if (currentPara is null)
|
if (currentPara is null)
|
||||||
{
|
{
|
||||||
var newPara = CloneParagraphWithoutSection(original);
|
// Маркер перед первым текстом — просто запоминаем
|
||||||
resultParas.Add(newPara);
|
pendingOrientation = breakType;
|
||||||
currentPara = newPara;
|
// Не создаём пустой параграф
|
||||||
AddSectionProperties(currentPara, breakType, false, sourceSection, portraitSection);
|
firstSplitMarkerHandled = true; // чтобы не обрабатывать как первый после текста
|
||||||
lastOrientation = breakType;
|
|
||||||
sectionChangeInsideGroup = true;
|
|
||||||
firstSplitMarkerHandled = true;
|
|
||||||
pendingOrientation = null;
|
|
||||||
textCount = 0;
|
|
||||||
lastTextPara = null;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!firstSplitMarkerHandled)
|
if (!firstSplitMarkerHandled)
|
||||||
{
|
{
|
||||||
|
// Это первый маркер после текста — применяем к последнему текстовому параграфу
|
||||||
if (lastTextPara is not null)
|
if (lastTextPara is not null)
|
||||||
{
|
{
|
||||||
if (lastTextPara.ParagraphProperties?.GetFirstChild<SectionProperties>() is null)
|
if (lastTextPara.ParagraphProperties?.GetFirstChild<SectionProperties>() is null)
|
||||||
@@ -629,19 +625,23 @@ internal static class MultiReplaceExt
|
|||||||
if (sourcePageSize is not null)
|
if (sourcePageSize is not null)
|
||||||
{
|
{
|
||||||
lastTextPara.ParagraphProperties.AppendChild(sourceSection.CloneNode(true));
|
lastTextPara.ParagraphProperties.AppendChild(sourceSection.CloneNode(true));
|
||||||
|
lastOrientation = breakType;
|
||||||
|
sectionChangeInsideGroup = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Если нет sourcePageSize, добавляем без PageSize (not set)
|
||||||
AddSectionProperties(lastTextPara, breakType, false, sourceSection, portraitSection);
|
AddSectionProperties(lastTextPara, breakType, false, sourceSection, portraitSection);
|
||||||
}
|
|
||||||
lastOrientation = breakType;
|
lastOrientation = breakType;
|
||||||
sectionChangeInsideGroup = true;
|
sectionChangeInsideGroup = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
firstSplitMarkerHandled = true;
|
firstSplitMarkerHandled = true;
|
||||||
pendingOrientation = null;
|
pendingOrientation = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Если нет lastTextPara, применяем к текущему
|
||||||
AddSectionProperties(currentPara, breakType, false, sourceSection, portraitSection);
|
AddSectionProperties(currentPara, breakType, false, sourceSection, portraitSection);
|
||||||
lastOrientation = breakType;
|
lastOrientation = breakType;
|
||||||
sectionChangeInsideGroup = true;
|
sectionChangeInsideGroup = true;
|
||||||
@@ -651,6 +651,7 @@ internal static class MultiReplaceExt
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Это не первый маркер — устанавливаем отложенную ориентацию для следующего текста
|
||||||
pendingOrientation = breakType;
|
pendingOrientation = breakType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -683,7 +684,7 @@ internal static class MultiReplaceExt
|
|||||||
{
|
{
|
||||||
var breakRun = new Run(new Break { Type = BreakValues.Page });
|
var breakRun = new Run(new Break { Type = BreakValues.Page });
|
||||||
remainderPara.InsertAt(breakRun, 0);
|
remainderPara.InsertAt(breakRun, 0);
|
||||||
bool addPageSize = (pendingOrientation.Value == BreakType.NewLandscapeSection);
|
bool addPageSize = true; // для остатка всегда с PageSize
|
||||||
AddSectionProperties(remainderPara, pendingOrientation.Value, addPageSize, sourceSection, portraitSection);
|
AddSectionProperties(remainderPara, pendingOrientation.Value, addPageSize, sourceSection, portraitSection);
|
||||||
pendingOrientation = null;
|
pendingOrientation = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user