1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WW8FFData.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #include "WW8FFData.hxx"
35 #include <tools/stream.hxx>
37 #include "writerwordglue.hxx"
43 using sw::types::msword_cast
;
45 WW8FFData::WW8FFData()
62 WW8FFData::~WW8FFData()
66 void WW8FFData::setHelp(const ::rtl::OUString
& rHelp
)
72 void WW8FFData::setStatus(const ::rtl::OUString
& rStatus
)
78 void WW8FFData::addListboxEntry(const ::rtl::OUString
& rEntry
)
81 msListEntries
.push_back(rEntry
);
84 void WW8FFData::WriteOUString(SvStream
* pDataStrm
, const ::rtl::OUString
& rStr
,
87 sal_uInt16 nStrLen
= msword_cast
<sal_uInt16
>(rStr
.getLength());
88 *pDataStrm
<< nStrLen
;
89 SwWW8Writer::WriteString16(*pDataStrm
, rStr
, bAddZero
);
92 void WW8FFData::Write(SvStream
* pDataStrm
)
94 ULONG nDataStt
= pDataStrm
->Tell();
96 static const sal_uInt8 aHeader
[] =
98 0,0,0,0, // len of struct
99 0x44,0, // the start of "next" data
100 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // PIC
101 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
102 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
103 0,0,0,0,0,0,0,0,0,0,0,0,0,0
106 pDataStrm
->Write( aHeader
, sizeof(aHeader
) );
108 sal_uInt8 aData
[10] = {
109 0xff, 0xff, 0xff, 0xff,
110 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
113 aData
[4] = mnType
| (mnResult
<< 2);
116 aData
[4] |= (1 << 7);
118 aData
[5] = (mnTextType
<< 3);
124 aData
[5] |= (1 << 1);
127 aData
[5] |= (1 << 2);
130 aData
[5] |= (1 << 6);
133 aData
[5] |= (1 << 7);
135 aData
[6] = ::sal::static_int_cast
<sal_uInt8
>(mnMaxLen
& 0xffff);
136 aData
[7] = ::sal::static_int_cast
<sal_uInt8
>(mnMaxLen
>> 8);
137 aData
[8] = ::sal::static_int_cast
<sal_uInt8
>(mnCheckboxHeight
& 0xffff);
138 aData
[9] = ::sal::static_int_cast
<sal_uInt8
>(mnCheckboxHeight
>> 8);
140 pDataStrm
->Write(aData
, sizeof(aData
));
142 WriteOUString(pDataStrm
, msName
, true);
145 WriteOUString(pDataStrm
, msDefault
, true);
147 *pDataStrm
<< mnDefault
;
149 WriteOUString(pDataStrm
, msFormat
, true);
150 WriteOUString(pDataStrm
, msHelp
, true);
151 WriteOUString(pDataStrm
, msStatus
, true);
152 WriteOUString(pDataStrm
, msMacroEnter
, true);
153 WriteOUString(pDataStrm
, msMacroExit
, true);
157 sal_uInt8 aData1
[2] = { 0xff, 0xff };
158 pDataStrm
->Write(aData1
, sizeof(aData1
));
160 sal_uInt32 nListboxEntries
= msListEntries
.size();
161 *pDataStrm
<< nListboxEntries
;
163 ::std::vector
< ::rtl::OUString
>::const_iterator aIt
= msListEntries
.begin();
165 while (aIt
!= msListEntries
.end())
167 const ::rtl::OUString
& rEntry
= *aIt
;
168 WriteOUString(pDataStrm
, rEntry
, false);
174 SwWW8Writer::WriteLong( *pDataStrm
, nDataStt
,
175 pDataStrm
->Tell() - nDataStt
);