. * */ namespace OCA\user_ldap\lib; interface ILDAPWrapper { //LDAP functions in use /** * Bind to LDAP directory * @param resource $link LDAP link resource * @param string $dn an RDN to log in with * @param string $password the password * @return bool true on success, false otherwise * * with $dn and $password as null a anonymous bind is attempted. */ public function bind($link, $dn, $password); /** * connect to an LDAP server * @param string $host The host to connect to * @param string $port The port to connect to * @return mixed a link resource on success, otherwise false */ public function connect($host, $port); /** * Send LDAP pagination control * @param resource $link LDAP link resource * @param int $pageSize number of results per page * @param bool $isCritical Indicates whether the pagination is critical of not. * @param array $cookie structure sent by LDAP server * @return bool true on success, false otherwise */ public function controlPagedResult($link, $pageSize, $isCritical, $cookie); /** * Retrieve the LDAP pagination cookie * @param resource $link LDAP link resource * @param resource $result LDAP result resource * @param string $cookie structure sent by LDAP server * @return bool true on success, false otherwise * * Corresponds to ldap_control_paged_result_response */ public function controlPagedResultResponse($link, $result, &$cookie); /** * Count the number of entries in a search * @param resource $link LDAP link resource * @param resource $result LDAP result resource * @return int|false number of results on success, false otherwise */ public function countEntries($link, $result); /** * Return the LDAP error number of the last LDAP command * @param resource $link LDAP link resource * @return string error message as string */ public function errno($link); /** * Return the LDAP error message of the last LDAP command * @param resource $link LDAP link resource * @return int error code as integer */ public function error($link); /** * Return first result id * @param resource $link LDAP link resource * @param resource $result LDAP result resource * @return Resource an LDAP search result resource * */ public function firstEntry($link, $result); /** * Get attributes from a search result entry * @param resource $link LDAP link resource * @param resource $result LDAP result resource * @return array containing the results, false on error * */ public function getAttributes($link, $result); /** * Get the DN of a result entry * @param resource $link LDAP link resource * @param resource $result LDAP result resource * @return string containing the DN, false on error */ public function getDN($link, $result); /** * Get all result entries * @param resource $link LDAP link resource * @param resource $result LDAP result resource * @return array containing the results, false on error */ public function getEntries($link, $result); /** * Return next result id * @param resource $link LDAP link resource * @param resource $result LDAP entry result resource * @return resource an LDAP search result resource * */ public function nextEntry($link, $result); /** * Read an entry * @param resource $link LDAP link resource * @param array $baseDN The DN of the entry to read from * @param string $filter An LDAP filter * @param array $attr array of the attributes to read * @return resource an LDAP search result resource */ public function read($link, $baseDN, $filter, $attr); /** * Search LDAP tree * @param resource $link LDAP link resource * @param string $baseDN The DN of the entry to read from * @param string $filter An LDAP filter * @param array $attr array of the attributes to read * @param int $attrsOnly optional, 1 if only attribute types shall be returned * @param int $limit optional, limits the result entries * @return resource|false an LDAP search result resource, false on error */ public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0); /** * Sets the value of the specified option to be $value * @param resource $link LDAP link resource * @param string $option a defined LDAP Server option * @param int $value the new value for the option * @return bool true on success, false otherwise */ public function setOption($link, $option, $value); /** * establish Start TLS * @param resource $link LDAP link resource * @return bool true on success, false otherwise */ public function startTls($link); /** * Sort the result of a LDAP search * @param resource $link LDAP link resource * @param resource $result LDAP result resource * @param string $sortFilter attribute to use a key in sort */ public function sort($link, $result, $sortFilter); /** * Unbind from LDAP directory * @param resource $link LDAP link resource * @return bool true on success, false otherwise */ public function unbind($link); //additional required methods in ownCloud /** * Checks whether the server supports LDAP * @return bool true if it the case, false otherwise * */ public function areLDAPFunctionsAvailable(); /** * Checks whether PHP supports LDAP Paged Results * @return bool true if it the case, false otherwise * */ public function hasPagedResultSupport(); /** * Checks whether the submitted parameter is a resource * @param resource $resource the resource variable to check * @return bool true if it is a resource, false otherwise */ public function isResource($resource); } java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java?h=Temp_PDF_in_PDF'>stats
path: root/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java
blob: 1a958530f71d762f8303ad5ddfc45a7e0808a5c3 (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
/*
 * Copyright 1999-2004 The Apache Software Foundation.
 * 
 * Licensed 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
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* $Id$ */


/*
 * This file is part of the RTF library of the FOP project, which was originally
 * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
 * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
 * the FOP project.
 */

package org.apache.fop.render.rtf.rtflib.testdocs;

import java.io.IOException;

import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyleNumber;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;

/**  Generates a simple RTF test document for the jfor rtflib package.
 *  @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
 */

class SimpleLists extends TestDocument {
    /** generate the body of the test document */
    protected void generateDocument(RtfDocumentArea rda, RtfSection sect)
    throws IOException {
        sect.newParagraph().newText("First paragraph of the 'SimpleLists' RTF test document.");
        sect.newParagraph().newText("First bulleted list with 5 items.");
        makeList(sect, 1, 5, null);
        sect.newParagraph().newText("Normal paragraph between lists 1 and 2.");
        makeList(sect, 2, 3, null);
        sect.newParagraph().newText("Normal paragraph after list 2.");

        sect.newParagraph().newText("Now a numbered list (4 items):");
        makeList(sect, 3, 4, new RtfListStyleNumber());
    }

    private void makeList(RtfSection sect, int listIndex, int nItems, RtfListStyle ls)
    throws IOException {
        final RtfList list = sect.newList(null);
        if (ls != null) {
            list.setRtfListStyle(ls);
        }
        for (int i = 0; i < nItems; i++) {
            final RtfListItem item = list.newListItem();
            for (int j = 0; j <= i; j++) {
                final RtfParagraph para = item.newParagraph();
                para.newText("List " + listIndex + ", item " + i + ", paragraph " + j);
                if (i == 0 && j == 0) {
                    final String txt = "This item takes more than one line to check word-wrapping.";
                    para.newText(". " + "This list should have " + nItems
                            + " items. " + txt + " " + txt + " " + txt);
                }
            }
        }
    }
}