changing nsXifconverter to nsIXifConverter

This commit is contained in:
mjudge%netscape.com 2000-05-13 08:11:29 +00:00
Родитель 1360793455
Коммит e1816be991
6 изменённых файлов: 50 добавлений и 44 удалений

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

@ -100,6 +100,9 @@
#include "nsIPref.h" #include "nsIPref.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsIDocumentEncoder.h" //for outputting selection
#define DETECTOR_PROGID_MAX 127 #define DETECTOR_PROGID_MAX 127
static char g_detector_progid[DETECTOR_PROGID_MAX + 1]; static char g_detector_progid[DETECTOR_PROGID_MAX + 1];
static PRBool gInitDetector = PR_FALSE; static PRBool gInitDetector = PR_FALSE;
@ -2490,7 +2493,7 @@ nsHTMLDocument::GetSelection(nsString& aReturn)
consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Depricated method document.getSelection() called, use window.getSelection() in stead!").GetUnicode()); consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Depricated method document.getSelection() called, use window.getSelection() in stead!").GetUnicode());
} }
return domSelection->ToString(aReturn); return domSelection->ToString(NS_ConvertASCIItoUCS2("text/plain"), nsIDocumentEncoder::OutputFormatted |nsIDocumentEncoder::OutputSelectionOnly, 0, aReturn);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -33,7 +33,7 @@
#include "nsICSSDeclaration.h" #include "nsICSSDeclaration.h"
#include "nsIHTMLCSSStyleSheet.h" #include "nsIHTMLCSSStyleSheet.h"
#include "nsHTMLValue.h" #include "nsHTMLValue.h"
#include "nsXIFConverter.h" #include "nsIXIFConverter.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
@ -89,16 +89,16 @@ nsMarkupDocument::CreateShell(nsIPresContext* aContext,
* @param aConverter -- the XIFConverter where all output is being written * @param aConverter -- the XIFConverter where all output is being written
* @param aSelector -- the Object to be converted to XIF * @param aSelector -- the Object to be converted to XIF
*/ */
void nsMarkupDocument::CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyleRule& aRule) void nsMarkupDocument::CSSSelectorsToXIF(nsIXIFConverter* aConverter, nsICSSStyleRule& aRule)
{ {
nsAutoString selectors; nsAutoString selectors;
aRule.GetSourceSelectorText(selectors); aRule.GetSourceSelectorText(selectors);
aConverter.BeginCSSSelectors(); aConverter->BeginCSSSelectors();
aConverter.AddCSSSelectors(selectors); aConverter->AddCSSSelectors(selectors);
aConverter.EndCSSSelectors(); aConverter->EndCSSSelectors();
} }
@ -109,12 +109,12 @@ void nsMarkupDocument::CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyle
* @param aConverter -- the XIFConverter where all output is being written * @param aConverter -- the XIFConverter where all output is being written
* @param aDeclaration -- the Object to be converted to XIF * @param aDeclaration -- the Object to be converted to XIF
*/ */
void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDeclaration& aDeclaration) void nsMarkupDocument::CSSDeclarationToXIF(nsIXIFConverter* aConverter, nsICSSDeclaration& aDeclaration)
{ {
nsAutoString list; nsAutoString list;
nsAutoString decl; nsAutoString decl;
aConverter.BeginCSSDeclarationList(); aConverter->BeginCSSDeclarationList();
aDeclaration.ToString(list); aDeclaration.ToString(list);
PRInt32 start = 0; PRInt32 start = 0;
@ -132,21 +132,21 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec
nsAutoString property; nsAutoString property;
nsAutoString value; nsAutoString value;
aConverter.BeginCSSDeclaration(); aConverter->BeginCSSDeclaration();
if (-1 < colon) { if (-1 < colon) {
decl.Left(property, colon); decl.Left(property, colon);
property.StripWhitespace(); property.StripWhitespace();
decl.Right(value, (decl.Length() - colon) - 2); decl.Right(value, (decl.Length() - colon) - 2);
aConverter.AddCSSDeclaration(property, value); aConverter->AddCSSDeclaration(property, value);
} }
aConverter.EndCSSDeclaration(); aConverter->EndCSSDeclaration();
} }
start = ++semiColon; start = ++semiColon;
semiColon = list.FindChar(';', PR_FALSE,start); semiColon = list.FindChar(';', PR_FALSE,start);
} }
aConverter.EndCSSDeclarationList(); aConverter->EndCSSDeclarationList();
} }
@ -157,7 +157,7 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec
* @param aConverter -- the XIFConverter where all output is being written * @param aConverter -- the XIFConverter where all output is being written
* @param aDeclaration -- the Object to be converted to XIF * @param aDeclaration -- the Object to be converted to XIF
*/ */
void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) void nsMarkupDocument::StyleSheetsToXIF(nsIXIFConverter* aConverter)
{ {
PRInt32 count = GetNumberOfStyleSheets(); PRInt32 count = GetNumberOfStyleSheets();
@ -194,12 +194,12 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter)
cssSheet->StyleRuleCount(ruleCount); cssSheet->StyleRuleCount(ruleCount);
if (ruleCount > 0) if (ruleCount > 0)
{ {
aConverter.BeginCSSStyleSheet(); aConverter->BeginCSSStyleSheet();
for (ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++) for (ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++)
{ {
if (NS_OK == cssSheet->GetStyleRuleAt(ruleIndex, rule)) if (NS_OK == cssSheet->GetStyleRuleAt(ruleIndex, rule))
{ {
aConverter.BeginCSSRule(); aConverter->BeginCSSRule();
if (nsnull != rule) if (nsnull != rule)
{ {
@ -219,10 +219,10 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter)
NS_IF_RELEASE(rule); NS_IF_RELEASE(rule);
} // ruleAt } // ruleAt
aConverter.EndCSSRule(); aConverter->EndCSSRule();
} // for loop } // for loop
} }
aConverter.EndCSSStyleSheet(); aConverter->EndCSSStyleSheet();
} // if ruleCount > 0 } // if ruleCount > 0
NS_RELEASE(cssSheet); NS_RELEASE(cssSheet);
} // css_sheet } // css_sheet
@ -232,7 +232,7 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter)
} }
void nsMarkupDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) void nsMarkupDocument::FinishConvertToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode)
{ {
nsIContent* content = nsnull; nsIContent* content = nsnull;
nsresult isContent = aNode->QueryInterface(kIContentIID, (void**)&content); nsresult isContent = aNode->QueryInterface(kIContentIID, (void**)&content);

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

@ -53,7 +53,7 @@ public:
* NOTE: we may way to place the result in a stream, * NOTE: we may way to place the result in a stream,
* but we will use a string for now -- gpk * but we will use a string for now -- gpk
*/ */
virtual void FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode); virtual void FinishConvertToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode);
// XXX Temp hack: moved from nsDocument // XXX Temp hack: moved from nsDocument
NS_IMETHOD CreateShell(nsIPresContext* aContext, NS_IMETHOD CreateShell(nsIPresContext* aContext,
@ -62,9 +62,9 @@ public:
nsIPresShell** aInstancePtrResult); nsIPresShell** aInstancePtrResult);
protected: protected:
virtual void CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyleRule& aRule); virtual void CSSSelectorsToXIF(nsIXIFConverter* aConverter, nsICSSStyleRule& aRule);
virtual void CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDeclaration& aDeclaration); virtual void CSSDeclarationToXIF(nsIXIFConverter* aConverter, nsICSSDeclaration& aDeclaration);
virtual void StyleSheetsToXIF(nsXIFConverter& aConverter); virtual void StyleSheetsToXIF(nsIXIFConverter* aConverter);
private: private:

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

@ -100,6 +100,9 @@
#include "nsIPref.h" #include "nsIPref.h"
#include "nsLayoutUtils.h" #include "nsLayoutUtils.h"
#include "nsIDocumentEncoder.h" //for outputting selection
#define DETECTOR_PROGID_MAX 127 #define DETECTOR_PROGID_MAX 127
static char g_detector_progid[DETECTOR_PROGID_MAX + 1]; static char g_detector_progid[DETECTOR_PROGID_MAX + 1];
static PRBool gInitDetector = PR_FALSE; static PRBool gInitDetector = PR_FALSE;
@ -2490,7 +2493,7 @@ nsHTMLDocument::GetSelection(nsString& aReturn)
consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Depricated method document.getSelection() called, use window.getSelection() in stead!").GetUnicode()); consoleService->LogStringMessage(NS_ConvertASCIItoUCS2("Depricated method document.getSelection() called, use window.getSelection() in stead!").GetUnicode());
} }
return domSelection->ToString(aReturn); return domSelection->ToString(NS_ConvertASCIItoUCS2("text/plain"), nsIDocumentEncoder::OutputFormatted |nsIDocumentEncoder::OutputSelectionOnly, 0, aReturn);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -33,7 +33,7 @@
#include "nsICSSDeclaration.h" #include "nsICSSDeclaration.h"
#include "nsIHTMLCSSStyleSheet.h" #include "nsIHTMLCSSStyleSheet.h"
#include "nsHTMLValue.h" #include "nsHTMLValue.h"
#include "nsXIFConverter.h" #include "nsIXIFConverter.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
@ -89,16 +89,16 @@ nsMarkupDocument::CreateShell(nsIPresContext* aContext,
* @param aConverter -- the XIFConverter where all output is being written * @param aConverter -- the XIFConverter where all output is being written
* @param aSelector -- the Object to be converted to XIF * @param aSelector -- the Object to be converted to XIF
*/ */
void nsMarkupDocument::CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyleRule& aRule) void nsMarkupDocument::CSSSelectorsToXIF(nsIXIFConverter* aConverter, nsICSSStyleRule& aRule)
{ {
nsAutoString selectors; nsAutoString selectors;
aRule.GetSourceSelectorText(selectors); aRule.GetSourceSelectorText(selectors);
aConverter.BeginCSSSelectors(); aConverter->BeginCSSSelectors();
aConverter.AddCSSSelectors(selectors); aConverter->AddCSSSelectors(selectors);
aConverter.EndCSSSelectors(); aConverter->EndCSSSelectors();
} }
@ -109,12 +109,12 @@ void nsMarkupDocument::CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyle
* @param aConverter -- the XIFConverter where all output is being written * @param aConverter -- the XIFConverter where all output is being written
* @param aDeclaration -- the Object to be converted to XIF * @param aDeclaration -- the Object to be converted to XIF
*/ */
void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDeclaration& aDeclaration) void nsMarkupDocument::CSSDeclarationToXIF(nsIXIFConverter* aConverter, nsICSSDeclaration& aDeclaration)
{ {
nsAutoString list; nsAutoString list;
nsAutoString decl; nsAutoString decl;
aConverter.BeginCSSDeclarationList(); aConverter->BeginCSSDeclarationList();
aDeclaration.ToString(list); aDeclaration.ToString(list);
PRInt32 start = 0; PRInt32 start = 0;
@ -132,21 +132,21 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec
nsAutoString property; nsAutoString property;
nsAutoString value; nsAutoString value;
aConverter.BeginCSSDeclaration(); aConverter->BeginCSSDeclaration();
if (-1 < colon) { if (-1 < colon) {
decl.Left(property, colon); decl.Left(property, colon);
property.StripWhitespace(); property.StripWhitespace();
decl.Right(value, (decl.Length() - colon) - 2); decl.Right(value, (decl.Length() - colon) - 2);
aConverter.AddCSSDeclaration(property, value); aConverter->AddCSSDeclaration(property, value);
} }
aConverter.EndCSSDeclaration(); aConverter->EndCSSDeclaration();
} }
start = ++semiColon; start = ++semiColon;
semiColon = list.FindChar(';', PR_FALSE,start); semiColon = list.FindChar(';', PR_FALSE,start);
} }
aConverter.EndCSSDeclarationList(); aConverter->EndCSSDeclarationList();
} }
@ -157,7 +157,7 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec
* @param aConverter -- the XIFConverter where all output is being written * @param aConverter -- the XIFConverter where all output is being written
* @param aDeclaration -- the Object to be converted to XIF * @param aDeclaration -- the Object to be converted to XIF
*/ */
void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) void nsMarkupDocument::StyleSheetsToXIF(nsIXIFConverter* aConverter)
{ {
PRInt32 count = GetNumberOfStyleSheets(); PRInt32 count = GetNumberOfStyleSheets();
@ -194,12 +194,12 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter)
cssSheet->StyleRuleCount(ruleCount); cssSheet->StyleRuleCount(ruleCount);
if (ruleCount > 0) if (ruleCount > 0)
{ {
aConverter.BeginCSSStyleSheet(); aConverter->BeginCSSStyleSheet();
for (ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++) for (ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++)
{ {
if (NS_OK == cssSheet->GetStyleRuleAt(ruleIndex, rule)) if (NS_OK == cssSheet->GetStyleRuleAt(ruleIndex, rule))
{ {
aConverter.BeginCSSRule(); aConverter->BeginCSSRule();
if (nsnull != rule) if (nsnull != rule)
{ {
@ -219,10 +219,10 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter)
NS_IF_RELEASE(rule); NS_IF_RELEASE(rule);
} // ruleAt } // ruleAt
aConverter.EndCSSRule(); aConverter->EndCSSRule();
} // for loop } // for loop
} }
aConverter.EndCSSStyleSheet(); aConverter->EndCSSStyleSheet();
} // if ruleCount > 0 } // if ruleCount > 0
NS_RELEASE(cssSheet); NS_RELEASE(cssSheet);
} // css_sheet } // css_sheet
@ -232,7 +232,7 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter)
} }
void nsMarkupDocument::FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) void nsMarkupDocument::FinishConvertToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode)
{ {
nsIContent* content = nsnull; nsIContent* content = nsnull;
nsresult isContent = aNode->QueryInterface(kIContentIID, (void**)&content); nsresult isContent = aNode->QueryInterface(kIContentIID, (void**)&content);

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

@ -53,7 +53,7 @@ public:
* NOTE: we may way to place the result in a stream, * NOTE: we may way to place the result in a stream,
* but we will use a string for now -- gpk * but we will use a string for now -- gpk
*/ */
virtual void FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode); virtual void FinishConvertToXIF(nsIXIFConverter* aConverter, nsIDOMNode* aNode);
// XXX Temp hack: moved from nsDocument // XXX Temp hack: moved from nsDocument
NS_IMETHOD CreateShell(nsIPresContext* aContext, NS_IMETHOD CreateShell(nsIPresContext* aContext,
@ -62,9 +62,9 @@ public:
nsIPresShell** aInstancePtrResult); nsIPresShell** aInstancePtrResult);
protected: protected:
virtual void CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyleRule& aRule); virtual void CSSSelectorsToXIF(nsIXIFConverter* aConverter, nsICSSStyleRule& aRule);
virtual void CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDeclaration& aDeclaration); virtual void CSSDeclarationToXIF(nsIXIFConverter* aConverter, nsICSSDeclaration& aDeclaration);
virtual void StyleSheetsToXIF(nsXIFConverter& aConverter); virtual void StyleSheetsToXIF(nsIXIFConverter* aConverter);
private: private: