diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-11-06 10:17:10 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-11-06 10:37:47 +0200 |
commit | d6cd273c59c976c085d68e9f171a09bf018b0039 (patch) | |
tree | 49b7b17bbd7f807a2b67e727ccdf95d908714b96 /solenv/bin | |
parent | de016544e7fd243d7f922b06c7fd11aadd9f0324 (diff) |
Add function to map custom widget name to its function to native-code.py
Use that function in the dialog builder instead of having explicit
code in there to check the names.
For now this simply uses a manually curated list of custom widgets. I
used some command line tools to extract the names of custom widgets
used in our .ui files, and then filtered out some I guess (hope) will
not be needed in a mobile app.
For this to work the custom widgets need to have unique names.
Currently that is not the case. Unless I did some mistake, there is
just one case of duplicate name, NotebookbarTabControl, which exists
both in the sfx and vcl libraries. (I simply filtered out that one,
too, for now.)
Change-Id: I29bbf6dfef2b3bde03acfc322495d051a7f275a8
Diffstat (limited to 'solenv/bin')
-rwxr-xr-x | solenv/bin/native-code.py | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 6cf298c20dc0..b7f397af4011 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -396,6 +396,138 @@ constructor_map = { 'writer' : writer_constructor_list, } +custom_widgets = [ + 'ArgEdit', + 'AutoCompleteMultiListBox', + 'AutoCorrEdit', + 'BookmarksBox', + 'CaptionComboBox', + 'CategoryListBox', + 'ClassificationEditView', + 'ColorConfigCtrl', + 'ColumnEdit', + 'CommandCategoryListBox', + 'ConditionEdit', + 'ContentListBox', + 'ContextVBox', + 'CuiCustomMultilineEdit', + 'CustomAnimationList', + 'CustomPropertiesControl', + 'DataTreeListBox', + 'DriverListControl', + 'DropdownBox', + 'EditBox', + 'EmojiView', + 'ExtBoxWithBtns', + 'ExtensionBox', + 'FEdit', + 'FontNameBox', + 'FontSizeBox', + 'FontStyleBox', + 'FormattedField', + 'FormulaListBox', + 'GalleryPreview', + 'IndexBox', + 'IndexBox', + 'IntellectualPropertyPartEdit', + 'LightButton', + 'LookUpComboBox', + 'MacroEventListBox', + 'ManagedMenuButton', + 'MultiLineEditSyntaxHighlight', + 'NumFormatListBox', + 'OFileURLControl', + 'OptionalBox', + 'PageNumberListBox', + 'PaperSizeListBox', + 'PriorityHBox', + 'PriorityMergedHBox', + 'PropertyControl', + 'RecentDocsView', + 'RefButton', + 'RefEdit', + 'ReplaceEdit', + 'ReturnActionEdit', + 'RowEdit', + 'RubyEdit', + 'RubyPreview', + 'RubyRadioButton', + 'SFTreeListBox', + 'SameContentListBox', + 'ScAutoFmtPreview', + 'ScCondFormatList', + 'ScCsvTableBox', + 'ScCursorRefEdit', + 'ScDPFunctionListBox', + 'ScDataTableView', + 'ScDoubleField', + 'ScEditWindow', + 'ScPivotLayoutTreeList', + 'ScPivotLayoutTreeListData', + 'ScPivotLayoutTreeListLabel', + 'ScRefButtonEx', + 'SdPageObjsTLB', + 'SearchBox', + 'SearchResultsBox', + 'SelectionListBox', + 'SentenceEditWindow', + 'SeriesListBox', + 'SfxAccCfgTabListBox', + 'SfxConfigFunctionListBox', + 'SfxConfigGroupListBox', + 'ShowNupOrderWindow', + 'ShowNupOrderWindow', + 'SidebarDialControl', + 'SidebarToolBox', + 'SmallButton', + 'SpacingListBox', + 'StatusBar', + 'StructListBox', + 'SuggestionDisplay', + 'SuggestionEdit', + 'SvSimpleTableContainer', + 'SvTabListBox', + 'SvTreeListBox', + 'SvtFileView', + 'SvtIconChoiceCtrl', + 'SvtURLBox', + 'Svx3DPreviewControl', + 'SvxCharViewControl', + 'SvxCheckListBox', + 'SvxColorListBox', + 'SvxColorValueSet', + 'SvxDictEdit', + 'SvxFillAttrBox', + 'SvxFillTypeBox', + 'SvxFontPrevWindow', + 'SvxHlmarkTreeLBox', + 'SvxHyperURLBox', + 'SvxLanguageBox', + 'SvxLanguageComboBox', + 'SvxLightCtl3D', + 'SvxNoSpaceEdit', + 'SvxPathControl', + 'SvxRelativeField', + 'SvxSwFrameExample', + 'SvxTextEncodingBox', + 'SvxTextEncodingBox', + 'SwAddressPreview', + 'SwCaptionPreview', + 'SwFieldRefTreeListBox', + 'SwGlTreeListBox', + 'SwGlossaryGroupTLB', + 'SwIdxTreeListBox', + 'SwMarkPreview', + 'SwNavHelpToolBox', + 'SwTokenWindow', + 'TableValueSet', + 'TemplateDefaultView', + 'TemplateLocalView', + 'TemplateSearchView', + 'ThesaurusAlternativesCtrl', + 'ValueSet', + ] + def get_constructor_guard(constructor): if type(full_constructor_map[constructor]) is bool: return None @@ -501,6 +633,24 @@ for constructor in sorted(full_constructor_map.keys()): if constructor_guard: print ('#endif') +print ('') +for entry in sorted(custom_widgets): + print ('void make' + entry + '();') +print ('static struct { const char *name; void(*func)(); } custom_widgets[] = {') +for entry in sorted(custom_widgets): + print (' { "make' + entry + '", make' + entry + ' },') +print ('};') +print ('') +print (""" +void (*lo_get_custom_widget_func(const char* name))() +{ + for (int i = 0; i < sizeof(custom_widgets) / sizeof(custom_widgets[0]); i++) + if (strcmp(name, custom_widgets[i].name) == 0) + return custom_widgets[i].func; + return nullptr; +} +""") + print (""" const lib_to_factory_mapping * lo_get_factory_map(void) |