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