프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / MarkupToPDF / Controls / Text / TextControl.cs @ b79d6e7f

이력 | 보기 | 이력해설 | 다운로드 (46.4 KB)

1
using MarkupToPDF.Common;
2
using MarkupToPDF.Controls.Common;
3
using MarkupToPDF.Serialize.Core;
4
using MarkupToPDF.Serialize.S_Control;
5
using System;
6
using System.Collections.Generic;
7
using System.ComponentModel;
8
using System.Linq;
9
using System.Text;
10
using System.Threading.Tasks;
11
using System.Windows;
12
using System.Windows.Controls;
13
using System.Windows.Media;
14
using System.Windows.Shapes;
15
using Markus.Fonts;
16
using System.Windows.Markup;
17

    
18
namespace MarkupToPDF.Controls.Text
19
{    
20
    public class TextControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, ITextControl, IMarkupControlData
21
    {
22
        public event PropertyChangedEventHandler PropertyChanged;
23

    
24
        private const string PART_Grid = "PART_Grid";
25
        private const string PART_Border = "PART_Border";
26
        private const string PART_TextBox = "PART_TextBox";
27
        private const string PART_TextPath = "PART_TextPath";
28
        private const string PART_TextBlock = "PART_TextBlock";
29
        private const string PART_Canvas = "PART_TextControlCanvas";
30
        private const string PART_BaseTextbox_Caret = "Caret";
31
        
32
        //private const string PART_TextPrefix = "PART_TextPrefix";
33
      
34
        public Path Base_TextPath = null;
35
        public Grid Base_Grid = null;
36
        public Border Base_Border = null;
37
        public Canvas Base_Canvas = null;
38
        //public TextBlock Base_TextPrefixBlock = null;
39
        public TextBlock Base_TextBlock = null;
40
        public TextBox Base_TextBox = null;
41
        public Border BaseTextbox_Caret = null;
42

    
43
        public RotateTransform _rotation = null;
44
        public TranslateTransform _translation = null;
45
        public ScaleTransform _scale = null;
46

    
47
        private const double _CloudArcDepth = 0.8;  /// 2018.05.14 added by humkyung
48

    
49
        public override bool IsSelected
50
        {
51
            get
52
            {
53
                return (bool)GetValue(IsSelectedProperty);
54
            }
55
            set
56
            {
57
                SetValue(IsSelectedProperty, value);
58
                OnPropertyChanged("IsSelected");
59
            }
60
        }
61

    
62
        #region Internal Method
63

    
64
        public TextControl()
65
        {
66
            //this.DefaultStyleKey = typeof(TextControl);
67
        }
68

    
69
        static TextControl()
70
        {
71
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TextControl), new FrameworkPropertyMetadata(typeof(TextControl)));
72
            //ResourceDictionary dictionary = new ResourceDictionary();
73
            //dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute);
74
            //if (!Application.Current.Resources.MergedDictionaries.Any(x => x.Source == dictionary.Source))
75
            //    Application.Current.Resources.MergedDictionaries.Add(dictionary);
76

    
77
        }
78

    
79
        public override void Copy(CommentUserInfo lhs)
80
        {
81
            if(lhs is TextControl item)
82
            {
83
                Text = item.Text;
84
                StartPoint = new Point(item.StartPoint.X, item.StartPoint.Y);
85
                EndPoint = new Point(item.EndPoint.X, item.EndPoint.Y);
86
                CanvasX = item.CanvasX;
87
                CanvasY = item.CanvasY;
88
                BoxWidth = item.BoxWidth;
89
                BoxHeight = item.BoxHeight;
90
                ControlType_No = item.ControlType_No;
91
                LineSize = item.LineSize;
92
                TextSize = item.TextSize;
93
                StrokeColor = item.StrokeColor;
94
                ArcLength = item.ArcLength;
95
                FontSize = item.FontSize;
96
                UserID = item.UserID;
97
                IsHighLight = item.IsHighLight;
98
                CommentAngle = item.CommentAngle;
99
                PointSet = item.PointSet.ConvertAll(x => new Point(x.X, x.Y));
100
                Opacity = item.Opacity;
101
                TextFamily = item.FontFamily;
102
                TextStyle = item.TextStyle;
103
                TextWeight = item.TextWeight;
104
                UnderLine = item.UnderLine;
105
            }
106
        }
107

    
108
        public override CommentUserInfo Clone()
109
        {
110
            var clone = new TextControl();
111
            clone.Copy(this);
112
            return clone;
113
        }
114

    
115
        public override void OnApplyTemplate()
116
        {
117
            base.OnApplyTemplate();
118

    
119
            Base_TextPath = GetTemplateChild(PART_TextPath) as Path;
120
            Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox;
121
            Base_TextBlock = GetTemplateChild(PART_TextBlock) as TextBlock;
122
            Base_Grid = GetTemplateChild(PART_Grid) as Grid;
123
            Base_Border = GetTemplateChild(PART_Border) as Border;
124
            Base_Canvas = GetTemplateChild(PART_Canvas) as Canvas;
125
            BaseTextbox_Caret = GetTemplateChild(PART_BaseTextbox_Caret) as Border;
126
            //BaseTextbox_Caret.Height = this.Base_TextBox.FontSize;
127
            this.Base_TextBox.Text = this.Text;
128
            this.Base_TextBox.CaretIndex = this.Base_TextBox.Text.Length;
129
            this.Base_TextBox.CaretBrush = new SolidColorBrush(Colors.Transparent);
130
            this.Base_TextBox.ApplyTemplate();
131
            MoveCustomCaret();
132
            if(this.Base_TextBox.FontSize > this.BaseTextbox_Caret.Height)
133
            {
134
                BaseTextbox_Caret.Height = this.Base_TextBox.FontSize;
135
            }
136
            //BaseTextbox_Caret.Height = Base_TextBox.ActualHeight - 5;
137

    
138
            this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
139
            this.Base_TextBox.TextChanged += new TextChangedEventHandler(Base_TextBox_TextChanged);
140
            this.Base_TextBlock.SizeChanged += new SizeChangedEventHandler(Base_TextBlock_SizeChanged);
141
            this.Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus);
142
            this.Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus);            
143
            this.Base_TextBox.SelectionChanged += (sender, e) => MoveCustomCaret();
144
            
145
            SetText();
146
            DrawingCloud();
147
        }
148

    
149
        public void SetFontFamily(FontFamily fontFamily)
150
        {
151
            
152
            if (this.Base_TextBlock != null) {
153
                this.Base_TextBlock.FontFamily = fontFamily;
154
            }
155

    
156
            if (this.Base_TextBox != null) {
157
                this.Base_TextBox.FontFamily = fontFamily;
158
            }
159
            this.FontFamily = fontFamily;
160
            this.TextFamily = fontFamily;
161
        }
162

    
163

    
164
        /// <summary>
165
        /// Moves the custom caret on the canvas.
166
        /// </summary>
167
        public void MoveCustomCaret()
168
        {
169

    
170
            var caretLocation = this.Base_TextBox.GetRectFromCharacterIndex(this.Base_TextBox.CaretIndex).Location;
171

    
172
            if (!double.IsInfinity(caretLocation.X)) {
173
                Canvas.SetLeft(this.BaseTextbox_Caret, caretLocation.X);
174
            }
175

    
176
            if (!double.IsInfinity(caretLocation.Y)) {
177
                Canvas.SetTop(this.BaseTextbox_Caret, caretLocation.Y);
178
                //Canvas.SetTop(this.BaseTextbox_Caret, (LineSize.Top - caretLocation.Y));
179
            }
180
        }
181

    
182
        
183

    
184
        public override void ApplyOverViewData()
185
        {
186
            this.OverViewPathData = this.PathData;
187
            if (Text == "")
188
                this.Text = this.OverViewText;
189
            else
190
                this.OverViewText = this.Text;
191
            
192
            this.OverViewPaint = this.Paint;
193

    
194
        }        
195

    
196
        void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
197
        {
198
            BoxWidth = e.NewSize.Width;
199
            BoxHeight = e.NewSize.Height;
200

    
201
            DrawingCloud();
202
        }
203
        private void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
204
        {
205
            BoxWidth = e.NewSize.Width;
206
            BoxHeight = e.NewSize.Height;
207

    
208
            DrawingCloud();
209
        }
210
        private void Base_TextBox_TextChanged(object sender, TextChangedEventArgs e)
211
        {
212
            if (IsEditingMode)
213
            {
214
                if (Base_TextBox.Text.Contains("|OR||DZ|"))
215
                {
216
                    Base_TextBox.Text = this.Text;
217
                }
218

    
219
                this.Text = Base_TextBox.Text;
220

    
221
            }            
222
            DrawingCloud();
223
        }
224
        void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
225
        {
226
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
227
            MoveCustomCaret();
228
            Base_TextBox.Focus();
229
            this.IsEditingMode = true;
230
        }
231

    
232
        void Base_TextBox_LostFocus(object sender, RoutedEventArgs e)
233
        {
234
            this.Text = Base_TextBox.Text;
235
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
236
            this.IsEditingMode = false;
237
            ApplyOverViewData();
238
        }
239

    
240
        //void TextControl_GotFocus(object sender, RoutedEventArgs e)
241
        //{
242
        //    Base_TextBox.Visibility = Visibility.Visible;
243
        //    Base_TextBlock.Visibility = Visibility.Collapsed;
244
        //    this.Base_TextBox.BorderThickness = new Thickness(1);
245
        //    if (UnderLine != null)
246
        //    {
247
        //        Base_TextBlock.TextDecorations = UnderLine;
248
        //    }
249
        //    if (this.Text != null)
250
        //    {
251
        //        Base_TextBox.Text = this.Text;
252
        //    }
253
        //    IsEditing = true;
254
        //}
255
        //void TextControl_LostFocus(object sender, RoutedEventArgs e)
256
        //{
257
        //    Base_TextBox.Visibility = Visibility.Collapsed;
258
        //    Base_TextBlock.Visibility = Visibility.Visible;
259
        //    this.Text = Base_TextBox.Text;
260
        //    if (UnderLine != null)
261
        //    {
262
        //        Base_TextBlock.TextDecorations = UnderLine;
263
        //    }
264
        //    Base_TextBlock.Margin =
265
        //       new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4, Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
266
        //    IsEditing = false;
267
        //}
268
        public void EditingMode()
269
        {            
270
            TextBoxVisibility = Visibility.Visible;
271
            TextBlockVisibility = Visibility.Collapsed;
272
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
273

    
274
            if (UnderLine != null)
275
                Base_TextBlock.TextDecorations = UnderLine;
276

    
277
        }
278

    
279
        public void UnEditingMode()
280
        {            
281
            TextBoxVisibility = Visibility.Collapsed;         
282
            TextBlockVisibility = Visibility.Visible; 
283
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
284

    
285
            if (UnderLine != null)
286
                Base_TextBlock.TextDecorations = UnderLine;
287

    
288
            
289
        }
