void COleIPFrameWnd::OnRequestPositionChange(LPCRECT lpRect) { COleServerDoc* pDoc = (COleServerDoc*)GetActiveDocument(); ASSERT_VALID(pDoc); ASSERT_KINDOF(COleServerDoc, pDoc); // DocObjects don't need to generate OnPosRectChange calls, // so we can just return if this is a DoCobject if (pDoc->IsDocObject()) return; // The default behavior is to not affect the extent during the // call to RequestPositionChange. This results in consistent // scaling behavior. pDoc->RequestPositionChange(lpRect); }
void COleIPFrameWnd::RecalcLayout(BOOL /*bNotify*/) { ASSERT_VALID(this); // better have a parent window (only used for inplace) CWnd* pParentWnd = GetParent(); ASSERT_VALID(pParentWnd); // see if this frame is supporting a normal in-place object or // a DocObject. DocObjects put scrollbars on the inside of the rect UINT nAdjustType = CWnd::adjustBorder; COleServerDoc* pDoc = (COleServerDoc*) GetActiveDocument(); if (pDoc != NULL) { ASSERT_VALID(pDoc); if (pDoc->IsDocObject()) nAdjustType = CWnd::adjustOutside; } // first call reposition bars with arbitarily large rect just to // see how much space the bars will take up CRect rectBig(0, 0, INT_MAX/2, INT_MAX/2); CRect rectLeft; RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &rectLeft, &rectBig); // grow the rect by the size of the control bars CRect rect = m_rectPos; rect.left -= rectLeft.left; rect.top -= rectLeft.top; rect.right += INT_MAX/2 - rectLeft.right; rect.bottom += INT_MAX/2 - rectLeft.bottom; // see how much extra space for non-client areas (such as scrollbars) // that the view needs. CWnd* pLeftOver = GetDlgItem(AFX_IDW_PANE_FIRST); if (pLeftOver != NULL) { rectBig = m_rectPos; pLeftOver->CalcWindowRect(&rectBig, CWnd::adjustOutside); rect.left -= m_rectPos.left - rectBig.left; rect.top -= m_rectPos.top - rectBig.top; rect.right += rectBig.right - m_rectPos.right; rect.bottom += rectBig.bottom - m_rectPos.bottom; } // adjust for non-client area on the frame window CalcWindowRect(&rect, nAdjustType); // the frame window must be clipped to the visible part in the container CRect rectVis; rectVis.IntersectRect(&rect, &m_rectClip); // move the window AfxRepositionWindow(NULL, m_hWnd, &rectVis); // now resize the control bars relative to the (now moved) frame pParentWnd->ClientToScreen(&rect); ScreenToClient(&rect); RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, CWnd::reposDefault, NULL, &rect); }