Commit 356943b5 authored by Oleg Korshul's avatar Oleg Korshul

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

parent d2529c5d
......@@ -817,7 +817,8 @@ var contentchanges_Remove = 2;
var offlineMode = '_offline_';
var c_oAscRulerUnits = {
var c_oAscDocumentUnits = {
Millimeter : 0,
Inch : 1
Inch : 1,
Point : 2
};
\ No newline at end of file
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"use strict";
var g_dDpiX = 96.0;
......@@ -3217,26 +3217,26 @@ function CEditorPage(api)
this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage);
}
this.UpdateHorRulerBack = function()
this.UpdateHorRulerBack = function(isattack)
{
var drDoc = this.m_oDrawingDocument;
if (0 <= drDoc.SlideCurrent && drDoc.SlideCurrent < drDoc.SlidesCount)
{
this.CreateBackgroundHorRuler();
this.CreateBackgroundHorRuler(undefined, isattack);
}
this.UpdateHorRuler();
}
this.UpdateVerRulerBack = function()
this.UpdateVerRulerBack = function(isattack)
{
var drDoc = this.m_oDrawingDocument;
if (0 <= drDoc.SlideCurrent && drDoc.SlideCurrent < drDoc.SlidesCount)
{
this.CreateBackgroundVerRuler();
this.CreateBackgroundVerRuler(undefined, isattack);
}
this.UpdateVerRuler();
}
this.CreateBackgroundHorRuler = function(margins)
this.CreateBackgroundHorRuler = function(margins, isattack)
{
var cachedPage = {};
cachedPage.width_mm = this.m_oLogicDocument.Width;
......@@ -3257,9 +3257,9 @@ function CEditorPage(api)
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 = {};
cachedPage.width_mm = this.m_oLogicDocument.Width;
......@@ -3280,7 +3280,7 @@ function CEditorPage(api)
cachedPage.margin_bottom = this.m_oLogicDocument.Height;
}
this.m_oVerRuler.CreateBackground(cachedPage);
this.m_oVerRuler.CreateBackground(cachedPage, isattack);
}
this.ThemeGenerateThumbnails = function(_master)
......
......@@ -3818,6 +3818,8 @@ asc_docs_api.prototype.asc_SetDocumentUnits = function(_units)
{
this.WordControl.m_oHorRuler.Units = _units;
this.WordControl.m_oVerRuler.Units = _units;
this.WordControl.UpdateHorRulerBack(true);
this.WordControl.UpdateVerRulerBack(true);
}
};
......
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"use strict";
var g_dDpiX = 96.0;
......@@ -432,7 +432,7 @@ function CEditorPage(api)
_text_bx_back.setAttribute("autocomplete", "off");
_text_bx_back.setAttribute("type", "password");
}
// в некоторых браузерах - readonly
try {_text_bx_back.willValidate = false;}catch(err){}
this.m_oMainView.HtmlElement.appendChild(_text_bx_back);
......@@ -3918,21 +3918,21 @@ function CEditorPage(api)
this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage);
}
this.UpdateHorRulerBack = function()
this.UpdateHorRulerBack = function(isattack)
{
var drDoc = this.m_oDrawingDocument;
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.UpdateVerRulerBack = function()
this.UpdateVerRulerBack = function(isattack)
{
var drDoc = this.m_oDrawingDocument;
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();
}
......
......@@ -209,7 +209,7 @@ function CHorRuler()
this.SimpleChanges = new RulerCheckSimpleChanges();
this.Units = c_oAscRulerUnits.Inch;
this.Units = c_oAscDocumentUnits.Millimeter;
this.InitTablePict = function()
{
......@@ -378,7 +378,7 @@ function CHorRuler()
return widthNew;
}
this.CreateBackground = function(cachedPage)
this.CreateBackground = function(cachedPage, isattack)
{
if (window["NATIVE_EDITOR_ENJINE"])
return;
......@@ -404,7 +404,7 @@ function CHorRuler()
if (this.CurrentObjectType == RULER_OBJECT_TYPE_COLUMNS)
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)
{
......@@ -610,7 +610,7 @@ function CHorRuler()
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 lCount2 = (left_margin / mm_1_4) >> 0;
......@@ -705,7 +705,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 lCount2 = (left_margin / inch_1_8) >> 0;
......@@ -784,6 +784,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)
{
......@@ -2590,7 +2655,7 @@ function CVerRuler()
this.SimpleChanges = new RulerCheckSimpleChanges();
this.Units = c_oAscRulerUnits.Inch;
this.Units = c_oAscDocumentUnits.Millimeter;
this.CheckCanvas = function()
{
......@@ -2636,7 +2701,7 @@ function CVerRuler()
return heightNew;
}
this.CreateBackground = function(cachedPage)
this.CreateBackground = function(cachedPage, isattack)
{
if (window["NATIVE_EDITOR_ENJINE"])
return;
......@@ -2660,7 +2725,7 @@ function CVerRuler()
var checker = this.RepaintChecker;
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)
{
......@@ -2811,7 +2876,7 @@ function CVerRuler()
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 lCount2 = (top_margin / mm_1_4) >> 0;
......@@ -2921,7 +2986,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 lCount2 = (top_margin / inch_1_8) >> 0;
......@@ -3015,6 +3080,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))
{
......
......@@ -6357,6 +6357,8 @@ asc_docs_api.prototype.asc_SetDocumentUnits = function(_units)
{
this.WordControl.m_oHorRuler.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