Calendar date extension for Calc - Update to version 2.60

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
ggeerits
Posts: 10
Joined: Wed Aug 06, 2008 1:08 pm
Location: Belgium

Calendar date extension for Calc - Update to version 2.60

Post by ggeerits »

 Edit: This topic is a continuation of two earlier topics:
Example: Calendar date selection dialog
Update for Calendar.ods
-- MrProgrammer, forum moderator 
The Calendar.ods spreadsheet has been replaced with an extension:

- OpenOffice:
ggCalendar-260-OO.oxt
(43.85 KiB) Downloaded 285 times
- LibreOffice:
ggCalendar-260-LO.oxt
(48.73 KiB) Downloaded 277 times
Calendar Help is located in the help menu of OpenOffice / LibreOffice

Version 2.60
- Change and save settings.
- Frame around date in calendar when mouse hovers over them.
- Remove all date buttons at once (created since version 2.60).
- Make a choice via menu Tools - Add-Ons.

Version 2.50
- If the cell already contains a date, the date picker will open with the existing date, otherwise with the current date
(only for cells associated with date buttons and one or more selected cells in a continuous range).
- It is possible to change the year by 1 or 10 years forward or backwards. The year can also be entered.
- The months can also be selected from a list.
- It is no longer possible to place multiple buttons on 1 cell.

Toolbar buttons:
- Date: the date will be inserted in the selected cell / cells.
- Date <-Button: A button is created in the selected cell, the date is inserted in the cell to the left of the button.
- Button-> Date: A button is created in the selected cell, the date is inserted in the cell to the right of the button.

The calendar automatically places itself under the button.

Install the extension with the Extension Manager.
Last edited by ggeerits on Mon Jun 21, 2021 12:13 pm, edited 5 times in total.
OpenOffice 4.1.10 and LibreOffice 7.1.3.2 on Windows 10 Pro
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Calendar extension

Post by JohnSUN-Pensioner »

You should add a check after each .getCurrentSelection. Current Selection does not have to be a cell or a range. It can be, for example, a graphic element on a sheet. See chapter 6.5. Selected text, what is it?
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
User avatar
Villeroy
Volunteer
Posts: 31270
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Calendar extension

Post by Villeroy »

There is always one active cell for a controller independently from the current selection:

Code: Select all

Function getActiveCell(oView)
Dim as1(), lSheet&,lCol&,lRow$, sDum as String,bErr as Boolean
   as1()  = Split(oView.ViewData, ";")
   lSheet = CLng(as1(1))
   sDum = as1(lSheet +3)
   as1() = Split(sDum, "/")
   on error goto errSlash
      lCol = CLng(as1(0))
      lRow = CLng(as1(1))
   on error goto 0
   getActiveCell = oView.Model.getSheets.getByIndex(lSheet).getcellByPosition(lCol,lRow)
exit Function
errSlash:
   if NOT(bErr) then
      bErr = True
      as1() = Split(sDum, "+")
      resume
   endif
End Function
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Calendar extension

Post by JohnSUN-Pensioner »

Yes, but Geert Geerits announced that the date will also be inserted into the range of selected cells.

By the way, more than 10 years have passed since you posted this code on this forum (and UROS published it even earlier), and the getActiveCell method did not appear in the API. (It's already been 10 years ?! :shock: )
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
User avatar
Villeroy
Volunteer
Posts: 31270
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Calendar extension

Post by Villeroy »

I posted the function 13 years ago to this forum copied from the old oooforum.org. It might be 15 or 16 years old.

May this snippet help to write a bullet proof selection macro:

Code: Select all

view = ThisComponent.getCurrentController()
oSel = view.getSelection()
If oSel.supportsService("com.sun.star.sheet.SheetCellRanges") then
	oEnum = oSel.createEnumeration()
ElseIf oSel.supportsService("com.sun.star.sheet.SheetCellRange") then
	oEnum = oSel.queryIntersection(oSel.getRangeAddress).createEnumeration()
else
	oSel = getActiveCell(view)
	oEnum = oSel.queryIntersection(oSel.getRangeAddress).createEnumeration()
endif
while oEnum.hasMoreElements()
	oNext = oEnum.nextElement()
	' do_stuff
wend
If the selection is a multiple range selection, create an enumeration of single ranges.
If it is a single range, create an enumeration with this range as only member.
If it is not anything like that (an object selection), get the active cell and create an enumeration with this range as only member.
Then loop throught the enumeration calling working routine.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Bidouille
Volunteer
Posts: 574
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: Calendar extension

Post by Bidouille »

Hello,

I suggest some enhancements. :)
Text localisation is not effective on tooltip buttons and "Today" button.
These 3 buttons on toolbar are not present as items in Insert menu
When I hit "Date" button on a cell contains a specific date, dialogbox not remains this date (always on today's date).
Last edited by Bidouille on Thu Jun 03, 2021 1:51 pm, edited 1 time in total.
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Calendar extension

Post by JohnSUN-Pensioner »

Yes, and this is not the only remark. Perhaps they should be collected in one place - either here or there.
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
Bidouille
Volunteer
Posts: 574
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: Calendar extension

Post by Bidouille »

We must be sign in to do this :(

And this thread should be moved in dedicated section ;)
 Edit: Done on 2021-06-06 by MrProgrammer 
ggeerits
Posts: 10
Joined: Wed Aug 06, 2008 1:08 pm
Location: Belgium

Re: Calendar date extension for Calc

Post by ggeerits »

There is an update of the date-picker calendar to version 2.50.
See the first message.
OpenOffice 4.1.10 and LibreOffice 7.1.3.2 on Windows 10 Pro
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Calendar date extension for Calc - Update to version 2.5

Post by JohnSUN-Pensioner »

Yes, that's much better.
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Calendar date extension for Calc - Update to version 2.5

Post by JeJe »

What I do with these things is use the mouse inside event to position a frame around (or other method of indication) to show which date is going to be clicked on.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
ggeerits
Posts: 10
Joined: Wed Aug 06, 2008 1:08 pm
Location: Belgium

Re: Calendar date extension for Calc - Update to version 2.5

Post by ggeerits »

JeJe wrote:What I do with these things is use the mouse inside event to position a frame around (or other method of indication) to show which date is going to be clicked on.
Thanks for the tip.
There is an update to version 2.60.
OpenOffice 4.1.10 and LibreOffice 7.1.3.2 on Windows 10 Pro
Post Reply