Example #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:TeDivisionLayoutMgr"/> class.
		/// </summary>
		/// <param name="layoutConfig">The layout config.</param>
		/// <param name="pubDiv">The pub div.</param>
		/// <param name="filterInstance">The filter instance.</param>
		/// <param name="numberOfColumns">The number of columns.</param>
		/// <param name="fIntroDivision">set to <c>true</c> for an intro division, otherwise
		/// <c>false</c>.</param>
		/// <remarks>We explicitly specify the number of columns for this division because we
		/// use the same IPubDivision for multiple division with different number of columns.
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		public TeDivisionLayoutMgr(IPrintLayoutConfigurer layoutConfig,
			IPubDivision pubDiv, int filterInstance, int numberOfColumns, bool fIntroDivision)
			: base(layoutConfig, pubDiv, filterInstance)
		{
			m_numberMainStreamColumns = numberOfColumns;
			m_fIntroDivision = fIntroDivision;
		}
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Test class that mocks the PageSetupDlg.
		/// </summary>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division.</param>
		/// <param name="pubPageInfo">The publication page info.</param>
		/// ------------------------------------------------------------------------------------
		public DummyPageSetupDlg(IPubPageLayout pgLayout, IPublication publication,
			IPubDivision division, List<PubPageInfo> pubPageInfo)
			: base(pgLayout, null, publication, division, null, null, new DummyApp(), pubPageInfo)
		{
			// need to set selected index to something other than 0, otherwise tests fail
			// on machines with default printer set to A4.
			PaperSizeName = "A5";
		}
Example #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds the division to the publication.
        /// </summary>
        /// <param name="pub">The publication where the division will be added.</param>
        /// <param name="fDifferentFirstHF">if set to <c>true</c> publication has a different
        /// first header/footer].</param>
        /// <param name="fDifferentEvenHF">if set to <c>true</c> publication has a different even
        /// header/footer.</param>
        /// <param name="startAt">Enumeration of options for where the content of the division
        /// begins</param>
        /// <returns>the new division</returns>
        /// ------------------------------------------------------------------------------------
        public IPubDivision AddDivisionToPub(IPublication pub, bool fDifferentFirstHF,
                                             bool fDifferentEvenHF, DivisionStartOption startAt)
        {
            IPubDivision div = Cache.ServiceLocator.GetInstance <IPubDivisionFactory>().Create();

            pub.DivisionsOS.Add(div);
            div.DifferentFirstHF = fDifferentFirstHF;
            div.DifferentEvenHF  = fDifferentEvenHF;
            div.StartAt          = startAt;
            return(div);
        }
Example #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="scr">The Scripture object (which owns the publications).</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division. The NumberOfColumns in the division should be
		/// set before calling this dialog.</param>
		/// <param name="teMainWnd">TE main window (provides callbacks).</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
		/// was brought up is Trial Publication view.</param>
		/// <param name="pubPageSizes">The page sizes available for publication.</param>
		/// ------------------------------------------------------------------------------------
		public TePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IScripture scr,
			IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd,
			IHelpTopicProvider helpTopicProvider, MsrSysType units, bool fIsTrialPub,
			List<PubPageInfo> pubPageSizes) :
			base(wsUser, pgLayout, scr, publication, division, teMainWnd, helpTopicProvider,
				units, pubPageSizes)
		{
			m_fIsTrialPublication = fIsTrialPub;
			if (!m_chkNonStdChoices.Checked) // following the standard
				m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value;
		}
Example #5
0
//		private decimal m_standardLeadingFactor;
        #endregion

        #region Constructor
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class.
        /// </summary>
        /// <param name="pgLayout">The page layout.</param>
        /// <param name="scr">The Scripture object (which owns the publications).</param>
        /// <param name="publication">The publication.</param>
        /// <param name="division">The division. The NumberOfColumns in the division should be
        /// set before calling this dialog.</param>
        /// <param name="teMainWnd">TE main window (provides callbacks).</param>
        /// <param name="helpTopicProvider">The help topic provider.</param>
        /// <param name="app">The app.</param>
        /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
        /// was brought up is Trial Publication view.</param>
        /// <param name="pubPageSizes">The page sizes available for publication.</param>
        /// ------------------------------------------------------------------------------------
        public TePageSetupDlg(IPubPageLayout pgLayout, IScripture scr,
                              IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd,
                              IHelpTopicProvider helpTopicProvider, IApp app, bool fIsTrialPub,
                              List <PubPageInfo> pubPageSizes) :
            base(pgLayout, scr, publication, division, teMainWnd, helpTopicProvider,
                 app, pubPageSizes)
        {
            m_fIsTrialPublication = fIsTrialPub;
//			if (!m_chkNonStdChoices.Checked) // following the standard
//				m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value;
        }
Example #6
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Constructs a dialog for choosing, creating, modifying, and deleting Header/Footer
 /// sets
 /// </summary>
 /// <param name="cache">Cache</param>
 /// <param name="pub">The current publication</param>
 /// <param name="helpProvider">Object that gives access to help</param>
 /// <param name="protectedHFSets">List of names of H/F sets that cannot be deleted</param>
 /// <param name="hfOwner">The owner of the H/F set.</param>
 /// ------------------------------------------------------------------------------------
 public HeaderFooterSetupDlg(FdoCache cache, IPublication pub,
                             IHelpTopicProvider helpProvider, List <string> protectedHFSets, ICmMajorObject hfOwner)
 {
     m_cache           = cache;
     m_HfSetOwner      = hfOwner;
     m_pub             = pub;
     m_pubDiv          = m_pub.DivisionsOS[0];
     m_helpProvider    = helpProvider;
     m_protectedHFSets = protectedHFSets;
     Initialize();
 }
Example #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void TestSetup()
        {
            base.TestSetup();

            m_pub = CreatePublication(0, 0, false, "TestPub", 0,
                                      BindingSide.Left, 0);

            m_div = AddDivisionToPub(m_pub, false, false, DivisionStartOption.Continuous);
            m_pgl = Cache.ServiceLocator.GetInstance <IPubPageLayoutFactory>().Create();
            m_div.PageLayoutOA = m_pgl;

            m_pubPageInfo = new List <PubPageInfo>();
            m_pubPageInfo.Add(new PubPageInfo("Full Page", 0, 0));
            m_pubPageInfo.Add(new PubPageInfo("5.25 x 8.25", (int)(8.25 * 72000), (int)(5.25 * 72000)));
            m_pubPageInfo.Add(new PubPageInfo("5.8 x 8.7", (int)(8.7 * 72000), (int)(5.8 * 72000)));
        }
Example #8
0
        public override void Initialize()
        {
            CheckDisposed();
            base.Initialize();

            wsUser = m_inMemoryCache.Cache.DefaultUserWs;
            m_inMemoryCache.InitializeAnnotationDefs();
            m_pub = m_inMemoryCache.CreatePublication(0, 0, false, "TestPub", 0,
                                                      BindingSide.Left, 0);

            m_div = m_inMemoryCache.AddDivisionToPub(m_pub, false, false,
                                                     DivisionStartOption.Continuous);
            m_pgl = new PubPageLayout() as IPubPageLayout;
            m_div.PageLayoutOA    = m_pgl;
            m_div.PageLayoutOAHvo = m_pgl.Hvo;

            m_pubPageInfo = new List <PubPageInfo>();
            m_pubPageInfo.Add(new PubPageInfo("Full Page", 0, 0));
            m_pubPageInfo.Add(new PubPageInfo("5.25 x 8.25", (int)(8.25 * 72000), (int)(5.25 * 72000)));
            m_pubPageInfo.Add(new PubPageInfo("5.8 x 8.7", (int)(8.7 * 72000), (int)(5.8 * 72000)));
        }
Example #9
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged
        /// resources; <c>false</c> to release only unmanaged resources.
        /// </param>
        /// -----------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            CloseRootBoxes();
            m_cache      = null;
            m_HfSetOwner = null;
            m_pub        = null;
            m_pubDiv     = null;

            base.Dispose(disposing);
        }
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged
        /// resources; <c>false</c> to release only unmanaged resources.
        /// </param>
        /// -----------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            CloseRootBoxes();
            m_cache      = null;
            m_HfSetOwner = null;
            m_pub        = null;
            m_pubDiv     = null;

            base.Dispose(disposing);
        }
Example #11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up a publication for OnPageSetup.
		/// </summary>
		/// <param name="publication">A publication to use for page setup.</param>
		/// <param name="division">Publication Division for pub</param>
		/// <param name="pageLayout">A publication page layout for pub</param>
		/// <returns>returns <c>false</c> if there is no current publication</returns>
		/// <remarks>This was the top half of OnPageSetup originally.
		/// It was refactored to avoid duplicating code in an override of
		/// OnPageSetup in TeMainWind.</remarks>
		/// ------------------------------------------------------------------------------------
		protected bool PageSetupPreparePublication(out IPublication publication,
			out IPubDivision division, out IPubPageLayout pageLayout)
		{
			publication = null;
			division = null;
			pageLayout = null;

			// Get a publication to use for page setup.
			publication = CurrentPublication;
			if (publication == null)
				return false;

			// Get a publication division for given publication.  If none, create one.
			int chvoDiv = publication.DivisionsOS.Count;
			int hvoDiv;
			if (chvoDiv < 1)
			{
				division = m_cache.ServiceLocator.GetInstance<IPubDivisionFactory>().Create();
				publication.DivisionsOS.Add(division);
				division.StartAt = DivisionStartOption.NewPage;
				division.DifferentEvenHF = false;
				division.DifferentFirstHF = false;
			}
			else
			{
				division = publication.DivisionsOS[0];
			}
			hvoDiv = division.Hvo;

			// Get publication page layout for given division.  If none create one.
			if (division.PageLayoutOA == null)
			{
				pageLayout = m_cache.ServiceLocator.GetInstance<IPubPageLayoutFactory>().Create();
				division.PageLayoutOA = pageLayout;
				pageLayout.MarginTop = 72000;
				pageLayout.MarginBottom = 72000;
				pageLayout.MarginInside = 72000;
				pageLayout.MarginOutside = 72000;
				pageLayout.PosHeader = 36000;
				pageLayout.PosFooter = 36000;
			}
			else
			{
				pageLayout = division.PageLayoutOA;
			}
			return true;
		}
Example #12
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the page setup dialog.
		/// </summary>
		/// <param name="pgl">The PubPageLayout object</param>
		/// <param name="pub">The Publication object</param>
		/// <param name="div">The PubDivision object</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual IPageSetupDialog CreatePageSetupDialog(IPubPageLayout pgl,
			IPublication pub, IPubDivision div)
		{
			throw new NotImplementedException("Subclass must override CreatePageSetupDialog.");
		}
Example #13
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing"><c>true</c> to release both managed and unmanaged
		/// resources; <c>false</c> to release only unmanaged resources.
		/// </param>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose( bool disposing )
		{
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			CloseRootBoxes();
			m_cache = null;
			m_HfSetOwner = null;
			m_pub = null;
			m_pubDiv = null;

			base.Dispose( disposing );
		}
Example #14
0
		/// <summary>
		///
		/// </summary>
		public override void TestSetup()
		{
			base.TestSetup();


			m_pub = CreatePublication(0, 0, false, "TestPub", 0,
				BindingSide.Left, 0);

			m_div = AddDivisionToPub(m_pub, false, false,
				DivisionStartOption.Continuous);
			m_pgl = Cache.ServiceLocator.GetInstance<IPubPageLayoutFactory>().Create();
			m_div.PageLayoutOA = m_pgl;

			m_pubPageInfo = new List<PubPageInfo>();
			m_pubPageInfo.Add(new PubPageInfo("Full Page", 0, 0));
			m_pubPageInfo.Add(new PubPageInfo("5.25 x 8.25", (int)(8.25 * 72000), (int)(5.25 * 72000)));
			m_pubPageInfo.Add(new PubPageInfo("5.8 x 8.7", (int)(8.7 * 72000), (int)(5.8 * 72000)));
		}
Example #15
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Test class that mocks the PageSetupDlg.
 /// </summary>
 /// <param name="wsUser">The user writing system.</param>
 /// <param name="pgLayout">The page layout.</param>
 /// <param name="publication">The publication.</param>
 /// <param name="division">The division.</param>
 /// <param name="units">The user's prefered measurement units.</param>
 /// <param name="pubPageInfo">The publication page info.</param>
 /// ------------------------------------------------------------------------------------
 public DummyPageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
                          IPubDivision division, MsrSysType units, List <PubPageInfo> pubPageInfo)
     :
     base(wsUser, pgLayout, null, publication, division, null, null, units, pubPageInfo)
 {
 }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// helper function verifies a complete division containing "Default" data
		/// </summary>
		/// <param name="division">the PubDivision to verify</param>
		/// ------------------------------------------------------------------------------------
		private void VerifyDivisionDefault(IPubDivision division)
		{
			//verify the division info
			Assert.AreEqual(DivisionStartOption.NewPage, division.StartAt);

			//verify division's pagelayout
			IPubPageLayout pageLayout = division.PageLayoutOA;
			VerifyPageLayoutDefault(pageLayout);

			//verify the division's header/footer set
			IPubHFSet hfSet = division.HFSetOA;
			VerifyHeaderFooterSetDefault(hfSet, true);

			//verify division's hf bools
			Assert.IsFalse(division.DifferentFirstHF, "DifferentFirstHF should be False.");
			Assert.IsFalse(division.DifferentEvenHF, "DifferentEvenHF should be False.");
		}
Example #17
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the page setup dialog.
		/// </summary>
		/// <param name="ws">The HVO of the user interface writing system</param>
		/// <param name="pgl">The PubPageLayout object</param>
		/// <param name="pub">The Publication object</param>
		/// <param name="div">The PubDivision object</param>
		/// <param name="helpTopicProvider">The Help topic provider</param>
		/// <param name="msrSysType">Type measurement units to use in the UI.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual IPageSetupDialog CreatePageSetupDialog(int ws, IPubPageLayout pgl,
			IPublication pub, IPubDivision div, IHelpTopicProvider helpTopicProvider,
			MsrSysType msrSysType)
		{
			throw new NotImplementedException("Subclass must override CreatePageSetupDialog.");
		}
Example #18
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Test class that mocks the PageSetupDlg.
 /// </summary>
 /// <param name="wsUser">The user writing system.</param>
 /// <param name="pgLayout">The page layout.</param>
 /// <param name="publication">The publication.</param>
 /// <param name="division">The division.</param>
 /// <param name="units">The user's prefered measurement units.</param>
 /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
 /// was brought up is "Trial Publication".</param>
 /// <param name="pubPageSizes">The publication page info.</param>
 /// ------------------------------------------------------------------------------------
 public DummyTePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
                            IPubDivision division, MsrSysType units, bool fIsTrialPub, List <PubPageInfo> pubPageSizes)
     :
     base(wsUser, pgLayout, null, publication, division, null, null, units, fIsTrialPub, pubPageSizes)
 {
 }
Example #19
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Test class that mocks the PageSetupDlg.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
		/// was brought up is "Trial Publication".</param>
		/// <param name="pubPageSizes">The publication page info.</param>
		/// ------------------------------------------------------------------------------------
		public DummyTePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
			IPubDivision division, MsrSysType units, bool fIsTrialPub, List<PubPageInfo> pubPageSizes)
			:
			base(wsUser, pgLayout, null, publication, division, null, null, units, fIsTrialPub, pubPageSizes)
		{
		}
Example #20
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Test class that mocks the PageSetupDlg.
 /// </summary>
 /// <param name="pgLayout">The page layout.</param>
 /// <param name="publication">The publication.</param>
 /// <param name="division">The division.</param>
 /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
 /// was brought up is "Trial Publication".</param>
 /// <param name="pubPageSizes">The publication page info.</param>
 /// ------------------------------------------------------------------------------------
 public DummyTePageSetupDlg(IPubPageLayout pgLayout, IPublication publication,
                            IPubDivision division, bool fIsTrialPub, List <PubPageInfo> pubPageSizes)
     : base(pgLayout, null, publication, division, null, null, new DummyApp(), fIsTrialPub, pubPageSizes)
 {
 }
Example #21
0
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			wsUser = m_inMemoryCache.Cache.DefaultUserWs;
			m_inMemoryCache.InitializeAnnotationDefs();
			m_pub = m_inMemoryCache.CreatePublication(0, 0, false, "TestPub", 0,
				BindingSide.Left, 0);

			m_div = m_inMemoryCache.AddDivisionToPub(m_pub, false, false,
				DivisionStartOption.Continuous);
			m_pgl = new PubPageLayout() as IPubPageLayout;
			m_div.PageLayoutOA = m_pgl;
			m_div.PageLayoutOAHvo = m_pgl.Hvo;

			m_pubPageInfo = new List<PubPageInfo>();
			m_pubPageInfo.Add(new PubPageInfo("Full Page", 0, 0));
			m_pubPageInfo.Add(new PubPageInfo("5.25 x 8.25", (int)(8.25 * 72000), (int)(5.25 * 72000)));
			m_pubPageInfo.Add(new PubPageInfo("5.8 x 8.7", (int)(8.7 * 72000), (int)(5.8 * 72000)));
		}
Example #22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Test class that mocks the PageSetupDlg.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="pubPageInfo">The publication page info.</param>
		/// ------------------------------------------------------------------------------------
		public DummyPageSetupDlg(int wsUser, IPubPageLayout pgLayout, IPublication publication,
			IPubDivision division, MsrSysType units, List<PubPageInfo> pubPageInfo)
			:
			base(wsUser, pgLayout, null, publication, division, null, null, units, pubPageInfo)
		{
		}
Example #23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up a publication for OnPageSetup.
		/// </summary>
		/// <param name="publication">A publication to use for page setup.</param>
		/// <param name="division">Publication Division for pub</param>
		/// <param name="pageLayout">A publication page layout for pub</param>
		/// <returns>returns <c>false</c> if there is no current publication</returns>
		/// <remarks>This was the top half of OnPageSetup originally.
		/// It was refactored to avoid duplicating code in an override of
		/// OnPageSetup in TeMainWind.</remarks>
		/// ------------------------------------------------------------------------------------
		protected bool PageSetupPreparePublication(out IPublication publication,
			out IPubDivision division, out IPubPageLayout pageLayout)
		{
			publication = null;
			division = null;
			pageLayout = null;

			// Get a publication to use for page setup.
			publication = CurrentPublication;
			if (publication == null)
				return false;

			// Get a publication division for given publication.  If none, create one.
			int chvoDiv = publication.DivisionsOS.Count;
			int hvoDiv;
			if (chvoDiv < 1)
			{
				hvoDiv = m_cache.CreateObject(PubDivision.kClassId, publication.Hvo,
					(int)Publication.PublicationTags.kflidDivisions, 0);
				division = new PubDivision(m_cache, hvoDiv, true, true);
				division.StartAt = DivisionStartOption.NewPage;
				division.DifferentEvenHF = false;
				division.DifferentFirstHF = false;
			}
			else
			{
				hvoDiv = publication.DivisionsOS.HvoArray[0];
				division = new PubDivision(m_cache, hvoDiv, true, true);
			}

			// Get publication page layout for given division.  If none create one.
			int hvoPgl;
			if (division.PageLayoutOAHvo == 0)
			{
				hvoPgl = m_cache.CreateObject(PubPageLayout.kClassId, hvoDiv,
					(int)PubDivision.PubDivisionTags.kflidPageLayout, 0);
				pageLayout = division.PageLayoutOA;
				pageLayout.MarginTop = 72000;
				pageLayout.MarginBottom = 72000;
				pageLayout.MarginInside = 72000;
				pageLayout.MarginOutside = 72000;
				pageLayout.PosHeader = 36000;
				pageLayout.PosFooter = 36000;
			}
			else
			{
				pageLayout = division.PageLayoutOA;
			}
			return true;
		}
        /// ------------------------------------------------------------------------------------
        /// <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);
        }
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing"><c>true</c> to release both managed and unmanaged
		/// resources; <c>false</c> to release only unmanaged resources.
		/// </param>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose( bool disposing )
		{
			System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			CloseRootBoxes();
			m_cache = null;
			m_HfSetOwner = null;
			m_pub = null;
			m_pubDiv = null;

			base.Dispose( disposing );
		}
Example #26
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Test class that mocks the PageSetupDlg.
		/// </summary>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division.</param>
		/// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
		/// was brought up is "Trial Publication".</param>
		/// <param name="pubPageSizes">The publication page info.</param>
		/// ------------------------------------------------------------------------------------
		public DummyTePageSetupDlg(IPubPageLayout pgLayout, IPublication publication,
			IPubDivision division, bool fIsTrialPub, List<PubPageInfo> pubPageSizes)
			: base(pgLayout, null, publication, division, null, null, new DummyApp(), fIsTrialPub, pubPageSizes)
		{
		}
Example #27
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the page setup dialog.
		/// </summary>
		/// <param name="pgl">The PubPageLayout object</param>
		/// <param name="pub">The Publication object</param>
		/// <param name="div">The PubDivision object</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected override IPageSetupDialog CreatePageSetupDialog(IPubPageLayout pgl,
			IPublication pub, IPubDivision div)
		{
			IWritingSystem wsObj = m_cache.ServiceLocator.WritingSystemManager.UserWritingSystem;

			TePageSetupDlg dlg = new TePageSetupDlg(pgl, m_scr, pub, div, this,
				m_app, m_app, ActiveEditingHelper.IsTrialPublicationView,
				TePublicationsInit.GetPubPageSizes(pub.Name, wsObj.Id));
			InitializePageSetupDlg(dlg);
			return dlg;
		}
Example #28
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:PageSetupDlg"/> class.
		/// </summary>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="pubOwner">The CmMajorObject that owns the publication.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division. The NumColumns in the division should be
		/// set before calling this dialog.</param>
		/// <param name="callbacks">The callbacks used to get application-specific settings.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="app">The app</param>
		/// <param name="pubPageSizes">The page sizes available for publication.</param>
		/// ------------------------------------------------------------------------------------
		public PageSetupDlg(IPubPageLayout pgLayout, ICmMajorObject pubOwner,
			IPublication publication, IPubDivision division, IPageSetupCallbacks callbacks,
			IHelpTopicProvider helpTopicProvider, IApp app, List<PubPageInfo> pubPageSizes) : this()
		{
			m_pubOwner = pubOwner;
			m_publication = publication;
			m_division = division;
			m_pgLayout = pgLayout;
			m_callbacks = callbacks;
			m_helpTopicProvider = helpTopicProvider;
			m_app = app;

			InitializePaperSizes();

			MsrSysType units = app.MeasurementSystem;
			m_udmTop.MeasureType = units;
			m_udmLeft.MeasureType = units;
			m_udmBottom.MeasureType = units;
			m_udmRight.MeasureType = units;
			m_udmGutter.MeasureType = units;
			m_udmPaperWidth.MeasureType = units;
			m_udmPaperWidth.UseVariablePrecision = true;
			m_udmPaperHeight.MeasureType = units;
			m_udmPaperHeight.UseVariablePrecision = true;
			m_udmHeader.MeasureType = units;
			m_udmFooter.MeasureType = units;

			m_udmTop.MeasureValue = pgLayout.MarginTop;
			m_udmLeft.MeasureValue = pgLayout.MarginInside;
			m_udmBottom.MeasureValue = pgLayout.MarginBottom;
			m_udmRight.MeasureValue = pgLayout.MarginOutside;
			m_udmGutter.MeasureValue = publication.GutterMargin;

			//REVIEW: Do we need to call UpdateMarginControls?
			m_numColumns = m_division.NumColumns;

			m_fBookFoldCurrent = publication.IsLandscape;

			//if (m_fBookFoldCurrent)
			//{
			//    pbBookFold.Image = ResourceHelper.BookFoldSelectedIcon;
			//    pbDraft.Image = ResourceHelper.PortraitIcon;
			//    pnlDraftOptions.Visible = false;
			//    pnlBookFoldOptions.Visible = true;

			//}
			//else // Draft
			//{
			//    pbBookFold.Image = ResourceHelper.BookFoldIcon;
			//    pbDraft.Image = ResourceHelper.PortraitSelectedIcon;
			//    pnlDraftOptions.Visible = true;
			//    pnlBookFoldOptions.Visible = false;
			//}

			//rdoSingleSide.Checked = true;
			//rdoDoubleSide.Checked = false;

			if (pubPageSizes != null && pubPageSizes.Count > 0)
			{
				cboPubPageSize.Items.Clear();
				foreach (PubPageInfo pubPgInfo in pubPageSizes)
				{
					cboPubPageSize.Items.Add(pubPgInfo);
					if (publication.PageHeight == pubPgInfo.Height &&
						publication.PageWidth == pubPgInfo.Width)
					{
						cboPubPageSize.SelectedItem = pubPgInfo;
					}
				}
			}
			else
				cboPubPageSize.SelectedIndex = 0;

			int mptPaperHeight = publication.PaperHeight;
			int mptPaperWidth = publication.PaperWidth;
			if (mptPaperHeight == 0)
			{
				m_fSavePaperSize = false;
				Debug.Assert(mptPaperWidth == 0);
				PrinterUtils.GetDefaultPaperSizeInMp(out mptPaperHeight, out mptPaperWidth);
			}
			else
				m_fSavePaperSize = true;

			// Find the paper size in the combo box.
			foreach (PaperSize size in cbPaperSize.Items)
			{
				if (size.Height * kCentiInchToMilliPoints == mptPaperHeight &&
					size.Width * kCentiInchToMilliPoints == mptPaperWidth)
				{
					cbPaperSize.SelectedItem = size;
				}
			}

			m_udmPaperWidth.MeasureValue = mptPaperWidth;
			m_udmPaperHeight.MeasureValue = mptPaperHeight;
			AdjustPaperSize(mptPaperWidth, mptPaperHeight);

			foreach (PubPageInfo pubPgInfo in cboPubPageSize.Items)
			{
				if (pubPgInfo.Height == m_publication.PageHeight &&
					pubPgInfo.Width == m_publication.PageWidth)
				{
					cboPubPageSize.SelectedItem = pubPgInfo;
					break;
				}
			}

			m_cbBookStart.SelectedIndex = (int)m_division.StartAt;
			m_ckbDiffEvenHF.Checked = m_division.DifferentEvenHF;
			m_ckbDiffFirstHF.Checked = m_division.DifferentFirstHF;
			m_udmHeader.MeasureValue = pgLayout.PosHeader;
			m_udmFooter.MeasureValue = pgLayout.PosFooter;
			switch (publication.FootnoteSepWidth)
			{
				case 0:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthNone;
					break;
				case 333:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthThird;
					break;
				case 1000:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthFull;
					break;
				default:
					Debug.Assert(false, "non-default footnote seperator width");
					m_cboSeparator.SelectedIndex = -1;
					break;
			}

			m_fChangingIndex = false;

			// Initialize dialog settings from the publication.
			NumberOfColumns = m_division.NumColumns;
			UpdateColumnButtonStates();

			SetFontSizeAndLineSpacing = true;
			if (PublicationUsesNormalStyle)
			{
				SetDefaultBaseFontAndLineSizes();
			}
			else
			{
				// In the unlikely event that the publication has a default value for one but not
				// both of these values, set the leading to the default percentage and set the
				// implicit value based on the explicit one.

				// Use the absolute value because we only support "exact" line spacing
				decimal mptPubBaseLineSpacing = (decimal)Math.Abs(publication.BaseLineSpacing);
				m_leadingFactor = (publication.BaseFontSize == 0 || publication.BaseLineSpacing == 0) ?
					StandardLeadingFactor : mptPubBaseLineSpacing / publication.BaseFontSize;

				SetBaseCharacterSize(publication.BaseFontSize);
				SetBaseLineSpacing(mptPubBaseLineSpacing);
				if (publication.BaseFontSize == 0)
					SetBaseCharacterSize(BaseLineSpacing / m_leadingFactor);
				else if (publication.BaseLineSpacing == 0)
					SetBaseLineSpacing(BaseCharacterSize * m_leadingFactor);

				m_fSaveBaseFontAndLineSizes = true;
			}
			SetFontSizeAndLineSpacing = false;

			m_chkNonStdChoices.Checked = !FollowsStandardSettings;
			UpdateTextSizeCtlStatus();
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructs a dialog for choosing, creating, modifying, and deleting Header/Footer
		/// sets
		/// </summary>
		/// <param name="cache">Cache</param>
		/// <param name="pub">The current publication</param>
		/// <param name="helpProvider">Object that gives access to help</param>
		/// <param name="protectedHFSets">List of names of H/F sets that cannot be deleted</param>
		/// <param name="hfOwner">The owner of the H/F set.</param>
		/// ------------------------------------------------------------------------------------
		public HeaderFooterSetupDlg(FdoCache cache, IPublication pub,
			IHelpTopicProvider helpProvider, List<string> protectedHFSets, ICmMajorObject hfOwner)
		{
			m_cache = cache;
			m_HfSetOwner = hfOwner;
			m_pub = pub;
			m_pubDiv = m_pub.DivisionsOS[0];
			m_helpProvider = helpProvider;
			m_protectedHFSets = protectedHFSets;
			Initialize();
		}
Example #30
0
			/// <summary>
			/// Contstructor
			/// </summary>
			/// <param name="div"></param>
			public DivInfo(IPubDivision div)
			{
				this.hfSet = div.HFSetOA.Hvo;
				this.fDifferentFirstHF = div.DifferentFirstHF;
				this.fDifferentEvenHF = div.DifferentEvenHF;
			}
Example #31
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="DivisionLayoutMgr"/> class.
		/// </summary>
		/// <param name="configurer">The print layout configurer that provides details about
		/// the streams that belong to this division.</param>
		/// <param name="division">The PubDivision used to get margin and header/
		/// footer settings</param>
		/// <param name="filterInstance">filter instance to use for book filtering</param>
		/// -----------------------------------------------------------------------------------
		public DivisionLayoutMgr(IPrintLayoutConfigurer configurer, IPubDivision division,
			int filterInstance)
		{
			m_filterInstance = filterInstance;
			m_configurer = configurer;
			m_pubDivision = division;
			m_numberMainStreamColumns = (division == null) ? 1 : division.NumColumns;
			SetInfoFromDB();
		}
Example #32
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the page setup dialog.
		/// </summary>
		/// <param name="ws">The HVO of the user interface writing system</param>
		/// <param name="pgl">The PubPageLayout object</param>
		/// <param name="pub">The Publication object</param>
		/// <param name="div">The PubDivision object</param>
		/// <param name="helpTopicProvider">The Help topic provider</param>
		/// <param name="msrSysType">Type measurement units to use in the UI.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected override IPageSetupDialog CreatePageSetupDialog(int ws, IPubPageLayout pgl,
			IPublication pub, IPubDivision div, IHelpTopicProvider helpTopicProvider,
			MsrSysType msrSysType)
		{
			TePageSetupDlg dlg = new TePageSetupDlg(ws, pgl, m_scr, pub, div, this,
				helpTopicProvider, msrSysType, ActiveEditingHelper.IsTrialPublicationView,
				TePublicationsInit.GetPubPageSizes(pub.Name,
				Cache.GetUnicodeProperty(ws, (int)LgWritingSystem.LgWritingSystemTags.kflidICULocale)));
			InitializePageSetupDlg(dlg);
			return dlg;
		}