Branch data 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 WW8FontTable::initPayload()
26 : : {
27 [ # # ]: 0 : sal_uInt32 nCount = getU8(0);
28 : :
29 : 0 : sal_uInt32 nOffset = 1;
30 : :
31 [ # # ]: 0 : while (nCount > 0)
32 : : {
33 [ # # ]: 0 : entryOffsets.push_back(nOffset);
34 : :
35 [ # # ]: 0 : sal_uInt32 nFFNSize = getU8(nOffset) + 1;
36 : :
37 [ # # ]: 0 : if (nFFNSize > 1)
38 : 0 : nCount--;
39 : :
40 : 0 : nOffset += nFFNSize;
41 : : }
42 : :
43 [ # # ]: 0 : entryOffsets.push_back(nOffset);
44 : 0 : mnPlcfPayloadOffset = nOffset;
45 : 0 : }
46 : :
47 : 0 : sal_uInt32 WW8FontTable::getEntryCount()
48 : : {
49 : 0 : return entryOffsets.size() - 1;
50 : : }
51 : :
52 : : writerfilter::Reference<Properties>::Pointer_t
53 : 0 : WW8FontTable::getEntry(sal_uInt32 nIndex)
54 : : {
55 : 0 : writerfilter::Reference<Properties>::Pointer_t pResult;
56 : :
57 [ # # ][ # # ]: 0 : sal_uInt32 nCount = entryOffsets[nIndex + 1] - entryOffsets[nIndex];
58 : :
59 [ # # ]: 0 : if (nCount > 1)
60 : : {
61 : : WW8Font * pFont = new WW8Font(this,
62 [ # # ][ # # ]: 0 : entryOffsets[nIndex], nCount);
[ # # ]
63 : :
64 : 0 : pFont->setIndex(nIndex);
65 : :
66 [ # # ][ # # ]: 0 : pResult = writerfilter::Reference<Properties>::Pointer_t(pFont);
[ # # ]
67 : : }
68 : :
69 : 0 : return pResult;
70 : : }
71 : :
72 : 0 : sal_uInt32 WW8Font::get_f()
73 : : {
74 : 0 : return mnIndex;
75 : : }
76 : :
77 : 0 : OUString WW8Font::get_xszFfn()
78 : : {
79 : 0 : sal_uInt32 nOffset = 0x28;
80 [ # # ]: 0 : sal_uInt32 nCount = get_cbFfnM1() - nOffset;
81 : :
82 [ # # ]: 0 : Sequence aSeq(mSequence, nOffset, nCount);
83 : :
84 : 0 : rtl_uString * pNew = 0;
85 : : rtl_uString_newFromStr
86 [ # # ]: 0 : (&pNew, reinterpret_cast<const sal_Unicode *>(&aSeq[0]));
87 : :
88 [ # # ]: 0 : return OUString(pNew);
89 : : }
90 : :
91 : 0 : OUString WW8Font::get_altName()
92 : : {
93 [ # # ]: 0 : sal_uInt32 nOffset = 0x28 + get_ixchSzAlt();
94 [ # # ]: 0 : sal_uInt32 nCount = get_cbFfnM1() - nOffset;
95 : :
96 [ # # ]: 0 : Sequence aSeq(mSequence, nOffset, nCount);
97 : :
98 : 0 : rtl_uString * pNew = 0;
99 : : rtl_uString_newFromStr
100 [ # # ]: 0 : (&pNew, reinterpret_cast<const sal_Unicode *>(&aSeq[0]));
101 : :
102 [ # # ]: 0 : return OUString(pNew);
103 : : }
104 : :
105 [ + - ][ + - ]: 60 : }}
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|