290
        public void SetText()
291
        {
292
            if (IsHighLight)
293
            {
294
                this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
295
                    Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
296
                this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
297
                    Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
298
            }
299
            else
300
            {
301
                //this.BackInnerColor = new SolidColorBrush(Color.FromArgb(0x003, 0xFF, 0xFF, 0xFF));
302
                //this.BackColor = new SolidColorBrush(Color.FromArgb(0x003, 0xFF, 0xFF, 0xFF));
303

    
304
                this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
305
                    Colors.White.R, Colors.White.G, Colors.White.B));
306

    
307
                this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
308
                    Colors.White.R, Colors.White.G, Colors.White.B));
309
            }
310
            if (Base_TextPath != null)
311
            {
312
                Base_TextPath.StrokeThickness = LineSize.Left;
313
            }
314
            
315
        }
316

    
317
        public void DrawingCloud()
318
        {
319
            
320
            List<Point> pCloud = new List<Point>
321
            {
322
                new Point(0, 0),
323
                new Point(0, 0 + BoxHeight + 0),
324
                new Point(0 + BoxWidth + 2, 0 + BoxHeight + 0),
325
                new Point(0 + BoxWidth + 2 ,0)
326
            };
327
            //this.Base_TextBox.Select(Base_TextBox.Text.Length, 0);
328
            if (Base_TextPath != null)
329
            {
330
                switch (ControlType_No)
331
                {
332
                    case 0:
333
                        {
334
                            PathData = new PathGeometry();
335
                            PathDataInner = (GenerateInner(pCloud));
336
                        }
337
                        break;
338
                    case 1:
339
                        {
340
                            PathData = (Generate_Rect(pCloud));
341
                            List<Point> pCloud2 = new List<Point>
342
                            {
343
                                new Point(0, 0),
344
                                new Point(0, 0 + BoxHeight + 0),
345
                                new Point(0 + BoxWidth + 10, 0 + BoxHeight + 0),
346
                                new Point(0 + BoxWidth + 10 ,0)
347
                            };
348
                            PathDataInner = (GenerateInner(pCloud));
349
                        }
350
                        break;
351
                    case 2:
352
                        {
353
                            PathData = (Generate(pCloud, this.ArcLength));
354
                            PathDataInner = (GenerateInner(pCloud));
355
                        }
356
                        break;
357
                }
358
            }
359
        }
360
        #endregion Internal Method
361

    
362
        public void Dispose()
363
        {
364
            //GC.Collect();
365
            ////GC.SuppressFinalize(this);
366
            this.Base_Border = null;
367
            this.Base_Canvas = null;
368
            this.Base_Grid = null;
369
            this.Base_TextBlock = null;
370
            this.Base_TextBox = null;
371
        }
372

    
373
        public override void UpdateControl()
374
        {
375
            if (this.PointSet.Count > 1)
376
            {
377
                this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
378
                this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
379
            }
380
        }
381

    
382
        #region Drawing Cloud Method
383
        public static PathGeometry Generate_Rect(List<Point> pData)
384
        {
385
            PathFigure pathFigure = new PathFigure();
386
            pathFigure.StartPoint = pData[0];
387

    
388
            PolyLineSegment polyline = new PolyLineSegment(pData, true);
389
            pathFigure.Segments.Add(polyline);
390

    
391
            PathGeometry rectPathGeometry = new PathGeometry();
392
            rectPathGeometry.Figures = new PathFigureCollection();
393
            pathFigure.IsClosed = true;
394
            pathFigure.IsFilled = false;
395
            rectPathGeometry.Figures.Add(pathFigure);
396

    
397

    
398
            return rectPathGeometry;
399
        }
400

    
401
        public static PathGeometry Generate(List<Point> pData, double _ArcLength = 20)
402
        {
403
            var _pathGeometry = new PathGeometry();
404
            double area = MathSet.AreaOf(pData);
405
            bool reverse = (area > 0);
406
            int count = pData.Count;
407
            for (int i = 0; i < count; i++)
408
            {
409
                PathFigure pathFigure = Polygon.CloudControl.GenerateLineWithCloud(pData[i % count], pData[(i + 1) % count], _ArcLength, reverse);
410
                pathFigure.IsClosed = false;
411
                pathFigure.IsFilled = true;
412
                _pathGeometry.Figures.Add(pathFigure);
413
            }
414

    
415
            return _pathGeometry;
416
        }
417

    
418

    
419
        public static PathGeometry GenerateInner(List<Point> pData)
420
        {
421
            var _pathGeometry = new PathGeometry();
422
            double area = MathSet.AreaOf(pData);
423
            bool reverse = (area > 0);
424
            int count = pData.Count;
425

    
426
            PathFigure pathFigur2 = new PathFigure();
427
            pathFigur2.StartPoint = pData[0];
428

    
429
            PolyLineSegment polyline = new PolyLineSegment(pData, true);
430
            pathFigur2.Segments.Add(polyline);
431

    
432
            pathFigur2.IsClosed = true;
433
            pathFigur2.IsFilled = true;
434
            _pathGeometry.Figures.Add(pathFigur2);
435

    
436
            return _pathGeometry;
437
        }
438
        #endregion
439

    
440
        #region Dependency Properties
441
        public static readonly DependencyProperty ControlTypeProperty =
442
        DependencyProperty.Register("ControlType", typeof(ControlType), typeof(TextControl), new FrameworkPropertyMetadata(ControlType.TextControl));
443

    
444
        public static readonly DependencyProperty ControlType_NoProperty =
445
        DependencyProperty.Register("ControlType_No", typeof(int), typeof(TextControl), new FrameworkPropertyMetadata(0));
446

    
447
        public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
448
            "IsSelected", typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
449

    
450
        public static readonly DependencyProperty PathGeometryProperty = DependencyProperty.Register(
451
            "PathGeometry", typeof(PathGeometry), typeof(TextControl), new PropertyMetadata(null, SetPathGeometryChanged));
452

    
453
        public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
454
            "Text", typeof(string), typeof(TextControl), new PropertyMetadata(null));
455

    
456
        public static readonly DependencyProperty OverViewTextProperty = DependencyProperty.Register(
457
            "OverViewText", typeof(string), typeof(TextControl), new PropertyMetadata(null, new PropertyChangedCallback(TextChanged)));
458

    
459
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
460
            "UserID", typeof(string), typeof(TextControl), new PropertyMetadata(null));
461

    
462
        /*public static readonly DependencyProperty FontColorProperty = DependencyProperty.Register(
463
            "FontColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));*/
464

    
465
        public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register(
466
            "StrokeColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
467

    
468
        public static readonly DependencyProperty ArcLengthProperty = DependencyProperty.Register(
469
            "ArcLength", typeof(double), typeof(TextControl), new PropertyMetadata((Double)10, PointValueChanged));
470

    
471
        //강인구 추가
472
        public static readonly DependencyProperty IsHighlightProperty = DependencyProperty.Register(
473
            "IsHighLight", typeof(bool), typeof(TextControl), new PropertyMetadata(false, PointValueChanged));
474

    
475
        public static readonly DependencyProperty BackColorProperty = DependencyProperty.Register(
476
            "BackColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
477

    
478
        public static readonly DependencyProperty BackInnerColorProperty = DependencyProperty.Register(
479
            "BackInnerColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
480

    
481
        public static readonly DependencyProperty UnderLineProperty = DependencyProperty.Register(
482
            "UnderLine", typeof(TextDecorationCollection), typeof(TextControl), new PropertyMetadata(null));
483

    
484
        public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
485
            "LineSize", typeof(Thickness), typeof(TextControl), new PropertyMetadata(new Thickness(4), PointValueChanged)); //여기만 4인지 모르겠지만 4 그대로 두겠음
486

    
487
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
488
            "PointSet", typeof(List<Point>), typeof(TextControl), new PropertyMetadata(new List<Point>()));
489

    
490
        public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
491
            "PathData", typeof(Geometry), typeof(TextControl), null);
492

    
493
        public static readonly DependencyProperty PathDataInnerProperty = DependencyProperty.Register(
494
            "PathDataInner", typeof(Geometry), typeof(TextControl), null);
495

    
496
        public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
497
            "OverViewPathDataProperty", typeof(Geometry), typeof(TextControl), null);
498

    
499
        public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register(
500
            "TextStyle", typeof(FontStyle), typeof(TextControl), new PropertyMetadata(FontStyles.Normal));
501

    
502
        public static readonly DependencyProperty TextFamilyProperty = DependencyProperty.Register(
503
            "TextFamily", typeof(FontFamily), typeof(TextControl), 
504
                        new PropertyMetadata(new PropertyChangedCallback(TextFamilyPropertyChanged)));
505

    
506
        public static readonly DependencyProperty TextWeightProperty = DependencyProperty.Register(
507
            "TextWeight", typeof(FontWeight), typeof(TextControl), new PropertyMetadata(FontWeights.Normal));
508

    
509
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(
510
            "CenterX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
511

    
512
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(
513
            "CenterY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
514

    
515
        public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
516
           "CanvasX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
517

    
518
        public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
519
            "CanvasY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
520

    
521
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
522
            "StartPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
523

    
524
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
525
            "EndPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(100, 100), PointValueChanged));
526

    
527
        public static readonly DependencyProperty TextSizeProperty = DependencyProperty.Register(
528
            "TextSize", typeof(Double), typeof(TextControl), new PropertyMetadata((Double)30, PointValueChanged));
529

    
530
        public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
531
            "Paint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
532

    
533
        public static readonly DependencyProperty OverViewPaintProperty = DependencyProperty.Register(
534
            "OverViewPaint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
535

    
536
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
537
            "Angle", typeof(double), typeof(TextControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
538

    
539
        public static readonly DependencyProperty EnableEditingProperty = DependencyProperty.Register(
540
           "EnableEditing", typeof(bool), typeof(TextControl), new PropertyMetadata((true), new PropertyChangedCallback(OnIsEditingChanged)));
541

    
542
        public static readonly DependencyProperty TextBoxVisibilityProperty = DependencyProperty.Register(
543
            "TextBoxVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Visible), OnTextBoxVisibilityChanged));
544

    
545
        public static readonly DependencyProperty TextBlockVisibilityProperty = DependencyProperty.Register(
546
            "TextBlockVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Collapsed), OnTextBlockVisibilityChanged));
547

    
548
        #endregion Dependency Properties
549

    
550
        #region dp Properties
551

    
552

    
553
        public override SolidColorBrush StrokeColor
554
        {
555
            get { return (SolidColorBrush)GetValue(StrokeColorProperty); }
556
            set
557
            {
558
                if (this.StrokeColor != value)
559
                {
560
                    SetValue(StrokeColorProperty, value);
561
                }
562
            }
563
        }
564

    
565
        public Double ArcLength
566
        {
567
            get { return (Double)GetValue(ArcLengthProperty); }
568
            set
569
            {
570
                if (this.ArcLength != value)
571
                {
572
                    SetValue(ArcLengthProperty, value);
573
                    OnPropertyChanged("ArcLength");
574
                }
575
            }
576
        }
577

    
578
        public bool EnableEditing
579
        {
580
            get { return (bool)GetValue(EnableEditingProperty); }
581
            set
582
            {
583
                if (this.EnableEditing != value)
584
                {
585
                    SetValue(EnableEditingProperty, value);
586
                    OnPropertyChanged("EnableEditing");
587
                }
588
            }
589
        }
590

    
591
        public Thickness LineSize
592
        {
593
            get
594
            {
595
                return (Thickness)GetValue(LineSizeProperty);
596
            }
597
            set
598
            {
599
                if (this.LineSize != value)
600
                {
601
                    SetValue(LineSizeProperty, value);
602
                    OnPropertyChanged("LineSize");
603
                }
604
            }
605
        }
606

    
607
        public override ControlType ControlType
608
        {
609
            get
610
            {
611
                return (ControlType)GetValue(ControlTypeProperty);
612
            }
613
            set
614
            {
615
                SetValue(ControlTypeProperty, value);
616
            }
617
        }
618
        public int ControlType_No
619
        {
620
            get
621
            {
622
                return (int)GetValue(ControlType_NoProperty);
623
            }
624
            set
625
            {
626
                SetValue(ControlType_NoProperty, value);
627
            }
628
        }
629

    
630
        public string UserID
631
        {
632
            get { return (string)GetValue(UserIDProperty); }
633
            set
634
            {
635
                if (this.UserID != value)
636
                {
637
                    SetValue(UserIDProperty, value);
638
                    OnPropertyChanged("UserID");
639
                }
640
            }
641
        }
642

    
643
        public double CenterX
644
        {
645
            get { return (double)GetValue(CenterXProperty); }
646
            set
647
            {
648
                SetValue(CenterXProperty, value);
649
                OnPropertyChanged("CenterX");
650

    
651
            }
652
        }
653

    
654
        public double CenterY
655
        {
656
            get { return (double)GetValue(CenterYProperty); }
657
            set
658
            {
659
                SetValue(CenterYProperty, value);
660
                OnPropertyChanged("CenterY");
661
            }
662
        }
663

    
664
        public string Text
665
        {
666
            get { return (string)GetValue(TextProperty); }
667
            set
668
            {
669
                if (this.Text != value)
670
                {
671
                    SetValue(TextProperty, value);
672
                    OnPropertyChanged("Text");
673
                }
674
            }
675
        }
676

    
677
        public string OverViewText
678
        {
679
            get { return (string)GetValue(OverViewTextProperty); }
680
            set
681
            {
682
                if (this.OverViewText != value)
683
                {
684
                    SetValue(OverViewTextProperty, value);
685
                    OnPropertyChanged("OverViewText");
686
                }
687
            }
688
        }
689

    
690
        public Geometry OverViewPathData
691
        {
692
            get { return (Geometry)GetValue(OverViewPathDataProperty); }
693
            set
694
            {
695
                if (this.OverViewPathData != value)
696
                {
697
                    SetValue(OverViewPathDataProperty, value);
698
                    OnPropertyChanged("OverViewPathData");
699
                }
700
            }
701
        }
702

    
703
        public Visibility TextBoxVisibility
704
        {
705
            get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
706
            set
707
            {
708
                if (this.TextBoxVisibility != value)
709
                {
710
                    SetValue(TextBoxVisibilityProperty, value);
711
                    OnPropertyChanged("TextBoxVisibility");
712
                }
713
            }
714
        }
715

    
716

    
717
        public Visibility TextBlockVisibility
718
        {
719
            get { return (Visibility)GetValue(TextBlockVisibilityProperty); }
720
            set
721
            {
722
                if (this.TextBlockVisibility != value)
723
                {
724
                    SetValue(TextBlockVisibilityProperty, value);
725
                    OnPropertyChanged("TextBlockVisibility");
726
                }
727
            }
728
        }
729

    
730
        public Double TextSize
731
        {
732
            get { return (Double)GetValue(TextSizeProperty); }
733
            set
734
            {
735
                if (this.TextSize != value)
736
                {
737
                    SetValue(TextSizeProperty, value);
738
                    OnPropertyChanged("TextSize");
739
                }
740
            }
741
        }
742
        /*
743
        public SolidColorBrush FontColor
744
        {
745
            get { return (SolidColorBrush)GetValue(FontColorProperty); }
746
            set
747
            {
748
                if (this.FontColor != value)
749
                {
750
                    SetValue(FontColorProperty, value);
751
                    OnPropertyChanged("FontColor");
752
                }
753
            }
754
        }*/
755

    
756
        public SolidColorBrush BackColor
757
        {
758
            get { return (SolidColorBrush)GetValue(BackColorProperty); }
759
            set
760
            {
761
                if (this.BackColor != value)
762
                {
763
                    SetValue(BackColorProperty, value);
764
                    OnPropertyChanged("BackColor");
765
                }
766
            }
767
        }
768

    
769
        public SolidColorBrush BackInnerColor
770
        {
771
            get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
772
            set
773
            {
774
                if (this.BackInnerColor != value)
775
                {
776
                    SetValue(BackInnerColorProperty, value);
777
                    OnPropertyChanged("BackInnerColor");
778
                }
779
            }
780
        }
781

    
782

    
783

    
784
        public TextDecorationCollection UnderLine
785
        {
786
            get
787
            {
788
                return (TextDecorationCollection)GetValue(UnderLineProperty);
789
            }
790
            set
791
            {
792
                if (this.UnderLine != value)
793
                {
794
                    SetValue(UnderLineProperty, value);
795
                    OnPropertyChanged("UnderLine");
796
                }
797
            }
798
        }
799

    
800
        public double CanvasX
801
        {
802
            get { return (double)GetValue(CanvasXProperty); }
803
            set
804
            {
805
                if (this.CanvasX != value)
806
                {
807
                    SetValue(CanvasXProperty, value);
808
                    OnPropertyChanged("CanvasX");
809
                }
810
            }
811
        }
812

    
813
        public double CanvasY
814
        {
815
            get { return (double)GetValue(CanvasYProperty); }
816
            set
817
            {
818
                if (this.CanvasY != value)
819
                {
820
                    SetValue(CanvasYProperty, value);
821
                    OnPropertyChanged("CanvasY");
822
                }
823
            }
824
        }
825

    
826
        public Point EndPoint
827
        {
828
            get { return (Point)GetValue(EndPointProperty); }
829
            set
830
            {
831
                if (this.EndPoint != value)
832
                {
833
                    SetValue(EndPointProperty, value);
834
                    OnPropertyChanged("EndPoint");
835
                }
836
            }
837
        }
838

    
839
        public Point StartPoint
840
        {
841
            get { return (Point)GetValue(StartPointProperty); }
842
            set
843
            {
844
                if (this.StartPoint != value)
845
                {
846
                    SetValue(StartPointProperty, value);
847
                    OnPropertyChanged("StartPoint");
848
                }
849
            }
850
        }
851

    
852
        public FontStyle TextStyle
853
        {
854
            get { return (FontStyle)GetValue(TextStyleProperty); }
855
            set
856
            {
857
                if (this.TextStyle != value)
858
                {
859
                    SetValue(TextStyleProperty, value);
860
                    OnPropertyChanged("TextStyle");
861
                }
862
            }
863
        }
864

    
865
        public FontFamily TextFamily
866
        {
867
            get { return (FontFamily)GetValue(TextFamilyProperty); }
868
            set
869
            {
870
                if (this.TextFamily != value)
871
                {
872
                    SetValue(TextFamilyProperty, value);
873
                    OnPropertyChanged("TextFamily");
874
                }
875
            }
876
        }
877

    
878
        public FontWeight TextWeight
879
        {
880
            get { return (FontWeight)GetValue(TextWeightProperty); }
881
            set
882
            {
883
                if (this.TextWeight != value)
884
                {
885
                    SetValue(TextWeightProperty, value);
886
                    OnPropertyChanged("TextWeight");
887
                }
888
            }
889
        }
890

    
891
        public PaintSet Paint
892
        {
893
            get { return (PaintSet)GetValue(PaintProperty); }
894
            set
895
            {
896
                if (this.Paint != value)
897
                {
898
                    SetValue(PaintProperty, value);
899
                    OnPropertyChanged("Paint");
900
                }
901
            }
902
        }
903

    
904
        public PaintSet OverViewPaint
905
        {
906
            get { return (PaintSet)GetValue(OverViewPaintProperty); }
907
            set
908
            {
909
                if (this.OverViewPaint != value)
910
                {
911
                    SetValue(OverViewPaintProperty, value);
912
                    OnPropertyChanged("OverViewPaint");
913
                }
914
            }
915
        }
916

    
917
        double IPath.LineSize
918
        {
919
            get
920
            {
921
                return this.LineSize.Left;
922
            }
923
            set
924
            {
925
                this.LineSize = new Thickness(value);
926
                OnPropertyChanged("LineSize");
927
            }
928
        }
929

    
930

    
931
        public Geometry PathData
932
        {
933
            get { return (Geometry)GetValue(PathDataProperty); }
934
            set
935
            {
936
                SetValue(PathDataProperty, value);
937
                OnPropertyChanged("PathData");
938
            }
939
        }
940

    
941
        public Geometry PathDataInner
942
        {
943
            get { return (Geometry)GetValue(PathDataInnerProperty); }
944
            set
945
            {
946
                SetValue(PathDataInnerProperty, value);
947
                OnPropertyChanged("PathDataInner");
948
            }
949
        }
950

    
951
        public override double CommentAngle
952
        {
953
            get { return (double)GetValue(AngleProperty); }
954
            set
955
            {
956
                if (this.CommentAngle != value)
957
                {
958
                    SetValue(AngleProperty, value);
959

    
960
                    OnPropertyChanged("Angle");
961
                    UpdateLayout();
962
                }
963
            }
964
        }
965

    
966
        public bool IsHighLight
967
        {
968
            get { return (bool)GetValue(IsHighlightProperty); }
969
            set
970
            {
971
                if (this.IsHighLight != value)
972
                {
973
                    SetValue(IsHighlightProperty, value);
974
                    OnPropertyChanged("IsHighLight");
975
                }
976
            }
977
        }
978

    
979
        public List<Point> PointSet
980
        {
981
            get { return (List<Point>)GetValue(PointSetProperty); }
982
            set
983
            {
984
                SetValue(PointSetProperty, value);
985
                OnPropertyChanged("PointSet");
986
            }
987
        }
988

    
989
        #endregion Properties
990

    
991
        #region Properties
992

    
993
        private bool _IsEditingMode;
994
        public bool IsEditingMode
995
        {
996
            get
997
            {
998
                return _IsEditingMode;
999
            }
1000
            set
1001
            {
1002
                _IsEditingMode = value;
1003
                OnPropertyChanged("IsEditingMode");
1004
            }
1005
        }
1006

    
1007
        public PathGeometry PathGeometry
1008
        {
1009
            get { return (PathGeometry)GetValue(PathGeometryProperty); }
1010
            set
1011
            {
1012
                SetValue(PathGeometryProperty, value);
1013
                OnPropertyChanged("PathGeometry");
1014
            }
1015
        }
1016

    
1017
        private double _BoxWidth;
1018
        public double BoxWidth
1019
        {
1020
            get
1021
            {
1022
                return _BoxWidth;
1023
            }
1024
            set
1025
            {
1026
                _BoxWidth = value;
1027
                OnPropertyChanged("BoxWidth");
1028
            }
1029
        }
1030

    
1031
        private double _BoxHeight;
1032
        public double BoxHeight
1033
        {
1034
            get
1035
            {
1036
                return _BoxHeight;
1037
            }
1038
            set
1039
            {
1040
                _BoxHeight = value;
1041
                OnPropertyChanged("BoxHeight");
1042
            }
1043
        }
1044

    
1045
        #endregion
1046

    
1047
        #region CallBack Method
1048

    
1049
        private static void TextFamilyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
1050
        {
1051
            //var instance = (TextControl)d;
1052

    
1053
            //instance.SetFontFamily(e.NewValue as FontFamily);
1054
        }
1055

    
1056
        public static void SetPathGeometryChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1057
        {
1058
            var instance = (TextControl)sender;
1059

    
1060
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1061
            {
1062
                instance.SetValue(e.Property, e.NewValue);
1063
            }
1064
        }
1065

    
1066

    
1067
        public static void OnTextBoxVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1068
        {
1069
            var instance = (TextControl)sender;
1070

    
1071
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1072
            {
1073
                instance.SetValue(e.Property, e.NewValue);
1074
            }
1075
        }
1076

    
1077
        public static void OnTextBlockVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1078
        {
1079
            var instance = (TextControl)sender;
1080

    
1081
            if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
1082
            {
1083
                instance.SetValue(e.Property, e.NewValue);
1084
            }
1085
        }
1086

    
1087
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1088
        {
1089
            //var instance = (TextControl)sender;
1090

    
1091
            //if (e.OldValue != e.NewValue && instance.Base_Border != null)
1092
            //{
1093
            //    instance.SetValue(e.Property, e.NewValue);
1094

    
1095
            //    if (instance.IsSelected)
1096
            //    {
1097
            //        instance.StrokeColor = new SolidColorBrush(Colors.Blue);
1098
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Blue);
1099
            //    }
1100
            //    else
1101
            //    {
1102
            //        instance.StrokeColor = new SolidColorBrush(Colors.Red);
1103
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Red);
1104
            //        //instance.FontColor = new SolidColorBrush(Colors.Transparent);
1105
            //        //instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Transparent);
1106
            //    }
1107

    
1108
            //}
1109
        }
1110

    
1111
        public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1112
        {
1113
            var instance = (TextControl)sender;
1114

    
1115
            if (e.OldValue != e.NewValue && instance != null)
1116
            {
1117
                instance.SetValue(e.Property, e.NewValue);
1118

    
1119
                Canvas.SetLeft(instance, instance.CanvasX);
1120
                Canvas.SetTop(instance, instance.CanvasY);
1121
            }
1122
        }
1123

    
1124
        public static void OnIsEditingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1125
        {
1126
            var instance = (TextControl)sender;
1127

    
1128
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1129
            {
1130
                instance.SetValue(e.Property, e.NewValue);
1131

    
1132
                if (instance.EnableEditing)
1133
                {
1134
                    instance.EditingMode();
1135
                }
1136
                else
1137
                {
1138
                    instance.UnEditingMode();
1139
                }
1140
            }
1141
        }
1142
        public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1143
        {
1144
            var instance = (TextControl)sender;
1145

    
1146
            if (e.OldValue != e.NewValue)
1147
            {
1148
                instance.SetValue(e.Property, e.NewValue);
1149
            }
1150
        }
1151

    
1152
        public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1153
        {
1154
            var instance = (TextControl)sender;
1155

    
1156
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1157
            {
1158
                instance.SetValue(e.Property, e.NewValue);
1159
                //instance.DrawingCloud();
1160
            }
1161
        }
1162

    
1163
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1164
        {
1165
            var instance = (TextControl)sender;
1166
            if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
1167
            {
1168
                instance.SetValue(e.Property, e.NewValue);
1169
                //instance.DrawingCloud();
1170
            }
1171
        }
1172

    
1173
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
1174
        {
1175
            var instance = (TextControl)sender;
1176
            
1177
            if (e.OldValue != e.NewValue && instance.Base_TextBox != null)
1178
            {                       
1179
                instance.SetText();
1180
                instance.DrawingCloud();
1181
            }
1182

    
1183
        }
1184

    
1185
        #endregion CallBack Method
1186

    
1187
        protected void OnPropertyChanged(string propName)
1188
        {
1189
            if (PropertyChanged != null)
1190
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
1191

    
1192
            if (propName == "UnderLine" && Base_TextBlock != null)
1193
            {
1194
                Base_TextBlock.TextDecorations = UnderLine;
1195
                //(sender as TextControl).Base_TextBlock.TextDecorations = (sender as TextControl).UnderLine;
1196
            }
1197
        }
1198

    
1199
        /// <summary>
1200
        /// return textcontrols' area
1201
        /// </summary>
1202
        public override Rect ItemRect
1203
        {
1204
            get
1205
            {
1206
                Point start = new Point(this.CanvasX, this.CanvasY);
1207

    
1208
                Point length = new Point();
1209
                double angle = this.CommentAngle * Math.PI / 180;
1210
                double sin = Math.Sin(angle);
1211
                double cos = Math.Cos(angle);
1212

    
1213
                length.X = this.BoxWidth * cos - this.BoxHeight * sin;
1214
                length.Y = this.BoxWidth * sin + this.BoxHeight * cos;
1215

    
1216
                Point end = new Point(start.X + length.X, start.Y + length.Y);
1217
                return new Rect(start, end);
1218
            }
1219
        }
1220

    
1221
        /// <summary>
1222
        /// translate control along given dx,dy
1223
        /// </summary>
1224
        /// <param name="dx"></param>
1225
        /// <param name="dy"></param>
1226
        public override void OnTranslate(double dx, double dy)
1227
        {
1228
            //this.CanvasX = Canvas.GetLeft(this) + dx;
1229
            //this.CanvasY = Canvas.GetTop(this) + dy;
1230
            this.StartPoint = new Point(this.StartPoint.X + dx, this.StartPoint.Y + dy);
1231
            this.EndPoint = new Point(this.EndPoint.X + dx, this.EndPoint.Y + dy);
1232

    
1233
            this.SetValue(TextControl.CanvasXProperty, Canvas.GetLeft(this) + dx);
1234
            this.SetValue(TextControl.CanvasYProperty, Canvas.GetTop(this) + dy);
1235
        }
1236

    
1237
        /// <summary>
1238
        /// Serialize this
1239
        /// </summary>
1240
        /// <param name="sUserId"></param>
1241
        /// <returns></returns>
1242
        public override string Serialize()
1243
        {
1244
            using (S_TextControl STemp = new S_TextControl())
1245
            {
1246
                STemp.TransformPoint = "0|0";
1247
                STemp.SizeSet = String.Format("{0}|{1}", this.LineSize.Left.ToString(), this.TextSize.ToString());
1248
                STemp.Text = this.Text;
1249
                STemp.UserID = this.UserID;
1250
                STemp.FontColor = this.StrokeColor.Color.ToString();
1251
                //STemp.FontColor = "#FFFFFF00";
1252

    
1253
                if (this.StartPoint == new Point())
1254
                    STemp.StartPoint = new Point(this.CanvasX, this.CanvasY);
1255
                else
1256
                    STemp.StartPoint = this.StartPoint;
1257

    
1258
                STemp.EndPoint = this.EndPoint;
1259
                STemp.Opac = this.Opacity;
1260
                STemp.PointSet = this.PointSet;
1261
                STemp.Angle = this.CommentAngle;
1262
                STemp.paintMethod = this.ControlType_No;
1263
                STemp.BoxW = this.BoxWidth;
1264
                STemp.BoxH = this.BoxHeight;
1265
                STemp.isHighLight = this.IsHighLight;
1266
                STemp.Name = this.GetType().Name.ToString();
1267
                STemp.fontConfig = new List<string>()
1268
                            {
1269
                                this.TextFamily.FontName(),
1270
                                this.TextStyle.ToString(),
1271
                                this.TextWeight.ToString(),
1272
                            };
1273

    
1274

    
1275

    
1276
                if (this.UnderLine != null)
1277
                {
1278
                    STemp.fontConfig.Add("true");
1279
                }
1280

    
1281
                ///강인구 추가(2017.11.02)
1282
                ///Memo 추가
1283
                STemp.Memo = this.Memo;
1284

    
1285
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
1286
            }
1287
        }
1288

    
1289
        /// <summary>
1290
        /// create a textcontrol from given string
1291
        /// </summary>
1292
        /// <param name="str"></param>
1293
        /// <returns></returns>
1294
        public static TextControl FromString(string str, SolidColorBrush brush, string sProjectNo)
1295
        {
1296
            using (S_TextControl s = JsonSerializerHelper.JsonDeserialize<S_TextControl>(str))
1297
            {
1298
                string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1299
                TextControl instance = new TextControl()
1300
                {
1301
                    Text = s.Text,
1302
                    StartPoint = s.StartPoint,
1303
                    EndPoint = s.EndPoint,
1304
                    CanvasX = s.StartPoint.X,
1305
                    CanvasY = s.StartPoint.Y,
1306
                    BoxWidth = s.BoxW,
1307
                    BoxHeight = s.BoxH,
1308
                    ControlType_No = s.paintMethod,
1309
                    LineSize = new Thickness(Convert.ToDouble(data2.First())),
1310
                    TextSize = Convert.ToDouble(data2[1]),
1311
                    StrokeColor = brush,
1312
                    FontSize = 10,
1313
                    UserID = s.UserID,
1314
                    IsHighLight = s.isHighLight,
1315
                    CommentAngle = s.Angle,
1316
                    PointSet = s.PointSet,
1317
                    Opacity = s.Opac,
1318
                    
1319
                    TextFamily = Markus.Fonts.FontHelper.GetFontFamily(s.fontConfig[0]),
1320
                    //인구 추가(2018.04.17)
1321
                    TextStyle = StringToFont.ConFontStyle(s.fontConfig[1]),
1322
                    TextWeight = StringToFont.ConFontWeight(s.fontConfig[2]),
1323
                };
1324

    
1325
                if (s.fontConfig.Count() == 4)
1326
                {
1327
                    instance.UnderLine = TextDecorations.Underline;
1328
                }
1329

    
1330
                return instance;
1331
            }
1332
        }
1333
    }
1334
}
클립보드 이미지 추가 (최대 크기: 500 MB)