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