Updated core
[LibreOffice.git] / writerfilter / source / doctok / WW8FontTable.cxx
blob2ecfe15a30f1d08c278a1e75283c7784f2ee6b75
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <doctok/resources.hxx>
22 namespace writerfilter {
23 namespace doctok {
25 void WW8FontTable::initPayload()
27 sal_uInt32 nCount = getU8(0);
29 sal_uInt32 nOffset = 1;
31 while (nCount > 0)
33 entryOffsets.push_back(nOffset);
35 sal_uInt32 nFFNSize = getU8(nOffset) + 1;
37 if (nFFNSize > 1)
38 nCount--;
40 nOffset += nFFNSize;
43 entryOffsets.push_back(nOffset);
44 mnPlcfPayloadOffset = nOffset;
47 sal_uInt32 WW8FontTable::getEntryCount()
49 return entryOffsets.size() - 1;
52 writerfilter::Reference<Properties>::Pointer_t
53 WW8FontTable::getEntry(sal_uInt32 nIndex)
55 writerfilter::Reference<Properties>::Pointer_t pResult;
57 sal_uInt32 nCount = entryOffsets[nIndex + 1] - entryOffsets[nIndex];
59 if (nCount > 1)
61 WW8Font * pFont = new WW8Font(this,
62 entryOffsets[nIndex], nCount);
64 pFont->setIndex(nIndex);
66 pResult = writerfilter::Reference<Properties>::Pointer_t(pFont);
69 return pResult;
72 sal_uInt32 WW8Font::get_f()
74 return mnIndex;
77 OUString WW8Font::get_xszFfn()
79 sal_uInt32 nOffset = 0x28;
80 sal_uInt32 nCount = get_cbFfnM1() - nOffset;
82 Sequence aSeq(mSequence, nOffset, nCount);
84 rtl_uString * pNew = 0;
85 rtl_uString_newFromStr
86 (&pNew, reinterpret_cast<const sal_Unicode *>(&aSeq[0]));
88 return OUString(pNew);
91 OUString WW8Font::get_altName()
93 sal_uInt32 nOffset = 0x28 + get_ixchSzAlt();
94 sal_uInt32 nCount = get_cbFfnM1() - nOffset;
96 Sequence aSeq(mSequence, nOffset, nCount);
98 rtl_uString * pNew = 0;
99 rtl_uString_newFromStr
100 (&pNew, reinterpret_cast<const sal_Unicode *>(&aSeq[0]));
102 return OUString(pNew);
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */