How to alphabetize slides?

Discuss the presentation application
Post Reply
highlife66
Posts: 4
Joined: Fri Apr 20, 2018 9:41 pm

How to alphabetize slides?

Post by highlife66 »

Hello, is it possible to alphabetize slides, I use them for a lyric monitor. THX!
OpenOffice 4.1.5 on Windows 10 pro
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to alphabetize slides?

Post by Zizi64 »

is it possible to alphabetize slides, I use them for a lyric monitor.
What you want to do really? Please give us some more details.

- Do you want to sort the slides?
- Or you want name the slides by letters or by words?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
highlife66
Posts: 4
Joined: Fri Apr 20, 2018 9:41 pm

Re: How to alphabetize slides?

Post by highlife66 »

Hi Zizi,
thank you for responding, yes, I would like to sort each individual slide. Each slide contains lyrics to one song and the title is at the top of the page. Is there a way to alphabetize each single slide?
OpenOffice 4.1.5 on Windows 10 pro
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to alphabetize slides?

Post by Zizi64 »

Hi Zizi,
thank you for responding, yes, I would like to sort each individual slide. Each slide contains lyrics to one song and the title is at the top of the page. Is there a way to alphabetize each single slide?
Maybe you can operate with some macros, but - I think - it is not an Impress related task.

Are the titles individual label objects in the slides (or they are parts only of the full text)? Can you upload an ODF type sample file hare?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
highlife66
Posts: 4
Joined: Fri Apr 20, 2018 9:41 pm

Re: How to alphabetize slides?

Post by highlife66 »

here is a test file...
Attachments
mastersongfile.odp
(20.55 KiB) Downloaded 222 times
OpenOffice 4.1.5 on Windows 10 pro
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to alphabetize slides?

Post by Zizi64 »

I would like to sort each individual slide. Each slide contains lyrics to one song and the title is at the top of the page. Is there a way to alphabetize each single slide?
I can see only one object on each sheet. There is not separated Title object and Text object on the slides. And the those different structures in the Titles...:
- Number - Letter
- Number - Space - Letter
It will be too difficult to alphabetize (to sort) the slides based on their contents...
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
highlife66
Posts: 4
Joined: Fri Apr 20, 2018 9:41 pm

Re: How to alphabetize slides?

Post by highlife66 »

Is this better? two separate text boxes for title and lyrics.
Attachments
test.odp
(19.84 KiB) Downloaded 230 times
OpenOffice 4.1.5 on Windows 10 pro
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to alphabetize slides?

Post by Zizi64 »

Yes, it is better.
Now you can get the text of the title shapes by your macro. You can find them the by the Name of theirs Style: 'title'. (The style name of the other shapes are 'subtitle'.) Then you can get the String of the shape.

But this is the first step only. You must continue the thinking about the sorting of the title strings, and about the re-sorting of the related Slides.

Here is a sample file with a macro subroutine: how to list all of the Titles in an Impress document:
Test_with_macro_and_customized_menu_byZizi64.odp
(23.42 KiB) Downloaded 238 times


Created and tested in my LibreOffice 5.4.6, and it was tested in my AOO 4.1.5 portable version.
Click on the (only one) item named 'List_Titles' of the new Menu named 'MyMacros'

the embedded macro code:

Code: Select all

REM  *****  BASIC  *****

Option explicit



Sub List_Titles

 Dim oDoc As Object
 Dim oSlides As object
 Dim oSlide as object
 Dim oShape as Object
 Dim oShapeStyle
 
 Dim iSlideCount as Integer
 Dim iSlideNumber as integer
 Dim iShapeCount
 Dim iShapeNumber

 Dim sTitleList as string
 
'loadxray

	oDoc = ThisComponent
    
	'xray oDoc
	oSlides = oDoc.getDrawPages
    iSlideCount = oSlides.count
    for iSlideNumber = 0 to iSlideCount-1
		oSlide = oSlides.getbyindex(iSlideNumber)
		'xray oSlide
		For iShapeNumber = 0 to  iShapeCount-1
			oShape = oSlide.getByIndex(iShapeNumber)
			'Xray oShape
			oShapeStyle = oShape.Style
			'print oShapeStyle.name
			If oShapeStyle.name = "title" then 
				sTitleList = sTitleList + oShape.String + Chr(13)
				'print oShape.String
			end if
		next iShapeNumber
	next iSlideNumber  

 MsgBox(sTitleList, 0, "List of the Titles:")
End Sub
Please download, install and use one of the object inspection tools like the MRI or the XrayTool - if you want create more macros. These tools can list the properties, methods, ...etc. of the programming objects. The commands related to the Xray tool or to the simple displaying method (print) are REM-ed in my samle code by an apostrophe sign.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to alphabetize slides?

Post by Zizi64 »

Last edited by Zizi64 on Sat Apr 28, 2018 3:04 pm, edited 3 times in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to alphabetize slides?

