📄 fuqexport4odteditor.pas
字号:
begin
DecLeftAndTop(pbTextHighlight);
end;
procedure TfmQExport4ODTEditor.pbTextHighlightPaint(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if not FCurrTextStyle.AllowHighlight then Exit;
PaintStandardColors(pbTextHighlight, FCurrTextStyle.HighlightColor);
end;
procedure TfmQExport4ODTEditor.btnCellColorClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if ColorDialog.Execute then
if ColorDialog.Color <> -1 then
FCurrCellStyle.Font.Color := ColorDialog.Color
else
FCurrCellStyle.Font.Color := clBlack;
pbCellFontColor.Repaint;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellColorMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
IncLeftAndTop(pbCellFontColor);
end;
procedure TfmQExport4ODTEditor.btnCellColorMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
DecLeftAndTop(pbCellFontColor);
end;
procedure TfmQExport4ODTEditor.pbCellFontColorPaint(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
PaintStandardColors(pbCellFontColor, FCurrCellStyle.Font.Color);
end;
procedure TfmQExport4ODTEditor.btnTextFontColorClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if ColorDialog.Execute then
if ColorDialog.Color <> -1 then
FCurrTextStyle.Font.Color := ColorDialog.Color
else
FCurrTextStyle.Font.Color := clBlack;
pbTextFontColor.Repaint;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextFontColorMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
IncLeftAndTop(pbTextFontColor);
end;
procedure TfmQExport4ODTEditor.btnTextFontColorMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
DecLeftAndTop(pbTextFontColor);
end;
procedure TfmQExport4ODTEditor.pbTextFontColorPaint(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
PaintStandardColors(pbTextFontColor, FCurrTextStyle.Font.Color);
end;
procedure TfmQExport4ODTEditor.btnTextBoldClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextBold.Down then
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style + [fsBold]
else
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style - [fsBold];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextItalicClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextItalic.Down then
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style + [fsItalic]
else
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style - [fsItalic];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextStrikeOutClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextStrikeOut.Down then
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style + [fsStrikeOut]
else
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style - [fsStrikeOut];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextUnderLineClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextUnderLine.Down then
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style + [fsUnderline]
else
FCurrTextStyle.Font.Style := FCurrTextStyle.Font.Style - [fsUnderline];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellBoldClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellBold.Down then
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style + [fsBold]
else
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style - [fsBold];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellItalicClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellItalic.Down then
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style + [fsItalic]
else
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style - [fsItalic];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellStrikeOutClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellStrikeOut.Down then
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style + [fsStrikeOut]
else
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style - [fsStrikeOut];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellUnderlineSingleClick(
Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellUnderlineSingle.Down then
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style + [fsUnderline]
else
FCurrCellStyle.Font.Style := FCurrCellStyle.Font.Style - [fsUnderline];
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellLeftClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellLeft.Down then
FCurrCellStyle.Alignment := taODFLeft;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellCenterClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellCenter.Down then
FCurrCellStyle.Alignment := taODFCenter;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellRightClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellRight.Down then
FCurrCellStyle.Alignment := taODFRight;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellJustifyClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellJustify.Down then
FCurrCellStyle.Alignment := taODFJustify;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellVerTopClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellVerTop.Down then
FCurrCellStyle.VerticalAligment := taODFTop;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellVerCenterClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellVerCenter.Down then
FCurrCellStyle.VerticalAligment := taODFMiddle;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnCellVerBottomClick(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
if btnCellVerBottom.Down then
FCurrCellStyle.VerticalAligment := taODFBottom;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextLeftClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextLeft.Down then
FCurrTextStyle.Alignment := taODFLeft;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextCenterClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextCenter.Down then
FCurrTextStyle.Alignment := taODFCenter;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextRightClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextRight.Down then
FCurrTextStyle.Alignment := taODFRight;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.btnTextJustifyClick(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
if btnTextJustify.Down then
FCurrTextStyle.Alignment := taODFJustify;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.TuneBorderControls;
var
Condition: Boolean;
begin
if not assigned(Border) then Exit;
Condition := false;
if Border.BorderStyle = bsODFSolid then
Condition := true;
laBorderColor.Enabled := Condition;
btnBorderTopColor.Enabled := Condition;
laBorderWidth.Enabled := Condition;
edBorderWidth.Enabled := Condition;
cbUseBorder.Checked := Condition;
pbBorderTop.Enabled := Condition;
edBorderWidth.Text := IntToStr(Border.BorderWidth);
if Condition then
pbBorderTop.Repaint;
end;
procedure TfmQExport4ODTEditor.NumberKeyPress(Sender: TObject;
var Key: Char);
begin
if not (Key in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', #8])
then Key := #0;
end;
procedure TfmQExport4ODTEditor.pbSampleTextPaint(Sender: TObject);
begin
if (FCurrTextStyle = nil) and (FCurrCellStyle = nil) then Exit;
if FCurrCellStyle <> nil then
DrawODTCellSample(pbSampleText, FCurrCellStyle);
if FCurrTextStyle <> nil then
DrawODTTextSample(pbSampleText, FCurrTextStyle);
end;
procedure TfmQExport4ODTEditor.cbTextFontChange(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
FCurrTextStyle.Font.Name := cbTextFont.Text;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.cbTextFontSizeChange(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
FCurrTextStyle.Font.Size := StrToIntDef(cbTextFontSize.Text, 10);
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.cbTextFontSizeEnter(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
cbTextFontSize.Text := IntToStr(FCurrTextStyle.Font.Size);
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.cbTextFontSizeExit(Sender: TObject);
begin
if not Assigned(FCurrTextStyle) then Exit;
cbTextFontSize.Text := IntToStr(FCurrTextStyle.Font.Size);
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.cbCellFontChange(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
FCurrCellStyle.Font.Name := cbCellFont.Text;
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.cbCellFontSizeChange(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
FCurrCellStyle.Font.Size := StrToIntDef(cbCellFontSize.Text, 10);
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.cbCellFontSizeEnter(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
cbCellFontSize.Text := IntToStr(FCurrCellStyle.Font.Size);
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.cbCellFontSizeExit(Sender: TObject);
begin
if not Assigned(FCurrCellStyle) then Exit;
cbCellFontSize.Text := IntToStr(FCurrCellStyle.Font.Size);
pbSampleText.Repaint;
end;
procedure TfmQExport4ODTEditor.bResetItemClick(Sender: TObject);
begin
FCurrCellStyle := nil;
FCurrTextStyle := nil;
FCurrState := -1;
if pcStyleEditor.ActivePage = tsOptions then
begin
if not assigned(lvOptions.Items[lvOptions.ItemFocused.Index]) then
Exit;
if lvOptions.Items[lvOptions.ItemFocused.Index].Caption =
{$IFDEF WIN32}QExportLoadStr(QED_ODT_Header){$ENDIF}
{$IFDEF LINUX}QED_ODT_Header{$ENDIF} then
begin
HrStyle.SetDefault;
FCurrTextStyle := HrStyle;
FCurrState := 0;
end;
if lvOptions.Items[lvOptions.ItemFocused.Index].Caption =
{$IFDEF WIN32}QExportLoadStr(QED_ODT_Footer){$ENDIF}
{$IFDEF LINUX}QED_ODT_Footer{$ENDIF} then
begin
FrStyle.SetDefault;
FCurrTextStyle := FrStyle;
FCurrState := 0;
end;
if lvOptions.Items[lvOptions.ItemFocused.Index].Caption =
{$IFDEF WIN32}QExportLoadStr(QED_ODT_CaptionRow){$ENDIF}
{$IFDEF LINUX}QED_ODT_CaptionRow{$ENDIF} then
begin
CrStyle.SetDefault;
FCurrCellStyle := CRStyle;
FCurrState := 1;
end;
if lvOptions.Items[lvOptions.ItemFocused.Index].Caption =
{$IFDEF WIN32}QExportLoadStr(QED_ODT_Data){$ENDIF}
{$IFDEF LINUX}QED_ODT_Data{$ENDIF} then
begin
DStyle.SetDefault;
FCurrCellStyle := DStyle;
FCurrState := 1;
end;
end;
if pcStyleEditor.ActivePage = tsStyles then
begin
if not assigned(lvSStyles.Items[lvSStyles.ItemFocused.Index]) then
Exit;
FCurrState := 1;
SStylesList[lvSStyles.ItemFocused.Index].SetDefault;
FCurrCellStyle := SStylesList[lvSStyles.ItemFocused.Index];
end;
SetCurrentStatus;
end;
procedure TfmQExport4ODTEditor.bResetAllClick(Sender: TObject);
var
i: Integer;
begin
if pcStyleEditor.ActivePage = tsOptions then
begin
HrStyle.SetDefault;
FrStyle.SetDefault;
CrStyle.SetDefault;
DStyle.SetDefault;
end;
if pcStyleEditor.ActivePage = tsStyles then
for i := 0 to SStylesList.Count - 1 do
SStylesList[i].SetDefault;
GetCurrentStyle;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -