TextEditPropertyViewModel.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. using ComPDFKitViewer;
  2. using ComPDFKitViewer.PdfViewer;
  3. using Microsoft.Win32;
  4. using PDF_Office.Model;
  5. using PDF_Office.Model.PropertyPanel.AnnotPanel;
  6. using Prism.Commands;
  7. using Prism.Mvvm;
  8. using Prism.Regions;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows;
  15. using System.Windows.Controls;
  16. using System.Windows.Input;
  17. using System.Windows.Media;
  18. namespace PDF_Office.ViewModels.PropertyPanel
  19. {
  20. public class TextEditPropertyViewModel : BindableBase, INavigationAware
  21. {
  22. #region 属性
  23. #region 编辑PDF全局
  24. private bool _isLayoutAvgAlign = false;
  25. public bool IsLayoutAvgAlign
  26. {
  27. get { return _isLayoutAvgAlign; }
  28. set
  29. {
  30. SetProperty(ref _isLayoutAvgAlign, value);
  31. }
  32. }
  33. private bool _isLayoutAlign = false;
  34. public bool IsLayoutAlign
  35. {
  36. get { return _isLayoutAlign; }
  37. set
  38. {
  39. SetProperty(ref _isLayoutAlign, value);
  40. }
  41. }
  42. private bool _isTextEdit = true;
  43. public bool IsTextEdit
  44. {
  45. get { return _isTextEdit; }
  46. set
  47. {
  48. SetProperty(ref _isTextEdit, value);
  49. }
  50. }
  51. #endregion
  52. #region 文本属性
  53. private double _angle;
  54. public double Angle
  55. {
  56. get { return _angle; }
  57. set
  58. {
  59. SetProperty(ref _angle, value);
  60. }
  61. }
  62. private Brush selectColor = new SolidColorBrush(Colors.Black);
  63. public Brush SelectColor
  64. {
  65. get { return selectColor; }
  66. set
  67. {
  68. SetProperty(ref selectColor, value);
  69. if (TextEditEvent != null)
  70. {
  71. bool isok = TextEditEvent.FontColor.A != (SelectColor as SolidColorBrush).Color.A ||
  72. TextEditEvent.FontColor.B != (SelectColor as SolidColorBrush).Color.B ||
  73. TextEditEvent.FontColor.G != (SelectColor as SolidColorBrush).Color.G ||
  74. TextEditEvent.FontColor.R != (SelectColor as SolidColorBrush).Color.R;
  75. if (isok)
  76. {
  77. TextEditEvent.FontColor = (SelectColor as SolidColorBrush).Color;
  78. TextEditEvent.UpdatePDFEditByEventArgs();
  79. }
  80. }
  81. }
  82. }
  83. private FontFamily fontFamily = new FontFamily("Courier");
  84. public FontFamily TextFontFamily
  85. {
  86. get { return fontFamily; }
  87. set
  88. {
  89. SetProperty(ref fontFamily, value);
  90. if (TextEditEvent != null)
  91. {
  92. TextEditEvent.FontFamily = fontFamily;
  93. TextEditEvent.UpdatePDFEditByEventArgs();
  94. }
  95. }
  96. }
  97. private FontWeight fontWeights = FontWeights.Normal;
  98. public FontWeight TextFontWeights
  99. {
  100. get { return fontWeights; }
  101. set
  102. {
  103. SetProperty(ref fontWeights, value);
  104. if (TextEditEvent != null)
  105. {
  106. TextEditEvent.FontWeight = fontWeights;
  107. TextEditEvent.UpdatePDFEditByEventArgs();
  108. }
  109. }
  110. }
  111. private FontStyle fontStyle = FontStyles.Normal;
  112. public FontStyle TextFontStyle
  113. {
  114. get { return fontStyle; }
  115. set
  116. {
  117. SetProperty(ref fontStyle, value);
  118. if (TextEditEvent != null)
  119. {
  120. TextEditEvent.FontStyle = fontStyle;
  121. TextEditEvent.UpdatePDFEditByEventArgs();
  122. }
  123. }
  124. }
  125. private int fontSize = 24;
  126. public int TextFontSize
  127. {
  128. get { return fontSize; }
  129. set
  130. {
  131. SetProperty(ref fontSize, value);
  132. if (TextEditEvent != null)
  133. {
  134. TextEditEvent.FontSize = fontSize;
  135. TextEditEvent.UpdatePDFEditByEventArgs();
  136. }
  137. }
  138. }
  139. private List<FontStyleItem> fontStyleList = new List<FontStyleItem>();
  140. public List<FontStyleItem> FontStyleList
  141. {
  142. get { return fontStyleList; }
  143. set
  144. {
  145. SetProperty(ref fontStyleList, value);
  146. }
  147. }
  148. #endregion
  149. #region 图像属性
  150. private bool _isCrop = false;
  151. public bool IsCrop
  152. {
  153. get { return _isCrop; }
  154. set
  155. {
  156. SetProperty(ref _isCrop, value);
  157. }
  158. }
  159. private System.Windows.Media.Imaging.BitmapSource _currentImg;
  160. public System.Windows.Media.Imaging.BitmapSource CurrentImg
  161. {
  162. get { return _currentImg; }
  163. set
  164. {
  165. SetProperty(ref _currentImg, value);
  166. }
  167. }
  168. #endregion
  169. #endregion
  170. #region Command
  171. #region 文本Command
  172. public DelegateCommand AddTextCommand { get; set; }
  173. public DelegateCommand AddImgCommand { get; set; }
  174. public DelegateCommand<object> SelectedColorCommand { get; set; }
  175. public DelegateCommand<object> SelectedFontStyleCommand { get; set; }
  176. public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
  177. public DelegateCommand<object> FontStyleChangedCommand { get; set; }
  178. public DelegateCommand<object> FontSizeChangedCommand { get; set; }
  179. public DelegateCommand<object> TextAlignCheckedCommand { get; set; }
  180. #endregion
  181. #region 图像Command
  182. public DelegateCommand ReplaceImgCommand { get; set; }
  183. public DelegateCommand ExportImgCommand { get; set; }
  184. public DelegateCommand CropImgCommand { get; set; }
  185. public DelegateCommand<object> ImgAlignCheckedCommand { get; set; }
  186. /// <summary>
  187. /// 逆时针旋转
  188. /// </summary>
  189. public DelegateCommand AntiClockwiseCommand { get; set; }
  190. /// <summary>
  191. /// 顺时针旋转
  192. /// </summary>
  193. public DelegateCommand ClockwiseCommand { get; set; }
  194. public DelegateCommand CropModeCommand { get; set; }
  195. public DelegateCommand CancelCropCommand { get; set; }
  196. #endregion
  197. public event EventHandler ClearCheckedAglin;
  198. #endregion
  199. private ComPDFKitViewer.PDFEditEvent TextEditEvent;
  200. public TextEditPropertyViewModel()
  201. {
  202. InitVariable();
  203. InitCommand();
  204. }
  205. private void InitVariable()
  206. {
  207. InitFontStyles();
  208. }
  209. private void InitFontStyles()
  210. {
  211. FontStyleList = LoadFontStyle.Load();
  212. }
  213. private void InitCommand()
  214. {
  215. AddTextCommand = new DelegateCommand(AddText);
  216. AddImgCommand = new DelegateCommand(AddImg);
  217. ReplaceImgCommand = new DelegateCommand(ReplaceImg);
  218. ExportImgCommand = new DelegateCommand(ExportImg);
  219. CropImgCommand = new DelegateCommand(CropImg);
  220. ImgAlignCheckedCommand = new DelegateCommand<object>(ImgAlignChecked);
  221. SelectedColorCommand = new DelegateCommand<object>(SelectedColor);
  222. SelectedFontStyleCommand = new DelegateCommand<object>(SelectedFontStyle);
  223. FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged);
  224. FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged);
  225. FontSizeChangedCommand = new DelegateCommand<object>(FontSizeChanged);
  226. TextAlignCheckedCommand = new DelegateCommand<object>(TextAlignChecked);
  227. AntiClockwiseCommand = new DelegateCommand(AntiClockwise);
  228. ClockwiseCommand = new DelegateCommand(Clockwise);
  229. CropModeCommand = new DelegateCommand(CropMode);
  230. CancelCropCommand = new DelegateCommand(CancelCropImg);
  231. }
  232. private void ImgAlignChecked(object obj)
  233. {
  234. if (obj != null)
  235. {
  236. switch((string)obj)
  237. {
  238. case "AlignLeft":
  239. PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
  240. break;
  241. case "AlignHorizonCenter":
  242. PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
  243. break;
  244. case "AlignRight":
  245. PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
  246. break;
  247. case "DistributeHorizontal":
  248. PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
  249. break;
  250. case "AlignTop":
  251. PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
  252. break;
  253. case "AlignVerticalCenter":
  254. PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
  255. break;
  256. case "AlignBottom":
  257. PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
  258. break;
  259. case "DistributeVertical":
  260. PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
  261. break;
  262. }
  263. }
  264. }
  265. private void CancelCropImg()
  266. {
  267. if (TextEditEvent != null)
  268. {
  269. TextEditEvent.ClipImage = false;
  270. TextEditEvent.CancelClip();
  271. TextEditEvent.UpdatePDFEditByEventArgs();
  272. IsCrop = false;
  273. }
  274. }
  275. private void CropImg()
  276. {
  277. if(TextEditEvent != null)
  278. {
  279. TextEditEvent.SaveClip();
  280. TextEditEvent.ClipImage = false;
  281. TextEditEvent.UpdatePDFEditByEventArgs();
  282. IsCrop = false;
  283. }
  284. }
  285. private void ExportImg()
  286. {
  287. if (PDFViewer == null || TextEditEvent == null || TextEditEvent.EditType != ComPDFKit.PDFPage.CPDFEditType.EditImage) return;
  288. //SaveFileDialog saveFileDialog = new SaveFileDialog();
  289. //saveFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
  290. //saveFileDialog.FileName = "编辑PDF导出图片";
  291. System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();
  292. folder.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
  293. if (folder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  294. {
  295. if (string.IsNullOrEmpty(folder.SelectedPath))
  296. return;
  297. var keyValueList = PDFViewer.GetSelectedImages();
  298. int i = 0;
  299. foreach (var bitmap in keyValueList)
  300. {
  301. foreach(var bitmapItem in bitmap.Value)
  302. {
  303. bitmapItem.Save(folder.SelectedPath + "\\" + i + ".png", System.Drawing.Imaging.ImageFormat.Png);
  304. i++;
  305. }
  306. }
  307. }
  308. }
  309. private void AddImg()
  310. {
  311. OpenFileDialog openFileDialog = new OpenFileDialog();
  312. openFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
  313. openFileDialog.Multiselect = true;
  314. if ((bool)openFileDialog.ShowDialog())
  315. {
  316. if (string.IsNullOrEmpty(openFileDialog.FileName) == false)
  317. {
  318. PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
  319. PDFViewer.AddPDFEditImage(openFileDialog.FileName);
  320. }
  321. }
  322. }
  323. private void ReplaceImg()
  324. {
  325. OpenFileDialog openFileDialog = new OpenFileDialog();
  326. openFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
  327. openFileDialog.Multiselect = true;
  328. if ((bool)openFileDialog.ShowDialog())
  329. {
  330. if (string.IsNullOrEmpty(openFileDialog.FileName) == false)
  331. {
  332. PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
  333. TextEditEvent.ReplaceImagePath = openFileDialog.FileName;
  334. TextEditEvent.UpdatePDFEditByEventArgs();
  335. }
  336. }
  337. }
  338. private void AddText()
  339. {
  340. PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
  341. }
  342. private void TextAlignChecked(object obj)
  343. {
  344. if((string)obj != null && TextEditEvent != null)
  345. {
  346. switch((string)obj)
  347. {
  348. case "AlignLeft":
  349. TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignLeft;
  350. break;
  351. case "AlignCenter":
  352. TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignMiddle;
  353. break;
  354. case "AlignRight":
  355. TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignRight;
  356. break;
  357. case "Align":
  358. TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignNone;
  359. break;
  360. }
  361. TextEditEvent.UpdatePDFEditByEventArgs();
  362. }
  363. }
  364. private void Clockwise()
  365. {
  366. Angle = TextEditEvent.Rotate = TextEditEvent.Rotate + 90;
  367. TextEditEvent.UpdatePDFEditByEventArgs();
  368. }
  369. private void AntiClockwise()
  370. {
  371. Angle = TextEditEvent.Rotate = TextEditEvent.Rotate - 90;
  372. TextEditEvent.UpdatePDFEditByEventArgs();
  373. }
  374. private void CropMode()
  375. {
  376. IsCrop = true;
  377. if(TextEditEvent != null)
  378. {
  379. TextEditEvent.ClipImage = true;
  380. TextEditEvent.UpdatePDFEditByEventArgs();
  381. }
  382. }
  383. private void SelectedColor(object obj)
  384. {
  385. if (obj != null)
  386. {
  387. var colorValue = (Color)obj;
  388. if (colorValue != null)
  389. {
  390. SelectColor = new SolidColorBrush(colorValue);
  391. }
  392. }
  393. }
  394. private void SelectedFontStyle(object obj)
  395. {
  396. if (obj != null && (FontStyleItem)obj != null)
  397. {
  398. var item = (FontStyleItem)obj;
  399. }
  400. }
  401. private void FontFamilyChanged(object obj)
  402. {
  403. if (obj != null)
  404. {
  405. if ((int)obj > -1)
  406. {
  407. if ((int)obj == 0)
  408. {
  409. TextFontFamily = new FontFamily("Courier");
  410. }
  411. if ((int)obj == 1)
  412. {
  413. TextFontFamily = new FontFamily("Helvetica");
  414. }
  415. if ((int)obj == 2)
  416. {
  417. TextFontFamily = new FontFamily("Times");
  418. }
  419. }
  420. }
  421. }
  422. private void FontStyleChanged(object obj)
  423. {
  424. if (obj != null)
  425. {
  426. var item = (ComboBoxItem)obj;
  427. var content = (string)item.Content;
  428. if (content != null)
  429. {
  430. if (content == "Regular")
  431. {
  432. TextFontWeights = FontWeights.Normal;
  433. TextFontStyle = FontStyles.Normal;
  434. }
  435. if (content == "Bold")
  436. {
  437. TextFontWeights = FontWeights.Bold;
  438. TextFontStyle = FontStyles.Normal;
  439. }
  440. if (content == "Italic")
  441. {
  442. TextFontWeights = FontWeights.Normal;
  443. TextFontStyle = FontStyles.Italic;
  444. }
  445. if (content == "Bold Italic")
  446. {
  447. TextFontWeights = FontWeights.Bold;
  448. TextFontStyle = FontStyles.Italic;
  449. }
  450. }
  451. }
  452. }
  453. private void FontSizeChanged(object obj)
  454. {
  455. if (obj != null)
  456. {
  457. var item = (ComboBoxItem)obj;
  458. var content = (string)item.Content;
  459. if (content != null)
  460. {
  461. var intData = int.Parse(content);
  462. TextFontSize = intData;
  463. }
  464. }
  465. }
  466. private CPDFViewer PDFViewer;
  467. public void OnNavigatedTo(NavigationContext navigationContext)
  468. {
  469. navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
  470. if (PDFViewer != null)
  471. {
  472. PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
  473. PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
  474. PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
  475. PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
  476. }
  477. }
  478. public bool IsNavigationTarget(NavigationContext navigationContext)
  479. {
  480. return true;
  481. }
  482. public void OnNavigatedFrom(NavigationContext navigationContext)
  483. {
  484. }
  485. private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
  486. {
  487. if (e == null)
  488. return;
  489. switch (e.CommandType)
  490. {
  491. case CommandType.Context:
  492. if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
  493. {
  494. e.PopupMenu = EmptyStateMenu(sender);
  495. if (e.PopupMenu != null)
  496. {
  497. e.Handle = true;
  498. }
  499. }
  500. else if(e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
  501. {
  502. e.PopupMenu = SelectPDFEdit(sender);
  503. if (e.PopupMenu != null)
  504. {
  505. e.Handle = true;
  506. }
  507. }
  508. else if(e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
  509. {
  510. // e.SelectText
  511. }
  512. break;
  513. default:
  514. e.DoCommand();
  515. break;
  516. }
  517. }
  518. private ContextMenu EmptyStateMenu(object sender)
  519. {
  520. var popMenu = App.Current.FindResource("NoneMenu") as ContextMenu;
  521. if (popMenu != null && popMenu.Items.Count == 3)
  522. {
  523. //复制
  524. MenuItem menuItem = popMenu.Items[0] as MenuItem;
  525. menuItem.CommandTarget = (UIElement)sender;
  526. menuItem.Command = ApplicationCommands.Paste;
  527. //添加文本
  528. menuItem = popMenu.Items[1] as MenuItem;
  529. menuItem.CommandTarget = (UIElement)sender;
  530. menuItem.Command = AddTextCommand;
  531. //添加图像
  532. menuItem = popMenu.Items[2] as MenuItem;
  533. menuItem.CommandTarget = (UIElement)sender;
  534. menuItem.Command = AddImgCommand;
  535. }
  536. return popMenu;
  537. }
  538. private ContextMenu SelectPDFEdit(object sender)
  539. {
  540. var popMenu = App.Current.FindResource("SelectImgMenu") as ContextMenu;
  541. if (popMenu != null && popMenu.Items.Count == 7)
  542. {
  543. //复制
  544. MenuItem menuItem = popMenu.Items[0] as MenuItem;
  545. menuItem.CommandTarget = (UIElement)sender;
  546. menuItem.Command = ApplicationCommands.Copy;
  547. //剪切
  548. menuItem = popMenu.Items[1] as MenuItem;
  549. menuItem.CommandTarget = (UIElement)sender;
  550. menuItem.Command = ApplicationCommands.Cut;
  551. //粘贴
  552. menuItem = popMenu.Items[2] as MenuItem;
  553. menuItem.CommandTarget = (UIElement)sender;
  554. menuItem.Command = ApplicationCommands.Paste;
  555. //删除
  556. menuItem = popMenu.Items[3] as MenuItem;
  557. menuItem.CommandTarget = (UIElement)sender;
  558. menuItem.Command = ApplicationCommands.Delete;
  559. //裁剪
  560. menuItem = popMenu.Items[4] as MenuItem;
  561. menuItem.CommandTarget = (UIElement)sender;
  562. menuItem.Command = CropModeCommand;
  563. //替换
  564. menuItem = popMenu.Items[5] as MenuItem;
  565. menuItem.CommandTarget = (UIElement)sender;
  566. menuItem.Command = ReplaceImgCommand;
  567. //导出
  568. menuItem = popMenu.Items[6] as MenuItem;
  569. menuItem.CommandTarget = (UIElement)sender;
  570. menuItem.Command = ExportImgCommand;
  571. }
  572. return popMenu;
  573. }
  574. private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
  575. {
  576. if(e != null && e.Count > 0)
  577. {
  578. ReLoadLayoutAlign(e.Count);
  579. IsTextEdit = (e[0].EditType == ComPDFKit.PDFPage.CPDFEditType.EditText);
  580. TextEditEvent = e[0];
  581. if (IsTextEdit == false)
  582. {
  583. var list = PDFViewer.GetSelectedImages();
  584. if(list != null && list.Count > 0)
  585. {
  586. System.Drawing.Bitmap bitmap = null;
  587. foreach (var item in list)
  588. {
  589. if(item.Value.Count>0)
  590. {
  591. bitmap = item.Value[0];
  592. break;
  593. }
  594. }
  595. if(bitmap != null)
  596. {
  597. IntPtr ip = bitmap.GetHbitmap();
  598. System.Windows.Media.Imaging.BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip, IntPtr.Zero, Int32Rect.Empty,
  599. System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
  600. CurrentImg = bitmapSource;
  601. }
  602. }
  603. }
  604. }
  605. else
  606. {
  607. IsLayoutAlign = false;
  608. IsLayoutAvgAlign = false;
  609. ClearCheckedAglin?.Invoke(null, null);
  610. IsTextEdit = true;
  611. }
  612. }
  613. private void ReLoadLayoutAlign(int count)
  614. {
  615. if (count >= 2)
  616. IsLayoutAlign = true;
  617. else
  618. IsLayoutAlign = false;
  619. if (count >= 3)
  620. IsLayoutAvgAlign = true;
  621. else
  622. IsLayoutAvgAlign = false;
  623. }
  624. }
  625. }