This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO41X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO41X by this push: new 45d3892737 Remove code for unused bmpmaker (#201) 45d3892737 is described below commit 45d3892737e7ab73df3f0ace0046e7222e74b996 Author: mseidel <msei...@apache.org> AuthorDate: Mon Feb 12 16:10:47 2024 +0100 Remove code for unused bmpmaker (#201) --- main/Repository.mk | 40 ++- main/svtools/Executable_bmp.mk | 61 ----- main/svtools/Executable_bmpsum.mk | 57 ----- main/svtools/Executable_g2g.mk | 64 ----- main/svtools/Module_svtools.mk | 13 +- main/svtools/bmpmaker/bmp.cxx | 244 ------------------- main/svtools/bmpmaker/bmp.hrc | 40 --- main/svtools/bmpmaker/bmp.src | 120 --------- main/svtools/bmpmaker/bmpcore.cxx | 418 ------------------------------- main/svtools/bmpmaker/bmpcore.hxx | 93 ------- main/svtools/bmpmaker/bmpsum.cxx | 501 -------------------------------------- main/svtools/bmpmaker/g2g.cxx | 247 ------------------- main/toolkit/src2xml/src.lst | 1 - 13 files changed, 21 insertions(+), 1878 deletions(-) diff --git a/main/Repository.mk b/main/Repository.mk index 92f3832de2..0770fe1414 100644 --- a/main/Repository.mk +++ b/main/Repository.mk @@ -1,5 +1,5 @@ #************************************************************** -# +# # 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 @@ -7,27 +7,21 @@ # 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 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# +# #************************************************************** - - $(eval $(call gb_Helper_register_repository,SRCDIR)) - $(eval $(call gb_Helper_register_executables,NONE, \ - bmp \ - bmpsum \ - g2g \ mkunroll \ rscdep \ so_checksum \ @@ -35,18 +29,18 @@ $(eval $(call gb_Helper_register_executables,NONE, \ )) $(eval $(call gb_Helper_register_executables,OOO, \ - spadmin.bin \ + spadmin.bin \ )) $(eval $(call gb_Helper_register_libraries,OOOLIBS, \ - AppleRemote \ + AppleRemote \ avmedia \ basegfx \ basebmp \ canvastools \ cppcanvas \ cui \ - desktop_detector \ + desktop_detector \ drawinglayer \ svgio \ editeng \ @@ -55,7 +49,7 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \ fwk \ fwl \ fwm \ - i18npaper \ + i18npaper \ lng \ msfilter \ msword \ @@ -80,11 +74,11 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \ unoxml \ vbahelper \ vcl \ - vclplug_gen \ - vclplug_gtk \ - vclplug_kde \ - vclplug_kde4 \ - vclplug_svp \ + vclplug_gen \ + vclplug_gtk \ + vclplug_kde \ + vclplug_kde4 \ + vclplug_svp \ xcr \ xo \ xof \ @@ -106,7 +100,7 @@ $(eval $(call gb_Helper_register_libraries,RTLIBS, \ comphelper \ i18nisolang1 \ i18nutil \ - jvmaccess \ + jvmaccess \ ucbhelper \ vos3 \ )) @@ -125,7 +119,7 @@ $(eval $(call gb_Helper_register_libraries,UNOLIBS_OOO, \ hatchwindowfactory \ passwordcontainer \ vbaswobj \ - msforms \ + msforms \ )) @@ -140,8 +134,8 @@ $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \ ooopathutils \ salcpprt \ zlib \ - graphite \ - vclmain \ + graphite \ + vclmain \ )) # vim: set noet sw=4 ts=4: diff --git a/main/svtools/Executable_bmp.mk b/main/svtools/Executable_bmp.mk deleted file mode 100644 index c8de1864fa..0000000000 --- a/main/svtools/Executable_bmp.mk +++ /dev/null @@ -1,61 +0,0 @@ -#************************************************************** -# -# 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 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -$(eval $(call gb_Executable_Executable,bmp)) - -$(eval $(call gb_Executable_set_include,bmp,\ - $$(INCLUDE) \ - -I$(WORKDIR)/inc/svtools \ - -I$(WORKDIR)/inc/ \ - -I$(OUTDIR)/inc/ \ - -I$(SRCDIR)/svtools/inc \ - -I$(SRCDIR)/svtools/inc/svtools \ - -I$(SRCDIR)/svtools/source/inc \ - -I$(SRCDIR)/svtools/inc/pch \ - -I$(OUTDIR)/inc/offuh \ -)) - -$(eval $(call gb_Executable_add_linked_libs,bmp,\ - sal \ - stl \ - tl \ - vcl \ - vos3 \ - $(gb_STDLIBS) \ -)) - -ifneq ($(USE_SYSTEM_STL),YES) -ifeq ($(PRODUCT),) - $(eval $(call gb_Executable_set_cxxflags,bmp,\ - $$(CXXFLAGS) \ - -D_DEBUG \ -)) -endif -endif - -$(eval $(call gb_Executable_add_exception_objects,bmp,\ - svtools/bmpmaker/bmp \ - svtools/bmpmaker/bmpcore \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/main/svtools/Executable_bmpsum.mk b/main/svtools/Executable_bmpsum.mk deleted file mode 100644 index 2931a0542c..0000000000 --- a/main/svtools/Executable_bmpsum.mk +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************** -# -# 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 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -$(eval $(call gb_Executable_Executable,bmpsum)) - -$(eval $(call gb_Executable_set_include,bmpsum,\ - $$(INCLUDE) \ - -I$(OUTDIR)/inc/ \ - -I$(OUTDIR)/inc/offuh/ \ - -I$(SRCDIR)/svtools/inc/ \ - -I$(SRCDIR)/svtools/inc/pch/ \ - -I$(SRCDIR)/svtools/inc/svtools/ \ -)) - -$(eval $(call gb_Executable_add_linked_libs,bmpsum,\ - sal \ - stl \ - tl \ - vcl \ - vos3 \ - $(gb_STDLIBS) \ -)) - -ifneq ($(USE_SYSTEM_STL),YES) -ifeq ($(PRODUCT),) - $(eval $(call gb_Executable_set_cxxflags,bmpsum,\ - $$(CXXFLAGS) \ - -D_DEBUG \ -)) -endif -endif - -$(eval $(call gb_Executable_add_exception_objects,bmpsum,\ - svtools/bmpmaker/bmpsum \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/main/svtools/Executable_g2g.mk b/main/svtools/Executable_g2g.mk deleted file mode 100644 index a8e5261b0c..0000000000 --- a/main/svtools/Executable_g2g.mk +++ /dev/null @@ -1,64 +0,0 @@ -#************************************************************** -# -# 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 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -$(eval $(call gb_Executable_Executable,g2g)) - -$(eval $(call gb_Executable_set_include,g2g,\ - $$(INCLUDE) \ - -I$(OUTDIR)/inc/ \ - -I$(OUTDIR)/inc/offuh/ \ - -I$(SRCDIR)/svtools/inc/ \ - -I$(SRCDIR)/svtools/inc/pch/ \ - -I$(SRCDIR)/svtools/inc/svtools/ \ -)) - -$(eval $(call gb_Executable_add_linked_libs,g2g,\ - jvmfwk \ - sal \ - stl \ - svt \ - tl \ - vcl \ - vos3 \ - $(gb_STDLIBS) \ -)) -ifeq ($(OS),OS2) -$(eval $(call gb_Executable_add_linked_libs,g2g,\ - cppu \ -)) -endif - -ifneq ($(USE_SYSTEM_STL),YES) -ifeq ($(PRODUCT),) - $(eval $(call gb_Executable_set_cxxflags,g2g,\ - $$(CXXFLAGS) \ - -D_DEBUG \ -)) -endif -endif - -$(eval $(call gb_Executable_add_exception_objects,g2g,\ - svtools/bmpmaker/g2g \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/main/svtools/Module_svtools.mk b/main/svtools/Module_svtools.mk index 394f7c61c8..ef1b27c434 100644 --- a/main/svtools/Module_svtools.mk +++ b/main/svtools/Module_svtools.mk @@ -1,5 +1,5 @@ #************************************************************** -# +# # 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 @@ -7,27 +7,22 @@ # 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 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# +# #************************************************************** - - $(eval $(call gb_Module_Module,svtools)) $(eval $(call gb_Module_add_targets,svtools,\ AllLangResTarget_svt \ - Executable_bmp \ - Executable_bmpsum \ - Executable_g2g \ Library_hatchwindowfactory \ Library_svt \ Package_inc \ diff --git a/main/svtools/bmpmaker/bmp.cxx b/main/svtools/bmpmaker/bmp.cxx deleted file mode 100644 index 30327a8574..0000000000 --- a/main/svtools/bmpmaker/bmp.cxx +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef INCLUDED_RTL_MATH_HXX -#include <rtl/math.hxx> -#endif - -#include <math.h> -#include <stdio.h> -#include <signal.h> -#include <vector> -using namespace std; - -#include <vcl/svapp.hxx> - -#include "svl/solar.hrc" -#include <svtools/filedlg.hxx> -#include "bmpcore.hxx" -#include "bmp.hrc" - -// ---------- -// - BmpApp - -// ---------- - -class BmpApp : public BmpCreator -{ -private: - - String aOutputFileName; - sal_uInt8 cExitCode; - - sal_Bool GetCommandOption( const ::std::vector< String >& rArgs, const String& rSwitch, String& rSwitchParam ); - sal_Bool GetCommandOptions( const ::std::vector< String >& rArgs, const String& rSwitch, ::std::vector< String >& rSwitchParams ); - - void SetExitCode( sal_uInt8 cExit ) - { - if( ( EXIT_NOERROR == cExitCode ) || ( cExit != EXIT_NOERROR ) ) - cExitCode = cExit; - } - void ShowUsage(); - - virtual void Message( const String& rText, sal_uInt8 cExitCode ); - -public: - - BmpApp(); - ~BmpApp(); - - int Start( const ::std::vector< String >& rArgs ); -}; - -// ----------------------------------------------------------------------------- - -BmpApp::BmpApp() -{ -} - -// ----------------------------------------------------------------------------- - -BmpApp::~BmpApp() -{ -} - -// ----------------------------------------------------------------------- - -sal_Bool BmpApp::GetCommandOption( const ::std::vector< String >& rArgs, const String& rSwitch, String& rParam ) -{ - sal_Bool bRet = sal_False; - - for( int i = 0, nCount = rArgs.size(); ( i < nCount ) && !bRet; i++ ) - { - String aTestStr( '-' ); - - for( int n = 0; ( n < 2 ) && !bRet; n++ ) - { - aTestStr += rSwitch; - - if( aTestStr.CompareIgnoreCaseToAscii( rArgs[ i ] ) == COMPARE_EQUAL ) - { - bRet = sal_True; - - if( i < ( nCount - 1 ) ) - rParam = rArgs[ i + 1 ]; - else - rParam = String(); - } - - if( 0 == n ) - aTestStr = '/'; - } - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -sal_Bool BmpApp::GetCommandOptions( const ::std::vector< String >& rArgs, const String& rSwitch, ::std::vector< String >& rParams ) -{ - sal_Bool bRet = sal_False; - - for( int i = 0, nCount = rArgs.size(); ( i < nCount ); i++ ) - { - String aTestStr( '-' ); - - for( int n = 0; ( n < 2 ) && !bRet; n++ ) - { - aTestStr += rSwitch; - - if( aTestStr.CompareIgnoreCaseToAscii( rArgs[ i ] ) == COMPARE_EQUAL ) - { - if( i < ( nCount - 1 ) ) - rParams.push_back( rArgs[ i + 1 ] ); - else - rParams.push_back( String() ); - - break; - } - - if( 0 == n ) - aTestStr = '/'; - } - } - - return( rParams.size() > 0 ); -} - -// ----------------------------------------------------------------------- - -void BmpApp::Message( const String& rText, sal_uInt8 cExit ) -{ - if( EXIT_NOERROR != cExit ) - SetExitCode( cExit ); - - ByteString aText( rText, RTL_TEXTENCODING_UTF8 ); - aText.Append( "\r\n" ); - fprintf( stderr, aText.GetBuffer() ); -} - -// ----------------------------------------------------------------------------- - -void BmpApp::ShowUsage() -{ - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Usage:" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " bmp srs_inputfile output_dir lang_dir lang_num -i input_dir [-i input_dir ][-f err_file]" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Options:" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " -i ... name of directory to be searched for input files [multiple occurence is possible]" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " -f name of file, output should be written to" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Examples:" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " bmp /home/test.srs /home/out enus 01 -i /home/res -f /home/out/bmp.err" ) ), EXIT_NOERROR ); -} - -// ----------------------------------------------------------------------------- - -int BmpApp::Start( const ::std::vector< String >& rArgs ) -{ - String aOutName; - - cExitCode = EXIT_NOERROR; - - if( rArgs.size() >= 6 ) - { - LangInfo aLangInfo; - sal_uInt16 nCurCmd = 0; - const String aSrsName( rArgs[ nCurCmd++ ] ); - ::std::vector< String > aInDirVector; - ByteString aLangDir; - - aOutName = rArgs[ nCurCmd++ ]; - - aLangDir = ByteString( rArgs[ nCurCmd++ ], RTL_TEXTENCODING_ASCII_US ); - aLangInfo.mnLangNum = static_cast< sal_uInt16 >( rArgs[ nCurCmd++ ].ToInt32() ); - - memcpy( aLangInfo.maLangDir, aLangDir.GetBuffer(), aLangDir.Len() + 1 ); - - GetCommandOption( rArgs, 'f', aOutputFileName ); - GetCommandOptions( rArgs, 'i', aInDirVector ); - - Create( aSrsName, aInDirVector, aOutName, aLangInfo ); - } - else - { - ShowUsage(); - cExitCode = EXIT_COMMONERROR; - } - - if( ( EXIT_NOERROR == cExitCode ) && aOutputFileName.Len() && aOutName.Len() ) - { - SvFileStream aOStm( aOutputFileName, STREAM_WRITE | STREAM_TRUNC ); - ByteString aStr( "Successfully generated ImageList(s) in: " ); - - aOStm.WriteLine( aStr.Append( ByteString( aOutName, RTL_TEXTENCODING_UTF8 ) ) ); - aOStm.Close(); - } - - return cExitCode; -} - -// -------- -// - Main - -// -------- - -int main( int nArgCount, char* ppArgs[] ) -{ -#ifdef UNX - static char aDisplayVar[ 1024 ]; - - strcpy( aDisplayVar, "DISPLAY=" ); - putenv( aDisplayVar ); -#endif - - ::std::vector< String > aArgs; - BmpApp aBmpApp; - - InitVCL( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >() ); - - for( int i = 1; i < nArgCount; i++ ) - aArgs.push_back( String( ppArgs[ i ], RTL_TEXTENCODING_ASCII_US ) ); - - return aBmpApp.Start( aArgs ); -} diff --git a/main/svtools/bmpmaker/bmp.hrc b/main/svtools/bmpmaker/bmp.hrc deleted file mode 100644 index 2a780d9450..0000000000 --- a/main/svtools/bmpmaker/bmp.hrc +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#define DLG_PATH 256 - -#define GRP_PATH 1 -#define FT_SRS 1 -#define FT_RES 2 -#define FT_OUT 3 -#define EDT_SRS 1 -#define EDT_RES 2 -#define EDT_OUT 3 -#define BTN_SRS 1 -#define BTN_RES 2 -#define BTN_OUT 3 -#define BTN_OK 1 -#define BTN_CANCEL 1 - -#define GRP_LANG 2 -#define LB_LANG 1 diff --git a/main/svtools/bmpmaker/bmp.src b/main/svtools/bmpmaker/bmp.src deleted file mode 100644 index 7cf5df4d44..0000000000 --- a/main/svtools/bmpmaker/bmp.src +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "bmp.hrc" -ModalDialog DLG_PATH { - HelpID = "svtools:ModalDialog:DLG_PATH"; - OutputSize = TRUE; - SVLook = TRUE; - Size = MAP_APPFONT( 301, 104 ); - Text = "Pfad-Einstellungen"; - Moveable = TRUE; - Closeable = TRUE; - GroupBox GRP_PATH { - Pos = MAP_APPFONT( 6, 3 ); - Size = MAP_APPFONT( 243, 59 ); - Text = "Pfade"; - }; - FixedText FT_SRS { - Pos = MAP_APPFONT( 12, 16 ); - Size = MAP_APPFONT( 50, 10 ); - Text = "SRS-Datei (inkl.Pfad):"; - }; - FixedText FT_OUT { - Pos = MAP_APPFONT( 12, 46 ); - Size = MAP_APPFONT( 50, 10 ); - Text = "Ausgabe-Pfad:"; - }; - FixedText FT_RES { - Pos = MAP_APPFONT( 12, 31 ); - Size = MAP_APPFONT( 50, 10 ); - Text = "Bitmap-Pfad:"; - }; - Edit EDT_SRS { - HelpID = "svtools:Edit:DLG_PATH:EDT_SRS"; - Border = TRUE; - Pos = MAP_APPFONT( 65, 14 ); - Size = MAP_APPFONT( 160, 12 ); - TabStop = TRUE; - }; - Edit EDT_RES { - HelpID = "svtools:Edit:DLG_PATH:EDT_RES"; - Border = TRUE; - Pos = MAP_APPFONT( 65, 29 ); - Size = MAP_APPFONT( 160, 12 ); - TabStop = TRUE; - }; - Edit EDT_OUT { - HelpID = "svtools:Edit:DLG_PATH:EDT_OUT"; - Border = TRUE; - Pos = MAP_APPFONT( 65, 44 ); - Size = MAP_APPFONT( 160, 12 ); - TabStop = TRUE; - }; - PushButton BTN_SRS { - HelpID = "svtools:PushButton:DLG_PATH:BTN_SRS"; - Pos = MAP_APPFONT( 228, 14 ); - Size = MAP_APPFONT( 15, 12 ); - Text = "..."; - TabStop = TRUE; - }; - PushButton BTN_RES { - HelpID = "svtools:PushButton:DLG_PATH:BTN_RES"; - Pos = MAP_APPFONT( 228, 29 ); - Size = MAP_APPFONT( 15, 12 ); - Text = "..."; - TabStop = TRUE; - }; - PushButton BTN_OUT { - HelpID = "svtools:PushButton:DLG_PATH:BTN_OUT"; - Pos = MAP_APPFONT( 228, 44 ); - Size = MAP_APPFONT( 15, 12 ); - Text = "..."; - TabStop = TRUE; - }; - OKButton BTN_OK { - Pos = MAP_APPFONT( 255, 6 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - DefButton = TRUE; - }; - CancelButton BTN_CANCEL { - Pos = MAP_APPFONT( 255, 21 ); - Size = MAP_APPFONT( 40, 12 ); - TabStop = TRUE; - }; - GroupBox GRP_LANG { - Pos = MAP_APPFONT( 6, 65 ); - Size = MAP_APPFONT( 243, 33 ); - Text = "Sprache"; - }; - ListBox LB_LANG { - HelpID = "svtools:ListBox:DLG_PATH:LB_LANG"; - Border = TRUE; - Pos = MAP_APPFONT( 12, 76 ); - Size = MAP_APPFONT( 231, 70 ); - TabStop = TRUE; - DropDown = TRUE; - VScroll = TRUE; - }; -}; diff --git a/main/svtools/bmpmaker/bmpcore.cxx b/main/svtools/bmpmaker/bmpcore.cxx deleted file mode 100644 index 17e823008c..0000000000 --- a/main/svtools/bmpmaker/bmpcore.cxx +++ /dev/null @@ -1,418 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include <tools/color.hxx> -#include <vcl/bmpacc.hxx> -#include <vcl/bitmapex.hxx> -#include <vcl/alpha.hxx> -#include <vcl/pngread.hxx> -#include <vcl/pngwrite.hxx> -#include "bmpcore.hxx" -#include <vcl/dibtools.hxx> -#include <vector> -#include <algorithm> - -#undef WRITE_ALPHA_PNG - -// ------------------------- -// - ImplGetSystemFileName - -// ------------------------- - -static String ImplGetSystemFileName( const String& rFileName ) -{ - String aRet( rFileName ); - const sal_Unicode aReplace = DirEntry::GetAccessDelimiter( FSYS_STYLE_HOST ).GetChar( 0 ); - - aRet.SearchAndReplaceAll( '/', aReplace ); - aRet.SearchAndReplaceAll( '\\', aReplace ); - - return aRet; -} - -// -------------- -// - BmpCreator - -// -------------- - -BmpCreator::BmpCreator() -{ -} - -// ----------------------------------------------------------------------------- - -BmpCreator::~BmpCreator() -{ -} - -// ----------------------------------------------------------------------------- - -void BmpCreator::Message( const String&, sal_uInt8 ) -{ -} - -// ----------------------------------------------------------------------- - -void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs, - const DirEntry& rOut, - const String& rName, - const LangInfo& rLang ) -{ - const sal_uInt32 nOldPos = pSRS->Tell(); - const char* pCollectFile = getenv( "BMP_COLLECT_FILE" ); - SvFileStream* pCollectStm = pCollectFile ? new SvFileStream( String( pCollectFile, RTL_TEXTENCODING_ASCII_US ), - STREAM_WRITE ) : NULL; - - if( pCollectStm ) - pCollectStm->Seek( STREAM_SEEK_TO_END ); - - if( rInDirs.size() ) - { - ByteString aLine; - String aInfo, aPrefix, aName( rName ), aString; - SvFileStream aOutStream; - BitmapEx aTotalBmpEx; - DirEntry aOutFile( rOut ); - ::std::vector< DirEntry > aInFiles( rInDirs ); - ::std::vector< String > aNameVector; - sal_uInt32 i; - - for( i = 0; i < aInFiles.size(); i++ ) - aInFiles[ i ] += DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "xxx.xxx" ) ) ); - - // get prefix for files - if( ( aName.Len() >= 3 ) && ( aName.GetChar( 2 ) != '_' ) ) - aPrefix = String( aName, 0, 3 ); - else - aPrefix = String( aName, 0, 2 ); - - String aNumStr( String::CreateFromAscii( rLang.maLangDir )) ; - - if( aNumStr.Len() == 1 ) - aNumStr.Insert( '0', 0 ); - - aName = DirEntry( aName ).GetBase(); - aName += String( RTL_CONSTASCII_USTRINGPARAM( ".bmp" ) ); - - // create output file name - aOutFile += DirEntry( aName ); - - // get number of bitmaps - while( aLine.Search( '}' ) == STRING_NOTFOUND ) - { - if( !pSRS->ReadLine( aLine ) ) - break; - - aLine.EraseLeadingChars( ' ' ); - aLine.EraseLeadingChars( '\t' ); - aLine.EraseAllChars( ';' ); - - if( aLine.IsNumericAscii() ) - { - aString = aPrefix; - - if( atoi( aLine.GetBuffer() ) < 10000 ) - aString += String::CreateFromInt32( 0 ); - - // search for pngs by default - String aPngString( aString += String( aLine.GetBuffer(), RTL_TEXTENCODING_UTF8 ) ); - aNameVector.push_back( aPngString += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ) ); - } - } - - if( !aNameVector.size() ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "WARNING: No imagelist resource found: " ) ).Append( aString ), EXIT_MISSING_RESOURCE ); - else - { - // write info - aInfo = String( RTL_CONSTASCII_USTRINGPARAM( "CREATING ImageList for language: " ) ); - aInfo += String( ::rtl::OUString::createFromAscii( rLang.maLangDir ) ); - aInfo += String( RTL_CONSTASCII_USTRINGPARAM( " [ " ) ); - - for( i = 0; i < rInDirs.size(); i++ ) - ( aInfo += rInDirs[ i ].GetFull() ) += String( RTL_CONSTASCII_USTRINGPARAM( "; " ) ); - - aInfo += String( RTL_CONSTASCII_USTRINGPARAM( " ]" ) ); - Message( aInfo ); - - // create bit vector to hold flags for valid bitmaps - ::std::bit_vector aValidBmpBitVector( aNameVector.size(), false ); - BitmapEx aBmpEx; - - for( sal_uInt32 n = 0; n < aNameVector.size(); n++ ) - { - aBmpEx.SetEmpty(); - - for( i = 0; i < aInFiles.size() && aBmpEx.IsEmpty(); i++ ) - { - DirEntry aInFile( aInFiles[ i ] ); - - aInFile.SetName( aString = aNameVector[ n ] ); - bool bPNG = aInFile.Exists(); - - if( !bPNG ) - { - aInFile.SetExtension( String( RTL_CONSTASCII_USTRINGPARAM( "bmp" ) ) ); - aString = aInFile.GetName(); - } - - if( aInFile.Exists() ) - { - const String aFileName( aInFile.GetFull() ); - SvFileStream aIStm( aFileName, STREAM_READ ); - - if( bPNG ) - { - ::vcl::PNGReader aPNGReader( aIStm ); - aBmpEx = aPNGReader.Read(); - } - else - { - ReadDIBBitmapEx(aBmpEx, aIStm); - } - - if( pCollectStm && !aBmpEx.IsEmpty() ) - { - const ByteString aCollectString( aFileName, RTL_TEXTENCODING_ASCII_US ); - pCollectStm->WriteLine( aCollectString ); - } - } - } - - const Size aSize( aBmpEx.GetSizePixel() ); - - if( aBmpEx.IsEmpty() ) - { - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: graphic is missing: " ) ).Append( aString ), EXIT_MISSING_BITMAP ); - } - else - { - if( aTotalBmpEx.IsEmpty() ) - { - // first bitmap determines metrics of total bitmap - Size aTotalSize( aOneSize = aSize ); - - aTotalSize.Width() *= aNameVector.size(); - aTotalBmpEx = Bitmap( aTotalSize, aBmpEx.GetBitmap().GetBitCount() ); - } - - if( ( aSize.Width() > aOneSize.Width() ) || ( aSize.Height() > aOneSize.Height() ) ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Different dimensions in file: " ) ).Append( aString ), EXIT_DIMENSIONERROR ); - else - { - Point aPoint; - const Rectangle aDst( Point( aOneSize.Width() * n, 0L ), aSize ); - const Rectangle aSrc( aPoint, aSize ); - - if( !aTotalBmpEx.IsEmpty() && !aBmpEx.IsEmpty() && !aDst.IsEmpty() && !aSrc.IsEmpty() ) - { - if( !aTotalBmpEx.IsTransparent() && aBmpEx.IsTransparent() ) - { - const Bitmap aTmpBmp( aTotalBmpEx.GetBitmap() ); - aTotalBmpEx = BitmapEx( aTmpBmp, AlphaMask( aTmpBmp.CreateMask( COL_LIGHTMAGENTA ) ) ); - } - else if( aTotalBmpEx.IsTransparent() && !aBmpEx.IsTransparent() ) - { - const Bitmap aTmpBmp( aBmpEx.GetBitmap() ); - aBmpEx = BitmapEx( aTmpBmp, AlphaMask( aTmpBmp.CreateMask( COL_LIGHTMAGENTA ) ) ); - } - - aTotalBmpEx.CopyPixel( aDst, aSrc, &aBmpEx ); - aValidBmpBitVector[ n ] = true; - } - } - } - } - - if( !aTotalBmpEx.IsEmpty() ) - { - // do we have invalid bitmaps? - if( ::std::find( aValidBmpBitVector.begin(), aValidBmpBitVector.end(), false ) != aValidBmpBitVector.end() ) - { - Bitmap aTmpBmp( aTotalBmpEx.GetBitmap() ); - BitmapWriteAccess* pAcc = aTmpBmp.AcquireWriteAccess(); - - if( pAcc ) - { - pAcc->SetLineColor( Color( COL_LIGHTGREEN ) ); - - for( sal_uInt32 n = 0; n < aValidBmpBitVector.size(); n++ ) - { - if( !aValidBmpBitVector[ n ] ) - { - const Rectangle aDst( Point( aOneSize.Width() * n, 0L ), aOneSize ); - - pAcc->DrawRect( aDst ); - pAcc->DrawLine( aDst.TopLeft(), aDst.BottomRight() ); - pAcc->DrawLine( aDst.TopRight(), aDst.BottomLeft() ); - } - } - - aTmpBmp.ReleaseAccess( pAcc ); - - if( aTotalBmpEx.IsAlpha() ) - aTotalBmpEx = BitmapEx( aTmpBmp, aTotalBmpEx.GetAlpha() ); - else if( aTotalBmpEx.IsTransparent() ) - aTotalBmpEx = BitmapEx( aTmpBmp, aTotalBmpEx.GetMask() ); - else - aTotalBmpEx = aTmpBmp; - } - } - - // write output file - const String aOutFileName( aOutFile.GetFull() ); - - aOutStream.Open( aOutFileName, STREAM_WRITE | STREAM_TRUNC ); - - if( !aOutStream.IsOpen() ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Could not open output file: " ) ).Append( aOutFileName ), EXIT_IOERROR ); - else - { - if( aOutFileName.Search( String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ) ) != STRING_NOTFOUND ) - { - ::vcl::PNGWriter aPNGWriter( aTotalBmpEx ); - aPNGWriter.Write( aOutStream ); - } - else - { - WriteDIBBitmapEx(aTotalBmpEx, aOutStream); - } - - if( aOutStream.GetError() ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Could not write to output file: " ) ).Append( aOutFileName ), EXIT_IOERROR ); - else - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Successfully generated ImageList " ) ).Append( aOutFileName ) ); - - aOutStream.Close(); - } - } - else - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Could not generate " ) ).Append( aOutFile.GetFull() ), EXIT_COMMONERROR ); - - Message( ' ' ); - } - } - else - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: SOLARSRC environment variable not set!" ) ), EXIT_MISSING_SOLARSRC_ENV ); - - pSRS->Seek( nOldPos ); - delete pCollectStm; -} - -// ----------------------------------------------------------------------------- - -void BmpCreator::Create( const String& rSRSName, - const ::std::vector< String >& rInDirs, - const String& rOutName, - const LangInfo& rLang ) -{ - DirEntry aFileName( ImplGetSystemFileName( rSRSName ) ), aOutDir( ImplGetSystemFileName( rOutName ) ); - ::std::vector< DirEntry > aInDirs; - sal_Bool bDone = sal_False; - - aFileName.ToAbs(); - aOutDir.ToAbs(); - - // create vector of all valid input directories, - // including language subdirectories - for( sal_uInt32 i = 0; i < rInDirs.size(); i++ ) - { - DirEntry aInDir( ImplGetSystemFileName( rInDirs[ i ] ) ); - - aInDir.ToAbs(); - - if( aInDir.Exists() ) - { - DirEntry aLangInDir( aInDir ); - - if( ( aLangInDir += DirEntry( ::rtl::OUString::createFromAscii( rLang.maLangDir ) ) ).Exists() ) - aInDirs.push_back( aLangInDir ); - - aInDirs.push_back( aInDir ); - } - } - - pSRS = new SvFileStream ( aFileName.GetFull(), STREAM_STD_READ ); - - if( pSRS->GetError() ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Kein SRS file!" ) ), EXIT_NOSRSFILE ); - else - { - String aText; - ByteString aByteText; - sal_Bool bLangDep = sal_False; - - do - { - do - { - if (!pSRS->ReadLine(aByteText)) - break; - } - while ( aByteText.Search( "ImageList" ) == STRING_NOTFOUND ); - - do - { - if (!pSRS->ReadLine( aByteText ) ) - break; - } - while ( aByteText.Search( "File" ) == STRING_NOTFOUND ); - aText = String::CreateFromAscii( aByteText.GetBuffer() ); - - const String aName( aText.GetToken( 1, '"' ) ); - - do - { - if( !bLangDep && - aByteText.Search( "File" ) != STRING_NOTFOUND && - aByteText.Search( '[' ) != STRING_NOTFOUND && - aByteText.Search( ']' ) != STRING_NOTFOUND ) - { - bLangDep = sal_True; - } - - if (!pSRS->ReadLine(aByteText)) - break; - } - while (aByteText.Search( "IdList" ) == STRING_NOTFOUND ); - aText = String::CreateFromAscii( aByteText.GetBuffer() ); - - // if image list is not language dependent, don't do anything for languages except german - if( aText.Len() ) - { - bDone = sal_True; - ImplCreate( aInDirs, aOutDir, aName, rLang ); - } -/* else if( ( rLang.mnLangNum != 49 ) && !bLangDep ) - { - Message( String( RTL_CONSTASCII_USTRINGPARAM( "INFO: ImageList is not language dependent! Nothing to do for this language." ) ) ); - bDone = sal_True; - }*/ - } - while ( aText.Len() ); - } - - if( !bDone ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: No ImageList found in SRS file!" ) ), EXIT_NOIMGLIST ); - - delete pSRS; -} diff --git a/main/svtools/bmpmaker/bmpcore.hxx b/main/svtools/bmpmaker/bmpcore.hxx deleted file mode 100644 index 0a1dcf6da0..0000000000 --- a/main/svtools/bmpmaker/bmpcore.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _BMPCORE_HXX -#define _BMPCORE_HXX - -#include <tools/stream.hxx> -#include <tools/fsys.hxx> -#include <vcl/bitmap.hxx> -#include <vector> - -// -------------- -// - Exit codes - -// -------------- - -#define EXIT_NOERROR 0 -#define EXIT_MISSING_BITMAP 1 -#define EXIT_NOSRSFILE 2 -#define EXIT_NOIMGLIST 3 -#define EXIT_DIMENSIONERROR 4 -#define EXIT_IOERROR 5 -#define EXIT_COMMONERROR 6 -#define EXIT_MISSING_RESOURCE 7 -#define EXIT_COLORDEPTHERROR 8 -#define EXIT_MISSING_SOLARSRC_ENV 9 - -// ------------ -// - LangInfo - -// ------------ - -struct LangInfo -{ - char maLangDir[ 257 ]; - sal_uInt16 mnLangNum; -}; - -// -------------- -// - BmpCreator - -// -------------- - -class BmpCreator -{ -private: - - Bitmap aOutBmp; - Size aOneSize; - Size aTotSize; - Point aPos; - SvFileStream* pSRS; - sal_uLong nTotCount; - sal_uInt16 nPos; - - void ImplCreate( const ::std::vector< DirEntry >& rInDirs, - const DirEntry& rOut, - const String& rName, - const LangInfo& rLang ); - -protected: - - virtual void Message( const String& rText, sal_uInt8 cExitCode = EXIT_NOERROR ); - -public: - - BmpCreator(); - virtual ~BmpCreator(); - - void Create( const String& rSRSName, - const ::std::vector< String >& rInDirs, - const String& rOutName, - const LangInfo& rLang ); -}; - -#endif // _BMPCORE_HXX diff --git a/main/svtools/bmpmaker/bmpsum.cxx b/main/svtools/bmpmaker/bmpsum.cxx deleted file mode 100644 index 09d8995399..0000000000 --- a/main/svtools/bmpmaker/bmpsum.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include <cstdio> -#include <csignal> -#include <vector> -#include <set> -#include <map> -#include <rtl/crc.h> -#include <tools/stream.hxx> -#include <tools/fsys.hxx> -#include <vcl/svapp.hxx> -#include <vcl/bitmap.hxx> -#include <vcl/bmpacc.hxx> -#include <vcl/pngread.hxx> -#include <vcl/dibtools.hxx> -#include "svl/solar.hrc" - -#define EXIT_NOERROR 0x00000000 -#define EXIT_INVALIDFILE 0x00000001 -#define EXIT_COMMONERROR 0x80000000 - -// ---------- -// - BmpSum - -// ---------- - -class BmpSum -{ -private: - - sal_uInt32 cExitCode; - - sal_Bool GetCommandOption( const ::std::vector< String >& rArgs, const String& rSwitch, String& rSwitchParam ); - sal_Bool GetCommandOptions( const ::std::vector< String >& rArgs, const String& rSwitch, ::std::vector< String >& rSwitchParams ); - - void SetExitCode( sal_uInt8 cExit ) - { - if( ( EXIT_NOERROR == cExitCode ) || ( cExit != EXIT_NOERROR ) ) - cExitCode = cExit; - } - void ShowUsage(); - void Message( const String& rText, sal_uInt8 cExitCode ); - - sal_uInt64 GetCRC( const BitmapEx& rBmpEx ); - - void ProcessFile( const String& rBmpFileName ); - void ProcessFileList( const String& rInFileList, const String& rOutFileList, const String& rOutPath ); - -public: -// - BmpSum(); - ~BmpSum(); - - int Start( const ::std::vector< String >& rArgs ); -}; - -// ----------------------------------------------------------------------------- - -BmpSum::BmpSum() -{ -} - -// ----------------------------------------------------------------------------- - -BmpSum::~BmpSum() -{ -} - -// ----------------------------------------------------------------------- - -sal_Bool BmpSum::GetCommandOption( const ::std::vector< String >& rArgs, const String& rSwitch, String& rParam ) -{ - sal_Bool bRet = sal_False; - - for( int i = 0, nCount = rArgs.size(); ( i < nCount ) && !bRet; i++ ) - { - String aTestStr( '-' ); - - for( int n = 0; ( n < 2 ) && !bRet; n++ ) - { - aTestStr += rSwitch; - - if( aTestStr.CompareIgnoreCaseToAscii( rArgs[ i ] ) == COMPARE_EQUAL ) - { - bRet = sal_True; - - if( i < ( nCount - 1 ) ) - rParam = rArgs[ i + 1 ]; - else - rParam = String(); - } - - if( 0 == n ) - aTestStr = '/'; - } - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -sal_Bool BmpSum::GetCommandOptions( const ::std::vector< String >& rArgs, const String& rSwitch, ::std::vector< String >& rParams ) -{ - sal_Bool bRet = sal_False; - - for( int i = 0, nCount = rArgs.size(); ( i < nCount ); i++ ) - { - String aTestStr( '-' ); - - for( int n = 0; ( n < 2 ) && !bRet; n++ ) - { - aTestStr += rSwitch; - - if( aTestStr.CompareIgnoreCaseToAscii( rArgs[ i ] ) == COMPARE_EQUAL ) - { - if( i < ( nCount - 1 ) ) - rParams.push_back( rArgs[ i + 1 ] ); - else - rParams.push_back( String() ); - - break; - } - - if( 0 == n ) - aTestStr = '/'; - } - } - - return( rParams.size() > 0 ); -} - -// ----------------------------------------------------------------------- - -void BmpSum::Message( const String& rText, sal_uInt8 nExitCode ) -{ - if( EXIT_NOERROR != nExitCode ) - SetExitCode( nExitCode ); - - ByteString aText( rText, RTL_TEXTENCODING_UTF8 ); - aText.Append( "\r\n" ); - fprintf( stderr, aText.GetBuffer() ); -} - -// ----------------------------------------------------------------------------- - -void BmpSum::ShowUsage() -{ - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Usage:" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " bmpsum bmp_inputfile" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " bmpsum -i input_filelist -o output_filelist [-p path_for_copied_bitmaps]" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Options:" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Examples:" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " bmpsum /home/test.bmp" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " bmpsum -i /home/inlist.txt -o /home/outlist.txt" ) ), EXIT_NOERROR ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " bmpsum -i /home/inlist.txt -o /home/outlist.txt -p /home/outpath" ) ), EXIT_NOERROR ); -} - -// ----------------------------------------------------------------------------- - -int BmpSum::Start( const ::std::vector< String >& rArgs ) -{ - cExitCode = EXIT_NOERROR; - - if( rArgs.size() >= 1 ) - { - String aInFileList, aOutFileList, aOutPath; - - if( GetCommandOption( rArgs, 'i', aInFileList ) && - GetCommandOption( rArgs, 'o', aOutFileList ) ) - { - GetCommandOption( rArgs, 'p', aOutPath ); - ProcessFileList( aInFileList, aOutFileList, aOutPath ); - } - else - { - ProcessFile( rArgs[ 0 ] ); - } - } - else - { - ShowUsage(); - cExitCode = EXIT_COMMONERROR; - } - - return cExitCode; -} - -// ----------------------------------------------------------------------------- - -sal_uInt64 BmpSum::GetCRC( const BitmapEx& rBmpEx ) -{ - Bitmap aBmp( rBmpEx.GetBitmap() ); - BitmapReadAccess* pRAcc = aBmp.AcquireReadAccess(); - AlphaMask aAlpha; - BitmapReadAccess* pAAcc = NULL; - sal_uInt64 nRet = 0; - sal_uInt32 nCrc = 0; - - if( rBmpEx.IsTransparent() ) - { - aAlpha = rBmpEx.GetAlpha(); - pAAcc = aAlpha.AcquireReadAccess(); - } - - if( pRAcc && pRAcc->Width() && pRAcc->Height() ) - { - SVBT32 aBT32; - - for( long nY = 0; nY < pRAcc->Height(); ++nY ) - { - for( long nX = 0; nX < pRAcc->Width(); ++nX ) - { - const BitmapColor aCol( pRAcc->GetColor( nY, nX ) ); - - UInt32ToSVBT32( aCol.GetRed(), aBT32 ); - nCrc = rtl_crc32( nCrc, aBT32, 4 ); - - UInt32ToSVBT32( aCol.GetGreen(), aBT32 ); - nCrc = rtl_crc32( nCrc, aBT32, 4 ); - - UInt32ToSVBT32( aCol.GetBlue(), aBT32 ); - nCrc = rtl_crc32( nCrc, aBT32, 4 ); - - if( pAAcc ) - { - const BitmapColor aMaskCol( pAAcc->GetColor( nY, nX ) ); - - UInt32ToSVBT32( aMaskCol.GetRed(), aBT32 ); - nCrc = rtl_crc32( nCrc, aBT32, 4 ); - - UInt32ToSVBT32( aMaskCol.GetGreen(), aBT32 ); - nCrc = rtl_crc32( nCrc, aBT32, 4 ); - - UInt32ToSVBT32( aMaskCol.GetBlue(), aBT32 ); - nCrc = rtl_crc32( nCrc, aBT32, 4 ); - } - } - } - - nRet = ( ( (sal_uInt64) pRAcc->Width() ) << 48 ) | - ( ( (sal_uInt64) pRAcc->Height() ) << 32 ) | - ( (sal_uInt64) nCrc ); - } - - if( pAAcc ) - aAlpha.ReleaseAccess( pAAcc); - - aBmp.ReleaseAccess( pRAcc ); - - return nRet; -} - -// ----------------------------------------------------------------------------- - -void BmpSum::ProcessFile( const String& rBmpFileName ) -{ - SvFileStream aIStm( rBmpFileName, STREAM_READ ); - - if( aIStm.IsOpen() ) - { - BitmapEx aBmpEx; - - ReadDIBBitmapEx(aBmpEx, aIStm); - - if( !aBmpEx.IsEmpty() ) - { - fprintf( stdout, "%" SAL_PRIuUINT64 "\r\n", GetCRC( aBmpEx ) ); - } - else - { - aIStm.ResetError(); - aIStm.Seek( 0 ); - - ::vcl::PNGReader aPngReader( aIStm ); - - aBmpEx = aPngReader.Read(); - - if( !aBmpEx.IsEmpty() ) - { - fprintf( stdout, "%" SAL_PRIuUINT64 "\r\n", GetCRC( aBmpEx ) ); - } - else - Message( String( RTL_CONSTASCII_USTRINGPARAM( "file not valid" ) ), EXIT_INVALIDFILE ); - } - } -} - -// ----------------------------------------------------------------------------- - -void BmpSum::ProcessFileList( const String& rInFileList, - const String& rOutFileList, - const String& rOutPath ) -{ - SvFileStream aIStm( rInFileList, STREAM_READ ); - SvFileStream aOStm( rOutFileList, STREAM_WRITE | STREAM_TRUNC ); - const DirEntry aBaseDir( rOutPath ); - - if( rOutPath.Len() ) - aBaseDir.MakeDir(); - - if( aIStm.IsOpen() && aOStm.IsOpen() ) - { - ByteString aReadLine; - ::std::set< ByteString > aFileNameSet; - - while( aIStm.ReadLine( aReadLine ) ) - { - if( aReadLine.Len() ) - aFileNameSet.insert( aReadLine ); - - if( aReadLine.Search( "enus" ) != STRING_NOTFOUND ) - { - static const char* aLanguages[] = - { - "chinsim", - "chintrad", - "dtch", - "enus", - "fren", - "hebrew" - "ital", - "japn", - "korean", - "pol", - "poln", - "port", - "russ", - "span", - "turk" - }; - - for( sal_uInt32 n = 0; n < 14; ++n ) - { - ByteString aLangPath( aReadLine ); - - aLangPath.SearchAndReplace( "enus", aLanguages[ n ] ); - - DirEntry aTestFile( aLangPath ); - - if( aTestFile.Exists() ) - aFileNameSet.insert( aLangPath ); - } - } - - aReadLine.Erase(); - } - - aIStm.Close(); - - ::std::set< ByteString >::iterator aIter( aFileNameSet.begin() ); - ::std::map< sal_uInt64, ::std::vector< ByteString > > aFileNameMap; - - while( aIter != aFileNameSet.end() ) - { - ByteString aStr( *aIter++ ); - SvFileStream aBmpStm( String( aStr.GetBuffer(), RTL_TEXTENCODING_ASCII_US ), STREAM_READ ); - sal_uInt64 nCRC = 0; - - if( aBmpStm.IsOpen() ) - { - BitmapEx aBmpEx; - - ReadDIBBitmapEx(aBmpEx, aBmpStm); - - if( !aBmpEx.IsEmpty() ) - nCRC = GetCRC( aBmpEx ); - else - { - aBmpStm.ResetError(); - aBmpStm.Seek( 0 ); - - ::vcl::PNGReader aPngReader( aBmpStm ); - - aBmpEx = aPngReader.Read(); - - if( !aBmpEx.IsEmpty() ) - nCRC = GetCRC( aBmpEx ); - - else - fprintf( stderr, "%s could not be opened\n", aStr.GetBuffer() ); - } - - aBmpStm.Close(); - } - - if( nCRC ) - { - ::std::map< sal_uInt64, ::std::vector< ByteString > >::iterator aFound( aFileNameMap.find( nCRC ) ); - - if( aFound != aFileNameMap.end() ) - (*aFound).second.push_back( aStr ); - else - { - ::std::vector< ByteString > aVector( 1, aStr ); - aFileNameMap[ nCRC ] = aVector; - } - - } - else - { - ::std::vector< ByteString > aVector( 1, aStr ); - aFileNameMap[ nCRC ] = aVector; - } - } - - ::std::map< sal_uInt64, ::std::vector< ByteString > >::iterator aMapIter( aFileNameMap.begin() ); - sal_uInt32 nFileCount = 0; - - while( aMapIter != aFileNameMap.end() ) - { - ::std::pair< const sal_uInt64, ::std::vector< ByteString > > aPair( *aMapIter++ ); - ::std::vector< ByteString > aFileNameVector( aPair.second ); - - // write new entries - for( sal_uInt32 i = 0; i < aFileNameVector.size(); ++i ) - { - ByteString aStr( ByteString::CreateFromInt64( aPair.first ) ); - ByteString aFileName( aFileNameVector[ i ] ); - DirEntry aSrcFile( aFileName ); - - aStr += '\t'; - aStr += aFileName; - - aOStm.WriteLine( aStr ); - - // copy bitmap - if( rOutPath.Len() ) - { - if( aFileName.Search( ":\\" ) != STRING_NOTFOUND ) - aFileName.Erase( 0, aFileName.Search( ":\\" ) + 2 ); - - aFileName.SearchAndReplaceAll( '\\', '/' ); - - sal_uInt16 nTokenCount = aFileName.GetTokenCount( '/' ); - DirEntry aNewDir( aBaseDir ); - - for( sal_uInt16 n = 0; ( n < nTokenCount - 1 ); n++ ) - { - aNewDir += DirEntry( aFileName.GetToken( n, '/' ) ); - aNewDir.MakeDir(); - } - - aNewDir += DirEntry( aFileName.GetToken( nTokenCount - 1, '/' ) ); - aSrcFile.CopyTo( aNewDir, FSYS_ACTION_COPYFILE ); - } - } - - ++nFileCount; - } - - fprintf( - stdout, "unique file count: %lu", - sal::static_int_cast< unsigned long >(nFileCount) ); - } -} - -// -------- -// - Main - -// -------- - -int main( int nArgCount, char* ppArgs[] ) -{ -#ifdef UNX - static char aDisplayVar[ 1024 ]; - - strcpy( aDisplayVar, "DISPLAY=" ); - putenv( aDisplayVar ); -#endif - - ::std::vector< String > aArgs; - BmpSum aBmpSum; - - InitVCL( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >() ); - - for( int i = 1; i < nArgCount; i++ ) - aArgs.push_back( String( ppArgs[ i ], RTL_TEXTENCODING_ASCII_US ) ); - - return aBmpSum.Start( aArgs ); -} diff --git a/main/svtools/bmpmaker/g2g.cxx b/main/svtools/bmpmaker/g2g.cxx deleted file mode 100644 index dbcb068f9f..0000000000 --- a/main/svtools/bmpmaker/g2g.cxx +++ /dev/null @@ -1,247 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include <stdio.h> -#include <signal.h> -#include <ctype.h> - -#include <sal/main.h> - -#include <tools/fsys.hxx> -#include <tools/stream.hxx> -#include <vcl/svapp.hxx> -#include "svtools/filter.hxx" - -#define EXIT_NOERROR 0x00000000 -#define EXIT_COMMONERROR 0x00000001 -#define EXIT_INVALID_FILE 0x00000002 -#define EXIT_INVALID_GRAPHICFILTER 0x00000004 -#define EXIT_INVALID_INPUTGRAPHIC 0x00000008 -#define EXIT_OUTPUTERROR 0x00000010 - -#define LOWERHEXTONUM( _def_Char ) (((_def_Char)<='9') ? ((_def_Char)-'0') : ((_def_Char)-'a'+10)) - -// ---------- -// - G2GApp - -// ---------- - -class G2GApp -{ -private: - - sal_uInt8 cExitCode; - - void ShowUsage(); - sal_Bool GetCommandOption( const ::std::vector< String >& rArgs, const String& rSwitch, String& rParam ); - void SetExitCode( sal_uInt8 cExit ) { if( ( EXIT_NOERROR == cExitCode ) || ( cExit != EXIT_NOERROR ) ) cExitCode = cExit; } - - virtual void Message( const String& rText, sal_uInt8 cExitCode = EXIT_NOERROR ); - -public: - - G2GApp(); - virtual ~G2GApp(); - - int Start( const ::std::vector< String >& rArgs ); -}; - -// ----------------------------------------------------------------------- - -G2GApp::G2GApp() -{ -} - -// ----------------------------------------------------------------------- - -G2GApp::~G2GApp() -{ -} - -// ----------------------------------------------------------------------- - -sal_Bool G2GApp::GetCommandOption( const ::std::vector< String >& rArgs, const String& rSwitch, String& rParam ) -{ - sal_Bool bRet = sal_False; - - for( int i = 0, nCount = rArgs.size(); ( i < nCount ) && !bRet; i++ ) - { - String aTestStr( '-' ); - - for( int n = 0; ( n < 2 ) && !bRet; n++ ) - { - aTestStr += rSwitch; - - if( aTestStr.CompareIgnoreCaseToAscii( rArgs[ i ] ) == COMPARE_EQUAL ) - { - bRet = sal_True; - - if( i < ( nCount - 1 ) ) - rParam = rArgs[ i + 1 ]; - else - rParam = String(); - } - - if( 0 == n ) - aTestStr = '/'; - } - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -void G2GApp::Message( const String& rText, sal_uInt8 nExitCode ) -{ - if( EXIT_NOERROR != nExitCode ) - SetExitCode( nExitCode ); - - ByteString aText( rText, RTL_TEXTENCODING_UTF8 ); - aText.Append( "\r\n" ); - fprintf( stderr, aText.GetBuffer() ); -} - -// ----------------------------------------------------------------------------- - -void G2GApp::ShowUsage() -{ - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Usage:" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " g2g inputfile outputfile -format exportformat -filterpath path [ -# RRGGBB ]" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Options:" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " -format short name of export filter to use ( e.g. gif, png, jpg, ... )" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " -filterpath path to externally loaded filter libraries" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " -# hex value of color to be set transparent in export file (optional)" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( "Examples:" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " g2g /home/test.bmp /home/test.jpg -format jpg -filterpath /home/filter" ) ) ); - Message( String( RTL_CONSTASCII_USTRINGPARAM( " g2g /home/test.bmp /home/test.gif -format gif -filterpath /home/filter -# C0C0C0" ) ) ); -} - -// ----------------------------------------------------------------------------- - -int G2GApp::Start( const ::std::vector< String >& rArgs ) -{ - int nCmdCount = rArgs.size(); - sal_uInt16 nCurCmd = 0; - - cExitCode = EXIT_NOERROR; - - if( nCmdCount >= 6 ) - { - GraphicFilter aFilter( sal_False ); - String aInFile, aOutFile, aFilterStr, aFilterPath, aTransColStr; - - aInFile = rArgs[ nCurCmd++ ]; - aOutFile = rArgs[ nCurCmd++ ]; - GetCommandOption( rArgs, String( RTL_CONSTASCII_USTRINGPARAM( "format" ) ), aFilterStr ); - GetCommandOption( rArgs, String( RTL_CONSTASCII_USTRINGPARAM( "filterpath" ) ), aFilterPath ); - GetCommandOption( rArgs, '#', aTransColStr ); - - aFilter.SetFilterPath( aFilterPath ); - - if( aInFile.Len() && aOutFile.Len() && aFilterStr.Len() ) - { - const sal_uInt16 nExportFilter = aFilter.GetExportFormatNumberForShortName( aFilterStr ); - - if( GRFILTER_FORMAT_NOTFOUND == nExportFilter ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "invalid graphic filter" ) ), EXIT_INVALID_GRAPHICFILTER ); - else - { - if( DirEntry( aInFile ).Exists() ) - { - SvFileStream aInStm( aInFile, STREAM_READ ); - Graphic aGraphic; - const GfxLink aGfxLink; - - aGraphic.SetLink( aGfxLink ); - - if( aFilter.ImportGraphic( aGraphic, aInFile, aInStm ) == GRFILTER_OK ) - { - SvFileStream aOutStm( aOutFile, STREAM_WRITE | STREAM_TRUNC ); - - if( ( aTransColStr.Len() == 6 ) && aFilter.IsExportPixelFormat( nExportFilter ) ) - { - ByteString aHexStr( aTransColStr, RTL_TEXTENCODING_ASCII_US ); - sal_Bool bHex = sal_True; - - aHexStr.ToLowerAscii(); - - for( sal_uInt16 i = 0; ( i < 6 ) && bHex; i++ ) - if( !isxdigit( aHexStr.GetChar( i ) ) ) - bHex = sal_False; - - if( bHex ) - { - const sal_uInt8 cTransR = ( LOWERHEXTONUM( aHexStr.GetChar( 0 ) ) << 4 ) | LOWERHEXTONUM( aHexStr.GetChar( 1 ) ); - const sal_uInt8 cTransG = ( LOWERHEXTONUM( aHexStr.GetChar( 2 ) ) << 4 ) | LOWERHEXTONUM( aHexStr.GetChar( 3 ) ); - const sal_uInt8 cTransB = ( LOWERHEXTONUM( aHexStr.GetChar( 4 ) ) << 4 ) | LOWERHEXTONUM( aHexStr.GetChar( 5 ) ); - - BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); - Bitmap aOldBmp( aBmpEx.GetBitmap() ); - Bitmap aOldMask( aBmpEx.GetMask() ); - Bitmap aNewMask( aOldBmp.CreateMask( Color( cTransR, cTransG, cTransB ) ) ); - - if( !aOldMask.IsEmpty() ) - aNewMask.CombineSimple( aOldMask, BMP_COMBINE_OR ); - - aGraphic = BitmapEx( aOldBmp, aNewMask ); - } - } - - aFilter.ExportGraphic( aGraphic, aOutFile, aOutStm, nExportFilter ); - - if( aOutStm.GetError() ) - Message( String( RTL_CONSTASCII_USTRINGPARAM( "could not write output file" ) ), EXIT_OUTPUTERROR ); - } - else - Message( String( RTL_CONSTASCII_USTRINGPARAM( "could import graphic" ) ), EXIT_INVALID_INPUTGRAPHIC ); - } - else - Message( String( RTL_CONSTASCII_USTRINGPARAM( "invalid file(s)" ) ), EXIT_INVALID_FILE ); - } - } - } - else - ShowUsage(); - - return cExitCode; -} - -// -------- -// - Main - -// -------- - -int main( int nArgCount, char* ppArgs[] ) -{ - ::std::vector< String > aArgs; - G2GApp aG2GApp; - - InitVCL( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >() ); - - for( int i = 1; i < nArgCount; i++ ) - aArgs.push_back( String( ppArgs[ i ], RTL_TEXTENCODING_ASCII_US ) ); - - return aG2GApp.Start( aArgs ); -} diff --git a/main/toolkit/src2xml/src.lst b/main/toolkit/src2xml/src.lst index 64c2850e64..0b83cd319f 100644 --- a/main/toolkit/src2xml/src.lst +++ b/main/toolkit/src2xml/src.lst @@ -567,7 +567,6 @@ ../../scsolver/source/ui/scsolver.src ../../automation/source/miniapp/servres.src ../../svtools/util/hidother.src -../../svtools/bmpmaker/bmp.src ../../svtools/source/uno/unoifac2.src ../../svtools/source/java/javaerror.src ../../svtools/source/java/patchjavaerror.src