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.awt.VclWindowPeerAttribute; 26cdf0e10cSrcweir import com.sun.star.awt.XWindowPeer; 27cdf0e10cSrcweir import com.sun.star.beans.PropertyValue; 28cdf0e10cSrcweir import com.sun.star.container.XNameAccess; 29cdf0e10cSrcweir import com.sun.star.container.XNameContainer; 30cdf0e10cSrcweir import com.sun.star.container.XNamed; 31cdf0e10cSrcweir import com.sun.star.frame.XFrame; 32cdf0e10cSrcweir import com.sun.star.lang.XComponent; 33cdf0e10cSrcweir import com.sun.star.sdb.CommandType; 34cdf0e10cSrcweir import com.sun.star.table.XCellRange; 35cdf0e10cSrcweir import com.sun.star.text.XTextContent; 36cdf0e10cSrcweir import com.sun.star.text.XTextCursor; 37cdf0e10cSrcweir import com.sun.star.text.XTextDocument; 38cdf0e10cSrcweir import com.sun.star.text.XTextTable; 39cdf0e10cSrcweir import com.sun.star.uno.Any; 40cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 41cdf0e10cSrcweir import com.sun.star.uno.XInterface; 42cdf0e10cSrcweir import com.sun.star.wizards.common.FileAccess; 43cdf0e10cSrcweir import com.sun.star.wizards.common.Helper; 44cdf0e10cSrcweir import com.sun.star.wizards.common.InvalidQueryException; 45cdf0e10cSrcweir import com.sun.star.wizards.common.JavaTools; 46cdf0e10cSrcweir import com.sun.star.wizards.common.Resource; 47cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 48cdf0e10cSrcweir 49cdf0e10cSrcweir import com.sun.star.sdb.application.DatabaseObject; 50cdf0e10cSrcweir import com.sun.star.sdb.application.XDatabaseDocumentUI; 51cdf0e10cSrcweir import com.sun.star.wizards.common.PropertyNames; 52cdf0e10cSrcweir import com.sun.star.wizards.common.SystemDialog; 53cdf0e10cSrcweir import com.sun.star.wizards.db.DBMetaData; 54cdf0e10cSrcweir import com.sun.star.wizards.document.OfficeDocument; 55cdf0e10cSrcweir import com.sun.star.wizards.ui.UIConsts; 56cdf0e10cSrcweir import java.util.ArrayList; 57cdf0e10cSrcweir import java.util.Vector; 58cdf0e10cSrcweir import java.util.logging.Level; 59cdf0e10cSrcweir import java.util.logging.Logger; 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** 62cdf0e10cSrcweir * 63cdf0e10cSrcweir * @author ll93751 64cdf0e10cSrcweir */ 65cdf0e10cSrcweir public class ReportTextImplementation extends ReportImplementationHelper implements IReportDocument 66cdf0e10cSrcweir { 67cdf0e10cSrcweir 68cdf0e10cSrcweir private ReportTextDocument m_aDoc; 69cdf0e10cSrcweir private Object m_aInitialDoc; 70cdf0e10cSrcweir private Resource m_resource; 71cdf0e10cSrcweir private XDatabaseDocumentUI m_documentUI; 72cdf0e10cSrcweir setInitialDocument(Object _aDoc)73cdf0e10cSrcweir private void setInitialDocument(Object _aDoc) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir m_aInitialDoc = _aDoc; 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir /** 79cdf0e10cSrcweir * This is a TEMPORARY function to give direct access to the old text document. 80cdf0e10cSrcweir * We have to remove this!!! 81cdf0e10cSrcweir * @return 82cdf0e10cSrcweir */ getDoc()83cdf0e10cSrcweir ReportTextDocument getDoc() 84cdf0e10cSrcweir { 85cdf0e10cSrcweir if (m_aDoc == null) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir if (m_aInitialDoc instanceof XTextDocument) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument) m_aInitialDoc, m_resource, getRecordParser()); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir else if (m_aInitialDoc instanceof String) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir m_aDoc = new ReportTextDocument(getMSF(), (String) m_aInitialDoc, m_resource, getRecordParser()); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir else 96cdf0e10cSrcweir { 97cdf0e10cSrcweir throw new RuntimeException("Unknown type for setInitialDocument() given."); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir } 100cdf0e10cSrcweir return m_aDoc; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir clearDocument()103cdf0e10cSrcweir public void clearDocument() 104cdf0e10cSrcweir { 105cdf0e10cSrcweir getDoc().oTextSectionHandler.removeAllTextSections(); 106cdf0e10cSrcweir getDoc().oTextTableHandler.removeAllTextTables(); 107cdf0e10cSrcweir getDoc().DBColumnsVector = new Vector(); 108cdf0e10cSrcweir } 109cdf0e10cSrcweir ReportTextImplementation( XMultiServiceFactory i_serviceFactory )110cdf0e10cSrcweir protected ReportTextImplementation( XMultiServiceFactory i_serviceFactory ) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir super( i_serviceFactory, ReportLayouter.SOOPTLANDSCAPE ); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )115cdf0e10cSrcweir public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource ) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir m_documentUI = i_documentUI; 118cdf0e10cSrcweir m_resource = i_resource; 119cdf0e10cSrcweir 120cdf0e10cSrcweir if ( m_aInitialDoc == null ) 121cdf0e10cSrcweir setInitialDocument( getLayoutPath() ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir initialResources(); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir create( XMultiServiceFactory i_serviceFactory, XDatabaseDocumentUI i_documentUI, XTextDocument i_initialDocument, Resource i_resources )126cdf0e10cSrcweir static IReportDocument create( XMultiServiceFactory i_serviceFactory, XDatabaseDocumentUI i_documentUI, XTextDocument i_initialDocument, Resource i_resources ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir ReportTextImplementation a = new ReportTextImplementation( i_serviceFactory ); 129cdf0e10cSrcweir a.setInitialDocument(i_initialDocument); 130cdf0e10cSrcweir a.initialize( i_documentUI, i_resources ); 131cdf0e10cSrcweir return a; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir getWizardParent()134cdf0e10cSrcweir public XWindowPeer getWizardParent() 135cdf0e10cSrcweir { 136cdf0e10cSrcweir return getDoc().xWindowPeer; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir static String sMsgQueryCreationImpossible; 139cdf0e10cSrcweir static String sReportFormNotExisting; 140cdf0e10cSrcweir static String sMsgHiddenControlMissing; 141cdf0e10cSrcweir static String sMsgEndAutopilot; 142cdf0e10cSrcweir static String sMsgConnectionImpossible; 143cdf0e10cSrcweir static String sMsgNoConnection; 144cdf0e10cSrcweir static String[] ReportMessages = new String[4]; 145cdf0e10cSrcweir initialResources()146cdf0e10cSrcweir private void initialResources() 147cdf0e10cSrcweir { 148cdf0e10cSrcweir sReportFormNotExisting = m_resource.getResText(UIConsts.RID_REPORT + 64); 149cdf0e10cSrcweir sMsgQueryCreationImpossible = m_resource.getResText(UIConsts.RID_REPORT + 65); 150cdf0e10cSrcweir sMsgHiddenControlMissing = m_resource.getResText(UIConsts.RID_REPORT + 66); 151cdf0e10cSrcweir sMsgEndAutopilot = m_resource.getResText(UIConsts.RID_DB_COMMON + 33); 152cdf0e10cSrcweir sMsgNoConnection = m_resource.getResText(UIConsts.RID_DB_COMMON + 14); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir addTextSectionCopies()155cdf0e10cSrcweir public void addTextSectionCopies() 156cdf0e10cSrcweir { 157cdf0e10cSrcweir m_aDoc.setLayoutSectionsVisible(false); 158cdf0e10cSrcweir XTextCursor xTextCursor = ReportTextDocument.createTextCursor(m_aDoc.xTextDocument.getText()); 159cdf0e10cSrcweir xTextCursor.gotoStart(false); 160cdf0e10cSrcweir for (int i = 0; i < getRecordParser().GroupFieldNames.length; i++) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(i + 1), null, null); 163cdf0e10cSrcweir xNamedTextSection.setName(ReportTextDocument.COPYOFGROUPSECTION + (i + 1)); 164cdf0e10cSrcweir renameTableofLastSection(ReportTextDocument.COPYOFTBLGROUPSECTION + (i + 1)); 165cdf0e10cSrcweir } 166cdf0e10cSrcweir if (getRecordParser().getRecordFieldNames().length > 0) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.RECORDSECTION, null, null); 169cdf0e10cSrcweir xNamedTextSection.setName(ReportTextDocument.COPYOFRECORDSECTION); 170cdf0e10cSrcweir renameTableofLastSection(ReportTextDocument.COPYOFTBLRECORDSECTION); 171cdf0e10cSrcweir } 172cdf0e10cSrcweir } 173cdf0e10cSrcweir addLinkedTextSection(XTextCursor xTextCursor, String sLinkRegion, DBColumn CurDBColumn, Object CurGroupValue)174cdf0e10cSrcweir private XNamed addLinkedTextSection(XTextCursor xTextCursor, String sLinkRegion, DBColumn CurDBColumn, Object CurGroupValue) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir XNamed xNamedTextSection = null; 177cdf0e10cSrcweir try 178cdf0e10cSrcweir { 179cdf0e10cSrcweir XInterface xTextSection = (XInterface) getDocumentServiceFactory().createInstance("com.sun.star.text.TextSection"); 180cdf0e10cSrcweir XTextContent xTextSectionContent = UnoRuntime.queryInterface( XTextContent.class, xTextSection ); 181cdf0e10cSrcweir xNamedTextSection = UnoRuntime.queryInterface( XNamed.class, xTextSection ); 182cdf0e10cSrcweir xTextCursor.gotoEnd(false); 183cdf0e10cSrcweir xTextCursor.getText().insertTextContent(xTextCursor, xTextSectionContent, true); 184cdf0e10cSrcweir Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion); 185cdf0e10cSrcweir if (CurDBColumn != null) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir boolean bIsGroupTable = (!sLinkRegion.equals(ReportTextDocument.RECORDSECTION)); 188cdf0e10cSrcweir if (bIsGroupTable) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); 191cdf0e10cSrcweir XCellRange xCellRange = UnoRuntime.queryInterface( XCellRange.class, xTextTable ); 192cdf0e10cSrcweir CurDBColumn.modifyCellContent(xCellRange, CurGroupValue); 193cdf0e10cSrcweir } 194cdf0e10cSrcweir } 195cdf0e10cSrcweir } 196cdf0e10cSrcweir catch (Exception ex) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); 199cdf0e10cSrcweir } 200cdf0e10cSrcweir return xNamedTextSection; 201cdf0e10cSrcweir } 202cdf0e10cSrcweir renameTableofLastSection(String _snewname)203cdf0e10cSrcweir private void renameTableofLastSection(String _snewname) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); 206cdf0e10cSrcweir XNamed xNamedTable = UnoRuntime.queryInterface( XNamed.class, xTextTable ); 207cdf0e10cSrcweir xNamedTable.setName(_snewname); 208cdf0e10cSrcweir } 209cdf0e10cSrcweir showMessageBox(String windowServiceName, int windowAttribute, String MessageText)210cdf0e10cSrcweir private int showMessageBox(String windowServiceName, int windowAttribute, String MessageText) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir return SystemDialog.showMessageBox(getMSF(), getWizardParent(), windowServiceName, windowAttribute, MessageText); 213cdf0e10cSrcweir } 214cdf0e10cSrcweir reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] _properties)215cdf0e10cSrcweir public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] _properties) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir try 218cdf0e10cSrcweir { 219cdf0e10cSrcweir XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms(); 220cdf0e10cSrcweir Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME); 221cdf0e10cSrcweir boolean bgetConnection; 222cdf0e10cSrcweir if (oDBForm != null) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot; 225cdf0e10cSrcweir XNameAccess xNamedForm = UnoRuntime.queryInterface( XNameAccess.class, oDBForm ); 226cdf0e10cSrcweir getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND); 227cdf0e10cSrcweir String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE); 228cdf0e10cSrcweir String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames"); 229cdf0e10cSrcweir String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames"); 230cdf0e10cSrcweir String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames"); 231cdf0e10cSrcweir 232cdf0e10cSrcweir String sorting = PropertyNames.EMPTY_STRING; 233cdf0e10cSrcweir if ( xNamedForm.hasByName( "Sorting" ) ) 234cdf0e10cSrcweir sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting"); 235cdf0e10cSrcweir 236cdf0e10cSrcweir String sQueryName = PropertyNames.EMPTY_STRING; 237cdf0e10cSrcweir if ( xNamedForm.hasByName( "QueryName" ) ) 238cdf0e10cSrcweir sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName"); 239cdf0e10cSrcweir 240cdf0e10cSrcweir String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, PropertyNames.SEMI_COLON); 241cdf0e10cSrcweir String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, PropertyNames.SEMI_COLON); 242cdf0e10cSrcweir if ( sorting.length() > 0) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir String[] sortList = JavaTools.ArrayoutofString(sorting, PropertyNames.SEMI_COLON); 245cdf0e10cSrcweir ArrayList<String[]> aSortFields = new ArrayList<String[]>(); 246cdf0e10cSrcweir for (String sortEntry : sortList) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir aSortFields.add(JavaTools.ArrayoutofString(sortEntry, ",")); 249cdf0e10cSrcweir } 250cdf0e10cSrcweir String[][] sortFieldNames = new String[aSortFields.size()][2]; 251cdf0e10cSrcweir aSortFields.toArray(sortFieldNames); 252cdf0e10cSrcweir getRecordParser().setSortFieldNames(sortFieldNames); 253cdf0e10cSrcweir } 254cdf0e10cSrcweir getRecordParser().setRecordFieldNames(sNewList); 255cdf0e10cSrcweir getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, PropertyNames.SEMI_COLON); 256cdf0e10cSrcweir getRecordParser().setCommandType(Integer.valueOf(sCommandType).intValue()); 257cdf0e10cSrcweir 258cdf0e10cSrcweir sMsgQueryCreationImpossible = JavaTools.replaceSubString(sMsgQueryCreationImpossible, getRecordParser().Command, "<STATEMENT>"); 259cdf0e10cSrcweir bgetConnection = getRecordParser().getConnection(_properties); 260cdf0e10cSrcweir int nCommandType = com.sun.star.sdb.CommandType.COMMAND; 261cdf0e10cSrcweir boolean bexecute = false; 262cdf0e10cSrcweir if (bgetConnection) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals(PropertyNames.EMPTY_STRING))) 265cdf0e10cSrcweir { 266cdf0e10cSrcweir DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName); 267cdf0e10cSrcweir if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet())) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND); 270cdf0e10cSrcweir getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command); 271cdf0e10cSrcweir getRecordParser().getSQLQueryComposer().prependSortingCriteria(); 272cdf0e10cSrcweir getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery(); 273cdf0e10cSrcweir } 274cdf0e10cSrcweir else 275cdf0e10cSrcweir { 276cdf0e10cSrcweir nCommandType = com.sun.star.sdb.CommandType.QUERY; 277cdf0e10cSrcweir getRecordParser().Command = sQueryName; 278cdf0e10cSrcweir } 279cdf0e10cSrcweir } 280cdf0e10cSrcweir 281cdf0e10cSrcweir bexecute = getRecordParser().executeCommand(nCommandType); //sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot, sFieldNameList, true); 282cdf0e10cSrcweir if (bexecute) 283cdf0e10cSrcweir { 284cdf0e10cSrcweir bexecute = getRecordParser().getFields(sFieldNameList, true); 285cdf0e10cSrcweir } 286cdf0e10cSrcweir return bexecute; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir else 289cdf0e10cSrcweir { 290cdf0e10cSrcweir return false; 291cdf0e10cSrcweir } 292cdf0e10cSrcweir } 293cdf0e10cSrcweir else 294cdf0e10cSrcweir { 295cdf0e10cSrcweir sReportFormNotExisting = JavaTools.replaceSubString(sReportFormNotExisting, ReportWizard.SOREPORTFORMNAME, "<REPORTFORM>"); 296cdf0e10cSrcweir showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sReportFormNotExisting + (char) 13 + sMsgEndAutopilot); 297cdf0e10cSrcweir return false; 298cdf0e10cSrcweir } 299cdf0e10cSrcweir } 300cdf0e10cSrcweir catch (InvalidQueryException queryexception) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir return false; 303cdf0e10cSrcweir } 304cdf0e10cSrcweir catch (java.lang.Exception ex) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); 307cdf0e10cSrcweir return false; 308cdf0e10cSrcweir } 309cdf0e10cSrcweir } 310cdf0e10cSrcweir private boolean m_bStopProcess; 311cdf0e10cSrcweir StopProcess()312cdf0e10cSrcweir public void StopProcess() 313cdf0e10cSrcweir { 314cdf0e10cSrcweir m_bStopProcess = true; 315cdf0e10cSrcweir } 316cdf0e10cSrcweir insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF)317cdf0e10cSrcweir public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir try 320cdf0e10cSrcweir { 321cdf0e10cSrcweir int ColIndex; 322cdf0e10cSrcweir boolean breset; 323cdf0e10cSrcweir Object oTable; 324cdf0e10cSrcweir Vector DataVector = new Vector(); 325cdf0e10cSrcweir DBColumn CurDBColumn; 326cdf0e10cSrcweir Object CurGroupValue; 327cdf0e10cSrcweir String CurGroupTableName; 328cdf0e10cSrcweir // RecordParser CurDBMetaData = getRecordParser(); 329cdf0e10cSrcweir getDoc().oTextFieldHandler.fixDateFields(true); 330cdf0e10cSrcweir getDoc().removeAllVisibleTextSections(); 331cdf0e10cSrcweir getDoc().removeNonLayoutTextTables(); 332cdf0e10cSrcweir addTextSectionCopies(); 333cdf0e10cSrcweir getDoc().getallDBColumns(); 334cdf0e10cSrcweir int GroupFieldCount = getRecordParser().GroupFieldNames.length; 335cdf0e10cSrcweir int FieldCount = getRecordParser().FieldColumns.length; 336cdf0e10cSrcweir Object[] OldGroupFieldValues = new Object[GroupFieldCount]; 337cdf0e10cSrcweir XTextTable[] xGroupBaseTables = new XTextTable[GroupFieldCount]; 338cdf0e10cSrcweir int RecordFieldCount = FieldCount - GroupFieldCount; 339cdf0e10cSrcweir XTextDocument xTextDocument = getDoc().xTextDocument; 340cdf0e10cSrcweir XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText()); 341cdf0e10cSrcweir xTextDocument.lockControllers(); 342cdf0e10cSrcweir 343cdf0e10cSrcweir if (getRecordParser().ResultSet.next()) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir replaceUserFields(); 346cdf0e10cSrcweir Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page"); 347cdf0e10cSrcweir for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir CurGroupTableName = ReportTextDocument.TBLGROUPSECTION + Integer.toString(ColIndex + 1); 350cdf0e10cSrcweir oTable = getDoc().oTextTableHandler.xTextTablesSupplier.getTextTables().getByName(CurGroupTableName); 351cdf0e10cSrcweir xGroupBaseTables[ColIndex] = UnoRuntime.queryInterface( XTextTable.class, oTable ); 352cdf0e10cSrcweir CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex); 353cdf0e10cSrcweir OldGroupFieldValues[ColIndex] = CurGroupValue; 354cdf0e10cSrcweir CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); 355cdf0e10cSrcweir addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); //COPYOF!!!! 356cdf0e10cSrcweir } 357cdf0e10cSrcweir if (getRecordParser().getcurrentRecordData(DataVector)) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir // int RowIndex = 1; 360cdf0e10cSrcweir m_bStopProcess = false; 361cdf0e10cSrcweir while ((getRecordParser().ResultSet.next()) && (!m_bStopProcess)) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir // RowIndex += 1; 364cdf0e10cSrcweir breset = false; 365cdf0e10cSrcweir for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex); 368cdf0e10cSrcweir if ((!CurGroupValue.equals(OldGroupFieldValues[ColIndex])) || (breset)) 369cdf0e10cSrcweir { 370cdf0e10cSrcweir breset = true; 371cdf0e10cSrcweir insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount); 372cdf0e10cSrcweir CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); 373cdf0e10cSrcweir addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); 374cdf0e10cSrcweir OldGroupFieldValues[ColIndex] = CurGroupValue; 375cdf0e10cSrcweir breset = !(ColIndex == GroupFieldCount - 1); 376cdf0e10cSrcweir } 377cdf0e10cSrcweir } 378cdf0e10cSrcweir getRecordParser().getcurrentRecordData(DataVector); 379cdf0e10cSrcweir // updateProgressDisplay(RowIndex); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount); 382cdf0e10cSrcweir } 383cdf0e10cSrcweir else 384cdf0e10cSrcweir { 385cdf0e10cSrcweir getDoc().unlockallControllers(); 386cdf0e10cSrcweir return; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir } 389cdf0e10cSrcweir else 390cdf0e10cSrcweir { 391cdf0e10cSrcweir for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); 394cdf0e10cSrcweir Object oValue = PropertyNames.EMPTY_STRING; 395cdf0e10cSrcweir addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, oValue); 396cdf0e10cSrcweir } 397cdf0e10cSrcweir addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null); 398cdf0e10cSrcweir Object[][] RecordArray = new Object[1][RecordFieldCount]; 399cdf0e10cSrcweir for (int i = 0; i < RecordArray[0].length; i++) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir RecordArray[0][i] = Any.VOID; 402cdf0e10cSrcweir } 403cdf0e10cSrcweir XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); 404cdf0e10cSrcweir OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1); 405cdf0e10cSrcweir } 406cdf0e10cSrcweir getDoc().oTextSectionHandler.breakLinkofTextSections(); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir catch (Exception ex) 409cdf0e10cSrcweir { 410cdf0e10cSrcweir Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); 411cdf0e10cSrcweir } 412cdf0e10cSrcweir // catch (java.lang.Exception javaexception) 413cdf0e10cSrcweir // { 414cdf0e10cSrcweir // javaexception.printStackTrace(System.out); 415cdf0e10cSrcweir // } 416cdf0e10cSrcweir getDoc().unlockallControllers(); 417cdf0e10cSrcweir getDoc().setLayoutSectionsVisible(false); 418cdf0e10cSrcweir getDoc().removeCopiedTextSections(); 419cdf0e10cSrcweir getDoc().oTextSectionHandler.removeInvisibleTextSections(); 420cdf0e10cSrcweir getDoc().removeLayoutTextTables(); 421cdf0e10cSrcweir } 422cdf0e10cSrcweir insertDataToRecordTable(XTextCursor xTextCursor, Vector DataVector, int FieldCount)423cdf0e10cSrcweir private void insertDataToRecordTable(XTextCursor xTextCursor, Vector DataVector, int FieldCount) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir int DataLength = DataVector.size(); 426cdf0e10cSrcweir if ((FieldCount > 0) && (DataLength > 0)) 427cdf0e10cSrcweir { 428cdf0e10cSrcweir addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null); 429cdf0e10cSrcweir Object[][] RecordArray = new Object[DataLength][FieldCount]; 430cdf0e10cSrcweir DataVector.copyInto(RecordArray); 431cdf0e10cSrcweir XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); 432cdf0e10cSrcweir if (DataLength > 1) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir xTextTable.getRows().insertByIndex(xTextTable.getRows().getCount(), DataLength - 1); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1); 437cdf0e10cSrcweir } 438cdf0e10cSrcweir DataVector.removeAllElements(); 439cdf0e10cSrcweir } 440cdf0e10cSrcweir // public void updateProgressDisplay(int iCounter) 441cdf0e10cSrcweir // { 442cdf0e10cSrcweir // try 443cdf0e10cSrcweir // { 444cdf0e10cSrcweir // if (iCounter % 10 == 0) 445cdf0e10cSrcweir // { 446cdf0e10cSrcweir // sProgressCurRecord = JavaTools.replaceSubString(sProgressBaseCurRecord, String.valueOf(iCounter), "<COUNT>"); 447cdf0e10cSrcweir // setControlProperty("lblCurProgress", PropertyNames.PROPERTY_LABEL, sProgressCurRecord); 448cdf0e10cSrcweir // super.xReschedule.reschedule(); 449cdf0e10cSrcweir // } 450cdf0e10cSrcweir // } 451cdf0e10cSrcweir // catch (java.lang.Exception jexception) 452cdf0e10cSrcweir // { 453cdf0e10cSrcweir // jexception.printStackTrace(System.out); 454cdf0e10cSrcweir // } 455cdf0e10cSrcweir // } replaceUserFields()456cdf0e10cSrcweir private void replaceUserFields() 457cdf0e10cSrcweir { 458cdf0e10cSrcweir DBColumn CurDBColumn; 459cdf0e10cSrcweir XTextCursor xNameCellCursor; 460cdf0e10cSrcweir String FieldContent; 461cdf0e10cSrcweir int iCount = getDoc().DBColumnsVector.size(); 462cdf0e10cSrcweir for (int i = 0; i < iCount; i++) 463cdf0e10cSrcweir { 464cdf0e10cSrcweir CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(i); 465cdf0e10cSrcweir xNameCellCursor = ReportTextDocument.createTextCursor(CurDBColumn.xNameCell); 466cdf0e10cSrcweir xNameCellCursor.gotoStart(false); 467cdf0e10cSrcweir FieldContent = getDoc().oTextFieldHandler.getUserFieldContent(xNameCellCursor); 468cdf0e10cSrcweir if (!FieldContent.equals(PropertyNames.EMPTY_STRING)) 469cdf0e10cSrcweir { 470cdf0e10cSrcweir xNameCellCursor.goRight((short) 1, true); 471cdf0e10cSrcweir xNameCellCursor.setString(FieldContent); 472cdf0e10cSrcweir } 473cdf0e10cSrcweir } 474cdf0e10cSrcweir } 475cdf0e10cSrcweir getFrame()476cdf0e10cSrcweir public XFrame getFrame() 477cdf0e10cSrcweir { 478cdf0e10cSrcweir return m_aDoc.xFrame; 479cdf0e10cSrcweir } 480cdf0e10cSrcweir getDocumentServiceFactory()481cdf0e10cSrcweir public XMultiServiceFactory getDocumentServiceFactory() 482cdf0e10cSrcweir { 483cdf0e10cSrcweir return m_aDoc.xMSFDoc; 484cdf0e10cSrcweir } 485cdf0e10cSrcweir store(String _sName, int _nOpenMode)486cdf0e10cSrcweir public void store(String _sName, int _nOpenMode) throws com.sun.star.uno.Exception 487cdf0e10cSrcweir { 488cdf0e10cSrcweir getDoc().createReportForm(ReportWizard.SOREPORTFORMNAME); 489cdf0e10cSrcweir // int nOpenMode = getReportOpenMode(); 490cdf0e10cSrcweir getDoc().oTextFieldHandler.updateDateFields(); 491cdf0e10cSrcweir getDoc().oTextFieldHandler.fixDateFields(false); 492cdf0e10cSrcweir if ((_nOpenMode == ReportFinalizer.SOCREATETEMPLATE || _nOpenMode == ReportFinalizer.SOUSETEMPLATE)) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir getDoc().oTextSectionHandler.breakLinkofTextSections(); 495cdf0e10cSrcweir getRecordParser().storeDatabaseDocumentToTempPath(getComponent(), _sName); 496cdf0e10cSrcweir } 497cdf0e10cSrcweir } 498cdf0e10cSrcweir liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)499cdf0e10cSrcweir public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount) 500cdf0e10cSrcweir { 501cdf0e10cSrcweir return getDoc().addGroupNametoDocument(GroupNames, CurGroupTitle, GroupFieldVector, ReportPath, iSelCount); 502cdf0e10cSrcweir } 503cdf0e10cSrcweir refreshGroupFields(String[] _sNewNames)504cdf0e10cSrcweir public void refreshGroupFields(String[] _sNewNames) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir getDoc().refreshGroupFields(_sNewNames); 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509cdf0e10cSrcweir // public boolean isGroupField(String _FieldName) 510cdf0e10cSrcweir // { 511cdf0e10cSrcweir // return getDoc().isGroupField(_FieldName); 512cdf0e10cSrcweir // } liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector)513cdf0e10cSrcweir public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir getDoc().removeGroupName(NewSelGroupNames, CurGroupTitle, GroupFieldVector); 516cdf0e10cSrcweir } 517cdf0e10cSrcweir setPageOrientation(int nOrientation)518cdf0e10cSrcweir public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException 519cdf0e10cSrcweir { 520cdf0e10cSrcweir // LLA: should we lock controllers here? 521cdf0e10cSrcweir // CurReportDocument.getDoc().xTextDocument.lockControllers(); 522cdf0e10cSrcweir if (nOrientation == ReportLayouter.SOOPTLANDSCAPE) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir getDoc().changePageOrientation(true); 525cdf0e10cSrcweir } 526cdf0e10cSrcweir else if (nOrientation == ReportLayouter.SOOPTPORTRAIT) 527cdf0e10cSrcweir { 528cdf0e10cSrcweir getDoc().changePageOrientation(false); 529cdf0e10cSrcweir } 530cdf0e10cSrcweir else 531cdf0e10cSrcweir { 532cdf0e10cSrcweir throw new com.sun.star.lang.IllegalArgumentException("Unknown Orientation."); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir // CurReportDocument.getDoc().unlockallControllers(); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir liveupdate_changeLayoutTemplate(String LayoutTemplatePath )537cdf0e10cSrcweir public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/) 538cdf0e10cSrcweir { 539cdf0e10cSrcweir getDoc().swapLayoutTemplate(LayoutTemplatePath/*, BitmapPath*/); 540cdf0e10cSrcweir } 541cdf0e10cSrcweir liveupdate_changeContentTemplate(String ContentTemplatePath)542cdf0e10cSrcweir public void liveupdate_changeContentTemplate(String ContentTemplatePath) 543cdf0e10cSrcweir { 544cdf0e10cSrcweir getDoc().swapContentTemplate(ContentTemplatePath); 545cdf0e10cSrcweir } 546cdf0e10cSrcweir layout_setupRecordSection(String TemplateName)547cdf0e10cSrcweir public void layout_setupRecordSection(String TemplateName) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir getDoc().setupRecordSection(TemplateName); 550cdf0e10cSrcweir } 551cdf0e10cSrcweir removeTextTableAndTextSection()552cdf0e10cSrcweir public void removeTextTableAndTextSection() 553cdf0e10cSrcweir { 554cdf0e10cSrcweir getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection"); 555cdf0e10cSrcweir getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection"); 556cdf0e10cSrcweir } 557cdf0e10cSrcweir layout_selectFirstPage()558cdf0e10cSrcweir public void layout_selectFirstPage() 559cdf0e10cSrcweir { 560cdf0e10cSrcweir getDoc().oViewHandler.selectFirstPage(getDoc().oTextTableHandler); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir dispose()563cdf0e10cSrcweir public void dispose() 564cdf0e10cSrcweir { 565cdf0e10cSrcweir OfficeDocument.dispose(getMSF(), getComponent()); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir getComponent()568cdf0e10cSrcweir public XComponent getComponent() 569cdf0e10cSrcweir { 570cdf0e10cSrcweir return getDoc().xComponent; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir liveupdate_changeUserFieldContent(String fieldname, String sfieldtitle)573cdf0e10cSrcweir public void liveupdate_changeUserFieldContent(String fieldname, String sfieldtitle) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle); 576cdf0e10cSrcweir } 577cdf0e10cSrcweir liveupdate_updateReportTitle(String _sTitleName)578cdf0e10cSrcweir public void liveupdate_updateReportTitle(String _sTitleName) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir } 581cdf0e10cSrcweir addReportToDBView()582cdf0e10cSrcweir public void addReportToDBView() 583cdf0e10cSrcweir { 584cdf0e10cSrcweir getRecordParser().addReportDocument(getComponent(), true); 585cdf0e10cSrcweir } 586cdf0e10cSrcweir createAndOpenReportDocument( String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign )587cdf0e10cSrcweir public void createAndOpenReportDocument( String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign ) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir try 590cdf0e10cSrcweir { 591cdf0e10cSrcweir m_documentUI.loadComponent( DatabaseObject.REPORT, sReportName, _bOpenInDesign ); 592cdf0e10cSrcweir } 593cdf0e10cSrcweir catch ( Exception ex ) 594cdf0e10cSrcweir { 595cdf0e10cSrcweir Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); 596cdf0e10cSrcweir } 597cdf0e10cSrcweir } 598cdf0e10cSrcweir initializeFieldColumns(final int _nType, final String TableName, final String[] FieldNames)599cdf0e10cSrcweir public void initializeFieldColumns(final int _nType, final String TableName, final String[] FieldNames) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir getRecordParser().initializeFieldColumns(FieldNames, TableName); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir setFieldTitles(String[] sFieldTitles)604cdf0e10cSrcweir public void setFieldTitles(String[] sFieldTitles) 605cdf0e10cSrcweir { 606cdf0e10cSrcweir getRecordParser().setFieldTitles(sFieldTitles); 607cdf0e10cSrcweir } 608cdf0e10cSrcweir setSorting(String[][] aSortFieldNames)609cdf0e10cSrcweir public void setSorting(String[][] aSortFieldNames) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir getRecordParser().setSortFieldNames(aSortFieldNames); 612cdf0e10cSrcweir } 613cdf0e10cSrcweir setGrouping(String[] aGroupFieldNames)614cdf0e10cSrcweir public void setGrouping(String[] aGroupFieldNames) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir getRecordParser().prependSortFieldNames(aGroupFieldNames); 617cdf0e10cSrcweir } 618cdf0e10cSrcweir 619cdf0e10cSrcweir // TODO: we have to change to String List!!!! 620cdf0e10cSrcweir private ArrayList m_aReportPath = null; 621cdf0e10cSrcweir getReportPath()622cdf0e10cSrcweir public ArrayList getReportPath() 623cdf0e10cSrcweir { 624cdf0e10cSrcweir if (m_aReportPath == null) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir // Check general availability of office paths 627cdf0e10cSrcweir try 628cdf0e10cSrcweir { 629cdf0e10cSrcweir m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard"); 630cdf0e10cSrcweir // m_sReportPath = FileAccess.combinePaths(getMSF(), m_sReportPath, "/wizard/report"); 631cdf0e10cSrcweir FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report"); 632cdf0e10cSrcweir } 633cdf0e10cSrcweir catch (Exception e) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, e ); 636cdf0e10cSrcweir } 637cdf0e10cSrcweir } 638cdf0e10cSrcweir return m_aReportPath; 639cdf0e10cSrcweir } 640cdf0e10cSrcweir getContentPath()641cdf0e10cSrcweir public String getContentPath() 642cdf0e10cSrcweir { 643cdf0e10cSrcweir ArrayList aReportPath = getReportPath(); 644cdf0e10cSrcweir for (int i = 0; i < aReportPath.size(); i++) 645cdf0e10cSrcweir { 646cdf0e10cSrcweir String sPath = (String) aReportPath.get(i); 647cdf0e10cSrcweir sPath += "/cnt-default.ott"; 648cdf0e10cSrcweir if (FileAccess.isPathValid(getMSF(), sPath)) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir return sPath; 651cdf0e10cSrcweir } 652cdf0e10cSrcweir } 653cdf0e10cSrcweir return PropertyNames.EMPTY_STRING; 654cdf0e10cSrcweir } 655cdf0e10cSrcweir getLayoutPath()656cdf0e10cSrcweir public String getLayoutPath() 657cdf0e10cSrcweir { 658cdf0e10cSrcweir ArrayList aReportPath = getReportPath(); 659cdf0e10cSrcweir for (int i = 0; i < aReportPath.size(); i++) 660cdf0e10cSrcweir { 661cdf0e10cSrcweir String sPath = (String) aReportPath.get(i); 662cdf0e10cSrcweir sPath += "/stl-default.ott"; 663cdf0e10cSrcweir if (FileAccess.isPathValid(getMSF(), sPath)) 664cdf0e10cSrcweir { 665cdf0e10cSrcweir return sPath; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir } 668cdf0e10cSrcweir return PropertyNames.EMPTY_STRING; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir getDefaultPageOrientation()671cdf0e10cSrcweir public int getDefaultPageOrientation() 672cdf0e10cSrcweir { 673cdf0e10cSrcweir return m_nDefaultPageOrientation; 674cdf0e10cSrcweir } 675cdf0e10cSrcweir getDataLayout()676cdf0e10cSrcweir public String[][] getDataLayout() 677cdf0e10cSrcweir { 678cdf0e10cSrcweir String[][] ContentFiles; 679cdf0e10cSrcweir try 680cdf0e10cSrcweir { 681cdf0e10cSrcweir // ContentFiles = FileAccess.getFolderTitles(m_xMSF, "cnt", CurReportDocument.getReportPath()); 682cdf0e10cSrcweir ContentFiles = FileAccess.getFolderTitles(getMSF(), "cnt", getReportPath()); 683cdf0e10cSrcweir } 684cdf0e10cSrcweir catch (com.sun.star.wizards.common.NoValidPathException e) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir ContentFiles = new String[2][]; 687cdf0e10cSrcweir String[] a = new String[1]; 688cdf0e10cSrcweir String[] b = new String[1]; 689cdf0e10cSrcweir a[0] = "DefaultLayoutOfData"; 690cdf0e10cSrcweir b[0] = "default"; 691cdf0e10cSrcweir ContentFiles[1] = a; 692cdf0e10cSrcweir ContentFiles[0] = b; 693cdf0e10cSrcweir } 694cdf0e10cSrcweir return ContentFiles; 695cdf0e10cSrcweir } 696cdf0e10cSrcweir getHeaderLayout()697cdf0e10cSrcweir public String[][] getHeaderLayout() 698cdf0e10cSrcweir { 699cdf0e10cSrcweir String[][] LayoutFiles; 700cdf0e10cSrcweir try 701cdf0e10cSrcweir { 702cdf0e10cSrcweir // LayoutFiles = FileAccess.getFolderTitles(m_xMSF, "stl", CurReportDocument.getReportPath()); 703cdf0e10cSrcweir LayoutFiles = FileAccess.getFolderTitles(getMSF(), "stl", getReportPath()); 704cdf0e10cSrcweir } 705cdf0e10cSrcweir catch (com.sun.star.wizards.common.NoValidPathException e) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir LayoutFiles = new String[2][]; 708cdf0e10cSrcweir String[] a = new String[1]; 709cdf0e10cSrcweir String[] b = new String[1]; 710cdf0e10cSrcweir a[0] = "DefaultLayoutOfHeaders"; 711cdf0e10cSrcweir b[0] = "default"; 712cdf0e10cSrcweir LayoutFiles[1] = a; 713cdf0e10cSrcweir LayoutFiles[0] = b; 714cdf0e10cSrcweir } 715cdf0e10cSrcweir return LayoutFiles; 716cdf0e10cSrcweir } 717cdf0e10cSrcweir importReportData(ReportWizard _aWizard)718cdf0e10cSrcweir public void importReportData(ReportWizard _aWizard) 719cdf0e10cSrcweir { 720cdf0e10cSrcweir Dataimport CurDataimport = new Dataimport(_aWizard.xMSF); 721cdf0e10cSrcweir CurDataimport.CurReportDocument = this; 722cdf0e10cSrcweir _aWizard.importReportData(_aWizard.xMSF, CurDataimport); 723cdf0e10cSrcweir } 724cdf0e10cSrcweir setCommandType(int _nCommand)725cdf0e10cSrcweir public void setCommandType(int _nCommand) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir // already set somewhere else 728cdf0e10cSrcweir } 729cdf0e10cSrcweir setCommand(String _sCommand)730cdf0e10cSrcweir public void setCommand(String _sCommand) 731cdf0e10cSrcweir { 732cdf0e10cSrcweir getRecordParser().Command = _sCommand; 733cdf0e10cSrcweir } 734cdf0e10cSrcweir checkInvariants()735cdf0e10cSrcweir public void checkInvariants() throws java.lang.Exception 736cdf0e10cSrcweir { 737cdf0e10cSrcweir } 738cdf0e10cSrcweir } 739