RibbonSampleView.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:30k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // RibbonSampleView.cpp : implementation of the CRibbonSampleView class
  2. //
  3. #include "stdafx.h"
  4. #include "RibbonSample.h"
  5. #include "RibbonSampleDoc.h"
  6. #include "CntrItem.h"
  7. #include "RibbonSampleView.h"
  8. #include "MainFrm.h"
  9. #include "GalleryItems.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CRibbonSampleView
  17. IMPLEMENT_DYNCREATE(CRibbonSampleView, CRichEditView)
  18. BEGIN_MESSAGE_MAP(CRibbonSampleView, CScrollRichEditView)
  19. //{{AFX_MSG_MAP(CRibbonSampleView)
  20. ON_WM_DESTROY()
  21. ON_WM_RBUTTONUP()
  22. ON_WM_LBUTTONUP()
  23. ON_WM_LBUTTONDOWN()
  24. //}}AFX_MSG_MAP
  25. // Standard printing commands
  26. ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint)
  27. ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
  28. ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
  29. ON_COMMAND_RANGE(ID_ILLUSTRATION_PICTURE, ID_TABLE_INSERTTABLE, OnInsertSomeObject)
  30. ON_COMMAND(ID_EDIT_GOTO, OnEditGoto)
  31. ON_COMMAND_RANGE(ID_PAGES_NEW, ID_NEWPAGE_BLANKPAGE, OnEmptyCommand)
  32. ON_COMMAND_RANGE(ID_THEMES_BUILTIN, ID_THEMES_BUILTIN, OnEmptyCommand)
  33. ON_UPDATE_COMMAND_UI(ID_PARAGRAPH_INDENTLEFT, OnUpdateIndentLeft)
  34. ON_XTP_EXECUTE(ID_PARAGRAPH_INDENTLEFT, OnIndentLeft)
  35. ON_NOTIFY(XTP_FN_SPINUP, ID_PARAGRAPH_INDENTLEFT, OnIndentLeftSpin)
  36. ON_NOTIFY(XTP_FN_SPINDOWN, ID_PARAGRAPH_INDENTLEFT, OnIndentLeftSpin)
  37. ON_UPDATE_COMMAND_UI(ID_PARAGRAPH_INDENTRIGHT, OnUpdateIndentRight)
  38. ON_XTP_EXECUTE(ID_PARAGRAPH_INDENTRIGHT, OnIndentRight)
  39. ON_NOTIFY(XTP_FN_SPINUP, ID_PARAGRAPH_INDENTRIGHT, OnIndentRightSpin)
  40. ON_NOTIFY(XTP_FN_SPINDOWN, ID_PARAGRAPH_INDENTRIGHT, OnIndentRightSpin)
  41. ON_UPDATE_COMMAND_UI(ID_PARAGRAPH_SPACINGBEFORE, OnUpdateSpaceBefore)
  42. ON_XTP_EXECUTE(ID_PARAGRAPH_SPACINGBEFORE, OnSpaceBefore)
  43. ON_NOTIFY(XTP_FN_SPINUP, ID_PARAGRAPH_SPACINGBEFORE, OnSpaceBeforeSpin)
  44. ON_NOTIFY(XTP_FN_SPINDOWN, ID_PARAGRAPH_SPACINGBEFORE, OnSpaceBeforeSpin)
  45. ON_UPDATE_COMMAND_UI(ID_PARAGRAPH_SPACINGAFTER, OnUpdateSpaceAfter)
  46. ON_XTP_EXECUTE(ID_PARAGRAPH_SPACINGAFTER, OnSpaceAfter)
  47. ON_NOTIFY(XTP_FN_SPINUP, ID_PARAGRAPH_SPACINGAFTER, OnSpaceAfterSpin)
  48. ON_NOTIFY(XTP_FN_SPINDOWN, ID_PARAGRAPH_SPACINGAFTER, OnSpaceAfterSpin)
  49. ON_COMMAND_RANGE(ID_CONTENTS_TABLE, ID_CONTENTS_UPDATE, OnEmptyCommand)
  50. ON_COMMAND_RANGE(ID_FOOTNOTES_INSERT, ID_FOOTNOTES_NEXT, OnEmptyCommand)
  51. ON_COMMAND_RANGE(ID_CAPTIONS_INSERT, ID_CAPTIONS_UPDATE, OnEmptyCommand)
  52. ON_COMMAND_RANGE(ID_INDEX_MARK, ID_INDEX_INSERT, OnEmptyCommand)
  53. ON_COMMAND_RANGE(ID_VIEW_PRINTLAYOUT, ID_VIEW_DRAFT, OnEmptyCommand)
  54. ON_COMMAND_RANGE(ID_ZOOM_ZOOM, ID_ZOOM_PAGEWIDTH, OnEmptyCommand)
  55. ON_UPDATE_COMMAND_UI(ID_NEWPAGE_SELECTION, CRichEditView::OnUpdateNeedSel)
  56. ON_COMMAND_RANGE(ID_INSERT_HYPERLINK, ID_TEXT_DATETIME, OnEmptyCommand)
  57. ON_COMMAND_RANGE(ID_TEXT_CHANGECASE, ID_BORDERS_NOBORDER, OnEmptyCommand)
  58. ON_COMMAND(ID_CHAR_BOLD, CRichEditView::OnCharBold)
  59. ON_COMMAND(ID_CHAR_UNDERLINE, CRichEditView::OnCharUnderline)
  60. ON_COMMAND(ID_CHAR_ITALIC, CRichEditView::OnCharItalic)
  61. ON_UPDATE_COMMAND_UI(ID_CHAR_BOLD, CRichEditView::OnUpdateCharBold)
  62. ON_UPDATE_COMMAND_UI(ID_CHAR_UNDERLINE, CRichEditView::OnUpdateCharUnderline)
  63. ON_UPDATE_COMMAND_UI(ID_CHAR_ITALIC, CRichEditView::OnUpdateCharItalic)
  64. ON_COMMAND(ID_PARA_CENTER, OnParaCenter)
  65. ON_UPDATE_COMMAND_UI(ID_PARA_CENTER, OnUpdateParaCenter)
  66. ON_COMMAND(ID_PARA_LEFT, OnParaLeft)
  67. ON_UPDATE_COMMAND_UI(ID_PARA_LEFT, OnUpdateParaLeft)
  68. ON_COMMAND(ID_PARA_RIGHT, OnParaRight)
  69. ON_UPDATE_COMMAND_UI(ID_PARA_RIGHT, OnUpdateParaRight)
  70. ON_COMMAND(ID_PARA_JUSTIFY, OnParaJustify)
  71. ON_UPDATE_COMMAND_UI(ID_PARA_JUSTIFY, OnUpdateParaJustify)
  72. ON_COMMAND(ID_INSERT_BULLET, CRichEditView::OnBullet)
  73. ON_UPDATE_COMMAND_UI(ID_INSERT_BULLET, CRichEditView::OnUpdateBullet)
  74. ON_COMMAND(ID_GROUP_FONT_OPTION, OnGroupFont)
  75. ON_COMMAND(ID_GROUP_CLIPBOARD_OPTION, OnGroupClipboad)
  76. ON_COMMAND(ID_GROUP_PARAGRAPH_OPTION, OnGroupParagraph)
  77. ON_UPDATE_COMMAND_UI(XTP_ID_RIBBONCONTROLTAB, OnUpdateRibbonTab)
  78. ON_UPDATE_COMMAND_UI(ID_GALLERY_FONTTEXTCOLOR, OnUpdateSelectorText)
  79. ON_XTP_EXECUTE(ID_GALLERY_FONTTEXTCOLOR, OnSelectorText)
  80. ON_UPDATE_COMMAND_UI(ID_TEXT_COLOR, OnUpdateText)
  81. ON_COMMAND(ID_TEXT_COLOR, OnButtonText)
  82. ON_UPDATE_COMMAND_UI(XTP_IDS_AUTOMATIC, OnUpdateTextAuto)
  83. ON_COMMAND(XTP_IDS_AUTOMATIC, OnTextAuto)
  84. ON_XTP_EXECUTE(ID_GALLERY_FONTBACKCOLOR, OnGalleryFontBackColor)
  85. ON_UPDATE_COMMAND_UI(ID_GALLERY_FONTBACKCOLOR, OnUpdateGalleryFontBackColor)
  86. ON_UPDATE_COMMAND_UI(ID_TEXT_HIGHLIGHTCOLOR, OnUpdateBack)
  87. ON_COMMAND(ID_TEXT_HIGHLIGHTCOLOR, OnButtonBack)
  88. ON_COMMAND(ID_BACKCOLOR_NOCOLORS, OnButtonBackNoColor)
  89. ON_UPDATE_COMMAND_UI(ID_BACKCOLOR_NOCOLORS, OnUpdateBackNoColor)
  90. ON_UPDATE_COMMAND_UI(ID_GALLERY_FONTFACE, OnUpdateGalleryFontFace)
  91. ON_UPDATE_COMMAND_UI(ID_GALLERY_FONTSIZE, OnUpdateGalleryFontSize)
  92. ON_UPDATE_COMMAND_UI(ID_FONT_FACE, OnUpdateComboFont)
  93. ON_XTP_EXECUTE(ID_FONT_FACE, OnEditFont)
  94. ON_UPDATE_COMMAND_UI(ID_FONT_SIZE, OnUpdateComboSize)
  95. ON_XTP_EXECUTE(ID_FONT_SIZE, OnEditSize)
  96. ON_CONTROL_REFLECT(EN_VSCROLL, OnEditScrollChanged)
  97. ON_NOTIFY_REFLECT(EN_REQUESTRESIZE, OnRequestResize)
  98. ON_COMMAND(ID_TEXT_INSERTOBJECT, CRichEditView::OnInsertObject)
  99. ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo)
  100. ON_XTP_EXECUTE(ID_EDIT_UNDO, OnEditUndo)
  101. ON_NOTIFY(XTP_SBN_SCROLL, ID_INDICATOR_ZOOMSLIDER, OnZoomSliderScroll)
  102. ON_COMMAND(ID_INDICATOR_ZOOM, OnZoomIndicator)
  103. END_MESSAGE_MAP()
  104. /////////////////////////////////////////////////////////////////////////////
  105. // CRibbonSampleView construction/destruction
  106. CRibbonSampleView::CRibbonSampleView()
  107. {
  108. m_clr = RGB(255, 0, 0);
  109. m_clrBack = COLORREF_NULL;
  110. m_ptLastSel = 0;
  111. m_nZoom = 100;
  112. }
  113. CRibbonSampleView::~CRibbonSampleView()
  114. {
  115. }
  116. BOOL CRibbonSampleView::PreCreateWindow(CREATESTRUCT& cs)
  117. {
  118. cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
  119. return CScrollRichEditView::PreCreateWindow(cs);
  120. }
  121. void CRibbonSampleView::OnInitialUpdate()
  122. {
  123. CScrollRichEditView::OnInitialUpdate();
  124. USES_CONVERSION;
  125. // Set the printing margins (720 twips = 1/2 inch).
  126. SetMargins(CRect(720, 720, 720, 720));
  127. if (GetDocument()->GetPathName().IsEmpty())
  128. {
  129. SetFont(XTPPaintManager()->GetRegularFont());
  130. CHARFORMAT cf;
  131. ZeroMemory(&cf, sizeof(CHARFORMAT));
  132. CString strDefFont = _T("Tahoma");
  133. cf.cbSize = sizeof(CHARFORMAT);
  134. cf.dwMask = CFM_BOLD |CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_SIZE |
  135. CFM_COLOR | CFM_OFFSET | CFM_PROTECTED | CFM_FACE;
  136. cf.dwEffects = CFE_AUTOCOLOR;
  137. cf.yHeight = 200; //10pt
  138. cf.bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
  139. #if (_RICHEDIT_VER >= 0x0200)
  140. lstrcpyn(cf.szFaceName, strDefFont, LF_FACESIZE);
  141. #else
  142. lstrcpynA(cf.szFaceName, T2A((LPTSTR) (LPCTSTR) strDefFont), LF_FACESIZE);
  143. #endif
  144. GetRichEditCtrl().SetDefaultCharFormat(cf);
  145. }
  146. ModifyStyleEx(WS_EX_CLIENTEDGE, 0);
  147. ModifyStyle(0, WS_BORDER);
  148. static BOOL bLoadOnce = FALSE;
  149. if (!bLoadOnce && GetDocument()->GetPathName().IsEmpty())
  150. {
  151. bLoadOnce = TRUE;
  152. HINSTANCE hInstance = AfxGetInstanceHandle();
  153. LPCTSTR lpszResourceName = _T("FEEDBACK.RTF");
  154. LPCTSTR lpszResourceType = _T("RTF");
  155. HRSRC hRsrc = ::FindResource(hInstance, lpszResourceName, lpszResourceType);
  156. if (hRsrc == NULL)
  157. return;
  158. HGLOBAL hGlobal = LoadResource(hInstance, hRsrc);
  159. if (hGlobal == NULL)
  160. return;
  161. LPCSTR pData = (LPCSTR)LockResource(hGlobal);
  162. if (pData == NULL)
  163. return;
  164. DWORD dwSize = (DWORD)SizeofResource(hInstance, hRsrc);
  165. if (dwSize == 0)
  166. return;
  167. CMemFile memRTF((BYTE*)pData, dwSize, 0);
  168. CArchive ar(&memRTF, CArchive::load | CArchive::bNoFlushOnDelete | CArchive::bNoByteSwap);
  169. Serialize(ar);
  170. GetDocument()->SetModifiedFlag(FALSE);
  171. }
  172. }
  173. /////////////////////////////////////////////////////////////////////////////
  174. // CRibbonSampleView printing
  175. BOOL CRibbonSampleView::OnPreparePrinting(CPrintInfo* pInfo)
  176. {
  177. // default preparation
  178. return DoPreparePrinting(pInfo);
  179. }
  180. void CRibbonSampleView::OnFilePrintPreview()
  181. {
  182. // In derived classes, implement special window handling here
  183. // Be sure to Unhook Frame Window close if hooked.
  184. // must not create this on the frame.  Must outlive this function
  185. CPrintPreviewState* pState = new CPrintPreviewState;
  186. // DoPrintPreview's return value does not necessarily indicate that
  187. // Print preview succeeded or failed, but rather what actions are necessary
  188. // at this point.  If DoPrintPreview returns TRUE, it means that
  189. // OnEndPrintPreview will be (or has already been) called and the
  190. // pState structure will be/has been deleted.
  191. // If DoPrintPreview returns FALSE, it means that OnEndPrintPreview
  192. // WILL NOT be called and that cleanup, including deleting pState
  193. // must be done here.
  194. if ( !DoPrintPreview( XTP_IDD_PREVIEW_DIALOGBAR, this,
  195. RUNTIME_CLASS( CXTPPreviewView ), pState ))
  196. {
  197. // In derived classes, reverse special window handling here for
  198. // Preview failure case
  199. TRACE0( "Error: DoPrintPreview failed.n" );
  200. AfxMessageBox( AFX_IDP_COMMAND_FAILURE );
  201. delete pState;      // preview failed to initialize, delete State now
  202. }
  203. }
  204. void CRibbonSampleView::OnDestroy()
  205. {
  206. CRichEditView::OnDestroy();
  207. }
  208. /////////////////////////////////////////////////////////////////////////////
  209. // CRibbonSampleView diagnostics
  210. #ifdef _DEBUG
  211. void CRibbonSampleView::AssertValid() const
  212. {
  213. CRichEditView::AssertValid();
  214. }
  215. void CRibbonSampleView::Dump(CDumpContext& dc) const
  216. {
  217. CRichEditView::Dump(dc);
  218. }
  219. CRibbonSampleDoc* CRibbonSampleView::GetDocument() // non-debug version is inline
  220. {
  221. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRibbonSampleDoc)));
  222. return (CRibbonSampleDoc*)m_pDocument;
  223. }
  224. #endif //_DEBUG
  225. /////////////////////////////////////////////////////////////////////////////
  226. // CRibbonSampleView message handlers
  227. void CRibbonSampleView::OnEditGoto()
  228. {
  229. }
  230. void CRibbonSampleView::OnEmptyCommand(UINT)
  231. {
  232. }
  233. void CRibbonSampleView::OnParaJustify()
  234. {
  235. OnParaAlign(0x4);
  236. }
  237. void CRibbonSampleView::OnUpdateParaJustify(CCmdUI* pCmdUI)
  238. {
  239. OnUpdateParaAlign(pCmdUI, 0x4);
  240. }
  241. void CRibbonSampleView::OnRButtonUp(UINT /*nFlags*/, CPoint point) 
  242. {
  243. ClientToScreen(&point);
  244. CXTPCommandBars* pCommandBars = ((CMainFrame*)AfxGetMainWnd())->GetCommandBars();
  245. if (FALSE)
  246. {
  247. pCommandBars->TrackPopupMenu(IDR_MENU_CONTEXT, TPM_RIGHTBUTTON , point.x, point.y);
  248. }
  249. else
  250. {
  251. CXTPMiniToolBar* pMiniToolBar = DYNAMIC_DOWNCAST(CXTPMiniToolBar, pCommandBars->GetContextMenus()->FindCommandBar(IDR_MENU_MINITOOLBAR));
  252. if (!pMiniToolBar)
  253. return;
  254. CXTPPopupBar* pPopupBar = (CXTPPopupBar*)pCommandBars->GetContextMenus()->FindCommandBar(IDR_MENU_CONTEXT);
  255. pMiniToolBar->TrackPopupMenu(pPopupBar, 0, point.x, point.y);
  256. }
  257. }
  258. void CRibbonSampleView::OnLButtonDown(UINT nFlags, CPoint point) 
  259. {
  260. GetRichEditCtrl().GetSel(m_ptLastSel.x, m_ptLastSel.y);
  261. CScrollRichEditView::OnLButtonDown(nFlags, point);
  262. }
  263. void CRibbonSampleView::OnLButtonUp(UINT nFlags, CPoint point) 
  264. {
  265. CScrollRichEditView::OnLButtonUp(nFlags, point);
  266. CPoint ptSel;
  267. GetRichEditCtrl().GetSel(ptSel.x, ptSel.y);
  268. if (ptSel.x != ptSel.y && ptSel != m_ptLastSel)
  269. {
  270. ClientToScreen(&point);
  271. CXTPCommandBars* pCommandBars = ((CMainFrame*)AfxGetMainWnd())->GetCommandBars();
  272. CXTPMiniToolBar* pMiniToolBar = DYNAMIC_DOWNCAST(CXTPMiniToolBar, pCommandBars->GetContextMenus()->FindCommandBar(IDR_MENU_MINITOOLBAR));
  273. if (!pMiniToolBar)
  274. return;
  275. pMiniToolBar->TrackMiniBar(0, point.x, point.y  - 15);
  276. }
  277. }
  278. void CRibbonSampleView::OnGroupClipboad()
  279. {
  280. AfxMessageBox(_T("Clipboard dialog"));
  281. }
  282. void CRibbonSampleView::OnGroupParagraph()
  283. {
  284. AfxMessageBox(_T("Paragraph dialog"));
  285. }
  286. void CRibbonSampleView::OnGroupFont()
  287. {
  288. OnFormatFont();
  289. }
  290. void CRibbonSampleView::OnUpdateRibbonTab(CCmdUI* pCmdUI)
  291. {
  292. CXTPRibbonControlTab* pControl = DYNAMIC_DOWNCAST(CXTPRibbonControlTab, CXTPControl::FromUI(pCmdUI));
  293. if (!pControl)
  294. return;
  295. pCmdUI->Enable(TRUE);
  296. BOOL bVisible;
  297. CXTPRibbonTab* pTab;
  298. CRibbonSampleCntrItem* pItem = (CRibbonSampleCntrItem*)GetSelectedItem();
  299. bVisible = pItem != NULL && pItem->m_nImage == IDB_BITMAP_TABLE;
  300. pTab = pControl->FindTab(ID_TAB_TABLEDESIGN);
  301. if (!pTab)
  302. return;
  303. pControl->GetParent()->LockRedraw();
  304. pTab->SetVisible(bVisible);
  305. pTab = pControl->FindTab(ID_TAB_TABLELAYOUT);
  306. pTab->SetVisible(bVisible);
  307. bVisible = pItem != NULL && pItem->m_nImage == IDB_BITMAP_CHART;
  308. pTab = pControl->FindTab(ID_TAB_CHARTDESIGN);
  309. pTab->SetVisible(bVisible);
  310. pTab = pControl->FindTab(ID_TAB_CHARTLAYOUT);
  311. pTab->SetVisible(bVisible);
  312. pTab = pControl->FindTab(ID_TAB_CHARTFORMAT);
  313. pTab->SetVisible(bVisible);
  314. pTab = pControl->FindTab(ID_TAB_PICTUREFORMAT);
  315. pTab->SetVisible(pItem != NULL);
  316. pControl->GetParent()->UnlockRedraw();
  317. }
  318. void CRibbonSampleView::OnInsertSomeObject(UINT nID)
  319. {
  320. if (!OpenClipboard())
  321. return;
  322. if (!::EmptyClipboard())
  323. {
  324. ::CloseClipboard ();
  325. return;
  326. }
  327. int nImage = nID - ID_ILLUSTRATION_PICTURE + IDB_BITMAP_PICTURE;
  328. CBitmap bmp;
  329. bmp.LoadBitmap(nImage);
  330. SetClipboardData(CF_BITMAP, (HANDLE)bmp.GetSafeHandle());
  331. ::CloseClipboard ();
  332. COleDataObject dataobj;
  333. dataobj.AttachClipboard();
  334. CWaitCursor wait;
  335. CRibbonSampleCntrItem* pItem = NULL;
  336. TRY
  337. {
  338. pItem = (CRibbonSampleCntrItem*)GetDocument()->CreateClientItem(NULL);
  339. pItem->m_bLock = TRUE;
  340. // paste embedded
  341. if (!pItem->CreateFromData(&dataobj) &&
  342. !pItem->CreateStaticFromData(&dataobj))
  343. {
  344. AfxThrowMemoryException();      // any exception will do
  345. }
  346. HRESULT hr = InsertItem(pItem);
  347. pItem->UpdateItemType();
  348. pItem->m_bLock = FALSE;
  349. if (hr != NOERROR)
  350. AfxThrowOleException(hr);
  351. }
  352. CATCH(CException, e)
  353. {
  354. if (pItem != NULL)
  355. {
  356. pItem->m_bLock = FALSE;
  357. ASSERT_VALID(pItem);
  358. pItem->Delete();
  359. pItem = NULL;
  360. }
  361. }
  362. END_CATCH
  363. if (pItem)
  364. {
  365. pItem->m_nImage = nImage;
  366. }
  367. }
  368. void CRibbonSampleView::OnUpdateSelectorText(CCmdUI* pCmdUI)
  369. {
  370. CXTPControlGallery* pControl =  DYNAMIC_DOWNCAST(CXTPControlGallery, CXTPControl::FromUI(pCmdUI));
  371. if (pControl)
  372. {
  373. pControl->SetCheckedItem(m_clr);
  374. }
  375. pCmdUI->Enable(TRUE);
  376. }
  377. void CRibbonSampleView::OnButtonText()
  378. {
  379. CHARFORMAT& cfm = GetCharFormatSelection( );
  380. cfm.dwMask |= CFM_COLOR;
  381. cfm.dwEffects &= ~CFE_AUTOCOLOR ;
  382. cfm.crTextColor = m_clr;
  383. GetRichEditCtrl().SetSelectionCharFormat(cfm);
  384. }
  385. void CRibbonSampleView::OnSelectorText(NMHDR* pNMHDR, LRESULT* pResult)
  386. {
  387. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  388. CXTPControlGallery* pControl = DYNAMIC_DOWNCAST(CXTPControlGallery, tagNMCONTROL->pControl);
  389. if (pControl)
  390. {
  391. CXTPControlGalleryItem* pItem = pControl->GetItem(pControl->GetSelectedItem());
  392. if (pItem)
  393. {
  394. m_clr = (COLORREF)pItem->GetID();
  395. OnButtonText();
  396. }
  397. *pResult = TRUE; // Handled
  398. }
  399. *pResult = 1;
  400. }
  401. void CRibbonSampleView::OnUpdateText(CCmdUI* pCmd)
  402. {
  403. CXTPControlPopupColor* pPopup = DYNAMIC_DOWNCAST(CXTPControlPopupColor, CXTPControl::FromUI(pCmd));
  404. if (pPopup)
  405. {
  406. pPopup->SetColor(m_clr);
  407. }
  408. pCmd->Enable(TRUE);
  409. }
  410. void CRibbonSampleView::OnTextAuto()
  411. {
  412. CHARFORMAT& cfm = GetCharFormatSelection( );
  413. cfm.dwMask |= CFM_COLOR;
  414. cfm.dwEffects |= CFE_AUTOCOLOR ;
  415. GetRichEditCtrl().SetSelectionCharFormat(cfm);
  416. }
  417. void CRibbonSampleView::OnUpdateTextAuto(CCmdUI* pCmd)
  418. {
  419. CHARFORMAT& cfm = GetCharFormatSelection( );
  420. pCmd->SetCheck(cfm.dwEffects & CFE_AUTOCOLOR? TRUE: FALSE);
  421. }
  422. //////////////////////////////////////////////////////////////////////////
  423. //
  424. void CRibbonSampleView::OnUpdateGalleryFontFace(CCmdUI* pCmdUI)
  425. {
  426. pCmdUI->Enable(TRUE);
  427. }
  428. void CRibbonSampleView::OnUpdateGalleryFontSize(CCmdUI* pCmdUI)
  429. {
  430. pCmdUI->Enable(TRUE);
  431. }
  432. void CRibbonSampleView::OnUpdateComboFont(CCmdUI* pCmd)
  433. {
  434. CXTPControlComboBox* pFontCombo = (CXTPControlComboBox*)CXTPControl::FromUI(pCmd);
  435. pCmd->Enable(TRUE);
  436. if (pFontCombo && pFontCombo->GetType() == xtpControlComboBox)
  437. {
  438. CHARFORMAT& cf = GetCharFormatSelection();
  439. if (pFontCombo->HasFocus())
  440. return;
  441. // the selection must be same font and charset to display correctly
  442. if ((cf.dwMask & (CFM_FACE | CFM_CHARSET)) == (CFM_FACE | CFM_CHARSET))
  443. pFontCombo->SetEditText(CString(cf.szFaceName));
  444. else
  445. pFontCombo->SetEditText(_T(""));
  446. }
  447. }
  448. void CRibbonSampleView::OnEditFont(NMHDR* pNMHDR, LRESULT* pResult)
  449. {
  450. USES_CONVERSION;
  451. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  452. CXTPControlComboBox* pControl = (CXTPControlComboBox*)tagNMCONTROL->pControl;
  453. if (pControl->GetType() == xtpControlComboBox)
  454. {
  455. CString strFont = pControl->GetEditText();
  456. #if (_MSC_VER < 1300)
  457. CHARFORMAT cf;
  458. #else
  459. CHARFORMAT2 cf;
  460. #endif
  461. cf.dwMask = CFM_FACE;
  462. #if (_RICHEDIT_VER >= 0x0200)
  463. lstrcpyn(cf.szFaceName, strFont, LF_FACESIZE);
  464. #else
  465. lstrcpynA(cf.szFaceName, T2A((LPTSTR)(LPCTSTR)strFont), LF_FACESIZE);
  466. #endif
  467. SetCharFormat(cf);
  468. *pResult = 1; // Handled;
  469. }
  470. }
  471. void CRibbonSampleView::OnUpdateComboSize(CCmdUI* pCmd)
  472. {
  473. CXTPControlComboBox* pFontCombo = (CXTPControlComboBox*)CXTPControl::FromUI(pCmd);
  474. pCmd->Enable(TRUE);
  475. if (pFontCombo && pFontCombo->GetType() == xtpControlComboBox)
  476. {
  477. CHARFORMAT& cf = GetCharFormatSelection();
  478. if (pFontCombo->HasFocus())
  479. return;
  480. int nTwip = (cf.dwMask & CFM_SIZE) ? cf.yHeight : -1;
  481. pFontCombo->SetEditText(CXTPControlSizeComboBox::TwipsToPointString(nTwip));
  482. }
  483. }
  484. void CRibbonSampleView::OnEditSize(NMHDR* pNMHDR, LRESULT* pResult)
  485. {
  486. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  487. CXTPControlComboBox* pControl = (CXTPControlComboBox*)tagNMCONTROL->pControl;
  488. if (pControl->GetType() == xtpControlComboBox)
  489. {
  490. #if (_MSC_VER < 1300)
  491. CHARFORMAT cf;
  492. #else
  493. CHARFORMAT2 cf;
  494. #endif
  495. int nSize = CXTPControlSizeComboBox::GetTwipSize(pControl->GetEditText());
  496. if (nSize > 0)
  497. {
  498. cf.dwMask = CFM_SIZE;
  499. cf.yHeight = nSize;
  500. SetCharFormat(cf);
  501. }
  502. *pResult = 1; // Handled;
  503. }
  504. }
  505. void CRibbonSampleView::OnGalleryFontBackColor(NMHDR* pNMHDR, LRESULT* pResult)
  506. {
  507. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  508. CXTPControlGallery* pControl = DYNAMIC_DOWNCAST(CXTPControlGallery, tagNMCONTROL->pControl);
  509. if (pControl)
  510. {
  511. CXTPControlGalleryItem* pItem = pControl->GetItem(pControl->GetSelectedItem());
  512. if (pItem)
  513. {
  514. m_clrBack = (COLORREF)pItem->GetID();
  515. OnButtonBack();
  516. }
  517. *pResult = TRUE; // Handled
  518. }
  519. }
  520. void CRibbonSampleView::OnUpdateGalleryFontBackColor(CCmdUI* pCmdUI)
  521. {
  522. CXTPControlGallery* pControl =  DYNAMIC_DOWNCAST(CXTPControlGallery, CXTPControl::FromUI(pCmdUI));
  523. if (pControl)
  524. {
  525. pControl->SetCheckedItem(m_clrBack);
  526. }
  527. pCmdUI->Enable(TRUE);
  528. }
  529. void CRibbonSampleView::OnButtonBack()
  530. {
  531. CHARFORMAT2 cfm;
  532. cfm.cbSize =  sizeof(CHARFORMAT2);
  533. ::SendMessage(GetRichEditCtrl().GetSafeHwnd(), EM_GETCHARFORMAT, 1, (LPARAM)&cfm);
  534. cfm.dwMask |= CFM_BACKCOLOR;
  535. cfm.dwEffects &= ~CFE_AUTOBACKCOLOR ;
  536. cfm.crBackColor = m_clrBack;
  537. ::SendMessage(GetRichEditCtrl().GetSafeHwnd(), EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfm);
  538. }
  539. void CRibbonSampleView::OnButtonBackNoColor()
  540. {
  541. CHARFORMAT2 cfm;
  542. cfm.cbSize =  sizeof(CHARFORMAT2);
  543. cfm.dwMask = CFM_BACKCOLOR;
  544. cfm.dwEffects |= CFE_AUTOBACKCOLOR ;
  545. cfm.crBackColor = m_clrBack;
  546. m_clrBack = COLORREF_NULL;
  547. ::SendMessage(GetRichEditCtrl().GetSafeHwnd(), EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfm);
  548. }
  549. void CRibbonSampleView::OnUpdateBack(CCmdUI* pCmdUI)
  550. {
  551. CXTPControlPopupColor* pPopup = DYNAMIC_DOWNCAST(CXTPControlPopupColor, CXTPControl::FromUI(pCmdUI));
  552. if (pPopup)
  553. {
  554. pPopup->SetColor(m_clrBack == COLORREF_NULL ? 0xFFFFFF : m_clrBack);
  555. }
  556. pCmdUI->Enable(TRUE);
  557. }
  558. void CRibbonSampleView::OnUpdateBackNoColor(CCmdUI* pCmdUI)
  559. {
  560. pCmdUI->SetCheck(m_clrBack == COLORREF_NULL ? 1 : 0);
  561. pCmdUI->Enable(TRUE);
  562. }
  563. CString FormatIndent(int nIndent)
  564. {
  565. CString strIndent;
  566. if (nIndent % 1000 == 0)
  567. strIndent.Format(_T("%0.0f""), (double)nIndent / 1000);
  568. else if (nIndent % 100 == 0)
  569. strIndent.Format(_T("%0.1f""), (double)nIndent / 1000);
  570. else
  571. strIndent.Format(_T("%0.2f""), (double)nIndent / 1000);
  572. return strIndent;
  573. }
  574. void CRibbonSampleView::SetIndentLeft(long nIndentLeft)
  575. {
  576. if (nIndentLeft < -11000)
  577. nIndentLeft = -11000;
  578. if (nIndentLeft > 22000)
  579. nIndentLeft = 22000;
  580. PARAFORMAT pf;
  581. pf.cbSize = sizeof(PARAFORMAT);
  582. pf.dwMask =  PFM_STARTINDENT;
  583. pf.dxStartIndent = nIndentLeft;
  584. ::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
  585. }
  586. long CRibbonSampleView::GetIndentLeft()
  587. {
  588. PARAFORMAT pf;
  589. pf.cbSize = sizeof(PARAFORMAT);
  590. pf.dwMask =  PFM_STARTINDENT;
  591. ::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
  592. return pf.dxStartIndent;
  593. }
  594. void CRibbonSampleView::OnUpdateIndentLeft(CCmdUI* pCmdUI)
  595. {
  596. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, CXTPControl::FromUI(pCmdUI));
  597. if (pControl && !pControl->HasFocus())
  598. {
  599. pControl->SetEditText(FormatIndent(GetIndentLeft()));
  600. }
  601. pCmdUI->Enable(TRUE);
  602. }
  603. double _ttof(LPCTSTR lpszStr)
  604. {
  605. USES_CONVERSION;
  606. return atof(T2A((LPTSTR)lpszStr));
  607. }
  608. void CRibbonSampleView::OnIndentLeft(NMHDR* pNMHDR, LRESULT* pResult)
  609. {
  610. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  611. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  612. if (pControl)
  613. {
  614. SetIndentLeft(int(_ttof(pControl->GetEditText()) * 1000));
  615. *pResult = TRUE;
  616. }
  617. }
  618. void CRibbonSampleView::OnIndentLeftSpin(NMHDR* pNMHDR, LRESULT* pResult)
  619. {
  620. NMXTPUPDOWN* tagNMCONTROL = (NMXTPUPDOWN*)pNMHDR;
  621. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  622. if (pControl)
  623. {
  624. SetIndentLeft(int(_ttof(pControl->GetEditText()) * 1000) + tagNMCONTROL->iDelta * 100);
  625. pControl->SetEditText(FormatIndent(GetIndentLeft()));
  626. }
  627. *pResult = 1;
  628. }
  629. void CRibbonSampleView::SetIndentRight(long nIndentRight)
  630. {
  631. if (nIndentRight < -11000)
  632. nIndentRight = -11000;
  633. if (nIndentRight > 22000)
  634. nIndentRight = 22000;
  635. PARAFORMAT pf;
  636. pf.cbSize = sizeof(PARAFORMAT);
  637. pf.dwMask =  PFM_RIGHTINDENT;
  638. pf.dxRightIndent = nIndentRight;
  639. ::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
  640. }
  641. long CRibbonSampleView::GetIndentRight()
  642. {
  643. PARAFORMAT pf;
  644. pf.cbSize = sizeof(PARAFORMAT);
  645. pf.dwMask =  PFM_RIGHTINDENT;
  646. ::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
  647. return pf.dxRightIndent;
  648. }
  649. void CRibbonSampleView::OnUpdateIndentRight(CCmdUI* pCmdUI)
  650. {
  651. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, CXTPControl::FromUI(pCmdUI));
  652. if (pControl && !pControl->HasFocus())
  653. {
  654. pControl->SetEditText(FormatIndent(GetIndentRight()));
  655. }
  656. pCmdUI->Enable(TRUE);
  657. }
  658. void CRibbonSampleView::OnIndentRight(NMHDR* pNMHDR, LRESULT* pResult)
  659. {
  660. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  661. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  662. if (pControl)
  663. {
  664. SetIndentRight(int(_ttof(pControl->GetEditText()) * 1000));
  665. *pResult = TRUE;
  666. }
  667. }
  668. void CRibbonSampleView::OnIndentRightSpin(NMHDR* pNMHDR, LRESULT* pResult)
  669. {
  670. NMXTPUPDOWN* tagNMCONTROL = (NMXTPUPDOWN*)pNMHDR;
  671. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  672. if (pControl)
  673. {
  674. SetIndentRight(int(_ttof(pControl->GetEditText()) * 1000) + tagNMCONTROL->iDelta * 100);
  675. pControl->SetEditText(FormatIndent(GetIndentRight()));
  676. }
  677. *pResult = 1;
  678. }
  679. #define SPACE_SIZE 20
  680. //////////////////////////////////////////////////////////////////////////
  681. CString FormatSpacing(int nIndent)
  682. {
  683. CString strSpacing;
  684. strSpacing.Format(_T("%i pt"), (int)(nIndent / SPACE_SIZE));
  685. return strSpacing;
  686. }
  687. void CRibbonSampleView::SetSpaceBefore(long nSpaceBefore)
  688. {
  689. if (nSpaceBefore < 0)
  690. nSpaceBefore = 0;
  691. PARAFORMAT2 pf;
  692. pf.cbSize = sizeof(PARAFORMAT2);
  693. pf.dwMask =  PFM_SPACEBEFORE;
  694. pf.dySpaceBefore = nSpaceBefore;
  695. ::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
  696. }
  697. long CRibbonSampleView::GetSpaceBefore()
  698. {
  699. PARAFORMAT2 pf;
  700. pf.cbSize = sizeof(PARAFORMAT2);
  701. pf.dwMask =  PFM_SPACEBEFORE;
  702. ::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
  703. return pf.dySpaceBefore;
  704. }
  705. void CRibbonSampleView::OnUpdateSpaceBefore(CCmdUI* pCmdUI)
  706. {
  707. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, CXTPControl::FromUI(pCmdUI));
  708. if (pControl && !pControl->HasFocus())
  709. {
  710. pControl->SetEditText(FormatSpacing(GetSpaceBefore()));
  711. }
  712. pCmdUI->Enable(TRUE);
  713. }
  714. void CRibbonSampleView::OnSpaceBefore(NMHDR* pNMHDR, LRESULT* pResult)
  715. {
  716. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  717. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  718. if (pControl)
  719. {
  720. SetSpaceBefore(_ttoi(pControl->GetEditText()) * SPACE_SIZE);
  721. *pResult = TRUE;
  722. }
  723. }
  724. void CRibbonSampleView::OnSpaceBeforeSpin(NMHDR* pNMHDR, LRESULT* pResult)
  725. {
  726. NMXTPUPDOWN* tagNMCONTROL = (NMXTPUPDOWN*)pNMHDR;
  727. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  728. if (pControl)
  729. {
  730. SetSpaceBefore(int(_ttoi(pControl->GetEditText()) * SPACE_SIZE) + tagNMCONTROL->iDelta * 6 * SPACE_SIZE);
  731. pControl->SetEditText(FormatSpacing(GetSpaceBefore()));
  732. }
  733. *pResult = 1;
  734. }
  735. //////////////////////////////////////////////////////////////////////////
  736. void CRibbonSampleView::SetSpaceAfter(long nSpaceAfter)
  737. {
  738. if (nSpaceAfter < 0)
  739. nSpaceAfter = 0;
  740. PARAFORMAT2 pf;
  741. pf.cbSize = sizeof(PARAFORMAT2);
  742. pf.dwMask =  PFM_SPACEAFTER;
  743. pf.dySpaceAfter = nSpaceAfter;
  744. ::SendMessage(m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf);
  745. }
  746. long CRibbonSampleView::GetSpaceAfter()
  747. {
  748. PARAFORMAT2 pf;
  749. pf.cbSize = sizeof(PARAFORMAT2);
  750. pf.dwMask =  PFM_SPACEAFTER;
  751. ::SendMessage(m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
  752. return pf.dySpaceAfter;
  753. }
  754. void CRibbonSampleView::OnUpdateSpaceAfter(CCmdUI* pCmdUI)
  755. {
  756. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, CXTPControl::FromUI(pCmdUI));
  757. if (pControl && !pControl->HasFocus())
  758. {
  759. pControl->SetEditText(FormatSpacing(GetSpaceAfter()));
  760. }
  761. pCmdUI->Enable(TRUE);
  762. }
  763. void CRibbonSampleView::OnSpaceAfter(NMHDR* pNMHDR, LRESULT* pResult)
  764. {
  765. NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
  766. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  767. if (pControl)
  768. {
  769. SetSpaceAfter(int(_ttoi(pControl->GetEditText()) * SPACE_SIZE));
  770. *pResult = TRUE;
  771. }
  772. }
  773. void CRibbonSampleView::OnSpaceAfterSpin(NMHDR* pNMHDR, LRESULT* pResult)
  774. {
  775. NMXTPUPDOWN* tagNMCONTROL = (NMXTPUPDOWN*)pNMHDR;
  776. CXTPControlEdit* pControl = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL->pControl);
  777. if (pControl)
  778. {
  779. SetSpaceAfter(int(_ttoi(pControl->GetEditText()) * SPACE_SIZE) + tagNMCONTROL->iDelta * 6 * SPACE_SIZE);
  780. pControl->SetEditText(FormatSpacing(GetSpaceAfter()));
  781. }
  782. *pResult = 1;
  783. }
  784. void CRibbonSampleView::OnUpdateEditUndo(CCmdUI* pCmd)
  785. {
  786. CXTPControlGallery* pControlUndo = DYNAMIC_DOWNCAST(CXTPControlGallery, CXTPControl::FromUI(pCmd));
  787. if (pControlUndo)
  788. {
  789. pCmd->Enable(GetRichEditCtrl().CanUndo());
  790. CXTPControlGalleryItems* pItems = pControlUndo->GetItems();
  791. pItems->RemoveAll();
  792. int nCount = RAND_S() % 20 + 3;
  793. for (int i = 0; i < nCount; i++)
  794. {
  795. CString str;
  796. str.Format(_T("Undo String %i"), i + 1);
  797. pItems->AddItem(new CGalleryItemUndo(str), i);
  798. }
  799. pControlUndo->OnSelectedItemChanged();
  800. pControlUndo->SetHeight(pItems->GetItemSize().cy * nCount + 2);
  801. }
  802. else
  803. {
  804. CRichEditView::OnUpdateEditUndo(pCmd);
  805. }
  806. }
  807. void CRibbonSampleView::OnEditUndo(NMHDR* pNMHDR, LRESULT* pResult)
  808. {
  809. CXTPControlGallery* pControlUndo = DYNAMIC_DOWNCAST(CXTPControlGallery, ((NMXTPCONTROL*)pNMHDR)->pControl);
  810. if (pControlUndo)
  811. {
  812. CString str;
  813. str.Format(_T("Undo last %i actions"), pControlUndo->GetSelectedItem() + 1);
  814. AfxMessageBox(str);
  815. }
  816. else
  817. {
  818. CRichEditView::OnEditUndo();
  819. }
  820. *pResult = 1; // Handled;
  821. }
  822. // Convert 0 -> 10%, 500 -> 100 %, 1000 -> 500 %
  823. int PosToZoom(int nPos) {
  824. return nPos <= 500 ? 10 + MulDiv(nPos, 90, 500) : 100 + MulDiv(nPos - 500, 400, 500);
  825. }
  826. int ZoomToPos(int nZoom) {
  827. return nZoom < 100 ? MulDiv(nZoom - 10, 500, 90) : 500 + MulDiv(nZoom - 100, 500, 400);
  828. }
  829. #ifndef EM_SETZOOM
  830. #define EM_SETZOOM (WM_USER + 225)
  831. #endif
  832. void CRibbonSampleView::OnZoomSliderScroll(NMHDR* pNMHDR, LRESULT* pResult)
  833. {
  834. NMXTPSCROLL* pNMScroll = (NMXTPSCROLL*)pNMHDR;
  835. CXTPStatusBarSliderPane* pPane = DYNAMIC_DOWNCAST(CXTPStatusBarSliderPane, pNMScroll->pSender);
  836. if (!pPane)
  837. return;
  838. int nZoom = m_nZoom;
  839. switch (pNMScroll->nSBCode)
  840. {
  841. case SB_TOP: nZoom = 10; break;
  842. case SB_BOTTOM: nZoom = 500; break;
  843. case SB_LINEUP: nZoom = max(((nZoom / 10) - 1) * 10, 10); break;
  844. case SB_LINEDOWN: nZoom = min(((nZoom / 10) + 1) * 10, 500); break;
  845. case SB_THUMBTRACK: nZoom = PosToZoom(pNMScroll->nPos); if (nZoom > 90 && nZoom < 150) nZoom = 100; break;
  846. case SB_PAGEUP: nZoom = max(nZoom - 10, 10); break;
  847. case SB_PAGEDOWN: nZoom = min(nZoom + 10, 500); break;
  848. }
  849. if (nZoom == m_nZoom)
  850. return;
  851. m_nZoom = nZoom;
  852. pPane->SetPos(ZoomToPos(nZoom));
  853. CXTPStatusBar* pStatusBar = pPane->GetStatusBar();
  854. CXTPStatusBarPane* pPaneZoomIndicator = pStatusBar->FindPane(ID_INDICATOR_ZOOM);
  855. CString strZoom;
  856. strZoom.Format(_T("%i%%"), m_nZoom);
  857. pPaneZoomIndicator->SetText(strZoom);
  858. SendMessage(EM_SETZOOM, m_nZoom, 100);
  859. }
  860. void CRibbonSampleView::OnZoomIndicator()
  861. {
  862. AfxMessageBox(_T("Zoom dialog box"));
  863. }