Commit 0ec08528 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Добавлен новый класс CSectionPr для работы с секциями в документе. Сделана...

Добавлен новый класс CSectionPr для работы с секциями в документе. Сделана возможность изменения параметров отдельной секции (размер страницы, поля, ориентация страницы). Сделана обработка знака разрыва секции, и отдельно обработан случай, когда знак разрыва секции идет в пустом параграфе.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55313 954022d7-b5bf-4e40-9824-e11837661b57
parent 297ad011
......@@ -2567,7 +2567,7 @@ CGraphics.prototype =
drawCollaborativeChanges : function(x, y, w, h)
{
this.b_color1( 0, 255, 0, 64 );
this.b_color1( 191, 255, 191, 255 );
this.rect( x, y, w, h );
this.df();
},
......
......@@ -159,6 +159,7 @@ function CTableId()
case historyitem_type_MathContent : Element = new CMathContent(); break;
case historyitem_type_CommentMark : Element = new ParaComment(); break;
case historyitem_type_ParaRun : Element = new ParaRun(); break;
case historyitem_type_Section : Element = new CSectionPr(); break;
}
Element.Read_FromBinary2(Reader);
......
......@@ -1062,6 +1062,10 @@ ParaComment.prototype =
{
},
Get_Range_VisibleWidth : function(RangeW, _CurLine, _CurRange)
{
},
//-----------------------------------------------------------------------------------
// Функции отрисовки
//-----------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -976,6 +976,20 @@ ParaHyperlink.prototype =
this.Content[Pos].Recalculate_MinMaxContentWidth(MinMax);
}
},
Get_Range_VisibleWidth : function(RangeW, _CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
for ( var CurPos = StartPos; CurPos <= EndPos; CurPos++ )
{
this.Content[CurPos].Get_Range_VisibleWidth(RangeW, CurLine, CurRange);
}
},
//-----------------------------------------------------------------------------------
// Функции отрисовки
//-----------------------------------------------------------------------------------
......
......@@ -846,6 +846,20 @@ ParaMath.prototype =
MinMax.nCurMaxWidth += this.Width;
},
Get_Range_VisibleWidth : function(RangeW, _CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
if ( EndPos >= 1 )
{
RangeW.W += this.Width;
}
},
//-----------------------------------------------------------------------------------
// Функции отрисовки
//-----------------------------------------------------------------------------------
......
This diff is collapsed.
This diff is collapsed.
......@@ -1575,11 +1575,23 @@ ParaRun.prototype =
}
case para_NewLine:
{
X += WordLen;
if ( true === Word )
{
EmptyLine = false;
Word = false;
X += SpaceLen;
SpaceLen = 0;
}
if ( break_Page === Item.BreakType )
{
if ( true === PRS.SkipPageBreak && Item === PRS.PageBreak )
continue;
Item.Flags.NewLine = true;
// PageBreak вне самого верхнего документа не надо учитывать
if ( !(Para.Parent instanceof CDocument) )
{
......@@ -1603,16 +1615,6 @@ ParaRun.prototype =
RangeEndPos = Pos + 1;
X += WordLen;
if ( true === Word )
{
EmptyLine = false;
Word = false;
X += SpaceLen;
SpaceLen = 0;
}
break;
}
case para_End:
......@@ -2061,12 +2063,27 @@ ParaRun.prototype =
}
case para_End:
{
var SectPr = PRSA.Paragraph.Get_SectionPr();
if ( undefined !== SectPr )
{
// Нас интересует следующая секция
var LogicDocument = PRSA.Paragraph.LogicDocument;
var NextSectPr = LogicDocument.SectionsInfo.Get_SectPr(PRSA.Paragraph.Index + 1).SectPr;
Item.Update_SectionPr(NextSectPr, PRSA.XEnd - PRSA.X);
}
else
Item.Clear_SectionPr();
PRSA.X += Item.Width;
break;
}
case para_NewLine:
{
if ( break_Page === Item.BreakType )
Item.Update_String( PRSA.XEnd - PRSA.X );
PRSA.X += Item.WidthVisible;
break;
......@@ -2333,7 +2350,10 @@ ParaRun.prototype =
if ( true === PBChecker.FindPB )
{
if ( Element === PBChecker.PageBreak )
{
PBChecker.FindPB = false;
PBChecker.PageBreak.Flags.NewLine = true;
}
}
else
{
......@@ -2525,6 +2545,60 @@ ParaRun.prototype =
MinMax.nMaxWidth = nMaxWidth;
MinMax.nCurMaxWidth = nCurMaxWidth;
},
Get_Range_VisibleWidth : function(RangeW, _CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var Range = this.Lines[CurLine].Ranges[CurRange];
var StartPos = Range.StartPos;
var EndPos = Range.EndPos;
for ( var Pos = StartPos; Pos < EndPos; Pos++ )
{
var Item = this.Content[Pos];
switch( Item.Type )
{
case para_Sym:
case para_Text:
case para_Space:
{
RangeW.W += Item.WidthVisible;
break;
}
case para_Drawing:
{
if ( true === Item.Is_Inline() )
RangeW.W += Item.Width;
break;
}
case para_PageNum:
case para_Tab:
{
RangeW.W += Item.Width;
break;
}
case para_NewLine:
{
RangeW.W += Item.WidthVisible;
break;
}
case para_End:
{
RangeW.W += Item.WidthVisible;
RangeW.End = true;
break;
}
}
}
},
//-----------------------------------------------------------------------------------
// Функции отрисовки
//-----------------------------------------------------------------------------------
......@@ -2759,24 +2833,34 @@ ParaRun.prototype =
}
case para_End:
{
// Выставляем настройки для символа параграфа
var EndTextPr = Para.Get_CompiledPr2( false).TextPr.Copy();
EndTextPr.Merge( Para.TextPr.Value );
var SectPr = Para.Get_SectionPr();
pGraphics.SetTextPr( EndTextPr );
if ( undefined === SectPr )
{
// Выставляем настройки для символа параграфа
var EndTextPr = Para.Get_CompiledPr2(false).TextPr.Copy();
EndTextPr.Merge(Para.TextPr.Value);
if ( true === EndTextPr.Color.Auto )
pGraphics.b_color1( AutoColor.r, AutoColor.g, AutoColor.b, 255);
else
pGraphics.b_color1( EndTextPr.Color.r, EndTextPr.Color.g, EndTextPr.Color.b, 255);
pGraphics.SetTextPr(EndTextPr);
bEnd = true;
var bEndCell = false;
if ( null === Para.Get_DocumentNext() && true === Para.Parent.Is_TableCellContent() )
bEndCell = true;
if (true === EndTextPr.Color.Auto)
pGraphics.b_color1(AutoColor.r, AutoColor.g, AutoColor.b, 255);
else
pGraphics.b_color1(EndTextPr.Color.r, EndTextPr.Color.g, EndTextPr.Color.b, 255);
Item.Draw( X, Y - this.YOffset, pGraphics, bEndCell );
X += Item.Width;
bEnd = true;
var bEndCell = false;
if (null === Para.Get_DocumentNext() && true === Para.Parent.Is_TableCellContent())
bEndCell = true;
Item.Draw(X, Y - this.YOffset, pGraphics, bEndCell);
X += Item.Width;
}
else
{
Item.Draw(X, Y - this.YOffset, pGraphics, false);
X += Item.Width;
}
break;
}
......
This diff is collapsed.
......@@ -5207,6 +5207,8 @@ function BinaryFileReader(doc, openParams)
}
// for(var i = 0, length = this.oReadResult.aPostOpenStyleNumCallbacks.length; i < length; ++i)
// this.oReadResult.aPostOpenStyleNumCallbacks[i].call();
this.Document.On_EndLoad();
};
};
function BinaryStyleTableReader(doc, oReadResult, stream)
......
......@@ -4431,6 +4431,45 @@ CTable.prototype =
}
},
Get_LastRangeVisibleBounds : function()
{
var CurPage = this.Pages.length - 1;
var Page_abs = this.Get_StartPage_Absolute() + CurPage;
var CurRow = this.Content.length - 1;
var Row = this.Content[CurRow];
var CurCell = Row.Get_CellsCount() - 1;
var Cell = Row.Get_Cell( CurCell );
var CellInfo = Row.Get_CellInfo( CurCell );
var CellMar = Cell.Get_Margins();
var X_start = CellInfo.X_cell_start;
var X_end = CellInfo.X_cell_end;
var Cell_PageRel = Page_abs - Cell.Content.Get_StartPage_Absolute();
var Bounds = Cell.Content_Get_PageBounds( Cell_PageRel );
var Y_offset = Cell.Temp.Y_VAlign_offset[Cell_PageRel];
var Y = 0;
if ( 0 != Cell_PageRel )
{
// мы должны определить ряд, на котором случился перенос на новую страницу
var TempRowIndex = this.Pages[CurPage].FirstRow;
Y = this.RowsInfo[TempRowIndex].Y[CurPage] + this.RowsInfo[TempRowIndex].TopDy[CurPage] + CellMar.Top.W + Y_offset;
}
else
{
Y = this.RowsInfo[CurRow].Y[CurPage] + this.RowsInfo[CurRow].TopDy[CurPage] + CellMar.Top.W + Y_offset;
}
return { X : X_start, Y : Y, W : X_end - X_start, H : 10 };
},
Get_NearestPos : function( PageNum, X, Y, bAnchor, Drawing )
{
var PNum = PageNum - this.PageNum;
......
......@@ -1025,7 +1025,7 @@ $("#td_formatmodel,#td_info, #td_redo, #td_undo, #td_orient, #td_bold, #td_itali
//editor.WordControl.m_oLogicDocument.LoadTestDocument4(); // среднее количество ранов
//editor.WordControl.m_oLogicDocument.LoadTestDocument5(); // 1 ран в параграфе
editor.WordControl.m_oLogicDocument.Add_SectionBreak();
editor.WordControl.m_oLogicDocument.Add_SectionBreak(section_type_Continuous);
break;
case "td_indent":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment