protected internal static void ExpandFieldsInBookRange(DocumentRange range, IWorkbook defaultSpreadsheet, Hashtable snippets = null)
        {
            var doc = range.BeginUpdateDocument();

            try
            {
                var fieldRanges = doc.FindAll(new Regex("(?:{{|(?:{(?:}}|[^}])*}(?!})))"), range);
                if (fieldRanges == null || fieldRanges.Length <= 0)
                {
                    return;
                }

                foreach (var fieldRange in fieldRanges)
                {
                    var fieldText = doc.GetText(fieldRange);
                    if (fieldText == "{{")
                    {
                        doc.Replace(fieldRange, "{");
                        continue;
                    }

                    var code = Utils.TrimString(UnpackField(fieldText));

                    if (code.StartsWith("#"))   //Fields starting with # - #FILE, #IMAGE, #LATEX etc. - calculate field and insert its content instead of field itself
                    {
                        var codeName = Regex.Match(code, @"(?<=^#)[\w_\-]+").Value;

                        using var book = new InternalBook()
                              {
                                  DefaultSpreadsheet = defaultSpreadsheet,
                                  NeedSynchronizeDefaultSpreadsheet = true,
                                  Snippets = ConvertSnippets()
                              };
                        var helperFieldRange = book.Document.AppendText($"DOCVARIABLE {code[1..]}");
        public BookDocumentView()
        {
            using var _ = new DocumentAddingProcessor(this);

            InitializeComponent();

            UIUtils.ConfigureRibbonBar(Ribbon);

            //Fix skin colors in comment control
            var commentEdit = richEditCommentControl1.Controls.OfType <InnerCommentControl>().FirstOrDefault();

            if (commentEdit != null)
            {
                commentEdit.Options.DocumentCapabilities.Macros     = DocumentCapability.Disabled;
                commentEdit.Options.DocumentCapabilities.OleObjects = DocumentCapability.Disabled;

                commentEdit.Views.DraftView.AdjustColorsToSkins       = commentEdit.RichEditControl.Views.DraftView.AdjustColorsToSkins;
                commentEdit.Views.SimpleView.AdjustColorsToSkins      = commentEdit.RichEditControl.Views.SimpleView.AdjustColorsToSkins;
                commentEdit.Views.PrintLayoutView.AdjustColorsToSkins = commentEdit.RichEditControl.Views.PrintLayoutView.AdjustColorsToSkins;
            }

            ribbonControl.SelectedPage = homeRibbonPage1;

            SCBook = new InternalBook(Editor);
            BookFactoryHelper.SetCommandFactory(Editor, this);

            Disposed += BookDocumentView_Disposed;

            //Disable removing styles
            barRemoveStyle.Visibility = BarItemVisibility.Never;
        }
        public ConsoleBookControl()
        {
            InitializeComponent();

            SetupEditor();

            SCBook    = new InternalBook(Editor);
            Disposed += ConsoleBookControl_Disposed;

            //Fix skin colors in comment control
            var commentEdit = richEditCommentControl1.Controls.OfType <InnerCommentControl>().FirstOrDefault();

            if (commentEdit != null)
            {
                commentEdit.Views.DraftView.AdjustColorsToSkins       = commentEdit.RichEditControl.Views.DraftView.AdjustColorsToSkins;
                commentEdit.Views.SimpleView.AdjustColorsToSkins      = commentEdit.RichEditControl.Views.SimpleView.AdjustColorsToSkins;
                commentEdit.Views.PrintLayoutView.AdjustColorsToSkins = commentEdit.RichEditControl.Views.PrintLayoutView.AdjustColorsToSkins;
            }

            UIUtils.ConfigureRibbonBar(Ribbon);
            Ribbon.SelectedPage = homeRibbonPage1;

            ProjectUriStreamProvider.RegisterProvider(Editor);

            //Disable removing styles
            barRemoveStyle.Visibility = BarItemVisibility.Never;
        }
Example #4
0
        public MongoDB.Models.Book ConvertInternalToMongoBook(InternalBook internalBook)
        {
            //var convertedGenre = (Genres)Enum.Parse(typeof(Genres), genre);

            return(new MongoDB.Models.Book
            {
                BookId = internalBook.BookId,
                OverallRating = internalBook.OverallRating,
                Pages = internalBook.Pages,
                PublicationYear = internalBook.PublicationYear,
                Sample = internalBook.Sample,
                Title = internalBook.Title,
                Writer = internalBook.Writer,
                Genre = internalBook.Genre
            });
        }
Example #5
0
        public async Task InsertBook([FromBody] InternalBook book)
        {
            //var bookOverride = new InternalBook()
            //{
            //    BookId = 4,
            //    Title="ninscneve",
            //    Writer="en",
            //    Genre= Book.DataManagement.OverallModels.Genres.StarWars,
            //    Pages=343,
            //    PublicationYear=2015,
            //    OverallRating=0,
            //    Sample="Ez a tortenete:semmi"
            //};

            await new BookService().InsertBook(book);
        }
 private void BookDocumentView_Disposed(object sender, EventArgs e)
 {
     SCBook?.Dispose();
     SCBook = null;
 }
Example #7
0
 public void Dispose()
 {
     CommonBook?.Dispose();
     CommonBook = null;
 }
Example #8
0
 public SCBook(ScriptHost host) : base(host)
 {
     CommonBook = new InternalBook(host.Engine.BookServer);
 }
Example #9
0
 public SCBook() : base()
 {
     CommonBook = new InternalBook();
 }
Example #10
0
 public async Task DeleteQueueBook(int userid, InternalBook model)
 {
     await _repo.DeleteQueueBook(userid, new Converter().ConvertInternalToMongoBook(model));
 }
Example #11
0
 public async Task InsertFinishedBook(int userid, InternalBook book)
 {
     //ha elkezdett törölni kell a felhasználótól
     await _repo.InsertFinishedBook(userid, new Converter().ConvertInternalToMongoBook(book));
 }
Example #12
0
 public async Task PutInQueue(int userId, InternalBook book)
 {
     await _repo.PutInQueue(userId, new Converter().ConvertInternalToMongoBook(book));
 }
Example #13
0
 public async Task SetFavorite(int userid, InternalBook book)
 {
     var mongoBook = new Converter().ConvertInternalToMongoBook(book);
     await _repo.SetFavorite(userid, mongoBook);
 }
Example #14
0
 public async Task InsertBook(InternalBook internalBook)
 {
     var book = new Converter().ConvertInternalToMongoBook(internalBook);
     await _repo.InsertBook(book);
 }