/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Called when the add button is pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        protected void m_btnAdd_Click(object sender, System.EventArgs e)
        {
            IPubHFSet HFSet = m_cache.ServiceLocator.GetInstance <IPubHFSetFactory>().Create();

            m_HfSetOwner.HeaderFooterSetsOC.Add(HFSet);
            IPubHeaderFactory phFactory = m_cache.ServiceLocator.GetInstance <IPubHeaderFactory>();

            HFSet.DefaultFooterOA = phFactory.Create();
            HFSet.DefaultHeaderOA = phFactory.Create();
            HFSet.FirstFooterOA   = phFactory.Create();
            HFSet.FirstHeaderOA   = phFactory.Create();
            HFSet.EvenFooterOA    = phFactory.Create();
            HFSet.EvenHeaderOA    = phFactory.Create();

            using (HeaderFooterModifyDlg dlg = new HeaderFooterModifyDlg(m_cache, HFSet as IPubHFSet, m_pub, m_helpProvider))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    UpdateNameBox(null);
                    UpdatePreView();
                }
                else
                {
                    // We don't want a new PubHFSet after all...
                    m_cache.DomainDataByFlid.DeleteObj(HFSet.Hvo);
                }
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates 2 fake HF sets for use in testing
        /// </summary>
        /// <returns>the created publication</returns>
        /// ------------------------------------------------------------------------------------
        private IPublication CreateFakeHFSets()
        {
            // create a publication
            IPublication pub = Cache.ServiceLocator.GetInstance <IPublicationFactory>().Create();

            Cache.LanguageProject.LexDbOA.PublicationsOC.Add(pub);
            IPubDivision pubDiv = Cache.ServiceLocator.GetInstance <IPubDivisionFactory>().Create();

            pub.DivisionsOS.Add(pubDiv);

            // create the current HF set for the publication
            pubDiv.HFSetOA = Cache.ServiceLocator.GetInstance <IPubHFSetFactory>().Create();
            IPubHeaderFactory phFactory = Cache.ServiceLocator.GetInstance <IPubHeaderFactory>();

            pubDiv.HFSetOA.DefaultHeaderOA = phFactory.Create();
            pubDiv.HFSetOA.DefaultFooterOA = phFactory.Create();
            pubDiv.HFSetOA.FirstHeaderOA   = phFactory.Create();
            pubDiv.HFSetOA.FirstFooterOA   = phFactory.Create();
            pubDiv.HFSetOA.EvenHeaderOA    = phFactory.Create();
            pubDiv.HFSetOA.EvenFooterOA    = phFactory.Create();
            pubDiv.HFSetOA.Name            = "Test HF Set of Matthew printed in Tabaluga";

            // create a dummy HF set
            int           userWs = Cache.WritingSystemFactory.UserWs;
            ITsStrFactory tsf    = Cache.TsStrFactory;
            IPubHFSet     hfset  = Cache.ServiceLocator.GetInstance <IPubHFSetFactory>().Create();

            m_hfSets.Add(hfset);
            hfset.Name            = "Test HF Set created today";
            hfset.Description     = tsf.MakeString("This is a test HF set", userWs);
            hfset.DefaultHeaderOA = phFactory.Create();
            hfset.DefaultFooterOA = phFactory.Create();
            hfset.EvenHeaderOA    = phFactory.Create();
            hfset.EvenFooterOA    = phFactory.Create();
            hfset.FirstFooterOA   = phFactory.Create();
            hfset.FirstHeaderOA   = phFactory.Create();
            hfset.DefaultFooterOA.OutsideAlignedText = tsf.MakeString("outside text", userWs);
            hfset.DefaultFooterOA.CenteredText       = tsf.MakeString("Song of songs", userWs);
            hfset.EvenHeaderOA.CenteredText          = tsf.MakeString("Song even pages", userWs);
            hfset.EvenHeaderOA.InsideAlignedText     = tsf.MakeString("Inside text", userWs);
            hfset.FirstFooterOA.InsideAlignedText    = tsf.MakeString("Inside text", userWs);

            // create another dummy HF set
            IPubHFSet hfset2 = Cache.ServiceLocator.GetInstance <IPubHFSetFactory>().Create();

            m_hfSets.Add(hfset2);
            hfset2.Name            = "Test HF Set of Matthew printed in Tabaluga";
            hfset2.Description     = tsf.MakeString("This is another test HF set", userWs);
            hfset2.DefaultHeaderOA = phFactory.Create();
            hfset2.DefaultFooterOA = phFactory.Create();
            hfset2.EvenHeaderOA    = phFactory.Create();
            hfset2.EvenFooterOA    = phFactory.Create();
            hfset2.FirstFooterOA   = phFactory.Create();
            hfset2.FirstHeaderOA   = phFactory.Create();
            hfset2.DefaultHeaderOA.OutsideAlignedText =
                TsStringUtils.CreateOrcFromGuid(HeaderFooterVc.PageNumberGuid,
                                                FwObjDataTypes.kodtContextString, Cache.DefaultUserWs);
            hfset2.DefaultFooterOA.CenteredText    = tsf.MakeString("Matthew", userWs);
            hfset2.EvenFooterOA.CenteredText       = tsf.MakeString("From Reference", userWs);
            hfset2.EvenHeaderOA.InsideAlignedText  = tsf.MakeString("nothing", userWs);
            hfset2.FirstFooterOA.InsideAlignedText = tsf.MakeString("Inside text", userWs);

            return(pub);
        }