зеркало из https://github.com/mozilla/pjs.git
Bug 474369 - get rid of nsVoidArray; widget part; r+sr=roc
This commit is contained in:
Родитель
864a45296a
Коммит
7b9bf0ac75
|
@ -41,7 +41,6 @@
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDeviceContextSpec.h"
|
#include "nsIDeviceContextSpec.h"
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsIPrintSettings.h"
|
#include "nsIPrintSettings.h"
|
||||||
#include "nsIPrintOptions.h"
|
#include "nsIPrintOptions.h"
|
||||||
// For public interface?
|
// For public interface?
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include "nsITransferable.h"
|
#include "nsITransferable.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsPrimitiveHelpers.h"
|
#include "nsPrimitiveHelpers.h"
|
||||||
#include "nsWidgetsCID.h"
|
#include "nsWidgetsCID.h"
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "prtime.h"
|
#include "prtime.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsTPtrArray.h"
|
||||||
#include "nsIProxyObjectManager.h"
|
#include "nsIProxyObjectManager.h"
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
@ -101,7 +101,7 @@ static BWindow * gLastActiveWindow = NULL;
|
||||||
// such as regxpcom, do not create a BApplication object, and therefor fail to run.,
|
// such as regxpcom, do not create a BApplication object, and therefor fail to run.,
|
||||||
// since a BCursor requires a vaild BApplication (see Bug#129964). But, we still want
|
// since a BCursor requires a vaild BApplication (see Bug#129964). But, we still want
|
||||||
// to cache them for performance. Currently, there are 17 cursors available;
|
// to cache them for performance. Currently, there are 17 cursors available;
|
||||||
static nsVoidArray gCursorArray(21);
|
static nsTPtrArray<BCursor> gCursorArray(21);
|
||||||
// Used in contrain position. Specifies how much of a window must remain on screen
|
// Used in contrain position. Specifies how much of a window must remain on screen
|
||||||
#define kWindowPositionSlop 20
|
#define kWindowPositionSlop 20
|
||||||
// BeOS does not provide this information, so we must hard-code it
|
// BeOS does not provide this information, so we must hard-code it
|
||||||
|
@ -1259,29 +1259,29 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor)
|
||||||
be_app->ShowCursor();
|
be_app->ShowCursor();
|
||||||
|
|
||||||
// Check to see if the array has been loaded, if not, do it.
|
// Check to see if the array has been loaded, if not, do it.
|
||||||
if (gCursorArray.Count() == 0)
|
if (gCursorArray.Length() == 0)
|
||||||
{
|
{
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorHyperlink),0);
|
gCursorArray.InsertElementAt(0 , new BCursor(cursorHyperlink));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorHorizontalDrag),1);
|
gCursorArray.InsertElementAt(1 , new BCursor(cursorHorizontalDrag));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorVerticalDrag),2);
|
gCursorArray.InsertElementAt(2 , new BCursor(cursorVerticalDrag));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorUpperLeft),3);
|
gCursorArray.InsertElementAt(3 , new BCursor(cursorUpperLeft));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorLowerRight),4);
|
gCursorArray.InsertElementAt(4 , new BCursor(cursorLowerRight));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorUpperRight),5);
|
gCursorArray.InsertElementAt(5 , new BCursor(cursorUpperRight));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorLowerLeft),6);
|
gCursorArray.InsertElementAt(6 , new BCursor(cursorLowerLeft));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorCrosshair),7);
|
gCursorArray.InsertElementAt(7 , new BCursor(cursorCrosshair));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorHelp),8);
|
gCursorArray.InsertElementAt(8 , new BCursor(cursorHelp));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorGrab),9);
|
gCursorArray.InsertElementAt(9 , new BCursor(cursorGrab));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorGrabbing),10);
|
gCursorArray.InsertElementAt(10, new BCursor(cursorGrabbing));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorCopy),11);
|
gCursorArray.InsertElementAt(11, new BCursor(cursorCopy));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorAlias),12);
|
gCursorArray.InsertElementAt(12, new BCursor(cursorAlias));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorWatch2),13);
|
gCursorArray.InsertElementAt(13, new BCursor(cursorWatch2));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorCell),14);
|
gCursorArray.InsertElementAt(14, new BCursor(cursorCell));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorZoomIn),15);
|
gCursorArray.InsertElementAt(15, new BCursor(cursorZoomIn));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorZoomOut),16);
|
gCursorArray.InsertElementAt(16, new BCursor(cursorZoomOut));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorLeft),17);
|
gCursorArray.InsertElementAt(17, new BCursor(cursorLeft));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorRight),18);
|
gCursorArray.InsertElementAt(18, new BCursor(cursorRight));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorTop),19);
|
gCursorArray.InsertElementAt(19, new BCursor(cursorTop));
|
||||||
gCursorArray.InsertElementAt((void*) new BCursor(cursorBottom),20);
|
gCursorArray.InsertElementAt(20, new BCursor(cursorBottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (aCursor)
|
switch (aCursor)
|
||||||
|
@ -1296,55 +1296,55 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_hyperlink:
|
case eCursor_hyperlink:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(0);
|
newCursor = gCursorArray.SafeElementAt(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_n_resize:
|
case eCursor_n_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(19);
|
newCursor = gCursorArray.SafeElementAt(19);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_s_resize:
|
case eCursor_s_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(20);
|
newCursor = gCursorArray.SafeElementAt(20);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_w_resize:
|
case eCursor_w_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(17);
|
newCursor = gCursorArray.SafeElementAt(17);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_e_resize:
|
case eCursor_e_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(18);
|
newCursor = gCursorArray.SafeElementAt(18);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_nw_resize:
|
case eCursor_nw_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(3);
|
newCursor = gCursorArray.SafeElementAt(3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_se_resize:
|
case eCursor_se_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(4);
|
newCursor = gCursorArray.SafeElementAt(4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_ne_resize:
|
case eCursor_ne_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(5);
|
newCursor = gCursorArray.SafeElementAt(5);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_sw_resize:
|
case eCursor_sw_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(6);
|
newCursor = gCursorArray.SafeElementAt(6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_crosshair:
|
case eCursor_crosshair:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(7);
|
newCursor = gCursorArray.SafeElementAt(7);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_help:
|
case eCursor_help:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(8);
|
newCursor = gCursorArray.SafeElementAt(8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_copy:
|
case eCursor_copy:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(11);
|
newCursor = gCursorArray.SafeElementAt(11);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_alias:
|
case eCursor_alias:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(12);
|
newCursor = gCursorArray.SafeElementAt(12);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_context_menu:
|
case eCursor_context_menu:
|
||||||
|
@ -1352,28 +1352,28 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_cell:
|
case eCursor_cell:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(14);
|
newCursor = gCursorArray.SafeElementAt(14);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_grab:
|
case eCursor_grab:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(9);
|
newCursor = gCursorArray.SafeElementAt(9);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_grabbing:
|
case eCursor_grabbing:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(10);
|
newCursor = gCursorArray.SafeElementAt(10);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_wait:
|
case eCursor_wait:
|
||||||
case eCursor_spinning:
|
case eCursor_spinning:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(13);
|
newCursor = gCursorArray.SafeElementAt(13);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_zoom_in:
|
case eCursor_zoom_in:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(15);
|
newCursor = gCursorArray.SafeElementAt(15);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_zoom_out:
|
case eCursor_zoom_out:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(16);
|
newCursor = gCursorArray.SafeElementAt(16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_not_allowed:
|
case eCursor_not_allowed:
|
||||||
|
@ -1383,12 +1383,12 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor)
|
||||||
|
|
||||||
case eCursor_col_resize:
|
case eCursor_col_resize:
|
||||||
// XXX not 100% appropriate perhaps
|
// XXX not 100% appropriate perhaps
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(1);
|
newCursor = gCursorArray.SafeElementAt(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_row_resize:
|
case eCursor_row_resize:
|
||||||
// XXX not 100% appropriate perhaps
|
// XXX not 100% appropriate perhaps
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(2);
|
newCursor = gCursorArray.SafeElementAt(2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_vertical_text:
|
case eCursor_vertical_text:
|
||||||
|
@ -1402,20 +1402,20 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor)
|
||||||
|
|
||||||
case eCursor_nesw_resize:
|
case eCursor_nesw_resize:
|
||||||
// XXX not 100% appropriate perhaps
|
// XXX not 100% appropriate perhaps
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(1);
|
newCursor = gCursorArray.SafeElementAt(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_nwse_resize:
|
case eCursor_nwse_resize:
|
||||||
// XXX not 100% appropriate perhaps
|
// XXX not 100% appropriate perhaps
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(1);
|
newCursor = gCursorArray.SafeElementAt(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_ns_resize:
|
case eCursor_ns_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(2);
|
newCursor = gCursorArray.SafeElementAt(2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_ew_resize:
|
case eCursor_ew_resize:
|
||||||
newCursor = (BCursor *)gCursorArray.SafeElementAt(1);
|
newCursor = gCursorArray.SafeElementAt(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eCursor_none:
|
case eCursor_none:
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include "nsIFileURL.h"
|
#include "nsIFileURL.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsPrimitiveHelpers.h"
|
#include "nsPrimitiveHelpers.h"
|
||||||
#include "prtime.h"
|
#include "prtime.h"
|
||||||
#include "prthread.h"
|
#include "prthread.h"
|
||||||
|
@ -977,7 +977,7 @@ nsDragService::GetSourceList(void)
|
||||||
{
|
{
|
||||||
if (!mSourceDataItems)
|
if (!mSourceDataItems)
|
||||||
return NULL;
|
return NULL;
|
||||||
nsVoidArray targetArray;
|
nsTArray<GtkTargetEntry*> targetArray;
|
||||||
GtkTargetEntry *targets;
|
GtkTargetEntry *targets;
|
||||||
GtkTargetList *targetList = 0;
|
GtkTargetList *targetList = 0;
|
||||||
PRUint32 targetCount = 0;
|
PRUint32 targetCount = 0;
|
||||||
|
@ -1126,15 +1126,14 @@ nsDragService::GetSourceList(void)
|
||||||
} // if it is a single item drag
|
} // if it is a single item drag
|
||||||
|
|
||||||
// get all the elements that we created.
|
// get all the elements that we created.
|
||||||
targetCount = targetArray.Count();
|
targetCount = targetArray.Length();
|
||||||
if (targetCount) {
|
if (targetCount) {
|
||||||
// allocate space to create the list of valid targets
|
// allocate space to create the list of valid targets
|
||||||
targets =
|
targets =
|
||||||
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry) * targetCount);
|
(GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry) * targetCount);
|
||||||
PRUint32 targetIndex;
|
PRUint32 targetIndex;
|
||||||
for ( targetIndex = 0; targetIndex < targetCount; ++targetIndex) {
|
for ( targetIndex = 0; targetIndex < targetCount; ++targetIndex) {
|
||||||
GtkTargetEntry *disEntry =
|
GtkTargetEntry *disEntry = targetArray.ElementAt(targetIndex);
|
||||||
(GtkTargetEntry *)targetArray.ElementAt(targetIndex);
|
|
||||||
// this is a string reference but it will be freed later.
|
// this is a string reference but it will be freed later.
|
||||||
targets[targetIndex].target = disEntry->target;
|
targets[targetIndex].target = disEntry->target;
|
||||||
targets[targetIndex].flags = disEntry->flags;
|
targets[targetIndex].flags = disEntry->flags;
|
||||||
|
@ -1143,8 +1142,7 @@ nsDragService::GetSourceList(void)
|
||||||
targetList = gtk_target_list_new(targets, targetCount);
|
targetList = gtk_target_list_new(targets, targetCount);
|
||||||
// clean up the target list
|
// clean up the target list
|
||||||
for (PRUint32 cleanIndex = 0; cleanIndex < targetCount; ++cleanIndex) {
|
for (PRUint32 cleanIndex = 0; cleanIndex < targetCount; ++cleanIndex) {
|
||||||
GtkTargetEntry *thisTarget =
|
GtkTargetEntry *thisTarget = targetArray.ElementAt(cleanIndex);
|
||||||
(GtkTargetEntry *)targetArray.ElementAt(cleanIndex);
|
|
||||||
g_free(thisTarget->target);
|
g_free(thisTarget->target);
|
||||||
g_free(thisTarget);
|
g_free(thisTarget);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "nsIDeviceContextSpec.h"
|
#include "nsIDeviceContextSpec.h"
|
||||||
#include "nsIPrintOptions.h"
|
#include "nsIPrintOptions.h"
|
||||||
#include "nsIPrintSettings.h"
|
#include "nsIPrintSettings.h"
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsPrintdOS2.h"
|
#include "nsPrintdOS2.h"
|
||||||
#include <os2.h>
|
#include <os2.h>
|
||||||
#include <pmddim.h>
|
#include <pmddim.h>
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
// OS/2 defines; for user messages & warp4 stuff, plus module-global data
|
// OS/2 defines; for user messages & warp4 stuff, plus module-global data
|
||||||
|
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsVoidArray.h"
|
|
||||||
|
|
||||||
#define INCL_PM
|
#define INCL_PM
|
||||||
#define INCL_NLS
|
#define INCL_NLS
|
||||||
|
|
|
@ -395,8 +395,8 @@ nsDataObj::~nsDataObj()
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(mTransferable);
|
NS_IF_RELEASE(mTransferable);
|
||||||
|
|
||||||
for (PRInt32 i = 0; i < mDataFlavors.Count(); ++i) {
|
for (PRUint32 i = 0; i < mDataFlavors.Length(); ++i) {
|
||||||
delete reinterpret_cast<nsCString *>(mDataFlavors.ElementAt(i));
|
delete mDataFlavors.ElementAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_enumFE->Release();
|
m_enumFE->Release();
|
||||||
|
@ -498,7 +498,7 @@ STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
|
||||||
FORMATETC fe;
|
FORMATETC fe;
|
||||||
m_enumFE->Reset();
|
m_enumFE->Reset();
|
||||||
while (NOERROR == m_enumFE->Next(1, &fe, &count)) {
|
while (NOERROR == m_enumFE->Next(1, &fe, &count)) {
|
||||||
nsCString * df = reinterpret_cast<nsCString*>(mDataFlavors.SafeElementAt(dfInx));
|
nsCString * df = mDataFlavors.SafeElementAt(dfInx);
|
||||||
if ( df ) {
|
if ( df ) {
|
||||||
if (FormatsMatch(fe, *pFE)) {
|
if (FormatsMatch(fe, *pFE)) {
|
||||||
pSTM->pUnkForRelease = NULL; // caller is responsible for deleting this data
|
pSTM->pUnkForRelease = NULL; // caller is responsible for deleting this data
|
||||||
|
@ -1373,7 +1373,7 @@ HRESULT nsDataObj::GetFile(FORMATETC& aFE, STGMEDIUM& aSTG)
|
||||||
m_enumFE->Reset();
|
m_enumFE->Reset();
|
||||||
PRBool found = PR_FALSE;
|
PRBool found = PR_FALSE;
|
||||||
while (NOERROR == m_enumFE->Next(1, &fe, &count)) {
|
while (NOERROR == m_enumFE->Next(1, &fe, &count)) {
|
||||||
nsCString * df = reinterpret_cast<nsCString*>(mDataFlavors.SafeElementAt(dfInx));
|
nsCString * df = mDataFlavors.SafeElementAt(dfInx);
|
||||||
dfInx++;
|
dfInx++;
|
||||||
if (df && df->EqualsLiteral(kNativeImageMime)) {
|
if (df && df->EqualsLiteral(kNativeImageMime)) {
|
||||||
found = PR_TRUE;
|
found = PR_TRUE;
|
||||||
|
|
|
@ -51,8 +51,7 @@
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsIInputStream.h"
|
#include "nsIInputStream.h"
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTPtrArray.h"
|
||||||
#include "nsVoidArray.h"
|
|
||||||
|
|
||||||
// XXX for older version of PSDK where IAsyncOperation and related stuff is not available
|
// XXX for older version of PSDK where IAsyncOperation and related stuff is not available
|
||||||
// but thisdefine should be removed when parocles config is updated
|
// but thisdefine should be removed when parocles config is updated
|
||||||
|
@ -265,7 +264,7 @@ class nsDataObj : public IDataObject,
|
||||||
|
|
||||||
ULONG m_cRef; // the reference count
|
ULONG m_cRef; // the reference count
|
||||||
|
|
||||||
nsVoidArray mDataFlavors;
|
nsTPtrArray<nsCString> mDataFlavors;
|
||||||
|
|
||||||
nsITransferable * mTransferable; // nsDataObj owns and ref counts nsITransferable,
|
nsITransferable * mTransferable; // nsDataObj owns and ref counts nsITransferable,
|
||||||
// the nsITransferable does know anything about the nsDataObj
|
// the nsITransferable does know anything about the nsDataObj
|
||||||
|
|
|
@ -76,14 +76,14 @@ nsDataObjCollection::~nsDataObjCollection()
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(mTransferable);
|
NS_IF_RELEASE(mTransferable);
|
||||||
|
|
||||||
PRInt32 i;
|
PRUint32 i;
|
||||||
|
|
||||||
for (i = 0; i < mDataFlavors.Count(); ++i) {
|
for (i = 0; i < mDataFlavors.Length(); ++i) {
|
||||||
delete (nsString *)mDataFlavors.ElementAt(i);
|
delete mDataFlavors.ElementAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < mDataObjects.Count(); ++i) {
|
for (i = 0; i < mDataObjects.Length(); ++i) {
|
||||||
IDataObject * dataObj = (IDataObject *)mDataObjects.ElementAt(i);
|
IDataObject * dataObj = mDataObjects.ElementAt(i);
|
||||||
NS_RELEASE(dataObj);
|
NS_RELEASE(dataObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ STDMETHODIMP nsDataObjCollection::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
|
||||||
PRNTDEBUG("nsDataObjCollection::GetData\n");
|
PRNTDEBUG("nsDataObjCollection::GetData\n");
|
||||||
PRNTDEBUG3(" format: %d Text: %d\n", pFE->cfFormat, CF_TEXT);
|
PRNTDEBUG3(" format: %d Text: %d\n", pFE->cfFormat, CF_TEXT);
|
||||||
|
|
||||||
for (PRInt32 i = 0; i < mDataObjects.Count(); ++i) {
|
for (PRUint32 i = 0; i < mDataObjects.Length(); ++i) {
|
||||||
IDataObject * dataObj = (IDataObject *)mDataObjects.ElementAt(i);
|
IDataObject * dataObj = mDataObjects.ElementAt(i);
|
||||||
if (S_OK == dataObj->GetData(pFE, pSTM)) {
|
if (S_OK == dataObj->GetData(pFE, pSTM)) {
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -189,8 +189,8 @@ STDMETHODIMP nsDataObjCollection::QueryGetData(LPFORMATETC pFE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (PRInt32 i = 0; i < mDataObjects.Count(); ++i) {
|
for (PRUint32 i = 0; i < mDataObjects.Length(); ++i) {
|
||||||
IDataObject * dataObj = (IDataObject *)mDataObjects.ElementAt(i);
|
IDataObject * dataObj = mDataObjects.ElementAt(i);
|
||||||
if (S_OK == dataObj->QueryGetData(pFE)) {
|
if (S_OK == dataObj->QueryGetData(pFE)) {
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,8 @@
|
||||||
#include <oleidl.h>
|
#include <oleidl.h>
|
||||||
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsTArray.h"
|
||||||
|
#include "nsTPtrArray.h"
|
||||||
|
|
||||||
class CEnumFormatEtc;
|
class CEnumFormatEtc;
|
||||||
class nsITransferable;
|
class nsITransferable;
|
||||||
|
@ -119,14 +120,14 @@ class nsDataObjCollection : public IDataObject, public nsIDataObjCollection //,
|
||||||
#if NOT_YET
|
#if NOT_YET
|
||||||
// from nsPIDataObjCollection
|
// from nsPIDataObjCollection
|
||||||
STDMETHODIMP AddDataObject(IDataObject * aDataObj);
|
STDMETHODIMP AddDataObject(IDataObject * aDataObj);
|
||||||
STDMETHODIMP GetNumDataObjects(PRInt32* outNum) { *outNum = mDataObjects.Count(); }
|
STDMETHODIMP GetNumDataObjects(PRInt32* outNum) { *outNum = mDataObjects.Length(); }
|
||||||
STDMETHODIMP GetDataObjectAt(PRUint32 aItem, IDataObject** outItem) { *outItem = (IDataObject *)mDataObjects.SafeElementAt(aItem); }
|
STDMETHODIMP GetDataObjectAt(PRUint32 aItem, IDataObject** outItem) { *outItem = mDataObjects.SafeElementAt(aItem); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// from nsPIDataObjCollection
|
// from nsPIDataObjCollection
|
||||||
void AddDataObject(IDataObject * aDataObj);
|
void AddDataObject(IDataObject * aDataObj);
|
||||||
PRInt32 GetNumDataObjects() { return mDataObjects.Count(); }
|
PRInt32 GetNumDataObjects() { return mDataObjects.Length(); }
|
||||||
IDataObject* GetDataObjectAt(PRUint32 aItem) { return (IDataObject *)mDataObjects.SafeElementAt(aItem); }
|
IDataObject* GetDataObjectAt(PRUint32 aItem) { return mDataObjects.SafeElementAt(aItem); }
|
||||||
|
|
||||||
// Return the registered OLE class ID of this object's CfDataObj.
|
// Return the registered OLE class ID of this object's CfDataObj.
|
||||||
CLSID GetClassID() const;
|
CLSID GetClassID() const;
|
||||||
|
@ -191,7 +192,7 @@ class nsDataObjCollection : public IDataObject, public nsIDataObjCollection //,
|
||||||
|
|
||||||
ULONG m_cRef; // the reference count
|
ULONG m_cRef; // the reference count
|
||||||
|
|
||||||
nsVoidArray mDataFlavors;
|
nsTArray<nsString*> mDataFlavors;
|
||||||
|
|
||||||
nsITransferable * mTransferable; // nsDataObjCollection owns and ref counts nsITransferable,
|
nsITransferable * mTransferable; // nsDataObjCollection owns and ref counts nsITransferable,
|
||||||
// the nsITransferable does know anything about the nsDataObjCollection
|
// the nsITransferable does know anything about the nsDataObjCollection
|
||||||
|
@ -199,7 +200,7 @@ class nsDataObjCollection : public IDataObject, public nsIDataObjCollection //,
|
||||||
CEnumFormatEtc * m_enumFE; // Ownership Rules:
|
CEnumFormatEtc * m_enumFE; // Ownership Rules:
|
||||||
// nsDataObjCollection owns and ref counts CEnumFormatEtc,
|
// nsDataObjCollection owns and ref counts CEnumFormatEtc,
|
||||||
|
|
||||||
nsVoidArray mDataObjects;
|
nsTPtrArray<IDataObject> mDataObjects;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
|
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsIPrintSettingsWin.h"
|
#include "nsIPrintSettingsWin.h"
|
||||||
|
|
||||||
|
@ -96,23 +95,23 @@ public:
|
||||||
void FreeGlobalPrinters();
|
void FreeGlobalPrinters();
|
||||||
|
|
||||||
PRBool PrintersAreAllocated() { return mPrinters != nsnull; }
|
PRBool PrintersAreAllocated() { return mPrinters != nsnull; }
|
||||||
LPTSTR GetItemFromList(PRInt32 aInx) { return mPrinters?(LPTSTR)mPrinters->ElementAt(aInx):nsnull; }
|
LPTSTR GetItemFromList(PRInt32 aInx) { return mPrinters?mPrinters->ElementAt(aInx):nsnull; }
|
||||||
nsresult EnumeratePrinterList();
|
nsresult EnumeratePrinterList();
|
||||||
void GetDefaultPrinterName(LPTSTR& aDefaultPrinterName);
|
void GetDefaultPrinterName(LPTSTR& aDefaultPrinterName);
|
||||||
PRInt32 GetNumPrinters() { return mPrinters?mPrinters->Count():0; }
|
PRInt32 GetNumPrinters() { return mPrinters?mPrinters->Length():0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GlobalPrinters() {}
|
GlobalPrinters() {}
|
||||||
nsresult EnumerateNativePrinters();
|
nsresult EnumerateNativePrinters();
|
||||||
void ReallocatePrinters();
|
void ReallocatePrinters();
|
||||||
|
|
||||||
static GlobalPrinters mGlobalPrinters;
|
static GlobalPrinters mGlobalPrinters;
|
||||||
static nsVoidArray* mPrinters;
|
static nsTArray<LPTSTR>* mPrinters;
|
||||||
};
|
};
|
||||||
//---------------
|
//---------------
|
||||||
// static members
|
// static members
|
||||||
GlobalPrinters GlobalPrinters::mGlobalPrinters;
|
GlobalPrinters GlobalPrinters::mGlobalPrinters;
|
||||||
nsVoidArray* GlobalPrinters::mPrinters = nsnull;
|
nsTArray<LPTSTR>* GlobalPrinters::mPrinters = nsnull;
|
||||||
|
|
||||||
|
|
||||||
//******************************************************
|
//******************************************************
|
||||||
|
@ -979,7 +978,7 @@ GlobalPrinters::ReallocatePrinters()
|
||||||
if (PrintersAreAllocated()) {
|
if (PrintersAreAllocated()) {
|
||||||
FreeGlobalPrinters();
|
FreeGlobalPrinters();
|
||||||
}
|
}
|
||||||
mPrinters = new nsVoidArray();
|
mPrinters = new nsTArray<LPTSTR>();
|
||||||
NS_ASSERTION(mPrinters, "Printers Array is NULL!");
|
NS_ASSERTION(mPrinters, "Printers Array is NULL!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,8 +987,8 @@ void
|
||||||
GlobalPrinters::FreeGlobalPrinters()
|
GlobalPrinters::FreeGlobalPrinters()
|
||||||
{
|
{
|
||||||
if (mPrinters != nsnull) {
|
if (mPrinters != nsnull) {
|
||||||
for (int i=0;i<mPrinters->Count();i++) {
|
for (int i=0;i<mPrinters->Length();i++) {
|
||||||
free((LPTSTR)mPrinters->ElementAt(i));
|
free(mPrinters->ElementAt(i));
|
||||||
}
|
}
|
||||||
delete mPrinters;
|
delete mPrinters;
|
||||||
mPrinters = nsnull;
|
mPrinters = nsnull;
|
||||||
|
@ -1078,13 +1077,13 @@ GlobalPrinters::EnumeratePrinterList()
|
||||||
|
|
||||||
// put the default printer at the beginning of list
|
// put the default printer at the beginning of list
|
||||||
if (defPrinterName != nsnull) {
|
if (defPrinterName != nsnull) {
|
||||||
for (PRInt32 i=0;i<mPrinters->Count();i++) {
|
for (PRInt32 i=0;i<mPrinters->Length();i++) {
|
||||||
LPTSTR name = (LPTSTR)mPrinters->ElementAt(i);
|
LPTSTR name = mPrinters->ElementAt(i);
|
||||||
if (!_tcscmp(name, defPrinterName)) {
|
if (!_tcscmp(name, defPrinterName)) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
LPTSTR ptr = (LPTSTR)mPrinters->ElementAt(0);
|
LPTSTR ptr = mPrinters->ElementAt(0);
|
||||||
mPrinters->ReplaceElementAt((void*)name, 0);
|
mPrinters->ElementAt(0) = name;
|
||||||
mPrinters->ReplaceElementAt((void*)ptr, i);
|
mPrinters->ElementAt(i) = ptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ nsScreenManagerWin :: nsScreenManagerWin ( )
|
||||||
nsScreenManagerWin :: ~nsScreenManagerWin()
|
nsScreenManagerWin :: ~nsScreenManagerWin()
|
||||||
{
|
{
|
||||||
// walk our list of cached screens and delete them.
|
// walk our list of cached screens and delete them.
|
||||||
for ( int i = 0; i < mScreenList.Count(); ++i ) {
|
for ( int i = 0; i < mScreenList.Length(); ++i ) {
|
||||||
ScreenListItem* item = reinterpret_cast<ScreenListItem*>(mScreenList[i]);
|
ScreenListItem* item = mScreenList[i];
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,8 @@ nsScreenManagerWin :: CreateNewScreenObject ( void* inScreen )
|
||||||
|
|
||||||
// look through our screen list, hoping to find it. If it's not there,
|
// look through our screen list, hoping to find it. If it's not there,
|
||||||
// add it and return the new one.
|
// add it and return the new one.
|
||||||
for ( int i = 0; i < mScreenList.Count(); ++i ) {
|
for ( int i = 0; i < mScreenList.Length(); ++i ) {
|
||||||
ScreenListItem* curr = reinterpret_cast<ScreenListItem*>(mScreenList[i]);
|
ScreenListItem* curr = mScreenList[i];
|
||||||
if ( inScreen == curr->mMon ) {
|
if ( inScreen == curr->mMon ) {
|
||||||
NS_IF_ADDREF(retScreen = curr->mScreen.get());
|
NS_IF_ADDREF(retScreen = curr->mScreen.get());
|
||||||
return retScreen;
|
return retScreen;
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsTArray.h"
|
||||||
|
|
||||||
class nsIScreen;
|
class nsIScreen;
|
||||||
|
class ScreenListItem;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ private:
|
||||||
PRUint32 mNumberOfScreens;
|
PRUint32 mNumberOfScreens;
|
||||||
|
|
||||||
// cache the screens to avoid the memory allocations
|
// cache the screens to avoid the memory allocations
|
||||||
nsAutoVoidArray mScreenList;
|
nsAutoTArray<ScreenListItem*, 8> mScreenList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
#include "nsIEventListener.h"
|
#include "nsIEventListener.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
|
||||||
class nsNativeDragTarget;
|
class nsNativeDragTarget;
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "nsIAppShell.h"
|
#include "nsIAppShell.h"
|
||||||
#include "nsILocalFile.h"
|
#include "nsILocalFile.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsGUIEvent.h"
|
#include "nsGUIEvent.h"
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsIWindowWatcher.h"
|
#include "nsIWindowWatcher.h"
|
||||||
#include "nsIDOMWindowInternal.h"
|
#include "nsIDOMWindowInternal.h"
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsSupportsArray.h"
|
#include "nsSupportsArray.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ Notes to self:
|
||||||
#include "nsTransferable.h"
|
#include "nsTransferable.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsIFormatConverter.h"
|
#include "nsIFormatConverter.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
@ -106,12 +106,11 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DataStruct* GetDataForFlavor (const nsVoidArray* pArray, const char* aDataFlavor);
|
DataStruct* GetDataForFlavor (const nsTArray<DataStruct*>* pArray,
|
||||||
|
const char* aDataFlavor)
|
||||||
DataStruct* GetDataForFlavor (const nsVoidArray* pArray, const char* aDataFlavor)
|
|
||||||
{
|
{
|
||||||
for (PRInt32 i = 0 ; i < pArray->Count () ; ++i) {
|
for (PRUint32 i = 0 ; i < pArray->Length () ; ++i) {
|
||||||
DataStruct* data = (DataStruct*)pArray->ElementAt (i);
|
DataStruct* data = pArray->ElementAt (i);
|
||||||
if (data->GetFlavor().Equals (aDataFlavor))
|
if (data->GetFlavor().Equals (aDataFlavor))
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +294,7 @@ DataStruct::ReadCache(nsISupports** aData, PRUint32* aDataLen)
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
nsTransferable::nsTransferable()
|
nsTransferable::nsTransferable()
|
||||||
{
|
{
|
||||||
mDataArray = new nsVoidArray();
|
mDataArray = new nsTArray<DataStruct*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -305,8 +304,8 @@ nsTransferable::nsTransferable()
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
nsTransferable::~nsTransferable()
|
nsTransferable::~nsTransferable()
|
||||||
{
|
{
|
||||||
for (PRInt32 i=0;i<mDataArray->Count();i++) {
|
for (PRUint32 i=0;i<mDataArray->Length();i++) {
|
||||||
DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
|
DataStruct * data = mDataArray->ElementAt(i);
|
||||||
delete data;
|
delete data;
|
||||||
}
|
}
|
||||||
delete mDataArray;
|
delete mDataArray;
|
||||||
|
@ -326,8 +325,8 @@ nsTransferable::GetTransferDataFlavors(nsISupportsArray ** aDataFlavorList)
|
||||||
nsresult rv = NS_NewISupportsArray ( aDataFlavorList );
|
nsresult rv = NS_NewISupportsArray ( aDataFlavorList );
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
for ( PRInt32 i=0; i<mDataArray->Count(); ++i ) {
|
for ( PRUint32 i=0; i<mDataArray->Length(); ++i ) {
|
||||||
DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
|
DataStruct * data = mDataArray->ElementAt(i);
|
||||||
nsCOMPtr<nsISupportsCString> flavorWrapper = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID);
|
nsCOMPtr<nsISupportsCString> flavorWrapper = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID);
|
||||||
if ( flavorWrapper ) {
|
if ( flavorWrapper ) {
|
||||||
flavorWrapper->SetData ( data->GetFlavor() );
|
flavorWrapper->SetData ( data->GetFlavor() );
|
||||||
|
@ -355,9 +354,9 @@ nsTransferable::GetTransferData(const char *aFlavor, nsISupports **aData, PRUint
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
// first look and see if the data is present in one of the intrinsic flavors
|
// first look and see if the data is present in one of the intrinsic flavors
|
||||||
PRInt32 i;
|
PRUint32 i;
|
||||||
for (i = 0; i < mDataArray->Count(); ++i ) {
|
for (i = 0; i < mDataArray->Length(); ++i ) {
|
||||||
DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
|
DataStruct * data = mDataArray->ElementAt(i);
|
||||||
if ( data->GetFlavor().Equals(aFlavor) ) {
|
if ( data->GetFlavor().Equals(aFlavor) ) {
|
||||||
data->GetData(aData, aDataLen);
|
data->GetData(aData, aDataLen);
|
||||||
if (*aDataLen == kFlavorHasDataProvider) {
|
if (*aDataLen == kFlavorHasDataProvider) {
|
||||||
|
@ -380,8 +379,8 @@ nsTransferable::GetTransferData(const char *aFlavor, nsISupports **aData, PRUint
|
||||||
|
|
||||||
// if not, try using a format converter to get the requested flavor
|
// if not, try using a format converter to get the requested flavor
|
||||||
if ( mFormatConv ) {
|
if ( mFormatConv ) {
|
||||||
for (i = 0; i < mDataArray->Count(); ++i) {
|
for (i = 0; i < mDataArray->Length(); ++i) {
|
||||||
DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
|
DataStruct * data = mDataArray->ElementAt(i);
|
||||||
PRBool canConvert = PR_FALSE;
|
PRBool canConvert = PR_FALSE;
|
||||||
mFormatConv->CanConvert(data->GetFlavor().get(), aFlavor, &canConvert);
|
mFormatConv->CanConvert(data->GetFlavor().get(), aFlavor, &canConvert);
|
||||||
if ( canConvert ) {
|
if ( canConvert ) {
|
||||||
|
@ -418,8 +417,8 @@ nsTransferable::GetAnyTransferData(char **aFlavor, nsISupports **aData, PRUint32
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aFlavor && aData && aDataLen);
|
NS_ENSURE_ARG_POINTER(aFlavor && aData && aDataLen);
|
||||||
|
|
||||||
for ( PRInt32 i=0; i < mDataArray->Count(); ++i ) {
|
for ( PRUint32 i=0; i < mDataArray->Length(); ++i ) {
|
||||||
DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
|
DataStruct * data = mDataArray->ElementAt(i);
|
||||||
if (data->IsDataAvailable()) {
|
if (data->IsDataAvailable()) {
|
||||||
*aFlavor = ToNewCString(data->GetFlavor());
|
*aFlavor = ToNewCString(data->GetFlavor());
|
||||||
data->GetData(aData, aDataLen);
|
data->GetData(aData, aDataLen);
|
||||||
|
@ -442,9 +441,9 @@ nsTransferable::SetTransferData(const char *aFlavor, nsISupports *aData, PRUint3
|
||||||
NS_ENSURE_ARG(aFlavor);
|
NS_ENSURE_ARG(aFlavor);
|
||||||
|
|
||||||
// first check our intrinsic flavors to see if one has been registered.
|
// first check our intrinsic flavors to see if one has been registered.
|
||||||
PRInt32 i = 0;
|
PRUint32 i = 0;
|
||||||
for (i = 0; i < mDataArray->Count(); ++i) {
|
for (i = 0; i < mDataArray->Length(); ++i) {
|
||||||
DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
|
DataStruct * data = mDataArray->ElementAt(i);
|
||||||
if ( data->GetFlavor().Equals(aFlavor) ) {
|
if ( data->GetFlavor().Equals(aFlavor) ) {
|
||||||
data->SetData ( aData, aDataLen );
|
data->SetData ( aData, aDataLen );
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -453,8 +452,8 @@ nsTransferable::SetTransferData(const char *aFlavor, nsISupports *aData, PRUint3
|
||||||
|
|
||||||
// if not, try using a format converter to find a flavor to put the data in
|
// if not, try using a format converter to find a flavor to put the data in
|
||||||
if ( mFormatConv ) {
|
if ( mFormatConv ) {
|
||||||
for (i = 0; i < mDataArray->Count(); ++i) {
|
for (i = 0; i < mDataArray->Length(); ++i) {
|
||||||
DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
|
DataStruct * data = mDataArray->ElementAt(i);
|
||||||
PRBool canConvert = PR_FALSE;
|
PRBool canConvert = PR_FALSE;
|
||||||
mFormatConv->CanConvert(aFlavor, data->GetFlavor().get(), &canConvert);
|
mFormatConv->CanConvert(aFlavor, data->GetFlavor().get(), &canConvert);
|
||||||
|
|
||||||
|
@ -490,7 +489,7 @@ nsTransferable::AddDataFlavor(const char *aDataFlavor)
|
||||||
|
|
||||||
// Create a new "slot" for the data
|
// Create a new "slot" for the data
|
||||||
DataStruct * data = new DataStruct ( aDataFlavor ) ;
|
DataStruct * data = new DataStruct ( aDataFlavor ) ;
|
||||||
mDataArray->AppendElement((void *)data);
|
mDataArray->AppendElement(data);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,11 @@
|
||||||
#include "nsIFormatConverter.h"
|
#include "nsIFormatConverter.h"
|
||||||
#include "nsITransferable.h"
|
#include "nsITransferable.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsTArray.h"
|
||||||
|
|
||||||
|
|
||||||
class nsVoidArray;
|
|
||||||
class nsString;
|
class nsString;
|
||||||
class nsDataObj;
|
class nsDataObj;
|
||||||
class nsVoidArray;
|
class DataStruct;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XP Transferable wrapper
|
* XP Transferable wrapper
|
||||||
|
@ -69,7 +67,7 @@ protected:
|
||||||
// get flavors w/out converter
|
// get flavors w/out converter
|
||||||
nsresult GetTransferDataFlavors(nsISupportsArray** aDataFlavorList);
|
nsresult GetTransferDataFlavors(nsISupportsArray** aDataFlavorList);
|
||||||
|
|
||||||
nsVoidArray * mDataArray;
|
nsTArray<DataStruct*> * mDataArray;
|
||||||
nsCOMPtr<nsIFormatConverter> mFormatConv;
|
nsCOMPtr<nsIFormatConverter> mFormatConv;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче