static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt, DWORD cookie) { ITextServices *ts = ftd->getTextService(); ITextDocument *td = ftd->getTextDocument(); long cnt; LRESULT lResult; /* TEXTRANGE trg; trg.chrg = range; trg.lpstrText = new TCHAR[trg.chrg.cpMax - trg.chrg.cpMin + 1]; ts->TxSendMessage(EM_GETTEXTRANGE, 0, (LPARAM)&trg, &lResult); MessageBox(0, txt, trg.lpstrText, MB_OK); */ ts->TxSendMessage(EM_SETSEL, range.cpMin, range.cpMax, &lResult); IRichEditOle* RichEditOle; ts->TxSendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle, &lResult); td->Freeze(&cnt); // HDC emfdc = CreateEnhMetaFile(NULL, NULL, NULL, _T("icon")); // DrawIconEx(emfdc, 0, 0, (HICON)_ttol(txt), 16, 16, 0, NULL, DI_NORMAL); // InsertBitmap(RichEditOle, CloseEnhMetaFile(emfdc)); #ifdef _WIN64 bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_tstoi64(txt))); #else bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_ttoi(txt))); #endif td->Unfreeze(&cnt); RichEditOle->Release(); return res; }
void CMSOffice2007DemoView::OnInsertPicture() { WPD_CHARFORMAT cf = GetCharFormatSelection(); InsertBitmap(IDB_PICTURE); SetCharFormat (cf); SyncFont (); }
void CMSOffice2007DemoView::OnInsertTable() { WPD_CHARFORMAT cf = GetCharFormatSelection(); InsertBitmap(IDB_TABLE); SetCharFormat (cf); SyncFont (); }
// returns true on success, false on failure bool ImageDataObject::InsertIcon(IRichEditOle* pRichEditOle, HICON hIcon, COLORREF backgroundColor, int sizeX, int sizeY) { bool result; HBITMAP hBmp = CacheIconToBMP(hIcon, backgroundColor, sizeX, sizeY); result = InsertBitmap(pRichEditOle, hBmp); DeleteObject(hBmp); return result; }
static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt, DWORD) { ITextServices *ts = ftd->getTextService(); ITextDocument *td = ftd->getTextDocument(); long cnt; LRESULT lResult; ts->TxSendMessage(EM_SETSEL, range.cpMin, range.cpMax, &lResult); IRichEditOle* RichEditOle; ts->TxSendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle, &lResult); td->Freeze(&cnt); #ifdef _WIN64 bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_tstoi64(txt))); #else bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_ttoi(txt))); #endif td->Unfreeze(&cnt); RichEditOle->Release(); return res; }
void CBCGPMSOffice2007DemoView::OnInsertTableGallery() { if (CRibbonTableButton::GetRows () > 0 && CRibbonTableButton::GetColumns () > 0) { CString str; str.Format (_T("Demo: insert %dx%d table"), CRibbonTableButton::GetColumns (), CRibbonTableButton::GetRows ()); MessageBox (str); InsertBitmap (IDB_TABLE); } }
void CMSOffice2007DemoView::OnInsertTableGallery() { if (CRibbonTableButton::GetRows() > 0 && CRibbonTableButton::GetColumns() > 0) { CString str; str.Format(_T("Demo: insert %dx%d table"), CRibbonTableButton::GetColumns(), CRibbonTableButton::GetRows()); MessageBox(str); WPD_CHARFORMAT cf = GetCharFormatSelection(); InsertBitmap(IDB_TABLE); SetCharFormat (cf); SyncFont (); } }
LRESULT OnLButtonDown(HWND hWnd,WPARAM wParam,LPARAM lParam) { int TempSel; int nHit; TCHAR *pText; if (NowTool==DT_TEXT) { pText=NULL; if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_TEXT),hWnd, TextDlgProc,(LPARAM)&pText) == IDOK) { if (lstrlen(pText) == 0) { free(pText); } else { AppendObject(DT_TEXT,LOWORD(lParam),HIWORD(lParam), LOWORD(lParam)+200,HIWORD(lParam)+50); arObj[arNum-1]->Text=pText; arObj[arNum-1]->Len=lstrlen(pText)+1; arObj[arNum-1]->PlaneColor=-1; InvalidateRect(hWndMain,NULL,TRUE); } NowTool=DT_SELECT; NowSel=arNum-1; } return 0; } if (NowTool==DT_BITMAP) { InsertBitmap(LOWORD(lParam),HIWORD(lParam)); return 0; } if (NowTool==DT_META) { InsertMeta(LOWORD(lParam),HIWORD(lParam)); return 0; } if (NowTool==DT_SELECT) { nHit=TrackerHitTest(LOWORD(lParam),HIWORD(lParam)); if (nHit != 0) { oldx=LOWORD(lParam); oldy=HIWORD(lParam); AdjustToGrid(oldx,oldy); dObj=*arObj[NowSel]; SizeCorner=nHit; DrawTemp(&dObj); DragMode=DM_SIZE; } else { TempSel=FindObject(LOWORD(lParam),HIWORD(lParam)); if (NowSel != TempSel) { NowSel=TempSel; InvalidateRect(hWnd,NULL,TRUE); UpdateWindow(hWnd); } if (NowSel != -1) { oldx=LOWORD(lParam); oldy=HIWORD(lParam); AdjustToGrid(oldx,oldy); dObj=*arObj[NowSel]; DrawTemp(&dObj); DragMode=DM_MOVE; } } } else { sx=LOWORD(lParam); sy=HIWORD(lParam); AdjustToGrid(sx,sy); oldx=sx; oldy=sy; DragMode=DM_DRAW; } SetCapture(hWnd); return 0; }
void CBCGPMSOffice2007DemoView::OnInsertTable() { InsertBitmap (IDB_TABLE); }
void CBCGPMSOffice2007DemoView::OnInsertChart() { InsertBitmap (IDB_CHART); }
void CBCGPMSOffice2007DemoView::OnInsertPicture() { InsertBitmap (IDB_PICTURE); }