1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22# Builds the Forms example of the Developers Guide. 23 24PRJ=../../.. 25SETTINGS=$(PRJ)/settings 26 27include $(SETTINGS)/settings.mk 28include $(SETTINGS)/std.mk 29include $(SETTINGS)/dk.mk 30 31# Define non-platform/compiler specific settings 32SAMPLE_NAME=FormsExamples 33SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME) 34SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME) 35 36APP1_NAME=DataAwareness 37APP1_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP1_NAME) 38APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar 39APP2_NAME=ValueBinding 40APP2_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP2_NAME) 41APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar 42APP3_NAME=SpreadsheetValueBinding 43APP3_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP3_NAME) 44APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar 45APP4_NAME=ControlValidation 46APP4_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP4_NAME) 47APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar 48 49COMMON_CLASS_OUT = $(SAMPLE_CLASS_OUT)/common 50COMMON_JAVAFILES = \ 51 ButtonOperator.java \ 52 ComponentTreeTraversal.java \ 53 ControlLock.java \ 54 DocumentHelper.java \ 55 DocumentType.java \ 56 DocumentViewHelper.java \ 57 FLTools.java \ 58 FormLayer.java \ 59 GridFieldValidator.java \ 60 InteractionRequest.java \ 61 KeyGenerator.java \ 62 SalesFilter.java \ 63 UNO.java \ 64 SpreadsheetView.java \ 65 WaitForInput.java \ 66 DocumentBasedExample.java \ 67 TableCellTextBinding.java \ 68 SpreadsheetDocument.java \ 69 NumericValidator.java \ 70 TextValidator.java \ 71 BooleanValidator.java \ 72 ListSelectionValidator.java \ 73 DateValidator.java \ 74 TimeValidator.java \ 75 ControlValidator.java \ 76 SingleControlValidation.java \ 77 HsqlDatabase.java \ 78 RowSet.java \ 79 URLHelper.java 80 81COMMON_CLASSFILES = $(patsubst %.java,$(COMMON_CLASS_OUT)/%.class,$(COMMON_JAVAFILES)) 82 83SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ 84 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\ 85 $(PATH_SEPARATOR)$(COMMON_CLASS_OUT)) 86 87 88# Targets 89.PHONY: ALL 90ALL : \ 91 FormsExample 92 93include $(SETTINGS)/stdtarget.mk 94 95$(COMMON_CLASSFILES) : $(COMMON_JAVAFILES) 96 -$(MKDIR) $(subst /,$(PS),$(@D)) 97 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMMON_CLASS_OUT) $^ 98 99# rule for client/example application manifest file 100$(SAMPLE_GEN_OUT)/%.mf : 101 -$(MKDIR) $(subst /,$(PS),$(@D)) 102 @echo Main-Class: com.sun.star.lib.loader.Loader> $@ 103 $(ECHOLINE)>> $@ 104 @echo Name: com/sun/star/lib/loader/Loader.class>> $@ 105 @echo Application-Class: $*>> $@ 106 107$(APP1_CLASS_OUT)/$(APP1_NAME).class : $(APP1_NAME).java $(COMMON_CLASSFILES) 108 -$(MKDIR) $(subst /,$(PS),$(@D)) 109 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP1_CLASS_OUT) $< 110 111$(APP2_CLASS_OUT)/$(APP2_NAME).class : $(APP2_NAME).java $(COMMON_CLASSFILES) 112 -$(MKDIR) $(subst /,$(PS),$(@D)) 113 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP2_CLASS_OUT) $< 114 115$(APP3_CLASS_OUT)/$(APP3_NAME).class : $(APP3_NAME).java $(COMMON_CLASSFILES) 116 -$(MKDIR) $(subst /,$(PS),$(@D)) 117 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP3_CLASS_OUT) $< 118 119$(APP4_CLASS_OUT)/$(APP4_NAME).class : $(APP4_NAME).java $(COMMON_CLASSFILES) 120 -$(MKDIR) $(subst /,$(PS),$(@D)) 121 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP4_CLASS_OUT) $< 122 123$(APP1_JAR) : $(SAMPLE_GEN_OUT)/$(APP1_NAME).mf $(APP1_CLASS_OUT)/$(APP1_NAME).class $(COMMON_CLASSFILES) 124 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 125 -$(MKDIR) $(subst /,$(PS),$(@D)) 126 +$(SDK_JAR) cvfm $@ $< -C $(APP1_CLASS_OUT) . 127 +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) . 128 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 129 130$(APP2_JAR) : $(SAMPLE_GEN_OUT)/$(APP2_NAME).mf $(APP2_CLASS_OUT)/$(APP2_NAME).class $(COMMON_CLASSFILES) 131 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 132 -$(MKDIR) $(subst /,$(PS),$(@D)) 133 +$(SDK_JAR) cvfm $@ $< -C $(APP2_CLASS_OUT) . 134 +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) . 135 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 136 137$(APP3_JAR) : $(SAMPLE_GEN_OUT)/$(APP3_NAME).mf $(APP3_CLASS_OUT)/$(APP3_NAME).class $(COMMON_CLASSFILES) 138 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 139 -$(MKDIR) $(subst /,$(PS),$(@D)) 140 +$(SDK_JAR) cvfm $@ $< -C $(APP3_CLASS_OUT) . 141 +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) . 142 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 143 144$(APP4_JAR) : $(SAMPLE_GEN_OUT)/$(APP4_NAME).mf $(APP4_CLASS_OUT)/$(APP4_NAME).class $(COMMON_CLASSFILES) 145 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 146 -$(MKDIR) $(subst /,$(PS),$(@D)) 147 +$(SDK_JAR) cvfm $@ $< -C $(APP4_CLASS_OUT) . 148 +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) . 149 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 150 151FormsExample : $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) $(APP4_JAR) 152 @echo -------------------------------------------------------------------------------- 153 @echo "$(QM)$(APP1_NAME)$(QM)" demonstrates various things around data aware controls. 154 @echo "$(QM)$(APP2_NAME)$(QM)" demonstrates the use of value bindings for form controls. 155 @echo "$(QM)$(APP3_NAME)$(QM)" demonstrates the usage of the com.sun.star.table.CellValueBinding service 156 @echo "$(QM)$(APP4_NAME)$(QM)" demonstrates the form control validation API 157 158 @echo Please use one of the following commands to run an example: 159 @echo - 160 @echo $(MAKE) $(APP1_NAME).run 161 @echo $(MAKE) $(APP2_NAME).run 162 @echo $(MAKE) $(APP3_NAME).run 163 @echo $(MAKE) $(APP4_NAME).run 164 @echo - 165 @echo Note: The data awareness example needs a running data source whith name 166 @echo $(SQM) $(SQM)"$(QM)OO_SDK_Demo_DB$(QM)". Make sure that you have created such a data source, 167 @echo - 168 @echo The document "$(QM)ProgrammaticScriptAssignment.odt$(QM)" demonstrates 169 @echo how you can programmatically create form controls, and associated 170 @echo scripts with certain events. 171 @echo - 172 @echo $(MAKE) ProgrammaticScriptAssignment.odt.load 173 @echo -------------------------------------------------------------------------------- 174 175ProgrammaticScriptAssignment.odt.load : $(COMP_REGISTERFLAG) 176 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@) 177 178%.run: $(SAMPLE_CLASS_OUT)/%.jar 179 $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< 180 181.PHONY: clean 182clean : 183 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) 184 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT)) 185