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