//*************************************************************************************
void CBCGPOleCntrFrameWnd::RecalcLayout (BOOL bNotify)
{
	AdjustClientArea();
	m_dockManager.AdjustDockingLayout ();
	m_dockManager.RecalcLayout (bNotify);

	CView* pView = GetActiveView ();
	if (pView != NULL && pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView)) && 
		m_dockManager.IsPrintPreviewValid ())
	{
		CRect rectClient = m_dockManager.GetClientAreaBounds ();
		pView->SetWindowPos (NULL, rectClient.left, rectClient.top, 
								rectClient.Width (), rectClient.Height (),
								SWP_NOZORDER  | SWP_NOACTIVATE);
	}

	m_pInPlaceFrame->RecalcLayout (bNotify);
}
//*************************************************************************************
void CBCGPOleDocIPFrameWnd::RecalcLayout (BOOL bNotify)
{
	COleDocIPFrameWnd::RecalcLayout (bNotify);

	if (m_bInRecalcLayout)
		return;

	m_bInRecalcLayout = TRUE;

	m_dockManager.RecalcLayout (bNotify);

	CView* pView = GetActiveView ();
	if (pView != NULL && pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView)) && 
		m_dockManager.IsPrintPreviewValid ())
	{
		CRect rectClient = m_dockManager.GetClientAreaBounds ();
		pView->SetWindowPos (NULL, rectClient.left, rectClient.top, 
								rectClient.Width (), rectClient.Height (),
								SWP_NOZORDER  | SWP_NOACTIVATE);
	}

	m_bInRecalcLayout = FALSE;
}
//*************************************************************************************
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);
    }
}