LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/ww8 - WW8FFData.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 66 0.0 %
Date: 2012-12-17 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          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             : 
      21             : #include "WW8FFData.hxx"
      22             : #include <tools/stream.hxx>
      23             : #include <doc.hxx>
      24             : #include "writerwordglue.hxx"
      25             : #include "wrtww8.hxx"
      26             : 
      27             : namespace sw
      28             : {
      29             : 
      30             : using sw::types::msword_cast;
      31             : 
      32           0 : WW8FFData::WW8FFData()
      33             :     :
      34             :     mnType(0),
      35             :     mnResult(0),
      36             :     mbOwnHelp(false),
      37             :     mbOwnStat(false),
      38             :     mbProtected(false),
      39             :     mbSize(false),
      40             :     mnTextType(0),
      41             :     mbRecalc(false),
      42             :     mbListBox(false),
      43             :     mnMaxLen(0),
      44             :     mnCheckboxHeight(0),
      45           0 :     mnDefault(0)
      46             : {
      47           0 : }
      48             : 
      49           0 : WW8FFData::~WW8FFData()
      50             : {
      51           0 : }
      52             : 
      53           0 : void WW8FFData::setHelp(const ::rtl::OUString & rHelp)
      54             : {
      55           0 :     msHelp = rHelp;
      56           0 :     mbOwnHelp = true;
      57           0 : }
      58             : 
      59           0 : void WW8FFData::setStatus(const ::rtl::OUString & rStatus)
      60             : {
      61           0 :     msStatus = rStatus;
      62           0 :     mbOwnStat = true;
      63           0 : }
      64             : 
      65           0 : void WW8FFData::addListboxEntry(const ::rtl::OUString & rEntry)
      66             : {
      67           0 :     mbListBox = true;
      68           0 :     msListEntries.push_back(rEntry);
      69           0 : }
      70             : 
      71           0 : void WW8FFData::WriteOUString(SvStream * pDataStrm, const ::rtl::OUString & rStr,
      72             :     bool bAddZero)
      73             : {
      74           0 :     sal_uInt16 nStrLen = msword_cast<sal_uInt16>(rStr.getLength());
      75           0 :     *pDataStrm << nStrLen;
      76           0 :     SwWW8Writer::WriteString16(*pDataStrm, rStr, bAddZero);
      77           0 : }
      78             : 
      79           0 : void WW8FFData::Write(SvStream * pDataStrm)
      80             : {
      81           0 :     sal_uLong nDataStt = pDataStrm->Tell();
      82             : 
      83             :     static const sal_uInt8 aHeader[] =
      84             :     {
      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
      91             :     };
      92             : 
      93           0 :     pDataStrm->Write( aHeader, sizeof(aHeader) );
      94             : 
      95             :     sal_uInt8 aData[10] = {
      96             :         0xff, 0xff, 0xff, 0xff,
      97             :         0x0, 0x0, 0x0, 0x0, 0x0, 0x0
      98           0 :     };
      99             : 
     100           0 :     aData[4] = mnType | (mnResult << 2);
     101             : 
     102           0 :     if (mbOwnHelp)
     103           0 :         aData[4] |= (1 << 7);
     104             : 
     105           0 :     aData[5] = (mnTextType << 3);
     106             : 
     107           0 :     if (mbOwnStat)
     108           0 :         aData[5] |= 1;
     109             : 
     110           0 :     if (mbProtected)
     111           0 :         aData[5] |= (1 << 1);
     112             : 
     113           0 :     if (mbSize)
     114           0 :         aData[5] |= (1 << 2);
     115             : 
     116           0 :     if (mbRecalc)
     117           0 :         aData[5] |= (1 << 6);
     118             : 
     119           0 :     if (mbListBox)
     120           0 :         aData[5] |= (1 << 7);
     121             : 
     122           0 :     aData[6] = ::sal::static_int_cast<sal_uInt8>(mnMaxLen & 0xffff);
     123           0 :     aData[7] = ::sal::static_int_cast<sal_uInt8>(mnMaxLen >> 8);
     124           0 :     aData[8] = ::sal::static_int_cast<sal_uInt8>(mnCheckboxHeight & 0xffff);
     125           0 :     aData[9] = ::sal::static_int_cast<sal_uInt8>(mnCheckboxHeight >> 8);
     126             : 
     127           0 :     pDataStrm->Write(aData, sizeof(aData));
     128             : 
     129           0 :     WriteOUString(pDataStrm, msName, true);
     130             : 
     131           0 :     if (mnType == 0)
     132           0 :         WriteOUString(pDataStrm, msDefault, true);
     133             :     else
     134           0 :         *pDataStrm << mnDefault;
     135             : 
     136           0 :     WriteOUString(pDataStrm, msFormat, true);
     137           0 :     WriteOUString(pDataStrm, msHelp, true);
     138           0 :     WriteOUString(pDataStrm, msStatus, true);
     139           0 :     WriteOUString(pDataStrm, msMacroEnter, true);
     140           0 :     WriteOUString(pDataStrm, msMacroExit, true);
     141             : 
     142           0 :     if (mnType == 2)
     143             :     {
     144           0 :         sal_uInt8 aData1[2] = { 0xff, 0xff };
     145           0 :         pDataStrm->Write(aData1, sizeof(aData1));
     146             : 
     147           0 :         sal_uInt32 nListboxEntries = msListEntries.size();
     148           0 :         *pDataStrm << nListboxEntries;
     149             : 
     150           0 :         ::std::vector< ::rtl::OUString >::const_iterator aIt = msListEntries.begin();
     151             : 
     152           0 :         while (aIt != msListEntries.end())
     153             :         {
     154           0 :             const ::rtl::OUString & rEntry = *aIt;
     155           0 :             WriteOUString(pDataStrm, rEntry, false);
     156             : 
     157           0 :             ++aIt;
     158             :         }
     159             :     }
     160             : 
     161             :     SwWW8Writer::WriteLong( *pDataStrm, nDataStt,
     162           0 :                            pDataStrm->Tell() - nDataStt );
     163           0 : }
     164             : 
     165             : }
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10