Exemple #1
0
        protected void AddViewTab(string tabName, DocumentViewType viewType)
        {
            int lastIndex = 0;

            foreach (var setting in _views.TabSettings)
            {
                if (lastIndex < setting.Index)
                {
                    lastIndex = setting.Index;
                }
            }
            lastIndex++;

            TabSetting tabSetting = new TabSetting();

            tabSetting.DisplayName = tabName;
            tabSetting.ColumnName  = "NOTE_TEXT" + lastIndex.ToString();
            tabSetting.Dynamic     = true;
            tabSetting.Order       = _views.TabSettings.Count + 1;
            tabSetting.Index       = lastIndex;
            tabSetting.Visible     = true;
            tabSetting.TabType     = viewType;

            _views.TabSettings.Add(tabSetting);

            AddNewColumn(tabSetting);
            _views.DocumentsService.SetDocumentColumnSettings(_views.TabSettings);

            _tabPages.Add(AddNewTab(tabSetting));

            RefreshTabs();
        }
        public PaneNoteHtmlView(string noteColumnName = "NOTE_TEXT", DocumentViewType viewType = DocumentViewType.Html_ListView)
        {
            NoteColumnName = noteColumnName;
            _viewType      = viewType;


            InitializeComponent();

            toolStripTop.Renderer = new CustomToolStripRenderer {
                RoundedEdges = false
            };
        }
Exemple #3
0
 public WebOptionsPage(IServiceProvider provider, WebPackage package)
     : base(provider)
 {
     this.InitializeComponent();
     this._webPackage = package;
     this._defaultViewComboBox.Items.Add(Enum.GetName(typeof(DocumentViewType), DocumentViewType.Design));
     this._defaultViewComboBox.Items.Add(Enum.GetName(typeof(DocumentViewType), DocumentViewType.Source));
     this._originalWebDefaultView = this._webPackage.WebDefaultViewInternal;
     this._originalDesignModeEnabled = this._webPackage.DesignModeEnabled;
     this._newWebDefaultView = this._originalWebDefaultView;
     this._newDesignModeEnabled = this._originalDesignModeEnabled;
 }
Exemple #4
0
 public override Document OpenProjectItem(DocumentProjectItem item, bool readOnly, DocumentViewType initialView)
 {
     IProjectManager service = (IProjectManager) base.GetService(typeof(IProjectManager));
     if (service != null)
     {
         Project localFileSystemProject = service.LocalFileSystemProject;
         if (localFileSystemProject != null)
         {
             return localFileSystemProject.OpenProjectItem(item, readOnly, initialView);
         }
     }
     return null;
 }
 public TableDocumentWindow(IServiceProvider serviceProvider, Document document, DocumentViewType initialView)
     : base(serviceProvider, document)
 {
     if (initialView == DocumentViewType.Default)
     {
         initialView = DocumentViewType.Design;
     }
     IDocumentView viewByType = ((IMultiViewDocumentWindow) this).GetViewByType(initialView);
     if (viewByType != null)
     {
         ((IMultiViewDocumentWindow) this).ActivateView(viewByType);
     }
 }
    internal static string smethod_7(DocumentViewType A_0)
    {
        int num = 15;

        switch (A_0)
        {
        case DocumentViewType.PrintLayout:
            return(BookmarkStart.b("䔴䔶倸唺䤼", num));

        case DocumentViewType.OutlineLayout:
            return(BookmarkStart.b("場嘶䨸伺堼䴾汀㍂⑄⁆ⱈ㡊", num));

        case DocumentViewType.NormalLayout:
            return(BookmarkStart.b("嬴堶䬸嘺尼匾", num));

        case DocumentViewType.WebLayout:
            return(BookmarkStart.b("䈴制嬸", num));
        }
        return(BookmarkStart.b("䔴䔶倸唺䤼", num));
    }
Exemple #7
0
 public override Document OpenProjectItem(DocumentProjectItem projectItem, bool readOnly, DocumentViewType initialView)
 {
     if ((projectItem is TableProjectItem) || (projectItem is StoredProcedureProjectItem))
     {
         IDocumentManager service = (IDocumentManager) base.GetService(typeof(IDocumentManager));
         if (service == null)
         {
             return null;
         }
         try
         {
             return service.OpenDocument(projectItem, readOnly, DocumentViewType.Default);
         }
         catch (Exception exception)
         {
             ((IMxUIService) base.GetService(typeof(IMxUIService))).ReportError(exception, "Error opening document.", false);
             return null;
         }
     }
     return null;
 }
Exemple #8
0
 public abstract Document OpenProjectItem(DocumentProjectItem projectItem, bool readOnly, DocumentViewType initialView);
 public MobileWebFormsDocumentWindow(IServiceProvider provider, Document document, DocumentViewType initialView)
     : base(provider, document, initialView)
 {
 }
Exemple #10
0
 Document IDocumentManager.OpenDocument(DocumentProjectItem projectItem, bool readOnly, DocumentViewType initialView)
 {
     if (this._documentList != null)
     {
         foreach (DocumentEntry entry in this._documentList)
         {
             if (projectItem.Equals(entry.document.ProjectItem))
             {
                 if (entry.docWindow.ActivateWindow())
                 {
                     return entry.document;
                 }
                 return null;
             }
         }
     }
     DocumentType documentType = projectItem.DocumentType;
     if (documentType != null)
     {
         IDocumentFactory factory = documentType.Factory;
         if (factory != null)
         {
             try
             {
                 DocumentEntry entry2 = new DocumentEntry();
                 entry2.document = factory.CreateDocument(projectItem, readOnly, this._documentMode, initialView, out entry2.docWindow, out entry2.designerHost);
                 if (this._documentList == null)
                 {
                     this._documentList = new ArrayList();
                 }
                 this._documentList.Add(entry2);
                 IServiceContainer service = (IServiceContainer) ((IServiceProvider) entry2.designerHost).GetService(typeof(IServiceContainer));
                 service.AddService(typeof(Document), entry2.document);
                 service.AddService(typeof(DocumentWindow), entry2.docWindow);
                 entry2.docWindow.Activated += new EventHandler(this.OnDocumentWindowActivated);
                 entry2.docWindow.Closed += new EventHandler(this.OnDocumentWindowClosed);
                 try
                 {
                     this.OnDesignerCreated(new DesignerEventArgs(entry2.designerHost));
                 }
                 catch (Exception)
                 {
                 }
                 try
                 {
                     this.OnDocumentOpened(new DocumentEventArgs(entry2.document));
                 }
                 catch (Exception)
                 {
                 }
                 if (entry2.docWindow.ShowWindow())
                 {
                     return entry2.document;
                 }
             }
             catch (Exception exception)
             {
                 ((IMxUIService) this._serviceProvider.GetService(typeof(IMxUIService))).ReportError(exception, "Unable to open the document", false);
             }
         }
     }
     return null;
 }
Exemple #11
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     throw new NotSupportedException("Invalid use of CodeDocumentFactory. This class only exists to represent a arbitrary code file.");
 }
Exemple #12
0
        protected void GetDocumentColumnSettings()
        {
            List <TabSetting> columnSettings = new List <TabSetting>();

            _noteColumnCount = 0;

            var cmd = _connection.CreateCommand();

            cmd.CommandText = "SELECT * FROM Documents";
            var reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly);

            DataTable table   = reader.GetSchemaTable();
            var       nameCol = table.Columns["ColumnName"];

            foreach (DataRow row in table.Rows)
            {
                if (row[nameCol].ToString().StartsWith("NOTE_TEXT"))
                {
                    var noteIndex = Int32.Parse(row[nameCol].ToString().Replace("NOTE_TEXT", "0"));

                    TabSetting setting = new TabSetting();
                    setting.ColumnName  = row[nameCol].ToString();
                    setting.DisplayName = "Document " + (noteIndex + 1).ToString();
                    setting.Visible     = true;
                    setting.Index       = noteIndex;
                    setting.Order       = -1;
                    setting.Dynamic     = IsColumnDynamic(setting.ColumnName);
                    setting.TabType     = DocumentViewType.Normal;
                    setting.Score       = false;
                    columnSettings.Add(setting);

                    _noteColumnCount++;
                }
                if (row[nameCol].ToString().StartsWith("NOTE_ENTITIES"))
                {
                    TabSetting setting = new TabSetting();
                    setting.ColumnName  = row[nameCol].ToString();
                    setting.DisplayName = "Document Entities";
                    setting.Visible     = false;
                    setting.Index       = -1;
                    setting.Order       = -1;
                    setting.Dynamic     = false;
                    setting.TabType     = DocumentViewType.Html_SpaCyEntityView;
                    setting.Score       = false;
                    columnSettings.Add(setting);
                }
                Console.WriteLine(row[nameCol]);
            }

            foreach (DataRow row1 in table.Rows)
            {
                if (row1[nameCol].ToString().StartsWith("Score"))
                {
                    var index      = Int32.Parse(row1[nameCol].ToString().Replace("Score", "0"));
                    var srchResult = columnSettings.Find(x => x.Index == index);
                    srchResult.Score = true;
                }
            }

            if (_noteColumnCount == 1)
            {
                columnSettings[0].DisplayName = "Document";
            }

            int namedColumnCount = 0;

            try
            {
                var cmdNameRead = _connection.CreateCommand();
                cmdNameRead.CommandText = "SELECT DocumentColumn, Name, Order, TabType FROM DocumentColumnNames";

                using (reader = cmdNameRead.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string           documentColumn = reader.GetString(0);
                        string           Name           = reader.GetString(1);
                        int              order          = reader.GetInt32(2);
                        DocumentViewType type           = (DocumentViewType)reader.GetInt32(3);

                        if (documentColumn.StartsWith("NOTE_TEXT") || documentColumn.StartsWith("NOTE_ENTITIES"))
                        {
                            var itemResult = columnSettings.Find(x => x.ColumnName == documentColumn);
                            if (itemResult != null)
                            {
                                itemResult.DisplayName = Name;
                                itemResult.Order       = order;
                                if (order == 0)
                                {
                                    itemResult.Visible = false;
                                }
                                else
                                {
                                    itemResult.Visible = true;
                                }

                                itemResult.TabType = type;
                                namedColumnCount++;
                            }
                        }
                        else
                        {
                            TabSetting setting = new TabSetting();
                            setting.ColumnName  = documentColumn;
                            setting.DisplayName = Name;
                            setting.Visible     = true;
                            setting.Index       = -1;
                            setting.Order       = order;
                            setting.Dynamic     = false;
                            setting.TabType     = DocumentViewType.Browser;
                            setting.Score       = false;

                            columnSettings.Add(setting);
                        }
                    }
                }
            } catch (Exception e)
            {
                Console.WriteLine("GetDocumentColumnNames: " + e.Message);
            }
            finally
            {
                int max_ordernum = 1;
                for (int i = 0; i < _noteColumnCount; i++)
                {
                    if (max_ordernum < columnSettings[i].Order)
                    {
                        max_ordernum = columnSettings[i].Order;
                    }
                }

                for (int i = 0; i < _noteColumnCount; i++)
                {
                    if (columnSettings[i].Order == -1)
                    {
                        columnSettings[i].Order = ++max_ordernum;
                    }
                }

                TabSettingCompare gg = new TabSettingCompare();

                columnSettings.Sort(gg);

                if (namedColumnCount < _noteColumnCount)
                {
                    SetDocumentColumnSettings(columnSettings, true);
                }

                SendResponse(new IpcResponse
                {
                    ResponseType           = IpcResponseType.Success,
                    DocumentColumnSettings = columnSettings,
                });
            }
        }
Exemple #13
0
 private void _defaultViewComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this._defaultViewComboBox.SelectedItem != null)
     {
         this._newWebDefaultView = (DocumentViewType) Enum.Parse(typeof(DocumentViewType), (string) this._defaultViewComboBox.SelectedItem);
     }
 }
Exemple #14
0
 public AscxDocumentWindow(IServiceProvider provider, Document document, DocumentViewType initialView)
     : base(provider, document, initialView)
 {
 }
Exemple #15
0
 public override Document OpenProjectItem(DocumentProjectItem item, bool readOnly, DocumentViewType initialView)
 {
     IDocumentManager service = (IDocumentManager) base.GetService(typeof(IDocumentManager));
     if (service == null)
     {
         return null;
     }
     MiscFileProjectItem projectItem = item as MiscFileProjectItem;
     if ((projectItem == null) || (projectItem.Project != this))
     {
         projectItem = new MiscFileProjectItem(item.Caption, item.Path, this);
     }
     Document document = service.OpenDocument(projectItem, readOnly, initialView);
     this.AddMruEntry(item);
     return document;
 }
Exemple #16
0
 void IPackage.Initialize(IServiceProvider serviceProvider)
 {
     this._serviceProvider = serviceProvider;
     IServiceContainer container = (IServiceContainer) this._serviceProvider.GetService(typeof(IServiceContainer));
     if (container != null)
     {
         container.AddService(typeof(IWebDocumentRunService), new ServiceCreatorCallback(this.OnCreateService));
     }
     IPreferencesService service = (IPreferencesService) this._serviceProvider.GetService(typeof(IPreferencesService));
     if (service != null)
     {
         PreferencesStore preferencesStore = service.GetPreferencesStore(typeof(WebPackage));
         this._webDefaultView = (DocumentViewType) preferencesStore.GetValue(WebDefaultViewPreference, (int) WebDefaultViewDefault);
         this._designModeEnabled = preferencesStore.GetValue(DesignViewModePreference, DesignViewModeDefault);
     }
 }
Exemple #17
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     Document document = new HtmlDocument(projectItem);
     designerHost = new DesignerHost(document);
     document.Load(readOnly);
     if (initialView == DocumentViewType.Default)
     {
         initialView = WebPackage.Instance.WebDefaultView;
     }
     documentWindow = new HtmlDocumentWindow(designerHost, document, initialView);
     return document;
 }
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     TableDocument document = new TableDocument(projectItem);
     designerHost = new DesignerHost(document);
     document.Load(readOnly);
     if (initialView == DocumentViewType.Default)
     {
         initialView = (document.Table.GetRowCount() == 0) ? DocumentViewType.Design : DocumentViewType.Source;
     }
     documentWindow = new TableDocumentWindow(designerHost, document, initialView);
     return document;
 }
 IDocumentView IMultiViewDocumentWindow.GetViewByType(DocumentViewType viewType)
 {
     return this._viewHost.GetViewByType(viewType);
 }
        protected internal string SignDocumentWithImage(string rootPath,
                                                        string fileName,
                                                        Stream imageStream,
                                                        int pageNumber,
                                                        int left,
                                                        int top,
                                                        int width,
                                                        int height,
                                                        int signatureColumnNum, int signatureRowNum)
        {
            string storagePath = rootPath;
            string outputPath  = Path.Combine(rootPath, @"Output");
            string imagesPath  = Path.Combine(rootPath, @"Images");

            // set up a configuration
            SignatureConfig config = new SignatureConfig()
            {
                StoragePath = storagePath,
                OutputPath  = outputPath,
                ImagesPath  = imagesPath
            };

            // instantiating the handler
            SignatureHandler handler = new SignatureHandler(config);

            // Set a license if you have one
            _licensing.ApplyLicense();

            // setup PDF image signature options
            SignImageOptions signOptions       = null;
            string           fileNameExtension = Path.GetExtension(fileName).TrimStart('.');

            fileNameExtension = fileNameExtension.ToLower();
            int pageWidth = 0, pageHeight = 0;
            DocumentViewType fileType = GetDocumentType(fileNameExtension);

            switch (fileType)
            {
            case DocumentViewType.Pdf:
                signOptions = new PdfSignImageOptions(imageStream);
                break;

            case DocumentViewType.Words:
                signOptions = new WordsSignImageOptions(imageStream);
                break;

            case DocumentViewType.Cells:
                signOptions = new CellsSignImageOptions(imageStream)
                {
                    ColumnNumber = signatureColumnNum,
                    RowNumber    = signatureRowNum
                };
                break;

            case DocumentViewType.Slides:
                signOptions = new SlidesSignImageOptions(imageStream);
                break;
            }
            signOptions.DocumentPageNumber = pageNumber;
            signOptions.Left         = left;
            signOptions.Top          = top;
            signOptions.Width        = width;
            signOptions.Height       = height;
            signOptions.SignAllPages = false;

            GroupDocs.Signature.Options.SaveOptions saveOptions = new GroupDocs.Signature.Options.SaveOptions(OutputType.String);
            // sign the document
            string outputFilePath = handler.Sign <string>(fileName, signOptions, saveOptions);

            return(outputFilePath);
        }
Exemple #21
0
 public override Document OpenProjectItem(DocumentProjectItem projectItem, bool readOnly, DocumentViewType initialView)
 {
     IDocumentManager service = (IDocumentManager) base.GetService(typeof(IDocumentManager));
     if (service == null)
     {
         return null;
     }
     OpenTypeProjectItem item = projectItem as OpenTypeProjectItem;
     if (item == null)
     {
         item = new OpenTypeProjectItem(((TypeProjectItem) projectItem).Type, this);
     }
     return service.OpenDocument(item, true, DocumentViewType.Default);
 }
Exemple #22
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     Document document = new AshxDocument(projectItem);
     designerHost = new DesignerHost(document);
     document.Load(readOnly);
     documentWindow = new AshxDocumentWindow(designerHost, document);
     return document;
 }
