C# Class XWord.AddinActions

Provides implementations for the common addin actions. This class should contain most VSTO specific code.
显示文件 Open project: xwiki-contrib/xwiki-office Class Usage Examples

Public Methods

Method Description
AddNewPage ( String space, String pageName ) : void

Starts editing a new wiki page. The page will not be created in the wiki until the fisrt save.

AddNewPage ( String spaceName, String pageName, String pageTitle, Form sender ) : void

Starts editing a new wiki page. The page will not be created in the wiki until the fisrt save.

AddinActions ( XWikiAddIn addin ) : System

Creates an instance for this class.

AttachCurrentFile ( String pageFullName ) : bool

Saves the document and attaches it to a wiki page

AttachCurrentFile ( String space, String page ) : bool

Saves the document and attaches it to a wiki page

CheckForErrors ( string content ) : bool

Searches the server response for error strings.

ConvertToNormalFolder ( string folder ) : void

Converts the folder to a "Normal" type folder.

DownloadAttachment ( String pageFullName, String attachmentName, String path ) : FileInfo

Downloads the file to a local folder. The folder is located in MyDocuments

EditPage ( String pageFullName ) : void

Edits a wiki page. The LoadingDialog is shown during the operation. EditPage

GetActivePageName ( ) : String

Gets the fullname of the wiki page edited in the active document.

HideProtectedPages ( Wiki wiki, List wildcards ) : void

Removes all protected pages from the Word wiki structure.

IsOpened ( String pageFullName ) : bool

Specifies if a wiki page is opened for editing.

IsProtectedPage ( String pageFullName, List wildCards ) : bool

Specifies if a page is protected or not.

RefreshActiveDocument ( ) : void

Reloads the active document, if it's a wiki page.

SaveFileDialog ( String fileName ) : String

Displays a SaveFileDialog

SaveToServer ( ) : void

Saves the currently edited page or document to the server. Displays the operation in progress dialog.

ShadowCopyDocument ( Microsoft.Office.Interop.Word document, string path, Microsoft.Office.Interop.Word saveFormat ) : bool

Copies a document to a specified path.

The document is saved in Unicode little endian encoding.

StartProcess ( String fullFileName ) : void

Starts a new process. - If the file is executable then it will execute that file. - If the file file is resistered to be opened with another application then it will be opened with that application - If the file doesnt have an assigned application then Windows Explorer openes it's directory.

Private Methods

Method Description
Application_MailMergeAfterMerge ( Microsoft Doc, Microsoft DocResult ) : void
CheckPageHistory ( String pageFullName, bool &wasModified, String &lastAuthor ) : XWiki.XmlRpc.PageHistorySummary[]

Updates the history of a page, the last author and specifies if the page was modified.

DisableGrammarAndSpellingChecking ( ) : void

Disable grammar and spelling checking.

GetPage ( Object _pageFullName ) : void

Edits a wiki page.

IndexPageHistory ( String pageFullName ) : void

Retrieves the versioning information for a wiki page, and registers it ot the history dictionary.

KeepNewWindowActivated ( Microsoft.Office.Interop.Word doc, Microsoft.Office.Interop.Word Wn ) : void

Activates the newest Word window.

MergeWithLatestVersion ( String pageFullName ) : bool

If the document was modified externally, prompts the user with the document merge screen.

OpenForMerge ( String pageFullName, String &localFileName ) : void

Retrieves a page from the wiki and save it locally in order to be merged to the active document.

OpenHTMLDocument ( String path ) : Microsoft.Office.Interop.Word.Document

Opens a local(document) file with Word.

ReportSaveProblem ( ) : void
RestoreGrammarAndSpellingSettings ( ) : void

Restore user settings for grammar and spelling checking.

SaveGrammarAndSpellingSettings ( ) : void

Save user settings for grammar and spelling checking.

SavePage ( String pageName, String &pageContent, String syntax ) : bool

Saves the page to the wiki. Shows a message box with an error if the operation fails.

SaveToXwiki ( ) : void

Saves the currently edited page or document to the server.

Method Details

AddNewPage() public method

Starts editing a new wiki page. The page will not be created in the wiki until the fisrt save.
public AddNewPage ( String space, String pageName ) : void
space String The name of the wiki space
pageName String The name of page
return void

AddNewPage() public method

Starts editing a new wiki page. The page will not be created in the wiki until the fisrt save.
public AddNewPage ( String spaceName, String pageName, String pageTitle, Form sender ) : void
spaceName String The name of the wiki space.
pageName String The name of page.
pageTitle String The title of the page.
sender System.Windows.Forms.Form /// The instance of the fprm that started the action. /// This form need to be closed before swithing the Active Word Document. ///
return void

AddinActions() public method

Creates an instance for this class.
public AddinActions ( XWikiAddIn addin ) : System
addin XWikiAddIn The instance of the current add-in.
return System

AttachCurrentFile() public method

Saves the document and attaches it to a wiki page
public AttachCurrentFile ( String pageFullName ) : bool
pageFullName String The full name of the wiki page.
return bool

AttachCurrentFile() public method

Saves the document and attaches it to a wiki page
public AttachCurrentFile ( String space, String page ) : bool
space String The name of the wiki space.
page String The name of the page.
return bool

CheckForErrors() public method

Searches the server response for error strings.
public CheckForErrors ( string content ) : bool
content string The server response.
return bool

ConvertToNormalFolder() public method

Converts the folder to a "Normal" type folder.
public ConvertToNormalFolder ( string folder ) : void
folder string
return void

DownloadAttachment() public method

Downloads the file to a local folder. The folder is located in MyDocuments
public DownloadAttachment ( String pageFullName, String attachmentName, String path ) : FileInfo
pageFullName String FullName of the wiki page - Space.Name
attachmentName String Name of the attached file
path String The location where the attachment will be downloaded. Use null for default location.
return System.IO.FileInfo

EditPage() public method

Edits a wiki page. The LoadingDialog is shown during the operation. EditPage
public EditPage ( String pageFullName ) : void
pageFullName String The full name of the wiki page that is being opened for editing.
return void

GetActivePageName() public method

Gets the fullname of the wiki page edited in the active document.
public GetActivePageName ( ) : String
return String

HideProtectedPages() public method

Removes all protected pages from the Word wiki structure.
public HideProtectedPages ( Wiki wiki, List wildcards ) : void
wiki XWiki.Model.Wiki The wiki instance.
wildcards List The list of protected pages wildcards.
return void

IsOpened() public method

Specifies if a wiki page is opened for editing.
public IsOpened ( String pageFullName ) : bool
pageFullName String The full name of the page.
return bool

IsProtectedPage() public method

Specifies if a page is protected or not.
public IsProtectedPage ( String pageFullName, List wildCards ) : bool
pageFullName String The full name of the page.
wildCards List The wildcard list of protected pages.
return bool

RefreshActiveDocument() public method

Reloads the active document, if it's a wiki page.
public RefreshActiveDocument ( ) : void
return void

SaveFileDialog() public method

Displays a SaveFileDialog
public SaveFileDialog ( String fileName ) : String
fileName String Optional name of file to be saved.
return String

SaveToServer() public method

Saves the currently edited page or document to the server. Displays the operation in progress dialog.
public SaveToServer ( ) : void
return void

ShadowCopyDocument() public method

Copies a document to a specified path.
The document is saved in Unicode little endian encoding.
When the file cannot be saved.
public ShadowCopyDocument ( Microsoft.Office.Interop.Word document, string path, Microsoft.Office.Interop.Word saveFormat ) : bool
document Microsoft.Office.Interop.Word The Document instance.
path string The path where the new file will be saved.
saveFormat Microsoft.Office.Interop.Word The save format.
return bool

StartProcess() public method

Starts a new process. - If the file is executable then it will execute that file. - If the file file is resistered to be opened with another application then it will be opened with that application - If the file doesnt have an assigned application then Windows Explorer openes it's directory.
public StartProcess ( String fullFileName ) : void
fullFileName String The full path and name of the file.
return void