-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oobranch c : ootext and rangesort #7788
Merged
Merged
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a50cc79
step0 : start model/openoffice, logic/openoffice/style
antalk2 d93bd56
correction: import order
antalk2 c9b72e9
add general utilities
antalk2 381a549
add UNO utilities, move CreationException, NoDocumentException
antalk2 f94c1f6
Xlint:unchecked model/openoffice/util
antalk2 f9a8176
add ootext
antalk2 6d013f1
add rangesort
antalk2 0434579
add compareStartsUnsafe, compareStartsThenEndsUnsafe
antalk2 3c45a8a
add Tuple3
antalk2 32f7a43
add ootext
antalk2 6bae6b4
add rangesort
antalk2 314902c
delNamesArray size correction
antalk2 dfe18bc
rangeSort update
antalk2 c9f4e57
Merge remote-tracking branch 'origin/oobranch-C' into oobranch-C
antalk2 6e4c7c2
cleanup
antalk2 66ac767
Merge remote-tracking branch 'upstream/main' into oobranch-C
antalk2 24375e9
ootext changes from improve-reversibility-rebased-03
antalk2 8c92db7
rangesort changes from improve-reversibility-rebased-03
antalk2 119149c
rangesort update from improve-reversibility-rebased-03
antalk2 91a3086
use longer lines in comments
antalk2 7533e8f
deleted src/main/java/org/jabref/model/openoffice/rangesort/RangeS…
antalk2 5fe0c36
use StringUtil.isNullOrEmpty
antalk2 65e1781
no natural sort for ComparableMark
antalk2 89f9aa6
in response to review
antalk2 373f467
use {@code }, PMD suggestions
antalk2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/main/java/org/jabref/gui/openoffice/CreationException.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/main/java/org/jabref/gui/openoffice/NoDocumentException.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/java/org/jabref/logic/openoffice/UndefinedBibtexEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...g/jabref/logic/openoffice/OOBibStyle.java → ...ef/logic/openoffice/style/OOBibStyle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...bref/logic/openoffice/OOPreFormatter.java → ...ogic/openoffice/style/OOPreFormatter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...abref/logic/openoffice/CitationEntry.java → ...abref/model/openoffice/CitationEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/main/java/org/jabref/model/openoffice/ootext/OOFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package org.jabref.model.openoffice.ootext; | ||
|
||
public class OOFormat { | ||
|
||
/** | ||
* Mark {@code s} as using a character locale known to OO. | ||
* | ||
* @param locale language[-country[-territory]] | ||
* | ||
* https://www.openoffice.org/api/docs/common/ref/com/sun/star/lang/Locale.html | ||
* | ||
* The country part is optional. | ||
* | ||
* The territory part is not only optional, the allowed "codes are | ||
* vendor and browser-specific", so probably best to avoid them if possible. | ||
* | ||
*/ | ||
public static OOText setLocale(OOText s, String locale) { | ||
return OOText.fromString(String.format("<span lang=\"%s\">", locale) + s.asString() + "</span>"); | ||
} | ||
|
||
/** | ||
* Mark {@code s} as using the character locale "zxx", which means | ||
* "no language", "no linguistic content". | ||
* | ||
* Used around citation marks, probably to turn off spellchecking. | ||
* | ||
*/ | ||
public static OOText setLocaleNone(OOText s) { | ||
return OOFormat.setLocale(s, "zxx"); | ||
} | ||
|
||
/** | ||
* Mark {@code s} using a character style {@code charStyle} | ||
* | ||
* @param charStyle Name of a character style known to OO. May be | ||
* empty for "Standard", which in turn means do not override any properties. | ||
* | ||
*/ | ||
public static OOText setCharStyle(OOText s, String charStyle) { | ||
return OOText.fromString(String.format("<span oo:CharStyleName=\"%s\">", charStyle) | ||
+ s.asString() | ||
+ "</span>"); | ||
} | ||
|
||
/** | ||
* Mark {@code s} as part of a paragraph with style {@code paraStyle} | ||
*/ | ||
public static OOText paragraph(OOText s, String paraStyle) { | ||
if (paraStyle == null || "".equals(paraStyle)) { | ||
antalk2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return paragraph(s); | ||
} | ||
String startTag = String.format("<p oo:ParaStyleName=\"%s\">", paraStyle); | ||
return OOText.fromString(startTag + s.asString() + "</p>"); | ||
} | ||
|
||
/** | ||
* Mark {@code s} as part of a paragraph. | ||
*/ | ||
public static OOText paragraph(OOText s) { | ||
return OOText.fromString("<p>" + s.asString() + "</p>"); | ||
} | ||
|
||
/** | ||
* Format an OO cross-reference showing the target's page number | ||
* as label to a reference mark. | ||
*/ | ||
public static OOText formatReferenceToPageNumberOfReferenceMark(String referencMarkName) { | ||
String s = String.format("<oo:referenceToPageNumberOfReferenceMark target=\"%s\">", | ||
referencMarkName); | ||
return OOText.fromString(s); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/main/java/org/jabref/model/openoffice/ootext/OOText.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.jabref.model.openoffice.ootext; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Text with HTML-like markup as understood by OOTextIntoOO.write | ||
* | ||
* Some of the tags can be added using OOFormat methods. Others come | ||
* from the layout engine, either by interpreting LaTeX markup or from | ||
* settings in the jstyle file. | ||
*/ | ||
public class OOText { | ||
|
||
private final String data; | ||
|
||
private OOText(String data) { | ||
Objects.requireNonNull(data); | ||
this.data = data; | ||
} | ||
|
||
/* null input is passed through */ | ||
k3KAW8Pnf7mkmdSMPHz27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public static OOText fromString(String s) { | ||
if (s == null) { | ||
return null; | ||
} | ||
return new OOText(s); | ||
} | ||
|
||
/* null input is passed through */ | ||
k3KAW8Pnf7mkmdSMPHz27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public static String toString(OOText s) { | ||
if (s == null) { | ||
return null; | ||
} | ||
return s.data; | ||
} | ||
|
||
public String asString() { | ||
return data; | ||
} | ||
|
||
/* Object.equals */ | ||
k3KAW8Pnf7mkmdSMPHz27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Override | ||
public boolean equals(Object o) { | ||
|
||
if (o == this) { | ||
return true; | ||
} | ||
|
||
if (!(o instanceof OOText)) { | ||
return false; | ||
} | ||
|
||
OOText c = (OOText) o; | ||
|
||
return data.equals(c.data); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return data.hashCode(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please no single character variables, better give it a more meaningful variable. Same applies for others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to
OOText ootext