Skip to content

Commit c6e6efc

Browse files
Revert "Adding Fade animation to all shapes"
This reverts commit b146513.
1 parent b146513 commit c6e6efc

File tree

3 files changed

+131
-128
lines changed

3 files changed

+131
-128
lines changed

PowerPoint/Openize.Slides.Facade/AnimationFacade.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,20 @@ public class AnimateFacade
1919
{
2020
// Properties for ShapeId, Delay, and Duration
2121
public string ShapeId { get; set; }
22-
public int Duration { get; set; }
23-
public string Type { get; set; }
22+
public string Delay { get; set; }
23+
public string Duration { get; set; }
2424

2525
// Constructor to initialize the properties
26-
public AnimateFacade(string shapeId = "1", int duration = 0, string type = "fade")
26+
public AnimateFacade(string shapeId = "1", string delay = "0", string duration = "indefinite")
2727
{
2828
ShapeId = shapeId;
29-
Type = type;
29+
Delay = delay;
3030
Duration = duration;
3131
}
32-
public Timing animate()
33-
{
34-
return GenerateTiming(ShapeId, 1000, "fade");
32+
public Timing animate() {
33+
return GenerateTiming(ShapeId);
3534
}
36-
public Timing GenerateTiming(String shapeId, int duration, String type)
35+
public Timing GenerateTiming(String shapeId)
3736
{
3837
Timing timing1 = new Timing();
3938

@@ -120,10 +119,10 @@ public Timing GenerateTiming(String shapeId, int duration, String type)
120119
setBehavior1.Append(commonBehavior1);
121120
setBehavior1.Append(toVariantValue1);
122121

123-
AnimateEffect animateEffect1 = new AnimateEffect() { Transition = AnimateEffectTransitionValues.In, Filter = type };
122+
AnimateEffect animateEffect1 = new AnimateEffect() { Transition = AnimateEffectTransitionValues.In, Filter = "fade" };
124123

125124
CommonBehavior commonBehavior2 = new CommonBehavior();
126-
CommonTimeNode commonTimeNode7 = new CommonTimeNode() { Id = (UInt32Value)7U, Duration = duration.ToString() };
125+
CommonTimeNode commonTimeNode7 = new CommonTimeNode() { Id = (UInt32Value)7U, Duration = "1000" };
127126

128127
TargetElement targetElement2 = new TargetElement();
129128
ShapeTarget shapeTarget2 = new ShapeTarget() { ShapeId = shapeId };
@@ -138,7 +137,7 @@ public Timing GenerateTiming(String shapeId, int duration, String type)
138137
Animate animate1 = new Animate() { CalculationMode = AnimateBehaviorCalculateModeValues.Linear, ValueType = AnimateBehaviorValues.Number };
139138

140139
CommonBehavior commonBehavior3 = new CommonBehavior();
141-
CommonTimeNode commonTimeNode8 = new CommonTimeNode() { Id = (UInt32Value)8U, Duration = duration.ToString(), Fill = TimeNodeFillValues.Hold };
140+
CommonTimeNode commonTimeNode8 = new CommonTimeNode() { Id = (UInt32Value)8U, Duration = "1000", Fill = TimeNodeFillValues.Hold };
142141

143142
TargetElement targetElement3 = new TargetElement();
144143
ShapeTarget shapeTarget3 = new ShapeTarget() { ShapeId = shapeId };
@@ -184,7 +183,7 @@ public Timing GenerateTiming(String shapeId, int duration, String type)
184183
Animate animate2 = new Animate() { CalculationMode = AnimateBehaviorCalculateModeValues.Linear, ValueType = AnimateBehaviorValues.Number };
185184

186185
CommonBehavior commonBehavior4 = new CommonBehavior();
187-
CommonTimeNode commonTimeNode9 = new CommonTimeNode() { Id = (UInt32Value)9U, Duration = duration.ToString(), Fill = TimeNodeFillValues.Hold };
186+
CommonTimeNode commonTimeNode9 = new CommonTimeNode() { Id = (UInt32Value)9U, Duration = "1000", Fill = TimeNodeFillValues.Hold };
188187

189188
TargetElement targetElement4 = new TargetElement();
190189
ShapeTarget shapeTarget4 = new ShapeTarget() { ShapeId = shapeId };

PowerPoint/Openize.Slides/Rectangle.cs

Lines changed: 73 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,122 +7,135 @@
77
namespace Openize.Slides
88
{
99
/// <summary>
10-
/// Represents a rectangle shape within a slide.
10+
/// This class represents the rectangle shape within a slide.
1111
/// </summary>
1212
public class Rectangle
1313
{
14+
private double _x;
15+
private double _y;
16+
private double _Width;
17+
private double _Height;
18+
private RectangleShapeFacade _Facade;
19+
private int _shapeIndex;
20+
private string _BackgroundColor = null;
21+
private AnimationType _Animation = AnimationType.None;
1422
/// <summary>
15-
/// Gets or sets the X coordinate of the rectangle shape.
23+
/// Property to get or set X coordinate of the shape.
1624
/// </summary>
17-
public double X { get; set; }
25+
public double X { get => _x; set => _x = value; }
1826

1927
/// <summary>
20-
/// Gets or sets the Y coordinate of the rectangle shape.
28+
/// Property to get or set Y coordinate of the shape.
2129
/// </summary>
22-
public double Y { get; set; }
30+
public double Y { get => _y; set => _y = value; }
2331

2432
/// <summary>
25-
/// Gets or sets the width of the rectangle shape.
33+
/// Property to get or set width of the shape.
2634
/// </summary>
27-
public double Width { get; set; }
35+
public double Width { get => _Width; set => _Width = value; }
2836

2937
/// <summary>
30-
/// Gets or sets the height of the rectangle shape.
38+
/// Property to get or set height of the shape.
3139
/// </summary>
32-
public double Height { get; set; }
40+
public double Height { get => _Height; set => _Height = value; }
3341

3442
/// <summary>
35-
/// Gets or sets the facade that handles rectangle shape operations.
43+
/// Property to get or set the RectangleShapeFacade.
3644
/// </summary>
37-
public RectangleShapeFacade Facade { get; set; }
45+
public RectangleShapeFacade Facade { get => _Facade; set => _Facade = value; }
3846

3947
/// <summary>
40-
/// Gets or sets the index of the shape within a slide.
48+
/// Property to get or set the shape index within a slide.
4149
/// </summary>
42-
public int ShapeIndex { get; set; }
50+
public int ShapeIndex { get => _shapeIndex; set => _shapeIndex = value; }
4351

4452
/// <summary>
45-
/// Gets or sets the background color of the rectangle shape.
46-
/// Default value is "Transparent".
53+
/// Property to set or get background color of a rectangle shape.
4754
/// </summary>
48-
public string BackgroundColor { get; set; } = "Transparent";
49-
55+
public string BackgroundColor { get => _BackgroundColor; set => _BackgroundColor = value; }
5056
/// <summary>
51-
/// Gets or sets the animation type applied to the rectangle shape.
52-
/// Default value is <see cref="AnimationType.None"/>.
57+
/// Property to set animation
5358
/// </summary>
54-
public AnimationType Animation { get; set; } = AnimationType.None;
55-
59+
public AnimationType Animation { get => _Animation; set => _Animation = value; }
5660
/// <summary>
57-
/// Initializes a new instance of the <see cref="Rectangle"/> class.
61+
/// Constructor of the Rectangle class initializes the object of RectangleShapeFacade and populates its fields.
5862
/// </summary>
5963
public Rectangle()
6064
{
61-
Facade = new RectangleShapeFacade
62-
{
63-
ShapeIndex = ShapeIndex
64-
};
65+
_Facade = new RectangleShapeFacade();
66+
_Facade.ShapeIndex = _shapeIndex;
6567

66-
X = Utility.EmuToPixels(1349828);
67-
Y = Utility.EmuToPixels(1999619);
68-
Width = Utility.EmuToPixels(6000000);
69-
Height = Utility.EmuToPixels(2000000);
68+
_BackgroundColor = "Transparent";
69+
_x = Utility.EmuToPixels(1349828);
70+
_y = Utility.EmuToPixels(1999619);
71+
_Width = Utility.EmuToPixels(6000000);
72+
_Height = Utility.EmuToPixels(2000000);
7073

71-
PopulateFacade();
74+
Populate_Facade();
7275
}
7376

7477
/// <summary>
75-
/// Updates the rectangle shape by synchronizing its properties with the facade.
78+
/// Method to update rectangle shape.
7679
/// </summary>
7780
public void Update()
7881
{
79-
PopulateFacade();
80-
Facade.UpdateShape();
82+
Populate_Facade();
83+
_Facade.UpdateShape();
8184
}
8285

8386
/// <summary>
84-
/// Populates the facade with the current rectangle properties.
85-
/// Converts pixel values to EMUs before setting them in the facade.
87+
/// Method to populate the fields of the respective facade.
8688
/// </summary>
87-
private void PopulateFacade()
89+
private void Populate_Facade()
8890
{
89-
Facade.BackgroundColor = BackgroundColor;
90-
Facade.X = Utility.PixelsToEmu(X);
91-
Facade.Y = Utility.PixelsToEmu(Y);
92-
Facade.Width = Utility.PixelsToEmu(Width);
93-
Facade.Height = Utility.PixelsToEmu(Height);
91+
_Facade.BackgroundColor = _BackgroundColor;
92+
_Facade.X = Utility.PixelsToEmu(_x);
93+
_Facade.Y = Utility.PixelsToEmu(_y);
94+
_Facade.Width = Utility.PixelsToEmu(_Width);
95+
_Facade.Height = Utility.PixelsToEmu(_Height);
9496
}
9597

9698
/// <summary>
97-
/// Retrieves a list of rectangle objects from their corresponding facades.
99+
/// Method for getting the list of rectangle shapes.
98100
/// </summary>
99-
/// <param name="rectangleFacades">A list of <see cref="RectangleShapeFacade"/> objects.</param>
100-
/// <returns>A list of <see cref="Rectangle"/> objects.</returns>
101-
public static List<Rectangle> GetRectangles(List<RectangleShapeFacade> rectangleFacades)
101+
/// <param name="RectangleFacades">A list of RectangleShapeFacade objects.</param>
102+
/// <returns>A list of Rectangle objects.</returns>
103+
public static List<Rectangle> GetRectangles(List<RectangleShapeFacade> RectangleFacades)
102104
{
103-
var rectangles = new List<Rectangle>();
104-
foreach (var facade in rectangleFacades)
105+
List<Rectangle> Rectangles = new List<Rectangle>();
106+
try
105107
{
106-
rectangles.Add(new Rectangle
108+
foreach (var facade in RectangleFacades)
107109
{
108-
BackgroundColor = facade.BackgroundColor,
109-
X = Utility.EmuToPixels(facade.X),
110-
Y = Utility.EmuToPixels(facade.Y),
111-
Width = Utility.EmuToPixels(facade.Width),
112-
Height = Utility.EmuToPixels(facade.Height),
113-
Facade = facade,
114-
ShapeIndex = facade.ShapeIndex
115-
});
110+
Rectangle Rectangle = new Rectangle
111+
{
112+
BackgroundColor = facade.BackgroundColor,
113+
X = Utility.EmuToPixels(facade.X),
114+
Y = Utility.EmuToPixels(facade.Y),
115+
Width = Utility.EmuToPixels(facade.Width),
116+
Height = Utility.EmuToPixels(facade.Height),
117+
Facade = facade,
118+
ShapeIndex = facade.ShapeIndex
119+
};
120+
121+
Rectangles.Add(Rectangle);
122+
}
116123
}
117-
return rectangles;
124+
catch (Exception ex)
125+
{
126+
string errorMessage = Common.OpenizeException.ConstructMessage(ex, "Getting Rectangle Shapes");
127+
throw new Common.OpenizeException(errorMessage, ex);
128+
}
129+
130+
return Rectangles;
118131
}
119132

120133
/// <summary>
121-
/// Removes the rectangle shape from the slide.
134+
/// Method to remove the rectangle shape from a slide.
122135
/// </summary>
123136
public void Remove()
124137
{
125-
Facade.RemoveShape(Facade.RectangleShape);
138+
_Facade.RemoveShape(this.Facade.RectangleShape);
126139
}
127140
}
128141
}

0 commit comments

Comments
 (0)