From dd4523397caa0d7e08c653784737030e377c2b97 Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Sat, 13 May 2000 08:11:29 +0000 Subject: [PATCH] changing nsXifconverter to nsIXifConverter git-svn-id: svn://10.0.0.236/trunk@69548 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLDocument.cpp | 5 ++- .../html/document/src/nsMarkupDocument.cpp | 34 +++++++++---------- .../html/document/src/nsMarkupDocument.h | 8 ++--- .../html/document/src/nsHTMLDocument.cpp | 5 ++- .../html/document/src/nsMarkupDocument.cpp | 34 +++++++++---------- .../html/document/src/nsMarkupDocument.h | 8 ++--- 6 files changed, 50 insertions(+), 44 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index f756919b376..448a5ea672c 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -100,6 +100,9 @@ #include "nsIPref.h" #include "nsLayoutUtils.h" +#include "nsIDocumentEncoder.h" //for outputting selection + + #define DETECTOR_PROGID_MAX 127 static char g_detector_progid[DETECTOR_PROGID_MAX + 1]; 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()); } - return domSelection->ToString(aReturn); + return domSelection->ToString(NS_ConvertASCIItoUCS2("text/plain"), nsIDocumentEncoder::OutputFormatted |nsIDocumentEncoder::OutputSelectionOnly, 0, aReturn); } NS_IMETHODIMP diff --git a/mozilla/content/html/document/src/nsMarkupDocument.cpp b/mozilla/content/html/document/src/nsMarkupDocument.cpp index 2b6032761cd..76b750f603d 100644 --- a/mozilla/content/html/document/src/nsMarkupDocument.cpp +++ b/mozilla/content/html/document/src/nsMarkupDocument.cpp @@ -33,7 +33,7 @@ #include "nsICSSDeclaration.h" #include "nsIHTMLCSSStyleSheet.h" #include "nsHTMLValue.h" -#include "nsXIFConverter.h" +#include "nsIXIFConverter.h" #include "nsIPresShell.h" @@ -89,16 +89,16 @@ nsMarkupDocument::CreateShell(nsIPresContext* aContext, * @param aConverter -- the XIFConverter where all output is being written * @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; 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 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 decl; - aConverter.BeginCSSDeclarationList(); + aConverter->BeginCSSDeclarationList(); aDeclaration.ToString(list); PRInt32 start = 0; @@ -132,21 +132,21 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec nsAutoString property; nsAutoString value; - aConverter.BeginCSSDeclaration(); + aConverter->BeginCSSDeclaration(); if (-1 < colon) { decl.Left(property, colon); property.StripWhitespace(); decl.Right(value, (decl.Length() - colon) - 2); - aConverter.AddCSSDeclaration(property, value); + aConverter->AddCSSDeclaration(property, value); } - aConverter.EndCSSDeclaration(); + aConverter->EndCSSDeclaration(); } start = ++semiColon; 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 aDeclaration -- the Object to be converted to XIF */ -void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) +void nsMarkupDocument::StyleSheetsToXIF(nsIXIFConverter* aConverter) { PRInt32 count = GetNumberOfStyleSheets(); @@ -194,12 +194,12 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) cssSheet->StyleRuleCount(ruleCount); if (ruleCount > 0) { - aConverter.BeginCSSStyleSheet(); + aConverter->BeginCSSStyleSheet(); for (ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++) { if (NS_OK == cssSheet->GetStyleRuleAt(ruleIndex, rule)) { - aConverter.BeginCSSRule(); + aConverter->BeginCSSRule(); if (nsnull != rule) { @@ -219,10 +219,10 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) NS_IF_RELEASE(rule); } // ruleAt - aConverter.EndCSSRule(); + aConverter->EndCSSRule(); } // for loop } - aConverter.EndCSSStyleSheet(); + aConverter->EndCSSStyleSheet(); } // if ruleCount > 0 NS_RELEASE(cssSheet); } // 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; nsresult isContent = aNode->QueryInterface(kIContentIID, (void**)&content); diff --git a/mozilla/content/html/document/src/nsMarkupDocument.h b/mozilla/content/html/document/src/nsMarkupDocument.h index 5b31e3b32bc..e53f65679cb 100644 --- a/mozilla/content/html/document/src/nsMarkupDocument.h +++ b/mozilla/content/html/document/src/nsMarkupDocument.h @@ -53,7 +53,7 @@ public: * NOTE: we may way to place the result in a stream, * 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 NS_IMETHOD CreateShell(nsIPresContext* aContext, @@ -62,9 +62,9 @@ public: nsIPresShell** aInstancePtrResult); protected: - virtual void CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyleRule& aRule); - virtual void CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDeclaration& aDeclaration); - virtual void StyleSheetsToXIF(nsXIFConverter& aConverter); + virtual void CSSSelectorsToXIF(nsIXIFConverter* aConverter, nsICSSStyleRule& aRule); + virtual void CSSDeclarationToXIF(nsIXIFConverter* aConverter, nsICSSDeclaration& aDeclaration); + virtual void StyleSheetsToXIF(nsIXIFConverter* aConverter); private: diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index f756919b376..448a5ea672c 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -100,6 +100,9 @@ #include "nsIPref.h" #include "nsLayoutUtils.h" +#include "nsIDocumentEncoder.h" //for outputting selection + + #define DETECTOR_PROGID_MAX 127 static char g_detector_progid[DETECTOR_PROGID_MAX + 1]; 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()); } - return domSelection->ToString(aReturn); + return domSelection->ToString(NS_ConvertASCIItoUCS2("text/plain"), nsIDocumentEncoder::OutputFormatted |nsIDocumentEncoder::OutputSelectionOnly, 0, aReturn); } NS_IMETHODIMP diff --git a/mozilla/layout/html/document/src/nsMarkupDocument.cpp b/mozilla/layout/html/document/src/nsMarkupDocument.cpp index 2b6032761cd..76b750f603d 100644 --- a/mozilla/layout/html/document/src/nsMarkupDocument.cpp +++ b/mozilla/layout/html/document/src/nsMarkupDocument.cpp @@ -33,7 +33,7 @@ #include "nsICSSDeclaration.h" #include "nsIHTMLCSSStyleSheet.h" #include "nsHTMLValue.h" -#include "nsXIFConverter.h" +#include "nsIXIFConverter.h" #include "nsIPresShell.h" @@ -89,16 +89,16 @@ nsMarkupDocument::CreateShell(nsIPresContext* aContext, * @param aConverter -- the XIFConverter where all output is being written * @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; 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 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 decl; - aConverter.BeginCSSDeclarationList(); + aConverter->BeginCSSDeclarationList(); aDeclaration.ToString(list); PRInt32 start = 0; @@ -132,21 +132,21 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec nsAutoString property; nsAutoString value; - aConverter.BeginCSSDeclaration(); + aConverter->BeginCSSDeclaration(); if (-1 < colon) { decl.Left(property, colon); property.StripWhitespace(); decl.Right(value, (decl.Length() - colon) - 2); - aConverter.AddCSSDeclaration(property, value); + aConverter->AddCSSDeclaration(property, value); } - aConverter.EndCSSDeclaration(); + aConverter->EndCSSDeclaration(); } start = ++semiColon; 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 aDeclaration -- the Object to be converted to XIF */ -void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) +void nsMarkupDocument::StyleSheetsToXIF(nsIXIFConverter* aConverter) { PRInt32 count = GetNumberOfStyleSheets(); @@ -194,12 +194,12 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) cssSheet->StyleRuleCount(ruleCount); if (ruleCount > 0) { - aConverter.BeginCSSStyleSheet(); + aConverter->BeginCSSStyleSheet(); for (ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++) { if (NS_OK == cssSheet->GetStyleRuleAt(ruleIndex, rule)) { - aConverter.BeginCSSRule(); + aConverter->BeginCSSRule(); if (nsnull != rule) { @@ -219,10 +219,10 @@ void nsMarkupDocument::StyleSheetsToXIF(nsXIFConverter& aConverter) NS_IF_RELEASE(rule); } // ruleAt - aConverter.EndCSSRule(); + aConverter->EndCSSRule(); } // for loop } - aConverter.EndCSSStyleSheet(); + aConverter->EndCSSStyleSheet(); } // if ruleCount > 0 NS_RELEASE(cssSheet); } // 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; nsresult isContent = aNode->QueryInterface(kIContentIID, (void**)&content); diff --git a/mozilla/layout/html/document/src/nsMarkupDocument.h b/mozilla/layout/html/document/src/nsMarkupDocument.h index 5b31e3b32bc..e53f65679cb 100644 --- a/mozilla/layout/html/document/src/nsMarkupDocument.h +++ b/mozilla/layout/html/document/src/nsMarkupDocument.h @@ -53,7 +53,7 @@ public: * NOTE: we may way to place the result in a stream, * 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 NS_IMETHOD CreateShell(nsIPresContext* aContext, @@ -62,9 +62,9 @@ public: nsIPresShell** aInstancePtrResult); protected: - virtual void CSSSelectorsToXIF(nsXIFConverter& aConverter, nsICSSStyleRule& aRule); - virtual void CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDeclaration& aDeclaration); - virtual void StyleSheetsToXIF(nsXIFConverter& aConverter); + virtual void CSSSelectorsToXIF(nsIXIFConverter* aConverter, nsICSSStyleRule& aRule); + virtual void CSSDeclarationToXIF(nsIXIFConverter* aConverter, nsICSSDeclaration& aDeclaration); + virtual void StyleSheetsToXIF(nsIXIFConverter* aConverter); private: