diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-11-30 14:44:46 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-11-30 14:44:46 +0000 |
commit | b996951652e8564766043a5f2ccf4a962ef27f31 (patch) | |
tree | 04f1ed827b8cdc070c68afc25bca6d42b3851431 | |
parent | e87505c8b639172a1ab7bbecd920ac652f763d93 (diff) | |
parent | b3346550b44737fc3395314c483cef2e71636827 (diff) |
slideshow1: merge with DEV300 m44
447 files changed, 11270 insertions, 12826 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index d7dd09749419..35d9cd77301e 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -425,7 +425,8 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) SbProcedureProperty* pNewProp = new SbProcedureProperty ( pProcedureProp->GetName(), pProcedureProp->GetType() ); // ( pProcedureProp->GetName(), pProcedureProp->GetType(), this ); - pNewProp->ResetFlag( SBX_NO_BROADCAST ); + pNewProp->SetFlags( nFlags_ ); // Copy flags
+ pNewProp->ResetFlag( SBX_NO_BROADCAST ); // except the Broadcast if it was set
pProcedureProp->SetFlags( nFlags_ ); pProps->PutDirect( pNewProp, i ); StartListening( pNewProp->GetBroadcaster(), TRUE ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index bf249731dc59..dc6fb6d13cec 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -117,7 +117,7 @@ static String ID_DBG_PROPERTIES( RTL_CONSTASCII_USTRINGPARAM("Dbg_Properties") ) static String ID_DBG_METHODS( RTL_CONSTASCII_USTRINGPARAM("Dbg_Methods") ); static ::rtl::OUString aSeqLevelStr( RTL_CONSTASCII_USTRINGPARAM("[]") ); -static ::rtl::OUString defaultNameSpace( RTL_CONSTASCII_USTRINGPARAM("org.openoffice") ); +static ::rtl::OUString defaultNameSpace( RTL_CONSTASCII_USTRINGPARAM("ooo.vba") ); // Gets the default property for an uno object. Note: There is some // redirection built in. The property name specifies the name @@ -1600,7 +1600,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, OSL_TRACE("Checking if object implements %s", OUStringToOString( defaultNameSpace + aClass, RTL_TEXTENCODING_UTF8 ).getStr() ); - // although interfaces in the org.openoffice.vba namespace + // although interfaces in the ooo.vba.vba namespace // obey the idl rules and have a leading X, in basic we // want to be able to do something like // 'dim wrkbooks as WorkBooks' diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 69b425a74c97..d242071784b6 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -1,4 +1,4 @@ -/************************************************************************* + /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -742,6 +742,7 @@ void SbiParser::DefEnum( BOOL bPrivate ) SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) { BOOL bFunc = BOOL( eCurTok == FUNCTION ); + BOOL bProp = BOOL( eCurTok == GET || eCurTok == SET || eCurTok == LET );
if( !TestSymbol() ) return NULL; String aName( aSym ); SbxDataType eType = eScanType; @@ -862,7 +863,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) // if( pDef->GetType() == SbxOBJECT ) // pDef->SetType( SbxVARIANT ), // Error( SbERR_SYNTAX ); - if( pDef->GetType() == SbxVARIANT && !bFunc ) + if( pDef->GetType() == SbxVARIANT && !( bFunc || bProp ) )
pDef->SetType( SbxEMPTY ); return pDef; } diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index b4e6ab6937a9..9cde971228d9 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -196,7 +196,7 @@ BOOL SbiScanner::NextSym() } // Leerstellen weg: - while( *pLine && ( *pLine == ' ' ) || ( *pLine == '\t' ) || ( *pLine == '\f' ) ) + while( *pLine && (( *pLine == ' ' ) || ( *pLine == '\t' ) || ( *pLine == '\f' )) )
pLine++, nCol++, bSpaces = TRUE; nCol1 = nCol; diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index df6d8f5cf1d2..02a41a6fc2c8 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -580,6 +580,9 @@ private: */ void impl_checkLoaded(); +private: + void impl_removeWithoutChecks( const ::rtl::OUString& _rElementName ); + public: SfxLibrary( ModifiableHelper& _rModifiable, @@ -651,6 +654,13 @@ public: ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); +public: + struct LibraryContainerAccess { friend class SfxLibraryContainer; private: LibraryContainerAccess() { } }; + void removeElementWithoutChecks( const ::rtl::OUString& _rElementName, LibraryContainerAccess ) + { + impl_removeWithoutChecks( _rElementName ); + } + protected: virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0; }; diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 9c9a994bb6c5..e92c8c974eb2 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1786,9 +1786,9 @@ INT16 implGetDateYear( double aDate ) BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet ) { - if ( nYear < 30 ) + if ( nYear < 30 && SbiRuntime::isVBAEnabled() )
nYear += 2000; - if ( nYear < 100 ) + else if ( nYear < 100 )
nYear += 1900; Date aCurDate( nDay, nMonth, nYear ); if ((nYear < 100 || nYear > 9999) ) diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index 5ed082aee893..2a7c69b16323 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -71,7 +71,7 @@ SbxArray* getVBAGlobals( ) xCtx.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW ); - SbUnoObject dGlobs( String( RTL_CONSTASCII_USTRINGPARAM("ExcelGlobals") ), xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/org.openoffice.vba.theGlobals") ) ); + SbUnoObject dGlobs( String( RTL_CONSTASCII_USTRINGPARAM("ExcelGlobals") ), xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) ); SbxVariable *vba = dGlobs.Find( String( RTL_CONSTASCII_USTRINGPARAM("getGlobals") ) , SbxCLASS_DONTCARE ); diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx index f03dfdf32bcb..5a5ba02d6da1 100644 --- a/basic/source/sbx/sbxexec.cxx +++ b/basic/source/sbx/sbxexec.cxx @@ -94,7 +94,7 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S { rSym = p; // Dann darf es Buchstaben, Zahlen oder Underlines enthalten - while( *p && rCharClass.isAlphaNumeric( *p ) || *p == '_' ) + while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
p++, nLen++; // BASIC-Standard-Suffixe werden ignoriert if( *p && (*p == '%' || *p == '&' || *p == '!' || *p == '#' || *p == '$' ) ) @@ -118,7 +118,7 @@ static SbxVariable* QualifiedName { // Element einlesen refVar = Element( pObj, pGbl, &p, t, aCharClass ); - while( refVar.Is() && *p == '.' || *p == '!' ) + while( refVar.Is() && (*p == '.' || *p == '!') )
{ // Es folgt noch ein Objektelement. Das aktuelle Element // muss also ein SBX-Objekt sein oder liefern! diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index a7f226f9455f..c397e402fac4 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -2155,10 +2155,9 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name ) Sequence< OUString > aNames = pImplLib->getElementNames(); sal_Int32 nNameCount = aNames.getLength(); const OUString* pNames = aNames.getConstArray(); - for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) + for( sal_Int32 i = 0 ; i < nNameCount ; ++i, ++pNames ) { - OUString aElementName = pNames[ i ]; - pImplLib->removeByName( aElementName ); + pImplLib->removeElementWithoutChecks( *pNames, SfxLibrary::LibraryContainerAccess() ); } } @@ -2907,20 +2906,16 @@ void SfxLibrary::insertByName( const OUString& aName, const Any& aElement ) implSetModified( sal_True ); } -void SfxLibrary::removeByName( const OUString& Name ) - throw(NoSuchElementException, WrappedTargetException, RuntimeException) +void SfxLibrary::impl_removeWithoutChecks( const ::rtl::OUString& _rElementName ) { - impl_checkReadOnly(); - impl_checkLoaded(); - - maNameContainer.removeByName( Name ); + maNameContainer.removeByName( _rElementName ); implSetModified( sal_True ); // Remove element file if( maStorageURL.getLength() ) { INetURLObject aElementInetObj( maStorageURL ); - aElementInetObj.insertName( Name, sal_False, + aElementInetObj.insertName( _rElementName, sal_False, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); aElementInetObj.setExtension( maLibElementFileExtension ); OUString aFile = aElementInetObj.GetMainURL( INetURLObject::NO_DECODE ); @@ -2932,9 +2927,17 @@ void SfxLibrary::removeByName( const OUString& Name ) } catch( Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } +} +void SfxLibrary::removeByName( const OUString& Name ) + throw(NoSuchElementException, WrappedTargetException, RuntimeException) +{ + impl_checkReadOnly(); + impl_checkLoaded(); + impl_removeWithoutChecks( Name ); } // XTypeProvider diff --git a/configmgr/source/tree/updatehelper.cxx b/configmgr/source/tree/updatehelper.cxx index bf0a65d9e412..5d07d3289e3d 100644 --- a/configmgr/source/tree/updatehelper.cxx +++ b/configmgr/source/tree/updatehelper.cxx @@ -450,36 +450,36 @@ void ApplyUpdate::handle(RemoveNode& _rChange) virtual void handle(ValueNode const& _aNewNode) { sharable::Node * childNode = m_cacheNode->getSubnode(getNodeName(_aNewNode)); - - OSL_ENSURE(childNode != 0, "TreeDifferenceBuilder: could not find expected node !"); - - sharable::ValueNode * valueNode = childNode->valueData(); - - OSL_ENSURE(valueNode != 0, "TreeDifferenceBuilder: node must be a value node!"); - - // if the values differ add a new change - if (_aNewNode.getValue() != valueNode->getValue()) + if (childNode != 0) { - bool bNewDefault = _aNewNode.isDefault(); - bool bOldDefault = valueNode->info.isDefault(); - - ValueChange::Mode eMode; - if (bNewDefault) - if (bOldDefault) - eMode = ValueChange::changeDefault; - else - eMode = ValueChange::setToDefault; - else - if (bOldDefault) - eMode = ValueChange::wasDefault; + sharable::ValueNode * valueNode = childNode->valueData(); + + OSL_ENSURE(valueNode != 0, "TreeDifferenceBuilder: node must be a value node!"); + + // if the values differ add a new change + if (_aNewNode.getValue() != valueNode->getValue()) + { + bool bNewDefault = _aNewNode.isDefault(); + bool bOldDefault = valueNode->info.isDefault(); + + ValueChange::Mode eMode; + if (bNewDefault) + if (bOldDefault) + eMode = ValueChange::changeDefault; + else + eMode = ValueChange::setToDefault; else - eMode = ValueChange::changeValue; + if (bOldDefault) + eMode = ValueChange::wasDefault; + else + eMode = ValueChange::changeValue; - std::auto_ptr<Change> pChange( - new ValueChange(_aNewNode.getName(), _aNewNode.getAttributes(), eMode, - _aNewNode.getValue(), valueNode->getValue()) ); + std::auto_ptr<Change> pChange( + new ValueChange(_aNewNode.getName(), _aNewNode.getAttributes(), eMode, + _aNewNode.getValue(), valueNode->getValue()) ); - m_rChangeList.addChange(pChange); + m_rChangeList.addChange(pChange); + } } } virtual void handle(ISubtree const& _aNewNode) diff --git a/connectivity/inc/connectivity/IParseContext.hxx b/connectivity/inc/connectivity/IParseContext.hxx index c51484fe1a6f..bcf90755a709 100644 --- a/connectivity/inc/connectivity/IParseContext.hxx +++ b/connectivity/inc/connectivity/IParseContext.hxx @@ -41,7 +41,7 @@ namespace connectivity //========================================================================== //= IParseContext //========================================================================== - class OOO_DLLPUBLIC_DBTOOLS IParseContext + class IParseContext { public: enum ErrorCode diff --git a/connectivity/inc/connectivity/dbmetadata.hxx b/connectivity/inc/connectivity/dbmetadata.hxx index 91280e97fab1..fce063231089 100644 --- a/connectivity/inc/connectivity/dbmetadata.hxx +++ b/connectivity/inc/connectivity/dbmetadata.hxx @@ -150,6 +150,10 @@ namespace dbtools * \return <TRUE/> when relations are supported, otherwise <FALSE/> */ bool supportsColumnAliasInOrderBy() const; + + /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed + */ + bool displayEmptyTableFolders() const; }; //........................................................................ diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx index c8c14200d901..9c3acfb606d5 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" - +#include "ParameterSubstitution.hxx" #include "FDatabaseMetaDataResultSet.hxx" #include "FDatabaseMetaDataResultSetMetaData.hxx" #include <com/sun/star/sdbc/DataType.hpp> @@ -48,6 +48,7 @@ #include <cppuhelper/typeprovider.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/factory.hxx> +#include <cppuhelper/implementationentry.hxx> #include "connectivity/dbexception.hxx" #include "TConnection.hxx" @@ -864,14 +865,23 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA // ------------------------------------------------------------------------- namespace connectivity { - Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet_CreateInstance(const Reference< XMultiServiceFactory >& ) throw( Exception ) + Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet_CreateInstance(const Reference< XComponentContext >& ) throw( Exception ) { return *(new ODatabaseMetaDataResultSet()); } } // ----------------------------------------------------------------------------- - +namespace +{ + cppu::ImplementationEntry entries[] = { + { &ODatabaseMetaDataResultSet_CreateInstance, &ODatabaseMetaDataResultSet::getImplementationName_Static, &ODatabaseMetaDataResultSet::getSupportedServiceNames_Static, + &cppu::createSingleComponentFactory, 0, 0 }, + { &ParameterSubstitution::create, &ParameterSubstitution::getImplementationName_Static, &ParameterSubstitution::getSupportedServiceNames_Static, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }; +} using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -893,56 +903,14 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const } //--------------------------------------------------------------------------------------- -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* /*_pServiceManager*/, com::sun::star::registry::XRegistryKey* _pRegistryKey) +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* serviceManager, com::sun::star::registry::XRegistryKey* registryKey) { - ::rtl::OUString sMainKeyName = ::rtl::OUString::createFromAscii("/"); - sMainKeyName += ODatabaseMetaDataResultSet::getImplementationName_Static(); - sMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES"); - - try - { - Reference< XRegistryKey > xMainKey = _pRegistryKey->createKey(sMainKeyName); - if (!xMainKey.is()) - return sal_False; - - Sequence< ::rtl::OUString > sServices = ODatabaseMetaDataResultSet::getSupportedServiceNames_Static(); - const ::rtl::OUString* pServices = sServices.getConstArray(); - for (sal_Int32 i=0; i<sServices.getLength(); ++i, ++pServices) - xMainKey->createKey(*pServices); - } - catch(InvalidRegistryException&) - { - return sal_False; - } - catch(InvalidValueException&) - { - return sal_False; - } - return sal_True; + return cppu::component_writeInfoHelper(serviceManager, registryKey, entries); } //--------------------------------------------------------------------------------------- -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* _pImplName, ::com::sun::star::lang::XMultiServiceFactory* _pServiceManager, void* /*_pRegistryKey*/) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* implName, ::com::sun::star::lang::XMultiServiceFactory* serviceManager, void* registryKey) { - void* pRet = NULL; - - if (ODatabaseMetaDataResultSet::getImplementationName_Static().compareToAscii(_pImplName) == 0) - { - Reference< XSingleServiceFactory > xFactory( - ::cppu::createSingleFactory( - _pServiceManager, - ODatabaseMetaDataResultSet::getImplementationName_Static(), - ODatabaseMetaDataResultSet_CreateInstance, - ODatabaseMetaDataResultSet::getSupportedServiceNames_Static(),0 - ) - ); - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; + return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries); } } // extern "C" diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 2823c2b43489..ffd67f9ef0fa 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -1939,6 +1939,21 @@ void ORowSetValue::fill(const Any& _rValue) setSigned(sal_False); break; } + case TypeClass_HYPER:
+ {
+ sal_Int64 nValue(0);
+ _rValue >>= nValue;
+ (*this) = nValue;
+ break;
+ }
+ case TypeClass_UNSIGNED_HYPER:
+ {
+ sal_uInt64 nValue(0);
+ _rValue >>= nValue;
+ (*this) = static_cast<sal_Int64>(nValue);
+ setSigned(sal_False);
+ break;
+ } case TypeClass_UNSIGNED_LONG: { sal_uInt32 nValue(0); diff --git a/connectivity/source/commontools/ParamterSubstitution.cxx b/connectivity/source/commontools/ParamterSubstitution.cxx new file mode 100644 index 000000000000..f3823a4f211f --- /dev/null +++ b/connectivity/source/commontools/ParamterSubstitution.cxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * 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: FDatabaseMetaDataResultSet.cxx,v $ + * $Revision: 1.24 $ + * + * 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. + * + ************************************************************************/ +#include "precompiled_connectivity.hxx" +#include "ParameterSubstitution.hxx" +#include "connectivity/sqlparse.hxx" +#include <comphelper/sequenceashashmap.hxx> + +namespace connectivity +{ + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::sdbc; + using namespace ::com::sun::star::lang; + using namespace ::com::sun::star; + + ParameterSubstitution::ParameterSubstitution(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ) : m_xContext(_rxContext) + { + } + void SAL_CALL ParameterSubstitution::initialize( const uno::Sequence< uno::Any >& _aArguments ) throw (uno::Exception, uno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_aMutex); + comphelper::SequenceAsHashMap aArgs(_aArguments); + uno::Reference< sdbc::XConnection > xConnection; + xConnection = aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")),xConnection); + m_xConnection = xConnection; + } + //------------------------------------------------------------------------------ + rtl::OUString ParameterSubstitution::getImplementationName_Static( ) throw(RuntimeException) + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.ParameterSubstitution")); + } + //------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ParameterSubstitution::getImplementationName( ) throw(RuntimeException) + { + return getImplementationName_Static(); + } + //------------------------------------------------------------------ + sal_Bool SAL_CALL ParameterSubstitution::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) + { + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; + + return pSupported != pEnd; + } + //------------------------------------------------------------------ + Sequence< ::rtl::OUString > SAL_CALL ParameterSubstitution::getSupportedServiceNames( ) throw(RuntimeException) + { + return getSupportedServiceNames_Static(); + } + //------------------------------------------------------------------ + Sequence< ::rtl::OUString > ParameterSubstitution::getSupportedServiceNames_Static( ) throw (RuntimeException) + { + Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.ParameterSubstitution"); + return aSNS; + } + + //------------------------------------------------------------------ + Reference< XInterface > ParameterSubstitution::create(const Reference< XComponentContext >& _xContext) + { + return *(new ParameterSubstitution(_xContext)); + } + //------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ParameterSubstitution::substituteVariables( const ::rtl::OUString& _sText, ::sal_Bool /*bSubstRequired*/ ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) + { + ::rtl::OUString sRet = _sText; + uno::Reference< sdbc::XConnection > xConnection = m_xConnection; + if ( xConnection.is() ) + { + try + { + uno::Reference< XMultiServiceFactory> xFac(m_xContext->getServiceManager(),uno::UNO_QUERY_THROW); + OSQLParser aParser( xFac ); + ::rtl::OUString sErrorMessage; + ::rtl::OUString sNewSql; + OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sText); + if(pNode) + { // special handling for parameters + OSQLParseNode::substituteParameterNames(pNode); + pNode->parseNodeToStr( sNewSql, xConnection ); + delete pNode; + sRet = sNewSql; + } + } + catch(const Exception&) + { + } + } + return sRet; + } + //------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ParameterSubstitution::reSubstituteVariables( const ::rtl::OUString& _sText ) throw (::com::sun::star::uno::RuntimeException) + { + return _sText; + } + //------------------------------------------------------------------ + ::rtl::OUString SAL_CALL ParameterSubstitution::getSubstituteVariableValue( const ::rtl::OUString& /*variable*/ ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) + { + throw container::NoSuchElementException(); + } + //------------------------------------------------------------------ + + +// ================================== +} // connectivity +// ================================== diff --git a/connectivity/source/commontools/TSkipDeletedSet.cxx b/connectivity/source/commontools/TSkipDeletedSet.cxx index 2abd3dee97e0..01783eb9f132 100644 --- a/connectivity/source/commontools/TSkipDeletedSet.cxx +++ b/connectivity/source/commontools/TSkipDeletedSet.cxx @@ -38,9 +38,9 @@ using namespace connectivity; // ----------------------------------------------------------------------------- OSkipDeletedSet::OSkipDeletedSet(IResultSetHelper* _pHelper) : m_pHelper(_pHelper) + ,m_bDeletedVisible(false) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "commontools", "Ocke.Janssen@sun.com", "OSkipDeletedSet::OSkipDeletedSet" ); - m_bDeletedVisible = m_pHelper->deletedVisible(); m_aBookmarksPositions.reserve(256); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 5df42da7ad5e..0cc19b61e72d 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -72,6 +72,7 @@ namespace dbtools using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_SET_THROW; /** === end UNO using === **/ namespace BooleanComparisonMode = ::com::sun::star::sdb::BooleanComparisonMode; @@ -286,10 +287,16 @@ namespace dbtools try { bSupport = m_pImpl->xConnectionMetaData->supportsIntegrityEnhancementFacility(); + } + catch( const Exception& ) + { + } + try + { if ( !bSupport ) { const ::rtl::OUString url = m_pImpl->xConnectionMetaData->getURL(); - char pMySQL[] = "sdbc:mysql:"; + char pMySQL[] = "sdbc:mysql"; bSupport = url.matchAsciiL(pMySQL,(sizeof(pMySQL)/sizeof(pMySQL[0]))-1); } } @@ -308,7 +315,30 @@ namespace dbtools OSL_VERIFY( setting >>= doGenerate ); return doGenerate; } + //-------------------------------------------------------------------- + bool DatabaseMetaData::displayEmptyTableFolders() const + { + bool doDisplay( true ); +#ifdef IMPLEMENTED_LATER + Any setting; + if ( lcl_getConnectionSetting( "DisplayEmptyTableFolders", *m_pImpl, setting ) ) + OSL_VERIFY( setting >>= doDisplay ); +#else + try + { + Reference< XDatabaseMetaData > xMeta( m_pImpl->xConnectionMetaData, UNO_SET_THROW ); + ::rtl::OUString sConnectionURL( xMeta->getURL() ); + doDisplay = sConnectionURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc" ) ) == 0; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +#endif + return doDisplay; + } + //........................................................................ } // namespace dbtools //........................................................................ diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk index 814f75a3a0c7..5b8287f6c826 100644 --- a/connectivity/source/commontools/makefile.mk +++ b/connectivity/source/commontools/makefile.mk @@ -84,6 +84,7 @@ EXCEPTIONSFILES=\ $(SLO)$/sqlerror.obj \ $(SLO)$/filtermanager.obj \ $(SLO)$/parameters.obj \ + $(SLO)$/ParamterSubstitution.obj \ $(SLO)$/formattedcolumnvalue.obj SLOFILES=\ diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 96f2767d3a77..f1da3b94ca81 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -135,6 +135,7 @@ OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIte m_nResultSetConcurrency = isCount() ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE; construct(); + m_aSkipDeletedSet.SetDeleted(m_bShowDeleted); osl_decrementInterlockedCount( &m_refCount ); } diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx index 974baa92ab41..921ba6704105 100644 --- a/connectivity/source/drivers/jdbc/CallableStatement.cxx +++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx @@ -83,6 +83,8 @@ Any SAL_CALL java_sql_CallableStatement::queryInterface( const Type & rType ) th // ------------------------------------------------------------------------- sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -106,6 +108,8 @@ sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( ) throw(starsdbc::SQLExc sal_Bool SAL_CALL java_sql_CallableStatement::getBoolean( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -129,6 +133,8 @@ sal_Bool SAL_CALL java_sql_CallableStatement::getBoolean( sal_Int32 columnIndex } sal_Int8 SAL_CALL java_sql_CallableStatement::getByte( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jbyte out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -152,6 +158,8 @@ sal_Int8 SAL_CALL java_sql_CallableStatement::getByte( sal_Int32 columnIndex ) t } Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); Sequence< sal_Int8 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -182,6 +190,8 @@ Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 co } ::com::sun::star::util::Date SAL_CALL java_sql_CallableStatement::getDate( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -206,6 +216,8 @@ Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 co } double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jdouble out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -229,6 +241,8 @@ double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex ) t float SAL_CALL java_sql_CallableStatement::getFloat( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jfloat out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -253,6 +267,8 @@ float SAL_CALL java_sql_CallableStatement::getFloat( sal_Int32 columnIndex ) thr sal_Int32 SAL_CALL java_sql_CallableStatement::getInt( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -277,6 +293,8 @@ sal_Int32 SAL_CALL java_sql_CallableStatement::getInt( sal_Int32 columnIndex ) t sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jlong out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -299,6 +317,8 @@ sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex ) Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -322,6 +342,8 @@ Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jshort out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -344,6 +366,8 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) ::rtl::OUString SAL_CALL java_sql_CallableStatement::getString( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; if( t.pEnv ){ @@ -368,6 +392,8 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) ::com::sun::star::util::Time SAL_CALL java_sql_CallableStatement::getTime( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -392,6 +418,8 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) ::com::sun::star::util::DateTime SAL_CALL java_sql_CallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -415,6 +443,8 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) { @@ -439,6 +469,8 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame } void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) { @@ -495,6 +527,8 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatem Reference< starsdbc::XArray > SAL_CALL java_sql_CallableStatement::getArray( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -518,6 +552,8 @@ Reference< starsdbc::XArray > SAL_CALL java_sql_CallableStatement::getArray( sal Reference< starsdbc::XClob > SAL_CALL java_sql_CallableStatement::getClob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -540,6 +576,8 @@ Reference< starsdbc::XClob > SAL_CALL java_sql_CallableStatement::getClob( sal_I } Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -563,6 +601,8 @@ Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_I Reference< starsdbc::XRef > SAL_CALL java_sql_CallableStatement::getRef( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index fff580ef7c38..5c5b9951e031 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -388,7 +388,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(SQLException, RuntimeException) { - static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ)Ljava/sql/ResultSet;"; static const char * cMethodName = "getBestRowIdentifier"; m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, cMethodName ); @@ -1540,7 +1540,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( if( t.pEnv ){ - static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I;)Ljava/sql/ResultSet;"; + static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/sql/ResultSet;"; static const char * cMethodName = "getUDTs"; // Java-Call absetzen static jmethodID mID = NULL; diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index bd28a24200cf..5ff18bb2c130 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -185,6 +185,8 @@ Sequence< Type > SAL_CALL java_sql_Statement_Base::getTypes( ) throw(RuntimeExc Reference< XResultSet > SAL_CALL java_sql_Statement_Base::getGeneratedValues( ) throw (SQLException, RuntimeException) { m_aLogger.log( LogLevel::FINE, STR_LOG_GENERATED_VALUES ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -232,6 +234,8 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::getGeneratedValues( ) void SAL_CALL java_sql_Statement_Base::cancel( ) throw(RuntimeException) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); if( t.pEnv ){ createStatement(t.pEnv); @@ -285,9 +289,12 @@ void SAL_CALL java_sql_Statement::clearBatch( ) throw(::com::sun::star::sdbc::S sal_Bool SAL_CALL java_sql_Statement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTE_STATEMENT, sql ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); + if( t.pEnv ) { createStatement(t.pEnv); @@ -320,6 +327,8 @@ sal_Bool SAL_CALL java_sql_Statement_Base::execute( const ::rtl::OUString& sql ) Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTE_QUERY, sql ); jobject out(0); @@ -356,6 +365,8 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const :: // ------------------------------------------------------------------------- Reference< XConnection > SAL_CALL java_sql_Statement_Base::getConnection( ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); return (Reference< XConnection >)m_pConnection; } // ------------------------------------------------------------------------- @@ -369,12 +380,14 @@ Any SAL_CALL java_sql_Statement::queryInterface( const Type & rType ) throw(Runt void SAL_CALL java_sql_Statement::addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ createStatement(t.pEnv); // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)I"; + static const char * cSignature = "(Ljava/lang/String;)V"; static const char * cMethodName = "addBatch"; // Java-Call absetzen static jmethodID mID = NULL; @@ -394,6 +407,8 @@ void SAL_CALL java_sql_Statement::addBatch( const ::rtl::OUString& sql ) throw(: Sequence< sal_Int32 > SAL_CALL java_sql_Statement::executeBatch( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); Sequence< sal_Int32 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -424,6 +439,8 @@ Sequence< sal_Int32 > SAL_CALL java_sql_Statement::executeBatch( ) throw(::com: sal_Int32 SAL_CALL java_sql_Statement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTE_UPDATE, sql ); jint out(0); @@ -459,6 +476,8 @@ sal_Int32 SAL_CALL java_sql_Statement_Base::executeUpdate( const ::rtl::OUString Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Statement_Base::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -483,6 +502,8 @@ Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Statement_Base sal_Int32 SAL_CALL java_sql_Statement_Base::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -508,6 +529,8 @@ sal_Int32 SAL_CALL java_sql_Statement_Base::getUpdateCount( ) throw(::com::sun: sal_Bool SAL_CALL java_sql_Statement_Base::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) @@ -532,6 +555,8 @@ sal_Bool SAL_CALL java_sql_Statement_Base::getMoreResults( ) throw(::com::sun:: // ------------------------------------------------------------------------- Any SAL_CALL java_sql_Statement_Base::getWarnings( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(NULL); SDBThreadAttach t; if( t.pEnv ) @@ -563,6 +588,8 @@ Any SAL_CALL java_sql_Statement_Base::getWarnings( ) throw(::com::sun::star::sd // ------------------------------------------------------------------------- void SAL_CALL java_sql_Statement_Base::clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; if( t.pEnv ) { @@ -583,6 +610,8 @@ void SAL_CALL java_sql_Statement_Base::clearWarnings( ) throw(::com::sun::star: //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getQueryTimeOut() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -605,6 +634,8 @@ sal_Int32 java_sql_Statement_Base::getQueryTimeOut() throw(SQLException, Runtim //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getMaxRows() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -627,6 +658,8 @@ sal_Int32 java_sql_Statement_Base::getMaxRows() throw(SQLException, RuntimeExcep //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getResultSetConcurrency() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv && object ){ @@ -651,6 +684,8 @@ sal_Int32 java_sql_Statement_Base::getResultSetConcurrency() throw(SQLException, //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getResultSetType() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv && object ){ @@ -674,6 +709,8 @@ sal_Int32 java_sql_Statement_Base::getResultSetType() throw(SQLException, Runtim //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getFetchDirection() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -696,6 +733,8 @@ sal_Int32 java_sql_Statement_Base::getFetchDirection() throw(SQLException, Runti //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getFetchSize() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -718,6 +757,8 @@ sal_Int32 java_sql_Statement_Base::getFetchSize() throw(SQLException, RuntimeExc //------------------------------------------------------------------------------ sal_Int32 java_sql_Statement_Base::getMaxFieldSize() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jint out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -740,6 +781,8 @@ sal_Int32 java_sql_Statement_Base::getMaxFieldSize() throw(SQLException, Runtime //------------------------------------------------------------------------------ ::rtl::OUString java_sql_Statement_Base::getCursorName() throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; if( t.pEnv ) @@ -765,6 +808,8 @@ sal_Int32 java_sql_Statement_Base::getMaxFieldSize() throw(SQLException, Runtime //------------------------------------------------------------------------------ void java_sql_Statement_Base::setQueryTimeOut(sal_Int32 _par0) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ createStatement(t.pEnv); @@ -787,6 +832,8 @@ void java_sql_Statement_Base::setQueryTimeOut(sal_Int32 _par0) throw(SQLExceptio //------------------------------------------------------------------------------ void java_sql_Statement_Base::setEscapeProcessing(sal_Bool _par0) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINE, STR_LOG_SET_ESCAPE_PROCESSING, _par0 ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -810,6 +857,8 @@ void java_sql_Statement_Base::setEscapeProcessing(sal_Bool _par0) throw(SQLExcep //------------------------------------------------------------------------------ void java_sql_Statement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ createStatement(t.pEnv); @@ -866,6 +915,8 @@ void java_sql_Statement_Base::setResultSetType(sal_Int32 _par0) throw(SQLExcepti //------------------------------------------------------------------------------ void java_sql_Statement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_DIRECTION, (sal_Int32)_par0 ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -888,6 +939,8 @@ void java_sql_Statement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLExcept //------------------------------------------------------------------------------ void java_sql_Statement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINER, STR_LOG_FETCH_SIZE, (sal_Int32)_par0 ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -911,6 +964,8 @@ void java_sql_Statement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, //------------------------------------------------------------------------------ void java_sql_Statement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ createStatement(t.pEnv); @@ -932,6 +987,8 @@ void java_sql_Statement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLExceptio //------------------------------------------------------------------------------ void java_sql_Statement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ createStatement(t.pEnv); diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx index 2b11797f27da..281e29fd5919 100644 --- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -40,6 +40,7 @@ #include <cppuhelper/typeprovider.hxx> #include <comphelper/sequence.hxx> #include "connectivity/dbtools.hxx" +#include "connectivity/FValue.hxx" #include "connectivity/dbexception.hxx" #include "resource/jdbc_log.hrc" #include "resource/common_res.hrc" @@ -123,6 +124,8 @@ void java_sql_PreparedStatement::saveClassRef( jclass pClass ) sal_Bool SAL_CALL java_sql_PreparedStatement::execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jboolean out(sal_False); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -147,6 +150,8 @@ sal_Bool SAL_CALL java_sql_PreparedStatement::execute( ) throw(::com::sun::star sal_Int32 SAL_CALL java_sql_PreparedStatement::executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED_UPDATE ); jint out(0); @@ -172,6 +177,8 @@ sal_Int32 SAL_CALL java_sql_PreparedStatement::executeUpdate( ) throw(::com::su void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); m_aLogger.log( LogLevel::FINER, STR_LOG_STRING_PARAMETER, parameterIndex, x ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -203,6 +210,8 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_PreparedStatement::executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED_QUERY ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); @@ -229,6 +238,8 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c void SAL_CALL java_sql_PreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_BOOLEAN_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -252,6 +263,8 @@ void SAL_CALL java_sql_PreparedStatement::setBoolean( sal_Int32 parameterIndex, void SAL_CALL java_sql_PreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_BYTE_PARAMETER, parameterIndex, (sal_Int32)x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -275,6 +288,8 @@ void SAL_CALL java_sql_PreparedStatement::setByte( sal_Int32 parameterIndex, sal void SAL_CALL java_sql_PreparedStatement::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_DATE_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -304,6 +319,8 @@ void SAL_CALL java_sql_PreparedStatement::setDate( sal_Int32 parameterIndex, con void SAL_CALL java_sql_PreparedStatement::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_TIME_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -333,6 +350,8 @@ void SAL_CALL java_sql_PreparedStatement::setTime( sal_Int32 parameterIndex, con void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_TIMESTAMP_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -360,6 +379,8 @@ void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_DOUBLE_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -383,6 +404,8 @@ void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, d void SAL_CALL java_sql_PreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_FLOAT_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -406,6 +429,8 @@ void SAL_CALL java_sql_PreparedStatement::setFloat( sal_Int32 parameterIndex, fl void SAL_CALL java_sql_PreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_INT_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -429,6 +454,8 @@ void SAL_CALL java_sql_PreparedStatement::setInt( sal_Int32 parameterIndex, sal_ void SAL_CALL java_sql_PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_LONG_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -452,6 +479,8 @@ void SAL_CALL java_sql_PreparedStatement::setLong( sal_Int32 parameterIndex, sal void SAL_CALL java_sql_PreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_NULL_PARAMETER, parameterIndex, sqlType ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -499,6 +528,8 @@ void SAL_CALL java_sql_PreparedStatement::setRef( sal_Int32 /*parameterIndex*/, void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_OBJECT_NULL_PARAMETER, parameterIndex ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -527,7 +558,15 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter //return; } else - pBigDecimal.reset(new java_math_BigDecimal(::comphelper::getString(x))); + { + ORowSetValue aValue; + aValue.fill(x); + const ::rtl::OUString sValue = aValue; + if ( sValue.getLength() ) + pBigDecimal.reset(new java_math_BigDecimal(sValue)); + else + pBigDecimal.reset(new java_math_BigDecimal(0.0)); + } //obj = convertwchar_tToJavaString(t.pEnv,::comphelper::getString(x)); t.pEnv->CallVoidMethod( object, mID, parameterIndex,pBigDecimal->getJavaObject(),targetSqlType,scale); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -549,6 +588,8 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter void SAL_CALL java_sql_PreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/, const ::rtl::OUString& /*typeName*/ ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_OBJECT_NULL_PARAMETER, parameterIndex ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -586,6 +627,8 @@ void SAL_CALL java_sql_PreparedStatement::setObject( sal_Int32 parameterIndex, c void SAL_CALL java_sql_PreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_SHORT_PARAMETER, parameterIndex, x ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -609,6 +652,8 @@ void SAL_CALL java_sql_PreparedStatement::setShort( sal_Int32 parameterIndex, sa void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_BYTES_PARAMETER, parameterIndex ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -636,6 +681,8 @@ void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, co void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_CHARSTREAM_PARAMETER, parameterIndex ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -687,6 +734,8 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_BINARYSTREAM_PARAMETER, parameterIndex ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -736,6 +785,8 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn void SAL_CALL java_sql_PreparedStatement::clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { m_aLogger.log( LogLevel::FINER, STR_LOG_CLEAR_PARAMETERS ); + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; if( t.pEnv ){ @@ -757,6 +808,8 @@ void SAL_CALL java_sql_PreparedStatement::clearParameters( ) throw(::com::sun:: // ------------------------------------------------------------------------- void SAL_CALL java_sql_PreparedStatement::clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ createStatement(t.pEnv); @@ -778,6 +831,8 @@ void SAL_CALL java_sql_PreparedStatement::clearBatch( ) throw(::com::sun::star: void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ createStatement(t.pEnv); @@ -798,6 +853,8 @@ void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sd ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL java_sql_PreparedStatement::executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); ::com::sun::star::uno::Sequence< sal_Int32 > aSeq; SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ){ @@ -826,6 +883,8 @@ void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sd // ------------------------------------------------------------------------- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL java_sql_PreparedStatement::getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv ) diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 4c46666d16e8..23270f3ea3ac 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -41,6 +41,7 @@ #include "java/sql/Blob.hxx" #include "java/sql/ResultSetMetaData.hxx" #include "java/io/InputStream.hxx" +#include "java/io/Reader.hxx" #include "java/tools.hxx" #include <comphelper/property.hxx> #include "connectivity/CommonTools.hxx" @@ -232,7 +233,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get if( t.pEnv ) { // temporaere Variable initialisieren - static const char * cSignature = "(I)Ljava/io/InputStream;"; + static const char * cSignature = "(I)Ljava/io/Reader;"; static const char * cMethodName = "getCharacterStream"; // Java-Call absetzen static jmethodID mID = NULL; @@ -245,7 +246,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get } //mID } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); + return out==0 ? 0 : new java_io_Reader( t.pEnv, out ); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/kab/KConnection.cxx b/connectivity/source/drivers/kab/KConnection.cxx index 89e024163f62..1df3315f559d 100644 --- a/connectivity/source/drivers/kab/KConnection.cxx +++ b/connectivity/source/drivers/kab/KConnection.cxx @@ -322,7 +322,7 @@ Reference< XTablesSupplier > SAL_CALL KabConnection::createCatalog() return m_pAddressBook; } // ----------------------------------------------------------------------------- -extern "C" void* SAL_CALL createKabConnection( void* _pDriver ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL createKabConnection( void* _pDriver ) { KabConnection* pConnection = new KabConnection( static_cast< KabDriver* >( _pDriver ) ); // by definition, the pointer crossing library boundaries as void ptr is acquired once diff --git a/connectivity/source/drivers/kab/KDEInit.cxx b/connectivity/source/drivers/kab/KDEInit.cxx index 5903ea0084d3..3e7c69166b1b 100644 --- a/connectivity/source/drivers/kab/KDEInit.cxx +++ b/connectivity/source/drivers/kab/KDEInit.cxx @@ -115,13 +115,13 @@ namespace } // ----------------------------------------------------------------------- -extern "C" void SAL_CALL initKApplication() +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL initKApplication() { ::connectivity::kab::KDEInit::Init(); } // ----------------------------------------------------------------------- -extern "C" void SAL_CALL shutdownKApplication() +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL shutdownKApplication() { ::connectivity::kab::KDEInit::Shutdown(); } @@ -143,7 +143,7 @@ extern "C" void SAL_CALL shutdownKApplication() #i60062# / 2006-01-06 / frank.schoenheit@sun.com */ -extern "C" int SAL_CALL matchKDEVersion() +extern "C" SAL_DLLPUBLIC_EXPORT int SAL_CALL matchKDEVersion() { double nMinVersion = normalizeVersion( MIN_KDE_VERSION_MAJOR, MIN_KDE_VERSION_MINOR ); double nCurVersion = normalizeVersion( ::KDE::versionMajor(), ::KDE::versionMinor() ); diff --git a/connectivity/source/drivers/kab/KServices.cxx b/connectivity/source/drivers/kab/KServices.cxx index cc8fb9fe564c..d670ffd8fba2 100644 --- a/connectivity/source/drivers/kab/KServices.cxx +++ b/connectivity/source/drivers/kab/KServices.cxx @@ -117,7 +117,7 @@ struct ProviderRequest //--------------------------------------------------------------------------------------- -extern "C" void SAL_CALL component_getImplementationEnvironment( +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, uno_Environment ** ) @@ -126,7 +126,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" sal_Bool SAL_CALL component_writeInfo( +extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey ) @@ -151,7 +151,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( } //--------------------------------------------------------------------------------------- -extern "C" void* SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, void*) diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk index 87228f89ba8c..4ee330345625 100644 --- a/connectivity/source/drivers/kab/makefile.mk +++ b/connectivity/source/drivers/kab/makefile.mk @@ -36,6 +36,7 @@ TARGET=kab TARGET2=$(TARGET)drv ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE # --- Settings ---------------------------------- diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk index 52ab4657986f..5e4927f811fd 100644 --- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk +++ b/connectivity/source/drivers/mozab/bootstrap/makefile.mk @@ -64,7 +64,7 @@ SLOFILES += \ $(SLO)$/MMozillaBootstrap.obj \ $(SLO)$/MNSFolders.obj -.IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" +.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES" ) || ( "$(WITH_MOZILLA)" == "NO" ) || ( "$(OS)" == "MACOSX" ) CDEFS+=-DMINIMAL_PROFILEDISCOVER SHL1TARGET=$(TARGET) diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk index 6d7ce287c24c..c2f0f2220d42 100644 --- a/connectivity/source/drivers/mozab/makefile.mk +++ b/connectivity/source/drivers/mozab/makefile.mk @@ -34,11 +34,12 @@ PRJNAME=connectivity TARGET=mozab TARGET2=$(TARGET)drv -.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" +.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || ( "$(OS)" == "MACOSX" ) all: - @echo " Not building the mozabsrc stuff in OpenOffice.org build" - @echo " dependency to Mozilla developer snapshots not feasable at the moment" - @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137" + @echo " Not building the mozilla address book driver" + @echo " dependency to Mozilla developer snapshots not feasable at the moment" + @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137" + @echo " see http://www.mozilla.org/issues/show_bug.cgi?id=91209" .ENDIF #mozilla specific stuff. diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx index 9dd1815ca787..dcee418b88e5 100644 --- a/connectivity/source/drivers/mysql/YDriver.cxx +++ b/connectivity/source/drivers/mysql/YDriver.cxx @@ -68,7 +68,7 @@ namespace connectivity ODriverDelegator::ODriverDelegator(const Reference< XMultiServiceFactory >& _rxFactory) : ODriverDelegator_BASE(m_aMutex) ,m_xFactory(_rxFactory) - ,m_bUseOdbc(sal_True) + ,m_eDriverType(D_ODBC) { } @@ -78,6 +78,7 @@ namespace connectivity try { ::comphelper::disposeComponent(m_xODBCDriver); + ::comphelper::disposeComponent(m_xNativeDriver); TJDBCDrivers::iterator aIter = m_aJdbcDrivers.begin(); TJDBCDrivers::iterator aEnd = m_aJdbcDrivers.end(); for ( ;aIter != aEnd;++aIter ) @@ -112,11 +113,28 @@ namespace connectivity return _sUrl.copy(0,16).equalsAscii("sdbc:mysql:odbc:"); } //-------------------------------------------------------------------- + sal_Bool isNativeUrl(const ::rtl::OUString& _sUrl) + { + return (!_sUrl.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:mysql:mysqlc:")), sizeof("sdbc:mysql:mysqlc:")-1)); + } + //-------------------------------------------------------------------- + T_DRIVERTYPE lcl_getDriverType(const ::rtl::OUString& _sUrl) + { + T_DRIVERTYPE eRet = D_JDBC; + if ( isOdbcUrl(_sUrl ) ) + eRet = D_ODBC; + else if ( isNativeUrl(_sUrl ) ) + eRet = D_NATIVE; + return eRet; + } + //-------------------------------------------------------------------- ::rtl::OUString transformUrl(const ::rtl::OUString& _sUrl) { ::rtl::OUString sNewUrl = _sUrl.copy(11); if ( isOdbcUrl( _sUrl ) ) sNewUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:")) + sNewUrl; + else if ( isNativeUrl( _sUrl ) ) + sNewUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:")) + sNewUrl; else { sNewUrl = sNewUrl.copy(5); @@ -139,7 +157,7 @@ namespace connectivity return xDriver; } //-------------------------------------------------------------------- - Sequence< PropertyValue > lcl_convertProperties(sal_Bool _bOdbc,const Sequence< PropertyValue >& info) + Sequence< PropertyValue > lcl_convertProperties(T_DRIVERTYPE _eType,const Sequence< PropertyValue >& info,const ::rtl::OUString& _sUrl) { ::std::vector<PropertyValue> aProps; const PropertyValue* pSupported = info.getConstArray(); @@ -151,7 +169,7 @@ namespace connectivity aProps.push_back( *pSupported ); } - if ( _bOdbc ) + if ( _eType == D_ODBC ) { aProps.push_back( PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Silent")) @@ -164,7 +182,7 @@ namespace connectivity ,makeAny(sal_True) ,PropertyState_DIRECT_VALUE) ); } - else + else if ( _eType == D_JDBC ) { aProps.push_back( PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")) @@ -172,6 +190,14 @@ namespace connectivity ,makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.mysql.jdbc.Driver"))) ,PropertyState_DIRECT_VALUE) ); } + else + { + aProps.push_back( PropertyValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NewURL")) + ,0 + ,makeAny(_sUrl) + ,PropertyState_DIRECT_VALUE) ); + } aProps.push_back( PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoRetrievingEnabled")) ,0 @@ -195,20 +221,25 @@ namespace connectivity Reference< XDriver > ODriverDelegator::loadDriver( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) { Reference< XDriver > xDriver; - ::rtl::OUString sCuttedUrl = transformUrl(url); - sal_Bool bIsODBC = isOdbcUrl( url ); - if ( bIsODBC ) + const ::rtl::OUString sCuttedUrl = transformUrl(url); + const T_DRIVERTYPE eType = lcl_getDriverType( url ); + if ( eType == D_ODBC ) { if ( !m_xODBCDriver.is() ) m_xODBCDriver = lcl_loadDriver(m_xFactory,sCuttedUrl); xDriver = m_xODBCDriver; + } // if ( bIsODBC ) + else if ( eType == D_NATIVE ) + { + if ( !m_xNativeDriver.is() ) + m_xNativeDriver = lcl_loadDriver(m_xFactory,sCuttedUrl); + xDriver = m_xNativeDriver; } else { ::comphelper::NamedValueCollection aSettings( info ); ::rtl::OUString sDriverClass(RTL_CONSTASCII_USTRINGPARAM("com.mysql.jdbc.Driver")); sDriverClass = aSettings.getOrDefault( "JavaDriverClass", sDriverClass ); - ::rtl::OUString sCharSet = aSettings.getOrDefault( "CharSet", ::rtl::OUString() ); TJDBCDrivers::iterator aFind = m_aJdbcDrivers.find(sDriverClass); if ( aFind == m_aJdbcDrivers.end() ) @@ -230,9 +261,9 @@ namespace connectivity if ( xDriver.is() ) { ::rtl::OUString sCuttedUrl = transformUrl(url); - const sal_Bool bIsODBC = isOdbcUrl( url ); - Sequence< PropertyValue > aConvertedProperties = lcl_convertProperties(bIsODBC,info); - if ( !bIsODBC ) + const T_DRIVERTYPE eType = lcl_getDriverType( url ); + Sequence< PropertyValue > aConvertedProperties = lcl_convertProperties(eType,info,url); + if ( eType == D_JDBC ) { ::comphelper::NamedValueCollection aSettings( info ); ::rtl::OUString sIanaName = aSettings.getOrDefault( "CharSet", ::rtl::OUString() ); @@ -284,14 +315,13 @@ namespace connectivity //-------------------------------------------------------------------- sal_Bool SAL_CALL ODriverDelegator::acceptsURL( const ::rtl::OUString& url ) throw (SQLException, RuntimeException) { - sal_Bool bOK = sal_False; - if ( url.getLength() >= 16 ) - { - ::rtl::OUString sPrefix = url.copy(0,16); - bOK = sPrefix.equalsAscii("sdbc:mysql:odbc:"); - if ( !bOK ) - bOK = sPrefix.equalsAscii("sdbc:mysql:jdbc:"); - } + Sequence< PropertyValue > info; + + sal_Bool bOK = url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:odbc:" ) ) + || url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:jdbc:" ) ) + || ( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc:" ) ) + && loadDriver( url, info ).is() + ); return bOK; } @@ -302,8 +332,6 @@ namespace connectivity if ( !acceptsURL(url) ) return Sequence< DriverPropertyInfo >(); - sal_Bool bIsODBC = isOdbcUrl( url ); - Sequence< ::rtl::OUString > aBoolean(2); aBoolean[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0")); aBoolean[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")); @@ -323,7 +351,8 @@ namespace connectivity ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0")) ,aBoolean) ); - if ( !bIsODBC ) + const T_DRIVERTYPE eType = lcl_getDriverType( url ); + if ( eType == D_JDBC ) { aDriverInfo.push_back(DriverPropertyInfo( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")) @@ -377,6 +406,24 @@ namespace connectivity } } } + } // if ( xTunnel.is() ) + if ( !xTab.is() ) + { + TWeakPairVector::iterator aEnd = m_aConnections.end(); + for (TWeakPairVector::iterator i = m_aConnections.begin(); aEnd != i; ++i) + { + Reference< XConnection > xTemp(i->first.get(),UNO_QUERY); + if ( xTemp == connection ) + { + xTab = Reference< XTablesSupplier >(i->second.first.get().get(),UNO_QUERY); + if ( !xTab.is() ) + { + xTab = new OMySQLCatalog(connection); + i->second.first = WeakReferenceHelper(xTab); + } + break; + } + } } return xTab; } diff --git a/connectivity/source/inc/ParameterSubstitution.hxx b/connectivity/source/inc/ParameterSubstitution.hxx new file mode 100644 index 000000000000..8bf4f7682f4b --- /dev/null +++ b/connectivity/source/inc/ParameterSubstitution.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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: FDatabaseMetaDataResultSet.cxx,v $ + * $Revision: 1.24 $ + * + * 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. + * + ************************************************************************/ +#include "precompiled_connectivity.hxx" +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <cppuhelper/implbase3.hxx> + +namespace connectivity +{ + typedef ::cppu::WeakImplHelper3< ::com::sun::star::util::XStringSubstitution + ,::com::sun::star::lang::XServiceInfo + ,::com::sun::star::lang::XInitialization > ParameterSubstitution_BASE; + class ParameterSubstitution : public ParameterSubstitution_BASE + { + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XConnection > m_xConnection; + + ParameterSubstitution( const ParameterSubstitution& ); + ParameterSubstitution& operator=( const ParameterSubstitution& ); + public: + + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext); + protected: + ParameterSubstitution(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); + virtual ~ParameterSubstitution(){} + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStringSubstitution + virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& aText, ::sal_Bool bSubstRequired ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL reSubstituteVariables( const ::rtl::OUString& aText ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSubstituteVariableValue( const ::rtl::OUString& variable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + }; +// ================================== +} // connectivity +// ================================== diff --git a/connectivity/source/inc/TSkipDeletedSet.hxx b/connectivity/source/inc/TSkipDeletedSet.hxx index 4e06e90267a3..7d7e0852f381 100644 --- a/connectivity/source/inc/TSkipDeletedSet.hxx +++ b/connectivity/source/inc/TSkipDeletedSet.hxx @@ -79,11 +79,11 @@ namespace connectivity /** getMappedPosition returns the mapped position of a logical position @param - sal_Int32 _nPos the logical position + sal_Int32 _nBookmark the logical position @return the mapped position */ - sal_Int32 getMappedPosition(sal_Int32 _nPos) const; + sal_Int32 getMappedPosition(sal_Int32 _nBookmark) const; /** insertNewPosition adds a new position to the map @param @@ -101,6 +101,7 @@ namespace connectivity @return the last position */ inline sal_Int32 getLastPosition() const { return m_aBookmarksPositions.size(); } + inline void SetDeleted(bool _bDeletedVisible) { m_bDeletedVisible = _bDeletedVisible; } }; } #endif // CONNECTIVITY_SKIPDELETEDSSET_HXX diff --git a/connectivity/source/inc/mysql/YDriver.hxx b/connectivity/source/inc/mysql/YDriver.hxx index 2c8d30db8ae8..262115ea1ff5 100644 --- a/connectivity/source/inc/mysql/YDriver.hxx +++ b/connectivity/source/inc/mysql/YDriver.hxx @@ -59,6 +59,12 @@ namespace connectivity typedef ::std::pair< ::com::sun::star::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair; typedef ::std::vector< TWeakPair > TWeakPairVector; DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >,TJDBCDrivers); + typedef enum + { + D_ODBC, + D_JDBC, + D_NATIVE + } T_DRIVERTYPE; /** delegates all calls to the orignal driver and extend the existing one with the SDBCX layer. @@ -72,9 +78,10 @@ namespace connectivity // of all the Connection objects // for this Driver ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xODBCDriver; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xNativeDriver; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; ::rtl::OUString m_sOldDriverClass; - sal_Bool m_bUseOdbc; + T_DRIVERTYPE m_eDriverType; /** load the driver we want to delegate. The <member>m_xODBCDriver</member> or <member>m_xDBCDriver</member> may be <NULL/> if the driver could not be loaded. diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index c1432d90c3f8..891fd41dae3f 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1066,6 +1066,26 @@ bool OSQLParseTreeIterator::traverseGroupByColumnNames(const OSQLParseNode* pSel traverseByColumnNames( pSelectNode, sal_False ); return !hasErrors(); } + +// ----------------------------------------------------------------------------- +namespace +{ + ::rtl::OUString lcl_generateParameterName( const OSQLParseNode& _rParentNode, const OSQLParseNode& _rParamNode ) + { + ::rtl::OUString sColumnName( RTL_CONSTASCII_USTRINGPARAM( "param" ) ); + const sal_Int32 nCount = (sal_Int32)_rParentNode.count(); + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + if ( _rParentNode.getChild(i) == &_rParamNode ) + { + sColumnName += ::rtl::OUString::valueOf( i+1 ); + break; + } + } + return sColumnName; + } +} + // ----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseParameters(const OSQLParseNode* _pNode) { @@ -1081,33 +1101,34 @@ void OSQLParseTreeIterator::traverseParameters(const OSQLParseNode* _pNode) sal_uInt32 nPos = 0; if ( pParent->getChild(nPos) == _pNode ) nPos = 2; - pParent->getChild(nPos)->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); + const OSQLParseNode* pOther = pParent->getChild(nPos); + if ( SQL_ISRULE( pOther, column_ref ) ) + getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias); + else + pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); } // if ( SQL_ISRULE(pParent,comparison_predicate) ) // x = X else if ( SQL_ISRULE(pParent,like_predicate) ) { - pParent->getChild(0)->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); + const OSQLParseNode* pOther = pParent->getChild(0); + if ( SQL_ISRULE( pOther, column_ref ) ) + getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias); + else + pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); } else if ( SQL_ISRULE(pParent,between_predicate) ) { - sal_Int32 nPos = 2; - if ( pParent->getChild(3) == _pNode ) - nPos = 1; - pParent->getChild(0)->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); - sColumnName += ::rtl::OUString::valueOf(nPos); + const OSQLParseNode* pOther = pParent->getChild(0); + if ( SQL_ISRULE( pOther, column_ref ) ) + getColumnRange( pOther, sColumnName, sTableRange, aColumnAlias); + else + { + pOther->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); + lcl_generateParameterName( *pParent, *_pNode ); + } } else if ( pParent->getNodeType() == SQL_NODE_COMMALISTRULE ) { - const sal_Int32 nParamCount = (sal_Int32)pParent->count(); - for (sal_Int32 i = 0; i < nParamCount; ++i) - { - if ( pParent->getChild(i) == _pNode ) - { - static const ::rtl::OUString s_sParam(RTL_CONSTASCII_USTRINGPARAM("param")); - sColumnName = s_sParam; - sColumnName += ::rtl::OUString::valueOf(i+1); - break; - } - } + lcl_generateParameterName( *pParent, *_pNode ); } } traverseParameter( _pNode, pParent, sColumnName, sTableRange, aColumnAlias ); diff --git a/desktop/os2/source/applauncher/launcher.cxx b/desktop/os2/source/applauncher/launcher.cxx index 24bb85aa5457..a17838687a0f 100644 --- a/desktop/os2/source/applauncher/launcher.cxx +++ b/desktop/os2/source/applauncher/launcher.cxx @@ -1,118 +1,118 @@ -/*************************************************************************
- *
- * 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
- *
- * 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.
- *
- ************************************************************************/
-
-#include "launcher.hxx"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <malloc.h>
-#include <process.h>
-
-int main( int argc, char* argv[])
-{
- PPIB pib;
- APIRET rc;
- RESULTCODES result = {0};
- char szFail[ _MAX_PATH];
-
- HAB hab = WinInitialize( 0);
- HMQ hmq = WinCreateMsgQueue( hab, 0);
- ERRORID erridErrorCode = 0;
- erridErrorCode = WinGetLastError(hab);
-
- // Calculate application name
- CHAR szLibpath[_MAX_PATH*2];
- CHAR szApplicationName[_MAX_PATH];
- CHAR szDrive[_MAX_PATH];
- CHAR szDir[_MAX_PATH];
- CHAR szFileName[_MAX_PATH];
- CHAR szExt[_MAX_PATH];
-
- // get executable fullpath
- DosGetInfoBlocks(NULL, &pib);
- DosQueryModuleName(pib->pib_hmte, sizeof(szApplicationName), szApplicationName);
-
- // adjust libpath
- _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt );
- char* basedir = strstr( szDir, "\\PROGRAM\\");
- if (basedir) *basedir = 0;
- sprintf( szLibpath, "%s%s\\URE\\BIN;%s%s\\BASIS\\PROGRAM;%BeginLIBPATH%",
- szDrive, szDir, szDrive, szDir);
- DosSetExtLIBPATH( (PCSZ)szLibpath, BEGIN_LIBPATH);
- // make sure we load DLL from our path only, so multiple instances/versions
- // can be loaded.
- DosSetExtLIBPATH( (PCSZ)"T", LIBPATHSTRICT);
-
- // adjust exe name
- _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt );
- _makepath( szApplicationName, szDrive, szDir, OFFICE_IMAGE_NAME, (".bin") );
-
- // copy command line parameters
- int i, len;
- len = strlen(szApplicationName) + 1 + strlen( APPLICATION_SWITCH) + 1 + 1;
- for( i=1; i<argc; i++)
- len += strlen( argv[i]) + 1;
-
- char* pszCommandLine, *pszArgs;
- pszCommandLine = (char*) calloc( 1, len);
- strcpy( pszCommandLine, szApplicationName);
- pszArgs = pszCommandLine + strlen(szApplicationName) + 1;
- strcat( pszArgs, APPLICATION_SWITCH);
- strcat( pszArgs, " ");
- for( i=1; i<argc; i++) {
- // add quotes if argument has spaces!
- if (strchr( argv[i], ' '))
- strcat( pszArgs, "\"");
- strcat( pszArgs, argv[i]);
- if (strchr( argv[i], ' '))
- strcat( pszArgs, "\"");
- strcat( pszArgs, " ");
- }
- pszArgs[ strlen( pszArgs) + 0] = 0;
-
- // execute
- rc = DosExecPgm(szFail, sizeof(szFail),
- EXEC_SYNC, (PCSZ)pszCommandLine, (PCSZ)NULL, &result,
- (PCSZ)szApplicationName);
- if (rc) {
- char szMessage[ _MAX_PATH*2];
- sprintf( szMessage, "Execution failed! Contact technical support.\n\nReturn code: %d\nFailing module:%s\n", rc, szFail);
- rc = WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
- (PSZ)szMessage,
- (PSZ)"Unable to start OpenOffice.org!",
- 0, MB_ERROR | MB_OK);
- WinDestroyMsgQueue( hmq);
- WinTerminate( hab);
- exit(1);
- }
-
- WinDestroyMsgQueue( hmq);
- WinTerminate( hab);
-
- exit( result.codeResult);
-}
+/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#include "launcher.hxx" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <malloc.h> +#include <process.h> + +int main( int argc, char* argv[]) +{ + PPIB pib; + APIRET rc; + RESULTCODES result = {0}; + char szFail[ _MAX_PATH]; + + HAB hab = WinInitialize( 0); + HMQ hmq = WinCreateMsgQueue( hab, 0); + ERRORID erridErrorCode = 0; + erridErrorCode = WinGetLastError(hab); + + // Calculate application name + CHAR szLibpath[_MAX_PATH*2]; + CHAR szApplicationName[_MAX_PATH]; + CHAR szDrive[_MAX_PATH]; + CHAR szDir[_MAX_PATH]; + CHAR szFileName[_MAX_PATH]; + CHAR szExt[_MAX_PATH]; + + // get executable fullpath + DosGetInfoBlocks(NULL, &pib); + DosQueryModuleName(pib->pib_hmte, sizeof(szApplicationName), szApplicationName); + + // adjust libpath + _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt ); + char* basedir = strstr( szDir, "\\PROGRAM\\"); + if (basedir) *basedir = 0; + sprintf( szLibpath, "\"%s%s\\URE\\BIN\";\"%s%s\\BASIS\\PROGRAM\";%BeginLIBPATH%", + szDrive, szDir, szDrive, szDir); + DosSetExtLIBPATH( (PCSZ)szLibpath, BEGIN_LIBPATH); + // make sure we load DLL from our path only, so multiple instances/versions + // can be loaded. + DosSetExtLIBPATH( (PCSZ)"T", LIBPATHSTRICT); + + // adjust exe name + _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt ); + _makepath( szApplicationName, szDrive, szDir, OFFICE_IMAGE_NAME, (".bin") ); + + // copy command line parameters + int i, len; + len = strlen(szApplicationName) + 1 + strlen( APPLICATION_SWITCH) + 1 + 1; + for( i=1; i<argc; i++) + len += strlen( argv[i]) + 1; + + char* pszCommandLine, *pszArgs; + pszCommandLine = (char*) calloc( 1, len); + strcpy( pszCommandLine, szApplicationName); + pszArgs = pszCommandLine + strlen(szApplicationName) + 1; + strcat( pszArgs, APPLICATION_SWITCH); + strcat( pszArgs, " "); + for( i=1; i<argc; i++) { + // add quotes if argument has spaces! + if (strchr( argv[i], ' ')) + strcat( pszArgs, "\""); + strcat( pszArgs, argv[i]); + if (strchr( argv[i], ' ')) + strcat( pszArgs, "\""); + strcat( pszArgs, " "); + } + pszArgs[ strlen( pszArgs) + 0] = 0; + + // execute + rc = DosExecPgm(szFail, sizeof(szFail), + EXEC_SYNC, (PCSZ)pszCommandLine, (PCSZ)NULL, &result, + (PCSZ)szApplicationName); + if (rc) { + char szMessage[ _MAX_PATH*2]; + sprintf( szMessage, "Execution failed! Contact technical support.\n\nReturn code: %d\nFailing module:%s\n", rc, szFail); + rc = WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, + (PSZ)szMessage, + (PSZ)"Unable to start OpenOffice.org!", + 0, MB_ERROR | MB_OK); + WinDestroyMsgQueue( hmq); + WinTerminate( hab); + exit(1); + } + + WinDestroyMsgQueue( hmq); + WinTerminate( hab); + + exit( result.codeResult); +} diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 3bf38d1e2b61..e87701b4addf 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -154,21 +154,26 @@ static bool configureUcb(bool bServer, rtl::OUString const & rPortalConnect) Reference<XContentProviderManager> xCPM = cb->getContentProviderManagerInterface(); #if 0 + try + { - Reference<XContentProviderFactory> xCPF( - xServiceFactory->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.ucb.ContentProviderProxyFactory")), - UNO_QUERY); - if(xCPF.is()) - xCPM->registerContentProvider( - xCPF->createContentProvider( + Reference<XContentProviderFactory> xCPF( + xServiceFactory->createInstance( rtl::OUString::createFromAscii( - "com.sun.star.ucb.GnomeVFSContentProvider" - ) - ), - rtl::OUString::createFromAscii(".*"), - false); + "com.sun.star.ucb.ContentProviderProxyFactory")), + UNO_QUERY); + if(xCPF.is()) + xCPM->registerContentProvider( + xCPF->createContentProvider( + rtl::OUString::createFromAscii( + "com.sun.star.ucb.GnomeVFSContentProvider" + ) + ), + rtl::OUString::createFromAscii(".*"), + false); + } catch (...) + { + } #else // Workaround for P1 #124597#. Instanciate GNOME-VFS-UCP in the thread that initialized @@ -176,18 +181,23 @@ static bool configureUcb(bool bServer, rtl::OUString const & rPortalConnect) // a different thread. The latter may happen when calling the Office remotely via UNO. // THIS IS NOT A FIX, JUST A WORKAROUND! - Reference<XContentProvider> xCP( - xServiceFactory->createInstance( - rtl::OUString::createFromAscii( - "com.sun.star.ucb.GnomeVFSContentProvider")), - UNO_QUERY); - if(xCP.is()) - xCPM->registerContentProvider( - xCP, - rtl::OUString::createFromAscii(".*"), - false); -#endif + try + { + Reference<XContentProvider> xCP( + xServiceFactory->createInstance( + rtl::OUString::createFromAscii( + "com.sun.star.ucb.GnomeVFSContentProvider")), + UNO_QUERY); + if(xCP.is()) + xCPM->registerContentProvider( + xCP, + rtl::OUString::createFromAscii(".*"), + false); + } catch (...) + { + } } +#endif } } catch (RuntimeException e) { } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 13e3f66a8347..63c6bcc32388 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -378,7 +378,7 @@ public: //------------------------------------------------------------------------------ ExtensionBox_Impl::ExtensionBox_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) : - IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP ), + IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ), m_bHasScrollBar( false ), m_bHasActive( false ), m_bNeedsRecalc( true ), diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index b72c5e231647..afd44f83cff6 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -1009,6 +1009,12 @@ PackageManagerImpl::getDeployedPackages_( OSL_ENSURE( 0, ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); } + catch (deployment::DeploymentException& exc) { + // ignore + (void) exc; // avoid warnings + OSL_ENSURE( 0, ::rtl::OUStringToOString( + exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + } } return comphelper::containerToSequence(packages); } diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index e17d60ce9ab5..e39f5e80fc31 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -75,6 +75,7 @@ #include "com/sun/star/deployment/XPackageManager.hpp" #include <vector> +#include <stdio.h> using namespace ::dp_misc; @@ -251,6 +252,18 @@ public: using ImplBaseT::disposing; }; +//Used to find a XPackage with a particular URL +class XPackage_eq : public std::unary_function<Reference<deployment::XPackage>, bool> +{ + OUString m_URL; +public: + explicit XPackage_eq(const OUString & s) : m_URL(s) {} + bool operator() (const Reference<deployment::XPackage> & p) const + { + return m_URL.equals(p->getURL()); + } +}; + //______________________________________________________________________________ BackendImpl::BackendImpl( Sequence<Any> const & args, @@ -896,7 +909,7 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) } if (sDescription.getLength()) return sDescription; - else if(m_oldDescription.getLength() == 0) + else if(m_oldDescription.getLength()) return m_oldDescription; else return OUString(); @@ -1362,10 +1375,20 @@ void BackendImpl::PackageImpl::scanBundle( checkAborted( abortChannel ); - const Reference<deployment::XPackage> xPackage( - bindBundleItem( url, mediaType, xCmdEnv ) ); - if (xPackage.is()) - bundle.push_back( xPackage ); + //We make sure that we only create one XPackage for a particular URL. + //Sometime programmers insert the same URL several times in the manifest + //which may lead to DisposedExceptions. + if (bundle.end() == std::find_if(bundle.begin(), bundle.end(), XPackage_eq(url))) + { + const Reference<deployment::XPackage> xPackage( + bindBundleItem( url, mediaType, xCmdEnv ) ); + if (xPackage.is()) + bundle.push_back( xPackage ); + } + else + { + fprintf(stderr, "manifest.xml contains a duplicate entry!\n"); + } } if (descrFile.getLength() > 0) diff --git a/desktop/source/pagein/makefile.mk b/desktop/source/pagein/makefile.mk index 85fb5169be08..729d460b3652 100644 --- a/desktop/source/pagein/makefile.mk +++ b/desktop/source/pagein/makefile.mk @@ -43,6 +43,8 @@ LIBSALCPPRT=$(0) .INCLUDE : settings.mk +.INCLUDE .IGNORE : icuversion.mk + # --- Files -------------------------------------------------------- OBJFILES= \ @@ -70,11 +72,13 @@ ALL: \ .INCLUDE : target.mk -ICUDLLPOST=$(DLLPOST).26 +ICUDLLPOST=$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) UDKDLLPOST=$(DLLPOST).$(UDK_MAJOR) UNODLLPOST=.uno$(DLLPOST) DFTDLLPOST=$(DLLPOSTFIX)$(DLLPOST) # Default +URELIBPATH=..$/ure-link$/lib + $(MISC)$/$(TARGET)-calc : makefile.mk @echo Making: $@ @-echo $(DLLPRE)sc$(DFTDLLPOST) > $@ @@ -95,39 +99,63 @@ $(MISC)$/$(TARGET)-writer : makefile.mk @-echo $(DLLPRE)sw$(DFTDLLPOST) > $@ @-echo $(DLLPRE)svx$(DFTDLLPOST) >> $@ -# sorted in reverse load order (ld.so.1) +# sorted in approx. reverse load order (ld.so.1) $(MISC)$/$(TARGET)-common : makefile.mk @echo Making: $@ - @-echo $(DLLPRE)icui18n$(ICUDLLPOST) > $@ - @-echo i18npool$(UNODLLPOST) >> $@ + @-echo i18npool$(UNODLLPOST) > $@ +.IF "$(SYSTEM_ICU)" != "YES" + @-echo $(DLLPRE)icui18n$(ICUDLLPOST) >> $@ + @-echo $(DLLPRE)icule$(ICUDLLPOST) >> $@ + @-echo $(DLLPRE)icuuc$(ICUDLLPOST) >> $@ + @-echo $(DLLPRE)icudata$(ICUDLLPOST) >> $@ +.ENDIF # SYSTEM_ICU # - @-echo $(DLLPRE)xcr$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)lng$(DFTDLLPOST) >> $@ @-echo $(DLLPRE)xo$(DFTDLLPOST) >> $@ - @-echo $(DLLPRE)go$(DFTDLLPOST) >> $@ - @-echo $(DLLPRE)sb$(DFTDLLPOST) >> $@ - @-echo $(DLLPRE)sfx$(DFTDLLPOST) >> $@ # + @-echo $(DLLPRE)fwe$(DFTDLLPOST) >> $@ @-echo $(DLLPRE)fwk$(DFTDLLPOST) >> $@ - @-echo $(DLLPRE)ucpfile1$(DLLPOST) >> $@ @-echo $(DLLPRE)fwi$(DFTDLLPOST) >> $@ @-echo $(DLLPRE)fwl$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)package2$(DLLPOST) >> $@ + @-echo $(DLLPRE)ucpfile1$(DLLPOST) >> $@ + @-echo $(DLLPRE)ucb1$(DLLPOST) >> $@ @-echo configmgr2$(UNODLLPOST) >> $@ # - @-echo $(DLLPRE)icuuc$(ICUDLLPOST) >> $@ - @-echo $(DLLPRE)sot$(DFTDLLPOST) >> $@ - @-echo $(DLLPRE)psp$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)dtransX11$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)vclplug_gen$(DFTDLLPOST) >> $@ +.IF "$(ENABLE_GTK)" != "" + @-echo $(DLLPRE)vclplug_gtk$(DFTDLLPOST) >> $@ +.ENDIF # ENABLE_GTK +.IF "$(ENABLE_KDE)" != "" + @-echo $(DLLPRE)vclplug_kde$(DFTDLLPOST) >> $@ +.ENDIF # ENABLE_KDE +# + @-echo $(DLLPRE)psp$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)basegfx$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)sot$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)xcr$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)sb$(DFTDLLPOST) >> $@ +# +# uno runtime environment +# + @-echo $(URELIBPATH)$/stocservices$(UNODLLPOST) >> $@ + @-echo $(URELIBPATH)$/bootstrap$(UNODLLPOST) >> $@ + @-echo $(URELIBPATH)$/$(DLLPRE)reg$(UDKDLLPOST) >> $@ + @-echo $(URELIBPATH)$/$(DLLPRE)store$(UDKDLLPOST) >> $@ .IF "$(USE_SYSTEM_STL)"!="YES" .IF "$(COMNAME)" == "gcc2" || "$(COMNAME)" == "gcc3" - @-echo $(DLLPRE)stlport_gcc$(DLLPOST) >> $@ + @-echo $(URELIBPATH)$/$(DLLPRE)stlport_gcc$(DLLPOST) >> $@ .ENDIF # gcc .IF "$(COMNAME)" == "sunpro5" - @-echo $(DLLPRE)stlport_sunpro$(DLLPOST) >> $@ + @-echo $(URELIBPATH)$/$(DLLPRE)stlport_sunpro$(DLLPOST) >> $@ .ENDIF # sunpro5 -.ENDIF - @-echo $(DLLPRE)uno_sal$(UDKDLLPOST) >> $@ - @-echo $(DLLPRE)uno_cppu$(UDKDLLPOST) >> $@ - @-echo $(DLLPRE)uno_cppuhelper$(COMID)$(UDKDLLPOST) >> $@ +.ENDIF # SYSTEM_STL + @-echo $(URELIBPATH)$/$(DLLPRE)uno_cppuhelper$(COMID)$(UDKDLLPOST) >> $@ + @-echo $(URELIBPATH)$/$(DLLPRE)uno_cppu$(UDKDLLPOST) >> $@ + @-echo $(URELIBPATH)$/$(DLLPRE)uno_sal$(UDKDLLPOST) >> $@ +# @-echo $(DLLPRE)ucbhelper$(UCBHELPER_MAJOR)$(COMID)$(DLLPOST) >> $@ @-echo $(DLLPRE)comphelp$(COMPHLP_MAJOR)$(COMID)$(DLLPOST) >> $@ @-echo $(DLLPRE)tl$(DFTDLLPOST) >> $@ @@ -136,4 +164,5 @@ $(MISC)$/$(TARGET)-common : makefile.mk @-echo $(DLLPRE)vcl$(DFTDLLPOST) >> $@ @-echo $(DLLPRE)tk$(DFTDLLPOST) >> $@ @-echo $(DLLPRE)svt$(DFTDLLPOST) >> $@ - @-echo soffice.bin >> $@ + @-echo $(DLLPRE)sfx$(DFTDLLPOST) >> $@ + @-echo $(DLLPRE)sofficeapp$(DLLPOST) >> $@ diff --git a/desktop/source/pkgchk/unopkg/makefile.mk b/desktop/source/pkgchk/unopkg/makefile.mk index 3562fad961d9..96f9c6e0a771 100644 --- a/desktop/source/pkgchk/unopkg/makefile.mk +++ b/desktop/source/pkgchk/unopkg/makefile.mk @@ -51,7 +51,13 @@ CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) APP1TARGET = so$/unopkg APP1OBJS = $(OBJFILES) -APP1STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) +APP1STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) \ + $(CPPULIB) $(CPPUHELPERLIB) $(COMPHELPERLIB) \ + $(UCBHELPERLIB) $(UNOTOOLSLIB) $(TOOLSLIB) $(VCLLIB) \ + $(DEPLOYMENTMISCLIB) $(BASEGFXLIB) $(I18NISOLANGLIB) \ + $(SOLTLIB) $(ICUUCLIB) $(ICUDATALIB) $(ICULELIB) \ + $(JVMACCESSLIB) $(XMLSCRIPTLIB) $(SALHELPERLIB) \ + $(VOSLIB) $(SOTLIB) $(I18NUTILLIB) $(BERKELEYLIB) APP1DEPN = $(SHL1TARGETN) APP1NOSAL = TRUE APP1RPATH = BRAND @@ -62,7 +68,14 @@ APP1LINKRES = $(MISC)$/$(TARGET)1.res APP2TARGET = unopkg APP2OBJS = $(OBJFILES) -APP2STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) +APP2STDLIBS = $(SALLIB) $(UNOPKGAPPLIB) \ + $(CPPULIB) $(CPPUHELPERLIB) $(COMPHELPERLIB) \ + $(UCBHELPERLIB) $(UNOTOOLSLIB) $(TOOLSLIB) \ + $(VCLLIB) $(BASEGFXLIB) $(I18NISOLANGLIB) \ + $(SOLTLIB) $(ICUUCLIB) $(ICUDATALIB) $(ICULELIB) \ + $(JVMACCESSLIB) $(SALHELPERLIB) \ + $(VOSLIB) $(SOTLIB) $(I18NUTILLIB) \ + $(DEPLOYMENTMISCLIB) $(BERKELEYLIB) $(XMLSCRIPTLIB) APP2DEPN = $(SHL1TARGETN) APP2NOSAL = TRUE APP2RPATH = BRAND @@ -83,6 +96,7 @@ SHL1STDLIBS = \ $(TOOLSLIB) \ $(VCLLIB) \ $(DEPLOYMENTMISCLIB) + SHL1VERSIONMAP = version.map SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) diff --git a/desktop/test/deployment/options/leaf1mod.oxt b/desktop/test/deployment/options/leaf1mod.oxt Binary files differnew file mode 100644 index 000000000000..d5d9fe6896f8 --- /dev/null +++ b/desktop/test/deployment/options/leaf1mod.oxt diff --git a/desktop/test/deployment/options/readme.txt b/desktop/test/deployment/options/readme.txt index da576203972d..9879a72ceffa 100644 --- a/desktop/test/deployment/options/readme.txt +++ b/desktop/test/deployment/options/readme.txt @@ -8,6 +8,11 @@ extensionoptions.jar into the extension. leaf1.oxt: Defines a leaf under the node WriterNode ================================================================================ +leaf1mod.oxt: Defines a leaf under the node WriterNode + +It has a douplicate entry in the manifest.xml (OptionsDialog.xcu). This would cause a DisposedException when uninstalling on OOo 3.0 and prevent the extension from being uninstalled. This is actually a bug of the extensions. However, the error is difficult to investigate. Therefore this was fixed to make OOo more robust (i96690). +================================================================================ + leaf2.oxt: Defines a leaf under a node that has a name which requires special "xml encoding". The name is "My Writer's & Settings". The node is not assigned to a Module and the Node/AllModules property is not true. This is a typical diff --git a/desktop/test/deployment/update/defect/update/info2.update.xml b/desktop/test/deployment/update/defect/update/info2.update.xml index 23647e1d53f1..1446608022f0 100644 --- a/desktop/test/deployment/update/defect/update/info2.update.xml +++ b/desktop/test/deployment/update/defect/update/info2.update.xml @@ -1 +1 @@ -This is a invalid update information file!!!
\ No newline at end of file +This is a invalid update information file!!! diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc index 3cd650ad7c59..6ee59c891bf0 100644 --- a/desktop/win32/source/guistdio/guistdio.inc +++ b/desktop/win32/source/guistdio/guistdio.inc @@ -45,6 +45,8 @@ #include <stdlib.h> #include <systools/win32/uwinapi.h> +#include <stdio.h> + //--------------------------------------------------------------------------- // Thread that reads from child process standard output pipe //--------------------------------------------------------------------------- @@ -214,9 +216,7 @@ DWORD WINAPI WaitForUIThread( LPVOID pParam ) #ifndef UNOPKG if ( !_tgetenv( TEXT("UNOPKG") ) ) WaitForInputIdle( hProcess, INFINITE ); - else #endif - WaitForSingleObject( hProcess, INFINITE ); return 0; } @@ -353,17 +353,19 @@ int _tmain( int, _TCHAR ** ) HANDLE hWaitForUIThread = CreateThread( NULL, 0, WaitForUIThread, (LPVOID)aProcessInfo.hProcess, 0, &dwWaitForUIThreadId ); DWORD dwWaitResult; - bool bDetach = false; - int nOpenPipes = 3; HANDLE hObjects[] = { hTargetProcess, hWaitForUIThread, - hInputThread, hOutputThread, hErrorThread }; + #ifdef UNOPKG + dwWaitResult = WaitForMultipleObjects( elementsof(hObjects), hObjects, TRUE, INFINITE ); + #else + bool bDetach = false; + int nOpenPipes = 2; do { dwWaitResult = WaitForMultipleObjects( elementsof(hObjects), hObjects, FALSE, INFINITE ); @@ -374,9 +376,8 @@ int _tmain( int, _TCHAR ** ) case WAIT_OBJECT_0 + 1: // The child process entered input idle bDetach = true; break; - case WAIT_OBJECT_0 + 2: // The remote end of stdin pipe was closed - case WAIT_OBJECT_0 + 3: // The remote end of stdout pipe was closed - case WAIT_OBJECT_0 + 4: // The remote end of stderr pipe was closed + case WAIT_OBJECT_0 + 2: // The remote end of stdout pipe was closed + case WAIT_OBJECT_0 + 3: // The remote end of stderr pipe was closed bDetach = --nOpenPipes <= 0; break; default: // Something went wrong @@ -385,15 +386,8 @@ int _tmain( int, _TCHAR ** ) } } while( !bDetach ); - //Even if the child process terminates it is not garanteed that all three pipe threads terminate - //as tests have proven. The loop above will be typically terminate because the process has - //terminated. Then the pipe threads may not have read all data from the pipes yet. When we close - //the threads then data may be lost. For example running unopkg without arguments shall print out - //the help text. Without this workaround some text would be missing. - //ifdef only for unopkg -#ifdef UNOPKG - Sleep(1000); -#endif +#endif + CloseHandle( hOutputThread ); CloseHandle( hErrorThread ); CloseHandle( hInputThread ); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 9e3e322a3ac4..d9d784f56b41 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -89,18 +89,19 @@ #define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38) #define PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 39) #define PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 40) -#define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41) -#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42) -#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43) -#define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44) -#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45) -#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46) -#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47) -#define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48) -#define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49) -#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) -#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) -#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) +#define PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41) +#define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42) +#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43) +#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44) +#define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45) +#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46) +#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47) +#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48) +#define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49) +#define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) +#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) +#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52) +#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 4a7b300ecfb1..69023873760a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -198,6 +198,9 @@ namespace drawinglayer // compare operator virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + // get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + // provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx index dd707c0f7d71..1160704c0fa3 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx @@ -164,6 +164,31 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +namespace drawinglayer +{ + namespace primitive2d + { + // #i97628# + // Primitive to encapsulate text from an active text edit; some + // renderers need to suppress this output due to painting the + // edited text in e.g. an OutlinerEditView. It's derived from + // GroupPrimitive2D, so the implicit decomposition will use the + // content. To suppress, this primitive needs to be parsed by + // the renderer without taking any action + class TextHierarchyEditPrimitive2D : public GroupPrimitive2D + { + private: + public: + TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren); + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx index bcbc8c67f847..772e030781fe 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX #include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <com/sun/star/drawing/TextureProjectionMode.hpp> #include <vector> ////////////////////////////////////////////////////////////////////////////// @@ -62,6 +63,20 @@ namespace drawinglayer { namespace primitive3d { + // #i98295# + basegfx::B3DRange getRangeFrom3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + void applyNormalsKindSphereTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill, const basegfx::B3DRange& rRange); + void applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + void applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill); + + // #i98314# + void applyTextureTo3DGeometry( + ::com::sun::star::drawing::TextureProjectionMode eModeX, + ::com::sun::star::drawing::TextureProjectionMode eModeY, + ::std::vector< basegfx::B3DPolyPolygon >& rFill, + const basegfx::B3DRange& rRange, + const basegfx::B2DVector& rTextureSize); + Primitive3DSequence create3DPolyPolygonLinePrimitives( const basegfx::B3DPolyPolygon& rUnitPolyPolygon, const basegfx::B3DHomMatrix& rObjectTransform, diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index 82c7f4824af4..e29b413190ab 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -96,7 +96,7 @@ namespace drawinglayer // common VCL rendering support void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); - void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate); + void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased); void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate); void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate); diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 14352c4a8595..4faa85fe898c 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -186,7 +186,7 @@ namespace drawinglayer if(bWaveLine) { eLineJoin = basegfx::B2DLINEJOIN_ROUND; - fLineHeight *= 0.5; + fLineHeight *= 0.25; } // prepare Line and Stroke Attributes @@ -215,7 +215,7 @@ namespace drawinglayer if(bWaveLine) { - double fWaveWidth(4.0 * fLineHeight); + double fWaveWidth(10.6 * fLineHeight); if(FONT_UNDERLINE_SMALLWAVE == eLineStyle) { @@ -227,7 +227,7 @@ namespace drawinglayer fWaveWidth *= 2.0; } - aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, 0.5 * fWaveWidth)); + aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aLine, aLineAttribute, aStrokeAttribute, fWaveWidth, fWaveWidth * 0.5)); } else { @@ -241,7 +241,13 @@ namespace drawinglayer { // double line, create 2nd primitive with offset using TransformPrimitive based on // already created NewPrimitive - const double fLineDist((bWaveLine ? 3.0 : 2.0) * fLineHeight); + double fLineDist(2.3 * fLineHeight); + + if(bWaveLine) + { + fLineDist = 6.3 * fLineHeight; + } + basegfx::B2DHomMatrix aTransform; // move base point of text to 0.0 and de-rotate @@ -482,6 +488,16 @@ namespace drawinglayer // init word iterator, get first word and truncate to possibilities ::com::sun::star::i18n::Boundary aNextWordBoundary(xLocalBreakIterator->getWordBoundary( getText(), getTextPosition(), getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True)); + + if(aNextWordBoundary.endPos == getTextPosition() && getTextLength() > 0) + { + // #i96474# + // a word before was found (this can happen when search starts on a whitespace and a word + // in front of it exists), force to look one position further + aNextWordBoundary = xLocalBreakIterator->getWordBoundary( + getText(), getTextPosition() + 1, getLocale(), ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True); + } + impCorrectTextBoundary(aNextWordBoundary); // prepare new font attributes WITHOUT outline @@ -791,6 +807,33 @@ namespace drawinglayer return false; } + // #i96475# + // Added missing implementation. Decorations may (will) stick out of the text's + // inking area, so add them if needed + basegfx::B2DRange TextDecoratedPortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + const bool bDecoratedIsNeeded( + FONT_UNDERLINE_NONE != getFontOverline() + || FONT_UNDERLINE_NONE != getFontUnderline() + || FONT_STRIKEOUT_NONE != getFontStrikeout() + || FONT_EMPHASISMARK_NONE != getFontEmphasisMark() + || FONT_RELIEF_NONE != getFontRelief() + || getShadow()); + + if(bDecoratedIsNeeded) + { + // decoration is used, fallback to BasePrimitive2D::getB2DRange which uses + // the own local decomposition for computation and thus creates all necessary + // geometric objects + return BasePrimitive2D::getB2DRange(rViewInformation); + } + else + { + // no relevant decoration used, fallback to TextSimplePortionPrimitive2D::getB2DRange + return TextSimplePortionPrimitive2D::getB2DRange(rViewInformation); + } + } + // provide unique ID ImplPrimitrive2DIDBlock(TextDecoratedPortionPrimitive2D, PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D) diff --git a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx index 7148a004a595..72249e673c1b 100644 --- a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx @@ -146,4 +146,21 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TextHierarchyEditPrimitive2D, PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// // eof diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index 241d02926cc1..df682ab04e6f 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -64,6 +64,93 @@ namespace drawinglayer { namespace primitive3d { + basegfx::B3DRange getRangeFrom3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) + { + basegfx::B3DRange aRetval; + + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + aRetval.expand(basegfx::tools::getRange(rFill[a])); + } + + return aRetval; + } + + void applyNormalsKindSphereTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill, const basegfx::B3DRange& rRange) + { + // create sphere normals + const basegfx::B3DPoint aCenter(rRange.getCenter()); + + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::applyDefaultNormalsSphere(rFill[a], aCenter); + } + } + + void applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) + { + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + rFill[a].clearNormals(); + } + } + + void applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) + { + // invert normals + for(sal_uInt32 a(0); a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::invertNormals(rFill[a]); + } + } + + void applyTextureTo3DGeometry( + ::com::sun::star::drawing::TextureProjectionMode eModeX, + ::com::sun::star::drawing::TextureProjectionMode eModeY, + ::std::vector< basegfx::B3DPolyPolygon >& rFill, + const basegfx::B3DRange& rRange, + const basegfx::B2DVector& rTextureSize) + { + sal_uInt32 a; + + // handle texture coordinates X + const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == eModeX); + const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == eModeX)); + + // handle texture coordinates Y + const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == eModeY); + const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == eModeY)); + + if(bParallelX || bParallelY) + { + // apply parallel texture coordinates in X and/or Y + for(a = 0; a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(rFill[a], rRange, bParallelX, bParallelY); + } + } + + if(bSphereX || bSphereY) + { + // apply spherical texture coordinates in X and/or Y + const basegfx::B3DPoint aCenter(rRange.getCenter()); + + for(a = 0; a < rFill.size(); a++) + { + rFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(rFill[a], aCenter, bSphereX, bSphereY); + } + } + + // transform texture coordinates to texture size + basegfx::B2DHomMatrix aTexMatrix; + aTexMatrix.scale(rTextureSize.getX(), rTextureSize.getY()); + + for(a = 0; a < rFill.size(); a++) + { + rFill[a].transformTextureCoordiantes(aTexMatrix); + } + } + Primitive3DSequence create3DPolyPolygonLinePrimitives( const basegfx::B3DPolyPolygon& rUnitPolyPolygon, const basegfx::B3DHomMatrix& rObjectTransform, diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index a83147da5022..e9ef154c95f3 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -67,10 +67,10 @@ namespace drawinglayer if(rSliceVector.size()) { sal_uInt32 a; - basegfx::B3DRange aRange; // decide what to create - const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()); + const ::com::sun::star::drawing::NormalsKind eNormalsKind(getSdr3DObjectAttribute().getNormalsKind()); + const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == eNormalsKind); const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX()); const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); double fRelativeTextureWidth(1.0); @@ -103,82 +103,35 @@ namespace drawinglayer 0.5, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform); // get full range - for(a = 0L; a < aFill.size(); a++) - { - aRange.expand(basegfx::tools::getRange(aFill[a])); - } + const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation if(getSdrLFSAttribute().getFill()) { - if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) + if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { - // create sphere normals - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); - } + applyNormalsKindSphereTo3DGeometry(aFill, aRange); } - else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) + else if(::com::sun::star::drawing::NormalsKind_FLAT == eNormalsKind) { - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].clearNormals(); - } + applyNormalsKindFlatTo3DGeometry(aFill); } if(getSdr3DObjectAttribute().getNormalsInvert()) { - // invert normals - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::invertNormals(aFill[a]); - } + applyNormalsInvertTo3DGeometry(aFill); } } // texture coordinates if(getSdrLFSAttribute().getFill()) { - // handle texture coordinates X - const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); - const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX())); - - // handle texture coordinates Y - const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY()); - const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY())); - - if(bParallelX || bParallelY) - { - // apply parallel texture coordinates in X and/or Y - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); - } - } - - if(bSphereX || bSphereY) - { - // apply spherical texture coordinates in X and/or Y - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); - } - } - - // transform texture coordinates to texture size - basegfx::B2DHomMatrix aTexMatrix; - aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].transformTextureCoordiantes(aTexMatrix); - } + applyTextureTo3DGeometry( + getSdr3DObjectAttribute().getTextureProjectionX(), + getSdr3DObjectAttribute().getTextureProjectionY(), + aFill, + aRange, + getTextureSize()); } if(getSdrLFSAttribute().getFill()) diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index f51aa3a85e24..33008e762c0a 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -69,10 +69,10 @@ namespace drawinglayer const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0)); const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI)); sal_uInt32 a; - basegfx::B3DRange aRange; // decide what to create - const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind()); + const ::com::sun::star::drawing::NormalsKind eNormalsKind(getSdr3DObjectAttribute().getNormalsKind()); + const bool bCreateNormals(::com::sun::star::drawing::NormalsKind_SPECIFIC == eNormalsKind); const bool bCreateTextureCoordiantesX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionX()); const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); basegfx::B2DHomMatrix aTexTransform; @@ -96,82 +96,35 @@ namespace drawinglayer 0.85, 0.6, bCreateTextureCoordiantesX || bCreateTextureCoordiantesY, aTexTransform); // get full range - for(a = 0L; a < aFill.size(); a++) - { - aRange.expand(basegfx::tools::getRange(aFill[a])); - } + const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation if(getSdrLFSAttribute().getFill()) { - if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) + if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { - // create sphere normals - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultNormalsSphere(aFill[a], aCenter); - } + applyNormalsKindSphereTo3DGeometry(aFill, aRange); } - else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) + else if(::com::sun::star::drawing::NormalsKind_FLAT == eNormalsKind) { - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].clearNormals(); - } + applyNormalsKindFlatTo3DGeometry(aFill); } if(getSdr3DObjectAttribute().getNormalsInvert()) { - // invert normals - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::invertNormals(aFill[a]); - } + applyNormalsInvertTo3DGeometry(aFill); } } // texture coordinates if(getSdrLFSAttribute().getFill()) { - // handle texture coordinates X - const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); - const bool bSphereX(!bParallelX && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionX())); - - // handle texture coordinates Y - const bool bParallelY(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionY()); - const bool bSphereY(!bParallelY && (::com::sun::star::drawing::TextureProjectionMode_SPHERE == getSdr3DObjectAttribute().getTextureProjectionY())); - - if(bParallelX || bParallelY) - { - // apply parallel texture coordinates in X and/or Y - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesParallel(aFill[a], aRange, bParallelX, bParallelY); - } - } - - if(bSphereX || bSphereY) - { - // apply spherical texture coordinates in X and/or Y - const basegfx::B3DPoint aCenter(aRange.getCenter()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a] = basegfx::tools::applyDefaultTextureCoordinatesSphere(aFill[a], aCenter, bSphereX, bSphereY); - } - } - - // transform texture coordinates to texture size - basegfx::B2DHomMatrix aTexMatrix; - aTexMatrix.scale(getTextureSize().getX(), getTextureSize().getY()); - - for(a = 0L; a < aFill.size(); a++) - { - aFill[a].transformTextureCoordiantes(aTexMatrix); - } + applyTextureTo3DGeometry( + getSdr3DObjectAttribute().getTextureProjectionX(), + getSdr3DObjectAttribute().getTextureProjectionY(), + aFill, + aRange, + getTextureSize()); } if(getSdrLFSAttribute().getFill()) diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index e27b8b43fe93..a0813d3202a8 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -62,6 +62,38 @@ namespace drawinglayer ::std::vector< basegfx::B3DPolyPolygon > aFill; aFill.push_back(getPolyPolygon3D()); + // get full range + const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); + + // #i98295# normal creation + if(getSdrLFSAttribute().getFill()) + { + if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) + { + applyNormalsKindSphereTo3DGeometry(aFill, aRange); + } + else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind()) + { + applyNormalsKindFlatTo3DGeometry(aFill); + } + + if(getSdr3DObjectAttribute().getNormalsInvert()) + { + applyNormalsInvertTo3DGeometry(aFill); + } + } + + // #i98314# texture coordinates + if(getSdrLFSAttribute().getFill()) + { + applyTextureTo3DGeometry( + getSdr3DObjectAttribute().getTextureProjectionX(), + getSdr3DObjectAttribute().getTextureProjectionY(), + aFill, + aRange, + getTextureSize()); + } + if(getSdrLFSAttribute().getFill()) { // add fill diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx index dd1f5e1b9ed1..1488cd4fd054 100644 --- a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx +++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx @@ -158,20 +158,56 @@ namespace drawinglayer basegfx::fround(aOutlineRange.getMaxX()), basegfx::fround(aOutlineRange.getMaxY())); const Rectangle aDestRectPixel(rOutDev.LogicToPixel(aDestRectLogic)); - // intersect with output pixel size + // #i96708# check if Metafile is recorded + const GDIMetaFile* pMetaFile = rOutDev.GetConnectMetaFile(); + const bool bRecordToMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); + + // intersect with output pixel size, but only + // when not recording to metafile const Rectangle aOutputRectPixel(Point(), rOutDev.GetOutputSizePixel()); - const Rectangle aCroppedRectPixel(aDestRectPixel.GetIntersection(aOutputRectPixel)); + Rectangle aCroppedRectPixel(bRecordToMetaFile ? aDestRectPixel : aDestRectPixel.GetIntersection(aOutputRectPixel)); if(!aCroppedRectPixel.IsEmpty()) { + // as maximum for destination, orientate at SourceSizePixel, but + // take a rotation of 45 degrees (sqrt(2)) as maximum expansion into account + const Size aSourceSizePixel(rBitmapEx.GetSizePixel()); + const double fMaximumArea( + (double)aSourceSizePixel.getWidth() * + (double)aSourceSizePixel.getHeight() * + 1.4142136); // 1.4142136 taken as sqrt(2.0) + + // test if discrete view size (pixel) maybe too big and limit it + const double fArea(aCroppedRectPixel.getWidth() * aCroppedRectPixel.getHeight()); + const bool bNeedToReduce(fArea > fMaximumArea); + double fReduceFactor(1.0); + + if(bNeedToReduce) + { + fReduceFactor = sqrt(fMaximumArea / fArea); + aCroppedRectPixel.setWidth(basegfx::fround(aCroppedRectPixel.getWidth() * fReduceFactor)); + aCroppedRectPixel.setHeight(basegfx::fround(aCroppedRectPixel.getHeight() * fReduceFactor)); + } + // build transform from pixel in aDestination to pixel in rBitmapEx basegfx::B2DHomMatrix aTransform; // from relative in aCroppedRectPixel to relative in aDestRectPixel + // No need to take bNeedToReduce into account, TopLeft is unchanged aTransform.translate(aCroppedRectPixel.Left() - aDestRectPixel.Left(), aCroppedRectPixel.Top() - aDestRectPixel.Top()); - // from relative in aDestRectPixel to absolute Logic - aTransform.scale((double)aDestRectLogic.getWidth() / (double)aDestRectPixel.getWidth(), (double)aDestRectLogic.getHeight() / (double)aDestRectPixel.getHeight()); + // from relative in aDestRectPixel to absolute Logic. Here it + // is essential to adapt to reduce factor (if used) + double fAdaptedDRPWidth((double)aDestRectPixel.getWidth()); + double fAdaptedDRPHeight((double)aDestRectPixel.getHeight()); + + if(bNeedToReduce) + { + fAdaptedDRPWidth *= fReduceFactor; + fAdaptedDRPHeight *= fReduceFactor; + } + + aTransform.scale(aDestRectLogic.getWidth() / fAdaptedDRPWidth, aDestRectLogic.getHeight() / fAdaptedDRPHeight); aTransform.translate(aDestRectLogic.Left(), aDestRectLogic.Top()); // from absolute in Logic to unified object coordinates (0.0 .. 1.0 in x and y) @@ -180,17 +216,60 @@ namespace drawinglayer aTransform = aInvBitmapTransform * aTransform; // from unit object coordinates to rBitmapEx pixel coordintes - const Size aSourceSizePixel(rBitmapEx.GetSizePixel()); aTransform.scale(aSourceSizePixel.getWidth() - 1L, aSourceSizePixel.getHeight() - 1L); // create bitmap using source, destination and linear back-transformation BitmapEx aDestination = impTransformBitmapEx(rBitmapEx, aCroppedRectPixel, aTransform); // paint - const bool bWasEnabled(rOutDev.IsMapModeEnabled()); - rOutDev.EnableMapMode(false); - rOutDev.DrawBitmapEx(aCroppedRectPixel.TopLeft(), aDestination); - rOutDev.EnableMapMode(bWasEnabled); + if(bNeedToReduce) + { + // paint in target size + const double fFactor(1.0 / fReduceFactor); + const Size aDestSizePixel( + basegfx::fround(aCroppedRectPixel.getWidth() * fFactor), + basegfx::fround(aCroppedRectPixel.getHeight() * fFactor)); + + if(bRecordToMetaFile) + { + rOutDev.DrawBitmapEx( + rOutDev.PixelToLogic(aCroppedRectPixel.TopLeft()), + rOutDev.PixelToLogic(aDestSizePixel), + aDestination); + } + else + { + const bool bWasEnabled(rOutDev.IsMapModeEnabled()); + rOutDev.EnableMapMode(false); + + rOutDev.DrawBitmapEx( + aCroppedRectPixel.TopLeft(), + aDestSizePixel, + aDestination); + + rOutDev.EnableMapMode(bWasEnabled); + } + } + else + { + if(bRecordToMetaFile) + { + rOutDev.DrawBitmapEx( + rOutDev.PixelToLogic(aCroppedRectPixel.TopLeft()), + aDestination); + } + else + { + const bool bWasEnabled(rOutDev.IsMapModeEnabled()); + rOutDev.EnableMapMode(false); + + rOutDev.DrawBitmapEx( + aCroppedRectPixel.TopLeft(), + aDestination); + + rOutDev.EnableMapMode(bWasEnabled); + } + } } } } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index bc7e659a8996..dc5589200c15 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -73,6 +73,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> #include <helperchartrenderer.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// // for PDFExtOutDevData Graphic support @@ -983,7 +984,7 @@ namespace drawinglayer SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rHairlinePrimitive.getB2DPolygon(), &aLineColor, 0, 0, 0, 0); impStartSvtGraphicStroke(pSvtGraphicStroke); - RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate)); + RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), false); impEndSvtGraphicStroke(pSvtGraphicStroke); break; } @@ -1652,6 +1653,27 @@ namespace drawinglayer break; } + case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D : + { + // #i99123# + // invisible primitive; to rebuilt the old MetaFile creation, it is necessary to + // not ignore them (as it was thought), but to add a MetaFile entry for them. + basegfx::B2DRange aInvisibleRange(rCandidate.getB2DRange(getViewInformation2D())); + + if(!aInvisibleRange.isEmpty()) + { + aInvisibleRange.transform(maCurrentTransformation); + const Rectangle aRectLogic( + (sal_Int32)floor(aInvisibleRange.getMinX()), (sal_Int32)floor(aInvisibleRange.getMinY()), + (sal_Int32)ceil(aInvisibleRange.getMaxX()), (sal_Int32)ceil(aInvisibleRange.getMaxY())); + + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(); + mpOutputDevice->DrawRect(aRectLogic); + } + + break; + } default : { // process recursively diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 70cb4dcb4b43..b1d508795cac 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -65,6 +65,7 @@ #include <tools/diagnose_ex.h> #include <com/sun/star/awt/PosSize.hpp> #include <cstdio> +#include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -139,13 +140,13 @@ namespace drawinglayer case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D : { // directdraw of text simple portion; added test possibility to check text decompose - static bool bHandleSimpleTextDirectly(true); + static bool bForceSimpleTextDecomposition(false); // Adapt evtl. used special DrawMode const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode()); adaptTextToFillDrawMode(); - if(bHandleSimpleTextDirectly) + if(!bForceSimpleTextDecomposition && getOptionsDrawinglayer().IsRenderSimpleTextDirect()) { RenderTextSimpleOrDecoratedPortionPrimitive2D(static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate)); } @@ -162,13 +163,13 @@ namespace drawinglayer case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D : { // directdraw of text simple portion; added test possibility to check text decompose - static bool bHandleComplexTextDirectly(false); + static bool bForceComplexTextDecomposition(false); // Adapt evtl. used special DrawMode const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode()); adaptTextToFillDrawMode(); - if(bHandleComplexTextDirectly) + if(!bForceComplexTextDecomposition && getOptionsDrawinglayer().IsRenderDecoratedTextDirect()) { RenderTextSimpleOrDecoratedPortionPrimitive2D(static_cast< const primitive2d::TextSimplePortionPrimitive2D& >(rCandidate)); } @@ -185,7 +186,7 @@ namespace drawinglayer case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D : { // direct draw of hairline - RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate)); + RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), true); break; } case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D : @@ -224,8 +225,23 @@ namespace drawinglayer } case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D : { + // #i98289# + const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); + const sal_uInt16 nOldAntiAliase(mpOutputDevice->GetAntialiasing()); + + if(bForceLineSnap) + { + mpOutputDevice->SetAntialiasing(nOldAntiAliase | ANTIALIASING_PIXELSNAPHAIRLINE); + } + // direct draw of MetaFile RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate)); + + if(bForceLineSnap) + { + mpOutputDevice->SetAntialiasing(nOldAntiAliase); + } + break; } case PRIMITIVE2D_ID_MASKPRIMITIVE2D : @@ -479,6 +495,43 @@ namespace drawinglayer } break; } + case PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D : + { + // #i98404# Handle directly, especially when AA is active + const primitive2d::BackgroundColorPrimitive2D& rPrimitive = static_cast< const primitive2d::BackgroundColorPrimitive2D& >(rCandidate); + const sal_uInt16 nOriginalAA(mpOutputDevice->GetAntialiasing()); + + // switch AA off in all cases + mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_ENABLE_B2DDRAW); + + // create color for fill + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor())); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + + // create rectangle for fill + const basegfx::B2DRange& aViewport(getViewInformation2D().getDiscreteViewport()); + const Rectangle aRectangle( + (sal_Int32)floor(aViewport.getMinX()), (sal_Int32)floor(aViewport.getMinY()), + (sal_Int32)ceil(aViewport.getMaxX()), (sal_Int32)ceil(aViewport.getMaxY())); + mpOutputDevice->DrawRect(aRectangle); + + // restore AA setting + mpOutputDevice->SetAntialiasing(nOriginalAA); + + break; + } + case PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D : + { + // #i97628# + // This primitive means that the content is derived from an active text edit, + // not from model data itself. Some renderers need to suppress this content, e.g. + // the pixel renderer used for displaying the edit view (like this one). It's + // not to be suppressed by the MetaFile renderers, so that the edited text is + // part of the MetaFile, e.g. needed for presentation previews. + // Action: Ignore here, do nothing. + break; + } default : { // process recursively diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index be30e9fe6e77..b8a21767b839 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -66,6 +66,7 @@ #include <vcl/svapp.hxx> #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> #include <tools/diagnose_ex.h> +#include <vcl/metric.hxx> ////////////////////////////////////////////////////////////////////////////// // control support @@ -158,9 +159,42 @@ namespace drawinglayer if(basegfx::fTools::more(aScale.getX(), 0.0) && basegfx::fTools::more(aScale.getY(), 0.0)) { - // prepare everything that is not sheared and mirrored + // #i96581# Get the font forced without FontStretching (use FontHeight as FontWidth) Font aFont(primitive2d::getVclFontFromFontAttributes( - rTextCandidate.getFontAttributes(), aScale.getX(), aScale.getY(), fRotate, *mpOutputDevice)); + rTextCandidate.getFontAttributes(), + aScale.getY(), + aScale.getY(), + fRotate, + *mpOutputDevice)); + + if(!basegfx::fTools::equal(aScale.getX(), aScale.getY())) + { + // #i96581# font stretching is needed; examine how big the difference between X and Y scaling is + const double fPercent(fabs(1.0 - (aScale.getX() / aScale.getY()))); + static double fMaximumAcceptedPercent(0.05); + static bool bForceAdaption(false); + + if(bForceAdaption || fPercent > fMaximumAcceptedPercent) + { + // #i96581# Need to adapt to a FontStretching bigger than acceptable maximum. + // Get font's real width using FontMetric and adapt font to stretched + // font + const FontMetric aFontMetric(mpOutputDevice->GetFontMetric(aFont)); + const double fRealFontWidth(aFontMetric.GetWidth()); + + aFont = primitive2d::getVclFontFromFontAttributes( + rTextCandidate.getFontAttributes(), + fRealFontWidth, + aScale.getY(), + fRotate, + *mpOutputDevice); + } + else + { + // #i96581# less than allowed maximum (probably SC's generated MapModes). React + // pragmatically by ignoring the stretching up to this point + } + } // handle additional font attributes const primitive2d::TextDecoratedPortionPrimitive2D* pTCPP = @@ -317,7 +351,7 @@ namespace drawinglayer } // direct draw of hairline - void VclProcessor2D::RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate) + void VclProcessor2D::RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased) { const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor())); mpOutputDevice->SetLineColor(Color(aHairlineColor)); @@ -325,6 +359,17 @@ namespace drawinglayer basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(maCurrentTransformation); + + if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()) + { + // #i98289# + // when a Hairline is painted and AntiAliasing is on the option SnapHorVerLinesToDiscrete + // allows to suppress AntiAliasing for pure horizontal or vertical lines. This is done since + // not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This + // NEEDS to be done in discrete coordinates, so only useful for pixel based rendering. + aLocalPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon); + } + mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); } @@ -623,6 +668,8 @@ namespace drawinglayer // units e.g. when creating a new MetaFile, but since much huger value ranges are used // there typically will be okay for this compromize. Rectangle aDestRectView( + // !!CAUTION!! Here, ceil and floor are exchanged BY PURPOSE, do NOT copy when + // looking for a standard conversion to rectangle (!) (sal_Int32)ceil(aOutlineRange.getMinX()), (sal_Int32)ceil(aOutlineRange.getMinY()), (sal_Int32)floor(aOutlineRange.getMaxX()), (sal_Int32)floor(aOutlineRange.getMaxY())); diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 9631bd344e6f..d9194ca4b5eb 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -312,6 +312,11 @@ namespace drawinglayer basegfx::BColor aObjectColor(rPrimitive.getMaterial().getColor()); bool bPaintIt(aFill.count()); + // #i98295# get ShadeMode. Correct early when only flat is possible due to missing normals + const ::com::sun::star::drawing::ShadeMode aShadeMode( + aFill.areNormalsUsed() ? + getSdrSceneAttribute().getShadeMode() : ::com::sun::star::drawing::ShadeMode_FLAT); + if(bPaintIt) { // get rid of texture coordinates if there is no texture @@ -320,6 +325,13 @@ namespace drawinglayer aFill.clearTextureCoordinates(); } + // #i98295# get rid of normals and color early when not needed + if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode) + { + aFill.clearNormals(); + aFill.clearBColors(); + } + // transform to device coordinates (-1.0 .. 1.0) and check for visibility aFill.transform(getViewInformation3D().getObjectToView()); const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aFill)); @@ -344,7 +356,6 @@ namespace drawinglayer if(bPaintIt) { // prepare ObjectToEye in NormalTransform - ::com::sun::star::drawing::ShadeMode aShadeMode(getSdrSceneAttribute().getShadeMode()); basegfx::B3DHomMatrix aNormalTransform(getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation()); if(getSdrSceneAttribute().getTwoSidedLighting()) @@ -360,27 +371,17 @@ namespace drawinglayer } } - if(::com::sun::star::drawing::ShadeMode_PHONG == aShadeMode) + switch(aShadeMode) { - // phong shading - if(aFill.areNormalsUsed()) + case ::com::sun::star::drawing::ShadeMode_PHONG: { - // transform normals to eye coor + // phong shading. Transform normals to eye coor aFill.transformNormals(aNormalTransform); + break; } - else - { - // fallback to gouraud when no normals available - aShadeMode = ::com::sun::star::drawing::ShadeMode_SMOOTH; - } - } - - if(::com::sun::star::drawing::ShadeMode_SMOOTH == aShadeMode) - { - // gouraud shading - if(aFill.areNormalsUsed()) + case ::com::sun::star::drawing::ShadeMode_SMOOTH: { - // transform normals to eye coor + // gouraud shading. Transform normals to eye coor aFill.transformNormals(aNormalTransform); // prepare color model parameters, evtl. use blend color @@ -406,38 +407,30 @@ namespace drawinglayer aPartFill.clearNormals(); aFill.setB3DPolygon(a, aPartFill); } + break; } - else + case ::com::sun::star::drawing::ShadeMode_FLAT: { - // fallback to flat when no normals available - aShadeMode = ::com::sun::star::drawing::ShadeMode_FLAT; - } - } + // flat shading. Get plane vector in eye coordinates + const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal()); - if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode) - { - // flat shading. Clear normals and colors - aFill.clearNormals(); - aFill.clearBColors(); - - // get plane vector in eye coordinates - const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal()); - - // prepare color model parameters, evtl. use blend color - const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor()); - const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular()); - const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission()); - const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity()); - - // solve color model for plane vector and use that color for whole plane - aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity); - } + // prepare color model parameters, evtl. use blend color + const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor()); + const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular()); + const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission()); + const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity()); - if(::com::sun::star::drawing::ShadeMode_DRAFT == aShadeMode) - { - // draft, just use object color which is already set. Delete all other infos - aFill.clearNormals(); - aFill.clearBColors(); + // solve color model for plane vector and use that color for whole plane + aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity); + break; + } + default: // case ::com::sun::star::drawing::ShadeMode_DRAFT: + { + // draft, just use object color which is already set. Delete all other infos + aFill.clearNormals(); + aFill.clearBColors(); + break; + } } // draw it to ZBuffer diff --git a/formula/inc/AddressConvention.hxx b/formula/inc/AddressConvention.hxx index d65a3be79524..d4d50e83dbfa 100644 --- a/formula/inc/AddressConvention.hxx +++ b/formula/inc/AddressConvention.hxx @@ -1,42 +1,42 @@ -/*************************************************************************
- *
- * 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: tokenuno.hxx,v $
- * $Revision: 1.4 $
- *
- * 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 FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
-#define FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
-
-#include "formula/formuladllapi.h"
-namespace formula
-{
-// =============================================================================
-// =============================================================================
-} // formula
-// =============================================================================
-
-#endif // FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
+/************************************************************************* + * + * 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: tokenuno.hxx,v $ + * $Revision: 1.4 $ + * + * 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 FORMULA_ADDRESSCONVENTION_HXX_INCLUDED +#define FORMULA_ADDRESSCONVENTION_HXX_INCLUDED + +#include "formula/formuladllapi.h" +namespace formula +{ +// ============================================================================= +// ============================================================================= +} // formula +// ============================================================================= + +#endif // FORMULA_ADDRESSCONVENTION_HXX_INCLUDED diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx index eb715f926e5c..1fc77e2db01e 100644 --- a/formula/inc/formula/FormulaCompiler.hxx +++ b/formula/inc/formula/FormulaCompiler.hxx @@ -89,6 +89,11 @@ public: FormulaCompiler(FormulaTokenArray& _rArr); virtual ~FormulaCompiler(); + // SUNWS8 needs a forward declared friend, otherwise members of the outer + // class are not accessible. + class OpCodeMap; + friend class FormulaCompiler::OpCodeMap; + /** Mappings from strings to OpCodes and vice versa. */ class FORMULA_DLLPUBLIC OpCodeMap { diff --git a/formula/inc/formula/IFunctionDescription.hxx b/formula/inc/formula/IFunctionDescription.hxx index 0ab5fd441add..3db1e6d49a94 100644 --- a/formula/inc/formula/IFunctionDescription.hxx +++ b/formula/inc/formula/IFunctionDescription.hxx @@ -66,7 +66,7 @@ namespace formula virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0; virtual const IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const = 0; - virtual const sal_Unicode getSingleToken(const EToken _eToken) const = 0; + virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0; }; class SAL_NO_VTABLE IFunctionCategory diff --git a/formula/inc/formula/intruref.hxx b/formula/inc/formula/intruref.hxx index e51f37f424ce..08d369084226 100644 --- a/formula/inc/formula/intruref.hxx +++ b/formula/inc/formula/intruref.hxx @@ -31,8 +31,8 @@ #ifndef FORMULA_INTRUREF_HXX #define FORMULA_INTRUREF_HXX -namespace formula
-{
+namespace formula +{ /** A simple intrusive refcounting template, not thread safe, but therefore also a bit faster than boost's smart_ptr or uno::Reference equivalents, and @@ -96,9 +96,9 @@ public: inline operator T*() const { return p; } inline T* get() const { return p; } }; -// =============================================================================
-} // formula
-// =============================================================================
+// ============================================================================= +} // formula +// ============================================================================= #endif // SC_INTRUREF_HXX diff --git a/formula/inc/formula/tokenarray.hxx b/formula/inc/formula/tokenarray.hxx index 5ba055156c80..d5a70db8ac53 100644 --- a/formula/inc/formula/tokenarray.hxx +++ b/formula/inc/formula/tokenarray.hxx @@ -74,30 +74,30 @@ class FORMULA_DLLPUBLIC FormulaTokenArray friend class FormulaMissingContext; protected: - FormulaToken** pCode; // Token code array - FormulaToken** pRPN; // RPN array + FormulaToken** pCode; // Token code array + FormulaToken** pRPN; // RPN array USHORT nLen; // Length of token array USHORT nRPN; // Length of RPN array USHORT nIndex; // Current step index USHORT nError; // Error code short nRefs; // Count of cell references ScRecalcMode nMode; // Flags to indicate when to recalc this code - BOOL bHyperLink; // If HYPERLINK() occurs in the formula. + BOOL bHyperLink; // If HYPERLINK() occurs in the formula. protected: void Assign( const FormulaTokenArray& ); /// Also used by the compiler. The token MUST had been allocated with new! - FormulaToken* Add( FormulaToken* ); + FormulaToken* Add( FormulaToken* ); inline void SetCombinedBitsRecalcMode( ScRecalcMode nBits ) - { nMode |= (nBits & ~RECALCMODE_EMASK); } + { nMode |= (nBits & ~RECALCMODE_EMASK); } inline ScRecalcMode GetCombinedBitsRecalcMode() const - { return nMode & ~RECALCMODE_EMASK; } + { return nMode & ~RECALCMODE_EMASK; } /** Exclusive bits already set in nMode are zero'ed, nVal may contain combined bits, but only one exclusive bit may be set! */ inline void SetMaskedRecalcMode( ScRecalcMode nBits ) - { nMode = GetCombinedBitsRecalcMode() | nBits; } + { nMode = GetCombinedBitsRecalcMode() | nBits; } public: FormulaTokenArray(); @@ -222,14 +222,14 @@ public: /** Determines if this formula needs any changes to convert it to something previous versions of OOo could consume (Plain Old Formula). */ - bool NeedsPofRewrite(const MissingConvention & rConv); + bool NeedsPofRewrite(const MissingConvention & rConv); /** Rewrites to Plain Old Formula, substituting missing parameters. The FormulaTokenArray* returned is new'ed. */ - FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv); + FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv); /** Determines if this formula may be followed by a reference. */ - bool MayReferenceFollow(); + bool MayReferenceFollow(); }; inline OpCode FormulaTokenArray::GetOuterFuncOpCode() diff --git a/formula/inc/helpids.hrc b/formula/inc/helpids.hrc index e971f2054eaf..bcbe9b2db85d 100644 --- a/formula/inc/helpids.hrc +++ b/formula/inc/helpids.hrc @@ -1,65 +1,65 @@ -/*************************************************************************
- *
- * 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: helpids.hrc,v $
- * $Revision: 1.7 $
- *
- * 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 FORMULA_HELPID_HRC
-#define FORMULA_HELPID_HRC
-
-#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc> // HID_FORMULA_START
-#endif
-
-#define HID_FORMULADLG_FORMULA (HID_FORMULA_START + 0)
-#define HID_FORMULA_FAP_FORMULA (HID_FORMULA_START + 1)
-#define HID_FORMULA_FAP_STRUCT (HID_FORMULA_START + 2)
-#define HID_FORMULA_FAP_PAGE (HID_FORMULA_START + 3)
-#define HID_FORMULA_FAP_EDIT1 (HID_FORMULA_START + 4)
-#define HID_FORMULA_FAP_EDIT2 (HID_FORMULA_START + 5)
-#define HID_FORMULA_FAP_EDIT3 (HID_FORMULA_START + 6)
-#define HID_FORMULA_FAP_EDIT4 (HID_FORMULA_START + 7)
-#define HID_FORMULA_FAP_BTN_FX1 (HID_FORMULA_START + 8)
-#define HID_FORMULA_FAP_BTN_FX2 (HID_FORMULA_START + 9)
-#define HID_FORMULA_FAP_BTN_FX3 (HID_FORMULA_START +10)
-#define HID_FORMULA_FAP_BTN_FX4 (HID_FORMULA_START +11)
-#define HID_FORMULA_FAP_BTN_REF1 (HID_FORMULA_START +12)
-#define HID_FORMULA_FAP_BTN_REF2 (HID_FORMULA_START +13)
-#define HID_FORMULA_FAP_BTN_REF3 (HID_FORMULA_START +14)
-#define HID_FORMULA_FAP_BTN_REF4 (HID_FORMULA_START +15)
-#define HID_FORMULA_LB_CATEGORY (HID_FORMULA_START +16)
-#define HID_FORMULA_LB_FUNCTION (HID_FORMULA_START +17)
-#define HID_FORMULATAB_FUNCTION (HID_FORMULA_START +18)
-#define HID_FORMULATAB_STRUCT (HID_FORMULA_START +19)
-
-
-#if HID_FORMULATAB_STRUCT > HID_FORMULA_END
-#error Help-Id Ueberlauf in #file, #line
-#endif
-// don't forget to update the file util/hidother.src
-
-#endif //FORMULA_HELPID_HRC
-
+/************************************************************************* + * + * 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: helpids.hrc,v $ + * $Revision: 1.7 $ + * + * 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 FORMULA_HELPID_HRC +#define FORMULA_HELPID_HRC + +#ifndef _SOLAR_HRC +#include <svtools/solar.hrc> // HID_FORMULA_START +#endif + +#define HID_FORMULADLG_FORMULA (HID_FORMULA_START + 0) +#define HID_FORMULA_FAP_FORMULA (HID_FORMULA_START + 1) +#define HID_FORMULA_FAP_STRUCT (HID_FORMULA_START + 2) +#define HID_FORMULA_FAP_PAGE (HID_FORMULA_START + 3) +#define HID_FORMULA_FAP_EDIT1 (HID_FORMULA_START + 4) +#define HID_FORMULA_FAP_EDIT2 (HID_FORMULA_START + 5) +#define HID_FORMULA_FAP_EDIT3 (HID_FORMULA_START + 6) +#define HID_FORMULA_FAP_EDIT4 (HID_FORMULA_START + 7) +#define HID_FORMULA_FAP_BTN_FX1 (HID_FORMULA_START + 8) +#define HID_FORMULA_FAP_BTN_FX2 (HID_FORMULA_START + 9) +#define HID_FORMULA_FAP_BTN_FX3 (HID_FORMULA_START +10) +#define HID_FORMULA_FAP_BTN_FX4 (HID_FORMULA_START +11) +#define HID_FORMULA_FAP_BTN_REF1 (HID_FORMULA_START +12) +#define HID_FORMULA_FAP_BTN_REF2 (HID_FORMULA_START +13) +#define HID_FORMULA_FAP_BTN_REF3 (HID_FORMULA_START +14) +#define HID_FORMULA_FAP_BTN_REF4 (HID_FORMULA_START +15) +#define HID_FORMULA_LB_CATEGORY (HID_FORMULA_START +16) +#define HID_FORMULA_LB_FUNCTION (HID_FORMULA_START +17) +#define HID_FORMULATAB_FUNCTION (HID_FORMULA_START +18) +#define HID_FORMULATAB_STRUCT (HID_FORMULA_START +19) + + +#if HID_FORMULATAB_STRUCT > HID_FORMULA_END +#error Help-Id Ueberlauf in #file, #line +#endif +// don't forget to update the file util/hidother.src + +#endif //FORMULA_HELPID_HRC + diff --git a/formula/prj/CVS/Entries b/formula/prj/CVS/Entries deleted file mode 100644 index 3ae75e3153ff..000000000000 --- a/formula/prj/CVS/Entries +++ /dev/null @@ -1,4 +0,0 @@ -/build.lst/1.10/Wed Aug 20 14:15:04 2008//Tcws_dev300_frmdlg
-/d.lst/1.6/Fri Aug 17 11:27:10 2007//Tcws_dev300_frmdlg
-/rpt.xml/1.2/Mon Jul 09 11:56:12 2007//Tcws_dev300_frmdlg
-D
diff --git a/formula/prj/CVS/Repository b/formula/prj/CVS/Repository deleted file mode 100644 index 573341612fc8..000000000000 --- a/formula/prj/CVS/Repository +++ /dev/null @@ -1 +0,0 @@ -/cvs/dba/reportdesign/prj diff --git a/formula/prj/CVS/Root b/formula/prj/CVS/Root deleted file mode 100644 index ed0df2a21830..000000000000 --- a/formula/prj/CVS/Root +++ /dev/null @@ -1 +0,0 @@ -:pserver:oj@so-cvs-tunnel.germany.sun.com:/cvs
diff --git a/formula/prj/CVS/Tag b/formula/prj/CVS/Tag deleted file mode 100644 index 9ff93ee1efdd..000000000000 --- a/formula/prj/CVS/Tag +++ /dev/null @@ -1 +0,0 @@ -Tcws_dev300_frmdlg diff --git a/formula/prj/CVS/Template b/formula/prj/CVS/Template deleted file mode 100644 index eec9bab36d48..000000000000 --- a/formula/prj/CVS/Template +++ /dev/null @@ -1,42 +0,0 @@ -Issue number: -Submitted by: -Reviewed by: -CVS: ---------------------------------------------------------------------- -CVS: Issue number: -CVS: If this change addresses one or more issues, -CVS: then enter the issue number(s) here. -CVS: Submitted by: -CVS: If this code has been contributed to the project by someone else; i.e., -CVS: they sent us a patch or a set of diffs, then include their name/email -CVS: address here. If this is your work then delete this line. -CVS: Reviewed by: -CVS: If we are doing pre-commit code reviews and someone else has -CVS: reviewed your changes, include their name(s) here. -CVS: If you have not had it reviewed then delete this line. -CVS: ---------------------------------------------------------------------- -CVS: Committers, -CVS: -CVS: Please follow these protocols: -CVS: -CVS: * Please include in the log message -CVS: reference(s) by ID / number and/or URL -CVS: to any and all relevant OpenOffice.org issue(s). -CVS: -CVS: * If the code is contributed from outside Sun -CVS: then please verify using the list at the following URL -CVS: http://www.openoffice.org/copyright/copyrightapproved.html -CVS: that Sun has received a signed Copyright Assignment Form -CVS: from the submitter. -CVS: -CVS: Otherwise, -CVS: please send an email TO: the submitter; and CC: OOCRequest@eng.sun.com -CVS: the letter (CopyRightRequest.txt) to request assignment of copyright to Sun -CVS: (http://www.openoffice.org/copyright/assign_copyright.html). -CVS: -CVS: Please do NOT commit code until you have verified (as detailed above) that -CVS: Sun has received a signed Copyright Assignment Form from the submitter. -CVS: -CVS: * Please send an email TO: the submitter -CVS: (particularly, if from outside Sun) -CVS: advising that the code has been committed, -CVS: and gratefully recognizing the contribution. diff --git a/formula/prj/d.lst b/formula/prj/d.lst index b37802fb922d..3ad1e394844f 100644 --- a/formula/prj/d.lst +++ b/formula/prj/d.lst @@ -1,37 +1,37 @@ -
-..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
-
-dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
-
-# Libraries
-..\%__SRC%\bin\for*.dll %_DEST%\bin%_EXT%\for*.dll
-..\%__SRC%\lib\libfor*.so %_DEST%\lib%_EXT%\libfor*.so
-..\%__SRC%\lib\ifor*.lib %_DEST%\lib%_EXT%\ifor*.lib
-..\%__SRC%\lib\libfor*.dylib %_DEST%\lib%_EXT%\libfor*.dylib
-
-# Resources
-..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
-
-mkdir: %_DEST%\inc%_EXT%\formula
-..\inc\formula\formdata.hxx %_DEST%\inc%_EXT%\formula\formdata.hxx
-..\inc\formula\formula.hxx %_DEST%\inc%_EXT%\formula\formula.hxx
-..\inc\formula\formulahelper.hxx %_DEST%\inc%_EXT%\formula\formulahelper.hxx
-..\inc\formula\funcutl.hxx %_DEST%\inc%_EXT%\formula\funcutl.hxx
-..\inc\formula\IControlReferenceHandler.hxx %_DEST%\inc%_EXT%\formula\IControlReferenceHandler.hxx
-..\inc\formula\IFunctionDescription.hxx %_DEST%\inc%_EXT%\formula\IFunctionDescription.hxx
-..\inc\formula\ExternalReferenceHelper.hxx %_DEST%\inc%_EXT%\formula\ExternalReferenceHelper.hxx
-..\inc\formula\formuladllapi.h %_DEST%\inc%_EXT%\formula\formuladllapi.h
-..\inc\formula\opcode.hxx %_DEST%\inc%_EXT%\formula\opcode.hxx
-..\inc\formula\grammar.hxx %_DEST%\inc%_EXT%\formula\grammar.hxx
-..\inc\formula\FormulaCompiler.hxx %_DEST%\inc%_EXT%\formula\FormulaCompiler.hxx
-..\inc\formula\FormulaOpCodeMapperObj.hxx %_DEST%\inc%_EXT%\formula\FormulaOpCodeMapperObj.hxx
-..\inc\formula\compiler.hrc %_DEST%\inc%_EXT%\formula\compiler.hrc
-..\inc\formula\token.hxx %_DEST%\inc%_EXT%\formula\token.hxx
-..\inc\formula\tokenarray.hxx %_DEST%\inc%_EXT%\formula\tokenarray.hxx
-..\inc\formula\errorcodes.hxx %_DEST%\inc%_EXT%\formula\errorcodes.hxx
-..\inc\formula\intruref.hxx %_DEST%\inc%_EXT%\formula\intruref.hxx
-
-
-
-
-
+ +..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid + +dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" + +# Libraries +..\%__SRC%\bin\for*.dll %_DEST%\bin%_EXT%\for*.dll +..\%__SRC%\lib\libfor*.so %_DEST%\lib%_EXT%\libfor*.so +..\%__SRC%\lib\ifor*.lib %_DEST%\lib%_EXT%\ifor*.lib +..\%__SRC%\lib\libfor*.dylib %_DEST%\lib%_EXT%\libfor*.dylib + +# Resources +..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res + +mkdir: %_DEST%\inc%_EXT%\formula +..\inc\formula\formdata.hxx %_DEST%\inc%_EXT%\formula\formdata.hxx +..\inc\formula\formula.hxx %_DEST%\inc%_EXT%\formula\formula.hxx +..\inc\formula\formulahelper.hxx %_DEST%\inc%_EXT%\formula\formulahelper.hxx +..\inc\formula\funcutl.hxx %_DEST%\inc%_EXT%\formula\funcutl.hxx +..\inc\formula\IControlReferenceHandler.hxx %_DEST%\inc%_EXT%\formula\IControlReferenceHandler.hxx +..\inc\formula\IFunctionDescription.hxx %_DEST%\inc%_EXT%\formula\IFunctionDescription.hxx +..\inc\formula\ExternalReferenceHelper.hxx %_DEST%\inc%_EXT%\formula\ExternalReferenceHelper.hxx +..\inc\formula\formuladllapi.h %_DEST%\inc%_EXT%\formula\formuladllapi.h +..\inc\formula\opcode.hxx %_DEST%\inc%_EXT%\formula\opcode.hxx +..\inc\formula\grammar.hxx %_DEST%\inc%_EXT%\formula\grammar.hxx +..\inc\formula\FormulaCompiler.hxx %_DEST%\inc%_EXT%\formula\FormulaCompiler.hxx +..\inc\formula\FormulaOpCodeMapperObj.hxx %_DEST%\inc%_EXT%\formula\FormulaOpCodeMapperObj.hxx +..\inc\formula\compiler.hrc %_DEST%\inc%_EXT%\formula\compiler.hrc +..\inc\formula\token.hxx %_DEST%\inc%_EXT%\formula\token.hxx +..\inc\formula\tokenarray.hxx %_DEST%\inc%_EXT%\formula\tokenarray.hxx +..\inc\formula\errorcodes.hxx %_DEST%\inc%_EXT%\formula\errorcodes.hxx +..\inc\formula\intruref.hxx %_DEST%\inc%_EXT%\formula\intruref.hxx + + + + + diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index a4840802192f..4cfa28d1806d 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -698,7 +698,7 @@ void FormulaCompiler::loadSymbols(USHORT _nSymbols,FormulaGrammar::Grammar _eGra if ( FormulaGrammar::GRAM_ENGLISH != _eGrammar ) fillFromAddInCollectionUpperName( _xMap); else - fillFromAddInCollectionEnglishName( mxSymbolsEnglish); + fillFromAddInCollectionEnglishName( _xMap); } } // ----------------------------------------------------------------------------- diff --git a/formula/source/core/api/FormulaOpCodeMapperObj.cxx b/formula/source/core/api/FormulaOpCodeMapperObj.cxx index 29f0a2d2789a..3c79e4c6513b 100644 --- a/formula/source/core/api/FormulaOpCodeMapperObj.cxx +++ b/formula/source/core/api/FormulaOpCodeMapperObj.cxx @@ -1,129 +1,129 @@ -/*************************************************************************
- *
- * 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: tokenuno.hxx,v $
- * $Revision: 1.4 $
- *
- * 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.
- *
- ************************************************************************/
-#include "precompiled_formula.hxx"
-#include "formula/FormulaOpCodeMapperObj.hxx"
-#include "formula/opcode.hxx"
-#include <comphelper/sequence.hxx>
-
-// =============================================================================
-namespace formula
-{
-// =============================================================================
-
- using namespace ::com::sun::star;
-
- // -----------------------------------------------------------------------------
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL FormulaOpCodeMapperObj::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException)
-{
- return ::comphelper::findValue( getSupportedServiceNames_Static(), _rServiceName, sal_True ).getLength() != 0;
-}
-//------------------------------------------------------------------------
-FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler)
-: m_pCompiler(_pCompiler)
-{
-}
-
-FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
-{
-}
-
-
-::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeExternal()
- throw (::com::sun::star::uno::RuntimeException)
-{
- return ocExternal;
-}
-
-
-::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeUnknown()
- throw (::com::sun::star::uno::RuntimeException)
-{
- return FormulaCompiler::OpCodeMap::getOpCodeUnknown();
-}
-
-
-::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
-SAL_CALL FormulaOpCodeMapperObj::getMappings(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
- sal_Int32 nLanguage )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
-{
- FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
- if (!xMap)
- throw lang::IllegalArgumentException();
- return xMap->createSequenceOfFormulaTokens( *m_pCompiler,rNames);
-}
-
-
-::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
-SAL_CALL FormulaOpCodeMapperObj::getAvailableMappings(
- sal_Int32 nLanguage, sal_Int32 nGroups )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
-{
- FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
- if (!xMap)
- throw lang::IllegalArgumentException();
- return xMap->createSequenceOfAvailableMappings( *m_pCompiler,nGroups);
-}
-//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName( ) throw(uno::RuntimeException)
-{
- return getImplementationName_Static();
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName_Static()
-{
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "simple.formula.FormulaOpCodeMapperObj" ) );
-}
-// --------------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames( ) throw(uno::RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-uno::Sequence< rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames_Static()
-{
- uno::Sequence< rtl::OUString > aSeq( 1 );
- aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FormulaOpCodeMapper" ));
- return aSeq;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL FormulaOpCodeMapperObj::create(
- uno::Reference< uno::XComponentContext > const & /*_xContext*/)
-{
- return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler>(new FormulaCompiler())));
-}
-// -----------------------------------------------------------------------------
-
-// =============================================================================
-} // formula
-// =============================================================================
+/************************************************************************* + * + * 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: tokenuno.hxx,v $ + * $Revision: 1.4 $ + * + * 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. + * + ************************************************************************/ +#include "precompiled_formula.hxx" +#include "formula/FormulaOpCodeMapperObj.hxx" +#include "formula/opcode.hxx" +#include <comphelper/sequence.hxx> + +// ============================================================================= +namespace formula +{ +// ============================================================================= + + using namespace ::com::sun::star; + + // ----------------------------------------------------------------------------- +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL FormulaOpCodeMapperObj::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException) +{ + return ::comphelper::findValue( getSupportedServiceNames_Static(), _rServiceName, sal_True ).getLength() != 0; +} +//------------------------------------------------------------------------ +FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler) +: m_pCompiler(_pCompiler) +{ +} + +FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj() +{ +} + + +::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeExternal() + throw (::com::sun::star::uno::RuntimeException) +{ + return ocExternal; +} + + +::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeUnknown() + throw (::com::sun::star::uno::RuntimeException) +{ + return FormulaCompiler::OpCodeMap::getOpCodeUnknown(); +} + + +::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > +SAL_CALL FormulaOpCodeMapperObj::getMappings( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames, + sal_Int32 nLanguage ) + throw ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException) +{ + FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage); + if (!xMap) + throw lang::IllegalArgumentException(); + return xMap->createSequenceOfFormulaTokens( *m_pCompiler,rNames); +} + + +::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry > +SAL_CALL FormulaOpCodeMapperObj::getAvailableMappings( + sal_Int32 nLanguage, sal_Int32 nGroups ) + throw ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException) +{ + FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage); + if (!xMap) + throw lang::IllegalArgumentException(); + return xMap->createSequenceOfAvailableMappings( *m_pCompiler,nGroups); +} +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName( ) throw(uno::RuntimeException) +{ + return getImplementationName_Static(); +} +// ----------------------------------------------------------------------------- +::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName_Static() +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "simple.formula.FormulaOpCodeMapperObj" ) ); +} +// -------------------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames( ) throw(uno::RuntimeException) +{ + return getSupportedServiceNames_Static(); +} +uno::Sequence< rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames_Static() +{ + uno::Sequence< rtl::OUString > aSeq( 1 ); + aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FormulaOpCodeMapper" )); + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL FormulaOpCodeMapperObj::create( + uno::Reference< uno::XComponentContext > const & /*_xContext*/) +{ + return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler>(new FormulaCompiler()))); +} +// ----------------------------------------------------------------------------- + +// ============================================================================= +} // formula +// ============================================================================= diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index d80591c58abb..3cb3eb10f1eb 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -880,11 +880,6 @@ BOOL FormulaTokenArray::HasMatrixDoubleRefOps() // --- POF (plain old formula) rewrite of a token array --------------------- -/* TODO: When both POF OOoXML and ODFF are to be supported differently, the - * FormulaMissingContext and FormulaTokenArray::*Pof* methods should go to a convention - * on its own. - */ - #if 0 // static function can't be compiled if not used (warning) //#if OSL_DEBUG_LEVEL > 0 @@ -898,65 +893,65 @@ static void DumpTokArr( FormulaTokenArray *pCode ) } #endif -inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const
-{
- switch (eOp)
- {
- case ocGammaDist:
- case ocPoissonDist:
- return true;
- case ocMissing:
- case ocLog:
- case ocAddress:
- return !isODFF(); // rewrite only for PODF
- default:
- return false;
- }
+inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const +{ + switch (eOp) + { + case ocGammaDist: + case ocPoissonDist: + case ocAddress: + return true; + case ocMissing: + case ocLog: + return !isODFF(); // rewrite only for PODF + default: + return false; + } } class FormulaMissingContext { public: - const FormulaToken* mpFunc; - int mnCurArg; + const FormulaToken* mpFunc; + int mnCurArg; void Clear() { mpFunc = NULL; mnCurArg = 0; } inline bool AddDefaultArg( FormulaTokenArray* pNewArr, int nArg, double f ) const; - static inline bool IsRewriteNeeded( OpCode eOp ); bool AddMissingExternal( FormulaTokenArray* pNewArr ) const; bool AddMissing( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const; void AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const; }; + void FormulaMissingContext::AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const { - if ( !mpFunc )
- return;
-
- switch (mpFunc->GetOpCode())
- {
- case ocGammaDist:
- if (mnCurArg == 2)
- {
- pNewArr->AddOpCode( ocSep );
- pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=TRUE()
- }
- break;
- case ocPoissonDist:
- if (mnCurArg == 1)
- {
- pNewArr->AddOpCode( ocSep );
- pNewArr->AddDouble( 1.0 ); // 3rd, Cumulative=TRUE()
- }
- break;
- case ocLog:
- if ( !rConv.isODFF() && mnCurArg == 0 )
- {
- pNewArr->AddOpCode( ocSep );
- pNewArr->AddDouble( 10.0 ); // 2nd, basis 10
- }
- break;
- default:
- break;
+ if ( !mpFunc ) + return; + + switch (mpFunc->GetOpCode()) + { + case ocGammaDist: + if (mnCurArg == 2) + { + pNewArr->AddOpCode( ocSep ); + pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=TRUE() + } + break; + case ocPoissonDist: + if (mnCurArg == 1) + { + pNewArr->AddOpCode( ocSep ); + pNewArr->AddDouble( 1.0 ); // 3rd, Cumulative=TRUE() + } + break; + case ocLog: + if ( !rConv.isODFF() && mnCurArg == 0 ) + { + pNewArr->AddOpCode( ocSep ); + pNewArr->AddDouble( 10.0 ); // 2nd, basis 10 + } + break; + default: + break; } } @@ -970,21 +965,10 @@ inline bool FormulaMissingContext::AddDefaultArg( FormulaTokenArray* pNewArr, in return false; } -inline bool FormulaMissingContext::IsRewriteNeeded( OpCode eOp ) -{ - switch (eOp) - { - case ocMissing: - case ocLog: - case ocAddress: - return true; - default: - return false; - } -} - bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) const { + // Only called for PODF, not ODFF. No need to distinguish. + const String &rName = mpFunc->GetExternal(); // initial (fast) check: @@ -1007,54 +991,63 @@ bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) con bool FormulaMissingContext::AddMissing( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const { - if ( !mpFunc )
- return false;
-
- bool bRet = false;
- if (rConv.isODFF())
- {
- }
- else
- {
- switch ( mpFunc->GetOpCode() )
- {
- case ocFixed:
- return AddDefaultArg( pNewArr, 1, 2.0 );
- //break;
- case ocBetaDist:
- case ocBetaInv:
- case ocRMZ: // PMT
- return AddDefaultArg( pNewArr, 3, 0.0 );
- //break;
- case ocZinsZ: // IPMT
- case ocKapz: // PPMT
- return AddDefaultArg( pNewArr, 4, 0.0 );
- //break;
- case ocBW: // PV
- case ocZW: // FV
- bRet |= AddDefaultArg( pNewArr, 2, 0.0 ); // pmt
- bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // [fp]v
- break;
- case ocZins: // RATE
- bRet |= AddDefaultArg( pNewArr, 1, 0.0 ); // pmt
- bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // fv
- bRet |= AddDefaultArg( pNewArr, 4, 0.0 ); // type
- break;
- case ocExternal:
- return AddMissingExternal( pNewArr );
- //break;
-
- // --- more complex cases ---
-
- case ocOffset:
- // FIXME: rather tough.
- // if arg 3 (height) ommitted, export arg1 (rows)
- break;
- default:
- break;
- }
- }
-
+ if ( !mpFunc ) + return false; + + bool bRet = false; + const OpCode eOp = mpFunc->GetOpCode(); + + // Add for both, PODF and ODFF + switch (eOp) + { + case ocAddress: + return AddDefaultArg( pNewArr, 2, 1.0 ); // abs + default: + break; + } + + if (rConv.isODFF()) + { + // Add for ODFF + } + else + { + // Add for PODF + switch (eOp) + { + case ocFixed: + return AddDefaultArg( pNewArr, 1, 2.0 ); + case ocBetaDist: + case ocBetaInv: + case ocRMZ: // PMT + return AddDefaultArg( pNewArr, 3, 0.0 ); + case ocZinsZ: // IPMT + case ocKapz: // PPMT + return AddDefaultArg( pNewArr, 4, 0.0 ); + case ocBW: // PV + case ocZW: // FV + bRet |= AddDefaultArg( pNewArr, 2, 0.0 ); // pmt + bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // [fp]v + break; + case ocZins: // RATE + bRet |= AddDefaultArg( pNewArr, 1, 0.0 ); // pmt + bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // fv + bRet |= AddDefaultArg( pNewArr, 4, 0.0 ); // type + break; + case ocExternal: + return AddMissingExternal( pNewArr ); + + // --- more complex cases --- + + case ocOffset: + // FIXME: rather tough. + // if arg 3 (height) ommitted, export arg1 (rows) + break; + default: + break; + } + } + return bRet; } @@ -1113,8 +1106,8 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissingToPof( const MissingConvent ++nFn; // all following operations on _that_ function pCtx[ nFn ].mpFunc = PeekPrevNoSpaces(); pCtx[ nFn ].mnCurArg = 0; - if (pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress) - pOcas[ nOcas++ ] = nFn; // entering ADDRESS() + if (pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress && !rConv.isODFF()) + pOcas[ nOcas++ ] = nFn; // entering ADDRESS() if PODF break; case ocClose: pCtx[ nFn ].AddMoreArgs( pNewArr, rConv ); diff --git a/formula/source/core/inc/core_resource.hrc b/formula/source/core/inc/core_resource.hrc index 4a64fddaba4b..769067d57839 100644 --- a/formula/source/core/inc/core_resource.hrc +++ b/formula/source/core/inc/core_resource.hrc @@ -1,48 +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: core_resource.hrc,v $
- * $Revision: 1.16.68.1 $
- *
- * 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 _FORMULA_CORE_RESOURCE_HRC_
-#define _FORMULA_CORE_RESOURCE_HRC_
-
-#include <svtools/solar.hrc>
-
-//------------------------------------------------------------------------------
-#define RID_CORE_STRINGS_START RID_FORMULA_START
-#define RID_CORE_OTHER_START RID_FORMULA_START
-
-//------------------------------------------------------------------------------
-//- String-IDs
-#define RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF (RID_CORE_OTHER_START + 0)
-#define RID_STRLIST_FUNCTION_NAMES_ENGLISH (RID_CORE_OTHER_START + 1)
-#define RID_STRLIST_FUNCTION_NAMES (RID_CORE_OTHER_START + 2)
-
-
-#endif // _FORMULA_CORE_RESOURCE_HRC_
-
+/************************************************************************* + * + * 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: core_resource.hrc,v $ + * $Revision: 1.16.68.1 $ + * + * 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 _FORMULA_CORE_RESOURCE_HRC_ +#define _FORMULA_CORE_RESOURCE_HRC_ + +#include <svtools/solar.hrc> + +//------------------------------------------------------------------------------ +#define RID_CORE_STRINGS_START RID_FORMULA_START +#define RID_CORE_OTHER_START RID_FORMULA_START + +//------------------------------------------------------------------------------ +//- String-IDs +#define RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF (RID_CORE_OTHER_START + 0) +#define RID_STRLIST_FUNCTION_NAMES_ENGLISH (RID_CORE_OTHER_START + 1) +#define RID_STRLIST_FUNCTION_NAMES (RID_CORE_OTHER_START + 2) + + +#endif // _FORMULA_CORE_RESOURCE_HRC_ + diff --git a/formula/source/core/inc/core_resource.hxx b/formula/source/core/inc/core_resource.hxx index f079fbf95100..c8b78a5bdbd8 100644 --- a/formula/source/core/inc/core_resource.hxx +++ b/formula/source/core/inc/core_resource.hxx @@ -1,114 +1,114 @@ -/*************************************************************************
- *
- * 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: core_resource.hxx,v $
- * $Revision: 1.5.68.2 $
- *
- * 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 _FORMULA_CORE_RESOURCE_HXX_
-#define _FORMULA_CORE_RESOURCE_HXX_
-
-#ifndef _RTL_USTRING_HXX_
-#include <rtl/ustring.hxx>
-#endif
-#include <osl/mutex.hxx>
-
-class ResMgr;
-//.........................................................................
-namespace formula
-{
-
-#define FORMULA_RES( id ) ResourceManager::loadString( id )
-#define FORMULA_RES_PARAM( id, ascii, replace ) ResourceManager::loadString( id, ascii, replace )
-
-#define FORMULACORE_RESSTRING( id ) FORMULA_RES( id )
- // (compatibility)
-
- //==================================================================
- //= ResourceManager
- //= handling ressources within the FORMULA-Core library
- //==================================================================
- class ResourceManager
- {
- friend class OModuleClient;
- static ::osl::Mutex s_aMutex; /// access safety
- static sal_Int32 s_nClients; /// number of registered clients
- static ResMgr* m_pImpl;
-
- private:
- // no instantiation allowed
- ResourceManager() { }
- ~ResourceManager() { }
-
- protected:
- static void ensureImplExists();
- /// register a client for the module
- static void registerClient();
- /// revoke a client for the module
- static void revokeClient();
-
- public:
- /** loads the string with the specified resource id
- */
- static ::rtl::OUString loadString(sal_uInt16 _nResId);
-
- /** loads a string from the resource file, substituting a placeholder with a given string
-
- @param _nResId
- the resource ID of the string to loAD
- @param _pPlaceholderAscii
- the ASCII representation of the placeholder string
- @param _rReplace
- the string which should substutite the placeholder
- */
- static ::rtl::OUString loadString(
- sal_uInt16 _nResId,
- const sal_Char* _pPlaceholderAscii,
- const ::rtl::OUString& _rReplace
- );
-
- static ResMgr* getResManager();
- };
-
- //=========================================================================
- //= OModuleClient
- //=========================================================================
- /** base class for objects which uses any global module-specific ressources
- */
- class OModuleClient
- {
- public:
- OModuleClient() { ResourceManager::registerClient(); }
- ~OModuleClient() { ResourceManager::revokeClient(); }
- };
-
-
-//.........................................................................
-} // formula
-//.........................................................................
-
-#endif // _FORMULA_CORE_RESOURCE_HXX_
-
+/************************************************************************* + * + * 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: core_resource.hxx,v $ + * $Revision: 1.5.68.2 $ + * + * 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 _FORMULA_CORE_RESOURCE_HXX_ +#define _FORMULA_CORE_RESOURCE_HXX_ + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif +#include <osl/mutex.hxx> + +class ResMgr; +//......................................................................... +namespace formula +{ + +#define FORMULA_RES( id ) ResourceManager::loadString( id ) +#define FORMULA_RES_PARAM( id, ascii, replace ) ResourceManager::loadString( id, ascii, replace ) + +#define FORMULACORE_RESSTRING( id ) FORMULA_RES( id ) + // (compatibility) + + //================================================================== + //= ResourceManager + //= handling ressources within the FORMULA-Core library + //================================================================== + class ResourceManager + { + friend class OModuleClient; + static ::osl::Mutex s_aMutex; /// access safety + static sal_Int32 s_nClients; /// number of registered clients + static ResMgr* m_pImpl; + + private: + // no instantiation allowed + ResourceManager() { } + ~ResourceManager() { } + + protected: + static void ensureImplExists(); + /// register a client for the module + static void registerClient(); + /// revoke a client for the module + static void revokeClient(); + + public: + /** loads the string with the specified resource id + */ + static ::rtl::OUString loadString(sal_uInt16 _nResId); + + /** loads a string from the resource file, substituting a placeholder with a given string + + @param _nResId + the resource ID of the string to loAD + @param _pPlaceholderAscii + the ASCII representation of the placeholder string + @param _rReplace + the string which should substutite the placeholder + */ + static ::rtl::OUString loadString( + sal_uInt16 _nResId, + const sal_Char* _pPlaceholderAscii, + const ::rtl::OUString& _rReplace + ); + + static ResMgr* getResManager(); + }; + + //========================================================================= + //= OModuleClient + //========================================================================= + /** base class for objects which uses any global module-specific ressources + */ + class OModuleClient + { + public: + OModuleClient() { ResourceManager::registerClient(); } + ~OModuleClient() { ResourceManager::revokeClient(); } + }; + + +//......................................................................... +} // formula +//......................................................................... + +#endif // _FORMULA_CORE_RESOURCE_HXX_ + diff --git a/formula/source/core/resource/core_resource.cxx b/formula/source/core/resource/core_resource.cxx index 8d2933375b17..de36c962a83e 100644 --- a/formula/source/core/resource/core_resource.cxx +++ b/formula/source/core/resource/core_resource.cxx @@ -1,111 +1,111 @@ -/*************************************************************************
- *
- * 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: core_resource.cxx,v $
- * $Revision: 1.11.68.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_formula.hxx"
-
-#include "core_resource.hxx"
-
-#include <tools/resmgr.hxx>
-
-// ---- needed as long as we have no contexts for components ---
-#include <vcl/svapp.hxx>
-#include <svtools/solar.hrc>
-
-//.........................................................................
-namespace formula
-{
-
- //==================================================================
- //= ResourceManager
- //==================================================================
- ::osl::Mutex ResourceManager::s_aMutex;
- sal_Int32 ResourceManager::s_nClients = 0;
- ResMgr* ResourceManager::m_pImpl = NULL;
-
- //------------------------------------------------------------------
- void ResourceManager::ensureImplExists()
- {
- if (m_pImpl)
- return;
-
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
-
- ByteString sFileName("for");
-
- m_pImpl = ResMgr::CreateResMgr(sFileName.GetBuffer(), aLocale);
- }
-
- //------------------------------------------------------------------
- ::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId)
- {
- ::rtl::OUString sReturn;
-
- ensureImplExists();
- if (m_pImpl)
- sReturn = String(ResId(_nResId,*m_pImpl));
-
- return sReturn;
- }
-
- //------------------------------------------------------------------
- ::rtl::OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii, const ::rtl::OUString& _rReplace )
- {
- String sString( loadString( _nResId ) );
- sString.SearchAndReplaceAscii( _pPlaceholderAscii, _rReplace );
- return sString;
- }
- //-------------------------------------------------------------------------
- void ResourceManager::registerClient()
- {
- ::osl::MutexGuard aGuard(s_aMutex);
- ++s_nClients;
- }
-
- //-------------------------------------------------------------------------
- void ResourceManager::revokeClient()
- {
- ::osl::MutexGuard aGuard(s_aMutex);
- if (!--s_nClients && m_pImpl)
- {
- delete m_pImpl;
- m_pImpl = NULL;
- }
- }
- ResMgr* ResourceManager::getResManager()
- {
- ensureImplExists();
- return m_pImpl;
- }
-
-//.........................................................................
-} // formula
-//.........................................................................
-
+/************************************************************************* + * + * 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: core_resource.cxx,v $ + * $Revision: 1.11.68.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_formula.hxx" + +#include "core_resource.hxx" + +#include <tools/resmgr.hxx> + +// ---- needed as long as we have no contexts for components --- +#include <vcl/svapp.hxx> +#include <svtools/solar.hrc> + +//......................................................................... +namespace formula +{ + + //================================================================== + //= ResourceManager + //================================================================== + ::osl::Mutex ResourceManager::s_aMutex; + sal_Int32 ResourceManager::s_nClients = 0; + ResMgr* ResourceManager::m_pImpl = NULL; + + //------------------------------------------------------------------ + void ResourceManager::ensureImplExists() + { + if (m_pImpl) + return; + + ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); + + ByteString sFileName("for"); + + m_pImpl = ResMgr::CreateResMgr(sFileName.GetBuffer(), aLocale); + } + + //------------------------------------------------------------------ + ::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId) + { + ::rtl::OUString sReturn; + + ensureImplExists(); + if (m_pImpl) + sReturn = String(ResId(_nResId,*m_pImpl)); + + return sReturn; + } + + //------------------------------------------------------------------ + ::rtl::OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii, const ::rtl::OUString& _rReplace ) + { + String sString( loadString( _nResId ) ); + sString.SearchAndReplaceAscii( _pPlaceholderAscii, _rReplace ); + return sString; + } + //------------------------------------------------------------------------- + void ResourceManager::registerClient() + { + ::osl::MutexGuard aGuard(s_aMutex); + ++s_nClients; + } + + //------------------------------------------------------------------------- + void ResourceManager::revokeClient() + { + ::osl::MutexGuard aGuard(s_aMutex); + if (!--s_nClients && m_pImpl) + { + delete m_pImpl; + m_pImpl = NULL; + } + } + ResMgr* ResourceManager::getResManager() + { + ensureImplExists(); + return m_pImpl; + } + +//......................................................................... +} // formula +//......................................................................... + diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index c19383a74f6b..a2a46b74f3a6 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -1060,7 +1060,7 @@ void FormulaDlg_Impl::UpdateFunctionDesc() String aSig = pDesc->getSignature(); aFtFuncName.SetText( aSig ); - aFtFuncDesc.SetText( pDesc->getFunctionName() ); + aFtFuncDesc.SetText( pDesc->getDescription() ); ResizeArgArr( pDesc ); if ( !m_aArguments.empty() ) // noch Argumente da? @@ -1713,7 +1713,7 @@ IMPL_LINK( FormulaDlg_Impl, FuncSelHdl, FuncPage*, EMPTYARG ) String aSig = pDesc->getSignature(); aFtHeadLine.SetText( pDesc->getFunctionName() ); aFtFuncName.SetText( aSig ); - aFtFuncDesc.SetText( pDesc->getFunctionName() ); + aFtFuncDesc.SetText( pDesc->getDescription() ); } } else diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx index f056d221ac74..f414cb41fb39 100644 --- a/formula/source/ui/dlg/funcpage.cxx +++ b/formula/source/ui/dlg/funcpage.cxx @@ -170,8 +170,12 @@ void FuncPage::UpdateFunctionList() for ( ; aIter != aEnd; ++aIter ) { - aLbFunction.SetEntryData( - aLbFunction.InsertEntry( (*aIter)->getFunctionName() ),(void*)*aIter ); + const IFunctionDescription* pDesc = *aIter; + if (pDesc) // may be null if a function is no longer available + { + aLbFunction.SetEntryData( + aLbFunction.InsertEntry( pDesc->getFunctionName() ), (void*)pDesc ); + } } } diff --git a/formula/source/ui/dlg/funcpage.hxx b/formula/source/ui/dlg/funcpage.hxx index dffe65ae8d4b..7fef02bd3c20 100644 --- a/formula/source/ui/dlg/funcpage.hxx +++ b/formula/source/ui/dlg/funcpage.hxx @@ -80,7 +80,7 @@ private: FixedText aFtCategory; ListBox aLbCategory; FixedText aFtFunction; - ListBox aLbFunction; + FormulaListBox aLbFunction; const IFunctionManager* m_pFunctionManager; diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx index d4e76cf09762..3437bc47302b 100644 --- a/formula/source/ui/dlg/parawin.cxx +++ b/formula/source/ui/dlg/parawin.cxx @@ -1,603 +1,603 @@ -/*************************************************************************
- *
- * 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: parawin.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_formula.hxx"
-
-
-
-//----------------------------------------------------------------------------
-
-#include <svtools/zforlist.hxx>
-#include <svtools/stritem.hxx>
-
-#include "parawin.hxx"
-#include "parawin.hrc"
-#include "helpids.hrc"
-#include "formula/formdata.hxx"
-#include "formula/IFunctionDescription.hxx"
-#include "ModuleHelper.hxx"
-#include "ForResId.hrc"
-
-#define VAR_ARGS 30
-namespace formula
-{
-//============================================================================
-
-ParaWin::ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos):
- TabPage (pParent,ModuleRes(RID_FORMULATAB_PARAMETER)),
- pFuncDesc ( NULL ),
- pMyParent (_pDlg),
- aFtEditDesc ( this, ModuleRes( FT_EDITDESC ) ),
- aFtArgName ( this, ModuleRes( FT_PARNAME ) ),
- aFtArgDesc ( this, ModuleRes( FT_PARDESC ) ),
-
- aFtArg1 ( this, ModuleRes( FT_ARG1 ) ),
- aFtArg2 ( this, ModuleRes( FT_ARG2 ) ),
- aFtArg3 ( this, ModuleRes( FT_ARG3 ) ),
- aFtArg4 ( this, ModuleRes( FT_ARG4 ) ),
-
- aBtnFx1 ( this, ModuleRes( BTN_FX1 ) ),
- aBtnFx2 ( this, ModuleRes( BTN_FX2 ) ),
- aBtnFx3 ( this, ModuleRes( BTN_FX3 ) ),
- aBtnFx4 ( this, ModuleRes( BTN_FX4 ) ),
-
- aEdArg1 ( this, ModuleRes( ED_ARG1 ) ),
- aEdArg2 ( this, ModuleRes( ED_ARG2 ) ),
- aEdArg3 ( this, ModuleRes( ED_ARG3 ) ),
- aEdArg4 ( this, ModuleRes( ED_ARG4 ) ),
-
- aRefBtn1 ( this, ModuleRes( RB_ARG1 ) ),
- aRefBtn2 ( this, ModuleRes( RB_ARG2 ) ),
- aRefBtn3 ( this, ModuleRes( RB_ARG3 ) ),
- aRefBtn4 ( this, ModuleRes( RB_ARG4 ) ),
-
- aSlider ( this, ModuleRes( WND_SLIDER ) ),
- m_sOptional ( ModuleRes( STR_OPTIONAL ) ),
- m_sRequired ( ModuleRes( STR_REQUIRED ) ),
- bRefMode (FALSE)
-{
- Image aFxHC( ModuleRes( IMG_FX_H ) );
- FreeResource();
- aDefaultString=aFtEditDesc.GetText();
-
- SetPosPixel(aPos);
- nEdFocus=NOT_FOUND;
- nActiveLine=0;
- Size aSize = aSlider.GetSizePixel();
- aSize.Width() = GetSettings().GetStyleSettings().GetScrollBarSize();
- aSlider.SetSizePixel( aSize );
- aSlider.SetEndScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
- aSlider.SetScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
-
- aBtnFx1.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
- aBtnFx2.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
- aBtnFx3.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
- aBtnFx4.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
-
- InitArgInput( 0, aFtArg1, aBtnFx1, aEdArg1, aRefBtn1);
- InitArgInput( 1, aFtArg2, aBtnFx2, aEdArg2, aRefBtn2);
- InitArgInput( 2, aFtArg3, aBtnFx3, aEdArg3, aRefBtn3);
- InitArgInput( 3, aFtArg4, aBtnFx4, aEdArg4, aRefBtn4);
- ClearAll();
-}
-
-void ParaWin::UpdateArgDesc( USHORT nArg )
-{
- if (nArg==NOT_FOUND) return;
-
- if ( nArgs > 4 )
- nArg = sal::static_int_cast<USHORT>( nArg + GetSliderPos() );
- //@ nArg += (USHORT)aSlider.GetThumbPos();
-
- if ( (nArgs > 0) && (nArg<nArgs) )
- {
- String aArgDesc;
- String aArgName;
-
- SetArgumentDesc( String() );
- SetArgumentText( String() );
-
- if ( nArgs < VAR_ARGS )
- {
- USHORT nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg;
- aArgDesc = pFuncDesc->getParameterDescription(nRealArg);
- aArgName = pFuncDesc->getParameterName(nRealArg);
- aArgName += ' ';
- aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
- }
- else
- {
- USHORT nFix = nArgs - VAR_ARGS;
- USHORT nPos = ( nArg < nFix ? nArg : nFix );
- USHORT nRealArg = (nPos < aVisibleArgMapping.size() ?
- aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
- aArgDesc = pFuncDesc->getParameterDescription(nRealArg);
- aArgName = pFuncDesc->getParameterName(nRealArg);
- if ( nArg >= nFix )
- aArgName += String::CreateFromInt32(nArg-nFix+1);
- aArgName += ' ';
-
- aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
- }
-
- SetArgumentDesc(aArgDesc);
- SetArgumentText(aArgName);
- }
-}
-
-void ParaWin::UpdateArgInput( USHORT nOffset, USHORT i )
-{
- USHORT nArg = nOffset + i;
- if ( nArgs < VAR_ARGS)
- {
- if(nArg<nArgs)
- {
- USHORT nRealArg = aVisibleArgMapping[nArg];
- SetArgNameFont (i,(pFuncDesc->isParameterOptional(nRealArg))
- ? aFntLight : aFntBold );
- SetArgName (i,pFuncDesc->getParameterName(nRealArg));
- }
- }
- else
- {
- USHORT nFix = nArgs - VAR_ARGS;
- USHORT nPos = ( nArg < nFix ? nArg : nFix );
- USHORT nRealArg = (nPos < aVisibleArgMapping.size() ?
- aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
- SetArgNameFont( i,
- (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ?
- aFntLight : aFntBold );
- if ( nArg >= nFix )
- {
- String aArgName( pFuncDesc->getParameterName(nRealArg) );
- aArgName += String::CreateFromInt32(nArg-nFix+1);
- SetArgName( i, aArgName );
- }
- else
- SetArgName( i, pFuncDesc->getParameterName(nRealArg) );
- }
- if(nArg<nArgs) SetArgVal(i,aParaArray[nArg]);
- //@ aArgInput[i].SetArgVal( *(pArgArr[nOffset+i]) );
-
-}
-
-ParaWin::~ParaWin()
-{
- // #i66422# if the focus changes during destruction of the controls,
- // don't call the focus handlers
- Link aEmptyLink;
- aBtnFx1.SetGetFocusHdl( aEmptyLink );
- aBtnFx2.SetGetFocusHdl( aEmptyLink );
- aBtnFx3.SetGetFocusHdl( aEmptyLink );
- aBtnFx4.SetGetFocusHdl( aEmptyLink );
-}
-
-USHORT ParaWin::GetActiveLine()
-{
- return nActiveLine;
-}
-
-void ParaWin::SetActiveLine(USHORT no)
-{
- if(no<nArgs)
- {
- long nOffset = GetSliderPos();
- nActiveLine=no;
- long nNewEdPos=(long)nActiveLine-nOffset;
- if(nNewEdPos<0 || nNewEdPos>3)
- {
- nOffset+=nNewEdPos;
- SetSliderPos((USHORT) nOffset);
- nOffset=GetSliderPos();
- }
- nEdFocus=no-(USHORT)nOffset;
- UpdateArgDesc( nEdFocus );
- }
-}
-
-RefEdit* ParaWin::GetActiveEdit()
-{
- if(nArgs>0 && nEdFocus!=NOT_FOUND)
- {
- return aArgInput[nEdFocus].GetArgEdPtr();
- }
- else
- {
- return NULL;
- }
-}
-
-
-String ParaWin::GetArgument(USHORT no)
-{
- String aStr;
- if(no<aParaArray.size())
- {
- aStr=aParaArray[no];
- if(no==nActiveLine && aStr.Len()==0)
- aStr+=' ';
- }
- return aStr;
-}
-
-String ParaWin::GetActiveArgName()
-{
- String aStr;
- if(nArgs>0 && nEdFocus!=NOT_FOUND)
- {
- aStr=aArgInput[nEdFocus].GetArgName();
- }
- return aStr;
-}
-
-
-void ParaWin::SetArgument(USHORT no, const String& aString)
-{
- if(no<aParaArray.size())
- {
- aParaArray[no] = aString;
- aParaArray[no].EraseLeadingChars();
- }
-}
-
-void ParaWin::DelParaArray()
-{
- ::std::vector<String>().swap(aParaArray);
-}
-
-void ParaWin::SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont)
-{
- aFntBold=aBoldFont;
- aFntLight=aLightFont;
-}
-
-void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc)
-{
- pFuncDesc=pFDesc;
-
- SetArgumentDesc( String() );
- SetArgumentText( String() );
- SetEditDesc( String() );
- nArgs = 0;
- if ( pFuncDesc!=NULL)
- {
- if ( pFuncDesc->getDescription().getLength() )
- {
- SetEditDesc(pFuncDesc->getDescription());
- }
- else
- {
- SetEditDesc(aDefaultString);
- }
- long nHelpId = pFuncDesc->getHelpId();
- nArgs = pFuncDesc->getSuppressedArgumentCount();
- pFuncDesc->fillVisibleArgumentMapping(aVisibleArgMapping);
- aSlider.Hide();
- SetHelpId( nHelpId );
- aEdArg1.SetHelpId( nHelpId );
- aEdArg2.SetHelpId( nHelpId );
- aEdArg3.SetHelpId( nHelpId );
- aEdArg4.SetHelpId( nHelpId );
-
- // Unique-IDs muessen gleich bleiben fuer Automatisierung
- SetUniqueId( HID_FORMULA_FAP_PAGE );
- aEdArg1.SetUniqueId( HID_FORMULA_FAP_EDIT1 );
- aEdArg2.SetUniqueId( HID_FORMULA_FAP_EDIT2 );
- aEdArg3.SetUniqueId( HID_FORMULA_FAP_EDIT3 );
- aEdArg4.SetUniqueId( HID_FORMULA_FAP_EDIT4 );
- SetActiveLine(0);
- }
- else
- {
- nActiveLine=0;
- }
-
-}
-
-void ParaWin::SetArgumentText(const String& aText)
-{
- aFtArgName.SetText(aText);
-}
-
-void ParaWin::SetArgumentDesc(const String& aText)
-{
- aFtArgDesc.SetText(aText);
-}
-
-void ParaWin::SetEditDesc(const String& aText)
-{
- aFtEditDesc.SetText(aText);
-}
-
-void ParaWin::SetArgName(USHORT no,const String& aText)
-{
- aArgInput[no].SetArgName(aText);
-}
-
-void ParaWin::SetArgNameFont(USHORT no,const Font& aFont)
-{
- aArgInput[no].SetArgNameFont(aFont);
-}
-
-void ParaWin::SetArgVal(USHORT no,const String& aText)
-{
- aArgInput[no].SetArgVal(aText);
-}
-
-void ParaWin::HideParaLine(USHORT no)
-{
- aArgInput[no].Hide();
-}
-
-void ParaWin::ShowParaLine(USHORT no)
-{
- aArgInput[no].Show();
-}
-
-void ParaWin::SetEdFocus(USHORT no)
-{
- UpdateArgDesc(no);
- if(no<4 && no<aParaArray.size())
- aArgInput[no].GetArgEdPtr()->GrabFocus();
-}
-
-
-void ParaWin::InitArgInput( USHORT nPos, FixedText& rFtArg, ImageButton& rBtnFx,
- ArgEdit& rEdArg, RefButton& rRefBtn)
-{
-
- rRefBtn.SetReferences(pMyParent,&rEdArg);
- rEdArg.SetRefDialog(pMyParent);
-
- aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn);
-
- aArgInput[nPos].Hide();
-
- aArgInput[nPos].SetFxClickHdl ( LINK( this, ParaWin, GetFxHdl ) );
- aArgInput[nPos].SetFxFocusHdl ( LINK( this, ParaWin, GetFxFocusHdl ) );
- aArgInput[nPos].SetEdFocusHdl ( LINK( this, ParaWin, GetEdFocusHdl ) );
- aArgInput[nPos].SetEdModifyHdl ( LINK( this, ParaWin, ModifyHdl ) );
-}
-
-void ParaWin::ClearAll()
-{
- SetFunctionDesc(NULL);
- SetArgumentOffset(0);
-}
-
-void ParaWin::SetArgumentOffset(USHORT nOffset)
-{
- DelParaArray();
- aSlider.SetThumbPos(0);
-
- aParaArray.resize(nArgs);
-
- if ( nArgs > 0 )
- {
- for ( int i=0; i<4 && i<nArgs; i++ )
- {
- String aString;
- aArgInput[i].SetArgVal(aString);
- aArgInput[i].GetArgEdPtr()->Init(
- (i==0) ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(),
- (i==3 || i==nArgs-1) ? (ArgEdit *)NULL : aArgInput[i+1].GetArgEdPtr(),
- aSlider, nArgs );
- }
- }
-
- if ( nArgs < 5 )
- {
- aSlider.Hide();
- }
- else
- {
- //aSlider.SetEndScrollHdl( LINK( this, ScFormulaDlg, ScrollHdl ) );
- aSlider.SetPageSize( 4 );
- aSlider.SetVisibleSize( 4 );
- aSlider.SetLineSize( 1 );
- aSlider.SetRange( Range( 0, nArgs ) );
- aSlider.SetThumbPos( nOffset );
- aSlider.Show();
- }
-
- UpdateParas();
-}
-
-void ParaWin::UpdateParas()
-{
- USHORT i;
- USHORT nOffset = GetSliderPos();
-
- if ( nArgs > 0 )
- {
- for ( i=0; (i<nArgs) && (i<4); i++ )
- {
- UpdateArgInput( nOffset, i );
- ShowParaLine(i);
- }
- }
-
- for ( i=nArgs; i<4; i++ ) HideParaLine(i);
-}
-
-
-USHORT ParaWin::GetSliderPos()
-{
- return (USHORT) aSlider.GetThumbPos();
-}
-
-void ParaWin::SetSliderPos(USHORT nSliderPos)
-{
- USHORT nOffset = GetSliderPos();
-
- if(aSlider.IsVisible() && nOffset!=nSliderPos)
- {
- aSlider.SetThumbPos(nSliderPos);
- for ( USHORT i=0; i<4; i++ )
- {
- UpdateArgInput( nSliderPos, i );
- }
- }
-}
-
-void ParaWin::SliderMoved()
-{
- USHORT nOffset = GetSliderPos();
-
- for ( USHORT i=0; i<4; i++ )
- {
- UpdateArgInput( nOffset, i );
- }
- if(nEdFocus!=NOT_FOUND)
- {
- UpdateArgDesc( nEdFocus );
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- nActiveLine=nEdFocus+nOffset;
- ArgumentModified();
- }
- aScrollLink.Call(this);
-}
-
-void ParaWin::ArgumentModified()
-{
- aArgModifiedLink.Call(this);
-}
-
-void ParaWin::FxClick()
-{
- aFxLink.Call(this);
-}
-
-
-IMPL_LINK( ParaWin, GetFxHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
-
- if(nEdFocus!=NOT_FOUND)
- {
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- nActiveLine=nEdFocus+nOffset;
- FxClick();
- }
- return 0;
-}
-
-IMPL_LINK( ParaWin, GetFxFocusHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
-
- if(nEdFocus!=NOT_FOUND)
- {
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- UpdateArgDesc( nEdFocus );
- nActiveLine=nEdFocus+nOffset;
- }
- return 0;
-}
-
-
-
-IMPL_LINK( ParaWin, GetEdFocusHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
-
- if(nEdFocus!=NOT_FOUND)
- {
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- UpdateArgDesc( nEdFocus );
- nActiveLine=nEdFocus+nOffset;
- ArgumentModified();
- }
-
- return 0;
-}
-
-
-IMPL_LINK( ParaWin, ScrollHdl, ScrollBar*, EMPTYARG )
-{
- SliderMoved();
-
- return 0;
-}
-
-IMPL_LINK( ParaWin, ModifyHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
- if(nEdFocus!=NOT_FOUND)
- {
- aParaArray[nEdFocus+nOffset] = aArgInput[nEdFocus].GetArgVal();
- UpdateArgDesc( nEdFocus);
- nActiveLine=nEdFocus+nOffset;
- }
-
- ArgumentModified();
- return 0;
-}
-
-
-
-} // formula
+/************************************************************************* + * + * 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: parawin.cxx,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_formula.hxx" + + + +//---------------------------------------------------------------------------- + +#include <svtools/zforlist.hxx> +#include <svtools/stritem.hxx> + +#include "parawin.hxx" +#include "parawin.hrc" +#include "helpids.hrc" +#include "formula/formdata.hxx" +#include "formula/IFunctionDescription.hxx" +#include "ModuleHelper.hxx" +#include "ForResId.hrc" + +#define VAR_ARGS 30 +namespace formula +{ +//============================================================================ + +ParaWin::ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos): + TabPage (pParent,ModuleRes(RID_FORMULATAB_PARAMETER)), + pFuncDesc ( NULL ), + pMyParent (_pDlg), + aFtEditDesc ( this, ModuleRes( FT_EDITDESC ) ), + aFtArgName ( this, ModuleRes( FT_PARNAME ) ), + aFtArgDesc ( this, ModuleRes( FT_PARDESC ) ), + + aFtArg1 ( this, ModuleRes( FT_ARG1 ) ), + aFtArg2 ( this, ModuleRes( FT_ARG2 ) ), + aFtArg3 ( this, ModuleRes( FT_ARG3 ) ), + aFtArg4 ( this, ModuleRes( FT_ARG4 ) ), + + aBtnFx1 ( this, ModuleRes( BTN_FX1 ) ), + aBtnFx2 ( this, ModuleRes( BTN_FX2 ) ), + aBtnFx3 ( this, ModuleRes( BTN_FX3 ) ), + aBtnFx4 ( this, ModuleRes( BTN_FX4 ) ), + + aEdArg1 ( this, ModuleRes( ED_ARG1 ) ), + aEdArg2 ( this, ModuleRes( ED_ARG2 ) ), + aEdArg3 ( this, ModuleRes( ED_ARG3 ) ), + aEdArg4 ( this, ModuleRes( ED_ARG4 ) ), + + aRefBtn1 ( this, ModuleRes( RB_ARG1 ) ), + aRefBtn2 ( this, ModuleRes( RB_ARG2 ) ), + aRefBtn3 ( this, ModuleRes( RB_ARG3 ) ), + aRefBtn4 ( this, ModuleRes( RB_ARG4 ) ), + + aSlider ( this, ModuleRes( WND_SLIDER ) ), + m_sOptional ( ModuleRes( STR_OPTIONAL ) ), + m_sRequired ( ModuleRes( STR_REQUIRED ) ), + bRefMode (FALSE) +{ + Image aFxHC( ModuleRes( IMG_FX_H ) ); + FreeResource(); + aDefaultString=aFtEditDesc.GetText(); + + SetPosPixel(aPos); + nEdFocus=NOT_FOUND; + nActiveLine=0; + Size aSize = aSlider.GetSizePixel(); + aSize.Width() = GetSettings().GetStyleSettings().GetScrollBarSize(); + aSlider.SetSizePixel( aSize ); + aSlider.SetEndScrollHdl( LINK( this, ParaWin, ScrollHdl ) ); + aSlider.SetScrollHdl( LINK( this, ParaWin, ScrollHdl ) ); + + aBtnFx1.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST ); + aBtnFx2.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST ); + aBtnFx3.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST ); + aBtnFx4.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST ); + + InitArgInput( 0, aFtArg1, aBtnFx1, aEdArg1, aRefBtn1); + InitArgInput( 1, aFtArg2, aBtnFx2, aEdArg2, aRefBtn2); + InitArgInput( 2, aFtArg3, aBtnFx3, aEdArg3, aRefBtn3); + InitArgInput( 3, aFtArg4, aBtnFx4, aEdArg4, aRefBtn4); + ClearAll(); +} + +void ParaWin::UpdateArgDesc( USHORT nArg ) +{ + if (nArg==NOT_FOUND) return; + + if ( nArgs > 4 ) + nArg = sal::static_int_cast<USHORT>( nArg + GetSliderPos() ); + //@ nArg += (USHORT)aSlider.GetThumbPos(); + + if ( (nArgs > 0) && (nArg<nArgs) ) + { + String aArgDesc; + String aArgName; + + SetArgumentDesc( String() ); + SetArgumentText( String() ); + + if ( nArgs < VAR_ARGS ) + { + USHORT nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg; + aArgDesc = pFuncDesc->getParameterDescription(nRealArg); + aArgName = pFuncDesc->getParameterName(nRealArg); + aArgName += ' '; + aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ; + } + else + { + USHORT nFix = nArgs - VAR_ARGS; + USHORT nPos = ( nArg < nFix ? nArg : nFix ); + USHORT nRealArg = (nPos < aVisibleArgMapping.size() ? + aVisibleArgMapping[nPos] : aVisibleArgMapping.back()); + aArgDesc = pFuncDesc->getParameterDescription(nRealArg); + aArgName = pFuncDesc->getParameterName(nRealArg); + if ( nArg >= nFix ) + aArgName += String::CreateFromInt32(nArg-nFix+1); + aArgName += ' '; + + aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ; + } + + SetArgumentDesc(aArgDesc); + SetArgumentText(aArgName); + } +} + +void ParaWin::UpdateArgInput( USHORT nOffset, USHORT i ) +{ + USHORT nArg = nOffset + i; + if ( nArgs < VAR_ARGS) + { + if(nArg<nArgs) + { + USHORT nRealArg = aVisibleArgMapping[nArg]; + SetArgNameFont (i,(pFuncDesc->isParameterOptional(nRealArg)) + ? aFntLight : aFntBold ); + SetArgName (i,pFuncDesc->getParameterName(nRealArg)); + } + } + else + { + USHORT nFix = nArgs - VAR_ARGS; + USHORT nPos = ( nArg < nFix ? nArg : nFix ); + USHORT nRealArg = (nPos < aVisibleArgMapping.size() ? + aVisibleArgMapping[nPos] : aVisibleArgMapping.back()); + SetArgNameFont( i, + (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? + aFntLight : aFntBold ); + if ( nArg >= nFix ) + { + String aArgName( pFuncDesc->getParameterName(nRealArg) ); + aArgName += String::CreateFromInt32(nArg-nFix+1); + SetArgName( i, aArgName ); + } + else + SetArgName( i, pFuncDesc->getParameterName(nRealArg) ); + } + if(nArg<nArgs) SetArgVal(i,aParaArray[nArg]); + //@ aArgInput[i].SetArgVal( *(pArgArr[nOffset+i]) ); + +} + +ParaWin::~ParaWin() +{ + // #i66422# if the focus changes during destruction of the controls, + // don't call the focus handlers + Link aEmptyLink; + aBtnFx1.SetGetFocusHdl( aEmptyLink ); + aBtnFx2.SetGetFocusHdl( aEmptyLink ); + aBtnFx3.SetGetFocusHdl( aEmptyLink ); + aBtnFx4.SetGetFocusHdl( aEmptyLink ); +} + +USHORT ParaWin::GetActiveLine() +{ + return nActiveLine; +} + +void ParaWin::SetActiveLine(USHORT no) +{ + if(no<nArgs) + { + long nOffset = GetSliderPos(); + nActiveLine=no; + long nNewEdPos=(long)nActiveLine-nOffset; + if(nNewEdPos<0 || nNewEdPos>3) + { + nOffset+=nNewEdPos; + SetSliderPos((USHORT) nOffset); + nOffset=GetSliderPos(); + } + nEdFocus=no-(USHORT)nOffset; + UpdateArgDesc( nEdFocus ); + } +} + +RefEdit* ParaWin::GetActiveEdit() +{ + if(nArgs>0 && nEdFocus!=NOT_FOUND) + { + return aArgInput[nEdFocus].GetArgEdPtr(); + } + else + { + return NULL; + } +} + + +String ParaWin::GetArgument(USHORT no) +{ + String aStr; + if(no<aParaArray.size()) + { + aStr=aParaArray[no]; + if(no==nActiveLine && aStr.Len()==0) + aStr+=' '; + } + return aStr; +} + +String ParaWin::GetActiveArgName() +{ + String aStr; + if(nArgs>0 && nEdFocus!=NOT_FOUND) + { + aStr=aArgInput[nEdFocus].GetArgName(); + } + return aStr; +} + + +void ParaWin::SetArgument(USHORT no, const String& aString) +{ + if(no<aParaArray.size()) + { + aParaArray[no] = aString; + aParaArray[no].EraseLeadingChars(); + } +} + +void ParaWin::DelParaArray() +{ + ::std::vector<String>().swap(aParaArray); +} + +void ParaWin::SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont) +{ + aFntBold=aBoldFont; + aFntLight=aLightFont; +} + +void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc) +{ + pFuncDesc=pFDesc; + + SetArgumentDesc( String() ); + SetArgumentText( String() ); + SetEditDesc( String() ); + nArgs = 0; + if ( pFuncDesc!=NULL) + { + if ( pFuncDesc->getDescription().getLength() ) + { + SetEditDesc(pFuncDesc->getDescription()); + } + else + { + SetEditDesc(aDefaultString); + } + long nHelpId = pFuncDesc->getHelpId(); + nArgs = pFuncDesc->getSuppressedArgumentCount(); + pFuncDesc->fillVisibleArgumentMapping(aVisibleArgMapping); + aSlider.Hide(); + SetHelpId( nHelpId ); + aEdArg1.SetHelpId( nHelpId ); + aEdArg2.SetHelpId( nHelpId ); + aEdArg3.SetHelpId( nHelpId ); + aEdArg4.SetHelpId( nHelpId ); + + // Unique-IDs muessen gleich bleiben fuer Automatisierung + SetUniqueId( HID_FORMULA_FAP_PAGE ); + aEdArg1.SetUniqueId( HID_FORMULA_FAP_EDIT1 ); + aEdArg2.SetUniqueId( HID_FORMULA_FAP_EDIT2 ); + aEdArg3.SetUniqueId( HID_FORMULA_FAP_EDIT3 ); + aEdArg4.SetUniqueId( HID_FORMULA_FAP_EDIT4 ); + SetActiveLine(0); + } + else + { + nActiveLine=0; + } + +} + +void ParaWin::SetArgumentText(const String& aText) +{ + aFtArgName.SetText(aText); +} + +void ParaWin::SetArgumentDesc(const String& aText) +{ + aFtArgDesc.SetText(aText); +} + +void ParaWin::SetEditDesc(const String& aText) +{ + aFtEditDesc.SetText(aText); +} + +void ParaWin::SetArgName(USHORT no,const String& aText) +{ + aArgInput[no].SetArgName(aText); +} + +void ParaWin::SetArgNameFont(USHORT no,const Font& aFont) +{ + aArgInput[no].SetArgNameFont(aFont); +} + +void ParaWin::SetArgVal(USHORT no,const String& aText) +{ + aArgInput[no].SetArgVal(aText); +} + +void ParaWin::HideParaLine(USHORT no) +{ + aArgInput[no].Hide(); +} + +void ParaWin::ShowParaLine(USHORT no) +{ + aArgInput[no].Show(); +} + +void ParaWin::SetEdFocus(USHORT no) +{ + UpdateArgDesc(no); + if(no<4 && no<aParaArray.size()) + aArgInput[no].GetArgEdPtr()->GrabFocus(); +} + + +void ParaWin::InitArgInput( USHORT nPos, FixedText& rFtArg, ImageButton& rBtnFx, + ArgEdit& rEdArg, RefButton& rRefBtn) +{ + + rRefBtn.SetReferences(pMyParent,&rEdArg); + rEdArg.SetRefDialog(pMyParent); + + aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn); + + aArgInput[nPos].Hide(); + + aArgInput[nPos].SetFxClickHdl ( LINK( this, ParaWin, GetFxHdl ) ); + aArgInput[nPos].SetFxFocusHdl ( LINK( this, ParaWin, GetFxFocusHdl ) ); + aArgInput[nPos].SetEdFocusHdl ( LINK( this, ParaWin, GetEdFocusHdl ) ); + aArgInput[nPos].SetEdModifyHdl ( LINK( this, ParaWin, ModifyHdl ) ); +} + +void ParaWin::ClearAll() +{ + SetFunctionDesc(NULL); + SetArgumentOffset(0); +} + +void ParaWin::SetArgumentOffset(USHORT nOffset) +{ + DelParaArray(); + aSlider.SetThumbPos(0); + + aParaArray.resize(nArgs); + + if ( nArgs > 0 ) + { + for ( int i=0; i<4 && i<nArgs; i++ ) + { + String aString; + aArgInput[i].SetArgVal(aString); + aArgInput[i].GetArgEdPtr()->Init( + (i==0) ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(), + (i==3 || i==nArgs-1) ? (ArgEdit *)NULL : aArgInput[i+1].GetArgEdPtr(), + aSlider, nArgs ); + } + } + + if ( nArgs < 5 ) + { + aSlider.Hide(); + } + else + { + //aSlider.SetEndScrollHdl( LINK( this, ScFormulaDlg, ScrollHdl ) ); + aSlider.SetPageSize( 4 ); + aSlider.SetVisibleSize( 4 ); + aSlider.SetLineSize( 1 ); + aSlider.SetRange( Range( 0, nArgs ) ); + aSlider.SetThumbPos( nOffset ); + aSlider.Show(); + } + + UpdateParas(); +} + +void ParaWin::UpdateParas() +{ + USHORT i; + USHORT nOffset = GetSliderPos(); + + if ( nArgs > 0 ) + { + for ( i=0; (i<nArgs) && (i<4); i++ ) + { + UpdateArgInput( nOffset, i ); + ShowParaLine(i); + } + } + + for ( i=nArgs; i<4; i++ ) HideParaLine(i); +} + + +USHORT ParaWin::GetSliderPos() +{ + return (USHORT) aSlider.GetThumbPos(); +} + +void ParaWin::SetSliderPos(USHORT nSliderPos) +{ + USHORT nOffset = GetSliderPos(); + + if(aSlider.IsVisible() && nOffset!=nSliderPos) + { + aSlider.SetThumbPos(nSliderPos); + for ( USHORT i=0; i<4; i++ ) + { + UpdateArgInput( nSliderPos, i ); + } + } +} + +void ParaWin::SliderMoved() +{ + USHORT nOffset = GetSliderPos(); + + for ( USHORT i=0; i<4; i++ ) + { + UpdateArgInput( nOffset, i ); + } + if(nEdFocus!=NOT_FOUND) + { + UpdateArgDesc( nEdFocus ); + aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX )); + nActiveLine=nEdFocus+nOffset; + ArgumentModified(); + } + aScrollLink.Call(this); +} + +void ParaWin::ArgumentModified() +{ + aArgModifiedLink.Call(this); +} + +void ParaWin::FxClick() +{ + aFxLink.Call(this); +} + + +IMPL_LINK( ParaWin, GetFxHdl, ArgInput*, pPtr ) +{ + USHORT nOffset = GetSliderPos(); + nEdFocus=NOT_FOUND; + for ( USHORT nPos=0; nPos<5;nPos++) + { + if(pPtr == &aArgInput[nPos]) + { + nEdFocus=nPos; + break; + } + } + + if(nEdFocus!=NOT_FOUND) + { + aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX )); + nActiveLine=nEdFocus+nOffset; + FxClick(); + } + return 0; +} + +IMPL_LINK( ParaWin, GetFxFocusHdl, ArgInput*, pPtr ) +{ + USHORT nOffset = GetSliderPos(); + nEdFocus=NOT_FOUND; + for ( USHORT nPos=0; nPos<5;nPos++) + { + if(pPtr == &aArgInput[nPos]) + { + nEdFocus=nPos; + break; + } + } + + if(nEdFocus!=NOT_FOUND) + { + aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX )); + UpdateArgDesc( nEdFocus ); + nActiveLine=nEdFocus+nOffset; + } + return 0; +} + + + +IMPL_LINK( ParaWin, GetEdFocusHdl, ArgInput*, pPtr ) +{ + USHORT nOffset = GetSliderPos(); + nEdFocus=NOT_FOUND; + for ( USHORT nPos=0; nPos<5;nPos++) + { + if(pPtr == &aArgInput[nPos]) + { + nEdFocus=nPos; + break; + } + } + + if(nEdFocus!=NOT_FOUND) + { + aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX )); + UpdateArgDesc( nEdFocus ); + nActiveLine=nEdFocus+nOffset; + ArgumentModified(); + } + + return 0; +} + + +IMPL_LINK( ParaWin, ScrollHdl, ScrollBar*, EMPTYARG ) +{ + SliderMoved(); + + return 0; +} + +IMPL_LINK( ParaWin, ModifyHdl, ArgInput*, pPtr ) +{ + USHORT nOffset = GetSliderPos(); + nEdFocus=NOT_FOUND; + for ( USHORT nPos=0; nPos<5;nPos++) + { + if(pPtr == &aArgInput[nPos]) + { + nEdFocus=nPos; + break; + } + } + if(nEdFocus!=NOT_FOUND) + { + aParaArray[nEdFocus+nOffset] = aArgInput[nEdFocus].GetArgVal(); + UpdateArgDesc( nEdFocus); + nActiveLine=nEdFocus+nOffset; + } + + ArgumentModified(); + return 0; +} + + + +} // formula diff --git a/formula/source/ui/inc/ForResId.hrc b/formula/source/ui/inc/ForResId.hrc index 99ce947a0560..43444bb9a112 100644 --- a/formula/source/ui/inc/ForResId.hrc +++ b/formula/source/ui/inc/ForResId.hrc @@ -1,77 +1,77 @@ -/*************************************************************************
- *
- * 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: RptResId.hrc,v $
- * $Revision: 1.6 $
- *
- * 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 FORMULA_FORRESID_HRC
-#define FORMULA_FORRESID_HRC
-
-// include -----------------------------------------------------------
-
-#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc>
-#endif
-
-#define RID_DIALOG_START RID_FORMULA_START
-#define RID_PAGE_START RID_FORMULA_START
-#define RID_ERRORBOX_START RID_FORMULA_START
-#define RID_QUERYBOX_START RID_FORMULA_START
-#define RID_TOOLBOX_START RID_FORMULA_START
-#define RID_BITMAP_START RID_FORMULA_START
-#define RID_IMAGE_START RID_FORMULA_START
-#define RID_IMAGELIST_START RID_FORMULA_START
-#define RID_MENU_START RID_FORMULA_START
-#define RID_STRING_START RID_FORMULA_START
-#define RID_UNTYPED_START RID_FORMULA_START
-#define RID_WARN_START RID_FORMULA_START
-#define RID_CONTROL_START RID_FORMULA_START
-#define RID_MISC_START RID_FORMULA_START
-
-// Dialog Control Id's -----------------------------------------------------------
-
-// strings
-
-// bitmap
-#define RID_BMP_REFBTN1 (RID_BITMAP_START + 0)
-#define RID_BMP_REFBTN1_H (RID_BITMAP_START + 1)
-#define RID_BMP_REFBTN2 (RID_BITMAP_START + 2)
-#define RID_BMP_REFBTN2_H (RID_BITMAP_START + 3)
-
-
-// pages
-#define RID_FORMULATAB_STRUCT (RID_PAGE_START + 0)
-#define RID_FORMULATAB_FUNCTION (RID_PAGE_START + 1)
-#define RID_FORMULADLG_FORMULA (RID_PAGE_START + 2)
-#define RID_FORMULATAB_PARAMETER (RID_PAGE_START + 3)
-#define RID_FORMULADLG_FORMULA_MODAL (RID_PAGE_START + 4)
-
-// misc
-
-// -----------------------------------------------------------------------
-
-#endif // FORMULA_FORRESID_HRC
+/************************************************************************* + * + * 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: RptResId.hrc,v $ + * $Revision: 1.6 $ + * + * 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 FORMULA_FORRESID_HRC +#define FORMULA_FORRESID_HRC + +// include ----------------------------------------------------------- + +#ifndef _SOLAR_HRC +#include <svtools/solar.hrc> +#endif + +#define RID_DIALOG_START RID_FORMULA_START +#define RID_PAGE_START RID_FORMULA_START +#define RID_ERRORBOX_START RID_FORMULA_START +#define RID_QUERYBOX_START RID_FORMULA_START +#define RID_TOOLBOX_START RID_FORMULA_START +#define RID_BITMAP_START RID_FORMULA_START +#define RID_IMAGE_START RID_FORMULA_START +#define RID_IMAGELIST_START RID_FORMULA_START +#define RID_MENU_START RID_FORMULA_START +#define RID_STRING_START RID_FORMULA_START +#define RID_UNTYPED_START RID_FORMULA_START +#define RID_WARN_START RID_FORMULA_START +#define RID_CONTROL_START RID_FORMULA_START +#define RID_MISC_START RID_FORMULA_START + +// Dialog Control Id's ----------------------------------------------------------- + +// strings + +// bitmap +#define RID_BMP_REFBTN1 (RID_BITMAP_START + 0) +#define RID_BMP_REFBTN1_H (RID_BITMAP_START + 1) +#define RID_BMP_REFBTN2 (RID_BITMAP_START + 2) +#define RID_BMP_REFBTN2_H (RID_BITMAP_START + 3) + + +// pages +#define RID_FORMULATAB_STRUCT (RID_PAGE_START + 0) +#define RID_FORMULATAB_FUNCTION (RID_PAGE_START + 1) +#define RID_FORMULADLG_FORMULA (RID_PAGE_START + 2) +#define RID_FORMULATAB_PARAMETER (RID_PAGE_START + 3) +#define RID_FORMULADLG_FORMULA_MODAL (RID_PAGE_START + 4) + +// misc + +// ----------------------------------------------------------------------- + +#endif // FORMULA_FORRESID_HRC diff --git a/formula/util/hidother.src b/formula/util/hidother.src index e29c9e9341c7..0a4ac39bd04d 100644 --- a/formula/util/hidother.src +++ b/formula/util/hidother.src @@ -1,57 +1,57 @@ -/*************************************************************************
-*
- * 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: hidother.src,v $
- * $Revision: 1.7 $
- *
- * 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.
- *
-************************************************************************/
-
-#include "../inc/helpids.hrc"
-
-#ifndef _SBASLTID_HRC
-#include <svx/svxids.hrc>
-#endif
-
-hidspecial HID_FORMULADLG_FORMULA { HelpId = HID_FORMULADLG_FORMULA; };
-hidspecial HID_FORMULA_FAP_FORMULA { HelpId = HID_FORMULA_FAP_FORMULA; };
-hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; };
-hidspecial HID_FORMULA_FAP_PAGE { HelpId = HID_FORMULA_FAP_PAGE; };
-hidspecial HID_FORMULA_FAP_EDIT1 { HelpId = HID_FORMULA_FAP_EDIT1; };
-hidspecial HID_FORMULA_FAP_EDIT2 { HelpId = HID_FORMULA_FAP_EDIT2; };
-hidspecial HID_FORMULA_FAP_EDIT3 { HelpId = HID_FORMULA_FAP_EDIT3; };
-hidspecial HID_FORMULA_FAP_EDIT4 { HelpId = HID_FORMULA_FAP_EDIT4; };
-hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; };
-hidspecial HID_FORMULA_FAP_BTN_FX1 { HelpId = HID_FORMULA_FAP_BTN_FX1; };
-hidspecial HID_FORMULA_FAP_BTN_FX2 { HelpId = HID_FORMULA_FAP_BTN_FX2; };
-hidspecial HID_FORMULA_FAP_BTN_FX3 { HelpId = HID_FORMULA_FAP_BTN_FX3; };
-hidspecial HID_FORMULA_FAP_BTN_FX4 { HelpId = HID_FORMULA_FAP_BTN_FX4; };
-hidspecial HID_FORMULA_FAP_BTN_REF1 { HelpId = HID_FORMULA_FAP_BTN_REF1; };
-hidspecial HID_FORMULA_FAP_BTN_REF2 { HelpId = HID_FORMULA_FAP_BTN_REF3; };
-hidspecial HID_FORMULA_FAP_BTN_REF3 { HelpId = HID_FORMULA_FAP_BTN_REF3; };
-hidspecial HID_FORMULA_FAP_BTN_REF4 { HelpId = HID_FORMULA_FAP_BTN_REF4; };
-hidspecial HID_FORMULA_LB_CATEGORY { HelpId = HID_FORMULA_LB_CATEGORY; };
-hidspecial HID_FORMULA_LB_FUNCTION { HelpId = HID_FORMULA_LB_FUNCTION; };
-hidspecial HID_FORMULATAB_FUNCTION { HelpId = HID_FORMULATAB_FUNCTION; };
-hidspecial HID_FORMULATAB_STRUCT { HelpId = HID_FORMULATAB_STRUCT; };
+/************************************************************************* +* + * 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: hidother.src,v $ + * $Revision: 1.7 $ + * + * 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. + * +************************************************************************/ + +#include "../inc/helpids.hrc" + +#ifndef _SBASLTID_HRC +#include <svx/svxids.hrc> +#endif + +hidspecial HID_FORMULADLG_FORMULA { HelpId = HID_FORMULADLG_FORMULA; }; +hidspecial HID_FORMULA_FAP_FORMULA { HelpId = HID_FORMULA_FAP_FORMULA; }; +hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; }; +hidspecial HID_FORMULA_FAP_PAGE { HelpId = HID_FORMULA_FAP_PAGE; }; +hidspecial HID_FORMULA_FAP_EDIT1 { HelpId = HID_FORMULA_FAP_EDIT1; }; +hidspecial HID_FORMULA_FAP_EDIT2 { HelpId = HID_FORMULA_FAP_EDIT2; }; +hidspecial HID_FORMULA_FAP_EDIT3 { HelpId = HID_FORMULA_FAP_EDIT3; }; +hidspecial HID_FORMULA_FAP_EDIT4 { HelpId = HID_FORMULA_FAP_EDIT4; }; +hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; }; +hidspecial HID_FORMULA_FAP_BTN_FX1 { HelpId = HID_FORMULA_FAP_BTN_FX1; }; +hidspecial HID_FORMULA_FAP_BTN_FX2 { HelpId = HID_FORMULA_FAP_BTN_FX2; }; +hidspecial HID_FORMULA_FAP_BTN_FX3 { HelpId = HID_FORMULA_FAP_BTN_FX3; }; +hidspecial HID_FORMULA_FAP_BTN_FX4 { HelpId = HID_FORMULA_FAP_BTN_FX4; }; +hidspecial HID_FORMULA_FAP_BTN_REF1 { HelpId = HID_FORMULA_FAP_BTN_REF1; }; +hidspecial HID_FORMULA_FAP_BTN_REF2 { HelpId = HID_FORMULA_FAP_BTN_REF3; }; +hidspecial HID_FORMULA_FAP_BTN_REF3 { HelpId = HID_FORMULA_FAP_BTN_REF3; }; +hidspecial HID_FORMULA_FAP_BTN_REF4 { HelpId = HID_FORMULA_FAP_BTN_REF4; }; +hidspecial HID_FORMULA_LB_CATEGORY { HelpId = HID_FORMULA_LB_CATEGORY; }; +hidspecial HID_FORMULA_LB_FUNCTION { HelpId = HID_FORMULA_LB_FUNCTION; }; +hidspecial HID_FORMULATAB_FUNCTION { HelpId = HID_FORMULATAB_FUNCTION; }; +hidspecial HID_FORMULATAB_STRUCT { HelpId = HID_FORMULATAB_STRUCT; }; diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx index 069395f0a442..3e7b04021f3a 100644 --- a/fpicker/source/aqua/FilterHelper.cxx +++ b/fpicker/source/aqua/FilterHelper.cxx @@ -407,6 +407,15 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) // OSL_TRACE(" folder"); return sal_True; } + + NSFileWrapper *wrapper = [[NSFileWrapper alloc] initWithPath:sFilename]; + MacOSBOOL bIsLink = [wrapper isSymbolicLink]; + [wrapper release]; + if (bIsLink) { +// OSL_TRACE(" symboliclink"); + return sal_True; + } + // OSL_TRACE(" file"); FilterList::iterator filter = ::std::find_if(m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch(m_aCurrentFilter)); diff --git a/fpicker/source/aqua/SalAquaFilePicker.cxx b/fpicker/source/aqua/SalAquaFilePicker.cxx index c590e078700b..ef0cde863f2b 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.cxx +++ b/fpicker/source/aqua/SalAquaFilePicker.cxx @@ -191,6 +191,11 @@ sal_Int16 SAL_CALL SalAquaFilePicker::execute() throw( uno::RuntimeException ) implInitialize(); + // if m_pDialog is nil after initialization, something must have gone wrong before + if (m_pDialog == nil) { + throw uno::RuntimeException(rtl::OUString::createFromAscii("The dialog was not properly initialized!"), static_cast< XFilePicker* >( this )); + } + if (m_pFilterHelper) { m_pFilterHelper->SetFilters(); } diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 013c643274d3..0a8b5ca76974 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: OfficeFilePicker.cxx,v $ - * $Revision: 1.17 $ + * $Revision: 1.17.20.1 $ * * This file is part of OpenOffice.org. * @@ -504,6 +504,7 @@ SvtFileDialog* SvtFilePicker::implCreateDialog( Window* _pParent ) { String sStandardDir = String( m_aStandardDir ); dialog->SetStandardDir( sStandardDir ); + dialog->SetBlackList( m_aBlackList ); } return dialog; @@ -1057,19 +1058,31 @@ void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments ) { checkAlive(); + Sequence< Any > aArguments( _rArguments.getLength()); + m_nServiceType = TemplateDescription::FILEOPEN_SIMPLE; if ( _rArguments.getLength() >= 1 ) { // compatibility: one argument, type sal_Int16 , specifies the service type - _rArguments[0] >>= m_nServiceType; + int index = 0; + + if (_rArguments[0] >>= m_nServiceType) + { + // skip the first entry if it was the ServiceType, because it's not needed in OCommonPicker::initialize and it's not a NamedValue + NamedValue emptyNamedValue; + aArguments[0] <<= emptyNamedValue; + index = 1; - for ( int i = 0; i < _rArguments.getLength(); i++) + } + for ( int i = index; i < _rArguments.getLength(); i++) { NamedValue namedValue; + aArguments[i] <<= _rArguments[i]; - if (_rArguments[i] >>= namedValue ) + if (aArguments[i] >>= namedValue ) { + if ( namedValue.Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StandardDir" ) ) ) ) { ::rtl::OUString sStandardDir; @@ -1082,12 +1095,16 @@ void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments ) m_aStandardDir = sStandardDir; } } + else if ( namedValue.Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BlackList" ) ) ) ) + { + namedValue.Value >>= m_aBlackList; + } } } } // let the base class analyze the sequence (will call into implHandleInitializationArgument) - OCommonPicker::initialize( _rArguments ); + OCommonPicker::initialize( aArguments ); } //------------------------------------------------------------------------- @@ -1105,6 +1122,13 @@ sal_Bool SvtFilePicker::implHandleInitializationArgument( const ::rtl::OUString& return sal_True; } + if ( _rName.equalsAscii( "BlackList" ) ) + { + OSL_VERIFY( _rValue >>= m_aBlackList ); + return sal_True; + } + + return OCommonPicker::implHandleInitializationArgument( _rName, _rValue ); } diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index f27bf584ef13..f9ada75ba3d1 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -61,6 +61,7 @@ typedef ::std::list < ElementEntry_Impl > ElementList; typedef ::com::sun::star::beans::StringPair UnoFilterEntry; typedef ::com::sun::star::uno::Sequence< UnoFilterEntry > UnoFilterList; // can be transported more effectively +typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > OUStringList; // can be transported more effectively // class SvtFilePicker --------------------------------------------------- @@ -91,6 +92,7 @@ private: ::rtl::OUString m_aOldHideDirectory; ::rtl::OUString m_aStandardDir; + OUStringList m_aBlackList; ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener; diff --git a/fpicker/source/office/asyncfilepicker.cxx b/fpicker/source/office/asyncfilepicker.cxx index c4f1c81d425f..81d6f7a01fb4 100644 --- a/fpicker/source/office/asyncfilepicker.cxx +++ b/fpicker/source/office/asyncfilepicker.cxx @@ -95,7 +95,12 @@ namespace svt } //-------------------------------------------------------------------- - void AsyncPickerAction::execute( const String& _rURL, const String& _rFilter, sal_Int32 _nMinTimeout, sal_Int32 _nMaxTimeout ) + void AsyncPickerAction::execute( + const String& _rURL, + const String& _rFilter, + sal_Int32 _nMinTimeout, + sal_Int32 _nMaxTimeout, + const OUStringList& rBlackList ) { DBG_TESTSOLARMUTEX(); // if this asserts, we'd need to have an own mutex per instance @@ -129,7 +134,7 @@ namespace svt break; case eOpenURL: - eResult = m_pView->Initialize( _rURL, _rFilter, pActionDescriptor.get() ); + eResult = m_pView->Initialize( _rURL, _rFilter, pActionDescriptor.get(), rBlackList ); break; case eExecuteFilter: diff --git a/fpicker/source/office/asyncfilepicker.hxx b/fpicker/source/office/asyncfilepicker.hxx index 772c0badf5c7..2c3f8e292474 100644 --- a/fpicker/source/office/asyncfilepicker.hxx +++ b/fpicker/source/office/asyncfilepicker.hxx @@ -37,14 +37,20 @@ #include <tools/link.hxx> #include <tools/string.hxx> #include <rtl/ref.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.h> class SvtFileView; class SvtFileDialog; + +typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > OUStringList; + //........................................................................ namespace svt { //........................................................................ + //==================================================================== //= AsyncPickerAction //==================================================================== @@ -82,7 +88,12 @@ namespace svt If smaller than or equal to <arg>_nMinTimeout</arg>, it will be corrected to <arg>_nMinTimeout</arg> + 30000. */ - void execute( const String& _rURL, const String& _rFilter, sal_Int32 _nMinTimeout, sal_Int32 _nMaxTimeout ); + void execute( + const String& _rURL, + const String& _rFilter, + sal_Int32 _nMinTimeout, + sal_Int32 _nMaxTimeout, + const OUStringList& rBlackList = OUStringList() ); /// cancels the running action void cancel(); diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx index 33a4e40ce401..64e506329d24 100644 --- a/fpicker/source/office/commonpicker.cxx +++ b/fpicker/source/office/commonpicker.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: commonpicker.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.12.1 $ * * This file is part of OpenOffice.org. * @@ -449,13 +449,21 @@ namespace svt { if ( *pArgument >>= aPropArg ) { + if ( aPropArg.Name.getLength() <= 0) + continue; + sSettingName = aPropArg.Name; aSettingValue = aPropArg.Value; } else if ( *pArgument >>= aPairArg ) { + if ( aPairArg.Name.getLength() <= 0) + continue; + sSettingName = aPairArg.Name; aSettingValue = aPairArg.Value; + + } else { diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 41e01b7a823c..1b9494bdae22 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -2319,7 +2319,7 @@ void SvtFileDialog::executeAsync( ::svt::AsyncPickerAction::Action _eAction, m_aConfiguration.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Timeout/Max" ) ) ) >>= nMaxTimeout; m_bInExecuteAsync = true; - m_pCurrentAsyncAction->execute( _rURL, _rFilter, bReallyAsync ? nMinTimeout : -1, nMaxTimeout ); + m_pCurrentAsyncAction->execute( _rURL, _rFilter, bReallyAsync ? nMinTimeout : -1, nMaxTimeout, GetBlackList() ); m_bInExecuteAsync = false; } @@ -2356,6 +2356,17 @@ void SvtFileDialog::SetStandardDir( const String& rStdDir ) _pImp->SetStandardDir( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); } +void SvtFileDialog::SetBlackList( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList ) +{ + _pImp->SetBlackList( rBlackList ); +} + +//***************************************************************************** + +const ::com::sun::star::uno::Sequence< ::rtl::OUString >& SvtFileDialog::GetBlackList() const +{ + return _pImp->GetBlackList(); +} //***************************************************************************** const String& SvtFileDialog::GetStandardDir() const diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index c207083796c7..96bcad358edd 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -216,6 +216,8 @@ public: void FileSelect(); void FilterSelect(); + void SetBlackList( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList ); + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetBlackList() const; void SetStandardDir( const String& rStdDir ); const String& GetStandardDir() const; SvStringsDtor* GetPathList() const; // bei MultiSelektion diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index bdd79578319c..35fcc7f95df9 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -200,6 +200,8 @@ private: const SvtFileDialogFilter_Impl* _pCurFilter; String m_sCurrentFilterDisplayName; // may differ from _pCurFilter->GetName in case it is a cached entry + ::com::sun::star::uno::Sequence< ::rtl::OUString > _aBlackList; + public: SvtFileDialogFilterList_Impl* _pFilter; SvtFileDialogFilter_Impl* _pUserFilter; @@ -260,6 +262,9 @@ public: SvtExpFileDlg_Impl( WinBits nBits ); ~SvtExpFileDlg_Impl(); + + inline void SetBlackList( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList ) { _aBlackList = rBlackList; } + inline const ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetBlackList() const { return _aBlackList; } void SetStandardDir( const String& _rDir ); inline const String& GetStandardDir() const { return _aStdDir; } inline void DisableFilterBoxAutoWidth() { _pLbFilter->EnableDDAutoWidth( FALSE ); } diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index d576a61b10df..a0360dbef57c 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -36,6 +36,7 @@ //------------------------------------------------------------------------ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> @@ -124,6 +125,40 @@ void SalGtkFilePicker::InitialMapping() gtk_widget_set_size_request (m_pPreview, -1, -1); } +static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) +{ + static bool bSet = false; + if (bSet) + return; + + OUString sUILocale; + try + { + uno::Reference<lang::XMultiServiceFactory> xConfigMgr = + uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + UNO_QUERY_THROW ); + + Sequence< Any > theArgs(1); + theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General"); + + uno::Reference< container::XNameAccess > xNameAccess = + uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ), + UNO_QUERY_THROW ); + + if (xNameAccess.is()) + xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale; + } catch (...) {} + + if (sUILocale.getLength()) + { + sUILocale = rtl::OUString::createFromAscii("LANGUAGE=") + sUILocale.replace('-', '_'); + putenv(strdup(rtl::OUStringToOString(sUILocale, osl_getThreadTextEncoding()).getStr())); + } + bSet = true; +} + SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : cppu::WeakComponentImplHelper10< XFilterManager, @@ -148,6 +183,8 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact m_PreviewImageWidth( 256 ), m_PreviewImageHeight( 256 ) { + lcl_setGTKLanguage(xServiceMgr); + int i; for( i = 0; i < TOGGLE_LAST; i++ ) diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index 4ea9dedf7d14..a22ef2bea143 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -40,7 +40,6 @@ #include <comphelper/sequenceasvector.hxx> #include <osl/file.hxx> #include <osl/mutex.hxx> -#include <Guiddef.h> inline bool is_current_process_window(HWND hwnd) { @@ -668,6 +667,22 @@ void VistaFilePickerImpl::impl_sta_SetDefaultName(const RequestRef& rRequest) { ::rtl::OUString sFilename = rRequest->getArgumentOrDefault(PROP_FILENAME, ::rtl::OUString()); TFileDialog iDialog = impl_getBaseDialogInterface(); + + TFileDialogCustomize iCustom = impl_getCustomizeInterface(); + if ( ! iCustom.is()) + return; + + // if we have the autoextension check box set, remove (or change ???) the extension of the filename + // so that the autoextension mechanism can do its job + BOOL bValue = FALSE; + HRESULT hResult = iCustom->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue); + if ( bValue ) + { + sal_Int32 nSepPos = sFilename.lastIndexOf( '.' ); + if ( -1 != nSepPos ) + sFilename = sFilename.copy(0, nSepPos); + } + iDialog->SetFileName ( reinterpret_cast<LPCTSTR>(sFilename.getStr())); m_sFilename = sFilename; } @@ -682,17 +697,11 @@ void VistaFilePickerImpl::impl_sta_setFiltersOnDialog() ::rtl::OUString sCurrentFilter = m_lFilters.getCurrentFilter(); sal_Int32 nCurrentFilter = m_lFilters.getFilterPos(sCurrentFilter); TFileDialog iDialog = impl_getBaseDialogInterface(); - TFileDialogCustomize iCustomize; + TFileDialogCustomize iCustomize = impl_getCustomizeInterface(); aLock.clear(); // <- SYNCHRONIZED -#ifdef __MINGW32__ - iDialog->QueryInterface(IID_IFileDialog, (void **)(&iCustomize)); -#else - iDialog.query(&iCustomize); -#endif - COMDLG_FILTERSPEC *pFilt = &lFilters[0]; iDialog->SetFileTypes(lFilters.size(), pFilt/*&lFilters[0]*/); iDialog->SetFileTypeIndex(nCurrentFilter + 1); diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx index ed63e2d66afa..c3acfb17f2da 100644 --- a/framework/inc/classes/fwktabwindow.hxx +++ b/framework/inc/classes/fwktabwindow.hxx @@ -57,7 +57,7 @@ class FwkTabControl : public TabControl public: FwkTabControl( Window* pParent, const ResId& rResId ); - void BroadcastEvent( ULONG nEvent );
+ void BroadcastEvent( ULONG nEvent ); }; class FwkTabPage : public TabPage @@ -65,7 +65,7 @@ class FwkTabPage : public TabPage private: rtl::OUString m_sPageURL; rtl::OUString m_sEventHdl; - css::uno::Reference< css::awt::XWindow > m_xPage;
+ css::uno::Reference< css::awt::XWindow > m_xPage; css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider; @@ -76,7 +76,7 @@ public: FwkTabPage( Window* pParent, const rtl::OUString& rPageURL, - const rtl::OUString& rEventHdl, + const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl, const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ); virtual ~FwkTabPage(); @@ -94,13 +94,13 @@ struct TabEntry sal_Int32 m_nIndex; FwkTabPage* m_pPage; ::rtl::OUString m_sPageURL; - ::rtl::OUString m_sEventHdl; + css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; TabEntry() : m_nIndex( -1 ), m_pPage( NULL ) {} - TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, ::rtl::OUString sEvent ) : - m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_sEventHdl( sEvent ) {} + TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) : + m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {} ~TabEntry() { delete m_pPage; } }; diff --git a/framework/prj/d.lst b/framework/prj/d.lst index 0f5217628a53..bf7a67d091e9 100644 --- a/framework/prj/d.lst +++ b/framework/prj/d.lst @@ -26,6 +26,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\statusbar ..\dtd\groupuinames.dtd %_DEST%\bin%_EXT%\groupuinames.dtd ..\%__SRC%\lib\ifwe.lib %_DEST%\lib%_EXT%\ifwe.lib +..\%__SRC%\lib\ifwi.lib %_DEST%\lib%_EXT%\ifwi.lib ..\inc\helper\imageproducer.hxx %_DEST%\inc%_EXT%\framework\imageproducer.hxx ..\inc\helper\acceleratorinfo.hxx %_DEST%\inc%_EXT%\framework\acceleratorinfo.hxx ..\inc\helper\actiontriggerhelper.hxx %_DEST%\inc%_EXT%\framework\actiontriggerhelper.hxx @@ -51,3 +52,4 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\statusbar ..\uiconfig\startmodule\statusbar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\StartModule\statusbar\*.xml ..\source\unotypes\fw?.xml %_DEST%\xml%_EXT%\*.xml + diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index efc41a6e35b8..330edb9c809a 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -1,1664 +1,1666 @@ -/*************************************************************************
- *
- * 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: acceleratorconfiguration.cxx,v $
- * $Revision: 1.7.204.12 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_framework.hxx"
-#include <accelerators/acceleratorconfiguration.hxx>
-
-//_______________________________________________
-// own includes
-#include <pattern/configuration.hxx>
-#include <accelerators/presethandler.hxx>
-
-#include <xml/saxnamespacefilter.hxx>
-#include <xml/acceleratorconfigurationreader.hxx>
-#include <xml/acceleratorconfigurationwriter.hxx>
-
-#include <threadhelp/readguard.hxx>
-#include <threadhelp/writeguard.hxx>
-
-#include <acceleratorconst.h>
-#include <services.h>
-
-//_______________________________________________
-// interface includes
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-//_______________________________________________
-// other includes
-#include <vcl/svapp.hxx>
-
-#ifndef __FRAMEWORK_ACCELERATORS_KEYMAPPING_HXX_
-#include <accelerators/keymapping.hxx>
-#endif
-
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
-#include <com/sun/star/container/XNamed.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
-#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_AWT_KEYEVENT_HPP_
-#include <com/sun/star/awt/KeyEvent.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
-#include <com/sun/star/awt/KeyModifier.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_UTIL_XCHANGESNOTIFIER_HPP_
-#include <com/sun/star/util/XChangesNotifier.hpp>
-#endif
-
-#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
-#include <comphelper/configurationhelper.hxx>
-#endif
-
-#ifndef UNOTOOLS_CONFIGPATHES_HXX_INCLUDED
-#include <unotools/configpathes.hxx>
-#endif
-
-#ifndef _RTL_LOGFILE_HXX_
-#include <rtl/logfile.hxx>
-#endif
-
-#include <svtools/acceleratorexecute.hxx>
-
-//_______________________________________________
-// const
-
-namespace framework
-{
-
-#ifdef fpc
- #error "Who exports this define? I use it as namespace alias ..."
-#else
- namespace fpc = ::framework::pattern::configuration;
-#endif
-
-//-----------------------------------------------
-// XInterface, XTypeProvider
-DEFINE_XINTERFACE_6(XMLBasedAcceleratorConfiguration ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ),
- DIRECT_INTERFACE(css::form::XReset ),
- DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence),
- DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ),
- DIRECT_INTERFACE(css::ui::XUIConfiguration ))
-
-DEFINE_XTYPEPROVIDER_6(XMLBasedAcceleratorConfiguration ,
- css::lang::XTypeProvider ,
- css::ui::XAcceleratorConfiguration ,
- css::form::XReset ,
- css::ui::XUIConfigurationPersistence,
- css::ui::XUIConfigurationStorage ,
- css::ui::XUIConfiguration )
-
-//-----------------------------------------------
-XMLBasedAcceleratorConfiguration::XMLBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
- : ThreadHelpBase (&Application::GetSolarMutex())
- , m_xSMGR (xSMGR )
- , m_aPresetHandler(xSMGR )
- , m_pWriteCache (0 )
-{
-}
-
-//-----------------------------------------------
-XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()
-{
- LOG_ASSERT(!m_pWriteCache, "XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()\nChanges not flushed. Ignore it ...")
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getAllKeyEvents()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG();
- AcceleratorCache::TKeyList lKeys = rCache.getAllKeys();
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::rtl::OUString SAL_CALL XMLBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
- throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG();
- if (!rCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
- return rCache.getCommandByKey(aKeyEvent);
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
- const ::rtl::OUString& sCommand )
- throw(css::lang::IllegalArgumentException,
- css::uno::RuntimeException )
-{
- if (
- (aKeyEvent.KeyCode == 0) &&
- (aKeyEvent.KeyChar == 0) &&
- (aKeyEvent.KeyFunc == 0) &&
- (aKeyEvent.Modifiers == 0)
- )
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache!
- rCache.setKeyCommandPair(aKeyEvent, sCommand);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
-throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG(sal_True); // true => force using of a writeable cache
- if (!rCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
- rCache.removeKey(aKeyEvent);
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG();
- if (!rCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(sCommand);
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
- throw(css::lang::IllegalArgumentException ,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- sal_Int32 i = 0;
- sal_Int32 c = lCommandList.getLength();
- css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list!
- AcceleratorCache& rCache = impl_getCFG();
-
- for (i=0; i<c; ++i)
- {
- const ::rtl::OUString& rCommand = lCommandList[i];
- if (!rCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- (sal_Int16)i);
-
- if (!rCache.hasCommand(rCommand))
- continue;
-
- AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
- if (lKeys.size()<1)
- continue;
-
- css::uno::Any& rAny = lPreferredOnes[i];
- rAny <<= *(lKeys.begin());
- }
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- return lPreferredOnes;
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache!
- if (!rCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString::createFromAscii("Command does not exists inside this container."),
- static_cast< ::cppu::OWeakObject* >(this));
- rCache.removeCommand(sCommand);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::reload()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- css::uno::Reference< css::io::XStream > xStreamNoLang;
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
- try
- {
- xStreamNoLang = m_aPresetHandler.openPreset(PresetHandler::PRESET_DEFAULT(), sal_True);
- }
- catch(const css::io::IOException&) {} // does not have to exist
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XInputStream > xIn;
- if (xStream.is())
- xIn = xStream->getInputStream();
- if (!xIn.is())
- throw css::io::IOException(
- ::rtl::OUString::createFromAscii("Could not open accelerator configuration for reading."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- // impl_ts_load() does not clear the cache
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
- m_aReadCache = AcceleratorCache();
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- impl_ts_load(xIn);
-
- // Load also the general language independent default accelerators
- // (ignoring the already defined accelerators)
- if (xStreamNoLang.is())
- {
- xIn = xStreamNoLang->getInputStream();
- if (xIn.is())
- impl_ts_load(xIn);
- }
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::store()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XOutputStream > xOut;
- if (xStream.is())
- xOut = xStream->getOutputStream();
-
- if (!xOut.is())
- throw css::io::IOException(
- ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- impl_ts_save(xOut);
-
- xOut.clear();
- xStream.clear();
-
- m_aPresetHandler.commitUserChanges();
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback(
- xStorage,
- PresetHandler::TARGET_CURRENT(),
- css::embed::ElementModes::READWRITE,
- sal_False); // False => no fallback from read/write to readonly!
- css::uno::Reference< css::io::XOutputStream > xOut;
- if (xStream.is())
- xOut = xStream->getOutputStream();
-
- if (!xOut.is())
- throw css::io::IOException(
- ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- impl_ts_save(xOut);
-
- // TODO inform listener about success, so it can flush the root and sub storage of this stream!
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isModified()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- return (m_pWriteCache != 0);
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isReadOnly()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XOutputStream > xOut;
- if (xStream.is())
- xOut = xStream->getOutputStream();
- return !(xOut.is());
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)")
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::hasStorage()
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)")
- return sal_False;
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::reset()
-throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
- m_aPresetHandler.copyPresetToTarget(PresetHandler::PRESET_DEFAULT(), PresetHandler::TARGET_CURRENT());
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- reload();
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::addResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-// IStorageListener
-void XMLBasedAcceleratorConfiguration::changesOccured(const ::rtl::OUString& /*sPath*/)
-{
- reload();
-}
-
-//-----------------------------------------------
-void XMLBasedAcceleratorConfiguration::impl_ts_load(const css::uno::Reference< css::io::XInputStream >& xStream)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
- if (m_pWriteCache)
- {
- // be aware of reentrance problems - use temp variable for calling delete ... :-)
- AcceleratorCache* pTemp = m_pWriteCache;
- m_pWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY);
- if (xSeek.is())
- xSeek->seek(0);
-
- // add accelerators to the cache (the cache is not cleared)
- // SAFE -> ----------------------------------
- aWriteLock.lock();
-
- // create the parser queue
- // Note: Use special filter object between parser and reader
- // to get filtered xml with right namespaces ...
- // Use further a temp cache for reading!
- AcceleratorConfigurationReader* pReader = new AcceleratorConfigurationReader(m_aReadCache);
- css::uno::Reference< css::xml::sax::XDocumentHandler > xReader (static_cast< ::cppu::OWeakObject* >(pReader), css::uno::UNO_QUERY_THROW);
- SaxNamespaceFilter* pFilter = new SaxNamespaceFilter(xReader);
- css::uno::Reference< css::xml::sax::XDocumentHandler > xFilter (static_cast< ::cppu::OWeakObject* >(pFilter), css::uno::UNO_QUERY_THROW);
-
- // connect parser, filter and stream
- css::uno::Reference< css::xml::sax::XParser > xParser(xSMGR->createInstance(SERVICENAME_SAXPARSER), css::uno::UNO_QUERY_THROW);
- xParser->setDocumentHandler(xFilter);
-
- css::xml::sax::InputSource aSource;
- aSource.aInputStream = xStream;
-
- // TODO think about error handling
- xParser->parseStream(aSource);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< css::io::XOutputStream >& xStream)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache aCache;
- sal_Bool bChanged = (m_pWriteCache != 0);
- if (bChanged)
- aCache.takeOver(*m_pWriteCache);
- else
- aCache.takeOver(m_aReadCache);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XTruncate > xClearable(xStream, css::uno::UNO_QUERY_THROW);
- xClearable->truncate();
-
- // TODO can be removed if seek(0) is done by truncate() automaticly!
- css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY);
- if (xSeek.is())
- xSeek->seek(0);
-
- // combine writer/cache/stream etcpp.
- css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW);
- xDataSource->setOutputStream(xStream);
-
- // write into the stream
- AcceleratorConfigurationWriter aWriter(aCache, xWriter);
- aWriter.flush();
-
- // take over all changes into the original container
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- // take over all changes into the readonly cache ...
- // and forget the copy-on-write copied cache
- if (bChanged)
- {
- m_aReadCache.takeOver(*m_pWriteCache);
- // live with reentrance .-)
- AcceleratorCache* pTemp = m_pWriteCache;
- m_pWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteAccessRequested)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- //create copy of our readonly-cache, if write access is forced ... but
- //not still possible!
- if (
- (bWriteAccessRequested) &&
- (!m_pWriteCache )
- )
- {
- m_pWriteCache = new AcceleratorCache(m_aReadCache);
- }
-
- // in case, we have a writeable cache, we use it for reading too!
- // Otherwhise the API user cant find its own changes ...
- if (m_pWriteCache)
- return *m_pWriteCache;
- else
- return m_aReadCache;
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::comphelper::Locale XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
-{
- static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup");
- static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" );
- static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" );
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY);
- css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
- ::rtl::OUString sISOLocale;
- xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale;
-
- if (!sISOLocale.getLength())
- return ::comphelper::Locale::EN_US();
- return ::comphelper::Locale(sISOLocale);
-}
-
-/*******************************************************************************
-*
-* XCU based accelerator configuration
-*
-*******************************************************************************/
-
-//-----------------------------------------------
-// XInterface, XTypeProvider
-DEFINE_XINTERFACE_7(XCUBasedAcceleratorConfiguration ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ),
- DIRECT_INTERFACE(css::util::XChangesListener ),
- DIRECT_INTERFACE(css::form::XReset ),
- DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence),
- DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ),
- DIRECT_INTERFACE(css::ui::XUIConfiguration ))
-
- DEFINE_XTYPEPROVIDER_7(XCUBasedAcceleratorConfiguration ,
- css::lang::XTypeProvider ,
- css::ui::XAcceleratorConfiguration ,
- css::util::XChangesListener ,
- css::form::XReset ,
- css::ui::XUIConfigurationPersistence,
- css::ui::XUIConfigurationStorage ,
- css::ui::XUIConfiguration )
-
-//-----------------------------------------------
-XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
- : ThreadHelpBase (&Application::GetSolarMutex())
- , m_xSMGR (xSMGR )
- , m_pPrimaryWriteCache(0 )
- , m_pSecondaryWriteCache(0 )
-{
- m_xCfg = css::uno::Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
- css::uno::UNO_QUERY );
-}
-
-//-----------------------------------------------
-XCUBasedAcceleratorConfiguration::~XCUBasedAcceleratorConfiguration()
-{
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getAllKeyEvents()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache::TKeyList lKeys = impl_getCFG(sal_True).getAllKeys(); //get keys from PrimaryKeys set
-
- AcceleratorCache::TKeyList lSecondaryKeys = impl_getCFG(sal_False).getAllKeys(); //get keys from SecondaryKeys set
- AcceleratorCache::TKeyList::const_iterator pIt;
- for ( pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt )
- lKeys.push_back(*pIt);
-
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::rtl::OUString SAL_CALL XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
- throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
-
- if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- if (rPrimaryCache.hasKey(aKeyEvent))
- return rPrimaryCache.getCommandByKey(aKeyEvent);
- else
- return rSecondaryCache.getCommandByKey(aKeyEvent);
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
- const ::rtl::OUString& sCommand )
- throw(css::lang::IllegalArgumentException,
- css::uno::RuntimeException )
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::setKeyEvent" );
-
- if (
- (aKeyEvent.KeyCode == 0) &&
- (aKeyEvent.KeyChar == 0) &&
- (aKeyEvent.KeyFunc == 0) &&
- (aKeyEvent.Modifiers == 0)
- )
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); // TRUE => force getting of a writeable cache!
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); // TRUE => force getting of a writeable cache!
-
- if ( rPrimaryCache.hasKey(aKeyEvent) )
- {
- ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
- if ( sCommand != sOriginalCommand )
- {
- if (rSecondaryCache.hasCommand(sOriginalCommand))
- {
- AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand);
- rSecondaryCache.removeKey(lSecondaryKeys[0]);
- rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand);
- }
-
- if (rPrimaryCache.hasCommand(sCommand))
- {
- AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
- rPrimaryCache.removeKey(lPrimaryKeys[0]);
- rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
- }
-
- rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- }
-
- else if ( rSecondaryCache.hasKey(aKeyEvent) )
- {
- ::rtl::OUString sOriginalCommand = rSecondaryCache.getCommandByKey(aKeyEvent);
- if (sCommand != sOriginalCommand)
- {
- if (rPrimaryCache.hasCommand(sCommand))
- {
- AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
- rPrimaryCache.removeKey(lPrimaryKeys[0]);
- rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
- }
-
- rSecondaryCache.removeKey(aKeyEvent);
- rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- }
-
- else
- {
- if (rPrimaryCache.hasCommand(sCommand))
- {
- AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
- rPrimaryCache.removeKey(lPrimaryKeys[0]);
- rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
- }
-
- rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::setKeyEvent" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
- throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
-
- if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- if (rPrimaryCache.hasKey(aKeyEvent))
- {
- ::rtl::OUString sDelCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
- if (sDelCommand.getLength() > 0)
- {
- ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
- if (rSecondaryCache.hasCommand(sOriginalCommand))
- {
- AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand);
- rSecondaryCache.removeKey(lSecondaryKeys[0]);
- rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand);
- }
-
- rPrimaryCache.removeKey(aKeyEvent);
- }
-
- }
- else
- {
- ::rtl::OUString sDelCommand = rSecondaryCache.getCommandByKey(aKeyEvent);
- if (sDelCommand.getLength() > 0)
- rSecondaryCache.removeKey(aKeyEvent);
- }
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
-
- if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- AcceleratorCache::TKeyList lKeys = rPrimaryCache.getKeysByCommand(sCommand);
-
- AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sCommand);
- AcceleratorCache::TKeyList::const_iterator pIt;
- for (pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt)
- lKeys.push_back(*pIt);
-
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList& lKeys)
-{
- AcceleratorCache::TKeyList::const_iterator pIt;
- for ( pIt = lKeys.begin ();
- pIt != lKeys.end ();
- ++pIt )
- {
- const css::awt::KeyEvent& rAWTKey = *pIt;
- const KeyCode aVCLKey = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(rAWTKey);
- const String sName = aVCLKey.GetName();
-
- if (sName.Len () > 0)
- return pIt;
- }
-
- return lKeys.end ();
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
- throw(css::lang::IllegalArgumentException ,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- sal_Int32 i = 0;
- sal_Int32 c = lCommandList.getLength();
- css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list!
- AcceleratorCache& rCache = impl_getCFG(sal_True);
-
- for (i=0; i<c; ++i)
- {
- const ::rtl::OUString& rCommand = lCommandList[i];
- if (!rCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- (sal_Int16)i);
-
- if (!rCache.hasCommand(rCommand))
- continue;
-
- AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
- if (lKeys.size()<1)
- continue;
-
- AcceleratorCache::TKeyList::const_iterator pPreferredKey = lcl_getPreferredKey(lKeys);
- if (pPreferredKey != lKeys.end ())
- {
- css::uno::Any& rAny = lPreferredOnes[i];
- rAny <<= *(pPreferredKey);
- }
- }
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- return lPreferredOnes;
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
-
- if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString::createFromAscii("Command does not exists inside this container."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- if (rPrimaryCache.hasCommand(sCommand))
- rPrimaryCache.removeCommand(sCommand);
- if (rSecondaryCache.hasCommand(sCommand))
- rSecondaryCache.removeCommand(sCommand);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::reload()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::reload()" );
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- sal_Bool bPreferred;
- css::uno::Reference< css::container::XNameAccess > xAccess;
-
- bPreferred = sal_True;
- m_aPrimaryReadCache = AcceleratorCache();
- if (m_pPrimaryWriteCache)
- {
- // be aware of reentrance problems - use temp variable for calling delete ... :-)
- AcceleratorCache* pTemp = m_pPrimaryWriteCache;
- m_pPrimaryWriteCache = 0;
- delete pTemp;
- }
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- impl_ts_load(bPreferred, xAccess); // load the preferred keys
-
- bPreferred = sal_False;
- m_aSecondaryReadCache = AcceleratorCache();
- if (m_pSecondaryWriteCache)
- {
- // be aware of reentrance problems - use temp variable for calling delete ... :-)
- AcceleratorCache* pTemp = m_pSecondaryWriteCache;
- m_pSecondaryWriteCache = 0;
- delete pTemp;
- }
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
- impl_ts_load(bPreferred, xAccess); // load the secondary keys
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::reload()" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::store()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::store()" );
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- sal_Bool bPreferred;
- css::uno::Reference< css::container::XNameAccess > xAccess;
-
- bPreferred = sal_True;
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- impl_ts_save(bPreferred, xAccess);
-
- bPreferred = sal_False;
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
- impl_ts_save(bPreferred, xAccess);
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::store()" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- // todo implement me
- // use m_aCache + old AcceleratorXMLWriter to store data directly on storage given as parameter ...
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isModified()
- throw(css::uno::RuntimeException)
-{
- return sal_False;
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isReadOnly()
- throw(css::uno::RuntimeException)
-{
- return sal_False;
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)")
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::hasStorage()
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)")
- return sal_False;
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::reset()
- throw(css::uno::RuntimeException)
-{
- css::uno::Reference< css::container::XNamed > xNamed(m_xCfg, css::uno::UNO_QUERY);
- ::rtl::OUString sConfig = xNamed->getName();
- if ( sConfig.equalsAscii("Global") )
- {
- m_xCfg = css::uno::Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_GLOBAL, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
- css::uno::UNO_QUERY );
- XCUBasedAcceleratorConfiguration::reload();
- }
- else if ( sConfig.equalsAscii("Modules") )
- {
- m_xCfg = css::uno::Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_MODULES, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
- css::uno::UNO_QUERY );
- XCUBasedAcceleratorConfiguration::reload();
- }
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::addResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util::ChangesEvent& aEvent)
- throw(css::uno::RuntimeException)
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::changesOccurred()" );
-
- css::uno::Reference< css::container::XHierarchicalNameAccess > xHAccess;
- aEvent.Base >>= xHAccess;
- if (! xHAccess.is ())
- return;
-
- const sal_Int32 c = aEvent.Changes.getLength();
- sal_Int32 i = 0;
-
- for (i=0; i<c; ++i)
- {
- const css::util::ElementChange& aChange = aEvent.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 :-)
- // So we try to split the path into 3 parts (module isnt important here, because we already know it ... because
- // these instance is bound to a specific module configuration ... or it''s the global configuration where no module is given at all.
-
- ::rtl::OUString sOrgPath ;
- ::rtl::OUString sPath ;
- ::rtl::OUString sKey;
-
- aChange.Accessor >>= sOrgPath;
- sPath = sOrgPath;
- ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sPrimarySecondary);
-
- ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sGlobalModules);
-
- if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
- {
- ::rtl::OUString sModule;
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
- }
- else if ( sGlobalModules.equals(CFG_ENTRY_MODULES) )
- {
- ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath);
- ::rtl::OUString sDropModule = ::rtl::OUString::createFromAscii("Module['") + sModule + ::rtl::OUString::createFromAscii("']");
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sDropModule);
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
- }
- }
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::changesOccurred()" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::disposing(const css::lang::EventObject& /*aSource*/)
- throw(css::uno::RuntimeException)
-{
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg )
-{
- AcceleratorCache aReadCache = AcceleratorCache();
- css::uno::Reference< css::container::XNameAccess > xAccess;
- if (m_sGlobalOrModules.equalsAscii("Global"))
- xCfg->getByName(CFG_ENTRY_GLOBAL) >>= xAccess;
- else if (m_sGlobalOrModules.equalsAscii("Modules"))
- {
- css::uno::Reference< css::container::XNameAccess > xModules;
- xCfg->getByName(CFG_ENTRY_MODULES) >>= xModules;
- xModules->getByName(m_sModuleCFG) >>= xAccess;
- }
-
- css::uno::Reference< css::container::XNameAccess > xKey;
- css::uno::Reference< css::container::XNameAccess > xCommand;
- if (xAccess.is())
- {
- css::uno::Sequence< ::rtl::OUString > lKeys = xAccess->getElementNames();
- sal_Int32 nKeys = lKeys.getLength();
- for ( sal_Int32 i=0; i<nKeys; ++i )
- {
- ::rtl::OUString sKey = lKeys[i];
- xAccess->getByName(sKey) >>= xKey;
- xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
-
- css::uno::Sequence< ::rtl::OUString > lLocales = xCommand->getElementNames();
- sal_Int32 nLocales = lLocales.getLength();
- ::std::vector< ::rtl::OUString > aLocales;
- for ( sal_Int32 j=0; j<nLocales; ++j )
- aLocales.push_back(lLocales[j]);
-
- ::std::vector< ::rtl::OUString >::const_iterator pFound;
- for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
- {
- if ( *pFound == impl_ts_getLocale().toISO() )
- break;
- }
-
- if ( pFound == aLocales.end() )
- {
- ::rtl::OUString sDefaultLocale = ::rtl::OUString::createFromAscii("en-US");
- for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
- {
- if ( *pFound == sDefaultLocale )
- break;
- }
-
- if ( pFound == aLocales.end() )
- continue;
- }
-
- ::rtl::OUString sLocale = *pFound;
- ::rtl::OUString sCommand;
- xCommand->getByName(sLocale) >>= sCommand;
- if (sCommand.getLength()<1)
- continue;
-
- KeyMapping aKeyMapping;
- css::awt::KeyEvent aKeyEvent;
-
- sal_Int32 nIndex = 0;
- ::rtl::OUString sKeyCommand = sKey.getToken(0, '_', nIndex);
- ::rtl::OUString sPrefix = ::rtl::OUString::createFromAscii("KEY_");
- aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(sPrefix + sKeyCommand);
-
- css::uno::Sequence< ::rtl::OUString > sToken(4);
- const sal_Int32 nToken = 4;
- sal_Bool bValid = sal_True;
- sal_Int32 k;
- for (k=0; k<nToken; ++k)
- {
- if (nIndex < 0)
- break;
-
- sToken[k] = sKey.getToken(0, '_', nIndex);
- ::rtl::OUString sTest = sToken[k];
- if (sToken[k].getLength() < 1)
- {
- bValid = sal_False;
- break;
- }
-
- if (sToken[k].equalsAscii("SHIFT"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
- else if (sToken[k].equalsAscii("MOD1"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
- else if (sToken[k].equalsAscii("MOD2"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
- else
- {
- bValid = sal_False;
- break;
- }
- }
-
- if ( !aReadCache.hasKey(aKeyEvent) && bValid && k<nToken)
- aReadCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- }
-
- if (bPreferred)
- m_aPrimaryReadCache.takeOver(aReadCache);
- else
- m_aSecondaryReadCache.takeOver(aReadCache);
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& /*xCfg*/)
-{
- if (bPreferred)
- {
- AcceleratorCache::TKeyList::const_iterator pIt;
- AcceleratorCache::TKeyList lPrimaryReadKeys = m_aPrimaryReadCache.getAllKeys();
- AcceleratorCache::TKeyList lPrimaryWriteKeys = m_pPrimaryWriteCache->getAllKeys();
-
- for ( pIt = lPrimaryReadKeys.begin(); pIt != lPrimaryReadKeys.end(); ++pIt )
- {
- if (!m_pPrimaryWriteCache->hasKey(*pIt))
- removeKeyFromConfiguration(*pIt, sal_True);
- }
-
- for ( pIt = lPrimaryWriteKeys.begin(); pIt != lPrimaryWriteKeys.end(); ++pIt )
- {
- ::rtl::OUString sCommand = m_pPrimaryWriteCache->getCommandByKey(*pIt);
- if (!m_aPrimaryReadCache.hasKey(*pIt))
- {
- insertKeyToConfiguration(*pIt, sCommand, sal_True);
- }
- else
- {
- ::rtl::OUString sReadCommand = m_aPrimaryReadCache.getCommandByKey(*pIt);
- if (sReadCommand != sCommand)
- insertKeyToConfiguration(*pIt, sCommand, sal_True);
- }
- }
-
- // take over all changes into the original container
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- if (m_pPrimaryWriteCache)
- {
- m_aPrimaryReadCache.takeOver(*m_pPrimaryWriteCache);
- AcceleratorCache* pTemp = m_pPrimaryWriteCache;
- m_pPrimaryWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
- }
-
- else
- {
- AcceleratorCache::TKeyList::const_iterator pIt;
- AcceleratorCache::TKeyList lSecondaryReadKeys = m_aSecondaryReadCache.getAllKeys();
- AcceleratorCache::TKeyList lSecondaryWriteKeys = m_pSecondaryWriteCache->getAllKeys();
-
- for ( pIt = lSecondaryReadKeys.begin(); pIt != lSecondaryReadKeys.end(); ++pIt)
- {
- if (!m_pSecondaryWriteCache->hasKey(*pIt))
- removeKeyFromConfiguration(*pIt, sal_False);
- }
-
-
- for ( pIt = lSecondaryWriteKeys.begin(); pIt != lSecondaryWriteKeys.end(); ++pIt )
- {
- ::rtl::OUString sCommand = m_pSecondaryWriteCache->getCommandByKey(*pIt);
- if (!m_aSecondaryReadCache.hasKey(*pIt))
- {
- insertKeyToConfiguration(*pIt, sCommand, sal_False);
- }
- else
- {
- ::rtl::OUString sReadCommand = m_aSecondaryReadCache.getCommandByKey(*pIt);
- if (sReadCommand != sCommand)
- insertKeyToConfiguration(*pIt, sCommand, sal_False);
- }
- }
-
- // take over all changes into the original container
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- if (m_pSecondaryWriteCache)
- {
- m_aSecondaryReadCache.takeOver(*m_pSecondaryWriteCache);
- AcceleratorCache* pTemp = m_pSecondaryWriteCache;
- m_pSecondaryWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
- }
-
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt::KeyEvent& aKeyEvent, const ::rtl::OUString& sCommand, const sal_Bool bPreferred )
-{
- css::uno::Reference< css::container::XNameAccess > xAccess;
- css::uno::Reference< css::container::XNameContainer > xContainer;
- css::uno::Reference< css::lang::XSingleServiceFactory > xFac;
- css::uno::Reference< css::uno::XInterface > xInst;
-
- if ( bPreferred )
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- else
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
-
- if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) )
- xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
- else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) )
- {
- css::uno::Reference< css::container::XNameContainer > xModules;
- xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
- if ( !xModules->hasByName(m_sModuleCFG) )
- {
- xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xModules, css::uno::UNO_QUERY);
- xInst = xFac->createInstance();
- xModules->insertByName(m_sModuleCFG, css::uno::makeAny(xInst));
- }
- xModules->getByName(m_sModuleCFG) >>= xContainer;
- }
-
- KeyMapping aKeyMapping;
- const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
- ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
-
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
- sKey += ::rtl::OUString::createFromAscii("_SHIFT");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
- sKey += ::rtl::OUString::createFromAscii("_MOD1");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
- sKey += ::rtl::OUString::createFromAscii("_MOD2");
-
- css::uno::Reference< css::container::XNameAccess > xKey;
- css::uno::Reference< css::container::XNameContainer > xCommand;
- if ( !xContainer->hasByName(sKey) )
- {
- xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xContainer, css::uno::UNO_QUERY);
- xInst = xFac->createInstance();
- xContainer->insertByName(sKey, css::uno::makeAny(xInst));
- }
- xContainer->getByName(sKey) >>= xKey;
-
- xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
- ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
- if ( !xCommand->hasByName(sLocale) )
- xCommand->insertByName(sLocale, css::uno::makeAny(sCommand));
- else
- xCommand->replaceByName(sLocale, css::uno::makeAny(sCommand));
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration( const css::awt::KeyEvent& aKeyEvent, const sal_Bool bPreferred )
-{
- css::uno::Reference< css::container::XNameAccess > xAccess;
- css::uno::Reference< css::container::XNameContainer > xContainer;
-
- if ( bPreferred )
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- else
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
-
- if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) )
- xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
- else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) )
- {
- css::uno::Reference< css::container::XNameAccess > xModules;
- xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
- if ( !xModules->hasByName(m_sModuleCFG) )
- return;
- xModules->getByName(m_sModuleCFG) >>= xContainer;
- }
-
- KeyMapping aKeyMapping;
- const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
- ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
-
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
- sKey += ::rtl::OUString::createFromAscii("_SHIFT");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
- sKey += ::rtl::OUString::createFromAscii("_MOD1");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
- sKey += ::rtl::OUString::createFromAscii("_MOD2");
-
- xContainer->removeByName(sKey);
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPrimarySecondary, const ::rtl::OUString& sGlobalModules, const ::rtl::OUString& sModule, const ::rtl::OUString& sKey )
-{
- css::uno::Reference< css::container::XNameAccess > xAccess;
- css::uno::Reference< css::container::XNameContainer > xContainer;
-
- m_xCfg->getByName(sPrimarySecondary) >>= xAccess;
- if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
- xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
- else
- {
- css::uno::Reference< css::container::XNameAccess > xModules;
- xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
- if ( !xModules->hasByName(sModule) )
- return;
- xModules->getByName(sModule) >>= xContainer;
- }
-
- KeyMapping aKeyMapping;
- css::awt::KeyEvent aKeyEvent;
- ::rtl::OUString sKeyIdentifier;
-
- sal_Int32 nIndex = 0;
- sKeyIdentifier = sKey.getToken(0, '_', nIndex);
- aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(::rtl::OUString::createFromAscii("KEY_")+sKeyIdentifier);
-
- css::uno::Sequence< ::rtl::OUString > sToken(3);
- const sal_Int32 nToken = 3;
- for (sal_Int32 i=0; i<nToken; ++i)
- {
- if ( nIndex < 0 )
- break;
-
- sToken[i] = sKey.getToken(0, '_', nIndex);
- if (sToken[i].equalsAscii("SHIFT"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
- else if (sToken[i].equalsAscii("MOD1"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
- else if (sToken[i].equalsAscii("MOD2"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
- }
-
- css::uno::Reference< css::container::XNameAccess > xKey;
- css::uno::Reference< css::container::XNameAccess > xCommand;
- ::rtl::OUString sCommand;
-
- if (xContainer->hasByName(sKey))
- {
- ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
- xContainer->getByName(sKey) >>= xKey;
- xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
- xCommand->getByName(sLocale) >>= sCommand;
- }
-
- if (sPrimarySecondary.equals(CFG_ENTRY_PRIMARY))
- {
- if (sCommand.getLength() ==0)
- m_aPrimaryReadCache.removeKey(aKeyEvent);
- else
- m_aPrimaryReadCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- else if (sPrimarySecondary.equals(CFG_ENTRY_SECONDARY))
- {
- if (sCommand.getLength() ==0)
- m_aSecondaryReadCache.removeKey(aKeyEvent);
- else
- m_aSecondaryReadCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
-}
-
-//-----------------------------------------------
-AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPreferred, sal_Bool bWriteAccessRequested)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- if (bPreferred)
- {
- //create copy of our readonly-cache, if write access is forced ... but
- //not still possible!
- if (
- (bWriteAccessRequested) &&
- (!m_pPrimaryWriteCache )
- )
- {
- m_pPrimaryWriteCache = new AcceleratorCache(m_aPrimaryReadCache);
- }
-
- // in case, we have a writeable cache, we use it for reading too!
- // Otherwhise the API user cant find its own changes ...
- if (m_pPrimaryWriteCache)
- return *m_pPrimaryWriteCache;
- else
- return m_aPrimaryReadCache;
- }
-
- else
- {
- //create copy of our readonly-cache, if write access is forced ... but
- //not still possible!
- if (
- (bWriteAccessRequested) &&
- (!m_pSecondaryWriteCache )
- )
- {
- m_pSecondaryWriteCache = new AcceleratorCache(m_aSecondaryReadCache);
- }
-
- // in case, we have a writeable cache, we use it for reading too!
- // Otherwhise the API user cant find its own changes ...
- if (m_pSecondaryWriteCache)
- return *m_pSecondaryWriteCache;
- else
- return m_aSecondaryReadCache;
- }
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::comphelper::Locale XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
-{
- static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup");
- static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" );
- static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" );
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY);
- css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
- ::rtl::OUString sISOLocale;
- xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale;
-
- if (!sISOLocale.getLength())
- return ::comphelper::Locale::EN_US();
- return ::comphelper::Locale(sISOLocale);
-}
-
-} // namespace framework
+/************************************************************************* + * + * 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: acceleratorconfiguration.cxx,v $ + * $Revision: 1.7.204.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" +#include <accelerators/acceleratorconfiguration.hxx> + +//_______________________________________________ +// own includes +#include <pattern/configuration.hxx> +#include <accelerators/presethandler.hxx> + +#include <xml/saxnamespacefilter.hxx> +#include <xml/acceleratorconfigurationreader.hxx> +#include <xml/acceleratorconfigurationwriter.hxx> + +#include <threadhelp/readguard.hxx> +#include <threadhelp/writeguard.hxx> + +#include <acceleratorconst.h> +#include <services.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/xml/sax/InputSource.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/io/XTruncate.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +//_______________________________________________ +// other includes +#include <vcl/svapp.hxx> + +#ifndef __FRAMEWORK_ACCELERATORS_KEYMAPPING_HXX_ +#include <accelerators/keymapping.hxx> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif + +#ifndef __COM_SUN_STAR_AWT_KEYEVENT_HPP_ +#include <com/sun/star/awt/KeyEvent.hpp> +#endif + +#ifndef __COM_SUN_STAR_AWT_KEYMODIFIER_HPP_ +#include <com/sun/star/awt/KeyModifier.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_UTIL_XCHANGESNOTIFIER_HPP_ +#include <com/sun/star/util/XChangesNotifier.hpp> +#endif + +#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ +#include <comphelper/configurationhelper.hxx> +#endif + +#ifndef UNOTOOLS_CONFIGPATHES_HXX_INCLUDED +#include <unotools/configpathes.hxx> +#endif + +#ifndef _RTL_LOGFILE_HXX_ +#include <rtl/logfile.hxx> +#endif + +#include <svtools/acceleratorexecute.hxx> + +//_______________________________________________ +// const + +namespace framework +{ + +#ifdef fpc + #error "Who exports this define? I use it as namespace alias ..." +#else + namespace fpc = ::framework::pattern::configuration; +#endif + +//----------------------------------------------- +// XInterface, XTypeProvider +DEFINE_XINTERFACE_6(XMLBasedAcceleratorConfiguration , + OWeakObject , + DIRECT_INTERFACE(css::lang::XTypeProvider ), + DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ), + DIRECT_INTERFACE(css::form::XReset ), + DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence), + DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ), + DIRECT_INTERFACE(css::ui::XUIConfiguration )) + +DEFINE_XTYPEPROVIDER_6(XMLBasedAcceleratorConfiguration , + css::lang::XTypeProvider , + css::ui::XAcceleratorConfiguration , + css::form::XReset , + css::ui::XUIConfigurationPersistence, + css::ui::XUIConfigurationStorage , + css::ui::XUIConfiguration ) + +//----------------------------------------------- +XMLBasedAcceleratorConfiguration::XMLBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR) + : ThreadHelpBase (&Application::GetSolarMutex()) + , m_xSMGR (xSMGR ) + , m_aPresetHandler(xSMGR ) + , m_pWriteCache (0 ) +{ +} + +//----------------------------------------------- +XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration() +{ + LOG_ASSERT(!m_pWriteCache, "XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()\nChanges not flushed. Ignore it ...") +} + +//----------------------------------------------- +css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getAllKeyEvents() + throw(css::uno::RuntimeException) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + AcceleratorCache& rCache = impl_getCFG(); + AcceleratorCache::TKeyList lKeys = rCache.getAllKeys(); + return lKeys.getAsConstList(); + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +::rtl::OUString SAL_CALL XMLBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent) + throw(css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + AcceleratorCache& rCache = impl_getCFG(); + if (!rCache.hasKey(aKeyEvent)) + throw css::container::NoSuchElementException( + ::rtl::OUString(), + static_cast< ::cppu::OWeakObject* >(this)); + return rCache.getCommandByKey(aKeyEvent); + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent, + const ::rtl::OUString& sCommand ) + throw(css::lang::IllegalArgumentException, + css::uno::RuntimeException ) +{ + if ( + (aKeyEvent.KeyCode == 0) && + (aKeyEvent.KeyChar == 0) && + (aKeyEvent.KeyFunc == 0) && + (aKeyEvent.Modifiers == 0) + ) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."), + static_cast< ::cppu::OWeakObject* >(this), + 0); + + if (!sCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + 1); + + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache! + rCache.setKeyCommandPair(aKeyEvent, sCommand); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent) +throw(css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + AcceleratorCache& rCache = impl_getCFG(sal_True); // true => force using of a writeable cache + if (!rCache.hasKey(aKeyEvent)) + throw css::container::NoSuchElementException( + ::rtl::OUString(), + static_cast< ::cppu::OWeakObject* >(this)); + rCache.removeKey(aKeyEvent); + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand) + throw(css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + if (!sCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + 1); + + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + AcceleratorCache& rCache = impl_getCFG(); + if (!rCache.hasCommand(sCommand)) + throw css::container::NoSuchElementException( + ::rtl::OUString(), + static_cast< ::cppu::OWeakObject* >(this)); + + AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(sCommand); + return lKeys.getAsConstList(); + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList) + throw(css::lang::IllegalArgumentException , + css::uno::RuntimeException ) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + sal_Int32 i = 0; + sal_Int32 c = lCommandList.getLength(); + css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list! + AcceleratorCache& rCache = impl_getCFG(); + + for (i=0; i<c; ++i) + { + const ::rtl::OUString& rCommand = lCommandList[i]; + if (!rCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + (sal_Int16)i); + + if (!rCache.hasCommand(rCommand)) + continue; + + AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand); + if (lKeys.size()<1) + continue; + + css::uno::Any& rAny = lPreferredOnes[i]; + rAny <<= *(lKeys.begin()); + } + + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + return lPreferredOnes; +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand) + throw(css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + if (!sCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + 0); + + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache! + if (!rCache.hasCommand(sCommand)) + throw css::container::NoSuchElementException( + ::rtl::OUString::createFromAscii("Command does not exists inside this container."), + static_cast< ::cppu::OWeakObject* >(this)); + rCache.removeCommand(sCommand); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::reload() + throw(css::uno::Exception , + css::uno::RuntimeException) +{ + css::uno::Reference< css::io::XStream > xStreamNoLang; + + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create! + try + { + xStreamNoLang = m_aPresetHandler.openPreset(PresetHandler::PRESET_DEFAULT(), sal_True); + } + catch(const css::io::IOException&) {} // does not have to exist + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + css::uno::Reference< css::io::XInputStream > xIn; + if (xStream.is()) + xIn = xStream->getInputStream(); + if (!xIn.is()) + throw css::io::IOException( + ::rtl::OUString::createFromAscii("Could not open accelerator configuration for reading."), + static_cast< ::cppu::OWeakObject* >(this)); + + // impl_ts_load() does not clear the cache + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + m_aReadCache = AcceleratorCache(); + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + + impl_ts_load(xIn); + + // Load also the general language independent default accelerators + // (ignoring the already defined accelerators) + if (xStreamNoLang.is()) + { + xIn = xStreamNoLang->getInputStream(); + if (xIn.is()) + impl_ts_load(xIn); + } +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::store() + throw(css::uno::Exception , + css::uno::RuntimeException) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create! + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + css::uno::Reference< css::io::XOutputStream > xOut; + if (xStream.is()) + xOut = xStream->getOutputStream(); + + if (!xOut.is()) + throw css::io::IOException( + ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."), + static_cast< ::cppu::OWeakObject* >(this)); + + impl_ts_save(xOut); + + xOut.clear(); + xStream.clear(); + + m_aPresetHandler.commitUserChanges(); +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage) + throw(css::uno::Exception , + css::uno::RuntimeException) +{ + css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback( + xStorage, + PresetHandler::TARGET_CURRENT(), + css::embed::ElementModes::READWRITE, + sal_False); // False => no fallback from read/write to readonly! + css::uno::Reference< css::io::XOutputStream > xOut; + if (xStream.is()) + xOut = xStream->getOutputStream(); + + if (!xOut.is()) + throw css::io::IOException( + ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."), + static_cast< ::cppu::OWeakObject* >(this)); + + impl_ts_save(xOut); + + // TODO inform listener about success, so it can flush the root and sub storage of this stream! +} + +//----------------------------------------------- +::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isModified() + throw(css::uno::RuntimeException) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + return (m_pWriteCache != 0); + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isReadOnly() + throw(css::uno::RuntimeException) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create! + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + css::uno::Reference< css::io::XOutputStream > xOut; + if (xStream.is()) + xOut = xStream->getOutputStream(); + return !(xOut.is()); +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XMLBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)") +} + +//----------------------------------------------- +::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::hasStorage() + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XMLBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)") + return sal_False; +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XMLBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me") +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XMLBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me") +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::reset() +throw(css::uno::RuntimeException) +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + m_aPresetHandler.copyPresetToTarget(PresetHandler::PRESET_DEFAULT(), PresetHandler::TARGET_CURRENT()); + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + + reload(); +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XMLBasedAcceleratorConfiguration::addResetListener()", "TODO implement me") +} + +//----------------------------------------------- +void SAL_CALL XMLBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XMLBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me") +} + +//----------------------------------------------- +// IStorageListener +void XMLBasedAcceleratorConfiguration::changesOccured(const ::rtl::OUString& /*sPath*/) +{ + reload(); +} + +//----------------------------------------------- +void XMLBasedAcceleratorConfiguration::impl_ts_load(const css::uno::Reference< css::io::XInputStream >& xStream) +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + if (m_pWriteCache) + { + // be aware of reentrance problems - use temp variable for calling delete ... :-) + AcceleratorCache* pTemp = m_pWriteCache; + m_pWriteCache = 0; + delete pTemp; + } + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + + css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY); + if (xSeek.is()) + xSeek->seek(0); + + // add accelerators to the cache (the cache is not cleared) + // SAFE -> ---------------------------------- + aWriteLock.lock(); + + // create the parser queue + // Note: Use special filter object between parser and reader + // to get filtered xml with right namespaces ... + // Use further a temp cache for reading! + AcceleratorConfigurationReader* pReader = new AcceleratorConfigurationReader(m_aReadCache); + css::uno::Reference< css::xml::sax::XDocumentHandler > xReader (static_cast< ::cppu::OWeakObject* >(pReader), css::uno::UNO_QUERY_THROW); + SaxNamespaceFilter* pFilter = new SaxNamespaceFilter(xReader); + css::uno::Reference< css::xml::sax::XDocumentHandler > xFilter (static_cast< ::cppu::OWeakObject* >(pFilter), css::uno::UNO_QUERY_THROW); + + // connect parser, filter and stream + css::uno::Reference< css::xml::sax::XParser > xParser(xSMGR->createInstance(SERVICENAME_SAXPARSER), css::uno::UNO_QUERY_THROW); + xParser->setDocumentHandler(xFilter); + + css::xml::sax::InputSource aSource; + aSource.aInputStream = xStream; + + // TODO think about error handling + xParser->parseStream(aSource); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< css::io::XOutputStream >& xStream) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + AcceleratorCache aCache; + sal_Bool bChanged = (m_pWriteCache != 0); + if (bChanged) + aCache.takeOver(*m_pWriteCache); + else + aCache.takeOver(m_aReadCache); + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + css::uno::Reference< css::io::XTruncate > xClearable(xStream, css::uno::UNO_QUERY_THROW); + xClearable->truncate(); + + // TODO can be removed if seek(0) is done by truncate() automaticly! + css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY); + if (xSeek.is()) + xSeek->seek(0); + + // combine writer/cache/stream etcpp. + css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW); + xDataSource->setOutputStream(xStream); + + // write into the stream + AcceleratorConfigurationWriter aWriter(aCache, xWriter); + aWriter.flush(); + + // take over all changes into the original container + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + // take over all changes into the readonly cache ... + // and forget the copy-on-write copied cache + if (bChanged) + { + m_aReadCache.takeOver(*m_pWriteCache); + // live with reentrance .-) + AcceleratorCache* pTemp = m_pWriteCache; + m_pWriteCache = 0; + delete pTemp; + } + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteAccessRequested) +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + //create copy of our readonly-cache, if write access is forced ... but + //not still possible! + if ( + (bWriteAccessRequested) && + (!m_pWriteCache ) + ) + { + m_pWriteCache = new AcceleratorCache(m_aReadCache); + } + + // in case, we have a writeable cache, we use it for reading too! + // Otherwhise the API user cant find its own changes ... + if (m_pWriteCache) + return *m_pWriteCache; + else + return m_aReadCache; + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +::comphelper::Locale XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const +{ + static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup"); + static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" ); + static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" ); + + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY); + css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW); + ::rtl::OUString sISOLocale; + xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale; + + if (!sISOLocale.getLength()) + return ::comphelper::Locale::EN_US(); + return ::comphelper::Locale(sISOLocale); +} + +/******************************************************************************* +* +* XCU based accelerator configuration +* +*******************************************************************************/ + +//----------------------------------------------- +// XInterface, XTypeProvider +DEFINE_XINTERFACE_7(XCUBasedAcceleratorConfiguration , + OWeakObject , + DIRECT_INTERFACE(css::lang::XTypeProvider ), + DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ), + DIRECT_INTERFACE(css::util::XChangesListener ), + DIRECT_INTERFACE(css::form::XReset ), + DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence), + DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ), + DIRECT_INTERFACE(css::ui::XUIConfiguration )) + + DEFINE_XTYPEPROVIDER_7(XCUBasedAcceleratorConfiguration , + css::lang::XTypeProvider , + css::ui::XAcceleratorConfiguration , + css::util::XChangesListener , + css::form::XReset , + css::ui::XUIConfigurationPersistence, + css::ui::XUIConfigurationStorage , + css::ui::XUIConfiguration ) + +//----------------------------------------------- +XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR) + : ThreadHelpBase (&Application::GetSolarMutex()) + , m_xSMGR (xSMGR ) + , m_pPrimaryWriteCache(0 ) + , m_pSecondaryWriteCache(0 ) +{ + m_xCfg = css::uno::Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + css::uno::UNO_QUERY ); +} + +//----------------------------------------------- +XCUBasedAcceleratorConfiguration::~XCUBasedAcceleratorConfiguration() +{ +} + +//----------------------------------------------- +css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getAllKeyEvents() + throw(css::uno::RuntimeException) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + AcceleratorCache::TKeyList lKeys = impl_getCFG(sal_True).getAllKeys(); //get keys from PrimaryKeys set + + AcceleratorCache::TKeyList lSecondaryKeys = impl_getCFG(sal_False).getAllKeys(); //get keys from SecondaryKeys set + AcceleratorCache::TKeyList::const_iterator pIt; + for ( pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt ) + lKeys.push_back(*pIt); + + return lKeys.getAsConstList(); + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +::rtl::OUString SAL_CALL XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent) + throw(css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True ); + AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False); + + if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent)) + throw css::container::NoSuchElementException( + ::rtl::OUString(), + static_cast< ::cppu::OWeakObject* >(this)); + + if (rPrimaryCache.hasKey(aKeyEvent)) + return rPrimaryCache.getCommandByKey(aKeyEvent); + else + return rSecondaryCache.getCommandByKey(aKeyEvent); + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent, + const ::rtl::OUString& sCommand ) + throw(css::lang::IllegalArgumentException, + css::uno::RuntimeException ) +{ + RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::setKeyEvent" ); + + if ( + (aKeyEvent.KeyCode == 0) && + (aKeyEvent.KeyChar == 0) && + (aKeyEvent.KeyFunc == 0) && + (aKeyEvent.Modifiers == 0) + ) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."), + static_cast< ::cppu::OWeakObject* >(this), + 0); + + if (!sCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + 1); + + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); // TRUE => force getting of a writeable cache! + AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); // TRUE => force getting of a writeable cache! + + if ( rPrimaryCache.hasKey(aKeyEvent) ) + { + ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent); + if ( sCommand != sOriginalCommand ) + { + if (rSecondaryCache.hasCommand(sOriginalCommand)) + { + AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand); + rSecondaryCache.removeKey(lSecondaryKeys[0]); + rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand); + } + + if (rPrimaryCache.hasCommand(sCommand)) + { + AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand); + rPrimaryCache.removeKey(lPrimaryKeys[0]); + rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand); + } + + rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand); + } + } + + else if ( rSecondaryCache.hasKey(aKeyEvent) ) + { + ::rtl::OUString sOriginalCommand = rSecondaryCache.getCommandByKey(aKeyEvent); + if (sCommand != sOriginalCommand) + { + if (rPrimaryCache.hasCommand(sCommand)) + { + AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand); + rPrimaryCache.removeKey(lPrimaryKeys[0]); + rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand); + } + + rSecondaryCache.removeKey(aKeyEvent); + rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand); + } + } + + else + { + if (rPrimaryCache.hasCommand(sCommand)) + { + AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand); + rPrimaryCache.removeKey(lPrimaryKeys[0]); + rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand); + } + + rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand); + } + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + + RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::setKeyEvent" ); +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent) + throw(css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); + AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); + + if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent)) + throw css::container::NoSuchElementException( + ::rtl::OUString(), + static_cast< ::cppu::OWeakObject* >(this)); + + if (rPrimaryCache.hasKey(aKeyEvent)) + { + ::rtl::OUString sDelCommand = rPrimaryCache.getCommandByKey(aKeyEvent); + if (sDelCommand.getLength() > 0) + { + ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent); + if (rSecondaryCache.hasCommand(sOriginalCommand)) + { + AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand); + rSecondaryCache.removeKey(lSecondaryKeys[0]); + rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand); + } + + rPrimaryCache.removeKey(aKeyEvent); + } + + } + else + { + ::rtl::OUString sDelCommand = rSecondaryCache.getCommandByKey(aKeyEvent); + if (sDelCommand.getLength() > 0) + rSecondaryCache.removeKey(aKeyEvent); + } + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand) + throw(css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + if (!sCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + 1); + + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True ); + AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False); + + if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand)) + throw css::container::NoSuchElementException( + ::rtl::OUString(), + static_cast< ::cppu::OWeakObject* >(this)); + + AcceleratorCache::TKeyList lKeys = rPrimaryCache.getKeysByCommand(sCommand); + + AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sCommand); + AcceleratorCache::TKeyList::const_iterator pIt; + for (pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt) + lKeys.push_back(*pIt); + + return lKeys.getAsConstList(); + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList& lKeys) +{ + AcceleratorCache::TKeyList::const_iterator pIt; + for ( pIt = lKeys.begin (); + pIt != lKeys.end (); + ++pIt ) + { + const css::awt::KeyEvent& rAWTKey = *pIt; + const KeyCode aVCLKey = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(rAWTKey); + const String sName = aVCLKey.GetName(); + + if (sName.Len () > 0) + return pIt; + } + + return lKeys.end (); +} + +//----------------------------------------------- +css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList) + throw(css::lang::IllegalArgumentException , + css::uno::RuntimeException ) +{ + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + sal_Int32 i = 0; + sal_Int32 c = lCommandList.getLength(); + css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list! + AcceleratorCache& rCache = impl_getCFG(sal_True); + + for (i=0; i<c; ++i) + { + const ::rtl::OUString& rCommand = lCommandList[i]; + if (!rCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + (sal_Int16)i); + + if (!rCache.hasCommand(rCommand)) + continue; + + AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand); + if (lKeys.size()<1) + continue; + + AcceleratorCache::TKeyList::const_iterator pPreferredKey = lcl_getPreferredKey(lKeys); + if (pPreferredKey != lKeys.end ()) + { + css::uno::Any& rAny = lPreferredOnes[i]; + rAny <<= *(pPreferredKey); + } + } + + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + return lPreferredOnes; +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand) + throw(css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::uno::RuntimeException ) +{ + if (!sCommand.getLength()) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."), + static_cast< ::cppu::OWeakObject* >(this), + 0); + + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); + AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); + + if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand)) + throw css::container::NoSuchElementException( + ::rtl::OUString::createFromAscii("Command does not exists inside this container."), + static_cast< ::cppu::OWeakObject* >(this)); + + if (rPrimaryCache.hasCommand(sCommand)) + rPrimaryCache.removeCommand(sCommand); + if (rSecondaryCache.hasCommand(sCommand)) + rSecondaryCache.removeCommand(sCommand); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::reload() + throw(css::uno::Exception , + css::uno::RuntimeException) +{ + RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::reload()" ); + + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + sal_Bool bPreferred; + css::uno::Reference< css::container::XNameAccess > xAccess; + + bPreferred = sal_True; + m_aPrimaryReadCache = AcceleratorCache(); + if (m_pPrimaryWriteCache) + { + // be aware of reentrance problems - use temp variable for calling delete ... :-) + AcceleratorCache* pTemp = m_pPrimaryWriteCache; + m_pPrimaryWriteCache = 0; + delete pTemp; + } + m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess; + impl_ts_load(bPreferred, xAccess); // load the preferred keys + + bPreferred = sal_False; + m_aSecondaryReadCache = AcceleratorCache(); + if (m_pSecondaryWriteCache) + { + // be aware of reentrance problems - use temp variable for calling delete ... :-) + AcceleratorCache* pTemp = m_pSecondaryWriteCache; + m_pSecondaryWriteCache = 0; + delete pTemp; + } + m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess; + impl_ts_load(bPreferred, xAccess); // load the secondary keys + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + + RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::reload()" ); +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::store() + throw(css::uno::Exception , + css::uno::RuntimeException) +{ + RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::store()" ); + + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + + sal_Bool bPreferred; + css::uno::Reference< css::container::XNameAccess > xAccess; + + bPreferred = sal_True; + m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess; + impl_ts_save(bPreferred, xAccess); + + bPreferred = sal_False; + m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess; + impl_ts_save(bPreferred, xAccess); + + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::store()" ); +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/) + throw(css::uno::Exception , + css::uno::RuntimeException) +{ + // todo implement me + // use m_aCache + old AcceleratorXMLWriter to store data directly on storage given as parameter ... +} + +//----------------------------------------------- +::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isModified() + throw(css::uno::RuntimeException) +{ + return sal_False; +} + +//----------------------------------------------- +::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isReadOnly() + throw(css::uno::RuntimeException) +{ + return sal_False; +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XCUBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)") +} + +//----------------------------------------------- +::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::hasStorage() + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XCUBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)") + return sal_False; +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XCUBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me") +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XCUBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me") +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::reset() + throw(css::uno::RuntimeException) +{ + css::uno::Reference< css::container::XNamed > xNamed(m_xCfg, css::uno::UNO_QUERY); + ::rtl::OUString sConfig = xNamed->getName(); + if ( sConfig.equalsAscii("Global") ) + { + m_xCfg = css::uno::Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_GLOBAL, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + css::uno::UNO_QUERY ); + XCUBasedAcceleratorConfiguration::reload(); + } + else if ( sConfig.equalsAscii("Modules") ) + { + m_xCfg = css::uno::Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_MODULES, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ), + css::uno::UNO_QUERY ); + XCUBasedAcceleratorConfiguration::reload(); + } +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XCUBasedAcceleratorConfiguration::addResetListener()", "TODO implement me") +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/) + throw(css::uno::RuntimeException) +{ + LOG_WARNING("XCUBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me") +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util::ChangesEvent& aEvent) + throw(css::uno::RuntimeException) +{ + RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::changesOccurred()" ); + + css::uno::Reference< css::container::XHierarchicalNameAccess > xHAccess; + aEvent.Base >>= xHAccess; + if (! xHAccess.is ()) + return; + + const sal_Int32 c = aEvent.Changes.getLength(); + sal_Int32 i = 0; + + for (i=0; i<c; ++i) + { + const css::util::ElementChange& aChange = aEvent.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 :-) + // So we try to split the path into 3 parts (module isnt important here, because we already know it ... because + // these instance is bound to a specific module configuration ... or it''s the global configuration where no module is given at all. + + ::rtl::OUString sOrgPath ; + ::rtl::OUString sPath ; + ::rtl::OUString sKey; + + aChange.Accessor >>= sOrgPath; + sPath = sOrgPath; + ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath); + sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sPrimarySecondary); + + ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath); + sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sGlobalModules); + + if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) ) + { + ::rtl::OUString sModule; + sKey = ::utl::extractFirstFromConfigurationPath(sPath); + if ( sKey.getLength() )
+ reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
+ } + else if ( sGlobalModules.equals(CFG_ENTRY_MODULES) ) + { + ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath); + ::rtl::OUString sDropModule = ::rtl::OUString::createFromAscii("Module['") + sModule + ::rtl::OUString::createFromAscii("']"); + sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sDropModule); + sKey = ::utl::extractFirstFromConfigurationPath(sPath); + if ( sKey.getLength() )
+ reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey); + } + } + + RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::changesOccurred()" ); +} + +//----------------------------------------------- +void SAL_CALL XCUBasedAcceleratorConfiguration::disposing(const css::lang::EventObject& /*aSource*/) + throw(css::uno::RuntimeException) +{ +} + +//----------------------------------------------- +void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg ) +{ + AcceleratorCache aReadCache = AcceleratorCache(); + css::uno::Reference< css::container::XNameAccess > xAccess; + if (m_sGlobalOrModules.equalsAscii("Global")) + xCfg->getByName(CFG_ENTRY_GLOBAL) >>= xAccess; + else if (m_sGlobalOrModules.equalsAscii("Modules")) + { + css::uno::Reference< css::container::XNameAccess > xModules; + xCfg->getByName(CFG_ENTRY_MODULES) >>= xModules; + xModules->getByName(m_sModuleCFG) >>= xAccess; + } + + css::uno::Reference< css::container::XNameAccess > xKey; + css::uno::Reference< css::container::XNameAccess > xCommand; + if (xAccess.is()) + { + css::uno::Sequence< ::rtl::OUString > lKeys = xAccess->getElementNames(); + sal_Int32 nKeys = lKeys.getLength(); + for ( sal_Int32 i=0; i<nKeys; ++i ) + { + ::rtl::OUString sKey = lKeys[i]; + xAccess->getByName(sKey) >>= xKey; + xKey->getByName(CFG_PROP_COMMAND) >>= xCommand; + + css::uno::Sequence< ::rtl::OUString > lLocales = xCommand->getElementNames(); + sal_Int32 nLocales = lLocales.getLength(); + ::std::vector< ::rtl::OUString > aLocales; + for ( sal_Int32 j=0; j<nLocales; ++j ) + aLocales.push_back(lLocales[j]); + + ::std::vector< ::rtl::OUString >::const_iterator pFound; + for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound ) + { + if ( *pFound == impl_ts_getLocale().toISO() ) + break; + } + + if ( pFound == aLocales.end() ) + { + ::rtl::OUString sDefaultLocale = ::rtl::OUString::createFromAscii("en-US"); + for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound ) + { + if ( *pFound == sDefaultLocale ) + break; + } + + if ( pFound == aLocales.end() ) + continue; + } + + ::rtl::OUString sLocale = *pFound; + ::rtl::OUString sCommand; + xCommand->getByName(sLocale) >>= sCommand; + if (sCommand.getLength()<1) + continue; + + KeyMapping aKeyMapping; + css::awt::KeyEvent aKeyEvent; + + sal_Int32 nIndex = 0; + ::rtl::OUString sKeyCommand = sKey.getToken(0, '_', nIndex); + ::rtl::OUString sPrefix = ::rtl::OUString::createFromAscii("KEY_"); + aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(sPrefix + sKeyCommand); + + css::uno::Sequence< ::rtl::OUString > sToken(4); + const sal_Int32 nToken = 4; + sal_Bool bValid = sal_True; + sal_Int32 k; + for (k=0; k<nToken; ++k) + { + if (nIndex < 0) + break; + + sToken[k] = sKey.getToken(0, '_', nIndex); + ::rtl::OUString sTest = sToken[k]; + if (sToken[k].getLength() < 1) + { + bValid = sal_False; + break; + } + + if (sToken[k].equalsAscii("SHIFT")) + aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT; + else if (sToken[k].equalsAscii("MOD1")) + aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1; + else if (sToken[k].equalsAscii("MOD2")) + aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2; + else + { + bValid = sal_False; + break; + } + } + + if ( !aReadCache.hasKey(aKeyEvent) && bValid && k<nToken) + aReadCache.setKeyCommandPair(aKeyEvent, sCommand); + } + } + + if (bPreferred) + m_aPrimaryReadCache.takeOver(aReadCache); + else + m_aSecondaryReadCache.takeOver(aReadCache); +} + +//----------------------------------------------- +void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& /*xCfg*/) +{ + if (bPreferred) + { + AcceleratorCache::TKeyList::const_iterator pIt; + AcceleratorCache::TKeyList lPrimaryReadKeys = m_aPrimaryReadCache.getAllKeys(); + AcceleratorCache::TKeyList lPrimaryWriteKeys = m_pPrimaryWriteCache->getAllKeys(); + + for ( pIt = lPrimaryReadKeys.begin(); pIt != lPrimaryReadKeys.end(); ++pIt ) + { + if (!m_pPrimaryWriteCache->hasKey(*pIt)) + removeKeyFromConfiguration(*pIt, sal_True); + } + + for ( pIt = lPrimaryWriteKeys.begin(); pIt != lPrimaryWriteKeys.end(); ++pIt ) + { + ::rtl::OUString sCommand = m_pPrimaryWriteCache->getCommandByKey(*pIt); + if (!m_aPrimaryReadCache.hasKey(*pIt)) + { + insertKeyToConfiguration(*pIt, sCommand, sal_True); + } + else + { + ::rtl::OUString sReadCommand = m_aPrimaryReadCache.getCommandByKey(*pIt); + if (sReadCommand != sCommand) + insertKeyToConfiguration(*pIt, sCommand, sal_True); + } + } + + // take over all changes into the original container + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + if (m_pPrimaryWriteCache) + { + m_aPrimaryReadCache.takeOver(*m_pPrimaryWriteCache); + AcceleratorCache* pTemp = m_pPrimaryWriteCache; + m_pPrimaryWriteCache = 0; + delete pTemp; + } + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + } + + else + { + AcceleratorCache::TKeyList::const_iterator pIt; + AcceleratorCache::TKeyList lSecondaryReadKeys = m_aSecondaryReadCache.getAllKeys(); + AcceleratorCache::TKeyList lSecondaryWriteKeys = m_pSecondaryWriteCache->getAllKeys(); + + for ( pIt = lSecondaryReadKeys.begin(); pIt != lSecondaryReadKeys.end(); ++pIt) + { + if (!m_pSecondaryWriteCache->hasKey(*pIt)) + removeKeyFromConfiguration(*pIt, sal_False); + } + + + for ( pIt = lSecondaryWriteKeys.begin(); pIt != lSecondaryWriteKeys.end(); ++pIt ) + { + ::rtl::OUString sCommand = m_pSecondaryWriteCache->getCommandByKey(*pIt); + if (!m_aSecondaryReadCache.hasKey(*pIt)) + { + insertKeyToConfiguration(*pIt, sCommand, sal_False); + } + else + { + ::rtl::OUString sReadCommand = m_aSecondaryReadCache.getCommandByKey(*pIt); + if (sReadCommand != sCommand) + insertKeyToConfiguration(*pIt, sCommand, sal_False); + } + } + + // take over all changes into the original container + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + if (m_pSecondaryWriteCache) + { + m_aSecondaryReadCache.takeOver(*m_pSecondaryWriteCache); + AcceleratorCache* pTemp = m_pSecondaryWriteCache; + m_pSecondaryWriteCache = 0; + delete pTemp; + } + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- + } + + ::comphelper::ConfigurationHelper::flush(m_xCfg); +} + +//----------------------------------------------- +void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt::KeyEvent& aKeyEvent, const ::rtl::OUString& sCommand, const sal_Bool bPreferred ) +{ + css::uno::Reference< css::container::XNameAccess > xAccess; + css::uno::Reference< css::container::XNameContainer > xContainer; + css::uno::Reference< css::lang::XSingleServiceFactory > xFac; + css::uno::Reference< css::uno::XInterface > xInst; + + if ( bPreferred ) + m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess; + else + m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess; + + if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) ) + xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer; + else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) ) + { + css::uno::Reference< css::container::XNameContainer > xModules; + xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules; + if ( !xModules->hasByName(m_sModuleCFG) ) + { + xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xModules, css::uno::UNO_QUERY); + xInst = xFac->createInstance(); + xModules->insertByName(m_sModuleCFG, css::uno::makeAny(xInst)); + } + xModules->getByName(m_sModuleCFG) >>= xContainer; + } + + KeyMapping aKeyMapping; + const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier... + ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex); + + if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT ) + sKey += ::rtl::OUString::createFromAscii("_SHIFT"); + if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 ) + sKey += ::rtl::OUString::createFromAscii("_MOD1"); + if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 ) + sKey += ::rtl::OUString::createFromAscii("_MOD2"); + + css::uno::Reference< css::container::XNameAccess > xKey; + css::uno::Reference< css::container::XNameContainer > xCommand; + if ( !xContainer->hasByName(sKey) ) + { + xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xContainer, css::uno::UNO_QUERY); + xInst = xFac->createInstance(); + xContainer->insertByName(sKey, css::uno::makeAny(xInst)); + } + xContainer->getByName(sKey) >>= xKey; + + xKey->getByName(CFG_PROP_COMMAND) >>= xCommand; + ::rtl::OUString sLocale = impl_ts_getLocale().toISO(); + if ( !xCommand->hasByName(sLocale) ) + xCommand->insertByName(sLocale, css::uno::makeAny(sCommand)); + else + xCommand->replaceByName(sLocale, css::uno::makeAny(sCommand)); +} + +//----------------------------------------------- +void XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration( const css::awt::KeyEvent& aKeyEvent, const sal_Bool bPreferred ) +{ + css::uno::Reference< css::container::XNameAccess > xAccess; + css::uno::Reference< css::container::XNameContainer > xContainer; + + if ( bPreferred ) + m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess; + else + m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess; + + if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) ) + xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer; + else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) ) + { + css::uno::Reference< css::container::XNameAccess > xModules; + xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules; + if ( !xModules->hasByName(m_sModuleCFG) ) + return; + xModules->getByName(m_sModuleCFG) >>= xContainer; + } + + KeyMapping aKeyMapping; + const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier... + ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex); + + if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT ) + sKey += ::rtl::OUString::createFromAscii("_SHIFT"); + if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 ) + sKey += ::rtl::OUString::createFromAscii("_MOD1"); + if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 ) + sKey += ::rtl::OUString::createFromAscii("_MOD2"); + + xContainer->removeByName(sKey); +} + +//----------------------------------------------- +void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPrimarySecondary, const ::rtl::OUString& sGlobalModules, const ::rtl::OUString& sModule, const ::rtl::OUString& sKey ) +{ + css::uno::Reference< css::container::XNameAccess > xAccess; + css::uno::Reference< css::container::XNameContainer > xContainer; + + m_xCfg->getByName(sPrimarySecondary) >>= xAccess; + if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) ) + xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer; + else + { + css::uno::Reference< css::container::XNameAccess > xModules; + xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules; + if ( !xModules->hasByName(sModule) ) + return; + xModules->getByName(sModule) >>= xContainer; + } + + KeyMapping aKeyMapping; + css::awt::KeyEvent aKeyEvent; + ::rtl::OUString sKeyIdentifier; + + sal_Int32 nIndex = 0; + sKeyIdentifier = sKey.getToken(0, '_', nIndex); + aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(::rtl::OUString::createFromAscii("KEY_")+sKeyIdentifier); + + css::uno::Sequence< ::rtl::OUString > sToken(3); + const sal_Int32 nToken = 3; + for (sal_Int32 i=0; i<nToken; ++i) + { + if ( nIndex < 0 ) + break; + + sToken[i] = sKey.getToken(0, '_', nIndex); + if (sToken[i].equalsAscii("SHIFT")) + aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT; + else if (sToken[i].equalsAscii("MOD1")) + aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1; + else if (sToken[i].equalsAscii("MOD2")) + aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2; + } + + css::uno::Reference< css::container::XNameAccess > xKey; + css::uno::Reference< css::container::XNameAccess > xCommand; + ::rtl::OUString sCommand; + + if (xContainer->hasByName(sKey)) + { + ::rtl::OUString sLocale = impl_ts_getLocale().toISO(); + xContainer->getByName(sKey) >>= xKey; + xKey->getByName(CFG_PROP_COMMAND) >>= xCommand; + xCommand->getByName(sLocale) >>= sCommand; + } + + if (sPrimarySecondary.equals(CFG_ENTRY_PRIMARY)) + { + if (sCommand.getLength() ==0) + m_aPrimaryReadCache.removeKey(aKeyEvent); + else + m_aPrimaryReadCache.setKeyCommandPair(aKeyEvent, sCommand); + } + else if (sPrimarySecondary.equals(CFG_ENTRY_SECONDARY)) + { + if (sCommand.getLength() ==0) + m_aSecondaryReadCache.removeKey(aKeyEvent); + else + m_aSecondaryReadCache.setKeyCommandPair(aKeyEvent, sCommand); + } +} + +//----------------------------------------------- +AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPreferred, sal_Bool bWriteAccessRequested) +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + if (bPreferred) + { + //create copy of our readonly-cache, if write access is forced ... but + //not still possible! + if ( + (bWriteAccessRequested) && + (!m_pPrimaryWriteCache ) + ) + { + m_pPrimaryWriteCache = new AcceleratorCache(m_aPrimaryReadCache); + } + + // in case, we have a writeable cache, we use it for reading too! + // Otherwhise the API user cant find its own changes ... + if (m_pPrimaryWriteCache) + return *m_pPrimaryWriteCache; + else + return m_aPrimaryReadCache; + } + + else + { + //create copy of our readonly-cache, if write access is forced ... but + //not still possible! + if ( + (bWriteAccessRequested) && + (!m_pSecondaryWriteCache ) + ) + { + m_pSecondaryWriteCache = new AcceleratorCache(m_aSecondaryReadCache); + } + + // in case, we have a writeable cache, we use it for reading too! + // Otherwhise the API user cant find its own changes ... + if (m_pSecondaryWriteCache) + return *m_pSecondaryWriteCache; + else + return m_aSecondaryReadCache; + } + + // <- SAFE ---------------------------------- +} + +//----------------------------------------------- +::comphelper::Locale XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const +{ + static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup"); + static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" ); + static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" ); + + // SAFE -> ---------------------------------- + ReadGuard aReadLock(m_aLock); + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + aReadLock.unlock(); + // <- SAFE ---------------------------------- + + css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY); + css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW); + ::rtl::OUString sISOLocale; + xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale; + + if (!sISOLocale.getLength()) + return ::comphelper::Locale::EN_US(); + return ::comphelper::Locale(sISOLocale); +} + +} // namespace framework diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx index 642b68e88714..cd9ff97dc652 100644 --- a/framework/source/classes/fwktabwindow.cxx +++ b/framework/source/classes/fwktabwindow.cxx @@ -81,18 +81,19 @@ void FwkTabControl::BroadcastEvent( ULONG nEvent ) { DBG_ERRORFILE( "FwkTabControl::BroadcastEvent(): illegal event" ); } -}
+} // class FwkTabPage ------------------------------------------------ FwkTabPage::FwkTabPage( - Window* pParent, const rtl::OUString& rPageURL, const rtl::OUString& rEventHdl, - const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ) : + Window* pParent, const rtl::OUString& rPageURL, + const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl, + const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ) : TabPage( pParent, WB_DIALOGCONTROL ), m_sPageURL ( rPageURL ), - m_sEventHdl ( rEventHdl ), + m_xEventHdl ( rEventHdl ), m_xWinProvider ( rProvider ) { @@ -113,17 +114,13 @@ void FwkTabPage::CreateDialog() try { uno::Reference< uno::XInterface > xHandler; - if ( m_sEventHdl.getLength() > 0 ) - { - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - m_xEventHdl = uno::Reference< awt::XContainerWindowEventHandler >( - xFactory->createInstance( m_sEventHdl ), uno::UNO_QUERY ); - xHandler = m_xEventHdl; - } + if ( m_xEventHdl.is() ) + xHandler = m_xEventHdl; + uno::Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), uno::UNO_QUERY ); m_xPage = uno::Reference < awt::XWindow >( m_xWinProvider->createContainerWindow( - m_sPageURL, rtl::OUString(), xParent, xHandler ), uno::UNO_QUERY );
+ m_sPageURL, rtl::OUString(), xParent, xHandler ), uno::UNO_QUERY ); CallMethod( INITIALIZE_METHOD ); } @@ -165,10 +162,10 @@ void FwkTabPage::ActivatePage() if ( !m_xPage.is() ) CreateDialog(); - if ( m_xPage.is() )
- {
+ if ( m_xPage.is() ) + { Resize (); - m_xPage->setVisible( sal_True );
+ m_xPage->setVisible( sal_True ); } } @@ -221,8 +218,8 @@ FwkTabWindow::FwkTabWindow( Window* pParent ) : uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); m_xWinProvider = uno::Reference < awt::XContainerWindowProvider >( xFactory->createInstance( SERVICENAME_WINPROVIDER ), uno::UNO_QUERY ); -
- SetPaintTransparent(true);
+ + SetPaintTransparent(true); m_aTabCtrl.SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) ); m_aTabCtrl.SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) ); @@ -283,11 +280,13 @@ IMPL_LINK( FwkTabWindow, ActivatePageHdl, TabControl *, EMPTYARG ) TabEntry* pEntry = FindEntry( nId ); if ( pEntry ) { - pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_sEventHdl, m_xWinProvider ); + pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider ); pTabPage->Show(); pTabPage->ActivatePage(); m_aTabCtrl.SetTabPage( nId, pTabPage ); } + } else { + pTabPage->ActivatePage(); } m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE ); return 1; @@ -320,7 +319,8 @@ void FwkTabWindow::AddEventListener( const Link& rEventListener ) FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties ) { - ::rtl::OUString sTitle, sToolTip, sPageURL, sEventHdl; + ::rtl::OUString sTitle, sToolTip, sPageURL; + uno::Reference< css::awt::XContainerWindowEventHandler > xEventHdl; uno::Reference< graphic::XGraphic > xImage; bool bDisabled = false; @@ -338,14 +338,14 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea else if ( sName.equalsAscii("PageURL") ) aAny >>= sPageURL; else if ( sName.equalsAscii("EventHdl") ) - aAny >>= sEventHdl; + aAny >>= xEventHdl; else if ( sName.equalsAscii("Image") ) aAny >>= xImage; else if ( sName.equalsAscii("Disabled") ) aAny >>= bDisabled; } - TabEntry* pEntry = new TabEntry( nIndex, sPageURL, sEventHdl ); + TabEntry* pEntry = new TabEntry( nIndex, sPageURL, xEventHdl ); m_TabList.push_back( pEntry ); USHORT nIdx = static_cast< USHORT >( nIndex ); m_aTabCtrl.InsertPage( nIdx, sTitle ); @@ -354,8 +354,8 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea if ( xImage.is() ) m_aTabCtrl.SetPageImage( nIdx, Image( xImage ) ); if ( bDisabled ) - m_aTabCtrl.EnablePage( nIdx, false );
-
+ m_aTabCtrl.EnablePage( nIdx, false ); + return pEntry->m_pPage; } @@ -382,11 +382,11 @@ sal_Int32 FwkTabWindow::GetActivePageId() const } // ----------------------------------------------------------------------- -void FwkTabWindow::Resize()
-{
+void FwkTabWindow::Resize() +{ Size aPageSize = GetSizePixel(); m_aTabCtrl.SetTabPageSizePixel( aPageSize ); -}
+} } // namespace framework diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index 051640fc3724..392e5574d82d 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -489,7 +489,25 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrame ) { // There exist a hard coded interception for special URLs. - if (lcl_isCloseDispatch (aURL)) + if ( + (aURL.Complete.equalsAscii(".uno:CloseDoc" )) || + (aURL.Complete.equalsAscii(".uno:CloseWin" )) + ) + { + css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY ); + // In case the frame is not a top one, is not based on system window and has a parent, + // the parent frame should to be queried for the correct dispatcher. + // See i93473 + if ( + !WindowHelper::isTopWindow(xFrame->getContainerWindow()) && + !VCLUnoHelper::GetWindow(xFrame->getContainerWindow())->IsSystemWindow() && + xParent.is() + ) + xDispatcher = xParent->queryDispatch(aURL, SPECIALTARGET_SELF, 0); + else + xDispatcher = implts_getOrCreateDispatchHelper( E_CLOSEDISPATCHER, xFrame ); + } + else if (aURL.Complete.equalsAscii(".uno:CloseFrame")) xDispatcher = implts_getOrCreateDispatchHelper( E_CLOSEDISPATCHER, xFrame ); if ( ! xDispatcher.is()) diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 90fbd3d2356e..932dd7fd1019 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -3278,6 +3278,7 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible ) WriteGuard aWriteLock( m_aLock ); m_aDockingArea = css::awt::Rectangle(); + m_bMustDoLayout = sal_True; aWriteLock.unlock(); } catch ( Exception& ) diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index fb655f334d57..03b0e1ec3dcc 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -595,18 +595,49 @@ void BackingWindow::Resize() maControlRect = Rectangle( Point( (aWindowSize.Width() - aControlSize.Width()) / 2, (aWindowSize.Height() - aControlSize.Height()) / 2 ), aControlSize ); + + maToolbox.calcMinSize(); + Size aTBSize( maToolbox.getMinSize() ); + Point aTBPos( maControlRect.Right() - aTBSize.Width() - 10, + maControlRect.Bottom() - aTBSize.Height() - 10 ); + maToolbox.SetPosSizePixel( aTBPos, aTBSize ); + + // #i93631# squeeze controls so they fit into the box + // this can be necessary due to application font height which has small deviations + // from the size set + const long nWDelta = maWelcomeSize.Height(); + const long nW2Delta = (maWelcomeSize.Height()*3)/2; + const long nPDelta = (maProductSize.Height()*3)/2; + const long nCDelta = (maCreateSize.Height()*3)/2; + const long nBDelta = maButtonImageSize.Height() + 10; + const long nB2Delta = 3*maButtonImageSize.Height()/2; + const long nLastDelta = maButtonImageSize.Height(); + long nDiff = 0; + while( ( maControlRect.Top() + + (nWDelta - nDiff) + + (nW2Delta- nDiff) + + (nPDelta - nDiff) + + (nCDelta - nDiff) + + 3 * (nBDelta - nDiff) + + (nB2Delta- nDiff) + + nLastDelta + ) > aTBPos.Y() ) + { + nDiff++; + } + long nYPos = maControlRect.Top(); - nYPos += (maWelcomeSize.Height()*3)/2; + nYPos += nW2Delta - nDiff; maWelcome.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); - nYPos += maWelcomeSize.Height(); + nYPos += nWDelta - nDiff; maProduct.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, (maProductSize.Height()*20)/19 ) ); - nYPos += (maProductSize.Height()*3)/2; + nYPos += nPDelta - nDiff; maCreateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, maCreateSize.Height() ) ); - nYPos += (maCreateSize.Height()*3)/2; + nYPos += nCDelta - nDiff; maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); maWriterText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), @@ -614,14 +645,14 @@ void BackingWindow::Resize() maCalcButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); maCalcText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += maButtonImageSize.Height() + 10; + nYPos += nBDelta - nDiff; maImpressButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); maImpressText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); maDrawText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += maButtonImageSize.Height() + 10; + nYPos += nBDelta - nDiff; maDBButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); maDBText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); @@ -629,21 +660,15 @@ void BackingWindow::Resize() maMathText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += 3*maButtonImageSize.Height()/2; + nYPos += nB2Delta - nDiff; maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); maTemplateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += maButtonImageSize.Height() + 10; + nYPos += nBDelta - nDiff; maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); maOpenText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += maButtonImageSize.Height() + 10; - - maToolbox.calcMinSize(); - Size aTBSize( maToolbox.getMinSize() ); - maToolbox.SetPosSizePixel( Point( maControlRect.Right() - aTBSize.Width() - 10, - maControlRect.Bottom() - aTBSize.Height() - 10 ), - aTBSize ); + nYPos += nBDelta - nDiff; } IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index ae6eef12f80f..fb3c08876687 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -154,7 +154,7 @@ TabWindowService::~TabWindowService() ResetableGuard aGuard( m_aLock ); ::sal_Int32 nID = m_nPageIndexCounter++; - TTabPageInfo aInfo(m_nPageIndexCounter); + TTabPageInfo aInfo(nID); m_lTabPageInfos[nID] = aInfo; @@ -202,7 +202,6 @@ void SAL_CALL TabWindowService::setTabProps( ::sal_Int32 if (pTabWin) { pTabWin->AddTabPage(rInfo.m_nIndex, rInfo.m_lProperties); - pTabWin->ActivatePage (rInfo.m_nIndex); rInfo.m_bCreated = sal_True; } } @@ -358,10 +357,7 @@ css::uno::Any SAL_CALL TabWindowService::impl_getPropertyValue(const ::rtl::OUSt //***************************************************************************************************************** IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent ) { - if ( - ( ! pEvent ) || - ( pEvent->ISA(VclWindowEvent) ) - ) + if ( !pEvent && !pEvent->ISA(VclWindowEvent)) return 0; ULONG nEventId = pEvent->GetId(); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 5e51f00faf77..a85cee3178c3 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -336,6 +336,10 @@ void ToolBarManager::Destroy() delete static_cast< AddonsParams* >( m_pToolBar->GetItemData( nItemId )); } + /* #i99167# removed change for i93173 since there is some weird crash + // #i93173# delete toolbar lazily as we can still be in one of its handlers + m_pToolBar->doLazyDelete(); + */ delete m_pToolBar; m_pToolBar = 0; } diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx index f60e445036d7..3a615768b074 100644 --- a/framework/source/uifactory/windowcontentfactorymanager.cxx +++ b/framework/source/uifactory/windowcontentfactorymanager.cxx @@ -1,550 +1,550 @@ -/*************************************************************************
- *
- * 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: uielementfactorymanager.cxx,v $
- * $Revision: 1.10.12.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_framework.hxx"
-
-//_________________________________________________________________________________________________________________
-// my own includes
-//_________________________________________________________________________________________________________________
-#include <uifactory/windowcontentfactorymanager.hxx>
-#include <threadhelp/resetableguard.hxx>
-#include "services.h"
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XControl.hpp>
-
-//_________________________________________________________________________________________________________________
-// includes of other projects
-//_________________________________________________________________________________________________________________
-#include <rtl/ustrbuf.hxx>
-#include <cppuhelper/weak.hxx>
-#include <tools/urlobj.hxx>
-#include <vcl/svapp.hxx>
-
-//_________________________________________________________________________________________________________________
-// Defines
-//_________________________________________________________________________________________________________________
-//
-
-using namespace ::com::sun::star;
-
-//_________________________________________________________________________________________________________________
-// Namespace
-//_________________________________________________________________________________________________________________
-//
-
-namespace framework
-{
-
-// global function needed by both implementations
-static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUString& aName, const rtl::OUString& aModuleName )
-{
- rtl::OUStringBuffer aKey( aType );
- aKey.appendAscii( "^" );
- aKey.append( aName );
- aKey.appendAscii( "^" );
- aKey.append( aModuleName );
- return aKey.makeStringAndClear();
-}
-
-
-//*****************************************************************************************************************
-// Configuration access class for UIElementFactoryManager implementation
-//*****************************************************************************************************************
-
-class ConfigurationAccess_WindowContentFactoryManager : // interfaces
- public lang::XTypeProvider ,
- public container::XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
-{
- public:
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager );
- virtual ~ConfigurationAccess_WindowContentFactoryManager();
-
- void readConfigurationData();
-
- rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule );
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
- virtual void SAL_CALL elementRemoved ( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
- virtual void SAL_CALL elementReplaced( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw(uno::RuntimeException);
-
- private:
- class FactoryMap : public std::hash_map< rtl::OUString,
- rtl::OUString,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
- {
- inline void free()
- {
- FactoryMap().swap( *this );
- }
- };
-
- sal_Bool impl_getElementProps( const uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const;
-
- rtl::OUString m_aPropType;
- rtl::OUString m_aPropName;
- rtl::OUString m_aPropModule;
- rtl::OUString m_aPropFactory;
- FactoryMap m_aFactoryMap;
- uno::Reference< lang::XMultiServiceFactory > m_xServiceManager;
- uno::Reference< lang::XMultiServiceFactory > m_xConfigProvider;
- uno::Reference< container::XNameAccess > m_xConfigAccess;
- bool m_bConfigAccessInitialized;
- bool m_bConfigDirty;
-};
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ConfigurationAccess_WindowContentFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE ( lang::XTypeProvider ),
- DIRECT_INTERFACE ( container::XContainerListener ),
- DERIVED_INTERFACE( lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_WindowContentFactoryManager ,
- lang::XTypeProvider ,
- container::XContainerListener ,
- lang::XEventListener
- )
-
-ConfigurationAccess_WindowContentFactoryManager::ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
- ThreadHelpBase(),
- m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )),
- m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
- m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
- m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )),
- m_xServiceManager( rServiceManager ),
- m_bConfigAccessInitialized( false ),
- m_bConfigDirty( true )
-{
- m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- uno::UNO_QUERY );
-}
-
-ConfigurationAccess_WindowContentFactoryManager::~ConfigurationAccess_WindowContentFactoryManager()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
- if ( xContainer.is() )
- xContainer->removeContainerListener( this );
-}
-
-rtl::OUString ConfigurationAccess_WindowContentFactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- // Make sure that we read the configuration data at least once.
- // May be more dependent on the dirty flag!
- readConfigurationData();
-
- FactoryMap::const_iterator pIter =
- m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rModule ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- else
- {
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- else
- {
- // Support factories which uses a defined prefix for their element names.
- sal_Int32 nIndex = rName.indexOf( '_' );
- if ( nIndex > 0 )
- {
- rtl::OUString aName = rName.copy( 0, nIndex );
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- }
-
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- }
- }
-
- return rtl::OUString();
-}
-
-// container.XContainerListener
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementInserted( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementRemoved ( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementReplaced( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-// lang.XEventListener
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::disposing( const lang::EventObject& ) throw(uno::RuntimeException)
-{
- // SAFE
- // remove our reference to the config access
- ResetableGuard aLock( m_aLock );
- m_xConfigAccess.clear();
-}
-
-void ConfigurationAccess_WindowContentFactoryManager::readConfigurationData()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- bool bConfigAccessInitialized(m_bConfigAccessInitialized);
- if ( !m_bConfigAccessInitialized )
- {
- uno::Sequence< uno::Any > aArgs( 1 );
- beans::PropertyValue aPropValue;
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" ));
- aArgs[0] <<= aPropValue;
-
- try
- {
- m_xConfigAccess = uno::Reference< container::XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- uno::UNO_QUERY );
- }
- catch ( lang::WrappedTargetException& )
- {
- }
-
- m_bConfigAccessInitialized = sal_True;
- }
-
- if ( m_xConfigAccess.is() && m_bConfigDirty )
- {
- uno::Sequence< rtl::OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
-
- uno::Any a;
- rtl::OUString aType;
- rtl::OUString aName;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aHashKey;
-
- uno::Reference< beans::XPropertySet > xPropertySet;
-
- m_aFactoryMap.clear();
- for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ )
- {
- if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService ))
- {
- // Create hash key from type, name and module as they are together a primary key to
- // the UNO service that implements the user interface element factory.
- aHashKey = getHashKeyFromStrings( aType, aName, aModule );
- m_aFactoryMap.insert( FactoryMap::value_type( aHashKey, aService ));
- }
- }
-
- uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
- m_bConfigDirty = false;
-
- aLock.unlock();
- // UNSAFE
-
- if ( xContainer.is() && !bConfigAccessInitialized)
- xContainer->addContainerListener( this );
- }
-}
-
-sal_Bool ConfigurationAccess_WindowContentFactoryManager::impl_getElementProps( const uno::Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const
-{
- uno::Reference< beans::XPropertySet > xPropertySet;
- uno::Reference< container::XNameAccess > xNameAccess;
- aElement >>= xPropertySet;
- aElement >>= xNameAccess;
-
- if ( xPropertySet.is() )
- {
- try
- {
- xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
- xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
- xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
- }
- catch ( beans::UnknownPropertyException& )
- {
- return sal_False;
- }
- catch ( lang::WrappedTargetException& )
- {
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( WindowContentFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE( lang::XTypeProvider ),
- DIRECT_INTERFACE( lang::XServiceInfo ),
- DIRECT_INTERFACE( lang::XSingleComponentFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( WindowContentFactoryManager ,
- lang::XTypeProvider ,
- lang::XServiceInfo ,
- lang::XSingleComponentFactory
- )
-
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager ,
- ::cppu::OWeakObject ,
- SERVICENAME_WINDOWCONTENTFACTORYMANAGER ,
- IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER
- )
-
-DEFINE_INIT_SERVICE ( WindowContentFactoryManager, {} )
-
-WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
- ThreadHelpBase( &Application::GetSolarMutex() ),
- m_bConfigRead( sal_False ),
- m_xServiceManager( xServiceManager )
-{
- m_pConfigAccess = new ConfigurationAccess_WindowContentFactoryManager( m_xServiceManager );
- m_pConfigAccess->acquire();
- m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY );
-}
-
-WindowContentFactoryManager::~WindowContentFactoryManager()
-{
- ResetableGuard aLock( m_aLock );
-
- // reduce reference count
- m_pConfigAccess->release();
-}
-
-void WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName )
-{
- const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
- const char RESOURCEURL_PREFIX[] = "private:resource/";
-
- if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- rtl::OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ));
- sal_Int32 nToken = 0;
- sal_Int32 nPart = 0;
- do
- {
- ::rtl::OUString sToken = aTmpStr.getToken( 0, '/', nToken);
- if ( sToken.getLength() )
- {
- if ( nPart == 0 )
- aType = sToken;
- else if ( nPart == 1 )
- aName = sToken;
- else
- break;
- nPart++;
- }
- }
- while( nToken >=0 );
- }
-}
-
-// XSingleComponentFactory
-uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithContext(
- const uno::Reference< uno::XComponentContext >& /*xContext*/ )
-throw (uno::Exception, uno::RuntimeException)
-{
-/*
- // Currently this method cannot be implemented for generic use. There is no way for external
- code to get a handle to the dialog model.
-
- uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY );
-
- const ::rtl::OUString sToolkitService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit"));
- uno::Reference< awt::XToolkit > xToolkit( xServiceManager->createInstance( sToolkitService ), uno::UNO_QUERY_THROW );
-
- const ::rtl::OUString sDialogModelService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialogModel"));
- uno::Reference< awt::XControlModel > xDialogModel( xServiceManager->createInstance( sDialogModelService ), uno::UNO_QUERY_THROW );
-
- const ::rtl::OUString sDecoration(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
- uno::Reference< beans::XPropertySet > xPropSet( xDialogModel, uno::UNO_QUERY_THROW );
- xPropSet->setPropertyValue( sDecoration, uno::makeAny(false));
-
- const ::rtl::OUString sDialogService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialog"));
- uno::Reference< awt::XControl > xDialogControl( xServiceManager->createInstance( sDialogService ), uno::UNO_QUERY_THROW );
-
- xDialogControl->setModel( xDialogModel );
-
- uno::Reference< awt::XWindowPeer > xWindowParentPeer( xToolkit->getDesktopWindow(), uno::UNO_QUERY );
- xDialogControl->createPeer( xToolkit, xWindowParentPeer );
- uno::Reference< uno::XInterface > xWindow( xDialogControl->getPeer(), uno::UNO_QUERY );
-*/
- uno::Reference< uno::XInterface > xWindow;
- return xWindow;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithArgumentsAndContext(
- const uno::Sequence< uno::Any >& Arguments, const uno::Reference< uno::XComponentContext >& Context )
-throw (uno::Exception, uno::RuntimeException)
-{
- uno::Reference< uno::XInterface > xWindow;
- uno::Reference< frame::XFrame > xFrame;
- ::rtl::OUString aResourceURL;
-
- for (sal_Int32 i=0; i < Arguments.getLength(); i++ )
- {
- beans::PropertyValue aPropValue;
- if ( Arguments[i] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "Frame" ))
- aPropValue.Value >>= xFrame;
- else if ( aPropValue.Name.equalsAscii( "ResourceURL" ))
- aPropValue.Value >>= aResourceURL;
- }
- }
-
- uno::Reference< frame::XModuleManager > xModuleManager;
- // SAFE
- {
- ResetableGuard aLock( m_aLock );
- xModuleManager = m_xModuleManager;
- }
- // UNSAFE
-
- // Determine the module identifier
- ::rtl::OUString aType;
- ::rtl::OUString aName;
- ::rtl::OUString aModuleId;
- try
- {
- if ( xFrame.is() && xModuleManager.is() )
- aModuleId = xModuleManager->identify( uno::Reference< uno::XInterface >( xFrame, uno::UNO_QUERY ) );
- }
- catch ( frame::UnknownModuleException& )
- {
- }
-
- RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
- if ( aType.getLength() > 0 &&
- aName.getLength() > 0 &&
- aModuleId.getLength() > 0 )
- {
- ::rtl::OUString aImplementationName;
- uno::Reference< uno::XInterface > xHolder( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY );
-
- // Detetmine the implementation name of the window content factory dependent on the
- // module identifier, user interface element type and name
- // SAFE
- ResetableGuard aLock( m_aLock );
- aImplementationName = m_pConfigAccess->getFactorySpecifierFromTypeNameModule( aType, aName, aModuleId );
- if ( aImplementationName.getLength() > 0 )
- {
- aLock.unlock();
- // UNSAFE
-
- uno::Reference< lang::XMultiServiceFactory > xServiceManager( Context->getServiceManager(), uno::UNO_QUERY );
- if ( xServiceManager.is() )
- {
- uno::Reference< lang::XSingleComponentFactory > xFactory(
- xServiceManager->createInstance( aImplementationName ), uno::UNO_QUERY );
- if ( xFactory.is() )
- {
- // Be careful: We call external code. Therefore here we have to catch all exceptions
- try
- {
- xWindow = xFactory->createInstanceWithArgumentsAndContext( Arguments, Context );
- }
- catch ( uno::RuntimeException& )
- {
- }
- catch ( uno::Exception& )
- {
- }
- }
- }
- }
- }
-
- // UNSAFE
- if ( !xWindow.is())
- {
- // Fallback: Use internal factory code to create a toolkit dialog as a content window
- xWindow = createInstanceWithContext(Context);
- }
-
- return xWindow;
-}
-
-} // namespace framework
+/************************************************************************* + * + * 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: uielementfactorymanager.cxx,v $ + * $Revision: 1.10.12.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <uifactory/windowcontentfactorymanager.hxx> +#include <threadhelp/resetableguard.hxx> +#include "services.h" + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/awt/XControl.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <rtl/ustrbuf.hxx> +#include <cppuhelper/weak.hxx> +#include <tools/urlobj.hxx> +#include <vcl/svapp.hxx> + +//_________________________________________________________________________________________________________________ +// Defines +//_________________________________________________________________________________________________________________ +// + +using namespace ::com::sun::star; + +//_________________________________________________________________________________________________________________ +// Namespace +//_________________________________________________________________________________________________________________ +// + +namespace framework +{ + +// global function needed by both implementations +static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUString& aName, const rtl::OUString& aModuleName ) +{ + rtl::OUStringBuffer aKey( aType ); + aKey.appendAscii( "^" ); + aKey.append( aName ); + aKey.appendAscii( "^" ); + aKey.append( aModuleName ); + return aKey.makeStringAndClear(); +} + + +//***************************************************************************************************************** +// Configuration access class for UIElementFactoryManager implementation +//***************************************************************************************************************** + +class ConfigurationAccess_WindowContentFactoryManager : // interfaces + public lang::XTypeProvider , + public container::XContainerListener , + // baseclasses + // Order is neccessary for right initialization! + private ThreadHelpBase , + public ::cppu::OWeakObject +{ + public: + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager ); + virtual ~ConfigurationAccess_WindowContentFactoryManager(); + + void readConfigurationData(); + + rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ); + + // container.XContainerListener + virtual void SAL_CALL elementInserted( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException); + virtual void SAL_CALL elementRemoved ( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException); + + // lang.XEventListener + virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw(uno::RuntimeException); + + private: + class FactoryMap : public std::hash_map< rtl::OUString, + rtl::OUString, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > + { + inline void free() + { + FactoryMap().swap( *this ); + } + }; + + sal_Bool impl_getElementProps( const uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const; + + rtl::OUString m_aPropType; + rtl::OUString m_aPropName; + rtl::OUString m_aPropModule; + rtl::OUString m_aPropFactory; + FactoryMap m_aFactoryMap; + uno::Reference< lang::XMultiServiceFactory > m_xServiceManager; + uno::Reference< lang::XMultiServiceFactory > m_xConfigProvider; + uno::Reference< container::XNameAccess > m_xConfigAccess; + bool m_bConfigAccessInitialized; + bool m_bConfigDirty; +}; + +//***************************************************************************************************************** +// XInterface, XTypeProvider +//***************************************************************************************************************** +DEFINE_XINTERFACE_3 ( ConfigurationAccess_WindowContentFactoryManager , + OWeakObject , + DIRECT_INTERFACE ( lang::XTypeProvider ), + DIRECT_INTERFACE ( container::XContainerListener ), + DERIVED_INTERFACE( lang::XEventListener, XContainerListener ) + ) + +DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_WindowContentFactoryManager , + lang::XTypeProvider , + container::XContainerListener , + lang::XEventListener + ) + +ConfigurationAccess_WindowContentFactoryManager::ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) : + ThreadHelpBase(), + m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )), + m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )), + m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )), + m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )), + m_xServiceManager( rServiceManager ), + m_bConfigAccessInitialized( false ), + m_bConfigDirty( true ) +{ + m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( rServiceManager->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), + uno::UNO_QUERY ); +} + +ConfigurationAccess_WindowContentFactoryManager::~ConfigurationAccess_WindowContentFactoryManager() +{ + // SAFE + ResetableGuard aLock( m_aLock ); + + uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY ); + if ( xContainer.is() ) + xContainer->removeContainerListener( this ); +} + +rtl::OUString ConfigurationAccess_WindowContentFactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule ) +{ + // SAFE + ResetableGuard aLock( m_aLock ); + + // Make sure that we read the configuration data at least once. + // May be more dependent on the dirty flag! + readConfigurationData(); + + FactoryMap::const_iterator pIter = + m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rModule )); + if ( pIter != m_aFactoryMap.end() ) + return pIter->second; + else + { + pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() )); + if ( pIter != m_aFactoryMap.end() ) + return pIter->second; + else + { + // Support factories which uses a defined prefix for their element names. + sal_Int32 nIndex = rName.indexOf( '_' ); + if ( nIndex > 0 ) + { + rtl::OUString aName = rName.copy( 0, nIndex ); + pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() )); + if ( pIter != m_aFactoryMap.end() ) + return pIter->second; + } + + pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() )); + if ( pIter != m_aFactoryMap.end() ) + return pIter->second; + } + } + + return rtl::OUString(); +} + +// container.XContainerListener +void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementInserted( const container::ContainerEvent& ) throw(uno::RuntimeException) +{ + // SAFE + ResetableGuard aLock( m_aLock ); + m_bConfigDirty = true; +} + +void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementRemoved ( const container::ContainerEvent& ) throw(uno::RuntimeException) +{ + // SAFE + ResetableGuard aLock( m_aLock ); + m_bConfigDirty = true; +} + +void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementReplaced( const container::ContainerEvent& ) throw(uno::RuntimeException) +{ + // SAFE + ResetableGuard aLock( m_aLock ); + m_bConfigDirty = true; +} + +// lang.XEventListener +void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::disposing( const lang::EventObject& ) throw(uno::RuntimeException) +{ + // SAFE + // remove our reference to the config access + ResetableGuard aLock( m_aLock ); + m_xConfigAccess.clear(); +} + +void ConfigurationAccess_WindowContentFactoryManager::readConfigurationData() +{ + // SAFE + ResetableGuard aLock( m_aLock ); + + bool bConfigAccessInitialized(m_bConfigAccessInitialized); + if ( !m_bConfigAccessInitialized ) + { + uno::Sequence< uno::Any > aArgs( 1 ); + beans::PropertyValue aPropValue; + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" )); + aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" )); + aArgs[0] <<= aPropValue; + + try + { + m_xConfigAccess = uno::Reference< container::XNameAccess >( m_xConfigProvider->createInstanceWithArguments( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" )), + aArgs ), + uno::UNO_QUERY ); + } + catch ( lang::WrappedTargetException& ) + { + } + + m_bConfigAccessInitialized = sal_True; + } + + if ( m_xConfigAccess.is() && m_bConfigDirty ) + { + uno::Sequence< rtl::OUString > aUIElementFactories = m_xConfigAccess->getElementNames(); + + uno::Any a; + rtl::OUString aType; + rtl::OUString aName; + rtl::OUString aModule; + rtl::OUString aService; + rtl::OUString aHashKey; + + uno::Reference< beans::XPropertySet > xPropertySet; + + m_aFactoryMap.clear(); + for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ ) + { + if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService )) + { + // Create hash key from type, name and module as they are together a primary key to + // the UNO service that implements the user interface element factory. + aHashKey = getHashKeyFromStrings( aType, aName, aModule ); + m_aFactoryMap.insert( FactoryMap::value_type( aHashKey, aService )); + } + } + + uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY ); + m_bConfigDirty = false; + + aLock.unlock(); + // UNSAFE + + if ( xContainer.is() && !bConfigAccessInitialized) + xContainer->addContainerListener( this ); + } +} + +sal_Bool ConfigurationAccess_WindowContentFactoryManager::impl_getElementProps( const uno::Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const +{ + uno::Reference< beans::XPropertySet > xPropertySet; + uno::Reference< container::XNameAccess > xNameAccess; + aElement >>= xPropertySet; + aElement >>= xNameAccess; + + if ( xPropertySet.is() ) + { + try + { + xPropertySet->getPropertyValue( m_aPropType ) >>= rType; + xPropertySet->getPropertyValue( m_aPropName ) >>= rName; + xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule; + xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier; + } + catch ( beans::UnknownPropertyException& ) + { + return sal_False; + } + catch ( lang::WrappedTargetException& ) + { + return sal_False; + } + } + + return sal_True; +} + +//***************************************************************************************************************** +// XInterface, XTypeProvider, XServiceInfo +//***************************************************************************************************************** +DEFINE_XINTERFACE_3 ( WindowContentFactoryManager , + OWeakObject , + DIRECT_INTERFACE( lang::XTypeProvider ), + DIRECT_INTERFACE( lang::XServiceInfo ), + DIRECT_INTERFACE( lang::XSingleComponentFactory ) + ) + +DEFINE_XTYPEPROVIDER_3 ( WindowContentFactoryManager , + lang::XTypeProvider , + lang::XServiceInfo , + lang::XSingleComponentFactory + ) + +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager , + ::cppu::OWeakObject , + SERVICENAME_WINDOWCONTENTFACTORYMANAGER , + IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER + ) + +DEFINE_INIT_SERVICE ( WindowContentFactoryManager, {} ) + +WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) : + ThreadHelpBase( &Application::GetSolarMutex() ), + m_bConfigRead( sal_False ), + m_xServiceManager( xServiceManager ) +{ + m_pConfigAccess = new ConfigurationAccess_WindowContentFactoryManager( m_xServiceManager ); + m_pConfigAccess->acquire(); + m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY ); +} + +WindowContentFactoryManager::~WindowContentFactoryManager() +{ + ResetableGuard aLock( m_aLock ); + + // reduce reference count + m_pConfigAccess->release(); +} + +void WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName ) +{ + const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17; + const char RESOURCEURL_PREFIX[] = "private:resource/"; + + if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) && + ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) + { + rtl::OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE )); + sal_Int32 nToken = 0; + sal_Int32 nPart = 0; + do + { + ::rtl::OUString sToken = aTmpStr.getToken( 0, '/', nToken); + if ( sToken.getLength() ) + { + if ( nPart == 0 ) + aType = sToken; + else if ( nPart == 1 ) + aName = sToken; + else + break; + nPart++; + } + } + while( nToken >=0 ); + } +} + +// XSingleComponentFactory +uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithContext( + const uno::Reference< uno::XComponentContext >& /*xContext*/ ) +throw (uno::Exception, uno::RuntimeException) +{ +/* + // Currently this method cannot be implemented for generic use. There is no way for external + code to get a handle to the dialog model. + + uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY ); + + const ::rtl::OUString sToolkitService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")); + uno::Reference< awt::XToolkit > xToolkit( xServiceManager->createInstance( sToolkitService ), uno::UNO_QUERY_THROW ); + + const ::rtl::OUString sDialogModelService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialogModel")); + uno::Reference< awt::XControlModel > xDialogModel( xServiceManager->createInstance( sDialogModelService ), uno::UNO_QUERY_THROW ); + + const ::rtl::OUString sDecoration(RTL_CONSTASCII_USTRINGPARAM("Decoration")); + uno::Reference< beans::XPropertySet > xPropSet( xDialogModel, uno::UNO_QUERY_THROW ); + xPropSet->setPropertyValue( sDecoration, uno::makeAny(false)); + + const ::rtl::OUString sDialogService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialog")); + uno::Reference< awt::XControl > xDialogControl( xServiceManager->createInstance( sDialogService ), uno::UNO_QUERY_THROW ); + + xDialogControl->setModel( xDialogModel ); + + uno::Reference< awt::XWindowPeer > xWindowParentPeer( xToolkit->getDesktopWindow(), uno::UNO_QUERY ); + xDialogControl->createPeer( xToolkit, xWindowParentPeer ); + uno::Reference< uno::XInterface > xWindow( xDialogControl->getPeer(), uno::UNO_QUERY ); +*/ + uno::Reference< uno::XInterface > xWindow; + return xWindow; +} + +uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithArgumentsAndContext( + const uno::Sequence< uno::Any >& Arguments, const uno::Reference< uno::XComponentContext >& Context ) +throw (uno::Exception, uno::RuntimeException) +{ + uno::Reference< uno::XInterface > xWindow; + uno::Reference< frame::XFrame > xFrame; + ::rtl::OUString aResourceURL; + + for (sal_Int32 i=0; i < Arguments.getLength(); i++ ) + { + beans::PropertyValue aPropValue; + if ( Arguments[i] >>= aPropValue ) + { + if ( aPropValue.Name.equalsAscii( "Frame" )) + aPropValue.Value >>= xFrame; + else if ( aPropValue.Name.equalsAscii( "ResourceURL" )) + aPropValue.Value >>= aResourceURL; + } + } + + uno::Reference< frame::XModuleManager > xModuleManager; + // SAFE + { + ResetableGuard aLock( m_aLock ); + xModuleManager = m_xModuleManager; + } + // UNSAFE + + // Determine the module identifier + ::rtl::OUString aType; + ::rtl::OUString aName; + ::rtl::OUString aModuleId; + try + { + if ( xFrame.is() && xModuleManager.is() ) + aModuleId = xModuleManager->identify( uno::Reference< uno::XInterface >( xFrame, uno::UNO_QUERY ) ); + } + catch ( frame::UnknownModuleException& ) + { + } + + RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName ); + if ( aType.getLength() > 0 && + aName.getLength() > 0 && + aModuleId.getLength() > 0 ) + { + ::rtl::OUString aImplementationName; + uno::Reference< uno::XInterface > xHolder( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY ); + + // Detetmine the implementation name of the window content factory dependent on the + // module identifier, user interface element type and name + // SAFE + ResetableGuard aLock( m_aLock ); + aImplementationName = m_pConfigAccess->getFactorySpecifierFromTypeNameModule( aType, aName, aModuleId ); + if ( aImplementationName.getLength() > 0 ) + { + aLock.unlock(); + // UNSAFE + + uno::Reference< lang::XMultiServiceFactory > xServiceManager( Context->getServiceManager(), uno::UNO_QUERY ); + if ( xServiceManager.is() ) + { + uno::Reference< lang::XSingleComponentFactory > xFactory( + xServiceManager->createInstance( aImplementationName ), uno::UNO_QUERY ); + if ( xFactory.is() ) + { + // Be careful: We call external code. Therefore here we have to catch all exceptions + try + { + xWindow = xFactory->createInstanceWithArgumentsAndContext( Arguments, Context ); + } + catch ( uno::RuntimeException& ) + { + } + catch ( uno::Exception& ) + { + } + } + } + } + } + + // UNSAFE + if ( !xWindow.is()) + { + // Fallback: Use internal factory code to create a toolkit dialog as a content window + xWindow = createInstanceWithContext(Context); + } + + return xWindow; +} + +} // namespace framework diff --git a/idl/util/makefile.mk b/idl/util/makefile.mk index eb45a00f9a15..44dfbad666f1 100644 --- a/idl/util/makefile.mk +++ b/idl/util/makefile.mk @@ -48,9 +48,12 @@ LIB1FILES = $(LB)$/prj.lib \ $(LB)$/cmptools.lib APP1TARGET= svidl +APP1RPATH=NONE APP1STDLIBS= \ $(TOOLSLIB) \ + $(VOSLIB) \ + $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) $(I18NISOLANGLIB) \ $(SALLIB) APP1LIBS= $(LB)$/$(TARGET).lib diff --git a/officecfg/prj/build.lst b/officecfg/prj/build.lst index b9aca0719882..88495a6e722b 100644 --- a/officecfg/prj/build.lst +++ b/officecfg/prj/build.lst @@ -6,6 +6,7 @@ oc officecfg\registry nmake - all oc_reg NULL oc officecfg\registry\schema\org\openoffice nmake - all oc_reg_schema_ooo NULL oc officecfg\registry\schema\org\openoffice\Office nmake - all oc_reg_schema_ooo_office NULL oc officecfg\registry\schema\org\openoffice\Office\UI nmake - all oc_reg_schema_ooo_office_ui NULL +oc officecfg\registry\schema\org\openoffice\Office\OOoImprovement nmake - all oc_reg_schema_ooo_office_oooimprovement NULL oc officecfg\registry\schema\org\openoffice\TypeDetection nmake - all oc_reg_schema_ooo_td NULL oc officecfg\registry\schema\org\openoffice\ucb nmake - all oc_reg_schema_ooo_ucb NULL oc officecfg\registry\data\org\openoffice nmake - all oc_reg_data_ooo oc_reg NULL @@ -13,4 +14,4 @@ oc officecfg\registry\data\org\openoffice\Office nmake - all oc_reg_data_ oc officecfg\registry\data\org\openoffice\Office\UI nmake - all oc_reg_data_ooo_office_ui oc_reg NULL oc officecfg\registry\data\org\openoffice\TypeDetection nmake - all oc_reg_data_ooo_td oc_reg NULL oc officecfg\registry\data\org\openoffice\ucb nmake - all oc_reg_data_ooo_ucb oc_reg NULL -oc officecfg\util nmake - all oc_util oc_reg_schema oc_reg_schema_ooo oc_reg_schema_ooo_office oc_reg_schema_ooo_office_ui oc_reg_schema_ooo_td oc_reg_schema_ooo_ucb oc_reg_data_ooo oc_reg_data_ooo_office oc_reg_data_ooo_office_ui oc_reg_data_ooo_td oc_reg_data_ooo_ucb NULL +oc officecfg\util nmake - all oc_util oc_reg_schema oc_reg_schema_ooo oc_reg_schema_ooo_office oc_reg_schema_ooo_office_ui oc_reg_schema_ooo_office_oooimprovement oc_reg_schema_ooo_td oc_reg_schema_ooo_ucb oc_reg_data_ooo oc_reg_data_ooo_office oc_reg_data_ooo_office_ui oc_reg_data_ooo_td oc_reg_data_ooo_ucb NULL diff --git a/officecfg/prj/d.lst b/officecfg/prj/d.lst index 106501f96cf2..d36f18660611 100644 --- a/officecfg/prj/d.lst +++ b/officecfg/prj/d.lst @@ -4,12 +4,14 @@ mkdir: %_DEST%\xml%_EXT%\registry\schema\org mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\UI +mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\OOoImprovement mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\ucb mkdir: %_DEST%\xml%_EXT%\registry\schema\org\openoffice\TypeDetection ..\%__SRC%\misc\registry\schema\org\openoffice\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice ..\%__SRC%\misc\registry\schema\org\openoffice\Office\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office ..\%__SRC%\misc\registry\schema\org\openoffice\Office\UI\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\UI +..\%__SRC%\misc\registry\schema\org\openoffice\Office\OOoImprovement\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\Office\OOoImprovement ..\%__SRC%\misc\registry\schema\org\openoffice\ucb\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\ucb ..\%__SRC%\misc\registry\schema\org\openoffice\TypeDetection\*.xcs %_DEST%\xml%_EXT%\registry\schema\org\openoffice\TypeDetection @@ -18,6 +20,7 @@ mkdir: %_DEST%\xml%_EXT%\registry\data\org mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\UI +mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\OOoImprovement mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\ucb mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\TypeDetection diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index 738801f20eae..5bfabf50e155 100644 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -4189,10 +4189,7 @@ </node> <node oor:name="F11_MOD1" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> - <value xml:lang="de">.uno:ActivateStyleApply</value> - <value xml:lang="en-US">.uno:StyleCatalog</value> - <value xml:lang="es">.uno:ActivateStyleApply</value> - <value xml:lang="fr">.uno:ActivateStyleApply</value> + <value xml:lang="en-US">.uno:ActivateStyleApply</value> </prop> </node> <node oor:name="F11_SHIFT" oor:op="replace"> @@ -5205,6 +5202,7 @@ </prop> </node> </node> + <node oor:name="com.sun.star.report.ReportDefinition" oor:op="replace"/> </node> </node> <node oor:name="SecondaryKeys"> diff --git a/officecfg/registry/data/org/openoffice/Office/Calc.xcu b/officecfg/registry/data/org/openoffice/Office/Calc.xcu index 17f9ac7878f5..d11781e27aec 100644 --- a/officecfg/registry/data/org/openoffice/Office/Calc.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Calc.xcu @@ -171,7 +171,40 @@ <value>SIT</value> </prop> <prop oor:name="Factor"> - <value>239.64</value> + <value>239.640</value> + </prop> + </node> + <node oor:name="CR14" oor:op="replace"> + <prop oor:name="FromUnit"> + <value>EUR</value> + </prop> + <prop oor:name="ToUnit"> + <value>MTL</value> + </prop> + <prop oor:name="Factor"> + <value>.429300</value> + </prop> + </node> + <node oor:name="CR15" oor:op="replace"> + <prop oor:name="FromUnit"> + <value>EUR</value> + </prop> + <prop oor:name="ToUnit"> + <value>CYP</value> + </prop> + <prop oor:name="Factor"> + <value>.585274</value> + </prop> + </node> + <node oor:name="CR16" oor:op="replace"> + <prop oor:name="FromUnit"> + <value>EUR</value> + </prop> + <prop oor:name="ToUnit"> + <value>SKK</value> + </prop> + <prop oor:name="Factor"> + <value>30.1260</value> </prop> </node> </node> diff --git a/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/officecfg/registry/data/org/openoffice/Office/Impress.xcu index cace4b74b25f..ccaddf1f7cae 100644 --- a/officecfg/registry/data/org/openoffice/Office/Impress.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Impress.xcu @@ -156,4 +156,9 @@ </node> </node> </node> + <node oor:name="Misc"> + <prop oor:name="TransitionFiles" install:module="ogltrans"> + <value oor:separator=";">vnd.sun.star.expand:$OOO_BASE_DIR/share/config/soffice.cfg/simpress/transitions.xml;vnd.sun.star.expand:$OOO_BASE_DIR/share/config/soffice.cfg/simpress/transitions-ogl.xml</value> + </prop> + </node> </oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu index e8f1707948ff..b3a5e358f9aa 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu @@ -1922,6 +1922,76 @@ </prop> </node> + <node oor:name="tile-flip" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Flipping tiles</value> + </prop> + </node> + <node oor:name="outside-cube" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Outside turning cube</value> + </prop> + </node> + <node oor:name="revolving-circles" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Revolving circles</value> + </prop> + </node> + <node oor:name="turning-helix" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Turning helix</value> + </prop> + </node> + <node oor:name="inside-cube" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Inside turning cube</value> + </prop> + </node> + <node oor:name="fall" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Fall</value> + </prop> + </node> + <node oor:name="turn-around" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Turn around</value> + </prop> + </node> + <node oor:name="iris" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Iris</value> + </prop> + </node> + <node oor:name="turn-down" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Turn down</value> + </prop> + </node> + <node oor:name="rochade" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Rochade</value> + </prop> + </node> + <node oor:name="venetian3dv" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Venetian Blinds 3D Vertical</value> + </prop> + </node> + <node oor:name="venetian3dh" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Venetian Blinds 3D Horizontal</value> + </prop> + </node> + <node oor:name="static" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Static</value> + </prop> + </node> + <node oor:name="finedissolve" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Fine Dissolve</value> + </prop> + </node> </node> </node> <node oor:name="Presets"> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index b5ce09bdf15c..81e36f670187 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -5177,7 +5177,7 @@ </node> <node oor:name=".uno:ObjectMenu" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Drawing ~Object</value> + <value xml:lang="en-US">~Object</value> </prop> </node> <node oor:name=".uno:EditMenu" oor:op="replace"> diff --git a/officecfg/registry/data/org/openoffice/Office/Writer.xcu b/officecfg/registry/data/org/openoffice/Office/Writer.xcu index 8427fc22d17f..d0eb8273fde3 100644 --- a/officecfg/registry/data/org/openoffice/Office/Writer.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Writer.xcu @@ -736,4 +736,9 @@ </prop> </node> </node> +<node oor:name="Notes"> + <prop oor:name="ShowAnkor"> + <value>false</value> + </prop> +</node> </oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/Office/makefile.mk b/officecfg/registry/data/org/openoffice/Office/makefile.mk index 74937432da4a..19ebc9279cce 100644 --- a/officecfg/registry/data/org/openoffice/Office/makefile.mk +++ b/officecfg/registry/data/org/openoffice/Office/makefile.mk @@ -88,6 +88,7 @@ MODULEFILES= \ Writer-defaultfontarial.xcu \ Writer-directcursor.xcu \ Writer-javamail.xcu \ + Impress-ogltrans.xcu \ Embedding-calc.xcu \ Embedding-chart.xcu \ Embedding-draw.xcu \ @@ -105,9 +106,11 @@ LOCALIZEDFILES= \ DataAccess.xcu \ TableWizard.xcu \ UI.xcu \ + Embedding.xcu \ WebWizard.xcu \ FormWizard.xcu \ Writer.xcu + .INCLUDE : target.mk diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index dff9ba8adeed..850d5205ddf9 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -506,10 +506,10 @@ </node> <node oor:name="ja" oor:op="replace"> <prop oor:name="CJK_TEXT" oor:type="xs:string" oor:op="replace"> - <value>HG 明朝L Sun;HG MinchoL Sun;HG PゴシックB Sun;ヒラギノ明朝 ProN W3;ヒラギノ明朝 Pro W3;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;HG Mincho Light J;MS P明朝;UmePlus P Gothic;TLP明朝;LX明朝;HGPMinchoL;IPA P明朝;東風明朝;Kochi Mincho;さざなみ明朝;Mincho;Serif</value> + <value>HG 明朝L Sun;HG MinchoL Sun;HG PゴシックB Sun;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;HG Mincho Light J;MS P明朝;ヒラギノ明朝 ProN W3;ヒラギノ明朝 Pro W3;UmePlus P Gothic;TLP明朝;LX明朝;HGPMinchoL;IPA P明朝;東風明朝;Kochi Mincho;さざなみ明朝;Mincho;Serif</value> </prop> <prop oor:name="CJK_HEADING" oor:type="xs:string" oor:op="replace"> - <value>HG 明朝L Sun;HG 明朝L;HG Mincho Light J;MS Pゴシック;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Gothic;MS 明朝;HG Mincho J;HG Mincho L;HG Mincho;Mincho;MS P明朝;HG Mincho Light J;MS ゴシック;HG Gothic J;HG Gothic B;HG Gothic;Gothic;MS Pゴシック;UmePlus P Gothic;Andale Sans UI</value> + <value>HG 明朝L Sun;HG 明朝L;HG Mincho Light J;MS Pゴシック;ヒラギノ角ゴ ProN W3;ヒラギノ角ゴ Pro W3;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Gothic;MS 明朝;HG Mincho J;HG Mincho L;HG Mincho;Mincho;MS P明朝;HG Mincho Light J;MS ゴシック;HG Gothic J;HG Gothic B;HG Gothic;Gothic;MS Pゴシック;UmePlus P Gothic;Andale Sans UI</value> </prop> <prop oor:name="CJK_PRESENTATION" oor:type="xs:string" oor:op="replace"> <value>HG PゴシックB Sun;HG-PGothicB Sun;HG PゴシックB;ヒラギノ明朝 ProN W3;ヒラギノ明朝 Pro W3;HG-PGothicB;HG-GothicB;HG Mincho Light J;MS Pゴシック;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;MS ゴシック;MS Pゴシック;HG Gothic;HG Gothic B;UmePlus P Gothic;Gothic;Andale Sans UI</value> @@ -518,19 +518,19 @@ <value>Andale;Arial</value> </prop> <prop oor:name="CJK_SPREADSHEET" oor:type="xs:string" oor:op="replace"> - <value>HG PゴシックB Sun;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;MS Pゴシック;TLPゴシック;LXゴシック;ヒラギノ明朝 ProN W3;ヒラギノ明朝 Pro W3;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;UmePlus P Gothic;Andale Sans UI;Kochi Gothic;HG Gothic J;HG Gothic B;HG Gothic;Gothic</value> + <value>HG PゴシックB Sun;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;MS Pゴシック;ヒラギノ角ゴ ProN W3;ヒラギノ角ゴ Pro W3;TLPゴシック;LXゴシック;ヒラギノ明朝 ProN W3;ヒラギノ明朝 Pro W3;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;UmePlus P Gothic;Andale Sans UI;Kochi Gothic;HG Gothic J;HG Gothic B;HG Gothic;Gothic</value> </prop> <prop oor:name="LATIN_SPREADSHEET" oor:type="xs:string" oor:op="replace"> - <value>HG PゴシックB Sun;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;Andale Sans UI;MS Pゴシック;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;MS Gothic;HG Gothic J;HG Gothic B;HG Gothic;Kochi Gothic;MS PGothic;UmePlus P Gothic;Gothic</value> + <value>HG PゴシックB Sun;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;Andale Sans UI;MS Pゴシック;ヒラギノ角ゴ ProN W3;ヒラギノ角ゴ Pro W3;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;MS Gothic;HG Gothic J;HG Gothic B;HG Gothic;Kochi Gothic;MS PGothic;UmePlus P Gothic;Gothic</value> </prop> <prop oor:name="UI_FIXED" oor:type="xs:string" oor:op="replace"> - <value>HG ゴシックB Sun;HG-GothicB Sun;HG Mincho Light J;MS Pゴシック;TLPゴシック;LXゴシック;ヒラギノ明朝 ProN W3;ヒラギノ明朝 Pro W3;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Kochi Gothic;UmePlus Gothic;Gothic</value> + <value>HG ゴシックB Sun;HG-GothicB Sun;HG Mincho Light J;MS Pゴシック;Osaka;ヒラギノ角ゴ ProN W3;ヒラギノ角ゴ Pro W3;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Kochi Gothic;UmePlus Gothic;Gothic</value> </prop> <prop oor:name="FIXED" oor:type="xs:string" oor:op="replace"> - <value>HG ゴシックB Sun;HG-GothicB Sun;HG ゴシックB;HG Mincho Light J;MS Pゴシック;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Kochi Gothic;UmePlus Gothic;Gothic</value> + <value>HG ゴシックB Sun;HG-GothicB Sun;HG ゴシックB;HG Mincho Light J;MS Pゴシック;ヒラギノ角ゴ ProN W3;ヒラギノ角ゴ Pro W3;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Kochi Gothic;UmePlus Gothic;Gothic</value> </prop> <prop oor:name="UI_SANS" oor:type="xs:string" oor:op="replace"> - <value>HG PゴシックB Sun;ヒラギノ明朝 ProN W3;ヒラギノ明朝 Pro W3;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;HG-GothicB;UmePlus P Gothic;Andale Sans UI;HG Mincho Light J;標準;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Kochi Gothic;Gothic;Gnu-Unifont</value> + <value>HG PゴシックB Sun;Osaka;ヒラギノ角ゴ ProN W3;ヒラギノ角ゴ Pro W3;HG-PGothicB Sun;HG PゴシックB;HG-PGothicB;HG-GothicB;UmePlus P Gothic;Andale Sans UI;HG Mincho Light J;標準;TLPゴシック;LXゴシック;HGPGothicB;IPA Pゴシック;東風ゴシック;さざなみゴシック;Kochi Gothic;Gothic;Gnu-Unifont</value> </prop> <prop oor:name="LATIN_FIXED" oor:type="xs:string" oor:op="replace"> <value>hgmincholightj;cumberlandamt;cumberland;couriernew;nimbusmonol;courier;lucidasanstypewriter;lucidatypewriter;monaco;monospaced</value> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index de0159bb9f28..5379ddaea0f5 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -1106,6 +1106,46 @@ Dymamic border coloring means that when the mouse is hovered over a control, and </info> <value>true</value> </prop> + <prop oor:name="SnapHorVerLinesToDiscrete" oor:type="xs:boolean"> + <info> + <author>AW</author> + <desc> + This switch allows to enhance visualisation of graphics which use Horizontal or Vertical Hairlines + combined with AntiAliased mode (e.g. in 2D charts). When not used, those lines will be AntiAliased + as everything else. Since this is not pleasing for the eye, this option allows to force those lines + to snap to discrete points (pixels) when activated and thus avoids AntiAliasing of pure Horizontal or + Vertical Hairlines. + </desc> + <label>Determines if Horizontal and Vertical HairLines in AntiAliased mode are snapped to discrete pixles to enhance visualisation</label> + </info> + <value>true</value> + </prop> + <prop oor:name="RenderDecoratedTextDirect" oor:type="xs:boolean"> + <info> + <author>AW</author> + <desc> + This switch determines if the decorations of decorated text portions (e.g. underline, strike through) + are rendered using VCL direct rendering or if the primitive is decomposed into simple text and the + corresponding geometrical representations of the decorations. Default is true since VCL's usage + of the diverse System's hinting possibilities for decorations is useful. + </desc> + <label>Determines if decorated texts are decomposed at render time or directly rendered using VCL</label> + </info> + <value>true</value> + </prop> + <prop oor:name="RenderSimpleTextDirect" oor:type="xs:boolean"> + <info> + <author>AW</author> + <desc> + This switch determines if simple text is directly rendered using VCL or not. If not, the simple text + is decomposed into PolyPolygons which will be painted then. Default is true, since VCL will use the + hinting for font rendering on the diverse supported systems, which gives better quality than rendering + the text as Polygons. + </desc> + <label>Determines if simple texts are decomposed at render time or directly rendered using VCL</label> + </info> + <value>true</value> + </prop> <prop oor:name="SolidDragCreate" oor:type="xs:boolean"> <info> <author>AW</author> diff --git a/officecfg/registry/schema/org/openoffice/Office/Logging.xcs b/officecfg/registry/schema/org/openoffice/Office/Logging.xcs index d303c1c988c2..5c2f2f1b4f01 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Logging.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Logging.xcs @@ -89,11 +89,10 @@ </info> <prop oor:name="EnablingAllowed" oor:type="xs:boolean"> <info> - <desc>if true and the OOoImprovement Extension is installed, userinterface events (clicks on toolbars and menus for - example) will get logged in a CSV-File. Sending these files to the - OpenOffice.org team helps optimizing the user experience.</desc> + <desc>only if this is true, usage tracking is allowed and its options will be shown + </desc> </info> - <value>true</value> + <value>false</value> </prop> <prop oor:name="LogPath" oor:type="xs:string"> <info> diff --git a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs new file mode 100755 index 000000000000..7ff91464727d --- /dev/null +++ b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Settings" oor:package="org.openoffice.Office.OOoImprovement" xml:lang="en-US"> + <info> + <desc>Contains preferences for the OpenOffice.org Improvement Program components.</desc> + </info> + <templates/> + <component> + <group oor:name="Participation"> + <info> + <desc>invitations to usage tracking etc.</desc> + </info> + <prop oor:name="OfficeStartCounterdown" oor:type="xs:int"> + <info> + <desc>the number of starts that will be skipped before the user will get invited to the + OpenOffice.org Improvement Program. If this is zero the user will get asked. + </desc> + </info> + <value>1</value> + </prop> + <prop oor:name="InvitationAccepted" oor:type="xs:boolean"> + <info> + <desc>true, if the user accepted the invitation.</desc> + </info> + <value>false</value> + </prop> + <prop oor:name="ShowedInvitation" oor:type="xs:boolean"> + <info> + <desc>true, if the user was already invited.</desc> + </info> + <value>false</value> + </prop> + <prop oor:name="DeliveredPrebundled" oor:type="xs:boolean"> + <info> + <desc>true, if the extension is prebundled - is set by an onFirstRunInitialization job. + (currently not implemented)</desc> + </info> + <value>false</value> + </prop> + <prop oor:name="HelpUrl" oor:type="xs:string"> + <info> + <desc>the url where additional infomation can be found.</desc> + </info> + <value>http://wiki.services.openoffice.org/wiki/User_Experience/OpenOffice.org_User_Feedback_Program</value> + </prop> + </group> + <group oor:name="Counters"> + <info> + <desc>counts of recorded events, uploaded reports etc.</desc> + </info> + <prop oor:name="UploadedReports" oor:type="xs:int"> + <info> + <desc>the number of reports uploaded.</desc> + </info> + <value>0</value> + </prop> + <prop oor:name="LoggedEvents" oor:type="xs:int"> + <info> + <desc>the number of events in zipped or already uploaded report.</desc> + </info> + <value>0</value> + </prop> + <prop oor:name="FailedAttempts" oor:type="xs:int"> + <info> + <desc>the number of failed upload tries.</desc> + </info> + <value>0</value> + </prop> + </group> + <group oor:name="Upload"> + <info> + <desc>settings on destination for uploading reports</desc> + </info> + <prop oor:name="SoapUrl" oor:type="xs:string"> + <info> + <desc>the url where reports get send to.</desc> + </info> + <value>http://report.services.openoffice.org:80/soap/servlet/rpcrouter</value> + </prop> + <prop oor:name="SoapIdAdditions" oor:type="xs:string"> + <info> + <desc>Additions to the SoapId for automated testing + DO NOT SET THIS VALUE UNLESS YOU KNOW WHAT YOU ARE DOING! + </desc> + </info> + <value></value> + </prop> + <prop oor:name="ReporterEmail" oor:type="xs:string"> + <info> + <desc>The Emailaddress to fill out in the reportmail.xml file. + DO NOT SET THIS VALUE UNLESS YOU KNOW WHAT YOU ARE DOING! + Its only purpose is testing and quality assureance. + </desc> + </info> + <value></value> + </prop> + </group> + </component> +</oor:component-schema> diff --git a/xmlhelp/source/cxxhelp/db/makefile.mk b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/makefile.mk index bc5bd5aaefee..1504d979b5eb 100644 --- a/xmlhelp/source/cxxhelp/db/makefile.mk +++ b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/makefile.mk @@ -6,9 +6,9 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ +# $RCSfile: $ # -# $Revision: 1.9 $ +# $Revision: $ # # This file is part of OpenOffice.org. # @@ -28,34 +28,19 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +PRJ=..$/..$/..$/..$/..$/.. -PRJ=..$/..$/.. +PRJNAME=officecfg +TARGET=schema_ooOImprovement +PACKAGE=org.openoffice.Office.OOoImprovement -PRJNAME= xmlhelp -TARGET= jadb -AUTOSEG= TRUE - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(GUI)"=="WNT" -CFLAGS+=-GR -.ENDIF -.IF "$(COM)"=="GCC" -CFLAGSCXX+=-frtti -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES=\ - $(SLO)$/Block.obj \ - $(SLO)$/BlockManager.obj \ - $(SLO)$/BtreeDict.obj +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk # --- Targets ------------------------------------------------------ -.INCLUDE : target.mk +XCSFILES= \ + Settings.xcs + +.INCLUDE : target.mk diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index 5f968ea1896b..1b21017e3f3c 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -5657,6 +5657,19 @@ </prop> </group> </group> + <group oor:name="Notes"> + <info> + <desc>Contains settings for notes</desc> + </info> + <prop oor:name="ShowAnkor" oor:type="xs:boolean"> + <info> + <author>mod</author> + <desc>configures if note anchor should be shown or hidden when display is off</desc> + <label>Notes Ankor on/off</label> + </info> + <value>false</value> + </prop> + </group> <group oor:name="Navigator"> <info> <desc>Contains settings for the Navigator.</desc> diff --git a/officecfg/registry/schema/org/openoffice/Office/makefile.mk b/officecfg/registry/schema/org/openoffice/Office/makefile.mk index 4d21f778ec1f..320ec8eed2ce 100644 --- a/officecfg/registry/schema/org/openoffice/Office/makefile.mk +++ b/officecfg/registry/schema/org/openoffice/Office/makefile.mk @@ -78,8 +78,9 @@ XCSFILES= \ ExtendedColorScheme.xcs \ TypeDetection.xcs \ TabBrowse.xcs \ - Paths.xcs \ - Histories.xcs + Paths.xcs \ + Histories.xcs \ + OOoImprovement.xcs .INCLUDE : target.mk diff --git a/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs b/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs new file mode 100644 index 000000000000..6cf0a994c808 --- /dev/null +++ b/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--*********************************************************************** + * + * 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: Configuration.xcs,v $ + * $Revision: 1.19 $ + * + * 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. + * + ************************************************************************ --> +<!DOCTYPE oor:component-schema SYSTEM "../../../../component-schema.dtd"> +<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="InteractionHandler" oor:package="org.openoffice.ucb" xml:lang="en-US"> <info> + <author>TKR</author> + <desc >Contains components and templates used for InteractionHandler configuration related data. </desc> + </info> + <templates> + <group oor:name="InteractionHandlerData"> + <info> + <desc>Contains the Service name of the custom InteractionHandler. The listed InteractionHandlers will be called after the "build-in" InteractionHandler sequently.</desc> + </info> + <prop oor:name="ServiceName" oor:type="xs:string"> + <info> + <desc>Specifies the name of the UNO service to be used to instantiate the InteractionHandler. The type should be com.sun.star.task.XInteractionHandler.</desc> + </info> + </prop> + </group> + </templates> + <component> + <set oor:name="InteractionHandlers" oor:node-type="InteractionHandlerData"> + <info> + <desc>Contains a root entry for InteractionHandler configurations.</desc> + </info> + </set> + </component> +</oor:component-schema> + + + + + + + + + + + + diff --git a/officecfg/registry/schema/org/openoffice/ucb/makefile.mk b/officecfg/registry/schema/org/openoffice/ucb/makefile.mk index df7b0055297e..269bdded299b 100644 --- a/officecfg/registry/schema/org/openoffice/ucb/makefile.mk +++ b/officecfg/registry/schema/org/openoffice/ucb/makefile.mk @@ -42,6 +42,7 @@ PACKAGE=org.openoffice.ucb XCSFILES= \ Configuration.xcs \ Hierarchy.xcs \ + InteractionHandler.xcs \ Store.xcs .INCLUDE : target.mk diff --git a/officecfg/util/alllang.xsl b/officecfg/util/alllang.xsl index a2cc1a025b48..53f488066e2e 100644 --- a/officecfg/util/alllang.xsl +++ b/officecfg/util/alllang.xsl @@ -38,7 +38,7 @@ exclude-result-prefixes="install"> <!-- Get the correct format --> -<xsl:output method="xml" indent="yes" /> +<xsl:output method="xml" indent="yes" encoding="UTF-8"/> <!--************************** PARAMETER ******************************** --> <xsl:param name="locale"/> diff --git a/officecfg/util/makefile.mk b/officecfg/util/makefile.mk index 36df0df36ad0..d022c9253798 100644 --- a/officecfg/util/makefile.mk +++ b/officecfg/util/makefile.mk @@ -45,6 +45,9 @@ $(MISC)$/$(TARGET)_delzip : $(BIN)$/registry_{$(alllangiso)}.zip : $(MISC)$/$(TARGET)_delzip cd $(MISC)$/registry$/res$/$(@:b:s/registry_//) && zip -ru ..$/..$/..$/..$/bin$/registry_$(@:b:s/registry_//).zip org/* +.IF "$(USE_SHELL)"!="4nt" + $(PERL) -w $(SOLARENV)$/bin$/cleanzip.pl $@ +.ENDIF # "$(USE_SHELL)"!="4nt" ALLTAR: \ $(MISC)$/$(TARGET)_delzip \ diff --git a/oovbaapi/genconstidl/api-to-idl.pl b/oovbaapi/genconstidl/api-to-idl.pl index a310d1450bf4..fb060d2b4ced 100644 --- a/oovbaapi/genconstidl/api-to-idl.pl +++ b/oovbaapi/genconstidl/api-to-idl.pl @@ -131,12 +131,23 @@ sub generate_idls($) { my $fname = $path . "/" . $type . ".idl"; open( IDL, ">$fname" ) || die "Cannot write $fname."; - print IDL "module org { module openoffice { module $module {\n"; + if( $module eq "vba" ) { + print IDL "module ooo { module $module {\n"; + } + else { + print IDL "module ooo { module vba { module $module {\n"; + } + print IDL " constants $type {\n"; foreach $constant ( @{$result{$module}{$type}} ) { print IDL " const long $constant->{'name'} = $constant->{'value'};\n"; } - print IDL " };\n}; }; };\n"; + if( $module eq "vba" ) { + print IDL " };\n}; };\n"; + } + else { + print IDL " };\n}; }; };\n"; + } close( IDL ); } diff --git a/oovbaapi/org/openoffice/vba/Globals.idl b/oovbaapi/ooo/vba/Globals.idl index 8a13f0a7b3d0..e2ed5e3749da 100644 --- a/oovbaapi/org/openoffice/vba/Globals.idl +++ b/oovbaapi/ooo/vba/Globals.idl @@ -28,21 +28,21 @@ * ************************************************************************/ -#ifndef __org_openoffice_vba_Globals_idl__ -#define __org_openoffice_vba_Globals_idl__ +#ifndef __ooo_vba_Globals_idl__ +#define __ooo_vba_Globals_idl__ -#ifndef __org_openoffice_vba_XGlobals_idl__ -#include <org/openoffice/vba/XGlobals.idl> +#ifndef __ooo_vba_XGlobals_idl__ +#include <ooo/vba/XGlobals.idl> #endif #include <com/sun/star/uno/XComponentContext.idl> #include <com/sun/star/table/XCellRange.idl> -module org { module openoffice { module vba { +module ooo { module vba { service Globals : XGlobals { }; -}; }; }; +}; }; #endif diff --git a/oovbaapi/ooo/vba/XAssistant.idl b/oovbaapi/ooo/vba/XAssistant.idl new file mode 100644 index 000000000000..ad8839b39dd8 --- /dev/null +++ b/oovbaapi/ooo/vba/XAssistant.idl @@ -0,0 +1,65 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XAssistant_idl__ +#define __ooo_vba_XAssistant_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { +//============================================================================= + +interface XAssistant +{ + interface ::ooo::vba::XHelperInterface; + + [attribute] boolean On; + [attribute] boolean Visible; + [attribute] long Top; + [attribute] long Left; + [attribute] long Animation; + + string Name() raises ( com::sun::star::script::BasicErrorException ); +}; + +}; }; + +#endif diff --git a/oovbaapi/org/openoffice/vba/XCollection.idl b/oovbaapi/ooo/vba/XCollection.idl index 65cec8d570a8..10d440957d34 100644 --- a/oovbaapi/org/openoffice/vba/XCollection.idl +++ b/oovbaapi/ooo/vba/XCollection.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_vba_XCollection_idl__ -#define __org_openoffice_vba_XCollection_idl__ +#ifndef __ooo_vba_XCollection_idl__ +#define __ooo_vba_XCollection_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> @@ -40,17 +40,17 @@ #include <com/sun/star/container/XEnumerationAccess.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module vba { +module ooo { module vba { //============================================================================= interface XCollection { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; interface ::com::sun::star::script::XDefaultMethod; interface ::com::sun::star::container::XEnumerationAccess; @@ -58,6 +58,6 @@ interface XCollection any Item( [in] any Index1, [in] any Index2 ); }; -}; }; }; +}; }; #endif diff --git a/oovbaapi/ooo/vba/XCommandBar.idl b/oovbaapi/ooo/vba/XCommandBar.idl new file mode 100644 index 000000000000..7bf5c9dcf675 --- /dev/null +++ b/oovbaapi/ooo/vba/XCommandBar.idl @@ -0,0 +1,64 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XCommandBar_idl__ +#define __ooo_vba_XCommandBar_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { +//============================================================================= +interface XCommandBarControls; + +interface XCommandBar +{ + interface XHelperInterface; + + [attribute] string Name; + [attribute] boolean Visible; + + void Delete() raises ( com::sun::star::script::BasicErrorException ); + any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException ); +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XCommandBarControl.idl b/oovbaapi/ooo/vba/XCommandBarControl.idl new file mode 100644 index 000000000000..44ec75e01729 --- /dev/null +++ b/oovbaapi/ooo/vba/XCommandBarControl.idl @@ -0,0 +1,64 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XCommandBarControl_idl__ +#define __ooo_vba_XCommandBarControl_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { +//============================================================================= + +interface XCommandBarControl +{ + interface XHelperInterface; + + [attribute] string Caption; + [attribute] string OnAction; + [attribute] boolean Visible; + + void Delete() raises ( com::sun::star::script::BasicErrorException ); + any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException ); +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XCommandBarControls.idl b/oovbaapi/ooo/vba/XCommandBarControls.idl new file mode 100644 index 000000000000..9b783edd3a24 --- /dev/null +++ b/oovbaapi/ooo/vba/XCommandBarControls.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XCommandBarControls_idl__ +#define __ooo_vba_XCommandBarControls_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> +#endif + +//============================================================================= + +module ooo { module vba { +//============================================================================= +interface XCommandBarControl; + +interface XCommandBarControls +{ + interface XCollection; + + XCommandBarControl Add( [in] any Type, [in] any Id, [in] any Parameter, [in] any Before, [in] any Temporary ) raises ( com::sun::star::script::BasicErrorException ); +}; + +}; }; + +#endif diff --git a/oovbaapi/ooo/vba/XCommandBars.idl b/oovbaapi/ooo/vba/XCommandBars.idl new file mode 100644 index 000000000000..f9fe9b41c0b7 --- /dev/null +++ b/oovbaapi/ooo/vba/XCommandBars.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_XCommandBars_idl__ +#define __ooo_vba_XCommandBars_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> +#endif + +//============================================================================= + +module ooo { module vba { +//============================================================================= +interface XCommandBar; + +interface XCommandBars +{ + interface XCollection; + + XCommandBar Add( [in] any Name, [in] any Position, [in] any MenuBar, [in] any Temporary ) raises ( com::sun::star::script::BasicErrorException ); +}; + +}; }; + +#endif diff --git a/oovbaapi/org/openoffice/vba/XErrObject.idl b/oovbaapi/ooo/vba/XErrObject.idl index e74f51ece4b1..5e1678704367 100644 --- a/oovbaapi/org/openoffice/vba/XErrObject.idl +++ b/oovbaapi/ooo/vba/XErrObject.idl @@ -28,14 +28,14 @@ * ************************************************************************/ -#ifndef __org_openoffice_vba__XErrObject_idl__ -#define __org_openoffice_vba__XErrObject_idl__ +#ifndef __ooo_vba__XErrObject_idl__ +#define __ooo_vba__XErrObject_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -module org { module openoffice { module vba { +module ooo { module vba { //============================================================================== /** */ @@ -54,5 +54,5 @@ interface XErrObject : ::com::sun::star::uno::XInterface }; -}; }; }; +}; }; #endif diff --git a/oovbaapi/org/openoffice/vba/XGlobals.idl b/oovbaapi/ooo/vba/XGlobals.idl index ae0af62ad4cb..75d84f6cf89d 100644 --- a/oovbaapi/org/openoffice/vba/XGlobals.idl +++ b/oovbaapi/ooo/vba/XGlobals.idl @@ -27,40 +27,40 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_vba_XGlobals_idl__ -#define __org_openoffice_vba_XGlobals_idl__ +#ifndef __ooo_vba_XGlobals_idl__ +#define __ooo_vba_XGlobals_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_excel_XApplication_idl__ -#include <org/openoffice/excel/XApplication.idl> +#ifndef __ooo_vba_excel_XApplication_idl__ +#include <ooo/vba/excel/XApplication.idl> #endif -#ifndef __org_openoffice_excel_XWorkbook_idl__ -#include <org/openoffice/excel/XWorkbook.idl> +#ifndef __ooo_vba_excel_XWorkbook_idl__ +#include <ooo/vba/excel/XWorkbook.idl> #endif -#ifndef __org_openoffice_excel_XWorksheet_idl__ -#include <org/openoffice/excel/XWorksheet.idl> +#ifndef __ooo_vba_excel_XWorksheet_idl__ +#include <ooo/vba/excel/XWorksheet.idl> #endif -module org { module openoffice { module vba { +module ooo { module vba { interface XGlobals: com::sun::star::uno::XInterface { // FIXME, need better way to expose globals sequence< any > getGlobals(); - [attribute, readonly] org::openoffice::excel::XApplication Application; - [attribute, readonly] org::openoffice::excel::XWorkbook ActiveWorkbook; - [attribute, readonly] org::openoffice::excel::XWorksheet ActiveSheet; + [attribute, readonly] ooo::vba::excel::XApplication Application; + [attribute, readonly] ooo::vba::excel::XWorkbook ActiveWorkbook; + [attribute, readonly] ooo::vba::excel::XWorksheet ActiveSheet; any WorkSheets( [in] any aIndex ); any WorkBooks( [in] any aIndex ); any Sheets( [in] any aIndex ); any Range( [in] any Cell1, [in] any Cell2 ); - any Names( ); + any Names( [in] any Index ); }; -}; }; }; +}; }; #endif diff --git a/oovbaapi/org/openoffice/vba/XHelperInterface.idl b/oovbaapi/ooo/vba/XHelperInterface.idl index d7e203cda90e..41021f54b035 100644 --- a/oovbaapi/org/openoffice/vba/XHelperInterface.idl +++ b/oovbaapi/ooo/vba/XHelperInterface.idl @@ -28,8 +28,8 @@ * ************************************************************************/ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#define __org_openoffice_vba_XHelperInterface_idl__ +#ifndef __ooo_vba_XHelperInterface_idl__ +#define __ooo_vba_XHelperInterface_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif @@ -45,7 +45,7 @@ #include <com/sun/star/lang/XServiceInfo.idl> #endif -module org { module openoffice { module vba { +module ooo { module vba { interface XHelperInterface { @@ -65,7 +65,7 @@ interface XHelperInterface }; -}; }; }; +}; }; #endif diff --git a/oovbaapi/org/openoffice/vba/XPropValue.idl b/oovbaapi/ooo/vba/XPropValue.idl index 47e1b724956b..9f2303b5baed 100644 --- a/oovbaapi/org/openoffice/vba/XPropValue.idl +++ b/oovbaapi/ooo/vba/XPropValue.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_vba_XPropValue_idl__ -#define __org_openoffice_vba_XPropValue_idl__ +#ifndef __ooo_vba_XPropValue_idl__ +#define __ooo_vba_XPropValue_idl__ #ifndef __com_sun_star_script_XDefaultProperty_idl__ #include <com/sun/star/script/XDefaultProperty.idl> @@ -37,7 +37,7 @@ //============================================================================= -module org { module openoffice { module vba { +module ooo { module vba { //============================================================================= @@ -48,7 +48,7 @@ interface XPropValue: com::sun::star::script::XDefaultProperty //============================================================================= -}; }; }; +}; }; #endif diff --git a/oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl b/oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl index 8e5a830d7cc5..e567f5e56d03 100644 --- a/oovbaapi/org/openoffice/vba/XVBAToOOEventDescGen.idl +++ b/oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_vba_XVBAToOOEventDescGen_idl__ -#define __org_openoffice_vba_XVBAToOOEventDescGen_idl__ +#ifndef __ooo_vba_XVBAToOOEventDescGen_idl__ +#define __ooo_vba_XVBAToOOEventDescGen_idl__ #ifndef __com_sun_star_script_ScriptEventDescriptor_idl__ #include <com/sun/star/script/ScriptEventDescriptor.idl> @@ -38,12 +38,12 @@ #include <com/sun/star/script/XScriptEventsSupplier.idl> #endif -module org { module openoffice { module vba { +module ooo { module vba { interface XVBAToOOEventDescGen : com::sun::star::uno::XInterface { sequence< com::sun::star::script::ScriptEventDescriptor > getEventDescriptions( [in] com::sun::star::uno::XInterface xControl, [in] string sLibModName, [in] sequence< string > handlerExts ); com::sun::star::script::XScriptEventsSupplier getEventSupplier( [in] com::sun::star::uno::XInterface xControl ); }; -}; }; }; +}; }; #endif diff --git a/oovbaapi/org/openoffice/constants/makefile.mk b/oovbaapi/ooo/vba/constants/makefile.mk index b086c0385cb2..9fb0e9144d28 100644 --- a/oovbaapi/org/openoffice/constants/makefile.mk +++ b/oovbaapi/ooo/vba/constants/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/..$/.. PRJNAME=oovbapi TARGET=constants -PACKAGE=org$/openoffice$/constants +PACKAGE=org$/vba$/constants # --- Settings ----------------------------------------------------- .INCLUDE : $(PRJ)$/util$/makefile.pmk diff --git a/oovbaapi/ooo/vba/excel/Hyperlink.idl b/oovbaapi/ooo/vba/excel/Hyperlink.idl new file mode 100644 index 000000000000..7f2058a6c3b0 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/Hyperlink.idl @@ -0,0 +1,54 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __ooo_vba_excel_Hyperlink_idl__ +#define __ooo_vba_excel_Hyperlink_idl__ + +#ifndef __ooo_vba_excel_XHyperlink_idl__ +#include <ooo/vba/excel/XHyperlink.idl> +#endif + +#include <com/sun/star/uno/XComponentContext.idl> +#include <com/sun/star/frame/XModel.idl> + +module ooo { module vba { module excel { +service Hyperlink : XHyperlink +{ + createHyperlink( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel ); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/org/openoffice/excel/Range.idl b/oovbaapi/ooo/vba/excel/Range.idl index 2c78e11373d1..6efcdfe27e51 100644 --- a/oovbaapi/org/openoffice/excel/Range.idl +++ b/oovbaapi/ooo/vba/excel/Range.idl @@ -28,20 +28,20 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_Range_idl__ -#define __org_openoffice_excel_Range_idl__ +#ifndef __ooo_vba_excel_Range_idl__ +#define __ooo_vba_excel_Range_idl__ -#ifndef __org_openoffice_excel_XRange_idl__ -#include <org/openoffice/excel/XRange.idl> +#ifndef __ooo_vba_excel_XRange_idl__ +#include <ooo/vba/excel/XRange.idl> #endif #include <com/sun/star/uno/XComponentContext.idl> #include <com/sun/star/table/XCellRange.idl> -module org { module openoffice { module excel { +module ooo { module vba { module excel { service Range : XRange { - createRangeFromXCellRange( [in] ::org::openoffice::vba::XHelperInterface Parent, [in] ::com::sun::star::table::XCellRange Range ); + createRangeFromXCellRange( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::table::XCellRange Range ); }; }; }; }; diff --git a/oovbaapi/ooo/vba/excel/Window.idl b/oovbaapi/ooo/vba/excel/Window.idl new file mode 100644 index 000000000000..ac907156fa18 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/Window.idl @@ -0,0 +1,54 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef __ooo_vba_excel_Window_idl__ +#define __ooo_vba_excel_Window_idl__ + +#ifndef __ooo_vba_excel_XWindow_idl__ +#include <ooo/vba/excel/XWindow.idl> +#endif + +#include <com/sun/star/uno/XComponentContext.idl> +#include <com/sun/star/frame/XModel.idl> + +module ooo { module vba { module excel { +service Window : XWindow +{ + createWindow( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel ); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/org/openoffice/excel/Workbook.idl b/oovbaapi/ooo/vba/excel/Workbook.idl index b45b2e7d7751..9b98d50386ed 100644 --- a/oovbaapi/org/openoffice/excel/Workbook.idl +++ b/oovbaapi/ooo/vba/excel/Workbook.idl @@ -28,20 +28,20 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_Workbook_idl__ -#define __org_openoffice_excel_Workbook_idl__ +#ifndef __ooo_vba_excel_Workbook_idl__ +#define __ooo_vba_excel_Workbook_idl__ -#ifndef __org_openoffice_excel_XWorkbook_idl__ -#include <org/openoffice/excel/XWorkbook.idl> +#ifndef __ooo_vba_excel_XWorkbook_idl__ +#include <ooo/vba/excel/XWorkbook.idl> #endif #include <com/sun/star/uno/XComponentContext.idl> #include <com/sun/star/frame/XModel.idl> -module org { module openoffice { module excel { +module ooo { module vba { module excel { service Workbook : XWorkbook { - createWorkbook( [in] ::org::openoffice::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel ); + createWorkbook( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel ); }; }; }; }; diff --git a/oovbaapi/org/openoffice/excel/Worksheet.idl b/oovbaapi/ooo/vba/excel/Worksheet.idl index 9b5cc8b52857..002156731f9b 100644 --- a/oovbaapi/org/openoffice/excel/Worksheet.idl +++ b/oovbaapi/ooo/vba/excel/Worksheet.idl @@ -28,11 +28,11 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_Worksheet_idl__ -#define __org_openoffice_excel_Worksheet_idl__ +#ifndef __ooo_vba_excel_Worksheet_idl__ +#define __ooo_vba_excel_Worksheet_idl__ -#ifndef __org_openoffice_excel_XWorksheet_idl__ -#include <org/openoffice/excel/XWorksheet.idl> +#ifndef __ooo_vba_excel_XWorksheet_idl__ +#include <ooo/vba/excel/XWorksheet.idl> #endif #ifndef __com_sun_star_sheet_XComponentContext_idl__ @@ -42,10 +42,10 @@ #include <com/sun/star/frame/XModel.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { service Worksheet : XWorksheet { - createWorksheet( [in] ::org::openoffice::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel, [in] string SheetName ); + createWorksheet( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel, [in] string SheetName ); }; }; }; }; diff --git a/oovbaapi/org/openoffice/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl index 43d2bbf0dc07..47628b18a7f1 100644 --- a/oovbaapi/org/openoffice/excel/XApplication.idl +++ b/oovbaapi/ooo/vba/excel/XApplication.idl @@ -27,18 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XApplication_idl__ -#define __org_openoffice_excel_XApplication_idl__ +#ifndef __ooo_vba_excel_XApplication_idl__ +#define __ooo_vba_excel_XApplication_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -module org { module openoffice { module excel { +#ifndef __ooo_vba_XAssistant_idl__ +#include <ooo/vba/XAssistant.idl> +#endif + +#ifndef __ooo_vba_XCommandBars_idl__ +#include <ooo/vba/XCommandBars.idl> +#endif + +module ooo { module vba { module excel { interface XRange; interface XWorkbook; @@ -51,13 +59,14 @@ interface XWorksheet; interface XApplication { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute, readonly] any Selection; [attribute, readonly] XWorkbook ActiveWorkbook; [attribute, readonly] XRange ActiveCell; [attribute, readonly] XWindow ActiveWindow; [attribute, readonly] XWorksheet ActiveSheet; + [attribute, readonly] ooo::vba::XAssistant Assistant; [attribute] long Calculation; //#TODO #FIXME this is more of a placeholder, will return // the value of activeworkbook, in xl 'ThisWorkbook' should return the @@ -81,6 +90,7 @@ interface XApplication string LibraryPath() raises(com::sun::star::script::BasicErrorException); string TemplatesPath() raises(com::sun::star::script::BasicErrorException); string PathSeparator() raises(com::sun::star::script::BasicErrorException); + any CommandBars( [in] any aIndex ); any Workbooks( [in] any aIndex ); any Worksheets( [in] any aIndex ); any Windows( [in] any aIndex ); @@ -88,7 +98,7 @@ interface XApplication any Evaluate( [in] string Name ); any Dialogs( [in] any DialogIndex ); any Range( [in] any Cell1, [in] any Cell2 ); - any Names(); + any Names( [in] any Index ); void GoTo( [in] any Reference, [in] any Scroll ); // #FIXME #TODO up to 30 args needed double CountA( [in] any arg1 ); @@ -96,6 +106,8 @@ interface XApplication void Calculate() raises(com::sun::star::script::BasicErrorException); XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30) raises(com::sun::star::script::BasicErrorException); + XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30) + raises(com::sun::star::script::BasicErrorException); void Volatile([in] any Volatile); void DoEvents(); }; diff --git a/oovbaapi/org/openoffice/excel/XAxes.idl b/oovbaapi/ooo/vba/excel/XAxes.idl index 6e948ff59ae5..ba8e298d29bc 100644 --- a/oovbaapi/org/openoffice/excel/XAxes.idl +++ b/oovbaapi/ooo/vba/excel/XAxes.idl @@ -28,29 +28,29 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XAxes_idl__ -#define __org_openoffice_excel_XAxes_idl__ +#ifndef __ooo_vba_excel_XAxes_idl__ +#define __ooo_vba_excel_XAxes_idl__ -#ifndef __org_openoffice_excel_XAxis_idl__ -#include <org/openoffice/excel/XAxis.idl> +#ifndef __ooo_vba_excel_XAxis_idl__ +#include <ooo/vba/excel/XAxis.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XAxes { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; }; }; }; }; diff --git a/oovbaapi/org/openoffice/excel/XAxis.idl b/oovbaapi/ooo/vba/excel/XAxis.idl index 860318fbccd4..6f6d17436835 100644 --- a/oovbaapi/org/openoffice/excel/XAxis.idl +++ b/oovbaapi/ooo/vba/excel/XAxis.idl @@ -28,22 +28,22 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XAxis_idl__ -#define __org_openoffice_excel_XAxis_idl__ +#ifndef __ooo_vba_excel_XAxis_idl__ +#define __ooo_vba_excel_XAxis_idl__ #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XAxisTitle; interface XAxis { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; void Delete() raises(com::sun::star::script::BasicErrorException); diff --git a/oovbaapi/org/openoffice/excel/XAxisTitle.idl b/oovbaapi/ooo/vba/excel/XAxisTitle.idl index e85d570b4760..72b7e37d17b3 100644 --- a/oovbaapi/org/openoffice/excel/XAxisTitle.idl +++ b/oovbaapi/ooo/vba/excel/XAxisTitle.idl @@ -28,22 +28,22 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XAxisTitle_idl__ -#define __org_openoffice_excel_XAxisTitle_idl__ +#ifndef __ooo_vba_excel_XAxisTitle_idl__ +#define __ooo_vba_excel_XAxisTitle_idl__ -#ifndef __org_openoffice_excel_XTitle_idl__ -#include <org/openoffice/excel/XTitle.idl> +#ifndef __ooo_vba_excel_XTitle_idl__ +#include <ooo/vba/excel/XTitle.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XAxisTitle { - interface ::org::openoffice::excel::XTitle; + interface ::ooo::vba::excel::XTitle; }; }; }; }; diff --git a/oovbaapi/org/openoffice/excel/XBorder.idl b/oovbaapi/ooo/vba/excel/XBorder.idl index 4923956c978d..8eab2ad4b123 100644 --- a/oovbaapi/org/openoffice/excel/XBorder.idl +++ b/oovbaapi/ooo/vba/excel/XBorder.idl @@ -27,25 +27,25 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XBorder_idl__ -#define __org_openoffice_excel_XBorder_idl__ +#ifndef __ooo_vba_excel_XBorder_idl__ +#define __ooo_vba_excel_XBorder_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XBorder { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] any Color; [attribute] any ColorIndex; diff --git a/oovbaapi/org/openoffice/excel/XBorders.idl b/oovbaapi/ooo/vba/excel/XBorders.idl index f44077e4dee2..2b960f2a5718 100644 --- a/oovbaapi/org/openoffice/excel/XBorders.idl +++ b/oovbaapi/ooo/vba/excel/XBorders.idl @@ -27,30 +27,30 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XBorders_idl__ -#define __org_openoffice_excel_XBorders_idl__ +#ifndef __ooo_vba_excel_XBorders_idl__ +#define __ooo_vba_excel_XBorders_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_excel_XBorder_idl__ -#include <org/openoffice/excel/XBorder.idl> +#ifndef __ooo_vba_excel_XBorder_idl__ +#include <ooo/vba/excel/XBorder.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XBorders { - interface org::openoffice::excel::XBorder; - interface org::openoffice::vba::XCollection; + interface ooo::vba::excel::XBorder; + interface ooo::vba::XCollection; }; //============================================================================= diff --git a/oovbaapi/org/openoffice/excel/XCharacters.idl b/oovbaapi/ooo/vba/excel/XCharacters.idl index 4a29406c6bf1..6438b63f014f 100644 --- a/oovbaapi/org/openoffice/excel/XCharacters.idl +++ b/oovbaapi/ooo/vba/excel/XCharacters.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XCharacters_idl__ -#define __org_openoffice_excel_XCharacters_idl__ +#ifndef __ooo_vba_excel_XCharacters_idl__ +#define __ooo_vba_excel_XCharacters_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_excel_XFont_idl__ -#include <org/openoffice/excel/XFont.idl> +#ifndef __ooo_vba_excel_XFont_idl__ +#include <ooo/vba/excel/XFont.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XCharacters { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] string Caption; [attribute, readonly ] long Count; diff --git a/oovbaapi/org/openoffice/excel/XChart.idl b/oovbaapi/ooo/vba/excel/XChart.idl index 4256552a05f3..cce19a4c84aa 100644 --- a/oovbaapi/org/openoffice/excel/XChart.idl +++ b/oovbaapi/ooo/vba/excel/XChart.idl @@ -27,14 +27,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XChart_idl__ -#define __org_openoffice_excel_XChart_idl__ +#ifndef __ooo_vba_excel_XChart_idl__ +#define __ooo_vba_excel_XChart_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ @@ -42,14 +42,14 @@ #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XRange; interface XChartTitle; interface XChart { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute, readonly] string Name; any SeriesCollection( [in] any Item ); diff --git a/oovbaapi/org/openoffice/excel/XChartObject.idl b/oovbaapi/ooo/vba/excel/XChartObject.idl index 1e523f402f08..1ac793a9caf0 100644 --- a/oovbaapi/org/openoffice/excel/XChartObject.idl +++ b/oovbaapi/ooo/vba/excel/XChartObject.idl @@ -27,27 +27,27 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XChartObject_idl__ -#define __org_openoffice_excel_XChartObject_idl__ +#ifndef __ooo_vba_excel_XChartObject_idl__ +#define __ooo_vba_excel_XChartObject_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XChart; interface XChartObject { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute, readonly] XChart Chart; [attribute] string Name; diff --git a/oovbaapi/org/openoffice/excel/XChartObjects.idl b/oovbaapi/ooo/vba/excel/XChartObjects.idl index b7af5ab11ce9..048ad64ccd3b 100644 --- a/oovbaapi/org/openoffice/excel/XChartObjects.idl +++ b/oovbaapi/ooo/vba/excel/XChartObjects.idl @@ -27,15 +27,15 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XChartObjects_idl__ -#define __org_openoffice_excel_XChartObjects_idl__ +#ifndef __ooo_vba_excel_XChartObjects_idl__ +#define __ooo_vba_excel_XChartObjects_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ @@ -44,12 +44,12 @@ //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XChartObjects { - interface org::openoffice::vba::XCollection; + interface ooo::vba::XCollection; any Add( [in] double Left, [in] double Top, [in] double Width, [in] double Height ) raises(com::sun::star::script::BasicErrorException); void Delete() raises (com::sun::star::script::BasicErrorException); }; diff --git a/oovbaapi/org/openoffice/excel/XChartTitle.idl b/oovbaapi/ooo/vba/excel/XChartTitle.idl index bdb1d61fcd39..d887b6449662 100644 --- a/oovbaapi/org/openoffice/excel/XChartTitle.idl +++ b/oovbaapi/ooo/vba/excel/XChartTitle.idl @@ -28,18 +28,18 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XChartTitle_idl__ -#define __org_openoffice_excel_XChartTitle_idl__ +#ifndef __ooo_vba_excel_XChartTitle_idl__ +#define __ooo_vba_excel_XChartTitle_idl__ -#ifndef ___org_openoffice_excel_XTitle_idl__ -#include <org/openoffice/excel/XTitle.idl> +#ifndef __ooo_vba_excel_XTitle_idl__ +#include <ooo/vba/excel/XTitle.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XTitle; interface XChartTitle diff --git a/oovbaapi/org/openoffice/excel/XCharts.idl b/oovbaapi/ooo/vba/excel/XCharts.idl index f0d1f2a445fe..553fd5fb3ef8 100644 --- a/oovbaapi/org/openoffice/excel/XCharts.idl +++ b/oovbaapi/ooo/vba/excel/XCharts.idl @@ -27,15 +27,15 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XChart_idl__ -#define __org_openoffice_excel_XChart_idl__ +#ifndef __ooo_vba_excel_XChart_idl__ +#define __ooo_vba_excel_XChart_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ @@ -44,12 +44,12 @@ //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XChart; //============================================================================= interface XCharts { - interface org::openoffice::vba::XCollection; + interface ooo::vba::XCollection; any Add() raises(com::sun::star::script::BasicErrorException); XChart getActiveChart() raises (com::sun::star::script::BasicErrorException); }; diff --git a/oovbaapi/org/openoffice/excel/XComment.idl b/oovbaapi/ooo/vba/excel/XComment.idl index d949782fe86d..9a1869ae09a8 100644 --- a/oovbaapi/org/openoffice/excel/XComment.idl +++ b/oovbaapi/ooo/vba/excel/XComment.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XComment_idl__ -#define __org_openoffice_excel_XComment_idl__ +#ifndef __ooo_vba_excel_XComment_idl__ +#define __ooo_vba_excel_XComment_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> @@ -36,19 +36,19 @@ #ifndef __com_sun_star_lang_IllegalArgumentException_idl__ #include <com/sun/star/lang/IllegalArgumentException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XApplication; interface XRange; interface XComment { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] string Author; // [attribute, readonly] Shape Shape; diff --git a/oovbaapi/org/openoffice/excel/XComments.idl b/oovbaapi/ooo/vba/excel/XComments.idl index 5eccde13e3c2..398138d4ceb1 100644 --- a/oovbaapi/org/openoffice/excel/XComments.idl +++ b/oovbaapi/ooo/vba/excel/XComments.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XComments_idl__ -#define __org_openoffice_excel_XComments_idl__ +#ifndef __ooo_vba_excel_XComments_idl__ +#define __ooo_vba_excel_XComments_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> @@ -36,17 +36,17 @@ #ifndef __com_sun_star_lang_IllegalArgumentException_idl__ #include <com/sun/star/lang/IllegalArgumentException.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XComments { - interface org::openoffice::vba::XCollection; + interface ooo::vba::XCollection; }; //============================================================================= diff --git a/oovbaapi/org/openoffice/excel/XDataLabel.idl b/oovbaapi/ooo/vba/excel/XDataLabel.idl index 0505b38be6c9..a25764dc5e45 100644 --- a/oovbaapi/org/openoffice/excel/XDataLabel.idl +++ b/oovbaapi/ooo/vba/excel/XDataLabel.idl @@ -27,14 +27,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XDataLabel_idl__ -#define __org_openoffice_excel_XDataLabel_idl__ +#ifndef __ooo_vba_excel_XDataLabel_idl__ +#define __ooo_vba_excel_XDataLabel_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ @@ -42,12 +42,12 @@ #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XDataLabel { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; string Text() raises(com::sun::star::script::BasicErrorException); string Name() raises (com::sun::star::script::BasicErrorException); diff --git a/oovbaapi/org/openoffice/excel/XDataLabels.idl b/oovbaapi/ooo/vba/excel/XDataLabels.idl index bd47dcb08ae7..8b61376ac51c 100644 --- a/oovbaapi/org/openoffice/excel/XDataLabels.idl +++ b/oovbaapi/ooo/vba/excel/XDataLabels.idl @@ -27,14 +27,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XDataLabels_idl__ -#define __org_openoffice_excel_XDataLabels_idl__ +#ifndef __ooo_vba_excel_XDataLabels_idl__ +#define __ooo_vba_excel_XDataLabels_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ @@ -42,12 +42,12 @@ #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XDataLabels { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; }; //============================================================================= diff --git a/oovbaapi/org/openoffice/excel/XDialog.idl b/oovbaapi/ooo/vba/excel/XDialog.idl index 63fd63910f03..5bfb18f69baf 100644 --- a/oovbaapi/org/openoffice/excel/XDialog.idl +++ b/oovbaapi/ooo/vba/excel/XDialog.idl @@ -27,21 +27,21 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XDialog_idl__ -#define __org_openoffice_excel_XDialog_idl__ +#ifndef __ooo_vba_excel_XDialog_idl__ +#define __ooo_vba_excel_XDialog_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= @@ -49,7 +49,7 @@ interface XApplication; interface XDialog { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; void Show(); }; diff --git a/oovbaapi/org/openoffice/excel/XDialogs.idl b/oovbaapi/ooo/vba/excel/XDialogs.idl index 543bf616572a..4b4493e9d2ff 100644 --- a/oovbaapi/org/openoffice/excel/XDialogs.idl +++ b/oovbaapi/ooo/vba/excel/XDialogs.idl @@ -27,30 +27,30 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XDialogs_idl__ -#define __org_openoffice_excel_XDialogs_idl__ +#ifndef __ooo_vba_excel_XDialogs_idl__ +#define __ooo_vba_excel_XDialogs_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XApplication; //============================================================================= -//interface XDialogs : ::org::openoffice::vba::XCollection +//interface XDialogs : ::ooo::vba::XCollection interface XDialogs { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute, readonly] long Count; diff --git a/oovbaapi/org/openoffice/excel/XFont.idl b/oovbaapi/ooo/vba/excel/XFont.idl index 5d056eb8c526..038e6b43a85c 100644 --- a/oovbaapi/org/openoffice/excel/XFont.idl +++ b/oovbaapi/ooo/vba/excel/XFont.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XFont_idl__ -#define __org_openoffice_excel_XFont_idl__ +#ifndef __ooo_vba_excel_XFont_idl__ +#define __ooo_vba_excel_XFont_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> @@ -37,17 +37,17 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XFont { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] any Size; [attribute] any StandardFontSize; @@ -63,6 +63,7 @@ interface XFont [attribute] any Subscript; [attribute] any Superscript; [attribute] any Name; + [attribute] any OutlineFont; }; //============================================================================= diff --git a/oovbaapi/org/openoffice/excel/XFormat.idl b/oovbaapi/ooo/vba/excel/XFormat.idl index 56d4ef46e7e7..4d65ff901cd2 100644 --- a/oovbaapi/org/openoffice/excel/XFormat.idl +++ b/oovbaapi/ooo/vba/excel/XFormat.idl @@ -28,17 +28,17 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XFormat_idl__ -#define __org_openoffice_excel_XFormat_idl__ +#ifndef __ooo_vba_excel_XFormat_idl__ +#define __ooo_vba_excel_XFormat_idl__ #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XBorders; interface XFont; @@ -46,7 +46,7 @@ interface XInterior; interface XFormat { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; // void Clear( ) raises ( com::sun::star::script::BasicErrorException ); any Borders( [in] any item ) diff --git a/oovbaapi/org/openoffice/excel/XFormatCondition.idl b/oovbaapi/ooo/vba/excel/XFormatCondition.idl index c1cb3c458afe..e6f542056d9b 100644 --- a/oovbaapi/org/openoffice/excel/XFormatCondition.idl +++ b/oovbaapi/ooo/vba/excel/XFormatCondition.idl @@ -28,18 +28,18 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XFormatCondition_idl__ -#define __org_openoffice_excel_XFormatCondition_idl__ +#ifndef __ooo_vba_excel_XFormatCondition_idl__ +#define __ooo_vba_excel_XFormatCondition_idl__ #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XFont; interface XInterior; @@ -47,7 +47,7 @@ interface XBorders; interface XFormatCondition { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; void Delete( ) raises ( com::sun::star::script::BasicErrorException ); diff --git a/oovbaapi/org/openoffice/excel/XFormatConditions.idl b/oovbaapi/ooo/vba/excel/XFormatConditions.idl index e53620ecd6cf..e5c6ec2dacd4 100644 --- a/oovbaapi/org/openoffice/excel/XFormatConditions.idl +++ b/oovbaapi/ooo/vba/excel/XFormatConditions.idl @@ -27,25 +27,25 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XFormatConditions_idl__ -#define __org_openoffice_excel_XFormatConditions_idl__ +#ifndef __ooo_vba_excel_XFormatConditions_idl__ +#define __ooo_vba_excel_XFormatConditions_idl__ #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif -module org { module openoffice { module excel +module ooo { module vba { module excel { interface XFormatCondition; interface XFormatConditions { - interface org::openoffice::vba::XCollection; + interface ooo::vba::XCollection; void Delete( ) raises ( com::sun::star::script::BasicErrorException ); diff --git a/xmlhelp/source/cxxhelp/inc/db/DBEnv.hxx b/oovbaapi/ooo/vba/excel/XHPageBreak.idl index 8aefc1b0e7d9..ffc131958e65 100644 --- a/xmlhelp/source/cxxhelp/inc/db/DBEnv.hxx +++ b/oovbaapi/ooo/vba/excel/XHPageBreak.idl @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DBEnv.hxx,v $ - * $Revision: 1.3 $ + * $RCSfile$ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -27,42 +27,29 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _XMLSEARCH_DB_DBENV_HXX_ -#define _XMLSEARCH_DB_DBENV_HXX_ +#ifndef __ooo_vba_excel_XHPageBreak_idl__ +#define __ooo_vba_excel_XHPageBreak_idl__ -namespace xmlsearch { - - namespace db { - - - class Block; - - - // environment class for a DBEnv - - class DBEnv - { - public: - - virtual sal_Int32 getEntryHeaderLen() const = 0; - - virtual sal_Int32 getBlockCount() const = 0; +#ifndef __ooo_vba_excel_XPageBreak_idl__ +#include <ooo/vba/excel/XPageBreak.idl> +#endif - virtual sal_Int32 getMaximumBlockCount() const = 0; - virtual sal_Int32 getDataLen() const = 0; +//============================================================================= - virtual sal_Int32 getBlockLen() const = 0; +module ooo { module vba { module excel { - virtual void read( sal_Int32 block,Block*& ) const = 0; +//============================================================================= - virtual void write( sal_Int32,Block* ) = 0; - }; +interface XHPageBreak +{ + interface ::ooo::vba::excel::XPageBreak; +}; +//============================================================================= - } +}; }; }; -} +#endif -#endif diff --git a/oovbaapi/ooo/vba/excel/XHPageBreaks.idl b/oovbaapi/ooo/vba/excel/XHPageBreaks.idl new file mode 100644 index 000000000000..028992fa9c30 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/XHPageBreaks.idl @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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$ + * $Revision$ + * + * 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 __ooo_vba_excel_XHPageBreaks_idl__ +#define __ooo_vba_excel_XHPageBreaks_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif + +#ifndef __com_sun_star_helper_script_BasicErrorException_idl__ +#include <com/sun/star/script/BasicErrorException.idl> +#endif +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> +#endif + +//============================================================================= + +module ooo { module vba { module excel { + +//============================================================================= + +interface XHPageBreak; + +interface XHPageBreaks +{ + + interface ooo::vba::XCollection; + //Methods + any Add([in] any Before) raises(com::sun::star::script::BasicErrorException); +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/excel/XHyperlink.idl b/oovbaapi/ooo/vba/excel/XHyperlink.idl new file mode 100644 index 000000000000..1745d7f6f68b --- /dev/null +++ b/oovbaapi/ooo/vba/excel/XHyperlink.idl @@ -0,0 +1,65 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_excel_XHyperlink_idl__ +#define __ooo_vba_excel_XHyperlink_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif + +//============================================================================= + +module ooo { module vba { module excel { + +//============================================================================= +interface XRange; +interface XHyperlink +{ + interface ::ooo::vba::XHelperInterface; + + [attribute] string Address; + [attribute] string Name; + [attribute] string TextToDisplay; + + XRange Range(); +}; + +}; }; }; + +#endif diff --git a/oovbaapi/org/openoffice/excel/XInterior.idl b/oovbaapi/ooo/vba/excel/XInterior.idl index d12b885e1f4f..c01a7f1af251 100644 --- a/oovbaapi/org/openoffice/excel/XInterior.idl +++ b/oovbaapi/ooo/vba/excel/XInterior.idl @@ -27,30 +27,33 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XInterior_idl__ -#define __org_openoffice_excel_XInterior_idl__ +#ifndef __ooo_vba_excel_XInterior_idl__ +#define __ooo_vba_excel_XInterior_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XInterior { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] any Color; [attribute] any ColorIndex; + [attribute] any Pattern; + [attribute] any PatternColor; + [attribute] any PatternColorIndex; }; //============================================================================= diff --git a/oovbaapi/org/openoffice/excel/XName.idl b/oovbaapi/ooo/vba/excel/XName.idl index 190e642ec5e4..a386ee96d3dd 100644 --- a/oovbaapi/org/openoffice/excel/XName.idl +++ b/oovbaapi/ooo/vba/excel/XName.idl @@ -27,20 +27,20 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XName_idl__ -#define __org_openoffice_excel_XName_idl__ +#ifndef __ooo_vba_excel_XName_idl__ +#define __ooo_vba_excel_XName_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= @@ -48,7 +48,7 @@ interface XRange; interface XName { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] string Name; [attribute] string NameLocal; diff --git a/oovbaapi/org/openoffice/excel/XNames.idl b/oovbaapi/ooo/vba/excel/XNames.idl index d91a1041f2e8..30d9208e2511 100644 --- a/oovbaapi/org/openoffice/excel/XNames.idl +++ b/oovbaapi/ooo/vba/excel/XNames.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XNames_idl__ -#define __org_openoffice_excel_XNames_idl__ +#ifndef __ooo_vba_excel_XNames_idl__ +#define __ooo_vba_excel_XNames_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XNames { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; any Add( [in] any Name , [in] any RefersTo , [in] any Visible , [in] any MacroType , [in] any ShortcutKey , [in] any Category , [in] any NameLocal , [in] any RefersToLocal , [in] any CategoryLocal , [in] any RefersToR1C1 , [in] any RefersToR1C1Local ); }; diff --git a/oovbaapi/org/openoffice/excel/XOLEObject.idl b/oovbaapi/ooo/vba/excel/XOLEObject.idl index ce065e5f0a3a..3f91b3ced021 100644 --- a/oovbaapi/org/openoffice/excel/XOLEObject.idl +++ b/oovbaapi/ooo/vba/excel/XOLEObject.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XOLEObject_idl__ -#define __org_openoffice_excel_XOLEObject_idl__ +#ifndef __ooo_vba_excel_XOLEObject_idl__ +#define __ooo_vba_excel_XOLEObject_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XOLEObject { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute, readonly] com::sun::star::uno::XInterface Object; [attribute] boolean Enabled; diff --git a/oovbaapi/org/openoffice/excel/XOLEObjects.idl b/oovbaapi/ooo/vba/excel/XOLEObjects.idl index c40b2e94b36e..f91020ff7416 100644 --- a/oovbaapi/org/openoffice/excel/XOLEObjects.idl +++ b/oovbaapi/ooo/vba/excel/XOLEObjects.idl @@ -27,21 +27,21 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XOLEObjects_idl__ -#define __org_openoffice_excel_XOLEObjects_idl__ +#ifndef __ooo_vba_excel_XOLEObjects_idl__ +#define __ooo_vba_excel_XOLEObjects_idl__ -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XOLEObjects { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; //[attribute, readonly] boolean Focused; }; diff --git a/oovbaapi/org/openoffice/excel/XOutline.idl b/oovbaapi/ooo/vba/excel/XOutline.idl index ec1a2ece2c73..756b938900fc 100644 --- a/oovbaapi/org/openoffice/excel/XOutline.idl +++ b/oovbaapi/ooo/vba/excel/XOutline.idl @@ -27,20 +27,20 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XOutline_idl__ -#define __org_openoffice_excel_XOutline_idl__ +#ifndef __ooo_vba_excel_XOutline_idl__ +#define __ooo_vba_excel_XOutline_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= @@ -48,7 +48,7 @@ module org { module openoffice { module excel { interface XOutline { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; //Methods void ShowLevels([in] any RowLevels,[in] any ColumnLevels); diff --git a/oovbaapi/ooo/vba/excel/XPageBreak.idl b/oovbaapi/ooo/vba/excel/XPageBreak.idl new file mode 100644 index 000000000000..9f606d11f1f2 --- /dev/null +++ b/oovbaapi/ooo/vba/excel/XPageBreak.idl @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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$ + * $Revision$ + * + * 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 __ooo_vba_excel_XPageBreak_idl__ +#define __ooo_vba_excel_XPageBreak_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif + +#ifndef __com_sun_star_helper_script_BasicErrorException_idl__ +#include <com/sun/star/script/BasicErrorException.idl> +#endif + +//============================================================================= + +module ooo { module vba { module excel { + +//============================================================================= + +interface XRange; + +interface XPageBreak +{ + + interface ::ooo::vba::XHelperInterface; + + // Attributes + [attribute] long Type; + + //Methods + void Delete() raises(com::sun::star::script::BasicErrorException); + XRange Location()raises(com::sun::star::script::BasicErrorException); + +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/excel/XPageSetup.idl b/oovbaapi/ooo/vba/excel/XPageSetup.idl new file mode 100644 index 000000000000..b847e656dadb --- /dev/null +++ b/oovbaapi/ooo/vba/excel/XPageSetup.idl @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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$ + * $Revision$ + * + * 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 __ooo_vba_excel_XPageSetup_idl__ +#define __ooo_vba_excel_XPageSetup_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif + +//============================================================================= + +module ooo { module vba { module excel { + +//============================================================================= + + +interface XPageSetup +{ + + interface ::ooo::vba::XHelperInterface; + + //Attributes + [attribute] string PrintArea; + [attribute] double TopMargin; + [attribute] double BottomMargin; + [attribute] double RightMargin; + [attribute] double LeftMargin; + [attribute] double HeaderMargin; + [attribute] double FooterMargin; + [attribute] long Orientation; + [attribute] any FitToPagesTall; + [attribute] any FitToPagesWide; + [attribute] any Zoom; + [attribute] string LeftHeader; + [attribute] string CenterHeader; + [attribute] string RightHeader; + [attribute] string LeftFooter; + [attribute] string CenterFooter; + [attribute] string RightFooter; + [attribute] long Order; + [attribute] long FirstPageNumber; + [attribute] boolean CenterVertically; + [attribute] boolean CenterHorizontally; + [attribute] boolean PrintHeadings; + +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/org/openoffice/excel/XPane.idl b/oovbaapi/ooo/vba/excel/XPane.idl index c2227123a703..f30159fae46e 100644 --- a/oovbaapi/org/openoffice/excel/XPane.idl +++ b/oovbaapi/ooo/vba/excel/XPane.idl @@ -36,7 +36,7 @@ //============================================================================ -module org{ module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================ diff --git a/oovbaapi/org/openoffice/excel/XPivotCache.idl b/oovbaapi/ooo/vba/excel/XPivotCache.idl index 338b2703d9ad..f50b1071a344 100644 --- a/oovbaapi/org/openoffice/excel/XPivotCache.idl +++ b/oovbaapi/ooo/vba/excel/XPivotCache.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XPivotCache_idl__ -#define __org_openoffice_excel_XPivotCache_idl__ +#ifndef __ooo_vba_excel_XPivotCache_idl__ +#define __ooo_vba_excel_XPivotCache_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XPivotCache { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; void Refresh(); }; diff --git a/oovbaapi/org/openoffice/excel/XPivotTable.idl b/oovbaapi/ooo/vba/excel/XPivotTable.idl index b54cd1b43905..118ec2c1751e 100644 --- a/oovbaapi/org/openoffice/excel/XPivotTable.idl +++ b/oovbaapi/ooo/vba/excel/XPivotTable.idl @@ -27,31 +27,31 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XPivotTable_idl__ -#define __org_openoffice_excel_XPivotTable_idl__ +#ifndef __ooo_vba_excel_XPivotTable_idl__ +#define __ooo_vba_excel_XPivotTable_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_excel_XPivotCache_idl__ -#include <org/openoffice/excel/XPivotCache.idl> +#ifndef __ooo_vba_excel_XPivotCache_idl__ +#include <ooo/vba/excel/XPivotCache.idl> #endif -#ifndef __org_openoffice_vba__XHelperInterface_idl__ -#define __org_openoffice_vba__XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba__XHelperInterface_idl__ +#define __ooo_vba__XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= //interface XPivotTable: com::sun::star::uno::XInterface interface XPivotTable { - interface org::openoffice::vba::XHelperInterface; + interface ooo::vba::XHelperInterface; XPivotCache PivotCache(); }; diff --git a/oovbaapi/org/openoffice/excel/XPivotTables.idl b/oovbaapi/ooo/vba/excel/XPivotTables.idl index 5d7bad6245a8..77085ce0d48f 100644 --- a/oovbaapi/org/openoffice/excel/XPivotTables.idl +++ b/oovbaapi/ooo/vba/excel/XPivotTables.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XPivotTables_idl__ -#define __org_openoffice_excel_XPivotTables_idl__ +#ifndef __ooo_vba_excel_XPivotTables_idl__ +#define __ooo_vba_excel_XPivotTables_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XPivotTables { - interface org::openoffice::vba::XCollection; + interface ooo::vba::XCollection; // PivotCache should be a PivotCache object ( but thats not defined // yet ) //XPivotTable Add( [in] any PivotCache, [in] any TableDestination, [in] any TableName, [in] any ReadData ); diff --git a/oovbaapi/org/openoffice/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl index 8812d2d56b78..742669a4662d 100644 --- a/oovbaapi/org/openoffice/excel/XRange.idl +++ b/oovbaapi/ooo/vba/excel/XRange.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XRange_idl__ -#define __org_openoffice_excel_XRange_idl__ +#ifndef __ooo_vba_excel_XRange_idl__ +#define __ooo_vba_excel_XRange_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> @@ -45,21 +45,21 @@ #ifndef __com_sun_star_script_XDefaultMethod_idl__ #include <com/sun/star/script/XDefaultMethod.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif -#ifndef __org_openoffice_excel_XFormat_idl__ -#include <org/openoffice/excel/XFormat.idl> +#ifndef __ooo_vba_excel_XFormat_idl__ +#include <ooo/vba/excel/XFormat.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif #ifndef __com_sun_star_helper_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XFont; interface XRows; @@ -77,8 +77,8 @@ interface XRange interface com::sun::star::container::XEnumerationAccess; interface com::sun::star::script::XDefaultMethod; interface com::sun::star::script::XDefaultProperty; - interface ::org::openoffice::excel::XFormat; - //interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::excel::XFormat; + //interface ::ooo::vba::XHelperInterface; [attribute] any Value; [attribute] any Formula; @@ -103,6 +103,7 @@ interface XRange [attribute, readonly] XValidation Validation; [attribute] any Style; [attribute] any AddIndent; + [attribute] any ShowDetail; XComment AddComment( [in] any Text ); void Clear(); @@ -134,6 +135,7 @@ interface XRange any getCellRange(); void PasteSpecial([in] any Paste, [in] any Operation,[in] any SkipBlanks, [in] any Transpose); boolean Replace( [in] string What, [in] string Replacement, [in] any LookAt, [in] any SearchOrder, [in] any MatchCase, [in] any MatchByte, [in] any SearchFormat, [in] any ReplaceFormat ); + XRange Find( [in] any What, [in] any After, [in] any LookIn, [in] any LookAt, [in] any SearchOrder, [in] any SearchDirection, [in] any MatchCase, [in] any MatchByte, [in] any SearchFormat ); void Sort( [in] any Key1, [in] any Order1, [in] any Key2, [in] any Type, [in] any Order2, [in] any Key3, [in] any Order3, @@ -164,6 +166,7 @@ interface XRange XRange SpecialCells( [in] any Type, [in] /*Optional*/ any Value ) raises ( com::sun::star::script::BasicErrorException ); void RemoveSubtotal() raises ( com::sun::star::script::BasicErrorException ); void Subtotal( [in] long GroupBy, [in] long Function, [in] /*Optional*/ sequence<long> TotalList, [in] /*Optional*/ any Replace, [in] /*Optional*/ any PageBreaks, [in] any SummaryBelowData ) raises ( com::sun::star::script::BasicErrorException ); + XRange MergeArea( ) raises ( com::sun::star::script::BasicErrorException ); }; diff --git a/oovbaapi/org/openoffice/excel/XSeries.idl b/oovbaapi/ooo/vba/excel/XSeries.idl index ef35fd6a5be9..f49b0b4cc456 100644 --- a/oovbaapi/org/openoffice/excel/XSeries.idl +++ b/oovbaapi/ooo/vba/excel/XSeries.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XSeries_idl__ -#define __org_openoffice_excel_XSeries_idl__ +#ifndef __ooo_vba_excel_XSeries_idl__ +#define __ooo_vba_excel_XSeries_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XSeries { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute, readonly] string Name; any Series( [in] any Item ); diff --git a/oovbaapi/org/openoffice/excel/XSeriesCollection.idl b/oovbaapi/ooo/vba/excel/XSeriesCollection.idl index 089ea773a70e..ed23be47c1f6 100644 --- a/oovbaapi/org/openoffice/excel/XSeriesCollection.idl +++ b/oovbaapi/ooo/vba/excel/XSeriesCollection.idl @@ -27,24 +27,24 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XSeriesCollection_idl__ -#define __org_openoffice_excel_XSeriesCollection_idl__ +#ifndef __ooo_vba_excel_XSeriesCollection_idl__ +#define __ooo_vba_excel_XSeriesCollection_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XSeries; //============================================================================= interface XSeriesCollection { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; //XSeries Add( [in] any Source, [in] any RowCol, [in] any SeriesLabels, // [in] any CategoryLabels, [in] any Replace ); XSeries NewSeries(); diff --git a/oovbaapi/org/openoffice/excel/XStyle.idl b/oovbaapi/ooo/vba/excel/XStyle.idl index 9476d2dd0d58..e570a5d2982d 100644 --- a/oovbaapi/org/openoffice/excel/XStyle.idl +++ b/oovbaapi/ooo/vba/excel/XStyle.idl @@ -28,21 +28,21 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XStyle_idl__ -#define __org_openoffice_excel_XStyle_idl__ +#ifndef __ooo_vba_excel_XStyle_idl__ +#define __ooo_vba_excel_XStyle_idl__ #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_excel_XFormat_idl__ -#include <org/openoffice/excel/XFormat.idl> +#ifndef __ooo_vba_excel_XFormat_idl__ +#include <ooo/vba/excel/XFormat.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XStyle { interface XFormat; diff --git a/oovbaapi/org/openoffice/excel/XStyles.idl b/oovbaapi/ooo/vba/excel/XStyles.idl index 820a59bd9b73..c37290da1b90 100644 --- a/oovbaapi/org/openoffice/excel/XStyles.idl +++ b/oovbaapi/ooo/vba/excel/XStyles.idl @@ -28,26 +28,26 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XStyles_idl__ -#define __org_openoffice_excel_XStyles_idl__ +#ifndef __ooo_vba_excel_XStyles_idl__ +#define __ooo_vba_excel_XStyles_idl__ #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XStyle; interface XStyles { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; /** @param Workbook Optional. diff --git a/oovbaapi/org/openoffice/excel/XTextFrame.idl b/oovbaapi/ooo/vba/excel/XTextFrame.idl index 33cd1603bfb9..e0380217e609 100644 --- a/oovbaapi/org/openoffice/excel/XTextFrame.idl +++ b/oovbaapi/ooo/vba/excel/XTextFrame.idl @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XTextFrame_idl__ -#define __org_openoffice_excel_XTextFrame_idl__ +#ifndef __ooo_vba_excel_XTextFrame_idl__ +#define __ooo_vba_excel_XTextFrame_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_excel_XCharacters_idl__ -#include <org/openoffice/excel/XCharacters.idl> +#ifndef __ooo_vba_excel_XCharacters_idl__ +#include <ooo/vba/excel/XCharacters.idl> #endif -module org { module openoffice { module excel { -interface XTextFrame : org::openoffice::vba::XHelperInterface +module ooo { module vba { module excel { +interface XTextFrame : ooo::vba::XHelperInterface { [attribute] boolean AutoSize; [attribute] float MarginBottom; diff --git a/oovbaapi/org/openoffice/excel/XTitle.idl b/oovbaapi/ooo/vba/excel/XTitle.idl index 2dd7dfa7ff98..d67f6a70050d 100644 --- a/oovbaapi/org/openoffice/excel/XTitle.idl +++ b/oovbaapi/ooo/vba/excel/XTitle.idl @@ -28,18 +28,18 @@ * ************************************************************************/ -#ifndef __org_openoffice_excel_XTitle_idl__ -#define __org_openoffice_excel_XTitle_idl__ +#ifndef __ooo_vba_excel_XTitle_idl__ +#define __ooo_vba_excel_XTitle_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif #ifndef __com_sun_star_script_BasicErrorException_idl__ #include <com/sun/star/script/BasicErrorException.idl> #endif -module org { module openoffice { module excel { +module ooo { module vba { module excel { interface XCharacters; interface XFont; @@ -48,7 +48,7 @@ interface XInterior; interface XTitle { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; // XBorder Border( ) raises ( com::sun::star::script::BasicErrorException ); XInterior Interior() raises(com::sun::star::script::BasicErrorException); diff --git a/oovbaapi/org/openoffice/excel/XValidation.idl b/oovbaapi/ooo/vba/excel/XValidation.idl index 7b9f506de52f..c8d38bafbd17 100644 --- a/oovbaapi/org/openoffice/excel/XValidation.idl +++ b/oovbaapi/ooo/vba/excel/XValidation.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XValidation_idl__ -#define __org_openoffice_excel_XValidation_idl__ +#ifndef __ooo_vba_excel_XValidation_idl__ +#define __ooo_vba_excel_XValidation_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XValidation { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] boolean IgnoreBlank; [attribute] boolean InCellDropdown; diff --git a/oovbaapi/org/openoffice/excel/XWindow.idl b/oovbaapi/ooo/vba/excel/XWindow.idl index d349854c1e73..b67810a764b3 100644 --- a/oovbaapi/org/openoffice/excel/XWindow.idl +++ b/oovbaapi/ooo/vba/excel/XWindow.idl @@ -27,26 +27,28 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XWindow_idl__ -#define __org_openoffice_excel_XWindow_idl__ +#ifndef __ooo_vba_excel_XWindow_idl__ +#define __ooo_vba_excel_XWindow_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XRange; +interface XWorksheet; +interface XPane; interface XWindow { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute] any Caption; [attribute] boolean DisplayGridlines; @@ -56,6 +58,8 @@ interface XWindow [attribute] boolean DisplayVerticalScrollBar; [attribute] boolean DisplayWorkbookTabs; [attribute] boolean FreezePanes; + [attribute] long Height; + [attribute] long Left; [attribute] boolean Split; [attribute] long SplitColumn; [attribute] double SplitHorizontal; @@ -63,6 +67,10 @@ interface XWindow [attribute] double SplitVertical; [attribute] any ScrollColumn; [attribute] any ScrollRow; + [attribute] long Top; + [attribute] any View; + [attribute] boolean Visible; + [attribute] long Width; [attribute] any WindowState; [attribute] any Zoom; any SelectedSheets( [in] any aIndex ); @@ -73,7 +81,21 @@ interface XWindow void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook); XRange ActiveCell() raises(com::sun::star::script::BasicErrorException); any Selection() raises(com::sun::star::script::BasicErrorException); + long PointsToScreenPixelsX([in] long Points) raises(com::sun::star::script::BasicErrorException); + long PointsToScreenPixelsY([in] long Points) raises(com::sun::star::script::BasicErrorException); + void PrintOut([in] /*optional short*/ any From, + [in] /*optional short*/ any To, + [in] /*optional short*/ any Copies, + [in] /*optional boolean*/ any Preview, + [in] /*optional string*/ any ActivePrinter, + [in] /*optional boolean*/ any PrintToFile, + [in] /*optional boolean*/ any Collate, + [in] /*optional string*/ any PrToFileName + ) raises(com::sun::star::script::BasicErrorException); + void PrintPreview( [in] /*Optional*/ any EnableChanges ) raises ( com::sun::star::script::BasicErrorException ); + XWorksheet ActiveSheet() raises(com::sun::star::script::BasicErrorException); + XPane ActivePane() raises(com::sun::star::script::BasicErrorException); }; //============================================================================= diff --git a/oovbaapi/org/openoffice/excel/XWindows.idl b/oovbaapi/ooo/vba/excel/XWindows.idl index 343ead19f864..56f571c51122 100644 --- a/oovbaapi/org/openoffice/excel/XWindows.idl +++ b/oovbaapi/ooo/vba/excel/XWindows.idl @@ -27,25 +27,25 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XWindows_idl__ -#define __org_openoffice_excel_XWindows_idl__ +#ifndef __ooo_vba_excel_XWindows_idl__ +#define __ooo_vba_excel_XWindows_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XWindows { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; void Arrange( [in] long ArrangeStyle, [in] any ActiveWorkbook, [in] any SyncHorizontal, [in] any SyncVertical ); }; diff --git a/oovbaapi/org/openoffice/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl index da4bc1c57548..e05a6ccca493 100644 --- a/oovbaapi/org/openoffice/excel/XWorkbook.idl +++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl @@ -27,20 +27,20 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XWorkbook_idl__ -#define __org_openoffice_excel_XWorkbook_idl__ +#ifndef __ooo_vba_excel_XWorkbook_idl__ +#define __ooo_vba_excel_XWorkbook_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= @@ -50,7 +50,7 @@ interface XStyles; interface XWorkbook { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; [attribute, readonly] string Name; [attribute, readonly] string Path; @@ -71,7 +71,7 @@ interface XWorkbook void Activate(); void ResetColors() raises (com::sun::star::script::BasicErrorException); - any Names(); + any Names( [in] any Index ); any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException); long FileFormat() raises (com::sun::star::script::BasicErrorException); diff --git a/oovbaapi/org/openoffice/excel/XWorkbooks.idl b/oovbaapi/ooo/vba/excel/XWorkbooks.idl index 6f963e84462a..a94747282200 100644 --- a/oovbaapi/org/openoffice/excel/XWorkbooks.idl +++ b/oovbaapi/ooo/vba/excel/XWorkbooks.idl @@ -27,27 +27,27 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XWorkbooks_idl__ -#define __org_openoffice_excel_XWorkbooks_idl__ +#ifndef __ooo_vba_excel_XWorkbooks_idl__ +#define __ooo_vba_excel_XWorkbooks_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XWorkbooks { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; any Add(); any Open([in] string Filename, [in] any UpdateLinks, [in] any ReadOnly, [in] any Format, [in] any Password, [in] any WriteResPassword, [in] any IgnoreReadOnlyRecommended, [in] any Origin, [in] any Delimiter, [in] any Editable, [in] any Notify, [in] any Converter, [in] any AddToMru); diff --git a/oovbaapi/org/openoffice/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl index e7fa8ed31d15..743e6b8fe6a2 100644 --- a/oovbaapi/org/openoffice/excel/XWorksheet.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl @@ -27,15 +27,15 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XWorksheet_idl__ -#define __org_openoffice_excel_XWorksheet_idl__ +#ifndef __ooo_vba_excel_XWorksheet_idl__ +#define __ooo_vba_excel_XWorksheet_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif #ifndef __com_sun_star_script_XInvocation_idl__ @@ -44,19 +44,21 @@ //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XComments; interface XRange; interface XOutline; +interface XPageSetup; +interface XHPageBreaks; interface XWorksheet { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; interface ::com::sun::star::script::XInvocation; - [attribute] string Name; + [attribute] string Name; [attribute] boolean Visible; [attribute, readonly] long StandardHeight; [attribute, readonly] long StandardWidth; @@ -67,6 +69,7 @@ interface XWorksheet [attribute, readonly] XWorksheet Next; [attribute, readonly] XWorksheet Previous; [attribute, readonly] string CodeName; + [attribute, readonly] short Index; void Activate(); void Calculate( ); @@ -83,6 +86,8 @@ interface XWorksheet any PivotTables([in] any Index); any Comments([in] any Index); XOutline Outline(); + XPageSetup PageSetup(); + any HPageBreaks([in] any Index); any OLEObjects([in] any Index); void ShowDataForm(); any Shapes([in] any Index); @@ -98,6 +103,7 @@ interface XWorksheet void setEnableCalculation([in] boolean EnableCalculation) raises(com::sun::star::script::BasicErrorException); boolean getEnableCalculation() raises(com::sun::star::script::BasicErrorException); + void PrintOut( [in] any From, [in] any To, [in] any Copies, [in] any Preview, [in] any ActivePrinter, [in] any PrintToFile, [in] any Collate, [in] any PrToFileName, [in] any IgnorePrintAreas ); }; diff --git a/oovbaapi/org/openoffice/excel/XWorksheetFunction.idl b/oovbaapi/ooo/vba/excel/XWorksheetFunction.idl index 3712f7977c09..ffe80f9a4739 100644 --- a/oovbaapi/org/openoffice/excel/XWorksheetFunction.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheetFunction.idl @@ -27,15 +27,15 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XWSFunction_idl__ -#define __org_openoffice_excel_XWSFunction_idl__ +#ifndef __ooo_vba_excel_XWSFunction_idl__ +#define __ooo_vba_excel_XWSFunction_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif #ifndef __com_sun_star_beans_XExactName_idl__ @@ -47,14 +47,14 @@ #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XWorksheetFunction { - interface ::org::openoffice::vba::XHelperInterface; + interface ::ooo::vba::XHelperInterface; interface ::com::sun::star::beans::XExactName; interface ::com::sun::star::script::XInvocation; }; diff --git a/oovbaapi/org/openoffice/excel/XWorksheets.idl b/oovbaapi/ooo/vba/excel/XWorksheets.idl index a8ae0799c4da..3a83b17a8a37 100644 --- a/oovbaapi/org/openoffice/excel/XWorksheets.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheets.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XWorksheets_idl__ -#define __org_openoffice_excel_XWorksheets_idl__ +#ifndef __ooo_vba_excel_XWorksheets_idl__ +#define __ooo_vba_excel_XWorksheets_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif //============================================================================= -module org { module openoffice { module excel { +module ooo { module vba { module excel { //============================================================================= interface XWorksheets { - interface ::org::openoffice::vba::XCollection; + interface ::ooo::vba::XCollection; [attribute] any Visible; any Add( [in] any Before, [in] any After, [in] any Count, [in] any Type ); void Delete(); diff --git a/oovbaapi/org/openoffice/excel/XlBuildInDialog.idl b/oovbaapi/ooo/vba/excel/XlBuildInDialog.idl index 8d995e92b18e..e55964441250 100644 --- a/oovbaapi/org/openoffice/excel/XlBuildInDialog.idl +++ b/oovbaapi/ooo/vba/excel/XlBuildInDialog.idl @@ -27,9 +27,9 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_excel_XlBuildInDialog_idl__ -#define __org_openoffice_excel_XlBuildInDialog_idl__ -module org { module openoffice { module excel { +#ifndef __ooo_vba_excel_XlBuildInDialog_idl__ +#define __ooo_vba_excel_XlBuildInDialog_idl__ +module ooo { module vba { module excel { constants XlBuildInDialog { diff --git a/oovbaapi/org/openoffice/excel/makefile.mk b/oovbaapi/ooo/vba/excel/makefile.mk index 81f7a95101fc..764c073e6846 100644 --- a/oovbaapi/org/openoffice/excel/makefile.mk +++ b/oovbaapi/ooo/vba/excel/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/..$/.. PRJNAME=oovapi TARGET=excel -PACKAGE=org$/openoffice$/Excel +PACKAGE=ooo$/vba$/Excel # --- Settings ----------------------------------------------------- .INCLUDE : $(PRJ)$/util$/makefile.pmk @@ -96,6 +96,13 @@ IDLFILES= XApplication.idl\ XNames.idl \ Workbook.idl \ Worksheet.idl \ + Window.idl \ + XHyperlink.idl \ + Hyperlink.idl \ + XPageSetup.idl \ + XPageBreak.idl \ + XHPageBreak.idl \ + XHPageBreaks.idl \ # ------------------------------------------------------------------ diff --git a/oovbaapi/org/openoffice/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk index 97f528ca2872..ee63d6373feb 100644 --- a/oovbaapi/org/openoffice/vba/makefile.mk +++ b/oovbaapi/ooo/vba/makefile.mk @@ -28,12 +28,12 @@ # for a copy of the LGPLv3 License. # #************************************************************************* -PRJ=..$/..$/.. +PRJ=..$/.. PRJNAME=oovbapi TARGET=vba -PACKAGE=org$/openoffice$/vba +PACKAGE=ooo$/vba # --- Settings ----------------------------------------------------- .INCLUDE : $(PRJ)$/util$/makefile.pmk @@ -52,6 +52,11 @@ IDLFILES=\ XVBAToOOEventDescGen.idl\ XPropValue.idl\ XHelperInterface.idl\ + XAssistant.idl\ + XCommandBarControl.idl\ + XCommandBarControls.idl\ + XCommandBar.idl\ + XCommandBars.idl\ Globals.idl\ # ------------------------------------------------------------------ diff --git a/oovbaapi/org/openoffice/msforms/MSFormReturnTypes.idl b/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl index 5c25d3c53f59..5c25d3c53f59 100644 --- a/oovbaapi/org/openoffice/msforms/MSFormReturnTypes.idl +++ b/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl diff --git a/oovbaapi/org/openoffice/msforms/XButton.idl b/oovbaapi/ooo/vba/msforms/XButton.idl index ed6b1770a1fd..bff23b2441e4 100644 --- a/oovbaapi/org/openoffice/msforms/XButton.idl +++ b/oovbaapi/ooo/vba/msforms/XButton.idl @@ -27,15 +27,15 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XButton_idl__ -#define __org_openoffice_msforms_XButton_idl__ +#ifndef __ooo_vba_msforms_XButton_idl__ +#define __ooo_vba_msforms_XButton_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif //============================================================================= -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { //============================================================================= interface XButton: com::sun::star::uno::XInterface diff --git a/oovbaapi/org/openoffice/msforms/XColorFormat.idl b/oovbaapi/ooo/vba/msforms/XColorFormat.idl index 0e4caa4e01fa..9c9e6f956c9b 100644 --- a/oovbaapi/org/openoffice/msforms/XColorFormat.idl +++ b/oovbaapi/ooo/vba/msforms/XColorFormat.idl @@ -27,16 +27,16 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XColorFormat_idl__ -#define __org_openoffice_msforms_XColorFormat_idl__ +#ifndef __ooo_vba_msforms_XColorFormat_idl__ +#define __ooo_vba_msforms_XColorFormat_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { -interface XColorFormat : org::openoffice::vba::XHelperInterface +interface XColorFormat : ooo::vba::XHelperInterface { [attribute] long RGB; [attribute] long SchemeColor; diff --git a/oovbaapi/org/openoffice/msforms/XComboBox.idl b/oovbaapi/ooo/vba/msforms/XComboBox.idl index cb8240dc3b88..3816d7524af9 100644 --- a/oovbaapi/org/openoffice/msforms/XComboBox.idl +++ b/oovbaapi/ooo/vba/msforms/XComboBox.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XComboBox_idl__ -#define __org_openoffice_msforms_XComboBox_idl__ +#ifndef __ooo_vba_msforms_XComboBox_idl__ +#define __ooo_vba_msforms_XComboBox_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> @@ -37,15 +37,18 @@ //============================================================================= -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { //============================================================================= interface XComboBox: ::com::sun::star::uno::XInterface { [attribute] any Value; + [attribute] any ListIndex; + [attribute, readonly ] long ListCount; [attribute] string Text; void AddItem( [in] any pvargItem, [in] any pvargIndex ); + void removeItem( [in] any index ); void Clear(); }; diff --git a/oovbaapi/org/openoffice/msforms/XControl.idl b/oovbaapi/ooo/vba/msforms/XControl.idl index 16983256977b..75f9becd253c 100644 --- a/oovbaapi/org/openoffice/msforms/XControl.idl +++ b/oovbaapi/ooo/vba/msforms/XControl.idl @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XControl_idl__ -#define __org_openoffice_msforms_XControl_idl__ +#ifndef __ooo_vba_msforms_XControl_idl__ +#define __ooo_vba_msforms_XControl_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> @@ -37,12 +37,20 @@ //============================================================================= -module org { module openoffice { module msforms { +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif +module ooo { module vba { module msforms { //============================================================================= -interface XControl: com::sun::star::uno::XInterface +interface XControl { + interface ::ooo::vba::XHelperInterface; + void SetFocus(); + [attribute, readonly ] com::sun::star::uno::XInterface Object; + [attribute] string ControlSource; + [attribute] string RowSource; [attribute] boolean Enabled; [attribute] boolean Visible; //Size. there are some defferent between Mso and OOo. @@ -52,6 +60,7 @@ interface XControl: com::sun::star::uno::XInterface //Postion [attribute] double Left; [attribute] double Top; + [attribute] string Name; }; //============================================================================= diff --git a/xmlhelp/source/cxxhelp/inc/db/BlockFactory.hxx b/oovbaapi/ooo/vba/msforms/XControls.idl index d11a3c3d18bf..46a265b24a5d 100644 --- a/xmlhelp/source/cxxhelp/inc/db/BlockFactory.hxx +++ b/oovbaapi/ooo/vba/msforms/XControls.idl @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: BlockFactory.hxx,v $ - * $Revision: 1.3 $ + * $RCSfile$ + * $Revision$ * * This file is part of OpenOffice.org. * @@ -27,28 +27,25 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _XMLSEARCH_DB_BLOCKFACTORY_HXX_ -#define _XMLSEARCH_DB_BLOCKFACTORY_HXX_ +#ifndef __ooo_vba_msforms_XControls_idl__ +#define __ooo_vba_msforms_XControls_idl__ -namespace xmlsearch { - - namespace db { - - - class Block; - - - class BlockFactory - { - public: - - virtual ~BlockFactory() { } - virtual Block* makeBlock() const = 0; - }; +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> +#endif +module ooo { module vba { module msforms { +interface XControl; - } -} +interface XControls +{ + interface ooo::vba::XCollection; + void Move( [in] double cx, [in] double cy ); +}; +}; }; }; #endif diff --git a/oovbaapi/org/openoffice/msforms/XFillFormat.idl b/oovbaapi/ooo/vba/msforms/XFillFormat.idl index 4bb5df0536f3..81c14288bfcf 100644 --- a/oovbaapi/org/openoffice/msforms/XFillFormat.idl +++ b/oovbaapi/ooo/vba/msforms/XFillFormat.idl @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XFillFormat_idl__ -#define __org_openoffice_msforms_XFillFormat_idl__ +#ifndef __ooo_vba_msforms_XFillFormat_idl__ +#define __ooo_vba_msforms_XFillFormat_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_msforms_XColorFormat_idl__ -#include <org/openoffice/msforms/XColorFormat.idl> +#ifndef __ooo_vba_msforms_XColorFormat_idl__ +#include <ooo/vba/msforms/XColorFormat.idl> #endif -module org { module openoffice { module msforms { -interface XFillFormat : org::openoffice::vba::XHelperInterface +module ooo { module vba { module msforms { +interface XFillFormat : ooo::vba::XHelperInterface { [attribute] boolean Visible; [attribute] double Transparency; diff --git a/oovbaapi/ooo/vba/msforms/XGroupBox.idl b/oovbaapi/ooo/vba/msforms/XGroupBox.idl new file mode 100644 index 000000000000..35fd3f8001e2 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XGroupBox.idl @@ -0,0 +1,56 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XGroupBox_idl__ +#define __ooo_vba_msforms_XGroupBox_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { +//============================================================================= +interface XGroupBox +{ + [attribute] string Caption; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/msforms/XImage.idl b/oovbaapi/ooo/vba/msforms/XImage.idl new file mode 100644 index 000000000000..b9f9226053d9 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XImage.idl @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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$ + * $Revision$ + * + * 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 __ooo_vba_msforms_XImage_idl__ +#define __ooo_vba_msforms_XImage_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { + +//============================================================================= +interface XImage: com::sun::star::uno::XInterface +{ +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/org/openoffice/msforms/XLabel.idl b/oovbaapi/ooo/vba/msforms/XLabel.idl index 7a0845b5616a..ae6cc2c92aea 100644 --- a/oovbaapi/org/openoffice/msforms/XLabel.idl +++ b/oovbaapi/ooo/vba/msforms/XLabel.idl @@ -27,20 +27,21 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XLabel_idl__ -#define __org_openoffice_msforms_XLabel_idl__ +#ifndef __ooo_vba_msforms_XLabel_idl__ +#define __ooo_vba_msforms_XLabel_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif //============================================================================= -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { //============================================================================= interface XLabel: com::sun::star::uno::XInterface { [attribute] string Caption; + [attribute] any Value; }; //============================================================================= diff --git a/oovbaapi/org/openoffice/msforms/XLineFormat.idl b/oovbaapi/ooo/vba/msforms/XLineFormat.idl index 7dc14f5bbc27..e4ce7043751f 100644 --- a/oovbaapi/org/openoffice/msforms/XLineFormat.idl +++ b/oovbaapi/ooo/vba/msforms/XLineFormat.idl @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XLineFormat_idl__ -#define __org_openoffice_msforms_XLineFormat_idl__ +#ifndef __ooo_vba_msforms_XLineFormat_idl__ +#define __ooo_vba_msforms_XLineFormat_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_msforms_XColorFormat_idl__ -#include <org/openoffice/msforms/XColorFormat.idl> +#ifndef __ooo_vba_msforms_XColorFormat_idl__ +#include <ooo/vba/msforms/XColorFormat.idl> #endif -module org { module openoffice { module msforms { -interface XLineFormat : org::openoffice::vba::XHelperInterface +module ooo { module vba { module msforms { +interface XLineFormat : ooo::vba::XHelperInterface { [attribute] long BeginArrowheadStyle; [attribute] long BeginArrowheadLength; diff --git a/oovbaapi/org/openoffice/msforms/XListBox.idl b/oovbaapi/ooo/vba/msforms/XListBox.idl index b302ef94b162..98849a4bc884 100644 --- a/oovbaapi/org/openoffice/msforms/XListBox.idl +++ b/oovbaapi/ooo/vba/msforms/XListBox.idl @@ -27,15 +27,15 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XListBox_idl__ -#define __org_openoffice_msforms_XListBox_idl__ +#ifndef __ooo_vba_msforms_XListBox_idl__ +#define __ooo_vba_msforms_XListBox_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif //============================================================================= -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { //============================================================================= @@ -44,10 +44,13 @@ interface XListBox: com::sun::star::uno::XInterface [attribute] any Value; [attribute] string Text; [attribute] boolean MultiSelect; - //[attribute] sequence< boolean > Selected; + [attribute] any ListIndex; + [attribute, readonly ] long ListCount; void AddItem( [in] any pvargItem, [in] any pvargIndex ); + void removeItem( [in] any index ); void Clear(); any Selected( [in] long index ); + any List( [in] any pvargIndex, [in] any pvarColumn ); }; //============================================================================= diff --git a/oovbaapi/ooo/vba/msforms/XMultiPage.idl b/oovbaapi/ooo/vba/msforms/XMultiPage.idl new file mode 100644 index 000000000000..d4a1f15c7b9e --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XMultiPage.idl @@ -0,0 +1,58 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XMultiPage_idl__ +#define __ooo_vba_msforms_XMultiPage_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { + +//============================================================================= +interface XMultiPage: com::sun::star::uno::XInterface +{ + [attribute] long Value; + any Pages( [in] any index ); +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/msforms/XPages.idl b/oovbaapi/ooo/vba/msforms/XPages.idl new file mode 100644 index 000000000000..f78ce3435919 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XPages.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XPage_idl__ +#define __ooo_vba_msforms_XPage_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> +#endif + +//============================================================================= + +module ooo { module vba { module msforms { + +//============================================================================= +interface XPages +{ + interface ooo::vba::XCollection; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/org/openoffice/msforms/XPictureFormat.idl b/oovbaapi/ooo/vba/msforms/XPictureFormat.idl index 7f490c6c5817..b9fd1c9a2cb0 100644 --- a/oovbaapi/org/openoffice/msforms/XPictureFormat.idl +++ b/oovbaapi/ooo/vba/msforms/XPictureFormat.idl @@ -27,16 +27,16 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XPictureFormat_idl__ -#define __org_openoffice_msforms_XPictureFormat_idl__ +#ifndef __ooo_vba_msforms_XPictureFormat_idl__ +#define __ooo_vba_msforms_XPictureFormat_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -module org { module openoffice { module msforms { -interface XPictureFormat : org::openoffice::vba::XHelperInterface +module ooo { module vba { module msforms { +interface XPictureFormat : ooo::vba::XHelperInterface { [attribute] double Brightness; [attribute] double Contrast; diff --git a/oovbaapi/ooo/vba/msforms/XProgressBar.idl b/oovbaapi/ooo/vba/msforms/XProgressBar.idl new file mode 100644 index 000000000000..1dea689b3bbb --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XProgressBar.idl @@ -0,0 +1,57 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XProgressBar_idl__ +#define __ooo_vba_msforms_XProgressBar_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { + +//============================================================================= +interface XProgressBar: com::sun::star::uno::XInterface +{ + [attribute] any Value; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/org/openoffice/msforms/XRadioButton.idl b/oovbaapi/ooo/vba/msforms/XRadioButton.idl index a94b8cd80749..80234913e6c6 100644 --- a/oovbaapi/org/openoffice/msforms/XRadioButton.idl +++ b/oovbaapi/ooo/vba/msforms/XRadioButton.idl @@ -27,21 +27,21 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XRadioButton_idl__ -#define __org_openoffice_msforms_XRadioButton_idl__ +#ifndef __ooo_vba_msforms_XRadioButton_idl__ +#define __ooo_vba_msforms_XRadioButton_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif //============================================================================= -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { //============================================================================= interface XRadioButton: com::sun::star::uno::XInterface { [attribute] string Caption; - [attribute] boolean Value; + [attribute] any Value; }; //============================================================================= diff --git a/oovbaapi/ooo/vba/msforms/XScrollBar.idl b/oovbaapi/ooo/vba/msforms/XScrollBar.idl new file mode 100644 index 000000000000..1f4f7277d7d7 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XScrollBar.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XScrollBar_idl__ +#define __ooo_vba_msforms_XScrollBar_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { + +//============================================================================= +interface XScrollBar: com::sun::star::uno::XInterface +{ + [attribute] long Max; + [attribute] long Min; + [attribute] any Value; + [attribute] long LargeChange; + [attribute] long SmallChange; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/org/openoffice/msforms/XShape.idl b/oovbaapi/ooo/vba/msforms/XShape.idl index d47263bfa691..e43726134680 100644 --- a/oovbaapi/org/openoffice/msforms/XShape.idl +++ b/oovbaapi/ooo/vba/msforms/XShape.idl @@ -27,32 +27,32 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XShape_idl__ -#define __org_openoffice_msforms_XShape_idl__ +#ifndef __ooo_vba_msforms_XShape_idl__ +#define __ooo_vba_msforms_XShape_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_excel_XTextFrame_idl__ -#include <org/openoffice/excel/XTextFrame.idl> +#ifndef __ooo_vba_excel_XTextFrame_idl__ +#include <ooo/vba/excel/XTextFrame.idl> #endif -#ifndef __org_openoffice_msforms_XLineFormat_idl__ -#include <org/openoffice/msforms/XLineFormat.idl> +#ifndef __ooo_vba_msforms_XLineFormat_idl__ +#include <ooo/vba/msforms/XLineFormat.idl> #endif -#ifndef __org_openoffice_msforms_XFillFormat_idl__ -#include <org/openoffice/msforms/XFillFormat.idl> +#ifndef __ooo_vba_msforms_XFillFormat_idl__ +#include <ooo/vba/msforms/XFillFormat.idl> #endif -#ifndef __org_openoffice_msforms_XPictureFormat_idl__ -#include <org/openoffice/msforms/XPictureFormat.idl> +#ifndef __ooo_vba_msforms_XPictureFormat_idl__ +#include <ooo/vba/msforms/XPictureFormat.idl> #endif -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { interface XShapeRange; -interface XShape : org::openoffice::vba::XHelperInterface +interface XShape : ooo::vba::XHelperInterface { [attribute] string Name; [attribute] double Height; @@ -73,7 +73,7 @@ interface XShape : org::openoffice::vba::XHelperInterface [attribute] RelativeVerticalPosition [attribute] XWrapFormat WrapFormat; */ - org::openoffice::excel::XTextFrame TextFrame(); + ooo::vba::excel::XTextFrame TextFrame(); void Delete(); void ZOrder( [in] long ZOrderCmd ); void IncrementRotation( [in] double Increment ); diff --git a/oovbaapi/org/openoffice/msforms/XShapeRange.idl b/oovbaapi/ooo/vba/msforms/XShapeRange.idl index 914362cdbb5c..e0ceb79f94bd 100644 --- a/oovbaapi/org/openoffice/msforms/XShapeRange.idl +++ b/oovbaapi/ooo/vba/msforms/XShapeRange.idl @@ -27,26 +27,26 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XShapeRange_idl__ -#define __org_openoffice_msforms_XShapeRange_idl__ +#ifndef __ooo_vba_msforms_XShapeRange_idl__ +#define __ooo_vba_msforms_XShapeRange_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_msforms_XShape_idl__ -#include <org/openoffice/msforms/XShape.idl> +#ifndef __ooo_vba_msforms_XShape_idl__ +#include <ooo/vba/msforms/XShape.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { interface XShapeRange { - interface org::openoffice::vba::XCollection; + interface ooo::vba::XCollection; void Select(); XShape Group(); void IncrementRotation( [in] double Increment ); diff --git a/oovbaapi/org/openoffice/msforms/XShapes.idl b/oovbaapi/ooo/vba/msforms/XShapes.idl index 1081902d8323..3d49fbc0701b 100644 --- a/oovbaapi/org/openoffice/msforms/XShapes.idl +++ b/oovbaapi/ooo/vba/msforms/XShapes.idl @@ -27,23 +27,23 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XShapes_idl__ -#define __org_openoffice_msforms_XShapes_idl__ +#ifndef __ooo_vba_msforms_XShapes_idl__ +#define __ooo_vba_msforms_XShapes_idl__ -#ifndef __org_openoffice_vba_XHelperInterface_idl__ -#include <org/openoffice/vba/XHelperInterface.idl> +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> #endif -#ifndef __org_openoffice_vba_XCollection_idl__ -#include <org/openoffice/vba/XCollection.idl> +#ifndef __ooo_vba_XCollection_idl__ +#include <ooo/vba/XCollection.idl> #endif -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { interface XShapeRange; interface XShape; interface XShapes { - interface org::openoffice::vba::XCollection; + interface ooo::vba::XCollection; void SelectAll(); XShapeRange Range( [in] any shapes ); /* diff --git a/oovbaapi/ooo/vba/msforms/XSpinButton.idl b/oovbaapi/ooo/vba/msforms/XSpinButton.idl new file mode 100644 index 000000000000..c1d306fc0b3f --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XSpinButton.idl @@ -0,0 +1,59 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XSpinButton_idl__ +#define __ooo_vba_msforms_XSpinButton_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { + +//============================================================================= +interface XSpinButton: com::sun::star::uno::XInterface +{ + [attribute] long Max; + [attribute] long Min; + [attribute] any Value; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/org/openoffice/msforms/XTextBox.idl b/oovbaapi/ooo/vba/msforms/XTextBox.idl index feb16f6779a1..ede3e846ffaf 100644 --- a/oovbaapi/org/openoffice/msforms/XTextBox.idl +++ b/oovbaapi/ooo/vba/msforms/XTextBox.idl @@ -27,21 +27,21 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __org_openoffice_msforms_XTextBox_idl__ -#define __org_openoffice_msforms_XTextBox_idl__ +#ifndef __ooo_vba_msforms_XTextBox_idl__ +#define __ooo_vba_msforms_XTextBox_idl__ #ifndef __com_sun_star_uno_XInterface_idl__ #include <com/sun/star/uno/XInterface.idl> #endif //============================================================================= -module org { module openoffice { module msforms { +module ooo { module vba { module msforms { //============================================================================= interface XTextBox: com::sun::star::uno::XInterface { [attribute] string Text; -// [attribute] any Value; + [attribute] any Value; [attribute] long MaxLength; [attribute] boolean Multiline; }; diff --git a/oovbaapi/ooo/vba/msforms/XTextBoxShape.idl b/oovbaapi/ooo/vba/msforms/XTextBoxShape.idl new file mode 100644 index 000000000000..6b1bf08fad07 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XTextBoxShape.idl @@ -0,0 +1,61 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XTextBoxShape_idl__ +#define __ooo_vba_msforms_XTextBoxShape_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +#ifndef __ooo_vba_excel_XCharacters_idl +#include <ooo/vba/excel/XCharacters.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { + +//============================================================================= +interface XTextBoxShape: com::sun::star::uno::XInterface +{ + [attribute] string Text; + ::ooo::vba::excel::XCharacters characters([in] any Start, [in] any Length); +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/msforms/XToggleButton.idl b/oovbaapi/ooo/vba/msforms/XToggleButton.idl new file mode 100644 index 000000000000..7031b8ccd437 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XToggleButton.idl @@ -0,0 +1,60 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XToggleButton_idl__ +#define __ooo_vba_msforms_XToggleButton_idl__ + +#ifndef __ooo_vba_msforms_XButton_idl__ +#include <ooo/vba/msforms/XButton.idl> +#endif +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif +//============================================================================= + +module ooo { module vba { module msforms { +//============================================================================= +interface XToggleButton +{ + interface XButton; + [attribute] any Value; +}; + +//============================================================================= + +}; }; }; + +#endif + + diff --git a/oovbaapi/ooo/vba/msforms/XUserForm.idl b/oovbaapi/ooo/vba/msforms/XUserForm.idl new file mode 100644 index 000000000000..608fe8480ef0 --- /dev/null +++ b/oovbaapi/ooo/vba/msforms/XUserForm.idl @@ -0,0 +1,58 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef __ooo_vba_msforms_XUserForm_idl__ +#define __ooo_vba_msforms_XUserForm_idl__ + +#ifndef __ooo_vba_XHelperInterface_idl__ +#include <ooo/vba/XHelperInterface.idl> +#endif +#ifndef __com_sun_star_script_XInvocation_idl__ +#include <com/sun/star/script/XInvocation.idl> +#endif +module ooo { module vba { module msforms { +interface XUserForm +{ + //interface ::ooo::vba::XHelperInterface; + interface ::com::sun::star::script::XInvocation; + [attribute] string Caption; + void Show(); + void Hide(); + void RePaint(); + void UnloadObject(); + any Controls( [in] any index ); +}; +}; }; }; + +#endif diff --git a/oovbaapi/org/openoffice/msforms/makefile.mk b/oovbaapi/ooo/vba/msforms/makefile.mk index a8984dd62519..f6549931444b 100644 --- a/oovbaapi/org/openoffice/msforms/makefile.mk +++ b/oovbaapi/ooo/vba/msforms/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/..$/.. PRJNAME=oovbapi TARGET=msforms -PACKAGE=org$/openoffice$/msforms +PACKAGE=ooo$/vba$/msforms # --- Settings ----------------------------------------------------- .INCLUDE : $(PRJ)$/util$/makefile.pmk @@ -60,7 +60,17 @@ IDLFILES=\ XFillFormat.idl \ XPictureFormat.idl \ XShapeRange.idl \ - XListBox.idl + XTextBoxShape.idl \ + XUserForm.idl \ + XListBox.idl \ + XToggleButton.idl \ + XScrollBar.idl \ + XProgressBar.idl \ + XMultiPage.idl \ + XPages.idl \ + XSpinButton.idl \ + XImage.idl \ + XControls.idl \ # ------------------------------------------------------------------ diff --git a/oovbaapi/prj/build.lst b/oovbaapi/prj/build.lst index afc88692586f..bc34a4f376ff 100644 --- a/oovbaapi/prj/build.lst +++ b/oovbaapi/prj/build.lst @@ -1,8 +1,8 @@ ovba oovbaapi : offapi solenv NULL -ovba oovbaapi usr1 - all ovba_mkout NULL -ovba oovbaapi\genconstidl nmake - all ovba_genconstidl NULL -ovba oovbaapi\org\openoffice\constants nmake - all ovba_constants ovba_genconstidl NULL -ovba oovbaapi\org\openoffice\vba nmake - all ovba_vba NULL -ovba oovbaapi\org\openoffice\excel nmake - all ovba_excel NULL -ovba oovbaapi\org\openoffice\msforms nmake - all ovba_msforms NULL -ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_msforms ovba_constants ovba_genconstidl NULL +ovba oovbaapi usr1 - all ovba_mkout NULL +ovba oovbaapi\genconstidl nmake - all ovba_genconstidl NULL +ovba oovbaapi\ooo\vba\constants nmake - all ovba_constants ovba_genconstidl NULL +ovba oovbaapi\ooo\vba nmake - all ovba_vba NULL +ovba oovbaapi\ooo\vba\excel nmake - all ovba_excel NULL +ovba oovbaapi\ooo\vba\msforms nmake - all ovba_msforms NULL +ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_msforms ovba_constants ovba_genconstidl NULL diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm index 3ab8636e0125..b595911b2a98 100755 --- a/readlicense_oo/docs/readme/readme.xrm +++ b/readlicense_oo/docs/readme/readme.xrm @@ -339,7 +339,7 @@ <Paragraph id="F2c" os="all"> <Text id="access7" xml:lang="en-US">For information on the accessibility features in ${PRODUCTNAME}, see </Text> - <Text id="abdfs2b" url="true" path="url" xml:lang="en-US">http://www.openoffice.org/access/</Text> + <Text id="abdfs2b" url="true" xml:lang="en-US">http://www.openoffice.org/access/</Text> <Text id="abdfs2c" xml:lang="en-US">.</Text> </Paragraph> diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index 55f17a9c1725..64b775cccebf 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -131,7 +131,7 @@ namespace basprov throw provider::ScriptFrameworkErrorException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "wrong number of paramters!" ) ), + "wrong number of parameters!" ) ), Reference< XInterface >(), m_funcName, ::rtl::OUString( diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 50b4a73388c2..6a6b6dbbbb4a 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -54,7 +54,7 @@ #include <com/sun/star/beans/MethodConcept.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> #ifdef FAKE_VBA_EVENT_SUPPORT -#include <org/openoffice/vba/XVBAToOOEventDescGen.hpp> +#include <ooo/vba/XVBAToOOEventDescGen.hpp> #endif using namespace ::com::sun::star; @@ -125,7 +125,7 @@ namespace dlgprov { Sequence< Any > args(1); args[0] <<= xModel; - mxListener = Reference< XScriptListener >( xSMgr->createInstanceWithArgumentsAndContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.EventListener" ) ), args, m_xContext ), UNO_QUERY ); + mxListener = Reference< XScriptListener >( xSMgr->createInstanceWithArgumentsAndContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), args, m_xContext ), UNO_QUERY ); } if ( rxControl.is() ) { @@ -199,7 +199,7 @@ namespace dlgprov Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); if ( xSMgr.is() ) { - Reference< org::openoffice::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY ); + Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY ); if ( xVBAToOOEvtDesc.is() ) xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl ), UNO_QUERY ); diff --git a/scripting/source/pyprov/officehelper.py b/scripting/source/pyprov/officehelper.py index 7119169741fd..5e6bd1cd9409 100644 --- a/scripting/source/pyprov/officehelper.py +++ b/scripting/source/pyprov/officehelper.py @@ -54,7 +54,11 @@ def bootstrap(): """ try: # soffice script used on *ix, Mac; soffice.exe used on Windoof - sOffice = os.path.join(os.path.dirname(__file__), "soffice") + if "UNO_PATH" in os.environ: + sOffice = os.environ["UNO_PATH"] + else: + sOffice = "" # lets hope for the best + sOffice = os.path.join(sOffice, "soffice") if platform.startswith("win"): sOffice += ".exe" diff --git a/sfx2/inc/sfx2/dockwin.hxx b/sfx2/inc/sfx2/dockwin.hxx index 79727b628a92..7784ea2b9505 100644 --- a/sfx2/inc/sfx2/dockwin.hxx +++ b/sfx2/inc/sfx2/dockwin.hxx @@ -1,145 +1,145 @@ -/*************************************************************************
- *
- * 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: dockwin.hxx,v $
- * $Revision: 1.4 $
- *
- * 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 _SFXDOCKWIN_HXX
-#define _SFXDOCKWIN_HXX
-
-#include "sal/config.h"
-#include "sal/types.h"
-#include <vcl/dockwin.hxx>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-
-#include "sfx2/dllapi.h"
-#include <sfx2/childwin.hxx>
-
-class SfxSplitWindow;
-class SfxDockingWindow_Impl;
-
-void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
-bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
-
-class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
-{
-private:
- Rectangle aInnerRect;
- Rectangle aOuterRect;
- SfxBindings* pBindings;
- Size aFloatSize;
- SfxChildWindow* pMgr;
- SfxDockingWindow_Impl* pImp;
-
- SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined
- SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined
-
-protected:
- SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect );
- void CalcSplitPosition(const Point rPos, Rectangle& rRect,
- SfxChildAlignment eAlign);
- virtual Size CalcDockingSize(SfxChildAlignment);
- virtual SfxChildAlignment
- CheckAlignment(SfxChildAlignment,SfxChildAlignment);
-
- virtual void Resize();
- virtual BOOL PrepareToggleFloatingMode();
- virtual void ToggleFloatingMode();
- virtual void StartDocking();
- virtual BOOL Docking( const Point& rPos, Rectangle& rRect );
- virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode );
- virtual void Resizing( Size& rSize );
- virtual void Paint( const Rectangle& rRect );
- virtual BOOL Close();
- virtual void Move();
-
-//#if 0 // _SOLAR__PRIVATE
- SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
-//#endif
-
-public:
- SfxDockingWindow( SfxBindings *pBindings,
- SfxChildWindow *pCW,
- Window* pParent,
- WinBits nWinBits=0);
- SfxDockingWindow( SfxBindings *pBindings,
- SfxChildWindow *pCW,
- Window* pParent,
- const ResId& rResId);
- ~SfxDockingWindow();
-
- void Initialize (SfxChildWinInfo* pInfo);
- virtual void FillInfo(SfxChildWinInfo&) const;
- virtual void StateChanged( StateChangedType nStateChange );
-
- void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
- { aInnerRect = rInner; aOuterRect = rOuter; }
- const Rectangle& GetInnerRect() const { return aInnerRect; }
- const Rectangle& GetOuterRect() const { return aOuterRect; }
- SfxBindings& GetBindings() const { return *pBindings; }
- USHORT GetType() const { return pMgr->GetType(); }
- SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
- void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
- Size GetFloatingSize() const { return aFloatSize; }
- void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
-
- void SetMinOutputSizePixel( const Size& rSize );
- Size GetMinOutputSizePixel() const;
- virtual long Notify( NotifyEvent& rNEvt );
- virtual void FadeIn( BOOL );
- void AutoShow( BOOL bShow = TRUE );
- DECL_LINK( TimerHdl, Timer* );
-
-//#if 0 // _SOLAR__PRIVATE
- SAL_DLLPRIVATE void Initialize_Impl();
- SAL_DLLPRIVATE USHORT GetWinBits_Impl() const;
- SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
- SAL_DLLPRIVATE void Disappear_Impl();
- SAL_DLLPRIVATE void Reappear_Impl();
- SAL_DLLPRIVATE BOOL IsAutoHide_Impl() const;
- SAL_DLLPRIVATE BOOL IsPinned_Impl() const;
- SAL_DLLPRIVATE void AutoShow_Impl( BOOL bShow = TRUE );
- SAL_DLLPRIVATE void Pin_Impl( BOOL bPinned );
- SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const;
- SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
-//#endif
-};
-
-class SfxDockingWrapper : public SfxChildWindow
-{
- public:
- SfxDockingWrapper( Window* pParent ,
- USHORT nId ,
- SfxBindings* pBindings ,
- SfxChildWinInfo* pInfo );
-
- SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
-};
-
-#endif // #ifndef _SFXDOCKWIN_HXX
+/************************************************************************* + * + * 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: dockwin.hxx,v $ + * $Revision: 1.4 $ + * + * 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 _SFXDOCKWIN_HXX +#define _SFXDOCKWIN_HXX + +#include "sal/config.h" +#include "sal/types.h" +#include <vcl/dockwin.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include "sfx2/dllapi.h" +#include <sfx2/childwin.hxx> + +class SfxSplitWindow; +class SfxDockingWindow_Impl; + +void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName ); +bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName ); + +class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow +{ +private: + Rectangle aInnerRect; + Rectangle aOuterRect; + SfxBindings* pBindings; + Size aFloatSize; + SfxChildWindow* pMgr; + SfxDockingWindow_Impl* pImp; + + SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined + SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined + +protected: + SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect ); + void CalcSplitPosition(const Point rPos, Rectangle& rRect, + SfxChildAlignment eAlign); + virtual Size CalcDockingSize(SfxChildAlignment); + virtual SfxChildAlignment + CheckAlignment(SfxChildAlignment,SfxChildAlignment); + + virtual void Resize(); + virtual BOOL PrepareToggleFloatingMode(); + virtual void ToggleFloatingMode(); + virtual void StartDocking(); + virtual BOOL Docking( const Point& rPos, Rectangle& rRect ); + virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode ); + virtual void Resizing( Size& rSize ); + virtual void Paint( const Rectangle& rRect ); + virtual BOOL Close(); + virtual void Move(); + +//#if 0 // _SOLAR__PRIVATE + SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; } +//#endif + +public: + SfxDockingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + Window* pParent, + WinBits nWinBits=0); + SfxDockingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + Window* pParent, + const ResId& rResId); + ~SfxDockingWindow(); + + void Initialize (SfxChildWinInfo* pInfo); + virtual void FillInfo(SfxChildWinInfo&) const; + virtual void StateChanged( StateChangedType nStateChange ); + + void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner) + { aInnerRect = rInner; aOuterRect = rOuter; } + const Rectangle& GetInnerRect() const { return aInnerRect; } + const Rectangle& GetOuterRect() const { return aOuterRect; } + SfxBindings& GetBindings() const { return *pBindings; } + USHORT GetType() const { return pMgr->GetType(); } + SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); } + void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); } + Size GetFloatingSize() const { return aFloatSize; } + void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; } + + void SetMinOutputSizePixel( const Size& rSize ); + Size GetMinOutputSizePixel() const; + virtual long Notify( NotifyEvent& rNEvt ); + virtual void FadeIn( BOOL ); + void AutoShow( BOOL bShow = TRUE ); + DECL_LINK( TimerHdl, Timer* ); + +//#if 0 // _SOLAR__PRIVATE + SAL_DLLPRIVATE void Initialize_Impl(); + SAL_DLLPRIVATE USHORT GetWinBits_Impl() const; + SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize ); + SAL_DLLPRIVATE void Disappear_Impl(); + SAL_DLLPRIVATE void Reappear_Impl(); + SAL_DLLPRIVATE BOOL IsAutoHide_Impl() const; + SAL_DLLPRIVATE BOOL IsPinned_Impl() const; + SAL_DLLPRIVATE void AutoShow_Impl( BOOL bShow = TRUE ); + SAL_DLLPRIVATE void Pin_Impl( BOOL bPinned ); + SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const; + SAL_DLLPRIVATE void ReleaseChildWindow_Impl(); +//#endif +}; + +class SfxDockingWrapper : public SfxChildWindow +{ + public: + SfxDockingWrapper( Window* pParent , + USHORT nId , + SfxBindings* pBindings , + SfxChildWinInfo* pInfo ); + + SFX_DECL_CHILDWINDOW(SfxDockingWrapper); +}; + +#endif // #ifndef _SFXDOCKWIN_HXX diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index 4fffe0b96c21..c93af303158c 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -179,7 +179,8 @@ public: sal_Int16 nDialog, SfxFilterFlags nMust, SfxFilterFlags nDont, - const String& rStandardDir); + const String& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList); FileDialogHelper( sal_Int64 nFlags, const String& rFactory, @@ -198,7 +199,8 @@ public: sal_Int16 nDialog, SfxFilterFlags nMust, SfxFilterFlags nDont, - const String& rStandardDir ); + const String& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList); FileDialogHelper( sal_Int64 nFlags ); @@ -211,6 +213,7 @@ public: const ::rtl::OUString& aFilterUIName, const ::rtl::OUString& aExtName, const ::rtl::OUString& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList, Window* _pPreferredParent = NULL ); @@ -330,7 +333,8 @@ ErrCode FileOpenDialog_Impl( sal_Int64 nFlags, SfxItemSet *& rpSet, const String* pPath = NULL, sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG, - const String& rStandardDir = String::CreateFromAscii( "" )); + const String& rStandardDir = String::CreateFromAscii( "" ), + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList = ::com::sun::star::uno::Sequence< ::rtl::OUString >()); //#endif } diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 64c7028dc0b1..b41ea004f3e3 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -296,7 +296,8 @@ #define SID_GRAFIC_DIALOG (SID_SFX_START + 305) #define SID_PATH (SID_SFX_START + 308) #define SID_SAVEDOCS (SID_SFX_START + 309) -#define SID_STANDARD_DIR (SID_SFX_START + 310) +#define SID_STANDARD_DIR (SID_SFX_START + 450) +#define SID_BLACK_LIST (SID_SFX_START + 451) // browse-ids #define SID_BROWSE_FORWARD (SID_SFX_START + 1300) @@ -569,7 +570,8 @@ #define SID_OPTIONS_PAGEURL (SID_SFX_START + 1713) #define SID_MORE_DICTIONARIES (SID_SFX_START + 1714) #define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715) -#define SID_SFX_free_START (SID_SFX_START + 1716) +#define SID_DEFAULTFILENAME (SID_SFX_START + 1716) +#define SID_SFX_free_START (SID_SFX_START + 1717) #define SID_SFX_free_END (SID_SFX_START + 3999) #define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index bc74b1be3946..b8597d853ddd 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -1646,7 +1646,34 @@ SfxStringItem DefaultFilePath SID_DEFAULTFILEPATH RecordPerSet; Synchron; - Readonly = FALSE, + Readonly = TRUE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = ; +] + +//-------------------------------------------------------------------------- +SfxStringItem DefaultFileName SID_DEFAULTFILENAME + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = TRUE, /* config: */ AccelConfig = FALSE, @@ -4697,7 +4724,7 @@ SfxStringItem OldPALK SID_OLD_PALK //-------------------------------------------------------------------------- SfxObjectItem Open SID_OPENDOC -(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem OpenFlags SID_OPTIONS,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxInt16Item Version SID_VERSION,SfxStringItem Referer SID_REFERER) +(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem OpenFlags SID_OPTIONS,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxInt16Item Version SID_VERSION,SfxStringItem Referer SID_REFERER,SfxStringItem SuggestedSaveAsDir SID_DEFAULTFILEPATH,SfxStringItem SuggestedSaveAsName SID_DEFAULTFILENAME) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 42102e1bee29..c73a40dd75a7 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -52,11 +52,17 @@ #include <com/sun/star/task/ErrorCodeRequest.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/uno/Sequence.h> #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase1.hxx> +#include <rtl/ustring.hxx> + #include <comphelper/storagehelper.hxx> #include <comphelper/synchronousdispatch.hxx> +#include <comphelper/configurationhelper.hxx> +#include <comphelper/sequenceasvector.hxx> #include <vcl/wrkwin.hxx> #include <svtools/intitem.hxx> @@ -90,6 +96,7 @@ #include <sfx2/new.hxx> #include <sfx2/objitem.hxx> #include <sfx2/objsh.hxx> +#include <svtools/slstitm.hxx> #include "objshimp.hxx" #include "openflag.hxx" #include <sfx2/passwd.hxx> @@ -116,6 +123,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::system; using namespace ::com::sun::star::task; +using namespace ::com::sun::star::container; using namespace ::cppu; using namespace ::sfx2; @@ -531,6 +539,13 @@ SfxObjectShellLock SfxApplication::NewDoc_Impl( const String& rFact, const SfxIt { if ( pSet ) { + // TODO/LATER: Should the other arguments be transfered as well? + SFX_ITEMSET_ARG( pSet, pDefaultPathItem, SfxStringItem, SID_DEFAULTFILEPATH, FALSE); + if ( pDefaultPathItem ) + xDoc->GetMedium()->GetItemSet()->Put( *pDefaultPathItem ); + SFX_ITEMSET_ARG( pSet, pDefaultNameItem, SfxStringItem, SID_DEFAULTFILENAME, FALSE); + if ( pDefaultNameItem ) + xDoc->GetMedium()->GetItemSet()->Put( *pDefaultNameItem ); SFX_ITEMSET_ARG( pSet, pTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); if ( pTitleItem ) xDoc->GetMedium()->GetItemSet()->Put( *pTitleItem ); @@ -569,12 +584,22 @@ void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) else aFactName = SvtModuleOptions().GetDefaultModuleName(); + SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, GetPool() ); String aFact = String::CreateFromAscii("private:factory/"); aFact += aFactName; aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) ); aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, GetFrame() ) ); aReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii( "_default" ) ) ); + + // TODO/LATER: Should the other arguments be transfered as well? + SFX_REQUEST_ARG( rReq, pDefaultPathItem, SfxStringItem, SID_DEFAULTFILEPATH, FALSE); + if ( pDefaultPathItem ) + aReq.AppendItem( *pDefaultPathItem ); + SFX_REQUEST_ARG( rReq, pDefaultNameItem, SfxStringItem, SID_DEFAULTFILENAME, FALSE); + if ( pDefaultNameItem ) + aReq.AppendItem( *pDefaultNameItem ); + SFX_APP()->ExecuteSlot( aReq ); const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); if ( pItem ) @@ -873,8 +898,15 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if ( pStandardDirItem ) sStandardDir = pStandardDirItem->GetValue(); + ::com::sun::star::uno::Sequence< ::rtl::OUString > aBlackList; + + SFX_REQUEST_ARG( rReq, pBlackListItem, SfxStringListItem, SID_BLACK_LIST, FALSE ); + if ( pBlackListItem ) + pBlackListItem->GetStringList( aBlackList ); + + ULONG nErr = sfx2::FileOpenDialog_Impl( - WB_OPEN | SFXWB_MULTISELECTION | SFXWB_SHOWVERSIONS, String(), pURLList, aFilter, pSet, &aPath, nDialog, sStandardDir ); + WB_OPEN | SFXWB_MULTISELECTION | SFXWB_SHOWVERSIONS, String(), pURLList, aFilter, pSet, &aPath, nDialog, sStandardDir, aBlackList ); if ( nErr == ERRCODE_ABORT ) { @@ -1120,12 +1152,18 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) const SfxFilter* pFilter = rMatcher.GetFilter4EA( aTypeName ); if ( !pFilter || !( pFilter->IsOwnFormat() )) { - // hyperlink does not link to known type => special handling (http, ftp) browser and (file) OS + // hyperlink does not link to own type => special handling (http, ftp) browser and (other external protocols) OS Reference< XSystemShellExecute > xSystemShellExecute( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), UNO_QUERY ); if ( xSystemShellExecute.is() ) { - if ( aINetProtocol == INET_PROT_FTP || + if ( aINetProtocol == INET_PROT_MAILTO ) + { + // don't dispatch mailto hyperlink to desktop dispatcher + rReq.RemoveItem( SID_TARGETNAME ); + rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_self") ) ); + } + else if ( aINetProtocol == INET_PROT_FTP || aINetProtocol == INET_PROT_HTTP || aINetProtocol == INET_PROT_HTTPS ) { @@ -1150,56 +1188,105 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) return; } - else if ( aINetProtocol == INET_PROT_FILE ) + else { - BOOL bLoadInternal = FALSE; + // check for "internal" protocols that should not be forwarded to the system + Sequence < ::rtl::OUString > aProtocols(2); - // security reservation: => we have to check the referer before executing - if (SFX_APP()->IsSecureURL(rtl::OUString(), &aReferer)) - { - ::rtl::OUString aURLString( aURL.Complete ); + // add special protocols that always should be treated as internal + aProtocols[0] = ::rtl::OUString::createFromAscii("private:*"); + aProtocols[1] = ::rtl::OUString::createFromAscii("vnd.sun.star.*"); - try + try + { + // get registered protocol handlers from configuration + Reference < XNameAccess > xAccess( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), + ::rtl::OUString::createFromAscii("org.openoffice.Office.ProtocolHandler/HandlerSet"), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); + if ( xAccess.is() ) { - // give os this file - xSystemShellExecute->execute( aURLString, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); + Sequence < ::rtl::OUString > aNames = xAccess->getElementNames(); + for ( sal_Int32 nName = 0; nName < aNames.getLength(); nName ++) + { + Reference < XPropertySet > xSet; + Any aRet = xAccess->getByName( aNames[nName] ); + aRet >>= xSet; + if ( xSet.is() ) + { + // copy protocols + aRet = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("Protocols") ); + Sequence < ::rtl::OUString > aTmp; + aRet >>= aTmp; + + // todo: add operator+= to SequenceAsVector class and use SequenceAsVector for aProtocols + sal_Int32 nLength = aProtocols.getLength(); + aProtocols.realloc( nLength+aTmp.getLength() ); + for ( sal_Int32 n=0; n<aTmp.getLength(); n++ ) + aProtocols[(++nLength)-1] = aTmp[n]; + } + } } - catch ( ::com::sun::star::lang::IllegalArgumentException& ) + } + catch ( Exception& ) + { + // registered protocols could not be read + } + + sal_Bool bFound = sal_False; + for ( sal_Int32 nProt=0; nProt<aProtocols.getLength(); nProt++ ) + { + WildCard aPattern(aProtocols[nProt]); + if ( aPattern.Matches( aURL.Complete ) ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window *pWindow = SFX_APP()->GetTopWindow(); - ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); + bFound = sal_True; + break; } - catch ( ::com::sun::star::system::SystemShellExecuteException& ) + } + + if ( !bFound ) + { + BOOL bLoadInternal = FALSE; + + // security reservation: => we have to check the referer before executing + if (SFX_APP()->IsSecureURL(rtl::OUString(), &aReferer)) { - if ( !pFilter ) + ::rtl::OUString aURLString( aURL.Complete ); + + try + { + // give os this file + xSystemShellExecute->execute( aURLString, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); + } + catch ( ::com::sun::star::lang::IllegalArgumentException& ) { vos::OGuard aGuard( Application::GetSolarMutex() ); Window *pWindow = SFX_APP()->GetTopWindow(); ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); } - else + catch ( ::com::sun::star::system::SystemShellExecuteException& ) { - rReq.RemoveItem( SID_TARGETNAME ); - rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_default") ) ); - bLoadInternal = TRUE; + if ( !pFilter ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window *pWindow = SFX_APP()->GetTopWindow(); + ErrorBox( pWindow, SfxResId( MSG_ERR_NO_WEBBROWSER_FOUND )).Execute(); + } + else + { + rReq.RemoveItem( SID_TARGETNAME ); + rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_default") ) ); + bLoadInternal = TRUE; + } } } - } - else - { - SfxErrorContext aCtx( ERRCTX_SFX_OPENDOC, aURL.Complete ); - ErrorHandler::HandleError( ERRCODE_IO_ACCESSDENIED ); - } + else + { + SfxErrorContext aCtx( ERRCTX_SFX_OPENDOC, aURL.Complete ); + ErrorHandler::HandleError( ERRCODE_IO_ACCESSDENIED ); + } - if ( !bLoadInternal ) - return; - } - else if ( aINetProtocol == INET_PROT_MAILTO ) - { - // don't dispatch mailto hyperlink to desktop dispatcher - rReq.RemoveItem( SID_TARGETNAME ); - rReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii("_self") ) ); + if ( !bLoadInternal ) + return; + } } } } diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index f455dd24a869..90b12b484a01 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -63,6 +63,7 @@ #include <svtools/ownlist.hxx> #include <svtools/lckbitem.hxx> #include <svtools/stritem.hxx> +#include <svtools/slstitm.hxx> #include <svtools/intitem.hxx> #include <svtools/eitem.hxx> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> @@ -193,6 +194,7 @@ static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); static const String sFolderName = String::CreateFromAscii( "FolderName" ); static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); +static const String sBlackList = String::CreateFromAscii( "BlackList" ); void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -683,10 +685,22 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); - DBG_ASSERT( bOK, "invalid type or value for FileName" ); + DBG_ASSERT( bOK, "invalid type or value for StanadardDir" ); if (bOK) rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) ); } + else if ( aName == sBlackList ) + { + ::com::sun::star::uno::Sequence< ::rtl::OUString > xVal; + sal_Bool bOK = (rProp.Value >>= xVal); + DBG_ASSERT( bOK, "invalid type or value for BlackList" ); + if (bOK) + { + SfxStringListItem stringList(SID_BLACK_LIST); + stringList.SetStringList( xVal ); + rSet.Put( stringList ); + } + } else if ( aName == sFileName ) { ::rtl::OUString sVal; @@ -974,6 +988,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_STANDARD_DIR ) == SFX_ITEM_SET ) nAdditional++; + if ( rSet.GetItemState( SID_BLACK_LIST ) == SFX_ITEM_SET ) + nAdditional++; if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET ) nAdditional++; if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET ) @@ -1157,6 +1173,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta continue; if ( nId == SID_STANDARD_DIR ) continue; + if ( nId == SID_BLACK_LIST ) + continue; if ( nId == SID_CONTENTTYPE ) continue; if ( nId == SID_WIN_POSSIZE ) @@ -1454,6 +1472,14 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = sStandardDir; pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } + if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = sBlackList; + + com::sun::star::uno::Sequence< rtl::OUString > aList; + ((SfxStringListItem*)pItem)->GetStringList( aList ); + pValue[nActProp++].Value <<= aList ; + } if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sFrameName; diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 1e0378bbd988..1bad9adc53aa 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -373,6 +373,7 @@ BOOL SfxHTMLParser::ParseMetaOptions( case HTML_META_CHANGEDBY: if (i_xDocProps.is()) { i_xDocProps->setModifiedBy( aContent ); + bChanged = TRUE; } break; @@ -403,6 +404,7 @@ BOOL SfxHTMLParser::ParseMetaOptions( case HTML_META_CONTENT_TYPE: if( aContent.Len() ) rEnc = GetEncodingByMIME( aContent ); + bChanged = TRUE; break; case HTML_META_NONE: diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 228eecfb6ce5..34deb24bcc32 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1544,8 +1544,17 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* if ( pCache && pCache->GetDispatch().is() ) { + DBG_ASSERT( !ppInternalArgs, "Internal args get lost when dispatched!" ); + + SfxItemPool &rPool = GetDispatcher()->GetFrame()->GetObjectShell()->GetPool(); + SfxRequest aReq( nId, nCallMode, rPool ); + aReq.SetModifier( nModi ); + if( ppItems ) + while( *ppItems ) + aReq.AppendItem( **ppItems++ ); + // cache binds to an external dispatch provider - pCache->Dispatch( nCallMode == SFX_CALLMODE_SYNCHRON ); + pCache->Dispatch( aReq.GetArgs(), nCallMode == SFX_CALLMODE_SYNCHRON ); if ( bDeleteCache ) DELETEZ( pCache ); SfxPoolItem *pVoid = new SfxVoidItem( nId ); diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index f72d8573df6c..cb7e0f042f0d 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: statcach.cxx,v $ - * $Revision: 1.36 $ + * $Revision: 1.36.180.1 $ * * This file is part of OpenOffice.org. * @@ -44,6 +44,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/FrameActionEvent.hpp> #include <com/sun/star/frame/FrameAction.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> #include <cppuhelper/weak.hxx> #include <svtools/eitem.hxx> #include <svtools/intitem.hxx> @@ -55,6 +56,7 @@ #endif #include <sfx2/app.hxx> +#include <sfx2/appuno.hxx> #include "statcach.hxx" #include <sfx2/msg.hxx> #include <sfx2/ctrlitem.hxx> @@ -65,6 +67,7 @@ #include <sfx2/msgpool.hxx> #include <sfx2/viewfrm.hxx> +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; @@ -191,13 +194,14 @@ const ::com::sun::star::frame::FeatureStateEvent& BindDispatch_Impl::GetStatus() return aStatus; } -void BindDispatch_Impl::Dispatch( sal_Bool bForceSynchron ) +void BindDispatch_Impl::Dispatch( uno::Sequence < beans::PropertyValue > aProps, sal_Bool bForceSynchron ) { if ( xDisp.is() && aStatus.IsEnabled ) { - ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > aProps(1); - aProps.getArray()[0].Name = DEFINE_CONST_UNICODE("SynchronMode"); - aProps.getArray()[0].Value <<= bForceSynchron ; + sal_Int32 nLength = aProps.getLength(); + aProps.realloc(nLength+1); + aProps[nLength].Name = DEFINE_CONST_UNICODE("SynchronMode"); + aProps[nLength].Value <<= bForceSynchron ; xDisp->dispatch( aURL, aProps ); } } @@ -560,12 +564,17 @@ void SfxStateCache::DeleteFloatingWindows() return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > (); } -void SfxStateCache::Dispatch( sal_Bool bForceSynchron ) +void SfxStateCache::Dispatch( const SfxItemSet* pSet, sal_Bool bForceSynchron ) { // protect pDispatch against destruction in the call ::com::sun::star::uno::Reference < ::com::sun::star::frame::XStatusListener > xKeepAlive( pDispatch ); if ( pDispatch ) - pDispatch->Dispatch( bForceSynchron ); + { + uno::Sequence < beans::PropertyValue > aArgs; + if (pSet) + TransformItems( nId, *pSet, aArgs ); + pDispatch->Dispatch( aArgs, bForceSynchron ); + } } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 7e24fdca9639..de74d88ab631 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -88,6 +88,7 @@ #include <svtools/pickerhelper.hxx> #include <svtools/docpasswdrequest.hxx> #include <ucbhelper/content.hxx> +#include <ucbhelper/commandenvironment.hxx> #include <comphelper/storagehelper.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <sfx2/app.hxx> @@ -904,7 +905,15 @@ sal_Bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker >& _rxFP ) // ----------- FileDialogHelper_Impl --------------------------- // ------------------------------------------------------------------------ -FileDialogHelper_Impl::FileDialogHelper_Impl( FileDialogHelper* _pAntiImpl, sal_Int16 nDialogType, sal_Int64 nFlags, sal_Int16 nDialog, Window* _pPreferredParentWindow, const String& sStandardDir ) +FileDialogHelper_Impl::FileDialogHelper_Impl( + FileDialogHelper* _pAntiImpl, + sal_Int16 nDialogType, + sal_Int64 nFlags, + sal_Int16 nDialog, + Window* _pPreferredParentWindow, + const String& sStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList + ) :m_nDialogType ( nDialogType ) ,meContext ( FileDialogHelper::UNKNOWN_CONTEXT ) { @@ -1065,7 +1074,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( FileDialogHelper* _pAntiImpl, sal_ //Sequence < Any > aInitArguments( mbSystemPicker || !mpPreferredParentWindow ? 1 : 3 ); - Sequence < Any > aInitArguments( !mpPreferredParentWindow ? 2 : 3 ); + Sequence < Any > aInitArguments( !mpPreferredParentWindow ? 3 : 4 ); // This is a hack. We currently know that the internal file picker implementation // supports the extended arguments as specified below. @@ -1089,8 +1098,15 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( FileDialogHelper* _pAntiImpl, sal_ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StandardDir" ) ), makeAny( sStandardDirTemp ) ); + + aInitArguments[2] <<= NamedValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BlackList" ) ), + makeAny( rBlackList ) + ); + + if ( mpPreferredParentWindow ) - aInitArguments[2] <<= NamedValue( + aInitArguments[3] <<= NamedValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface( mpPreferredParentWindow ) ) ); @@ -2298,9 +2314,10 @@ FileDialogHelper::FileDialogHelper( sal_Int16 nDialog, SfxFilterFlags nMust, SfxFilterFlags nDont, - const String& rStandardDir) + const String& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList) { - mpImp = new FileDialogHelper_Impl( this, getDialogType( nFlags ), nFlags, nDialog, NULL , rStandardDir ); + mpImp = new FileDialogHelper_Impl( this, getDialogType( nFlags ), nFlags, nDialog, NULL , rStandardDir, rBlackList ); mxImp = mpImp; // create the list of filters @@ -2353,9 +2370,10 @@ FileDialogHelper::FileDialogHelper( sal_Int16 nDialog, SfxFilterFlags nMust, SfxFilterFlags nDont, - const String& rStandardDir ) + const String& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList) { - mpImp = new FileDialogHelper_Impl( this, nDialogType, nFlags, nDialog, NULL, rStandardDir ); + mpImp = new FileDialogHelper_Impl( this, nDialogType, nFlags, nDialog, NULL, rStandardDir, rBlackList ); mxImp = mpImp; // create the list of filters @@ -2379,9 +2397,10 @@ FileDialogHelper::FileDialogHelper( const ::rtl::OUString& aFilterUIName, const ::rtl::OUString& aExtName, const ::rtl::OUString& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList, Window* _pPreferredParent ) { - mpImp = new FileDialogHelper_Impl( this, nDialogType, nFlags, SFX2_IMPL_DIALOG_CONFIG, _pPreferredParent,rStandardDir ); + mpImp = new FileDialogHelper_Impl( this, nDialogType, nFlags, SFX2_IMPL_DIALOG_CONFIG, _pPreferredParent,rStandardDir, rBlackList ); mxImp = mpImp; // the wildcard here is expected in form "*.extension" @@ -2571,10 +2590,21 @@ ErrCode FileDialogHelper::GetGraphic( Graphic& rGraphic ) const // ------------------------------------------------------------------------ static int impl_isFolder( const OUString& rPath ) { + uno::Reference< task::XInteractionHandler > xHandler; + try + { + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xHandler.set( xFactory->createInstance( DEFINE_CONST_OUSTRING( "com.sun.star.task.InteractionHandler" ) ), + uno::UNO_QUERY_THROW ); + } + catch ( Exception const & ) + { + } + try { ::ucbhelper::Content aContent( - rPath, uno::Reference< ucb::XCommandEnvironment >() ); + rPath, new ::ucbhelper::CommandEnvironment( xHandler, uno::Reference< ucb::XProgressHandler >() ) ); if ( aContent.isFolder() ) return 1; @@ -2733,10 +2763,11 @@ ErrCode FileOpenDialog_Impl( sal_Int64 nFlags, SfxItemSet *& rpSet, const String* pPath, sal_Int16 nDialog, - const String& rStandardDir ) + const String& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList ) { ErrCode nRet; - FileDialogHelper aDialog( nFlags, rFact, nDialog, 0, 0, rStandardDir ); + FileDialogHelper aDialog( nFlags, rFact, nDialog, 0, 0, rStandardDir, rBlackList ); String aPath; if ( pPath ) diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index e747f9427f36..848719547ab4 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -195,7 +195,8 @@ namespace sfx2 sal_Int64 nFlags, sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG, Window* _pPreferredParentWindow = NULL, - const String& sStandardDir = String::CreateFromAscii( "" ) + const String& sStandardDir = String::CreateFromAscii( "" ), + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList = ::com::sun::star::uno::Sequence< ::rtl::OUString >() ); virtual ~FileDialogHelper_Impl(); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index ad87e2867eae..cb2c14893e33 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -758,6 +758,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Sfx pCurObjShell ( NULL ), xModuleManager ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY ), + pbDeleted ( NULL ), aFmtLb ( this, WB_BORDER | WB_TABSTOP | WB_SORT ), aFilterLb ( pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP ), @@ -801,6 +802,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Mod pStyleSheetPool ( NULL ), pTreeBox ( NULL ), pCurObjShell ( NULL ), + pbDeleted ( NULL ), aFmtLb ( this, SfxResId( BT_VLIST ) ), aFilterLb ( pW, SfxResId( BT_FLIST ) ), @@ -1013,6 +1015,11 @@ SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl() pStyleSheetPool = NULL; delete pTreeBox; delete pTimer; + if ( pbDeleted ) + { + pbDeleted->bDead = true; + pbDeleted = NULL; + } } //------------------------------------------------------------------------- @@ -1632,7 +1639,7 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint // es kann sein, da\s sich ein neuer erst anmeldet, nachdem der Timer // abgelaufen ist - macht sich schlecht in UpdateStyles_Impl() ! - ULONG nId = ((SfxSimpleHint&) rHint).GetId(); + ULONG nId = rHint.ISA(SfxSimpleHint) ? ( (SfxSimpleHint&)rHint ).GetId() : 0; if(!bDontUpdate && nId != SFX_HINT_DYING && (rHint.Type() == TYPE(SfxStyleSheetPoolHint)|| @@ -1717,13 +1724,14 @@ BOOL SfxCommonTemplateDialog_Impl::Execute_Impl( pItems[ nCount++ ] = 0; - const SfxPoolItem* pItem; + Deleted aDeleted; + pbDeleted = &aDeleted; USHORT nModi = pModifier ? *pModifier : 0; - pItem = rDispatcher.Execute( + const SfxPoolItem* pItem = rDispatcher.Execute( nId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD | SFX_CALLMODE_MODAL, pItems, nModi ); - if ( !pItem ) + if ( !pItem || aDeleted() ) return FALSE; if ( nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId ) diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 477720a960e7..c530c59851ec 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -283,7 +283,6 @@ public: sal_Bool m_bSalvageMode: 1; sal_Bool m_bVersionsAlreadyLoaded: 1; sal_Bool m_bLocked: 1; - sal_Bool m_bHandleSysLocked: 1; sal_Bool m_bGotDateTime: 1; uno::Reference < embed::XStorage > xStorage; @@ -378,7 +377,6 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) m_bSalvageMode( sal_False ), m_bVersionsAlreadyLoaded( sal_False ), m_bLocked( sal_False ), - m_bHandleSysLocked( sal_False ), m_bGotDateTime( sal_False ), pAntiImpl( pAntiImplP ), nFileVersion( 0 ), @@ -1147,159 +1145,181 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) sal_Bool bResult = pImp->m_bLocked; - if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) + if ( !bResult ) { - // the special file locking should be used only for file URLs - - // in case of storing the document should request the output before locking - if ( bLoading ) - { - // let the stream be opened to check the system file locking - GetMedium_Impl(); - } - - // no locking is necessary on loading if the document is explicitly opened as copy + // no read-write access is necessary on loading if the document is explicitly opened as copy SFX_ITEMSET_ARG( GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); + } - if ( !bResult && ( !IsReadOnly() || pImp->m_bHandleSysLocked ) ) + if ( !bResult && !IsReadOnly() ) + { + // check whether the file is readonly in fs + // do it only for loading, some contents still might have problems with this property, let them not affect the saving + sal_Bool bContentReadonly = sal_False; + if ( bLoading ) { - sal_Int8 bUIStatus = LOCK_UI_NOLOCK; - - // check whether system file locking has been used, the default value is false - sal_Bool bUseSystemLock = sal_False; try { - - uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( - ::comphelper::getProcessServiceFactory(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), - ::comphelper::ConfigurationHelper::E_STANDARD ); - if ( !xCommonConfig.is() ) - throw uno::RuntimeException(); - - ::comphelper::ConfigurationHelper::readRelativeKey( - xCommonConfig, - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock; + // MediaDescriptor does this check also, the duplication should be avoided in future + pImp->aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bContentReadonly; } - catch( const uno::Exception& ) + catch( uno::Exception ) + {} + } + + if ( !bContentReadonly ) + { + if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) { - } + // the special file locking should be used only for file URLs - // TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem - if ( bUseSystemLock && !pImp->xStream.is() && !pOutStream ) - pImp->m_bHandleSysLocked = sal_True; // if system lock is used the writeable stream should be available + // in case of storing the document should request the output before locking + if ( bLoading ) + { + // let the stream be opened to check the system file locking + GetMedium_Impl(); + } - do - { + sal_Int8 bUIStatus = LOCK_UI_NOLOCK; + + // check whether system file locking has been used, the default value is false + sal_Bool bUseSystemLock = sal_False; try { - ::svt::DocumentLockFile aLockFile( aLogicName ); - if ( !pImp->m_bHandleSysLocked ) + uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( + ::comphelper::getProcessServiceFactory(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), + ::comphelper::ConfigurationHelper::E_STANDARD ); + if ( !xCommonConfig.is() ) + throw uno::RuntimeException(); + + ::comphelper::ConfigurationHelper::readRelativeKey( + xCommonConfig, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock; + } + catch( const uno::Exception& ) + { + } + + // TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem + // if system lock is used the writeable stream should be available + sal_Bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImp->xStream.is() && !pOutStream ); + + do + { + try { - try - { - bResult = aLockFile.CreateOwnLockFile(); - } - catch ( ucb::InteractiveIOException& e ) + ::svt::DocumentLockFile aLockFile( aLogicName ); + if ( !bHandleSysLocked ) { - if ( e.Code == IOErrorCode_INVALID_PARAMETER ) + try + { + bResult = aLockFile.CreateOwnLockFile(); + } + catch ( ucb::InteractiveIOException& e ) { - // it looks like the lock file name is not accepted by the content - if ( !bUseSystemLock ) + if ( e.Code == IOErrorCode_INVALID_PARAMETER ) { - // system file locking is not active, ask user whether he wants to open the document without any locking - uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - - if ( xHandler.is() ) + // it looks like the lock file name is not accepted by the content + if ( !bUseSystemLock ) { - ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl - = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) ); + // system file locking is not active, ask user whether he wants to open the document without any locking + uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); + + if ( xHandler.is() ) + { + ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl + = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) ); - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 ); - aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() ); - aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() ); - xIgnoreRequestImpl->setContinuations( aContinuations ); + uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 ); + aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() ); + aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() ); + xIgnoreRequestImpl->setContinuations( aContinuations ); - xHandler->handle( xIgnoreRequestImpl.get() ); + xHandler->handle( xIgnoreRequestImpl.get() ); - ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection(); - bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() ); + ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection(); + bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() ); + } } + else + bResult = sal_True; } else - bResult = sal_True; + throw; } - else - throw; } - } - if ( !bResult ) - { - uno::Sequence< ::rtl::OUString > aData; - try + if ( !bResult ) { - // impossibility to get data is no real problem - aData = aLockFile.GetLockData(); - } - catch( uno::Exception ) {} + uno::Sequence< ::rtl::OUString > aData; + try + { + // impossibility to get data is no real problem + aData = aLockFile.GetLockData(); + } + catch( uno::Exception ) {} - sal_Bool bOwnLock = sal_False; + sal_Bool bOwnLock = sal_False; - if ( !pImp->m_bHandleSysLocked ) - { - uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry(); - bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID - && aOwnData.getLength() > LOCKFILE_USERURL_ID - && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) ); - - if ( bOwnLock - && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] ) - && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) ) + if ( !bHandleSysLocked ) { - // this is own lock from the same installation, it could remain because of crash - bResult = sal_True; + uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry(); + bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID + && aOwnData.getLength() > LOCKFILE_USERURL_ID + && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) ); + + if ( bOwnLock + && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] ) + && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) ) + { + // this is own lock from the same installation, it could remain because of crash + bResult = sal_True; + } } - } - if ( !bResult && !bNoUI ) - { - bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock ); - if ( bUIStatus == LOCK_UI_SUCCEEDED ) + if ( !bResult && !bNoUI ) { - // take the ownership over the lock file - bResult = aLockFile.OverwriteOwnLockFile(); + bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock ); + if ( bUIStatus == LOCK_UI_SUCCEEDED ) + { + // take the ownership over the lock file + bResult = aLockFile.OverwriteOwnLockFile(); + } } - } - pImp->m_bHandleSysLocked = sal_False; + bHandleSysLocked = sal_False; + } } - } - catch( uno::Exception& ) - { - } - } while( !bResult && bUIStatus == LOCK_UI_TRY ); + catch( uno::Exception& ) + { + } + } while( !bResult && bUIStatus == LOCK_UI_TRY ); - pImp->m_bLocked = bResult; + pImp->m_bLocked = bResult; + } + else + { + // this is no file URL, check whether the file is readonly + bResult = !bContentReadonly; + } } + } - if ( !bResult && GetError() == ERRCODE_NONE ) - { - // the error should be set in case it is storing process - // or the document has been opened for editing explicitly + if ( !bResult && GetError() == ERRCODE_NONE ) + { + // the error should be set in case it is storing process + // or the document has been opened for editing explicitly - SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); - if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) - SetError( ERRCODE_IO_ACCESSDENIED ); - else - GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); - } + SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); + if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) + SetError( ERRCODE_IO_ACCESSDENIED ); + else + GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); } - else - bResult = sal_True; return bResult; } @@ -2515,7 +2535,6 @@ void SfxMedium::GetMedium_Impl() { TransformItems( SID_OPENDOC, *GetItemSet(), xProps ); comphelper::MediaDescriptor aMedium( xProps ); - sal_Bool bRequestedReadOnly = aMedium.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_READONLY(), sal_False ); if ( bFromTempFile ) { @@ -2531,19 +2550,8 @@ void SfxMedium::GetMedium_Impl() else aMedium.addInputStream(); - // the warning is shown if the user wants to edit the document, but it is not possible - pImp->m_bHandleSysLocked = ( !bRequestedReadOnly && aMedium.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_READONLY(), sal_False ) ); - - sal_Bool bReadOnly = sal_False; - aMedium[comphelper::MediaDescriptor::PROP_READONLY()] >>= bReadOnly; - if ( bReadOnly ) - { - SFX_ITEMSET_ARG( GetItemSet(), pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False); - BOOL bForceWritable = ( pROItem && !pROItem->GetValue() ); - GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); - if( bForceWritable ) - SetError( ERRCODE_IO_ACCESSDENIED ); - } + // the ReadOnly property set in aMedium is ignored + // the check is done in LockOrigFileOnDemand() for file and non-file URLs //TODO/MBA: what happens if property is not there?! GetContent(); @@ -2765,6 +2773,17 @@ void SfxMedium::Init_Impl() DBG_ERROR( "Unexpected Output stream parameter!\n" ); } + if ( aLogicName.Len() ) + { + // if the logic name is set it should be set in MediaDescriptor as well + SFX_ITEMSET_ARG( pSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE ); + if ( !pFileNameItem ) + { + // let the ItemSet be created if necessary + GetItemSet()->Put( SfxStringItem( SID_FILE_NAME, INetURLObject( aLogicName ).GetMainURL( INetURLObject::NO_DECODE ) ) ); + } + } + SetIsRemote_Impl(); } diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 9a19f3751f69..7965e5921b0d 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/frame/XStorable2.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> @@ -227,13 +228,21 @@ public: sal_Bool OutputFileDialog( sal_Int8 nStoreMode, const ::comphelper::SequenceAsHashMap& aPreselectedFilterPropsHM, sal_Bool bSetStandardName, - ::rtl::OUString& aUserSelectedName, + ::rtl::OUString& aSuggestedName, sal_Bool bPreselectPassword, - const ::rtl::OUString& rPath, + const ::rtl::OUString& aSuggestedDir, sal_Int16 nDialog, - const ::rtl::OUString& rStandardDir); + const ::rtl::OUString& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList + ); sal_Bool ShowDocumentInfoDialog(); + + ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, + const sfx2::FileDialogHelper::Context& aCtxt ); + ::rtl::OUString GetReccomendedName( const ::rtl::OUString& aSuggestedName, + const ::rtl::OUString& aTypeName ); + }; //------------------------------------------------------------------------- @@ -719,11 +728,12 @@ sal_Bool ModelData_Impl::CheckFilterOptionsDialogExistence() sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, const ::comphelper::SequenceAsHashMap& aPreselectedFilterPropsHM, sal_Bool bSetStandardName, - ::rtl::OUString& aUserSelectedName, + ::rtl::OUString& aSuggestedName, sal_Bool bPreselectPassword, - const ::rtl::OUString& rPath, + const ::rtl::OUString& aSuggestedDir, sal_Int16 nDialog, - const ::rtl::OUString& rStandardDir ) + const ::rtl::OUString& rStandardDir, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList) { sal_Bool bUseFilterOptions = sal_False; @@ -785,13 +795,13 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString::createFromAscii( "UIName" ), ::rtl::OUString() ); - pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aFilterUIName, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ), rStandardDir ); + pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aFilterUIName, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ), rStandardDir, rBlackList ); pFileDlg->SetCurrentFilter( aFilterUIName ); } else { // This is the normal dialog - pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir ); + pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList ); } if( aDocServiceName.equalsAscii( "com.sun.star.drawing.DrawingDocument" ) ) @@ -819,103 +829,52 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, else { // This is the normal dialog - pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir ); + pFileDlg = new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList ); pFileDlg->CreateMatcher( aDocServiceName ); } - // the last used name might be provided by aUserSelectedName from the old selection - ::rtl::OUString aLastName = aUserSelectedName; + ::rtl::OUString aAdjustToType; - if ( ( aLastName.getLength() || GetStorable()->hasLocation() ) - && !GetMediaDescr().getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "RepairPackage" ), - sal_False ) ) + // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format + if ( bSetStandardName || GetStorable()->hasLocation() ) { - // --> PB 2004-11-05 #i36524# - aLastName must be an URL, not only a filename - if ( !aLastName.getLength() ) - aLastName = GetStorable()->getLocation(); - // <-- - - if ( !aLastName.getLength() ) - { - aLastName = GetDocProps().getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Title" ), - ::rtl::OUString() ); - INetURLObject aObj( INetURLObject::GetAbsURL( SvtPathOptions().GetWorkPath(), aLastName ) ); - aLastName = aObj.GetMainURL( INetURLObject::NO_DECODE ); - } - uno::Sequence< beans::PropertyValue > aOldFilterProps; - sal_Int32 nOldFiltFlags = 0; ::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( - aFilterNameString, - ::rtl::OUString() ); + aFilterNameString, + ::rtl::OUString() ); if ( aOldFilterName.getLength() ) m_pOwner->GetFilterConfiguration()->getByName( aOldFilterName ) >>= aOldFilterProps; ::comphelper::SequenceAsHashMap aOldFiltPropsHM( aOldFilterProps ); - nOldFiltFlags = aOldFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), - (sal_Int32)0 ); + sal_Int32 nOldFiltFlags = aOldFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Flags" ), (sal_Int32)0 ); - // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format if ( bSetStandardName || ( nOldFiltFlags & nMust ) != nMust || nOldFiltFlags & nDont ) { - ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "UIName" ), - ::rtl::OUString() ); - ::rtl::OUString aTypeName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( + // the suggested type will be changed, the extension should be adjusted + aAdjustToType = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "Type" ), ::rtl::OUString() ); - if( aLastName.getLength() ) - { - INetURLObject aObj( aLastName ); - if ( aTypeName.getLength() ) - { - uno::Reference< container::XNameAccess > xTypeDetection = uno::Reference< container::XNameAccess >( - m_pOwner->GetServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ), - uno::UNO_QUERY ); - if ( xTypeDetection.is() ) - { - uno::Sequence< beans::PropertyValue > aTypeNameProps; - if ( ( xTypeDetection->getByName( aTypeName ) >>= aTypeNameProps ) && aTypeNameProps.getLength() ) - { - ::comphelper::SequenceAsHashMap aTypeNamePropsHM( aTypeNameProps ); - uno::Sequence< ::rtl::OUString > aExtensions = aTypeNamePropsHM.getUnpackedValueOrDefault( - ::rtl::OUString::createFromAscii( "Extension" ), - ::uno::Sequence< ::rtl::OUString >() ); - if ( aExtensions.getLength() ) - aObj.SetExtension( aExtensions[0] ); - } - } - } - - pFileDlg->SetDisplayDirectory( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); - } - + ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault( + ::rtl::OUString::createFromAscii( "UIName" ), + ::rtl::OUString() ); pFileDlg->SetCurrentFilter( aFilterUIName ); } else { - if( aLastName.getLength() ) - pFileDlg->SetDisplayDirectory( aLastName ); - pFileDlg->SetCurrentFilter( aOldFiltPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "UIName" ), ::rtl::OUString() ) ); } } - else - { - // pb: set graphic path if context == SD_EXPORT or SI_EXPORT else work path - String sDirectory = eCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT - ? SvtPathOptions().GetGraphicPath() : SvtPathOptions().GetWorkPath(); - pFileDlg->SetDisplayDirectory( sDirectory ); - } - if ( rPath.getLength() ) - pFileDlg->SetDisplayDirectory( rPath ); + ::rtl::OUString aReccomendedDir = GetReccomendedDir( aSuggestedDir, eCtxt ); + if ( aReccomendedDir.getLength() ) + pFileDlg->SetDisplayDirectory( aReccomendedDir ); + ::rtl::OUString aReccomendedName = GetReccomendedName( aSuggestedName, aAdjustToType ); + if ( aReccomendedName.getLength() ) + pFileDlg->SetFileName( aReccomendedName ); uno::Reference < view::XSelectionSupplier > xSel( GetModel()->getCurrentController(), uno::UNO_QUERY ); if ( xSel.is() && xSel->getSelection().hasValue() ) @@ -962,7 +921,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, // get the path from the dialog INetURLObject aURL( pFileDlg->GetPath() ); // the path should be provided outside since it might be used for further calls to the dialog - aUserSelectedName = aURL.GetMainURL( INetURLObject::NO_DECODE ); + aSuggestedName = aURL.GetName( INetURLObject::DECODE_WITH_CHARSET ); // old filter options should be cleared in case different filter is used @@ -1089,6 +1048,95 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() return bDialogUsed; } +//------------------------------------------------------------------------- +::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, const sfx2::FileDialogHelper::Context& aCtxt ) +{ + ::rtl::OUString aReccomendedDir; + + if ( ( aSuggestedDir.getLength() || GetStorable()->hasLocation() ) + && !GetMediaDescr().getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "RepairPackage" ), + sal_False ) ) + { + INetURLObject aLocation; + if ( aSuggestedDir.getLength() ) + aLocation = INetURLObject( aSuggestedDir ); + else + { + ::rtl::OUString aOldURL = GetStorable()->getLocation(); + if ( aOldURL.getLength() ) + { + INetURLObject aTmp( aOldURL ); + if ( aTmp.removeSegment() ) + aLocation = aTmp; + } + + if ( aLocation.HasError() ) + aLocation = INetURLObject( SvtPathOptions().GetWorkPath() ); + } + + aLocation.setFinalSlash(); + if ( !aLocation.HasError() ) + aReccomendedDir = aLocation.GetMainURL( INetURLObject::NO_DECODE ); + } + else + { + // pb: set graphic path if context == SD_EXPORT or SI_EXPORT else work path + ::rtl::OUString aConfigSuggestion( ( aCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) ? SvtPathOptions().GetGraphicPath() : SvtPathOptions().GetWorkPath() ); + aReccomendedDir = INetURLObject( aConfigSuggestion ).GetMainURL( INetURLObject::NO_DECODE ); + } + + return aReccomendedDir; +} + +//------------------------------------------------------------------------- +::rtl::OUString ModelData_Impl::GetReccomendedName( const ::rtl::OUString& aSuggestedName, const ::rtl::OUString& aTypeName ) +{ + // the last used name might be provided by aSuggestedName from the old selection, or from the MediaDescriptor + ::rtl::OUString aReccomendedName; + + if ( aSuggestedName.getLength() ) + aReccomendedName = aSuggestedName; + else + { + aReccomendedName = INetURLObject( GetStorable()->getLocation() ).GetName( INetURLObject::DECODE_WITH_CHARSET ); + if ( !aReccomendedName.getLength() ) + { + try { + uno::Reference< frame::XTitle > xTitle( GetModel(), uno::UNO_QUERY_THROW ); + aReccomendedName = xTitle->getTitle(); + } catch( uno::Exception& ) {} + } + + if ( aReccomendedName.getLength() && aTypeName.getLength() ) + { + // adjust the extension to the type + uno::Reference< container::XNameAccess > xTypeDetection = uno::Reference< container::XNameAccess >( + m_pOwner->GetServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.TypeDetection" ) ), + uno::UNO_QUERY ); + if ( xTypeDetection.is() ) + { + INetURLObject aObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "file:///c:/" ) ) + aReccomendedName ); + + uno::Sequence< beans::PropertyValue > aTypeNameProps; + if ( ( xTypeDetection->getByName( aTypeName ) >>= aTypeNameProps ) && aTypeNameProps.getLength() ) + { + ::comphelper::SequenceAsHashMap aTypeNamePropsHM( aTypeNameProps ); + uno::Sequence< ::rtl::OUString > aExtensions = aTypeNamePropsHM.getUnpackedValueOrDefault( + ::rtl::OUString::createFromAscii( "Extensions" ), + ::uno::Sequence< ::rtl::OUString >() ); + if ( aExtensions.getLength() ) + aObj.SetExtension( aExtensions[0] ); + } + + aReccomendedName = aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ); + } + } + } + + return aReccomendedName; +} + + //========================================================================= // class SfxStoringHelper //========================================================================= @@ -1175,7 +1223,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& const ::rtl::OUString& aSlotName, uno::Sequence< beans::PropertyValue >& aArgsSequence, sal_Bool bPreselectPassword, - ::rtl::OUString aUserSelectedName ) + ::rtl::OUString aSuggestedName ) { ModelData_Impl aModelData( *this, xModel, aArgsSequence ); @@ -1297,7 +1345,6 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& if ( aFileNameIter == aModelData.GetMediaDescr().end() ) { sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG; - ::rtl::OUString aPath; ::comphelper::SequenceAsHashMap::const_iterator aDlgIter = aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "UseSystemDialog" ) ); if ( aDlgIter != aModelData.GetMediaDescr().end() ) @@ -1310,10 +1357,18 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& nDialog = SFX2_IMPL_DIALOG_OOO; } - ::comphelper::SequenceAsHashMap::const_iterator aPathIter = - aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "FolderName" ) ); - if ( aPathIter != aModelData.GetMediaDescr().end() ) - aPathIter->second >>= aPath; + // The Dispatch supports parameter FolderName that overwrites SuggestedSaveAsDir + ::rtl::OUString aSuggestedDir = aModelData.GetMediaDescr().getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FolderName" ) ), ::rtl::OUString() ); + if ( !aSuggestedDir.getLength() ) + { + aSuggestedDir = aModelData.GetMediaDescr().getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SuggestedSaveAsDir" ) ), ::rtl::OUString() ); + if ( !aSuggestedDir.getLength() ) + aSuggestedDir = aModelData.GetDocProps().getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SuggestedSaveAsDir" ) ), ::rtl::OUString() ); + } + + aSuggestedName = aModelData.GetMediaDescr().getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SuggestedSaveAsName" ) ), ::rtl::OUString() ); + if ( !aSuggestedName.getLength() ) + aSuggestedName = aModelData.GetDocProps().getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SuggestedSaveAsName" ) ), ::rtl::OUString() ); ::rtl::OUString sStandardDir; ::comphelper::SequenceAsHashMap::const_iterator aStdDirIter = @@ -1321,13 +1376,20 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& if ( aStdDirIter != aModelData.GetMediaDescr().end() ) aStdDirIter->second >>= sStandardDir; + ::com::sun::star::uno::Sequence< ::rtl::OUString > aBlackList; + + ::comphelper::SequenceAsHashMap::const_iterator aBlackListIter = + aModelData.GetMediaDescr().find( ::rtl::OUString::createFromAscii( "BlackList" ) ); + if ( aBlackListIter != aModelData.GetMediaDescr().end() ) + aBlackListIter->second >>= aBlackList; + sal_Bool bExit = sal_False; while ( !bExit ) { - bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aUserSelectedName, bPreselectPassword, aPath, nDialog, sStandardDir ); + bUseFilterOptions = aModelData.OutputFileDialog( nStoreMode, aFilterProps, bSetStandardName, aSuggestedName, bPreselectPassword, aSuggestedDir, nDialog, sStandardDir, aBlackList ); // in case the dialog is opend a second time the folder should be the same as before, not what was handed over by parameters - aPath = ::rtl::OUString(); + aSuggestedDir = ::rtl::OUString(); if ( nStoreMode == SAVEAS_REQUESTED ) { // in case of saving check filter for possible alien warning @@ -1657,4 +1719,3 @@ Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& return pWin; } - diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 9ea841d363a8..7bb988f6d80e 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/XScriptInvocationContext.hpp> #include <com/sun/star/embed/EmbedStates.hpp> +#include <com/sun/star/embed/XEmbedPersist.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/container/XChild.hpp> @@ -336,9 +337,11 @@ sal_Bool SfxObjectShell::IsModified() if ( pImp->m_bIsModified ) return sal_True; - if ( !pImp->m_xDocStorage.is() ) + if ( !pImp->m_xDocStorage.is() || IsReadOnly() ) { // if the document still has no storage and is not set to be modified explicitly it is not modified + // a readonly document is also not modified + return sal_False; } @@ -532,10 +535,30 @@ sal_Bool SfxObjectShell::SwitchToShared( sal_Bool bShared, sal_Bool bSave ) if ( bShared != IsDocShared() ) { + ::rtl::OUString aOrigURL = GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); + + if ( !aOrigURL.getLength() && bSave ) + { + // this is a new document, let it be stored before switching to the shared mode; + // the storing should be done without shared flag, since it is possible that the + // target location does not allow to create sharing control file; + // the shared flag will be set later after creation of sharing control file + SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst( this ); + + if ( pViewFrame ) + { + // TODO/LATER: currently the application guards against the reentrance problem + const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); + SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); + bResult = ( pResult && pResult->GetValue() ); + if ( bResult ) + aOrigURL = GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); + } + } + sal_Bool bOldValue = HasSharedXMLFlagSet(); SetSharedXMLFlag( bShared ); - ::rtl::OUString aOrigURL = GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); sal_Bool bRemoveEntryOnError = sal_False; if ( bResult && bShared ) { @@ -558,6 +581,7 @@ sal_Bool SfxObjectShell::SwitchToShared( sal_Bool bShared, sal_Bool bSave ) if ( pViewFrame ) { // TODO/LATER: currently the application guards against the reentrance problem + SetModified( sal_True ); // the modified flag has to be set to let the document be stored with the shared flag const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); SfxBoolItem* pResult = PTR_CAST( SfxBoolItem, pItem ); bResult = ( pResult && pResult->GetValue() ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 95640642f565..2867334625bc 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1304,7 +1304,7 @@ sal_uInt16 SfxObjectShell::ImplGetSignatureState( sal_Bool bScriptingContent ) { *pState = SIGNATURESTATE_NOSIGNATURES; - if ( GetMedium() && GetMedium()->GetName().Len() && GetMedium()->GetStorage().is() && IsOwnStorageFormat_Impl( *GetMedium()) ) + if ( GetMedium() && GetMedium()->GetName().Len() && IsOwnStorageFormat_Impl( *GetMedium()) && GetMedium()->GetStorage().is() ) { try { diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index dff75d14d459..4eb5c6f417fd 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1317,16 +1317,14 @@ sal_Bool SfxObjectShell::SaveTo_Impl else { // This is SaveAs or export action, prepare the target medium + // the alien filters still might write directly to the file, that is of course a bug, + // but for now the framework has to be ready for it + // TODO/LATER: let the medium be prepared for alien formats as well rMedium.CloseAndRelease(); if ( bStorageBasedTarget ) { rMedium.GetOutputStorage(); } - else - { - rMedium.CreateTempFileNoCopy(); - rMedium.GetOutStream(); - } } // TODO/LATER: error handling @@ -2680,6 +2678,8 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl SfxItemSet *pSet = GetMedium()->GetItemSet(); pSet->ClearItem( SID_INTERACTIONHANDLER ); pSet->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); + pSet->ClearItem( SID_STANDARD_DIR ); + pSet->ClearItem( SID_PATH ); if ( !bSaveTo ) { @@ -2696,6 +2696,8 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl //pSet->ClearItem( SID_USE_FILTEROPTIONS ); pSet->ClearItem( SID_EDITDOC ); pSet->ClearItem( SID_OVERWRITE ); + pSet->ClearItem( SID_DEFAULTFILEPATH ); + pSet->ClearItem( SID_DEFAULTFILENAME ); SFX_ITEMSET_GET( (*aParams), pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False ); if ( pFilterItem ) diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 51d63d301ffc..07d218fcd690 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -303,7 +303,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > } // PaperFormat-Property? - if ( rProp.Name.compareToAscii( "PaperFormat" ) == 0 ) + else if ( rProp.Name.compareToAscii( "PaperFormat" ) == 0 ) { if ( ( rProp.Value >>= nPaperFormat ) == sal_False ) { @@ -320,7 +320,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > } // PaperSize-Property? - if ( rProp.Name.compareToAscii( "PaperSize" ) == 0 ) + else if ( rProp.Name.compareToAscii( "PaperSize" ) == 0 ) { awt::Size aTempSize ; if ( ( rProp.Value >>= aTempSize ) == sal_False ) @@ -332,6 +332,24 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > aSetPaperSize = impl_Size_Struct2Object(aTempSize); } } + + // PrinterTray-Property + else if ( rProp.Name.compareToAscii( "PrinterPaperTray" ) == 0 ) + { + rtl::OUString aTmp; + if ( ( rProp.Value >>= aTmp ) == sal_False ) + throw ::com::sun::star::lang::IllegalArgumentException(); + USHORT nCount = pPrinter->GetPaperBinCount(); + for (USHORT nBin=0; nBin<nCount; nBin++) + { + ::rtl::OUString aName( pPrinter->GetPaperBinName(nBin) ); + if ( aName == aTmp ) + { + pPrinter->SetPaperBin(nBin); + break; + } + } + } } //os 12.11.98: die PaperSize darf nur gesetzt werden, wenn tatsaechlich diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 09dc93f53f36..5501b153e99c 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2410,6 +2410,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , } else if ( SFX_EVENT_LOADFINISHED == pNamedHint->GetEventId() ) { + impl_getPrintHelper();
ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); } else if ( SFX_EVENT_SAVEASDOCDONE == pNamedHint->GetEventId() ) @@ -2423,6 +2424,10 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , addTitle_Impl( aArgs, aTitle ); attachResource( m_pData->m_pObjectShell->GetMedium()->GetName(), aArgs ); } + else if ( SFX_EVENT_DOCCREATED == pNamedHint->GetEventId() )
+ {
+ impl_getPrintHelper();
+ }
postEvent_Impl( pNamedHint->GetEventId() ); } diff --git a/sfx2/source/inc/statcach.hxx b/sfx2/source/inc/statcach.hxx index d48f7c672643..84d045d2a14b 100644 --- a/sfx2/source/inc/statcach.hxx +++ b/sfx2/source/inc/statcach.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: statcach.hxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.180.1 $ * * This file is part of OpenOffice.org. * @@ -38,6 +38,7 @@ #include <com/sun/star/frame/XDispatchProviderInterception.hpp> #include <com/sun/star/frame/FeatureStateEvent.hpp> #include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> #include <cppuhelper/weak.hxx> #ifndef _SFXBINDINGS_HXX @@ -76,7 +77,7 @@ public: void Release(); const ::com::sun::star::frame::FeatureStateEvent& GetStatus() const; - void Dispatch( sal_Bool bForceSynchron = sal_False ); + void Dispatch( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aProps, sal_Bool bForceSynchron = sal_False ); }; class SfxStateCache @@ -109,7 +110,7 @@ public: const SfxSlotServer* GetSlotServer( SfxDispatcher &rDispat ) { return GetSlotServer( rDispat, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > () ); } ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > GetDispatch() const; - void Dispatch( sal_Bool bForceSynchron = sal_False ); + void Dispatch( const SfxItemSet* pSet, sal_Bool bForceSynchron = sal_False ); sal_Bool IsControllerDirty() const { return bCtrlDirty ? sal_True : sal_False; } SfxPoolItem* GetItem() const { return pLastItem; } diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 2fab1bc97d2a..c1ffb7a79a0a 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -110,6 +110,15 @@ public: // class SfxCommonTemplateDialog_Impl ------------------------------------ +struct Deleted +{ + bool bDead; + + Deleted() : bDead(false) {} + + inline bool operator()() { return bDead; } +}; + class SfxCommonTemplateDialog_Impl : public SfxListener { private: @@ -154,6 +163,7 @@ protected: SfxObjectShell* pCurObjShell; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager; + Deleted* pbDeleted; SfxActionListBox aFmtLb; ListBox aFilterLb; diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index a0c67b47d057..ec26c3e6bbaf 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -73,6 +73,8 @@ #define UNO_QUERY ::com::sun::star::uno::UNO_QUERY namespace css = ::com::sun::star; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::beans::PropertyValue; //-------------------------------------------------------------------------------------------------------- // --- XNameReplace --- @@ -83,55 +85,58 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY & { ::osl::MutexGuard aGuard( maMutex ); - bool bReset = !rElement.hasValue(); // find the event in the list and replace the data long nCount = maEventNames.getLength(); for ( long i=0; i<nCount; i++ ) { if ( maEventNames[i] == aName ) { + Sequence< PropertyValue > aProperties; // check for correct type of the element - if ( bReset || ::getCppuType( (const SEQUENCE < PROPERTYVALUE > *)0 ) == rElement.getValueType() ) + if ( rElement.hasValue() && !( rElement >>= aProperties ) ) + throw ILLEGALARGUMENTEXCEPTION(); + + // create Configuration at first, creation might call this method also and that would overwrite everything + // we might have stored before! + USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName ); + OSL_ENSURE( nID, "SfxEvents_Impl::replaceByName: no ID for the given event!" ); + if ( !nID ) + // throw? + return; + + if ( mpObjShell && !mpObjShell->IsLoading() ) + mpObjShell->SetModified( TRUE ); + + if ( aProperties.getLength() ) { - // create Configuration at first, creation might call this method also and that would overwrite everything - // we might have stored before! - USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName ); - if ( nID ) + // "normalize" the macro descriptor + ANY aValue; + BlowUpMacro( rElement, aValue, mpObjShell ); + aValue >>= aProperties; + + ::rtl::OUString sType; + if ( ( aProperties.getLength() == 1 ) + && ( aProperties[0].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) + && ( aProperties[0].Value >>= sType ) + && ( sType.getLength() == 0 ) + ) { - // pConfig becomes the owner of the new SvxMacro - if ( mpObjShell && !mpObjShell->IsLoading() ) - mpObjShell->SetModified( TRUE ); - - if ( bReset ) - { - maEventData[i] = ANY(); - } - else - { - ANY aValue; - BlowUpMacro( rElement, aValue, mpObjShell ); - - SEQUENCE < PROPERTYVALUE > aProperties; - if ( aValue >>= aProperties ) - { - ::rtl::OUString aType; - if (( aProperties[0].Name.compareToAscii( PROP_EVENT_TYPE ) == 0 ) && - ( aProperties[0].Value >>= aType ) && - aType.getLength() == 0 ) - { - // An empty event type means no binding. Therefore reset data - // to reflect that state. - maEventData[i] = ANY(); - } - else - maEventData[i] = aValue; - } - } + // An empty event type means no binding. Therefore reset data + // to reflect that state. + // (that's for compatibility only. Nowadays, the Tools/Customize dialog should + // set an empty sequence to indicate the request for resetting the assignment.) + aProperties.realloc( 0 ); } } - else - throw ILLEGALARGUMENTEXCEPTION(); + if ( aProperties.getLength() ) + { + maEventData[i] = makeAny( aProperties ); + } + else + { + maEventData[i].clear(); + } return; } } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 5565b3a10f49..937360e15906 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -554,6 +554,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); GetDispatcher()->Execute( SID_EDIT_FRAMESET, SFX_CALLMODE_RECORD, &aItem, 0L ); + pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); } return; } diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 73e062167e00..3c2054a4a881 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -812,6 +812,8 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) rReq.Ignore(); } + pPrinter->SetNextJobIsQuick( false ); + delete pPrintDlg; break; } diff --git a/shell/prj/build.lst b/shell/prj/build.lst index 510071ccc868..9758834dc803 100644 --- a/shell/prj/build.lst +++ b/shell/prj/build.lst @@ -5,6 +5,7 @@ sl shell\source\win32\simplemail nmake - w sl_win32_simp sl shell\source\unix\exec nmake - u sl_unix sl_inc NULL sl shell\source\unix\exec nmake - p sl_unix sl_inc NULL sl shell\source\unix\misc nmake - u sl_unix_misc sl_inc NULL +sl shell\source\unix\misc nmake - p sl_unix_misc sl_inc NULL sl shell\source\cmdmail nmake - u sl_cmdmail sl_inc NULL sl shell\source\cmdmail nmake - p sl_cmdmail sl_inc NULL sl shell\source\all nmake - all sl_all sl_inc NULL diff --git a/shell/source/backends/kdebe/kdepathslayer.cxx b/shell/source/backends/kdebe/kdepathslayer.cxx index 6e13e0ee39c3..34d85ee93d6d 100644 --- a/shell/source/backends/kdebe/kdepathslayer.cxx +++ b/shell/source/backends/kdebe/kdepathslayer.cxx @@ -79,20 +79,20 @@ void SAL_CALL KDEPathsLayer::readData( const uno::Reference<backend::XLayerHandl uno::Sequence<backend::PropertyInfo> aPropInfoList(1); sal_Int32 nProperties = 0; - QString aDocumentsDir( "file:" ); - ::rtl::OUString sDocumentsDir; - - aDocumentsDir += KGlobalSettings::documentPath(); + QString aDocumentsDir( KGlobalSettings::documentPath() ); + rtl::OUString sDocumentsDir; + rtl::OUString sDocumentsURL; if ( aDocumentsDir.endsWith(QChar('/')) ) aDocumentsDir.truncate ( aDocumentsDir.length() - 1 ); sDocumentsDir = (const sal_Unicode *) aDocumentsDir.ucs2(); + osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData ); aPropInfoList[nProperties].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") ); aPropInfoList[nProperties].Type = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "string" ) ); aPropInfoList[nProperties].Protected = sal_False; - aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsDir ); + aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsURL ); if( nProperties > 0 ) { diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 7bbe7a3c97d1..315f78c517ff 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -97,7 +97,11 @@ void escapeForShell( rtl::OStringBuffer & rBuffer, const rtl::OString & rURL) { // escape every non alpha numeric characters (excluding a few "known good") by prepending a '\' sal_Char c = rURL[n]; - if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '/' && c != '.' ) + if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) +#ifdef OS2 // YD we don't need to escape ':', '-', '\\', '_' + && c != ':' && c != '-' && c != '\\' && c != '_' +#endif + && c != '/' && c != '.' ) rBuffer.append( '\\' ); rBuffer.append( c ); diff --git a/shell/source/unix/misc/makefile.mk b/shell/source/unix/misc/makefile.mk index d54e359406b0..ba2ed56b83ef 100644 --- a/shell/source/unix/misc/makefile.mk +++ b/shell/source/unix/misc/makefile.mk @@ -51,6 +51,23 @@ SCRIPTFILES = \ $(BIN)$/gnome-open-url \ $(BIN)$/kde-open-url +.IF "$(GUI)" == "OS2" + +APP1TARGET = open-url +APP1OBJS = \ + $(OBJ)$/open-url.obj \ + open-url.def +APP1LIBS = + +APP2TARGET = senddoc +APP2OBJS = \ + $(OBJ)$/senddoc.obj \ + senddoc.def +APP2LIBS = +APP2STDLIBS = + +.ELSE + APP1TARGET = gnome-open-url.bin APP1OBJS = \ $(OBJ)$/gnome-open-url.obj @@ -65,6 +82,7 @@ APP2LIBS = APP2STDLIBS = OBJFILES = $(APP1OBJS) $(APP2OBJS) +.ENDIF # --- Targets ------------------------------------------------------ diff --git a/shell/source/unix/misc/open-url.c b/shell/source/unix/misc/open-url.c new file mode 100644 index 000000000000..00a2e3bff774 --- /dev/null +++ b/shell/source/unix/misc/open-url.c @@ -0,0 +1,180 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile:$ + * + * $Revision:$ + * + * last change: $Author:$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <process.h> +#include <time.h> + +#define INCL_DOS +#define INCL_DOSERRORS +#define INCL_PM +#include <os2.h> + +// OOo uses popen() to start us, so we cannot show PM dialogs. +// log message to disk. +void logMessage( char* msg) +{ + PPIB pib; + CHAR szApplicationName[_MAX_PATH]; + CHAR szDrive[_MAX_PATH]; + CHAR szDir[_MAX_PATH]; + CHAR szFileName[_MAX_PATH]; + CHAR szExt[_MAX_PATH]; + FILE* log; + time_t timeOfDay; + struct tm* localTime; + + // get executable fullpath + DosGetInfoBlocks(NULL, &pib); + DosQueryModuleName(pib->pib_hmte, sizeof(szApplicationName), szApplicationName); + _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt ); + // log name + _makepath( szApplicationName, szDrive, szDir, szFileName, (".LOG") ); + log = fopen( szApplicationName, "a"); + if (!log) + return; + time( &timeOfDay); + localTime = localtime( &timeOfDay); + fprintf( log, "%04d/%02d/%02d %02d:%02d:%02d %s\n", + localTime->tm_year+1900, localTime->tm_mon+1, localTime->tm_mday, + localTime->tm_hour, localTime->tm_min, localTime->tm_sec, msg); + fclose( log); +} + +// dump comand line arguments +void dumpArgs( int argc, char *argv[] ) +{ + int i; + + logMessage( "Start of command line arguments dump:"); + for( i=0; i<argc; i++) + logMessage( argv[i]); +} + +/* + * The intended use of this tool is to pass the argument to + * the default URL exe. + */ +int main(int argc, char *argv[] ) +{ + APIRET rc; + RESULTCODES result = {0}; + char szAppFromINI[_MAX_PATH]; + char szDirFromINI[_MAX_PATH]; + char szCmdLine[1024]; + char szFail[ _MAX_PATH]; + ULONG ulSID; + PID pid; + + // check parameters + if (argc != 2) + { + logMessage( "Usage: open-url <url>"); + dumpArgs( argc, argv); + return -1; + } + + // check configuration + rc = PrfQueryProfileString(HINI_USER, "WPURLDEFAULTSETTINGS", + "DefaultBrowserExe", "", + szAppFromINI, sizeof(szAppFromINI)); + rc = PrfQueryProfileString(HINI_USER, "WPURLDEFAULTSETTINGS", + "DefaultWorkingDir", "", + szDirFromINI, sizeof(szDirFromINI)); + if (*szAppFromINI == 0 || *szDirFromINI == 0) + { + logMessage( "Unable to find default url handler in USER.INI; exiting."); + dumpArgs( argc, argv); + return -1; + } + + // get default parameter list + rc = PrfQueryProfileString(HINI_USER, "WPURLDEFAULTSETTINGS", + "DefaultParameters", "", + szCmdLine, sizeof(szCmdLine)); + strcat( szCmdLine, " "); + strcat( szCmdLine, argv[1]); + + // change default directory + _chdir( szDirFromINI); + + // start default handler + STARTDATA SData; + CHAR szObjBuf[CCHMAXPATH]; + + SData.Length = sizeof(STARTDATA); + SData.Related = SSF_RELATED_INDEPENDENT; + SData.FgBg = (1) ? SSF_FGBG_FORE : SSF_FGBG_BACK; + SData.TraceOpt = SSF_TRACEOPT_NONE; + + SData.PgmTitle = (PSZ)szAppFromINI; + + SData.PgmName = (PSZ)szAppFromINI; + SData.PgmInputs = (PSZ)szCmdLine; + + SData.TermQ = NULL; + SData.Environment = 0; + SData.InheritOpt = SSF_INHERTOPT_PARENT; + SData.SessionType = SSF_TYPE_PM; + SData.IconFile = 0; + SData.PgmHandle = 0; + + SData.PgmControl = SSF_CONTROL_VISIBLE; + + SData.InitXPos = 30; + SData.InitYPos = 40; + SData.InitXSize = 200; + SData.InitYSize = 140; + SData.Reserved = 0; + SData.ObjectBuffer = szFail; + SData.ObjectBuffLen = (ULONG)sizeof(szFail); + + rc = DosStartSession( &SData, &ulSID, &pid); + // show error dialog in case of problems + if (rc != NO_ERROR && rc != ERROR_SMG_START_IN_BACKGROUND) { + char szMessage[ _MAX_PATH*2]; + sprintf( szMessage, "Execution failed! rc: %d, failing module:%s", rc, szFail); + logMessage( szMessage); + dumpArgs( argc, argv); + return -1; + } + + // ok + return 0; +} + diff --git a/shell/source/unix/misc/open-url.def b/shell/source/unix/misc/open-url.def new file mode 100644 index 000000000000..3a26831e2a65 --- /dev/null +++ b/shell/source/unix/misc/open-url.def @@ -0,0 +1 @@ +NAME open-url WINDOWAPI diff --git a/shell/source/unix/misc/senddoc.c b/shell/source/unix/misc/senddoc.c new file mode 100644 index 000000000000..e918ba69c86d --- /dev/null +++ b/shell/source/unix/misc/senddoc.c @@ -0,0 +1,212 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile:$ + * + * $Revision:$ + * + * last change: $Author:$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <process.h> +#include <time.h> + +#define INCL_DOS +#define INCL_DOSERRORS +#define INCL_PM +#include <os2.h> + +// OOo uses popen() to start us, so we cannot show PM dialogs. +// log message to disk. +void logMessage( char* msg) +{ + PPIB pib; + CHAR szApplicationName[_MAX_PATH]; + CHAR szDrive[_MAX_PATH]; + CHAR szDir[_MAX_PATH]; + CHAR szFileName[_MAX_PATH]; + CHAR szExt[_MAX_PATH]; + FILE* log; + time_t timeOfDay; + struct tm* localTime; + + // get executable fullpath + DosGetInfoBlocks(NULL, &pib); + DosQueryModuleName(pib->pib_hmte, sizeof(szApplicationName), szApplicationName); + _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt ); + // log name + _makepath( szApplicationName, szDrive, szDir, szFileName, (".LOG") ); + log = fopen( szApplicationName, "a"); + if (!log) + return; + time( &timeOfDay); + localTime = localtime( &timeOfDay); + fprintf( log, "%04d/%02d/%02d %02d:%02d:%02d %s\n", + localTime->tm_year+1900, localTime->tm_mon+1, localTime->tm_mday, + localTime->tm_hour, localTime->tm_min, localTime->tm_sec, msg); + fclose( log); +} + +// dump comand line arguments +void dumpArgs( int argc, char *argv[] ) +{ + int i; + + logMessage( "Start of command line arguments dump:"); + for( i=0; i<argc; i++) + logMessage( argv[i]); +} + +/* + * The intended use of this tool is to pass the argument to + * the default mail handler. + */ +int main(int argc, char *argv[] ) +{ + APIRET rc; + RESULTCODES result = {0}; + char szAppFromINI[_MAX_PATH]; + char szDirFromINI[_MAX_PATH]; + char szCmdLine[1024]; + char szFail[ _MAX_PATH]; + ULONG ulSID; + PID pid; + int i; + BOOL bMailClient = FALSE; + + // check parameters + if (argc < 5) + { + logMessage( "Usage: senddoc --mailclient <client> --attach <uri>"); + dumpArgs( argc, argv); + return -1; + } + + // check configuration + rc = PrfQueryProfileString(HINI_USER, "WPURLDEFAULTSETTINGS", + "DefaultMailExe", "", + szAppFromINI, sizeof(szAppFromINI)); + rc = PrfQueryProfileString(HINI_USER, "WPURLDEFAULTSETTINGS", + "DefaultMailWorkingDir", "", + szDirFromINI, sizeof(szDirFromINI)); + if (*szAppFromINI == 0 || *szDirFromINI == 0) + { + logMessage( "Unable to find default mail handler in USER.INI; exiting."); + dumpArgs( argc, argv); + return -1; + } + + // get default parameter list, at leat -compose is required + rc = PrfQueryProfileString(HINI_USER, "WPURLDEFAULTSETTINGS", + "DefaultMailParameters", "", + szCmdLine, sizeof(szCmdLine)); + if (strstr( szCmdLine, "-compose") == 0) + strcat( szCmdLine, " -compose"); // add if missing! + + // parse cmdline arguments + for( i=1; i<argc; i++) + { + if (!strcmp( argv[i], "--mailclient")) { + // we support only Thunderbird/Mozilla command line options, check exe name + if (strstr( argv[i+1], "thunderbird") == 0 + && strstr( argv[i+1], "mozilla") == 0 + && strstr( argv[i+1], "seamonkey") == 0) + { + logMessage( "Only Thunderbird/Mozilla is currently supported. Exiting."); + dumpArgs( argc, argv); + return -1; + } + // mail client found + bMailClient = TRUE; + i++; + } else if (!strcmp( argv[i], "--attach")) { + strcat( szCmdLine, " attachment=file://"); + strcat( szCmdLine, argv[i+1]); + i++; + } + // ignore other options (BTW currently none) + } + if (bMailClient == FALSE) + { + logMessage( "No mail client specified. Exiting."); + dumpArgs( argc, argv); + return -1; + } + + // change default directory + _chdir( szDirFromINI); + + // start default handler + STARTDATA SData; + CHAR szObjBuf[CCHMAXPATH]; + + SData.Length = sizeof(STARTDATA); + SData.Related = SSF_RELATED_INDEPENDENT; + SData.FgBg = (1) ? SSF_FGBG_FORE : SSF_FGBG_BACK; + SData.TraceOpt = SSF_TRACEOPT_NONE; + + SData.PgmTitle = (PSZ)szAppFromINI; + + SData.PgmName = (PSZ)szAppFromINI; + SData.PgmInputs = (PSZ)szCmdLine; + + SData.TermQ = NULL; + SData.Environment = 0; + SData.InheritOpt = SSF_INHERTOPT_PARENT; + SData.SessionType = SSF_TYPE_PM; + SData.IconFile = 0; + SData.PgmHandle = 0; + + SData.PgmControl = SSF_CONTROL_VISIBLE; + + SData.InitXPos = 30; + SData.InitYPos = 40; + SData.InitXSize = 200; + SData.InitYSize = 140; + SData.Reserved = 0; + SData.ObjectBuffer = szFail; + SData.ObjectBuffLen = (ULONG)sizeof(szFail); + + rc = DosStartSession( &SData, &ulSID, &pid); + // show error dialog in case of problems + if (rc != NO_ERROR && rc != ERROR_SMG_START_IN_BACKGROUND) { + char szMessage[ _MAX_PATH*2]; + sprintf( szMessage, "Execution failed! rc: %d, failing module:%s", rc, szFail); + logMessage( szMessage); + dumpArgs( argc, argv); + return -1; + } + + // ok + return 0; +} + diff --git a/shell/source/unix/misc/senddoc.def b/shell/source/unix/misc/senddoc.def new file mode 100644 index 000000000000..0abf1553a4a9 --- /dev/null +++ b/shell/source/unix/misc/senddoc.def @@ -0,0 +1 @@ +NAME senddoc WINDOWAPI diff --git a/shell/source/unix/misc/senddoc.sh b/shell/source/unix/misc/senddoc.sh index b9931cfc7adf..3f5b517d023c 100644 --- a/shell/source/unix/misc/senddoc.sh +++ b/shell/source/unix/misc/senddoc.sh @@ -329,7 +329,8 @@ case `basename "$MAILER" | sed 's/-.*$//'` in while [ "$1" != "" ]; do case $1 in --attach) - ATTACH="${ATTACH:-}${ATTACH:+ } $2" + #i95688# fix filenames containing accented chars, whatever alien + ATTACH="${ATTACH:-}${ATTACH:+ }"`echo "file://$2" | ${URI_ENCODE}` shift ;; *) @@ -337,7 +338,6 @@ case `basename "$MAILER" | sed 's/-.*$//'` in esac shift; done - /usr/bin/open -a "${MAILER}" ${ATTACH} ;; diff --git a/svx/inc/svditer.hxx b/svx/inc/svditer.hxx index 18ddc39b627c..92325f281c92 100644 --- a/svx/inc/svditer.hxx +++ b/svx/inc/svditer.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svditer.hxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.246.1 $ * * This file is part of OpenOffice.org. * @@ -37,6 +37,7 @@ class SdrObjList; class SdrObject; +class SdrMarkList; // SdrObjListIter methods: // IM_FLAT : Flach ueber die Liste @@ -51,6 +52,8 @@ class SVX_DLLPUBLIC SdrObjListIter BOOL mbReverse; void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bUseZOrder); + void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode); + void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, BOOL bUseZOrder); public: SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE); @@ -67,6 +70,9 @@ public: SdrObject and is no longer limited to group objects */ SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE); + /** Iterates over a list of marked objects received from the SdrMarkView. */ + SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE); + void Reset() { mnIndex = (mbReverse ? maObjList.Count() : 0L); } BOOL IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.Count())); } SdrObject* Next() { return (SdrObject*)maObjList.GetObject(mbReverse ? --mnIndex : mnIndex++); } diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index a9ff116dbd26..448973fa525c 100644 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -1365,9 +1365,11 @@ #define RID_SVXSTR_SELMODE_BLK (RID_SVX_START + 1167) #define RID_SVXSTR_STYLEFAMILY_TABLEDESIGN (RID_SVX_START + 1168) #define STR_LINKEDDOC_NO_SYSTEM_FILE (RID_SVX_START + 1169) -// pb: next free string resource id -#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1170) +#define RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED (RID_SVX_START + 1170) +#define RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED (RID_SVX_START + 1171) + // if you add here, remember to adjust RID_SVXSTR_NEXTFREE +#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1172) // ---------------------------------------------------------------------------- // if we have _a_lot_ time, we should group the resource ids by type, instead diff --git a/svx/inc/svx/fmview.hxx b/svx/inc/svx/fmview.hxx index ed100d9cb338..c79748ddb94f 100644 --- a/svx/inc/svx/fmview.hxx +++ b/svx/inc/svx/fmview.hxx @@ -150,11 +150,9 @@ public: virtual void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC); virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC); - // the following is a hack, only to be used on the 3.0.1 branch, to prevent becoming - // incompatible there - // #i94033# / 2008-10-16 / frank.schoenheit@sun.com - void onBeginCompleteRedraw(); - void onEndCompleteRedraw(); + virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut); + virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer); + SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return pActualOutDev;} SVX_DLLPRIVATE sal_Bool checkUnMarkAll(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xSource); diff --git a/svx/inc/svx/msdffimp.hxx b/svx/inc/svx/msdffimp.hxx index c70ed64203b6..6a86c09ebf25 100644 --- a/svx/inc/svx/msdffimp.hxx +++ b/svx/inc/svx/msdffimp.hxx @@ -616,13 +616,13 @@ public: // BOOL bLookForEnd ); // SdrObject* ImportObj(SvStream& rSt, void* pData, - const Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL); + Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL); SdrObject* ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, void* pData, - const Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL ); + Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL ); SdrObject* ImportShape( const DffRecordHeader& rHd, SvStream& rSt, void* pData, - const Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL); + Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL); Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect ); void GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt, diff --git a/svx/inc/svx/optimprove.hxx b/svx/inc/svx/optimprove.hxx index 63d4ce854827..816e531ca28a 100644 --- a/svx/inc/svx/optimprove.hxx +++ b/svx/inc/svx/optimprove.hxx @@ -102,6 +102,7 @@ private: SVX_DLLPRIVATE SvxImprovementOptionsPage( Window* pParent, const SfxItemSet& rSet ); + DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlinkImage * ); DECL_DLLPRIVATE_LINK( HandleShowData, PushButton * ); public: @@ -137,23 +138,5 @@ public: void SetInfoText( const String& rText ); }; -class SVX_DLLPUBLIC SvxImprovementDialog2 : public ModalDialog -{ -private: - SvxInfoWindow m_aInfoWin; - FixedText m_aInvitationFT; - RadioButton m_aYesRB; - RadioButton m_aNoRB; - FixedLine m_aButtonLine; - svt::FixedHyperlinkImage m_aInfoFI; - OKButton m_aOKBtn; - - DECL_DLLPRIVATE_LINK( HandleOK, OKButton * ); - DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlinkImage * ); - -public: - SvxImprovementDialog2( Window* pParent ); -}; - #endif diff --git a/svx/inc/svx/outliner.hxx b/svx/inc/svx/outliner.hxx index 9fc20b815494..f2a64e16acb6 100644 --- a/svx/inc/svx/outliner.hxx +++ b/svx/inc/svx/outliner.hxx @@ -89,6 +89,7 @@ class SvxForbiddenCharactersTable; #include <vos/ref.hxx> #include <svx/svxfont.hxx> #include <svx/eedata.hxx> +#include <svx/paragraphdata.hxx> class SvxFieldData; ////////////////////////////////////////////////////////////////////////////// @@ -122,25 +123,6 @@ namespace basegfx { class B2DPolyPolygon; } // #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7 #define OLUNDO_CHECKPARA EDITUNDO_USER+8 -// MT 07/00: Only for internal use, oder some kind like hPara for the few -// functions where you need it outside ( eg. moving paragraphs... ) - -class ParagraphData -{ - friend class Paragraph; - friend class OutlinerParaObject; -protected: - sal_Int16 nDepth; - sal_Int16 mnNumberingStartValue; - sal_Bool mbParaIsNumberingRestart; - -public: - ParagraphData( const ParagraphData& ); - ParagraphData(); - - ParagraphData& operator=( const ParagraphData& ); -}; - class Paragraph : protected ParagraphData { private: diff --git a/svx/inc/svx/outlobj.hxx b/svx/inc/svx/outlobj.hxx index 32c59a051e3b..9a8efeaaddc1 100644 --- a/svx/inc/svx/outlobj.hxx +++ b/svx/inc/svx/outlobj.hxx @@ -31,61 +31,66 @@ #ifndef _OUTLOBJ_HXX #define _OUTLOBJ_HXX +////////////////////////////////////////////////////////////////////////////// + #include <tools/solar.h> #include <tools/string.hxx> #include <rsc/rscsfx.hxx> -#include <svtools/itemset.hxx> +#include <svx/paragraphdata.hxx> #include "svx/svxdllapi.h" -#include <svx/eeitem.hxx> - -class Outliner; class EditTextObject; -class SvStream; -class SfxItemPool; -class SfxStyleSheetPool; -class ParagraphData; +class ImplOutlinerParaObject; + +////////////////////////////////////////////////////////////////////////////// class SVX_DLLPUBLIC OutlinerParaObject { - friend class Outliner; +private: + ImplOutlinerParaObject* mpImplOutlinerParaObject; - EditTextObject* pText; - ParagraphData* pParagraphDataArr; - sal_uInt32 nCount; - BOOL bIsEditDoc; - OutlinerParaObject( USHORT nParaCount ); + void ImplMakeUnique(); public: - OutlinerParaObject( const OutlinerParaObject& ); - OutlinerParaObject( const EditTextObject& rTObj ); - ~OutlinerParaObject(); + // constructors/destructor + OutlinerParaObject( + const EditTextObject& rEditTextObject, + const ParagraphDataVector& rParagraphDataVector = ParagraphDataVector(), + bool bIsEditDoc = true); + OutlinerParaObject(const OutlinerParaObject& rCandidate); + ~OutlinerParaObject(); - OutlinerParaObject* Clone() const; + // assignment operator + OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate); - USHORT GetOutlinerMode() const; - void SetOutlinerMode( USHORT n ); + // compare operator + bool operator==(const OutlinerParaObject& rCandidate) const; + bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); } - BOOL IsVertical() const; - void SetVertical( BOOL bVertical ); + // outliner mode access + sal_uInt16 GetOutlinerMode() const; + void SetOutlinerMode(sal_uInt16 nNew); - sal_uInt32 Count() const { return nCount; } - sal_Int16 GetDepth( USHORT nPara ) const; - const EditTextObject& GetTextObject() const { return *pText; } - void ClearPortionInfo(); - BOOL IsEditDoc() const { return bIsEditDoc; } - void Store( SvStream& ) const; - static OutlinerParaObject* Create( SvStream&, SfxItemPool* pTextObjectPool = 0 ); + // vertical access + bool IsVertical() const; + void SetVertical(bool bNew); - BOOL ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, - const XubString& rNewName, SfxStyleFamily eNewFamily ); - void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ); - void SetStyleSheets( USHORT nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily ); + // data read access + sal_uInt32 Count() const; + sal_Int16 GetDepth(sal_uInt16 nPara) const; + const EditTextObject& GetTextObject() const; + bool IsEditDoc() const; + const ParagraphData& GetParagraphData(sal_uInt32 nIndex) const; - BOOL RemoveCharAttribs( USHORT nWhich = 0 ); - BOOL RemoveParaAttribs( USHORT nWhich = 0 ); + // portion info support + void ClearPortionInfo(); - void MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart = EE_CHAR_START, USHORT nEnd = EE_CHAR_END ); + // StyleSheet support + bool ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily); + void ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName); + void SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily); }; +////////////////////////////////////////////////////////////////////////////// + #endif diff --git a/svx/inc/svx/paragraphdata.hxx b/svx/inc/svx/paragraphdata.hxx new file mode 100644 index 000000000000..ddd98a15e176 --- /dev/null +++ b/svx/inc/svx/paragraphdata.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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: outlobj.hxx,v $ + * $Revision: 1.5.78.1 $ + * + * 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 _PARAGRAPH_DATA_HXX +#define _PARAGRAPH_DATA_HXX + +#include <tools/solar.h> +#include <vector> + +////////////////////////////////////////////////////////////////////////////// +// MT 07/00: Only for internal use, oder some kind like hPara for the few +// functions where you need it outside ( eg. moving paragraphs... ) +// +// AW: Unfortunately NOT only local (formally in outliner.hxx), but also +// used in outlobj.hxx. Moved to own header + +class ParagraphData +{ + friend class Paragraph; + friend class OutlinerParaObject; + +protected: + sal_Int16 nDepth; + sal_Int16 mnNumberingStartValue; + sal_Bool mbParaIsNumberingRestart; + +public: + ParagraphData( const ParagraphData& ); + ParagraphData(); + + ParagraphData& operator=( const ParagraphData& ); + + // compare operator + bool operator==(const ParagraphData& rCandidate) const; + + // data read access + sal_Int16 getDepth() const { return nDepth; } +}; + +////////////////////////////////////////////////////////////////////////////// + +typedef ::std::vector< ParagraphData > ParagraphDataVector; + +////////////////////////////////////////////////////////////////////////////// + +#endif // _PARAGRAPH_DATA_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index 712f01b69334..9033135e6caa 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -34,6 +34,7 @@ #include <svx/xenum.hxx> #include <sal/types.h> +#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines @@ -53,7 +54,7 @@ namespace drawinglayer class SdrTextAttribute { const SdrText& mrSdrText; - const OutlinerParaObject* mpOutlinerParaObject; + const OutlinerParaObject maOutlinerParaObject; XFormTextStyle meFormTextStyle; sal_Int32 maTextLeftDistance; @@ -67,28 +68,35 @@ namespace drawinglayer unsigned mbHideContour : 1; unsigned mbBlink : 1; unsigned mbScroll : 1; + unsigned mbInEditMode : 1; public: SdrTextAttribute( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, sal_Int32 aTextRightDistance, sal_Int32 aTextLowerDistance, - bool bContour, bool bFitToSize, - bool bHideContour, bool bBlink, - bool bScroll); + bool bContour, + bool bFitToSize, + bool bHideContour, + bool bBlink, + bool bScroll, + bool bInEditMode); bool operator==(const SdrTextAttribute& rCandidate) const; // data access const SdrText& getSdrText() const { return mrSdrText; } + const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } bool isContour() const { return mbContour; } bool isFontwork() const { return (XFT_NONE != meFormTextStyle); } bool isFitToSize() const { return mbFitToSize; } bool isHideContour() const { return mbHideContour; } bool isBlink() const { return mbBlink; } bool isScroll() const { return mbScroll; } + bool isInEditMode() const { return mbInEditMode; } XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } diff --git a/svx/inc/svx/sdr/contact/objectcontact.hxx b/svx/inc/svx/sdr/contact/objectcontact.hxx index 448b61c486ca..3990c48695a3 100644 --- a/svx/inc/svx/sdr/contact/objectcontact.hxx +++ b/svx/inc/svx/sdr/contact/objectcontact.hxx @@ -191,6 +191,9 @@ namespace sdr // recording MetaFile? Default is false virtual bool isOutputToRecordingMetaFile() const; + // pdf export? Default is false + virtual bool isOutputToPDFFile() const; + // gray display mode virtual bool isDrawModeGray() const; diff --git a/svx/inc/svx/sdr/contact/objectcontactofpageview.hxx b/svx/inc/svx/sdr/contact/objectcontactofpageview.hxx index 677e6b20e309..10227d557dde 100644 --- a/svx/inc/svx/sdr/contact/objectcontactofpageview.hxx +++ b/svx/inc/svx/sdr/contact/objectcontactofpageview.hxx @@ -123,6 +123,9 @@ namespace sdr // recording MetaFile? Default is false virtual bool isOutputToRecordingMetaFile() const; + // pdf export? Default is false + virtual bool isOutputToPDFFile() const; + // gray display mode virtual bool isDrawModeGray() const; diff --git a/svx/inc/svx/sdr/overlay/overlaymanager.hxx b/svx/inc/svx/sdr/overlay/overlaymanager.hxx index d2e4f8a8aba3..53cb15c5d72b 100644 --- a/svx/inc/svx/sdr/overlay/overlaymanager.hxx +++ b/svx/inc/svx/sdr/overlay/overlaymanager.hxx @@ -97,7 +97,7 @@ namespace sdr // return mfDiscreteOne to derivations, but also check for buffered local // ViewTransformation and evtl. correct mfDiscreteOne - const double getDiscreteOne() const; + double getDiscreteOne() const; public: OverlayManager(OutputDevice& rOutputDevice); diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index c190d78b7890..a9b3767c3c32 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -74,7 +74,10 @@ namespace drawinglayer attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText); attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet); attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet); - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); + attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText& rText, + bool bSuppressText); // #i98072# added option to suppress text on demand attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill); diff --git a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx index 37edea1a5878..2d419e9cd45d 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx @@ -33,12 +33,14 @@ #define INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX #include <vcl/bitmapex.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines namespace basegfx { class BColor; + class B2DHomMatrix; } ////////////////////////////////////////////////////////////////////////////// @@ -54,6 +56,9 @@ namespace drawinglayer // create a 7x7 gluepoint symbol in given colors as BitmapEx BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB); + // #i99123# + Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix); + } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index 10b35c4dd027..8579b87e9470 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -36,6 +36,8 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <com/sun/star/drawing/XDrawPage.hpp> +#include <boost/shared_ptr.hpp> +#include <svx/outlobj.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines @@ -54,6 +56,11 @@ namespace drawinglayer // something equal const SdrText& mrSdrText; // text model data + // #i97628# + // The text content; now as OutlinerParaObject* and in exclusive, local, cloned + // form as needed in a primitive + const OutlinerParaObject maOutlinerParaObject; + // remeber last VisualizingPage for which a decomposition was made. If the new target // is not given or different, the decomposition needs to be potentially removed // for supporting e.g. page number change on MasterPage objects or the different @@ -77,10 +84,13 @@ namespace drawinglayer void setLastSpellCheck(bool bNew) { mbLastSpellCheck = bNew; } public: - SdrTextPrimitive2D(const SdrText& rSdrText); + SdrTextPrimitive2D( + const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr); // get data const SdrText& getSdrText() const { return mrSdrText; } + const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; @@ -114,6 +124,7 @@ namespace drawinglayer public: SdrContourTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, const ::basegfx::B2DHomMatrix& rObjectTransform); @@ -151,6 +162,7 @@ namespace drawinglayer public: SdrPathTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DPolyPolygon& rPathPolyPolygon); // get data @@ -191,6 +203,7 @@ namespace drawinglayer public: SdrBlockTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DHomMatrix& rTextRangeTransform, bool bUnlimitedPage, bool bCellText, @@ -232,6 +245,7 @@ namespace drawinglayer public: SdrStretchTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, const ::basegfx::B2DHomMatrix& rTextRangeTransform); // get data diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx index 33f72b5c3529..866fda1eff48 100644 --- a/svx/inc/svx/svdomeas.hxx +++ b/svx/inc/svx/svdomeas.hxx @@ -160,6 +160,10 @@ public: virtual FASTBOOL CalcFieldValue(const SvxFieldItem& rField, USHORT nPara, USHORT nPos, FASTBOOL bEdit, Color*& rpTxtColor, Color*& rpFldColor, String& rRet) const; + + // #i97878# + virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const; + virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon); }; ///////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx index d9e9d46739d3..dcdbe7fc1c8f 100644 --- a/svx/inc/svx/svdpntv.hxx +++ b/svx/inc/svx/svdpntv.hxx @@ -383,9 +383,9 @@ public: // DoCompleteRedraw draws the DrawingLayer hierarchy then. // EndCompleteRedraw does the necessary refreshes, evtl. paints text edit and overlay and evtl destroys the // SdrPaintWindow again. This means: the SdrPaintWindow is no longer safe after this closing call. - SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut); - void DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0); - void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer); + virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut); + virtual void DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0); + virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer); //////////////////////////////////////////////////////////////////////////////////////////////////// // used for the other applications basctl/sc/sw which call DrawLayer at PageViews diff --git a/svx/inc/svx/svdpool.hxx b/svx/inc/svx/svdpool.hxx index 12ce8d669f4d..d6cf4f8543b6 100644 --- a/svx/inc/svx/svdpool.hxx +++ b/svx/inc/svx/svdpool.hxx @@ -45,7 +45,9 @@ class SVX_DLLPUBLIC SdrItemPool : public XOutdevItemPool public: SdrItemPool(SfxItemPool* pMaster = 0L, sal_Bool bLoadRefCounts = sal_True); SdrItemPool(const SdrItemPool& rPool); +protected: virtual ~SdrItemPool(); +public: virtual SfxItemPool* Clone() const; virtual SfxItemPresentation GetPresentation(const SfxPoolItem& rItem, diff --git a/svx/inc/svx/unoshape.hxx b/svx/inc/svx/unoshape.hxx index 3d55f9286236..fe8cd8a93e2a 100644 --- a/svx/inc/svx/unoshape.hxx +++ b/svx/inc/svx/unoshape.hxx @@ -73,6 +73,12 @@ class SfxItemSet; class SdrModel; class SvxDrawPage; class SvGlobalName; +// --> OD 2009-01-16 #i59051# +namespace basegfx + { + class B2DPolyPolygon; + } // end of namespace basegfx +// <-- class SvxShapeMutex { @@ -132,6 +138,10 @@ protected: // Umrechnungen fuer den Writer, der in TWIPS arbeitet void ForceMetricToItemPoolMetric(Pair& rPoint) const throw(); void ForceMetricTo100th_mm(Pair& rPoint) const throw(); + // --> OD 2009-01-16 #i59051# + void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw(); + void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw(); + // <-- ::com::sun::star::uno::Any GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertyMap* pMap ) const; diff --git a/svx/inc/svx/xpool.hxx b/svx/inc/svx/xpool.hxx index 6492f4dd6c6a..c8e944801941 100644 --- a/svx/inc/svx/xpool.hxx +++ b/svx/inc/svx/xpool.hxx @@ -56,7 +56,8 @@ public: XOutdevItemPool(const XOutdevItemPool& rPool); virtual SfxItemPool* Clone() const; - ~XOutdevItemPool(); +protected: + virtual ~XOutdevItemPool(); }; #endif // _XPOOL_HXX diff --git a/svx/prj/d.lst b/svx/prj/d.lst index e55f2a585838..3b70b59970fb 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -412,6 +412,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\source\items\boxobj.hxx %_DEST%\inc%_EXT%\svx\boxobj.hxx ..\inc\svx\itemtype.hxx %_DEST%\inc%_EXT%\svx\itemtype.hxx ..\inc\svx\outliner.hxx %_DEST%\inc%_EXT%\svx\outliner.hxx +..\inc\svx\paragraphdata.hxx %_DEST%\inc%_EXT%\svx\paragraphdata.hxx ..\inc\svx\outlobj.hxx %_DEST%\inc%_EXT%\svx\outlobj.hxx ..\inc\svx\editdata.hxx %_DEST%\inc%_EXT%\svx\editdata.hxx ..\inc\svx\editeng.hxx %_DEST%\inc%_EXT%\svx\editeng.hxx diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index cd111db1a654..072d6347f3f4 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -41,6 +41,7 @@ #include <svx/outliner.hxx> #include <svx/svdmodel.hxx> #include <svx/svdobj.hxx> +#include <svx/svdpool.hxx> //------------------------------------------------------------------------ // @@ -112,9 +113,10 @@ namespace accessibility String GetText( const ESelection& /*rSel*/ ) const { return String(); } SfxItemSet GetAttribs( const ESelection& /*rSel*/, BOOL /*bOnlyHardAttrib*/ = 0 ) const { - String aDummyStr(RTL_CONSTASCII_USTRINGPARAM("Dummy")); - SfxItemPool aPool(aDummyStr,0,0,NULL); - return SfxItemSet(aPool); + // AW: Very dangerous: The former implementation used a SfxItemPool created on the + // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using + // a deleted Pool by design. + return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool()); } SfxItemSet GetParaAttribs( USHORT /*nPara*/ ) const { return GetAttribs(ESelection()); } void SetParaAttribs( USHORT /*nPara*/, const SfxItemSet& /*rSet*/ ) {} diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index 9895f3c6e3b0..fbba42ba8d01 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -177,7 +177,7 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustom // Copy text content OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject(); if( pParaObj ) - pTextObj->NbcSetOutlinerParaObject( pParaObj->Clone() ); + pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) ); // copy all attributes SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() ); diff --git a/svx/source/dialog/SpellDialog.cxx b/svx/source/dialog/SpellDialog.cxx index 300aee8197f7..58ffa4cb964b 100644 --- a/svx/source/dialog/SpellDialog.cxx +++ b/svx/source/dialog/SpellDialog.cxx @@ -2161,4 +2161,7 @@ void ExplainButton::RequestHelp( const HelpEvent& ) Help::ShowBalloon( this, GetPosPixel(), m_sExplanation ); } - +void ExplainButton::Click() +{ + RequestHelp( HelpEvent() ); +} diff --git a/svx/source/dialog/chardlg.src b/svx/source/dialog/chardlg.src index b51008e285f6..19ad1e090435 100644 --- a/svx/source/dialog/chardlg.src +++ b/svx/source/dialog/chardlg.src @@ -637,6 +637,7 @@ TabPage RID_SVXPAGE_CHAR_EFFECTS Pos = MAP_APPFONT ( 6 , 168 ) ; Size = MAP_APPFONT ( 248 , 16 ) ; WordBreak = TRUE ; + Hide = TRUE; }; String STR_EFFECTS_CAPITALS { @@ -877,6 +878,7 @@ TabPage RID_SVXPAGE_CHAR_POSITION Pos = MAP_APPFONT ( 6 , 168 ) ; Size = MAP_APPFONT ( 248 , 16 ) ; WordBreak = TRUE ; + Hide = TRUE; }; }; diff --git a/svx/source/dialog/cuifmsearch.cxx b/svx/source/dialog/cuifmsearch.cxx index 33a022f5aba1..b0c80f8297ef 100644 --- a/svx/source/dialog/cuifmsearch.cxx +++ b/svx/source/dialog/cuifmsearch.cxx @@ -512,11 +512,15 @@ IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, CheckBox*, pBox) // die beiden jeweils anderen Boxes disablen oder enablen CheckBox* pBoxes[] = { &m_cbWildCard, &m_cbRegular, &m_cbApprox }; for (sal_uInt32 i=0; i<sizeof(pBoxes)/sizeof(CheckBox*); ++i) + { if (pBoxes[i] != pBox) + { if (bChecked) pBoxes[i]->Disable(); else pBoxes[i]->Enable(); + } + } // an die Engine weiterreichen m_pSearchEngine->SetWildcard(m_cbWildCard.IsEnabled() ? m_cbWildCard.IsChecked() : sal_False); @@ -526,6 +530,7 @@ IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, CheckBox*, pBox) // die Position-Listbox anpassen (ist bei Wildcard-Suche nicht erlaubt) if (pBox == &m_cbWildCard) + { if (bChecked) { m_ftPosition.Disable(); @@ -536,13 +541,16 @@ IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, CheckBox*, pBox) m_ftPosition.Enable(); m_lbPosition.Enable(); } + } // und den Button fuer die Aehnlichkeitssuche if (pBox == &m_cbApprox) + { if (bChecked) m_pbApproxSettings.Enable(); else m_pbApproxSettings.Disable(); + } } else if (pBox == &m_aHalfFullFormsCJK) { diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 090d3eb1da53..162d25937c5f 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -141,7 +141,7 @@ IMapWindow::~IMapWindow() for( String* pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() ) delete pStr; - delete pIMapPool; + SfxItemPool::Free(pIMapPool); delete[] pItemInfo; } @@ -287,7 +287,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) Point aPoint; Rectangle aClipRect( aPoint, GetGraphicSize() ); SdrObject* pSdrObj = NULL; - IMapObject* pCloneIMapObj = NULL; + IMapObjectPtr pCloneIMapObj; switch( pIMapObj->GetType() ) { @@ -300,7 +300,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) aDrawRect.Intersection( aClipRect ); pSdrObj = (SdrObject*) new SdrRectObj( aDrawRect ); - pCloneIMapObj = (IMapObject*) new IMapRectangleObject( *pIMapRectObj ); + pCloneIMapObj.reset((IMapObject*) new IMapRectangleObject( *pIMapRectObj )); } break; @@ -316,7 +316,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) aCircle.Intersection( aClipRect ); pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aCircle, 0, 36000 ); - pCloneIMapObj = (IMapObject*) new IMapCircleObject( *pIMapCircleObj ); + pCloneIMapObj.reset((IMapObject*) new IMapCircleObject( *pIMapCircleObj )); } break; @@ -348,7 +348,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) pSdrObj = (SdrObject*)new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aPolygon)); } - pCloneIMapObj = (IMapObject*) new IMapPolygonObject( *pIMapPolyObj ); + pCloneIMapObj.reset((IMapObject*) new IMapPolygonObject( *pIMapPolyObj )); } break; @@ -416,9 +416,9 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) { SdrRectObj* pRectObj = (SdrRectObj*) &rObj; IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(), - String(), String(), String(), String(), String(), TRUE, FALSE ); + String(), String(), String(), String(), String(), TRUE, FALSE ); - pRectObj->InsertUserData( new IMapUserData( pObj ) ); + pRectObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } break; @@ -431,7 +431,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) IMapPolygonObject* pObj = new IMapPolygonObject( Polygon(aPoly), String(), String(), String(), String(), String(), TRUE, FALSE ); pObj->SetExtraEllipse( aPoly.GetBoundRect() ); - pCircObj->InsertUserData( new IMapUserData( pObj ) ); + pCircObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } break; @@ -447,7 +447,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) { Polygon aPoly(rXPolyPoly.getB2DPolygon(0L)); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, String(), String(), String(), String(), String(), TRUE, FALSE ); - pPathObj->InsertUserData( new IMapUserData( pObj ) ); + pPathObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); } } break; @@ -473,10 +473,10 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) String aAltText; String aDesc; String aTarget; - IMapObject* pIMapObj = pUserData->GetObject(); + IMapObjectPtr pIMapObj = pUserData->GetObject(); BOOL bActive = TRUE; - if ( pIMapObj ) + if ( pIMapObj.get() ) { aURL = pIMapObj->GetURL(); aAltText = pIMapObj->GetAltText(); @@ -489,8 +489,8 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) { case( OBJ_RECT ): { - pUserData->ReplaceObject( new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(), - aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ) ); + pUserData->ReplaceObject( IMapObjectPtr(new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(), + aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ) ) ); } break; @@ -505,7 +505,7 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) // wurde von uns nur temporaer angelegt delete pPathObj; - pUserData->ReplaceObject( pObj ); + pUserData->ReplaceObject( IMapObjectPtr(pObj) ); } break; @@ -521,7 +521,7 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) { Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0L)); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, FALSE ); - pUserData->ReplaceObject( pObj ); + pUserData->ReplaceObject( IMapObjectPtr(pObj) ); } } break; @@ -606,7 +606,7 @@ IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj ) const IMapUserData* pUserData = (IMapUserData*) pSdrObj->GetUserData( 0 ); if ( pUserData ) - pIMapObj = pUserData->GetObject(); + pIMapObj = pUserData->GetObject().get(); } return pIMapObj; diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index d1ac67245ce4..0b8ecd942215 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -83,31 +83,34 @@ const UINT32 IMapInventor = UINT32('I') * 0x00000001+ UINT32('P') * 0x01000000; +typedef boost::shared_ptr< IMapObject > IMapObjectPtr; + class IMapUserData : public SdrObjUserData { - IMapObject* pObj; + // #i98386# use boost::shared_ptr here due to cloning possibilities + IMapObjectPtr mpObj; public: IMapUserData() : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( NULL ) {} + mpObj ( ) {} - IMapUserData( IMapObject* pIMapObj ) : + IMapUserData( const IMapObjectPtr& rIMapObj ) : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( pIMapObj ) {} + mpObj ( rIMapObj ) {} IMapUserData( const IMapUserData& rIMapUserData ) : SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ), - pObj ( rIMapUserData.pObj ) {} + mpObj ( rIMapUserData.mpObj ) {} - ~IMapUserData() { delete pObj; } + ~IMapUserData() { } virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); } - void SetObject( IMapObject* pIMapObj ) { pObj = pIMapObj; } - IMapObject* GetObject() const { return pObj; } - void ReplaceObject( IMapObject* pNewIMapObject ) { delete pObj; pObj = pNewIMapObject; } + void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; } + const IMapObjectPtr GetObject() const { return mpObj; } + void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; } }; diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index b5c71c19c36b..dbf6871fd4a5 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -329,6 +329,7 @@ USHORT SvxLanguageBox::InsertLanguage( const LanguageType nLangType, USHORT nPos String aStrEntry = m_pLangTable->GetString( nLang ); if (LANGUAGE_NONE == nLang && m_bHasLangNone && m_bLangNoneIsLangAll) aStrEntry = m_aAllString; + aStrEntry = ApplyLreOrRleEmbedding( aStrEntry ); USHORT nAt = 0; if ( m_bWithCheckmark ) diff --git a/svx/source/dialog/macropg.cxx b/svx/source/dialog/macropg.cxx index 9abe061693aa..6eeba1b0e703 100644 --- a/svx/source/dialog/macropg.cxx +++ b/svx/source/dialog/macropg.cxx @@ -285,6 +285,8 @@ void _SvxMacroTabPage::InitResources() aDisplayNames.push_back( EventDisplayName( "OnModifyChanged", RID_SVXSTR_EVENT_MODIFYCHANGED ) ); aDisplayNames.push_back( EventDisplayName( "OnMailMerge", RID_SVXSTR_EVENT_MAILMERGE ) ); aDisplayNames.push_back( EventDisplayName( "OnPageCountChange", RID_SVXSTR_EVENT_PAGECOUNTCHANGE ) ); + aDisplayNames.push_back( EventDisplayName( "OnSubComponentOpened", RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED ) ); + aDisplayNames.push_back( EventDisplayName( "OnSubComponentClosed", RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED ) ); // the event name to UI string mappings for forms & dialogs // diff --git a/svx/source/dialog/macropg.src b/svx/source/dialog/macropg.src index 0fddd8cd3186..7bcd35a13948 100644 --- a/svx/source/dialog/macropg.src +++ b/svx/source/dialog/macropg.src @@ -232,6 +232,14 @@ String RID_SVXSTR_EVENT_PAGECOUNTCHANGE { Text [ en-US ] = "Changing the page count" ; }; +String RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED +{ + Text = "Loaded a sub component" ; +}; +String RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED +{ + Text = "Closed a sub component" ; +}; String RID_SVXSTR_EVENT_APPROVEPARAMETER { Text [ en-US ] = "Fill parameters" ; diff --git a/svx/source/dialog/optgdlg.cxx b/svx/source/dialog/optgdlg.cxx index ee45b9c8c928..0c9c0abe5693 100644 --- a/svx/source/dialog/optgdlg.cxx +++ b/svx/source/dialog/optgdlg.cxx @@ -1282,8 +1282,9 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe String aStr_( pCurr->GetBankSymbol() ); aStr_ += aTwoSpace; aStr_ += pCurr->GetSymbol(); + aStr = ApplyLreOrRleEmbedding( aStr_ ); aStr_ += aTwoSpace; - aStr_ += pLanguageTable->GetString( pCurr->GetLanguage() ); + aStr_ += ApplyLreOrRleEmbedding( pLanguageTable->GetString( pCurr->GetLanguage() ) ); USHORT nPos = aCurrencyLB.InsertEntry( aStr_ ); aCurrencyLB.SetEntryData( nPos, (void*) pCurr ); } diff --git a/svx/source/dialog/optimprove.cxx b/svx/source/dialog/optimprove.cxx index 088064266083..c50abdf026b0 100644 --- a/svx/source/dialog/optimprove.cxx +++ b/svx/source/dialog/optimprove.cxx @@ -50,6 +50,8 @@ #include <com/sun/star/oooimprovement/XCoreController.hpp> #include <comphelper/configurationhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/uieventslogger.hxx> +#include <tools/testtoolloader.hxx> namespace lang = ::com::sun::star::lang; namespace uno = ::com::sun::star::uno; @@ -87,11 +89,12 @@ SvxImprovementPage::SvxImprovementPage( Window* pParent ) : m_aShowDataPB.Hide(); Size aNewSize = m_aInvitationFT.GetSizePixel(); - const long nNewWidth = aNewSize.Width() * 4 / 5; + const long nMinWidth = m_aYesRB.CalcMinimumSize().Width(); + const long nNewWidth = std::max( aNewSize.Width() * 4 / 5, nMinWidth ); const long nWDelta = aNewSize.Width() - nNewWidth; aNewSize.Width() = nNewWidth; - Size aCalcSize = m_aInvitationFT.CalcMinimumSize( nNewWidth ); - long nHDelta = aCalcSize.Height() - aNewSize.Height(); + const Size aCalcSize = m_aInvitationFT.CalcMinimumSize( nNewWidth ); + const long nHDelta = aCalcSize.Height() - aNewSize.Height(); aNewSize.Height() = aCalcSize.Height(); m_aInvitationFT.SetSizePixel( aNewSize ); @@ -190,6 +193,9 @@ IMPL_LINK( SvxImprovementDialog, HandleOK, OKButton*, EMPTYARG ) ::rtl::OUString::createFromAscii("InvitationAccepted"), uno::makeAny( m_pPage->IsYesChecked() ), ::comphelper::ConfigurationHelper::E_STANDARD ); + // TODO: refactor + ::comphelper::UiEventsLogger::reinit(); + ::tools::InitTestToolLib(); } EndDialog( RET_OK ); return 0; @@ -222,110 +228,3 @@ void SvxInfoWindow::SetInfoText( const String& rText ) m_aInfoText.SetPosSizePixel( aPos, aSize ); } -// class SvxImprovementDialog2 ------------------------------------------- - -SvxImprovementDialog2::SvxImprovementDialog2( Window* pParent ) : - - ModalDialog( pParent, SVX_RES( RID_SVXPAGE_IMPROVEMENT ) ), - - m_aInfoWin ( this, SVX_RES( WIN_INFO ) ), - m_aInvitationFT ( this, SVX_RES( FT_INVITATION ) ), - m_aYesRB ( this, SVX_RES( RB_YES ) ), - m_aNoRB ( this, SVX_RES( RB_NO ) ), - m_aButtonLine ( this, SVX_RES( FL_IMPROVE ) ), - m_aInfoFI ( this, SVX_RES( FI_INFO ) ), - m_aOKBtn ( this, SVX_RES( BTN_OK ) ) - -{ - FreeResource(); - - SvxImprovementPage* pPage = new SvxImprovementPage( this ); - m_aInfoWin.Show(); - m_aInfoWin.SetInfoText( pPage->GetInfoText() ); - m_aInvitationFT.SetText( pPage->GetInvitationText() ); - m_aYesRB.SetText( pPage->GetYesButtonText() ); - m_aNoRB.SetText( pPage->GetNoButtonText() ); - SetText( pPage->GetPageText() ); - delete pPage; - - m_aInfoFI.SetClickHdl( LINK( this, SvxImprovementDialog2, HandleHyperlink ) ); - m_aOKBtn.SetClickHdl( LINK( this, SvxImprovementDialog2, HandleOK ) ); - - Size aImgSz = m_aInfoFI.GetImage().GetSizePixel(); - Size aCtrlSz = m_aInfoFI.GetSizePixel(); - Point aCtrlPos = m_aInfoFI.GetPosPixel(); - - long nDeltaW = aCtrlSz.Width() - aImgSz.Width(); - long nDeltaH = aCtrlSz.Height() - aImgSz.Height(); - if ( nDeltaW > 4 ) - { - nDeltaW -= 4; - aCtrlSz.Width() -= nDeltaW; - aCtrlPos.X() -= ( nDeltaW / 2 ); - } - if ( nDeltaH > 4 ) - { - nDeltaH -= 4; - aCtrlSz.Height() -= nDeltaH; - aCtrlPos.Y() -= ( nDeltaH / 2 ); - } - m_aInfoFI.SetPosSizePixel( aCtrlPos, aCtrlSz ); -} - -IMPL_LINK( SvxImprovementDialog2, HandleHyperlink, svt::FixedHyperlinkImage*, pHyperlinkImage ) -{ - ::rtl::OUString sURL( pHyperlinkImage->GetURL() ); - - if ( sURL.getLength() > 0 ) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xSMGR = - ::comphelper::getProcessServiceFactory(); - uno::Reference< XSystemShellExecute > xSystemShell( - xSMGR->createInstance( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), - uno::UNO_QUERY_THROW ); - if ( xSystemShell.is() ) - { - xSystemShell->execute( - sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); - } - } - catch( const uno::Exception& e ) - { - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - - return 0; -} - -IMPL_LINK( SvxImprovementDialog2, HandleOK, OKButton*, EMPTYARG ) -{ - uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - uno::Reference< com::sun::star::oooimprovement::XCoreController > core_c( - xSMGR->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.oooimprovement.CoreController")), - uno::UNO_QUERY); - if(core_c.is()) - { - ::comphelper::ConfigurationHelper::writeDirectKey( - xSMGR, - ::rtl::OUString::createFromAscii("/org.openoffice.Office.OOoImprovement.Settings"), - ::rtl::OUString::createFromAscii("Participation"), - ::rtl::OUString::createFromAscii("ShowedInvitation"), - uno::makeAny( true ), - ::comphelper::ConfigurationHelper::E_STANDARD ); - ::comphelper::ConfigurationHelper::writeDirectKey( - xSMGR, - ::rtl::OUString::createFromAscii("/org.openoffice.Office.OOoImprovement.Settings"), - ::rtl::OUString::createFromAscii("Participation"), - ::rtl::OUString::createFromAscii("InvitationAccepted"), - uno::makeAny( m_aYesRB.IsChecked() != FALSE ), - ::comphelper::ConfigurationHelper::E_STANDARD ); - } - EndDialog( RET_OK ); - return 0; -} - diff --git a/svx/source/dialog/optimprove2.cxx b/svx/source/dialog/optimprove2.cxx index 91f2f95f1805..81bf4be47584 100644 --- a/svx/source/dialog/optimprove2.cxx +++ b/svx/source/dialog/optimprove2.cxx @@ -51,10 +51,14 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/oooimprovement/XCore.hpp> #include <com/sun/star/oooimprovement/XCoreController.hpp> +#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> #include <comphelper/configurationhelper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/synchronousdispatch.hxx> +#include <comphelper/uieventslogger.hxx> +#include <tools/testtoolloader.hxx> #define C2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) @@ -62,6 +66,7 @@ namespace beans = ::com::sun::star::beans; namespace lang = ::com::sun::star::lang; namespace uno = ::com::sun::star::uno; namespace util = ::com::sun::star::util; +using namespace com::sun::star::system; // class SvxEmptyPage ---------------------------------------------------- @@ -97,6 +102,8 @@ SvxImprovementOptionsPage::SvxImprovementOptionsPage( Window* pParent, const Sfx { FreeResource(); + m_aInfoFI.SetURL( C2S( "www.sun.com/privacy/" ) ); + m_aInfoFI.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleHyperlink ) ); m_aShowDataPB.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleShowData ) ); } @@ -104,6 +111,36 @@ SvxImprovementOptionsPage::~SvxImprovementOptionsPage() { } +IMPL_LINK( SvxImprovementOptionsPage, HandleHyperlink, svt::FixedHyperlinkImage*, EMPTYARG ) +{ + ::rtl::OUString sURL( m_aInfoFI.GetURL() ); + + if ( sURL.getLength() > 0 ) + { + try + { + uno::Reference< lang::XMultiServiceFactory > xSMGR = + ::comphelper::getProcessServiceFactory(); + uno::Reference< XSystemShellExecute > xSystemShell( + xSMGR->createInstance( ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), + uno::UNO_QUERY_THROW ); + if ( xSystemShell.is() ) + { + xSystemShell->execute( + sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); + } + } + catch( const uno::Exception& e ) + { + OSL_TRACE( "Caught exception: %s\n thread terminated.\n", + rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); + } + } + + return 0; +} + IMPL_LINK( SvxImprovementOptionsPage, HandleShowData, PushButton*, EMPTYARG ) { uno::Reference < uno::XInterface > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( @@ -148,6 +185,9 @@ sal_Bool SvxImprovementOptionsPage::FillItemSet( SfxItemSet& /*rSet*/ ) ::comphelper::ConfigurationHelper::writeRelativeKey( xConfig, C2S("Participation"), C2S("InvitationAccepted"), uno::makeAny( m_aYesRB.IsChecked() != FALSE ) ); ::comphelper::ConfigurationHelper::flush( xConfig ); + // TODO: refactor + ::comphelper::UiEventsLogger::reinit(); + ::tools::InitTestToolLib(); } catch( uno::Exception& ) { diff --git a/svx/source/dialog/textattr.cxx b/svx/source/dialog/textattr.cxx index f8d54239d176..a7eb3069026a 100644 --- a/svx/source/dialog/textattr.cxx +++ b/svx/source/dialog/textattr.cxx @@ -500,10 +500,12 @@ BOOL SvxTextAttrPage::FillItemSet( SfxItemSet& rAttrs) if(!bIsDisabled) { if( aTsbFullWidth.GetState() == STATE_CHECK ) + { if (IsTextDirectionLeftToRight()) eTHA = SDRTEXTHORZADJUST_BLOCK; else eTVA = SDRTEXTVERTADJUST_BLOCK; + } if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SFX_ITEM_DONTCARE ) { diff --git a/svx/source/dialog/treeopt.cxx b/svx/source/dialog/treeopt.cxx index ba36428e2cd5..7b13286ebd36 100644 --- a/svx/source/dialog/treeopt.cxx +++ b/svx/source/dialog/treeopt.cxx @@ -55,6 +55,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/oooimprovement/XCoreController.hpp> #include <comphelper/configurationhelper.hxx> #include <com/sun/star/awt/XDialogProvider.hpp> #include <com/sun/star/awt/XDialogProvider2.hpp> @@ -1892,18 +1893,15 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) for ( i = 1; i < nEnd; ++i ) { - bool bImprovePage = false; + String sNewTitle = rGeneralArray.GetString(i); nPageId = (sal_uInt16)rGeneralArray.GetValue(i); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; // Disable Online Update page if service not installed - if( RID_SVXPAGE_ONLINEUPDATE == nPageId || RID_SVXPAGE_IMPROVEMENT == nPageId ) + if( RID_SVXPAGE_ONLINEUPDATE == nPageId ) { - bImprovePage = ( RID_SVXPAGE_IMPROVEMENT == nPageId ); - ::rtl::OUString sService = bImprovePage ? - C2U("com.sun.star.oooimprovement.CoreController") : - C2U("com.sun.star.setup.UpdateCheck"); + const ::rtl::OUString sService = C2U("com.sun.star.setup.UpdateCheck"); try { @@ -1917,33 +1915,49 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) { continue; } + } + // Disable OOoImprovement page if not enabled + if( RID_SVXPAGE_IMPROVEMENT == nPageId ) + { + const ::rtl::OUString sService = C2U("com.sun.star.oooimprovement.CoreController"); + + try + { + Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + Reference < ::com::sun::star::oooimprovement::XCoreController > xService( xFactory->createInstance( sService ), UNO_QUERY ); + + if( ! xService.is() ) + continue; + if( ! xService->showBuiltinOptionsPage(1)) + continue; + } + catch ( ::com::sun::star::loader::CannotActivateFactoryException& ) + { + continue; + } - if ( bImprovePage ) + SvxEmptyPage* pTempPage = new SvxEmptyPage( this ); + sPageTitle = pTempPage->GetText(); + delete pTempPage; + xub_StrLen nPos = sPageTitle.Search( rGeneralArray.GetString(0) ); + if ( nPos != STRING_NOTFOUND ) { - SvxEmptyPage* pTempPage = new SvxEmptyPage( this ); - sPageTitle = pTempPage->GetText(); - delete pTempPage; - xub_StrLen nPos = sPageTitle.Search( rGeneralArray.GetString(0) ); - if ( nPos != STRING_NOTFOUND ) + xub_StrLen nLen = rGeneralArray.GetString(0).Len(); + if ( sPageTitle.GetChar( nPos + nLen ) == ' ' ) + nLen++; + else if ( nPos + nLen == sPageTitle.Len() && + sPageTitle.GetChar( nPos + nLen ) == ' ' ) { - xub_StrLen nLen = rGeneralArray.GetString(0).Len(); - if ( sPageTitle.GetChar( nPos + nLen ) == ' ' ) - nLen++; - else if ( nPos + nLen == sPageTitle.Len() && - sPageTitle.GetChar( nPos + nLen ) == ' ' ) - { - nPos++; - nLen++; - } - sPageTitle.Erase( nPos, nLen ); + nPos++; + nLen++; } + sPageTitle.Erase( nPos, nLen ); } + if(sPageTitle.Len() > 0) + sNewTitle = sPageTitle; } - if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled ) { - String sNewTitle = - ( bImprovePage && sPageTitle.Len() > 0 ) ? sPageTitle : rGeneralArray.GetString(i); AddTabPage( nPageId, sNewTitle, nGroup ); } } diff --git a/svx/source/editeng/editdoc.cxx b/svx/source/editeng/editdoc.cxx index d5f5cbff507f..c90de8eb5ce0 100644 --- a/svx/source/editeng/editdoc.cxx +++ b/svx/source/editeng/editdoc.cxx @@ -1245,7 +1245,7 @@ EditDoc::~EditDoc() { ImplDestroyContents(); if ( bOwnerOfPool ) - delete pItemPool; + SfxItemPool::Free(pItemPool); } void EditDoc::ImplDestroyContents() diff --git a/svx/source/editeng/editdoc.hxx b/svx/source/editeng/editdoc.hxx index 3b4d5cdb5515..dd9662d366e5 100644 --- a/svx/source/editeng/editdoc.hxx +++ b/svx/source/editeng/editdoc.hxx @@ -784,7 +784,9 @@ class EditEngineItemPool : public SfxItemPool { public: EditEngineItemPool( BOOL bPersistenRefCounts ); - ~EditEngineItemPool(); +protected: + virtual ~EditEngineItemPool(); +public: virtual SvStream& Store( SvStream& rStream ) const; }; diff --git a/svx/source/editeng/editobj.cxx b/svx/source/editeng/editobj.cxx index 759c39b79c00..d0170e507060 100644 --- a/svx/source/editeng/editobj.cxx +++ b/svx/source/editeng/editobj.cxx @@ -566,8 +566,42 @@ bool EditTextObject::operator==( const EditTextObject& rCompare ) const return static_cast< const BinTextObject* >( this )->operator==( static_cast< const BinTextObject& >( rCompare ) ); } +// from SfxItemPoolUser +void BinTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool) +{ + if(!bOwnerOfPool && pPool && pPool == &rSfxItemPool) + { + // The pool we are based on gets destructed; get owner of pool by creating own one. + // No need to call RemoveSfxItemPoolUser(), this is done from the pool's destructor + // Base new pool on EditEnginePool; it would also be possible to clone the used + // pool if needed, but only text attributes should be used. + SfxItemPool* pNewPool = EditEngine::CreatePool(); + + if(pPool) + { + pNewPool->SetDefaultMetric(pPool->GetMetric(DEF_METRIC)); + } + + for(sal_uInt16 n(0); n < aContents.Count(); n++) + { + // clone ContentInfos for new pool + ContentInfo* pOrg = aContents.GetObject(n); + DBG_ASSERT(pOrg, "NULL-Pointer in ContentList!"); + + ContentInfo* pNew = new ContentInfo(*pOrg, *pNewPool); + aContents.Replace(pNew, n); + delete pOrg; + } + + // set local variables + pPool = pNewPool; + bOwnerOfPool = TRUE; + } +} + BinTextObject::BinTextObject( SfxItemPool* pP ) : - EditTextObject( EE_FORMAT_BIN ) + EditTextObject( EE_FORMAT_BIN ), + SfxItemPoolUser() { nVersion = 0; nMetric = 0xFFFF; @@ -584,13 +618,20 @@ BinTextObject::BinTextObject( SfxItemPool* pP ) : pPool = EditEngine::CreatePool(); bOwnerOfPool = TRUE; } + + if(!bOwnerOfPool && pPool) + { + pPool->AddSfxItemPoolUser(*this); + } + bVertical = FALSE; bStoreUnicodeStrings = FALSE; nScriptType = 0; } BinTextObject::BinTextObject( const BinTextObject& r ) : - EditTextObject( r ) + EditTextObject( r ), + SfxItemPoolUser() { nVersion = r.nVersion; nMetric = r.nMetric; @@ -613,6 +654,11 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : } + if(!bOwnerOfPool && pPool) + { + pPool->AddSfxItemPoolUser(*this); + } + if ( bOwnerOfPool && pPool && r.pPool ) pPool->SetDefaultMetric( r.pPool->GetMetric( DEF_METRIC ) ); @@ -627,6 +673,11 @@ BinTextObject::BinTextObject( const BinTextObject& r ) : __EXPORT BinTextObject::~BinTextObject() { + if(!bOwnerOfPool && pPool) + { + pPool->RemoveSfxItemPoolUser(*this); + } + ClearPortionInfo(); DeleteContents(); if ( bOwnerOfPool ) @@ -634,7 +685,7 @@ __EXPORT BinTextObject::~BinTextObject() // Nicht mehr, wegen 1xDefItems. // siehe auch ~EditDoc(). // pPool->ReleaseDefaults( TRUE /* bDelete */ ); - delete pPool; + SfxItemPool::Free(pPool); } } diff --git a/svx/source/editeng/editobj2.hxx b/svx/source/editeng/editobj2.hxx index 943e394f7ee7..51a044575dd2 100644 --- a/svx/source/editeng/editobj2.hxx +++ b/svx/source/editeng/editobj2.hxx @@ -195,7 +195,7 @@ SV_DECL_PTRARR( ContentInfoList, ContentInfoPtr, 1, 4 ) // MT 05/00: Sollte mal direkt EditTextObjekt werden => keine virtuellen Methoden mehr. -class BinTextObject : public EditTextObject +class BinTextObject : public EditTextObject, public SfxItemPoolUser { using EditTextObject::operator==; @@ -303,6 +303,8 @@ public: bool operator==( const BinTextObject& rCompare ) const; + // from SfxItemPoolUser + virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool); }; #endif // _EDITOBJ2_HXX diff --git a/svx/source/editeng/impedit3.cxx b/svx/source/editeng/impedit3.cxx index a7b9beeb6a53..93bbf1915ab0 100644 --- a/svx/source/editeng/impedit3.cxx +++ b/svx/source/editeng/impedit3.cxx @@ -163,7 +163,18 @@ BYTE GetCharTypeForCompression( xub_Unicode cChar ) } } -void lcl_DrawRedLines( OutputDevice* pOutDev, long nFontHeight, const Point& rPnt, sal_uInt16 nIndex, sal_uInt16 nMaxEnd, const sal_Int32* pDXArray, WrongList* pWrongs, short nOrientation, const Point& rOrigin, BOOL bVertical ) +void lcl_DrawRedLines( + OutputDevice* pOutDev, + long nFontHeight, + const Point& rPnt, + sal_uInt16 nIndex, + sal_uInt16 nMaxEnd, + const sal_Int32* pDXArray, + WrongList* pWrongs, + short nOrientation, + const Point& rOrigin, + BOOL bVertical, + BOOL bIsRightToLeft ) { #ifndef SVX_LIGHT // Aber nur, wenn Font nicht zu klein... @@ -202,14 +213,24 @@ void lcl_DrawRedLines( OutputDevice* pOutDev, long nFontHeight, const Point& rPn if ( nStart > nIndex ) { if ( !bVertical ) - aPnt1.X() += pDXArray[ nStart - nIndex - 1 ]; + { + // since for RTL portions rPnt is on the visual right end of the portion + // (i.e. at the start of the first RTL char) we need to subtract the offset + // for RTL portions... + aPnt1.X() += (bIsRightToLeft ? -1 : 1) * pDXArray[ nStart - nIndex - 1 ]; + } else aPnt1.Y() += pDXArray[ nStart - nIndex - 1 ]; } Point aPnt2( rPnt ); DBG_ASSERT( nEnd > nIndex, "RedLine: aPnt2?" ); if ( !bVertical ) - aPnt2.X() += pDXArray[ nEnd - nIndex - 1 ]; + { + // since for RTL portions rPnt is on the visual right end of the portion + // (i.e. at the start of the first RTL char) we need to subtract the offset + // for RTL portions... + aPnt2.X() += (bIsRightToLeft ? -1 : 1) * pDXArray[ nEnd - nIndex - 1 ]; + } else aPnt2.Y() += pDXArray[ nEnd - nIndex - 1 ]; if ( nOrientation ) @@ -3153,6 +3174,11 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta Point aOutPos( aTmpPos ); aRedLineTmpPos = aTmpPos; + // In RTL portions spell markup pos should be at the start of the + // first chara as well. That is on the right end of the portion + if (pTextPortion->IsRightToLeft()) + aRedLineTmpPos.X() += pTextPortion->GetSize().Width(); + //L2R if ( pTextPortion->GetRightToLeft() ) //L2R { //L2R sal_uInt16 nNextPortion = y+1; @@ -3419,7 +3445,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta } Color aOldColor( pOutDev->GetLineColor() ); pOutDev->SetLineColor( Color( GetColorConfig().GetColorValue( svtools::SPELL ).nColor ) ); - lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, nIndex, nIndex + pTextPortion->GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical() ); + lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, nIndex, nIndex + pTextPortion->GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), pTextPortion->IsRightToLeft() ); pOutDev->SetLineColor( aOldColor ); } #endif // !SVX_LIGHT diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 28b6c509dc12..cbb5cd5b48f2 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -1109,6 +1109,7 @@ void FmGridControl::SetDesignMode(sal_Bool bMode) sal_Bool bOldMode = IsDesignMode(); DbGridControl::SetDesignMode(bMode); if (bOldMode != bMode) + { if (!bMode) { // selection aufheben @@ -1136,6 +1137,7 @@ void FmGridControl::SetDesignMode(sal_Bool bMode) } } } + } } //------------------------------------------------------------------------------ @@ -2043,6 +2045,7 @@ void FmGridControl::Select() Reference< XIndexAccess > xColumns(GetPeer()->getColumns(), UNO_QUERY); Reference< XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY); if (xSelSupplier.is()) + { if (nSelectedColumn != SAL_MAX_UINT16) { Reference< XPropertySet > xColumn; @@ -2053,6 +2056,7 @@ void FmGridControl::Select() { xSelSupplier->select(Any()); } + } } catch(Exception&) { diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 157f8deaf2b0..80983514ede5 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1940,10 +1940,12 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V { FmXGridCell* pXCell = pLoop->GetCell(); if (pXCell) + { if (bVoid) pXCell->SetTextLineColor(); else pXCell->SetTextLineColor(aTextLineColor); + } pLoop = rColumns.Next(); } @@ -2911,11 +2913,15 @@ IMPL_LINK(FmXGridPeer, OnQueryGridSlotState, void*, pSlot) Sequence<sal_uInt16>& aSupported = getSupportedGridSlots(); const sal_uInt16* pSlots = aSupported.getConstArray(); for (sal_uInt16 i=0; i<aSupported.getLength(); ++i) + { if (pSlots[i] == nSlot) + { if (!m_pDispatchers[i].is()) return -1; // nothing known about this slot else return m_pStateCache[i]; + } + } return -1; } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index b3b18632884c..96534551b354 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -1323,6 +1323,7 @@ sal_uInt16 DbGridControl::SetOptions(sal_uInt16 nOpt) // the 'insert' option affects our empty row if (bInsertChanged) + { if (m_nOptions & OPT_INSERT) { // the insert option is to be set m_xEmptyRow = new DbGridRow(); @@ -1335,6 +1336,7 @@ sal_uInt16 DbGridControl::SetOptions(sal_uInt16 nOpt) GoToRowColumnId(GetCurRow() - 1, GetCurColumnId()); RowRemoved(GetRowCount(), 1, sal_True); } + } // the 'delete' options has no immediate consequences @@ -1729,10 +1731,12 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) for (nNewModelPos = 0; nNewModelPos < m_aColumns.Count(); ++nNewModelPos) { if (!m_aColumns.GetObject(nNewModelPos)->IsHidden()) + { if (!nNewViewPos) break; else --nNewViewPos; + } } DBG_ASSERT(nNewModelPos<m_aColumns.Count(), "DbGridControl::ColumnMoved : could not find the new model position !"); diff --git a/svx/source/form/fmctrler.cxx b/svx/source/form/fmctrler.cxx index eea5570389b0..8fbac309c736 100644 --- a/svx/source/form/fmctrler.cxx +++ b/svx/source/form/fmctrler.cxx @@ -163,7 +163,7 @@ class ColumnInfoCache public: ColumnInfoCache( const Reference< XColumnsSupplier >& _rxColSupplier ); - const size_t getColumnCount() const { return m_aColumns.size(); } + size_t getColumnCount() const { return m_aColumns.size(); } const ColumnInfo& getColumnInfo( size_t _pos ); bool controlsInitialized() const { return m_bControlsInitialized; } diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 738aad42fb2c..529646e2fea1 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -1333,25 +1333,11 @@ void FmFormShell::SetControlActivationHandler( const Link& _rHdl ) } //------------------------------------------------------------------------ -SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const +namespace { - if ( !_rxModel.is() ) - return NULL; - - FmFormModel* pModel = GetFormModel(); - OSL_ENSURE( pModel, "FmFormShell::GetFormControl: no model!" ); - if ( !pModel ) - return NULL; - - sal_uInt16 pageCount = pModel->GetPageCount(); - for ( sal_uInt16 page = 0; page < pageCount; ++page ) + SdrUnoObj* lcl_findUnoObject( const SdrObjList& _rObjList, const Reference< XControlModel >& _rxModel ) { - SdrPage* pPage = pModel->GetPage( page ); - OSL_ENSURE( pPage, "FmFormShell::GetFormControl: NULL page encountered!" ); - if ( !pPage ) - continue; - - SdrObjListIter aIter( *pPage ); + SdrObjListIter aIter( _rObjList ); while ( aIter.IsMore() ) { SdrObject* pObject = aIter.Next(); @@ -1364,12 +1350,51 @@ SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxMod continue; if ( _rxModel == xControlModel ) - { - _out_rxControl = pUnoObject->GetUnoControl( _rView, _rDevice ); return pUnoObject; - } } + return NULL; } +} + +//------------------------------------------------------------------------ +SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const +{ + if ( !_rxModel.is() ) + return NULL; + + // we can only retrieve controls for SdrObjects which belong to page which is actually displayed in the given view + SdrPageView* pPageView = _rView.GetSdrPageView(); + SdrPage* pPage = pPageView ? pPageView->GetPage() : NULL; + OSL_ENSURE( pPage, "FmFormShell::GetFormControl: no page displayed in the given view!" ); + if ( !pPage ) + return NULL; + + SdrUnoObj* pUnoObject = lcl_findUnoObject( *pPage, _rxModel ); + if ( pUnoObject ) + { + _out_rxControl = pUnoObject->GetUnoControl( _rView, _rDevice ); + return pUnoObject; + } + +#if OSL_DEBUG_LEVEL > 0 + // perhaps we are fed with a control model which lives on a page other than the one displayed + // in the given view. This is worth being reported as error, in non-product builds. + FmFormModel* pModel = GetFormModel(); + if ( pModel ) + { + sal_uInt16 pageCount = pModel->GetPageCount(); + for ( sal_uInt16 page = 0; page < pageCount; ++page ) + { + pPage = pModel->GetPage( page ); + OSL_ENSURE( pPage, "FmFormShell::GetFormControl: NULL page encountered!" ); + if ( !pPage ) + continue; + + pUnoObject = lcl_findUnoObject( *pPage, _rxModel ); + OSL_ENSURE( !pUnoObject, "FmFormShell::GetFormControl: the given control model belongs to a wrong page (displayed elsewhere)!" ); + } + } +#endif return NULL; } diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index fab478154247..1ad30e5fd78f 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -431,6 +431,7 @@ sal_Bool isControlList(const SdrMarkList& rMarkList) // And this would be wrong :) // 03.02.00 - 72529 - FS if (!pAs3DObject) + { if (pObj->IsGroupObject()) { SdrObjListIter aIter(*pObj->GetSubList()); @@ -445,6 +446,7 @@ sal_Bool isControlList(const SdrMarkList& rMarkList) bHadAnyLeafs = sal_True; bControlList = FmFormInventor == pObj->GetObjInventor(); } + } } return bControlList && bHadAnyLeafs; @@ -1150,14 +1152,17 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent { Reference< XBindableValue > xOldBindable( xOldModel, UNO_QUERY ); Reference< XBindableValue > xNewBindable( xNewModel, UNO_QUERY ); + if ( xOldBindable.is() ) { try { - xNewBindable->setValueBinding( xOldBindable->getValueBinding() ); + if ( xNewBindable.is() ) + xNewBindable->setValueBinding( xOldBindable->getValueBinding() ); xOldBindable->setValueBinding( NULL ); } - catch(const IncompatibleTypesException&) + catch(const Exception&) { + DBG_UNHANDLED_EXCEPTION(); } } } @@ -1165,16 +1170,17 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent { Reference< XListEntrySink > xOldSink( xOldModel, UNO_QUERY ); Reference< XListEntrySink > xNewSink( xNewModel, UNO_QUERY ); - if ( xOldSink.is() && xNewSink.is() ) + if ( xOldSink.is() ) { try { - xNewSink->setListEntrySource( xOldSink->getListEntrySource() ); + if ( xNewSink.is() ) + xNewSink->setListEntrySource( xOldSink->getListEntrySource() ); xOldSink->setListEntrySource( NULL ); } catch(const Exception&) { - DBG_ERROR("FmXFormShell::executeControlConversionSlot: caught an exception while creating the control !"); + DBG_UNHANDLED_EXCEPTION(); } } } @@ -2427,11 +2433,12 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn Reference< XPropertySet> xCursorSet(pfmscContextInfo->xCursor, UNO_QUERY); Reference< XResultSetUpdate> xUpdateCursor(pfmscContextInfo->xCursor, UNO_QUERY); if (xUpdateCursor.is() && xCursorSet.is() && xCursorSet.is()) + { if (::comphelper::getBOOL(xCursorSet->getPropertyValue(FM_PROP_ISNEW))) xUpdateCursor->moveToCurrentRow(); - else - if (::comphelper::getBOOL(xCursorSet->getPropertyValue(FM_PROP_ISMODIFIED))) - xUpdateCursor->cancelRowUpdates(); + else if (::comphelper::getBOOL(xCursorSet->getPropertyValue(FM_PROP_ISMODIFIED))) + xUpdateCursor->cancelRowUpdates(); + } return pfmscContextInfo->arrFields.size(); } diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 73665766a3a4..08643e025e19 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -670,15 +670,15 @@ namespace svx //------------------------------------------------------------------------ void FmTextControlShell::executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq ) { - ::std::auto_ptr< SfxItemPool > pPool( EditEngine::CreatePool() ); - pPool->FreezeIdRanges(); - SfxItemSet aPureItems( *pPool ); - const SvxFontListItem* pFontList = PTR_CAST( SvxFontListItem, m_pViewFrame->GetObjectShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); DBG_ASSERT( pFontList, "FmTextControlShell::executeAttributeDialog: no font list item!" ); if ( !pFontList ) return; + SfxItemPool* pPool = EditEngine::CreatePool(); + pPool->FreezeIdRanges(); + SfxItemSet aPureItems( *pPool ); + // put the current states of the items into the set SfxAllItemSet aCurrentItems( aPureItems ); transferFeatureStatesToItemSet( m_aControlFeatures, aCurrentItems ); @@ -774,6 +774,8 @@ namespace svx } _rReq.Done( rModifiedItems ); } + + SfxItemPool::Free(pPool); } //------------------------------------------------------------------------ diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index d3b83f7c7676..159efb1331a1 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -860,12 +860,14 @@ sal_Int16 GridView2ModelPos(const Reference< ::com::sun::star::container::XInd { rColumns->getByIndex(i) >>= xCur; if (!::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN))) + { // for every visible col : if nViewPos is greater zero, decrement it, else we // have found the model position if (!nViewPos) break; else --nViewPos; + } } if (i<rColumns->getCount()) return i; diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 2b5095473067..94ce048f4ed2 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -498,14 +498,17 @@ void FmFormView::RemoveControlContainer(const Reference< ::com::sun::star::awt:: } // ----------------------------------------------------------------------------- -void FmFormView::onBeginCompleteRedraw() +SdrPaintWindow* FmFormView::BeginCompleteRedraw(OutputDevice* pOut) { + SdrPaintWindow* pPaintWindow = E3dView::BeginCompleteRedraw( pOut ); pImpl->suspendTabOrderUpdate(); + return pPaintWindow; } // ----------------------------------------------------------------------------- -void FmFormView::onEndCompleteRedraw() +void FmFormView::EndCompleteRedraw( SdrPaintWindow& rPaintWindow, bool bPaintFormLayer ) { + E3dView::EndCompleteRedraw( rPaintWindow, bPaintFormLayer ); pImpl->resumeTabOrderUpdate(); } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 4a8d993cf595..d696f84b0b44 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -197,23 +197,35 @@ FmXPageViewWinRec::~FmXPageViewWinRec() //------------------------------------------------------------------ void FmXPageViewWinRec::dispose() { - for (::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin(); - i != m_aControllerList.end(); i++) + for ( ::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin(); + i != m_aControllerList.end(); + ++i + ) { - // detaching the events - Reference< XChild > xChild((*i)->getModel(), UNO_QUERY); - if (xChild.is()) + try { - Reference< XEventAttacherManager > xEventManager(xChild->getParent(), UNO_QUERY); - Reference< XInterface > xIfc(*i, UNO_QUERY); - xEventManager->detach( i - m_aControllerList.begin(), xIfc ); - } + Reference< XFormController > xController( *i, UNO_SET_THROW ); + + // detaching the events + Reference< XChild > xControllerModel( xController->getModel(), UNO_QUERY ); + if ( xControllerModel.is() ) + { + Reference< XEventAttacherManager > xEventManager( xControllerModel->getParent(), UNO_QUERY ); + Reference< XInterface > xControllerNormalized( xController, UNO_QUERY_THROW ); + xEventManager->detach( i - m_aControllerList.begin(), xControllerNormalized ); + } - // dispose the formcontroller - Reference< XComponent > xComp(*i, UNO_QUERY); - xComp->dispose(); + // dispose the formcontroller + Reference< XComponent > xComp( xController, UNO_QUERY_THROW ); + xComp->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } - m_aControllerList.clear(); // this call deletes the formcontrollers + + m_aControllerList.clear(); } diff --git a/svx/source/gengal/makefile.mk b/svx/source/gengal/makefile.mk index 0a86d1debf63..1c8284a19eee 100644 --- a/svx/source/gengal/makefile.mk +++ b/svx/source/gengal/makefile.mk @@ -71,6 +71,11 @@ APP1STDLIBS=$(TOOLSLIB) \ $(SOTLIB) \ $(VCLLIB) \ $(UCBHELPERLIB) \ + $(BASEGFXLIB) $(I18NISOLANGLIB) $(TKLIB) $(UNOTOOLSLIB) $(I18NUTILLIB) \ + $(ICUUCLIB) $(JVMFWKLIB) $(SALHELPERLIB) $(FWELIB) $(BASICLIB) \ + $(XMLSCRIPTLIB) $(SJLIB) $(ICUDATALIB) $(ICULELIB) $(JVMACCESSLIB) \ + $(AVMEDIALIB) $(XMLOFFLIB) $(SAXLIB) $(FWILIB) $(DRAWINGLAYERLIB) $(LNGLIB) \ + $(CPPCANVASLIB) $(CANVASTOOLSLIB) $(AGGLIB) \ $(SVXLIB) #.IF "$(COM)"=="GCC" diff --git a/svx/source/inc/SpellDialog.hxx b/svx/source/inc/SpellDialog.hxx index 93b1ea57338d..e7545eaeb6e7 100644 --- a/svx/source/inc/SpellDialog.hxx +++ b/svx/source/inc/SpellDialog.hxx @@ -134,6 +134,7 @@ class ExplainButton : public PushButton String m_sExplanation; virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void Click(); public: ExplainButton( Window* pParent, const ResId& rResId ) : PushButton( pParent, rResId ){} ~ExplainButton(); diff --git a/svx/source/intro/iso.src b/svx/source/intro/iso.src index e88d512a6544..cff148376d2a 100644 --- a/svx/source/intro/iso.src +++ b/svx/source/intro/iso.src @@ -84,7 +84,7 @@ ModalDialog RID_DEFAULTABOUT Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; WordBreak = TRUE ; - Text[ en-US ] = "Copyright © 2005-2008 Sun Microsystems, Inc. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Use is subject to license terms. This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo, Java, Solaris and StarOffice are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.\n\nThis product is based on the OpenOffice.org project." ; + Text[ en-US ] = "Copyright © 2005-2009 Sun Microsystems, Inc. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Use is subject to license terms. This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo, Java, Solaris and StarOffice are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.\n\nThis product is based on the OpenOffice.org project." ; }; StringArray ABOUT_STR_DEVELOPER_ARY { @@ -92,7 +92,7 @@ ModalDialog RID_DEFAULTABOUT }; String ABOUT_STR_FRENCH_COPYRIGHT { - Text = "Copyright © 2005-2008 Sun Microsystems, Inc. Tous droits réservés. Sun Microsystems, Inc. détient les droits de propriété intellectuels relatifs á la technologie incorporée dans le produit qui est décrit dans ce document. En particulier, et ce sans limitation, ces droits de propriété intellectuelle peuvent inclure un ou plus des brevets américains listés á l'adresse http://www.sun.com/patents et un ou les brevets supplémentaires ou les applications de brevet en attente aux Etats - Unis et dans les autres pays. L'utilisation est soumise aux termes du contrat de licence. Cette distribution peut comprendre des composants développés par des tierces parties. Sun, Sun Microsystems, le logo Sun, Java, Solaris et StarOffice sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays. Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d'autres pays. UNIX est une marque déposée aux Etats-Unis et dans d'autres pays et licenciée exlusivement par X/Open Company, Ltd.\n\nCe produit a été créé á partir du projet OpenOffice.org." ; + Text = "Copyright © 2005-2009 Sun Microsystems, Inc. Tous droits réservés. Sun Microsystems, Inc. détient les droits de propriété intellectuels relatifs á la technologie incorporée dans le produit qui est décrit dans ce document. En particulier, et ce sans limitation, ces droits de propriété intellectuelle peuvent inclure un ou plus des brevets américains listés á l'adresse http://www.sun.com/patents et un ou les brevets supplémentaires ou les applications de brevet en attente aux Etats - Unis et dans les autres pays. L'utilisation est soumise aux termes du contrat de licence. Cette distribution peut comprendre des composants développés par des tierces parties. Sun, Sun Microsystems, le logo Sun, Java, Solaris et StarOffice sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays. Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d'autres pays. UNIX est une marque déposée aux Etats-Unis et dans d'autres pays et licenciée exlusivement par X/Open Company, Ltd.\n\nCe produit a été créé á partir du projet OpenOffice.org." ; }; String ABOUT_STR_ACCEL { diff --git a/svx/source/intro/ooo.src b/svx/source/intro/ooo.src index f3a938828eda..9a59a643168f 100644 --- a/svx/source/intro/ooo.src +++ b/svx/source/intro/ooo.src @@ -89,7 +89,7 @@ ModalDialog RID_DEFAULTABOUT { Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; - Text[ en-US ] ="Copyright 2000-2008 Sun Microsystems Inc.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at http://www.openoffice.org/welcome/credits.html."; + Text[ en-US ] ="Copyright 2000-2009 Sun Microsystems Inc.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at http://www.openoffice.org/welcome/credits.html."; WordBreak = TRUE ; }; StringArray ABOUT_STR_DEVELOPER_ARY diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx index 821750b55e8b..78b87bde99ef 100644 --- a/svx/source/msfilter/msdffimp.cxx +++ b/svx/source/msfilter/msdffimp.cxx @@ -4453,7 +4453,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, Rect // PptSlidePersistEntry& rPersistEntry, SdPage* pPage SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, void* pClientData, - const Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ) + Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ) { SdrObject* pRet = NULL; DffRecordHeader aObjHd; @@ -4471,7 +4471,7 @@ SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, void* pClientData, } SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, void* pClientData, - const Rectangle& rClientRect, const Rectangle& rGlobalChildRect, + Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ) { SdrObject* pRet = NULL; @@ -4495,8 +4495,6 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r nGroupRotateAngle = mnFix16Angle; Rectangle aClientRect( rClientRect ); - if ( rClientRect.IsEmpty() ) - aClientRect = pRet->GetSnapRect(); Rectangle aGlobalChildRect; if ( !nCalledByGroup || rGlobalChildRect.IsEmpty() ) @@ -4575,7 +4573,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r } SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& rSt, void* pClientData, - const Rectangle& rClientRect, const Rectangle& rGlobalChildRect, + Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId ) { SdrObject* pRet = NULL; @@ -4686,7 +4684,12 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if ( aObjData.nSpFlags & SP_FGROUP ) { pRet = new SdrObjGroup; - pRet->NbcSetLogicRect( aBoundRect ); // SJ: SnapRect is allowed to be set at the group only for the first time + /* After CWS aw033 has been integrated, an empty group object + cannot store its resulting bounding rectangle anymore. We have + to return this rectangle via rClientRect now, but only, if + caller has not passed an own bounding ractangle. */ + if ( rClientRect.IsEmpty() ) + rClientRect = aBoundRect; nGroupShapeFlags = aObjData.nSpFlags; // #73013# } else if ( ( aObjData.eShapeType != mso_sptNil ) || IsProperty( DFF_Prop_pVertices ) || bGraphic ) diff --git a/svx/source/options/optimprove.src b/svx/source/options/optimprove.src index 722735730b0d..148d7391c905 100644 --- a/svx/source/options/optimprove.src +++ b/svx/source/options/optimprove.src @@ -121,53 +121,3 @@ TabPage RID_SVXPAGE_IMPROVEMENT }; }; -ModalDialog RID_SVXPAGE_IMPROVEMENT -{ - //!HelpId = HID_OPTIONS_IMPROVEMENT ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 210 , 173 ) ; - Moveable = TRUE ; - Window WIN_INFO - { - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 210 , 30 ) ; - }; - FixedText FT_INVITATION - { - Pos = MAP_APPFONT ( 6 , 36 ) ; - Size = MAP_APPFONT ( 198 , 72 ) ; - WordBreak = TRUE ; - }; - RadioButton RB_YES - { - Pos = MAP_APPFONT ( 6 , 114 ) ; - Size = MAP_APPFONT ( 198 , 10 ) ; - Check = TRUE ; - }; - RadioButton RB_NO - { - Pos = MAP_APPFONT ( 6 , 127 ) ; - Size = MAP_APPFONT ( 198 , 10 ) ; - }; - FixedLine FL_IMPROVE - { - Pos = MAP_APPFONT ( 0 , 140 ) ; - Size = MAP_APPFONT ( 210 , 8 ) ; - }; - FixedImage FI_INFO - { - Pos = MAP_APPFONT ( 6 , 151 ) ; - Size = MAP_APPFONT ( 18 , 18 ) ; - Fixed = Image - { - ImageBitmap = Bitmap { File = "info.png"; }; - }; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 154, 153 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - diff --git a/svx/source/outliner/makefile.mk b/svx/source/outliner/makefile.mk index 5a1e287d6eff..deef3530499c 100644 --- a/svx/source/outliner/makefile.mk +++ b/svx/source/outliner/makefile.mk @@ -34,6 +34,7 @@ PRJ=..$/.. PRJNAME=svx TARGET=outliner AUTOSEG=true +ENABLE_EXCEPTIONS=TRUE PROJECTPCH4DLL=TRUE PROJECTPCH=outl_pch diff --git a/svx/source/outliner/outleeng.cxx b/svx/source/outliner/outleeng.cxx index 47786327293f..a9d797de3c09 100644 --- a/svx/source/outliner/outleeng.cxx +++ b/svx/source/outliner/outleeng.cxx @@ -228,7 +228,11 @@ void OutlinerEditEng::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) EditEngine::SetParaAttribs( (USHORT)nPara, rSet ); pOwner->ImplCheckNumBulletItem( (USHORT)nPara ); - pOwner->ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pOwner->pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + pOwner->ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pOwner->pParaList->GetParagraphCount()) ); + // <-- if ( !IsInUndo() && IsUndoEnabled() ) pOwner->UndoActionEnd( OLUNDO_ATTR ); diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx index 2d72442a9e9f..19a92f91f4fc 100644 --- a/svx/source/outliner/outliner.cxx +++ b/svx/source/outliner/outliner.cxx @@ -332,7 +332,11 @@ void Outliner::SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingSta pPara->IsParaIsNumberingRestart(), pPara->IsParaIsNumberingRestart() ) ); pPara->SetNumberingStartValue( nNumberingStartValue ); - ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- pEditEngine->SetModified(); } } @@ -356,7 +360,11 @@ void Outliner::SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumb pPara->IsParaIsNumberingRestart(), bParaIsNumberingRestart ) ); pPara->SetParaIsNumberingRestart( bParaIsNumberingRestart ); - ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- pEditEngine->SetModified(); } } @@ -378,14 +386,19 @@ OutlinerParaObject* Outliner::CreateParaObject( USHORT nStartPara, USHORT nCount if( !nCount ) return NULL; - OutlinerParaObject* pPObj = new OutlinerParaObject( nCount ); - pPObj->pText = pEditEngine->CreateTextObject( nStartPara, nCount ); - pPObj->SetOutlinerMode( GetMode() ); - pPObj->bIsEditDoc = ( ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) ? TRUE : FALSE; + EditTextObject* pText = pEditEngine->CreateTextObject( nStartPara, nCount ); + const bool bIsEditDoc(OUTLINERMODE_TEXTOBJECT == ImplGetOutlinerMode()); + ParagraphDataVector aParagraphDataVector(nCount); + const sal_uInt16 nLastPara(nStartPara + nCount - 1); - USHORT nLastPara = nStartPara + nCount - 1; - for ( USHORT nPara = nStartPara; nPara <= nLastPara; nPara++ ) - pPObj->pParagraphDataArr[ nPara-nStartPara] = *GetParagraph( nPara ); + for(sal_uInt16 nPara(nStartPara); nPara <= nLastPara; nPara++) + { + aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara); + } + + OutlinerParaObject* pPObj = new OutlinerParaObject(*pText, aParagraphDataVector, bIsEditDoc); + pPObj->SetOutlinerMode(GetMode()); + delete pText; return pPObj; } @@ -573,8 +586,8 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) Init( rPObj.GetOutlinerMode() ); ImplBlockInsertionCallbacks( TRUE ); - pEditEngine->SetText( *(rPObj.pText) ); - if( rPObj.nCount != pEditEngine->GetParagraphCount() ) + pEditEngine->SetText(rPObj.GetTextObject()); + if( rPObj.Count() != pEditEngine->GetParagraphCount() ) { int nop=0;nop++; } @@ -582,16 +595,20 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) bFirstParaIsEmpty = FALSE; pParaList->Clear( TRUE ); - for( USHORT nCurPara = 0; nCurPara < rPObj.nCount; nCurPara++ ) + for( USHORT nCurPara = 0; nCurPara < rPObj.Count(); nCurPara++ ) { - Paragraph* pPara = new Paragraph( rPObj.pParagraphDataArr[ nCurPara ] ); + Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(nCurPara)); ImplCheckDepth( pPara->nDepth ); pParaList->Insert( pPara, LIST_APPEND ); ImplCheckNumBulletItem( nCurPara ); } - ImplCheckParagraphs( 0, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( 0, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- EnableUndo( bUndo ); ImplBlockInsertionCallbacks( FALSE ); @@ -614,19 +631,19 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) if( bFirstParaIsEmpty ) { pParaList->Clear( TRUE ); - pEditEngine->SetText( *(rPObj.pText) ); + pEditEngine->SetText(rPObj.GetTextObject()); nPara = 0; } else { nPara = pParaList->GetParagraphCount(); - pEditEngine->InsertParagraph( EE_PARA_APPEND, *(rPObj.pText) ); + pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject() ); } bFirstParaIsEmpty = FALSE; - for( USHORT n = 0; n < rPObj.nCount; n++ ) + for( USHORT n = 0; n < rPObj.Count(); n++ ) { - pPara = new Paragraph( rPObj.pParagraphDataArr[ n ] ); + pPara = new Paragraph( rPObj.GetParagraphData(n) ); pParaList->Insert( pPara, LIST_APPEND ); USHORT nP = sal::static_int_cast< USHORT >(nPara+n); DBG_ASSERT(pParaList->GetAbsPos(pPara)==nP,"AddText:Out of sync"); @@ -634,7 +651,11 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) } DBG_ASSERT( pEditEngine->GetParagraphCount()==pParaList->GetParagraphCount(), "SetText: OutOfSync" ); - ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- ImplBlockInsertionCallbacks( FALSE ); pEditEngine->SetUpdateMode( bUpdate ); @@ -1496,7 +1517,10 @@ void Outliner::ImplCheckParagraphs( USHORT nStart, USHORT nEnd ) { DBG_CHKTHIS( Outliner, 0 ); - for ( USHORT n = nStart; n <= nEnd; n++ ) + // --> OD 2009-03-10 #i100014# + // assure that the following for-loop does not loop forever + for ( ULONG n = nStart; n < nEnd; n++ ) + // <-- { Paragraph* pPara = pParaList->GetParagraph( n ); if (pPara) diff --git a/svx/source/outliner/outlobj.cxx b/svx/source/outliner/outlobj.cxx index ace1dd2c8b73..1f2297bada6f 100644 --- a/svx/source/outliner/outlobj.cxx +++ b/svx/source/outliner/outlobj.cxx @@ -38,234 +38,220 @@ #include <svx/outlobj.hxx> #include <outleeng.hxx> #include <svx/editobj.hxx> +#include <vcl/bitmap.hxx> +#include <tools/stream.hxx> +////////////////////////////////////////////////////////////////////////////// -#include <vcl/bitmap.hxx> +class ImplOutlinerParaObject +{ +public: + // data members + EditTextObject* mpEditTextObject; + ParagraphDataVector maParagraphDataVector; + bool mbIsEditDoc; + + // refcounter + sal_uInt32 mnRefCount; + + // constuctor + ImplOutlinerParaObject(EditTextObject* pEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc) + : mpEditTextObject(pEditTextObject), + maParagraphDataVector(rParagraphDataVector), + mbIsEditDoc(bIsEditDoc), + mnRefCount(0) + { + if( (maParagraphDataVector.size() == 0) && (pEditTextObject->GetParagraphCount() != 0) )
+ maParagraphDataVector.resize(pEditTextObject->GetParagraphCount()); + } + // destructor + ~ImplOutlinerParaObject() + { + delete mpEditTextObject; + } -#include <tools/stream.hxx> + bool operator==(const ImplOutlinerParaObject& rCandidate) const + { + return (*mpEditTextObject == *rCandidate.mpEditTextObject + && maParagraphDataVector == rCandidate.maParagraphDataVector + && mbIsEditDoc == rCandidate.mbIsEditDoc); + } +}; -DBG_NAME(OutlinerParaObject) +////////////////////////////////////////////////////////////////////////////// -OutlinerParaObject::OutlinerParaObject( USHORT nParaCount ) +void OutlinerParaObject::ImplMakeUnique() { - DBG_CTOR(OutlinerParaObject,0); - - bIsEditDoc = TRUE; - pParagraphDataArr = new ParagraphData[ nParaCount ]; - nCount = nParaCount; + if(mpImplOutlinerParaObject->mnRefCount) + { + ImplOutlinerParaObject* pNew = new ImplOutlinerParaObject( + mpImplOutlinerParaObject->mpEditTextObject->Clone(), + mpImplOutlinerParaObject->maParagraphDataVector, + mpImplOutlinerParaObject->mbIsEditDoc); + mpImplOutlinerParaObject->mnRefCount--; + mpImplOutlinerParaObject = pNew; + } } -OutlinerParaObject::OutlinerParaObject( const OutlinerParaObject& rObj ) +OutlinerParaObject::OutlinerParaObject(const EditTextObject& rEditTextObject, const ParagraphDataVector& rParagraphDataVector, bool bIsEditDoc) +: mpImplOutlinerParaObject(new ImplOutlinerParaObject(rEditTextObject.Clone(), rParagraphDataVector, bIsEditDoc)) { - DBG_CTOR(OutlinerParaObject,0); - - bIsEditDoc = rObj.bIsEditDoc; - nCount = rObj.nCount; - pParagraphDataArr = new ParagraphData[ nCount ]; - for( sal_uInt32 i = 0; i < nCount; i++ ) - pParagraphDataArr[i] = rObj.pParagraphDataArr[i]; - pText = rObj.pText->Clone(); } -OutlinerParaObject::OutlinerParaObject( const EditTextObject& rEditObj ) +OutlinerParaObject::OutlinerParaObject(const OutlinerParaObject& rCandidate) +: mpImplOutlinerParaObject(rCandidate.mpImplOutlinerParaObject) { - DBG_CTOR(OutlinerParaObject,0); - - bIsEditDoc = TRUE; - pText = rEditObj.Clone(); - nCount = pText->GetParagraphCount(); - pParagraphDataArr = new ParagraphData[ nCount ]; + mpImplOutlinerParaObject->mnRefCount++; } OutlinerParaObject::~OutlinerParaObject() { - DBG_DTOR(OutlinerParaObject,0); - - delete pText; - delete[] pParagraphDataArr; + if(mpImplOutlinerParaObject->mnRefCount) + { + mpImplOutlinerParaObject->mnRefCount--; + } + else + { + delete mpImplOutlinerParaObject; + } } -sal_Int16 OutlinerParaObject::GetDepth( USHORT nPara ) const +OutlinerParaObject& OutlinerParaObject::operator=(const OutlinerParaObject& rCandidate) { - if( pParagraphDataArr && (nPara < nCount ) ) - return pParagraphDataArr[nPara].nDepth; - else - return -1; + if(rCandidate.mpImplOutlinerParaObject != mpImplOutlinerParaObject) + { + if(mpImplOutlinerParaObject->mnRefCount) + { + mpImplOutlinerParaObject->mnRefCount--; + } + else + { + delete mpImplOutlinerParaObject; + } + + mpImplOutlinerParaObject = rCandidate.mpImplOutlinerParaObject; + mpImplOutlinerParaObject->mnRefCount++; + } + + return *this; } -void OutlinerParaObject::ClearPortionInfo() +bool OutlinerParaObject::operator==(const OutlinerParaObject& rCandidate) const { - DBG_CHKTHIS(OutlinerParaObject,0); - pText->ClearPortionInfo(); + if(rCandidate.mpImplOutlinerParaObject == mpImplOutlinerParaObject) + { + return true; + } + + return (*rCandidate.mpImplOutlinerParaObject == *mpImplOutlinerParaObject); } -OutlinerParaObject* OutlinerParaObject::Clone() const +sal_uInt16 OutlinerParaObject::GetOutlinerMode() const { - DBG_CHKTHIS(OutlinerParaObject,0); - OutlinerParaObject* pObj = new OutlinerParaObject(*this); - return pObj; + return mpImplOutlinerParaObject->mpEditTextObject->GetUserType(); } -void OutlinerParaObject::ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName ) +void OutlinerParaObject::SetOutlinerMode(sal_uInt16 nNew) { - DBG_CHKTHIS(OutlinerParaObject,0); - pText->ChangeStyleSheetName( eFamily, rOldName, rNewName ); + if(mpImplOutlinerParaObject->mpEditTextObject->GetUserType() != nNew) + { + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->SetUserType(nNew); + } } -BOOL OutlinerParaObject::ChangeStyleSheets( const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily ) +bool OutlinerParaObject::IsVertical() const { - DBG_CHKTHIS(OutlinerParaObject,0); - return pText->ChangeStyleSheets( rOldName, eOldFamily, rNewName, eNewFamily ); + return mpImplOutlinerParaObject->mpEditTextObject->IsVertical(); } -void OutlinerParaObject::SetStyleSheets( USHORT nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily ) +void OutlinerParaObject::SetVertical(bool bNew) { - for ( USHORT n = sal::static_int_cast< USHORT >( Count() ); n; ) + if((bool)mpImplOutlinerParaObject->mpEditTextObject->IsVertical() != bNew) { - if ( GetDepth( --n ) == nLevel ) - pText->SetStyleSheet( n, rNewName, rNewFamily ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->SetVertical(bNew); } } -void OutlinerParaObject::Store(SvStream& rStream ) const +sal_uInt32 OutlinerParaObject::Count() const { - rStream << nCount; - rStream << static_cast<sal_uInt32>(0x42345678); - pText->Store( rStream ); - - for( USHORT nPos=0; nPos < nCount; nPos++ ) - rStream << pParagraphDataArr[ nPos ].nDepth; - - rStream << bIsEditDoc; + return mpImplOutlinerParaObject->maParagraphDataVector.size(); } -OutlinerParaObject* OutlinerParaObject::Create( SvStream& rStream, SfxItemPool* pTextObjectPool ) +sal_Int16 OutlinerParaObject::GetDepth(sal_uInt16 nPara) const { - OutlinerParaObject* pPObj = NULL; - USHORT nVersion = 0; - - sal_uInt32 nCount; - rStream >> nCount; - - sal_uInt32 nSyncRef; - rStream >> nSyncRef; - if( nSyncRef == 0x12345678 ) - nVersion = 1; - else if( nSyncRef == 0x22345678 ) - nVersion = 2; - else if( nSyncRef == 0x32345678 ) - nVersion = 3; - else if ( nSyncRef == 0x42345678 ) - nVersion = 4; - - if ( nVersion ) + if(nPara < mpImplOutlinerParaObject->maParagraphDataVector.size()) { - pPObj = new OutlinerParaObject( (USHORT)nCount ); - if( nVersion <= 3 ) - { - EditTextObject* pAllText = 0; - USHORT nCurPara = 0; - while ( nCount ) - { - EditTextObject* pText = EditTextObject::Create( rStream, NULL ); - DBG_ASSERT(pText,"CreateEditTextObject failed"); - sal_uInt32 nSync = 0; - rStream >> nSync; - DBG_ASSERT(nSync==nSyncRef,"Stream out of sync"); - USHORT nDepth; - rStream >> nDepth; - Paragraph* pPara = new Paragraph( nDepth ); - if( nVersion == 1 ) - { - // Bullet ueberlesen - USHORT nFlags; - rStream >> nFlags; - - if ( nFlags & 0x0001 ) // Bitmap - { - Bitmap aBmp; - rStream >> aBmp; - } - else - { - Color aColor; - rStream >> aColor; - rStream.SeekRel( 16 ); - String aName; - rStream.ReadByteString(aName); - rStream.SeekRel( 12 ); - } - long nDummy; - rStream >> nDummy; - rStream >> nDummy; - } - pPara->bVisible = TRUE; - if( !pAllText ) - pAllText = pText; - else - { - pAllText->Insert( *pText, 0xffff ); - delete pText; - } - pPObj->pParagraphDataArr[ nCurPara ] = *pPara; - delete pPara; - nCount--; - nCurPara++; - if( nCount ) - { - sal_uInt32 _nSync = 0; - rStream >> _nSync; - DBG_ASSERT(_nSync==nSyncRef,"Stream out of sync"); - } - } - if( nVersion == 3 ) - rStream >> pPObj->bIsEditDoc; - pPObj->pText = pAllText; - } - else // nVersion >= 4 - { - pPObj->pText = EditTextObject::Create( rStream, pTextObjectPool ); - for( USHORT nCur=0; nCur < nCount; nCur++ ) - rStream >> pPObj->pParagraphDataArr[ nCur ].nDepth; - rStream >> pPObj->bIsEditDoc; - } + return mpImplOutlinerParaObject->maParagraphDataVector[nPara].getDepth(); + } + else + { + return -1; } - return pPObj; } -USHORT OutlinerParaObject::GetOutlinerMode() const +const EditTextObject& OutlinerParaObject::GetTextObject() const { - return pText->GetUserType(); + return *mpImplOutlinerParaObject->mpEditTextObject; } -void OutlinerParaObject::SetOutlinerMode( USHORT n ) +bool OutlinerParaObject::IsEditDoc() const { - pText->SetUserType( n ); + return mpImplOutlinerParaObject->mbIsEditDoc; } -BOOL OutlinerParaObject::RemoveCharAttribs( USHORT nWhich ) +const ParagraphData& OutlinerParaObject::GetParagraphData(sal_uInt32 nIndex) const { - return pText->RemoveCharAttribs( nWhich ); + if(nIndex < mpImplOutlinerParaObject->maParagraphDataVector.size()) + { + return mpImplOutlinerParaObject->maParagraphDataVector[nIndex]; + } + else + { + OSL_ENSURE(false, "OutlinerParaObject::GetParagraphData: Access out of range (!)"); + static ParagraphData aEmptyParagraphData; + return aEmptyParagraphData; + } } -BOOL OutlinerParaObject::RemoveParaAttribs( USHORT nWhich ) +void OutlinerParaObject::ClearPortionInfo() { - return pText->RemoveParaAttribs( nWhich ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->ClearPortionInfo(); } -void OutlinerParaObject::MergeParaAttribs( const SfxItemSet& rAttribs, USHORT nStart, USHORT nEnd ) +bool OutlinerParaObject::ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily) { - pText->MergeParaAttribs( rAttribs, nStart, nEnd ); + ImplMakeUnique(); + return mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheets(rOldName, eOldFamily, rNewName, eNewFamily); } -void OutlinerParaObject::SetVertical( BOOL bVertical ) +void OutlinerParaObject::ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName) { - pText->SetVertical( bVertical ); + ImplMakeUnique(); + mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheetName(eFamily, rOldName, rNewName); } -BOOL OutlinerParaObject::IsVertical() const +void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily) { - return pText->IsVertical(); + const sal_uInt32 nCount(mpImplOutlinerParaObject->maParagraphDataVector.size()); + + if(nCount) + { + ImplMakeUnique(); + sal_uInt16 nDecrementer(sal::static_int_cast< sal_uInt16 >(nCount)); + + for(;nDecrementer;) + { + if(GetDepth(--nDecrementer) == nLevel) + { + mpImplOutlinerParaObject->mpEditTextObject->SetStyleSheet(nDecrementer, rNewName, rNewFamily); + } + } + } } +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/outliner/outlvw.cxx b/svx/source/outliner/outlvw.cxx index 428b3767eaf4..102a0318bcb5 100644 --- a/svx/source/outliner/outlvw.cxx +++ b/svx/source/outliner/outlvw.cxx @@ -1192,7 +1192,11 @@ void OutlinerView::ToggleBullets() } } - USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount()-1); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount()); + // <-- pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); @@ -1222,7 +1226,11 @@ void OutlinerView::EnableBullets() } } - USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount()-1); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount()); + // <-- pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); diff --git a/svx/source/outliner/paralist.cxx b/svx/source/outliner/paralist.cxx index 0efd519ac76a..3bc52fd8e460 100644 --- a/svx/source/outliner/paralist.cxx +++ b/svx/source/outliner/paralist.cxx @@ -59,6 +59,13 @@ ParagraphData& ParagraphData::operator=( const ParagraphData& r) return *this; } +bool ParagraphData::operator==(const ParagraphData& rCandidate) const +{ + return (nDepth == rCandidate.nDepth + && mnNumberingStartValue == rCandidate.mnNumberingStartValue + && mbParaIsNumberingRestart == rCandidate.mbParaIsNumberingRestart); +} + Paragraph::Paragraph( sal_Int16 nDDepth ) : aBulSize( -1, -1) { diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 00185c8a88ff..394f68041d7a 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -44,6 +44,7 @@ namespace drawinglayer { SdrTextAttribute::SdrTextAttribute( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, @@ -53,9 +54,10 @@ namespace drawinglayer bool bFitToSize, bool bHideContour, bool bBlink, - bool bScroll) + bool bScroll, + bool bInEditMode) : mrSdrText(rSdrText), - mpOutlinerParaObject(rSdrText.GetOutlinerParaObject()), + maOutlinerParaObject(rOutlinerParaObject), meFormTextStyle(eFormTextStyle), maTextLeftDistance(aTextLeftDistance), maTextUpperDistance(aTextUpperDistance), @@ -65,15 +67,14 @@ namespace drawinglayer mbFitToSize(bFitToSize), mbHideContour(bHideContour), mbBlink(bBlink), - mbScroll(bScroll) + mbScroll(bScroll), + mbInEditMode(bInEditMode) { } bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const { - const bool bOutlinerParaObjectSameAddress(mpOutlinerParaObject == rCandidate.mpOutlinerParaObject); - - return (bOutlinerParaObjectSameAddress + return (getOutlinerParaObject() == rCandidate.getOutlinerParaObject() && getFormTextStyle() == rCandidate.getFormTextStyle() && getTextLeftDistance() == rCandidate.getTextLeftDistance() && getTextUpperDistance() == rCandidate.getTextUpperDistance() @@ -83,7 +84,8 @@ namespace drawinglayer && isFitToSize() == rCandidate.isFitToSize() && isHideContour() == rCandidate.isHideContour() && isBlink() == rCandidate.isBlink() - && isScroll() == rCandidate.isScroll()); + && isScroll() == rCandidate.isScroll() + && isInEditMode() == rCandidate.isInEditMode()); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const diff --git a/svx/source/sdr/contact/objectcontact.cxx b/svx/source/sdr/contact/objectcontact.cxx index 9491d1f06ee4..d404785af481 100644 --- a/svx/source/sdr/contact/objectcontact.cxx +++ b/svx/source/sdr/contact/objectcontact.cxx @@ -262,6 +262,12 @@ namespace sdr return false; } + // pdf export? Default is false + bool ObjectContact::isOutputToPDFFile() const + { + return false; + } + // gray display mode bool ObjectContact::isDrawModeGray() const { diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index 94a5756483cd..41af4fa5fa84 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -185,12 +185,25 @@ namespace sdr // update current ViewInformation2D at the ObjectContact const double fCurrentTime(getPrimitiveAnimator().GetTime()); OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice(); - const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile(); - const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); basegfx::B2DRange aViewRange; // create ViewRange - if(!bOutputToRecordingMetaFile) + if(isOutputToRecordingMetaFile()) + { + if(isOutputToPDFFile() || isOutputToPrinter()) + { + // #i98402# if it's a PDF export, set the ClipRegion as ViewRange. This is + // mainly because SW does not use DrawingLayer Page-Oriented and if not doing this, + // all existing objects will be collected as primitives and processed. + // OD 2009-03-05 #i99876# perform the same also for SW on printing. + const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect()); + + aViewRange = basegfx::B2DRange( + aLogicClipRectangle.Left(), aLogicClipRectangle.Top(), + aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom()); + } + } + else { // use visible pixels, but transform to world coordinates const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel()); @@ -403,6 +416,12 @@ namespace sdr return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); } + // pdf export? + bool ObjectContactOfPageView::isOutputToPDFFile() const + { + return (0 != mrPageWindow.GetPaintWindow().GetOutputDevice().GetPDFWriter()); + } + // gray display mode bool ObjectContactOfPageView::isDrawModeGray() const { diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index fbe39a6f3034..851ee1f3da58 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -38,6 +38,7 @@ #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <svx/sdr/primitive3d/sdrattributecreator3d.hxx> #include <basegfx/polygon/b3dpolygon.hxx> +#include <basegfx/polygon/b3dpolypolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -120,11 +121,57 @@ namespace sdr if(bTexture) { - const basegfx::B2DRange aTxRange(basegfx::tools::getRange(aPolyTexture2D)); - aTextureSize.setX(aTxRange.getWidth()); - aTextureSize.setY(aTxRange.getHeight()); + // #i98314# + // create texture size from object's size + const basegfx::B3DRange aObjectRange(basegfx::tools::getRange(aPolyPolygon3D)); + + double fWidth(0.0); + double fHeight(0.0); + + // this is a polygon object, so Width/Height and/or Depth may be zero (e.g. left + // wall of chart). Take this into account + if(basegfx::fTools::equalZero(aObjectRange.getWidth())) + { + // width is zero, use height and depth + fWidth = aObjectRange.getHeight(); + fHeight = aObjectRange.getDepth(); + } + else if(basegfx::fTools::equalZero(aObjectRange.getHeight())) + { + // height is zero, use width and depth + fWidth = aObjectRange.getWidth(); + fHeight = aObjectRange.getDepth(); + } + else + { + // use width and height + fWidth = aObjectRange.getWidth(); + fHeight = aObjectRange.getHeight(); + } + + if(basegfx::fTools::lessOrEqual(fWidth, 0.0) ||basegfx::fTools::lessOrEqual(fHeight, 0.0)) + { + // no texture; fallback to very small size + aTextureSize.setX(0.01); + aTextureSize.setY(0.01); + } + else + { + aTextureSize.setX(fWidth); + aTextureSize.setY(fHeight); + } } + // #i98295# + // unfortunately, this SdrObject type which allows a free 3d geometry definition was defined + // wrong topologically in relation to it's plane normal and 3D visibility when it was invented + // a long time ago. Since the API allows creation of this SDrObject type, it is not possible to + // simply change this definition. Only the chart should use it, and at least this object type + // only exists at Runtime (is not saved and/or loaded in any FileFormat). Still someone external + // may have used it in it's API. To not risk wrong 3D lightings, i have to switch the orientation + // of the polygon here + aPolyPolygon3D.flip(); + // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 2e83b3829e06..317a49bb090d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -61,7 +61,12 @@ namespace sdr if(pSdrText) { - drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute(rItemSet, *pSdrText); + // #i98072# Get shandow and text; eventually suppress the text if it's + // a TextPath FontworkGallery object + drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute( + rItemSet, + *pSdrText, + GetCustomShapeObj().IsTextPath()); drawinglayer::primitive2d::Primitive2DSequence xGroup; bool bHasText(pAttribute && pAttribute->getText()); diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 01eb6699c4aa..26a3934c179e 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -197,36 +197,45 @@ namespace sdr if(rPage.IsMasterPage()) { - OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); - - if(rPage.GetObjCount()) + if(0 == rPage.GetPageNum()) + { + // #i98063# + // filter MasterPage 0 since it's the HandoutPage. Thus, it's a + // MasterPage, but has no MPBGO, so there is nothing to do here. + } + else { - SdrObject* pObject = rPage.GetObj(0); - OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)"); + OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); - if(pObject && pObject->IsMasterPageBackgroundObject()) + if(rPage.GetObjCount()) { - // build primitive from pObject's attributes - const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + SdrObject* pObject = rPage.GetObj(0); + OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)"); - if(pFill) + if(pObject && pObject->IsMasterPageBackgroundObject()) { - if(pFill->isVisible()) + // build primitive from pObject's attributes + const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); + drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + + if(pFill) { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + if(pFill->isVisible()) + { + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + + delete pFill; } - - delete pFill; } } } diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index b129aaea137a..c48d110faaf2 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -38,6 +38,7 @@ #include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx> #include <svtools/itemset.hxx> +#include <svx/sdr/primitive2d/sdrprimitivetools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -111,6 +112,18 @@ namespace sdr delete pAttribute; } + + if(!xRetval.hasElements()) + { + // #i99123# + // Object is invisible. Create a fallback primitive for HitTest + basegfx::B2DHomMatrix aObjectMatrix; + basegfx::B2DPolyPolygon aObjectPolyPolygon; + GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } return xRetval; diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index f2e632e9fd2e..ce8e2862590e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -85,6 +85,7 @@ namespace sdr virtual bool isOutputToWindow() const; virtual bool isOutputToVirtualDevice() const; virtual bool isOutputToRecordingMetaFile() const; + virtual bool isOutputToPDFFile() const; virtual bool isDrawModeGray() const; virtual bool isDrawModeBlackWhite() const; virtual bool isDrawModeHighContrast() const; @@ -189,6 +190,7 @@ namespace sdr bool PagePrimitiveExtractor::isOutputToWindow() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToWindow(); } bool PagePrimitiveExtractor::isOutputToVirtualDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToVirtualDevice(); } bool PagePrimitiveExtractor::isOutputToRecordingMetaFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToRecordingMetaFile(); } + bool PagePrimitiveExtractor::isOutputToPDFFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPDFFile(); } bool PagePrimitiveExtractor::isDrawModeGray() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeGray(); } bool PagePrimitiveExtractor::isDrawModeBlackWhite() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeBlackWhite(); } bool PagePrimitiveExtractor::isDrawModeHighContrast() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeHighContrast(); } diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index fc994c199284..d5681c60463e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -130,7 +130,15 @@ namespace sdr // the original ChartPrettyPainter does not do it for VDEV if(!bPrettyPrintingForBitmaps && bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice()) { - bDoChartPrettyPrinting = false; + if(GetObjectContact().isOutputToPDFFile()) + { + // #i97982# + // For PDF files, allow PrettyPrinting + } + else + { + bDoChartPrettyPrinting = false; + } } // the chart model is needed. Check if it's available diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 4549e98995a1..8c682adfc166 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -121,7 +121,7 @@ namespace sdr } } - const double OverlayManager::getDiscreteOne() const + double OverlayManager::getDiscreteOne() const { if(getOutputDevice().GetViewTransformation() != maViewTransformation) { diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index edc7d482641b..dffd81dab0b9 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -475,7 +475,7 @@ namespace drawinglayer attribute::SdrTextAttribute* createNewSdrTextAttribute(const SfxItemSet& rSet, const SdrText& rText) { - attribute::SdrTextAttribute* pRetval(0L); + attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); if(rText.GetOutlinerParaObject() && rText.GetModel()) @@ -492,24 +492,40 @@ namespace drawinglayer bInEditMode = rTextObj.IsInEditMode(); } - if(!bInEditMode) + OutlinerParaObject aOutlinerParaObject(*rText.GetOutlinerParaObject()); + + if(bInEditMode) { - const SdrFitToSizeType eFit = rTextObj.GetFitToSize(); - const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); - - pRetval = new attribute::SdrTextAttribute( - rText, - ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), - rTextObj.GetTextLeftDistance(), - rTextObj.GetTextUpperDistance(), - rTextObj.GetTextRightDistance(), - rTextObj.GetTextLowerDistance(), - ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), - (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), - ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), - SDRTEXTANI_BLINK == eAniKind, - SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind); + OutlinerParaObject* pTempObj = rTextObj.GetEditOutlinerParaObject(); + + if(pTempObj) + { + aOutlinerParaObject = *pTempObj; + delete pTempObj; + } + else + { + bInEditMode = false; + } } + + const SdrFitToSizeType eFit = rTextObj.GetFitToSize(); + const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); + + pRetval = new attribute::SdrTextAttribute( + rText, + aOutlinerParaObject, + ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), + rTextObj.GetTextLeftDistance(), + rTextObj.GetTextUpperDistance(), + rTextObj.GetTextRightDistance(), + rTextObj.GetTextLowerDistance(), + ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(), + (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit), + ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(), + SDRTEXTANI_BLINK == eAniKind, + SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, + bInEditMode); } return pRetval; @@ -602,14 +618,18 @@ namespace drawinglayer return pRetval; } - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText) { attribute::SdrShadowTextAttribute* pRetval(0L); attribute::SdrShadowAttribute* pShadow(0L); attribute::SdrTextAttribute* pText(0L); + // #i98072# added option to suppress text // look for text first - pText = createNewSdrTextAttribute(rSet, rText); + if(!bSuppressText) + { + pText = createNewSdrTextAttribute(rSet, rText); + } // try shadow pShadow = createNewSdrShadowAttribute(rSet); diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index f203cee5fa79..4a27eb73de8e 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -54,6 +54,7 @@ #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> +#include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -205,12 +206,12 @@ namespace drawinglayer aScaledUnitPolyPolygon.transform(aScaleTransform); // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), aScaledUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledUnitPolyPolygon, rObjectTransform); } else { // create with unit polygon - pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rUnitPolyPolygon, rObjectTransform); + pNew = new SdrContourTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), rUnitPolyPolygon, rObjectTransform); } } else if(rText.isFontwork() && !rText.isScroll()) @@ -218,7 +219,7 @@ namespace drawinglayer // text on path, use scaled polygon. Not allowed when text scrolling is used. ::basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); - pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), aScaledPolyPolygon); + pNew = new SdrPathTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon); } else { @@ -266,12 +267,12 @@ namespace drawinglayer if(rText.isFitToSize()) { // streched text in range - pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), aAnchorTransform); + pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform); } else // text in range { // build new primitive - pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap); + pNew = new SdrBlockTextPrimitive2D(rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, rText.isScroll(), bCellText, bWordWrap); } } @@ -397,8 +398,22 @@ namespace drawinglayer } else { - // add to decomposition - return Primitive2DReference(pNew); + if(rText.isInEditMode()) + { + // #i97628# + // encapsulate with TextHierarchyEditPrimitive2D to allow renderers + // to suppress actively edited content if needed + const Primitive2DReference xRefA(pNew); + const Primitive2DSequence aContent(&xRefA, 1L); + + // create and add TextHierarchyEditPrimitive2D primitive + return Primitive2DReference(new TextHierarchyEditPrimitive2D(aContent)); + } + else + { + // add to decomposition + return Primitive2DReference(pNew); + } } } diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 6726d7671a23..7f9b47afb2d4 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -125,7 +125,8 @@ namespace drawinglayer } // create primitive and get text range - pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), aTextMatrix, pTextAttribute->isScroll(), false, false); + pBlockText = new SdrBlockTextPrimitive2D(pTextAttribute->getSdrText(), pTextAttribute->getOutlinerParaObject(), + aTextMatrix, pTextAttribute->isScroll(), false, false); aTextRange = pBlockText->getB2DRange(aViewInformation); } diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index 76f776a8077f..2cedb1bfce29 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -66,32 +66,31 @@ namespace drawinglayer } // add line - if(getSdrLFSTAttribute().getLine()) + // #i97981# condition was inverse to purpose. When being compatible to paint version, + // border needs to be suppressed + if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine()) { - if(bBehaveCompatibleToPaintVersion) + // if line width is given, polygon needs to be grown by half of it to make the + // outline to be outside of the bitmap + if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) { - // if line width is given, polygon needs to be grown by half of it to make the - // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) - { - // decompose to get scale - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - getTransform().decompose(aScale, aTranslate, fRotate, fShearX); - - // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); - double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); - double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); - const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); - basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); - } - else - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); - } + // decompose to get scale + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getTransform().decompose(aScale, aTranslate, fRotate, fShearX); + + // create expanded range (add relative half line width to unit rectangle) + double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); + double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); + const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); + basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + } + else + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); } } else diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index e0c0068a7efa..6c665cbef4c9 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -33,6 +33,10 @@ #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> #include <vcl/bmpacc.hxx> #include <osl/mutex.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// // helper methods @@ -175,6 +179,20 @@ namespace drawinglayer return *pRetVal; } + + // #i99123# + Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix) + { + // create PolygonHairlinePrimitive2D + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + aUnitOutline.transform(rMatrix); + const basegfx::BColor aBlack(0.0, 0.0, 0.0); + const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack)); + + // create HitTestPrimitive2D with it + const Primitive2DSequence xSequence(&xReference, 1); + return Primitive2DReference(new HitTestPrimitive2D(xSequence)); + } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index a8d8f12b5aff..113cd226d8ba 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -63,33 +63,30 @@ namespace drawinglayer return xRetval; } - SdrTextPrimitive2D::SdrTextPrimitive2D(const SdrText& rSdrText) + SdrTextPrimitive2D::SdrTextPrimitive2D( + const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject) : BasePrimitive2D(), mrSdrText(rSdrText), + maOutlinerParaObject(rOutlinerParaObject), mxLastVisualizingPage(), mbLastSpellCheck(false), mbContainsPageField(false) { - if(mrSdrText.GetOutlinerParaObject()) - { - const EditTextObject& rETO = mrSdrText.GetOutlinerParaObject()->GetTextObject(); - mbContainsPageField = rETO.HasField(SvxPageField::StaticType()) - || rETO.HasField(SvxHeaderField::StaticType()) - || rETO.HasField(SvxFooterField::StaticType()) - || rETO.HasField(SvxDateTimeField::StaticType()); - } + const EditTextObject& rETO = maOutlinerParaObject.GetTextObject(); + mbContainsPageField = rETO.HasField(SvxPageField::StaticType()) + || rETO.HasField(SvxHeaderField::StaticType()) + || rETO.HasField(SvxFooterField::StaticType()) + || rETO.HasField(SvxDateTimeField::StaticType()); } bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { if(BasePrimitive2D::operator==(rPrimitive)) { - // since OutlinerParaObject has no compare operator, i do not clone it for this class and - // use the address in the SdrText for comparison if it did change const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive; - const bool bOutlinerParaSameAddress(getSdrText().GetOutlinerParaObject() == rCompare.getSdrText().GetOutlinerParaObject()); - return bOutlinerParaSameAddress; + return (getOutlinerParaObject() == rCompare.getOutlinerParaObject()); } return false; @@ -154,9 +151,10 @@ namespace drawinglayer SdrContourTextPrimitive2D::SdrContourTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, const ::basegfx::B2DHomMatrix& rObjectTransform) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maUnitPolyPolygon(rUnitPolyPolygon), maObjectTransform(rObjectTransform) { @@ -177,7 +175,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrContourTextPrimitive2D(getSdrText(), maUnitPolyPolygon, rTransform * maObjectTransform); + return new SdrContourTextPrimitive2D(getSdrText(), getOutlinerParaObject(), maUnitPolyPolygon, rTransform * maObjectTransform); } // provide unique ID @@ -208,8 +206,9 @@ namespace drawinglayer SdrPathTextPrimitive2D::SdrPathTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DPolyPolygon& rPathPolyPolygon) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maPathPolyPolygon(rPathPolyPolygon) { } @@ -230,7 +229,7 @@ namespace drawinglayer { ::basegfx::B2DPolyPolygon aNewPolyPolygon(maPathPolyPolygon); aNewPolyPolygon.transform(rTransform); - return new SdrPathTextPrimitive2D(getSdrText(), aNewPolyPolygon); + return new SdrPathTextPrimitive2D(getSdrText(), getOutlinerParaObject(), aNewPolyPolygon); } // provide unique ID @@ -261,11 +260,12 @@ namespace drawinglayer SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DHomMatrix& rTextRangeTransform, bool bUnlimitedPage, bool bCellText, bool bWordWrap) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform), mbUnlimitedPage(bUnlimitedPage), mbCellText(bCellText), @@ -290,7 +290,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrBlockTextPrimitive2D(getSdrText(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap()); + return new SdrBlockTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getUnlimitedPage(), getCellText(), getWordWrap()); } // provide unique ID @@ -321,8 +321,9 @@ namespace drawinglayer SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D( const SdrText& rSdrText, + const OutlinerParaObject& rOutlinerParaObject, const ::basegfx::B2DHomMatrix& rTextRangeTransform) - : SdrTextPrimitive2D(rSdrText), + : SdrTextPrimitive2D(rSdrText, rOutlinerParaObject), maTextRangeTransform(rTextRangeTransform) { } @@ -341,7 +342,7 @@ namespace drawinglayer SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const { - return new SdrStretchTextPrimitive2D(getSdrText(), rTransform * maTextRangeTransform); + return new SdrStretchTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * maTextRangeTransform); } // provide unique ID diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 86ce2fa9205c..68b1679dff49 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1430,7 +1430,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, if(pLast && pSrcPath->GetOutlinerParaObject()) { - pLast->SetOutlinerParaObject(pSrcPath->GetOutlinerParaObject()->Clone()); + pLast->SetOutlinerParaObject(new OutlinerParaObject(*pSrcPath->GetOutlinerParaObject())); } } else if(pCustomShape) @@ -1469,7 +1469,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, OutlinerParaObject* pParaObj = pCustomShape->GetOutlinerParaObject(); if(pParaObj) { - pTextObj->NbcSetOutlinerParaObject(pParaObj->Clone()); + pTextObj->NbcSetOutlinerParaObject(new OutlinerParaObject(*pParaObj)); } // copy all attributes diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index 32bc5ecca46f..6b15cc3be9bf 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -7254,7 +7254,7 @@ void GetLinePositions( const SdrObject* pObj, const std::set< sal_Int32 >& rRows nPosition |= aPt1.Y() < aPt2.Y() ? LinePositionBLTR : LinePositionTLBR; std::set< sal_Int32 >::const_iterator aRow( rRows.find( aPt1.Y() < aPt2.Y() ? aPt1.Y() : aPt2.Y() ) ); - std::set< sal_Int32 >::const_iterator aColumn( rRows.find( aPt1.X() < aPt2.X() ? aPt1.X() : aPt2.X() ) ); + std::set< sal_Int32 >::const_iterator aColumn( rColumns.find( aPt1.X() < aPt2.X() ? aPt1.X() : aPt2.X() ) ); if ( ( aRow != rRows.end() ) && ( aColumn != rColumns.end() ) ) { nPosition |= ( std::distance( rRows.begin(), aRow ) * rColumns.size() ) + std::distance( rColumns.begin(), aColumn ); @@ -7514,7 +7514,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab } } ::sdr::table::SdrTableObj* pTable = new ::sdr::table::SdrTableObj( pSdrModel ); - pTable->SetSnapRect( pGroup->GetSnapRect() ); + pTable->uno_lock(); Reference< XTable > xTable( pTable->getTable() ); try { @@ -7551,7 +7551,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab { SdrText* pSdrText = pTable->getText( nTableIndex ); if ( pSdrText ) - pSdrText->SetOutlinerParaObject( pParaObject->Clone() ); + pSdrText->SetOutlinerParaObject(new OutlinerParaObject(*pParaObject) ); } } } @@ -7580,11 +7580,14 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab } } } - SdrObject::Free( pGroup ); + pTable->uno_unlock(); + pTable->SetSnapRect( pGroup->GetSnapRect() ); pRet = pTable; + SdrObject::Free( pGroup ); } catch( Exception& ) { + pTable->uno_unlock(); SdrObject* pObj = pTable; SdrObject::Free( pObj ); } diff --git a/svx/source/svdraw/svditer.cxx b/svx/source/svdraw/svditer.cxx index 68c78a94e0ec..18662de89bcd 100644 --- a/svx/source/svdraw/svditer.cxx +++ b/svx/source/svdraw/svditer.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svditer.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.246.1 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,7 @@ #include <svx/svdpage.hxx> #include <svx/svdogrp.hxx> #include <svx/svdobj.hxx> +#include <svx/svdmark.hxx> // #99190# #include <svx/scene3d.hxx> @@ -68,33 +69,45 @@ SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, BOOL b Reset(); } +SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode, BOOL bReverse ) +: maObjList(1024, 64, 64), + mnIndex(0L), + mbReverse(bReverse) +{ + ImpProcessMarkList(rMarkList, eMode); + Reset(); +} + void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bUseZOrder) { - for(sal_uInt32 a(0L); a < rObjList.GetObjCount(); a++) + for( ULONG nIdx = 0, nCount = rObjList.GetObjCount(); nIdx < nCount; ++nIdx ) { - SdrObject* pObj = NULL; - if (bUseZOrder) - pObj = rObjList.GetObj(a); - else - pObj = rObjList.GetObjectForNavigationPosition(a); - if (pObj == NULL) - { - OSL_ASSERT(pObj!=NULL); - continue; - } + SdrObject* pObj = bUseZOrder ? + rObjList.GetObj( nIdx ) : rObjList.GetObjectForNavigationPosition( nIdx ); + OSL_ASSERT( pObj != 0 ); + if( pObj ) + ImpProcessObj( pObj, eMode, bUseZOrder ); + } +} - sal_Bool bIsGroup(pObj->IsGroupObject()); +void SdrObjListIter::ImpProcessMarkList( const SdrMarkList& rMarkList, SdrIterMode eMode ) +{ + for( ULONG nIdx = 0, nCount = rMarkList.GetMarkCount(); nIdx < nCount; ++nIdx ) + if( SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj() ) + ImpProcessObj( pObj, eMode, FALSE ); +} - // #99190# 3D objects are no group objects, IsGroupObject() - // only tests if pSub is not null ptr :-( - if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene)) - bIsGroup = sal_False; +void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, BOOL bUseZOrder) +{ + bool bIsGroup = pObj->IsGroupObject(); + // #99190# 3D objects are no group objects, IsGroupObject() + // only tests if pSub is not null ptr :-( + if( bIsGroup && pObj->ISA( E3dObject ) && !pObj->ISA( E3dScene ) ) + bIsGroup = false; - if(eMode != IM_DEEPNOGROUPS || !bIsGroup) - maObjList.Insert(pObj, LIST_APPEND); + if( !bIsGroup || (eMode != IM_DEEPNOGROUPS) ) + maObjList.Insert( pObj, LIST_APPEND ); - if(bIsGroup && eMode != IM_FLAT) - ImpProcessObjectList(*pObj->GetSubList(), eMode, bUseZOrder); - } + if( bIsGroup && (eMode != IM_FLAT) ) + ImpProcessObjectList( *pObj->GetSubList(), eMode, bUseZOrder ); } - diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 43f7b841516c..60761a2d3557 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -93,6 +93,8 @@ // #95114# #include <vcl/svapp.hxx> #include <svx/sdr/properties/properties.hxx> +#include <svx/eeitem.hxx> +#include <svtools/itemset.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -346,11 +348,11 @@ SdrModel::~SdrModel() { // Pools loeschen, falls es meine sind SfxItemPool* pOutlPool=pItemPool->GetSecondaryPool(); - delete pItemPool; + SfxItemPool::Free(pItemPool); // Der OutlinerPool muss nach dem ItemPool plattgemacht werden, da der // ItemPool SetItems enthaelt die ihrerseits Items des OutlinerPools // referenzieren (Joe) - delete pOutlPool; + SfxItemPool::Free(pOutlPool); } if( mpForbiddenCharactersTable ) @@ -976,17 +978,19 @@ void SdrModel::SetDefaultTabulator(USHORT nVal) void SdrModel::ImpSetUIUnit() { - if (aUIScale.GetNumerator()==0 || aUIScale.GetDenominator()==0) aUIScale=Fraction(1,1); - FASTBOOL bMapInch=IsInch(eObjUnit); - FASTBOOL bMapMetr=IsMetric(eObjUnit); - FASTBOOL bUIInch=IsInch(eUIUnit); - FASTBOOL bUIMetr=IsMetric(eUIUnit); - nUIUnitKomma=0; - long nMul=1; - long nDiv=1; + if(0 == aUIScale.GetNumerator() || 0 == aUIScale.GetDenominator()) + { + aUIScale = Fraction(1,1); + } + + // set start values + nUIUnitKomma = 0; + sal_Int64 nMul(1); + sal_Int64 nDiv(1); - // Zunaechst normalisieren auf m bzw. " - switch (eObjUnit) { + // normalize on meters resp. inch + switch (eObjUnit) + { case MAP_100TH_MM : nUIUnitKomma+=5; break; case MAP_10TH_MM : nUIUnitKomma+=4; break; case MAP_MM : nUIUnitKomma+=3; break; @@ -1010,7 +1014,8 @@ void SdrModel::ImpSetUIUnit() // 1 pole = 5 1/2 yd = 198" = 5.029,2mm // 1 yd = 3 ft = 36" = 914,4mm // 1 ft = 12 " = 1" = 304,8mm - switch (eUIUnit) { + switch (eUIUnit) + { case FUNIT_NONE : break; // Metrisch case FUNIT_100TH_MM: nUIUnitKomma-=5; break; @@ -1030,48 +1035,61 @@ void SdrModel::ImpSetUIUnit() case FUNIT_PERCENT: nUIUnitKomma+=2; break; } // switch - if (bMapInch && bUIMetr) { - nUIUnitKomma+=4; - nMul*=254; - } - if (bMapMetr && bUIInch) { - nUIUnitKomma-=4; - nDiv*=254; - } - - // Temporaere Fraction zum Kuerzen - Fraction aTempFract(nMul,nDiv); - nMul=aTempFract.GetNumerator(); - nDiv=aTempFract.GetDenominator(); - // Nun mit dem eingestellten Masstab verknuepfen - BigInt nBigMul(nMul); - BigInt nBigDiv(nDiv); - BigInt nBig1000(1000); - nBigMul*=aUIScale.GetDenominator(); - nBigDiv*=aUIScale.GetNumerator(); - while (nBigMul>nBig1000) { + // check if mapping is from metric to inch and adapt + const bool bMapInch(IsInch(eObjUnit)); + const bool bUIMetr(IsMetric(eUIUnit)); + + if (bMapInch && bUIMetr) + { + nUIUnitKomma += 4; + nMul *= 254; + } + + // check if mapping is from inch to metric and adapt + const bool bMapMetr(IsMetric(eObjUnit)); + const bool bUIInch(IsInch(eUIUnit)); + + if (bMapMetr && bUIInch) + { + nUIUnitKomma -= 4; + nDiv *= 254; + } + + // use temporary fraction for reduction (fallback to 32bit here), + // may need to be changed in the future, too + if(1 != nMul || 1 != nDiv) + { + const Fraction aTemp(static_cast< long >(nMul), static_cast< long >(nDiv)); + nMul = aTemp.GetNumerator(); + nDiv = aTemp.GetDenominator(); + } + + // #i89872# take Unit of Measurement into account + if(1 != aUIScale.GetDenominator() || 1 != aUIScale.GetNumerator()) + { + // divide by UIScale + nMul *= aUIScale.GetDenominator(); + nDiv *= aUIScale.GetNumerator(); + } + + // shorten trailing zeroes for dividend + while(0 == (nMul % 10)) + { nUIUnitKomma--; - nBigMul/=10; + nMul /= 10; } - while (nBigDiv>nBig1000) { + + // shorten trailing zeroes for divisor + while(0 == (nDiv % 10)) + { nUIUnitKomma++; - nBigDiv/=10; - } - nMul=long(nBigMul); - nDiv=long(nBigDiv); - switch ((short)nMul) { - case 10: nMul=1; nUIUnitKomma--; break; - case 100: nMul=1; nUIUnitKomma-=2; break; - case 1000: nMul=1; nUIUnitKomma-=3; break; - } // switch - switch ((short)nDiv) { - case 10: nDiv=1; nUIUnitKomma++; break; - case 100: nDiv=1; nUIUnitKomma+=2; break; - case 1000: nDiv=1; nUIUnitKomma+=3; break; - } // switch - aUIUnitFact=Fraction(nMul,nDiv); - bUIOnlyKomma=nMul==nDiv; - TakeUnitStr(eUIUnit,aUIUnitStr); + nDiv /= 10; + } + + // end preparations, set member values + aUIUnitFact = Fraction(sal_Int32(nMul), sal_Int32(nDiv)); + bUIOnlyKomma = (nMul == nDiv); + TakeUnitStr(eUIUnit, aUIUnitStr); } void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 3f748e53ff47..70dda490a540 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2461,7 +2461,7 @@ void SdrObjCustomShape::SetVerticalWriting( sal_Bool bVertical ) if( pOutlinerParaObject ) { - if(pOutlinerParaObject->IsVertical() != bVertical) + if(pOutlinerParaObject->IsVertical() != (bool)bVertical) { // get item settings const SfxItemSet& rSet = GetObjectItemSet(); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 475ffbb8ea98..6ec9c607188b 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -613,8 +613,8 @@ void SdrObject::FreeGlobalDrawObjectItemPool() if(mpGlobalItemPool) { SfxItemPool* pGlobalOutlPool = mpGlobalItemPool->GetSecondaryPool(); - delete mpGlobalItemPool; - delete pGlobalOutlPool; + SfxItemPool::Free(mpGlobalItemPool); + SfxItemPool::Free(pGlobalOutlPool); } } diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 5e61a923a51e..6f97d4051b28 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -71,6 +71,7 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1441,4 +1442,133 @@ USHORT SdrMeasureObj::GetOutlinerViewAnchorMode() const return (USHORT)eRet; } +////////////////////////////////////////////////////////////////////////////// +// #i97878# +// TRGetBaseGeometry/TRSetBaseGeometry needs to be based on two positions, +// same as line geometry in SdrPathObj. Thus needs to be overloaded and +// implemented since currently it is derived from SdrTextObj which uses +// a functionality based on SnapRect which is not useful here + +inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); } +inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } + +sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const +{ + // handle the same as a simple line since the definition is based on two points + const basegfx::B2DRange aRange(aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y()); + basegfx::B2DTuple aScale(aRange.getRange()); + basegfx::B2DTuple aTranslate(aRange.getMinimum()); + + // position maybe relative to anchorpos, convert + if( pModel->IsWriter() ) + { + if(GetAnchorPos().X() || GetAnchorPos().Y()) + { + aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y()); + } + } + + // force MapUnit to 100th mm + SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + switch(eMapUnit) + { + case SFX_MAPUNIT_TWIP : + { + // postion + aTranslate.setX(ImplTwipsToMM(aTranslate.getX())); + aTranslate.setY(ImplTwipsToMM(aTranslate.getY())); + + // size + aScale.setX(ImplTwipsToMM(aScale.getX())); + aScale.setY(ImplTwipsToMM(aScale.getY())); + + break; + } + default: + { + DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!"); + } + } + } + + // build return value matrix + rMatrix.identity(); + + if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0)) + { + rMatrix.scale(aScale.getX(), aScale.getY()); + } + + if(!aTranslate.equalZero()) + { + rMatrix.translate(aTranslate.getX(), aTranslate.getY()); + } + + return sal_True; +} + +void SdrMeasureObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/) +{ + // use given transformation to derive the two defining points from unit line + basegfx::B2DPoint aPosA(rMatrix * basegfx::B2DPoint(0.0, 0.0)); + basegfx::B2DPoint aPosB(rMatrix * basegfx::B2DPoint(1.0, 0.0)); + + // force metric to pool metric + SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + switch(eMapUnit) + { + case SFX_MAPUNIT_TWIP : + { + // position + aPosA.setX(ImplMMToTwips(aPosA.getX())); + aPosA.setY(ImplMMToTwips(aPosA.getY())); + aPosB.setX(ImplMMToTwips(aPosB.getX())); + aPosB.setY(ImplMMToTwips(aPosB.getY())); + + break; + } + default: + { + DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); + } + } + } + + if( pModel->IsWriter() ) + { + // if anchor is used, make position relative to it + if(GetAnchorPos().X() || GetAnchorPos().Y()) + { + const basegfx::B2DVector aAnchorOffset(GetAnchorPos().X(), GetAnchorPos().Y()); + + aPosA += aAnchorOffset; + aPosB += aAnchorOffset; + } + } + + // derive new model data + const Point aNewPt1(basegfx::fround(aPosA.getX()), basegfx::fround(aPosA.getY())); + const Point aNewPt2(basegfx::fround(aPosB.getX()), basegfx::fround(aPosB.getY())); + + if(aNewPt1 != aPt1 || aNewPt2 != aPt2) + { + // set model values and broadcast + Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); + + aPt1 = aNewPt1; + aPt2 = aNewPt2; + + SetTextDirty(); + ActionChanged(); + SetChanged(); + BroadcastObjectChange(); + SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0); + } +} + +////////////////////////////////////////////////////////////////////////////// // eof diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index dd2fc5e9cd9c..9abf3950d694 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -910,7 +910,10 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FAS pTestObj->GetOutlinerParaObject() != pOutlinerParaObject ) { if( bHitTest ) // #i33696# take back fix #i27510# + { rOutliner.SetTextObj( this ); + rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); + } rOutliner.SetUpdateMode(TRUE); rOutliner.SetText(*pPara); @@ -1338,7 +1341,7 @@ void SdrTextObj::operator=(const SdrObject& rObj) } else { - pNewOutlinerParaObject = pTextObj->getActiveText()->GetOutlinerParaObject()->Clone(); + pNewOutlinerParaObject = new OutlinerParaObject(*pTextObj->getActiveText()->GetOutlinerParaObject()); } } @@ -1714,7 +1717,7 @@ void SdrTextObj::SetVerticalWriting(sal_Bool bVertical) pOutlinerParaObject = GetOutlinerParaObject(); } - if( pOutlinerParaObject && (pOutlinerParaObject->IsVertical() != bVertical) ) + if( pOutlinerParaObject && (pOutlinerParaObject->IsVertical() != (bool)bVertical) ) { // get item settings const SfxItemSet& rSet = GetObjectItemSet(); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index be1d19f96f4e..b6dc0a8186f2 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -435,6 +435,17 @@ namespace if(!basegfx::fTools::equal(fStart, fEnd)) { + if(rInfo.IsRTL()) + { + // #i98523# + // When the portion is RTL, mirror the redlining using the + // full portion width + const double fTextWidth(aDXArray[aDXArray.size() - 1]); + + fStart = fTextWidth - fStart; + fEnd = fTextWidth - fEnd; + } + maTextPortionPrimitives.push_back(new drawinglayer::primitive2d::WrongSpellPrimitive2D( aNewTransform, fStart, @@ -662,7 +673,7 @@ bool SdrTextObj::impDecomposeContourTextPrimitive( rOutliner.SetPaperSize(aNullSize); rOutliner.SetPolygon(aPolyPolygon); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*rSdrContourTextPrimitive.getSdrText().GetOutlinerParaObject()); + rOutliner.SetText(rSdrContourTextPrimitive.getOutlinerParaObject()); // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); @@ -729,9 +740,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( // add one to rage sizes to get back to the old Rectangle and outliner measurements const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L)); const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L)); - const OutlinerParaObject* pOutlinerParaObject = rSdrBlockTextPrimitive.getSdrText().GetOutlinerParaObject(); - OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)"); - const bool bVerticalWritintg(pOutlinerParaObject->IsVertical()); + const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical()); const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight)); if(bIsCell) @@ -743,7 +752,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetPaperSize(aAnchorTextSize); rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0)); rOutliner.SetUpdateMode(TRUE); - rOutliner.SetText(*pOutlinerParaObject); + rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); rOutliner.SetUpdateMode(TRUE); rOutliner.SetControlWord(nOriginalControlWord); } @@ -766,7 +775,7 @@ bool SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*pOutlinerParaObject); + rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); rOutliner.SetControlWord(nOriginalControlWord); } @@ -894,7 +903,7 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive( rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); rOutliner.SetPaperSize(aNullSize); rOutliner.SetUpdateMode(true); - rOutliner.SetText(*rSdrStretchTextPrimitive.getSdrText().GetOutlinerParaObject()); + rOutliner.SetText(rSdrStretchTextPrimitive.getOutlinerParaObject()); // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage())); diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx index 42645bc9aecb..3b1a304bf9d4 100644 --- a/svx/source/svdraw/svdotxed.cxx +++ b/svx/source/svdraw/svdotxed.cxx @@ -39,6 +39,7 @@ #include <editstat.hxx> #include <svtools/itemset.hxx> #include <svx/eeitem.hxx> +#include <svx/sdtfchim.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -91,7 +92,9 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl) if(pOutlinerParaObject!=NULL) { rOutl.SetText(*GetOutlinerParaObject()); + rOutl.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); } + // ggf. Rahmenattribute am 1. (neuen) Absatz des Outliners setzen if( !HasTextImpl( &rOutl ) ) { diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index cf9476ed2489..d6020908bef0 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -623,6 +623,10 @@ uno::Reference< awt::XControl > SdrUnoObj::GetUnoControl(const SdrView& _rView, uno::Reference< awt::XControl > xControl; SdrPageView* pPageView = _rView.GetSdrPageView(); + OSL_ENSURE( GetPage() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" ); + if ( GetPage() != pPageView->GetPage() ) + return NULL; + SdrPageWindow* pPageWindow = pPageView ? pPageView->FindPageWindow( _rOut ) : NULL; OSL_ENSURE( pPageWindow, "SdrUnoObj::GetUnoControl: did not find my SdrPageWindow!" ); if ( !pPageWindow ) diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 1bebad93223d..c42497d73507 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -36,7 +36,6 @@ #include <sdrpaintwindow.hxx> #include <goodies/grfmgr.hxx> #include <svx/svdmodel.hxx> -#include <svx/fmview.hxx> #ifdef DBG_UTIL #include <svdibrow.hxx> @@ -868,13 +867,6 @@ SdrPaintWindow* SdrPaintView::BeginCompleteRedraw(OutputDevice* pOut) pPaintWindow->setTemporaryTarget(true); } - // the following is a hack, only to be used on the 3.0.1 branch, to prevent becoming - // incompatible there - // #i94033# / 2008-10-16 / frank.schoenheit@sun.com - FmFormView* pMeAsFormView = dynamic_cast< FmFormView* >( this ); - if ( pMeAsFormView ) - pMeAsFormView->onBeginCompleteRedraw(); - return pPaintWindow; } @@ -938,13 +930,6 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFo rPaintWindow.OutputPreRenderDevice(rPaintWindow.GetRedrawRegion()); } } - - // the following is a hack, only to be used on the 3.0.1 branch, to prevent becoming - // incompatible there - // #i94033# / 2008-10-16 / frank.schoenheit@sun.com - FmFormView* pMeAsFormView = dynamic_cast< FmFormView* >( this ); - if ( pMeAsFormView ) - pMeAsFormView->onEndCompleteRedraw(); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx index dd30d6ec5dba..cbf80e23c91d 100644 --- a/svx/source/svdraw/svdtext.cxx +++ b/svx/source/svdraw/svdtext.cxx @@ -39,6 +39,8 @@ #include "svx/svdoutl.hxx" #include "svx/svdmodel.hxx" #include "svx/fhgtitem.hxx" +#include <svx/eeitem.hxx> +#include <svtools/itemset.hxx> SdrText::SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject /* = 0 */ ) : mpOutlinerParaObject( pOutlinerParaObject ) diff --git a/svx/source/svdraw/svdtxhdl.cxx b/svx/source/svdraw/svdtxhdl.cxx index 8446b3dd6ea6..e78b85ff10d0 100644 --- a/svx/source/svdraw/svdtxhdl.cxx +++ b/svx/source/svdraw/svdtxhdl.cxx @@ -57,6 +57,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svtools/itemset.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 976f48c82194..eb52bfb62c9e 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -348,7 +348,7 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBO { pTextUndo = pObj->GetOutlinerParaObject(); if(pTextUndo) - pTextUndo = pTextUndo->Clone(); + pTextUndo = new OutlinerParaObject(*pTextUndo); } } } @@ -409,7 +409,7 @@ void SdrUndoAttrObj::Undo() pTextRedo = pObj->GetOutlinerParaObject(); if(pTextRedo) - pTextRedo = pTextRedo->Clone(); + pTextRedo = new OutlinerParaObject(*pTextRedo); } } @@ -470,7 +470,7 @@ void SdrUndoAttrObj::Undo() if(pTextUndo) { - pObj->SetOutlinerParaObject(pTextUndo->Clone()); + pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextUndo)); } } @@ -540,7 +540,7 @@ void SdrUndoAttrObj::Redo() // #i8508# if(pTextRedo) { - pObj->SetOutlinerParaObject(pTextRedo->Clone()); + pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextRedo)); } } @@ -1096,7 +1096,7 @@ SdrUndoObjSetText::SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText) { SdrText* pText = static_cast< SdrTextObj*>( &rNewObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pOldText = pText->GetOutlinerParaObject()->Clone(); + pOldText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); bEmptyPresObj = rNewObj.IsEmptyPresObj(); } @@ -1115,7 +1115,7 @@ void SdrUndoObjSetText::AfterSetText() { SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText && pText->GetOutlinerParaObject() ) - pNewText = pText->GetOutlinerParaObject()->Clone(); + pNewText = new OutlinerParaObject(*pText->GetOutlinerParaObject()); bNewTextAvailable=TRUE; } } @@ -1132,7 +1132,7 @@ void SdrUndoObjSetText::Undo() // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung OutlinerParaObject* pText1 = pOldText; if(pText1) - pText1 = pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText ) @@ -1148,7 +1148,7 @@ void SdrUndoObjSetText::Redo() OutlinerParaObject* pText1 = pNewText; if(pText1) - pText1 = pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); if( pText ) @@ -1192,7 +1192,7 @@ void SdrUndoObjSetText::SdrRepeat(SdrView& rView) rView.AddUndo(new SdrUndoObjSetText(*pTextObj,0)); OutlinerParaObject* pText1=pNewText; if (pText1!=NULL) - pText1=pText1->Clone(); + pText1 = new OutlinerParaObject(*pText1); pTextObj->SetOutlinerParaObject(pText1); } } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 4eb4fd0118dc..e7096dcc2df0 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -409,7 +409,7 @@ void Cell::replaceContentAndFormating( const CellRef& xSourceCell ) if( xSourceCell.is() && mpProperties ) { mpProperties->SetMergedItemSet( xSourceCell->GetObjectItemSet() ); - SetOutlinerParaObject( xSourceCell->GetOutlinerParaObject()->Clone() ); + SetOutlinerParaObject( new OutlinerParaObject(*xSourceCell->GetOutlinerParaObject()) ); SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() ); SdrTableObj& rSourceTableObj = dynamic_cast< SdrTableObj& >( xSourceCell->GetObject() ); @@ -509,10 +509,7 @@ const SfxItemSet& Cell::GetObjectItemSet() else { DBG_ERROR("Cell::GetObjectItemSet(), called without properties!"); - static UniString aEmptyStr; - static SfxItemPool aEmptyPool(aEmptyStr,0,0,0); - static SfxItemSet aSet(aEmptyPool); - return aSet; + return GetObject().GetObjectItemSet(); } } @@ -678,6 +675,9 @@ void Cell::SetOutlinerParaObject( OutlinerParaObject* pTextObject ) { SdrText::SetOutlinerParaObject( pTextObject ); maSelection.nStartPara = 0xffff; + + if( pTextObject == 0 ) + ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT ); } // ----------------------------------------------------------------------------- @@ -694,15 +694,22 @@ void Cell::AddUndo() // ----------------------------------------------------------------------------- -sdr::properties::TextProperties* Cell::CloneProperties( SdrObject& rNewObj, Cell& rNewCell ) +sdr::properties::TextProperties* Cell::CloneProperties( sdr::properties::TextProperties* pProperties, SdrObject& rNewObj, Cell& rNewCell ) { - if( mpProperties ) - return new sdr::properties::CellProperties( *static_cast<sdr::properties::CellProperties*>(mpProperties), rNewObj, &rNewCell ); + if( pProperties ) + return new sdr::properties::CellProperties( *static_cast<sdr::properties::CellProperties*>(pProperties), rNewObj, &rNewCell ); else return 0; } // ----------------------------------------------------------------------------- + +sdr::properties::TextProperties* Cell::CloneProperties( SdrObject& rNewObj, Cell& rNewCell ) +{ + return CloneProperties(mpProperties,rNewObj,rNewCell); +} + +// ----------------------------------------------------------------------------- // XInterface // ----------------------------------------------------------------------------- diff --git a/svx/source/table/cell.hxx b/svx/source/table/cell.hxx index 02d5d1dc30cc..15be15b2b6af 100644 --- a/svx/source/table/cell.hxx +++ b/svx/source/table/cell.hxx @@ -202,6 +202,8 @@ public: sdr::properties::TextProperties* CloneProperties( SdrObject& rNewObj, Cell& rNewCell ); + static sdr::properties::TextProperties* CloneProperties( sdr::properties::TextProperties* pProperties, SdrObject& rNewObj, Cell& rNewCell ); + void notifyModified(); protected: diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx index 91235c908e0b..f72ca2fd8927 100644 --- a/svx/source/table/tableundo.cxx +++ b/svx/source/table/tableundo.cxx @@ -40,6 +40,7 @@ #include "tablerow.hxx" #include "tablecolumn.hxx" + // ----------------------------------------------------------------------------- using ::rtl::OUString; @@ -56,22 +57,36 @@ CellUndo::CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell ) , mxCell( xCell ) , mbUndo( true ) { - - getDataFromCell( maUndoData ); + if( mxCell.is() && mxObjRef.is() ) + { + getDataFromCell( maUndoData ); + mxObjRef->AddObjectUser( *this ); + } } CellUndo::~CellUndo() { - if( mbUndo ) - { - delete maUndoData.mpProperties; - delete maUndoData.mpOutlinerParaObject; - } - else - { - delete maRedoData.mpProperties; - delete maRedoData.mpOutlinerParaObject; - } + if( mxObjRef.is() ) + mxObjRef->RemoveObjectUser( *this ); + dispose(); +} + +void CellUndo::dispose() +{ + mxCell.clear(); + delete maUndoData.mpProperties; + maUndoData.mpProperties = 0; + delete maRedoData.mpProperties; + maRedoData.mpProperties = 0; + delete maUndoData.mpOutlinerParaObject; + maUndoData.mpOutlinerParaObject = 0; + delete maRedoData.mpOutlinerParaObject; + maRedoData.mpOutlinerParaObject = 0; +} + +void CellUndo::ObjectInDestruction(const SdrObject& ) +{ + dispose(); } void CellUndo::Undo() @@ -88,7 +103,7 @@ void CellUndo::Undo() void CellUndo::Redo() { - if( mxCell.is() && mbUndo ) + if( mxCell.is() && !mbUndo ) { setDataToCell( maRedoData ); mbUndo = true; @@ -110,11 +125,14 @@ BOOL CellUndo::Merge( SfxUndoAction *pNextAction ) void CellUndo::setDataToCell( const Data& rData ) { - mxCell->mpProperties = rData.mpProperties; - + delete mxCell->mpProperties; + if( rData.mpProperties ) + mxCell->mpProperties = Cell::CloneProperties( rData.mpProperties, *mxObjRef.get(), *mxCell.get() ); + else + mxCell->mpProperties = 0; if( rData.mpOutlinerParaObject ) - mxCell->SetOutlinerParaObject( rData.mpOutlinerParaObject->Clone() ); + mxCell->SetOutlinerParaObject( new OutlinerParaObject(*rData.mpOutlinerParaObject) ); else mxCell->RemoveOutlinerParaObject(); @@ -137,7 +155,7 @@ void CellUndo::getDataFromCell( Data& rData ) rData.mpProperties = mxCell->CloneProperties( *mxObjRef.get(), *mxCell.get()); if( mxCell->GetOutlinerParaObject() ) - rData.mpOutlinerParaObject = mxCell->GetOutlinerParaObject()->Clone(); + rData.mpOutlinerParaObject = new OutlinerParaObject(*mxCell->GetOutlinerParaObject()); else rData.mpOutlinerParaObject = 0; diff --git a/svx/source/table/tableundo.hxx b/svx/source/table/tableundo.hxx index 07adeb872192..cc6c73ce5367 100644 --- a/svx/source/table/tableundo.hxx +++ b/svx/source/table/tableundo.hxx @@ -50,7 +50,7 @@ class OutlinerParaObject; namespace sdr { namespace table { -class CellUndo : public SdrUndoAction +class CellUndo : public SdrUndoAction, public sdr::ObjectUser { public: CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell ); @@ -60,6 +60,9 @@ public: virtual void Redo(); virtual BOOL Merge( SfxUndoAction *pNextAction ); + void dispose(); + virtual void ObjectInDestruction(const SdrObject& rObject); + private: struct Data { diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index f7a2134c520e..1abf930eb3ed 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -73,7 +73,7 @@ SvxUnoDrawPool::SvxUnoDrawPool( SdrModel* pModel ) throw() SvxUnoDrawPool::~SvxUnoDrawPool() throw() { - delete mpDefaultsPool; + SfxItemPool::Free(mpDefaultsPool); } void SvxUnoDrawPool::init() diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 9af61cebf6af..e45095492e1b 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -551,6 +551,37 @@ void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw() } //---------------------------------------------------------------------- +// --> OD 2009-01-16 #i59051# +void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw() +{ + DBG_TESTSOLARMUTEX(); + if(mpModel) + { + SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0); + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + switch(eMapUnit) + { + case SFX_MAPUNIT_TWIP : + { + basegfx::B2DHomMatrix aTransform; + const double fMMToTWIPS(72.0 / 127.0); + + aTransform.scale(fMMToTWIPS, fMMToTWIPS); + rPolyPolygon.transform(aTransform); + break; + } + default: + { + DBG_ERROR("Missing unit translation to PoolMetric!"); + } + } + } + } +} +// <-- + +//---------------------------------------------------------------------- void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw() { DBG_TESTSOLARMUTEX(); @@ -578,6 +609,37 @@ void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw() } //---------------------------------------------------------------------- +// --> OD 2009-01-16 #i59051# +void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw() +{ + DBG_TESTSOLARMUTEX(); + SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM; + if(mpModel) + { + eMapUnit = mpModel->GetItemPool().GetMetric(0); + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + switch(eMapUnit) + { + case SFX_MAPUNIT_TWIP : + { + basegfx::B2DHomMatrix aTransform; + const double fTWIPSToMM(127.0 / 72.0); + + aTransform.scale(fTWIPSToMM, fTWIPSToMM); + rPolyPolygon.transform(aTransform); + break; + } + default: + { + DBG_ERROR("Missing unit translation to 100th mm!"); + } + } + } + } +} +// <-- +//---------------------------------------------------------------------- void SvxShape::ObtainSettingsFromPropertySet(SvxItemPropertySet& rPropSet) throw() { DBG_TESTSOLARMUTEX(); @@ -2420,10 +2482,15 @@ bool SvxShape::setPropertyValueImpl( const SfxItemPropertyMap* pProperty, const if( rValue >>= aUnoPoint ) { Point aPoint( aUnoPoint.X, aUnoPoint.Y ); + // --> OD 2009-01-16 #i59051# + // perform metric change before applying anchor position, + // because the anchor position is in pool metric. + ForceMetricToItemPoolMetric( aPoint ); + // <-- if( mpModel->IsWriter() ) aPoint += mpObj->GetAnchorPos(); - ForceMetricToItemPoolMetric( aPoint ); +// ForceMetricToItemPoolMetric( aPoint ); pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint ); return true; } @@ -2447,6 +2514,9 @@ bool SvxShape::setPropertyValueImpl( const SfxItemPropertyMap* pProperty, const if ( rValue >>= aPolyPoly ) { basegfx::B2DPolyPolygon aNewPolyPolygon( SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aPolyPoly ) ); + // --> OD 2009-01-16 #i59051# + ForceMetricToItemPoolMetric( aNewPolyPolygon ); + // <-- if( mpModel->IsWriter() ) { Point aPoint( mpObj->GetAnchorPos() ); @@ -2471,6 +2541,9 @@ bool SvxShape::setPropertyValueImpl( const SfxItemPropertyMap* pProperty, const if(pMeasureObj && ( rValue >>= aUnoPoint ) ) { Point aPoint( aUnoPoint.X, aUnoPoint.Y ); + // --> OD 2009-01-12 #i59051# + ForceMetricToItemPoolMetric( aPoint ); + // <-- if( mpModel->IsWriter() ) aPoint += mpObj->GetAnchorPos(); @@ -2891,6 +2964,9 @@ bool SvxShape::getPropertyValueImpl( const SfxItemPropertyMap* pProperty, ::com: aMatrix.translate( -aPoint.X(), -aPoint.Y() ); aPolyPoly.transform( aMatrix ); } + // --> OD 2009-01-16 #i59051# + ForceMetricTo100th_mm( aPolyPoly ); + // <-- drawing::PolyPolygonBezierCoords aRetval; SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval); rValue <<= aRetval; @@ -2911,6 +2987,9 @@ bool SvxShape::getPropertyValueImpl( const SfxItemPropertyMap* pProperty, ::com: if( mpModel->IsWriter() ) aPoint -= mpObj->GetAnchorPos(); + // --> OD 2009-01-12 #i59051# + ForceMetricTo100th_mm( aPoint ); + // <-- awt::Point aUnoPoint( aPoint.X(), aPoint.Y() ); rValue <<= aUnoPoint; diff --git a/svx/source/unoedit/unotext.cxx b/svx/source/unoedit/unotext.cxx index 797d266b4e44..777e75d89b4a 100644 --- a/svx/source/unoedit/unotext.cxx +++ b/svx/source/unoedit/unotext.cxx @@ -2496,9 +2496,10 @@ String SvxDummyTextSource::GetText( const ESelection& ) const SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, BOOL ) const { - String aDummyStr(RTL_CONSTASCII_USTRINGPARAM("Dummy")); - SfxItemPool aPool(aDummyStr,0,0,NULL); - return SfxItemSet(aPool); + // AW: Very dangerous: The former implementation used a SfxItemPool created on the + // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using + // a deleted Pool by design. + return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool()); } SfxItemSet SvxDummyTextSource::GetParaAttribs( sal_uInt16 ) const diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 7b28349cac43..b304ea9a62a1 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -120,7 +120,7 @@ XPropertyTable::~XPropertyTable() // Eigener Pool wird geloescht if( bOwnPool && pXPool ) { - delete pXPool; + SfxItemPool::Free(pXPool); } } @@ -352,7 +352,7 @@ XPropertyList::~XPropertyList() if( bOwnPool && pXPool ) { - delete pXPool; + SfxItemPool::Free(pXPool); } } diff --git a/svx/util/hidother.src b/svx/util/hidother.src index ea18f2c0ee97..1dff4a184b7e 100644 --- a/svx/util/hidother.src +++ b/svx/util/hidother.src @@ -31,6 +31,7 @@ #include "hidother.hrc" #include <svx/svxids.hrc> #include "../inc/fmhelp.hrc" +#include "../source/dialog/svuidlg.hrc" hidspecial SID_GALLERY_IMPORTTHEME { HelpID = SID_GALLERY_IMPORTTHEME; }; hidspecial HID_GALLERY_NEW_THEME { HelpID = HID_GALLERY_NEW_THEME; }; @@ -502,4 +503,6 @@ hidspecial HID_HANGULDLG_SUGGESTIONS { HelpId = HID_HANGULDLG_SUGGESTIONS; }; hidspecial HID_HANGULDLG_SUGGESTIONS_GRID { HelpId = HID_HANGULDLG_SUGGESTIONS_GRID; }; hidspecial HID_HANGULDLG_SUGGESTIONS_LIST { HelpId = HID_HANGULDLG_SUGGESTIONS_LIST; }; +hidspecial HID_PASTE_DLG { HelpId = HID_PASTE_DLG; }; +hidspecial HID_LINKDLG_TABLB { HelpId = HID_LINKDLG_TABLB; }; diff --git a/sysui/desktop/debian/makefile.mk b/sysui/desktop/debian/makefile.mk index fa4f558c1f2b..1e0761198c14 100644 --- a/sysui/desktop/debian/makefile.mk +++ b/sysui/desktop/debian/makefile.mk @@ -49,7 +49,7 @@ TARGET=debian .IF "$(PKGFORMAT)"!="$(PKGFORMAT:s/deb//)" -DEBFILES=$(foreach,i,{$(PRODUCTLIST)} $(PKGDIR)$/$i3.1-$(TARGET)-menus_$(PKGVERSION.$i)-$(PKGREV)_all.deb) +DEBFILES=$(foreach,i,{$(PRODUCTLIST)} $(PKGDIR)$/$i3.2-$(TARGET)-menus_$(PKGVERSION.$i)-$(PKGREV)_all.deb) .ENDIF @@ -64,22 +64,22 @@ ALLTAR : $(DEBFILES) %/DEBIAN/control : $$(@:f) @$(MKDIRHIER) $(@:d) $*$/etc $*$/usr/share/applnk/Office $*$/usr/lib/menu - ln -sf /opt/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.1//)) $*$/etc$/ - /bin/sh -c -x "cd $(COMMONMISC)$/$(*:f:s/-/ /:1:s/3.1//) && DESTDIR=$(shell @cd $*; pwd) ICON_PREFIX=$(ICONPREFIX) KDEMAINDIR=/usr GNOMEDIR=/usr create_tree.sh" - @cat openoffice.org-debian-menus | sed -e 's/%PRODUCTNAME/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.1//)) $(PRODUCTVERSION.$(*:f:s/-/ /:1:s/3.1//))/' -e 's/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.1//))/' -e 's/%ICONPREFIX/$(ICONPREFIX.$(*:f:s/-/ /:1:s/3.1//))/' > $*$/usr/lib/menu/$(*:f:s/_/ /:1:s/3.1//) - echo "Package: $(*:f:s/_/ /:1:s/3.1//)" > $@ - cat $(@:f) | tr -d "\015" | sed "s/%productname/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.1//))/" >> $@ - echo "Version: $(PKGVERSION.$(*:f:s/-/ /:1:s/3.1//))-$(PKGREV)" >> $@ + ln -sf /opt/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.2//)) $*$/etc$/ + /bin/sh -c -x "cd $(COMMONMISC)$/$(*:f:s/-/ /:1:s/3.2//) && DESTDIR=$(shell @cd $*; pwd) ICON_PREFIX=$(ICONPREFIX) KDEMAINDIR=/usr GNOMEDIR=/usr create_tree.sh" + @cat openoffice.org-debian-menus | sed -e 's/%PRODUCTNAME/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.2//)) $(PRODUCTVERSION.$(*:f:s/-/ /:1:s/3.2//))/' -e 's/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.2//))/' -e 's/%ICONPREFIX/$(ICONPREFIX.$(*:f:s/-/ /:1:s/3.2//))/' > $*$/usr/lib/menu/$(*:f:s/_/ /:1:s/3.2//) + echo "Package: $(*:f:s/_/ /:1:s/3.2//)" > $@ + cat $(@:f) | tr -d "\015" | sed "s/%productname/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.2//))/" >> $@ + echo "Version: $(PKGVERSION.$(*:f:s/-/ /:1:s/3.2//))-$(PKGREV)" >> $@ @du -k -s $* | awk -F ' ' '{ printf "Installed-Size: %s\n", $$1 ; }' >> $@ %/DEBIAN/postinst : $$(@:f) - @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.1//))/g" > $@ + @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.2//))/g" > $@ %/DEBIAN/postrm : $$(@:f) - @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.1//))/g" > $@ + @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.2//))/g" > $@ %/DEBIAN/prerm : $$(@:f) - @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.1//))/g" > $@ + @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.2//))/g" > $@ # --- packaging --------------------------------------------------- diff --git a/sysui/desktop/mandriva/mandriva-menus.spec b/sysui/desktop/mandriva/mandriva-menus.spec index c2204f4b4973..5be889e3924e 100644 --- a/sysui/desktop/mandriva/mandriva-menus.spec +++ b/sysui/desktop/mandriva/mandriva-menus.spec @@ -289,7 +289,7 @@ GenerateMenu "%unixfilename-printeradmin" \ "core02" %clean -rm -rf $RPM_BUILD_ROOT/* +rm -rf $RPM_BUILD_ROOT %preun # remove from /etc/mailcap only on de-install diff --git a/sysui/desktop/productversion.mk b/sysui/desktop/productversion.mk index 78a66b7f33b1..7d2467d32e7e 100644 --- a/sysui/desktop/productversion.mk +++ b/sysui/desktop/productversion.mk @@ -50,7 +50,7 @@ PKGDIR=$(BIN) PRODUCTLIST = openoffice.org broffice.org # default values to minimize maintainance effort -PRODUCTVERSION = 3.1 +PRODUCTVERSION = 3.2 PRODUCTVERSIONSHORT = 3 PKGVERSION = $(PRODUCTVERSION) # gnome-vfs treats everything behind the last '.' as an icon extension, diff --git a/sysui/desktop/redhat/redhat-menus.spec b/sysui/desktop/redhat/redhat-menus.spec index a5b09ceaac84..4ad74ad1b31f 100644 --- a/sysui/desktop/redhat/redhat-menus.spec +++ b/sysui/desktop/redhat/redhat-menus.spec @@ -37,7 +37,7 @@ for i in `cat launcherlist`; do done %clean -rm -rf $RPM_BUILD_ROOT/* +rm -rf $RPM_BUILD_ROOT %triggerin -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-base, %pkgprefix-math if [ -x /usr/bin/update-desktop-database ]; then diff --git a/sysui/desktop/slackware/makefile.mk b/sysui/desktop/slackware/makefile.mk index 6610e0e628fa..ae08a3772838 100644 --- a/sysui/desktop/slackware/makefile.mk +++ b/sysui/desktop/slackware/makefile.mk @@ -44,7 +44,7 @@ TARGET=slackware # --- Files -------------------------------------------------------- -MENUFILES=$(PKGDIR)$/{$(PRODUCTLIST)}3.1-$(TARGET)-menus-$(PKGVERSION)-noarch-$(PKGREV).tgz +MENUFILES=$(PKGDIR)$/{$(PRODUCTLIST)}3.2-$(TARGET)-menus-$(PKGVERSION)-noarch-$(PKGREV).tgz .IF "$(USE_SHELL)"=="bash" ECHOPARAM=-e @@ -67,26 +67,26 @@ $(MISC)/$(TARGET)/usr/share/applications/ : # FIXME: removal of *-extension.* only to create identical packages to OOF680 %/usr/share/applications : @$(MKDIRHIER) $@ - /bin/sh -c "cd $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.1//); DESTDIR=$(shell @cd $*; pwd) GNOMEDIR="" ICON_PREFIX=$(ICONPREFIX.$(*:b:s/-/ /:1:s/3.1//)) KDEMAINDIR=/opt/kde .$/create_tree.sh" + /bin/sh -c "cd $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.2//); DESTDIR=$(shell @cd $*; pwd) GNOMEDIR="" ICON_PREFIX=$(ICONPREFIX.$(*:b:s/-/ /:1:s/3.2//)) KDEMAINDIR=/opt/kde .$/create_tree.sh" $(RM) $*$/opt$/kde$/share$/icons$/*$/*$/*$/*-extension.png $(RM) $*$/opt$/kde$/share$/mimelnk$/application$/*-extension.desktop $(RM) $*$/usr$/share$/applications$/*.desktop $(RM) $*$/usr$/bin$/soffice %$/install$/doinst.sh : update-script - @echo "( cd etc ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//)) )" > $@ - @echo "( cd etc ; ln -snf /opt/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//):s/-//) $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//)) )" >> $@ + @echo "( cd etc ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//)) )" > $@ + @echo "( cd etc ; ln -snf /opt/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//):s/-//) $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//)) )" >> $@ @echo "( cd usr/bin ; rm -rf soffice )" >> $@ - @echo "( cd usr/bin ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//))/program/soffice soffice )" >> $@ - @echo $(ECHOPARAM) $(foreach,i,$(shell @cat $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.1//)/launcherlist) "\n( cd usr/share/applications ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//))-$i )\n( cd usr/share/applications ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//))/share/xdg/$i $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//))-$i )") >> $@ + @echo "( cd usr/bin ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//))/program/soffice soffice )" >> $@ + @echo $(ECHOPARAM) $(foreach,i,$(shell @cat $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.2//)/launcherlist) "\n( cd usr/share/applications ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//))-$i )\n( cd usr/share/applications ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//))/share/xdg/$i $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//))-$i )") >> $@ @cat $< >> $@ %$/install$/slack-desc : slack-desc @$(MKDIRHIER) $(@:d) - @sed -e "s/PKGNAME/$(*:b:s/-/ /:1:s/3.1//)-$(TARGET)-menus/g" -e "s/PKGVERSION/$(PKGVERSION.$(*:b:s/-/ /:1:s/3.1//))/g" \ - -e "s/LONGPRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.1//)) $(PRODUCTVERSION.$(*:b:s/-/ /:1:s/3.1//))/g" \ - -e "s/PRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.1//))/g" \ - -e "s/UNIXFILENAME/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.1//))/g" $< > $@ + @sed -e "s/PKGNAME/$(*:b:s/-/ /:1:s/3.2//)-$(TARGET)-menus/g" -e "s/PKGVERSION/$(PKGVERSION.$(*:b:s/-/ /:1:s/3.2//))/g" \ + -e "s/LONGPRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.2//)) $(PRODUCTVERSION.$(*:b:s/-/ /:1:s/3.2//))/g" \ + -e "s/PRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.2//))/g" \ + -e "s/UNIXFILENAME/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.2//))/g" $< > $@ # needed to satisfy the slackware package tools - they need # the entries like this diff --git a/sysui/desktop/solaris/makefile.mk b/sysui/desktop/solaris/makefile.mk index 427545619532..25cf88ea32fb 100644 --- a/sysui/desktop/solaris/makefile.mk +++ b/sysui/desktop/solaris/makefile.mk @@ -127,6 +127,6 @@ $(PKGFILES) : $(MISC)$/{$(PRODUCTLIST)}$/prototype pkgmk -l 1073741824 -r . -f $(MISC)$/$(@:b:b:s/-/ /:1)$/prototype -o -d $(PKGDIR) ARCH=$(PKGARCH) VERSION=$(PKGVERSION.$(@:b:s/-/ /:1)),REV=$(PKGREV).$(PKGDATESTRING) $(FASPAC) $(SOLARBINDIR)/faspac-so.sh -a -d $(PKGDIR) $(@:b:b:s/-/ /:1:s/.//)30-desktop-int @tar -cf - -C $(PKGDIR) $(@:b:b:s/-/ /:1:s/.//)30-desktop-int | gzip > $@ - @rm -rf $(PKGDIR)/$(@:b:b:s/-/ /:1:s/.//)-desktop-int30 + @rm -rf $(PKGDIR)/$(@:b:b:s/-/ /:1:s/.//)30-desktop-int .ENDIF diff --git a/sysui/desktop/suse/suse-menus.spec b/sysui/desktop/suse/suse-menus.spec index fbb3ff231592..a1bd2b0359f1 100644 --- a/sysui/desktop/suse/suse-menus.spec +++ b/sysui/desktop/suse/suse-menus.spec @@ -36,7 +36,7 @@ export GNOME_MIME_THEME=hicolor ./create_tree.sh %clean -rm -rf $RPM_BUILD_ROOT/* +rm -rf $RPM_BUILD_ROOT %triggerin -- %pkgprefix, %pkgprefix-writer, %pkgprefix-calc, %pkgprefix-draw, %pkgprefix-impress, %pkgprefix-base, %pkgprefix-math if [ -x /opt/gnome/bin/update-desktop-database ]; then diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index fb2ebe3f9277..d876a5001c18 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: cachedcontentresultset.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.22.1 $ * * This file is part of OpenOffice.org. * @@ -808,35 +808,17 @@ sal_Bool SAL_CALL CachedContentResultSet aGuard.reacquire(); m_nLastAppliedPos += nM; m_bAfterLastApplied = nRow != m_nLastAppliedPos; - return nRow == m_nLastAppliedPos; } else throw rEx; } + + return nRow == m_nLastAppliedPos; } else return sal_True; }; -sal_Bool SAL_CALL CachedContentResultSet - ::applyPositionToOrigin() - throw( SQLException, - RuntimeException ) -{ - impl_EnsureNotDisposed(); - - sal_Int32 nRow; - { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - if( m_bAfterLast ) - throw SQLException(); - nRow = m_nRow; - if( !nRow ) - throw SQLException(); - } - return applyPositionToOrigin( nRow ); -}; - //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //define for fetching data diff --git a/ucb/source/cacher/cachedcontentresultset.hxx b/ucb/source/cacher/cachedcontentresultset.hxx index eb30a92735cf..e74051e83886 100644 --- a/ucb/source/cacher/cachedcontentresultset.hxx +++ b/ucb/source/cacher/cachedcontentresultset.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: cachedcontentresultset.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.22.1 $ * * This file is part of OpenOffice.org. * @@ -179,11 +179,6 @@ private: throw( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ); - sal_Bool SAL_CALL - applyPositionToOrigin() - throw( com::sun::star::sdbc::SQLException, - com::sun::star::uno::RuntimeException ); - void SAL_CALL impl_fetchData( sal_Int32 nRow, sal_Int32 nCount , sal_Int32 nFetchDirection ) diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index b3260e340519..3e89d7e20d2d 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: sortresult.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.22.1 $ * * This file is part of OpenOffice.org. * @@ -1677,7 +1677,7 @@ void SortedResultSet::Move( long nPos, long nCount, long nOffset ) // finally put the remembered entries at there new location nTo = nPos + nOffset; - for ( i=0; i<nCount; i++ ); + for ( i=0; i<nCount; i++ ) { maO2S.Replace( (void*)pTmpArr[ i ], (sal_uInt32)( nTo+i ) ); } diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index 22931079cbcd..77d3a7d4d790 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: filglob.cxx,v $ - * $Revision: 1.26 $ + * $Revision: 1.26.4.1 $ * * This file is part of OpenOffice.org. * @@ -263,80 +263,6 @@ namespace fileaccess { return osl::File::move( strPath,strDestPath ); } - - oslFileError getResolvedURL(rtl_uString* ustrPath, rtl_uString** pustrResolvedURL) - { - /* TODO: If file exist and is a link get link target URL */ - rtl_uString_assign( pustrResolvedURL, ustrPath ); - - return osl_File_E_None; - } - - - -//---------------------------------------------------------------------------- -// makeAbsolute Path -//---------------------------------------------------------------------------- - - - sal_Bool SAL_CALL makeAbsolutePath( const rtl::OUString& aRelPath, - rtl::OUString& aAbsPath ) - { - // should no longer happen - OSL_ASSERT( 0 != aRelPath.compareToAscii( "//./" , 4 ) ); - - if ( 0 != aRelPath.compareToAscii( "file://" , 7 ) ) - return sal_False; - - // The 'upward' ('/../') pattern. - static const sal_Unicode pattern[5] = - { - '/', '.', '.', '/', 0 - }; - - // Ensure 'relative path' contains 'pattern'. - if (rtl_ustr_indexOfStr_WithLength ( - aRelPath.getStr(), aRelPath.getLength(), pattern, 4) < 0) - { - // Path already absolute. - aAbsPath = aRelPath; - return sal_True; - } - - // Tokenize 'relative path'. - std::vector< rtl::OUString > aTokenStack; - sal_Int32 nIndex = 6; - - aRelPath.getToken( 0, '/', nIndex ); - while ( nIndex >= 0 ) - { - rtl::OUString aToken (aRelPath.getToken( 0, '/', nIndex )); - - if ( aToken.compareToAscii( ".." ) == 0 && ! aTokenStack.empty()) - aTokenStack.pop_back(); - else - aTokenStack.push_back( aToken ); - } - - // Reassemble as 'absolute path'. - rtl::OUStringBuffer aBuffer (aRelPath.getLength()); - aBuffer.appendAscii ("file:/", 6); - - std::vector< rtl::OUString >::const_iterator it; - for (it = aTokenStack.begin(); it != aTokenStack.end(); ++it) - { - aBuffer.append (sal_Unicode('/')); - aBuffer.append (*it); - } - - aAbsPath = aBuffer.makeStringAndClear(); - - return sal_True; - } - - - - void throw_handler( sal_Int32 errorCode, sal_Int32 minorCode, diff --git a/ucb/source/ucp/file/filglob.hxx b/ucb/source/ucp/file/filglob.hxx index 5455d1f25c23..fd4d6fb96c9c 100644 --- a/ucb/source/ucp/file/filglob.hxx +++ b/ucb/source/ucp/file/filglob.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: filglob.hxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.22.1 $ * * This file is part of OpenOffice.org. * @@ -105,18 +105,6 @@ namespace fileaccess { const rtl::OUString& strDestPath, sal_Bool test = false ); - extern oslFileError getResolvedURL( rtl_uString* ustrPath, - rtl_uString** pustrResolvedURL); - - - // Removes ellipses like .. and . from a file path - // Needs rework; This seems to be the most time consuming function in - // the whole file content provider - - extern sal_Bool SAL_CALL makeAbsolutePath( const rtl::OUString& aRelPath, - rtl::OUString& aAbsPath ); - - // This function implements the global exception handler of the file_ucp; // It never returns; diff --git a/ucb/source/ucp/file/filrec.cxx b/ucb/source/ucp/file/filrec.cxx index b583520344da..873c8b000ec1 100644 --- a/ucb/source/ucp/file/filrec.cxx +++ b/ucb/source/ucp/file/filrec.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: filrec.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.22.1 $ * * This file is part of OpenOffice.org. * @@ -122,14 +122,6 @@ sal_Bool ReconnectingFile::reconnect() return m_aFile.getPos( uPos ); } -::osl::FileBase::RC ReconnectingFile::isEndOfFile( sal_Bool *pIsEOF ) -{ - if ( m_bDisconnect ) - return ::osl::FileBase::E_NETWORK; - - return m_aFile.isEndOfFile( pIsEOF ); -} - ::osl::FileBase::RC ReconnectingFile::setSize( sal_uInt64 uSize ) { ::osl::FileBase::RC nRes = ::osl::FileBase::E_NETWORK; @@ -200,14 +192,6 @@ sal_Bool ReconnectingFile::reconnect() return m_aFile.write( pBuffer, uBytesToWrite, rBytesWritten ); } -::osl::FileBase::RC ReconnectingFile::readLine( ::rtl::ByteSequence& aSeq ) -{ - if ( m_bDisconnect ) - return ::osl::FileBase::E_NETWORK; - - return m_aFile.readLine( aSeq ); -} - ::osl::FileBase::RC ReconnectingFile::sync() const { if ( m_bDisconnect ) diff --git a/ucb/source/ucp/file/filrec.hxx b/ucb/source/ucp/file/filrec.hxx index f00684eb6f76..4d6833159719 100644 --- a/ucb/source/ucp/file/filrec.hxx +++ b/ucb/source/ucp/file/filrec.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: filrec.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.22.1 $ * * This file is part of OpenOffice.org. * @@ -73,8 +73,6 @@ public: ::osl::FileBase::RC getPos( sal_uInt64& uPos ); - ::osl::FileBase::RC isEndOfFile( sal_Bool *pIsEOF ); - ::osl::FileBase::RC setSize( sal_uInt64 uSize ); ::osl::FileBase::RC getSize( sal_uInt64 &rSize ); @@ -83,8 +81,6 @@ public: ::osl::FileBase::RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten); - ::osl::FileBase::RC readLine( ::rtl::ByteSequence& aSeq ); - ::osl::FileBase::RC sync() const; }; diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index 23532578d906..e070f091363d 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -2297,6 +2297,11 @@ shell::commit( const shell::ContentMap::iterator& it, sal_Bool isDirectory,isFile,isVolume,isRemoveable,isRemote,isFloppy,isCompactDisc; + sal_Int64 dirSize = 0;
+
+ if( aFileStatus.isValid( FileStatusMask_FileSize ) )
+ dirSize = aFileStatus.getFileSize(); + if( aFileStatus.isValid( FileStatusMask_Type ) ) { if( osl::FileStatus::Link == aFileStatus.getFileType() && @@ -2314,6 +2319,9 @@ shell::commit( const shell::ContentMap::iterator& it, osl::FileStatus::Directory == aFileStatus2.getFileType(); isFile = osl::FileStatus::Regular == aFileStatus2.getFileType(); + + if( aFileStatus2.isValid( FileStatusMask_FileSize ) )
+ dirSize = aFileStatus2.getFileSize(); } else { @@ -2395,17 +2403,8 @@ shell::commit( const shell::ContentMap::iterator& it, it1 = properties.find( MyProperty( Size ) ); if( it1 != properties.end() ) { - if( aFileStatus.isValid( FileStatusMask_FileSize ) ) - { - aAny <<= sal_Int64( aFileStatus.getFileSize() ); - it1->setValue( aAny ); - } - else - { - sal_Int64 dirSize = 0; - aAny <<= dirSize; - it1->setValue( aAny ); - } + aAny <<= dirSize;
+ it1->setValue( aAny ); } diff --git a/ucb/source/ucp/ftp/ftpcfunc.cxx b/ucb/source/ucp/ftp/ftpcfunc.cxx index d7433b388d23..fef6cc505eb5 100644 --- a/ucb/source/ucp/ftp/ftpcfunc.cxx +++ b/ucb/source/ucp/ftp/ftpcfunc.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ftpcfunc.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.22.1 $ * * This file is part of OpenOffice.org. * @@ -47,18 +47,6 @@ using namespace com::sun::star::uno; extern "C" { - int ftp_write(void *buffer,size_t size,size_t nmemb,void *stream) - { - FTPStreamContainer *_stream = - reinterpret_cast<FTPStreamContainer*>(stream); - - if(!_stream) - return 0; - - return _stream->write(buffer,size,nmemb); - } - - int file_write(void *buffer,size_t size,size_t nmemb,void *stream) { FILE* file = @@ -68,11 +56,4 @@ extern "C" { return fwrite(buffer,size,nmemb,file); } - - int ftp_passwd(void *, char*, char*, int) - { - return 0; - } - - } diff --git a/ucb/source/ucp/ftp/ftpcfunc.hxx b/ucb/source/ucp/ftp/ftpcfunc.hxx index 769b1090dd5b..8c2d79d93238 100644 --- a/ucb/source/ucp/ftp/ftpcfunc.hxx +++ b/ucb/source/ucp/ftp/ftpcfunc.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ftpcfunc.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.22.1 $ * * This file is part of OpenOffice.org. * @@ -59,34 +59,8 @@ extern "C" { */ - int ftp_write(void *buffer,size_t size,size_t nmemb,void *stream); - int file_write(void *buffer,size_t size,size_t nmemb,void *stream); } - - - -namespace ftp { - - /** Is the first argument to 'passwd' below. - */ - - class FTPClient - { - public: - - virtual rtl::OUString passwd() const = 0; - }; - -} - - -extern "C" { - - int ftp_passwd(void *client,char*prompt,char*buffer,int bufferlength); - -} - #endif diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx index 78cf25bc24ec..2371506f0d78 100644 --- a/ucb/source/ucp/webdav/ContentProperties.cxx +++ b/ucb/source/ucp/webdav/ContentProperties.cxx @@ -371,28 +371,6 @@ void ContentProperties::UCBNamesToHTTPNames( } //========================================================================= -// static -void ContentProperties::getMappableHTTPHeaders( - std::vector< rtl::OUString > & rHeaderNames ) -{ - // -> DateModified - rHeaderNames.push_back( - rtl::OUString::createFromAscii( "Last-Modified" ) ); - - // -> MediaType - rHeaderNames.push_back( - rtl::OUString::createFromAscii( "Content-Type" ) ); - - // -> Size - rHeaderNames.push_back( - rtl::OUString::createFromAscii( "Content-Length" ) ); - - // -> BaseURI - rHeaderNames.push_back( - rtl::OUString::createFromAscii( "Content-Location" ) ); -} - -//========================================================================= bool ContentProperties::containsAllNames( const uno::Sequence< beans::Property >& rProps, std::vector< rtl::OUString > & rNamesNotContained ) const diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx index 758e035c0e05..47e1ff57e3ec 100644 --- a/ucb/source/ucp/webdav/ContentProperties.hxx +++ b/ucb/source/ucp/webdav/ContentProperties.hxx @@ -146,11 +146,6 @@ public: std::vector< rtl::OUString > & resources, bool bIncludeUnmatched = true ); - // Returns a list of HTTP header names that can be mapped to UCB property - // names. - static void getMappableHTTPHeaders( - std::vector< rtl::OUString > & rHeaderNames ); - // return true, if all properties contained in rProps are contained in // this ContentProperties instance. Otherwiese, false will be returned. // rNamesNotContained contain the missing names. diff --git a/ucb/source/ucp/webdav/NeonHeadRequest.cxx b/ucb/source/ucp/webdav/NeonHeadRequest.cxx index 3664b22590ec..e81c8e33b24a 100644 --- a/ucb/source/ucp/webdav/NeonHeadRequest.cxx +++ b/ucb/source/ucp/webdav/NeonHeadRequest.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NeonHeadRequest.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.11 $ * * This file is part of OpenOffice.org. * @@ -66,7 +66,7 @@ void process_headers(ne_request *req, while ( it != end ) { - if ( (*it).equalsIgnoreAsciiCase(aHeaderName) ) + if ( (*it) == aHeaderName ) break; ++it; @@ -126,7 +126,7 @@ extern "C" void NHR_ResponseHeaderCatcher( void * userdata, while ( it != end ) { - if ( (*it).equalsIgnoreAsciiCase(aHeaderName) ) + if ( (*it) == aHeaderName ) break; ++it; diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx index 218b499316a2..6171d3fa0bfc 100644 --- a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx +++ b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx @@ -103,8 +103,12 @@ extern "C" int NPFR_propfind_iter( void* userdata, if ( aValue.getLength() ) { aValue = aValue.toAsciiLowerCase(); - if ( aValue.compareTo( - RTL_CONSTASCII_STRINGPARAM( "<collection" ) ) == 0 ) + if ( + ( aValue.compareTo( + RTL_CONSTASCII_STRINGPARAM( "<collection" ) ) == 0 ) || + ( aValue.compareTo( + RTL_CONSTASCII_STRINGPARAM( "<dav:collection" ) ) == 0 ) + ) { thePropertyValue.Value <<= OUString::createFromAscii( "collection" ); diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index d12130fdffac..165824a44c93 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NeonSession.cxx,v $ - * $Revision: 1.55 $ + * $Revision: 1.55.12.1 $ * * This file is part of OpenOffice.org. * @@ -270,6 +270,8 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, * cancel the request. (if non-zero, username and password are * ignored.) */ + + #if 0 // Give'em only a limited mumber of retries.. if ( attempt > 9 ) @@ -357,6 +359,7 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) ); return theRetVal; + } // ------------------------------------------------------------------- @@ -391,6 +394,10 @@ extern "C" int NeonSession_CertificationNotify( void *userdata, xCertificateContainer = uno::Reference< ::com::sun::star::security::XCertificateContainer >( pSession->getMSF().get()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.security.CertificateContainer" )), uno::UNO_QUERY ); + // YD if xmlsecurity is not built (os2), we cannot continue. + if (!xCertificateContainer.is()) + return 1; + char * dn; failures = 0; @@ -760,8 +767,11 @@ void NeonSession::Init() // Note: Calling ne_set_[server|proxy]_auth more than once per // m_pHttpSession instance sometimes(?) crashes Neon! ( last // checked: 0.22.0) - ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this ); - ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this ); + //ne_set_server_auth( m_pHttpSession, NeonSession_NeonAuth, this ); + ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + //ne_set_proxy_auth ( m_pHttpSession, NeonSession_NeonAuth, this ); + ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + } } @@ -1816,30 +1826,6 @@ bool NeonSession::getDataFromInputStream( NeonSession::Map NeonSession::certMap; -bool NeonSession::isCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) -{ - Map::iterator p = NeonSession::certMap.find(url); - - bool ret = false; - - while( p != NeonSession::certMap.end() ) - { - ret = (*p).second.equals(certificate_name); - if( ret ) - break; - p++; - } - - return ret; -} - -// ------------------------------------------------------------------- -//static -void NeonSession::rememberCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ) -{ - NeonSession::certMap.insert( Map::value_type( url, certificate_name ) ); -} - // --------------------------------------------------------------------- sal_Bool NeonSession::isDomainMatch( rtl::OUString certHostName) diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx index e4ecfc817450..98e9ea9fb17c 100644 --- a/ucb/source/ucp/webdav/NeonSession.hxx +++ b/ucb/source/ucp/webdav/NeonSession.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NeonSession.hxx,v $ - * $Revision: 1.31 $ + * $Revision: 1.31.12.1 $ * * This file is part of OpenOffice.org. * @@ -225,10 +225,6 @@ class NeonSession : public DAVSession const ::uno::Reference< ::lang::XMultiServiceFactory > getMSF() { return m_xFactory->getServiceFactory(); } - - static bool isCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ); - static void rememberCertificate( const ::rtl::OUString & url, const ::rtl::OUString & certificate_name ); - const void * getRequestData() const { return m_pRequestData; } sal_Bool isDomainMatch( rtl::OUString certHostName ); diff --git a/ucb/source/ucp/webdav/NeonUri.cxx b/ucb/source/ucp/webdav/NeonUri.cxx index b1f8d9fbc4f5..5c49179f6b20 100644 --- a/ucb/source/ucp/webdav/NeonUri.cxx +++ b/ucb/source/ucp/webdav/NeonUri.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NeonUri.cxx,v $ - * $Revision: 1.25 $ + * $Revision: 1.25.16.1 $ * * This file is part of OpenOffice.org. * @@ -310,20 +310,6 @@ bool NeonUri::operator== ( const NeonUri & rOther ) const return unescape( GetPathBaseName() ); } -::rtl::OUString NeonUri::GetPathDirName () const -{ - sal_Int32 nPos = mPath.lastIndexOf ('/'); - if (nPos == mPath.getLength () - 1) - { - // Trailing slash found. Skip. - nPos = mPath.lastIndexOf ('/', nPos); - } - if (nPos != -1) - return mPath.copy (0, nPos + 1); - else - return rtl::OUString::createFromAscii ("/"); -} - void NeonUri::AppendPath (const rtl::OUString& rPath) { if (mPath.lastIndexOf ('/') != mPath.getLength () - 1) diff --git a/ucb/source/ucp/webdav/NeonUri.hxx b/ucb/source/ucp/webdav/NeonUri.hxx index c59f3d1da1ec..0ea848d4ae92 100644 --- a/ucb/source/ucp/webdav/NeonUri.hxx +++ b/ucb/source/ucp/webdav/NeonUri.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: NeonUri.hxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.22.1 $ * * This file is part of OpenOffice.org. * @@ -81,7 +81,6 @@ class NeonUri { return mPath; }; ::rtl::OUString GetPathBaseName ( void ) const; - ::rtl::OUString GetPathDirName ( void ) const; ::rtl::OUString GetPathBaseNameUnescaped ( void ) const; diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index 033a29d9335f..dff18a5f1d73 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -2129,9 +2129,6 @@ uno::Any Content::open( DAVResource aResource; std::vector< rtl::OUString > aHeaders; -// // Obtain list containing all HTTP headers that can -// // be mapped to UCB properties. -// ContentProperties::getMappableHTTPHeaders( aHeaders ); xResAccess->GET( xOut, aHeaders, aResource, xEnv ); m_bDidGetOrHead = true; @@ -2176,9 +2173,6 @@ uno::Any Content::open( // fill inputsream sync; return if all data present DAVResource aResource; std::vector< rtl::OUString > aHeaders; -// // Obtain list containing all HTTP headers that can -// // be mapped to UCB properties. -// ContentProperties::getMappableHTTPHeaders( aHeaders ); uno::Reference< io::XInputStream > xIn = xResAccess->GET( aHeaders, aResource, xEnv ); @@ -3194,11 +3188,16 @@ const Content::ResourceType & Content::getResourceType( } eResourceType = DAV; } - catch ( DAVException const& ) + catch ( DAVException const& e) { - //Fallback rResAccess->resetUri(); - eResourceType = NON_DAV; + + if (e.getStatus() == SC_METHOD_NOT_ALLOWED) + { + // Status SC_METHOD_NOT_ALLOWED is a safe indicator that the + // resource is NON_DAV + eResourceType = NON_DAV; + } } } m_eResourceType = eResourceType; diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx index 02e6a106fe64..861e48bdfcee 100644 --- a/ucb/source/ucp/webdav/webdavcontent.hxx +++ b/ucb/source/ucp/webdav/webdavcontent.hxx @@ -106,10 +106,6 @@ private: ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( ::com::sun::star::uno::Exception ); - void getProperties( const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment >& xEnv, - PropertyMap & rProps ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > getPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties, diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx index 12e9803d391c..305d509b4e2c 100644 --- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx +++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: webdavcontentcaps.cxx,v $ - * $Revision: 1.21 $ + * $Revision: 1.21.20.1 $ * * This file is part of OpenOffice.org. * @@ -524,17 +524,6 @@ uno::Sequence< beans::Property > Content::getProperties( } //========================================================================= -void Content::getProperties( - const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv, - PropertyMap & rProps ) -{ - uno::Sequence< beans::Property > aProps = getProperties( xEnv ); - sal_Int32 nCount = aProps.getLength(); - for ( sal_Int32 n = 0; n < nCount; ++n ) - rProps.insert( aProps[ n ] ); -} - -//========================================================================= // virtual uno::Sequence< com::sun::star::ucb::CommandInfo > Content::getCommands( const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv ) diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index ca5e13fa54c3..30a4d0f48c94 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -40,6 +40,7 @@ #include "com/sun/star/beans/XPropertyAccess.hpp" #include "com/sun/star/configuration/backend/MergeRecoveryRequest.hpp" #include "com/sun/star/configuration/backend/StratumCreationException.hpp" +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include "com/sun/star/container/XContainerQuery.hpp" #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/container/XNameContainer.hpp" @@ -59,6 +60,8 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/script/ModuleSizeExceededRequest.hpp" #include "com/sun/star/sync2/BadPartnershipException.hpp" +#include "com/sun/star/task/XInteractionHandler.hpp" +#include "com/sun/star/task/XInteractionHandler2.hpp" #include "com/sun/star/task/DocumentPasswordRequest.hpp" #include "com/sun/star/task/ErrorCodeIOException.hpp" #include "com/sun/star/task/ErrorCodeRequest.hpp" @@ -99,6 +102,7 @@ #include "com/sun/star/xforms/InvalidDataOnSubmitException.hpp" #include <com/sun/star/security/CertificateValidity.hpp> + #include "vos/mutex.hxx" #include "tools/rcid.h" #include "vcl/svapp.hxx" @@ -141,6 +145,9 @@ using ::com::sun::star::task::XInteractionApprove; using ::com::sun::star::task::XInteractionAskLater; using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest; + +#define CONFIG_INTERACTIONHANDLERS_KEY "/org.openoffice.ucb.InteractionHandler/InteractionHandlers" + namespace { class CookieList: public List @@ -526,7 +533,7 @@ UUIInteractionHelper::getStringFromRequest( return getStringFromRequest_impl(rRequest); } -void UUIInteractionHelper::handleMessageboxRequests( +bool UUIInteractionHelper::handleMessageboxRequests( star::uno::Reference< star::task::XInteractionRequest > const & rRequest, bool bObtainErrorStringOnly, bool & bHasErrorString, @@ -560,7 +567,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::ucb::NameClashException aNCException; @@ -582,7 +589,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::ucb::UnsupportedNameClashException aUORequest; @@ -608,7 +615,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bHasErrorString, rErrorString); } - return; + return true; } star::document::BrokenPackageRequest aBrokenPackageRequest; @@ -624,7 +631,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::ucb::InteractiveIOException aIoException; @@ -846,7 +853,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::ucb::InteractiveAppException aAppException; @@ -860,6 +867,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); + return true; } star::ucb::InteractiveNetworkException aNetworkException; @@ -905,7 +913,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::ucb::InteractiveCHAOSException aChaosException; @@ -928,7 +936,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::ucb::InteractiveWrongMediumException aWrongMediumException; @@ -945,7 +953,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::java::WrongJavaVersionException aWrongJavaVersionException; @@ -988,7 +996,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::sync2::BadPartnershipException aBadPartnershipException; @@ -1010,7 +1018,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::configuration::backend::MergeRecoveryRequest aMergeRecoveryRequest; @@ -1030,7 +1038,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::configuration::backend::StratumCreationException @@ -1054,7 +1062,7 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::xforms::InvalidDataOnSubmitException aInvalidDataOnSubmitException; @@ -1071,10 +1079,13 @@ void UUIInteractionHelper::handleMessageboxRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); + return true; } + + return false; } -void UUIInteractionHelper::handleDialogRequests( +bool UUIInteractionHelper::handleDialogRequests( star::uno::Reference< star::task::XInteractionRequest > const & rRequest) { star::uno::Any aAnyRequest(rRequest->getRequest()); @@ -1084,7 +1095,7 @@ void UUIInteractionHelper::handleDialogRequests( { handleAuthenticationRequest(aAuthenticationRequest, rRequest->getContinuations()); - return; + return true; } star::ucb::CertificateValidationRequest aCertificateValidationRequest; @@ -1092,7 +1103,7 @@ void UUIInteractionHelper::handleDialogRequests( { handleCertificateValidationRequest(aCertificateValidationRequest, rRequest->getContinuations()); - return; + return true; } // @@@ Todo #i29340#: activate! @@ -1109,7 +1120,7 @@ void UUIInteractionHelper::handleDialogRequests( { handleMasterPasswordRequest(aMasterPasswordRequest.Mode, rRequest->getContinuations()); - return; + return true; } star::task::DocumentPasswordRequest aDocumentPasswordRequest; @@ -1118,7 +1129,7 @@ void UUIInteractionHelper::handleDialogRequests( handlePasswordRequest(aDocumentPasswordRequest.Mode, rRequest->getContinuations(), aDocumentPasswordRequest.Name); - return; + return true; } star::task::PasswordRequest aPasswordRequest; @@ -1126,7 +1137,7 @@ void UUIInteractionHelper::handleDialogRequests( { handlePasswordRequest(aPasswordRequest.Mode, rRequest->getContinuations()); - return; + return true; } star::ucb::HandleCookiesRequest aCookiesRequest; @@ -1134,7 +1145,7 @@ void UUIInteractionHelper::handleDialogRequests( { handleCookiesRequest(aCookiesRequest, rRequest->getContinuations()); - return; + return true; } star::document::NoSuchFilterRequest aNoSuchFilterRequest; @@ -1142,7 +1153,7 @@ void UUIInteractionHelper::handleDialogRequests( { handleNoSuchFilterRequest(aNoSuchFilterRequest, rRequest->getContinuations()); - return; + return true; } star::document::AmbigousFilterRequest aAmbigousFilterRequest; @@ -1150,7 +1161,7 @@ void UUIInteractionHelper::handleDialogRequests( { handleAmbigousFilterRequest(aAmbigousFilterRequest, rRequest->getContinuations()); - return; + return true; } star::document::FilterOptionsRequest aFilterOptionsRequest; @@ -1158,7 +1169,7 @@ void UUIInteractionHelper::handleDialogRequests( { handleFilterOptionsRequest(aFilterOptionsRequest, rRequest->getContinuations()); - return; + return true; } star::document::LockedDocumentRequest aLockedDocumentRequest; @@ -1168,7 +1179,7 @@ void UUIInteractionHelper::handleDialogRequests( aLockedDocumentRequest.UserInfo, rRequest->getContinuations(), UUI_DOC_LOAD_LOCK ); - return; + return true; } star::document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest; @@ -1178,7 +1189,7 @@ void UUIInteractionHelper::handleDialogRequests( aOwnLockOnDocumentRequest.TimeInfo, rRequest->getContinuations(), aOwnLockOnDocumentRequest.IsStoring ? UUI_DOC_OWN_SAVE_LOCK : UUI_DOC_OWN_LOAD_LOCK ); - return; + return true; } star::document::LockedOnSavingRequest aLockedOnSavingRequest; @@ -1188,25 +1199,27 @@ void UUIInteractionHelper::handleDialogRequests( aLockedOnSavingRequest.UserInfo, rRequest->getContinuations(), UUI_DOC_SAVE_LOCK ); - return; + return true; } star::document::ChangedByOthersRequest aChangedByOthersRequest; if (aAnyRequest >>= aChangedByOthersRequest ) { handleChangedByOthersRequest( rRequest->getContinuations() ); - return; + return true; } star::document::LockFileIgnoreRequest aLockFileIgnoreRequest; if (aAnyRequest >>= aLockFileIgnoreRequest ) { handleLockFileIgnoreRequest( rRequest->getContinuations() ); - return; + return true; } + + return false; } -void UUIInteractionHelper::handleErrorHandlerRequests( +bool UUIInteractionHelper::handleErrorHandlerRequests( star::uno::Reference< star::task::XInteractionRequest > const & rRequest, bool bObtainErrorStringOnly, bool & bHasErrorString, @@ -1222,7 +1235,7 @@ void UUIInteractionHelper::handleErrorHandlerRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } star::task::DocumentMacroConfirmationRequest aMacroConfirmRequest; @@ -1232,7 +1245,7 @@ void UUIInteractionHelper::handleErrorHandlerRequests( aMacroConfirmRequest, rRequest->getContinuations() ); - return; + return true; } FutureDocumentVersionProductUpdateRequest aProductUpdateRequest; @@ -1242,7 +1255,7 @@ void UUIInteractionHelper::handleErrorHandlerRequests( aProductUpdateRequest, rRequest->getContinuations() ); - return; + return true; } star::task::ErrorCodeIOException aErrorCodeIOException; @@ -1253,8 +1266,10 @@ void UUIInteractionHelper::handleErrorHandlerRequests( bObtainErrorStringOnly, bHasErrorString, rErrorString); - return; + return true; } + + return false; } void @@ -1272,17 +1287,43 @@ UUIInteractionHelper::handle_impl( //////////////////////////////////////////////////////////// bool bDummy = false; rtl::OUString aDummy; - handleMessageboxRequests(rRequest, false, bDummy, aDummy); + if (! handleMessageboxRequests(rRequest, false, bDummy, aDummy)) + { + //////////////////////////////////////////////////////////// + // Use ErrorHandler::HandleError + //////////////////////////////////////////////////////////// + if (!handleErrorHandlerRequests(rRequest, false, bDummy, aDummy)) + { + //////////////////////////////////////////////////////////// + // Display Special Dialog + //////////////////////////////////////////////////////////// + if (!handleDialogRequests(rRequest)) + { + //////////////////////////////////////////////////////////// + // Use customized InteractionHandler from configuration + //////////////////////////////////////////////////////////// + InteractionHandlerDataList dataList; - //////////////////////////////////////////////////////////// - // Use ErrorHandler::HandleError - //////////////////////////////////////////////////////////// - handleErrorHandlerRequests(rRequest, false, bDummy, aDummy); + GetInteractionHandlerList(dataList); - //////////////////////////////////////////////////////////// - // Display Special Dialog - //////////////////////////////////////////////////////////// - handleDialogRequests(rRequest); + InteractionHandlerDataList::const_iterator aEnd(dataList.end()); + for (InteractionHandlerDataList::const_iterator aIt(dataList.begin()); + aIt != aEnd; ++aIt) + { + Reference< uno::XInterface > xIfc = + m_xServiceFactory->createInstance(aIt->ServiceName); + + Reference< com::sun::star::task::XInteractionHandler2 > xInteractionHandler = + Reference< com::sun::star::task::XInteractionHandler2 >( xIfc, UNO_QUERY ); + + OSL_ENSURE( xInteractionHandler.is(), "Custom Interactionhandler does not implement mandatory interface XInteractionHandler2!" ); + if (xInteractionHandler.is()) + if (xInteractionHandler->handleInteractionRequest(rRequest)) + break; + } + } + } + } } catch (std::bad_alloc const &) { @@ -1292,6 +1333,113 @@ UUIInteractionHelper::handle_impl( } } +void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList &rdataList) +{ + uno::Reference< lang::XMultiServiceFactory > xConfigProv( + m_xServiceFactory->createInstance( + rtl::OUString::createFromAscii( + "com.sun.star.configuration.ConfigurationProvider" ) ), + uno::UNO_QUERY ); + + if ( !xConfigProv.is() ) + { + OSL_ENSURE( false, + "GetInteractionHandlerList - No config provider!" ); + return; + } + + rtl::OUStringBuffer aFullPath; + aFullPath.appendAscii( CONFIG_INTERACTIONHANDLERS_KEY ); + + uno::Sequence< uno::Any > aArguments( 1 ); + beans::PropertyValue aProperty; + aProperty.Name + = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + aProperty.Value <<= aFullPath.makeStringAndClear(); + aArguments[ 0 ] <<= aProperty; + + uno::Reference< uno::XInterface > xInterface( + xConfigProv->createInstanceWithArguments( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" ) ), + aArguments ) ); + + if ( !xInterface.is() ) + { + OSL_ENSURE( false, + "GetInteractionHandlerList - No config access!" ); + return; + } + + uno::Reference< container::XNameAccess > xNameAccess( + xInterface, uno::UNO_QUERY ); + + if ( !xNameAccess.is() ) + { + OSL_ENSURE( false, + "GetInteractionHandlerList - No XNameAccess!" ); + return; + } + + uno::Sequence< rtl::OUString > aElems = xNameAccess->getElementNames(); + const rtl::OUString* pElems = aElems.getConstArray(); + sal_Int32 nCount = aElems.getLength(); + + if ( nCount > 0 ) + { + uno::Reference< container::XHierarchicalNameAccess > + xHierNameAccess( xInterface, uno::UNO_QUERY ); + + if ( !xHierNameAccess.is() ) + { + OSL_ENSURE( false, + "GetInteractionHandlerList - " + "No XHierarchicalNameAccess!" ); + return; + } + + // Iterate over children. + for ( sal_Int32 n = 0; n < nCount; ++n ) + { + rtl::OUStringBuffer aElemBuffer; + aElemBuffer.appendAscii( "['" ); + aElemBuffer.append( pElems[ n ] ); + + try + { + InteractionHandlerData aInfo; + + // Obtain service name. + rtl::OUStringBuffer aKeyBuffer = aElemBuffer; + aKeyBuffer.appendAscii( "']/ServiceName" ); + + rtl::OUString aValue; + if ( !( xHierNameAccess->getByHierarchicalName( + aKeyBuffer.makeStringAndClear() ) >>= aValue ) ) + { + OSL_ENSURE( false, + "GetInteractionHandlerList - " + "Error getting item value!" ); + continue; + } + + aInfo.ServiceName = aValue; + + // Append info to list. + rdataList.push_back( aInfo ); + } + catch ( container::NoSuchElementException& ) + { + // getByHierarchicalName + + OSL_ENSURE( false, + "GetInteractionHandlerList - " + "caught NoSuchElementException!" ); + } + } + } +} + Window * UUIInteractionHelper::getParentProperty() SAL_THROW(()) { osl::MutexGuard aGuard(m_aPropertyMutex); diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index b3257688cb8c..8b53b071a629 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -65,6 +65,22 @@ struct CntHTTPCookieRequest; #define UUI_DOC_SAVE_LOCK 2 #define UUI_DOC_OWN_SAVE_LOCK 3 +//============================================================================ +/** Information about a InteractionHandler + */ +struct InteractionHandlerData +{ + /** The UNO service name to use to instanciate the content provider. + */ + rtl::OUString ServiceName; + + InteractionHandlerData() {}; + InteractionHandlerData( const rtl::OUString & rService) + : ServiceName( rService ){} +}; + +typedef std::vector< InteractionHandlerData > InteractionHandlerDataList; + namespace cssu = com::sun::star::uno; namespace dcss = ::com::sun::star; @@ -139,6 +155,8 @@ private: rRequest) throw (com::sun::star::uno::RuntimeException); + void + GetInteractionHandlerList(InteractionHandlerDataList &rdataList); sal_Bool isDomainMatch( rtl::OUString hostName, rtl::OUString certHostName); @@ -356,7 +374,7 @@ private: rtl::OUString & rErrorString) SAL_THROW((::com::sun::star::uno::RuntimeException)); - void handleMessageboxRequests( + bool handleMessageboxRequests( ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest, @@ -364,12 +382,12 @@ private: bool & bHasErrorString, rtl::OUString & rErrorString); - void handleDialogRequests( + bool handleDialogRequests( ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest); - void handleErrorHandlerRequests( + bool handleErrorHandlerRequests( ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest, diff --git a/uui/source/masterpasscrtdlg.cxx b/uui/source/masterpasscrtdlg.cxx index d8844381f7a8..2c20991bdc59 100644 --- a/uui/source/masterpasscrtdlg.cxx +++ b/uui/source/masterpasscrtdlg.cxx @@ -115,9 +115,12 @@ MasterPasswordCreateDialog::MasterPasswordCreateDialog Rectangle aRect = aFTMasterPasswordWarning.GetTextRect( aLabelRect, aFTMasterPasswordWarning.GetText() ); long nNewLabelHeight = 0; - for( nNewLabelHeight = ( nTextWidth / nLableWidth + 1 ) * nTextHeight; - nNewLabelHeight < aRect.GetHeight(); - nNewLabelHeight += nTextHeight ) ; + if ( nTextWidth > 0 ) + { + for( nNewLabelHeight = ( nTextWidth / nLableWidth + 1 ) * nTextHeight; + nNewLabelHeight < aRect.GetHeight(); + nNewLabelHeight += nTextHeight ); + } long nDelta = nNewLabelHeight - nLabelHeight; Size aNewDlgSize = GetSizePixel(); diff --git a/xmlhelp/prj/build.lst b/xmlhelp/prj/build.lst index c8f5eb1602c3..b360e5f763ee 100644 --- a/xmlhelp/prj/build.lst +++ b/xmlhelp/prj/build.lst @@ -5,6 +5,5 @@ xh xmlhelp\source\treeview nmake - all xh_treeview xh_inc NULL xh xmlhelp\source\com\sun\star\help nmake - all xh_help xh_inc NULL xh xmlhelp\source\cxxhelp\util nmake - all xh_cutil xh_inc NULL xh xmlhelp\source\cxxhelp\qe nmake - all xh_qe xh_inc NULL -xh xmlhelp\source\cxxhelp\db nmake - all xh_db xh_inc NULL xh xmlhelp\source\cxxhelp\provider nmake - all xh_provider xh_inc NULL -xh xmlhelp\util nmake - all xh_util xh_cutil xh_qe xh_db xh_provider NULL +xh xmlhelp\util nmake - all xh_util xh_cutil xh_qe xh_provider NULL diff --git a/xmlhelp/source/com/sun/star/help/HelpCompiler.cxx b/xmlhelp/source/com/sun/star/help/HelpCompiler.cxx index 879052117fca..5001d0907972 100644 --- a/xmlhelp/source/com/sun/star/help/HelpCompiler.cxx +++ b/xmlhelp/source/com/sun/star/help/HelpCompiler.cxx @@ -41,6 +41,16 @@ #include <tools/prewin.h> #include <tools/postwin.h> #endif +#include <osl/thread.hxx> + +static void impl_sleep( sal_uInt32 nSec ) +{ + TimeValue aTime; + aTime.Seconds = nSec; + aTime.Nanosec = 0; + + osl::Thread::wait( aTime ); +} HelpCompiler::HelpCompiler(StreamTable &in_streamTable, const fs::path &in_inputFile, const fs::path &in_src, const fs::path &in_resEmbStylesheet, @@ -62,11 +72,7 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath) { res = xmlParseFile(filePath.native_file_string().c_str()); if( !res ){ -#if defined(UNX) || defined(OS2) - sleep( 3 ); -#else - Sleep( 3 ); -#endif + impl_sleep( 3 ); res = xmlParseFile(filePath.native_file_string().c_str()); } } @@ -91,11 +97,7 @@ xmlDocPtr HelpCompiler::getSourceDocument(const fs::path &filePath) xmlDocPtr doc = xmlParseFile(filePath.native_file_string().c_str()); if( !doc ) { -#if defined(UNX) || defined(OS2) - sleep( 3 ); -#else - Sleep( 3 ); -#endif + impl_sleep( 3 ); doc = xmlParseFile(filePath.native_file_string().c_str()); } @@ -416,11 +418,7 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException ) // resolve the dom if (!docResolvedOrg) { -#if defined(UNX) || defined(OS2) - sleep( 3 ); -#else - Sleep( 3 ); -#endif + impl_sleep( 3 ); docResolvedOrg = getSourceDocument(inputFile); if( !docResolvedOrg ) { diff --git a/xmlhelp/source/com/sun/star/help/HelpComponent.java b/xmlhelp/source/com/sun/star/help/HelpComponent.java index 35c856ec5788..481605cb2984 100755 --- a/xmlhelp/source/com/sun/star/help/HelpComponent.java +++ b/xmlhelp/source/com/sun/star/help/HelpComponent.java @@ -1,138 +1,138 @@ -/*************************************************************************
- *
- * 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: HelpSearch.java,v $
- * $Revision: 1.2 $
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.help;
-
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.registry.XRegistryKey;
-
-/*
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XMultiComponentFactory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.lib.uno.helper.WeakBase;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.Any;
-import com.sun.star.uno.AnyConverter;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.FilterIndexReader;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Searcher;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.WildcardQuery;
-
-import com.sun.star.script.XInvocation;
-import com.sun.star.beans.XIntrospectionAccess;
-
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.io.File;
-*/
-
-/** This class capsulates the class, that implements the minimal component, a
- * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a
- * method, that writes the information into the given registry key
- * (<CODE>__writeRegistryServiceInfo</CODE>).
- */
-public class HelpComponent
-{
- /**
- * Gives a factory for creating the service.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns a <code>XSingleComponentFactory</code> for creating
- * the component
- * @param sImplName the name of the implementation for which a
- * service is desired
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static XSingleComponentFactory __getComponentFactory(String sImplName)
- {
- XSingleComponentFactory xFactory = null;
-
- if ( sImplName.equals( HelpSearch._HelpSearch.class.getName() ) )
- xFactory = Factory.createComponentFactory(HelpSearch._HelpSearch.class,
- HelpSearch._HelpSearch.getServiceNames());
- else if ( sImplName.equals( HelpIndexer.class.getName() ) )
- xFactory = Factory.createComponentFactory(HelpIndexer.class,
- HelpIndexer.getServiceNames());
- return xFactory;
- }
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey)
- {
- boolean bSuccessHelpSearch = Factory.writeRegistryServiceInfo
- (HelpSearch._HelpSearch.class.getName(),
- HelpSearch._HelpSearch.getServiceNames(), regKey);
- boolean bSuccessHelpIndexer = Factory.writeRegistryServiceInfo
- (HelpIndexer.class.getName(),
- HelpIndexer.getServiceNames(), regKey);
-
- return bSuccessHelpSearch && bSuccessHelpIndexer;
- }
- /** This method is a member of the interface for initializing an object
- * directly after its creation.
- * @param object This array of arbitrary objects will be passed to the
- * component after its creation.
- * @throws Exception Every exception will not be handled, but will be
- * passed to the caller.
- */
- public void initialize( Object[] object )
- throws com.sun.star.uno.Exception
- {
- /* The component describes what arguments its expected and in which
- * order!At this point you can read the objects and can intialize
- * your component using these objects.
- */
- }
-}
+/************************************************************************* + * + * 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: HelpSearch.java,v $ + * $Revision: 1.2 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.help; + +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.registry.XRegistryKey; + +/* +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.Type; +import com.sun.star.uno.Any; +import com.sun.star.uno.AnyConverter; + +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.FilterIndexReader; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.Term; +import org.apache.lucene.queryParser.QueryParser; +import org.apache.lucene.search.Hits; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Searcher; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.WildcardQuery; + +import com.sun.star.script.XInvocation; +import com.sun.star.beans.XIntrospectionAccess; + +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.io.File; +*/ + +/** This class capsulates the class, that implements the minimal component, a + * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a + * method, that writes the information into the given registry key + * (<CODE>__writeRegistryServiceInfo</CODE>). + */ +public class HelpComponent +{ + /** + * Gives a factory for creating the service. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns a <code>XSingleComponentFactory</code> for creating + * the component + * @param sImplName the name of the implementation for which a + * service is desired + * @see com.sun.star.comp.loader.JavaLoader + */ + public static XSingleComponentFactory __getComponentFactory(String sImplName) + { + XSingleComponentFactory xFactory = null; + + if ( sImplName.equals( HelpSearch._HelpSearch.class.getName() ) ) + xFactory = Factory.createComponentFactory(HelpSearch._HelpSearch.class, + HelpSearch._HelpSearch.getServiceNames()); + else if ( sImplName.equals( HelpIndexer.class.getName() ) ) + xFactory = Factory.createComponentFactory(HelpIndexer.class, + HelpIndexer.getServiceNames()); + return xFactory; + } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) + { + boolean bSuccessHelpSearch = Factory.writeRegistryServiceInfo + (HelpSearch._HelpSearch.class.getName(), + HelpSearch._HelpSearch.getServiceNames(), regKey); + boolean bSuccessHelpIndexer = Factory.writeRegistryServiceInfo + (HelpIndexer.class.getName(), + HelpIndexer.getServiceNames(), regKey); + + return bSuccessHelpSearch && bSuccessHelpIndexer; + } + /** This method is a member of the interface for initializing an object + * directly after its creation. + * @param object This array of arbitrary objects will be passed to the + * component after its creation. + * @throws Exception Every exception will not be handled, but will be + * passed to the caller. + */ + public void initialize( Object[] object ) + throws com.sun.star.uno.Exception + { + /* The component describes what arguments its expected and in which + * order!At this point you can read the objects and can intialize + * your component using these objects. + */ + } +} diff --git a/xmlhelp/source/com/sun/star/help/HelpSearch.java b/xmlhelp/source/com/sun/star/help/HelpSearch.java index e52dd2db7d83..9200702fb5a9 100644 --- a/xmlhelp/source/com/sun/star/help/HelpSearch.java +++ b/xmlhelp/source/com/sun/star/help/HelpSearch.java @@ -1,351 +1,351 @@ -/*************************************************************************
- *
- * 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: HelpSearch.java,v $
- * $Revision: 1.3 $
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.help;
-
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XMultiComponentFactory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.lib.uno.helper.WeakBase;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.Any;
-import com.sun.star.uno.AnyConverter;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.analysis.cjk.CJKAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.FilterIndexReader;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Searcher;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.WildcardQuery;
-
-import com.sun.star.script.XInvocation;
-import com.sun.star.beans.XIntrospectionAccess;
-
-/** This class capsulates the class, that implements the minimal component, a
- * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a
- * method, that writes the information into the given registry key
- * (<CODE>__writeRegistryServiceInfo</CODE>).
- */
-public class HelpSearch
-{
- /** This class implements the component. At least the interfaces XServiceInfo,
- * XTypeProvider, and XInitialization should be provided by the service.
- */
- public static class _HelpSearch extends WeakBase
- implements XServiceInfo, XInvocation
- {
- /** The service name, that must be used to get an instance of this service.
- */
- static private final String __serviceName =
- "com.sun.star.help.HelpSearch";
- static private final String aSearchMethodName = "search";
-
- /** The initial component contextr, that gives access to
- * the service manager, supported singletons, ...
- * It's often later used
- */
- private XComponentContext m_cmpCtx;
-
- /** The service manager, that gives access to all registered services.
- * It's often later used
- */
- private XMultiComponentFactory m_xMCF;
-
- /** The constructor of the inner class has a XMultiServiceFactory parameter.
- * @param xmultiservicefactoryInitialization A special service factory
- * could be introduced while initializing.
- */
- public _HelpSearch(XComponentContext xCompContext)
- {
- try {
- m_cmpCtx = xCompContext;
- m_xMCF = m_cmpCtx.getServiceManager();
- }
- catch( Exception e ) {
- e.printStackTrace();
- }
- }
-
- /** This method returns an array of all supported service names.
- * @return Array of supported service names.
- */
- public String[] getSupportedServiceNames()
- {
- return getServiceNames();
- }
-
- /** This method is a simple helper function to used in the
- * static component initialisation functions as well as in
- * getSupportedServiceNames.
- */
- public static String[] getServiceNames()
- {
- String[] sSupportedServiceNames = { __serviceName };
- return sSupportedServiceNames;
- }
-
- /** This method returns true, if the given service will be
- * supported by the component.
- * @param sServiceName Service name.
- * @return True, if the given service name will be supported.
- */
- public boolean supportsService( String sServiceName )
- {
- return sServiceName.equals( __serviceName );
- }
-
- /** Return the class name of the component.
- * @return Class name of the component.
- */
- public String getImplementationName()
- {
- return _HelpSearch.class.getName();
- }
-
- //===================================================
- // XInvocation
- public XIntrospectionAccess getIntrospection()
- {
- return null;
- }
-
- public Object invoke( String aFunctionName, java.lang.Object[] aParams,
- short[][] aOutParamIndex, java.lang.Object[][] aOutParam )
- throws com.sun.star.lang.IllegalArgumentException,
- com.sun.star.script.CannotConvertException,
- com.sun.star.reflection.InvocationTargetException
- {
- String[] aRet = null;
- if( !aFunctionName.equals( aSearchMethodName ) )
- throw new com.sun.star.lang.IllegalArgumentException();
-
- Object[] aScoreOutArray = new Object[1];
- aScoreOutArray[0] = null;
- try
- {
- aRet = doQuery( aParams, aScoreOutArray );
- }
- catch( Exception e )
- {
- aRet = null;
- }
-
- Object aScoreArray = aScoreOutArray[0];
- if( aScoreArray == null )
- {
- aOutParamIndex[0] = new short[0];
- aOutParam[0] = new Object[0];
- }
- else
- {
- short nInParamCount = (short)aParams.length;
- aOutParamIndex[0] = new short[1];
- aOutParamIndex[0][0] = nInParamCount;
- aOutParam[0] = new Object[1];
- aOutParam[0][0] = aScoreArray;
- }
-
- Any aRetAny = new Any( new Type( String[].class ), aRet );
- return aRetAny;
- }
-
- public void setValue( String aPropertyName, java.lang.Object aValue )
- throws com.sun.star.beans.UnknownPropertyException,
- com.sun.star.script.CannotConvertException,
- com.sun.star.reflection.InvocationTargetException {
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public Object getValue( String aPropertyName )
- throws com.sun.star.beans.UnknownPropertyException {
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public boolean hasMethod( String aMethodName ) {
- boolean bRet = (aMethodName.equals( aSearchMethodName ) );
- return bRet;
- }
- public boolean hasProperty( String aName ) {
- return false;
- }
-
- // Command line interface for testing
- private static String[] doQuery( Object[] args, Object[] aScoreOutArray ) throws Exception
- {
- String aLanguageStr = "";
- String aIndexStr = "";
- String aQueryStr = "";
- boolean bCaptionOnly = false;
-
- int nParamCount = args.length;
- String aStrs[] = new String[nParamCount];
- for( int i = 0 ; i < nParamCount ; i++ )
- {
- try
- {
- aStrs[i] = AnyConverter.toString( args[i] );
- }
- catch( IllegalArgumentException e )
- {
- aStrs[i] = "";
- }
- }
-
- // TODO: Error handling
- for( int i = 0 ; i < nParamCount ; i++ )
- {
- if ("-lang".equals(aStrs[i]) )
- {
- aLanguageStr = aStrs[i + 1];
- i++;
- }
- else if( "-index".equals(aStrs[i]) )
- {
- aIndexStr = aStrs[i+1];
- i++;
- }
- else if( "-query".equals(aStrs[i]) )
- {
- aQueryStr = aStrs[i+1];
- i++;
- }
- else if( "-caption".equals(aStrs[i]) )
- {
- bCaptionOnly = true;
- }
- }
- String[] aDocs = queryImpl( aLanguageStr, aIndexStr, aQueryStr, bCaptionOnly, aScoreOutArray );
-
- return aDocs;
- }
-
- private static String[] queryImpl( String aLanguageStr, String aIndexStr, String aQueryStr,
- boolean bCaptionOnly, Object[] aScoreOutArray ) throws Exception
- {
- IndexReader reader = IndexReader.open( aIndexStr );
- Searcher searcher = new IndexSearcher( reader );
- Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer() : (Analyzer)new StandardAnalyzer();
-
- String aField;
- if( bCaptionOnly )
- aField = "caption";
- else
- aField = "content";
-
- Query aQuery;
- if( aQueryStr.endsWith( "*" ) )
- aQuery = new WildcardQuery( new Term( aField, aQueryStr ) );
- else
- aQuery = new TermQuery( new Term( aField, aQueryStr ) );
-
- // Perform search
- Hits aHits = searcher.search( aQuery );
- int nHitCount = aHits.length();
-
- String aDocs[] = new String[nHitCount];
- float aScores[] = null;
- aScores = new float[nHitCount];
- for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
- {
- Document aDoc = aHits.doc( iHit );
- String aPath = aDoc.get( "path" );
- aDocs[iHit] = ( aPath != null ) ? aPath : "";
- aScores[iHit] = aHits.score( iHit );
- }
- aScoreOutArray[0] = aScores;
-
- reader.close();
-
- return aDocs;
- }
- }
-
- /**
- * Gives a factory for creating the service.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns a <code>XSingleComponentFactory</code> for creating
- * the component
- * @param sImplName the name of the implementation for which a
- * service is desired
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static XSingleComponentFactory __getComponentFactory(String sImplName)
- {
- XSingleComponentFactory xFactory = null;
-
- if ( sImplName.equals( _HelpSearch.class.getName() ) )
- xFactory = Factory.createComponentFactory(_HelpSearch.class,
- _HelpSearch.getServiceNames());
-
- return xFactory;
- }
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return Factory.writeRegistryServiceInfo(_HelpSearch.class.getName(),
- _HelpSearch.getServiceNames(),
- regKey);
- }
- /** This method is a member of the interface for initializing an object
- * directly after its creation.
- * @param object This array of arbitrary objects will be passed to the
- * component after its creation.
- * @throws Exception Every exception will not be handled, but will be
- * passed to the caller.
- */
- public void initialize( Object[] object )
- throws com.sun.star.uno.Exception {
- /* The component describes what arguments its expected and in which
- * order!At this point you can read the objects and can intialize
- * your component using these objects.
- */
- }
-}
+/************************************************************************* + * + * 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: HelpSearch.java,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +package com.sun.star.help; + +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.Type; +import com.sun.star.uno.Any; +import com.sun.star.uno.AnyConverter; + +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis.cjk.CJKAnalyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.FilterIndexReader; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.Term; +import org.apache.lucene.search.Hits; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Searcher; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.WildcardQuery; + +import com.sun.star.script.XInvocation; +import com.sun.star.beans.XIntrospectionAccess; + +/** This class capsulates the class, that implements the minimal component, a + * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a + * method, that writes the information into the given registry key + * (<CODE>__writeRegistryServiceInfo</CODE>). + */ +public class HelpSearch +{ + /** This class implements the component. At least the interfaces XServiceInfo, + * XTypeProvider, and XInitialization should be provided by the service. + */ + public static class _HelpSearch extends WeakBase + implements XServiceInfo, XInvocation + { + /** The service name, that must be used to get an instance of this service. + */ + static private final String __serviceName = + "com.sun.star.help.HelpSearch"; + static private final String aSearchMethodName = "search"; + + /** The initial component contextr, that gives access to + * the service manager, supported singletons, ... + * It's often later used + */ + private XComponentContext m_cmpCtx; + + /** The service manager, that gives access to all registered services. + * It's often later used + */ + private XMultiComponentFactory m_xMCF; + + /** The constructor of the inner class has a XMultiServiceFactory parameter. + * @param xmultiservicefactoryInitialization A special service factory + * could be introduced while initializing. + */ + public _HelpSearch(XComponentContext xCompContext) + { + try { + m_cmpCtx = xCompContext; + m_xMCF = m_cmpCtx.getServiceManager(); + } + catch( Exception e ) { + e.printStackTrace(); + } + } + + /** This method returns an array of all supported service names. + * @return Array of supported service names. + */ + public String[] getSupportedServiceNames() + { + return getServiceNames(); + } + + /** This method is a simple helper function to used in the + * static component initialisation functions as well as in + * getSupportedServiceNames. + */ + public static String[] getServiceNames() + { + String[] sSupportedServiceNames = { __serviceName }; + return sSupportedServiceNames; + } + + /** This method returns true, if the given service will be + * supported by the component. + * @param sServiceName Service name. + * @return True, if the given service name will be supported. + */ + public boolean supportsService( String sServiceName ) + { + return sServiceName.equals( __serviceName ); + } + + /** Return the class name of the component. + * @return Class name of the component. + */ + public String getImplementationName() + { + return _HelpSearch.class.getName(); + } + + //=================================================== + // XInvocation + public XIntrospectionAccess getIntrospection() + { + return null; + } + + public Object invoke( String aFunctionName, java.lang.Object[] aParams, + short[][] aOutParamIndex, java.lang.Object[][] aOutParam ) + throws com.sun.star.lang.IllegalArgumentException, + com.sun.star.script.CannotConvertException, + com.sun.star.reflection.InvocationTargetException + { + String[] aRet = null; + if( !aFunctionName.equals( aSearchMethodName ) ) + throw new com.sun.star.lang.IllegalArgumentException(); + + Object[] aScoreOutArray = new Object[1]; + aScoreOutArray[0] = null; + try + { + aRet = doQuery( aParams, aScoreOutArray ); + } + catch( Exception e ) + { + aRet = null; + } + + Object aScoreArray = aScoreOutArray[0]; + if( aScoreArray == null ) + { + aOutParamIndex[0] = new short[0]; + aOutParam[0] = new Object[0]; + } + else + { + short nInParamCount = (short)aParams.length; + aOutParamIndex[0] = new short[1]; + aOutParamIndex[0][0] = nInParamCount; + aOutParam[0] = new Object[1]; + aOutParam[0][0] = aScoreArray; + } + + Any aRetAny = new Any( new Type( String[].class ), aRet ); + return aRetAny; + } + + public void setValue( String aPropertyName, java.lang.Object aValue ) + throws com.sun.star.beans.UnknownPropertyException, + com.sun.star.script.CannotConvertException, + com.sun.star.reflection.InvocationTargetException { + throw new com.sun.star.beans.UnknownPropertyException(); + } + + public Object getValue( String aPropertyName ) + throws com.sun.star.beans.UnknownPropertyException { + throw new com.sun.star.beans.UnknownPropertyException(); + } + + public boolean hasMethod( String aMethodName ) { + boolean bRet = (aMethodName.equals( aSearchMethodName ) ); + return bRet; + } + public boolean hasProperty( String aName ) { + return false; + } + + // Command line interface for testing + private static String[] doQuery( Object[] args, Object[] aScoreOutArray ) throws Exception + { + String aLanguageStr = ""; + String aIndexStr = ""; + String aQueryStr = ""; + boolean bCaptionOnly = false; + + int nParamCount = args.length; + String aStrs[] = new String[nParamCount]; + for( int i = 0 ; i < nParamCount ; i++ ) + { + try + { + aStrs[i] = AnyConverter.toString( args[i] ); + } + catch( IllegalArgumentException e ) + { + aStrs[i] = ""; + } + } + + // TODO: Error handling + for( int i = 0 ; i < nParamCount ; i++ ) + { + if ("-lang".equals(aStrs[i]) ) + { + aLanguageStr = aStrs[i + 1]; + i++; + } + else if( "-index".equals(aStrs[i]) ) + { + aIndexStr = aStrs[i+1]; + i++; + } + else if( "-query".equals(aStrs[i]) ) + { + aQueryStr = aStrs[i+1]; + i++; + } + else if( "-caption".equals(aStrs[i]) ) + { + bCaptionOnly = true; + } + } + String[] aDocs = queryImpl( aLanguageStr, aIndexStr, aQueryStr, bCaptionOnly, aScoreOutArray ); + + return aDocs; + } + + private static String[] queryImpl( String aLanguageStr, String aIndexStr, String aQueryStr, + boolean bCaptionOnly, Object[] aScoreOutArray ) throws Exception + { + IndexReader reader = IndexReader.open( aIndexStr ); + Searcher searcher = new IndexSearcher( reader ); + Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer() : (Analyzer)new StandardAnalyzer(); + + String aField; + if( bCaptionOnly ) + aField = "caption"; + else + aField = "content"; + + Query aQuery; + if( aQueryStr.endsWith( "*" ) ) + aQuery = new WildcardQuery( new Term( aField, aQueryStr ) ); + else + aQuery = new TermQuery( new Term( aField, aQueryStr ) ); + + // Perform search + Hits aHits = searcher.search( aQuery ); + int nHitCount = aHits.length(); + + String aDocs[] = new String[nHitCount]; + float aScores[] = null; + aScores = new float[nHitCount]; + for( int iHit = 0 ; iHit < nHitCount ; iHit++ ) + { + Document aDoc = aHits.doc( iHit ); + String aPath = aDoc.get( "path" ); + aDocs[iHit] = ( aPath != null ) ? aPath : ""; + aScores[iHit] = aHits.score( iHit ); + } + aScoreOutArray[0] = aScores; + + reader.close(); + + return aDocs; + } + } + + /** + * Gives a factory for creating the service. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns a <code>XSingleComponentFactory</code> for creating + * the component + * @param sImplName the name of the implementation for which a + * service is desired + * @see com.sun.star.comp.loader.JavaLoader + */ + public static XSingleComponentFactory __getComponentFactory(String sImplName) + { + XSingleComponentFactory xFactory = null; + + if ( sImplName.equals( _HelpSearch.class.getName() ) ) + xFactory = Factory.createComponentFactory(_HelpSearch.class, + _HelpSearch.getServiceNames()); + + return xFactory; + } + + /** + * Writes the service information into the given registry key. + * This method is called by the <code>JavaLoader</code> + * <p> + * @return returns true if the operation succeeded + * @param regKey the registryKey + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { + return Factory.writeRegistryServiceInfo(_HelpSearch.class.getName(), + _HelpSearch.getServiceNames(), + regKey); + } + /** This method is a member of the interface for initializing an object + * directly after its creation. + * @param object This array of arbitrary objects will be passed to the + * component after its creation. + * @throws Exception Every exception will not be handled, but will be + * passed to the caller. + */ + public void initialize( Object[] object ) + throws com.sun.star.uno.Exception { + /* The component describes what arguments its expected and in which + * order!At this point you can read the objects and can intialize + * your component using these objects. + */ + } +} diff --git a/xmlhelp/source/com/sun/star/help/makefile.mk b/xmlhelp/source/com/sun/star/help/makefile.mk index 730121fd7168..c30b36bea8a5 100644 --- a/xmlhelp/source/com/sun/star/help/makefile.mk +++ b/xmlhelp/source/com/sun/star/help/makefile.mk @@ -82,6 +82,7 @@ APP1TARGET= $(TARGET) APP1OBJS=\ $(OBJ)$/HelpLinker.obj \ $(OBJ)$/HelpCompiler.obj +APP1RPATH=NONE APP1STDLIBS+=$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) diff --git a/xmlhelp/source/cxxhelp/db/Block.cxx b/xmlhelp/source/cxxhelp/db/Block.cxx deleted file mode 100644 index c1b993a820e2..000000000000 --- a/xmlhelp/source/cxxhelp/db/Block.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************* - * - * 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: Block.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <rtl/memory.h> -#include <db/Block.hxx> -#ifndef _XMLSEARCH_UTIL_RANDOMACCESSSTREAM_HXX_ -#include <util/RandomAccessStream.hxx> -#endif -#include <db/DBEnv.hxx> - - -using namespace xmlsearch; -using namespace xmlsearch::db; - - -/******************************************************************************/ -/* */ -/* Block */ -/* */ -/******************************************************************************/ - - -Block::Block( const DBEnv* dbenv ) - : dbenv_( dbenv ), - isLeaf_( true ), - free_( 0 ), - num_( 0 ), - dataL_( dbenv->getDataLen() ), - data_( new sal_Int8[ dbenv->getDataLen() ] ) -{ - rtl_zeroMemory( data_,dataL_ ); -} - - -Block::~Block() -{ - delete[] data_; -} - - - -void Block::read( util::RandomAccessStream* in ) -{ - sal_Int8 buffer[4]; - in->readBytes( buffer,4 ); - num_ = getInteger_( buffer ); - - in->readBytes( buffer,4 ); - sal_Int32 twoFields = getInteger_( buffer ); - - isLeaf_ = ( twoFields & 0x80000000 ) != 0; - free_ = twoFields & 0x7FFFFFFF; - - in->readBytes( data_,dbenv_->getDataLen() ); -} - - -sal_Int32 Block::getInteger( sal_Int32 i ) const throw( excep::IllegalIndexException ) -{ - if( i < 0 || dbenv_->getDataLen() <= i ) - throw excep::IllegalIndexException( - rtl::OUString::createFromAscii( "Block::getInteger -> index out of range" ) ); - - sal_Int32 ret = ::getInteger_( &data_[i] ); - return ret; -} - - - diff --git a/xmlhelp/source/cxxhelp/db/BlockManager.cxx b/xmlhelp/source/cxxhelp/db/BlockManager.cxx deleted file mode 100644 index 4e1a4dc9aaa2..000000000000 --- a/xmlhelp/source/cxxhelp/db/BlockManager.cxx +++ /dev/null @@ -1,218 +0,0 @@ -/************************************************************************* - * - * 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: BlockManager.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <db/BlockManager.hxx> -#include <util/RandomAccessStream.hxx> - - - -using namespace ::xmlsearch; -using namespace ::xmlsearch::excep; -using namespace ::xmlsearch::db; - - - -BlockManager::BlockManager( DBEnv* dbenv ) throw( IOException ) - : dbenv_( dbenv ), - oldest_( 0 ), - newest_( 0 ), - blockused_( 0 ), - blockTable_( dbenv_ ? dbenv_->getBlockCount() : 0 ) // Hardcoded headerlen? -{ - if( blockTable_.size() ) - mapStorage2Memory( 0 ); - else - { - delete dbenv_; - throw IOException( rtl::OUString::createFromAscii( "BlockManager::BlockManager -> no blockcount" ) ); - } -} - - - -BlockManager::~BlockManager() -{ - delete dbenv_; -} - - - -void BlockManager::lock( sal_Int32 blNum ) throw( excep::IllegalIndexException ) -{ - if( blNum < 0 || blockTable_.size() <= sal_uInt32( blNum ) ) - throw excep::IllegalIndexException( rtl::OUString::createFromAscii( "BlockManager::lock ->" ) ); - - blockTable_[ blNum ].lock(); -} - - - -void BlockManager::unlock( sal_Int32 blNum ) throw( excep::IllegalIndexException ) -{ - if( blNum < 0 || blockTable_.size() <= sal_uInt32( blNum ) ) - throw excep::IllegalIndexException( rtl::OUString::createFromAscii( "BlockManager::unlock ->" ) ); - - blockTable_[ blNum ].unlock(); -} - - -bool BlockManager::isLocked( sal_Int32 blNum ) throw( excep::IllegalIndexException ) -{ - if( blNum < 0 || blockTable_.size() <= sal_uInt32( blNum ) ) - throw excep::IllegalIndexException( rtl::OUString::createFromAscii( "BlockManager::isLocked ->" ) ); - - return blockTable_[ blNum ].isLocked(); -} - - -void BlockManager::modf( sal_Int32 blNum ) throw( excep::IllegalIndexException ) -{ - if( blNum < 0 || blockTable_.size() <= sal_uInt32( blNum ) ) - throw excep::IllegalIndexException( rtl::OUString::createFromAscii( "BlockManager::modf ->" ) ); - - blockTable_[ blNum ].modf(); -} - - -void BlockManager::close() throw( excep::IOException ) -{ - if( ! dbenv_ ) - throw excep::IOException( rtl::OUString::createFromAscii( "BlockManager::save -> no environment" ) ); - - for( sal_uInt32 i = 0; i < blockTable_.size(); ++i ) - if( blockTable_[i].isModf() ) - blockTable_[i].write( dbenv_,i ); -} - - - -const Block* BlockManager::accessBlock( sal_Int32 blNum ) throw( excep::NoSuchBlock ) -{ - if( blNum < 0 || blockTable_.size() <= sal_uInt32( blNum ) ) - throw excep::IllegalIndexException( - rtl::OUString::createFromAscii( - "BlockManager:accessBlock -> index out of range" ) ); - - if( blockTable_[ blNum ].is() ) - moveToFront( blNum ); - else if( blockused_ < dbenv_->getMaximumBlockCount() ) - mapStorage2Memory( blNum ); - else - remap( blNum ); - - return blockTable_[ blNum ].getBlock( ); -} - - - -void BlockManager::moveToFront( sal_Int32 blNum ) -{ - if( blNum == oldest_ ) - { - oldest_ = blockTable_[blNum].next(); - blockTable_[blNum].prev( newest_ ); - blockTable_[newest_].next( blNum ); - newest_ = blNum; - } - else if( blNum != newest_ ) - { - blockTable_[blockTable_[blNum].next()].prev( blockTable_[blNum].prev() ); - blockTable_[blockTable_[blNum].prev()].next( blockTable_[blNum].next() ); - blockTable_[blNum].prev( newest_ ); - blockTable_[newest_].next( blNum ); - newest_ = blNum; - } -} - - -// maps file into buffer - -void BlockManager::mapStorage2Memory( sal_Int32 blNum ) throw( excep::IOException ) -{ - add( blNum ); - blockTable_[blNum].read( dbenv_,blNum ); -} - - - -void BlockManager::remap( sal_Int32 blNum ) throw( excep::XmlSearchException ) -{ - sal_Int32 idx = oldest_; - - while( blockTable_[ idx ].isLocked() && idx != newest_ ) - idx = blockTable_[ idx ].next(); - - if( blockTable_[ idx ].isLocked() ) - throw excep::XmlSearchException( - rtl::OUString::createFromAscii( "everything locked" ) ); - - if( blockTable_[ idx].isModf() ) - blockTable_[ idx ].write( dbenv_,idx ); - - // delete from double-linked list - if( idx == oldest_ ) - oldest_ = blockTable_[ idx ].next(); - else if( idx == newest_ ) - newest_ = blockTable_[ idx ].prev(); - else - { - blockTable_[ blockTable_[ idx ].next() ].prev( blockTable_[ idx ].prev() ); - blockTable_[ blockTable_[ idx ].prev() ].next( blockTable_[ idx ].next() ); - } - - add( blNum ); - blockTable_[blNum].add( blockTable_[ idx ].reset() ); -} - - - -void BlockManager::add( sal_Int32 blNum ) -{ - blockTable_[ blNum ].prev( newest_ ); - blockTable_[ newest_ ].next( blNum ); - newest_ = blNum; -} - - -void BlockManager::mapBlocks( const BlockProcessor& blProc ) -{ - sal_Int32 nBlocks = dbenv_->getBlockCount(); - Block* block = 0; - for (int i = 0; i < nBlocks; i++) - { - dbenv_->read( i,block ); - blProc.process( block ); - } -} - - - diff --git a/xmlhelp/source/cxxhelp/db/BtreeDict.cxx b/xmlhelp/source/cxxhelp/db/BtreeDict.cxx deleted file mode 100644 index 6f9a32850b56..000000000000 --- a/xmlhelp/source/cxxhelp/db/BtreeDict.cxx +++ /dev/null @@ -1,623 +0,0 @@ -/************************************************************************* - * - * 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: BtreeDict.cxx,v $ - * $Revision: 1.16 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <stdlib.h> -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <db/BtreeDict.hxx> -#include <db/Block.hxx> -#include <db/BlockFactory.hxx> -#include <db/BlockManager.hxx> -#include <db/DBEnv.hxx> -#include <util/RandomAccessStream.hxx> -#include <util/DBEnvImpl.hxx> -#ifndef _XMLSEARCH_UTIL_RANDOMACCESSSTREAM_HXX_ -#include <util/RandomAccessStream.hxx> -#endif - - - -const sal_Int32 xmlsearch::db::BtreeDict::ENTHEADERLEN = 6; -const sal_Int32 xmlsearch::db::BtreeDict::BLOCKSIZE = 2048; -const sal_Int32 xmlsearch::db::BtreeDict::HEADERLEN = 8; -const sal_Int32 xmlsearch::db::BtreeDict::DATALEN = -xmlsearch::db::BtreeDict::BLOCKSIZE - xmlsearch::db::BtreeDict::HEADERLEN; - -const sal_Int32 xmlsearch::db::BtreeDict::nBlocksLimit = 64; -const sal_Int32 xmlsearch::db::BtreeDict::MaxKeyLength = 255; -const sal_Int32 xmlsearch::db::BtreeDict::lastPtrIndex = 508; //!!! Careful with that number, Eugene - - -namespace xmlsearch { - - namespace db { - - class DictBlock - : public Block - { - friend class BtreeDict; - - - public: - - DictBlock( const DBEnv* dbenv ) - : Block( dbenv ) - { - } - - sal_Int32 free() const - { - return getFree() + firstEntry(); - } - - sal_Int32 numberOfEntries() const - { - return getInteger( 0 ); - } - - sal_Int32 nthPointer( sal_Int32 n ) const - { - return getInteger( 4*(n+1) ); - } - - sal_Int32 getChildIdx( sal_Int32 index ) const - { - return nthPointer( BtreeDict::lastPtrIndex - index ); - } - - sal_Int32 entryKeyLength( sal_Int32 i ) const - { - - return getData()[i] & 0xFF; - } - - sal_Int32 entryID( sal_Int32 i ) const - { - return getInteger(i + 2); - } - - sal_Int32 entryCompression( sal_Int32 i ) const - { - return getData()[i+1] & 0xFF; - } - - sal_Int32 entryLength( sal_Int32 entry ) const - { - return BtreeDict::ENTHEADERLEN + entryKeyLength( entry ); - } - - sal_Int32 entryKey( sal_Int32 entry ) const - { - return entry + BtreeDict::ENTHEADERLEN; - } - - sal_Int32 firstEntry() const - { - return 4; - } - - sal_Int32 nextEntry( sal_Int32 entry ) const - { - return entry + entryLength( entry ); - } - - void restoreKeyInBuffer( sal_Int32 entry, sal_Int8* buffer ) const - { - sal_Int32 howMany = entryKeyLength( entry ); - sal_Int32 where = entryCompression( entry ); - sal_Int32 from = entryKey( entry ); - while( howMany-- > 0 ) - buffer[ where++ ] = getData()[ from++ ]; - } - - rtl::OUString restoreKey( sal_Int32 entry, sal_Int8* buffer ) const - { - sal_Int32 howMany = entryKeyLength( entry ); - sal_Int32 where = entryCompression( entry ); - sal_Int32 from = entryKey( entry ); - while( howMany-- > 0 ) - buffer[ where++ ] = getData()[ from++ ]; - - return rtl::OUString( (sal_Char*)(buffer),where,RTL_TEXTENCODING_UTF8 ); - } - - rtl::OUString findID( sal_Int32 id ) const throw( xmlsearch::excep::XmlSearchException ) - { - sal_Int8 buffer[ BtreeDict::MaxKeyLength ]; - sal_Int32 freeSpace = free(); - for( sal_Int32 ent = firstEntry(); ent < freeSpace; ent = nextEntry( ent ) ) - if( entryID( ent ) == id ) // found - return restoreKey( ent,buffer ); - else - restoreKeyInBuffer( ent,buffer ); - - throw xmlsearch::excep::XmlSearchException( - rtl::OUString::createFromAscii( "DictBlock::findID -> ID not found in block" ) ); - } - - - void withPrefix( const BtreeDict* owner, - const rtl::OUString& prefix, - sal_Int32 prefLen, - std::vector<sal_Int32>& result) const - throw( xmlsearch::excep::XmlSearchException ); - - -// void withPrefix( const BtreeDict* owner, -// const rtl::OUString& prefix, -// sal_Int32 prefLen, -// std::vector<sal_Int32>& result) const -// throw( xmlsearch::excep::XmlSearchException ) -// { -// sal_Int8 buffer[ BtreeDict::MaxKeyLength ]; -// const int freeSpace = free(); -// int entryPtr = firstEntry(); -// if( isLeaf() ) -// while (entryPtr < freeSpace) -// { -// if( restoreKey( entryPtr,buffer).compareTo( prefix,prefix.getLength() ) == 0 ) -// result.push_back( entryID( entryPtr ) ); -// entryPtr = nextEntry(entryPtr); -// } -// else -// { -// owner->lock( getNum() ); -// sal_Int32 entryIndex = 0; -// while( entryPtr < freeSpace ) -// { -// rtl::OUString key = restoreKey( entryPtr,buffer ); - -// if( key.getLength() > prefLen ) -// key = key.copy( 0,prefLen ); -// sal_Int32 cmp = key.compareTo(prefix); - -// if( cmp < 0 ) -// { -// entryPtr = nextEntry( entryPtr ); -// ++entryIndex; -// } -// else if( cmp == 0 ) -// { -// result.push_back( entryID( entryPtr ) ); -// owner->accessBlock( getChildIdx( entryIndex ) )->withPrefix( owner,prefix,prefLen,result ); -// entryPtr = nextEntry( entryPtr ); -// ++entryIndex; -// } -// else -// { -// owner->unlock( getNum() ); -// owner->accessBlock( getChildIdx( entryIndex ) )->withPrefix( owner,prefix,prefLen,result ); -// return; -// } -// } - -// owner->unlock( getNum() ); -// owner->accessBlock( getChildIdx( numberOfEntries() ) )->withPrefix( owner,prefix,prefLen,result ); -// } -// } - - - void setBlockNumbers( sal_Int32* blocks ) - { - for( sal_Int32 e = firstEntry(); e < getFree() ; e = nextEntry(e) ) - blocks[ entryID(e) ] = getNum(); - } - - - protected: - - void doMap( BtreeDict* owner,EntryProcessor* processor ) const - throw( xmlsearch::excep::XmlSearchException ) - { - sal_Int8 buffer[ BtreeDict::MaxKeyLength ]; - sal_Int32 freeSpace = free(); - sal_Int32 entryPtr = firstEntry(); - - if( isLeaf() ) - while( entryPtr < freeSpace ) - { - processor->processEntry( restoreKey( entryPtr,buffer ), - entryID( entryPtr ) ); - entryPtr = nextEntry( entryPtr ); - } - else - { - owner->lock( getNum() ); - sal_Int8 entryIdx = 0; - while( entryPtr < freeSpace ) - { - owner->accessBlock( getChildIdx( entryIdx ) )->doMap( owner,processor ); - processor->processEntry( restoreKey( entryPtr,buffer ), - entryID( entryPtr ) ); - entryPtr = nextEntry( entryPtr ); - ++entryIdx; - } - owner->accessBlock( getChildIdx( entryIdx ) )->doMap( owner,processor ); - owner->unlock( getNum() ); - } - } - - - }; // end class DictBlock - - - } // end namespace db - -} // end namespace xmlsearch - - - - -using namespace xmlsearch; -using namespace xmlsearch::excep; -using namespace xmlsearch::db; -using namespace xmlsearch::util; - - - - -void DictBlock::withPrefix( const BtreeDict* owner, - const rtl::OUString& prefix, - sal_Int32 prefLen, - std::vector<sal_Int32>& result) const - throw( xmlsearch::excep::XmlSearchException ) -{ - sal_Int8 buffer[ BtreeDict::MaxKeyLength ]; - const int freeSpace = free(); - int entryPtr = firstEntry(); - if( isLeaf() ) - while( entryPtr < freeSpace ) - { - rtl::OUString key = restoreKey( entryPtr,buffer); - if( key.indexOf( prefix ) != -1 ) - result.push_back( entryID( entryPtr ) ); - entryPtr = nextEntry(entryPtr); - } - else - { - owner->lock( getNum() ); - sal_Int32 entryIndex = 0; - while( entryPtr < freeSpace ) - { - rtl::OUString key = restoreKey( entryPtr,buffer ); - - if( key.getLength() > prefLen ) - key = key.copy( 0,prefLen ); - - sal_Int32 cmp = key.indexOf(prefix); - - if( cmp != -1 ) - result.push_back( entryID( entryPtr ) ); - owner->accessBlock( getChildIdx( entryIndex ) )->withPrefix( owner,prefix,prefLen,result ); - entryPtr = nextEntry( entryPtr ); - ++entryIndex; - } - - owner->unlock( getNum() ); - owner->accessBlock( getChildIdx( numberOfEntries() ) )->withPrefix( owner,prefix,prefLen,result ); - } -} - - - - -class BlockProcessorImpl - : public BlockProcessor -{ -public: - - BlockProcessorImpl( BtreeDict* bla ) - : bla_( bla ) - { - } - - - ~BlockProcessorImpl() - { - } - - - void process( Block* block ) const; - -private: - - BtreeDict* bla_; -}; - - - -void BlockProcessorImpl::process( Block* block ) const -{ - DictBlock* bla = dynamic_cast<DictBlock*>( block ); - bla->setBlockNumbers( bla_->get_blocks() ); -} - - - - - -BtreeDict::BtreeDict( const util::IndexAccessor& indexAccessor ) throw( IOException ) - : blockManager_( new DBEnvImpl( indexAccessor ) ), // may throw IOExcption - blocksL_( 0 ), - blocks_( 0 ) -{ - - RandomAccessStream* SCHEMA = indexAccessor.getStream( rtl::OUString::createFromAscii( "SCHEMA" ), - rtl::OUString::createFromAscii( "r" ) ); - - if( SCHEMA ) - { - sal_Int32 len = SCHEMA->length(); - char* bff = new char[ 1 + len ]; - bff[ len ] = 0; - SCHEMA->readBytes( reinterpret_cast<sal_Int8*>( bff ),len ); - delete SCHEMA; - - rtl::OString aStr( bff ); - - sal_Int32 idx = 3 + aStr.lastIndexOf( "rt=" ); - root_ = atoi( bff + idx ); - - idx = 4 + aStr.lastIndexOf( "id1=" ); - sal_Int32 count = atoi( bff + idx ); - blocks_ = new sal_Int32[ blocksL_ = count ]; - - delete[] bff; - BlockProcessorImpl blProc( this ); - blockManager_.mapBlocks( blProc ); - } - else - throw IOException( rtl::OUString::createFromAscii( "BtreeDict::BtreeDict -> no SCHEMA/schema" ) ); -} - - -BtreeDict::~BtreeDict() -{ - delete[] blocks_; -} - - -const DictBlock* BtreeDict::accessBlock( sal_Int32 id ) const -{ - const Block* bl = blockManager_.accessBlock( id ); - return dynamic_cast< const DictBlock* >( bl ); -} - - -void BtreeDict::lock( sal_Int32 blNum ) const throw( excep::IllegalIndexException ) -{ - blockManager_.lock( blNum ); -} - - -void BtreeDict::unlock( sal_Int32 blNum ) const throw( excep::IllegalIndexException ) -{ - blockManager_.unlock( blNum ); -} - -sal_Int32 BtreeDict::fetch( const rtl::OUString& key ) const throw( excep::XmlSearchException ) -{ - /** - * Here is the correct code. To function it requires a bug fix in the old Javacode of - * Jaczeks index engine. - */ - - rtl::OString searchString( key.getStr(),key.getLength(),RTL_TEXTENCODING_UTF8 ); - - return find( accessBlock( root_ ), - reinterpret_cast< const sal_Int8* >( searchString.getStr() ), - searchString.getLength() ); - - - /** - * The key has to be replaced by UTF8-encoded byterepresentations of unicode string, - * as a workaround to Jazceks bug. - */ - -// rtl::OString Key( key.getStr(),key.getLength(),RTL_TEXTENCODING_ISO_8859_1 ); - -// sal_Int32 len = key.getLength(); -// sal_Int8 *searchStr = new sal_Int8[ 1+len ]; -// searchStr[len] = 0; - -// rtl_copyMemory( searchStr,(const sal_Int8*)(Key.getStr()),len ); -// sal_Int32 ret = find( accessBlock( root_ ), -// searchStr, -// len ); -// delete[] searchStr; -// return ret; -} - - -rtl::OUString BtreeDict::fetch( sal_Int32 conceptID ) const throw( excep::XmlSearchException ) -{ - if( blocksL_ <= conceptID ) - throw excep::XmlSearchException( rtl::OUString() ); - - return findID( blocks_[conceptID], conceptID ); -} - - -std::vector< sal_Int32 > BtreeDict::withPrefix( const rtl::OUString& prefix ) const - throw( excep::XmlSearchException ) -{ - std::vector< sal_Int32 > result; - const DictBlock *bl = accessBlock( root_ ); - bl->withPrefix( this,prefix,prefix.getLength(),result ); - return result; -} - - - -sal_Int32 BtreeDict::find( const DictBlock* bl, - const sal_Int8* key, - sal_Int32 inputKeyLen ) const throw( excep::XmlSearchException ) -{ - sal_Int32 entryPtr = bl->firstEntry(); - sal_Int32 freeSpace = bl->free(); - sal_Int32 nCharsEqual = 0; - sal_Int32 compression = 0; - - for( sal_Int32 entryIdx = 0; ; ) - { - if( entryPtr == freeSpace ) - return find( bl, - key, - inputKeyLen, - bl->numberOfEntries() ); - - else if( compression == nCharsEqual ) - { - sal_Int32 keyLen = bl->entryKeyLength( entryPtr ); - sal_Int32 keyPtr = bl->entryKey( entryPtr ), i; - for( i = 0; i < keyLen && key[ nCharsEqual ] == bl->getData()[keyPtr + i]; i++ ) - ++nCharsEqual; - if( i == keyLen ) - { - if( nCharsEqual == inputKeyLen ) - return bl->entryID( entryPtr ); - } - else if( ( key[ nCharsEqual ] & 0xFF ) < ( bl->getData()[ keyPtr + i ] & 0xFF) ) - return find( bl,key,inputKeyLen,entryIdx ); - } - - else if( compression < nCharsEqual ) // compression dropped - return find( bl,key,inputKeyLen,entryPtr == freeSpace ? bl->numberOfEntries() : entryIdx ); - - - do - { - entryPtr = bl->nextEntry( entryPtr ); - ++entryIdx; - } while( bl->entryCompression( entryPtr ) > nCharsEqual ); - - compression = bl->entryCompression( entryPtr ); - } -} - - - - -sal_Int32 BtreeDict::find( const DictBlock* bl, - const sal_Int8* key, - sal_Int32 inputKeyLen, - sal_Int32 index ) const throw( xmlsearch::excep::XmlSearchException ) -{ - return bl->isLeaf() ? 0 : find( child( bl,index ),key,inputKeyLen ); -} - - - -const DictBlock* BtreeDict::child( const DictBlock* bl,sal_Int32 index) const throw( excep::XmlSearchException ) -{ - return accessBlock( bl->getChildIdx(index) ); -} - - -rtl::OUString BtreeDict::findID( sal_Int32 blNum,sal_Int32 id ) const throw( xmlsearch::excep::XmlSearchException ) -{ - return accessBlock( blNum )->findID( id ); -} - - - - -// Definitions for DBEnvImpl - - - -DBEnvImpl::DBEnvImpl( const util::IndexAccessor& indexAccessor ) -{ - file_ = indexAccessor.getStream( rtl::OUString::createFromAscii( "DICTIONARY" ), - rtl::OUString::createFromAscii( "r" ) ); -} - - -DBEnvImpl::~DBEnvImpl() -{ - delete file_; -} - - -sal_Int32 DBEnvImpl::getEntryHeaderLen() const -{ - return BtreeDict::ENTHEADERLEN; -} - - -sal_Int32 DBEnvImpl::getBlockCount() const -{ - if( file_ ) - return file_->length() / BtreeDict::BLOCKSIZE; - else - return 0; -} - -sal_Int32 DBEnvImpl::getMaximumBlockCount() const -{ - return BtreeDict::nBlocksLimit; -} - - -sal_Int32 util::DBEnvImpl::getDataLen() const -{ - return BtreeDict::DATALEN; -} - - -sal_Int32 DBEnvImpl::getBlockLen() const -{ - return BtreeDict::BLOCKSIZE; -} - - -void DBEnvImpl::read( sal_Int32 blNum,xmlsearch::db::Block*& block ) const -{ - if( ! block ) - block = new xmlsearch::db::DictBlock( this ); - - if( file_ ) - { - file_->seek( blNum * getBlockLen() ); - block->read( file_ ); - } -} - - -void DBEnvImpl::write( sal_Int32 blNum,xmlsearch::db::Block* block ) -{ - (void)blNum; - if( ! block ) - return; -} diff --git a/xmlhelp/source/cxxhelp/inc/db/Block.hxx b/xmlhelp/source/cxxhelp/inc/db/Block.hxx deleted file mode 100644 index ee57708bf2fe..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/Block.hxx +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * 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: Block.hxx,v $ - * $Revision: 1.4 $ - * - * 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 _XMLSEARCH_DB_BLOCK_HXX_ -#define _XMLSEARCH_DB_BLOCK_HXX_ - -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> - - -namespace xmlsearch { - - namespace util { - - class RandomAccessStream; - - } - - namespace db { - - - class DBEnv; - - - class Block // refcounted class - { - public: - - Block( const DBEnv* ); - virtual ~Block(); - - sal_Int32 getInteger( sal_Int32 i ) const throw( xmlsearch::excep::IllegalIndexException ); - - void trueLeaf() { isLeaf_ = true; } - void falseLeaf() { isLeaf_ = false; } - bool isLeaf() const { return isLeaf_; } - - void setFree( sal_Int32 free ) { free_ = free; } - sal_Int32 getFree() const { return free_; } - - void setNum( sal_Int32 num ) { num_ = num; } - sal_Int32 getNum() const { return num_; } - - void read( util::RandomAccessStream* in ); - - const sal_Int8* getData() const { return data_; } - - - protected: - - const DBEnv* dbenv_; // not owner - - - private: - - bool isLeaf_; - sal_Int32 free_; - sal_Int32 num_; - sal_Int32 dataL_; - sal_Int8* data_; - - // methods - - Block( const Block& ); - Block& operator=( const Block& ); - - }; // end class Block - - - } -} - - -inline sal_Int32 getInteger_( const sal_Int8* v ) -{ - return (((((( (v[0]&0xFF) ) << 8 ) - | (v[1]&0xFF) ) << 8 ) - | (v[2]&0xFF) ) << 8 ) - | (v[3]&0xFF); -} - - - -inline void setInteger_( sal_Int8* v,sal_Int32 value ) -{ - v[0] = sal_Int8((value >> 24) & 0xFF); - v[1] = sal_Int8((value >> 16) & 0xFF); - v[2] = sal_Int8((value >> 8) & 0xFF); - v[3] = sal_Int8( value & 0xFF ); -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/db/BlockManager.hxx b/xmlhelp/source/cxxhelp/inc/db/BlockManager.hxx deleted file mode 100644 index 84871c749989..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/BlockManager.hxx +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************* - * - * 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: BlockManager.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _XMLSEARCH_DB_BLOCKMANAGER_HXX_ -#define _XMLSEARCH_DB_BLOCKMANAGER_HXX_ - -#include <rtl/ustring.hxx> -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <db/Block.hxx> -#include <db/BlockFactory.hxx> -#include <db/DBEnv.hxx> -#include <excep/XmlSearchExceptions.hxx> - -namespace xmlsearch { - - namespace util { - - class RandomAccessStream; - - } - - namespace db { - - - class BlockDecoratour // internal class for BlockManager - { - public: - - BlockDecoratour() - : lock_( false ), - modf_( false ), - prev_( 0 ), - next_( 0 ), - block_( 0 ) - { - } - - ~BlockDecoratour() { delete block_; } - - void lock() { lock_ = true; } - void unlock() { lock_ = false; } - bool isLocked() const { return lock_; } - - bool isModf() const { return modf_; } - void modf() { modf_ = true; } - - void next( sal_Int32 parnext ) { next_ = parnext; } - sal_Int32 next() const { return next_; } - void prev( sal_Int32 parprev ) { prev_ = parprev; } - sal_Int32 prev() const { return prev_; } - - void read( DBEnv* dbenv,sal_Int32 blNum ) { dbenv->read( blNum,block_ ); } - void write(DBEnv* dbenv,sal_Int32 blNum ) { dbenv->write( blNum,block_ ); } - - Block* reset() { lock_ = modf_ = false; prev_ = next_ = 0; Block* tmp = block_; block_ = 0; return tmp; } - void add( Block* block ) { delete block_; block_ = block; } - bool is() const { return block_ != 0; } - - const Block* getBlock() const { return block_; } - - private: - - bool lock_; - bool modf_; - sal_Int32 prev_; - sal_Int32 next_; - Block* block_; - - }; - - - - class BlockProcessor - { - public: - - virtual void process( Block* block ) const = 0; - virtual ~BlockProcessor() {} - }; - - - class BlockManager - { - public: - - // Buffered mapping of stream into memory - - BlockManager( DBEnv* ) throw( xmlsearch::excep::IOException ); - virtual ~BlockManager(); - - // From BlockManagerBase - virtual void lock( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - virtual void unlock( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - virtual bool isLocked( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - - virtual void modf( sal_Int32 blNum ) throw( xmlsearch::excep::IllegalIndexException ); - virtual void close() throw( xmlsearch::excep::IOException ); - - virtual const Block* accessBlock( sal_Int32 blNum ) throw( xmlsearch::excep::NoSuchBlock ); - virtual void mapBlocks( const BlockProcessor& blProc ); - - - private: - - // types - - xmlsearch::db::DBEnv* dbenv_; - - sal_Int32 oldest_; - sal_Int32 newest_; - BlockDecoratour dummy_; - sal_Int32 blockused_; - std::vector< BlockDecoratour > blockTable_; - - - // private methods - - void moveToFront( sal_Int32 index ); - void mapStorage2Memory( sal_Int32 blNum ) throw( xmlsearch::excep::IOException ); - void remap( sal_Int32 blNum ) throw( xmlsearch::excep::XmlSearchException ); - void add( sal_Int32 blNum ); - }; - - - } -} - - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/db/BtreeDict.hxx b/xmlhelp/source/cxxhelp/inc/db/BtreeDict.hxx deleted file mode 100644 index 9b5c29606011..000000000000 --- a/xmlhelp/source/cxxhelp/inc/db/BtreeDict.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * 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: BtreeDict.hxx,v $ - * $Revision: 1.4 $ - * - * 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 _XMLSEARCH_DB_BTREEDICT_HXX_ -#define _XMLSEARCH_DB_BTREEDICT_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> -#include <db/BlockManager.hxx> -#include <db/EntryProcessor.hxx> -#include <util/IndexAccessor.hxx> - -namespace xmlsearch { - - namespace db { - - - class DictBlock; - class DBEnv; - - - class BtreeDict - { - public: - - static const sal_Int32 ENTHEADERLEN; - static const sal_Int32 BLOCKSIZE; - static const sal_Int32 HEADERLEN; - static const sal_Int32 DATALEN; - - static const sal_Int32 nBlocksLimit; - static const sal_Int32 MaxKeyLength; - static const sal_Int32 lastPtrIndex; //!!! Careful with that number, Eugene - - BtreeDict( const xmlsearch::util::IndexAccessor& indexAccessor ) - throw( xmlsearch::excep::IOException ); - ~BtreeDict(); - - void lock( sal_Int32 blNum ) const throw( xmlsearch::excep::IllegalIndexException ); - void unlock( sal_Int32 blNum ) const throw( xmlsearch::excep::IllegalIndexException ); - - const DictBlock* accessBlock( sal_Int32 id ) const; - - sal_Int32 fetch( const rtl::OUString& key ) const throw( xmlsearch::excep::XmlSearchException ); - rtl::OUString fetch( sal_Int32 conceptID ) const throw( xmlsearch::excep::XmlSearchException ); - - std::vector< sal_Int32 > withPrefix( const rtl::OUString& prefix ) const throw( xmlsearch::excep::XmlSearchException ); - sal_Int32* get_blocks() const { return blocks_; } - - void test(); - - private: - - mutable BlockManager blockManager_; - sal_Int32 root_; - sal_Int32 blocksL_; - sal_Int32* blocks_; - - sal_Int32 find( const DictBlock* bl, - const sal_Int8* key, - sal_Int32 inputKeyLen ) const throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 find( const DictBlock* bl, - const sal_Int8* key, - sal_Int32 inputKeyLen, - sal_Int32 index ) const throw( xmlsearch::excep::XmlSearchException ); - - const DictBlock* child( const DictBlock* bl, - sal_Int32 index) const throw( xmlsearch::excep::XmlSearchException ); - - rtl::OUString findID( sal_Int32 blNum,sal_Int32 id ) const throw( xmlsearch::excep::XmlSearchException ); - - }; - - - } -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx b/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx deleted file mode 100644 index 52e8e1560102..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/ConceptData.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * 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: ConceptData.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _XMLSEARCH_QE_CONCEPTDATA_HXX_ -#define _XMLSEARCH_QE_CONCEPTDATA_HXX_ - -#include <rtl/ref.hxx> -#include <sal/types.h> -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif - - -namespace xmlsearch { - - namespace qe { - - - class RoleFiller; - class Query; - class ContextTables; - - class ConceptData - { - public: - - ConceptData( sal_Int32 id = 0, - sal_Int32 role = 0, - double score = 0.0, - sal_Int32 queryNo = 0, - sal_Int32 nColumns = 0, - ContextTables* contextTables = 0 ); - - virtual ~ConceptData(); - - void acquire() { ++m_nRefcount; } - void release() { if( ! --m_nRefcount ) delete this; } - - bool cEquals( ConceptData* r ) { return concept_ == r->concept_; } - bool crEquals( ConceptData* r ) { return cEquals( r ) && role_ == r->role_; } - bool crqEquals( ConceptData* r ) { return crEquals( r ) && queryNo_ == r->queryNo_; } - bool compareWith( ConceptData* r ) { return - (concept_ < r->concept_) || - (cEquals( r ) && role_ < r->role_) || - (crEquals( r ) && penalty_ < r->penalty_); } - - void addLast( ConceptData* r ); - - sal_Int32 getConcept() const { return concept_; } - - sal_Int32 getQueryMask() const - { - return ( next_.is() ? next_->getQueryMask() : 0 ) | ( 1 << queryNo_ ); - } - - void runBy( std::vector< Query* >& queries ); - - virtual void generateFillers( std::vector< RoleFiller* >& array, sal_Int32 last ); - - sal_Int32 getConcept() { return concept_; } - - sal_uInt8 getRole() { return role_; } - - sal_uInt8 getQuery() { return queryNo_; } - - double getScore() { return penalty_; } - - double getPenalty() { return penalty_; } - - - protected: - - static const sal_Int32 ProxPerTerm; - - sal_uInt8 queryNo_,nColumns_,role_; - - sal_Int32 concept_,proximity_; - - double penalty_; - - sal_uInt32 m_nRefcount; - - ContextTables* ctx_; - rtl::Reference< ConceptData > next_; - std::vector< rtl::Reference< RoleFiller > > roleFillers_; - }; - - - - } - -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx b/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx deleted file mode 100644 index b3752990ec49..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/ContextTables.hxx +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************* - * - * 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: ContextTables.hxx,v $ - * $Revision: 1.4 $ - * - * 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 _XMLSEARCH_QE_CONTEXTTABLES_HXX_ -#define _XMLSEARCH_QE_CONTEXTTABLES_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> - - -namespace xmlsearch { - - namespace qe { - - /* forward declaration */ - - class ContextTables; - - - /******************************************************************************/ - - - class Tables - { - public: - - Tables( ContextTables* p ); - - ~Tables(); - - void setTables( ContextTables* p ); - - - private: - - sal_Int32 initialWordsCachedL_,destsCachedL_,linkTypesCachedL_,seqNumbersCachedL_; - sal_Int32 *initialWordsCached_,*destsCached_,*linkTypesCached_,*seqNumbersCached_; - - }; // end class Tables - - - /******************************************************************************/ - - - class ContextTables - { - friend class Tables; - - public: - - ContextTables( const std::vector< sal_Int32 >& offsets, - sal_Int32 contextDataL,sal_Int8 *contextData, - sal_Int32 linkNamesL,rtl::OUString *linkNames ); - - ~ContextTables(); - - void setMicroindex( sal_Int32 docNo ) throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 linkCode( const rtl::OUString& linkName_ ); - - bool* getIgnoredElementsSet( sal_Int32& len, /*out*/ - const sal_Int32 ignoredElementsL, - const rtl::OUString* ignoredElements ); - - bool notIgnored( sal_Int32 ctx, - sal_Int32 ignoredElementsL,bool* ignoredElements ); - - sal_Int32 firstParentWithCode( const sal_Int32 pos,const sal_Int32 linkCode_ ); - - void resetContextSearch(); - - sal_Int32 wordContextLin(sal_Int32 wordNumber); - - private: - - sal_Int32 nTextNodes_,initialWordsIndex_,lastDocNo_; - sal_Int32 initialWordsL_,destsL_,linkTypesL_,seqNumbersL_,markersL_; - sal_Int32 *initialWords_,*dests_,*linkTypes_,*seqNumbers_,*markers_; - - sal_Int32 contextDataL_; - sal_Int8 *contextData_; // no - - sal_Int32 linkNamesL_; - rtl::OUString *linkNames_; // no - - std::vector<Tables*> cache_; - std::vector< sal_Int32 > kTable_,auxArray_; - - const std::vector< sal_Int32 >& offsets_; - - }; // end class ContextTables - - - /******************************************************************************/ - - } // end namespace qe - -} // end namespace xmlsearch - - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx index 27e545af06cf..bdad2d01d43c 100644 --- a/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx +++ b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx @@ -35,8 +35,6 @@ #include <rtl/ustring.hxx> #endif #include <excep/XmlSearchExceptions.hxx> -#include <qe/XmlIndex.hxx> -#include <qe/ConceptData.hxx> #include <util/CompressorIterator.hxx> #include <util/Decompressor.hxx> @@ -61,103 +59,6 @@ namespace xmlsearch { }; - class NextDocGenerator - { - public: - - NextDocGenerator( ConceptData* cd,XmlIndex* env ); - - ~NextDocGenerator() { delete iterator_; } - - sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) - { - return ( document_ = ( iterator_ ? iterator_->first() : NonnegativeIntegerGenerator::END ) ); - } - - sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) - { - if( iterator_ ) - return document_ = iterator_->next(); - - throw xmlsearch::excep::XmlSearchException( rtl::OUString::createFromAscii( "NextDocGenerator::next ->" ) ); - } - - sal_Int32 getDocument() { return document_; } - - sal_Int32 getConcept() { return concept_; } - - sal_Int32 getQueryMask() { return queryMask_; } - - rtl::Reference< ConceptData > getTerms() { return terms_; } - - bool smallerThan( NextDocGenerator* other ) - { - return - (document_ < other->document_) - || - (document_ == other->document_ && concept_ < other->concept_); - } - - - private: - - sal_Int32 document_,concept_,queryMask_; - rtl::Reference< ConceptData > terms_; - NonnegativeIntegerGenerator* iterator_; - }; - - - class NextDocGeneratorHeap - { - public: - - NextDocGeneratorHeap() - : nonEmpty_( false ), - heapSize_( 0 ), - free_( 0 ) - - { - } - - ~NextDocGeneratorHeap() - { - reset(); - } - - void reset(); - - void addGenerator( NextDocGenerator* gen ); - - void start(); - - bool isNonEmpty() const { return nonEmpty_; } - - void step() throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 getDocument() { return heap_[0]->getDocument(); } - - sal_Int32 getConcept() { return heap_[0]->getConcept(); } - - sal_Int32 getQueryMask() { return heap_[0]->getQueryMask(); } - - rtl::Reference< ConceptData > getTerms() { return heap_[0]->getTerms(); } - - bool atDocument( sal_Int32 document ); - - - private: - - bool nonEmpty_; - - sal_Int32 heapSize_,free_; - - std::vector< NextDocGenerator* > heap_; - - void heapify( sal_Int32 i ); - }; - - - class RoleFiller { public: @@ -166,24 +67,11 @@ namespace xmlsearch { RoleFiller(); - RoleFiller( sal_Int32 nColumns, - ConceptData* first, - sal_Int32 role, - sal_Int32 pos, - sal_Int32 parentContext, - sal_Int32 limit ); - ~RoleFiller(); void acquire() { ++m_nRefcount; } void release() { if( ! --m_nRefcount ) delete this; } - void scoreList( Query* ,sal_Int32 ); - - sal_Int32 getConcept(); - - void use( std::vector< RoleFiller*>& place,sal_Int32 query ); - private: static RoleFiller roleFiller_; @@ -195,55 +83,6 @@ namespace xmlsearch { RoleFiller* next_; std::vector< RoleFiller* > fillers_; - - ConceptData* conceptData_; - - double penalty( Query* query,sal_Int32 nColumns ); - - void makeQueryHit( Query* query,sal_Int32 doc,double penalty_ ); - - void considerReplacementWith( RoleFiller* replacement ); - - double getScore() { return conceptData_->getScore(); } - }; - - - - class ConceptGroupGenerator - : public xmlsearch::util::CompressorIterator - { - public: - - static const sal_Int32 NConceptsInGroup; - - ConceptGroupGenerator(); - - ConceptGroupGenerator( sal_Int32 dataL,sal_Int8* data,sal_Int32 index,sal_Int32 k ); - - virtual ~ConceptGroupGenerator(); - - void init( sal_Int32 bytesL,sal_Int8* bytes,sal_Int32 index,sal_Int32 k ); - - bool next() throw( xmlsearch::excep::XmlSearchException ); - - void generateFillers( std::vector< RoleFiller* >& array ); - - sal_Int32 position() { return last_; } - - void value( sal_Int32 value_ ) { last_ += value_; } - - sal_Int32 decodeConcepts( sal_Int32 k, sal_Int32 shift, sal_Int32 *concepts ) throw( xmlsearch::excep::XmlSearchException ); - - void addTerms( sal_Int32 index, ConceptData* terms ); - - private: - - static const sal_Int32 BitsInLabel; - - sal_Int32 last_,k1_,k2_; - std::vector< rtl::Reference< ConceptData > > table_; - xmlsearch::util::Decompressor* bits_; - rtl::Reference< ConceptData> cData_; }; @@ -255,27 +94,9 @@ namespace xmlsearch { : heapSize_( 0 ), free_( 0 ) { } - - ~GeneratorHeap() { reset(); } - - bool start( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException ); - - bool next( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException ); - - void reset(); - - void addGenerator( ConceptGroupGenerator* cd ); - private: sal_Int32 heapSize_,free_; - - std::vector< ConceptGroupGenerator* > heap_; - - void buildHeap(); - - void heapify( sal_Int32 root ); - }; diff --git a/xmlhelp/source/cxxhelp/inc/qe/Query.hxx b/xmlhelp/source/cxxhelp/inc/qe/Query.hxx index 1d7cbb22f079..33b0d3153ba4 100644 --- a/xmlhelp/source/cxxhelp/inc/qe/Query.hxx +++ b/xmlhelp/source/cxxhelp/inc/qe/Query.hxx @@ -32,20 +32,16 @@ #include <sal/types.h> #include <rtl/memory.h> -#include <rtl/ustring.hxx> -#include <qe/XmlIndex.hxx> +#include <rtl/ustring.hxx> +#include <vector> namespace xmlsearch { namespace qe { - class QueryResults; class Search; - class ConceptData; class RoleFiller; - class ContextTables; - class QueryHit { @@ -66,8 +62,6 @@ namespace xmlsearch { sal_Int32 getDocument() const { return doc_; } - sal_Int32* getMatches( sal_Int32& matchesL ); - sal_Int32 countOfMatches() const { return matchesL_; } sal_Int32 getBegin() const { return begin_; } @@ -167,124 +161,6 @@ namespace xmlsearch { }; // end class QueryHitData - - class HitStore - { - public: - - HitStore( double, sal_Int32,sal_Int32 ); - - ~HitStore(); - - QueryHit* firstBestQueryHit(); - - QueryHit* nextBestQueryHit(); - - bool goodEnough( double penalty,sal_Int32 begin,sal_Int32 end ); - - QueryHit* createQueryHit( double penalty,sal_Int32 doc,sal_Int32 begin,sal_Int32 end ); - - double getCurrentStandard() { return standard_; } - - - private: - - const sal_Int32 limit_,nColumns_; - - sal_Int32 index_,free_; - - double standard_; - - std::vector< QueryHit* > heap_; - - void heapify( sal_Int32 ); - - void quicksort( sal_Int32 p,sal_Int32 r ); - - sal_Int32 partition( sal_Int32 p,sal_Int32 r ); - }; - - - - class Query - { - public: - - Query( XmlIndex* env, - sal_Int32 nColumns, - sal_Int32 nHits, - sal_Int32 missingPenaltiesL, - double* missingPenalties ); - - virtual ~Query(); - - void missingTerms( sal_Int32 nMissingTerms ); - - virtual void addControlConceptData( Search*,sal_Int32 ) { } - - virtual bool zoned() const { return false; } - - virtual ConceptData* makeConceptData( sal_Int32 col,sal_Int32 concept,double penalty,sal_Int32 queryNo ); - - void getHits( std::vector< QueryHitData* >& data,sal_Int32 nHits ); - - double lookupPenalty( sal_Int32 pattern ) { return penalties_[ pattern ]; } - - RoleFiller* getRoleFillers() { return roleFillerList_; } - - void resetForNextDocument(); - - void saveRoleFillers( RoleFiller* roleFillerList ) { roleFillerList_ = roleFillerList; } - - bool vote(); - - sal_Int32 getNColumns() { return nColumns_; } - - QueryHit* maybeCreateQueryHit( double penalty, - sal_Int32 doc, sal_Int32 begin, sal_Int32 end, sal_Int32 parentContext); - - void setIgnoredElements( const sal_Int32 ignoredElementsL,const rtl::OUString* ignoredElements ); - - double getOutOufOrderPenalty() { return 0.25; } - - double getGapPenalty() { return 0.005; } - - void updateEstimate( sal_Int32 role,double penalty ); - - - protected: - - XmlIndex* env_; - ContextTables* ctx_; - HitStore store_; - - sal_Int32 nHitsRequested_,nColumns_; - double currentStandard_; - - sal_Int32 missingPenaltyL_,upperboundTemplateL_,penaltiesL_; - double *missingPenalty_,*upperboundTemplate_,*penalties_; - - sal_Int32 ignoredElementsL_; - bool *ignoredElements_; - - - private: - - bool vote_; - double missingTermsPenalty_; - - // for use with Start/Stop - - RoleFiller *roleFillerList_; - - void makePenaltiesTable(); - - double computePenalty( sal_Int32 ); - - }; - - - class PrefixTranslator { public: @@ -294,34 +170,6 @@ namespace xmlsearch { return 0; } }; - - - - - class QueryResults; - - - - class QueryHitIterator - { - public: - - QueryHitIterator( const QueryResults* result ); - - ~QueryHitIterator(); - - bool next(); - - QueryHitData* getHit( const PrefixTranslator* ) const; - - private: - - bool accessible_; - sal_Int32 index_; - const QueryResults* result_; - }; - - } } diff --git a/xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx b/xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx deleted file mode 100644 index cb5cb1c67c73..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/QueryProcessor.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* - * - * 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: QueryProcessor.hxx,v $ - * $Revision: 1.3.26.1 $ - * - * 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 _XMLSEARCH_QE_QUERYPROCESSOR_HXX_ -#define _XMLSEARCH_QE_QUERYPROCESSOR_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> -#include <qe/Query.hxx> -#include <qe/Search.hxx> - - -namespace xmlsearch { - - namespace qe { - - - class QueryStatement - { - public: - - QueryStatement( sal_Int32 nHits, - const std::vector< rtl::OUString >& terms, - const rtl::OUString& scope ) - : nHits_( nHits ), - terms_( terms ), - scope_( scope ) - { - } - - ~QueryStatement() - { - } - - - sal_Int32 getHitCount() const { return nHits_; } - - const std::vector< rtl::OUString >& getTerms() const { return terms_; } - - const rtl::OUString getScope() const { return scope_; } - - - private: - - sal_Int32 nHits_; - std::vector< rtl::OUString > terms_; - rtl::OUString scope_; - - }; - - - - class QueryResults - { - friend class QueryHitIterator; - - public: - - QueryResults( Query*, sal_Int32 ); - - ~QueryResults(); - - QueryHitIterator* makeQueryHitIterator() const - { - return new QueryHitIterator( this ); - } - - - private: - - std::vector< QueryHitData* > queryHits_; - }; - - - - class QueryProcessor - { - public: - - QueryProcessor( const rtl::OUString& installDir ) - throw( xmlsearch::excep::IOException ); - - ~QueryProcessor(); - - QueryResults* processQuery( const QueryStatement& ment ); - - private: - - static const double INFLpenalty; - - Query* processQuery( Search&,const QueryStatement& ); - - QueryResults* makeQueryResults( Query*,sal_Int32 nHits ); - - XmlIndex env_; - }; - - } - -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/Search.hxx b/xmlhelp/source/cxxhelp/inc/qe/Search.hxx deleted file mode 100644 index f77fe60bf9e8..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/Search.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * 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: Search.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _XMLSEARCH_QE_SEARCH_HXX_ -#define _XMLSEARCH_QE_SEARCH_HXX_ - - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ref.hxx> -#include <rtl/ustring.hxx> -#include <qe/Query.hxx> -#include <qe/XmlIndex.hxx> -#ifndef _XMLSEARCH_DB_CONTEXTTABLES_HXX_ -#include <qe/ContextTables.hxx> -#endif -#include <qe/ConceptData.hxx> -#include <qe/DocGenerator.hxx> - - -class QueryFactoryImpl; - - -namespace xmlsearch { - - namespace qe { - - - class RoleFiller; - - - class Search - { - public: - - Search( XmlIndex* env ); - ~Search(); - - Query* addQuery( const rtl::OUString& context, - sal_Int32 nValidTerms,sal_Int32 nMissingTerms,sal_Int32 nHits, - double variantPenalty, - const std::vector< sal_Int32 >& primary, - const std::vector< std::vector< sal_Int32 > >& columns ); - - void startSearch(); - - - private: - - XmlIndex* env_; - QueryFactoryImpl* queryFactory_; - NextDocGeneratorHeap nextDocGenHeap_; - GeneratorHeap genHeap_; - ConceptGroupGenerator firstGenerator_; - std::vector< Query* > queries_; - ConceptData** conceptVisitor_; - std::vector< rtl::Reference< ConceptData > > conceptData_; - sal_Int32 free2_,limit_,document_,max_,base_,startingIndex_,nConcepts_; - sal_Int32 *concepts_; - std::vector<sal_Int32> docConcepts_,queryMasks_,maxConcepts_,kTable_,offsets_; - - sal_Int32 dataL_; - sal_Int8 *data_; - - void addTerm( sal_Int32 col,sal_Int32 concept,double score ); - - sal_Int32 partition( sal_Int32 p,sal_Int32 r ); - - void quicksort( sal_Int32 p,sal_Int32 r ); - - void searchDocument(); - - sal_Int32 nextDocument( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException ); - - bool openDocumentIndex( sal_Int32 docNo ) throw( xmlsearch::excep::XmlSearchException ); - - ConceptGroupGenerator* makeGenerator( sal_Int32 group ) throw( xmlsearch::excep::XmlSearchException ); //t - - sal_Int32 indexOf( sal_Int32 concept ) throw( xmlsearch::excep::XmlSearchException ); - }; - - - } - -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx b/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx deleted file mode 100644 index ba9664032bf9..000000000000 --- a/xmlhelp/source/cxxhelp/inc/qe/XmlIndex.hxx +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * 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: XmlIndex.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _XMLSEARCH_QE_XMLINDEX_HXX_ -#define _XMLSEARCH_QE_XMLINDEX_HXX_ - -#ifndef INCLUDED_STL_VECTOR -#include <vector> -#define INCLUDED_STL_VECTOR -#endif -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> -#include <qe/ContextTables.hxx> -#include <db/BtreeDict.hxx> -#include <util/IndexAccessor.hxx> - - -namespace xmlsearch { - - namespace qe { - - - class QueryHit; - class QueryHitData; - class NonnegativeIntegerGenerator; - - - class XmlIndex - { - public: - - XmlIndex( const rtl::OUString& indexDir ) - throw( xmlsearch::excep::IOException ); - - ~XmlIndex(); - - ContextTables* getContextInfo() { return contextTables_; } - - - sal_Int32 fetch( const rtl::OUString& key ) const throw( xmlsearch::excep::XmlSearchException ) - { - return dict_.fetch( key ); - } - - rtl::OUString fetch( sal_Int32 key ) const throw( xmlsearch::excep::XmlSearchException ) - { - return dict_.fetch( key ); - } - - std::vector< sal_Int32 > withPrefix( const rtl::OUString& prefix ) const throw( xmlsearch::excep::XmlSearchException ) - { - return dict_.withPrefix( prefix ); - } - - bool occursInText( sal_Int32 concept ); - - void reset(); - - void resetContextSearch() { contextTables_->resetContextSearch(); } - - NonnegativeIntegerGenerator* getDocumentIterator( sal_Int32 concept ); - - rtl::OUString documentName( sal_Int32 docNumber ) throw( xmlsearch::excep::XmlSearchException ); - - QueryHitData* hitToData( QueryHit* ); - - sal_Int8* getPositions( sal_Int32&,sal_Int32 docNo ) throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 getDocumentIndex( sal_Int32 docNo ) { return microIndexOffsets_[ docNo ] - currentBatchOffset_; } - - - private: - - sal_Int32 currentBatchOffset_,maxDocNumberInCache_; - - xmlsearch::util::IndexAccessor indexAccessor_; - xmlsearch::util::RandomAccessStream* positionsFile_; - xmlsearch::db::BtreeDict dict_; - - ContextTables* contextTables_; - - sal_Int32 allListsL_; - sal_Int8* allLists_; - - bool allInCache_; - sal_Int32 positionsL_; - sal_Int8 *positions_; - - sal_Int32 contextsDataL_; - sal_Int8 *contextsData_; - - sal_Int32 linkNamesL_; - rtl::OUString* linkNames_; - - std::vector< sal_Int32 > concepts_,offsets_,documents_,microIndexOffsets_,titles_,contextsOffsets_; - - void readMicroindexes( sal_Int32 docNo ) throw( xmlsearch::excep::IOException ); - }; - - - } - -} - - - -#endif - diff --git a/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx b/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx index d31a9d03d1b4..246d647603ee 100644 --- a/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx +++ b/xmlhelp/source/cxxhelp/inc/util/ConceptList.hxx @@ -58,18 +58,6 @@ namespace xmlsearch { void value( sal_Int32 val ) { value_ += val; } - sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) - { - value_ = 0; - sal_Int32 ret = list_.readNext( k_,this ) ? value_ : END; - return ret; - } - - sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) - { - return list_.readNext( k_,this) ? value_ : END; - } - private: sal_Int32 k_,value_; diff --git a/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx b/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx deleted file mode 100644 index 1a14383af980..000000000000 --- a/xmlhelp/source/cxxhelp/inc/util/DBEnvImpl.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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: DBEnvImpl.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _XMLSEARCH_DB_DBENVIMPL_HXX_ -#define _XMLSEARCH_DB_DBENVIMPL_HXX_ -#endif - - -#include <rtl/ustring.hxx> -#include <db/DBEnv.hxx> -#include <util/RandomAccessStream.hxx> -#include <db/Block.hxx> -#include <util/IndexAccessor.hxx> - -namespace xmlsearch { - - namespace util { - - - class DBEnvImpl - : public xmlsearch::db::DBEnv - { - public: - - DBEnvImpl( const IndexAccessor& indexDir ); - virtual ~DBEnvImpl(); - - virtual sal_Int32 getEntryHeaderLen() const; - virtual sal_Int32 getBlockCount() const; - virtual sal_Int32 getMaximumBlockCount() const; - virtual sal_Int32 getDataLen() const; - virtual sal_Int32 getBlockLen() const; - virtual void read( sal_Int32 blNum,xmlsearch::db::Block*& block ) const; - virtual void write( sal_Int32 blNum,xmlsearch::db::Block* block ); - - - private: - - xmlsearch::util::RandomAccessStream* file_; - }; - - - } - -} diff --git a/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx b/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx index fcc5ee35ba00..2f68133d7f6f 100644 --- a/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx +++ b/xmlhelp/source/cxxhelp/inc/util/Decompressor.hxx @@ -60,35 +60,17 @@ namespace xmlsearch { virtual sal_Int32 getNextByte() = 0; - sal_Int32 read( sal_Int32 kBits ) throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 ascendingDecode( sal_Int32 k,sal_Int32 start,sal_Int32 *concepts ) - throw( xmlsearch::excep::XmlSearchException ); - - void ascDecode( sal_Int32 k,std::vector< sal_Int32 >& array) throw( xmlsearch::excep::XmlSearchException ); - - void decode(sal_Int32 k, sal_Int32* array ) throw( xmlsearch::excep::XmlSearchException ); - - void decode( sal_Int32 k,std::vector< sal_Int32 >& array) throw( xmlsearch::excep::XmlSearchException ); - virtual void initReading() { toRead_ = 0; } - bool readNext( sal_Int32 k,CompressorIterator* it) throw( xmlsearch::excep::XmlSearchException ); - private: static const sal_Int32 BitsInByte; static const sal_Int32 NBits; sal_Int32 readByte_, toRead_, path_; - - sal_Int32 read() throw( xmlsearch::excep::XmlSearchException ); - - sal_Int32 countZeroes() throw( xmlsearch::excep::XmlSearchException ); - }; diff --git a/xmlhelp/source/cxxhelp/inc/util/IndexAccessor.hxx b/xmlhelp/source/cxxhelp/inc/util/IndexAccessor.hxx deleted file mode 100644 index edae2cb85724..000000000000 --- a/xmlhelp/source/cxxhelp/inc/util/IndexAccessor.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * 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: IndexAccessor.hxx,v $ - * $Revision: 1.3 $ - * - * 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 _XMLSEARCH_UTIL_INDEXACCESSOR_HXX_ -#define _XMLSEARCH_UTIL_INDEXACCESSOR_HXX_ - - -#include <rtl/ustring.hxx> -#include <excep/XmlSearchExceptions.hxx> - -namespace xmlsearch { - - namespace util { - - class RandomAccessStream; - - class IndexAccessor - { - public: - - enum ACCESSKIND { READ, - WRITE, - READWRITE }; - - - IndexAccessor( const rtl::OUString& dirName ) - { - if( dirName.getLength() ) - { - if( dirName.getStr()[dirName.getLength()-1] != sal_Unicode( '/' ) ) - dirName_ = ( dirName + rtl::OUString::createFromAscii( "/" ) ) ; - else - dirName_ = dirName; - } - } - - - ~IndexAccessor() - { - } - - - IndexAccessor( const IndexAccessor& accessor ) - { - dirName_ = accessor.dirName_; - } - - - RandomAccessStream* getStream( const rtl::OUString& fileName, - const rtl::OUString& how ) const; - - - sal_Int32 readByteArray( sal_Int8*& data, const rtl::OUString& fileName ) - throw( xmlsearch::excep::IOException ); - - private: - - rtl::OUString dirName_; - - }; - - } -} - - -#endif diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 578c428d6a35..c96378e15ed7 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -1062,7 +1062,8 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& ja } Reference< XHierarchicalNameAccess > Databases::findJarFileForPath - ( const rtl::OUString& jar, const rtl::OUString& Language, const rtl::OUString& path ) + ( const rtl::OUString& jar, const rtl::OUString& Language, + const rtl::OUString& path, rtl::OUString* o_pExtensionPath ) { Reference< XHierarchicalNameAccess > xNA; if( ! jar.getLength() || @@ -1074,7 +1075,7 @@ Reference< XHierarchicalNameAccess > Databases::findJarFileForPath JarFileIterator aJarFileIt( m_xContext, *this, jar, Language ); Reference< XHierarchicalNameAccess > xTestNA; Reference< deployment::XPackage > xParentPackageBundle; - while( (xTestNA = aJarFileIt.nextJarFile( xParentPackageBundle )).is() ) + while( (xTestNA = aJarFileIt.nextJarFile( xParentPackageBundle, o_pExtensionPath )).is() ) { if( xTestNA.is() && xTestNA->hasByHierarchicalName( path ) ) { @@ -1663,7 +1664,7 @@ rtl::OUString KeyDataBaseFileIterator::implGetDbFileFromPackage // class JarFileIterator Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile - ( Reference< deployment::XPackage >& o_xParentPackageBundle ) + ( Reference< deployment::XPackage >& o_xParentPackageBundle, rtl::OUString* o_pExtensionPath ) { Reference< XHierarchicalNameAccess > xNA; @@ -1687,6 +1688,8 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile break; xNA = implGetJarFromPackage( xHelpPackage ); + if( xNA.is() && o_pExtensionPath != NULL ) + *o_pExtensionPath = xHelpPackage->getURL(); break; } @@ -1697,6 +1700,8 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile break; xNA = implGetJarFromPackage( xHelpPackage ); + if( xNA.is() && o_pExtensionPath != NULL ) + *o_pExtensionPath = xHelpPackage->getURL(); break; } case END_REACHED: diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx index f098f8109b34..7839b080c1c6 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.hxx +++ b/xmlhelp/source/cxxhelp/provider/databases.hxx @@ -271,8 +271,8 @@ namespace chelp { const rtl::OUString& Language ); com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > - findJarFileForPath( const rtl::OUString& jar, - const rtl::OUString& Language, const rtl::OUString& path ); + findJarFileForPath( const rtl::OUString& jar, const rtl::OUString& Language, + const rtl::OUString& path, rtl::OUString* o_pExtensionPath = NULL ); /** * Maps a given language-locale combination to language. @@ -533,7 +533,8 @@ namespace chelp { {} com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > - nextJarFile( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle ); + nextJarFile( com::sun::star::uno::Reference< com::sun::star::deployment::XPackage >& o_xParentPackageBundle, + rtl::OUString* o_pExtensionPath = NULL ); private: com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index 0d1d4c4c2424..4fef867ee6fc 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/script/XInvocation.hpp> -#include <qe/QueryProcessor.hxx> #ifndef INCLUDED_STL_ALGORITHM #include <algorithm> #define INCLUDED_STL_ALGORITHM @@ -47,6 +46,8 @@ #define INCLUDED_STL_SET #endif +#include <qe/Query.hxx>
+#include <qe/DocGenerator.hxx>
#include "resultsetforquery.hxx" #include "databases.hxx" diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 59ffaa2aa6c9..6c17cd6dd847 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -992,55 +992,65 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, RTL_TEXTENCODING_UTF8 ) + rtl::OString('\''); } - rtl::OString aPureExtensionId; - rtl::OString aExpandedExtensionPath; - if( !aPureProgramm.getLength() ) + // Do we need to add extension path? + ::rtl::OUString aExtensionPath; + rtl::OUString aJar = urlParam->get_jar(); + + bool bAddExtensionPath = false;
+ sal_Int32 nQuestionMark1 = aJar.indexOf( sal_Unicode('?') ); + sal_Int32 nQuestionMark2 = aJar.lastIndexOf( sal_Unicode('?') ); + if( nQuestionMark1 != -1 && nQuestionMark2 != -1 && nQuestionMark1 != nQuestionMark2 ) { - // Extension jar file? Search for ? - rtl::OUString aJar = urlParam->get_jar(); - sal_Int32 nQuestionMark1 = aJar.indexOf( sal_Unicode('?') ); - sal_Int32 nQuestionMark2 = aJar.lastIndexOf( sal_Unicode('?') ); - if( nQuestionMark1 != -1 && nQuestionMark2 != -1 && nQuestionMark1 != nQuestionMark2 ) - { - // ExtensionPath - ::rtl::OUString aExtensionPath = aJar.copy( nQuestionMark1 + 1, nQuestionMark2 - nQuestionMark1 - 1 ); - - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - Reference< XPropertySet > xProps( xFactory, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - Reference< XComponentContext > xContext; - if (xProps.is()) - { - xProps->getPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext; - } - if( !xContext.is() ) - { - throw RuntimeException( - ::rtl::OUString::createFromAscii( "InputStreamTransformer::InputStreamTransformer(), no XComponentContext" ), - Reference< XInterface >() ); - } + aExtensionPath = aJar.copy( nQuestionMark1 + 1, nQuestionMark2 - nQuestionMark1 - 1 ); + bAddExtensionPath = true; + } + else + { + // Path not yet specified, search directly + Reference< XHierarchicalNameAccess > xNA = pDatabases->findJarFileForPath + ( aJar, urlParam->get_language(), urlParam->get_path(), &aExtensionPath ); + if( xNA.is() && aExtensionPath.getLength() ) + bAddExtensionPath = true; + } - rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionPath, xContext ); - aExpandedExtensionPath = rtl::OUStringToOString( aOUExpandedExtensionPath, osl_getThreadTextEncoding() ); - - // Add extension language part - rtl::OString aExtensionLanguage = aPureLanguage; - if( aExtensionLanguage.getLength() > 2 ) - aExtensionLanguage = aExtensionLanguage.copy( 0, 2 ); - aExpandedExtensionPath += rtl::OString('/'); - aExpandedExtensionPath += aExtensionLanguage; - parString[last++] = "ExtensionPath"; - parString[last++] = rtl::OString('\'') + aExpandedExtensionPath + rtl::OString('\''); - - // ExtensionId - sal_Int32 iSlash = aPath.indexOf( '/' ); - if( iSlash != -1 ) - aPureExtensionId = aPath.copy( 0, iSlash ); - - parString[last++] = "ExtensionId"; - parString[last++] = rtl::OString('\'') + aPureExtensionId + rtl::OString('\''); + if( bAddExtensionPath ) + { + Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + Reference< XPropertySet > xProps( xFactory, UNO_QUERY ); + OSL_ASSERT( xProps.is() ); + Reference< XComponentContext > xContext; + if (xProps.is()) + { + xProps->getPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext; } + if( !xContext.is() ) + { + throw RuntimeException( + ::rtl::OUString::createFromAscii( "InputStreamTransformer::InputStreamTransformer(), no XComponentContext" ), + Reference< XInterface >() ); + } + + rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionPath, xContext ); + rtl::OString aExpandedExtensionPath = rtl::OUStringToOString( aOUExpandedExtensionPath, osl_getThreadTextEncoding() ); + + // Add extension language part + rtl::OString aExtensionLanguage = aPureLanguage; + if( aExtensionLanguage.getLength() > 2 ) + aExtensionLanguage = aExtensionLanguage.copy( 0, 2 ); + aExpandedExtensionPath += rtl::OString('/'); + aExpandedExtensionPath += aExtensionLanguage; + parString[last++] = "ExtensionPath"; + parString[last++] = rtl::OString('\'') + aExpandedExtensionPath + rtl::OString('\''); + + // ExtensionId + rtl::OString aPureExtensionId; + sal_Int32 iSlash = aPath.indexOf( '/' ); + if( iSlash != -1 ) + aPureExtensionId = aPath.copy( 0, iSlash ); + + parString[last++] = "ExtensionId"; + parString[last++] = rtl::OString('\'') + aPureExtensionId + rtl::OString('\''); } for( int i = 0; i < last; ++i ) diff --git a/xmlhelp/source/cxxhelp/qe/ConceptData.cxx b/xmlhelp/source/cxxhelp/qe/ConceptData.cxx deleted file mode 100644 index 83399d370c03..000000000000 --- a/xmlhelp/source/cxxhelp/qe/ConceptData.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* - * - * 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: ConceptData.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <qe/ConceptData.hxx> -#include <qe/Query.hxx> -#include <qe/DocGenerator.hxx> - - -using namespace xmlsearch::qe; - - -const sal_Int32 ConceptData::ProxPerTerm = 10; - - -ConceptData::ConceptData( sal_Int32 id, - sal_Int32 role, - double score, - sal_Int32 queryNo, - sal_Int32 nColumns, - ContextTables* contextTables ) - : queryNo_( sal_uInt8( queryNo & 0xF ) ), - nColumns_( sal_uInt8( nColumns & 0xF ) ), - role_( sal_uInt8( role & 0xF ) ), - concept_( id ), - proximity_( nColumns * ProxPerTerm ), - penalty_( score ), - m_nRefcount( 0 ), - ctx_( contextTables ), - next_( 0 ) -{ -} - - -ConceptData::~ConceptData() -{ -} - - -void ConceptData::runBy( std::vector< Query* >& queries ) -{ - rtl::Reference< ConceptData > cd( this ); - do - { - Query* query = queries[ cd->queryNo_ ]; - query->updateEstimate( cd->role_,cd->penalty_ ); - } - while( (cd = cd->next_).is() ); -} - - -void ConceptData::addLast( ConceptData* r ) -{ - if( next_.is() ) - next_->addLast( r ); - else - next_ = r; -} - - -void ConceptData::generateFillers( std::vector< RoleFiller* >& array, sal_Int32 pos ) -{ - if( array[ queryNo_ ] != RoleFiller::STOP() ) // not 'prohibited' - { - sal_Int32 wcl = ctx_->wordContextLin( pos ); - roleFillers_.push_back( new RoleFiller( nColumns_, - this, - role_, - pos, - wcl, - pos + proximity_ ) ); - roleFillers_.back()->use( array, queryNo_ ); - } - // !!! maybe eliminate tail recursion - if( next_.is() ) - next_->generateFillers( array,pos ); -} diff --git a/xmlhelp/source/cxxhelp/qe/ContextTables.cxx b/xmlhelp/source/cxxhelp/qe/ContextTables.cxx deleted file mode 100644 index 139348aeb153..000000000000 --- a/xmlhelp/source/cxxhelp/qe/ContextTables.cxx +++ /dev/null @@ -1,572 +0,0 @@ -/************************************************************************* - * - * 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: ContextTables.cxx,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" - -#ifndef _rtl_MEMORY_H_ -#include <rtl/memory.h> -#endif -#include <qe/ContextTables.hxx> -#ifndef _XMLSEARCH_UTIL_BYTEARRAYDECOMPRESSOR_HXX_ -#include <util/Decompressor.hxx> -#endif - -using namespace xmlsearch; -using namespace xmlsearch::qe; - - - -Tables::Tables( ContextTables* p ) - : initialWordsCached_( new sal_Int32[ initialWordsCachedL_ = p->initialWordsL_ ] ), - destsCached_( new sal_Int32[ destsCachedL_ = p->destsL_ ] ), - linkTypesCached_( new sal_Int32[ linkTypesCachedL_ = p->linkTypesL_ ] ), - seqNumbersCached_( new sal_Int32[ seqNumbersCachedL_ = p->seqNumbersL_ ] ) -{ - rtl_copyMemory( (void*)initialWordsCached_, - (void*)p->initialWords_, - sizeof(sal_Int32) * p->initialWordsL_ ); - - rtl_copyMemory( (void*)destsCached_, - (void*)p->dests_, - sizeof(sal_Int32) * p->destsL_ ); - - rtl_copyMemory( (void*)linkTypesCached_, - (void*)p->linkTypes_, - sizeof(sal_Int32) * p->linkTypesL_ ); - - rtl_copyMemory( (void*)seqNumbersCached_, - (void*)p->seqNumbers_, - sizeof(sal_Int32) * p->seqNumbersL_ ); -} - - - -Tables::~Tables() -{ - delete[] seqNumbersCached_; - delete[] linkTypesCached_; - delete[] destsCached_; - delete[] initialWordsCached_; -} - - - -void Tables::setTables( ContextTables* p ) -{ - delete[] p->initialWords_; - p->initialWordsL_ = initialWordsCachedL_; - p->initialWords_ = initialWordsCached_; - initialWordsCached_ = 0; - - delete[] p->dests_; - p->destsL_ = destsCachedL_; - p->dests_ = destsCached_; - destsCached_ = 0; - - delete[] p->linkTypes_; - p->linkTypesL_ = linkTypesCachedL_; - p->linkTypes_ = linkTypesCached_; - linkTypesCached_ = 0; - - delete[] p->seqNumbers_; - p->seqNumbersL_ = seqNumbersCachedL_; - p->seqNumbers_ = seqNumbersCached_; - seqNumbersCached_ = 0; - - p->nTextNodes_ = initialWordsCachedL_; -} - - - - -ContextTables::ContextTables( const std::vector< sal_Int32 >& offsets, - sal_Int32 contextDataL,sal_Int8 *contextData, - sal_Int32 linkNamesL,rtl::OUString *linkNames ) - : lastDocNo_( -1 ), - initialWordsL_( 0 ), - destsL_( 0 ), - linkTypesL_( 0 ), - seqNumbersL_( 0 ), - markersL_( 0 ), - initialWords_( 0 ), - dests_( 0 ), - linkTypes_( 0 ), - seqNumbers_( 0 ), - markers_( 0 ), - contextDataL_( contextDataL ), - contextData_( contextData ), - linkNamesL_( linkNamesL ), - linkNames_( linkNames ), - cache_( offsets.size() ), - kTable_( 5 ), - auxArray_( 4096 ), - offsets_( offsets ) -{ - for( sal_uInt32 i = 0; i < offsets_.size(); ++i ) - cache_[i] = 0; -} - - - -ContextTables::~ContextTables() -{ - delete[] markers_; - delete[] seqNumbers_; - delete[] linkTypes_; - delete[] dests_; - delete[] initialWords_; - - for( sal_uInt32 i = 0; i < cache_.size(); ++i ) - delete cache_[i]; -} - - - -void ContextTables::setMicroindex( sal_Int32 docNo ) throw( excep::XmlSearchException ) -{ - if( docNo != lastDocNo_ ) - { // check if we need to do anything - if( cache_[ docNo ] ) - cache_[ docNo ]->setTables( this ); - else - { - sal_Int32 offset = offsets_[ docNo ]; - sal_Int32 k0 = contextData_[ offset ] & 0xFF; - util::ByteArrayDecompressor compr( contextDataL_,contextData_,offset + 1 ); - kTable_.clear(); - compr.decode( k0,kTable_ ); - // decompress initialWords into auxiliary array - auxArray_.clear(); - compr.ascDecode( kTable_[0],auxArray_ ); // _initialWords - - delete[] initialWords_; - initialWords_ = new sal_Int32[ initialWordsL_ = auxArray_.size() ]; - sal_Int32 k; - for( k = 0; k < initialWordsL_; ++k ) //?opt - initialWords_[k] = auxArray_[k]; - - nTextNodes_ = initialWordsL_; - // decompress destinations into auxiliary array - auxArray_.clear(); - compr.decode( kTable_[1],auxArray_ ); // _dests - auxArray_.push_back( -1 ); // sentinel, root - - delete[] dests_; - dests_ = new sal_Int32[ destsL_ = auxArray_.size() ]; - for( k = 0; k < destsL_; ++k ) //?opt - dests_[k] = auxArray_[k]; - - delete[] linkTypes_; - linkTypes_ = new sal_Int32[ linkTypesL_ = destsL_ - nTextNodes_ - 1 ]; - compr.decode( kTable_[2],linkTypes_ ); - - delete[] seqNumbers_; - seqNumbers_ = new sal_Int32[ seqNumbersL_ = destsL_ - 1 ]; - compr.decode( kTable_[ 3 ],seqNumbers_ ); - - cache_[docNo] = new Tables( this ); - } - - lastDocNo_ = docNo; - delete[] markers_; - markers_ = new sal_Int32[ markersL_ = destsL_ ]; - } - initialWordsIndex_ = 0; -} - - - -sal_Int32 ContextTables::linkCode( const rtl::OUString& linkName_ ) -{ - for( sal_Int32 i = 0; i < linkNamesL_; ++i ) - if( linkName_ == linkNames_[i] ) - return i; - return -1; // when not found -} - - -bool* ContextTables::getIgnoredElementsSet( sal_Int32& len, - const sal_Int32 ignoredElementsL, - const rtl::OUString* ignoredElements ) -{ - bool *result = 0; - if( ignoredElements && ignoredElementsL > 0 ) - { - for( sal_Int32 i = 0; i < ignoredElementsL; ++i ) - { - sal_Int32 code = linkCode( ignoredElements[i] ); - if( code > -1 ) - { - if( ! result ) - result = new bool[ len = linkNamesL_ ]; - - result[ code ] = true; - } - } - } - return result; -} - - - -bool ContextTables::notIgnored( sal_Int32 ctx, - sal_Int32 ignoredElementsL,bool* ignoredElements ) -{ - (void)ignoredElementsL; - - do - { - if( ignoredElements[ linkTypes_[ ctx ] ] ) - return false; - } - while( ( ctx = dests_[ ctx ] ) > -1 ); // parentContext 'hand inlined' - return true; -} - - -/* - * starting with ctx and going up the ancestry tree look for the first - * context with the given linkCode - */ - -sal_Int32 ContextTables::firstParentWithCode( const sal_Int32 pos,const sal_Int32 linkCode_ ) -{ - sal_Int32 ctx = dests_[ wordContextLin(pos) ]; // first parent of text node - const sal_Int32 shift = nTextNodes_; - const sal_Int32 limit = destsL_ - 1; - while( linkTypes_[ ctx - shift ] != linkCode_ ) - if( ( ctx = dests_[ ctx ] ) == limit ) - return -1; - return ctx; -} - - -void ContextTables::resetContextSearch() -{ - initialWordsIndex_ = 0; -} - - -sal_Int32 ContextTables::wordContextLin(sal_Int32 wordNumber) -{ - for (sal_Int32 i = initialWordsIndex_; i < nTextNodes_; ++i ) - if (initialWords_[i] > wordNumber) - { // first such i - // - 1 if wordNumbers can be the same - initialWordsIndex_ = i; // cached to speed up next search - return i - 1; - } - return nTextNodes_ - 1; -} - - -// void ContextTables::appendSegment( sal_Int32 context,rtl::OUStringBuffer& result ) -// { -// result.append( context < nTextNodes_ ? -// rtl::OUString::createFromAscii( "text()" ) : -// linkNames_[ linkTypes_[ context - nTextNodes_ ] ] ); -// result.append(sal_Unicode( '[' ) ); -// result.append( seqNumbers_[ context ] ); -// result.append(sal_Unicode( "]/" ) ); -// } - - -// /* -// * XPath (forking) location of the hit -// */ - -// void ContextTables::hitLocation( sal_Int32 termsL,rtl::OUString* terms, -// sal_Int32 matchesL,sal_Int32* matches, -// StringBuffer& result ) -// { -// const sal_Int32 N = termsL; -// std::vector< sal_Int32 > stacks( N ); -// sal_Int32* wordNumbers = new sal_Int32[N]; -// std::vector< sal_Int32 > stack; -// sal_Int32 lastInitialWordIndex = -1; -// sal_Int32 pattern = 0,context = 0,nPopped = 0,pathStart = 0,pathEnd = 0; -// for( sal_Int32 i = 0,marker = 1; i < N; i++,marker <<= 1 ) -// if ( terms[i] ) -// { -// const sal_Int32 wordNumber = matches[i*2 + 1]; -// const sal_Int32 initialWordIndex = findIndexBin(wordNumber); -// wordNumbers[i] = wordNumber - initialWords_[initialWordIndex] + 1; -// if( initialWordIndex == lastInitialWordIndex ) // save work -// ; // do nothing, path will be reused -// else -// { -// pattern |= marker; -// stack = stacks[i] = new IntegerArray(); - -// context = initialWordIndex; -// do -// { -// const sal_Int32 parent = dests_[context]; -// if( parent != -1 ) -// { -// stack.add( context ); -// markers_[context] |= marker; -// context = parent; -// } -// else -// break; -// } -// while( true ); -// lastInitialWordIndex = initialWordIndex; -// } -// } - -// // find and output common path -// // process first non-missing match - -// sal_Int32 i = 0, marker = 1, nMissing = 0; - -// // find first non-missing matching term -// // there has to be at least one if the hit was built -// // count potential leading missing terms to output appropriate elements -// // before outputting elements for matches - -// for ( ; i < N; i++,marker <<= 1 ) -// if (terms[i] != null) -// { -// result.append( rtl::OUString::createFromAscii( "<Matches path=\"" ) ); -// stack = stacks[i]; -// while (stack.size() > 0) -// { -// context = stack.popLast(); -// if ( markers_[context] == pattern ) -// { -// markers_[context] = 0; -// appendSegment( context,result ); // belongs to common -// context = -1; // used -// ++nPopped; -// } -// else -// break; -// } -// // end of 'matches' && common path -// result.append("\">"); -// // output elements for any leading missingTerms -// while (--nMissing >= 0) -// result.append("<MissingTerm/>"); - -// result.append("<Match term=\""); -// result.append(terms[i]); -// result.append("\" path=\""); -// pathStart = result.getLength(); -// if (context != -1) -// { -// appendSegment(context, result); -// markers_[context] = 0; -// } -// while (stack.size() > 0 ) -// { -// context = stack.popLast(); -// appendSegment(context, result); -// markers_[context] = 0; -// } - -// pathEnd = result.length(); - -// result.append("\" tokenNumber=\""); -// result.append(wordNumbers[i]); -// result.append("]\"/>"); - -// break; // just the first non-zero -// } -// else -// ++nMissing; // only count leading missing terms - -// // process the remaining matches -// for (i++, marker <<= 1 ; i < N; i++, marker <<= 1) -// if (terms[i] != null) { -// result.append("<Match term=\""); -// result.append(terms[i]); -// result.append("\" path=\""); -// stack = stacks[i]; -// if (stack == null) // reuse previously generated path -// result.append(result.substring(pathStart, pathEnd)); -// else { -// stack.pop(nPopped); -// pathStart = result.length(); -// while (stack.cardinality() > 0) { -// context = stack.popLast(); -// appendSegment(context, result); -// _markers[context] = 0; -// } -// pathEnd = result.length(); -// } -// result.append("\" tokenNumber=\""); -// result.append(wordNumbers[i]); -// result.append("]\"/>"); -// } -// else -// result.append("<MissingTerm/>"); -// result.append("</Matches>"); -// } - - -// /* -// * QueryHitData is initialized in the caller -// * this function fills the commonPath for all matching terms -// * and relative paths for the individual terms -// */ - -// void ContextTables::hitLocation(String[] terms, sal_Int32[] matches, QueryHitData data) { -// StringBuffer buffer = new StringBuffer(512); -// const sal_Int32 N = terms.length; -// IntegerArray[] stacks = new IntegerArray[N]; -// sal_Int32[] wordNumbers = new sal_Int32[N]; -// IntegerArray stack; -// sal_Int32 lastInitialWordIndex = -1; -// sal_Int32 pattern = 0, nPopped = 0, pathStart = 0, pathEnd = 0; -// for (sal_Int32 i = 0, marker = 1; i < N; i++, marker <<= 1) -// if (terms[i] != null) { -// const sal_Int32 wordNumber = matches[i*2 + 1]; -// const sal_Int32 initialWordIndex = findIndexBin(wordNumber); -// wordNumbers[i] = wordNumber - _initialWords[initialWordIndex] + 1; -// if (initialWordIndex == lastInitialWordIndex) // save work -// ; // do nothing, path will be reused -// else { -// pattern |= marker; -// stack = stacks[i] = new IntegerArray(); -// for (sal_Int32 ctx = initialWordIndex;;) { -// const sal_Int32 parent = _dests[ctx]; -// if (parent != -1) { -// stack.add(ctx); -// _markers[ctx] |= marker; -// ctx = parent; -// } -// else -// break; -// } -// lastInitialWordIndex = initialWordIndex; -// } -// } -// // find and output common path -// // process first match -// StringBuffer path = new StringBuffer(256); -// String previousPath = null; // we may be copying subpaths from it -// sal_Int32 i = 0, marker = 1; -// for ( ; i < N; i++, marker <<= 1) -// if (terms[i] != null) { -// sal_Int32 context = 0; -// stack = stacks[i]; -// while (stack.cardinality() > 0) { -// context = stack.popLast(); -// if (_markers[context] == pattern) { -// _markers[context] = 0; -// appendSegment(context, path); // belongs to common -// context = -1; // used -// ++nPopped; -// } -// else -// break; -// } -// data.setCommonPath(path.toString()); -// // end of 'matches' && common path -// path.setLength(0); // will now be used for relative paths -// pathStart = 0; -// if (context != -1) { -// appendSegment(context, path); -// _markers[context] = 0; -// } -// while (stack.cardinality() > 0) { -// context = stack.popLast(); -// appendSegment(context, path); -// _markers[context] = 0; -// } -// pathEnd = path.length(); -// data.setMatchLocation(i, previousPath = path.toString(), wordNumbers[i]); -// break; // just the first non-zero -// } - -// // process the remaining matches -// for (i++, marker <<= 1 ; i < N; i++, marker <<= 1) -// if (terms[i] != null) { -// path.setLength(0); -// stack = stacks[i]; -// if (stack == null) // reuse previously generated path -// path.append(previousPath.substring(pathStart, pathEnd)); -// else { -// stack.pop(nPopped); -// pathStart = path.length(); -// while (stack.cardinality() > 0) { -// const sal_Int32 context = stack.popLast(); -// appendSegment(context, path); -// _markers[context] = 0; -// } -// pathEnd = path.length(); -// } -// data.setMatchLocation(i, previousPath = path.toString(), wordNumbers[i]); -// } -// } - -// private sal_Int32 ContextTables::findIndexBin(const sal_Int32 wordNumber) { -// sal_Int32 i = 0, j = _nTextNodes - 1; -// while (i <= j) { -// const sal_Int32 k = (i + j) >>> 1; -// if (_initialWords[k] < wordNumber) -// i = k + 1; -// else if (_initialWords[k] > wordNumber) -// j = k - 1; -// else -// return k; -// } -// return i - 1; -// } - - /* - public void addGoverningFiller(int query, RoleFiller rf, int parent) { - // !!! for now assume just one query - GoverningContext gc = null; - if (_governingContexts[parent] == null) { - // find parent governing context - for (int c = _dests[parent]; ; c = _dests[c]) - if (_governingContexts[c] != null || c == 0) { - // System.out.println("parent found at " + c); - gc = new GoverningContext(c, rf); - break; - } - } - else - gc = new GoverningContext(_governingContexts[parent], rf); - _governingContexts[parent] = gc; - } - */ - - - - - - - - diff --git a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx index b3aea87db3d2..7492e66f9e9b 100644 --- a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx +++ b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx @@ -39,8 +39,6 @@ using namespace xmlsearch::qe; const sal_Int32 NonnegativeIntegerGenerator::END = -1; -const sal_Int32 ConceptGroupGenerator::NConceptsInGroup = 16; -const sal_Int32 ConceptGroupGenerator::BitsInLabel = 4; RoleFiller RoleFiller::roleFiller_; @@ -55,441 +53,12 @@ RoleFiller::RoleFiller() parentContext_( 0 ), limit_( 0 ), next_( 0 ), - fillers_( 0 ), - conceptData_( 0 ) + fillers_( 0 ) { } -RoleFiller::RoleFiller( sal_Int32 nColumns, - ConceptData* first, - sal_Int32 role, - sal_Int32 pos, - sal_Int32 parentContext, - sal_Int32 limit ) - : m_nRefcount( 0 ), - fixedRole_( sal_uInt8( role & 0xF ) ), // primary/constitutive concept/role - next_( 0 ), - fillers_( nColumns ), - conceptData_( first ) -{ - filled_ = sal_Int16( 1 << fixedRole_ ); - begin_ = pos; // offset in file - // _end = _begin + first.getConceptLength(); - end_ = begin_ + 1; - limit_ = limit; - parentContext_ = parentContext; - next_ = 0; - for( sal_uInt32 i = 0; i < fillers_.size(); ++i ) - fillers_[i] = 0; - fillers_[ role ] = this; -} - - RoleFiller::~RoleFiller() { } - - -void RoleFiller::scoreList( Query* query,sal_Int32 document ) -{ - sal_Int32 nColumns = query->getNColumns(); - RoleFiller* candidateHit = this; // function called for the head of list - RoleFiller* next; // lookahead: if overlap, if so, is it better - - // 'candidateHit' always points at the current candidate to be converted to a QueryHit - // 'penalty' is its penalty - // 'next' is used to explore earlier overlapping fillers - // the decision to emit a QueryHit is made when either there's no next - // or next doesn't overlap the current candidate - // the loop's logic makes sure that at emit time there's no better/earlier filler - // to overlap with the candidate - - double penalty_ = candidateHit->penalty( query,nColumns ); - - for( next = candidateHit->next_; next; next = next->next_ ) - if( next->end_ < candidateHit->begin_ ) - { // no overlap - candidateHit->makeQueryHit( query,document,penalty_ ); - candidateHit = next; - penalty_ = candidateHit->penalty( query,nColumns ); - } - else - { // !!! can be computed in two steps - double penalty2 = next->penalty( query,nColumns ); - if( penalty2 <= penalty_ ) - { // prefer next, disregard candidateHit - penalty_ = penalty2; - candidateHit = next; - } - } - candidateHit->makeQueryHit(query,document,penalty_); -} - - - - -void RoleFiller::makeQueryHit( Query* query,sal_Int32 doc,double penalty_ ) -{ - QueryHit* hit = query->maybeCreateQueryHit( penalty_,doc, - begin_,end_,parentContext_ ); - if( hit ) - { - sal_Int32 N; - sal_Int32* matches = hit->getMatches( N ); - N /= 2; - - for( sal_Int32 i = 0,j = 0; i < N; ++i ) - if( filled_ & 1 << i ) - { - matches[ j++ ] = fillers_[ i ]->getConcept(); - matches[ j++ ] = fillers_[ i ]->begin_; - } - else - j += 2; - } -} - - - -sal_Int32 RoleFiller::getConcept() -{ - return conceptData_->getConcept(); -} - - - -void RoleFiller::use( std::vector< RoleFiller*>& place,sal_Int32 query ) -{ - RoleFiller* rf = place[ query ]; - if( rf ) - { - place[ query ] = this; // put at the head of list - next_ = rf; - while( rf->limit_ >= begin_ ) - { - // check if we can grow/improve a hit - // we don't ever replace filler's fixed role - if( fixedRole_ != rf->fixedRole_ && - // in same parent context eg. PARA - rf->parentContext_ == parentContext_ ) - { - if( ( rf->filled_ & ( 1 << fixedRole_ ) ) == 0 ) - { - // not filled yet - rf->filled_ |= 1 << fixedRole_; - rf->fillers_[ fixedRole_ ] = this; - rf->end_ = end_; - } - else - rf->considerReplacementWith( this ); - } - - if( rf->next_ ) - rf = rf->next_; - else - return; - } - } - else - place[query] = this; -} - - -void RoleFiller::considerReplacementWith( RoleFiller* replacement ) -{ - // !!! simplistic for now - // needs gap and out of order - sal_Int32 role = replacement->fixedRole_; - if( replacement->getScore() > fillers_[role]->getScore() ) - fillers_[ role ] = replacement; -} - - - -double RoleFiller::penalty( Query* query,sal_Int32 nColumns ) -{ - sal_Int32 length = end_ - begin_ + 1; - double penalty_ = query->lookupPenalty( filled_ ); - // !!! here is a chance to check against query - // if hit worth scoring further - // might not be if query already has lots of good hits - for( sal_Int32 i = 0; i < nColumns; ++i ) - if( filled_ & ( 1 << i ) ) - { - penalty_ += fillers_[i]->conceptData_->getPenalty(); - //length -= _fillers[i]._conceptData.getConceptLength() + 1; - length -= 2; // !!! ??? c.length is not used ? - if( filled_ >> (i + 1) ) - for( sal_Int32 j = i + 1; j < nColumns; ++j ) - if( ( filled_ & 1 << j ) && fillers_[j]->begin_ < begin_ ) - penalty_ += query->getOutOufOrderPenalty(); - } - double result = penalty_ + length * query->getGapPenalty(); - return result < 0.0 ? 0.0 : result; // !!! quick fix -} - - - -NextDocGenerator::NextDocGenerator( ConceptData* cd,XmlIndex* env ) - : document_( 0 ), - concept_( cd ? cd->getConcept() : -1 ), - queryMask_( cd ? cd->getQueryMask() : -1 ), - terms_( cd ), - iterator_( env->getDocumentIterator( concept_ ) ) -{ -} - - - -void NextDocGeneratorHeap::reset() -{ - for( sal_Int32 i = 0; i < heapSize_; ++i ) - { - delete heap_[i]; heap_[i] = 0; - } - free_ = 0; - nonEmpty_ = false; -} - - - -void NextDocGeneratorHeap::addGenerator( NextDocGenerator* gen ) -{ - if( sal_uInt32( free_ ) == heap_.size() ) - { - heap_.push_back( 0 ); - } - - heap_[free_++] = gen; -} - - - -void NextDocGeneratorHeap::start() -{ - if( ( heapSize_ = free_ ) > 0 ) - { - for( sal_Int32 i = heapSize_ / 2; i >= 0; --i ) - heapify(i); - nonEmpty_ = true; - } - else - nonEmpty_ = false; -} - - -void NextDocGeneratorHeap::step() throw( excep::XmlSearchException ) -{ - if( heap_[0]->next() != NonnegativeIntegerGenerator::END ) - heapify(0); - else if ( heapSize_ > 1 ) - { - delete heap_[0]; - heap_[0] = heap_[--heapSize_]; - heap_[ heapSize_ ] = 0; - heapify(0); - } - else - nonEmpty_ = false; -} - - -void NextDocGeneratorHeap::heapify( sal_Int32 i ) -{ - NextDocGenerator* temp; - for( sal_Int32 r,l,smallest; ; ) - { - r = ( i + 1 ) << 1; - l = r - 1; - smallest = ( l < heapSize_ && heap_[l]->smallerThan( heap_[i] ) ) ? l : i; - if( r < heapSize_ && heap_[r]->smallerThan( heap_[ smallest ] ) ) - smallest = r; - if( smallest != i ) - { - temp = heap_[ smallest ]; - heap_[ smallest ] = heap_[ i ]; - heap_[i] = temp; - i = smallest; - } - else - break; - } -} - - -bool NextDocGeneratorHeap::atDocument( sal_Int32 document ) -{ - return nonEmpty_ && heap_[0]->getDocument() == document; -} - - - - -ConceptGroupGenerator::ConceptGroupGenerator( sal_Int32 dataL,sal_Int8* data,sal_Int32 index,sal_Int32 k ) - : last_( 0 ), - k1_( k ), - k2_( BitsInLabel ), - table_( NConceptsInGroup ), - bits_( new util::ByteArrayDecompressor( dataL,data,index ) ) -{ -} - - - -ConceptGroupGenerator::ConceptGroupGenerator() - : last_( 0 ), - k1_( 0 ), - k2_( BitsInLabel ), - table_( NConceptsInGroup ), - bits_( 0 ) -{ -} - - -ConceptGroupGenerator::~ConceptGroupGenerator() -{ - delete bits_; -} - - -void ConceptGroupGenerator::generateFillers( std::vector< RoleFiller* >& array ) -{ - cData_->generateFillers( array,last_ ); -} - - -bool ConceptGroupGenerator::next() throw( excep::XmlSearchException ) -{ - while( bits_->readNext( k1_,this ) ) - { - sal_Int32 bla = bits_->read( k2_ ); - if( ( cData_ = table_[ bla ] ).is() ) - return true; - } - return false; -} - - -sal_Int32 ConceptGroupGenerator::decodeConcepts( sal_Int32 k, - sal_Int32 shift, - sal_Int32 *concepts ) - throw( excep::XmlSearchException ) -{ - return bits_->ascendingDecode( k,shift,concepts ); -} - - - -void ConceptGroupGenerator::init( sal_Int32 bytesL,sal_Int8* bytes,sal_Int32 index,sal_Int32 k ) -{ - k1_ = k; - delete bits_; - bits_ = new util::ByteArrayDecompressor( bytesL,bytes,index ); - last_ = 0; - for( sal_Int32 i = 0;i < NConceptsInGroup; i++ ) - table_[i] = 0; -} - - - -void ConceptGroupGenerator::addTerms( sal_Int32 index,ConceptData* terms ) -{ - table_[ index ] = terms; -} - - - -void GeneratorHeap::reset() -{ - for( sal_Int32 i = 0; i < heapSize_; ++i ) - { - delete heap_[i]; - heap_[i] = 0; - } - free_ = 0; -} - - -void GeneratorHeap::addGenerator( ConceptGroupGenerator* cd ) -{ - if( sal_uInt32( free_ ) == heap_.size() ) - { - heap_.push_back( 0 ); - } - - heap_[free_++] = cd; -} - - -void GeneratorHeap::buildHeap() -{ - for( sal_Int32 i = heapSize_/2; i >= 0; i-- ) - heapify(i); -} - - -void GeneratorHeap::heapify( sal_Int32 root ) -{ - for( sal_Int32 smallest = 0; ; ) - { - const sal_Int32 right = ( root + 1 ) << 1; - const sal_Int32 left = right - 1; - smallest = ( left < heapSize_ && heap_[left]->position() < heap_[ root ]->position() ) ? left : root; - if( right< heapSize_ && heap_[right]->position() < heap_[smallest]->position() ) - smallest = right; - if( smallest != root ) - { - ConceptGroupGenerator* temp = heap_[smallest]; - heap_[smallest] = heap_[root]; - heap_[root] = temp; - root = smallest; - } - else - break; - } -} - - -bool GeneratorHeap::start( std::vector< RoleFiller* >& array ) throw( xmlsearch::excep::XmlSearchException ) -{ - if( ( heapSize_ = free_ ) > 0 ) - { - for( sal_Int32 i = 0; i < free_; ++i ) - heap_[i]->next(); - - buildHeap(); - heap_[0]->generateFillers( array ); - return true; - } - else - return false; -} - - -bool GeneratorHeap::next( std::vector< RoleFiller* >& array ) throw( xmlsearch::excep::XmlSearchException ) -{ - if( heapSize_ > 0 ) - { - if( ! heap_[0]->next() ) // no more - { - if( heapSize_ > 1) - { - delete heap_[0]; - heap_[0] = heap_[--heapSize_]; - heap_[heapSize_] = 0; - } - else - { - heapSize_ = 0; - return false; - } - } - heapify(0); - heap_[0]->generateFillers( array ); - return true; - } - else - return false; -} diff --git a/xmlhelp/source/cxxhelp/qe/Query.cxx b/xmlhelp/source/cxxhelp/qe/Query.cxx deleted file mode 100644 index 861df3da1ec6..000000000000 --- a/xmlhelp/source/cxxhelp/qe/Query.cxx +++ /dev/null @@ -1,393 +0,0 @@ -/************************************************************************* - * - * 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: Query.cxx,v $ - * $Revision: 1.13 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <qe/Query.hxx> -#include <qe/XmlIndex.hxx> -#include <qe/ConceptData.hxx> -#include <qe/QueryProcessor.hxx> -#include <qe/ContextTables.hxx> - - -using namespace xmlsearch::qe; - - -sal_Int32* QueryHit::getMatches( sal_Int32& matchesL ) -{ - matchesL = matchesL_; - return matches_; -} - - -/******************************************************************************/ -/* */ -/* HitStore */ -/* */ -/******************************************************************************/ - - -HitStore::HitStore( double initialStandard,sal_Int32 limit,sal_Int32 nColumns ) - : limit_( limit ), - nColumns_( nColumns ), - index_( 0 ), - free_( 0 ), - standard_( initialStandard ), - heap_( limit ) -{ - for( sal_uInt32 i = 0; i < heap_.size(); ++i ) - heap_[i] = 0; -} - - - -HitStore::~HitStore() -{ - for( sal_uInt32 i = 0; i < heap_.size(); ++i ) - delete heap_[i]; -} - - - -bool HitStore::goodEnough( double penalty, sal_Int32 begin, sal_Int32 end ) -{ - return free_ == limit_ ? heap_[0]->worseThan( penalty,begin,end ) : true; -} - - -QueryHit* HitStore::createQueryHit( double penalty,sal_Int32 doc,sal_Int32 begin,sal_Int32 end ) -{ - QueryHit* hit = new QueryHit( nColumns_,penalty,doc,begin,end ); - if( free_ == limit_ ) - { // goodEnough'ness checked already - delete heap_[0]; - heap_[0] = hit; - heapify( 0 ); - standard_ = heap_[0]->getPenalty(); - } - else if( free_ < limit_ ) - { - heap_[ free_++ ] = hit; - if( free_ == limit_ ) - { // we have the needed number - for( sal_Int32 i = free_/2; i >= 0; --i ) // build heap - heapify( i ); - standard_ = heap_[0]->getPenalty(); - } - } - return hit; -} - - -struct CompareQueryHit -{ - bool operator()( const QueryHit* l,const QueryHit* r ) - { - return l->compareTo( r ); - } -}; - - -#include <algorithm> - - -QueryHit* HitStore::firstBestQueryHit() -{ - if( free_ > 0) - { - CompareQueryHit bla; - heap_.resize( free_ ); - std::stable_sort( heap_.begin(),heap_.end(),bla ); - index_ = 0; - return nextBestQueryHit(); - } - else - return 0; -} - - -QueryHit* HitStore::nextBestQueryHit() -{ - return index_ < free_ ? heap_[ index_++ ] : 0; -} - - -void HitStore::heapify( sal_Int32 i ) -{ - for( sal_Int32 r,l,worst; ; ) - { - r = (i + 1) << 1; l = r - 1; - worst = l < free_ && heap_[i]->betterThan( heap_[l] ) ? l : i; - if( r < free_ && heap_[ worst ]->betterThan( heap_[r] ) ) - worst = r; - if (worst != i) - { - QueryHit* temp = heap_[ worst ]; - heap_[ worst ] = heap_[ i ]; - heap_[i] = temp; - i = worst; // continue - } - else - break; - } -} - - -// sal_Int32 HitStore::partition( sal_Int32 p,sal_Int32 r ) -// { -// QueryHit* x = heap_[ ((p + r) >> 1) & 0x7FFFFFFF ]; -// sal_Int32 i = p - 1, j = r + 1; -// while( true ) -// { -// while( x->compareTo( heap_[--j] ) ) -// ; -// while( heap_[++i]->compareTo( x ) ) -// ; -// if( i < j ) -// { -// QueryHit* t = heap_[i]; -// heap_[i] = heap_[j]; -// heap_[j] = t; -// } -// else -// return j; -// } -// } - - -// void HitStore::quicksort( sal_Int32 p,sal_Int32 r ) -// { -// while( p < r ) -// { -// sal_Int32 q = partition( p,r ); -// quicksort(p, q); -// p = q + 1; -// } -// } - - - -/******************************************************************************/ -/* */ -/* Query */ -/* */ -/******************************************************************************/ - - -#define MissingTermPenalty 10.0 - - -Query::Query( XmlIndex* env, - sal_Int32 nColumns, - sal_Int32 nHits, - sal_Int32 missingPenaltiesL, - double* missingPenalties ) - : env_( env ), - ctx_( env ? env->getContextInfo() : 0 ), - store_( nColumns * MissingTermPenalty - 0.0001,nHits,nColumns ), - nHitsRequested_( nHits ), - nColumns_( nColumns ), - currentStandard_( nColumns * MissingTermPenalty - 0.0001 ), - missingPenaltyL_( nColumns ), - upperboundTemplateL_( nColumns ), - penaltiesL_( missingPenaltiesL ), - missingPenalty_( new double[ nColumns ] ), - upperboundTemplate_( new double[ nColumns ] ), - penalties_( missingPenalties ), - ignoredElementsL_( 0 ), - ignoredElements_( 0 ), - missingTermsPenalty_( 0.0 ) -{ - // for the EmptyQuery case (awaits arch improvement pass) - - if( missingPenalties ) - for( sal_Int32 i = 0;i < nColumns_; ++i ) - missingPenalty_[i] = missingPenalties[i]; - else - for( sal_Int32 i = 0;i < nColumns_; ++i ) - missingPenalty_[i] = MissingTermPenalty; - - makePenaltiesTable(); - // _roleFillerList = RoleFiller.STOP; -} - - -Query::~Query() -{ - delete[] missingPenalty_; - delete[] upperboundTemplate_; - delete[] penalties_; - delete[] ignoredElements_; -} - - -void Query::setIgnoredElements( const sal_Int32 ignoredElementsL,const rtl::OUString* ignoredElements ) -{ - if( ctx_ ) - ignoredElements_ = ctx_->getIgnoredElementsSet( ignoredElementsL_, - ignoredElementsL,ignoredElements ); - - if( ! ctx_ ) - { - ignoredElementsL_ = 0; - ignoredElements_ = 0; - } -} - - - -void Query::missingTerms( sal_Int32 nMissingTerms ) -{ - missingTermsPenalty_ = MissingTermPenalty * nMissingTerms; -} - - - -ConceptData* Query::makeConceptData( sal_Int32 col,sal_Int32 concept,double penalty,sal_Int32 queryNo ) -{ - return new ConceptData( concept,col,penalty,queryNo,nColumns_,env_->getContextInfo() );; -} - - -void Query::getHits( std::vector< QueryHitData* >& data,sal_Int32 n ) -{ - if( n <= 0 ) - return; - - QueryHit* qh = store_.firstBestQueryHit(); - - while( qh ) - { - data.push_back( env_->hitToData( qh ) ); - qh = data.size() < sal_uInt32( n ) ? store_.nextBestQueryHit() : 0; - } -} - - -QueryHit* Query::maybeCreateQueryHit( double penalty, - sal_Int32 doc, sal_Int32 begin, sal_Int32 end, sal_Int32 parentContext ) -{ - // hits are located using only terms actually present in text - // if B is not present, the query A B C reduces to A C and penalties - // are computed as if B did not occur in query - // to meaningfully merge results from different servers, some of which - // may have B, penalty has to be normalized to the common computing scheme - - QueryHit* res = - ( store_.goodEnough( penalty += missingTermsPenalty_,begin,end ) - && ( ! ignoredElements_ || ctx_->notIgnored( parentContext,ignoredElementsL_,ignoredElements_ ) ) ) - ? - store_.createQueryHit( penalty,doc,begin,end ) - : - 0; - return res; -} - - -void Query::makePenaltiesTable() -{ - sal_Int32 nPatterns = 1 << nColumns_; - delete[] penalties_; - penalties_ = new double[ penaltiesL_ = nPatterns ]; - for (sal_Int32 i = 0; i < nPatterns; ++i ) - penalties_[i] = computePenalty(i); -} - - -double Query::computePenalty( sal_Int32 n ) -{ - double penalty = 0.0; - for( sal_Int32 i = 0; i < nColumns_; ++i ) - if( ( n & 1 << i ) == 0 ) - penalty += missingPenalty_[i]; - return penalty; -} - - -void Query::resetForNextDocument() -{ - currentStandard_ = store_.getCurrentStandard(); - // "everything's missing" - for( sal_Int32 i = 0; i < nColumns_; i++ ) - upperboundTemplate_[i] = missingPenalty_[i]; - vote_ = false; -} - - -bool Query::vote() -{ - double sum = 0.0; - for( sal_Int32 i = 0; i < nColumns_; i++ ) - sum += upperboundTemplate_[i]; - return vote_ = (sum <= currentStandard_ ); -} - - -void Query::updateEstimate( sal_Int32 role,double penalty ) -{ - if( penalty < upperboundTemplate_[ role ] ) - upperboundTemplate_[ role ] = penalty; -} - - -/******************************************************************************/ -/* */ -/* QueryHitIterator */ -/* */ -/******************************************************************************/ - - - -QueryHitIterator::QueryHitIterator( const QueryResults* result ) - : index_( -1 ), - result_( result ) -{ -} - - -QueryHitIterator::~QueryHitIterator() -{ - delete result_; -} - - -bool QueryHitIterator::next() -{ - return accessible_ = ( ++index_ < sal_Int32( result_->queryHits_.size() ) ); -} - - -QueryHitData* QueryHitIterator::getHit( const PrefixTranslator* ) const -{ - if( accessible_ ) - return result_->queryHits_[index_]; - else - return 0; -} diff --git a/xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx b/xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx deleted file mode 100644 index c5f892fb603f..000000000000 --- a/xmlhelp/source/cxxhelp/qe/QueryProcessor.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * 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: QueryProcessor.cxx,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <qe/QueryProcessor.hxx> -#include <db/DBEnv.hxx> - - - -using namespace std; -using namespace xmlsearch; -using namespace xmlsearch::excep; -using namespace xmlsearch::qe; - - -const double QueryProcessor::INFLpenalty = 0.0; - - -QueryProcessor::QueryProcessor( const rtl::OUString& installDir ) - throw( IOException ) - : env_( installDir ) -{ -} - - -QueryProcessor::~QueryProcessor() -{ - // delete env_; -} - - - -QueryResults* QueryProcessor::processQuery( const QueryStatement& ment ) -{ - Search search( &env_ ); - Query* query = processQuery( search,ment ); - query->setIgnoredElements( 0,0 ); - search.startSearch(); - return makeQueryResults( query,ment.getHitCount() ); -} - - -Query* QueryProcessor::processQuery( Search& search,const QueryStatement& ment ) -{ - sal_Int32 nValidTerms = 0, nMissingTerms = 0, nContentTerms = 0; - double variantPenalty = 0.0; - - const sal_Int32 nHits = ment.getHitCount(); - const rtl::OUString scope = ment.getScope(); - const vector< rtl::OUString >& terms = ment.getTerms(); - const sal_Int32 nTerms = terms.size(); - - vector< sal_Int32 > primary( nTerms ); - vector< sal_Int32 > missingTerms( nTerms ); - vector< vector< sal_Int32 > > columns( nTerms ); - - for( int i = 0; i < nTerms; ++i ) - { - const sal_Int32 lgt = terms[i].getLength(); - const sal_Unicode* str = terms[i].getStr(); - - if( str[0] == sal_Unicode('+') ) - { - // poor man's escape for query control - // not implemented yet - } - else - { - ++nContentTerms; - rtl::OUString term = terms[i].toAsciiLowerCase(); - sal_Int32 id = 0; - std::vector< sal_Int32 > ids; - if( str[0] == sal_Unicode('\"') ) - { - id = env_.fetch( term.copy( 1 ) ); // goes to BtreeDict::fetch - } - else if( str[lgt-1] == sal_Unicode( '*' ) ) - { - ids = env_.withPrefix( term.copy( 0,lgt - 1 ) ); // goes to BtreeDict::withPrefix - variantPenalty = 0.0; - } - else - { - sal_Int32 formID; - id = env_.fetch( term ); - - // std::vector< rtl::OUString > variants( morph_->getVariants( term ) ); - std::vector< rtl::OUString > variants; - - for( sal_uInt32 j = 0; j < variants.size(); ++j ) - { - formID = env_.fetch( variants[j] ); - if( formID > 0 && formID != id ) - ids.push_back( formID ); - } - variantPenalty = INFLpenalty; - } - - if( ids.size() > 0 || id > 0 ) - { - columns[ nValidTerms ] = ids; - primary[ nValidTerms++ ] = id; - } - else - { - ++nMissingTerms; - // !!! not used now (intended to fill out appropriate missing terms in QueryHits - missingTerms.push_back( nContentTerms - 1 ); - } - - } - } - - return search.addQuery( scope, - nValidTerms,nMissingTerms,nHits, - variantPenalty, - primary, - columns ); -} - - - -QueryResults::QueryResults( Query* query, sal_Int32 nHits ) -{ - if( query ) - query->getHits( queryHits_,nHits ); -} - - -QueryResults::~QueryResults() -{ - for( sal_uInt32 i = 0; i < queryHits_.size(); ++i ) - delete queryHits_[i]; -} - - -QueryResults* QueryProcessor::makeQueryResults( Query* query,sal_Int32 nHits ) -{ - return new QueryResults( query,nHits ); -} - diff --git a/xmlhelp/source/cxxhelp/qe/Search.cxx b/xmlhelp/source/cxxhelp/qe/Search.cxx deleted file mode 100644 index 493205661d64..000000000000 --- a/xmlhelp/source/cxxhelp/qe/Search.cxx +++ /dev/null @@ -1,720 +0,0 @@ -/************************************************************************* - * - * 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: Search.cxx,v $ - * $Revision: 1.11 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <qe/Search.hxx> - - -using namespace std; -using namespace xmlsearch; -using namespace xmlsearch::qe; - - - - -/******************************************************************************/ -/* */ -/* Emtpy ConceptData/Query */ -/* */ -/******************************************************************************/ - - -class EmptyConceptData - : public ConceptData -{ -public: - - virtual void generateFillers( std::vector< RoleFiller* >& , sal_Int32 ) { } - -}; // end class EmptyQuery - - - -class EmptyQuery - : public Query -{ -public: - - EmptyQuery() - : Query( 0,0,0,0,0 ), - conceptDataInstance_( ) - { - } - - ConceptData* makeConceptData( sal_Int32 col, - sal_Int32 concept, - double penalty, - sal_Int32 queryNo ) - { - (void)col; - (void)concept; - (void)penalty; - (void)queryNo; - - return &conceptDataInstance_; - } - -private: - - EmptyConceptData conceptDataInstance_; - -}; // end class EmptyQuery - - - -/******************************************************************************/ -/* */ -/* ConceptData1/Query1 */ -/* */ -/******************************************************************************/ - - -class ConceptData1 - : public ConceptData -{ -public: - - ConceptData1( sal_Int32 id, - sal_Int32 role, - double score, - sal_Int32 queryNo, - sal_Int32 nColumns, - ContextTables* ctxInfo, - sal_Int32 code ) - : ConceptData( id,role,score,queryNo,nColumns,ctxInfo ), - fieldCode_( code ) - { - } - - virtual void generateFillers( std::vector< RoleFiller* >& array, sal_Int32 pos ); - - -private: - - sal_Int32 fieldCode_; - -}; // end class ConceptData1 - - -class Query1 - : public Query -{ -public: - - Query1( XmlIndex* env, - sal_Int32 nColumns, - sal_Int32 nHits, - sal_Int32 missingPenaltiesL, - double* missingPenalties, - sal_Int32 fieldCode ) - : Query( env,nColumns,nHits,missingPenaltiesL,missingPenalties ), - searchFieldCode_( fieldCode ) - { - } - - virtual ConceptData* makeConceptData( sal_Int32 col, - sal_Int32 concept, - double score, - sal_Int32 query ); - - -private: - - sal_Int32 searchFieldCode_; -}; - - - -/********************************************************************************/ -// Impl -/********************************************************************************/ - - -void ConceptData1::generateFillers( std::vector< RoleFiller* >& array, sal_Int32 pos ) -{ - if( array[ queryNo_ ] != RoleFiller::STOP() ) - { // not 'prohibited' - // !!! candidate for a single _ctx op - sal_Int32 ancestor = ctx_->firstParentWithCode(pos,fieldCode_); - if( ancestor != -1 ) - { - - - RoleFiller* p = new RoleFiller( nColumns_, - this, - role_, - pos, - ancestor, - pos + proximity_); - p->use( array,queryNo_ ); - } - } - - if( next_.is() ) - next_->generateFillers( array,pos ); -} - - - -ConceptData* Query1::makeConceptData( sal_Int32 col, - sal_Int32 concept, - double score, - sal_Int32 query ) -{ - return new ConceptData1( concept,col,score,query,nColumns_,ctx_,searchFieldCode_ ); -} - - - -/******************************************************************************/ -/* */ -/* QueryFactoryImpl */ -/* */ -/******************************************************************************/ - - -class QueryFactoryImpl -{ -public: - - Query* makeQuery( XmlIndex* env,const rtl::OUString& context,sal_Int32 nColumns,sal_Int32 nHits); - - Query* empty() { return &emptyQueryInstance_; } - -private: - - EmptyQuery emptyQueryInstance_; - -}; // end class QueryFactoryImpl - - - - -Query* QueryFactoryImpl::makeQuery( XmlIndex* env, - const rtl::OUString& context, - sal_Int32 nColumns, - sal_Int32 nHits ) -{ - if( ! context.getLength() ) - return new Query( env,nColumns,nHits,0,0 ); - else if( context.indexOf( sal_Unicode( '|' ) ) != -1 ) - { - return 0; //t - } - else if( context.indexOf( rtl::OUString::createFromAscii( "//" ) ) != -1 ) - { - return 0; //t - } - else if( context.indexOf( sal_Unicode( '/' ) ) != -1 ) - { - return 0; //t - } - else if( context.indexOf( sal_Unicode( '@' ) ) != -1 ) - { - return 0; //t - } - else if( context.indexOf( sal_Unicode( '[' ) ) != -1 ) - { - return 0; //t - } - else - { - sal_Int32 code = env->getContextInfo()->linkCode( context ); - if( code != -1 ) - return new Query1( env,nColumns,nHits,0,0,code); - else - return &emptyQueryInstance_; - } -} - - - -Search::Search( XmlIndex* env ) - : env_( env ), - queryFactory_( 0 ), - nextDocGenHeap_(), - firstGenerator_(), - free2_( 0 ), - limit_( 0 ), - base_( 0 ), - concepts_( new sal_Int32[ ConceptGroupGenerator::NConceptsInGroup ] ), - dataL_( 0 ), - data_( 0 ) -{ -} - - - -Search::~Search() -{ - sal_uInt32 i; - Query* stopq = queryFactory_ ? queryFactory_->empty() : 0; - ConceptData* stopc = stopq ? stopq->makeConceptData( 0,0,0.0,0 ) : 0; - (void)stopc; - - for( i = 0; i < queries_.size(); ++i ) - if( queries_[i] != stopq ) - delete queries_[i]; - - delete[] concepts_; - - delete queryFactory_; -} - - - - -Query* Search::addQuery( const rtl::OUString& context, - sal_Int32 nValidTerms,sal_Int32 nMissingTerms,sal_Int32 nHits, - double variantPenalty, - const std::vector< sal_Int32 >& primary, - const std::vector< std::vector< sal_Int32 > >& columns ) -{ - // by now, scope == context - if( ! queryFactory_ ) - queryFactory_ = new QueryFactoryImpl(); - - Query* query = queryFactory_->makeQuery( env_,context,nValidTerms,nHits ); - query->missingTerms( nMissingTerms ); - queries_.push_back( query ); - - for( sal_Int32 i = 0; i < nValidTerms; ++i ) - { - if( primary[i] > 0 ) - addTerm( i,primary[i],0.0 ); - - for( sal_uInt32 j = 0; j < columns[i].size(); ++j ) - addTerm( i,columns[i][j],variantPenalty ); - } - - // start stop - query->addControlConceptData( this,queries_.size()-1 ); - return query; -} - - - -void Search::startSearch() -{ - sal_Int32 i,j; - // set up ConceptData lists - // order search terms - quicksort( 0, free2_ - 1); - - // remove duplicates - for (i = 0; i < free2_ - 1; i = j) - { - for (j = i + 1; j < free2_; j++) - { - if( conceptData_[i]->crqEquals( conceptData_[j].get() ) ) - conceptData_[j] = 0; - else - i = j; - } - } - - // create lists - for( i = 0; i < free2_ - 1; i = j ) - { - for (j = i + 1; j < free2_; j++ ) - { - if( conceptData_[j].is() ) - { - if( conceptData_[i]->cEquals( conceptData_[j].get() ) ) - { - conceptData_[i]->addLast( conceptData_[j].get() ); - conceptData_[j] = 0; - } - else - i = j; - } - } - } - - // densify - for( i = 0; i < free2_ - 1; i++) - { - if( ! conceptData_[i].is() ) - { - for( j = i + 1; j < free2_; j++) - { - if (conceptData_[j].is() ) - { - conceptData_[i] = conceptData_[j]; - conceptData_[j] = 0; - break; - } - } - } - } - - // set up new document generators - nextDocGenHeap_.reset(); - for( i = 0; i < free2_ && conceptData_[i].is(); i++) - { - NextDocGenerator* gen = new NextDocGenerator( conceptData_[i].get(),env_ ); - try - { - sal_Int32 doc; - gen->first(); - if( ( doc = gen->getDocument() ) != NonnegativeIntegerGenerator::END ) - { - /* !!! ??? is concept length used any more in any way - conceptData_[i]. - setConceptLength(_env. - getConceptLength(conceptData_[i].getConcept())); - */ - nextDocGenHeap_.addGenerator( gen ); - } - } - catch( ... ) - { - } - } - - nextDocGenHeap_.start(); - env_->reset(); - env_->resetContextSearch(); - searchDocument(); -} - - - - -void Search::addTerm( sal_Int32 col,sal_Int32 concept,double score ) -{ - if( env_->occursInText( concept ) ) - { - ConceptData* cd = queries_[queries_.size()-1]->makeConceptData( col,concept,score,queries_.size()-1 ); - if( sal_uInt32( free2_ ) == conceptData_.size() ) - { - conceptData_.push_back( 0 ); -// conceptVisitor_ = &conceptData_[0]; - } - conceptData_[ free2_++ ] = cd; - } -} - - - - - -void Search::searchDocument() -{ - std::vector< RoleFiller* > start( queries_.size() ); - do - { - try - { - switch( nextDocument( start ) ) - { - case 0: // multi group - genHeap_.start( start ); - while( genHeap_.next( start ) ) - ; - break; - - case 1: // single group - while( firstGenerator_.next() ) - firstGenerator_.generateFillers( start ); - break; - - case 2: // reached the end - return; - } - } - catch( const excep::XmlSearchException& ) - { - continue; - } - - RoleFiller* next; - for( sal_uInt32 i = 0; i < queries_.size(); ++i ) - { - if( ( next = start[i] ) != 0 && next != RoleFiller::STOP() ) - next->scoreList( queries_[i],document_ ); - else if( queries_[i]->zoned() ) - { - RoleFiller* rfs = queries_[i]->getRoleFillers(); - if( rfs && rfs != RoleFiller::STOP() ) - rfs->scoreList( queries_[i],document_ ); - } - } - genHeap_.reset(); - } - while( nextDocGenHeap_.isNonEmpty() ); - - // #i80952 -#if 0 - for( sal_uInt32 i = 0; i < start.size(); ++i ) - if( start[i] != RoleFiller::STOP() ) - delete start[i]; -#endif -} - - - -sal_Int32 Search::nextDocument( std::vector< RoleFiller* >& start ) throw( xmlsearch::excep::XmlSearchException ) -{ - while( nextDocGenHeap_.isNonEmpty() ) - { // still something to do - sal_uInt32 i; - for( i = 0; i < queries_.size(); ++i ) - if( queries_[i] ) - queries_[i]->resetForNextDocument(); - - // gather all concepts this document has - // and store associated conceptData - sal_Int32 index = 0; - document_ = nextDocGenHeap_.getDocument(); - docConcepts_.clear(); - queryMasks_.clear(); - do - { - docConcepts_.push_back( nextDocGenHeap_.getConcept() ); - queryMasks_.push_back( nextDocGenHeap_.getQueryMask() ); - ConceptData *conceptData = ( conceptData_[ index++ ] = nextDocGenHeap_.getTerms() ).get(); - conceptData->runBy( queries_ ); - nextDocGenHeap_.step(); - } - while( nextDocGenHeap_.atDocument( document_) ); - - // if there is no saturation model, some query will always vote YES - // and so every document will be opened - // even if this case, however, savings can be achieved by not generating fillers - // for some queries (not scoring, etc) - // and, with more care, creation of some GroupGenerators can be avoided - // saturating queries with lots of good hits will lead to best results - - sal_Int32 voteMask = 0; - Query* query; - for( i = 0; i < queries_.size(); ++i ) - { - query = queries_[i]; - if( query ) - { - query->saveRoleFillers( 0 ); - if( query->vote() ) - { - // normal reset - start[i] = query->zoned() ? RoleFiller::STOP() : 0; - voteMask |= 1 << i; - } - else - start[i] = RoleFiller::STOP(); // prohibit setting - } - } - - // we may eliminate some ConceptGroupGenerators - // those which would be used only by Queries which voted NO - if( voteMask != 0 ) - { // need to open up document - ConceptGroupGenerator* gen; - // !!! don't gather Fillers for disinterested Queries - if( openDocumentIndex( document_ ) ) - { // multi group - // set up all needed generators - sal_Int32 j = 0; - while( ( queryMasks_[j] & voteMask ) == 0 ) - ++j; - // assert(j < index); - sal_Int32 c = docConcepts_[j]; - sal_Int32 group = 0; - // find first group - while( /*group < maxConcepts_.size() &&*/ - c > maxConcepts_[ group ] && ++group < limit_ ) - ; - gen = makeGenerator( group ); - gen->addTerms( indexOf(c),conceptData_[j].get() ); - - for( ++j; j < index; j++ ) - if( ( queryMasks_[j] & voteMask ) > 0 ) - { - c = docConcepts_[j]; - if( c > max_ ) - { // need to find another group - // assert(group < _limit); - while( /*group < maxConcepts_.size() &&*/ - c > maxConcepts_[ group ] && ++group < limit_ ) - ; - gen = makeGenerator( group ); - } - gen->addTerms( indexOf(c),conceptData_[j].get() ); - } - return 0; - } - else - { // single group - for( sal_Int32 j = 0; j < index; j++ ) - if( queryMasks_[j] & voteMask ) - firstGenerator_.addTerms( indexOf( docConcepts_[j] ),conceptData_[j].get() ); - return 1; - } - } - } - return 2; -} - - - - -bool Search::openDocumentIndex( sal_Int32 docNo ) throw( excep::XmlSearchException ) -{ - data_ = env_->getPositions( dataL_,docNo ); - base_ = env_->getDocumentIndex( docNo ); - - startingIndex_ = 0; - sal_Int32 kk = data_[ base_ ] & 0xFF, k2; - - switch( kk >> 6 ) - { // get type - case 0: // single group, no extents - k2 = data_[base_ + 1]; - firstGenerator_.init( dataL_,data_,base_ += 2,k2 ); - // decode concept table - nConcepts_ = firstGenerator_.decodeConcepts( kk & 0x3F,0,concepts_ ); - return false; - - case 2: // multi group, no extents - { - kTable_.clear(); - offsets_.clear(); - maxConcepts_.clear(); - util::ByteArrayDecompressor compr( dataL_,data_,base_ + 1 ); - compr.decode( kk & 0x3F,kTable_ ); - - sal_Int32 last = kTable_.back(); - kTable_.pop_back(); - compr.ascDecode( last,offsets_ ); - last = kTable_.back(); - kTable_.pop_back(); - compr.ascDecode( last,maxConcepts_ ); - - base_ += 1 + compr.bytesRead(); - limit_ = maxConcepts_.size(); - } - return true; - - case 1: // single group, extents - case 3: // multi group, extents - throw excep::XmlSearchException( rtl::OUString::createFromAscii( "extents not yet implemented\n" ) ); - } - return false; -} - - - - - -ConceptGroupGenerator* Search::makeGenerator( sal_Int32 group ) - throw( excep::XmlSearchException ) -{ - sal_Int32 shift,index; - if( group > 0 ) - { - index = base_ + offsets_[ group - 1 ]; - shift = maxConcepts_[ group - 1 ]; - } - else - { - index = base_; - shift = 0; - } - - // initialize generator - ConceptGroupGenerator* gen = - new ConceptGroupGenerator( dataL_,data_,index,kTable_[ 1 + 2*group ] ); - // decode concept table - nConcepts_ = gen->decodeConcepts( kTable_[2*group],shift,concepts_ ); - - if( group < limit_ ) - max_ = concepts_[ nConcepts_ ] = maxConcepts_[ group ]; - else - max_ = concepts_[ nConcepts_ - 1 ]; - - genHeap_.addGenerator( gen ); - startingIndex_ = 0; // in _concepts; lower search index - return gen; -} - - - -sal_Int32 Search::indexOf(sal_Int32 concept) throw( excep::XmlSearchException ) -{ - sal_Int32 i = startingIndex_,j = nConcepts_,k; - while( i <= j ) - if( concepts_[ k = (i + j)/2 ] < concept ) - i = k + 1; - else if( concept < concepts_[k] ) - j = k - 1; - else - { - startingIndex_ = k + 1; - return k; - } - throw excep::XmlSearchException( rtl::OUString::createFromAscii( "indexOf not found" ) ); -} - - - - -sal_Int32 Search::partition( sal_Int32 p,sal_Int32 r ) -{ - rtl::Reference< ConceptData > x = conceptData_[ ((p + r) >> 1) & 0x7FFFFFFF ]; - sal_Int32 i = p - 1, j = r + 1; - while( true ) - { - while( x->compareWith( conceptData_[--j].get() ) ) - ; - while( conceptData_[++i]->compareWith( x.get() ) ) - ; - if( i < j ) - { - rtl::Reference< ConceptData > t = conceptData_[i]; - conceptData_[i] = conceptData_[j]; - conceptData_[j] = t; - } - else - return j; - } -} - - - -void Search::quicksort( sal_Int32 p,sal_Int32 r ) -{ - while (p < r) - { - sal_Int32 q = partition( p,r ); - quicksort(p, q); - p = q + 1; - } -} diff --git a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx b/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx deleted file mode 100644 index 707a09f1a42e..000000000000 --- a/xmlhelp/source/cxxhelp/qe/XmlIndex.cxx +++ /dev/null @@ -1,457 +0,0 @@ -/************************************************************************* - * - * 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: XmlIndex.cxx,v $ - * $Revision: 1.19 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <osl/diagnose.h> -#include <qe/XmlIndex.hxx> -#include <qe/DocGenerator.hxx> -#include <util/ConceptList.hxx> -#ifndef _XMLSEARCH_UTIL_RANDOMACCESSSTREAM_HXX_ -#include <util/RandomAccessStream.hxx> -#endif -#include <util/Decompressor.hxx> -#include <qe/Query.hxx> - -using namespace xmlsearch; -using namespace xmlsearch::excep; -using namespace xmlsearch::qe; - - -// extern sal_Int32 getInteger_( const sal_Int8* ); - - -XmlIndex::XmlIndex( const rtl::OUString& indexDir ) - throw( IOException ) - : currentBatchOffset_( 0 ), - maxDocNumberInCache_( -1 ), - indexAccessor_( indexDir ), - dict_( indexAccessor_ ), - contextTables_( 0 ), - allListsL_( 0 ), - allLists_( 0 ), - positionsL_( 0 ), - positions_( 0 ), - contextsDataL_( 0 ), - contextsData_( 0 ), - concepts_( 0 ), - documents_( 0 ) -{ - // reading DOCS - try - { - allListsL_ = indexAccessor_.readByteArray( allLists_, - rtl::OUString::createFromAscii("DOCS") ); // reading DOCS - } - catch( IOException ) - { - OSL_ENSURE( allLists_ != 0, "XmlIndex::XmlIndex -> cannot open DOCS/docs" ); - throw; - } - - // reading CONTEXTS - try - { - contextsDataL_ = indexAccessor_.readByteArray( contextsData_, - rtl::OUString::createFromAscii("CONTEXTS") ); // reading CONTEXTS - } - catch( IOException ) - { - OSL_ENSURE( allLists_ != 0, "XmlIndex::XmlIndex -> cannot open CONTEXTS/contexts" ); - delete[] allLists_; - throw; - } - - // reading POSITIONS - { - positionsFile_ = indexAccessor_.getStream( rtl::OUString::createFromAscii( "POSITIONS" ), - rtl::OUString::createFromAscii( "r" ) ); - - OSL_ENSURE( positionsFile_ != 0, "XmlIndex::XmlIndex -> cannot open POSITIONS/positions" ); - - if( positionsFile_ ) - { - //!!! temporary: better than fixed large value, worse than 'intelligent' size mgt - allInCache_ = true; - if( allInCache_ ) // yes, intended - { - reset(); - positions_ = new sal_Int8[ positionsL_ = positionsFile_->length() ]; - positionsFile_->readBytes( positions_,positionsL_ ); - } - } - else - { - delete[] allLists_; - delete[] contextsData_; - throw IOException( rtl::OUString::createFromAscii( "XmlIndex::XmlIndex -> no POSITIONS/positions") ); - } - } - - - // reading DOCS.TAB - { - util::RandomAccessStream* in = indexAccessor_.getStream( rtl::OUString::createFromAscii( "DOCS.TAB" ), - rtl::OUString::createFromAscii( "r" ) ); - - if( in ) - { - sal_Int8 a[4]; - a[0] = a[1] = a[2] = 0; - in->readBytes( &a[3],1 ); - sal_Int32 k1 = ::getInteger_( a ); - util::StreamDecompressor sddocs( in ); - sddocs.ascDecode( k1,concepts_ ); - in->readBytes( &a[3],1 ); - sal_Int32 k2 = ::getInteger_( a ); - offsets_.push_back( 0 ); - util::StreamDecompressor sdoffsets( in ); - sdoffsets.ascDecode( k2,offsets_ ); - delete in; - } - else - { - delete[] allLists_; - delete[] contextsData_; - delete[] positions_; - delete positionsFile_; - throw IOException( rtl::OUString::createFromAscii( "XmlIndex::XmlIndex -> no DOCS.TAB/docs.tab") ); - } - } - - // reading OFFSETS - { - util::RandomAccessStream* in = indexAccessor_.getStream( rtl::OUString::createFromAscii( "OFFSETS" ), - rtl::OUString::createFromAscii( "r" ) ); - if( in ) - { - sal_Int8 a[4]; - a[0] = a[1] = a[2] = 0; - in->readBytes( &a[3],1 ); - sal_Int32 k1 = ::getInteger_( a ); - util::StreamDecompressor sddocs( in ); - sddocs.decode( k1,documents_ ); - in->readBytes( &a[3],1 ); - sal_Int32 k2 = ::getInteger_( a ); - util::StreamDecompressor sdoffsets( in ); - sdoffsets.ascDecode( k2,microIndexOffsets_ ); - in->readBytes( &a[3],1 ); - sal_Int32 k3 = ::getInteger_( a ); - util::StreamDecompressor sdtitles( in ); - sdtitles.decode( k3,titles_ ); - - in->readBytes( &a[3],1 ); - sal_Int32 k4 = ::getInteger_( a ); - // contextsOffsets_ = new IntegerArray(_documents.cardinality() + 1); - util::StreamDecompressor co(in); - // _contextsOffsets.add(0); // first, trivial offset - co.ascDecode( k4,contextsOffsets_ ); - delete in; - } - else - { - delete[] allLists_; - delete[] contextsData_; - delete[] positions_; - delete positionsFile_; - throw IOException( rtl::OUString::createFromAscii( "XmlIndex::XmlIndex -> no OFFSETS/offsets") ); - } - } - - // reading linknames - { - util::RandomAccessStream* in = - indexAccessor_.getStream( rtl::OUString::createFromAscii( "LINKNAMES" ), - rtl::OUString::createFromAscii( "r" ) ); - if( ! in ) - { - delete[] allLists_; - delete[] contextsData_; - delete[] positions_; - delete positionsFile_; - throw IOException( - rtl::OUString::createFromAscii( "BtreeDict::BtreeDict -> no LINKNAMES/linknames" ) ); - } - - sal_Int32 len = in->length(); - char* bff = new char[ 1 + len ], *bff1 = new char[ 1 + len ]; - bff[ len ] = 0; - in->readBytes( reinterpret_cast<sal_Int8*>( bff ),len ); - delete in; - - // Now the buffer must be densified. - int i,len1 = 0; - for( i = 0; i < len; ++i ) - { - if( bff[i] ) - bff1[ len1++ ] = bff[i]; - } - bff1[len1] = 0; - delete[] bff; - rtl::OString aStr( bff1 ); // build a string from the densified buffer; - delete[] bff1; - -// // Now determine the order -// #define NAMECOUNT 16 -// #define UNREACHABLEPLACE 100000; -// /** -// * The available names cannot be determined from LINKNAMES at current, -// * because LINKNAMES is a serialized Java-object -// * Always update LINKNAMES if index.xsl or default.xsl are modified. -// */ -// rtl::OString LN[NAMECOUNT]; -// LN[0] = "text:span"; -// LN[1] = "help:help-text"; -// LN[2] = "help:to-be-embedded"; -// LN[3] = "headingheading"; -// LN[4] = "office:body"; -// LN[5] = "text:p"; -// LN[6] = "office:document"; -// LN[7] = "help:link"; -// LN[8] = "help:key-word"; -// LN[9] = "table:table"; -// LN[10] = "table:table-header-row"; -// LN[11] = "table:table-row"; -// LN[12] = "table:table-cell"; -// LN[13] = "text:unordered-list"; -// LN[14] = "text:ordered-list"; -// LN[15] = "text:list-item"; - // Now determine the order - -#define NAMECOUNT 16 -#define UNREACHABLEPLACE 100000; - /** - * The available names cannot be determined from LINKNAMES at current, - * because LINKNAMES is a serialized Java-object - * Always update LINKNAMES if index.xsl or default.xsl are modified. - */ - - rtl::OString LN[NAMECOUNT]; - LN[0] = "helpdocument"; - LN[1] = "body"; - LN[2] = "title"; - LN[3] = "table"; - LN[4] = "tablecell"; - LN[5] = "tablerow"; - LN[6] = "list"; - LN[7] = "listitem"; - LN[8] = "item"; - LN[9] = "emph"; - LN[10] = "paragraph"; - LN[11] = "section"; - LN[12] = "bookmark"; - LN[13] = "bookmark_value"; - LN[14] = "ahelp"; - LN[15] = "link"; - - // Determine index in file - int idx[NAMECOUNT]; - /*int*/ linkNamesL_ = NAMECOUNT; - for( i = 0; i < NAMECOUNT; ++i ) - if( ( idx[i] = aStr.indexOf( LN[i] ) ) == -1 ) { - idx[i] = UNREACHABLEPLACE; - --linkNamesL_; - } - - linkNames_ = new rtl::OUString[linkNamesL_]; - for( i = 0; i < linkNamesL_; ++i ) { - // TODO what happens to first if we never hit Place? - int first = 0; - int Place = UNREACHABLEPLACE; // This is the defintely last place - for( int j = 0; j < NAMECOUNT; ++j ) - { - if( idx[j] < Place ) - Place = idx[first = j]; - } - idx[first] = UNREACHABLEPLACE; - linkNames_[i] = rtl::OUString( LN[first].getStr(),LN[first].getLength(),RTL_TEXTENCODING_UTF8 ); - } - -#undef NAMECOUNT -#undef UNREACHABLEPLACE - } // end linknames - - - { - contextTables_ = new ContextTables(contextsOffsets_, - contextsDataL_,contextsData_, - linkNamesL_,linkNames_ ); - } -} - - -XmlIndex::~XmlIndex() -{ - delete[] allLists_; - delete[] contextsData_; - delete[] linkNames_; - delete[] positions_; - delete positionsFile_; - delete contextTables_; -} - - - -void XmlIndex::reset() -{ - maxDocNumberInCache_ = allInCache_ ? static_cast<sal_Int32>(microIndexOffsets_.size()) - 1 : -1; -} - - -sal_Int32 binarySearch( const std::vector<sal_Int32>& arr,sal_Int32 value ) -{ - sal_Int32 i = 0, j = arr.size(), k; - while (i <= j) - if (arr[k = (i + j)/2] < value) - i = k + 1; - else if (value < arr[k]) - j = k - 1; - else - return k; - return -1; -} - - -NonnegativeIntegerGenerator* XmlIndex::getDocumentIterator( sal_Int32 concept ) -{ - sal_Int32 index = binarySearch( concepts_,concept ); - - if( index >= 0 ) - return new util::ConceptList( allLists_,allListsL_,offsets_[index] ); - else - return 0; -} - - -bool XmlIndex::occursInText( sal_Int32 concept ) -{ - return binarySearch( concepts_,concept) >= 0; -} - - -sal_Int8* XmlIndex::getPositions( sal_Int32& len,sal_Int32 docNo ) throw( excep::XmlSearchException ) -{ - contextTables_->setMicroindex( docNo ); - if( docNo > maxDocNumberInCache_ ) - readMicroindexes( docNo ); - - len = positionsL_; - return positions_; -} - - -rtl::OUString XmlIndex::documentName( sal_Int32 docNumber ) throw( excep::XmlSearchException ) -{ - if( docNumber < 0 || documents_.size() <= sal_uInt32( docNumber ) ) - { - rtl::OUString message = rtl::OUString::createFromAscii( "XmlIndex::documentName -> " ); - throw excep::XmlSearchException( message ); - } - - return dict_.fetch( documents_[ docNumber ] ); -} - - - - -void XmlIndex::readMicroindexes( sal_Int32 docNo ) throw( xmlsearch::excep::IOException ) -{ - currentBatchOffset_ = microIndexOffsets_[docNo]; - sal_Int32 offsetLimit = currentBatchOffset_ + positionsL_; - sal_Int32 upTo = 0, nextDoc = docNo; - sal_Int32 lastOffset = 0; - - do - { - if( ++nextDoc == sal_Int32( microIndexOffsets_.size() ) ) - lastOffset = sal_Int32( positionsFile_->length() ); - else if( microIndexOffsets_[ nextDoc ] > offsetLimit ) - lastOffset = microIndexOffsets_[ nextDoc ]; - } - while( lastOffset == 0 ); - - if( lastOffset > offsetLimit ) - { - upTo = microIndexOffsets_[ nextDoc - 1 ]; - maxDocNumberInCache_ = nextDoc - 2; - } - else - { - upTo = lastOffset; - maxDocNumberInCache_ = nextDoc - 1; - } - - if( maxDocNumberInCache_ < docNo ) - { // cache too small - // for current microindex - // System.out.println("expanding cache to " + _positionsCacheSize); - delete[] positions_; - positions_ = new sal_Int8[ positionsL_ = lastOffset - currentBatchOffset_ ]; - readMicroindexes( docNo ); - return; - } - - positionsFile_->seek( currentBatchOffset_ ); - positionsFile_->readBytes( positions_,upTo - currentBatchOffset_ ); -} - - -QueryHitData* XmlIndex::hitToData( QueryHit* hit ) -{ - sal_Int32 termsL,matchesL; - sal_Int32 *matches = hit->getMatches( matchesL ); - rtl::OUString *terms = new rtl::OUString[ termsL = matchesL >>/*>*/ 1 ]; - for( sal_Int32 i = 0; i < termsL; ++i ) - { - sal_Int32 aInt = ( i << 1 ); - if( 0 <= aInt && aInt < matchesL ) - { - sal_Int32 match = matches[ aInt ]; - if( match > 0 ) - try - { - terms[i] = fetch( match ); - } - catch( const excep::XmlSearchException& ) - { - } - } - } - - sal_Int32 document = hit->getDocument(); - QueryHitData *res = new QueryHitData( hit->getPenalty(), - documentName( document ), - termsL,terms ); - contextTables_->setMicroindex( document ); - contextTables_->resetContextSearch(); - return res; -} - - diff --git a/xmlhelp/source/cxxhelp/qe/makefile.mk b/xmlhelp/source/cxxhelp/qe/makefile.mk index e86231898cb1..249950c4f02a 100644 --- a/xmlhelp/source/cxxhelp/qe/makefile.mk +++ b/xmlhelp/source/cxxhelp/qe/makefile.mk @@ -45,14 +45,7 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+=-GR .ENDIF -SLOFILES=\ - $(SLO)$/ConceptData.obj \ - $(SLO)$/ContextTables.obj \ - $(SLO)$/DocGenerator.obj \ - $(SLO)$/Query.obj \ - $(SLO)$/QueryProcessor.obj \ - $(SLO)$/Search.obj \ - $(SLO)$/XmlIndex.obj +SLOFILES=$(SLO)$/DocGenerator.obj # --- Targets ------------------------------------------------------ diff --git a/xmlhelp/source/cxxhelp/util/Decompressor.cxx b/xmlhelp/source/cxxhelp/util/Decompressor.cxx index 14bfdd8c6ab2..8a6352c6db08 100644 --- a/xmlhelp/source/cxxhelp/util/Decompressor.cxx +++ b/xmlhelp/source/cxxhelp/util/Decompressor.cxx @@ -30,183 +30,29 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmlhelp.hxx" -#include <db/Block.hxx> #include <util/Decompressor.hxx> #include <util/CompressorIterator.hxx> - - using namespace xmlsearch; using namespace xmlsearch::util; - - const sal_Int32 Decompressor::BitsInByte = 8; const sal_Int32 Decompressor::NBits = 32; - -sal_Int32 Decompressor::read( sal_Int32 kBits ) throw( excep::XmlSearchException ) -{ - sal_Int32 shift = BitsInByte - toRead_; - if( kBits <= toRead_ ) - return ( ( readByte_ << shift ) & 0xFF) >>/*>*/ (shift + ( toRead_ -= kBits)); - else - { - sal_Int32 result = toRead_ > 0 ? ( ( readByte_ << shift ) & 0xFF ) >>/*>*/ shift : 0; - for( kBits -= toRead_; kBits >= BitsInByte; kBits -= BitsInByte ) - result = ( result << BitsInByte ) | getNextByte(); - if( kBits > 0 ) - return ( result << kBits ) | ( ( readByte_ = getNextByte() ) >>/*>*/ ( toRead_ = BitsInByte - kBits ) ); - else - { - toRead_ = 0; - return result; - } - } -} - - -sal_Int32 Decompressor::ascendingDecode( sal_Int32 k,sal_Int32 start,sal_Int32* array ) - throw( xmlsearch::excep::XmlSearchException ) -{ - sal_Int32 path = 0, index = 0; - LOOP: - while( true ) - if( read() ) - array[index++] = (start += path | read(k)); - else - for( sal_Int32 cnt = 0;; readByte_ = getNextByte(), toRead_ = BitsInByte ) - while( toRead_-- > 0 ) - if( readByte_ & ( 1 << toRead_ ) ) - { - ++cnt; - sal_Int32 Path = ( (path >>/*>*/ ( k + cnt ) << cnt ) | read( cnt ) ) << k; - if (Path != path) - { - array[index++] = ( start += ( path = Path ) | read( k ) ); - goto LOOP; - } - else - return index; - } - else - ++cnt; -} - - - -void Decompressor::ascDecode( sal_Int32 k,std::vector< sal_Int32 >& array) throw( excep::XmlSearchException ) -{ - for( sal_Int32 path = 0,start = 0; ; ) - if( read() != 0 ) - array.push_back( start += path | read( k ) ); - else - { - sal_Int32 count = countZeroes() + 1; - sal_Int32 saved = path; - path = ( ( path >>/*>*/ ( k + count ) << count) | read( count ) ) << k; - if( path != saved ) // convention for end - array.push_back( start += path | read( k ) ); - else - break; - } -} - - -void Decompressor::decode( sal_Int32 k,std::vector< sal_Int32 >& array) throw( excep::XmlSearchException ) -{ - for( sal_Int32 path = 0; ; ) - if( read() ) - array.push_back( path | read( k ) ); - else - { - sal_Int32 count = countZeroes() + 1; - sal_Int32 saved = path; - path = ( ( path >>/*>*/ ( k + count ) << count ) | read( count ) ) << k; - if( path != saved ) // convention for end - array.push_back( path | read( k ) ); - else - break; - } -} - - - -void Decompressor::decode(sal_Int32 k, sal_Int32* array ) throw( excep::XmlSearchException ) -{ - for( sal_Int32 path = 0,index = 0; ; ) - if( read() ) - array[ index++] = ( path | read( k ) ); - else - { - sal_Int32 count = countZeroes() + 1; - sal_Int32 saved = path; - path = ( ( path >>/*>*/ ( k + count ) << count ) | read( count ) ) << k; - if( path != saved ) // convention for end - array[ index++ ] = ( path | read( k ) ); - else - break; - } -} - - - -sal_Int32 Decompressor::read() throw( excep::XmlSearchException ) -{ - if( toRead_-- > 0 ) - return readByte_ & ( 1 << toRead_ ); - else - { // get next word - toRead_ = BitsInByte - 1; - return ( readByte_ = getNextByte() ) & 0x80; - } -} - - -sal_Int32 Decompressor::countZeroes() throw( excep::XmlSearchException ) -{ - for( sal_Int32 count = 0; ;readByte_ = getNextByte(),toRead_ = BitsInByte ) - while( toRead_-- > 0 ) - if( readByte_ & ( 1 << toRead_ ) ) - return count; - else - ++count; -} - - -bool Decompressor::readNext( sal_Int32 k,CompressorIterator* it) throw( excep::XmlSearchException ) +inline sal_Int32 getInteger_( const sal_Int8* v ) { - if( read() != 0 ) - { - it->value( path_ | read(k) ); - return true; - } - else - for( sal_Int32 count = 1; ; readByte_ = getNextByte(), toRead_ = BitsInByte ) - while( toRead_-- > 0 ) - if( readByte_ & ( 1 << toRead_ ) ) - { - sal_Int32 saved = path_; - path_ = ( (path_ >>/*>*/ ( k + count ) << count ) | read( count ) ) << k; - if( path_ != saved ) - { - it->value( path_ | read( k ) ); - return true; - } - else - return false; - } - else - ++count; + return (((((( v[0]&0xFF ) << 8 ) + | v[1]&0xFF ) << 8 ) + | v[2]&0xFF ) << 8 ) + | v[3]&0xFF; } - - +
sal_Int32 StreamDecompressor::getNextByte() { sal_Int8 a[4]; a[0] = a[1] = a[2] = 0; if( in_->readBytes( &a[3],1 ) != -1 ) - return ::getInteger_( a ); + return getInteger_( a ); else return -1; } diff --git a/xmlhelp/source/cxxhelp/util/IndexAccessor.cxx b/xmlhelp/source/cxxhelp/util/IndexAccessor.cxx deleted file mode 100644 index d1df9f02d7a6..000000000000 --- a/xmlhelp/source/cxxhelp/util/IndexAccessor.cxx +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************* - * - * 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: IndexAccessor.cxx,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmlhelp.hxx" -#include <osl/diagnose.h> -#include <osl/file.hxx> -#include <util/IndexAccessor.hxx> -#include <util/RandomAccessStream.hxx> - - -using namespace xmlsearch::excep; -using namespace xmlsearch::util; - - -class RandomAccessStreamImpl - : public RandomAccessStream -{ -public: - - RandomAccessStreamImpl( const rtl::OUString& aPath,const rtl::OUString& how ); - - ~RandomAccessStreamImpl() - { - close(); - } - - virtual void seek( sal_Int32 pos ) - { - file_.setPos( Pos_Absolut,sal_uInt64( pos ) ); - } - - virtual sal_Int32 readBytes( sal_Int8* data,sal_Int32 num ) - { - sal_uInt64 nbytesread; - -#ifdef DBG_UTIL - osl::FileBase::RC err = - file_.read( (void*)(data), sal_uInt64(num),nbytesread ); - - OSL_ENSURE( err == osl::FileBase::E_None, "RandomAccessStreamImpl::readBytes: -> file not open" ); -#else - file_.read( (void*)(data), sal_uInt64(num),nbytesread ); -#endif - - return sal_Int32( nbytesread ); - } - - virtual void writeBytes( sal_Int8*, sal_Int32 ) - { - // Do nothing by now - } - - virtual sal_Int32 length() - { - osl::DirectoryItem aItem; - osl::FileStatus aStatus( FileStatusMask_FileSize ); - osl::DirectoryItem::get( path_,aItem ); - aItem.getFileStatus( aStatus ); - return sal_Int32( aStatus.getFileSize() ); - } - - virtual void close() - { - file_.close(); - } - - bool isOpen() - { - return isOpen_; - } - -private: - - rtl::OUString path_; - osl::File file_; - bool isOpen_; -}; - - -RandomAccessStreamImpl::RandomAccessStreamImpl( const rtl::OUString& aPath,const rtl::OUString& how ) - : path_( aPath ), - file_( aPath ) -{ - sal_uInt32 flags = 0; - const sal_Unicode* bla = how.getStr(); - - for( int i = 0; i < how.getLength(); ++i ) - { - if( bla[i] == sal_Unicode( 'r' ) ) - flags |= Read; - else if( bla[i] == sal_Unicode( 'w' ) ) - flags |= Write; - else if( bla[i] == sal_Unicode( 'c' ) ) - flags |= Create; - } - isOpen_ = ( file_.open( flags ) == osl::FileBase::E_None ); - if( !isOpen_ ) - { - file_.close(); - OSL_ENSURE( false,"RandomAccessStreamImpl::RandomAccessStreamImpl -> could not open file" ); - } -} - - - -RandomAccessStream* IndexAccessor::getStream( const rtl::OUString& fileName,const rtl::OUString& how ) const -{ - rtl::OUString qualifiedName; - int retry = 2; - RandomAccessStreamImpl *p = 0; - - while( retry-- && ! p ) - { - if( retry == 1 ) - qualifiedName = dirName_ + fileName; - else if( retry == 0 ) - qualifiedName = dirName_ + fileName.toAsciiLowerCase(); - - p = new RandomAccessStreamImpl( qualifiedName,how ); - if( ! p->isOpen() ) - { - delete p; p = 0; - } - } - - return p; -} - - -sal_Int32 IndexAccessor::readByteArray( sal_Int8*& out,const rtl::OUString& fileName ) - throw( IOException ) -{ - RandomAccessStream* in = getStream( fileName,rtl::OUString::createFromAscii("r") ); - if( ! in ) - throw IOException( - rtl::OUString::createFromAscii( "IndexAccessor::readByteArray -> cannot open file " ) + - fileName ); - - sal_Int32 n; - delete[] out; - out = new sal_Int8[ n = in->length() ]; - in->readBytes( out,n ); - delete in; - return n; -} - - - - - - - diff --git a/xmlhelp/source/cxxhelp/util/makefile.mk b/xmlhelp/source/cxxhelp/util/makefile.mk index e872498f719b..8e25c8584cd2 100644 --- a/xmlhelp/source/cxxhelp/util/makefile.mk +++ b/xmlhelp/source/cxxhelp/util/makefile.mk @@ -46,8 +46,7 @@ CFLAGS+=-GR .ENDIF SLOFILES=\ - $(SLO)$/Decompressor.obj \ - $(SLO)$/IndexAccessor.obj + $(SLO)$/Decompressor.obj # --- Targets ------------------------------------------------------ diff --git a/xmlhelp/util/makefile.mk b/xmlhelp/util/makefile.mk index fb0a92d8e679..8b2a95171345 100644 --- a/xmlhelp/util/makefile.mk +++ b/xmlhelp/util/makefile.mk @@ -72,7 +72,6 @@ SHL1STDLIBS= \ SHL1LIBS = \ $(SLB)$/jaqe.lib \ $(SLB)$/jautil.lib \ - $(SLB)$/jadb.lib \ $(SLB)$/chelp.lib # --- Def-File --------------------------------------------------------- diff --git a/xmloff/inc/xmloff/xmltypes.hxx b/xmloff/inc/xmloff/xmltypes.hxx index d00a8ab3ced2..a5f5eb72de1a 100644 --- a/xmloff/inc/xmloff/xmltypes.hxx +++ b/xmloff/inc/xmloff/xmltypes.hxx @@ -275,13 +275,12 @@ #define XML_TYPE_NUMBER16_AUTO (XML_TEXT_TYPES_START + 105) #define XML_TYPE_TEXT_SOFT_PAGE_BREAK (XML_TEXT_TYPES_START + 106) #define XML_TYPE_TEXT_USE_SOFT_PAGE_BREAKS (XML_TEXT_TYPES_START + 107) -#define XML_TYPE_TEXT_CLIP (XML_TEXT_TYPES_START + 108) - -#define XML_TYPE_TEXT_OVERLINE_TYPE (XML_TEXT_TYPES_START + 108) -#define XML_TYPE_TEXT_OVERLINE_STYLE (XML_TEXT_TYPES_START + 109) -#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 110) -#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 111) -#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 112) +#define XML_TYPE_TEXT_CLIP (XML_TEXT_TYPES_START + 108) +#define XML_TYPE_TEXT_OVERLINE_TYPE (XML_TEXT_TYPES_START + 109) +#define XML_TYPE_TEXT_OVERLINE_STYLE (XML_TEXT_TYPES_START + 110) +#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 111) +#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112) +#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113) #define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT) #define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index cdca6f1c314d..db1cb93203f6 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3057,12 +3057,14 @@ void SchXMLExportHelper::exportDataPoints( { aPropertyStates.clear(); uno::Reference< beans::XPropertySet > xPropSet; + bool bExportNumFmt = false; if( aAttrPointSet.find( nElement ) != aEndIt ) { try { xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet( xSeries, nElement, mrExport.GetModel() ); + bExportNumFmt = true; } catch( uno::Exception & rEx ) { @@ -3081,7 +3083,7 @@ void SchXMLExportHelper::exportDataPoints( if( xPropSet.is()) { const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 ) + if( nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 && bExportNumFmt ) { lcl_exportNumberFormat( sNumFormat, xPropSet, mrExport ); lcl_exportNumberFormat( sPercentageNumFormat, xPropSet, mrExport ); @@ -3107,7 +3109,8 @@ void SchXMLExportHelper::exportDataPoints( } } } - DBG_ASSERT( static_cast<sal_Int32>(aDataPointList.size()) == nSeriesLength, "not enough data points" ); + DBG_ASSERT( !bExportContent || (static_cast<sal_Int32>(aDataPointList.size()) == nSeriesLength), + "not enough data points on content export" ); } else { diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx index c1bffb7de71a..924918364970 100644 --- a/xmloff/source/core/nmspmap.cxx +++ b/xmloff/source/core/nmspmap.cxx @@ -254,8 +254,12 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey, { OUStringBuffer sQName; // ...if it's in our map, make the prefix - sQName.append ( (*aIter).second->sPrefix); - sQName.append ( sal_Unicode(':') ); + const OUString & prefix( (*aIter).second->sPrefix ); + if (prefix.getLength()) // not default namespace + { + sQName.append( prefix ); + sQName.append( sal_Unicode(':') ); + } sQName.append ( rLocalName ); if (bCache) { diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 6bb0db20749e..ad2bbc545bdb 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -1141,8 +1141,15 @@ namespace xmloff if ( bMakeAbsolute && ( _rValue.getLength() > 0 ) ) { // make a global URL out of the local one - ::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().ResolveGraphicObjectURL( _rValue, FALSE ); - OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue ); + ::rtl::OUString sAdjustedValue; + // only resolve image related url + // we don't want say form url targets to be resolved + // using ResolveGraphicObjectURL + if ( 0 == _rLocalName.compareToAscii( s_pImageDataAttributeName ) ) + sAdjustedValue = m_rContext.getGlobalContext().ResolveGraphicObjectURL( _rValue, FALSE ); + else + sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue ); + OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue ); } else OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, _rValue ); diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx index 41f8fbca526c..cf8156ae21e8 100644 --- a/xmloff/source/script/XMLEventExport.cxx +++ b/xmloff/source/script/XMLEventExport.cxx @@ -339,6 +339,8 @@ const XMLEventNameTranslation aStandardEventTable[] = { "OnSaveTo", XML_NAMESPACE_OFFICE, "save-to" }, { "OnSaveToDone", XML_NAMESPACE_OFFICE, "save-to-done" }, { "OnSaveToFailed", XML_NAMESPACE_OFFICE, "save-to-failed" }, + { "OnSubComponentOpened", XML_NAMESPACE_OFFICE, "subcomponent-opened" }, + { "OnSubComponentClosed", XML_NAMESPACE_OFFICE, "subcomponent-closed" }, { NULL, 0, 0 } }; diff --git a/xmloff/source/style/escphdl.cxx b/xmloff/source/style/escphdl.cxx index 999375d19cc5..2b14138691df 100644 --- a/xmloff/source/style/escphdl.cxx +++ b/xmloff/source/style/escphdl.cxx @@ -150,7 +150,11 @@ sal_Bool XMLEscapementHeightPropHdl::importXML( const OUString& rStrImpValue, un } else { - nProp = (sal_Int8) DFLT_ESC_PROP; + sal_Int32 nEscapementPosition=0; + if( SvXMLUnitConverter::convertPercent( nEscapementPosition, aToken ) && nEscapementPosition==0 ) + nProp = 100; //if escapement position is zero and no escapement height is given the default height should be 100percent and not something smaller (#i91800#) + else + nProp = (sal_Int8) DFLT_ESC_PROP; } rValue <<= nProp; diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index d4737ce7baec..18946de8c3a6 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -378,6 +378,8 @@ XMLPropertyMapEntry aXMLParaPropMap[] = MP_E( "DefaultOutlineLevel", STYLE, DEFAULT_OUTLINE_LEVEL, XML_TYPE_TEXT_NUMBER8_ONE_BASED|MID_FLAG_SPECIAL_ITEM_EXPORT|MID_FLAG_NO_PROPERTY_IMPORT, CTF_DEFAULT_OUTLINE_LEVEL ), + MP_ED( "FontIndependentLineSpacing", STYLE, FONT_INDEPENDENT_LINE_SPACING, XML_TYPE_BOOL, 0 ), + M_END() }; @@ -390,8 +392,6 @@ XMLPropertyMapEntry aXMLAdditionalTextDefaultsMap[] = // OD 2004-05-05 #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS MG_ED( "WrapInfluenceOnPosition", DRAW, WRAP_INFLUENCE_ON_POSITION, XML_TYPE_WRAP_INFLUENCE_ON_POSITION, 0 ), - MP_ED( "FontIndependentLineSpacing", STYLE, FONT_INDEPENDENT_LINE_SPACING, XML_TYPE_BOOL, 0 ), - M_END() }; |