Commit 65b4c9b0 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 19646 - [Copy&Paste] Изменяется стиль таблицы после redo отмены вставки таблицы

Bug 19674 - [Copy&Paste] Пропадают маркеры текста при копировании таблицы
Переделано открытие, чтобы его можно было использовать для копирования через бинарник(все свойства выставлялись через методы). Поправились баги с копирование через бинарник и undo/redo, и пересылкой изменений в совместном редактировании.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49722 954022d7-b5bf-4e40-9824-e11837661b57
parent a8ce35b3
...@@ -1484,19 +1484,19 @@ CopyProcessor.prototype = ...@@ -1484,19 +1484,19 @@ CopyProcessor.prototype =
elem.before = elem.gridStart - nMinGrid; elem.before = elem.gridStart - nMinGrid;
elem.after = nMaxGrid - elem.gridEnd; elem.after = nMaxGrid - elem.gridEnd;
} }
this.oBinaryFileWriter.CopyTable(Item, aSelectedRows, nMinGrid, nMaxGrid);
this.oBinaryFileWriter.copyParams.bLockCopyElems++; this.oBinaryFileWriter.copyParams.bLockCopyElems++;
this.CopyTable(oDomTarget, Item, aSelectedRows); this.CopyTable(oDomTarget, Item, aSelectedRows);
this.oBinaryFileWriter.copyParams.bLockCopyElems--; this.oBinaryFileWriter.copyParams.bLockCopyElems--;
this.oBinaryFileWriter.CopyTable(Item, aSelectedRows, nMinGrid, nMaxGrid);
} }
} }
} }
else else
{ {
this.oBinaryFileWriter.CopyTable(Item, null);
this.oBinaryFileWriter.copyParams.bLockCopyElems++; this.oBinaryFileWriter.copyParams.bLockCopyElems++;
this.CopyTable(oDomTarget, Item, null); this.CopyTable(oDomTarget, Item, null);
this.oBinaryFileWriter.copyParams.bLockCopyElems--; this.oBinaryFileWriter.copyParams.bLockCopyElems--;
this.oBinaryFileWriter.CopyTable(Item, null);
} }
} }
else if ( type_Paragraph === Item.GetType() ) else if ( type_Paragraph === Item.GetType() )
...@@ -2525,7 +2525,6 @@ PasteProcessor.prototype = ...@@ -2525,7 +2525,6 @@ PasteProcessor.prototype =
} }
//обрабатываем стили //обрабатываем стили
var isAlreadyContainsStyle; var isAlreadyContainsStyle;
var addStyles = [];
var api = this.api; var api = this.api;
var oStyleTypes = {par: 1, table: 2, lvl: 3}; var oStyleTypes = {par: 1, table: 2, lvl: 3};
var addNewStyles = false; var addNewStyles = false;
...@@ -2540,9 +2539,9 @@ PasteProcessor.prototype = ...@@ -2540,9 +2539,9 @@ PasteProcessor.prototype =
var isEqualName = null; var isEqualName = null;
if(null != stylePaste && null != stylePaste.style) if(null != stylePaste && null != stylePaste.style)
{ {
for(var j in oDocumentStyles) for(var j in oDocumentStyles.Style)
{ {
var styleDoc = oDocumentStyles[j]; var styleDoc = oDocumentStyles.Style[j];
isAlreadyContainsStyle = styleDoc.isEqual(stylePaste.style); isAlreadyContainsStyle = styleDoc.isEqual(stylePaste.style);
if(styleDoc.Name == stylePaste.style.Name) if(styleDoc.Name == stylePaste.style.Name)
isEqualName = j; isEqualName = j;
...@@ -2551,7 +2550,7 @@ PasteProcessor.prototype = ...@@ -2551,7 +2550,7 @@ PasteProcessor.prototype =
if(oStyleTypes.par == nStyleType) if(oStyleTypes.par == nStyleType)
elem.pPr.PStyle = j; elem.pPr.PStyle = j;
else if(oStyleTypes.table == nStyleType) else if(oStyleTypes.table == nStyleType)
elem.pPr.TableStyle = j; elem.pPr.Set_TableStyle2(j);
else else
elem.pPr.PStyle = j; elem.pPr.PStyle = j;
break; break;
...@@ -2562,58 +2561,36 @@ PasteProcessor.prototype = ...@@ -2562,58 +2561,36 @@ PasteProcessor.prototype =
if(nStyleType == oStyleTypes.par || nStyleType == oStyleTypes.lvl) if(nStyleType == oStyleTypes.par || nStyleType == oStyleTypes.lvl)
elem.pPr.PStyle = isEqualName; elem.pPr.PStyle = isEqualName;
else if (nStyleType == oStyleTypes.table) else if (nStyleType == oStyleTypes.table)
elem.pPr.TableStyle = isEqualName; elem.pPr.Set_TableStyle2(isEqualName);
addStyles[addStyles.length] = isEqualName;
} }
else if(!isAlreadyContainsStyle && isEqualName == null)//нужно добавить новый стиль else if(!isAlreadyContainsStyle && isEqualName == null)//нужно добавить новый стиль
{ {
oDocumentStyles[stylePaste.style.Name] = stylePaste.style; //todo править и BaseOn
var nStyleId = oDocumentStyles.Add(stylePaste.style);
if(nStyleType == oStyleTypes.par || nStyleType == oStyleTypes.lvl) if(nStyleType == oStyleTypes.par || nStyleType == oStyleTypes.lvl)
elem.pPr.PStyle = stylePaste.style.Name; elem.pPr.PStyle = nStyleId;
else if (nStyleType == oStyleTypes.table) else if (nStyleType == oStyleTypes.table)
elem.pPr.TableStyle = stylePaste.style.Name; elem.pPr.Set_TableStyle2(nStyleId);
addStyles[addStyles.length] = stylePaste.style.Name;
addNewStyles = true; addNewStyles = true;
} }
} }
} }
//добавляем картинки стилей в меню
if(addNewStyles)
api.GenerateStyles();
} }
fParseStyle(oBinaryFileReader.oReadResult.paraStyles, this.oDocument.Styles.Style, oBinaryFileReader.oReadResult, oStyleTypes.par); fParseStyle(oBinaryFileReader.oReadResult.paraStyles, this.oDocument.Styles, oBinaryFileReader.oReadResult, oStyleTypes.par);
fParseStyle(oBinaryFileReader.oReadResult.tableStyles, this.oDocument.Styles.Style, oBinaryFileReader.oReadResult, oStyleTypes.table); fParseStyle(oBinaryFileReader.oReadResult.tableStyles, this.oDocument.Styles, oBinaryFileReader.oReadResult, oStyleTypes.table);
fParseStyle(oBinaryFileReader.oReadResult.lvlStyles, this.oDocument.Styles.Style, oBinaryFileReader.oReadResult, oStyleTypes.lvl); fParseStyle(oBinaryFileReader.oReadResult.lvlStyles, this.oDocument.Styles, oBinaryFileReader.oReadResult, oStyleTypes.lvl);
var aContent = oBinaryFileReader.oReadResult.DocumentContent; var aContent = oBinaryFileReader.oReadResult.DocumentContent;
//добавляем во вставляемые параграфы стили(если уже данные стили присутcтвуют) for(var i = 0, length = oBinaryFileReader.oReadResult.aPostOpenStyleNumCallbacks.length; i < length; ++i)
var styleName; oBinaryFileReader.oReadResult.aPostOpenStyleNumCallbacks[i].call();
if(addStyles && addStyles.length != 0)
{
for(var i in aContent)
{
if(aContent[i].GetType() != oStyleTypes.table)
{
styleName = aContent[i].Style_Get();
for(var k = 0; k < addStyles.length; k++)
{
if(styleName == addStyles[k])
{
aContent[i].Style_Add(styleName);
break;
}
}
}
}
}
if(oReadResult.bLastRun) if(oReadResult.bLastRun)
this.bInBlock = false; this.bInBlock = false;
else else
this.bInBlock = true; this.bInBlock = true;
//создаем список используемых шрифтов //создаем список используемых шрифтов
var AllFonts = new Object(); var AllFonts = new Object();
this.oDocument.Numbering.Document_Get_AllFontNames(AllFonts);
this.oDocument.Styles.Document_Get_AllFontNames(AllFonts);
for ( var Index = 0, Count = aContent.length; Index < Count; Index++ ) for ( var Index = 0, Count = aContent.length; Index < Count; Index++ )
aContent[Index].Document_Get_AllFontNames( AllFonts ); aContent[Index].Document_Get_AllFontNames( AllFonts );
var aPrepeareFonts = []; var aPrepeareFonts = [];
...@@ -2623,7 +2600,7 @@ PasteProcessor.prototype = ...@@ -2623,7 +2600,7 @@ PasteProcessor.prototype =
var aPrepeareImages = []; var aPrepeareImages = [];
for(var i in window.global_pptx_content_loader.ImageMapChecker) for(var i in window.global_pptx_content_loader.ImageMapChecker)
aPrepeareImages.push(i); aPrepeareImages.push(i);
return {content: aContent, fonts: aPrepeareFonts, images: aPrepeareImages}; return {content: aContent, fonts: aPrepeareFonts, images: aPrepeareImages, bAddNewStyles: addNewStyles};
}, },
Start : function(node) Start : function(node)
{ {
...@@ -2671,6 +2648,8 @@ PasteProcessor.prototype = ...@@ -2671,6 +2648,8 @@ PasteProcessor.prototype =
oThis.InsertInDocument(); oThis.InsertInDocument();
node.blur(); node.blur();
node.style.display = ELEMENT_DISPAY_STYLE; node.style.display = ELEMENT_DISPAY_STYLE;
if(aContent.bAddNewStyles)
oThis.api.GenerateStyles();
} }
}); });
return; return;
......
This diff is collapsed.
...@@ -19705,7 +19705,7 @@ CTableCell.prototype = ...@@ -19705,7 +19705,7 @@ CTableCell.prototype =
Set_Pr : function(CellPr) Set_Pr : function(CellPr)
{ {
History.Add( this, { Type : historyitem_TableCell_Pr, Old : this.Pr, New : RowPr } ); History.Add( this, { Type : historyitem_TableCell_Pr, Old : this.Pr, New : CellPr } );
this.Pr = CellPr; this.Pr = CellPr;
this.Recalc_CompiledPr(); this.Recalc_CompiledPr();
}, },
......
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