/// <summary>
        /// Creats a group object
        /// </summary>
        /// <returns>The Shape observer for the newly created group or <c>null</c>.</returns>
        private OoShapeObserver createGroup()
        {
            OoShapeObserver group = null;

            OoAccessibleDocWnd  draw = null;
            OoDrawPagesObserver doc  = null;
            OoDrawPageObserver  page = null;

            if (IsShapeSelected && LastSelectedShape != null)
            {
                page = LastSelectedShape.Page;
                doc  = page.PagesObserver;
                draw = doc.DocWnd;
            }
            else
            {
                // TODO: how to get those things
            }

            if (doc != null && draw != null && draw.DrawPageSupplier != null)
            {
                Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[DRAWING]\t[CREATE]\t" + "build group shape");
                var grpShape = OoDrawUtils.CreateGroupShape_anonymous(draw.DrawPageSupplier);
                OoUtils.SetStringProperty(grpShape, "Name", LL.GetTrans("tangram.oomanipulation.shape.group"));
                if (page != null && page.DrawPage_anonymouse != null)
                {
                    var pageObj = page.DrawPage_anonymouse;
                    OoDrawUtils.AddShapeToDrawPageUndoable(grpShape, pageObj, draw.DrawPageSupplier);
                    group = doc.RegisterNewShape(grpShape);
                }
            }

            return(group);
        }
        private bool setStringProperty(string name, string value)
        {
            string val = OoUtils.GetStringProperty(Shape as XPropertySet, name);

            if (val.Equals(value))
            {
                return(true);
            }
            try
            {
                //OoUtils.SetPropertyUndoable(Shape, name, value, getDocument() as XUndoManagerSupplier);
                OoUtils.SetStringProperty(Shape as XPropertySet, name, value);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write("exception during setting property " + ex);
            }
            string newVal = getStringProperty(name);

            return(newVal.Equals(value));
        }
예제 #3
0
        /// <summary>
        /// Sets the text value of a cell .
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="cellName">Name of the cell.</param>
        /// <param name="value">The value.</param>
        public static void SetCellTextValue(ref XTextTable table, string cellName, string value, string fontName = "Verdana", int charWeight = 100, short VertOrient = 1, int charHeight = 12, int paraAdjust = 0)
        {
            var a1 = table.getCellByName(cellName);

            if (a1 != null && a1 is XText)
            {
                // set the style of the cell
                // set style for the TextRange before inserting text content!
                var start = ((XTextRange)a1).getStart();
                if (start != null && start is XTextRange)
                {
                    //util.Debug.GetAllProperties(start);
                    OoUtils.SetStringProperty(start, "CharFontName", fontName);
                    OoUtils.SetProperty(start, "CharWeight", (float)charWeight);
                    OoUtils.SetProperty(a1, "VertOrient", VertOrient);
                    OoUtils.SetProperty(start, "CharHeight", charHeight);
                    OoUtils.SetProperty(start, "ParaAdjust", paraAdjust);
                }
                ((XText)a1).setString(value);
            }
        }