trichview.com

trichview.support




Re: RichViewEdit + dynamic array


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/15/2004 22:48:31


Ok, in any case, it would be two step procedure.


I assume that all pictures have unique identifiers allowing to link RichView

picture items with the propert picture in array (otherwise you cannot use

OnRVFPictureNeeded).

This identifier can be stored either in item name or item tag.


1) You need to load document in RichView

In OnRVFPictureNeeded you need to provide some picture for the removed

pictures.

2) Delete the removed pictures from the document using this procedure

(it deletes all pictures, so you need to add a check which pictures to

delete).




procedure DeletePictures(RVData: TCustomRVData);

var i, r, c: Integer;

    table: TRVTableItemInfo;

    SAP, BR, PB: Boolean;

begin

  for i := RVData.ItemCount-1 downto 0 do begin

    if i>=RVData.ItemCount then

      continue;

    case RVData.GetItemStyle(i) of

      rvsPicture:

        begin

          // check if this picture must be deleted. If yes, then

          SAP := RVData.GetItem(i).SameAsPrev;

          BR  := RVData.GetItem(i).BR;

          PB  := RVData.PageBreaksBeforeItems[i];

          RVData.DeleteItems(i, 1);

          if not SAP and (i<RVData.ItemCount) and

RVData.GetItem(i).SameAsPrev then begin

            // moving line break (and related properties) from the deleted

            // picture to the next item after it

            RVData.GetItem(i).SameAsPrev := SAP;

            RVData.GetItem(i).BR := BR;

            RVData.PageBreaksBeforeItems[i] := PB;

            end

          else if (i<>0) and (RVData.GetItemStyle(i-1)=rvsListMarker) and

            ((i=RVData.ItemCount) or not RVData.GetItem(i).SameAsPrev) then

begin

            // list marker without other items in paragraph is disallowed

            RVData.DeleteItems(i-1, 1);

          end;

        end;

      rvsTable:

        begin

          table := TRVTableItemInfo(RVData.GetItem(i));

          for r := 0 to table.Rows.Count-1 do

            for c := 0 to table.Rows[r].Count-1 do

              if table.Cells[r,c]<>nil then

                DeletePictures(table.Cells[r,c].GetRVData);

        end;

    end;

  end;

end;


>

> I can't show any "missing picture". I want to delete whole image item. Any

> idea?

>

> "Sergey Tkachenko" <[email protected]> wrote:

> >May be an alternative solution is acceptable?

> >Do not delete pictures from editors, but when loading document containing

> >missing pictures show special "missing picture" images in their place?

It's

> >easy to do, beacuse you return images in OnRVFPictureNeeded.

> >

> >>

> >> Hi,

> >> I have one RichViewEdit + dynamic array of TMemoryStream + dynamic

array

> >> of images.

> >> Example:

> >> 1) adding a picture (only pointer <- rvfoSavePictureBody = false) from

> >array

> >> 2) saving RichViewEdit to array (TMemoryStream)

> >> 3) loading other element of a array to RichViewEdit

> >> 4) adding the same picture

> >> .. and so on

> >> This is not a problem but if I delete picture from array I would like

> to

> >> delete added item (rvsPicture) in whole array where are RichViewEdits

> >saved.

> >> Any Idea? Please help.

> >

> >

>





Powered by ABC Amber Outlook Express Converter