Commit a2b7076d authored by Sergey.Luzyanin's avatar Sergey.Luzyanin

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50181 954022d7-b5bf-4e40-9824-e11837661b57
parent 43a86a9c
......@@ -674,6 +674,12 @@ DrawingObjectsController.prototype =
unGroup: function()
{
this.checkSelectedObjectsAndCallback(this.unGroupCallback, null)
},
unGroupCallback: function()
{
History.Create_NewPoint();
if(isRealObject(this.curState.group) )
{
this.curState.group.resetSelection();
......
......@@ -180,7 +180,7 @@ function NullState(drawingObjectsController, drawingObjects)
{
this.drawingObjectsController.clearPreTrackObjects();
var is_selected = cur_drawing.selected;
if(!(e.ctrlKey || e.shiftKey))
if(!(e.ctrlKey || e.shiftKey) && !is_selected)
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.OnUpdateOverlay();
......@@ -2189,7 +2189,7 @@ function PreMoveState(drawingObjectsController, drawingObjects, startX, startY,
}
else
{
if(this.majorObjectIsSelected)
if(this.majorObjectIsSelected && e.button !== 2)
{
this.drawingObjectsController.changeCurrentState(new GroupState(this.drawingObjectsController, this.drawingObjects, this.majorObject));
this.drawingObjectsController.onMouseDown(e, x, y);
......
......@@ -114,6 +114,31 @@ CGraphicFrame.prototype =
this.nvGraphicFramePr = pr;
},
paragraphFormatPaste: function(CopyTextPr, CopyParaPr, Bool)
{
if(isRealObject(this.graphicObject))
{
this.graphicObject.Paragraph_Format_Paste(CopyTextPr, CopyParaPr, Bool);
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
}
},
Paragraph_ClearFormatting: function()
{
if(isRealObject(this.graphicObject))
{
this.graphicObject.Paragraph_ClearFormatting();
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
}
},
Set_Props: function(props)
{
......
......@@ -591,6 +591,7 @@ CPresentation.prototype =
this.DrawingDocument.OnRecalculatePage(i, this.Slides[i]);
}
this.DrawingDocument.OnEndRecalculate();
this.Slides[this.CurPage].graphicObjects.updateSelectionState();
},
updateSlideIndexes: function()
......@@ -1334,67 +1335,12 @@ CPresentation.prototype =
Paragraph_ClearFormatting : function()
{
// Работаем с колонтитулом
if ( docpostype_HdrFtr === this.CurPos.Type )
return this.HdrFtr.Paragraph_ClearFormatting();
else if ( docpostype_DrawingObjects === this.CurPos.Type )
return this.DrawingObjects.paragraphClearFormatting();
else //if ( docpostype_Content === this.CurPos.Type )
{
if ( true === this.Selection.Use )
{
if ( selectionflag_Common === this.Selection.Flag )
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if ( StartPos > EndPos )
{
var Temp = StartPos;
StartPos = EndPos;
EndPos = Temp;
}
for ( var Index = StartPos; Index <= EndPos; Index++ )
{
var Item = this.Content[Index];
if ( type_Table === Item.GetType() )
Item.Paragraph_ClearFormatting();
else if ( type_Paragraph === Item.GetType() )
{
Item.Clear_Formatting();
Item.Clear_TextFormatting();
}
}
// Нам нужно пересчитать все изменения, начиная с первого элемента,
// попавшего в селект.
this.ContentLastChangePos = StartPos;
this.Recalculate();
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
}
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
if ( type_Table === Item.GetType() )
Item.Paragraph_ClearFormatting();
else if ( type_Paragraph === Item.GetType() )
if(this.Document_Is_SelectionLocked(changestype_Drawing_Props) === false)
{
Item.Clear_Formatting();
Item.Clear_TextFormatting();
// Нам нужно пересчитать все изменения, начиная с текущего элемента
this.ContentLastChangePos = this.CurPos.ContentPos;
History.Create_NewPoint();
this.Slides[this.CurPage].graphicObjects.Paragraph_ClearFormatting();
this.Recalculate();
}
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
}
}
},
Remove : function(Count, bOnlyText, bRemoveOnlySelection)
......@@ -1681,119 +1627,12 @@ CPresentation.prototype =
Get_Paragraph_TextPr_Copy : function()
{
// Работаем с колонтитулом
if ( docpostype_HdrFtr === this.CurPos.Type )
return this.HdrFtr.Get_Paragraph_TextPr_Copy();
else if ( docpostype_DrawingObjects === this.CurPos.Type )
return this.DrawingObjects.getParagraphTextPrCopy();
else //if ( docpostype_Content === this.CurPos.Type )
{
var Result_TextPr = null;
if ( true === this.Selection.Use )
{
var VisTextPr;
switch ( this.Selection.Flag )
{
case selectionflag_Common:
{
var StartPos = this.Selection.StartPos;
if ( this.Selection.EndPos < StartPos )
StartPos = this.Selection.EndPos;
var Item = this.Content[StartPos];
if ( type_Paragraph == Item.GetType() )
{
var StartPos_item = Item.Selection.StartPos;
if ( Item.Selection.EndPos < StartPos_item )
StartPos_item = Item.Selection.EndPos;
VisTextPr = Item.Internal_CalculateTextPr( StartPos_item - 1 );
}
else if ( type_Table == Item.GetType() )
VisTextPr = Item.Get_Paragraph_TextPr_Copy();
break;
}
case selectionflag_Numbering:
{
// Текстовые настройки применяем к конкретной нумерации
if ( null == this.Selection.Data || this.Selection.Data.length <= 0 )
break;
var NumPr = this.Content[this.Selection.Data[0]].Numbering_Get();
VisTextPr = this.Numbering.Get_AbstractNum( NumPr.NumId ).Lvl[NumPr.Lvl].TextPr;
break;
}
}
Result_TextPr = VisTextPr;
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
if ( type_Paragraph == Item.GetType() )
{
Result_TextPr = Item.Internal_CalculateTextPr( Item.CurPos.ContentPos - 1 );
}
else if ( type_Table == Item.GetType() )
{
Result_TextPr = Item.Get_Paragraph_TextPr_Copy();
}
}
return Result_TextPr;
}
return this.Slides[this.CurPage].graphicObjects.Get_Paragraph_TextPr().Copy();
},
Get_Paragraph_ParaPr_Copy : function()
{
// Работаем с колонтитулом
if ( docpostype_HdrFtr === this.CurPos.Type )
return this.HdrFtr.Get_Paragraph_ParaPr_Copy();
else if ( docpostype_DrawingObjects === this.CurPos.Type )
return this.DrawingObjects.getParagraphParaPrCopy();
else //if ( docpostype_Content === this.CurPos.Type )
{
var Result_ParaPr = null;
if ( true === this.Selection.Use )
{
switch ( this.Selection.Flag )
{
case selectionflag_Common:
{
var StartPos = this.Selection.StartPos;
if ( this.Selection.EndPos < StartPos )
StartPos = this.Selection.EndPos;
var Item = this.Content[StartPos];
Result_ParaPr = Item.Get_Paragraph_ParaPr_Copy();
break;
}
case selectionflag_Numbering:
{
// Текстовые настройки применяем к конкретной нумерации
if ( null == this.Selection.Data || this.Selection.Data.length <= 0 )
break;
var NumPr = this.Content[this.Selection.Data[0]].Numbering_Get();
Result_ParaPr = this.Numbering.Get_AbstractNum( NumPr.NumId ).Lvl[NumPr.Lvl].ParaPr;
break;
}
}
}
else
{
var Item = this.Content[this.CurPos.ContentPos];
Result_ParaPr = Item.Get_Paragraph_ParaPr_Copy();
}
return Result_ParaPr;
}
return this.Slides[this.CurPage].graphicObjects.Get_Paragraph_ParaPr().Copy();
},
Get_AllParagraphs_ByNumbering : function(NumPr)
......@@ -5083,7 +4922,8 @@ CPresentation.prototype =
}
} */
editor.sync_EndCatchSelectedElements();
var slide = this.Slides[this.CurPage];
editor.sync_EndCatchSelectedElements({theme:slide.Layout.Master.Theme,slide: slide, layout:slide.Layout, master:slide.Layout.Master});
this.Document_UpdateRulersState();
this.Document_UpdateUndoRedoState();
this.Document_UpdateCanAddHyperlinkState();
......
......@@ -310,12 +310,20 @@ CShape.prototype =
{
if(this.txBody)
{
return this.txBody.content.Get_Paragraph_ParPr();
return this.txBody.content.Get_Paragraph_ParaPr();
}
return new CParaPr();
},
Paragraph_ClearFormatting: function()
{
if(this.txBody)
{
return this.txBody.content.Paragraph_ClearFormatting();
}
},
initDefaultTextRect: function(x, y, extX, extY, flipH, flipV)
{
......@@ -2649,6 +2657,19 @@ CShape.prototype =
}
},
paragraphFormatPaste: function(CopyTextPr, CopyParaPr, Bool)
{
if(isRealObject(this.txBody))
{
this.txBody.content.Paragraph_Format_Paste(CopyTextPr, CopyParaPr, Bool);
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
}
},
setParagraphAlign: function(val)
{
if(isRealObject(this.txBody))
......
......@@ -553,6 +553,9 @@ CTextBody.prototype =
OnContentRecalculate: function()
{},
Set_CurrentElement: function()
{},
writeToBinary: function(w)
{
this.bodyPr.Write_ToBinary2(w);
......
......@@ -175,6 +175,13 @@ CGraphicObjects.prototype = {
},
Paragraph_ClearFormatting: function()
{
if(this.State.textObject && this.State.textObject.Paragraph_ClearFormatting)
{
this.State.textObject.Paragraph_ClearFormatting();
}
},
Update_CursorType: function(x, y, e )
{
switch(this.State.id)
......@@ -832,6 +839,31 @@ CGraphicObjects.prototype = {
}
}
}
var charts = by_types.charts;
for(var i = 0; i < charts.length; ++i)
{
if(!isRealObject(chart_props))
{
chart_props = {fromGroup: this.State.id === STATES_ID_GROUP || this.State.id === STATES_ID_TEXT_ADD_IN_GROUP};
chart_props.ChartProperties = charts[i].chart;
}
else
{
chart_props.chart = null;
chart_props.severalCharts = true;
if(chart_props.severalChartTypes !== true)
{
if(!(chart_props.ChartProperties.type === charts[i].chart.type && chart_props.ChartProperties.subType === charts[i].chart.subType) )
chart_props.severalChartTypes = true;
}
if(chart_props.severalChartStyles !== true)
{
if(chart_props.ChartProperties.styleId !== charts[i].chart.styleId )
chart_props.severalChartStyles = true;
}
}
}
break;
}
}
......@@ -850,6 +882,12 @@ CGraphicObjects.prototype = {
editor.sync_shapePropCallback(shape_props);
}
if(chart_props)
{
editor.sync_ImgPropCallback(chart_props);
}
this.State.textObject.updateInterfaceTextState();
if(this.State.textObject.isTable && this.State.textObject.isTable())
{
......@@ -906,6 +944,12 @@ CGraphicObjects.prototype = {
{
editor.sync_shapePropCallback(shape_props);
}
if(chart_props)
{
editor.sync_ImgPropCallback(chart_props);
}
}
// editor.sync_VerticalTextAlign(this.getVerticalAlign());
......
......@@ -213,7 +213,7 @@ function NullState(drawingObjectsController, drawingObjects)
{
this.drawingObjectsController.clearPreTrackObjects();
var is_selected = cur_drawing.selected;
if(!(e.CtrlKey || e.ShiftKey))
if(!(e.CtrlKey || e.ShiftKey) && !is_selected)
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.OnUpdateOverlay();
......@@ -1651,6 +1651,17 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.selectionSetEnd(e, x, y);
this.drawingObjectsController.updateSelectionState();
if(editor.isPaintFormat)
{
var doc = editor.WordControl.m_oLogicDocument;
if(this.textObject.paragraphFormatPaste && doc.Document_Is_SelectionLocked(changestype_Drawing_Props) === false)
{
History.Create_NewPoint();
this.textObject.paragraphFormatPaste(doc.CopyTextPr, doc.CopyParaPr, false);
editor.sync_PaintFormatCallback( false );
doc.Recalculate();
}
}
}
};
......
......@@ -1742,6 +1742,10 @@ function ResizeTrackGroup(originalObject, cardDirection, parentTrack)
this.trackEnd = function()
{
if(!isRealObject(this.original.group))
{
this.original.normalize();
}
this.original.setOffset(this.x, this.y);
this.original.setExtents(this.extX, this.extY);
this.original.setChildExtents(this.extX, this.extY);
......
......@@ -612,7 +612,7 @@ asc_docs_api.prototype.sync_BeginCatchSelectedElements = function()
if (0 != this.SelectedObjectsStack.length)
this.SelectedObjectsStack.splice(0, this.SelectedObjectsStack.length);
}
asc_docs_api.prototype.sync_EndCatchSelectedElements = function()
asc_docs_api.prototype.sync_EndCatchSelectedElements = function(options)
{
if ( !this.chartStyleManager.isReady() || !this.chartPreviewManager.isReady() )
......@@ -621,8 +621,8 @@ asc_docs_api.prototype.sync_EndCatchSelectedElements = function()
{
if ( this.SelectedObjectsStack[i].Value.ChartProperties )
{
this.chartStyleManager.init();
this.chartPreviewManager.init();
this.chartStyleManager.init(options);
this.chartPreviewManager.init(options);
this.asc_fireCallback("asc_onUpdateChartStyles");
break;
}
......@@ -3113,7 +3113,8 @@ asc_docs_api.prototype.sync_AddImageCallback = function(){
this.asc_fireCallback("asc_onAddImage");
}
asc_docs_api.prototype.sync_ImgPropCallback = function(imgProp){
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new CSelectedObject( c_oAscTypeSelectElement.Image, new CImgProperty( imgProp ) );
var type = imgProp.ChartProperties ? c_oAscTypeSelectElement.Chart : c_oAscTypeSelectElement.Image;
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new CSelectedObject( type, new CImgProperty( imgProp ) );
}
asc_docs_api.prototype.sync_ImgWrapStyleChangedCallback = function(style){
this.asc_fireCallback("asc_onImgWrapStyleChanged",style);
......@@ -3827,23 +3828,11 @@ asc_docs_api.prototype.DublicateSlide = function()
var selectionArray = this.WordControl.Thumbnails.GetSelectedArray();
var _presentation = this.WordControl.m_oLogicDocument;
var _old_slides_buffer = [];
for(var _buffer_index = 0; _buffer_index < _presentation.slidesBuffer.length; ++_buffer_index)
{
_old_slides_buffer.push(_presentation.slidesBuffer[_buffer_index]);
}
var _old_glyphs_buffer = [];
for(_buffer_index = 0; _buffer_index < _presentation.glyphsBuffer.length; ++_buffer_index)
{
_old_glyphs_buffer.push(_presentation.glyphsBuffer[_buffer_index]);
}
History.Create_NewPoint();
_presentation.slidesCopy(selectionArray);
_presentation.slidesPaste(selectionArray[selectionArray.length -1], true);
_presentation.slidesBuffer = _old_slides_buffer;
_presentation.glyphsBuffer = _old_glyphs_buffer;
var div = document.createElement("div");
var copy_processor = new CopyProcessor(editor, div);
copy_processor.Start();
var oPasteProcessor = new PasteProcessor(this, true, true, false);
oPasteProcessor.Start(copy_processor.ElemToSelect);
}
asc_docs_api.prototype.SelectAllSlides = function(layoutType)
......
......@@ -1148,36 +1148,73 @@ function CImageSize( width, height )
CImageSize.prototype.get_ImageWidth = function() { return this.Width; }
CImageSize.prototype.get_ImageHeight = function() { return this.Height; }
function CImgProperty( obj )
{
if( obj )
{
this.Width = (undefined != obj.Width) ? obj.Width : null;
this.Height = (undefined != obj.Height) ? obj.Height : null;
this.WrappingStyle = (undefined != obj.WrappingStyle) ? obj.WrappingStyle : null;
this.CanBeFlow = (undefined != obj.CanBeFlow) ? obj.CanBeFlow : true;
this.Width = (undefined != obj.Width ) ? obj.Width : undefined;
this.Height = (undefined != obj.Height ) ? obj.Height : undefined;
this.WrappingStyle = (undefined != obj.WrappingStyle) ? obj.WrappingStyle : undefined;
this.Paddings = (undefined != obj.Paddings ) ? new CPaddings (obj.Paddings) : undefined;
this.Position = (undefined != obj.Position ) ? new CPosition (obj.Position) : undefined;
this.AllowOverlap = (undefined != obj.AllowOverlap ) ? obj.AllowOverlap : undefined;
this.PositionH = (undefined != obj.PositionH ) ? new CImagePositionH(obj.PositionH) : undefined;
this.PositionV = (undefined != obj.PositionV ) ? new CImagePositionV(obj.PositionV) : undefined;
this.Paddings = (undefined != obj.Paddings && null != obj.Paddings) ? new CPaddings (obj.Paddings) : null;
this.Position = (undefined != obj.Position && null != obj.Position) ? new CPosition (obj.Position) : null;
this.Internal_Position = (undefined != obj.Internal_Position) ? obj.Internal_Position : null;
this.ImageUrl = (undefined != obj.ImageUrl) ? obj.ImageUrl : null;
this.IsLocked = obj.IsLocked === true || obj.IsLocked === false ? obj.IsLocked : false;
this.Locked = (undefined != obj.Locked) ? obj.Locked : false;
this.ChartProperties = (undefined != obj.ChartProperties) ? obj.ChartProperties : null;
this.ShapeProperties = (undefined != obj.ShapeProperties) ? /*CreateAscShapePropFromProp*/(obj.ShapeProperties) : null;
this.ChangeLevel = (undefined != obj.ChangeLevel) ? obj.ChangeLevel : null;
this.Group = (obj.Group != undefined) ? obj.Group : null;
this.fromGroup = obj.fromGroup != undefined ? obj.fromGroup : null;
this.severalCharts = obj.severalCharts != undefined ? obj.severalCharts : false;
this.severalChartTypes = obj.severalChartTypes != undefined ? obj.severalChartTypes : undefined;
this.severalChartStyles = obj.severalChartStyles != undefined ? obj.severalChartStyles : undefined;
this.verticalTextAlign = obj.verticalTextAlign != undefined ? obj.verticalTextAlign : undefined;
}
else
{
this.Width = null;
this.Height = null;
this.WrappingStyle = null;
this.Paddings = new CPaddings (); // default values
this.Position = new CPosition (); // default values
this.CanBeFlow = true;
this.Width = undefined;
this.Height = undefined;
this.WrappingStyle = undefined;
this.Paddings = undefined;
this.Position = undefined;
this.PositionH = undefined;
this.PositionV = undefined;
this.Internal_Position = null;
this.ImageUrl = null;
this.IsLocked = false;
this.Locked = false;
this.ChartProperties = null;
this.ShapeProperties = null;
this.ImageProperties = null;
this.ChangeLevel = null;
this.Group = null;
this.fromGroup = null;
this.severalCharts = false;
this.severalChartTypes = undefined;
this.severalChartStyles = undefined;
this.verticalTextAlign = undefined;
}
}
CImgProperty.prototype.get_ChangeLevel = function() { return this.ChangeLevel; };
CImgProperty.prototype.put_ChangeLevel = function(v) { this.ChangeLevel = v; };
CImgProperty.prototype.get_CanBeFlow = function() { return this.CanBeFlow; }
CImgProperty.prototype.get_Width = function() { return this.Width; }
CImgProperty.prototype.put_Width = function(v) { this.Width = v; }
CImgProperty.prototype.get_Locked = function() { return this.IsLocked; }
CImgProperty.prototype.put_Locked = function(v) { this.IsLocked = v; }
CImgProperty.prototype.get_Height = function() { return this.Height; }
CImgProperty.prototype.put_Height = function(v) { this.Height = v; }
CImgProperty.prototype.get_WrappingStyle = function() { return this.WrappingStyle; }
......@@ -1186,32 +1223,95 @@ CImgProperty.prototype.put_WrappingStyle = function(v) { this.WrappingStyle = v;
CImgProperty.prototype.get_Paddings = function() { return this.Paddings; }
// Аргумент объект класса CPaddings
CImgProperty.prototype.put_Paddings = function(v) { this.Paddings = v; }
CImgProperty.prototype.get_AllowOverlap = function() {return this.AllowOverlap;}
CImgProperty.prototype.put_AllowOverlap = function(v) {this.AllowOverlap = v;}
// Возвращается объект класса CPosition
CImgProperty.prototype.get_Position = function() { return this.Position; }
// Аргумент объект класса CPosition
CImgProperty.prototype.put_Position = function(v) { this.Position = v; }
CImgProperty.prototype.get_PositionH = function() { return this.PositionH; }
CImgProperty.prototype.put_PositionH = function(v) { this.PositionH = v; }
CImgProperty.prototype.get_PositionV = function() { return this.PositionV; }
CImgProperty.prototype.put_PositionV = function(v) { this.PositionV = v; }
CImgProperty.prototype.get_Value_X = function(RelativeFrom) { if ( null != this.Internal_Position ) return this.Internal_Position.Calculate_X_Value(RelativeFrom); return 0; }
CImgProperty.prototype.get_Value_Y = function(RelativeFrom) { if ( null != this.Internal_Position ) return this.Internal_Position.Calculate_Y_Value(RelativeFrom); return 0; }
CImgProperty.prototype.get_ImageUrl = function() { return this.ImageUrl; }
CImgProperty.prototype.put_ImageUrl = function(v) { this.ImageUrl = v; }
CImgProperty.prototype.get_Group = function() { return this.Group; }
CImgProperty.prototype.put_Group = function(v) { this.Group = v; }
CImgProperty.prototype.get_FromGroup = function() { return this.fromGroup; }
CImgProperty.prototype.put_FromGroup = function(v) { this.fromGroup = v; }
CImgProperty.prototype.get_isChartProps = function() { return this.isChartProps; }
CImgProperty.prototype.put_isChartPross = function(v) { this.isChartProps = v; }
CImgProperty.prototype.get_SeveralCharts = function() { return this.severalCharts; }
CImgProperty.prototype.put_SeveralCharts = function(v) { this.severalCharts = v; }
CImgProperty.prototype.get_SeveralChartTypes = function() { return this.severalChartTypes; }
CImgProperty.prototype.put_SeveralChartTypes = function(v) { this.severalChartTypes = v; }
CImgProperty.prototype.get_SeveralChartStyles = function() { return this.severalChartStyles; }
CImgProperty.prototype.put_SeveralChartStyles = function(v) { this.severalChartStyles = v; }
CImgProperty.prototype.get_VerticalTextAlign = function() { return this.verticalTextAlign; };
CImgProperty.prototype.put_VerticalTextAlign = function(v) { this.verticalTextAlign = v; };
CImgProperty.prototype.get_OriginSize = function(api)
{
var _img = api.ImageLoader.map_image_index[_getFullImageSrc(this.ImageUrl)];
if (_img != undefined && _img.Image != null || _img.Status == ImageLoadStatus.Loading)
var _image = api.ImageLoader.map_image_index[_getFullImageSrc(this.ImageUrl)];
if (_image != undefined && _image.Image != null && _image.Status == ImageLoadStatus.Complete)
{
var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin));
var _h = Math.max(1, Page_Height - (Y_Top_Margin + Y_Bottom_Margin));
var bIsCorrect = false;
if (_image.Image != null)
{
var _w = _img.Image.width;
var _h = _img.Image.height;
var __w = Math.max(parseInt(_image.Image.width * g_dKoef_pix_to_mm), 1);
var __h = Math.max(parseInt(_image.Image.height * g_dKoef_pix_to_mm), 1);
var _max = Math.min(api.WordControl.m_oLogicDocument.Width, api.WordControl.m_oLogicDocument.Height) * g_dKoef_mm_to_pix;
if (_w > _max || _h > _max)
var dKoef = Math.max(__w / _w, __h / _h);
if (dKoef > 1)
{
var _koef = _max / Math.max(1, Math.max(_w, _h));
_w = Math.max(5, __w / dKoef);
_h = Math.max(5, __h / dKoef);
_w = (_koef * _w) >> 0;
_h = (_koef * _h) >> 0;
bIsCorrect = true;
}
return new CImageSize((_w * g_dKoef_pix_to_mm) >> 0, (_h * g_dKoef_pix_to_mm) >> 0);
else
{
_w = __w;
_h = __h;
}
return new CImageSize( 50, 50 );
}
return new CImageSize( parseInt(_w), parseInt(_h), bIsCorrect);
}
return new CImageSize( 50, 50, false );
}
CImgProperty.prototype.get_Locked = function() { return this.Locked; }
CImgProperty.prototype.get_ChartProperties = function()
{
return this.ChartProperties;
};
CImgProperty.prototype.put_ChartProperties = function(v)
{
this.ChartProperties = v;
};
CImgProperty.prototype.get_ShapeProperties = function()
{
return this.ShapeProperties;
};
CImgProperty.prototype.put_ShapeProperties = function(v)
{
this.ShapeProperties = v;
};
function CHeaderProp( obj )
{
......
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