1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 package com.sun.star.wizards.reportbuilder.layout; 24 25 import com.sun.star.awt.Rectangle; 26 import com.sun.star.report.XGroup; 27 import com.sun.star.report.XSection; 28 import com.sun.star.wizards.common.Resource; 29 import com.sun.star.wizards.report.IReportDefinitionReadAccess; 30 import com.sun.star.wizards.ui.UIConsts; 31 32 /** 33 * 34 * @author ll93751 35 */ 36 public class ColumnarSingleColumn extends ReportBuilderLayouter 37 { 38 ColumnarSingleColumn(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)39 public ColumnarSingleColumn(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource) 40 { 41 super(_xDefinitionAccess, _aResource); 42 } 43 getName()44 public String getName() 45 { 46 return "ColumnarSingleColumnLayoutOfData"; 47 } 48 getLocalizedName()49 public String getLocalizedName() 50 { 51 return getResource().getResText(UIConsts.RID_REPORT + 81); 52 } 53 insertDetailFields()54 protected void insertDetailFields() 55 { 56 copyDetailProperties(); 57 58 final String[] aFieldTitleNames = getFieldTitleNames(); 59 if (aFieldTitleNames == null) 60 { 61 return; 62 } 63 final String[] aFieldNames = getFieldNames(); 64 if (aFieldNames == null) 65 { 66 return; 67 } 68 // int nGroups = getReportDefinition().getGroups().getCount(); 69 70 final XSection xSection = getReportDefinition().getDetail(); 71 72 Rectangle aRect = new Rectangle(); 73 74 final int nLabelWidth = getMaxLabelWidth(); 75 final SectionObject aSOLabel = getDesignTemplate().getDetailLabel(); 76 aSOLabel.setFontToBold(); 77 final SectionObject aSOTextField = getDesignTemplate().getDetailTextField(); 78 79 final int nWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups()) - nLabelWidth; 80 81 for (int i = 0; i < aFieldNames.length; i++) 82 { 83 aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); 84 final String sLabel = aFieldTitleNames[i]; 85 aRect = insertLabel(xSection, sLabel, aRect, nLabelWidth, aSOLabel); 86 final String sFieldName = convertToFieldName(aFieldNames[i]); 87 aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSOTextField); 88 int nHeight = aRect.Height; 89 aRect.Y += Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight), nHeight); 90 } 91 aRect.Y += aSOLabel.getHeight(LayoutConstants.EmptyLineHeight); // one empty line 92 xSection.setHeight(aRect.Y); 93 doNotBreakInTable(xSection); 94 } 95 insertDetailFieldTitles(int lastGroupPostion)96 protected void insertDetailFieldTitles(int lastGroupPostion) 97 { 98 // we won't extra field titles 99 } 100 } 101