Ejemplo n.º 1
0
        //{
        //    get => textBlockFormat;
        //    set => textBlockFormat = value;
        //}
        //private string message = "Fox Lady";
        //public string Message
        //{
        //    get => message;
        //    set => message = value;
        //}


        public EditParagraphViewModel()
        {
            UpdateSettings      = new DelegateCommand(OnUpdateSettingsExecute, OnUpdateSettingsCanExecute);
            LoadCurrentSettings = new DelegateCommand(OnLoadCurrentSettingsExecute, OnLoadCurrentSettingsCanExecute);

            HorizontalAlignmentChoices = new System.Collections.ObjectModel.ObservableCollection <ItemInfo>()
            {
                new ItemInfo()
                {
                    Content = "Left", Value = "0"
                }
                , new ItemInfo()
                {
                    Content = "Center", Value = "1"
                }
                , new ItemInfo()
                {
                    Content = "Right", Value = "2"
                }
                , new ItemInfo()
                {
                    Content = "TextControlBound", Value = "=IF(Controls.Row_1 > Width, 0, IF(Controls.Row_1 < 0, 2, 1))"
                }
                , new ItemInfo()
                {
                    Content = "Foo", Value = "Bar"
                }
            };


            // TODO(crhodes)
            // Decide if we want defaults
            Paragraph = new ParagraphWrapper(new Domain.ParagraphRow());
        }
Ejemplo n.º 2
0
        void OnLoadCurrentSettingsExecute()
        {
            Visio.Application app = Globals.ThisAddIn.Application;

            Visio.Selection selection = app.ActiveWindow.Selection;

            // Verify only one shape, for now just grab first.

            foreach (Visio.Shape shape in selection)
            {
                Paragraph = new ParagraphWrapper(Visio_Shape.Get_ParagraphSection(shape));
                OnPropertyChanged("Paragraph");
            }
        }
Ejemplo n.º 3
0
        private IEnumerable <Sentence> ConcatSentences(List <Paragraph> paragraphs)
        {
            Sentence currentSentence     = new Sentence();
            int      lastParagraphNumber = int.MinValue;

            foreach (var paragraph in paragraphs)
            {
                if (lastParagraphNumber + 1 != paragraph.Number) //check if paragraphs belong sequentially together
                {
                    if (currentSentence.Text.Length > 0)         //this check avoids to add empty Sentence
                    {
                        yield return(currentSentence);

                        currentSentence = new Sentence();
                    }
                }

                lastParagraphNumber = paragraph.Number;
                var paragraphWrapper = new ParagraphWrapper(paragraph);

                var sentenceChunks = SentenceSplitEngine.Split(paragraph.Text);
                foreach (var sentenceChunk in sentenceChunks)
                {
                    if (currentSentence.Text.Length > 0 && SentenceDelimiterBeforeChars.Contains(sentenceChunk[0]))
                    {
                        yield return(currentSentence);

                        currentSentence = new Sentence();
                    }
                    currentSentence.SentenceParagraphs.Add(new SentenceParagraphRelation(sentenceChunk, paragraphWrapper));
                    if (SentenceDelimiterAfterChars.Contains(sentenceChunk[sentenceChunk.Length - 1]))
                    {
                        yield return(currentSentence);

                        currentSentence = new Sentence();
                    }
                }
            }
            if (currentSentence.Text.Length > 0) //this check avoid a empty last Sentence (could happen when the last chunk ends with a delimiter)
            {
                yield return(currentSentence);
            }
        }
Ejemplo n.º 4
0
 public SentenceParagraphRelation(string text, ParagraphWrapper paragraphWrapper)
 {
     paragraphWrapper.SentenceParagraphRelations.Add(this);
     ParagraphWrapper = paragraphWrapper;
     Text             = text;
 }