bool InitFloatingObjectsMovingResizing() { HitTestInformation savedHitTestInformation = GetHitInfo(); if (IsTouching) { savedHitTestInformation = _touchStartHitTestInfo; } if (((savedHitTestInformation.ViewportInfo == null) || (savedHitTestInformation.RowViewportIndex == -2)) || (savedHitTestInformation.ColumnViewportIndex == 2)) { return(false); } _floatingObjectsMovingResizingStartRow = savedHitTestInformation.ViewportInfo.Row; _floatingObjectsMovingResizingStartColumn = savedHitTestInformation.ViewportInfo.Column; _dragStartRowViewport = savedHitTestInformation.RowViewportIndex; _dragStartColumnViewport = savedHitTestInformation.ColumnViewportIndex; _dragToRowViewport = savedHitTestInformation.RowViewportIndex; _dragToColumnViewport = savedHitTestInformation.ColumnViewportIndex; _floatingObjectsMovingResizingStartPoint = savedHitTestInformation.HitPoint; SetActiveColumnViewportIndex(savedHitTestInformation.ColumnViewportIndex); SetActiveRowViewportIndex(savedHitTestInformation.RowViewportIndex); CachFloatingObjectsMovingResizingLayoutModels(); RowLayout viewportRowLayoutNearY = GetViewportRowLayoutNearY(_dragStartRowViewport, _floatingObjectsMovingResizingStartPoint.Y); ColumnLayout viewportColumnLayoutNearX = GetViewportColumnLayoutNearX(_dragToColumnViewport, _floatingObjectsMovingResizingStartPoint.X); _floatingObjectsMovingResizingStartPointCellBounds = new Rect(viewportColumnLayoutNearX.X, viewportRowLayoutNearY.Y, viewportColumnLayoutNearX.Width, viewportRowLayoutNearY.Height); _floatingObjectsMovingStartLocations = new Dictionary <string, Point>(); for (int i = 0; i < _movingResizingFloatingObjects.Count; i++) { IFloatingObject obj2 = _movingResizingFloatingObjects[i]; _floatingObjectsMovingStartLocations.Add(obj2.Name, obj2.Location); } return(true); }
void ArrangeFloatingObjects() { if (_cachedFloatingObjects.Count == 0) { return; } FloatingObjectLayoutModel viewportFloatingObjectLayoutModel = ParentViewport.Excel.GetViewportFloatingObjectLayoutModel(RowViewportIndex, ColumnViewportIndex); foreach (FloatingObjectContainer container in _cachedFloatingObjects.Values) { IFloatingObject floatingObject = container.FloatingObject; Point location = new Point(0.0, 0.0); Size size = new Size(0.0, 0.0); FloatingObjectLayout layout = viewportFloatingObjectLayoutModel.Find(floatingObject.Name); if (layout != null) { double num = 7.0; double num2 = 1.0; location = new Point(((layout.X - Location.X) - num) - num2, ((layout.Y - Location.Y) - num) - num2); size = new Size(layout.Width + (2.0 * num), layout.Height + (2.0 * num)); } #if !IOS container.InvalidateArrange(); #endif container.Arrange(new Rect(location, size)); } }
void ReplaceObject(string name, T floatingObject) { int index = -1; for (int i = 0; i < base.Items.Count; i++) { IFloatingObject obj2 = base.Items[i]; if ((obj2 != null) && (obj2.Name == name)) { index = i; break; } } this.ReplaceObject(index, floatingObject); }