/***************************************************************************
* DSOFCONTROL.CPP
*
* CDsoFramerControl: The Base Control
*
* Copyright (c)1999-2001 Microsoft Corporation, All Rights Reserved
* Written by DSO Office Integration, Microsoft Developer Support
*
* THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*
***************************************************************************/
#include "dsoframer.h"
////////////////////////////////////////////////////////////////////////
// CDsoFramerControl - The Main Control Class
//
// Serves as a base for the ActiveX Document site object which will do
// the actual embedding.
//
CDsoFramerControl::CDsoFramerControl(LPUNKNOWN punk)
{
ODS("CDsoFramerControl::CDsoFramerControl\n");
m_pOuterUnknown = ((punk) ? punk : (IUnknown*)&m_xInternalUnknown);
}
CDsoFramerControl::~CDsoFramerControl(void)
{
ODS("CDsoFramerControl::~CDsoFramerControl\n");
RELEASE_INTERFACE(m_pITypeInfo);
RELEASE_INTERFACE(m_pClientSite);
RELEASE_INTERFACE(m_pControlSite);
RELEASE_INTERFACE(m_pInPlaceSite);
RELEASE_INTERFACE(m_pInPlaceFrame);
RELEASE_INTERFACE(m_pInPlaceUIWindow);
RELEASE_INTERFACE(m_pViewAdviseSink);
RELEASE_INTERFACE(m_pOleAdviseHolder);
}
////////////////////////////////////////////////////////////////////////
// CDsoFramerControl::InitializeNewInstance
//
// Sets up the inital state for the control. Any other member variable
// not set here will be NULL/FALSE thanks to zero-init in MemAlloc.
//
STDMETHODIMP CDsoFramerControl::InitializeNewInstance()
{
m_clrBorderColor = 0x80000010; // System Button Shadow Color
m_clrBackColor = 0x80000005; // System Window Background Color
m_clrForeColor = 0x80000008; // System Window Text Color
m_clrTBarColor = 0x80000010; // System Button Shadow Color
m_clrTBarTextColor = 0x80000014; // System Button Highlight Color
m_fBorderStyle = dsoBorderFlat;
m_fShowTitlebar = TRUE;
m_fShowToolbars = TRUE;
m_wMenuItems = 0xFFFF; // All items are "enabled" by default
return S_OK;
}
////////////////////////////////////////////////////////////////////////
// CDsoFramerControl::InPlaceActivate
//
// Does all the work in-place activating and/or ui activating the
// control when asked to do so. Sets up the main control window, the
// needed interfaces, and (if not in design) subclasses the main top-level
// window we can monitor messages that must be forwarded to an ip active
// DocObject when we have one loaded.
//
STDMETHODIMP CDsoFramerControl::InPlaceActivate(LONG lVerb)
{
HRESULT hr;
SIZEL sizel;
TRACE1("CDsoFramerControl::InPlaceActivate - %d\n", lVerb);
// if we don't have a client site, then there's not much to do.
if (!m_pClientSite) return S_OK;
// get an InPlace site pointer.
if (NULL == m_pInPlaceSite)
{
hr = m_pClientSite->QueryInterface(IID_IOleInPlaceSite, (void **)&m_pInPlaceSite);
RETURN_ON_FAILURE(hr);
}
// if we're not already active, go and do it.
if (!m_fInPlaceActive)
{
OLEINPLACEFRAMEINFO InPlaceFrameInfo;
RECT rcPos, rcClip;
hr = m_pInPlaceSite->CanInPlaceActivate();
if (hr != S_OK){ if (!FAILED(hr)) hr = E_FAIL; goto cleanup;}
// if we are here, then we have permission to go in-place active.
// now, announce our intentions to actually go ahead and do this.
hr = m_pInPlaceSite->OnInPlaceActivate();
GOTO_ON_FAILURE(hr, cleanup);
// if we're here, we're ready to go in-place active. we just need
// to set up some flags, and then create the window [if we have one]
m_fInPlaceActive = TRUE;
// we need to get some information about our location in the parent
// window, as well as some information about the parent
hr = m_pInPlaceSite->GetWindow(&m_hwndParent);
if (FAILED(hr) || !IsWindow(m_hwndParent))
{
hr = OLE_E_INVALIDHWND;
goto cleanup;
}
InPlaceFrameInfo.cb = sizeof(OLEINPLACEFRAMEINFO);
hr = m_pInPlaceSite->GetWindowContext(&m_pInPlaceFrame, &m_pInPlaceUIWindow, &rcPos, &rcClip, &InPlaceFrameInfo);
GOTO_ON_FAILURE(hr, cleanup);
// make sure we'll display ourselves in the correct location with the correct size
sizel.cx = rcPos.right - rcPos.left;
sizel.cy = rcPos.bottom - rcPos.top;
m_Size = sizel;
m_xOleInplaceObject.SetObjectRects(&rcPos, &rcClip);
// finally, create our window if we have to!
if (NULL == m_hwnd)
{
WNDCLASS wndclass;
EnterCriticalSection(&v_csecThreadSynch);
if (GetClassInfo(v_hModule, "DSOFramerOCXWnd", &wndclass) == 0)
{
memset(&wndclass, 0, sizeof(WNDCLASS));
wndclass.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
wndclass.lpfnWndProc = CDsoFramerControl::ControlWindowProc;
wndclass.hInstance = v_hModule;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.lpszClassName = "DSOFramerOCXWnd";
RegisterClass(&wndclass);
}
m_hwnd = CreateWindowEx(0, "DSOFramerOCXWnd", NULL,
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
rcPos.left, rcPos.top, m_Size.cx, m_Size.cy,
m_hwndParent, NULL, v_hModule, NULL);
if (m_hwnd) SetWindowLong(m_hwnd, GWL_USERDATA, (LONG)this);
LeaveCriticalSection(&v_csecThreadSynch);
if (!m_hwnd) {hr = E_FAIL; goto cleanup;}
}
// finally, tell the host of this
m_pClientSite->ShowObject();
}
// if we're not inplace visible yet, do so now.
if (!m_fInPlaceVisible)
SetInPlaceVisible(TRUE);
// Hook top-level parent window if in RunMode. This let's us
// track WM_ACTIVATEAPP messages, which are critical for DocObjs...
if (!m_pFrameHook)
m_pFrameHook = CDsoFrameWindowHook::AttachToFrameWindow(m_hwnd, this);
// if we were asked to UIActivate, and we currently are not, do so!
if ((lVerb == OLEIVERB_PRIMARY ||
lVerb == OLEIVERB_UIACTIVATE) && (!m_fUIActive))
{
m_fUIActive = TRUE;
// inform the container of our intent
m_pInPlaceSite->OnUIActivate();
// notify the hook we have taked focus...
if (m_pFrameHook)
m_pFrameHook->SetActiveComponent(this);
// take the focus [which is what UI Activation is all about !]
SetFocus(m_hwnd);
// set ourselves up in the host.
if (m_pInPlaceFrame)
m_pInPlaceFrame->SetActiveObject((IOleInPlaceActiveObject*)&m_xOleInplaceActiveObject, NULL);
if (m_pInPlaceUIWindow)
m_pInPlaceUIWindow->SetActiveObject((IOleInPlaceActiveObject*)&m_xOleInplaceActiveObject, NULL);
// we have to explicitly say we don't wany any border space.
if (m_pInPlaceFrame)
m_pInPlaceFrame->SetBorderSpace(NULL);
if (m_pInPlaceUIWindow)
m_pInPlaceUIWindow->SetBorderSpace(NULL);
}
return S_OK; // be-de-be-de-be-de that's all folks!
cleanup:
// something catastrophic happened [or, at least something bad].
// die a horrible fiery mangled painful death.
m_fInPlaceActive = FALSE;
return hr;
}
////////////////////////////////////////////////////////////////////////
// CDsoFramerControl::SetInPlaceVisible
//
// Make sure our control is visible or not (does not actually take ui
// focus, that should be done in InPlaceActivate).
//
STDMETHODIMP_(void) CDsoFramerControl::SetInPlaceVisible(BOOL fShow)
{
BOOL fVisible;
m_fInPlaceVisible = fShow;
// don't do anything if we don't have a window. otherwise, set it
if (m_hwnd)
{
fVisible = IsWindowVisible(m_hwnd);
if (fVisible && !fShow)
没有合适的资源?快使用搜索试试~ 我知道了~
带测试用例的office控件
共34个文件
h:7个
cpp:6个
gif:5个
需积分: 0 13 下载量 112 浏览量
2008-09-10
11:27:26
上传
评论
收藏 188KB ZIP 举报
温馨提示
office控件,能打开word、excel、ppt、PDF等文件,同时附带测试用例!
资源推荐
资源详情
资源评论
收起资源包目录
dsoFramer.zip (34个子文件)
dsoFramer
dsoframer.ocx 55KB
WebTest
bottomcurve.gif 179B
officelogo.gif 5KB
righttopcurve.gif 88B
webtest.htm 9KB
lefttopcurve.gif 89B
Thumbs.db 8KB
mslogo.gif 2KB
Source
version.h 2KB
Release
dsoframer.ocx 55KB
Lib
dsoframer.odl 6KB
dsoframerlib.h 6KB
dsoframer.olb 7KB
dsofdocobj.h 9KB
dsoframer.dsp 6KB
mainentry.cpp 8KB
classfactory.cpp 4KB
dsoframer.h 21KB
dsoframer.dsw 541B
utilities.cpp 22KB
rbbinder.h 8KB
dsofdocobj.cpp 65KB
dsofcontrol.cpp 92KB
dsoframer.plg 2KB
utilities.h 7KB
dsoframer.def 205B
dsoframer.ncb 113KB
Res
dso.ico 318B
resource.h 1KB
Thumbs.db 4KB
dsoframer.rc 4KB
toolbox.bmp 334B
dsoframer.opt 48KB
dsofauto.cpp 24KB
共 34 条
- 1
资源评论
hwz_01
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 王姿.html
- 51单片机学习(1)-软件keil下载
- 历届(第1-21届)希望杯数学竞赛初一试题及答案(最新整理).doc全国数学邀请赛(264页资料)
- 水滴.psd
- TokenPocket_V2.1.2_release.apk
- Apache-druid-kafka-rce.yaml
- 基于C#的ASP.NET数据库原理及应用技术课程指导平台的开发
- 基于ROS的智能车轨迹跟踪算法的仿真与设计源码运用PID跟踪算法.zip.zip
- Bug Bounty Tip - i春秋Self-XSS变废为宝的奇思妙想
- 1991-2015年全国初中化学竞赛复赛试题汇编(212页)(24年竞赛复赛真题).docx天原杯
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功