Esempio n. 1
0
        public void saveTo(BinaryWriter writer, PersistContext ctx)
        {
            writer.Write(x);
            writer.Write(y);
            writer.Write(allowIncoming);
            writer.Write(allowOutgoing);
            writer.Write((int)markStyle);
            ctx.saveColor(color);

            // new in file format 6
            writer.Write(col);

            // new in file format 7
            bool tagSerializable = false;

            if (tag != null)
            {
                tagSerializable = tag.GetType().IsSerializable;
            }
            writer.Write(tagSerializable);

            if (tagSerializable)
            {
                ctx.saveTag(tag);
            }

            // new in file format 23
            writer.Write(toolTip);
        }
Esempio n. 2
0
        public virtual void saveTo(BinaryWriter writer, PersistContext ctx)
        {
            ctx.saveRect(rect);
            writer.Write(constructed);
            writer.Write(locked);
            writer.Write(zIndex);
            writer.Write((int)penDashStyle);
            writer.Write((double)penWidth);
            writer.Write((double)shadowOffsetX);
            writer.Write((double)shadowOffsetY);
            writer.Write(invisible);
            writer.Write(selected);

            bool tagSerializable = false;

            if (tag != null)
            {
                tagSerializable = tag.GetType().IsSerializable;
            }
            writer.Write(tagSerializable);

            if (tagSerializable)
            {
                ctx.saveTag(tag);
            }

            ctx.saveFont(Font);
            writer.Write(toolTip);

            ctx.saveReference(this, subordinateGroup, 100);
            ctx.saveReference(this, masterGroup, 101);

            // new in file format 10
            ctx.saveColor(shadowColor);
            writer.Write(ignoreLayout);

            // new in file format 15
            writer.Write(printable);

            // new in file format 16
            writer.Write(weight);
        }
Esempio n. 3
0
        public virtual void saveTo(BinaryWriter writer, PersistContext ctx)
        {
            ctx.saveReference(this, prevPoints, 1);
            ctx.saveRect(prevRect);
            writer.Write(attachments.Count);
            for (int i = 0; i < attachments.Count; ++i)
            {
                Attachment atch = (Attachment)attachments[i];
                ctx.saveObject(atch);
            }
            ctx.saveReference(this, mainObj, 2);

            writer.Write(visible);

            bool tagSerializable = false;

            if (tag != null)
            {
                tagSerializable = tag.GetType().IsSerializable;
            }
            writer.Write(tagSerializable);

            if (tagSerializable)
            {
                ctx.saveTag(tag);
            }

            // new in save format 17
            writer.Write(autoDeleteItems);

            // new in save format 21
            writer.Write(expandable);

            // new in save format 22
            writer.Write(followMasterRotation);
        }
Esempio n. 4
0
			public virtual void saveTo(BinaryWriter writer, PersistContext ctx)
			{
				writer.Write(text);
				ctx.saveStringFormat(textFormat);
				ctx.saveReference(this, table, 1);

				// new in save format 6
				writer.Write((int)picturePos);
				ctx.saveImage(picture);

				// new in save format 14
				ctx.saveColor(textColor);
				ctx.saveReference(this, brush, 2);

				// new in save format 18
				writer.Write(toolTip);

				// new in save format 19
				writer.Write(hyperLink);

				// new in save format 22
				writer.Write(columnSpan);
				writer.Write(rowSpan);

				bool tagSerializable = false;
				if (tag != null)
					tagSerializable = tag.GetType().IsSerializable;
				writer.Write(tagSerializable);

				if (tagSerializable)
					ctx.saveTag(tag);
			}