Exemple #23
0
 private void OpenDocument(DocumentProjectItem projectItem, DocumentViewType viewType)
 {
     IDocumentManager service = (IDocumentManager) base.ServiceProvider.GetService(typeof(IDocumentManager));
     if (service != null)
     {
         service.OpenDocument(projectItem, false, viewType);
     }
 }
Exemple #24
0
 Document IDocumentFactory.CreateDocument(DocumentProjectItem projectItem, bool readOnly, DocumentMode mode, DocumentViewType initialView, out DocumentWindow documentWindow, out DesignerHost designerHost)
 {
     if (projectItem == null)
     {
         throw new ArgumentNullException("projectItem");
     }
     if (initialView == DocumentViewType.Default)
     {
         initialView = WebPackage.Instance.WebDefaultView;
         if (initialView == DocumentViewType.Source)
         {
             initialView = DocumentViewType.Composite;
         }
     }
     documentWindow = null;
     AscxDocument document = new AscxDocument(projectItem);
     designerHost = new WebFormsDesignerHost(document);
     document.Load(readOnly);
     Page page = null;
     UserControl child = null;
     if (document.DocumentDirective.Inherits.ToLower().IndexOf("mobile") < 0)
     {
         page = new Page();
         child = new UserControl();
         child.ID = "Page";
         documentWindow = new AscxDocumentWindow(designerHost, document, initialView);
         page.Site = new AscxPageSite(designerHost, page);
         page.DesignerInitialize();
         page.Controls.Add(child);
     }
     else
     {
         if (!_mobileAssemblyLoadFailed)
         {
             if (_mobileAssembly == null)
             {
                 _mobileAssembly = Assembly.LoadWithPartialName(_mobileAssemblyName);
             }
             if (_mobileAssembly != null)
             {
                 document.Dispose();
                 document = new AscxDocument(projectItem);
                 Type type = _mobileAssembly.GetType("System.Web.UI.MobileControls.MobilePage");
                 Type type2 = _mobileAssembly.GetType("System.Web.UI.MobileControls.MobileUserControl");
                 Type type3 = _mobileAssembly.GetType("System.Web.UI.MobileControls.Form");
                 page = (Page) Activator.CreateInstance(type);
                 child = (UserControl) Activator.CreateInstance(type2);
                 Control control2 = (Control) Activator.CreateInstance(type3);
                 Type type4 = Type.GetType("Microsoft.Matrix.Packages.Web.Mobile.MobileDesignerHost, Microsoft.Matrix.Packages.Web.Mobile");
                 designerHost = (DesignerHost) Activator.CreateInstance(type4, new object[] { document });
                 document.Load(readOnly);
                 Type type5 = Type.GetType("Microsoft.Matrix.Packages.Web.Mobile.MobileWebFormsDocumentWindow, Microsoft.Matrix.Packages.Web.Mobile");
                 documentWindow = (DocumentWindow) Activator.CreateInstance(type5, new object[] { designerHost, document, initialView });
                 page.Site = new AscxPageSite(designerHost, page);
                 page.DesignerInitialize();
                 page.Controls.Add(control2);
                 control2.Controls.Add(child);
             }
             else
             {
                 _mobileAssemblyLoadFailed = true;
             }
         }
         if (_mobileAssemblyLoadFailed)
         {
             document.Dispose();
             Document document2 = new TextDocument(projectItem);
             designerHost = new DesignerHost(document2);
             ((IMxUIService) designerHost.GetService(typeof(IMxUIService))).ReportError("Microsoft Mobile Internet Toolkit is required for design-time editing of mobile user controls.\r\nPlease visit 'http://www.asp.net/mobile/default.aspx' for more information.\r\nThe user control will be opened in the text editor instead.", "Mobile User Controls are not enabled.", true);
             document2.Load(readOnly);
             documentWindow = new TextDocumentWindow(designerHost, document2);
             return document2;
         }
     }
     IDesignerHost host = designerHost;
     host.Container.Add(child, "UserControl");
     child.DesignerInitialize();
     return document;
 }
 public IDocumentView GetViewByType(DocumentViewType viewType)
 {
     if ((viewType < DocumentViewType.Default) || (viewType > DocumentViewType.Composite))
     {
         throw new ArgumentOutOfRangeException("Invalid DocumentViewType");
     }
     foreach (MultiViewDocumentWindow.ViewInfo info in this._views)
     {
         if (info.view.ViewType == viewType)
         {
             return info.view;
         }
     }
     return null;
 }