import type { OfficeAnnotationSource } from '../../services/annotations/AnnotationSource'; import type { OfficeAnnotation, OfficeAnnotationSourceSnapshot, OfficeAnnotationTarget } from '../../services/annotations/types'; import type { WordRevisionRecord } from '../../services/word/review/types'; /** 格式查看器完成批注目标定位后返回是否成功。 */ export type OfficeAnnotationNavigator = (annotation: OfficeAnnotation) => boolean | Promise; /** 审阅面板可读取的批注状态。 */ export type OfficeAnnotationControllerState = Readonly<{ /** 当前格式数据源的轻量快照。 */ snapshot: OfficeAnnotationSourceSnapshot; /** 当前活动批注的索引。 */ activeIndex: number; /** 当前活动批注;尚未选择时为空。 */ activeAnnotation?: OfficeAnnotation; /** 当前活动修订;尚未选择时为空。 */ activeRevision?: WordRevisionRecord; /** 可见范围是否正在读取。 */ loading: boolean; /** 最近一次读取或定位失败的说明。 */ error?: string; /** 批注缓存变化标识,供窗口列表重新取值。 */ cacheRevision: number; }>; /** 审阅面板和格式查看器共享的稳定操作集合。 */ export type OfficeAnnotationControllerActions = Readonly<{ /** 注册当前格式的批注数据源。 */ registerSource(source: OfficeAnnotationSource): () => void; /** 注册指定目标类别的精确导航能力。 */ registerNavigator(kind: OfficeAnnotationTarget['kind'], navigator: OfficeAnnotationNavigator): () => void; /** 确保指定批注索引范围已经进入缓存。 */ loadRange(start: number, end: number): Promise; /** 读取缓存中的指定批注。 */ getCached(index: number): OfficeAnnotation | undefined; /** 按稳定标识读取一组批注,但不改变当前活动项。 */ loadAnnotationsByIds(ids: readonly string[]): Promise; /** 选择指定索引并导航到源内容。 */ selectIndex(index: number): Promise; /** 通过稳定标识选择批注。 */ selectId(id: string): Promise; /** 选择上一条批注。 */ previous(): Promise; /** 选择下一条批注。 */ next(): Promise; /** 从正文激活修订,不把当前页面跳回该修订的首个片段。 */ activateRevisionId(id: string): Promise; /** 关闭正文中已经固定显示的修订提示框。 */ clearActiveRevision(): void; }>; /** 组合层与格式渲染器共享的批注控制器。 */ export type OfficeAnnotationController = Readonly<{ /** 当前审阅运行时启用的内容类别。 */ options: Readonly<{ showComments: boolean; showNotes: boolean; }>; state: OfficeAnnotationControllerState; actions: OfficeAnnotationControllerActions; }>; /** 管理批注数据源、窗口缓存、活动项和格式导航。 */ export declare function useOfficeAnnotationController({ enabled, sessionKey, showComments, showNotes, onActivate, }: { /** 当前实例是否启用审阅能力。 */ enabled: boolean; /** 当前解析会话的稳定标识。 */ sessionKey?: string; /** 是否在正文和面板中显示批注。 */ showComments: boolean; /** 是否在审阅摘要中显示脚注、尾注和格式笔记。 */ showNotes: boolean; /** 批注从正文或外部导航激活后请求打开审阅面板。 */ onActivate?(): void; }): OfficeAnnotationController;