INTEGRATION: CWS hb10 (1.103.102); FILE MERGED
2008/08/29 14:25:45 hbrinkm 1.103.102.4: RESYNC: (1.103-1.104); FILE MERGED 2008/08/29 13:39:05 hbrinkm 1.103.102.3: #158227# OOo needs checkbox height to be set for import 2008/07/23 11:47:45 hbrinkm 1.103.102.2: #158227# resolve warnings 2008/07/23 08:14:19 hbrinkm 1.103.102.1: #158227#: use WW8FFData to write form field data
This commit is contained in:
parent
85a333e07a
commit
ed731aa599
1 changed files with 47 additions and 245 deletions
|
@ -7,7 +7,7 @@
|
||||||
* OpenOffice.org - a multi-platform office productivity suite
|
* OpenOffice.org - a multi-platform office productivity suite
|
||||||
*
|
*
|
||||||
* $RCSfile: wrtw8esh.cxx,v $
|
* $RCSfile: wrtw8esh.cxx,v $
|
||||||
* $Revision: 1.104 $
|
* $Revision: 1.105 $
|
||||||
*
|
*
|
||||||
* This file is part of OpenOffice.org.
|
* This file is part of OpenOffice.org.
|
||||||
*
|
*
|
||||||
|
@ -109,6 +109,7 @@
|
||||||
// --> OD 2007-07-24 #148096#
|
// --> OD 2007-07-24 #148096#
|
||||||
#include <ndtxt.hxx>
|
#include <ndtxt.hxx>
|
||||||
// <--
|
// <--
|
||||||
|
#include "WW8FFData.hxx"
|
||||||
|
|
||||||
using namespace com::sun::star;
|
using namespace com::sun::star;
|
||||||
using namespace sw::util;
|
using namespace sw::util;
|
||||||
|
@ -200,7 +201,7 @@ void SwWW8Writer::DoComboBox(const rtl::OUString &rName,
|
||||||
if (!bWrtWW8)
|
if (!bWrtWW8)
|
||||||
return;
|
return;
|
||||||
OutField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
|
OutField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
|
||||||
WRITEFIELD_START | WRITEFIELD_CMD_START);
|
WRITEFIELD_START | WRITEFIELD_CMD_START);
|
||||||
// write the refence to the "picture" structure
|
// write the refence to the "picture" structure
|
||||||
ULONG nDataStt = pDataStrm->Tell();
|
ULONG nDataStt = pDataStrm->Tell();
|
||||||
pChpPlc->AppendFkpEntry( Strm().Tell() );
|
pChpPlc->AppendFkpEntry( Strm().Tell() );
|
||||||
|
@ -220,148 +221,26 @@ void SwWW8Writer::DoComboBox(const rtl::OUString &rName,
|
||||||
pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1);
|
pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1);
|
||||||
|
|
||||||
OutField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
|
OutField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN),
|
||||||
WRITEFIELD_CLOSE);
|
WRITEFIELD_CLOSE);
|
||||||
|
|
||||||
static const sal_uInt8 aComboData1[] =
|
::sw::WW8FFData * pFFData = new ::sw::WW8FFData();
|
||||||
|
|
||||||
|
pFFData->setType(2);
|
||||||
|
pFFData->setName(rName);
|
||||||
|
pFFData->setHelp(rHelp);
|
||||||
|
pFFData->setStatus(rToolTip);
|
||||||
|
|
||||||
|
sal_uInt32 nListItems = rListItems.getLength();
|
||||||
|
|
||||||
|
for (sal_uInt32 i = 0; i < nListItems; i++)
|
||||||
{
|
{
|
||||||
0,0,0,0, // len of struct
|
if (i < 0x20 && rSelected == rListItems[i])
|
||||||
0x44,0, // the start of "next" data
|
pFFData->setResult(::sal::static_int_cast<sal_uInt8>(i));
|
||||||
0,0,0,0,0,0,0,0,0,0, // PIC-Structure!
|
pFFData->addListboxEntry(rListItems[i]);
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0, // /
|
|
||||||
};
|
|
||||||
pDataStrm->Write( aComboData1, sizeof(aComboData1) );
|
|
||||||
|
|
||||||
static const sal_uInt8 aComboData2[] =
|
|
||||||
{
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF
|
|
||||||
};
|
|
||||||
pDataStrm->Write( aComboData2, sizeof(aComboData2) );
|
|
||||||
|
|
||||||
sal_uInt8 nHeaderByte = 0xe2;
|
|
||||||
sal_uInt32 nNoStrings = rListItems.getLength();
|
|
||||||
if (nNoStrings)
|
|
||||||
{
|
|
||||||
bool bSelectedDone = false;
|
|
||||||
sal_uInt32 i;
|
|
||||||
|
|
||||||
for ( i = 0; i < nNoStrings; ++i)
|
|
||||||
{
|
|
||||||
if (rSelected == rListItems[i])
|
|
||||||
{
|
|
||||||
bSelectedDone = true;
|
|
||||||
i++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bSelectedDone && i <= 0x3F) //only 6 bit available for selected item
|
|
||||||
{
|
|
||||||
nHeaderByte |= (i << 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*pDataStrm << nHeaderByte;
|
pFFData->Write(pDataStrm);
|
||||||
|
|
||||||
sal_uInt8 aComboData9[] =
|
|
||||||
{
|
|
||||||
0x80, 0x00, 0x00, 0x00, 0x00
|
|
||||||
};
|
|
||||||
|
|
||||||
if (rToolTip.getLength() > 0)
|
|
||||||
aComboData9[0] |= 1;
|
|
||||||
|
|
||||||
pDataStrm->Write( aComboData9, sizeof(aComboData9) );
|
|
||||||
|
|
||||||
sal_uInt16 nLen = msword_cast<sal_uInt16>(rName.getLength());
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, rName, true);
|
|
||||||
|
|
||||||
static const sal_uInt8 aComboData3[] =
|
|
||||||
{
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
||||||
};
|
|
||||||
pDataStrm->Write( aComboData3, sizeof(aComboData3) );
|
|
||||||
|
|
||||||
nLen = msword_cast<sal_uInt16>(rHelp.getLength());
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, rHelp, true);
|
|
||||||
|
|
||||||
nLen = msword_cast<sal_uInt16>(rToolTip.getLength());
|
|
||||||
if (nLen > 0)
|
|
||||||
{
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, rToolTip, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const sal_uInt8 aComboData4[] =
|
|
||||||
{
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0xff, 0xff
|
|
||||||
};
|
|
||||||
|
|
||||||
pDataStrm->Write( aComboData4, sizeof(aComboData4) );
|
|
||||||
*pDataStrm << nNoStrings;
|
|
||||||
if (!nNoStrings)
|
|
||||||
*pDataStrm << sal_uInt16(0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (sal_uInt32 i = 0; i < nNoStrings; ++i)
|
|
||||||
{
|
|
||||||
const rtl::OUString &rItem = rListItems[i];
|
|
||||||
sal_uInt16 nStrLen = msword_cast<sal_uInt16>(rItem.getLength());
|
|
||||||
*pDataStrm << nStrLen;
|
|
||||||
WriteString16(*pDataStrm, rItem, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SwWW8Writer::WriteLong( *pDataStrm, nDataStt,
|
|
||||||
pDataStrm->Tell() - nDataStt );
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool lcl_HasPropertyNonEmpty
|
|
||||||
(uno::Reference<beans::XPropertySet> xPropSet,
|
|
||||||
const rtl::OUString & sPropName)
|
|
||||||
{
|
|
||||||
bool bResult = false;
|
|
||||||
|
|
||||||
uno::Reference<beans::XPropertySetInfo> xPropSetInfo =
|
|
||||||
xPropSet->getPropertySetInfo();
|
|
||||||
|
|
||||||
if (xPropSetInfo->hasPropertyByName(sPropName))
|
|
||||||
{
|
|
||||||
uno::Any aTmp(xPropSet->getPropertyValue(sPropName));
|
|
||||||
const rtl::OUString * pStr = (const rtl::OUString *)aTmp.getValue();
|
|
||||||
|
|
||||||
if (pStr && pStr->getLength() > 0)
|
|
||||||
bResult = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void lcl_WW8WriteProperty(uno::Reference<beans::XPropertySet> xPropSet,
|
|
||||||
SvStream * pDataStrm,
|
|
||||||
const rtl::OUString & sPropName)
|
|
||||||
{
|
|
||||||
uno::Reference<beans::XPropertySetInfo> xPropSetInfo =
|
|
||||||
xPropSet->getPropertySetInfo();
|
|
||||||
|
|
||||||
const rtl::OUString * pStr = NULL;
|
|
||||||
uno::Any aTmp;
|
|
||||||
|
|
||||||
if (xPropSetInfo->hasPropertyByName(sPropName))
|
|
||||||
{
|
|
||||||
aTmp = xPropSet->getPropertyValue(sPropName);
|
|
||||||
pStr = (const rtl::OUString *)aTmp.getValue();
|
|
||||||
}
|
|
||||||
sal_uInt16 nLen = pStr ? msword_cast<sal_uInt16>(pStr->getLength()) : 0;
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
if (pStr)
|
|
||||||
SwWW8Writer::WriteString16(*pDataStrm, String(*pStr), true);
|
|
||||||
else
|
|
||||||
SwWW8Writer::WriteString16(*pDataStrm, aEmptyStr, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwWW8Writer::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet)
|
void SwWW8Writer::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet)
|
||||||
|
@ -389,23 +268,10 @@ void SwWW8Writer::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet)
|
||||||
pChpPlc->AppendFkpEntry(Strm().Tell(),
|
pChpPlc->AppendFkpEntry(Strm().Tell(),
|
||||||
sizeof( aArr1 ), aArr1 );
|
sizeof( aArr1 ), aArr1 );
|
||||||
|
|
||||||
static const sal_uInt8 aComboData1[] =
|
::sw::WW8FFData * pFFData = new ::sw::WW8FFData();
|
||||||
{
|
|
||||||
0,0,0,0, // len of struct
|
|
||||||
0x44,0, // the start of "next" data
|
|
||||||
0,0,0,0,0,0,0,0,0,0, // PIC-Structure!
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0, // /
|
|
||||||
};
|
|
||||||
pDataStrm->Write( aComboData1, sizeof(aComboData1) );
|
|
||||||
|
|
||||||
static const sal_uInt8 aComboData2[] =
|
pFFData->setType(1);
|
||||||
{
|
pFFData->setCheckboxHeight(0x14);
|
||||||
0xFF, 0xFF, 0xFF, 0xFF
|
|
||||||
};
|
|
||||||
pDataStrm->Write( aComboData2, sizeof(aComboData2) );
|
|
||||||
|
|
||||||
sal_Int16 nTemp = 0;
|
sal_Int16 nTemp = 0;
|
||||||
xPropSet->getPropertyValue(C2U("DefaultState")) >>= nTemp;
|
xPropSet->getPropertyValue(C2U("DefaultState")) >>= nTemp;
|
||||||
|
@ -413,57 +279,44 @@ void SwWW8Writer::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet)
|
||||||
|
|
||||||
xPropSet->getPropertyValue(C2U("State")) >>= nTemp;
|
xPropSet->getPropertyValue(C2U("State")) >>= nTemp;
|
||||||
sal_uInt32 nIsChecked(nTemp);
|
sal_uInt32 nIsChecked(nTemp);
|
||||||
sal_uInt8 nHeaderByte = 0xe5;
|
|
||||||
if (nIsDefaultChecked != nIsChecked)
|
if (nIsDefaultChecked != nIsChecked)
|
||||||
{
|
{
|
||||||
switch (nIsChecked)
|
switch (nIsChecked)
|
||||||
{
|
{
|
||||||
case false:
|
case false:
|
||||||
nHeaderByte = 0x1;
|
pFFData->setResult(0);
|
||||||
break;
|
break;
|
||||||
case true:
|
case true:
|
||||||
nHeaderByte = 0x5;
|
pFFData->setResult(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(!this, "how did that happen");
|
ASSERT(!this, "how did that happen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*pDataStrm << nHeaderByte;
|
|
||||||
|
|
||||||
sal_uInt8 aComboData5[] =
|
::rtl::OUString aStr;
|
||||||
|
static ::rtl::OUString sName(C2U("Name"));
|
||||||
|
if (xPropSetInfo->hasPropertyByName(sName))
|
||||||
{
|
{
|
||||||
0x04, 0x00, 0x00, 0x14, 0x00
|
xPropSet->getPropertyValue(sName) >>= aStr;
|
||||||
};
|
pFFData->setName(aStr);
|
||||||
|
}
|
||||||
|
|
||||||
const rtl::OUString sHelpText(C2U("HelpText"));
|
static ::rtl::OUString sHelpText(C2U("HelpText"));
|
||||||
if (lcl_HasPropertyNonEmpty(xPropSet, sHelpText))
|
if (xPropSetInfo->hasPropertyByName(sHelpText))
|
||||||
aComboData5[0] |= 0x1;
|
|
||||||
|
|
||||||
pDataStrm->Write( aComboData5, sizeof(aComboData5) );
|
|
||||||
|
|
||||||
lcl_WW8WriteProperty(xPropSet, pDataStrm, C2U("Name"));
|
|
||||||
|
|
||||||
*pDataStrm << nIsDefaultChecked;
|
|
||||||
|
|
||||||
static const sal_uInt8 aComboData3[] =
|
|
||||||
{
|
{
|
||||||
0x00, 0x00
|
xPropSet->getPropertyValue(sHelpText) >>= aStr;
|
||||||
};
|
pFFData->setHelp(aStr);
|
||||||
|
}
|
||||||
pDataStrm->Write( aComboData3, sizeof(aComboData3) );
|
static ::rtl::OUString sHelpF1Text(C2U("HelpF1Text"));
|
||||||
|
if (xPropSetInfo->hasPropertyByName(sHelpF1Text))
|
||||||
lcl_WW8WriteProperty(xPropSet, pDataStrm, C2U("HelpF1Text"));
|
|
||||||
lcl_WW8WriteProperty(xPropSet, pDataStrm, sHelpText);
|
|
||||||
|
|
||||||
static const sal_uInt8 aComboData4[] =
|
|
||||||
{
|
{
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
xPropSet->getPropertyValue(sHelpF1Text) >>= aStr;
|
||||||
};
|
pFFData->setStatus(aStr);
|
||||||
|
}
|
||||||
|
|
||||||
pDataStrm->Write( aComboData4, sizeof(aComboData4) );
|
pFFData->Write(pDataStrm);
|
||||||
|
|
||||||
SwWW8Writer::WriteLong( *pDataStrm, nDataStt,
|
|
||||||
pDataStrm->Tell() - nDataStt );
|
|
||||||
|
|
||||||
OutField(0, ww::eFORMCHECKBOX, aEmptyStr, WRITEFIELD_CLOSE);
|
OutField(0, ww::eFORMCHECKBOX, aEmptyStr, WRITEFIELD_CLOSE);
|
||||||
}
|
}
|
||||||
|
@ -490,64 +343,13 @@ void SwWW8Writer::DoFormText(const SwInputField * pFld)
|
||||||
pChpPlc->AppendFkpEntry(Strm().Tell(),
|
pChpPlc->AppendFkpEntry(Strm().Tell(),
|
||||||
sizeof( aArr1 ), aArr1 );
|
sizeof( aArr1 ), aArr1 );
|
||||||
|
|
||||||
static const sal_uInt8 aComboData1[] =
|
::sw::WW8FFData * pFFData = new ::sw::WW8FFData();
|
||||||
{
|
|
||||||
0,0,0,0, // len of struct
|
|
||||||
0x44,0, // the start of "next" data
|
|
||||||
0,0,0,0,0,0,0,0,0,0, // PIC-Structure!
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // |
|
|
||||||
0,0,0,0 // /
|
|
||||||
};
|
|
||||||
pDataStrm->Write( aComboData1, sizeof(aComboData1) );
|
|
||||||
|
|
||||||
sal_uInt8 aComboData2[] =
|
pFFData->setType(0);
|
||||||
{
|
pFFData->setName(pFld->GetPar2());
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0
|
pFFData->setHelp(pFld->GetHelp());
|
||||||
};
|
pFFData->setStatus(pFld->GetToolTip());
|
||||||
|
pFFData->Write(pDataStrm);
|
||||||
if (pFld->GetToolTip().Len() > 0)
|
|
||||||
aComboData2[5] |= 0x1;
|
|
||||||
|
|
||||||
pDataStrm->Write( aComboData2, sizeof(aComboData2) );
|
|
||||||
|
|
||||||
rtl::OUString aStr = pFld->GetPar2();
|
|
||||||
sal_uInt16 nLen = msword_cast<sal_uInt16>(aStr.getLength());
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, aStr, true);
|
|
||||||
|
|
||||||
aStr = rtl::OUString();//aEmptyStr; //pFld->GetPar1();
|
|
||||||
nLen = msword_cast<sal_uInt16>(aStr.getLength());
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, aStr, true);
|
|
||||||
|
|
||||||
aStr = pFld->GetHelp();
|
|
||||||
nLen = msword_cast<sal_uInt16>(aStr.getLength());
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, aStr, true);
|
|
||||||
|
|
||||||
nLen = 0;
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, aEmptyStr, true);
|
|
||||||
|
|
||||||
aStr = pFld->GetToolTip();
|
|
||||||
if (aStr.getLength() > 0)
|
|
||||||
{
|
|
||||||
nLen = msword_cast<sal_uInt16>(aStr.getLength());
|
|
||||||
*pDataStrm << nLen;
|
|
||||||
WriteString16(*pDataStrm, aStr, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static sal_uInt8 aComboData3[] =
|
|
||||||
{
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
pDataStrm->Write( aComboData3, sizeof(aComboData3) );
|
|
||||||
|
|
||||||
SwWW8Writer::WriteLong( *pDataStrm, nDataStt,
|
|
||||||
pDataStrm->Tell() - nDataStt );
|
|
||||||
|
|
||||||
OutField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CMD_END);
|
OutField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CMD_END);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue