Пример #1
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public EditorProject()
 {
     bool ActionState = ActionManager.Instance.Disabled;
     ActionManager.Instance.Disabled = true;
     reportPage = (ReportPage)EditorItemFactory.Instance.CreateItem(typeof(ReportPage));
     ActionManager.Instance.Disabled = ActionState;
     isContainer = true;
     Children.Add(reportPage);
 }
Пример #2
0
        /// <summary>
        /// Load item from node
        /// </summary>
        /// <param name="itemNode"></param>
        private void LoadItem(XmlNode itemNode)
        {
            string itemType = "";

            if (itemNode.Attributes.Count > 0)
            {
                itemType = itemNode.Attributes["Type"].Value;
                EditorItem newItem = ReportPage.CreateItemFromType(itemType);
                //newItem.Parent = this;
                newItem.Load(itemNode);
                newItem.Parent = this;
                //Children.Add(newItem);
            }
        }
Пример #3
0
        public override void Load(System.Xml.XmlNode element)
        {
            base.Load(element);

            UnitsManager unitMng = new UnitsManager();

            // Load info
            XmlNode node = element.SelectSingleNode("Info");

            if (node != null)
            {
                this.Description = node.Attributes["Description"].Value;
            }

            // Load page size
            node = element.SelectSingleNode("Size");
            if (node != null)
            {
                MeasureUnit   = unitMng.StringToUnit(node.Attributes["Width"].Value);
                WidthInUnits  = (float)(System.Convert.ToDouble(node.Attributes["Width"].Value.TrimEnd(unitMng.UnitToString(MeasureUnit).ToCharArray())));
                HeightInUnits = (float)(System.Convert.ToDouble(node.Attributes["Height"].Value.TrimEnd(unitMng.UnitToString(MeasureUnit).ToCharArray())));
            }
            else
            {
                // set default sizes
                MeasureUnit    = MeasureUnits.cm;
                WidthInUnits   = (float)unitMng.ConvertUnit(19, MeasureUnits.cm, MeasureUnits.point);
                HeightInPixels = (float)unitMng.ConvertUnit(21, MeasureUnits.cm, MeasureUnits.point);
            }

            // Load fill color
            node = element.SelectSingleNode("FillColor");
            if (node != null)
            {
                try
                {
                    int r = Convert.ToInt32(node.Attributes["R"].Value);
                    int g = Convert.ToInt32(node.Attributes["G"].Value);
                    int b = Convert.ToInt32(node.Attributes["B"].Value);
                    int a = Convert.ToInt32(node.Attributes["A"].Value);
                    this.FillColor = Color.FromArgb(a, r, g, b);
                }
                catch { }
            }

            // Load BackgroundImageName
            node = element.SelectSingleNode("BackgroundImage");
            if (node != null)
            {
                this.imageName = node.Attributes["Name"].Value;
            }

            // load embedded image if available
            node = element.SelectSingleNode("EmbeddedImage");
            if (node != null)
            {
                if (node.InnerText != null && node.InnerText.Length > 0)
                {
                    this.imageData    = Convert.FromBase64String(node.InnerText);
                    pictureForDisplay = Bitmap.FromStream(new MemoryStream(this.imageData));
                }
            }



            // Load none balloons items
            node = element.SelectSingleNode("Items");
            if (node != null)
            {
                foreach (XmlNode childNode in node.ChildNodes)
                {
                    if (childNode.Name == "Item")
                    {
                        // this is not valid for generator but this can be loaded into editor
                        string     itemType = childNode.Attributes["Type"].Value;
                        EditorItem newItem  = ReportPage.CreateItemFromType(itemType);
                        newItem.Load(childNode);
                        newItem.Parent = this;
                        //Children.Add(newItem);
                    }
                }
            }


            // Load balloons
            node = element.SelectSingleNode("Balloons");
            if (node != null)
            {
                foreach (XmlNode balloonNode in node.ChildNodes)
                {
                    if (balloonNode.Name == "Balloon")
                    {
                        string tmpType;
                        tmpType = balloonNode.Attributes["Type"].Value;
                        if (tmpType == "Static")
                        {
                            StaticBalloon child = new StaticBalloon();
                            //child.Parent = this;
                            child.Load(balloonNode);
                            child.Parent = this;
                            //Children.Add(child);
                        }
                        else if (tmpType == "Dynamic")
                        {
                            DynamicBalloon child = new DynamicBalloon();
                            //child.Parent = this;
                            child.Load(balloonNode);
                            child.Parent = this;
                            //Children.Add(child);
                        }
                    }
                    else if (balloonNode.Name == "Item")
                    {
                        // this is not valid for generator but this can be loaded into editor
                        string     itemType = balloonNode.Attributes["Type"].Value;
                        EditorItem newItem  = ReportPage.CreateItemFromType(itemType);
                        newItem.Load(balloonNode);
                        newItem.Parent = this;
                        //Children.Add(newItem);
                    }
                }
            }
        }
Пример #4
0
 public ReportPageViewer(ReportPage owner)
 {
     this.owner = owner;
 }
Пример #5
0
 public void SetPreviewListActive(bool active)
 {
     if(active)
     {
         sourceReportPage = ReportPage; // save current report page
         this.reportPage = (ReportPage)sourceReportPage.SimpleClone();  // report page is now emtpy clone that has no children and ready to be used by generator
     }
     else
     {
         this.reportPage = sourceReportPage; // restore page to what was saved
     }
 }
Пример #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="position"></param>
 public Ruler(RulerPosition position, ReportPage reportPage)
 {
     this.position = position;
     this.reportPage = reportPage;
 }
Пример #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="position"></param>
 public Ruler(RulerPosition position, ReportPage reportPage)
 {
     this.position   = position;
     this.reportPage = reportPage;
 }
Пример #8
0
        /// <summary>
        /// Write balloon, make its coordinates and draw all child items like static texts, dynamic texts, etc.        /// 
        /// </summary>
        /// <param name="balloon">current ballon that should be used as template for creating new one</param>
        /// <param name="page">current page</param>
        /// <param name="parentBalloon">parent ballon in which this new one should be stored</param>
        /// <param name="isStaticBalloon">is new ballon of static type, meaning that it will be placed where put</param>
        /// <param name="level">just level of recursion parameter</param>
        /// <param name="drawChildren">should this method draw items in ballon or just allocate space</param>
        /// <param name="staticBottomDockedFlag">This flag is set if this should create static Bottom docked balloon</param>
        /// <returns>newly created balloon that should be placed on page</returns>
        Balloon WriteBalloon(Balloon balloon, ReportPage page, Balloon parentBalloon, 
            bool isStaticBalloon, bool drawChildren, bool staticBottomDockedFlag,
            int level)
        {
            string logTab = "";
            for (int i = 0; i < level; i++)
            {
                logTab += "\t";
            }

            Loger.LogMessage(logTab + "WriteBalloon Begin");

            StaticBalloon newStaticBalloon;
            DynamicBalloon newDynamicBalloon;
            UnitsManager unitConverter;

            unitConverter = UnitsManager.Instance;

            // if this balloon is static then place it exactly where it should go
            if (isStaticBalloon)
            {
                newStaticBalloon = (StaticBalloon)CreateNewBalloon(balloon, page, parentBalloon, isStaticBalloon);

                // we don't check if static balloons fall inside parents as they should always be included. Just allocate space for it in parent
                if(parentBalloon != null)
                {
                    parentBalloon.AddChild(newStaticBalloon, true, false);
                    if (drawChildren)
                    {
                        AddNonBalloonChildren(balloon, newStaticBalloon);
                    }
                }
                else
                {
                    page.AddChild(newStaticBalloon, true, false);
                    if (drawChildren)
                    {
                        AddNonBalloonChildren(balloon, newStaticBalloon);
                    }
                }

                Loger.LogMessage(logTab + "WriteBalloon End - return static balloon");
                return newStaticBalloon;
            }
            else
            {
                newDynamicBalloon = (DynamicBalloon)CreateNewBalloon(balloon, page, parentBalloon, isStaticBalloon);

                // in case of dynamic balloons we do next thing
                if(parentBalloon != null)
                {
                    if(!parentBalloon.AddChild(newDynamicBalloon, false, staticBottomDockedFlag))
                    {
                        Loger.LogMessage(logTab + "WriteBalloon End - return NULL - AddChild failed when Parent balloon != null");
                        return null;
                    }
                    else
                    {
                        if (drawChildren)
                        {
                            AddNonBalloonChildren(balloon, newDynamicBalloon);
                        }
                    }
                }
                else
                {
                    //newDynamicBalloon.Parent = EditorController.Instance.EditorProject.ReportPage;
                    //EditorController.Instance.EditorProject.PreviewList.Add(newDynamicBalloon);
                    if(!page.AddChild(newDynamicBalloon, false, false))
                    {
                        Loger.LogMessage(logTab + "WriteBalloon End - return NULL - AddChild failed when Parent balloon == null");
                        return null;
                    }
                    else
                    {
                        if (drawChildren)
                        {
                            AddNonBalloonChildren(balloon, newDynamicBalloon);
                        }
                    }
                }

                Loger.LogMessage(logTab + "WriteBalloon End - return dynamic balloon");
                return newDynamicBalloon;
            }

            //return null;
            // 4.    Make balloon graphically.
            // 5.    For each item in balloon
            // 6.      Process each item and request data when needed by using RequestDataCallback
            // 7.    End
            // do static balloon logic. Static balloons are placed where specified and have static dimensions
        }
