summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/bootstrp/makefile.mk9
-rw-r--r--tools/bootstrp/rscdep.cxx59
-rw-r--r--tools/inc/tools/color.hxx2
-rw-r--r--tools/inc/tools/svlibrary.hxx42
-rw-r--r--tools/inc/tools/wintypes.hxx1
-rw-r--r--tools/prj/d.lst1
-rw-r--r--tools/source/generic/makefile.mk3
-rw-r--r--tools/source/generic/svlibrary.cxx129
8 files changed, 196 insertions, 50 deletions
diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk
index b592cb900630..41188d2117d0 100644
--- a/tools/bootstrp/makefile.mk
+++ b/tools/bootstrp/makefile.mk
@@ -38,6 +38,10 @@ LIBTARGET=NO
CDEFS+=-D_TOOLS_STRINGLIST
+.IF "$(HAVE_GETOPT)" == "YES"
+CDEFS += -DHAVE_GETOPT
+.ENDIF
+
# --- Files --------------------------------------------------------
OBJFILES= \
@@ -83,6 +87,11 @@ APP2TARGET= rscdep
APP2OBJS= $(OBJ)$/rscdep.obj
APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib
APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB)
+.IF "$(HAVE_GETOPT)" != "YES"
+.IF "$(OS)"=="WNT"
+APP2STDLIBS+=gnu_getopt.lib
+.ENDIF
+.ENDIF
APP2RPATH= NONE
APP2RPATH= NONE
APP2RPATH= NONE
diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx
index 5c18793c9833..37edfc6a8c18 100644
--- a/tools/bootstrp/rscdep.cxx
+++ b/tools/bootstrp/rscdep.cxx
@@ -45,6 +45,16 @@
#include "cppdep.hxx"
+#if defined WNT
+#if !defined HAVE_GETOPT
+#define __STDC__ 1
+#define __GNU_LIBRARY__
+#include <external/glibc/getopt.h>
+#else
+#include <getopt.h>
+#endif
+#endif
+
class RscHrcDep : public CppDep
{
public:
@@ -70,15 +80,6 @@ void RscHrcDep::Execute()
//static String aDelim;
-/* poor man's getopt() */
-int simple_getopt(char *argv[], const char *optstring);
-#if defined(WNT) || defined(OS2)
-static char *optarg = NULL;
-static int optind = 1;
-static int optopt = 0;
-static int opterr = 0;
-#endif
-
SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{
int c;
@@ -179,7 +180,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
while( 1 )
{
- c = simple_getopt( argv,
+ c = getopt( argc, argv,
"_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\"");
if ( c == -1 )
break;
@@ -296,41 +297,3 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
return 0;
}
-/* my very simple minded implementation of getopt()
- * it's too sad that getopt() is not available everywhere
- * note: this is not a full POSIX conforming getopt()
- */
-int simple_getopt(char *argv[], const char *optstring)
-{
- char *arg = argv[optind];
-
- /* skip all response file arguments */
- if ( arg ) {
- while ( *arg == '@' )
- arg = argv[++optind];
-
- if ( arg[0] == '-' && arg[1] != '\0' ) {
- const char *popt;
- int c = arg[1];
- if ( (popt = strchr(optstring, c)) == NULL ) {
- optopt = c;
- if ( opterr )
- fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
- return '?';
- }
- if ( *(++popt) == ':') {
- if ( arg[2] != '\0' ) {
- optarg = ++arg;
- } else {
- optarg = argv[++optind];
- }
- } else {
- optarg = NULL;
- }
- ++optind;
- return c;
- }
- }
- return -1;
-}
-
diff --git a/tools/inc/tools/color.hxx b/tools/inc/tools/color.hxx
index 56d596453740..a99ad1dd11c4 100644
--- a/tools/inc/tools/color.hxx
+++ b/tools/inc/tools/color.hxx
@@ -78,7 +78,7 @@ typedef UINT32 ColorData;
#define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 )
#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF )
#define COL_TRANSPARENT TRGB_COLORDATA( 0xFF, 0xFF, 0xFF, 0xFF )
-#define COL_AUTO (UINT32)0xFFFFFFFF
+#define COL_AUTO (ColorData)0xFFFFFFFF
#define COL_AUTHOR1_DARK RGB_COLORDATA(198, 146, 0)
#define COL_AUTHOR1_NORMAL RGB_COLORDATA(255, 255, 158)
#define COL_AUTHOR1_LIGHT RGB_COLORDATA(255, 255, 195)
diff --git a/tools/inc/tools/svlibrary.hxx b/tools/inc/tools/svlibrary.hxx
new file mode 100644
index 000000000000..fa8ff7c8068b
--- /dev/null
+++ b/tools/inc/tools/svlibrary.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _SVLIBRARY_HXX
+#define _SVLIBRARY_HXX
+
+#include "tools/toolsdllapi.h"
+
+#include <osl/module.hxx>
+#include <rtl/ustring.hxx>
+
+class TOOLS_DLLPUBLIC SvLibrary
+{
+public:
+ static bool LoadModule( osl::Module&, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode = SAL_LOADMODULE_DEFAULT );
+};
+
+#endif
+
diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx
index 8f13af8fd842..7d6296b76e8c 100644
--- a/tools/inc/tools/wintypes.hxx
+++ b/tools/inc/tools/wintypes.hxx
@@ -215,6 +215,7 @@ typedef sal_Int64 WinBits;
// Window-Bits for CheckBox
#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000))
+#define WB_EARLYTOGGLE ((WinBits)SAL_CONST_INT64(0x4000000000))
// Window-Bits for Edit
#define WB_PASSWORD ((WinBits)0x01000000)
diff --git a/tools/prj/d.lst b/tools/prj/d.lst
index 6b4a99a3a676..e0291c2f8ad0 100644
--- a/tools/prj/d.lst
+++ b/tools/prj/d.lst
@@ -37,6 +37,7 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp
..\inc\tools\postextstl.h %_DEST%\inc%_EXT%\tools\postextstl.h
..\inc\tools\preextstl.h %_DEST%\inc%_EXT%\tools\preextstl.h
+..\inc\tools\svlibrary.hxx %_DEST%\inc%_EXT%\tools\svlibrary.hxx
..\inc\tools\solarmutex.hxx %_DEST%\inc%_EXT%\tools\solarmutex.hxx
..\inc\tools\wintypes.hxx %_DEST%\inc%_EXT%\tools\wintypes.hxx
..\inc\tools\mapunit.hxx %_DEST%\inc%_EXT%\tools\mapunit.hxx
diff --git a/tools/source/generic/makefile.mk b/tools/source/generic/makefile.mk
index 5cdaa02065ae..07bab82f32b0 100644
--- a/tools/source/generic/makefile.mk
+++ b/tools/source/generic/makefile.mk
@@ -37,9 +37,10 @@ TARGET=gen
# --- Files --------------------------------------------------------
-EXCEPTIONSFILES = $(SLO)$/poly.obj $(OBJ)$/poly.obj
+EXCEPTIONSFILES = $(SLO)$/poly.obj $(OBJ)$/poly.obj $(SLO)$/svlibrary.obj
SLOFILES= $(SLO)$/toolsin.obj \
+ $(SLO)$/svlibrary.obj \
$(SLO)$/b3dtrans.obj \
$(SLO)$/link.obj \
$(SLO)$/bigint.obj \
diff --git a/tools/source/generic/svlibrary.cxx b/tools/source/generic/svlibrary.cxx
new file mode 100644
index 000000000000..6ebfd0086b5c
--- /dev/null
+++ b/tools/source/generic/svlibrary.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * 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_tools.hxx"
+
+#include <tools/svlibrary.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/string.hxx>
+#include <rtl/uri.hxx>
+
+using namespace com::sun::star;
+
+static uno::Sequence< rtl::OUString > GetMultiPaths_Impl()
+{
+ uno::Sequence< rtl::OUString > aRes;
+ uno::Sequence< rtl::OUString > aInternalPaths;
+ uno::Sequence< rtl::OUString > aUserPaths;
+
+ bool bSuccess = true;
+ uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ try
+ {
+ String aInternal;
+ aInternal.AppendAscii("Libraries");
+ String aUser;
+ aUser.AppendAscii("Libraries");
+ aInternal .AppendAscii( "_internal" );
+ aUser .AppendAscii( "_user" );
+
+ uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW );
+ xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths;
+ xPathSettings->getPropertyValue( aUser ) >>= aUserPaths;
+ }
+ catch (uno::Exception &)
+ {
+ bSuccess = false;
+ }
+ }
+ if (bSuccess)
+ {
+ sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
+ aRes.realloc( nMaxEntries );
+ rtl::OUString *pRes = aRes.getArray();
+ sal_Int32 nCount = 0; // number of actually added entries
+ for (int i = 0; i < 2; ++i)
+ {
+ const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths;
+ const rtl::OUString *pPathSeq = rPathSeq.getConstArray();
+ for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k)
+ {
+ const bool bAddUser = (&rPathSeq == &aUserPaths);
+ const bool bAddInternal = (&rPathSeq == &aInternalPaths);
+ if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0)
+ pRes[ nCount++ ] = pPathSeq[k];
+ }
+ }
+ aRes.realloc( nCount );
+ }
+
+ return aRes;
+}
+
+bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode )
+{
+ static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl();
+ bool bLoaded = false;
+
+ for (sal_Int32 n=0; n<aPaths.getLength(); n++)
+ {
+ rtl::OUString aMod = aPaths[n];
+ if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0)
+ {
+ uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext();
+ uno::Reference< util::XMacroExpander > xMacroExpander;
+ xComponentContext->getValueByName(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) )
+ >>= xMacroExpander;
+
+ aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 );
+ aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
+ aMod = xMacroExpander->expandMacros( aMod );
+ }
+
+ aMod += ::rtl::OUString( sal_Unicode('/') );
+ aMod += rLibName;
+ bLoaded = rModule.load( aMod, mode );
+ if ( bLoaded )
+ break;
+ }
+
+ if (!bLoaded )
+ bLoaded = rModule.loadRelative( baseModule, rLibName, mode );
+
+ return bLoaded;
+}