Building an ArcGIS Controls map viewer application
PageLayoutControlEvents.cpp
// Copyright 2010 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

  
#include "PageLayoutControlEvents.h"

void PageLayoutControlEvents::OnAfterDraw(VARIANT display, long viewDrawPhase)
{
}

void PageLayoutControlEvents::OnAfterScreenDraw(long hdc)
{
}

void PageLayoutControlEvents::OnBeforeScreenDraw(long hdc)
{
} 

void PageLayoutControlEvents::OnDoubleClick(long button, long shift, long x, 
                                            long y, double mapX, double mapY)
{
} 

void PageLayoutControlEvents::OnExtentUpdated(VARIANT displayTransformation,
                                              VARIANT_BOOL sizeChanged, 
                                              VARIANT newEnvelope)
{
}

void PageLayoutControlEvents::OnFullExtentUpdated(VARIANT displayTransformation, 
                                                  VARIANT newEnvelope)
{
}

void PageLayoutControlEvents::OnKeyDown(long keyCode, long shift)
{
}

void PageLayoutControlEvents::OnKeyUp(long keyCode, long shift)
{
}

void PageLayoutControlEvents::OnFocusMapChanged()
{
}

void PageLayoutControlEvents::OnPageLayoutReplaced(VARIANT newPageLayout)
{
  // Get the extent of the PageLayout's focus map 
  IActiveViewPtr ipActiveView;
  g_ipPageLayoutControl->get_ActiveView(&ipActiveView);
  IMapPtr ipFocusMap;
  ipActiveView->get_FocusMap(&ipFocusMap);
  IActiveViewPtr ipMapActiveView(ipFocusMap); 
  ipMapActiveView->get_Extent(&g_ipCurrentExtent);

  // Trap focus map's ITransformEvents 
  IScreenDisplayPtr ipScreenDisp;
  ipMapActiveView->get_ScreenDisplay(&ipScreenDisp);
  IDisplayTransformationPtr ipDisplayTrans;     
  ipScreenDisp->get_DisplayTransformation(&ipDisplayTrans);
  LPOLESTR lpszGUID;
  ::StringFromIID(IID_ITransformEvents, &lpszGUID);
  IUIDPtr ipUID(CLSID_UID);
  ipUID->put_Value(CComVariant(lpszGUID));
  g_ipTransEventHelper->AdviseEvents(ipDisplayTrans, ipUID);
  
  // Load the same pre-authored map document into the MapControl
  CComBSTR DocFileName;
  IPageLayoutControl2Ptr ipPage2 = g_ipPageLayoutControl;
  ipPage2->get_DocumentFilename(&DocFileName);
  g_ipMapControl->LoadMxFile(DocFileName);

  // Set the extent of the MapControl to be the full extent
  IEnvelopePtr ipFullExtentEnv;
  g_ipMapControl->get_FullExtent(&ipFullExtentEnv);
  g_ipMapControl->put_Extent(ipFullExtentEnv);
}

void PageLayoutControlEvents::OnPageSizeChanged()
{
}

void PageLayoutControlEvents::OnMouseDown(long button, long shift, long x, 
                                          long y, double mapX, double mapY)
{
  // Popup the ToolbarMenu
  if (button == 2)
  {
    long lHWndParent;
    g_ipPageLayoutControl->get_hWnd(&lHWndParent);
    g_ipPopupMenu->PopupMenu(x, y, lHWndParent);
  }  
}

void PageLayoutControlEvents::OnMouseMove(long button, long shift, long x, 
                                          long y, double mapX, double mapY)
{
}

void PageLayoutControlEvents::OnMouseUp(long button, long shift, long x, 
                                        long y, double mapX, double mapY)
{
}

void PageLayoutControlEvents::OnOleDrop(esriControlsDropAction dropAction, 
                                        VARIANT dataObjectHelper, 
                                        long* effect, long button, 
                                        long shift, long x, long y)
{
}

void PageLayoutControlEvents::OnSelectionChanged()
{
}

void PageLayoutControlEvents::OnViewRefreshed(VARIANT ActiveView, long viewDrawPhase, 
                                              VARIANT layerOrElement, VARIANT envelope)
{
}