This is an automated email from the ASF dual-hosted git repository. leginee pushed a commit to branch bazel-migration in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 0d745a9e937fa9f1ca8064b7dfde6a9d4fe03a59 Author: Peter Kovacs <[email protected]> AuthorDate: Thu Jun 18 05:43:14 2026 +0200 fix dropdown new menu with items and icons. --- build/rules/BUILD.bazel | 4 ++ build/rules/normalize_idlist.pl | 84 +++++++++++++++++++++++++++++++++++++++++ build/rules/rsc_pipeline.bzl | 29 +++++++++++++- main/avmedia/BUILD.bazel | 8 ++++ main/basctl/BUILD.bazel | 5 ++- main/default_images/BUILD.bazel | 6 +++ main/extensions/BUILD.bazel | 3 ++ main/officecfg/BUILD.bazel | 19 +++++++++- main/reportdesign/BUILD.bazel | 5 ++- main/svx/BUILD.bazel | 3 ++ 10 files changed, 162 insertions(+), 4 deletions(-) diff --git a/build/rules/BUILD.bazel b/build/rules/BUILD.bazel index f5d7cac24d..03cb1e73e7 100644 --- a/build/rules/BUILD.bazel +++ b/build/rules/BUILD.bazel @@ -1 +1,5 @@ # Starlark rule definitions — no build targets here, only .bzl exports. + +# Helper script used by rsc_pipeline.bzl (rsc_res) to normalize ImageList +# IdList blocks in generated .srs files so rsc2 can resolve Prefix+Id images. +exports_files(["normalize_idlist.pl"]) diff --git a/build/rules/normalize_idlist.pl b/build/rules/normalize_idlist.pl new file mode 100644 index 0000000000..9ac3e970b4 --- /dev/null +++ b/build/rules/normalize_idlist.pl @@ -0,0 +1,84 @@ +#!/usr/bin/perl +#************************************************************** +# Normalize ImageList IdList blocks in an rsc .srs (stdin -> stdout). +# +# WHY: rsc2's PreprocessSrsFile() (main/rsc/source/rsc/rsc.cxx) resolves the +# Prefix+Id images of an `ImageList { Prefix="sx"; IdList={...}; }` resource by +# scanning the .srs line-by-line and accepting ONLY entries that are a single +# pure integer per line (String::IsNumericAscii) before forming the image file +# name (e.g. "sx" + "0" + "3123" -> sx03123.png) and looking it up via -lip. +# +# Our pipeline produces the .srs with `rscpp` (a plain C preprocessor), which +# leaves the IdList entries as UNEVALUATED expressions all on one line, e.g. +# IdList = +# { +# (3076 + 47) ; (3076 + 50) ; ... ; +# }; +# IsNumericAscii rejects every one of these, so rsc2 embeds an EMPTY image list +# and every Prefix+Id icon (svtools document-type icons, navigator/toolbox +# images in ~44 .src files) silently vanishes from the .res. Upstream's rsc +# first pass evaluates the expressions and writes one integer per line; this +# script reproduces that for the rscpp+rsc2 split. +# +# WHAT: inside each `IdList = { ... }` block, evaluate every additive numeric +# expression "(BASE + N [+ ...])" to a plain integer and emit one entry per +# line. Non-numeric tokens (e.g. leftover cpp line-markers like "# 137") are +# passed through untouched — rsc2 already skips them. The rsc2 COMPILE pass +# evaluated these same expressions itself, so this is behaviour-preserving for +# compilation and only repairs the image pre-pass. +#************************************************************** +use strict; +use warnings; + +local $/; # slurp whole file +my $text = <STDIN>; + +$text =~ s{(IdList\s*=\s*\{)(.*?)(\})}{ normalize($1, $2, $3, $`) }ges; + +print $text; + +sub normalize { + my ($head, $body, $tail, $pre) = @_; + # Only repair IdLists whose entries are the UNEVALUATED arithmetic that rscpp + # leaves behind, e.g. "(3076 + 47)". Those always contain a '+'. Plain + # numeric or symbolic-already-resolved IdLists ("1; 2;", "36; 37;") were never + # affected by that bug, and many appear inline inside macros next to a + # Color{...} mask whose stray '}' would desync rsc2's line scanner if we + # reformatted them — so leave such blocks BYTE-FOR-BYTE unchanged. + return $head . $body . $tail unless $body =~ /\+/; + + # Only act when the enclosing ImageList uses capital "Prefix". rsc2's image + # resolver scans case-sensitively for "Prefix"; some .src (dbaccess, + # reportdesign GroupsSorting/CondFormat) write lowercase "prefix", which it + # never sees → it would form an empty-prefix name like "30768" and + # FatalError(ERR_NOIMAGE). Upstream leaves those image lists empty too, so + # if the nearest prefix keyword in THIS ImageList is lowercase, don't touch + # the block. Bound the search to the current ImageList (text after the last + # "ImageList" keyword) so a previous block's Prefix can't leak in. + my $block = $pre; + $block =~ s/.*\bImageList\b//s; + my $kw = ''; + $kw = $1 while $block =~ /([Pp])refix\s*=/g; + return $head . $body . $tail unless $kw eq 'P'; + + my @out; + for my $tok (split /;/, $body) { + $tok =~ s/^\s+//; + $tok =~ s/\s+$//; + next if $tok eq ''; + if ($tok =~ /^[\d\s()+]+$/) { # additive numeric expression + my $sum = 0; + $sum += $_ for ($tok =~ /(\d+)/g); + push @out, $sum; + } else { # leave anything else as-is + push @out, $tok; + } + } + # Always emit CANONICAL form: a leading newline so "IdList" starts on its + # own line (some .src use macros that put "MaskColor=Color{...}; IdList={...}" + # on ONE line — rsc2's PreprocessSrsFile scans for the "IdList" line and stops + # at the FIRST '}', so a stray '}' from an inline Color{} on that same line + # breaks it). "IdList =" / "{" / one-int-per-line / "}" is the form rsc2's + # scanner reliably consumes. + return "\nIdList =\n{\n" . join('', map { "$_;\n" } @out) . "}"; +} diff --git a/build/rules/rsc_pipeline.bzl b/build/rules/rsc_pipeline.bzl index 6cb94fa2dc..b64b2d5486 100644 --- a/build/rules/rsc_pipeline.bzl +++ b/build/rules/rsc_pipeline.bzl @@ -240,7 +240,28 @@ def _rsc_res_impl(ctx): mnemonic = "RscFixBitmaps", progress_message = "Fixing Bitmap blocks in %s" % srs_int.basename, ) - srs_for_rsc2.append(srs_fixed) + + # ── Step 1.6: Normalize ImageList IdList blocks ─────────────────────── + # rscpp leaves IdList entries as unevaluated "(BASE + N)" expressions all + # on one line. rsc2's PreprocessSrsFile() image resolver only accepts a + # single pure integer per line, so without this every Prefix+Id image + # (svtools document-type icons, navigator/toolbox images, ~44 .src files) + # is dropped from the .res. Evaluate + one-per-line; see normalize_idlist.pl. + srs_idlist = ctx.actions.declare_file( + ctx.label.name + "_srs_idlist/" + srs_int.basename, + ) + ctx.actions.run_shell( + command = ( + "perl '" + ctx.file._fix_idlist.path + "' < '" + + srs_fixed.path + "' > '" + srs_idlist.path + "'" + ), + inputs = [srs_fixed, ctx.file._fix_idlist], + outputs = [srs_idlist], + use_default_shell_env = True, + mnemonic = "RscFixImageList", + progress_message = "Normalizing ImageList IdLists in %s" % srs_int.basename, + ) + srs_for_rsc2.append(srs_idlist) # ── Step 2: Compile all .srs intermediates → .res with rsc2 ────────── ctx.actions.run( @@ -306,6 +327,12 @@ rsc_res = rule( cfg = "exec", allow_files = True, ), + "_fix_idlist": attr.label( + default = "//build/rules:normalize_idlist.pl", + allow_single_file = True, + cfg = "exec", + doc = "perl script that evaluates ImageList IdList expressions to one-int-per-line so rsc2 can resolve Prefix+Id images", + ), # ── Runtime DLLs (individual single-file attrs) ────────────────── "_sal_dll": attr.label( default = "//main/sal:sal", diff --git a/main/avmedia/BUILD.bazel b/main/avmedia/BUILD.bazel index 7969f169d1..3dae64fa61 100644 --- a/main/avmedia/BUILD.bazel +++ b/main/avmedia/BUILD.bazel @@ -180,6 +180,14 @@ rsc_res( srcs = glob(["source/**/*.src"]), hdrs = glob(["source/**/*.hrc"]), includes = ["main/avmedia/source"], + # mediacontrol.src has ImageList resources (av/avl/avh/avlh prefixes); the + # icons must be supplied so rsc2 can resolve them. images_root makes the + # stored path "avmedia/res/av0NNNN.png" match the images.zip entry. + images = [ + "//main/default_images:avmedia_res_images", + "//main/default_images:shared_images", + ], + images_root = "main/default_images", visibility = ["//visibility:public"], ) diff --git a/main/basctl/BUILD.bazel b/main/basctl/BUILD.bazel index 9352ea99c6..5620856fa3 100644 --- a/main/basctl/BUILD.bazel +++ b/main/basctl/BUILD.bazel @@ -192,7 +192,10 @@ rsc_res( "main/svtools/inc", "main/editeng/inc", ], - images = ["//main/default_images:basctl_res_images"], + images = [ + "//main/default_images:basctl_res_images", + "//main/default_images:shared_images", + ], images_root = "main/default_images", visibility = ["//visibility:public"], ) diff --git a/main/default_images/BUILD.bazel b/main/default_images/BUILD.bazel index 15815dde87..9d4dad3df0 100644 --- a/main/default_images/BUILD.bazel +++ b/main/default_images/BUILD.bazel @@ -52,6 +52,12 @@ filegroup( visibility = ["//visibility:public"], ) +filegroup( + name = "avmedia_res_images", + srcs = glob(["avmedia/res/**"]), + visibility = ["//visibility:public"], +) + filegroup( name = "basctl_res_images", srcs = glob(["basctl/res/**"]), diff --git a/main/extensions/BUILD.bazel b/main/extensions/BUILD.bazel index 51994d8f02..ea1aa20179 100644 --- a/main/extensions/BUILD.bazel +++ b/main/extensions/BUILD.bazel @@ -294,6 +294,9 @@ rsc_res( "main/sfx2/inc", "main/editeng/inc", ], + # toolbar.src has ImageList resources (sc/lc/sch/lch prefixes) → supply icons. + images = ["//main/default_images:shared_images"], + images_root = "main/default_images", ) # dbp.res — database pilots diff --git a/main/officecfg/BUILD.bazel b/main/officecfg/BUILD.bazel index 7fd8402c68..ac9f02af27 100644 --- a/main/officecfg/BUILD.bazel +++ b/main/officecfg/BUILD.bazel @@ -216,17 +216,34 @@ filegroup( # # Naming: alllang_module_<xcu_id>_<module> # where xcu_id = xcu path with / and . replaced by _ +# +# The xcs/schemaRoot params are REQUIRED here for the SAME reason as the default +# spool below (see that block's long comment). alllang.xsl's prop template +# decides "localized-only fallback" vs "mergeable" by inspecting the schema node +# from document($xcs); the `module` param only selects which install:module +# nodes survive — it does NOT change prop-value handling. Without the schema, +# every localized-only prop (e.g. Office/Common.xcu Menus/New Title, which exists +# only as <value xml:lang="en-US">) falls through the normal value template that +# discards all @xml:lang values, so the per-module .xcd entries kept their nodes +# (Text Document, HTML Document, …) but with EMPTY <prop oor:name="Title"/> → +# the Writer "New" toolbar dropdown showed blank rows. Adding xcs/schemaRoot +# retains the en-US fallback exactly as it did for the default spool. [ genrule( name = "alllang_module_{}_{}".format( xcu.replace("/", "_").replace(".", "_"), module), - srcs = ["registry/data/" + xcu, "util/alllang.xsl"], + srcs = [ + "registry/data/" + xcu, + "util/alllang.xsl", + ] + glob(["registry/schema/**/*.xcs"]), outs = ["spool_module/{}/{}".format(module, xcu)], tools = ["@libxslt//:xsltproc"], cmd_bat = ( "$(location @libxslt//:xsltproc) --novalid " + "--stringparam module {} ".format(module) + + "--stringparam xcs ../registry/schema/{}.xcs ".format(xcu[:-len(".xcu")]) + + "--stringparam schemaRoot ../registry/schema " + "-o $(OUTS) " + "$(location util/alllang.xsl) " + "$(location registry/data/{})".format(xcu) diff --git a/main/reportdesign/BUILD.bazel b/main/reportdesign/BUILD.bazel index 428f505252..30d11bbcd4 100644 --- a/main/reportdesign/BUILD.bazel +++ b/main/reportdesign/BUILD.bazel @@ -536,7 +536,10 @@ rsc_res( "main/sfx2/inc", "main/sfx2/inc/sfx2", ], - images = ["//main/default_images:reportdesign_res_images"], + images = [ + "//main/default_images:reportdesign_res_images", + "//main/default_images:shared_images", + ], images_root = "main/default_images", visibility = ["//visibility:public"], ) diff --git a/main/svx/BUILD.bazel b/main/svx/BUILD.bazel index 777845eb99..d35ebf3518 100644 --- a/main/svx/BUILD.bazel +++ b/main/svx/BUILD.bazel @@ -984,6 +984,9 @@ rsc_res( ], hdrs = _SVX_HDRS, includes = _SVX_INCLUDES, + # app.src has ImageList resources (sc/lc/sch/lch prefixes) → supply icons. + images = ["//main/default_images:shared_images"], + images_root = "main/default_images", visibility = ["//visibility:public"], )
