Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
xupefei committed Sep 2, 2018
1 parent df5ab0f commit 92b3be0
Show file tree
Hide file tree
Showing 8 changed files with 1,401 additions and 13 deletions.
11 changes: 7 additions & 4 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using QuickLook.Common.Plugin;

namespace QuickLook.Plugin.OfficeViewer
{
public class Plugin : IViewer
{
private readonly string[] _formats =
{".doc", ".docm", ".docx", ".rtf", ".xls", ".xlsx", ".xlsm", ".pptx", ".pptm", ".potx", ".potm"};

public int Priority => 0;

public void Init()
Expand All @@ -33,17 +36,17 @@ public void Init()

public bool CanHandle(string path)
{
return !Directory.Exists(path) && path.ToLower().EndsWith(".docx");
return !Directory.Exists(path) && _formats.Contains(Path.GetExtension(path).ToLower());
}

public void Prepare(string path, ContextObject context)
{
context.PreferredSize = new Size {Width = 600, Height = 400};
context.SetPreferredSizeFit(new Size {Width = 1920, Height = 1440}, 0.9);
}

public void View(string path, ContextObject context)
{
var viewer = SyncfusionControl.OpenWord(path);
var viewer = SyncfusionControl.Open(path);

context.ViewerContent = viewer;
context.Title = $"{Path.GetFileName(path)}";
Expand Down
19 changes: 19 additions & 0 deletions QuickLook.Plugin.OfficeViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="QuickLook.Plugin.PDFViewer">
<HintPath>QuickLook.Plugin.PDFViewer\QuickLook.Plugin.PDFViewer.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Syncfusion.Compression.Base, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Compression.Base.16.2.0.50\lib\net46\Syncfusion.Compression.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.DocIO.Base, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.DocIO.Base.16.2.0.50\lib\net46\Syncfusion.DocIO.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.ExcelChartToImageConverter.Wpf, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.ExcelChartToImageConverter.WPF.16.2.0.50\lib\net46\Syncfusion.ExcelChartToImageConverter.Wpf.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Licensing, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Licensing.16.2.0.50\lib\net46\Syncfusion.Licensing.dll</HintPath>
</Reference>
Expand All @@ -71,6 +78,15 @@
<Reference Include="Syncfusion.OfficeChartToImageConverter.Wpf, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.OfficeChartToImageConverter.Wpf.16.2.0.50\lib\net46\Syncfusion.OfficeChartToImageConverter.Wpf.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Pdf.Base, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Pdf.Base.16.2.0.50\lib\net46\Syncfusion.Pdf.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Presentation.Base, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Presentation.Base.16.2.0.50\lib\net46\Syncfusion.Presentation.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.PresentationToPdfConverter.Base, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.PresentationToPdfConverter.Base.16.2.0.50\lib\net46\Syncfusion.PresentationToPdfConverter.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.SfCellGrid.WPF, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.SfCellGrid.WPF.16.2.0.50\lib\net46\Syncfusion.SfCellGrid.WPF.dll</HintPath>
</Reference>
Expand All @@ -86,6 +102,9 @@
<Reference Include="Syncfusion.SfSpreadsheet.WPF, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.SfSpreadsheet.WPF.16.2.0.50\lib\net46\Syncfusion.SfSpreadsheet.WPF.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.SfSpreadsheetHelper.WPF, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.SfSpreadsheetHelper.WPF.16.2.0.50\lib\net46\Syncfusion.SfSpreadsheetHelper.WPF.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Shared.Wpf, Version=16.2460.0.50, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>packages\Syncfusion.Shared.WPF.16.2.0.50\lib\net46\Syncfusion.Shared.Wpf.dll</HintPath>
</Reference>
Expand Down
Binary file added QuickLook.Plugin.PDFViewer/PdfiumViewer.dll
Binary file not shown.
Loading

0 comments on commit 92b3be0

Please sign in to comment.