Exemplo n.º 1
0
        /// <summary>
        /// CreateFromData
        /// </summary>
        internal TNoteRecord(int aRow, int aCol, TRichString aTxt, string aAuthor, TDrawing Drawing, TImageProperties Properties,
                             ExcelFile xls, TSheet sSheet, bool ReadFromXlsx)
            : base((int)xlr.NOTE, aCol)
        {
            if ((aCol < 0) || (aCol > FlxConsts.Max_Columns))
            {
                XlsMessages.ThrowException(XlsErr.ErrXlsIndexOutBounds, aCol, "Column", 0, FlxConsts.Max_Columns);
            }

            Dwg = Drawing.AddNewComment(xls, Properties, sSheet, ReadFromXlsx);
            TEscherImageAnchorRecord Anchor = GetImageRecord();

            if (Anchor != null)
            {
                NoteTextBox = Anchor.SaveCommentCoords(sSheet, aRow, aCol);
            }

            Col         = aCol;
            OptionFlags = 0;   //option flags
            unchecked
            {
                ObjId = (UInt16)Dwg.ObjId;   //object id
            }

            Author = aAuthor;

            SetText(aTxt);
        }
Exemplo n.º 2
0
 private TEscherImageAnchorRecord GetImageRecord()
 {
     if (Dwg == null)
     {
         return(null);
     }
     else
     {
         TEscherRecord R = Dwg.FindRoot();
         if (R == null)
         {
             return(null);
         }
         else
         {
             R = R.FindRec <TEscherImageAnchorRecord>();
             if (R == null)
             {
                 return(null);
             }
             else
             {
                 TEscherImageAnchorRecord Anchor = ((TEscherImageAnchorRecord)R);
                 return(Anchor);
             }
         }
     }
 }
Exemplo n.º 3
0
        internal void FixDwgOfs(int Row, TSheet dSheet)
        {
            TEscherImageAnchorRecord Anchor = GetImageRecord();

            if (Anchor != null)
            {
                AdaptSize(Anchor, Row, dSheet);
            }
        }
Exemplo n.º 4
0
        internal TClientAnchor GetAnchor(int Row, TSheet dSheet)
        {
            TEscherImageAnchorRecord Anchor = GetImageRecord();

            if (Anchor == null)
            {
                return(new TClientAnchor());
            }
            AdaptSize(Anchor, Row, dSheet);
            return(Anchor.GetAnchor());
        }
Exemplo n.º 5
0
/*Now we keep range to insert on dwgofs. Inserting here could lead to inserting rows on the cells (and moving the red triangle down), but not on the note. Both must move together.
 *         internal override void ArrangeInsertRange(int Row, TXlsCellRange CellRange, int aRowCount, int aColCount, TSheetInfo SheetInfo)
 *      {
 *          if ((SheetInfo.InsSheet<0) || (SheetInfo.SourceFormulaSheet != SheetInfo.InsSheet)) return;  //this is also on the base.arrangeinsertrange, but we want to keep both inserts together. If we insert on the red triangle, we insert on the shape. If we don't we don't no matter that the shape is on range to insert.
 *
 *          base.ArrangeInsertRange (Row, CellRange, aRowCount, aColCount, SheetInfo);
 *          if ((Dwg!=null) && (Dwg.FindRoot()!=null))
 *          {
 *              Dwg.FindRoot().ArrangeInsertRange(CellRange, aRowCount, aColCount, SheetInfo, true);
 *          }
 *      }
 */
        internal void FixDwgIds(TDrawing Drawing, int Row, TSheet sSheet, bool UseObjId, TCopiedGen CopiedGen)
        {
            if (UseObjId)
            {
                Dwg = Drawing.FindObjId(ObjId);
            }
            else
            {
                if (Dwg != null)
                {
                    Dwg = Dwg.CopiedTo(CopiedGen) as TEscherClientDataRecord;
                }
                if (Dwg != null)
                {
                    ObjId = (UInt16)Dwg.ObjId;
                }
            }
            TEscherImageAnchorRecord Anchor = GetImageRecord();

            if (Anchor != null)
            {
                NoteTextBox = Anchor.SaveCommentCoords(sSheet, Row, Col);
            }
        }
Exemplo n.º 6
0
 private void AdaptSize(TEscherImageAnchorRecord Anchor, int Row, TSheet dSheet)
 {
     Anchor.RestoreCommentCoords(NoteTextBox, dSheet, Row, Col);
 }