Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <doctok/resources.hxx>
21 : #include <WW8ResourceModelImpl.hxx>
22 :
23 : namespace writerfilter {
24 : namespace doctok {
25 :
26 0 : void WW8ListTable::initPayload()
27 : {
28 0 : sal_uInt32 nCount = getEntryCount();
29 :
30 0 : sal_uInt32 nOffset = 2;
31 0 : sal_uInt32 nOffsetLevel = mnPlcfPayloadOffset;
32 0 : for (sal_uInt32 n = 0; n < nCount; ++n)
33 : {
34 0 : WW8List aList(this, nOffset);
35 :
36 0 : entryOffsets.push_back(nOffset);
37 0 : payloadIndices.push_back(payloadOffsets.size());
38 0 : nOffset += WW8List::getSize();
39 :
40 0 : sal_uInt32 nLvlCount = aList.get_fSimpleList() ? 1 : 9;
41 :
42 0 : for (sal_uInt32 i = 0; i < nLvlCount; ++i)
43 : {
44 0 : WW8ListLevel aLevel(this, nOffsetLevel);
45 :
46 0 : payloadOffsets.push_back(nOffsetLevel);
47 :
48 0 : nOffsetLevel += aLevel.calcSize();
49 0 : }
50 :
51 0 : if (nOffsetLevel > getCount())
52 : {
53 0 : nOffsetLevel = getCount();
54 :
55 : break;
56 : }
57 0 : }
58 :
59 0 : payloadOffsets.push_back(nOffsetLevel);
60 0 : entryOffsets.push_back(nOffset);
61 0 : }
62 :
63 0 : sal_uInt32 WW8ListTable::getEntryCount()
64 : {
65 0 : return getU16(0);
66 : }
67 :
68 : writerfilter::Reference<Properties>::Pointer_t
69 0 : WW8ListTable::getEntry(sal_uInt32 nIndex)
70 : {
71 0 : WW8List * pList = new WW8List(this, entryOffsets[nIndex]);
72 :
73 0 : pList->setIndex(nIndex);
74 :
75 : return writerfilter::Reference<Properties>::Pointer_t
76 0 : (pList);
77 : }
78 :
79 0 : sal_uInt32 WW8List::get_listlevel_count()
80 : {
81 0 : if (get_fSimpleList())
82 0 : return 1;
83 :
84 0 : return 9;
85 : }
86 :
87 : writerfilter::Reference<Properties>::Pointer_t
88 0 : WW8List::get_listlevel(sal_uInt32 nIndex)
89 : {
90 0 : WW8ListTable * pListTable = dynamic_cast<WW8ListTable *>(mpParent);
91 0 : sal_uInt32 nPayloadIndex = pListTable->getPayloadIndex(mnIndex) + nIndex;
92 0 : sal_uInt32 nPayloadOffset = pListTable->getPayloadOffset(nPayloadIndex);
93 0 : sal_uInt32 nPayloadSize = pListTable->getPayloadSize(nPayloadIndex);
94 :
95 : return writerfilter::Reference<Properties>::Pointer_t
96 0 : (new WW8ListLevel(mpParent, nPayloadOffset, nPayloadSize));
97 : }
98 :
99 0 : OUString WW8ListLevel::get_xst()
100 : {
101 0 : sal_uInt32 nOffset = WW8ListLevel::getSize();
102 :
103 0 : nOffset += get_cbGrpprlPapx();
104 0 : nOffset += get_cbGrpprlChpx();
105 :
106 0 : return getString(nOffset);
107 : }
108 :
109 0 : void WW8ListLevel::resolveNoAuto(Properties & rHandler)
110 : {
111 0 : sal_uInt32 nOffset = getSize();
112 :
113 : {
114 : WW8PropertySet::Pointer_t pSet
115 0 : (new WW8PropertySetImpl(*this, nOffset, get_cbGrpprlPapx()));
116 :
117 0 : WW8PropertiesReference aRef(pSet);
118 0 : aRef.resolve(rHandler);
119 : }
120 :
121 0 : nOffset += get_cbGrpprlPapx();
122 :
123 : {
124 : WW8PropertySet::Pointer_t pSet
125 0 : (new WW8PropertySetImpl(*this, nOffset, get_cbGrpprlChpx()));
126 :
127 0 : WW8PropertiesReference aRef(pSet);
128 0 : aRef.resolve(rHandler);
129 : }
130 0 : }
131 :
132 0 : sal_uInt32 WW8ListLevel::calcSize()
133 : {
134 0 : sal_uInt32 nResult = WW8ListLevel::getSize();
135 :
136 0 : nResult += get_cbGrpprlPapx();
137 0 : nResult += get_cbGrpprlChpx();
138 0 : nResult += 2 + getU16(nResult) * 2;
139 :
140 0 : return nResult;
141 : }
142 15 : }}
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|