Exemple #1
0
        /// <summary>
        /// Load the tree items if the starting point is a feature structure.
        /// </summary>
        /// <param name="fs"></param>
        private void LoadPhonFeats(IFsFeatStruc fs)
        {
            m_flidDummyValue = DummyVirtualHandler.InstallDummyHandler(m_cache.VwCacheDaAccessor, "FsClosedFeature", "DummyValue",
                                                                       (int)CellarModuleDefns.kcptReferenceAtom).Tag;
            IVwCacheDa cda = m_cache.VwCacheDaAccessor;

            foreach (int hvoClosedFeature in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC.HvoArray)
            {
                if (fs != null)
                {
                    IFsClosedValue closedValue = fs.FindClosedValue(hvoClosedFeature);
                    if (closedValue != null)
                    {
                        cda.CacheObjProp(hvoClosedFeature, m_flidDummyValue, closedValue.ValueRAHvo);
                    }
                    else
                    {                      // set the value to zero so nothing shows
                        cda.CacheObjProp(hvoClosedFeature, m_flidDummyValue, 0);
                    }
                }
                else
                {
                    // set the value to zero so nothing shows
                    cda.CacheObjProp(hvoClosedFeature, m_flidDummyValue, 0);
                }
            }
        }
Exemple #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create a view with multiple LexEntry objects.
        /// </summary>
        /// <param name="rghvoEntries"></param>
        /// <param name="cache"></param>
        /// <param name="styleSheet"></param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        private XmlView CreateSummaryView(List <int> rghvoEntries, FdoCache cache, IVwStylesheet styleSheet)
        {
            IVwVirtualHandler vh = DummyVirtualHandler.InstallDummyHandler(cache.VwCacheDaAccessor,
                                                                           "LexDb", "EntriesFound", (int)FieldType.kcptReferenceSequence);

            m_flidDummy = vh.Tag;
            cache.VwCacheDaAccessor.CacheVecProp(cache.LangProject.LexDbOAHvo, m_flidDummy,
                                                 rghvoEntries.ToArray(), rghvoEntries.Count);
            XmlView xv = new XmlView(cache.LangProject.LexDbOAHvo, "publishFound", null, false);

            xv.LoadFlexLayouts = true;
            xv.Cache           = cache;
            xv.StyleSheet      = styleSheet;
            return(xv);
        }
        /// <summary>
        /// Load the tree items if the starting point is a simple context.
        /// </summary>
        /// <param name="fs"></param>
        private void LoadPhonFeats(List <int> featureHvos)
        {
            m_dummyPolarityFlid = DummyVirtualHandler.InstallDummyHandler(m_cache.VwCacheDaAccessor, "FsClosedFeature", "DummyPolarity",
                                                                          (int)CellarModuleDefns.kcptUnicode).Tag;
            IVwCacheDa cda = m_cache.VwCacheDaAccessor;

            foreach (int hvoClosedFeature in featureHvos)
            {
                string str = null;
                if (ContainsFeature(m_ctxt.PlusConstrRS, hvoClosedFeature))
                {
                    str = MEStrings.ksFeatConstrAgree;
                }
                else if (ContainsFeature(m_ctxt.MinusConstrRS, hvoClosedFeature))
                {
                    str = MEStrings.ksFeatConstrDisagree;
                }
                else
                {
                    str = "";
                }
                cda.CacheUnicodeProp(hvoClosedFeature, m_dummyPolarityFlid, str, str.Length);
            }
        }
Exemple #4
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Tag used for a dummy int64 property which records, for texts parsed with no dummy annotations
 /// required, the most recent modify timestamp for any paragraph in the text. This determines
 /// for such texts whether the text requires re-parsing, by comparison with TextParseTimeStamp.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <returns></returns>
 /// ------------------------------------------------------------------------------------
 private static int ParagraphsModifiedTimestampTag(FdoCache cache)
 {
     return(DummyVirtualHandler.InstallDummyHandler(cache.VwCacheDaAccessor,
                                                    "StText", "ParagraphsModifiedTimestamp", (int)CellarModuleDefns.kcptTime).Tag);
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Configure a PublicationControl
        /// </summary>
        /// <param name="fAddSubStream">if set to <c>true</c> add subordinate stream.</param>
        /// <param name="fAddContent">if set to <c>true</c> add real content, otherwise add
        /// rectangle for paragraph.</param>
        /// ------------------------------------------------------------------------------------
        private void ConfigurePublication(bool fAddSubStream, bool fAddContent)
        {
            // When called for test setup, they will be null.
            // When called from within as test
            if (m_ScrPubCtrl != null)
            {
                m_ScrPubCtrl.Dispose();
            }
            if (m_division != null)
            {
                m_division.Dispose();
            }
            m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream,
                                                                        fAddContent), 1);

            FwStyleSheet styleSheet = new FwStyleSheet();

            styleSheet.Init(Cache, Cache.LangProject.TranslatedScriptureOAHvo,
                            (int)Scripture.ScriptureTags.kflidStyles);

            FootnoteVc footnoteVc = new FootnoteVc(-1, TeStVc.LayoutViewTarget.targetPrint,
                                                   Cache.DefaultVernWs);

            footnoteVc.Cache      = Cache;
            footnoteVc.Stylesheet = styleSheet;

            DummyPrintConfigurer configurer = m_division.Configurer as DummyPrintConfigurer;

            configurer.RootOnEachPage    = true;
            configurer.DependentRootFrag = (int)FootnoteFrags.kfrRootInPageSeq;
            configurer.DependentRootTag  = DummyVirtualHandler.InstallDummyHandler(Cache.VwCacheDaAccessor,
                                                                                   "Scripture", "FootnotesOnPage", (int)CellarModuleDefns.kcptReferenceSequence).Tag;
            configurer.StyleSheet      = styleSheet;
            configurer.DependentRootVc = footnoteVc;

            m_dbPub = new Publication(Cache,
                                      Cache.LangProject.TranslatedScriptureOA.PublicationsOC.HvoArray[0]);
            m_dbPub.BaseFontSize    = 12;
            m_dbPub.BaseLineSpacing = 15;
            PubDivision pubDiv = new PubDivision();

            m_dbPub.DivisionsOS.Append(pubDiv);
            pubDiv.PageLayoutOA = new PubPageLayout();
            pubDiv.NumColumns   = 1;
            pubDiv.StartAt      = DivisionStartOption.NewPage;

            m_ScrPubCtrl = new DummyScripturePublicationNoDb(m_dbPub, styleSheet, m_division, DateTime.Now,
                                                             m_filterInstance);

            m_ScrPubCtrl.IsLeftBound = true;

            // Set up the publication
            m_ScrPubCtrl.PageHeight  = 72000 * 11;         // 11 inches
            m_ScrPubCtrl.PageWidth   = (int)(72000 * 8.5); // 8.5 inches
            m_division.TopMargin     = 36000;              // Half inch
            m_division.BottomMargin  = 18000;              // Quarter inch
            m_division.InsideMargin  = 9000;               // 1/8 inch
            m_division.OutsideMargin = 4500;               // 1/16 inch
            m_ScrPubCtrl.Width       = 3 * 96;             // represents a window that is 3" wide at 96 DPI
            m_ScrPubCtrl.Configure();
        }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// When RootOnEachPage is true, this obtains the property of the dummy root object
 /// under which the dependent object IDs are stored.
 /// </summary>
 /// <param name="cache">FDO cache</param>
 /// <returns>Tag for dependent root object</returns>
 /// ------------------------------------------------------------------------------------
 public static int GetDependentRootTag(FdoCache cache)
 {
     return(DummyVirtualHandler.InstallDummyHandler(cache.VwCacheDaAccessor,
                                                    "Scripture", "FootnotesOnPage", (int)CellarModuleDefns.kcptReferenceSequence).Tag);
 }
Exemple #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This is the main interesting method of displaying objects and fragments of them.
        /// Scripture Footnotes are displayed by displaying each footnote's reference and text.
        /// The text is displayed using the standard view constructor for StText.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            CheckDisposed();

            switch (frag)
            {
            case (int)FootnoteFrags.kfrScripture:
            {
                vwenv.NoteDependency(new int[] { m_cache.LangProject.TranslatedScriptureOAHvo },
                                     new int[] { (int)Scripture.ScriptureTags.kflidScriptureBooks }, 1);
                vwenv.AddLazyVecItems(BooksTag, this, (int)FootnoteFrags.kfrBook);
                break;
            }

            case (int)FootnoteFrags.kfrRootInPageSeq:
            {
                int tag = DummyVirtualHandler.InstallDummyHandler(m_cache.VwCacheDaAccessor,
                                                                  "Scripture", "FootnotesOnPage",
                                                                  (int)CellarModuleDefns.kcptReferenceSequence).Tag;
                // Get the list of footnotes to display
                int[] hvos = m_cache.GetVectorProperty(hvo, tag, true);
                if (hvos.Length > 0)
                {
                    int ownerHvo = m_cache.GetOwnerOfObject(hvos[0]);
                    // The ownerHvo should be the HVO of the book
                    vwenv.NoteDependency(new int[] { ownerHvo },
                                         new int[] { (int)ScrBook.ScrBookTags.kflidFootnotes }, 1);
                }
                vwenv.AddObjVec(tag, this, (int)FootnoteFrags.kfrAllFootnotesWithinPagePara);
                break;
            }

            case (int)FootnoteFrags.kfrFootnoteWithinPagePara:
            {
                // Note a dependency on the footnote options so that the footnote will
                // be refreshed when these are changed.
                int[] depHvos = { hvo };
                int[] depTags = { StFootnote.ktagFootnoteOptions };
                vwenv.NoteDependency(depHvos, depTags, 1);

                // Insert the marker and reference
                vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteMarker);
                vwenv.AddObj(hvo, this, (int)StTextFrags.kfrFootnoteReference);

                // Insert (we hope only one) paragraph contents.
                vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this,
                                     (int)FootnoteFrags.kfrFootnoteParaWithinPagePara);
                break;
            }

            case (int)FootnoteFrags.kfrFootnoteParaWithinPagePara:
            {
                if (!InsertParaContentsUserPrompt(vwenv, hvo))
                {
                    // Display the text paragraph contents, or its user prompt.
                    vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null);
                }
                break;
            }

            case (int)FootnoteFrags.kfrBook:
            {
                vwenv.OpenDiv();
                vwenv.AddObjVecItems((int)ScrBook.ScrBookTags.kflidFootnotes, this,
                                     (int)StTextFrags.kfrFootnote);
                vwenv.CloseDiv();
                break;
            }

            case (int)StTextFrags.kfrFootnoteMarker:
            {
                ScrFootnote footnote = new ScrFootnote(Cache, hvo);
                if (footnote.DisplayFootnoteMarker)
                {
                    DisplayFootnoteMarker(vwenv, footnote);
                }
                break;
            }

            case (int)StTextFrags.kfrFootnoteReference:
            {
                ITsStrFactory   tsStrFactory = TsStrFactoryClass.Create();
                ITsPropsFactory tpf          = TsPropsFactoryClass.Create();
                ITsTextProps    ttp          = tpf.MakeProps(ScrStyleNames.FootnoteTargetRef, m_wsDefault, 0);

                ScrFootnote footnote    = new ScrFootnote(m_cache, hvo);
                string      footnoteRef = footnote.GetReference(m_wsDefault);
                ITsString   tssRef      = tsStrFactory.MakeStringWithPropsRgch(footnoteRef,
                                                                               footnoteRef.Length, ttp);
                vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
                                      (int)FwTextPropVar.ktpvEnum,
                                      (int)TptEditable.ktptNotEditable);
                vwenv.AddString(tssRef);
                break;
            }

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }