Implement a new function to use in Writer's textfields

I have recently implemented a function that returns the value in full of a number. For example, for $ 3.45 the function returns me the string: “three dollars and forty-five cents”.
I was able to make this function available in Calc (“com.sun.star.sheet.AddIn”), where it works perfectly.
Now I would like to know how to increment the set of functions available in Writer to include this new function so that I can use it along with textfields.
Does anyone know how to do this? By the way, where did the functions available in Writer for textfields were implemented?

Could you please explain “the functions available in Writer for textfields”? I thought functions are only possible in table cells. The functions available in table cells are in http://opengrok.libreoffice.org/xref/core/sw/source/core/bastyp/calc.cxx