зеркало из https://github.com/mozilla/pjs.git
groundwork for 44684: adding a "GetAlignment" call to the editor so that ui can reflect alignment of selection
This commit is contained in:
Родитель
feb7dd02ea
Коммит
008d4be4c9
|
@ -1233,6 +1233,34 @@ nsEditorShell::GetListItemState(PRBool *aMixed, PRUnichar **_retval)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsEditorShell::GetAlignment(PRBool *aMixed, PRUnichar **_retval)
|
||||||
|
{
|
||||||
|
if (!aMixed || !_retval) return NS_ERROR_NULL_POINTER;
|
||||||
|
*_retval = nsnull;
|
||||||
|
*aMixed = PR_FALSE;
|
||||||
|
|
||||||
|
nsresult err = NS_NOINTERFACE;
|
||||||
|
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
|
||||||
|
if (htmlEditor)
|
||||||
|
{
|
||||||
|
nsIHTMLEditor::EAlignment firstAlign;
|
||||||
|
err = htmlEditor->GetAlignment(*aMixed, firstAlign);
|
||||||
|
if (NS_SUCCEEDED(err))
|
||||||
|
{
|
||||||
|
nsAutoString tagStr;
|
||||||
|
if (firstAlign == nsIHTMLEditor::eLeft)
|
||||||
|
tagStr.AssignWithConversion("left");
|
||||||
|
else if (firstAlign == nsIHTMLEditor::eCenter)
|
||||||
|
tagStr.AssignWithConversion("center");
|
||||||
|
else if (firstAlign == nsIHTMLEditor::eRight)
|
||||||
|
tagStr.AssignWithConversion("right");
|
||||||
|
*_retval = tagStr.ToNewUnicode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEditorShell::ApplyStyleSheet(const PRUnichar *url)
|
nsEditorShell::ApplyStyleSheet(const PRUnichar *url)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,7 +80,7 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// These must map onto the button-order for nsICommonDialog::Confirm results
|
// These must map onto the button-order for nsICommonDialog::Confirm results
|
||||||
// which are rather ugly right now (Cancel in the middle!)
|
// which are rather ugly right now (Cancel in the middle!)
|
||||||
typedef enum {eYes = 0, eCancel = 1, eNo = 2 } EConfirmResult;
|
typedef enum {eYes = 0, eCancel = 1, eNo = 2 } EConfirmResult;
|
||||||
|
|
||||||
|
@ -100,30 +100,30 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
eUninitializedEditorType = 0,
|
eUninitializedEditorType = 0,
|
||||||
ePlainTextEditorType = 1,
|
ePlainTextEditorType = 1,
|
||||||
eHTMLTextEditorType = 2
|
eHTMLTextEditorType = 2
|
||||||
} EEditorType;
|
} EEditorType;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
eCantEditNoReason = 0,
|
eCantEditNoReason = 0,
|
||||||
eCantEditFramesets = 1,
|
eCantEditFramesets = 1,
|
||||||
eCantEditMimeType = 2,
|
eCantEditMimeType = 2,
|
||||||
eCantEditOther = 3
|
eCantEditOther = 3
|
||||||
} ECantEditReason;
|
} ECantEditReason;
|
||||||
|
|
||||||
nsresult DoEditorMode(nsIDocShell *aDocShell);
|
nsresult DoEditorMode(nsIDocShell *aDocShell);
|
||||||
// nuke any existing editor in the editorShell, thus preparing it to edit
|
// nuke any existing editor in the editorShell, thus preparing it to edit
|
||||||
// a(nother) document.
|
// a(nother) document.
|
||||||
nsresult ResetEditingState();
|
nsresult ResetEditingState();
|
||||||
nsresult InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell);
|
nsresult InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell);
|
||||||
nsresult PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUrl);
|
nsresult PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUrl);
|
||||||
nsresult ScrollSelectionIntoView();
|
nsresult ScrollSelectionIntoView();
|
||||||
nsresult TransferDocumentStateListeners();
|
nsresult TransferDocumentStateListeners();
|
||||||
nsresult RemoveOneProperty(const nsString& aProp, const nsString& aAttr);
|
nsresult RemoveOneProperty(const nsString& aProp, const nsString& aAttr);
|
||||||
nsresult DoFind(PRBool aFindNext);
|
nsresult DoFind(PRBool aFindNext);
|
||||||
// To allow executing JavaScript commands from C++ via nsIEditorControler interface
|
// To allow executing JavaScript commands from C++ via nsIEditorControler interface
|
||||||
nsresult DoControllerCommand(nsString& aCommand);
|
nsresult DoControllerCommand(nsString& aCommand);
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
EConfirmResult ConfirmWithCancel(const nsString& aTitle, const nsString& aQuestion,
|
EConfirmResult ConfirmWithCancel(const nsString& aTitle, const nsString& aQuestion,
|
||||||
const nsString *aYesString, const nsString *aNoString);
|
const nsString *aYesString, const nsString *aNoString);
|
||||||
|
|
||||||
// this returns an AddReffed nsIScriptContext. You must relase it.
|
// this returns an AddReffed nsIScriptContext. You must relase it.
|
||||||
nsIScriptContext* GetScriptContext(nsIDOMWindow * aWin);
|
nsIScriptContext* GetScriptContext(nsIDOMWindow * aWin);
|
||||||
|
|
||||||
// Get a string from the string bundle file
|
// Get a string from the string bundle file
|
||||||
void GetBundleString(const nsString& name, nsString &outString);
|
void GetBundleString(const nsString& name, nsString &outString);
|
||||||
|
@ -161,7 +161,7 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
// fix rowspan, colspan, and missing cells problems
|
// fix rowspan, colspan, and missing cells problems
|
||||||
nsresult CheckPrefAndNormalizeTable();
|
nsresult CheckPrefAndNormalizeTable();
|
||||||
|
|
||||||
nsCOMPtr<nsIHTMLEditor> mEditor; // this can be either an HTML or plain text (or other?) editor
|
nsCOMPtr<nsIHTMLEditor> mEditor; // this can be either an HTML or plain text (or other?) editor
|
||||||
nsCOMPtr<nsISupports> mSearchContext; // context used for search and replace. Owned by the appshell.
|
nsCOMPtr<nsISupports> mSearchContext; // context used for search and replace. Owned by the appshell.
|
||||||
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
// These doc listeners are registered with the editor when that gets
|
// These doc listeners are registered with the editor when that gets
|
||||||
// created. We also keep them in this list so we can register if we have
|
// created. We also keep them in this list so we can register if we have
|
||||||
// to blow away the editor (e.g. URL reload)
|
// to blow away the editor (e.g. URL reload)
|
||||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||||
|
|
||||||
// Pointer to localized strings used for UI
|
// Pointer to localized strings used for UI
|
||||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||||
|
@ -197,26 +197,26 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
// so we need to track it separately
|
// so we need to track it separately
|
||||||
PRBool mHTMLSourceMode;
|
PRBool mHTMLSourceMode;
|
||||||
|
|
||||||
nsIDOMWindow *mWebShellWindow; // weak reference
|
nsIDOMWindow *mWebShellWindow; // weak reference
|
||||||
//nsIDOMWindow *mContentWindow; // weak reference
|
//nsIDOMWindow *mContentWindow; // weak reference
|
||||||
nsWeakPtr mContentWindow; // weak reference
|
nsWeakPtr mContentWindow; // weak reference
|
||||||
|
|
||||||
nsEditorParserObserver *mParserObserver; // we hold the owning ref to this.
|
nsEditorParserObserver *mParserObserver; // we hold the owning ref to this.
|
||||||
nsInterfaceState *mStateMaintainer; // we hold the owning ref to this.
|
nsInterfaceState *mStateMaintainer; // we hold the owning ref to this.
|
||||||
|
|
||||||
nsIEditorController *mEditorController; // temporary weak ref to the editor controller
|
nsIEditorController *mEditorController; // temporary weak ref to the editor controller
|
||||||
nsIDocShell *mDocShell; // weak reference
|
nsIDocShell *mDocShell; // weak reference
|
||||||
|
|
||||||
// The webshell that contains the document being edited.
|
// The webshell that contains the document being edited.
|
||||||
// Don't assume that webshell directly contains the document being edited;
|
// Don't assume that webshell directly contains the document being edited;
|
||||||
// if we are in a frameset, this assumption is false.
|
// if we are in a frameset, this assumption is false.
|
||||||
nsIDocShell *mContentAreaDocShell; // weak reference
|
nsIDocShell *mContentAreaDocShell; // weak reference
|
||||||
|
|
||||||
PRPackedBool mCloseWindowWhenLoaded; // error on load. Close window when loaded
|
PRPackedBool mCloseWindowWhenLoaded; // error on load. Close window when loaded
|
||||||
ECantEditReason mCantEditReason;
|
ECantEditReason mCantEditReason;
|
||||||
|
|
||||||
EEditorType mEditorType;
|
EEditorType mEditorType;
|
||||||
nsString mEditorTypeString; // string which describes which editor type will be instantiated (lowercased)
|
nsString mEditorTypeString; // string which describes which editor type will be instantiated (lowercased)
|
||||||
PRInt32 mWrapColumn; // can't actually set this 'til the editor is created, so we may have to hold on to it for a while
|
PRInt32 mWrapColumn; // can't actually set this 'til the editor is created, so we may have to hold on to it for a while
|
||||||
|
|
||||||
nsStringArray mSuggestedWordList;
|
nsStringArray mSuggestedWordList;
|
||||||
|
|
|
@ -455,6 +455,11 @@ nsHTMLEditRules::GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBo
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLEditRules::GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLEditRules::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
nsHTMLEditRules::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
||||||
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
||||||
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
||||||
|
NS_IMETHOD GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign);
|
||||||
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat);
|
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat);
|
||||||
|
|
||||||
// nsIEditActionListener methods
|
// nsIEditActionListener methods
|
||||||
|
|
|
@ -3082,6 +3082,18 @@ nsHTMLEditor::GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool
|
||||||
return htmlRules->GetListItemState(aMixed, aLI, aDT, aDD);
|
return htmlRules->GetListItemState(aMixed, aLI, aDT, aDD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLEditor::GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign)
|
||||||
|
{
|
||||||
|
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
|
||||||
|
|
||||||
|
nsCOMPtr<nsIHTMLEditRules> htmlRules = do_QueryInterface(mRules);
|
||||||
|
if (!htmlRules) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
return htmlRules->GetAlignment(aMixed, aAlign);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLEditor::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
nsHTMLEditor::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,6 +138,7 @@ public:
|
||||||
NS_IMETHOD GetFontFaceState(PRBool &aMixed, nsString &outFace);
|
NS_IMETHOD GetFontFaceState(PRBool &aMixed, nsString &outFace);
|
||||||
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
||||||
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
||||||
|
NS_IMETHOD GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign);
|
||||||
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
||||||
|
|
||||||
NS_IMETHOD MakeOrChangeList(const nsString& aListType);
|
NS_IMETHOD MakeOrChangeList(const nsString& aListType);
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL)=0;
|
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL)=0;
|
||||||
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD)=0;
|
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD)=0;
|
||||||
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)=0;
|
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)=0;
|
||||||
|
NS_IMETHOD GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign)=0;
|
||||||
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat)=0;
|
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1233,6 +1233,34 @@ nsEditorShell::GetListItemState(PRBool *aMixed, PRUnichar **_retval)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsEditorShell::GetAlignment(PRBool *aMixed, PRUnichar **_retval)
|
||||||
|
{
|
||||||
|
if (!aMixed || !_retval) return NS_ERROR_NULL_POINTER;
|
||||||
|
*_retval = nsnull;
|
||||||
|
*aMixed = PR_FALSE;
|
||||||
|
|
||||||
|
nsresult err = NS_NOINTERFACE;
|
||||||
|
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
|
||||||
|
if (htmlEditor)
|
||||||
|
{
|
||||||
|
nsIHTMLEditor::EAlignment firstAlign;
|
||||||
|
err = htmlEditor->GetAlignment(*aMixed, firstAlign);
|
||||||
|
if (NS_SUCCEEDED(err))
|
||||||
|
{
|
||||||
|
nsAutoString tagStr;
|
||||||
|
if (firstAlign == nsIHTMLEditor::eLeft)
|
||||||
|
tagStr.AssignWithConversion("left");
|
||||||
|
else if (firstAlign == nsIHTMLEditor::eCenter)
|
||||||
|
tagStr.AssignWithConversion("center");
|
||||||
|
else if (firstAlign == nsIHTMLEditor::eRight)
|
||||||
|
tagStr.AssignWithConversion("right");
|
||||||
|
*_retval = tagStr.ToNewUnicode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEditorShell::ApplyStyleSheet(const PRUnichar *url)
|
nsEditorShell::ApplyStyleSheet(const PRUnichar *url)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,7 +80,7 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// These must map onto the button-order for nsICommonDialog::Confirm results
|
// These must map onto the button-order for nsICommonDialog::Confirm results
|
||||||
// which are rather ugly right now (Cancel in the middle!)
|
// which are rather ugly right now (Cancel in the middle!)
|
||||||
typedef enum {eYes = 0, eCancel = 1, eNo = 2 } EConfirmResult;
|
typedef enum {eYes = 0, eCancel = 1, eNo = 2 } EConfirmResult;
|
||||||
|
|
||||||
|
@ -100,30 +100,30 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
eUninitializedEditorType = 0,
|
eUninitializedEditorType = 0,
|
||||||
ePlainTextEditorType = 1,
|
ePlainTextEditorType = 1,
|
||||||
eHTMLTextEditorType = 2
|
eHTMLTextEditorType = 2
|
||||||
} EEditorType;
|
} EEditorType;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
eCantEditNoReason = 0,
|
eCantEditNoReason = 0,
|
||||||
eCantEditFramesets = 1,
|
eCantEditFramesets = 1,
|
||||||
eCantEditMimeType = 2,
|
eCantEditMimeType = 2,
|
||||||
eCantEditOther = 3
|
eCantEditOther = 3
|
||||||
} ECantEditReason;
|
} ECantEditReason;
|
||||||
|
|
||||||
nsresult DoEditorMode(nsIDocShell *aDocShell);
|
nsresult DoEditorMode(nsIDocShell *aDocShell);
|
||||||
// nuke any existing editor in the editorShell, thus preparing it to edit
|
// nuke any existing editor in the editorShell, thus preparing it to edit
|
||||||
// a(nother) document.
|
// a(nother) document.
|
||||||
nsresult ResetEditingState();
|
nsresult ResetEditingState();
|
||||||
nsresult InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell);
|
nsresult InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell);
|
||||||
nsresult PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUrl);
|
nsresult PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUrl);
|
||||||
nsresult ScrollSelectionIntoView();
|
nsresult ScrollSelectionIntoView();
|
||||||
nsresult TransferDocumentStateListeners();
|
nsresult TransferDocumentStateListeners();
|
||||||
nsresult RemoveOneProperty(const nsString& aProp, const nsString& aAttr);
|
nsresult RemoveOneProperty(const nsString& aProp, const nsString& aAttr);
|
||||||
nsresult DoFind(PRBool aFindNext);
|
nsresult DoFind(PRBool aFindNext);
|
||||||
// To allow executing JavaScript commands from C++ via nsIEditorControler interface
|
// To allow executing JavaScript commands from C++ via nsIEditorControler interface
|
||||||
nsresult DoControllerCommand(nsString& aCommand);
|
nsresult DoControllerCommand(nsString& aCommand);
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
EConfirmResult ConfirmWithCancel(const nsString& aTitle, const nsString& aQuestion,
|
EConfirmResult ConfirmWithCancel(const nsString& aTitle, const nsString& aQuestion,
|
||||||
const nsString *aYesString, const nsString *aNoString);
|
const nsString *aYesString, const nsString *aNoString);
|
||||||
|
|
||||||
// this returns an AddReffed nsIScriptContext. You must relase it.
|
// this returns an AddReffed nsIScriptContext. You must relase it.
|
||||||
nsIScriptContext* GetScriptContext(nsIDOMWindow * aWin);
|
nsIScriptContext* GetScriptContext(nsIDOMWindow * aWin);
|
||||||
|
|
||||||
// Get a string from the string bundle file
|
// Get a string from the string bundle file
|
||||||
void GetBundleString(const nsString& name, nsString &outString);
|
void GetBundleString(const nsString& name, nsString &outString);
|
||||||
|
@ -161,7 +161,7 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
// fix rowspan, colspan, and missing cells problems
|
// fix rowspan, colspan, and missing cells problems
|
||||||
nsresult CheckPrefAndNormalizeTable();
|
nsresult CheckPrefAndNormalizeTable();
|
||||||
|
|
||||||
nsCOMPtr<nsIHTMLEditor> mEditor; // this can be either an HTML or plain text (or other?) editor
|
nsCOMPtr<nsIHTMLEditor> mEditor; // this can be either an HTML or plain text (or other?) editor
|
||||||
nsCOMPtr<nsISupports> mSearchContext; // context used for search and replace. Owned by the appshell.
|
nsCOMPtr<nsISupports> mSearchContext; // context used for search and replace. Owned by the appshell.
|
||||||
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
// These doc listeners are registered with the editor when that gets
|
// These doc listeners are registered with the editor when that gets
|
||||||
// created. We also keep them in this list so we can register if we have
|
// created. We also keep them in this list so we can register if we have
|
||||||
// to blow away the editor (e.g. URL reload)
|
// to blow away the editor (e.g. URL reload)
|
||||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||||
|
|
||||||
// Pointer to localized strings used for UI
|
// Pointer to localized strings used for UI
|
||||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||||
|
@ -197,26 +197,26 @@ class nsEditorShell : public nsIEditorShell,
|
||||||
// so we need to track it separately
|
// so we need to track it separately
|
||||||
PRBool mHTMLSourceMode;
|
PRBool mHTMLSourceMode;
|
||||||
|
|
||||||
nsIDOMWindow *mWebShellWindow; // weak reference
|
nsIDOMWindow *mWebShellWindow; // weak reference
|
||||||
//nsIDOMWindow *mContentWindow; // weak reference
|
//nsIDOMWindow *mContentWindow; // weak reference
|
||||||
nsWeakPtr mContentWindow; // weak reference
|
nsWeakPtr mContentWindow; // weak reference
|
||||||
|
|
||||||
nsEditorParserObserver *mParserObserver; // we hold the owning ref to this.
|
nsEditorParserObserver *mParserObserver; // we hold the owning ref to this.
|
||||||
nsInterfaceState *mStateMaintainer; // we hold the owning ref to this.
|
nsInterfaceState *mStateMaintainer; // we hold the owning ref to this.
|
||||||
|
|
||||||
nsIEditorController *mEditorController; // temporary weak ref to the editor controller
|
nsIEditorController *mEditorController; // temporary weak ref to the editor controller
|
||||||
nsIDocShell *mDocShell; // weak reference
|
nsIDocShell *mDocShell; // weak reference
|
||||||
|
|
||||||
// The webshell that contains the document being edited.
|
// The webshell that contains the document being edited.
|
||||||
// Don't assume that webshell directly contains the document being edited;
|
// Don't assume that webshell directly contains the document being edited;
|
||||||
// if we are in a frameset, this assumption is false.
|
// if we are in a frameset, this assumption is false.
|
||||||
nsIDocShell *mContentAreaDocShell; // weak reference
|
nsIDocShell *mContentAreaDocShell; // weak reference
|
||||||
|
|
||||||
PRPackedBool mCloseWindowWhenLoaded; // error on load. Close window when loaded
|
PRPackedBool mCloseWindowWhenLoaded; // error on load. Close window when loaded
|
||||||
ECantEditReason mCantEditReason;
|
ECantEditReason mCantEditReason;
|
||||||
|
|
||||||
EEditorType mEditorType;
|
EEditorType mEditorType;
|
||||||
nsString mEditorTypeString; // string which describes which editor type will be instantiated (lowercased)
|
nsString mEditorTypeString; // string which describes which editor type will be instantiated (lowercased)
|
||||||
PRInt32 mWrapColumn; // can't actually set this 'til the editor is created, so we may have to hold on to it for a while
|
PRInt32 mWrapColumn; // can't actually set this 'til the editor is created, so we may have to hold on to it for a while
|
||||||
|
|
||||||
nsStringArray mSuggestedWordList;
|
nsStringArray mSuggestedWordList;
|
||||||
|
|
|
@ -531,6 +531,8 @@ interface nsIEditorShell : nsISupports
|
||||||
wstring GetListState(out boolean mixed);
|
wstring GetListState(out boolean mixed);
|
||||||
/* Returns "li", "dt", or "dd" */
|
/* Returns "li", "dt", or "dd" */
|
||||||
wstring GetListItemState(out boolean mixed);
|
wstring GetListItemState(out boolean mixed);
|
||||||
|
/* Returns "left", "center", or "right" */
|
||||||
|
wstring GetAlignment(out boolean mixed);
|
||||||
|
|
||||||
void ApplyStyleSheet(in wstring url);
|
void ApplyStyleSheet(in wstring url);
|
||||||
|
|
||||||
|
|
|
@ -455,6 +455,11 @@ nsHTMLEditRules::GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBo
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLEditRules::GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLEditRules::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
nsHTMLEditRules::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
||||||
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
||||||
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
||||||
|
NS_IMETHOD GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign);
|
||||||
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat);
|
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat);
|
||||||
|
|
||||||
// nsIEditActionListener methods
|
// nsIEditActionListener methods
|
||||||
|
|
|
@ -3082,6 +3082,18 @@ nsHTMLEditor::GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool
|
||||||
return htmlRules->GetListItemState(aMixed, aLI, aDT, aDD);
|
return htmlRules->GetListItemState(aMixed, aLI, aDT, aDD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLEditor::GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign)
|
||||||
|
{
|
||||||
|
if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
|
||||||
|
|
||||||
|
nsCOMPtr<nsIHTMLEditRules> htmlRules = do_QueryInterface(mRules);
|
||||||
|
if (!htmlRules) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
return htmlRules->GetAlignment(aMixed, aAlign);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLEditor::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
nsHTMLEditor::GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,6 +138,7 @@ public:
|
||||||
NS_IMETHOD GetFontFaceState(PRBool &aMixed, nsString &outFace);
|
NS_IMETHOD GetFontFaceState(PRBool &aMixed, nsString &outFace);
|
||||||
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL);
|
||||||
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD);
|
||||||
|
NS_IMETHOD GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign);
|
||||||
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent);
|
||||||
|
|
||||||
NS_IMETHOD MakeOrChangeList(const nsString& aListType);
|
NS_IMETHOD MakeOrChangeList(const nsString& aListType);
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL)=0;
|
NS_IMETHOD GetListState(PRBool &aMixed, PRBool &aOL, PRBool &aUL, PRBool &aDL)=0;
|
||||||
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD)=0;
|
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD)=0;
|
||||||
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)=0;
|
NS_IMETHOD GetIndentState(PRBool &aCanIndent, PRBool &aCanOutdent)=0;
|
||||||
|
NS_IMETHOD GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign)=0;
|
||||||
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat)=0;
|
NS_IMETHOD GetParagraphState(PRBool &aMixed, nsString &outFormat)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,13 @@ public:
|
||||||
eTypedBreak // user typed enter
|
eTypedBreak // user typed enter
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// used by GetAlignment()
|
||||||
|
typedef enum {
|
||||||
|
eLeft,
|
||||||
|
eCenter,
|
||||||
|
eRight
|
||||||
|
} EAlignment;
|
||||||
|
|
||||||
/* ------------ Document info methods -------------- */
|
/* ------------ Document info methods -------------- */
|
||||||
|
|
||||||
/** get the length of the document in characters */
|
/** get the length of the document in characters */
|
||||||
|
@ -334,6 +341,14 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD)=0;
|
NS_IMETHOD GetListItemState(PRBool &aMixed, PRBool &aLI, PRBool &aDT, PRBool &aDD)=0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetAlignment returns what alignment is in the selection.
|
||||||
|
* @param aMixed True if there is more than one type of list item, or
|
||||||
|
* if there is some list and non-list
|
||||||
|
* @param aAlign enum value for first encountered alignment (left/center/right)
|
||||||
|
*/
|
||||||
|
NS_IMETHOD GetAlignment(PRBool &aMixed, EAlignment &aAlign)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document me!
|
* Document me!
|
||||||
*
|
*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче