Contents

# Барномасозии Васлак дар LibreOffice Calc

Методи мукаммалкунии Calc Бо васлак, ки дар ин ҷой оварда шудааст кӯҳна мебошад. Интерфейсҳо ҳоло ҳам кор мекунанд ба хотири мувофиқат ба гузашта, вале барои барномасозии Васлакҳои нав шумо бояд Функтсияҳои APIро истифода баред.

LibreOffice Calc can be expanded by Add-Ins, which are external programming modules providing additional functions for working with spreadsheets. These are listed in the Function Wizard in the Add-In category. If you would like to program an Add-In yourself, you can learn here which functions must be exported by the shared library external DLL so that the Add-In can be successfully attached.

LibreOffice searches the Add-in folder defined in the configuration for a suitable shared library DLL. To be recognized by LibreOffice, the shared library DLL must have certain properties, as explained in the following. This information allows you to program your own Add-In for Function Wizard of LibreOffice Calc.

## Консептсияи Васлак

Ҳар як китобхонаи Васлак якчанд функтсия дорад. ,Баъзе функтсияҳо барои идоракунӣ мебошанд. Шумо метавонед қариб тамони номро барои васлакатон истифода кунед. Ба ҳар ҳол онҳо бояд чанд қоидаро риоя кунанд. Номгузорӣ дар ҳар платформа дигар хел мебошад.

### Functions of Shared Library AddIn DLL

Ҳадди ақал функтсияҳои административии GetFunctionCount and GetFunctionData вуҷуд дошта бошанд. Бо ин васила функтсияҳо, параметрҳои онҳо муайян карда мешавад. Арзиши баргардандаи Double ва String дастгири шудааст. Ҳамчун параметр, диапазони чашмак массиви Double , массиви String , and массиви Чашмак дастгири шудаанд.

Параметрҳо ба воситаи ҳаволаҳо гузошта мешаванд. Вале, ин дар LibreOffice Calc дастгирӣ нашудааст.

Китобхонаҳо дар вақти иҷроиш бор карда шуда ва бо функтсияҳои административӣ тафтиш карда мешаванд.

Функтсияҳо синхронӣ даъвад шуда натиҷаашон маълум мегарданд. Функтсияҳои асихронӣ низ имкон доранд; вале онҳо муфассал шарҳ дода нашудаанд аз сабаби мураккабӣ.

## Маълумоти умумӣ оиди интерфейс

Шумораи максималии параметрҳо дар LibreOffice Calc 16 аст: як параметри баргардонӣ ва то 15 параметри дохилкунӣ.

Типи далелҳо:

Типи далелҳо | Шарҳ
--- | ---
CALLTYPE | Дар Windows: FAR PASCAL (_far _pascal) Дигар: аслӣ (operating system specific default)
USHORT | 2 Byte unsigned Integer
DOUBLE | 8 byte platform-dependent format
Paramtype | Platform-dependent like int PTR_DOUBLE =0 pointer to a double PTR_STRING =1 pointer to a zero-terminated string PTR_DOUBLE_ARR =2 pointer to a double array PTR_STRING_ARR =3 pointer to a string array PTR_CELL_ARR =4 pointer to a cell array NONE =5

## Shared Library DLL functions

Following you will find a description of those functions, which are called at the Shared Library external DLL.

For all Shared Library DLL functions, the following applies:

void CALLTYPE fn(out, in1, in2, ...)

Output: Resulting value

Input: Any number of types (double&, char*, double*, char**, Cell area), where the Cell area is an array of types double array, string array, or cell array.

### GetFunctionCount()

Шумораи функтсияҳоро ба ғайр аз функтсияҳои административии параметри шаволашуда. Ҳар як функтсия рақами ягона аз 0 то nCount-1 дорад. Ин рақам лозим аст барои функтсияҳои GetFunctionData ва GetParameterDescription.

Синтаксис

void CALLTYPE GetFunctionCount(USHORT& nCount)

Параметр

USHORT &nCount:

Output: Reference to a variable, which is supposed to contain the number of Add-In functions. For example: If the Add-In provides 5 functions for LibreOffice Calc, then nCount=5.

### GetFunctionData()

Ҳама маълумоти муҳимро оиди васлак муайян мекунад.

Синтаксис

void CALLTYPE GetFunctionData(USHORT& nNo, char* pFuncName, USHORT& nParamCount, Paramtype* peType, char* pInternalName)

Параметр

USHORT& nNo:

Input: Function number between 0 and nCount-1, inclusively.

char* pFuncName:

Output: Function name as seen by the programmer, as it is named in the Shared Library DLL. This name does not determine the name used in the Function Wizard.

USHORT& nParamCount:

Output: Number of parameters in AddIn function. This number must be greater than 0, because there is always a result value; the maximum value is 16.

Paramtype* peType:

Output: Pointer to an array of exactly 16 variables of type Paramtype. The first nParamCount entries are filled with the suitable type of parameter.

char* pInternalName:

Output: Function name as seen by the user, as it appears in the Function Wizard. May contain umlauts.

Параметрҳои pFuncName ва pInternalName char arrays мебошанд, ки андозаи 256 ро дар LibreOffice Calc доранд.

### GetParameterDescription()

Шарҳи мухтасари васлак ва функтсияҳои онро дорад. Ин функтсия барои нишондиҳии параметрҳо дар Ёвари Функтсия истифода мешавад.

Синтаксис

void CALLTYPE GetParameterDescription(USHORT& nNo, USHORT& nParam, char* pName, char* pDesc)

Параметр

USHORT& nNo:

Input: Number of the function in the library; between 0 and nCount-1.

USHORT& nParam:

Input: Indicates, for which parameter the description is provided; parameters start at 1. If nParam is 0, the description itself is supposed to be provided in pDesc; in this case, pName does not have any meaning.

char* pName:

Output: Takes up the parameter name or type, for example, the word "Number" or "String" or "Date", and so on. Implemented in LibreOffice Calc as char[256].

char* pDesc:

Output: Takes up the description of the parameter, for example, "Value, at which the universe is to be calculated." Implemented in LibreOffice Calc as char[256].

pName and pDesc are char arrays; implemented in LibreOffice Calc with size 256. Please note that the space available in the Function Wizard is limited and that the 256 characters cannot be fully used.

## Cell areas

The following tables contain information about which data structures must be provided by an external program module in order to pass cell areas. LibreOffice Calc distinguishes between three different arrays, depending on the data type.

### Double Array

As a parameter, a cell area with values of the Number/Double type can be passed. A double array in LibreOffice Calc is defined as follows:

Offset | Name | Description
--- | --- | ---
0 | Стн | Column number in the upper-left corner of the cell area. Numbering starts at 0.
2 | Сатр | Row number in the upper-left corner of the cell area; numbering starts at 0.
4 | Табуляр | Table number in the upper-left corner of the cell area; numbering starts at 0.
6 | Стн | Column number in the lower-right corner of the cell area. Numbering starts at 0.
8 | Сатр | Row number in the lower-right corner of the cell area; numbering starts at 0.
10 | Табуляр | Table number in the lower-right corner of the cell area; numbering starts at 0.
12 | Шумора | Number of the following elements. Empty cells are not counted or passed.
14 | Стн | Column number of the element. Numbering starts at 0.
16 | Сатр | Row number of the element; numbering starts at 0.
18 | Табуляр | Table number of the element; numbering starts at 0.
20 | Хатогӣ | Error number, where the value 0 is defined as "no error." If the element comes from a formula cell the error value is determined by the formula.
22 | Арзиш | 8 byte IEEE variable of type double/floating point
30 | ... | Next element

### String Array

A cell area, which contains values of data type Text and is passed as a string array. A string array in LibreOffice Calc is defined as follows:

Offset | Name | Description
--- | --- | ---
0 | Стн | Column number in the upper-left corner of the cell area. Numbering starts at 0.
2 | Сатр | Row number in the upper-left corner of the cell area; numbering starts at 0.
4 | Табуляр | Table number in the upper-left corner of the cell area; numbering starts at 0.
6 | Стн | Column number in the lower-right corner of the cell area. Numbering starts at 0.
8 | Сатр | Row number in the lower-right corner of the cell area; numbering starts at 0.
10 | Табуляр | Table number in the lower-right corner of the cell area; numbering starts at 0.
12 | Шумора | Number of the following elements. Empty cells are not counted or passed.
14 | Стн | Column number of the element. Numbering starts at 0.
16 | Сатр | Row number of the element; numbering starts at 0.
18 | Табуляр | Table number of the element; numbering starts at 0.
20 | Хатогӣ | Error number, where the value 0 is defined as "no error." If the element comes from a formula cell the error value is determined by the formula.
22 | Len | Length of the following string, including closing zero byte. If the length including closing zero byte equals an odd value a second zero byte is added to the string so that an even value is achieved. Therefore, Len is calculated using ((StrLen+2)&~1).
24 | Сатрҳо | String with closing zero byte
24+Len | ... | Next element

### Cell Array

Cell arrays are used to call cell areas containing text as well as numbers. A cell array in LibreOffice Calc is defined as follows:

Offset | Name | Description
--- | --- | ---
0 | Стн | Column number in the upper-left corner of the cell area. Numbering starts at 0.
2 | Сатр | Row number in the upper-left corner of the cell area; numbering starts at 0.
4 | Табуляр | Table number in the upper-left corner of the cell area; numbering starts at 0.
6 | Стн | Column number in the lower-right corner of the cell area. Numbering starts at 0.
8 | Сатр | Row number in the lower-right corner of the cell area; numbering starts at 0.
10 | Табуляр | Table number in the lower-right corner of the cell area; numbering starts at 0.
12 | Шумора | Number of the following elements. Empty cells are not counted or passed.
14 | Стн | Column number of the element. Numbering starts at 0.
16 | Сатр | Row number of the element; numbering starts at 0.
18 | Табуляр | Table number of the element; numbering starts at 0.
20 | Хатогӣ | Error number, where the value 0 is defined as "no error." If the element comes from a formula cell the error value is determined by the formula.
22 | Тип | Type of cell content, 0 == Double, 1 == String
24 | Value or Len | If type == 0: 8 byte IEEE variable of type double/floating point If type == 1: Length of the following string, including closing zero byte. If the length including closing zero byte equals an odd value a second zero byte is added to the string so that an even value is achieved. Therefore, Len is calculated using ((StrLen+2)&~1).
26 if type==1 | Сатрҳо | If type == 1: String with closing zero byte
32 or 26+Len | ... | Next element

Please support us!