Commit 695f6e52 authored by Oleg Korshul's avatar Oleg Korshul Committed by Alexander.Trofimov

пункты в линейках

parent 445387fb
...@@ -793,7 +793,8 @@ var contentchanges_Remove = 2; ...@@ -793,7 +793,8 @@ var contentchanges_Remove = 2;
var offlineMode = '_offline_'; var offlineMode = '_offline_';
var c_oAscRulerUnits = { var c_oAscDocumentUnits = {
Millimeter : 0, Millimeter : 0,
Inch : 1 Inch : 1,
Point : 2
}; };
\ No newline at end of file
...@@ -3193,26 +3193,26 @@ function CEditorPage(api) ...@@ -3193,26 +3193,26 @@ function CEditorPage(api)
this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage); this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage);
} }
this.UpdateHorRulerBack = function() this.UpdateHorRulerBack = function(isattack)
{ {
var drDoc = this.m_oDrawingDocument; var drDoc = this.m_oDrawingDocument;
if (0 <= drDoc.SlideCurrent && drDoc.SlideCurrent < drDoc.SlidesCount) if (0 <= drDoc.SlideCurrent && drDoc.SlideCurrent < drDoc.SlidesCount)
{ {
this.CreateBackgroundHorRuler(); this.CreateBackgroundHorRuler(undefined, isattack);
} }
this.UpdateHorRuler(); this.UpdateHorRuler();
} }
this.UpdateVerRulerBack = function() this.UpdateVerRulerBack = function(isattack)
{ {
var drDoc = this.m_oDrawingDocument; var drDoc = this.m_oDrawingDocument;
if (0 <= drDoc.SlideCurrent && drDoc.SlideCurrent < drDoc.SlidesCount) if (0 <= drDoc.SlideCurrent && drDoc.SlideCurrent < drDoc.SlidesCount)
{ {
this.CreateBackgroundVerRuler(); this.CreateBackgroundVerRuler(undefined, isattack);
} }
this.UpdateVerRuler(); this.UpdateVerRuler();
} }
this.CreateBackgroundHorRuler = function(margins) this.CreateBackgroundHorRuler = function(margins, isattack)
{ {
var cachedPage = {}; var cachedPage = {};
cachedPage.width_mm = this.m_oLogicDocument.Width; cachedPage.width_mm = this.m_oLogicDocument.Width;
...@@ -3233,9 +3233,9 @@ function CEditorPage(api) ...@@ -3233,9 +3233,9 @@ function CEditorPage(api)
cachedPage.margin_bottom = this.m_oLogicDocument.Height; cachedPage.margin_bottom = this.m_oLogicDocument.Height;
} }
this.m_oHorRuler.CreateBackground(cachedPage); this.m_oHorRuler.CreateBackground(cachedPage, isattack);
} }
this.CreateBackgroundVerRuler = function(margins) this.CreateBackgroundVerRuler = function(margins, isattack)
{ {
var cachedPage = {}; var cachedPage = {};
cachedPage.width_mm = this.m_oLogicDocument.Width; cachedPage.width_mm = this.m_oLogicDocument.Width;
...@@ -3256,7 +3256,7 @@ function CEditorPage(api) ...@@ -3256,7 +3256,7 @@ function CEditorPage(api)
cachedPage.margin_bottom = this.m_oLogicDocument.Height; cachedPage.margin_bottom = this.m_oLogicDocument.Height;
} }
this.m_oVerRuler.CreateBackground(cachedPage); this.m_oVerRuler.CreateBackground(cachedPage, isattack);
} }
this.ThemeGenerateThumbnails = function(_master) this.ThemeGenerateThumbnails = function(_master)
......
...@@ -3794,6 +3794,8 @@ asc_docs_api.prototype.asc_SetDocumentUnits = function(_units) ...@@ -3794,6 +3794,8 @@ asc_docs_api.prototype.asc_SetDocumentUnits = function(_units)
{ {
this.WordControl.m_oHorRuler.Units = _units; this.WordControl.m_oHorRuler.Units = _units;
this.WordControl.m_oVerRuler.Units = _units; this.WordControl.m_oVerRuler.Units = _units;
this.WordControl.UpdateHorRulerBack(true);
this.WordControl.UpdateVerRulerBack(true);
} }
}; };
......
"use strict"; "use strict";
var g_dDpiX = 96.0; var g_dDpiX = 96.0;
var g_dDpiY = 96.0; var g_dDpiY = 96.0;
...@@ -3894,21 +3894,21 @@ function CEditorPage(api) ...@@ -3894,21 +3894,21 @@ function CEditorPage(api)
this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage); this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage);
} }
this.UpdateHorRulerBack = function() this.UpdateHorRulerBack = function(isattack)
{ {
var drDoc = this.m_oDrawingDocument; var drDoc = this.m_oDrawingDocument;
if (0 <= drDoc.m_lCurrentPage && drDoc.m_lCurrentPage < drDoc.m_lPagesCount) if (0 <= drDoc.m_lCurrentPage && drDoc.m_lCurrentPage < drDoc.m_lPagesCount)
{ {
this.m_oHorRuler.CreateBackground(drDoc.m_arrPages[drDoc.m_lCurrentPage]); this.m_oHorRuler.CreateBackground(drDoc.m_arrPages[drDoc.m_lCurrentPage], isattack);
} }
this.UpdateHorRuler(); this.UpdateHorRuler();
} }
this.UpdateVerRulerBack = function() this.UpdateVerRulerBack = function(isattack)
{ {
var drDoc = this.m_oDrawingDocument; var drDoc = this.m_oDrawingDocument;
if (0 <= drDoc.m_lCurrentPage && drDoc.m_lCurrentPage < drDoc.m_lPagesCount) if (0 <= drDoc.m_lCurrentPage && drDoc.m_lCurrentPage < drDoc.m_lPagesCount)
{ {
this.m_oVerRuler.CreateBackground(drDoc.m_arrPages[drDoc.m_lCurrentPage]); this.m_oVerRuler.CreateBackground(drDoc.m_arrPages[drDoc.m_lCurrentPage], isattack);
} }
this.UpdateVerRuler(); this.UpdateVerRuler();
} }
......
...@@ -185,7 +185,7 @@ function CHorRuler() ...@@ -185,7 +185,7 @@ function CHorRuler()
this.SimpleChanges = new RulerCheckSimpleChanges(); this.SimpleChanges = new RulerCheckSimpleChanges();
this.Units = c_oAscRulerUnits.Inch; this.Units = c_oAscDocumentUnits.Millimeter;
this.InitTablePict = function() this.InitTablePict = function()
{ {
...@@ -354,7 +354,7 @@ function CHorRuler() ...@@ -354,7 +354,7 @@ function CHorRuler()
return widthNew; return widthNew;
} }
this.CreateBackground = function(cachedPage) this.CreateBackground = function(cachedPage, isattack)
{ {
if (window["NATIVE_EDITOR_ENJINE"]) if (window["NATIVE_EDITOR_ENJINE"])
return; return;
...@@ -380,7 +380,7 @@ function CHorRuler() ...@@ -380,7 +380,7 @@ function CHorRuler()
if (this.CurrentObjectType == RULER_OBJECT_TYPE_COLUMNS) if (this.CurrentObjectType == RULER_OBJECT_TYPE_COLUMNS)
markup = this.m_oColumnMarkup; markup = this.m_oColumnMarkup;
if (this.CurrentObjectType == checker.Type && width == checker.Width) if (isattack !== true && this.CurrentObjectType == checker.Type && width == checker.Width)
{ {
if (this.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH) if (this.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH)
{ {
...@@ -586,7 +586,7 @@ function CHorRuler() ...@@ -586,7 +586,7 @@ function CHorRuler()
context.font = "7pt Arial"; context.font = "7pt Arial";
if (this.Units == c_oAscRulerUnits.Millimeter) if (this.Units == c_oAscDocumentUnits.Millimeter)
{ {
var lCount1 = ((width - left_margin) / mm_1_4) >> 0; var lCount1 = ((width - left_margin) / mm_1_4) >> 0;
var lCount2 = (left_margin / mm_1_4) >> 0; var lCount2 = (left_margin / mm_1_4) >> 0;
...@@ -681,7 +681,7 @@ function CHorRuler() ...@@ -681,7 +681,7 @@ function CHorRuler()
} }
} }
} }
else if (this.Units == c_oAscRulerUnits.Inch) else if (this.Units == c_oAscDocumentUnits.Inch)
{ {
var lCount1 = ((width - left_margin) / inch_1_8) >> 0; var lCount1 = ((width - left_margin) / inch_1_8) >> 0;
var lCount2 = (left_margin / inch_1_8) >> 0; var lCount2 = (left_margin / inch_1_8) >> 0;
...@@ -760,6 +760,71 @@ function CHorRuler() ...@@ -760,6 +760,71 @@ function CHorRuler()
} }
} }
} }
else if (this.Units == c_oAscDocumentUnits.Point)
{
var point_1_12 = 25.4 * dKoef_mm_to_pix / 12;
var lCount1 = ((width - left_margin) / point_1_12) >> 0;
var lCount2 = (left_margin / point_1_12) >> 0;
var index = 0;
var num = 0;
for (var i = 1; i < lCount1; i++)
{
var lXPos = ((left_margin + i * point_1_12) >> 0) + 0.5;
index++;
if (index == 12)
index = 0;
if (0 == index || 6 == index)
{
num++;
// number
var strNum = "" + (num * 36);
var lWidthText = context.measureText(strNum).width;
lXPos -= (lWidthText / 2.0);
context.fillText(strNum, lXPos, this.m_nBottom - 3);
}
else if (point_1_12 > 5)
{
// 1/12
context.beginPath();
context.moveTo(lXPos, middleVert - part1);
context.lineTo(lXPos, middleVert + part1);
context.stroke();
}
}
index = 0;
num = 0;
for (var i = 1; i <= lCount2; i++)
{
var lXPos = ((left_margin - i * point_1_12) >> 0) + 0.5;
index++;
if (index == 12)
index = 0;
if (0 == index || 6 == index)
{
num++;
// number
var strNum = "" + (num * 36);
var lWidthText = context.measureText(strNum).width;
lXPos -= (lWidthText / 2.0);
context.fillText(strNum, lXPos, this.m_nBottom - 3);
}
else if (point_1_12 > 5)
{
// 1/12
context.beginPath();
context.moveTo(lXPos, middleVert - part1);
context.lineTo(lXPos, middleVert + part1);
context.stroke();
}
}
}
if (null != markup && this.CurrentObjectType == RULER_OBJECT_TYPE_TABLE) if (null != markup && this.CurrentObjectType == RULER_OBJECT_TYPE_TABLE)
{ {
...@@ -2566,7 +2631,7 @@ function CVerRuler() ...@@ -2566,7 +2631,7 @@ function CVerRuler()
this.SimpleChanges = new RulerCheckSimpleChanges(); this.SimpleChanges = new RulerCheckSimpleChanges();
this.Units = c_oAscRulerUnits.Inch; this.Units = c_oAscDocumentUnits.Millimeter;
this.CheckCanvas = function() this.CheckCanvas = function()
{ {
...@@ -2612,7 +2677,7 @@ function CVerRuler() ...@@ -2612,7 +2677,7 @@ function CVerRuler()
return heightNew; return heightNew;
} }
this.CreateBackground = function(cachedPage) this.CreateBackground = function(cachedPage, isattack)
{ {
if (window["NATIVE_EDITOR_ENJINE"]) if (window["NATIVE_EDITOR_ENJINE"])
return; return;
...@@ -2636,7 +2701,7 @@ function CVerRuler() ...@@ -2636,7 +2701,7 @@ function CVerRuler()
var checker = this.RepaintChecker; var checker = this.RepaintChecker;
var markup = this.m_oTableMarkup; var markup = this.m_oTableMarkup;
if (this.CurrentObjectType == checker.Type && height == checker.Height) if (isattack !== true && this.CurrentObjectType == checker.Type && height == checker.Height)
{ {
if (this.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH) if (this.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH)
{ {
...@@ -2787,7 +2852,7 @@ function CVerRuler() ...@@ -2787,7 +2852,7 @@ function CVerRuler()
context.font = "7pt Arial"; context.font = "7pt Arial";
if (this.Units == c_oAscRulerUnits.Millimeter) if (this.Units == c_oAscDocumentUnits.Millimeter)
{ {
var lCount1 = ((height - top_margin) / mm_1_4) >> 0; var lCount1 = ((height - top_margin) / mm_1_4) >> 0;
var lCount2 = (top_margin / mm_1_4) >> 0; var lCount2 = (top_margin / mm_1_4) >> 0;
...@@ -2897,7 +2962,7 @@ function CVerRuler() ...@@ -2897,7 +2962,7 @@ function CVerRuler()
} }
} }
} }
else if (this.Units == c_oAscRulerUnits.Inch) else if (this.Units == c_oAscDocumentUnits.Inch)
{ {
var lCount1 = ((height - top_margin) / inch_1_8) >> 0; var lCount1 = ((height - top_margin) / inch_1_8) >> 0;
var lCount2 = (top_margin / inch_1_8) >> 0; var lCount2 = (top_margin / inch_1_8) >> 0;
...@@ -2991,6 +3056,86 @@ function CVerRuler() ...@@ -2991,6 +3056,86 @@ function CVerRuler()
} }
} }
} }
else if (this.Units == c_oAscDocumentUnits.Point)
{
var point_1_12 = 25.4 * dKoef_mm_to_pix / 12;
var lCount1 = ((height - top_margin) / point_1_12) >> 0;
var lCount2 = (top_margin / point_1_12) >> 0;
var index = 0;
var num = 0;
for (var i = 1; i < lCount1; i++)
{
var lYPos = ((top_margin + i * point_1_12) >> 0) + 0.5;
index++;
if (index == 12)
index = 0;
if (0 == index || 6 == index)
{
num++;
// number
var strNum = "" + (num * 36);
var lWidthText = context.measureText(strNum).width;
context.translate(middleHor, lYPos);
context.rotate(-Math.PI / 2);
context.fillText(strNum, -lWidthText / 2.0, 4);
if (!this.IsRetina)
context.setTransform(1, 0, 0, 1, 0, 5);
else
context.setTransform(2, 0, 0, 2, 0, 10);
}
else if (point_1_12 > 5)
{
// 1/8
context.beginPath();
context.moveTo(middleHor - part1, lYPos);
context.lineTo(middleHor + part1, lYPos);
context.stroke();
}
}
index = 0;
num = 0;
for (var i = 1; i <= lCount2; i++)
{
var lYPos = ((top_margin - i * point_1_12) >> 0) + 0.5;
index++;
if (index == 12)
index = 0;
if (0 == index || 6 == index)
{
num++;
// number
var strNum = "" + (num * 36);
var lWidthText = context.measureText(strNum).width;
context.translate(middleHor, lYPos);
context.rotate(-Math.PI / 2);
context.fillText(strNum, -lWidthText / 2.0, 4);
if (!this.IsRetina)
context.setTransform(1, 0, 0, 1, 0, 5);
else
context.setTransform(2, 0, 0, 2, 0, 10);
}
else if (point_1_12 > 5)
{
// 1/8
context.beginPath();
context.moveTo(middleHor - part1, lYPos);
context.lineTo(middleHor + part1, lYPos);
context.stroke();
}
}
}
if ((this.CurrentObjectType == RULER_OBJECT_TYPE_TABLE) && (null != markup)) if ((this.CurrentObjectType == RULER_OBJECT_TYPE_TABLE) && (null != markup))
{ {
......
...@@ -6333,6 +6333,8 @@ asc_docs_api.prototype.asc_SetDocumentUnits = function(_units) ...@@ -6333,6 +6333,8 @@ asc_docs_api.prototype.asc_SetDocumentUnits = function(_units)
{ {
this.WordControl.m_oHorRuler.Units = _units; this.WordControl.m_oHorRuler.Units = _units;
this.WordControl.m_oVerRuler.Units = _units; this.WordControl.m_oVerRuler.Units = _units;
this.WordControl.UpdateHorRulerBack(true);
this.WordControl.UpdateVerRulerBack(true);
} }
}; };
......
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