Exemplo n.º 1
0
        public ExportDialog(Mediator mediator)
        {
            m_mediator = mediator;
            m_cache    = (FdoCache)mediator.PropertyTable.GetValue("cache");

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            m_helpTopic = "khtpExportLexicon";

            this.helpProvider = new System.Windows.Forms.HelpProvider();
            this.helpProvider.HelpNamespace = FwApp.App.HelpFile;
            this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0));
            this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);

            // Determine whether we can support "configured" type export by trying to obtain
            // the XmlVc for an XmlDocView.  Also obtain the database id and class id of the
            // root object.

            object objCurrentControl;

            objCurrentControl = m_mediator.PropertyTable.GetValue("currentContentControlObject", null);
            //XmlDocView docView = objCurrentControl as XmlDocView;
            //if (docView == null)
            //{
            //    XCore.MultiPane xmp = objCurrentControl as XCore.MultiPane;
            //    if (xmp != null)
            //        docView = xmp.FirstVisibleControl as XmlDocView;
            //}
            XmlDocView docView = FindXmlDocView(objCurrentControl as Control);

            if (docView != null)
            {
                m_seqView = docView.Controls[0] as XmlSeqView;
            }
            if (m_seqView != null)
            {
                m_xvc = m_seqView.Vc;
            }

            CmObject cmo = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject", null)
                           as CmObject;

            if (cmo != null)
            {
                m_hvoRootObj = cmo.OwnerHVO;
                if (m_hvoRootObj != 0)
                {
                    m_clidRootObj = m_cache.GetClassOfObject(m_hvoRootObj);
                }
            }

            m_chkExportPictures.Checked = false;
            m_chkExportPictures.Visible = false;
            m_chkExportPictures.Enabled = false;
            m_fExportPicturesAndMedia   = false;
        }
Exemplo n.º 2
0
		public ExportDialog(Mediator mediator)
		{
			m_mediator = mediator;
			m_cache = (FdoCache)mediator.PropertyTable.GetValue("cache");

			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			m_helpTopic = "khtpExportLexicon";

			this.helpProvider = new System.Windows.Forms.HelpProvider();
			this.helpProvider.HelpNamespace = FwApp.App.HelpFile;
			this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0));
			this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);

			// Determine whether we can support "configured" type export by trying to obtain
			// the XmlVc for an XmlDocView.  Also obtain the database id and class id of the
			// root object.

			object objCurrentControl;
			objCurrentControl = m_mediator.PropertyTable.GetValue("currentContentControlObject", null);
			//XmlDocView docView = objCurrentControl as XmlDocView;
			//if (docView == null)
			//{
			//    XCore.MultiPane xmp = objCurrentControl as XCore.MultiPane;
			//    if (xmp != null)
			//        docView = xmp.FirstVisibleControl as XmlDocView;
			//}
			XmlDocView docView = FindXmlDocView(objCurrentControl as Control);
			if (docView != null)
				m_seqView = docView.Controls[0] as XmlSeqView;
			if (m_seqView != null)
				m_xvc = m_seqView.Vc;

			CmObject cmo = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject", null)
				as CmObject;
			if (cmo != null)
			{
				m_hvoRootObj = cmo.OwnerHVO;
				if (m_hvoRootObj != 0)
					m_clidRootObj = m_cache.GetClassOfObject(m_hvoRootObj);
			}

			m_chkExportPictures.Checked = false;
			m_chkExportPictures.Visible = false;
			m_chkExportPictures.Enabled = false;
			m_fExportPicturesAndMedia = false;
		}
Exemplo n.º 3
0
        /// <summary>
        /// Return whether it is OK to move the objects indicated by odi to the specified destination.
        /// </summary>
        /// <param name="hvoDstOwner"></param>
        /// <param name="flidDst"></param>
        /// <param name="ihvoDstStart"></param>
        /// <param name="odi"></param>
        /// <returns></returns>
        public bool OkToMove(int hvoDstOwner, int flidDst, int ihvoDstStart, ObjectDragInfo odi)
        {
            CheckDisposed();

            FDO.FdoCache cache = Slice.ContainingDataTree.Cache;
            if (flidDst == odi.FlidSrc)
            {
                // Verify that it is not a no-operation.
                if (hvoDstOwner == odi.HvoSrcOwner)
                {
                    // Same property of same object. If it's a collection, disable.
                    FieldType fieldType = cache.GetFieldType(flidDst);
                    // We can't drag it to the position it's already at; that's no change. We also can't drag it
                    // to the position one greater: that amounts to trying to place it after itself, which (after
                    // removing it from before itself) amounts to a no-operation.
                    if (fieldType == FieldType.kcptOwningSequence &&
                        ihvoDstStart != odi.IhvoSrcStart && ihvoDstStart != odi.IhvoSrcStart + 1)
                    {
                        // It's a sequence and the target and source positions are different, so we can do it.
                        return(true);
                    }
                }
                else
                {
                    // Different objects; need to verify no circular ownership involved.
                    for (int ihvo = odi.IhvoSrcStart; ihvo <= odi.IhvoSrcEnd; ihvo++)
                    {
                        int hvo = cache.GetVectorItem(odi.HvoSrcOwner, odi.FlidSrc, ihvo);
                        // See if hvoDstOwner is owned by hvo
                        int hvo2 = hvoDstOwner;
                        // loop from hvo2 to root owner of hvo2. If hvo2 or any of its owners is hvo,
                        // we have a problem.
                        while (hvo2 != 0)
                        {
                            if (hvo == hvo2)
                            {
                                return(false);                                // circular ownership, can't drop.
                            }
                            hvo2 = cache.GetOwnerOfObject(hvo2);
                        }
                    }
                    return(true);
                }
            }
            else
            {
                // Different property, check signature.
                IFwMetaDataCache mdc    = cache.MetaDataCacheAccessor;
                uint             luclid = mdc.GetDstClsId((uint)flidDst);
                for (int ihvo = odi.IhvoSrcStart; ihvo <= odi.IhvoSrcEnd; ihvo++)
                {
                    int  hvo = cache.GetVectorItem(odi.HvoSrcOwner, odi.FlidSrc, ihvo);
                    uint cls = (uint)cache.GetClassOfObject(hvo);
                    while (cls != 0 && cls != luclid)
                    {
                        cls = mdc.GetBaseClsId(cls);
                    }
                    if (cls == 0)
                    {
                        return(false);                        // wrong signature, can't drop.
                    }
                }
                // All sigs OK, allow drop.
                return(true);
            }
            // If none of those cases is OK, can't do it.
            return(false);
        }