File tree Expand file tree Collapse file tree 3 files changed +81
-0
lines changed
src/foundation/src/MigraDoc/src
MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes
MigraDoc.RtfRendering/RtfRendering Expand file tree Collapse file tree 3 files changed +81
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,19 @@ public FillFormat FillFormat
125125 }
126126 }
127127
128+ /// <summary>
129+ /// Gets the text in front or behind format of the shape.
130+ /// </summary>
131+ public TextWithShapeFormat TextWithShapeFormat
132+ {
133+ get => Values . TextWithShapeFormat ??= new TextWithShapeFormat ( this ) ;
134+ set
135+ {
136+ SetParent ( value ) ;
137+ Values . TextWithShapeFormat = value ;
138+ }
139+ }
140+
128141 /// <summary>
129142 /// Gets or sets the height of the shape.
130143 /// </summary>
@@ -234,6 +247,12 @@ internal ShapeValues(DocumentObject owner) : base(owner)
234247 /// </summary>
235248 public FillFormat ? FillFormat { get ; set ; }
236249
250+ /// <summary>
251+ /// Gets or sets the internal nullable implementation value of the enclosing document object property.
252+ /// See enclosing document object class for documentation of this property.
253+ /// </summary>
254+ public TextWithShapeFormat ? TextWithShapeFormat { get ; set ; }
255+
237256 /// <summary>
238257 /// Gets or sets the internal nullable implementation value of the enclosing document object property.
239258 /// See enclosing document object class for documentation of this property.
Original file line number Diff line number Diff line change 1+ // MigraDoc - Creating Documents on the Fly
2+ // See the LICENSE file in the solution root for more information.
3+
4+ namespace MigraDoc . DocumentObjectModel . Shapes
5+ {
6+ /// <summary>
7+ /// A TextWithShapeFormat object
8+ /// Defines the background filling of the shape.
9+ /// </summary>
10+ public class TextWithShapeFormat : DocumentObject
11+ {
12+ /// <summary>
13+ /// Initializes a new instance of the FillFormat class.
14+ /// </summary>
15+ public TextWithShapeFormat ( ) { }
16+
17+ /// <summary>
18+ /// Initializes a new instance of the FillFormat class with the specified parent.
19+ /// </summary>
20+ internal TextWithShapeFormat ( DocumentObject parent ) : base ( parent ) { }
21+
22+ /// <summary>
23+ /// Creates a deep copy of this object.
24+ /// </summary>
25+ public new TextWithShapeFormat Clone ( )
26+ => ( TextWithShapeFormat ) DeepCopy ( ) ;
27+
28+ /// <summary>
29+ /// Gets or sets a value indicating whether the text should be in front of the shape.
30+ /// </summary>
31+ public bool ? TextInFront { get ; set ; }
32+
33+ /// <summary>
34+ /// Converts FillFormat into DDL.
35+ /// </summary>
36+ internal override void Serialize ( Serializer serializer )
37+ {
38+ int pos = serializer . BeginContent ( "TextWithShapeFormat" ) ;
39+ if ( this . TextInFront . HasValue )
40+ serializer . WriteSimpleAttribute ( "TextInFront" , this . TextInFront . Value ) ;
41+
42+ serializer . EndContent ( ) ;
43+ }
44+
45+ /// <summary>
46+ /// Returns the meta object of this instance.
47+ /// </summary>
48+ internal override Meta Meta => TheMeta ;
49+
50+ static readonly Meta TheMeta = new ( typeof ( TextWithShapeFormat ) ) ;
51+ }
52+ }
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ void RenderShapeAttributes()
5757 }
5858 RenderLineFormat ( ) ;
5959 RenderFillFormat ( ) ;
60+ RenderTextWithShapeFormat ( ) ;
6061 }
6162
6263 /// <summary>
@@ -74,6 +75,15 @@ protected void RenderFillFormat()
7475 RenderNameValuePair ( "fFilled" , "0" ) ;
7576 }
7677
78+ protected void RenderTextWithShapeFormat ( )
79+ {
80+ var tf = GetValueAsIntended ( "TextWithShapeFormat" ) as TextWithShapeFormat ;
81+ if ( tf != null && tf . TextInFront . HasValue && tf . TextInFront . Value )
82+ RenderNameValuePair ( "fBehindDocument" , "0" ) ;
83+ else
84+ RenderNameValuePair ( "fBehindDocument" , "1" ) ;
85+ }
86+
7787 protected Unit GetLineWidth ( )
7888 {
7989 var lf = GetValueAsIntended ( "LineFormat" ) as LineFormat ;
You can’t perform that action at this time.
0 commit comments