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.reportbuilder.layout; 24cdf0e10cSrcweir 25cdf0e10cSrcweir import com.sun.star.awt.Rectangle; 26cdf0e10cSrcweir import com.sun.star.report.XGroup; 27cdf0e10cSrcweir import com.sun.star.report.XSection; 28cdf0e10cSrcweir import com.sun.star.wizards.common.Resource; 29cdf0e10cSrcweir import com.sun.star.wizards.report.IReportDefinitionReadAccess; 30cdf0e10cSrcweir import com.sun.star.wizards.ui.UIConsts; 31cdf0e10cSrcweir 32cdf0e10cSrcweir /** 33cdf0e10cSrcweir * 34cdf0e10cSrcweir * @author ll93751 35cdf0e10cSrcweir */ 36cdf0e10cSrcweir public class ColumnarSingleColumn extends ReportBuilderLayouter 37cdf0e10cSrcweir { 38cdf0e10cSrcweir ColumnarSingleColumn(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)39cdf0e10cSrcweir public ColumnarSingleColumn(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource) 40cdf0e10cSrcweir { 41cdf0e10cSrcweir super(_xDefinitionAccess, _aResource); 42cdf0e10cSrcweir } 43cdf0e10cSrcweir getName()44cdf0e10cSrcweir public String getName() 45cdf0e10cSrcweir { 46cdf0e10cSrcweir return "ColumnarSingleColumnLayoutOfData"; 47cdf0e10cSrcweir } 48cdf0e10cSrcweir getLocalizedName()49cdf0e10cSrcweir public String getLocalizedName() 50cdf0e10cSrcweir { 51cdf0e10cSrcweir return getResource().getResText(UIConsts.RID_REPORT + 81); 52cdf0e10cSrcweir } 53cdf0e10cSrcweir insertDetailFields()54cdf0e10cSrcweir protected void insertDetailFields() 55cdf0e10cSrcweir { 56cdf0e10cSrcweir copyDetailProperties(); 57cdf0e10cSrcweir 58cdf0e10cSrcweir final String[] aFieldTitleNames = getFieldTitleNames(); 59cdf0e10cSrcweir if (aFieldTitleNames == null) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir return; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir final String[] aFieldNames = getFieldNames(); 64cdf0e10cSrcweir if (aFieldNames == null) 65cdf0e10cSrcweir { 66cdf0e10cSrcweir return; 67cdf0e10cSrcweir } 68cdf0e10cSrcweir // int nGroups = getReportDefinition().getGroups().getCount(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir final XSection xSection = getReportDefinition().getDetail(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir Rectangle aRect = new Rectangle(); 73cdf0e10cSrcweir 74cdf0e10cSrcweir final int nLabelWidth = getMaxLabelWidth(); 75cdf0e10cSrcweir final SectionObject aSOLabel = getDesignTemplate().getDetailLabel(); 76cdf0e10cSrcweir aSOLabel.setFontToBold(); 77cdf0e10cSrcweir final SectionObject aSOTextField = getDesignTemplate().getDetailTextField(); 78cdf0e10cSrcweir 79cdf0e10cSrcweir final int nWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups()) - nLabelWidth; 80cdf0e10cSrcweir 81cdf0e10cSrcweir for (int i = 0; i < aFieldNames.length; i++) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); 84cdf0e10cSrcweir final String sLabel = aFieldTitleNames[i]; 85cdf0e10cSrcweir aRect = insertLabel(xSection, sLabel, aRect, nLabelWidth, aSOLabel); 86cdf0e10cSrcweir final String sFieldName = convertToFieldName(aFieldNames[i]); 87cdf0e10cSrcweir aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSOTextField); 88cdf0e10cSrcweir int nHeight = aRect.Height; 89cdf0e10cSrcweir aRect.Y += Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight), nHeight); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir aRect.Y += aSOLabel.getHeight(LayoutConstants.EmptyLineHeight); // one empty line 92cdf0e10cSrcweir xSection.setHeight(aRect.Y); 93cdf0e10cSrcweir doNotBreakInTable(xSection); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir insertDetailFieldTitles(int lastGroupPostion)96cdf0e10cSrcweir protected void insertDetailFieldTitles(int lastGroupPostion) 97cdf0e10cSrcweir { 98cdf0e10cSrcweir // we won't extra field titles 99cdf0e10cSrcweir } 100cdf0e10cSrcweir } 101