diff options
author | Noel Power <noel.power@novell.com> | 2011-06-07 10:58:17 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2011-06-07 10:58:17 +0100 |
commit | a4b592dbc7aae6a56a6ea6f8a697cad441af3b8f (patch) | |
tree | aec6cc051a9a9151358aadab7f216b53f168aadd | |
parent | f61c6a2a0e05173a43caa49d9b1e68a921afd002 (diff) |
Revert "fix date format export, N is not a recognised format code"
This reverts commit 186032185beaa6859193c8946e7d1d0197db55be.
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 174 |
2 files changed, 98 insertions, 85 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 2f4921bbdaee..76770985ca2b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -756,15 +756,6 @@ void DocxAttributeOutput::CmdField_Impl( FieldInfos& rInfos ) for ( xub_StrLen i = 0; i < nNbToken; i++ ) { String sToken = rInfos.sCmd.GetToken( i, '\t' ); - if ( rInfos.eType == ww::eCREATEDATE - || rInfos.eType == ww::eSAVEDATE - || rInfos.eType == ww::ePRINTDATE - || rInfos.eType == ww::eDATE - || rInfos.eType == ww::eTIME ) - { - sToken.SearchAndReplaceAll( String( RTL_CONSTASCII_USTRINGPARAM("NNNN") ), String( RTL_CONSTASCII_USTRINGPARAM("dddd") ) ); - sToken.SearchAndReplaceAll( String( RTL_CONSTASCII_USTRINGPARAM("NN") ), String( RTL_CONSTASCII_USTRINGPARAM("ddd") ) ); - } // Write the Field command DoWriteCmd( sToken ); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index eb257f2b6b38..90dbc4bf3434 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2138,88 +2138,118 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, SvStream *pDataStream) { sal_uInt8 nField; - // nHeaderBype == version - sal_uInt32 nHeaderByte; - - // The following is a FFData structure as described in - // Microsoft's DOC specification (chapter 2.9.78) + sal_uInt8 nHeaderByte; + int nType=0; *pDataStream >> nHeaderByte; + if (nHeaderByte == 0xFF) //Guesswork time, difference between 97 and 95 ? + { + pDataStream->SeekRel(3); + *pDataStream >> nHeaderByte; + nType=1; + } + fUnknown = nHeaderByte & 0x3; + fDropdownIndex = (nHeaderByte & 0x7C) >> 2; + *pDataStream >> nField; + fToolTip = nField & 0x01; + fNoMark = (nField & 0x02)>>1; + fUseSize = (nField & 0x04)>>2; + fNumbersOnly= (nField & 0x08)>>3; + fDateOnly = (nField & 0x10)>>4; + fUnused = (nField & 0xE0)>>5; + *pDataStream >> nSize; - // wouldn't it be better to read the bits as a 16 bit word ( like it is in the spec. - // certainly easier to follow. - sal_uInt8 bits1; - *pDataStream >> bits1; - sal_uInt8 bits2; - *pDataStream >> bits2; - - sal_uInt8 iType = ( bits1 & 0x3 ); - - // we should verify that bits.iType & nWhich concur - OSL_ENSURE( iType == nWhich, "something wrong, expect control type read from stream doesn't match nWhich passed in"); - if ( !( iType == nWhich ) ) - return; // bail out - - sal_uInt8 iRes = (bits1 & 0x7C) >> 2; - - sal_uInt16 cch; - *pDataStream >> cch; - - sal_uInt16 hps; - *pDataStream >> hps; + *pDataStream >> hpsCheckBox; + if (nType == 0) + pDataStream->SeekRel(2); //Guess rtl_TextEncoding eEnc = rRdr.eStructCharSet; + sTitle = !nType ? WW8ReadPString(*pDataStream, eEnc, true) + : WW8Read_xstz(*pDataStream, 0, true); - // xstzName - sTitle = WW8Read_xstz(*pDataStream, 0, true); + if (nWhich == WW8_CT_CHECKBOX) + { + *pDataStream >> nDefaultChecked; + nChecked = nDefaultChecked; - if (nWhich == WW8_CT_EDIT) - { // Field is a textbox - // Default text - // xstzTextDef - sDefault = WW8Read_xstz(*pDataStream, 0, true); + sal_uInt8 iRes = (nHeaderByte >> 2) & 0x1F; + switch (iRes) + { + case 1: //checked + nChecked = true; + break; + case 25: //undefined, Undefined checkboxes are treated as unchecked + //but it appear that both visually and the value are picked up from the default in that case + break; + case 0: //unchecked + nChecked = false; + break; + default: + OSL_ENSURE(!this, "unknown option, please report to cmc"); + break; + } + if ( nDefaultChecked ) + sDefault = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("1") ); + else + sDefault = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("0") ); } + else if (nWhich == WW8_CT_DROPDOWN) + *pDataStream >> nChecked; else { - // CheckBox or ComboBox - sal_uInt16 wDef = 0; - *pDataStream >> wDef; - nChecked = wDef; // default - if (nWhich == WW8_CT_CHECKBOX) - { - if ( iRes != 25 ) - nChecked = iRes; - sDefault = ( wDef == 0 ) ? rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("0") ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("1") ); - } + sDefault = !nType ? WW8ReadPString(*pDataStream, eEnc, true) + : WW8Read_xstz(*pDataStream, 0, true); } - // xstzTextFormat - sFormatting = WW8Read_xstz(*pDataStream, 0, true); - // xstzHelpText - sHelp = WW8Read_xstz(*pDataStream, 0, true); - // xstzStatText - sToolTip = WW8Read_xstz(*pDataStream, 0, true); - String sEntryMacro = WW8Read_xstz(*pDataStream, 0, true); - String sExitMcr = WW8Read_xstz(*pDataStream, 0, true); + sFormatting = !nType ? WW8ReadPString(*pDataStream, eEnc, true) + : WW8Read_xstz(*pDataStream, 0, true); - if (nWhich == WW8_CT_DROPDOWN) - { - bool bAllOk = true; - // SSTB (see Spec. 2.2.4) - sal_uInt16 fExtend; - *pDataStream >> fExtend; - sal_uInt16 nNoStrings; + sHelp = !nType ? WW8ReadPString(*pDataStream, eEnc, true) + : WW8Read_xstz(*pDataStream, 0, true); - // Isn't it that if fExtend isn't 0xFFFF then fExtend actually - // doesn't exist and we really have just read nNoStrings ( or cData )? - if (fExtend != 0xFFFF) - bAllOk = false; - *pDataStream >> nNoStrings; + if (nWhich == WW8_CT_DROPDOWN) //is this the case ? + fToolTip = true; - // I guess this should be zero ( and we should ensure that ) - sal_uInt16 cbExtra; - *pDataStream >> cbExtra; + if( fToolTip ) + { + sToolTip = !nType ? WW8ReadPString(*pDataStream, eEnc, true) + : WW8Read_xstz(*pDataStream, 0, true); + } + if (nWhich == WW8_CT_DROPDOWN) + { + bool bAllOk = true; + pDataStream->SeekRel(4 * (nType ? 2 : 1)); + sal_uInt16 nDummy; + *pDataStream >> nDummy; + sal_uInt32 nNoStrings; + if (!nType) + { + sal_uInt16 nWord95NoStrings; + *pDataStream >> nWord95NoStrings; + nNoStrings = nWord95NoStrings; + *pDataStream >> nWord95NoStrings; + if (nNoStrings != nWord95NoStrings) + bAllOk = false; + nNoStrings = nWord95NoStrings; + sal_uInt16 nDummy2; + *pDataStream >> nDummy2; + if (nDummy2 != 0) + bAllOk = false; + *pDataStream >> nDummy2; + if (nDummy2 != 0xA) + bAllOk = false; + if (!bAllOk) //Not as expected, don't risk it at all. + nNoStrings = 0; + for (sal_uInt16 nI = 0; nI < nNoStrings; ++nI) + pDataStream->SeekRel(2); + } + else + { + if (nDummy != 0xFFFF) + bAllOk = false; + *pDataStream >> nNoStrings; + } OSL_ENSURE(bAllOk, "Unknown formfield dropdown list structure. Report to cmc"); if (!bAllOk) //Not as expected, don't risk it at all. @@ -2227,19 +2257,11 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, maListEntries.reserve(nNoStrings); for (sal_uInt32 nI = 0; nI < nNoStrings; ++nI) { - String sEntry = WW8Read_xstz(*pDataStream, 0, false); + String sEntry = !nType ? WW8ReadPString(*pDataStream, eEnc, false) + : WW8Read_xstz(*pDataStream, 0, false); maListEntries.push_back(sEntry); } } - fDropdownIndex = iRes; - - nField = bits2; - fToolTip = nField & 0x01; - fNoMark = (nField & 0x02)>>1; - fUseSize = (nField & 0x04)>>2; - fNumbersOnly= (nField & 0x08)>>3; - fDateOnly = (nField & 0x10)>>4; - fUnused = (nField & 0xE0)>>5; } WW8FormulaListBox::WW8FormulaListBox(SwWW8ImplReader &rR) |