Example #1
0
        protected void PageInit(object sender, EventArgs e)
        {
            Logger.Write("BaseWebTemplate", "PageInit", string.Format("request: {0}", Request.Url.ToString()));
            string requestPage = Request.Url.Segments[Request.Url.Segments.Length - 1];

            if (requestPage.ToLower() != "default.aspx")
            {
                throw new Exception("No find page");
            }
            NameValueCollection coll = Request.QueryString;
            string pageName          = GetPageName(coll);

            Logger.Write("BaseWebTemplate", "PageInit", "Load page " + pageName);

            UOI.Sys.Page      page     = UOI.Sys.Page.GetObject(pageName);
            ContentCollection contents = page.GetPageData(coll);
            string            webControlId;
            string            xml;
            string            xsl;

            foreach (UOI.Sys.Content content in contents)
            {
                webControlId = content.Control.WebContolId;
                xml          = content.Xml;
                xsl          = content.Xsl.XData;
                ApplyPageData(webControlId, xml, xsl);
            }

            Logger.Write("BaseWebTemplate", "PageInit", "Finish load page");
        }
Example #2
0
        /// <summary>
        /// Inits the standards.
        /// </summary>
        private void InitStandards()
        {
            Content = new ContentCollection();

            Content.Inserted += Content_Inserted;
            Content.Removed  += Content_Removed;
        }
        /// <summary>
        /// Initializes an instance of a ContentListControl.
        /// </summary>
        public ContentLayout()
        {
            _contentList = new ContentCollection();
            _contentList.CollectionChanged += OnContentListCollectionChanged;

            Loaded += OnLoaded;
        }
Example #4
0
        public DataGridLite()
        {
            _columns     = new ContentCollection <LiteColumn>(this);
            _rows        = new ContentCollection <LiteRow>(this);
            _cells       = new ContentCollection <UIElement>(this);
            _headerCells = new ContentCollection <UIElement>(this);
            _scrollbar   = new ScrollBar();

            AddLogicalChild(_scrollbar);
            AddVisualChild(_scrollbar);
            _scrollbar.Scroll += OnScroll;
            _scrollbar.SetBinding(RangeBase.SmallChangeProperty, new Binding {
                Path   = new PropertyPath("RowHeight"),
                Source = this,
                Mode   = BindingMode.OneWay,
            });
            _scrollbar.SetBinding(RangeBase.LargeChangeProperty, new Binding {
                Path      = new PropertyPath("Maximum"),
                Source    = _scrollbar,
                Mode      = BindingMode.OneWay,
                Converter = new ScrollStepConverter {
                    Multiplier = .1
                }
            });
            MouseUp    += GridMouseUp;
            MouseDown  += GridMouseDown;
            MouseWheel += GridMouseWheel;
        }
Example #5
0
        /// <summary>
        /// Gets the content for headers and footers.
        /// </summary>
        /// <param name="contentNode">The content node.</param>
        /// <param name="textDocument">The text document.</param>
        /// <returns>The contents as IContentCollection.</returns>
        public ContentCollection GetContentHeaderFooter(XmlNode contentNode, TextDocument textDocument)
        {
            ContentCollection contents = new ContentCollection();

            if (contentNode != null && contentNode.HasChildNodes)
            {
                XmlNode node = null;
                if (textDocument.XmlDoc != contentNode.OwnerDocument)
                {
                    node = textDocument.XmlDoc.ImportNode(contentNode, true);
                }
                else
                {
                    node = contentNode;
                }
                MainContentProcessor mcp = new MainContentProcessor(textDocument);
                foreach (XmlNode nodeChild in node.ChildNodes)
                {
                    IContent iContent = mcp.CreateContent(nodeChild);
                    if (iContent != null)
                    {
                        if (iContent is AODL.Document.Content.Tables.Table)
                        {
                            ((AODL.Document.Content.Tables.Table)iContent).BuildNode();
                        }
                        contents.Add(iContent);
                    }
                }
            }
            return(contents);
        }
Example #6
0
        protected void Restore()
        {
            if (_zone != null)
            {
                ContentCollection cc = ZoneHelper.Contents(_zone);

                // Record restore object for each Content
                foreach (Content c in cc)
                {
                    c.RecordFloatingRestore();
                    c.Docked = true;
                }

                // Ensure each content is removed from any Parent
                foreach (Content c in cc)
                {
                    _dockingManager.HideContent(c, false, true);
                }

                // Now restore each of the Content
                foreach (Content c in cc)
                {
                    _dockingManager.ShowContent(c);
                }

                _dockingManager.UpdateInsideFill();
            }

            this.Close();
        }
        /// <summary>
        /// Initializes an instance of a ContentListControl.
        /// </summary>
        public ContentLayout()
        {
            _contentList = new ContentCollection();
            _contentList.CollectionChanged += OnContentListCollectionChanged;

            Loaded += OnLoaded;
        }
Example #8
0
        public Models.ContentCollection CreateContentCollection()
        {
            var result = new ContentCollection();

            this.context.Entry(result).State = System.Data.Entity.EntityState.Added;
            return(result);
        }
        /// <summary>
        /// Changes to shows collection are reflected in item source for shows listbox
        /// </summary>
        private void Contents_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (App.Current == null)
            {
                return;
            }

            if (contentLoaded && contentUpdated)
            {
                UpdateGenresComboBoxSafe();
            }

            // Invoke can result in dead-lock if another app thread if waiting for collection.ContentLock
            ContentCollection collection = sender as ContentCollection;

            if (App.Current.Dispatcher.CheckAccess())
            {
                UpdateContents(e, collection);
            }
            else
            {
                App.Current.Dispatcher.BeginInvoke((Action) delegate
                {
                    UpdateContents(e, collection);
                });
            }
        }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DrawArea"/> class.
 /// </summary>
 /// <param name="document">The document.</param>
 protected DrawArea(IDocument document)
 {
     Document          = document;
     Content           = new ContentCollection();
     Content.Inserted += Content_Inserted;
     Content.Removed  += Content_Removed;
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DrawTextBox"/> class.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <param name="node">The node.</param>
 public DrawTextBox(IDocument document, XElement node)
 {
     Document          = document;
     Content           = new ContentCollection();
     Content.Inserted += Content_Inserted;
     Content.Removed  += Content_Removed;
     Node              = node;
 }
Example #12
0
        public ProvisioningContainer(RoamingProfile profile)
        {
            if (profile == null)
                throw new ArgumentNullException("profile");

            this.profile = profile;
            Contents = new ContentCollection();
        }
Example #13
0
        public async Task <string> AddContentCollection(ContentCollection contentCollection)
        {
            contentCollection.Id = Guid.NewGuid().ToString();
            var projectId = contentCollection.ContentType.AppId;
            await _contentCollectionCommands.CreateAsync(projectId, contentCollection.Id, contentCollection);

            return(contentCollection.Id);
        }
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var scopedServiceProvider = scope.ServiceProvider;
                _logger.LogInformation($"Initializing AppText.Localization...");

                var applicationStore       = scopedServiceProvider.GetRequiredService <IApplicationStore>();
                var contentDefinitionStore = scopedServiceProvider.GetRequiredService <IContentDefinitionStore>();
                var contentStore           = scopedServiceProvider.GetRequiredService <IContentStore>();

                var translationsContentType = (await contentDefinitionStore.GetContentTypes(new ContentTypeQuery
                {
                    AppId = null,
                    IncludeGlobalContentTypes = true,
                    Name = TranslationConstants.TranslationContentType,
                })).FirstOrDefault();
                if (translationsContentType == null)
                {
                    throw new InvalidOperationException($"Cannot initialize AppText.Localization because it requires the global {TranslationConstants.TranslationContentType} content type, which could not be found");
                }

                // Ensure there is an app where the translations are stored
                var appId = _options.AppId;
                if (!await applicationStore.AppExists(appId))
                {
                    await applicationStore.AddApp(new App
                    {
                        Id              = appId,
                        DisplayName     = appId,
                        Languages       = new[] { Constants.DefaultDefaultLanguage },
                        DefaultLanguage = Constants.DefaultDefaultLanguage,
                        IsSystemApp     = true
                    });
                }

                // Ensure there is a collection for the translations
                var collection = (await contentStore.GetContentCollections(new ContentCollectionQuery
                {
                    AppId = appId,
                    Name = _options.CollectionName
                })).FirstOrDefault();

                if (collection == null)
                {
                    collection = new ContentCollection
                    {
                        ContentType      = translationsContentType,
                        Name             = _options.CollectionName,
                        ListDisplayField = TranslationConstants.TranslationTextFieldName,
                        Version          = 1
                    };
                    var contentCollectionSaveCommandHandler = scopedServiceProvider.GetRequiredService <ICommandHandler <SaveContentCollectionCommand> >();
                    await contentCollectionSaveCommandHandler.Handle(new SaveContentCollectionCommand(appId, collection));
                }
                _logger.LogInformation($"Finished initializing AppText.Localization.");
            }
        }
Example #15
0
        public async Task <IActionResult> FromResx(string appId, string language, string collection, [FromForm] IFormFile resxFile)
        {
            var translationContentType = (await _contentTypeQueryHandler
                                          .Handle(new ContentTypeQuery {
                AppId = null, Name = Constants.TranslationContentType, IncludeGlobalContentTypes = true
            }))
                                         .FirstOrDefault();

            if (translationContentType == null)
            {
                return(NotFound($"The {Constants.TranslationContentType} content type could not be found"));
            }

            var contentCollection = (await _contentCollectionQueryHandler
                                     .Handle(new ContentCollectionQuery {
                AppId = appId, Name = collection
            }))
                                    .FirstOrDefault();

            if (contentCollection == null)
            {
                contentCollection = new ContentCollection {
                    ContentType = translationContentType, Name = collection, ListDisplayField = Constants.TranslationTextFieldName
                };
                var newContentCollectionCommand = new SaveContentCollectionCommand(appId, contentCollection);
                await _saveContentCollectionCommand.Handle(newContentCollectionCommand);
            }

            // HACK: we need to change the reader and writer type names in the resHeaders to the ones of System.Resources.NetStandard.ResXResourceReader and -Writer
            var xdoc = XDocument.Load(resxFile.OpenReadStream());

            xdoc.Root
            .Elements("resheader")
            .First(rh => rh.Attribute("name").Value == "reader")
            .Element("value")
            .SetValue("System.Resources.NetStandard.ResXResourceReader, System.Resources.NetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
            xdoc.Root
            .Elements("resheader")
            .First(rh => rh.Attribute("name").Value == "writer")
            .Element("value")
            .SetValue("System.Resources.NetStandard.ResXResourceWriter, System.Resources.NetStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");

            var ms = new MemoryStream();

            xdoc.Save(ms);
            ms.Position = 0;
            var resxReader = new ResXResourceReader(ms);

            var translationsDictionary = new Dictionary <string, string>();

            foreach (DictionaryEntry entry in resxReader)
            {
                translationsDictionary.Add((string)entry.Key, (string)entry.Value);
            }
            await UpdateCollectionFromDictionary(appId, contentCollection.Id, language, translationsDictionary);

            return(Ok());
        }
Example #16
0
        /// <summary>
        /// Inits the standards.
        /// </summary>
        private void InitStandards()
        {
            //Todo: FrameBuilder
            AnchorType = "paragraph";

            Content           = new ContentCollection();
            Content.Inserted += Content_Inserted;
            Content.Removed  += Content_Removed;
        }
Example #17
0
        private void LoadArticle()
        {
            var action = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                ContentCollection.BeginLoad(LiPTT.CurrentArticle);
                ArticleHeader.DataContext        = LiPTT.CurrentArticle;
                SplitViewPaneContent.DataContext = LiPTT.CurrentArticle;

                ControlVisible = true;
            });
        }
Example #18
0
 private void InitBoard(PTTClient sender, LiPttEventArgs e)
 {
     if (e.State == PttState.Board)
     {
         LiPTT.PttEventEchoed -= InitBoard;
         var action = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             ContentCollection.BeginLoad();
         });
     }
 }
Example #19
0
 public void Dispose()
 {
     Response.Dispose();
     ContentCollection.Clear();
     AdsCollection.Clear();
     PricesCollection.Clear();
     LocationCollection.Clear();
     PublishingTimeCollection.Clear();
     IndividualAdsUrlsCollection.Clear();
     IndividualAdsNamesCollection.Clear();
 }
Example #20
0
        public override void PerformRestore(DockingManager dm)
        {
            // Create collection of Contents to auto hide
            ContentCollection cc = new ContentCollection();

            // In this case, there is only one
            cc.Add(_content);

            // Add to appropriate AutoHidePanel based on _state
            dm.AutoHideContents(cc, _state);
        }
Example #21
0
        protected ODFFormControl(ODFForm ParentForm, XmlNode node)
        {
            _document   = ParentForm.Document;
            _parentForm = ParentForm;
            Node        = node;

            _contentCollection = null;
            _controlRef        = null;

            _properties           = new FormPropertyCollection();
            _properties.Inserted += PropertyCollection_Inserted;
            _properties.Removed  += PropertyCollection_Removed;
        }
Example #22
0
        protected ODFFormControl(ODFForm parentForm, XElement node)
        {
            _document  = parentForm.Document;
            ParentForm = parentForm;
            Node       = node;

            _contentCollection = null;
            _controlRef        = null;

            Properties           = new FormPropertyCollection();
            Properties.Inserted += PropertyCollection_Inserted;
            Properties.Removed  += PropertyCollection_Removed;
        }
        /// <summary>
        /// Loading complete of shows load them into shows listbox
        /// </summary>
        private void Content_LoadComplete(object sender, EventArgs e)
        {
            ContentCollection contentCollection = (ContentCollection)sender;

            if (contentCollection.ContentType != this.contentType)
            {
                return;
            }

            contentLoaded = true;
            UpdateGenresComboBoxSafe();
            UpdateProgressSafe(100, "Loading complete!", true);
        }
Example #24
0
        protected override void OnClosing(CancelEventArgs e)
        {
            if (_zone != null)
            {
                ContentCollection cc = ZoneHelper.Contents(_zone);

                // Record restore object for each Content
                foreach (Content c in cc)
                {
                    c.RecordRestore();
                }

                // Ensure each content is removed from any Parent
                foreach (Content c in cc)
                {
                    // Is content allowed to be hidden?
                    if (!_dockingManager.OnContentHiding(c))
                    {
                        // Hide the content always
                        _dockingManager.HideContent(c, false, true);

                        // Do we also remove the content?
                        if (c.CloseOnHide)
                        {
                            // Remove the content from the collection
                            _dockingManager.Contents.Remove(c);

                            // Dispose of the contained control/form
                            if (c.Control != null)
                            {
                                c.Control.Dispose();
                            }
                        }
                    }
                    else
                    {
                        // At least one Content refuses to die, so do not
                        // let the whole floating form be closed down
                        e.Cancel = true;
                    }
                }
            }

            // Must set focus back to the main application Window
            if (this.Owner != null)
            {
                this.Owner.Activate();
            }

            base.OnClosing(e);
        }
Example #25
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     ContentCollection.LoadContent(Content);
     // Create a new SpriteBatch, which can be used to draw textures.
     menuState        = new MenuState(this, graphics.GraphicsDevice, Content);
     leaderboardState = new LeaderboardState(this, graphics.GraphicsDevice, Content);
     spriteBatch      = new SpriteBatch(GraphicsDevice);
     font             = ContentCollection.font;
     song             = ContentCollection.song;
     MediaPlayer.Play(song);
     MediaPlayer.Volume      = 0.1f;
     MediaPlayer.IsRepeating = true;
     // TODO: use this.Content to load your game content here
 }
Example #26
0
        public void ExitFloating()
        {
            if (_zone != null)
            {
                ContentCollection cc = ZoneHelper.Contents(_zone);

                // Record restore object for each Content
                foreach (Content c in cc)
                {
                    c.RecordFloatingRestore();
                    c.Docked = true;
                }
            }
        }
Example #27
0
        protected ODFFormControl(ODFForm ParentForm, ContentCollection contentCollection, string id, string x, string y, string width, string height)         //: base (document, ContentCollection, id, x, y, width, height)
        {
            _document          = ParentForm.Document;
            _parentForm        = ParentForm;
            Node               = ParentForm.Node;
            _contentCollection = contentCollection;
            CreateBasicNode();
            ID          = id;
            _controlRef = new ODFControlRef(_document, id, x, y, width, height);

            _properties           = new FormPropertyCollection();
            _properties.Inserted += PropertyCollection_Inserted;
            _properties.Removed  += PropertyCollection_Removed;
        }
Example #28
0
        protected override void OnMove(EventArgs e)
        {
            Point newPos = this.Location;

            // Grab the aggregate collection of all Content objects in the Zone
            ContentCollection cc = ZoneHelper.Contents(_zone);

            // Update each one with the new FloatingForm location
            foreach (Content c in cc)
            {
                c.DisplayLocation = newPos;
            }

            base.OnMove(e);
        }
Example #29
0
        protected ODFFormControl(ODFForm parentForm, ContentCollection contentCollection, string id)
        {
            _document          = parentForm.Document;
            ParentForm         = parentForm;
            Node               = parentForm.Node;
            _contentCollection = contentCollection;
            CreateBasicNode();
            Id = id;
            ControlImplementation = "ooo:com.sun.star.form.component.TextField";
            _controlRef           = new ODFControlRef(_document, id);

            Properties           = new FormPropertyCollection();
            Properties.Inserted += PropertyCollection_Inserted;
            Properties.Removed  += PropertyCollection_Removed;
        }
Example #30
0
        public WindowContent(DockingManager manager, VisualStyle vs)
            : base(manager)
        {
            // Remember state
            _style = vs;

            // Create collection of window details
            _contents = new ContentCollection();

            // We want notification when contents are added/removed/cleared
            _contents.Clearing += new CollectionClear(OnContentsClearing);
            _contents.Inserted += new CollectionChange(OnContentInserted);
            _contents.Removing += new CollectionChange(OnContentRemoving);
            _contents.Removed  += new CollectionChange(OnContentRemoved);
        }
Example #31
0
        /// <summary>
        /// create the chart series
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private IContent CreateChartSeries(XElement node)
        {
            try
            {
                ChartSeries series = new ChartSeries(Chart.Document, node)
                {
                    Chart = Chart
                };

                ChartStyleProcessor csp       = new ChartStyleProcessor(Chart);
                XElement            nodeStyle = csp.ReadStyleNode(series.StyleName);
                IStyle            style       = csp.ReadStyle(nodeStyle, "series");
                ContentCollection iColl       = new ContentCollection();

                if (style != null)
                {
                    series.Style = style;
                    Chart.Styles.Add(style);
                }

                foreach (XElement nodeChild in series.Node.Elements())
                {
                    IContent icontent = CreateContent(nodeChild);

                    if (icontent != null)
                    {
                        AddToCollection(icontent, iColl);
                    }
                }

                series.Node.Value = "";

                foreach (IContent iContent in iColl)
                {
                    if (iContent is ChartDataPoint)
                    {
                        series.DataPointCollection.Add(iContent as ChartDataPoint);
                    }
                }

                return(series);
            }

            catch (Exception ex)
            {
                throw new AODLException("Exception while creating the chart series!", ex);
            }
        }
Example #32
0
        protected override void OnResize(System.EventArgs e)
        {
            // Grab the aggregate collection of all Content objects in the Zone
            ContentCollection cc = ZoneHelper.Contents(_zone);

            // Do not include the caption height of the tool window in the saved height
            Size newSize = new Size(this.Width, this.Height - SystemInformation.ToolWindowCaptionHeight);

            // Update each one with the new FloatingForm location
            foreach (Content c in cc)
            {
                c.FloatingSize = newSize;
            }

            base.OnResize(e);
        }
		/// <summary>
		/// Convert a AODL IContentCollection into an ArrayList of IElement iText objects.
		/// </summary>
		/// <param name="iContentCollection">The i content collection.</param>
		/// <returns>An ArrayList of iText IElement objects.</returns>
		public static ArrayList GetMixedPdfContent(ContentCollection iContentCollection)
		{
			ArrayList mixedPdfContent = new ArrayList();
			foreach(IContent content in iContentCollection)
			{
				if (content is AODL.Document.Content.Text.Paragraph)
				{
					if (((AODL.Document.Content.Text.Paragraph)content).MixedContent != null
					    && ((AODL.Document.Content.Text.Paragraph)content).MixedContent.Count > 0)
						mixedPdfContent.Add(ParagraphConverter.Convert(
							content as AODL.Document.Content.Text.Paragraph));
					else
						mixedPdfContent.Add(iTextSharp.text.Chunk.NEWLINE);
				}
				else if (content is AODL.Document.Content.Text.Header)
				{
					mixedPdfContent.Add(HeadingConverter.Convert(
						content as AODL.Document.Content.Text.Header));
				}
				else if (content is AODL.Document.Content.Tables.Table)
				{
					TableConverter tc = new TableConverter();
					mixedPdfContent.Add(tc.Convert(
						content as AODL.Document.Content.Tables.Table));
				}
				else if (content is AODL.Document.Content.Draw.Frame)
				{
					DrawFrameConverter dfc = new DrawFrameConverter();
					mixedPdfContent.Add(dfc.Convert(
						content as AODL.Document.Content.Draw.Frame));
				}
				else if (content is AODL.Document.Content.Draw.Graphic)
				{
					ImageConverter ic = new ImageConverter();
					mixedPdfContent.Add(ic.Convert(
						content as AODL.Document.Content.Draw.Graphic));
				}
			}
			return mixedPdfContent;
		}
		private void AddToCollection(IContent content, ContentCollection coll)
		{
			coll.Add(content);

			if (content is ODFControlRef)
			{
				ODFControlRef ctrlRef = content as ODFControlRef;
				if (this._document is TextDocument)
				{
					
					TextDocument td = this._document as TextDocument;
					ODFFormControl fc = td.FindControlById(ctrlRef.DrawControl);
					
					if (fc != null)
					{
						fc.ContentCollection = coll;
						fc.ControlRef = ctrlRef;
					}

				}
			}
		}
Example #35
0
		public ContentCollection CloneContentCollection(ContentCollection contentCollection)
		{
			ContentCollection clonedContent = new ContentCollection();
			
			int index = 0;
			foreach (IContent content in contentCollection)
			{
				index ++;
				try
				{
					clonedContent.Add(CloneAny(content));
				}
				catch (ContentMockerException e)
				{
					throw new ContentMockerException(string.Format(
						"Could not clone element {0} in given collection. Item " +
						" index was {1}",
						content.Node.Value,
						index), e);
				}
			}
			return clonedContent;
		}
		/// <summary>
		/// Creates the event listeners.
		/// </summary>
		/// <param name="eventListenersNode">The event listeners node.</param>
		/// <returns></returns>
		public EventListeners CreateEventListeners(XmlNode eventListenersNode)
		{
			try
			{
				EventListeners eventList	= new EventListeners(this._document, eventListenersNode);
				ContentCollection iCol		= new ContentCollection();

				if (eventList.Node != null)
					foreach(XmlNode nodeChild in eventList.Node.ChildNodes)
				{
					IContent iContent	= this.CreateContent(nodeChild);
					if (iContent != null)
						AddToCollection(iContent,iCol);
					//iCol.Add(iContent);
				}

				eventList.Node.InnerXml		= "";

				foreach(IContent iContent in iCol)
					AddToCollection(iContent, eventList.Content);
				//eventList.Content.Add(iContent);

				return eventList;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a ImageMap.", ex);
			}
		}
		/// <summary>
		/// Creates the image map.
		/// </summary>
		/// <param name="imageMapNode">The image map node.</param>
		/// <returns></returns>
		private ImageMap CreateImageMap(XmlNode imageMapNode)
		{
			try
			{
				ImageMap imageMap			= new ImageMap(this._document, imageMapNode);
				ContentCollection iCol		= new ContentCollection();

				if (imageMap.Node != null)
					foreach(XmlNode nodeChild in imageMap.Node.ChildNodes)
				{
					IContent iContent	= this.CreateContent(nodeChild);
					if (iContent != null)
						AddToCollection(iContent, iCol);
					//iCol.Add(iContent);
				}

				imageMap.Node.InnerXml		= "";

				foreach(IContent iContent in iCol)
					AddToCollection(iContent, imageMap.Content);
				//imageMap.Content.Add(iContent);

				return imageMap;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a ImageMap.", ex);
			}
		}
		/// <summary>
		/// Creates the draw area circle.
		/// </summary>
		/// <param name="drawAreaCircleNode">The draw area circle node.</param>
		/// <returns></returns>
		private DrawAreaCircle CreateDrawAreaCircle(XmlNode drawAreaCircleNode)
		{
			try
			{
				DrawAreaCircle dAreaCirc	= new DrawAreaCircle(this._document, drawAreaCircleNode);
				ContentCollection iCol		= new ContentCollection();

				if (dAreaCirc.Node != null)
					foreach(XmlNode nodeChild in dAreaCirc.Node.ChildNodes)
				{
					IContent iContent	= this.CreateContent(nodeChild);
					if (iContent != null)
						AddToCollection(iContent, iCol);
					//iCol.Add(iContent);
				}

				dAreaCirc.Node.InnerXml		= "";

				foreach(IContent iContent in iCol)
					AddToCollection(iContent, dAreaCirc.Content);
				//dAreaCirc.Content.Add(iContent);

				return dAreaCirc;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a DrawAreaCircle.", ex);
			}
		}
		/// <summary>
		/// Creates the draw text box.
		/// </summary>
		/// <param name="drawTextBoxNode">The draw text box node.</param>
		/// <returns></returns>
		private DrawTextBox CreateDrawTextBox(XmlNode drawTextBoxNode)
		{
			try
			{
				DrawTextBox drawTextBox		= new DrawTextBox(this._document, drawTextBoxNode);
				ContentCollection iColl	= new ContentCollection();

				foreach(XmlNode nodeChild in drawTextBox.Node.ChildNodes)
				{
					IContent iContent				= this.CreateContent(nodeChild);
					if (iContent != null)
						//iColl.Add(iContent);
						AddToCollection(iContent, iColl);
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create a IContent object for a DrawTextBox.", nodeChild));
					}
				}

				drawTextBox.Node.InnerXml					= "";

				foreach(IContent iContent in iColl)
					AddToCollection(iContent, drawTextBox.Content);
				//drawTextBox.Content.Add(iContent);

				return drawTextBox;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Graphic.", ex);
			}
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="TextPageFooter"/> class.
		/// </summary>
		protected TextPageHeaderFooterBase()
		{
			this._contentCollection = new ContentCollection();
			this._contentCollection.Inserted += _contentCollection_Inserted;
			this._contentCollection.Removed += _contentCollection_Removed;
		}
		/// <summary>
		/// Creates an ODFRadioButton
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		/// <param name="x">X coordinate of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="y">Y coordinate of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="width">Width of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="height">Height of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		public ODFRadioButton(ODFForm ParentForm, ContentCollection contentCollection, string id, string x, string y, string width, string height): base (ParentForm, contentCollection, id, x, y, width, height)
		{}
		/// <summary>
		/// Creates an ODFValueRange
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		/// <param name="x">X coordinate of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="y">Y coordinate of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="width">Width of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="height">Height of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		public ODFValueRange(ODFForm ParentForm, ContentCollection contentCollection, string id, string x, string y, string width, string height): base (ParentForm, contentCollection, id, x, y, width, height)
		{}
		/// <summary>
		/// Creates an ODFHidden
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		public ODFHidden(ODFForm ParentForm, ContentCollection contentCollection, string id): base (ParentForm, contentCollection, id)
		{}
		/// <summary>
		/// Creates the table.
		/// </summary>
		/// <param name="tableNode">The tablenode.</param>
		/// <returns></returns>
		private Table CreateTable(XmlNode tableNode)
		{
			try
			{
				//Create a new table
				Table table					= new Table(this._document, tableNode);
				ContentCollection iColl	= new ContentCollection();
				//Recieve the table style
				IStyle tableStyle		= this._document.Styles.GetStyleByName(table.StyleName);

				if (tableStyle != null)
					table.Style				= tableStyle;
				else
				{
					this.OnWarning(new AODLWarning("Couldn't recieve a TableStyle.", tableNode));
				}
				
				

				//Create the table content
				foreach(XmlNode nodeChild in table.Node.ChildNodes)
				{
					IContent iContent				= this.CreateContent(nodeChild);
					
					if (iContent != null)
					{
						//iColl.Add(iContent);
						AddToCollection(iContent, iColl);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a table node. Content is unknown table content!", iContent.Node));
					}
				}

				table.Node.InnerText					= "";

				foreach(IContent iContent in iColl)
				{
					if (iContent is Column)
					{
						((Column)iContent).Table	= table;
						table.ColumnCollection.Add(iContent as Column);
					}
					else if (iContent is Row)
					{
						((Row)iContent).Table		= table;
						table.Rows.Add(iContent as Row);
					}
					else if (iContent is RowHeader)
					{
						((RowHeader)iContent).Table	= table;
						table.RowHeader			= iContent as RowHeader;
					}
					else
					{
						table.Node.AppendChild(iContent.Node);
						this.OnWarning(new AODLWarning("Couldn't create IContent from a table node.", tableNode));
					}
				}
				
				return table;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Table.", ex);
			}
		}
		/// <summary>
		/// Creates the list.
		/// </summary>
		/// <param name="listNode">The list node.</param>
		/// <returns>The List object</returns>
		private List CreateList(XmlNode listNode)
		{
			try
			{
				#region Old code Todo: delete
				//				string stylename				= null;
				//				XmlNode	stylenode				= null;
				//				ListStyles liststyles			= ListStyles.Bullet; //as default
				//				string paragraphstylename		= null;
				//
				//				if (outerlist == null)
				//				{
				//					stylename			= this.GetStyleName(listNode.OuterXml);
				//					stylenode			= this.GetAStyleNode("text:list-style", stylename);
				//					liststyles			= this.GetListStyle(listNode);
				//				}
				//				List list					= null;
				//
				//				if (listNode.ChildNodes.Count > 0)
				//				{
				//					try
				//					{
				//						paragraphstylename	= this.GetAValueFromAnAttribute(listNode.ChildNodes.Item(0).ChildNodes.Item(0), "@style:style-name");
				//					}
				//					catch(Exception ex)
				//					{
				//						paragraphstylename	= "P1";
				//					}
				//				}
				#endregion
				//Create a new List
				List list					= new List(this._document, listNode);
				ContentCollection iColl	= new ContentCollection();
				//Revieve the ListStyle
				IStyle listStyle			= this._document.Styles.GetStyleByName(list.StyleName);

				if (listStyle != null)
					list.Style				= listStyle;

				foreach(XmlNode nodeChild in list.Node.ChildNodes)
				{
					IContent iContent		= this.CreateContent(nodeChild);

					if (iContent != null)
						AddToCollection(iContent, iColl);
					//iColl.Add(iContent);
				}

				list.Node.InnerXml			= "";

				foreach(IContent iContent in iColl)
					AddToCollection(iContent, list.Content);
				//list.Content.Add(iContent);
				
				return list;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a List.", ex);
			}
		}
Example #46
0
		/// <summary>
		/// Creates an ODFGrid
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		public ODFGrid(ODFForm ParentForm, ContentCollection contentCollection, string id): base (ParentForm, contentCollection, id)
		{
			_columns = new ODFGridColumnCollection();
			RestoreColumnEvents();
		}
		/// <summary>
		/// Appends the HTML.
		/// </summary>
		/// <param name="contentlist">The contentlist.</param>
		/// <param name="template">The template.</param>
		/// <returns>The filled template string</returns>
		private string AppendHtml(ContentCollection contentlist, string template)
		{
			try
			{
				HTMLContentBuilder htmlContentBuilder	= new HTMLContentBuilder();
				htmlContentBuilder.GraphicTargetFolder	= this._imgFolder;
				string htmlBody							= htmlContentBuilder.GetIContentCollectionAsHtml(this._document.Content);
				template								+= htmlBody;

				template		+= "</body>\n</html>";

				template		= this.SetMetaContent(template);
				
				return template;
			}
			catch(Exception)
			{
				throw;
			}
		}
		/// <summary>
		/// Creates the frame.
		/// </summary>
		/// <param name="frameNode">The framenode.</param>
		/// <returns>The Frame object.</returns>
		public Frame CreateFrame(XmlNode frameNode)
		{
			try
			{
				#region Old code Todo: delete
				//				Frame frame					= null;
				//				XmlNode graphicnode			= null;
				//				XmlNode graphicproperties	= null;
				//				string realgraphicname		= "";
				//				string stylename			= "";
				//				stylename					= this.GetStyleName(framenode.OuterXml);
				//				XmlNode stylenode			= this.GetAStyleNode("style:style", stylename);
				//				realgraphicname				= this.GetAValueFromAnAttribute(framenode, "@draw:name");
				//
				//				//Console.WriteLine("frame: {0}", framenode.OuterXml);
				//
				//				//Up to now, the only sopported, inner content of a frame is a graphic
				//				if (framenode.ChildNodes.Count > 0)
				//					if (framenode.ChildNodes.Item(0).OuterXml.StartsWith("<draw:image"))
				//						graphicnode			= framenode.ChildNodes.Item(0).CloneNode(true);
				//
				//				//If not graphic, it could be text-box, ole or something else
				//				//try to find graphic frame inside
				//				if (graphicnode == null)
				//				{
				//					XmlNode child		= framenode.SelectSingleNode("//draw:frame", this._document.NamespaceManager);
				//					if (child != null)
				//						frame		= this.CreateFrame(child);
				//					return frame;
				//				}
				//
				//				string graphicpath			= this.GetAValueFromAnAttribute(graphicnode, "@xlink:href");
				//
				//				if (stylenode != null)
				//					if (stylenode.ChildNodes.Count > 0)
				//						if (stylenode.ChildNodes.Item(0).OuterXml.StartsWith("<style:graphic-properties"))
				//							graphicproperties	= stylenode.ChildNodes.Item(0).CloneNode(true);
				//
				//				if (stylename.Length > 0 && stylenode != null && realgraphicname.Length > 0
				//					&& graphicnode != null && graphicpath.Length > 0 && graphicproperties != null)
				//				{
				//					graphicpath				= graphicpath.Replace("Pictures", "");
                //					graphicpath				= OpenDocumentTextImporter.dirpics+graphicpath.Replace('/', Path.DirectorySeparatorChar);
				//
				//					frame					= new Frame(this._document, stylename,
				//												realgraphicname, graphicpath);
				//
				//					frame.Style.Node		= stylenode;
				//					frame.Graphic.Node		= graphicnode;
				//					((FrameStyle)frame.Style).GraphicProperties.Node = graphicproperties;
				//
				//					XmlNode nodeSize		= framenode.SelectSingleNode("@svg:height",
				//						this._document.NamespaceManager);
				//
				//					if (nodeSize != null)
				//						if (nodeSize.InnerText != null)
				//							frame.GraphicHeight	= nodeSize.InnerText;
				//
				//					nodeSize		= framenode.SelectSingleNode("@svg:width",
				//						this._document.NamespaceManager);
				//
				//					if (nodeSize != null)
				//						if (nodeSize.InnerText != null)
				//							frame.GraphicWidth	= nodeSize.InnerText;
				//				}
				#endregion
				
				//Create a new Frame
				Frame frame					= new Frame(this._document, null);
				frame.Node					= frameNode;
				ContentCollection iColl	= new ContentCollection();
				//Revieve the FrameStyle
				IStyle frameStyle			= this._document.Styles.GetStyleByName(frame.StyleName);

				if (frameStyle != null)
					frame.Style					= frameStyle;
				else
				{
					this.OnWarning(new AODLWarning("Couldn't recieve a FrameStyle.", frameNode));
				}

				//Create the frame content
				foreach(XmlNode nodeChild in frame.Node.ChildNodes)
				{
					IContent iContent				= this.CreateContent(nodeChild);
					if (iContent != null)
						AddToCollection(iContent, iColl);
					//iColl.Add(iContent);
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create a IContent object for a frame.", nodeChild));
					}
				}

				frame.Node.InnerXml					= "";

				foreach(IContent iContent in iColl)
				{
					AddToCollection(iContent, frame.Content);
					//frame.Content.Add(iContent);
					if (iContent is Graphic)
					{
						LoadFrameGraphic(frame, iContent as Graphic);
					}

					if (iContent is EmbedObject)
					{
						//(EmbedObject(iContent)).Frame  =frame;
						(iContent as EmbedObject).Frame = frame;
					}
				}
				return frame;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Frame.", ex);
			}
		}
Example #49
0
		/// <summary>
		/// Creates an ODFGrid
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		/// <param name="x">X coordinate of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="y">Y coordinate of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="width">Width of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		/// <param name="height">Height of the control in ODF format (eg. "1cm", "15mm", 3.2cm" etc)</param>
		public ODFGrid(ODFForm ParentForm, ContentCollection contentCollection, string id, string x, string y, string width, string height): base (ParentForm, contentCollection, id, x, y, width, height)
		{
			_columns = new ODFGridColumnCollection();
			RestoreColumnEvents();
		}
		/// <summary>
		/// Creates an ODFValueRange
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		public ODFValueRange(ODFForm ParentForm, ContentCollection contentCollection, string id): base (ParentForm, contentCollection, id)
		{}
		/// <summary>
		/// Creates the list item.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns></returns>
		private ListItem CreateListItem(XmlNode node)
		{
			try
			{

				ListItem listItem			= new ListItem(this._document);
				ContentCollection iColl	= new ContentCollection();
				listItem.Node				= node;

				foreach(XmlNode nodeChild in listItem.Node.ChildNodes)
				{
					IContent iContent		= this.CreateContent(nodeChild);
					if (iContent != null)
						AddToCollection(iContent, iColl);
					//iColl.Add(iContent);
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create a IContent object for a ListItem.", nodeChild));
					}
				}

				listItem.Node.InnerXml		= "";

				foreach(IContent iContent in iColl)
					//listItem.Content.Add(iContent);
					AddToCollection(iContent,listItem.Content);

				return listItem;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a ListItem.", ex);
			}
		}
		/// <summary>
		/// Gets the I content collection as HTML.
		/// </summary>
		/// <param name="iContentCollection">The i content collection.</param>
		/// <returns></returns>
		public string GetIContentCollectionAsHtml(ContentCollection iContentCollection)
		{
			string html					= "";

			try
			{
				if (iContentCollection != null)
				{
					foreach(IContent iContent in iContentCollection)
					{
						//determine type
						if (iContent is Table)
							html			+= this.GetTableAsHtml(iContent as Table);
						else if (iContent is ODFControlRef)
							html			+= this.GetODFControlAsHtml(iContent as ODFControlRef);
						else if (iContent is Field)
							html			+= this.GetFieldAsHtml(iContent as Field);
						else if (iContent is Paragraph)
							html			+= this.GetParagraphAsHtml(iContent as Paragraph);
						else if (iContent is List)
							html			+= this.GetListAsHtml(iContent as List);
						else if (iContent is Frame)
							html			+= this.GetDrawFrameAsHtml(iContent as Frame);
						else if (iContent is DrawTextBox)
							html			+= this.GetDrawTextBoxAsHtml(iContent as DrawTextBox);
						else if (iContent is Graphic)
							html			+= this.GetGraphicAsHtml(iContent as Graphic);
						else if (iContent is ListItem)
							html			+= this.GetListItemAsHtml(iContent as ListItem);
						else if (iContent is Header)
							html			+= this.GetHeadingAsHtml(iContent as Header);
						else if (iContent is TableOfContents)
							html			+= this.GetTableOfContentsAsHtml(iContent as TableOfContents);
						else if (iContent is UnknownContent)
							html			+= this.GetUnknowContentAsHtml(iContent as UnknownContent);
						else if (iContent is ImageMap)
							html			+= this.GetImageMapAsHtml(iContent as ImageMap);
						else if (iContent is DrawArea)
							html			+= this.GetDrawAreaAsHtml(iContent as DrawArea);
						else
							//this should never happens, because all not implemented elements 
							//are unknwon content
							if (OnWarning != null)
						{
							AODLWarning warning			= new AODLWarning("Finding total unknown content. This should (could) never happen.");
							//warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
							OnWarning(warning);
						}
					}
				}
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to build a HTML string from an IContentCollection.", ex);
			}

			return html;
		}
        private void UpdateContents(System.Collections.Specialized.NotifyCollectionChangedEventArgs e, ContentCollection collection)
        {
            lock (collection.ContentLock)
            {
                if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
                {
                    Contents.Clear();
                    contentViewModels.Clear();
                }

                if (e.OldItems != null)
                    foreach (Content remItem in e.OldItems)
                    {
                        Contents.Remove(remItem);
                        contentViewModels.Remove(remItem);
                    }
                if (e.NewItems != null)
                    foreach (Content addItem in e.NewItems)
                    {
                        Contents.Add(addItem);
                        //contentViewModels.Add(addItem, new ContentControlViewModel(addItem));
                    }
            }
        }
		/// <summary>
		/// Creates the table row.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns></returns>
		private Row CreateTableRow(XmlNode node)
		{
			try
			{
				//Create a new Row
				Row row						= new Row(this._document, node);
				ContentCollection iColl	= new ContentCollection();
				//Recieve RowStyle
				IStyle rowStyle				= this._document.Styles.GetStyleByName(row.StyleName);

				if (rowStyle != null)
					row.Style				= rowStyle;
				//No need for a warning

				//Create the cells
				foreach(XmlNode nodeChild in row.Node.ChildNodes)
				{
					// Phil Jollans 24-March-2008
					// Handle the attribute table:number-columns-repeated on cell nodes,
					// by inserting multiple nodes. CreateContent clones the nodes so this
					// seems fairly safe.
					int     iRepeatCount = 1;
					XmlNode xn           = nodeChild.SelectSingleNode ( "@table:number-columns-repeated", this._document.NamespaceManager );
					if ( xn != null )
					{
						iRepeatCount = int.Parse ( xn.InnerText );
						
						// Inetrnally, the node is no longer repeated, so it seems correct
						// to remove the the attribute table:number-columns-repeated.
						nodeChild.Attributes.RemoveNamedItem ( xn.Name ) ;
					}
					
					for ( int i = 0 ; i < iRepeatCount ; i++ )
					{
						IContent iContent		= this.CreateContent(nodeChild);

						if (iContent != null)
						{
							//iColl.Add(iContent);
							AddToCollection(iContent, iColl);
						}
						else
						{
							this.OnWarning(new AODLWarning("Couldn't create IContent from a table row.", nodeChild));
						}
					}
				}

				row.Node.InnerXml			= "";

				foreach(IContent iContent in iColl)
				{
					if (iContent is Cell)
					{
						((Cell)iContent).Row		= row;
						row.Cells.Add(iContent as Cell);
					}
					else if (iContent is CellSpan)
					{
						((CellSpan)iContent).Row	= row;
						row.CellSpanCollection.Add(iContent as CellSpan);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a row node. Content is unknown table row content!", iContent.Node));
					}
				}

				return row;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Table Row.", ex);
			}
		}
Example #55
0
		/// <summary>
		/// Creates an ODFCheckBox
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		public ODFCheckBox(ODFForm ParentForm, ContentCollection contentCollection, string id): base (ParentForm, contentCollection, id)
		{}
		/// <summary>
		/// Creates the table header row.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns></returns>
		private RowHeader CreateTableHeaderRow(XmlNode node)
		{
			try
			{
				//Create a new Row
				RowHeader rowHeader			= new RowHeader(this._document, node);
				ContentCollection iColl	= new ContentCollection();
				//Recieve RowStyle
				IStyle rowStyle				= this._document.Styles.GetStyleByName(rowHeader.StyleName);

				if (rowStyle != null)
					rowHeader.Style				= rowStyle;
				//No need for a warning

				//Create the cells
				foreach(XmlNode nodeChild in rowHeader.Node.ChildNodes)
				{
					IContent iContent			= this.CreateContent(nodeChild);

					if (iContent != null)
					{
						//iColl.Add(iContent);
						AddToCollection(iContent, iColl);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a table row.", nodeChild));
					}
				}

				rowHeader.Node.InnerXml			= "";

				foreach(IContent iContent in iColl)
				{
					if (iContent is Row)
					{
						rowHeader.RowCollection.Add(iContent as Row);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a row header node. Content is unknown table row header content!", iContent.Node));
					}
				}
				return rowHeader;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Table Row.", ex);
			}
		}
		/// <summary>
		/// Creates an ODFRadioButton
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		public ODFRadioButton(ODFForm ParentForm, ContentCollection contentCollection, string id): base (ParentForm, contentCollection, id)
		{}
		/// <summary>
		/// Creates the table cell.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns></returns>
		private Cell CreateTableCell(XmlNode node)
		{
			try
			{
				//Create a new Cel
				Cell cell					= new Cell(this._document, node);
				ContentCollection iColl	= new ContentCollection();
				//Recieve CellStyle
				IStyle cellStyle			= this._document.Styles.GetStyleByName(cell.StyleName);

				if (cellStyle != null)
				{
					cell.Style				= cellStyle;
				}
				//No need for a warning

				//Create the cells content
				foreach(XmlNode nodeChild in cell.Node.ChildNodes)
				{
					IContent iContent		= this.CreateContent(nodeChild);

					if (iContent != null)
					{
						//iColl.Add(iContent);
						AddToCollection(iContent, iColl);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a table cell.", nodeChild));
					}
				}

				cell.Node.InnerXml			= "";

				foreach(IContent iContent in iColl)
					AddToCollection(iContent,cell.Content);
				//cell.Content.Add(iContent);
				return cell;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Table Row.", ex);
			}
		}
Example #59
0
		/// <summary>
		/// Creates an ODFTextArea
		/// </summary>
		/// <param name="ParentForm">Parent form that the control belongs to</param>
		/// <param name="contentCollection">Collection of content where the control will be referenced</param>
		/// <param name="id">Control ID. Please specify a unique ID!</param>
		public ODFTextArea(ODFForm ParentForm, ContentCollection contentCollection, string id): base (ParentForm, contentCollection, id)
		{}
		/// <summary>
		/// Creates the table of contents.
		/// </summary>
		/// <param name="tocNode">The toc node.</param>
		/// <returns></returns>
		private TableOfContents CreateTableOfContents(XmlNode tocNode)
		{
			try
			{
				if (this._document is TextDocument)
				{
					//Create the TableOfContents object
					TableOfContents tableOfContents		= new TableOfContents(
						((TextDocument)this._document), tocNode);
					//Recieve the Section style
					IStyle sectionStyle					= this._document.Styles.GetStyleByName(tableOfContents.StyleName);

					if (sectionStyle != null)
						tableOfContents.Style				= sectionStyle;
					else
					{
						OnWarning(new AODLWarning("A SectionStyle for the TableOfContents object wasn't found.", tocNode));
					}
					
					//Create the text entries
					XmlNodeList paragraphNodeList	= tocNode.SelectNodes(
						"text:index-body/text:p", this._document.NamespaceManager);
					XmlNode indexBodyNode			= tocNode.SelectSingleNode("text:index-body",
					                                                   this._document.NamespaceManager);
					tableOfContents.IndexBodyNode	= indexBodyNode;
					ContentCollection pCollection	= new ContentCollection();

					foreach(XmlNode paragraphnode in paragraphNodeList)
					{
						Paragraph paragraph			= this.CreateParagraph(paragraphnode);
						if (indexBodyNode != null)
							indexBodyNode.RemoveChild(paragraphnode);
						//pCollection.Add(paragraph);
						AddToCollection(paragraph, pCollection);
					}

					foreach(IContent content in pCollection)
						AddToCollection(content, tableOfContents.Content);
					//tableOfContents.Content.Add(content);

					return tableOfContents;
				}

				return null;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a TableOfContents.", ex);
			}
		}