RichObject CreateImageObject(const Image& img, int cx, int cy) { RichObject o = RichObject("image", StoreImageAsString(img)); if(cx || cy) o.SetSize(GetRatioSize(o.GetPixelSize(), cx, cy)); return o; }
void RichTxt::SaveFormat(Formating& r, int p1, int p2, const RichStyles& style) const { Array<RichObject> dummy; for(int i = p1; i <= p2; i++) if(IsTable(i)) { const RichTable& tab = part[i].Get<RichTable>(); for(int i = 0; i < tab.GetRows(); i++) for(int j = 0; j < tab.GetColumns(); j++) if(tab(i, j)) { const RichTxt& txt = tab[i][j].text; txt.SaveFormat(r, 0, txt.GetPartCount() - 1, style); } } else { RichPara pa = Get(i, style); for(int i = 0; i < pa.GetCount(); i++) { RichPara::Part& p = pa[i]; int q = p.GetLength(); p.field = Id(); p.object = RichObject(); WString h; while(q) { int c = min(q, 50000); h.Cat(c + 32); q -= c; } p.text = h; } r.styleid.Add(pa.format.styleid); r.format.Add(pa.Pack(GetStyle(style, pa.format.styleid).format, dummy)); } }
RichObject CreateRawImageObject(const String& s, int cx, int cy) { RichObject o = RichObject("rawimage", s); o.InitSize(cx, cy); return o; }