зеркало из https://github.com/mozilla/pjs.git
Set focus when page is done loading. Fixed labels for menus and toolbars. Replaced 'vertical-align' with 'valign' for box alignment. Changed strings for Edit Modes. Unload style sheets when loading a url into existing window
This commit is contained in:
Родитель
c1b4f66195
Коммит
fc2bc945aa
|
@ -227,7 +227,10 @@ nsEditorShell::nsEditorShell()
|
|||
, mWrapColumn(0)
|
||||
, mSuggestedWordIndex(0)
|
||||
, mDictionaryIndex(0)
|
||||
, mDisplayMode(eDisplayModeNormal)
|
||||
, mMailCompose(0)
|
||||
{
|
||||
//TODO:Save last-used display mode in prefs so new window inherits?
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
@ -424,7 +427,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
aUrl->GetSpec(&pageURLString);
|
||||
|
||||
#if DEBUG
|
||||
printf("Editor is editing %s\n", pageURLString ? pageURLString : "");
|
||||
printf("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : "");
|
||||
#endif
|
||||
|
||||
// only save the file spec if this is a local file, and is not
|
||||
|
@ -432,6 +435,8 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
if (nsCRT::strncmp(pageScheme, "file", 4) == 0 &&
|
||||
nsCRT::strncmp(pageURLString,"about:blank", 11) != 0)
|
||||
{
|
||||
// Clutzy method of converting URL to local file format
|
||||
// nsIFileSpec is going away -- is nsFileSpec???
|
||||
nsFileURL pageURL(pageURLString);
|
||||
nsFileSpec pageSpec(pageURL);
|
||||
|
||||
|
@ -460,11 +465,12 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
// Load style sheet with settings that should never
|
||||
// change, even in "Browser" mode
|
||||
// We won't unload this, so we don't need to be returned the style sheet pointer
|
||||
styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorOverride.css"), nsnull);
|
||||
|
||||
|
||||
styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorOverride.css"),
|
||||
getter_AddRefs(mBaseStyleSheet));
|
||||
|
||||
// Load the edit mode override style sheet
|
||||
// This will be remove for "Browser" mode
|
||||
SetDisplayMode(eDisplayModeNormal);
|
||||
SetDisplayMode(mDisplayMode);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Activate the debug menu only in debug builds
|
||||
|
@ -475,8 +481,15 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
elem->RemoveAttribute(NS_ConvertASCIItoUCS2("hidden"));
|
||||
#endif
|
||||
|
||||
// Force initial focus to the content window -- HOW?
|
||||
// mWebShellWin->SetFocus();
|
||||
// Force initial focus to the content window except if in mail compose
|
||||
if (!mMailCompose)
|
||||
{
|
||||
mContentWindow->Focus();
|
||||
// turn on caret
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
editor->GetSelectionController(getter_AddRefs(selCon));
|
||||
if (selCon) selCon->SetCaretEnabled(PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -607,9 +620,17 @@ nsEditorShell::SetEditorType(const PRUnichar *editorType)
|
|||
|
||||
nsAutoString theType = editorType;
|
||||
theType.ToLowerCase();
|
||||
if (theType.EqualsWithConversion("text") || theType.EqualsWithConversion("html") || theType.IsEmpty() || theType.EqualsWithConversion("htmlmail"))
|
||||
|
||||
PRBool textMail = theType.EqualsWithConversion("textmail");
|
||||
mMailCompose = theType.EqualsWithConversion("htmlmail") || textMail;
|
||||
|
||||
if (mMailCompose ||theType.EqualsWithConversion("text") || theType.EqualsWithConversion("html") || theType.IsEmpty())
|
||||
{
|
||||
mEditorTypeString = theType;
|
||||
// We don't store a separate type for textmail
|
||||
if (textMail)
|
||||
mEditorTypeString = NS_ConvertASCIItoUCS2("text");
|
||||
else
|
||||
mEditorTypeString = theType;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
|
@ -1003,10 +1024,18 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
|
|||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aDisplayMode == eDisplayModeSource && mDisplayMode == eDisplayModeSource)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString indexVal = NS_ConvertASCIItoUCS2((aDisplayMode == eDisplayModeSource) ? "1" : "0");
|
||||
SetChromeAttribute( mDocShell, "ContentWindowDeck", "index", indexVal );
|
||||
|
||||
nsCOMPtr<nsIEditorStyleSheets> styleSheets = do_QueryInterface(mEditor);
|
||||
if (!styleSheets) return NS_NOINTERFACE;
|
||||
|
||||
if (aDisplayMode == eDisplayModeWYSIWYG)
|
||||
mDisplayMode = aDisplayMode;
|
||||
|
||||
if (aDisplayMode == eDisplayModePreview)
|
||||
{
|
||||
// Remove all extra "edit mode" style sheets
|
||||
if (mEditModeStyleSheet)
|
||||
|
@ -1033,14 +1062,8 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
|
|||
if (mEditModeStyleSheet) return NS_OK;
|
||||
|
||||
//Load the editmode style sheet
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mEditModeStyleSheet = styleSheet;
|
||||
return res;
|
||||
return styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(mEditModeStyleSheet));
|
||||
}
|
||||
else if (aDisplayMode == eDisplayModeAllTags)
|
||||
{
|
||||
|
@ -1052,26 +1075,13 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
|
|||
{
|
||||
// Note: using "@import url(chrome://editor/content/EditorContent.css);"
|
||||
// in EditorAllTags.css doesn't seem to work!?
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mEditModeStyleSheet = styleSheet;
|
||||
styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(mEditModeStyleSheet));
|
||||
}
|
||||
|
||||
//Load the editmode style sheet
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorAllTags.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mAllTagsModeStyleSheet = styleSheet;
|
||||
return res;
|
||||
return styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorAllTags.css"),
|
||||
getter_AddRefs(mAllTagsModeStyleSheet));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1091,11 +1101,7 @@ nsEditorShell::DisplayParagraphMarks(PRBool aShowMarks)
|
|||
//Load the style sheet
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorParagraphMarks.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mParagraphMarksStyleSheet = styleSheet;
|
||||
getter_AddRefs(mParagraphMarksStyleSheet));
|
||||
}
|
||||
else if (mParagraphMarksStyleSheet)
|
||||
{
|
||||
|
@ -1130,13 +1136,39 @@ nsEditorShell::SetBodyAttribute(const PRUnichar *attr, const PRUnichar *value)
|
|||
NS_IMETHODIMP
|
||||
nsEditorShell::LoadUrl(const PRUnichar *url)
|
||||
{
|
||||
if(!mContentAreaDocShell)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
if(!mContentAreaDocShell || !mEditor)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mContentAreaDocShell));
|
||||
NS_ENSURE_SUCCESS(webNav->LoadURI(url), NS_ERROR_FAILURE);
|
||||
// Always unload all the override style sheets before loading
|
||||
// a url in case we're replacing an existing document that used them
|
||||
nsCOMPtr<nsIEditorStyleSheets> styleSheets = do_QueryInterface(mEditor);
|
||||
if (!styleSheets) return NS_NOINTERFACE;
|
||||
|
||||
return NS_OK;
|
||||
if (mBaseStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mBaseStyleSheet);
|
||||
mBaseStyleSheet = nsnull;
|
||||
}
|
||||
if (mEditModeStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mEditModeStyleSheet);
|
||||
mEditModeStyleSheet = nsnull;
|
||||
}
|
||||
if (mAllTagsModeStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mAllTagsModeStyleSheet);
|
||||
mAllTagsModeStyleSheet = nsnull;
|
||||
}
|
||||
if (mParagraphMarksStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mParagraphMarksStyleSheet);
|
||||
mParagraphMarksStyleSheet = nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mContentAreaDocShell));
|
||||
NS_ENSURE_SUCCESS(webNav->LoadURI(url), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3105,6 +3137,9 @@ nsEditorShell::GetSelectedElement(const PRUnichar *aInTagName, nsIDOMElement **a
|
|||
{
|
||||
case eHTMLTextEditorType:
|
||||
result = mEditor->GetSelectedElement(tagName, aOutElement);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
break;
|
||||
|
||||
case ePlainTextEditorType:
|
||||
|
@ -3129,7 +3164,13 @@ nsEditorShell::GetFirstSelectedCell(nsIDOMElement **aOutElement)
|
|||
{
|
||||
nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(mEditor);
|
||||
if (tableEditor)
|
||||
{
|
||||
result = tableEditor->GetFirstSelectedCell(aOutElement, nsnull);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3182,6 +3223,9 @@ nsEditorShell::GetElementOrParentByTagName(const PRUnichar *aInTagName, nsIDOMNo
|
|||
{
|
||||
case eHTMLTextEditorType:
|
||||
result = mEditor->GetElementOrParentByTagName(tagName, node, aOutElement);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
break;
|
||||
|
||||
case ePlainTextEditorType:
|
||||
|
@ -3765,7 +3809,12 @@ nsEditorShell::GetCellAt(nsIDOMElement *tableElement, PRInt32 rowIndex, PRInt32
|
|||
{
|
||||
nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(mEditor);
|
||||
if (tableEditor)
|
||||
{
|
||||
result = tableEditor->GetCellAt(tableElement, rowIndex, colIndex, *_retval);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -145,6 +145,8 @@ class nsEditorShell : public nsIEditorShell,
|
|||
nsCOMPtr<nsISupports> mSearchContext; // context used for search and replace. Owned by the appshell.
|
||||
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
||||
|
||||
PRBool mMailCompose;
|
||||
|
||||
// this is a holding pen for doc state listeners. They will be registered with
|
||||
// the editor when that gets created.
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||
|
@ -157,6 +159,13 @@ class nsEditorShell : public nsIEditorShell,
|
|||
nsCOMPtr<nsICSSStyleSheet> mEditModeStyleSheet;
|
||||
nsCOMPtr<nsICSSStyleSheet> mAllTagsModeStyleSheet;
|
||||
nsCOMPtr<nsICSSStyleSheet> mParagraphMarksStyleSheet;
|
||||
|
||||
// The override style sheet that we never unload while editing
|
||||
nsCOMPtr<nsICSSStyleSheet> mBaseStyleSheet;
|
||||
|
||||
// Saves the current display mode to reload style sheets
|
||||
// after loading a url
|
||||
PRInt32 mDisplayMode;
|
||||
|
||||
nsIDOMWindow *mWebShellWindow; // weak reference
|
||||
nsIDOMWindow *mContentWindow; // weak reference
|
||||
|
|
|
@ -848,20 +848,23 @@ NS_IMETHODIMP nsHTMLEditor::TabInTable(PRBool inIsShift, PRBool *outHandled)
|
|||
if (NS_FAILED(res)) return res;
|
||||
*outHandled = PR_TRUE;
|
||||
// put selection in right place
|
||||
// Use table code to get selection and index to new row...
|
||||
nsCOMPtr<nsIDOMSelection>selection;
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
nsCOMPtr<nsIDOMElement> tbl;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, row, column;
|
||||
// leveraging charlie's table code: find where row is....
|
||||
res = GetCellContext(selection, tbl, cell, cellParent, cellOffset, row, column);
|
||||
PRInt32 row;
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(tbl),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&row, nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// so that we can ask for first cell in that row...
|
||||
// ...so that we can ask for first cell in that row...
|
||||
res = GetCellAt(tbl, row, 0, *(getter_AddRefs(cell)));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// and then set selection there.
|
||||
// ...and then set selection there.
|
||||
// (Note that normally you should use CollapseSelectionToDeepestNonTableFirstChild(),
|
||||
// but we know cell is an empty new cell, so this works fine)
|
||||
node = do_QueryInterface(cell);
|
||||
if (node) selection->Collapse(node,0);
|
||||
return NS_OK;
|
||||
|
@ -4939,7 +4942,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToStream(nsIOutputStream* aOutputStream,
|
|||
return encoder->EncodeToStream(aOutputStream);
|
||||
}
|
||||
|
||||
static SetSelectionAroundHeadChildren(nsCOMPtr<nsIDOMSelection> aSelection, nsWeakPtr aDocWeak)
|
||||
static nsresult SetSelectionAroundHeadChildren(nsCOMPtr<nsIDOMSelection> aSelection, nsWeakPtr aDocWeak)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
// Set selection around <head> node
|
||||
|
|
|
@ -379,7 +379,11 @@ protected:
|
|||
// This doesn't change or use the current selection
|
||||
NS_IMETHOD InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpan,
|
||||
PRBool aAfter, nsIDOMElement **aNewCell);
|
||||
NS_IMETHOD DeleteTable(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection);
|
||||
|
||||
// Move all contents from aCellToMerge into aTargetCell (append at end)
|
||||
NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, PRBool aDeleteCellToMerge);
|
||||
|
||||
NS_IMETHOD DeleteTable2(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection);
|
||||
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan);
|
||||
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan);
|
||||
|
||||
|
@ -393,10 +397,15 @@ protected:
|
|||
PRBool AllCellsInColumnSelected(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32 aNumberOfRows);
|
||||
|
||||
// Most insert methods need to get the same basic context data
|
||||
NS_IMETHOD GetCellContext(nsCOMPtr<nsIDOMSelection> &aSelection,
|
||||
nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMElement> &aCell,
|
||||
nsCOMPtr<nsIDOMNode> &aCellParent, PRInt32& aCellOffset,
|
||||
PRInt32& aRow, PRInt32& aCol);
|
||||
// Any of the pointers may be null if you don't need that datum (for more efficiency)
|
||||
// Input: *aCell is a known cell,
|
||||
// if null, cell is obtained from the anchor node of the selection
|
||||
// Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
|
||||
NS_IMETHOD GetCellContext(nsIDOMSelection **aSelection,
|
||||
nsIDOMElement **aTable,
|
||||
nsIDOMElement **aCell,
|
||||
nsIDOMNode **aCellParent, PRInt32 *aCellOffset,
|
||||
PRInt32 *aRowIndex, PRInt32 *aColIndex);
|
||||
|
||||
// Fallback method: Call this after using ClearSelection() and you
|
||||
// failed to set selection to some other content in the document
|
||||
|
|
|
@ -185,12 +185,15 @@ NS_IMETHODIMP nsHTMLEditor::SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
|
||||
{
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> curCell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, curCell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
nsresult res = GetCellContext(nsnull,
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(curCell),
|
||||
getter_AddRefs(cellParent), &cellOffset,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!curCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -356,9 +359,12 @@ nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> curCell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, curCell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(curCell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!curCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -467,9 +473,12 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> curCell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, curCell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(nsnull,
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(curCell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!curCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -611,7 +620,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
|||
|
||||
// Editor helper only
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteTable(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection)
|
||||
nsHTMLEditor::DeleteTable2(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> tableParent;
|
||||
PRInt32 tableOffset;
|
||||
|
@ -635,15 +644,14 @@ nsHTMLEditor::DeleteTable()
|
|||
{
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
nsresult res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
nsnull, nsnull, nsnull, nsnull, nsnull);
|
||||
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
res = DeleteTable(table, selection);
|
||||
res = DeleteTable2(table, selection);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -654,8 +662,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
|
||||
nsresult res = nsEditor::GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -665,7 +672,11 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
|||
|
||||
for (PRInt32 i = 0; i < aNumber; i++)
|
||||
{
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -685,7 +696,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (rowCount == 1)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
// We need to call DeleteTableRow to handle cells with rowspan
|
||||
res = DeleteTableRow(1);
|
||||
|
@ -715,11 +726,14 @@ nsHTMLEditor::DeleteTableCellContents()
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -759,12 +773,15 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -774,7 +791,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
|||
|
||||
// Shortcut the case of deleting all columns in table
|
||||
if(startColIndex == 0 && aNumber >= colCount)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
|
||||
|
@ -839,7 +856,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (rowCount == 1)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
// Delete the row by placing caret in cell we were to delete
|
||||
// We need to call DeleteTableRow to handle cells with rowspan
|
||||
|
@ -876,12 +893,15 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -891,7 +911,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
|||
|
||||
// Shortcut the case of deleting all rows in table
|
||||
if(startRowIndex == 0 && aNumber >= rowCount)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
|
||||
|
@ -1049,6 +1069,7 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
|||
nsCOMPtr<nsIDOMRange> range;
|
||||
res = GetFirstSelectedCell(getter_AddRefs(cell), getter_AddRefs(range));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (res == NS_EDITOR_ELEMENT_NOT_FOUND) return NS_OK;
|
||||
|
||||
while (cell)
|
||||
{
|
||||
|
@ -1102,20 +1123,21 @@ nsHTMLEditor::SelectAllTableCells()
|
|||
if (!cellNode) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMElement> startCell = cell;
|
||||
|
||||
// Get location of cell:
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
// Get parent table
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
if(!table) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
res = nsEditor::GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
// Suppress nsIDOMSelectionListener notification
|
||||
// until all selection changes are finished
|
||||
nsSelectionBatcher selectionBatcher(selection);
|
||||
|
@ -1169,16 +1191,19 @@ nsHTMLEditor::SelectTableRow()
|
|||
nsCOMPtr<nsIDOMNode> cellNode = do_QueryInterface(cell);
|
||||
if (!cellNode) return NS_ERROR_FAILURE;
|
||||
|
||||
// Get location of cell:
|
||||
// Get table and location of cell:
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -1240,12 +1265,15 @@ nsHTMLEditor::SelectTableColumn()
|
|||
// Get location of cell:
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
|
@ -1290,88 +1318,118 @@ nsHTMLEditor::SelectTableColumn()
|
|||
NS_IMETHODIMP
|
||||
nsHTMLEditor::JoinTableCells()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
nsCOMPtr<nsIDOMElement> targetCell;
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, *getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
//*** Initial test: just merge with cell to the right
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cell2;
|
||||
PRInt32 startRowIndex2, startColIndex2, rowSpan2, colSpan2, actualRowSpan2, actualColSpan2;
|
||||
PRBool isSelected2;
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex+actualColSpan, *getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
|
||||
// Get cell and table at selection anchor node (and other data)
|
||||
nsresult res = GetCellContext(nsnull,
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(targetCell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if(!table || !targetCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// We need rowspan and colspan data
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, *getter_AddRefs(targetCell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!targetCell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> firstCell;
|
||||
res = GetFirstSelectedCell(getter_AddRefs(firstCell), nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
//We reset caret in destructor...
|
||||
nsSetCaretAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn);
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
//Don't let Rules System change the selection
|
||||
nsAutoTxnsConserveSelection dontChangeSelection(this);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode = do_QueryInterface(cellParent);
|
||||
nsCOMPtr<nsIDOMNode> cellNode = do_QueryInterface(cell);
|
||||
nsCOMPtr<nsIDOMNode> cellNode2 = do_QueryInterface(cell2);
|
||||
if(cellNode && cellNode2 && parentNode)
|
||||
if (firstCell)
|
||||
{
|
||||
PRInt32 insertIndex = 0;
|
||||
|
||||
// Get index of last child in target cell
|
||||
nsCOMPtr<nsIDOMNodeList> childNodes;
|
||||
res = cellNode->GetChildNodes(getter_AddRefs(childNodes));
|
||||
if ((NS_SUCCEEDED(res)) && (childNodes))
|
||||
{
|
||||
// Start inserting just after last child
|
||||
PRUint32 len;
|
||||
res = childNodes->GetLength(&len);
|
||||
if (NS_FAILED(res)) return res;
|
||||
insertIndex = (PRInt32)len;
|
||||
}
|
||||
|
||||
// Move content from cell2 to cell
|
||||
nsCOMPtr<nsIDOMNode> cellChild;
|
||||
res = cell2->GetFirstChild(getter_AddRefs(cellChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
while (cellChild)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> nextChild;
|
||||
res = cellChild->GetNextSibling(getter_AddRefs(nextChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = DeleteNode(cellChild);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = nsEditor::InsertNode(cellChild, cellNode, insertIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
cellChild = nextChild;
|
||||
insertIndex++;
|
||||
}
|
||||
// Reset target cell's spans
|
||||
res = SetColSpan(cell, actualColSpan+actualColSpan2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Delete cells whose contents were moved
|
||||
res = DeleteNode(cell2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Merge selected cells
|
||||
}
|
||||
else
|
||||
{
|
||||
// Merge with cell to the right
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex+actualColSpan, *getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell2) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Move contents and delete cell to the right
|
||||
res = MergeCells(targetCell, cell2, PR_TRUE);
|
||||
|
||||
// Reset target cell's spans
|
||||
res = SetColSpan(targetCell, actualColSpan+actualColSpan2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell,
|
||||
nsCOMPtr<nsIDOMElement> aCellToMerge,
|
||||
PRBool aDeleteCellToMerge)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> targetCell = do_QueryInterface(aTargetCell);
|
||||
nsCOMPtr<nsIDOMNode> cellToMerge = do_QueryInterface(aCellToMerge);
|
||||
if(!targetCell || !cellToMerge) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
// Get index of last child in target cell
|
||||
nsCOMPtr<nsIDOMNodeList> childNodes;
|
||||
res = targetCell->GetChildNodes(getter_AddRefs(childNodes));
|
||||
// If we fail or don't have children,
|
||||
// we insert at index 0
|
||||
PRInt32 insertIndex = 0;
|
||||
|
||||
if ((NS_SUCCEEDED(res)) && (childNodes))
|
||||
{
|
||||
// Start inserting just after last child
|
||||
PRUint32 len;
|
||||
res = childNodes->GetLength(&len);
|
||||
if (NS_FAILED(res)) return res;
|
||||
insertIndex = (PRInt32)len;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> cellChild;
|
||||
res = cellToMerge->GetFirstChild(getter_AddRefs(cellChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
while (cellChild)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> nextChild;
|
||||
res = cellChild->GetNextSibling(getter_AddRefs(nextChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = nsEditor::DeleteNode(cellChild);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = nsEditor::InsertNode(cellChild, targetCell, insertIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
cellChild = nextChild;
|
||||
insertIndex++;
|
||||
}
|
||||
|
||||
// Delete cells whose contents were moved
|
||||
if (aDeleteCellToMerge)
|
||||
res = DeleteNode(cellToMerge);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1647,38 +1705,92 @@ nsHTMLEditor::GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIn
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellContext(nsCOMPtr<nsIDOMSelection> &aSelection,
|
||||
nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMElement> &aCell,
|
||||
nsCOMPtr<nsIDOMNode> &aCellParent, PRInt32& aCellOffset,
|
||||
PRInt32& aRow, PRInt32& aCol)
|
||||
nsHTMLEditor::GetCellContext(nsIDOMSelection **aSelection,
|
||||
nsIDOMElement **aTable,
|
||||
nsIDOMElement **aCell,
|
||||
nsIDOMNode **aCellParent, PRInt32 *aCellOffset,
|
||||
PRInt32 *aRowIndex, PRInt32 *aColIndex)
|
||||
{
|
||||
nsresult res = nsEditor::GetSelection(getter_AddRefs(aSelection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aSelection) return NS_ERROR_FAILURE;
|
||||
// Initialize return pointers
|
||||
if (aSelection) *aSelection = nsnull;
|
||||
if (aTable) *aTable = nsnull;
|
||||
if (aCell) *aCell = nsnull;
|
||||
if (aCellParent) *aCellParent = nsnull;
|
||||
if (aCellOffset) *aCellOffset = 0;
|
||||
if (aRowIndex) *aRowIndex = 0;
|
||||
if (aColIndex) *aColIndex = 0;
|
||||
|
||||
if (!aCell)
|
||||
nsCOMPtr <nsIDOMSelection> selection;
|
||||
nsresult res = nsEditor::GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aSelection)
|
||||
{
|
||||
// Get cell if it's the child of selection anchor node,
|
||||
// or get the enclosing by a cell
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(aCell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aCell) return NS_ERROR_FAILURE;
|
||||
*aSelection = selection.get();
|
||||
NS_ADDREF(*aSelection);
|
||||
}
|
||||
// Get containing table and the immediate parent of the cell
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aCell, getter_AddRefs(aTable));
|
||||
nsCOMPtr <nsIDOMElement> table;
|
||||
nsCOMPtr <nsIDOMElement> cell;
|
||||
|
||||
// Caller may supply the cell...
|
||||
if (aCell && *aCell)
|
||||
cell = *aCell;
|
||||
|
||||
// ...but if not supplied,
|
||||
// get cell if it's the child of selection anchor node,
|
||||
// or get the enclosing by a cell
|
||||
if (!cell)
|
||||
{
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we are not in a cell
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
}
|
||||
if (aCell)
|
||||
{
|
||||
*aCell = cell.get();
|
||||
NS_ADDREF(*aCell);
|
||||
}
|
||||
|
||||
// Get containing table
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aTable) return NS_ERROR_FAILURE;
|
||||
// Cell must be in a table, so fail if not found
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
if (aTable)
|
||||
{
|
||||
*aTable = table.get();
|
||||
NS_ADDREF(*aTable);
|
||||
}
|
||||
|
||||
res = aCell->GetParentNode(getter_AddRefs(aCellParent));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aCellParent) return NS_ERROR_FAILURE;
|
||||
// Get the rest of the related data only if requested
|
||||
if (aRowIndex || aColIndex)
|
||||
{
|
||||
PRInt32 rowIndex, colIndex;
|
||||
// Get current cell location so we can put caret back there when done
|
||||
res = GetCellIndexes(cell, rowIndex, colIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
if (aRowIndex) *aRowIndex = rowIndex;
|
||||
if (aColIndex) *aColIndex = colIndex;
|
||||
}
|
||||
if (aCellParent)
|
||||
{
|
||||
nsCOMPtr <nsIDOMNode> cellParent;
|
||||
// Get the immediate parent of the cell
|
||||
res = cell->GetParentNode(getter_AddRefs(cellParent));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Cell has to have a parent, so fail if not found
|
||||
if (!cellParent) return NS_ERROR_FAILURE;
|
||||
|
||||
// Get current cell location so we can put caret back there when done
|
||||
res = GetCellIndexes(aCell, aRow, aCol);
|
||||
if(NS_FAILED(res)) return res;
|
||||
*aCellParent = cellParent.get();
|
||||
NS_ADDREF(*aCellParent);
|
||||
|
||||
// And the parent and offsets needed to do an insert
|
||||
return GetChildOffset(aCell, aCellParent, aCellOffset);
|
||||
if (aCellOffset)
|
||||
res = GetChildOffset(cell, cellParent, *aCellOffset);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1698,10 +1810,14 @@ nsHTMLEditor::GetFirstSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange)
|
|||
if (NS_FAILED(res)) return res;
|
||||
if (!range) return NS_ERROR_FAILURE;
|
||||
|
||||
mSelectedCellIndex = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> cellNode;
|
||||
res = GetFirstNodeInRange(range, getter_AddRefs(cellNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cellNode) return NS_ERROR_FAILURE;
|
||||
// Failure here means selection is in a text node,
|
||||
// so there's no selected cell
|
||||
if (NS_FAILED(res)) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
if (!cellNode) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
if (IsTableCell(cellNode))
|
||||
{
|
||||
|
@ -1715,7 +1831,7 @@ nsHTMLEditor::GetFirstSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange)
|
|||
}
|
||||
}
|
||||
else
|
||||
res = NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
// Setup for next cell
|
||||
mSelectedCellIndex = 1;
|
||||
|
@ -1975,10 +2091,10 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Traverse all selected cells
|
||||
// (Failure here may indicate that aCellElement wasn't really a cell)
|
||||
nsCOMPtr<nsIDOMElement> selectedCell;
|
||||
res = GetFirstSelectedCell(getter_AddRefs(selectedCell), nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (res == NS_EDITOR_ELEMENT_NOT_FOUND) return NS_OK;
|
||||
|
||||
// We have at least one selected cell, so set return value
|
||||
aSelectionType = TABLESELECTION_CELL;
|
||||
|
|
|
@ -227,7 +227,10 @@ nsEditorShell::nsEditorShell()
|
|||
, mWrapColumn(0)
|
||||
, mSuggestedWordIndex(0)
|
||||
, mDictionaryIndex(0)
|
||||
, mDisplayMode(eDisplayModeNormal)
|
||||
, mMailCompose(0)
|
||||
{
|
||||
//TODO:Save last-used display mode in prefs so new window inherits?
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
@ -424,7 +427,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
aUrl->GetSpec(&pageURLString);
|
||||
|
||||
#if DEBUG
|
||||
printf("Editor is editing %s\n", pageURLString ? pageURLString : "");
|
||||
printf("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : "");
|
||||
#endif
|
||||
|
||||
// only save the file spec if this is a local file, and is not
|
||||
|
@ -432,6 +435,8 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
if (nsCRT::strncmp(pageScheme, "file", 4) == 0 &&
|
||||
nsCRT::strncmp(pageURLString,"about:blank", 11) != 0)
|
||||
{
|
||||
// Clutzy method of converting URL to local file format
|
||||
// nsIFileSpec is going away -- is nsFileSpec???
|
||||
nsFileURL pageURL(pageURLString);
|
||||
nsFileSpec pageSpec(pageURL);
|
||||
|
||||
|
@ -460,11 +465,12 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
// Load style sheet with settings that should never
|
||||
// change, even in "Browser" mode
|
||||
// We won't unload this, so we don't need to be returned the style sheet pointer
|
||||
styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorOverride.css"), nsnull);
|
||||
|
||||
|
||||
styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorOverride.css"),
|
||||
getter_AddRefs(mBaseStyleSheet));
|
||||
|
||||
// Load the edit mode override style sheet
|
||||
// This will be remove for "Browser" mode
|
||||
SetDisplayMode(eDisplayModeNormal);
|
||||
SetDisplayMode(mDisplayMode);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Activate the debug menu only in debug builds
|
||||
|
@ -475,8 +481,15 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
|
|||
elem->RemoveAttribute(NS_ConvertASCIItoUCS2("hidden"));
|
||||
#endif
|
||||
|
||||
// Force initial focus to the content window -- HOW?
|
||||
// mWebShellWin->SetFocus();
|
||||
// Force initial focus to the content window except if in mail compose
|
||||
if (!mMailCompose)
|
||||
{
|
||||
mContentWindow->Focus();
|
||||
// turn on caret
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
editor->GetSelectionController(getter_AddRefs(selCon));
|
||||
if (selCon) selCon->SetCaretEnabled(PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -607,9 +620,17 @@ nsEditorShell::SetEditorType(const PRUnichar *editorType)
|
|||
|
||||
nsAutoString theType = editorType;
|
||||
theType.ToLowerCase();
|
||||
if (theType.EqualsWithConversion("text") || theType.EqualsWithConversion("html") || theType.IsEmpty() || theType.EqualsWithConversion("htmlmail"))
|
||||
|
||||
PRBool textMail = theType.EqualsWithConversion("textmail");
|
||||
mMailCompose = theType.EqualsWithConversion("htmlmail") || textMail;
|
||||
|
||||
if (mMailCompose ||theType.EqualsWithConversion("text") || theType.EqualsWithConversion("html") || theType.IsEmpty())
|
||||
{
|
||||
mEditorTypeString = theType;
|
||||
// We don't store a separate type for textmail
|
||||
if (textMail)
|
||||
mEditorTypeString = NS_ConvertASCIItoUCS2("text");
|
||||
else
|
||||
mEditorTypeString = theType;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
|
@ -1003,10 +1024,18 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
|
|||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aDisplayMode == eDisplayModeSource && mDisplayMode == eDisplayModeSource)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString indexVal = NS_ConvertASCIItoUCS2((aDisplayMode == eDisplayModeSource) ? "1" : "0");
|
||||
SetChromeAttribute( mDocShell, "ContentWindowDeck", "index", indexVal );
|
||||
|
||||
nsCOMPtr<nsIEditorStyleSheets> styleSheets = do_QueryInterface(mEditor);
|
||||
if (!styleSheets) return NS_NOINTERFACE;
|
||||
|
||||
if (aDisplayMode == eDisplayModeWYSIWYG)
|
||||
mDisplayMode = aDisplayMode;
|
||||
|
||||
if (aDisplayMode == eDisplayModePreview)
|
||||
{
|
||||
// Remove all extra "edit mode" style sheets
|
||||
if (mEditModeStyleSheet)
|
||||
|
@ -1033,14 +1062,8 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
|
|||
if (mEditModeStyleSheet) return NS_OK;
|
||||
|
||||
//Load the editmode style sheet
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mEditModeStyleSheet = styleSheet;
|
||||
return res;
|
||||
return styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(mEditModeStyleSheet));
|
||||
}
|
||||
else if (aDisplayMode == eDisplayModeAllTags)
|
||||
{
|
||||
|
@ -1052,26 +1075,13 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
|
|||
{
|
||||
// Note: using "@import url(chrome://editor/content/EditorContent.css);"
|
||||
// in EditorAllTags.css doesn't seem to work!?
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mEditModeStyleSheet = styleSheet;
|
||||
styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
|
||||
getter_AddRefs(mEditModeStyleSheet));
|
||||
}
|
||||
|
||||
//Load the editmode style sheet
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorAllTags.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mAllTagsModeStyleSheet = styleSheet;
|
||||
return res;
|
||||
return styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorAllTags.css"),
|
||||
getter_AddRefs(mAllTagsModeStyleSheet));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1091,11 +1101,7 @@ nsEditorShell::DisplayParagraphMarks(PRBool aShowMarks)
|
|||
//Load the style sheet
|
||||
nsCOMPtr<nsICSSStyleSheet> styleSheet;
|
||||
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorParagraphMarks.css"),
|
||||
getter_AddRefs(styleSheet));
|
||||
|
||||
// Save the returned style sheet so we can remove it later
|
||||
if (NS_SUCCEEDED(res))
|
||||
mParagraphMarksStyleSheet = styleSheet;
|
||||
getter_AddRefs(mParagraphMarksStyleSheet));
|
||||
}
|
||||
else if (mParagraphMarksStyleSheet)
|
||||
{
|
||||
|
@ -1130,13 +1136,39 @@ nsEditorShell::SetBodyAttribute(const PRUnichar *attr, const PRUnichar *value)
|
|||
NS_IMETHODIMP
|
||||
nsEditorShell::LoadUrl(const PRUnichar *url)
|
||||
{
|
||||
if(!mContentAreaDocShell)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
if(!mContentAreaDocShell || !mEditor)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mContentAreaDocShell));
|
||||
NS_ENSURE_SUCCESS(webNav->LoadURI(url), NS_ERROR_FAILURE);
|
||||
// Always unload all the override style sheets before loading
|
||||
// a url in case we're replacing an existing document that used them
|
||||
nsCOMPtr<nsIEditorStyleSheets> styleSheets = do_QueryInterface(mEditor);
|
||||
if (!styleSheets) return NS_NOINTERFACE;
|
||||
|
||||
return NS_OK;
|
||||
if (mBaseStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mBaseStyleSheet);
|
||||
mBaseStyleSheet = nsnull;
|
||||
}
|
||||
if (mEditModeStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mEditModeStyleSheet);
|
||||
mEditModeStyleSheet = nsnull;
|
||||
}
|
||||
if (mAllTagsModeStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mAllTagsModeStyleSheet);
|
||||
mAllTagsModeStyleSheet = nsnull;
|
||||
}
|
||||
if (mParagraphMarksStyleSheet)
|
||||
{
|
||||
styleSheets->RemoveOverrideStyleSheet(mParagraphMarksStyleSheet);
|
||||
mParagraphMarksStyleSheet = nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mContentAreaDocShell));
|
||||
NS_ENSURE_SUCCESS(webNav->LoadURI(url), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3105,6 +3137,9 @@ nsEditorShell::GetSelectedElement(const PRUnichar *aInTagName, nsIDOMElement **a
|
|||
{
|
||||
case eHTMLTextEditorType:
|
||||
result = mEditor->GetSelectedElement(tagName, aOutElement);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
break;
|
||||
|
||||
case ePlainTextEditorType:
|
||||
|
@ -3129,7 +3164,13 @@ nsEditorShell::GetFirstSelectedCell(nsIDOMElement **aOutElement)
|
|||
{
|
||||
nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(mEditor);
|
||||
if (tableEditor)
|
||||
{
|
||||
result = tableEditor->GetFirstSelectedCell(aOutElement, nsnull);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3182,6 +3223,9 @@ nsEditorShell::GetElementOrParentByTagName(const PRUnichar *aInTagName, nsIDOMNo
|
|||
{
|
||||
case eHTMLTextEditorType:
|
||||
result = mEditor->GetElementOrParentByTagName(tagName, node, aOutElement);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
break;
|
||||
|
||||
case ePlainTextEditorType:
|
||||
|
@ -3765,7 +3809,12 @@ nsEditorShell::GetCellAt(nsIDOMElement *tableElement, PRInt32 rowIndex, PRInt32
|
|||
{
|
||||
nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(mEditor);
|
||||
if (tableEditor)
|
||||
{
|
||||
result = tableEditor->GetCellAt(tableElement, rowIndex, colIndex, *_retval);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -145,6 +145,8 @@ class nsEditorShell : public nsIEditorShell,
|
|||
nsCOMPtr<nsISupports> mSearchContext; // context used for search and replace. Owned by the appshell.
|
||||
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
||||
|
||||
PRBool mMailCompose;
|
||||
|
||||
// this is a holding pen for doc state listeners. They will be registered with
|
||||
// the editor when that gets created.
|
||||
nsCOMPtr<nsISupportsArray> mDocStateListeners; // contents are nsISupports
|
||||
|
@ -157,6 +159,13 @@ class nsEditorShell : public nsIEditorShell,
|
|||
nsCOMPtr<nsICSSStyleSheet> mEditModeStyleSheet;
|
||||
nsCOMPtr<nsICSSStyleSheet> mAllTagsModeStyleSheet;
|
||||
nsCOMPtr<nsICSSStyleSheet> mParagraphMarksStyleSheet;
|
||||
|
||||
// The override style sheet that we never unload while editing
|
||||
nsCOMPtr<nsICSSStyleSheet> mBaseStyleSheet;
|
||||
|
||||
// Saves the current display mode to reload style sheets
|
||||
// after loading a url
|
||||
PRInt32 mDisplayMode;
|
||||
|
||||
nsIDOMWindow *mWebShellWindow; // weak reference
|
||||
nsIDOMWindow *mContentWindow; // weak reference
|
||||
|
|
|
@ -60,9 +60,10 @@ interface nsIEditorShell : nsISupports
|
|||
};
|
||||
|
||||
enum {
|
||||
eDisplayModeWYSIWYG,
|
||||
eDisplayModePreview,
|
||||
eDisplayModeNormal,
|
||||
eDisplayModeAllTags
|
||||
eDisplayModeAllTags,
|
||||
eDisplayModeSource
|
||||
};
|
||||
%}
|
||||
readonly attribute boolean documentModified;
|
||||
|
@ -451,8 +452,8 @@ interface nsIEditorShell : nsISupports
|
|||
* (from override styles in EditorAllTags.css)
|
||||
* to show icon for every HTML tag
|
||||
*/
|
||||
void SetDisplayMode(in PRInt32 displayMode);
|
||||
|
||||
void SetDisplayMode(in PRInt32 displayMode);
|
||||
|
||||
/** Add/remove an overridestyle sheet to show paragraph marks
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -848,20 +848,23 @@ NS_IMETHODIMP nsHTMLEditor::TabInTable(PRBool inIsShift, PRBool *outHandled)
|
|||
if (NS_FAILED(res)) return res;
|
||||
*outHandled = PR_TRUE;
|
||||
// put selection in right place
|
||||
// Use table code to get selection and index to new row...
|
||||
nsCOMPtr<nsIDOMSelection>selection;
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
nsCOMPtr<nsIDOMElement> tbl;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, row, column;
|
||||
// leveraging charlie's table code: find where row is....
|
||||
res = GetCellContext(selection, tbl, cell, cellParent, cellOffset, row, column);
|
||||
PRInt32 row;
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(tbl),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&row, nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// so that we can ask for first cell in that row...
|
||||
// ...so that we can ask for first cell in that row...
|
||||
res = GetCellAt(tbl, row, 0, *(getter_AddRefs(cell)));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// and then set selection there.
|
||||
// ...and then set selection there.
|
||||
// (Note that normally you should use CollapseSelectionToDeepestNonTableFirstChild(),
|
||||
// but we know cell is an empty new cell, so this works fine)
|
||||
node = do_QueryInterface(cell);
|
||||
if (node) selection->Collapse(node,0);
|
||||
return NS_OK;
|
||||
|
@ -4939,7 +4942,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToStream(nsIOutputStream* aOutputStream,
|
|||
return encoder->EncodeToStream(aOutputStream);
|
||||
}
|
||||
|
||||
static SetSelectionAroundHeadChildren(nsCOMPtr<nsIDOMSelection> aSelection, nsWeakPtr aDocWeak)
|
||||
static nsresult SetSelectionAroundHeadChildren(nsCOMPtr<nsIDOMSelection> aSelection, nsWeakPtr aDocWeak)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
// Set selection around <head> node
|
||||
|
|
|
@ -379,7 +379,11 @@ protected:
|
|||
// This doesn't change or use the current selection
|
||||
NS_IMETHOD InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpan,
|
||||
PRBool aAfter, nsIDOMElement **aNewCell);
|
||||
NS_IMETHOD DeleteTable(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection);
|
||||
|
||||
// Move all contents from aCellToMerge into aTargetCell (append at end)
|
||||
NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, PRBool aDeleteCellToMerge);
|
||||
|
||||
NS_IMETHOD DeleteTable2(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection);
|
||||
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan);
|
||||
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan);
|
||||
|
||||
|
@ -393,10 +397,15 @@ protected:
|
|||
PRBool AllCellsInColumnSelected(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32 aNumberOfRows);
|
||||
|
||||
// Most insert methods need to get the same basic context data
|
||||
NS_IMETHOD GetCellContext(nsCOMPtr<nsIDOMSelection> &aSelection,
|
||||
nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMElement> &aCell,
|
||||
nsCOMPtr<nsIDOMNode> &aCellParent, PRInt32& aCellOffset,
|
||||
PRInt32& aRow, PRInt32& aCol);
|
||||
// Any of the pointers may be null if you don't need that datum (for more efficiency)
|
||||
// Input: *aCell is a known cell,
|
||||
// if null, cell is obtained from the anchor node of the selection
|
||||
// Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
|
||||
NS_IMETHOD GetCellContext(nsIDOMSelection **aSelection,
|
||||
nsIDOMElement **aTable,
|
||||
nsIDOMElement **aCell,
|
||||
nsIDOMNode **aCellParent, PRInt32 *aCellOffset,
|
||||
PRInt32 *aRowIndex, PRInt32 *aColIndex);
|
||||
|
||||
// Fallback method: Call this after using ClearSelection() and you
|
||||
// failed to set selection to some other content in the document
|
||||
|
|
|
@ -185,12 +185,15 @@ NS_IMETHODIMP nsHTMLEditor::SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
|
||||
{
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> curCell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, curCell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
nsresult res = GetCellContext(nsnull,
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(curCell),
|
||||
getter_AddRefs(cellParent), &cellOffset,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!curCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -356,9 +359,12 @@ nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> curCell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, curCell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(curCell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!curCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -467,9 +473,12 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> curCell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, curCell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(nsnull,
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(curCell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!curCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -611,7 +620,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
|||
|
||||
// Editor helper only
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteTable(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection)
|
||||
nsHTMLEditor::DeleteTable2(nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMSelection> &aSelection)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> tableParent;
|
||||
PRInt32 tableOffset;
|
||||
|
@ -635,15 +644,14 @@ nsHTMLEditor::DeleteTable()
|
|||
{
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
nsresult res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
nsresult res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
nsnull, nsnull, nsnull, nsnull, nsnull);
|
||||
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
res = DeleteTable(table, selection);
|
||||
res = DeleteTable2(table, selection);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -654,8 +662,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
|
||||
nsresult res = nsEditor::GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -665,7 +672,11 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
|||
|
||||
for (PRInt32 i = 0; i < aNumber; i++)
|
||||
{
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -685,7 +696,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (rowCount == 1)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
// We need to call DeleteTableRow to handle cells with rowspan
|
||||
res = DeleteTableRow(1);
|
||||
|
@ -715,11 +726,14 @@ nsHTMLEditor::DeleteTableCellContents()
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -759,12 +773,15 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -774,7 +791,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
|||
|
||||
// Shortcut the case of deleting all columns in table
|
||||
if(startColIndex == 0 && aNumber >= colCount)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
|
||||
|
@ -839,7 +856,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (rowCount == 1)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
// Delete the row by placing caret in cell we were to delete
|
||||
// We need to call DeleteTableRow to handle cells with rowspan
|
||||
|
@ -876,12 +893,15 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
|||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
@ -891,7 +911,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
|||
|
||||
// Shortcut the case of deleting all rows in table
|
||||
if(startRowIndex == 0 && aNumber >= rowCount)
|
||||
return DeleteTable(table, selection);
|
||||
return DeleteTable2(table, selection);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
|
||||
|
@ -1049,6 +1069,7 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
|||
nsCOMPtr<nsIDOMRange> range;
|
||||
res = GetFirstSelectedCell(getter_AddRefs(cell), getter_AddRefs(range));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (res == NS_EDITOR_ELEMENT_NOT_FOUND) return NS_OK;
|
||||
|
||||
while (cell)
|
||||
{
|
||||
|
@ -1102,20 +1123,21 @@ nsHTMLEditor::SelectAllTableCells()
|
|||
if (!cellNode) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMElement> startCell = cell;
|
||||
|
||||
// Get location of cell:
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
// Get parent table
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
if(!table) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
res = nsEditor::GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
// Suppress nsIDOMSelectionListener notification
|
||||
// until all selection changes are finished
|
||||
nsSelectionBatcher selectionBatcher(selection);
|
||||
|
@ -1169,16 +1191,19 @@ nsHTMLEditor::SelectTableRow()
|
|||
nsCOMPtr<nsIDOMNode> cellNode = do_QueryInterface(cell);
|
||||
if (!cellNode) return NS_ERROR_FAILURE;
|
||||
|
||||
// Get location of cell:
|
||||
// Get table and location of cell:
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -1240,12 +1265,15 @@ nsHTMLEditor::SelectTableColumn()
|
|||
// Get location of cell:
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex;
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
res = GetCellContext(getter_AddRefs(selection),
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(cell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
|
@ -1290,88 +1318,118 @@ nsHTMLEditor::SelectTableColumn()
|
|||
NS_IMETHODIMP
|
||||
nsHTMLEditor::JoinTableCells()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsCOMPtr<nsIDOMNode> cellParent;
|
||||
PRInt32 cellOffset, startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
nsCOMPtr<nsIDOMElement> targetCell;
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = GetCellContext(selection, table, cell, cellParent, cellOffset, startRowIndex, startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, *getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
//*** Initial test: just merge with cell to the right
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cell2;
|
||||
PRInt32 startRowIndex2, startColIndex2, rowSpan2, colSpan2, actualRowSpan2, actualColSpan2;
|
||||
PRBool isSelected2;
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex+actualColSpan, *getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
|
||||
// Get cell and table at selection anchor node (and other data)
|
||||
nsresult res = GetCellContext(nsnull,
|
||||
getter_AddRefs(table),
|
||||
getter_AddRefs(targetCell),
|
||||
nsnull, nsnull,
|
||||
&startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if(!table || !targetCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// We need rowspan and colspan data
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, *getter_AddRefs(targetCell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!targetCell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> firstCell;
|
||||
res = GetFirstSelectedCell(getter_AddRefs(firstCell), nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
//We reset caret in destructor...
|
||||
nsSetCaretAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn);
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
//Don't let Rules System change the selection
|
||||
nsAutoTxnsConserveSelection dontChangeSelection(this);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode = do_QueryInterface(cellParent);
|
||||
nsCOMPtr<nsIDOMNode> cellNode = do_QueryInterface(cell);
|
||||
nsCOMPtr<nsIDOMNode> cellNode2 = do_QueryInterface(cell2);
|
||||
if(cellNode && cellNode2 && parentNode)
|
||||
if (firstCell)
|
||||
{
|
||||
PRInt32 insertIndex = 0;
|
||||
|
||||
// Get index of last child in target cell
|
||||
nsCOMPtr<nsIDOMNodeList> childNodes;
|
||||
res = cellNode->GetChildNodes(getter_AddRefs(childNodes));
|
||||
if ((NS_SUCCEEDED(res)) && (childNodes))
|
||||
{
|
||||
// Start inserting just after last child
|
||||
PRUint32 len;
|
||||
res = childNodes->GetLength(&len);
|
||||
if (NS_FAILED(res)) return res;
|
||||
insertIndex = (PRInt32)len;
|
||||
}
|
||||
|
||||
// Move content from cell2 to cell
|
||||
nsCOMPtr<nsIDOMNode> cellChild;
|
||||
res = cell2->GetFirstChild(getter_AddRefs(cellChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
while (cellChild)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> nextChild;
|
||||
res = cellChild->GetNextSibling(getter_AddRefs(nextChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = DeleteNode(cellChild);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = nsEditor::InsertNode(cellChild, cellNode, insertIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
cellChild = nextChild;
|
||||
insertIndex++;
|
||||
}
|
||||
// Reset target cell's spans
|
||||
res = SetColSpan(cell, actualColSpan+actualColSpan2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Delete cells whose contents were moved
|
||||
res = DeleteNode(cell2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Merge selected cells
|
||||
}
|
||||
else
|
||||
{
|
||||
// Merge with cell to the right
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex+actualColSpan, *getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell2) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Move contents and delete cell to the right
|
||||
res = MergeCells(targetCell, cell2, PR_TRUE);
|
||||
|
||||
// Reset target cell's spans
|
||||
res = SetColSpan(targetCell, actualColSpan+actualColSpan2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell,
|
||||
nsCOMPtr<nsIDOMElement> aCellToMerge,
|
||||
PRBool aDeleteCellToMerge)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> targetCell = do_QueryInterface(aTargetCell);
|
||||
nsCOMPtr<nsIDOMNode> cellToMerge = do_QueryInterface(aCellToMerge);
|
||||
if(!targetCell || !cellToMerge) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
// Get index of last child in target cell
|
||||
nsCOMPtr<nsIDOMNodeList> childNodes;
|
||||
res = targetCell->GetChildNodes(getter_AddRefs(childNodes));
|
||||
// If we fail or don't have children,
|
||||
// we insert at index 0
|
||||
PRInt32 insertIndex = 0;
|
||||
|
||||
if ((NS_SUCCEEDED(res)) && (childNodes))
|
||||
{
|
||||
// Start inserting just after last child
|
||||
PRUint32 len;
|
||||
res = childNodes->GetLength(&len);
|
||||
if (NS_FAILED(res)) return res;
|
||||
insertIndex = (PRInt32)len;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> cellChild;
|
||||
res = cellToMerge->GetFirstChild(getter_AddRefs(cellChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
while (cellChild)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> nextChild;
|
||||
res = cellChild->GetNextSibling(getter_AddRefs(nextChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = nsEditor::DeleteNode(cellChild);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = nsEditor::InsertNode(cellChild, targetCell, insertIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
cellChild = nextChild;
|
||||
insertIndex++;
|
||||
}
|
||||
|
||||
// Delete cells whose contents were moved
|
||||
if (aDeleteCellToMerge)
|
||||
res = DeleteNode(cellToMerge);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1647,38 +1705,92 @@ nsHTMLEditor::GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIn
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellContext(nsCOMPtr<nsIDOMSelection> &aSelection,
|
||||
nsCOMPtr<nsIDOMElement> &aTable, nsCOMPtr<nsIDOMElement> &aCell,
|
||||
nsCOMPtr<nsIDOMNode> &aCellParent, PRInt32& aCellOffset,
|
||||
PRInt32& aRow, PRInt32& aCol)
|
||||
nsHTMLEditor::GetCellContext(nsIDOMSelection **aSelection,
|
||||
nsIDOMElement **aTable,
|
||||
nsIDOMElement **aCell,
|
||||
nsIDOMNode **aCellParent, PRInt32 *aCellOffset,
|
||||
PRInt32 *aRowIndex, PRInt32 *aColIndex)
|
||||
{
|
||||
nsresult res = nsEditor::GetSelection(getter_AddRefs(aSelection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aSelection) return NS_ERROR_FAILURE;
|
||||
// Initialize return pointers
|
||||
if (aSelection) *aSelection = nsnull;
|
||||
if (aTable) *aTable = nsnull;
|
||||
if (aCell) *aCell = nsnull;
|
||||
if (aCellParent) *aCellParent = nsnull;
|
||||
if (aCellOffset) *aCellOffset = 0;
|
||||
if (aRowIndex) *aRowIndex = 0;
|
||||
if (aColIndex) *aColIndex = 0;
|
||||
|
||||
if (!aCell)
|
||||
nsCOMPtr <nsIDOMSelection> selection;
|
||||
nsresult res = nsEditor::GetSelection(getter_AddRefs(selection));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aSelection)
|
||||
{
|
||||
// Get cell if it's the child of selection anchor node,
|
||||
// or get the enclosing by a cell
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(aCell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aCell) return NS_ERROR_FAILURE;
|
||||
*aSelection = selection.get();
|
||||
NS_ADDREF(*aSelection);
|
||||
}
|
||||
// Get containing table and the immediate parent of the cell
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aCell, getter_AddRefs(aTable));
|
||||
nsCOMPtr <nsIDOMElement> table;
|
||||
nsCOMPtr <nsIDOMElement> cell;
|
||||
|
||||
// Caller may supply the cell...
|
||||
if (aCell && *aCell)
|
||||
cell = *aCell;
|
||||
|
||||
// ...but if not supplied,
|
||||
// get cell if it's the child of selection anchor node,
|
||||
// or get the enclosing by a cell
|
||||
if (!cell)
|
||||
{
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we are not in a cell
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
}
|
||||
if (aCell)
|
||||
{
|
||||
*aCell = cell.get();
|
||||
NS_ADDREF(*aCell);
|
||||
}
|
||||
|
||||
// Get containing table
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aTable) return NS_ERROR_FAILURE;
|
||||
// Cell must be in a table, so fail if not found
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
if (aTable)
|
||||
{
|
||||
*aTable = table.get();
|
||||
NS_ADDREF(*aTable);
|
||||
}
|
||||
|
||||
res = aCell->GetParentNode(getter_AddRefs(aCellParent));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aCellParent) return NS_ERROR_FAILURE;
|
||||
// Get the rest of the related data only if requested
|
||||
if (aRowIndex || aColIndex)
|
||||
{
|
||||
PRInt32 rowIndex, colIndex;
|
||||
// Get current cell location so we can put caret back there when done
|
||||
res = GetCellIndexes(cell, rowIndex, colIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
if (aRowIndex) *aRowIndex = rowIndex;
|
||||
if (aColIndex) *aColIndex = colIndex;
|
||||
}
|
||||
if (aCellParent)
|
||||
{
|
||||
nsCOMPtr <nsIDOMNode> cellParent;
|
||||
// Get the immediate parent of the cell
|
||||
res = cell->GetParentNode(getter_AddRefs(cellParent));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Cell has to have a parent, so fail if not found
|
||||
if (!cellParent) return NS_ERROR_FAILURE;
|
||||
|
||||
// Get current cell location so we can put caret back there when done
|
||||
res = GetCellIndexes(aCell, aRow, aCol);
|
||||
if(NS_FAILED(res)) return res;
|
||||
*aCellParent = cellParent.get();
|
||||
NS_ADDREF(*aCellParent);
|
||||
|
||||
// And the parent and offsets needed to do an insert
|
||||
return GetChildOffset(aCell, aCellParent, aCellOffset);
|
||||
if (aCellOffset)
|
||||
res = GetChildOffset(cell, cellParent, *aCellOffset);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1698,10 +1810,14 @@ nsHTMLEditor::GetFirstSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange)
|
|||
if (NS_FAILED(res)) return res;
|
||||
if (!range) return NS_ERROR_FAILURE;
|
||||
|
||||
mSelectedCellIndex = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> cellNode;
|
||||
res = GetFirstNodeInRange(range, getter_AddRefs(cellNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cellNode) return NS_ERROR_FAILURE;
|
||||
// Failure here means selection is in a text node,
|
||||
// so there's no selected cell
|
||||
if (NS_FAILED(res)) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
if (!cellNode) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
if (IsTableCell(cellNode))
|
||||
{
|
||||
|
@ -1715,7 +1831,7 @@ nsHTMLEditor::GetFirstSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange)
|
|||
}
|
||||
}
|
||||
else
|
||||
res = NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
// Setup for next cell
|
||||
mSelectedCellIndex = 1;
|
||||
|
@ -1975,10 +2091,10 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Traverse all selected cells
|
||||
// (Failure here may indicate that aCellElement wasn't really a cell)
|
||||
nsCOMPtr<nsIDOMElement> selectedCell;
|
||||
res = GetFirstSelectedCell(getter_AddRefs(selectedCell), nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (res == NS_EDITOR_ELEMENT_NOT_FOUND) return NS_OK;
|
||||
|
||||
// We have at least one selected cell, so set return value
|
||||
aSelectionType = TABLESELECTION_CELL;
|
||||
|
|
|
@ -272,6 +272,7 @@ public:
|
|||
* @param aCell Selected cell or null if ranges don't contain cell selections
|
||||
* @param aRange Optional: if not null, return the selection range
|
||||
* associated with the cell
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
NS_IMETHOD GetFirstSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange)=0;
|
||||
|
||||
|
|
|
@ -29,10 +29,20 @@
|
|||
var editorShell;
|
||||
var documentModified;
|
||||
var prefAuthorString = "";
|
||||
var NormalMode = 1;
|
||||
var PreviewMode = 2;
|
||||
// These must match enums in nsIEditorShell.idl:
|
||||
var DisplayModePreview = 0;
|
||||
var DisplayModeNormal = 1;
|
||||
var DisplayModeAllTags = 2;
|
||||
var DisplayModeSource = 3;
|
||||
var EditorDisplayMode = 1; // Normal Editor mode
|
||||
var WebCompose = false; // Set true for Web Composer, leave false for Messenger Composer
|
||||
var docWasModified = false; // Check if clean document, if clean then unload when user "Opens"
|
||||
var contentWindow = 0;
|
||||
var sourceContentWindow = 0;
|
||||
|
||||
var prefs;
|
||||
// These must be kept in synch with the XUL <options> lists
|
||||
var gParagraphTagNames = new Array("","P","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","ADDRESS","PRE","DT","DD");
|
||||
var gFontFaceNames = new Array("","tt","Arial, Helvetica","Times","Courier");
|
||||
|
@ -52,20 +62,14 @@ function EditorOnLoad()
|
|||
if ( window.arguments && window.arguments[0] ) {
|
||||
// Opened via window.openDialog with URL as argument.
|
||||
// Put argument where EditorStartup expects it.
|
||||
dump("EditorOnLoad: url to load="+window.arguments[0]+"\n");
|
||||
document.getElementById( "args" ).setAttribute( "value", window.arguments[0] );
|
||||
}
|
||||
|
||||
WebCompose = true;
|
||||
|
||||
// Continue with normal startup.
|
||||
EditorStartup('html', document.getElementById("content-frame"));
|
||||
|
||||
// Active menu items that are initially hidden in XUL
|
||||
// because they are not needed by Messenger Composer
|
||||
var styleMenu = document.getElementById("stylesheetMenu")
|
||||
if (styleMenu)
|
||||
styleMenu.removeAttribute("hidden");
|
||||
|
||||
WebCompose = true;
|
||||
window.tryToClose = EditorClose;
|
||||
}
|
||||
|
||||
function TextEditorOnLoad()
|
||||
|
@ -118,6 +122,7 @@ var DocumentStateListener =
|
|||
function EditorStartup(editorType, editorElement)
|
||||
{
|
||||
contentWindow = window.content;
|
||||
sourceContentWindow = document.getElementById("HTMLSourceWindow");
|
||||
|
||||
// store the editor shell in the window, so that child windows can get to it.
|
||||
editorShell = editorElement.editorShell;
|
||||
|
@ -137,17 +142,27 @@ function EditorStartup(editorType, editorElement)
|
|||
// add a listener to be called when document is really done loading
|
||||
editorShell.RegisterDocumentStateListener( DocumentStateListener );
|
||||
|
||||
// Store the prefs object
|
||||
try {
|
||||
prefs = Components.classes['component://netscape/preferences'];
|
||||
if (prefs) prefs = prefs.getService();
|
||||
if (prefs) prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
|
||||
if (prefs)
|
||||
return prefs;
|
||||
else
|
||||
dump("failed to get prefs service!\n");
|
||||
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
dump("failed to get prefs service!\n");
|
||||
}
|
||||
|
||||
// Get url for editor content and load it.
|
||||
// the editor gets instantiated by the editor shell when the URL has finished loading.
|
||||
var url = document.getElementById("args").getAttribute("value");
|
||||
dump("EditorStartup: url="+url+"\n");
|
||||
editorShell.LoadUrl(url);
|
||||
|
||||
// Set focus to the edit window
|
||||
// This still doesn't work!
|
||||
// It works after using a toolbar button, however!
|
||||
contentWindow.focus();
|
||||
// call updateCommands to disable while we're loading the page
|
||||
window.updateCommands("create");
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,9 +322,10 @@ function EditorOpenRemote()
|
|||
return _EditorObsolete();
|
||||
}
|
||||
|
||||
// used by openLocation. see navigator.js for additional notes.
|
||||
// used by openLocation. see openLocation.js for additional notes.
|
||||
function delayedOpenWindow(chrome, flags, url)
|
||||
{
|
||||
dump("delayedOpenWindow: URL="+url+"\n");
|
||||
if (PageIsEmptyAndUntouched())
|
||||
editorShell.LoadUrl(url);
|
||||
else
|
||||
|
@ -426,6 +442,11 @@ function EditorFindNext()
|
|||
return _EditorObsolete();
|
||||
}
|
||||
|
||||
function EditorShowClipboard()
|
||||
{
|
||||
dump("EditorShowClipboard not implemented\n");
|
||||
}
|
||||
|
||||
// --------------------------- View menu ---------------------------
|
||||
|
||||
function EditorViewSource()
|
||||
|
@ -471,18 +492,12 @@ function EditorSetTextProperty(property, attribute, value)
|
|||
contentWindow.focus();
|
||||
}
|
||||
|
||||
/*
|
||||
function EditorSelectParagraphFormat(commandID, select)
|
||||
function onParagraphFormatChange(commandID)
|
||||
{
|
||||
content.focus(); // required hack for now
|
||||
|
||||
if (select.selectedIndex != -1)
|
||||
EditorSetParagraphFormat(commandID, gParagraphTagNames[select.selectedIndex]);
|
||||
}
|
||||
*/
|
||||
var commandNode = document.getElementById(commmandID);
|
||||
var state = commandNode.getAttribute("state");
|
||||
dump(" ==== onParagraphFormatChange was called. state="+state+"|\n");
|
||||
|
||||
function onParagraphFormatChange()
|
||||
{
|
||||
return; //TODO: REWRITE THIS
|
||||
var menulist = document.getElementById("ParagraphSelect");
|
||||
if (menulist)
|
||||
|
@ -735,6 +750,15 @@ function EditorRemoveBackColor(ColorWellID)
|
|||
contentWindow.focus();
|
||||
}
|
||||
|
||||
|
||||
function SetManualTextColor()
|
||||
{
|
||||
}
|
||||
|
||||
function SetManualTextColor()
|
||||
{
|
||||
}
|
||||
|
||||
function EditorSetFontColor(color)
|
||||
{
|
||||
editorShell.SetTextProperty("font", "color", color);
|
||||
|
@ -761,27 +785,7 @@ function EditorRemoveStyle(tagName)
|
|||
|
||||
function EditorToggleStyle(styleName)
|
||||
{
|
||||
// see if the style is already set by looking at the observer node,
|
||||
// which is the appropriate button
|
||||
// cmanske: I don't think we should depend on button state!
|
||||
// (this won't work for other list styles, anyway)
|
||||
// We need to get list type from document
|
||||
var theButton = document.getElementById(styleName + "Button");
|
||||
dump("Toggling style " + styleName + "\n");
|
||||
if (theButton)
|
||||
{
|
||||
var isOn = theButton.getAttribute(styleName);
|
||||
if (isOn == "true")
|
||||
editorShell.RemoveTextProperty(gStyleTags[styleName], "", "");
|
||||
else
|
||||
editorShell.SetTextProperty(gStyleTags[styleName], "", "");
|
||||
|
||||
contentWindow.focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("No button found for the " + styleName + " style\n");
|
||||
}
|
||||
return _EditorObsolete();
|
||||
}
|
||||
|
||||
function EditorRemoveLinks()
|
||||
|
@ -876,7 +880,8 @@ function EditorInsertOrEditImage()
|
|||
|
||||
function EditorInsertOrEditHLine()
|
||||
{
|
||||
return _EditorObsolete();}
|
||||
return _EditorObsolete();
|
||||
}
|
||||
|
||||
function EditorInsertChars()
|
||||
{
|
||||
|
@ -914,10 +919,17 @@ function EditorSetDisplayMode(mode)
|
|||
editorShell.SetDisplayMode(mode);
|
||||
|
||||
// Set the UI states
|
||||
document.getElementById("PreviewModeButton").setAttribute("selected",Number(mode == 0));
|
||||
document.getElementById("NormalModeButton").setAttribute("selected",Number(mode == 1));
|
||||
document.getElementById("TagModeButton").setAttribute("selected",Number(mode == 2));
|
||||
contentWindow.focus();
|
||||
document.getElementById("PreviewModeButton").setAttribute("selected",Number(mode == DisplayModePreview));
|
||||
document.getElementById("NormalModeButton").setAttribute("selected",Number(mode == DisplayModeNormal));
|
||||
document.getElementById("TagModeButton").setAttribute("selected",Number(mode == DisplayModeAllTags));
|
||||
var HTMLButton = document.getElementById("SourceModeButton");
|
||||
if (HTMLButton)
|
||||
HTMLButton.setAttribute("selected", Number(mode == DisplayModeSource));
|
||||
dump(sourceContentWindow+"=SourceWindow\n");
|
||||
if (mode == DisplayModeSource)
|
||||
sourceContentWindow.focus();
|
||||
else
|
||||
contentWindow.focus();
|
||||
}
|
||||
|
||||
function EditorToggleParagraphMarks()
|
||||
|
@ -1326,6 +1338,7 @@ function initFontStyleMenu(menuPopup)
|
|||
//--------------------------------------------------------------------
|
||||
function onButtonUpdate(button, commmandID)
|
||||
{
|
||||
dump(" === onButtonUpdate called\n");
|
||||
var commandNode = document.getElementById(commmandID);
|
||||
var state = commandNode.getAttribute("state");
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
<toolbox id="EditorToolbox">
|
||||
<!-- toolbar filled out from editorOverlay -->
|
||||
<!-- add class="standard" for dark blue background (icons need rework first) -->
|
||||
<toolbar class="toolbar-primary chromeclass-toolbar" id="EditToolbar" persist="collapsed">
|
||||
<toolbar class="toolbar-primary" id="EditToolbar" persist="collapsed">
|
||||
<button id="newButton"/>
|
||||
<button id="openButton"/>
|
||||
<button id="saveButton"/>
|
||||
|
@ -192,14 +192,19 @@
|
|||
<splitter id="sidebar-splitter" class="chromeclass-extrachrome"/>
|
||||
|
||||
<box id="appcontent" orient="vertical" flex="1">
|
||||
<editor type="content-primary" id="content-frame" src="about:blank" flex="1"/>
|
||||
<deck id="ContentWindowDeck" index="0" flex="1">
|
||||
<editor type="content-primary" id="content-frame" src="about:blank" flex="1"/>
|
||||
|
||||
<toolbar id="EditModeToolbar" chromeclass="extrachrome" persist="collapsed">
|
||||
<!-- DAMN! This worked for a few minutes on 5/1/00, but after updating tree, it crashes creating the textarea editor! -->
|
||||
<!-- <textfield id="HTMLSourceWindow" multiline="true" rows="2" flex="1" style="width:10em; height:10em;"/> -->
|
||||
</deck>
|
||||
|
||||
<toolbar id="EditModeToolbar" chromeclass="extrachrome" collapsed="true" persist="collapsed">
|
||||
<text class="margin-left-right" value="&editMode.label;"/>
|
||||
<!-- From editorOverlay.xul -->
|
||||
<text id="NormalModeButton"/>
|
||||
<text id="TagModeButton"/>
|
||||
<!-- <text id="HTMLModeButton"/> -->
|
||||
<!-- <text id="SourceModeButton"/> -->
|
||||
<text id="PreviewModeButton"/>
|
||||
<spring flex="1"/>
|
||||
</toolbar>
|
||||
|
|
|
@ -55,15 +55,14 @@
|
|||
<key id="pastequotationkb" xulkey="true" shift="true" key="&editpaste.keybinding;" observes="cmd_pasteQuote" />
|
||||
<key id="key_delete"/>
|
||||
<key id="key_selectAll"/>
|
||||
<key id="findkb" xulkey="true" key="&editfind.keybinding;" observes="cmd_find" />
|
||||
<key id="findnextkb" xulkey="true" key="&editfindnext.keybinding;" observes="cmd_findNext" />
|
||||
<key id="findkb" xulkey="true" key="&editfind.keybinding;" observes="cmd_find" />
|
||||
<key id="findnextkb" xulkey="true" key="&editfindnext.keybinding;" observes="cmd_findNext" />
|
||||
<key id="checkspellingkb" xulkey="true" key="&editcheckspelling.keybinding;" observes="cmd_spelling" />
|
||||
<key id="key_preferences"/>
|
||||
|
||||
<key id="boldkb" xulkey="true" key="&stylebold.keybinding;" observes="cmd_bold"/>
|
||||
<key id="italickb" xulkey="true" key="&styleitalic.keybinding;" observes="cmd_italic"/>
|
||||
|
||||
<key id="underlinekb" xulkey="true" key="&styleunderline.keybinding;" onkeypress="EditorToggleStyle('underline')"/>
|
||||
<key id="boldkb" xulkey="true" key="&stylebold.keybinding;" observes="cmd_bold"/>
|
||||
<key id="italickb" xulkey="true" key="&styleitalic.keybinding;" observes="cmd_italic"/>
|
||||
<key id="underlinekb" xulkey="true" key="&styleunderline.keybinding;" observes="cmd_underline"/>
|
||||
|
||||
<!-- these should come from tasksOverlay.xul -->
|
||||
<key id="navigatortaskkb" xulkey="true" key="1" onkeypress="Navigator()" />
|
||||
|
@ -115,21 +114,22 @@
|
|||
<command id="cmd_viewtaskbar" oncommand="goToggleToolbar('taskbar','cmd_viewtaskbar');" checked="true"/>
|
||||
|
||||
<!-- format menu -->
|
||||
<command id="cmd_listProperties" oncommand="goDoCommand('cmd_listProperties')"/>
|
||||
<command id="cmd_pageProperties" oncommand="goDoCommand('cmd_pageProperties')"/>
|
||||
<command id="cmd_colorProperties" oncommand="goDoCommand('cmd_colorProperties')"/>
|
||||
<command id="cmd_listProperties" oncommand="goDoCommand('cmd_listProperties')"/>
|
||||
<command id="cmd_pageProperties" oncommand="goDoCommand('cmd_pageProperties')"/>
|
||||
<command id="cmd_colorProperties" oncommand="goDoCommand('cmd_colorProperties')"/>
|
||||
|
||||
<command id="cmd_link" value="&insertLinkCmd.label;" oncommand="goDoCommand('cmd_link')"/>
|
||||
<command id="cmd_anchor" value="&insertAnchorCmd.label;" oncommand="goDoCommand('cmd_anchor')"/>
|
||||
<command id="cmd_insertChars" value="&insertCharsCmd.label;" oncommand="goDoCommand('cmd_insertChars')"/>
|
||||
<command id="cmd_image" value="&insertImageCmd.label;" oncommand="goDoCommand('cmd_image')"/>
|
||||
<command id="cmd_hline" value="&insertHLineCmd.label;" oncommand="goDoCommand('cmd_hline')"/>
|
||||
<command id="cmd_table" value="&insertTableCmd.label;" oncommand="goDoCommand('cmd_table')"/>
|
||||
<command id="cmd_editTable" oncommand="goDoCommand('cmd_editTable')"/>
|
||||
<command id="cmd_insertHTML" value="&HTMLSourceCmd.label;" oncommand="goDoCommand('cmd_insertHTML')"/>
|
||||
<command id="cmd_editHTML" value="&HTMLSourceCmd.label;" oncommand="goDoCommand('cmd_editHTML')"/>
|
||||
<command id="cmd_insertBreak" value="&insertLineBreakCmd.label;" oncommand="goDoCommand('cmd_insertBreak')"/>
|
||||
<command id="cmd_insertBreakAll" value="&insertBreakBelowImagesCmd.label;" oncommand="goDoCommand('cmd_insertBreakAll')"/>
|
||||
<command id="cmd_link" oncommand="goDoCommand('cmd_link')"/>
|
||||
<command id="cmd_anchor" oncommand="goDoCommand('cmd_anchor')"/>
|
||||
<command id="cmd_insertChars" oncommand="goDoCommand('cmd_insertChars')"/>
|
||||
<command id="cmd_image" oncommand="goDoCommand('cmd_image')"/>
|
||||
<command id="cmd_hline" oncommand="goDoCommand('cmd_hline')"/>
|
||||
<command id="cmd_table" oncommand="goDoCommand('cmd_table')"/>
|
||||
<command id="cmd_insertChars" oncommand="goDoCommand('cmd_insertChars')" value="&insertCharsCmd.label;"/>
|
||||
<command id="cmd_editTable" oncommand="goDoCommand('cmd_editTable')"/>
|
||||
<command id="cmd_insertHTML" oncommand="goDoCommand('cmd_insertHTML')" value="&HTMLSourceCmd.label;"/>
|
||||
<command id="cmd_editHTML" oncommand="goDoCommand('cmd_editHTML')" value="&HTMLSourceCmd.label;"/>
|
||||
<command id="cmd_insertBreak" oncommand="goDoCommand('cmd_insertBreak')" value="&insertLineBreakCmd.label;"/>
|
||||
<command id="cmd_insertBreakAll" oncommand="goDoCommand('cmd_insertBreakAll')" value="&insertBreakBelowImagesCmd.label;"/>
|
||||
|
||||
</commandset>
|
||||
|
||||
|
@ -161,10 +161,10 @@
|
|||
|
||||
<command id="cmd_preferences"/>
|
||||
|
||||
<command id="cmd_find" value="&findCmd.label;" oncommand="goDoCommand('cmd_find')"/>
|
||||
<command id="cmd_findNext" value="&findAgainCmd.label;" oncommand="goDoCommand('cmd_findNext')"/>
|
||||
<command id="cmd_spelling" value="&checkSpellingCmd.label;" oncommand="goDoCommand('cmd_spelling')"/>
|
||||
<command id="cmd_pasteQuote" value="&pasteAsQuotationCmd.label;" oncommand="goDoCommand('cmd_pasteQuote')"/>
|
||||
<command id="cmd_find" oncommand="goDoCommand('cmd_find')"/>
|
||||
<command id="cmd_findNext" oncommand="goDoCommand('cmd_findNext')" value="&findAgainCmd.label;"/>
|
||||
<command id="cmd_spelling" oncommand="goDoCommand('cmd_spelling')"/>
|
||||
<command id="cmd_pasteQuote" oncommand="goDoCommand('cmd_pasteQuote')" value="&pasteAsQuotationCmd.label;"/>
|
||||
|
||||
</commandset>
|
||||
|
||||
|
@ -266,10 +266,10 @@
|
|||
<menuseparator id="edEditMenuSep2" />
|
||||
<menuitem id="menu_selectAll"/>
|
||||
<menuseparator class="hide-in-IM"/>
|
||||
<menuitem id="menu_find" accesskey="&editfind.accesskey;" key="findkb" observes="cmd_find"/>
|
||||
<menuitem id="menu_find" accesskey="&editfind.accesskey;" key="findkb" observes="cmd_find" value="&findCmd.label;"/>
|
||||
<menuitem id="menu_findnext" accesskey="&editfindnext.accesskey;" key="findnextkb" observes="cmd_findNext"/>
|
||||
<menuseparator class="hide-in-IM" />
|
||||
<menuitem id="menu_checkspelling" accesskey="&editcheckspelling.accesskey;" key="checkspellingkb" observes="cmd_spelling"/>
|
||||
<menuitem id="menu_checkspelling" accesskey="&editcheckspelling.accesskey;" key="checkspellingkb" observes="cmd_spelling" value="&checkSpellingCmd.label;"/>
|
||||
<menuseparator class="hide-in-IM"/>
|
||||
<menuitem class="hide-in-IM" id="menu_editHTML" accesskey="&HTMLsource.accesskey;" observes="cmd_editHTML"/>
|
||||
<menuseparator/>
|
||||
|
@ -378,19 +378,19 @@
|
|||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<!-- Insert menu -->
|
||||
<!-- Insert menu -->
|
||||
<menu id="insertMenu" value="&insertMenu.label;" accesskey="&insertmenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem accesskey="&insertlink.accesskey;" observes="cmd_link"/>
|
||||
<menuitem accesskey="&insertanchor.accesskey;" observes="cmd_anchor"/>
|
||||
<menuitem accesskey="&insertimage.accesskey;" observes="cmd_image"/>
|
||||
<menuitem accesskey="&inserthline.accesskey;" observes="cmd_hline"/>
|
||||
<menuitem accesskey="&inserttable.accesskey;" observes="cmd_table"/>
|
||||
<menuitem accesskey="&HTMLsource.accesskey;" key="inserthtmlkb" observes="cmd_insertHTML"/>
|
||||
<menuitem accesskey="&insertchars.accesskey;" observes="cmd_insertChars"/>
|
||||
<menuitem accesskey="&insertlink.accesskey;" observes="cmd_link" value="&insertLinkCmd.label;" />
|
||||
<menuitem accesskey="&insertanchor.accesskey;" observes="cmd_anchor" value="&insertCharsCmd.label;"/>
|
||||
<menuitem accesskey="&insertimage.accesskey;" observes="cmd_image" value="&insertImageCmd.label;"/>
|
||||
<menuitem accesskey="&inserthline.accesskey;" observes="cmd_hline" value="&insertHLineCmd.label;"/>
|
||||
<menuitem accesskey="&inserttable.accesskey;" observes="cmd_table" value="&insertTableCmd.label;"/>
|
||||
<menuitem accesskey="&HTMLsource.accesskey;" observes="cmd_insertHTML" key="inserthtmlkb"/>
|
||||
<menuitem accesskey="&insertchars.accesskey;" observes="cmd_insertChars" />
|
||||
<menuseparator />
|
||||
<menuitem accesskey="&insertlinebreak.accesskey;" disabled="true" observes="cmd_insertBreak"/>
|
||||
<menuitem accesskey="&insertbreak.accesskey;" disabled="true" observes="cmd_insertBreakAll"/>
|
||||
<menuitem accesskey="&insertlinebreak.accesskey;" observes="cmd_insertBreak"/>
|
||||
<menuitem accesskey="&insertbreak.accesskey;" observes="cmd_insertBreakAll"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
|
@ -586,59 +586,78 @@
|
|||
oncommand="goDoCommand('cmd_colorProperties')"/>
|
||||
|
||||
<menu id="tableMenu" value="&tableMenu.label;" accesskey="&tablemenu.accesskey;">
|
||||
<menupopup>
|
||||
<menu id="tableSelectMenu" value="&tableSelectMenu.label;"
|
||||
accesskey="&tableselectmenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem value="&tableTable.label;" accesskey="&tabletable.accesskey;" oncommand="EditorSelectTable()"/>
|
||||
<menuitem value="&tableRow.label;" accesskey="&tablerow.accesskey;" oncommand="EditorSelectTableRow()"/>
|
||||
<menuitem value="&tableColumn.label;" accesskey="&tablecolumn.accesskey;" oncommand="EditorSelectTableColumn()"/>
|
||||
<menuitem value="&tableCell.label;" accesskey="&tablecell.accesskey;" oncommand="EditorSelectTableCell()"/>
|
||||
<menuitem value="&tableAllCells.label;" accesskey="&tableallcells.accesskey;" oncommand="EditorSelectAllTableCells()"/>
|
||||
<menu id="tableSelectMenu" value="&tableSelectMenu.label;"
|
||||
accesskey="&tableselectmenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem value="&tableTable.label;" accesskey="&tabletable.accesskey;" oncommand="EditorSelectTable()"/>
|
||||
<menuitem value="&tableRow.label;" accesskey="&tablerow.accesskey;" oncommand="EditorSelectTableRow()"/>
|
||||
<menuitem value="&tableColumn.label;" accesskey="&tablecolumn.accesskey;" oncommand="EditorSelectTableColumn()"/>
|
||||
<menuitem value="&tableCell.label;" accesskey="&tablecell.accesskey;" oncommand="EditorSelectTableCell()"/>
|
||||
<menuitem value="&tableAllCells.label;" accesskey="&tableallcells.accesskey;" oncommand="EditorSelectAllTableCells()"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tableInsertMenu" value="&tableInsertMenu.label;" accesskey="&tableinsertmenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem value="&insertTableCmd.label;" accesskey="&tabletable.accesskey;" oncommand="EditorInsertTable()"/>
|
||||
<menuseparator />
|
||||
<menuitem value="&tableRowAbove.label;" accesskey="&tablerow.accesskey;" oncommand="EditorInsertTableRow(false)"/>
|
||||
<menuitem value="&tableRowBelow.label;" accesskey="&tablerowbelow.accesskey;" oncommand="EditorInsertTableRow(true)"/>
|
||||
<menuseparator />
|
||||
<menuitem value="&tableColumnBefore.label;" accesskey="&tablecolumn.accesskey;" oncommand="EditorInsertTableColumn(false)"/>
|
||||
<menuitem value="&tableColumnAfter.label;" accesskey="&tablecolumnafter.accesskey;" oncommand="EditorInsertTableColumn(true)"/>
|
||||
<menuseparator />
|
||||
<menuitem value="&tableCellBefore.label;" accesskey="&tablecell.accesskey;" oncommand="EditorInsertTableCell(false)"/>
|
||||
<menuitem value="&tableCellAfter.label;" accesskey="&tablecellafter.accesskey;" oncommand="EditorInsertTableCell(true)"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tableDeleteMenu" value="&tableDeleteMenu.label;" accesskey="&tabledeletemenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem value="&tableTable.label;" accesskey="&tabletable.accesskey;" oncommand="EditorDeleteTable()"/>
|
||||
<menuitem value="&tableRow.label;" accesskey="&tablerow.accesskey;" oncommand="EditorDeleteTableRow(1)"/>
|
||||
<menuitem value="&tableColumn.label;" accesskey="&tablecolumn.accesskey;" oncommand="EditorDeleteTableColumn(1)"/>
|
||||
<menuitem value="&tableCell.label;" accesskey="&tablecell.accesskey;" oncommand="EditorDeleteTableCell(1)"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator />
|
||||
<menuitem id="tableFixupMenuitem" value="&tableFixup.label;" accesskey="&tablefixup.accesskey;" oncommand="EditorNormalizeTable()"/>
|
||||
<!-- menu text set in InitTableMenu -->
|
||||
<menuitem id="tableJoinCellsMenuitem" value="TEST Join" accesskey="&tablejoin.accesskey;" oncommand="EditorJoinTableCells()" oncreate="InitTableMenu()"/>
|
||||
<menuitem id="tablePropertiesMenuitem" value="&tableProperties.label;" accesskey="&properties.accesskey;" observes="cmd_editTable"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tableInsertMenu" value="&tableInsertMenu.label;" accesskey="&tableinsertmenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem value="&insertTableCmd.label;" accesskey="&tabletable.accesskey;" oncommand="EditorInsertTable()"/>
|
||||
<menuseparator />
|
||||
<menuitem value="&tableRowAbove.label;" accesskey="&tablerow.accesskey;" oncommand="EditorInsertTableRow(false)"/>
|
||||
<menuitem value="&tableRowBelow.label;" accesskey="&tablerowbelow.accesskey;" oncommand="EditorInsertTableRow(true)"/>
|
||||
<menuseparator />
|
||||
<menuitem value="&tableColumnBefore.label;" accesskey="&tablecolumn.accesskey;" oncommand="EditorInsertTableColumn(false)"/>
|
||||
<menuitem value="&tableColumnAfter.label;" accesskey="&tablecolumnafter.accesskey;" oncommand="EditorInsertTableColumn(true)"/>
|
||||
<menuseparator />
|
||||
<menuitem value="&tableCellBefore.label;" accesskey="&tablecell.accesskey;" oncommand="EditorInsertTableCell(false)"/>
|
||||
<menuitem value="&tableCellAfter.label;" accesskey="&tablecellafter.accesskey;" oncommand="EditorInsertTableCell(true)"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tableDeleteMenu" value="&tableDeleteMenu.label;" accesskey="&tabledeletemenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem value="&tableTable.label;" accesskey="&tabletable.accesskey;" oncommand="EditorDeleteTable()"/>
|
||||
<menuitem value="&tableRow.label;" accesskey="&tablerow.accesskey;" oncommand="EditorDeleteTableRow(1)"/>
|
||||
<menuitem value="&tableColumn.label;" accesskey="&tablecolumn.accesskey;" oncommand="EditorDeleteTableColumn(1)"/>
|
||||
<menuitem value="&tableCell.label;" accesskey="&tablecell.accesskey;" oncommand="EditorDeleteTableCell(1)"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator />
|
||||
<menuitem id="tableFixupMenuitem" value="&tableFixup.label;" accesskey="&tablefixup.accesskey;" oncommand="EditorNormalizeTable()"/>
|
||||
<menuitem id="tableJoinCellsMenuitem" value="&tableJoinCells.label;" accesskey="&tablejoin.accesskey;" oncommand="EditorJoinTableCells()" disabled="true"/>
|
||||
<menuitem id="tablePropertiesMenuitem" value="&tableProperties.label;" accesskey="&properties.accesskey;" observes="cmd_editTable"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<popup id="TextColorPopup" popupanchor="bottomleft">
|
||||
<text id="TextColorCaption" class="color-caption" value="&textColorCaption.label;" flex="1"/>
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<colorpicker id="TextColorPicker" palettename="standard" onclick="EditorSelectTextColor('TextColorPicker','TextColorPopupButton');"/>
|
||||
<button class="button-toolbar" value="&colorPicker.default.label;" oncommand="EditorRemoveTextColor('TextColorPopupButton');"/>
|
||||
<text class="ColorPickerLabel" id="TextColorCaption" value="&textColorCaption.label;" flex="1"/>
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<box valign="middle" autostretch="never">
|
||||
<text class="color-button"/>
|
||||
<text class="label" value="&lastPickedColor.label;"/>
|
||||
</box>
|
||||
<colorpicker id="TextColorPicker" palettename="standard" onclick="EditorSelectTextColor('TextColorPicker','TextColorPopupButton');"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<text class="label" value="&colorLabel.label;"/>
|
||||
<textfield id="TextColorInput" flex="1" style="width: 1em"/>
|
||||
<button class="dialog" value="&ok.label;" oncommand="SetManualTextColor()"/>
|
||||
</box>
|
||||
<button class="dialog" value="&colorPicker.default.label;" oncommand="EditorRemoveTextColor('TextColorPopupButton');"/>
|
||||
</popup>
|
||||
|
||||
<popup id="BackColorPopup" popupanchor="bottomleft" oncreate="InitBackColorPopup()">
|
||||
<!-- Text is filled in at runtime according to what background element will be set -->
|
||||
<text id="BackColorCaption" class="color-caption" value="Background Color" flex="1"/>
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<colorpicker id="BackColorPicker" palettename="standard" onclick="EditorSelectBackColor('BackColorPicker','BackColorPopupButton');"/>
|
||||
<button class="button-toolbar" value="&colorPicker.default.label;" oncommand="EditorRemoveBackColor('BackColorPopupButton');"/>
|
||||
<text class="ColorPickerLabel" id="BackColorCaption" value="Background Color" flex="1"/>
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<box valign="middle" autostretch="never">
|
||||
<text class="color-button"/>
|
||||
<text class="label" value="&lastPickedColor.label;"/>
|
||||
</box>
|
||||
<colorpicker id="BackColorPicker" palettename="standard" onclick="EditorSelectBackColor('BackColorPicker','BackColorPopupButton');"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<text class="label" value="&colorLabel.label;"/>
|
||||
<textfield id="BackColorInput" flex="1" style="width: 1em"/>
|
||||
<button class="dialog" value="Ok" oncommand="SetManualBackColor()"/>
|
||||
</box>
|
||||
<button class="dialog" value="&colorPicker.default.label;" oncommand="EditorRemoveBackColor('BackColorPopupButton');"/>
|
||||
</popup>
|
||||
|
||||
<menupopup id="AlignmentPopup">
|
||||
|
@ -693,7 +712,7 @@
|
|||
|
||||
<!-- Formatting toolbar items. "data" are HTML tagnames, don't translate -->
|
||||
<menulist id="ParagraphSelect">
|
||||
<observes element="cmd_paragraphState" attribute="state" onbroadcast="onParagraphFormatChange()"/>
|
||||
<observes element="cmd_paragraphState" attribute="state" onbroadcast="onParagraphFormatChange('cmd_paragraphState')"/>
|
||||
<menupopup oncommand="EditorSetParagraphFormat('cmd_paragraphState', event.target.data)">
|
||||
<menuitem value="&normalCmd.label;" data=""/>
|
||||
<menuitem value="¶graphParagraphCmd.label;" data="P"/>
|
||||
|
@ -739,8 +758,8 @@
|
|||
</menulist>
|
||||
|
||||
<stack id="ColorButtons" autostretch="never">
|
||||
<text id="BackColorPopupButton" popup="BackColorPopup"/>
|
||||
<text id="TextColorPopupButton" popup="TextColorPopup"/>
|
||||
<text class="color-button" id="BackColorPopupButton" popup="BackColorPopup"/>
|
||||
<text class="color-button" id="TextColorPopupButton" popup="TextColorPopup"/>
|
||||
</stack>
|
||||
|
||||
<button class="button-toolbar" id="DecreaseFontSizeButton" observes="cmd_decreaseFont"/>
|
||||
|
@ -771,7 +790,7 @@
|
|||
<!-- Edit Mode toolbar -->
|
||||
<text id="NormalModeButton" class="EditModeButton" selected="1" value="&normalMode.label;" onclick="EditorSetDisplayMode(1)"/>
|
||||
<text id="TagModeButton" class="EditModeButton" selected="0" value="&showAllTags.label;" onclick="EditorSetDisplayMode(2)"/>
|
||||
<text id="HTMLModeButton" class="EditModeButton" selected="0" value="&HTMLSourceCmd.label;" onclick="EditorSetDisplayMode(3)"/>
|
||||
<text id="SourceModeButton" class="EditModeButton" selected="0" value="&sourceMode.label;" onclick="EditorSetDisplayMode(3)"/>
|
||||
<text id="PreviewModeButton" class="EditModeButton" selected="0" value="&previewMode.label;" onclick="EditorSetDisplayMode(0)"/>
|
||||
|
||||
<!-- InsertPopupButton is used by messengercompose.xul -->
|
||||
|
|
|
@ -86,8 +86,8 @@ NoHeadings=(No headings without anchors)
|
|||
PageBackColor=Page Background Color
|
||||
CellBackColor=Cell Background Color
|
||||
TableBackColor=Table Background Color
|
||||
|
||||
LastPickedColor=Last picked color
|
||||
ColorLable=Color:
|
||||
Table=Table
|
||||
TableCell=Table Cell
|
||||
HLine=H.Line
|
||||
|
@ -97,3 +97,6 @@ NamedAnchor=Named Anchor
|
|||
Tag=Tag
|
||||
#Don't translate "%obj%" it will be replaced with one of above object nouns
|
||||
ObjectProperties=%obj% Properties...
|
||||
#Next 2 must contain the "tablejoin.accesskey" letter in editorOverlay.dtd
|
||||
JoinSelectedCells=Join Selected Cells
|
||||
JoinCellToRight=Join with Cell to the Right
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
<!ENTITY fileopenremote.keybinding "l">
|
||||
<!ENTITY recentFilesMenu.label "Recent Files">
|
||||
<!ENTITY recentFilesMenu.accesskey "r">
|
||||
<!ENTITY fileRevert.label "Revert">
|
||||
<!ENTITY filerevert.accesskey "v">
|
||||
<!ENTITY saveCmd.label "Save">
|
||||
<!ENTITY filesave.accesskey "s">
|
||||
<!ENTITY filesave.keybinding "s">
|
||||
|
@ -482,9 +484,12 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from
|
|||
<!ENTITY tableDeleteMenu.label "Delete">
|
||||
<!ENTITY tabledeletemenu.accesskey "d">
|
||||
|
||||
<!ENTITY tableFixup.label "Fixup table layout">
|
||||
<!ENTITY tablefixup.accesskey "f">
|
||||
<!ENTITY tableJoinCells.label "Join Cells">
|
||||
<!ENTITY tableFixup.label "Normalize table layout">
|
||||
<!ENTITY tablefixup.accesskey "n">
|
||||
<!-- text for "Join Cells" is in editor.properties
|
||||
("JoinSelectedCells" and "JoinCellToRight")
|
||||
the access key must exist in both of those strings
|
||||
-->
|
||||
<!ENTITY tablejoin.accesskey "j">
|
||||
<!ENTITY tableProperties.label "Table Properties...">
|
||||
<!-- These may be shared in other menus -->
|
||||
|
@ -541,9 +546,12 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from
|
|||
<!-- Used with color pickers in Format toolbar and Format Menu -->
|
||||
<!ENTITY colorPicker.default.label "Reader's default color">
|
||||
<!ENTITY colorPicker.default.accesskey "r">
|
||||
<!ENTITY colorLabel.label "Color:">
|
||||
<!ENTITY ok.label "OK">
|
||||
<!ENTITY lastPickedColor.label "Last-picked color">
|
||||
|
||||
<!-- Display Mode Toolbar -->
|
||||
<!ENTITY normalMode.label "Normal">
|
||||
<!ENTITY previewMode.label "Edit Preview">
|
||||
<!ENTITY showAllTags.label "Show All Tags">
|
||||
<!ENTITY treeModeButton.label "Tag Tree">
|
||||
<!ENTITY sourceMode.label "HTML Source">
|
||||
|
|
|
@ -47,6 +47,15 @@
|
|||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.inset-border {
|
||||
border: 1px inset white;
|
||||
}
|
||||
|
||||
/* THIS DOESN'T WORK ON <text>! */
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* end of SHOULD GO IN GLOBAL */
|
||||
|
||||
#EditModeToolbar {
|
||||
|
@ -91,10 +100,6 @@
|
|||
padding: 1px 5px -1px 3px;
|
||||
}
|
||||
|
||||
.color-caption {
|
||||
border: 1px inset white;
|
||||
}
|
||||
|
||||
/* Image URLs for all Editor toolbar buttons */
|
||||
|
||||
#boldButton {
|
||||
|
@ -228,29 +233,34 @@
|
|||
list-style-image:url("chrome://editor/skin/images/justify.gif");
|
||||
}
|
||||
|
||||
#ColorButtons {
|
||||
margin: 2px;
|
||||
.ColorPickerLabel {
|
||||
border: 1px inset white;
|
||||
margin: 0px;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* TODO: How to make inset color skinable? */
|
||||
#TextColorPopupButton {
|
||||
.color-button {
|
||||
border: 1px inset #CCCCCC;
|
||||
padding: 0px;
|
||||
margin-right: 7px;
|
||||
margin-bottom: 7px;
|
||||
width: 14px;
|
||||
height: 12px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.color-button:hover {
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
#TextColorPopupButton {
|
||||
margin: 2px 9px 9px 2px;
|
||||
/* TEMP: Set color here. TODO: Set color from page */
|
||||
background-color: #AA0000;
|
||||
}
|
||||
|
||||
#BackColorPopupButton {
|
||||
border: 1px inset #CCCCCC;
|
||||
padding: 0px;
|
||||
margin-top: 7px;
|
||||
margin-left: 7px;
|
||||
width: 14px;
|
||||
height: 12px;
|
||||
|
||||
margin: 9px 2px 2px 9px;
|
||||
/* TEMP: Set color here. TODO: Set color from page */
|
||||
background-color: #FFFF00;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ function Startup()
|
|||
doSetOKCancel(onOK, null);
|
||||
|
||||
// Initialize default colors from browser prefs
|
||||
prefs = GetPrefs();
|
||||
var prefs = GetPrefs();
|
||||
if (prefs)
|
||||
{
|
||||
dump("Getting browser prefs...\n");
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<textfield id="BackgroundImageInput"/>
|
||||
<button class="dialog" id="ChooseFile" flex="1"/>
|
||||
</row>
|
||||
<row autostretch="never" vertical-align="middle">
|
||||
<row autostretch="never" valign="middle">
|
||||
<html class="label wrap" flex="1">&saveImageMsg.label;</html>
|
||||
<button class="dialog" id="AdvancedEditButton" flex="1"/>
|
||||
</row>
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
<grid>
|
||||
<columns><column/><column/><column /></columns>
|
||||
<rows>
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="middle" autostretch="never">
|
||||
<text class="label" value="&widthEditField.label;"/>
|
||||
<textfield class="narrow" id="width" flex="1" onkeyup="forceInteger('width')"/>
|
||||
<menulist id="pixelOrPercentMenulist"/>
|
||||
<!-- menupopup and menuitems added by JS -->
|
||||
</row>
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="middle" autostretch="never">
|
||||
<text class="label" value="&heightEditField.label;"/>
|
||||
<textfield class="narrow" id="height" onkeyup="forceInteger('height')"/>
|
||||
<text class="label" value="&pixelsPopup.value;"/>
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<columns><column/><column/><column/></columns>
|
||||
<rows>
|
||||
<!--////// IMAGE WIDTH //////-->
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="baseline" autostretch="never">
|
||||
<text class = "label"
|
||||
id = "widthLabel"
|
||||
for = "widthInput"
|
||||
|
@ -132,7 +132,7 @@
|
|||
<!-- contents are appended by JS -->
|
||||
</row>
|
||||
<!--////// IMAGE HEIGHT //////-->
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="baseline" autostretch="never">
|
||||
<text class = "label"
|
||||
id = "heightLabel"
|
||||
for = "heightInput"
|
||||
|
@ -175,7 +175,7 @@
|
|||
<titledbox flex="1" orient="vertical">
|
||||
<title><text class="label" id="alignLabel" value="&alignment.label;"/></title>
|
||||
<menulist id = "alignTypeSelect" onchange ="doOverallEnabling()">
|
||||
<menupopup vertical-align="middle">
|
||||
<menupopup valign="middle">
|
||||
<menuitem class="middle"><image id="img-align-top"/> <text class="label" value = "&topPopup.value;"/></menuitem>
|
||||
<menuitem class="middle"><image id="img-align-middle"/><text class="label" value = "¢erPopup.value;"/></menuitem>
|
||||
<menuitem class="middle"><image id="img-align-bottom"/><text class="label" value = "&bottomPopup.value;"/></menuitem>
|
||||
|
@ -191,7 +191,7 @@
|
|||
<grid>
|
||||
<columns><column/><column/><column/></columns>
|
||||
<rows>
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="baseline" autostretch="never">
|
||||
<text
|
||||
class = "label align-right"
|
||||
id = "leftrightLabel"
|
||||
|
@ -206,7 +206,7 @@
|
|||
id = "leftrighttypeLabel"
|
||||
value = "&pixelsPopup.value;" />
|
||||
</row>
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="baseline" autostretch="never">
|
||||
<text
|
||||
class = "label align-right"
|
||||
id = "topbottomLabel"
|
||||
|
@ -221,7 +221,7 @@
|
|||
id = "topbottomtypeLabel"
|
||||
value = "&pixelsPopup.value;" />
|
||||
</row>
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="baseline" autostretch="never">
|
||||
<text class = "label align-right"
|
||||
id = "borderLabel"
|
||||
value = "&borderEditField.label;"/>
|
||||
|
|
|
@ -45,8 +45,9 @@
|
|||
<keyset id="keyset"/>
|
||||
|
||||
<text class="label" id="srcMessage" value="&sourceEditField.label;"/>
|
||||
<html:textarea rows="16" cols="80" id="srcInput" flex="1"/>
|
||||
<!-- <textfield id="srcInput" multiline="true" rows="6" flex="1"/> -->
|
||||
<box orient="vertical" flex="1" style="width: 30em; height: 20em;">
|
||||
<textfield id="srcInput" multiline="true" rows="1" style="width: 1em" flex="1"/> -->
|
||||
</box>
|
||||
<!-- Will this accept the embedded HTML tags? -->
|
||||
<box>
|
||||
<spring class="bigspacer"/>
|
||||
|
|
|
@ -47,38 +47,43 @@
|
|||
<grid>
|
||||
<columns><column/><column/><column/></columns>
|
||||
<rows>
|
||||
<row vertical-align="baseline" text-align="right" autostretch="never">
|
||||
<row valign="baseline" text-align="right" autostretch="never">
|
||||
<text class="label align-right" text-align="right" value="&numRowsEditField.label;"/>
|
||||
<textfield class="narrow" id="rowsInput" onkeyup="forceInteger(this.id)" />
|
||||
<spring/>
|
||||
</row>
|
||||
<row vertical-align="baseline" text-align="right" autostretch="never">
|
||||
<row valign="baseline" text-align="right" autostretch="never">
|
||||
<text class="label align-right" value="&numColumnsEditField.label;"/>
|
||||
<textfield class="narrow" id="columnsInput" onkeyup="forceInteger(this.id)" />
|
||||
<spring/>
|
||||
</row>
|
||||
<row vertical-align="baseline" text-align="right" autostretch="never">
|
||||
<row valign="baseline" text-align="right" autostretch="never">
|
||||
<text class="label align-right" value="&widthEditField.label;"/>
|
||||
<textfield class="narrow" id="widthInput" onkeyup="forceInteger(this.id)" />
|
||||
<menulist id="widthPixelOrPercentMenulist"><menupopup/></menulist>
|
||||
<!-- child elements are appended by JS -->
|
||||
</row>
|
||||
<row vertical-align="baseline" text-align="right" autostretch="never">
|
||||
<row valign="baseline" text-align="right" autostretch="never">
|
||||
<text class="label align-right" value="&heightEditField.label;"/>
|
||||
<textfield class="narrow" id="heightInput" onkeyup="forceInteger(this.id)" />
|
||||
<menulist id="heightPixelOrPercentMenulist"><menupopup/></menulist>
|
||||
<!-- child elements are appended by JS -->
|
||||
</row>
|
||||
<row vertical-align="baseline" autostretch="never">
|
||||
<row valign="baseline" autostretch="never">
|
||||
<text class="label align-right" text-align="right" value="&borderEditField.label;"/>
|
||||
<textfield class="narrow" id="borderInput" onkeyup="forceInteger(this.id)" />
|
||||
<text value="&pixels.label;"/>
|
||||
<text class="label" value="&pixels.label;"/>
|
||||
</row>
|
||||
<spring class="spacer"/>
|
||||
<row valign="baseline" autostretch="never">
|
||||
<spring/>
|
||||
<spring/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<button class="dialog" id="AdvancedEditButton"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<spring class="spacer"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<box id="AdvancedEdit"/>
|
||||
<separator class="groove"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<box id="okCancelButtons"/>
|
||||
</window>
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<grid>
|
||||
<columns><column/><column/></columns>
|
||||
<rows>
|
||||
<row autostretch="never" vertical-align="middle">
|
||||
<row autostretch="never" valign="middle">
|
||||
<textfield id="hrefInput" flex="1"/>
|
||||
<button class="dialog" id="ChooseFile" flex="1"/>
|
||||
</row>
|
||||
|
|
|
@ -54,15 +54,15 @@
|
|||
<text class="label" value="&lastModified.label;" flex ="1" align="left"/>
|
||||
<text class="label" id="PageModDate" align="left"/>
|
||||
</row>
|
||||
<row vertical-align="middle">
|
||||
<row valign="baseline">
|
||||
<text class="label" value="&titleInput.label;"/>
|
||||
<textfield id="TitleInput" flex ="1" onkeyup="TextfieldChanged(this.id)"/>
|
||||
</row>
|
||||
<row vertical-align="middle">
|
||||
<row valign="baseline">
|
||||
<text class="label" value="&authorInput.label;"/>
|
||||
<textfield id="AuthorInput" flex ="1" onkeyup="TextfieldChanged(this.id)"/>
|
||||
</row>
|
||||
<row vertical-align="middle">
|
||||
<row valign="baseline">
|
||||
<text class="label" value="&descriptionInput.label;"/>
|
||||
<textfield class="MinWidth20em" id="DescriptionInput" flex ="1" onkeyup="TextfieldChanged(this.id)"/>
|
||||
</row>
|
||||
|
@ -76,7 +76,9 @@
|
|||
<box id="MoreSection" orient="vertical" flex="1">
|
||||
<!-- html used for labels that need to wrap -->
|
||||
<html class="wrap" flex="1">"&headSection.label;</html>
|
||||
<textfield class="MinWidth20em" id="HeadSrcInput" multiline="true" rows="10" flex="1"/>
|
||||
<box orient="vertical" flex="1" style="width: 10em; height: 10em;">
|
||||
<textfield id="HeadSrcInput" multiline="true" style="width: 1em" rows="1" flex="1"/>
|
||||
</box>
|
||||
<box>
|
||||
<box orient="vertical"><text class="label" value="&example.label;"/></box>
|
||||
<html class="wrap bold" flex="1">&example.value;</html>
|
||||
|
|
|
@ -56,12 +56,12 @@
|
|||
<box id="TablePanel" orient="vertical">
|
||||
<titledbox><title><text value="&size.label;"/></title>
|
||||
<box orient="vertical">
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="TableRowsInput" value="&tableRows.label;"/>
|
||||
<textfield class="narrow" id="TableRowsInput" onkeyup="forceInteger(this.id)" disabled="true"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="TableColumnsInput" value="&tableColumns.label;"/>
|
||||
<textfield class="narrow" id="TableColumnsInput" onkeyup="forceInteger(this.id)" disabled="true"/>
|
||||
</box>
|
||||
|
@ -69,13 +69,13 @@
|
|||
<spring class="bigspacer"/>
|
||||
<spring class="bigspacer"/>
|
||||
<box orient="vertical">
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="right" for="TableHeightInput" value="&tableHeight.label;"/>
|
||||
<textfield class="narrow" id="TableHeightInput" onkeyup="forceInteger(this.id)"/>
|
||||
<menulist id="TableHeightUnits"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="right" for="TableWidthInput" value="&tableWidth.label;"/>
|
||||
<textfield class="narrow" id="TableWidthInput" onkeyup="forceInteger(this.id)"/>
|
||||
<menulist id="TableWidthUnits"/>
|
||||
|
@ -85,20 +85,20 @@
|
|||
</titledbox>
|
||||
<box>
|
||||
<titledbox orient="vertical"><title><text align="left" value="&tableBorderSpacing.label;"/></title>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text align="left" for="BorderWidthInput" value="&tableBorderWidth.label;"/>
|
||||
<spring class="spacer"/>
|
||||
<textfield class="narrow" id="BorderWidthInput" onkeyup="forceInteger(this.id)"/>
|
||||
<text align="left" value="&pixels.label;"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="SpacingInput" value="&tableSpacing.label;"/>
|
||||
<textfield class="narrow" id="SpacingInput" onkeyup="forceInteger(this.id)"/>
|
||||
<text align="left" value="&tablePxBetwCells.label;"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="PaddingInput" value="&tablePadding.label;"/>
|
||||
<textfield class="narrow" id="PaddingInput" onkeyup="forceInteger(this.id)"/>
|
||||
<!-- Use DIV instead of TEXT because label has embeded <br> -->
|
||||
|
@ -135,7 +135,7 @@
|
|||
<spring class="bigspacer"/>
|
||||
</box>
|
||||
<titledbox orient="vertical"><title><text align="left" value="&background.label;"/></title>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" value="&color.label;"/>
|
||||
<menu class="colorpicker">
|
||||
<box>
|
||||
|
@ -151,13 +151,13 @@
|
|||
<text id="TableInheritColor" value="&tableInheritColor.label;" hidden="true"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="TableImageInput" value="&image.label;"/>
|
||||
<textfield id="TableImageInput" flex="1"/>
|
||||
<button class="dialog" value="&ChooseImage.label;" id="TableImageButton" oncommand="ChooseCellImage()"/>
|
||||
</box>
|
||||
<!-- Not sure if we will support this
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<spring class="MinWidth50"/>
|
||||
<html:input type="checkbox" id="TableLeaveLocCheck"/>
|
||||
<text align="left" for="TableLeaveLocCheck" value="&LeaveImageAtLocation.label;"/>
|
||||
|
@ -175,7 +175,7 @@
|
|||
|
||||
<!-- CELL PANEL -->
|
||||
<box id="CellPanel" orient="vertical">
|
||||
<titledbox autostretch="never" valign="middle">
|
||||
<titledbox autostretch="never" valign="baseline">
|
||||
<title><text align="left" value="&cellSelection.label;"/></title>
|
||||
<spring class="spacer"/>
|
||||
<menulist class="MinWidth50" id="SelectionList">
|
||||
|
@ -193,13 +193,13 @@
|
|||
<!-- cell size titledbox -->
|
||||
<titledbox><title><text align="left" value="&size.label;"/></title>
|
||||
<box orient="vertical">
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="CellHeightInput" value="&tableHeight.label;"/>
|
||||
<textfield class="narrow" id="CellHeightInput" onkeyup="forceInteger(this.id)"/>
|
||||
<menulist id="CellHeightUnits"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="CellWidthInput" value="&tableWidth.label;"/>
|
||||
<textfield class="narrow" id="CellWidthInput" onkeyup="forceInteger(this.id)"/>
|
||||
<menulist id="CellWidthUnits"/>
|
||||
|
@ -211,12 +211,12 @@
|
|||
<text for="RowSpanInput" value="&cellSpans.label;"/>
|
||||
</box>
|
||||
<box orient="vertical">
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<textfield class="narrow" id="RowSpanInput" onkeyup="forceInteger(this.id)"/>
|
||||
<text align="left" value="&cellSpanRows.label;"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<textfield class="narrow" id="ColSpanInput" onkeyup="forceInteger(this.id)"/>
|
||||
<text align="left" value="&cellSpanCols.label;"/>
|
||||
</box>
|
||||
|
@ -254,18 +254,18 @@
|
|||
<spring class="spacer"/>
|
||||
<titledbox orient="vertical">
|
||||
<title><text align="left" value="&cellTextStyle.label;"/></title>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<html:input type="checkbox" id="HeaderCheck"/>
|
||||
<text align="left" for="HeaderCheck" value="&cellHeader.label;"/>
|
||||
</box>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<html:input type="checkbox" id="NoWrapCheck"/>
|
||||
<text align="left" for="NoWrapCheck" value="&cellNoWrap.label;"/>
|
||||
</box>
|
||||
</titledbox>
|
||||
</box>
|
||||
<titledbox orient="vertical"><title><text align="left" value="&background.label;"/></title>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" value="&color.label;"/>
|
||||
<menu class="colorpicker">
|
||||
<box>
|
||||
|
@ -283,13 +283,13 @@
|
|||
<text id="CellInheritColor" value="&cellInheritColor.label;" hidden="true"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<text class="MinWidth50" align="left" for="CellImageInput" value="&image.label;" />
|
||||
<textfield id="CellImageInput" flex="1"/>
|
||||
<button class="dialog" value="&ChooseImage.label;" id="CellImageButton" oncommand="ChooseCellImage()"/>
|
||||
</box>
|
||||
<!-- Not sure if we will support this
|
||||
<box valign="middle" autostretch="never">
|
||||
<box valign="baseline" autostretch="never">
|
||||
<spring class="MinWidth50"/>
|
||||
<html:input type="checkbox" id="CellLeaveLocCheck"/>
|
||||
<text align="left" for="CellLeaveLocCheck" value="&LeaveImageAtLocation.label;"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче