Exemple #1
0
        public void ExportUSFM_ToolboxVernacular()
        {
            string           fileName = Path.Combine(Path.GetTempPath(), "~usfmfile~.txt");
            FilteredScrBooks filter   = FilteredScrBooks.GetFilterInstance(Cache, 1);

            while (filter.BookCount > 0)
            {
                filter.Remove(0);
            }
            // add the book of James to the book filter
            filter.Add(Cache.LangProject.TranslatedScriptureOA.ScriptureBooksOS[1]);

            // perform Toolbox vernacular export
            try
            {
                ExportUsfm export = new ExportUsfm(Cache, filter, fileName);
                export.MarkupSystem = MarkupType.Toolbox;
                export.Run();
                VerifyFile("SIL.FieldWorks.AcceptanceTests.TE.ExportJasToolbox.sf",
                           fileName);
            }
            finally
            {
                try
                {
                    File.Delete(fileName);
                }
                catch {}
            }
        }
Exemple #2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="TeHeaderFooterVc"/> class.
 /// </summary>
 /// <param name="cache">DB Connection</param>
 /// <param name="page">Page information</param>
 /// <param name="wsDefault">ID of default writing system</param>
 /// <param name="printDateTime">printing date/time</param>
 /// <param name="filterInstance">book filter instance</param>
 /// <param name="sectionsTag">The sections tag.</param>
 /// ------------------------------------------------------------------------------------
 public TeHeaderFooterVc(FdoCache cache, IPageInfo page, int wsDefault,
                         DateTime printDateTime, int filterInstance, int sectionsTag)
     : base(page, wsDefault, printDateTime, cache)
 {
     m_scr               = m_cache.LangProject.TranslatedScriptureOA;
     m_bookFilter        = FilteredScrBooks.GetFilterInstance(m_cache, filterInstance);
     m_autoAdjustColumns = true;
     m_sectionsTag       = sectionsTag;
 }
            /// --------------------------------------------------------------------------------
            /// <summary>
            ///
            /// </summary>
            /// --------------------------------------------------------------------------------
            public DummyTeFootnoteView(FdoCache cache)
                : base()
            {
                // Add virtual property to cache
                if (FilteredScrBooks.GetFilterInstance(cache, 0) == null)
                {
                    new FilteredScrBooks(cache, 0);
                }

                m_locationTracker = new LocationTrackerImpl(cache, 0);
            }
Exemple #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make the root box.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void MakeRoot()
        {
            CheckDisposed();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            if (FwEditingHelper.ApplicableStyleContexts != null)
            {
                FwEditingHelper.ApplicableStyleContexts = new List <ContextValues>(2);
                FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.Note);
                FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.General);
            }

            // This is muy importante. If a spurious rootbox got made already and we just replace
            // it with a new one, the old one will fire an assertion in its destructor.
            // REVIEW: Is this okay? Is there any way to prevent early creation of rootboxes?
            if (m_rootb == null)
            {
                m_rootb = VwRootBoxClass.Create();
            }

            m_rootb.SetSite(this);

            // Set up a new view constructor.
            m_FootnoteVc = new FootnoteVc(m_filterInstance, TeStVc.LayoutViewTarget.targetDraft,
                                          m_isBackTranslation ? m_btWs : m_fdoCache.DefaultVernWs);
            m_FootnoteVc.ContentType = this.ContentType;

            m_FootnoteVc.Cache           = m_fdoCache;
            m_FootnoteVc.HeightEstimator = Group as IHeightEstimator;
            m_FootnoteVc.Editable        = EditingHelper.Editable;
            m_bookFilter = FilteredScrBooks.GetFilterInstance(m_fdoCache, m_filterInstance);

            m_FootnoteVc.Cache = m_fdoCache;

            m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
            //EditingHelper.RootObjects = new int[]{ScriptureObj.Hvo};
            m_rootb.SetRootObject(ScriptureObj.Hvo, m_FootnoteVc,
                                  (int)FootnoteFrags.kfrScripture, m_styleSheet);

            base.MakeRoot();
            m_dxdLayoutWidth = kForceLayout;             // Don't try to draw until we get OnSize and do layout.

            //TODO:
            //ptmw->RegisterRootBox(qrootb);

            Synchronize(m_rootb);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Makes a call to MakeSubordinateView, to add a view containing footnotes.
        /// </summary>
        /// <param name="div">The PrintLayout manager object</param>
        /// ------------------------------------------------------------------------------------
        public override void ConfigureSubordinateViews(DivisionLayoutMgr div)
        {
            int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOAHvo;

            BtFootnotePrintLayoutSideBySideVc footnoteVc = new BtFootnotePrintLayoutSideBySideVc(
                TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet,
                m_fdoCache, m_ws);
            NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor,
                                                         hvoScripture);

            IVwVirtualHandler vh =
                FilteredScrBooks.GetFilterInstance(m_fdoCache, div.FilterInstance);

            if (vh != null)
            {
                ownerSvd.AddTagLookup((int)Scripture.ScriptureTags.kflidScriptureBooks,
                                      vh.Tag);
            }

            div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture,
                                     footnoteVc, ownerSvd);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Makes a call to MakeSubordinateView, to add a view containing footnotes.
        /// </summary>
        /// <param name="div">The division layout manager</param>
        /// ------------------------------------------------------------------------------------
        public virtual void ConfigureSubordinateViews(DivisionLayoutMgr div)
        {
            int hvoScripture = m_fdoCache.LangProject.TranslatedScriptureOAHvo;
            int wsDefault    = ((m_viewType & TeViewType.BackTranslation) != 0 ?
                                m_fdoCache.DefaultAnalWs : m_fdoCache.DefaultVernWs);

            NLevelOwnerSvd ownerSvd = new NLevelOwnerSvd(2, m_fdoCache.MainCacheAccessor,
                                                         hvoScripture);

            IVwVirtualHandler vh =
                FilteredScrBooks.GetFilterInstance(m_fdoCache, div.FilterInstance);

            if (vh != null)
            {
                ownerSvd.AddTagLookup((int)Scripture.ScriptureTags.kflidScriptureBooks,
                                      vh.Tag);
            }

            if (m_sharedStream == null)
            {
                FootnoteVc footnoteVc = new FootnoteVc(div.FilterInstance,
                                                       TeStVc.LayoutViewTarget.targetPrint, wsDefault);
                footnoteVc.Cache = m_fdoCache;
                footnoteVc.DisplayTranslation = (m_viewType & TeViewType.BackTranslation) != 0;

                div.AddSubordinateStream(hvoScripture, (int)FootnoteFrags.kfrScripture,
                                         footnoteVc, ownerSvd);
            }
            else
            {
                int hvoRoot;
                IVwViewConstructor vc;
                int           frag;
                IVwStylesheet stylesheet;
                ((IVwRootBox)m_sharedStream).GetRootObject(out hvoRoot, out vc, out frag, out stylesheet);
                div.AddSharedSubordinateStream(m_sharedStream, vc, ownerSvd);
            }
        }
Exemple #7
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="LocationTrackerImpl"/> class.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="filterInstance">The filter instance. If 0, then the normal DB book list
 /// is used</param>
 /// <param name="contentType">Indicates the kind of data in the view about which we
 /// are returning selection information.</param>
 /// ------------------------------------------------------------------------------------
 public LocationTrackerImpl(FdoCache cache, int filterInstance, StVc.ContentTypes contentType)
 {
     m_cache       = cache;
     m_bookFilter  = FilteredScrBooks.GetFilterInstance(cache, filterInstance);
     m_contentType = contentType;
 }