📄 dsofdocobj.h
字号:
/***************************************************************************
* DSOFDOCOBJ.H
*
* DSOFramer: OLE DocObject Site component (used by the control)
*
* Copyright ?999-2004; Microsoft Corporation. All rights reserved.
* Written by Microsoft Developer Support Office Integration (PSS DSOI)
*
* This code is provided via KB 311765 as a sample. It is not a formal
* product and has not been tested with all containers or servers. Use it
* for educational purposes only. See the EULA.TXT file included in the
* KB download for full terms of use and restrictions.
*
* 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.
*
***************************************************************************/
#ifndef DS_DSOFDOCOBJ_H
#define DS_DSOFDOCOBJ_H
////////////////////////////////////////////////////////////////////
// Declarations for Interfaces used in DocObject Containment
//
#include <docobj.h> // Standard DocObjects (common to all AxDocs)
#include "ipprevw.h" // PrintPreview (for select Office apps)
#include "rbbinder.h" // Internet Publishing (for Web Folder write access)
////////////////////////////////////////////////////////////////////
// CDsoDocObject -- ActiveDocument Container Site Object
//
// The CDsoDocObject object handles all the DocObject embedding for the
// control and os fairly self-contained. Like the control it has its
// own window, but it merely acts as a parent for the embedded object
// window(s) which it activates.
//
// CDsoDocObject works by taking a file (or automation object) and
// copying out the OLE storage used for its persistent data. It then
// creates a new embedding based on the data. If a storage is not
// avaiable, it will attempt to oad the file directly, but the results
// are less predictable using this manner since DocObjects are embeddings
// and not links and this component has limited support for links. As a
// result, we will attempt to keep our own storage copy in most cases.
//
// You should note that this approach is different than one taken by the
// web browser control, which is basically a link container which will
// try to embed (ip activate) if allowed, but if not it opens the file
// externally and keeps the link. If CDsoDocObject cannot embed the object,
// it returns an error. It will not open the object external.
//
// Like the control, this object also uses nested classes for the OLE
// interfaces used in the embedding. They are easier to track and easier
// to debug if a specific interface is over/under released. Again this was
// a design decision to make the sample easier to break apart, but not required.
//
// Because the object is not tied to the top-level window, it constructs
// the OLE merged menu as a set of popup menus which the control then displays
// in whatever form it wants. You would need to customize this if you used
// the control in a host and wanted the menus to merge with the actual host
// menu bar (on the top-level window or form).
//
class CDsoFramerControl;
class CDsoDocObject : public IUnknown
{
public:
BOOL m_bNewCreate;//if the DocObject is Opened ..the FALSE ,otherwize TRUE;
CDsoDocObject();
~CDsoDocObject();
CDsoFramerControl * m_pParentCtrl;
// IUnknown Implementation
STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
// IOleClientSite Implementation
BEGIN_INTERFACE_PART(OleClientSite, IOleClientSite)
STDMETHODIMP SaveObject(void);
STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker** ppmk);
STDMETHODIMP GetContainer(IOleContainer** ppContainer);
STDMETHODIMP ShowObject(void);
STDMETHODIMP OnShowWindow(BOOL fShow);
STDMETHODIMP RequestNewObjectLayout(void);
END_INTERFACE_PART(OleClientSite)
// IOleInPlaceSite Implementation
BEGIN_INTERFACE_PART(OleInPlaceSite, IOleInPlaceSite)
STDMETHODIMP GetWindow(HWND* phwnd);
STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
STDMETHODIMP CanInPlaceActivate(void);
STDMETHODIMP OnInPlaceActivate(void);
STDMETHODIMP OnUIActivate(void);
STDMETHODIMP GetWindowContext(IOleInPlaceFrame** ppFrame, IOleInPlaceUIWindow** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
STDMETHODIMP Scroll(SIZE sz);
STDMETHODIMP OnUIDeactivate(BOOL fUndoable);
STDMETHODIMP OnInPlaceDeactivate(void);
STDMETHODIMP DiscardUndoState(void);
STDMETHODIMP DeactivateAndUndo(void);
STDMETHODIMP OnPosRectChange(LPCRECT lprcPosRect);
END_INTERFACE_PART(OleInPlaceSite)
// IOleDocumentSite Implementation
BEGIN_INTERFACE_PART(OleDocumentSite, IOleDocumentSite)
STDMETHODIMP ActivateMe(IOleDocumentView* pView);
END_INTERFACE_PART(OleDocumentSite)
// IOleInPlaceFrame Implementation
BEGIN_INTERFACE_PART(OleInPlaceFrame, IOleInPlaceFrame)
STDMETHODIMP GetWindow(HWND* phWnd);
STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
STDMETHODIMP GetBorder(LPRECT prcBorder);
STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS pBW);
STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS pBW);
STDMETHODIMP SetActiveObject(LPOLEINPLACEACTIVEOBJECT pIIPActiveObj, LPCOLESTR pszObj);
STDMETHODIMP InsertMenus(HMENU hMenu, LPOLEMENUGROUPWIDTHS pMGW);
STDMETHODIMP SetMenu(HMENU hMenu, HOLEMENU hOLEMenu, HWND hWndObj);
STDMETHODIMP RemoveMenus(HMENU hMenu);
STDMETHODIMP SetStatusText(LPCOLESTR pszText);
STDMETHODIMP EnableModeless(BOOL fEnable);
STDMETHODIMP TranslateAccelerator(LPMSG pMSG, WORD wID);
END_INTERFACE_PART(OleInPlaceFrame)
// IOleCommandTarget Implementation
BEGIN_INTERFACE_PART(OleCommandTarget , IOleCommandTarget)
STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText);
STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvaIn, VARIANTARG *pvaOut);
END_INTERFACE_PART(OleCommandTarget)
// IAuthenticate Implementation
BEGIN_INTERFACE_PART(Authenticate , IAuthenticate)
STDMETHODIMP Authenticate(HWND *phwnd, LPWSTR *pszUsername, LPWSTR *pszPassword);
END_INTERFACE_PART(Authenticate)
// IServiceProvider Implementation
BEGIN_INTERFACE_PART(ServiceProvider , IServiceProvider)
STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void **ppv);
END_INTERFACE_PART(ServiceProvider)
// IContinueCallback Implementation
BEGIN_INTERFACE_PART(ContinueCallback , IContinueCallback)
STDMETHODIMP FContinue(void);
STDMETHODIMP FContinuePrinting(LONG cPagesPrinted, LONG nCurrentPage, LPOLESTR pwszPrintStatus);
END_INTERFACE_PART(ContinueCallback)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -