summaryrefslogtreecommitdiff
path: root/solenv/bin/native-code.py
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-11-06 10:17:10 +0200
committerTor Lillqvist <tml@collabora.com>2018-11-06 12:00:55 +0100
commit2bc5ab312b1cdb8c299253a54fecdd3c64319fd2 (patch)
treec185caa1ffff52083b35f121afbf98d87a79404c /solenv/bin/native-code.py
parent2a6e3fa7a0d938a7db2d75cabb2341149903437a (diff)
Add function to map custom widget name to its function to native-code.py
Use that function in the dialog builder instead of looking up the function dynamically, which won't work in a Release build as the linker will filter out functions that aren't explicitly referenced. 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 Reviewed-on: https://gerrit.libreoffice.org/62946 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'solenv/bin/native-code.py')
-rwxr-xr-xsolenv/bin/native-code.py204
1 files changed, 204 insertions, 0 deletions
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 430a429e9b6d..82c030ff79b5 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -365,6 +365,192 @@ constructor_map = {
'writer' : writer_constructor_list,
}
+custom_widgets = [
+ 'ArgEdit',
+ 'AutoCompleteMultiListBox',
+ 'AutoCorrEdit',
+ 'AutoFormatPreview',
+ 'BackgroundPreview',
+ 'BmpWindow',
+ 'BookmarksBox',
+ 'CaptionComboBox',
+ 'CategoryListBox',
+ 'ClassificationEditView',
+ 'ColorConfigCtrl',
+ 'ColorFieldControl',
+ 'ColorPreviewControl',
+ 'ColorSliderControl',
+ 'ColumnEdit',
+ 'ColumnValueSet',
+ 'CommandCategoryListBox',
+ 'ConditionEdit',
+ 'ContentListBox',
+ 'ContextVBox',
+ 'CuiCustomMultilineEdit',
+ 'CustomPropertiesControl',
+ 'DataTreeListBox',
+ 'DialControl',
+ 'DriverListControl',
+ 'DropdownBox',
+ 'EditBox',
+ 'EmbossControl',
+ 'EmojiView',
+ 'ExtBoxWithBtns',
+ 'ExtensionBox',
+ 'FEdit',
+ 'FontNameBox',
+ 'FontSizeBox',
+ 'FontStyleBox',
+ 'FontStyleBox',
+ 'FormattedField',
+ 'FormulaListBox',
+ 'FrameDirectionListBox',
+ 'GalleryPreview',
+ 'GraphCtrl',
+ 'GraphicPreviewWindow',
+ 'HexColorControl',
+ 'HyphenEdit',
+ 'IndexBox',
+ 'IndexBox',
+ 'IntellectualPropertyPartEdit',
+ 'LightButton',
+ 'LineEndLB',
+ 'LineLB',
+ 'LineListBox',
+ 'LookUpComboBox',
+ 'MacroEventListBox',
+ 'ManagedMenuButton',
+ 'MultiLineEditSyntaxHighlight',
+ 'NumFormatListBox',
+ 'NumberingPreview',
+ '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',
+ 'ScExtIButton',
+ 'ScPivotLayoutTreeList',
+ 'ScPivotLayoutTreeListData',
+ 'ScPivotLayoutTreeListLabel',
+ 'ScRefButtonEx',
+ 'ScTabBgColorValueSet',
+ 'SdPageObjsTLB',
+ 'SearchBox',
+ 'SearchResultsBox',
+ 'SelectionListBox',
+ 'SentenceEditWindow',
+ 'SeriesListBox',
+ 'SfxAccCfgTabListBox',
+ 'SfxConfigFunctionListBox',
+ 'SfxConfigGroupListBox',
+ 'SfxPreviewWin',
+ 'ShowNupOrderWindow',
+ 'ShowNupOrderWindow',
+ 'SidebarDialControl',
+ 'SidebarToolBox',
+ 'SlideTransitionBox',
+ 'SmallButton',
+ 'SmallButton',
+ 'SpacingListBox',
+ 'StatusBar',
+ 'StructListBox',
+ 'SuggestionDisplay',
+ 'SuggestionEdit',
+ 'SvSimpleTableContainer',
+ 'SvTabListBox',
+ 'SvTreeListBox',
+ 'SvtFileView',
+ 'SvtIconChoiceCtrl',
+ 'SvtURLBox',
+ 'Svx3DPreviewControl',
+ 'SvxBmpNumValueSet',
+ 'SvxCharView',
+ 'SvxCheckListBox',
+ 'SvxColorListBox',
+ 'SvxColorValueSet',
+ 'SvxCropExample',
+ 'SvxDictEdit',
+ 'SvxFillAttrBox',
+ 'SvxFillTypeBox',
+ 'SvxFontListBox',
+ 'SvxFontPrevWindow',
+ 'SvxFrameSelector',
+ 'SvxHlmarkTreeLBox',
+ 'SvxHyperURLBox',
+ 'SvxLanguageBox',
+ 'SvxLanguageComboBox',
+ 'SvxLanguageComboBox',
+ 'SvxLightCtl3D',
+ 'SvxNoSpaceEdit',
+ 'SvxNumValueSet',
+ 'SvxNumberPreview',
+ 'SvxNumberingPreview',
+ 'SvxPageWindow',
+ 'SvxParaPrevWindow',
+ 'SvxPathControl',
+ 'SvxPixelCtl',
+ 'SvxPresetListBox',
+ 'SvxRectCtl',
+ 'SvxRelativeField',
+ 'SvxSearchCharSet',
+ 'SvxShowCharSet',
+ 'SvxShowText',
+ 'SvxSwFrameExample',
+ 'SvxTextEncodingBox',
+ 'SvxTextEncodingBox',
+ 'SvxXConnectionPreview',
+ 'SvxXLinePreview',
+ 'SvxXMeasurePreview',
+ 'SvxXRectPreview',
+ 'SvxXShadowPreview',
+ 'SwAddressPreview',
+ 'SwCaptionPreview',
+ 'SwColExample',
+ 'SwColumnOnlyExample',
+ 'SwDropCapsPict',
+ 'SwEnvPreview',
+ 'SwFieldRefTreeListBox',
+ 'SwGlTreeListBox',
+ 'SwGlossaryGroupTLB',
+ 'SwIdxTreeListBox',
+ 'SwLabPreview',
+ 'SwMarkPreview',
+ 'SwNavHelpToolBox',
+ 'SwNumberingTypeListBox',
+ 'SwPageGridExample',
+ 'SwTokenWindow',
+ 'TabWin_Impl',
+ 'TableDesignBox',
+ 'TableValueSet',
+ 'TemplateDefaultView',
+ 'TemplateLocalView',
+ 'TemplateSearchView',
+ 'TextDirectionListBox',
+ 'ThesaurusAlternativesCtrl',
+ 'ValueSet',
+ ]
+
def get_constructor_guard(constructor):
if type(full_constructor_map[constructor]) is bool:
return None
@@ -469,6 +655,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)