gecko-dev/mailnews/compose/public/nsIMsgCompose.idl

237 lines
7.5 KiB
Plaintext

/* -*- Mode: idl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsISupports.idl"
#include "domstubs.idl"
#include "nsIMsgCompFields.idl"
#include "nsIMsgComposeParams.idl"
#include "nsIEditorShell.idl"
#include "nsIMsgIdentity.idl"
#include "nsIMsgSend.idl"
#include "nsIMsgComposeProgress.idl"
%{ C++
#include "nsIDOMWindowInternal.h"
#include "nsIEditorShell.h"
%}
typedef long MSG_ComposeSaveType;
[scriptable, uuid(6953e50a-7531-11d3-85fe-006008948010)]
interface nsIMsgCompSaveType {
const long File = 0;
const long Template = 1;
const long Draft = 2;
};
typedef long MSG_DeliverMode;
[scriptable, uuid(f338eba4-7530-11d3-8833-006008948010)]
interface nsIMsgCompDeliverMode {
const long Now = 0;
const long Later = 1;
const long Save = 2;
const long SaveAs = 3;
const long SaveAsDraft = 4;
const long SaveAsTemplate = 5;
};
[scriptable, uuid(f38ea280-e090-11d3-a449-e3153319347c)]
interface nsIMsgCompSendFormat {
const long AskUser = 4; /* Hack: Bug 44512. If this is 0 and passed
as results.action to the askSendFormat
dialog, the args object gets destroyed.*/
const long PlainText = 1;
const long HTML = 2;
const long Both = 3;
};
[scriptable, uuid(9638af92-1dd1-11b2-bef1-ca5fee0abc62)]
interface nsIMsgCompConvertible/*ToTXT*/ {
const long Plain = 1; // Like 4.x: Only <html>, <p>, <br>, ...
const long Yes = 2; // *Minor* alterations of the look: <ol>, <dd>, ...
const long Altering = 3; /* Look altered: <strong>, <i>, <h1>, ...
Can be expressed in plaintext, but not in
the way it looked in the HTML composer. */
const long No = 4; /* Will lose data: <font>, ...
Really *requires* visual formatting or
is not supported by our HTML->TXT converter. */
/* The values here have meaning, they are "levels":
convertible({a; b}) == max(convertible({a}), convertible({b}))
must be true, i.e. the higher value counts. */
};
[scriptable, uuid(e72c6981-992a-11d3-a449-eb15bb19bc7c)]
interface nsIMsgComposeStateListener : nsISupports
{
/* ... */
void NotifyComposeFieldsReady();
void ComposeProcessDone();
void SaveInFolderDone(in string folderName);
};
%{ C++
/* TODO: we should create an interface for this enum! */
typedef enum {
eComposeFieldsReady,
eComposeProcessDone,
eSaveInFolderDone
} TStateListenerNotification;
%}
native TStateListenerNotification(TStateListenerNotification);
native nsString(nsString);
[ref] native nsStringRef(nsString);
[scriptable, uuid(4E606270-B588-11D2-8289-00805F2A0107)]
interface nsIMsgCompose : nsISupports {
/* ... */
void Initialize(in nsIDOMWindowInternal aWindow, in nsIMsgComposeParams params);
/* ... */
void SetDocumentCharset(in string charset);
/* ... */
void RegisterStateListener(in nsIMsgComposeStateListener stateListener);
/* ... */
void UnregisterStateListener(in nsIMsgComposeStateListener stateListener);
/* ... */
void SendMsg(in MSG_DeliverMode deliverMode, in nsIMsgIdentity identity, in nsIMsgComposeProgress progress);
/* ... */
void CloseWindow();
/*
AttachmentPrettyName will return only the leafName if the it's a file URL.
It will also convert the filename to the right character set.
This UI utility function should probably go into it's own class
*/
wstring AttachmentPrettyName(in string url);
/*
CheckAndPopulateRecipients will perform several task:
1) if populateMailList is true, it will populate mailing presents in the compose field
2) if returnNoHTMLRecipients is true, build a list of non HTML recipient
3) return the lowest common format prefered by recipients (unknow, plaintext or html)
*/
unsigned long CheckAndPopulateRecipients(in boolean populateMailList, in boolean returnNonHTMLRecipients, out wstring nonHTMLRecipients);
/* GetNoHtmlNewsgroups: if null is passed as recipient, the function will automatically
looks for newsgroups stored in compose fields
*/
string GetNoHtmlNewsgroups(in string newsgroups);
/* bodyConvertible: The level of "convertibility" to plaintext
* @return a value from nsIMsgCompConvertible.
*/
long bodyConvertible();
/* SetSignature: will replace the curr.
*/
void SetSignature(in nsIMsgIdentity identity);
/* ResetNodeEventHandlers: Temporary API to go around bug 26528. THis API will be removed when bug 26528 is fixed.
*/
void ResetNodeEventHandlers(in nsIDOMNode node);
/* ... */
attribute nsIEditorShell editor;
/* ... */
readonly attribute nsIDOMWindowInternal domWindow;
/* ... */
readonly attribute nsIMsgCompFields compFields;
/* ... */
readonly attribute boolean composeHTML;
/* ... */
readonly attribute MSG_ComposeType type;
/* ... */
readonly attribute long wrapLength;
/* by reading this value, you can determine if yes or not the message has been mofified
by the user. When you set this value to false, you reset the modification count
of the body to 0 (clean).
*/
attribute boolean bodyModified;
/* The following functions are for internal use, essentially for the listener */
/* ... */
[noscript] void setCiteReference(in nsString citeReference);
/* Set the URI of the folder where the message has been saved */
[noscript] void setSavedFoldeURI(in string folderURI);
/* Append the signature defined in the identity to the msgBody */
[noscript] void processSignature(in nsIMsgIdentity identity, inout nsString aMsgBody);
/* set any reply flags on the original message's folder */
[noscript] void processReplyFlags();
/* ... */
[noscript] void convertAndLoadComposeWindow(in nsIEditorShell aEditorShell, in nsStringRef aPrefix, in nsStringRef aBuf,
in nsStringRef aSignature, in boolean aQuoted, in boolean aHTMLEditor);
/* Tell the doc state listeners that the doc state has changed */
[noscript] void notifyStateListeners(in TStateListenerNotification aNotificationType);
/* Retreive the progress object */
[nocript] nsIMsgComposeProgress getProgress();
/* Set the message send object */
[nocript] void setMessageSend(in nsIMsgSend msgSend);
/* Retreive the message send object */
[nocript] nsIMsgSend getMessageSend();
/* ... */
[noscript] void buildBodyMessageAndSignature();
/* ... */
[noscript] void buildQuotedMessageAndSignature();
/* ... */
[noscript] void getQuotingToFollow(out boolean quotingToFollow);
};
/* Listener interface */
[noscript, uuid(ACC72780-2CEA-11D5-9DAA-BACDEAC1EEFC)]
interface nsIMsgComposeSendListener : nsISupports {
void setMsgCompose(in nsIMsgCompose msgCompose);
void setDeliverMode(in MSG_DeliverMode deliverMode);
};