customize color palette in LibreOffice

You can create a your own palette file,

  • with .soc extension
  • and with a content like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ooo:color-table xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ooo="http://openoffice.org/2004/office">
<draw:color draw:name="panna" draw:color="#faf7d2"/>
<draw:color draw:name="mattone" draw:color="#bc5a1f"/>
<draw:color draw:name="OldLace" draw:color="#FDF5E6"/>
<draw:color draw:name="Cornsilk" draw:color="#FFF8DC"/>
</ooo:color-table>
  • then you have to put it (also as symlink) in /libreoffice/share/palette.

You will be able to choose that palette (with the same name of the file .soc), and you will be able to use your preferred colors highlighting words in LibreWriter, for example.

ancient greek in LibreOffice

Some days ago I wrote this: 

a simple maquillage, unfortunately

I mean ancient greek font so that you can, typing ‘a’ get immediatly ‘α’. So far the free most interesting true type font (the only recognised by LibreOffice) is SPIonic.

You can see more details here

With this font you can tranform the word “Nomos” in “Nomov“, with few mouse clics (basically with the font menu, even though in this case you have to convert the final sigma as well). 

caveat

Absolutely to avoid the “AncientGreek” extension: cumbersome, useless and very aggressive (after removing leaves you with modified shortcuts, including some basic like ctrl + z, ctrl + b and F3).Vey bad!

 a new solution

I noticed that the above solution works only within LibreOffice: if you copy a greek word in another program, you get a no-greek text (with latin encoding). That’s why I call it now a maquillage.
A possible, better solution is go to a website that easyly encode your text in ancient greek, such as this.

embed database data in odt file

 the problem

In odt it is possible to insert some database data as fields in a odt file, but when you change data in phpmyadmin I get
1) a correct update in the data source view above the text,
2) not in the odt file (body: where
are the fields): the fields texts remain unchanged, even after doing the
command “update fields” (both from menu and from keyboard: F9, or
shift+ctrl+F9).

a solution

A workaround is to use insert – section to insert a part of a php file via localhost.

  1. you will see in your odt file the content of the (section=div, of the) php file, as in the picture following:
    image description
  2. insert -> section -> link -> file name “http://localhost/[path]/[filename].php” -> section (the “id” name you have chosen in php file, i.g. inserting a <div id=”biblio”>[php/mysql code]</div> the section name will “biblio”)

Of course, you must previously

  • activate a php/mysql server in local
  • and possibly have some knowledge of html/php source code.

share (embedding) text between odt documents (librewriter)

Impossible use cross-reference or dde-link for more than a paragraph.
So the only way (to share more than a paragraph) are sections:

  1. define the area you want share in the file A as a bookmark;
  2. in the file B insert -> section -> as link – choose the file and the bookmark
  3. the text boormarked in A will be visible in B

n.b.
It is not necessary a master document.

cambiare formattazione ai campi in LibreOffice

Change style in fields:
I campi in LibreWriter, a mio parere, hanno di default uno sfondo troppo scuro, che rende difficile la leggibilità del testo. Per cui si può modificarne lo sfondo, come segue:

Modify option Field Shadings in Option -> Tools -> LibreOffice -> Application Colors -> Cat: Text Document according to you preferred color (light grey, f.e.).

LibreWriter macro per aprire un documento nel punto in cui lo si è chiuso

Si possono creare due macro:
Con la prima (qui) creiamo un segnalibro nel punto in cui siamo arrivati, il segnalibro “qui”, e questa macro la assegnamo automaticamente al salvataggio di un documento.
Con la seconda (vai_qui) andiamo esattamente al punto in cui avevamo chiuso il documento, e questa macro la assegniamo alla apertura di un documento. Abbiamo dovuto duplicare le istruzioni, altrimenti, nei documenti lunghi il cursore andava sì nel pyunto dove c’è il segnalibro, ma il focus restava su un’altra porzione del documento. Invece così va tutto a posto.

1a macro

sub qui
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Bookmark"
args1(0).Value = "qui"

dispatcher.executeDispatch(document, ".uno:DeleteBookmark", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Bookmark"
args2(0).Value = "qui"

dispatcher.executeDispatch(document, ".uno:InsertBookmark", "", 0, args2())

end sub

2a macro

sub vai_qui

If NOT ThisComponent.supportsService("com.sun.star.text.TextDocument" ) Then
   Exit Sub  
End If

oBookmarks = ThisComponent.getBookmarks()
If NOT oBookmarks.hasByName("qui") Then
   Exit Sub  
End If

ViewCursor = ThisComponent.CurrentController.getviewCursor()
Bookmark = ThisComponent.Bookmarks.getByName("qui").Anchor
ViewCursor.gotorange(Bookmark, False)

ViewCursor = ThisComponent.CurrentController.getviewCursor()
Bookmark = ThisComponent.Bookmarks.getByName("qui").Anchor
ViewCursor.gotorange(Bookmark, False)

end sub