123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457 |
- <UserControl
- x:Class="PDF_Master.Views.PageEdit.PageEditContent"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:convert="clr-namespace:PDF_Master.DataConvert"
- xmlns:cus="clr-namespace:PDF_Master.CustomControl"
- xmlns:cussys="clr-namespace:PDF_Master.CustomControl.SystemControl"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
- xmlns:local="clr-namespace:PDF_Master.Views.PageEdit"
- xmlns:mainpage="clr-namespace:PDF_Master.Strings.MainPage"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:model="clr-namespace:PDF_Master.Model"
- xmlns:pageedit="clr-namespace:PDF_Master.Model.PageEdit"
- xmlns:pageedit1="clr-namespace:PDF_Master.ViewModels.PageEdit"
- xmlns:prism="http://prismlibrary.com/"
- xmlns:viewmodel="clr-namespace:PDF_Master.ViewModels.PageEdit"
- xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
- Name="PageEdit"
- d:DataContext="{d:DesignInstance Type=pageedit1:PageEditContentViewModel}"
- d:DesignHeight="450"
- d:DesignWidth="800"
- prism:ViewModelLocator.AutoWireViewModel="True"
- FocusVisualStyle="{x:Null}"
- IsVisibleChanged="PageEdit_IsVisibleChanged"
- SizeChanged="PageEdit_SizeChanged"
- mc:Ignorable="d">
- <UserControl.Resources>
- <ResourceDictionary>
- <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
- <convert:UnVisivleConvert x:Key="UnVisibleConvert" />
- <DataTemplate x:Key="PageEditListBoxItemTemplate" DataType="{x:Type pageedit:PageEditItem}">
- <StackPanel AllowDrop="True">
- <Border
- Name="BdBorder"
- VerticalAlignment="Top"
- BorderBrush="Transparent"
- BorderThickness="2"
- CornerRadius="0">
- <Grid
- Name="GridRoot"
- Width="{Binding ItemSize.Width}"
- Height="{Binding ItemSize.Height}"
- Margin="1"
- Background="Transparent">
- <Image Source="{Binding Image}" Stretch="Uniform" />
- <Border
- Width="10"
- Height="10"
- Margin="0,10,10,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Background="Yellow"
- Visibility="{Binding HaveBookMark, Converter={StaticResource BoolToVisibleConvert}}" />
- </Grid>
- </Border>
- <Border
- Name="BdPageNum"
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Bottom"
- Background="Transparent">
- <StackPanel
- Name="StkpnlButtom"
- Width="auto"
- MinWidth="10"
- HorizontalAlignment="Center"
- Background="Transparent">
- <TextBlock
- Width="auto"
- Height="22"
- Margin="0,4"
- HorizontalAlignment="Center"
- FontSize="14"
- Text="{Binding PageNumber}" />
- <TextBlock
- Width="auto"
- MinHeight="22"
- MaxWidth="{Binding ElementName=GridRoot, Path=ActualWidth}"
- HorizontalAlignment="Center"
- FontSize="14"
- Text="{Binding PageSize}"
- TextWrapping="Wrap"
- Visibility="{Binding ShowPageSize, Converter={StaticResource BoolToVisibleConvert}}" />
- </StackPanel>
- </Border>
- </StackPanel>
- </DataTemplate>
- <ContextMenu x:Key="ListBoxItemMenu" DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
- <MenuItem Header="插入页面" Visibility="Collapsed">
- <MenuItem
- Command="{Binding InsertCommand}"
- CommandParameter="{x:Static model:ParameterNames.InsertType_File}"
- Header="插入文件" />
- <MenuItem
- Command="{Binding InsertCommand}"
- CommandParameter="{x:Static model:ParameterNames.InsertType_Blank}"
- Header="插入空白页" />
- <MenuItem
- Command="{Binding InsertCommand}"
- CommandParameter="{x:Static model:ParameterNames.InsertType_Custom}"
- Header="插入自定义页面" />
- </MenuItem>
- <MenuItem
- Command="{Binding ExtractCommand}"
- Header="提取页面"
- Visibility="Collapsed" />
- <MenuItem
- Command="{Binding ReplaceCommand}"
- Header="替换页面"
- Visibility="Collapsed" />
- <MenuItem Command="{Binding DeleteCommand}" Header="{x:Static mainpage:MainPage.PageEdit_MenuDelete}" />
- <MenuItem Command="{Binding RightRotateCommand}" Header="{x:Static mainpage:MainPage.PageEdit_MenuRotateClockwise}" />
- <MenuItem Command="{Binding LeftRotateCommand}" Header="{x:Static mainpage:MainPage.PageEdit_MenuRotateCounterclockwise}" />
- <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
- <MenuItem Command="{Binding CopyCommand}" Header="{x:Static mainpage:MainPage.PageEdit_MenuCopy}" />
- <MenuItem Command="{Binding CutCommand}" Header="{x:Static mainpage:MainPage.PageEdit_MenuCut}" />
- <MenuItem Command="{Binding PasteCommand}" Header="{x:Static mainpage:MainPage.PageEdit_MenuPaste}" />
- <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
- <MenuItem
- Command="{Binding ShowPageSizeCommand}"
- Header="{x:Static mainpage:MainPage.PageEdit_MenuShowPageSize}"
- Visibility="{Binding Source={x:Reference Name=MenuHidePageSize}, Path=Visibility, Converter={StaticResource UnVisibleConvert}}" />
- <MenuItem
- Name="MenuHidePageSize"
- Command="{Binding ShowPageSizeCommand}"
- Header="隐藏页面大小"
- Visibility="{Binding HasShowPageSize}" />
- <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
- <MenuItem Command="{Binding PrintCommand}" Header="{x:Static mainpage:MainPage.PageEdit_MenuPrint}" />
- </ContextMenu>
- <Style BasedOn="{StaticResource subToolBar}" TargetType="{x:Type Button}">
- <Setter Property="Width" Value="28" />
- <Setter Property="Height" Value="28" />
- </Style>
- <Style TargetType="{x:Type Path}">
- <Setter Property="Fill" Value="{StaticResource color.icon.base.brand}" />
- </Style>
- </ResourceDictionary>
- </UserControl.Resources>
- <UserControl.InputBindings>
- <KeyBinding Command="{Binding CopyCommand}" Gesture="Ctrl+C" />
- <KeyBinding Command="{Binding PasteCommand}" Gesture="Ctrl+V" />
- <KeyBinding Command="{Binding CutCommand}" Gesture="Ctrl+X" />
- <KeyBinding Command="{Binding RightRotateCommand}" Gesture="Ctrl+R" />
- <KeyBinding Command="{Binding LeftRotateCommand}" Gesture="Ctrl+L" />
- <KeyBinding Command="{Binding DeleteCommand}" Gesture="Delete" />
- <KeyBinding Key="Esc" Command="{Binding ClearSelectedCommand}" />
- <KeyBinding
- Key="Add"
- Command="{Binding ZoomInCommand}"
- Modifiers="Ctrl" />
- <KeyBinding
- Key="Subtract"
- Command="{Binding ZoomOutCommand}"
- Modifiers="Ctrl" />
- </UserControl.InputBindings>
- <Border
- AllowDrop="True"
- BorderBrush="#F2F2F2"
- BorderThickness="0,1,0,0"
- Drop="Border_Drop">
- <Grid
- DragLeave="Grid_DragLeave"
- DragOver="Grid_DragOver"
- Drop="Grid_Drop"
- PreviewDragEnter="Grid_PreviewDragEnter">
- <Grid.RowDefinitions>
- <RowDefinition Height="auto" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Grid Height="40" Background="{StaticResource color.sys.layout.mg}">
- <StackPanel
- Name="StkpnlCenter"
- HorizontalAlignment="Center"
- Orientation="Horizontal">
- <Grid>
- <ComboBox
- Width="117"
- Height="23"
- IsEditable="True"
- ItemsSource="{Binding PageRangeItems}"
- SelectedIndex="{Binding ComboxSelectIndex, Mode=TwoWay}"
- Text="{Binding TbPageRange}">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="PreviewKeyDown">
- <i:InvokeCommandAction Command="{Binding PreviewKeyDown}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- <i:EventTrigger EventName="KeyDown">
- <i:InvokeCommandAction Command="{Binding KeyDown}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- <i:EventTrigger EventName="LostFocus">
- <i:InvokeCommandAction Command="{Binding LostFocusCommand}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </ComboBox>
- </Grid>
- <Button Margin="5" Command="{Binding LeftRotateCommand}">
- <Path
- Width="29"
- Height="28"
- Data="M9.61772 12.8118C10.1691 10.0672 12.5932 8 15.5001 8C18.8138 8 21.5001 10.6863 21.5001 14C21.5001 17.3137 18.8138 20 15.5001 20C14.4056 20 13.3823 19.7078 12.5008 19.1979L11.4994 20.9291C12.6771 21.6104 14.0446 22 15.5001 22C19.9184 22 23.5001 18.4183 23.5001 14C23.5001 9.58172 19.9184 6 15.5001 6C11.6625 6 8.45601 8.70211 7.67946 12.3075L6.58239 10.4073L4.85034 11.4073L7.15034 15.3911C7.42648 15.8694 8.03807 16.0332 8.51637 15.7571L12.5001 13.4571L11.5001 11.725L9.61772 12.8118Z" />
- </Button>
- <Button Margin="5" Command="{Binding RightRotateCommand}">
- <Path
- Width="29"
- Height="28"
- Data="M19.4129 12.9758C18.9269 10.15 16.4645 8 13.5 8C10.1863 8 7.5 10.6863 7.5 14C7.5 17.3137 10.1863 20 13.5 20C14.5945 20 15.6178 19.7078 16.4993 19.1979L17.5007 20.9291C16.323 21.6104 14.9555 22 13.5 22C9.08172 22 5.5 18.4183 5.5 14C5.5 9.58172 9.08172 6 13.5 6C17.1531 6 20.2343 8.44856 21.192 11.794L21.7091 9.86404L23.641 10.3817L22.4504 14.8249C22.3075 15.3584 21.7591 15.675 21.2257 15.532L16.7824 14.3415L17.3 12.4096L19.4129 12.9758Z" />
- </Button>
- <Separator
- Width="1"
- Height="24"
- Margin="5,0"
- BorderBrush="#33000000"
- BorderThickness="5"
- Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
- <Menu
- Width="65"
- Height="20"
- Margin="5"
- Visibility="Collapsed">
- <MenuItem
- Width="65"
- Height="20"
- Header="插入">
- <MenuItem
- Command="{Binding InsertCommand}"
- CommandParameter="{x:Static model:ParameterNames.InsertType_File}"
- Header="插入文件" />
- <MenuItem
- Command="{Binding InsertCommand}"
- CommandParameter="{x:Static model:ParameterNames.InsertType_Blank}"
- Header="插入空白页" />
- <MenuItem
- Command="{Binding InsertCommand}"
- CommandParameter="{x:Static model:ParameterNames.InsertType_Custom}"
- Header="插入自定义页面" />
- </MenuItem>
- </Menu>
- <Button
- Margin="5"
- Command="{Binding ExtractCommand}"
- Content="提取"
- Visibility="Collapsed" />
- <Button
- Margin="5"
- Command="{Binding ReplaceCommand}"
- Content="替换"
- Visibility="Collapsed" />
- <Button
- Margin="5"
- Command="{Binding SplitCommand}"
- Content="拆分"
- Visibility="Collapsed" />
- <Button
- Margin="5"
- Command="{Binding ReverseCommand}"
- Content="倒序"
- Visibility="Collapsed" />
- <Separator
- Width="1"
- Height="24"
- Margin="5,0"
- BorderBrush="#33000000"
- BorderThickness="5"
- Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
- Visibility="Collapsed" />
- <Button Margin="5" Command="{Binding DeleteCommand}">
- <Path
- Width="29"
- Height="28"
- Data="M12.5 6H16.5V4H12.5V6ZM21.5 9H23.5V7H19.5H9.5H5.5V9H7.5V22C7.5 23.1046 8.39543 24 9.5 24H19.5C20.6046 24 21.5 23.1046 21.5 22V9ZM19.5 9H9.5V22H19.5V9ZM13.5 19L13.5 12H15.5V19H13.5Z" />
- </Button>
- </StackPanel>
- <StackPanel
- Name="StkpnlRight"
- HorizontalAlignment="Right"
- Orientation="Horizontal">
- <Button Margin="4" Command="{Binding ZoomInCommand}">
- <Path
- Width="28"
- Height="28"
- Data="M20 12.5C20 16.0899 17.0899 19 13.5 19C9.91015 19 7 16.0899 7 12.5C7 8.91015 9.91015 6 13.5 6C17.0899 6 20 8.91015 20 12.5ZM18.2928 19.5209C16.9284 20.4541 15.2779 21 13.5 21C8.80558 21 5 17.1944 5 12.5C5 7.80558 8.80558 4 13.5 4C18.1944 4 22 7.80558 22 12.5C22 14.6954 21.1677 16.6965 19.8013 18.2048L23.4741 22.0603L22.026 23.4397L18.2928 19.5209ZM12.5 9V11.5H10V13.5H12.5V16H14.5V13.5H17V11.5H14.5V9H12.5Z" />
- </Button>
- <Button Margin="4" Command="{Binding ZoomOutCommand}">
- <Path
- Width="28"
- Height="28"
- Data="M20 12.5C20 16.0899 17.0899 19 13.5 19C9.91015 19 7 16.0899 7 12.5C7 8.91015 9.91015 6 13.5 6C17.0899 6 20 8.91015 20 12.5ZM18.2928 19.5209C16.9284 20.4541 15.2779 21 13.5 21C8.80558 21 5 17.1944 5 12.5C5 7.80558 8.80558 4 13.5 4C18.1944 4 22 7.80558 22 12.5C22 14.6954 21.1677 16.6965 19.8013 18.2048L23.4741 22.0603L22.026 23.4397L18.2928 19.5209ZM10 11.5H17V13.5H10V11.5Z" />
- </Button>
- </StackPanel>
- </Grid>
- <Border
- Name="GridBOTAHeader"
- BorderBrush="{StaticResource color.field.border.norm}"
- BorderThickness="0,0,0,1"
- Visibility="{Binding IsBOTAThumb}">
- <Grid
- Height="52"
- VerticalAlignment="Center"
- Background="{StaticResource color.sys.layout.mg}">
- <TextBlock
- Margin="16,0"
- VerticalAlignment="Center"
- FontFamily="Segoe UI"
- FontSize="14"
- FontWeight="SemiBold"
- LineHeight="20"
- Text="{Binding T_Title}" />
- <ToggleButton
- Name="TbnTwoLine"
- Width="32"
- Height="32"
- Margin="16,0"
- HorizontalAlignment="Right"
- Click="TbnTwoLine_Click"
- Style="{StaticResource SubToolbarTgb}">
- <Path
- Width="32"
- Height="32"
- Data="M18.2998 21.6998V10.2998H21.6998V21.6998H18.2998ZM16.7998 9.59981C16.7998 9.15798 17.1579 8.7998 17.5998 8.7998H22.3998C22.8416 8.7998 23.1998 9.15798 23.1998 9.5998V22.3998C23.1998 22.8416 22.8416 23.1998 22.3998 23.1998H17.5998C17.1579 23.1998 16.7998 22.8416 16.7998 22.3998V9.59981ZM10.2998 21.6998V10.2998H13.6998V21.6998H10.2998ZM8.7998 9.59981C8.7998 9.15798 9.15798 8.79981 9.5998 8.79981H14.3998C14.8416 8.79981 15.1998 9.15798 15.1998 9.59981V22.3998C15.1998 22.8416 14.8416 23.1998 14.3998 23.1998H9.59981C9.15798 23.1998 8.7998 22.8416 8.7998 22.3998V9.59981Z"
- Fill="{Binding ElementName=TbnTwoLine, Path=Foreground}" />
- </ToggleButton>
- </Grid>
- </Border>
- <ListBox
- Name="ListPageEdit"
- Grid.Row="1"
- Padding="0"
- AllowDrop="True"
- BorderThickness="0"
- Drop="ListPageEdit_Drop"
- FocusVisualStyle="{x:Null}"
- ItemTemplate="{StaticResource PageEditListBoxItemTemplate}"
- ItemsSource="{Binding PageEditItems}"
- PreviewMouseLeftButtonDown="ListPageEdit_PreviewMouseLeftButtonDown"
- PreviewMouseLeftButtonUp="ListPageEdit_PreviewMouseLeftButtonUp"
- PreviewMouseMove="ListPageEdit_PreviewMouseMove"
- ScrollBar.Scroll="ListPageEdit_Scroll"
- ScrollViewer.ScrollChanged="ListPageEdit_ScrollChanged"
- SelectedIndex="{Binding ListSelectedIndex, Mode=TwoWay}"
- SelectionMode="Extended">
- <!-- 此处要用循环模式,否则滚动时容易误触发EndSscroll 从而频繁拿图导致卡顿 -->
- <ListBox.ItemContainerStyle>
- <Style TargetType="{x:Type ListBoxItem}">
- <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
- <Setter Property="Margin" Value="0,10" />
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="Visibility" Value="{Binding Visible}" />
- <Setter Property="IsSelected" Value="{Binding Selected, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}" />
- <Setter Property="HorizontalAlignment" Value="Center" />
- <Setter Property="VerticalAlignment" Value="Center" />
- <Setter Property="HorizontalContentAlignment" Value="Center" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="ContextMenu" Value="{StaticResource ListBoxItemMenu}" />
- <EventSetter Event="DragLeave" Handler="ListBoxItem_DragLeave" />
- <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown" />
- <EventSetter Event="PreviewMouseDoubleClick" Handler="ListBoxItem_PreviewMouseDoubleClick" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=DataContext.IsBOTAThumb}" Value="Visible">
- <Setter Property="Template" Value="{StaticResource BOTAListBoxItemTemplate}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ListBox.ItemContainerStyle>
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <!-- item间距自适应 -->
- <wpftk:VirtualizingWrapPanel />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectionChanged">
- <i:InvokeCommandAction Command="{Binding SelectionChangedCommand}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- <ListBox.Style>
- <Style TargetType="{x:Type ListBox}">
- <Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=GridBOTAHeader, Path=Visibility}" Value="Visible">
- <Setter Property="Background" Value="{StaticResource color.sys.layout.mg}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=GridBOTAHeader, Path=Visibility}" Value="Collapsed">
- <Setter Property="Background" Value="{StaticResource color.sys.layout.bg.view}" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ListBox.Style>
- </ListBox>
- <!-- 框选的矩形框 -->
- <Rectangle
- Name="RectChoose"
- Grid.Row="1"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- Fill="#AACCEE"
- Opacity="0.3"
- Stroke="#AACCEE"
- StrokeThickness="2" />
- <!-- 插入标记 -->
- <Line
- Name="LineInset"
- Grid.Row="1"
- AllowDrop="True"
- Drop="MidLane_Drop"
- Stroke="#FF477EDE"
- StrokeEndLineCap="Triangle"
- StrokeStartLineCap="Triangle"
- StrokeThickness="5"
- Visibility="Collapsed"
- X1="20"
- X2="20"
- Y1="0"
- Y2="150" />
- <!-- 拖拽虚影 -->
- <Image
- Name="ImgPicture"
- Grid.Row="1"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- AllowDrop="True"
- Drop="ImgPicture_Drop"
- Opacity="0.8"
- RenderOptions.BitmapScalingMode="HighQuality"
- UseLayoutRounding="True"
- Visibility="{Binding ElementName=LineInset, Path=Visibility}" />
- <cus:ToastControl
- Grid.Row="1"
- Width="auto"
- Height="auto"
- Margin="0,0,0,100"
- VerticalAlignment="Bottom"
- Background="#89000000"
- BeginTime="0:0:0:3"
- CornerRadius="4"
- FontSize="14"
- Foreground="White"
- StringContent="{Binding ToastText}"
- Visibility="{Binding ShowTip, Mode=TwoWay}"
- Duration="0:0:0:3" />
- <!--<ProgressBar
- Grid.Row="1"
- Width="400"
- Height="10"
- Foreground="Blue"
- IsIndeterminate="True"
- Visibility="{Binding IsLoading}" />-->
- </Grid>
- </Border>
- </UserControl>
|