예제 #1
0
long CuDlgSqlQueryPageXML::OnChangeSetting(WPARAM wParam, LPARAM lParam)
{
	CdSqlQueryRichEditDoc* pDoc = (CdSqlQueryRichEditDoc*)lParam;
	if (pDoc)
	{
		CaSqlQueryProperty& property = pDoc->GetProperty();
		if (property.GetFont())
		{
			CuWebBrowser2* pIe = (CuWebBrowser2*)GetDlgItem (IDC_EXPLORER1);
			if (pIe && IsWindow (pIe->m_hWnd))
			{
				pIe->SendMessage (WM_SETFONT, (WPARAM)property.GetFont(), MAKELPARAM(TRUE, 0));
			}
		}
	}
	return 0;
}
예제 #2
0
void CvSqlQueryRichEditView::OnInitialUpdate() 
{
	CRichEditView::OnInitialUpdate();
	HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
	if (hFont == NULL)
		hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);
	if (hFont)
		SendMessage(WM_SETFONT, (WPARAM)hFont);

	CdSqlQueryRichEditDoc* pDoc =(CdSqlQueryRichEditDoc*)GetDocument();
	CfSqlQueryFrame* pFrame  = (CfSqlQueryFrame*)GetParentFrame();
	CuDlgSqlQueryResult* pDlgResult = pFrame->GetDlgSqlQueryResult();
	CaSqlQueryProperty& property = pDoc->GetProperty();
	if (pDlgResult && property.IsTraceActivated() && property.IsTraceToTop())
	{
		pDlgResult->SelectRawPage();
	}
}
예제 #3
0
BOOL CuDlgSqlQueryPageXML::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CfSqlQueryFrame* pFrame = (CfSqlQueryFrame*)GetParentFrame();
	CdSqlQueryRichEditDoc* pDoc = (CdSqlQueryRichEditDoc*)pFrame->GetActiveDocument();
	if (pDoc)
		m_bXMLSource = !(pDoc->GetProperty().GetXmlDisplayMode() == 1);
	else
		m_bXMLSource = FALSE;
	m_pQueryRowParam->SetMode(m_bXMLSource);
	m_strPreview.LoadString (IDS_PREVIEW);
	m_cButtonXML.GetWindowText (m_strXmlSource);
	if (m_bXMLSource)
		m_cButtonXML.SetWindowText (m_strPreview);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #4
0
void CvSqlQueryLowerView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) 
{
	// Necessary to pick informations from the printer dc
	pDC->SetMapMode(MM_TEXT);
	// Pick printer information
	m_ScalingFactorX = pDC->GetDeviceCaps(SCALINGFACTORX);  // power of 2
	m_ScalingFactorY = pDC->GetDeviceCaps(SCALINGFACTORY);  // power of 2
	m_nPageWidth = pDC->GetDeviceCaps(PHYSICALWIDTH) - 2*pDC->GetDeviceCaps(PHYSICALOFFSETX);
	m_nPageHeight = pDC->GetDeviceCaps(PHYSICALHEIGHT) - 2*pDC->GetDeviceCaps(PHYSICALOFFSETY);
	//
	// create printer font and store useful information
	//

	// Get screen font
	HFONT hScreenFont = NULL;
	CdSqlQueryRichEditDoc* pDoc =(CdSqlQueryRichEditDoc*)GetDocument();
	ASSERT (pDoc);
	LOGFONT lf;
	hScreenFont = pDoc->GetProperty().GetFont();
	if (!hScreenFont)
	{
		CWnd* pCurrentPage = m_pQueryResultDlg->GetCurrentPage();
		if (pCurrentPage)
			hScreenFont = (HFONT)pCurrentPage->SendMessage (WMUSRMSG_GETFONT, 0, 0); 
		if (!hScreenFont)
			hScreenFont = (HFONT)GetFont();
	}
	ASSERT (hScreenFont);
	// Create wysiwig printer fonts
	CFont* pScreenFont = CFont::FromHandle(hScreenFont);
	int success = pScreenFont->GetLogFont(&lf);
	ASSERT (success);

	CDC* pScreenDC = GetDC();
	ASSERT (pScreenDC);
	int printerLogPixelsX = pDC->GetDeviceCaps(LOGPIXELSX);
	int screenLogPixelsX  = pScreenDC->GetDeviceCaps(LOGPIXELSX);
	int printerLogPixelsY = pDC->GetDeviceCaps(LOGPIXELSY);
	int screenLogPixelsY  = pScreenDC->GetDeviceCaps(LOGPIXELSY);
	ReleaseDC(pScreenDC);
	
	// Scales: rounded to the nearest for print scales, rounded up for font
	m_PixelXPrintScale = ( ( printerLogPixelsX + screenLogPixelsX / 2 - 1) / screenLogPixelsX) << m_ScalingFactorX;
	m_PixelYPrintScale = ( ( printerLogPixelsY + screenLogPixelsY / 2 - 1) / screenLogPixelsY) << m_ScalingFactorY;
	int fontYScale = ( (printerLogPixelsY + screenLogPixelsY - 1) / screenLogPixelsY ) << m_ScalingFactorY;
	lf.lfHeight *= fontYScale;
	
	// Normal font
	lf.lfWeight = FW_NORMAL;      // So that displayed result is not too heavy looking at - SIDE EFFECT IF SCREEN FONT IS BOLD
	lf.lfUnderline = FALSE;
	BOOL bSuccess = m_printerFont.CreateFontIndirect(&lf);
	ASSERT (bSuccess);
	
	// underlined font
	lf.lfUnderline = TRUE;
	bSuccess = m_printerCaptFont.CreateFontIndirect(&lf);
	ASSERT (bSuccess);
	
	// Bold font
	lf.lfUnderline = FALSE;
	lf.lfWeight = FW_BOLD;
	bSuccess = m_printerBoldFont.CreateFontIndirect(&lf);
	ASSERT (bSuccess);
	
	// calculate reference text sizes
	TEXTMETRIC tm;
	CFont* pOldFont = pDC->SelectObject(&m_printerFont);
	pDC->GetTextMetrics(&tm);
	m_nLineHeight = tm.tmHeight + tm.tmExternalLeading;
	pDC->SelectObject(&m_printerCaptFont);
	pDC->GetTextMetrics(&tm);
	m_nCaptLineHeight = tm.tmHeight + tm.tmExternalLeading;
	pDC->SelectObject(&m_printerBoldFont);
	pDC->GetTextMetrics(&tm);
	m_nBoldLineHeight = tm.tmHeight + tm.tmExternalLeading;
	pDC->SelectObject(pOldFont);
	
	// Reset number of pages to be printed, will be calculated at first call to PrintPage()
	m_nbPrintPage = 0;
	
	// Call special method of CuDlgSqlQueryResult, in order to get current property page data
	// Code here rather than in OnPrint() so it will not be called for each printed page
	m_pPageData = m_pQueryResultDlg->GetCurrentPageData();
	// Can be null (freshly created sql with no statement executed yet
}