From 345d5c3a52f46ba4fe3673f9b775367a7fa54bbc Mon Sep 17 00:00:00 2001 From: Hylke van der Schaaf Date: Sat, 8 Feb 2020 06:32:18 +0100 Subject: [PATCH] =?UTF-8?q?Addresses=20#10,=20Copy=20page=20number=20area?= =?UTF-8?q?=20to=20a=20new=20text=20area=20in=20the=20sa=E2=80=A6=20(#31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ExpandAnimations.bas | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/ExpandAnimations.bas b/src/ExpandAnimations.bas index 54303ef..8912e87 100644 --- a/src/ExpandAnimations.bas +++ b/src/ExpandAnimations.bas @@ -136,6 +136,14 @@ function expandDocument(doc as Object, oStatusBar as Object) ' go through pages in reverse order for i = numSlides-1 to 0 step -1 slide = doc.drawPages(i) + if slide.IsPageNumberVisible then + fixateSlideNumber(doc, slide, i+1, numSlides) + end if + ' If the slide name is pageXXn it is an autogenerated name + ' It is impossible to name a slide "Slide XX", but "Slide: XX" works + if Left(slide.Name, 4) = "page" then + slide.Name = "Slide: " & CStr(i+1) + end if oStatusBar.setValue(numSlides-i) if hasAnimation(slide) then n = countAnimationSteps(slide) @@ -157,7 +165,27 @@ function expandDocument(doc as Object, oStatusBar as Object) ' saving the expanded version doc.store() +end function +function fixateSlideNumber(doc as Object, slide as Object, slideNr as Integer, slideCount as Integer) + master = slide.MasterPage + shapeCount = master.getCount() + for shapeNr = 0 to shapeCount-1 + shape = master.getByIndex(shapeNr) + shapeType = shape.getShapeType() + if shapeType = "com.sun.star.presentation.SlideNumberShape" then + copy = doc.createInstance("com.sun.star.drawing.TextShape") + 'Call Tools.WritedbgInfo(shape) + slide.IsPageNumberVisible = False + slide.add(copy) + copy.setString(CStr(slideNr) & " / " & CStr(slideCount)) + copy.Style = shape.Style + copy.Text.Style = shape.Text.Style + copy.Position = shape.Position + copy.Size = shape.Size + copy.TextVerticalAdjust = shape.TextVerticalAdjust + end if + next end function function somethingWrong( slide as Object )