// @(#) 1.8.1.4 nt/src/core/odhelp.cpp, odcore, od96nt, odnt9712d 10/14/96 18:00:55 [ 3/21/97 17:37:34 ]
//====START_GENERATED_PROLOG======================================
//
//
//   COMPONENT_NAME: odcore
//
//   CLASSES: none
//
//   ORIGINS: 82,27
//
//
//   (C) COPYRIGHT International Business Machines Corp. 1995,1996
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//   	
//   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
//   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
//   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
//   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
//   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
//   OR PERFORMANCE OF THIS SOFTWARE.
//
//====END_GENERATED_PROLOG========================================
//
/********************************************************************/
/*  Licensed Materials - Property of IBM                            */
/*                                                                  */
/*                                                                  */
/* Copyright (C) International Business Machines Corp., 1994.       */
/* Copyright (C) Apple Computer, Inc., 1994                         */
/*                                                                  */
/*  US Government Users Restricted Rights -                         */
/*  Use, duplication, or disclosure restricted                      */
/*  by GSA ADP Schedule Contract with IBM Corp.                     */
/*                                                                  */
/*  IBM Change History (most recent first):                         */
/*  defect   date   Int.  Desc.                                     */
/*  143882 11/17/95 st    change window title of help to Help       */
/*         09/08/95 mjk   Add Unicode Support                       */
/*  128320 07/21/95 BLG   If invalid file name given to display help*/
/*                        or displayHelpIndex will return kODFalse  */
/*         07/12/95 KEK   Replace references to "docshell.hlp" with */
/*                          ODHELPFILE; #include "odres.h"          */
/*  124089 06/01/95 BLG   DisplayHelp & DisplayIndexHelp always     */
/*                          return false.                           */
/********************************************************************/
/*
  File:    ODHelp.cpp

  Contains:  Opendoc help code for OS/2 and Win NT/95

  Owned by:  Ben Garrett
*/
/*
 *  This file was generated by the SOM Compiler and Emitter Framework.
 *  Generated using:
 *      SOM Emitter emitxtm: 2.41
 */

#ifndef SOM_Module_odhelp_Source
#define SOM_Module_odhelp_Source
#endif

#include "odres.h"  /*KEK*/

#ifndef SOM_ODWindowState_xh
#include <WinStat.xh>
#endif
#ifndef SOM_ODSession_xh
#include <ODSessn.xh>
#endif

#ifndef _HLPPANELS_
#include <hlppanls.h>
#endif

#include "ODHelp.xih"

SOM_Scope void  SOMLINK ODHelpInitHelp(ODHelp *somSelf,  Environment *ev,
                                       ODSession  *Session )
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpInitHelp");

  somThis->fhwndHelp = kODNULL;    // HWND owning HELP (usually DOCSHELL hwnd, but can be the "Select Root Kind" dialog hwnd

}

SOM_Scope ODBoolean  SOMLINK ODHelpDisplayHelp(ODHelp *somSelf,
                                               Environment *ev,
                                               string sHelpFile,
                                               ODULong ulPanelId)
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpDisplayHelp");

  WinHelp(somThis->fhwndHelp,sHelpFile,HELP_CONTEXT,ulPanelId);
  return kODTrue;

}

SOM_Scope ODBoolean  SOMLINK ODHelpDisplayHelpIndex(ODHelp *somSelf,
                                                    Environment *ev,
                                                    string sHelpFile)
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpDisplayHelpIndex");

  WinHelp(somThis->fhwndHelp,sHelpFile,HELP_FINDER,0);
  return kODTrue;

}

SOM_Scope ODBoolean  SOMLINK ODHelpDisplayHelpUsingHelp(ODHelp *somSelf,
                                                        Environment *ev,
                                                        string sHelpFile)
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpDisplayHelpUsingHelp");

  WinHelp(somThis->fhwndHelp,sHelpFile,HELP_HELPONHELP,0);
  return kODTrue;

}

