Hacking Framework

Save, Save As and Export

The Save, Save As, and Export actions are executed with the event IDs of SID_SAVEDOC, SID_SAVEASDOC, and SID_EXPORTDOC, respectively. All of these commands are received in SfxObjectShell::ExecFile_Impl with the only difference between these commands being the event ID; these commands all end up being handled by the same code.

File Format Filters

Filter configuration files are all in XML format. They are located in filter/source/config/fragments/filters with an .xcu extension. These xcu files are fragments which get merged into a single configuration file at build time.

The following properties are used in a filter fragment file:

  • Flags
  • UIComponent
  • FilterService
  • UserData
  • UIName
  • FileFormatVersion
  • Type
  • TemplateName
  • DocumentService

Possible values for the Flags properties are

  • 3RDPARTYFILTER
  • ALIEN
  • ASYNCHRON
  • BROWSERPREFERRED
  • CONSULTSERVICE
  • DEFAULT
  • EXPORT
  • IMPORT
  • INTERNAL
  • NOTINCHOOSER
  • NOTINFILEDIALOG
  • NOTINSTALLED
  • OWN
  • PACKED
  • PREFERRED
  • READONLY
  • SILENTEXPORT
  • SUPPORTSSELECTION
  • TEMPLATE
  • TEMPLATEPATH
  • USESOPTIONS
  • COMBINED

as outlined in filter/source/config/cache/constant.hxx.

Class filter::config::FilterCache implements the filter cache that includes all filter configuration and type detection data, and this is where the filter configuration data, stored in the cache file, are loaded into the application process. Class filter::config::CacheItem represents each cached filter item. Take a look at FilterCache::impl_load to see how cached filter items get loaded into the process.

Method filter::config::FilterCache::impl_convertFlagNames2FlagField converts the flag names to an internal flag value used as a bit field. Those flag values defined in filter/source/config/cache/constant.hxx (FLAGVAL_*) are mapped by values to SFX_FILTER_* in sfx2/inc/sfx2/docfilt.hxx.

File Picker

The file open, save and save-as dialogs are implemented as UNO services whose implementations are found in the fpicker module. This module implements file picker dialogs that are native to each supported platform as well as the OOo’s own dialog. UNO services com.sun.star.ui.dialogs.SystemFilePicker and com.sun.star.ui.dialogs.OfficeFilePicker implements the native file picker and the OOo file picker, respectively. In sfx2, class sfx2::FileDialogHelper encapsulates all of these details and provides a simpler set of APIs.

Class SfxPasswordDialog implements the password dialog that pops up when the application needs to get a password from the user, such as when saving the document with a password.

System Clipboard

Copying and pasting via system clipboard is handled by class TransferableDataHelper in the svtools module.

Class CDataFormatTranslator in module dtrans handle translation of system clipboard data into OO.o’s internal clipboard data. Internally, OO.o uses struct com.sun.star.datatransfer.DataFlavor to store clipboard meta data. CDataFormatTranslator::initTranslationTable registers all clipboard formats that OO.o handles internally. So, if you were to add a new clipboard format, this is the method to look into.