diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-06 13:01:23 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-06 13:01:23 +0100 |
commit | 13bc9463db8c6968925b11a8c1c1c710b3a5c58b (patch) | |
tree | df1b785a2a894ecdbd56a7f360f88d03e5038624 | |
parent | f22b78ad8acc72e8ab9edb1c6fc2cdb67753c3dd (diff) | |
parent | 406dec43952fa9a7afa55738c6e7df317ad26275 (diff) |
rebased to OOO330m17
87 files changed, 3100 insertions, 723 deletions
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx index 3216e401b707..c3ed0d09b134 100644 --- a/basic/source/sbx/sbxbool.cxx +++ b/basic/source/sbx/sbxbool.cxx @@ -91,7 +91,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p ) { if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) ) nRes = SbxTRUE; - else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) ) + else if( !p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) ) { // Jetzt kann es noch in eine Zahl konvertierbar sein BOOL bError = TRUE; diff --git a/configmgr/source/README b/configmgr/source/README index b731043d34ed..b00990d1eeb2 100644 --- a/configmgr/source/README +++ b/configmgr/source/README @@ -70,6 +70,7 @@ writemodfile.cxx broadcaster.cxx Notification management. +additions.hxx update.cxx Extension manager interface. diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 190db364cdfe..eda60e6d612a 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -798,13 +798,22 @@ void Access::initBroadcasterAndChanges( css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement } - //TODO: if (allChanges != 0) { - // allChanges->push_back( - // css::util::ElementChange( - // css::uno::makeAny(...), - // css::uno::Any(), css::uno::Any())); - // //TODO: non-void ReplacedElement - //} + if (allChanges != 0) { + rtl::OUStringBuffer path( + getRelativePathRepresentation()); + if (path.getLength() != 0) { + path.append(sal_Unicode('/')); + } + path.append( + Data::createSegment( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")), + i->first)); + allChanges->push_back( + css::util::ElementChange( + css::uno::makeAny(path.makeStringAndClear()), + css::uno::Any(), css::uno::Any())); + //TODO: non-void ReplacedElement + } } // else: spurious Modifications::Node not representing a change break; diff --git a/configmgr/source/additions.hxx b/configmgr/source/additions.hxx new file mode 100644 index 000000000000..f34373c7f742 --- /dev/null +++ b/configmgr/source/additions.hxx @@ -0,0 +1,43 @@ +/************************************************************************* +* +* 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 INCLUDED_CONFIGMGR_SOURCE_ADDITIONS_HXX +#define INCLUDED_CONFIGMGR_SOURCE_ADDITIONS_HXX + +#include "sal/config.h" + +#include <list> + +#include "path.hxx" + +namespace configmgr { + +typedef std::list< Path > Additions; + +} + +#endif diff --git a/configmgr/source/broadcaster.cxx b/configmgr/source/broadcaster.cxx index bb77039dcc8f..ab59d333d6d3 100644 --- a/configmgr/source/broadcaster.cxx +++ b/configmgr/source/broadcaster.cxx @@ -32,13 +32,17 @@ #include "com/sun/star/beans/XPropertyChangeListener.hpp" #include "com/sun/star/container/XContainerListener.hpp" #include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/XEventListener.hpp" +#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/XChangesListener.hpp" +#include "cppuhelper/exc_hlp.hxx" #include "osl/diagnose.hxx" +#include "rtl/string.h" +#include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -50,6 +54,13 @@ namespace { namespace css = com::sun::star; +void appendMessage( + rtl::OUStringBuffer & buffer, css::uno::Exception const & exception) +{ + buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("; ")); + buffer.append(exception.Message); +} + } void Broadcaster::addDisposeNotification( @@ -108,14 +119,16 @@ void Broadcaster::addChangesNotification( } void Broadcaster::send() { - bool exception = false; + css::uno::Any exception; + rtl::OUStringBuffer messages; for (DisposeNotifications::iterator i(disposeNotifications_.begin()); i != disposeNotifications_.end(); ++i) { try { i->listener->disposing(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ContainerNotifications::iterator i( @@ -125,8 +138,9 @@ void Broadcaster::send() { try { i->listener->elementInserted(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ContainerNotifications::iterator i( @@ -136,8 +150,9 @@ void Broadcaster::send() { try { i->listener->elementRemoved(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ContainerNotifications::iterator i( @@ -147,8 +162,9 @@ void Broadcaster::send() { try { i->listener->elementReplaced(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (PropertyChangeNotifications::iterator i( @@ -158,8 +174,9 @@ void Broadcaster::send() { try { i->listener->propertyChange(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (PropertiesChangeNotifications::iterator i( @@ -169,8 +186,9 @@ void Broadcaster::send() { try { i->listener->propertiesChange(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } for (ChangesNotifications::iterator i(changesNotifications_.begin()); @@ -178,16 +196,19 @@ void Broadcaster::send() { try { i->listener->changesOccurred(i->event); } catch (css::lang::DisposedException &) { - } catch (css::uno::Exception &) { - exception = true; + } catch (css::uno::Exception & e) { + exception = cppu::getCaughtException(); + appendMessage(messages, e); } } - if (exception) { //TODO - throw css::uno::RuntimeException( - rtl::OUString( + if (exception.hasValue()) { + throw css::lang::WrappedTargetRuntimeException( + (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "configmgr exceptions during listener notification")), - css::uno::Reference< css::uno::XInterface >()); + "configmgr exceptions during listener notification")) + + messages.makeStringAndClear()), + css::uno::Reference< css::uno::XInterface >(), + exception); } } diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index ef2b213d4ef1..d387f351de30 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -282,9 +282,10 @@ css::uno::Any ChildAccess::asValue() { if (!Components::allLocales(locale)) { // Find best match using an adaption of RFC 4647 lookup matching // rules, removing "-" or "_" delimited segments from the end; - // defaults are the empty string locale, the "en-US" locale, the - // first child (if any), or a nil value (even though it may be - // illegal for the given property), in that order: + // defaults are the "en-US" locale, the "en" locale, the empty + // string locale, the first child (if any), or a nil value (even + // though it may be illegal for the given property), in that + // order: rtl::Reference< ChildAccess > child; for (;;) { child = getChild(locale); @@ -295,16 +296,26 @@ css::uno::Any ChildAccess::asValue() { while (i > 0 && locale[i] != '-' && locale[i] != '_') { --i; } + if (i == 0) { + break; + } locale = locale.copy(0, i); } if (!child.is()) { child = getChild( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US"))); if (!child.is()) { - std::vector< rtl::Reference< ChildAccess > > all( - getAllChildren()); - if (!all.empty()) { - child = all.front(); + child = getChild( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en"))); + if (!child.is()) { + child = getChild(rtl::OUString()); + if (!child.is()) { + std::vector< rtl::Reference< ChildAccess > > + all(getAllChildren()); + if (!all.empty()) { + child = all.front(); + } + } } } } diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 04e6317c959d..d812e54498ac 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -29,6 +29,7 @@ #include "sal/config.h" #include <algorithm> +#include <cstddef> #include <list> #include "com/sun/star/beans/Optional.hpp" @@ -43,8 +44,11 @@ #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" +#include "osl/conditn.hxx" #include "osl/diagnose.h" #include "osl/file.hxx" +#include "osl/mutex.hxx" +#include "osl/thread.hxx" #include "rtl/bootstrap.hxx" #include "rtl/logfile.h" #include "rtl/ref.hxx" @@ -53,11 +57,15 @@ #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "salhelper/simplereferenceobject.hxx" +#include "additions.hxx" #include "components.hxx" #include "data.hxx" +#include "lock.hxx" #include "modifications.hxx" #include "node.hxx" +#include "nodemap.hxx" #include "parsemanager.hxx" #include "partial.hxx" #include "rootaccess.hxx" @@ -86,12 +94,12 @@ typedef std::list< UnresolvedListItem > UnresolvedList; void parseXcsFile( rtl::OUString const & url, int layer, Data & data, Partial const * partial, - Modifications * modifications) + Modifications * modifications, Additions * additions) SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { - OSL_ASSERT(partial == 0 && modifications == 0); - (void) partial; (void) modifications; + OSL_ASSERT(partial == 0 && modifications == 0 && additions == 0); + (void) partial; (void) modifications; (void) additions; OSL_VERIFY( rtl::Reference< ParseManager >( new ParseManager(url, new XcsParser(layer, data)))->parse()); @@ -99,14 +107,16 @@ void parseXcsFile( void parseXcuFile( rtl::OUString const & url, int layer, Data & data, Partial const * partial, - Modifications * modifications) + Modifications * modifications, Additions * additions) SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { OSL_VERIFY( rtl::Reference< ParseManager >( new ParseManager( - url, new XcuParser(layer, data, partial, modifications)))-> + url, + new XcuParser( + layer, data, partial, modifications, additions)))-> parse()); } @@ -116,11 +126,94 @@ rtl::OUString expand(rtl::OUString const & str) { return s; } +bool canRemoveFromLayer(int layer, rtl::Reference< Node > const & node) { + OSL_ASSERT(node.is()); + if (node->getLayer() > layer && node->getLayer() < Data::NO_LAYER) { + return false; + } + switch (node->kind()) { + case Node::KIND_LOCALIZED_PROPERTY: + case Node::KIND_GROUP: + for (NodeMap::iterator i(node->getMembers().begin()); + i != node->getMembers().end(); ++i) + { + if (!canRemoveFromLayer(layer, i->second)) { + return false; + } + } + return true; + case Node::KIND_SET: + return node->getMembers().empty(); + default: // Node::KIND_PROPERTY, Node::KIND_LOCALIZED_VALUE + return true; + } +} + static bool singletonCreated = false; static Components * singleton = 0; } +class Components::WriteThread: + public osl::Thread, public salhelper::SimpleReferenceObject +{ +public: + static void * operator new(std::size_t size) + { return Thread::operator new(size); } + + static void operator delete(void * pointer) + { Thread::operator delete(pointer); } + + WriteThread( + rtl::Reference< WriteThread > * reference, Components & components, + rtl::OUString const & url, Data const & data); + + void flush() { delay_.set(); } + +private: + virtual ~WriteThread() {} + + virtual void SAL_CALL run(); + + virtual void SAL_CALL onTerminated() { release(); } + + rtl::Reference< WriteThread > * reference_; + Components & components_; + rtl::OUString url_; + Data const & data_; + osl::Condition delay_; +}; + +Components::WriteThread::WriteThread( + rtl::Reference< WriteThread > * reference, Components & components, + rtl::OUString const & url, Data const & data): + reference_(reference), components_(components), url_(url), data_(data) +{ + OSL_ASSERT(reference != 0); + acquire(); +} + +void Components::WriteThread::run() { + TimeValue t = { 1, 0 }; // 1 sec + delay_.wait(&t); // must not throw; result_error is harmless and ignored + osl::MutexGuard g(lock); // must not throw + try { + try { + writeModFile(components_, url_, data_); + } catch (css::uno::RuntimeException & e) { + // Silently ignore write errors, instead of aborting: + OSL_TRACE( + "configmgr error writing modifications: %s", + rtl::OUStringToOString( + e.Message, RTL_TEXTENCODING_UTF8).getStr()); + } + } catch (...) { + reference_->clear(); + throw; + } + reference_->clear(); +} + void Components::initSingleton( css::uno::Reference< css::uno::XComponentContext > const & context) { @@ -211,14 +304,30 @@ void Components::addModification(Path const & path) { } void Components::writeModifications() { - writeModFile(*this, getModificationFileUrl(), data_); + if (!writeThread_.is()) { + writeThread_ = new WriteThread( + &writeThread_, *this, getModificationFileUrl(), data_); + writeThread_->create(); + } +} + +void Components::flushModifications() { + rtl::Reference< WriteThread > thread; + { + osl::MutexGuard g(lock); + thread = writeThread_; + } + if (thread.is()) { + thread->flush(); + thread->join(); + } } void Components::insertExtensionXcsFile( bool shared, rtl::OUString const & fileUri) { try { - parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0); + parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( (rtl::OUString( @@ -233,9 +342,12 @@ void Components::insertExtensionXcuFile( bool shared, rtl::OUString const & fileUri, Modifications * modifications) { OSL_ASSERT(modifications != 0); + int layer = shared ? 10 : 14; + Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer); try { - parseXcuFile(fileUri, shared ? 10 : 14, data_, 0, modifications); + parseXcuFile(fileUri, layer, data_, 0, modifications, adds); } catch (css::container::NoSuchElementException & e) { + data_.removeExtensionXcuAdditions(fileUri); throw css::uno::RuntimeException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -245,6 +357,58 @@ void Components::insertExtensionXcuFile( } } +void Components::removeExtensionXcuFile( + rtl::OUString const & fileUri, Modifications * modifications) +{ + //TODO: Ideally, exactly the data coming from the specified xcu file would + // be removed. However, not enough information is recorded in the in-memory + // data structures to do so. So, as a workaround, all those set elements + // that were freshly added by the xcu and have afterwards been left + // unchanged or have only had their properties changed in the user layer are + // removed (and nothing else). The heuristic to determine + // whether a node has been left unchanged is to check the layer ID (as + // usual) and additionally to check that the node does not recursively + // contain any non-empty sets (multiple extension xcu files are merged into + // one layer, so checking layer ID alone is not enough). Since + // item->additions records all additions of set members in textual order, + // the latter check works well when iterating through item->additions in + // reverse order. + OSL_ASSERT(modifications != 0); + rtl::Reference< Data::ExtensionXcu > item( + data_.removeExtensionXcuAdditions(fileUri)); + if (item.is()) { + for (Additions::reverse_iterator i(item->additions.rbegin()); + i != item->additions.rend(); ++i) + { + rtl::Reference< Node > parent; + NodeMap const * map = &data_.components; + rtl::Reference< Node > node; + for (Path::const_iterator j(i->begin()); j != i->end(); ++j) { + parent = node; + node = Data::findNode(Data::NO_LAYER, *map, *j); + if (!node.is()) { + break; + } + map = &node->getMembers(); + } + if (node.is()) { + OSL_ASSERT(parent.is()); + if (parent->kind() == Node::KIND_SET) { + OSL_ASSERT( + node->kind() == Node::KIND_GROUP || + node->kind() == Node::KIND_SET); + if (canRemoveFromLayer(item->layer, node)) { + parent->getMembers().erase(i->back()); + data_.modifications.remove(*i); + modifications->add(*i); + } + } + } + } + writeModifications(); + } +} + void Components::insertModificationXcuFile( rtl::OUString const & fileUri, std::set< rtl::OUString > const & includedPaths, @@ -252,12 +416,14 @@ void Components::insertModificationXcuFile( Modifications * modifications) { OSL_ASSERT(modifications != 0); + Partial part(includedPaths, excludedPaths); try { - Partial part(includedPaths, excludedPaths); - parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications); - } catch (css::uno::Exception & e) { //TODO: more specific exception catching + parseFileLeniently( + &parseXcuFile, fileUri, Data::NO_LAYER, data_, &part, modifications, + 0); + } catch (css::container::NoSuchElementException & e) { OSL_TRACE( - "configmgr error inserting %s: %s", + "configmgr error inserting non-existing %s: %s", rtl::OUStringToOString(fileUri, RTL_TEXTENCODING_UTF8).getStr(), rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); } @@ -377,7 +543,8 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":BUNDLED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); + "PackageRegistryBackend/configmgr.ini"))), + false); parseXcsXcuIniLayer( 9, expand( @@ -386,8 +553,9 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":SHARED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); - parseXcsXcuLayer( //TODO: migrate + "PackageRegistryBackend/configmgr.ini"))), + true); + parseXcsXcuLayer( 11, expand( rtl::OUString( @@ -396,6 +564,8 @@ Components::Components( ":UNO_USER_PACKAGES_CACHE}/registry/" "com.sun.star.comp.deployment.configuration." "PackageRegistryBackend/registry")))); + // can be dropped once old UserInstallation format can no longer exist + // (probably OOo 4) parseXcsXcuIniLayer( 13, expand( @@ -404,21 +574,34 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":UNO_USER_PACKAGES_CACHE}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); + "PackageRegistryBackend/configmgr.ini"))), + true); + parseModificationLayer(); + RTL_LOGFILE_TRACE_AUTHOR("configmgr", "sb", "end parsing"); +} + +Components::~Components() {} + +void Components::parseFileLeniently( + FileParser * parseFile, rtl::OUString const & url, int layer, Data & data, + Partial const * partial, Modifications * modifications, + Additions * additions) +{ + OSL_ASSERT(parseFile != 0); try { - parseModificationLayer(); + (*parseFile)(url, layer, data, partial, modifications, additions); + } catch (css::container::NoSuchElementException &) { + throw; } catch (css::uno::Exception & e) { //TODO: more specific exception catching - // Silently ignore unreadable parts of a corrupted user modification - // layer, instead of completely preventing OOo from starting: + // Silently ignore invalid XML files, instead of completely preventing + // OOo from starting: OSL_TRACE( - "configmgr error reading user modification layer: %s", + "configmgr error reading %s: %s", + rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr(), rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); } - RTL_LOGFILE_TRACE_AUTHOR("configmgr", "sb", "end parsing"); } -Components::~Components() {} - void Components::parseFiles( int layer, rtl::OUString const & extension, FileParser * parseFile, rtl::OUString const & url, bool recursive) @@ -470,7 +653,8 @@ void Components::parseFiles( file.match(extension, file.getLength() - extension.getLength())) { try { - (*parseFile)(stat.getFileURL(), layer, data_, 0, 0); + parseFileLeniently( + parseFile, stat.getFileURL(), layer, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( (rtl::OUString( @@ -486,19 +670,26 @@ void Components::parseFiles( void Components::parseFileList( int layer, FileParser * parseFile, rtl::OUString const & urls, - rtl::Bootstrap const & ini) + rtl::Bootstrap const & ini, bool recordAdditions) { for (sal_Int32 i = 0;;) { rtl::OUString url(urls.getToken(0, ' ', i)); if (url.getLength() != 0) { ini.expandMacrosFrom(url); //TODO: detect failure + Additions * adds = 0; + if (recordAdditions) { + adds = data_.addExtensionXcuAdditions(url, layer); + } try { - (*parseFile)(url, layer, data_, 0, 0); + parseFileLeniently(parseFile, url, layer, data_, 0, 0, adds); } catch (css::container::NoSuchElementException & e) { OSL_TRACE( "configmgr file does not exist: %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8).getStr()); + if (adds != 0) { + data_.removeExtensionXcuAdditions(url); + } } } if (i == -1) { @@ -610,18 +801,20 @@ void Components::parseXcsXcuLayer(int layer, rtl::OUString const & url) { url + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/data")), false); } -void Components::parseXcsXcuIniLayer(int layer, rtl::OUString const & url) { +void Components::parseXcsXcuIniLayer( + int layer, rtl::OUString const & url, bool recordAdditions) +{ //TODO: rtl::Bootstrap::getFrom "first trie[s] to retrieve the value via the // global function" rtl::Bootstrap ini(url); rtl::OUString urls; if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SCHEMA")), urls)) { - parseFileList(layer, &parseXcsFile, urls, ini); + parseFileList(layer, &parseXcsFile, urls, ini, false); } if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA")), urls)) { - parseFileList(layer + 1, &parseXcuFile, urls, ini); + parseFileList(layer + 1, &parseXcuFile, urls, ini, recordAdditions); } } @@ -650,13 +843,15 @@ rtl::OUString Components::getModificationFileUrl() const { void Components::parseModificationLayer() { try { - parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0); + parseFileLeniently( + &parseXcuFile, getModificationFileUrl(), Data::NO_LAYER, data_, 0, + 0, 0); } catch (css::container::NoSuchElementException &) { OSL_TRACE( "configmgr user registrymodifications.xcu does not (yet) exist"); // Migrate old user layer data (can be removed once migration is no - // longer relevant; also see hack for xsi namespace in XmlReader - // constructor): + // longer relevant, probably OOo 4; also see hack for xsi namespace in + // XmlReader constructor): parseFiles( Data::NO_LAYER, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".xcu")), &parseXcuFile, diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index 2e635680c1ce..1c735efca6ba 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -38,7 +38,10 @@ #include "com/sun/star/uno/Reference.hxx" #include "rtl/ref.hxx" +#include "additions.hxx" #include "data.hxx" +#include "modifications.hxx" +#include "nodemap.hxx" #include "path.hxx" namespace com { namespace sun { namespace star { @@ -56,7 +59,6 @@ namespace rtl { namespace configmgr { class Broadcaster; -class Modifications; class Node; class Partial; class RootAccess; @@ -92,12 +94,20 @@ public: void writeModifications(); + void flushModifications(); + // must be called with configmgr::lock unaquired; must be called before + // shutdown if writeModifications has ever been called (probably + // indirectly, via removeExtensionXcuFile) + void insertExtensionXcsFile(bool shared, rtl::OUString const & fileUri); void insertExtensionXcuFile( bool shared, rtl::OUString const & fileUri, Modifications * modifications); + void removeExtensionXcuFile( + rtl::OUString const & fileUri, Modifications * modifications); + void insertModificationXcuFile( rtl::OUString const & fileUri, std::set< rtl::OUString > const & includedPaths, @@ -109,7 +119,8 @@ public: private: typedef void FileParser( - rtl::OUString const &, int, Data &, Partial const *, Modifications *); + rtl::OUString const &, int, Data &, Partial const *, Modifications *, + Additions *); Components( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > @@ -117,19 +128,25 @@ private: ~Components(); + void parseFileLeniently( + FileParser * parseFile, rtl::OUString const & url, int layer, + Data & data, Partial const * partial, Modifications * modifications, + Additions * additions); + void parseFiles( int layer, rtl::OUString const & extension, FileParser * parseFile, rtl::OUString const & url, bool recursive); void parseFileList( int layer, FileParser * parseFile, rtl::OUString const & urls, - rtl::Bootstrap const & ini); + rtl::Bootstrap const & ini, bool recordAdditions); void parseXcdFiles(int layer, rtl::OUString const & url); void parseXcsXcuLayer(int layer, rtl::OUString const & url); - void parseXcsXcuIniLayer(int layer, rtl::OUString const & url); + void parseXcsXcuIniLayer( + int layer, rtl::OUString const & url, bool recordAdditions); void parseModuleLayer(int layer, rtl::OUString const & url); @@ -148,11 +165,14 @@ private: com::sun::star::beans::XPropertySet > > ExternalServices; + class WriteThread; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > context_; Data data_; WeakRootSet roots_; ExternalServices externalServices_; + rtl::Reference< WriteThread > writeThread_; }; } diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index a89540a88158..3cd58b145bff 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -114,6 +114,8 @@ public: private: virtual ~Service() {} + virtual void SAL_CALL disposing() { flushModifications(); } + virtual rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException) { return configuration_provider::getImplementationName(); } @@ -166,6 +168,8 @@ private: virtual css::lang::Locale SAL_CALL getLocale() throw (css::uno::RuntimeException); + void flushModifications() const; + css::uno::Reference< css::uno::XComponentContext > context_; rtl::OUString locale_; }; @@ -241,7 +245,7 @@ Service::createInstanceWithArguments( if (nodepath.getLength() == 0) { badNodePath(); } - // For backwards compatibility, allow a notepath that misses the leading + // For backwards compatibility, allow a nodepath that misses the leading // slash: if (nodepath[0] != '/') { nodepath = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + nodepath; @@ -326,7 +330,7 @@ void Service::removeRefreshListener( } void Service::flush() throw (css::uno::RuntimeException) { - //TODO + flushModifications(); cppu::OInterfaceContainerHelper * cont = rBHelper.getContainer( cppu::UnoType< css::util::XFlushListener >::get()); if (cont != 0) { @@ -380,6 +384,16 @@ css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) { return loc; } +void Service::flushModifications() const { + Components * components; + { + osl::MutexGuard guard(lock); + Components::initSingleton(context_); + components = &Components::getSingleton(); + } + components->flushModifications(); +} + class Factory: public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, private boost::noncopyable @@ -456,7 +470,8 @@ Factory::createInstanceWithArgumentsAndContext( " arguments")), 0); } - // For backwards compatibility, allow "Locale" in any case: + // For backwards compatibility, allow "Locale" and (ignored) + // "EnableAsync" in any case: if (name.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("locale"))) { @@ -471,8 +486,9 @@ Factory::createInstanceWithArgumentsAndContext( " one, non-empty, string Locale argument")), 0); } - } else { - //TODO + } else if (!name.equalsIgnoreAsciiCaseAsciiL( + RTL_CONSTASCII_STRINGPARAM("enableasync"))) + { throw css::uno::Exception( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index e12f9596940b..50466ca0532c 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -36,11 +36,13 @@ #include "osl/diagnose.h" #include "rtl/ref.hxx" #include "rtl/string.h" +#include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "additions.hxx" #include "data.hxx" #include "groupnode.hxx" #include "node.hxx" @@ -325,4 +327,46 @@ rtl::Reference< Node > Data::getTemplate( return findNode(layer, templates, fullName); } +Additions * Data::addExtensionXcuAdditions( + rtl::OUString const & url, int layer) +{ + rtl::Reference< ExtensionXcu > item(new ExtensionXcu); + ExtensionXcuAdditions::iterator i( + extensionXcuAdditions_.insert( + ExtensionXcuAdditions::value_type( + url, rtl::Reference< ExtensionXcu >())).first); + if (i->second.is()) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "already added extension xcu ")) + + url), + css::uno::Reference< css::uno::XInterface >()); + } + i->second = item; + item->layer = layer; + return &item->additions; +} + +rtl::Reference< Data::ExtensionXcu > Data::removeExtensionXcuAdditions( + rtl::OUString const & url) +{ + ExtensionXcuAdditions::iterator i(extensionXcuAdditions_.find(url)); + if (i == extensionXcuAdditions_.end()) { + // This can happen, as migration of pre OOo 3.3 UserInstallation + // extensions in dp_registry::backend::configuration::BackendImpl:: + // PackageImpl::processPackage_ can cause just-in-time creation of + // extension xcu files that are never added via addExtensionXcuAdditions + // (also, there might be url spelling differences between calls to + // addExtensionXcuAdditions and removeExtensionXcuAdditions?): + OSL_TRACE( + "unknown configmgr::Data::removeExtensionXcuAdditions(%s)", + rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()); + return rtl::Reference< ExtensionXcu >(); + } + rtl::Reference< ExtensionXcu > item(i->second); + extensionXcuAdditions_.erase(i); + return item; +} + } diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index 52353d066b67..8f5f7af0d86e 100644 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx @@ -31,18 +31,20 @@ #include "sal/config.h" #include <climits> +#include <map> #include <vector> #include "boost/noncopyable.hpp" #include "rtl/ref.hxx" +#include "rtl/ustring.hxx" #include "sal/types.h" +#include "salhelper/simplereferenceobject.hxx" +#include "additions.hxx" #include "modifications.hxx" #include "nodemap.hxx" #include "path.hxx" -namespace rtl { class OUString; } - namespace configmgr { class Node; @@ -50,6 +52,11 @@ class Node; struct Data: private boost::noncopyable { enum { NO_LAYER = INT_MAX }; + struct ExtensionXcu: public salhelper::SimpleReferenceObject { + int layer; + Additions additions; + }; + NodeMap templates; NodeMap components; @@ -80,6 +87,18 @@ struct Data: private boost::noncopyable { rtl::Reference< Node > getTemplate( int layer, rtl::OUString const & fullName) const; + + Additions * addExtensionXcuAdditions( + rtl::OUString const & url, int layer); + + rtl::Reference< ExtensionXcu > removeExtensionXcuAdditions( + rtl::OUString const & url); + +private: + typedef std::map< rtl::OUString, rtl::Reference< ExtensionXcu > > + ExtensionXcuAdditions; + + ExtensionXcuAdditions extensionXcuAdditions_; }; } diff --git a/configmgr/source/modifications.cxx b/configmgr/source/modifications.cxx index 2ad3b5ef8bd1..add18ceaa1ea 100644 --- a/configmgr/source/modifications.cxx +++ b/configmgr/source/modifications.cxx @@ -59,6 +59,27 @@ void Modifications::add(Path const & path) { p->children.clear(); } +void Modifications::remove(Path const & path) { + OSL_ASSERT(!path.empty()); + Node * p = &root_; + for (Path::const_iterator i(path.begin());;) { + Node::Children::iterator j(p->children.find(*i)); + if (j == p->children.end()) { + break; + } + if (++i == path.end()) { + p->children.erase(j); + if (p->children.empty()) { + Path parent(path); + parent.pop_back(); + remove(parent); + } + break; + } + p = &j->second; + } +} + Modifications::Node const & Modifications::getRoot() const { return root_; } diff --git a/configmgr/source/modifications.hxx b/configmgr/source/modifications.hxx index e29a10150148..c28b1aadd192 100644 --- a/configmgr/source/modifications.hxx +++ b/configmgr/source/modifications.hxx @@ -54,6 +54,8 @@ public: void add(Path const & path); + void remove(Path const & path); + Node const & getRoot() const; private: diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx index 4c1d59d5d054..403b761a5abd 100644 --- a/configmgr/source/update.cxx +++ b/configmgr/source/update.cxx @@ -89,6 +89,9 @@ private: sal_Bool shared, rtl::OUString const & fileUri) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeExtensionXcuFile(rtl::OUString const & fileUri) + throw (css::uno::RuntimeException); + virtual void SAL_CALL insertModificationXcuFile( rtl::OUString const & fileUri, css::uno::Sequence< rtl::OUString > const & includedPaths, @@ -120,6 +123,20 @@ void Service::insertExtensionXcuFile( bc.send(); } +void Service::removeExtensionXcuFile(rtl::OUString const & fileUri) + throw (css::uno::RuntimeException) +{ + Broadcaster bc; + { + osl::MutexGuard g(lock); + Modifications mods; + Components::getSingleton().removeExtensionXcuFile(fileUri, &mods); + Components::getSingleton().initGlobalBroadcaster( + mods, rtl::Reference< RootAccess >(), &bc); + } + bc.send(); +} + void Service::insertModificationXcuFile( rtl::OUString const & fileUri, css::uno::Sequence< rtl::OUString > const & includedPaths, diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 498254b35644..ad774d5ca3e3 100644 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -137,7 +137,7 @@ bool XcdParser::startElement( if (ns == XmlReader::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("component-data"))) { - nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0); + nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0); nesting_ = 1; return nestedParser_->startElement(reader, ns, name); } diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index cd1e6e55d085..91f3b244c5a8 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -68,12 +68,13 @@ namespace css = com::sun::star; XcuParser::XcuParser( int layer, Data & data, Partial const * partial, - Modifications * broadcastModifications): + Modifications * broadcastModifications, Additions * additions): valueParser_(layer), data_(data), partial_(partial), broadcastModifications_(broadcastModifications), - recordModifications_(layer == Data::NO_LAYER), + additions_(additions), recordModifications_(layer == Data::NO_LAYER), trackPath_( - partial_ != 0 || broadcastModifications_ != 0 || recordModifications_) + partial_ != 0 || broadcastModifications_ != 0 || additions_ != 0 || + recordModifications_) {} XcuParser::~XcuParser() {} @@ -624,7 +625,7 @@ void XcuParser::handleLocpropValue( pop = true; } if (trackPath_) { - recordModification(); + recordModification(false); if (pop) { path_.pop_back(); } @@ -638,7 +639,7 @@ void XcuParser::handleLocpropValue( locprop->getMembers().erase(i); } state_.push(State(true)); - recordModification(); + recordModification(false); break; default: throw css::uno::RuntimeException( @@ -750,7 +751,7 @@ void XcuParser::handleUnknownGroupProp( prop->setFinalized(valueParser_.getLayer()); } state_.push(State(prop, name, state_.top().locked)); - recordModification(); + recordModification(false); break; } // fall through @@ -800,7 +801,7 @@ void XcuParser::handlePlainGroupProp( property, (state_.top().locked || finalizedLayer < valueParser_.getLayer()))); - recordModification(); + recordModification(false); break; case OPERATION_REMOVE: if (!property->isExtension()) { @@ -814,7 +815,7 @@ void XcuParser::handlePlainGroupProp( } group->getMembers().erase(propertyIndex); state_.push(State(true)); // ignore children - recordModification(); + recordModification(false); break; } } @@ -863,7 +864,7 @@ void XcuParser::handleLocalizedGroupProp( replacement, name, (state_.top().locked || finalizedLayer < valueParser_.getLayer()))); - recordModification(); + recordModification(false); } break; case OPERATION_REMOVE: @@ -1070,7 +1071,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { member->setFinalized(finalizedLayer); member->setMandatory(mandatoryLayer); state_.push(State(member, name, false)); - recordModification(); + recordModification(i == set->getMembers().end()); } break; case OPERATION_FUSE: @@ -1084,7 +1085,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { member->setFinalized(finalizedLayer); member->setMandatory(mandatoryLayer); state_.push(State(member, name, false)); - recordModification(); + recordModification(true); } } else { state_.push( @@ -1104,15 +1105,18 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { set->getMembers().erase(i); } state_.push(State(true)); - recordModification(); + recordModification(false); break; } } -void XcuParser::recordModification() { +void XcuParser::recordModification(bool addition) { if (broadcastModifications_ != 0) { broadcastModifications_->add(path_); } + if (addition && additions_ != 0) { + additions_->push_back(path_); + } if (recordModifications_) { data_.modifications.add(path_); } diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx index 64108451b4ef..02ef4e5ff117 100644 --- a/configmgr/source/xcuparser.hxx +++ b/configmgr/source/xcuparser.hxx @@ -35,6 +35,7 @@ #include "rtl/ref.hxx" #include "rtl/ustring.hxx" +#include "additions.hxx" #include "node.hxx" #include "nodemap.hxx" #include "parser.hxx" @@ -59,7 +60,7 @@ class XcuParser: public Parser { public: XcuParser( int layer, Data & data, Partial const * partial, - Modifications * broadcastModifications); + Modifications * broadcastModifications, Additions * additions); private: virtual ~XcuParser(); @@ -108,7 +109,7 @@ private: void handleSetNode(XmlReader & reader, SetNode * set); - void recordModification(); + void recordModification(bool addition); struct State { rtl::Reference< Node > node; // empty iff ignore or <items> @@ -141,6 +142,7 @@ private: Data & data_; Partial const * partial_; Modifications * broadcastModifications_; + Additions * additions_; bool recordModifications_; bool trackPath_; rtl::OUString componentName_; diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index 3707b7fdb65d..d63c83524389 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -326,9 +326,16 @@ namespace dbtools ::rtl::OUString sStringValue; if ( m_pData->m_xColumn.is() ) { - sStringValue = DBTypeConversion::getValue( - m_pData->m_xColumn, m_pData->m_xFormatter, m_pData->m_aNullDate, m_pData->m_nFormatKey, m_pData->m_nKeyType - ); + if ( m_pData->m_bNumericField ) + { + sStringValue = DBTypeConversion::getValue( + m_pData->m_xColumn, m_pData->m_xFormatter, m_pData->m_aNullDate, m_pData->m_nFormatKey, m_pData->m_nKeyType + ); + } + else + { + sStringValue = m_pData->m_xColumn->getString(); + } } return sStringValue; } diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index 43de55e3505c..d598de8bc12d 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -578,7 +578,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, // StarView zu lang ist oder der Treiber kann die Laenge der // Daten nicht im voraus bestimmen - also als MemoryStream // speichern. - while ((pcbValue == SQL_NO_TOTAL ) || pcbValue > nMaxLen) + while ((pcbValue == SQL_NO_TOTAL ) || nLen > nMaxLen) { // Bei Strings wird der Puffer nie ganz ausgenutzt // (das letzte Byte ist immer ein NULL-Byte, das diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 84e9aa2532ff..9709d33fdf76 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -2627,7 +2627,7 @@ value_exp_commalist: } ; function_arg: - value_exp + result | value_exp comparison value_exp { $$ = SQL_NEW_RULE; diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index fa7550812bbe..8eb4dd3cc25b 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -155,6 +155,7 @@ class Desktop : public Application sal_Bool InitializeInstallation( const rtl::OUString& rAppFilename ); sal_Bool InitializeConfiguration(); + void FlushConfiguration(); sal_Bool InitializeQuickstartMode( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr ); void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const ::rtl::OUString& aMsg ); diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index 0215f88d1ff0..cd191e43ef2b 100644 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -96,7 +96,7 @@ if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \ "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"` if [ -n "$my_path" ] ; then - LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH} + LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH fi fi diff --git a/desktop/scripts/unopkg.sh b/desktop/scripts/unopkg.sh index 0fe319735c06..1f09b87eb1ef 100644 --- a/desktop/scripts/unopkg.sh +++ b/desktop/scripts/unopkg.sh @@ -57,7 +57,7 @@ if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \ "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"` if [ -n "$my_path" ] ; then - LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH} + LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH fi fi diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index f5d6979bc4b1..cf5997ea3722 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -754,6 +754,7 @@ void Desktop::DeInit() // instead of removing of the configManager just let it commit all the changes RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); utl::ConfigManager::GetConfigManager()->StoreConfigItems(); + FlushConfiguration(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); // close splashscreen if it's still open @@ -815,6 +816,7 @@ BOOL Desktop::QueryExit() } else { + FlushConfiguration(); try { // it is no problem to call DisableOfficeIPCThread() more than once @@ -1436,18 +1438,7 @@ USHORT Desktop::Exception(USHORT nError) if ( bAllowRecoveryAndSessionManagement ) bRestart = SaveTasks(); - // because there is no method to flush the condiguration data, we must dispose the ConfigManager - Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); - if (xCFGFlush.is()) - { - xCFGFlush->flush(); - } - else - { - Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); - if (xCFGDispose.is()) - xCFGDispose->dispose(); - } + FlushConfiguration(); switch( nError & EXC_MAJORTYPE ) { @@ -1976,6 +1967,7 @@ void Desktop::Main() // remove temp directory RemoveTemporaryDirectory(); + FlushConfiguration(); // The acceptors in the AcceptorMap must be released (in DeregisterServices) // with the solar mutex unlocked, to avoid deadlock: nAcquireCount = Application::ReleaseSolarMutex(); @@ -2073,6 +2065,22 @@ sal_Bool Desktop::InitializeConfiguration() return bOk; } +void Desktop::FlushConfiguration() +{ + Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); + if (xCFGFlush.is()) + { + xCFGFlush->flush(); + } + else + { + // because there is no method to flush the condiguration data, we must dispose the ConfigManager + Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); + if (xCFGDispose.is()) + xCFGDispose->dispose(); + } +} + sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& rSMgr ) { try diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 78b29624b16e..44d1e30f74b6 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -363,26 +363,28 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) // ----------------------------------------------------------------------- MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) { - if ( nPos >= (long) getItemCount() ) - return CMD_NONE; + if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) ) + { + if ( ! GetEntryData( nPos )->m_bLocked ) + { + PopupMenu aPopup; - PopupMenu aPopup; + aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); - aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); + if ( GetEntryData( nPos )->m_bUser ) + { + if ( GetEntryData( nPos )->m_eState == REGISTERED ) + aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); + else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) + aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); + } - if ( ! GetEntryData( nPos )->m_bLocked ) - { - if ( GetEntryData( nPos )->m_bUser ) - { - if ( GetEntryData( nPos )->m_eState == REGISTERED ) - aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); - else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) - aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); + aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); + + return (MENU_COMMAND) aPopup.Execute( this, rPos ); } - aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); } - - return (MENU_COMMAND) aPopup.Execute( this, rPos ); + return CMD_NONE; } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 24b47aa223e3..5f9de3965199 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -71,29 +71,34 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_pPublisher( NULL ), m_xPackage( xPackage ) { - m_sTitle = xPackage->getDisplayName(); - m_sVersion = xPackage->getVersion(); - m_sDescription = xPackage->getDescription(); - - beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); - m_sPublisher = aInfo.First; - m_sPublisherURL = aInfo.Second; - - // get the icons for the package if there are any - uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); - if ( xGraphic.is() ) - m_aIcon = Image( xGraphic ); - - xGraphic = xPackage->getIcon( true ); - if ( xGraphic.is() ) - m_aIconHC = Image( xGraphic ); - else - m_aIconHC = m_aIcon; + try + { + m_sTitle = xPackage->getDisplayName(); + m_sVersion = xPackage->getVersion(); + m_sDescription = xPackage->getDescription(); + + beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); + m_sPublisher = aInfo.First; + m_sPublisherURL = aInfo.Second; + + // get the icons for the package if there are any + uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); + if ( xGraphic.is() ) + m_aIcon = Image( xGraphic ); + + xGraphic = xPackage->getIcon( true ); + if ( xGraphic.is() ) + m_aIconHC = Image( xGraphic ); + else + m_aIconHC = m_aIcon; - if ( eState == AMBIGUOUS ) - m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); - else if ( eState == NOT_REGISTERED ) - checkDependencies(); + if ( eState == AMBIGUOUS ) + m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); + else if ( eState == NOT_REGISTERED ) + checkDependencies(); + } + catch (deployment::ExtensionRemovedException &) {} + catch (uno::RuntimeException &) {} } //------------------------------------------------------------------------------ @@ -963,6 +968,11 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > & bool bLocked = m_pManager->isReadOnly( xPackage ); TEntry_Impl pEntry( new Entry_Impl( xPackage, eState, bLocked ) ); + + // Don't add empty entries + if ( ! pEntry->m_sTitle.Len() ) + return 0; + xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); ::osl::ClearableMutexGuard guard(m_entriesMutex); diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx index c2801ba1d965..0de1f9e96e91 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.cxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx @@ -31,6 +31,8 @@ #include "com/sun/star/deployment/VersionException.hpp" #include "com/sun/star/deployment/LicenseException.hpp" #include "com/sun/star/deployment/InstallException.hpp" +#include "com/sun/star/deployment/DependencyException.hpp" +#include "com/sun/star/deployment/PlatformException.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionHandler.hpp" @@ -250,7 +252,43 @@ void NoLicenseCommandEnv::handle( handle_(approve, abort, xRequest); } +// SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv( +// css::uno::Reference< css::task::XInteractionHandler> const & handler): +// BaseCommandEnv(handler) +// { +// } +SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv() +{ +} + +void SilentCheckPrerequisitesCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + deployment::LicenseException licExc; + deployment::PlatformException platformExc; + deployment::DependencyException depExc; + bool approve = false; + bool abort = false; + + if (request >>= licExc) + { + approve = true; + handle_(approve, abort, xRequest); + } + else if ((request >>= platformExc) + || (request >>= depExc)) + { + m_Exception = request; + } + else + { + m_UnknownException = request; + } +} // NoExceptionCommandEnv::NoExceptionCommandEnv( // css::uno::Reference< css::task::XInteractionHandler> const & handler, // css::uno::Type const & type): diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx index aa21f8281c72..bea11586d462 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.hxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx @@ -135,6 +135,29 @@ public: }; +/* For use in XExtensionManager::addExtension in the call to + XPackage::checkPrerequisites + It prevents all user interactions. The license is always accepted. + It remembers if there was a platform or a dependency exception in + the member m_bException. if there was any other exception then m_bUnknownException + is set. + + */ +class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv +{ +public: + SilentCheckPrerequisitesCommandEnv(); + // XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) + throw (css::uno::RuntimeException); + + // Set to true if a PlatformException or a DependencyException were handled. + css::uno::Any m_Exception; + // Set to true if an unknown exception was handled. + css::uno::Any m_UnknownException; +}; + // class NoExceptionCommandEnv : public BaseCommandEnv // { // css::uno::Type m_type; diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index c82973f1b680..709cca86c631 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -139,6 +139,37 @@ void writeLastModified(OUString & url, Reference<ucb::XCommandEnvironment> const OUSTR("Failed to update") + url, 0, exc); } } + +class ExtensionRemoveGuard +{ + css::uno::Reference<css::deployment::XPackage> m_extension; + css::uno::Reference<css::deployment::XPackageManager> m_xPackageManager; + +public: + ExtensionRemoveGuard( + css::uno::Reference<css::deployment::XPackage> const & extension, + css::uno::Reference<css::deployment::XPackageManager> const & xPackageManager): + m_extension(extension), m_xPackageManager(xPackageManager) {} + ~ExtensionRemoveGuard(); + + void reset(css::uno::Reference<css::deployment::XPackage> const & extension) { + m_extension = extension; + } +}; + +ExtensionRemoveGuard::~ExtensionRemoveGuard() +{ + try { + if (m_xPackageManager.is() && m_extension.is()) + m_xPackageManager->removePackage( + dp_misc::getIdentifier(m_extension), ::rtl::OUString(), + css::uno::Reference<css::task::XAbortChannel>(), + css::uno::Reference<css::ucb::XCommandEnvironment>()); + } catch (...) { + OSL_ASSERT(0); + } +} + } //end namespace namespace dp_manager { @@ -500,6 +531,107 @@ ExtensionManager::getSupportedPackageTypes() { return m_userRepository->getSupportedPackageTypes(); } +//Do some necessary checks and user interaction. This function does not +//aquire the extension manager mutex and that mutex must not be aquired +//when this function is called. doChecksForAddExtension does synchronous +//user interactions which may require aquiring the solar mutex. +//Returns true if the extension can be installed. +bool ExtensionManager::doChecksForAddExtension( + Reference<deploy::XPackageManager> const & xPackageMgr, + uno::Sequence<beans::NamedValue> const & properties, + css::uno::Reference<css::deployment::XPackage> const & xTmpExtension, + Reference<task::XAbortChannel> const & xAbortChannel, + Reference<ucb::XCommandEnvironment> const & xCmdEnv, + Reference<deploy::XPackage> & out_existingExtension ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + try + { + Reference<deploy::XPackage> xOldExtension; + const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); + const OUString sFileName = xTmpExtension->getName(); + const OUString sDisplayName = xTmpExtension->getDisplayName(); + const OUString sVersion = xTmpExtension->getVersion(); + + try + { + xOldExtension = xPackageMgr->getDeployedPackage( + sIdentifier, sFileName, xCmdEnv); + out_existingExtension = xOldExtension; + } + catch (lang::IllegalArgumentException &) + { + } + bool bCanInstall = false; + + //This part is not guarded against other threads removing, adding, disabling ... + //etc. the same extension. + //checkInstall is safe because it notifies the user if the extension is not yet + //installed in the same repository. Because addExtension has its own guard + //(m_addMutex), another thread cannot add the extension in the meantime. + //checkUpdate is called if the same extension exists in the same + //repository. The user is asked if they want to replace it. Another + //thread + //could already remove the extension. So asking the user was not + //necessary. No harm is done. The other thread may also ask the user + //if he wants to remove the extension. This depends on the + //XCommandEnvironment which it passes to removeExtension. + if (xOldExtension.is()) + { + //throws a CommandFailedException if the user cancels + //the action. + checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv); + } + else + { + //throws a CommandFailedException if the user cancels + //the action. + checkInstall(sDisplayName, xCmdEnv); + } + //Prevent showing the license if requested. + Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv); + ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>()); + + dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); + const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes = + info.getSimpleLicenseAttributes(); + + if (licenseAttributes && licenseAttributes->suppressIfRequired + && props.isSuppressedLicense()) + _xCmdEnv = Reference<ucb::XCommandEnvironment>( + new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); + + bCanInstall = xTmpExtension->checkPrerequisites( + xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false; + + return bCanInstall; + } + catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (uno::Exception &) { + uno::Any excOccurred = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this), excOccurred); + throw exc; + } catch (...) { + throw uno::RuntimeException( + OUSTR("Extension Manager: unexpected exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this)); + } +} // Only add to shared and user repository Reference<deploy::XPackage> ExtensionManager::addExtension( @@ -524,165 +656,183 @@ Reference<deploy::XPackage> ExtensionManager::addExtension( throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast<cppu::OWeakObject*>(this), 0); - ::osl::MutexGuard guard(getMutex()); + //We must make sure that the xTmpExtension is not create twice, because this + //would remove the first one. + ::osl::MutexGuard addGuard(m_addMutex); + Reference<deploy::XPackage> xTmpExtension = getTempExtension(url, xAbortChannel, xCmdEnv); + //Make sure the extension is removed from the tmp repository in case + //of an exception + ExtensionRemoveGuard tmpExtensionRemoveGuard(xTmpExtension, m_tmpRepository); const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); const OUString sFileName = xTmpExtension->getName(); - const OUString sDisplayName = xTmpExtension->getDisplayName(); - const OUString sVersion = xTmpExtension->getVersion(); - dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); - const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes = - info.getSimpleLicenseAttributes(); Reference<deploy::XPackage> xOldExtension; Reference<deploy::XPackage> xExtensionBackup; - uno::Any excOccurred1; uno::Any excOccurred2; bool bUserDisabled = false; - try + bool bCanInstall = doChecksForAddExtension( + xPackageManager, + properties, + xTmpExtension, + xAbortChannel, + xCmdEnv, + xOldExtension ); + { - bUserDisabled = isUserDisabled(sIdentifier, sFileName); - try - { - xOldExtension = xPackageManager->getDeployedPackage( - sIdentifier, sFileName, xCmdEnv); - } - catch (lang::IllegalArgumentException &) - { - } - bool bCanInstall = false; - try + // In this garded section (getMutex) we must not use the argument xCmdEnv + // because it may bring up dialogs (XInteractionHandler::handle) this + //may potententially deadlock. See issue + //http://qa.openoffice.org/issues/show_bug.cgi?id=114933 + //By not providing xCmdEnv the underlying APIs will throw an exception if + //the XInteractionRequest cannot be handled + ::osl::MutexGuard guard(getMutex()); + + if (bCanInstall) { - if (xOldExtension.is()) + try { - //throws a CommandFailedException if the user cancels - //the action. - checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv); + bUserDisabled = isUserDisabled(sIdentifier, sFileName); + if (xOldExtension.is()) + { + try + { + xOldExtension->revokePackage( + xAbortChannel, Reference<ucb::XCommandEnvironment>()); + //save the old user extension in case the user aborts + //store the extension in the tmp repository, this will overwrite + //xTmpPackage (same identifier). Do not let the user abort or + //interact + //importing the old extension in the tmp repository will remove + //the xTmpExtension + //no command environment supplied, only this class shall interact + //with the user! + xExtensionBackup = m_tmpRepository->importExtension( + xOldExtension, Reference<task::XAbortChannel>(), + Reference<ucb::XCommandEnvironment>()); + tmpExtensionRemoveGuard.reset(xExtensionBackup); + //xTmpExtension will later be used to check the dependencies + //again. However, only xExtensionBackup will be later removed + //from the tmp repository + xTmpExtension = xExtensionBackup; + OSL_ASSERT(xTmpExtension.is()); + } + catch (lang::DisposedException &) + { + //Another thread might have removed the extension meanwhile + } + } + //check again dependencies but prevent user interaction, + //We can disregard the license, because the user must have already + //accepted it, whe we called checkPrerequisites the first time + SilentCheckPrerequisitesCommandEnv * pSilentCommandEnv = + new SilentCheckPrerequisitesCommandEnv(); + Reference<ucb::XCommandEnvironment> silentCommandEnv(pSilentCommandEnv); + + sal_Int32 failedPrereq = xTmpExtension->checkPrerequisites( + xAbortChannel, silentCommandEnv, true); + if (failedPrereq == 0) + { + xNewExtension = xPackageManager->addPackage( + url, properties, OUString(), xAbortChannel, + Reference<ucb::XCommandEnvironment>()); + //If we add a user extension and there is already one which was + //disabled by a user, then the newly installed one is enabled. If we + //add to another repository then the user extension remains + //disabled. + bool bUserDisabled2 = bUserDisabled; + if (repository.equals(OUSTR("user"))) + bUserDisabled2 = false; + + activateExtension( + dp_misc::getIdentifier(xNewExtension), + xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, + Reference<ucb::XCommandEnvironment>()); + } + else + { + if (pSilentCommandEnv->m_Exception.hasValue()) + ::cppu::throwException(pSilentCommandEnv->m_Exception); + else if ( pSilentCommandEnv->m_UnknownException.hasValue()) + ::cppu::throwException(pSilentCommandEnv->m_UnknownException); + else + throw deploy::DeploymentException ( + OUSTR("Extension Manager: exception during addExtension, ckeckPrerequisites failed"), + static_cast<OWeakObject*>(this), uno::Any()); + } } - else - { - //throws a CommandFailedException if the user cancels - //the action. - checkInstall(sDisplayName, xCmdEnv); + catch (deploy::DeploymentException& ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (...) { + excOccurred2 = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during addExtension, url: ") + + url, static_cast<OWeakObject*>(this), excOccurred2); + excOccurred2 <<= exc; } - //Prevent showing the license if requested. - Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv); - ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>()); - if (licenseAttributes && licenseAttributes->suppressIfRequired - && props.isSuppressedLicense()) - _xCmdEnv = Reference<ucb::XCommandEnvironment>( - new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); - - bCanInstall = xTmpExtension->checkPrerequisites( - xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false; - } - catch (deploy::DeploymentException& ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (ucb::CommandFailedException & ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (ucb::CommandAbortedException & ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (lang::IllegalArgumentException &) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (uno::RuntimeException &) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (...) { - excOccurred1 = ::cppu::getCaughtException(); - deploy::DeploymentException exc( - OUSTR("Extension Manager: exception during addExtension, url: ") - + url, static_cast<OWeakObject*>(this), excOccurred1); - excOccurred1 <<= exc; } - if (bCanInstall) + if (excOccurred2.hasValue()) { - if (xOldExtension.is()) + //It does not matter what exception is thrown. We try to + //recover the original status. + //If the user aborted installation then a ucb::CommandAbortedException + //is thrown. + //Use a private AbortChannel so the user cannot interrupt. + try + { + if (xExtensionBackup.is()) + { + Reference<deploy::XPackage> xRestored = + xPackageManager->importExtension( + xExtensionBackup, Reference<task::XAbortChannel>(), + Reference<ucb::XCommandEnvironment>()); + } + activateExtension( + sIdentifier, sFileName, bUserDisabled, false, + Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>()); + } + catch (...) { - xOldExtension->revokePackage(xAbortChannel, xCmdEnv); - //save the old user extension in case the user aborts - //store the extension in the tmp repository, this will overwrite - //xTmpPackage (same identifier). Do not let the user abort or - //interact - Reference<ucb::XCommandEnvironment> tmpCmdEnv( - new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); - //importing the old extension in the tmp repository will remove - //the xTmpExtension - xTmpExtension = 0; - xExtensionBackup = m_tmpRepository->importExtension( - xOldExtension, Reference<task::XAbortChannel>(), - tmpCmdEnv); } - xNewExtension = xPackageManager->addPackage( - url, properties, OUString(), xAbortChannel, xCmdEnv); - //If we add a user extension and there is already one which was - //disabled by a user, then the newly installed one is enabled. If we - //add to another repository then the user extension remains - //disabled. - bool bUserDisabled2 = bUserDisabled; - if (repository.equals(OUSTR("user"))) - bUserDisabled2 = false; - activateExtension( - dp_misc::getIdentifier(xNewExtension), - xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, xCmdEnv); - fireModified(); + ::cppu::throwException(excOccurred2); } - } - catch (deploy::DeploymentException& ) { - excOccurred2 = ::cppu::getCaughtException(); + } // leaving the garded section (getMutex()) + + try + { + fireModified(); + + }catch (deploy::DeploymentException& ) { + throw; } catch (ucb::CommandFailedException & ) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (ucb::CommandAbortedException & ) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (lang::IllegalArgumentException &) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (uno::RuntimeException &) { - excOccurred2 = ::cppu::getCaughtException(); - } catch (...) { - excOccurred2 = ::cppu::getCaughtException(); + throw; + } catch (uno::Exception &) { + uno::Any excOccurred = ::cppu::getCaughtException(); deploy::DeploymentException exc( - OUSTR("Extension Manager: exception during addExtension, url: ") - + url, static_cast<OWeakObject*>(this), excOccurred2); - excOccurred2 <<= exc; - } - - if (excOccurred2.hasValue()) - { - //It does not matter what exception is thrown. We try to - //recover the original status. - //If the user aborted installation then a ucb::CommandAbortedException - //is thrown. - //Use a private AbortChannel so the user cannot interrupt. - try - { - Reference<ucb::XCommandEnvironment> tmpCmdEnv( - new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); - if (xExtensionBackup.is()) - { - Reference<deploy::XPackage> xRestored = - xPackageManager->importExtension( - xExtensionBackup, Reference<task::XAbortChannel>(), - tmpCmdEnv); - } - activateExtension( - sIdentifier, sFileName, bUserDisabled, false, - Reference<task::XAbortChannel>(), tmpCmdEnv); - if (xTmpExtension.is() || xExtensionBackup.is()) - m_tmpRepository->removePackage( - sIdentifier, OUString(), xAbortChannel, xCmdEnv); - fireModified(); - } - catch (...) - { - } - ::cppu::throwException(excOccurred2); + OUSTR("Extension Manager: exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this), excOccurred); + throw exc; + } catch (...) { + throw uno::RuntimeException( + OUSTR("Extension Manager: unexpected exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this)); } - if (xTmpExtension.is() || xExtensionBackup.is()) - m_tmpRepository->removePackage( - sIdentifier,OUString(), xAbortChannel, xCmdEnv); - - if (excOccurred1.hasValue()) - ::cppu::throwException(excOccurred1); return xNewExtension; } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index 64cada7da3ac..683f45a1bd6e 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -235,6 +235,8 @@ private: css::uno::Reference<css::deployment::XPackageManager> m_bundledRepository; css::uno::Reference<css::deployment::XPackageManager> m_tmpRepository; + //only to be used within addExtension + ::osl::Mutex m_addMutex; /* contains the names of all repositories (except tmp) in order of there priority. That is, the first element is "user" follod by "shared" and then "bundled" @@ -296,6 +298,21 @@ private: css::uno::Reference<css::deployment::XPackageManager> getPackageManager(::rtl::OUString const & repository) throw (css::lang::IllegalArgumentException); + + bool doChecksForAddExtension( + css::uno::Reference<css::deployment::XPackageManager> const & xPackageMgr, + css::uno::Sequence<css::beans::NamedValue> const & properties, + css::uno::Reference<css::deployment::XPackage> const & xTmpExtension, + css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel, + css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv, + css::uno::Reference<css::deployment::XPackage> & out_existingExtension ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + }; } diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx index 52011f1f0ca0..fb6efe0b79aa 100755..100644 --- a/desktop/source/deployment/misc/dp_update.cxx +++ b/desktop/source/deployment/misc/dp_update.cxx @@ -90,8 +90,6 @@ getUpdateInformation( Reference<deployment::XUpdateInformationProvider > const & Sequence<Reference< xml::dom::XElement > >(); } -//Put in anonymous namespace - void getOwnUpdateInfos( Reference<uno::XComponentContext> const & xContext, Reference<deployment::XUpdateInformationProvider > const & updateInformation, @@ -185,6 +183,56 @@ void getDefaultUpdateInfos( } } +bool containsBundledOnly(Sequence<Reference<deployment::XPackage> > const & sameIdExtensions) +{ + OSL_ASSERT(sameIdExtensions.getLength() == 3); + if (!sameIdExtensions[0].is() && !sameIdExtensions[1].is() && sameIdExtensions[2].is()) + return true; + else + return false; +} +/** Returns true if the list of extensions are bundled extensions and there are no + other extensions with the same identifier in the shared or user repository. + If extensionList is NULL, then it is checked if there are only bundled extensions. +*/ +bool onlyBundledExtensions( + Reference<deployment::XExtensionManager> const & xExtMgr, + std::vector< Reference<deployment::XPackage > > const * extensionList) +{ + OSL_ASSERT(xExtMgr.is()); + bool onlyBundled = true; + if (extensionList) + { + typedef std::vector<Reference<deployment::XPackage > >::const_iterator CIT; + for (CIT i = extensionList->begin(); i != extensionList->end(); i++) + { + Sequence<Reference<deployment::XPackage> > seqExt = xExtMgr->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(*i), (*i)->getName(), Reference<ucb::XCommandEnvironment>()); + + if (!containsBundledOnly(seqExt)) + { + onlyBundled = false; + break; + } + + } + } + else + { + const uno::Sequence< uno::Sequence< Reference<deployment::XPackage > > > seqAllExt = + xExtMgr->getAllExtensions(Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>()); + + for (int pos = seqAllExt.getLength(); pos --; ) + { + if (!containsBundledOnly(seqAllExt[pos])) + { + onlyBundled = false; + break; + } + } + } + return onlyBundled; +} } // anon namespace @@ -233,13 +281,14 @@ UPDATE_SOURCE isUpdateUserExtension( retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} } else { @@ -278,13 +327,14 @@ UPDATE_SOURCE isUpdateSharedExtension( else if (index == 3) retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} return retVal; } @@ -332,7 +382,7 @@ UpdateInfoMap getOnlineUpdateInfos( { OSL_ASSERT(xExtMgr.is()); UpdateInfoMap infoMap; - if (!xExtMgr.is()) + if (!xExtMgr.is() || onlyBundledExtensions(xExtMgr, extensionList)) return infoMap; if (!extensionList) diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 3c6680065db5..1e7ee5bfac8a 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -139,7 +139,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data); ::boost::optional<ConfigurationBackendDb::Data> readDataFromDb(OUString const & url); - void deleteDataFromDb(OUString const & url); + OUString deleteDataFromDb(OUString const & url); ::std::list<OUString> getAllIniEntries(); public: @@ -240,10 +240,18 @@ void BackendImpl::addDataToDb( return data; } -void BackendImpl::deleteDataFromDb(OUString const & url) +OUString BackendImpl::deleteDataFromDb(OUString const & url) { - if (m_backendDb.get()) + OUString url2(url); + if (m_backendDb.get()) { + boost::optional< ConfigurationBackendDb::Data > data( + m_backendDb->getEntry(url)); + if (data) { + url2 = expandUnoRcTerm(data->iniEntry); + } m_backendDb->removeEntry(url); + } + return url2; } ::std::list<OUString> BackendImpl::getAllIniEntries() @@ -717,11 +725,11 @@ void BackendImpl::PackageImpl::processPackage_( //rebuilding the directory structure. rtl::OUString url2( rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8)); - ConfigurationBackendDb::Data data; if (url2 != url) { bool schema = i->second.equalsIgnoreAsciiCase( "vnd.sun.star.configuration-schema"); OUString url_replaced(url2); + ConfigurationBackendDb::Data data; if (!schema) { const OUString sModFolder = that->createFolder(OUString(), xCmdEnv); @@ -734,6 +742,7 @@ void BackendImpl::PackageImpl::processPackage_( deleteTempFolder(sModFolder); } that->addToConfigmgrIni(schema, url_replaced, xCmdEnv); + data.iniEntry = dp_misc::makeRcTerm(url_replaced); that->addDataToDb(url2, data); } that->m_registeredPackages->erase(i->first); @@ -750,9 +759,12 @@ void BackendImpl::PackageImpl::processPackage_( OSL_ASSERT(0); } } - that->deleteDataFromDb(getURL()); - - //TODO: revoking at runtime, possible, sensible? + url = that->deleteDataFromDb(url); + if (!m_isSchema) { + com::sun::star::configuration::Update::get( + that->m_xComponentContext)->removeExtensionXcuFile( + expandUnoRcUrl(url)); + } } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index bc17a1f7163d..5a5efe825cfb 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -80,6 +80,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference<AbortChannel> const & abortChannel, Reference<XCommandEnvironment> const & xCmdEnv ); + bool extensionContainsCompiledHelp(); public: PackageImpl( ::rtl::Reference<PackageRegistryBackend> const & myBackend, @@ -100,7 +101,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference<XCommandEnvironment> const & xCmdEnv ); void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, - Reference<ucb::XCommandEnvironment> const & xCmdEnv); + bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv); void implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ); @@ -259,6 +260,57 @@ BackendImpl * BackendImpl::PackageImpl::getMyBackend() const return pBackend; } + +bool BackendImpl::PackageImpl::extensionContainsCompiledHelp() +{ + bool bCompiled = true; + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl(getURL()); + + ::osl::Directory helpFolder(aExpandedHelpURL); + if ( helpFolder.open() == ::osl::File::E_None) + { + //iterate over the contents of the help folder + //We assume that all folders withing the help folder contain language specific + //help files. If just one of them does not contain compiled help then this + //function returns false. + ::osl::DirectoryItem item; + ::osl::File::RC errorNext = ::osl::File::E_None; + while ((errorNext = helpFolder.getNextItem(item)) == ::osl::File::E_None) + { + //No find the language folders + ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileName |FileStatusMask_FileURL); + if (item.getFileStatus(stat) == ::osl::File::E_None) + { + if (stat.getFileType() != ::osl::FileStatus::Directory) + continue; + + //look if there is the folder help.idxl in the language folder + OUString compUrl(stat.getFileURL() + OUSTR("/help.idxl")); + ::osl::Directory compiledFolder(compUrl); + if (compiledFolder.open() != ::osl::File::E_None) + { + bCompiled = false; + break; + } + } + else + { + //Error + OSL_ASSERT(0); + bCompiled = false; + break; + } + } + if (errorNext != ::osl::File::E_NOENT + && errorNext != ::osl::File::E_None) + { + //Error + OSL_ASSERT(0); + bCompiled = false; + } + } + return bCompiled; +} //______________________________________________________________________________ beans::Optional< beans::Ambiguous<sal_Bool> > BackendImpl::PackageImpl::isRegistered_( @@ -289,7 +341,8 @@ void BackendImpl::PackageImpl::processPackage_( BackendImpl* that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv); + that->implProcessHelp( xThisPackage, doRegisterPackage, + extensionContainsCompiledHelp(), xCmdEnv); } beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL() @@ -316,213 +369,220 @@ static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) ); void BackendImpl::implProcessHelp -( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, +( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv) { OSL_ASSERT(xPackage.is()); if (doRegisterPackage) { HelpBackendDb::Data data; - const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); - data.dataUrl = sHelpFolder; - - Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); - rtl::OUString aHelpURL = xPackage->getURL(); - rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); - rtl::OUString aName = xPackage->getName(); - if( !xSFA->isFolder( aExpandedHelpURL ) ) + + if (compiledHelp) { - rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); - aErrStr += rtl::OUString::createFromAscii( "No help folder" ); - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + data.dataUrl = xPackage->getURL(); } - - Reference<XComponentContext> const & xContext = getComponentContext(); - Reference< script::XInvocation > xInvocation; - if( xContext.is() ) + else { - try + const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); + data.dataUrl = sHelpFolder; + + Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); + rtl::OUString aHelpURL = xPackage->getURL(); + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); + rtl::OUString aName = xPackage->getName(); + if( !xSFA->isFolder( aExpandedHelpURL ) ) { - xInvocation = Reference< script::XInvocation >( - xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( - "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); + aErrStr += rtl::OUString::createFromAscii( "No help folder" ); + OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } - catch (Exception &) + + Reference<XComponentContext> const & xContext = getComponentContext(); + Reference< script::XInvocation > xInvocation; + if( xContext.is() ) { - // i98680: Survive missing lucene + try + { + xInvocation = Reference< script::XInvocation >( + xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( + "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + } + catch (Exception &) + { + // i98680: Survive missing lucene + } } - } - // Scan languages - Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); - sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); - const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); - for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) - { - rtl::OUString aLangURL = pSeq[iLang]; - if( xSFA->isFolder( aLangURL ) ) + // Scan languages + Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); + sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); + const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); + for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) { - std::vector< rtl::OUString > aXhpFileVector; - - // calculate jar file URL - sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); - // for example "/en" - OUString langFolderURLSegment( - aLangURL.copy( - indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1)); - - //create the folder in the "temporary folder" - ::ucbhelper::Content langFolderContent; - const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment); - const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest); - ::dp_misc::create_folder( - &langFolderContent, - langFolderDest, xCmdEnv); - - rtl::OUString aJarFile( - makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + - OUSTR(".jar"))); - aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); - - rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( - aJarFile, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ); - rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); - aDestBasePath += aEncodedJarFilePath; - aDestBasePath += rtl::OUString::createFromAscii( "/" ); - - sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; - - Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); - sal_Int32 nSubLangCount = aSubLangSeq.getLength(); - const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); - for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + rtl::OUString aLangURL = pSeq[iLang]; + if( xSFA->isFolder( aLangURL ) ) { - rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; - if( !xSFA->isFolder( aSubFolderURL ) ) - continue; + std::vector< rtl::OUString > aXhpFileVector; + + // calculate jar file URL + sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); + // for example "/en" + OUString langFolderURLSegment( + aLangURL.copy( + indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1)); + + //create the folder in the "temporary folder" + ::ucbhelper::Content langFolderContent; + const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment); + const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest); + ::dp_misc::create_folder( + &langFolderContent, + langFolderDest, xCmdEnv); + + rtl::OUString aJarFile( + makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + + OUSTR(".jar"))); + aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); + + rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( + aJarFile, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ); + rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + aDestBasePath += aEncodedJarFilePath; + aDestBasePath += rtl::OUString::createFromAscii( "/" ); + + sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; + + Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); + sal_Int32 nSubLangCount = aSubLangSeq.getLength(); + const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); + for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + { + rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; + if( !xSFA->isFolder( aSubFolderURL ) ) + continue; - implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); + implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); - // Copy to package (later: move?) - rtl::OUString aDestPath = aDestBasePath; - rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); - aDestPath += aPureFolderName; - xSFA->copy( aSubFolderURL, aDestPath ); - } + // Copy to package (later: move?) + rtl::OUString aDestPath = aDestBasePath; + rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); + aDestPath += aPureFolderName; + xSFA->copy( aSubFolderURL, aDestPath ); + } - // Call compiler - sal_Int32 nXhpFileCount = aXhpFileVector.size(); - rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; - for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - { - rtl::OUString aXhpFile = aXhpFileVector[iXhp]; - rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); - pXhpFiles[iXhp] = aXhpRelFile; - } + // Call compiler + sal_Int32 nXhpFileCount = aXhpFileVector.size(); + rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; + for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) + { + rtl::OUString aXhpFile = aXhpFileVector[iXhp]; + rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); + pXhpFiles[iXhp] = aXhpRelFile; + } - rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); - rtl::OUString aOfficeHelpPathFileURL; - ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); + rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); + rtl::OUString aOfficeHelpPathFileURL; + ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); - HelpProcessingErrorInfo aErrorInfo; - bool bSuccess = compileExtensionHelp( - aOfficeHelpPathFileURL, aHelpStr, aLangURL, - nXhpFileCount, pXhpFiles, - langFolderDestExpanded, aErrorInfo ); + HelpProcessingErrorInfo aErrorInfo; + bool bSuccess = compileExtensionHelp( + aOfficeHelpPathFileURL, aHelpStr, aLangURL, + nXhpFileCount, pXhpFiles, + langFolderDestExpanded, aErrorInfo ); - if( bSuccess && xInvocation.is() ) - { - Sequence<uno::Any> aParamsSeq( 6 ); - - aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); - - rtl::OUString aLang; - sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); - if( nLastSlash != -1 ) - aLang = aLangURL.copy( nLastSlash + 1 ); - else - aLang = rtl::OUString::createFromAscii( "en" ); - aParamsSeq[1] = uno::makeAny( aLang ); - - aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); - aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); - - aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); - rtl::OUString aSystemPath; - osl::FileBase::getSystemPathFromFileURL( - langFolderDestExpanded, aSystemPath ); - aParamsSeq[5] = uno::makeAny( aSystemPath ); - - Sequence< sal_Int16 > aOutParamIndex; - Sequence< uno::Any > aOutParam; - uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), - aParamsSeq, aOutParamIndex, aOutParam ); - } - - if( !bSuccess ) - { - USHORT nErrStrId = 0; - switch( aErrorInfo.m_eErrorClass ) + if( bSuccess && xInvocation.is() ) { - case HELPPROCESSING_GENERAL_ERROR: - case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; - case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; - default: ; - }; - - rtl::OUString aErrStr; - if( nErrStrId != 0 ) + Sequence<uno::Any> aParamsSeq( 6 ); + + aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); + + rtl::OUString aLang; + sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); + if( nLastSlash != -1 ) + aLang = aLangURL.copy( nLastSlash + 1 ); + else + aLang = rtl::OUString::createFromAscii( "en" ); + aParamsSeq[1] = uno::makeAny( aLang ); + + aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); + aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); + + aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); + rtl::OUString aSystemPath; + osl::FileBase::getSystemPathFromFileURL( + langFolderDestExpanded, aSystemPath ); + aParamsSeq[5] = uno::makeAny( aSystemPath ); + + Sequence< sal_Int16 > aOutParamIndex; + Sequence< uno::Any > aOutParam; + uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), + aParamsSeq, aOutParamIndex, aOutParam ); + } + + if( !bSuccess ) { - aErrStr = getResourceString( nErrStrId ); - - // Remoce CR/LF - rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); - sal_Unicode nCR = 13, nLF = 10; - sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); - sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); - sal_Int32 nCopy; - if( nSearchCR != -1 || nSearchLF != -1 ) + USHORT nErrStrId = 0; + switch( aErrorInfo.m_eErrorClass ) { - if( nSearchCR == -1 ) - nCopy = nSearchLF; - else if( nSearchLF == -1 ) - nCopy = nSearchCR; - else - nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; - - aErrMsg = aErrMsg.copy( 0, nCopy ); - } - aErrStr += aErrMsg; - if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + case HELPPROCESSING_GENERAL_ERROR: + case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; + case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; + default: ; + }; + + rtl::OUString aErrStr; + if( nErrStrId != 0 ) { - aErrStr += rtl::OUString::createFromAscii( " in " ); - - rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, - rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - aErrStr += aDecodedFile; - if( aErrorInfo.m_nXMLParsingLine != -1 ) + aErrStr = getResourceString( nErrStrId ); + + // Remoce CR/LF + rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); + sal_Unicode nCR = 13, nLF = 10; + sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); + sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); + sal_Int32 nCopy; + if( nSearchCR != -1 || nSearchLF != -1 ) { - aErrStr += rtl::OUString::createFromAscii( ", line " ); - aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + if( nSearchCR == -1 ) + nCopy = nSearchLF; + else if( nSearchLF == -1 ) + nCopy = nSearchCR; + else + nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; + + aErrMsg = aErrMsg.copy( 0, nCopy ); + } + aErrStr += aErrMsg; + if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + { + aErrStr += rtl::OUString::createFromAscii( " in " ); + + rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, + rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aErrStr += aDecodedFile; + if( aErrorInfo.m_nXMLParsingLine != -1 ) + { + aErrStr += rtl::OUString::createFromAscii( ", line " ); + aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + } } } - } - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + } } } } - //Writing the data entry replaces writing the flag file. If we got to this //point the registration was successful. addDataToDb(xPackage->getURL(), data); - } + } //if (doRegisterPackage) else { deleteDataFromDb(xPackage->getURL()); diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index feb55d0af3bf..7f262d66684b 100644..100755 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -986,16 +986,20 @@ OUString BackendImpl::PackageImpl::getDescription() if (sRelativeURL.getLength()) { OUString sURL = m_url_expanded + OUSTR("/") + sRelativeURL; - sDescription = getTextFromURL( - css::uno::Reference< css::ucb::XCommandEnvironment >(), sURL); + try + { + sDescription = getTextFromURL( css::uno::Reference< css::ucb::XCommandEnvironment >(), sURL ); + } + catch ( css::deployment::DeploymentException& ) + { + OSL_ENSURE( 0, ::rtl::OUStringToOString( ::comphelper::anyToString( ::cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 ).getStr() ); + } } + if (sDescription.getLength()) return sDescription; - else if(m_oldDescription.getLength()) - return m_oldDescription; - else - return OUString(); + return m_oldDescription; } //______________________________________________________________________________ diff --git a/desktop/util/verinfo.rc b/desktop/util/verinfo.rc index 038953f2aa79..7d589956ec83 100644..100755 --- a/desktop/util/verinfo.rc +++ b/desktop/util/verinfo.rc @@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo block "040704E4" { // German StringTable - value "CompanyName", "Oracle, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #else block "040904E4" { // International StringTable - value "CompanyName", "Oracle, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #endif } diff --git a/desktop/win32/source/applauncher/ooo/verinfo.rc b/desktop/win32/source/applauncher/ooo/verinfo.rc index ce698ba80333..c13e723527fc 100644..100755 --- a/desktop/win32/source/applauncher/ooo/verinfo.rc +++ b/desktop/win32/source/applauncher/ooo/verinfo.rc @@ -69,7 +69,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #else block "040904E4" @@ -81,7 +81,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #endif } diff --git a/desktop/win32/source/applauncher/verinfo.rc b/desktop/win32/source/applauncher/verinfo.rc index 0db55c58c4b2..c0ff71494014 100644..100755 --- a/desktop/win32/source/applauncher/verinfo.rc +++ b/desktop/win32/source/applauncher/verinfo.rc @@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo block "040704E4" { // German StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #else block "040904E4" { // International StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(RES_APP_NAME) ".exe\0" value "InternalName", PPS(RES_APP_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle and/or its affiliates. All rights reserved.\0" } #endif } diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 0d57e566ef8a..73683884e2bd 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -248,9 +248,12 @@ namespace if(nPushFlags) { OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)"); - PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back()); - pNew->setPushFlags(nPushFlags); - maPropertyHolders.push_back(pNew); + if ( !maPropertyHolders.empty() ) + { + PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back()); + pNew->setPushFlags(nPushFlags); + maPropertyHolders.push_back(pNew); + } } } @@ -354,8 +357,9 @@ namespace PropertyHolder& Current() { + static PropertyHolder aDummy; OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: CURRENT with no property holders (!)"); - return *maPropertyHolders.back(); + return maPropertyHolders.empty() ? aDummy : *maPropertyHolders.back(); } ~PropertyHolders() diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index dc954de7bb2a..0d2be85f9872 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1206,7 +1206,12 @@ namespace drawinglayer mpOutputDevice->SetLineColor(Color(aHairlineColor)); mpOutputDevice->SetFillColor(); aHairLinePolyPolygon.transform(maCurrentTransformation); - LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth())); + + // #i113922# LineWidth needs to be transformed, too + const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(rLine.getWidth(), 0.0)); + const double fDiscreteLineWidth(aDiscreteUnit.getLength()); + + LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fDiscreteLineWidth)); aLineInfo.SetLineJoin(rLine.getLineJoin()); for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++) diff --git a/editeng/inc/editeng/unoipset.hxx b/editeng/inc/editeng/unoipset.hxx index 3cd3053e4c3e..8a28df5cbe28 100644 --- a/editeng/inc/editeng/unoipset.hxx +++ b/editeng/inc/editeng/unoipset.hxx @@ -64,6 +64,7 @@ public: sal_Bool AreThereOwnUsrAnys() const { return (pCombiList ? sal_True : sal_False); } ::com::sun::star::uno::Any* GetUsrAnyForID(sal_uInt16 nWID) const; void AddUsrAnyForID(const ::com::sun::star::uno::Any& rAny, sal_uInt16 nWID); + void ClearAllUsrAny(); com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const; const SfxItemPropertyMapEntry* getPropertyMapEntries() const {return _pMap;} diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index f969a8033f08..b7124881c90e 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -701,7 +701,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( bRunNext = true; } } - else if ( cChar == '/' ) + else if ( cChar == '/' && nEndPos > 1 && rTxt.Len() > (nEndPos - 1) ) { // Remove the hardspace right before to avoid formatting URLs sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 39ab3507c5d3..6ba232010390 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -71,15 +71,7 @@ SvxItemPropertySet::SvxItemPropertySet( const SfxItemPropertyMapEntry* pMap, Sfx //---------------------------------------------------------------------- SvxItemPropertySet::~SvxItemPropertySet() { -/* - if(pItemPool) - delete pItemPool; - pItemPool = NULL; -*/ - - if(pCombiList) - delete pCombiList; - pCombiList = NULL; + ClearAllUsrAny(); } //---------------------------------------------------------------------- @@ -111,6 +103,17 @@ void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID) pCombiList->Insert(pNew); } +//---------------------------------------------------------------------- + +void SvxItemPropertySet::ClearAllUsrAny() +{ + if(pCombiList) + delete pCombiList; + pCombiList = NULL; +} + +//---------------------------------------------------------------------- + sal_Bool SvxUnoCheckForPositiveValue( const uno::Any& rVal ) { sal_Bool bConvert = sal_True; // the default is that all metric items must be converted diff --git a/framework/inc/classes/framelistanalyzer.hxx b/framework/inc/classes/framelistanalyzer.hxx index 518870b354f1..4ab3c4532cdc 100644 --- a/framework/inc/classes/framelistanalyzer.hxx +++ b/framework/inc/classes/framelistanalyzer.hxx @@ -29,13 +29,6 @@ #define __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_ //_______________________________________________ -// my own includes - -#include <threadhelp/threadhelpbase.hxx> -#include <macros/debug.hxx> -#include <general.h> - -//_______________________________________________ // interface includes #include <com/sun/star/frame/XFrame.hpp> @@ -88,10 +81,10 @@ class FrameListAnalyzer public: /** provides access to the frame container, which should be analyzed. */ - const css::uno::Reference< css::frame::XFramesSupplier >& m_xSupplier; + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& m_xSupplier; /** hold the reference frame, which is used e.g. to detect other frames with the same model. */ - const css::uno::Reference< css::frame::XFrame >& m_xReferenceFrame; + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xReferenceFrame; /** enable/disable some special analyzing steps. see impl_analyze() for further informations. */ @@ -100,19 +93,19 @@ class FrameListAnalyzer /** contains all frames, which uses the same model like the reference frame. Will be filled only if m_eDetectMode has set the flag E_MODEL. The reference frame is never part of this list! */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lModelFrames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lModelFrames; /** contains all frames, which does not contain the same model like the reference frame. Filling of it can't be supressed by m_eDetectMode. The reference frame is never part of this list! All frames inside this list are visible ones. */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherVisibleFrames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherVisibleFrames; /** contains all frames, which does not contain the same model like the reference frame. Filling of it can't be supressed by m_eDetectMode. The reference frame is never part of this list! All frames inside this list are hidden ones. */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherHiddenFrames; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherHiddenFrames; /** points to the help frame. Will be set only, if any other frame (means different from the reference frame) @@ -137,7 +130,7 @@ class FrameListAnalyzer Analyzing of the help frame ignores the visible state of any frame. But note: a hidden help frame indicates a wrong state! */ - css::uno::Reference< css::frame::XFrame > m_xHelp; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xHelp; /** points to the frame, which contains the backing component. Will be set only, if any other frame (means different from the reference frame) @@ -163,7 +156,7 @@ class FrameListAnalyzer Analyzing of the help frame ignores the visible state of any frame. But note: a hidden backing mode frame indicates a wrong state! */ - css::uno::Reference< css::frame::XFrame > m_xBackingComponent; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xBackingComponent; /** is set to true only, if the reference frame is a hidden one. This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */ @@ -200,8 +193,8 @@ class FrameListAnalyzer analyze steps. Note: Some member values will be undefined, if an analyze step will be disabled. */ - FrameListAnalyzer( const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier , - const css::uno::Reference< css::frame::XFrame >& xReferenceFrame , + FrameListAnalyzer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& xSupplier , + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xReferenceFrame , sal_uInt32 eDetectMode ); virtual ~FrameListAnalyzer(); diff --git a/framework/inc/framework.hrc b/framework/inc/framework.hrc index eea91edeaa07..1817b60d90e9 100644 --- a/framework/inc/framework.hrc +++ b/framework/inc/framework.hrc @@ -35,9 +35,9 @@ #define RID_GROUPS_OFFSET 32000 #define RID_GROUPS_END 32767 -#define RID_FWK_DIALOG_START (RID_FWK_START + 2048) +#define RID_FWK_DIALOG_START_CORRECT (RID_FWK_START + 2048) -#define DLG_FILTER_SELECT (RID_FWK_DIALOG_START + 0) +#define DLG_FILTER_SELECT (RID_FWK_DIALOG_START_CORRECT + 0) #define STR_FILTER_DOWNLOAD (RID_FWK_START+0) #define STR_FILTER_CHOOSER (RID_FWK_START+1) @@ -45,7 +45,7 @@ #define STR_FILTER_ZIPPED (RID_FWK_START+3) // ResIds for BackingWindow -#define DLG_BACKING (RID_FWK_DIALOG_START+100) +#define DLG_BACKING (RID_FWK_DIALOG_START_CORRECT+100) #define STR_BACKING_WELCOME 1 #define STR_BACKING_WELCOMEPRODUCT 2 #define STR_BACKING_CREATE 3 @@ -78,7 +78,7 @@ #define BMP_BACKING_OPENTEMPLATE 17 // Ids of TabWindow -#define WIN_TABWINDOW (RID_FWK_DIALOG_START+101) +#define WIN_TABWINDOW (RID_FWK_DIALOG_START_CORRECT+101) #define TC_TABCONTROL 1 #endif diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx index 9c5f9c89afe6..856746139b68 100644 --- a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx @@ -219,6 +219,7 @@ namespace framework com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xModuleAcceleratorManager; }; } diff --git a/framework/prj/d.lst b/framework/prj/d.lst index 7f260f07cf65..fe6077f57bc8 100644 --- a/framework/prj/d.lst +++ b/framework/prj/d.lst @@ -42,6 +42,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\statusbar ..\inc\classes\menuextensionsupplier.hxx %_DEST%\inc%_EXT%\framework\menuextensionsupplier.hxx ..\inc\interaction\preventduplicateinteraction.hxx %_DEST%\inc%_EXT%\framework\preventduplicateinteraction.hxx ..\inc\helper\titlehelper.hxx %_DEST%\inc%_EXT%\framework\titlehelper.hxx +..\inc\classes\framelistanalyzer.hxx %_DEST%\inc%_EXT%\framework\framelistanalyzer.hxx ..\uiconfig\startmodule\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\menubar\*.xml ..\uiconfig\startmodule\toolbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\toolbar\*.xml diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index b81ef5aecf0e..43772f5c4273 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -1248,11 +1248,12 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util: if (! xHAccess.is ()) return; - const sal_Int32 c = aEvent.Changes.getLength(); + css::util::ChangesEvent aReceivedEvents( aEvent ); + const sal_Int32 c = aReceivedEvents.Changes.getLength(); sal_Int32 i = 0; for (i=0; i<c; ++i) { - const css::util::ElementChange& aChange = aEvent.Changes[i]; + const css::util::ElementChange& aChange = aReceivedEvents.Changes[i]; // Only path of form "PrimaryKeys/Modules/Module['<module_name>']/Key['<command_url>']/Command[<locale>]" will // be interesting for use. Sometimes short path values are given also by the broadcaster ... but they must be ignored :-) diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 17def8e1c684..eaf0a4d33133 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -29,6 +29,7 @@ #include "precompiled_framework.hxx" #include "backingwindow.hxx" +#include "classes/resource.hrc" #include "framework.hrc" #include "classes/fwkresid.hxx" #include <services.h> @@ -388,8 +389,13 @@ void BackingWindow::prepareRecentFileMenu() aBuf.append( aMenuTitle ); mpRecentMenu->InsertItem( static_cast<USHORT>(i+1), aBuf.makeStringAndClear() ); } - maOpenButton.SetPopupMenu( mpRecentMenu ); } + else + { + String aNoDoc( FwkResId( STR_NODOCUMENT ) ); + mpRecentMenu->InsertItem( 0xffff, aNoDoc ); + } + maOpenButton.SetPopupMenu( mpRecentMenu ); } void BackingWindow::initBackground() diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 77e58df602ff..65df7b2236e7 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -777,26 +777,29 @@ void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::u css::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); - { - ResetableGuard aGuard( m_aLock ); - try - { - if ( m_xModuleImageManager.is() ) - m_xModuleImageManager->dispose(); - } - catch ( Exception& ) - { - } + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + ResetableGuard aGuard( m_aLock ); + Reference< XComponent > xModuleImageManager( m_xModuleImageManager ); + m_xModuleImageManager.clear(); + m_xModuleAcceleratorManager.clear(); + m_aUIElements[LAYER_USERDEFINED].clear(); + m_aUIElements[LAYER_DEFAULT].clear(); + m_xDefaultConfigStorage.clear(); + m_xUserConfigStorage.clear(); + m_xUserRootCommit.clear(); + m_bConfigRead = false; + m_bModified = false; + m_bDisposed = true; + aGuard.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - m_xModuleImageManager.clear(); - m_aUIElements[LAYER_USERDEFINED].clear(); - m_aUIElements[LAYER_DEFAULT].clear(); - m_xDefaultConfigStorage.clear(); - m_xUserConfigStorage.clear(); - m_xUserRootCommit.clear(); - m_bConfigRead = false; - m_bModified = false; - m_bDisposed = true; + try + { + if ( xModuleImageManager.is() ) + xModuleImageManager->dispose(); + } + catch ( Exception& ) + { } } @@ -1371,30 +1374,35 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() } return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY ); - -// return Reference< XInterface >(); } Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) { ResetableGuard aGuard( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + Reference< XMultiServiceFactory > xSMGR = m_xServiceManager; - ::rtl::OUString aModule = /*m_aModuleShortName*/m_aModuleIdentifier; - aGuard.unlock(); + ::rtl::OUString aModule = m_aModuleIdentifier; - Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION); - Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW); + if ( !m_xModuleAcceleratorManager.is() ) + { + Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION); + Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW); - PropertyValue aProp; - aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier"); - aProp.Value <<= aModule; + PropertyValue aProp; + aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier"); + aProp.Value <<= aModule; - Sequence< Any > lArgs(1); - lArgs[0] <<= aProp; + Sequence< Any > lArgs(1); + lArgs[0] <<= aProp; - xInit->initialize(lArgs); + xInit->initialize(lArgs); + m_xModuleAcceleratorManager = Reference< XInterface >( xManager, UNO_QUERY ); + } - return xManager; + return m_xModuleAcceleratorManager; } Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 91532cda76e2..edc5f67ce60a 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -50,7 +50,6 @@ LIB1OBJFILES= \ $(SLO)$/protocolhandlercache.obj \ $(SLO)$/networkdomain.obj \ $(SLO)$/configaccess.obj \ - $(SLO)$/framelistanalyzer.obj \ $(SLO)$/shareablemutex.obj \ $(SLO)$/itemcontainer.obj \ $(SLO)$/rootitemcontainer.obj \ @@ -99,6 +98,7 @@ LIB2OBJFILES= \ $(SLO)$/configimporter.obj \ $(SLO)$/menuextensionsupplier.obj \ $(SLO)$/preventduplicateinteraction.obj \ + $(SLO)$/framelistanalyzer.obj \ $(SLO)$/titlehelper.obj # --- import classes library --------------------------------------------------- diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index 7468394d2617..89062d7b7263 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -94,7 +94,7 @@ public: USHORT GetViewFactoryCount() const; SfxViewFactory& GetViewFactory(USHORT i = 0) const; - /// returns the view factory whose GetViewName delivers the requested logical name + /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const; // Filter diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index d376236bf830..affa836486e6 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -253,6 +253,7 @@ public: private: SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); + SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const USHORT i_nNewViewId ); /** loads the given existing document into the given frame diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 8465a238cd5b..ee8dfb1ca57c 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -123,13 +123,13 @@ public: \ static SfxViewFactory&Factory() { return *pFactory; } \ static void InitFactory() -#define SFX_IMPL_VIEWFACTORY(Class, rResId) \ +#define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \ SfxViewFactory* Class::pFactory; \ SfxViewShell* __EXPORT Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \ { return new Class(pFrame, pOldView); } \ void Class::RegisterFactory( USHORT nPrio ) \ { \ - pFactory = new SfxViewFactory(&CreateInstance,&InitFactory,nPrio,rResId);\ + pFactory = new SfxViewFactory(&CreateInstance,&InitFactory,nPrio,AsciiViewName);\ InitFactory(); \ } \ void Class::InitFactory() diff --git a/sfx2/inc/viewfac.hxx b/sfx2/inc/viewfac.hxx index 6f9ae1d3cb37..b0f0abdba3b3 100644 --- a/sfx2/inc/viewfac.hxx +++ b/sfx2/inc/viewfac.hxx @@ -46,24 +46,29 @@ class SFX2_DLLPUBLIC SfxViewFactory { public: SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI, - USHORT nOrdinal, const ResId& aDescrResId ); + USHORT nOrdinal, const sal_Char* asciiViewName ); ~SfxViewFactory(); SfxViewShell *CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh); void InitFactory(); - String GetDescription() const - { return String( aDescription ); } USHORT GetOrdinal() const { return nOrd; } - /// returns an API-compatible view name. For the moment, this is "view" with an appended ordinal/ID - String GetViewName() const; + /// returns a legacy view name. This is "view" with an appended ordinal/ID. + String GetLegacyViewName() const; + + /** returns a API-compatible view name. + + For details on which view names are specified, see the XModel2.getAvailableViewControllerNames + documentation. + */ + String GetAPIViewName() const; private: SfxViewCtor fnCreate; SfxViewInit fnInit; USHORT nOrd; - ResId aDescription; + const String m_sViewName; }; #endif diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index f25485a1401c..30fe2460d512 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -253,10 +253,11 @@ namespace sfx2 pWindow->SetHelpId( HID_TASKPANE_WINDOW ); pWindow->SetOutputSizePixel( Size( 300, 450 ) ); - pWindow->Show(); dynamic_cast< SfxDockingWindow* >( pWindow )->Initialize( i_pInfo ); SetHideNotDelete( TRUE ); + + pWindow->Show(); } //------------------------------------------------------------------------------------------------------------------ @@ -584,6 +585,7 @@ namespace sfx2 return; ::rtl::OUString sFirstVisiblePanelResource; + ::rtl::OUString sFirstPanelResource; const Sequence< ::rtl::OUString > aUIElements( aWindowStateConfig.getNodeNames() ); for ( const ::rtl::OUString* resource = aUIElements.getConstArray(); @@ -594,6 +596,8 @@ namespace sfx2 if ( !impl_isToolPanelResource( *resource ) ) continue; + sFirstPanelResource = *resource; + ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); @@ -620,6 +624,9 @@ namespace sfx2 sFirstVisiblePanelResource = *resource; } + if ( sFirstVisiblePanelResource.getLength() == 0 ) + sFirstVisiblePanelResource = sFirstPanelResource; + if ( sFirstVisiblePanelResource.getLength() ) { ::boost::optional< size_t > aPanelPos( GetPanelPos( sFirstVisiblePanelResource ) ); diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index bfd67210ec44..4311559f94af 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -159,6 +159,21 @@ void SfxObjectFactory::RegisterViewFactory SfxViewFactory &rFactory ) { +#if OSL_DEBUG_LEVEL > 0 + { + const String sViewName( rFactory.GetAPIViewName() ); + for ( sal_uInt16 i = 0; i < pImpl->aViewFactoryArr.Count(); ++i ) + { + if ( !pImpl->aViewFactoryArr[i]->GetAPIViewName().Equals( sViewName ) ) + continue; + ByteString sMessage( "SfxObjectFactory::RegisterViewFactory: duplicate view name '" ); + sMessage += ByteString( sViewName, RTL_TEXTENCODING_ASCII_US ); + sMessage += "'!"; + OSL_ENSURE( false, sMessage.GetBuffer() ); + break; + } + } +#endif sal_uInt16 nPos; for ( nPos = 0; nPos < pImpl->aViewFactoryArr.Count() && @@ -467,7 +482,9 @@ SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rVie ) { SfxViewFactory& rViewFac( GetViewFactory( nViewNo ) ); - if ( rViewFac.GetViewName() == i_rViewName ) + if ( ( rViewFac.GetAPIViewName() == i_rViewName ) + || ( rViewFac.GetLegacyViewName() == i_rViewName ) + ) return &rViewFac; } return NULL; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 066f366b09bd..bb0e6939ead8 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1344,8 +1344,13 @@ sal_uInt16 SfxObjectShell::ImplGetSignatureState( sal_Bool bScriptingContent ) void SfxObjectShell::ImplSign( sal_Bool bScriptingContent ) { // Check if it is stored in OASIS format... - if ( GetMedium() && GetMedium()->GetFilter() - && ( !GetMedium()->GetFilter()->IsOwnFormat() || !GetMedium()->HasStorage_Impl() ) ) + if ( GetMedium() + && GetMedium()->GetFilter() + && GetMedium()->GetName().Len() + && ( !GetMedium()->GetFilter()->IsOwnFormat() + || !GetMedium()->HasStorage_Impl() + ) + ) { // Only OASIS and OOo6.x formats will be handled further InfoBox( NULL, SfxResId( RID_XMLSEC_INFO_WRONGDOCFORMAT ) ).Execute(); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index e3b04f72caf7..037493c61252 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1917,7 +1917,25 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl( bResult = SaveCompleted( xTmpStorage ); if ( bResult ) + { pImp->pBasicManager->setStorage( xTmpStorage ); + + // Get rid of this workaround after issue i113914 is fixed + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImp->xBasicLibraries, uno::UNO_QUERY_THROW ); + xBasicLibraries->setRootStorage( xTmpStorage ); + } + catch( uno::Exception& ) + {} + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImp->xDialogLibraries, uno::UNO_QUERY_THROW ); + xDialogLibraries->setRootStorage( xTmpStorage ); + } + catch( uno::Exception& ) + {} + } } catch( uno::Exception& ) {} @@ -2063,6 +2081,22 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) // TODO/LATER: may be this code will be replaced, but not sure // Set storage in document library containers pImp->pBasicManager->setStorage( xStorage ); + + // Get rid of this workaround after issue i113914 is fixed + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImp->xBasicLibraries, uno::UNO_QUERY_THROW ); + xBasicLibraries->setRootStorage( xStorage ); + } + catch( uno::Exception& ) + {} + try + { + uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImp->xDialogLibraries, uno::UNO_QUERY_THROW ); + xDialogLibraries->setRootStorage( xStorage ); + } + catch( uno::Exception& ) + {} } else { diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index fe4ffa50f67d..846cc669b9a7 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3812,7 +3812,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewCon Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount ); for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) - aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetViewName(); + aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetAPIViewName(); return aViewNames; } @@ -3826,7 +3826,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef SfxModelGuard aGuard( *this ); const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); - const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName(); + const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetAPIViewName(); aGuard.clear(); diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index ed158ce009e3..df252b831803 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -650,7 +650,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // ensure the ID of the to-be-created view is in the descriptor, if possible const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); - const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); + const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() ); // if the document is created hidden, prevent it from being deleted until it is shown or disposed impl_lockHiddenDocument( *xDoc, aDescriptor ); diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index f5c24b195af7..cda5fd0bdd7d 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -118,6 +118,7 @@ using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::lang::DisposedException; using ::com::sun::star::awt::XWindow; using ::com::sun::star::frame::XController; @@ -579,7 +580,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run ::rtl::OUString sViewName; if ( nViewNo < rDocFac.GetViewFactoryCount() ) - sViewName = rDocFac.GetViewFactory( nViewNo ).GetViewName(); + sViewName = rDocFac.GetViewFactory( nViewNo ).GetAPIViewName(); return sViewName; } @@ -1421,20 +1422,52 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) // if so, forward it to the view/shell. if ( !bHasPluginMode && !bHasJumpMark ) { + // Note that this might not be the ideal place here. Restoring view data should, IMO, be the + // responsibility of the loader, not an implementation detail burried here deep within the controller's + // implementation. + // What I think should be done to replace the below code: + // - change SfxBaseController::restoreViewData to also accept a PropertyValue[] (it currently accepts + // a string only), and forward it to its ViewShell's ReadUserDataSequence + // - change the frame loader so that when a new document is loaded (as opposed to an existing + // document being loaded into a new frame), the model's view data is examine the very same + // way as below, and the proper view data is set via XController::restoreViewData + // - extend SfxViewFrame::SwitchToViewShell_Impl. Currently, it cares for the case where a non-PrintPreview + // view is exchanged, and sets the old view's data at the model. It should also care for the other + // way, were the PrintPreview view is left: in this case, the new view should also be initialized + // with the model's view data try { - Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY ); - Reference< XIndexAccess > xViewData; - if ( xViewDataSupplier.is() ) - xViewData = xViewDataSupplier->getViewData(); - if ( xViewData.is() && xViewData->getCount() > 0 ) + Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY_THROW ); + Reference< XIndexAccess > xViewData( xViewDataSupplier->getViewData(), UNO_SET_THROW ); + + // find the view data item whose ViewId matches the ID of the view we're just connecting to + const SfxObjectFactory& rDocFactory( rDoc.GetFactory() ); + const sal_Int32 nCount = xViewData->getCount(); + sal_Int32 nViewDataIndex = 0; + for ( sal_Int32 i=0; i<nCount; ++i ) { - Sequence< PropertyValue > aViewData; - if ( ( xViewData->getByIndex( 0 ) >>= aViewData ) && ( aViewData.getLength() ) ) + const ::comphelper::NamedValueCollection aViewData( xViewData->getByIndex(i) ); + ::rtl::OUString sViewId( aViewData.getOrDefault( "ViewId", ::rtl::OUString() ) ); + if ( sViewId.getLength() == 0 ) + continue; + + const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId ); + if ( pViewFactory == NULL ) + continue; + + if ( pViewFactory->GetOrdinal() == pViewFrame->GetCurViewId() ) { - m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE ); + nViewDataIndex = i; + break; } } + if ( nViewDataIndex < nCount ) + { + Sequence< PropertyValue > aViewData; + OSL_VERIFY( xViewData->getByIndex( nViewDataIndex ) >>= aViewData ); + if ( aViewData.getLength() > 0 ) + m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE ); + } } catch( const Exception& ) { diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx index b58bbc2840da..f9469e8a9f88 100644 --- a/sfx2/source/view/viewfac.cxx +++ b/sfx2/source/view/viewfac.cxx @@ -49,7 +49,7 @@ void SfxViewFactory::InitFactory() (*fnInit)(); } -String SfxViewFactory::GetViewName() const +String SfxViewFactory::GetLegacyViewName() const { ::rtl::OUStringBuffer aViewName; aViewName.appendAscii( "view" ); @@ -57,18 +57,27 @@ String SfxViewFactory::GetViewName() const return aViewName.makeStringAndClear(); } +String SfxViewFactory::GetAPIViewName() const +{ + if ( m_sViewName.Len() > 0 ) + return m_sViewName; + + if ( GetOrdinal() == 0 ) + return String::CreateFromAscii( "Default" ); + + return GetLegacyViewName(); +} + // CTOR / DTOR ----------------------------------------------------------- SfxViewFactory::SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI, - USHORT nOrdinal, const ResId& aDescrResId ): + USHORT nOrdinal, const sal_Char* asciiViewName ): fnCreate(fnC), fnInit(fnI), nOrd(nOrdinal), - aDescription(aDescrResId.GetId(), *aDescrResId.GetResMgr()) + m_sViewName( String::CreateFromAscii( asciiViewName ) ) { - aDescription.SetRT(aDescrResId.GetRT()); DBG_CTOR(SfxViewFactory, 0); -// SFX_APP()->RegisterViewFactory_Impl(*this); } SfxViewFactory::~SfxViewFactory() diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ed924623c700..72e3737057c1 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -75,6 +75,8 @@ #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/EmbedStates.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> #include <rtl/ustrbuf.hxx> #include <unotools/localfilehelper.hxx> @@ -96,6 +98,7 @@ #include <comphelper/storagehelper.hxx> #include <svtools/asynclink.hxx> #include <svl/sharecontrolfile.hxx> +#include <framework/framelistanalyzer.hxx> #include <boost/optional.hpp> @@ -106,6 +109,8 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using ::com::sun::star::awt::XWindow; using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexContainer; namespace css = ::com::sun::star; #ifndef GCC @@ -2092,7 +2097,25 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell { ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + + if ( !i_bHidden ) + { + try + { + // if there is a backing component, use it + Reference< XFramesSupplier > xTaskSupplier( xDesktop , css::uno::UNO_QUERY_THROW ); + ::framework::FrameListAnalyzer aAnalyzer( xTaskSupplier, Reference< XFrame >(), ::framework::FrameListAnalyzer::E_BACKINGCOMPONENT ); + + if ( aAnalyzer.m_xBackingComponent.is() ) + xFrame = aAnalyzer.m_xBackingComponent; + } + catch( uno::Exception& ) + {} + } + + if ( !xFrame.is() ) + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + bOwnFrame = true; } @@ -2242,6 +2265,72 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c //-------------------------------------------------------------------- +void SfxViewFrame::SaveCurrentViewData_Impl( const USHORT i_nNewViewId ) +{ + SfxViewShell* pCurrentShell = GetViewShell(); + ENSURE_OR_RETURN_VOID( pCurrentShell != NULL, "SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" ); + + // determine the logical (API) view name + const SfxObjectFactory& rDocFactory( pCurrentShell->GetObjectShell()->GetFactory() ); + const sal_uInt16 nCurViewNo = rDocFactory.GetViewNo_Impl( GetCurViewId(), 0 ); + const String sCurrentViewName = rDocFactory.GetViewFactory( nCurViewNo ).GetAPIViewName(); + const sal_uInt16 nNewViewNo = rDocFactory.GetViewNo_Impl( i_nNewViewId, 0 ); + const String sNewViewName = rDocFactory.GetViewFactory( nNewViewNo ).GetAPIViewName(); + if ( ( sCurrentViewName.Len() == 0 ) || ( sNewViewName.Len() == 0 ) ) + { + // can't say anything about the view, the respective application did not yet migrate its code to + // named view factories => bail out + OSL_ENSURE( false, "SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" ); + return; + } + OSL_ENSURE( !sNewViewName.Equals( sCurrentViewName ), "SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!" ); + + // save the view data only when we're moving from a non-print-preview to the print-preview view + if ( !sNewViewName.EqualsAscii( "PrintPreview" ) ) + return; + + // retrieve the view data from the view + Sequence< PropertyValue > aViewData; + pCurrentShell->WriteUserDataSequence( aViewData ); + + try + { + // retrieve view data (for *all* views) from the model + const Reference< XController > xController( pCurrentShell->GetController(), UNO_SET_THROW ); + const Reference< XViewDataSupplier > xViewDataSupplier( xController->getModel(), UNO_QUERY_THROW ); + const Reference< XIndexContainer > xViewData( xViewDataSupplier->getViewData(), UNO_QUERY_THROW ); + + // look up the one view data item which corresponds to our current view, and remove it + const sal_Int32 nCount = xViewData->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) + { + const ::comphelper::NamedValueCollection aCurViewData( xViewData->getByIndex(i) ); + ::rtl::OUString sViewId( aCurViewData.getOrDefault( "ViewId", ::rtl::OUString() ) ); + if ( sViewId.getLength() == 0 ) + continue; + + const SfxViewFactory* pViewFactory = rDocFactory.GetViewFactoryByViewName( sViewId ); + if ( pViewFactory == NULL ) + continue; + + if ( pViewFactory->GetOrdinal() == GetCurViewId() ) + { + xViewData->removeByIndex(i); + break; + } + } + + // then replace it with the most recent view data we just obtained + xViewData->insertByIndex( 0, makeAny( aViewData ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//-------------------------------------------------------------------- + sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( sal_uInt16 nViewIdOrNo, /* > 0 @@ -2304,6 +2393,9 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); const USHORT nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; + // save the view data of the old view, so it can be restored later on (when needed) + SaveCurrentViewData_Impl( nViewId ); + // create and load new ViewShell SfxViewShell* pNewSh = LoadViewIntoFrame_Impl( *GetObjectShell(), diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 4ed0173be8e1..72a85258e9c3 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -143,18 +143,26 @@ SfxPrinterController::SfxPrinterController( const Any& i_rComplete, aRenderOptions[1].Value = i_rViewProp; aRenderOptions[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ); aRenderOptions[2].Value <<= sal_True; - Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) ); - int nProps = aRenderParms.getLength(); - for( int i = 0; i < nProps; i++ ) + try { - if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) ); + int nProps = aRenderParms.getLength(); + for( int i = 0; i < nProps; i++ ) { - Sequence< beans::PropertyValue > aUIProps; - aRenderParms[i].Value >>= aUIProps; - setUIOptions( aUIProps ); - break; + if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + { + Sequence< beans::PropertyValue > aUIProps; + aRenderParms[i].Value >>= aUIProps; + setUIOptions( aUIProps ); + break; + } } } + catch( lang::IllegalArgumentException& ) + { + // the first renderer should always be available for the UI options, + // but catch the exception to be safe + } } // set some job parameters @@ -234,7 +242,13 @@ Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_ if( mxRenderable.is() && pPrinter ) { Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() ); - aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions ); + try + { + aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions ); + } + catch( lang::IllegalArgumentException& ) + { + } } return aResult; } diff --git a/svx/source/dialog/checklbx.cxx b/svx/source/dialog/checklbx.cxx index c54634017392..80096ce70f32 100644 --- a/svx/source/dialog/checklbx.cxx +++ b/svx/source/dialog/checklbx.cxx @@ -212,7 +212,7 @@ void SvxCheckListBox::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() ) { - Point aPnt = rMEvt.GetPosPixel(); + const Point aPnt = rMEvt.GetPosPixel(); SvLBoxEntry* pEntry = GetEntry( aPnt ); if ( pEntry ) @@ -230,6 +230,13 @@ void SvxCheckListBox::MouseButtonDown( const MouseEvent& rMEvt ) { ToggleCheckButton( pEntry ); SvTreeListBox::MouseButtonDown( rMEvt ); + + // check if the entry below the mouse changed during the base method call. This is possible if, + // for instance, a handler invoked by the base class tampers with the list entries. + const SvLBoxEntry* pNewEntry = GetEntry( aPnt ); + if ( pNewEntry != pEntry ) + return; + if ( bCheck != ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) ) CheckButtonHdl(); return; diff --git a/svx/source/dialog/sendreportunx.cxx b/svx/source/dialog/sendreportunx.cxx index 47a75f668b2f..d59bc9bb1cba 100644 --- a/svx/source/dialog/sendreportunx.cxx +++ b/svx/source/dialog/sendreportunx.cxx @@ -243,7 +243,7 @@ namespace svx{ int ret = -1; rtl::OUString path1( RTL_CONSTASCII_USTRINGPARAM( - "$BRAND_BASE_DIR/program/crash_report.bin")); + "$BRAND_BASE_DIR/program/crashrep")); rtl::Bootstrap::expandMacros(path1); rtl::OString path2; if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) == diff --git a/svx/source/gengal/gengal.sh b/svx/source/gengal/gengal.sh index 98e2cc1c845a..a760b8e085d0 100644 --- a/svx/source/gengal/gengal.sh +++ b/svx/source/gengal/gengal.sh @@ -67,17 +67,17 @@ case $sd_platform in ;; Darwin) - DYLD_LIBRARY_PATH=${sd_prog}${DYLD_LIBRARY_PATH+:${DYLD_LIBRARY_PATH}} + 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}} + 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}} + LD_LIBRARY_PATH=${sd_prog}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} export LD_LIBRARY_PATH ;; esac diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index e21ea8fc6e4b..d80f871d8b3c 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -32,7 +32,7 @@ StringArray RID_ATTR_NAMES { - ItemList = + ItemList [ en-US ] = { < "Scale" ; SID_ATTR_ZOOM ; > ; < "Brush" ; SID_ATTR_BRUSH ; > ; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index d860f4973fd2..9c5affc38f9b 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -708,6 +708,7 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& // next entry ++aSrcIt; } + const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny(); } } diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index c13ec9d367c8..30f7e32f3828 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/ucb/XParameterizedContentProvider.hpp> #include <com/sun/star/ucb/XContentProviderFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/uno/Any.hxx> #include <ucbhelper/cancelcommandexecution.hxx> @@ -182,6 +183,63 @@ void makeAndAppendXMLName( } } +bool createContentProviderData( + const rtl::OUString & rProvider, + const uno::Reference< container::XHierarchicalNameAccess >& rxHierNameAccess, + ContentProviderData & rInfo) +{ + // Obtain service name. + rtl::OUStringBuffer aKeyBuffer (rProvider); + aKeyBuffer.appendAscii( "/ServiceName" ); + + rtl::OUString aValue; + try + { + if ( !( rxHierNameAccess->getByHierarchicalName( + aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) + { + OSL_ENSURE( false, + "UniversalContentBroker::getContentProviderData - " + "Error getting item value!" ); + } + } + catch (container::NoSuchElementException &) + { + return false; + } + + rInfo.ServiceName = aValue; + + // Obtain URL Template. + aKeyBuffer.append(rProvider); + aKeyBuffer.appendAscii( "/URLTemplate" ); + + if ( !( rxHierNameAccess->getByHierarchicalName( + aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) + { + OSL_ENSURE( false, + "UniversalContentBroker::getContentProviderData - " + "Error getting item value!" ); + } + + rInfo.URLTemplate = aValue; + + // Obtain Arguments. + aKeyBuffer.append(rProvider); + aKeyBuffer.appendAscii( "/Arguments" ); + + if ( !( rxHierNameAccess->getByHierarchicalName( + aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) + { + OSL_ENSURE( false, + "UniversalContentBroker::getContentProviderData - " + "Error getting item value!" ); + } + + rInfo.Arguments = aValue; + return true; +} + } //========================================================================= @@ -647,28 +705,10 @@ void SAL_CALL UniversalContentBroker::changesOccurred( const util::ChangesEvent& sal_Int32 nCount = Event.Changes.getLength(); if ( nCount ) { + uno::Reference< container::XHierarchicalNameAccess > xHierNameAccess; + Event.Base >>= xHierNameAccess; - uno::Reference< lang::XMultiServiceFactory > xConfigProv( - m_xSMgr->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.configuration.ConfigurationProvider" ) ), - uno::UNO_QUERY_THROW ); - - uno::Sequence< uno::Any > aArguments( 1 ); - beans::PropertyValue aProperty; - aProperty.Name - = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aProperty.Value <<= Event.Base; - aArguments[ 0 ] <<= aProperty; - - uno::Reference< uno::XInterface > xInterface( - xConfigProv->createInstanceWithArguments( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" ) ), - aArguments ) ); - - uno::Reference< container::XHierarchicalNameAccess > - xHierNameAccess( xInterface, uno::UNO_QUERY_THROW ); + OSL_ASSERT( xHierNameAccess.is() ); const util::ElementChange* pElementChanges = Event.Changes.getConstArray(); @@ -682,9 +722,18 @@ void SAL_CALL UniversalContentBroker::changesOccurred( const util::ChangesEvent& ContentProviderData aInfo; - createContentProviderData(aKey, xHierNameAccess, aInfo); - - aData.push_back(aInfo); + // Removal of UCPs from the configuration leads to changesOccurred + // notifications, too, but it is hard to tell for a given + // ElementChange whether it is an addition or a removal, so as a + // heuristic consider as removals those that cause a + // NoSuchElementException in createContentProviderData. + // + // For now, removal of UCPs from the configuration is simply ignored + // (and not reflected in the UCB's data structures): + if (createContentProviderData(aKey, xHierNameAccess, aInfo)) + { + aData.push_back(aInfo); + } } prepareAndRegister(aData); @@ -852,7 +901,10 @@ bool UniversalContentBroker::getContentProviderData( makeAndAppendXMLName( aElemBuffer, pElems[ n ] ); aElemBuffer.appendAscii( "']" ); - createContentProviderData(aElemBuffer.makeStringAndClear(), xHierNameAccess, aInfo); + OSL_VERIFY( + createContentProviderData( + aElemBuffer.makeStringAndClear(), xHierNameAccess, + aInfo)); rListToFill.push_back( aInfo ); } @@ -884,55 +936,6 @@ bool UniversalContentBroker::getContentProviderData( return true; } -void UniversalContentBroker::createContentProviderData( - const rtl::OUString & rProvider, - const uno::Reference< container::XHierarchicalNameAccess >& rxHierNameAccess, - ContentProviderData & rInfo) -{ - // Obtain service name. - rtl::OUStringBuffer aKeyBuffer (rProvider); - aKeyBuffer.appendAscii( "/ServiceName" ); - - rtl::OUString aValue; - if ( !( rxHierNameAccess->getByHierarchicalName( - aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) - { - OSL_ENSURE( false, - "UniversalContentBroker::getContentProviderData - " - "Error getting item value!" ); - } - - rInfo.ServiceName = aValue; - - // Obtain URL Template. - aKeyBuffer.append(rProvider); - aKeyBuffer.appendAscii( "/URLTemplate" ); - - if ( !( rxHierNameAccess->getByHierarchicalName( - aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) - { - OSL_ENSURE( false, - "UniversalContentBroker::getContentProviderData - " - "Error getting item value!" ); - } - - rInfo.URLTemplate = aValue; - - // Obtain Arguments. - aKeyBuffer.append(rProvider); - aKeyBuffer.appendAscii( "/Arguments" ); - - if ( !( rxHierNameAccess->getByHierarchicalName( - aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) - { - OSL_ENSURE( false, - "UniversalContentBroker::getContentProviderData - " - "Error getting item value!" ); - } - - rInfo.Arguments = aValue; -} - //========================================================================= // // ProviderListEntry_Impl implementation. diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx index 0e44c5bc99b5..d2f6e4e4c41e 100644 --- a/ucb/source/core/ucb.hxx +++ b/ucb/source/core/ucb.hxx @@ -40,7 +40,6 @@ #include <com/sun/star/util/XChangesListener.hpp> #include <com/sun/star/util/XChangesNotifier.hpp> #include <com/sun/star/container/XContainer.hpp> -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <rtl/ustrbuf.hxx> #include <cppuhelper/weak.hxx> @@ -204,11 +203,6 @@ private: void prepareAndRegister( const ucbhelper::ContentProviderDataList& rData); - void createContentProviderData( - const rtl::OUString& rProvider, - const com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess >& rxHierNameAccess, - ucbhelper::ContentProviderData& rInfo); - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr; diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 73fa61f31ff4..95c2b45749ac 100755..100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -270,7 +270,7 @@ handleAuthenticationRequest_( aInfo.SetCanRememberPassword( ePreferredRememberMode != eAlternateRememberMode); aInfo.SetIsRememberPassword( - eDefaultRememberMode != ucb::RememberAuthentication_NO); + ePreferredRememberMode == eDefaultRememberMode); aInfo.SetIsRememberPersistent( ePreferredRememberMode == ucb::RememberAuthentication_PERSISTENT); diff --git a/xmlhelp/prj/d.lst b/xmlhelp/prj/d.lst index 1cfa107f73b9..67fe323757bb 100644 --- a/xmlhelp/prj/d.lst +++ b/xmlhelp/prj/d.lst @@ -4,4 +4,7 @@ ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.* ..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.* ..\util\ucpchelp.xml %_DEST%\xml%_EXT%\ucpchelp.xml +..\util\*.xsl %_DEST%\bin%_EXT%\*.* ..\%__SRC%\lib\ihelplinker.lib %_DEST%\lib%_EXT%\ihelplinker.lib +..\%__SRC%\bin\helpxsl.zip %_DEST%\pck%_EXT%\helpxsl.zip + diff --git a/xmlhelp/util/delzip b/xmlhelp/util/delzip new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/xmlhelp/util/delzip diff --git a/xmlhelp/util/embed.xsl b/xmlhelp/util/embed.xsl new file mode 100644 index 000000000000..3a4e3ef80f61 --- /dev/null +++ b/xmlhelp/util/embed.xsl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:output indent="yes" method="xml"/> + +<!-- SPECIFY YOUR FILE SYSTEM ROOT PATH TO THE HELP FILES --> +<xsl:param name="fsroot" select="'file:///handbuch/WORKBENCH/helpcontent2/source/'"/> + +<!-- +###################################################### +All others +###################################################### +--> +<xsl:template match="/"> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="*|@*|comment()|processing-instruction()|text()"> + <xsl:copy> + <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/> + </xsl:copy> +</xsl:template> + +<xsl:template match="*|@*|comment()|processing-instruction()|text()" mode="embedded"> + <xsl:copy> + <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()" mode="embedded"/> + </xsl:copy> +</xsl:template> + +<xsl:template match="bookmark" mode="embedded" /> +<xsl:template match="ahelp" mode="embedded"> + <xsl:apply-templates mode="embedded"/> +</xsl:template> + +<xsl:template match="paragraph[@role='heading']"> + <title> + <xsl:apply-templates/> + </title> +</xsl:template> + +<xsl:template match="paragraph[@role=*]"> + <paragraph> + <xsl:apply-templates/> + </paragraph> +</xsl:template> + +<xsl:template match="sort"> + <xsl:apply-templates/> +</xsl:template> + + +<!-- +###################################################### +EMBED +###################################################### +--> +<xsl:template match="embed"> + + <xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/> + <xsl:if test="not($doc//section[@id=$anchor])"> <!-- fallback for embeds that actually should be embedvars --> + <paragraph role="paragraph"><xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/></paragraph> + </xsl:if> +</xsl:template> + +<!-- +###################################################### +EMBEDVAR +###################################################### +--> +<xsl:template match="embedvar"> + <xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links --> + <xsl:variable name="href"><xsl:value-of select="substring-before(concat($fsroot,@href),'#')"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </xsl:if> + + <!-- FPE: embedvars, that point to "text/shared/00/00000004.xml#wie" will only be resolved in the main_transform --> + +</xsl:template> +</xsl:stylesheet> diff --git a/xmlhelp/util/idxcaption.xsl b/xmlhelp/util/idxcaption.xsl new file mode 100644 index 000000000000..7570fa5c7870 --- /dev/null +++ b/xmlhelp/util/idxcaption.xsl @@ -0,0 +1,34 @@ +<xsl:stylesheet version="1.0" encoding="UTF-8" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:office="http://openoffice.org/2000/office" + xmlns:style="http://openoffice.org/2000/style" + xmlns:table="http://openoffice.org/2000/table" + xmlns:draw="http://openoffice.org/2000/drawing" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:meta="http://openoffice.org/2000/meta" + xmlns:number="http://openoffice.org/2000/datastyle" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:chart="http://openoffice.org/2000/chart" + xmlns:help="http://openoffice.org/2000/help" + xmlns:index="http://sun.com/2000/XMLSearch" + xmlns:text="http://openoffice.org/2000/text"> + +<xsl:param name="Language" select="'en-US'"/> +<xsl:output method="text" encoding="UTF-8"/> + +<xsl:template match="/"> + <xsl:apply-templates select="//title" mode="include"/> + <xsl:apply-templates select="//paragraph[@role='heading']" mode="include"/> +</xsl:template> + +<xsl:template match="*" mode="include"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="*"/> + +</xsl:stylesheet> + diff --git a/xmlhelp/util/idxcontent.xsl b/xmlhelp/util/idxcontent.xsl new file mode 100644 index 000000000000..aa371d7f9255 --- /dev/null +++ b/xmlhelp/util/idxcontent.xsl @@ -0,0 +1,104 @@ +<xsl:stylesheet version="1.0" encoding="UTF-8" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:office="http://openoffice.org/2000/office" + xmlns:style="http://openoffice.org/2000/style" + xmlns:table="http://openoffice.org/2000/table" + xmlns:draw="http://openoffice.org/2000/drawing" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:meta="http://openoffice.org/2000/meta" + xmlns:number="http://openoffice.org/2000/datastyle" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:chart="http://openoffice.org/2000/chart" + xmlns:help="http://openoffice.org/2000/help" + xmlns:index="http://sun.com/2000/XMLSearch" + xmlns:text="http://openoffice.org/2000/text"> + +<xsl:param name="Language" select="'en-US'"/> +<xsl:output method="text" encoding="UTF-8"/> + +<xsl:template match="helpdocument|body"> + <xsl:choose> + <xsl:when test="meta/topic[@indexer='exclude']"/> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="title"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="table"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="tablecell"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="tablerow"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="list"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="listitem"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="item"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="emph"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="paragraph"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="section"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="bookmark"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="bookmark_value"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="link"> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="ahelp[@visibility='visible']"> + <xsl:value-of select="."/> + <xsl:text>
</xsl:text> +</xsl:template> + +<xsl:template match="*"/> + +</xsl:stylesheet> + + diff --git a/xmlhelp/util/main_transform.xsl b/xmlhelp/util/main_transform.xsl new file mode 100644 index 000000000000..d9b6c3229696 --- /dev/null +++ b/xmlhelp/util/main_transform.xsl @@ -0,0 +1,972 @@ +<?xml version="1.0" encoding="UTF-8"?> + + +<!--*********************************************************************** + This is the main transformation style sheet for transforming. + Only use with OOo 2.0 + Owner: fpe@openoffice.org + ========================================================================= + Changes Log + May 24 2004 Created + Aug 24 2004 Fixed for help2 CWS + Aug 27 2004 Added css link, fixed missing embed-mode for variable + Removed width/height for images + Sep 03 2004 Modularized xsl, added some embedded modes + Oct 08 2004 Fixed bug wrong mode "embedded" for links + Added embedded modes for embed and embedvar (for cascaded embeds) + Added <p> tags around falsely embedded pars and vars + Dec 08 2004 #i38483#, fixed wrong handling of web links + #i37377#, fixed missing usage of Database parameter for switching + Jan 04 2005 #i38905#, fixed buggy branding replacement template + Mar 17 2005 #i43972#, added language info to image URL, evaluate Language parameter + evaluate new localize attribute in images + May 10 2005 #i48785#, fixed wrong setting of distrib variable + Aug 16 2005 workaround for #i53365# + Aug 19 2005 fixed missing list processing in embedded sections + Aug 19 2005 #i53535#, fixed wrong handling of Database parameter + Oct 17 2006 #i70462#, disabled sorting to avoid output of error messages to console + Jun 15 2009 #i101799#, fixed wrong handling of http URLs with anchors +***********************************************************************//--> + +<!-- + + 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. + +--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:output indent="yes" method="html"/> + +<!-- +############################ +# Variables and Parameters # +############################ +//--> + +<!-- General Usage --> +<xsl:variable name="am" select="'&'"/> +<xsl:variable name="sl" select="'/'"/> +<xsl:variable name="qt" select="'"'"/> + +<!-- generic Icon alt text --> +<xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/> + +<!-- For calculating pixel sizes --> +<xsl:variable name="dpi" select="'96'"/> +<xsl:variable name="dpcm" select="'38'"/> + +<!-- Product brand variables used in the help files --> +<xsl:variable name="brand1" select="'$[officename]'"/> +<xsl:variable name="brand2" select="'$[officeversion]'"/> +<xsl:variable name="brand3" select="'%PRODUCTNAME'"/> +<xsl:variable name="brand4" select="'%PRODUCTVERSION'"/> + +<!-- meta data variables from the help file --> +<xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/> +<xsl:variable name="topic_id" select="/helpdocument/meta/topic/@id"/> +<xsl:variable name="topic_status" select="/helpdocument/meta/topic/@status"/> +<xsl:variable name="title" select="/helpdocument/meta/topic/title"/> +<xsl:variable name="doclang" select="/helpdocument/meta/topic/title/@xml-lang"/> + +<!-- Module and the corresponding switching values--> +<xsl:param name="Database" select="'swriter'"/> +<xsl:variable name="module" select="$Database"/> +<xsl:variable name="appl"> + <xsl:choose> + <xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when> + <xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when> + <xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when> + <xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when> + <xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when> + <xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when> + <xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when> + </xsl:choose> +</xsl:variable> + + <!-- the other parameters given by the help caller --> +<xsl:param name="System" select="'WIN'"/> +<xsl:param name="productname" select="'Office'"/> +<xsl:param name="productversion" select="''"/> +<xsl:variable name="pversion"> + <xsl:value-of select="translate($productversion,' ','')"/> +</xsl:variable> +<!-- this is were the images are --> +<xsl:param name="imgrepos" select="''"/> +<xsl:param name="Id" /> +<!-- (lame) distinction between OS and Commercial --> +<xsl:param name="distrib"> + <xsl:choose> + <xsl:when test="starts-with($productname,'OpenOffice')"> + <xsl:value-of select="'OpenSource'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'COMMERCIAL'"/> + </xsl:otherwise> + </xsl:choose> +</xsl:param> +<xsl:param name="Language" select="'en-US'"/> +<xsl:variable name="lang" select="$Language"/> + +<xsl:param name="ExtensionId" select="''"/> +<xsl:param name="ExtensionPath" select="''"/> + + + <!-- parts of help and image urls --> +<xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/> +<xsl:variable name="img_url_prefix" select="concat('vnd.sun.star.zip://',$imgrepos,'/')"/> +<xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/> +<xsl:variable name="urlpre" select="$help_url_prefix" /> +<xsl:variable name="linkprefix" select="$urlpre"/> +<xsl:variable name="linkpostfix" select="$urlpost"/> + +<xsl:variable name="css" select="'default.css'"/> + +<!-- images for notes, tips and warnings --> +<xsl:variable name="note_img" select="concat($img_url_prefix,'res/helpimg/note.png')"/> +<xsl:variable name="tip_img" select="concat($img_url_prefix,'res/helpimg/tip.png')"/> +<xsl:variable name="warning_img" select="concat($img_url_prefix,'res/helpimg/warning.png')"/> + +<!-- +############# +# Templates # +############# +//--> + +<!-- Create the document skeleton --> +<xsl:template match="/"> + <xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/> + <html> + <head> + <title><xsl:value-of select="$title"/></title> + <link href="{$csslink}" rel="Stylesheet" type="text/css" /> <!-- stylesheet link --> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> + </head> + <body lang="{$lang}"> + <xsl:apply-templates select="/helpdocument/body"/> + </body> + </html> +</xsl:template> + +<!-- AHELP --> +<xsl:template match="ahelp"> + <xsl:if test="not(@visibility='hidden')"><span class="avis"><xsl:apply-templates /></span></xsl:if> +</xsl:template> + +<!-- ALT --> +<xsl:template match="alt"/> + +<!-- BOOKMARK --> +<xsl:template match="bookmark"> + <a name="{@id}"></a> + <xsl:choose> + <xsl:when test="starts-with(@branch,'hid')" /> + <xsl:otherwise><xsl:apply-templates /></xsl:otherwise> + </xsl:choose> +</xsl:template> +<xsl:template match="bookmark" mode="embedded" /> + +<!-- BOOKMARK_VALUE --> +<xsl:template match="bookmark_value" /> + +<!-- BR --> +<xsl:template match="br"><br /></xsl:template> + +<!-- CAPTION --> +<xsl:template match="caption" /> + +<!-- CASE --> +<xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template> +<xsl:template match="case" mode="embedded"> + <xsl:call-template name="insertcase"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- CASEINLINE --> +<xsl:template match="caseinline"><xsl:call-template name="insertcase" /></xsl:template> +<xsl:template match="caseinline" mode="embedded"> + <xsl:call-template name="insertcase"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- COMMENT --> +<xsl:template match="comment" /> +<xsl:template match="comment" mode="embedded"/> + +<!-- CREATED --> +<xsl:template match="created" /> + +<!-- DEFAULT --> +<xsl:template match="default"><xsl:call-template name="insertdefault" /></xsl:template> +<xsl:template match="default" mode="embedded"> + <xsl:call-template name="insertdefault"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- DEFAULTINLINE --> +<xsl:template match="defaultinline"><xsl:call-template name="insertdefault" /></xsl:template> +<xsl:template match="defaultinline" mode="embedded"> + <xsl:call-template name="insertdefault"> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> +</xsl:template> + +<!-- EMBED --> +<xsl:template match="embed"><xsl:call-template name="resolveembed"/></xsl:template> +<xsl:template match="embed" mode="embedded"><xsl:call-template name="resolveembed"/></xsl:template> + +<!-- EMBEDVAR --> +<xsl:template match="embedvar"><xsl:call-template name="resolveembedvar"/></xsl:template> +<xsl:template match="embedvar" mode="embedded"><xsl:call-template name="resolveembedvar"/></xsl:template> + +<!-- EMPH --> +<xsl:template match="emph"> + <span class="emph"><xsl:apply-templates /></span> +</xsl:template> +<xsl:template match="emph" mode="embedded"> + <span class="emph"><xsl:apply-templates /></span> +</xsl:template> + +<!-- FILENAME --> +<xsl:template match="filename" /> + +<!-- HISTORY --> +<xsl:template match="history" /> + +<!-- IMAGE --> +<xsl:template match="image"><xsl:call-template name="insertimage"/></xsl:template> +<xsl:template match="image" mode="embedded"><xsl:call-template name="insertimage"/></xsl:template> + +<!-- ITEM --> +<xsl:template match="item"><span class="{@type}"><xsl:apply-templates /></span></xsl:template> +<xsl:template match="item" mode="embedded"><span class="{@type}"><xsl:apply-templates /></span></xsl:template> + +<!-- LASTEDITED --> +<xsl:template match="lastedited" /> + +<!-- LINK --> +<xsl:template match="link"> + <xsl:choose> <!-- don't insert the heading link to itself --> + <xsl:when test="(concat('/',@href) = /helpdocument/meta/topic/filename) or (@href = /helpdocument/meta/topic/filename)"> + <xsl:apply-templates /> + </xsl:when> + <xsl:when test="contains(child::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links --> + <xsl:call-template name="insert_howtoget"> + <xsl:with-param name="linkhref" select="@href"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="createlink" /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> +<xsl:template match="link" mode="embedded"> + <xsl:call-template name="createlink"/> +</xsl:template> + +<!-- LIST --> +<xsl:template match="list"> + <xsl:choose> + <xsl:when test="@type='ordered'"> + <ol> + <xsl:if test="@startwith"> + <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute> + </xsl:if> + <xsl:apply-templates /> + </ol> + </xsl:when> + <xsl:otherwise> + <ul><xsl:apply-templates /></ul> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="list" mode="embedded"> + <xsl:choose> + <xsl:when test="@type='ordered'"> + <ol> + <xsl:if test="@startwith"> + <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute> + </xsl:if> + <xsl:apply-templates mode="embedded"/> + </ol> + </xsl:when> + <xsl:otherwise> + <ul><xsl:apply-templates mode="embedded"/></ul> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<!-- LISTITEM --> +<xsl:template match="listitem"> + <li><xsl:apply-templates /></li> +</xsl:template> + +<xsl:template match="listitem" mode="embedded"> + <li><xsl:apply-templates mode="embedded"/></li> +</xsl:template> + +<!-- META, SEE HEADER --> +<xsl:template match="meta" /> + +<!-- OBJECT (UNUSED) --> +<xsl:template match="object" /> + +<!-- PARAGRAPH --> +<xsl:template match="paragraph"> + <xsl:choose> + + <xsl:when test="@role='heading'"> + <xsl:call-template name="insertheading"> + <xsl:with-param name="level" select="@level"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(' note warning tip ',@role)"> + <xsl:call-template name="insertnote"> + <xsl:with-param name="type" select="@role" /> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links --> + <xsl:apply-templates /> + </xsl:when> + + <xsl:otherwise> + <xsl:call-template name="insertpara" /> + </xsl:otherwise> + + </xsl:choose> +</xsl:template> + +<xsl:template match="paragraph" mode="embedded"> + <xsl:choose> + + <xsl:when test="@role='heading'"> <!-- increase the level of headings that are embedded --> + <!-- + The internal sablotron processor does not seem to support the number function. + Therefore, we need a workaround for + <xsl:variable name="level"><xsl:value-of select="number(@level)+1"/></xsl:variable> + --> + <xsl:variable name="newlevel"> + <xsl:choose> + <xsl:when test="@level='1'"><xsl:value-of select="'2'"/></xsl:when> + <xsl:when test="@level='2'"><xsl:value-of select="'2'"/></xsl:when> + <xsl:when test="@level='3'"><xsl:value-of select="'3'"/></xsl:when> + <xsl:when test="@level='4'"><xsl:value-of select="'4'"/></xsl:when> + <xsl:when test="@level='5'"><xsl:value-of select="'5'"/></xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:call-template name="insertheading"> + <xsl:with-param name="level" select="$newlevel"/> + <xsl:with-param name="embedded" select="'yes'"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(' note warning tip ',@role)"> + <xsl:call-template name="insertnote"> + <xsl:with-param name="type" select="@role" /> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links --> + <xsl:apply-templates /> + </xsl:when> + + <xsl:otherwise> + <xsl:call-template name="insertpara" /> + </xsl:otherwise> + + </xsl:choose> +</xsl:template> + + +<!-- SECTION --> +<xsl:template match="section"> + <a name="{@id}"></a> + + <xsl:choose> + + <xsl:when test="@id='relatedtopics'"> + <div class="relatedtopics"> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <p class="related"> + <xsl:apply-templates select="$doc//variable[@id=$anchor]"/> + </p> + <div class="relatedbody"> + <xsl:apply-templates /> + </div> + </div> + </xsl:when> + + <xsl:when test="@id='howtoget'"> + <xsl:call-template name="insert_howtoget" /> + </xsl:when> + + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + + </xsl:choose> + +</xsl:template> + + +<!-- SECTION --> +<xsl:template match="section" mode="embedded"> + <a name="{@id}"></a> + <xsl:apply-templates mode="embedded"/> +</xsl:template> + +<!-- SORT --> +<xsl:template match="sort" > + <!-- sorting disabled due to #i70462# + <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> + //--> + <xsl:apply-templates /> +</xsl:template> +<xsl:template match="sort" mode="embedded"> +<!-- sorting disabled due to #i70462# + <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates> + //--> + <xsl:apply-templates /> +</xsl:template> + +<!-- SWITCH --> +<xsl:template match="switch"><xsl:apply-templates /></xsl:template> +<xsl:template match="switch" mode="embedded"><xsl:apply-templates /></xsl:template> + +<!-- SWITCHINLINE --> +<xsl:template match="switchinline"><xsl:apply-templates /></xsl:template> +<xsl:template match="switchinline" mode="embedded"><xsl:apply-templates mode="embedded"/></xsl:template> + +<!-- TABLE --> +<xsl:template match="table"><xsl:call-template name="inserttable"/></xsl:template> +<xsl:template match="table" mode="embedded"><xsl:call-template name="inserttable"/></xsl:template> + +<!-- TABLECELL --> +<xsl:template match="tablecell"><td valign="top"><xsl:apply-templates /></td></xsl:template> +<xsl:template match="tablecell" mode="icontable"><td valign="top"><xsl:apply-templates/></td></xsl:template> +<xsl:template match="tablecell" mode="embedded"><td valign="top"><xsl:apply-templates mode="embedded"/></td></xsl:template> + +<!-- TABLEROW --> +<xsl:template match="tablerow"><tr><xsl:apply-templates /></tr></xsl:template> +<xsl:template match="tablerow" mode="icontable"><tr><xsl:apply-templates mode="icontable"/></tr></xsl:template> +<xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates mode="embedded"/></tr></xsl:template> + +<!-- TITLE --> +<xsl:template match="title"/> + +<!-- TOPIC --> +<xsl:template match="topic"/> + +<!-- VARIABLE --> +<xsl:template match="variable"><a name="{@id}"></a><xsl:apply-templates /></xsl:template> +<xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template> + +<xsl:template match="text()"> + <xsl:call-template name="brand"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> +</xsl:template> + +<xsl:template match="text()" mode="embedded"> + <xsl:call-template name="brand"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> +</xsl:template> + +<!-- In case of missing help files --> +<xsl:template match="help-id-missing"><xsl:value-of select="$Id"/></xsl:template> + +<!-- +################### +# NAMED TEMPLATES # +################### +//--> + +<!-- Branding --> +<xsl:template name="brand" > + <xsl:param name="string"/> + + <xsl:choose> + + <xsl:when test="contains($string,$brand1)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand1)"/> + <xsl:value-of select="$productname"/> + <xsl:value-of select="substring-after($string,$brand1)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($string,$brand2)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand2)"/> + <xsl:value-of select="$pversion"/> + <xsl:value-of select="substring-after($string,$brand2)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($string,$brand3)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand3)"/> + <xsl:value-of select="$productname"/> + <xsl:value-of select="substring-after($string,$brand3)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($string,$brand4)"> + <xsl:variable name="newstr"> + <xsl:value-of select="substring-before($string,$brand4)"/> + <xsl:value-of select="$pversion"/> + <xsl:value-of select="substring-after($string,$brand4)"/> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + + +<!-- Insert Paragraph --> +<xsl:template name="insertpara"> + <xsl:variable name="role"> + <xsl:choose> + <xsl:when test="ancestor::table"> + <xsl:value-of select="concat(@role,'intable')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@role"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <p class="{$role}"><xsl:apply-templates /></p> +</xsl:template> + +<!-- Insert "How to get Link" --> +<xsl:template name="insert_howtoget"> + <xsl:param name="linkhref" /> + <xsl:variable name="archive" select="'shared'"/> + <xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable> + <xsl:variable name="tmp_doc" select="document($tmp_href)"/> + <table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0"> + <tr> + <td> + <p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p> + <div class="howtogetbody"> + <xsl:choose> + <xsl:when test="$linkhref = ''"> <!-- new style --> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> <!-- old style --> + <xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable> + <xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable> + <xsl:variable name="docum" select="document($href)"/> + + <xsl:call-template name="insertembed"> + <xsl:with-param name="doc" select="$docum" /> + <xsl:with-param name="anchor" select="$anc" /> + </xsl:call-template> + + </xsl:otherwise> + </xsl:choose> + </div> + </td> + </tr> + </table> + <br/> +</xsl:template> + +<!-- Create a link --> +<xsl:template name="createlink"> +<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> +<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> + <xsl:choose> + <xsl:when test="starts-with(@href,'http://')"> <!-- web links --> + <a href="{@href}"><xsl:apply-templates /></a> + </xsl:when> + <xsl:when test="contains(@href,'#')"> + <xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,substring-before(@href,'#'),$linkpostfix,$dbpostfix,$anchor)"/></xsl:variable> + <a href="{$href}"><xsl:apply-templates /></a> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,@href,$linkpostfix,$dbpostfix)"/></xsl:variable> + <a href="{$href}"><xsl:apply-templates /></a> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<!-- Insert Note, Warning, or Tip --> +<xsl:template name="insertnote"> + <xsl:param name="type" /> <!-- note, tip, or warning --> + <xsl:variable name="imgsrc"> + <xsl:choose> + <xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when> + <xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when> + <xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable> + <xsl:variable name="alt"> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/',$alttext,$urlpost,$dbpostfix)"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </xsl:variable> + <div class="{$type}"> + <table border="0" class="{$type}" cellspacing="0" cellpadding="5"> + <tr> + <td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td> + <td><xsl:apply-templates /></td> + </tr> + </table> + </div> + <br/> +</xsl:template> + +<!-- Insert a heading --> +<xsl:template name="insertheading"> + <xsl:param name="level" /> + <xsl:param name="embedded" /> + <xsl:text disable-output-escaping="yes"><h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + <xsl:text disable-output-escaping="yes"></h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text> +</xsl:template> + +<!-- Evaluate a case or caseinline switch --> +<xsl:template name="insertcase"> + <xsl:param name="embedded" /> + <xsl:choose> + <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']"> + <xsl:if test="@select = $System"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']"> + <xsl:if test="@select = $appl"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']"> + <xsl:if test="@select = $distrib"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + </xsl:choose> +</xsl:template> + +<!-- Evaluate a default or defaultinline switch --> +<xsl:template name="insertdefault"> + <xsl:param name="embedded" /> + + <xsl:choose> + <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']"> + <xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']"> + <xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']"> + <xsl:if test="not(../child::case[@select=$distrib]) and not(../child::caseinline[@select=$distrib])"> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + </xsl:choose> +</xsl:template> + +<!-- evaluate embeds --> +<xsl:template name="insertembed"> + <xsl:param name="doc" /> + <xsl:param name="anchor" /> + <!-- different embed targets (also falsely used embed instead embedvar) --> + <xsl:choose> + <xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name --> + <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/> + </xsl:when> + <xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name --> + <p class="embedded"> + <xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/> + </p> + </xsl:when> + <xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name --> + <p class="embedded"> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </p> + </xsl:when> + <xsl:otherwise> <!-- then give up --> + <p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<!-- Insert an image --> +<xsl:template name="insertimage"> + + <xsl:variable name="fpath"> + <xsl:call-template name="getfpath"> + <xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="fname"> + <xsl:call-template name="getfname"> + <xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="src"> + <xsl:choose> + <xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)"> + <xsl:value-of select="concat($ExtensionPath,'/',@src)"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="(@localize='true') and not($lang='en-US')"> + <xsl:value-of select="concat($img_url_prefix,$fpath,$lang,'/',$fname)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($img_url_prefix,$fpath,$fname)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>--> + <xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable> + <xsl:variable name="width" select="''"/> <!-- Images don't all have the correct size --> + <xsl:variable name="height" select="''"/><!-- Image don't all have the correct size --> + <img src="{$src}" alt="{$alt}" title="{$alt}"> + <xsl:if test="not($width='')"><xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute></xsl:if> + <xsl:if test="not($height='')"><xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute></xsl:if> + </img> +</xsl:template> + +<!-- Insert a Table --> +<xsl:template name="inserttable"> + <xsl:variable name="imgsrc"> <!-- see if we are in an image table --> + <xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/> + </xsl:variable> + + <xsl:choose> + + <xsl:when test="count(descendant::tablecell)=1"> + <table border="0" class="onecell" cellpadding="0" cellspacing="0"> + <xsl:apply-templates /> + </table> + </xsl:when> + + <xsl:when test="descendant::tablecell[1]/descendant::image"> + <table border="0" class="icontable" cellpadding="5" cellspacing="0"> + <xsl:apply-templates mode="icontable"/> + </table> + </xsl:when> + + <xsl:when test="@class='wide'"> + <table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" > + <xsl:apply-templates /> + </table> + </xsl:when> + + <xsl:when test="not(@class='')"> + <table border="1" class="{@class}" cellpadding="0" cellspacing="0" > + <xsl:apply-templates /> + </table> + </xsl:when> + + <xsl:otherwise> + <table border="1" class="border" cellpadding="0" cellspacing="0" > + <xsl:apply-templates /> + </table> + </xsl:otherwise> + </xsl:choose> + + <br/> +</xsl:template> + +<xsl:template name="resolveembed"> + <div class="embedded"> + <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> + <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable> + <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="docum" select="document($href)"/> + + <xsl:call-template name="insertembed"> + <xsl:with-param name="doc" select="$docum" /> + <xsl:with-param name="anchor" select="$anc" /> + </xsl:call-template> + + </div> +</xsl:template> + +<xsl:template name="resolveembedvar"> + <xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links --> + <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> + <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:choose> + <xsl:when test="$doc//variable[@id=$anchor]"> <!-- test for a variable of that name --> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </xsl:when> + <xsl:otherwise> <!-- or give up --> + <span class="bug">[<xsl:value-of select="@href"/> not found].</span> + </xsl:otherwise> + </xsl:choose> + </xsl:if> +</xsl:template> + +<!-- Apply --> +<xsl:template name="apply"> + <xsl:param name="embedded" /> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="getfpath"> + <xsl:param name="s"/> + <xsl:param name="p"/> + <xsl:choose> + <xsl:when test="contains($s,'/')"> + <xsl:call-template name="getfpath"> + <xsl:with-param name="p"><xsl:value-of select="concat($p,substring-before($s,'/'),'/')"/></xsl:with-param> + <xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$p"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="getfname"> + <xsl:param name="s"/> + <xsl:choose> + <xsl:when test="contains($s,'/')"> + <xsl:call-template name="getfname"> + <xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$s"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="createDBpostfix"> + <xsl:param name="archive"/> + <xsl:variable name="newDB"> + <xsl:choose> + <xsl:when test="(substring($archive,1,6) = 'shared')"><xsl:value-of select="$Database"/></xsl:when> + <xsl:otherwise><xsl:value-of select="substring-before($archive,'/')"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat($am,'DbPAR=',$newDB)"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/xmlhelp/util/makefile.mk b/xmlhelp/util/makefile.mk index 10206670b5f8..66551f15bffc 100644 --- a/xmlhelp/util/makefile.mk +++ b/xmlhelp/util/makefile.mk @@ -74,5 +74,11 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ---------------------------------------------------------- +ZIP1TARGET=helpxsl +ZIP1FLAGS= -u -r +#ZIP1DIR=$(PRJ)$/source$/auxiliary +ZIP1LIST=main_transform*.xsl idxcaption.xsl idxcontent.xsl + + .INCLUDE: target.mk diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index f4843d54ace1..80238a075973 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3110,6 +3110,9 @@ namespace xmloff { namespace token { XML_DIAGONAL_BL_TR_WIDTHS, XML_DIAGONAL_TL_BR_WIDTHS, + XML_OUTSIDE_MINIMUM,//#i114142# + XML_OUTSIDE_MAXIMUM,//#i114142# + XML_TOKEN_END }; diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx index 0616040148b5..79a59ab6910f 100644 --- a/xmloff/source/chart/PropertyMap.hxx +++ b/xmloff/source/chart/PropertyMap.hxx @@ -223,6 +223,8 @@ SvXMLEnumMapEntry aXMLChartAxisLabelPositionEnumMap[] = { ::xmloff::token::XML_NEAR_AXIS_OTHER_SIDE, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE }, { ::xmloff::token::XML_OUTSIDE_START, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START }, { ::xmloff::token::XML_OUTSIDE_END, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END }, + { ::xmloff::token::XML_OUTSIDE_MINIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START },//#i114142# + { ::xmloff::token::XML_OUTSIDE_MAXIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END },//#i114142# { ::xmloff::token::XML_TOKEN_INVALID, 0 } }; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index c4abc4172959..e6f6fc6d9340 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1688,20 +1688,16 @@ void SchXMLExportHelper_Impl::exportTable() { mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); - // write the original range name as id into the local table - // to allow a correct re-association when copying via clipboard + exportText( *aIt ); + if( nC < nComplexCount ) + lcl_exportComplexLabel( rComplexColumnDescriptions[nC++], mrExport ); if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd ) { + // remind the original range to allow a correct re-association when copying via clipboard if ((*aColumnDescriptions_RangeIter).getLength()) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aColumnDescriptions_RangeIter); - } + SchXMLTools::exportRangeToSomewhere( mrExport, *aColumnDescriptions_RangeIter ); ++aColumnDescriptions_RangeIter; } - exportText( *aIt ); - if( nC < nComplexCount ) - lcl_exportComplexLabel( rComplexColumnDescriptions[nC++], mrExport ); } OSL_ASSERT( bHasOwnData || aColumnDescriptions_RangeIter == aColumnDescriptions_RangeEnd ); } // closing row and header-rows elements @@ -1725,17 +1721,15 @@ void SchXMLExportHelper_Impl::exportTable() SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); if( aRowDescriptionsIter != aData.aRowDescriptions.end()) { - // write the original range name as id into the local table - // to allow a correct re-association when copying via clipboard - if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd ) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aRowDescriptions_RangeIter++); - } exportText( *aRowDescriptionsIter ); ++aRowDescriptionsIter; if( nC < nComplexCount ) lcl_exportComplexLabel( rComplexRowDescriptions[nC++], mrExport ); + if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd ) + { + // remind the original range to allow a correct re-association when copying via clipboard + SchXMLTools::exportRangeToSomewhere( mrExport, *aRowDescriptions_RangeIter++ ); + } } } @@ -1748,19 +1742,15 @@ void SchXMLExportHelper_Impl::exportTable() mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT ); mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); - // write the original range name as id into the local table to - // allow a correct re-association when copying via clipboard + exportText( msString, false ); // do not convert tabs and lfs if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) && - ( mbRowSourceColumns || (aColIt == aRowIt->begin())) ) + ( mbRowSourceColumns || (aColIt == aRowIt->begin()) ) ) { + // remind the original range to allow a correct re-association when copying via clipboard if ((*aDataRangeIter).getLength()) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aDataRangeIter); - } + SchXMLTools::exportRangeToSomewhere( mrExport, *aDataRangeIter ); ++aDataRangeIter; } - exportText( msString, false ); // do not convert tabs and lfs } } } @@ -3063,6 +3053,10 @@ void SchXMLExportHelper_Impl::exportSeries( { // add style name attribute AddAutoStyleAttribute( aPropertyStates ); + + const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 ) + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149# SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True ); } else // autostyles diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index d82970858ebe..d3f0670f672d 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -34,6 +34,7 @@ #include "SchXMLImport.hxx" #include "SchXMLTools.hxx" #include "transporttypes.hxx" +#include "XMLStringBufferImportContext.hxx" #include <tools/debug.hxx> #include <rtl/math.hxx> #include "xmlnmspe.hxx" @@ -687,6 +688,35 @@ SvXMLImportContext* SchXMLTableRowContext::CreateChildContext( return pContext; } +//--------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- + +class SchXMLRangeSomewhereContext : public SvXMLImportContext +{ +//#i113950# previously the range was exported to attribute text:id, +//but that attribute does not allow arbitrary strings anymore +//so we need to find an alternative to save that range info for copy/paste scenario ... +//-> use description at an empty group element for now + +private: + ::rtl::OUString& mrRangeString; + ::rtl::OUStringBuffer maRangeStringBuffer; + +public: + SchXMLRangeSomewhereContext( SvXMLImport& rImport, + const ::rtl::OUString& rLocalName, + ::rtl::OUString& rRangeString ); + virtual ~SchXMLRangeSomewhereContext(); + + virtual SvXMLImportContext* CreateChildContext( + USHORT nPrefix, + const ::rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +//--------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- // ======================================== // classes for cells and their content @@ -778,11 +808,18 @@ SvXMLImportContext* SchXMLTableCellContext::CreateChildContext( pContext = new SchXMLTextListContext( GetImport(), rLocalName, *rCell.pComplexString ); mbReadText = sal_False;//don't apply text from <text:p> } - // <text:p> element - read text and range-id + // <text:p> element - read text (and range from text:id old version) else if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) ) { pContext = new SchXMLParagraphContext( GetImport(), rLocalName, maCellContent, &maRangeId ); } + // <draw:g> element - read range + else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_G ) ) + { + //#i113950# previously the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore + //so we need to find an alternative to save that range info for copy/paste scenario ... -> use description at an empty group element for now + pContext = new SchXMLRangeSomewhereContext( GetImport(), rLocalName, maRangeId ); + } else { pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); @@ -1148,3 +1185,34 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( } } +//--------------------------------------------------------------------------------------------------- + +SchXMLRangeSomewhereContext::SchXMLRangeSomewhereContext( SvXMLImport& rImport, + const OUString& rLocalName, + OUString& rRangeString ) : + SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ), + mrRangeString( rRangeString ) +{ +} + +SchXMLRangeSomewhereContext::~SchXMLRangeSomewhereContext() +{ +} + +SvXMLImportContext* SchXMLRangeSomewhereContext::CreateChildContext( + USHORT nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList >& ) +{ + if( XML_NAMESPACE_SVG == nPrefix && IsXMLToken( rLocalName, XML_DESC ) ) + { + return new XMLStringBufferImportContext( + GetImport(), nPrefix, rLocalName, maRangeStringBuffer ); + } + return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); +} + +void SchXMLRangeSomewhereContext::EndElement() +{ + mrRangeString = maRangeStringBuffer.makeStringAndClear(); +} diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 582e5aead326..b2a90e534771 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -600,6 +600,29 @@ void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsL } } +void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue ) +{ + //with issue #i366# and CWS chart20 ranges for error bars were introduced + //to keep them during copy paste from calc to impress for example it + //was necessary to introduce a mapping between the used ranges within calc and the data written to the local table + //this is why we write this ranges here + + //#i113950# first the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore within ODF 1.2 + //as an alternative the range info is now saved into the description at an empty group element (not very nice, but ODF conform) + + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion == SvtSaveOptions::ODFVER_010 || nCurrentODFVersion == SvtSaveOptions::ODFVER_011 ) + return;//svg:desc is not allowed at draw:g in ODF1.0; but as the ranges for error bars are anyhow not allowed within ODF1.0 nor ODF1.1 we do not need the information + + SvXMLElementExport aEmptyShapeGroup( rExport, XML_NAMESPACE_DRAW, + ::xmloff::token::GetXMLToken( ::xmloff::token::XML_G ), + sal_True, sal_False ); + SvXMLElementExport aDescription( rExport, XML_NAMESPACE_SVG, + ::xmloff::token::GetXMLToken( ::xmloff::token::XML_DESC ), + sal_True, sal_False ); + rExport.GetDocHandler()->characters( rValue ); +} + Reference< chart2::XRegressionCurve > getRegressionCurve( const Reference< chart2::XDataSeries > & xDataSeries ) { diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index bcc39ae3d114..d8841bf3861b 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -105,6 +105,8 @@ namespace SchXMLTools void exportText( SvXMLExport& rExport, const ::rtl::OUString& rText, bool bConvertTabsLFs ); + void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue ); + /** returns the properties of the equation of the first regression curve that is no mean-value line */ diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index a3d4a0c48d02..d65bafe583df 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3082,8 +3082,8 @@ namespace xmloff { namespace token { TOKEN( "axis-label-position", XML_AXIS_LABEL_POSITION ), TOKEN( "near-axis", XML_NEAR_AXIS ), TOKEN( "near-axis-other-side", XML_NEAR_AXIS_OTHER_SIDE ), - TOKEN( "outside-minimum", XML_OUTSIDE_START ), - TOKEN( "outside-maximum", XML_OUTSIDE_END ), + TOKEN( "outside-start", XML_OUTSIDE_START ), + TOKEN( "outside-end", XML_OUTSIDE_END ), TOKEN( "tick-mark-position", XML_TICK_MARK_POSITION ), TOKEN( "at-labels", XML_AT_LABELS ), TOKEN( "at-axis", XML_AT_AXIS ), @@ -3110,6 +3110,9 @@ namespace xmloff { namespace token { TOKEN( "diagonal-bl-tr-widths", XML_DIAGONAL_BL_TR_WIDTHS ), TOKEN( "diagonal-tl-br-widths", XML_DIAGONAL_TL_BR_WIDTHS ), + TOKEN( "outside-minimum", XML_OUTSIDE_MINIMUM ), + TOKEN( "outside-maximum", XML_OUTSIDE_MAXIMUM ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index b073e1e28d40..a26806ce6c24 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -1926,7 +1926,35 @@ void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XA SetLayer(); if ( maPath.hasValue() ) - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath ); + { + // --> OD #i115492# + // Ignore svg:d attribute for text documents created by OpenOffice.org + // versions before OOo 3.3, because these OOo versions are storing + // svg:d values not using the correct unit. + bool bApplySVGD( true ); + if ( uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() ) + { + sal_Int32 nUPD( 0 ); + sal_Int32 nBuild( 0 ); + const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild ); + if ( GetImport().IsTextDocInOOoFileFormat() || + ( bBuildIdFound && + ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0 + ( nUPD == 680 ) || // OOo 2.x + ( nUPD == 300 ) || // OOo 3.0 - OOo 3.0.1 + ( nUPD == 310 ) || // OOo 3.1 - OOo 3.1.1 + ( nUPD == 320 ) ) ) ) // OOo 3.2 - OOo 3.2.1 + { + bApplySVGD = false; + } + } + + if ( bApplySVGD ) + { + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath ); + } + // <-- + } SdXMLShapeContext::StartElement(xAttrList); } |