Esempio n. 1
0
        public void PresentationtMarkerGetCrossedSlideIdElementsShouldReturnOne()
        {
            IList <int> result = UniversalPreCGWMarker.GetCrossedSlideIdElements("rId5", "rId5");

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(2, result[0]);
        }
        /// <summary>
        /// Finds parts of documents selected by the marker and returns as a list of persons each containing list of document elements
        /// </summary>
        /// <returns></returns>
        public IList <OpenXMLDocumentPart <SlideId> > Run()
        {
            IList <OpenXMLDocumentPart <SlideId> > documentElements = new List <OpenXMLDocumentPart <SlideId> >();

            if (SplitPresentationObj != null)
            {
                foreach (Person person in SplitPresentationObj.Person)
                {
                    if (person.UniversalMarker != null)
                    {
                        foreach (PersonUniversalMarker marker in person.UniversalMarker)
                        {
                            IList <int> result = UniversalPreMarker.GetCrossedSlideIdElements(marker.ElementId, marker.SelectionLastelementId);
                            foreach (int index in result)
                            {
                                if (string.IsNullOrEmpty(SubdividedParagraphs[index]))
                                {
                                    SubdividedParagraphs[index] = person.Email;
                                }
                                else
                                {
                                    throw new ElementToPersonPairException();
                                }
                            }
                        }
                    }
                }

                string email = string.Empty;
                OpenXMLDocumentPart <SlideId> part = new OpenXMLDocumentPart <SlideId>();
                var slidePartsList = Presentation.Presentation.SlideIdList.ChildElements;
                for (int index = 0; index < slidePartsList.Count; index++)
                {
                    if (SubdividedParagraphs[index] != email)
                    {
                        part = new OpenXMLDocumentPart <SlideId>();
                        part.CompositeElements.Add(slidePartsList[index] as SlideId);
                        email = SubdividedParagraphs[index];
                        if (string.IsNullOrEmpty(email))
                        {
                            part.PartOwner = "undefined";
                        }
                        else
                        {
                            part.PartOwner = email;
                        }

                        documentElements.Add(part);
                    }
                    else
                    {
                        part.CompositeElements.Add(slidePartsList[index] as SlideId);
                    }
                }
            }

            return(documentElements);
        }
Esempio n. 3
0
        public void PresentationMarkerGetCrossedSlideIdElementsShouldReturnThree()
        {
            IList <int> result = UniversalPreSampleMarker.GetCrossedSlideIdElements("rId12", "rId14");

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Count);
            Assert.AreEqual(10, result[0]);
            Assert.AreEqual(11, result[1]);
            Assert.AreEqual(12, result[2]);
        }