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