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 .
21 #include "WW8FFData.hxx"
22 #include <tools/stream.hxx>
24 #include "writerwordglue.hxx"
30 using sw::types::msword_cast
;
32 WW8FFData::WW8FFData()
49 WW8FFData::~WW8FFData()
53 void WW8FFData::setHelp(const OUString
& rHelp
)
59 void WW8FFData::setStatus(const OUString
& rStatus
)
65 void WW8FFData::addListboxEntry(const OUString
& rEntry
)
68 msListEntries
.push_back(rEntry
);
71 void WW8FFData::WriteOUString(SvStream
* pDataStrm
, const OUString
& rStr
,
74 sal_uInt16 nStrLen
= msword_cast
<sal_uInt16
>(rStr
.getLength());
75 *pDataStrm
<< nStrLen
;
76 SwWW8Writer::WriteString16(*pDataStrm
, rStr
, bAddZero
);
79 void WW8FFData::Write(SvStream
* pDataStrm
)
81 sal_uLong nDataStt
= pDataStrm
->Tell();
83 static const sal_uInt8 aHeader
[] =
85 0,0,0,0, // len of struct
86 0x44,0, // the start of "next" data
87 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // PIC
88 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
89 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
90 0,0,0,0,0,0,0,0,0,0,0,0,0,0
93 pDataStrm
->Write( aHeader
, sizeof(aHeader
) );
95 sal_uInt8 aData
[10] = {
96 0xff, 0xff, 0xff, 0xff,
97 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
100 aData
[4] = mnType
| (mnResult
<< 2);
103 aData
[4] |= (1 << 7);
105 aData
[5] = (mnTextType
<< 3);
111 aData
[5] |= (1 << 1);
114 aData
[5] |= (1 << 2);
117 aData
[5] |= (1 << 6);
120 aData
[5] |= (1 << 7);
122 aData
[6] = ::sal::static_int_cast
<sal_uInt8
>(mnMaxLen
& 0xffff);
123 aData
[7] = ::sal::static_int_cast
<sal_uInt8
>(mnMaxLen
>> 8);
124 aData
[8] = ::sal::static_int_cast
<sal_uInt8
>(mnCheckboxHeight
& 0xffff);
125 aData
[9] = ::sal::static_int_cast
<sal_uInt8
>(mnCheckboxHeight
>> 8);
127 pDataStrm
->Write(aData
, sizeof(aData
));
129 WriteOUString(pDataStrm
, msName
, true);
132 WriteOUString(pDataStrm
, msDefault
, true);
134 *pDataStrm
<< mnDefault
;
136 WriteOUString(pDataStrm
, msFormat
, true);
137 WriteOUString(pDataStrm
, msHelp
, true);
138 WriteOUString(pDataStrm
, msStatus
, true);
139 WriteOUString(pDataStrm
, msMacroEnter
, true);
140 WriteOUString(pDataStrm
, msMacroExit
, true);
144 sal_uInt8 aData1
[2] = { 0xff, 0xff };
145 pDataStrm
->Write(aData1
, sizeof(aData1
));
147 sal_uInt32 nListboxEntries
= msListEntries
.size();
148 *pDataStrm
<< nListboxEntries
;
150 ::std::vector
< OUString
>::const_iterator aIt
= msListEntries
.begin();
152 while (aIt
!= msListEntries
.end())
154 const OUString
& rEntry
= *aIt
;
155 WriteOUString(pDataStrm
, rEntry
, false);
161 SwWW8Writer::WriteLong( *pDataStrm
, nDataStt
,
162 pDataStrm
->Tell() - nDataStt
);
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */