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 
24 #include "resources.hxx"
25 
26 namespace writerfilter {
27 namespace doctok {
28 
initPayload()29 void WW8LFOTable::initPayload()
30 {
31     sal_uInt32 nCount = getEntryCount();
32 
33     sal_uInt32 nOffset = 4;
34     sal_uInt32 nOffsetLFOData = mnPlcfPayloadOffset;
35 
36     for (sal_uInt32 n = 0; n < nCount; ++n)
37     {
38         WW8LFO aLFO(this, nOffset);
39 
40         entryOffsets.push_back(nOffset);
41         nOffset += WW8LFO::getSize();
42 
43         payloadOffsets.push_back(nOffsetLFOData);
44         payloadIndices.push_back(n);
45 
46         nOffsetLFOData += 4;
47 
48         sal_uInt32 nLvls = aLFO.get_clfolvl();
49 
50         for (sal_uInt32 k = 0; k < nLvls; ++k)
51         {
52             WW8LFOLevel aLevel(this, nOffsetLFOData);
53             nOffsetLFOData += aLevel.calcSize();
54         }
55     }
56 
57     entryOffsets.push_back(nOffset);
58     payloadOffsets.push_back(nOffsetLFOData);
59 }
60 
getEntryCount()61 sal_uInt32 WW8LFOTable::getEntryCount()
62 {
63     return getU32(0);
64 }
65 
66 writerfilter::Reference<Properties>::Pointer_t
getEntry(sal_uInt32 nIndex)67 WW8LFOTable::getEntry(sal_uInt32 nIndex)
68 {
69     WW8LFO * pLFO = new WW8LFO(this, entryOffsets[nIndex]);
70 
71     pLFO->setIndex(nIndex);
72 
73     return writerfilter::Reference<Properties>::Pointer_t(pLFO);
74 }
75 
76 writerfilter::Reference<Properties>::Pointer_t
get_LFOData()77 WW8LFO::get_LFOData()
78 {
79     WW8LFOTable * pLFOTable = dynamic_cast<WW8LFOTable *>(mpParent);
80     sal_uInt32 nPayloadOffset = pLFOTable->getPayloadOffset(mnIndex);
81     sal_uInt32 nPayloadSize = pLFOTable->getPayloadSize(mnIndex);
82 
83     return writerfilter::Reference<Properties>::Pointer_t
84     (new WW8LFOData(mpParent, nPayloadOffset, nPayloadSize));
85 }
86 
87 /*
88 writerfilter::Reference<Properties>::Pointer_t
89 WW8LFO::get_lfolevel(sal_uInt32 nIndex)
90 {
91     WW8LFOTable * pLFOTable = dynamic_cast<WW8LFOTable *>(mpParent);
92     sal_uInt32 nPayloadIndex = pLFOTable->getPayloadIndex(mnIndex) + nIndex;
93     sal_uInt32 nPayloadOffset = pLFOTable->getPayloadOffset(nPayloadIndex);
94     sal_uInt32 nPayloadSize = pLFOTable->getPayloadSize(nPayloadIndex);
95 
96     return writerfilter::Reference<Properties>::Pointer_t
97         (new WW8LFOLevel(mpParent, nPayloadOffset, nPayloadSize));
98 }
99 */
100 
resolveNoAuto(Properties &)101 void WW8LFOLevel::resolveNoAuto(Properties & /*rHandler*/)
102 {
103 
104 }
105 
calcSize()106 sal_uInt32 WW8LFOLevel::calcSize()
107 {
108     sal_uInt32 nResult = WW8LFOLevel::getSize();
109 
110     if (get_fFormatting())
111     {
112         WW8ListLevel aLevel(mpParent, mnOffsetInParent + nResult);
113 
114         nResult += aLevel.calcSize();
115 
116         sal_uInt32 nXstSize = mpParent->getU16(mnOffsetInParent + nResult);
117 
118         nResult += (nXstSize + 1) * 2;
119     }
120 
121     return nResult;
122 }
123 
124 }}
125