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