Exemplo n.º 1
0
 internal static void Map(Font font, DocumentObjectModel.Document domDocument, string domStyleName)
 {
     DocumentObjectModel.Style domStyle = domDocument.Styles[domStyleName];
     if (domStyle != null)
     {
         FontMapper mapper = new FontMapper();
         mapper.MapObject(font, domStyle.Font);
     }
 }
Exemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            ExtractorDocumentType documentType   = ExtractorDocumentType.Get(context);
            ResultsDocumentBounds documentBounds = DocumentBounds.Get(context);
            string   text         = DocumentText.Get(context);
            Document document     = DocumentObjectModel.Get(context);
            string   documentPath = DocumentPath.Get(context);

            ExtractorResult.Set(context, ComputeResult(documentType, documentBounds, text, document, documentPath));
        }
        protected override void Execute(CodeActivityContext context)
        {
            string   text         = DocumentText.Get(context);
            Document document     = DocumentObjectModel.Get(context);
            string   documentPath = DocumentPath.Get(context);

            ClassifierDocumentType[] documentTypes = DocumentTypes.Get(context);
            int evidencePage = EvidencePage.Get(context);

            ClassifierResult.Set(context, ComputeResult(text, document, documentPath, documentTypes, evidencePage));
        }
Exemplo n.º 4
0
        void MapObject(PlotArea plotArea, DocumentObjectModel.Shapes.Charts.PlotArea domPlotArea)
        {
            plotArea.BottomPadding = domPlotArea.BottomPadding.Point;
            plotArea.RightPadding = domPlotArea.RightPadding.Point;
            plotArea.LeftPadding = domPlotArea.LeftPadding.Point;
            plotArea.TopPadding = domPlotArea.TopPadding.Point;

            if (!domPlotArea.IsNull("LineFormat"))
                LineFormatMapper.Map(plotArea.LineFormat, domPlotArea.LineFormat);
            if (!domPlotArea.IsNull("FillFormat"))
                FillFormatMapper.Map(plotArea.FillFormat, domPlotArea.FillFormat);
        }
Exemplo n.º 5
0
        void MapObject(FillFormat fillFormat, DocumentObjectModel.Shapes.FillFormat domFillFormat)
        {
            if (domFillFormat.Color.IsEmpty)
                fillFormat.Color = XColor.Empty;
            else
            {
#if noCMYK
                fillFormat.Color = XColor.FromArgb((int)domFillFormat.Color.Argb);
#else
                fillFormat.Color = ColorHelper.ToXColor(domFillFormat.Color, domFillFormat.Document.UseCmykColor);
#endif
            }
            fillFormat.Visible = domFillFormat.Visible;
        }
Exemplo n.º 6
0
 void MapObject(XValues xValues, DocumentObjectModel.Shapes.Charts.XValues domXValues)
 {
     foreach (DocumentObjectModel.Shapes.Charts.XSeries domXSeries in domXValues)
     {
         XSeries xSeries = xValues.AddXSeries();
         DocumentObjectModel.Shapes.Charts.XSeriesElements domXSeriesElements = domXSeries.GetValue("XSeriesElements") as DocumentObjectModel.Shapes.Charts.XSeriesElements;
         foreach (DocumentObjectModel.Shapes.Charts.XValue domXValue in domXSeriesElements)
         {
             if (domXValue == null)
                 xSeries.AddBlank();
             else
                 xSeries.Add(domXValue.GetValue("Value").ToString());
         }
     }
 }
Exemplo n.º 7
0
        static void MapObject(Axis axis, DocumentObjectModel.Shapes.Charts.Axis domAxis)
        {
            if (!domAxis.IsNull("TickLabels.Format"))
                axis.TickLabels.Format = domAxis.TickLabels.Format;
            if (!domAxis.IsNull("TickLabels.Style"))
                FontMapper.Map(axis.TickLabels.Font, domAxis.TickLabels.Document, domAxis.TickLabels.Style);
            if (!domAxis.IsNull("TickLabels.Font"))
                FontMapper.Map(axis.TickLabels.Font, domAxis.TickLabels.Font);

            if (!domAxis.IsNull("MajorTickMark"))
                axis.MajorTickMark = (TickMarkType)domAxis.MajorTickMark;
            if (!domAxis.IsNull("MinorTickMark"))
                axis.MinorTickMark = (TickMarkType)domAxis.MinorTickMark;

            if (!domAxis.IsNull("MajorTick"))
                axis.MajorTick = domAxis.MajorTick;
            if (!domAxis.IsNull("MinorTick"))
                axis.MinorTick = domAxis.MinorTick;

            if (!domAxis.IsNull("Title"))
            {
                axis.Title.Caption = domAxis.Title.Caption;
                if (!domAxis.IsNull("Title.Style"))
                    FontMapper.Map(axis.Title.Font, domAxis.Title.Document, domAxis.Title.Style);
                if (!domAxis.IsNull("Title.Font"))
                    FontMapper.Map(axis.Title.Font, domAxis.Title.Font);
                axis.Title.Orientation = domAxis.Title.Orientation.Value;
                axis.Title.Alignment = (HorizontalAlignment)domAxis.Title.Alignment;
                axis.Title.VerticalAlignment = (VerticalAlignment)domAxis.Title.VerticalAlignment;
            }

            axis.HasMajorGridlines = domAxis.HasMajorGridlines;
            axis.HasMinorGridlines = domAxis.HasMinorGridlines;

            if (!domAxis.IsNull("MajorGridlines") && !domAxis.MajorGridlines.IsNull("LineFormat"))
                LineFormatMapper.Map(axis.MajorGridlines.LineFormat, domAxis.MajorGridlines.LineFormat);
            if (!domAxis.IsNull("MinorGridlines") && !domAxis.MinorGridlines.IsNull("LineFormat"))
                LineFormatMapper.Map(axis.MinorGridlines.LineFormat, domAxis.MinorGridlines.LineFormat);

            if (!domAxis.IsNull("MaximumScale"))
                axis.MaximumScale = domAxis.MaximumScale;
            if (!domAxis.IsNull("MinimumScale"))
                axis.MinimumScale = domAxis.MinimumScale;

            if (!domAxis.IsNull("LineFormat"))
                LineFormatMapper.Map(axis.LineFormat, domAxis.LineFormat);
        }
Exemplo n.º 8
0
        void MapObject(LineFormat lineFormat, DocumentObjectModel.Shapes.LineFormat domLineFormat)
        {
            if (domLineFormat.Color.IsEmpty)
                lineFormat.Color = XColor.Empty;
            else
            {
#if noCMYK
                lineFormat.Color = XColor.FromArgb(domLineFormat.Color.Argb);
#else
                lineFormat.Color = ColorHelper.ToXColor(domLineFormat.Color, domLineFormat.Document.UseCmykColor);
#endif
            }
            switch (domLineFormat.DashStyle)
            {
                case DocumentObjectModel.Shapes.DashStyle.Dash:
                    lineFormat.DashStyle = XDashStyle.Dash;
                    break;
                case DocumentObjectModel.Shapes.DashStyle.DashDot:
                    lineFormat.DashStyle = XDashStyle.DashDot;
                    break;
                case DocumentObjectModel.Shapes.DashStyle.DashDotDot:
                    lineFormat.DashStyle = XDashStyle.DashDotDot;
                    break;
                case DocumentObjectModel.Shapes.DashStyle.Solid:
                    lineFormat.DashStyle = XDashStyle.Solid;
                    break;
                case DocumentObjectModel.Shapes.DashStyle.SquareDot:
                    lineFormat.DashStyle = XDashStyle.Dot;
                    break;
                default:
                    lineFormat.DashStyle = XDashStyle.Solid;
                    break;
            }
            switch (domLineFormat.Style)
            {
                case DocumentObjectModel.Shapes.LineStyle.Single:
                    lineFormat.Style = LineStyle.Single;
                    break;
            }
            lineFormat.Visible = domLineFormat.Visible;
            if (domLineFormat.IsNull("Visible"))
                lineFormat.Visible = true;
            lineFormat.Width = domLineFormat.Width.Point;
        }
Exemplo n.º 9
0
        void MapObject(Font font, DocumentObjectModel.Font domFont)
        {
            font.Bold = domFont.Bold;
            if (domFont.Color.IsEmpty)
                font.Color = XColor.Empty;
            else
            {
#if noCMYK
                font.Color = XColor.FromArgb((int)domFont.Color.Argb);
#else
                font.Color = ColorHelper.ToXColor(domFont.Color, domFont.Document.UseCmykColor);
#endif
            }
            font.Italic = domFont.Italic;
            if (!domFont.IsNull("Name"))
                font.Name = domFont.Name;
            if (!domFont.IsNull("Size"))
                font.Size = domFont.Size.Point;
            font.Subscript = domFont.Subscript;
            font.Superscript = domFont.Superscript;
            font.Underline = (Underline)domFont.Underline;
        }
Exemplo n.º 10
0
 internal static void Map(FillFormat fillFormat, DocumentObjectModel.Shapes.FillFormat domFillFormat)
 {
     FillFormatMapper mapper = new FillFormatMapper();
     mapper.MapObject(fillFormat, domFillFormat);
 }
Exemplo n.º 11
0
 internal static void Map(PlotArea plotArea, DocumentObjectModel.Shapes.Charts.PlotArea domPlotArea)
 {
     PlotAreaMapper mapper = new PlotAreaMapper();
     mapper.MapObject(plotArea, domPlotArea);
 }
Exemplo n.º 12
0
        void MapObject(Chart chart, DocumentObjectModel.Shapes.Charts.Chart domChart)
        {
            DocumentObjectModel.Shapes.Charts.Legend domLegend = null;
            DocumentObjectModel.Shapes.Charts.TextArea textArea = null;

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.BottomArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Bottom;
                    domLegend = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea = domChart.BottomArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.RightArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Right;
                    domLegend = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea = domChart.RightArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.LeftArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Left;
                    domLegend = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea = domChart.LeftArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.TopArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Top;
                    domLegend = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea = domChart.TopArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.HeaderArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Top;
                    domLegend = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea = domChart.HeaderArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.FooterArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = DockingType.Bottom;
                    domLegend = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea = domChart.FooterArea;
                }
            }

            if (domLegend != null)
            {
                if (!domLegend.IsNull("LineFormat"))
                    LineFormatMapper.Map(chart.Legend.LineFormat, domLegend.LineFormat);
                if (!textArea.IsNull("Style"))
                    FontMapper.Map(chart.Legend.Font, textArea.Document, textArea.Style);
                if (!domLegend.IsNull("Format.Font"))
                    FontMapper.Map(chart.Legend.Font, domLegend.Format.Font);
            }
        }
Exemplo n.º 13
0
 internal static void Map(Chart chart, DocumentObjectModel.Shapes.Charts.Chart domChart)
 {
     LegendMapper mapper = new LegendMapper();
     mapper.MapObject(chart, domChart);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Maps the specified DOM chart.
 /// </summary>
 /// <param name="domChart">The DOM chart.</param>
 /// <returns></returns>
 public static ChartFrame Map(DocumentObjectModel.Shapes.Charts.Chart domChart)
 {
     ChartMapper mapper = new ChartMapper();
     return mapper.MapObject(domChart);
 }
Exemplo n.º 15
0
 internal static void Map(Font font, DocumentObjectModel.Font domFont)
 {
     FontMapper mapper = new FontMapper();
     mapper.MapObject(font, domFont);
 }
Exemplo n.º 16
0
 internal static void Map(LineFormat lineFormat, DocumentObjectModel.Shapes.LineFormat domLineFormat)
 {
     LineFormatMapper mapper = new LineFormatMapper();
     mapper.MapObject(lineFormat, domLineFormat);
 }
Exemplo n.º 17
0
 internal static void Map(Axis axis, DocumentObjectModel.Shapes.Charts.Axis domAxis)
 {
     AxisMapper mapper = new AxisMapper();
     MapObject(axis, domAxis);
 }
Exemplo n.º 18
0
 internal static void Map(SeriesCollection seriesCollection, DocumentObjectModel.Shapes.Charts.SeriesCollection domSeriesCollection)
 {
     SeriesCollectionMapper mapper = new SeriesCollectionMapper();
     mapper.MapObject(seriesCollection, domSeriesCollection);
 }
Exemplo n.º 19
0
 internal static void Map(XValues xValues, DocumentObjectModel.Shapes.Charts.XValues domXValues)
 {
     XValuesMapper mapper = new XValuesMapper();
     mapper.MapObject(xValues, domXValues);
 }
Exemplo n.º 20
0
        void MapObject(SeriesCollection seriesCollection, DocumentObjectModel.Shapes.Charts.SeriesCollection domSeriesCollection)
        {
            foreach (DocumentObjectModel.Shapes.Charts.Series domSeries in domSeriesCollection)
            {
                Series series = seriesCollection.AddSeries();
                series.Name = domSeries.Name;

                if (domSeries.IsNull("ChartType"))
                {
                    DocumentObjectModel.Shapes.Charts.Chart chart = (DocumentObjectModel.Shapes.Charts.Chart)DocumentObjectModel.DocumentRelations.GetParentOfType(domSeries, typeof(DocumentObjectModel.Shapes.Charts.Chart));
                    series.ChartType = (ChartType)chart.Type;
                }
                else
                    series.ChartType = (ChartType)domSeries.ChartType;

                if (!domSeries.IsNull("DataLabel"))
                    DataLabelMapper.Map(series.DataLabel, domSeries.DataLabel);
                if (!domSeries.IsNull("LineFormat"))
                    LineFormatMapper.Map(series.LineFormat, domSeries.LineFormat);
                if (!domSeries.IsNull("FillFormat"))
                    FillFormatMapper.Map(series.FillFormat, domSeries.FillFormat);

                series.HasDataLabel = domSeries.HasDataLabel;
                if (domSeries.MarkerBackgroundColor.IsEmpty)
                    series.MarkerBackgroundColor = XColor.Empty;
                else
                {
#if noCMYK
          series.MarkerBackgroundColor = XColor.FromArgb(domSeries.MarkerBackgroundColor.Argb);
#else
                    series.MarkerBackgroundColor =
                      ColorHelper.ToXColor(domSeries.MarkerBackgroundColor, domSeries.Document.UseCmykColor);
#endif
                }
                if (domSeries.MarkerForegroundColor.IsEmpty)
                    series.MarkerForegroundColor = XColor.Empty;
                else
                {
#if noCMYK
          series.MarkerForegroundColor = XColor.FromArgb(domSeries.MarkerForegroundColor.Argb);
#else
                    series.MarkerForegroundColor =
                      ColorHelper.ToXColor(domSeries.MarkerForegroundColor, domSeries.Document.UseCmykColor);
#endif
                }
                series.MarkerSize = domSeries.MarkerSize.Point;
                if (!domSeries.IsNull("MarkerStyle"))
                    series.MarkerStyle = (MarkerStyle)domSeries.MarkerStyle;

                foreach (DocumentObjectModel.Shapes.Charts.Point domPoint in domSeries.Elements)
                {
                    if (domPoint != null)
                    {
                        Point point = series.Add(domPoint.Value);
                        FillFormatMapper.Map(point.FillFormat, domPoint.FillFormat);
                        LineFormatMapper.Map(point.LineFormat, domPoint.LineFormat);
                    }
                    else
                        series.Add(double.NaN);
                }
            }
        }
Exemplo n.º 21
-2
        private ChartFrame MapObject(DocumentObjectModel.Shapes.Charts.Chart domChart)
        {
            ChartFrame chartFrame = new ChartFrame();
            chartFrame.Size = new XSize(domChart.Width.Point, domChart.Height.Point);
            chartFrame.Location = new XPoint(domChart.Left.Position.Point, domChart.Top.Position.Point);

            Chart chart = new Chart((ChartType)domChart.Type);

            if (!domChart.IsNull("XAxis"))
                AxisMapper.Map(chart.XAxis, domChart.XAxis);
            if (!domChart.IsNull("YAxis"))
                AxisMapper.Map(chart.YAxis, domChart.YAxis);

            PlotAreaMapper.Map(chart.PlotArea, domChart.PlotArea);

            SeriesCollectionMapper.Map(chart.SeriesCollection, domChart.SeriesCollection);

            LegendMapper.Map(chart, domChart);

            chart.DisplayBlanksAs = (BlankType)domChart.DisplayBlanksAs;
            chart.HasDataLabel = domChart.HasDataLabel;
            if (!domChart.IsNull("DataLabel"))
                DataLabelMapper.Map(chart.DataLabel, domChart.DataLabel);

            if (!domChart.IsNull("Style"))
                FontMapper.Map(chart.Font, domChart.Document, domChart.Style);
            if (!domChart.IsNull("Format.Font"))
                FontMapper.Map(chart.Font, domChart.Format.Font);
            if (!domChart.IsNull("XValues"))
                XValuesMapper.Map(chart.XValues, domChart.XValues);

            chartFrame.Add(chart);
            return chartFrame;
        }