/** @hidden */ /** */
/// <reference path="../../../vendor/i18next.d.ts" />
//@ts-ignore

import { i18n as i18nInstance } from 'i18next';
//@ts-ignore
import { MouseEventHandler } from 'react';
//@ts-ignore
import { CoreUITheme, NotificationManagerProps, ToolbarStatus } from '@grapecity/core-ui';
import { DocumentMoniker, PluginModel, ReportViewerCmd, ReportViewerCommandStatus } from '../api';
import { DocumentViewer } from '../components';
import { MouseMode, PageDecoration, UISize, ViewMode, ZoomSettings, ZoomTarget } from '../components/DocumentViewer';
import * as SearchPanel from '../features/search';
import { CancellationToken } from './CancellationToken';
import { EventFan } from './EventFan';
import { LoadResult } from './SessionState';
import { Toolbar, ToolbarLayout } from './Toolbar';
export declare class ChangedEventArgs {
    readonly state: DocumentViewer.Model;
    constructor(state: DocumentViewer.Model);
}
export declare class DocumentOpenedEventArgs {
    readonly document: PluginModel.IDocument | null;
    constructor(document: PluginModel.IDocument | null);
}
export declare class DocumentViewOpenedEventArgs {
    readonly view: PluginModel.IDocumentView | null;
    constructor(view: PluginModel.IDocumentView | null);
}
type TopBottomPanelToggle = {
    /** Defines top-bottom-panels controls position to toolbar */
    position: 'left' | 'right';
    /** Defines right separator presence */
    includeSeparator?: boolean;
};
export type PageViewOptions = {
    /** Defines horizontal alignment for report page inside view area. horizontalAlignment = 'center' by default */
    horizontalAlignment?: 'left' | 'right' | 'center';
    /** Removes 'gray' background, shadows, paper borders, and other things that make 'paper view' */
    /** @obsolete */
    withoutPaperView?: boolean;
};
type ZoomOptions = {
    /** Defines min zoom factor */
    minZoom?: number;
    /** Defines max zoom factor */
    maxZoom?: number;
    /** Defines zoom factor array to show in Zoom Control Dropdown in Toolbar */
    dropdownZoomFactorValues?: number[];
};
type NotificationSettings = {
    rounded?: boolean;
    position?: NotificationManagerProps['position'];
    errorCategoryLabel?: NotificationManagerProps['errorCategoryLabel'];
    warningCategoryLabel?: NotificationManagerProps['warningCategoryLabel'];
    infoCategoryLabel?: NotificationManagerProps['infoCategoryLabel'];
};
export type ReportViewerOptions = {
    /** Defines where the panels (search, parameters etc) are placed */
    PanelsLocation?: 'sidebar' | 'toolbar';
    /** Allows to override default error behavior */
    ErrorHandler?: PluginModel.ErrorHandler;
    /** Defines initial toolbar state */
    ToolbarLayout?: ToolbarLayout;
    /** Defines UI elements size */
    UISize?: UISize;
    /** Defines top-bottom-panels controls position and separator presence*/
    TopBottomPanelToggle?: TopBottomPanelToggle;
    /** Disables focus highlighting timer for better accessibility */
    DisableFocusTimer?: boolean;
    /** Isolates this Viewer instance. Required if multiple instances are present on the same page */
    InstanceId?: string;
    /** Defines horizontal alignment and view for report page like part of the WebPage or 'paper view' */
    PageViewOptions?: PageViewOptions;
    /** Defines default width of sidebar - number of pixels or valid CSS length */
    SidebarDefaultWidth?: number | string;
    /**
     * Callback which fires each time when toolbar is collapsed or expanded.
     * @param status new status of toolbar
     */
    OnToolbarToggle?: (status: ToolbarStatus) => void;
    /** Defines default zoom options */
    ZoomOptions?: ZoomOptions;
    /** Defines the position of notification appearance and rounding. */
    NotificationSettings?: NotificationSettings;
    /** Custom theme for the Report Viewer. This can be set only once during the creation of the viewer instance. */
    Theme?: CoreUITheme;
    /**
     * Defines whether theme inline styles are needed
     * @default true
     * */
    UseInlineThemeCSS?: boolean;
};
/** The custom document view ctor specification. */
export type CustomDocumentViewFactory = (connectProps: any, // props for component view (dispatch and ref)
handleViewerCmd: (cmd: ReportViewerCmd) => void, handleClick: MouseEventHandler, placeholder: Element) => void;
/** Defines the argument type for the ReportViewer.search method. */
export type SearchOptions = {
    /** Text to search for. */
    text: string;
    /** Case-sensitive search. */
    matchCase?: boolean;
    /** Search backward from the current position. */
    searchBackward?: boolean;
    /** Match whole word. */
    wholeWord?: boolean;
    /** The page to start the search from. */
    startPage?: number;
};
/**
 * The main control implementation.
 * @hidden
 */
export declare class ReportViewer implements PluginModel.IViewerHost {
    private readonly _viewerState;
    readonly instanceId: string;
    private readonly _stateChangeEvent;
    private readonly _documentViewOpenedEvent;
    private readonly _documentOpenedEvent;
    private readonly _documentProgressEvent;
    private readonly _menuPanelChangeEvent;
    private readonly _panelsStore;
    private readonly _progressStore;
    private _toolbar;
    private readonly _hostElement;
    private _errorHandler;
    private readonly _disposables;
    private readonly i18n;
    private readonly _panelsOnSidebar;
    private uiInstance;
    private sendNotification;
    private handleClick;
    private getZoomFactor;
    private setZoomFactor;
    private _isMobile;
    private _appRef;
    constructor(element: any, options?: ReportViewerOptions, customDocumentView?: CustomDocumentViewFactory, xi18n?: i18nInstance);
    /** disposes control and and */
    dispose(): void;
    setPlugin<TEvent extends PluginModel.IViewerEvent>(plugin: PluginModel.IPluginModule<TEvent, any>): void;
    private _panelLastKey;
    private _cancelTaskRequested;
    /** Starts long-running operation and displays progress window while operation is running. */
    executeTask(task: (callbacks: PluginModel.TaskCallbacks) => Promise<void>, settings?: PluginModel.TaskSettings): Promise<void>;
    createPanel<TState>(component: any, binder: PluginModel.IStateBinder<TState>, key: string, { icon, description, visible, enabled, label, location }: Partial<PluginModel.PanelSettings>): PluginModel.PanelHandle;
    /** Updates the panel visibility. */
    showPanel(panelKey: PluginModel.PanelHandle, visible?: boolean): void;
    /** Updates panel settings such as visibility, label or "enabled" status. */
    updatePanel(panelKey: PluginModel.PanelHandle, settings: Partial<PluginModel.PanelSettings>): void;
    /** Gets the current panel state. */
    getPanelState(panelKey: PluginModel.PanelHandle): PluginModel.PanelSettings | null;
    /** Orders and filters panel items. '*' indicates "the rest of panels". 'sep'/'separator' indicated menu separator. */
    layoutPanels(layout: string[]): void;
    /** @deprecated use expandPanel() instead */
    bringPanelToFront(panelKey: PluginModel.PanelHandle): void;
    expandPanel(panelKey: PluginModel.PanelHandle): void;
    collapsePanel(panelKey: PluginModel.PanelHandle): void;
    bindPanel<TState, TMsg>(panelKey: PluginModel.PanelHandle, store: PluginModel.IStore<TState, TMsg>): void;
    closePanelOnNarrowScreen(panel?: PluginModel.PanelHandle): void;
    processCommand: (cmd: ReportViewerCmd) => void;
    reportError(params: PluginModel.IErrorParams): void;
    /** Updates activeTopPanelId for to show/hide panel with setting.location = 'top' (id = null to hide panel)*/
    setActiveTopPanel(id: string | null): void;
    /** Updates activeBottomPanelId for to show/hide panel with setting.location = 'bottom' (id = null to hide panel)*/
    setActiveBottomPanel(id: string | null): void;
    /** Gets the main window's host element */
    get hostElement(): Element;
    /** Gets or sets callback that is invoked when an error occurs in the process of displaying the report */
    get errorHandler(): PluginModel.ErrorHandler;
    set errorHandler(errorHandler: PluginModel.ErrorHandler);
    /** The event indicating document was changed (new document opened, drilled or "back to parent" is issued) */
    get onDocumentOpen(): EventFan<DocumentOpenedEventArgs>;
    /** The event indicating document view was changed (new document opened, refreshed, toggled etc) */
    get onDocumentViewOpen(): EventFan<DocumentViewOpenedEventArgs>;
    /** The event indicating document load progress */
    get onDocumentProgress(): EventFan<PluginModel.ProgressMessage>;
    /** Indicates the viewer state was changed. */
    get onViewerStateChange(): EventFan<ChangedEventArgs>;
    /** Temporary expose event, which occurs on panel change  */
    get tempOnPanelChange(): EventFan<string | null>;
    /** Resets report and cancel current session if any. */
    resetDocument(): Promise<void>;
    /** Loads the report (no UI), so caller has to process load result and report error if any. */
    load(moniker: DocumentMoniker, token?: CancellationToken): Promise<LoadResult>;
    /** Loads the report and reports error to error dialog. */
    open(moniker: DocumentMoniker): Promise<LoadResult>;
    get toolbar(): Toolbar;
    /** Gets currently viewed document state */
    get viewerState(): DocumentViewer.Model;
    /** Gets or sets view mode (single page or continuous). */
    get viewMode(): ViewMode;
    set viewMode(mode: ViewMode);
    get zoom(): ZoomSettings;
    set zoom(zoom: ZoomSettings);
    set theme(newTheme: CoreUITheme | undefined);
    get theme(): CoreUITheme | undefined;
    /**
        Gets/sets target element for zoom transformation.
        If 'page' is set, each page will be transformed individually (default behavior).
        If 'viewport' is set, entire viewport element will be transformed instead.
        This is added to prevent issues in some specific cases, see ARJ-4340.
     * */
    get zoomTarget(): ZoomTarget;
    set zoomTarget(zoomTarget: ZoomTarget);
    get mouseMode(): MouseMode;
    set mouseMode(mode: MouseMode);
    /** Gets or sets viewer background color, default value = 'transparent' */
    get backgroundColor(): string;
    set backgroundColor(color: string);
    setBackgroundColor(backgroundColor?: string): void;
    /** Gets or sets page view decoration mode. */
    get pageDecoration(): PageDecoration;
    set pageDecoration(pageDecoration: PageDecoration);
    get enableSidebarInFullscreen(): boolean;
    set enableSidebarInFullscreen(enableSidebarInFullscreen: boolean);
    processCustomAction: (action: any) => boolean;
    processAction: (action: any) => boolean;
    get commandStatus(): ReportViewerCommandStatus;
    get isFullscreen(): boolean;
    toggleFullscreen(fullscreen?: boolean): void;
    get isToolbarHidden(): boolean;
    toggleToolbar(show?: boolean): void;
    /** Sets of toggles sidebar's panels visibility */
    toggleSidebar: (show?: boolean) => void;
    /** Gets the current document */
    get document(): PluginModel.IDocumentView | null;
    /** Searches currently opened document for the text. */
    search({ text, matchCase, wholeWord, searchBackward, startPage }: SearchOptions, resultFn: (result: SearchPanel.SearchResult) => void, progressFn?: (progress: {
        pageIndex: number;
        pageCount: number | null;
    }) => void, cancel?: CancellationToken): Promise<SearchPanel.SearchStatus>;
    /** Navigates to a page containing the result and highlights found text. */
    highlight(result: SearchPanel.SearchResult): Promise<void>;
}
export {};
