diff options
author | obo <obo@openoffice.org> | 2010-06-15 10:26:12 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-15 10:26:12 +0200 |
commit | b2bc2f73cf3c616cd4e2e9cc2406d7cffe41c749 (patch) | |
tree | c77b1ba4dcfb9ac2e4a3fb863e51278a33fc5b11 | |
parent | 798e415c982fa6e449493ff7679896897c7f597d (diff) | |
parent | 0fa91aa2d58df7388d674a3a781b4506d4b27895 (diff) |
CWS-TOOLING: integrate CWS fwk139
32 files changed, 617 insertions, 431 deletions
diff --git a/avmedia/source/framework/makefile.mk b/avmedia/source/framework/makefile.mk index 34669d3e9f..4185f3cbfc 100644 --- a/avmedia/source/framework/makefile.mk +++ b/avmedia/source/framework/makefile.mk @@ -50,6 +50,7 @@ SLOFILES= \ $(SLO)$/soundhandler.obj EXCEPTIONSFILES = \ + $(SLO)$/mediatoolbox.obj \ $(SLO)$/soundhandler.obj # --- Targets ---------------------------------- diff --git a/desktop/source/deployment/dp_xml.cxx b/desktop/source/deployment/dp_xml.cxx index a935ca1113..a4d4de1873 100644 --- a/desktop/source/deployment/dp_xml.cxx +++ b/desktop/source/deployment/dp_xml.cxx @@ -44,6 +44,20 @@ namespace dp_misc //============================================================================== void xml_parse( + Reference<xml::input::XRoot> const & xRoot, + ::ucbhelper::Content & ucb_content, + Reference<XComponentContext> const & xContext ) +{ + const Any arg(xRoot); + const Reference<xml::sax::XDocumentHandler> xDocHandler( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + OUSTR("com.sun.star.xml.input.SaxDocumentHandler"), + Sequence<Any>( &arg, 1 ), xContext ), UNO_QUERY_THROW ); + xml_parse( xDocHandler, ucb_content, xContext ); + } + +//============================================================================== +void xml_parse( Reference<xml::sax::XDocumentHandler> const & xDocHandler, ::ucbhelper::Content & ucb_content, Reference<XComponentContext> const & xContext ) @@ -61,199 +75,4 @@ void xml_parse( xParser->parseStream( source ); } -//============================================================================== -void xml_parse( - Reference<xml::input::XRoot> const & xRoot, - ::ucbhelper::Content & ucb_content, - Reference<XComponentContext> const & xContext ) -{ - const Any arg(xRoot); - const Reference<xml::sax::XDocumentHandler> xDocHandler( - xContext->getServiceManager()->createInstanceWithArgumentsAndContext( - OUSTR("com.sun.star.xml.input.SaxDocumentHandler"), - Sequence<Any>( &arg, 1 ), xContext ), UNO_QUERY_THROW ); - xml_parse( xDocHandler, ucb_content, xContext ); -} - -//############################################################################## - -//______________________________________________________________________________ -XmlRootElement::XmlRootElement( - OUString const & uri, OUString const & localname ) - : m_uri( uri ) -{ - m_localname = localname; -} - -//______________________________________________________________________________ -XmlRootElement::~XmlRootElement() -{ -} - -// XRoot -//______________________________________________________________________________ -void XmlRootElement::startDocument( - Reference<xml::input::XNamespaceMapping> const & xMapping ) - throw (xml::sax::SAXException, RuntimeException) -{ - m_xNamespaceMapping = xMapping; - - try { - m_uid = m_xNamespaceMapping->getUidByUri( m_uri ); - } - catch (container::NoSuchElementException & exc) { - throw xml::sax::SAXException( - exc.Message, static_cast<OWeakObject *>(this), Any(exc) ); - } -} - -//______________________________________________________________________________ -void XmlRootElement::endDocument() - throw (xml::sax::SAXException, RuntimeException) -{ -} - -//______________________________________________________________________________ -void XmlRootElement::processingInstruction( - OUString const &, OUString const & ) - throw (xml::sax::SAXException, RuntimeException) -{ -} - -//______________________________________________________________________________ -void XmlRootElement::setDocumentLocator( - Reference<xml::sax::XLocator> const & ) - throw (xml::sax::SAXException, RuntimeException) -{ -} - -//______________________________________________________________________________ -Reference<xml::input::XElement> XmlRootElement::startRootElement( - sal_Int32 uid, OUString const & localname, - Reference<xml::input::XAttributes> const & xAttributes ) - throw (xml::sax::SAXException, RuntimeException) -{ - check_xmlns( uid ); - if (! localname.equals( m_localname )) { - throw xml::sax::SAXException( - OUSTR("unexpected root element ") + localname, - static_cast<OWeakObject *>(this), Any() ); - } - m_xAttributes = xAttributes; - - return this; -} - -//############################################################################## - -//______________________________________________________________________________ -XmlElement::~XmlElement() -{ -} - -//______________________________________________________________________________ -void XmlElement::check_xmlns( sal_Int32 uid ) const - throw (xml::sax::SAXException) -{ - if (uid != m_uid) - { - ::rtl::OUStringBuffer buf; - buf.appendAscii( - RTL_CONSTASCII_STRINGPARAM("illegal xml namespace uri=\"") ); - try { - buf.append( m_xNamespaceMapping->getUriByUid( uid ) ); - } - catch (container::NoSuchElementException & exc) { - throw xml::sax::SAXException( - exc.Message, static_cast<OWeakObject *>( - const_cast<XmlElement *>(this) ), Any(exc) ); - } - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\"!") ); - throw xml::sax::SAXException( - buf.makeStringAndClear(), - static_cast<OWeakObject *>( const_cast<XmlElement *>(this) ), - Any() ); - } -} - -// XElement -//______________________________________________________________________________ -Reference<xml::input::XElement> XmlElement::getParent() - throw (RuntimeException) -{ - return m_xParent; -} - -//______________________________________________________________________________ -OUString XmlElement::getLocalName() - throw (RuntimeException) -{ - return m_localname; -} - -//______________________________________________________________________________ -sal_Int32 XmlElement::getUid() - throw (RuntimeException) -{ - return m_uid; -} - -//______________________________________________________________________________ -Reference<xml::input::XAttributes> XmlElement::getAttributes() - throw (RuntimeException) -{ - return m_xAttributes; -} - -//______________________________________________________________________________ -void XmlElement::ignorableWhitespace( - OUString const & ) - throw (xml::sax::SAXException, RuntimeException) -{ -} - -//______________________________________________________________________________ -void XmlElement::characters( OUString const & chars ) - throw (xml::sax::SAXException, RuntimeException) -{ - m_characters += chars; -} - -//______________________________________________________________________________ -void XmlElement::processingInstruction( - OUString const &, OUString const & ) - throw (xml::sax::SAXException, RuntimeException) -{ -} - -//______________________________________________________________________________ -void XmlElement::endElement() - throw (xml::sax::SAXException, RuntimeException) -{ - m_got_endElement = true; -} - -//______________________________________________________________________________ -Reference<xml::input::XElement> XmlElement::startChildElement( - sal_Int32 uid, OUString const & localName, - Reference<xml::input::XAttributes> const & ) - throw (xml::sax::SAXException, RuntimeException) -{ - ::rtl::OUStringBuffer buf; - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("unexpected element " - "{ tag=\"") ); - buf.append( localName ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\", uri=\"") ); - try { - buf.append( m_xNamespaceMapping->getUriByUid( uid ) ); - } - catch (container::NoSuchElementException & exc) { - throw xml::sax::SAXException( - exc.Message, static_cast<OWeakObject *>(this), Any(exc) ); - } - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" }!") ); - throw xml::sax::SAXException( - buf.makeStringAndClear(), static_cast<OWeakObject *>(this), Any() ); -} - } diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx index 80c46df937..5d8356e85c 100644 --- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx +++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx @@ -216,16 +216,6 @@ public: */ ::rtl::OUString getIconURL( sal_Bool bHighContrast ) const; - /** - Allow direct access to the XPath functionality. - - @return - direct access to the XPath functionality; null iff this instance was - constructed with a null <code>element</code> - */ - ::com::sun::star::uno::Reference< ::com::sun::star::xml::xpath::XXPathAPI > - getXpath() const; - private: SAL_DLLPRIVATE ::boost::optional< ::rtl::OUString > getOptionalValue( ::rtl::OUString const & expression) const; diff --git a/desktop/source/deployment/inc/dp_xml.h b/desktop/source/deployment/inc/dp_xml.h index cc2a847082..cad9e91bb5 100644 --- a/desktop/source/deployment/inc/dp_xml.h +++ b/desktop/source/deployment/inc/dp_xml.h @@ -52,110 +52,6 @@ void xml_parse( ::ucbhelper::Content & ucb_content, css::uno::Reference< css::uno::XComponentContext > const & xContext ); -//============================================================================== -void xml_parse( - css::uno::Reference< css::xml::input::XRoot > const & xRoot, - ::ucbhelper::Content & ucb_content, - css::uno::Reference< css::uno::XComponentContext > const & xContext ); - -//============================================================================== -class XmlElement : public ::cppu::WeakImplHelper1< css::xml::input::XElement > -{ -protected: - css::uno::Reference<css::xml::input::XNamespaceMapping> m_xNamespaceMapping; - const css::uno::Reference<css::xml::input::XElement> m_xParent; - sal_Int32 m_uid; - ::rtl::OUString m_localname; - css::uno::Reference<css::xml::input::XAttributes> m_xAttributes; - ::rtl::OUString m_characters; - bool m_got_endElement; - - void check_xmlns( sal_Int32 uid ) const throw (css::xml::sax::SAXException); - - inline XmlElement() - : m_uid( -1 ), - m_got_endElement( false ) - {} - virtual ~XmlElement(); -public: - inline bool isParsed() const { return m_got_endElement; } - - inline XmlElement( - css::uno::Reference<css::xml::input::XNamespaceMapping> - const & xMapping, - css::uno::Reference<css::xml::input::XElement> const & xParent, - sal_Int32 uid, ::rtl::OUString const & localname, - css::uno::Reference< css::xml::input::XAttributes > - const & xAttributes ) - : m_xNamespaceMapping( xMapping ), - m_xParent( xParent ), - m_uid( uid ), - m_localname( localname ), - m_xAttributes( xAttributes ), - m_got_endElement( false ) - {} - - // XElement - virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL - getParent() throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getLocalName() - throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getUid() - throw (css::uno::RuntimeException); - virtual css::uno::Reference<css::xml::input::XAttributes> SAL_CALL - getAttributes() throw (css::uno::RuntimeException); - virtual void SAL_CALL ignorableWhitespace( - ::rtl::OUString const & rWhitespaces ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual void SAL_CALL characters( ::rtl::OUString const & rChars ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual void SAL_CALL processingInstruction( - ::rtl::OUString const & Target, ::rtl::OUString const & Data ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual void SAL_CALL endElement() - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL - startChildElement( - sal_Int32 nUid, ::rtl::OUString const & rLocalName, - css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); -}; - -//============================================================================== -class XmlRootElement : public ::cppu::ImplInheritanceHelper1< - XmlElement, css::xml::input::XRoot > -{ - const ::rtl::OUString m_uri; - -protected: - virtual ~XmlRootElement(); -public: - inline ::rtl::OUString const & getUri() const - { return m_uri; } - - XmlRootElement( - ::rtl::OUString const & uri, ::rtl::OUString const & localname ); - - // XRoot - virtual void SAL_CALL startDocument( - css::uno::Reference<css::xml::input::XNamespaceMapping> - const & xMapping ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual void SAL_CALL endDocument() - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual void SAL_CALL processingInstruction( - ::rtl::OUString const & target, ::rtl::OUString const & data ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual void SAL_CALL setDocumentLocator( - css::uno::Reference<css::xml::sax::XLocator> const & xLocator ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); - virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL - startRootElement( - sal_Int32 uid, ::rtl::OUString const & localname, - css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) - throw (css::xml::sax::SAXException, css::uno::RuntimeException); -}; - } #endif diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 73df2b0168..58e17a017b 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -264,12 +264,6 @@ DescriptionInfoset::getUpdateDownloadUrls() const ::boost::optional< ::rtl::OUString >(); } -css::uno::Reference< css::xml::xpath::XXPathAPI > DescriptionInfoset::getXpath() - const -{ - return m_xpath; -} - ::boost::optional< ::rtl::OUString > DescriptionInfoset::getOptionalValue( ::rtl::OUString const & expression) const { diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 07e971b033..23f7cf019e 100755..100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -139,17 +139,7 @@ OO3ExtensionMigration::~OO3ExtensionMigration() } } -void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< deployment::XPackage > & xPkg) -{ - const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); - if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) - { - xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - } -} - - void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) +void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) { osl::Directory aScanRootDir( sSourceDir ); osl::FileStatus fs(FileStatusMask_Type | FileStatusMask_FileURL); @@ -382,35 +372,6 @@ bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir return false; } -bool OO3ExtensionMigration::copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) -{ - bool bRet = false; - - INetURLObject aSourceObj( sSourceDir ); - INetURLObject aDestObj( sTargetDir ); - String aName = aDestObj.getName(); - aDestObj.removeSegment(); - aDestObj.setFinalSlash(); - - try - { - ::ucbhelper::Content aDestPath( aDestObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); - uno::Reference< ucb::XCommandInfo > xInfo = aDestPath.getCommands(); - ::rtl::OUString aTransferName = ::rtl::OUString::createFromAscii( "transfer" ); - if ( xInfo->hasCommandByName( aTransferName ) ) - { - aDestPath.executeCommand( aTransferName, uno::makeAny( - ucb::TransferInfo( sal_False, aSourceObj.GetMainURL( INetURLObject::NO_DECODE ), aName, ucb::NameClash::OVERWRITE ) ) ); - bRet = true; - } - } - catch( uno::Exception& ) - { - } - - return bRet; -} - // ----------------------------------------------------------------------------- // XServiceInfo @@ -496,32 +457,6 @@ TStringVectorPtr getContent( const ::rtl::OUString& rBaseURL ) return aResult; } -// ----------------------------------------------------------------------------- -// XJob -// ----------------------------------------------------------------------------- - -void OO3ExtensionMigration::copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) -{ - ::rtl::OUString sEx1( m_sSourceDir ); - sEx1 += sExcludeDir1; - ::rtl::OUString sEx2( m_sSourceDir ); - sEx2 += sExcludeDir2; - - TStringVectorPtr aList = getContent( sSourceDir ); - TStringVector::const_iterator aI = aList->begin(); - while ( aI != aList->end() ) - { - ::rtl::OUString sSourceLocalName = aI->copy( sSourceDir.getLength() ); - ::rtl::OUString aTemp = aI->copy( m_sSourceDir.getLength() ); - if ( aTemp != sExcludeDir1 && aTemp != sExcludeDir2 ) - { - ::rtl::OUString sTargetName = sTargetDir + sSourceLocalName; - copy( (*aI), sTargetName ); - } - ++aI; - } -} - Any OO3ExtensionMigration::execute( const Sequence< beans::NamedValue >& ) throw (lang::IllegalArgumentException, Exception, RuntimeException) { @@ -559,12 +494,6 @@ TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() { } -TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( - uno::Reference< task::XInteractionHandler> const & handler) - : m_forwardHandler(handler) -{ -} - TmpRepositoryCommandEnv::~TmpRepositoryCommandEnv() { } diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index 4a2b389310..30dee04178 100755..100644 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -97,16 +97,10 @@ namespace migration }; ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); - void copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); - bool copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); ScanResult scanExtensionFolder( const ::rtl::OUString& sExtFolder ); void scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ); bool scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlFilePath ); bool migrateExtension( const ::rtl::OUString& sSourceDir ); - /* fills m_scriptElements and m_dialogElements - */ - void registerConfigurationPackage( - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); public: OO3ExtensionMigration(::com::sun::star::uno::Reference< @@ -142,8 +136,6 @@ namespace migration public: virtual ~TmpRepositoryCommandEnv(); TmpRepositoryCommandEnv(); - TmpRepositoryCommandEnv( - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> const & handler); // XCommandEnvironment virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL diff --git a/desktop/source/migration/wizard.cxx b/desktop/source/migration/wizard.cxx index 64b135d87f..5b5f0a260d 100644 --- a/desktop/source/migration/wizard.cxx +++ b/desktop/source/migration/wizard.cxx @@ -219,11 +219,6 @@ FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAccep defaultButton(WZB_NEXT); } -void FirstStartWizard::EnableButtonsWhileMigration() -{ - enableButtons(0xff, sal_True); -} - void FirstStartWizard::DisableButtonsWhileMigration() { enableButtons(0xff, sal_False); diff --git a/desktop/source/migration/wizard.hxx b/desktop/source/migration/wizard.hxx index 9f26a8b4f2..0b546acec1 100644 --- a/desktop/source/migration/wizard.hxx +++ b/desktop/source/migration/wizard.hxx @@ -62,7 +62,6 @@ public: virtual short Execute(); virtual long PreNotify( NotifyEvent& rNEvt ); - void EnableButtonsWhileMigration(); void DisableButtonsWhileMigration(); private: diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx index 7dd81f3f17..106e1cc6a5 100644 --- a/embeddedobj/source/inc/oleembobj.hxx +++ b/embeddedobj/source/inc/oleembobj.hxx @@ -186,6 +186,8 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper5 ::rtl::OUString m_aTempURL; + ::rtl::OUString m_aTempDumpURL; + // STAMPIT solution // the following member is used during verb execution to detect whether the verb execution modifies the object VerbExecutionController m_aVerbExecutionController; diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index e1bf2754b6..c3dfd00271 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -46,10 +46,16 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <rtl/logfile.hxx> #include <cppuhelper/interfacecontainer.h> #include <comphelper/mimeconfighelper.hxx> +#include <comphelper/storagehelper.hxx> #include <targetstatecontrol.hxx> @@ -674,6 +680,85 @@ sal_Int32 SAL_CALL OleEmbeddedObject::getCurrentState() return m_nObjectState; } +namespace +{ + bool lcl_CopyStream(uno::Reference<io::XInputStream> xIn, uno::Reference<io::XOutputStream> xOut) + { + const sal_Int32 nChunkSize = 4096; + uno::Sequence< sal_Int8 > aData(nChunkSize); + sal_Int32 nTotalRead = 0; + sal_Int32 nRead; + do + { + nRead = xIn->readBytes(aData, nChunkSize); + nTotalRead += nRead; + xOut->writeBytes(aData); + } while (nRead == nChunkSize); + return nTotalRead != 0; + } + + //Dump the objects content to a tempfile, just the "CONTENTS" stream if + //there is one for non-compound documents, otherwise the whole content. + // + //On success a file is returned which must be removed by the caller + rtl::OUString lcl_ExtractObject(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory, + ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xObjectStream) + { + rtl::OUString sUrl; + + // the solution is only active for Unix systems +#ifndef WNT + uno::Reference <beans::XPropertySet> xNativeTempFile( + xFactory->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), uno::UNO_QUERY_THROW); + uno::Reference < io::XStream > xStream(xNativeTempFile, uno::UNO_QUERY_THROW); + + uno::Sequence< uno::Any > aArgs( 2 ); + aArgs[0] <<= xObjectStream; + aArgs[1] <<= (sal_Bool)sal_True; // do not create copy + uno::Reference< container::XNameContainer > xNameContainer( + xFactory->createInstanceWithArguments( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.OLESimpleStorage")), + aArgs ), uno::UNO_QUERY_THROW ); + + uno::Reference< io::XStream > xCONTENTS; + xNameContainer->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONTENTS"))) >>= xCONTENTS; + + sal_Bool bCopied = xCONTENTS.is() && lcl_CopyStream(xCONTENTS->getInputStream(), xStream->getOutputStream()); + + uno::Reference< io::XSeekable > xSeekableStor(xObjectStream, uno::UNO_QUERY); + if (xSeekableStor.is()) + xSeekableStor->seek(0); + + if (!bCopied) + bCopied = lcl_CopyStream(xObjectStream->getInputStream(), xStream->getOutputStream()); + + if (bCopied) + { + xNativeTempFile->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveFile")), + uno::makeAny(sal_False)); + uno::Any aUrl = xNativeTempFile->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri"))); + aUrl >>= sUrl; + + xNativeTempFile = uno::Reference<beans::XPropertySet>(); + + uno::Reference<ucb::XSimpleFileAccess> xSimpleFileAccess( + xFactory->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), + uno::UNO_QUERY_THROW); + + xSimpleFileAccess->setReadOnly(sUrl, sal_True); + } + else + { + xNativeTempFile->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveFile")), + uno::makeAny(sal_True)); + } +#endif + return sUrl; + } +} + //---------------------------------------------- void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) throw ( lang::IllegalArgumentException, @@ -789,10 +874,28 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) } if ( !m_pOwnView || !m_pOwnView->Open() ) - throw embed::UnreachableStateException(); + { + //Make a RO copy and see if the OS can find something to at + //least display the content for us + if (!m_aTempDumpURL.getLength()) + m_aTempDumpURL = lcl_ExtractObject(m_xFactory, m_xObjectStream); + + if (m_aTempDumpURL.getLength()) + { + uno::Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( m_xFactory->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))), + uno::UNO_QUERY_THROW); + xSystemShellExecute->execute(m_aTempDumpURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS); + } + else + throw embed::UnreachableStateException(); + } } else + { + throw embed::UnreachableStateException(); + } } } diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index 7db1a22003..abb47f2a26 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -158,6 +158,9 @@ OleEmbeddedObject::~OleEmbeddedObject() if ( m_aTempURL.getLength() ) KillFile_Impl( m_aTempURL, m_xFactory ); + + if ( m_aTempDumpURL.getLength() ) + KillFile_Impl( m_aTempDumpURL, m_xFactory ); } //------------------------------------------------------ diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index 63663e5690..85ed7795b9 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -147,6 +147,7 @@ VistaFilePickerImpl::VistaFilePickerImpl() , m_lLastFiles () , m_iEventHandler(new VistaFilePickerEventHandler(this)) , m_bInExecute (sal_False) + , m_bWasExecuted (sal_False) , m_sDirectory () , m_sFilename () { @@ -851,6 +852,8 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest) // tasks must be done differently .-) (e.g. see impl_sta_getSelectedFiles()) m_bInExecute = sal_True; + m_bWasExecuted = sal_True; + aLock.clear(); // <- SYNCHRONIZED @@ -1092,6 +1095,7 @@ void VistaFilePickerImpl::impl_sta_GetControlValue(const RequestRef& rRequest) return; css::uno::Any aValue; + if( m_bWasExecuted ) switch (nId) { case css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD : diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx index f3be49c39e..5fe5ac8445 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx @@ -329,6 +329,8 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex /// @todo document me ::sal_Bool m_bInExecute; + ::sal_Bool m_bWasExecuted; + // handle to parent window HWND m_hParentWindow; diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx index a3c5945626..f42284702d 100644 --- a/framework/inc/classes/menumanager.hxx +++ b/framework/inc/classes/menumanager.hxx @@ -82,13 +82,14 @@ class MenuManager : public ThreadHelpBase , Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren ); - +#if 0 MenuManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, REFERENCE< XFRAME >& rFrame, AddonMenu* pAddonMenu, sal_Bool bDelete, sal_Bool bDeleteChildren ); +#endif virtual ~MenuManager(); diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index a4485da237..0c3448d482 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -60,6 +60,9 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/ui/XAcceleratorConfiguration.hpp> +//shizhoubo +#include <com/sun/star/frame/XToolbarController.hpp> +//end //_________________________________________________________________________________________________________________ // other includes //_________________________________________________________________________________________________________________ @@ -185,6 +188,9 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetPropsForCommand( const ::rtl::OUString& rCmdURL ); void CreateControllers(); void UpdateControllers(); + //for update controller via Support Visiable by shizhoubo + void UpdateController( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarController > xController); + //end void AddFrameActionListener(); void AddImageOrientationListener(); void UpdateImageOrientation(); diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx index 4b7c702906..825a4b278c 100644 --- a/framework/source/classes/menumanager.cxx +++ b/framework/source/classes/menumanager.cxx @@ -357,6 +357,7 @@ MenuManager::MenuManager( SetHdl(); } +#if 0 // #110897# MenuManager::MenuManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, @@ -413,6 +414,7 @@ MenuManager::MenuManager( SetHdl(); } +#endif void MenuManager::SetHdl() { diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 1b619e637c..cbdf12fe16 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -855,6 +855,7 @@ void PathSettings::impl_setPathValue( sal_Int32 nID , ::rtl::OUString sVal; aVal >>= sVal; OUStringList lList = impl_convertOldStyle2Path(sVal); + impl_subst(lList, fa_getSubstitution(), sal_False); impl_purgeKnownPaths(aChangePath, lList); if (! impl_isValidPath(lList)) throw css::lang::IllegalArgumentException(); diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index c39b5a231b..7c82e2e825 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -92,6 +92,9 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo resetPopupMenu( rPopupMenu ); if ( pVCLPopupMenu ) pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu(); + + if (!pPopupMenu) + return; // insert basic String aCommand = String::CreateFromAscii( ".uno:MacroDialog" ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index a804d9270b..e4cb7fd3ed 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -517,7 +517,47 @@ void ToolBarManager::UpdateControllers() } m_bUpdateControllers = sal_False; } +//for update toolbar controller via Support Visible by shizhoubo +void ToolBarManager::UpdateController( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarController > xController) +{ + RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::UpdateControllers" ); + + if ( !m_bUpdateControllers ) + { + m_bUpdateControllers = sal_True; + try + { if(xController.is()) + { + Reference< XUpdatable > xUpdatable( xController, UNO_QUERY ); + if ( xUpdatable.is() ) + xUpdatable->update(); + } + } + catch ( Exception& ) + { + } + + /* m_bUpdateControllers = sal_True; + ToolBarControllerMap::iterator pIter = m_aControllerMap.begin(); + + while ( pIter != m_aControllerMap.end() ) + { + try + { + Reference< XUpdatable > xUpdatable( pIter->second, UNO_QUERY ); + if ( xUpdatable.is() ) + xUpdatable->update(); + } + catch ( Exception& ) + { + } + ++pIter; + }*/ + } + m_bUpdateControllers = sal_False; +} +//end void ToolBarManager::frameAction( const FrameActionEvent& Action ) throw ( RuntimeException ) { @@ -1072,6 +1112,19 @@ void ToolBarManager::CreateControllers() Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); xInit->initialize( aArgs ); + //for Support Visiblitly by shizhoubo + if (pController) + { + // rtl::OUString aCommandURL = pController->m_aCommandURL; + if(aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SwitchXFormsDesignMode" )) || + aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ViewDataSourceBrowser" )) || + aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ParaLeftToRight" )) || + aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ParaRightToLeft" )) + ) + pController->setFastPropertyValue_NoBroadcast(1,makeAny(sal_True)); + } + + //end } // Request a item window from the toolbar controller and set it at the VCL toolbar @@ -1092,6 +1145,31 @@ void ToolBarManager::CreateControllers() } } } + //for update Controller via support visiable state by shizhoubo + Reference< XPropertySet > xPropSet( xController, UNO_QUERY ); + if ( xPropSet.is() ) + { + try + { + sal_Bool bSupportVisiable = sal_True; + Any a( xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" ))) ); + a >>= bSupportVisiable; + if ( bSupportVisiable ) + { + Reference< XToolbarController > xTbxController( xController, UNO_QUERY ); + UpdateController(xTbxController); + } + } + catch ( RuntimeException& ) + { + throw; + } + catch ( Exception& ) + { + } + } + //end + } AddFrameActionListener(); diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index bf330268cd..8e18ca575c 100755..100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -90,6 +90,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >scalc</value> </prop> @@ -131,6 +134,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >sdraw</value> </prop> @@ -172,6 +178,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >simpress</value> </prop> @@ -211,6 +220,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >smath</value> </prop> @@ -250,6 +262,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >sglobal</value> </prop> @@ -291,6 +306,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >swriter</value> </prop> @@ -438,6 +456,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >sweb</value> </prop> @@ -690,6 +711,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >schart</value> </prop> @@ -729,6 +753,9 @@ <prop oor:name="ooSetupFactoryTemplateFile"> <value ></value> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged"> + <value >false</value> + </prop> <prop oor:name="ooSetupFactoryShortName"> <value >dbapp</value> </prop> diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs index b6c86b2300..76c4bb1778 100644 --- a/officecfg/registry/schema/org/openoffice/Setup.xcs +++ b/officecfg/registry/schema/org/openoffice/Setup.xcs @@ -155,6 +155,12 @@ <desc>Specifies the name of the standard template file for the factory.</desc> </info> </prop> + <prop oor:name="ooSetupFactorySystemDefaultTemplateChanged" oor:type="xs:boolean"> + <!-- UIHints: setup --> + <info> + <desc>Indicates if the system default template has been changed.</desc> + </info> + </prop> <prop oor:name="ooSetupFactoryWindowAttributes" oor:type="xs:string"> <!-- UIHints: setup --> <info> diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index 87fa15db4d..fe2667d128 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -101,6 +101,7 @@ public: const SfxFilter* GetTemplateFilter() const; static String GetStandardTemplate( const String& rServiceName ); static void SetStandardTemplate( const String& rServiceName, const String& rTemplateName ); + static void SetSystemTemplate( const String& rServiceName, const String& rTemplateName ); void SetDocumentServiceName( const rtl::OUString& rServiceName ); const rtl::OUString& GetDocumentServiceName() const; diff --git a/sfx2/inc/sfx2/tbxctrl.hxx b/sfx2/inc/sfx2/tbxctrl.hxx index 600b051170..8bd07c4f9d 100644 --- a/sfx2/inc/sfx2/tbxctrl.hxx +++ b/sfx2/inc/sfx2/tbxctrl.hxx @@ -243,6 +243,7 @@ protected: virtual void SAL_CALL release() throw(); // XEventListener + using ::cppu::OPropertySetHelper::disposing; virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException ); // XComponent diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 2dc396956a..409e29c1e4 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -33,6 +33,7 @@ #include <vcl/svapp.hxx> #include <sfx2/filedlghelper.hxx> #include <unotools/localedatawrapper.hxx> +#include <unotools/cmdoptions.hxx> #include <comphelper/processfactory.hxx> #include <svl/urihelper.hxx> #include <unotools/useroptions.hxx> @@ -119,6 +120,8 @@ const USHORT HI_TYPE = 2; const USHORT HI_VALUE = 3; const USHORT HI_ACTION = 4; +static const char DOCUMENT_SIGNATURE_MENU_CMD[] = "Signature"; + //------------------------------------------------------------------------ String CreateSizeText( ULONG nSize, BOOL bExtraBytes = TRUE, BOOL bSmartExtraBytes = FALSE ); String CreateSizeText( ULONG nSize, BOOL bExtraBytes, BOOL bSmartExtraBytes ) @@ -858,6 +861,13 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet ) aNewSize.Width() -= nDelta; aUseUserDataCB.SetSizePixel( aNewSize ); } + // See i96288 + // Check if the document signature command is enabled + // on the main list enable/disable the pushbutton accordingly + SvtCommandOptions aCmdOptions; + if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( DOCUMENT_SIGNATURE_MENU_CMD ) ) ) ) + aSignatureBtn.Disable(); } //------------------------------------------------------------------------ diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 5ca70ef53e..3167c13ccd 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -57,6 +57,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/types.hxx> #include <comphelper/sequenceashashmap.hxx> +#include <comphelper/stillreadwriteinteraction.hxx> #include <tools/urlobj.hxx> #include <vcl/help.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -542,33 +543,13 @@ void FileDialogHelper_Impl::updateExportButton() // ------------------------------------------------------------------------ void FileDialogHelper_Impl::updateSelectionBox() { - if ( !mbExport ) + if ( !mbHasSelectionBox ) return; - // Does the selection box exist? - bool bSelectionBoxFound = false; - uno::Reference< XControlInformation > xCtrlInfo( mxFileDlg, UNO_QUERY ); - if ( xCtrlInfo.is() ) - { - Sequence< ::rtl::OUString > aCtrlList = xCtrlInfo->getSupportedControls(); - sal_uInt32 nCount = aCtrlList.getLength(); - for ( sal_uInt32 nCtrl = 0; nCtrl < nCount; ++nCtrl ) - if ( aCtrlList[ nCtrl ].equalsAscii("SelectionBox") ) - { - bSelectionBoxFound = true; - break; - } - } - - if ( bSelectionBoxFound ) - { - const SfxFilter* pFilter = getCurentSfxFilter(); - updateExtendedControl( - ExtendedFilePickerElementIds::CHECKBOX_SELECTION, - ( mbSelectionEnabled && pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_SUPPORTSSELECTION ) != 0 ) ); - uno::Reference< XFilePickerControlAccess > xCtrlAccess( mxFileDlg, UNO_QUERY ); - xCtrlAccess->setValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0, makeAny( (sal_Bool)mbSelection ) ); - } + const SfxFilter* pFilter = getCurentSfxFilter(); + mbSelectionFltrEnabled = updateExtendedControl( + ExtendedFilePickerElementIds::CHECKBOX_SELECTION, + ( mbSelectionEnabled && pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_SUPPORTSSELECTION ) != 0 ) ); } // ------------------------------------------------------------------------ @@ -956,6 +937,8 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( mbPwdCheckBoxState = sal_False; mbSelection = sal_False; mbSelectionEnabled = sal_True; + mbHasSelectionBox = sal_False; + mbSelectionFltrEnabled = sal_False; // default settings m_nDontFlags = SFX_FILTER_INTERNAL | SFX_FILTER_NOTINFILEDLG | SFX_FILTER_NOTINSTALLED; @@ -1025,6 +1008,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( nTemplateDescription = TemplateDescription::FILESAVE_AUTOEXTENSION_SELECTION; mbHasAutoExt = sal_True; mbIsSaveDlg = sal_True; + mbHasSelectionBox = sal_True; if ( mbExport && !mxFilterCFG.is() && xFactory.is() ) { mxFilterCFG = uno::Reference< XNameAccess >( @@ -2072,6 +2056,21 @@ void FileDialogHelper_Impl::saveConfig() bWriteConfig = sal_True; } } + + if( mbHasSelectionBox && mbSelectionFltrEnabled ) + { + try + { + aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0 ); + sal_Bool bSelection = sal_True; + aValue >>= bSelection; + if ( aUserData.GetTokenCount(' ') < 3 ) + aUserData.Append(' '); + aUserData.SetToken( 2, ' ', String::CreateFromInt32( (sal_Int32) bSelection ) ); + bWriteConfig = sal_True; + } + catch( IllegalArgumentException ){} + } if ( bWriteConfig ) aDlgOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aUserData ) ) ); @@ -2205,6 +2204,17 @@ void FileDialogHelper_Impl::loadConfig() } catch( IllegalArgumentException ){} } + + if( mbHasSelectionBox ) + { + sal_Int32 nFlag = aUserData.GetToken( 2, ' ' ).ToInt32(); + aValue <<= (sal_Bool) nFlag; + try + { + xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_SELECTION, 0, aValue ); + } + catch( IllegalArgumentException ){} + } if ( !maPath.getLength() ) displayFolder( SvtPathOptions().GetWorkPath() ); @@ -2664,10 +2674,12 @@ static int impl_isFolder( const OUString& rPath ) { } + ::rtl::Reference< ::comphelper::StillReadWriteInteraction > aHandler = new ::comphelper::StillReadWriteInteraction( xHandler ); + try { ::ucbhelper::Content aContent( - rPath, new ::ucbhelper::CommandEnvironment( xHandler, uno::Reference< ucb::XProgressHandler >() ) ); + rPath, new ::ucbhelper::CommandEnvironment( static_cast< task::XInteractionHandler* > ( aHandler.get() ), uno::Reference< ucb::XProgressHandler >() ) ); if ( aContent.isFolder() ) return 1; diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 2d20b2eca6..f7b6f8d41c 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -107,6 +107,8 @@ namespace sfx2 sal_Bool mbPwdCheckBoxState : 1; sal_Bool mbSelection : 1; sal_Bool mbSelectionEnabled : 1; + sal_Bool mbHasSelectionBox : 1; + sal_Bool mbSelectionFltrEnabled : 1; private: void addFilters( sal_Int64 nFlags, diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index e0c75790d0..448d89b7d2 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -30,13 +30,19 @@ #include <com/sun/star/registry/MergeConflictException.hpp> #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/frame/XLoadable.hpp> +#include <com/sun/star/frame/XStorable.hpp> #include <comphelper/processfactory.hxx> #include <tools/config.hxx> #include <unotools/pathoptions.hxx> #include <unotools/moduleoptions.hxx> #include <tools/urlobj.hxx> #include <unotools/ucbstreamhelper.hxx> +#include <unotools/localfilehelper.hxx> #include <comphelper/sequenceashashmap.hxx> +#include <comphelper/configurationhelper.hxx> #include <sfx2/sfx.hrc> #include <sfx2/docfilt.hxx> @@ -49,9 +55,15 @@ #include <sfx2/mnumgr.hxx> #include "sfxresid.hxx" #include <sfx2/sfxuno.hxx> +#include "syspath.hxx" +#include <osl/file.hxx> +#include <osl/security.hxx> #include "doc.hrc" +#include <assert.h> + namespace css = ::com::sun::star; +using namespace ::com::sun::star; //======================================================================== @@ -182,13 +194,130 @@ void SfxObjectFactory::SetModule_Impl( SfxModule *pMod ) pImpl->pModule = pMod; } +void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const String& rTemplateName ) +{ + static const int nMaxPathSize = 16000; + static ::rtl::OUString SERVICE_FILTER_FACTORY = ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ); + static ::rtl::OUString SERVICE_TYPE_DECTECTION = ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ); + static ::rtl::OUString SERVICE_SIMPLE_ACCESS = ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ); + + static ::rtl::OUString CONF_ROOT = ::rtl::OUString::createFromAscii( "/org.openoffice.Setup"); + static ::rtl::OUString CONF_PATH = ::rtl::OUString::createFromAscii( "Office/Factories/" ) + ::rtl::OUString( rServiceName ); + static ::rtl::OUString PROP_DEF_TEMPL_CHANGED = ::rtl::OUString::createFromAscii( "ooSetupFactorySystemDefaultTemplateChanged" ); + static ::rtl::OUString PROP_ACTUAL_FILTER = ::rtl::OUString::createFromAscii( "ooSetupFactoryActualFilter" ); + + static ::rtl::OUString DEF_TPL_STR = ::rtl::OUString::createFromAscii("/soffice."); + + String sURL; + String sPath; + sal_Unicode aPathBuffer[nMaxPathSize]; + if ( SystemPath::GetUserTemplateLocation( aPathBuffer, nMaxPathSize )) + sPath = String( aPathBuffer ); + ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, sURL ); + + ::rtl::OUString aUserTemplateURL( sURL ); + if ( aUserTemplateURL.getLength() != 0) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XInterface > xConfig = ::comphelper::ConfigurationHelper::openConfig( + xFactory, CONF_ROOT, ::comphelper::ConfigurationHelper::E_STANDARD ); + + ::rtl::OUString aActualFilter; + ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_ACTUAL_FILTER ) >>= aActualFilter; + sal_Bool bChanged(sal_False); + ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_DEF_TEMPL_CHANGED ) >>= bChanged; + + uno::Reference< container::XNameAccess > xFilterFactory( + xFactory->createInstance( SERVICE_FILTER_FACTORY ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xTypeDetection( + xFactory->createInstance( SERVICE_TYPE_DECTECTION ), uno::UNO_QUERY_THROW ); + + ::rtl::OUString aActualFilterTypeName; + uno::Sequence< beans::PropertyValue > aActuralFilterData; + xFilterFactory->getByName( aActualFilter ) >>= aActuralFilterData; + for ( sal_Int32 nInd = 0; nInd < aActuralFilterData.getLength(); nInd++ ) + if ( aActuralFilterData[nInd].Name.equalsAscii( "Type" ) ) + aActuralFilterData[nInd].Value >>= aActualFilterTypeName; + ::comphelper::SequenceAsHashMap aProps1( xTypeDetection->getByName( aActualFilterTypeName ) ); + uno::Sequence< ::rtl::OUString > aAllExt = + aProps1.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Extensions" ), uno::Sequence< ::rtl::OUString >() ); + //To-do: check if aAllExt is empty first + ::rtl::OUString aExt = aAllExt[0]; + + aUserTemplateURL += DEF_TPL_STR; + aUserTemplateURL += aExt; + + uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( + xFactory->createInstance( SERVICE_SIMPLE_ACCESS ), uno::UNO_QUERY_THROW ); + + ::rtl::OUString aBackupURL; + ::osl::Security().getConfigDir(aBackupURL); + aBackupURL += ::rtl::OUString::createFromAscii( "/temp" ); + + if ( !xSimpleFileAccess->exists( aBackupURL ) ) + xSimpleFileAccess->createFolder( aBackupURL ); + + aBackupURL += DEF_TPL_STR; + aBackupURL += aExt; + + if ( rTemplateName.Len() != 0 ) + { + if ( xSimpleFileAccess->exists( aUserTemplateURL ) && !bChanged ) + xSimpleFileAccess->copy( aUserTemplateURL, aBackupURL ); + + uno::Reference< document::XTypeDetection > xTypeDetector( xTypeDetection, uno::UNO_QUERY ); + ::comphelper::SequenceAsHashMap aProps2( xTypeDetection->getByName( xTypeDetector->queryTypeByURL( rTemplateName ) ) ); + ::rtl::OUString aFilterName = + aProps2.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString() ); + + uno::Sequence< beans::PropertyValue > aArgs( 3 ); + aArgs[0].Name = ::rtl::OUString::createFromAscii( "FilterName" ); + aArgs[0].Value <<= aFilterName; + aArgs[1].Name = ::rtl::OUString::createFromAscii( "AsTemplate" ); + aArgs[1].Value <<= sal_True; + aArgs[2].Name = ::rtl::OUString::createFromAscii( "URL" ); + aArgs[2].Value <<= ::rtl::OUString( rTemplateName ); + + uno::Reference< frame::XLoadable > xLoadable( xFactory->createInstance( ::rtl::OUString( rServiceName ) ), uno::UNO_QUERY ); + xLoadable->load( aArgs ); + + aArgs.realloc( 2 ); + aArgs[1].Name = ::rtl::OUString::createFromAscii( "Overwrite" ); + aArgs[1].Value <<= sal_True; + + uno::Reference< frame::XStorable > xStorable( xLoadable, uno::UNO_QUERY ); + xStorable->storeToURL( aUserTemplateURL, aArgs ); + ::comphelper::ConfigurationHelper::writeRelativeKey( xConfig, CONF_PATH, PROP_DEF_TEMPL_CHANGED, uno::makeAny( sal_True )); + ::comphelper::ConfigurationHelper::flush( xConfig ); + } + else + { + DBG_ASSERT( bChanged, "invalid ooSetupFactorySystemDefaultTemplateChanged value!" ); + + xSimpleFileAccess->copy( aBackupURL, aUserTemplateURL ); + xSimpleFileAccess->kill( aBackupURL ); + ::comphelper::ConfigurationHelper::writeRelativeKey( xConfig, CONF_PATH, PROP_DEF_TEMPL_CHANGED, uno::makeAny( sal_False )); + ::comphelper::ConfigurationHelper::flush( xConfig ); + } + } + catch( uno::Exception& ) + { + } + } +} + void SfxObjectFactory::SetStandardTemplate( const String& rServiceName, const String& rTemplate ) { SvtModuleOptions::EFactory eFac = SvtModuleOptions::ClassifyFactoryByServiceName(rServiceName); if (eFac == SvtModuleOptions::E_UNKNOWN_FACTORY) eFac = SvtModuleOptions::ClassifyFactoryByShortName(rServiceName); if (eFac != SvtModuleOptions::E_UNKNOWN_FACTORY) + { + SetSystemTemplate( rServiceName, rTemplate ); SvtModuleOptions().SetFactoryStandardTemplate(eFac, rTemplate); + } } String SfxObjectFactory::GetStandardTemplate( const String& rServiceName ) diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index b766921e34..b1bddf82e4 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -83,7 +83,9 @@ SLOFILES = \ $(SLO)$/sfxmodelfactory.obj \ $(SLO)$/sfxacldetect.obj \ $(SLO)$/docstoragemodifylistener.obj \ - $(SLO)$/querytemplate.obj + $(SLO)$/querytemplate.obj \ + $(SLO)$/syspath.obj \ + $(SLO)$/syspathw32.obj # $(SLO)$/applet.obj \ @@ -91,7 +93,8 @@ SLOFILES = \ #HACK TO DISABLE PCH NOOPTFILES= \ - $(SLO)$/sfxacldetect.obj + $(SLO)$/sfxacldetect.obj \ + $(SLO)$/syspathw32.obj .ENDIF diff --git a/sfx2/source/doc/syspath.cxx b/sfx2/source/doc/syspath.cxx new file mode 100755 index 0000000000..f12f5abf46 --- /dev/null +++ b/sfx2/source/doc/syspath.cxx @@ -0,0 +1,48 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2008 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: shutdowniconw32.cxx,v $ +* $Revision: 1.48 $ +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +// Comment out precompiled statement due to redefinition errors +#include "precompiled_sfx2.hxx" + +#include "syspath.hxx" + +extern "C" bool GetUserTemplateLocation(sal_Unicode*, int nSize); + +bool SystemPath::GetUserTemplateLocation(sal_Unicode* pFolder, int nSize ) +{ +#ifdef WNT + return ::GetUserTemplateLocation( pFolder, nSize ); +#else + (void)pFolder; + (void)nSize; + return false; +#endif +} diff --git a/sfx2/source/doc/syspath.hxx b/sfx2/source/doc/syspath.hxx new file mode 100644 index 0000000000..cc1a1ef2ed --- /dev/null +++ b/sfx2/source/doc/syspath.hxx @@ -0,0 +1,44 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2008 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: shutdowniconw32.cxx,v $ +* $Revision: 1.48 $ +* +* 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 __SYSPATH_HXX__ +#define __SYSPATH_HXX__ +//#pragma warning(disable:4917) + +#include <sfx2/dllapi.h> + +class SFX2_DLLPUBLIC SystemPath +{ +public: + static bool GetUserTemplateLocation(sal_Unicode*, int nSize); +}; + +#endif + diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx new file mode 100644 index 0000000000..51dc9d8d66 --- /dev/null +++ b/sfx2/source/doc/syspathw32.cxx @@ -0,0 +1,83 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2008 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: shutdowniconw32.cxx,v $ +* $Revision: 1.48 $ +* +* 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. +* +************************************************************************/ + +#ifdef WNT +#ifdef _MSC_VER +#pragma warning(disable:4917) +#endif +#include <shlobj.h> + +static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize ) +{ + LPITEMIDLIST pidl; + HRESULT hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl ); + + if( hHdl == NOERROR ) + { + WCHAR *lpFolder = static_cast< WCHAR* >( HeapAlloc( GetProcessHeap(), 0, 16000 )); + + SHGetPathFromIDListW( pidl, lpFolder ); + wcsncpy( pszFolder, lpFolder, nSize ); + + HeapFree( GetProcessHeap(), 0, lpFolder ); + IMalloc *pMalloc; + if( NOERROR == SHGetMalloc(&pMalloc) ) + { + pMalloc->Free( pidl ); + pMalloc->Release(); + } + } + return true; +} + +#endif + +// Copied from sal/types.h to circumvent problems with precompiled headers +// and redefinitions of BOOL, INT32 and other types. Unfortunately tools +// also define these type incompatible with Win32 types which leads from +// time to time to very nasty compilation errors. If someone finds a better +// way to solve these probs please remove this copied part! +typedef unsigned short sal_uInt16; +#if ( defined(WIN32) && !defined(__MINGW32__) ) + typedef wchar_t sal_Unicode; +#else + typedef sal_uInt16 sal_Unicode; +#endif + +extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize) +{ +#ifdef WNT + return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, pFolder, nSize ); +#else + (void)pFolder; + (void)nSize; + return false; +#endif +} |