⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rvitem.pas

📁 richview1.7 full.source
💻 PAS
📖 第 1 页 / 共 5 页
字号:
end;
{------------------------------------------------------------------------------}
procedure TCustomRVItemInfo.UpdateStyles(TextStylesShift,
  ParaStylesShift, ListStylesShift: TRVIntegerList);
begin
  dec(ParaNo,ParaStylesShift[ParaNo]-1);
end;
{------------------------------------------------------------------------------}
function TCustomRVItemInfo.GetSubRVData(var StoreState: TRVStoreSubRVData;
                                         Position: TRVSubRVDataPos): TPersistent;
begin
  Result := nil;
  StoreState := nil;
end;
{------------------------------------------------------------------------------}
procedure TCustomRVItemInfo.ChooseSubRVData(StoreState: TRVStoreSubRVData);
begin
  // nothing to do here
end;
{------------------------------------------------------------------------------}
procedure TCustomRVItemInfo.CleanUpChosen;
begin
  // nothing to do here
end;
{------------------------------------------------------------------------------}
procedure TCustomRVItemInfo.ResetSubCoords;
begin
  // nothing to do here
end;
{------------------------------------------------------------------------------}
function TCustomRVItemInfo.SetExtraIntProperty(Prop: TRVExtraItemProperty; Value: Integer): Boolean;
begin
  Result := False;
end;
{------------------------------------------------------------------------------}
function TCustomRVItemInfo.GetExtraIntProperty(Prop: TRVExtraItemProperty; var Value: Integer): Boolean;
begin
  Result := False;
end;
{------------------------------------------------------------------------------}
function TCustomRVItemInfo.GetSoftPageBreakDY(Data: Integer): Integer;
begin
  Result := Data;
end;
{============================= TRVNonTextItemInfo =============================}
procedure TRVNonTextItemInfo.AdjustInserted(x, y: Integer; adjusty: Boolean);
begin
  // nothing to do here
end;
{------------------------------------------------------------------------------}
function TRVNonTextItemInfo.GetHeight: Integer;
begin
  Result := 0;
end;
{------------------------------------------------------------------------------}
function TRVNonTextItemInfo.GetWidth: Integer;
begin
  Result := 0;
end;
{------------------------------------------------------------------------------}
function TRVNonTextItemInfo.GetLeftOverhang: Integer;
begin
  Result := 0;
end;
{------------------------------------------------------------------------------}
procedure TRVNonTextItemInfo.SetExtraPropertyFromRVFStr(const Str: String);
var PropName: String;
    PropVal: Integer;
    p: Integer;
begin
  p := Pos('=', Str);
  if p=0 then
    exit;
  PropName := Copy(Str,1,p-1);
  PropVal  := StrToIntDef(Copy(Str,p+1, Length(Str)),0);
  SetExtraIntProperty(GetRVFExtraPropertyByName(PropName), PropVal);
end;
{=========================== TRVFullLineItemInfo ==============================}
function TRVFullLineItemInfo.GetBoolValue(Prop: TRVItemBoolProperty): Boolean;
begin
  case Prop of
    rvbpFullWidth:
      Result := True;
    else
      Result := inherited GetBoolValue(Prop);
  end;
end;
{------------------------------------------------------------------------------}
function TRVFullLineItemInfo.GetBorderHeight: Integer;
begin
  Result := 0;
end;
{------------------------------------------------------------------------------}
function TRVFullLineItemInfo.GetBorderWidth: Integer;
begin
  Result := 0;
end;
{=============================== TRVRectItemInfo ==============================}
procedure TRVRectItemInfo.Assign(Source: TCustomRVItemInfo);
begin
  if Source is TRVRectItemInfo then begin
    VAlign := TRVRectItemInfo(Source).VAlign;
    VShift := TRVRectItemInfo(Source).VShift;
  end;
  inherited Assign(Source);
end;
{------------------------------------------------------------------------------}
function TRVRectItemInfo.GetDescent: Integer;
begin
  Result := 1;
end;
{------------------------------------------------------------------------------}
function TRVRectItemInfo.ReadRVFHeader(var P: PChar;
  RVData: TPersistent): Boolean;
var va: Integer;
begin
  Result := True;
  if not (P^ in [#0, #10, #13]) then begin
    Result := RVFReadInteger(P,va);
    if Result then
      VAlign := TRVVAlign(va);
    end
  else
    VAlign := rvvaBaseLine;
end;
{------------------------------------------------------------------------------}
function TRVRectItemInfo.SaveRVFHeaderTail(RVData: TPersistent): String;
begin
  Result := IntToStr(ord(VAlign));
end;
{------------------------------------------------------------------------------}
function TRVRectItemInfo.GetRVFExtraPropertyCount: Integer;
begin
  Result := inherited GetRVFExtraPropertyCount;
  if VShift<>0 then
    inc(Result);
  if VShiftAbs then
    inc(Result);  
end;
{------------------------------------------------------------------------------}
procedure TRVRectItemInfo.SaveRVFExtraProperties(Stream: TStream);
begin
  if VShift<>0 then
    RVFWriteLine(Stream, Format('vshift=%d',[VShift]));
  if VShiftAbs then
    RVFWriteLine(Stream, 'vshiftabs=1');
end;
{------------------------------------------------------------------------------}
function TRVRectItemInfo.GetVShiftCSS(RVStyle: TRVStyle): String;
begin
  Result := '';
  if (VShift=0) or (GetImageHeight(RVStyle)=0) or (VAlign<>rvvaBaseLine) then
    exit;
  if VShiftAbs then
    Result := Format('vertical-align : %d', [VShift])
  else
    Result := Format('vertical-align : %d', [MulDiv(GetImageHeight(RVStyle),VShift,100)])
end;
{------------------------------------------------------------------------------}
function TRVRectItemInfo.SetExtraIntProperty(Prop: TRVExtraItemProperty; Value: Integer): Boolean;
begin
  case Prop of
    rvepVShift:
      begin
        VShift := Value;
        Result := True;
      end;
    rvepVShiftAbs:
      begin
        VShiftAbs := Value<>0;
        Result := True;
      end;
    else
      Result := inherited SetExtraIntProperty(Prop, Value);
  end;
end;
{------------------------------------------------------------------------------}
function TRVRectItemInfo.GetExtraIntProperty(Prop: TRVExtraItemProperty; var Value: Integer): Boolean;
begin
  case Prop of
    rvepVShift:
      begin
        Value := VShift;
        Result := True;
      end;
    rvepVShiftAbs:
      begin
        Value := ord(VShiftAbs);
        Result := True;
      end;
    else
      Result := inherited GetExtraIntProperty(Prop, Value);
  end;
end;
{================================ TRVControlItemInfo ==========================}
constructor TRVControlItemInfo.CreateEx(RVData: TPersistent; AControl: TControl; AVAlign: TRVVAlign);
begin
  inherited Create(RVData);
  StyleNo  := rvsComponent;
  Control  := AControl;
  VAlign   := AVAlign;
end;
{------------------------------------------------------------------------------}
destructor TRVControlItemInfo.Destroy;
begin
  Control.Free;
  inherited Destroy;
end;
{------------------------------------------------------------------------------}
procedure TRVControlItemInfo.AdjustInserted(x, y: Integer; adjusty: Boolean);
begin
  Control.Left := x+1;
  Control.Tag  := y+1;
  if adjusty then
    RV_Tag2Y(Control);
  Control.Visible := True;    
end;
{------------------------------------------------------------------------------}
function TRVControlItemInfo.GetHeight: Integer;
begin
  Result := Control.Height+2;
end;
{------------------------------------------------------------------------------}
function TRVControlItemInfo.GetImageHeight(RVStyle: TRVStyle): Integer;
begin
  Result := Control.Height;
end;
{------------------------------------------------------------------------------}
function TRVControlItemInfo.GetWidth: Integer;
begin
  Result := Control.Width+2;
end;
{------------------------------------------------------------------------------}
function TRVControlItemInfo.GetImageWidth(RVStyle: TRVStyle): Integer;
begin
  Result := Control.Width;
end;
{------------------------------------------------------------------------------}
function TRVControlItemInfo.GetMinWidth(sad: PRVScreenAndDevice; Canvas: TCanvas;
                                        RVData: TPersistent): Integer;
begin
  if PercentWidth<>0 then
    Result := 20
  else
    Result := Control.Width+2;
  if sad<>nil then
    Result := MulDiv(Result, sad.ppixDevice, sad.ppixScreen);
end;
{------------------------------------------------------------------------------}
function TRVControlItemInfo.CreatePrintingDrawItem(RVData: TObject; const sad: TRVScreenAndDevice): TRVDrawLineInfo;
begin
  if not GetBoolValueEx(rvbpPrintToBMP, nil) or (MinHeightOnPage=0) then begin
    Result := TRVDrawLineInfo.Create;
    exit;
  end;
  Result := TRVMultiImagePrintInfo.Create(Self);
  Result.Width  := MulDiv(GetWidth, sad.ppixDevice, sad.ppixScreen);
  Result.Height := MulDiv(GetHeight, sad.ppiyDevice, sad.ppiyScreen);
  TRVMultiImagePrintInfo(Result).sad := sad;
end;
{------------------------------------------------------------------------------}
function TRVControlItemInfo.PrintToBitmap(Bkgnd: TBitmap;
                                           Preview: Boolean; RichView: TRVScroller;
                                           dli: TRVDrawLineInfo;
                                           Part: Integer): Boolean;
var ctrlbmp: TBitmap;
    Top: Integer;
begin
  Result := False;
  ctrlbmp := nil;
  if Assigned(TPrintableRV(RichView).RVPrint.OnPrintComponent) then
    TPrintableRV(RichView).RVPrint.OnPrintComponent(TPrintableRV(RichView).RVPrint, Control, ctrlbmp)
  else
    ctrlbmp := DrawControl(Control);
  if (dli is TRVMultiImagePrintInfo) and (Part>=0) then
    Top := -TRVImagePrintPart(TRVMultiImagePrintInfo(dli).PartsList[Part]).ImgTop
  else
    Top := 0;
  if (ctrlbmp<>nil) then
    try
      Result := True;
      if MinHeightOnPage<=0 then begin
        if ctrlbmp.Width>bkgnd.Width then
          bkgnd.Width := ctrlbmp.Width;
        if ctrlbmp.Height>bkgnd.Height then
          bkgnd.Height := ctrlbmp.Height;
        Bkgnd.Canvas.Draw((Bkgnd.Width-ctrlbmp.Width) div 2,
          (Bkgnd.Height-ctrlbmp.Height) div 2, ctrlbmp);
        end
      else
        Bkgnd.Canvas.Draw(0, Top, ctrlbmp);
    finally
      ctrlbmp.Free;
    end;
end;
{------------------------------------------------------------------------------}
proc

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -