Пример #1
0
 /// <summary>
 /// Set an inner shadow of the picture.
 /// </summary>
 /// <param name="ThemeColor">The theme color used for the inner shadow.</param>
 /// <param name="Tint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
 /// <param name="Transparency">Transparency of the shadow color ranging from 0% to 100%. Accurate to 1/1000 of a percent.</param>
 /// <param name="Blur">Shadow blur, ranging from 0 pt to 2147483647 pt (but consider a maximum of 100 pt). Accurate to 1/12700 of a point. Default value is 0 pt.</param>
 /// <param name="Angle">Angle of shadow projection based on picture, ranging from 0 degrees to 359.9 degrees. 0 degrees means the shadow is to the right of the picture, 90 degrees means it's below, 180 degrees means it's to the left and 270 degrees means it's above. Accurate to 1/60000 of a degree. Default value is 0 degrees.</param>
 /// <param name="Distance">Distance of shadow away from picture, ranging from 0 pt to 2147483647 pt (but consider a maximum of 200 pt). Accurate to 1/12700 of a point. Default value is 0 pt.</param>
 public void SetInnerShadow(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal Blur, decimal Angle, decimal Distance)
 {
     this.HasInnerShadow = true;
     this.PictureInnerShadow = this.FormInnerShadow(true, new System.Drawing.Color(), ThemeColor, Tint, Transparency, Blur, Angle, Distance);
 }
Пример #2
0
 private static void ModifyPowerPointParagraphTextContent(OXD.Paragraph paragraph, string txt)
 {
     if (null != paragraph)
     {
         OXD.Run run = paragraph.Descendants<OXD.Run>().FirstOrDefault();
         if (null != run)
         {
             OXD.Run final_run = run.CloneNode(true) as OXD.Run;
             OXD.Text text = final_run.Descendants<OXD.Text>().FirstOrDefault();
             OXD.Text final_text = (null == text ? new OXD.Text() : text.CloneNode(true) as OXD.Text);
             final_text.Text = txt;
             try
             { final_run.ReplaceChild<OXD.Text>(final_text, text); }
             catch
             { throw; }
             ReplaceWordRun(paragraph, run, final_run);
         }
         else
         {
             run = new OXD.Run();
         }
     }
 }
Пример #3
0
 private static void RemoveLastGridColumn(OXD.TableGrid tableGrid)
 {
     var lastColumn = tableGrid.Descendants<OXD.GridColumn>().Last();
     tableGrid.RemoveChild<OXD.GridColumn>(lastColumn);
 }
Пример #4
0
 public void SetPerspectiveShadow(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal HorizontalRatio, decimal VerticalRatio, decimal HorizontalSkew, decimal VerticalSkew, decimal Blur, decimal Angle, decimal Distance, A.RectangleAlignmentValues Alignment, bool RotateWithPicture)
 {
     this.Shadow.IsInnerShadow = false;
     this.Shadow.SetShadowColor(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, Transparency);
     this.Shadow.Transparency = Transparency;
     this.Shadow.OuterShadowHorizontalRatio = HorizontalRatio;
     this.Shadow.OuterShadowVerticalRatio = VerticalRatio;
     this.Shadow.OuterShadowHorizontalSkew = HorizontalSkew;
     this.Shadow.OuterShadowVerticalSkew = VerticalSkew;
     this.Shadow.OuterShadowBlurRadius = Blur;
     this.Shadow.Angle = Angle;
     this.Shadow.OuterShadowDistance = Distance;
     this.Shadow.OuterShadowAlignment = Alignment;
     this.Shadow.OuterShadowRotateWithShape = RotateWithPicture;
 }
Пример #5
0
 private static void AddNewGridColumn(OXD.TableGrid tableGrid, OXD.TableRow headerRow, OXD.TableRow contentRow)
 {
     var columns = tableGrid.Descendants<OXD.GridColumn>();
     if (null != columns && columns.Any())
     {
         var headerLastCell = headerRow.Descendants<OXD.TableCell>().Last();
         var contentLastCell = contentRow.Descendants<OXD.TableCell>().Last();
         double tableWidth = columns.Sum(_ => Convert.ToInt32(_.Width.Value));
         var newColWidth = Math.Floor(tableWidth / columns.Count());
         foreach (var col in columns)
         {
             col.Width = col.Width > 0 ? Convert.ToInt64(Math.Floor((tableWidth - newColWidth) / (tableWidth / col.Width))) : 0;
         }
         tableGrid.InsertAfter<OXD.GridColumn>(new OXD.GridColumn() { Width = Convert.ToInt64(newColWidth) }, columns.Last());
         headerRow.InsertAfter<OXD.TableCell>((OXD.TableCell)headerLastCell.CloneNode(true), headerLastCell);
         contentRow.InsertAfter<OXD.TableCell>((OXD.TableCell)contentLastCell.CloneNode(true), contentLastCell);
     }
 }
Пример #6
0
 public void SetInnerShadow(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal Blur, decimal Angle, decimal Distance)
 {
     this.Shadow.IsInnerShadow = true;
     this.Shadow.SetShadowColor(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, Transparency);
     this.Shadow.Transparency = Transparency;
     this.Shadow.InnerShadowBlurRadius = Blur;
     this.Shadow.Angle = Angle;
     this.Shadow.InnerShadowDistance = Distance;
 }
Пример #7
0
 public void SetOuterShadow(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal Size, decimal Blur, decimal Angle, decimal Distance, A.RectangleAlignmentValues Alignment, bool RotateWithPicture)
 {
     this.Shadow.IsInnerShadow = false;
     this.Shadow.SetShadowColor(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, Transparency);
     this.Shadow.Transparency = Transparency;
     this.Shadow.Size = Size;
     this.Shadow.OuterShadowBlurRadius = Blur;
     this.Shadow.Angle = Angle;
     this.Shadow.OuterShadowDistance = Distance;
     this.Shadow.OuterShadowAlignment = Alignment;
     this.Shadow.OuterShadowRotateWithShape = RotateWithPicture;
 }
		/// <summary>
		/// Gets if this run is underlined or not
		/// </summary>
		/// <param name="run">Run of interest</param>
		/// <returns>True if it is underlined, false otherwise</returns>
		private bool IsRunUnderlined(Drawing.Run run)
		{
			var runProperty = run.Descendants<Drawing.RunProperties>().FirstOrDefault();
			return runProperty.Underline != null
				&& runProperty.Underline.Value != Drawing.TextUnderlineValues.None;
		}
		/// <summary>
		/// Gets if this run is Strike-through or not
		/// </summary>
		/// <param name="run">Run of interest</param>
		/// <returns>True if it is strike-through, false otherwise</returns>
		private bool IsRunStrikeThrough(Drawing.Run run)
		{
			var runProperty = run.Descendants<Drawing.RunProperties>().FirstOrDefault();
			return runProperty.Strike != null 
				&& runProperty.Strike.Value != Drawing.TextStrikeValues.NoStrike;
		}
Пример #10
0
 /// <summary>
 /// Set a pattern fill with a preset pattern, foreground color and background color.
 /// </summary>
 /// <param name="PresetPattern">A preset fill pattern.</param>
 /// <param name="ForegroundColorTheme">The theme color to be used for the foreground.</param>
 /// <param name="ForegroundColorTint">The tint applied to the foreground theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
 /// <param name="BackgroundColorTheme">The theme color to be used for the background.</param>
 /// <param name="BackgroundColorTint">The tint applied to the background theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
 public void SetPatternFill(A.PresetPatternValues PresetPattern, SLThemeColorIndexValues ForegroundColorTheme, double ForegroundColorTint, SLThemeColorIndexValues BackgroundColorTheme, double BackgroundColorTint)
 {
     this.Type = SLFillType.PatternFill;
     this.PatternPreset = PresetPattern;
     this.PatternForegroundColor.SetColor(ForegroundColorTheme, ForegroundColorTint, 0);
     this.PatternBackgroundColor.SetColor(BackgroundColorTheme, BackgroundColorTint, 0);
 }
		/// <summary>
		/// Gets if this run is italic or not
		/// </summary>
		/// <param name="run">Run of interest</param>
		/// <returns>True if it is italic, false otherwise</returns>
		private bool IsRunItalic(Drawing.Run run)
		{
			var runProperty = run.Descendants<Drawing.RunProperties>().FirstOrDefault();
			return runProperty.Italic != null && runProperty.Italic.Value;
		}
Пример #12
0
 /// <summary>
 /// Set a pattern fill with a preset pattern, foreground color and background color.
 /// </summary>
 /// <param name="PresetPattern">A preset fill pattern.</param>
 /// <param name="ForegroundColorTheme">The theme color to be used for the foreground.</param>
 /// <param name="BackgroundColor">The color to be used for the background.</param>
 public void SetPatternFill(A.PresetPatternValues PresetPattern, SLThemeColorIndexValues ForegroundColorTheme, System.Drawing.Color BackgroundColor)
 {
     this.Type = SLFillType.PatternFill;
     this.PatternPreset = PresetPattern;
     this.PatternForegroundColor.SetColor(ForegroundColorTheme, 0, 0);
     this.PatternBackgroundColor.SetColor(BackgroundColor, 0);
 }
Пример #13
0
 /// <summary>
 /// Set a picture fill. This tiles the picture.
 /// </summary>
 /// <param name="PictureFileName">The file name of the image/picture used.</param>
 /// <param name="OffsetX">Horizontal offset ranging from -2147483648 pt to 2147483647 pt. However a suggested range is -1585pt to 1584pt. Accurate to 1/12700 of a point.</param>
 /// <param name="OffsetY">Vertical offset ranging from -2147483648 pt to 2147483647 pt. However a suggested range is -1585pt to 1584pt. Accurate to 1/12700 of a point.</param>
 /// <param name="ScaleX">Horizontal scale in percentage. A suggested range is 0% to 100%.</param>
 /// <param name="ScaleY">Vertical scale in percentage. A suggested range is 0% to 100%.</param>
 /// <param name="Alignment">Picture alignment.</param>
 /// <param name="MirrorType">Picture mirror type.</param>
 /// <param name="Transparency">Transparency of the picture ranging from 0% to 100%. Accurate to 1/1000 of a percent.</param>
 public void SetPictureFill(string PictureFileName, decimal OffsetX, decimal OffsetY, decimal ScaleX, decimal ScaleY, A.RectangleAlignmentValues Alignment, A.TileFlipValues MirrorType, decimal Transparency)
 {
     this.Type = SLFillType.BlipFill;
     this.BlipTile = true;
     this.BlipFileName = PictureFileName;
     this.BlipOffsetX = OffsetX;
     this.BlipOffsetY = OffsetY;
     this.BlipScaleX = ScaleX;
     this.BlipScaleY = ScaleY;
     this.BlipAlignment = Alignment;
     this.BlipMirrorType = MirrorType;
     this.BlipTransparency = Transparency;
 }
Пример #14
0
        private A.OuterShadow FormOuterShadow(bool UseThemeColour, System.Drawing.Color ShadowColor, A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal Blur, decimal Angle, decimal Distance, decimal HorizontalRatio, decimal VerticalRatio, decimal HorizontalSkew, decimal VerticalSkew, A.RectangleAlignmentValues Alignment, bool RotateWithPicture)
        {
            A.OuterShadow outershadow = new A.OuterShadow();
            outershadow.BlurRadius = SLDrawingTool.CalculatePositiveCoordinate(Blur);
            // default is 0
            if (outershadow.BlurRadius.Value == 0) outershadow.BlurRadius = null;

            outershadow.Distance = SLDrawingTool.CalculatePositiveCoordinate(Distance);
            // default is 0
            if (outershadow.Distance.Value == 0) outershadow.Distance = null;

            outershadow.Direction = SLDrawingTool.CalculatePositiveFixedAngle(Angle);
            // default is 0
            if (outershadow.Direction.Value == 0) outershadow.Direction = null;

            outershadow.HorizontalRatio = SLDrawingTool.CalculatePercentage(HorizontalRatio);
            // default is 100000
            if (outershadow.HorizontalRatio.Value == 100000) outershadow.HorizontalRatio = null;

            outershadow.VerticalRatio = SLDrawingTool.CalculatePercentage(VerticalRatio);
            // default is 100000
            if (outershadow.VerticalRatio.Value == 100000) outershadow.VerticalRatio = null;

            outershadow.HorizontalSkew = SLDrawingTool.CalculateFixedAngle(HorizontalSkew);
            // default is 0
            if (outershadow.HorizontalSkew.Value == 0) outershadow.HorizontalSkew = null;

            outershadow.VerticalSkew = SLDrawingTool.CalculateFixedAngle(VerticalSkew);
            // default is 0
            if (outershadow.VerticalSkew.Value == 0) outershadow.VerticalSkew = null;

            // default is Bottom (b)
            if (Alignment != A.RectangleAlignmentValues.Bottom)
            {
                outershadow.Alignment = Alignment;
            }

            // default is true
            if (!RotateWithPicture)
            {
                outershadow.RotateWithShape = false;
            }

            if (!UseThemeColour)
            {
                outershadow.RgbColorModelHex = this.FormRgbColorModelHex(ShadowColor, Transparency);
            }
            else
            {
                outershadow.SchemeColor = this.FormSchemeColor(ThemeColor, Tint, Transparency);
            }

            return outershadow;
        }
