summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-01-22 17:12:19 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-01-22 17:12:19 +0000
commitd49f2b5bfd79749e448b45fdab9d98313af48356 (patch)
tree5f87382b9207e8db744fde3b9232c718dd4c6a86 /desktop
parent0e18fd2829069f1b8ec018ccfbf2fc4c4e7698b1 (diff)
#i10000# missing changes from jl111
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx11
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatability.cxx8
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx4
-rw-r--r--desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx7
-rw-r--r--desktop/source/deployment/inc/dp_descriptioninfoset.hxx7
-rw-r--r--desktop/source/deployment/inc/dp_misc.h49
-rw-r--r--desktop/source/deployment/manager/dp_manager.cxx4
-rw-r--r--desktop/source/deployment/misc/dp_descriptioninfoset.cxx8
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx122
-rw-r--r--desktop/source/deployment/misc/dp_platform.cxx6
-rw-r--r--desktop/source/deployment/registry/dp_registry.cxx15
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx63
-rw-r--r--desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx18
-rw-r--r--desktop/source/deployment/registry/sfwk/dp_sfwk.cxx17
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_app.cxx106
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx81
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_shared.h40
-rw-r--r--desktop/test/deployment/description/desc1.oxtbin0 -> 2096 bytes
-rw-r--r--desktop/test/deployment/description/desc2.oxtbin0 -> 2091 bytes
-rw-r--r--desktop/test/deployment/description/desc3.oxtbin0 -> 2070 bytes
-rw-r--r--desktop/test/deployment/description/desc4.oxtbin0 -> 2061 bytes
-rw-r--r--desktop/test/deployment/description/desc5.oxtbin0 -> 2041 bytes
-rwxr-xr-xdesktop/test/deployment/description/readme.txt23
-rw-r--r--desktop/win32/source/guistdio/guistdio.inc109
-rw-r--r--desktop/win32/source/guistdio/unopkgio.cxx4
25 files changed, 502 insertions, 200 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 3c28ebd1ba..07c0fbca21 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -373,11 +373,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
uno::Any request( xRequest->getRequest() );
OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION );
-#if OSL_DEBUG_LEVEL > 1
- OSL_TRACE( "[dp_gui_cmdenv.cxx] incoming request:\n%s\n",
- ::rtl::OUStringToOString( ::comphelper::anyToString(request),
- RTL_TEXTENCODING_UTF8 ).getStr() );
-#endif
+ dp_misc::TRACE( OUSTR("[dp_gui_cmdenv.cxx] incoming request:\n")
+ + ::comphelper::anyToString(request) + OUSTR("\n"));
lang::WrappedTargetException wtExc;
deployment::DependencyException depExc;
@@ -790,8 +787,8 @@ void ExtensionCmdQueue::Thread::execute()
{
if ( m_wakeup.wait() != osl::Condition::result_ok )
{
- OSL_TRACE( "dp_gui::ExtensionCmdQueue::Thread::run: ignored "
- "osl::Condition::wait failure" );
+ dp_misc::TRACE( "dp_gui::ExtensionCmdQueue::Thread::run: ignored "
+ "osl::Condition::wait failure\n" );
}
m_wakeup.reset();
diff --git a/desktop/source/deployment/gui/dp_gui_updatability.cxx b/desktop/source/deployment/gui/dp_gui_updatability.cxx
index 46fffabac4..d78ade6a8f 100644
--- a/desktop/source/deployment/gui/dp_gui_updatability.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatability.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_gui_updatability.cxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.86.1 $
*
* This file is part of OpenOffice.org.
*
@@ -151,10 +151,10 @@ Updatability::Thread::~Thread() {}
void Updatability::Thread::execute() {
for (;;) {
+
if (m_wakeup.wait() != osl::Condition::result_ok) {
- OSL_TRACE(
- "dp_gui::Updatability::Thread::run: ignored "
- "osl::Condition::wait failure");
+ dp_misc::TRACE("dp_gui::Updatability::Thread::run: ignored \n");
+ dp_misc::TRACE("osl::Condition::wait failure\n");
}
m_wakeup.reset();
Input input;
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index bbdc62c309..82ee9e0c6f 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -903,8 +903,8 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly,
}
catch( const css::uno::Exception& e )
{
- OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
- rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ dp_misc::TRACE( OUSTR("Caught exception: ")
+ + e.Message + OUSTR("\n thread terminated.\n\n"));
}
}
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
index 3536fc679e..d58f744286 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
@@ -658,11 +658,8 @@ void UpdateCommandEnv::handle(
{
cssu::Any request( xRequest->getRequest() );
OSL_ASSERT( request.getValueTypeClass() == cssu::TypeClass_EXCEPTION );
-#if OSL_DEBUG_LEVEL > 1
- OSL_TRACE( "[dp_gui_cmdenv.cxx] incoming request:\n%s\n",
- ::rtl::OUStringToOString( ::comphelper::anyToString(request),
- RTL_TEXTENCODING_UTF8 ).getStr() );
-#endif
+ dp_misc::TRACE(OUSTR("[dp_gui_cmdenv.cxx] incoming request:\n")
+ + ::comphelper::anyToString(request) + OUSTR("\n\n"));
css::deployment::VersionException verExc;
bool approve = false;
diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx
index f1b298ffca..3ee49627ef 100644
--- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx
+++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_descriptioninfoset.hxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.34.1 $
*
* This file is part of OpenOffice.org.
*
@@ -162,6 +162,11 @@ public:
*/
::boost::optional< ::rtl::OUString > getLocalizedUpdateWebsiteURL() const;
+ /** returns the relative URL to the description.
+
+ The URL is relative to the root directory of the extensions.
+ */
+ ::rtl::OUString getLocalizedDescriptionURL() const;
/**
Return the dependencies.
diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h
index ee67569f34..20437d0391 100644
--- a/desktop/source/deployment/inc/dp_misc.h
+++ b/desktop/source/deployment/inc/dp_misc.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_misc.h,v $
- * $Revision: 1.13 $
+ * $Revision: 1.13.86.2 $
*
* This file is part of OpenOffice.org.
*
@@ -106,7 +106,54 @@ oslProcess raiseProcess( ::rtl::OUString const & appURL,
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
::rtl::OUString getExtensionDefaultUpdateURL();
+/** writes the argument string to the console.
+ On Linux/Unix/etc. it converts the UTF16 string to an ANSI string using
+ osl_getThreadTextEncoding() as target encoding. On Windows it uses WriteFile
+ with the standard out stream. unopkg.com reads the data and prints them out using
+ WriteConsoleW.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void writeConsole(::rtl::OUString const & sText);
+
+/** writes the argument string to the console.
+ On Linux/Unix/etc. the string is passed into fprintf without any conversion.
+ On Windows the string is converted to UTF16 assuming the argument is UTF8
+ encoded. The UTF16 string is written to stdout with WriteFile. unopkg.com
+ reads the data and prints them out using WriteConsoleW.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void writeConsole(::rtl::OString const & sText);
+/** writes the argument to the console using the error stream.
+ Otherwise the same as writeConsole.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void writeConsoleError(::rtl::OUString const & sText);
+
+
+/** writes the argument to the console using the error stream.
+ Otherwise the same as writeConsole.
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void writeConsoleError(::rtl::OString const & sText);
+
+
+/** reads from the console.
+ On Linux/Unix/etc. it uses fgets to read char values and converts them to OUString
+ using osl_getThreadTextEncoding as target encoding. The returned string has a maximum
+ size of 1024 and does NOT include leading and trailing white space(applied OUString::trim())
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+::rtl::OUString readConsole();
+
+/** print the text to the console in a debug build.
+ The argument is forwarded to writeConsole. The function does not add new line.
+ The code is only executed if OSL_DEBUG_LEVEL > 1
+*/
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void TRACE(::rtl::OUString const & sText);
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
+void TRACE(::rtl::OString const & sText);
}
#endif
diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 1138514af1..ed5e11a98b 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_manager.cxx,v $
- * $Revision: 1.34 $
+ * $Revision: 1.33.8.2 $
*
* This file is part of OpenOffice.org.
*
@@ -627,7 +627,7 @@ bool PackageManagerImpl::checkInstall(
{
Any request(
deployment::InstallException(
- OUSTR("Extension ") + id + OUSTR("is about to be installed."),
+ OUSTR("Extension ") + id + OUSTR(" is about to be installed."),
static_cast<OWeakObject *>(this), package));
bool approve = false, abort = false;
if (! interactContinuation(
diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
index 9898bd69ed..d3c7f28115 100644
--- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
+++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_descriptioninfoset.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.34.1 $
*
* This file is part of OpenOffice.org.
*
@@ -373,6 +373,12 @@ css::uno::Sequence< ::rtl::OUString > DescriptionInfoset::getUrls(
}
+::rtl::OUString DescriptionInfoset::getLocalizedDescriptionURL() const
+{
+ return getLocalizedHREFAttrFromChild(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "/desc:description/desc:extension-description")), NULL);
+}
+
css::uno::Reference< css::xml::dom::XNode >
DescriptionInfoset::getLocalizedChild( const ::rtl::OUString & sParent) const
{
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index bc94fde3fc..c067b26d1a 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_misc.cxx,v $
- * $Revision: 1.20 $
+ * $Revision: 1.19.8.4 $
*
* This file is part of OpenOffice.org.
*
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+
#include "dp_misc.h"
#include "dp_interact.h"
#include "rtl/uri.hxx"
@@ -49,10 +50,19 @@
#include "boost/scoped_array.hpp"
#include "boost/shared_ptr.hpp"
+#ifdef WNT
+//#include "tools/prewin.h"
+#define UNICODE
+#define _UNICODE
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+//#include "tools/postwin.h"
+#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using ::rtl::OUString;
+using ::rtl::OString;
#define SOFFICE1 "soffice.exe"
@@ -350,4 +360,114 @@ OUString getExtensionDefaultUpdateURL()
}
+#ifdef WNT
+void writeConsoleWithStream(::rtl::OUString const & sText, HANDLE stream)
+{
+ DWORD nWrittenChars = 0;
+ WriteFile(stream, sText.getStr(),
+ sText.getLength() * 2, &nWrittenChars, NULL);
+}
+#else
+void writeConsoleWithStream(::rtl::OUString const & sText, FILE * stream)
+{
+ OString s = OUStringToOString(sText, osl_getThreadTextEncoding());
+ fprintf(stream, "%s", s.getStr());
+ fflush(stream);
+}
+#endif
+
+#ifdef WNT
+void writeConsoleWithStream(::rtl::OString const & sText, HANDLE stream)
+{
+ writeConsoleWithStream(OStringToOUString(
+ sText, RTL_TEXTENCODING_UTF8), stream);
+}
+#else
+void writeConsoleWithStream(::rtl::OString const & sText, FILE * stream)
+{
+ fprintf(stream, "%s", sText.getStr());
+ fflush(stream);
+}
+#endif
+
+void writeConsole(::rtl::OUString const & sText)
+{
+#ifdef WNT
+ writeConsoleWithStream(sText, GetStdHandle(STD_OUTPUT_HANDLE));
+#else
+ writeConsoleWithStream(sText, stdout);
+#endif
+}
+
+void writeConsole(::rtl::OString const & sText)
+{
+#ifdef WNT
+ writeConsoleWithStream(sText, GetStdHandle(STD_OUTPUT_HANDLE));
+#else
+ writeConsoleWithStream(sText, stdout);
+#endif
+}
+
+void writeConsoleError(::rtl::OUString const & sText)
+{
+#ifdef WNT
+ writeConsoleWithStream(sText, GetStdHandle(STD_ERROR_HANDLE));
+#else
+ writeConsoleWithStream(sText, stderr);
+#endif
+}
+
+
+void writeConsoleError(::rtl::OString const & sText)
+{
+#ifdef WNT
+ writeConsoleWithStream(sText, GetStdHandle(STD_ERROR_HANDLE));
+#else
+ writeConsoleWithStream(sText, stderr);
+#endif
+}
+
+
+
+OUString readConsole()
+{
+#ifdef WNT
+ sal_Unicode aBuffer[1024];
+ DWORD dwRead = 0;
+ //unopkg.com feeds unopkg.exe with wchar_t|s
+ if (ReadFile( GetStdHandle(STD_INPUT_HANDLE), &aBuffer, sizeof(aBuffer), &dwRead, NULL ) )
+ {
+ OSL_ASSERT((dwRead % 2) == 0);
+ OUString value( aBuffer, dwRead / 2);
+ value = value.trim();
+ return value;
+ }
+ return OUString();
+
+#else
+ char buf[1024];
+ rtl_zeroMemory(buf, 1024);
+ // read one char less so that the last char in buf is always zero
+ fgets(buf, 1024, stdin);
+ OUString value = ::rtl::OStringToOUString(::rtl::OString(buf), osl_getThreadTextEncoding());
+ return value.trim();
+#endif
+}
+
+void TRACE(::rtl::OUString const & sText)
+{
+ (void) sText;
+#if OSL_DEBUG_LEVEL > 1
+ writeConsole(sText);
+#endif
+}
+
+void TRACE(::rtl::OString const & sText)
+{
+ (void) sText;
+#if OSL_DEBUG_LEVEL > 1
+ writeConsole(sText);
+#endif
+}
+
}
diff --git a/desktop/source/deployment/misc/dp_platform.cxx b/desktop/source/deployment/misc/dp_platform.cxx
index bbf3d2bc0f..a61fd6c4af 100644
--- a/desktop/source/deployment/misc/dp_platform.cxx
+++ b/desktop/source/deployment/misc/dp_platform.cxx
@@ -8,7 +8,7 @@
*
* $RCSfile: dp_platform.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.2.86.2 $
*
* This file is part of OpenOffice.org.
*
@@ -63,7 +63,7 @@
#define PLATFORM_FREEBSD_X86_64 "freebsd_x86_64"
#define PLATFORM_MACOSX_X86 "macosx_x86"
#define PLATFORM_MACOSX_PPC "macosx_powerpc"
-#define PLATFORM_OS2_X86 "os/2_x86"
+#define PLATFORM_OS2_X86 "os2_x86"
@@ -165,7 +165,7 @@ namespace
else if (token.equals(OUSTR(PLATFORM_MACOSX_PPC)))
ret = checkOSandCPU(OUSTR("MacOSX"), OUSTR("PowerPC"));
else if (token.equals(OUSTR(PLATFORM_OS2_X86)))
- ret = checkOSandCPU(OUSTR("OS/2"), OUSTR("x86"));
+ ret = checkOSandCPU(OUSTR("OS2"), OUSTR("x86"));
else
{
OSL_ENSURE(0, "Extension Manager: The extension supports an unknown platform. "
diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx
index 3ea6d7d7fd..543bb4fd6c 100644
--- a/desktop/source/deployment/registry/dp_registry.cxx
+++ b/desktop/source/deployment/registry/dp_registry.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_registry.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.86.1 $
*
* This file is part of OpenOffice.org.
*
@@ -63,6 +63,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
using ::rtl::OUString;
+
namespace dp_registry {
namespace backend {
@@ -362,7 +363,7 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create(
// dump tables:
{
t_registryset allBackends;
- OSL_TRACE( "> [dp_registry.cxx] media-type detection:" );
+ dp_misc::TRACE("> [dp_registry.cxx] media-type detection:\n\n" );
for ( t_string2string::const_iterator iPos(
that->m_filter2mediaType.begin() );
iPos != that->m_filter2mediaType.end(); ++iPos )
@@ -381,11 +382,9 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create(
buf.append( Reference<lang::XServiceInfo>(
xBackend, UNO_QUERY_THROW )
->getImplementationName() );
- OSL_TRACE( ::rtl::OUStringToOString(
- buf.makeStringAndClear(),
- RTL_TEXTENCODING_UTF8 ).getStr() );
+ dp_misc::writeConsole( buf.makeStringAndClear() + OUSTR("\n"));
}
- OSL_TRACE( "> [dp_registry.cxx] ambiguous backends:" );
+ dp_misc::TRACE( "> [dp_registry.cxx] ambiguous backends:\n\n" );
for ( t_registryset::const_iterator iPos(
that->m_ambiguousBackends.begin() );
iPos != that->m_ambiguousBackends.end(); ++iPos )
@@ -410,9 +409,7 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create(
if (pos < (types.getLength() - 1))
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") );
}
- OSL_TRACE( ::rtl::OUStringToOString(
- buf.makeStringAndClear(),
- RTL_TEXTENCODING_UTF8 ).getStr() );
+ dp_misc::TRACE(buf.makeStringAndClear() + OUSTR("\n\n"));
}
allBackends.insert( that->m_ambiguousBackends.begin(),
that->m_ambiguousBackends.end() );
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 8f9b551852..a1452ee782 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_package.cxx,v $
- * $Revision: 1.35 $
+ * $Revision: 1.34.16.2 $
*
* This file is part of OpenOffice.org.
*
@@ -99,8 +99,10 @@ class BackendImpl : public ImplBaseT
class PackageImpl : public ::dp_registry::backend::Package
{
BackendImpl * getMyBackend() const;
-
- OUString m_description;
+ /** constains the old tooltip description for the Extension Manager GUI in OOo v.2.x
+ We keep it for backward compatibility.
+ */
+ OUString m_oldDescription;
OUString m_url_expanded;
const bool m_legacyBundle;
Sequence< Reference<deployment::XPackage> > m_bundle;
@@ -141,7 +143,8 @@ class BackendImpl : public ImplBaseT
css::ucb::CommandFailedException,
css::ucb::CommandAbortedException,
css::uno::RuntimeException);
- OUString getLicenseText(
+ // @throws DeploymentException
+ OUString getTextFromURL(
const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv,
const OUString& licenseUrl);
@@ -446,44 +449,22 @@ BackendImpl::PackageImpl::isRegistered_(
present, beans::Ambiguous<sal_Bool>(reg, ambig) );
}
-OUString BackendImpl::PackageImpl::getLicenseText(
+OUString BackendImpl::PackageImpl::getTextFromURL(
const css::uno::Reference< css::ucb::XCommandEnvironment >& xCmdEnv,
const OUString& licenseUrl)
{
try
{
::ucbhelper::Content descContent(licenseUrl, xCmdEnv);
- css::uno::Reference<css::io::XInputStream> xInput = descContent.openStream();
-
- //read out the complete content and create a string
- const sal_Int32 nConstBufferSize = 32000;
- sal_Int32 nRead = 0;
- css::uno::Sequence<sal_Int8> seqTemp(nConstBufferSize);
- css::uno::Sequence<sal_Int8> seqAll(0);
-
- do
- {
- nRead = xInput->readBytes ( seqTemp, nConstBufferSize );
- sal_Int32 lenAll = seqAll.getLength();
- seqAll.realloc(seqAll.getLength() + nRead);
- sal_Int8 const * arTemp = seqTemp.getConstArray();
- sal_Int8 * arAll = seqAll.getArray();
- rtl_copyMemory(arAll + lenAll, arTemp, nRead);
- }
- while ( nRead == nConstBufferSize );
-
- xInput->closeInput();
-
- OUString sLic(reinterpret_cast<sal_Char const *>(seqAll.getConstArray()),
- seqAll.getLength(), RTL_TEXTENCODING_UTF8);
-
- return sLic;
+ ::rtl::ByteSequence seq = dp_misc::readFile(descContent);
+ return OUString( reinterpret_cast<sal_Char const *>(
+ seq.getConstArray()), seq.getLength(), RTL_TEXTENCODING_UTF8);
}
catch (css::uno::Exception&)
{
Any exc( ::cppu::getCaughtException() );
throw css::deployment::DeploymentException(
- OUSTR("Could not read license text in ") + licenseUrl, 0, exc);
+ OUSTR("Could not read file ") + licenseUrl, 0, exc);
}
}
@@ -600,7 +581,7 @@ bool BackendImpl::PackageImpl::checkDependencies(
throw css::deployment::DeploymentException(
OUSTR("Could not obtain path to license. Possible error in description.xml"), 0, Any());
OUString sHref = desc.getExtensionRootUrl() + OUSTR("/") + sLic;
- OUString sLicense = getLicenseText(xCmdEnv, sHref);
+ OUString sLicense = getTextFromURL(xCmdEnv, sHref);
//determine who has to agree to the license
css::uno::Reference<css::xml::xpath::XXPathObject> nodeAttribWho3 =
xPath->eval(nodeSimpleLic,
@@ -904,7 +885,21 @@ void BackendImpl::PackageImpl::processPackage_(
//______________________________________________________________________________
OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException)
{
- return m_description;
+ const OUString sRelativeURL(getDescriptionInfoset().getLocalizedDescriptionURL());
+ OUString sDescription;
+ if (sRelativeURL.getLength())
+ {
+ OUString sURL = m_url_expanded + OUSTR("/") + sRelativeURL;
+ sDescription = getTextFromURL(
+ css::uno::Reference< css::ucb::XCommandEnvironment >(), sURL);
+
+ }
+ if (sDescription.getLength())
+ return sDescription;
+ else if(m_oldDescription.getLength() == 0)
+ return m_oldDescription;
+ else
+ return OUString();
}
//______________________________________________________________________________
@@ -1392,7 +1387,7 @@ void BackendImpl::PackageImpl::scanBundle(
{
buf.append( Package::getDescription() );
}
- m_description = buf.makeStringAndClear();
+ m_oldDescription = buf.makeStringAndClear();
}
}
}
diff --git a/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx b/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx
index 607c2caec7..0653934af9 100644
--- a/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx
+++ b/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_parceldesc.cxx,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.86.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,8 +30,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+#include "dp_misc.h"
#include "dp_parceldesc.hxx"
+
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -93,8 +96,9 @@ ParcelDescDocHandler::startElement( const OUString& aName,
throw ( xml::sax::SAXException,
RuntimeException )
{
- OSL_TRACE("ParcelDescDocHandler::startElement() for %s",
- rtl::OUStringToOString( aName, RTL_TEXTENCODING_ASCII_US ).getStr() );
+
+ dp_misc::TRACE(OUSTR("ParcelDescDocHandler::startElement() for ") +
+ aName + OUSTR("\n"));
if ( !skipIndex )
{
if ( aName.equals( OUString::createFromAscii( "parcel" ) ) )
@@ -105,8 +109,8 @@ ParcelDescDocHandler::startElement( const OUString& aName,
}
else
{
- OSL_TRACE("ParcelDescDocHandler::startElement() skipping for %s",
- rtl::OUStringToOString( aName, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ dp_misc::TRACE(OUSTR("ParcelDescDocHandler::startElement() skipping for ")
+ + aName + OUSTR("\n"));
}
}
@@ -117,8 +121,8 @@ void SAL_CALL ParcelDescDocHandler::endElement( const OUString & aName )
if ( skipIndex )
{
--skipIndex;
- OSL_TRACE("ParcelDescDocHandler::endElement() skipping for %s",
- rtl::OUStringToOString( aName, RTL_TEXTENCODING_ASCII_US ).getStr() );
+ dp_misc::TRACE(OUSTR("ParcelDescDocHandler::endElement() skipping for ")
+ + aName + OUSTR("\n"));
}
}
diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
index 64dec79ee3..c460409890 100644
--- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
+++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dp_sfwk.cxx,v $
- * $Revision: 1.16 $
+ * $Revision: 1.16.66.1 $
*
* This file is part of OpenOffice.org.
*
@@ -153,8 +153,7 @@ BackendImpl::PackageImpl::PackageImpl(
rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
m_name = m_displayName;
- OSL_TRACE("PakageImpl displayName is %s",
- ::rtl::OUStringToOString( m_displayName , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
+ dp_misc::TRACE(OUSTR("PakageImpl displayName is ") + m_displayName);
}
//______________________________________________________________________________
@@ -294,12 +293,10 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
sal_Int32 startOfReplace = sfwkLibType.indexOf( MACRONAME );
sal_Int32 charsToReplace = MACRONAME.getLength();
sfwkLibType = sfwkLibType.replaceAt( startOfReplace, charsToReplace, lang );
- OSL_TRACE("******************************");
- OSL_TRACE(" BackEnd detected lang = %s ",
- rtl::OUStringToOString( lang, RTL_TEXTENCODING_ASCII_US ).getStr() );
- OSL_TRACE(" for url %s",
- rtl::OUStringToOString( sParcelDescURL, RTL_TEXTENCODING_ASCII_US ).getStr() );
- OSL_TRACE("******************************");
+ dp_misc::TRACE("******************************\n");
+ dp_misc::TRACE(OUSTR(" BackEnd detected lang = ") + lang + OUSTR("\n"));
+ dp_misc::TRACE(OUSTR(" for url ") + sParcelDescURL + OUSTR("\n") );
+ dp_misc::TRACE("******************************\n");
return new PackageImpl( this, url, sfwkLibType );
}
}
@@ -374,7 +371,7 @@ void BackendImpl::PackageImpl::processPackage_(
{
if ( !m_xNameCntrPkgHandler.is() )
{
- OSL_TRACE("no package handler!!!!");
+ dp_misc::TRACE("no package handler!!!!\n");
throw RuntimeException( OUSTR("No package Handler " ),
Reference< XInterface >() );
}
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index 6ec2552ee0..bc5fb098f8 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -30,6 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "dp_misc.h"
#include "unopkg_main.h"
#include "unopkg_shared.h"
#include "dp_identifier.hxx"
@@ -53,8 +54,6 @@
#include <stdio.h>
#include <vector>
-#define APP_NAME "unopkg"
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -94,8 +93,8 @@ const char s_usingText [] =
" --deployment-context expert feature: explicit deployment context\n"
" <context>\n"
"\n"
-"For details concerning deployment and this tool, please read the developer's\n"
-"guide: http://api.openoffice.org/DevelopersGuide/" APP_NAME ".html\n";
+"To learn more about the Extension Manager and extensions, see:\n"
+"http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions\n\n";
//------------------------------------------------------------------------------
const OptionInfo s_option_infos [] = {
@@ -205,7 +204,6 @@ extern "C" int unopkg_main()
{
tools::extendApplicationEnvironment();
DisposeGuard disposeGuard;
- rtl_TextEncoding textenc = osl_getThreadTextEncoding();
bool bNoOtherErrorMsg = false;
OUString subCommand;
bool option_shared = false;
@@ -244,15 +242,15 @@ extern "C" int unopkg_main()
sal_uInt32 nCount = osl_getCommandArgCount();
if (nCount == 0 || isOption( info_help, &nPos ))
{
- printf( "%s\n", s_usingText );
+ dp_misc::writeConsole(s_usingText);
return 0;
}
else if (isOption( info_version, &nPos )) {
- printf( "\n%s Version 1.0\n", APP_NAME );
+ dp_misc::writeConsole("\n"APP_NAME" Version 3.0\n");
return 0;
}
//consume all bootstrap variables which may occur before the subcommannd
- while(isBootstrapVariable(&nPos)) ;
+ while(isBootstrapVariable(&nPos));
if(nPos >= nCount)
return 0;
@@ -287,13 +285,13 @@ extern "C" int unopkg_main()
if (cmdArg[ 0 ] == '-')
{
// is option:
- fprintf( stderr,
- "\nERROR: unexpected option %s!\n"
- " Use " APP_NAME
- " %s to print all options.\n",
- ::rtl::OUStringToOString(
- cmdArg, textenc ).getStr(),
- toString( info_help ).getStr() );
+ dp_misc::writeConsoleError(
+ OUSTR("\nERROR: unexpected option ") +
+ cmdArg +
+ OUSTR("!\n") +
+ OUSTR(" Use " APP_NAME " ") +
+ toString(info_help) +
+ OUSTR(" to print all options.\n"));
return 1;
}
else
@@ -312,7 +310,7 @@ extern "C" int unopkg_main()
//make sure the bundled option was provided together with shared
if (option_bundled && !option_shared)
{
- fprintf( stderr,
+ dp_misc::writeConsoleError(
"\nERROR: option --bundled can only be used together with --shared!");
return 1;
}
@@ -332,10 +330,11 @@ extern "C" int unopkg_main()
option_shared = true;
}
else if (option_shared) {
- fprintf( stderr,
- "WARNING: explicit context given! "
- "Ignoring option %s!\n",
- toString( info_shared ).getStr() );
+ dp_misc::writeConsoleError(
+ OUSTR("WARNING: explicit context given! ") +
+ OUSTR("Ignoring option ") +
+ toString( info_shared ) +
+ OUSTR("!\n") );
}
}
@@ -404,9 +403,8 @@ extern "C" int unopkg_main()
{
packages = xPackageManager->getDeployedPackages(
Reference<task::XAbortChannel>(), xCmdEnv );
- printf( "all deployed %s packages:\n",
- ::rtl::OUStringToOString(
- deploymentContext, textenc ).getStr() );
+ dp_misc::writeConsole(
+ OUSTR("all deployed ") + deploymentContext + OUSTR(" packages:\n"));
}
else
{
@@ -445,49 +443,59 @@ extern "C" int unopkg_main()
}
else
{
- fprintf( stderr,
- "\nERROR: unknown sub-command %s!\n"
- " Use " APP_NAME " %s to print all options.\n",
- ::rtl::OUStringToOString( subCommand, textenc ).getStr(),
- toString( info_help ).getStr() );
+ dp_misc::writeConsoleError(
+ OUSTR("\nERROR: unknown sub-command ") +
+ subCommand +
+ OUSTR("!\n") +
+ OUSTR(" Use " APP_NAME " ") +
+ toString(info_help) +
+ OUSTR(" to print all options.\n"));
return 1;
}
if (option_verbose)
- printf( "\n%s done.\n", APP_NAME );
+ dp_misc::writeConsole(OUSTR("\n"APP_NAME" done.\n"));
//Force to release all bridges which connect us to the child processes
disposeBridges(xLocalComponentContext);
return 0;
}
- catch (ucb::CommandFailedException &e) {
- fprintf(stderr, "%s\n", ::rtl::OUStringToOString(e.Message, textenc).getStr());
+ catch (ucb::CommandFailedException &e)
+ {
+ dp_misc::writeConsoleError(e.Message + OUSTR("\n"));
bNoOtherErrorMsg = true;
}
- catch (ucb::CommandAbortedException &) {
- fprintf( stderr, "\n%s aborted!\n", APP_NAME );
+ catch (ucb::CommandAbortedException &)
+ {
+ dp_misc::writeConsoleError("\n"APP_NAME" aborted!\n");
+ }
+ catch (deployment::DeploymentException & exc)
+ {
+ dp_misc::writeConsoleError(
+ OUSTR("\nERROR: ") +
+ exc.Message + OUSTR("\n") +
+ OUSTR(" Cause: ") +
+ OUString(option_verbose ? ::comphelper::anyToString(exc.Cause):
+ reinterpret_cast< css::uno::Exception const *>(
+ exc.Cause.getValue())->Message) +
+ OUSTR("\n"));
}
- catch (deployment::DeploymentException & exc) {
- fprintf( stderr,
- "\nERROR: %s\n"
- " Cause: %s\n",
- ::rtl::OUStringToOString(
- exc.Message, textenc ).getStr(),
- ::rtl::OUStringToOString(
- option_verbose
- ? ::comphelper::anyToString(exc.Cause)
- : reinterpret_cast<
- ::com::sun::star::uno::Exception const *>(
- exc.Cause.getValue())->Message, textenc).getStr() );
+ catch (LockFileException & e)
+ {
+ if (!subcmd_gui)
+ dp_misc::writeConsoleError(e.Message);
+ bNoOtherErrorMsg = true;
}
catch (::com::sun::star::uno::Exception & e ) {
Any exc( ::cppu::getCaughtException() );
- fprintf( stderr, "\nERROR: %s\n", ::rtl::OUStringToOString(
- option_verbose ? e.Message + OUSTR("\nException details: \n") +
- ::comphelper::anyToString(exc) : e.Message, textenc).getStr() );
+ dp_misc::writeConsoleError(
+ OUSTR("\nERROR: ") +
+ OUString(option_verbose ? e.Message + OUSTR("\nException details: \n") +
+ ::comphelper::anyToString(exc) : e.Message) +
+ OUSTR("\n"));
}
if (!bNoOtherErrorMsg)
- fprintf( stderr, "\n%s failed.\n", APP_NAME );
+ dp_misc::writeConsoleError("\n"APP_NAME" failed.\n");
disposeBridges(xLocalComponentContext);
return 1;
}
diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
index d0ac9398cc..7dbce92fd1 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: unopkg_cmdenv.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.8.3 $
*
* This file is part of OpenOffice.org.
*
@@ -67,17 +67,6 @@ using ::rtl::OUString;
namespace {
-inline ::com::sun::star::lang::Locale toLocale( ::rtl::OUString const & slang )
-{
- ::com::sun::star::lang::Locale locale;
- sal_Int32 nIndex = 0;
- locale.Language = slang.getToken( 0, '-', nIndex );
- locale.Country = slang.getToken( 0, '-', nIndex );
- locale.Variant = slang.getToken( 0, '-', nIndex );
- return locale;
-}
-
-
//==============================================================================
struct OfficeLocale :
public rtl::StaticWithInit<const lang::Locale, OfficeLocale> {
@@ -176,24 +165,20 @@ void CommandEnvironmentImpl::printLicense(const OUString& sLicense, bool & accep
{
ResMgr * pResMgr = DeploymentResMgr::get();
OUString s1 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr));
- ::rtl::OString os1 = ::rtl::OUStringToOString(s1, osl_getThreadTextEncoding());
OUString s2 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr));
- ::rtl::OString os2 = ::rtl::OUStringToOString(s2, osl_getThreadTextEncoding());
OUString s3 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr));
- ::rtl::OString os3 = ::rtl::OUStringToOString(s3, osl_getThreadTextEncoding());
OUString s4 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr));
- ::rtl::OString os4 = ::rtl::OUStringToOString(s4, osl_getThreadTextEncoding());
OUString sYES = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_YES, *pResMgr));
OUString sY = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_Y, *pResMgr));
OUString sNO = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_NO, *pResMgr));
OUString sN = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_N, *pResMgr));
-
- fprintf(stdout, "\n\n%s\n\n", os1.getStr());
- fprintf(stdout, "%s\n\n", OUStringToOString(sLicense, osl_getThreadTextEncoding()).getStr());
- fprintf(stdout, "%s\n", os2.getStr());
- fprintf(stdout, "%s", os3.getStr());
- fflush(stdout);
-
+
+ OUString sNewLine(RTL_CONSTASCII_USTRINGPARAM("\n"));
+
+ dp_misc::writeConsole(sNewLine + sNewLine + s1 + sNewLine + sNewLine);
+ dp_misc::writeConsole(sLicense + sNewLine + sNewLine);
+ dp_misc::writeConsole(s2 + sNewLine);
+ dp_misc::writeConsole(s3);
//the user may enter "yes" or "no", we compare in a case insensitive way
Reference< css::i18n::XCollator > xCollator(
@@ -206,13 +191,7 @@ void CommandEnvironmentImpl::printLicense(const OUString& sLicense, bool & accep
do
{
- char buf[16];
- rtl_zeroMemory(buf, 16);
- // read one char less so that the last char in buf is always zero
- fgets(buf, 15, stdin);
- OUString sAnswer = ::rtl::OStringToOUString(::rtl::OString(buf), osl_getThreadTextEncoding());
- sAnswer = sAnswer.trim();
-
+ OUString sAnswer = dp_misc::readConsole();
if (xCollator->compareString(sAnswer, sYES) == 0
|| xCollator->compareString(sAnswer, sY) == 0)
{
@@ -227,8 +206,7 @@ void CommandEnvironmentImpl::printLicense(const OUString& sLicense, bool & accep
}
else
{
- fprintf(stdout, "\n\n%s\n", os4.getStr());
- fflush(stdout);
+ dp_misc::writeConsole(sNewLine + sNewLine + s4 + sNewLine);
}
}
while(true);
@@ -257,11 +235,8 @@ void CommandEnvironmentImpl::handle(
{
Any request( xRequest->getRequest() );
OSL_ASSERT( request.getValueTypeClass() == TypeClass_EXCEPTION );
-#if OSL_DEBUG_LEVEL > 1
- OSL_TRACE( "[unopkg_cmdenv.cxx] incoming request:\n%s\n",
- ::rtl::OUStringToOString( ::comphelper::anyToString(request),
- RTL_TEXTENCODING_UTF8 ).getStr() );
-#endif
+ dp_misc::TRACE(OUSTR("[unopkg_cmdenv.cxx] incoming request:\n")
+ + ::comphelper::anyToString(request) + OUSTR("\n\n"));
// selections:
bool approve = false;
@@ -309,8 +284,7 @@ void CommandEnvironmentImpl::handle(
{
String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, *DeploymentResMgr::get() ) );
sResMsg.SearchAndReplaceAllAscii( "%NAME", licAgreementExc.ExtensionName );
- ::rtl::OString oMsg = ::rtl::OUStringToOString(sResMsg, osl_getThreadTextEncoding());
- fprintf(stdout, "\n%s\n\n", oMsg.getStr());
+ dp_misc::writeConsole(OUSTR("\n") + sResMsg + OUSTR("\n\n"));
abort = true;
}
else if (request >>= licExc)
@@ -328,9 +302,7 @@ void CommandEnvironmentImpl::handle(
{
String sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *dp_gui::DeploymentGuiResMgr::get()));
sMsg.SearchAndReplaceAllAscii("%Name", platExc.package->getDisplayName());
- ::rtl::OString oMsg = ::rtl::OUStringToOString(sMsg, osl_getThreadTextEncoding());
-
- fprintf(stdout, "\n%s\n\n", oMsg.getStr());
+ dp_misc::writeConsole(OUSTR("\n") + sMsg + OUSTR("\n\n"));
approve = true;
}
else {
@@ -350,9 +322,8 @@ void CommandEnvironmentImpl::handle(
if (abort && m_option_verbose && !bLicenseException)
{
OUString msg = ::comphelper::anyToString(request);
- fprintf( stderr, "\nERROR: %s\n",
- ::rtl::OUStringToOString(
- msg, osl_getThreadTextEncoding() ).getStr() );
+ dp_misc::writeConsoleError(
+ OUSTR("\nERROR: ") + msg + OUSTR("\n"));
}
// select:
@@ -400,13 +371,11 @@ void CommandEnvironmentImpl::update_( Any const & Status )
{
if (! Status.hasValue())
return;
-
- FILE * stream;
+ bool bUseErr = false;
OUString msg;
if (Status >>= msg) {
if (! m_option_verbose)
return;
- stream = stdout;
}
else {
::rtl::OUStringBuffer buf;
@@ -421,13 +390,21 @@ void CommandEnvironmentImpl::update_( Any const & Status )
buf.append( ::comphelper::anyToString(Status) );
}
msg = buf.makeStringAndClear();
- stream = stderr;
+ bUseErr = true;
}
OSL_ASSERT( m_logLevel >= 0 );
for ( sal_Int32 n = 0; n < m_logLevel; ++n )
- fprintf( stream, " " );
- fprintf( stream, "%s\n", ::rtl::OUStringToOString(
- msg, osl_getThreadTextEncoding() ).getStr() );
+ {
+ if (bUseErr)
+ dp_misc::writeConsoleError(" ");
+ else
+ dp_misc::writeConsole(" ");
+ }
+
+ if (bUseErr)
+ dp_misc::writeConsoleError(msg + OUSTR("\n"));
+ else
+ dp_misc::writeConsole(msg + OUSTR("\n"));
}
//______________________________________________________________________________
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h
index 2c787e90e7..b17b89ead1 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: unopkg_shared.h,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.8.3 $
*
* This file is part of OpenOffice.org.
*
@@ -29,22 +29,50 @@
************************************************************************/
#include "dp_misc.h"
+#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/lang/XComponent.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/ucb/XCommandEnvironment.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
#include "tools/resmgr.hxx"
+#include "rtl/ustring.hxx"
+#include "unotools/configmgr.hxx"
+#define APP_NAME "unopkg"
namespace css = ::com::sun::star;
namespace unopkg {
+ inline ::com::sun::star::lang::Locale toLocale( ::rtl::OUString const & slang )
+ {
+ ::com::sun::star::lang::Locale locale;
+ sal_Int32 nIndex = 0;
+ locale.Language = slang.getToken( 0, '-', nIndex );
+ locale.Country = slang.getToken( 0, '-', nIndex );
+ locale.Variant = slang.getToken( 0, '-', nIndex );
+ return locale;
+ }
+
+
+ struct OfficeLocale :
+ public rtl::StaticWithInit<const css::lang::Locale, OfficeLocale> {
+ const css::lang::Locale operator () () {
+ ::rtl::OUString slang;
+ if (! (::utl::ConfigManager::GetDirectConfigProperty(
+ ::utl::ConfigManager::LOCALE ) >>= slang))
+ throw css::uno::RuntimeException( OUSTR("Cannot determine language!"), 0 );
+ if (slang.getLength() == 0)
+ slang = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US"));
+ return toLocale(slang);
+ }
+};
+
struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr >
{
ResMgr * operator () () {
- return ResMgr::CreateResMgr( "deployment" );
+ return ResMgr::CreateResMgr( "deployment", OfficeLocale::get());
}
};
@@ -56,8 +84,14 @@ struct OptionInfo
bool m_has_argument;
};
+struct LockFileException : public css::uno::Exception
+{
+ LockFileException(::rtl::OUString const & sMessage) :
+ css::uno::Exception(sMessage, css::uno::Reference< css::uno::XInterface > ()) {}
+};
+
//==============================================================================
-::rtl::OString toString( OptionInfo const * info );
+::rtl::OUString toString( OptionInfo const * info );
//==============================================================================
OptionInfo const * getOptionInfo(
diff --git a/desktop/test/deployment/description/desc1.oxt b/desktop/test/deployment/description/desc1.oxt
new file mode 100644
index 0000000000..e447fd6eae
--- /dev/null
+++ b/desktop/test/deployment/description/desc1.oxt
Binary files differ
diff --git a/desktop/test/deployment/description/desc2.oxt b/desktop/test/deployment/description/desc2.oxt
new file mode 100644
index 0000000000..8df2f33fa6
--- /dev/null
+++ b/desktop/test/deployment/description/desc2.oxt
Binary files differ
diff --git a/desktop/test/deployment/description/desc3.oxt b/desktop/test/deployment/description/desc3.oxt
new file mode 100644
index 0000000000..fbd1136b03
--- /dev/null
+++ b/desktop/test/deployment/description/desc3.oxt
Binary files differ
diff --git a/desktop/test/deployment/description/desc4.oxt b/desktop/test/deployment/description/desc4.oxt
new file mode 100644
index 0000000000..0c97f5fd44
--- /dev/null
+++ b/desktop/test/deployment/description/desc4.oxt
Binary files differ
diff --git a/desktop/test/deployment/description/desc5.oxt b/desktop/test/deployment/description/desc5.oxt
new file mode 100644
index 0000000000..8110073499
--- /dev/null
+++ b/desktop/test/deployment/description/desc5.oxt
Binary files differ
diff --git a/desktop/test/deployment/description/readme.txt b/desktop/test/deployment/description/readme.txt
new file mode 100755
index 0000000000..bb133ba516
--- /dev/null
+++ b/desktop/test/deployment/description/readme.txt
@@ -0,0 +1,23 @@
+The folder contains extensions which use in the description.xml the following:
+-The <extension-description> element The element contains localized child
+elements.
+
+The following table shows what localized item is used, when the Office the locale
+en-US uses. The displayed extension description contains the locale.
+
+
+Localization:
+
+Installed office: en-US
+ | locale
+=========================
+desc1.oxt | en-US
+-------------------------
+desc2.oxt | en-US-region1
+--------------------------
+desc3.oxt | en
+--------------------------
+desc4.oxt | en-GB
+--------------------------
+desc5.oxt | de
+
diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc
index aaf51acc96..3cd650ad7c 100644
--- a/desktop/win32/source/guistdio/guistdio.inc
+++ b/desktop/win32/source/guistdio/guistdio.inc
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: guistdio.inc,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.86.3 $
*
* This file is part of OpenOffice.org.
*
@@ -49,12 +49,81 @@
// Thread that reads from child process standard output pipe
//---------------------------------------------------------------------------
+#ifdef UNOPKG
+
+DWORD passOutputToConsole(HANDLE readPipe, HANDLE console)
+{
+ BYTE aBuffer[1024];
+ DWORD dwRead = 0;
+ HANDLE hReadPipe = readPipe;
+ BOOL fSuccess;
+ DWORD dwWritten;
+
+ //Indicates that we read an odd number of bytes. That is, we only read half of the last
+ //wchar_t
+ bool bIncompleteWchar = false;
+ //fprintf, fwprintf will both send char data without the terminating zero.
+ //fwprintf converts the unicode string first.
+ //We expect here to receive unicode without the terminating zero.
+ //unopkg and the extension manager code MUST
+ //use dp_misc::writeConsole instead of using fprintf, etc.
+
+ DWORD dwToRead = sizeof(aBuffer);
+ BYTE * pBuffer = aBuffer;
+ while ( ReadFile( hReadPipe, pBuffer, dwToRead, &dwRead, NULL ) )
+ {
+ //If the previous ReadFile call read an odd number of bytes, then the last one was
+ //put at the front of the buffer. We increase the number of read bytes by one to reflect
+ //that one byte.
+ if (bIncompleteWchar)
+ dwRead++;
+ //We must make sure that only complete wchar_t|s are written. WriteConsolse takes
+ //the number of wchar_t|s as argument. ReadFile, however, reads bytes.
+ bIncompleteWchar = dwRead % 2 ? true : false;
+ if (bIncompleteWchar)
+ {
+ //To test this case, give aBuffer a small odd size, e.g. aBuffer[3]
+ //The last byte, which is the incomplete wchar_t (half of it), will not be written.
+ fSuccess = WriteConsoleW( console, aBuffer,
+ (dwRead - 1) / 2, &dwWritten, NULL );
+
+ //Move the last byte to the front of the buffer, so that it is the start of the
+ //next string
+ aBuffer[0] = aBuffer[dwRead - 1];
+
+ //Make sure that ReadFile does not overwrite the first byte the next time
+ dwToRead = sizeof(aBuffer) - 1;
+ pBuffer = aBuffer + 1;
+
+ }
+ else
+ { //We have read an even number of bytes. Therefore, we do not put the last incomplete
+ //wchar_t at the front of the buffer. We will use the complete buffer the next time
+ //when ReadFile is called.
+ dwToRead = sizeof(aBuffer);
+ pBuffer = aBuffer;
+ fSuccess = WriteConsoleW( console,
+ aBuffer, dwRead / 2, &dwWritten, NULL );
+ }
+ }
+
+ return 0;
+}
+
+#endif
+
+#ifdef UNOPKG
+DWORD WINAPI OutputThread( LPVOID pParam )
+{
+ return passOutputToConsole((HANDLE)pParam, GetStdHandle( STD_OUTPUT_HANDLE ));
+}
+
+#else
DWORD WINAPI OutputThread( LPVOID pParam )
{
BYTE aBuffer[256];
DWORD dwRead = 0;
HANDLE hReadPipe = (HANDLE)pParam;
-
while ( ReadFile( hReadPipe, &aBuffer, sizeof(aBuffer), &dwRead, NULL ) )
{
BOOL fSuccess;
@@ -65,11 +134,18 @@ DWORD WINAPI OutputThread( LPVOID pParam )
return 0;
}
-
+#endif
//---------------------------------------------------------------------------
// Thread that reads from child process standard error pipe
//---------------------------------------------------------------------------
+#ifdef UNOPKG
+DWORD WINAPI ErrorThread( LPVOID pParam )
+{
+ return passOutputToConsole((HANDLE)pParam, GetStdHandle( STD_ERROR_HANDLE ));
+}
+
+#else
DWORD WINAPI ErrorThread( LPVOID pParam )
{
BYTE aBuffer[256];
@@ -86,11 +162,29 @@ DWORD WINAPI ErrorThread( LPVOID pParam )
return 0;
}
-
+#endif
//---------------------------------------------------------------------------
// Thread that writes to child process standard input pipe
//---------------------------------------------------------------------------
+#ifdef UNOPKG
+DWORD WINAPI InputThread( LPVOID pParam )
+{
+ const DWORD dwBufferSize = 256;
+ wchar_t aBuffer[dwBufferSize];
+ DWORD dwRead = 0;
+ HANDLE hWritePipe = (HANDLE)pParam;
+
+ while (ReadConsoleW( GetStdHandle( STD_INPUT_HANDLE ), &aBuffer, dwBufferSize, &dwRead, NULL ) )
+ {
+ BOOL fSuccess;
+ DWORD dwWritten;
+
+ fSuccess = WriteFile( hWritePipe, aBuffer, dwRead * 2, &dwWritten, NULL );
+ }
+ return 0;
+}
+#else
DWORD WINAPI InputThread( LPVOID pParam )
{
BYTE aBuffer[256];
@@ -107,6 +201,7 @@ DWORD WINAPI InputThread( LPVOID pParam )
return 0;
}
+#endif
//---------------------------------------------------------------------------
// Thread that waits until child process reached input idle
@@ -116,8 +211,8 @@ DWORD WINAPI WaitForUIThread( LPVOID pParam )
{
HANDLE hProcess = (HANDLE)pParam;
-#ifndef GUISTDIO_KEEPRUNNING
- if ( !_tgetenv( TEXT("GUISTDIO_KEEPRUNNING") ) )
+#ifndef UNOPKG
+ if ( !_tgetenv( TEXT("UNOPKG") ) )
WaitForInputIdle( hProcess, INFINITE );
else
#endif
@@ -296,7 +391,7 @@ int _tmain( int, _TCHAR ** )
//the threads then data may be lost. For example running unopkg without arguments shall print out
//the help text. Without this workaround some text would be missing.
//ifdef only for unopkg
-#ifdef GUISTDIO_KEEPRUNNING
+#ifdef UNOPKG
Sleep(1000);
#endif
CloseHandle( hOutputThread );
diff --git a/desktop/win32/source/guistdio/unopkgio.cxx b/desktop/win32/source/guistdio/unopkgio.cxx
index f3a62f14ad..e9dfafa6ea 100644
--- a/desktop/win32/source/guistdio/unopkgio.cxx
+++ b/desktop/win32/source/guistdio/unopkgio.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: unopkgio.cxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.86.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,5 +30,5 @@
#include "precompiled_desktop.hxx"
-#define GUISTDIO_KEEPRUNNING
+#define UNOPKG
#include "guistdio.inc"