Skip to content

Commit

Permalink
feat(slideshow) : #MAG-544 add description slide (#393)
Browse files Browse the repository at this point in the history
Co-authored-by: Florent Mariotti <[email protected]>
  • Loading branch information
FlorentMr and Florent Mariotti authored Feb 27, 2025
1 parent 6a15457 commit 8d39fd8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ public class Slideshow {
public static final int MARGIN_LEFT = 140;
public static final int MARGIN_TOP_TITLE = 40;
public static final int WIDTH = 1000;
public static final String DEFAULT_FONT = "Roboto";
public static final int SLIDE_HEIGHT = 720;
public static final int SLIDE_WIDTH = 1280;

// Constantes pour les titres
public static final int TITLE_HEIGHT = 70;
public static final Double TITLE_FONT_SIZE = 44.0;
public static final int DESCRIPTION_TITLE_HEIGHT = 75;
public static final Double DESCRIPTION_TITLE_FONT_SIZE = 55.0;
public static final int MAIN_TITLE_HEIGHT = 100;
public static final Double MAIN_TITLE_FONT_SIZE = 100.0;

Expand All @@ -27,6 +30,7 @@ public class Slideshow {
public static final int CONTENT_MARGIN_TOP = 140;
public static final int MAIN_CONTENT_MARGIN_TOP = 300;
public static final Double CONTENT_FONT_SIZE = 36.0;
public static final Double DESCRIPTION_FONT_SIZE = 24.0;

// Constantes pour les images
public static final int MAIN_IMAGE_CONTENT_HEIGHT = 400;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ private Future<XMLSlideShow> createFreeLayoutSlideObjects(Board board, UserInfos

SlideFactory slideFactory = new SlideFactory();

//DESCRIPTION
XSLFSlide descriptionApacheSlide = createDescriptionSlide(board, i18nHelper);
ppt.createSlide().importContent(descriptionApacheSlide);

// Utiliser l'ordre des cartes du Board
for (Card boardCard : board.cards()) {
String cardId = boardCard.getId();
Expand Down Expand Up @@ -273,6 +277,25 @@ private XSLFSlide createTitleSlide(XSLFSlide newTitleSlide, Board board, List<Ma
return newTitleSlide;
}

private XSLFSlide createDescriptionSlide(Board board, I18nHelper i18nHelper) {
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();

SlideHelper.createTitle(slide, i18nHelper.translate("magneto.create.board.description"),
Slideshow.DESCRIPTION_TITLE_HEIGHT, Slideshow.DESCRIPTION_TITLE_FONT_SIZE, TextParagraph.TextAlign.LEFT);

XSLFTextBox textBox = SlideHelper.createContent(slide);

XSLFTextParagraph paragraph = textBox.addNewTextParagraph();
paragraph.setTextAlign(TextParagraph.TextAlign.LEFT);
XSLFTextRun textRun = paragraph.addNewTextRun();
textRun.setText(board.getDescription());
textRun.setFontSize(Slideshow.DESCRIPTION_FONT_SIZE);
textRun.setFontFamily(Slideshow.DEFAULT_FONT);

return slide;
}

private Slide createSlideFromCard(Card card, SlideFactory slideFactory, JsonObject slideShowData,
List<Map<String, Object>> documents) {
SlideProperties.Builder propertiesBuilder = new SlideProperties.Builder()
Expand Down

0 comments on commit 8d39fd8

Please sign in to comment.