Post by Zizi64 »

Here is a sample code, how to aplhabetize some strings (the Titles in your case):
https://wiki.openoffice.org/wiki/Sorting_and_searching
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to alphabetize slides?

Post by Zizi64 »

There is a great feature in the Impress: You can set a User defined order of the slides the a custom slideshow. And you can control this feature by macros. It will not sort the slides in the file, it will create a sorted custom playlist only.
Here is an example. Just click on the user defined menu named 'MyMacros' and click on the only one item named 'Create_Sorted_SlideShow'. The macro will create a Custom slideshow based on the alphabetic order of the Titles:
Zizi64_Start_SlideShow_in_CustomOrder2.odp
(28.32 KiB) Downloaded 240 times
The macro code (it was created based on the examples of the lenked topics above, and based on KovLev's combined sort routine:

Code: Select all

REM  *****  BASIC  *****

Option explicit


Sub Create_Sorted_SlideShow

 Dim oDoc as object
 Dim oDrawPages as object
 Dim oCustPresentations as object
 Dim oMyCustPres as object
 Dim oPresentation as object
 Dim oNewPresentation as object
 Dim oActualSlide as object
 
 Dim iSlideCount as integer
 Dim iCount as integer
 Dim i as integer
 
'loadxray

	oDoc = ThisComponent
	oDrawPages = oDoc.getDrawPages
	iSlideCount = oDrawPages.Count

 Dim vTitleList(iSlideCount-1) as String
 Dim vSortedTitleIndex(iSlideCount-1) as Integer
	
	For i = 0 to iSlideCount-1
		vSortedTitleIndex(i) = i
	next i
	vTitleList = Get_Slide_Titles(oDoc)
	SortStringArray(vTitleList, vSortedTitleIndex)
	oCustPresentations = oDoc.getCustomPresentations()

	If oCustPresentations.hasByname("SortedSlides") Then
		oMyCustPres = oCustPresentations.getByName("SortedSlides")
		iCount = oMyCustPres.Count
		
		If iCount > 0 then

			For i = 0 to iCount-1
				oMyCustPres.removeByIndex(0)
			next i
		End if
	Else
		oNewPresentation = oCustPresentations.createInstance()   '"com.sun.star.presentation.CustomPresentation")
		oCustPresentations.insertByName("SortedSlides", oNewPresentation)
		oMyCustPres = oCustPresentations.getByName("SortedSlides")
	end if

	iCount = oMyCustPres.Count
	If iCount > 0 then
		For i = 0 to iCount -1
			oMyCustPres.removeByIndex(0)
		next i
	end if
	
	For i = 0 to iSlideCount-1
		oActualSlide = oDrawPages.getByIndex(vSortedTitleIndex(i))
		oMyCustPres.insertByIndex(i, oActualSlide)
	next i

	oPresentation = oDoc.Presentation
	oPresentation.CustomShow = "SortedSlides"
	oPresentation.Start()

end sub
'________________________________________________________________


Function Get_Slide_Titles(Optional oPassedDoc as object) as Variant

 Dim oDoc As Object
 Dim oSlides As object
 Dim oSlide as object
 Dim oShape as Object
 Dim oShapeStyle
 
 Dim iSlideCount as Integer
 Dim iSlideNumber as integer
 Dim iShapeCount
 Dim iShapeNumber

	If isMissing(oPassedDoc) then 
		oDoc = ThisComponent
	else
		oDoc = oPassedDoc	
	end if
    
	oSlides = oDoc.getDrawPages
	iSlideCount = oSlides.count
	
 Dim TheResultArray(iSlideCount-1) as String
 
    for iSlideNumber = 0 to iSlideCount-1
		oSlide = oSlides.getbyindex(iSlideNumber)
		for iShapeNumber = 0 to  iShapeCount-1
			oShape = oSlide.getByIndex(iShapeNumber)
			oShapeStyle = oShape.Style
			If oShapeStyle.name = "title" then 

				TheResultArray(iSlideNumber) = oShape.String
			end if
		next iShapeNumber
	next iSlideNumber  
 
 Get_Slide_Titles = TheResultArray
End function
'________________________________________________________________


sub SortStringArray(myArray as variant, myIntArray as variant)
 
 dim h as integer 
 dim i as integer
 dim j as integer
 dim t as string
 dim iUb as integer
 dim iLb as integer

	iLb = lBound(myArray)
	iUb = uBound(myArray)
	
	for i = iUb to iLb step -1
		for j = 0 to i - 1 step 1
			if strComp(myArray(i), myArray(j), 0) < 1 then
				t = myArray(i)
				h = myIntArray(i)
				myArray(i) = myArray(j)
				myIntArray(i) = myIntArray(j)
				myArray(j) = t
				myIntArray(j) = h
			end if
		next j
	next i
end sub
'________________________________________________________________
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply