Commit 273e6ff9 authored by Ilya Kirillov's avatar Ilya Kirillov

Fix bug #30940. Default styles were remaked.

parent 902b1a3d
...@@ -676,20 +676,10 @@ CStyle.prototype = ...@@ -676,20 +676,10 @@ CStyle.prototype =
this.TextPr.Document_Get_AllFontNames(AllFonts); this.TextPr.Document_Get_AllFontNames(AllFonts);
}, },
Create_Default_Paragraph : function() Create_Default_Paragraph : function()
{ {
this.Set_QFormat(true);
var TextPr = },
{
FontFamily: { Name : "Arial", Index : -1 },
Color : { r : 0, g : 0, b : 0 },
Unifill : AscFormat.CreateUnfilFromRGB(0,0,0)
};
this.Set_QFormat( true );
this.Set_TextPr( TextPr );
},
Create_Default_Character : function() Create_Default_Character : function()
{ {
...@@ -705,344 +695,373 @@ CStyle.prototype = ...@@ -705,344 +695,373 @@ CStyle.prototype =
this.Set_UnhideWhenUsed( true ); this.Set_UnhideWhenUsed( true );
}, },
Create_Heading1 : function() private_CreateDefaultUnifillColor : function()
{ {
var ParaPr = var Unifill = new AscFormat.CUniFill();
{ Unifill.fill = new AscFormat.CSolidFill();
KeepNext : true, Unifill.fill.color = AscFormat.builder_CreateSchemeColor('tx1');
KeepLines: true, return Unifill;
},
Spacing :
{ Create_Heading1 : function()
Before : 24 * g_dKoef_pt_to_mm, {
After : 0 var ParaPr = {
}, KeepNext : true,
KeepLines : true,
OutlineLvl : 0
}; Spacing : {
Before : 24 * g_dKoef_pt_to_mm,
var TextPr = After : 0
{ },
FontSize : 24,
FontFamily : { Name : Default_Heading_Font, Index : -1 }, OutlineLvl : 0
Bold : true, };
Color :
{ var TextPr = {
r : 0, FontSize : 24,
g : 0, FontSizeCS : 24,
b : 0 RFonts : {
} Ascii : {Name : Default_Heading_Font, Index : -1},
}; EastAsia : {Name : Default_Heading_Font, Index : -1},
HAnsi : {Name : Default_Heading_Font, Index : -1},
this.Set_QFormat( true ); CS : {Name : Default_Heading_Font, Index : -1}
this.Set_UiPriority( 9 ); },
this.Set_ParaPr( ParaPr );
this.Set_TextPr( TextPr ); Bold : true,
}, BoldCS : true,
Color : {
Create_Heading2 : function() r : 0,
{ g : 0,
var ParaPr = b : 0
{ },
KeepNext : true, Unifill : this.private_CreateDefaultUnifillColor()
KeepLines: true, };
Spacing :
{
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 1
};
var TextPr =
{
FontSize : 20,
FontFamily : { Name : Default_Heading_Font, Index : -1 },
Bold : true,
Color :
{
r : 0,
g : 0,
b : 0
}
};
this.Set_QFormat( true );
this.Set_UiPriority( 9 );
this.Set_UnhideWhenUsed( true );
this.Set_TextPr( TextPr );
this.Set_ParaPr( ParaPr );
},
Create_Heading3 : function()
{
var ParaPr =
{
KeepNext : true,
KeepLines: true,
Spacing :
{
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 2
};
var TextPr =
{
FontSize : 18,
FontFamily : { Name : Default_Heading_Font, Index : -1 },
Bold : true,
Italic : true,
Color :
{
r : 0,
g : 0,
b : 0
}
};
this.Set_QFormat( true );
this.Set_UiPriority( 9 );
this.Set_UnhideWhenUsed( true );
this.Set_TextPr( TextPr );
this.Set_ParaPr( ParaPr );
},
Create_Heading4 : function()
{
var ParaPr =
{
KeepNext : true,
KeepLines: true,
Spacing :
{
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 3
};
var TextPr =
{
FontSize : 16,
FontFamily : { Name : Default_Heading_Font, Index : -1 },
Color :
{
r : 0x23,
g : 0x23,
b : 0x23
}
};
this.Set_QFormat( true );
this.Set_UiPriority( 9 );
this.Set_UnhideWhenUsed( true );
this.Set_TextPr( TextPr );
this.Set_ParaPr( ParaPr );
},
Create_Heading5 : function()
{
var ParaPr =
{
KeepNext : true,
KeepLines: true,
Spacing :
{
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 4
};
var TextPr =
{
FontSize : 14,
FontFamily : { Name : Default_Heading_Font, Index : -1 },
Bold : true,
Color :
{
r : 0x44,
g : 0x44,
b : 0x44
}
};
this.Set_QFormat( true );
this.Set_UiPriority( 9 );
this.Set_UnhideWhenUsed( true );
this.Set_TextPr( TextPr );
this.Set_ParaPr( ParaPr );
},
Create_Heading6 : function()
{
var ParaPr =
{
KeepNext : true,
KeepLines: true,
Spacing :
{
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 5
};
var TextPr =
{
FontSize : 14,
Italic : true,
FontFamily : { Name : Default_Heading_Font, Index : -1 },
Color :
{
r : 0x23,
g : 0x23,
b : 0x23
}
};
this.Set_QFormat( true ); this.Set_QFormat( true );
this.Set_UiPriority( 9 ); this.Set_UiPriority( 9 );
this.Set_UnhideWhenUsed( true );
this.Set_TextPr( TextPr );
this.Set_ParaPr( ParaPr ); this.Set_ParaPr( ParaPr );
},
Create_Heading7 : function()
{
var ParaPr =
{
KeepNext : true,
KeepLines: true,
Spacing :
{
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 6
};
var TextPr =
{
FontSize : 12,
FontFamily : { Name : Default_Heading_Font, Index : -1 },
Bold : true,
Color :
{
r : 0x60,
g : 0x60,
b : 0x60
}
};
this.Set_QFormat( true );
this.Set_UiPriority( 9 );
this.Set_UnhideWhenUsed( true );
this.Set_TextPr( TextPr ); this.Set_TextPr( TextPr );
this.Set_ParaPr( ParaPr );
}, },
Create_Heading8 : function() Create_Heading2 : function()
{ {
var ParaPr = var ParaPr = {
{ KeepNext : true,
KeepNext : true, KeepLines : true,
KeepLines: true,
Spacing : {
Spacing : Before : 10 * g_dKoef_pt_to_mm,
{ After : 0
Before : 10 * g_dKoef_pt_to_mm, },
After : 0
}, OutlineLvl : 1
};
OutlineLvl : 7
}; var TextPr = {
FontSize : 20,
var TextPr = RFonts : {
{ Ascii : {Name : Default_Heading_Font, Index : -1},
FontSize : 12, EastAsia : {Name : Default_Heading_Font, Index : -1},
FontFamily : { Name : Default_Heading_Font, Index : -1 }, HAnsi : {Name : Default_Heading_Font, Index : -1},
Color : CS : {Name : Default_Heading_Font, Index : -1}
{ },
r : 0x44, Bold : true,
g : 0x44, BoldCS : true,
b : 0x44 Color : {
} r : 0,
}; g : 0,
b : 0
this.Set_QFormat( true ); },
this.Set_UiPriority( 9 ); Unifill : this.private_CreateDefaultUnifillColor()
this.Set_UnhideWhenUsed( true ); };
this.Set_TextPr( TextPr );
this.Set_ParaPr( ParaPr ); this.Set_QFormat(true);
}, this.Set_UiPriority(9);
this.Set_UnhideWhenUsed(true);
Create_Heading9 : function() this.Set_TextPr(TextPr);
{ this.Set_ParaPr(ParaPr);
var ParaPr = },
{
KeepNext : true, Create_Heading3 : function()
KeepLines: true, {
var ParaPr = {
Spacing : KeepNext : true,
{ KeepLines : true,
Before : 10 * g_dKoef_pt_to_mm,
After : 0 Spacing : {
}, Before : 10 * g_dKoef_pt_to_mm,
After : 0
OutlineLvl : 8 },
};
OutlineLvl : 2
var TextPr = };
{
FontSize : 11.5, var TextPr = {
FontFamily : { Name : Default_Heading_Font, Index : -1 }, FontSize : 18,
Italic : true, FontSizeCS : 18,
Color : RFonts : {
{ Ascii : {Name : Default_Heading_Font, Index : -1},
r : 0x44, EastAsia : {Name : Default_Heading_Font, Index : -1},
g : 0x44, HAnsi : {Name : Default_Heading_Font, Index : -1},
b : 0x44 CS : {Name : Default_Heading_Font, Index : -1}
} },
}; Bold : true,
BoldCS : true,
this.Set_QFormat( true ); Italic : true,
this.Set_UiPriority( 9 ); ItalicCS : true,
this.Set_UnhideWhenUsed( true ); Color : {
this.Set_TextPr( TextPr ); r : 0,
this.Set_ParaPr( ParaPr ); g : 0,
}, b : 0
},
Create_ListParagraph : function() Unifill : this.private_CreateDefaultUnifillColor()
{ };
var ParaPr =
{ this.Set_QFormat(true);
Ind : this.Set_UiPriority(9);
{ this.Set_UnhideWhenUsed(true);
Left : 36 * g_dKoef_pt_to_mm this.Set_TextPr(TextPr);
}, this.Set_ParaPr(ParaPr);
},
ContextualSpacing : true
}; Create_Heading4 : function()
{
this.Set_QFormat( true ); var ParaPr = {
this.Set_UiPriority( 34 ); KeepNext : true,
this.Set_ParaPr( ParaPr ); KeepLines : true,
},
Spacing : {
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 3
};
var TextPr = {
FontSize : 16,
FontSizeCS : 16,
RFonts : {
Ascii : {Name : Default_Heading_Font, Index : -1},
EastAsia : {Name : Default_Heading_Font, Index : -1},
HAnsi : {Name : Default_Heading_Font, Index : -1},
CS : {Name : Default_Heading_Font, Index : -1}
},
Color : {
r : 0x23,
g : 0x23,
b : 0x23
}
};
this.Set_QFormat(true);
this.Set_UiPriority(9);
this.Set_UnhideWhenUsed(true);
this.Set_TextPr(TextPr);
this.Set_ParaPr(ParaPr);
},
Create_Heading5 : function()
{
var ParaPr = {
KeepNext : true,
KeepLines : true,
Spacing : {
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 4
};
var TextPr =
{
FontSize : 14,
FontSizeCS : 14,
RFonts : {
Ascii : {Name : Default_Heading_Font, Index : -1},
EastAsia : {Name : Default_Heading_Font, Index : -1},
HAnsi : {Name : Default_Heading_Font, Index : -1},
CS : {Name : Default_Heading_Font, Index : -1}
},
Bold : true,
BoldCS : true,
Color : {
r : 0x44,
g : 0x44,
b : 0x44
}
};
this.Set_QFormat(true);
this.Set_UiPriority(9);
this.Set_UnhideWhenUsed(true);
this.Set_TextPr(TextPr);
this.Set_ParaPr(ParaPr);
},
Create_Heading6 : function()
{
var ParaPr = {
KeepNext : true,
KeepLines : true,
Spacing : {
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 5
};
var TextPr = {
FontSize : 14,
FontSizeCS : 14,
Italic : true,
ItalicCS : true,
RFonts : {
Ascii : {Name : Default_Heading_Font, Index : -1},
EastAsia : {Name : Default_Heading_Font, Index : -1},
HAnsi : {Name : Default_Heading_Font, Index : -1},
CS : {Name : Default_Heading_Font, Index : -1}
},
Color : {
r : 0x23,
g : 0x23,
b : 0x23
}
};
this.Set_QFormat(true);
this.Set_UiPriority(9);
this.Set_UnhideWhenUsed(true);
this.Set_TextPr(TextPr);
this.Set_ParaPr(ParaPr);
},
Create_Heading7 : function()
{
var ParaPr = {
KeepNext : true,
KeepLines : true,
Spacing : {
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 6
};
var TextPr = {
FontSize : 12,
FontSizeCS : 12,
RFonts : {
Ascii : {Name : Default_Heading_Font, Index : -1},
EastAsia : {Name : Default_Heading_Font, Index : -1},
HAnsi : {Name : Default_Heading_Font, Index : -1},
CS : {Name : Default_Heading_Font, Index : -1}
},
Bold : true,
BoldCS : true,
Color : {
r : 0x60,
g : 0x60,
b : 0x60
}
};
this.Set_QFormat(true);
this.Set_UiPriority(9);
this.Set_UnhideWhenUsed(true);
this.Set_TextPr(TextPr);
this.Set_ParaPr(ParaPr);
},
Create_Heading8 : function()
{
var ParaPr = {
KeepNext : true,
KeepLines : true,
Spacing : {
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 7
};
var TextPr = {
FontSize : 12,
FontSizeCS : 12,
RFonts : {
Ascii : {Name : Default_Heading_Font, Index : -1},
EastAsia : {Name : Default_Heading_Font, Index : -1},
HAnsi : {Name : Default_Heading_Font, Index : -1},
CS : {Name : Default_Heading_Font, Index : -1}
},
Color : {
r : 0x44,
g : 0x44,
b : 0x44
}
};
this.Set_QFormat(true);
this.Set_UiPriority(9);
this.Set_UnhideWhenUsed(true);
this.Set_TextPr(TextPr);
this.Set_ParaPr(ParaPr);
},
Create_Heading9 : function()
{
var ParaPr = {
KeepNext : true,
KeepLines : true,
Spacing : {
Before : 10 * g_dKoef_pt_to_mm,
After : 0
},
OutlineLvl : 8
};
var TextPr = {
FontSize : 11.5,
FontSizeCS : 11.5,
RFonts : {
Ascii : {Name : Default_Heading_Font, Index : -1},
EastAsia : {Name : Default_Heading_Font, Index : -1},
HAnsi : {Name : Default_Heading_Font, Index : -1},
CS : {Name : Default_Heading_Font, Index : -1}
},
Italic : true,
ItalicCS : true,
Color : {
r : 0x44,
g : 0x44,
b : 0x44
}
};
this.Set_QFormat(true);
this.Set_UiPriority(9);
this.Set_UnhideWhenUsed(true);
this.Set_TextPr(TextPr);
this.Set_ParaPr(ParaPr);
},
Create_ListParagraph : function()
{
var ParaPr = {
Ind : {
Left : 36 * g_dKoef_pt_to_mm
},
ContextualSpacing : true
};
this.Set_QFormat(true);
this.Set_UiPriority(34);
this.Set_ParaPr(ParaPr);
},
Create_NoSpacing : function() Create_NoSpacing : function()
{ {
...@@ -8532,9 +8551,6 @@ CTextPr.prototype = ...@@ -8532,9 +8551,6 @@ CTextPr.prototype =
if (this.Underline !== TextPr.Underline) if (this.Underline !== TextPr.Underline)
return false; return false;
if ((undefined === this.FontFamily && undefined !== TextPr.FontFamily) || (undefined !== this.FontFamily && (undefined === TextPr.FontFamily || this.FontFamily.Name !== TextPr.FontFamily.Name)))
return false;
if (false if (false
|| (undefined === this.FontSize || (undefined === this.FontSize
&& undefined !== TextPr.FontSize) && undefined !== TextPr.FontSize)
...@@ -8599,7 +8615,6 @@ CTextPr.prototype = ...@@ -8599,7 +8615,6 @@ CTextPr.prototype =
if ((undefined === this.Unifill && undefined !== TextPr.Unifill) || (undefined !== this.Unifill && (undefined === TextPr.Unifill || true !== this.Unifill.IsIdentical(TextPr.Unifill)))) if ((undefined === this.Unifill && undefined !== TextPr.Unifill) || (undefined !== this.Unifill && (undefined === TextPr.Unifill || true !== this.Unifill.IsIdentical(TextPr.Unifill))))
return false; return false;
if ((undefined === this.TextOutline && undefined !== TextPr.TextOutline) || (undefined !== this.TextOutline && (undefined === TextPr.TextOutline || true !== this.TextOutline.IsIdentical(TextPr.TextOutline)))) if ((undefined === this.TextOutline && undefined !== TextPr.TextOutline) || (undefined !== this.TextOutline && (undefined === TextPr.TextOutline || true !== this.TextOutline.IsIdentical(TextPr.TextOutline))))
return false; return false;
...@@ -9302,18 +9317,22 @@ CParaSpacing.prototype = ...@@ -9302,18 +9317,22 @@ CParaSpacing.prototype =
this.AfterAutoSpacing = Spacing.AfterAutoSpacing; this.AfterAutoSpacing = Spacing.AfterAutoSpacing;
}, },
Is_Equal : function(Spacing) Is_Equal : function(Spacing)
{ {
if (this.Line !== Spacing.Line if (this.Line !== Spacing.Line
|| this.LineRule !== Spacing.LineRule || this.LineRule !== Spacing.LineRule
|| this.Before !== Spacing.Before || (this.Before === undefined && Spacing.Before !== undefined)
|| this.BeforeAutoSpacing !== Spacing.BeforeAutoSpacing || (this.Before !== undefined && Spacing.Before === undefined)
|| this.After !== Spacing.After || ((this.Before !== undefined && Spacing.Before !== undefined) && (this.Before - Spacing.Before) > 0.001)
|| this.AfterAutoSpacing !== Spacing.AfterAutoSpacing) || this.BeforeAutoSpacing !== Spacing.BeforeAutoSpacing
return false; || (this.After === undefined && Spacing.After !== undefined)
|| (this.After !== undefined && Spacing.After === undefined)
|| ((this.After !== undefined && Spacing.After !== undefined) && (this.After - Spacing.After) > 0.001)
|| this.AfterAutoSpacing !== Spacing.AfterAutoSpacing)
return false;
return true; return true;
}, },
Set_FromObject : function(Spacing) Set_FromObject : function(Spacing)
{ {
...@@ -10020,26 +10039,18 @@ CParaPr.prototype = ...@@ -10020,26 +10039,18 @@ CParaPr.prototype =
{ {
this.ContextualSpacing = ParaPr.ContextualSpacing; this.ContextualSpacing = ParaPr.ContextualSpacing;
if ( undefined != ParaPr.Ind ) this.Ind = new CParaInd();
{ if (undefined != ParaPr.Ind)
this.Ind = new CParaInd(); this.Ind.Set_FromObject(ParaPr.Ind);
this.Ind.Set_FromObject( ParaPr.Ind );
}
else
this.Ind = undefined;
this.Jc = ParaPr.Jc; this.Jc = ParaPr.Jc;
this.KeepLines = ParaPr.KeepLines; this.KeepLines = ParaPr.KeepLines;
this.KeepNext = ParaPr.KeepNext; this.KeepNext = ParaPr.KeepNext;
this.PageBreakBefore = ParaPr.PageBreakBefore; this.PageBreakBefore = ParaPr.PageBreakBefore;
if ( undefined != ParaPr.Spacing ) this.Spacing = new CParaSpacing();
{ if (undefined != ParaPr.Spacing)
this.Spacing = new CParaSpacing(); this.Spacing.Set_FromObject(ParaPr.Spacing);
this.Spacing.Set_FromObject( ParaPr.Spacing );
}
else
this.Spacing = undefined;
if ( undefined != ParaPr.Shd ) if ( undefined != ParaPr.Shd )
{ {
......
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