blob: d7d4e10f097c0d6d555fd6b141c27fada4caf162 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package org.libreoffice.report.pentaho.layoutprocessor;
import org.libreoffice.report.pentaho.model.FixedTextElement;
import org.jfree.report.DataSourceException;
import org.jfree.report.ReportDataFactoryException;
import org.jfree.report.ReportProcessingException;
import org.jfree.report.data.GlobalMasterRow;
import org.jfree.report.data.ReportDataRow;
import org.jfree.report.flow.FlowController;
import org.jfree.report.flow.ReportContext;
import org.jfree.report.flow.ReportTarget;
import org.jfree.report.flow.layoutprocessor.LayoutController;
import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory;
import org.jfree.report.structure.Section;
/**
* Processes a fixed-text element of the OpenOffice reporting specificiation.
* The element itself contains a single paragraph which contains the content.
* After checking, whether this element should be printed, this layout
* controller simply delegates the dirty work to a suitable handler.
*
* @noinspection CloneableClassWithoutClone
* @since 05.03.2007
*/
public class FixedTextLayoutController
extends AbstractReportElementLayoutController
{
public FixedTextLayoutController()
{
}
@Override
public boolean isValueChanged()
{
final FlowController controller = getFlowController();
final GlobalMasterRow masterRow = controller.getMasterRow();
final ReportDataRow reportDataRow = masterRow.getReportDataRow();
return reportDataRow.getCursor() == 0;
}
@Override
protected LayoutController delegateContentGeneration(final ReportTarget target)
throws ReportProcessingException, ReportDataFactoryException,
DataSourceException
{
final FixedTextElement fte = (FixedTextElement) getNode();
final Section content = fte.getContent();
final FlowController flowController = getFlowController();
final ReportContext reportContext = flowController.getReportContext();
final LayoutControllerFactory layoutControllerFactory =
reportContext.getLayoutControllerFactory();
final FixedTextLayoutController flc = (FixedTextLayoutController) clone();
flc.setState(AbstractReportElementLayoutController.FINISHED);
return layoutControllerFactory.create(flowController, content, flc);
}
}
|