tdf#171218 extras: Restored missing ID field in bullets.thm

This change restores the system gallery theme ID to bullets.thm, which
restores language and localization-independent lookup in the gallery UI.

This field was unintentionally removed by a prior update to the file
contents. Updating these .thm files is unnecessarily fragile. There does
not appear to be any way to set an ID other than by using a hex editor,
and the ID field is only retained if updates are incremental. In order
to make this somewhat easier, this change also adds an --id <id>
parameter to gengal. This parameter can be used to manually set the
correct ID when a new .thm file is generated (however, it will not
change the ID for an existing .thm file that is being updated).

Regression from commit 480ef73dee
Author: Heiko Tietze <heiko.tietze@documentfoundation.org>
Date:   Mon Oct 27 12:37:09 2025 +0100

    Revert^2 "tdf#139076 update Bullet icons with sexy .svg icons"

Change-Id: Idccdffb987606a1863c745c96bc0f8ba5cb6565f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208701
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
This commit is contained in:
Jonathan Clark
2026-07-30 15:47:03 +02:00
parent b75d3c0dd5
commit 417c7ee132
4 changed files with 18 additions and 11 deletions
Binary file not shown.
+1 -1
View File
@@ -127,7 +127,7 @@ public:
bool HasTheme( std::u16string_view rThemeName );
SAL_DLLPRIVATE OUString GetThemeName( sal_uInt32 nThemeId ) const;
bool CreateTheme( const OUString& rThemeName );
bool CreateTheme( const OUString& rThemeName, sal_uInt32 nId = 0U );
void RenameTheme( const OUString& rOldName, const OUString& rNewName );
bool RemoveTheme( const OUString& rThemeName );
+2 -2
View File
@@ -575,7 +575,7 @@ bool Gallery::HasTheme( std::u16string_view rThemeName )
return( ImplGetThemeEntry( rThemeName ) != nullptr );
}
bool Gallery::CreateTheme( const OUString& rThemeName )
bool Gallery::CreateTheme( const OUString& rThemeName, sal_uInt32 nId )
{
bool bRet = false;
@@ -585,7 +585,7 @@ bool Gallery::CreateTheme( const OUString& rThemeName )
aURL.Append( rThemeName );
GalleryThemeEntry* pNewEntry = new GalleryThemeEntry(
true, aURL, rThemeName,
false, true, 0, false );
false, true, nId, false );
m_aThemeList.emplace_back( pNewEntry );
delete pNewEntry->createGalleryTheme( this );
+15 -8
View File
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <optional>
#include <vector>
#include <comphelper/processfactory.hxx>
@@ -57,7 +58,7 @@ protected:
static void createTheme( const OUString& aThemeName, std::u16string_view aGalleryURL,
const OUString& aDestDir, std::vector<INetURLObject> &rFiles,
bool bRelativeURLs )
bool bRelativeURLs, sal_uInt32 nId )
{
std::unique_ptr<Gallery> pGallery(new Gallery( aGalleryURL ));
@@ -68,11 +69,13 @@ static void createTheme( const OUString& aThemeName, std::u16string_view aGaller
pGallery->GetThemeCount() );
GalleryTheme *pGalTheme;
if( !pGallery->HasTheme( aThemeName) ) {
if( !pGallery->CreateTheme( aThemeName ) ) {
fprintf( stderr, "Failed to create theme\n" );
exit( 1 );
}
if (!pGallery->HasTheme(aThemeName))
{
if (!pGallery->CreateTheme(aThemeName, nId))
{
fprintf(stderr, "Failed to create theme\n");
exit(1);
}
}
fprintf( stderr, "Existing themes: %" SAL_PRI_SIZET "u\n",
@@ -112,11 +115,12 @@ static int PrintHelp()
{
fprintf( stdout, "Utility to generate LibreOffice gallery files\n\n" );
fprintf( stdout, "using: gengal --name <name> --path <dir> [ --destdir <path> ]\n");
fprintf( stdout, "using: gengal --name <name> --id <id> --path <dir> [ --destdir <path> ]\n");
fprintf( stdout, " [ files ... ]\n\n" );
fprintf( stdout, "options:\n");
fprintf( stdout, " --name <theme>\t\tdefines the user visible name of the created or updated theme.\n");
fprintf( stdout, " --id <id>\t\tid of system theme, or zero if non-system (include/svx/gallery.hxx).\n");
fprintf( stdout, " --path <dir>\t\tdefines directory where the gallery files are created\n");
fprintf( stdout, "\t\t\tor updated.\n");
@@ -255,6 +259,7 @@ int GalApp::Main()
OUString aPath, aDestDir;
OUString aName( u"Default name"_ustr );
std::vector<INetURLObject> aFiles;
std::optional<sal_uInt32> nId;
for( sal_uInt16 i = 0; i < GetCommandLineParamCount(); ++i )
{
@@ -274,6 +279,8 @@ int GalApp::Main()
else if ( aParam == "--path" )
aPath = Smartify( GetCommandLineParam( ++i ) ).
GetMainURL(INetURLObject::DecodeMechanism::NONE);
else if ( aParam == "--id")
nId = GetCommandLineParam(++i).toUInt32();
else if ( aParam == "--destdir" )
aDestDir = GetCommandLineParam( ++i );
else if ( aParam == "--relative-urls" )
@@ -290,7 +297,7 @@ int GalApp::Main()
if( aFiles.empty() )
return PrintHelp();
createTheme( aName, aPath, aDestDir, aFiles, mbRelativeURLs );
createTheme(aName, aPath, aDestDir, aFiles, mbRelativeURLs, nId.value_or(0));
}
catch (const uno::Exception&)
{