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