Exemplo n.º 1
0
        // -------------------------------------------------------------

        public HtmlReportBuilder(TaskList tasks, HtmlReportTemplate template, Preferences prefs)
        {
            m_Tasklist = tasks;
            m_Template = template;

            var defFontName = prefs.GetProfileString("Preferences", "HTMLFont", "Verdana");
            var defFontSize = prefs.GetProfileInt("Preferences", "HtmlFontSize", 2);

            m_DefaultFontStyle = String.Format("html {{ font-family: {0}; font-size: {1}; }}", defFontName, defFontSize);

            m_StrikeThruDone = prefs.GetProfileBool("Preferences", "StrikethroughDone", true);

            if (prefs.GetProfileBool("Preferences", "UseSpaceIndents", true))
            {
                int nSpace = prefs.GetProfileInt("Preferences", "TextIndent", 2);

                while (nSpace-- > 0)
                {
                    m_Indent = (m_Indent + Space);
                }
            }
            else
            {
                m_Indent = Tab;
            }
        }
Exemplo n.º 2
0
        // --------------------------------------------------------------

        public HtmlReportTemplateForm(String typeId, Translator trans, TaskList tasks, Preferences prefs, String key)
        {
            m_TypeId   = typeId;
            m_Trans    = trans;
            m_Tasklist = tasks;
            m_Prefs    = prefs;
            m_PrefsKey = key;

            m_Template         = new HtmlReportTemplate();
            m_PrevTemplate     = new HtmlReportTemplate();
            m_CustomAttributes = new Dictionary <String, String>();

            m_EditedSinceLastSave = false;
            m_TemplateFilePath    = prefs.GetProfileString(key, "LastOpenTemplate", "");

            if (!m_Template.Load(m_TemplateFilePath))
            {
                m_TemplateFilePath = String.Empty;
            }
            else
            {
                m_PrevTemplate.Copy(m_Template);
            }

            m_ChangeTimer          = new Timer();
            m_ChangeTimer.Tick    += new EventHandler(OnChangeTimer);
            m_ChangeTimer.Interval = 500;

            InitializeComponent();

            // Build list custom attribute IDs for later use
            if (tasks.HasCustomAttributes())
            {
                var numAttrib = tasks.GetCustomAttributeCount();
                var attribs   = new Dictionary <String, String>();

                for (var attrib = 0; attrib < numAttrib; attrib++)
                {
                    m_CustomAttributes.Add(tasks.GetCustomAttributeID(attrib).ToLower(),
                                           tasks.GetCustomAttributeLabel(attrib));
                }
            }

            this.htmlReportTasksControl.SetCustomAttributes(m_CustomAttributes);

            HtmlEditorControlEx.SizeEditHtmlForm = new Size(prefs.GetProfileInt(key, "HtmlFormWidth", -1),
                                                            prefs.GetProfileInt(key, "HtmlFormHeight", -1));

            var prevSize = new Size(prefs.GetProfileInt(key, "TemplateFormWidth", -1),
                                    prefs.GetProfileInt(key, "TemplateFormHeight", -1));

            if ((prevSize.Width > 0) && (prevSize.Height > 0))
            {
                this.Size = prevSize;
            }
        }
Exemplo n.º 3
0
        public bool Equals(HtmlReportTemplate other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Header.Equals(other.Header) &&
                   Title.Equals(other.Title) &&
                   Task.Equals(other.Task) &&
                   Footer.Equals(other.Footer));
        }
Exemplo n.º 4
0
        public bool Copy(HtmlReportTemplate other)
        {
            if (other == null)
            {
                return(false);
            }

            Header.Copy(other.Header);
            Title.Copy(other.Title);
            Task.Copy(other.Task);
            Footer.Copy(other.Footer);

            return(true);
        }
