]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/webview_ie.cpp
Fix broken and missing DataView interface items for Phoenix
[wxWidgets.git] / src / msw / webview_ie.cpp
index de67e1ee32bfdc6f062e7879d5cf75aef1c9e446..0eb1be1c7e3ff6db6fe0f80d675eed6b4d3352d2 100644 (file)
@@ -38,6 +38,9 @@ namespace {
 DEFINE_GUID(wxIID_IInternetProtocolRoot,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
 DEFINE_GUID(wxIID_IInternetProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
 DEFINE_GUID(wxIID_IDocHostUIHandler, 0xbd3f23c0, 0xd43e, 0x11cf, 0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a);
 DEFINE_GUID(wxIID_IInternetProtocolRoot,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
 DEFINE_GUID(wxIID_IInternetProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
 DEFINE_GUID(wxIID_IDocHostUIHandler, 0xbd3f23c0, 0xd43e, 0x11cf, 0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a);
+DEFINE_GUID(wxIID_IHTMLElement2,0x3050f434,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
+DEFINE_GUID(wxIID_IMarkupServices,0x3050f4a0,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
+DEFINE_GUID(wxIID_IMarkupContainer,0x3050f5f9,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
 
 enum //Internal find flags
 {
 
 enum //Internal find flags
 {
@@ -101,9 +104,27 @@ bool wxWebViewIE::Create(wxWindow* parent,
 
 wxWebViewIE::~wxWebViewIE()
 {
 
 wxWebViewIE::~wxWebViewIE()
 {
-    for(unsigned int i = 0; i < m_factories.size(); i++)
+    wxDynamicLibrary urlMon(wxT("urlmon.dll"));
+    if(urlMon.HasSymbol(wxT("CoInternetGetSession")))
     {
     {
-        m_factories[i]->Release();
+        typedef HRESULT (WINAPI *CoInternetGetSession_t)(DWORD,
+                                                         wxIInternetSession**,
+                                                         DWORD);
+        wxDYNLIB_FUNCTION(CoInternetGetSession_t, CoInternetGetSession, urlMon);
+
+        wxIInternetSession* session;
+        HRESULT res = (*pfnCoInternetGetSession)(0, &session, 0);
+        if(FAILED(res))
+        {
+            wxFAIL_MSG("Could not retrive internet session");
+        }
+
+        for(unsigned int i = 0; i < m_factories.size(); i++)
+        {
+            session->UnregisterNameSpace(m_factories[i], 
+                                        (m_factories[i]->GetName()).wc_str());
+            m_factories[i]->Release();
+        }
     }
     FindClear();
 }
     }
     FindClear();
 }
@@ -913,16 +934,16 @@ wxCOMPtr<IHTMLDocument2> wxWebViewIE::GetDocument() const
 
 bool wxWebViewIE::IsElementVisible(IHTMLElement* elm)
 {
 
 bool wxWebViewIE::IsElementVisible(IHTMLElement* elm)
 {
-    IHTMLCurrentStyle* style;
+    wxIHTMLCurrentStyle* style;
     IHTMLElement *elm1 = elm;
     IHTMLElement *elm1 = elm;
-    IHTMLElement2 *elm2;
+    wxIHTMLElement2 *elm2;
     BSTR tmp_bstr;
     bool is_visible = true;
     //This method is not perfect but it does discover most of the hidden elements.
     //so if a better solution is found, then please do improve.
     while(elm1)
     {
     BSTR tmp_bstr;
     bool is_visible = true;
     //This method is not perfect but it does discover most of the hidden elements.
     //so if a better solution is found, then please do improve.
     while(elm1)
     {
-        if(SUCCEEDED(elm1->QueryInterface(IID_IHTMLElement2, (void**) &elm2)))
+        if(SUCCEEDED(elm1->QueryInterface(wxIID_IHTMLElement2, (void**) &elm2)))
         {
             if(SUCCEEDED(elm2->get_currentStyle(&style)))
             {
         {
             if(SUCCEEDED(elm2->get_currentStyle(&style)))
             {
@@ -961,16 +982,16 @@ bool wxWebViewIE::IsElementVisible(IHTMLElement* elm)
 
 void wxWebViewIE::FindInternal(const wxString& text, int flags, int internal_flag)
 {
 
 void wxWebViewIE::FindInternal(const wxString& text, int flags, int internal_flag)
 {
-    IMarkupServices *pIMS;
-    IMarkupContainer *pIMC;
-    IMarkupPointer *ptrBegin, *ptrEnd;
+    wxIMarkupServices *pIMS;
+    wxIMarkupContainer *pIMC;
+    wxIMarkupPointer *ptrBegin, *ptrEnd;
     IHTMLElement* elm;
     long find_flag = 0;
     IHTMLDocument2 *document = GetDocument();
     //This function does the acutal work.
     IHTMLElement* elm;
     long find_flag = 0;
     IHTMLDocument2 *document = GetDocument();
     //This function does the acutal work.
-    if(SUCCEEDED(document->QueryInterface(IID_IMarkupServices, (void **)&pIMS)))
+    if(SUCCEEDED(document->QueryInterface(wxIID_IMarkupServices, (void **)&pIMS)))
     {
     {
-        if(SUCCEEDED(document->QueryInterface(IID_IMarkupContainer, (void **)&pIMC)))
+        if(SUCCEEDED(document->QueryInterface(wxIID_IMarkupContainer, (void **)&pIMC)))
         {
             BSTR attr_bstr = SysAllocString(L"style=\"background-color:#ffff00\"");
             BSTR text_bstr = SysAllocString(text.wc_str());
         {
             BSTR attr_bstr = SysAllocString(L"style=\"background-color:#ffff00\"");
             BSTR text_bstr = SysAllocString(text.wc_str());
@@ -1017,7 +1038,7 @@ void wxWebViewIE::FindInternal(const wxString& text, int flags, int internal_fla
                         }
                         if(internal_flag & wxWEB_VIEW_FIND_ADD_POINTERS)
                         {
                         }
                         if(internal_flag & wxWEB_VIEW_FIND_ADD_POINTERS)
                         {
-                            IMarkupPointer *cptrBegin, *cptrEnd;
+                            wxIMarkupPointer *cptrBegin, *cptrEnd;
                             pIMS->CreateMarkupPointer(&cptrBegin);
                             pIMS->CreateMarkupPointer(&cptrEnd);
                             cptrBegin->MoveToPointer(ptrBegin);
                             pIMS->CreateMarkupPointer(&cptrBegin);
                             pIMS->CreateMarkupPointer(&cptrEnd);
                             cptrBegin->MoveToPointer(ptrBegin);
@@ -1085,8 +1106,8 @@ long wxWebViewIE::FindNext(int direction)
     //some variables to use later on.
     IHTMLElement *body_element;
     IHTMLBodyElement *body;
     //some variables to use later on.
     IHTMLElement *body_element;
     IHTMLBodyElement *body;
-    IHTMLTxtRange *range = NULL;
-    IMarkupServices *pIMS;
+    wxIHTMLTxtRange *range = NULL;
+    wxIMarkupServices *pIMS;
     IHTMLDocument2 *document = GetDocument();
     long ret = -1;
     //Now try to create a range from the body.
     IHTMLDocument2 *document = GetDocument();
     long ret = -1;
     //Now try to create a range from the body.
@@ -1094,12 +1115,12 @@ long wxWebViewIE::FindNext(int direction)
     {
         if(SUCCEEDED(body_element->QueryInterface(IID_IHTMLBodyElement,(void**)&body)))
         {
     {
         if(SUCCEEDED(body_element->QueryInterface(IID_IHTMLBodyElement,(void**)&body)))
         {
-            if(SUCCEEDED(body->createTextRange(&range)))
+            if(SUCCEEDED(body->createTextRange((IHTMLTxtRange**)(&range))))
             {
                 //So far so good, now we try to position our find pointers.
             {
                 //So far so good, now we try to position our find pointers.
-                if(SUCCEEDED(document->QueryInterface(IID_IMarkupServices,(void **)&pIMS)))
+                if(SUCCEEDED(document->QueryInterface(wxIID_IMarkupServices,(void **)&pIMS)))
                 {
                 {
-                    IMarkupPointer *begin = m_findPointers[m_findPosition].begin, *end = m_findPointers[m_findPosition].end;
+                    wxIMarkupPointer *begin = m_findPointers[m_findPosition].begin, *end = m_findPointers[m_findPosition].end;
                     if(pIMS->MoveRangeToPointers(begin,end,range) == S_OK && range->select() == S_OK)
                     {
                         ret = m_findPosition;
                     if(pIMS->MoveRangeToPointers(begin,end,range) == S_OK && range->select() == S_OK)
                     {
                         ret = m_findPosition;