summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/reportbuilder
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-08-18 02:27:27 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-08-18 02:27:27 +0200
commit57272eaaf5776f673b5141354a1d1e1af080d575 (patch)
tree9241d5523e03af24cd7ba2e45dd8b0951a9fdeb1 /wizards/com/sun/star/wizards/reportbuilder
parent1df024d97cc44155566f8db279e8cdba37e95fcf (diff)
parentf9d40c2b591215b57ece4ba6e623b7808a7ae717 (diff)
Merge commit 'f9d40c2b591215b57ece4ba6e623b7808a7ae717' into feature/gsoc2011_wizards
Conflicts: wizards/com/sun/star/wizards/common/Resource.java merged resolved as per: e52421bc118e9c5f3fce5a32ba9efdcad7627d92 9e91dbca08056fc31f388f5642fdfa3d2b910990 in the old components repository merging the corresponding commit 3b4fe490441f9f77829bc6c1ae30d79a4d50255b there
Diffstat (limited to 'wizards/com/sun/star/wizards/reportbuilder')
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java123
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java8
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java7
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java8
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java23
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java10
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java10
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java2
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java394
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java7
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java7
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java10
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java7
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java46
14 files changed, 339 insertions, 323 deletions
diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
index 6a90214696a5..9e40a0833f32 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
@@ -2,7 +2,7 @@
************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -33,7 +33,6 @@ import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XHierarchicalNameContainer;
-import com.sun.star.container.XNameContainer;
import com.sun.star.frame.XController;
import com.sun.star.frame.XDispatch;
import com.sun.star.frame.XDispatchProvider;
@@ -60,6 +59,7 @@ import java.util.Set;
import java.util.Vector;
import com.sun.star.wizards.common.FileAccess;
import com.sun.star.wizards.common.NamedValueCollection;
+import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.report.IReportBuilderLayouter;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
import com.sun.star.wizards.report.IReportDocument;
@@ -78,23 +78,24 @@ import java.util.logging.Logger;
public class ReportBuilderImplementation extends ReportImplementationHelper
implements IReportDocument, IReportDefinitionReadAccess
{
- private Resource m_resource;
- private XDatabaseDocumentUI m_documentUI;
+ private Resource m_resource;
+ private XDatabaseDocumentUI m_documentUI;
private static final int MAXIMUM_GROUPCOUNT = 4;
+ private String[] groupNames = null;
- private ReportBuilderImplementation( XMultiServiceFactory _serviceFactory )
+ private ReportBuilderImplementation(XMultiServiceFactory _serviceFactory)
{
// creates an access to the ReportBuilder Extension
super(_serviceFactory, ReportLayouter.SOOPTLANDSCAPE);
}
- public static IReportDocument create( XMultiServiceFactory i_serviceFactory )
+ public static IReportDocument create(XMultiServiceFactory i_serviceFactory)
{
- return new ReportBuilderImplementation( i_serviceFactory );
+ return new ReportBuilderImplementation(i_serviceFactory);
}
- public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )
+ public void initialize(final XDatabaseDocumentUI i_documentUI, final Resource i_resource)
{
m_documentUI = i_documentUI;
m_resource = i_resource;
@@ -106,12 +107,11 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
public XWindowPeer getWizardParent()
{
- final XWindowPeer aWindowPeer = UnoRuntime.queryInterface( XWindowPeer.class, getFrame().getComponentWindow() );
- return aWindowPeer;
+ return UnoRuntime.queryInterface(XWindowPeer.class, getFrame().getComponentWindow());
}
private XFrame m_xFrame = null;
// private ReportBuilderLayouter m_aReportBuilderLayouter = null;
- private String m_sReportBuilderLayoutName = "";
+ private String m_sReportBuilderLayoutName = PropertyNames.EMPTY_STRING;
/**
* Get access to the current ReportLayouter, which depends on the name.
@@ -120,8 +120,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
*/
private IReportBuilderLayouter getReportBuilderLayouter()
{
- final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName);
- return aReportBuilderLayouter;
+ return (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName);
}
private Object m_aReportDocument;
private XPropertySet m_documentDefinition;
@@ -139,15 +138,18 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
try
{
NamedValueCollection creationArgs = new NamedValueCollection();
- creationArgs.put( "DocumentServiceName", "com.sun.star.report.ReportDefinition" );
- creationArgs.put( "Mode", "remote" );
+ creationArgs.put("DocumentServiceName", "com.sun.star.report.ReportDefinition");
+ creationArgs.put("Mode", "remote");
- XComponent[] docDefinition = new XComponent[] { null };
+ XComponent[] docDefinition = new XComponent[]
+ {
+ null
+ };
XComponent reportDefinitionComp = m_documentUI.createComponentWithArguments(
- DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition );
+ DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition);
- m_documentDefinition = UnoRuntime.queryInterface( XPropertySet.class, docDefinition[0] );
- m_reportDocument = UnoRuntime.queryInterface( XReportDefinition.class, reportDefinitionComp );
+ m_documentDefinition = UnoRuntime.queryInterface(XPropertySet.class, docDefinition[0]);
+ m_reportDocument = UnoRuntime.queryInterface(XReportDefinition.class, reportDefinitionComp);
}
catch (com.sun.star.uno.Exception e)
{
@@ -164,8 +166,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
private XModeSelector getModeSelector()
{
final XController xController = getReportDefinition().getCurrentController();
- final XModeSelector xModeSelector = UnoRuntime.queryInterface( XModeSelector.class, xController );
- return xModeSelector;
+ return UnoRuntime.queryInterface(XModeSelector.class, xController);
}
private void switchOffAddFieldWindow()
@@ -209,11 +210,11 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
try
{
final XController xController = getReportDefinition().getCurrentController();
- final XDispatchProvider xDP = UnoRuntime.queryInterface( XDispatchProvider.class, xController );
+ final XDispatchProvider xDP = UnoRuntime.queryInterface(XDispatchProvider.class, xController);
// Create special service for parsing of given URL.
final Object aURLTransformer = getMSF().createInstance("com.sun.star.util.URLTransformer");
- final XURLTransformer xURLTransformer = UnoRuntime.queryInterface( com.sun.star.util.XURLTransformer.class, aURLTransformer );
+ final XURLTransformer xURLTransformer = UnoRuntime.queryInterface(com.sun.star.util.XURLTransformer.class, aURLTransformer);
com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1];
aURL[0] = new com.sun.star.util.URL();
@@ -273,14 +274,14 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
return;
}
- final XCommandProcessor xProcessor = UnoRuntime.queryInterface( XCommandProcessor.class, m_documentDefinition );
+ final XCommandProcessor xProcessor = UnoRuntime.queryInterface(XCommandProcessor.class, m_documentDefinition);
final com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
aCommand.Name = "store";
xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);
final XHierarchicalNameContainer aNameContainer = UnoRuntime.queryInterface(XHierarchicalNameContainer.class, m_aReportDocument);
- aNameContainer.insertByHierarchicalName( Name, m_documentDefinition );
+ aNameContainer.insertByHierarchicalName(Name, m_documentDefinition);
}
public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)
@@ -328,7 +329,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
/**
* Change the current Layouter by a new one with the given Name _sName.
- * If there exist no other layouter with the given name, nothing happens, the layouter will not change to
+ * If there exist no other layouter with the given name, nothing happens, the layouter will not change to
* an illegal one.
* @param _sName Name of the other layouter.
*/
@@ -366,19 +367,19 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
{
try
{
- if ( m_documentDefinition != null )
+ if (m_documentDefinition != null)
{
// set the document to "not modified", to ensure that it won't ask the user before closing
- XModifiable documentModify = UnoRuntime.queryInterface( XModifiable.class, m_reportDocument );
- documentModify.setModified( false );
+ XModifiable documentModify = UnoRuntime.queryInterface(XModifiable.class, m_reportDocument);
+ documentModify.setModified(false);
// actually close
- XSubDocument subComponent = UnoRuntime.queryInterface( XSubDocument.class, m_documentDefinition );
+ XSubDocument subComponent = UnoRuntime.queryInterface(XSubDocument.class, m_documentDefinition);
subComponent.close();
}
}
- catch ( Exception ex )
+ catch (Exception ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex);
}
m_documentDefinition = null;
m_reportDocument = null;
@@ -407,15 +408,15 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
{
}
- private XComponent loadReport( final String i_reportName )
+ private XComponent loadReport(final String i_reportName)
{
try
{
- return m_documentUI.loadComponent( DatabaseObject.REPORT, i_reportName, false );
+ return m_documentUI.loadComponent(DatabaseObject.REPORT, i_reportName, false);
}
- catch ( Exception ex )
+ catch (Exception ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@@ -428,19 +429,19 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
aCommand.Name = "open";
try
{
- final Object result = commandProcessor.execute( aCommand, commandProcessor.createCommandIdentifier(), null );
- return UnoRuntime.queryInterface( XComponent.class, result );
+ final Object result = commandProcessor.execute(aCommand, commandProcessor.createCommandIdentifier(), null);
+ return UnoRuntime.queryInterface(XComponent.class, result);
}
- catch ( Exception ex )
+ catch (Exception ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
- public void createAndOpenReportDocument( String i_name, boolean i_asTemplate, boolean i_openForEditing )
+ public void createAndOpenReportDocument(String i_name, boolean i_asTemplate, boolean i_openForEditing)
{
- if ( i_openForEditing )
+ if (i_openForEditing)
{
// we won't destroy the report builder window, also don't create a document
// Do we need to reopen the report builder with the known name?
@@ -449,13 +450,13 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
return;
}
- if ( i_asTemplate )
+ if (i_asTemplate)
{
// don't need the report definition anymore - the document it represents has already been stored
closeReportDefinition();
// open the report, again, this time not in design, but containing data
- loadReport( i_name );
+ loadReport(i_name);
}
else
{
@@ -466,8 +467,10 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
closeReportDefinition();
// store the generated report
- if ( getRecordParser().storeDatabaseDocumentToTempPath( document, i_name ) )
- getRecordParser().addReportDocument( document, false );
+ if (getRecordParser().storeDatabaseDocumentToTempPath(document, i_name))
+ {
+ getRecordParser().addReportDocument(document, false);
+ }
}
dispose();
@@ -509,10 +512,17 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
public void setSorting(String[][] _aSortFieldNames)
{
getRecordParser().setSortFieldNames(_aSortFieldNames);
+ if (groupNames != null)
+ {
+ getRecordParser().prependSortFieldNames(groupNames);
+ }
+ getReportBuilderLayouter().insertSortingNames(_aSortFieldNames);
+ getReportBuilderLayouter().layout();
}
public void setGrouping(String[] _aGroupFieldNames)
{
+ groupNames = _aGroupFieldNames;
getRecordParser().prependSortFieldNames(_aGroupFieldNames);
getReportBuilderLayouter().insertGroupNames(_aGroupFieldNames);
@@ -532,12 +542,12 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
try
{
// Check general availability of office paths
- m_aReportPath = FileAccess.getOfficePaths( getMSF(), "Template", "share", "/wizard" );
- FileAccess.combinePaths( getMSF(), m_aReportPath, "/wizard/report" );
+ m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
+ FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report");
}
- catch ( NoValidPathException ex )
+ catch (NoValidPathException ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex);
}
}
return m_aReportPath;
@@ -545,7 +555,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
public String getContentPath()
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public int getDefaultPageOrientation()
@@ -573,8 +583,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
Object[] aParams = new Object[2];
aParams[0] = this;
aParams[1] = m_resource;
- final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) cTor.newInstance(aParams);
- return aReportBuilderLayouter;
+ return (IReportBuilderLayouter) cTor.newInstance(aParams);
}
catch (Exception e)
{
@@ -642,7 +651,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
String[] a = new String[getLayoutMap().size()];
String[] b = new String[getLayoutMap().size()];
- // run through the whole layoutmap and
+ // run through the whole layoutmap and
final Set aKeys = getLayoutMap().keySet();
final Iterator aKeyIterator = aKeys.iterator();
int i = 0;
@@ -727,7 +736,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
getReportDefinition().setCommandType(_nCommand);
}
-
public void checkInvariants() throws java.lang.Exception
{
final String sDefaultHeaderLayoutPath = getDefaultHeaderLayout();
@@ -737,12 +745,9 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
}
FileAccess aAccess = new FileAccess(getGlobalMSF());
- if (! aAccess.exists(sDefaultHeaderLayoutPath, true))
+ if (!aAccess.exists(sDefaultHeaderLayoutPath, true))
{
throw new java.io.IOException("default.otr");
}
}
-
}
-
-
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
index ccb74ebf6f07..8bd706a32241 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
@@ -2,7 +2,7 @@
************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,6 +28,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -52,8 +53,7 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 81);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 81);
}
protected void insertDetailFields()
@@ -98,7 +98,7 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
index 2dc468fb09e7..288180921f5e 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -51,8 +51,7 @@ public class ColumnarThreeColumns extends ColumnarTwoColumns
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 83);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 83);
}
protected void insertDetailFields()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
index d79713524021..0060ca7f3b9f 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
@@ -2,7 +2,7 @@
************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,6 +28,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -52,8 +53,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 82);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 82);
}
protected void insertDetailFields()
@@ -130,7 +130,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
index 55fdafe6c79a..e5c2089963a2 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -41,6 +41,7 @@ import com.sun.star.report.XReportDefinition;
import com.sun.star.report.XSection;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.common.PropertyNames;
/**
*
@@ -180,7 +181,7 @@ public class DesignTemplate
// is aObj a textfield
// m_aDetailLabel_FD
// m_aDetailTextField_FD
- XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj);
+ XFixedText aFixedText = UnoRuntime.queryInterface(XFixedText.class, aObj);
if (aFixedText != null &&
m_aDetailLabel == null)
{
@@ -188,7 +189,7 @@ public class DesignTemplate
}
else
{
- XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ XFormattedField aFormattedField = UnoRuntime.queryInterface(XFormattedField.class, aObj);
if (aFormattedField != null &&
m_aDetailTextField == null)
{
@@ -217,7 +218,7 @@ public class DesignTemplate
try
{
Object aGroup = xGroups.getByIndex(nGroup);
- XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
+ XGroup xGroup = UnoRuntime.queryInterface(XGroup.class, aGroup);
XSection xGroupSection = xGroup.getHeader();
final int nCount = xGroupSection.getCount();
@@ -226,7 +227,7 @@ public class DesignTemplate
try
{
Object aObj = xGroupSection.getByIndex(i);
- XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj);
+ XFixedText aFixedText = UnoRuntime.queryInterface(XFixedText.class, aObj);
// is aObj a label
// is aObj a textfield
if (aFixedText != null &&
@@ -236,7 +237,7 @@ public class DesignTemplate
}
else
{
- XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ XFormattedField aFormattedField = UnoRuntime.queryInterface(XFormattedField.class, aObj);
if (aFormattedField != null &&
m_aGroupTextField[nGroup] == null)
{
@@ -282,7 +283,7 @@ public class DesignTemplate
/**
* create a new DesignTemplate by try to load a otr file from the given path.
* Internally we store the loaded ReportDefinition.
- *
+ *
* @param _xMSF
* @param _sPath
* @return
@@ -316,11 +317,11 @@ public class DesignTemplate
m_xGlobalMSF = _xMSF;
m_sFilename = _sPath;
final Object aObj = _xMSF.createInstance("com.sun.star.report.ReportDefinition");
- m_xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj);
+ m_xReportDefinition = UnoRuntime.queryInterface(XReportDefinition.class, aObj);
PropertyValue[] aLoadProps = new PropertyValue[2];
- aLoadProps[0] = Properties.createProperty("URL", _sPath);
- aLoadProps[1] = Properties.createProperty("ReadOnly", Boolean.TRUE);
+ aLoadProps[0] = Properties.createProperty(PropertyNames.URL, _sPath);
+ aLoadProps[1] = Properties.createProperty(PropertyNames.READ_ONLY, Boolean.TRUE);
m_xReportDefinition.load(aLoadProps);
analyseReportDefinition();
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
index 9fd891a446f2..fe1b2f6f27ee 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -29,6 +29,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -53,8 +54,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 85);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 85);
}
protected void insertDetailFields()
@@ -159,7 +159,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
index c03cf7cec909..2052c40cfb42 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -29,6 +29,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -53,8 +54,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 84);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 84);
}
protected void insertDetailFields()
@@ -126,7 +126,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java b/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java
index c31ce4b5f277..d5261c62dc33 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java
@@ -2,7 +2,7 @@
* ***********************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
index 0c2e5af3bd36..6fe96bb2fc94 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
@@ -1,8 +1,7 @@
-/*
- ************************************************************************
+/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -72,6 +71,8 @@ import com.sun.star.wizards.report.IReportDefinitionReadAccess;
import com.sun.star.wizards.ui.UIConsts;
import java.util.HashMap;
import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* This class is abstract and more like a helper for create different layouts for Report Builder Wizard.
@@ -83,6 +84,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
private IReportDefinitionReadAccess m_xReportDefinitionReadAccess;
private Resource m_aResource;
+ private String[][] m_aSortNames;
/**
* dispose the ReportBuilderLayouter
@@ -91,13 +93,13 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
closeDesignTemplate();
m_xReportDefinitionReadAccess = null;
- // m_xReportBuilderLayouter = null;
+ // m_xReportBuilderLayouter = null;
}
/**
* The Constructor is protected, this is a abstract class, use Tabular or other to create an instance.
* @param _xDefinitionAccess
- * @param _aResource
+ * @param _aResource
*/
protected ReportBuilderLayouter(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
{
@@ -126,7 +128,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
/**
* Layout the complete report new, by all information we know until this time.
- *
+ *
* If there are some information less, it is no problem for this function, they will be leaved out.
* It is possible to call this function after every change, but be careful, could take a little bit longer.
*/
@@ -148,11 +150,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
insertPageFooter();
clearGroups();
- insertGroups();
+ int lastGroupPostion = insertGroups();
clearDetails();
// clearFieldTitles();
- insertDetailFieldTitles();
+ insertDetailFieldTitles(lastGroupPostion);
insertDetailFields();
}
catch (java.lang.ArrayIndexOutOfBoundsException e)
@@ -163,13 +165,13 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
throw e;
}
- catch (Exception e)
+ catch (Exception ex)
{
- // Exception not set. Not from interest here.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
// -------------------------------------------------------------------------
+
/**
* Remove all Groups
*/
@@ -183,16 +185,17 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
xGroups.removeByIndex(0);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // Exception not set. Not from interest here.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
// -------------------------------------------------------------------------
+
/**
* Remove all fields
- * @param _xSectionToClear
+ * @param _xSectionToClear
*/
private void emptySection(XSection _xSectionToClear)
{
@@ -206,13 +209,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aObj = _xSectionToClear.getByIndex(0);
- final XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aObj);
+ final XShape aShape = UnoRuntime.queryInterface(XShape.class, aObj);
_xSectionToClear.remove(aShape);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -226,8 +228,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// public void clearFieldTitles()
// {
// }
+
/**
- *
+ *
* @param _nGroupCount
* @return the left indent in 1/100mm
*/
@@ -291,7 +294,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// get all Page Styles
final Object aPageStylesObj = xNameAccess.getByName(_sStyleName);
- final XNameAccess xContainer = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj);
+ final XNameAccess xContainer = UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj);
// step over all Page Styles, search the one which is in use
final String[] aElementNames = xContainer.getElementNames();
@@ -299,7 +302,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
final String sName = aElementNames[i];
final Object aObj = xContainer.getByName(sName);
- final XStyle xStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, aObj);
+ final XStyle xStyle = UnoRuntime.queryInterface(XStyle.class, aObj);
if (xStyle.isInUse())
{
aUsedStyle = xStyle;
@@ -307,10 +310,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- e.printStackTrace();
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
return aUsedStyle;
}
@@ -352,6 +354,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return m_nPageWidth;
}
// -------------------------------------------------------------------------
+
/**
* Stores the Group names. To insert/create a report with such group names, call layout()
* @param _aGroupNames
@@ -361,6 +364,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
m_aGroupNames = _aGroupNames;
}
+ public void insertSortingNames(String[][] _aSortFieldNames)
+ {
+ m_aSortNames = _aSortFieldNames;
+ }
+
protected void copyGroupProperties(int _nGroup)
{
if (getDesignTemplate() != null)
@@ -368,103 +376,111 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final XGroups xForeignGroups = getDesignTemplate().getGroups();
- int nGroups = xForeignGroups.getCount();
- Object aForeignGroup = xForeignGroups.getByIndex(_nGroup);
- XGroup xForeignGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aForeignGroup);
- XSection xForeignGroupSection = xForeignGroup.getHeader();
-
- if (xForeignGroupSection != null)
+ if (_nGroup < xForeignGroups.getCount())
{
- final XGroups xGroups = getReportDefinition().getGroups();
- Object aGroup = xGroups.getByIndex(_nGroup);
- XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
- XSection xGroupSection = xGroup.getHeader();
+ XGroup xForeignGroup = UnoRuntime.queryInterface(XGroup.class, xForeignGroups.getByIndex(_nGroup));
+ XSection xForeignGroupSection = xForeignGroup.getHeader();
- // copy Properties
- copyProperties(xForeignGroupSection, xGroupSection);
+ if (xForeignGroupSection != null)
+ {
+ final XGroups xGroups = getReportDefinition().getGroups();
+ Object aGroup = xGroups.getByIndex(_nGroup);
+ XGroup xGroup = UnoRuntime.queryInterface(XGroup.class, aGroup);
+ XSection xGroupSection = xGroup.getHeader();
+
+ // copy Properties
+ copyProperties(xForeignGroupSection, xGroupSection);
+ }
}
}
- catch (Exception e)
+ catch (Exception ex)
{
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
// -------------------------------------------------------------------------
- protected void insertGroups()
- {
- if (m_aGroupNames == null)
- {
- return;
- }
+ protected int insertGroups()
+ {
final XGroups xGroups = getReportDefinition().getGroups();
- final int nLeftPageIndent = getLeftPageIndent();
- final int nLabelWidth = getMaxLabelWidth(); // 3000;
- final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
- final int nFieldWidth = nUsablePageWidth - nLabelWidth;
-
- // after done with all groups, we need access to the last group, for set property 'KeepTogether' so we remember it.
- XGroup aLastGroup = null;
+ int lastGroupPosition = -1;
- for (int i = 0; i < m_aGroupNames.length; i++)
+ if (m_aGroupNames != null)
{
- final XGroup xGroup = xGroups.createGroup();
- aLastGroup = xGroup;
+ final int nLeftPageIndent = getLeftPageIndent();
+ final int nLabelWidth = getMaxLabelWidth(); // 3000;
+ final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
+ final int nFieldWidth = nUsablePageWidth - nLabelWidth;
- // TODO: debug what the m_aGroupNames are, "field:[...]" or the "fieldname"
- xGroup.setExpression(m_aGroupNames[i]);
- xGroup.setHeaderOn(true);
- // we don't want any group footer (default off)
- // xGroup.setFooterOn(true);
+ XGroup aLastGroup = null;
+ // after done with all groups, we need access to the last group, for set property 'KeepTogether' so we remember it.
- try
+ for (int i = 0; i < m_aGroupNames.length; i++)
{
- // we need to append by hand
- // TODO: documentation is unclear here, that we have to insert by hand
- int nCount = xGroups.getCount();
- xGroups.insertByIndex(nCount, xGroup);
+ lastGroupPosition = i;
+ final XGroup xGroup = xGroups.createGroup();
+ aLastGroup = xGroup;
- final XSection xGroupSection = xGroup.getHeader();
- copyGroupProperties(nCount);
-
- Rectangle aRect = new Rectangle();
- aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
- SectionObject aSO = getDesignTemplate().getGroupLabel(i);
- int nLabelHeight = 0;
-// if (aSO != null)
-// {
- nLabelHeight = aSO.getHeight(LayoutConstants.LabelHeight);
- aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO);
-// }
-// else
-// {
-// nLabelHeight = 500;
-// aRect = insertBoldLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth);
-// }
- final String sGroupName = convertToFieldName(m_aGroupNames[i]);
- aSO = getDesignTemplate().getGroupTextField(i);
- insertFormattedField(xGroupSection, sGroupName, aRect, nFieldWidth, aSO);
+ xGroup.setExpression(m_aGroupNames[i]);
+ xGroup.setHeaderOn(true);
- // draw a line under the label/formattedfield
- aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
- aRect.Y = nLabelHeight;
- final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
- final int nLineHeight = LayoutConstants.LineHeight;
- insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight);
- xGroupSection.setHeight(nLabelHeight + nLineHeight);
+ try
+ {
+ int nCount = xGroups.getCount();
+ xGroups.insertByIndex(nCount, xGroup);
+ final XSection xGroupSection = xGroup.getHeader();
+ copyGroupProperties(nCount);
+
+ Rectangle aRect = new Rectangle();
+ aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
+ SectionObject aSO = getDesignTemplate().getGroupLabel(i);
+ aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO);
+ final String sGroupName = convertToFieldName(m_aGroupNames[i]);
+ aSO = getDesignTemplate().getGroupTextField(i);
+ aRect = insertFormattedField(xGroupSection, sGroupName, aRect, nFieldWidth, aSO);
+ int height = aRect.Height;
+
+ // draw a line under the label/formattedfield
+ aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
+ aRect.Y = aRect.Height;
+ final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
+ final int nLineHeight = LayoutConstants.LineHeight;
+ insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight);
+ xGroupSection.setHeight(height + nLineHeight);
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
+ }
}
- catch (com.sun.star.uno.Exception e)
+
+ // hold the inner group together
+ if (aLastGroup != null)
{
- // TODO: Exception not set.
+ doNotBreakInTable(aLastGroup);
}
}
-
- // hold the inner group together
- if (aLastGroup != null)
+ if (m_aSortNames != null)
{
- doNotBreakInTable(aLastGroup);
+ for (String[] sortFieldName : m_aSortNames)
+ {
+ try
+ {
+ final XGroup xGroup = xGroups.createGroup();
+ xGroup.setExpression(sortFieldName[0]);
+ xGroup.setSortAscending(PropertyNames.ASC.equals(sortFieldName[1]));
+ xGroup.setHeaderOn(false);
+ int nCount = xGroups.getCount();
+ xGroups.insertByIndex(nCount, xGroup);
+ }
+ catch (java.lang.Exception ex)
+ {
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
}
+ return lastGroupPosition;
}
// -------------------------------------------------------------------------
@@ -487,10 +503,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return m_aFieldTitleNames[i];
}
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
- protected int getTypeFromFieldName(String _sField)
+ protected int getTypeFromFieldName(String _sField)
{
for (int i = 0; i < m_aFieldNames.length; i++)
{
@@ -514,6 +530,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return false;
}
// -------------------------------------------------------------------------
+
/**
* Helper to get all field names without the names which are already in the group names
* @param _aList
@@ -542,7 +559,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
for (int i = 0; i < _aList.length; i++)
{
final String sField = _aList[i];
- if (listContains(m_aGroupNames, sField) == true)
+ if (listContains(m_aGroupNames, sField))
{
continue;
}
@@ -578,8 +595,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return getNamesWithoutGroupNames(m_aFieldNames, m_aFieldTitleNames);
}
// -------------------------------------------------------------------------
- abstract protected void insertDetailFieldTitles();
+
+ abstract protected void insertDetailFieldTitles(int lastGroupPostion);
// -------------------------------------------------------------------------
+
/**
* Give a list off all field names to insert the field names, call layout()
* @param _aFieldNames
@@ -627,12 +646,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
copyProperties(xForeignSection, xSection);
}
}
- catch (Exception e)
+ catch (Exception ex)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
// -------------------------------------------------------------------------
+
protected Rectangle insertLabel(XSection _xSection, String _sLabel, Rectangle _aRect, int _nWidth, SectionObject _aSO)
{
if (_xSection != null)
@@ -640,7 +661,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
- final XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ final XFixedText xFixedText = UnoRuntime.queryInterface(XFixedText.class, aFixedText);
int nHeight = LayoutConstants.LabelHeight; // default height of label is fixed.
@@ -678,15 +699,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
xFixedText.setHeight(nHeight);
_xSection.add(xFixedText);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
return _aRect;
}
// -------------------------------------------------------------------------
+
protected String convertToFieldName(String _sElementName)
{
final StringBuffer aDataField = new StringBuffer(32);
@@ -694,27 +715,28 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return aDataField.toString();
}
+
protected String convertFromFieldName(String _sName)
{
if (_sName.startsWith("field:["))
{
int nCloseBrace = _sName.lastIndexOf("]");
- final String sName = _sName.substring(7, nCloseBrace).trim();
- return sName;
+ return _sName.substring(7, nCloseBrace).trim();
}
return _sName;
}
// -------------------------------------------------------------------------
+
/**
* Insert a already formatted field name into a given section
- *
+ *
* Use 'convertToFieldName(dbfield)' to convert a dbfield name in the right.
- *
+ *
* @param _xSection in which section the formatted field will store
* @param _sFormattedfield as String a dbfield or an other function
* @param _aRect .X, .Y are the absolute position (1/100mm) where the formatted field will set
* @param _nWidth the width of the field in 1/100mm
- * @param _aSO
+ * @param _aSO
* @return a new Rectangle with the new Rect.X position, Rect.Y will not change.
*/
protected Rectangle insertFormattedField(XSection _xSection, String _sFormattedfield, Rectangle _aRect, int _nWidth, SectionObject _aSO)
@@ -732,9 +754,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
int nHeight = LayoutConstants.FormattedFieldHeight;
int nType = getTypeFromFieldName(convertFromFieldName(_sFormattedfield));
- if (nType == DataType.BINARY ||
- nType == DataType.VARBINARY ||
- nType == DataType.LONGVARBINARY)
+ if (nType == DataType.BINARY
+ || nType == DataType.VARBINARY
+ || nType == DataType.LONGVARBINARY)
{
aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl");
nHeight = LayoutConstants.BinaryHeight;
@@ -744,20 +766,21 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
aField = getMSFofReportDefinition().createInstance("com.sun.star.report.FormattedField");
nHeight = LayoutConstants.FormattedFieldHeight;
if (nType == DataType.LONGVARCHAR) /* memo */
+
{
nHeight = LayoutConstants.MemoFieldHeight; // special case for memo
}
}
_aRect.Height = nHeight;
- final XReportControlModel xReportControlModel = (XReportControlModel) UnoRuntime.queryInterface(XReportControlModel.class, aField);
+ final XReportControlModel xReportControlModel = UnoRuntime.queryInterface(XReportControlModel.class, aField);
if (xReportControlModel != null)
{
// #i86907# not documented right in idl description.
xReportControlModel.setDataField(_sFormattedfield);
if (_aSO != null)
{
- // TODO: there seems to be some problems with copy all properties from the design template to the current design
+ // TODO: there seems to be some problems with copy all properties from the design template to the current design
final FontDescriptor aFD = _aSO.getFontDescriptor();
if (aFD != null)
{
@@ -772,12 +795,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
_aRect.X += _nWidth;
xReportControlModel.setHeight(nHeight);
- if (nType == DataType.BINARY ||
- nType == DataType.VARBINARY ||
- nType == DataType.LONGVARBINARY)
+ if (nType == DataType.BINARY
+ || nType == DataType.VARBINARY
+ || nType == DataType.LONGVARBINARY)
{
// aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl");
- final XImageControl xImageControl = (XImageControl) UnoRuntime.queryInterface(XImageControl.class, xReportControlModel);
+ final XImageControl xImageControl = UnoRuntime.queryInterface(XImageControl.class, xReportControlModel);
if (xImageControl != null)
{
// xImageControl.setScaleImage(true);
@@ -795,19 +818,19 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// xReportControlModel.???
// }
}
- catch (com.sun.star.beans.UnknownPropertyException e)
+ catch (com.sun.star.beans.UnknownPropertyException ex)
{
- // seems we not able to set ParaAdjust
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
// spezial case rpt:now() (default date format)
if (_sFormattedfield.equals("rpt:now()"))
{
- final XFormattedField xFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel);
+ final XFormattedField xFormattedField = UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel);
XNumberFormatsSupplier x = xFormattedField.getFormatsSupplier();
XNumberFormats xFormats = x.getNumberFormats();
- XNumberFormatTypes x3 = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats);
+ XNumberFormatTypes x3 = UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats);
Locale.getDefault();
com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale();
aLocale.Country = Locale.getDefault().getCountry();
@@ -819,10 +842,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
_xSection.add(xReportControlModel);
}
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
return _aRect;
@@ -845,12 +867,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
if (m_xMSF == null)
{
- final XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition());
- m_xMSF = xMSF;
+ m_xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition());
}
return m_xMSF;
}
// -------------------------------------------------------------------------
+
protected Rectangle insertVerticalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight)
{
return insertLine(_xSection, _aRect, _nWidth, _nHeight, 1);
@@ -868,7 +890,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aFixedLine = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedLine");
- final XFixedLine xFixedLine = (XFixedLine) UnoRuntime.queryInterface(XFixedLine.class, aFixedLine);
+ final XFixedLine xFixedLine = UnoRuntime.queryInterface(XFixedLine.class, aFixedLine);
xFixedLine.setOrientation(_nOrientation);
// TODO: line width is fixed
@@ -882,15 +904,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
xFixedLine.setHeight(_nHeight);
_xSection.add(xFixedLine);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
return _aRect;
}
// -------------------------------------------------------------------------
+
protected void clearReportHeader()
{
XSection xSection;
@@ -902,9 +924,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
emptySection(xSection);
}
}
- catch (com.sun.star.container.NoSuchElementException e)
+ catch (com.sun.star.container.NoSuchElementException ex)
{
- // Exception not set. Not really from interest.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -930,6 +952,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
else
@@ -953,7 +976,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.container.NoSuchElementException e)
{
- // Exception not set. Not really from interest.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -979,6 +1002,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
else
@@ -989,6 +1013,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
// -------------------------------------------------------------------------
+
protected void clearPageHeader()
{
XSection xSection;
@@ -1002,7 +1027,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.container.NoSuchElementException e)
{
- // Exception not set. Not really from interest.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -1010,14 +1035,13 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// {
// GregorianCalendar aCalendar = new GregorianCalendar();
// StringBuffer aBuf = new StringBuffer();
-//
+//
// Locale aLocale = new Locale("en","US");
// SimpleDateFormat aFormat = new SimpleDateFormat(_sFormat, aLocale);
// aBuf = aFormat.format(aCalendar.getTime(), aBuf, new FieldPosition(0) );
// // DebugHelper.writeInfo("Date: " + aBuf.toString());
// return aBuf.toString();
// }
-
// protected String getCurrentDate()
// {
// Calendar aCalendar = Calendar.getInstance();
@@ -1038,14 +1062,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
//// long nTime = aDate.getTime();
//// Long aLong = new Long(nTime);
//// String aStr = aLong.toString();
-////
+////
//// Date aNewDate = new Date(1202382900000L);
////// aNewDate.
//// String aDateStr = aNewDate.toString();
////// Datetime aNewTime = new Time(1202382900);
////// String aTimeStr = aNewTime.toString();
////
-//
+//
// }
protected void clearPageFooter()
{
@@ -1060,7 +1084,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.container.NoSuchElementException e)
{
- // Exception not set. Should not from interest here.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -1094,7 +1118,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
/**
* Returns the width and height of a given string (_sText) in 1/100mm drawn in the given font descriptor.
* TODO: This function is a performance leak, we could store already calculated values in a map, to build a cache. Access should be much faster then.
- *
+ *
* @param _sText
* @param _aFont
* @return width of given text in 1/100mm
@@ -1108,49 +1132,49 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(XControlContainer.class, aControlContainer);
final Object aFixedTextModel = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlFixedTextModel");
- final XControlModel xFixedTextModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
+ final XControlModel xFixedTextModel = UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
final PropertySetHelper aPropertySetHelper = new PropertySetHelper(xFixedTextModel);
// aPropertySetHelper.showProperties();
- aPropertySetHelper.setPropertyValueDontThrow("FontDescriptor", _aFont);
+ aPropertySetHelper.setPropertyValueDontThrow(PropertyNames.FONT_DESCRIPTOR, _aFont);
final Object aUnoCtrlFixedText = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlFixedText");
// XServiceInfo xServiceInfo2 = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, aUnoCtrlFixedText);
// String[] sServices2 = xServiceInfo2.getSupportedServiceNames();
- final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText);
+ final XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText);
xWindow.setVisible(false);
- final XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText);
+ final XControl xControl = UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText);
xControl.setModel(xFixedTextModel);
- final com.sun.star.awt.XFixedText xFixedText = (com.sun.star.awt.XFixedText) UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText);
+ final com.sun.star.awt.XFixedText xFixedText = UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText);
xFixedText.setText(_sText);
- final XLayoutConstrains xLayoutConstraints = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText);
+ final XLayoutConstrains xLayoutConstraints = UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText);
final Size aSizeInPixel = xLayoutConstraints.getPreferredSize();
- final XWindowPeer xPeerOfReportDefinition = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow());
+ final XWindowPeer xPeerOfReportDefinition = UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow());
xControl.createPeer(null, xPeerOfReportDefinition);
final XWindowPeer x = xControl.getPeer();
- final XUnitConversion xConversion = (XUnitConversion) UnoRuntime.queryInterface(XUnitConversion.class, x);
+ final XUnitConversion xConversion = UnoRuntime.queryInterface(XUnitConversion.class, x);
aSizeMM_100TH = xConversion.convertSizeToLogic(aSizeInPixel, com.sun.star.util.MeasureUnit.MM_100TH);
// xToolkit.createScreenCompatibleDevice(_nWidth, _nWidth).
// XWindow x = getReportDefinition().getCurrentController().getFrame().getContainerWindow();
// Object aObj = _xSection.getParent();
// we don't need the created objects any longer
- final XComponent xFixedTextDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFixedText);
+ final XComponent xFixedTextDeleter = UnoRuntime.queryInterface(XComponent.class, xFixedText);
xFixedTextDeleter.dispose();
- final XComponent xFixedTextModelDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, aFixedTextModel);
+ final XComponent xFixedTextModelDeleter = UnoRuntime.queryInterface(XComponent.class, aFixedTextModel);
xFixedTextModelDeleter.dispose();
}
catch (Exception e)
{
- // TODO: Exception not set.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
return aSizeMM_100TH;
}
@@ -1161,24 +1185,24 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
return m_sTableName;
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
protected String getUserNameFromConfiguration()
{
- String sFirstName = "";
- String sLastName = "";
+ String sFirstName = PropertyNames.EMPTY_STRING;
+ String sLastName = PropertyNames.EMPTY_STRING;
try
{
Object oProdNameAccess = Configuration.getConfigurationRoot(getGlobalMSF(), "org.openoffice.UserProfile/Data", false);
sFirstName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "givenname");
sLastName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "sn");
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
- return sFirstName + " " + sLastName;
+ return sFirstName + PropertyNames.SPACE + sLastName;
}
/**
@@ -1188,8 +1212,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
*/
private void copyProperties(Object _aFrom, Object _aTo)
{
- XPropertySet xFrom = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aFrom);
- XPropertySet xTo = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aTo);
+ XPropertySet xFrom = UnoRuntime.queryInterface(XPropertySet.class, _aFrom);
+ XPropertySet xTo = UnoRuntime.queryInterface(XPropertySet.class, _aTo);
XPropertySetInfo xForeignPropInfo = xFrom.getPropertySetInfo();
@@ -1210,6 +1234,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
}
@@ -1230,7 +1255,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
while (xEnum.hasMoreElements())
{
Object aEnumObj = xEnum.nextElement();
- XReportComponent aComponent = (XReportComponent) UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);
+ XReportComponent aComponent = UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);
// XCloneable aClone = (XCloneable)UnoRuntime.queryInterface(XCloneable.class, aEnumObj);
if (aComponent != null)
@@ -1238,14 +1263,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
Object aClone = aComponent.createClone();
if (aClone != null)
{
- String sName = aComponent.getName();
- com.sun.star.awt.Point aPosition = aComponent.getPosition();
- Size aSize = aComponent.getSize();
-
- XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aClone);
- String sShapeType = aShape.getShapeType();
- com.sun.star.awt.Point aShapePoint = aShape.getPosition();
- Size aShapeSize = aShape.getSize();
+ XShape aShape = UnoRuntime.queryInterface(XShape.class, aClone);
// normally 'createClone' will create a real clone of the component,
// but there seems some problems, we have to controll.
@@ -1260,9 +1278,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
- // String sName = xForeignSection.getName();
- // int dummy = 0;
+ // String sName = xForeignSection.getName();
+ // int dummy = 0;
}
protected void insertPageHeader()
@@ -1287,9 +1306,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
+ }
}
- return;
- }
else
{
// we won't a page header
@@ -1364,7 +1383,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.uno.Exception e)
{
- // TODO: Exception not set.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
}
@@ -1390,6 +1409,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
else
@@ -1423,8 +1443,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
final String sSurroundDoubleQuotes = "\"" + sPageOf + "\"";
final String sPageNumber = sSurroundDoubleQuotes.replaceAll("#page#", "\" & PageNumber() & \"");
final String sPageCount = sPageNumber.replaceAll("#count#", "\" & PageCount() & \"");
- final String sNoLastUnusedQuotes = sPageCount.replaceAll(" & \\\"\\\"", "");
- final String sNoFirstUnusedQuotes = sNoLastUnusedQuotes.replaceAll("\\\"\\\" & ", "");
+ final String sNoLastUnusedQuotes = sPageCount.replaceAll(" & \\\"\\\"", PropertyNames.EMPTY_STRING);
+ final String sNoFirstUnusedQuotes = sNoLastUnusedQuotes.replaceAll("\\\"\\\" & ", PropertyNames.EMPTY_STRING);
final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent();
@@ -1445,17 +1465,16 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
aRect.Y += nLineHeight;
aRect.Y += LayoutConstants.LabelHeight;
- final int nWidth = nUsablePageWidth;
aRect.X = getLeftPageIndent();
- aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nWidth, null, (short) com.sun.star.awt.TextAlign.CENTER);
+ aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nUsablePageWidth, null, (short) com.sun.star.awt.TextAlign.CENTER);
aRect.Y += LayoutConstants.FormattedFieldHeight + LayoutConstants.LineHeight;
xSection.setHeight(aRect.Y);
}
catch (Exception e)
{
- // TODO: Exception not set.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
}
@@ -1574,7 +1593,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
if (m_aFixedTextHelper == null)
{
final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
- m_aFixedTextHelper = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ m_aFixedTextHelper = UnoRuntime.queryInterface(XFixedText.class, aFixedText);
}
m_aFixedTextHelper.setLabel(_sLabel);
@@ -1595,7 +1614,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.uno.Exception e)
{
- // TODO: Exception not set.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
return nWidth;
@@ -1623,7 +1642,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
String sDefaultHeaderLayout = m_xReportDefinitionReadAccess.getDefaultHeaderLayout();
loadAndSetBackgroundTemplate(sDefaultHeaderLayout);
- // copy all functions from the design template to the current report definition
+ // copy all functions from the design template to the current report definition
// XFunctions xOtherFunctions = m_xDesignTemplate.getReportDefinition().getFunctions();
// final int nFunctionCount = xOtherFunctions.getCount();
// for (int i=0;i<nFunctionCount;i++)
@@ -1648,7 +1667,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// {
// ex.printStackTrace();
// }
-//
+//
// }
}
@@ -1678,8 +1697,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
closeDesignTemplate();
String sName = FileAccess.getFilename(LayoutTemplatePath);
- if (sName.toLowerCase().equals("default.otr_") ||
- LayoutTemplatePath.equals("DefaultLayoutOfHeaders"))
+ if (sName.toLowerCase().equals("default.otr_")
+ || LayoutTemplatePath.equals("DefaultLayoutOfHeaders"))
{
// this is the default layout, we don't want to have a layout for this.
}
@@ -1690,4 +1709,3 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
}
-
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
index 8df754795e63..198f76b6720e 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -44,8 +44,7 @@ public class SectionEmptyObject extends SectionObject
public static SectionObject create()
{
- SectionEmptyObject a = new SectionEmptyObject();
- return a;
+ return new SectionEmptyObject();
}
public FontDescriptor getFontDescriptor()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
index ae3766fd3391..874e165088d6 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -48,8 +48,7 @@ public class SectionLabel extends SectionObject
public static SectionObject create(XFixedText _aFixedText)
{
- final SectionLabel a = new SectionLabel(_aFixedText);
- return a;
+ return new SectionLabel(_aFixedText);
}
/**
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
index 797ac097f915..58a9cc94b746 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -65,14 +65,12 @@ abstract public class SectionObject
public int getHeight(int _nDefault)
{
- final int nHeight = getPropertySetHelper().getPropertyValueAsInteger(PropertyNames.PROPERTY_HEIGHT, _nDefault);
- return nHeight;
+ return getPropertySetHelper().getPropertyValueAsInteger(PropertyNames.PROPERTY_HEIGHT, _nDefault);
}
public float getCharWeight(float _nDefault)
{
- final float fCharWeight = (float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault);
- return fCharWeight;
+ return(float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault);
}
public void setFontToBold()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
index 2a11fcd56f04..f3e99c1e384d 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
@@ -1,8 +1,8 @@
/*
* ***********************************************************************
- *
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -46,8 +46,7 @@ public class SectionTextField extends SectionObject
public static SectionObject create(XFormattedField _aFormattedField)
{
- SectionTextField a = new SectionTextField(_aFormattedField);
- return a;
+ return new SectionTextField(_aFormattedField);
}
public FontDescriptor getFontDescriptor()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
index 0fe168b28263..e01d1d3389c4 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
@@ -2,7 +2,7 @@
************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -55,8 +55,7 @@ public class Tabular extends ReportBuilderLayouter
public String getLocalizedName()
{
- String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 80);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 80);
}
protected void insertDetailFields()
@@ -92,60 +91,59 @@ public class Tabular extends ReportBuilderLayouter
xSection.setHeight(nHeight);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
final String[] aFieldTitleNames = getFieldTitleNames();
- if (aFieldTitleNames == null)
+ if (aFieldTitleNames == null || aFieldTitleNames.length == 0)
{
return;
}
- if (aFieldTitleNames.length == 0)
- {
- return;
- }
- final int nGroups = getReportDefinition().getGroups().getCount();
try
{
- XSection xSection = null;
SectionObject aSO = null;
- if (nGroups == 0)
+ final XGroups xGroups = getReportDefinition().getGroups();
+ final XGroup xGroup;
+ if (lastGroupPostion == -1)
{
// Spezial case, there is no Group.
- final XGroups xGroups = getReportDefinition().getGroups();
- final XGroup xGroup = xGroups.createGroup();
+ xGroup = xGroups.createGroup();
xGroup.setHeaderOn(true);
xGroups.insertByIndex(xGroups.getCount(), xGroup);
- xSection = xGroup.getHeader();
copyGroupProperties(0);
aSO = getDesignTemplate().getDetailLabel();
aSO.setFontToBold();
}
else
{
- final XGroups xGroups = getReportDefinition().getGroups();
// we insert the titles in the last group
- final Object aGroup = xGroups.getByIndex(nGroups - 1);
- final XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
- xSection = xGroup.getHeader();
+ xGroup = UnoRuntime.queryInterface(XGroup.class, xGroups.getByIndex(lastGroupPostion));
// We don't need to copy the GroupProperties, because this is done in the insertGroup() member function
// copyGroupProperties(0);
- aSO = getDesignTemplate().getGroupLabel(nGroups - 1);
+ aSO = getDesignTemplate().getGroupLabel(lastGroupPostion);
}
+ XSection xSection = xGroup.getHeader();
Rectangle aRect = new Rectangle();
-// TODO: getCountOfGroups() == nGroups???
aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
- // TODO: group line is fix
- aRect.Y = aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight; // group height + a little empty line
+ if (lastGroupPostion == -1)
+ {
+ xSection.setHeight(0); // group height + a little empty line)
+ aRect.Y = 0;
+ }
+ else
+ {
+ aRect.Y = xSection.getHeight() + LayoutConstants.LineHeight;
+ }
+
final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldTitleNames.length);
for (int i = 0; i < aFieldTitleNames.length; i++)
{
aRect = insertLabel(xSection, aFieldTitleNames[i], aRect, nWidth, aSO);
}
- xSection.setHeight(aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight + aSO.getHeight(LayoutConstants.LabelHeight));
+ xSection.setHeight(xSection.getHeight() + aSO.getHeight(LayoutConstants.LabelHeight));
}
catch (com.sun.star.uno.Exception e)
{