Exemplo n.º 5
0
        // -------------------------------------------------------------

        public HtmlReportBuilder(TaskList tasks, HtmlReportTemplate template, Preferences prefs, bool preview)
        {
            m_Tasklist = tasks;
            m_Template = template;

            m_StrikeThruDone = prefs.GetProfileBool("Preferences", "StrikethroughDone", true);
            m_BodyFontStyle  = FormatBodyFontStyle(prefs);
            m_TaskBaseIndent = FormatTaskBaseIndent(prefs);

            Header = new HeaderTemplateReporter(template.Header);
            Title  = new TitleTemplateReporter(template.Title);
            Tasks  = new TaskTemplateReporter(template.Task, preview);
            Footer = new FooterTemplateReporter(template.Footer);
        }
Exemplo n.º 6
0
        protected bool InitConsts(TaskList tasks, string destFilePath, bool silent, Preferences prefs, string sKey)
        {
            // Display a dialog to get the report parameters
            // or to return the last saved template
            using (var dialog = new HtmlReportTemplateForm(m_TypeId, m_Trans, tasks, prefs, sKey))
            {
                if (!silent && (dialog.ShowDialog() != DialogResult.OK))
                {
                    return(false);
                }

                m_Template = dialog.ReportTemplate;
            }

            return(m_Template.HasContents());
        }
Exemplo n.º 7
0
        // --------------------------------------------------------------

        public HtmlReportTemplateForm(String typeId, Translator trans, TaskList tasks, Preferences prefs)
        {
            m_TypeId   = typeId;
            m_Trans    = trans;
            m_Tasklist = tasks;
            m_Prefs    = prefs;

            m_Template     = new HtmlReportTemplate();
            m_PrevTemplate = new HtmlReportTemplate();

            m_ChangeTimer          = new Timer();
            m_ChangeTimer.Tick    += new EventHandler(OnChangeTimer);
            m_ChangeTimer.Interval = 500;

            InitializeComponentEx();
        }
Exemplo n.º 8
0
        //static String CommentsDoneColor = @"#808080";
        //static String Endl = @"\n";

        // -------------------------------------------------------------

        public HtmlReportBuilder(Translator trans, TaskList tasks, Preferences prefs, HtmlReportTemplate template, bool preview)
        {
            m_Tasklist = tasks;
            m_Template = template;

            m_StrikeThruDone = prefs.GetProfileBool("Preferences", "StrikethroughDone", true);
            m_BodyFontStyle  = HtmlReportUtils.FormatBodyFontStyle(prefs);

            Header = new HeaderTemplateReporter(template.Header, template.BackColor);
            Title  = new TitleTemplateReporter(trans, template.Title);
            Footer = new FooterTemplateReporter(template.Footer, template.BackColor);

            var custAttribs = HtmlReportUtils.GetCustomAttributes(tasks);
            var baseIndent  = HtmlReportUtils.FormatTaskBaseIndent(prefs);

            Tasks = new TaskTemplateReporter(trans, template.Task, baseIndent, preview);
        }
Exemplo n.º 9
0
        public bool Copy(HtmlReportTemplate other)
        {
            if (other == null)
            {
                return(false);
            }

            BackImage = String.Copy(other.BackImage);
            BackColor = DrawingColor.Copy(other.BackColor);

            Header.Copy(other.Header);
            Title.Copy(other.Title);
            Task.Copy(other.Task);
            Footer.Copy(other.Footer);

            return(true);
        }
Exemplo n.º 10
0
        // --------------------------------------------------------------

        public HtmlReportTemplateForm(String typeId, Translator trans, TaskList tasks, bool printing, Preferences prefs, String key)
        {
            m_TypeId   = typeId;
            m_Trans    = trans;
            m_Tasklist = tasks;
            m_Prefs    = prefs;
            m_PrefsKey = key;
            m_Printing = printing;

            m_Template            = new HtmlReportTemplate();
            m_PrevTemplate        = new HtmlReportTemplate();
            m_CustomAttributes    = new HtmlReportUtils.CustomAttributes();
            m_EditedSinceLastSave = false;

            m_ChangeTimer          = new Timer();
            m_ChangeTimer.Tick    += new EventHandler(OnChangeTimer);
            m_ChangeTimer.Interval = 500;

            InitializeComponent();
            InitialiseFontAndColors();
            DoHighDPIFixups();

            // Build list custom attribute IDs for later use
            if (tasks.HasCustomAttributes())
            {
                var numAttrib   = tasks.GetCustomAttributeCount();
                var custAttribs = new HtmlReportUtils.CustomAttributes();

                for (var attrib = 0; attrib < numAttrib; attrib++)
                {
                    m_CustomAttributes.Add(tasks.GetCustomAttributeID(attrib).ToLower(),
                                           tasks.GetCustomAttributeLabel(attrib));
                }
            }

            this.htmlReportTasksControl.SetCustomAttributes(m_CustomAttributes);

            var prevSize = LoadPreferences();

            if ((prevSize.Width > 0) && (prevSize.Height > 0))
            {
                this.Size = prevSize;
            }
        }
Exemplo n.º 11
0
        protected bool InitConsts(TaskList tasks, string destFilePath, bool silent, Preferences prefs, string sKey)
        {
            if (!silent)
            {
                // Display a dialog to get the report parameters
                using (var dialog = new HtmlReportTemplateForm(m_TypeId, m_Trans, tasks, prefs))
                {
                    if (dialog.ShowDialog() != DialogResult.OK)
                    {
                        return(false);
                    }

                    m_Template = dialog.ReportTemplate;
#if DEBUG
                    return(false);
#endif
                }
            }
            return(true);
        }
Exemplo n.º 12
0
        public bool Equals(HtmlReportTemplate other)
        {
            if (other == null)
            {
                return(false);
            }

            if (!BackImage.Equals(other.BackImage))
            {
                return(false);
            }

            if (!DrawingColor.Equals(BackColor, other.BackColor))
            {
                return(false);
            }

            if (!Header.Equals(other.Header))
            {
                return(false);
            }

            if (!Title.Equals(other.Title))
            {
                return(false);
            }

            if (!Task.Equals(other.Task))
            {
                return(false);
            }

            if (!Footer.Equals(other.Footer))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 13
0
        private void OnChangeTemplate(PageType page, HtmlReportTemplate oldTemplate, HtmlReportTemplate newTemplate)
        {
            switch (page)
            {
            case PageType.Header:
                break;

            case PageType.Title:
                break;

            case PageType.Tasks:
            {
                var oldLayout = oldTemplate.Task.LayoutStyle;
                var newLayout = newTemplate.Task.LayoutStyle;

                bool showTableHeaderCombo = (newLayout == TaskTemplate.Layout.StyleType.Table);

                if (showTableHeaderCombo != this.tableHeaderRowCombobox.Visible)
                {
                    this.tableHeaderRowCombobox.Visible = showTableHeaderCombo;
                    this.tableHeaderRowCombobox.Enabled = showTableHeaderCombo;

                    int newBottom = (showTableHeaderCombo ? this.htmlReportHeaderControl.Bottom : this.tableHeaderRowCombobox.Bottom);

                    this.htmlReportTasksControl.Bounds = Rectangle.FromLTRB(this.htmlReportTasksControl.Left,
                                                                            this.htmlReportTasksControl.Top,
                                                                            this.htmlReportTasksControl.Right,
                                                                            newBottom);
                }
            }
            break;

            case PageType.Footer:
                break;
            }

            RefreshPreview();
        }
        // --------------------------------------------------------------

        public HtmlReportTemplateForm(String typeId, Translator trans, TaskList tasks, Preferences prefs, String key)
        {
            m_TypeId   = typeId;
            m_Trans    = trans;
            m_Tasklist = tasks;
            m_Prefs    = prefs;
            m_PrefsKey = key;

            m_Template     = new HtmlReportTemplate();
            m_PrevTemplate = new HtmlReportTemplate();

            m_TemplateFilePath = prefs.GetProfileString(key, "LastOpenTemplate", "");

            if (!m_Template.Load(m_TemplateFilePath))
            {
                m_TemplateFilePath = String.Empty;
            }

            m_ChangeTimer          = new Timer();
            m_ChangeTimer.Tick    += new EventHandler(OnChangeTimer);
            m_ChangeTimer.Interval = 500;

            InitializeComponent();
        }