home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / central / CBrowserContext.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  55.8 KB  |  1,961 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. //    CBrowserContext.cp
  20.  
  21. #include "CBrowserContext.h"
  22. #include "CNSContextCallbacks.h"
  23. #include "CHTMLView.h"
  24. #ifndef NSPR20
  25. #include "CNetwork.h"
  26. #endif
  27. #include "UStdDialogs.h"
  28. #include "UFormElementFactory.h"
  29. #include "CAutoPtrXP.h"
  30. #include "RandomFrontEndCrap.h" // for IsSpecialBrowserWindow
  31. #include "CURLDispatcher.h"
  32.  
  33. #include "CFontReference.h"
  34.  
  35. #include <LString.h>
  36.  
  37. #include "earlmgr.h"
  38. #include "uprefd.h"
  39. #include "xp.h"
  40. #include "xp_thrmo.h"
  41. #include "shist.h"
  42. #include "glhist.h"
  43. #include "libimg.h"
  44. #include "np.h"
  45. #include "libmime.h"
  46. #include "libi18n.h"
  47. #include "mimages.h"
  48. #include "ufilemgr.h"
  49. #include "java.h"
  50. #include "layers.h"
  51. #include "intl_csi.h"
  52. #include "uintl.h"
  53.  
  54. // FIX ME -- write a CopyAlloc like function that takes a CString
  55. #include "macutil.h"
  56. #include "CAutoPtrXP.h"
  57.  
  58. const ResIDT cJSDialogTitleStrID = 16010;
  59. const Int16 cDialogTitleSeperatorStrIndex = 1;
  60. const Int16 cDialogTitleStrIndex = 2;
  61.  
  62. // utility function to build window title for JavaScript dialogs
  63. static void AppendJSStringToHost(LStr255& ioTitle, const char* inURL)
  64. {
  65.     LStr255 titleSeperatorStr(cJSDialogTitleStrID, cDialogTitleSeperatorStrIndex);
  66.     LStr255 jsAppStr(cJSDialogTitleStrID, cDialogTitleStrIndex);
  67.  
  68.     if (inURL)
  69.     {
  70.         CAutoPtrXP<char> hostname(NET_ParseURL(inURL, GET_HOST_PART));
  71.         char *host = hostname.get();
  72.         if (host && *host)
  73.         {
  74.             ioTitle = host;
  75.             ioTitle += titleSeperatorStr;
  76.             ioTitle += jsAppStr;
  77.         }
  78.         else
  79.         {
  80.             ioTitle = jsAppStr;
  81.         }
  82.     }
  83.     else
  84.     {
  85.         ioTitle = jsAppStr;
  86.     }
  87.     
  88. }
  89.  
  90. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  91. //
  92. #pragma mark --- CONSTRUCTION / DESTRUCTION ---
  93. //
  94. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  95.  
  96. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  97. //    Ñ    
  98. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  99.  
  100. CBrowserContext::CBrowserContext()
  101. :    CNSContext(MWContextBrowser)
  102. ,    mCompositor(nil)
  103. ,    mImageGroupContext(nil)
  104. ,    mImagesLoading(false)
  105. ,    mImagesLooping(false)
  106. ,    mImagesDelayed(false)
  107. ,    mMochaImagesLoading(false)
  108. ,    mMochaImagesLooping(false)
  109. ,    mMochaImagesDelayed(false)
  110. ,    mInNoMoreUsers(false)
  111. {
  112.     mLoadImagesOverride = false;
  113.     mDelayImages =     CPrefs::GetBoolean( CPrefs::DelayImages );
  114.     mIsRepaginating = false;
  115.     mIsRepaginationPending = false;
  116.     
  117. // FIX ME!!! need to add unique identifier
  118. //    fWindowID = sWindowID++;
  119.  
  120. //    XP_AddContextToList(&mContext);
  121.     SHIST_InitSession(&mContext);
  122.         
  123.     //
  124.     // Allocate a new image library context
  125.     //
  126.     CreateImageContext( &mContext );
  127.     mImageGroupContext = mContext.img_cx;
  128.     IL_AddGroupObserver(mImageGroupContext, ImageGroupObserver, &mContext);
  129. }
  130.  
  131. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  132. //    Ñ    
  133. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  134.  
  135. CBrowserContext::CBrowserContext(MWContextType inType) 
  136. :    CNSContext(inType)
  137. ,    mCompositor(nil)
  138. ,    mImageGroupContext(nil)
  139. ,    mImagesLoading(false)
  140. ,    mImagesLooping(false)
  141. ,    mImagesDelayed(false)
  142. ,    mMochaImagesLoading(false)
  143. ,    mMochaImagesLooping(false)
  144. ,    mMochaImagesDelayed(false)
  145. ,    mInNoMoreUsers(false)
  146. {
  147.     mLoadImagesOverride = false;
  148.     mDelayImages =     CPrefs::GetBoolean( CPrefs::DelayImages );
  149.     mIsRepaginating = false;
  150.     mIsRepaginationPending = false;
  151.     
  152. // FIX ME!!! need to add unique identifier
  153. //    fWindowID = sWindowID++;
  154.  
  155. //    XP_AddContextToList(&mContext);
  156.     SHIST_InitSession(&mContext);
  157.     
  158.     //
  159.     // Allocate a new image library context
  160.     //
  161.     CreateImageContext( &mContext );
  162.     mImageGroupContext = mContext.img_cx;
  163.     IL_AddGroupObserver(mImageGroupContext, ImageGroupObserver, &mContext);
  164. }
  165.  
  166. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  167. //    Ñ    
  168. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  169.  
  170. // this is a shallow copy.  child contexts are not duplicated.
  171. CBrowserContext::CBrowserContext(const CBrowserContext& inOriginal)
  172. :    CNSContext(inOriginal)
  173. ,    mCompositor(nil)
  174. ,    mImageGroupContext(nil)
  175. ,    mImagesLoading(false)
  176. ,    mImagesLooping(false)
  177. ,    mImagesDelayed(false)
  178. ,    mMochaImagesLoading(false)
  179. ,    mMochaImagesLooping(false)
  180. ,    mMochaImagesDelayed(false)
  181. ,    mInNoMoreUsers(false)
  182. {
  183.     mLoadImagesOverride = inOriginal.IsLoadImagesOverride();
  184.     mDelayImages =     inOriginal.IsImageLoadingDelayed();
  185.     mIsRepaginating = inOriginal.IsRepaginating();
  186.     mIsRepaginationPending = inOriginal.IsRepagintaitonPending();
  187.     SetCompositor(inOriginal.mCompositor);
  188.  
  189. // FIX ME!!! need to make sure all things inited in the default ctor are done here
  190.  
  191.     //
  192.     // Allocate a new image library context
  193.     //
  194.     CreateImageContext( &mContext );
  195.     mImageGroupContext = mContext.img_cx;
  196.     IL_AddGroupObserver(mImageGroupContext, ImageGroupObserver, &mContext);
  197. }
  198.  
  199. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  200. //    Ñ    
  201. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  202.  
  203. CBrowserContext::~CBrowserContext()
  204. {
  205.     // NOTE: IL_RemoveGroupObserver and DestroyImageContext are done on our behalf
  206.     // in other places
  207.  
  208.     SetCompositor(NULL);
  209.  
  210.     // 97-06-06 mjc - remove the context from the global list in CNSContext::NoMoreUsers before calling mocha.
  211.     //XP_RemoveContextFromList(&mContext);
  212.     if (mContext.name != NULL)
  213.         {
  214.         XP_FREE(mContext.name);
  215.         mContext.name = NULL;
  216.         }
  217. }
  218.  
  219. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  220. //    Ñ    
  221. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  222.  
  223. void CBrowserContext::NoMoreUsers(void)
  224. {
  225.     mInNoMoreUsers = true;
  226.  
  227.         // this object is about to be destroyed...
  228.     mIsRepaginationPending = false;    // ...so, clear requests for further work.
  229.  
  230.     CNSContext::NoMoreUsers();
  231. }
  232.  
  233. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  234. //    Ñ    
  235. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  236.  
  237. void CBrowserContext::SetCurrentView(CHTMLView* inView)
  238. {
  239.     if (inView != NULL)
  240.         {
  241.         }
  242.     else
  243.         {
  244.         // Cleanup???
  245.         }
  246.  
  247. // these are the old vars.  we want to make sure they are always null        
  248.     mContext.fe.view = NULL;
  249.     mContext.fe.newView = inView;
  250. }
  251.  
  252. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  253. //    Ñ    
  254. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  255.  
  256. CBrowserContext* CBrowserContext::GetTopContext()
  257. {
  258.     CBrowserContext* theReturnContext = this;
  259.     if (theReturnContext->mContext.grid_parent != NULL)
  260.         {
  261.         CBrowserContext* theTempContext = ExtractBrowserContext(theReturnContext->mContext.grid_parent);
  262.         theReturnContext = theTempContext->GetTopContext();
  263.         }
  264.         
  265.     return theReturnContext;
  266. }
  267.  
  268. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  269. //    Ñ    
  270. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  271.  
  272. Boolean CBrowserContext::HasColorSpace(void) const
  273. {
  274.     return (mContext.color_space != NULL);
  275. }
  276.  
  277. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  278. //    Ñ    
  279. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  280.  
  281. Boolean CBrowserContext::HasGridParent(void) const
  282. {
  283.     return (mContext.grid_parent != NULL);
  284. }
  285.  
  286. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  287. //    Ñ    
  288. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  289.  
  290. Boolean CBrowserContext::HasFullPagePlugin(void) const
  291. {
  292.     NPEmbeddedApp* theApp = mContext.pluginList;
  293.     return ((theApp != NULL) && (theApp->next == NULL) && (theApp->pagePluginType == NP_FullPage));
  294. }
  295.  
  296. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  297. //    Ñ    
  298. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  299.  
  300. void CBrowserContext::SetLoadImagesOverride(Boolean inOverride)
  301. {
  302.     mLoadImagesOverride = inOverride;
  303. }
  304.  
  305. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  306. //    Ñ    
  307. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  308.  
  309. Boolean CBrowserContext::IsLoadImagesOverride(void) const
  310. {
  311.     return mLoadImagesOverride;
  312. }
  313.  
  314. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  315. //    Ñ    
  316. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  317.  
  318. void CBrowserContext::SetDelayImages(Boolean inDelay)
  319. {
  320.     mDelayImages = inDelay;
  321. }
  322.  
  323. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  324. //    Ñ    
  325. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  326.  
  327. Boolean CBrowserContext::IsImageLoadingDelayed(void) const
  328. {
  329.     return mDelayImages;
  330. }
  331.  
  332. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  333. //    Ñ    
  334. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  335.  
  336. Boolean    CBrowserContext::IsRestrictedTarget(void) const
  337. {
  338.     return (mContext.restricted_target) ? true : false;
  339. }
  340.  
  341. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  342. //    Ñ    
  343. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  344.  
  345. void CBrowserContext::SetRestrictedTarget(Boolean inIsRestricted)
  346. {
  347.     mContext.restricted_target = inIsRestricted;
  348. }
  349.  
  350. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  351. //    Ñ    
  352. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  353.  
  354. Boolean CBrowserContext::IsRootDocInfoContext()
  355. {
  356.     // 1997-05-02 pkc -- I observe that the first context that gets called
  357.     // for doc info window has a name of cDocInfoWindowContextName and has
  358.     // NULL grid_parent && NULL grid_children fields.
  359.     // Obviously, if this ever changes, this function needs to change.
  360.     if (mContext.name != NULL)
  361.         return (IsDocInfoWindow(mContext.name) && !HasGridParent()/* && !HasGridChildren()*/);
  362.     else
  363.         return false;
  364. }
  365.  
  366. // 1997-05-16 pkc -- added this method to work around page source resize bug
  367. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  368. //    Ñ    
  369. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  370.  
  371. Boolean CBrowserContext::IsViewSourceContext()
  372. {
  373.     if (mContext.name != NULL)
  374.         return (IsViewSourceWindow(mContext.name));
  375.     else
  376.         return false;
  377. }
  378.  
  379. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  380. //    Ñ    
  381. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  382.  
  383. Boolean CBrowserContext::IsSpecialBrowserContext()
  384. {
  385.     if (mContext.name != NULL)
  386.         return IsSpecialBrowserWindow(mContext.name);
  387.     else
  388.         return false;
  389. }
  390.  
  391. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  392. //    Ñ    
  393. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  394.  
  395. Boolean CBrowserContext::SupportsPageServices()
  396. {
  397.     return SHIST_CurrentHandlesPageServices(*this);
  398. }
  399.  
  400. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  401. //
  402. #pragma mark --- LAYERS / COMPOSITOR ---
  403. //
  404. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  405.  
  406. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  407. //    Ñ    
  408. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  409.  
  410. Boolean CBrowserContext::HasCompositor(void) const
  411. {
  412.     return (mContext.compositor != NULL);
  413. }
  414.  
  415. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  416. //    Ñ    
  417. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  418.  
  419. CL_Compositor* CBrowserContext::GetCompositor(void) const
  420. {
  421.     return mContext.compositor;
  422. }
  423.  
  424. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  425. //    Ñ    
  426. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  427.  
  428. void CBrowserContext::SetCompositor(CSharableCompositor* inCompositor)
  429. {
  430.     mContext.compositor = inCompositor ? *inCompositor : (CL_Compositor*)nil;
  431.     if (mCompositor)
  432.         mCompositor->RemoveUser(this);
  433.     mCompositor = inCompositor;
  434.     if (mCompositor)
  435.         mCompositor->AddUser(this);
  436. }
  437.  
  438. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  439. //    Ñ    
  440. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  441.  
  442. PRBool CBrowserContext::HandleLayerEvent(    
  443.     CL_Layer*                inLayer, 
  444.     CL_Event*                inEvent)
  445. {
  446.     PRBool result = PR_FALSE;
  447.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  448.     if (theCurrentView != NULL)
  449.         result = theCurrentView->HandleLayerEvent(inLayer, inEvent);
  450.     return result;
  451. }
  452.  
  453. PRBool CBrowserContext::HandleEmbedEvent(    
  454.     LO_EmbedStruct*            inEmbed, 
  455.     CL_Event*                inEvent)
  456. {
  457.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  458.     Assert_(theCurrentView != NULL);
  459.     if (theCurrentView == NULL)
  460.         return PR_FALSE;
  461.     return theCurrentView->HandleEmbedEvent(inEmbed, inEvent);
  462. }
  463.  
  464. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  465. //
  466. #pragma mark --- HISTORY ---
  467. //
  468. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  469.  
  470. void CBrowserContext::RememberHistoryPosition(
  471.     Int32                    inH,
  472.     Int32                    inV)
  473. {
  474. #ifdef LAYERS
  475.     LO_Element* theNearestElement = LO_XYToNearestElement(&mContext, inH, inV, NULL);
  476. #else
  477.     LO_Element* theNearestElement = LO_XYToNearestElement(&mContext, inH, inV);
  478. #endif 
  479.  
  480.     if (theNearestElement != NULL)
  481.         SHIST_SetPositionOfCurrentDoc(&mContext.hist, theNearestElement->lo_any.ele_id);
  482. }
  483.  
  484. History_entry* CBrowserContext::GetNextHistoryEntry(void)
  485. {
  486.     return SHIST_GetNext(&mContext);
  487. }
  488.  
  489. History_entry* CBrowserContext::GetPreviousHistoryEntry(void)
  490. {
  491.     return SHIST_GetPrevious(&mContext);
  492. }
  493.  
  494. Boolean CBrowserContext::CanGoForward(void)
  495. {
  496.     return SHIST_CanGoForward(&mContext);
  497. }
  498.  
  499. Boolean CBrowserContext::CanGoBack(void)
  500. {
  501.     return SHIST_CanGoBack(&mContext);
  502. }
  503.  
  504. Boolean CBrowserContext::HasGridChildren(void)
  505. {
  506.     return (mContext.grid_children != NULL);
  507. }
  508.  
  509. Boolean CBrowserContext::IsGridChild(void)
  510. {
  511.     return (mContext.is_grid_cell);
  512. }
  513.  
  514. Boolean CBrowserContext::IsGridCell()
  515. {
  516.     return (mContext.is_grid_cell);
  517. }
  518.  
  519. Boolean CBrowserContext::GoForwardInGrid(void)
  520. {
  521.     return LO_ForwardInGrid(&mContext);
  522. }
  523.  
  524. Boolean CBrowserContext::GoBackInGrid(void)
  525. {
  526.     return LO_BackInGrid(&mContext);
  527. }
  528.  
  529. void CBrowserContext::GoForward(void)
  530. {
  531.     if (!HasGridChildren() || !GoForwardInGrid())
  532.         LoadHistoryEntry(index_GoForward);
  533. }
  534.  
  535. void CBrowserContext::GoBack(void)
  536. {
  537.     if (!HasGridChildren() || !GoBackInGrid())
  538.         LoadHistoryEntry(index_GoBack);
  539. }
  540.  
  541. void CBrowserContext::GoForwardOneHost()
  542. {
  543.     History*        history = &mContext.hist;
  544.     History_entry*    currentEntry = GetCurrentHistoryEntry();
  545.     History_entry*    entry = nil;
  546.     
  547.     if (currentEntry)
  548.     {
  549.         CAutoPtrXP<char> currentHost = NET_ParseURL(currentEntry->address, GET_HOST_PART);
  550.  
  551.         if (currentHost.get())
  552.         {
  553.             Int32 historyIndex = 0;
  554.             Int32 currentEntryIndex = SHIST_GetIndex(history, currentEntry);
  555.             Int32 numItemsInHistory = GetHistoryListCount();
  556.             
  557.             for (int i = currentEntryIndex + 1;  i <= numItemsInHistory && !historyIndex; i++)
  558.             {
  559.                 entry = SHIST_GetEntry(history, i - 1);
  560.                 
  561.                 if (entry)
  562.                 {
  563.                     CAutoPtrXP<char> host = NET_ParseURL(entry->address, GET_HOST_PART);
  564.                     
  565.                     if (host.get())
  566.                     {
  567.                         if (strcasecomp(currentHost.get(), host.get()) != 0)
  568.                         {
  569.                             historyIndex = i;
  570.                         }
  571.                     }
  572.                 }
  573.             }
  574.             
  575.             if (!historyIndex)
  576.             {
  577.                 historyIndex = numItemsInHistory;
  578.             }
  579.  
  580.             LoadHistoryEntry(historyIndex);
  581.         }
  582.     }
  583. }
  584.  
  585. void CBrowserContext::GoBackOneHost()
  586. {
  587.     History*        history = &mContext.hist;
  588.     History_entry*    currentEntry = GetCurrentHistoryEntry();
  589.     History_entry*    entry = nil;
  590.     
  591.     if (currentEntry)
  592.     {
  593.         CAutoPtrXP<char> currentHost = NET_ParseURL(currentEntry->address, GET_HOST_PART);
  594.  
  595.         if (currentHost.get())
  596.         {
  597.             Int32 historyIndex = 0;
  598.             Int32 currentEntryIndex = SHIST_GetIndex(history, currentEntry);
  599.             
  600.             for (int i = currentEntryIndex - 1;  i >= 1 && !historyIndex; i--)
  601.             {
  602.                 entry = SHIST_GetEntry(history, i - 1);
  603.                 
  604.                 if (entry)
  605.                 {
  606.                     CAutoPtrXP<char> host = NET_ParseURL(entry->address, GET_HOST_PART);
  607.                     
  608.                     if (host.get())
  609.                     {
  610.                         if (strcasecomp(currentHost.get(), host.get()) != 0)
  611.                         {
  612.                             historyIndex = i;
  613.                         }
  614.                     }
  615.                 }
  616.             }
  617.             
  618.             if (!historyIndex)
  619.             {
  620.                 historyIndex = 1;
  621.             }
  622.  
  623.             LoadHistoryEntry(historyIndex);
  624.         }
  625.     }
  626. }
  627.  
  628. // inIndex is one-based
  629. // special case:
  630. //         -1 is go back
  631. //        0 is go forward
  632. //        -2 is reload current
  633. void CBrowserContext::LoadHistoryEntry(Int32 inIndex, Boolean inSuperReload)
  634. {
  635.     History_entry* entry = NULL;
  636.     switch (inIndex)
  637.     {
  638.         case index_GoBack:
  639.             entry = GetPreviousHistoryEntry();
  640.             break;
  641.         case index_GoForward:
  642.             entry = GetNextHistoryEntry();
  643.             break;
  644.         case index_Reload:
  645.             entry = GetCurrentHistoryEntry();
  646.             break;
  647.         default:
  648.             entry = SHIST_GetObjectNum(&mContext.hist, inIndex);
  649.     }
  650.     if (entry)
  651.     {
  652.         URL_Struct* url = SHIST_CreateURLStructFromHistoryEntry(&mContext, entry); // SIGH!
  653.         if ( url )
  654.         {
  655.             // 97-05-14 pkc -- only fiddle with url->force_reload if we're doing a reload
  656.             if (inIndex == index_Reload)
  657.             {
  658.                 if(inSuperReload)
  659.                     url->force_reload = NET_SUPER_RELOAD;
  660.                 else
  661.                     url->force_reload = NET_NORMAL_RELOAD;
  662.             }
  663.             SwitchLoadURL( url, FO_CACHE_AND_PRESENT );
  664.         }
  665.     }
  666. }
  667.  
  668. void CBrowserContext::InitHistoryFromContext( CBrowserContext *parentContext)
  669. {
  670.     if ( parentContext )
  671.     {
  672.         SHIST_CopySession( &mContext, parentContext->operator MWContext*() );
  673.         Int32 curIndex = parentContext->GetIndexOfCurrentHistoryEntry();
  674.         SHIST_SetCurrent( &mContext.hist, curIndex );
  675.     }
  676. }
  677.  
  678. #pragma mark --- Image Observer ---
  679.  
  680. Boolean CBrowserContext::IsContextLoopingRecurse()
  681. {
  682.    int i = 1;
  683.    MWContext *childContext;
  684.  
  685.    if (mImagesLooping)
  686.        return true;
  687.  
  688.    if (mMochaImagesLooping)
  689.        return true;
  690.  
  691.    while ((childContext = (MWContext *)XP_ListGetObjectNum(mContext.grid_children, i++)) != 0)
  692.    {
  693.        if (ExtractBrowserContext(childContext)->IsContextLoopingRecurse())
  694.            return true;
  695.    }
  696.    
  697.    return false;
  698. }
  699.  
  700.             // Returns true if this context or its children have any looping images.
  701. Boolean CBrowserContext::IsContextLooping()
  702. {
  703.     return (IsContextLoopingRecurse());
  704. }
  705.  
  706.  
  707. void
  708. CBrowserContext::SetImagesLoading(Boolean inValue)
  709. {
  710.     mImagesLoading = inValue;
  711.     LCommander::SetUpdateCommandStatus(true);
  712. }
  713.  
  714. void
  715. CBrowserContext::SetImagesLooping(Boolean inValue)
  716. {
  717.     mImagesLooping = inValue;
  718.     LCommander::SetUpdateCommandStatus(true);
  719. }
  720.  
  721. void
  722. CBrowserContext::SetImagesDelayed(Boolean inValue)
  723. {
  724.     mImagesDelayed = inValue;
  725.     LCommander::SetUpdateCommandStatus(true);
  726. }
  727.  
  728. void
  729. CBrowserContext::SetMochaImagesLoading(Boolean inValue)
  730. {
  731.     mMochaImagesLoading = inValue;
  732.     LCommander::SetUpdateCommandStatus(true);
  733. }
  734.  
  735. void
  736. CBrowserContext::SetMochaImagesLooping(Boolean inValue)
  737. {
  738.     mMochaImagesLooping = inValue;
  739.     LCommander::SetUpdateCommandStatus(true);
  740. }
  741.  
  742. void
  743. CBrowserContext::SetMochaImagesDelayed(Boolean inValue)
  744. {
  745.     mMochaImagesDelayed = inValue;
  746.     LCommander::SetUpdateCommandStatus(true);
  747. }
  748.  
  749.  
  750. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  751. //
  752. #pragma mark --- URL MANIPULATION ---
  753. //
  754. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  755. // Moved to CNSContext
  756.  
  757.  
  758. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  759. //
  760. #pragma mark --- REPAGINATION ---
  761. //
  762. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  763.  
  764. void CBrowserContext::Repaginate(NET_ReloadMethod repage)
  765. {
  766.     History_entry* theCurrentEntry = SHIST_GetCurrent(&mContext.hist);
  767.     if ((theCurrentEntry == NULL) || (theCurrentEntry->is_binary))
  768.         {
  769.         BroadcastMessage(msg_NSCPEmptyRepagination);
  770.         return;
  771.         }
  772.         
  773.     if (XP_IsContextBusy(&mContext))
  774.         {
  775.         mIsRepaginationPending = true;
  776.         return;
  777.         }
  778.  
  779.     BroadcastMessage(msg_NSCPAboutToRepaginate);
  780.  
  781.     // it would be bad to reload the URL for the editor (file may not be saved!)
  782.     if (EDT_IS_EDITOR((&mContext)))
  783.     {
  784.         // Editor can relayout page without having to do NET_GetURL
  785.         BroadcastMessage(msg_NSCPEditorRepaginate);
  786.         return;
  787.     }
  788.     
  789.     URL_Struct* theURL = SHIST_CreateWysiwygURLStruct(&mContext, theCurrentEntry);    
  790.     if (theURL == NULL)
  791.         return;
  792.     
  793.     theURL->force_reload = repage;
  794.     
  795.     // don't reload any images! Only from cache!
  796.     mIsRepaginationPending = false;
  797.     mIsRepaginating = true;
  798.  
  799.     NPL_SamePage(&mContext);
  800.     SwitchLoadURL(theURL, FO_CACHE_AND_PRESENT);
  801. }
  802.  
  803. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  804. //    Ñ    
  805. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  806.  
  807. Boolean    CBrowserContext::IsRepaginating(void) const
  808. {
  809.     return mIsRepaginating;
  810. }
  811.  
  812. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  813. //    Ñ    
  814. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  815.  
  816. Boolean CBrowserContext::IsRepagintaitonPending(void) const
  817. {
  818.     return mIsRepaginationPending;
  819. }
  820.  
  821. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  822. //
  823. #pragma mark --- FRAME MANAGEMENT ---
  824. //
  825. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  826.  
  827. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  828. //    Ñ    
  829. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  830.  
  831. MWContext* CBrowserContext::CreateGridContext(
  832.     void*                     inHistList,
  833.     void*                     inHistEntry,
  834.     Int32                    inX,
  835.     Int32                     inY,
  836.     Int32                    inWidth,
  837.     Int32                    inHeight,
  838.     char*                     inURLString,
  839.     char*                     inWindowTarget,
  840.     Int8                    inScrollMode,
  841.     NET_ReloadMethod         inForceReload,
  842.     Bool                     inNoEdge)
  843. {
  844.     Assert_(mContext.type != MWContextText);
  845.  
  846.     CBrowserContext* theNewContext = NULL;
  847.  
  848.     try
  849.         {
  850.         theNewContext = new CBrowserContext(*this);
  851.         StSharer theShareLock(theNewContext);
  852.         
  853.         theNewContext->mContext.is_grid_cell = true;
  854. //     theNewContext->fe.realContext = owningContext;
  855.         theNewContext->mContext.grid_parent = *this;
  856.  
  857.         CHTMLView* theCurrentView = ExtractHyperView(*this);
  858.         Assert_(theCurrentView != NULL);
  859.         ThrowIfNULL_(theCurrentView);
  860.         theCurrentView->CreateGridView(theNewContext, inX, inY, inWidth, inHeight, inScrollMode, inNoEdge);
  861.         
  862.         // Ñ create the new context for our view
  863. //        vcontext = newContext = context->CreateGridContext();
  864. //        newContext->fe.view = newView;
  865. //        newContext->grid_parent = fHContext;
  866.  
  867.         if (inWindowTarget != NULL)
  868.             theNewContext->SetDescriptor(inWindowTarget);
  869.  
  870.         XP_AddContextToList(*theNewContext);
  871.                 
  872.         // Ñ grid history magic
  873.         XP_List* theHistList = (XP_List*)inHistList;
  874.         History_entry* theHist = (History_entry*)inHistEntry;
  875.         if (inHistList != NULL)
  876.             {
  877.             if (theNewContext->mContext.hist.list_ptr != NULL)
  878.                 XP_FREE(theNewContext->mContext.hist.list_ptr);
  879.             theNewContext->mContext.hist.list_ptr = theHistList;
  880.             }
  881.         else if (theHist != NULL)
  882.             SHIST_AddDocument(*theNewContext, theHist);
  883.         if (theHist == NULL)
  884.             {
  885.             URL_Struct* theURL = NET_CreateURLStruct(inURLString, NET_DONT_RELOAD);
  886.             theURL->force_reload = inForceReload;
  887.  
  888.             History_entry* theNewHist = SHIST_GetCurrent( &mContext.hist );
  889.             if ((theNewHist != NULL) && (theNewHist->referer != NULL))
  890.                 theURL->referer = XP_STRDUP(theNewHist->referer);
  891.             
  892.             theNewContext->ImmediateLoadURL(theURL, FO_CACHE_AND_PRESENT);
  893.             }
  894.         else
  895.             {
  896.             URL_Struct* theURL = SHIST_CreateURLStructFromHistoryEntry(*theNewContext, theHist);
  897.             if (theURL)
  898.                 theNewContext->ImmediateLoadURL(theURL, FO_CACHE_AND_PRESENT);
  899.             }
  900.         
  901.         theNewContext->AddUser(this);
  902.         BroadcastMessage(msg_NSCGridContextCreated, theNewContext);
  903.         }
  904.     catch (...)
  905.         {
  906.         
  907.         return NULL;
  908.         }
  909.  
  910.     return *theNewContext;
  911. }
  912.  
  913. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  914. //    Ñ    
  915. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  916.  
  917. void* CBrowserContext::DisposeGridContext(
  918.     XP_Bool                    inSaveHistory)
  919. {
  920.     // Fix bug #76484 -- remove multiple calls to LO_DiscardDocument. It will
  921.     // get called in CNSContext::NoMoreUsers()
  922.     // LO_DiscardDocument(&mContext);
  923.  
  924.     if (!inSaveHistory)
  925.         {
  926.         // We will call this again in ~CNSContext, but it looks safe to call
  927.         // again because the first call will set mContext.hist.list_ptr to zero.
  928.         // We need to call this here because we might try to destroy form
  929.         // elements in the history, which are destroyed by a callback through
  930.         // the associated CHTMLView; but the broadcast below will destroy the
  931.         // CHTMLView.
  932.         SHIST_EndSession(&mContext);
  933.         }
  934.     
  935.     XP_List* theHistoryList = NULL;
  936.     if (inSaveHistory)
  937.         {
  938.         theHistoryList = mContext.hist.list_ptr;
  939.         mContext.hist.list_ptr = NULL;
  940.         }
  941.  
  942.     Assert_(mContext.grid_parent != NULL);
  943.     CBrowserContext* theParentContext = ExtractBrowserContext(mContext.grid_parent);
  944.     Assert_(theParentContext != NULL);
  945.     
  946.     theParentContext->DisposeGridChild(this);
  947.     
  948.     // Moved broadcast past DisposeGridChild() so that the view has the last shared reference
  949.     // on the context. Thus, the view is still valid when the context is actually disposed,
  950.     // and callback such as HideJavaAppElement will still work.
  951.     // Now that this broadcast happens after the call to DisposeGridChild(), a more
  952.     // appropriate message would be msg_NSCGridContextPostDispose.
  953.     
  954.     // First we broadcast to an client views that this grid context is about to die
  955.     // clients should clean up and remove their shared references to the context
  956.     // upon receiving this message.
  957.     BroadcastMessage(msg_NSCGridContextPreDispose, &inSaveHistory);
  958.  
  959.     return theHistoryList;
  960. }
  961.  
  962. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  963. //    Ñ    
  964. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  965.  
  966. void CBrowserContext::DisposeGridChild(
  967.     CBrowserContext*                inChildContext)
  968. {
  969.     Assert_(inChildContext != this);
  970.     Assert_(inChildContext != NULL);
  971.  
  972.     // 97.12.19 pchen. Fix AT&T bug #97213. If we're removing all our
  973.     // grid children, reset scroll mode of our corresponding CHTMLView.
  974.     if (CountGridChildren() == 1)
  975.     {
  976.         // removing grid children, reset scroll mode on CHTMLView
  977.         CHTMLView* theCurrentView = ExtractHyperView(*this);
  978.         if (theCurrentView != NULL)
  979.         {
  980.             theCurrentView->ResetToDefaultScrollMode();
  981.         }
  982.     }
  983.  
  984.     inChildContext->RemoveUser(this);
  985.     BroadcastMessage(msg_NSCGridContextDisposed);
  986. }
  987.  
  988. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  989. //    Ñ    
  990. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  991.  
  992. void CBrowserContext::ReloadGridFromHistory(
  993.     void*                     inHistEntry,
  994.     NET_ReloadMethod         inReload)
  995. {
  996.     History_entry*    theHist = (History_entry*)inHistEntry;
  997.     if (theHist == NULL)
  998.         return;
  999.             
  1000.     URL_Struct*    theURL = SHIST_CreateURLStructFromHistoryEntry(*this, theHist);
  1001.     theURL->force_reload = inReload;
  1002.     
  1003.     SwitchLoadURL(theURL, FO_CACHE_AND_PRESENT);
  1004. }
  1005.  
  1006. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1007. //    Ñ    
  1008. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1009.  
  1010. void CBrowserContext::RestructureGridContext(
  1011.     Int32                    inX,
  1012.     Int32                     inY,
  1013.     Int32                    inWidth,
  1014.     Int32                    inHeight)
  1015. {
  1016.     Assert_(mContext.type != MWContextText);
  1017.     
  1018.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1019.     Assert_(theCurrentView != NULL);
  1020.     if (theCurrentView == NULL)
  1021.         return;
  1022.     theCurrentView->RestructureGridView(inX, inY, inWidth, inHeight);
  1023. }
  1024.  
  1025. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1026. //    Ñ    
  1027. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1028.  
  1029. void CBrowserContext::GetFullGridSize(
  1030.     Int32&                    outWidth,
  1031.     Int32&                    outHeight)
  1032. {
  1033.     outWidth = outHeight = 80;
  1034.     if (mContext.type != MWContextText)
  1035.         {
  1036.         CHTMLView* theCurrentView = ExtractHyperView(*this);
  1037.         Assert_(theCurrentView != NULL);
  1038.         if (theCurrentView)
  1039.             theCurrentView->GetFullGridSize(outWidth, outHeight);
  1040.         }
  1041. }
  1042.  
  1043. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1044. //    Ñ    
  1045. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1046.  
  1047. Int32 CBrowserContext::CountGridChildren(void) const
  1048. {
  1049.     Int32 theChildCount = 0;
  1050.     if (mContext.grid_children != NULL)
  1051.         theChildCount = XP_ListCount(mContext.grid_children);
  1052.         
  1053.     return theChildCount;
  1054. }
  1055.  
  1056. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1057. //
  1058. #pragma mark --- CALLBACK IMPLEMENTATION ---
  1059. //
  1060. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1061.  
  1062.  
  1063. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1064. //    Ñ    
  1065. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1066.  
  1067. void CBrowserContext::AllConnectionsComplete(void)
  1068. {
  1069.     mIsRepaginating = false;
  1070.     
  1071.     CNSContext::AllConnectionsComplete();
  1072.     
  1073.     if (CWebFontReference::NeedToReload(*this))
  1074.     {
  1075.         LO_InvalidateFontData(*this);
  1076.         this->Repaginate();
  1077.     }
  1078.         
  1079. }
  1080.  
  1081. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1082. //    Ñ    
  1083. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1084.  
  1085. void CBrowserContext::LayoutNewDocument(
  1086.     URL_Struct*            inURL,
  1087.     Int32*                inWidth,
  1088.     Int32*                inHeight,
  1089.     Int32*                inMarginWidth,
  1090.     Int32*                inMarginHeight)
  1091. {
  1092.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1093.     // Check to see if theCurrentView is NULL because it's possible
  1094.     // for XP code to try to lay out after we've destroyed window
  1095.     if (theCurrentView != NULL)
  1096.     {
  1097.         theCurrentView->LayoutNewDocument(inURL, inWidth, inHeight, inMarginWidth, inMarginHeight);
  1098.         
  1099.         CStr31 theTitle = CFileMgr::FileNameFromURL(inURL->address);
  1100.         History_entry* theNewEntry = SHIST_CreateHistoryEntry(inURL, theTitle);
  1101.         SHIST_AddDocument(*this, theNewEntry);
  1102.         
  1103.         BroadcastMessage(msg_NSCLayoutNewDocument, inURL);
  1104.         
  1105.         // setup security status
  1106.         if (!IsGridChild())
  1107.         {
  1108.             int status = XP_GetSecurityStatus(*this);
  1109.             BroadcastMessage(msg_SecurityState, (void*)status);
  1110.         }
  1111.     }
  1112.     // 97-06-04 pkc -- clear default status string in context
  1113.     ClearDefaultStatus();
  1114. }
  1115.  
  1116. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1117. //    Ñ    
  1118. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1119.     
  1120. void CBrowserContext::SetDocTitle(
  1121.     char*                     inTitle)
  1122. {
  1123.     // 97-05-20 pkc -- don't broadcast if we're in NoMoreUsers() call chain
  1124.     // only broadcast doc title changed if we're top-level context
  1125.     if (!mInNoMoreUsers && !IsGridChild())
  1126.     {
  1127.         if(inTitle != NULL)      
  1128.         {
  1129.             unsigned char *converted =
  1130.                     INTL_ConvertLineWithoutAutoDetect(
  1131.                             INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(&mContext)),
  1132.                             ScriptToEncoding(::FontToScript(applFont)),
  1133.                             (unsigned char *) inTitle,
  1134.                             (uint32) XP_STRLEN(inTitle));
  1135.             if (converted && ((char *) converted != inTitle))
  1136.             {
  1137.                 inTitle = (char *) converted;
  1138.             } 
  1139.  
  1140.             StrAllocCopy(mContext.title, inTitle);
  1141.             SHIST_SetTitleOfCurrentDoc(&mContext);
  1142.             BroadcastMessage(msg_NSCDocTitleChanged, inTitle);
  1143.             if (converted)
  1144.                 XP_FREE(converted);
  1145.         }
  1146.     }
  1147. }
  1148.  
  1149. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1150. //    Ñ    
  1151. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1152.  
  1153. void CBrowserContext::FinishedLayout(void)
  1154. {
  1155.     FM_SetFlushable(&mContext, true);
  1156.  
  1157.     if (!mInNoMoreUsers)
  1158.         BroadcastMessage(msg_NSCFinishedLayout);
  1159. }
  1160.  
  1161. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1162. //    Ñ    
  1163. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1164.  
  1165. int CBrowserContext::GetTextInfo(
  1166.     LO_TextStruct*            inText,
  1167.     LO_TextInfo*            inTextInfo)
  1168. {
  1169.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1170.     Assert_(theCurrentView != NULL);
  1171.     if (theCurrentView == NULL)
  1172.         return 1;
  1173.     return theCurrentView->GetTextInfo(inText, inTextInfo);
  1174. }
  1175.  
  1176. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1177. //    Ñ    
  1178. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1179.  
  1180. int CBrowserContext::MeasureText(
  1181.     LO_TextStruct*            inText,
  1182.     short*                    outCharLocs)
  1183. {
  1184.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1185.     Assert_(theCurrentView != NULL);
  1186.     if (theCurrentView == NULL)
  1187.         return 0;
  1188.     return theCurrentView->MeasureText(inText, outCharLocs);
  1189. }
  1190.  
  1191. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1192. //    Ñ    
  1193. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1194.  
  1195. void CBrowserContext::GetEmbedSize(
  1196.     LO_EmbedStruct*            inEmbedStruct,
  1197.     NET_ReloadMethod        inReloadMethod)
  1198. {
  1199.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1200.     Assert_(theCurrentView != NULL);
  1201.     if (theCurrentView == NULL)
  1202.         return;
  1203.     theCurrentView->GetEmbedSize(inEmbedStruct, inReloadMethod);
  1204. }
  1205.  
  1206. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1207. //    Ñ    
  1208. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1209.  
  1210. void CBrowserContext::GetJavaAppSize(
  1211.     LO_JavaAppStruct*        inJavaAppStruct,
  1212.     NET_ReloadMethod        inReloadMethod)
  1213. {
  1214.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1215.     Assert_(theCurrentView != NULL);
  1216.     if (theCurrentView == NULL)
  1217.         return;
  1218.     theCurrentView->GetJavaAppSize(inJavaAppStruct, inReloadMethod);
  1219. }
  1220.  
  1221. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1222. //    Ñ    
  1223. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1224.  
  1225. void CBrowserContext::GetFormElementInfo(
  1226.     LO_FormElementStruct*     inElement)
  1227. {
  1228.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1229.     Assert_(theCurrentView != NULL);
  1230.     if (theCurrentView == NULL)
  1231.         return;
  1232.     theCurrentView->GetFormElementInfo(inElement);
  1233. }
  1234.  
  1235. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1236. //    Ñ    
  1237. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1238.  
  1239. void CBrowserContext::GetFormElementValue(
  1240.     LO_FormElementStruct*     inElement,
  1241.     XP_Bool                 inHide)
  1242. {
  1243.     /*
  1244.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1245.     Assert_(theCurrentView != NULL);
  1246.     theCurrentView->GetFormElementValue(inElement, inHide);
  1247.     */
  1248.     // Check that the view is not deleted, because the form elements
  1249.     // try to access panes within that view.
  1250.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1251.     if (theCurrentView)
  1252.         UFormElementFactory::GetFormElementValue(inElement, inHide);
  1253. }
  1254.  
  1255. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1256. //    Ñ    
  1257. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1258.  
  1259. void CBrowserContext::ResetFormElement(
  1260.     LO_FormElementStruct*     inElement)
  1261. {
  1262.     /*
  1263.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1264.     Assert_(theCurrentView != NULL);
  1265.     theCurrentView->ResetFormElement(inElement);
  1266.     */
  1267.     UFormElementFactory::ResetFormElement(inElement, true, true);
  1268. }
  1269.  
  1270. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1271. //    Ñ    
  1272. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1273.  
  1274. void CBrowserContext::SetFormElementToggle(
  1275.     LO_FormElementStruct*     inElement,
  1276.     XP_Bool                 inToggle)
  1277. {
  1278.     /*
  1279.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1280.     Assert_(theCurrentView != NULL);
  1281.     theCurrentView->SetFormElementToggle(inElement, inToggle);
  1282.     */
  1283.     UFormElementFactory::SetFormElementToggle(inElement, inToggle);
  1284. }
  1285.  
  1286. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1287. //    Ñ    
  1288. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1289.  
  1290. void CBrowserContext::FreeEmbedElement(
  1291.     LO_EmbedStruct*            inEmbedStruct)
  1292. {
  1293.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1294.     Assert_(theCurrentView != NULL);
  1295.     if (theCurrentView != NULL)
  1296.         theCurrentView->FreeEmbedElement(inEmbedStruct);
  1297. }
  1298.  
  1299. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1300. //    Ñ    
  1301. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1302.  
  1303. void CBrowserContext::CreateEmbedWindow(
  1304.     NPEmbeddedApp*        inEmbeddedApp)
  1305. {
  1306.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1307.     Assert_(theCurrentView != NULL);
  1308.     if (theCurrentView != NULL)
  1309.         theCurrentView->CreateEmbedWindow(inEmbeddedApp);
  1310. }
  1311.  
  1312. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1313. //    Ñ    
  1314. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1315.  
  1316. void CBrowserContext::SaveEmbedWindow(
  1317.     NPEmbeddedApp*        inEmbeddedApp)
  1318. {
  1319.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1320.     Assert_(theCurrentView != NULL);
  1321.     if (theCurrentView != NULL)
  1322.         theCurrentView->SaveEmbedWindow(inEmbeddedApp);
  1323. }
  1324.  
  1325. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1326. //    Ñ    
  1327. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1328.  
  1329. void CBrowserContext::RestoreEmbedWindow(
  1330.     NPEmbeddedApp*        inEmbeddedApp)
  1331. {
  1332.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1333.     Assert_(theCurrentView != NULL);
  1334.     if (theCurrentView != NULL)
  1335.         theCurrentView->RestoreEmbedWindow(inEmbeddedApp);
  1336. }
  1337.  
  1338. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1339. //    Ñ    
  1340. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1341.  
  1342. void CBrowserContext::DestroyEmbedWindow(
  1343.     NPEmbeddedApp*        inEmbeddedApp)
  1344. {
  1345.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1346.     Assert_(theCurrentView != NULL);
  1347.     if (theCurrentView != NULL)
  1348.         theCurrentView->DestroyEmbedWindow(inEmbeddedApp);
  1349. }
  1350.  
  1351. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1352. //    Ñ    
  1353. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1354.  
  1355. void CBrowserContext::FreeJavaAppElement(
  1356.     LJAppletData*            inAppletData)
  1357. {
  1358.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1359.     Assert_(theCurrentView != NULL);
  1360.     if (theCurrentView != NULL)
  1361.         theCurrentView->FreeJavaAppElement(inAppletData);
  1362. }
  1363.  
  1364. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1365. //    Ñ    
  1366. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1367.  
  1368. void CBrowserContext::HideJavaAppElement(
  1369.     LJAppletData*                inAppletData)
  1370. {
  1371.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1372.     Assert_(theCurrentView != NULL);
  1373.     if (theCurrentView != NULL)
  1374.         theCurrentView->HideJavaAppElement(inAppletData);
  1375. }
  1376.  
  1377. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1378. //    Ñ    
  1379. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1380.  
  1381. void CBrowserContext::FreeEdgeElement(
  1382.     LO_EdgeStruct*            inEdgeStruct)
  1383. {
  1384.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1385.     Assert_(theCurrentView != NULL);
  1386.     if (theCurrentView != NULL)
  1387.         theCurrentView->FreeEdgeElement(inEdgeStruct);
  1388. }
  1389.  
  1390. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1391. //    Ñ    
  1392. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1393.  
  1394. void CBrowserContext::FormTextIsSubmit(
  1395.     LO_FormElementStruct*     inElement)
  1396. {
  1397.     /*
  1398.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1399.     Assert_(theCurrentView != NULL);
  1400.     theCurrentView->FormTextIsSubmit(inElement);
  1401.     */
  1402.     UFormElementFactory::FormTextIsSubmit(inElement);
  1403. }
  1404.  
  1405. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1406. //    Ñ    
  1407. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1408.  
  1409. void CBrowserContext::DisplaySubtext(
  1410.     int                     inLocation,
  1411.     LO_TextStruct*            inText,
  1412.     Int32                     inStartPos,
  1413.     Int32                    inEndPos,
  1414.     XP_Bool                 inNeedBG)
  1415. {
  1416.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1417.     Assert_(theCurrentView != NULL);
  1418.     if (theCurrentView == NULL)
  1419.         return;
  1420.     theCurrentView->DisplaySubtext(inLocation, inText, inStartPos, inEndPos, inNeedBG);
  1421. }
  1422.  
  1423. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1424. //    Ñ    
  1425. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1426.  
  1427. void CBrowserContext::DisplayText(
  1428.     int                     inLocation,
  1429.     LO_TextStruct*            inText,
  1430.     XP_Bool                 inNeedBG)
  1431. {
  1432.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1433.     Assert_(theCurrentView != NULL);
  1434.     if (theCurrentView == NULL)
  1435.         return;
  1436.     theCurrentView->DisplayText(inLocation, inText, inNeedBG);
  1437. }
  1438.  
  1439. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1440. //    Ñ    
  1441. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1442.  
  1443. void CBrowserContext::DisplayEmbed(
  1444.     int                     inLocation,
  1445.     LO_EmbedStruct*            inEmbedStruct)
  1446. {
  1447.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1448.     Assert_(theCurrentView != NULL);
  1449.     if (theCurrentView == NULL)
  1450.         return;
  1451.     theCurrentView->DisplayEmbed(inLocation, inEmbedStruct);
  1452. }
  1453.  
  1454. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1455. //    Ñ    
  1456. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1457.  
  1458. void CBrowserContext::DisplayJavaApp(
  1459.     int                     inLocation,
  1460.     LO_JavaAppStruct*        inJavaAppStruct)
  1461. {
  1462.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1463.     Assert_(theCurrentView != NULL);
  1464.     if (theCurrentView == NULL)
  1465.         return;
  1466.     theCurrentView->DisplayJavaApp(inLocation, inJavaAppStruct);
  1467. }
  1468.  
  1469. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1470. //    Ñ    
  1471. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1472.  
  1473. void CBrowserContext::DisplayEdge(
  1474.     int                     inLocation,
  1475.     LO_EdgeStruct*            inEdgeStruct)
  1476. {
  1477.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1478.     Assert_(theCurrentView != NULL);
  1479.     if (theCurrentView == NULL)
  1480.         return;
  1481.     theCurrentView->DisplayEdge(inLocation, inEdgeStruct);
  1482. }
  1483.  
  1484. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1485. //    Ñ    
  1486. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1487.  
  1488. void CBrowserContext::DisplayTable(
  1489.     int                     inLocation,
  1490.     LO_TableStruct*            inTableStruct)
  1491. {
  1492.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1493.     Assert_(theCurrentView != NULL);
  1494.     if (theCurrentView == NULL)
  1495.         return;
  1496.     theCurrentView->DisplayTable(inLocation, inTableStruct);
  1497. }
  1498.  
  1499. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1500. //    Ñ    
  1501. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1502.  
  1503. void CBrowserContext::DisplayCell(
  1504.     int                     inLocation,
  1505.     LO_CellStruct*            inCellStruct)
  1506. {
  1507.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1508.     Assert_(theCurrentView != NULL);
  1509.     if (theCurrentView == NULL)
  1510.         return;
  1511.     theCurrentView->DisplayCell(inLocation, inCellStruct);
  1512. }
  1513.  
  1514. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1515. //    Ñ    
  1516. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1517.  
  1518. void CBrowserContext::InvalidateEntireTableOrCell(
  1519.     LO_Element*            inElement)
  1520. {
  1521.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1522.     Assert_(theCurrentView != NULL);
  1523.     if (theCurrentView == NULL)
  1524.         return;
  1525.     theCurrentView->InvalidateEntireTableOrCell(inElement);
  1526. }
  1527.  
  1528. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1529. //    Ñ    
  1530. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1531.  
  1532. void CBrowserContext::DisplayAddRowOrColBorder(
  1533.     XP_Rect*                inRect,
  1534.     XP_Bool                    inDoErase)
  1535. {
  1536.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1537.     Assert_(theCurrentView != NULL);
  1538.     if (theCurrentView == NULL)
  1539.         return;
  1540.     theCurrentView->DisplayAddRowOrColBorder(inRect, inDoErase);
  1541. }
  1542.  
  1543. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1544. //    Ñ    
  1545. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1546.  
  1547. void CBrowserContext::DisplaySubDoc(
  1548.     int                     /*inLocation*/,
  1549.     LO_SubDocStruct*        /*inSubdocStruct*/)
  1550. {
  1551.     // Empty NS_xxx implementation
  1552. }
  1553.  
  1554. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1555. //    Ñ    
  1556. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1557.  
  1558. void CBrowserContext::DisplayLineFeed(
  1559.     int                     inLocation,
  1560.     LO_LinefeedStruct*        inLinefeedStruct,
  1561.     XP_Bool                 inNeedBG)
  1562. {
  1563.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1564.     Assert_(theCurrentView != NULL);
  1565.     if (theCurrentView == NULL)
  1566.         return;
  1567.     theCurrentView->DisplayLineFeed(inLocation, inLinefeedStruct, inNeedBG);
  1568. }
  1569.  
  1570. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1571. //    Ñ    
  1572. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1573.  
  1574. void CBrowserContext::DisplayHR(
  1575.     int                     inLocation,
  1576.     LO_HorizRuleStruct*        inRuleStruct)
  1577. {
  1578.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1579.     Assert_(theCurrentView != NULL);
  1580.     if (theCurrentView == NULL)
  1581.         return;
  1582.     theCurrentView->DisplayHR(inLocation, inRuleStruct);
  1583. }
  1584.  
  1585. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1586. //    Ñ    
  1587. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1588.  
  1589. void CBrowserContext::DisplayBullet(
  1590.     int                     inLocation,
  1591.     LO_BullettStruct*        inBullettStruct)
  1592. {
  1593.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1594.     Assert_(theCurrentView != NULL);
  1595.     if (theCurrentView == NULL)
  1596.         return;
  1597.     theCurrentView->DisplayBullet(inLocation, inBullettStruct);
  1598. }
  1599.  
  1600. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1601. //    Ñ    
  1602. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1603.  
  1604. void CBrowserContext::DisplayFormElement(
  1605.     int                     inLocation,
  1606.     LO_FormElementStruct*     inFormElement)
  1607. {
  1608.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1609.     Assert_(theCurrentView != NULL);
  1610.     if (theCurrentView == NULL)
  1611.         return;
  1612.     theCurrentView->DisplayFormElement(inLocation, inFormElement);
  1613. }
  1614.  
  1615. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1616. //    Ñ    
  1617. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1618.  
  1619. void CBrowserContext::DisplayBorder(
  1620.     int                     inLocation,
  1621.     int                        inX,
  1622.     int                        inY,
  1623.     int                        inWidth,
  1624.     int                        inHeight,
  1625.     int                        inBW,
  1626.     LO_Color*                 inColor,
  1627.     LO_LineStyle            inStyle)
  1628. {
  1629.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1630.     Assert_(theCurrentView != NULL);
  1631.     if (theCurrentView == NULL)
  1632.         return;
  1633.     theCurrentView->DisplayBorder(inLocation, inX, inY, inWidth, inHeight, inBW, inColor, inStyle);
  1634. }
  1635.  
  1636.  
  1637. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1638. //    Ñ    UpdateEnableStates--Editor can change enable/disable state of buttons
  1639. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1640.  
  1641. void CBrowserContext::UpdateEnableStates()
  1642. {
  1643.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1644.     Assert_(theCurrentView != NULL);
  1645.     if (theCurrentView == NULL)
  1646.         return;
  1647.     theCurrentView->UpdateEnableStates();
  1648. }
  1649.  
  1650. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1651. //    Ñ    DisplayFeedback--Editor shows selection
  1652. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1653.  
  1654. void CBrowserContext::DisplayFeedback(
  1655.     int                     inLocation,
  1656.     LO_Element_struct        *inElement)
  1657. {
  1658.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1659.     Assert_(theCurrentView != NULL);
  1660.     if (theCurrentView == NULL)
  1661.         return;
  1662.     theCurrentView->DisplayFeedback(inLocation, inElement);
  1663. }
  1664.  
  1665. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1666. //    Ñ    
  1667. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1668.  
  1669. void CBrowserContext::ClearView(
  1670.     int                     inWhich)
  1671. {
  1672.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1673.     Assert_(theCurrentView != NULL);
  1674.     if (theCurrentView == NULL)
  1675.         return;
  1676.     theCurrentView->ClearView(inWhich);
  1677. }
  1678.  
  1679. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1680. //    Ñ    
  1681. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1682.  
  1683. void CBrowserContext::SetDocDimension(
  1684.     int                     inLocation,
  1685.     Int32                     inWidth,
  1686.     Int32                     inLength)
  1687. {
  1688.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1689.     // Check to see if theCurrentView is NULL because it's possible
  1690.     // for XP code to try to lay out after we've destroyed window
  1691.     if (theCurrentView != NULL)
  1692.         theCurrentView->SetDocDimension(inLocation, inWidth, inLength);
  1693. }
  1694.  
  1695. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1696. //    Ñ    
  1697. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1698.  
  1699. void CBrowserContext::SetDocPosition(
  1700.     int                     inLocation,
  1701.     Int32                     inX,
  1702.     Int32                     inY)
  1703. {
  1704.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1705.     // Check to see if theCurrentView is NULL because it's possible
  1706.     // for XP code to try to lay out after we've destroyed window
  1707.     if (theCurrentView != NULL)
  1708.         theCurrentView->SetDocPosition(inLocation, inX, inY);
  1709. }
  1710.  
  1711. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1712. //    Ñ    
  1713. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1714.  
  1715. void CBrowserContext::GetDocPosition(
  1716.     int                     inLocation,
  1717.     Int32*                    outX,
  1718.     Int32*                    outY)
  1719. {
  1720.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1721.     Assert_(theCurrentView != NULL);
  1722.     if (theCurrentView == NULL)
  1723.         return;
  1724.     theCurrentView->GetDocPosition(inLocation, outX, outY);
  1725. }
  1726.  
  1727. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1728. //    Ñ    
  1729. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1730.  
  1731. void CBrowserContext::SetBackgroundColor(
  1732.     Uint8                     inRed,
  1733.     Uint8                    inGreen,
  1734.     Uint8                     inBlue)
  1735. {
  1736.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1737.     Assert_(theCurrentView != NULL);
  1738.     if (theCurrentView == NULL)
  1739.         return;
  1740.     theCurrentView->SetBackgroundColor(inRed, inGreen, inBlue);
  1741. }
  1742.  
  1743. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1744. //    Ñ    
  1745. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1746.  
  1747. void CBrowserContext::EraseBackground(
  1748.     int                        inLocation,
  1749.     Int32                    inX,
  1750.     Int32                    inY,
  1751.     Uint32                    inWidth,
  1752.     Uint32                    inHeight,
  1753.     LO_Color*                inColor)
  1754. {
  1755.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1756.     Assert_(theCurrentView != NULL);
  1757.     if (theCurrentView != NULL)
  1758.         theCurrentView->EraseBackground(inLocation, inX, inY, inWidth, inHeight, inColor);
  1759. }
  1760.  
  1761. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1762. //    Ñ    
  1763. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1764.  
  1765. void CBrowserContext::SetDrawable(
  1766.     CL_Drawable*            inDrawable)
  1767. {
  1768.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1769.     CDrawable *theDrawable;
  1770.     
  1771.     Assert_(theCurrentView != NULL);
  1772.     if (theCurrentView == NULL)
  1773.         return;
  1774.     if (inDrawable)
  1775.         theDrawable = (CDrawable *) CL_GetDrawableClientData(inDrawable);
  1776.     else
  1777.         theDrawable = NULL;
  1778.     theCurrentView->SetCurrentDrawable(theDrawable);
  1779. }
  1780.  
  1781. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1782. //    Ñ    
  1783. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1784.  
  1785. void CBrowserContext::GetTextFrame(
  1786.     LO_TextStruct*            inTextStruct,
  1787.     Int32                    inStartPos,
  1788.     Int32                    inEndPos,
  1789.     XP_Rect*                outFrame)
  1790. {
  1791.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1792.     Assert_(theCurrentView != NULL);
  1793.     if (theCurrentView != NULL)
  1794.         theCurrentView->GetTextFrame(inTextStruct, inStartPos, inEndPos, outFrame);
  1795. }
  1796.  
  1797. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1798. //    Ñ    
  1799. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1800.  
  1801. void CBrowserContext::GetDefaultBackgroundColor(
  1802.     LO_Color* outColor) const
  1803. {
  1804.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1805.     Assert_(theCurrentView != NULL);
  1806.     if (theCurrentView != NULL)
  1807.         theCurrentView->GetDefaultBackgroundColor(outColor);
  1808. }
  1809.  
  1810. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1811. //    Ñ    
  1812. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1813.  
  1814. void CBrowserContext::DrawJavaApp(
  1815.     int                     inLocation,
  1816.     LO_JavaAppStruct*        inJavaAppStruct)
  1817. {
  1818.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1819.     Assert_(theCurrentView != NULL);
  1820.     if (theCurrentView != NULL)
  1821.         theCurrentView->DrawJavaApp(inLocation, inJavaAppStruct);
  1822. }
  1823.  
  1824. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1825. //    Ñ    
  1826. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1827.  
  1828. void CBrowserContext::HandleClippingView(
  1829.     struct LJAppletData     *appletD, 
  1830.     int                     x, 
  1831.     int                     y, 
  1832.     int                     width, 
  1833.     int                     height)
  1834. {
  1835.     CHTMLView* theCurrentView = ExtractHyperView(*this);
  1836.     Assert_(theCurrentView != NULL);
  1837.     if (theCurrentView != NULL)
  1838.         theCurrentView->HandleClippingView(appletD, x, y, width, height);
  1839. }
  1840.  
  1841. CSharableCompositor::~CSharableCompositor()
  1842. {
  1843.     if (mCompositor)
  1844.         CL_DestroyCompositor(mCompositor);
  1845. }
  1846.  
  1847.  
  1848. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1849. //    Ñ    
  1850. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1851.  
  1852. void CBrowserContext::ConstructJSDialogTitle(LStr255& outTitle)
  1853. {
  1854.     if (mContext.url)
  1855.     {
  1856.         AppendJSStringToHost(outTitle, mContext.url);
  1857.     }
  1858.     else
  1859.     {
  1860.         History_entry* hist = GetCurrentHistoryEntry();
  1861.         if (hist)
  1862.         {
  1863.             AppendJSStringToHost(outTitle, hist->address);
  1864.         }
  1865.         else
  1866.         {
  1867.             AppendJSStringToHost(outTitle, NULL);
  1868.         }
  1869.     }
  1870. }
  1871.  
  1872. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1873. //    Ñ    
  1874. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1875.  
  1876. void CBrowserContext::Alert(
  1877.     const char*                inAlertText)
  1878. {
  1879.     CStr255     pmessage( inAlertText );
  1880.     StripDoubleCRs( pmessage );
  1881.     pmessage=NET_UnEscape(pmessage);
  1882.     if (mContext.bJavaScriptCalling)
  1883.     {
  1884.         // this is a JavaScript alert, make title string for alert
  1885.         LStr255 titleStr;
  1886.         ConstructJSDialogTitle(titleStr);
  1887.         UStdDialogs::Alert(pmessage, eAlertTypeCaution, NULL, NULL, &titleStr);
  1888.     }
  1889.     else
  1890.     {
  1891.         UStdDialogs::Alert(pmessage, eAlertTypeCaution);
  1892.     }
  1893. }
  1894.  
  1895. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1896. //    Ñ    
  1897. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1898.  
  1899. XP_Bool    CBrowserContext::Confirm(
  1900.     const char*             inMessage)
  1901. {
  1902.     XP_Bool result;
  1903.     CStr255 mesg(inMessage);
  1904.     ConvertCRtoLF(mesg);
  1905.     StripDoubleCRs(mesg);
  1906.     mesg = NET_UnEscape(mesg);
  1907.     if (mContext.bJavaScriptCalling)
  1908.     {
  1909.         // this is a JavaScript confirm, make title string for confirm
  1910.         LStr255 titleStr;
  1911.         ConstructJSDialogTitle(titleStr);
  1912.         result = UStdDialogs::AskOkCancel(mesg, NULL, NULL, &titleStr);
  1913.     }
  1914.     else
  1915.     {
  1916.         result = UStdDialogs::AskOkCancel(mesg);
  1917.     }
  1918.     return result;
  1919. }
  1920.  
  1921.  
  1922. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1923. //    Ñ    
  1924. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  1925.  
  1926. char* CBrowserContext::Prompt(
  1927.     const char*             inMessage,
  1928.     const char*                inDefaultText)
  1929. {
  1930.     char* result = NULL;
  1931.     CStr255 mesg(inMessage), ioString(inDefaultText);
  1932.     mesg = NET_UnEscape(mesg);
  1933.     Boolean prompt = false;
  1934.  
  1935.     if (mContext.bJavaScriptCalling)
  1936.     {
  1937.         // this is a JavaScript prompt, make title string for prompt
  1938.         LStr255 titleStr;
  1939.         ConstructJSDialogTitle(titleStr);
  1940.         CStr255 title(titleStr);
  1941.         prompt = UStdDialogs::AskStandardTextPrompt(title, mesg, ioString);
  1942.     }
  1943.     else
  1944.     {
  1945.         prompt = UStdDialogs::AskStandardTextPrompt("", mesg, ioString);
  1946.     }
  1947.     
  1948.     if (prompt)
  1949.     {
  1950.         if (ioString.Length() > 0)
  1951.         {
  1952.             result = (char*)XP_ALLOC(ioString.Length() + 1);
  1953.             ThrowIfNULL_(result);
  1954.             ::BlockMoveData(&ioString[1], result, ioString.Length());
  1955.             result[ioString.Length()] = '\0';
  1956.         }
  1957.     }
  1958.  
  1959.     return result;    
  1960. }
  1961.