How officedev/office-custom-ui-editor works
1. What this repo is
- A standalone Windows desktop application built in C#/.NET for editing the Office Custom UI XML stored inside Office Open XML documents.
- It is not a web app or library-only repo; the architecture centers on a single WinForms UI that edits a document payload and ships with sample content and deployment artifacts.
2. Main application shell
- CustomUIEditor.csproj / CustomUIEditor.sln define the app.
- MainForm.cs is the primary workspace where editing happens.
- AboutBox.cs and ClientEULA.rtf are standard desktop-app support pieces rather than core logic.
3. Document lifecycle boundary
- OfficeDocument.cs and DocumentLifeCycle.cs form the core boundary between the editor UI and the Office file/package being edited.
- This is where the app likely handles loading, opening, tracking changes, and saving the custom UI part inside an Office document.
4. XML content editing layer
- CustomUIContent.cs, MainFormRichTextBox.cs, and XmlColorizer.cs suggest the UI edits raw XML with syntax coloring and a richer text editor surface.
- This layer is responsible for presenting the customUI markup as editable text while keeping it readable and structured for users.
5. Office-specific authoring helpers
- CallbacksBuilder.cs indicates tooling for generating or managing Office Ribbon/backstage callback definitions.
- CustomUIEditor.cs appears to hold editor-specific logic that ties the UI, content model, and Office custom UI concepts together.
6. Schema awareness and validation
- Schemas/customUI.xsd and Schemas/customui14.xsd are the two supported schema boundaries.
- The README makes clear the tool supports Office 2007 and Office 2010+ custom UI schemas, which is a major architectural constraint because it defines what XML the editor must understand.
7. Undo/redo subsystem
- The UndoRedo folder is a self-contained implementation of editing history.
- It includes model types like stacks, lists, and nodes plus control commands, indicating the editor keeps its own undo/redo state rather than relying on the framework.
8. Resource and localization layer
- StringsResource.resx, ImagesResource.resx, and their designer files hold UI text and image assets.
- This separates the visual/editor chrome from logic and supports the small desktop UI with reusable icons and strings.
9. Sample-driven workflow
- The Samples folder contains example XML files such as custom tabs, groups, repurposing examples, and Office-type-specific samples for Word, Excel, and PowerPoint.
- These samples function as reference inputs and likely as quick-start templates for users editing Office ribbon customizations.
10. Office-type visual cues
- Bitmap assets under Resources (worddoc.bmp, excelwkb.bmp, pptpre.bmp, callbacks.bmp) suggest the UI distinguishes document types and callback-related features visually.
- This reinforces that the app is organized around Office document categories and Ribbon callback editing tasks.
11. Desktop app configuration
- app.config and app.manifest define runtime settings and Windows application metadata.
- This is typical of a .NET Framework WinForms tool and confirms the app runs locally with standard Windows deployment behavior.
12. Distribution/publishing boundary
- The publish folder contains ClickOnce-style output: application manifests, deployment files, and setup.exe.
- This is separate from source and shows the project is packaged for end-user installation rather than just source checkout.
13. Overall data flow
- User opens an Office document or sample XML in the WinForms shell.
- The document lifecycle layer loads the customUI XML.
- The editor presents and colors the XML, validates/anchors it against the supported schemas, and tracks edits through the undo/redo subsystem.
- On save, the modified custom UI part is written back into the Office document/package.
14. Architectural takeaway
- The repo is a single-process, client-side XML editor with clear internal boundaries: UI shell, Office document lifecycle, XML editing/validation, undo/redo, resources, and deployment.
- The key external dependency is the Office Open XML custom UI schema ecosystem, which defines the domain the app edits.
Main entry points: MainForm.cs Main form · CustomUIEditor.csproj App project · publish Publish · UndoRedoStack.cs Undo stack
Components 18
Desktop shell
WinForms application entry points and main editor window
- Main form · Primary editor window for loading, editing, and saving custom UI XML
MainForm.cs - About box · Standard application information dialog
AboutBox.cs - App project · Project and solution defining the desktop application
CustomUIEditor.csproj
Document lifecycle
Boundary between the editor and Office Open XML payloads
- Lifecycle · Loads, tracks, and persists document state across edits
DocumentLifeCycle.cs - Office document · Represents the Office Open XML document being edited
OfficeDocument.cs
XML editing
Raw customUI text editing, coloring, and schema-aware authoring
- Content model · Represents editable customUI content
CustomUIContent.cs - Rich editor · Rich text editing surface used for XML input
MainFormRichTextBox.cs - Colorizer · Applies XML coloring and readability cues
XmlColorizer.cs - Callbacks · Builds or manages Ribbon and backstage callback definitions
CallbacksBuilder.cs
Undo/redo
Standalone editing history implementation
- Undo stack · Coordinates undo and redo actions for edits
UndoRedo/Model/UndoRedoStack.cs - Commands · Undo and redo command operations for the editor
UndoRedo/Control/Commands.cs - Stacks · Stack abstractions used by the undo and redo system
UndoRedo/Model/Stack.cs - Lists · Linked-list structures supporting change history
UndoRedo/Model/List.cs
Assets and delivery
Resources, samples, schemas, and deployment artifacts
- Strings · Localized UI strings and labels
StringsResource.resx - Images · UI image resources and icons
ImagesResource.resx - Samples · Reference Office custom UI sample documents
Samples - Schemas · Supported Office 2007 and Office 2010 plus customUI schemas
Schemas - Publish · ClickOnce-style published application artifacts
publish
Connections 21
- App project → Main form: defines · Project wires up the main WinForms workspace
- App project → About box: includes · Project includes the auxiliary dialog
- App project → Lifecycle: compiles · Project contains the document workflow boundary
- Main form → Lifecycle: opens/saves · UI delegates document workflow to lifecycle management
- Lifecycle → Office document: wraps · Lifecycle operates on the Office document boundary
- Main form → Rich editor: edits in · The form uses a rich text surface for XML editing
- Rich editor → Colorizer: colors · Text surface is syntax-colored for XML readability
- Main form → Content model: binds · Workspace edits the customUI content model
- Content model → Schemas: constrained by · Content must conform to supported customUI schemas
- Main form → Callbacks: uses · Editor workflow includes callback generation support
- Main form → Undo stack: tracks edits · User edits are recorded in undo and redo state
- Undo stack → Commands: executes · History controller applies commands
- Undo stack → Stacks: stores · Undo and redo state uses stack structures
- Stacks → Lists: backed by · Stack implementation relies on list nodes
- Main form → Samples: loads examples · Samples provide starter XML and references
- Main form → Strings: uses · UI text is sourced from resources
- Main form → Images: uses · UI chrome uses image resources
- Publish → App project: packages · Published artifacts are built from the desktop app
- Publish → Samples: includes · Deployment output carries sample files
- Publish → Schemas: includes · Deployment output carries schema files
- About box → Main form: supports · About dialog is auxiliary to the main workspace