diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:31:31 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:39:41 -0700 |
commit | 7ea99e3a8951e265d1437a77dcfee069de0edf76 (patch) | |
tree | 8e113fea67931064e2a9338d67b26aaabab27512 /platform/windows/mupdf_cpp | |
parent | 8a9519f2183b64fe220bcb1f6acedbe6acc190cd (diff) | |
download | mupdf-7ea99e3a8951e265d1437a77dcfee069de0edf76.tar.xz |
Rename of winrt to windows due to presence on gsview in this folder.
The contents of this folder will contain both winrt and gsview projects
which are shared in a common visual studio 2013 solution.
Diffstat (limited to 'platform/windows/mupdf_cpp')
33 files changed, 6501 insertions, 0 deletions
diff --git a/platform/windows/mupdf_cpp/App.xaml b/platform/windows/mupdf_cpp/App.xaml new file mode 100644 index 00000000..dfb5d11c --- /dev/null +++ b/platform/windows/mupdf_cpp/App.xaml @@ -0,0 +1,20 @@ +<Application + x:Class="mupdf_cpp.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:mupdf_cpp"> + + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + + <!-- + Styles that define common aspects of the platform look and feel + Required by Visual Studio project and item templates + --> + <ResourceDictionary Source="Common/StandardStyles.xaml"/> + </ResourceDictionary.MergedDictionaries> + + </ResourceDictionary> + </Application.Resources> +</Application> diff --git a/platform/windows/mupdf_cpp/App.xaml.cpp b/platform/windows/mupdf_cpp/App.xaml.cpp new file mode 100644 index 00000000..4bb9614c --- /dev/null +++ b/platform/windows/mupdf_cpp/App.xaml.cpp @@ -0,0 +1,131 @@ +// +// App.xaml.cpp +// Implementation of the App class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace mupdf_cpp; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 + +/// <summary> +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// </summary> +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// <summary> +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used when the application is launched to open a specific file, to display +/// search results, and so forth. +/// </summary> +/// <param name="args">Details about the launch request and process.</param> +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args) +{ + auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + if (args->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + + } + + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + if (!rootFrame->Navigate(TypeName(MainPage::typeid), args->Arguments)) + { + throw ref new FailureException("Failed to create initial page"); + } + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + auto rootPage = safe_cast<MainPage^>(rootFrame->Content); + rootPage->FileEvent = nullptr; + rootPage->ProtocolEvent = nullptr; + + // Ensure the current window is active + Window::Current->Activate(); + } + else + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + if (!rootFrame->Navigate(TypeName(MainPage::typeid), args->Arguments)) + { + throw ref new FailureException("Failed to create initial page"); + } + } + // Ensure the current window is active + Window::Current->Activate(); + } +} + +/* Handle case where we do a association file opening and the app is already + running */ +void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs^ args) +{ + auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content); + + if (rootFrame->Content == nullptr) + { + if (!rootFrame->Navigate(TypeName(MainPage::typeid))) + { + throw ref new FailureException("Failed to create initial page"); + } + } + auto p = dynamic_cast<MainPage^>(rootFrame->Content); + p->FileEvent = args; + p->ProtocolEvent = nullptr; + p->FromFile(); + Window::Current->Activate(); +} + +/// <summary> +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// </summary> +/// <param name="sender">The source of the suspend request.</param> +/// <param name="e">Details about the suspend request.</param> +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + //TODO: Save application state and stop any background activity +} diff --git a/platform/windows/mupdf_cpp/App.xaml.h b/platform/windows/mupdf_cpp/App.xaml.h new file mode 100644 index 00000000..b62c9979 --- /dev/null +++ b/platform/windows/mupdf_cpp/App.xaml.h @@ -0,0 +1,24 @@ +// +// App.xaml.h +// Declaration of the App class. +// + +#pragma once + +#include "App.g.h" + +namespace mupdf_cpp +{ + /// <summary> + /// Provides application-specific behavior to supplement the default Application class. + /// </summary> + ref class App sealed + { + public: + App(); + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args) override; + virtual void App::OnFileActivated(Windows::ApplicationModel::Activation::FileActivatedEventArgs^ args) override; + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + }; +} diff --git a/platform/windows/mupdf_cpp/Assets/Logo.Scale-100.png b/platform/windows/mupdf_cpp/Assets/Logo.Scale-100.png Binary files differnew file mode 100644 index 00000000..821cb7d9 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/Logo.Scale-100.png diff --git a/platform/windows/mupdf_cpp/Assets/Logo.Scale-140.png b/platform/windows/mupdf_cpp/Assets/Logo.Scale-140.png Binary files differnew file mode 100644 index 00000000..94eb9b67 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/Logo.Scale-140.png diff --git a/platform/windows/mupdf_cpp/Assets/Logo.Scale-180.png b/platform/windows/mupdf_cpp/Assets/Logo.Scale-180.png Binary files differnew file mode 100644 index 00000000..44354901 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/Logo.Scale-180.png diff --git a/platform/windows/mupdf_cpp/Assets/Logo.Scale-80.png b/platform/windows/mupdf_cpp/Assets/Logo.Scale-80.png Binary files differnew file mode 100644 index 00000000..165bda7a --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/Logo.Scale-80.png diff --git a/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-100.png b/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-100.png Binary files differnew file mode 100644 index 00000000..5b5635e9 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-100.png diff --git a/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-140.png b/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-140.png Binary files differnew file mode 100644 index 00000000..2813a863 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-140.png diff --git a/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-180.png b/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-180.png Binary files differnew file mode 100644 index 00000000..1908837d --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/StoreLogo.scale-180.png diff --git a/platform/windows/mupdf_cpp/Assets/WideLogo.scale-100.png b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-100.png Binary files differnew file mode 100644 index 00000000..9497ffb5 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-100.png diff --git a/platform/windows/mupdf_cpp/Assets/WideLogo.scale-140.png b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-140.png Binary files differnew file mode 100644 index 00000000..1c6cd7a0 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-140.png diff --git a/platform/windows/mupdf_cpp/Assets/WideLogo.scale-180.png b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-180.png Binary files differnew file mode 100644 index 00000000..7d3391f8 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-180.png diff --git a/platform/windows/mupdf_cpp/Assets/WideLogo.scale-80.png b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-80.png Binary files differnew file mode 100644 index 00000000..471efbda --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/WideLogo.scale-80.png diff --git a/platform/windows/mupdf_cpp/Assets/mupdf_smallogo.png b/platform/windows/mupdf_cpp/Assets/mupdf_smallogo.png Binary files differnew file mode 100644 index 00000000..48746c87 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/mupdf_smallogo.png diff --git a/platform/windows/mupdf_cpp/Assets/mupdf_splash.png b/platform/windows/mupdf_cpp/Assets/mupdf_splash.png Binary files differnew file mode 100644 index 00000000..624f9ae9 --- /dev/null +++ b/platform/windows/mupdf_cpp/Assets/mupdf_splash.png diff --git a/platform/windows/mupdf_cpp/Common/StandardStyles.xaml b/platform/windows/mupdf_cpp/Common/StandardStyles.xaml new file mode 100644 index 00000000..ed4b0ec2 --- /dev/null +++ b/platform/windows/mupdf_cpp/Common/StandardStyles.xaml @@ -0,0 +1,1889 @@ +<!-- + This file contains XAML styles that simplify application development. + + These are not merely convenient, but are required by most Visual Studio project and item templates. + Removing, renaming, or otherwise modifying the content of these files may result in a project that + does not build, or that will not build once additional pages are added. If variations on these + styles are desired it is recommended that you copy the content under a new name and modify your + private copy. +--> + +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + + <!-- Non-brush values that vary across themes --> + + <ResourceDictionary.ThemeDictionaries> + <ResourceDictionary x:Key="Default"> + <x:String x:Key="BackButtonGlyph"></x:String> + <x:String x:Key="BackButtonSnappedGlyph"></x:String> + </ResourceDictionary> + + <ResourceDictionary x:Key="HighContrast"> + <x:String x:Key="BackButtonGlyph"></x:String> + <x:String x:Key="BackButtonSnappedGlyph"></x:String> + </ResourceDictionary> + </ResourceDictionary.ThemeDictionaries> + + <x:String x:Key="ChevronGlyph"></x:String> + + <!-- RichTextBlock styles --> + + <Style x:Key="BasicRichTextStyle" TargetType="RichTextBlock"> + <Setter Property="Foreground" Value="{StaticResource ApplicationForegroundThemeBrush}"/> + <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/> + <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/> + <Setter Property="TextTrimming" Value="WordEllipsis"/> + <Setter Property="TextWrapping" Value="Wrap"/> + <Setter Property="Typography.StylisticSet20" Value="True"/> + <Setter Property="Typography.DiscretionaryLigatures" Value="True"/> + <Setter Property="Typography.CaseSensitiveForms" Value="True"/> + </Style> + + <Style x:Key="BaselineRichTextStyle" TargetType="RichTextBlock" BasedOn="{StaticResource BasicRichTextStyle}"> + <Setter Property="LineHeight" Value="20"/> + <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/> + <!-- Properly align text along its baseline --> + <Setter Property="RenderTransform"> + <Setter.Value> + <TranslateTransform X="-1" Y="4"/> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="ItemRichTextStyle" TargetType="RichTextBlock" BasedOn="{StaticResource BaselineRichTextStyle}"/> + + <Style x:Key="BodyRichTextStyle" TargetType="RichTextBlock" BasedOn="{StaticResource BaselineRichTextStyle}"> + <Setter Property="FontWeight" Value="SemiLight"/> + </Style> + + <!-- TextBlock styles --> + + <Style x:Key="BasicTextStyle" TargetType="TextBlock"> + <Setter Property="Foreground" Value="{StaticResource ApplicationForegroundThemeBrush}"/> + <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/> + <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/> + <Setter Property="TextTrimming" Value="WordEllipsis"/> + <Setter Property="TextWrapping" Value="Wrap"/> + <Setter Property="Typography.StylisticSet20" Value="True"/> + <Setter Property="Typography.DiscretionaryLigatures" Value="True"/> + <Setter Property="Typography.CaseSensitiveForms" Value="True"/> + </Style> + + <Style x:Key="BaselineTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BasicTextStyle}"> + <Setter Property="LineHeight" Value="20"/> + <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/> + <!-- Properly align text along its baseline --> + <Setter Property="RenderTransform"> + <Setter.Value> + <TranslateTransform X="-1" Y="4"/> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="HeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"> + <Setter Property="FontSize" Value="56"/> + <Setter Property="FontWeight" Value="Light"/> + <Setter Property="LineHeight" Value="40"/> + <Setter Property="RenderTransform"> + <Setter.Value> + <TranslateTransform X="-2" Y="8"/> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="SubheaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"> + <Setter Property="FontSize" Value="26.667"/> + <Setter Property="FontWeight" Value="Light"/> + <Setter Property="LineHeight" Value="30"/> + <Setter Property="RenderTransform"> + <Setter.Value> + <TranslateTransform X="-1" Y="6"/> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="TitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"> + <Setter Property="FontWeight" Value="SemiBold"/> + </Style> + + <Style x:Key="SubtitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"> + <Setter Property="FontWeight" Value="Normal"/> + </Style> + + <Style x:Key="ItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"/> + + <Style x:Key="BodyTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"> + <Setter Property="FontWeight" Value="SemiLight"/> + </Style> + + <Style x:Key="CaptionTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"> + <Setter Property="FontSize" Value="12"/> + <Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/> + </Style> + + <Style x:Key="GroupHeaderTextStyle" TargetType="TextBlock"> + <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/> + <Setter Property="TextTrimming" Value="WordEllipsis"/> + <Setter Property="TextWrapping" Value="NoWrap"/> + <Setter Property="Typography.StylisticSet20" Value="True"/> + <Setter Property="Typography.DiscretionaryLigatures" Value="True"/> + <Setter Property="Typography.CaseSensitiveForms" Value="True"/> + <Setter Property="FontSize" Value="26.667"/> + <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/> + <Setter Property="FontWeight" Value="Light"/> + <Setter Property="LineHeight" Value="30"/> + <Setter Property="RenderTransform"> + <Setter.Value> + <TranslateTransform X="-1" Y="6"/> + </Setter.Value> + </Setter> + </Style> + + <!-- Button styles --> + + <!-- + TextButtonStyle is used to style a Button using subheader-styled text with no other adornment. There + are two styles that are based on TextButtonStyle (TextPrimaryButtonStyle and TextSecondaryButtonStyle) + which are used in the GroupedItemsPage as a group header and in the FileOpenPickerPage for triggering + commands. + --> + <Style x:Key="TextButtonStyle" TargetType="ButtonBase"> + <Setter Property="MinWidth" Value="0"/> + <Setter Property="MinHeight" Value="0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ButtonBase"> + <Grid Background="Transparent"> + <ContentPresenter x:Name="Text" Content="{TemplateBinding Content}" /> + <Rectangle + x:Name="FocusVisualWhite" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="1.5"/> + <Rectangle + x:Name="FocusVisualBlack" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="0.5"/> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="PointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationPointerOverForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationPressedForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationPressedForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualWhite" Storyboard.TargetProperty="Opacity"/> + <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualBlack" Storyboard.TargetProperty="Opacity"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused"/> + </VisualStateGroup> + <VisualStateGroup x:Name="CheckStates"> + <VisualState x:Name="Checked"/> + <VisualState x:Name="Unchecked"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Indeterminate"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="TextPrimaryButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource TextButtonStyle}"> + <Setter Property="Foreground" Value="{StaticResource ApplicationHeaderForegroundThemeBrush}"/> + </Style> + + <Style x:Key="TextSecondaryButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource TextButtonStyle}"> + <Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/> + </Style> + + <!-- + TextRadioButtonStyle is used to style a RadioButton using subheader-styled text with no other adornment. + This style is used in the SearchResultsPage to allow selection among filters. + --> + <Style x:Key="TextRadioButtonStyle" TargetType="RadioButton" BasedOn="{StaticResource TextButtonStyle}"> + <Setter Property="Margin" Value="0,0,30,0"/> + </Style> + + <!-- + AppBarButtonStyle is used to style a Button (or ToggleButton) for use in an App Bar. Content will be centered + and should fit within the 40 pixel radius glyph provided. 16-point Segoe UI Symbol is used for content text + to simplify the use of glyphs from that font. AutomationProperties.Name is used for the text below the glyph. + --> + <Style x:Key="AppBarButtonStyle" TargetType="ButtonBase"> + <Setter Property="Foreground" Value="{StaticResource AppBarItemForegroundThemeBrush}"/> + <Setter Property="VerticalAlignment" Value="Stretch"/> + <Setter Property="FontFamily" Value="Segoe UI Symbol"/> + <Setter Property="FontWeight" Value="Normal"/> + <Setter Property="FontSize" Value="20"/> + <Setter Property="AutomationProperties.ItemType" Value="App Bar Button"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ButtonBase"> + <Grid x:Name="RootGrid" Width="100" Background="Transparent"> + <StackPanel VerticalAlignment="Top" Margin="0,12,0,11"> + <Grid Width="40" Height="40" Margin="0,0,0,5" HorizontalAlignment="Center"> + <TextBlock x:Name="BackgroundGlyph" Text="" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0" Foreground="{StaticResource AppBarItemBackgroundThemeBrush}"/> + <TextBlock x:Name="OutlineGlyph" Text="" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0"/> + <ContentPresenter x:Name="Content" HorizontalAlignment="Center" Margin="-1,-1,0,0" VerticalAlignment="Center"/> + </Grid> + <TextBlock + x:Name="TextLabel" + Text="{TemplateBinding AutomationProperties.Name}" + Foreground="{StaticResource AppBarItemForegroundThemeBrush}" + Margin="0,0,2,0" + FontSize="12" + TextAlignment="Center" + Width="88" + MaxHeight="32" + TextTrimming="WordEllipsis" + Style="{StaticResource BasicTextStyle}"/> + </StackPanel> + <Rectangle + x:Name="FocusVisualWhite" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="1.5"/> + <Rectangle + x:Name="FocusVisualBlack" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="0.5"/> + + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="ApplicationViewStates"> + <VisualState x:Name="FullScreenLandscape"/> + <VisualState x:Name="Filled"/> + <VisualState x:Name="FullScreenPortrait"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Width"> + <DiscreteObjectKeyFrame KeyTime="0" Value="60"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Snapped"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Width"> + <DiscreteObjectKeyFrame KeyTime="0" Value="60"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="PointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPointerOverBackgroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPointerOverForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OutlineGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPressedForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OutlineGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <DoubleAnimation + Storyboard.TargetName="FocusVisualWhite" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + <DoubleAnimation + Storyboard.TargetName="FocusVisualBlack" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused" /> + <VisualState x:Name="PointerFocused" /> + </VisualStateGroup> + <VisualStateGroup x:Name="CheckStates"> + <VisualState x:Name="Checked"> + <Storyboard> + <DoubleAnimation Duration="0" To="0" Storyboard.TargetName="OutlineGlyph" Storyboard.TargetProperty="Opacity"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundCheckedGlyph" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPressedForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Unchecked"/> + <VisualState x:Name="Indeterminate"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- + Standard AppBarButton Styles for use with Button and ToggleButton + + An AppBarButton Style is provided for each of the glyphs in the Segoe UI Symbol font. + Uncomment any style you reference (as not all may be required). + --> + <Style x:Key="HelpAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="HelpAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Help"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SearchAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SearchAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Search"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OpenFileAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OpenFileAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Open File"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="NextAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="NextAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Next"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PreviousAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PreviousAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Previous"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="NoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="NoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="No"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SettingsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SettingsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Settings"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="LinksAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="LinksAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Links"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ContentsBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AllAppsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Contents"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ReflowAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ReflowAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="TextExtract"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ZoomInAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ZoomInAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Zoom In"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ZoomOutAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ZoomOutAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Zoom Out"/> + <Setter Property="Content" Value=""/> + </Style> + + <!-- + + <Style x:Key="SkipBackAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SkipBackAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Skip Back"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SkipAheadAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SkipAheadAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Skip Ahead"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PlayAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PlayAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Play"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PauseAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PauseAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Pause"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="EditAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="EditAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Edit"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SaveAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SaveAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Save"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DeleteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DeleteAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Delete"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DiscardAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DiscardAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Discard"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RemoveAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RemoveAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Remove"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AddAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AddAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Add"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="NoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="NoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="No"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="YesAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="YesAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Yes"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MoreAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MoreAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="More"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RedoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RedoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Redo"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="UndoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="UndoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Undo"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="HomeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="HomeAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Home"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OutAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OutAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Out"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="NextAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="NextAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Next"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PreviousAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PreviousAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Previous"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FavoriteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FavoriteAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Favorite"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PhotoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PhotoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Photo"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SettingsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SettingsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Settings"/> + <Setter Property="Content" Value=""/> + </Style> + --> + + <!-- + <Style x:Key="VideoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="VideoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Video"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RefreshAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RefreshAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Refresh"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DownloadAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DownloadAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Download"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MailAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MailAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Mail"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SearchAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SearchAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Search"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="HelpAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="HelpAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Help"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="UploadAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="UploadAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Upload"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="EmojiAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="EmojiAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Emoji"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="TwoPageAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="TwoPageAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Two Page"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="LeaveChatAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="LeaveChatAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Upload"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MailForwardAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MailForwardAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Forward Mail"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ClockAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ClockAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Clock"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SendAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SendAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Send"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CropAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CropAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Crop"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RotateCameraAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RotateCameraAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Rotate Camera"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PeopleAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PeopleAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="People"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ClosePaneAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ClosePaneAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Close Pane"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OpenPaneAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OpenPaneAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Open Pane"/> + <Setter Property="Content" Value=""/> + </Style> + --> + + <!-- + <Style x:Key="WorldAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="WorldAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="World"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FlagAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FlagAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Flag"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PreviewLinkAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PreviewLinkAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Preview Link"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="GlobeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="GlobeAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Globe"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="TrimAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="TrimAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Trim"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AttachCameraAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AttachCameraAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Attach Camera"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ZoomInAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ZoomInAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Zoom In"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="BookmarksAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="BookmarksAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Bookmarks"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DocumentAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DocumentAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Document"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ProtectedDocumentAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ProtectedDocumentAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Protected Document"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PageAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PageAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Page"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="BulletsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="BulletsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Bullets"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CommentAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CommentAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Comment"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="Mail2AppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="Mail2AppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Mail2"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ContactInfoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ContactInfoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Contact Info"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="HangUpAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="HangUpAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Hang Up"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ViewAllAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ViewAllAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="View All"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MapPinAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MapPinAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Map Pin"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PhoneAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PhoneAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Phone"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="VideoChatAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="VideoChatAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Video Chat"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SwitchAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SwitchAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Switch"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ContactAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ContactAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Contact"/> + <Setter Property="Content" Value=""/> + </Style> + + --> + + <!-- + + <Style x:Key="RenameAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RenameAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Rename"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PinAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PinAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Pin"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MusicInfoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MusicInfoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Music Info"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="GoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="GoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Go"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="KeyboardAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="KeyboardAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Keyboard"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DockLeftAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DockLeftAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Dock Left"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DockRightAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DockRightAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Dock Right"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DockBottomAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DockBottomAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Dock Bottom"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RemoteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RemoteAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Remote"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SyncAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SyncAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Sync"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RotateAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RotateAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Rotate"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ShuffleAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ShuffleAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Shuffle"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ListAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ListAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="List"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ShopAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ShopAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Shop"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SelectAllAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SelectAllAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Select All"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OrientationAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OrientationAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Orientation"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ImportAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ImportAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Import"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ImportAllAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ImportAllAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Import All"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="BrowsePhotosAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="BrowsePhotosAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Browse Photos"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="WebcamAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="WebcamAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Webcam"/> + <Setter Property="Content" Value=""/> + </Style> + --> + + <!-- + <Style x:Key="PicturesAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PicturesAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Pictures"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SaveLocalAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SaveLocalAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Save Local"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CaptionAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CaptionAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Caption"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="StopAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="StopAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Stop"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ShowResultsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ShowResultsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Show Results"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="VolumeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="VolumeAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Volume"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RepairAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RepairAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Repair"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MessageAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MessageAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Message"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="Page2AppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="Page2AppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Page2"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CalendarDayAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CalendarDayAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Day"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CalendarWeekAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CalendarWeekAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Week"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CalendarAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CalendarAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Calendar"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CharactersAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CharactersAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Characters"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MailReplyAllAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MailReplyAllAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Reply All"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ReadAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ReadAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Read"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="LinkAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="LinkAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Link"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AccountsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AccountsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Accounts"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ShowBccAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ShowBccAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Show Bcc"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="HideBccAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="HideBccAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Hide Bcc"/> + <Setter Property="Content" Value=""/> + </Style> + --> + + <!-- + <Style x:Key="CutAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CutAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Cut"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AttachAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AttachAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Attach"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PasteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PasteAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Paste"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FilterAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FilterAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Filter"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CopyAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CopyAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Copy"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="Emoji2AppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="Emoji2AppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Emoji2"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ImportantAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ImportantAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Important"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MailReplyAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MailReplyAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Reply"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SlideShowAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SlideShowAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Slideshow"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SortAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SortAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Sort"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ManageAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ManageAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Manage"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AllAppsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AllAppsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="All Apps"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DisconnectDriveAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DisconnectDriveAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Disconnect Drive"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MapDriveAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MapDriveAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Map Drive"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="NewWindowAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="NewWindowAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="New Window"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OpenWithAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OpenWithAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Open With"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ContactPresenceAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ContactPresenceAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Presence"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PriorityAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PriorityAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Priority"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="UploadSkyDriveAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="UploadSkyDriveAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Skydrive"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="GoToTodayAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="GoToTodayAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Today"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FontAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FontAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Font"/> + <Setter Property="Content" Value=""/> + </Style> + + --> + + <!-- + + <Style x:Key="FontColorAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FontColorAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Font Color"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="Contact2AppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="Contact2AppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Contact"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FolderppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FolderAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Folder"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AudioAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AudioAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Audio"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PlaceholderAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PlaceholderAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Placeholder"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ViewAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ViewAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="View"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SetLockScreenAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SetLockscreenAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Set Lockscreen"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SetTitleAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SetTitleAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Set Title"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CcAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CcAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Cc"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="StopSlideShowAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="StopSlideshowAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Stop Slideshow"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PermissionsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PermissionsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Permisions"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="HighlightAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="HighlightAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Highlight"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DisableUpdatesAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DisableUpdatesAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Disable Updates"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="UnfavoriteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="UnfavoriteAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Unfavorite"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="UnPinAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="UnPinAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Unpin"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OpenLocalAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OpenLocalAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Open Loal"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MuteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MuteAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Mute"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ItalicAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ItalicAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Italic"/> + <Setter Property="Content" Value=""/> + </Style> + --> + + <!-- + <Style x:Key="UnderlineAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="UnderlineAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Underline"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="BoldAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="BoldAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Bold"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MoveToFolderAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MoveToFolderAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Move to Folder"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="LikeDislikeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="LikeDislikeAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Like/Dislike"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DislikeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DislikeAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Dislike"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="LikeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="LikeAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Like"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AlignRightAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AlignRightAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Align Right"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AlignCenterAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AlignCenterAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Align Center"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AlignLeftAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AlignLeftAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Align Left"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ZoomAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ZoomAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Zoom"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ZoomOutAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ZoomOutAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Zoom Out"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OpenFileAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OpenFileAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Open File"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OtherUserAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OtherUserAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Other User"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AdminAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AdminAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Admin"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="StreetAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="StreetAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Street"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MapAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MapAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Map"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ClearSelectionAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ClearSelectionAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Clear Selection"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FontDecreaseAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FontDecreaseAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Decrease Font"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FontIncreaseAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FontIncreaseAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Increase Font"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FontSizeAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FontSizeAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Font Size"/> + <Setter Property="Content" Value=""/> + </Style> + --> + + <!-- + <Style x:Key="CellphoneAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CellphoneAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Cellphone"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ReshareAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ReshareAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Reshare"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="TagAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="TagAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Tag"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RepeatOneAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RepeatOneAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Repeat Once"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="RepeatAllAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="RepeatAllAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Repeat All"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OutlineStarAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OutlineStarAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Outline Star"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SolidStarAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SolidStarAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Solid Star"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CalculatorAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CalculatorAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Calculator"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="DirectionsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="DirectionsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Directions"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="TargetAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="TargetAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Target"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="LibraryAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="LibraryAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Library"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PhonebookAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PhonebookAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Phonebook"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MemoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MemoAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Memo"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="MicrophoneAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="MicrophoneAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Microphone"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="PostUpdateAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="PostUpdateAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Post Update"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="BackToWindowAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="BackToWindowAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Back to Window"/> + <Setter Property="Content" Value=""/> + </Style> + --> + + <!-- + <Style x:Key="FullScreenAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FullScreenAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Full Screen"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="NewFolderAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="NewFolderAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="New Folder"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="CalendarReplyAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="CalendarReplyAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Calendar Reply"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="UnsyncFolderAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="UnsyncFolderAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Unsync Folder"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ReportHackedAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ReportHackedAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Report Hacked"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SyncFolderAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SyncFolderAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Sync Folder"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="BlockContactAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="Block ContactAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="BlockContact"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="SwitchAppsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="SwitchAppsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Switch Apps"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="AddFriendAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="AddFriendAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Add Friend"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="TouchPointerAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="TouchPointerAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Touch Pointer"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="GoToStartAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="GoToStartAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Go to Start"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ZeroBarsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ZeroBarsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Zero Bars"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="OneBarAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="OneBarAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="One Bar"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="TwoBarsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="TwoBarsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Two Bars"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="ThreeBarsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="ThreeBarsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Three Bars"/> + <Setter Property="Content" Value=""/> + </Style> + <Style x:Key="FourBarsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> + <Setter Property="AutomationProperties.AutomationId" Value="FourBarsAppBarButton"/> + <Setter Property="AutomationProperties.Name" Value="Four Bars"/> + <Setter Property="Content" Value=""/> + </Style> + + --> + + <!-- Title area styles --> + + <Style x:Key="PageHeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource HeaderTextStyle}"> + <Setter Property="TextWrapping" Value="NoWrap"/> + <Setter Property="VerticalAlignment" Value="Bottom"/> + <Setter Property="Margin" Value="0,0,30,40"/> + </Style> + + <Style x:Key="PageSubheaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource SubheaderTextStyle}"> + <Setter Property="TextWrapping" Value="NoWrap"/> + <Setter Property="VerticalAlignment" Value="Bottom"/> + <Setter Property="Margin" Value="0,0,0,40"/> + </Style> + + <Style x:Key="SnappedPageHeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource PageSubheaderTextStyle}"> + <Setter Property="Margin" Value="0,0,18,40"/> + </Style> + + <!-- + BackButtonStyle is used to style a Button for use in the title area of a page. Margins appropriate for + the conventional page layout are included as part of the style. + --> + <Style x:Key="BackButtonStyle" TargetType="Button"> + <Setter Property="MinWidth" Value="0"/> + <Setter Property="Width" Value="48"/> + <Setter Property="Height" Value="48"/> + <Setter Property="Margin" Value="36,0,36,36"/> + <Setter Property="VerticalAlignment" Value="Bottom"/> + <Setter Property="FontFamily" Value="Segoe UI Symbol"/> + <Setter Property="FontWeight" Value="Normal"/> + <Setter Property="FontSize" Value="56"/> + <Setter Property="AutomationProperties.AutomationId" Value="BackButton"/> + <Setter Property="AutomationProperties.Name" Value="Back"/> + <Setter Property="AutomationProperties.ItemType" Value="Navigation Button"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid x:Name="RootGrid"> + <Grid Margin="-1,-16,0,0"> + <TextBlock x:Name="BackgroundGlyph" Text="" Foreground="{StaticResource BackButtonBackgroundThemeBrush}"/> + <TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonGlyph}" Foreground="{StaticResource BackButtonForegroundThemeBrush}"/> + <TextBlock x:Name="ArrowGlyph" Text="" Foreground="{StaticResource BackButtonPressedForegroundThemeBrush}" Opacity="0"/> + </Grid> + <Rectangle + x:Name="FocusVisualWhite" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="1.5"/> + <Rectangle + x:Name="FocusVisualBlack" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="0.5"/> + + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal" /> + <VisualState x:Name="PointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimation + Storyboard.TargetName="ArrowGlyph" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + <DoubleAnimation + Storyboard.TargetName="NormalGlyph" + Storyboard.TargetProperty="Opacity" + To="0" + Duration="0"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <DoubleAnimation + Storyboard.TargetName="FocusVisualWhite" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + <DoubleAnimation + Storyboard.TargetName="FocusVisualBlack" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused" /> + <VisualState x:Name="PointerFocused" /> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- + PortraitBackButtonStyle is used to style a Button for use in the title area of a portrait page. Margins appropriate + for the conventional page layout are included as part of the style. + --> + <Style x:Key="PortraitBackButtonStyle" TargetType="Button" BasedOn="{StaticResource BackButtonStyle}"> + <Setter Property="Margin" Value="26,0,26,36"/> + </Style> + + <!-- + SnappedBackButtonStyle is used to style a Button for use in the title area of a snapped page. Margins appropriate + for the conventional page layout are included as part of the style. + + The obvious duplication here is necessary as the glyphs used in snapped are not merely smaller versions of the same + glyph but are actually distinct. + --> + <Style x:Key="SnappedBackButtonStyle" TargetType="Button"> + <Setter Property="MinWidth" Value="0"/> + <Setter Property="Margin" Value="20,0,0,0"/> + <Setter Property="VerticalAlignment" Value="Bottom"/> + <Setter Property="FontFamily" Value="Segoe UI Symbol"/> + <Setter Property="FontWeight" Value="Normal"/> + <Setter Property="FontSize" Value="26.66667"/> + <Setter Property="AutomationProperties.AutomationId" Value="BackButton"/> + <Setter Property="AutomationProperties.Name" Value="Back"/> + <Setter Property="AutomationProperties.ItemType" Value="Navigation Button"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid x:Name="RootGrid" Width="36" Height="36" Margin="-3,0,7,33"> + <Grid Margin="-1,-1,0,0"> + <TextBlock x:Name="BackgroundGlyph" Text="" Foreground="{StaticResource BackButtonBackgroundThemeBrush}"/> + <TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonSnappedGlyph}" Foreground="{StaticResource BackButtonForegroundThemeBrush}"/> + <TextBlock x:Name="ArrowGlyph" Text="" Foreground="{StaticResource BackButtonPressedForegroundThemeBrush}" Opacity="0"/> + </Grid> + <Rectangle + x:Name="FocusVisualWhite" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="1.5"/> + <Rectangle + x:Name="FocusVisualBlack" + IsHitTestVisible="False" + Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="0.5"/> + + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal" /> + <VisualState x:Name="PointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonForegroundThemeBrush}"/> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimation + Storyboard.TargetName="ArrowGlyph" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + <DoubleAnimation + Storyboard.TargetName="NormalGlyph" + Storyboard.TargetProperty="Opacity" + To="0" + Duration="0"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <DoubleAnimation + Storyboard.TargetName="FocusVisualWhite" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + <DoubleAnimation + Storyboard.TargetName="FocusVisualBlack" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0"/> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused" /> + <VisualState x:Name="PointerFocused" /> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Item templates --> + + <!-- Grid-appropriate 250 pixel square item template as seen in the GroupedItemsPage and ItemsPage --> + <DataTemplate x:Key="Standard250x250ItemTemplate"> + <Grid HorizontalAlignment="Left" Width="250" Height="250"> + <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}"> + <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/> + </Border> + <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}"> + <TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/> + <TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/> + </StackPanel> + </Grid> + </DataTemplate> + + <!-- Grid-appropriate 500 by 130 pixel item template as seen in the GroupDetailPage --> + <DataTemplate x:Key="Standard500x130ItemTemplate"> + <Grid Height="110" Width="480" Margin="10"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="110" Height="110"> + <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/> + </Border> + <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0"> + <TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextStyle}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Subtitle}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Description}" Style="{StaticResource BodyTextStyle}" MaxHeight="60"/> + </StackPanel> + </Grid> + </DataTemplate> + + <!-- List-appropriate 130 pixel high item template as seen in the SplitPage --> + <DataTemplate x:Key="Standard130ItemTemplate"> + <Grid Height="110" Margin="6"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="110" Height="110"> + <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/> + </Border> + <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0"> + <TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextStyle}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Subtitle}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Description}" Style="{StaticResource BodyTextStyle}" MaxHeight="60"/> + </StackPanel> + </Grid> + </DataTemplate> + + <!-- + List-appropriate 80 pixel high item template as seen in the SplitPage when Filled, and + the following pages when snapped: GroupedItemsPage, GroupDetailPage, and ItemsPage + --> + <DataTemplate x:Key="Standard80ItemTemplate"> + <Grid Margin="6"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="60" Height="60"> + <Image Source="{Binding Image}" Stretch="UniformToFill"/> + </Border> + <StackPanel Grid.Column="1" Margin="10,0,0,0"> + <TextBlock Text="{Binding Title}" Style="{StaticResource ItemTextStyle}" MaxHeight="40"/> + <TextBlock Text="{Binding Subtitle}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap"/> + </StackPanel> + </Grid> + </DataTemplate> + + <!-- Grid-appropriate 300 by 70 pixel item template as seen in the SearchResultsPage --> + <DataTemplate x:Key="StandardSmallIcon300x70ItemTemplate"> + <Grid Width="294" Margin="6"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="0,0,0,10" Width="40" Height="40"> + <Image Source="{Binding Image}" Stretch="UniformToFill"/> + </Border> + <StackPanel Grid.Column="1" Margin="10,-10,0,0"> + <TextBlock Text="{Binding Title}" Style="{StaticResource BodyTextStyle}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Subtitle}" Style="{StaticResource BodyTextStyle}" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Description}" Style="{StaticResource BodyTextStyle}" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" TextWrapping="NoWrap"/> + </StackPanel> + </Grid> + </DataTemplate> + + <!-- List-appropriate 70 pixel high item template as seen in the SearchResultsPage when Snapped --> + <DataTemplate x:Key="StandardSmallIcon70ItemTemplate"> + <Grid Margin="6"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="0,0,0,10" Width="40" Height="40"> + <Image Source="{Binding Image}" Stretch="UniformToFill"/> + </Border> + <StackPanel Grid.Column="1" Margin="10,-10,0,0"> + <TextBlock Text="{Binding Title}" Style="{StaticResource BodyTextStyle}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Subtitle}" Style="{StaticResource BodyTextStyle}" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" TextWrapping="NoWrap"/> + <TextBlock Text="{Binding Description}" Style="{StaticResource BodyTextStyle}" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" TextWrapping="NoWrap"/> + </StackPanel> + </Grid> + </DataTemplate> + + <!-- + 190x130 pixel item template for displaying file previews as seen in the FileOpenPickerPage + Includes an elaborate tooltip to display title and description text + --> + <DataTemplate x:Key="StandardFileWithTooltip190x130ItemTemplate"> + <Grid> + <Grid Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}"> + <Image + Source="{Binding Image}" + Width="190" + Height="130" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Stretch="Uniform"/> + </Grid> + <ToolTipService.Placement>Mouse</ToolTipService.Placement> + <ToolTipService.ToolTip> + <ToolTip> + <ToolTip.Style> + <Style TargetType="ToolTip"> + <Setter Property="BorderBrush" Value="{StaticResource ToolTipBackgroundThemeBrush}" /> + <Setter Property="Padding" Value="0" /> + </Style> + </ToolTip.Style> + + <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + + <Grid Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="20"> + <Image + Source="{Binding Image}" + Width="160" + Height="160" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Stretch="Uniform"/> + </Grid> + <StackPanel Width="200" Grid.Column="1" Margin="0,20,20,20"> + <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" Style="{StaticResource BodyTextStyle}"/> + <TextBlock Text="{Binding Description}" MaxHeight="140" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" Style="{StaticResource BodyTextStyle}"/> + </StackPanel> + </Grid> + </ToolTip> + </ToolTipService.ToolTip> + </Grid> + </DataTemplate> + + <!-- ScrollViewer styles --> + + <Style x:Key="HorizontalScrollViewerStyle" TargetType="ScrollViewer"> + <Setter Property="HorizontalScrollBarVisibility" Value="Auto"/> + <Setter Property="VerticalScrollBarVisibility" Value="Disabled"/> + <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Enabled" /> + <Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled" /> + <Setter Property="ScrollViewer.ZoomMode" Value="Disabled" /> + </Style> + + <Style x:Key="VerticalScrollViewerStyle" TargetType="ScrollViewer"> + <Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/> + <Setter Property="VerticalScrollBarVisibility" Value="Auto"/> + <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" /> + <Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled" /> + <Setter Property="ScrollViewer.ZoomMode" Value="Disabled" /> + </Style> + + <!-- Page layout roots typically use entrance animations and a theme-appropriate background color --> + + <Style x:Key="LayoutRootStyle" TargetType="Panel"> + <Setter Property="Background" Value="{StaticResource ApplicationPageBackgroundThemeBrush}"/> + <Setter Property="ChildrenTransitions"> + <Setter.Value> + <TransitionCollection> + <EntranceThemeTransition/> + </TransitionCollection> + </Setter.Value> + </Setter> + </Style> +</ResourceDictionary> diff --git a/platform/windows/mupdf_cpp/DocumentPage.cpp b/platform/windows/mupdf_cpp/DocumentPage.cpp new file mode 100644 index 00000000..39a22aa9 --- /dev/null +++ b/platform/windows/mupdf_cpp/DocumentPage.cpp @@ -0,0 +1,15 @@ +#include "pch.h" +#include "DocumentPage.h" + +namespace mupdf_cpp +{ + DocumentPage::DocumentPage(void) + { + this->Image = nullptr; + this->Height = 0; + this->Width = 0; + this->PageZoom = 1.0; + this->Content = NOTSET; + _isPropertyChangedObserved = false; + } +} diff --git a/platform/windows/mupdf_cpp/DocumentPage.h b/platform/windows/mupdf_cpp/DocumentPage.h new file mode 100644 index 00000000..383d63d1 --- /dev/null +++ b/platform/windows/mupdf_cpp/DocumentPage.h @@ -0,0 +1,231 @@ +#pragma once + +#include "RectList.h" +#include <collection.h> + +/* Used for binding to the xaml in the scroll view. */ +using namespace Windows::UI::Xaml::Media::Imaging; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml::Data; + +typedef enum { + FULL_RESOLUTION = 0, + THUMBNAIL, + DUMMY, + OLD_RESOLUTION, + PRINT_PREVIEW, + NOTSET +} Page_Content_t; + +namespace mupdf_cpp +{ + // enables data binding with this class + [Windows::UI::Xaml::Data::Bindable] + public ref class DocumentPage sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged + { + private: + int height; + int width; + double page_zoom; + int native_height; + int native_width; + WriteableBitmap^ image; + Page_Content_t content; + IVector<RectList^>^ textbox; + IVector<RectList^>^ linkbox; + public: + DocumentPage(void); + + /* Note IVector needed for WinRT interface */ + property IVector<RectList^>^ TextBox + { + IVector<RectList^>^ get() + { + return (textbox); + } + + void set(IVector<RectList^>^ value) + { + textbox = value; + DocumentPage::OnPropertyChanged("TextBox"); + } + } + + property IVector<RectList^>^ LinkBox + { + IVector<RectList^>^ get() + { + return (linkbox); + } + + void set(IVector<RectList^>^ value) + { + linkbox = value; + DocumentPage::OnPropertyChanged("LinkBox"); + } + } + + property int Content + { + int get() + { + return ((int) content); + } + + void set(int value) + { + if (value > NOTSET) + { + throw ref new Platform::InvalidArgumentException(); + } + content = (Page_Content_t) value; + } + } + + property int Height + { + int get() + { + return height; + } + + void set(int value) + { + if (value < 0) + { + throw ref new Platform::InvalidArgumentException(); + } + height = value; + } + } + + property int Width + { + int get() + { + return width; + } + + void set(int value) + { + if (value < 0) + { + throw ref new Platform::InvalidArgumentException(); + } + width = value; + } + } + property int NativeHeight + { + int get() + { + return native_height; + } + + void set(int value) + { + if (value < 0) + { + throw ref new Platform::InvalidArgumentException(); + } + native_height = value; + } + } + + property int NativeWidth + { + int get() + { + return native_width; + } + + void set(int value) + { + if (value < 0) + { + throw ref new Platform::InvalidArgumentException(); + } + native_width = value; + } + } + + property double PageZoom + { + double get() + { + return page_zoom; + } + + void set(double value) + { + if (value < 0) + { + throw ref new Platform::InvalidArgumentException(); + } + page_zoom = value; + } + } + + property WriteableBitmap^ Image + { + WriteableBitmap^ get() + { + return image; + } + + void set(WriteableBitmap^ value) + { + image = value; + DocumentPage::OnPropertyChanged("Image"); + } + } + + private: + bool _isPropertyChangedObserved; + event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ _privatePropertyChanged; + + protected: + /// <summary> + /// Notifies listeners that a property value has changed. + /// </summary> + /// <param name="propertyName">Name of the property used to notify listeners.</param> + void OnPropertyChanged(String^ propertyName) + { + if (_isPropertyChangedObserved) + { + PropertyChanged(this, ref new PropertyChangedEventArgs(propertyName)); + } + } + + public: + + // in c++, it is not neccessary to include definitions + // of add, remove, and raise. These definitions have + // been made explicitly here so that we can check if + // the event has listeners before firing the event. + virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged + { + virtual Windows::Foundation::EventRegistrationToken add(Windows::UI::Xaml::Data::PropertyChangedEventHandler^ e) + { + _isPropertyChangedObserved = true; + return _privatePropertyChanged += e; + } + + virtual void remove(Windows::Foundation::EventRegistrationToken t) + { + _privatePropertyChanged -= t; + } + + protected: + virtual void raise(Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e) + { + if (_isPropertyChangedObserved) + { + _privatePropertyChanged(sender, e); + } + } + } +#pragma endregion + }; +} diff --git a/platform/windows/mupdf_cpp/MainPage.xaml b/platform/windows/mupdf_cpp/MainPage.xaml new file mode 100644 index 00000000..42296f6a --- /dev/null +++ b/platform/windows/mupdf_cpp/MainPage.xaml @@ -0,0 +1,299 @@ +<Page + x:Class="mupdf_cpp.MainPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:winapp" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> + + <Page.BottomAppBar> + <AppBar> + <Grid Margin="38,0,0,0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <Slider x:Name="xaml_PageSlider" Minimum="0" Maximum="10" PointerCaptureLost="Slider_ValueChanged" KeyUp="Slider_Key" Grid.Column="0" Margin="10,0" VerticalAlignment="Center" /> + <Button x:Name="Find_File" Style="{StaticResource OpenFileAppBarButtonStyle}" Tag="OpenFile" HorizontalAlignment="Right" Grid.Column="1" Click="Picker"/> + </Grid> + </AppBar> + </Page.BottomAppBar> + <Page.TopAppBar> + <AppBar x:Name="TopAppBar1" AutomationProperties.Name="Top App Bar" Loaded="topAppBar_Loaded"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <StackPanel x:Name="LeftPanel" Orientation="Horizontal" HorizontalAlignment="Left" > + <TextBox x:Name="FindBox" Width="200" Height="20" Margin="2"/> + <Button x:Name="PrevSearch" Style="{StaticResource PreviousAppBarButtonStyle}" Click="SearchPrev"/> + <Button x:Name="NextSearch" Style="{StaticResource NextAppBarButtonStyle}" Click="SearchNext"/> + + </StackPanel> + <StackPanel x:Name="RightPanel" Orientation="Horizontal" HorizontalAlignment="Right"> + <Button x:Name="Search" Style="{StaticResource SearchAppBarButtonStyle}" Tag="Search" Click="Searcher"/> + <Button x:Name="ZoomIn" Style="{StaticResource ZoomInAppBarButtonStyle}" Tag="ZoomIn" Click="ZoomInPress"/> + <Button x:Name="ZoomOut" Style="{StaticResource ZoomOutAppBarButtonStyle}" Tag="ZoomOut" Click="ZoomOutPress"/> + <Button x:Name="Contents" Style="{StaticResource ContentsBarButtonStyle}" Tag="Contents" Click="ContentDisplay"/> + <Button x:Name="Links" Style="{StaticResource LinksAppBarButtonStyle}" Tag="Links" Click="Linker"/> + <Button x:Name="Reflow" Style="{StaticResource ReflowAppBarButtonStyle}" Tag="Reflow" Click="Reflower"/> + </StackPanel> + </Grid> + </AppBar> + </Page.TopAppBar> + + <Grid x:Name="xaml_OutsideGrid"> + <Grid.Background> + <LinearGradientBrush EndPoint="-0.074,-0.068" StartPoint="1.027,1.024"> + <GradientStop Color="Black"/> + <GradientStop Color="White"/> + <GradientStop Color="White" Offset="0.919"/> + <GradientStop Color="#FFCDCDCD" Offset="0.741"/> + <GradientStop Color="#FF909090" Offset="0.524"/> + <GradientStop Color="#FF737373" Offset="0.421"/> + <GradientStop Color="#FF2A2A2A" Offset="0.155"/> + <GradientStop Color="#FF1A1A1A" Offset="0.097"/> + <GradientStop Color="#FF040404" Offset="0.018"/> + <GradientStop Color="#FFB3B3B3" Offset="0.651"/> + <GradientStop Color="#FF989898" Offset="0.556"/> + <GradientStop Color="#FF666666" Offset="0.375"/> + <GradientStop Color="#FF4B4B4B" Offset="0.278"/> + <GradientStop Color="#FF3A3A3A" Offset="0.215"/> + </LinearGradientBrush> + </Grid.Background> + + <Grid x:Name="xaml_MainGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SizeChanged="GridSizeChanged"> + <Canvas x:Name="xaml_zoomCanvas" HorizontalAlignment="Center" VerticalAlignment="Center" ManipulationMode="All" > + <!-- Horizontal flip view --> + <FlipView x:Name="xaml_horiz_flipView" SelectionChanged="FlipView_SelectionChanged" VerticalAlignment="Center" + HorizontalAlignment="Center" UseTouchAnimationsForAllNavigation="False"> + <FlipView.ItemsPanel> + <ItemsPanelTemplate> + <VirtualizingStackPanel Orientation="Horizontal"/> + </ItemsPanelTemplate> + </FlipView.ItemsPanel> + <FlipView.ItemTemplate> + <DataTemplate> + <ScrollViewer + Name="xaml_ScrollView_h" + ZoomMode="Enabled" + ViewChanged="ScrollChanged" + HorizontalScrollMode="Auto" + VerticalScrollMode="Auto" + VerticalSnapPointsType="None" + HorizontalSnapPointsType="None" + HorizontalScrollBarVisibility="Auto" + VerticalScrollBarVisibility="Auto" + MinZoomFactor="0.25" + MaxZoomFactor="4" IsZoomChainingEnabled="true"> + <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="{Binding Height}" Width="{Binding Width}"> + <Image Source="{Binding Image}" Width="{Binding Width}" Height="{Binding Height}" + Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"/> + <!-- After much work, figured out how to have a binding for the rectangles. TextBox and LinkBox are + a collection that is in the other main collection used for the scroll viewer. It works + nicely and cleanly once you figure out how to set up all the templates and the bindings --> + <ItemsControl ItemsSource="{Binding Path=TextBox}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Canvas/> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemContainerStyle> + <Style TargetType="ContentPresenter"> + <Setter Property="Canvas.Left" Value="{Binding Left}"/> + <Setter Property="Canvas.Top" Value="{Binding Top}"/> + </Style> + </ItemsControl.ItemContainerStyle> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}"> + <Rectangle.RenderTransform> + <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> + </Rectangle.RenderTransform> + </Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <ItemsControl ItemsSource="{Binding Path=LinkBox}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Canvas/> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemContainerStyle> + <Style TargetType="ContentPresenter"> + <Setter Property="Canvas.Left" Value="{Binding Left}"/> + <Setter Property="Canvas.Top" Value="{Binding Top}"/> + </Style> + </ItemsControl.ItemContainerStyle> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}" IsTapEnabled="True" Tapped="LinkTapped"> + <Rectangle.RenderTransform> + <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> + </Rectangle.RenderTransform> + </Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + </Canvas> + </ScrollViewer> + </DataTemplate> + </FlipView.ItemTemplate> + </FlipView> + <!-- Vertical flip view --> + <FlipView x:Name="xaml_vert_flipView" SelectionChanged="FlipView_SelectionChanged" VerticalAlignment="Center" + HorizontalAlignment="Center" IsEnabled="False" Opacity="0" UseTouchAnimationsForAllNavigation="False"> + <FlipView.ItemsPanel> + <ItemsPanelTemplate> + <VirtualizingStackPanel Orientation="Vertical"/> + </ItemsPanelTemplate> + </FlipView.ItemsPanel> + <FlipView.ItemTemplate> + <DataTemplate> + <ScrollViewer + Name="xaml_ScrollView_v" + ZoomMode="Enabled" + ViewChanged="ScrollChanged" + HorizontalScrollMode="Auto" + VerticalScrollMode="Auto" + VerticalSnapPointsType="None" + HorizontalSnapPointsType="None" + HorizontalScrollBarVisibility="Auto" + VerticalScrollBarVisibility="Auto" + MinZoomFactor="0.25" + MaxZoomFactor="4"> + <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="{Binding Height}" Width="{Binding Width}"> + <Image Source="{Binding Image}" Width="{Binding Width}" Height="{Binding Height}" + Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"/> + <ItemsControl ItemsSource="{Binding Path=TextBox}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Canvas/> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemContainerStyle> + <Style TargetType="ContentPresenter"> + <Setter Property="Canvas.Left" Value="{Binding Left}"/> + <Setter Property="Canvas.Top" Value="{Binding Top}"/> + </Style> + </ItemsControl.ItemContainerStyle> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}" IsTapEnabled="True" Tapped="LinkTapped"> + <Rectangle.RenderTransform> + <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> + </Rectangle.RenderTransform> + </Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <ItemsControl ItemsSource="{Binding Path=LinkBox}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Canvas/> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemContainerStyle> + <Style TargetType="ContentPresenter"> + <Setter Property="Canvas.Left" Value="{Binding Left}"/> + <Setter Property="Canvas.Top" Value="{Binding Top}"/> + </Style> + </ItemsControl.ItemContainerStyle> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}" IsTapEnabled="True" Tapped="LinkTapped"> + <Rectangle.RenderTransform> + <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> + </Rectangle.RenderTransform> + </Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Canvas> + </ScrollViewer> + </DataTemplate> + </FlipView.ItemTemplate> + </FlipView> + </Canvas> + <ListView x:Name="xaml_ListView" Foreground="Black" HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" Opacity="0" IsItemClickEnabled="True" + ItemClick="ContentSelected" SelectionMode="Single" IsEnabled="False"> + + <ListView.ItemTemplate> + <DataTemplate> + <StackPanel Margin="5,5,0,0" HorizontalAlignment="Left"> + <TextBlock TextWrapping="Wrap" Text="{Binding StringMargin}" FontFamily="Segoe UI" FontSize="20" /> + </StackPanel> + </DataTemplate> + </ListView.ItemTemplate> + + <ListView.Background> + <SolidColorBrush Color="LightGray"></SolidColorBrush> + </ListView.Background> + </ListView> + </Grid> + + <!-- Note that windows webview does not reflow when we scale. It + will only do this with a size change. Unfortunately, the webview + object is special in that it intercepts all actions and passes + nothing to the application for these manipulations. I tried + various things including the use of a webview brush to + capture the current webview but that is a complex issue since + it is a static image in that case. The other option would + be to go to a Rich Text type of view. --> + <WebView x:Name="xaml_WebView" HorizontalAlignment="Stretch" Width="Auto" Height="Auto" + VerticalAlignment="Stretch" Visibility="Collapsed" + ScrollViewer.HorizontalScrollBarVisibility="Visible" + ScrollViewer.VerticalScrollBarVisibility="Visible" + ScrollViewer.VerticalScrollMode="Enabled" + ScrollViewer.HorizontalScrollMode="Enabled" + ScrollViewer.ZoomMode="Enabled"/> + + <StackPanel x:Name="xaml_ProgressStack" Opacity="1" VerticalAlignment="Center" Margin="0,15" HorizontalAlignment="Center" Visibility="Collapsed"> + <Border BorderThickness="5" BorderBrush="Black" > + <StackPanel Background="LightGray" HorizontalAlignment="Left" Width="756" > + <TextBlock HorizontalAlignment="Center" Margin="10" + Text="Text Search Progress" FontSize="20"/> + <ProgressBar x:Name="xaml_Progress" Margin="5" Height="15" + IsIndeterminate="False" Maximum="100" VerticalAlignment="Stretch" /> + <Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10" Click="CancelSearch" Height="39"> + <TextBlock HorizontalAlignment="Center" Text="Cancel"/> + </Button> + </StackPanel> + </Border> + </StackPanel> + + <StackPanel x:Name="xaml_PrintStack" Opacity="1" VerticalAlignment="Center" Margin="0,15" HorizontalAlignment="Center" Visibility="Collapsed"> + <Border BorderThickness="5" BorderBrush="Black" > + <StackPanel Background="LightGray" HorizontalAlignment="Left" Width="756" > + <TextBlock HorizontalAlignment="Center" Margin="10" + Text="Print Progress" FontSize="20"/> + <ProgressBar x:Name="xaml_PrintProgress" Margin="5" Height="15" + IsIndeterminate="False" Maximum="100" VerticalAlignment="Stretch" /> + <Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10" Click="HideProgress" Height="39"> + <TextBlock HorizontalAlignment="Center" Text="Hide"/> + </Button> + </StackPanel> + </Border> + </StackPanel> + + <StackPanel x:Name="xaml_PasswordStack" Opacity="1" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed"> + <Border BorderThickness="5" BorderBrush="Black" > + <StackPanel Background="LightGray" > + <TextBlock HorizontalAlignment="Center" Margin="10" + Text="Password Required" FontSize="20"/> + <PasswordBox x:Name="xaml_password" Height="35" Width="400" Margin="20"/> + <Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10" Click="PasswordOK" Height="39"> + <TextBlock HorizontalAlignment="Center" Text="OK"/> + </Button> + </StackPanel> + </Border> + </StackPanel> + </Grid> +</Page> diff --git a/platform/windows/mupdf_cpp/MainPage.xaml.cpp b/platform/windows/mupdf_cpp/MainPage.xaml.cpp new file mode 100644 index 00000000..a57a7a23 --- /dev/null +++ b/platform/windows/mupdf_cpp/MainPage.xaml.cpp @@ -0,0 +1,2394 @@ +// +// MainPage.xaml.cpp +// Implementation of the MainPage class. +// + +#include "pch.h" +#include "MainPage.xaml.h" +#include <regex> +#include <sstream> +#include "DXGI1_3.h" + +#define LOOK_AHEAD 1 /* A +/- count on the pages to pre-render */ +#define THUMB_PREADD 10 +#define MIN_SCALE 0.5 + +#define SCALE_THUMB 0.1 +#define PRINT_PREVIEW_SCALE 0.5 + +#define BLANK_WIDTH 17 +#define BLANK_HEIGHT 22 + +#define KEYBOARD_ZOOM_STEP 0.25 +#define ZOOM_MAX 4 +#define ZOOM_MIN 0.25 + +#define KEY_PLUS 0xbb +#define KEY_MINUS 0xbd +#define ZOOM_IN 0 +#define ZOOM_OUT 1 + +#define SEARCH_FIT 672 +#define VS_LARGE 1366 +#define VS_SMALL 500 + +static float screenScale = 1; + +using namespace mupdf_cpp; +using namespace Windows::Foundation; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; +using namespace Windows::Graphics::Display; +using namespace Windows::Graphics::Printing; +using namespace Windows::UI::Core; + +//****************** Added ***************** +using namespace Windows::Storage::Pickers; +using namespace Windows::Devices::Enumeration; +using namespace concurrency; +using namespace Windows::Graphics::Imaging; +//****************** End Add **************** + +#ifndef NDEBUG +unsigned int _mainThreadId = 0U; + +#ifdef __cplusplus +extern "C" { +#endif + + // The IsMainThread function returns true if the current thread is the app's main thread and false otherwise. + bool IsMainThread() + { + return (_mainThreadId == GetCurrentThreadId()); + } + + // The IsBackgroundThread function returns false if the current thread is the app's main thread and true otherwise. + bool IsBackgroundThread() + { + return (_mainThreadId != GetCurrentThreadId()); + } + + // The RecordMainThread function registers the main thread ID for use by the IsMainThread and IsBackgroundThread functions. + void RecordMainThread() + { + _mainThreadId = GetCurrentThreadId(); + } + +#ifdef __cplusplus +} +#endif + +#endif /* not NDEBUG */ + +MainPage::MainPage() +{ + InitializeComponent(); + Application::Current->Suspending += + ref new SuspendingEventHandler(this, &MainPage::App_Suspending); + Application::Current->UnhandledException += + ref new UnhandledExceptionEventHandler(this, &MainPage::ExceptionHandler); + m_textcolor="#402572AC"; + m_linkcolor="#40AC7225"; + mu_doc = nullptr; + m_docPages = ref new Platform::Collections::Vector<DocumentPage^>(); + m_thumbnails = ref new Platform::Collections::Vector<DocumentPage^>(); + m_page_link_list = ref new Platform::Collections::Vector<IVector<RectList^>^>(); + m_text_list = ref new Platform::Collections::Vector<RectList^>(); + m_linkset = ref new Platform::Collections::Vector<int>(); + if (m_docPages == nullptr || m_thumbnails == nullptr || + m_page_link_list == nullptr || m_text_list == nullptr || + m_linkset == nullptr) + throw ref new FailureException("Document allocation failed!"); + + SetUpDirectX(); + RegisterForPrinting(); + CleanUp(); +#ifndef NDEBUG + RecordMainThread(); +#endif + /* So that we can catch special loading events (e.g. open with) */ + _pageLoadedHandlerToken = Loaded += ref new RoutedEventHandler(this, &MainPage::Page_Loaded); +} + +/* You need a Direct3D device to create a Direct2D device. This gets stuff + set up for Direct2D printing support */ +void MainPage::SetUpDirectX() +{ + UINT creation_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; + ComPtr<IDXGIDevice> dxgi_device; + D2D1_FACTORY_OPTIONS options; + ZeroMemory(&options, sizeof(D2D1_FACTORY_OPTIONS)); + D3D_FEATURE_LEVEL feature_levels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + D3D_FEATURE_LEVEL_9_3, + D3D_FEATURE_LEVEL_9_2, + D3D_FEATURE_LEVEL_9_1 + }; + ComPtr<ID3D11Device> device; + ComPtr<ID3D11DeviceContext> context; + +#if defined(_DEBUG) + options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION; +#endif + + ThrowIfFailed(D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, 0, + creation_flags, feature_levels, ARRAYSIZE(feature_levels), + D3D11_SDK_VERSION, &device, &m_featureLevel, &context)); + ThrowIfFailed(device.As(&m_d3d_device)); + ThrowIfFailed(context.As(&m_d3d_context)); + ThrowIfFailed(m_d3d_device.As(&dxgi_device)); + ThrowIfFailed(D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, + __uuidof(ID2D1Factory1), &options, &m_d2d_factory)); + ThrowIfFailed(CoCreateInstance(CLSID_WICImagingFactory, nullptr, + CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_wic_factory))); + m_d2d_factory->CreateDevice(dxgi_device.Get(), &m_d2d_device); +} + +/* Used during launch of application from file when application was not + already running */ +void MainPage::Page_Loaded(Object^ sender, RoutedEventArgs^ e) +{ + MainPage^ rootPage = dynamic_cast<MainPage^>(sender); + if (rootPage->FileEvent != nullptr) + { + /* Launched with an "open with", or as default app */ + if (rootPage->FileEvent->Files->Size > 0) + { + IStorageItem ^file = rootPage->FileEvent->Files->GetAt(0); + StorageFile ^sfile = safe_cast<StorageFile^>(file); + + OpenDocumentPrep(sfile); + } + } +} + +/* Used during launch of application from file when application was already + running */ +void MainPage::FromFile() +{ + if (this->FileEvent != nullptr) + { + /* Launched with an "open with", or as default app */ + if (this->FileEvent->Files->Size > 0) + { + IStorageItem ^file = this->FileEvent->Files->GetAt(0); + StorageFile ^sfile = safe_cast<StorageFile^>(file); + + OpenDocumentPrep(sfile); + } + } +} + +/// <summary> +/// Invoked when this page is about to be displayed in a Frame. +/// </summary> +/// <param name="e">Event data that describes how this page was reached. The Parameter +/// property is typically used to configure the page.</param> +void MainPage::OnNavigatedTo(NavigationEventArgs^ e) +{ + +} + +void MainPage::ExceptionHandler(Object^ sender, UnhandledExceptionEventArgs^ e) +{ + if (!this->m_init_done) + { + /* Windows 8.1 has some weird issues that occur before we have even tried + to open a document. For example rolling the mouse wheel throws an + exception in 8.1 but not 8.0. This is clearly a windows issue. For + now mark as handled and move on which seems to be fine */ + e->Handled = true; + } + else + { + e->Handled = true; + NotifyUser("An error was encountered", ErrorMessage); + } +} + +/* We need to clean up (Trim) the directX memory on suspension */ +void MainPage::App_Suspending(Object^ sender, SuspendingEventArgs^ e) +{ + ComPtr<IDXGIDevice3> pDXGIDevice; + ThrowIfFailed(m_d3d_device.As(&pDXGIDevice)); + pDXGIDevice->Trim(); +} + +void MainPage::ExitInvokedHandler(Windows::UI::Popups::IUICommand^ command) +{ + +} + +void MainPage::OKInvokedHandler(Windows::UI::Popups::IUICommand^ command) +{ + +} + +void MainPage::NotifyUser(String^ strMessage, int type) +{ + MessageDialog^ msg = ref new MessageDialog(strMessage); + UICommand^ ExitCommand = nullptr; + UICommand^ OKCommand = nullptr; + + switch (type) + { + case StatusMessage: + OKCommand = ref new UICommand("OK", + ref new UICommandInvokedHandler(this, &MainPage::OKInvokedHandler)); + msg->Commands->Append(OKCommand); + /// Set the command that will be invoked by default + msg->DefaultCommandIndex = 0; + // Set the command to be invoked when escape is pressed + msg->CancelCommandIndex = 1; + break; + case ErrorMessage: + ExitCommand = ref new UICommand("Exit", + ref new UICommandInvokedHandler(this, &MainPage::ExitInvokedHandler)); + msg->Commands->Append(ExitCommand); + /// Set the command that will be invoked by default + msg->DefaultCommandIndex = 0; + // Set the command to be invoked when escape is pressed + msg->CancelCommandIndex = 1; + break; + default: + break; + } + // Show the message dialog + msg->ShowAsync(); +} + +void MainPage::Picker(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + /* If we are actively rendering a document to the print thread then notify the + user that they will need to wait */ + if (m_print_active == PRINT_ACTIVE) + { + int total_pages = GetPrintPageCount(); + auto str1 = "Cannot open new file. Currently rendering page " + + m_curr_print_count + " of " + total_pages + " for print queue"; + NotifyUser(str1, StatusMessage); + return; + } + + FileOpenPicker^ openPicker = ref new FileOpenPicker(); + openPicker->ViewMode = PickerViewMode::List; + openPicker->SuggestedStartLocation = PickerLocationId::DocumentsLibrary; + openPicker->FileTypeFilter->Append(".pdf"); + openPicker->FileTypeFilter->Append(".xps"); + openPicker->FileTypeFilter->Append(".cbz"); + openPicker->FileTypeFilter->Append(".oxps"); + + create_task(openPicker->PickSingleFileAsync()).then([this](StorageFile^ file) + { + if (file) + { + this->OpenDocumentPrep(file); + } + else + { + /* Nothing selected */ + } + }); +} + +/* Set the page with the new raster information */ +void MainPage::UpdatePage(int page_num, InMemoryRandomAccessStream^ ras, + Point ras_size, Page_Content_t content_type, double zoom_in) +{ + assert(IsMainThread()); + + WriteableBitmap ^bmp = ref new WriteableBitmap((int)ras_size.X, (int) ras_size.Y); + if (bmp == nullptr) + { +#ifdef _DEBUG + NotifyUser("BMP UpdatePage Failed Page " + page_num, ErrorMessage); +#endif + return; + } + bmp->SetSource(ras); + + DocumentPage^ doc_page = ref new DocumentPage(); + if (doc_page == nullptr) + { +#ifdef _DEBUG + NotifyUser("doc_page UpdatePage Failed Page " + page_num, ErrorMessage); +#endif + return; + } + doc_page->Image = bmp; + + if (content_type == THUMBNAIL) + { + doc_page->Height = (int) (ras_size.Y / SCALE_THUMB); + doc_page->Width = (int) (ras_size.X / SCALE_THUMB); + } + else + { + doc_page->Height = (int) ras_size.Y; + doc_page->Width = (int) ras_size.X; + } + doc_page->Content = content_type; + doc_page->PageZoom = zoom_in; + + /* We do not want flipview change notification to occur for ourselves */ + m_page_update = true; + this->m_docPages->SetAt(page_num, doc_page); + m_page_update = false; +} + +/* Set the page with the new raster information but only the image data */ +void MainPage::ReplaceImage(int page_num, InMemoryRandomAccessStream^ ras, + Point ras_size, double page_zoom) +{ + assert(IsMainThread()); + + WriteableBitmap ^bmp = ref new WriteableBitmap((int) ras_size.X, (int) ras_size.Y); + if (bmp == nullptr) + { +#ifdef _DEBUG + NotifyUser("BMP ReplaceImage Failed Page " + page_num, ErrorMessage); +#endif + return; + } + + bmp->SetSource(ras); + DocumentPage^ doc_page = this->m_docPages->GetAt(page_num); + if (doc_page == nullptr) + { +#ifdef _DEBUG + NotifyUser("doc_page ReplaceImage Failed Page " + page_num, ErrorMessage); +#endif + return; + } + doc_page->Image = bmp; + doc_page->Height = (int) ras_size.Y; + doc_page->Width = (int) ras_size.X; + doc_page->PageZoom = page_zoom; +} + +int MainPage::ComputePageSize(spatial_info_t spatial_info, int page_num, + Point *render_size, float *scale_factor) +{ + Point screenSize; + Point renpageSize; + Point size; + + try + { + size = mu_doc->GetPageSize(page_num); + } + catch (Exception ^except) + { +#ifdef _DEBUG + NotifyUser(except->Message, ErrorMessage); +#endif + return E_FAILURE; + } + + screenSize = spatial_info.size; + screenSize.Y *= screenScale; + screenSize.X *= screenScale; + + float hscale = screenSize.X / size.X; + float vscale = screenSize.Y / size.Y; + float scale = min(hscale, vscale); + renpageSize.X = (float)(size.X * scale * spatial_info.scale_factor); + renpageSize.Y = (float)(size.Y * scale * spatial_info.scale_factor); + + *scale_factor = (float) (scale * spatial_info.scale_factor); + *render_size = renpageSize; + + return S_ISOK; +} + +static Point fitPageToScreen(Point page, Point screen) +{ + Point pageSize; + + float hscale = screen.X / page.X; + float vscale = screen.Y / page.Y; + float scale = min(hscale, vscale); + pageSize.X = floorf(page.X * scale) / page.X; + pageSize.Y = floorf(page.Y * scale) / page.Y; + + return pageSize; +} + +spatial_info_t MainPage::InitSpatial(double scale) +{ + spatial_info_t value; + + value.size.Y = (float) (this->ActualHeight); + value.size.X = (float) (this->ActualWidth); + value.scale_factor = scale; + + return value; +} + +void Prepare_bmp(int width, int height, DataWriter ^dw) +{ + int row_size = width * 4; + int bmp_size = row_size * height + 54; + + dw->WriteString("BM"); + dw->ByteOrder = ByteOrder::LittleEndian; + dw->WriteInt32(bmp_size); + dw->WriteInt16(0); + dw->WriteInt16(0); + dw->WriteInt32(54); + dw->WriteInt32(40); + dw->WriteInt32(width); + dw->WriteInt32(height); + dw->WriteInt16(1); + dw->WriteInt16(32); + dw->WriteInt32(0); + dw->WriteInt32(row_size * height); + dw->WriteInt32(2835); + dw->WriteInt32(2835); + dw->WriteInt32(0); + dw->WriteInt32(0); +} + +void MainPage::ReleasePages(int old_page, int new_page) +{ + if (old_page == new_page) return; + /* To keep from having memory issue reset the page back to + the thumb if we are done rendering the thumbnails */ + for (int k = old_page - LOOK_AHEAD; k <= old_page + LOOK_AHEAD; k++) + { + if (k < new_page - LOOK_AHEAD || k > new_page + LOOK_AHEAD) + { + if (k >= 0 && k < this->m_num_pages) + { + SetThumb(k); + } + } + } +} + +/* Return this page from a full res image to the thumb image or only set + to thumb if it has not already been set */ +void MainPage::SetThumb(unsigned int page_num) +{ + /* See what is there now */ + auto doc = this->m_docPages->GetAt(page_num); + if (doc->Content == THUMBNAIL && doc->PageZoom == m_doczoom) return; + + if (this->m_thumbnails->Size > page_num) + { + m_page_update = true; + auto thumb_page = this->m_thumbnails->GetAt(page_num); + thumb_page->Height = (int)(thumb_page->NativeHeight * m_doczoom); + thumb_page->Width = (int)(thumb_page->NativeWidth * m_doczoom); + thumb_page->PageZoom = 1.0; + this->m_docPages->SetAt(page_num, thumb_page); + m_page_update = false; + } +} + +/* Initializes the flipview items with the thumb pages as they become + available */ +void MainPage::SetThumbInit(unsigned int page_num) +{ + /* See what is there now */ + auto doc = this->m_docPages->GetAt(page_num); + if (doc->Content == THUMBNAIL || doc->Content == FULL_RESOLUTION) return; + + if (this->m_thumbnails->Size > page_num) + { + doc->Content = THUMBNAIL; + auto thumb_page = this->m_thumbnails->GetAt(page_num); + thumb_page->Height = (int)(thumb_page->NativeHeight); + thumb_page->Width = (int)(thumb_page->NativeWidth); + doc->Image = thumb_page->Image; + doc->Height = thumb_page->Height; + doc->Width = thumb_page->Width; + doc->PageZoom = 1.0; + } +} + +/* Create white image for us to use as place holder in large document for flip + view filling instead of the thumbnail image */ +void MainPage::CreateBlank(int width, int height) +{ + Array<unsigned char>^ bmp_data = ref new Array<unsigned char>(height * 4 * width); + if (bmp_data == nullptr) + { +#ifdef _DEBUG + NotifyUser("CreateBlank failed", ErrorMessage); +#endif + return; + } + /* Set up the memory stream */ + WriteableBitmap ^bmp = ref new WriteableBitmap(width, height); + InMemoryRandomAccessStream ^ras = ref new InMemoryRandomAccessStream(); + if (bmp == nullptr || ras == nullptr) + { +#ifdef _DEBUG + NotifyUser("CreateBlank failed", ErrorMessage); +#endif + return; + } + DataWriter ^dw = ref new DataWriter(ras->GetOutputStreamAt(0)); + if (dw == nullptr) + { +#ifdef _DEBUG + NotifyUser("CreateBlank failed", ErrorMessage); +#endif + return; + } /* Go ahead and write our header data into the memory stream */ + Prepare_bmp(width, height, dw); + + /* Set the data to all white */ + memset(bmp_data->Data, 255, height * 4 * width); + + /* Write the data */ + dw->WriteBytes(bmp_data); + + DataWriterStoreOperation^ result = dw->StoreAsync(); + /* Block on the Async call */ + while(result->Status != Windows::Foundation::AsyncStatus::Completed) { + } + /* And store in a the image brush */ + bmp->SetSource(ras); + m_BlankBmp = bmp; +} + +void MainPage::SetFlipView() +{ + int height = (int) (this->ActualHeight); + int width = (int) (this->ActualWidth); + + CreateBlank(BLANK_WIDTH, BLANK_HEIGHT); + /* Set the current flip view mode */ + if (height > width) + this->m_curr_flipView = xaml_vert_flipView; + else + this->m_curr_flipView = xaml_horiz_flipView; +} + +/* Clean up everything as we are opening a new document after having another + one open */ +void MainPage::CleanUp() +{ + m_init_done = false; + /* Remove current pages in the flipviews */ + if (m_docPages != nullptr && m_docPages->Size > 0) + m_docPages->Clear(); + if (m_thumbnails != nullptr && m_thumbnails->Size > 0) + m_thumbnails->Clear(); + /* With the ref counting this should not leak */ + if (m_page_link_list != nullptr && m_page_link_list->Size > 0) + m_page_link_list->Clear(); + if (m_text_list->Size > 0) + m_text_list->Clear(); + m_ppage_num_list.clear(); + + if (m_linkset != nullptr && m_linkset->Size > 0) + m_linkset->Clear(); + + if (this->mu_doc != nullptr) + mu_doc->CleanUp(); + + mu_doc = ref new mudocument(); + if (mu_doc == nullptr) + throw ref new FailureException("Document allocation failed!"); + + this->m_curr_flipView = nullptr; + m_currpage = -1; + m_file_open = false; + m_slider_min = 0; + m_slider_max = 0; + m_memory_use = 0; + m_insearch = false; + m_search_active = false; + m_sliderchange = false; + m_flip_from_searchlink = false; + m_num_pages = -1; + m_search_rect_count = 0; + m_ren_status = REN_AVAILABLE; + m_links_on = false; + m_rectlist_page = -1; + m_Progress = 0.0; + m_doczoom = 1.0; + m_print_active = PRINT_INACTIVE; + m_curr_print_count = 1; + + this->xaml_PageSlider->Minimum = m_slider_min; + this->xaml_PageSlider->Maximum = m_slider_max; + this->xaml_PageSlider->IsEnabled = false; +} + +/* Create the thumbnail images */ +void MainPage::RenderThumbs() +{ + spatial_info_t spatial_info = this->InitSpatial(1); + int num_pages = this->m_num_pages; + cancellation_token_source cts; + auto token = cts.get_token(); + m_ThumbCancel = cts; + auto ui = task_continuation_context::use_current(); + + this->m_ren_status = REN_THUMBS; + auto task_thumb = create_task([spatial_info, num_pages, this, ui, token]()-> int + { + spatial_info_t spatial_info_local = spatial_info; + Point ras_size; + Array<unsigned char>^ bmp_data; + int code; + float scale_factor; + + /* The renderings run on a background thread */ + assert(IsBackgroundThread()); + spatial_info_local.scale_factor = SCALE_THUMB; + + for (int k = 0; k < num_pages; k++) + { + if (ComputePageSize(spatial_info_local, k, &ras_size, &scale_factor) == S_ISOK) + { + code = mu_doc->RenderPageBitmapSync(k, (int)ras_size.X, + (int)ras_size.Y, scale_factor, false, true, false, { 0, 0 }, + { ras_size.X, ras_size.Y }, &bmp_data); + + DocumentPage^ doc_page = ref new DocumentPage(); + doc_page->Height = (int)(ras_size.Y / SCALE_THUMB); + doc_page->Width = (int)(ras_size.X / SCALE_THUMB); + doc_page->NativeHeight = (int)(ras_size.Y / SCALE_THUMB); + doc_page->NativeWidth = (int)(ras_size.X / SCALE_THUMB); + doc_page->TextBox = nullptr; + doc_page->LinkBox = nullptr; + doc_page->Content = THUMBNAIL; + + InMemoryRandomAccessStream ^ras = ref new InMemoryRandomAccessStream(); + DataWriter ^dw = ref new DataWriter(ras->GetOutputStreamAt(0)); + Prepare_bmp((int)ras_size.X, (int)ras_size.Y, dw); + dw->WriteBytes(bmp_data); + auto t = create_task(dw->StoreAsync()); + t.wait(); + + /* The update with the WriteableBitmap has to take place in the + UI thread. The fact that you cannot create a WriteableBitmap + object execept in the UI thread is a poor design in WinRT. + We will do the callback but with a low priority */ + this->Dispatcher->RunAsync(CoreDispatcherPriority::Low, + ref new DispatchedHandler([this, ras_size, k, ras, doc_page]() + { + assert(IsMainThread()); + WriteableBitmap ^bmp = ref new WriteableBitmap((int)ras_size.X, (int)ras_size.Y); + bmp->SetSource(ras); + doc_page->Image = bmp; + m_thumbnails->SetAt(k, doc_page); + SetThumbInit((unsigned int) k); + })); + } + } + return num_pages; /* all done with thumbnails! */ + }, token).then([this](task<int> the_task) + { + /* Finish adding them, but not if we were cancelled. */ + this->m_ren_status = REN_AVAILABLE; + bool is_cancelled = false; + try + { + the_task.get(); + } + catch (const task_canceled& e) + { + (void)e; // Unused parameter + is_cancelled = true; + } + }, task_continuation_context::use_current()); +} + +void MainPage::OpenDocumentPrep(StorageFile^ file) +{ + if (this->m_num_pages != -1) + { + m_init_done = false; + + /* Set the index to the start of the document */ + this->xaml_vert_flipView->SelectedIndex = 0; + this->xaml_horiz_flipView->SelectedIndex = 0; + + /* If the thumbnail thread is running then we need to end that first */ + RenderingStatus_t *ren_status = &m_ren_status; + cancellation_token_source *ThumbCancel = &m_ThumbCancel; + + /* Create a task to wait until the renderer is available, then clean up then open */ + auto t = create_task([ren_status, ThumbCancel]()->int + { + if (*ren_status == REN_THUMBS) + ThumbCancel->cancel(); + while (*ren_status != REN_AVAILABLE) { + } + return 0; + }).then([this](task<int> the_task) + { + CleanUp(); + return 0; + }, task_continuation_context::use_current()).then([this, file](task<int> the_task) + { + OpenDocument(file); + }, task_continuation_context::use_current()); + } + else + { + OpenDocument(file); + } +} + +void MainPage::OpenDocument(StorageFile^ file) +{ + this->SetFlipView(); + + /* Open document and when open, push on */ + auto open_task = create_task(mu_doc->OpenFileAsync(file)); + open_task.then([this](int code) -> int + { + assert(IsMainThread()); + if (code != S_ISOK) + { + return code; + } + /* We need to check if password is required */ + if (mu_doc->RequiresPassword()) + { + xaml_PasswordStack->Visibility = Windows::UI::Xaml::Visibility::Visible; + return E_NEEDPASSWORD; + } + else + { + xaml_PasswordStack->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + return S_ISOK; + } + }).then([this](int code)->int + { + assert(IsMainThread()); + if (code == S_ISOK) + InitialRender(); + return code; + }, task_continuation_context::use_current()).then([this](int code) + { + if (code == S_ISOK) + RenderThumbs(); + else + { + if (code != E_NEEDPASSWORD) + { + NotifyUser("Sorry, an issue was encountered in opening file", + StatusMessage); + } + } + }, task_continuation_context::use_current()); +} + +void MainPage::InitialRender() +{ + assert(IsMainThread()); + m_num_pages = mu_doc->GetNumPages(); + + if ((m_currpage) >= m_num_pages) + { + m_currpage = m_num_pages - 1; + } + else if (m_currpage < 0) + { + m_currpage = 0; + } + /* Initialize all the flipvew items with blanks and the thumbnails. */ + for (int k = 0; k < m_num_pages; k++) + { + /* Blank pages */ + DocumentPage^ doc_page = ref new DocumentPage(); + Vector<RectList^>^ temp_link = ref new Vector<RectList^>(); + if (doc_page == nullptr || temp_link == nullptr) + throw ref new FailureException("Document allocation failed!"); + doc_page->Image = m_BlankBmp; + doc_page->Height = BLANK_HEIGHT; + doc_page->Width = BLANK_WIDTH; + doc_page->NativeHeight = BLANK_HEIGHT; + doc_page->NativeWidth = BLANK_WIDTH; + doc_page->Content = DUMMY; + doc_page->TextBox = nullptr; + doc_page->LinkBox = nullptr; + m_docPages->Append(doc_page); + m_thumbnails->Append(doc_page); + /* Create empty lists for our links and specify that they have + not been computed for these pages */ + m_page_link_list->Append(temp_link); + m_linkset->Append(false); + } + + this->xaml_horiz_flipView->ItemsSource = m_docPages; + this->xaml_vert_flipView->ItemsSource = m_docPages; + + /* Do the first few pages, then start the thumbs */ + spatial_info_t spatial_info = InitSpatial(1); + for (int k = 0; k < LOOK_AHEAD + 2; k++) + { + if (m_num_pages > k ) + { + Point ras_size; + float scale_factor; + + if (ComputePageSize(spatial_info, k, &ras_size, &scale_factor) == S_ISOK) + { + auto render_task = create_task(mu_doc->RenderPageAsync(k, (int)ras_size.X, (int)ras_size.Y, true, scale_factor)); + render_task.then([this, k, ras_size](InMemoryRandomAccessStream^ ras) + { + if (ras != nullptr) + UpdatePage(k, ras, ras_size, FULL_RESOLUTION, 1.0); + }, task_continuation_context::use_current()); + } + } + } + /* Update the slider settings, if more than one page */ + if (m_num_pages > 1) + { + this->xaml_PageSlider->Maximum = m_num_pages; + this->xaml_PageSlider->Minimum = 1; + this->xaml_PageSlider->IsEnabled = true; + } + else + { + this->xaml_PageSlider->Maximum = 0; + this->xaml_PageSlider->Minimum = 0; + this->xaml_PageSlider->IsEnabled = false; + } + /* All done with initial pages */ + this->m_init_done = true; +} + +void MainPage::RenderRange(int curr_page) +{ + /* Render +/- the look ahead from where we are if blank page is present */ + spatial_info_t spatial_info = InitSpatial(m_doczoom); + bool curr_page_rendered = true; + int range = LOOK_AHEAD; + + assert(IsMainThread()); + if (m_flip_from_searchlink) + range = 0; + for (int k = curr_page - LOOK_AHEAD; k <= curr_page + LOOK_AHEAD; k++) + { + if (k >= 0 && k < m_num_pages) + { + /* Check if page is already rendered */ + auto doc = this->m_docPages->GetAt(k); + if (doc->Content != FULL_RESOLUTION || + doc->PageZoom != m_doczoom) + { + Point ras_size; + float scale_factor; + if (ComputePageSize(spatial_info, k, &ras_size, &scale_factor) == S_ISOK) + { + double zoom = m_doczoom; + auto render_task = create_task(mu_doc->RenderPageAsync(k, (int)ras_size.X, (int)ras_size.Y, true, scale_factor)); + render_task.then([this, k, ras_size, zoom, curr_page](InMemoryRandomAccessStream^ ras) + { + if (ras != nullptr) + { + Point new_ras_size = ras_size; + + /* This is so that the scroll update will apply the zoom + keeping us in-sync. And making sure that we can't + exceed our limits with keyboard vs touch. I.e. any + resolution changes must go through the scrollviewer. + It makes the upcoming page appear to come in at its + zoom level of 1.0 but it is smoothly scaled to the + current scale resolution. */ + new_ras_size.X = (float) (new_ras_size.X / zoom); + new_ras_size.Y = (float)(new_ras_size.Y / zoom); + UpdatePage(k, ras, new_ras_size, FULL_RESOLUTION, zoom); + } + }, task_continuation_context::use_current()).then([this, k, curr_page]() + { + if (k == curr_page && this->m_links_on) + AddLinkCanvas(); + if (k == curr_page && this->m_text_list->Size > 0 && + m_flip_from_searchlink) + { + AddTextCanvas(); + m_flip_from_searchlink = false; + } + if (k == curr_page) + { + m_curr_flipView->UpdateLayout(); + UpdateZoom(); + } + }, task_continuation_context::use_current()); + + } + } + else + { + /* We did not need to render the curr_page, so add links below if + needed. Otherwise, we need to wait for the task above to + complete before we add the links. */ + if (k == curr_page) + { + curr_page_rendered = false; + UpdateZoom(); + } + } + } + } + m_currpage = curr_page; + if (this->m_links_on && !curr_page_rendered) + AddLinkCanvas(); + if (this->m_text_list->Size > 0 && !curr_page_rendered && m_flip_from_searchlink) + { + AddTextCanvas(); + m_flip_from_searchlink = false; + } +} + +void MainPage::FlipView_SelectionChanged(Object^ sender, SelectionChangedEventArgs^ e) +{ + if (m_init_done && !m_page_update) + { + int pos = this->m_curr_flipView->SelectedIndex; + + if (pos >= 0) + { + if (xaml_PageSlider->IsEnabled) + { + xaml_PageSlider->Value = pos + 1; + } + if (m_sliderchange) + { + m_sliderchange = false; + return; + } + else + { + /* Make sure to clear any text search */ + auto doc_old = this->m_docPages->GetAt(m_currpage); + doc_old->TextBox = nullptr; + } + /* Get the current page */ + int curr_page = this->m_currpage; + this->m_currpage = pos; + this->RenderRange(pos); + this->ReleasePages(curr_page, pos); + } + } +} + +/* Slider via drag */ +void MainPage::Slider_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e) +{ + Slider_Common(); +} + +/* Slider via keyboard */ +void MainPage::Slider_Key(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) +{ + Slider_Common(); +} + +void MainPage::Slider_Common() +{ + if (IsNotStandardView() || m_currpage == this->xaml_PageSlider->Value - 1) + return; + + int newValue = (int) this->xaml_PageSlider->Value - 1; /* zero based */ + + if (m_init_done && this->xaml_PageSlider->IsEnabled) + { + this->m_curr_flipView->SelectedIndex = (int) (this->xaml_PageSlider->Value - 1); + } + return; +} + +/* Search Related Code */ +void MainPage::Searcher(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + ShowSearchBox(); + UpdateAppBarButtonViewState(); +} + +void MainPage::ShowSearchBox() +{ + /* Update the app bar so that we can do the search */ + StackPanel^ leftPanel = (StackPanel^) this->TopAppBar->FindName("LeftPanel"); + + if (leftPanel != nullptr && m_insearch) + { + m_insearch = false; + FindBox->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + PrevSearch->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + NextSearch->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + } + else if (leftPanel != nullptr && !m_insearch) + { + /* Search is not going to work in the squashed view */ + if (this->ActualWidth < SEARCH_FIT) + { + NotifyUser("Please enlarge application to use search", StatusMessage); + return; + } + m_insearch = true; + FindBox->Visibility = Windows::UI::Xaml::Visibility::Visible; + PrevSearch->Visibility = Windows::UI::Xaml::Visibility::Visible; + NextSearch->Visibility = Windows::UI::Xaml::Visibility::Visible; + } +} + +void MainPage::ClearTextSearch() +{ + /* Clear out any old search result */ + if (m_text_list->Size > 0) + m_text_list->Clear(); +} + +void MainPage::ShowSearchResults(int page_num, unsigned int box_count) +{ + int old_page = this->m_currpage; + int new_page = page_num; + + ClearTextSearch(); + + /* Compute any scalings */ + Point screenSize; + Point pageSize; + Point scale; + + screenSize.Y = (float) (this->ActualHeight); + screenSize.X = (float) (this->ActualWidth); + screenSize.X *= screenScale; + screenSize.Y *= screenScale; + + try + { + pageSize = mu_doc->GetPageSize(m_currpage); + } + catch (Exception ^except) + { +#ifdef _DEBUG + NotifyUser(except->Message, ErrorMessage); +#endif + return; + } + scale = fitPageToScreen(pageSize, screenSize); + auto doc_page = this->m_docPages->GetAt(old_page); + + /* Construct our list of rectangles */ + for (unsigned int k = 0; k < box_count; k++) + { + RectList^ rect_item = ref new RectList(); + if (rect_item == nullptr) + { + break; + } + auto curr_box = mu_doc->GetTextSearch(k); + + rect_item->Color = m_textcolor; + rect_item->Height = (int) (curr_box->LowerRight.Y - curr_box->UpperLeft.Y); + rect_item->Width = (int) (curr_box->LowerRight.X - curr_box->UpperLeft.X); + rect_item->X = (int) (curr_box->UpperLeft.X * scale.X); + rect_item->Y = (int) (curr_box->UpperLeft.Y * scale.Y); + rect_item->Width = (int)((double)rect_item->Width * scale.X); + rect_item->Height = (int)((double)rect_item->Height * scale.Y); + rect_item->Index = k.ToString(); + m_text_list->Append(rect_item); + } + /* Make sure the current page has its text results cleared */ + doc_page->TextBox = nullptr; + + /* Go ahead and set our doc item to this in the vertical and horizontal view */ + m_searchpage = new_page; + m_flip_from_searchlink = true; + + if (old_page == new_page) + { + FlipView_SelectionChanged(nullptr, nullptr); + } + else + { + this->m_curr_flipView->SelectedIndex = new_page; + } + return; +} + +void MainPage::SearchNext(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + if (IsNotStandardView()) + return; + + StackPanel^ leftPanel = (StackPanel^) this->TopAppBar->FindName("LeftPanel"); + TextBox^ findBox = (TextBox^) leftPanel->FindName("FindBox"); + String^ textToFind = findBox->Text; + + if (this->m_search_active == false && textToFind != nullptr) + SearchInDirection(1, textToFind); +} + +void MainPage::SearchPrev(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + if (IsNotStandardView()) + return; + + StackPanel^ leftPanel = (StackPanel^) this->TopAppBar->FindName("LeftPanel"); + TextBox^ findBox = (TextBox^) leftPanel->FindName("FindBox"); + String^ textToFind = findBox->Text; + + if (this->m_search_active == false && textToFind != nullptr) + SearchInDirection(-1, textToFind); +} + +void MainPage::CancelSearch(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + m_searchcts.cancel(); + xaml_ProgressStack->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + this->m_search_active = false; +} + +void MainPage::AddTextCanvas() +{ + /* Go ahead and set our doc item to this in the vertical and horizontal view */ + auto doc_page = this->m_docPages->GetAt(m_currpage); + assert(doc_page->Content == FULL_RESOLUTION); + if (doc_page->Content == FULL_RESOLUTION) // We should not be doing links for thumbnails + { + doc_page->TextBox = m_text_list; + } + this->m_search_active = false; +} + +void MainPage::SearchProgress(IAsyncOperationWithProgress<int, double>^ operation, double status) +{ + xaml_Progress->Value = status; +} + +void MainPage::SearchInDirection(int dir, String^ textToFind) +{ + cancellation_token_source cts; + auto token = cts.get_token(); + m_searchcts = cts; + int pos = m_currpage; + int start; + + if (m_searchpage == pos) + start = pos + dir; + else + start = pos; + + if (start < 0) + return; + if (start > this->m_num_pages - 1) + return; + this->m_search_active = true; + + ProgressBar^ my_xaml_Progress = (ProgressBar^) (this->FindName("xaml_Progress")); + xaml_ProgressStack->Visibility = Windows::UI::Xaml::Visibility::Visible; + auto temp = mu_doc->SearchDocumentWithProgressAsync(textToFind, dir, start, + m_num_pages); + temp->Progress = ref new AsyncOperationProgressHandler<int, double>(this, &MainPage::SearchProgress); + + auto search_task = create_task(temp, token); + + /* Do the continuation on the ui thread */ + auto con_task = search_task.then([this, textToFind](int page_num) + { + xaml_ProgressStack->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + if (page_num == TEXT_NOT_FOUND) + { + auto str1 = "\"" + textToFind + "\" Was Not Found In The Search"; + NotifyUser(str1, StatusMessage); + this->m_search_active = false; + } + else + { + int box_count = mu_doc->TextSearchCount(); + + if (box_count > 0) + { + this->ShowSearchResults(page_num, (unsigned int) box_count); + } + } + }, task_continuation_context::use_current()); +} + +/* This is here to handle when we rotate or go into the snapview mode */ +void MainPage::GridSizeChanged() +{ + int height = (int) (this->ActualHeight); + int width = (int) (this->ActualWidth); + FlipView^ old_flip = m_curr_flipView; + + if (TopAppBar1->IsOpen) + { + UpdateAppBarButtonViewState(); + } + + if (height > width) + { + m_curr_flipView = this->xaml_vert_flipView; + this->xaml_zoomCanvas->Height = height; + this->xaml_zoomCanvas->Width = width; + this->m_curr_flipView->Height = height; + this->m_curr_flipView->Width = width; + + xaml_vert_flipView->IsEnabled = true; + xaml_vert_flipView->Opacity = 1; + xaml_horiz_flipView->IsEnabled = false; + xaml_horiz_flipView->Opacity = 0; + } + else + { + m_curr_flipView = this->xaml_horiz_flipView; + this->xaml_zoomCanvas->Height = height; + this->xaml_zoomCanvas->Width = width; + this->m_curr_flipView->Height = height; + this->m_curr_flipView->Width = width; + + xaml_horiz_flipView->IsEnabled = true; + xaml_horiz_flipView->Opacity = 1; + xaml_vert_flipView->IsEnabled = false; + xaml_vert_flipView->Opacity = 0; + } + + if (xaml_WebView->Visibility == Windows::UI::Xaml::Visibility::Visible) + xaml_WebView->Height = xaml_OutsideGrid->ActualHeight; + + UpdateThumbSizes(); + + if (m_num_pages > 0 && old_flip != m_curr_flipView && old_flip != nullptr) + { + /* If links are on or off, we need to invalidate */ + ClearLinks(); + InvalidateLinks(); + + /* And force a rerender */ + for (int k = m_currpage - LOOK_AHEAD; k <= m_currpage + LOOK_AHEAD; k++) + { + if (k >= 0 && k < m_num_pages) + { + DocumentPage ^doc = this->m_docPages->GetAt(k); + doc->Content = OLD_RESOLUTION; + } + } + this->m_curr_flipView->SelectedIndex = this->m_currpage; + FlipView_SelectionChanged(nullptr, nullptr); + } +} + +void MainPage::UpdatePreRenderedPageSizes() +{ + if (m_num_pages > 0) + { + for (int k = m_currpage - LOOK_AHEAD; k <= m_currpage + LOOK_AHEAD; k++) + { + if (k >= 0 && k < m_num_pages && k != m_currpage) + { + DocumentPage ^doc = this->m_docPages->GetAt(k); + doc->Content = OLD_RESOLUTION; + int curr_height = doc->Height; + int curr_width = doc->Width; + + double scale_x = (double)curr_height / (double)(this->xaml_zoomCanvas->Height); + double scale_y = (double)curr_width / (double)(this->xaml_zoomCanvas->Width); + + double min_scale = max(scale_x, scale_y); + doc->Height = (int) (curr_height * m_doczoom / min_scale); + doc->Width = (int) (curr_width * m_doczoom / min_scale); + } + } + } +} + +void MainPage::UpdateThumbSizes() +{ + /* Reset the thumbview scaling values */ + if (m_num_pages > 0) + { + int num_items = m_docPages->Size; + for (int i = 0; i < num_items; i++) + { + DocumentPage ^thumb_page = m_docPages->GetAt(i); + if (thumb_page != nullptr && thumb_page->Image != nullptr + && thumb_page->Content == THUMBNAIL) + { + int curr_height = thumb_page->NativeHeight; + int curr_width = thumb_page->NativeWidth; + + double scale_x = (double)curr_height / (double)(this->xaml_zoomCanvas->Height); + double scale_y = (double)curr_width / (double)(this->xaml_zoomCanvas->Width); + + double min_scale = max(scale_x, scale_y); + thumb_page->Height = (int)(curr_height / min_scale); + thumb_page->Width = (int)(curr_width / min_scale); + } + } + } +}; + +/* Link related code */ +void MainPage::Linker(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + m_links_on = !m_links_on; + + if (!m_init_done || IsNotStandardView()) + return; + if (m_links_on) + AddLinkCanvas(); + else + ClearLinks(); +} + +void MainPage::ClearLinks() +{ + /* Make sure surrounding render pages lose their links */ + for (int k = m_currpage - LOOK_AHEAD; k <= m_currpage + LOOK_AHEAD; k++) + { + if (k >= 0 && k < m_num_pages) + { + auto doc_page = this->m_docPages->GetAt(k); + if (doc_page->Content == FULL_RESOLUTION) + { + doc_page->LinkBox = nullptr; + } + } + } +} + +void MainPage::InvalidateLinks() +{ + for (int k = 0; k < m_num_pages; k++) + m_linkset->SetAt(k, false); +} + +/* Add in the link rects. If we have not already computed them then do that now */ +void MainPage::AddLinkCanvas() +{ + /* See if the link object for this page has already been computed */ + int link_page = m_linkset->GetAt(m_currpage); + auto doc_page = this->m_docPages->GetAt(m_currpage); + + if (!link_page) + { + m_linkset->SetAt(m_currpage, true); + unsigned int num_links = mu_doc->ComputeLinks(m_currpage); + if (num_links == 0) return; + + Point screenSize; + Point pageSize; + Point scale; + + screenSize.Y = (float) (this->ActualHeight); + screenSize.X = (float)(this->ActualWidth); + screenSize.X *= screenScale; + screenSize.Y *= screenScale; + + try + { + pageSize = mu_doc->GetPageSize(m_currpage); + } + catch (Exception ^except) + { +#ifdef _DEBUG + NotifyUser(except->Message, ErrorMessage); +#endif + return; + } + scale = fitPageToScreen(pageSize, screenSize); + + /* Create a new RectList collection */ + auto link_list = ref new Platform::Collections::Vector<RectList^>(); + if (link_list == nullptr) + return; + + /* Now add the rects */ + for (unsigned int k = 0; k < num_links; k++) + { + auto curr_link = mu_doc->GetLink(k); + if (curr_link->Type != NOT_SET) + { + RectList^ rect_item = ref new RectList(); + if (rect_item == nullptr) + break; + rect_item->Color = m_linkcolor; + rect_item->Height = (int) (curr_link->LowerRight.Y - curr_link->UpperLeft.Y); + rect_item->Width = (int) (curr_link->LowerRight.X - curr_link->UpperLeft.X); + rect_item->X = (int) (curr_link->UpperLeft.X * scale.X); + rect_item->Y = (int) (curr_link->UpperLeft.Y * scale.Y); + rect_item->Width = (int)((double)rect_item->Width * scale.X); + rect_item->Height = (int)((double)rect_item->Height * scale.Y); + rect_item->Type = curr_link->Type; + rect_item->Urilink = curr_link->Uri; + rect_item->PageNum = curr_link->PageNum; + rect_item->Index = k.ToString(); + link_list->Append(rect_item); + } + } + /* Now set it in our list of links */ + m_page_link_list->SetAt(m_currpage, link_list); + } + /* Go ahead and set our doc item to this in the vertical and horizontal view */ + if (doc_page->LinkBox == nullptr) + { + if (doc_page->Content == FULL_RESOLUTION) // We should not be doing links for thumbnails + { + doc_page->LinkBox = m_page_link_list->GetAt(m_currpage); + } + } +} + +/* A link was tapped */ +void MainPage::LinkTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e) +{ + Rectangle^ rect = safe_cast<Rectangle^>(e->OriginalSource); + String^ str_index = safe_cast<String^>(rect->Tag); + int index = (int) (_wtof(str_index->Data())); + + if (index >= 0 && index < m_num_pages) + { + auto link_list = m_page_link_list->GetAt(m_currpage); + auto link = link_list->GetAt(index); + + if (link->Type == LINK_GOTO) + { + this->m_curr_flipView->SelectedIndex = link->PageNum; + } + else if (link->Type == LINK_URI) + { + // Set the option to show a warning + auto launchOptions = ref new Windows::System::LauncherOptions(); + launchOptions->TreatAsUntrusted = true; + + // Launch the URI with a warning prompt + concurrency::task<bool> launchUriOperation(Windows::System::Launcher::LaunchUriAsync(link->Urilink, launchOptions)); + launchUriOperation.then([](bool success) + { + if (success) + { + // URI launched + } + else + { + // URI launch failed + } + }); + } + } +} + +/* Bring up the contents */ +void MainPage::ContentDisplay(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + if (this->m_num_pages < 0) + return; + + if (IsNotStandardView() && !this->xaml_ListView->IsEnabled) + return; + + if (this->xaml_ListView->IsEnabled) + { + this->xaml_ListView->Opacity = 0.0; + this->xaml_ListView->IsEnabled = false; + this->m_curr_flipView->Opacity = 1.0; + this->m_curr_flipView->IsEnabled = true; + this->xaml_PageSlider->IsEnabled = true; + } + else + { + if (xaml_ListView->Items->Size == 0) + { + unsigned int size_content = mu_doc->ComputeContents(); + /* Bring up the content now */ + for (unsigned int k = 0; k < size_content; k++) + { + ContentItem^ item = mu_doc->GetContent(k); + this->xaml_ListView->Items->Append(item); + } + if (size_content > 0) + { + this->xaml_ListView->Opacity = 1.0; + this->xaml_ListView->IsEnabled = true; + this->m_curr_flipView->Opacity = 0.0; + this->m_curr_flipView->IsEnabled = false; + this->xaml_PageSlider->IsEnabled = false; + } + } + else + { + this->xaml_ListView->Opacity = 1.0; + this->xaml_ListView->IsEnabled = true; + this->m_curr_flipView->Opacity = 0.0; + this->m_curr_flipView->IsEnabled = false; + this->xaml_PageSlider->IsEnabled = false; + } + } +} + +void MainPage::ContentSelected(Platform::Object^ sender, Windows::UI::Xaml::Controls::ItemClickEventArgs^ e) +{ + ContentItem^ b = safe_cast<ContentItem^>(e->ClickedItem); + int newpage = b->Page; + + if (newpage > -1 && newpage < this->m_num_pages) + { + this->xaml_ListView->Opacity = 0.0; + this->xaml_ListView->IsEnabled = false; + this->m_curr_flipView->Opacity = 1.0; + this->m_curr_flipView->IsEnabled = true; + this->xaml_PageSlider->IsEnabled = true; + + int old_page = this->m_currpage; + this->m_curr_flipView->SelectedIndex = newpage; + this->m_currpage = newpage; + } +} + +void MainPage::Reflower(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + if (this->m_num_pages < 0) return; + + if (xaml_WebView->Visibility == Windows::UI::Xaml::Visibility::Visible) + { + /* Go back to flip view */ + xaml_WebView->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + this->xaml_MainGrid->Opacity = 1.0; + this->m_curr_flipView->IsEnabled = true; + this->xaml_PageSlider->IsEnabled = true; + } + else if (this->m_curr_flipView->IsEnabled) + { + String^ html_string = mu_doc->ComputeHTML(this->m_currpage); + xaml_WebView->Visibility = Windows::UI::Xaml::Visibility::Visible; + this->xaml_MainGrid->Opacity = 0.0; + this->m_curr_flipView->IsEnabled = false; + this->xaml_PageSlider->IsEnabled = false; + this->xaml_WebView->NavigateToString(html_string); + this->xaml_WebView->Height = this->ActualHeight; + } +} + +/* Need to handle resizing of app bar to make sure everything fits */ +void MainPage::topAppBar_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + /* Remove search box in snapped view as we don't have the room for it */ + int temp = (int) (this->ActualWidth); + if (this->ActualWidth < SEARCH_FIT && m_insearch) + ShowSearchBox(); + UpdateAppBarButtonViewState(); + /* This is needed to make sure we get the proper state during start-up. The + object has to be visible to set the state. So that is the way we start */ + if (!m_insearch && FindBox->Visibility == Windows::UI::Xaml::Visibility::Visible) + { + FindBox->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + PrevSearch->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + NextSearch->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + } +} + +String^ MainPage::GetVisualState() +{ + String^ visualstate = "FullScreenLandscape"; + + int width = (int) (this->ActualWidth); + int height = (int) (this->ActualHeight); + + if (width < VS_SMALL) + { + visualstate = "Snapped"; + } + else if (width < VS_LARGE) + { + if (width < height) + { + visualstate = "FullScreenPortrait"; + } + else + { + visualstate = "Snapped"; + } + } + return visualstate; +} + +void MainPage::UpdateAppBarButtonViewState() +{ + String ^viewState = GetVisualState(); + VisualStateManager::GoToState(Search, viewState, true); + VisualStateManager::GoToState(Contents, viewState, true); + VisualStateManager::GoToState(Links, viewState, true); + VisualStateManager::GoToState(Reflow, viewState, true); + VisualStateManager::GoToState(ZoomIn, viewState, true); + VisualStateManager::GoToState(ZoomOut, viewState, true); + VisualStateManager::GoToState(PrevSearch, viewState, true); + VisualStateManager::GoToState(NextSearch, viewState, true); +} + +/* Scroll viewer scale changes. If first time to this page, then we essentially + have our scroll setting set at 1.0. */ +void MainPage::ScrollChanged(Platform::Object^ sender, + Windows::UI::Xaml::Controls::ScrollViewerViewChangedEventArgs^ e) +{ + ScrollViewer^ scrollviewer = safe_cast<ScrollViewer^> (sender); + auto doc_page = this->m_docPages->GetAt(m_currpage); + double new_scroll_zoom = scrollviewer->ZoomFactor; + + /* Check if we are already at this resolution with this page */ + if (new_scroll_zoom == doc_page->PageZoom) + return; + + if (!e->IsIntermediate) + { + int page = m_currpage; + + m_doczoom = new_scroll_zoom; + if (m_doczoom > ZOOM_MAX) + { + m_doczoom = ZOOM_MAX; + } + if (m_doczoom < ZOOM_MIN) + { + m_doczoom = ZOOM_MIN; + } + /* Render at new resolution. */ + spatial_info_t spatial_info = InitSpatial(m_doczoom); + Point ras_size; + float scale_factor; + if (ComputePageSize(spatial_info, page, &ras_size, &scale_factor) == S_ISOK) + { + doc_page->PageZoom = m_doczoom; + auto render_task = create_task(mu_doc->RenderPageAsync(page, (int)ras_size.X, (int)ras_size.Y, true, scale_factor)); + render_task.then([this, page, ras_size, scrollviewer](InMemoryRandomAccessStream^ ras) + { + if (ras != nullptr) + ReplaceImage(page, ras, ras_size, m_doczoom); + }, task_continuation_context::use_current()); + } + } +} + +/* Needed to find scrollviewer child from template of flipview item */ +Windows::UI::Xaml::FrameworkElement^ FindVisualChildByName(DependencyObject^ obj, String^ name) +{ + FrameworkElement^ ret; + if (obj == nullptr) return nullptr; + + int numChildren = VisualTreeHelper::GetChildrenCount(obj); + + for (int i = 0; i < numChildren; i++) + { + auto objChild = VisualTreeHelper::GetChild(obj, i); + auto child = safe_cast<FrameworkElement^>(objChild); + if (child != nullptr && child->Name == name) + { + return child; + } + ret = FindVisualChildByName(objChild, name); + if (ret != nullptr) + break; + } + return ret; +} + +void MainPage::ZoomInPress(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + if (!m_init_done || IsNotStandardView()) return; + NonTouchZoom(ZOOM_IN); +} + +void MainPage::ZoomOutPress(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + if (!m_init_done || IsNotStandardView()) return; + NonTouchZoom(ZOOM_OUT); +} + +void MainPage::NonTouchZoom(int zoom) +{ + auto doc_page = this->m_docPages->GetAt(m_currpage); + double curr_zoom = doc_page->PageZoom; + + ScrollViewer^ scrollviewer; + FlipViewItem^ item = safe_cast<FlipViewItem^> + (m_curr_flipView->ContainerFromIndex(m_currpage)); + auto item2 = m_curr_flipView->ContainerFromIndex(m_currpage); + + /* We don't know which one so check for both */ + ScrollViewer^ t1 = + safe_cast<ScrollViewer^> (FindVisualChildByName(item2, "xaml_ScrollView_v")); + ScrollViewer^ t2 = + safe_cast<ScrollViewer^> (FindVisualChildByName(item2, "xaml_ScrollView_h")); + + if (t1 != nullptr) + scrollviewer = t1; + else + scrollviewer = t2; + + if (scrollviewer == nullptr) + return; + + if (zoom == ZOOM_IN) + { + curr_zoom = curr_zoom + KEYBOARD_ZOOM_STEP; + if (curr_zoom > ZOOM_MAX) curr_zoom = ZOOM_MAX; + } + else if (zoom == ZOOM_OUT) + { + curr_zoom = curr_zoom - KEYBOARD_ZOOM_STEP; + if (curr_zoom < ZOOM_MIN) curr_zoom = ZOOM_MIN; + } else + return; + + /* It all needs to be driven by the scroll viewer otherwise we + end up out of sync */ + Platform::Object^ obj_zoom = (float)curr_zoom; + Platform::IBox<float>^ box_zoom; + box_zoom = safe_cast<Platform::IBox<float>^>(obj_zoom); + + scrollviewer->ChangeView(nullptr, nullptr, box_zoom, false); +} + +/* Adjust the page scrollviewer to the current zoom level */ +void MainPage::UpdateZoom() +{ + ScrollViewer^ scrollviewer; + FlipViewItem^ item = safe_cast<FlipViewItem^> + (m_curr_flipView->ContainerFromIndex(m_currpage)); + auto item2 = m_curr_flipView->ContainerFromIndex(m_currpage); + + /* We don't know which one so check for both */ + ScrollViewer^ t1 = + safe_cast<ScrollViewer^> (FindVisualChildByName(item2, "xaml_ScrollView_v")); + ScrollViewer^ t2 = + safe_cast<ScrollViewer^> (FindVisualChildByName(item2, "xaml_ScrollView_h")); + + if (t1 != nullptr) + scrollviewer = t1; + else + scrollviewer = t2; + + if (scrollviewer == nullptr) + return; + + float curr_zoom = scrollviewer->ZoomFactor; + Platform::Object^ obj_zoom = (float)m_doczoom; + Platform::IBox<float>^ box_zoom; + box_zoom = safe_cast<Platform::IBox<float>^>(obj_zoom); + scrollviewer->ChangeView(nullptr, nullptr, box_zoom, false); +} + +/* Zoom in and out for keyboard only case. */ +void MainPage::OnKeyDown(KeyRoutedEventArgs^ e) +{ + if (!m_init_done || IsNotStandardView()) return; + + long val = (long) (e->Key); + + if (val == KEY_PLUS) + NonTouchZoom(ZOOM_IN); + else if (val == KEY_MINUS) + NonTouchZoom(ZOOM_OUT); + else + return; +} + +void MainPage::PasswordOK(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + /* If password checks out then go ahead and start rendering */ + if (mu_doc->ApplyPassword(xaml_password->Password)) + { + xaml_password->Password = nullptr; + xaml_PasswordStack->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + InitialRender(); + RenderThumbs(); + } + else + NotifyUser("Incorrect Password", StatusMessage); +} + +/* So that we know if we are in a standard view case and not in reflow, or + * content type */ +bool MainPage::IsNotStandardView() +{ + return (this->xaml_ListView->Opacity == 1.0 || + xaml_WebView->Visibility == Windows::UI::Xaml::Visibility::Visible); +} + +/* The following code is for print support. */ +void MainPage::RegisterForPrinting() +{ + m_print_manager = Windows::Graphics::Printing::PrintManager::GetForCurrentView(); + m_print_manager->PrintTaskRequested += + ref new TypedEventHandler<PrintManager^, PrintTaskRequestedEventArgs^>(this, &MainPage::SetPrintTask); +} + +void MainPage::SetPrintTask(PrintManager^ sender, PrintTaskRequestedEventArgs^ args) +{ + PrintTaskSourceRequestedHandler^ source_handler = + ref new PrintTaskSourceRequestedHandler([this](PrintTaskSourceRequestedArgs^ args)-> void{ + Microsoft::WRL::ComPtr<PrintPages> document_source; + ThrowIfFailed(Microsoft::WRL::MakeAndInitialize<PrintPages>(&document_source, reinterpret_cast<IUnknown*>(this))); + IPrintDocumentSource^ objSource(reinterpret_cast<IPrintDocumentSource^>(document_source.Get())); + args->SetSource(objSource); + }); + + PrintTask^ print_task = + args->Request->CreatePrintTask(L"MuPDF WinRT Print", source_handler); + + /* Call backs so that we know when we are all done with the printing */ + print_task->Progressing += + ref new TypedEventHandler<PrintTask^, PrintTaskProgressingEventArgs^>(this, &MainPage::PrintProgress); + print_task->Completed += + ref new TypedEventHandler<PrintTask^, PrintTaskCompletedEventArgs^>(this, &MainPage::PrintCompleted); + m_print_active = PRINT_ACTIVE; + m_curr_print_count = 0; + + PrintTaskOptionDetails^ printDetailedOptions = + PrintTaskOptionDetails::GetFromPrintTaskOptions(print_task->Options); + + // Some standard printer options + printDetailedOptions->DisplayedOptions->Clear(); + printDetailedOptions->DisplayedOptions->Append(Windows::Graphics::Printing::StandardPrintTaskOptions::MediaSize); + printDetailedOptions->DisplayedOptions->Append(Windows::Graphics::Printing::StandardPrintTaskOptions::Copies); + + // Our custom options + PrintCustomItemListOptionDetails^ resolution = + printDetailedOptions->CreateItemListOption("resolution", "Render Resolution"); + resolution->AddItem("sres96", "96dpi"); + resolution->AddItem("sres150", "150 dpi"); + resolution->AddItem("sres300", "300 dpi"); + resolution->AddItem("sres600", "600 dpi"); + resolution->TrySetValue("sres600"); + m_printresolution = 600; + printDetailedOptions->DisplayedOptions->Append("resolution"); + + PrintCustomItemListOptionDetails^ location = printDetailedOptions->CreateItemListOption("location", "Location"); + location->AddItem("sCenter", "Center"); + location->AddItem("sTopleft", "Top Left"); + // Add the custom option to the option list. + printDetailedOptions->DisplayedOptions->Append("location"); + location->TrySetValue("sCenter"); + m_centerprint = true; + print_task->Options->MediaSize = PrintMediaSize::NorthAmericaLetter; + + PrintCustomItemListOptionDetails^ pageFormat = printDetailedOptions->CreateItemListOption(L"PageRange", L"Page Range"); + pageFormat->AddItem(L"PrintAll", L"Print all"); + pageFormat->AddItem(L"PrintRange", L"Print Range"); + printDetailedOptions->DisplayedOptions->Append(L"PageRange"); + PrintCustomTextOptionDetails^ pageRangeEdit = printDetailedOptions->CreateTextOption(L"PageRangeEdit", L"Range"); + + printDetailedOptions->OptionChanged += + ref new TypedEventHandler<PrintTaskOptionDetails^, PrintTaskOptionChangedEventArgs^>(this, &MainPage::PrintOptionsChanged); +} + +int MainPage::GetPrintPageCount() +{ + if (m_ppage_num_list.size() > 0) + return (int) m_ppage_num_list.size(); + else + return m_num_pages; +} + +void MainPage::PrintOptionsChanged(PrintTaskOptionDetails^ sender, PrintTaskOptionChangedEventArgs^ args) +{ + bool force_reset = false; + + if (args->OptionId == nullptr) + return; + + String^ optionId = safe_cast<String^>(args->OptionId); + + if (optionId == "resolution") + { + IPrintOptionDetails^ resolution = sender->Options->Lookup(optionId); + String^ resolutionValue = safe_cast<String^>(resolution->Value); + + if (resolutionValue == "sres96") + { + m_printresolution = 96; + } + else if (resolutionValue == "sres150") + { + m_printresolution = 150; + } + else if (resolutionValue == "sres300") + { + m_printresolution = 300; + } + else if(resolutionValue == "sres600") + { + m_printresolution = 600; + } + } + + /* Need to update preview with a change of this one */ + if (optionId == "location") + { + IPrintOptionDetails^ scaling = sender->Options->Lookup(optionId); + String^ scaleValue = safe_cast<String^>(scaling->Value); + + if (scaleValue == "sCenter") + { + m_centerprint = true; + } + if (scaleValue == "sTopleft") + { + m_centerprint = false; + } + force_reset = true; + } + + if (optionId == L"PageRange") + { + IPrintOptionDetails^ pagerange = sender->Options->Lookup(optionId); + String^ pageRangeValue = pagerange->Value->ToString(); + + if(pageRangeValue == L"PrintRange") + { + sender->DisplayedOptions->Append(L"PageRangeEdit"); + m_pageRangeEditVisible = true; + } + else + { + RemovePageRangeEdit(sender); + } + RefreshPreview(); + } + + if (optionId == L"PageRangeEdit") + { + IPrintOptionDetails^ pagerange = sender->Options->Lookup(optionId); + + std::wregex rangePattern(L"^\\s*\\d+\\s*(\\-\\s*\\d+\\s*)?(\\,\\s*\\d+\\s*(\\-\\s*\\d+\\s*)?)*$"); + std::wstring pageRangeValue(pagerange->Value->ToString()->Data()); + + if(!std::regex_match(pageRangeValue.begin(), pageRangeValue.end(), rangePattern)) + { + pagerange->ErrorText = L"Invalid Page Range (eg: 1-3, 5)"; + } + else + { + pagerange->ErrorText = L""; + try + { + GetPagesInRange(pagerange->Value->ToString()); + } + catch(PageRangeException* rangeException) + { + pagerange->ErrorText = ref new String(rangeException->get_DisplayMessage().data()); + delete rangeException; + } + force_reset = true; + } + } + if (force_reset) + { + RefreshPreview(); + } +} + +void MainPage::SplitString(String^ string, wchar_t delimiter, std::vector<std::wstring>& words) + { + std::wistringstream iss(string->Data()); + + std::wstring part; + while(std::getline(iss, part, delimiter)) + { + words.push_back(part); + }; +} + +void MainPage::GetPagesInRange(String^ pagerange) +{ + std::vector<std::wstring> vector_range; + SplitString(pagerange, ',', vector_range); + + m_ppage_num_list.clear(); + for(std::vector<std::wstring>::iterator it = vector_range.begin(); it != vector_range.end(); ++ it) + { + int intervalPos = static_cast<int>((*it).find('-')); + if( intervalPos != -1) + { + int start = _wtoi((*it).substr(0, intervalPos).data()); + int end = _wtoi((*it).substr(intervalPos + 1, (*it).length() - intervalPos - 1).data()); + + if ((start < 1) || (end > static_cast<int>(m_num_pages)) || (start >= end)) + { + std::wstring message(L"Invalid page(s) in range "); + + message.append(std::to_wstring(start)); + message.append(L" - "); + message.append(std::to_wstring(end)); + + throw new PageRangeException(message); + } + + for(int intervalPage=start; intervalPage <= end; ++intervalPage) + { + m_ppage_num_list.push_back(intervalPage); + } + } + else + { + int pageNr = _wtoi((*it).data()); + std::wstring message(L"Invalid page "); + + if (pageNr < 1) + { + message.append(std::to_wstring(pageNr)); + throw new PageRangeException(message); + } + if (pageNr > static_cast<int>(m_num_pages)) + { + message.append(std::to_wstring(pageNr)); + throw new PageRangeException(message); + } + m_ppage_num_list.push_back(pageNr); + } + } + std::sort(m_ppage_num_list.begin(), m_ppage_num_list.end(), std::less<int>()); + std::unique(m_ppage_num_list.begin(), m_ppage_num_list.end()); +} + +void MainPage::RemovePageRangeEdit(PrintTaskOptionDetails^ printTaskOptionDetails) +{ + if (m_pageRangeEditVisible) + { + unsigned int index; + if(printTaskOptionDetails->DisplayedOptions->IndexOf(ref new String(L"PageRangeEdit"), &index)) + { + printTaskOptionDetails->DisplayedOptions->RemoveAt(index); + } + m_pageRangeEditVisible = false; + } +} + +void MainPage::CreatePrintControl(_In_ IPrintDocumentPackageTarget* docPackageTarget, + _In_ D2D1_PRINT_CONTROL_PROPERTIES* printControlProperties) +{ + m_d2d_printcontrol = nullptr; + ThrowIfFailed(m_d2d_device->CreatePrintControl(m_wic_factory.Get(), docPackageTarget, + printControlProperties, &m_d2d_printcontrol)); +} + +void MainPage::DrawPreviewSurface(float width, float height, float scale_in, + D2D1_RECT_F contentBox, uint32 page_num, + IPrintPreviewDxgiPackageTarget* previewTarget) +{ + int dpi = 96; + int index_page_num = page_num - 1; + int ren_page_num = index_page_num; + + if (m_ppage_num_list.size() > 0) + ren_page_num = m_ppage_num_list[page_num - 1] - 1; + + /* This goes on in a background thread. Hence is non-blocking for UI */ + assert(IsBackgroundThread()); + + /* Set up all the DirectX stuff */ + CD3D11_TEXTURE2D_DESC textureDesc(DXGI_FORMAT_B8G8R8A8_UNORM, + static_cast<uint32>(ceil(width * dpi / 96)), + static_cast<uint32>(ceil(height * dpi / 96)), + 1, 1, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE); + ComPtr<ID3D11Texture2D> texture; + ThrowIfFailed(m_d3d_device->CreateTexture2D(&textureDesc, nullptr, &texture)); + ComPtr<IDXGISurface> dxgi_surface; + ThrowIfFailed(texture.As<IDXGISurface>(&dxgi_surface)); + + // Create a new D2D device context for rendering the preview surface. D2D + // device contexts are stateful, and hence a unique device context must be + // used on each thread. + ComPtr<ID2D1DeviceContext> d2d_context; + ThrowIfFailed(m_d2d_device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, + &d2d_context)); + // Update DPI for preview surface as well. + d2d_context->SetDpi(96, 96); + + D2D1_BITMAP_PROPERTIES1 bitmap_properties = + D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW, + D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE)); + + // Create surface bitmap on which page content is drawn. + ComPtr<ID2D1Bitmap1> d2d_surfacebitmap; + ThrowIfFailed(d2d_context->CreateBitmapFromDxgiSurface(dxgi_surface.Get(), + &bitmap_properties, &d2d_surfacebitmap)); + d2d_context->SetTarget(d2d_surfacebitmap.Get()); + + /* Figure out all the sizing */ + spatial_info_t spatial_info; + spatial_info.scale_factor = 1.0; + spatial_info.size.X = width; + spatial_info.size.Y = height; + Point ras_size; + float scale_factor; + + if (ComputePageSize(spatial_info, ren_page_num, &ras_size, &scale_factor) != S_ISOK) + return; + + ras_size.X = ceil(ras_size.X); + ras_size.Y = ceil(ras_size.Y); + + Array<unsigned char>^ bmp_data; + int code = mu_doc->RenderPageBitmapSync(ren_page_num, (int) ras_size.X, + (int)ras_size.Y, scale_factor, true, false, false, { 0, 0 }, + { ras_size.X, ras_size.Y }, &bmp_data); + if (bmp_data == nullptr) + return; + D2D1_SIZE_U bit_map_rect; + bit_map_rect.width = (UINT32) (ras_size.X); + bit_map_rect.height = (UINT32) (ras_size.Y); + + D2D1_BITMAP_PROPERTIES1 bitmap_prop = + D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_NONE, + D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE)); + + ID2D1Bitmap1 *bit_map; + ThrowIfFailed(d2d_context->CreateBitmap(bit_map_rect, &(bmp_data[0]), + (UINT32) (ras_size.X * 4), + &bitmap_prop, &bit_map)); + D2D1_SIZE_F size = bit_map->GetSize(); + + /* Handle centering */ + float y_offset = 0; + float x_offset = 0; + if (m_centerprint) + { + y_offset = (float) ((height - size.height) / 2.0); + x_offset = (float) ((width - size.width) / 2.0); + } + + d2d_context->BeginDraw(); + d2d_context->DrawBitmap(bit_map, D2D1::RectF(x_offset, y_offset, + size.width + x_offset, size.height + y_offset)); + ThrowIfFailed(d2d_context->EndDraw()); + ThrowIfFailed(previewTarget->DrawPage(page_num, dxgi_surface.Get(), + (float) dpi, (float) dpi)); +} + +HRESULT MainPage::ClosePrintControl() +{ + return (m_d2d_printcontrol == nullptr) ? S_OK : m_d2d_printcontrol->Close(); +} + +/* To support high resolution printing, we tile renderings at the maxbitmap size + allowed with DirectX for this particular device. e.g the low end surface + will have a smaller maxbitmap size compared to a laptop or desktop. */ +void MainPage::PrintPage(uint32 page_num, D2D1_RECT_F image_area, D2D1_SIZE_F page_area, + float device_dpi, IStream* print_ticket) +{ + int dpi = m_printresolution; + int index_page_num = page_num - 1; + int ren_page_num = index_page_num; + bool tile = false; + Point tile_count; + D2D1_SIZE_U bit_map_rect; + Array<unsigned char>^ bmp_data; + + if (index_page_num == 0) + { + this->Dispatcher->RunAsync(CoreDispatcherPriority::Low, + ref new DispatchedHandler([this]() + { + xaml_PrintStack->Visibility = Windows::UI::Xaml::Visibility::Visible; + })); + } + + /* Windoze seems to hand me a bogus dpi. Need to follow up on this */ + device_dpi = 96; + + if (m_ppage_num_list.size() > 0) + ren_page_num = m_ppage_num_list[page_num - 1] - 1; + + /* This goes on in a background thread. Hence is non-blocking for UI */ + assert(IsBackgroundThread()); + + /* Print command list set up */ + ComPtr<ID2D1DeviceContext> d2d_context; + ThrowIfFailed(m_d2d_device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, + &d2d_context)); + + /* This should let us work in pixel dimensions but after much testing + it clearly has some issues. May investigate this further later. */ + //d2d_context->SetUnitMode(D2D1_UNIT_MODE_PIXELS); + ComPtr<ID2D1CommandList> clist; + ThrowIfFailed(d2d_context->CreateCommandList(&clist)); + d2d_context->SetTarget(clist.Get()); + + /* Width and height here are at 96 dpi */ + float width = image_area.right - image_area.left; + float height = image_area.bottom - image_area.top; + + /* MuPDF native resolution is 72dpi */ + spatial_info_t spatial_info; + spatial_info.scale_factor = 1.0; + spatial_info.size.X = (width / device_dpi) * (m_printresolution); + spatial_info.size.Y = (height /device_dpi) * (m_printresolution); + Point ras_size; + float scale_factor; + + if (ComputePageSize(spatial_info, ren_page_num, &ras_size, &scale_factor) != S_ISOK) + return; + ras_size.X = ceil(ras_size.X); + ras_size.Y = ceil(ras_size.Y); + + /* Determine if we need to do any tiling */ + int tile_size = d2d_context->GetMaximumBitmapSize(); + tile_count.Y = 1; + if (ras_size.X > tile_size) + { + tile = true; + tile_count.X = (float) ceil((float) ras_size.X / (float) tile_size); + bit_map_rect.width = (UINT32) (tile_size); + } + else + { + tile_count.X = 1; + bit_map_rect.width = (UINT32) (ras_size.X); + } + if (ras_size.Y > tile_size) + { + tile = true; + tile_count.Y = (float) ceil((float) ras_size.Y / (float) tile_size); + bit_map_rect.height = (UINT32) (tile_size); + } + else + { + tile_count.Y = 1; + bit_map_rect.height = (UINT32) (ras_size.Y); + } + + /* Adjust for centering in media page */ + float y_offset = 0; + float x_offset = 0; + if (m_centerprint) + { + y_offset = (float)round(((page_area.height - (ras_size.Y) * device_dpi / m_printresolution) / 2.0)); + x_offset = (float)round(((page_area.width - (ras_size.X) * device_dpi / m_printresolution) / 2.0)); + } + + D2D1_BITMAP_PROPERTIES1 bitmap_prop = + D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_NONE, + D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE), + (float) m_printresolution, (float) m_printresolution); + + ID2D1Bitmap1 *bit_map = NULL; + Point top_left, top_left_dip; + Point bottom_right, bottom_right_dip; + + /* Initialize X location */ + top_left.X = 0; + bottom_right.X = (float) bit_map_rect.width; + + d2d_context->BeginDraw(); + /* Useful for debugging */ + //d2d_context->Clear(D2D1::ColorF(D2D1::ColorF::Coral)); + int total_tile = (int) (tile_count.X * tile_count.Y); + + for (int x = 0; x < tile_count.X; x++) + { + /* Reset Y location */ + top_left.Y = 0; + bottom_right.Y = (float) bit_map_rect.height; + + for (int y = 0; y < tile_count.Y; y++) + { + int code = mu_doc->RenderPageBitmapSync(ren_page_num, (int)bit_map_rect.width, + (int)bit_map_rect.height, scale_factor, true, false, tile, top_left, + bottom_right, &bmp_data); + if (bmp_data == nullptr || code != 0) + break; + + ThrowIfFailed(d2d_context->CreateBitmap(bit_map_rect, &(bmp_data[0]), + (UINT32)(bit_map_rect.width * 4), &bitmap_prop, &bit_map)); + + // This is where D2D1_UNIT_MODE_PIXELS fails to work. Essentially, + // DirectX ends up clipping based upon the origin still in DIPS + // instead of actual pixel positions. + top_left_dip.X = (float)((double) top_left.X * (double)device_dpi / (double)m_printresolution + x_offset - 0.5); + top_left_dip.Y = (float)((double)top_left.Y * (double)device_dpi / (double)m_printresolution + y_offset - 0.5); + bottom_right_dip.X = (float)((double)bottom_right.X * (double)device_dpi / (double)m_printresolution + x_offset + 0.5); + bottom_right_dip.Y = (float)((double)bottom_right.Y * (double)device_dpi / (double)m_printresolution + y_offset + 0.5); + d2d_context->DrawBitmap(bit_map, D2D1::RectF(top_left_dip.X, top_left_dip.Y, + bottom_right_dip.X, bottom_right_dip.Y)); + bit_map->Release(); + + /* Increment Y location */ + top_left.Y += (float) bit_map_rect.height; + bottom_right.Y += (float) bit_map_rect.height; + PrintProgressTile(total_tile); + } + /* Increment X location */ + top_left.X += (float) bit_map_rect.width; + bottom_right.X += (float) bit_map_rect.width; + } + ThrowIfFailed(d2d_context->EndDraw()); + ThrowIfFailed(clist->Close()); + ThrowIfFailed(m_d2d_printcontrol->AddPage(clist.Get(), page_area, print_ticket)); +} + +void MainPage::RefreshPreview() +{ + PrintPages *p_struct = (PrintPages*) m_print_struct; + p_struct->ResetPreview(); +} + +/* This reference is needed so that we can reset preview when changes occur on options */ +void MainPage::SetPrintTarget(void *print_struct) +{ + m_print_struct = print_struct; +} + +void MainPage::PrintProgress(PrintTask^ sender, PrintTaskProgressingEventArgs^ args) +{ + assert(IsBackgroundThread()); + this->m_curr_print_count = args->DocumentPageCount; + + /* Update the progress bar if it is still active */ + this->Dispatcher->RunAsync(CoreDispatcherPriority::Low, + ref new DispatchedHandler([this]() + { + if (this->xaml_PrintStack->Visibility != Windows::UI::Xaml::Visibility::Collapsed) + { + xaml_PrintProgress->Value = + 100.0 * (double)m_curr_print_count / (double)GetPrintPageCount(); + } + })); +} + +void MainPage::PrintProgressTile(int total_tiles) +{ + assert(IsBackgroundThread()); + double step_size = 100.0 / ((double)GetPrintPageCount() * (double)total_tiles); + /* Update the progress bar if it is still active. The tiling of each + page can be slow on the surface if the resolution is high, hence + the need for this feedback */ + this->Dispatcher->RunAsync(CoreDispatcherPriority::Low, + ref new DispatchedHandler([this, step_size]() + { + if (this->xaml_PrintStack->Visibility != Windows::UI::Xaml::Visibility::Collapsed) + { + xaml_PrintProgress->Value += step_size; + } + })); +} + +void MainPage::PrintCompleted(PrintTask^ sender, PrintTaskCompletedEventArgs^ args) +{ + assert(IsBackgroundThread()); + m_print_active = PRINT_INACTIVE; + this->Dispatcher->RunAsync(CoreDispatcherPriority::Low, + ref new DispatchedHandler([this]() + { + xaml_PrintStack->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + xaml_PrintProgress->Value = 0; + })); +} + +void mupdf_cpp::MainPage::HideProgress(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + xaml_PrintStack->Visibility = Windows::UI::Xaml::Visibility::Collapsed; +} diff --git a/platform/windows/mupdf_cpp/MainPage.xaml.h b/platform/windows/mupdf_cpp/MainPage.xaml.h new file mode 100644 index 00000000..1cf8dd97 --- /dev/null +++ b/platform/windows/mupdf_cpp/MainPage.xaml.h @@ -0,0 +1,319 @@ +// +// MainPage.xaml.h +// Declaration of the MainPage class. +// + +#pragma once + +#include "MainPage.g.h" +#include "ppl.h" +#include "ppltasks.h" +#include <collection.h> +#include <algorithm> +#include <assert.h> +#include "DocumentPage.h" +#include "status.h" +#include "PrintPage.h" + +using namespace Platform; +using namespace Concurrency; +using namespace Windows::Storage; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Media::Imaging; +using namespace Windows::Storage::Streams; +using namespace Windows::Foundation; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Shapes; +using namespace Windows::Foundation::Collections; +using namespace Platform::Collections; +using namespace Windows::UI::ViewManagement; +using namespace Windows::UI::Popups; +using namespace Windows::UI::Xaml::Navigation; +using namespace Windows::ApplicationModel; +using namespace Windows::UI::Core; +using namespace mupdfwinrt; + +using namespace Windows::Graphics::Display; +using namespace Windows::Graphics::Printing; +using namespace Windows::UI; +using namespace Windows::UI::Text; +using namespace Windows::UI::Xaml::Documents; +using namespace Windows::Graphics::Printing::OptionDetails; +using namespace Windows::UI::Xaml::Printing; + +typedef enum +{ + StatusMessage, + ErrorMessage +} NotifyType_t; + +typedef enum { + REN_AVAILABLE = 0, + REN_THUMBS, + REN_UPDATE_THUMB_CANVAS, + REN_PAGE /* Used to ignore value when source based setting */ +} RenderingStatus_t; + +typedef enum { + PRINT_INACTIVE = 0, + PRINT_ACTIVE, + PRINT_FAILED +} PrintStatus_t; + +typedef struct spatial_info_s +{ + Point size; + double scale_factor; +} spatial_info_t; + +namespace mupdf_cpp +{ + class PageRangeException + { + private: + std::wstring m_message; + public: + PageRangeException(std::wstring &message) + { + m_message = message; + } + ~PageRangeException() + { + } + std::wstring get_DisplayMessage() + { + return m_message; + } + }; + + public value class PrintPageDesc + { + public: + Size margin; + Size pagesize; + Size printpagesize; + Size resolution; + + friend bool operator == (PrintPageDesc pp1, PrintPageDesc pp2) + { + bool equal = (std::abs(pp1.pagesize.Width - pp2.pagesize.Width) < FLT_EPSILON) && + (std::abs(pp1.pagesize.Height - pp2.pagesize.Height) < FLT_EPSILON); + if (equal) + { + equal = (std::abs(pp1.printpagesize.Width - pp2.printpagesize.Width) < FLT_EPSILON) && + (std::abs(pp1.printpagesize.Height - pp2.printpagesize.Height) < FLT_EPSILON); + } + if (equal) + { + equal = (std::abs(pp1.resolution.Width - pp2.resolution.Width) < FLT_EPSILON) && + (std::abs(pp1.resolution.Height - pp2.resolution.Height) < FLT_EPSILON); + } + return equal; + } + friend bool operator != (PrintPageDesc pp1, PrintPageDesc pp2) + { + return !(pp1 == pp2); + } + }; + + public ref class MainPage sealed + { + + inline void ThrowIfFailed(HRESULT hr) + { + if (FAILED(hr)) + { + /* We are in a different thread in this case. */ + this->Dispatcher->RunAsync(CoreDispatcherPriority::Low, + ref new DispatchedHandler([this]() + { + this->m_print_active = PRINT_FAILED; + xaml_PrintStack->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + this->NotifyUser("Print Failed", ErrorMessage); + })); + throw Platform::Exception::CreateException(hr, "Print Failed"); + } + } + + public: + MainPage(); + + property Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ ProtocolEvent + { + Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ get() { return _protocolEventArgs; } + void set(Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ value) { _protocolEventArgs = value; } + } + + property Windows::ApplicationModel::Activation::FileActivatedEventArgs^ FileEvent + { + Windows::ApplicationModel::Activation::FileActivatedEventArgs^ get() { return _fileEventArgs; } + void set(Windows::ApplicationModel::Activation::FileActivatedEventArgs^ value) { _fileEventArgs = value; } + } + void NotifyUser(String^ strMessage, int type); + void FromFile(); /* For association cases when we are already running */ + + protected: + virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override; + virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) override; + property Windows::Graphics::Printing::IPrintDocumentSource^ PrintDocumentSource + { + Windows::Graphics::Printing::IPrintDocumentSource^ get() + { + return m_printdoc_source; + } + } + + private: + Windows::Foundation::EventRegistrationToken _pageLoadedHandlerToken; + Vector<DocumentPage^>^ m_docPages; + Vector<DocumentPage^>^ m_thumbnails; + Vector<IVector<RectList^>^>^ m_page_link_list; + Vector<int>^ m_linkset; + Vector<RectList^>^ m_text_list; + mudocument^ mu_doc; + int m_rectlist_page; + bool m_file_open; + int m_currpage; + int m_searchpage; + int m_num_pages; + int m_slider_min; + int m_slider_max; + bool m_init_done; + bool m_flip_from_searchlink; + bool m_links_on; + int m_search_rect_count; + cancellation_token_source m_searchcts; + bool m_page_update; + long long m_memory_use; + WriteableBitmap ^m_BlankBmp; + String^ m_textcolor; + String^ m_linkcolor; + FlipView^ m_curr_flipView; + RenderingStatus_t m_ren_status; + cancellation_token_source m_ThumbCancel; + bool m_insearch; /* Used for UI display */ + bool m_search_active; /* Used to avoid multiple UI clicks */ + bool m_sliderchange; + double m_Progress; + double m_doczoom; + + /* Print related */ + PrintDocument^ m_printdoc; + IPrintDocumentSource^ m_printdoc_source; + PrintPageDesc m_printpagedesc; + int m_printresolution; + bool m_centerprint; + bool m_pageRangeEditVisible; + std::vector<int> m_ppage_num_list; + int m_curr_print_count; + PrintStatus_t m_print_active; + + /* DirectX Print Control */ + PrintManager ^m_print_manager; + Microsoft::WRL::ComPtr<ID3D11Device> m_d3d_device; + Microsoft::WRL::ComPtr<ID3D11DeviceContext> m_d3d_context; + Microsoft::WRL::ComPtr<ID2D1PrintControl> m_d2d_printcontrol; + Microsoft::WRL::ComPtr<ID2D1Device> m_d2d_device; + Microsoft::WRL::ComPtr<IWICImagingFactory2> m_wic_factory; + Microsoft::WRL::ComPtr<ID2D1Factory1> m_d2d_factory; + D3D_FEATURE_LEVEL m_featureLevel; + void *m_print_struct; + + void ReplaceImage(int page_num, InMemoryRandomAccessStream^ ras, Point ras_size, double zoom); + void Picker(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void Searcher(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void OpenDocumentPrep(StorageFile^ file); + void OpenDocument(StorageFile^ file); + void InitialRender(); + void RenderRange(int curr_page); + void CleanUp(); + void UpdatePage(int page_num, InMemoryRandomAccessStream^ ras, Point ras_size, Page_Content_t content_type, double zoom); + void CreateBlank(int width, int height); + void HandleFileNotFoundException(Platform::COMException^ e); + void NotifyUserFileNotExist(); + void SetFlipView(); + void FlipView_SelectionChanged(Object^ sender, SelectionChangedEventArgs^ e); + void SearchNext(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void SearchPrev(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void CancelSearch(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void SearchInDirection(int dir, String^ textToFind); + void ShowSearchResults(int page_num, unsigned int box_count); + void ClearTextSearch(); + void AddTextCanvas(); + void GridSizeChanged(); + void UpdateThumbSizes(); + void UpdatePreRenderedPageSizes(); + void ShowThumbnail(); + void Canvas_ManipulationCompleted(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationCompletedRoutedEventArgs^ e); + void AddThumbNail(int page_num, FlipView^ flip_view); + spatial_info_t InitSpatial(double scale); + void RenderThumbs(); + void SetThumb(unsigned int page_num); + void ReleasePages(int old_page, int new_page); + void Linker(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void AddLinkCanvas(); + void ClearLinks(); + void InvalidateLinks(); + void ContentDisplay(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void ListView_Single_Tap(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e); + void ContentSelected(Platform::Object^ sender, Windows::UI::Xaml::Controls::ItemClickEventArgs^ e); + void ContentChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e); + void Reflower(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void topAppBar_Loaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void UpdateAppBarButtonViewState(); + void ExitInvokedHandler(Windows::UI::Popups::IUICommand^ command); + void OKInvokedHandler(Windows::UI::Popups::IUICommand^ command); + int ComputePageSize(spatial_info_t spatial_info, int page_num, Point *ren_size, float *scale_factor); + void ScrollChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::ScrollViewerViewChangedEventArgs^ e); + void LinkTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e); + void SearchProgress(IAsyncOperationWithProgress<int, double>^ operation, double status); + void PasswordOK(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void App_Suspending(Object^ sender, SuspendingEventArgs^ e); + void ExceptionHandler(Object^ sender, UnhandledExceptionEventArgs^ e); + void ZoomInPress(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void ZoomOutPress(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void NonTouchZoom(int zoom); + void ShowSearchBox(); + bool IsNotStandardView(); + void Page_Loaded(Object^ sender, RoutedEventArgs^ e); + Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ _protocolEventArgs; + Windows::ApplicationModel::Activation::FileActivatedEventArgs^ _fileEventArgs; + void Slider_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e); + void Slider_Key(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e); + void Slider_Common(); + void FlipView_Started(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationStartedRoutedEventArgs^ e); + void UpdateZoom(); + String^ GetVisualState(); + void SetThumbInit(unsigned int page_num); + + /* Print Related */ + void RegisterForPrinting(); + void PrintOptionsChanged(PrintTaskOptionDetails^ sender, PrintTaskOptionChangedEventArgs^ args); + void RefreshPreview(); + void RemovePageRangeEdit(PrintTaskOptionDetails^ printTaskOptionDetails); + void SplitString(String^ string, wchar_t delimiter, std::vector<std::wstring>& words); + void GetPagesInRange(String^ pageRange); + void SetPrintTask( PrintManager^, PrintTaskRequestedEventArgs^ args); + void SetUpDirectX(); + + internal: + void CreatePrintControl(IPrintDocumentPackageTarget* docPackageTarget, + D2D1_PRINT_CONTROL_PROPERTIES* printControlProperties); + void PrintPage(uint32 page_num, D2D1_RECT_F image_area, D2D1_SIZE_F page_area, + float device_dpi, IStream* print_ticket); + HRESULT ClosePrintControl(); + void DrawPreviewSurface(float width, float height, float scale, + D2D1_RECT_F contentBox, uint32 desiredJobPage, + IPrintPreviewDxgiPackageTarget* previewTarget); + int GetPrintPageCount(); + void SetPrintTarget(void *print_struct); + void PrintProgress(PrintTask^ sender, PrintTaskProgressingEventArgs^ args); + void PrintProgressTile(int total_tiles); + void PrintCompleted(PrintTask^ sender, PrintTaskCompletedEventArgs^ args); +private: + void Testing(Platform::Object^ sender, Windows::UI::Xaml::Input::ManipulationCompletedRoutedEventArgs^ e); + void HideProgress(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); +}; +} diff --git a/platform/windows/mupdf_cpp/Package.StoreAssociation.xml b/platform/windows/mupdf_cpp/Package.StoreAssociation.xml new file mode 100644 index 00000000..099c2431 --- /dev/null +++ b/platform/windows/mupdf_cpp/Package.StoreAssociation.xml @@ -0,0 +1,375 @@ +<?xml version="1.0" encoding="utf-8"?> +<StoreAssociation xmlns="http://schemas.microsoft.com/appx/2010/storeassociation"> + <Publisher>CN=B93265AA-82AD-458A-A08E-7069B8ED88B5</Publisher> + <NamespacePrefix>ArtifexSoftware</NamespacePrefix> + <PublisherDisplayName>Artifex Software</PublisherDisplayName> + <GeneratePackageHash>http://www.w3.org/2001/04/xmlenc#sha256</GeneratePackageHash> + <SupportedLocales> + <Language Code="af" InMinimumRequirementSet="false" /> + <Language Code="af-za" InMinimumRequirementSet="false" /> + <Language Code="am" InMinimumRequirementSet="false" /> + <Language Code="am-et" InMinimumRequirementSet="false" /> + <Language Code="ar" InMinimumRequirementSet="true" /> + <Language Code="ar-ae" InMinimumRequirementSet="true" /> + <Language Code="ar-bh" InMinimumRequirementSet="true" /> + <Language Code="ar-dz" InMinimumRequirementSet="true" /> + <Language Code="ar-eg" InMinimumRequirementSet="true" /> + <Language Code="ar-iq" InMinimumRequirementSet="true" /> + <Language Code="ar-jo" InMinimumRequirementSet="true" /> + <Language Code="ar-kw" InMinimumRequirementSet="true" /> + <Language Code="ar-lb" InMinimumRequirementSet="true" /> + <Language Code="ar-ly" InMinimumRequirementSet="true" /> + <Language Code="ar-ma" InMinimumRequirementSet="true" /> + <Language Code="ar-om" InMinimumRequirementSet="true" /> + <Language Code="ar-qa" InMinimumRequirementSet="true" /> + <Language Code="ar-sa" InMinimumRequirementSet="true" /> + <Language Code="ar-sy" InMinimumRequirementSet="true" /> + <Language Code="ar-tn" InMinimumRequirementSet="true" /> + <Language Code="ar-ye" InMinimumRequirementSet="true" /> + <Language Code="as" InMinimumRequirementSet="false" /> + <Language Code="as-in" InMinimumRequirementSet="false" /> + <Language Code="az-arab" InMinimumRequirementSet="false" /> + <Language Code="az-arab-az" InMinimumRequirementSet="false" /> + <Language Code="az-cyrl" InMinimumRequirementSet="false" /> + <Language Code="az-cyrl-az" InMinimumRequirementSet="false" /> + <Language Code="az-latn" InMinimumRequirementSet="false" /> + <Language Code="az-latn-az" InMinimumRequirementSet="false" /> + <Language Code="be" InMinimumRequirementSet="false" /> + <Language Code="be-by" InMinimumRequirementSet="false" /> + <Language Code="bg" InMinimumRequirementSet="true" /> + <Language Code="bg-bg" InMinimumRequirementSet="true" /> + <Language Code="bn" InMinimumRequirementSet="false" /> + <Language Code="bn-bd" InMinimumRequirementSet="false" /> + <Language Code="bn-in" InMinimumRequirementSet="false" /> + <Language Code="bs" InMinimumRequirementSet="false" /> + <Language Code="bs-cyrl" InMinimumRequirementSet="false" /> + <Language Code="bs-cyrl-ba" InMinimumRequirementSet="false" /> + <Language Code="bs-latn" InMinimumRequirementSet="false" /> + <Language Code="bs-latn-ba" InMinimumRequirementSet="false" /> + <Language Code="ca" InMinimumRequirementSet="false" /> + <Language Code="ca-es" InMinimumRequirementSet="false" /> + <Language Code="ca-es-valencia" InMinimumRequirementSet="false" /> + <Language Code="chr-cher" InMinimumRequirementSet="false" /> + <Language Code="chr-cher-us" InMinimumRequirementSet="false" /> + <Language Code="chr-latn" InMinimumRequirementSet="false" /> + <Language Code="cs" InMinimumRequirementSet="true" /> + <Language Code="cs-cz" InMinimumRequirementSet="true" /> + <Language Code="cy" InMinimumRequirementSet="false" /> + <Language Code="cy-gb" InMinimumRequirementSet="false" /> + <Language Code="da" InMinimumRequirementSet="true" /> + <Language Code="da-dk" InMinimumRequirementSet="true" /> + <Language Code="de" InMinimumRequirementSet="true" /> + <Language Code="de-at" InMinimumRequirementSet="true" /> + <Language Code="de-ch" InMinimumRequirementSet="true" /> + <Language Code="de-de" InMinimumRequirementSet="true" /> + <Language Code="de-li" InMinimumRequirementSet="true" /> + <Language Code="de-lu" InMinimumRequirementSet="true" /> + <Language Code="el" InMinimumRequirementSet="true" /> + <Language Code="el-gr" InMinimumRequirementSet="true" /> + <Language Code="en" InMinimumRequirementSet="true" /> + <Language Code="en-011" InMinimumRequirementSet="true" /> + <Language Code="en-014" InMinimumRequirementSet="true" /> + <Language Code="en-018" InMinimumRequirementSet="true" /> + <Language Code="en-021" InMinimumRequirementSet="true" /> + <Language Code="en-029" InMinimumRequirementSet="true" /> + <Language Code="en-053" InMinimumRequirementSet="true" /> + <Language Code="en-au" InMinimumRequirementSet="true" /> + <Language Code="en-bz" InMinimumRequirementSet="true" /> + <Language Code="en-ca" InMinimumRequirementSet="true" /> + <Language Code="en-gb" InMinimumRequirementSet="true" /> + <Language Code="en-hk" InMinimumRequirementSet="true" /> + <Language Code="en-id" InMinimumRequirementSet="true" /> + <Language Code="en-ie" InMinimumRequirementSet="true" /> + <Language Code="en-in" InMinimumRequirementSet="true" /> + <Language Code="en-jm" InMinimumRequirementSet="true" /> + <Language Code="en-kz" InMinimumRequirementSet="true" /> + <Language Code="en-mt" InMinimumRequirementSet="true" /> + <Language Code="en-my" InMinimumRequirementSet="true" /> + <Language Code="en-nz" InMinimumRequirementSet="true" /> + <Language Code="en-ph" InMinimumRequirementSet="true" /> + <Language Code="en-pk" InMinimumRequirementSet="true" /> + <Language Code="en-sg" InMinimumRequirementSet="true" /> + <Language Code="en-tt" InMinimumRequirementSet="true" /> + <Language Code="en-us" InMinimumRequirementSet="true" /> + <Language Code="en-vn" InMinimumRequirementSet="true" /> + <Language Code="en-za" InMinimumRequirementSet="true" /> + <Language Code="es" InMinimumRequirementSet="true" /> + <Language Code="es-019" InMinimumRequirementSet="true" /> + <Language Code="es-419" InMinimumRequirementSet="true" /> + <Language Code="es-ar" InMinimumRequirementSet="true" /> + <Language Code="es-bo" InMinimumRequirementSet="true" /> + <Language Code="es-cl" InMinimumRequirementSet="true" /> + <Language Code="es-co" InMinimumRequirementSet="true" /> + <Language Code="es-cr" InMinimumRequirementSet="true" /> + <Language Code="es-do" InMinimumRequirementSet="true" /> + <Language Code="es-ec" InMinimumRequirementSet="true" /> + <Language Code="es-es" InMinimumRequirementSet="true" /> + <Language Code="es-gt" InMinimumRequirementSet="true" /> + <Language Code="es-hn" InMinimumRequirementSet="true" /> + <Language Code="es-mx" InMinimumRequirementSet="true" /> + <Language Code="es-ni" InMinimumRequirementSet="true" /> + <Language Code="es-pa" InMinimumRequirementSet="true" /> + <Language Code="es-pe" InMinimumRequirementSet="true" /> + <Language Code="es-pr" InMinimumRequirementSet="true" /> + <Language Code="es-py" InMinimumRequirementSet="true" /> + <Language Code="es-sv" InMinimumRequirementSet="true" /> + <Language Code="es-us" InMinimumRequirementSet="true" /> + <Language Code="es-uy" InMinimumRequirementSet="true" /> + <Language Code="es-ve" InMinimumRequirementSet="true" /> + <Language Code="et" InMinimumRequirementSet="true" /> + <Language Code="et-ee" InMinimumRequirementSet="true" /> + <Language Code="eu" InMinimumRequirementSet="false" /> + <Language Code="eu-es" InMinimumRequirementSet="false" /> + <Language Code="fa" InMinimumRequirementSet="false" /> + <Language Code="fa-ir" InMinimumRequirementSet="false" /> + <Language Code="fi" InMinimumRequirementSet="true" /> + <Language Code="fi-fi" InMinimumRequirementSet="true" /> + <Language Code="fil" InMinimumRequirementSet="false" /> + <Language Code="fil-latn" InMinimumRequirementSet="false" /> + <Language Code="fil-ph" InMinimumRequirementSet="false" /> + <Language Code="fr" InMinimumRequirementSet="true" /> + <Language Code="fr-011" InMinimumRequirementSet="true" /> + <Language Code="fr-015" InMinimumRequirementSet="true" /> + <Language Code="fr-021" InMinimumRequirementSet="true" /> + <Language Code="fr-029" InMinimumRequirementSet="true" /> + <Language Code="fr-155" InMinimumRequirementSet="true" /> + <Language Code="fr-be" InMinimumRequirementSet="true" /> + <Language Code="fr-ca" InMinimumRequirementSet="true" /> + <Language Code="fr-cd" InMinimumRequirementSet="true" /> + <Language Code="fr-ch" InMinimumRequirementSet="true" /> + <Language Code="fr-ci" InMinimumRequirementSet="true" /> + <Language Code="fr-cm" InMinimumRequirementSet="true" /> + <Language Code="fr-fr" InMinimumRequirementSet="true" /> + <Language Code="fr-ht" InMinimumRequirementSet="true" /> + <Language Code="fr-lu" InMinimumRequirementSet="true" /> + <Language Code="fr-ma" InMinimumRequirementSet="true" /> + <Language Code="fr-mc" InMinimumRequirementSet="true" /> + <Language Code="fr-ml" InMinimumRequirementSet="true" /> + <Language Code="fr-re" InMinimumRequirementSet="true" /> + <Language Code="frc-latn" InMinimumRequirementSet="true" /> + <Language Code="frp-latn" InMinimumRequirementSet="true" /> + <Language Code="ga" InMinimumRequirementSet="false" /> + <Language Code="ga-ie" InMinimumRequirementSet="false" /> + <Language Code="gd-gb" InMinimumRequirementSet="false" /> + <Language Code="gd-latn" InMinimumRequirementSet="false" /> + <Language Code="gl" InMinimumRequirementSet="false" /> + <Language Code="gl-es" InMinimumRequirementSet="false" /> + <Language Code="gu" InMinimumRequirementSet="false" /> + <Language Code="gu-in" InMinimumRequirementSet="false" /> + <Language Code="ha-latn" InMinimumRequirementSet="false" /> + <Language Code="ha-latn-ng" InMinimumRequirementSet="false" /> + <Language Code="he" InMinimumRequirementSet="true" /> + <Language Code="he-il" InMinimumRequirementSet="true" /> + <Language Code="hi" InMinimumRequirementSet="true" /> + <Language Code="hi-in" InMinimumRequirementSet="true" /> + <Language Code="hr" InMinimumRequirementSet="true" /> + <Language Code="hr-ba" InMinimumRequirementSet="true" /> + <Language Code="hr-hr" InMinimumRequirementSet="true" /> + <Language Code="hu" InMinimumRequirementSet="true" /> + <Language Code="hu-hu" InMinimumRequirementSet="true" /> + <Language Code="hy" InMinimumRequirementSet="false" /> + <Language Code="hy-am" InMinimumRequirementSet="false" /> + <Language Code="id" InMinimumRequirementSet="true" /> + <Language Code="id-id" InMinimumRequirementSet="true" /> + <Language Code="ig-latn" InMinimumRequirementSet="false" /> + <Language Code="ig-ng" InMinimumRequirementSet="false" /> + <Language Code="is" InMinimumRequirementSet="false" /> + <Language Code="is-is" InMinimumRequirementSet="false" /> + <Language Code="it" InMinimumRequirementSet="true" /> + <Language Code="it-ch" InMinimumRequirementSet="true" /> + <Language Code="it-it" InMinimumRequirementSet="true" /> + <Language Code="iu-cans" InMinimumRequirementSet="false" /> + <Language Code="iu-latn" InMinimumRequirementSet="false" /> + <Language Code="iu-latn-ca" InMinimumRequirementSet="false" /> + <Language Code="ja" InMinimumRequirementSet="true" /> + <Language Code="ja-jp" InMinimumRequirementSet="true" /> + <Language Code="ka" InMinimumRequirementSet="false" /> + <Language Code="ka-ge" InMinimumRequirementSet="false" /> + <Language Code="kk" InMinimumRequirementSet="false" /> + <Language Code="kk-kz" InMinimumRequirementSet="false" /> + <Language Code="km" InMinimumRequirementSet="false" /> + <Language Code="km-kh" InMinimumRequirementSet="false" /> + <Language Code="kn" InMinimumRequirementSet="false" /> + <Language Code="kn-in" InMinimumRequirementSet="false" /> + <Language Code="ko" InMinimumRequirementSet="true" /> + <Language Code="ko-kr" InMinimumRequirementSet="true" /> + <Language Code="kok" InMinimumRequirementSet="false" /> + <Language Code="kok-in" InMinimumRequirementSet="false" /> + <Language Code="ku-arab" InMinimumRequirementSet="false" /> + <Language Code="ku-arab-iq" InMinimumRequirementSet="false" /> + <Language Code="ky-cyrl" InMinimumRequirementSet="false" /> + <Language Code="ky-kg" InMinimumRequirementSet="false" /> + <Language Code="lb" InMinimumRequirementSet="false" /> + <Language Code="lb-lu" InMinimumRequirementSet="false" /> + <Language Code="lt" InMinimumRequirementSet="true" /> + <Language Code="lt-lt" InMinimumRequirementSet="true" /> + <Language Code="lv" InMinimumRequirementSet="true" /> + <Language Code="lv-lv" InMinimumRequirementSet="true" /> + <Language Code="mi" InMinimumRequirementSet="false" /> + <Language Code="mi-latn" InMinimumRequirementSet="false" /> + <Language Code="mi-nz" InMinimumRequirementSet="false" /> + <Language Code="mk" InMinimumRequirementSet="false" /> + <Language Code="mk-mk" InMinimumRequirementSet="false" /> + <Language Code="ml" InMinimumRequirementSet="false" /> + <Language Code="ml-in" InMinimumRequirementSet="false" /> + <Language Code="mn-cyrl" InMinimumRequirementSet="false" /> + <Language Code="mn-mn" InMinimumRequirementSet="false" /> + <Language Code="mn-mong" InMinimumRequirementSet="false" /> + <Language Code="mn-phag" InMinimumRequirementSet="false" /> + <Language Code="mr" InMinimumRequirementSet="false" /> + <Language Code="mr-in" InMinimumRequirementSet="false" /> + <Language Code="ms" InMinimumRequirementSet="false" /> + <Language Code="ms-bn" InMinimumRequirementSet="false" /> + <Language Code="ms-my" InMinimumRequirementSet="false" /> + <Language Code="mt" InMinimumRequirementSet="false" /> + <Language Code="mt-mt" InMinimumRequirementSet="false" /> + <Language Code="nb" InMinimumRequirementSet="true" /> + <Language Code="nb-no" InMinimumRequirementSet="true" /> + <Language Code="ne" InMinimumRequirementSet="false" /> + <Language Code="ne-np" InMinimumRequirementSet="false" /> + <Language Code="nl" InMinimumRequirementSet="true" /> + <Language Code="nl-be" InMinimumRequirementSet="true" /> + <Language Code="nl-nl" InMinimumRequirementSet="true" /> + <Language Code="nn" InMinimumRequirementSet="false" /> + <Language Code="nn-no" InMinimumRequirementSet="false" /> + <Language Code="no" InMinimumRequirementSet="true" /> + <Language Code="no-no" InMinimumRequirementSet="true" /> + <Language Code="nso" InMinimumRequirementSet="false" /> + <Language Code="nso-za" InMinimumRequirementSet="false" /> + <Language Code="or" InMinimumRequirementSet="false" /> + <Language Code="or-in" InMinimumRequirementSet="false" /> + <Language Code="pa" InMinimumRequirementSet="false" /> + <Language Code="pa-arab" InMinimumRequirementSet="false" /> + <Language Code="pa-arab-pk" InMinimumRequirementSet="false" /> + <Language Code="pa-deva" InMinimumRequirementSet="false" /> + <Language Code="pa-in" InMinimumRequirementSet="false" /> + <Language Code="pl" InMinimumRequirementSet="true" /> + <Language Code="pl-pl" InMinimumRequirementSet="true" /> + <Language Code="prs" InMinimumRequirementSet="false" /> + <Language Code="prs-af" InMinimumRequirementSet="false" /> + <Language Code="prs-arab" InMinimumRequirementSet="false" /> + <Language Code="pt" InMinimumRequirementSet="true" /> + <Language Code="pt-br" InMinimumRequirementSet="true" /> + <Language Code="pt-pt" InMinimumRequirementSet="true" /> + <Language Code="quc-latn" InMinimumRequirementSet="false" /> + <Language Code="qut-gt" InMinimumRequirementSet="false" /> + <Language Code="qut-latn" InMinimumRequirementSet="false" /> + <Language Code="quz" InMinimumRequirementSet="false" /> + <Language Code="quz-bo" InMinimumRequirementSet="false" /> + <Language Code="quz-ec" InMinimumRequirementSet="false" /> + <Language Code="quz-pe" InMinimumRequirementSet="false" /> + <Language Code="ro" InMinimumRequirementSet="true" /> + <Language Code="ro-ro" InMinimumRequirementSet="true" /> + <Language Code="ru" InMinimumRequirementSet="true" /> + <Language Code="ru-ru" InMinimumRequirementSet="true" /> + <Language Code="rw" InMinimumRequirementSet="false" /> + <Language Code="rw-rw" InMinimumRequirementSet="false" /> + <Language Code="sd-arab" InMinimumRequirementSet="false" /> + <Language Code="sd-arab-pk" InMinimumRequirementSet="false" /> + <Language Code="sd-deva" InMinimumRequirementSet="false" /> + <Language Code="si" InMinimumRequirementSet="false" /> + <Language Code="si-lk" InMinimumRequirementSet="false" /> + <Language Code="sk" InMinimumRequirementSet="true" /> + <Language Code="sk-sk" InMinimumRequirementSet="true" /> + <Language Code="sl" InMinimumRequirementSet="true" /> + <Language Code="sl-si" InMinimumRequirementSet="true" /> + <Language Code="sq" InMinimumRequirementSet="false" /> + <Language Code="sq-al" InMinimumRequirementSet="false" /> + <Language Code="sr-cyrl" InMinimumRequirementSet="false" /> + <Language Code="sr-cyrl-ba" InMinimumRequirementSet="false" /> + <Language Code="sr-cyrl-cs" InMinimumRequirementSet="false" /> + <Language Code="sr-cyrl-me" InMinimumRequirementSet="false" /> + <Language Code="sr-cyrl-rs" InMinimumRequirementSet="false" /> + <Language Code="sr-latn" InMinimumRequirementSet="true" /> + <Language Code="sr-latn-ba" InMinimumRequirementSet="true" /> + <Language Code="sr-latn-cs" InMinimumRequirementSet="true" /> + <Language Code="sr-latn-me" InMinimumRequirementSet="true" /> + <Language Code="sr-latn-rs" InMinimumRequirementSet="true" /> + <Language Code="sv" InMinimumRequirementSet="true" /> + <Language Code="sv-fi" InMinimumRequirementSet="true" /> + <Language Code="sv-se" InMinimumRequirementSet="true" /> + <Language Code="sw" InMinimumRequirementSet="false" /> + <Language Code="sw-ke" InMinimumRequirementSet="false" /> + <Language Code="ta" InMinimumRequirementSet="false" /> + <Language Code="ta-in" InMinimumRequirementSet="false" /> + <Language Code="te" InMinimumRequirementSet="false" /> + <Language Code="te-in" InMinimumRequirementSet="false" /> + <Language Code="tg-arab" InMinimumRequirementSet="false" /> + <Language Code="tg-cyrl" InMinimumRequirementSet="false" /> + <Language Code="tg-cyrl-tj" InMinimumRequirementSet="false" /> + <Language Code="tg-latn" InMinimumRequirementSet="false" /> + <Language Code="th" InMinimumRequirementSet="true" /> + <Language Code="th-th" InMinimumRequirementSet="true" /> + <Language Code="ti" InMinimumRequirementSet="false" /> + <Language Code="ti-et" InMinimumRequirementSet="false" /> + <Language Code="tk-cyrl" InMinimumRequirementSet="false" /> + <Language Code="tk-cyrl-tr" InMinimumRequirementSet="false" /> + <Language Code="tk-latn" InMinimumRequirementSet="false" /> + <Language Code="tk-latn-tr" InMinimumRequirementSet="false" /> + <Language Code="tk-tm" InMinimumRequirementSet="false" /> + <Language Code="tn" InMinimumRequirementSet="false" /> + <Language Code="tn-bw" InMinimumRequirementSet="false" /> + <Language Code="tn-za" InMinimumRequirementSet="false" /> + <Language Code="tr" InMinimumRequirementSet="true" /> + <Language Code="tr-tr" InMinimumRequirementSet="true" /> + <Language Code="tt-arab" InMinimumRequirementSet="false" /> + <Language Code="tt-cyrl" InMinimumRequirementSet="false" /> + <Language Code="tt-latn" InMinimumRequirementSet="false" /> + <Language Code="tt-ru" InMinimumRequirementSet="false" /> + <Language Code="ug-arab" InMinimumRequirementSet="false" /> + <Language Code="ug-cn" InMinimumRequirementSet="false" /> + <Language Code="ug-cyrl" InMinimumRequirementSet="false" /> + <Language Code="ug-latn" InMinimumRequirementSet="false" /> + <Language Code="uk" InMinimumRequirementSet="true" /> + <Language Code="uk-ua" InMinimumRequirementSet="true" /> + <Language Code="ur" InMinimumRequirementSet="false" /> + <Language Code="ur-pk" InMinimumRequirementSet="false" /> + <Language Code="uz-cyrl" InMinimumRequirementSet="false" /> + <Language Code="uz-latn" InMinimumRequirementSet="false" /> + <Language Code="uz-latn-uz" InMinimumRequirementSet="false" /> + <Language Code="vi" InMinimumRequirementSet="false" /> + <Language Code="vi-vn" InMinimumRequirementSet="false" /> + <Language Code="wo" InMinimumRequirementSet="false" /> + <Language Code="wo-sn" InMinimumRequirementSet="false" /> + <Language Code="xh" InMinimumRequirementSet="false" /> + <Language Code="xh-za" InMinimumRequirementSet="false" /> + <Language Code="yo-latn" InMinimumRequirementSet="false" /> + <Language Code="yo-ng" InMinimumRequirementSet="false" /> + <Language Code="zh-cn" InMinimumRequirementSet="true" /> + <Language Code="zh-hans" InMinimumRequirementSet="true" /> + <Language Code="zh-hans-cn" InMinimumRequirementSet="true" /> + <Language Code="zh-hans-sg" InMinimumRequirementSet="true" /> + <Language Code="zh-hant" InMinimumRequirementSet="true" /> + <Language Code="zh-hant-hk" InMinimumRequirementSet="true" /> + <Language Code="zh-hant-mo" InMinimumRequirementSet="true" /> + <Language Code="zh-hant-tw" InMinimumRequirementSet="true" /> + <Language Code="zh-hk" InMinimumRequirementSet="true" /> + <Language Code="zh-tw" InMinimumRequirementSet="true" /> + <Language Code="zu" InMinimumRequirementSet="false" /> + <Language Code="zu-za" InMinimumRequirementSet="false" /> + </SupportedLocales> + <ProductReservedInfo> + <MainPackageIdentityName>ArtifexSoftware.MuPDF</MainPackageIdentityName> + <ReservedNames> + <ReservedName>MuPDF</ReservedName> + </ReservedNames> + </ProductReservedInfo> + <AccountPackageIdentityNames /> + <PackageInfoList LandingUrl="https://appdev.microsoft.com:443/StorePortals/Developer/Catalog/ReleaseAnchor/52099d67-4c8e-45dc-812e-205317d5804a"> + <PackageInfo> + <OsMinVersion>6.2.1.0</OsMinVersion> + <PackageArchitecture>arm</PackageArchitecture> + <PackageMaxArchitectureVersion>1.0.0.10</PackageMaxArchitectureVersion> + </PackageInfo> + <PackageInfo> + <OsMinVersion>6.2.1.0</OsMinVersion> + <PackageArchitecture>x86</PackageArchitecture> + <PackageMaxArchitectureVersion>1.0.0.10</PackageMaxArchitectureVersion> + </PackageInfo> + <PackageInfo> + <OsMinVersion>6.2.1.0</OsMinVersion> + <PackageArchitecture>x64</PackageArchitecture> + <PackageMaxArchitectureVersion>1.0.0.10</PackageMaxArchitectureVersion> + </PackageInfo> + </PackageInfoList> +</StoreAssociation>
\ No newline at end of file diff --git a/platform/windows/mupdf_cpp/Package.appxmanifest b/platform/windows/mupdf_cpp/Package.appxmanifest new file mode 100644 index 00000000..ce62ba5f --- /dev/null +++ b/platform/windows/mupdf_cpp/Package.appxmanifest @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest"> + <Identity Name="ArtifexSoftware.MuPDF" Publisher="CN=B93265AA-82AD-458A-A08E-7069B8ED88B5" Version="1.2.0.19" /> + <Properties> + <DisplayName>MuPDF</DisplayName> + <PublisherDisplayName>Artifex Software</PublisherDisplayName> + <Logo>Assets\StoreLogo.png</Logo> + </Properties> + <Prerequisites> + <OSMinVersion>6.3</OSMinVersion> + <OSMaxVersionTested>6.3</OSMaxVersionTested> + </Prerequisites> + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="mupdf_cpp.App"> + <Extensions> + <Extension Category="windows.fileTypeAssociation"> + <FileTypeAssociation Name=".pdf"> + <EditFlags OpenIsSafe="true" /> + <SupportedFileTypes> + <FileType>.pdf</FileType> + <FileType>.xps</FileType> + <FileType>.cbz</FileType> + <FileType>.oxps</FileType> + </SupportedFileTypes> + </FileTypeAssociation> + </Extension> + </Extensions> + <m2:VisualElements DisplayName="MuPDF" Description="A lightweight, high quality PDF/XPS/CBZ viewer/print driver for Windows 8.1 devices." BackgroundColor="#464646" ForegroundText="light" Square150x150Logo="Assets\Logo.png" Square30x30Logo="assets/mupdf_smallogo.png"> + <m2:DefaultTile> + <m2:ShowNameOnTiles> + <m2:ShowOn Tile="square150x150Logo" /> + </m2:ShowNameOnTiles> + </m2:DefaultTile> + <m2:SplashScreen Image="Assets\mupdf_splash.png" /> + </m2:VisualElements> + </Application> + </Applications> +</Package>
\ No newline at end of file diff --git a/platform/windows/mupdf_cpp/PrintPage.cpp b/platform/windows/mupdf_cpp/PrintPage.cpp new file mode 100644 index 00000000..83d31791 --- /dev/null +++ b/platform/windows/mupdf_cpp/PrintPage.cpp @@ -0,0 +1,165 @@ +#include "pch.h" +#include "PrintPage.h" + +using namespace Microsoft::WRL; +using namespace Windows::Graphics::Printing; + +#pragma region IDocumentPageSource Methods + +/* This is the interface to the print thread calls */ +IFACEMETHODIMP +PrintPages::GetPreviewPageCollection(IPrintDocumentPackageTarget* doc_target, + IPrintPreviewPageCollection** doc_collection) +{ + HRESULT hr = (doc_target != nullptr) ? S_OK : E_INVALIDARG; + + if (SUCCEEDED(hr)) + { + hr = doc_target->GetPackageTarget(ID_PREVIEWPACKAGETARGET_DXGI, + IID_PPV_ARGS(&m_dxgi_previewtarget)); + } + ComPtr<IPrintPreviewPageCollection> page_collection; + if (SUCCEEDED(hr)) + { + ComPtr<PrintPages> docSource(this); + hr = docSource.As<IPrintPreviewPageCollection>(&page_collection); + } + if (SUCCEEDED(hr)) + hr = page_collection.CopyTo(doc_collection); + + if (SUCCEEDED(hr)) + this->m_renderer->SetPrintTarget((void*) this); + return hr; +} + +IFACEMETHODIMP +PrintPages::MakeDocument(IInspectable* doc_options, IPrintDocumentPackageTarget* doc_target) +{ + if (doc_options == nullptr || doc_target == nullptr) + return E_INVALIDARG; + + PrintTaskOptions^ option = reinterpret_cast<PrintTaskOptions^>(doc_options); + PrintPageDescription page_desc = option->GetPageDescription(1); + + D2D1_PRINT_CONTROL_PROPERTIES print_properties; + + print_properties.rasterDPI = (float)(min(page_desc.DpiX, page_desc.DpiY)); + print_properties.colorSpace = D2D1_COLOR_SPACE_SRGB; + print_properties.fontSubset = D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT; + + HRESULT hr = S_OK; + + try + { + m_renderer->CreatePrintControl(doc_target, &print_properties); + + D2D1_RECT_F imageableRect = D2D1::RectF(page_desc.ImageableRect.X, + page_desc.ImageableRect.Y, + page_desc.ImageableRect.X + page_desc.ImageableRect.Width, + page_desc.ImageableRect.Y + page_desc.ImageableRect.Height); + + D2D1_SIZE_F pageSize = D2D1::SizeF(page_desc.PageSize.Width, page_desc.PageSize.Height); + m_totalpages = m_renderer->GetPrintPageCount(); + + for (uint32 page_num = 1; page_num <= m_totalpages; ++page_num) + m_renderer->PrintPage(page_num, imageableRect, pageSize, (float) page_desc.DpiX, nullptr); + } + catch (Platform::Exception^ e) + { + hr = e->HResult; + } + + HRESULT hrClose = m_renderer->ClosePrintControl(); + if (SUCCEEDED(hr)) + { + hr = hrClose; + } + return hr; +} + +#pragma endregion IDocumentPageSource Methods + +#pragma region IPrintPreviewPageCollection Methods + +IFACEMETHODIMP +PrintPages::Paginate(uint32 current_jobpage, IInspectable* doc_options) +{ + HRESULT hr = (doc_options != nullptr) ? S_OK : E_INVALIDARG; + + if (SUCCEEDED(hr)) + { + PrintTaskOptions^ option = reinterpret_cast<PrintTaskOptions^>(doc_options); + PrintPageDescription page_desc = option->GetPageDescription(current_jobpage); + + hr = m_dxgi_previewtarget->InvalidatePreview(); + m_totalpages = m_renderer->GetPrintPageCount(); + + if (SUCCEEDED(hr)) + hr = m_dxgi_previewtarget->SetJobPageCount(PageCountType::FinalPageCount, m_totalpages); + + if (SUCCEEDED(hr)) + { + m_width = page_desc.PageSize.Width; + m_height = page_desc.PageSize.Height; + m_imageable_rect = D2D1::RectF(page_desc.ImageableRect.X, page_desc.ImageableRect.Y, + page_desc.ImageableRect.X + page_desc.ImageableRect.Width, + page_desc.ImageableRect.Y + page_desc.ImageableRect.Height); + m_paginate_called = true; + } + } + return hr; +} + +float +PrintPages::TransformedPageSize(float desired_width, float desired_height, + Windows::Foundation::Size* preview_size) +{ + float scale = 1.0f; + + if (desired_width > 0 && desired_height > 0) + { + preview_size->Width = desired_width; + preview_size->Height = desired_height; + scale = m_width / desired_width; + } + else + { + preview_size->Width = 0; + preview_size->Height = 0; + } + return scale; +} + +void +PrintPages::ResetPreview() +{ + m_dxgi_previewtarget->InvalidatePreview(); +} + +IFACEMETHODIMP +PrintPages::MakePage(uint32 desired_jobpage, float width, float height) +{ + HRESULT hr = (width > 0 && height > 0) ? S_OK : E_INVALIDARG; + + if (desired_jobpage == JOB_PAGE_APPLICATION_DEFINED && m_paginate_called) + desired_jobpage = 1; + + if (SUCCEEDED(hr) && m_paginate_called) + { + Windows::Foundation::Size preview_size; + float scale = TransformedPageSize(width, height, &preview_size); + + try + { + m_renderer->DrawPreviewSurface(preview_size.Width, preview_size.Height, + scale, m_imageable_rect, desired_jobpage, + m_dxgi_previewtarget.Get()); + } + catch (Platform::Exception^ e) + { + hr = e->HResult; + } + } + return hr; +} +#pragma region IPrintPreviewPageCollection Methods diff --git a/platform/windows/mupdf_cpp/PrintPage.h b/platform/windows/mupdf_cpp/PrintPage.h new file mode 100644 index 00000000..725a5a43 --- /dev/null +++ b/platform/windows/mupdf_cpp/PrintPage.h @@ -0,0 +1,57 @@ +#pragma once +#include <windows.graphics.printing.h> +#include <printpreview.h> +#include <documentsource.h> +#include "MainPage.xaml.h" + +using namespace Microsoft::WRL; +using namespace mupdf_cpp; + +/* This is the interface to the print thread calls */ +class PrintPages : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::WinRtClassicComMix>, + ABI::Windows::Graphics::Printing::IPrintDocumentSource, + IPrintDocumentPageSource, + IPrintPreviewPageCollection> +{ +private: + InspectableClass(L"Windows.Graphics.Printing.IPrintDocumentSource", BaseTrust); + +public: + HRESULT RuntimeClassInitialize(IUnknown* pageRenderer) + { + HRESULT hr = (pageRenderer != nullptr) ? S_OK : E_INVALIDARG; + + if (SUCCEEDED(hr)) + { + m_paginate_called = false; + m_totalpages = 1; + m_height = 0.f; + m_width = 0.f; + m_renderer = reinterpret_cast<MainPage^>(pageRenderer); + } + return hr; + } + IFACEMETHODIMP GetPreviewPageCollection(IPrintDocumentPackageTarget* doc_target, + IPrintPreviewPageCollection** doc_collection); + IFACEMETHODIMP MakeDocument(IInspectable* doc_options, + IPrintDocumentPackageTarget* doc_target); + IFACEMETHODIMP Paginate(uint32 current_jobpage, IInspectable* doc_options); + IFACEMETHODIMP MakePage(uint32 desired_jobpage, float width, float height); + void ResetPreview(); + +private: + float TransformedPageSize(float desired_width, float desired_height, + Windows::Foundation::Size* preview_size); + uint32 m_totalpages; + bool m_paginate_called; + float m_height; + float m_width; + D2D1_RECT_F m_imageable_rect; + MainPage^ m_renderer; + + Microsoft::WRL::ComPtr<IPrintPreviewDxgiPackageTarget> m_dxgi_previewtarget; + + void DrawPreviewSurface(float width, float height, float scale_in, + D2D1_RECT_F contentBox, uint32 page_num, + IPrintPreviewDxgiPackageTarget* previewTarget); +}; diff --git a/platform/windows/mupdf_cpp/RectList.cpp b/platform/windows/mupdf_cpp/RectList.cpp new file mode 100644 index 00000000..b9c1560d --- /dev/null +++ b/platform/windows/mupdf_cpp/RectList.cpp @@ -0,0 +1,9 @@ +#include "pch.h" +#include "RectList.h" + +namespace mupdf_cpp +{ + RectList::RectList(void) + { + } +} diff --git a/platform/windows/mupdf_cpp/RectList.h b/platform/windows/mupdf_cpp/RectList.h new file mode 100644 index 00000000..999fe3d2 --- /dev/null +++ b/platform/windows/mupdf_cpp/RectList.h @@ -0,0 +1,153 @@ +#pragma once + +/* WinRT RectList class for binding a collection of rects to the xaml ui */ +using namespace Windows::UI::Xaml::Media::Imaging; +using namespace Windows::UI::Xaml::Controls; +using namespace Platform; /* For String */ + +namespace mupdf_cpp +{ + [Windows::UI::Xaml::Data::Bindable] // in c++, adding this attribute to ref classes enables data binding for more info search for 'Bindable' on the page http://go.microsoft.com/fwlink/?LinkId=254639 + + public ref class RectList sealed + { + private: + int height; + int width; + int x; + int y; + String^ color; + /* These are used to store the link infomation */ + int type; + int pagenum; + Windows::Foundation::Uri ^uri; + String^ index; // For identify which rectangle was tapped + public: + RectList(void); + + property String^ Index + { + String^ get() + { + return ((String^) index); + } + + void set(String^ value) + { + index = value; + } + } + + property String^ Color + { + String^ get() + { + return (color); + } + + void set(String^ value) + { + color = value; + } + } + + property int Height + { + int get() + { + return ((int) height); + } + + void set(int value) + { + if (value < 0) + { + throw ref new Platform::InvalidArgumentException(); + } + height = value; + } + } + + property int Width + { + int get() + { + return width; + } + + void set(int value) + { + if (value < 0) + { + throw ref new Platform::InvalidArgumentException(); + } + width = value; + } + } + + property int X + { + int get() + { + return x; + } + + void set(int value) + { + x = value; + } + } + + property int Y + { + int get() + { + return y; + } + + void set(int value) + { + y = value; + } + } + + property int Type + { + int get() + { + return type; + } + + void set(int value) + { + type = value; + } + } + + property int PageNum + { + int get() + { + return pagenum; + } + + void set(int value) + { + pagenum = value; + } + } + + property Windows::Foundation::Uri^ Urilink + { + Windows::Foundation::Uri^ get() + { + return uri; + } + + void set(Windows::Foundation::Uri^ value) + { + uri = value; + } + } + }; +} diff --git a/platform/windows/mupdf_cpp/mupdf_cpp.rc b/platform/windows/mupdf_cpp/mupdf_cpp.rc Binary files differnew file mode 100644 index 00000000..0d7c7a75 --- /dev/null +++ b/platform/windows/mupdf_cpp/mupdf_cpp.rc diff --git a/platform/windows/mupdf_cpp/mupdf_cpp.vcxproj b/platform/windows/mupdf_cpp/mupdf_cpp.vcxproj new file mode 100644 index 00000000..eee0eb95 --- /dev/null +++ b/platform/windows/mupdf_cpp/mupdf_cpp.vcxproj @@ -0,0 +1,280 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0204a4e7-f1b8-4268-a67c-a2c674b4742d}</ProjectGuid> + <RootNamespace>mupdf_cpp</RootNamespace> + <DefaultLanguage>en-US</DefaultLanguage> + <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> + <AppContainerApplication>true</AppContainerApplication> + <ApplicationType>Windows Store</ApplicationType> + <ApplicationTypeRevision>8.1</ApplicationTypeRevision> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <PackageCertificateThumbprint>03074CFDB8E2AB0CD384A1FFA139F7959DC8A656</PackageCertificateThumbprint> + <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision> + <PackageCertificateKeyFile>mupdf_cpp_StoreKey.pfx</PackageCertificateKeyFile> + <AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> + <OutDir>$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> + <OutDir>$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <OutDir>$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> + <OutDir>$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <OutDir>$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../../include/;../mupdfwinrt/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <AdditionalDependencies>D3D11.lib;D2d1.lib;kernel32.lib;%(AdditionalDependencies);../$(Platform)/$(Configuration)/libmupdf_winRT.lib;../$(Platform)/$(Configuration)/libthirdparty_winRT.lib;../$(Platform)/$(Configuration)/libmupdf-nov8_winRT.lib;../$(Platform)/$(Configuration)/mupdfwinrt.lib</AdditionalDependencies> + <AdditionalOptions>/APPCONTAINER %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../../include/;../mupdfwinrt/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_UNICODE;NDEBUG;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies>D3D11.lib;D2d1.lib;kernel32.lib;%(AdditionalDependencies);../$(Platform)/$(Configuration)/libmupdf_winRT.lib;../$(Platform)/$(Configuration)/libthirdparty_winRT.lib;../$(Platform)/$(Configuration)/libmupdf-nov8_winRT.lib;../$(Platform)/$(Configuration)/mupdfwinrt.lib</AdditionalDependencies> + <SectionAlignment> + </SectionAlignment> + <AdditionalOptions>/APPCONTAINER %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../../include/;../mupdfwinrt/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <AdditionalDependencies>D3D11.lib;D2d1.lib;kernel32.lib;%(AdditionalDependencies);../$(Platform)/$(Configuration)/libmupdf_winRT.lib;../$(Platform)/$(Configuration)/libthirdparty_winRT.lib;../$(Platform)/$(Configuration)/mupdfwinrt.lib</AdditionalDependencies> + <AdditionalOptions>/APPCONTAINER /SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../../include/;../mupdfwinrt/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_UNICODE;NDEBUG;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies>D3D11.lib;D2d1.lib;kernel32.lib;%(AdditionalDependencies);../$(Platform)/$(Configuration)/libmupdf_winRT.lib;../$(Platform)/$(Configuration)/libthirdparty_winRT.lib;../$(Platform)/$(Configuration)/mupdfwinrt.lib</AdditionalDependencies> + <SectionAlignment> + </SectionAlignment> + <AdditionalOptions>/APPCONTAINER /SAFESEH %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../../include/;../mupdfwinrt/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <AdditionalDependencies>D3D11.lib;D2d1.lib;kernel32.lib;%(AdditionalDependencies);../$(Platform)/$(Configuration)/libmupdf_winRT.lib;../$(Platform)/$(Configuration)/libthirdparty_winRT.lib;../$(Platform)/$(Configuration)/mupdfwinrt.lib</AdditionalDependencies> + <AdditionalOptions>/APPCONTAINER %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453</DisableSpecificWarnings> + <AdditionalIncludeDirectories>../../include/;../mupdfwinrt/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_UNICODE;NDEBUG;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalDependencies>D3D11.lib;D2d1.lib;kernel32.lib;%(AdditionalDependencies);../$(Platform)/$(Configuration)/libmupdf_winRT.lib;../$(Platform)/$(Configuration)/libthirdparty_winRT.lib;../$(Platform)/$(Configuration)/mupdfwinrt.lib</AdditionalDependencies> + <SectionAlignment> + </SectionAlignment> + <AdditionalOptions>/APPCONTAINER %(AdditionalOptions)</AdditionalOptions> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\mupdfwinrt\Links.h" /> + <ClInclude Include="..\mupdfwinrt\status.h" /> + <ClInclude Include="PrintPage.h" /> + <ClInclude Include="DocumentPage.h" /> + <ClInclude Include="pch.h" /> + <ClInclude Include="App.xaml.h"> + <DependentUpon>App.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="MainPage.xaml.h"> + <DependentUpon>MainPage.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="RectList.h" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="Common\StandardStyles.xaml"> + <SubType>Designer</SubType> + </Page> + <Page Include="MainPage.xaml"> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + <None Include="mupdf_cpp_StoreKey.pfx" /> + <None Include="mupdf_cpp_TemporaryKey.pfx" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="App.xaml.cpp"> + <DependentUpon>App.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="PrintPage.cpp" /> + <ClCompile Include="DocumentPage.cpp" /> + <ClCompile Include="MainPage.xaml.cpp"> + <DependentUpon>MainPage.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="pch.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + </ClCompile> + <ClCompile Include="RectList.cpp" /> + </ItemGroup> + <ItemGroup> + <Image Include="Assets\Logo.Scale-100.png" /> + <Image Include="Assets\Logo.Scale-140.png" /> + <Image Include="Assets\Logo.Scale-180.png" /> + <Image Include="Assets\Logo.Scale-80.png"> + <DeploymentContent>true</DeploymentContent> + </Image> + <Image Include="Assets\mupdf_smallogo.png" /> + <Image Include="Assets\mupdf_splash.png" /> + <Image Include="Assets\StoreLogo.scale-100.png"> + <DeploymentContent>true</DeploymentContent> + </Image> + <Image Include="Assets\StoreLogo.scale-140.png"> + <DeploymentContent>true</DeploymentContent> + </Image> + <Image Include="Assets\StoreLogo.scale-180.png"> + <DeploymentContent>true</DeploymentContent> + </Image> + </ItemGroup> + <ItemGroup> + <None Include="Package.StoreAssociation.xml" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\mupdfwinrt\mupdfwinrt.vcxproj"> + <Project>{9e6ab41d-09a7-45a6-a53b-1e4bf3ac5b33}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/platform/windows/mupdf_cpp/mupdf_cpp.vcxproj.filters b/platform/windows/mupdf_cpp/mupdf_cpp.vcxproj.filters new file mode 100644 index 00000000..5d7615b2 --- /dev/null +++ b/platform/windows/mupdf_cpp/mupdf_cpp.vcxproj.filters @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Common"> + <UniqueIdentifier>0204a4e7-f1b8-4268-a67c-a2c674b4742d</UniqueIdentifier> + </Filter> + <Filter Include="Assets"> + <UniqueIdentifier>a297f943-f0d7-4847-867e-a7aa1ef7f484</UniqueIdentifier> + </Filter> + <Page Include="Common\StandardStyles.xaml"> + <Filter>Common</Filter> + </Page> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="App.xaml.cpp" /> + <ClCompile Include="MainPage.xaml.cpp" /> + <ClCompile Include="pch.cpp" /> + <ClCompile Include="DocumentPage.cpp" /> + <ClCompile Include="RectList.cpp" /> + <ClCompile Include="PrintPage.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="pch.h" /> + <ClInclude Include="App.xaml.h" /> + <ClInclude Include="MainPage.xaml.h" /> + <ClInclude Include="DocumentPage.h" /> + <ClInclude Include="RectList.h" /> + <ClInclude Include="..\mupdfwinrt\status.h" /> + <ClInclude Include="PrintPage.h" /> + <ClInclude Include="..\mupdfwinrt\Links.h" /> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest" /> + </ItemGroup> + <ItemGroup> + <None Include="mupdf_cpp_TemporaryKey.pfx" /> + <None Include="Package.StoreAssociation.xml" /> + <None Include="mupdf_cpp_StoreKey.pfx" /> + </ItemGroup> + <ItemGroup> + <Page Include="MainPage.xaml" /> + </ItemGroup> + <ItemGroup> + <Image Include="Assets\mupdf_smallogo.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\Logo.Scale-80.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\Logo.Scale-100.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\Logo.Scale-140.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\Logo.Scale-180.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\mupdf_splash.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\StoreLogo.scale-100.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\StoreLogo.scale-140.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="Assets\StoreLogo.scale-180.png"> + <Filter>Assets</Filter> + </Image> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/platform/windows/mupdf_cpp/pch.cpp b/platform/windows/mupdf_cpp/pch.cpp new file mode 100644 index 00000000..01484ff5 --- /dev/null +++ b/platform/windows/mupdf_cpp/pch.cpp @@ -0,0 +1,6 @@ +// +// pch.cpp +// Include the standard header and generate the precompiled header. +// + +#include "pch.h" diff --git a/platform/windows/mupdf_cpp/pch.h b/platform/windows/mupdf_cpp/pch.h new file mode 100644 index 00000000..b23c6b70 --- /dev/null +++ b/platform/windows/mupdf_cpp/pch.h @@ -0,0 +1,18 @@ +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include <collection.h> +#include "App.xaml.h" +/* DirectX requirements */ +#include <wrl.h> +#include <wrl\client.h> +#include <dxgi.h> +#include <dxgi1_2.h> +#include <D2d1_1.h> +#include <D3D11.h> +#include <PrintPreview.h> +#include <Wincodec.h> |