//-----------------------------------------------------------------------
// ODHelpGetHelpID  (private)
//-----------------------------------------------------------------------
SOM_Scope  ODULong  SOMLINK ODHelpGetHelpID(ODHelp *somSelf,
                                            Environment *ev,
                                            ODMenuID menuID)
{
    ODHelpData *somThis = ODHelpGetData(somSelf);
    ODHelpMethodDebug("ODHelp", "ODHelpGetHelpID");

    ODULong helpID;

    switch(menuID)
    {
        case IDMS_DOCUMENT:
            helpID = IDMS_DOCUMENT_PANEL;
            break;
        case DOC_NEW:
            helpID = 16;
            break;
        case DOC_OPENAS:
            helpID = IDMS_DOC_OPENAS_PANEL;
            break;
        case DOC_SAVE:
            helpID = IDMS_DOC_SAVE_PANEL;
            break;
        case DOC_SAVECOPY:
            helpID = IDMS_DOC_SAVECOPY_PANEL;
            break;
        case DOC_REVERTTOSAVED:
            helpID = IDMS_DOC_REVERTTOSAVED_PANEL;
            break;
        case DOC_DRAFTS:
            helpID = IDMS_DR_DRAFT_PANEL;
            break;
        case DOC_DRAFTCREATE:
            helpID = IDMS_CREATINGDRAFT_PANEL;
            break;
        case DOC_DRAFTHISTORY:
            helpID = IDMS_DRAFTWINDOW_PANEL;
            break;
        case DOC_PROPERTIES:
            helpID = IDMS_DOC_PROPERTIES_PANEL;
            break;
        case DOC_SETUP:
            helpID = 1005;
            break;
        case DOC_PRINT:
            helpID = IDMS_DOC_PRINT_PANEL;
            break;
        case DOC_CLOSE:
            helpID = 122;
            break;
        case IDMS_EDIT:
            helpID = IDMS_EDIT_PANEL;
            break;
        case EDIT_UNDO:
            helpID = IDMS_EDIT_UNDO_PANEL;
            break;
        case EDIT_REDO:
            helpID = IDMS_EDIT_REDO_PANEL;
            break;
        case EDIT_CUT:
            helpID = IDMS_EDIT_CUT_PANEL;
            break;
        case EDIT_COPY:
            helpID = IDMS_EDIT_COPY_PANEL;
            break;
        case EDIT_CREATE:
            helpID = IDMS_EDIT_CREATE_PANEL;
            break;
        case EDIT_PASTE:
            helpID = IDMS_EDIT_PASTE_PANEL;
            break;
        case EDIT_PASTEAS:
            helpID = 131;
            break;
        case EDIT_LINK_MENU:
            helpID = LINKINGITEMS_PANEL;
            break;
        case EDIT_PASTELINK:
            helpID = IDMS_EDIT_PASTELINK_PANEL;
            break;
        case EDIT_BREAKLINK:
            helpID = IDMS_EDIT_BREAKLINK_PANEL;
            break;
        case EDIT_LINKINFO:
            helpID = 123;
            break;
        case EDIT_DELETE:
            helpID = IDMS_EDIT_DELETE_PANEL;
            break;
        case EDIT_SELECTALL:
            helpID = IDMS_EDIT_SELECTALL_PANEL;
            break;
        case EDIT_DESELECTALL:
            helpID = IDMS_EDIT_DESELECTALL_PANEL;
            break;
        case EDIT_OPENSEL:
            helpID = IDMS_EDIT_OPENSEL_PANEL;
            break;
        case EDIT_INSERT:
            helpID = 29;
            break;
        case EDIT_SELPROPERTIES:
            helpID = IDMS_EDIT_SELPROPERTIES_PANEL;
            break;
        case IDMS_VIEW:
            helpID = IDMS_VIEW_PANEL;
            break;
        case VIEW_PROPERTIES:
            helpID = IDMS_VIEW_PROPERTIES_PANEL;
            break;
        case VIEW_SHOWAS:
            helpID = IDMS_VIEW_SHOWAS_PANEL;
            break;
        case VIEW_SASMALLICON:
            helpID = VIEW_SASMALLICON_PANEL;
            break;
        case VIEW_SALARGEICON:
            helpID = VIEW_SALARGEICON_PANEL;
            break;
        case VIEW_SATHUMBNAIL:
            helpID = VIEW_SATHUMBNAIL_PANEL;
            break;
        case VIEW_SAFRAME:
            helpID = VIEW_SAFRAME_PANEL;
            break;
        case VIEW_VIEWINWINDOW:
            helpID = 135;
            break;
        case IDMS_HELP:
            helpID = 43;
            break;
        case HELP_INDEX_OD:
            helpID = 33516;
            break;
        case HELP_GENERAL:
            helpID = 33517;
            break;
        case HELP_USING:
            helpID = 33518;
            break;
        case HELP_PRODUCTINFO:
            helpID = 33515;
            break;
        default:
            helpID = 0;
            break;
    }

    return helpID;
}

SOM_Scope void  SOMLINK ODHelpTerminateHelp(ODHelp *somSelf,
                                             Environment *ev)
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpTerminateHelp");

  WinHelp(somThis->fhwndHelp,"",HELP_QUIT,0);

}

SOM_Scope void  SOMLINK ODHelpsomInit(ODHelp *somSelf)
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpsomInit");

  ODHelp_parent_ODObject_somInit(somSelf);
}

SOM_Scope void  SOMLINK ODHelpsomUninit(ODHelp *somSelf)
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpsomUninit");

  ODHelp_parent_ODObject_somUninit(somSelf);
}

SOM_Scope ODSize  SOMLINK ODHelpPurge(ODHelp *somSelf,  Environment *ev,
                                      ODSize size)
{
  ODHelpData *somThis = ODHelpGetData(somSelf);
  ODHelpMethodDebug("ODHelp","ODHelpPurge");

  return (ODHelp_parent_ODObject_Purge(somSelf, ev, size));
}

