Exemplo n.º 1
0
        public void LoadFromStream(Stream aStream, ushort aFileVersion)
        {
            byte[] vBuffer;
            if (aFileVersion < 15)
            {
                int vLineSpace = 0;
                vBuffer = BitConverter.GetBytes(vLineSpace);
                aStream.Read(vBuffer, 0, vBuffer.Length);
            }

            byte vByte = 0;

            if (aFileVersion > 16)
            {
                vByte          = (byte)aStream.ReadByte();
                FLineSpaceMode = (ParaLineSpaceMode)vByte;
            }

            if (aFileVersion < 22)
            {
                vBuffer = BitConverter.GetBytes(FFirstIndentPix);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FFirstIndentPix = BitConverter.ToInt32(vBuffer, 0);
                //
                vBuffer = BitConverter.GetBytes(FLeftIndentPix);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FLeftIndentPix = BitConverter.ToInt32(vBuffer, 0);
            }
            else
            {
                vBuffer = BitConverter.GetBytes(FFirstIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FFirstIndent    = BitConverter.ToSingle(vBuffer, 0);
                FFirstIndentPix = HCUnitConversion.MillimeterToPixX(FFirstIndent);
                //
                vBuffer = BitConverter.GetBytes(FLeftIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FLeftIndent    = BitConverter.ToSingle(vBuffer, 0);
                FLeftIndentPix = HCUnitConversion.MillimeterToPixX(FLeftIndent);
                //
                vBuffer = BitConverter.GetBytes(FRightIndent);
                aStream.Read(vBuffer, 0, vBuffer.Length);
                FRightIndent    = BitConverter.ToSingle(vBuffer, 0);
                FRightIndentPix = HCUnitConversion.MillimeterToPixX(FRightIndent);
            }

            //
            HC.HCLoadColorFromStream(aStream, ref FBackColor);
            //
            vByte      = (byte)aStream.ReadByte();
            FAlignHorz = (ParaAlignHorz)vByte;

            if (aFileVersion > 17)
            {
                vByte      = (byte)aStream.ReadByte();
                FAlignVert = (ParaAlignVert)vByte;
            }
        }
Exemplo n.º 2
0
 public void AssignEx(HCParaStyle ASource)
 {
     this.FLineSpaceMode = ASource.LineSpaceMode;
     this.FFristIndent   = ASource.FristIndent;
     this.FLeftIndent    = ASource.LeftIndent;
     this.FBackColor     = ASource.BackColor;
     this.FAlignHorz     = ASource.AlignHorz;
     this.FAlignVert     = ASource.AlignVert;
 }
Exemplo n.º 3
0
 public HCParaStyle()
 {
     FirstIndent    = 0;
     LeftIndent     = 0;
     RightIndent    = 0;
     FLineSpaceMode = ParaLineSpaceMode.pls100;
     FBackColor     = Color.Silver;
     FAlignHorz     = ParaAlignHorz.pahJustify;
     FAlignVert     = ParaAlignVert.pavCenter;
 }
Exemplo n.º 4
0
 public void AssignEx(HCParaStyle aSource)
 {
     FLineSpaceMode = aSource.LineSpaceMode;
     FirstIndent    = aSource.FirstIndent;
     LeftIndent     = aSource.LeftIndent;
     RightIndent    = aSource.RightIndent;
     FBackColor     = aSource.BackColor;
     FAlignHorz     = aSource.AlignHorz;
     FAlignVert     = aSource.AlignVert;
 }
Exemplo n.º 5
0
        public void LoadFromStream(Stream AStream, ushort AFileVersion)
        {
            byte[] vBuffer;
            if (AFileVersion < 15)
            {
                int vLineSpace = 0;
                vBuffer = BitConverter.GetBytes(vLineSpace);
                AStream.Read(vBuffer, 0, vBuffer.Length);
            }

            byte vByte = 0;

            if (AFileVersion > 16)
            {
                vByte          = (byte)AStream.ReadByte();
                FLineSpaceMode = (ParaLineSpaceMode)vByte;
            }

            vBuffer = BitConverter.GetBytes(FFristIndent);
            AStream.Read(vBuffer, 0, vBuffer.Length);
            FFristIndent = BitConverter.ToInt32(vBuffer, 0);
            //
            vBuffer = BitConverter.GetBytes(FLeftIndent);
            AStream.Read(vBuffer, 0, vBuffer.Length);
            FLeftIndent = BitConverter.ToInt32(vBuffer, 0);
            //
            HC.LoadColorFromStream(AStream, ref FBackColor);
            //
            vByte      = (byte)AStream.ReadByte();
            FAlignHorz = (ParaAlignHorz)vByte;

            if (AFileVersion > 17)
            {
                vByte      = (byte)AStream.ReadByte();
                FAlignVert = (ParaAlignVert)vByte;
            }
        }
Exemplo n.º 6
0
 /// <summary> 修改当前光标所在段行间距 </summary>
 public void ApplyParaLineSpace(ParaLineSpaceMode aSpaceMode)
 {
     FData.ApplyParaLineSpace(aSpaceMode);
     CheckUpdateInfo();
 }
Exemplo n.º 7
0
        public void ParseXml(XmlElement aNode)
        {
            FirstIndent = int.Parse(aNode.Attributes["firstindent"].Value);
            LeftIndent  = int.Parse(aNode.Attributes["leftindent"].Value);
            RightIndent = int.Parse(aNode.Attributes["rightindent"].Value);
            FBackColor  = HC.GetXmlRGBColor(aNode.Attributes["bkcolor"].Value);
            //GetXMLLineSpaceMode_;
            if (aNode.Attributes["spacemode"].Value == "100")
            {
                FLineSpaceMode = ParaLineSpaceMode.pls100;
            }
            else
            if (aNode.Attributes["spacemode"].Value == "115")
            {
                FLineSpaceMode = ParaLineSpaceMode.pls115;
            }
            else
            if (aNode.Attributes["spacemode"].Value == "150")
            {
                FLineSpaceMode = ParaLineSpaceMode.pls150;
            }
            else
            if (aNode.Attributes["spacemode"].Value == "200")
            {
                FLineSpaceMode = ParaLineSpaceMode.pls200;
            }
            else
            if (aNode.Attributes["spacemode"].Value == "fix")
            {
                FLineSpaceMode = ParaLineSpaceMode.plsFix;
            }

            //GetXMLHorz_;
            if (aNode.Attributes["horz"].Value == "left")
            {
                FAlignHorz = ParaAlignHorz.pahLeft;
            }
            else
            if (aNode.Attributes["horz"].Value == "right")
            {
                FAlignHorz = ParaAlignHorz.pahRight;
            }
            else
            if (aNode.Attributes["horz"].Value == "center")
            {
                FAlignHorz = ParaAlignHorz.pahCenter;
            }
            else
            if (aNode.Attributes["horz"].Value == "justify")
            {
                FAlignHorz = ParaAlignHorz.pahJustify;
            }
            else
            if (aNode.Attributes["horz"].Value == "scatter")
            {
                FAlignHorz = ParaAlignHorz.pahScatter;
            }

            //GetXMLVert_;
            if (aNode.Attributes["vert"].Value == "top")
            {
                FAlignVert = ParaAlignVert.pavTop;
            }
            else
            if (aNode.Attributes["vert"].Value == "center")
            {
                FAlignVert = ParaAlignVert.pavCenter;
            }
            else
            if (aNode.Attributes["vert"].Value == "bottom")
            {
                FAlignVert = ParaAlignVert.pavBottom;
            }
        }
Exemplo n.º 8
0
 /// <summary> 修改当前光标所在段行间距 </summary>
 public void ApplyParaLineSpace(ParaLineSpaceMode aSpaceMode, Single aSpace = 1)
 {
     FData.ApplyParaLineSpace(aSpaceMode, aSpace);
     CheckUpdateInfo();
 }