Пример #1
0
 private void rbtnHistoryNext_DropDown(object sender, EventArgs e)
 {
     rbtnHistoryNext.Items.Clear();
     for (int i = _pview.CurrentHistoryEntryIndex + 1, j = 0; i < _pview.ViewHistory.Count && j < 10; ++i, ++j)
     {
         ViewHistoryItem vhi = _pview.ViewHistory[i];
         RibbonButton    btn = new RibbonButton(vhi.Caption);
         btn.Tag = vhi;
         rbtnHistoryNext.Items.Add(btn);
     }
 }
Пример #2
0
 private void RibbonClick(RibbonItem item)
 {
     if (item.Parent as RibbonItem == rbtnHistoryBack || item.Parent as RibbonItem == rbtnHistoryNext)
     {
         ViewHistoryItem vhi = item.Tag as ViewHistoryItem;
         if (vhi != null)
         {
             _pview.CurrentHistoryEntry = vhi;
         }
     }
 }
Пример #3
0
 /// <summary>
 /// TBD:
 /// Called from rbnMain_RibbonEvent(...) and handling RibbonEventType.DropDown events from rbnMain.
 /// </summary>
 /// <param name="item">RibbonItem that was droppeddown.</param>
 private void RibbonDropDown(RibbonItem item)
 {
     if (item == rbtnHistoryBack)
     {
         rbtnHistoryBack.Items.Clear();
         for (int i = ppMain.CurrentHistoryEntryIndex - 1, j = 0;
              i >= 0 && j < 10;
              i--, j++)
         {
             ViewHistoryItem vhi = ppMain.ViewHistory[i];
             RibbonButton    btn = new RibbonButton(vhi.Caption);
             btn.Tag = vhi;
             rbtnHistoryBack.Items.Add(btn);
         }
     }
     else if (item == rbtnHistoryNext)
     {
         rbtnHistoryNext.Items.Clear();
         for (int i = ppMain.CurrentHistoryEntryIndex + 1, j = 0;
              i < ppMain.ViewHistory.Count && j < 10;
              i++, j++)
         {
             ViewHistoryItem vhi = ppMain.ViewHistory[i];
             RibbonButton    btn = new RibbonButton(vhi.Caption);
             btn.Tag = vhi;
             rbtnHistoryNext.Items.Add(btn);
         }
     }
     else if (item == rbtnSave)
     {
         rbtnSave.Items.Clear();
         foreach (C1.C1Preview.Export.ExportProvider ep in C1.C1Preview.Export.ExportProviders.RegisteredProviders)
         {
             if (ep.CanExportObject(Document))
             {
                 RibbonButton rb = new RibbonButton();
                 rb.Text   = ep.FormatName;
                 rb.Tag    = ep;
                 rb.Click += new EventHandler(rb_Click);
                 rbtnSave.Items.Add(rb);
             }
         }
     }
 }
Пример #4
0
 /// <summary>
 /// TBD:
 /// Called from rbnMain_RibbonEvent(...) and handling RibbonEventType.Click events from rbnMain.
 /// </summary>
 /// <param name="item">RibbonItem that was clicked.</param>
 private void RibbonClick(RibbonItem item)
 {
     if (item == rbtnSave || item == rbtnSave2)
     {
         ppMain.FileSave();
     }
     if (item == rbtnOpen || item == rbtnOpen2)
     {
         ppMain.FileOpen();
     }
     else if (item == rbtnPrint || item == rbtnPrint2)
     {
         ppMain.Print();
     }
     else if (item == rbtnReflow)
     {
         ppMain.Reflow();
     }
     else if (item == rbtnPagePortrait)
     {
         if (ppMain.PageSettings != null)
         {
             PageSettings ps = (PageSettings)ppMain.PageSettings.Clone();
             ps.Landscape        = false;
             ppMain.PageSettings = ps;
         }
     }
     else if (item == rbtnPageLandscape)
     {
         if (ppMain.PageSettings != null)
         {
             PageSettings ps = (PageSettings)ppMain.PageSettings.Clone();
             ps.Landscape        = true;
             ppMain.PageSettings = ps;
         }
     }
     else if (item == rbtnPageSetup || item == rbtnPageSetup2)
     {
         ppMain.PageSetup();
     }
     else if (item == rbtnZoomFitToWindow)
     {
         ppMain.ZoomMode = ZoomModeEnum.WholePage;
     }
     else if (item.Parent as RibbonMenu == rbtnZoom)
     {
         string s = item.Tag as string;
         if (s != null)
         {
             int v;
             if (int.TryParse(s, out v))
             {
                 ppMain.ZoomFactor = v / 100.0;
             }
         }
     }
     else if (item == rbtnZoomOnePage)
     {
         using (new C1PreviewPane.LayoutSection(ppMain, HistorySavedActionsEnum.All))
         {
             ppMain.Continuous = true;
             ppMain.PageLayout = C1.Win.C1Preview.PageLayoutEnum.Normal;
             ppMain.Cols       = 1;
             ppMain.Rows       = 1;
             ppMain.ZoomMode   = ZoomModeEnum.WholePage;
         }
     }
     else if (item == rbtnZoomTwoPages ||
              item == rbtnZoomFourPages ||
              item == rbtnZoomEightPages ||
              item == rbtnZoomTwelvePages)
     {
         string s = item.Tag as string;
         if (s != null)
         {
             string[] cr = s.Split(',');
             if (cr.Length == 2)
             {
                 int c, r;
                 if (int.TryParse(cr[0], out r) && int.TryParse(cr[1], out c))
                 {
                     using (new C1PreviewPane.LayoutSection(ppMain, HistorySavedActionsEnum.All))
                     {
                         ppMain.Continuous = true;
                         ppMain.PageLayout = C1.Win.C1Preview.PageLayoutEnum.Custom;
                         ppMain.Cols       = c;
                         ppMain.Rows       = r;
                     }
                 }
             }
         }
     }
     if (item == rbtnHistoryBack)
     {
         ppMain.HistoryBack();
     }
     else if (item == rbtnHistoryNext)
     {
         ppMain.HistoryForward();
     }
     else if (item == rbtnFirstPage)
     {
         ppMain.StartPageIdx = 0;
     }
     else if (item == rbtnPreviousPage)
     {
         ppMain.StartPageIdx--;
     }
     else if (item == rbtnNextPage)
     {
         ppMain.StartPageIdx++;
     }
     else if (item == rbtnLastPage)
     {
         ppMain.StartPageIdx = ppMain.Pages.Count - 1;
     }
     if (item == rbtnHandTool)
     {
         ppMain.MouseMode = MouseModeEnum.Hand;
     }
     else if (item == rbtnTextSelectTool)
     {
         ppMain.MouseMode = MouseModeEnum.Select;
     }
     else if (item == rbtnOutline)
     {
         dtpOutline.Show();
         ActiveControl = povMain;
     }
     else if (item == rbtnPages)
     {
         dtpPages.Show();
         ActiveControl = ptvMain;
     }
     else if (item == rbtnSearch)
     {
         dtpSearch.Show();
         ActiveControl = ptspMain.Controls[0].Controls[2];
     }
     else if (item.Parent as RibbonItem == rbtnHistoryBack || item.Parent as RibbonItem == rbtnHistoryNext)
     {
         ViewHistoryItem vhi = item.Tag as ViewHistoryItem;
         if (vhi != null)
         {
             ppMain.CurrentHistoryEntry = vhi;
         }
     }
 }