Document Event-Driven Macros

This section describes how to assign scripts to application, document or form events.

You can automatically execute a macro when a specified software event occurs by assigning the desired macro to the event. The following table provides an overview of document events and at what point an assigned macro is executed.

์ด๋ฒคํŠธ

ํ• ๋‹น๋œ ๋งคํฌ๋กœ๊ฐ€ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค...

routine

์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ์‹œ์ž‘

...after a LibreOffice application is started.

OnStartApp

์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ๋‹ซ๊ธฐ

...LibreOffice ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์ด ์ข…๋ฃŒ๋˜๊ธฐ ์ „

OnCloseApp

๋ฌธ์„œ ์ƒ์„ฑ๋จ

...New document created with File - New or with the New icon. Note that this event also fires when Basic IDE opens.

OnCreate

์ƒˆ ๋ฌธ์„œ

...ํŒŒ์ผ - ์ƒˆ๋กœ ๋งŒ๋“ค๊ธฐ ๋˜๋Š” ์ƒˆ๋กœ ๋งŒ๋“ค๊ธฐ ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์ƒˆ ๋ฌธ์„œ๋ฅผ ๋งŒ๋“  ํ›„

OnNew

๋ฌธ์„œ ๋กœ๋“œ ๋งˆ์นจ

...before a document is opened with File - Open or with the Open icon.

OnLoadFinished

๋ฌธ์„œ ์—ด๊ธฐ

...ํŒŒ์ผ - ์—ด๊ธฐ ๋˜๋Š” ์—ด๊ธฐ ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œ๋ฅผ ์—ฐ ํ›„

OnLoad

๋ฌธ์„œ๊ฐ€ ๋‹ซํžˆ๋ ค๊ณ  ํ•จ

...๋ฌธ์„œ๋ฅผ ๋‹ซ๊ธฐ ์ „

OnPrepareUnload

๋‹ซํžŒ ๋ฌธ์„œ

...๋ฌธ์„œ๋ฅผ ๋‹ซ์€ ํ›„. ๋ฌธ์„œ๋ฅผ ๋‹ซ๊ธฐ ์ „์— ์ €์žฅํ•˜๋ฉด "๋ฌธ์„œ ์ €์žฅ" ์ด๋ฒคํŠธ๋„ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฒƒ์— ์ฃผ์˜ํ•ฉ๋‹ˆ๋‹ค.

OnUnload

-no UI-

OnLayoutFinished

๋ณด๊ธฐ ์ƒ์„ฑ๋จ

Document is displayed. Note that this event also happens when a document is duplicated.

OnViewCreated

๋ณด๊ธฐ๊ฐ€ ๋‹ซํžˆ๋ ค๊ณ  ํ•จ

Document layout is getting removed.

OnPrepareViewClosing

๋ณด๊ธฐ ๋‹ซํž˜

Document layout is cleared prior to the document closure.

OnViewClosed

๋ฌธ์„œ ํ™œ์„ฑํ™”

...๋ฌธ์„œ๋ฅผ ๋งจ ์•ž์œผ๋กœ ๊ฐ€์ ธ์˜จ ํ›„

OnFocus

๋ฌธ์„œ ๋น„ํ™œ์„ฑํ™”

...๋‹ค๋ฅธ ๋ฌธ์„œ๋ฅผ ๋งจ ์•ž์œผ๋กœ ๊ฐ€์ ธ์˜จ ํ›„

OnUnfocus

๋ฌธ์„œ ์ €์žฅ

...ํŒŒ์ผ - ์ €์žฅ ๋˜๋Š” ์ €์žฅ ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œ๋ฅผ ์ €์žฅํ•˜๊ธฐ ์ „(๋ฌธ์„œ ์ด๋ฆ„์„ ์ด๋ฏธ ์ง€์ •ํ•œ ๊ฒฝ์šฐ)

OnSaveAs

๋ฌธ์„œ๊ฐ€ ์ €์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

...ํŒŒ์ผ - ์ €์žฅ ๋˜๋Š” ์ €์žฅ ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์„œ๋ฅผ ์ €์žฅํ•œ ํ›„(๋ฌธ์„œ ์ด๋ฆ„์„ ์ด๋ฏธ ์ง€์ •ํ•œ ๊ฒฝ์šฐ)

OnSaveDone

๋ฌธ์„œ ์ €์žฅ ์‹คํŒจ

Document could not be saved.

OnSaveFailed

๋ฌธ์„œ๋ฅผ ๋‹ค๋ฅธ ์ด๋ฆ„์œผ๋กœ ์ €์žฅ

...๋ฌธ์„œ๋ฅผ ์ง€์ •ํ•œ ์ด๋ฆ„์œผ๋กœ ์ €์žฅํ•˜๊ธฐ ์ „(ํŒŒ์ผ - ๋‹ค๋ฅธ ์ด๋ฆ„์œผ๋กœ ์ €์žฅ์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ๋ฌธ์„œ ์ด๋ฆ„์„ ์•„์ง ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ํŒŒ์ผ - ์ €์žฅ ๋˜๋Š” ์ €์žฅ ์•„์ด์ฝ˜ ์‚ฌ์šฉ)

OnSaveAs

๋ฌธ์„œ๊ฐ€ ๋‹ค์Œ์˜ ์ด๋ฆ„์œผ๋กœ ์ €์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

... ๋ฌธ์„œ๋ฅผ ์ง€์ •๋œ ์ด๋ฆ„์œผ๋กœ ์ €์žฅํ•œ ํ›„(ํŒŒ์ผ - ๋‹ค๋ฅธ ์ด๋ฆ„์œผ๋กœ ์ €์žฅ์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ๋ฌธ์„œ ์ด๋ฆ„์„ ์•„์ง ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ํŒŒ์ผ - ์ €์žฅ ๋ฉ”๋‰ด ๋˜๋Š” ์ €์žฅ ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์ €์žฅํ•œ ๊ฒฝ์šฐ)

OnSaveAsDone

'Save As' has failed

Document could not be saved.

OnSaveAsFailed

-no UI-

When the document disk location has changed, for example after a File - Save As action.

OnStorageChanged

๋ฌธ์„œ ์‚ฌ๋ณธ์„ ์ €์žฅํ•˜๊ฑฐ๋‚˜ ๋‚ด๋ณด๋‚ด๊ธฐ

...before a document is saved with File - Save a Copy, File - Export, File - Export as PDF or the Save icons.

OnCopyTo

๋ฌธ์„œ ์‚ฌ๋ณธ์ด ์ƒ์„ฑ๋จ

...after a document is saved with File - Save a Copy, File - Export, File - Export as PDF or the Save icons.

OnCopyToDone

๋ฌธ์„œ ์‚ฌ๋ณธ์˜ ์ƒ์„ฑ์— ์‹คํŒจ

Document could not be copied or exported.

OnCopyToFailed

๋ฌธ์„œ ์ธ์‡„

...after the Print dialog is closed, but before the actual print process begins. This event occurs for each copy printed.

OnPrint

-no UI-

...after document security settings have changed.

OnModeChanged

'์ˆ˜์ •' ์ƒํƒœ ๋ณ€๊ฒฝ๋จ

Modified state of a document has changed.

OnModifyChanged

๋ฌธ์„œ ์ œ๋ชฉ ๋ณ€๊ฒฝ๋จ

When the document title gets updated.

OnTitleChanged

ํ•˜์œ„ ์ฝคํฌ๋„ŒํŠธ ๋กœ๋“œ๋จ

...after a database form has been opened.

OnSubComponentOpened

ํ•˜์œ„ ์ฝคํฌ๋„ŒํŠธ๋ฅผ ๋‹ซํž˜

...after a database form has been closed.

OnSubComponentClosed

์–‘์‹ ํŽธ์ง€ ์ธ์‡„ ์‹œ์ž‘

...before printing form letters using File - Print or Tools - Mail Merge Wizard menus.

