/// <summary> /// Initializes a new instance of the <see cref="OoDrawPagesObserver"/> class. /// </summary> /// <param name="dp">The Draw document.</param> /// <param name="doc">The document related accessibility component.</param> /// <param name="docWnd">The related document accessible window component.</param> public OoDrawPagesObserver(XDrawPagesSupplier dp, OoAccComponent doc, OoAccessibleDocWnd docWnd = null) { this.PagesSupplier = dp; Document = doc; DocWnd = docWnd; // get Zoom and ViewOffset first time if (Controller != null) { if (Controller is XPropertySet) { refreshDrawViewProperties((XPropertySet)(Controller)); } // try to get dpi settings from openoffice XWindow componentWindow = Controller.ComponentWindow; if (componentWindow != null && componentWindow is XDevice) { DeviceInfo deviceInfo = (DeviceInfo)((XDevice)componentWindow).getInfo(); if (deviceInfo != null) { PixelPerMeterX = deviceInfo.PixelPerMeterX; PixelPerMeterY = deviceInfo.PixelPerMeterY; } } } // register for Zoom and ViewOffset updates addVisibleAreaPropertyChangeListener(); if (this.PagesSupplier != null) { List <XDrawPage> dpL = OoDrawUtils.DrawDocGetXDrawPageList(dp); if (PagesSupplier is unoidl.com.sun.star.frame.XTitle) { Title = ((unoidl.com.sun.star.frame.XTitle)PagesSupplier).getTitle(); } Logger.Instance.Log(LogPriority.DEBUG, this, "create DrawPagesObserver for supplier " + dp.GetHashCode() + " width title '" + Title + "' - having " + dpL.Count + " pages"); //FIXME: Do this if the api enable parallel access //Parallel.ForEach(dpL, (drawPage) => //{ // OoDrawPageObserver dpobs = new OoDrawPageObserver(drawPage, this); // DrawPageobservers[drawPage] = dpobs; // DrawPages.Add(dpobs); //}); foreach (var drawPage in dpL) { OoDrawPageObserver dpobs = new OoDrawPageObserver(drawPage, this); RegisterDrawPage(dpobs); } XModifyBroadcaster mdfBc = PagesSupplier as XModifyBroadcaster; if (mdfBc != null) { mdfBc.addModifyListener(eventForwarder); } } }
public DrawDocLayerManager(XLayerSupplier drwaDoc) { if (drwaDoc == null) { throw new ArgumentNullException("drwaDoc", "The XLayerSupplier is null"); } _layerManger = drwaDoc.getLayerManager(); XModifyBroadcaster debc = drwaDoc as XModifyBroadcaster; if (debc != null) { ((XModifyBroadcaster)drwaDoc).addModifyListener(this); } }