ViewContent.xaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <UserControl
  2. x:Class="PDF_Office.Views.ViewContent"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:Viewer="clr-namespace:ComPDFKitViewer.PdfViewer;assembly=ComPDFKit.Viewer"
  6. xmlns:convert="clr-namespace:PDF_Office.DataConvert"
  7. xmlns:cus="clr-namespace:PDF_Office.CustomControl"
  8. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  9. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  10. xmlns:local="clr-namespace:PDF_Office.Views"
  11. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  12. xmlns:prism="http://prismlibrary.com/"
  13. xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels"
  14. d:DataContext="{d:DesignInstance Type=viewmodels:ViewContentViewModel}"
  15. d:DesignHeight="450"
  16. d:DesignWidth="800"
  17. prism:ViewModelLocator.AutoWireViewModel="True"
  18. KeyDown="UserControl_KeyDown"
  19. mc:Ignorable="d">
  20. <i:Interaction.Triggers>
  21. <i:EventTrigger EventName="Loaded">
  22. <prism:InvokeCommandAction Command="{Binding Load}" />
  23. </i:EventTrigger>
  24. </i:Interaction.Triggers>
  25. <UserControl.Resources>
  26. <ResourceDictionary>
  27. <ResourceDictionary.MergedDictionaries>
  28. <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyle.xaml" />
  29. </ResourceDictionary.MergedDictionaries>
  30. <Style x:Key="MenuButtonStyle" TargetType="{x:Type Button}">
  31. <Setter Property="Width" Value="20" />
  32. <Setter Property="Height" Value="20" />
  33. </Style>
  34. <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
  35. </ResourceDictionary>
  36. </UserControl.Resources>
  37. <Grid>
  38. <Grid.RowDefinitions>
  39. <RowDefinition Name="HeadRow" Height="40" />
  40. <RowDefinition Name="ToolRow" Height="40" />
  41. <RowDefinition Height="*" />
  42. <RowDefinition Height="32" />
  43. </Grid.RowDefinitions>
  44. <Grid Visibility="{Binding GridVisibility}">
  45. <!-- 左边菜单按钮 -->
  46. <StackPanel
  47. HorizontalAlignment="Left"
  48. Orientation="Horizontal"
  49. Visibility="{Binding IsReadMode}">
  50. <Button
  51. Margin="8"
  52. Style="{StaticResource MenuButtonStyle}"
  53. ToolTip="File">
  54. <Path Data="M12.6172 12L15.8906 5.44531C15.9635 5.29948 16 5.14844 16 4.99219C16 4.85677 15.974 4.72917 15.9219 4.60938C15.8698 4.48958 15.7982 4.38411 15.707 4.29297C15.6159 4.20182 15.5091 4.13021 15.3867 4.07812C15.2643 4.02604 15.1354 4 15 4H13V2C13 1.85938 12.974 1.72917 12.9219 1.60938C12.8698 1.48958 12.7982 1.38411 12.707 1.29297C12.6159 1.20182 12.5104 1.13021 12.3906 1.07812C12.2708 1.02604 12.1406 1 12 1H6.25C6.08854 1 5.94661 0.97526 5.82422 0.925781C5.70182 0.876302 5.58724 0.815104 5.48047 0.742188C5.3737 0.669271 5.26823 0.588542 5.16406 0.5C5.0599 0.411458 4.94141 0.330729 4.80859 0.257812C4.67578 0.184896 4.52474 0.123698 4.35547 0.0742188C4.1862 0.0247396 3.98438 0 3.75 0H1C0.859375 0 0.729167 0.0260417 0.609375 0.078125C0.489583 0.130208 0.384115 0.201823 0.292969 0.292969C0.201823 0.384115 0.130208 0.489583 0.078125 0.609375C0.0260417 0.729167 0 0.859375 0 1V12H12.6172ZM1 9.38281V1H3.75C3.91146 1 4.05339 1.02474 4.17578 1.07422C4.29818 1.1237 4.41276 1.1849 4.51953 1.25781C4.6263 1.33073 4.73177 1.41146 4.83594 1.5C4.9401 1.58854 5.05859 1.66927 5.19141 1.74219C5.32422 1.8151 5.47526 1.8763 5.64453 1.92578C5.8138 1.97526 6.01562 2 6.25 2H12V4H4.3125C4.11979 4 3.94401 4.04948 3.78516 4.14844C3.6263 4.2474 3.5026 4.38281 3.41406 4.55469L1 9.38281ZM1.3125 11H12L15 5H4.3125L1.3125 11Z" Fill="#333333" />
  55. </Button>
  56. <Button
  57. Margin="8"
  58. Command="{Binding SaveFile}"
  59. IsEnabled="{Binding CanSave}"
  60. Style="{StaticResource MenuButtonStyle}"
  61. ToolTip="Save">
  62. <Path Data="M0 0H10.7071L14 3.29289V14H0V0ZM13 3.707L10.293 1H1V13H3V7H11V13H13V3.707ZM10 13H4V8H10V13ZM6 5V4H3V5H6Z" Fill="#333333" />
  63. </Button>
  64. <Button
  65. Margin="8"
  66. Command="{Binding UndoCommand}"
  67. IsEnabled="{Binding CanUndo}"
  68. Style="{StaticResource MenuButtonStyle}"
  69. ToolTip="Undo">
  70. <Path Data="M3.02773 1.12105L2 1.1197L2.00703 6.05868L7.14571 6.06544L7.1443 5.07764L3.95607 5.07345L5.96547 3.14214L6.1139 3.0063C7.72531 1.60263 10.2166 1.64791 11.7713 3.14214C13.3745 4.68306 13.3745 7.18139 11.7713 8.72231L5.96547 14.3025L6.69119 15L12.497 9.41983L12.651 9.26532C14.4996 7.33014 14.4483 4.32008 12.497 2.44461C10.4929 0.518462 7.24377 0.518462 5.23974 2.44461L3.03264 4.56595L3.02773 1.12105Z" Fill="#333333" />
  71. </Button>
  72. <Button
  73. Margin="8"
  74. Command="{Binding RedoCommand}"
  75. IsEnabled="{Binding CanRedo}"
  76. Style="{StaticResource MenuButtonStyle}"
  77. ToolTip="Redo">
  78. <Path Data="M10.9737 0.118216L12 0.116865L11.993 5.05009L6.86172 5.05685L6.86312 4.0702L10.0425 4.06602L8.03792 2.13876L7.88969 2.00309C6.28039 0.601253 3.78921 0.649819 2.23256 2.1464C0.627259 3.68974 0.623702 6.18858 2.22461 7.72771L8.02203 13.3014L7.29536 14L1.49795 8.42633L1.34413 8.27199C-0.501568 6.33885 -0.445937 3.3281 1.50788 1.44969C3.51451 -0.479494 6.76344 -0.483769 8.76458 1.44014L10.9688 3.55934L10.9737 0.118216Z" Fill="#333333" />
  79. </Button>
  80. </StackPanel>
  81. <!-- 右边菜单按钮 -->
  82. <StackPanel
  83. HorizontalAlignment="Right"
  84. Orientation="Horizontal"
  85. Visibility="{Binding IsReadMode}">
  86. <Button
  87. Margin="8"
  88. Style="{StaticResource MenuButtonStyle}"
  89. ToolTip="Print" Command="{Binding PrintCommand}">
  90. <Path Data="M12 6V0H4V6H1.5L1.35554 6.00687C0.594888 6.07955 0 6.7203 0 7.5V14H4V16H12V14H16V7.5L15.9931 7.35554C15.9204 6.59489 15.2797 6 14.5 6H12ZM4 10V13H1V7.5L1.00806 7.41012C1.05039 7.17688 1.25454 7 1.5 7H14.5L14.5899 7.00806C14.8231 7.05039 15 7.25454 15 7.5V13H12V10H4ZM11 6V1H5V6H11ZM11 11H5V15H11V11ZM3 8H2V9H3V8Z" Fill="#333333" />
  91. </Button>
  92. <Button
  93. Margin="8"
  94. Style="{StaticResource MenuButtonStyle}"
  95. ToolTip="Share">
  96. <Path Data="M10 11L15.5 5.5L10 0V3C9.35417 3 8.73307 3.08333 8.13672 3.25C7.54036 3.41667 6.98307 3.65234 6.46484 3.95703C5.94661 4.26172 5.47526 4.6263 5.05078 5.05078C4.6263 5.47526 4.26172 5.94661 3.95703 6.46484C3.65234 6.98307 3.41667 7.54036 3.25 8.13672C3.08333 8.73307 3 9.35417 3 10V11C3.45833 10.526 3.95703 10.1029 4.49609 9.73047C5.03516 9.35807 5.60156 9.04297 6.19531 8.78516C6.78906 8.52734 7.40495 8.33203 8.04297 8.19922C8.68099 8.06641 9.33333 8 10 8V11ZM4.125 8.76562C4.22396 8.28646 4.37891 7.82943 4.58984 7.39453C4.80078 6.95964 5.05859 6.55599 5.36328 6.18359C5.66797 5.8112 6.01432 5.47917 6.40234 5.1875C6.79036 4.89583 7.21094 4.65625 7.66406 4.46875C7.96094 4.34375 8.24219 4.2487 8.50781 4.18359C8.77344 4.11849 9.03776 4.07292 9.30078 4.04688C9.5638 4.02083 9.72396 4.00651 10 4.00391C10.276 4.0013 10.6823 4 11 4V2.41406L14 5.5L11 8.5V7H10C8.94792 7 7.92448 7.14844 6.92969 7.44531C5.9349 7.74219 5 8.18229 4.125 8.76562ZM1 14V4H0V15H16V12H15V14H1Z" Fill="#333333" />
  97. </Button>
  98. <ToggleButton
  99. Name="TbtnProperty"
  100. Width="20"
  101. Height="20"
  102. Margin="8"
  103. IsChecked="{Binding IsPropertyOpen}"
  104. ToolTip="Property" />
  105. </StackPanel>
  106. <TabControl
  107. x:Name="ToolTabControl"
  108. Grid.Row="0"
  109. Grid.RowSpan="2"
  110. HorizontalAlignment="Center"
  111. VerticalAlignment="Top"
  112. BorderThickness="0"
  113. SelectedIndex="{Binding TabSelectedIndex, Mode=TwoWay}"
  114. Style="{StaticResource TabControlWithUnderLineStyle}"
  115. Visibility="{Binding IsReadMode}">
  116. <cus:IconAndTextTabItem
  117. x:Name="TabItemAnnotation"
  118. Header="注释"
  119. Style="{StaticResource TabItem_WithUnderLineStyle}">
  120. <Grid Grid.Row="1" Height="40" />
  121. </cus:IconAndTextTabItem>
  122. <cus:IconAndTextTabItem
  123. x:Name="TabItemPageEdit"
  124. Header="页面"
  125. Style="{StaticResource TabItem_WithUnderLineStyle}" />
  126. <cus:IconAndTextTabItem
  127. x:Name="TabItemConvert"
  128. Header="转换"
  129. Style="{StaticResource TabItem_WithUnderLineStyle}" />
  130. <cus:IconAndTextTabItem
  131. x:Name="TabItemScan"
  132. Header="扫描和OCR"
  133. Style="{StaticResource TabItem_WithUnderLineStyle}">
  134. <Grid Grid.Row="1" Height="40" />
  135. </cus:IconAndTextTabItem>
  136. <cus:IconAndTextTabItem
  137. x:Name="TabItemEdit"
  138. Height="40"
  139. Header="编辑"
  140. Style="{StaticResource TabItem_WithUnderLineStyle}">
  141. <Grid Grid.Row="1" Height="40" />
  142. </cus:IconAndTextTabItem>
  143. <cus:IconAndTextTabItem
  144. x:Name="TabItemForm"
  145. Height="40"
  146. Header="表单"
  147. Style="{StaticResource TabItem_WithUnderLineStyle}">
  148. <Grid Grid.Row="1" Height="40" />
  149. </cus:IconAndTextTabItem>
  150. <cus:IconAndTextTabItem
  151. x:Name="TabItemFill"
  152. Height="40"
  153. Header="填写与签名"
  154. Style="{StaticResource TabItem_WithUnderLineStyle}">
  155. <Grid Grid.Row="1" Height="40" />
  156. </cus:IconAndTextTabItem>
  157. <cus:IconAndTextTabItem
  158. x:Name="TabItemTool"
  159. Height="40"
  160. Header="工具"
  161. Style="{StaticResource TabItem_WithUnderLineStyle}">
  162. <Grid Grid.Row="1" Height="40" />
  163. </cus:IconAndTextTabItem>
  164. <i:Interaction.Triggers>
  165. <i:EventTrigger EventName="SelectionChanged">
  166. <i:InvokeCommandAction Command="{Binding TabControlSelectionChangedCommand}" PassEventArgsToCommand="True" />
  167. </i:EventTrigger>
  168. </i:Interaction.Triggers>
  169. </TabControl>
  170. </Grid>
  171. <!-- 底部工具栏 -->
  172. <ContentControl Grid.Row="3" prism:RegionManager.RegionName="{Binding BottomToolRegionName}" />
  173. <!-- 专门用来显示菜单二级工具栏 -->
  174. <!-- 调整工具栏的显示图层,方便阅读模式处理 -->
  175. <ContentControl
  176. Name="ContentToolsBar"
  177. Grid.Row="{Binding GridToolRow}"
  178. prism:RegionManager.RegionName="{Binding ToolsBarContentRegionName}"
  179. Visibility="{Binding ToolsBarContentVisible}" />
  180. <ContentControl
  181. Name="ContentConverterBar"
  182. Grid.Row="{Binding GridToolRow}"
  183. prism:RegionManager.RegionName="{Binding ConverterBarContentRegionName}"
  184. Visibility="{Binding ConverterBarContentVisible}" />
  185. <ContentControl
  186. Name="TextEditContentBar"
  187. Grid.Row="{Binding GridToolRow}"
  188. prism:RegionManager.RegionName="{Binding TextEditContentRegionName}"
  189. Visibility="{Binding TextEditToolContentVisible}" />
  190. <Grid Name="DocumentView" Grid.Row="2">
  191. <Grid.ColumnDefinitions>
  192. <ColumnDefinition
  193. x:Name="BOTACloumn"
  194. Width="{Binding BOTAWidth, Mode=TwoWay}"
  195. MinWidth="48"
  196. MaxWidth="400" />
  197. <ColumnDefinition Width="12" />
  198. <ColumnDefinition
  199. Name="ViewerColumn"
  200. Width="*"
  201. MinWidth="200" />
  202. <ColumnDefinition Name="PropertyColumn" MinWidth="0">
  203. <ColumnDefinition.Style>
  204. <Style TargetType="{x:Type ColumnDefinition}">
  205. <Style.Triggers>
  206. <DataTrigger Binding="{Binding ElementName=TbtnProperty, Path=IsChecked}" Value="True">
  207. <Setter Property="Width" Value="260" />
  208. </DataTrigger>
  209. <DataTrigger Binding="{Binding ElementName=TbtnProperty, Path=IsChecked}" Value="False">
  210. <Setter Property="Width" Value="0" />
  211. </DataTrigger>
  212. </Style.Triggers>
  213. </Style>
  214. </ColumnDefinition.Style>
  215. </ColumnDefinition>
  216. </Grid.ColumnDefinitions>
  217. <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" />
  218. <GridSplitter
  219. Grid.Column="1"
  220. Width="12"
  221. FocusVisualStyle="{x:Null}"
  222. ResizeBehavior="PreviousAndNext"
  223. ShowsPreview="True" />
  224. <ContentControl
  225. x:Name="PDFViewerContent"
  226. Grid.Column="2"
  227. HorizontalAlignment="Stretch"
  228. prism:RegionManager.RegionName="{Binding ViwerRegionName}" />
  229. <ScrollViewer Grid.Column="4" VerticalScrollBarVisibility="Auto">
  230. <ContentControl prism:RegionManager.RegionName="{Binding PropertyRegionName}" />
  231. </ScrollViewer>
  232. </Grid>
  233. <!-- 用于显示页面编辑、水印、背景、标记密文等功能的区域 -->
  234. <ContentControl
  235. Name="ContentTool"
  236. Grid.Row="{Binding GridToolRow}"
  237. Grid.RowSpan="{Binding GridToolRowSpan}"
  238. prism:RegionManager.RegionName="{Binding ToolContentRegionName}"
  239. Visibility="{Binding ToolContentVisible}" />
  240. <cus:LoadingControl Grid.RowSpan="3" Visibility="{Binding IsLoading}" />
  241. </Grid>
  242. </UserControl>