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