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 
23 package com.sun.star.wizards.report;
24 
25 import com.sun.star.beans.PropertyValue;
26 import com.sun.star.lang.XComponent;
27 import com.sun.star.lang.XMultiServiceFactory;
28 import com.sun.star.sdb.application.XDatabaseDocumentUI;
29 import com.sun.star.wizards.common.Resource;
30 import java.util.ArrayList;
31 import java.util.Vector;
32 
33 /**
34  * New Interface which gives us the possibility to switch on the fly between the old
35  * Wizard and the new Sun Report Builder Wizard, which use the same UI.
36  *
37  * @author ll93751
38  */
39 public interface IReportDocument
40 {
41     // -------------------------------------------------------------------------
42     // initialisation
43     // -------------------------------------------------------------------------
initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )44     public void initialize(
45             final XDatabaseDocumentUI i_documentUI,
46             final Resource i_resource
47         );
48 
49     // -------------------------------------------------------------------------
50     // Access Helper
51     // -------------------------------------------------------------------------
52     /**
53      * Gives access to the DB Values
54      * @return
55      */
getRecordParser()56     public com.sun.star.wizards.db.RecordParser getRecordParser();
57 
58     /**
59      * Give access to the parent document
60      * It is a document in the old Wizard
61      * It is a Report Builder in the new Wizard
62      * @return
63      */
getWizardParent()64     public com.sun.star.awt.XWindowPeer getWizardParent();
65 
66     /**
67      *
68      * @return the Frame of the document Window or Report Builder Window
69      */
getFrame()70     public com.sun.star.frame.XFrame getFrame();
71 
getComponent()72     public XComponent getComponent();
73 
74     // -------------------------------------------------------------------------
75     // First step: After entering the table name, select fields
76     // -------------------------------------------------------------------------
77     /**
78      * Is called after first step, set Tablename and the fields, which should occur in the Report.
79      * @param _aType
80      * @param TableName
81      * @param FieldNames
82      */
initializeFieldColumns(final int _aType, final String TableName, final String[] FieldNames)83     public void initializeFieldColumns(final int _aType, final String TableName, final String[] FieldNames);
84 
85     /**
86      * Empties the report document
87      */
clearDocument()88     public void clearDocument();
89 
90     /**
91      * Empties the report document, if we called back, don't remove Grouping/Sorting
92      */
removeTextTableAndTextSection()93     public void removeTextTableAndTextSection();
94 
95     // -------------------------------------------------------------------------
96     // Second step: Label field titles
97     // -------------------------------------------------------------------------
98     /**
99      * Set new names for the titles
100      * @param sFieldTitles
101      */
setFieldTitles(final String[] sFieldTitles)102     public void setFieldTitles(final String[] sFieldTitles);
103 
104     /**
105      * Change a the name of the 'title' of one field.
106      * It is possible to give all element names new names which are used as
107      * element title of a given element name.
108      * This is only used as a preview
109      * @param FieldName
110      * @param TitleName
111      */
liveupdate_changeUserFieldContent(final String FieldName, final String TitleName)112     public void liveupdate_changeUserFieldContent(final String FieldName, final String TitleName);
113     // -------------------------------------------------------------------------
114     // Third step: Grouping
115     // -------------------------------------------------------------------------
116     /* Grouping Page */
117     // Document should not hold the grouping information!
118     /**
119      * Called by press ('greater then') add a group to the group list
120      * @param GroupNames
121      * @param CurGroupTitle
122      * @param GroupFieldVector
123      * @param ReportPath
124      * @param iSelCount
125      * @return
126      */
liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)127     public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount);
128 
refreshGroupFields(String[] _sNewNames)129     public void refreshGroupFields(String[] _sNewNames);
130     // public boolean isGroupField(String _FieldName);
131     /**
132      * Called by press ('less then') Removes an already set Groupname out of the list
133      * @param NewSelGroupNames
134      * @param CurGroupTitle
135      * @param GroupFieldVector
136      */
liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.Vector GroupFieldVector)137     public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.Vector GroupFieldVector);
138 
139     /**
140      * set the list how to group
141      * @param aGroupList
142      */
setGrouping(String[] aGroupList)143     public void setGrouping(String[] aGroupList);
144     // -------------------------------------------------------------------------
145     // Fourth step: Sorting
146     // -------------------------------------------------------------------------
147     /**
148      * Set the list how to sort
149      * @param aSort
150      */
setSorting(String[][] aSort)151     public void setSorting(String[][] aSort);
152     // -------------------------------------------------------------------------
153     // Fivth step: Templates / Layout
154     // -------------------------------------------------------------------------
155     /* Template Page */
setPageOrientation(int nOrientation)156     public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException;
157 
getDefaultPageOrientation()158     public int getDefaultPageOrientation();
159 
getReportPath()160     public ArrayList getReportPath();
161 
getLayoutPath()162     public String getLayoutPath();
163 
getContentPath()164     public String getContentPath();
165 
166     /**
167      * Called if a new Layout is selected
168      * @param LayoutTemplatePath
169      */
liveupdate_changeLayoutTemplate(String LayoutTemplatePath )170     public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/);
171 
172     /**
173      * Called if a new Template is selected
174      * @param ContentTemplatePath
175      */
liveupdate_changeContentTemplate(String ContentTemplatePath)176     public void liveupdate_changeContentTemplate(String ContentTemplatePath);
177 
178     //    public String[] getLayoutTemplates();
179     //    public String[] getContentTemplates();
layout_selectFirstPage()180     public void layout_selectFirstPage();
181 
layout_setupRecordSection(String TemplateName)182     public void layout_setupRecordSection(String TemplateName);
183     // -------------------------------------------------------------------------
184     // finishing
185     // -------------------------------------------------------------------------
186     // preview (update titlenames)
187     // addTextListener
188     /**
189      * Set the Title into the document from the 'Create Report Page'
190      * BUG: The Title is empty after create Report.
191      * @param _sTitleName
192      */
liveupdate_updateReportTitle(String _sTitleName)193     public void liveupdate_updateReportTitle(String _sTitleName);
194 
195     /**
196      * Store the document by the given name
197      * @param Name
198      * @param OpenMode
199      */
store(String Name, int OpenMode)200     public void store(String Name, int OpenMode) throws com.sun.star.uno.Exception;
201 
202     /**
203      * The current report is added to the DB View under the given name
204      *
205      * TODO: add Name to this functionality
206      */
addReportToDBView()207     public void addReportToDBView();
208 
importReportData(ReportWizard aWizard)209     public void importReportData(ReportWizard aWizard);
210 
211     /**
212      * Create the final Report document
213      * @param Name
214      * @param _bAsTemplate
215      * @param _bOpenInDesign
216      * @return
217      */
createAndOpenReportDocument( final String Name, final boolean _bAsTemplate, final boolean _bOpenInDesign )218     public void createAndOpenReportDocument(
219         final String Name,
220         final boolean _bAsTemplate,
221         final boolean _bOpenInDesign
222     );
223 
dispose()224     public void dispose();
225     // -------------------------------------------------------------------------
226     // Garbage dump
227     // -------------------------------------------------------------------------
228     /* DataImport */
229     // ???
230     // public void addTextSectionCopies();
231     // ???
reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties)232     public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties);
233     // ???
insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF)234     public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF);
235     // ???
236     // public com.sun.star.lang.XMultiServiceFactory getDocumentServiceFactory();
237     /**
238      * set a internal variable to stop a maybe longer DB access.
239      */
StopProcess()240     public void StopProcess(); // cancel
241 
242     /**
243      * Returns a string list of layouts.
244      * @return
245      */
getDataLayout()246     public String[][] getDataLayout();
247 
248     /**
249      * Returns a string list of header layouts
250      * @return
251      */
getHeaderLayout()252     public String[][] getHeaderLayout();
253 
setCommandType(int CommandType)254     public void setCommandType(int CommandType);
255 
setCommand(String Command)256     public void setCommand(String Command);
257 
258     /**
259      * check internal invariants
260      * @throws a
261      */
checkInvariants()262     public void checkInvariants() throws java.lang.Exception;
263 }
264