Пример #15
0
 public void Set3DScene(A.PresetCameraValues CameraPreset, decimal FieldOfView, decimal Zoom, decimal CameraLatitude, decimal CameraLongitude, decimal CameraRevolution, A.LightRigValues LightRigType, A.LightRigDirectionValues LightRigDirection, decimal LightRigLatitude, decimal LightRigLongitude, decimal LightRigRevolution)
 {
     this.Rotation3D.CameraPreset = CameraPreset;
     this.Rotation3D.Perspective = FieldOfView;
     // no zoom
     this.Rotation3D.Y = CameraLatitude;
     this.Rotation3D.X = CameraLongitude;
     this.Rotation3D.Z = CameraRevolution;
     this.Format3D.Lighting = LightRigType;
     // no light direction, latitude, longitude
     this.Format3D.Angle = LightRigRevolution;
 }
		/// <summary>
		/// Gets the size of the text in the given run
		/// </summary>
		/// <param name="run">Run of interest</param>
		/// <returns>Size of the font in points,
		/// default is 11.0pt</returns>
		private string RunFontSize(Drawing.Run run)
		{
			var runProperty = run.Descendants<Drawing.RunProperties>().FirstOrDefault();
			if (runProperty.FontSize != null)
				return String.Format("{0:0.0}pt", runProperty.FontSize.Value / 100.0);
			else
				return "11.0pt";
		}
Пример #17
0
 public void SetGlow(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal GlowRadius)
 {
     this.Glow.SetGlow(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, Transparency, GlowRadius);
 }
Пример #18
0
 public void SetSolidFill(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency)
 {
     this.Fill.SetSolidFill(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, Transparency);
 }
Пример #19
0
 public void SetOuterShadow(System.Drawing.Color ShadowColor, decimal Transparency, decimal Size, decimal Blur, decimal Angle, decimal Distance, A.RectangleAlignmentValues Alignment, bool RotateWithPicture)
 {
     this.Shadow.IsInnerShadow = false;
     this.Shadow.SetShadowColor(ShadowColor, Transparency);
     this.Shadow.Transparency = Transparency;
     this.Shadow.Size = Size;
     this.Shadow.OuterShadowBlurRadius = Blur;
     this.Shadow.Angle = Angle;
     this.Shadow.OuterShadowDistance = Distance;
     this.Shadow.OuterShadowAlignment = Alignment;
     this.Shadow.OuterShadowRotateWithShape = RotateWithPicture;
 }
Пример #20
0
 public void SetSolidOutline(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency)
 {
     this.Line.SetSolidLine(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, Transparency);
 }
Пример #21
0
 public void SetOutlineStyle(decimal Width, A.CompoundLineValues? CompoundType, A.PresetLineDashValues? DashType, A.LineCapValues? CapType, SLLineJoinValues? JoinType)
 {
     this.Line.Width = Width;
     if (CompoundType != null) this.Line.CompoundLineType = CompoundType.Value;
     if (DashType != null) this.Line.DashType = DashType.Value;
     if (CapType != null) this.Line.CapType = CapType.Value;
     if (JoinType != null) this.Line.JoinType = JoinType.Value;
 }
Пример #22
0
 public void Set3DBevelTop(A.BevelPresetValues BevelPreset, decimal Width, decimal Height)
 {
     this.Format3D.SetBevelTop(BevelPreset, Width, Height);
 }
Пример #23
0
 public void SetReflection(decimal BlurRadius, decimal StartOpacity, decimal StartPosition, decimal EndAlpha, decimal EndPosition, decimal Distance, decimal Direction, decimal FadeDirection, decimal HorizontalRatio, decimal VerticalRatio, decimal HorizontalSkew, decimal VerticalSkew, A.RectangleAlignmentValues Alignment, bool RotateWithShape)
 {
     this.Reflection.SetReflection(BlurRadius, StartOpacity, StartPosition, EndAlpha, EndPosition, Distance, Direction, FadeDirection, HorizontalRatio, VerticalRatio, HorizontalSkew, VerticalSkew, Alignment, RotateWithShape);
 }
Пример #24
0
 public void Set3DContour(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal ContourWidth)
 {
     this.Format3D.SetContour(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, ContourWidth);
     this.Format3D.clrContourColor.Transparency = Transparency;
 }
Пример #25
0
 private static void ModifyPowerPointCellTextContent(OXD.TableCell cell, string txt)
 {
     if (null != cell)
     {
         OXD.TextBody textbody = cell.Descendants<OXD.TextBody>().FirstOrDefault();
         if (null != textbody)
         {
             OXD.TextBody final_textbody = textbody.CloneNode(true) as OXD.TextBody;
             OXD.Paragraph paragraph = final_textbody.Descendants<OXD.Paragraph>().FirstOrDefault();
             if (null != paragraph)
             {
                 OXD.Paragraph final_paragraph = paragraph.CloneNode(true) as OXD.Paragraph;
                 ModifyPowerPointParagraphTextContent(final_paragraph, txt);
                 final_textbody.ReplaceChild<OXD.Paragraph>(final_paragraph, paragraph);
             }
             cell.ReplaceChild<OXD.TextBody>(final_textbody, textbody);
         }
     }
 }
Пример #26
0
 public void Set3DExtrusion(A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal ExtrusionHeight)
 {
     this.Format3D.SetExtrusion(SLDrawingTool.TranslateSchemeColorValue(ThemeColor), (double)Tint, ExtrusionHeight);
     this.Format3D.clrExtrusionColor.Transparency = Transparency;
 }
Пример #27
0
 private static void ModifyPowerPointRowTextContent(OXD.TableRow headerRowTemplate, string txt)
 {
     if (null != headerRowTemplate)
     {
         var cells = headerRowTemplate.Descendants<OXD.TableCell>();
         if (null != cells)
         {
             foreach (var cell in cells)
             {
                 ModifyPowerPointCellTextContent(cell, txt);
             }
         }
     }
 }
Пример #28
0
 public void Set3DMaterialType(A.PresetMaterialTypeValues MaterialType)
 {
     this.Format3D.Material = MaterialType;
 }
Пример #29
0
 private static void ReplaceWordRun(OXD.Paragraph paragraph, OXD.Run initRun, OXD.Run finalRun)
 {
     if (null != paragraph.Descendants<OXD.Run>())
     {
         List<OXD.Run> runs = paragraph.Descendants<OXD.Run>().ToList();
         foreach (var run in runs)
         {
             if (initRun != run)
             {
                 paragraph.RemoveChild<OXD.Run>(run);
             }
         }
         paragraph.ReplaceChild<OXD.Run>(finalRun, initRun);
     }
 }
Пример #30
0
        private A.InnerShadow FormInnerShadow(bool UseThemeColour, System.Drawing.Color ShadowColor, A.SchemeColorValues ThemeColor, decimal Tint, decimal Transparency, decimal Blur, decimal Angle, decimal Distance)
        {
            A.InnerShadow innershadow = new A.InnerShadow();
            innershadow.BlurRadius = SLDrawingTool.CalculatePositiveCoordinate(Blur);
            // default is 0
            if (innershadow.BlurRadius.Value == 0) innershadow.BlurRadius = null;

            innershadow.Distance = SLDrawingTool.CalculatePositiveCoordinate(Distance);
            // default is 0
            if (innershadow.Distance.Value == 0) innershadow.Distance = null;

            innershadow.Direction = SLDrawingTool.CalculatePositiveFixedAngle(Angle);
            // default is 0
            if (innershadow.Direction.Value == 0) innershadow.Direction = null;

            if (!UseThemeColour)
            {
                innershadow.RgbColorModelHex = this.FormRgbColorModelHex(ShadowColor, Transparency);
            }
            else
            {
                innershadow.SchemeColor = this.FormSchemeColor(ThemeColor, Tint, Transparency);
            }

            return innershadow;
        }