summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-22 12:41:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-22 13:11:34 +0100
commite8204fe4cb382176bd9a803f4e7a21e5f69ce2db (patch)
treeb462a3610da26d739ebfc4782947740292b2657a
parent1a2c28cf0dabd1b84d7130186f562de82cb1ca82 (diff)
Resolves: ooo#40683 support word for windows 1
via the standard .doc binary filter Change-Id: I0284fa815e6874d7d59ad1ad8ede4482d2e266a4
-rw-r--r--filter/source/config/fragments/filters/MS_WinWord_5.xcu2
-rw-r--r--filter/source/config/fragments/types/writer_MS_WinWord_5.xcu2
-rw-r--r--sw/qa/core/data/ww5/pass/ooo2535-1-WW2.doc (renamed from sw/qa/core/data/ww5/pass/ooo2535-1.doc)bin55056 -> 55056 bytes
-rw-r--r--sw/qa/core/data/ww5/pass/ooo40683-1-WW1.docbin0 -> 3698 bytes
-rw-r--r--sw/source/filter/ww8/types.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx3
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx51
-rw-r--r--sw/source/ui/uno/swdetect.cxx6
9 files changed, 47 insertions, 24 deletions
diff --git a/filter/source/config/fragments/filters/MS_WinWord_5.xcu b/filter/source/config/fragments/filters/MS_WinWord_5.xcu
index b1b29fde0baa..a8656eda4bf5 100644
--- a/filter/source/config/fragments/filters/MS_WinWord_5.xcu
+++ b/filter/source/config/fragments/filters/MS_WinWord_5.xcu
@@ -21,7 +21,7 @@
<prop oor:name="FilterService"/>
<prop oor:name="UserData"><value>WW6</value></prop>
<prop oor:name="UIName">
- <value xml:lang="en-US">Microsoft WinWord 5</value>
+ <value xml:lang="en-US">Microsoft WinWord 1/2/5</value>
</prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>writer_MS_WinWord_5</value></prop>
diff --git a/filter/source/config/fragments/types/writer_MS_WinWord_5.xcu b/filter/source/config/fragments/types/writer_MS_WinWord_5.xcu
index 93d994516e73..87ee89e85ba4 100644
--- a/filter/source/config/fragments/types/writer_MS_WinWord_5.xcu
+++ b/filter/source/config/fragments/types/writer_MS_WinWord_5.xcu
@@ -23,7 +23,7 @@
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>MS WinWord 5</value></prop>
<prop oor:name="UIName">
- <value>Microsoft WinWord 5</value>
+ <value>Microsoft WinWord 1/2/5</value>
</prop>
<prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
</node>
diff --git a/sw/qa/core/data/ww5/pass/ooo2535-1.doc b/sw/qa/core/data/ww5/pass/ooo2535-1-WW2.doc
index 2c594f562347..2c594f562347 100644
--- a/sw/qa/core/data/ww5/pass/ooo2535-1.doc
+++ b/sw/qa/core/data/ww5/pass/ooo2535-1-WW2.doc
Binary files differ
diff --git a/sw/qa/core/data/ww5/pass/ooo40683-1-WW1.doc b/sw/qa/core/data/ww5/pass/ooo40683-1-WW1.doc
new file mode 100644
index 000000000000..af63daa0c0ed
--- /dev/null
+++ b/sw/qa/core/data/ww5/pass/ooo40683-1-WW1.doc
Binary files differ
diff --git a/sw/source/filter/ww8/types.hxx b/sw/source/filter/ww8/types.hxx
index f0fc5bde8874..a57b99bd9aaf 100644
--- a/sw/source/filter/ww8/types.hxx
+++ b/sw/source/filter/ww8/types.hxx
@@ -30,7 +30,7 @@ namespace ww
const sal_uInt8* data() const { return empty() ? 0 : &front(); }
};
- enum WordVersion {eWW2 = 2, eWW6 = 6, eWW7 = 7, eWW8 = 8};
+ enum WordVersion {eWW1 = 1, eWW2 = 2, eWW6 = 6, eWW7 = 7, eWW8 = 8};
inline bool IsSevenMinus(WordVersion eVer) { return eVer <= eWW7; }
inline bool IsEightPlus(WordVersion eVer) { return eVer >= eWW8; }
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index fafab4302037..9b10f1e702db 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6090,8 +6090,9 @@ sal_uLong SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss)
case 6:
case 7:
if (
- (0xa5dc != nMagic && 0xa5db != nMagic) &&
- (nMagic < 0xa697 || nMagic > 0xa699)
+ 0xa59b != nMagic && 0xa59c != nMagic &&
+ 0xa5dc != nMagic && 0xa5db != nMagic &&
+ (nMagic < 0xa697 || nMagic > 0xa699)
)
{
// Test for own 97 fake!
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 8d2758e5f3b6..b5cc9a846a82 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1642,6 +1642,7 @@ wwTableSprm GetTableSprm(sal_uInt16 nId, ww::WordVersion eVer)
return sprmTDxaCol;
}
break;
+ case ww::eWW1:
case ww::eWW2:
switch (nId)
{
@@ -4358,7 +4359,7 @@ void WW8RStyle::ImportNewFormatStyles()
void WW8RStyle::ImportStyles()
{
- if (ww::eWW2 == pIo->pWwFib->GetFIBVersion())
+ if (pIo->pWwFib->GetFIBVersion() <= ww::eWW2)
ImportOldFormatStyles();
else
ImportNewFormatStyles();
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 1df4c607eddf..f0f15d89f345 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -780,7 +780,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher()
wwSprmParser::wwSprmParser(ww::WordVersion eVersion) : meVersion(eVersion)
{
- OSL_ENSURE((meVersion >= ww::eWW2 && meVersion <= ww::eWW8),
+ OSL_ENSURE((meVersion >= ww::eWW1 && meVersion <= ww::eWW8),
"Impossible value for version");
mnDelta = (ww::IsSevenMinus(meVersion)) ? 0 : 1;
@@ -2480,7 +2480,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
FillEntry(aEntry, nDataOffset, aEntry.mnLen);
- if (aEntry.mnLen && eVersion == ww::eWW2)
+ if (aEntry.mnLen && eVersion <= ww::eWW2)
{
Word2CHPX aChpx = ReadWord2Chpx(*pSt, nFilePos + nOfs + 1, static_cast< sal_uInt8 >(aEntry.mnLen));
std::vector<sal_uInt8> aSprms = ChpxToSprms(aChpx);
@@ -2507,7 +2507,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
aEntry.mnLen *= 2;
//stylecode, std/istd
- if (eVersion == ww::eWW2)
+ if (eVersion <= ww::eWW2)
{
if (aEntry.mnLen >= 1)
{
@@ -2843,6 +2843,7 @@ bool WW8PLCFx_Fc_FKP::NewFkp()
switch (GetFIBVersion())
{
+ case ww::eWW1:
case ww::eWW2:
pFkpSizeTab = WW8FkpSizeTabVer2;
break;
@@ -5124,6 +5125,10 @@ ww::WordVersion WW8Fib::GetFIBVersion() const
ww::WordVersion eVer = ww::eWW8;
/*
* Word for Windows 2 I think (1.X might work too if anyone has an example.
+ *
+ * 0xA59B for Word 1 for Windows
+ * 0xA59C for Word 1 for OS/2 "PM Word"
+ *
* Various pages claim that the fileformats of Word 1 and 2 for Windows are
* equivalent to Word for Macintosh 4 and 5. On the other hand
*
@@ -5138,7 +5143,9 @@ ww::WordVersion WW8Fib::GetFIBVersion() const
* its format isn't the same as that of Word 2 for windows. Nor is it
* the same as that of Word for DOS/PCWord 5
*/
- if (wIdent == 0xa5db)
+ if (wIdent == 0xa59b || wIdent == 0xa59c)
+ eVer = ww::eWW1;
+ else if (wIdent == 0xa5db)
eVer = ww::eWW2;
else
{
@@ -5367,12 +5374,20 @@ WW8Fib::WW8Fib(SvStream& rSt, sal_uInt8 nWantedVersion, sal_uInt32 nOffset)
lcbPlcfmcr = Readcb(rSt, eVer);
rSt.ReadInt32( fcSttbfmcr );
lcbSttbfmcr = Readcb(rSt, eVer);
- rSt.ReadInt32( fcPrDrvr );
- lcbPrDrvr = Readcb(rSt, eVer);
- rSt.ReadInt32( fcPrEnvPort );
- lcbPrEnvPort = Readcb(rSt, eVer);
- rSt.ReadInt32( fcPrEnvLand );
- lcbPrEnvLand = Readcb(rSt, eVer);
+ if (eVer >= ww::eWW2)
+ {
+ rSt.ReadInt32( fcPrDrvr );
+ lcbPrDrvr = Readcb(rSt, eVer);
+ rSt.ReadInt32( fcPrEnvPort );
+ lcbPrEnvPort = Readcb(rSt, eVer);
+ rSt.ReadInt32( fcPrEnvLand );
+ lcbPrEnvLand = Readcb(rSt, eVer);
+ }
+ else
+ {
+ rSt.ReadInt32( fcPrEnvPort );
+ lcbPrEnvPort = Readcb(rSt, eVer);
+ }
rSt.ReadInt32( fcWss );
lcbWss = Readcb(rSt, eVer);
rSt.ReadInt32( fcDop );
@@ -5393,13 +5408,17 @@ WW8Fib::WW8Fib(SvStream& rSt, sal_uInt8 nWantedVersion, sal_uInt32 nOffset)
// weiteres short nur bei Ver67 ueberspringen
if (IsSevenMinus(eVer))
{
- rSt.SeekRel( 1*sizeof( sal_Int16) );
+ if (eVer == ww::eWW1)
+ rSt.SeekRel(1*sizeof(sal_Int32));
+ rSt.SeekRel(1*sizeof(sal_Int16));
- // folgende 4 Shorts existieren nur bei Ver67;
- rSt.ReadInt16( pnChpFirst_Ver67 );
- rSt.ReadInt16( pnPapFirst_Ver67 );
- rSt.ReadInt16( cpnBteChp_Ver67 );
- rSt.ReadInt16( cpnBtePap_Ver67 );
+ if (eVer >= ww::eWW2)
+ {
+ rSt.ReadInt16(pnChpFirst_Ver67);
+ rSt.ReadInt16(pnPapFirst_Ver67);
+ }
+ rSt.ReadInt16(cpnBteChp_Ver67);
+ rSt.ReadInt16(cpnBtePap_Ver67);
}
if (eVer > ww::eWW2)
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index c37e9fcfe22e..eff1d64ea0b9 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -73,8 +73,10 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
if ( pInStrm->Read( nBuffer, nBufSize ) < nBufSize )
return OUString();
- bIsDetected = ( nBuffer[0] == 0xDB && nBuffer[1] == 0xA5 && nBuffer[2] == 0x2D ) // WinWord 2.0 file
- || ( nBuffer[0] == 0xDC && nBuffer[1] == 0xA5 && nBuffer[2] == 0x65 ); // WinWord 6.0/95, as a single stream file
+ bIsDetected = (nBuffer[0] == 0x9B && nBuffer[1] == 0xA5 && nBuffer[2] == 0x21) // WinWord 1
+ || (nBuffer[0] == 0x9C && nBuffer[1] == 0xA5 && nBuffer[2] == 0x21) // PMWord 1
+ || (nBuffer[0] == 0xDB && nBuffer[1] == 0xA5 && nBuffer[2] == 0x2D) // WinWord 2
+ || (nBuffer[0] == 0xDC && nBuffer[1] == 0xA5 && nBuffer[2] == 0x65); // WinWord 6.0/95, as a single stream file
}
else
{