diff options
Diffstat (limited to 'svx/source/gengal')
-rw-r--r-- | svx/source/gengal/gengal.cxx | 319 | ||||
-rw-r--r-- | svx/source/gengal/gengal.sh | 101 | ||||
-rw-r--r-- | svx/source/gengal/gengalrc.in | 12 | ||||
-rw-r--r-- | svx/source/gengal/makefile.mk | 85 |
4 files changed, 0 insertions, 517 deletions
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx deleted file mode 100644 index e7001d176920..000000000000 --- a/svx/source/gengal/gengal.cxx +++ /dev/null @@ -1,319 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -#include <stdio.h> -#include <unistd.h> -#include <memory> -#include <list> - -#include <unotools/streamwrap.hxx> -#include <unotools/ucbstreamhelper.hxx> - -#include <comphelper/processfactory.hxx> -#include <comphelper/regpathhelper.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <cppuhelper/bootstrap.hxx> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/registry/XSimpleRegistry.hpp> - -#include <ucbhelper/contentbroker.hxx> -#include <ucbhelper/configurationkeys.hxx> - -#include <tools/urlobj.hxx> -#include <tools/fsys.hxx> -#include <svtools/filedlg.hxx> - -#include <vcl/window.hxx> -#include <vcl/svapp.hxx> -#include <vcl/font.hxx> -#include <vcl/sound.hxx> -#include <vcl/print.hxx> -#include <vcl/toolbox.hxx> -#include <vcl/help.hxx> -#include <vcl/scrbar.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> - -#include <osl/file.hxx> -#include <osl/process.h> -#include <rtl/bootstrap.hxx> - -#include <svx/galtheme.hxx> -#include <svx/gallery1.hxx> - -using namespace ::vos; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::lang; - -typedef ::std::list<rtl::OUString> FileNameList; - -class GalApp : public Application -{ -public: - virtual void Main(); - -protected: - Reference<XMultiServiceFactory> xMSF; - void Init(); - void InitUCB(); -}; - -Gallery* createGallery( const rtl::OUString& aGalleryURL ) -{ - return new Gallery( aGalleryURL ); -} - -void disposeGallery( Gallery* pGallery ) -{ - delete pGallery; -} - -static void createTheme( rtl::OUString aThemeName, - rtl::OUString aGalleryURL, - rtl::OUString aDestDir, - UINT32 nNumFrom, - FileNameList &rFiles ) -{ - Gallery * pGallery( createGallery( aGalleryURL ) ); - - if (!pGallery ) { - fprintf( stderr, "Could't acquire '%s'\n", - (const sal_Char *) rtl::OUStringToOString( aGalleryURL, - RTL_TEXTENCODING_UTF8 ) ); - exit( 1 ); - } - fprintf( stderr, "Work on gallery '%s'\n", - (const sal_Char *) rtl::OUStringToOString( aGalleryURL, RTL_TEXTENCODING_UTF8 ) ); - - fprintf( stderr, "Existing themes: %lu\n", - sal::static_int_cast< unsigned long >( - pGallery->GetThemeCount() ) ); - - if( !pGallery->HasTheme( aThemeName) ) { - if( !pGallery->CreateTheme( aThemeName, nNumFrom ) ) { - fprintf( stderr, "Failed to create theme\n" ); - disposeGallery( pGallery ); - exit( 1 ); - } - } - - fprintf( stderr, "Existing themes: %lu\n", - sal::static_int_cast< unsigned long >( - pGallery->GetThemeCount() ) ); - - SfxListener aListener; - - GalleryTheme *pGalTheme = pGallery->AcquireTheme( aThemeName, aListener ); - if ( pGalTheme == NULL ) { - fprintf( stderr, "Failed to acquire theme\n" ); - disposeGallery( pGallery ); - exit( 1 ); - } - - fprintf( stderr, "Using DestDir: %s\n", - (const sal_Char *) rtl::OUStringToOString( aDestDir, RTL_TEXTENCODING_UTF8 ) ); - pGalTheme->SetDestDir(String(aDestDir)); - - FileNameList::const_iterator aIter; - - for( aIter = rFiles.begin(); aIter != rFiles.end(); aIter++ ) - { -// Should/could use: -// if ( ! pGalTheme->InsertFileOrDirURL( aURL ) ) { -// Requires a load more components ... - - Graphic aGraphic; - String aFormat; - -#if 1 - if ( ! pGalTheme->InsertURL( *aIter ) ) - fprintf( stderr, "Failed to import '%s'\n", - (const sal_Char *) rtl::OUStringToOString( *aIter, RTL_TEXTENCODING_UTF8 ) ); - else - fprintf( stderr, "Imported file '%s' (%lu)\n", - (const sal_Char *) rtl::OUStringToOString( *aIter, RTL_TEXTENCODING_UTF8 ), - sal::static_int_cast< unsigned long >( - pGalTheme->GetObjectCount() ) ); - -#else // only loads BMPs - SvStream *pStream = ::utl::UcbStreamHelper::CreateStream( *aIter, STREAM_READ ); - if (!pStream) { - fprintf( stderr, "Can't find image to import\n" ); - disposeGallery( pGallery ); - exit (1); - } - *pStream >> aGraphic; - delete pStream; - if( aGraphic.GetType() == GRAPHIC_NONE ) - { - fprintf( stderr, "Failed to load '%s'\n", - (const sal_Char *) rtl::OUStringToOString( *aIter, RTL_TEXTENCODING_UTF8 ) ); - continue; - } - - SgaObjectBmp aObject( aGraphic, *aIter, aFormat ); - if ( ! aObject.IsValid() ) { - fprintf( stderr, "Failed to create thumbnail for image\n" ); - continue; - } - - if ( ! pGalTheme->InsertObject( aObject ) ) { - fprintf( stderr, "Failed to insert file or URL\n" ); - continue; - } -#endif - } - - pGallery->ReleaseTheme( pGalTheme, aListener ); - disposeGallery( pGallery ); -} - -static void PrintHelp() -{ - fprintf( stdout, "Utility to generate OO.o gallery files\n\n" ); - - fprintf( stdout, "using: gengal --name <name> --path <dir> [ --destdir <path> ]\n"); - fprintf( stdout, " [ --number-from <num> ] [ files ... ]\n\n" ); - - fprintf( stdout, "options:\n"); - fprintf( stdout, " --name <theme>\t\tdefines a name of the created or updated theme.\n"); - fprintf( stdout, " --path <dir>\t\tdefines directory where the gallery files are created\n"); - fprintf( stdout, "\t\t\tor updated.\n"); - fprintf( stdout, " --destdir <dir>\tdefines a path prefix to be removed from the paths\n"); - fprintf( stdout, "\t\t\tstored in the gallery files. It is useful to create\n"); - fprintf( stdout, "\t\t\tRPM packages using the BuildRoot feature.\n"); - fprintf( stdout, " --number-from <num>\tdefines minimal number for the newly created gallery\n"); - fprintf( stdout, "\t\t\ttheme files.\n"); - fprintf( stdout, " files\t\t\tlists files to be added to the gallery. Absolute paths\n"); - fprintf( stdout, "\t\t\tare required.\n"); -} - -static rtl::OUString Smartify( const rtl::OUString &rPath ) -{ - INetURLObject aURL; - aURL.SetSmartURL( rPath ); - return aURL.GetMainURL( INetURLObject::NO_DECODE ); -} - -#define OUSTRING_CSTR( str ) \ - rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr() - -void GalApp::Init() -{ - if( getenv( "OOO_INSTALL_PREFIX" ) == NULL ) { - rtl::OUString fileName = GetAppFileName(); - int lastSlash = fileName.lastIndexOf( '/' ); -#ifdef WNT - // Don't know which directory separators GetAppFileName() returns on Windows. - // Be safe and take into consideration they might be backslashes. - if( fileName.lastIndexOf( '\\' ) > lastSlash ) - lastSlash = fileName.lastIndexOf( '\\' ); -#endif - rtl::OUString baseBinDir = fileName.copy( 0, lastSlash ); - rtl::OUString installPrefix = baseBinDir + rtl::OUString::createFromAscii( "/../.." ); - - rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("OOO_INSTALL_PREFIX")); - osl_setEnvironment(envVar.pData, installPrefix.pData); - } - OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) ); - - Reference<XComponentContext> xComponentContext - = ::cppu::defaultBootstrap_InitialComponentContext(); - xMSF = Reference<XMultiServiceFactory> - ( xComponentContext->getServiceManager(), UNO_QUERY ); - if( !xMSF.is() ) - fprintf( stderr, "Failed to bootstrap\n" ); - ::comphelper::setProcessServiceFactory( xMSF ); - - InitUCB(); -} - -void GalApp::InitUCB() -{ - rtl::OUString aEmpty; - Sequence< Any > aArgs(6); - aArgs[0] - <<= rtl::OUString::createFromAscii(UCB_CONFIGURATION_KEY1_LOCAL); - aArgs[1] - <<= rtl::OUString::createFromAscii(UCB_CONFIGURATION_KEY2_OFFICE); - aArgs[2] <<= rtl::OUString::createFromAscii("PIPE"); - aArgs[3] <<= aEmpty; - aArgs[4] <<= rtl::OUString::createFromAscii("PORTAL"); - aArgs[5] <<= aEmpty; - - if (! ::ucbhelper::ContentBroker::initialize( xMSF, aArgs ) ) - fprintf( stderr, "Failed to init content broker\n" ); -} - -void GalApp::Main() -{ - bool bHelp = false; - rtl::OUString aPath, aDestDir; - rtl::OUString aName = rtl::OUString::createFromAscii( "Default name" ); - UINT32 nNumFrom = 0; - FileNameList aFiles; - - for( USHORT i = 0; i < GetCommandLineParamCount(); i++ ) - { - rtl::OUString aParam = GetCommandLineParam( i ); - - if( aParam.equalsAscii( "--help" ) || - aParam.equalsAscii( "-h" ) ) - bHelp = true; - - else if ( aParam.equalsAscii( "--name" ) ) - aName = GetCommandLineParam( ++i ); - - else if ( aParam.equalsAscii( "--path" ) ) - aPath = Smartify( GetCommandLineParam( ++i ) ); - - else if ( aParam.equalsAscii( "--destdir" ) ) - aDestDir = GetCommandLineParam( ++i ); - - else if ( aParam.equalsAscii( "--number-from" ) ) - nNumFrom = GetCommandLineParam( ++i ).ToInt32(); - - else - aFiles.push_back( Smartify( aParam ) ); - } - - if( bHelp ) - { - PrintHelp(); - return; - } - - createTheme( aName, aPath, aDestDir, nNumFrom, aFiles ); -} - -GalApp aGalApp; diff --git a/svx/source/gengal/gengal.sh b/svx/source/gengal/gengal.sh deleted file mode 100644 index a760b8e085d0..000000000000 --- a/svx/source/gengal/gengal.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -# enable file locking -SAL_ENABLE_FILE_LOCKING=1 -export SAL_ENABLE_FILE_LOCKING - -# resolve installation directory -sd_cwd="`pwd`" -if [ -h "$0" ] ; then - sd_basename=`basename "$0"` - sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` - cd "`dirname "$0"`" - cd "`dirname "$sd_script"`" -else - cd "`dirname "$0"`" -fi - -sd_prog="`pwd`" - -cd .. -sd_binary=`basename "$0"`".bin" -sd_inst="`pwd`" - -# change back directory -cd "$sd_cwd" - -# check if all required patches are installed -if [ -x "$sd_prog/sopatchlevel.sh" ]; then - "$sd_prog/sopatchlevel.sh" - if [ $? -eq 1 ]; then - exit 0 - fi -fi - -# set search path for shared libraries -sd_platform=`uname -s` -case $sd_platform in - AIX) - LIBPATH=${sd_prog}${LIBPATH+:${LIBPATH}} - export LIBPATH - ;; - - Darwin) - DYLD_LIBRARY_PATH=${sd_prog}${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}} - export DYLD_LIBRARY_PATH - ;; - - HP-UX) - SHLIB_PATH=${sd_prog}:/usr/openwin/lib${SHLIB_PATH:+:${SHLIB_PATH}} - export SHLIB_PATH - ;; - - *) - LD_LIBRARY_PATH=${sd_prog}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} - export LD_LIBRARY_PATH - ;; -esac - -# misc. environment variables -unset XENVIRONMENT - -# set path so that other apps can be started just by name -PATH="$sd_prog":$PATH -export PATH - -OOO_INSTALL_PREFIX=${OOO_INSTALL_PREFIX-$sd_prog/../..} -if ! test -e $OOO_INSTALL_PREFIX/basis-link; then - # Hack for vanilla OOo binaries' split install layout - OOO_INSTALL_PREFIX=$OOO_INSTALL_PREFIX/../openoffice.org3 -fi - -export OOO_INSTALL_PREFIX - -# execute binary -exec "$sd_prog/$sd_binary" "$@" diff --git a/svx/source/gengal/gengalrc.in b/svx/source/gengal/gengalrc.in deleted file mode 100644 index 00ae5eb3cd5e..000000000000 --- a/svx/source/gengal/gengalrc.in +++ /dev/null @@ -1,12 +0,0 @@ -OOO_INSTALL_PREFIX_URL=file://${OOO_INSTALL_PREFIX} -OOO_BASIS_URL=${OOO_INSTALL_PREFIX_URL}/basis-link -OOO_BASIS_BIN_URL=${OOO_BASIS_URL}/program -OOO_URE_URL=${OOO_BASIS_URL}/ure-link -# -#CFG_INIFILE=${OOO_BASIS_BIN_URL}/configmgrrc -#BaseInstallation=${OOO_BASIS_URL} -BRAND_BASE_DIR=${OOO_INSTALL_PREFIX_URL} -OOO_BASE_DIR=${OOO_BASIS_URL} -# -UNO_TYPES=${OOO_URE_URL}/share/misc/types.rdb ${OOO_BASIS_BIN_URL}/offapi.rdb -UNO_SERVICES=${OOO_URE_URL}/share/misc/services.rdb ${OOO_BASIS_BIN_URL}/services.rdb diff --git a/svx/source/gengal/makefile.mk b/svx/source/gengal/makefile.mk deleted file mode 100644 index eefe8679a139..000000000000 --- a/svx/source/gengal/makefile.mk +++ /dev/null @@ -1,85 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=svx - -TARGET=gengal -TARGETTYPE=GUI -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SCRIPTFILES = $(BIN)$/gengal - -OBJFILES= $(OBJ)$/gengal.obj - -.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2" -APP1TARGET= $(TARGET) -.ELSE # .IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2" -APP1TARGET= $(TARGET).bin -.ENDIF # .IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2" - -APP1OBJS= $(OBJFILES) - -APP1STDLIBS=$(TOOLSLIB) \ - $(SO2LIB) \ - $(SVLLIB) \ - $(COMPHELPERLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(VCLLIB) \ - $(UCBHELPERLIB) \ - $(SVXCORELIB) - -#.IF "$(COM)"=="GCC" -#ADDOPTFILES=$(OBJ)$/gengal.obj -#add_cflagscxx="-frtti -fexceptions" -#.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : \ - $(SCRIPTFILES)\ - $(BIN)/gengalrc - -$(SCRIPTFILES) : $$(@:f:+".sh") - @tr -d "\015" < $(@:f:+".sh") > $@ - -$(BIN)/%: %.in - cp $< $@ - |