# File-processing Control Command Standard (v5.65.0)

This standard is intended for OneEditor / OneViewer and file-processing Control packages such as UnifiedWriter, UnifiedSpread, UnifiedSlide, UnifiedPainter and UnifiedCoder.

## Namespace policy

Host-owned commands use `host.*`.  Package-owned commands use a package prefix.

| Owner | Prefix examples |
|---|---|
| Host | `host.file.*`, `host.help.*`, `host.settings.*` |
| UnifiedWriter | `writer.file.*`, `writer.edit.*`, `writer.view.*`, `writer.insert.*`, `writer.format.*`, `writer.review.*`, `writer.table.*`, `writer.image.*`, `writer.macro.*` |
| UnifiedSpread | `spread.*` |
| UnifiedSlide | `slide.*` |

## Host-owned File / Help command IDs

```text
host.file.new
host.file.open
host.file.close
host.file.save
host.file.saveAs
host.file.export
host.file.print
host.file.properties
host.help.open
host.help.shortcuts
host.help.about
host.help.diagnostics
host.settings.open
```

Host commands represent Host-shell-level operations when an integrated Host chooses to own global File/Help UI. This is a OneEditor / OneViewer style integration profile, not a rule for every Host. In WorkbenchControl or ordinary page embedding, UnifiedWriter may render its own File menu and call its package commands directly. In both cases, storage provider, file picker and save target remain callback/adapter concerns, and OneViewer uses the same package EditorControl in view/read-only mode.

## UnifiedWriter package file command IDs

These commands are owned by UnifiedWriter because they are file-format-specific. They are storage-provider-neutral. WorkbenchControl can invoke them from its own File menu; a OneEditor / OneViewer integration profile can also invoke them from Host File UI after the active file type/package is known.

```text
writer.file.newDocument
writer.file.openPackage
writer.file.savePackage
writer.file.saveAsPackage
writer.file.importContent
writer.file.export
writer.file.printContent
writer.file.properties
```

## UnifiedWriter document command IDs

```text
writer.edit.undo
writer.edit.redo
writer.edit.cut
writer.edit.copy
writer.edit.paste
writer.edit.findReplace
writer.view.printLayout
writer.view.normalLayout
writer.view.outline
writer.insert.link
writer.insert.image
writer.insert.table
writer.insert.comment
writer.insert.footnote
writer.insert.file
writer.format.bold
writer.format.italic
writer.format.underline
writer.format.textColor
writer.format.highlightColor
writer.format.alignLeft
writer.format.alignCenter
writer.format.alignRight
writer.format.justify
writer.format.lineSpacing
writer.format.clear
writer.review.comment.add
writer.review.trackChanges.toggle
writer.review.suggesting.toggle
writer.table.mergeCells
writer.table.splitCell
writer.table.properties
writer.image.options
writer.image.wrap
writer.image.delete
writer.macro.diagnostics
writer.macro.codeViewer
writer.macro.run
writer.macro.translateVba
```

## Command descriptor contract

```javascript
{
  id: 'writer.format.bold',
  owner: 'UnifiedWriter.EditorControl',
  category: 'format',
  scope: 'edit',
  label: { ja: '太字', en: 'Bold', zh: '加粗' },
  icon: 'bold',
  shortcut: 'Ctrl+B',
  legacyAction: 'bold',
  capability: 'writer.format.bold',
  readOnly: false,
  hostOwned: false
}
```

## Import / Export terminology

`Open` opens a file and routes it to the correct Control.  `Insert from file` inserts external content into the current document.  `Export` produces a Blob in a requested format; the Host chooses the destination.

The Host should not rely on a permanent global `Import` menu.  Instead it should call `control.getImportCapabilities()` and decide whether the capability appears under Open, Insert, Convert or a Host-specific workflow.

## OneEditor / OneViewer File menu delegation profile

```text
host.file.new / host.file.open
  → Host selects or detects file type
  → Host loads UnifiedWriter / UnifiedSpread / UnifiedSlide etc.
  → Host obtains command/menu/toolbar contributions
  → Host routes File menu actions to writer.file.* or the equivalent package namespace
```

WorkbenchControl may render its own File menu for standalone or page-embedded use. That menu calls `writer.file.*` package commands because WorkbenchControl already knows it is hosting UnifiedWriter. OneEditor / OneViewer may ignore this File menu contribution and render a Host-owned File menu instead. This delegation profile must not be treated as a universal Host rule.


## EditorControl edit/view mode standard

File-processing packages should not define a separate ViewerControl when the same body Control can operate in read-only mode. UnifiedWriter standardizes this as:

```text
OneEditor  -> createEditorControl({ mode: 'edit' })
OneViewer  -> createEditorControl({ mode: 'view' })
Workbench  -> createWorkbenchControl({ mode: 'edit' | 'view' })
```

In view mode, UnifiedWriter still exposes view-safe storage-neutral file commands/capabilities such as open, export, print and properties. Mutation-oriented command groups such as Insert, Format and Review are omitted, disabled, or guarded at the public API boundary. File/Help UI ownership depends on the active surface: WorkbenchControl may render it, while OneEditor / OneViewer may delegate from Host UI.
