<wpf:ThemableWindow x:Class="InABox.Wpf.Reports.PreviewWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:wpf="clr-namespace:InABox.Wpf"
        xmlns:reports="clr-namespace:InABox.Wpf.Reports"
        xmlns:editor="clr-namespace:RoslynPad.Editor;assembly=RoslynPad.Editor.Windows"
        xmlns:preview="clr-namespace:FastReport.Preview;assembly=FastReport.WPF"
        xmlns:design="clr-namespace:FastReport.Design;assembly=FastReport.WPF"
        mc:Ignorable="d"
        Title="PreviewWindow" Height="450" Width="800"
        Closing="PreviewWindow_OnClosing">
    <Grid x:Name="MainGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="0"/>
            <RowDefinition Height="0"/>
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="0" Name="PreviewGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="0" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <ToolBar x:Name="Toolbar" Grid.Row="0" Grid.Column="0" ToolBarTray.IsLocked="True" Loaded="ToolBar_Loaded" Background="White"
                 Margin="0" Padding="0">

                <Button x:Name="PrintButton" ToolTip="Print Report" Click="PrintButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>
                <Button x:Name="SavePDFButton" ToolTip="Save as PDF" Click="SaveButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"
                        Tag="{x:Static reports:ReportExportType.PDF}"/>
                <Button x:Name="SaveRTFButton" ToolTip="Save as RTF" Click="SaveButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"
                        Tag="{x:Static reports:ReportExportType.RTF}"/>
                <Button x:Name="SaveExcelButton" ToolTip="Save as Spreadsheet" Click="SaveButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"
                        Tag="{x:Static reports:ReportExportType.Excel}"/>
                <!--<Button x:Name="EmailButton" ToolTip="Email Report" Click="EmailButton_Click" ToolBar.OverflowMode="Never"/>-->
                <Separator x:Name="ExportSeparator" />
                <Button x:Name="FirstButton" ToolTip="First Page" Click="FirstButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>
                <Button x:Name="BackButton" ToolTip="Previous Page" Click="BackButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>
                <Button x:Name="NextButton" ToolTip="Next Page" Click="NextButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>
                <Button x:Name="LastButton" ToolTip="Last Page" Click="LastButton_Click" ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>
                <Separator />
                <Button x:Name="ZoomInButton" ToolTip="Zoom In" Click="ZoomInButton_Click" IsEnabled="true"
                    ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>
                <Button x:Name="ZoomOutButton" ToolTip="Zoom Out" Click="ZoomOutButton_Click" IsEnabled="true"
                    ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>

            </ToolBar>

            <ToolBar Grid.Row="0" Grid.Column="1" ToolBarTray.IsLocked="True" Loaded="ToolBar_Loaded" Margin="0" Background="White"
                 Padding="0">
                <Button x:Name="DesignButton" ToolTip="Design Report" Click="DesignButton_Click" IsEnabled="true"
                    ToolBar.OverflowMode="Never" VerticalAlignment="Top"/>
            </ToolBar>

            <Border BorderBrush="Gray" BorderThickness="0.75" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
                    <preview:WpfPreviewControl x:Name="Preview" ToolbarVisible="False" />
            </Border>

            <Border BorderBrush="Gray" BorderThickness="0.75" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Background="Gray">
                <Label Content="Loading Report..." HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="24"></Label>
            </Border>

        </Grid>

        <design:WpfDesignerControl  Grid.Row="1" x:Name="Designer" />

        <Grid Grid.Row="2">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <ToolBar Grid.Row="0">
                    <Button x:Name="SaveEditorButton" ToolTip="Save" Click="SaveEditorButton_Click" IsEnabled="True">
                        <Image Source="pack://application:,,,/Resources/disk.png" Height="32" Width="32" />
                    </Button>
                </ToolBar>
                <editor:RoslynCodeEditor x:Name="Editor" Grid.Row="1"></editor:RoslynCodeEditor>
            </Grid>
        </Grid>
    </Grid>
    
</wpf:ThemableWindow>