-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### General - Migrated from Bitbucket to GitHub - Dark mode using FlafLaf 1.0 - Added Applet that allows to start Joeffice embedded in any software accepting applets ### Word Processor - Created component not dependant of NetBeans Platform that can be embedded in other Java application - Use paragraph style for attributes not defined on text - Use a default font (instead of previously used font) when no font is defined - Scale fonts to 96/72 for Windows ### Spreadsheet - Fixed missing background color for spreadsheets - Fixed copy values of cells when the cell has a formula - Added option to limit the size of the sheet up to the filled in cell - Made SheetComponent independant of SpreadsheetComponent - Scale fonts to 96/72 for Windows ### Presentation - Fixed position and size of images in slide
- Loading branch information
Showing
33 changed files
with
628 additions
and
216 deletions.
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
79 changes: 79 additions & 0 deletions
79
Desktop/src/org/joeffice/desktop/actions/EditorFindable.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,79 @@ | ||
/* | ||
* Copyright 2023 Japplis. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.joeffice.desktop.actions; | ||
|
||
import static java.awt.font.TextAttribute.*; | ||
import static org.joeffice.desktop.actions.ExtraTextAttribute.*; | ||
import static javax.swing.text.StyleConstants.*; | ||
|
||
import java.text.AttributedCharacterIterator; | ||
import java.text.AttributedCharacterIterator.Attribute; | ||
import java.text.AttributedString; | ||
import java.util.EnumSet; | ||
import java.util.Enumeration; | ||
|
||
import javax.swing.JTextPane; | ||
import javax.swing.text.*; | ||
|
||
import org.joeffice.desktop.ui.Findable; | ||
|
||
/** | ||
* Class that applies the style to the editor. | ||
* | ||
* This involves converting the {@link AttributedString} to an {@link AttributeSet} and vice versa. | ||
* | ||
* @author Anthony Goubard - Japplis | ||
*/ | ||
public class EditorFindable implements Findable { | ||
|
||
private JTextPane textPane; | ||
private int position = 0; | ||
private String lastSearch; | ||
private EnumSet<FindOption> lastOptions; | ||
|
||
public EditorFindable(JTextPane textPane) { | ||
this.textPane = textPane; | ||
} | ||
|
||
@Override | ||
public boolean find(String search, EnumSet<FindOption> options) { | ||
lastSearch = search; | ||
lastOptions = options; | ||
return find(0); | ||
} | ||
|
||
private boolean find(int fromPosition) { | ||
try { | ||
String text = textPane.getDocument().getText(0, textPane.getDocument().getLength()); | ||
position = find(text, lastSearch, fromPosition, lastOptions); | ||
if (position != -1) { | ||
textPane.setCaretPosition(position); | ||
} | ||
return position != -1; | ||
} catch (BadLocationException ex) { | ||
return false; | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public boolean findNext(boolean forward) { | ||
if (position == textPane.getCaretPosition()) { | ||
position++; | ||
} | ||
return find(position); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.joeffice.desktop.ui; | ||
|
||
import java.util.EnumSet; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* Interface for finding text within the document. | ||
* | ||
* @author Anthony Goubard - Japplis | ||
*/ | ||
public interface Findable { | ||
|
||
public enum FindOption {MATCH_CASE, WHOLE_WORD, REG_EXP}; | ||
|
||
boolean find(String search, EnumSet<FindOption> options); | ||
|
||
boolean findNext(boolean forward); | ||
|
||
default int find(String text, String search, int from, EnumSet<FindOption> options) { | ||
if (options.contains(FindOption.MATCH_CASE) && options.size() == 1) { | ||
return text.indexOf(search, from); | ||
} | ||
String searchRegExp = search; | ||
if (!options.contains(FindOption.REG_EXP)) { | ||
searchRegExp = search.replaceAll("[\\$\\^\\.\\?\\[\\{]", "\\$1"); | ||
} | ||
if (options.contains(FindOption.WHOLE_WORD)) { | ||
searchRegExp = "\\b" + searchRegExp + "\\b"; | ||
} | ||
if (!options.contains(FindOption.MATCH_CASE) && !search.contains("(?i)")) { | ||
searchRegExp = "(?i)" + searchRegExp; | ||
} | ||
String searchText = text.substring(from); | ||
Pattern searchPattern = Pattern.compile(searchRegExp); | ||
Matcher searchMatcher = searchPattern.matcher(searchText); | ||
if (searchMatcher.find()) { | ||
return from + searchMatcher.start(); | ||
} | ||
return -1; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ Joeffice modules and file extensions supported: | |
* Database (h2) | ||
|
||
Joeffice uses the following libraries: | ||
* The NetBeans Platform (12.3) https://netbeans.org/features/platform/ | ||
* The NetBeans Platform (16) https://netbeans.org/features/platform/ | ||
* Apache POI (5.0.0) https://poi.apache.org/ | ||
* H2 Database (1.4.200) https://www.h2database.com/ | ||
* Batik (included in Apache POI) https://xmlgraphics.apache.org/batik/ | ||
|
@@ -33,17 +33,20 @@ What are the advantages compared to Microsoft Office: | |
* Window docking of documents in the application | ||
* Can be included in your company Java applications (Apache License) | ||
|
||
TODO | ||
### TODO | ||
* Recent files | ||
* Macro system (Edit -> Macro) | ||
* Fix actions | ||
* @ActionState | ||
* Fails on Java 16 (NetBeans framework exceptions thrown) | ||
|
||
How to contribute: | ||
### How to contribute: | ||
* There are a few FIXME in the code | ||
* Submit merge request | ||
* For large contributions, sign the contributor license agreement which stays that you and your company donate the code to this project. | ||
|
||
For feature requests: | ||
### Sponsors | ||
* [Japplis](https://www.japplis.com) _better tools, better jobs_ | ||
|
||
### For feature requests: | ||
* Contact [email protected] |
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
Oops, something went wrong.