1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "WW8FFData.hxx"
21 #include <tools/stream.hxx>
22 #include "writerwordglue.hxx"
28 using sw::types::msword_cast
;
30 WW8FFData::WW8FFData()
47 WW8FFData::~WW8FFData()
51 void WW8FFData::setHelp(const OUString
& rHelp
)
57 void WW8FFData::setStatus(const OUString
& rStatus
)
63 void WW8FFData::addListboxEntry(const OUString
& rEntry
)
66 msListEntries
.push_back(rEntry
);
69 void WW8FFData::WriteOUString(SvStream
* pDataStrm
, const OUString
& rStr
,
72 sal_uInt16 nStrLen
= msword_cast
<sal_uInt16
>(rStr
.getLength());
73 pDataStrm
->WriteUInt16( nStrLen
);
74 SwWW8Writer::WriteString16(*pDataStrm
, rStr
, bAddZero
);
77 void WW8FFData::Write(SvStream
* pDataStrm
)
79 sal_uInt64 nDataStt
= pDataStrm
->Tell();
81 static const sal_uInt8 aHeader
[] =
83 0,0,0,0, // len of struct
84 0x44,0, // the start of "next" data
85 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // PIC
86 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
87 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
88 0,0,0,0,0,0,0,0,0,0,0,0,0,0
91 pDataStrm
->WriteBytes(aHeader
, sizeof(aHeader
));
93 sal_uInt8 aData
[10] = {
94 0xff, 0xff, 0xff, 0xff,
95 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
98 aData
[4] = mnType
| (mnResult
<< 2);
101 aData
[4] |= (1 << 7);
103 aData
[5] = (mnTextType
<< 3);
109 aData
[5] |= (1 << 1);
112 aData
[5] |= (1 << 2);
115 aData
[5] |= (1 << 6);
118 aData
[5] |= (1 << 7);
120 aData
[6] = ::sal::static_int_cast
<sal_uInt8
>(mnMaxLen
& 0xffff);
121 aData
[7] = ::sal::static_int_cast
<sal_uInt8
>(mnMaxLen
>> 8);
122 aData
[8] = ::sal::static_int_cast
<sal_uInt8
>(mnCheckboxHeight
& 0xffff);
123 aData
[9] = ::sal::static_int_cast
<sal_uInt8
>(mnCheckboxHeight
>> 8);
125 pDataStrm
->WriteBytes(aData
, sizeof(aData
));
127 WriteOUString(pDataStrm
, msName
, true);
130 WriteOUString(pDataStrm
, msDefault
, true);
132 pDataStrm
->WriteUInt16( mnDefault
);
134 WriteOUString(pDataStrm
, msFormat
, true);
135 WriteOUString(pDataStrm
, msHelp
, true);
136 WriteOUString(pDataStrm
, msStatus
, true);
137 WriteOUString(pDataStrm
, msMacroEnter
, true);
138 WriteOUString(pDataStrm
, msMacroExit
, true);
142 sal_uInt8 aData1
[2] = { 0xff, 0xff };
143 pDataStrm
->WriteBytes(aData1
, sizeof(aData1
));
145 sal_uInt32 nListboxEntries
= msListEntries
.size();
146 pDataStrm
->WriteUInt32( nListboxEntries
);
148 for (const OUString
& rEntry
: msListEntries
)
149 WriteOUString(pDataStrm
, rEntry
, false);
152 SwWW8Writer::WriteLong( *pDataStrm
, nDataStt
,
153 pDataStrm
->Tell() - nDataStt
);
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */