void COleDocument::PreCloseFrame(CFrameWnd* pFrameArg) { ASSERT_VALID(this); ASSERT_VALID(pFrameArg); // turn off redraw so the user doesn't see the deactivation happening BOOL bSetRedraw = FALSE; if (pFrameArg->GetStyle() & WS_VISIBLE) { pFrameArg->SendMessage(WM_SETREDRAW, (WPARAM)FALSE); bSetRedraw = TRUE; } // deactivate any inplace active items on this frame COleClientItem* pItem = GetInPlaceActiveItem(pFrameArg); if (pItem != NULL) { pItem->Deactivate(); pItem->Close(OLECLOSE_NOSAVE); } // turn redraw back on if (bSetRedraw) pFrameArg->SendMessage(WM_SETREDRAW, (WPARAM)TRUE); // should not have any inplace active items ASSERT(GetInPlaceActiveItem(pFrameArg) == NULL); }
//**************************************************************************** void CBCGPFrameWnd::OnUpdateFrameMenu (HMENU hMenuAlt) { CFrameWnd::OnUpdateFrameMenu (hMenuAlt); BOOL bIsMenuBar = m_Impl.m_pMenuBar != NULL && (m_Impl.m_pMenuBar->GetStyle () & WS_VISIBLE); BOOL bIsRibbon = FALSE; #ifndef BCGP_EXCLUDE_RIBBON if (m_Impl.m_pRibbonBar != NULL && (m_Impl.m_pRibbonBar->GetStyle () & WS_VISIBLE)) { bIsRibbon = TRUE; } #endif if (bIsMenuBar || bIsRibbon) { COleClientItem* pActiveItem = GetInPlaceActiveItem (); if (pActiveItem == NULL || pActiveItem->GetInPlaceWindow () == NULL) { SetMenu (NULL); } else { SetMenu (CMenu::FromHandle (hMenuAlt)); } } }
void COleDocument::PreCloseFrame(CFrameWnd* pFrameArg) { ASSERT_VALID(this); ASSERT_VALID(pFrameArg); // deactivate any inplace active items on this frame COleClientItem* pItem = GetInPlaceActiveItem(pFrameArg); if (pItem != NULL) { pItem->Deactivate(); pItem->Close(OLECLOSE_NOSAVE); } // should not have any inplace active items ASSERT(GetInPlaceActiveItem(pFrameArg) == NULL); }
//**************************************************************************************** void CBCGPFrameWnd::ActiveItemRecalcLayout () { COleClientItem* pActiveItem = GetInPlaceActiveItem (); if (pActiveItem != NULL && pActiveItem->m_pInPlaceFrame != NULL) { CRect rectBounds = m_dockManager.GetClientAreaBounds (); pActiveItem->m_pInPlaceFrame->OnRecalcLayout (); } AdjustClientArea (); }
//*************************************************************************************** void CBCGPFrameWnd::OnClose() { if (m_pPrintPreviewFrame != NULL) { m_pPrintPreviewFrame->SendMessage (WM_COMMAND, AFX_ID_PREVIEW_CLOSE); m_pPrintPreviewFrame = NULL; return; } if (!m_Impl.IsPrintPreview ()) { m_bClosing = TRUE; } // Deactivate OLE container first: COleClientItem* pActiveItem = GetInPlaceActiveItem (); if (pActiveItem != NULL) { pActiveItem->Deactivate (); } m_Impl.OnCloseFrame(); CFrameWnd::OnClose(); }
//************************************************************************************* void CBCGPFrameWnd::RecalcLayout (BOOL bNotify) { if (m_bInRecalcLayout) return; m_bInRecalcLayout = TRUE; BOOL bWasOleInPlaceActive = m_Impl.m_bIsOleInPlaceActive; m_Impl.m_bIsOleInPlaceActive = FALSE; COleClientItem* pActiveItem = GetInPlaceActiveItem (); if (pActiveItem != NULL && pActiveItem->m_pInPlaceFrame != NULL && pActiveItem->GetItemState () == COleClientItem::activeUIState) { m_Impl.m_bIsOleInPlaceActive = TRUE; m_Impl.m_bHadCaption = (GetStyle () & WS_CAPTION) != 0; } if (!m_bIsMinimized) { CView* pView = GetActiveView (); if (m_dockManager.IsPrintPreviewValid () || m_pNotifyHook != NULL) { if (pView != NULL && pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView))) { m_dockManager.RecalcLayout (bNotify); CRect rectClient = m_dockManager.GetClientAreaBounds (); pView->SetWindowPos (NULL, rectClient.left, rectClient.top, rectClient.Width (), rectClient.Height (), SWP_NOZORDER | SWP_NOACTIVATE); } else { if (bNotify && m_pNotifyHook != NULL) { ActiveItemRecalcLayout (); } else { m_bInRecalcLayout = FALSE; CFrameWnd::RecalcLayout (bNotify); AdjustClientArea (); } } } else { m_dockManager.RecalcLayout (bNotify); AdjustClientArea (); } } m_bInRecalcLayout = FALSE; if (bWasOleInPlaceActive != m_Impl.m_bIsOleInPlaceActive) { if (!m_Impl.m_bHadCaption) { if (m_Impl.m_bIsOleInPlaceActive) { ModifyStyle (0, WS_CAPTION); } else { ModifyStyle (WS_CAPTION, 0); } } m_Impl.OnChangeVisualManager (); SetWindowPos (NULL, -1, -1, -1, -1, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED); } }