diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /officecfg/util | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'officecfg/util')
-rw-r--r-- | officecfg/util/AcceleratorKeyChecker.fodt | 775 | ||||
-rw-r--r-- | officecfg/util/alllang.xsl | 421 | ||||
-rw-r--r-- | officecfg/util/data_val.xsl | 320 | ||||
-rwxr-xr-x | officecfg/util/delcomment.sed | 1 | ||||
-rw-r--r-- | officecfg/util/schema_trim.xsl | 145 | ||||
-rw-r--r-- | officecfg/util/schema_val.xsl | 139 |
6 files changed, 1801 insertions, 0 deletions
diff --git a/officecfg/util/AcceleratorKeyChecker.fodt b/officecfg/util/AcceleratorKeyChecker.fodt new file mode 100644 index 0000000000..e40928c28a --- /dev/null +++ b/officecfg/util/AcceleratorKeyChecker.fodt @@ -0,0 +1,775 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:creation-date>2015-09-24T00:23:17.450000000</meta:creation-date><dc:date>2016-02-12T08:27:37.426000000</dc:date><meta:editing-duration>PT2H10M43S</meta:editing-duration><meta:editing-cycles>75</meta:editing-cycles><meta:generator>LibreOfficeDev/5.2.0.0.alpha0$Windows_x86 LibreOffice_project/f14d271d31e75de09821cf1766c7ab2a9c6e0461</meta:generator><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="11" meta:word-count="235" meta:character-count="1250" meta:non-whitespace-character-count="1030"/></office:meta> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item> + <config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item> + <config:config-item config:name="ViewAreaWidth" config:type="long">26407</config:config-item> + <config:config-item config:name="ViewAreaHeight" config:type="long">15162</config:config-item> + <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item> + <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">view2</config:config-item> + <config:config-item config:name="ViewLeft" config:type="long">11382</config:config-item> + <config:config-item config:name="ViewTop" config:type="long">4362</config:config-item> + <config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item> + <config:config-item config:name="VisibleTop" config:type="long">0</config:config-item> + <config:config-item config:name="VisibleRight" config:type="long">26405</config:config-item> + <config:config-item config:name="VisibleBottom" config:type="long">15161</config:config-item> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + <config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item> + <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item> + <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item> + <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrinterName" config:type="string"/> + <config:config-item config:name="EmbeddedDatabaseName" config:type="string"/> + <config:config-item config:name="CurrentDatabaseDataSource" config:type="string">Bröllopsgäster</config:config-item> + <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item> + <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item> + <config:config-item config:name="FloattableNomargins" config:type="boolean">false</config:config-item> + <config:config-item config:name="UnbreakableNumberings" config:type="boolean">false</config:config-item> + <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item> + <config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item> + <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item> + <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/> + <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrinterSetup" config:type="base64Binary"/> + <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> + <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> + <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> + <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item> + <config:config-item config:name="SurroundTextWrapSmall" config:type="boolean">false</config:config-item> + <config:config-item config:name="SmallCapsPercentage66" config:type="boolean">false</config:config-item> + <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item> + <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> + <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item> + <config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item> + <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item> + <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item> + <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> + <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item> + <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item> + <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item> + <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/> + <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item> + <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item> + <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item> + <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item> + <config:config-item config:name="RsidRoot" config:type="int">1854555</config:config-item> + <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> + <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item> + <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item> + <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item> + <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item> + <config:config-item config:name="Rsid" config:type="int">3406469</config:config-item> + <config:config-item config:name="ApplyParagraphMarkFormatToNumbering" config:type="boolean">false</config:config-item> + <config:config-item config:name="MathBaselineAlignment" config:type="boolean">true</config:config-item> + <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item> + <config:config-item config:name="PropLineSpacingShrinksFirstLine" config:type="boolean">true</config:config-item> + <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item> + <config:config-item config:name="TabOverflow" config:type="boolean">true</config:config-item> + <config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item> + <config:config-item config:name="SubtractFlysAnchoredAtFlys" config:type="boolean">false</config:config-item> + <config:config-item config:name="ClippedPictures" config:type="boolean">false</config:config-item> + <config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item> + <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrintFaxName" config:type="string"/> + <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrintEmptyPages" config:type="boolean">false</config:config-item> + </config:config-item-set> + </office:settings> + <office:scripts> + <office:script script:language="ooo:Basic"> + <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"> + <ooo:library-embedded ooo:name="Standard"/> + <ooo:library-embedded ooo:name="AcceleratorKeyCheck"> + <ooo:module ooo:name="AccNameProvider"> + <ooo:source-code>REM ***** BASIC ***** +Dim ROLEMAP As Object + +Sub Main +' msgbox getNameOfAccessibleRole(40) +' msgbox getNameOfAccessibleRole(57) +End Sub + +Function getNameOfAccessibleRole(sID As Integer) + If IsNull(ROLEMAP) Then + initializeRoleMap + End If + If ROLEMAP.containsKey(sID) Then + getNameOfAccessibleRole = ROLEMAP.get(sID) + Else + MsgBox "Could not find the name for the AccessibleRole: " & sID + End If +End Function + +Sub initializeRoleMap + ROLEMAP = com.sun.star.container.EnumerableMap.create("short", "string") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.UNKNOWN, "UNKNOWN") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.ALERT, "ALERT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.COLUMN_HEADER, "COLUMN_HEADER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.CANVAS, "CANVAS") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.CHECK_BOX, "CHECK_BOX") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.CHECK_MENU_ITEM, "CHECK_MENU_ITEM") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.COLOR_CHOOSER, "COLOR_CHOOSER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.COMBO_BOX, "COMBO_BOX") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DATE_EDITOR, "DATE_EDITOR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DESKTOP_ICON, "DESKTOP_ICON") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DESKTOP_PANE, "DESKTOP_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DIRECTORY_PANE, "DIRECTORY_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DIALOG, "DIALOG") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DOCUMENT, "DOCUMENT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.EMBEDDED_OBJECT, "EMBEDDED_OBJECT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.END_NOTE, "END_NOTE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.FILE_CHOOSER, "FILE_CHOOSER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.FILLER, "FILLER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.FONT_CHOOSER, "FONT_CHOOSER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.FOOTER, "FOOTER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.FOOTNOTE, "FOOTNOTE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.FRAME, "FRAME") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.GLASS_PANE, "GLASS_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.GRAPHIC, "GRAPHIC") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.GROUP_BOX, "GROUP_BOX") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.HEADER, "HEADER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.HEADING, "HEADING") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.HYPER_LINK, "HYPER_LINK") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.ICON, "ICON") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.INTERNAL_FRAME, "INTERNAL_FRAME") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.LABEL, "LABEL") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.LAYERED_PANE, "LAYERED_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.LIST, "LIST") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.LIST_ITEM, "LIST_ITEM") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.MENU, "MENU") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.MENU_BAR, "MENU_BAR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.MENU_ITEM, "MENU_ITEM") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.OPTION_PANE, "OPTION_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PAGE_TAB, "PAGE_TAB") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PAGE_TAB_LIST, "PAGE_TAB_LIST") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PANEL, "PANEL") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PARAGRAPH, "PARAGRAPH") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PASSWORD_TEXT, "PASSWORD_TEXT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.POPUP_MENU, "POPUP_MENU") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "PUSH_BUTTON") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PROGRESS_BAR, "PROGRESS_BAR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.RADIO_BUTTON, "RADIO_BUTTON") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.RADIO_MENU_ITEM, "RADIO_MENU_ITEM") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.ROW_HEADER, "ROW_HEADER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.ROOT_PANE, "ROOT_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SCROLL_BAR, "SCROLL_BAR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SCROLL_PANE, "SCROLL_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SHAPE, "SHAPE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SEPARATOR, "SEPARATOR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SLIDER, "SLIDER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SPIN_BOX, "SPIN_BOX") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SPLIT_PANE, "SPLIT_PANE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.STATUS_BAR, "STATUS_BAR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TABLE, "TABLE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TABLE_CELL, "TABLE_CELL") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TEXT, "TEXT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TEXT_FRAME, "TEXT_FRAME") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TOGGLE_BUTTON, "TOGGLE_BUTTON") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TOOL_BAR, "TOOL_BAR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TOOL_TIP, "TOOL_TIP") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TREE, "TREE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.VIEW_PORT, "VIEW_PORT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.WINDOW, "WINDOW") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.BUTTON_DROPDOWN, "BUTTON_DROPDOWN") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.BUTTON_MENU, "BUTTON_MENU") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.CAPTION, "CAPTION") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.CHART, "CHART") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.EDIT_BAR, "EDIT_BAR") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.FORM, "FORM") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.IMAGE_MAP, "IMAGE_MAP") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.NOTE, "NOTE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.PAGE, "PAGE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.RULER, "RULER") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.SECTION, "SECTION") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TREE_ITEM, "TREE_ITEM") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.TREE_TABLE, "TREE_TABLE") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.COMMENT, "COMMENT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.COMMENT_END, "COMMENT_END") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DOCUMENT_PRESENTATION, "DOCUMENT_PRESENTATION") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DOCUMENT_SPREADSHEET, "DOCUMENT_SPREADSHEET") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.DOCUMENT_TEXT, "DOCUMENT_TEXT") + ROLEMAP.put (com.sun.star.accessibility.AccessibleRole.STATIC, "STATIC") +End Sub + + </ooo:source-code> + </ooo:module> + <ooo:module ooo:name="__testMenu"> + <ooo:source-code>REM ***** BASIC ***** +Option Explicit + +Dim oReportCursor As Object +Dim oReportDoc As Object +Dim oReportTable As Object +Dim oComponentName As String +Dim sMenuName As String +Dim hasSubMenu As String +Dim keybinding1 As Object +Dim keybinding2 As Object +Dim accKeyBinding As String + +Sub testmenus +Dim sAccName As String +Dim i As Integer, j As Integer, iMenuBarIndex As Integer +Dim oAccChild As Object, oAccContext As Object, accMenu As Object +Dim ComponentsToCheck As Variant, oComponent As Object + + GlobalScope.BasicLibraries.LoadLibrary("Tools") + + oReportDoc = CreateNewDocument("swriter") + oReportCursor = oReportDoc.getText().createTextCursor() + + ComponentsToCheck() = Array("Writer", "Calc", "Impress","Draw", "Math") + For Each oComponentName In ComponentsToCheck + oComponent = CreateNewDocument("s" & LCase(oComponentName)) + AccReportHeading(oComponentName, 1) + + oAccContext = getAccessibleContextOfDocument(oComponent) + + For i = 0 To oAccContext.getAccessibleChildCount -1 + oAccChild = oAccContext.getAccessibleChild(i).getAccessibleContext() + sAccName = getNameOfAccessibleRole(oAccChild.AccessibleRole) + If sAccName = "MENU_BAR" Then + iMenuBarIndex = i + AccReportHeading("Top Level Menu") + insertReportTable(Array("Name", "Accelerator key", "Has submenu"), oComponentName & "-Top_Level_Menu") + For j = 0 To oAccChild.getAccessibleChildCount -1 + hasSubMenu = "" + accMenu = oAccChild.getAccessibleChild(j).getAccessibleContext() + sMenuName = accMenu.AccessibleName + keybinding1 = accMenu.getAccessibleActionKeyBinding(0).getAccessibleKeyBinding(0) + If accMenu.getAccessibleActionKeyBinding(0).getAccessibleKeyBindingCount() > 1 Then + keybinding2 = accMenu.getAccessibleActionKeyBinding(0).getAccessibleKeyBinding(1) + End If + accKeyBinding = makeKeyStrokeReadable(keybinding1(0), True) + If accMenu.AccessibleChildCount > 0 Then hasSubMenu = "Yes" + insertReportTableContent(Array(sMenuName, accKeyBinding, hasSubMenu)) + Next + End If + Next + AddMenuTables oAccContext.getAccessibleChild(iMenuBarIndex).getAccessibleContext + + DisposeDocument(oComponent) + Next + CheckTableAndMarkupDuplicates +End Sub + +Sub AddMenuTables(accMenuBar) +Dim i As Integer, accMenu As Object + For i = 0 To accMenuBar.getAccessibleChildCount-1 + accMenu = accMenuBar.getAccessibleChild(i) + sMenuName = accMenu.AccessibleName + AccReportHeading(accMenu.AccessibleName) + insertReportTable(Array("Name", "Accelerator key", "Has submenu"), oComponentName & "-" & sMenuName) + FillMenuTable accMenu, 2 + HandleSubMenues accMenu + Next +End Sub + +Sub HandleSubMenues(accMenu, Optional HeadingLevel as Integer) +Dim i As Integer, accMenuItem As Object, sSubMenuName As String + If isMissing(HeadingLevel) Then HeadingLevel = 3 + For i = 0 To accMenu.getAccessibleChildCount-1 + accMenuItem = accMenu.getAccessibleChild(i) + If getNameOfAccessibleRole(accMenuItem.getAccessibleRole) = "MENU" Then + sSubMenuName = accMenuItem.AccessibleName + AccReportHeading(sSubMenuName, HeadingLevel) + insertReportTable(Array("Name", "Accelerator key", "Has submenu"), oComponentName & "-" & sMenuName & "-" & sSubMenuName) + FillMenuTable accMenuItem + ' Take care of submenues of submenues + ' Example in Writer: Insert - Shape - Line + HandleSubMenues accMenuItem, HeadingLevel + 1 + End If + Next +End Sub + +Sub FillMenuTable(accMenu) +Dim i As Integer, accMenuItem As Object + 'Check if it is a menu, and open it + If getNameOfAccessibleRole(accMenu.getAccessibleRole) = "MENU" Then + accMenu.doAccessibleAction(0) + End If + For i = 0 To accMenu.getAccessibleChildCount-1 + accMenuItem = accMenu.getAccessibleChild(i) + Select Case getNameOfAccessibleRole(accMenuItem.getAccessibleRole) + Case "MENU_ITEM", "CHECK_MENU_ITEM", "RADIO_MENU_ITEM" + hasSubMenu = "" + sMenuName = accMenuItem.AccessibleName + keybinding1 = accMenuItem.getAccessibleActionKeyBinding(0).getAccessibleKeyBinding(0) + accKeyBinding = makeKeyStrokeReadable(keybinding1(0)) + insertReportTableContent(Array(sMenuName, accKeyBinding, hasSubMenu)) + Case "MENU" + hasSubMenu = "Yes" + sMenuName = accMenuItem.AccessibleName + keybinding1 = accMenuItem.getAccessibleActionKeyBinding(0).getAccessibleKeyBinding(0) + accKeyBinding = makeKeyStrokeReadable(keybinding1(0)) + insertReportTableContent(Array(sMenuName, accKeyBinding, hasSubMenu)) + End Select + Next +End Sub + +Function getAccessibleContextOfDocument(oDoc) +Dim oContainerWindow As Object + oContainerWindow = oDoc.getCurrentController().getFrame().getContainerWindow() + getAccessibleContextOfDocument = oContainerWindow.getAccessibleContext() +End Function + +Function makeKeyStrokeReadable(oKeyStroke, Optional bIgnoreAltModifier) +Dim sModifiers As String, sMod As String + If isMissing(bIgnoreAltModifier) Then bIgnoreAltModifier = false + + sModifiers = cStr(oKeyStroke.Modifiers) + Select Case sModifiers + Case "1" + sMod = "Shift + " + Case "2" + sMod = "Ctrl + " + Case "3" + sMod = "Ctrl + Shift + " + Case "4" + If bIgnoreAltModifier Then + sMod = "" + Else + sMod = "Alt + " + End If + Case "5" + sMod = "Shift + Alt + " + Case "6" + sMod = "Ctrl + Alt + " + Case "7" + sMod = "Ctrl + Shift + Alt + " + Case "0" + sMod = "" + Case Else + sMod = "Are you using Mac? Not sure if this is supported on Mac? Your modifier is: " & sModifiers + End Select + makeKeyStrokeReadable = sMod & UCase(oKeyStroke.KeyChar) +End Function + +Sub AccReport(sString) + oReportCursor.setString(sString) + oReportCursor.collapseToEnd() +End Sub + +Sub AccReportHeading(sString as string, Optional HeadingLevel as integer) +If IsMissing(HeadingLevel) Then HeadingLevel = 2 + oReportCursor.collapseToEnd() + oReportCursor.ParaStyleName = "Heading " & HeadingLevel + oReportCursor.setString(sString & chr(13)) + oReportCursor.collapseToEnd() +End Sub + +Sub insertReportTable(sColumns(), sTableName As String) +Dim noColumns As Integer, i As Integer +Dim oCell As Object + noColumns = UBound(sColumns) + oReportTable = oReportDoc.createInstance ("com.sun.star.text.TextTable") + oReportTable.initialize(2, noColumns+1) + oReportTable.HeaderRowCount = 1 + oReportTable.RepeatHeadline = true + sTableName = Replace(sTableName, " ", "_") + sTableName = Replace(sTableName, ".", "") + oReportTable.Name = sTableName + oReportCursor.getText().insertTextContent(oReportCursor, oReportTable, False) + + For i = 0 To noColumns + oCell = oReportTable.getCellByPosition( i, 0 ) + oCell.setString(sColumns(i)) + Next +End Sub + +Sub insertReportTableContent(sColumns()) +Dim noColumns As Integer, iRows As Integer, i As Integer +Dim oCell As Object + noColumns = UBound(sColumns) + iRows = oReportTable.getRows().Count + If iRows = 2 Then + oCell = oReportTable.getCellByPosition(0, iRows-1) + If oCell.getString() <> "" Then + oReportTable.getRows().insertByIndex(iRows,1) + Else + iRows = iRows-1 + End If + Else + oReportTable.getRows().insertByIndex(iRows,1) + End If + + For i = 0 To noColumns + oCell = oReportTable.getCellByPosition( i, iRows ) + oCell.setString(sColumns(i)) + Next +End Sub + +Sub CheckTableAndMarkupDuplicates +Dim iTable As Integer, oTable As Object +Dim i As Integer, j As Integer +Dim sAccKey1 As String, sAccKey2 As String + For iTable = 0 To oReportDoc.TextTables.Count-1 + oTable = oReportDoc.TextTables(iTable) + 'First row is a header so we can start at the second row (1) + For i = 1 To oTable.getRows.Count-1 + For j = i + 1 To oTable.getRows.Count-1 + sAccKey1 = oTable.getCellByPosition(1, i).getString() + sAccKey2 = oTable.getCellByPosition(1, j).getString() + If sAccKey1 = sAccKey2 Then + If oTable.getCellByPosition(2, i).getString() = "Yes" Then + oTable.getRows().getByIndex(i).BackColor = RGB(255, 0, 0) + Else + oTable.getRows().getByIndex(i).BackColor = RGB(255, 255, 0) + End If + If oTable.getCellByPosition(2, j).getString() = "Yes" Then + oTable.getRows().getByIndex(j).BackColor = RGB(255, 0, 0) + Else + oTable.getRows().getByIndex(j).BackColor = RGB(255, 255,0) + End If + End If + Next + Next + Next +End Sub + + </ooo:source-code> + </ooo:module> + </ooo:library-embedded> + </ooo:libraries> + </office:script> + </office:scripts> + <office:font-face-decls> + <style:font-face style:name="OpenSymbol" svg:font-family="OpenSymbol" style:font-charset="x-symbol"/> + <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" style:font-family-generic="swiss"/> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> + <style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Microsoft YaHei" svg:font-family="'Microsoft YaHei'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="SimSun" svg:font-family="SimSun" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="sv" fo:country="SE" style:letter-kerning="true" style:font-name-asian="SimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="sv" fo:country="SE" style:letter-kerning="true" style:font-name-asian="SimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"> + <style:text-properties fo:language="en" fo:country="US" style:font-size-asian="10.5pt"/> + </style:style> + <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text"> + <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" fo:keep-with-next="always"/> + <style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Microsoft YaHei" style:font-family-asian="'Microsoft YaHei'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lucida Sans" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/> + </style:style> + <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"> + <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" loext:contextual-spacing="false" fo:line-height="120%"/> + </style:style> + <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list"> + <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss"/> + </style:style> + <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" text:number-lines="false" text:line-number="0"/> + <style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss" style:font-size-complex="12pt" style:font-style-complex="italic"/> + </style:style> + <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index"> + <style:paragraph-properties text:number-lines="false" text:line-number="0"/> + <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="swiss"/> + </style:style> + <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text"> + <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false"/> + <style:text-properties fo:font-size="130%" fo:font-weight="bold" style:font-size-asian="130%" style:font-weight-asian="bold" style:font-size-complex="130%" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Quotations" style:family="paragraph" style:parent-style-name="Standard" style:class="html"> + <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="1cm" fo:margin-top="0cm" fo:margin-bottom="0.499cm" loext:contextual-spacing="false" fo:text-indent="0cm" style:auto-text-indent="false"/> + </style:style> + <style:style style:name="Title" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="chapter"> + <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/> + <style:text-properties fo:font-size="28pt" fo:font-weight="bold" style:font-size-asian="28pt" style:font-weight-asian="bold" style:font-size-complex="28pt" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Subtitle" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="chapter"> + <style:paragraph-properties fo:margin-top="0.106cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" fo:text-align="center" style:justify-single-word="false"/> + <style:text-properties fo:font-size="18pt" style:font-size-asian="18pt" style:font-size-complex="18pt"/> + </style:style> + <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:class="text"> + <style:paragraph-properties fo:margin-top="0.353cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false"/> + <style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text"> + <style:paragraph-properties fo:margin-top="0.247cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false"/> + <style:text-properties fo:font-size="101%" fo:font-weight="bold" style:font-size-asian="101%" style:font-weight-asian="bold" style:font-size-complex="101%" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text"> + <style:text-properties style:font-name="OpenSymbol" fo:font-family="OpenSymbol" style:font-charset="x-symbol" style:font-name-asian="OpenSymbol" style:font-family-asian="OpenSymbol" style:font-charset-asian="x-symbol" style:font-name-complex="OpenSymbol" style:font-family-complex="OpenSymbol" style:font-charset-complex="x-symbol"/> + </style:style> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="1" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.762cm" fo:text-indent="-0.762cm" fo:margin-left="0.762cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="2" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.016cm" fo:text-indent="-1.016cm" fo:margin-left="1.016cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="3" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.27cm" fo:text-indent="-1.27cm" fo:margin-left="1.27cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="4" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.524cm" fo:text-indent="-1.524cm" fo:margin-left="1.524cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="5" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.778cm" fo:text-indent="-1.778cm" fo:margin-left="1.778cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="6" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.032cm" fo:text-indent="-2.032cm" fo:margin-left="2.032cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="7" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.286cm" fo:text-indent="-2.286cm" fo:margin-left="2.286cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="8" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-2.54cm" fo:margin-left="2.54cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="9" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.794cm" fo:text-indent="-2.794cm" fo:margin-left="2.794cm"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="10" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.048cm" fo:text-indent="-3.048cm" fo:margin-left="3.048cm"/> + </style:list-level-properties> + </text:outline-level-style> + </text:outline-style> + <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> + <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Text_20_body"> + <style:text-properties officeooo:rsid="001c4c5b" officeooo:paragraph-rsid="001c4c5b"/> + </style:style> + <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Text_20_body"> + <style:text-properties officeooo:rsid="0027107a" officeooo:paragraph-rsid="0027107a"/> + </style:style> + <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Text_20_body"> + <style:text-properties fo:font-weight="normal" officeooo:rsid="0027b74d" officeooo:paragraph-rsid="0027b74d" style:font-weight-asian="normal" style:font-weight-complex="normal"/> + </style:style> + <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Text_20_body"> + <style:text-properties fo:font-weight="normal" officeooo:rsid="0027107a" officeooo:paragraph-rsid="0027107a" style:font-weight-asian="normal" style:font-weight-complex="normal"/> + </style:style> + <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Heading_20_1"> + <style:text-properties officeooo:rsid="001c4c5b" officeooo:paragraph-rsid="001c4c5b"/> + </style:style> + <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard"> + <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/> + <style:text-properties style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-size="12pt" fo:font-style="normal" style:text-underline-style="none" fo:font-weight="normal"/> + </style:style> + <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Heading_20_1"> + <style:text-properties officeooo:rsid="001c4c5b" officeooo:paragraph-rsid="001c4c5b"/> + </style:style> + <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L1"> + <style:text-properties officeooo:rsid="0027107a" officeooo:paragraph-rsid="0027107a"/> + </style:style> + <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L1"> + <style:text-properties fo:font-weight="normal" officeooo:rsid="0027107a" officeooo:paragraph-rsid="0027107a" style:font-weight-asian="normal" style:font-weight-complex="normal"/> + </style:style> + <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L1"> + <style:text-properties fo:font-weight="normal" officeooo:rsid="0027b74d" officeooo:paragraph-rsid="0027b74d" style:font-weight-asian="normal" style:font-weight-complex="normal"/> + </style:style> + <style:style style:name="P11" style:family="paragraph"> + <style:paragraph-properties fo:text-align="center"/> + <style:text-properties style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-size="12pt" fo:font-style="normal" style:text-underline-style="none" fo:font-weight="normal"/> + </style:style> + <style:style style:name="T1" style:family="text"> + <style:text-properties officeooo:rsid="0023a8b2"/> + </style:style> + <style:style style:name="T2" style:family="text"> + <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="T3" style:family="text"> + <style:text-properties fo:font-weight="bold" officeooo:rsid="002ae357" style:font-weight-asian="bold" style:font-weight-complex="bold"/> + </style:style> + <style:style style:name="T4" style:family="text"> + <style:text-properties fo:font-weight="normal" style:font-weight-asian="normal" style:font-weight-complex="normal"/> + </style:style> + <style:style style:name="T5" style:family="text"> + <style:text-properties officeooo:rsid="00290da0"/> + </style:style> + <style:style style:name="T6" style:family="text"> + <style:text-properties officeooo:rsid="002ae357"/> + </style:style> + <style:style style:name="T7" style:family="text"> + <style:text-properties officeooo:rsid="002c2869"/> + </style:style> + <text:list-style style:name="L1"> + <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.27cm" fo:text-indent="-0.635cm" fo:margin-left="1.27cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" text:bullet-char="◦"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.905cm" fo:text-indent="-0.635cm" fo:margin-left="1.905cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" text:bullet-char="▪"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-0.635cm" fo:margin-left="2.54cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.175cm" fo:text-indent="-0.635cm" fo:margin-left="3.175cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" text:bullet-char="◦"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.81cm" fo:text-indent="-0.635cm" fo:margin-left="3.81cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" text:bullet-char="▪"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="4.445cm" fo:text-indent="-0.635cm" fo:margin-left="4.445cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.08cm" fo:text-indent="-0.635cm" fo:margin-left="5.08cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" text:bullet-char="◦"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.715cm" fo:text-indent="-0.635cm" fo:margin-left="5.715cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" text:bullet-char="▪"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.35cm" fo:text-indent="-0.635cm" fo:margin-left="6.35cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.985cm" fo:text-indent="-0.635cm" fo:margin-left="6.985cm"/> + </style:list-level-properties> + </text:list-level-style-bullet> + </text:list-style> + <style:style style:name="gr1" style:family="graphic"> + <style:graphic-properties style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <office:forms form:automatic-focus="false" form:apply-design-mode="false"> + <form:form form:name="Form" form:apply-filter="true" form:command-type="table" form:control-implementation="ooo:com.sun.star.form.component.Form" office:target-frame="" xlink:href="" xlink:type="simple"> + <form:properties> + <form:property form:property-name="PropertyChangeNotificationEnabled" office:value-type="boolean" office:boolean-value="true"/> + </form:properties> + <form:button form:name="Push Button 1" form:control-implementation="ooo:com.sun.star.form.component.CommandButton" xml:id="control1" form:id="control1" form:label="Generate report" office:target-frame="" xlink:href="" form:image-data="" form:delay-for-repeat="PT0.050000000S" form:image-position="center"> + <form:properties> + <form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.CommandButton"/> + </form:properties> + <office:event-listeners> + <script:event-listener script:language="ooo:script" script:event-name="form:performaction" xlink:href="vnd.sun.star.script:AcceleratorKeyCheck.__testMenu.testmenus?language=Basic&location=document" xlink:type="simple"/> + </office:event-listeners> + </form:button> + </form:form> + </office:forms> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + </text:sequence-decls> + <text:h text:style-name="P5" text:outline-level="1">Accelerator key check</text:h> + <text:p text:style-name="P1">This document contains some code to traverse the menus and generate a reports the contents of the main menu items and it's accelerator keys. If there is a duplicate and the menu item has a sub menu then that means that the user won't be able to reach the second menu item with the same accelerator key. Therefore it will be marked with a <text:span text:style-name="T2">red</text:span> background color. If it has the same key <text:span text:style-name="T6">but don't have a sub-menu it is marked with a </text:span><text:span text:style-name="T3">yellow</text:span><text:span text:style-name="T6"> background, this is still a problem </text:span>that should be fixed but the <text:span text:style-name="T7">problem</text:span> is just not <text:span text:style-name="T1">quite </text:span>as severe.</text:p> + <text:p text:style-name="P1"><draw:control text:anchor-type="as-char" svg:y="0cm" draw:z-index="0" draw:style-name="gr1" draw:text-style-name="P11" svg:width="3.89cm" svg:height="1.324cm" draw:control="control1"/></text:p> + <text:p text:style-name="P2">If nothing happens when you press Generate report then the macros have probably been blocked for security reasons. To allow the report tobe generated you need change this setting. To do this:</text:p> + <text:list xml:id="list8718540425442089522" text:style-name="L1"> + <text:list-item> + <text:p text:style-name="P8">Go to <text:span text:style-name="T2">Tools</text:span> → <text:span text:style-name="T2">Options</text:span> (or if your'e using Mac <text:span text:style-name="T2">LibreOffice → Preferences...</text:span><text:span text:style-name="T4">)</text:span></text:p> + </text:list-item> + <text:list-item> + <text:p text:style-name="P8"><text:span text:style-name="T4">In the tree list to the left of the dialog navigate to </text:span><text:span text:style-name="T2">LibreOffice → Security</text:span></text:p> + </text:list-item> + <text:list-item> + <text:p text:style-name="P8">Click on the button <text:span text:style-name="T2">Macro security</text:span><text:span text:style-name="T4">...</text:span></text:p> + </text:list-item> + <text:list-item> + <text:p text:style-name="P8"><text:span text:style-name="T4">Set the Security Level to </text:span><text:span text:style-name="T2">Medium</text:span></text:p> + </text:list-item> + <text:list-item> + <text:p text:style-name="P9">Close and reopen this document</text:p> + </text:list-item> + <text:list-item> + <text:p text:style-name="P10">You will get a warning that the document contains macros, click the button <text:span text:style-name="T2">Enable Macros</text:span>. </text:p> + </text:list-item> + </text:list> + <text:p text:style-name="P3">Of course you need to pay attention when this dialog shows up and don't <text:span text:style-name="T5">blindly </text:span>allow macros to run if you don't know where it comes from and what it does.</text:p> + </office:text> + </office:body> +</office:document> diff --git a/officecfg/util/alllang.xsl b/officecfg/util/alllang.xsl new file mode 100644 index 0000000000..b9b2d19835 --- /dev/null +++ b/officecfg/util/alllang.xsl @@ -0,0 +1,421 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> + +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + xmlns:install="http://openoffice.org/2004/installation" + exclude-result-prefixes="install"> + +<!-- Get the correct format --> +<xsl:output method="xml" indent="yes" encoding="UTF-8"/> + +<!--************************** PARAMETER ******************************** --> +<xsl:param name="locale"/> +<xsl:param name="module"/> +<xsl:param name="xcs"/> +<xsl:param name="schemaRoot">.</xsl:param> +<xsl:param name="fallback-locale">en-US</xsl:param> + +<xsl:param name="LIBO_SHARE_FOLDER"/> +<xsl:param name="LIBO_SHARE_HELP_FOLDER"/> + +<xsl:variable name="schemaRootURL"> + <xsl:value-of select="$schemaRoot"/> +</xsl:variable> +<xsl:variable name="schemaURL"> + <xsl:value-of select="$xcs"/> +</xsl:variable> + +<!--************************** TEMPLATES ******************************** --> +<!-- ensure that at least root is available --> + <xsl:template match="/oor:component-data"> + <xsl:copy> + <xsl:choose> + <xsl:when test="string-length($locale)"> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select = "node|prop" mode="locale"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select = "@*"/> + <xsl:for-each select="node|prop"> + <xsl:variable name="component-schema" select="document($schemaURL)/oor:component-schema"/> + <xsl:apply-templates select="."> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="context" select="$component-schema/component/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="find-module" select="$module"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> + </xsl:template> + +<!-- locale dependent data --> + <xsl:template match="node|prop" mode = "locale"> + <xsl:choose> + <xsl:when test="$locale=$fallback-locale"> + <xsl:if test="descendant::value[@xml:lang=$locale]/../value[not (@xml:lang)]"> + <xsl:copy> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select = "node|prop|value" mode = "locale"/> + </xsl:copy> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="descendant::value[@xml:lang = $locale]"> + <xsl:copy> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select = "node|prop|value" mode = "locale"/> + </xsl:copy> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="value" mode="locale"> + <xsl:if test="@xml:lang=$locale and not(@install:module)"> + <xsl:copy> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select="node()"/> + </xsl:copy> + </xsl:if> + </xsl:template> + + <xsl:template match = "@*" mode="locale"> + <xsl:copy/> + </xsl:template> + + <!-- suppress all merge instructions --> + <xsl:template match = "@oor:op" mode="locale"/> + + <!-- suppress all module markers --> + <xsl:template match = "@install:module" mode="locale"/> + +<!-- locale independent data --> + + <!-- handle template references --> + <xsl:template name="copy-resolve-template"> + <xsl:param name = "node-type"/> + <xsl:param name = "schema-type"/> + <xsl:param name = "component-schema"/> + + <xsl:choose> + <xsl:when test="$schema-type='node-ref'"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="$schema-type='set'"> + <xsl:copy> + <xsl:apply-templates select = "@*" /> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:copy> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">ERROR: The schema element for a <xsl:value-of select="$schema-type"/> + should not have a node-type. + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="copy-node"> + <xsl:param name = "context"/> + <xsl:param name = "component-schema"/> + + <xsl:choose> + <!-- look for matching templates in other components --> + <xsl:when test="$context/@oor:node-type and $context/@oor:component"> + <xsl:variable name="fileURL"> + <xsl:call-template name="composeFileURL"> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="componentName"><xsl:value-of select="$context/@oor:component"/></xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="copy-resolve-template"> + <xsl:with-param name="node-type" select="$context/@oor:node-type"/> + <xsl:with-param name="schema-type" select="local-name($context)"/> + <xsl:with-param name="component-schema" select="document($fileURL)/oor:component-schema"/> + </xsl:call-template> + </xsl:when> + <!-- look for matching templates within the same component --> + <xsl:when test="$context/@oor:node-type"> + <xsl:call-template name="copy-resolve-template"> + <xsl:with-param name="node-type" select="$context/@oor:node-type"/> + <xsl:with-param name="schema-type" select="local-name($context)"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select = "@*" /> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:copy> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="node"> + <xsl:param name = "context"/> + <xsl:param name = "component-schema"/> + + <xsl:variable name="applicable-values" select="descendant::value[not (@xml:lang) or (@xml:lang=$fallback-locale) or (@install:module=$module)]"/> + <xsl:variable name="substantive-nodes" select="descendant-or-self::*[(@oor:finalized='true') or (@oor:mandatory='true') or (@oor:op!='modify')]"/> + + <xsl:choose> + <!-- go ahead, if we are in the active module --> + <xsl:when test="ancestor-or-self::*/@install:module=$module"> + <xsl:if test="$applicable-values | $substantive-nodes"> + <xsl:call-template name="copy-node"> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="context" select="$context"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <!-- strip data from wrong module --> + <xsl:when test="ancestor-or-self::*/@install:module"/> + <!-- looking for module --> + <xsl:when test="$module"> + <xsl:if test="($applicable-values | $substantive-nodes)/ancestor-or-self::*/@install:module=$module"> + <xsl:call-template name="copy-node"> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="context" select="$context"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <!-- copying non-module data --> + <xsl:otherwise> + <xsl:if test="($applicable-values | $substantive-nodes)[not(ancestor-or-self::*/@install:module)]"> + <xsl:call-template name="copy-node"> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="context" select="$context"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="prop"> + <xsl:param name = "context"/> + <xsl:choose> + <xsl:when test="$module and not((ancestor-or-self::* | child::value)/@install:module=$module)"/> + <xsl:when test="not($module) and ancestor-or-self::*/@install:module"/> + <xsl:when test="not ($context) or @oor:finalized='true' or @oor:op!='modify'"> + <xsl:copy> + <xsl:apply-templates select = "@*"/> + <xsl:apply-templates select = "value"/> + </xsl:copy> + </xsl:when> + <xsl:when test="value[not (@xml:lang) or @install:module]"> + <xsl:if test="value[not(@install:module) or @install:module=$module]"> + <!-- copy locale independent values only, if the values differ --> + <xsl:variable name="isRedundant"> + <xsl:call-template name="isRedundant"> + <xsl:with-param name="schemaval" select="$context/value"/> + <xsl:with-param name="dataval" select="value[(not(@xml:lang) or @install:module) and (not(@install:module) or @install:module=$module)]"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$isRedundant ='false'"> + <xsl:copy> + <xsl:apply-templates select = "@*"/> + <xsl:apply-templates select = "value"/> + </xsl:copy> + </xsl:if> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select = "@*"/> + <xsl:apply-templates select = "value" mode="fallback-locale"/> + </xsl:copy> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="value"> + <xsl:choose> + <xsl:when test="@xml:lang and not(@install:module)"/> + <xsl:when test="$module and not(ancestor-or-self::*/@install:module=$module)"/> + <xsl:when test="not($module) and ancestor-or-self::*/@install:module"/> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select = "@*|node()"/> + </xsl:copy> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="value" mode="fallback-locale"> + <xsl:if test="@xml:lang=$fallback-locale and not(@install:module)"> + <xsl:copy> + <xsl:apply-templates select = "@*|node()"/> + </xsl:copy> + </xsl:if> + </xsl:template> + + <xsl:template match ="it|unicode"> + <xsl:copy> + <xsl:apply-templates select = "@*|node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match = "@*"> + <xsl:copy/> + </xsl:template> + + <!-- suppress all merge instructions, that are out-of-module --> + <xsl:template match = "@oor:op"> + <xsl:if test="not($module) or ancestor::*/@install:module"> + <xsl:copy/> + </xsl:if> + </xsl:template> + + <!-- suppress all module markers --> + <xsl:template match = "@install:module"/> + +<!-- compares two values --> + <xsl:template name="isRedundant"> + <xsl:param name = "schemaval"/> + <xsl:param name = "dataval"/> + <xsl:choose> + <xsl:when test="not ($dataval)"> + <xsl:value-of select="true()"/> + </xsl:when> + <xsl:when test="$dataval/@oor:external"> + <xsl:value-of select="false()"/> + </xsl:when> + <xsl:when test="not ($schemaval)"> + <xsl:choose> + <xsl:when test="$dataval/@xsi:nil='true'"> + <xsl:value-of select="true()"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="false()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$schemaval != $dataval"> + <xsl:value-of select="false()"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="true()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="composeFileURL"> + <xsl:param name="componentName"/> + <xsl:variable name="fileURL"> + <xsl:value-of select="$schemaRootURL"/>/<xsl:value-of select="translate($componentName,'.','/')"/><xsl:text>.xcs</xsl:text> + </xsl:variable> + <xsl:value-of select="$fileURL"/> + </xsl:template> + + <xsl:template match="@oor:name"> + <xsl:attribute name="oor:name"> + <xsl:call-template name="replacetwo"> + <xsl:with-param name="input" select="current()"/> + <xsl:with-param name="pattern1" select="'@LIBO_SHARE_FOLDER@'"/> + <xsl:with-param name="replace1" select="$LIBO_SHARE_FOLDER"/> + <xsl:with-param name="pattern2" select="'@LIBO_SHARE_HELP_FOLDER@'"/> + <xsl:with-param name="replace2" select="$LIBO_SHARE_HELP_FOLDER"/> + </xsl:call-template> + </xsl:attribute> + </xsl:template> + + <xsl:template match="text()"> + <xsl:call-template name="replacetwo"> + <xsl:with-param name="input" select="current()"/> + <xsl:with-param name="pattern1" select="'@LIBO_SHARE_FOLDER@'"/> + <xsl:with-param name="replace1" select="$LIBO_SHARE_FOLDER"/> + <xsl:with-param name="pattern2" select="'@LIBO_SHARE_HELP_FOLDER@'"/> + <xsl:with-param name="replace2" select="$LIBO_SHARE_HELP_FOLDER"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="replace"> + <xsl:param name="input"/> + <xsl:param name="pattern"/> + <xsl:param name="replace"/> + <xsl:choose> + <xsl:when test="contains($input, $pattern)"> + <xsl:value-of select="substring-before($input, $pattern)"/> + <xsl:value-of select="$replace"/> + <xsl:call-template name="replace"> + <xsl:with-param + name="input" select="substring-after($input, $pattern)"/> + <xsl:with-param name="pattern" select="$pattern"/> + <xsl:with-param name="replace" select="$replace"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$input"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="replacetwo"> + <xsl:param name="input"/> + <xsl:param name="pattern1"/> + <xsl:param name="replace1"/> + <xsl:param name="pattern2"/> + <xsl:param name="replace2"/> + <xsl:choose> + <xsl:when test="contains($input, $pattern1)"> + <xsl:call-template name="replace"> + <xsl:with-param + name="input" select="substring-before($input, $pattern1)"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> + <xsl:value-of select="$replace1"/> + <xsl:call-template name="replacetwo"> + <xsl:with-param + name="input" select="substring-after($input, $pattern1)"/> + <xsl:with-param name="pattern1" select="$pattern1"/> + <xsl:with-param name="replace1" select="$replace1"/> + <xsl:with-param name="pattern2" select="$pattern2"/> + <xsl:with-param name="replace2" select="$replace2"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="replace"> + <xsl:with-param + name="input" select="$input"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:transform> diff --git a/officecfg/util/data_val.xsl b/officecfg/util/data_val.xsl new file mode 100644 index 0000000000..3e2200dbd5 --- /dev/null +++ b/officecfg/util/data_val.xsl @@ -0,0 +1,320 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> + +<!-- ************************************************************************************** --> +<!-- * Transformation from New Format XCS & XCU to schema description *** --> +<!-- ************************************************************************************** --> +<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + xmlns:install="http://openoffice.org/2004/installation"> + +<!-- Get the correct format --> +<xsl:output method="xml" indent="yes" /> + +<xsl:param name="xcs"/> +<xsl:param name="schemaRoot">.</xsl:param> + +<xsl:variable name="schemaRootURL"> + <xsl:value-of select="$schemaRoot"/> +</xsl:variable> +<xsl:variable name="schemaURL"> + <xsl:value-of select="$xcs"/> +</xsl:variable> + +<!-- ************************************** --> +<!-- * oor:component-data *** --> +<!-- ************************************** --> + <xsl:template match="/oor:component-data"> + <xsl:variable name="component-schema" select="document($schemaURL)/oor:component-schema"/> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/component/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="parent-schema-type" select="local-name($component-schema)"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:template> + +<!-- ****************************************** --> +<!-- * handle template references *** --> +<!-- ****************************************** --> + <xsl:template name="resolve-template"> + <xsl:param name = "node-type"/> + <xsl:param name = "schema-type"/> + <xsl:param name = "component-schema"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + + <xsl:if test="not ($component-schema)"> + <xsl:message terminate="yes">ERROR: Template '<xsl:value-of select="$node-type"/>', + referenced from node '<xsl:value-of select="$path"/>' + does not exist in schema! + </xsl:message> + </xsl:if> + + <xsl:choose> + <xsl:when test="$schema-type='node-ref'"> + <xsl:variable name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$context"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="parent-schema-type" select="local-name($context)"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="$schema-type='set'"> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="parent-schema-type" select="$schema-type"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">ERROR: The schema element for node <xsl:value-of select="$path"/> + is a <xsl:value-of select="$schema-type"/> and should not have a node-type. + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +<!-- ****************************************** --> +<!-- * node *** --> +<!-- ****************************************** --> + <xsl:template match="node"> + <xsl:param name = "context"/> + <xsl:param name = "component-schema"/> + <xsl:param name = "parent-schema-type"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + + <xsl:if test="not ($context)"> + <xsl:message terminate="yes">ERROR: Node '<xsl:value-of select="$path"/>' does not exist in schema!</xsl:message> + </xsl:if> + + <xsl:call-template name="checkModule"/> + <xsl:call-template name="checkDuplicates"/> + + <xsl:choose> + <!-- look for matching templates in other components --> + <xsl:when test="$context/@oor:node-type and $context/@oor:component"> + <xsl:variable name="fileURL"> + <xsl:call-template name="composeFileURL"> + <xsl:with-param name="componentName"><xsl:value-of select="$context/@oor:component"/></xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:call-template name="resolve-template"> + <xsl:with-param name="node-type" select="$context/@oor:node-type"/> + <xsl:with-param name="schema-type" select="local-name($context)"/> + <xsl:with-param name="component-schema" select="document($fileURL)/oor:component-schema"/> + </xsl:call-template> + </xsl:when> + <!-- look for matching templates within the same component --> + <xsl:when test="$context/@oor:node-type"> + <xsl:call-template name="resolve-template"> + <xsl:with-param name="node-type" select="$context/@oor:node-type"/> + <xsl:with-param name="schema-type" select="local-name($context)"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + </xsl:call-template> + </xsl:when> + <!-- is the node extensible ? --> + <xsl:when test="$context/@oor:extensible='true'"> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="." mode="extensible"> + <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="parent-schema-type" select="local-name($context)"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="parent-schema-type" select="local-name($context)"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="@oor:mandatory='true' and $parent-schema-type!='set'"> + <xsl:message terminate="yes">ERROR: Node '<xsl:value-of select="$path"/>' that is not a set element is marked as mandatory!</xsl:message> + </xsl:if> + </xsl:template> + +<!-- ****************************************** --> +<!-- * prop *** --> +<!-- ****************************************** --> + <xsl:template match="prop"> + <xsl:param name = "context"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + + + <xsl:if test="not ($context)"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not exist in schema !</xsl:message> + </xsl:if> + + <xsl:if test="@oor:op"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has unexpected operation '<xsl:value-of select="@oor:op"/>' !</xsl:message> + </xsl:if> + + <xsl:if test="not($context/@oor:localized='true')"> + <xsl:for-each select="value"> + <xsl:if test="@xml:lang"> + <xsl:message terminate="yes">ERROR: Non-localized property '<xsl:value-of select="$path"/>' has value for xml:lang='<xsl:value-of select="@xml:lang"/>'!</xsl:message> + </xsl:if> + </xsl:for-each> + </xsl:if> + + <xsl:call-template name="checkModule"/> + <xsl:call-template name="checkDuplicates"/> + + <xsl:apply-templates /> + </xsl:template> + +<!-- ****************************************** --> +<!-- * value *** --> +<!-- ****************************************** --> + <xsl:template match="value"> + <xsl:call-template name="checkModule"/> + <xsl:variable name="path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + <xsl:variable name="lang" select="@xml:lang"/> + <xsl:variable name="module" select="@install:module"/> + <xsl:if test="$module and $lang='x-no-translate'"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has value for special xml:lang="x-no-translate" in module <xsl:value-of select="$module"/>.</xsl:message> + </xsl:if> + <xsl:choose> + <xsl:when + test="preceding-sibling::value[($lang and not(@xml:lang)) or (not($lang) and @xml:lang)]"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has values with and without xml:lang attributes.</xsl:message> + </xsl:when> + <xsl:when + test="preceding-sibling::value[((not($lang) and not(@xml:lang)) or $lang=@xml:lang) and ((not($module) and not(@install:module)) or $module=@install:module)]"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has values with matching xml:lang attribute <xsl:value-of select="$lang"/> and inconsistent install:module attributes.</xsl:message> + </xsl:when> + </xsl:choose> + </xsl:template> + +<!-- ****************************************** --> +<!-- * node (mode:extensible) - not supported * --> +<!-- ****************************************** --> + <xsl:template match="node" mode="extensible"> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + + <xsl:message terminate="yes">ERROR: Node '<xsl:value-of select="$path"/>' is within an extensible node!</xsl:message> + </xsl:template> +<!-- ****************************************** --> +<!-- * prop (mode:extensible) *** --> +<!-- ****************************************** --> + <xsl:template match="prop" mode="extensible"> + <xsl:param name = "context"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + + <xsl:choose> + <xsl:when test="not(@oor:op)"> + <xsl:if test="not ($context)"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not exist in schema!</xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="@oor:op='replace'"> + <xsl:if test="not (@oor:type)"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not have a type!</xsl:message> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has unexpected operation '<xsl:value-of select="@oor:op"/>'!</xsl:message> + </xsl:otherwise> + </xsl:choose> + + <!-- Extension properties are always non-localized: --> + <xsl:for-each select="value"> + <xsl:if test="@xml:lang"> + <xsl:message terminate="yes">ERROR: Non-localized extension property '<xsl:value-of select="$path"/>' has value for xml:lang='<xsl:value-of select="@xml:lang"/>'!</xsl:message> + </xsl:if> + </xsl:for-each> + + <xsl:call-template name="checkModule"/> + <xsl:call-template name="checkDuplicates"/> + </xsl:template> + + +<!-- ************************************* --> +<!-- * checkDuplicates *** --> +<!-- ************************************* --> + <xsl:template name="checkDuplicates"> + <xsl:variable name="item-name" select="@oor:name"/> + <xsl:if test="following-sibling::*[@oor:name = $item-name]"> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + <xsl:message terminate="yes">ERROR: Duplicate node/prop '<xsl:value-of select="$path"/>'!</xsl:message> + </xsl:if> + </xsl:template> + + +<!-- ************************************* --> +<!-- * checkModule *** --> +<!-- ************************************* --> + <xsl:template name="checkModule"> + <xsl:if test="@install:module"> + <xsl:if test="ancestor::*[@install:module]"> + <xsl:message terminate="yes">ERROR: Nested modules are not supported. Found module '<xsl:value-of select="@install:module"/>' within module '<xsl:value-of select="ancestor::*/@install:module"/>'! + </xsl:message> + </xsl:if> + </xsl:if> + </xsl:template> + +<!-- ************************************* --> +<!-- * collectPath *** --> +<!-- ************************************* --> + <xsl:template name="collectPath"> + <xsl:for-each select="ancestor-or-self::node()[@oor:name]"> + <xsl:text>/</xsl:text><xsl:value-of select="@oor:name"/> + </xsl:for-each> + </xsl:template> + + +<!-- ****************************** --> +<!-- * composeFileURL *** --> +<!-- ****************************** --> + <xsl:template name="composeFileURL"> + <xsl:param name="componentName"/> + <xsl:variable name="fileURL"> + <xsl:value-of select="$schemaRootURL"/>/<xsl:value-of select="translate($componentName,'.','/')"/><xsl:text>.xcs</xsl:text> + </xsl:variable> + <xsl:value-of select="$fileURL"/> + </xsl:template> + + +</xsl:transform> + diff --git a/officecfg/util/delcomment.sed b/officecfg/util/delcomment.sed new file mode 100755 index 0000000000..7f47aaeb21 --- /dev/null +++ b/officecfg/util/delcomment.sed @@ -0,0 +1 @@ +/^<!--/,/-->/ d diff --git a/officecfg/util/schema_trim.xsl b/officecfg/util/schema_trim.xsl new file mode 100644 index 0000000000..0e0f06fba7 --- /dev/null +++ b/officecfg/util/schema_trim.xsl @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <!-- -*- indent-tabs-mode: nil -*- --> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> + +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + version="1.0"> + + <xsl:param name="LIBO_SHARE_FOLDER"/> + <xsl:param name="LIBO_SHARE_HELP_FOLDER"/> + + <!-- Get the correct format --> + <xsl:output method="xml" indent="yes"/> + <xsl:namespace-alias stylesheet-prefix="xs" result-prefix="xs"></xsl:namespace-alias> + + <!-- Remove all comments from the schema files --> + <xsl:template match="*|@*"> + <xsl:copy> + <xsl:apply-templates select="*|@*"/> + </xsl:copy> + </xsl:template> + + <!-- suppress the location of the schema --> + <xsl:template match = "@xsi:schemaLocation"/> + + <!-- suppress the constraints of the schema + <xsl:template match = "constraints"/> --> + + <!-- suppress all documentation items + <xsl:template match = "info"/> --> + + <!-- suppress constraints for deprecated items --> + <xsl:template match = "constraints[../info/deprecated]"/> + + <!-- suppress all documentation for deprecated items --> + <xsl:template match = "desc[../deprecated]"/> + <xsl:template match = "label[../deprecated]"/> + + <!-- copy all other documentation with content --> + <xsl:template match="info|desc|label"> + <xsl:copy> + <xsl:apply-templates select="@*"/> + <xsl:value-of select="."/> + </xsl:copy> + </xsl:template> + + <!-- suppress all author items --> + <xsl:template match = "author"/> + + <!-- suppress values, which are marked as nil --> + <xsl:template match="value[@xsi:nil='true']" /> + + <!-- copy all other values with content --> + <xsl:template match="value"> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match ="it|unicode"> + <xsl:copy> + <xsl:apply-templates select = "@*|node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="text()"> + <xsl:call-template name="replacetwo"> + <xsl:with-param name="input" select="current()"/> + <xsl:with-param name="pattern1" select="'@LIBO_SHARE_FOLDER@'"/> + <xsl:with-param name="replace1" select="$LIBO_SHARE_FOLDER"/> + <xsl:with-param name="pattern2" select="'@LIBO_SHARE_HELP_FOLDER@'"/> + <xsl:with-param name="replace2" select="$LIBO_SHARE_HELP_FOLDER"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="replace"> + <xsl:param name="input"/> + <xsl:param name="pattern"/> + <xsl:param name="replace"/> + <xsl:choose> + <xsl:when test="contains($input, $pattern)"> + <xsl:value-of select="substring-before($input, $pattern)"/> + <xsl:value-of select="$replace"/> + <xsl:call-template name="replace"> + <xsl:with-param name="input" select="substring-after($input, $pattern)"/> + <xsl:with-param name="pattern" select="$pattern"/> + <xsl:with-param name="replace" select="$replace"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$input"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="replacetwo"> + <xsl:param name="input"/> + <xsl:param name="pattern1"/> + <xsl:param name="replace1"/> + <xsl:param name="pattern2"/> + <xsl:param name="replace2"/> + <xsl:choose> + <xsl:when test="contains($input, $pattern1)"> + <xsl:call-template name="replace"> + <xsl:with-param name="input" select="substring-before($input, $pattern1)"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> + <xsl:value-of select="$replace1"/> + <xsl:call-template name="replacetwo"> + <xsl:with-param name="input" select="substring-after($input, $pattern1)"/> + <xsl:with-param name="pattern1" select="$pattern1"/> + <xsl:with-param name="replace1" select="$replace1"/> + <xsl:with-param name="pattern2" select="$pattern2"/> + <xsl:with-param name="replace2" select="$replace2"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="replace"> + <xsl:with-param name="input" select="$input"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:transform> diff --git a/officecfg/util/schema_val.xsl b/officecfg/util/schema_val.xsl new file mode 100644 index 0000000000..38478ea8bb --- /dev/null +++ b/officecfg/util/schema_val.xsl @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> + +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + version="1.0"> + +<!-- Get the correct format --> +<xsl:output method="xml" indent="yes"/> +<xsl:namespace-alias stylesheet-prefix="xs" result-prefix="xs"></xsl:namespace-alias> + +<!-- Parameter --> +<xsl:param name="root">../registry/schema</xsl:param> +<xsl:param name="schemaRoot"/> +<xsl:param name="componentName"/> + + <xsl:template match = "/"> + <xsl:apply-templates/> + </xsl:template> + +<!-- activate attribute templates --> + <xsl:template match="group|set|prop"> + <xsl:apply-templates select="*|@*"/> + </xsl:template> + +<!-- make sure that missing features are not invoked --> + <xsl:template match = "item"> + <xsl:message terminate="yes">ERROR: multiple template types for sets are NOT supported!</xsl:message> + </xsl:template> + + <xsl:template match = "set[@oor:extensible='true']"> + <xsl:message terminate="yes">ERROR: extensible sets are currently NOT supported!</xsl:message> + </xsl:template> + + <xsl:template match = "group[@oor:extensible='true']"> + <xsl:if test="count(child::set) or count(child::group) or count(child::node-ref)"> + <xsl:message terminate="yes">ERROR: extensible groups with children are currently NOT supported!</xsl:message> + </xsl:if> + <xsl:apply-templates select="*|@*"/> + </xsl:template> + +<!-- Localized info elements (desc/label) are not supported currently --> + <xsl:template match="info//*[@xml:lang]"> + <xsl:message terminate="yes">ERROR: Info elements (desc/label) are currently not localized. Remove xml:lang attributes!</xsl:message> + </xsl:template> + +<!-- check for duplicate child names --> + <xsl:template match="@oor:name"> + <xsl:variable name="item-name" select="."/> + <xsl:if test="../following-sibling::*[@oor:name = $item-name]"> + <xsl:message terminate="yes">ERROR: Duplicate node name '<xsl:value-of select="$item-name"/>'!</xsl:message> + </xsl:if> + </xsl:template> + +<!-- check if properties of type 'any' do not have a value --> + <xsl:template match="prop[@oor:type='oor:any']"> + <xsl:if test="count(value)"> + <xsl:message terminate="yes">ERROR: Properties of type 'oor:any' MUST NOT have a value!</xsl:message> + </xsl:if> + <xsl:apply-templates select="*|@*"/> + </xsl:template> + +<!-- inhibit (explicit) NIL values --> + <xsl:template match="value[@xsi:nil]"> + <xsl:message terminate="yes">ERROR: xsi:nil is not allowed in schemas !</xsl:message> + </xsl:template> + +<!-- validate for correct node references --> + <xsl:template match="@oor:node-type"> + <xsl:choose> + <xsl:when test="../@oor:component"> + <xsl:variable name ="file"> + <xsl:call-template name="locateFile"><xsl:with-param name="componentName" select="../@oor:component"/></xsl:call-template> + </xsl:variable> + <xsl:if test="not(document($file)/oor:component-schema/templates/*[@oor:name=current()])"> + <xsl:message terminate="yes">ERROR: node-type '<xsl:value-of select="current()"/>' not found!</xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="not(/oor:component-schema/templates/*[@oor:name=current()])"> + <xsl:message terminate="yes">ERROR: node-type '<xsl:value-of select="current()"/>' not found!</xsl:message> + </xsl:when> + </xsl:choose> + </xsl:template> + +<!-- validate if file name matches component-name --> + <xsl:template match="oor:component-schema"> + <xsl:variable name ="fullName"><xsl:value-of select="@oor:package"/>.<xsl:value-of select="@oor:name"/></xsl:variable> + <xsl:if test="$fullName != $componentName"> + <xsl:message terminate="yes">ERROR: Component name '<xsl:value-of select="$fullName"/>' does not match with file name!</xsl:message> + </xsl:if> + <xsl:apply-templates select="*|@*"/> + </xsl:template> + + +<!-- locate a component file --> + <xsl:template name="locateFile"> + <xsl:param name="componentName"/> + <xsl:variable name="path"><xsl:value-of select="translate($componentName,'.','/')"/>.xcs</xsl:variable> + <xsl:variable name ="file"> + <xsl:variable name ="tryfile" select="concat($root,'/',$path)"/> + <xsl:choose> + <xsl:when test="document($tryfile)"> + <xsl:value-of select="$tryfile"/> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$schemaRoot"> + <xsl:variable name="globalfile" select="concat($schemaRoot,'/',$path)"/> + <xsl:if test="document($globalfile)"> + <xsl:value-of select="$globalfile"/> + </xsl:if> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="not($file)"> + <xsl:message terminate ="yes">**Error: unable to locate document '<xsl:value-of select="$path"/>'</xsl:message> + </xsl:if> + <xsl:value-of select="$file"/> + </xsl:template> + +</xsl:transform> |