Browse Source

大纲-自测问题修复

zhuyi 2 years ago
parent
commit
11cd7b55ca

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -1888,6 +1888,7 @@
     <Resource Include="Resources\ToolBarIcon\Scan\batch.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Resource>
+    <Resource Include="Resources\BOTA\no_outline.png" />
     <Content Include="source\AnalysisWord\Res\word\_rels\document.xml.rels">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

BIN
PDF Office/Resources/BOTA/no_outline.png


File diff suppressed because it is too large
+ 1 - 0
PDF Office/Styles/OutLineItemStyle.xaml


+ 3 - 3
PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs

@@ -502,7 +502,7 @@ namespace PDF_Office.ViewModels.BOTA
         /// <summary>
         /// 获取对应大纲所需的缩略图数据
         /// </summary>
-        public WriteableBitmap LoadPreview(OutlineNode outlineNode)
+        public WriteableBitmap LoadPreview(OutlineNode outlineNode,int Width,int Height)
         {
             CPDFPage page = PDFViewer.Document.PageAtIndex(Convert.ToInt32(outlineNode.PageIndex) - 1);
             Size size = PDFViewer.Document.GetPageSize(Convert.ToInt32(outlineNode.PageIndex) - 1);
@@ -516,7 +516,7 @@ namespace PDF_Office.ViewModels.BOTA
             {
                 zoomXY.Y = 0;
             }
-            Size zoomSize = new Size((int)(size.Width * outlineNode.Zoom), (int)(size.Height * outlineNode.Zoom));
+            Size zoomSize = new Size((int)(Width * outlineNode.Zoom), (int)(Height * outlineNode.Zoom));
             bmpData = new byte[(int)(zoomSize.Width * zoomSize.Height * 4)];
             WirteBitmap = new WriteableBitmap((int)zoomSize.Width, (int)zoomSize.Height, 96, 96, PixelFormats.Bgra32, null);
 
@@ -524,7 +524,7 @@ namespace PDF_Office.ViewModels.BOTA
             {
                 return null;
             }
-            page.RenderPageBitmapWithMatrix((float)outlineNode.Zoom, new Rect(zoomXY.X, zoomXY.Y, zoomSize.Width, zoomSize.Height), 0xFFFFFFFF, bmpData, 1, true);
+            page.RenderPageBitmapWithMatrix((float)outlineNode.Zoom, new Rect(zoomXY.X, size.Height-zoomXY.Y, zoomSize.Width, zoomSize.Height), 0xFFFFFFFF, bmpData, 1, true);
             WirteBitmap.WritePixels(new Int32Rect(0, 0, (int)zoomSize.Width, (int)zoomSize.Height), bmpData, WirteBitmap.BackBufferStride, 0);
             WirteBitmap.Freeze();
             return WirteBitmap;

+ 6 - 0
PDF Office/Views/BOTA/OutLineControl.xaml

@@ -76,7 +76,13 @@
         <Grid Grid.Row="1"
                DragOver="Grid_DragOver"
               DragLeave="Grid_DragLeave">
+            <StackPanel VerticalAlignment="Center" x:Name="NoOutlineStackPanel" Visibility="{Binding Outlinelist.Count, Converter={StaticResource ListCountToVisible}}">
+                <Image Source="pack://application:,,,/PDF Office;component/Resources/BOTA/no_outline.png" />
+                <TextBlock Text="No outline found" FontSize="14" FontFamily="Segoe UI" Height="22" HorizontalAlignment="Center"/>
+                <TextBlock Text="Please right-click on the selected page and select Add Outline, or click the Add button on the upper right to create a outline." Width="168" FontSize="12" FontFamily="Segoe UI" TextWrapping="Wrap" Foreground="#94989C" HorizontalAlignment="Center"/>
+            </StackPanel>
             <TreeView x:Name="OutlineView" Grid.Row="1" ItemsSource="{Binding Outlinelist}" 
+                Visibility="{Binding ElementName=NoOutlineStackPanel,Path=Visibility,Converter={StaticResource UnVisivleConvert}}"
                 BorderThickness="0" AllowDrop="True"
                 VirtualizingPanel.ScrollUnit="Pixel"
                 Drop="OutlineView_Drop"

+ 1 - 1
PDF Office/Views/BOTA/OutLineControl.xaml.cs

@@ -284,7 +284,7 @@ namespace PDF_Office.Views.BOTA
             }
             //开始绘制
             DrawingContext drawDc = imageControl.OpenDraw();
-            WriteableBitmap imageData = (DataContext as OutLineControlViewModel).LoadPreview(outline);
+            WriteableBitmap imageData = (DataContext as OutLineControlViewModel).LoadPreview(outline, (int)imageControl.Width, (int)imageControl.Height);
             if (imageData == null)
             {
                 imageControl.CloseDraw();