Skip to content
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

CSL4LibreOffice - A [GSoC '24] #11477

Merged
merged 59 commits into from
Jul 15, 2024
Merged

CSL4LibreOffice - A [GSoC '24] #11477

merged 59 commits into from
Jul 15, 2024

Conversation

subhramit
Copy link
Collaborator

@subhramit subhramit commented Jul 10, 2024

Functionality to use CSL Style citations in OO/LO

Closes #8893
Closes #2146

[Part of GSoC '24 CSL4LibreOffice Project]

  • This PR adds the functionality to select, preview and use a CSL Style for the purpose of inserting bibliography or in-text citations via JabRef's OpenOffice/LibreOffice integration.

To insert a CSL Style Citation into the document:

  1. Open a library in JabRef
  2. Connect it to a running LibreOffice document instance (https://docs.jabref.org/cite/openofficeintegration)
  3. Press the "Select Style" button on the OpenOffice panel
  4. You will see the following window with two tabs, representing CSL Styles and JStyles. By default, the "CSL Styles" tab will be active. Select a CSL Style:
    image
  5. In the library, select an entry or a group of entries to cite
  6. Press "Cite" in the OO Panel to insert bibliography, or press "Cite in-text" to insert in-text citation

Follow-up: #11521

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • [ ] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@subhramit
Copy link
Collaborator Author

  • Feature wish: Double click on a CSL Style should select the style and close the dialog

image

Feature added.

@subhramit
Copy link
Collaborator Author

subhramit commented Jul 11, 2024

  • When I reopen the dialog "Style selection", the previously selected style should be selected.

This one seems slightly more complex. Planning on a separate PR for this.
Could @koppor or @LoayGhreeb outline some steps?
A slightly easier approach seems to be to render the title and preview of the last selected style in the Preview section below in the Style Select dialog, and then letting the user select it again. Would this suffice?

@LoayGhreeb
Copy link
Collaborator

  • When I reopen the dialog "Style selection", the previously selected style should be selected.

This one seems slightly more complex. Planning on a separate PR for this.

You can use the "Global Search window" as an example for this. Instead of creating a new dialog every time, you can create one dialog show and hide it. This approach will prevent losing the selection state.

checkout:

openGlobalSearchButton.setOnAction(evt -> {
globalSearchActive.setValue(true);
if (globalSearchResultDialog == null) {
globalSearchResultDialog = new GlobalSearchResultDialog(undoManager, tabContainer);
}
stateManager.activeGlobalSearchQueryProperty().setValue(searchQueryProperty.get());
updateSearchQuery();
dialogService.showCustomDialogAndWait(globalSearchResultDialog);
globalSearchActive.setValue(false);
});

@koppor
Copy link
Member

koppor commented Jul 11, 2024

You can use the "Global Search window" as an example for this. Instead of creating a new dialog every time, you can create one dialog show and hide it. This approach will prevent losing the selection state.

Nice. After restart of JabRef, the style should also be selected. I assume that that style to be used is stored in the preferences? Is it stored in LibreOffice only? I would put it into the preferences and based on that lookup it the table.

(Haven't looked into the code itself. Just assumptions. If I looked in the code I would search for: Where is the reference of the current style held. Where does the dialog put it? Can the dialog also read it from there? If not, where can it be persisted?)

@Siedlerchr
Copy link
Member

Current selected style should be stored in Open Office Preferences

@koppor koppor added this to the 6.0-alpha milestone Jul 15, 2024
@koppor
Copy link
Member

koppor commented Jul 15, 2024

Follow-up PR: subhramit#7

@koppor koppor enabled auto-merge July 15, 2024 19:24
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DevCall: This is OK to go through, JavaDoc for the OO thing is very optional (it was existing before). Let's focus on

a) the architecture (subhramit#7) and
b) preferences (should be done in the next days)

@koppor koppor added this pull request to the merge queue Jul 15, 2024
Merged via the queue into JabRef:main with commit 003587c Jul 15, 2024
23 checks passed
@koppor koppor mentioned this pull request Jul 15, 2024
6 tasks
@subhramit
Copy link
Collaborator Author

subhramit commented Jul 15, 2024

DevCall: This is OK to go through, JavaDoc for the OO thing is very optional (it was existing before). Let's focus on

a) the architecture (subhramit#7) and b) preferences (should be done in the next days)

Refinement for future reference: OO thing refers to possible tests of XTextDocument doc and XTextCursor cursor.
These tests would be dependent on description of these parameters, which would be added soon. However, since these parameters were existing already since OOBibStyle existed (pipeline to push JStyle bibliography into OO) and being used, the tests were deemed optional for our present purposes.

@subhramit
Copy link
Collaborator Author

subhramit commented Jul 15, 2024

DevCall: This is OK to go through, JavaDoc for the OO thing is very optional (it was existing before). Let's focus on

a) the architecture (subhramit#7) and b) preferences (should be done in the next days)

More context: The preferences storage feature subhramit#6 (b) is currently dependent on the architecture (a), so both of the above are coupled, hence we'll try to finish them both together [PR - B of the project].
c) A preliminary blog post to be written giving a walkthrough regarding how to use the current CSL Bibliography features.
d) Pending JavDoc documentation.

Siedlerchr added a commit to subhramit/jabref that referenced this pull request Jul 19, 2024
* upstream/main:
  Fix NPE when saving preferences (JabRef#11509)
  Switch to stream-based loading (JabRef#11479)
  Save unlinked local files dialog prefs (JabRef#11493)
  Add minimal support for biblatex data annotations (JabRef#11506)
  Fix handling of relative-file storage and auto linking (JabRef#11492)
  New Crowdin updates (JabRef#11504)
  Add missing issue numbers
  CSL4LibreOffice - A [GSoC '24] (JabRef#11477)
  Bump src/main/resources/csl-styles from `b2be5ae` to `fd6cb3e` (JabRef#11501)
  Bump gittools/actions from 1.1.1 to 1.2.0 (JabRef#11500)
  Bump com.kohlschutter.junixsocket:junixsocket-core from 2.9.1 to 2.10.0 (JabRef#11498)
  Bump commons-logging:commons-logging from 1.3.2 to 1.3.3 (JabRef#11499)
  Bump org.jsoup:jsoup from 1.17.2 to 1.18.1 (JabRef#11497)
  Bump com.kohlschutter.junixsocket:junixsocket-mysql from 2.9.1 to 2.10.0 (JabRef#11496)
  Bump org.openrewrite.recipe:rewrite-recipe-bom from 2.14.0 to 2.15.0 (JabRef#11495)
  FAQ updates (JabRef#11486)
  Update Gradle Wrapper from 8.8 to 8.9.
  Fix Chocolate.bib (JabRef#11491)

# Conflicts:
#	src/main/java/org/jabref/gui/openoffice/OOBibBase.java
#	src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
#	src/main/java/org/jabref/gui/openoffice/StyleSelectDialogView.java
#	src/main/java/org/jabref/gui/openoffice/StyleSelectDialogViewModel.java
#	src/main/java/org/jabref/preferences/JabRefPreferences.java
@subhramit subhramit mentioned this pull request Jul 21, 2024
6 tasks
@subhramit
Copy link
Collaborator Author

Follow-up PR: #11521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants