eclipse-platform / eclipse-platform/eclipse.platform

Compare with Microsoft Word 2007 and above diffs in direction opposite to Word 2003

オープン
#65 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
165
フォーク
174
平均マージ
2日 8時間
マージ済み PR(30日)
22

説明

This is a fresh copy of the old [bug 401373](https://bugs.eclipse.org/bugs/show_bug.cgi?id=401373), after doing some intensive research & debugging today.

The fix seems to be pretty easy: as hinted in the linked report, it is just about switching the compared Document objects order based on the Word version, like they did it back in 2008 in TortoiseSVN:

TortoiseGit/tortoisesvn@0dabda7d91c41c085986a150afc1a368e154f102, or just look for occurrences of `vOffice2007` in their [diff-doc.js](https://github.com/TortoiseGit/tortoisesvn/blob/master/contrib/diff-scripts/diff-doc.js).

=> We can probably do something similar inside the `org.eclipse.compare.internal.win32.WordComparison.createWorkingCopy(String baseDocument, String revisedDocument, String workingCopy)` method.

We just need to get to `Word.Version` somehow, in order to implement the switch condition for backwards compatibility. The following looks like the simplest working way (possibly returning string `12.0` for Word 2007):

```java
getVariantProperty(new OleAutomation(new OleClientSite(frame, SWT.NONE, "Word.Application")), "Version")
```

_Trivia: The reported problem is technically already 14 years old, as the comparison feature, relying on pre-2007 Word versions, was implemented back in 2008. And it looks like an undocumented change in the Microsoft's [_Document.Compare()](https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word._document.compare?view=word-pia) method._

**UPDATE:** Unfortunately, the problem seems to be hidden more in the core "comparison logic" which is inconsistent across the GUI. See e.g. [bug 516450](https://bugs.eclipse.org/bugs/show_bug.cgi?id=516450) for more details. For this bug, this means that it is quite possible that the diff is currently displayed incorrectly e.g. **just when comparing file versions from the History view** ("Compare with each other"). And this is caused by passing "left" and "right" versions into the Word comparator in different order from various GUI actions.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

org.eclipse.compare.internal.win32.WordComparison.createWorkingCopy(String baseDocument, String revisedDocument, String workingCopy) から始め、次に左側と右側のバージョンを Word comparator に渡す GUI の経路を調べます。既存の動作を TortoiseSVN's diff-doc.js および bug 516450 と比較します。完了の条件は、影響を受ける比較アクションが Word の各バージョンで正しい順序を使用することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
desktop
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。