This commit is contained in:
sfraser%netscape.com 1999-05-13 04:47:09 +00:00
Родитель 1f14b3c9f0
Коммит e9fa3630d0
2 изменённых файлов: 37 добавлений и 2 удалений

Просмотреть файл

@ -48,6 +48,9 @@ public:
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat)=0;
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn)=0;
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn)=0;
NS_IMETHOD SetEditorType(const nsString& aEditorType)=0;
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue)=0;
@ -120,6 +123,8 @@ public:
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument); \
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection); \
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat); \
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn); \
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn); \
NS_IMETHOD SetEditorType(const nsString& aEditorType); \
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue); \
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr); \
@ -161,6 +166,8 @@ public:
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument) { return _to GetEditorDocument(aEditorDocument); } \
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection) { return _to GetEditorSelection(aEditorSelection); } \
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat) { return _to GetParagraphFormat(aParagraphFormat); } \
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn) { return _to GetWrapColumn(aWrapColumn); } \
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn) { return _to SetWrapColumn(aWrapColumn); } \
NS_IMETHOD SetEditorType(const nsString& aEditorType) { return _to SetEditorType(aEditorType); } \
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue) { return _to SetTextProperty(aProp, aAttr, aValue); } \
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr) { return _to RemoveTextProperty(aProp, aAttr); } \

Просмотреть файл

@ -60,7 +60,8 @@ enum EditorAppCore_slots {
EDITORAPPCORE_CONTENTSASHTML = -2,
EDITORAPPCORE_EDITORDOCUMENT = -3,
EDITORAPPCORE_EDITORSELECTION = -4,
EDITORAPPCORE_PARAGRAPHFORMAT = -5
EDITORAPPCORE_PARAGRAPHFORMAT = -5,
EDITORAPPCORE_WRAPCOLUMN = -6
};
/***********************************************************************/
@ -136,6 +137,17 @@ GetEditorAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case EDITORAPPCORE_WRAPCOLUMN:
{
PRInt32 prop;
if (NS_OK == a->GetWrapColumn(&prop)) {
*vp = INT_TO_JSVAL(prop);
}
else {
return JS_FALSE;
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
@ -163,7 +175,22 @@ SetEditorAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
case EDITORAPPCORE_WRAPCOLUMN:
{
PRInt32 prop;
int32 temp;
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
prop = (PRInt32)temp;
}
else {
JS_ReportError(cx, "Parameter must be a number");
return JS_FALSE;
}
a->SetWrapColumn(prop);
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
@ -1407,6 +1434,7 @@ static JSPropertySpec EditorAppCoreProperties[] =
{"editorDocument", EDITORAPPCORE_EDITORDOCUMENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{"editorSelection", EDITORAPPCORE_EDITORSELECTION, JSPROP_ENUMERATE | JSPROP_READONLY},
{"ParagraphFormat", EDITORAPPCORE_PARAGRAPHFORMAT, JSPROP_ENUMERATE | JSPROP_READONLY},
{"wrapColumn", EDITORAPPCORE_WRAPCOLUMN, JSPROP_ENUMERATE},
{0}
};