xref: /AOO41X/main/writerfilter/documentation/AddingTable.cxx (revision b4a4f18ca4dc88f864a44914739541fc69bd3f91)
1*b4a4f18cSAndrew Rist /**************************************************************
2*b4a4f18cSAndrew Rist  *
3*b4a4f18cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b4a4f18cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b4a4f18cSAndrew Rist  * distributed with this work for additional information
6*b4a4f18cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b4a4f18cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b4a4f18cSAndrew Rist  * "License"); you may not use this file except in compliance
9*b4a4f18cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b4a4f18cSAndrew Rist  *
11*b4a4f18cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b4a4f18cSAndrew Rist  *
13*b4a4f18cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b4a4f18cSAndrew Rist  * software distributed under the License is distributed on an
15*b4a4f18cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b4a4f18cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*b4a4f18cSAndrew Rist  * specific language governing permissions and limitations
18*b4a4f18cSAndrew Rist  * under the License.
19*b4a4f18cSAndrew Rist  *
20*b4a4f18cSAndrew Rist  *************************************************************/
21*b4a4f18cSAndrew Rist 
test()22cdf0e10cSrcweir void test()
23cdf0e10cSrcweir {
24cdf0e10cSrcweir     portion = appendPortion("text");
25cdf0e10cSrcweir     tableContext = new TableContext();
26cdf0e10cSrcweir     {
27cdf0e10cSrcweir         tableStack.push(tableContext);
28cdf0e10cSrcweir         portion = appendPortion("A1");
29cdf0e10cSrcweir         tableContext.addPortion(portion);
30cdf0e10cSrcweir         tableContext.endCell();
31cdf0e10cSrcweir         portion = appendPortion("B1");
32cdf0e10cSrcweir         tableContext.addPortion(portion);
33cdf0e10cSrcweir         tableContext.endCell();
34cdf0e10cSrcweir         portion = appendPortion("C1");
35cdf0e10cSrcweir         tableContext.addPortion(portion);
36cdf0e10cSrcweir         tableContext.endCell();
37cdf0e10cSrcweir         tableContext.endRow(rowProperties);
38cdf0e10cSrcweir         portion = appendPortion("A2");
39cdf0e10cSrcweir         tableContext.addPortion(portion);
40cdf0e10cSrcweir         tableContext.endCell();
41cdf0e10cSrcweir         tableContext = new TableContext();
42cdf0e10cSrcweir         {
43cdf0e10cSrcweir             tableStack.push(tableContext);
44cdf0e10cSrcweir             portion = appendPortion("B2A1");
45cdf0e10cSrcweir             tableContext.addPortion(portion);
46cdf0e10cSrcweir             tableContext.endCell();
47cdf0e10cSrcweir             portion = appendPortion("B2B1");
48cdf0e10cSrcweir             tableContext.addPortion(portion);
49cdf0e10cSrcweir             tableContext.endCell();
50cdf0e10cSrcweir             tableContext.endRow(rowProperties);
51cdf0e10cSrcweir             portion = appendPortion("B2A2");
52cdf0e10cSrcweir             tableContext.addPortion(portion);
53cdf0e10cSrcweir             tableContext.endCell();
54cdf0e10cSrcweir             portion = appendPortion("B2B2");
55cdf0e10cSrcweir             tableContext.addPortion(portion);
56cdf0e10cSrcweir             tableContext.endCell();
57cdf0e10cSrcweir             tableContext.endRow(rowProperties);
58cdf0e10cSrcweir         }
59cdf0e10cSrcweir         portion = createTable(tableContext);
60cdf0e10cSrcweir         tableContext = tableStack.pop();
61cdf0e10cSrcweir         tableContext.addPortion(portion);
62cdf0e10cSrcweir         portion = appendPortion("B2");
63cdf0e10cSrcweir         tableContext.addPortion(portion);
64cdf0e10cSrcweir         tableContext.endCell();
65cdf0e10cSrcweir         portion = appendPortion("C2");
66cdf0e10cSrcweir         tableContext.addPortion(portion);
67cdf0e10cSrcweir         tableContext.endCell();
68cdf0e10cSrcweir         tableContext.endRow(rowProperties);
69cdf0e10cSrcweir     }
70cdf0e10cSrcweir     portion = createTable(tableContext);
71cdf0e10cSrcweir     portion = appendPortion("text");
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir /*
75cdf0e10cSrcweir   tableContext.endCell:
76cdf0e10cSrcweir     merge text ranges of portions to one and add this range to ranges of row.
77cdf0e10cSrcweir  */
78