OnMailMerge

์–‘์‹ ํŽธ์ง€ ์ธ์‡„ ๋งˆ์นจ

...after printing of form letters using File - Print or Tools - Mail Merge Wizard menus.

OnMailMergeFinished

Printing of form fields started

...before printing form fields.

OnFieldMerge

Printing of form fields finished

...after printing form fields.

OnFieldMergeFinished

ํŽ˜์ด์ง€ ์ˆ˜ ๋ณ€๊ฒฝ

When the page count changes.

OnPageCountChanged


note

Most events relate to documents, except OnStartApp, OnCloseApp, OnCreate and OnLoadFinished that occur at application level. OnSubComponentOpened, and OnSubComponentClosed events are fired by database's forms.


tip

Writer documents are triggering those specific events: OnLayoutFinished, OnMailMerge, OnMailMergeFinished, OnFieldMerge, OnFieldMergeFinished and OnPageCountChanged.


์ด๋ฒคํŠธ์— ๋งคํฌ๋กœ ํ• ๋‹น

  1. ๋„๊ตฌ - ์‚ฌ์šฉ์ž ์ •์˜๋ฅผ ์„ ํƒํ•˜๊ณ  ์ด๋ฒคํŠธ ํƒญ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  2. ์ €์žฅ ์œ„์น˜ ๋ชฉ๋ก ์ƒ์ž์—์„œ ํ• ๋‹น์„ ์ „์—ญ์ ์œผ๋กœ ์œ ํšจํ•˜๊ฒŒ ํ• ์ง€ ๋˜๋Š” ํ˜„์žฌ ๋ฌธ์„œ์—์„œ๋งŒ ์œ ํšจํ•˜๊ฒŒ ํ• ์ง€ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ์ด๋ฒคํŠธ ๋ชฉ๋ก์—์„œ ์ด๋ฒคํŠธ๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  4. ๋งคํฌ๋กœ๋ฅผ ํด๋ฆญํ•˜๊ณ  ์„ ํƒํ•œ ์ด๋ฒคํŠธ์— ํ• ๋‹นํ•  ๋งคํฌ๋กœ๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  5. ํ™•์ธ์„ ํด๋ฆญํ•˜์—ฌ ๋งคํฌ๋กœ๋ฅผ ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค.

  6. ํ™•์ธ์„ ํด๋ฆญํ•˜์—ฌ ๋Œ€ํ™” ์ƒ์ž๋ฅผ ๋‹ซ์Šต๋‹ˆ๋‹ค.

์ด๋ฒคํŠธ์— ๋Œ€ํ•œ ๋งคํฌ๋กœ ํ• ๋‹น ์ œ๊ฑฐ

  1. ๋„๊ตฌ - ์‚ฌ์šฉ์ž ์ •์˜๋ฅผ ์„ ํƒํ•˜๊ณ  ์ด๋ฒคํŠธ ํƒญ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  2. ์ €์žฅ ์œ„์น˜ ๋ชฉ๋ก ์ƒ์ž์˜ ์˜ต์…˜์„ ์„ ํƒํ•˜์—ฌ ์ „์—ญ ํ• ๋‹น ๋˜๋Š” ํ˜„์žฌ ๋ฌธ์„œ์—์„œ๋งŒ ์œ ํšจํ•œ ํ• ๋‹น์„ ์ œ๊ฑฐํ• ์ง€ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  3. ์ œ๊ฑฐํ•  ํ• ๋‹น์ด ํฌํ•จ๋œ ์ด๋ฒคํŠธ๋ฅผ ์ด๋ฒคํŠธ ๋ชฉ๋ก์—์„œ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

  4. ์ œ๊ฑฐ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

  5. ํ™•์ธ์„ ํด๋ฆญํ•˜์—ฌ ๋Œ€ํ™” ์ƒ์ž๋ฅผ ๋‹ซ์Šต๋‹ˆ๋‹ค.

In addition to assigning macros to events, one can monitor events triggered in LibreOffice documents.

Please support us!