Commit 843daee0 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

cool header footer

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56038 954022d7-b5bf-4e40-9824-e11837661b57
parent 4da3fad0
...@@ -1667,7 +1667,104 @@ CGraphics.prototype = ...@@ -1667,7 +1667,104 @@ CGraphics.prototype =
return this.m_bIntegerGrid; return this.m_bIntegerGrid;
}, },
DrawHeaderEdit : function(yPos, lock_type) DrawStringASCII : function(name, size, bold, italic, text, x, y, bIsHeader)
{
var _textProp = {
RFonts : { Ascii : { Name : name, Index : -1 } },
FontSize : (((size * 2 * 96 / this.m_dDpiY) + 0.5) >> 0) / 2,
Bold : false,
Italic : false
};
this.m_oTextPr = _textProp;
this.m_oGrFonts.Ascii.Name = this.m_oTextPr.RFonts.Ascii.Name;
this.m_oGrFonts.Ascii.Index = -1;
this.SetFontSlot(fontslot_ASCII, 1);
this.m_oFontManager.LoadString2(text, 0, 0);
var measure = this.m_oFontManager.MeasureString2();
var _ctx = this.m_oContext;
_ctx.beginPath();
_ctx.fillStyle = "#E1E1E1";
_ctx.strokeStyle = GlobalSkin.RulerOutline;
var __x = this.m_oFullTransform.TransformPointX(x, y) >> 0;
var __y = this.m_oFullTransform.TransformPointY(x, y) >> 0;
var __w = (measure.fWidth >> 0) + 20;
var __h = (measure.fHeight >> 0) + 10;
if (!bIsHeader)
__y -= __h;
_ctx.rect(__x + 0.5, __y + 0.5, __w, __h);
_ctx.fill();
_ctx.stroke();
_ctx.beginPath();
this.b_color1(68, 68, 68, 255);
var _koef_px_to_mm = 25.4 / this.m_dDpiY;
if (bIsHeader)
this.t(text, x + 10 * _koef_px_to_mm, y + (__h - 5) * _koef_px_to_mm);
else
this.t(text, x + 10 * _koef_px_to_mm, y - 5 * _koef_px_to_mm);
},
DrawStringASCII2 : function(name, size, bold, italic, text, x, y, bIsHeader)
{
var _textProp = {
RFonts : { Ascii : { Name : name, Index : -1 } },
FontSize : (((size * 2 * 96 / this.m_dDpiY) + 0.5) >> 0) / 2,
Bold : false,
Italic : false
};
this.m_oTextPr = _textProp;
this.m_oGrFonts.Ascii.Name = this.m_oTextPr.RFonts.Ascii.Name;
this.m_oGrFonts.Ascii.Index = -1;
this.SetFontSlot(fontslot_ASCII, 1);
this.m_oFontManager.LoadString2(text, 0, 0);
var measure = this.m_oFontManager.MeasureString2();
var _ctx = this.m_oContext;
_ctx.beginPath();
_ctx.fillStyle = "#E1E1E1";
_ctx.strokeStyle = GlobalSkin.RulerOutline;
var __x = this.m_oFullTransform.TransformPointX(this.m_dWidthMM - x, y) >> 0;
var __y = this.m_oFullTransform.TransformPointY(this.m_dWidthMM - x, y) >> 0;
var __w = (measure.fWidth >> 0) + 20;
var __h = (measure.fHeight >> 0) + 10;
__x -= __w;
if (!bIsHeader)
__y -= __h;
_ctx.rect(__x + 0.5, __y + 0.5, __w, __h);
_ctx.fill();
_ctx.stroke();
_ctx.beginPath();
this.b_color1(68, 68, 68, 255);
var _koef_px_to_mm = 25.4 / this.m_dDpiY;
var xPos = this.m_dWidthMM - x - (__w - 10) * _koef_px_to_mm;
if (bIsHeader)
this.t(text, xPos, y + (__h - 5) * _koef_px_to_mm);
else
this.t(text, xPos, y - 5 * _koef_px_to_mm);
},
DrawHeaderEdit : function(yPos, lock_type, sectionNum, bIsRepeat, type)
{ {
var _y = this.m_oFullTransform.TransformPointY(0,yPos); var _y = this.m_oFullTransform.TransformPointY(0,yPos);
_y = (_y >> 0) + 0.5; _y = (_y >> 0) + 0.5;
...@@ -1684,8 +1781,11 @@ CGraphics.prototype = ...@@ -1684,8 +1781,11 @@ CGraphics.prototype =
case locktype_None: case locktype_None:
case locktype_Mine: case locktype_Mine:
{ {
this.p_color(155, 187, 277, 255); //this.p_color(155, 187, 277, 255);
ctx.lineWidth = 2; //ctx.lineWidth = 2;
// GlobalSkin.RulerOutline
this.p_color(0xBB, 0xBE, 0xC2, 255);
ctx.lineWidth = 1;
break; break;
} }
case locktype_Other: case locktype_Other:
...@@ -1706,8 +1806,11 @@ CGraphics.prototype = ...@@ -1706,8 +1806,11 @@ CGraphics.prototype =
} }
} }
if (true === this.m_bIntegerGrid) var bIsNoIntGrid = this.m_bIntegerGrid;
{
if (false == bIsNoIntGrid)
this.SetIntegerGrid(true);
this._s(); this._s();
while (true) while (true)
{ {
...@@ -1719,26 +1822,31 @@ CGraphics.prototype = ...@@ -1719,26 +1822,31 @@ CGraphics.prototype =
_x+=_w2; _x+=_w2;
} }
this.ds(); this.ds();
}
else var _header_text = "Header"
{ if (-1 != sectionNum)
this.SetIntegerGrid(true); _header_text += (" -Section " + (sectionNum + 1) + "-");
this._s();
while (true) if (type.bFirst)
_header_text = "First Page " + _header_text;
else if (EvenAndOddHeaders)
{ {
if (_x > _wmax) if (type.bEven)
break; _header_text = "Even Page " + _header_text;
ctx.moveTo(_x,_y); else
_x+=_w1; _header_text = "Odd Page " + _header_text;
ctx.lineTo(_x,_y);
_x+=_w2;
} }
this.ds();
this.DrawStringASCII("Courier New", 9, false, false, _header_text, 2, yPos, true);
if (bIsRepeat)
this.DrawStringASCII2("Courier New", 9, false, false, "Same as Previous", 2, yPos, true);
if (false == bIsNoIntGrid)
this.SetIntegerGrid(false); this.SetIntegerGrid(false);
}
}, },
DrawFooterEdit : function(yPos, lock_type) DrawFooterEdit : function(yPos, lock_type, sectionNum, bIsRepeat, type)
{ {
var _y = this.m_oFullTransform.TransformPointY(0,yPos); var _y = this.m_oFullTransform.TransformPointY(0,yPos);
_y = (_y >> 0) + 0.5; _y = (_y >> 0) + 0.5;
...@@ -1753,8 +1861,11 @@ CGraphics.prototype = ...@@ -1753,8 +1861,11 @@ CGraphics.prototype =
case locktype_None: case locktype_None:
case locktype_Mine: case locktype_Mine:
{ {
this.p_color(155, 187, 277, 255); //this.p_color(155, 187, 277, 255);
ctx.lineWidth = 2; //ctx.lineWidth = 2;
// GlobalSkin.RulerOutline
this.p_color(0xBB, 0xBE, 0xC2, 255);
ctx.lineWidth = 1;
break; break;
} }
case locktype_Other: case locktype_Other:
...@@ -1777,8 +1888,11 @@ CGraphics.prototype = ...@@ -1777,8 +1888,11 @@ CGraphics.prototype =
var _wmax = this.m_lWidthPix; var _wmax = this.m_lWidthPix;
if (true === this.m_bIntegerGrid) var bIsNoIntGrid = this.m_bIntegerGrid;
{
if (false == bIsNoIntGrid)
this.SetIntegerGrid(true);
this._s(); this._s();
while (true) while (true)
{ {
...@@ -1790,23 +1904,28 @@ CGraphics.prototype = ...@@ -1790,23 +1904,28 @@ CGraphics.prototype =
_x+=_w2; _x+=_w2;
} }
this.ds(); this.ds();
}
else var _header_text = "Footer"
{ if (-1 != sectionNum)
this.SetIntegerGrid(true); _header_text += (" -Section " + (sectionNum + 1) + "-");
this._s();
while (true) if (type.bFirst)
_header_text = "First Page " + _header_text;
else if (EvenAndOddHeaders)
{ {
if (_x > _wmax) if (type.bEven)
break; _header_text = "Even Page " + _header_text;
ctx.moveTo(_x,_y); else
_x+=_w1; _header_text = "Odd Page " + _header_text;
ctx.lineTo(_x,_y);
_x+=_w2;
} }
this.ds();
this.DrawStringASCII("Courier New", 9, false, false, _header_text, 2, yPos, false);
if (bIsRepeat)
this.DrawStringASCII2("Courier New", 9, false, false, "Same as Previous", 2, yPos, false);
if (false == bIsNoIntGrid)
this.SetIntegerGrid(false); this.SetIntegerGrid(false);
}
}, },
DrawLockParagraph : function(lock_type, x, y1, y2) DrawLockParagraph : function(lock_type, x, y1, y2)
......
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