Пример #9
0
        /// <summary>
        /// This will create new Balloon object based from Balloon information. 
        /// </summary>
        /// <param name="balloon">Original from what new should be created</param>
        /// <param name="page">Current page</param>
        /// <param name="parentBalloon">parent balloon that is generated</param>
        /// <param name="isStatic">If new balloon should be created as StaticBalloon</param>
        /// <param name="level">level of recursion, for logging purposes</param>
        /// <returns></returns>
        Balloon CreateNewBalloon(Balloon balloon, ReportPage page, Balloon parentBalloon, bool isStatic)
        {
            if (isStatic)
            {
                StaticBalloon newStaticBalloon = new StaticBalloon();
                newStaticBalloon.TemplateBalloon = balloon;
                newStaticBalloon.LocationInUnitsX = balloon.LocationInUnitsX;
                newStaticBalloon.LocationInUnitsY = balloon.LocationInUnitsY;

                newStaticBalloon.WidthInPixels = balloon.GetFitToContentWidthInPixels();
                newStaticBalloon.HeightInPixels = balloon.GetFitToContentHeightInPixels();

                newStaticBalloon.zoomLevel = balloon.zoomLevel;
                newStaticBalloon.sourceBallon = balloon;
                newStaticBalloon.Disabled = true;
                newStaticBalloon.CanGrow = balloon.DockPosition == EditorItem.DockingPosition.DOCK_BOTTOM ? false : balloon.CanGrow;
                newStaticBalloon.Borders = balloon.Borders;
                newStaticBalloon.FillCapacity = balloon.FillCapacity;
                newStaticBalloon.AvailableOnEveryPage = balloon.AvailableOnEveryPage;
                newStaticBalloon.FillingGeneratesNew = balloon.FillingGeneratesNew;
                newStaticBalloon.FitToContent = balloon.FitToContent;
                newStaticBalloon.FillColor = balloon.FillColor;
                newStaticBalloon.MeasureUnit = balloon.MeasureUnit;

                float relLocationX = balloon.LocationInPixelsX; //unitConverter.ConvertUnit(balloon.LocationInUnitsX, balloon.MeasureUnit, MeasureUnits.point);
                float relLocationY = balloon.LocationInPixelsY; //unitConverter.ConvertUnit(balloon.LocationInUnitsY, balloon.MeasureUnit, MeasureUnits.point);
                float width = balloon.GetFitToContentWidthInPixels();
                float height = balloon.GetFitToContentHeightInPixels();

                newStaticBalloon.containerRect.left = relLocationX;
                newStaticBalloon.containerRect.bottom = relLocationY + height;
                newStaticBalloon.containerRect.right = relLocationX + width;
                newStaticBalloon.containerRect.top = relLocationY;
                newStaticBalloon.positionRect.top = relLocationY;
                newStaticBalloon.positionRect.left = relLocationX;
                return newStaticBalloon;
            }
            else
            {
                DynamicBalloon newDynamicBalloon = new DynamicBalloon();
                newDynamicBalloon.FillColor = balloon.FillColor;
                newDynamicBalloon.TemplateBalloon = balloon;
                newDynamicBalloon.LocationInUnitsX = balloon.LocationInUnitsX;
                newDynamicBalloon.LocationInUnitsY = balloon.LocationInUnitsY;
                newDynamicBalloon.zoomLevel = balloon.zoomLevel;
                newDynamicBalloon.sourceBallon = balloon;
                newDynamicBalloon.Disabled = true;
                newDynamicBalloon.FitToContent = balloon.FitToContent;
                newDynamicBalloon.CanGrow = balloon.CanGrow;
                newDynamicBalloon.Borders = balloon.Borders;
                newDynamicBalloon.FillCapacity = balloon.FillCapacity;
                newDynamicBalloon.AvailableOnEveryPage = balloon.AvailableOnEveryPage;
                newDynamicBalloon.FillingGeneratesNew = balloon.FillingGeneratesNew;
                newDynamicBalloon.MeasureUnit = balloon.MeasureUnit;

                newDynamicBalloon.WidthInPixels = balloon.GetFitToContentWidthInPixels();
                newDynamicBalloon.HeightInPixels = balloon.GetFitToContentHeightInPixels();
                newDynamicBalloon.positionRect.top = balloon.LocationInPixelsY;
                newDynamicBalloon.positionRect.left = balloon.LocationInPixelsX;
                return newDynamicBalloon;
            }
            return null;
        }
Пример #10
0
 public ReportPageViewer(ReportPage owner)
 {
     this.owner = owner;
 }