コード例 #1
0
ファイル: FloatingObjectLayer.cs プロジェクト: Daoting/dt
        void ArrangePictures()
        {
            if (_cachedPictures.Count == 0)
            {
                return;
            }

            FloatingObjectLayoutModel viewportFloatingObjectLayoutModel = ParentViewport.Excel.GetViewportFloatingObjectLayoutModel(RowViewportIndex, ColumnViewportIndex);

            foreach (PictureContainer container in _cachedPictures.Values)
            {
                FloatingObject       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));
            }
        }
コード例 #2
0
ファイル: FloatingObjectLayer.cs プロジェクト: Daoting/dt
        void MeasurePictures()
        {
            var pictures = ActiveSheet.Pictures;

            if (pictures.Count == 0)
            {
                if (_cachedPictures.Count > 0)
                {
                    _cachedPictures.Clear();
                }
                return;
            }

            var oldPics = _cachedPictures;

            _cachedPictures = new Dictionary <string, PictureContainer>();
            FloatingObjectLayoutModel viewportFloatingObjectLayoutModel = ParentViewport.Excel.GetViewportFloatingObjectLayoutModel(RowViewportIndex, ColumnViewportIndex);

            for (int i = 0; i < pictures.Count; i++)
            {
                PictureContainer container;
                Picture          picture = pictures[i];
                if (!oldPics.TryGetValue(picture.Name, out container))
                {
                    container = new PictureContainer(picture, ParentViewport);
                    int maxZIndex = GetMaxZIndex();
                    Canvas.SetZIndex(container, maxZIndex + 1);
                    Children.Add(container);
                }
                else
                {
                    oldPics.Remove(picture.Name);
                }
                _cachedPictures.Add(picture.Name, container);

                Size empty = _szEmpty;
                FloatingObjectLayout layout = viewportFloatingObjectLayoutModel.Find(picture.Name);
                if (layout != null)
                {
                    double num3 = 7.0;
                    empty = new Size(layout.Width + (2.0 * num3), layout.Height + (2.0 * num3));
                }

#if !IOS
                container.InvalidateMeasure();
#endif
                container.Measure(empty);
            }

            if (oldPics.Count > 0)
            {
                foreach (var item in oldPics)
                {
                    Children.Remove(item.Value);
                }
            }
        }
コード例 #3
0
ファイル: FloatingObjectLayer.cs プロジェクト: Daoting/dt
        void MeasureCharts()
        {
            var charts = ActiveSheet.Charts;

            if (charts.Count == 0)
            {
                if (_cachedCharts.Count > 0)
                {
                    _cachedCharts.Clear();
                }
                return;
            }

            var oldCharts = _cachedCharts;

            _cachedCharts = new Dictionary <string, SpreadChartContainer>();
            FloatingObjectLayoutModel layoutModel = ParentViewport.Excel.GetViewportFloatingObjectLayoutModel(RowViewportIndex, ColumnViewportIndex);

            for (int i = 0; i < charts.Count; i++)
            {
                SpreadChartContainer container;
                SpreadChart          chart = charts[i];
                if (!oldCharts.TryGetValue(chart.Name, out container))
                {
                    container = new SpreadChartContainer(chart, new Chart(), ParentViewport);
                    int maxZIndex = GetMaxZIndex();
                    Canvas.SetZIndex(container, maxZIndex + 1);
                    Children.Add(container);
                }
                else
                {
                    oldCharts.Remove(chart.Name);
                }
                _cachedCharts.Add(chart.Name, container);

                Size size = _szEmpty;
                FloatingObjectLayout layout = layoutModel.Find(chart.Name);
                if (layout != null)
                {
                    double num3 = 7.0;
                    size = new Size(layout.Width + (2.0 * num3), layout.Height + (2.0 * num3));
                }
#if !IOS
                container.InvalidateMeasure();
#endif
                container.Measure(size);
            }

            if (oldCharts.Count > 0)
            {
                foreach (var item in oldCharts)
                {
                    Children.Remove(item.Value);
                }
            }
        }
コード例 #4
0
ファイル: FloatingObjectLayer.cs プロジェクト: Daoting/dt
        void MeasureFloatingObjects()
        {
            var floatingObjects = ActiveSheet.FloatingObjects;

            if (floatingObjects.Count == 0)
            {
                if (_cachedFloatingObjects.Count > 0)
                {
                    _cachedFloatingObjects.Clear();
                }
                return;
            }

            var oldObjects = _cachedFloatingObjects;

            _cachedFloatingObjects = new Dictionary <string, FloatingObjectContainer>();
            FloatingObjectLayoutModel viewportFloatingObjectLayoutModel = ParentViewport.Excel.GetViewportFloatingObjectLayoutModel(RowViewportIndex, ColumnViewportIndex);

            for (int i = 0; i < floatingObjects.Count; i++)
            {
                FloatingObjectContainer container;
                FloatingObject          floatingObject = floatingObjects[i];
                if (!oldObjects.TryGetValue(floatingObject.Name, out container))
                {
                    FrameworkElement content = null;
                    if (floatingObject is CustomFloatingObject)
                    {
                        content = (floatingObject as CustomFloatingObject).Content;
                    }
                    container = new FloatingObjectContainer(floatingObject, ParentViewport);
                    if (content != null)
                    {
                        container.Content = content;
                    }
                    int maxZIndex = GetMaxZIndex();
                    Canvas.SetZIndex(container, maxZIndex + 1);
                    Children.Add(container);
                }
                else
                {
                    oldObjects.Remove(floatingObject.Name);
                }
                _cachedFloatingObjects.Add(floatingObject.Name, container);

                Size empty = _szEmpty;
                FloatingObjectLayout layout = viewportFloatingObjectLayoutModel.Find(floatingObject.Name);
                if (layout != null)
                {
                    double num3 = 7.0;
                    empty = new Size(layout.Width + (2.0 * num3), layout.Height + (2.0 * num3));
                }
#if !IOS
                container.InvalidateMeasure();
#endif
                container.Measure(empty);
            }

            if (oldObjects.Count > 0)
            {
                foreach (var item in oldObjects)
                {
                    Children.Remove(item.Value);
                }
            }
        }