COLORREF CPreviewDC::SetBkColor( COLORREF crColor ) /*************************************************/ { COLORREF crOldColor = ::SetBkColor( m_hAttribDC, crColor ); MirrorFont(); return( crOldColor ); }
CFont *CPreviewDC::SelectObject( CFont *pFont ) /*********************************************/ { HFONT hOldFont = (HFONT)::SelectObject( m_hAttribDC, pFont->GetSafeHandle() ); MirrorFont(); return( CFont::FromHandle( hOldFont ) ); }
void CPreviewDC::SetScaleRatio( int nNumerator, int nDenominator ) /****************************************************************/ { m_nScaleNum = nNumerator; m_nScaleDen = nDenominator; MirrorMappingMode( TRUE ); MirrorFont(); }
void CPreviewDC::SetAttribDC(HDC hDC) { ASSERT(hDC != NULL); CDC::SetAttribDC(hDC); MirrorMappingMode(TRUE); MirrorFont(); MirrorAttributes(); }
void CPreviewDC::SetAttribDC( HDC hDC ) /*************************************/ { CDC::SetAttribDC( hDC ); if( m_hDC != NULL ) { MirrorAttributes(); MirrorFont(); MirrorMappingMode( TRUE ); } }
void CPreviewDC::SetScaleRatio(int nNumerator, int nDenominator) { m_nScaleNum = nNumerator; m_nScaleDen = nDenominator; if (m_hAttribDC != NULL) { MirrorMappingMode(TRUE); MirrorFont(); } }
void CPreviewDC::SetOutputDC( HDC hDC ) /*************************************/ { CDC::SetOutputDC( hDC ); m_nSaveDCIndex = ::SaveDC( m_hDC ); if( m_hAttribDC != NULL ) { MirrorAttributes(); MirrorFont(); MirrorMappingMode( FALSE ); } }
CGdiObject *CPreviewDC::SelectStockObject( int nIndex ) /*****************************************************/ { if( nIndex == OEM_FIXED_FONT || nIndex == ANSI_FIXED_FONT || nIndex == ANSI_VAR_FONT || nIndex == SYSTEM_FONT || nIndex == DEVICE_DEFAULT_FONT || nIndex == SYSTEM_FIXED_FONT || nIndex == DEFAULT_GUI_FONT ) { m_hPrinterFont = (HFONT)::GetStockObject( nIndex ); HGDIOBJ hOldFont = ::SelectObject( m_hAttribDC, m_hPrinterFont ); MirrorFont(); return( CGdiObject::FromHandle( hOldFont ) ); } return( CDC::SelectStockObject( nIndex ) ); }
void CPreviewDC::SetOutputDC(HDC hDC) { ASSERT(hDC != NULL); m_nSaveDCIndex = ::SaveDC(hDC); // restore in ReleaseOutputDC() CDC::SetOutputDC(hDC); if (m_hAttribDC != NULL) { MirrorMappingMode(FALSE); if (m_hFont) ::SelectObject(m_hDC, m_hFont); else MirrorFont(); MirrorAttributes(); } }
CFont* CPreviewDC::SelectObject(CFont* pFont) { if (pFont == NULL) return NULL; ASSERT(m_hAttribDC != NULL); ASSERT_VALID(pFont); CFont* pOldFont = (CFont*) CGdiObject::FromHandle( ::SelectObject(m_hAttribDC, pFont->m_hObject)); // If same as already selected, don't re-mirror screen font if (m_hPrinterFont != pFont->m_hObject) { m_hPrinterFont = (HFONT)pFont->m_hObject; MirrorFont(); } return pOldFont; }
BOOL CPreviewDC::RestoreDC(int nSavedDC) { ASSERT(m_hAttribDC != NULL); BOOL bSuccess = ::RestoreDC(m_hAttribDC, nSavedDC); if (bSuccess) { if (m_nSaveDCDelta != 0x7fff) { ASSERT(m_hDC != NULL); // removed Output DC after save if (nSavedDC != -1) nSavedDC += m_nSaveDCDelta; bSuccess = ::RestoreDC(m_hDC, nSavedDC); MirrorFont(); // mirror the font } else { ASSERT(m_hDC == NULL); // Added the Output DC after save } } return bSuccess; }
CGdiObject* CPreviewDC::SelectStockObject(int nIndex) { ASSERT(m_hAttribDC != NULL); HGDIOBJ hObj = ::GetStockObject(nIndex); switch (nIndex) { case ANSI_FIXED_FONT: case ANSI_VAR_FONT: case DEVICE_DEFAULT_FONT: case OEM_FIXED_FONT: case SYSTEM_FONT: case SYSTEM_FIXED_FONT: case DEFAULT_GUI_FONT: // Handle the stock fonts correctly { CGdiObject* pObject = CGdiObject::FromHandle( ::SelectObject(m_hAttribDC, hObj)); // Don't re-mirror screen font if this is the same font. if (m_hPrinterFont == (HFONT) hObj) return pObject; m_hPrinterFont = (HFONT) hObj; ASSERT(m_hPrinterFont != NULL); // Do not allow infinite recursion MirrorFont(); return pObject; } default: if (m_hDC != NULL) ::SelectObject(m_hDC, hObj); return CGdiObject::FromHandle(::SelectObject(m_hAttribDC, hObj)); } }