|
|
|
@ -4,14 +4,19 @@ import com.fr.base.BaseFormula;
|
|
|
|
|
import com.fr.base.Formula; |
|
|
|
|
import com.fr.base.Parameter; |
|
|
|
|
import com.fr.base.StoreProcedureParameter; |
|
|
|
|
import com.fr.base.core.KV; |
|
|
|
|
import com.fr.base.iofile.attr.WatermarkAttr; |
|
|
|
|
import com.fr.base.present.FormulaPresent; |
|
|
|
|
import com.fr.base.present.Present; |
|
|
|
|
import com.fr.data.condition.FormulaCondition; |
|
|
|
|
import com.fr.data.core.Compare; |
|
|
|
|
import com.fr.design.actions.replace.info.DealWithInfoValue; |
|
|
|
|
import com.fr.design.actions.replace.info.Info; |
|
|
|
|
import com.fr.design.actions.replace.utils.ShowValueUtils; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
|
import com.fr.form.main.Form; |
|
|
|
|
import com.fr.function.IF; |
|
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
|
import com.fr.js.SingleJavaScript; |
|
|
|
|
import com.fr.main.impl.WorkBook; |
|
|
|
|
import com.fr.report.cell.cellattr.CellInsertPolicyAttr; |
|
|
|
@ -54,6 +59,15 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
info.updateOldStr(((Formula) replaceObject).getContent(), findStr); |
|
|
|
|
((Formula) replaceObject).setContent(ShowValueUtils.replaceAll(((Formula) replaceObject).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof Formula){ |
|
|
|
|
Formula formula = (Formula) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(formula.getContent(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* FormulaCondition |
|
|
|
@ -77,6 +91,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((FormulaCondition) replaceObject).setFormula(ShowValueUtils.replaceAll(((FormulaCondition) replaceObject).getFormula(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof FormulaCondition){ |
|
|
|
|
FormulaCondition condition = (FormulaCondition) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(condition.getFormula(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* Compare |
|
|
|
@ -102,6 +124,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof Compare){ |
|
|
|
|
Compare compare = (Compare) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(GeneralUtils.objectToString(compare.getValue()), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 富文本 |
|
|
|
@ -128,6 +158,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof RichChar){ |
|
|
|
|
RichChar richChar = (RichChar) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(richChar.getText(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* KV |
|
|
|
@ -150,6 +188,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(((Formula) ((com.fr.base.core.KV) replaceObject).getValue()).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof com.fr.base.core.KV){ |
|
|
|
|
com.fr.base.core.KV kv = (com.fr.base.core.KV) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(GeneralUtils.objectToString(kv.getValue()), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 插入策略 |
|
|
|
@ -171,6 +217,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((CellInsertPolicyAttr) replaceObject).getDefaultInsertValue())).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof CellInsertPolicyAttr){ |
|
|
|
|
CellInsertPolicyAttr policyAttr = (CellInsertPolicyAttr) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(GeneralUtils.objectToString(policyAttr.getDefaultInsertValue()), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* present |
|
|
|
@ -193,6 +247,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((FormulaPresent) replaceObject).setFormulaContent(ShowValueUtils.replaceAll(((FormulaPresent) replaceObject).getFormulaContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof FormulaPresent){ |
|
|
|
|
FormulaPresent present = (FormulaPresent) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(present.getFormulaContent(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* SingleJavaScript |
|
|
|
@ -211,10 +273,17 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
public void setValue(Info info, String findStr, String replaceStr, List<Pair<Integer, Integer>> operatorArray) { |
|
|
|
|
Object replaceObject = info.getContent().getReplaceObject(); |
|
|
|
|
info.updateOldStr(((SingleJavaScript) replaceObject).getFileName(), findStr); |
|
|
|
|
|
|
|
|
|
((SingleJavaScript) replaceObject).setFileName(ShowValueUtils.replaceAll(((SingleJavaScript) replaceObject).getFileName(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof SingleJavaScript){ |
|
|
|
|
SingleJavaScript javaScript = (SingleJavaScript) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(javaScript.getFileName(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 参数 |
|
|
|
@ -237,6 +306,16 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((Formula) (((ParameterProvider) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((ParameterProvider) replaceObject).getValue())).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof ParameterProvider){ |
|
|
|
|
ParameterProvider provider = (ParameterProvider) info.getContent().getReplaceObject(); |
|
|
|
|
if (provider.getValue() instanceof Formula){ |
|
|
|
|
return StringUtils.equals(GeneralUtils.objectToString(provider.getValue()), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* FormulaProvider |
|
|
|
@ -259,6 +338,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((FormulaProvider) replaceObject).setContent(ShowValueUtils.replaceAll(((FormulaProvider) replaceObject).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof FormulaProvider){ |
|
|
|
|
FormulaProvider provider = (FormulaProvider) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(provider.getContent(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 参数 |
|
|
|
@ -281,6 +368,16 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((Formula) (((Parameter) replaceObject).getValue())).setContent(ShowValueUtils.replaceAll(((Formula) (((Parameter) replaceObject).getValue())).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof Parameter){ |
|
|
|
|
Parameter parameter = (Parameter) info.getContent().getReplaceObject(); |
|
|
|
|
if (parameter.getValue() instanceof Formula){ |
|
|
|
|
return StringUtils.equals(((Formula) parameter.getValue()).getContent(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 数据列 |
|
|
|
@ -303,6 +400,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((DSColumn) replaceObject).setResult(ShowValueUtils.replaceAll(((DSColumn) replaceObject).getResult(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof DSColumn){ |
|
|
|
|
DSColumn column = (DSColumn) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(column.getResult(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 公式类型 |
|
|
|
@ -325,6 +430,14 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((BaseFormula) replaceObject).setContent(ShowValueUtils.replaceAll(((BaseFormula) replaceObject).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof BaseFormula){ |
|
|
|
|
BaseFormula formula = (BaseFormula) info.getContent().getReplaceObject(); |
|
|
|
|
return StringUtils.equals(formula.getContent(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 存储过程的参数 |
|
|
|
@ -347,6 +460,17 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
((Formula) ((StoreProcedureParameter) replaceObject).getValue()).setContent(ShowValueUtils.replaceAll(((Formula) ((StoreProcedureParameter) replaceObject).getValue()).getContent(), findStr, replaceStr)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof StoreProcedureParameter){ |
|
|
|
|
StoreProcedureParameter procedureParameter = (StoreProcedureParameter) info.getContent().getReplaceObject(); |
|
|
|
|
if (procedureParameter.getValue() instanceof Formula){ |
|
|
|
|
return StringUtils.equals(GeneralUtils.objectToString(procedureParameter.getValue()), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* WatermarkAttr水印 |
|
|
|
@ -369,6 +493,15 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
watermarkAttr.setText(ShowValueUtils.replaceAll(watermarkAttr.getText(), findStr, replaceStr)); |
|
|
|
|
workBook.addAttrMark(watermarkAttr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean check(Info info) { |
|
|
|
|
if (info.getContent().getReplaceObject() instanceof WatermarkAttr){ |
|
|
|
|
WatermarkAttr watermarkAttr = ((WatermarkAttr) info.getContent().getReplaceObject()); |
|
|
|
|
return StringUtils.equals(watermarkAttr.getText(), info.getContent().getOldShowStr()); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -395,6 +528,12 @@ public enum FormulaReplaceObject implements DealWithInfoValue {
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 校验内容 |
|
|
|
|
* @param info |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
abstract public boolean check(Info info); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getInfoShowStr(Info info) { |
|
|
|
|