Esempio n. 5
0
		/// <summary>
		/// Saves the flowchart document into a stream
		/// </summary>
		public void SaveToStream(Stream stream, bool clearDirty)
		{
			PersistContext ctx = new PersistContext(stream, this);
			ctx.writeHeader();

			// write properties
			DocInfoVer1 docInfo1 = new DocInfoVer1(this);
			DocInfoVer2 docInfo2 = new DocInfoVer2(this);
			ctx.saveObject(docInfo1);
			ctx.saveObject(docInfo2);

			ctx.saveStringFormat(textFormat);
			ctx.saveFont(Font);
			ctx.saveImage(BackgroundImage);

			// write collections
			ctx.saveObject(zOrder);
			ctx.saveObject(groups);
			ctx.saveObject(selection);

			ctx.saveReference(this, activeObject, 1);

			ctx.saveObject(shapeTemplate);

			Brush.StoreBrushes(new BinaryWriter(stream), ctx);
			ctx.saveObject(boxPen);
			ctx.saveObject(arrowPen);
			ctx.saveObject(tablePen);
			ctx.saveReference(this, boxBrush, 2);
			ctx.saveReference(this, arrowBrush, 3);
			ctx.saveReference(this, tableBrush, 4);

			ctx.writer.Write((int)boxSelStyle);
			ctx.writer.Write((int)tableSelStyle);

			// new in save format 5
			ctx.writer.Write(allowLinksRepeat);

			// new in save format 6
			ctx.writer.Write(PolyTextLayout);
			ctx.writer.Write(ShapeOrientation);

			// new in save format 8
			ctx.writer.Write(routeArrows);
			ctx.writer.Write(arrowsRetainForm);
			ctx.writer.Write((int)arrowTextStyle);
			ctx.writer.Write((int)tableLinkStyle);

			// new in save format 12
			ctx.writer.Write((int)measureUnit);
			ctx.saveRect(docExtentsMin);

			// new in save format 14
			ctx.writer.Write((int)expandBtnPos);

			ctx.writer.Write((int)Orientation.Auto);	// not used anymore
			ctx.writer.Write((int)Orientation.Auto); // not used anymore

			ctx.writer.Write(enableStyledText);
			ctx.writer.Write(usePolyTextLt);
			ctx.saveReference(this, brush, 5);

			// new in save format 17
			ctx.writer.Write(arrowText);
			ctx.writer.Write(boxText);
			ctx.writer.Write((int)arrowCrossings);
			ctx.writer.Write((int)gridStyle);
			ctx.writer.Write(crossRadius);

			// new in save format 20
			ctx.saveReference(this, exteriorBrush, 6);
			ctx.writer.Write(arrowsSnapToBorders);
			ctx.writer.Write((int)arrowSelStyle);

			// new in save format 21
			bool tagSerializable = false;
			if (Tag != null)
				tagSerializable = Tag.GetType().IsSerializable;
			ctx.writer.Write(tagSerializable);

			if (tagSerializable)
				ctx.saveTag(Tag);

			// new in save format 27
			ctx.writer.Write(roundedArrows);
			ctx.writer.Write(roundedArrowsRadius);

			// write the chart objects
			ctx.writeReferencedObjects();

			if (clearDirty)
				Dirty = false;
		}
Esempio n. 6
0
		public override void saveTo(BinaryWriter writer, PersistContext ctx)
		{
			base.saveTo(writer, ctx);

			writer.Write((long)enabledHandles);
			writer.Write((int)ctrlMouseAction);
			ctx.saveReference(this, incomingArrows, 1);
			ctx.saveReference(this, outgoingArrows, 2);

			if (_control != null)
			{
				System.Type type = _control.GetType();

				string assemblyName = type.Assembly.GetName().Name;
				string typeName = type.FullName;

				writer.Write(true);
				writer.Write(assemblyName);
				writer.Write(typeName);

				// Save control serializable properties
				PropertyInfo[] props = type.GetProperties();
				foreach (PropertyInfo prop in props)
				{
					// Will not serialize indexed properties
					ParameterInfo[] iparams = prop.GetIndexParameters();
					if (iparams == null || iparams.Length > 0)
						continue;
					if (!prop.CanRead || !prop.CanWrite)
						continue;

					object val = null;
					try
					{
						val = prop.GetValue(_control, null);
					}
					catch
					{
						// Some properties cannot be read
						continue;
					}
					if (val == null)
						continue;
					if (!(val.GetType().IsSerializable))
						continue;
					if (val is ChartObject)
						continue;

					writer.Write(true);
					writer.Write(prop.Name);
					ctx.saveTag(val);
				}
				writer.Write(false);

				flowChart.fireControlHostSerializing(this, writer);
			}
			else
			{
				writer.Write(false);
			}

			// new in save format 14
			writer.Write(Expanded);
			writer.Write(Expandable);

			// new in save format 22
			writer.Write((int)selStyle);
		}
Esempio n. 7
0
		public void saveTo(BinaryWriter writer, PersistContext ctx)
		{
			writer.Write(x);
			writer.Write(y);
			writer.Write(allowIncoming);
			writer.Write(allowOutgoing);
			writer.Write((int)markStyle);
			ctx.saveColor(color);

			// new in file format 6
			writer.Write(col);

			// new in file format 7
			bool tagSerializable = false;
			if (tag != null)
				tagSerializable = tag.GetType().IsSerializable;
			writer.Write(tagSerializable);

			if (tagSerializable)
				ctx.saveTag(tag);

			// new in file format 23
			writer.Write(toolTip);
		}
Esempio n. 8
0
		public virtual void saveTo(BinaryWriter writer, PersistContext ctx)
		{
			ctx.saveReference(this, prevPoints, 1);
			ctx.saveRect(prevRect);
			writer.Write(attachments.Count);
			for (int i = 0; i < attachments.Count; ++i)
			{
				Attachment atch = (Attachment)attachments[i];
				ctx.saveObject(atch);
			}
			ctx.saveReference(this, mainObj, 2);

			writer.Write(visible);

			bool tagSerializable = false;
			if (tag != null)
				tagSerializable = tag.GetType().IsSerializable;
			writer.Write(tagSerializable);

			if (tagSerializable)
				ctx.saveTag(tag);

			// new in save format 17
			writer.Write(autoDeleteItems);

			// new in save format 21
			writer.Write(expandable);

			// new in save format 22
			writer.Write(followMasterRotation);
		}
Esempio n. 9
0
		public virtual void saveTo(BinaryWriter writer, PersistContext ctx)
		{
			ctx.saveRect(rect);
			writer.Write(constructed);
			writer.Write(locked);
			writer.Write(zIndex);
			writer.Write((int)penDashStyle);
			writer.Write((double)penWidth);
			writer.Write((double)shadowOffsetX);
			writer.Write((double)shadowOffsetY);
			writer.Write(invisible);
			writer.Write(selected);

			bool tagSerializable = false;
			if (tag != null)
				tagSerializable = tag.GetType().IsSerializable;
			writer.Write(tagSerializable);

			if (tagSerializable)
				ctx.saveTag(tag);

			ctx.saveFont(Font);
			writer.Write(toolTip);

			ctx.saveReference(this, subordinateGroup, 100);
			ctx.saveReference(this, masterGroup, 101);

			// new in file format 10
			ctx.saveColor(shadowColor);
			writer.Write(ignoreLayout);

			// new in file format 15
			writer.Write(printable);

			// new in file format 16
			writer.Write(weight);
		}
Esempio n. 10
0
        public override void saveTo(BinaryWriter writer, PersistContext ctx)
        {
            base.saveTo(writer, ctx);

            writer.Write((long)enabledHandles);
            writer.Write((int)ctrlMouseAction);
            ctx.saveReference(this, incomingArrows, 1);
            ctx.saveReference(this, outgoingArrows, 2);

            if (_control != null)
            {
                System.Type type = _control.GetType();

                string assemblyName = type.Assembly.GetName().Name;
                string typeName     = type.FullName;

                writer.Write(true);
                writer.Write(assemblyName);
                writer.Write(typeName);

                // Save control serializable properties
                PropertyInfo[] props = type.GetProperties();
                foreach (PropertyInfo prop in props)
                {
                    // Will not serialize indexed properties
                    ParameterInfo[] iparams = prop.GetIndexParameters();
                    if (iparams == null || iparams.Length > 0)
                    {
                        continue;
                    }
                    if (!prop.CanRead || !prop.CanWrite)
                    {
                        continue;
                    }

                    object val = null;
                    try
                    {
                        val = prop.GetValue(_control, null);
                    }
                    catch
                    {
                        // Some properties cannot be read
                        continue;
                    }
                    if (val == null)
                    {
                        continue;
                    }
                    if (!(val.GetType().IsSerializable))
                    {
                        continue;
                    }
                    if (val is ChartObject)
                    {
                        continue;
                    }

                    writer.Write(true);
                    writer.Write(prop.Name);
                    ctx.saveTag(val);
                }
                writer.Write(false);

                flowChart.fireControlHostSerializing(this, writer);
            }
            else
            {
                writer.Write(false);
            }

            // new in save format 14
            writer.Write(Expanded);
            writer.Write(Expandable);

            // new in save format 22
            writer.Write((int)selStyle);
        }