diff options
744 files changed, 20811 insertions, 17046 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index e6520a40aedf..0e8928bc6c1a 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -103,6 +103,7 @@ TYPEINIT1(SbUnoObject,SbxObject) TYPEINIT1(SbUnoClass,SbxObject) TYPEINIT1(SbUnoService,SbxObject) TYPEINIT1(SbUnoServiceCtor,SbxMethod) +TYPEINIT1(SbUnoSingleton,SbxObject) typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper; @@ -3299,6 +3300,18 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t ) pRes->PutObject( xWrapper ); } } + + // An UNO singleton? + if( !pRes ) + { + SbUnoSingleton* pUnoSingleton = findUnoSingleton( aNewName ); + if( pUnoSingleton ) + { + pRes = new SbxVariable( SbxVARIANT ); + SbxObjectRef xWrapper = (SbxObject*)pUnoSingleton; + pRes->PutObject( xWrapper ); + } + } } } @@ -3579,6 +3592,90 @@ SbxInfo* SbUnoServiceCtor::GetInfo() } +SbUnoSingleton* findUnoSingleton( const String& rName ) +{ + SbUnoSingleton* pSbUnoSingleton = NULL; + + Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl(); + if( xTypeAccess->hasByHierarchicalName( rName ) ) + { + Any aRet = xTypeAccess->getByHierarchicalName( rName ); + Reference< XTypeDescription > xTypeDesc; + aRet >>= xTypeDesc; + + if( xTypeDesc.is() ) + { + TypeClass eTypeClass = xTypeDesc->getTypeClass(); + if( eTypeClass == TypeClass_SINGLETON ) + { + Reference< XSingletonTypeDescription > xSingletonTypeDesc( xTypeDesc, UNO_QUERY ); + if( xSingletonTypeDesc.is() ) + pSbUnoSingleton = new SbUnoSingleton( rName, xSingletonTypeDesc ); + } + } + } + return pSbUnoSingleton; +} + +SbUnoSingleton::SbUnoSingleton( const String& aName_, + const Reference< XSingletonTypeDescription >& xSingletonTypeDesc ) + : SbxObject( aName_ ) + , m_xSingletonTypeDesc( xSingletonTypeDesc ) +{ + SbxVariableRef xGetMethodRef = + new SbxMethod( String( RTL_CONSTASCII_USTRINGPARAM( "get" ) ), SbxOBJECT ); + QuickInsert( (SbxVariable*)xGetMethodRef ); +} + +void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pParams = pVar->GetParameters(); + UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0; + UINT32 nAllowedParamCount = 1; + + Reference < XComponentContext > xContextToUse; + if( nParamCount > 0 ) + { + // Check if first parameter is a context and use it then + Reference < XComponentContext > xFirstParamContext; + Any aArg1 = sbxToUnoValue( pParams->Get( 1 ) ); + if( (aArg1 >>= xFirstParamContext) && xFirstParamContext.is() ) + xContextToUse = xFirstParamContext; + } + + if( !xContextToUse.is() ) + { + Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + xContextToUse.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW ); + --nAllowedParamCount; + } + + if( nParamCount > nAllowedParamCount ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + Any aRetAny; + if( xContextToUse.is() ) + { + String aSingletonName( RTL_CONSTASCII_USTRINGPARAM("/singletons/") ); + aSingletonName += GetName(); + Reference < XInterface > xRet; + xContextToUse->getValueByName( aSingletonName ) >>= xRet; + aRetAny <<= xRet; + } + unoToSbxValue( pVar, aRetAny ); + } + else + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); +} + //======================================================================== //======================================================================== diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index d96edd1bc298..2d9836e3530e 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -41,6 +41,7 @@ #include <com/sun/star/script/XInvocation.hpp> #include <com/sun/star/reflection/XIdlClass.hpp> #include <com/sun/star/reflection/XServiceTypeDescription2.hpp> +#include <com/sun/star/reflection/XSingletonTypeDescription.hpp> #include <rtl/ustring.hxx> class SbUnoObject: public SbxObject @@ -226,6 +227,23 @@ public: }; +// Wrapper for UNO Singleton +class SbUnoSingleton : public SbxObject +{ + const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XSingletonTypeDescription > m_xSingletonTypeDesc; + +public: + TYPEINFO(); + SbUnoSingleton( const String& aName_, + const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XSingletonTypeDescription >& xSingletonTypeDesc ); + + void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); +}; +SV_DECL_IMPL_REF(SbUnoSingleton); + +SbUnoSingleton* findUnoSingleton( const String& rName ); + + // #105565 Special Object to wrap a strongly typed Uno Any class SbUnoAnyObject: public SbxObject { diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 6ccb7e81d2c4..14c84420dad6 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1744,7 +1744,7 @@ void SfxLibraryContainer::implImportLibDescriptor // Methods of new XLibraryStorage interface? -void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Bool bComplete ) +void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& i_rStorage, sal_Bool bComplete ) { const Sequence< OUString > aNames = maNameContainer.getElementNames(); sal_Int32 nNameCount = aNames.getLength(); @@ -1765,35 +1765,13 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave ); // Write to storage? - sal_Bool bStorage = xStorage.is(); - uno::Reference< embed::XStorage > xLibrariesStor; + sal_Bool bStorage = i_rStorage.is(); uno::Reference< embed::XStorage > xSourceLibrariesStor; - if( bStorage ) + uno::Reference< embed::XStorage > xTargetLibrariesStor; + ::rtl::OUString sTempTargetStorName; + const bool bInplaceStorage = bStorage && ( i_rStorage == mxStorage ); + if ( bStorage ) { - // when we save to our root storage, ensure the libs are all loaded. Else the below cleaning - // of the target storage will loose them. - if ( xStorage == mxStorage ) - { - pName = aNames.getConstArray(); - for ( ; pName != pNamesEnd; ++pName ) - { - if ( !isLibraryLoaded( *pName ) ) - loadLibrary( *pName ); - } - } - - // first of all, clean the target library storage, since the storing procedure must do overwrite - try - { - if ( xStorage->hasByName( maLibrariesDir ) ) - xStorage->removeElement( maLibrariesDir ); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return; - } - // Don't write if only empty standard lib exists if ( ( nNameCount == 1 ) && ( aNames[0].equalsAscii( "Standard" ) ) ) { @@ -1804,29 +1782,54 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto return; } - try { - xLibrariesStor.set( xStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); + // create the empty target storage + try + { + ::rtl::OUString sTargetLibrariesStoreName; + if ( bInplaceStorage ) + { + // create a temporary target storage + const ::rtl::OUStringBuffer aTempTargetNameBase = maLibrariesDir + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_temp_" ) ); + sal_Int32 index = 0; + do + { + ::rtl::OUStringBuffer aTempTargetName( aTempTargetNameBase ); + aTempTargetName.append( index++ ); + + sTargetLibrariesStoreName = aTempTargetName.makeStringAndClear(); + if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + break; + } + while ( true ); + sTempTargetStorName = sTargetLibrariesStoreName; + } + else + { + sTargetLibrariesStoreName = maLibrariesDir; + if ( i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + i_rStorage->removeElement( sTargetLibrariesStoreName ); + } + + xTargetLibrariesStor.set( i_rStorage->openStorageElement( sTargetLibrariesStoreName, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - #if OSL_DEBUG_LEVEL > 0 - Any aError( ::cppu::getCaughtException() ); - ::rtl::OStringBuffer aMessage; - aMessage.append( "couln't open source library storage.\n\nException:" ); - aMessage.append( ::rtl::OUStringToOString( ::comphelper::anyToString( aError ), osl_getThreadTextEncoding() ) ); - OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); - #endif + DBG_UNHANDLED_EXCEPTION(); return; } + // open the source storage which might be used to copy yet-unmodified libraries try { - if ( ( mxStorage != xStorage ) && ( mxStorage->hasByName( maLibrariesDir ) ) ) - xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); + if ( mxStorage->hasByName( maLibrariesDir ) ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ ); + else if ( bInplaceStorage ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ); } catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); + return; } } @@ -1838,7 +1841,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto SfxLibrary* pImplLib = getImplLib( *pName ); if( pImplLib->mbSharedIndexFile ) continue; - bool bExtensionLib = pImplLib->mbExtension; + const bool bExtensionLib = pImplLib->mbExtension; ::xmlscript::LibDescriptor& rLib = bExtensionLib ? aLibDescriptorForExtensionLibs : pLibArray->mpLibs[iArray]; if( !bExtensionLib ) @@ -1858,12 +1861,14 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto if( pImplLib->implIsModified() || bComplete ) { - // Can we copy the storage? + // Can we simply copy the storage? if( !mbOldInfoFormat && !pImplLib->implIsModified() && !mbOasis2OOoFormat && xSourceLibrariesStor.is() ) { - try { - xSourceLibrariesStor->copyElementTo( rLib.aName, xLibrariesStor, rLib.aName ); - } catch( uno::Exception& ) + try + { + xSourceLibrariesStor->copyElementTo( rLib.aName, xTargetLibrariesStor, rLib.aName ); + } + catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); // TODO: error handling? @@ -1876,7 +1881,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { try { - xLibraryStor = xLibrariesStor->openStorageElement( + xLibraryStor = xTargetLibrariesStor->openStorageElement( rLib.aName, embed::ElementModes::READWRITE ); } @@ -1908,7 +1913,8 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto implStoreLibraryIndexFile( pImplLib, rLib, xLibraryStor ); if( bStorage ) { - try { + try + { uno::Reference< embed::XTransactedObject > xTransact( xLibraryStor, uno::UNO_QUERY_THROW ); xTransact->commit(); } @@ -1928,6 +1934,59 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto rLib.bReadOnly = pImplLib->mbReadOnlyLink; } + // if we did an in-place save into a storage (i.e. a save into the storage we were already based on), + // then we need to clean up the temporary storage we used for this + if ( bInplaceStorage && sTempTargetStorName.getLength() ) + { + OSL_ENSURE( xSourceLibrariesStor.is(), "SfxLibrariesContainer::storeLibraries_impl: unexpected: we should have a source storage here!" ); + try + { + // for this, we first remove everything from the source storage, then copy the complete content + // from the temporary target storage. From then on, what used to be the "source storage" becomes + // the "targt storage" for all subsequent operations. + + // (We cannot simply remove the storage, denoted by maLibrariesDir, from i_rStorage - there might be + // open references to it.) + + if ( xSourceLibrariesStor.is() ) + { + // remove + const Sequence< ::rtl::OUString > aRemoveNames( xSourceLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pRemoveName = aRemoveNames.getConstArray(); + pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength(); + ++pRemoveName + ) + { + xSourceLibrariesStor->removeElement( *pRemoveName ); + } + + // copy + const Sequence< ::rtl::OUString > aCopyNames( xTargetLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pCopyName = aCopyNames.getConstArray(); + pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength(); + ++pCopyName + ) + { + xTargetLibrariesStor->copyElementTo( *pCopyName, xSourceLibrariesStor, *pCopyName ); + } + } + + // close and remove temp target + xTargetLibrariesStor->dispose(); + i_rStorage->removeElement( sTempTargetStorName ); + xTargetLibrariesStor.clear(); + sTempTargetStorName = ::rtl::OUString(); + + // adjust target + xTargetLibrariesStor = xSourceLibrariesStor; + xSourceLibrariesStor.clear(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + if( !mbOldInfoFormat && !maModifiable.isModified() ) return; maModifiable.setModified( sal_False ); @@ -1953,7 +2012,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") ); try { - xInfoStream = xLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); + xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY ); OSL_ENSURE ( xProps.is(), "The stream must implement XPropertySet!\n" ); if ( !xProps.is() ) @@ -2012,7 +2071,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto xmlscript::exportLibraryContainer( xHandler, pLibArray ); if ( bStorage ) { - uno::Reference< embed::XTransactedObject > xTransact( xLibrariesStor, uno::UNO_QUERY ); + uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY ); OSL_ENSURE( xTransact.is(), "The storage must implement XTransactedObject!\n" ); if ( !xTransact.is() ) throw uno::RuntimeException(); diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 2f860f805487..8306c692c30f 100644 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -28,7 +28,7 @@ #include "precompiled_configmgr.hxx" #include "sal/config.h" -#include <cstddef> +#include <climits> #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" diff --git a/connectivity/inc/connectivity/TTableHelper.hxx b/connectivity/inc/connectivity/TTableHelper.hxx index 2f6e094cc224..9f0a644e0b6d 100644 --- a/connectivity/inc/connectivity/TTableHelper.hxx +++ b/connectivity/inc/connectivity/TTableHelper.hxx @@ -33,6 +33,10 @@ #include "connectivity/sdbcx/VKey.hxx" #include "connectivity/StdTypeDefs.hxx" #include <comphelper/stl_types.hxx> +#include <com/sun/star/sdb/tools/XTableRename.hpp> +#include <com/sun/star/sdb/tools/XTableAlteration.hpp> +#include <com/sun/star/sdb/tools/XKeyAlteration.hpp> +#include <com/sun/star/sdb/tools/XIndexAlteration.hpp> namespace connectivity { @@ -155,6 +159,11 @@ namespace connectivity void addKey(const ::rtl::OUString& _sName,const sdbcx::TKeyProperties& _aKeyProperties); virtual ::rtl::OUString getTypeCreatePattern() const; + + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableRename> getRenameService() const; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableAlteration> getAlterService() const; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XKeyAlteration> getKeyService() const; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XIndexAlteration> getIndexService() const; }; } #endif // CONNECTIVITY_TABLEHELPER_HXX diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx index 76593f1fa7e6..1503291ef9b7 100644 --- a/connectivity/inc/connectivity/dbtools.hxx +++ b/connectivity/inc/connectivity/dbtools.hxx @@ -350,6 +350,33 @@ namespace dbtools ,const ::rtl::OUString& _sProperty, sal_Bool _bDefault = sal_False); + /** retrieves a particular indirect data source setting + + @param _rxDataSource + a data source component + @param _pAsciiSettingsName + the ASCII name of the setting to obtain + @param _rSettingsValue + the value of the setting, upon successfull return + + @return + <FALSE/> if the setting is not present in the <member scope="com::sun::star::sdb">DataSource::Info</member> + member of the data source + <TRUE/> otherwise + */ + OOO_DLLPUBLIC_DBTOOLS + bool getDataSourceSetting( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource, + const sal_Char* _pAsciiSettingsName, + ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue + ); + OOO_DLLPUBLIC_DBTOOLS + bool getDataSourceSetting( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource, + const ::rtl::OUString& _sSettingsName, + ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue + ); + OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getDefaultReportEngineServiceName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); /** quote the given name with the given quote string. diff --git a/connectivity/inc/connectivity/formattedcolumnvalue.hxx b/connectivity/inc/connectivity/formattedcolumnvalue.hxx index 6b3f477cfe65..d9bb8b49973f 100644 --- a/connectivity/inc/connectivity/formattedcolumnvalue.hxx +++ b/connectivity/inc/connectivity/formattedcolumnvalue.hxx @@ -33,6 +33,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/sdb/XColumn.hpp> #include <com/sun/star/sdb/XColumnUpdate.hpp> +#include <com/sun/star/util/XNumberFormatter.hpp> /** === end UNO includes === **/ #include <boost/noncopyable.hpp> @@ -74,6 +75,19 @@ namespace dbtools const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn ); + /** constructs an instance + + The format key for the string value exchange is taken from the given column object. + If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken. + Otherwise, a default format matching the column type is determined. + + The locale of this fallback format is the current system locale. + */ + FormattedColumnValue( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& i_rNumberFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_rColumn + ); + // note that all methods of this class need to be virtual, since it's // used in a load-on-demand context in module SVX diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx index dcd341cb4db7..1f77d51929d0 100644 --- a/connectivity/source/commontools/TIndexes.cxx +++ b/connectivity/source/commontools/TIndexes.cxx @@ -140,73 +140,80 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const ::rtl::OUString& _rForName if ( m_pTable->isNew() ) return cloneDescriptor( descriptor ); - ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); - ::rtl::OUStringBuffer aSql( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CREATE "))); - ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); - ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + if ( m_pTable->getIndexService().is() ) + { + m_pTable->getIndexService()->addIndex(m_pTable,descriptor); + } + else + { + ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); + ::rtl::OUStringBuffer aSql( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CREATE "))); + ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); - if(comphelper::getBOOL(descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISUNIQUE)))) - aSql.appendAscii("UNIQUE "); - aSql.appendAscii("INDEX "); + if(comphelper::getBOOL(descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISUNIQUE)))) + aSql.appendAscii("UNIQUE "); + aSql.appendAscii("INDEX "); - ::rtl::OUString aCatalog,aSchema,aTable; - dbtools::qualifiedNameComponents(m_pTable->getMetaData(),m_pTable->getName(),aCatalog,aSchema,aTable,::dbtools::eInDataManipulation); - ::rtl::OUString aComposedName; + ::rtl::OUString aCatalog,aSchema,aTable; + dbtools::qualifiedNameComponents(m_pTable->getMetaData(),m_pTable->getName(),aCatalog,aSchema,aTable,::dbtools::eInDataManipulation); + ::rtl::OUString aComposedName; - aComposedName = dbtools::composeTableName(m_pTable->getMetaData(),aCatalog,aSchema,aTable,sal_True,::dbtools::eInIndexDefinitions); - if ( _rForName.getLength() ) - { - aSql.append( ::dbtools::quoteName( aQuote, _rForName ) ); - aSql.appendAscii(" ON "); - aSql.append(aComposedName); - aSql.appendAscii(" ( "); - - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - sal_Bool bAddIndexAppendix = ::dbtools::getBooleanDataSourceSetting( m_pTable->getConnection(), "AddIndexAppendix" ); - sal_Int32 nCount = xColumns->getCount(); - for(sal_Int32 i = 0 ; i < nCount; ++i) + aComposedName = dbtools::composeTableName(m_pTable->getMetaData(),aCatalog,aSchema,aTable,sal_True,::dbtools::eInIndexDefinitions); + if ( _rForName.getLength() ) { - xColProp.set(xColumns->getByIndex(i),UNO_QUERY); - aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); + aSql.append( ::dbtools::quoteName( aQuote, _rForName ) ); + aSql.appendAscii(" ON "); + aSql.append(aComposedName); + aSql.appendAscii(" ( "); - if ( bAddIndexAppendix ) + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + sal_Bool bAddIndexAppendix = ::dbtools::getBooleanDataSourceSetting( m_pTable->getConnection(), "AddIndexAppendix" ); + sal_Int32 nCount = xColumns->getCount(); + for(sal_Int32 i = 0 ; i < nCount; ++i) { + xColProp.set(xColumns->getByIndex(i),UNO_QUERY); + aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); + + if ( bAddIndexAppendix ) + { - aSql.appendAscii(any2bool(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISASCENDING))) - ? - " ASC" - : - " DESC"); + aSql.appendAscii(any2bool(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISASCENDING))) + ? + " ASC" + : + " DESC"); + } + aSql.appendAscii(","); } - aSql.appendAscii(","); + aSql.setCharAt(aSql.getLength()-1,')'); } - aSql.setCharAt(aSql.getLength()-1,')'); - } - else - { - aSql.append(aComposedName); + else + { + aSql.append(aComposedName); - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - if(xColumns->getCount() != 1) - throw SQLException(); + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + if(xColumns->getCount() != 1) + throw SQLException(); - xColumns->getByIndex(0) >>= xColProp; + xColumns->getByIndex(0) >>= xColProp; - aSql.append(aDot); - aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); - } + aSql.append(aDot); + aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); + } - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - if ( xStmt.is() ) - { - ::rtl::OUString sSql = aSql.makeStringAndClear(); - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + if ( xStmt.is() ) + { + ::rtl::OUString sSql = aSql.makeStringAndClear(); + xStmt->execute(sSql); + ::comphelper::disposeComponent(xStmt); + } } return createObject( _rForName ); @@ -218,27 +225,34 @@ void OIndexesHelper::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElem Reference< XConnection> xConnection = m_pTable->getConnection(); if( xConnection.is() && !m_pTable->isNew()) { - ::rtl::OUString aName,aSchema; - sal_Int32 nLen = _sElementName.indexOf('.'); - if(nLen != -1) - aSchema = _sElementName.copy(0,nLen); - aName = _sElementName.copy(nLen+1); + if ( m_pTable->getIndexService().is() ) + { + m_pTable->getIndexService()->dropIndex(m_pTable,_sElementName); + } + else + { + ::rtl::OUString aName,aSchema; + sal_Int32 nLen = _sElementName.indexOf('.'); + if(nLen != -1) + aSchema = _sElementName.copy(0,nLen); + aName = _sElementName.copy(nLen+1); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP INDEX "); + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP INDEX "); - ::rtl::OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::eInIndexDefinitions, false, false, true ); - ::rtl::OUString sIndexName,sTemp; - sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), sTemp, aSchema, aName, sal_True, ::dbtools::eInIndexDefinitions ); + ::rtl::OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::eInIndexDefinitions, false, false, true ); + ::rtl::OUString sIndexName,sTemp; + sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), sTemp, aSchema, aName, sal_True, ::dbtools::eInIndexDefinitions ); - aSql += sIndexName - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")) - + aComposedName; + aSql += sIndexName + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")) + + aComposedName; - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + if ( xStmt.is() ) + { + xStmt->execute(aSql); + ::comphelper::disposeComponent(xStmt); + } } } } diff --git a/connectivity/source/commontools/TKeys.cxx b/connectivity/source/commontools/TKeys.cxx index d6325f0b0a93..c4d5dfbf20e0 100644 --- a/connectivity/source/commontools/TKeys.cxx +++ b/connectivity/source/commontools/TKeys.cxx @@ -147,69 +147,80 @@ sdbcx::ObjectType OKeysHelper::appendObject( const ::rtl::OUString& _rForName, c return xNewDescriptor; } - // if we're here, we belong to a table which is not new, i.e. already exists in the database. - // In this case, really append the new index. - const ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE))); + sal_Int32 nUpdateRule = 0, nDeleteRule = 0; + ::rtl::OUString sReferencedName; - ::rtl::OUString aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE ")); - ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); - ::rtl::OUString aDot = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); - - aSql += composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::eInTableDefinitions, false, false, true ); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ADD ")); - - if ( nKeyType == KeyType::PRIMARY ) + if ( nKeyType == KeyType::FOREIGN ) { - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PRIMARY KEY (")); + descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_REFERENCEDTABLE)) >>= sReferencedName; + descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_UPDATERULE)) >>= nUpdateRule; + descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_DELETERULE)) >>= nDeleteRule; } - else if ( nKeyType == KeyType::FOREIGN ) + + if ( m_pTable->getKeyService().is() ) { - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY (")); + m_pTable->getKeyService()->addKey(m_pTable,descriptor); } else - throw SQLException(); - - Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); - Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - for(sal_Int32 i=0;i<xColumns->getCount();++i) { - ::cppu::extractInterface(xColProp,xColumns->getByIndex(i)); - aSql += ::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); + // if we're here, we belong to a table which is not new, i.e. already exists in the database. + // In this case, really append the new index. + ::rtl::OUStringBuffer aSql; + aSql.appendAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); - sal_Int32 nUpdateRule = 0, nDeleteRule = 0; - ::rtl::OUString sReferencedName; + aSql.append(composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::eInTableDefinitions, false, false, true )); + aSql.appendAscii(" ADD "); - if ( nKeyType == KeyType::FOREIGN ) - { - descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_REFERENCEDTABLE)) >>= sReferencedName; - - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" REFERENCES ")) - + ::dbtools::quoteTableName(m_pTable->getConnection()->getMetaData(),sReferencedName,::dbtools::eInTableDefinitions); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); + if ( nKeyType == KeyType::PRIMARY ) + { + aSql.appendAscii(" PRIMARY KEY ("); + } + else if ( nKeyType == KeyType::FOREIGN ) + { + aSql.appendAscii(" FOREIGN KEY ("); + } + else + throw SQLException(); - for(sal_Int32 i=0;i<xColumns->getCount();++i) + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + for(sal_Int32 i = 0 ; i < xColumns->getCount() ; ++i) { - xColumns->getByIndex(i) >>= xColProp; - aSql += ::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_RELATEDCOLUMN)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + if ( i > 0 ) + aSql.appendAscii(","); + ::cppu::extractInterface(xColProp,xColumns->getByIndex(i)); + aSql.append( ::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) ); + } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); + aSql.appendAscii(")"); - descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_UPDATERULE)) >>= nUpdateRule; - descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_DELETERULE)) >>= nDeleteRule; + if ( nKeyType == KeyType::FOREIGN ) + { + aSql.appendAscii(" REFERENCES "); + aSql.append(::dbtools::quoteTableName(m_pTable->getConnection()->getMetaData(),sReferencedName,::dbtools::eInTableDefinitions)); + aSql.appendAscii(" ("); - aSql += getKeyRuleString(sal_True ,nUpdateRule); - aSql += getKeyRuleString(sal_False ,nDeleteRule); - } + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + if ( i > 0 ) + aSql.appendAscii(","); + xColumns->getByIndex(i) >>= xColProp; + aSql.append(::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_RELATEDCOLUMN))))); - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - xStmt->execute(aSql); + } + aSql.appendAscii(")"); + aSql.append(getKeyRuleString(sal_True ,nUpdateRule)); + aSql.append(getKeyRuleString(sal_False ,nDeleteRule)); + } + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql.makeStringAndClear()); + } // find the name which the database gave the new key ::rtl::OUString sNewName( _rForName ); try @@ -266,34 +277,41 @@ void OKeysHelper::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName Reference< XConnection> xConnection = m_pTable->getConnection(); if ( xConnection.is() && !m_pTable->isNew() ) { - ::rtl::OUString aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE ")); - - aSql += composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::eInTableDefinitions, false, false, true ); - Reference<XPropertySet> xKey(getObject(_nPos),UNO_QUERY); - - sal_Int32 nKeyType = KeyType::PRIMARY; - if ( xKey.is() ) - { - ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); - xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= nKeyType; - } - if ( KeyType::PRIMARY == nKeyType ) + if ( m_pTable->getKeyService().is() ) { - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP PRIMARY KEY")); + m_pTable->getKeyService()->dropKey(m_pTable,xKey); } else { - aSql += getDropForeignKey(); - const ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString(); - aSql += ::dbtools::quoteName( aQuote,_sElementName); - } + ::rtl::OUStringBuffer aSql; + aSql.appendAscii("ALTER TABLE "); - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); + aSql.append( composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::eInTableDefinitions, false, false, true )); + + sal_Int32 nKeyType = KeyType::PRIMARY; + if ( xKey.is() ) + { + ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); + xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= nKeyType; + } + if ( KeyType::PRIMARY == nKeyType ) + { + aSql.appendAscii(" DROP PRIMARY KEY"); + } + else + { + aSql.append(getDropForeignKey()); + const ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString(); + aSql.append( ::dbtools::quoteName( aQuote,_sElementName) ); + } + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + if ( xStmt.is() ) + { + xStmt->execute(aSql.makeStringAndClear()); + ::comphelper::disposeComponent(xStmt); + } } } } diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx index 14da663a9022..f44b08fa15b7 100644 --- a/connectivity/source/commontools/TTableHelper.cxx +++ b/connectivity/source/commontools/TTableHelper.cxx @@ -95,14 +95,53 @@ public: } namespace connectivity { + ::rtl::OUString lcl_getServiceNameForSetting(const Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,const ::rtl::OUString& i_sSetting) + { + ::rtl::OUString sSupportService; + Any aValue; + if ( ::dbtools::getDataSourceSetting(_xConnection,i_sSetting,aValue) ) + { + aValue >>= sSupportService; + } + return sSupportService; + } struct OTableHelperImpl { TKeyMap m_aKeys; - Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + // helper services which can be provided by extensions + Reference< ::com::sun::star::sdb::tools::XTableRename> m_xRename; + Reference< ::com::sun::star::sdb::tools::XTableAlteration> m_xAlter; + Reference< ::com::sun::star::sdb::tools::XKeyAlteration> m_xKeyAlter; + Reference< ::com::sun::star::sdb::tools::XIndexAlteration> m_xIndexAlter; + + Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; ::comphelper::ImplementationReference< OTableContainerListener,XContainerListener> m_xTablePropertyListener; ::std::vector< ColumnDesc > m_aColumnDesc; + OTableHelperImpl(const Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) + : m_xConnection(_xConnection) + { + try + { + m_xMetaData = m_xConnection->getMetaData(); + Reference<XMultiServiceFactory> xFac(_xConnection,UNO_QUERY); + if ( xFac.is() ) + { + static const ::rtl::OUString s_sTableRename(RTL_CONSTASCII_USTRINGPARAM("TableRenameServiceName")); + m_xRename.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sTableRename)),UNO_QUERY); + static const ::rtl::OUString s_sTableAlteration(RTL_CONSTASCII_USTRINGPARAM("TableAlterationServiceName")); + m_xAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sTableAlteration)),UNO_QUERY); + static const ::rtl::OUString s_sKeyAlteration(RTL_CONSTASCII_USTRINGPARAM("KeyAlterationServiceName")); + m_xKeyAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sKeyAlteration)),UNO_QUERY); + static const ::rtl::OUString s_sIndexAlteration(RTL_CONSTASCII_USTRINGPARAM("IndexAlterationServiceName")); + m_xIndexAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sIndexAlteration)),UNO_QUERY); + } + } + catch(const Exception&) + { + } + } }; } @@ -110,16 +149,8 @@ OTableHelper::OTableHelper( sdbcx::OCollection* _pTables, const Reference< XConnection >& _xConnection, sal_Bool _bCase) :OTable_TYPEDEF(_pTables,_bCase) - ,m_pImpl(new OTableHelperImpl) + ,m_pImpl(new OTableHelperImpl(_xConnection)) { - try - { - m_pImpl->m_xConnection = _xConnection; - m_pImpl->m_xMetaData = m_pImpl->m_xConnection->getMetaData(); - } - catch(const Exception&) - { - } } // ------------------------------------------------------------------------- OTableHelper::OTableHelper( sdbcx::OCollection* _pTables, @@ -137,16 +168,8 @@ OTableHelper::OTableHelper( sdbcx::OCollection* _pTables, _Description, _SchemaName, _CatalogName) - ,m_pImpl(new OTableHelperImpl) + ,m_pImpl(new OTableHelperImpl(_xConnection)) { - try - { - m_pImpl->m_xConnection = _xConnection; - m_pImpl->m_xMetaData = m_pImpl->m_xConnection->getMetaData(); - } - catch(const Exception&) - { - } } // ----------------------------------------------------------------------------- OTableHelper::~OTableHelper() @@ -480,24 +503,31 @@ void SAL_CALL OTableHelper::rename( const ::rtl::OUString& newName ) throw(SQLEx if(!isNew()) { - ::rtl::OUString sSql = getRenameStart(); - ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); + if ( m_pImpl->m_xRename.is() ) + { + m_pImpl->m_xRename->rename(this,newName); + } + else + { + ::rtl::OUString sSql = getRenameStart(); + ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); - ::rtl::OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(getMetaData(),newName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); + ::rtl::OUString sCatalog,sSchema,sTable; + ::dbtools::qualifiedNameComponents(getMetaData(),newName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); - ::rtl::OUString sComposedName; - sComposedName = ::dbtools::composeTableName(getMetaData(),m_CatalogName,m_SchemaName,m_Name,sal_True,::dbtools::eInDataManipulation); - sSql += sComposedName - + ::rtl::OUString::createFromAscii(" TO "); - sComposedName = ::dbtools::composeTableName(getMetaData(),sCatalog,sSchema,sTable,sal_True,::dbtools::eInDataManipulation); - sSql += sComposedName; + ::rtl::OUString sComposedName; + sComposedName = ::dbtools::composeTableName(getMetaData(),m_CatalogName,m_SchemaName,m_Name,sal_True,::dbtools::eInDataManipulation); + sSql += sComposedName + + ::rtl::OUString::createFromAscii(" TO "); + sComposedName = ::dbtools::composeTableName(getMetaData(),sCatalog,sSchema,sTable,sal_True,::dbtools::eInDataManipulation); + sSql += sComposedName; - Reference< XStatement > xStmt = m_pImpl->m_xConnection->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); + Reference< XStatement > xStmt = m_pImpl->m_xConnection->createStatement( ); + if ( xStmt.is() ) + { + xStmt->execute(sSql); + ::comphelper::disposeComponent(xStmt); + } } OTable_TYPEDEF::rename(newName); @@ -576,3 +606,24 @@ Reference< XConnection> OTableHelper::getConnection() const { return m_pImpl->m_xConnection; } +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XTableRename> OTableHelper::getRenameService() const +{ + return m_pImpl->m_xRename; +} +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XTableAlteration> OTableHelper::getAlterService() const +{ + return m_pImpl->m_xAlter; +} +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XKeyAlteration> OTableHelper::getKeyService() const +{ + return m_pImpl->m_xKeyAlter; +} +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XIndexAlteration> OTableHelper::getIndexService() const +{ + return m_pImpl->m_xIndexAlter; +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 09cad3928da5..0b7cb5b5df58 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -318,8 +318,8 @@ Reference< XConnection > getConnection_allowException( Reference<XCompletedConnection> xConnectionCompletion(xProp, UNO_QUERY); if (xConnectionCompletion.is()) { // instantiate the default SDB interaction handler - Reference< XInteractionHandler > xHandler(_rxFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.InteractionHandler")), UNO_QUERY); - OSL_ENSURE(xHandler.is(), "dbtools::getConnection service com.sun.star.sdb.InteractionHandler not available!"); + Reference< XInteractionHandler > xHandler(_rxFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandler")), UNO_QUERY); + OSL_ENSURE(xHandler.is(), "dbtools::getConnection service com.sun.star.task.InteractionHandler not available!"); if (xHandler.is()) { xConnection = xConnectionCompletion->connectWithCompletion(xHandler); diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 24184fb5ecad..7cf12345ae67 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -593,7 +593,39 @@ bool getBooleanDataSourceSetting( const Reference< XConnection >& _rxConnection, } return bValue; } +// ------------------------------------------------------------------------- +bool getDataSourceSetting( const Reference< XInterface >& _xChild, const ::rtl::OUString& _sAsciiSettingsName, + Any& /* [out] */ _rSettingsValue ) +{ + bool bIsPresent = false; + try + { + const Reference< XPropertySet> xDataSourceProperties( findDataSource( _xChild ), UNO_QUERY ); + OSL_ENSURE( xDataSourceProperties.is(), "getDataSourceSetting: invalid data source object!" ); + if ( !xDataSourceProperties.is() ) + return false; + + const Reference< XPropertySet > xSettings( + xDataSourceProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Settings") ) ), + UNO_QUERY_THROW + ); + _rSettingsValue = xSettings->getPropertyValue( _sAsciiSettingsName ); + bIsPresent = true; + } + catch( const Exception& ) + { + bIsPresent = false; + } + return bIsPresent; +} +// ------------------------------------------------------------------------- +bool getDataSourceSetting( const Reference< XInterface >& _rxDataSource, const sal_Char* _pAsciiSettingsName, + Any& /* [out] */ _rSettingsValue ) +{ + ::rtl::OUString sAsciiSettingsName = ::rtl::OUString::createFromAscii(_pAsciiSettingsName); + return getDataSourceSetting( _rxDataSource, sAsciiSettingsName,_rSettingsValue ); +} // ----------------------------------------------------------------------------- sal_Bool isDataSourcePropertyEnabled(const Reference<XInterface>& _xProp,const ::rtl::OUString& _sProperty,sal_Bool _bDefault) { diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index 95cda758eaa0..3707b7fdb65d 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -42,13 +42,11 @@ /** === end UNO includes === **/ //#include <unotools/syslocale.hxx> - #include <tools/diagnose_ex.h> - #include <i18npool/mslangid.hxx> - #include <comphelper/numbers.hxx> #include <comphelper/componentcontext.hxx> +#include <unotools/sharedunocomponent.hxx> //........................................................................ namespace dbtools @@ -59,6 +57,7 @@ namespace dbtools using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; @@ -113,21 +112,7 @@ namespace dbtools //................................................................ void lcl_clear_nothrow( FormattedColumnValue_Data& _rData ) { - if ( _rData.m_xFormatter.is() ) - { - try - { - Reference< XComponent > xFormatterComp( _rData.m_xFormatter, UNO_QUERY ); - if ( xFormatterComp.is() ) - xFormatterComp->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - _rData.m_xFormatter.clear(); - } - + _rData.m_xFormatter.clear(); _rData.m_nFormatKey = 0; _rData.m_nFieldType = DataType::OTHER; _rData.m_nKeyType = NumberFormat::UNDEFINED; @@ -138,21 +123,24 @@ namespace dbtools } //................................................................ - void lcl_initColumnDataValue_nothrow( const ::comphelper::ComponentContext& _rContext, FormattedColumnValue_Data& _rData, - const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& _rxColumn ) + void lcl_initColumnDataValue_nothrow( FormattedColumnValue_Data& _rData, + const Reference< XNumberFormatter >& i_rNumberFormatter, const Reference< XPropertySet >& _rxColumn ) { lcl_clear_nothrow( _rData ); - OSL_PRECOND( _rxRowSet.is(), "lcl_initColumnDataValue_nothrow: no row set!" ); - OSL_PRECOND( _rxColumn.is(), "lcl_initColumnDataValue_nothrow: no column!" ); - if ( !_rxRowSet.is() || !_rxColumn.is() ) + OSL_PRECOND( i_rNumberFormatter.is(), "lcl_initColumnDataValue_nothrow: no number formats -> no formatted values!" ); + if ( !i_rNumberFormatter.is() ) return; try { + Reference< XNumberFormatsSupplier > xNumberFormatsSupp( i_rNumberFormatter->getNumberFormatsSupplier(), UNO_SET_THROW ); + + // remember the column _rData.m_xColumn.set( _rxColumn, UNO_QUERY_THROW ); _rData.m_xColumnUpdate.set( _rxColumn, UNO_QUERY ); + // determine the field type, and whether it's a numeric field OSL_VERIFY( _rxColumn->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) ) ) >>= _rData.m_nFieldType ); switch ( _rData.m_nFieldType ) @@ -177,10 +165,6 @@ namespace dbtools break; } - // get the number formats supplier of the connection of the form - Reference< XConnection > xConnection( getConnection( _rxRowSet ), UNO_QUERY_THROW ); - Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, sal_False, _rContext.getLegacyServiceFactory() ), UNO_QUERY_THROW ); - // get the format key of our bound field Reference< XPropertySetInfo > xPSI( _rxColumn->getPropertySetInfo(), UNO_QUERY_THROW ); bool bHaveFieldFormat = false; @@ -194,23 +178,49 @@ namespace dbtools // fall back to a format key as indicated by the field type Locale aSystemLocale; MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage(), aSystemLocale ); - Reference< XNumberFormatTypes > xNumTypes( xSupplier->getNumberFormats(), UNO_QUERY_THROW ); + Reference< XNumberFormatTypes > xNumTypes( xNumberFormatsSupp->getNumberFormats(), UNO_QUERY_THROW ); _rData.m_nFormatKey = getDefaultNumberFormat( _rxColumn, xNumTypes, aSystemLocale ); } // some more formatter settings - _rData.m_nKeyType = ::comphelper::getNumberFormatType( xSupplier->getNumberFormats(), _rData.m_nFormatKey ); - Reference< XPropertySet > xFormatSettings( xSupplier->getNumberFormatSettings(), UNO_QUERY_THROW ); + _rData.m_nKeyType = ::comphelper::getNumberFormatType( xNumberFormatsSupp->getNumberFormats(), _rData.m_nFormatKey ); + Reference< XPropertySet > xFormatSettings( xNumberFormatsSupp->getNumberFormatSettings(), UNO_QUERY_THROW ); OSL_VERIFY( xFormatSettings->getPropertyValue( ::rtl::OUString::createFromAscii( "NullDate" ) ) >>= _rData.m_aNullDate ); - // create a formatter working with the connection's number format supplier - _rData.m_xFormatter.set( _rContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW ); - _rData.m_xFormatter->attachNumberFormatsSupplier( xSupplier ); + // remember the formatter + _rData.m_xFormatter = i_rNumberFormatter; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //................................................................ + void lcl_initColumnDataValue_nothrow( const ::comphelper::ComponentContext& i_rContext, FormattedColumnValue_Data& i_rData, + const Reference< XRowSet >& i_rRowSet, const Reference< XPropertySet >& i_rColumn ) + { + OSL_PRECOND( i_rRowSet.is(), "lcl_initColumnDataValue_nothrow: no row set!" ); + if ( !i_rRowSet.is() ) + return; + + Reference< XNumberFormatter > xNumberFormatter; + try + { + // get the number formats supplier of the connection of the form + Reference< XConnection > xConnection( getConnection( i_rRowSet ), UNO_QUERY_THROW ); + Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, sal_True, i_rContext.getLegacyServiceFactory() ), UNO_SET_THROW ); + + // create a number formatter for it + xNumberFormatter.set( i_rContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW ); + xNumberFormatter->attachNumberFormatsSupplier( xSupplier ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } + + lcl_initColumnDataValue_nothrow( i_rData, xNumberFormatter, i_rColumn ); } } @@ -218,11 +228,19 @@ namespace dbtools //= FormattedColumnValue //==================================================================== //-------------------------------------------------------------------- - FormattedColumnValue::FormattedColumnValue( const ::comphelper::ComponentContext& _rContext, - const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& _rxColumn ) + FormattedColumnValue::FormattedColumnValue( const ::comphelper::ComponentContext& i_rContext, + const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& i_rColumn ) + :m_pData( new FormattedColumnValue_Data ) + { + lcl_initColumnDataValue_nothrow( i_rContext, *m_pData, _rxRowSet, i_rColumn ); + } + + //-------------------------------------------------------------------- + FormattedColumnValue::FormattedColumnValue( const Reference< XNumberFormatter >& i_rNumberFormatter, + const Reference< XPropertySet >& _rxColumn ) :m_pData( new FormattedColumnValue_Data ) { - lcl_initColumnDataValue_nothrow( _rContext, *m_pData, _rxRowSet, _rxColumn ); + lcl_initColumnDataValue_nothrow( *m_pData, i_rNumberFormatter, _rxColumn ); } //-------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu index b29387edfcb7..5859d5eecf3e 100755 --- a/connectivity/source/drivers/ado/ado.xcu +++ b/connectivity/source/drivers/ado/ado.xcu @@ -154,6 +154,11 @@ <value>3</value> </prop> </node> + <node oor:name="ColumnAliasInOrderBy" oor:op="replace"> + <prop oor:name="Value" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> </node> <node oor:name="Features"> <node oor:name="UseSQL92NamingConstraints" oor:op="replace"> diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index 3ae0b72ff878..fdf16c8b975a 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -211,7 +211,7 @@ void SAL_CALL OHSQLTable::alterColumnByName( const ::rtl::OUString& colName, con // now we should look if the name of the column changed ::rtl::OUString sNewColumnName; descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName; - if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) ) + if ( !sNewColumnName.equals(colName) ) { const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index 0538073781ed..29d8c189a66e 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -709,38 +709,44 @@ void java_sql_Statement_Base::getFastPropertyValue( ) const { java_sql_Statement_Base* THIS = const_cast<java_sql_Statement_Base*>(this); - switch(nHandle) + try + { + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + rValue <<= THIS->getQueryTimeOut(); + break; + case PROPERTY_ID_MAXFIELDSIZE: + rValue <<= THIS->getMaxFieldSize(); + break; + case PROPERTY_ID_MAXROWS: + rValue <<= THIS->getMaxRows(); + break; + case PROPERTY_ID_CURSORNAME: + rValue <<= THIS->getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= THIS->getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= THIS->getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= THIS->getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= THIS->getFetchSize(); + break; + case PROPERTY_ID_ESCAPEPROCESSING: + rValue <<= (sal_Bool)m_bEscapeProcessing; + break; + case PROPERTY_ID_USEBOOKMARKS: + default: + ; + } + } + catch(const Exception&) { - case PROPERTY_ID_QUERYTIMEOUT: - rValue <<= THIS->getQueryTimeOut(); - break; - case PROPERTY_ID_MAXFIELDSIZE: - rValue <<= THIS->getMaxFieldSize(); - break; - case PROPERTY_ID_MAXROWS: - rValue <<= THIS->getMaxRows(); - break; - case PROPERTY_ID_CURSORNAME: - rValue <<= THIS->getCursorName(); - break; - case PROPERTY_ID_RESULTSETCONCURRENCY: - rValue <<= THIS->getResultSetConcurrency(); - break; - case PROPERTY_ID_RESULTSETTYPE: - rValue <<= THIS->getResultSetType(); - break; - case PROPERTY_ID_FETCHDIRECTION: - rValue <<= THIS->getFetchDirection(); - break; - case PROPERTY_ID_FETCHSIZE: - rValue <<= THIS->getFetchSize(); - break; - case PROPERTY_ID_ESCAPEPROCESSING: - rValue <<= (sal_Bool)m_bEscapeProcessing; - break; - case PROPERTY_ID_USEBOOKMARKS: - default: - ; } } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx index 4d9f8bb6d9eb..0c8134e69809 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx @@ -30,12 +30,6 @@ #include <MNSINIParser.hxx> #include <rtl/byteseq.hxx> -ini_Section * IniParser::getSection(OUString const & secName) -{ - if (mAllSection.find(secName) != mAllSection.end()) - return &mAllSection[secName]; - return NULL; -} IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException ) { OUString iniUrl; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx index 63263a2cc893..0e36308946ef 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx @@ -72,7 +72,6 @@ class IniParser IniSectionMap mAllSection; public: IniSectionMap * getAllSection(){return &mAllSection;}; - ini_Section * getSection(OUString const & secName); IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException ); #if OSL_DEBUG_LEVEL > 0 void Dump(); diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx index ff5666d7ffa7..72383be76c58 100644 --- a/connectivity/source/drivers/mysql/YTable.cxx +++ b/connectivity/source/drivers/mysql/YTable.cxx @@ -281,7 +281,7 @@ void SAL_CALL OMySQLTable::alterColumnByName( const ::rtl::OUString& colName, co const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); sSql += ::dbtools::quoteName(sQuote,colName); sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - sSql += ::dbtools::createStandardColumnPart(descriptor,getConnection(),getTypeCreatePattern()); + sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),getTypeCreatePattern())); executeStatement(sSql); } m_pColumns->refresh(); @@ -310,7 +310,7 @@ void OMySQLTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rCo ::comphelper::copyProperties(_xDescriptor,xProp); xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType)); - sSql += ::dbtools::createStandardColumnPart(xProp,getConnection(),getTypeCreatePattern()); + sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(xProp,getConnection(),getTypeCreatePattern())); executeStatement(sSql); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index d56c53a1358e..b337ddc92390 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -184,12 +184,27 @@ void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) } } // ------------------------------------------------------------------------- +::rtl::OUString OTables::adjustSQL(const ::rtl::OUString& _sSql) +{ + ::rtl::OUString sSQL = _sSql; + static const ::rtl::OUString s_sUNSIGNED(RTL_CONSTASCII_USTRINGPARAM("UNSIGNED")); + sal_Int32 nIndex = sSQL.indexOf(s_sUNSIGNED); + while(nIndex != -1 ) + { + sal_Int32 nParen = sSQL.indexOf(')',nIndex); + sal_Int32 nPos = nIndex + s_sUNSIGNED.getLength(); + ::rtl::OUString sNewUnsigned( sSQL.copy(nPos,nParen - nPos + 1)); + sSQL = sSQL.replaceAt(nIndex,s_sUNSIGNED.getLength()+sNewUnsigned.getLength(),sNewUnsigned + s_sUNSIGNED); + nIndex = sSQL.indexOf(s_sUNSIGNED,nIndex + s_sUNSIGNED.getLength()+sNewUnsigned.getLength()); + } + return sSQL; +} +// ------------------------------------------------------------------------- void OTables::createTable( const Reference< XPropertySet >& descriptor ) { const Reference< XConnection > xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection(); static const ::rtl::OUString s_sCreatePattern(RTL_CONSTASCII_USTRINGPARAM("(M,D)")); - const ::rtl::OUString aSql = ::dbtools::createSqlCreateTableStatement(descriptor,xConnection,s_sCreatePattern); - + const ::rtl::OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection,s_sCreatePattern)); Reference< XStatement > xStmt = xConnection->createStatement( ); if ( xStmt.is() ) { diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx index f27bd64545be..da29bcf08c17 100644 --- a/connectivity/source/drivers/odbcbase/OResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx @@ -466,11 +466,9 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro return nRet; } - ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex); - if ( aFind == m_aODBCColumnTypes.end() ) - aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first; + const SWORD nColumnType = impl_getColumnType_nothrow(columnIndex); - switch(aFind->second) + switch(nColumnType) { case SQL_WVARCHAR: case SQL_WCHAR: @@ -479,7 +477,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro case SQL_CHAR: case SQL_LONGVARCHAR: { - ::rtl::OUString aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,aFind->second,m_bWasNull,**this,m_nTextEncoding); + ::rtl::OUString aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding); return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); } default: @@ -624,10 +622,8 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept else { checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex); - if ( aFind == m_aODBCColumnTypes.end() ) - aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first; - nRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,aFind->second,m_bWasNull,**this,m_nTextEncoding); + const SWORD nColumnType = impl_getColumnType_nothrow(columnIndex); + nRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding); } return nRet; } @@ -1502,10 +1498,8 @@ void OResultSet::fillRow(sal_Int32 _nToColumn) case DataType::LONGVARCHAR: case DataType::CLOB: { - ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(nColumn); - if ( aFind == m_aODBCColumnTypes.end() ) - aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(nColumn,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,nColumn))).first; - *pColumn = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,nColumn,aFind->second,m_bWasNull,**this,m_nTextEncoding); + const SWORD nColumnType = impl_getColumnType_nothrow(nColumn); + *pColumn = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,nColumn,nColumnType,m_bWasNull,**this,m_nTextEncoding); } break; case DataType::BIGINT: @@ -1750,4 +1744,12 @@ void OResultSet::fillNeededData(SQLRETURN _nRet) while (nRet == SQL_NEED_DATA); } } +// ----------------------------------------------------------------------------- +SWORD OResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex) +{ + ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex); + if ( aFind == m_aODBCColumnTypes.end() ) + aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first; + return aFind->second; +} diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx index 024e19cc624c..421012e3678e 100644 --- a/connectivity/source/inc/mysql/YTables.hxx +++ b/connectivity/source/inc/mysql/YTables.hxx @@ -71,6 +71,11 @@ namespace connectivity can contain () which have to filled with values */ static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + + /** convert the sql statement to fit MySQL notation + @param _sSql in/out + */ + static ::rtl::OUString adjustSQL(const ::rtl::OUString& _sSql); }; } } diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx index 3071dbb52c2c..d0aa60a812ca 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -97,7 +97,7 @@ namespace connectivity sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - SWORD impl_getColumnType_nothrow(sal_Int32 column); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); sal_Int32 mapColumn (sal_Int32 column); diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx index 6c6965861251..41aee7db1cea 100644 --- a/connectivity/source/inc/odbc/OResultSet.hxx +++ b/connectivity/source/inc/odbc/OResultSet.hxx @@ -173,6 +173,7 @@ namespace connectivity sal_Bool moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData); TVoidPtr allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex); SQLRETURN unbind(sal_Bool _bUnbindHandle = sal_True); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index 77bef5a3dc83..a88450399c17 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -717,7 +717,7 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const ::rtl::OUStri } // found something? - if ( m_aDriversBS.end() != aFind ) + if ( m_aDriversBS.end() != aFind && aFind->xDriver.is() && aFind->xDriver->acceptsURL(_rURL) ) xReturn = aFind->xDriver; } diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 77544ece300a..275bd5b34619 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -396,7 +396,7 @@ VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_S <SQL>\" { return gatherString('\"',0); } <SQL>` { return gatherString('`' ,0); } -<PREDICATE_GER,PREDICATE_ENG,DATE>"[" { return gatherString(']' ,0);} +<PREDICATE_GER,PREDICATE_ENG,DATE,SQL>"[" { return gatherString(']' ,0);} \' { return gatherString('\'',1); } diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst index 5ec84bca7d37..92a4853c2bed 100644 --- a/desktop/prj/d.lst +++ b/desktop/prj/d.lst @@ -59,8 +59,8 @@ mkdir: %_DEST%\bin%_EXT%\odf4ms ..\%__SRC%\lib\liboffacc*.so %_DEST%\lib%_EXT%\liboffacc*.so ..\%__SRC%\lib\liboffacc*.dylib %_DEST%\lib%_EXT%\liboffacc*.dylib ..\%__SRC%\bin\migratio*.dll %_DEST%\bin%_EXT%\migratio*.dll -..\%__SRC%\lib\migrationoo2.uno.so %_DEST%\lib%_EXT%\migrationoo2.uno.so -..\%__SRC%\lib\migrationoo2.uno.dylib %_DEST%\lib%_EXT%\migrationoo2.uno.dylib +..\%__SRC%\lib\migratio*.uno.so %_DEST%\lib%_EXT%\migratio*.uno.so +..\%__SRC%\lib\migratio*.uno.dylib %_DEST%\lib%_EXT%\migratio*.uno.dylib ..\%__SRC%\bin\sweb %_DEST%\bin%_EXT%\sweb.bin diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 0b3813f42971..0625191ee2ea 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -227,7 +227,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) bViewEvent = sal_False; bStartEvent = sal_False; bDisplaySpec = sal_False; - } + } else if ( aArgStr.EqualsIgnoreCaseAscii( "-view" )) { // open in viewmode @@ -239,31 +239,43 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) bViewEvent = sal_True; bStartEvent = sal_False; bDisplaySpec = sal_False; - } + } else if ( aArgStr.EqualsIgnoreCaseAscii( "-show" )) { - // open in viewmode - bOpenEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_True; - bPrintEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bForceOpenEvent = sal_False; - bDisplaySpec = sal_False; + // open in viewmode + bOpenEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_True; + bPrintEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bForceOpenEvent = sal_False; + bDisplaySpec = sal_False; } else if ( aArgStr.EqualsIgnoreCaseAscii( "-display" )) { - // open in viewmode - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_True; + // set display + bOpenEvent = sal_False; + bPrintEvent = sal_False; + bForceOpenEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_False; + bDisplaySpec = sal_True; + } + else if ( aArgStr.EqualsIgnoreCaseAscii( "-language" )) + { + bOpenEvent = sal_False; + bPrintEvent = sal_False; + bForceOpenEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_False; + bDisplaySpec = sal_False; } + #ifdef MACOSX /* #i84053# ignore -psn on Mac Platform dependent #ifdef here is ugly, however this is currently @@ -272,15 +284,15 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) */ else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL ) { - // finder argument from MacOSX - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; + // finder argument from MacOSX + bOpenEvent = sal_False; + bPrintEvent = sal_False; + bForceOpenEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_False; + bDisplaySpec = sal_False; } #endif } @@ -509,7 +521,12 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& } else if ( aArgStr.Copy(0, 9).EqualsIgnoreCaseAscii( "-version=" )) { - AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, aArgStr.Copy( 15 ) ); + AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, aArgStr.Copy( 9 ) ); + return sal_True; + } + else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-language=" )) + { + AddStringListParam_Impl( CMD_STRINGPARAM_LANGUAGE, aArgStr.Copy( 10 ) ); return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-writer" )) == sal_True ) @@ -858,6 +875,13 @@ sal_Bool CommandLineArgs::GetPrinterName( ::rtl::OUString& rPara ) const return m_aStrSetParams[ CMD_STRINGPARAM_PRINTERNAME ]; } +sal_Bool CommandLineArgs::GetLanguage( ::rtl::OUString& rPara ) const +{ + osl::MutexGuard aMutexGuard( m_aMutex ); + rPara = m_aStrParams[ CMD_STRINGPARAM_LANGUAGE ]; + return m_aStrSetParams[ CMD_STRINGPARAM_LANGUAGE ]; +} + sal_Bool CommandLineArgs::IsEmpty() const { osl::MutexGuard aMutexGuard( m_aMutex ); diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index 894259ffc30b..615577098c2d 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -91,6 +91,7 @@ class CommandLineArgs CMD_STRINGPARAM_PRINTTOLIST, CMD_STRINGPARAM_PRINTERNAME, CMD_STRINGPARAM_DISPLAY, + CMD_STRINGPARAM_LANGUAGE, CMD_STRINGPARAM_COUNT // must be last element! }; @@ -167,6 +168,7 @@ class CommandLineArgs sal_Bool GetPrintList( ::rtl::OUString& rPara) const; sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const; sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const; + sal_Bool GetLanguage( ::rtl::OUString& rPara ) const; // Special analyzed states (does not match directly to a command line parameter!) sal_Bool IsPrinting() const; diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 8ce57eb3451f..7969371f56d9 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -52,6 +52,7 @@ #include <rtl/locale.hxx> #include <rtl/instance.hxx> #include <osl/process.h> +#include <osl/file.hxx> using namespace rtl; using namespace com::sun::star::uno; @@ -62,10 +63,54 @@ using namespace com::sun::star::util; namespace desktop { +static char const SOFFICE_BOOTSTRAP[] = "Bootstrap"; +static char const SOFFICE_STARTLANG[] = "STARTLANG"; sal_Bool LanguageSelection::bFoundLanguage = sal_False; OUString LanguageSelection::aFoundLanguage; const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US"); + +static sal_Bool existsURL( OUString const& sURL ) +{ + using namespace osl; + DirectoryItem aDirItem; + + if (sURL.getLength() != 0) + return ( DirectoryItem::get( sURL, aDirItem ) == DirectoryItem::E_None ); + + return sal_False; +} + +// locate soffice.ini/.rc file +static OUString locateSofficeIniFile() +{ + OUString aUserDataPath; + OUString aSofficeIniFileURL; + + // Retrieve the default file URL for the soffice.ini/rc + rtl::Bootstrap().getIniName( aSofficeIniFileURL ); + + if ( utl::Bootstrap::locateUserData( aUserDataPath ) == utl::Bootstrap::PATH_EXISTS ) + { + const char CONFIG_DIR[] = "/config"; + + sal_Int32 nIndex = aSofficeIniFileURL.lastIndexOf( '/'); + if ( nIndex > 0 ) + { + OUString aUserSofficeIniFileURL; + OUStringBuffer aBuffer( aUserDataPath ); + aBuffer.appendAscii( CONFIG_DIR ); + aBuffer.append( aSofficeIniFileURL.copy( nIndex )); + aUserSofficeIniFileURL = aBuffer.makeStringAndClear(); + + if ( existsURL( aUserSofficeIniFileURL )) + return aUserSofficeIniFileURL; + } + } + // Fallback try to use the soffice.ini/rc from program folder + return aSofficeIniFileURL; +} + Locale LanguageSelection::IsoStringToLocale(const OUString& str) { Locale l; @@ -119,8 +164,51 @@ bool LanguageSelection::prepareLanguage() catch (Exception&) { } + // get the selected UI language as string - OUString aLocaleString = getLanguageString(); + bool bCmdLanguage( false ); + bool bIniLanguage( false ); + OUString aEmpty; + OUString aLocaleString = getUserUILanguage(); + + if ( aLocaleString.getLength() == 0 ) + { + CommandLineArgs* pCmdLineArgs = Desktop::GetCommandLineArgs(); + if ( pCmdLineArgs ) + { + pCmdLineArgs->GetLanguage(aLocaleString); + if (isInstalledLanguage(aLocaleString, sal_False)) + { + bCmdLanguage = true; + bFoundLanguage = true; + aFoundLanguage = aLocaleString; + } + else + aLocaleString = aEmpty; + } + + if ( !bCmdLanguage ) + { + OUString aSOfficeIniURL = locateSofficeIniFile(); + Config aConfig(aSOfficeIniURL); + aConfig.SetGroup( SOFFICE_BOOTSTRAP ); + OString sLang = aConfig.ReadKey( SOFFICE_STARTLANG ); + aLocaleString = OUString( sLang.getStr(), sLang.getLength(), RTL_TEXTENCODING_ASCII_US ); + if (isInstalledLanguage(aLocaleString, sal_False)) + { + bIniLanguage = true; + bFoundLanguage = true; + aFoundLanguage = aLocaleString; + } + else + aLocaleString = aEmpty; + } + } + + // user further fallbacks for the UI language + if ( aLocaleString.getLength() == 0 ) + aLocaleString = getLanguageString(); + if ( aLocaleString.getLength() > 0 ) { try @@ -136,9 +224,21 @@ bool LanguageSelection::prepareLanguage() flush(); theConfigProvider->setLocale(loc); - Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Setup/L10N/", sal_True), UNO_QUERY_THROW); - xProp->setPropertyValue(OUString::createFromAscii("ooLocale"), makeAny(aLocaleString)); - Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); + if ( !bCmdLanguage ) + { + // Store language only + Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Setup/L10N/", sal_True), UNO_QUERY_THROW); + xProp->setPropertyValue(OUString::createFromAscii("ooLocale"), makeAny(aLocaleString)); + Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); + } + + if ( bIniLanguage ) + { + // Store language only + Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Office.Linguistic/General/", sal_True), UNO_QUERY_THROW); + xProp->setPropertyValue(OUString::createFromAscii("UILocale"), makeAny(aLocaleString)); + Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); + } MsLangId::setConfiguredSystemUILanguage( MsLangId::convertLocaleToLanguage(loc) ); @@ -197,11 +297,8 @@ void LanguageSelection::setDefaultLanguage(const OUString& sLocale) } } -OUString LanguageSelection::getLanguageString() +OUString LanguageSelection::getUserUILanguage() { - // did we already find a language? - if (bFoundLanguage) - return aFoundLanguage; // check whether the user has selected a specific language OUString aUserLanguage = getUserLanguage(); if (aUserLanguage.getLength() > 0 ) @@ -219,6 +316,21 @@ OUString LanguageSelection::getLanguageString() resetUserLanguage(); } } + + return aUserLanguage; +} + +OUString LanguageSelection::getLanguageString() +{ + // did we already find a language? + if (bFoundLanguage) + return aFoundLanguage; + + // check whether the user has selected a specific language + OUString aUserLanguage = getUserUILanguage(); + if (aUserLanguage.getLength() > 0 ) + return aUserLanguage ; + // try to use system default aUserLanguage = getSystemLanguage(); if (aUserLanguage.getLength() > 0 ) diff --git a/desktop/source/app/langselect.hxx b/desktop/source/app/langselect.hxx index 58b98fa88102..60308164690f 100644 --- a/desktop/source/app/langselect.hxx +++ b/desktop/source/app/langselect.hxx @@ -50,6 +50,7 @@ private: static com::sun::star::uno::Sequence< rtl::OUString > getInstalledLanguages(); static sal_Bool isInstalledLanguage(rtl::OUString& usLocale, sal_Bool bExact=sal_False); static rtl::OUString getFirstInstalledLanguage(); + static rtl::OUString getUserUILanguage(); static rtl::OUString getUserLanguage(); static rtl::OUString getSystemLanguage(); static void resetUserLanguage(); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 31019948f043..2d0733dfbae3 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -90,8 +90,7 @@ using ::rtl::OUString; namespace dp_gui { -#define ICON_OFFSET 50 -#define TOP_OFFSET 3 +#define TOP_OFFSET 5 #define LINE_SIZE 4 #define PROGRESS_WIDTH 60 #define PROGRESS_HEIGHT 14 diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index b95a7e5f8cfb..2e02a90f59fd 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -520,10 +520,10 @@ void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntr else aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon; Size aImageSize = aImage.GetSizePixel(); - if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) ) - DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage ); + if ( ( aImageSize.Width() <= ICON_WIDTH ) && ( aImageSize.Height() <= ICON_HEIGHT ) ) + DrawImage( Point( aPos.X()+((ICON_WIDTH-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage ); else - DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage ); + DrawImage( aPos, Size( ICON_WIDTH, ICON_HEIGHT ), aImage ); // Setup fonts Font aStdFont( GetFont() ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 18487dffe6e1..ad62bfd1a2d8 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -45,9 +45,10 @@ namespace dp_gui { #define SMALL_ICON_SIZE 16 -#define TOP_OFFSET 3 +#define TOP_OFFSET 5 #define ICON_HEIGHT 42 -#define ICON_OFFSET 50 +#define ICON_WIDTH 47 +#define ICON_OFFSET 72 #define RIGHT_ICON_OFFSET 5 #define SPACE_BETWEEN 3 diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx index f9b3e1d989f1..38a1870782ed 100644 --- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx +++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx @@ -53,6 +53,15 @@ namespace rtl { class OUString; } namespace dp_misc { +struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC SimpleLicenseAttributes +{ + ::rtl::OUString acceptBy; + //Attribute suppress-on-update. Default is false. + bool suppressOnUpdate; + //Attribute suppress-if-required. Default is false. + bool suppressIfRequired; +}; + /** Access to the content of an XML <code>description</code> element. @@ -132,6 +141,13 @@ public: */ ::rtl::OUString getLocalizedLicenseURL() const; + /** returns the attributes of the simple-license element + + As long as there is a simple-license element, the function will return + the structure. If it does not exist, then the optional object is uninitialized. + */ + ::boost::optional<SimpleLicenseAttributes> getSimpleLicenseAttributes() const; + /** returns the localized display name of the extensions. In case there is no localized display-name then an empty string is returned. diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 587e31bebfb9..28f45918e9e2 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -370,6 +370,50 @@ css::uno::Sequence< ::rtl::OUString > DescriptionInfoset::getUrls( } +::boost::optional<SimpleLicenseAttributes> +DescriptionInfoset::getSimpleLicenseAttributes() const +{ + //Check if the node exist + css::uno::Reference< css::xml::dom::XNode > n; + if (m_element.is()) { + try { + n = m_xpath->selectSingleNode(m_element, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@accept-by"))); + } catch (css::xml::xpath::XPathException &) { + // ignore + } + if (n.is()) + { + SimpleLicenseAttributes attributes; + attributes.acceptBy = + getNodeValueFromExpression(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@accept-by"))); + + ::boost::optional< ::rtl::OUString > suppressOnUpdate = getOptionalValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@suppress-on-update"))); + if (suppressOnUpdate) + attributes.suppressOnUpdate = (*suppressOnUpdate).trim().equalsIgnoreAsciiCase( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))); + else + attributes.suppressOnUpdate = false; + + ::boost::optional< ::rtl::OUString > suppressIfRequired = getOptionalValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@suppress-if-required"))); + if (suppressIfRequired) + attributes.suppressIfRequired = (*suppressIfRequired).trim().equalsIgnoreAsciiCase( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))); + else + attributes.suppressIfRequired = false; + + return ::boost::optional<SimpleLicenseAttributes>(attributes); + } + } + return ::boost::optional<SimpleLicenseAttributes>(); +} + ::rtl::OUString DescriptionInfoset::getLocalizedDescriptionURL() const { return getLocalizedHREFAttrFromChild(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index cfe5be59dad0..e45f7fb7ef73 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -70,7 +70,7 @@ #include "com/sun/star/xml/dom/XDocumentBuilder.hpp" #include "com/sun/star/xml/xpath/XXPathAPI.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" - +#include "boost/optional.hpp" #include <vector> #include <stdio.h> @@ -583,21 +583,12 @@ bool BackendImpl::PackageImpl::checkDependencies( { try { - css::uno::Reference<css::xml::dom::XNode> xRoot = desc.getRootElement(); - css::uno::Reference<css::xml::xpath::XXPathAPI> xPath = - getDescriptionInfoset().getXpath(); - - css::uno::Reference<css::xml::dom::XNode> nodeSimpleLic; - try { - nodeSimpleLic = xPath->selectSingleNode(xRoot, - OUSTR("/desc:description/desc:registration/desc:simple-license")); - } catch (css::xml::xpath::XPathException &) { - // ignore - } - - if (!nodeSimpleLic.is()) + DescriptionInfoset info = getDescriptionInfoset(); + ::boost::optional<SimpleLicenseAttributes> simplLicAttr + = info.getSimpleLicenseAttributes(); + if (! simplLicAttr) return true; - OUString sLic = getDescriptionInfoset().getLocalizedLicenseURL(); + OUString sLic = info.getLocalizedLicenseURL(); //If we do not get a localized licence then there is an error in the description.xml //This should be handled by using a validating parser. Therefore we assume that no //license is available. @@ -606,23 +597,20 @@ bool BackendImpl::PackageImpl::checkDependencies( OUSTR("Could not obtain path to license. Possible error in description.xml"), 0, Any()); OUString sHref = desc.getExtensionRootUrl() + OUSTR("/") + sLic; OUString sLicense = getTextFromURL(xCmdEnv, sHref); - //determine who has to agree to the license - css::uno::Reference<css::xml::xpath::XXPathObject> nodeAttribWho3 = - xPath->eval(nodeSimpleLic, - OUSTR("@accept-by")); - OUString sAccept = nodeAttribWho3->getString().trim(); + ////determine who has to agree to the license //check correct value for attribute - if ( ! (sAccept.equals(OUSTR("user")) || sAccept.equals(OUSTR("admin")))) + if ( ! (simplLicAttr->acceptBy.equals(OUSTR("user")) || simplLicAttr->acceptBy.equals(OUSTR("admin")))) throw css::deployment::DeploymentException( OUSTR("Could not obtain attribute simple-lincense@accept-by or it has no valid value"), 0, Any()); //If if @accept-by="user" then every user needs to accept the license before it can be installed. - //Therefore we must prevent the installation as shared extension. + //Therefore we must prevent the installation as shared extension unless suppress-if-required="true" OSL_ASSERT(aContextName.getLength()); - if (sAccept.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared"))) + if (simplLicAttr->acceptBy.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared"))) { - css::deployment::LicenseIndividualAgreementException exc = - css::deployment::LicenseIndividualAgreementException(OUString(), 0, m_name); + css::deployment::LicenseIndividualAgreementException + exc = css::deployment::LicenseIndividualAgreementException( + OUString(), 0, m_name, simplLicAttr->suppressIfRequired); bool approve = false; bool abort = false; @@ -632,32 +620,24 @@ bool BackendImpl::PackageImpl::checkDependencies( OUSTR("Could not interact with user."), 0, Any()); if (abort == true) return false; - //We should always prevent installation - OSL_ASSERT(0); - } - //determine optional attribute simple-license@suppressOnUpdate - css::uno::Reference<css::xml::dom::XElement> elemSimpleLic(nodeSimpleLic, css::uno::UNO_QUERY_THROW); - sal_Bool bSuppress = sal_False; - if (elemSimpleLic->hasAttribute(OUSTR("suppress-on-update"))) - { - if (elemSimpleLic->getAttribute(OUSTR("suppress-on-update")).equals(OUSTR("true"))) - bSuppress = sal_True; + //If the unopkg --suppress-license was used and simplLicAttr->suppressIfRequired == true, + //then the user implicitely accepts the license } //Only use interaction if there is no version of this extension already installed //and the suppress-on-update flag is not set for the new extension - // bInstalled | bSuppress | show license + // bInstalled | bSuppressOnUpdate | show license //---------------------------------------- - // 0 | 0 | 1 - // 0 | 1 | 1 - // 1 | 0 | 1 - // 1 | 1 | 0 + // 0 | 0 | 1 + // 0 | 1 | 1 + // 1 | 0 | 1 + // 1 | 1 | 0 - if ( !(bInstalled && bSuppress)) + if ( !(bInstalled && simplLicAttr->suppressOnUpdate)) { - css::deployment::LicenseException licExc = - css::deployment::LicenseException(OUString(), 0, m_name, sLicense); + css::deployment::LicenseException licExc( + OUString(), 0, m_name, sLicense, simplLicAttr->suppressIfRequired); bool approve = false; bool abort = false; if (! interactContinuation( diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 250fe58841f8..2181daab7454 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -34,6 +34,7 @@ #include <unotools/textsearch.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <unotools/bootstrap.hxx> #include <rtl/bootstrap.hxx> #include <tools/config.hxx> @@ -91,7 +92,6 @@ static void releaseImpl() } } - // static main entry point for the migration process void Migration::doMigration() { @@ -140,11 +140,11 @@ sal_Bool MigrationImpl::checkMigration() MigrationImpl::MigrationImpl(const uno::Reference< XMultiServiceFactory >& xFactory) : m_vrVersions(new strings_v) , m_xFactory(xFactory) - , m_vrMigrations(readMigrationSteps()) - , m_aInfo(findInstallation()) - , m_vrFileList(compileFileList()) - , m_vrServiceList(compileServiceList()) { + readAvailableMigrations(m_vMigrationsAvailable); + sal_Int32 nIndex = findPreferedMigrationProcess(m_vMigrationsAvailable); + if ( nIndex >= 0 ) + m_vrMigrations = readMigrationSteps(m_vMigrationsAvailable[nIndex].name); } MigrationImpl::~MigrationImpl() @@ -154,6 +154,10 @@ MigrationImpl::~MigrationImpl() sal_Bool MigrationImpl::doMigration() { + // compile file and service list for migration + m_vrFileList = compileFileList(); + m_vrServiceList = compileServiceList(); + sal_Bool result = sal_False; try{ copyFiles(); @@ -218,20 +222,61 @@ sal_Bool MigrationImpl::checkMigrationCompleted() return bMigrationCompleted; } - -migrations_vr MigrationImpl::readMigrationSteps() +static void insertSorted(migrations_available& rAvailableMigrations, supported_migration& aSupportedMigration) { + bool bInserted( false ); + migrations_available::iterator pIter = rAvailableMigrations.begin(); + while ( !bInserted && pIter != rAvailableMigrations.end()) + { + if ( pIter->nPriority < aSupportedMigration.nPriority ) + { + rAvailableMigrations.insert(pIter, aSupportedMigration ); + bInserted = true; + } + ++pIter; + } + if ( !bInserted ) + rAvailableMigrations.push_back( aSupportedMigration ); +} +bool MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigrations) +{ // get supported version names - uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration"), uno::UNO_QUERY_THROW); - uno::Sequence< OUString > seqVersions; - aMigrationAccess->getByName(OUString::createFromAscii("SupportedVersions")) >>= seqVersions; - for (sal_Int32 i=0; i<seqVersions.getLength(); i++) - m_vrVersions->push_back(seqVersions[i].trim()); + uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); + uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames(); + + const OUString aVersionIdentifiers( RTL_CONSTASCII_USTRINGPARAM( "VersionIdentifiers" )); + const OUString aPriorityIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Priority" )); + + for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++) + { + sal_Int32 nPriority( 0 ); + uno::Sequence< OUString > seqVersions; + uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(seqSupportedVersions[i]), uno::UNO_QUERY_THROW ); + xMigrationData->getByName( aVersionIdentifiers ) >>= seqVersions; + xMigrationData->getByName( aPriorityIdentifier ) >>= nPriority; + + supported_migration aSupportedMigration; + aSupportedMigration.name = seqSupportedVersions[i]; + aSupportedMigration.nPriority = nPriority; + for (sal_Int32 j=0; j<seqVersions.getLength(); j++) + aSupportedMigration.supported_versions.push_back(seqVersions[j].trim()); + insertSorted( rAvailableMigrations, aSupportedMigration ); + } + + return true; +} + +migrations_vr MigrationImpl::readMigrationSteps(const ::rtl::OUString& rMigrationName) +{ + // get migration access + uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); + uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(rMigrationName), uno::UNO_QUERY_THROW ); // get migration description from from org.openoffice.Setup/Migration // and build vector of migration steps - uno::Reference< XNameAccess > theNameAccess(getConfigAccess("org.openoffice.Setup/Migration/MigrationSteps"), uno::UNO_QUERY_THROW); + OUString aMigrationSteps( RTL_CONSTASCII_USTRINGPARAM( "MigrationSteps" )); + uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName(aMigrationSteps), uno::UNO_QUERY_THROW); uno::Sequence< OUString > seqMigrations = theNameAccess->getElementNames(); uno::Reference< XNameAccess > tmpAccess; uno::Reference< XNameAccess > tmpAccess2; @@ -273,6 +318,20 @@ migrations_vr MigrationImpl::readMigrationSteps() tmpStep.excludeConfig.push_back(tmpSeq[j]); } + // included extensions... + if (tmpAccess->getByName(OUString::createFromAscii("IncludedExtensions")) >>= tmpSeq) + { + for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) + tmpStep.includeExtensions.push_back(tmpSeq[j]); + } + + // excluded extensions... + if (tmpAccess->getByName(OUString::createFromAscii("ExcludedExtensions")) >>= tmpSeq) + { + for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) + tmpStep.excludeExtensions.push_back(tmpSeq[j]); + } + // config components if (tmpAccess->getByName(OUString::createFromAscii("ServiceConfigComponents")) >>= tmpSeq) { @@ -280,7 +339,6 @@ migrations_vr MigrationImpl::readMigrationSteps() tmpStep.configComponents.push_back(tmpSeq[j]); } - // generic service tmpAccess->getByName(OUString::createFromAscii("MigrationService")) >>= tmpStep.service; @@ -302,7 +360,7 @@ static FileBase::RC _checkAndCreateDirectory(INetURLObject& dirURL) return result; } -install_info MigrationImpl::findInstallation() +install_info MigrationImpl::findInstallation(const strings_v& rVersions) { rtl::OUString aProductName; uno::Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); @@ -310,9 +368,9 @@ install_info MigrationImpl::findInstallation() aProductName = aProductName.toAsciiLowerCase(); install_info aInfo; - strings_v::const_iterator i_ver = m_vrVersions->begin(); + strings_v::const_iterator i_ver = rVersions.begin(); uno::Reference < util::XStringSubstitution > xSubst( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.PathSubstitution")), uno::UNO_QUERY ); - while (i_ver != m_vrVersions->end()) + while (i_ver != rVersions.end()) { ::rtl::OUString aVersion, aProfileName; sal_Int32 nSeparatorIndex = (*i_ver).indexOf('='); @@ -330,7 +388,7 @@ install_info MigrationImpl::findInstallation() osl::Security().getConfigDir( aUserInst ); if ( aUserInst.getLength() && aUserInst[ aUserInst.getLength()-1 ] != '/' ) aUserInst += ::rtl::OUString::createFromAscii("/"); -#ifdef UNX +#if defined UNX && ! defined MACOSX // tribute to whoever had the "great" idea to use different names on Windows and Unix aUserInst += ::rtl::OUString::createFromAscii("."); #endif @@ -345,12 +403,34 @@ install_info MigrationImpl::findInstallation() } catch( uno::Exception& ){} } - i_ver++; + ++i_ver; } return aInfo; } +sal_Int32 MigrationImpl::findPreferedMigrationProcess(const migrations_available& rAvailableMigrations) +{ + sal_Int32 nIndex( -1 ); + sal_Int32 i( 0 ); + + migrations_available::const_iterator rIter = rAvailableMigrations.begin(); + while ( rIter != rAvailableMigrations.end() ) + { + install_info aInstallInfo = findInstallation(rIter->supported_versions); + if (aInstallInfo.productname.getLength() > 0 ) + { + m_aInfo = aInstallInfo; + nIndex = i; + break; + } + ++i; + ++rIter; + } + + return nIndex; +} + strings_vr MigrationImpl::applyPatterns(const strings_v& vSet, const strings_v& vPatterns) const { using namespace utl; @@ -517,8 +597,6 @@ void MigrationImpl::copyConfig() aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); OSL_ENSURE(sal_False, aMsg.getStr()); } - - } // removes elements of vector 2 in vector 1 @@ -626,7 +704,6 @@ void MigrationImpl::copyFiles() void MigrationImpl::runServices() { - //create stratum for old user layer OUString aOldLayerURL = m_aInfo.userdata; aOldLayerURL += OUString::createFromAscii("/user/registry"); @@ -637,7 +714,7 @@ void MigrationImpl::runServices() aStratumSvc, stratumArgs), uno::UNO_QUERY); // Build argument array - uno::Sequence< uno::Any > seqArguments(3); + uno::Sequence< uno::Any > seqArguments(4); seqArguments[0] = uno::makeAny(NamedValue( OUString::createFromAscii("Productname"), uno::makeAny(m_aInfo.productname))); @@ -673,11 +750,22 @@ void MigrationImpl::runServices() i_comp++; i++; } + // set old config argument seqArguments[2] = uno::makeAny(NamedValue( OUString::createFromAscii("OldConfiguration"), uno::makeAny(seqComponents))); + // set black list for extension migration + uno::Sequence< rtl::OUString > seqExtBlackList; + sal_uInt32 nSize = i_mig->excludeExtensions.size(); + if ( nSize > 0 ) + seqExtBlackList = comphelper::arrayToSequence< ::rtl::OUString >( + &i_mig->excludeExtensions[0], nSize ); + seqArguments[3] = uno::makeAny(NamedValue( + OUString::createFromAscii("ExtensionBlackList"), + uno::makeAny( seqExtBlackList ))); + xMigrationJob = uno::Reference< XJob >(m_xFactory->createInstanceWithArguments( i_mig->service, seqArguments), uno::UNO_QUERY_THROW); diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx index 95b0c3535a80..b40de510261d 100644 --- a/desktop/source/migration/migration_impl.hxx +++ b/desktop/source/migration/migration_impl.hxx @@ -65,11 +65,21 @@ struct migration_step strings_v includeConfig; strings_v excludeConfig; strings_v configComponents; + strings_v includeExtensions; + strings_v excludeExtensions; rtl::OUString service; }; +struct supported_migration +{ + rtl::OUString name; + sal_Int32 nPriority; + strings_v supported_versions; +}; + typedef std::vector< migration_step > migrations_v; typedef std::auto_ptr< migrations_v > migrations_vr; +typedef std::vector< supported_migration > migrations_available; class MigrationImpl { @@ -77,18 +87,22 @@ class MigrationImpl private: strings_vr m_vrVersions; NS_UNO::Reference< NS_CSS::lang::XMultiServiceFactory > m_xFactory; - migrations_vr m_vrMigrations; // list of all migration specs from config - install_info m_aInfo; // info about the version being migrated - strings_vr m_vrFileList; // final list of files to be copied - strings_vr m_vrConfigList; // final list of nodes to be copied - strings_vr m_vrServiceList; // final list of services to be called - - // initializer functions... - migrations_vr readMigrationSteps(); - install_info findInstallation(); - strings_vr compileFileList(); - strings_vr compileConfigList(); - strings_vr compileServiceList(); + + migrations_available m_vMigrationsAvailable; // list of all available migrations + migrations_vr m_vrMigrations; // list of all migration specs from config + install_info m_aInfo; // info about the version being migrated + strings_vr m_vrFileList; // final list of files to be copied + strings_vr m_vrConfigList; // final list of nodes to be copied + strings_vr m_vrServiceList; // final list of services to be called + + // functions to control the migration process + bool readAvailableMigrations(migrations_available&); + migrations_vr readMigrationSteps(const ::rtl::OUString& rMigrationName); + sal_Int32 findPreferedMigrationProcess(const migrations_available&); + install_info findInstallation(const strings_v& rVersions); + strings_vr compileFileList(); + strings_vr compileConfigList(); + strings_vr compileServiceList(); // helpers void substract(strings_v& va, const strings_v& vb_c) const; diff --git a/desktop/source/migration/pages.cxx b/desktop/source/migration/pages.cxx index 0aadc92827bb..11cc61ed84ff 100644 --- a/desktop/source/migration/pages.cxx +++ b/desktop/source/migration/pages.cxx @@ -55,6 +55,7 @@ #include <rtl/bootstrap.hxx> #include <rtl/ustrbuf.hxx> #include <osl/file.hxx> +#include <osl/thread.hxx> #include <unotools/bootstrap.hxx> #include <tools/config.hxx> @@ -62,6 +63,7 @@ using namespace rtl; using namespace osl; using namespace utl; using namespace svt; +using namespace com::sun::star; using namespace com::sun::star::frame; using namespace com::sun::star::lang; using namespace com::sun::star::util; @@ -305,12 +307,46 @@ void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint ) // ------------------------------------------------------------------- -MigrationPage::MigrationPage( svt::OWizardMachine* parent, const ResId& resid) +class MigrationThread : public ::osl::Thread +{ + public: + MigrationThread(); + + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); +}; + +MigrationThread::MigrationThread() +{ +} + +void MigrationThread::run() +{ + try + { + Migration::doMigration(); + } + catch ( uno::Exception& ) + { + } +} + +void MigrationThread::onTerminated() +{ +} + +// ------------------------------------------------------------------- + +MigrationPage::MigrationPage( + svt::OWizardMachine* parent, + const ResId& resid, + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > xThrobber) : OWizardPage(parent, resid) , m_ftHead(this, WizardResId(FT_MIGRATION_HEADER)) , m_ftBody(this, WizardResId(FT_MIGRATION_BODY)) , m_cbMigration(this, WizardResId(CB_MIGRATION)) , m_bMigrationDone(sal_False) + , m_xThrobber(xThrobber) { FreeResource(); _setBold(m_ftHead); @@ -325,9 +361,28 @@ sal_Bool MigrationPage::commitPage( CommitPageReason _eReason ) { if (_eReason == eTravelForward && m_cbMigration.IsChecked() && !m_bMigrationDone) { - EnterWait(); - Migration::doMigration(); - LeaveWait(); + GetParent()->EnterWait(); + FirstStartWizard* pWizard = dynamic_cast< FirstStartWizard* >( GetParent() ); + if ( pWizard ) + pWizard->DisableButtonsWhileMigration(); + + uno::Reference< awt::XWindow > xWin( m_xThrobber, uno::UNO_QUERY ); + xWin->setVisible( true ); + m_xThrobber->start(); + MigrationThread* pMigThread = new MigrationThread(); + pMigThread->create(); + + while ( pMigThread->isRunning() ) + { + Application::Reschedule(); + } + + m_xThrobber->stop(); + GetParent()->LeaveWait(); + // Next state will enable buttons - so no EnableButtons necessary! + xWin->setVisible( false ); + pMigThread->join(); + delete pMigThread; m_bMigrationDone = sal_True; } else diff --git a/desktop/source/migration/pages.hxx b/desktop/source/migration/pages.hxx index c1e8b2c62e42..9740773fe602 100644 --- a/desktop/source/migration/pages.hxx +++ b/desktop/source/migration/pages.hxx @@ -38,6 +38,8 @@ #include <svl/lstner.hxx> #include <svtools/xtextedt.hxx> +#include <com/sun/star/awt/XThrobber.hpp> + namespace desktop { class WelcomePage : public svt::OWizardPage @@ -120,8 +122,9 @@ private: FixedText m_ftBody; CheckBox m_cbMigration; sal_Bool m_bMigrationDone; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > m_xThrobber; public: - MigrationPage( svt::OWizardMachine* parent, const ResId& resid); + MigrationPage( svt::OWizardMachine* parent, const ResId& resid, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > xThrobber ); virtual sal_Bool commitPage( CommitPageReason _eReason ); protected: diff --git a/sfx2/source/view/impframe.cxx b/desktop/source/migration/services/cexportsoo3.cxx index 997637b3a531..20b8232044e9 100644..100755 --- a/sfx2/source/view/impframe.cxx +++ b/desktop/source/migration/services/cexportsoo3.cxx @@ -2,10 +2,13 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: cexports.cxx,v $ + * $Revision: 1.9 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -26,30 +29,43 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" +#include "precompiled_desktop.hxx" -#ifndef GCC -#endif +#include "cppuhelper/implementationentry.hxx" +#include "oo3extensionmigration.hxx" -#include "impframe.hxx" +extern "C" +{ -#include <svl/smplhint.hxx> +::cppu::ImplementationEntry entries [] = +{ + { + migration::OO3ExtensionMigration_create, migration::OO3ExtensionMigration_getImplementationName, + migration::OO3ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, + 0, 0 + }, + { 0, 0, 0, 0, 0, 0 } +}; -#include <sfx2/frame.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/viewfrm.hxx> -void SfxFrame_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) +void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** ) { - SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pHint && pHint->GetId() == SFX_HINT_CANCELLABLE && pCurrentViewFrame ) - { - // vom Cancel-Manager - SfxBindings &rBind = pCurrentViewFrame->GetBindings(); - rBind.Invalidate( SID_BROWSE_STOP ); - if ( !rBind.IsInRegistrations() ) - rBind.Update( SID_BROWSE_STOP ); - rBind.Invalidate( SID_BROWSE_STOP ); - } + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey ) +{ + return ::cppu::component_writeInfoHelper( + pServiceManager, pRegistryKey, entries ); +} + +void * SAL_CALL component_getFactory( + const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + return ::cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, entries ); } +} diff --git a/desktop/source/migration/services/makefile.mk b/desktop/source/migration/services/makefile.mk index 514132037368..55ecff6bc06f 100644 --- a/desktop/source/migration/services/makefile.mk +++ b/desktop/source/migration/services/makefile.mk @@ -31,6 +31,7 @@ PRJNAME=desktop TARGET = migrationoo2.uno ENABLE_EXCEPTIONS=TRUE COMP1TYPELIST = migrationoo2 +LIBTARGET=NO # --- Settings ----------------------------------------------------- .INCLUDE : ..$/..$/deployment/inc/dp_misc.mk @@ -50,7 +51,18 @@ SLOFILES= \ $(SLO)$/cexports.obj \ $(SLO)$/basicmigration.obj \ $(SLO)$/wordbookmigration.obj \ - $(SLO)$/extensionmigration.obj + $(SLO)$/extensionmigration.obj \ + $(SLO)$/autocorrmigration.obj \ + $(SLO)$/oo3extensionmigration.obj \ + $(SLO)$/cexportsoo3.obj + +SHL1OBJS= \ + $(SLO)$/jvmfwk.obj \ + $(SLO)$/cexports.obj \ + $(SLO)$/basicmigration.obj \ + $(SLO)$/wordbookmigration.obj \ + $(SLO)$/extensionmigration.obj \ + $(SLO)$/autocorrmigration.obj SHL1TARGET=$(TARGET) SHL1VERSIONMAP = $(SOLARENV)/src/component.map @@ -67,16 +79,42 @@ SHL1STDLIBS= \ $(JVMFWKLIB) \ $(XMLSCRIPTLIB) \ $(BERKELEYLIB) - - SHL1DEPN= -SHL1IMPLIB=i$(TARGET) -SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1IMPLIB=imigrationoo2 +#SHL1LIBS=$(SLB)$/$(TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +COMP2TYPELIST = migrationoo3 +SHL2TARGET=migrationoo3.uno +SHL2VERSIONMAP = migrationoo3.map + +SHL2OBJS= \ + $(SLO)$/cexportsoo3.obj \ + $(SLO)$/oo3extensionmigration.obj + +SHL2STDLIBS= \ + $(DEPLOYMENTMISCLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) \ + $(UCBHELPERLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(I18NISOLANGLIB) \ + $(JVMFWKLIB) \ + $(XMLSCRIPTLIB) \ + $(BERKELEYLIB) + +SHL2DEPN= +SHL2IMPLIB=imigrationoo3 +#SHL2LIBS=$(SLB)$/$(SHL2TARGET).lib +SHL2DEF=$(MISC)$/$(SHL2TARGET).def + +DEF2NAME=$(SHL2TARGET) + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/desktop/source/migration/services/migrationoo3.map b/desktop/source/migration/services/migrationoo3.map new file mode 100755 index 000000000000..ac2c3750bfe0 --- /dev/null +++ b/desktop/source/migration/services/migrationoo3.map @@ -0,0 +1,8 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx new file mode 100755 index 000000000000..11bf8129cc04 --- /dev/null +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -0,0 +1,656 @@ +/************************************************************************* + * + * 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: extensionmigration.cxx,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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "oo3extensionmigration.hxx" +#include <rtl/instance.hxx> +#include <osl/file.hxx> +#include <osl/thread.h> +#include <tools/urlobj.hxx> +#include <unotools/bootstrap.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/textsearch.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/processfactory.hxx> +#include <ucbhelper/content.hxx> + +#include <com/sun/star/deployment/thePackageManagerFactory.hpp> +#include <com/sun/star/deployment/XPackageManagerFactory.hpp> +#include <com/sun/star/task/XInteractionApprove.hpp> +#include <com/sun/star/task/XInteractionAbort.hpp> +#include <com/sun/star/ucb/XCommandInfo.hpp> +#include <com/sun/star/ucb/TransferInfo.hpp> +#include <com/sun/star/ucb/NameClash.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/xml/xpath/XXPathAPI.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace migration +{ + +static ::rtl::OUString sExtensionSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/uno_packages/" ) ); +static ::rtl::OUString sSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cache" ) ); +static ::rtl::OUString sConfigDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data" ) ); +static ::rtl::OUString sOrgDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); +static ::rtl::OUString sExcludeDir1 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); +static ::rtl::OUString sExcludeDir2 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org/openoffice" ) ); +static ::rtl::OUString sDescriptionXmlFile = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/description.xml" ) ); +static ::rtl::OUString sExtensionRootSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/uno_packages" ) ); + +static ::rtl::OUString sConfigurationDataType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-data")); +static ::rtl::OUString sConfigurationSchemaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-schema")); + +// ============================================================================= +// component operations +// ============================================================================= + +::rtl::OUString OO3ExtensionMigration_getImplementationName() +{ + static ::rtl::OUString* pImplName = 0; + if ( !pImplName ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pImplName ) + { + static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.migration.OOo3Extensions" ) ); + pImplName = &aImplName; + } + } + return *pImplName; +} + +// ----------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > OO3ExtensionMigration_getSupportedServiceNames() +{ + static Sequence< ::rtl::OUString >* pNames = 0; + if ( !pNames ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pNames ) + { + static Sequence< ::rtl::OUString > aNames(1); + aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Extensions" ) ); + pNames = &aNames; + } + } + return *pNames; +} + +// ============================================================================= +// ExtensionMigration +// ============================================================================= + +OO3ExtensionMigration::OO3ExtensionMigration(Reference< XComponentContext > const & ctx) : +m_ctx(ctx) +{ +} + +// ----------------------------------------------------------------------------- + +OO3ExtensionMigration::~OO3ExtensionMigration() +{ +} + +::osl::FileBase::RC OO3ExtensionMigration::checkAndCreateDirectory( INetURLObject& rDirURL ) +{ + ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); + if ( aResult == ::osl::FileBase::E_NOENT ) + { + INetURLObject aBaseURL( rDirURL ); + aBaseURL.removeSegment(); + checkAndCreateDirectory( aBaseURL ); + return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); + } + else + { + return aResult; + } +} + +void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< deployment::XPackage > & xPkg) +{ + const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); + if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) + { + xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + } +} + + void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) +{ + osl::Directory aScanRootDir( sSourceDir ); + osl::FileStatus fs(FileStatusMask_Type | FileStatusMask_FileURL); + osl::FileBase::RC nRetCode = aScanRootDir.open(); + if ( nRetCode == osl::Directory::E_None ) + { + sal_uInt32 nHint( 0 ); + osl::DirectoryItem aItem; + while ( aScanRootDir.getNextItem( aItem, nHint ) == osl::Directory::E_None ) + { + if (( aItem.getFileStatus(fs) == osl::FileBase::E_None ) && + ( fs.getFileType() == osl::FileStatus::Directory )) + { + //Check next folder as the "real" extension folder is below a temp folder! + ::rtl::OUString sExtensionFolderURL = fs.getFileURL(); + + osl::DirectoryItem aExtDirItem; + osl::Directory aExtensionRootDir( sExtensionFolderURL ); + + nRetCode = aExtensionRootDir.open(); + if (( nRetCode == osl::Directory::E_None ) && + ( aExtensionRootDir.getNextItem( aExtDirItem, nHint ) == osl::Directory::E_None )) + { + bool bFileStatus = aExtDirItem.getFileStatus(fs) == osl::FileBase::E_None; + bool bIsDir = fs.getFileType() == osl::FileStatus::Directory; + + if ( bFileStatus && bIsDir ) + { + sExtensionFolderURL = fs.getFileURL(); + ScanResult eResult = scanExtensionFolder( sExtensionFolderURL ); + if ( eResult == SCANRESULT_MIGRATE_EXTENSION ) + aMigrateExtensions.push_back( sExtensionFolderURL ); + } + } + } + } + } +} + +OO3ExtensionMigration::ScanResult OO3ExtensionMigration::scanExtensionFolder( const ::rtl::OUString& sExtFolder ) +{ + ScanResult aResult = SCANRESULT_NOTFOUND; + osl::Directory aDir(sExtFolder); + + // get sub dirs + if (aDir.open() == osl::FileBase::E_None) + { + // work through directory contents... + osl::DirectoryItem item; + osl::FileStatus fs(FileStatusMask_Type | FileStatusMask_FileURL); + TStringVector aDirectories; + while ((aDir.getNextItem(item) == osl::FileBase::E_None ) && + ( aResult == SCANRESULT_NOTFOUND )) + { + if (item.getFileStatus(fs) == osl::FileBase::E_None) + { + ::rtl::OUString aDirEntryURL; + if (fs.getFileType() == osl::FileStatus::Directory) + aDirectories.push_back( fs.getFileURL() ); + else + { + aDirEntryURL = fs.getFileURL(); + if ( aDirEntryURL.indexOf( sDescriptionXmlFile ) > 0 ) + aResult = scanDescriptionXml( aDirEntryURL ) ? SCANRESULT_MIGRATE_EXTENSION : SCANRESULT_DONTMIGRATE_EXTENSION; + } + } + } + + TStringVector::const_iterator pIter = aDirectories.begin(); + while ( pIter != aDirectories.end() && aResult == SCANRESULT_NOTFOUND ) + { + aResult = scanExtensionFolder( *pIter ); + ++pIter; + } + } + return aResult; +} + +bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlURL ) +{ + if ( !m_xDocBuilder.is() ) + { + m_xDocBuilder = uno::Reference< xml::dom::XDocumentBuilder >( + m_ctx->getServiceManager()->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder")), + m_ctx ), uno::UNO_QUERY ); + } + + if ( !m_xSimpleFileAccess.is() ) + { + m_xSimpleFileAccess = uno::Reference< ucb::XSimpleFileAccess >( + m_ctx->getServiceManager()->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), + m_ctx ), uno::UNO_QUERY ); + } + + ::rtl::OUString aExtIdentifier; + if ( m_xDocBuilder.is() && m_xSimpleFileAccess.is() ) + { + try + { + uno::Reference< io::XInputStream > xIn = + m_xSimpleFileAccess->openFileRead( sDescriptionXmlURL ); + + if ( xIn.is() ) + { + uno::Reference< xml::dom::XDocument > xDoc = m_xDocBuilder->parse( xIn ); + if ( xDoc.is() ) + { + uno::Reference< xml::dom::XElement > xRoot = xDoc->getDocumentElement(); + if ( xRoot.is() && + xRoot->getTagName().equals(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("description"))) ) + { + uno::Reference< xml::xpath::XXPathAPI > xPath( + m_ctx->getServiceManager()->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.xpath.XPathAPI")), + m_ctx), + uno::UNO_QUERY); + + xPath->registerNS( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc")), + xRoot->getNamespaceURI()); + xPath->registerNS( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xlink")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http://www.w3.org/1999/xlink"))); + + try + { + uno::Reference< xml::dom::XNode > xRootNode( xRoot, uno::UNO_QUERY ); + uno::Reference< xml::dom::XNode > xNode( + xPath->selectSingleNode( + xRootNode, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc:identifier/@value")) )); + if ( xNode.is() ) + aExtIdentifier = xNode->getNodeValue(); + } + catch ( xml::xpath::XPathException& ) + { + } + catch ( xml::dom::DOMException& ) + { + } + } + } + } + + if ( aExtIdentifier.getLength() > 0 ) + { + // scan extension identifier and try to match with our black list entries + for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ ) + { + utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); + utl::TextSearch ts(param, LANGUAGE_DONTKNOW); + + xub_StrLen start = 0; + xub_StrLen end = static_cast<USHORT>(aExtIdentifier.getLength()); + if (ts.SearchFrwrd(aExtIdentifier, &start, &end)) + return false; + } + } + } + catch ( ucb::CommandAbortedException& ) + { + } + catch ( uno::RuntimeException& ) + { + } + + if ( aExtIdentifier.getLength() == 0 ) + { + // Fallback: + // Try to use the folder name to match our black list + // as some extensions don't provide an identifier in the + // description.xml! + for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ ) + { + utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); + utl::TextSearch ts(param, LANGUAGE_DONTKNOW); + + xub_StrLen start = 0; + xub_StrLen end = static_cast<USHORT>(sDescriptionXmlURL.getLength()); + if (ts.SearchFrwrd(sDescriptionXmlURL, &start, &end)) + return false; + } + } + } + + return true; +} + +bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir ) +{ + if ( !m_xPackageManager.is() ) + { + try + { + m_xPackageManager = deployment::thePackageManagerFactory::get( m_ctx )->getPackageManager( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "user" )) ); + } + catch ( ucb::CommandFailedException & ){} + catch ( uno::RuntimeException & ) {} + } + + if ( m_xPackageManager.is() ) + { + try + { + TmpRepositoryCommandEnv* pCmdEnv = new TmpRepositoryCommandEnv(); + + uno::Reference< ucb::XCommandEnvironment > xCmdEnv( + static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY ); + uno::Reference< task::XAbortChannel > xAbortChannel; + uno::Reference< deployment::XPackage > xPackage = + m_xPackageManager->addPackage( sSourceDir, ::rtl::OUString(), xAbortChannel, xCmdEnv ); + + if ( xPackage.is() ) + return true; + } + catch ( ucb::CommandFailedException& ) + { + } + catch ( ucb::CommandAbortedException& ) + { + } + catch ( lang::IllegalArgumentException& ) + { + } + } + + return false; +} + +bool OO3ExtensionMigration::copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) +{ + bool bRet = false; + + INetURLObject aSourceObj( sSourceDir ); + INetURLObject aDestObj( sTargetDir ); + String aName = aDestObj.getName(); + aDestObj.removeSegment(); + aDestObj.setFinalSlash(); + + try + { + ::ucbhelper::Content aDestPath( aDestObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); + uno::Reference< ucb::XCommandInfo > xInfo = aDestPath.getCommands(); + ::rtl::OUString aTransferName = ::rtl::OUString::createFromAscii( "transfer" ); + if ( xInfo->hasCommandByName( aTransferName ) ) + { + aDestPath.executeCommand( aTransferName, uno::makeAny( + ucb::TransferInfo( sal_False, aSourceObj.GetMainURL( INetURLObject::NO_DECODE ), aName, ucb::NameClash::OVERWRITE ) ) ); + bRet = true; + } + } + catch( uno::Exception& ) + { + } + + return bRet; +} + + +// ----------------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------------- + +::rtl::OUString OO3ExtensionMigration::getImplementationName() throw (RuntimeException) +{ + return OO3ExtensionMigration_getImplementationName(); +} + +// ----------------------------------------------------------------------------- + +sal_Bool OO3ExtensionMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); + const ::rtl::OUString* pNames = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pNames + aNames.getLength(); + for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) + ; + + return pNames != pEnd; +} + +// ----------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > OO3ExtensionMigration::getSupportedServiceNames() throw (RuntimeException) +{ + return OO3ExtensionMigration_getSupportedServiceNames(); +} + +// ----------------------------------------------------------------------------- +// XInitialization +// ----------------------------------------------------------------------------- + +void OO3ExtensionMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + const Any* pIter = aArguments.getConstArray(); + const Any* pEnd = pIter + aArguments.getLength(); + for ( ; pIter != pEnd ; ++pIter ) + { + beans::NamedValue aValue; + *pIter >>= aValue; + if ( aValue.Name.equalsAscii( "UserData" ) ) + { + if ( !(aValue.Value >>= m_sSourceDir) ) + { + OSL_ENSURE( false, "ExtensionMigration::initialize: argument UserData has wrong type!" ); + } + } + else if ( aValue.Name.equalsAscii( "ExtensionBlackList" ) ) + { + Sequence< ::rtl::OUString > aBlackList; + if ( (aValue.Value >>= aBlackList ) && ( aBlackList.getLength() > 0 )) + { + m_aBlackList.resize( aBlackList.getLength() ); + ::comphelper::sequenceToArray< ::rtl::OUString >( &m_aBlackList[0], aBlackList ); + } + } + } +} + +// ----------------------------------------------------------------------------- + +TStringVectorPtr getContent( const ::rtl::OUString& rBaseURL ) +{ + TStringVectorPtr aResult( new TStringVector ); + ::osl::Directory aDir( rBaseURL); + if ( aDir.open() == ::osl::FileBase::E_None ) + { + // iterate over directory content + TStringVector aSubDirs; + ::osl::DirectoryItem aItem; + while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None ) + { + ::osl::FileStatus aFileStatus( FileStatusMask_Type | FileStatusMask_FileURL ); + if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None ) + aResult->push_back( aFileStatus.getFileURL() ); + } + } + + return aResult; +} + +// ----------------------------------------------------------------------------- +// XJob +// ----------------------------------------------------------------------------- + +void OO3ExtensionMigration::copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) +{ + ::rtl::OUString sEx1( m_sSourceDir ); + sEx1 += sExcludeDir1; + ::rtl::OUString sEx2( m_sSourceDir ); + sEx2 += sExcludeDir2; + + TStringVectorPtr aList = getContent( sSourceDir ); + TStringVector::const_iterator aI = aList->begin(); + while ( aI != aList->end() ) + { + ::rtl::OUString sSourceLocalName = aI->copy( sSourceDir.getLength() ); + ::rtl::OUString aTemp = aI->copy( m_sSourceDir.getLength() ); + if ( aTemp != sExcludeDir1 && aTemp != sExcludeDir2 ) + { + ::rtl::OUString sTargetName = sTargetDir + sSourceLocalName; + copy( (*aI), sTargetName ); + } + ++aI; + } +} + +Any OO3ExtensionMigration::execute( const Sequence< beans::NamedValue >& ) + throw (lang::IllegalArgumentException, Exception, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( m_sTargetDir ); + if ( aStatus == ::utl::Bootstrap::PATH_EXISTS ) + { + // copy all extensions + ::rtl::OUString sSourceDir( m_sSourceDir ); + sSourceDir += sExtensionSubDir; + sSourceDir += sSubDirName; + sSourceDir += sExtensionRootSubDirName; + TStringVector aExtensionToMigrate; + scanUserExtensions( sSourceDir, aExtensionToMigrate ); + if ( aExtensionToMigrate.size() > 0 ) + { + TStringVector::iterator pIter = aExtensionToMigrate.begin(); + while ( pIter != aExtensionToMigrate.end() ) + { + migrateExtension( *pIter ); + ++pIter; + } + } + } + + return Any(); +} + +// ----------------------------------------------------------------------------- +// TmpRepositoryCommandEnv +// ----------------------------------------------------------------------------- + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() +{ +} + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( + uno::Reference< task::XInteractionHandler> const & handler) + : m_forwardHandler(handler) +{ +} + +TmpRepositoryCommandEnv::~TmpRepositoryCommandEnv() +{ +} +// XCommandEnvironment +//______________________________________________________________________________ +uno::Reference< task::XInteractionHandler > TmpRepositoryCommandEnv::getInteractionHandler() +throw ( uno::RuntimeException ) +{ + return this; +} + +//______________________________________________________________________________ +uno::Reference< ucb::XProgressHandler > TmpRepositoryCommandEnv::getProgressHandler() +throw ( uno::RuntimeException ) +{ + return this; +} + +// XInteractionHandler +void TmpRepositoryCommandEnv::handle( + uno::Reference< task::XInteractionRequest> const & xRequest ) + throw ( uno::RuntimeException ) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + + bool approve = true; + bool abort = false; + + // select: + uno::Sequence< Reference< task::XInteractionContinuation > > conts( + xRequest->getContinuations() ); + Reference< task::XInteractionContinuation > const * pConts = + conts.getConstArray(); + sal_Int32 len = conts.getLength(); + for ( sal_Int32 pos = 0; pos < len; ++pos ) + { + if (approve) { + uno::Reference< task::XInteractionApprove > xInteractionApprove( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionApprove.is()) { + xInteractionApprove->select(); + // don't query again for ongoing continuations: + approve = false; + } + } + else if (abort) { + uno::Reference< task::XInteractionAbort > xInteractionAbort( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionAbort.is()) { + xInteractionAbort->select(); + // don't query again for ongoing continuations: + abort = false; + } + } + } +} + +// XProgressHandler +void TmpRepositoryCommandEnv::push( uno::Any const & /*Status*/ ) +throw (uno::RuntimeException) +{ +} + + +void TmpRepositoryCommandEnv::update( uno::Any const & /*Status */) +throw (uno::RuntimeException) +{ +} + +void TmpRepositoryCommandEnv::pop() throw (uno::RuntimeException) +{ +} + +// ============================================================================= +// component operations +// ============================================================================= + +Reference< XInterface > SAL_CALL OO3ExtensionMigration_create( + Reference< XComponentContext > const & ctx ) + SAL_THROW( () ) +{ + return static_cast< lang::XTypeProvider * >( new OO3ExtensionMigration( + ctx) ); +} + +// ----------------------------------------------------------------------------- + +} // namespace migration diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx new file mode 100755 index 000000000000..a001f41d92c5 --- /dev/null +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * 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: extensionmigration.hxx,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. + * + ************************************************************************/ + +#ifndef _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ +#define _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ + +#include "misc.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/deployment/XPackageManager.hpp> + +#include <osl/mutex.hxx> +#include <osl/file.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/compbase3.hxx> +#include <ucbhelper/content.hxx> +#include <xmlscript/xmllib_imexp.hxx> + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } + namespace deployment { + class XPackage; + } +}}} + +class INetURLObject; + + +namespace migration +{ + + ::rtl::OUString SAL_CALL OO3ExtensionMigration_getImplementationName(); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OO3ExtensionMigration_getSupportedServiceNames(); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OO3ExtensionMigration_create( + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) + SAL_THROW( (::com::sun::star::uno::Exception) ); + + + // ============================================================================= + // class ExtensionMigration + // ============================================================================= + + typedef ::cppu::WeakImplHelper3< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::task::XJob > ExtensionMigration_BASE; + + class OO3ExtensionMigration : public ExtensionMigration_BASE + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XDocumentBuilder > m_xDocBuilder; + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > m_xSimpleFileAccess; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > m_xPackageManager; + ::osl::Mutex m_aMutex; + ::rtl::OUString m_sSourceDir; + ::rtl::OUString m_sTargetDir; + TStringVector m_aBlackList; + + enum ScanResult + { + SCANRESULT_NOTFOUND, + SCANRESULT_MIGRATE_EXTENSION, + SCANRESULT_DONTMIGRATE_EXTENSION + }; + + ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); + void copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); + bool copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); + ScanResult scanExtensionFolder( const ::rtl::OUString& sExtFolder ); + void scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ); + bool scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlFilePath ); + bool migrateExtension( const ::rtl::OUString& sSourceDir ); + /* fills m_scriptElements and m_dialogElements + */ + void registerConfigurationPackage( + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); + + public: + OO3ExtensionMigration(::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & ctx); + virtual ~OO3ExtensionMigration(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) + 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); + + // XJob + virtual ::com::sun::star::uno::Any SAL_CALL execute( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + }; + + class TmpRepositoryCommandEnv + : public ::cppu::WeakImplHelper3< ::com::sun::star::ucb::XCommandEnvironment, + ::com::sun::star::task::XInteractionHandler, + ::com::sun::star::ucb::XProgressHandler > + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_forwardHandler; + public: + virtual ~TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> const & handler); + + // XCommandEnvironment + virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL + getInteractionHandler() throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > + SAL_CALL getProgressHandler() throw ( ::com::sun::star::uno::RuntimeException ); + + // XInteractionHandler + virtual void SAL_CALL handle( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & xRequest ) + throw (::com::sun::star::uno::RuntimeException); + + // XProgressHandler + virtual void SAL_CALL push( ::com::sun::star::uno::Any const & Status ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL update( ::com::sun::star::uno::Any const & Status ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL pop() throw (::com::sun::star::uno::RuntimeException); + }; + +//......................................................................... +} // namespace migration +//......................................................................... + +#endif // _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ diff --git a/desktop/source/migration/wizard.cxx b/desktop/source/migration/wizard.cxx index eeea969c6175..48ee2abc71ca 100644 --- a/desktop/source/migration/wizard.cxx +++ b/desktop/source/migration/wizard.cxx @@ -61,11 +61,14 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/awt/WindowDescriptor.hpp> +#include <com/sun/star/awt/WindowAttribute.hpp> using namespace svt; using namespace rtl; using namespace osl; using namespace utl; +using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -77,13 +80,38 @@ using namespace com::sun::star::container; namespace desktop { -const FirstStartWizard::WizardState FirstStartWizard::STATE_WELCOME = 0; -const FirstStartWizard::WizardState FirstStartWizard::STATE_LICENSE = 1; -const FirstStartWizard::WizardState FirstStartWizard::STATE_MIGRATION = 2; -const FirstStartWizard::WizardState FirstStartWizard::STATE_USER = 3; +const FirstStartWizard::WizardState FirstStartWizard::STATE_WELCOME = 0; +const FirstStartWizard::WizardState FirstStartWizard::STATE_LICENSE = 1; +const FirstStartWizard::WizardState FirstStartWizard::STATE_MIGRATION = 2; +const FirstStartWizard::WizardState FirstStartWizard::STATE_USER = 3; const FirstStartWizard::WizardState FirstStartWizard::STATE_UPDATE_CHECK = 4; const FirstStartWizard::WizardState FirstStartWizard::STATE_REGISTRATION = 5; +static uno::Reference< uno::XComponentContext > getComponentContext( const uno::Reference< lang::XMultiServiceFactory >& rFactory ) +{ + uno::Reference< uno::XComponentContext > rContext; + uno::Reference< beans::XPropertySet > rPropSet( rFactory, uno::UNO_QUERY ); + uno::Any a = rPropSet->getPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ); + a >>= rContext; + return rContext; +} + +static sal_Int32 getBuildId() +{ + ::rtl::OUString aDefault; + ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); + sal_Int32 nBuildId( 0 ); + sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); + sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); + if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) + { + ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); + nBuildId = aBuildId.toInt32(); + } + return nBuildId; +} + WizardResId::WizardResId( USHORT nId ) : ResId( nId, *FirstStartWizard::GetResManager() ) { @@ -118,7 +146,47 @@ FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAccep // enableState(STATE_USER, sal_False); // enableState(STATE_REGISTRATION, sal_False); - ShowButtonFixedLine(sal_True); + try + { + Point pos(5, 210 ); + Size size(11, 11 ); + + pos = LogicToPixel( pos, MAP_APPFONT ); + size = LogicToPixel( size, MAP_APPFONT ); + + uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< awt::XToolkit > xToolkit( + uno::Reference< lang::XMultiComponentFactory >( + xFactory, uno::UNO_QUERY_THROW)-> + createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")), + getComponentContext(xFactory)), + uno::UNO_QUERY_THROW); + + m_xThrobber = uno::Reference< awt::XThrobber >( + xToolkit->createWindow( + awt::WindowDescriptor( + awt::WindowClass_SIMPLE, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber")), + GetComponentInterface(), 0, + awt::Rectangle( + pos.X(), pos.Y(), size.Width(), size.Height()), + awt::WindowAttribute::SHOW)), + uno::UNO_QUERY_THROW); + } + catch (uno::RuntimeException &) + { + throw; + } + catch (Exception& ) + { + } + + uno::Reference< awt::XWindow > xThrobberWin( m_xThrobber, uno::UNO_QUERY ); + if ( xThrobberWin.is() ) + xThrobberWin->setVisible( false ); + Size aTPSize(TP_WIDTH, TP_HEIGHT); SetPageSizePixel(LogicToPixel(aTPSize, MAP_APPFONT)); @@ -151,6 +219,16 @@ FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAccep defaultButton(WZB_NEXT); } +void FirstStartWizard::EnableButtonsWhileMigration() +{ + enableButtons(0xff, sal_True); +} + +void FirstStartWizard::DisableButtonsWhileMigration() +{ + enableButtons(0xff, sal_False); +} + ::svt::RoadmapWizardTypes::PathId FirstStartWizard::defineWizardPagesDependingFromContext() { ::svt::RoadmapWizardTypes::PathId aDefaultPath = 0; @@ -280,7 +358,7 @@ TabPage* FirstStartWizard::createPage(WizardState _nState) pTabPage = new LicensePage(this, WizardResId(TP_LICENSE), m_aLicensePath); break; case STATE_MIGRATION: - pTabPage = new MigrationPage(this, WizardResId(TP_MIGRATION)); + pTabPage = new MigrationPage(this, WizardResId(TP_MIGRATION), m_xThrobber ); break; case STATE_USER: pTabPage = new UserPage(this, WizardResId(TP_USER)); @@ -350,6 +428,14 @@ sal_Bool FirstStartWizard::prepareLeaveCurrentState( CommitPageReason _eReason ) sal_Bool FirstStartWizard::leaveState(WizardState) { + if (( getCurrentState() == STATE_MIGRATION ) && m_bLicenseWasAccepted ) + { + // Store accept date and patch level now as it has been + // overwritten by the migration process! + storeAcceptDate(); + setPatchLevel(); + } + return sal_True; } @@ -436,6 +522,30 @@ void FirstStartWizard::storeAcceptDate() } +void FirstStartWizard::setPatchLevel() +{ + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // get configuration provider + Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Sequence< Any > theArgs(1); + NamedValue v(OUString::createFromAscii("NodePath"), + makeAny(OUString::createFromAscii("org.openoffice.Office.Common/Help/Registration"))); + theArgs[0] <<= v; + Reference< XPropertySet > pset = Reference< XPropertySet >( + theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); + Any result = pset->getPropertyValue(OUString::createFromAscii("ReminderDate")); + + OUString aPatchLevel( RTL_CONSTASCII_USTRINGPARAM( "Patch" )); + aPatchLevel += OUString::valueOf( getBuildId(), 10 ); + pset->setPropertyValue(OUString::createFromAscii("ReminderDate"), makeAny(aPatchLevel)); + Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); + } catch (const Exception&) + { + } +} + #ifdef WNT typedef int ( __stdcall * CleanCurUserRegProc ) ( wchar_t* ); #endif diff --git a/desktop/source/migration/wizard.hrc b/desktop/source/migration/wizard.hrc index 56bc61184fda..fdad97a8174b 100644 --- a/desktop/source/migration/wizard.hrc +++ b/desktop/source/migration/wizard.hrc @@ -78,6 +78,7 @@ #define ED_USER_LAST 17 #define ED_USER_FATHER 18 #define ED_USER_INITIALS 19 +#define TR_WAITING 20 // global strings #define STR_STATE_WELCOME RID_FIRSTSTSTART_START+100 diff --git a/desktop/source/migration/wizard.hxx b/desktop/source/migration/wizard.hxx index b84b461937e7..e41bfe373cde 100644 --- a/desktop/source/migration/wizard.hxx +++ b/desktop/source/migration/wizard.hxx @@ -32,6 +32,7 @@ #include <svtools/roadmapwizard.hxx> #include <vcl/window.hxx> #include <tools/resid.hxx> +#include <com/sun/star/awt/XThrobber.hpp> namespace desktop { @@ -61,6 +62,9 @@ public: virtual short Execute(); virtual long PreNotify( NotifyEvent& rNEvt ); + void EnableButtonsWhileMigration(); + void DisableButtonsWhileMigration(); + private: sal_Bool m_bOverride; WizardState _currentState; @@ -73,10 +77,12 @@ private: sal_Bool m_bLicenseWasAccepted; sal_Bool m_bAutomaticUpdChk; Link m_lnkCancel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > m_xThrobber; rtl::OUString m_aLicensePath; void storeAcceptDate(); + void setPatchLevel(); void disableWizard(); void enableQuickstart(); diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 02fde984141c..2acd4f79a781 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -82,6 +82,8 @@ const char s_usingText [] = " -V, --version version information\n" " -v, --verbose verbose output to stdout\n" " -f, --force force overwriting existing extensions\n" +" -s, --suppress-license prevents showing the license provided that\n" +" the extension allows it\n" " --log-file <file> custom log file; default: <cache-dir>/log.txt\n" " --shared expert feature: operate on shared installation\n" " deployment context;\n" @@ -103,6 +105,7 @@ const OptionInfo s_option_infos [] = { { RTL_CONSTASCII_STRINGPARAM("shared"), '\0', false }, { RTL_CONSTASCII_STRINGPARAM("deployment-context"), '\0', true }, { RTL_CONSTASCII_STRINGPARAM("bundled"), '\0', false}, + { RTL_CONSTASCII_STRINGPARAM("suppress-license"), 's', false}, { 0, 0, '\0', false } }; @@ -207,6 +210,7 @@ extern "C" int unopkg_main() bool option_force = false; bool option_verbose = false; bool option_bundled = false; + bool option_suppressLicense = false; bool subcmd_add = false; bool subcmd_gui = false; OUString logFile; @@ -230,6 +234,9 @@ extern "C" int unopkg_main() s_option_infos, OUSTR("version") ); OptionInfo const * info_bundled = getOptionInfo( s_option_infos, OUSTR("bundled") ); + OptionInfo const * info_suppressLicense = getOptionInfo( + s_option_infos, OUSTR("suppress-license") ); + Reference<XComponentContext> xComponentContext; Reference<XComponentContext> xLocalComponentContext; @@ -271,6 +278,7 @@ extern "C" int unopkg_main() !readOption( &option_shared, info_shared, &nPos ) && !readOption( &option_force, info_force, &nPos ) && !readOption( &option_bundled, info_bundled, &nPos ) && + !readOption( &option_suppressLicense, info_suppressLicense, &nPos ) && !readArgument( &deploymentContext, info_context, &nPos ) && !isBootstrapVariable(&nPos)) { @@ -342,7 +350,8 @@ extern "C" int unopkg_main() Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv( createCmdEnv( xComponentContext, logFile, - option_force, option_verbose, option_bundled) ); + option_force, option_verbose, option_bundled, + option_suppressLicense) ); if (subcmd_add || subCommand.equalsAsciiL( diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 414a80eccc79..e4a503d98732 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -86,6 +86,7 @@ class CommandEnvironmentImpl bool m_option_force_overwrite; bool m_option_verbose; bool m_option_bundled; + bool m_option_suppressLicense; Reference< XComponentContext > m_xComponentContext; Reference< XProgressHandler > m_xLogFile; @@ -99,7 +100,8 @@ public: OUString const & log_file, bool option_force_overwrite, bool option_verbose, - bool option_bundled); + bool option_bundled, + bool option_suppressLicense); // XCommandEnvironment virtual Reference< task::XInteractionHandler > SAL_CALL @@ -124,11 +126,13 @@ CommandEnvironmentImpl::CommandEnvironmentImpl( OUString const & log_file, bool option_force_overwrite, bool option_verbose, - bool option_bundled) + bool option_bundled, + bool option_suppressLicense) : m_logLevel(0), m_option_force_overwrite( option_force_overwrite ), m_option_verbose( option_verbose ), m_option_bundled( option_bundled), + m_option_suppressLicense( option_suppressLicense), m_xComponentContext(xComponentContext) { if (log_file.getLength() > 0) { @@ -279,15 +283,25 @@ void CommandEnvironmentImpl::handle( } else if (request >>= licAgreementExc) { - String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, *DeploymentResMgr::get() ) ); - sResMsg.SearchAndReplaceAllAscii( "%NAME", licAgreementExc.ExtensionName ); - dp_misc::writeConsole(OUSTR("\n") + sResMsg + OUSTR("\n\n")); - abort = true; + if (m_option_suppressLicense && licAgreementExc.SuppressIfRequired) + { + approve = true; + } + else + { + String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, *DeploymentResMgr::get() ) ); + sResMsg.SearchAndReplaceAllAscii( "%NAME", licAgreementExc.ExtensionName ); + dp_misc::writeConsole(OUSTR("\n") + sResMsg + OUSTR("\n\n")); + abort = true; + } } else if (request >>= licExc) { bLicenseException = true; - printLicense(licExc.Text, approve, abort); + if (m_option_suppressLicense && licExc.SuppressIfRequired) + approve = true; + else + printLicense(licExc.Text, approve, abort); } else if (request >>= instExc) { @@ -432,10 +446,12 @@ Reference< XCommandEnvironment > createCmdEnv( OUString const & logFile, bool option_force_overwrite, bool option_verbose, - bool option_bundled) + bool option_bundled, + bool option_suppressLicense) { return new CommandEnvironmentImpl( - xContext, logFile, option_force_overwrite, option_verbose, option_bundled); + xContext, logFile, option_force_overwrite, option_verbose, option_bundled, + option_suppressLicense); } } // unopkg diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index cd082231774d..6e9d30cf0d42 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -163,7 +163,8 @@ css::uno::Reference<css::ucb::XCommandEnvironment> createCmdEnv( ::rtl::OUString const & logFile, bool option_force_overwrite, bool option_verbose, - bool option_bundled); + bool option_bundled, + bool option_suppressLicense); //============================================================================== void printf_packages( diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 6e949c1bf00c..5fee3028b4f6 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -44,6 +44,8 @@ #include <rtl/logfile.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/math.hxx> +#include <vcl/graph.hxx> +#include <svtools/filter.hxx> #define NOT_LOADED ((long)-1) @@ -58,6 +60,7 @@ SplashScreen::SplashScreen(const Reference< XMultiServiceFactory >& rSMgr) , _vdev(*((IntroWindow*)this)) , _cProgressFrameColor(sal::static_int_cast< ColorData >(NOT_LOADED)) , _cProgressBarColor(sal::static_int_cast< ColorData >(NOT_LOADED)) + , _bNativeProgress(true) , _iMax(100) , _iProgress(0) , _eBitmapMode(BM_DEFAULTMODE) @@ -295,6 +298,9 @@ void SplashScreen::loadConfig() OUString( RTL_CONSTASCII_USTRINGPARAM( "ProgressPosition" ) ) ); OUString sFullScreenSplash = implReadBootstrapKey( OUString( RTL_CONSTASCII_USTRINGPARAM( "FullScreenSplash" ) ) ); + OUString sNativeProgress = implReadBootstrapKey( + OUString( RTL_CONSTASCII_USTRINGPARAM( "NativeProgress" ) ) ); + // Determine full screen splash mode _bFullScreenSplash = (( sFullScreenSplash.getLength() > 0 ) && @@ -345,6 +351,11 @@ void SplashScreen::loadConfig() } } + if( sNativeProgress.getLength() ) + { + _bNativeProgress = sNativeProgress.toBoolean(); + } + if ( sSize.getLength() ) { sal_Int32 idx = 0; @@ -418,9 +429,15 @@ bool SplashScreen::loadBitmap( SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); if ( !aStrm.GetError() ) { + // Use graphic class to also support more graphic formats (bmp,png,...) + Graphic aGraphic; + + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); + // Default case, we load the intro bitmap from a seperate file // (e.g. staroffice_intro.bmp or starsuite_intro.bmp) - aStrm >> _aIntroBmp; + _aIntroBmp = aGraphic.GetBitmapEx(); return true; } @@ -438,8 +455,14 @@ bool SplashScreen::findBitmap(rtl::OUString const & path) { haveBitmap = findAppBitmap(path); } if ( !haveBitmap ) + { haveBitmap = loadBitmap( - path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.bmp"))); + path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.png"))); + if ( !haveBitmap ) + haveBitmap = loadBitmap( + path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.bmp"))); + } + return haveBitmap; } @@ -469,21 +492,34 @@ bool SplashScreen::findScreenBitmap(rtl::OUString const & path) aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".bmp" ); - OUString aBmpFileName = aStrBuf.makeStringAndClear(); + + OUString aRootIntroFileName = aStrBuf.makeStringAndClear(); + OUString aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".png"); bool haveBitmap = loadBitmap( path, aBmpFileName ); if ( !haveBitmap ) { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".bmp"); + haveBitmap = loadBitmap( path, aBmpFileName ); + } + + if ( !haveBitmap ) + { aStrBuf.appendAscii( "intro_" ); aStrBuf.appendAscii( "_" ); aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".bmp" ); - aBmpFileName = aStrBuf.makeStringAndClear(); + + aRootIntroFileName = aStrBuf.makeStringAndClear(); + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".png"); haveBitmap = loadBitmap( path, aBmpFileName ); + if ( !haveBitmap ) + { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".bmp"); + haveBitmap = loadBitmap( path, aBmpFileName ); + } } return haveBitmap; } @@ -498,9 +534,16 @@ bool SplashScreen::findAppBitmap(rtl::OUString const & path) aStrBuf.appendAscii( "intro_" ); aStrBuf.appendAscii( "_" ); aStrBuf.append( _sAppName ); - aStrBuf.appendAscii( ".bmp" ); - OUString aBmpFileName = aStrBuf.makeStringAndClear(); + + OUString aRootIntroFileName = aStrBuf.makeStringAndClear(); + + OUString aBmpFileName = aRootIntroFileName + OUString::createFromAscii( ".png" ); haveBitmap = loadBitmap( path, aBmpFileName ); + if ( !haveBitmap ) + { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii( ".bmp" ); + haveBitmap = loadBitmap( path, aBmpFileName ); + } } return haveBitmap; } @@ -584,9 +627,9 @@ void SplashScreen::Paint( const Rectangle&) BOOL bNativeOK = FALSE; // in case of native controls we need to draw directly to the window - if( IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) ) + if( _bNativeProgress && IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) ) { - DrawBitmap( Point(), _aIntroBmp ); + DrawBitmapEx( Point(), _aIntroBmp ); ImplControlValue aValue( _iProgress * _barwidth / _iMax); Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) ); @@ -612,7 +655,7 @@ void SplashScreen::Paint( const Rectangle&) //non native drawing // draw bitmap if (_bPaintBitmap) - _vdev.DrawBitmap( Point(), _aIntroBmp ); + _vdev.DrawBitmapEx( Point(), _aIntroBmp ); if (_bPaintProgress) { // draw progress... diff --git a/desktop/source/splash/splash.hxx b/desktop/source/splash/splash.hxx index f56fff54b931..99677aa107f1 100644 --- a/desktop/source/splash/splash.hxx +++ b/desktop/source/splash/splash.hxx @@ -34,7 +34,7 @@ #include <cppuhelper/implbase2.hxx> #include <cppuhelper/interfacecontainer.h> #include <vcl/introwin.hxx> -#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <osl/mutex.hxx> #include <vcl/virdev.hxx> @@ -86,9 +86,10 @@ private: Reference< XMultiServiceFactory > _rFactory; VirtualDevice _vdev; - Bitmap _aIntroBmp; + BitmapEx _aIntroBmp; Color _cProgressFrameColor; Color _cProgressBarColor; + bool _bNativeProgress; OUString _sAppName; std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues; diff --git a/desktop/test/deployment/simple_license/suppress_license.oxt b/desktop/test/deployment/simple_license/suppress_license.oxt Binary files differnew file mode 100755 index 000000000000..2bacd6aa378b --- /dev/null +++ b/desktop/test/deployment/simple_license/suppress_license.oxt diff --git a/desktop/test/deployment/simple_license/tests_simple_license.odt b/desktop/test/deployment/simple_license/tests_simple_license.odt Binary files differindex b0f5410d9987..b0c86e11c69b 100644 --- a/desktop/test/deployment/simple_license/tests_simple_license.odt +++ b/desktop/test/deployment/simple_license/tests_simple_license.odt diff --git a/desktop/util/ooverinfo.rc b/desktop/util/ooverinfo.rc index 7a80adcad62c..28b1e0d4a811 100644 --- a/desktop/util/ooverinfo.rc +++ b/desktop/util/ooverinfo.rc @@ -69,7 +69,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #else block "040904E4" @@ -81,7 +81,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #endif } @@ -96,44 +96,43 @@ VS_VERSION_INFO versioninfo } } - -2 ICON "icons\\ooo3_writer_doc.ico" -3 ICON "icons\\ooo3_writer_tem.ico" -4 ICON "icons\\ooo3_calc_doc.ico" -5 ICON "icons\\ooo3_calc_tem.ico" -6 ICON "icons\\ooo3_draw_doc.ico" -7 ICON "icons\\ooo3_draw_tem.ico" -8 ICON "icons\\ooo3_impress_doc.ico" -9 ICON "icons\\ooo3_impress_tem.ico" -10 ICON "icons\\ooo3_impress_doc.ico" -11 ICON "icons\\ooo3_global_doc.ico" -12 ICON "icons\\ooo3_html_doc.ico" -13 ICON "icons\\ooo3_chart_doc.ico" -14 ICON "icons\\ooo3_base_doc.ico" -15 ICON "icons\\ooo3_math_doc.ico" -16 ICON "icons\\ooo3_empty_tem.ico" -17 ICON "icons\\ooo3_macro_doc.ico" +2 ICON "icons\\oasis-text.ico" +3 ICON "icons\\oasis-text-template.ico" +4 ICON "icons\\oasis-spreadsheet.ico" +5 ICON "icons\\oasis-spreadsheet-template.ico" +6 ICON "icons\\oasis-drawing.ico" +7 ICON "icons\\oasis-drawing-template.ico" +8 ICON "icons\\oasis-presentation.ico" +9 ICON "icons\\oasis-presentation-template.ico" +10 ICON "icons\\oasis-presentation-template.ico" +11 ICON "icons\\oasis-master-document.ico" +12 ICON "icons\\oasis-web-template.ico" +13 ICON "icons\\oasis-empty-document.ico" +14 ICON "icons\\oasis-database.ico" +15 ICON "icons\\oasis-formula.ico" +16 ICON "icons\\empty-template.ico" +17 ICON "icons\\empty-document.ico" 18 ICON "icons\\ooo-configuration.ico" 19 ICON "icons\\ooo-open.ico" -20 ICON "icons\\ooo-image-doc.ico" +20 ICON "icons\\empty-document.ico" 21 ICON "icons\\ooo3_writer_app.ico" 22 ICON "icons\\ooo3_calc_app.ico" 23 ICON "icons\\ooo3_draw_app.ico" 24 ICON "icons\\ooo3_impress_app.ico" 25 ICON "icons\\ooo3_math_app.ico" 26 ICON "icons\\ooo3_base_app.ico" -27 ICON "icons\\ooo3_empty_doc.ico" -28 ICON "icons\\ooo11-writer-doc.ico" -29 ICON "icons\\ooo11-writer-tem.ico" -30 ICON "icons\\ooo11-calc-doc.ico" -31 ICON "icons\\ooo11-calc-tem.ico" -32 ICON "icons\\ooo11-draw-doc.ico" -33 ICON "icons\\ooo11-draw-tem.ico" -34 ICON "icons\\ooo11-impress-doc.ico" -35 ICON "icons\\ooo11-impress-tem.ico" -36 ICON "icons\\ooo11-master-doc.ico" -37 ICON "icons\\ooo11-chart-doc.ico" -38 ICON "icons\\ooo11-base-doc.ico" -39 ICON "icons\\ooo11-math-doc.ico" +27 ICON "icons\\oasis-empty-document.ico" +28 ICON "icons\\text.ico" +29 ICON "icons\\text-template.ico" +30 ICON "icons\\spreadsheet.ico" +31 ICON "icons\\spreadsheet-template.ico" +32 ICON "icons\\drawing.ico" +33 ICON "icons\\drawing-template.ico" +34 ICON "icons\\presentation.ico" +35 ICON "icons\\presentation-template.ico" +36 ICON "icons\\master-document.ico" +37 ICON "icons\\empty-document.ico" +38 ICON "icons\\database.ico" +39 ICON "icons\\formula.ico" 40 ICON "icons\\oxt-extension.ico" diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc index adf7aac708eb..d19603d54855 100644 --- a/desktop/util/ooverinfo2.rc +++ b/desktop/util/ooverinfo2.rc @@ -48,42 +48,43 @@ // ----------------------------------------------------------------------- -ICON 2 "icons/ooo-writer-doc.ico" -ICON 3 "icons/ooo-writer-tem.ico" -ICON 4 "icons/ooo-calc-doc.ico" -ICON 5 "icons/ooo-calc-tem.ico" -ICON 6 "icons/ooo-draw-doc.ico" -ICON 7 "icons/ooo-draw-tem.ico" -ICON 8 "icons/ooo-impress-doc.ico" -ICON 9 "icons/ooo-impress-tem.ico" -ICON 10 "icons/ooo-impress-doc.ico" -//ICON 11 "icons/ooo-global-doc.ico" -//ICON 12 "icons/ooo-html-doc.ico" -ICON 13 "icons/ooo-chart-doc.ico" -ICON 14 "icons/ooo-base-doc.ico" -ICON 15 "icons/ooo-math-doc.ico" -ICON 16 "icons/ooo-empty-tem.ico" -ICON 17 "icons/ooo-macro-doc.ico" +ICON 2 "icons/oasis-text.ico" +ICON 3 "icons/oasis-text-template.ico" +ICON 4 "icons/oasis-spreadsheet.ico" +ICON 5 "icons/oasis-spreadsheet-template.ico" +ICON 6 "icons/oasis-drawing.ico" +ICON 7 "icons/oasis-drawing-template.ico" +ICON 8 "icons/oasis-presentation.ico" +ICON 9 "icons/oasis-presentation-template.ico" +ICON 10 "icons/oasis-presentation-template.ico" +// ICON 11 "icons/oasis-master-document.ico" +// ICON 12 "icons/oasis-web-template.ico" +ICON 13 "icons/oasis-empty-document.ico" +ICON 14 "icons/oasis-database.ico" +ICON 15 "icons/oasis-formula.ico" +ICON 16 "icons/empty-template.ico" +ICON 17 "icons/empty-document.ico" ICON 18 "icons/ooo-configuration.ico" ICON 19 "icons/ooo-open.ico" -ICON 20 "icons/ooo-image-doc.ico" +ICON 20 "icons/empty-document.ico" ICON 21 "icons/ooo-writer-app.ico" ICON 22 "icons/ooo-calc-app.ico" ICON 23 "icons/ooo-draw-app.ico" ICON 24 "icons/ooo-impress-app.ico" ICON 25 "icons/ooo-math-app.ico" ICON 26 "icons/ooo-base-app.ico" -ICON 27 "icons/ooo-empty-doc.ico" -ICON 28 "icons/ooo11-writer-doc.ico" -ICON 29 "icons/ooo11-writer-tem.ico" -ICON 30 "icons/ooo11-calc-doc.ico" -ICON 31 "icons/ooo11-calc-tem.ico" -ICON 32 "icons/ooo11-draw-doc.ico" -ICON 33 "icons/ooo11-draw-tem.ico" -ICON 34 "icons/ooo11-impress-doc.ico" -ICON 35 "icons/ooo11-impress-tem.ico" -ICON 36 "icons/ooo11-master-doc.ico" -ICON 37 "icons/ooo11-chart-doc.ico" -ICON 38 "icons/ooo11-base-doc.ico" -ICON 39 "icons/ooo11-math-doc.ico" +ICON 27 "icons/oasis-empty-document.ico" +ICON 28 "icons/text.ico" +ICON 29 "icons/text-template.ico" +ICON 30 "icons/spreadsheet.ico" +ICON 31 "icons/spreadsheet-template.ico" +ICON 32 "icons/drawing.ico" +ICON 33 "icons/drawing-template.ico" +ICON 34 "icons/presentation.ico" +ICON 35 "icons/presentation-template.ico" +ICON 36 "icons/master-document.ico" +ICON 37 "icons/empty-document.ico" +ICON 38 "icons/database.ico" +ICON 39 "icons/formula.ico" +ICON 40 "icons/oxt-extension.ico" diff --git a/desktop/util/verinfo.rc b/desktop/util/verinfo.rc index a9f3dcd3f44c..d61493568490 100644 --- a/desktop/util/verinfo.rc +++ b/desktop/util/verinfo.rc @@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo block "040704E4" { // German StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle, Inc.\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #else block "040904E4" { // International StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle, Inc.\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #endif } diff --git a/desktop/zipintro/makefile.mk b/desktop/zipintro/makefile.mk index 6a1ff592d636..fef106d1e09d 100644 --- a/desktop/zipintro/makefile.mk +++ b/desktop/zipintro/makefile.mk @@ -36,29 +36,29 @@ TARGET=zipintro DEFAULT_FLAVOURS=dev dev_nologo nologo broffice dev_broffice nologo_broffice nologo_dev_broffice intro ZIP1LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP2LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP3LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP4LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP5LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP6LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP7LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo_broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo_broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP8LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo_broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo_broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP1TARGET=dev_intro ZIP1DEPS=$(ZIP1LIST) @@ -129,3 +129,6 @@ $(MISC)$/%.bmp : $(SOLARSRC)$/%.bmp @@-$(MKDIRHIER) $(@:d) $(COPY) $< $@ +$(MISC)$/%.png : $(SOLARSRC)$/%.png + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ diff --git a/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx deleted file mode 100644 index 5e9f3ca4abe7..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX - -#include <basegfx/color/bcolor.hxx> - -////////////////////////////////////////////////////////////////////////////// -// predefines -class XHatch; - -namespace drawinglayer -{ - namespace attribute - { - enum GradientStyle - { - GRADIENTSTYLE_LINEAR, - GRADIENTSTYLE_AXIAL, - GRADIENTSTYLE_RADIAL, - GRADIENTSTYLE_ELLIPTICAL, - GRADIENTSTYLE_SQUARE, - GRADIENTSTYLE_RECT - }; - - enum HatchStyle - { - HATCHSTYLE_SINGLE, - HATCHSTYLE_DOUBLE, - HATCHSTYLE_TRIPLE - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class FillGradientAttribute - { - basegfx::BColor maStartColor; - basegfx::BColor maEndColor; - double mfBorder; - double mfOffsetX; - double mfOffsetY; - double mfAngle; - GradientStyle meStyle; - sal_uInt16 mnSteps; - - public: - FillGradientAttribute( - GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, double fAngle, - const basegfx::BColor& rStartColor, const basegfx::BColor& rEndColor, sal_uInt16 nSteps); - bool operator==(const FillGradientAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getStartColor() const { return maStartColor; } - const basegfx::BColor& getEndColor() const { return maEndColor; } - double getBorder() const { return mfBorder; } - double getOffsetX() const { return mfOffsetX; } - double getOffsetY() const { return mfOffsetY; } - double getAngle() const { return mfAngle; } - GradientStyle getStyle() const { return meStyle; } - sal_uInt16 getSteps() const { return mnSteps; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class FillHatchAttribute - { - double mfDistance; - double mfAngle; - basegfx::BColor maColor; - HatchStyle meStyle; - - // bitfield - unsigned mbFillBackground : 1; - - public: - FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor& rColor, bool bFillBackground); - bool operator==(const FillHatchAttribute& rCandidate) const; - - // data access - double getDistance() const { return mfDistance; } - double getAngle() const { return mfAngle; } - const basegfx::BColor& getColor() const { return maColor; } - HatchStyle getStyle() const { return meStyle; } - bool isFillBackground() const { return mbFillBackground; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx index 8425400daf0d..1bb8a864fa81 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx @@ -28,18 +28,22 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX -#include <vcl/bitmapex.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/vector/b2dvector.hxx> +#include <sal/types.h> ////////////////////////////////////////////////////////////////////////////// // predefines +class BitmapEx; + namespace basegfx { - class B2DRange; - class BColor; + class B2DPoint; + class B2DVector; } +namespace drawinglayer { namespace attribute { + class ImpFillBitmapAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -48,26 +52,32 @@ namespace drawinglayer { class FillBitmapAttribute { - BitmapEx maBitmapEx; - basegfx::B2DPoint maTopLeft; - basegfx::B2DVector maSize; - - // bitfield - unsigned mbTiling : 1; + private: + ImpFillBitmapAttribute* mpFillBitmapAttribute; public: + /// constructors/assignmentoperator/destructor FillBitmapAttribute( const BitmapEx& rBitmapEx, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling); + FillBitmapAttribute(); + FillBitmapAttribute(const FillBitmapAttribute& rCandidate); + FillBitmapAttribute& operator=(const FillBitmapAttribute& rCandidate); + ~FillBitmapAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator bool operator==(const FillBitmapAttribute& rCandidate) const; - // data access - const BitmapEx& getBitmapEx() const { return maBitmapEx; } - const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } - const basegfx::B2DVector& getSize() const { return maSize; } - bool getTiling() const { return mbTiling; } + // data read access + const BitmapEx& getBitmapEx() const; + const basegfx::B2DPoint& getTopLeft() const; + const basegfx::B2DVector& getSize() const; + bool getTiling() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx new file mode 100644 index 000000000000..f7bddbfe0f89 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpFillGradientAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// +// declarations + +namespace drawinglayer +{ + namespace attribute + { + enum GradientStyle + { + GRADIENTSTYLE_LINEAR, + GRADIENTSTYLE_AXIAL, + GRADIENTSTYLE_RADIAL, + GRADIENTSTYLE_ELLIPTICAL, + GRADIENTSTYLE_SQUARE, + GRADIENTSTYLE_RECT + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class FillGradientAttribute + { + private: + ImpFillGradientAttribute* mpFillGradientAttribute; + + public: + /// constructors/assignmentoperator/destructor + FillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps); + FillGradientAttribute(); + FillGradientAttribute(const FillGradientAttribute& rCandidate); + FillGradientAttribute& operator=(const FillGradientAttribute& rCandidate); + ~FillGradientAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillGradientAttribute& rCandidate) const; + + // data read access + GradientStyle getStyle() const; + double getBorder() const; + double getOffsetX() const; + double getOffsetY() const; + double getAngle() const; + const basegfx::BColor& getStartColor() const; + const basegfx::BColor& getEndColor() const; + sal_uInt16 getSteps() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx new file mode 100644 index 000000000000..9f147b36ef34 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpFillHatchAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// +// declarations + +namespace drawinglayer +{ + namespace attribute + { + enum HatchStyle + { + HATCHSTYLE_SINGLE, + HATCHSTYLE_DOUBLE, + HATCHSTYLE_TRIPLE + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class FillHatchAttribute + { + private: + ImpFillHatchAttribute* mpFillHatchAttribute; + + public: + /// constructors/assignmentoperator/destructor + FillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground); + FillHatchAttribute(); + FillHatchAttribute(const FillHatchAttribute& rCandidate); + FillHatchAttribute& operator=(const FillHatchAttribute& rCandidate); + ~FillHatchAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillHatchAttribute& rCandidate) const; + + // data read access + HatchStyle getStyle() const; + double getDistance() const; + double getAngle() const; + const basegfx::BColor& getColor() const; + bool isFillBackground() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx index d565d8037800..6dffd80b332e 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx @@ -28,9 +28,16 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX -#include <sal/config.h> #include <sal/types.h> -#include <tools/string.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class String; + +namespace drawinglayer { namespace attribute { + class ImpFontAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -46,22 +53,11 @@ namespace drawinglayer class FontAttribute { private: - /// core data - String maFamilyName; // Font Family Name - String maStyleName; // Font Style Name - sal_uInt16 mnWeight; // Font weight - - /// bitfield - unsigned mbSymbol : 1; // Symbol Font Flag - unsigned mbVertical : 1; // Vertical Text Flag - unsigned mbItalic : 1; // Italic Flag - unsigned mbOutline : 1; // Outline Flag - unsigned mbRTL : 1; // RTL Flag - unsigned mbBiDiStrong : 1; // BiDi Flag - // TODO: pair kerning and CJK kerning + ImpFontAttribute* mpFontAttribute; public: - /// constructor + /// constructors/assignmentoperator/destructor + /// TODO: pair kerning and CJK kerning FontAttribute( const String& rFamilyName, const String& rStyleName, @@ -71,45 +67,28 @@ namespace drawinglayer bool bItalic = false, bool bOutline = false, bool bRTL = false, - bool bBiDiStrong = false) - : maFamilyName(rFamilyName), - maStyleName(rStyleName), - mnWeight(nWeight), - mbSymbol(bSymbol), - mbVertical(bVertical), - mbItalic(bItalic), - mbOutline(bOutline), - mbRTL(bRTL), - mbBiDiStrong(bBiDiStrong) - { - } + bool bBiDiStrong = false); + FontAttribute(); + FontAttribute(const FontAttribute& rCandidate); + FontAttribute& operator=(const FontAttribute& rCandidate); + ~FontAttribute(); - FontAttribute() - : maFamilyName(), - maStyleName(), - mnWeight(0), - mbSymbol(false), - mbVertical(false), - mbItalic(false), - mbOutline(false), - mbRTL(false), - mbBiDiStrong(false) - { - } + // checks if the incarnation is default constructed + bool isDefault() const; - /// compare operator - bool operator==(const FontAttribute& rCompare) const; + // compare operator + bool operator==(const FontAttribute& rCandidate) const; /// data read access - const String& getFamilyName() const { return maFamilyName; } - const String& getStyleName() const { return maStyleName; } - sal_uInt16 getWeight() const { return mnWeight; } - bool getSymbol() const { return mbSymbol; } - bool getVertical() const { return mbVertical; } - bool getItalic() const { return mbItalic; } - bool getOutline() const { return mbOutline; } - bool getRTL() const { return mbRTL; } - bool getBiDiStrong() const { return mbBiDiStrong; } + const String& getFamilyName() const; + const String& getStyleName() const; + sal_uInt16 getWeight() const; + bool getSymbol() const; + bool getVertical() const; + bool getItalic() const; + bool getOutline() const; + bool getRTL() const; + bool getBiDiStrong() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx index b541c2cf10df..4e29cf05e27f 100644 --- a/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx @@ -28,13 +28,19 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX -#include <basegfx/polygon/b2dlinegeometry.hxx> -#include <basegfx/color/bcolor.hxx> -#include <vector> +#include <basegfx/vector/b2enums.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpLineAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -44,50 +50,29 @@ namespace drawinglayer class LineAttribute { private: - basegfx::BColor maColor; // color - double mfWidth; // absolute line width - basegfx::B2DLineJoin meLineJoin; // type of LineJoin + ImpLineAttribute* mpLineAttribute; public: + /// constructors/assignmentoperator/destructor LineAttribute( const basegfx::BColor& rColor, double fWidth = 0.0, - basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND) - : maColor(rColor), - mfWidth(fWidth), - meLineJoin(aB2DLineJoin) - { - } - - LineAttribute(const LineAttribute& rCandidate) - { - *this = rCandidate; - } - - LineAttribute& operator=(const LineAttribute& rCandidate) - { - maColor = rCandidate.maColor; - mfWidth = rCandidate.mfWidth; - meLineJoin = rCandidate.meLineJoin; - return *this; - } + basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND); + LineAttribute(); + LineAttribute(const LineAttribute& rCandidate); + LineAttribute& operator=(const LineAttribute& rCandidate); + ~LineAttribute(); - ~LineAttribute() - { - } + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const LineAttribute& rCandidate) const - { - return (maColor == rCandidate.maColor - && mfWidth == rCandidate.mfWidth - && meLineJoin == rCandidate.meLineJoin); - } + bool operator==(const LineAttribute& rCandidate) const; - // data access - const basegfx::BColor& getColor() const { return maColor; } - double getWidth() const { return mfWidth; } - basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } + // data read access + const basegfx::BColor& getColor() const; + double getWidth() const; + basegfx::B2DLineJoin getLineJoin() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx index acd6f5ec4f64..9f681afc7d51 100644 --- a/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx @@ -28,12 +28,19 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/numeric/ftools.hxx> +#include <sal/types.h> ////////////////////////////////////////////////////////////////////////////// // predefines +namespace basegfx { + class B2DPolyPolygon; +} + +namespace drawinglayer { namespace attribute { + class ImpLineStartEndAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -43,35 +50,29 @@ namespace drawinglayer class LineStartEndAttribute { private: - double mfWidth; // absolute line StartEndGeometry base width - basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon - - // bitfield - unsigned mbCentered : 1; // use centered to ineStart/End point? + ImpLineStartEndAttribute* mpLineStartEndAttribute; public: + /// constructors/assignmentoperator/destructor LineStartEndAttribute( double fWidth, const basegfx::B2DPolyPolygon& rPolyPolygon, - bool bCentered) - : mfWidth(fWidth), - maPolyPolygon(rPolyPolygon), - mbCentered(bCentered) - { - } + bool bCentered); + LineStartEndAttribute(); + LineStartEndAttribute(const LineStartEndAttribute& rCandidate); + LineStartEndAttribute& operator=(const LineStartEndAttribute& rCandidate); + ~LineStartEndAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const LineStartEndAttribute& rCandidate) const - { - return (basegfx::fTools::equal(mfWidth, rCandidate.mfWidth) - && maPolyPolygon == rCandidate.maPolyPolygon - && mbCentered == rCandidate.mbCentered); - } + bool operator==(const LineStartEndAttribute& rCandidate) const; - // data access - double getWidth() const { return mfWidth; } - const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } - bool isCentered() const { return mbCentered; } + // data read access + double getWidth() const; + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const; + bool isCentered() const; bool isActive() const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx index 1d9adf2a5c9f..2bb2256ee559 100644 --- a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx @@ -54,7 +54,11 @@ namespace drawinglayer public: // constructors/destructor - MaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity); + MaterialAttribute3D( + const basegfx::BColor& rColor, + const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, + sal_uInt16 nSpecularIntensity); MaterialAttribute3D(const basegfx::BColor& rColor); MaterialAttribute3D(); MaterialAttribute3D(const MaterialAttribute3D& rCandidate); @@ -63,11 +67,13 @@ namespace drawinglayer // assignment operator MaterialAttribute3D& operator=(const MaterialAttribute3D& rCandidate); + // checks if the incarnation is default constructed + bool isDefault() const; + // compare operator bool operator==(const MaterialAttribute3D& rCandidate) const; - bool operator!=(const MaterialAttribute3D& rCandidate) const { return !operator==(rCandidate); } - // data access + // data read access const basegfx::BColor& getColor() const; const basegfx::BColor& getSpecular() const; const basegfx::BColor& getEmission() const; diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx index 6c23c7ca63a6..583a01915662 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx @@ -28,57 +28,53 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX +#include <sal/types.h> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> + ////////////////////////////////////////////////////////////////////////////// // predefines -namespace drawinglayer { namespace attribute { - class SdrLineAttribute; - class SdrFillAttribute; - class SdrLineStartEndAttribute; - class SdrShadowAttribute; - class FillGradientAttribute; -}} - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace attribute { - class SdrLineFillShadowAttribute + class SdrLineFillShadowAttribute3D { - // shadow, line, lineStartEnd, fill, transGradient and compound3D attributes - SdrShadowAttribute* mpShadow; // shadow attributes (if used) - SdrLineAttribute* mpLine; // line attributes (if used) - SdrLineStartEndAttribute* mpLineStartEnd; // line start end (if used) - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) + private: + const SdrLineAttribute maLine; + const SdrFillAttribute maFill; + const SdrLineStartEndAttribute maLineStartEnd; + const SdrShadowAttribute maShadow; + const FillGradientAttribute maFillFloatTransGradient; public: - SdrLineFillShadowAttribute( - SdrLineAttribute* pLine = 0, - SdrFillAttribute* pFill = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - FillGradientAttribute* pFillFloatTransGradient = 0); - ~SdrLineFillShadowAttribute(); + /// constructors/assignmentoperator/destructor + SdrLineFillShadowAttribute3D( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient); + SdrLineFillShadowAttribute3D(); - // copy constructor and assigment operator - SdrLineFillShadowAttribute(const SdrLineFillShadowAttribute& rCandidate); - SdrLineFillShadowAttribute& operator=(const SdrLineFillShadowAttribute& rCandidate); + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const SdrLineFillShadowAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpFill || mpLine); } + bool operator==(const SdrLineFillShadowAttribute3D& rCandidate) const; - // data access - const SdrShadowAttribute* getShadow() const { return mpShadow; } - const SdrLineAttribute* getLine() const { return mpLine; } - const SdrLineStartEndAttribute* getLineStartEnd() const { return mpLineStartEnd; } - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } + // data read access + const SdrLineAttribute& getLine() const { return maLine; } + const SdrFillAttribute& getFill() const { return maFill; } + const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; } + const SdrShadowAttribute& getShadow() const { return maShadow; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } }; } // end of namespace overlay } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx deleted file mode 100644 index 28421e3477b1..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx +++ /dev/null @@ -1,215 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX - -#include <basegfx/polygon/b2dlinegeometry.hxx> -#include <basegfx/color/bcolor.hxx> -#include <vector> -#include <basegfx/vector/b2dvector.hxx> - -////////////////////////////////////////////////////////////////////////////// -// predefines -class SdrTextObj; - -namespace drawinglayer { namespace attribute { - class SdrFillBitmapAttribute; - class FillHatchAttribute; - class FillGradientAttribute; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineAttribute - { - // line definitions - basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines - double mfWidth; // 1/100th mm, 0.0==hair - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // color of line - ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern - double mfFullDotDashLen; // sum of maDotDashArray (for convenience) - - public: - SdrLineAttribute( - basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, - const ::std::vector< double >& rDotDashArray, double fFullDotDashLen); - ~SdrLineAttribute(); - - // constructor to create a line attribute for a colored hairline - SdrLineAttribute(const basegfx::BColor& rColor); - - // compare operator - bool operator==(const SdrLineAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (1.0 != mfTransparence); } - bool isDashed() const { return (0L != maDotDashArray.size()); } - - // data access - basegfx::B2DLineJoin getJoin() const { return meJoin; } - double getWidth() const { return mfWidth; } - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } - double getFullDotDashLen() const { return mfFullDotDashLen; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineStartEndAttribute - { - // line arrow definitions - basegfx::B2DPolyPolygon maStartPolyPolygon; // start Line PolyPolygon - basegfx::B2DPolyPolygon maEndPolyPolygon; // end Line PolyPolygon - double mfStartWidth; // 1/100th mm - double mfEndWidth; // 1/100th mm - - // bitfield - unsigned mbStartActive : 1L; // start of Line is active - unsigned mbEndActive : 1L; // end of Line is active - unsigned mbStartCentered : 1L; // Line is centered on line start point - unsigned mbEndCentered : 1L; // Line is centered on line end point - - public: - SdrLineStartEndAttribute( - const basegfx::B2DPolyPolygon& rStartPolyPolygon, const basegfx::B2DPolyPolygon& rEndPolyPolygon, - double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered); - ~SdrLineStartEndAttribute(); - - // compare operator - bool operator==(const SdrLineStartEndAttribute& rCandidate) const; - - // bool access - bool isStartActive() const { return mbStartActive; } - bool isEndActive() const { return mbEndActive; } - bool isStartCentered() const { return mbStartCentered; } - bool isEndCentered() const { return mbEndCentered; } - bool isVisible() const { return (isStartActive() || isEndActive()); } - - // data access - const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; } - const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; } - double getStartWidth() const { return mfStartWidth; } - double getEndWidth() const { return mfEndWidth; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrShadowAttribute - { - // shadow definitions - basegfx::B2DVector maOffset; // shadow offset 1/100th mm - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // color of shadow - - public: - SdrShadowAttribute( - const basegfx::B2DVector& rOffset, double fTransparence, const basegfx::BColor& rColor); - ~SdrShadowAttribute(); - - // compare operator - bool operator==(const SdrShadowAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (1.0 != mfTransparence); } - - // data access - const basegfx::B2DVector& getOffset() const { return maOffset; } - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrFillAttribute - { - // fill definitions - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // fill color - FillGradientAttribute* mpGradient; // fill gradient (if used) - FillHatchAttribute* mpHatch; // fill hatch (if used) - SdrFillBitmapAttribute* mpBitmap; // fill bitmap (if used) - - public: - SdrFillAttribute( - double fTransparence, const basegfx::BColor& rColor, FillGradientAttribute* pGradient = 0L, - FillHatchAttribute* pHatch = 0L, SdrFillBitmapAttribute* pBitmap = 0L); - ~SdrFillAttribute(); - - // copy constructor and assigment operator - SdrFillAttribute(const SdrFillAttribute& rCandidate); - SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate); - - // compare operator - bool operator==(const SdrFillAttribute& rCandidate) const; - - // bool access - bool isGradient() const { return (0L != mpGradient); } - bool isHatch() const { return (0L != mpHatch); } - bool isBitmap() const { return (0L != mpBitmap); } - bool isColor() const { return (!mpGradient && !mpHatch && !mpBitmap); } - bool isVisible() const { return (1.0 != mfTransparence); } - - // data access - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - const FillGradientAttribute* getGradient() const { return mpGradient; } - const FillHatchAttribute* getHatch() const { return mpHatch; } - const SdrFillBitmapAttribute* getBitmap() const { return mpBitmap; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx deleted file mode 100644 index 3d88fe52d5c1..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx +++ /dev/null @@ -1,209 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX - -#include <basegfx/vector/b2dvector.hxx> -#include <com/sun/star/drawing/NormalsKind.hpp> -#include <com/sun/star/drawing/TextureProjectionMode.hpp> -#include <com/sun/star/drawing/ProjectionMode.hpp> -#include <com/sun/star/drawing/TextureKind2.hpp> -#include <com/sun/star/drawing/TextureMode.hpp> -#include <basegfx/vector/b3dvector.hxx> -#include <com/sun/star/drawing/ShadeMode.hpp> -#include <basegfx/color/bcolor.hxx> -#include <drawinglayer/attribute/materialattribute3d.hxx> -#include <vector> - -////////////////////////////////////////////////////////////////////////////// -// predefines - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class Sdr3DObjectAttribute - { - // 3D object attribute definitions - ::com::sun::star::drawing::NormalsKind maNormalsKind; // normals type (0..2) - ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2) - ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2) - ::com::sun::star::drawing::TextureKind2 maTextureKind; // texture kind (see uno API) - ::com::sun::star::drawing::TextureMode maTextureMode; // texture kind (see uno API) - MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity - - // bitfield - unsigned mbNormalsInvert : 1; // invert normals - unsigned mbDoubleSided : 1; // surfaces are double sided - unsigned mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene - unsigned mbTextureFilter : 1; // filter texture to make more smooth - unsigned mbReducedLineGeometry : 1; // use reduced line geometry (object specific) - - public: - Sdr3DObjectAttribute( - ::com::sun::star::drawing::NormalsKind aNormalsKind, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, - ::com::sun::star::drawing::TextureKind2 aTextureKind, - ::com::sun::star::drawing::TextureMode aTextureMode, - const MaterialAttribute3D& rMaterial, - bool bNormalsInvert, - bool bDoubleSided, - bool bShadow3D, - bool bTextureFilter, - bool bReducedLineGeometry); - - // compare operator - bool operator==(const Sdr3DObjectAttribute& rCandidate) const; - - // data access - ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; } - ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; } - ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; } - ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; } - ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; } - const MaterialAttribute3D& getMaterial() const { return maMaterial; } - bool getNormalsInvert() const { return mbNormalsInvert; } - bool getDoubleSided() const { return mbDoubleSided; } - bool getShadow3D() const { return mbShadow3D; } - bool getTextureFilter() const { return mbTextureFilter; } - bool getReducedLineGeometry() const { return mbReducedLineGeometry; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class Sdr3DLightAttribute - { - // 3D light attribute definitions - basegfx::BColor maColor; - basegfx::B3DVector maDirection; - - // bitfield - unsigned mbSpecular : 1; - - public: - Sdr3DLightAttribute( - const basegfx::BColor& rColor, - const basegfx::B3DVector& rDirection, - bool bSpecular); - - // compare operator - bool operator==(const Sdr3DLightAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getColor() const { return maColor; } - const basegfx::B3DVector& getDirection() const { return maDirection; } - bool getSpecular() const { return mbSpecular; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLightingAttribute - { - // 3D light attribute definitions - basegfx::BColor maAmbientLight; - ::std::vector< Sdr3DLightAttribute > maLightVector; - - public: - SdrLightingAttribute( - const basegfx::BColor& rAmbientLight, - const ::std::vector< Sdr3DLightAttribute >& rLightVector); - - // compare operator - bool operator==(const SdrLightingAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getAmbientLight() const { return maAmbientLight; } - const ::std::vector< Sdr3DLightAttribute >& getLightVector() const { return maLightVector; } - - // color model solver - basegfx::BColor solveColorModel( - const basegfx::B3DVector& rNormalInEyeCoordinates, - const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, - const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const; - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrSceneAttribute - { - // 3D scene attribute definitions - double mfDistance; - double mfShadowSlant; - ::com::sun::star::drawing::ProjectionMode maProjectionMode; - ::com::sun::star::drawing::ShadeMode maShadeMode; - - // bitfield - unsigned mbTwoSidedLighting : 1; - - public: - SdrSceneAttribute( - double fDistance, - double fShadowSlant, - ::com::sun::star::drawing::ProjectionMode aProjectionMode, - ::com::sun::star::drawing::ShadeMode aShadeMode, - bool bTwoSidedLighting); - - // compare operator - bool operator==(const SdrSceneAttribute& rCandidate) const; - - // data access - double getDistance() const { return mfDistance; } - double getShadowSlant() const { return mfShadowSlant; } - ::com::sun::star::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; } - ::com::sun::star::drawing::ShadeMode getShadeMode() const { return maShadeMode; } - bool getTwoSidedLighting() const { return mbTwoSidedLighting; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx new file mode 100644 index 000000000000..6ae2084d1d30 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrFillAttribute; + class FillGradientAttribute; + class FillHatchAttribute; + class SdrFillBitmapAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFillAttribute + { + private: + ImpSdrFillAttribute* mpSdrFillAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap); + SdrFillAttribute(); + SdrFillAttribute(const SdrFillAttribute& rCandidate); + SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate); + ~SdrFillAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrFillAttribute& rCandidate) const; + + // data read access + double getTransparence() const; + const basegfx::BColor& getColor() const; + const FillGradientAttribute& getGradient() const; + const FillHatchAttribute& getHatch() const; + const SdrFillBitmapAttribute& getBitmap() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx index e18ba2a51091..10408b477317 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx @@ -28,21 +28,23 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX -#include <vcl/bitmap.hxx> -#include <basegfx/vector/b2dvector.hxx> +#include <sal/types.h> ////////////////////////////////////////////////////////////////////////////// // predefines -class SfxItemSet; -namespace drawinglayer { namespace attribute { - class FillBitmapAttribute; -}} +class Bitmap; namespace basegfx { class B2DRange; + class B2DVector; } +namespace drawinglayer { namespace attribute { + class FillBitmapAttribute; + class ImpSdrFillBitmapAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -51,27 +53,42 @@ namespace drawinglayer { class SdrFillBitmapAttribute { - Bitmap maBitmap; - basegfx::B2DVector maSize; - basegfx::B2DVector maOffset; - basegfx::B2DVector maOffsetPosition; - basegfx::B2DVector maRectPoint; - - // bitfield - unsigned mbTiling : 1; - unsigned mbStretch : 1; - unsigned mbLogSize : 1; + private: + ImpSdrFillBitmapAttribute* mpSdrFillBitmapAttribute; public: + /// constructors/assignmentoperator/destructor SdrFillBitmapAttribute( - const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, - const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint, - bool bTiling, bool bStretch, bool bLogSize); + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize); + SdrFillBitmapAttribute(); + SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate); + SdrFillBitmapAttribute& operator=(const SdrFillBitmapAttribute& rCandidate); + ~SdrFillBitmapAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator bool operator==(const SdrFillBitmapAttribute& rCandidate) const; - // data access - const Bitmap& getBitmap() const { return maBitmap; } - bool getTiling() const { return mbTiling; } + // data read access + const Bitmap& getBitmap() const; + const basegfx::B2DVector& getSize() const; + const basegfx::B2DVector& getOffset() const; + const basegfx::B2DVector& getOffsetPosition() const; + const basegfx::B2DVector& getRectPoint() const; + bool getTiling() const; + bool getStretch() const; + bool getLogSize() const; + + // FillBitmapAttribute generator FillBitmapAttribute getFillBitmapAttribute(const basegfx::B2DRange& rRange) const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx new file mode 100644 index 000000000000..aad8c6ff62ec --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B3DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdr3DLightAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class Sdr3DLightAttribute + { + private: + ImpSdr3DLightAttribute* mpSdr3DLightAttribute; + + public: + // constructors/destructor + Sdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular); + Sdr3DLightAttribute(const basegfx::BColor& rColor); + Sdr3DLightAttribute(); + Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate); + ~Sdr3DLightAttribute(); + + // assignment operator + Sdr3DLightAttribute& operator=(const Sdr3DLightAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const Sdr3DLightAttribute& rCandidate) const; + + // data read access + const basegfx::BColor& getColor() const; + const basegfx::B3DVector& getDirection() const; + bool getSpecular() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx new file mode 100644 index 000000000000..b4c84d7cc1b0 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX + +#include <sal/types.h> +#include <vector> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B3DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLightingAttribute; + class Sdr3DLightAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLightingAttribute + { + private: + ImpSdrLightingAttribute* mpSdrLightingAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector); + SdrLightingAttribute(); + SdrLightingAttribute(const SdrLightingAttribute& rCandidate); + SdrLightingAttribute& operator=(const SdrLightingAttribute& rCandidate); + ~SdrLightingAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLightingAttribute& rCandidate) const; + + // data read access + const basegfx::BColor& getAmbientLight() const; + const ::std::vector< Sdr3DLightAttribute >& getLightVector() const; + + // color model solver + basegfx::BColor solveColorModel( + const basegfx::B3DVector& rNormalInEyeCoordinates, + const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx new file mode 100644 index 000000000000..5df511995e9f --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX + +#include <sal/types.h> +#include <basegfx/vector/b2enums.hxx> +#include <vector> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLineAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineAttribute + { + private: + ImpSdrLineAttribute* mpSdrLineAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen); + SdrLineAttribute(const basegfx::BColor& rColor); + SdrLineAttribute(); + SdrLineAttribute(const SdrLineAttribute& rCandidate); + SdrLineAttribute& operator=(const SdrLineAttribute& rCandidate); + ~SdrLineAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineAttribute& rCandidate) const; + + // data access + basegfx::B2DLineJoin getJoin() const; + double getWidth() const; + double getTransparence() const; + const basegfx::BColor& getColor() const; + const ::std::vector< double >& getDotDashArray() const; + double getFullDotDashLen() const; + + // bool access + bool isDashed() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx new file mode 100644 index 000000000000..76bd836ac770 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class B2DPolyPolygon; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLineStartEndAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineStartEndAttribute + { + private: + ImpSdrLineStartEndAttribute* mpSdrLineStartEndAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered); + SdrLineStartEndAttribute(); + SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate); + SdrLineStartEndAttribute& operator=(const SdrLineStartEndAttribute& rCandidate); + ~SdrLineStartEndAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineStartEndAttribute& rCandidate) const; + + // data read access + const basegfx::B2DPolyPolygon& getStartPolyPolygon() const; + const basegfx::B2DPolyPolygon& getEndPolyPolygon() const; + double getStartWidth() const; + double getEndWidth() const; + bool isStartActive() const; + bool isEndActive() const; + bool isStartCentered() const; + bool isEndCentered() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx new file mode 100644 index 000000000000..d5ee84e8cfec --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX + +#include <sal/types.h> +#include <com/sun/star/drawing/NormalsKind.hpp> +#include <com/sun/star/drawing/TextureProjectionMode.hpp> +#include <com/sun/star/drawing/TextureKind2.hpp> +#include <com/sun/star/drawing/TextureMode.hpp> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdr3DObjectAttribute; + class MaterialAttribute3D; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class Sdr3DObjectAttribute + { + private: + ImpSdr3DObjectAttribute* mpSdr3DObjectAttribute; + + public: + // constructors/destructor + Sdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry); + Sdr3DObjectAttribute(); + Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate); + ~Sdr3DObjectAttribute(); + + // assignment operator + Sdr3DObjectAttribute& operator=(const Sdr3DObjectAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const Sdr3DObjectAttribute& rCandidate) const; + + // data read access + ::com::sun::star::drawing::NormalsKind getNormalsKind() const; + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const; + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const; + ::com::sun::star::drawing::TextureKind2 getTextureKind() const; + ::com::sun::star::drawing::TextureMode getTextureMode() const; + const MaterialAttribute3D& getMaterial() const; + bool getNormalsInvert() const; + bool getDoubleSided() const; + bool getShadow3D() const; + bool getTextureFilter() const; + bool getReducedLineGeometry() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx new file mode 100644 index 000000000000..7b25b6c48666 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX + +#include <sal/types.h> +#include <com/sun/star/drawing/ProjectionMode.hpp> +#include <com/sun/star/drawing/ShadeMode.hpp> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdrSceneAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrSceneAttribute + { + private: + ImpSdrSceneAttribute* mpSdrSceneAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting); + SdrSceneAttribute(); + SdrSceneAttribute(const SdrSceneAttribute& rCandidate); + SdrSceneAttribute& operator=(const SdrSceneAttribute& rCandidate); + ~SdrSceneAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrSceneAttribute& rCandidate) const; + + // data read access + double getDistance() const; + double getShadowSlant() const; + ::com::sun::star::drawing::ProjectionMode getProjectionMode() const; + ::com::sun::star::drawing::ShadeMode getShadeMode() const; + bool getTwoSidedLighting() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx new file mode 100644 index 000000000000..72bdcd2af2c2 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B2DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrShadowAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrShadowAttribute + { + private: + ImpSdrShadowAttribute* mpSdrShadowAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor); + SdrShadowAttribute(); + SdrShadowAttribute(const SdrShadowAttribute& rCandidate); + SdrShadowAttribute& operator=(const SdrShadowAttribute& rCandidate); + ~SdrShadowAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrShadowAttribute& rCandidate) const; + + // data access + const basegfx::B2DVector& getOffset() const; + double getTransparence() const; + const basegfx::BColor& getColor() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx index 5b38e57a2432..0a8213c9bcf2 100644 --- a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx @@ -28,13 +28,16 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX -#include <basegfx/polygon/b2dlinegeometry.hxx> -#include <basegfx/color/bcolor.hxx> +#include <sal/types.h> #include <vector> ////////////////////////////////////////////////////////////////////////////// // predefines +namespace drawinglayer { namespace attribute { + class ImpStrokeAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -44,49 +47,26 @@ namespace drawinglayer class StrokeAttribute { private: - ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern - double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + ImpStrokeAttribute* mpStrokeAttribute; public: + /// constructors/assignmentoperator/destructor StrokeAttribute( const ::std::vector< double >& rDotDashArray, - double fFullDotDashLen = 0.0) - : maDotDashArray(rDotDashArray), - mfFullDotDashLen(fFullDotDashLen) - { - } - - StrokeAttribute() - : maDotDashArray(), - mfFullDotDashLen(0.0) - { - } - - StrokeAttribute(const StrokeAttribute& rCandidate) - { - *this = rCandidate; - } - - StrokeAttribute& operator=(const StrokeAttribute& rCandidate) - { - maDotDashArray = rCandidate.maDotDashArray; - mfFullDotDashLen = rCandidate.mfFullDotDashLen; - return *this; - } + double fFullDotDashLen = 0.0); + StrokeAttribute(); + StrokeAttribute(const StrokeAttribute& rCandidate); + StrokeAttribute& operator=(const StrokeAttribute& rCandidate); + ~StrokeAttribute(); - ~StrokeAttribute() - { - } + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const StrokeAttribute& rCandidate) const - { - return (mfFullDotDashLen == rCandidate.mfFullDotDashLen - && maDotDashArray == rCandidate.maDotDashArray); - } + bool operator==(const StrokeAttribute& rCandidate) const; - // data access - const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + // data read access + const ::std::vector< double >& getDotDashArray() const; double getFullDotDashLen() const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx index 45df570a108c..dd3bce88f25f 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx @@ -114,12 +114,18 @@ namespace drawinglayer */ ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); + /// default (empty) constructor + ViewInformation2D(); + /// copy constructor ViewInformation2D(const ViewInformation2D& rCandidate); /// destructor ~ViewInformation2D(); + // checks if the incarnation is default constructed + bool isDefault() const; + /// assignment operator ViewInformation2D& operator=(const ViewInformation2D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx index c09e89997761..5b37c5a2fe50 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx @@ -119,12 +119,18 @@ namespace drawinglayer */ ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); + /// default (empty) constructor + ViewInformation3D(); + /// copy constructor ViewInformation3D(const ViewInformation3D& rCandidate); /// destructor ~ViewInformation3D(); + // checks if the incarnation is default constructed + bool isDefault() const; + /// assignment operator ViewInformation3D& operator=(const ViewInformation3D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx deleted file mode 100644 index ca2be3acfd66..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX - -#include <drawinglayer/primitive2d/groupprimitive2d.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** AlphaPrimitive2D class - - This is the basic primitive for applying freely defined transparence - to freely defined content. The basic idea is to associate a content - which is defined as a sequence of primitives and hold as child content - in the GroupPrimitive2D with an alpha channel also defined as a sequence - of primitives and hold in the Alpha member. - - The basic definition is to use the Alpha content as Alpha-Mask by - interpreting the Alpha-content not as RGB, but as Luminance alpha mask - using the common RGB_to_luminance definition as e.g. used by VCL. - - The defining geometry is the Range of the child primitive sequence, - this means the renderers will/shall use this geometric information for - rendering, not the alpha one. The alpha one should/will be clipped - accordingly. - */ - class AlphaPrimitive2D : public GroupPrimitive2D - { - private: - /// The Alpha-Mask who's RGB-Values are interpreted as Luminance - Primitive2DSequence maAlpha; - - public: - /** constructor - - @param rChildren - The content which is defined to have a transparency. The - range of this primitive is defined by this content - - @param rAlpha - The definition of the Alpha-channel for this primitive. It - will be interpreted as mask by interpreting as gray values - using the common RGB_to_luminance definitions - */ - AlphaPrimitive2D( - const Primitive2DSequence& rChildren, - const Primitive2DSequence& rAlpha); - - /// data read access - const Primitive2DSequence& getAlpha() const { return maAlpha; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index 6b10badae989..8ef63d012780 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -102,14 +102,16 @@ namespace drawinglayer Current Basic 2D Primitives are: - - BitmapPrimitive2D (bitmap data, evtl. with alpha) - - MetafilePrimitive2D (VCL Metafile, currently no decomposition, but planned, so may vanish) + - BitmapPrimitive2D (bitmap data, evtl. with transparence) - PointArrayPrimitive2D (single points) - PolygonHairlinePrimitive2D (hairline curves/polygons) - PolyPolygonColorPrimitive2D (colored polygons) + UPDATE: MetafilePrimitive2D (VCL Metafile) is taken off this list since + it is implemented with the integration of CWS aw078 into DV300m69. + All other implemented primitives have a defined decomposition and can thus be - decomposed downt to this small set. + decomposed down to this small set. A renderer implementing support for this minimal set of primitives can completely render primitive-based visualisations. Of course, he also has to take states into account diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index fb4463977a01..7872ad825496 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -40,7 +40,7 @@ ////////////////////////////////////////////////////////////////////////////// // local primitives -#define PRIMITIVE2D_ID_ALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0) #define PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 1) #define PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 2) #define PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 3) @@ -75,7 +75,7 @@ #define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32) #define PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 33) #define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 34) -#define PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) +#define PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) #define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36) #define PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37) #define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38) @@ -93,14 +93,14 @@ #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) -#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54) -#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55) -#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56) -#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) -#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) -#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) -#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60) +#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) +#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54) +#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55) +#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56) +#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) +#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) +#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) +#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index a75f9861823c..868c5014cfde 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -29,7 +29,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 18d7995c9263..8b09540933ed 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -29,7 +29,8 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <basegfx/color/bcolor.hxx> ////////////////////////////////////////////////////////////////////////////// // FillHatchPrimitive2D class diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index 90fed88725cc..f8deb0903deb 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -66,7 +66,7 @@ namespace drawinglayer /// Grid color for single-pixel grid points basegfx::BColor maBColor; - /// The Bitmap (with alpha) for grid cross points + /// The Bitmap (with transparence) for grid cross points BitmapEx maCrossMarker; /** the last used object to view transformtion and the last Viewport, diff --git a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx index d529b363c9fa..0e95e7d15f2f 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx @@ -63,7 +63,7 @@ namespace drawinglayer Current Basic 2D StatePrimitives are: - - AlphaPrimitive2D (objects with freely defined transparence) + - TransparencePrimitive2D (objects with freely defined transparence) - InvertPrimitive2D (for XOR) - MaskPrimitive2D (for masking) - ModifiedColorPrimitive2D (for a stack of color modifications) diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx new file mode 100644 index 000000000000..08ddd8237688 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.hxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ + * + * 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/groupprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a PresObj's outline. To still be able to use primitives for HitTest + // functionality, the 2d decompositions will produce an as much as possible + // simplified line geometry encapsulated in this primtive when there is no + // line geometry. In a further enchanced version this may change to 'if neither + // filled nor lines' creation criteria. The whole primitive decomposes to nothing, + // so no one not knowing it will be influenced. Only helper processors for hit test + // (and maybe BoundRect extractors) will use it and it's children subcontent. + class HiddenGeometryPrimitive2D : public GroupPrimitive2D + { + public: + HiddenGeometryPrimitive2D(const Primitive2DSequence& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use hidden geometry, so + // the local implementation will return the children's range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// local decomposition. Implementation will return empty Primitive2DSequence + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx deleted file mode 100644 index 6561457b2ff8..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX - -#include <drawinglayer/primitive2d/groupprimitive2d.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** HitTestPrimitive2D class - - This primitive is used to represent geometry for non-visible objects, - e.g. a PresObj's outline. To still be able to use primitives for HitTest - functionality, the 2d decompositions will produce an as much as possible - simplified line geometry encapsulated in this primtive when there is no - line geometry. In a further enchanced version this may change to 'if neither - filled nor lines' creation criteria. The whole primitive decomposes to nothing, - so no one not knowing it will be influenced. Only helper processors for hit test - (and maybe BoundRect extractors) will use it and it's children subcontent. - */ - class HitTestPrimitive2D : public GroupPrimitive2D - { - public: - /// constructor - HitTestPrimitive2D(const Primitive2DSequence& rChildren); - - /** despite returning an empty decomposition since it's no visualisation data, - range calculation is intended to use invisible replacement geometry, so - the local implementation will return the children's range - */ - virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - - /** local decomposition. Implementation will return empty Primitive2DSequence - since this is no visualisation data - */ - virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index ef8d86ad1b09..b531d5a66f3d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer invariant, so that the bitmap is always visualized unscaled and unrotated. It is used e.g. for grid position visualisation. The given Bitmap - (with alpha) is defined to be visible centered at each of the given + (with transparence) is defined to be visible centered at each of the given positions. It decomposes to the needed number of BitmapPrimitive2D's, so it would be efficient to handle it directly in a renderer. diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx index 21f634fd0f5a..07ba73fd51f1 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx @@ -39,7 +39,7 @@ namespace drawinglayer { namespace primitive2d { - /** MediaPrimitive2D class + /** MetafilePrimitive2D class This is the MetaFile representing primitive. It's geometry is defined by MetaFileTransform. The content (defined by MetaFile) will be scaled diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index a761eaa09d49..80e281ede05c 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -33,6 +33,8 @@ #include <drawinglayer/attribute/strokeattribute.hxx> #include <drawinglayer/attribute/linestartendattribute.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/color/bcolor.hxx> ////////////////////////////////////////////////////////////////////////////// // PolygonHairlinePrimitive2D class diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index eaa2e37fea92..18743937b6bc 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -29,12 +29,14 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <drawinglayer/attribute/lineattribute.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> #include <drawinglayer/attribute/linestartendattribute.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <basegfx/color/bcolor.hxx> ////////////////////////////////////////////////////////////////////////////// // PolyPolygonHairlinePrimitive2D class @@ -401,7 +403,7 @@ namespace drawinglayer /** PolyPolygonBitmapPrimitive2D class This primitive defines a PolyPolygon filled with bitmap data - (including alpha). The decomosition will create a MaskPrimitive2D + (including transparence). The decomosition will create a MaskPrimitive2D containing a FillBitmapPrimitive2D. */ class PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 2f836aaf52cf..4c95972ca67d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -30,10 +30,12 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <drawinglayer/primitive3d/baseprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <drawinglayer/geometry/viewinformation3d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <vcl/bitmapex.hxx> +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightattribute3d.hxx> ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx new file mode 100644 index 000000000000..e27a3b2b7725 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrdecompositiontools3d.hxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * + * 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class B2DPolyPolygon; + class B2DHomMatrix; +} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // helpers to create HitTestPrimitives Line + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DHomMatrix& rMatrix); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolygon); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange, + const basegfx::B2DHomMatrix& rMatrix); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolygon, + const basegfx::B2DHomMatrix& rMatrix); + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index 86093e74abcb..3325e25dc913 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -93,20 +93,20 @@ namespace drawinglayer double getTextWidth( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const; + sal_uInt32 nIndex, + sal_uInt32 nLength) const; bool getTextOutlines( basegfx::B2DPolyPolygonVector&, const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength, - const ::std::vector< double >& rDXArray); + sal_uInt32 nIndex, + sal_uInt32 nLength, + const ::std::vector< double >& rDXArray) const; basegfx::B2DRange getTextBoundRect( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const; + sal_uInt32 nIndex, + sal_uInt32 nLength) const; double getFontAscent() const; double getFontDescent() const; @@ -115,7 +115,12 @@ namespace drawinglayer const Rectangle& rRectangle, const String& rText, sal_uInt16 nStyle, - GDIMetaFile& rGDIMetaFile); + GDIMetaFile& rGDIMetaFile) const; + + ::std::vector< double > getTextArray( + const String& rText, + sal_uInt32 nIndex, + sal_uInt32 nLength) const; }; } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx new file mode 100644 index 000000000000..85032d0bd202 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: alphaprimitive2d.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/groupprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** TransparencePrimitive2D class + + This is the basic primitive for applying freely defined transparence + to freely defined content. The basic idea is to associate a content + which is defined as a sequence of primitives and hold as child content + in the GroupPrimitive2D with a transparence channel also defined as a sequence + of primitives and hold in the transparence member. + + The basic definition is to use the transparence content as transparence-Mask by + interpreting the transparence-content not as RGB, but as Luminance transparence mask + using the common RGB_to_luminance definition as e.g. used by VCL. + + The defining geometry is the Range of the child primitive sequence, + this means the renderers will/shall use this geometric information for + rendering, not the transparent one. The transparent one should/will be clipped + accordingly. + */ + class TransparencePrimitive2D : public GroupPrimitive2D + { + private: + /// The transparence-Mask who's RGB-Values are interpreted as Luminance + Primitive2DSequence maTransparence; + + public: + /** constructor + + @param rChildren + The content which is defined to have a transparency. The + range of this primitive is defined by this content + + @param rTransparence + The definition of the Transparence-channel for this primitive. It + will be interpreted as mask by interpreting as gray values + using the common RGB_to_luminance definitions + */ + TransparencePrimitive2D( + const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTransparence); + + /// data read access + const Primitive2DSequence& getTransparence() const { return maTransparence; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx deleted file mode 100644 index 7b1daf1e0bc1..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX - -#include <drawinglayer/primitive2d/groupprimitive2d.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** UnifiedAlphaPrimitive2D class - - This primitive encapsualtes a child hierarchy and defines - that it shall be visualized with the given transparency. That - transparency is unique for all contained geometry, so that - e.g. overlapping polygons in the child geometry will not show - regions of combined transparency, but be all rendered with the - defined, single transparency. - */ - class UnifiedAlphaPrimitive2D : public GroupPrimitive2D - { - private: - /// the unified alpha transparence - double mfAlpha; - - public: - /// constructor - UnifiedAlphaPrimitive2D( - const Primitive2DSequence& rChildren, - double fAlpha); - - /// data read access - double getAlpha() const { return mfAlpha; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - - /// create decomposition - virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx new file mode 100644 index 000000000000..52f3747ddba2 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UnifiedTransparencePrimitive2D.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * + * 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/groupprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** UnifiedTransparencePrimitive2D class + + This primitive encapsualtes a child hierarchy and defines + that it shall be visualized with the given transparency. That + transparency is unique for all contained geometry, so that + e.g. overlapping polygons in the child geometry will not show + regions of combined transparency, but be all rendered with the + defined, single transparency. + */ + class UnifiedTransparencePrimitive2D : public GroupPrimitive2D + { + private: + /// the unified transparence + double mfTransparence; + + public: + /// constructor + UnifiedTransparencePrimitive2D( + const Primitive2DSequence& rChildren, + double fTransparence); + + /// data read access + double getTransparence() const { return mfTransparence; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// own getB2DRange implementation to include transparent geometries to BoundRect calculations + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// create decomposition + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx index 151f2d5ac7ca..71db55657b3b 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx @@ -37,25 +37,25 @@ ////////////////////////////////////////////////////////////////////////////// // local primitives -#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0) -#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1) -#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2) -#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3) -#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4) -#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5) -#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6) -#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7) -#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8) -#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9) -#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10) -#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11) -#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12) -#define PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13) -#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14) -#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15) -#define PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16) -#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17) -#define PRIMITIVE3D_ID_HITTESTPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18) +#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1) +#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2) +#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3) +#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4) +#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5) +#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6) +#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7) +#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8) +#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9) +#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10) +#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11) +#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12) +#define PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13) +#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14) +#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15) +#define PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16) +#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17) +#define PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx index 98790dfdefa3..a61c36b8bd8a 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx @@ -51,7 +51,7 @@ namespace drawinglayer - TexturePrimitive3D (with the following variations) - GradientTexturePrimitive3D (for 3D gradient fill) - BitmapTexturePrimitive3D (for 3D Bitmap fill) - - AlphaTexturePrimitive3D (for 3D transparence) + - TransparenceTexturePrimitive3D (for 3D transparence) - HatchTexturePrimitive3D (for 3D hatch fill) - TransformPrimitive3D (for a transformation stack) */ diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx index 6a38888b20ce..b986c12adad3 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx @@ -29,6 +29,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX #include <drawinglayer/primitive3d/textureprimitive3d.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx new file mode 100644 index 000000000000..287bfcc689e4 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.hxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ + * + * 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 INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX + +#include <drawinglayer/primitive3d/groupprimitive3d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive3d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a 3D cube without fill attributes. To still be able to use + // primitives for HitTest functionality, the 3d decompositions produce + // an as much as possible simplified fill geometry encapsulated in this + // primtive when there is no fill geometry. Currently, the 3d hit test + // uses only areas, so maybe in a further enchanced version this will change + // to 'if neither filled nor lines' creation criteria. The whole primitive + // decomposes to nothing, so no one not knowing it will be influenced. Only + // helper processors for hit test (and maybe BoundRect extractors) will + // use it and it's children subcontent. + class HiddenGeometryPrimitive3D : public GroupPrimitive3D + { + public: + HiddenGeometryPrimitive3D(const Primitive3DSequence& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use hidden geometry, so + // the local implementation will return the children's range + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; + + /// The default implementation returns an empty sequence + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx deleted file mode 100644 index 8b8776b2ff84..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX - -#include <drawinglayer/primitive3d/groupprimitive3d.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive3d - { - /** HitTestPrimitive3D class - - This primitive is used to represent geometry for non-visible objects, - e.g. a 3D cube without fill attributes. To still be able to use - primitives for HitTest functionality, the 3d decompositions produce - an as much as possible simplified fill geometry encapsulated in this - primtive when there is no fill geometry. Currently, the 3d hit test - uses only areas, so maybe in a further enchanced version this will change - to 'if neither filled nor lines' creation criteria. The whole primitive - decomposes to nothing, so no one not knowing it will be influenced. Only - helper processors for hit test (and maybe BoundRect extractors) will - use it and it's children subcontent. - */ - class HitTestPrimitive3D : public GroupPrimitive3D - { - public: - /// constructor - HitTestPrimitive3D(const Primitive3DSequence& rChildren); - - /** despite returning an empty decomposition since it's no visualisation data, - range calculation is intended to use invisible replacement geometry, so - the local implementation will return the children's range - */ - virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - - /** local decomposition. Implementation will return empty Primitive3DSequence - since this is no visualisation data - */ - virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive3DIDBlock() - }; - } // end of namespace primitive3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx index 843c805d9a5f..f1f680e11574 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx @@ -53,7 +53,7 @@ namespace drawinglayer SdrCubePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx index f04e4e28181d..4ccd863de69f 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx @@ -81,13 +81,20 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient = 0L); + const attribute::FillGradientAttribute& rFillGradient); Primitive3DSequence createShadowPrimitive3D( const Primitive3DSequence& rSource, const attribute::SdrShadowAttribute& rShadow, bool bShadow3D); - } // end of namespace overlay + + Primitive3DSequence createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute); + + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx index e4d580aa1229..254254a0055c 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx @@ -87,7 +87,7 @@ namespace drawinglayer SdrExtrudePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, double fDepth, diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx index fe342ba90896..28a483a5b5b2 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx @@ -101,7 +101,7 @@ namespace drawinglayer SdrLathePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, sal_uInt32 nHorizontalSegments, diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx index 29cf12edffc3..5c2a4e6b2575 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx @@ -62,7 +62,7 @@ namespace drawinglayer const basegfx::B3DPolyPolygon& rPolyPolygon3D, const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// data access diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx index 87c63142bd6e..fbef979d4b92 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx @@ -32,8 +32,8 @@ #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/vector/b2dvector.hxx> #include <drawinglayer/attribute/sdrallattribute3d.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx> +#include <drawinglayer/attribute/sdrobjectattribute3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -53,7 +53,7 @@ namespace drawinglayer /// object surface attributes basegfx::B3DHomMatrix maTransform; basegfx::B2DVector maTextureSize; - attribute::SdrLineFillShadowAttribute maSdrLFSAttribute; + attribute::SdrLineFillShadowAttribute3D maSdrLFSAttribute; attribute::Sdr3DObjectAttribute maSdr3DObjectAttribute; protected: @@ -72,13 +72,13 @@ namespace drawinglayer SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// data read access const basegfx::B3DHomMatrix& getTransform() const { return maTransform; } const basegfx::B2DVector& getTextureSize() const { return maTextureSize; } - const attribute::SdrLineFillShadowAttribute& getSdrLFSAttribute() const { return maSdrLFSAttribute; } + const attribute::SdrLineFillShadowAttribute3D& getSdrLFSAttribute() const { return maSdrLFSAttribute; } const attribute::Sdr3DObjectAttribute getSdr3DObjectAttribute() const { return maSdr3DObjectAttribute; } /// compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx index 880bb56e1ec9..510c29b4de07 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx @@ -58,7 +58,7 @@ namespace drawinglayer SdrSpherePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments); diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index 715ac6610be1..a2e57da2cf1a 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -29,9 +29,10 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX #include <drawinglayer/primitive3d/groupprimitive3d.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -83,13 +84,13 @@ namespace drawinglayer { namespace primitive3d { - /** UnifiedAlphaTexturePrimitive3D class + /** UnifiedTransparenceTexturePrimitive3D class This 3D primitive expands TexturePrimitive3D to a unified - alpha (transparence) texture definition. All 3D primitives + transparence texture definition. All 3D primitives embedded here will be shown with the given transparency. */ - class UnifiedAlphaTexturePrimitive3D : public TexturePrimitive3D + class UnifiedTransparenceTexturePrimitive3D : public TexturePrimitive3D { private: /// transparency definition @@ -97,7 +98,7 @@ namespace drawinglayer public: /// constructor - UnifiedAlphaTexturePrimitive3D( + UnifiedTransparenceTexturePrimitive3D( double fTransparence, const Primitive3DSequence& rChildren); @@ -107,6 +108,9 @@ namespace drawinglayer /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; + /// own getB3DRange implementation to include transparent geometries to BoundRect calculations + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; + /// local decomposition. virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; @@ -200,18 +204,18 @@ namespace drawinglayer { namespace primitive3d { - /** AlphaTexturePrimitive3D class + /** TransparenceTexturePrimitive3D class - This 3D primitive expands TexturePrimitive3D to a alpha texture - definition. For alpha definition, a gradient is used. The values in - that gradient will be interpreted as luminance Alpha-Values. All 3D + This 3D primitive expands TexturePrimitive3D to a transparence texture + definition. For transparence definition, a gradient is used. The values in + that gradient will be interpreted as luminance Transparence-Values. All 3D primitives embedded here will be shown with the defined transparence. */ - class AlphaTexturePrimitive3D : public GradientTexturePrimitive3D + class TransparenceTexturePrimitive3D : public GradientTexturePrimitive3D { public: /// constructor - AlphaTexturePrimitive3D( + TransparenceTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize); diff --git a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx index c3889463c1de..d93fb68c932c 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx @@ -37,30 +37,159 @@ namespace drawinglayer { namespace processor2d { + /** BaseProcessor2D class + + Baseclass for all C++ implementations of instances which process + primitives. + + Instances which process primitives can be renderers, but also stuff + for HitTests, BoundRect calculations and/or animation processing. The + main usage are renderers, but they are supposed to handle any primitive + processing. + + The base implementation is constructed with a ViewInformation2D which + is accessible throughout the processor implementations. The idea is + to construct any processor with a given ViewInformation2D. To be able + to handle primitives which need to change the current transformation + (as e.g. TransformPrimitive2D) it is allowed for the processor implementation + to change tis local value using updateViewInformation. + + The basic processing method is process(..) which gets handed over the + sequence of primitives to process. For convenience of the C++ implementations, + the default implementation of process(..) maps all accesses to primitives to + single calls to processBasePrimitive2D(..) where the primitive in question is + already casted to the C++ implementation class. + + The process(..) implementation makes a complete iteration over the given + sequence of primitives. If the Primitive is not derived from BasePrimitive2D + and thus not part of the C++ implementations, it converts ViewInformation2D + to the corresponding API implementation (an uno::Sequence< beans::PropertyValue >) + and recursively calls the method process(..) at the primitive with the decomposition + derived from that primitive. This is the preparation to handle unknown implementations + of the com::sun::star::graphic::XPrimitive2D interface in the future. + + So, to implement a basic processor, it is necessary to overload and implement the + processBasePrimitive2D(..) method. A minimal renderer has to support the + Basic Primitives (see baseprimitive2d.hxx) and the Grouping Primitives (see + groupprimitive2d.hxx). These are (currently): + + Basic Primitives: + + - BitmapPrimitive2D (bitmap data, evtl. with transparence) + - PointArrayPrimitive2D (single points) + - PolygonHairlinePrimitive2D (hairline curves/polygons) + - PolyPolygonColorPrimitive2D (colored polygons) + + Grouping Primitives: + + - TransparencePrimitive2D (objects with freely defined transparence) + - InvertPrimitive2D (for XOR) + - MaskPrimitive2D (for masking) + - ModifiedColorPrimitive2D (for a stack of color modifications) + - TransformPrimitive2D (for a transformation stack) + + A processor doing so is a minimal processor. Of course a processor may + handle any higher-level prmitive (that has a decomposition implementation) + for more direct data access or performance reasons, too. + + The main part of a processBasePrimitive2D implementation is a switch..case + construct, looking like the following: + + void foo::processBasePrimitive2D(const BasePrimitive2D& rCandidate) + { + switch(rCandidate.getPrimitive2DID()) + { + case PRIMITIVE2D_ID_??? : + { + // process PRIMITIVE2D_ID_??? here... + + ... + + break; + } + + ... + + default : + { + // process recursively + process(rCandidate.get2DDecomposition(getViewInformation2D())); + break; + } + } + } + + The default case makes the processor work with all complex primitives + by recursively using their decomposition. + + You can also add a case for ignoring primitives by using: + + case PRIMITIVE2D_ID_...IGNORE.A.. : + case PRIMITIVE2D_ID_...IGNORE.B.. : + case PRIMITIVE2D_ID_...IGNORE.C.. : + { + // ignore these primitives by neither processing nor + // recursively processing their decomposition + break; + } + + Another useful case is embedding the processing of a complex primitive by + bracketing it with some actions: + + case PRIMITIVE2D_ID_SOME_TEXT : + { + // encapsulate e.g. with changing local varibles, e.g. + // sometimes it's good to know if a basic primitive is + // part of a text, especially when not handling the text + // self but by purpose want to handle the decomposed + // geometries in the processor + startText(); + process(rCandidate.get2DDecomposition(getViewInformation2D())); + endText(); + break; + } + + As an example a processor collecting the outlines of a sequence of primitives + only needs to handle some Basic Primitives and create outline and collect + outline polygons e.g. for primitives with area like BitmapPrimitive2D (a + rectangle) and PolyPolygonColorPrimitive2D. When also handling the Grouping + Primitives MaskPrimitive2D (e.g. ignoring it's content, using the mask polyPolygon) + and TransformPrimitive2D (to have the correct local transformation), a processor + creating the outline can be written using just four (4) primitives. As a tipp, it can + be helpful to add many for the purpose not interesting higher level primitives + to not force their decomposition to be created and/or parsed. + */ class BaseProcessor2D { private: + /// The ViewInformation2D itself. It's private to isolate accesses to it geometry::ViewInformation2D maViewInformation2D; protected: + /* access method to allow the implementations to change the current + ViewInformation2D if needed. This allows isolating these accesses + later if needed + */ void updateViewInformation(const geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; } - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive2D-based. - // Default implementation does nothing + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive2D-based. + Default implementation does nothing + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: + /// constructor/destructor BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation); virtual ~BaseProcessor2D(); - // the central processing method + /// the central processing method virtual void process(const primitive2d::Primitive2DSequence& rSource); - // data access + /// data read access const geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; } }; } // end of namespace processor2d @@ -68,6 +197,44 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +namespace drawinglayer +{ + namespace processor2d + { + /** CollectingProcessor2D class + + A processor which just collects all primitives given to it in + process(..) calls to maPrimitive2DSequence. This can e.g. be used to + hand around as instance over various methods where every called + method can add graphic content to it. + */ + class CollectingProcessor2D : public BaseProcessor2D + { + private: + primitive2d::Primitive2DSequence maPrimitive2DSequence; + + public: + CollectingProcessor2D(const geometry::ViewInformation2D& rViewInformation); + virtual ~CollectingProcessor2D(); + + /// the central processing method + virtual void process(const primitive2d::Primitive2DSequence& rSource); + + /// helpers for adding to local sequence + void appendPrimitive2DReference(const primitive2d::Primitive2DReference& rSource) + { + primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, rSource); + } + + /// data access and reset + const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + void reset() { maPrimitive2DSequence = primitive2d::Primitive2DSequence(); } + }; + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + #endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX // eof diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx index e3a5bf0eb336..72ff97076a6c 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx @@ -56,10 +56,10 @@ namespace drawinglayer { namespace primitive2d { class MetafilePrimitive2D; class TextSimplePortionPrimitive2D; class BitmapPrimitive2D; - class AlphaPrimitive2D; + class TransparencePrimitive2D; class PolygonStrokePrimitive2D; class FillBitmapPrimitive2D; - class UnifiedAlphaPrimitive2D; + class UnifiedTransparencePrimitive2D; }} ////////////////////////////////////////////////////////////////////////////// @@ -68,6 +68,11 @@ namespace drawinglayer { namespace processor2d { + /** canvasProcessor2D class + + A basic implementation of a renderer for com::sun::star::rendering::XCanvas + as a target + */ class canvasProcessor2D : public BaseProcessor2D { private: @@ -103,10 +108,10 @@ namespace drawinglayer void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate); void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); - void impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate); + void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate); void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive); void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D); - void impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate); + void impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate); public: canvasProcessor2D( diff --git a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx index b65f7c63b721..9ec44d324187 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx @@ -38,13 +38,18 @@ namespace drawinglayer { namespace processor2d { + /** ContourExtractor2D class + + A processor who extracts the contour of the primtives feeded to it + in the single local PolyPolygon + */ class ContourExtractor2D : public BaseProcessor2D { private: - // the extracted contour + /// the extracted contour std::vector< basegfx::B2DPolyPolygon > maExtractedContour; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx index 9352b13c6cda..be0b40ff2139 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx @@ -43,29 +43,36 @@ namespace drawinglayer { namespace processor2d { + /** HitTestProcessor2D class + + This processor implements a HitTest with the feeded primitives, + given tolerance and extras + */ class HitTestProcessor2D : public BaseProcessor2D { private: - // discrete HitTest position + /// discrete HitTest position basegfx::B2DPoint maDiscreteHitPosition; - // discrete HitTolerance + /// discrete HitTolerance double mfDiscreteHitTolerance; - // bitfield + /// bitfield unsigned mbHit : 1; unsigned mbHitToleranceUsed : 1; - // this flag decides if primitives of type HitTestPrimitive2D - // will be taken into account for HitTesting or not. Those primitives - // are created for objects which are else completely invisible and normally - // their content exists of hairline primitives describing the object's contour - unsigned mbUseHitTestPrimitiveContent : 1; + /* this flag decides if primitives which are embedded to an + UnifiedTransparencePrimitive2D and are invisible will be taken into account for + HitTesting or not. Those primitives are created for objects which are else + completely invisible and normally their content exists of hairline + primitives describing the object's contour + */ + unsigned mbUseInvisiblePrimitiveContent : 1; - // flag to concentraze on text hits only + /// flag to concentraze on text hits only unsigned mbHitTextOnly : 1; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); bool checkHairlineHitWithTolerance( const basegfx::B2DPolygon& rPolygon, @@ -83,18 +90,18 @@ namespace drawinglayer bool bHitTextOnly); virtual ~HitTestProcessor2D(); - // data write access - void setUseHitTestPrimitiveContent(bool bNew) + /// data write access + void setUseInvisiblePrimitiveContent(bool bNew) { - if((bool)mbUseHitTestPrimitiveContent != bNew) mbUseHitTestPrimitiveContent = bNew; + if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew; } - // data read access + /// data read access const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; } double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; } bool getHit() const { return mbHit; } bool getHitToleranceUsed() const { return mbHitToleranceUsed; } - bool getUseHitTestPrimitiveContent() const { return mbUseHitTestPrimitiveContent;} + bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;} bool getHitTextOnly() const { return mbHitTextOnly; } }; } // end of namespace processor2d diff --git a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx index 0749d241e640..9ea9313c8743 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx @@ -37,16 +37,21 @@ namespace drawinglayer { namespace processor2d { + /** LineGeometryExtractor2D class + + This processor can extract the line geometry from feeded primpitives. The + hairlines and the fille geometry from fat lines are separated. + */ class LineGeometryExtractor2D : public BaseProcessor2D { private: std::vector< basegfx::B2DPolygon > maExtractedHairlines; std::vector< basegfx::B2DPolyPolygon > maExtractedLineFills; - // bitfield + /// bitfield unsigned mbInLineGeometry : 1; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx index 9dac85fe8955..2fa0bc47862c 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx @@ -40,7 +40,7 @@ namespace drawinglayer { namespace processor2d { - // helper data structure for returning the result + /// helper data structure for returning the result struct TextAsPolygonDataNode { private: @@ -65,9 +65,13 @@ namespace drawinglayer bool getIsFilled() const { return mbIsFilled; } }; - // typedef for a vector of that helper data + /// typedef for a vector of that helper data typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector; + /** TextAsPolygonExtractor2D class + + This processor extracts text in the feeded primitives to filled polygons + */ class TextAsPolygonExtractor2D : public BaseProcessor2D { private: diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index 21e8e2257d48..db5a70e9b4d7 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -39,6 +39,7 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class GDIMetaFile; class Rectangle; class Gradient; @@ -62,10 +63,22 @@ namespace drawinglayer { namespace processor2d { + /** VclMetafileProcessor2D class + + This processor derived from VclProcessor2D is the base class for rendering + all feeded primitives to a classical VCL-Metafile, including all over the + time grown extra data in comments and PDF exception data creations. Also + printing needs some exception stuff. + + All in all it is needed to emulate the old ::paint output from the old + Drawinglayer as long as exporters and/or filters still use the Metafile + and the extra-data added to it (which can be seen mostly as 'extensions' + or simply as 'hacks'). + */ class VclMetafileProcessor2D : public VclProcessor2D { private: - // local helper(s) + /// local helper(s) Rectangle impDumpToMetaFile( const primitive2d::Primitive2DSequence& rContent, GDIMetaFile& o_rContentMetafile); @@ -85,42 +98,47 @@ namespace drawinglayer void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); - // the current clipping PolyPolygon from MaskPrimitive2D + /// the current clipping PolyPolygon from MaskPrimitive2D basegfx::B2DPolyPolygon maClipPolyPolygon; - // the target MetaFile + /// the target MetaFile GDIMetaFile* mpMetaFile; - // do not allow embedding SvtGraphicFills into each other, - // use a counter to prevent that + /* do not allow embedding SvtGraphicFills into each other, + use a counter to prevent that + */ sal_uInt32 mnSvtGraphicFillCount; - // same for SvtGraphicStroke + /// same for SvtGraphicStroke sal_uInt32 mnSvtGraphicStrokeCount; - // hold the last unified transparence value to have it handy - // on SvtGraphicStroke creation + /* hold the last unified transparence value to have it handy + on SvtGraphicStroke creation + */ double mfCurrentUnifiedTransparence; - // break iterator support - // made static so it only needs to be fetched once, even with many single - // constructed VclMetafileProcessor2D. It's still incarnated on demand, - // but exists for OOo runtime now by purpose. + /* break iterator support + made static so it only needs to be fetched once, even with many single + constructed VclMetafileProcessor2D. It's still incarnated on demand, + but exists for OOo runtime now by purpose. + */ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator; - // vcl::PDFExtOutDevData support - // For the first step, some extra actions at vcl::PDFExtOutDevData need to - // be emulated with the VclMetafileProcessor2D. These are potentially temporarily - // since PDF export may use PrimitiveSequences one day directly. + /* vcl::PDFExtOutDevData support + For the first step, some extra actions at vcl::PDFExtOutDevData need to + be emulated with the VclMetafileProcessor2D. These are potentially temporarily + since PDF export may use PrimitiveSequences one day directly. + */ vcl::PDFExtOutDevData* mpPDFExtOutDevData; protected: - // the local processor for BasePrinitive2D-Implementation based primitives, - // called from the common process()-implementation + /* the local processor for BasePrinitive2D-Implementation based primitives, + called from the common process()-implementation + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: - // constructor/destructor + /// constructor/destructor VclMetafileProcessor2D( const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx index e9c052afad9e..a237f5d289d7 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx @@ -32,34 +32,39 @@ #include <vcl/outdev.hxx> ////////////////////////////////////////////////////////////////////////////// -// predefines - -////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace processor2d { + /** VclPixelProcessor2D class + + This processor derived from VclProcessor2D is the base class for rendering + all feeded primitives to a VCL Window. It is the currently used renderer + for all VCL editing output from the DrawingLayer. + */ class VclPixelProcessor2D : public VclProcessor2D { private: - // The Pixel renderer resets the original MapMode from the OutputDevice. - // For some situations it is necessary to get it again, so it is rescued here + /* The Pixel renderer resets the original MapMode from the OutputDevice. + For some situations it is necessary to get it again, so it is rescued here + */ MapMode maOriginalMapMode; protected: - // the local processor for BasePrinitive2D-Implementation based primitives, - // called from the common process()-implementation + /* the local processor for BasePrinitive2D-Implementation based primitives, + called from the common process()-implementation + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: - // constructor/destructor + /// constructor/destructor VclPixelProcessor2D( const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); virtual ~VclPixelProcessor2D(); - // data access + /// data read access const MapMode& getOriginalMapMode() const { return maOriginalMapMode; } }; } // end of namespace processor2d diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index 841ac2618756..9db84f3e7e0c 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -47,8 +47,8 @@ namespace drawinglayer { namespace primitive2d { class PolyPolygonColorPrimitive2D; class MetafilePrimitive2D; class MaskPrimitive2D; - class UnifiedAlphaPrimitive2D; - class AlphaPrimitive2D; + class UnifiedTransparencePrimitive2D; + class TransparencePrimitive2D; class TransformPrimitive2D; class MarkerArrayPrimitive2D; class PointArrayPrimitive2D; @@ -65,6 +65,11 @@ namespace drawinglayer { namespace processor2d { + /** VclProcessor2D class + + This processor is the base class for VCL-Based processors. It has no + processBasePrimitive2D implementation and thus is not usable directly. + */ class VclProcessor2D : public BaseProcessor2D { protected: @@ -99,8 +104,8 @@ namespace drawinglayer void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate); void RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate); - void RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate); - void RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate); + void RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate); + void RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate); void RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate); void RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate); void RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate); diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx index cd2cc2e6113f..6ed00c337ef3 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx @@ -37,6 +37,13 @@ namespace drawinglayer { namespace processor3d { + /** BaseProcessor3D class + + Baseclass for all C++ implementations of instances which process + primitives. + + Please have a look at baseprocessor2d.hxx for more comments. + */ class BaseProcessor3D { private: @@ -48,9 +55,10 @@ namespace drawinglayer maViewInformation3D = rViewInformation3D; } - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. - // Default implementation does nothing + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + Default implementation does nothing + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -72,6 +80,13 @@ namespace drawinglayer { namespace processor3d { + /** CollectingProcessor3D class + + A processor which just collects all primitives given to it in + process(..) calls to maPrimitive3DSequence. This can e.g. be used to + hand around as instance over various methods where every called + method can add graphic content to it. + */ class CollectingProcessor3D : public BaseProcessor3D { private: @@ -81,16 +96,16 @@ namespace drawinglayer CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation); virtual ~CollectingProcessor3D(); - // the central processing method + /// the central processing method virtual void process(const primitive3d::Primitive3DSequence& rSource); - // helpers for adding to local sequence + /// helpers for adding to local sequence void appendPrimitive3DReference(const primitive3d::Primitive3DReference& rSource) { primitive3d::appendPrimitive3DReferenceToPrimitive3DSequence(maPrimitive3DSequence, rSource); } - // data access and reset + /// data access and reset const primitive3d::Primitive3DSequence& getPrimitive3DSequence() const { return maPrimitive3DSequence; } void reset() { maPrimitive3DSequence = primitive3d::Primitive3DSequence(); } }; diff --git a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx index 12ebf023be2a..918634af5e35 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx @@ -36,26 +36,38 @@ namespace drawinglayer { namespace processor3d { + /** CutFindProcessor class + + This processor extracts all cuts of 3D plane geometries in the feeded primitives + with the given cut vector, based on the ViewInformation3D given. + */ class CutFindProcessor : public BaseProcessor3D { private: - // the start and stop point for the cut vector + /// the start and stop point for the cut vector basegfx::B3DPoint maFront; basegfx::B3DPoint maBack; - // the found cut points + /// the found cut points ::std::vector< basegfx::B3DPoint > maResult; - // #i102956# the transformation change from TransformPrimitive3D processings - // needs to be remembered to be able to transform found cuts to the - // basic coordinate system the processor starts with + /* #i102956# the transformation change from TransformPrimitive3D processings + needs to be remembered to be able to transform found cuts to the + basic coordinate system the processor starts with + */ basegfx::B3DHomMatrix maCombinedTransform; - // bitfield + /// bitfield bool mbAnyHit : 1; - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* this flag decides if primitives which are invisible will be taken into account for + HitTesting or not. + */ + bool mbUseInvisiblePrimitiveContent : 1; + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -64,9 +76,16 @@ namespace drawinglayer const basegfx::B3DPoint& rBack, bool bAnyHit); - // data access + /// data write access + void setUseInvisiblePrimitiveContent(bool bNew) + { + if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew; + } + + /// data read access const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } bool getAnyHit() const { return mbAnyHit; } + bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;} }; } // end of namespace processor3d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx index 0b8c1bb413a9..af8de431f191 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -33,9 +33,11 @@ #include <basegfx/range/b2drange.hxx> #include <basegfx/color/bcolormodifier.hxx> #include <svtools/optionsdrawinglayer.hxx> +#include <boost/shared_ptr.hpp> ////////////////////////////////////////////////////////////////////////////// // predefines + namespace basegfx { class BZPixelRaster; class B3DPolygon; @@ -68,35 +70,49 @@ namespace drawinglayer { namespace processor3d { + /** DefaultProcessor3D class + + This processor renders all feeded primitives to a 2D raster where for all + primitives the two basic methods rasterconvertB3DPolygon for hairlines and + rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to + e.g. base a Z-Buffer supported renderer on the 3D primitive processing. + */ class DefaultProcessor3D : public BaseProcessor3D { protected: - // render information - const attribute::SdrSceneAttribute& mrSdrSceneAttribute; // read-only scene infos (normal handling, etc...) - const attribute::SdrLightingAttribute& mrSdrLightingAttribute; // read-only light infos (lights, etc...) + /// read-only scene infos (normal handling, etc...) + const attribute::SdrSceneAttribute& mrSdrSceneAttribute; + + /// read-only light infos (lights, etc...) + const attribute::SdrLightingAttribute& mrSdrLightingAttribute; - // renderer range. Need to be correctly set by the derived implementations - basegfx::B2DRange maRasterRange; // the (0, 0, W, H) range from mpBZPixelRaster + /// renderer range. Need to be correctly set by the derived implementations + /// normally the (0, 0, W, H) range from mpBZPixelRaster + basegfx::B2DRange maRasterRange; - // the modifiedColorPrimitive stack + /// the modifiedColorPrimitive stack basegfx::BColorModifierStack maBColorModifierStack; - // the current active texture - texture::GeoTexSvx* mpGeoTexSvx; + /// the current active texture + boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx; - // the current active transparence texture - texture::GeoTexSvx* mpTransparenceGeoTexSvx; + /// the current active transparence texture + boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx; - // SvtOptionsDrawinglayer incarnation to react on diverse settings + /// SvtOptionsDrawinglayer incarnation to react on diverse settings const SvtOptionsDrawinglayer maDrawinglayerOpt; - // bitfield + /// counter for entered transparence textures + sal_uInt32 mnTransparenceCounter; + + /// bitfield unsigned mbModulate : 1; unsigned mbFilter : 1; unsigned mbSimpleTextureActive : 1; ////////////////////////////////////////////////////////////////////////////// // rendering support + void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence); void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive); void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive); @@ -108,6 +124,7 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons. These NEED to be // implemented from derivations + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0; @@ -121,19 +138,20 @@ namespace drawinglayer const attribute::SdrLightingAttribute& rSdrLightingAttribute); virtual ~DefaultProcessor3D(); - // data read access + /// data read access const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; } const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; } - // data read access renderer stuff + /// data read access renderer stuff const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } - const texture::GeoTexSvx* getGeoTexSvx() const { return mpGeoTexSvx; } - const texture::GeoTexSvx* getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; } bool getModulate() const { return mbModulate; } bool getFilter() const { return mbFilter; } bool getSimpleTextureActive() const { return mbSimpleTextureActive; } - // access to Drawinglayer configuration options + /// access to Drawinglayer configuration options const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; } }; } // end of namespace processor3d diff --git a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx index 51cbbe15e68d..f07eaa5c245c 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx @@ -40,20 +40,27 @@ namespace drawinglayer { namespace processor3d { + /** Geometry2DExtractingProcessor class + + This processor extracts the 2D geometry (projected geometry) of all feeded primitives. + It is e.g. used as sub-processor for contour extraction where 3D geometry is only + useful as 2D projected geometry. + */ class Geometry2DExtractingProcessor : public BaseProcessor3D { private: - // result holding vector (2D) + /// result holding vector (2D) primitive2d::Primitive2DSequence maPrimitive2DSequence; - // object transformation for scene for 2d definition + /// object transformation for scene for 2d definition basegfx::B2DHomMatrix maObjectTransformation; - // the modifiedColorPrimitive stack + /// the modifiedColorPrimitive stack basegfx::BColorModifierStack maBColorModifierStack; - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -61,7 +68,7 @@ namespace drawinglayer const geometry::ViewInformation3D& rViewInformation, const basegfx::B2DHomMatrix& rObjectTransformation); - // data access + // data read access const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx index 5f5396f23baf..23d8e7edd913 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx @@ -44,17 +44,24 @@ namespace drawinglayer { namespace processor3d { + /** Shadow3DExtractingProcessor class + + This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives. + It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite + some data to do so since we do not only offer flat projected 2D shadow, but also projections + dependent on the light source + */ class Shadow3DExtractingProcessor : public BaseProcessor3D { private: - // result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) + /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) primitive2d::Primitive2DSequence maPrimitive2DSequence; primitive2d::Primitive2DSequence* mpPrimitive2DSequence; - // object transformation for scene for 2d definition + /// object transformation for scene for 2d definition basegfx::B2DHomMatrix maObjectTransformation; - // prepared data (transformations) for 2D/3D shadow calculations + /// prepared data (transformations) for 2D/3D shadow calculations basegfx::B3DHomMatrix maWorldToEye; basegfx::B3DHomMatrix maEyeToView; basegfx::B3DVector maLightNormal; @@ -62,26 +69,28 @@ namespace drawinglayer basegfx::B3DPoint maPlanePoint; double mfLightPlaneScalar; - // the shadow color used for sub-primitives. Can stay at black since - // the encapsulating 2d shadow primitive will contain the color + /* the shadow color used for sub-primitives. Can stay at black since + the encapsulating 2d shadow primitive will contain the color + */ basegfx::BColor maPrimitiveColor; - // bitfield - // flag if shadow plane projection preparation leaded to valid results + /// bitfield + /// flag if shadow plane projection preparation leaded to valid results unsigned mbShadowProjectionIsValid : 1; - // flag if conversion is switched on + /// flag if conversion is switched on unsigned mbConvert : 1; - // flag if conversion shall use projection + /// flag if conversion shall use projection unsigned mbUseProjection : 1; - // helpers + /// local helpers basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource); basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource); - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -92,7 +101,7 @@ namespace drawinglayer double fShadowSlant, const basegfx::B3DRange& rContained3DRange); - // data access + /// data read access const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx index c7d10bdfc690..aefeddbb38a9 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -50,6 +50,7 @@ namespace drawinglayer { } class ZBufferRasterConverter3D; +class RasterPrimitive3D; ////////////////////////////////////////////////////////////////////////////// @@ -57,37 +58,40 @@ namespace drawinglayer { namespace processor3d { + /** ZBufferProcessor3D class + + This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D + raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle + transparent content. + */ class ZBufferProcessor3D : public DefaultProcessor3D { private: - // the raster target, a Z-Buffer + /// the raster target, a Z-Buffer basegfx::BZPixelRaster* mpBZPixelRaster; - // inverse of EyeToView for rasterconversion with evtl. Phong shading + /// inverse of EyeToView for rasterconversion with evtl. Phong shading basegfx::B3DHomMatrix maInvEyeToView; - // The raster converter for Z-Buffer + /// The raster converter for Z-Buffer ZBufferRasterConverter3D* mpZBufferRasterConverter3D; - // AA value. Defines how many oversmples will be used in X and Y. Values 0, 1 - // will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + /* AA value. Defines how many oversmples will be used in X and Y. Values 0, 1 + will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + */ sal_uInt16 mnAntiAlialize; - // bitfield - // a combination of bools to allow two-pass rendering to render - // the transparent parts in the 2nd run (if any) as needed for Z-Buffer - unsigned mbProcessTransparent : 1; - unsigned mbContainsTransparent : 1; - + /* remembered RasterPrimitive3D's which need to be painted back to front + for transparent 3D parts + */ + std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds; ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const; - // the processing method for a single, known primitive - virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive); - public: ZBufferProcessor3D( const geometry::ViewInformation3D& rViewInformation3D, @@ -100,14 +104,9 @@ namespace drawinglayer sal_uInt16 nAntiAlialize); virtual ~ZBufferProcessor3D(); - // helpers for drawing transparent parts in 2nd run. To use this - // processor, call processNonTransparent and then processTransparent - // with the same primitives. The 2nd call will only do something, - // when transparent parts are contained - void processNonTransparent(const primitive3d::Primitive3DSequence& rSource); - void processTransparent(const primitive3d::Primitive3DSequence& rSource); + void finish(); - // get the result as bitmapEx + /// get the result as bitmapEx BitmapEx getBitmapEx() const; }; } // end of namespace processor3d diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index ee5b96d98a03..7ae13f8ebe33 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -8,7 +8,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx -..\inc\drawinglayer\primitive2d\alphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\alphaprimitive2d.hxx +..\inc\drawinglayer\primitive2d\transparenceprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transparenceprimitive2d.hxx ..\inc\drawinglayer\primitive2d\animatedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\animatedprimitive2d.hxx ..\inc\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx ..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx @@ -24,7 +24,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\gridprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\gridprimitive2d.hxx ..\inc\drawinglayer\primitive2d\groupprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\groupprimitive2d.hxx ..\inc\drawinglayer\primitive2d\helplineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\helplineprimitive2d.hxx -..\inc\drawinglayer\primitive2d\hittestprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hittestprimitive2d.hxx +..\inc\drawinglayer\primitive2d\hiddengeometryprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hiddengeometryprimitive2d.hxx ..\inc\drawinglayer\primitive2d\invertprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\invertprimitive2d.hxx ..\inc\drawinglayer\primitive2d\markerarrayprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\markerarrayprimitive2d.hxx ..\inc\drawinglayer\primitive2d\maskprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\maskprimitive2d.hxx @@ -36,6 +36,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\polygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\polypolygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polypolygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\primitivetools2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\primitivetools2d.hxx +..\inc\drawinglayer\primitive2d\sdrdecompositiontools2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sdrdecompositiontools2d.hxx ..\inc\drawinglayer\primitive2d\sceneprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sceneprimitive2d.hxx ..\inc\drawinglayer\primitive2d\shadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\shadowprimitive2d.hxx ..\inc\drawinglayer\primitive2d\structuretagprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\structuretagprimitive2d.hxx @@ -46,7 +47,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx ..\inc\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx ..\inc\drawinglayer\primitive2d\transformprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transformprimitive2d.hxx -..\inc\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx +..\inc\drawinglayer\primitive2d\unifiedtransparenceprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedtransparenceprimitive2d.hxx ..\inc\drawinglayer\primitive2d\wrongspellprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\wrongspellprimitive2d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d @@ -54,7 +55,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d ..\inc\drawinglayer\primitive3d\baseprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\baseprimitive3d.hxx ..\inc\drawinglayer\primitive3d\groupprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\groupprimitive3d.hxx ..\inc\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx -..\inc\drawinglayer\primitive3d\hittestprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hittestprimitive3d.hxx +..\inc\drawinglayer\primitive2d\hiddengeometryprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hiddengeometryprimitive3d.hxx ..\inc\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx ..\inc\drawinglayer\primitive3d\polygonprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygonprimitive3d.hxx ..\inc\drawinglayer\primitive3d\polygontubeprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygontubeprimitive3d.hxx @@ -97,13 +98,20 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d ..\inc\drawinglayer\processor3d\tbufferprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\tbufferprocessor3d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\attribute -..\inc\drawinglayer\attribute\fillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillattribute.hxx +..\inc\drawinglayer\attribute\fillgradientattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillgradientattribute.hxx +..\inc\drawinglayer\attribute\fillhatchattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillhatchattribute.hxx ..\inc\drawinglayer\attribute\fillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillbitmapattribute.hxx ..\inc\drawinglayer\attribute\fontattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fontattribute.hxx ..\inc\drawinglayer\attribute\materialattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\materialattribute3d.hxx ..\inc\drawinglayer\attribute\sdrallattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrallattribute3d.hxx -..\inc\drawinglayer\attribute\sdrattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute.hxx -..\inc\drawinglayer\attribute\sdrattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlineattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlineattribute.hxx +..\inc\drawinglayer\attribute\sdrlinestartendattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlinestartendattribute.hxx +..\inc\drawinglayer\attribute\sdrshadowattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrshadowattribute.hxx +..\inc\drawinglayer\attribute\sdrfillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrfillattribute.hxx +..\inc\drawinglayer\attribute\sdrobjectattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrobjectattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlightattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlightattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlightingattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlightingattribute3d.hxx +..\inc\drawinglayer\attribute\sdrsceneattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrsceneattribute3d.hxx ..\inc\drawinglayer\attribute\sdrfillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrfillbitmapattribute.hxx ..\inc\drawinglayer\attribute\strokeattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\strokeattribute.hxx ..\inc\drawinglayer\attribute\lineattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\lineattribute.hxx diff --git a/drawinglayer/source/attribute/fillattribute.cxx b/drawinglayer/source/attribute/fillattribute.cxx deleted file mode 100644 index 17829d81f761..000000000000 --- a/drawinglayer/source/attribute/fillattribute.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include <drawinglayer/attribute/fillattribute.hxx> -#include <basegfx/numeric/ftools.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - FillGradientAttribute::FillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, double fAngle, - const basegfx::BColor& rStartColor, const basegfx::BColor& rEndColor, sal_uInt16 nSteps) - : maStartColor(rStartColor), - maEndColor(rEndColor), - mfBorder(fBorder), - mfOffsetX(fOffsetX), - mfOffsetY(fOffsetY), - mfAngle(fAngle), - meStyle(eStyle), - mnSteps(nSteps) - { - } - - bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const - { - return (meStyle == rCandidate.meStyle - && maStartColor == rCandidate.maStartColor - && maEndColor == rCandidate.maEndColor - && mfBorder == rCandidate.mfBorder - && mfOffsetX == rCandidate.mfOffsetX - && mfOffsetY == rCandidate.mfOffsetY - && mfAngle == rCandidate.mfAngle - && mnSteps == rCandidate.mnSteps); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - FillHatchAttribute::FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor& rColor, bool bFillBackground) - : mfDistance(fDistance), - mfAngle(fAngle), - maColor(rColor), - meStyle(eStyle), - mbFillBackground(bFillBackground) - { - } - - bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const - { - return (meStyle == rCandidate.meStyle - && mfDistance == rCandidate.mfDistance - && mfAngle == rCandidate.mfAngle - && maColor == rCandidate.maColor - && mbFillBackground == rCandidate.mbFillBackground); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/fillbitmapattribute.cxx b/drawinglayer/source/attribute/fillbitmapattribute.cxx index 9dd6802babe0..34927a3a746c 100644 --- a/drawinglayer/source/attribute/fillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx @@ -29,6 +29,7 @@ #include "precompiled_drawinglayer.hxx" #include <drawinglayer/attribute/fillbitmapattribute.hxx> +#include <vcl/bitmapex.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -36,25 +37,161 @@ namespace drawinglayer { namespace attribute { + class ImpFillBitmapAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + BitmapEx maBitmapEx; + basegfx::B2DPoint maTopLeft; + basegfx::B2DVector maSize; + + // bitfield + unsigned mbTiling : 1; + + ImpFillBitmapAttribute( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rTopLeft, + const basegfx::B2DVector& rSize, + bool bTiling) + : mnRefCount(0), + maBitmapEx(rBitmapEx), + maTopLeft(rTopLeft), + maSize(rSize), + mbTiling(bTiling) + { + } + + bool operator==(const ImpFillBitmapAttribute& rCandidate) const + { + return (maBitmapEx == rCandidate.maBitmapEx + && maTopLeft == rCandidate.maTopLeft + && maSize == rCandidate.maSize + && mbTiling == rCandidate.mbTiling); + } + + // data read access + const BitmapEx& getBitmapEx() const { return maBitmapEx; } + const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } + const basegfx::B2DVector& getSize() const { return maSize; } + bool getTiling() const { return mbTiling; } + + static ImpFillBitmapAttribute* get_global_default() + { + static ImpFillBitmapAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillBitmapAttribute( + BitmapEx(), + basegfx::B2DPoint(), + basegfx::B2DVector(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + FillBitmapAttribute::FillBitmapAttribute( const BitmapEx& rBitmapEx, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling) - : maBitmapEx(rBitmapEx), - maTopLeft(rTopLeft), - maSize(rSize), - mbTiling(bTiling) + : mpFillBitmapAttribute(new ImpFillBitmapAttribute( + rBitmapEx, rTopLeft, rSize, bTiling)) { } + FillBitmapAttribute::FillBitmapAttribute() + : mpFillBitmapAttribute(ImpFillBitmapAttribute::get_global_default()) + { + mpFillBitmapAttribute->mnRefCount++; + } + + FillBitmapAttribute::FillBitmapAttribute(const FillBitmapAttribute& rCandidate) + : mpFillBitmapAttribute(rCandidate.mpFillBitmapAttribute) + { + mpFillBitmapAttribute->mnRefCount++; + } + + FillBitmapAttribute::~FillBitmapAttribute() + { + if(mpFillBitmapAttribute->mnRefCount) + { + mpFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpFillBitmapAttribute; + } + } + + bool FillBitmapAttribute::isDefault() const + { + return mpFillBitmapAttribute == ImpFillBitmapAttribute::get_global_default(); + } + + FillBitmapAttribute& FillBitmapAttribute::operator=(const FillBitmapAttribute& rCandidate) + { + if(rCandidate.mpFillBitmapAttribute != mpFillBitmapAttribute) + { + if(mpFillBitmapAttribute->mnRefCount) + { + mpFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpFillBitmapAttribute; + } + + mpFillBitmapAttribute = rCandidate.mpFillBitmapAttribute; + mpFillBitmapAttribute->mnRefCount++; + } + + return *this; + } + bool FillBitmapAttribute::operator==(const FillBitmapAttribute& rCandidate) const { - return (getBitmapEx() == rCandidate.getBitmapEx() - && getTopLeft() == rCandidate.getTopLeft() - && getSize() == rCandidate.getSize() - && getTiling() == rCandidate.getTiling()); + if(rCandidate.mpFillBitmapAttribute == mpFillBitmapAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillBitmapAttribute == *mpFillBitmapAttribute); + } + + const BitmapEx& FillBitmapAttribute::getBitmapEx() const + { + return mpFillBitmapAttribute->getBitmapEx(); } + + const basegfx::B2DPoint& FillBitmapAttribute::getTopLeft() const + { + return mpFillBitmapAttribute->getTopLeft(); + } + + const basegfx::B2DVector& FillBitmapAttribute::getSize() const + { + return mpFillBitmapAttribute->getSize(); + } + + bool FillBitmapAttribute::getTiling() const + { + return mpFillBitmapAttribute->getTiling(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx new file mode 100644 index 000000000000..17e0cd6c098b --- /dev/null +++ b/drawinglayer/source/attribute/fillgradientattribute.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.cxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <basegfx/color/bcolor.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpFillGradientAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + GradientStyle meStyle; + double mfBorder; + double mfOffsetX; + double mfOffsetY; + double mfAngle; + basegfx::BColor maStartColor; + basegfx::BColor maEndColor; + sal_uInt16 mnSteps; + + ImpFillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps) + : mnRefCount(0), + meStyle(eStyle), + mfBorder(fBorder), + mfOffsetX(fOffsetX), + mfOffsetY(fOffsetY), + mfAngle(fAngle), + maStartColor(rStartColor), + maEndColor(rEndColor), + mnSteps(nSteps) + { + } + + // data read access + GradientStyle getStyle() const { return meStyle; } + double getBorder() const { return mfBorder; } + double getOffsetX() const { return mfOffsetX; } + double getOffsetY() const { return mfOffsetY; } + double getAngle() const { return mfAngle; } + const basegfx::BColor& getStartColor() const { return maStartColor; } + const basegfx::BColor& getEndColor() const { return maEndColor; } + sal_uInt16 getSteps() const { return mnSteps; } + + bool operator==(const ImpFillGradientAttribute& rCandidate) const + { + return (getStyle() == rCandidate.getStyle() + && getBorder() == rCandidate.getBorder() + && getOffsetX() == rCandidate.getOffsetX() + && getOffsetY() == rCandidate.getOffsetY() + && getAngle() == rCandidate.getAngle() + && getStartColor() == rCandidate.getStartColor() + && getEndColor() == rCandidate.getEndColor() + && getSteps() == rCandidate.getSteps()); + } + + static ImpFillGradientAttribute* get_global_default() + { + static ImpFillGradientAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillGradientAttribute( + GRADIENTSTYLE_LINEAR, + 0.0, 0.0, 0.0, 0.0, + basegfx::BColor(), + basegfx::BColor(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FillGradientAttribute::FillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps) + : mpFillGradientAttribute(new ImpFillGradientAttribute( + eStyle, fBorder, fOffsetX, fOffsetY, fAngle, rStartColor, rEndColor, nSteps)) + { + } + + FillGradientAttribute::FillGradientAttribute() + : mpFillGradientAttribute(ImpFillGradientAttribute::get_global_default()) + { + mpFillGradientAttribute->mnRefCount++; + } + + FillGradientAttribute::FillGradientAttribute(const FillGradientAttribute& rCandidate) + : mpFillGradientAttribute(rCandidate.mpFillGradientAttribute) + { + mpFillGradientAttribute->mnRefCount++; + } + + FillGradientAttribute::~FillGradientAttribute() + { + if(mpFillGradientAttribute->mnRefCount) + { + mpFillGradientAttribute->mnRefCount--; + } + else + { + delete mpFillGradientAttribute; + } + } + + bool FillGradientAttribute::isDefault() const + { + return mpFillGradientAttribute == ImpFillGradientAttribute::get_global_default(); + } + + FillGradientAttribute& FillGradientAttribute::operator=(const FillGradientAttribute& rCandidate) + { + if(rCandidate.mpFillGradientAttribute != mpFillGradientAttribute) + { + if(mpFillGradientAttribute->mnRefCount) + { + mpFillGradientAttribute->mnRefCount--; + } + else + { + delete mpFillGradientAttribute; + } + + mpFillGradientAttribute = rCandidate.mpFillGradientAttribute; + mpFillGradientAttribute->mnRefCount++; + } + + return *this; + } + + bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const + { + if(rCandidate.mpFillGradientAttribute == mpFillGradientAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillGradientAttribute == *mpFillGradientAttribute); + } + + const basegfx::BColor& FillGradientAttribute::getStartColor() const + { + return mpFillGradientAttribute->getStartColor(); + } + + const basegfx::BColor& FillGradientAttribute::getEndColor() const + { + return mpFillGradientAttribute->getEndColor(); + } + + double FillGradientAttribute::getBorder() const + { + return mpFillGradientAttribute->getBorder(); + } + + double FillGradientAttribute::getOffsetX() const + { + return mpFillGradientAttribute->getOffsetX(); + } + + double FillGradientAttribute::getOffsetY() const + { + return mpFillGradientAttribute->getOffsetY(); + } + + double FillGradientAttribute::getAngle() const + { + return mpFillGradientAttribute->getAngle(); + } + + GradientStyle FillGradientAttribute::getStyle() const + { + return mpFillGradientAttribute->getStyle(); + } + + sal_uInt16 FillGradientAttribute::getSteps() const + { + return mpFillGradientAttribute->getSteps(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx b/drawinglayer/source/attribute/fillhatchattribute.cxx new file mode 100644 index 000000000000..4a82ef5594ab --- /dev/null +++ b/drawinglayer/source/attribute/fillhatchattribute.cxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.cxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <basegfx/color/bcolor.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpFillHatchAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + HatchStyle meStyle; + double mfDistance; + double mfAngle; + basegfx::BColor maColor; + + // bitfield + unsigned mbFillBackground : 1; + + ImpFillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground) + : mnRefCount(0), + meStyle(eStyle), + mfDistance(fDistance), + mfAngle(fAngle), + maColor(rColor), + mbFillBackground(bFillBackground) + { + } + + // data read access + HatchStyle getStyle() const { return meStyle; } + double getDistance() const { return mfDistance; } + double getAngle() const { return mfAngle; } + const basegfx::BColor& getColor() const { return maColor; } + bool isFillBackground() const { return mbFillBackground; } + + bool operator==(const ImpFillHatchAttribute& rCandidate) const + { + return (getStyle() == rCandidate.getStyle() + && getDistance() == rCandidate.getDistance() + && getAngle() == rCandidate.getAngle() + && getColor() == rCandidate.getColor() + && isFillBackground() == rCandidate.isFillBackground()); + } + + static ImpFillHatchAttribute* get_global_default() + { + static ImpFillHatchAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillHatchAttribute( + HATCHSTYLE_SINGLE, + 0.0, 0.0, + basegfx::BColor(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FillHatchAttribute::FillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground) + : mpFillHatchAttribute(new ImpFillHatchAttribute( + eStyle, fDistance, fAngle, rColor, bFillBackground)) + { + } + + FillHatchAttribute::FillHatchAttribute() + : mpFillHatchAttribute(ImpFillHatchAttribute::get_global_default()) + { + mpFillHatchAttribute->mnRefCount++; + } + + FillHatchAttribute::FillHatchAttribute(const FillHatchAttribute& rCandidate) + : mpFillHatchAttribute(rCandidate.mpFillHatchAttribute) + { + mpFillHatchAttribute->mnRefCount++; + } + + FillHatchAttribute::~FillHatchAttribute() + { + if(mpFillHatchAttribute->mnRefCount) + { + mpFillHatchAttribute->mnRefCount--; + } + else + { + delete mpFillHatchAttribute; + } + } + + bool FillHatchAttribute::isDefault() const + { + return mpFillHatchAttribute == ImpFillHatchAttribute::get_global_default(); + } + + FillHatchAttribute& FillHatchAttribute::operator=(const FillHatchAttribute& rCandidate) + { + if(rCandidate.mpFillHatchAttribute != mpFillHatchAttribute) + { + if(mpFillHatchAttribute->mnRefCount) + { + mpFillHatchAttribute->mnRefCount--; + } + else + { + delete mpFillHatchAttribute; + } + + mpFillHatchAttribute = rCandidate.mpFillHatchAttribute; + mpFillHatchAttribute->mnRefCount++; + } + + return *this; + } + + bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const + { + if(rCandidate.mpFillHatchAttribute == mpFillHatchAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillHatchAttribute == *mpFillHatchAttribute); + } + + // data read access + HatchStyle FillHatchAttribute::getStyle() const + { + return mpFillHatchAttribute->getStyle(); + } + + double FillHatchAttribute::getDistance() const + { + return mpFillHatchAttribute->getDistance(); + } + + double FillHatchAttribute::getAngle() const + { + return mpFillHatchAttribute->getAngle(); + } + + const basegfx::BColor& FillHatchAttribute::getColor() const + { + return mpFillHatchAttribute->getColor(); + } + + bool FillHatchAttribute::isFillBackground() const + { + return mpFillHatchAttribute->isFillBackground(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx index 4818026c11ac..7d10d3a37384 100644 --- a/drawinglayer/source/attribute/fontattribute.cxx +++ b/drawinglayer/source/attribute/fontattribute.cxx @@ -29,6 +29,7 @@ #include "precompiled_drawinglayer.hxx" #include <drawinglayer/attribute/fontattribute.hxx> +#include <tools/string.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -36,18 +37,215 @@ namespace drawinglayer { namespace attribute { - bool FontAttribute::operator==(const FontAttribute& rCompare) const - { - return (getFamilyName() == rCompare.getFamilyName() - && getStyleName() == rCompare.getStyleName() - && getWeight() == rCompare.getWeight() - && getSymbol() == rCompare.getSymbol() - && getVertical() == rCompare.getVertical() - && getItalic() == rCompare.getItalic() - && getOutline() == rCompare.getOutline() - && getRTL() == rCompare.getRTL() - && getBiDiStrong() == rCompare.getBiDiStrong()); + class ImpFontAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + /// core data + String maFamilyName; // Font Family Name + String maStyleName; // Font Style Name + sal_uInt16 mnWeight; // Font weight + + /// bitfield + unsigned mbSymbol : 1; // Symbol Font Flag + unsigned mbVertical : 1; // Vertical Text Flag + unsigned mbItalic : 1; // Italic Flag + unsigned mbOutline : 1; // Outline Flag + unsigned mbRTL : 1; // RTL Flag + unsigned mbBiDiStrong : 1; // BiDi Flag + + ImpFontAttribute( + const String& rFamilyName, + const String& rStyleName, + sal_uInt16 nWeight, + bool bSymbol, + bool bVertical, + bool bItalic, + bool bOutline, + bool bRTL, + bool bBiDiStrong) + : mnRefCount(0), + maFamilyName(rFamilyName), + maStyleName(rStyleName), + mnWeight(nWeight), + mbSymbol(bSymbol), + mbVertical(bVertical), + mbItalic(bItalic), + mbOutline(bOutline), + mbRTL(bRTL), + mbBiDiStrong(bBiDiStrong) + { + } + + // data read access + const String& getFamilyName() const { return maFamilyName; } + const String& getStyleName() const { return maStyleName; } + sal_uInt16 getWeight() const { return mnWeight; } + bool getSymbol() const { return mbSymbol; } + bool getVertical() const { return mbVertical; } + bool getItalic() const { return mbItalic; } + bool getOutline() const { return mbOutline; } + bool getRTL() const { return mbRTL; } + bool getBiDiStrong() const { return mbBiDiStrong; } + + bool operator==(const ImpFontAttribute& rCompare) const + { + return (getFamilyName() == rCompare.getFamilyName() + && getStyleName() == rCompare.getStyleName() + && getWeight() == rCompare.getWeight() + && getSymbol() == rCompare.getSymbol() + && getVertical() == rCompare.getVertical() + && getItalic() == rCompare.getItalic() + && getOutline() == rCompare.getOutline() + && getRTL() == rCompare.getRTL() + && getBiDiStrong() == rCompare.getBiDiStrong()); + } + + static ImpFontAttribute* get_global_default() + { + static ImpFontAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFontAttribute( + String(), String(), + 0, + false, false, false, false, false, false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FontAttribute::FontAttribute( + const String& rFamilyName, + const String& rStyleName, + sal_uInt16 nWeight, + bool bSymbol, + bool bVertical, + bool bItalic, + bool bOutline, + bool bRTL, + bool bBiDiStrong) + : mpFontAttribute(new ImpFontAttribute( + rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bOutline, bRTL, bBiDiStrong)) + { + } + + FontAttribute::FontAttribute() + : mpFontAttribute(ImpFontAttribute::get_global_default()) + { + mpFontAttribute->mnRefCount++; + } + + FontAttribute::FontAttribute(const FontAttribute& rCandidate) + : mpFontAttribute(rCandidate.mpFontAttribute) + { + mpFontAttribute->mnRefCount++; + } + + FontAttribute::~FontAttribute() + { + if(mpFontAttribute->mnRefCount) + { + mpFontAttribute->mnRefCount--; + } + else + { + delete mpFontAttribute; + } + } + + bool FontAttribute::isDefault() const + { + return mpFontAttribute == ImpFontAttribute::get_global_default(); + } + + FontAttribute& FontAttribute::operator=(const FontAttribute& rCandidate) + { + if(rCandidate.mpFontAttribute != mpFontAttribute) + { + if(mpFontAttribute->mnRefCount) + { + mpFontAttribute->mnRefCount--; + } + else + { + delete mpFontAttribute; + } + + mpFontAttribute = rCandidate.mpFontAttribute; + mpFontAttribute->mnRefCount++; + } + + return *this; + } + + bool FontAttribute::operator==(const FontAttribute& rCandidate) const + { + if(rCandidate.mpFontAttribute == mpFontAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFontAttribute == *mpFontAttribute); + } + + const String& FontAttribute::getFamilyName() const + { + return mpFontAttribute->getFamilyName(); + } + + const String& FontAttribute::getStyleName() const + { + return mpFontAttribute->getStyleName(); + } + + sal_uInt16 FontAttribute::getWeight() const + { + return mpFontAttribute->getWeight(); } + + bool FontAttribute::getSymbol() const + { + return mpFontAttribute->getSymbol(); + } + + bool FontAttribute::getVertical() const + { + return mpFontAttribute->getVertical(); + } + + bool FontAttribute::getItalic() const + { + return mpFontAttribute->getItalic(); + } + + bool FontAttribute::getOutline() const + { + return mpFontAttribute->getOutline(); + } + + bool FontAttribute::getRTL() const + { + return mpFontAttribute->getRTL(); + } + + bool FontAttribute::getBiDiStrong() const + { + return mpFontAttribute->getBiDiStrong(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx index e249d7fe493a..baa57811f469 100644 --- a/drawinglayer/source/attribute/lineattribute.cxx +++ b/drawinglayer/source/attribute/lineattribute.cxx @@ -29,6 +29,7 @@ #include "precompiled_drawinglayer.hxx" #include <drawinglayer/attribute/lineattribute.hxx> +#include <basegfx/color/bcolor.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -36,6 +37,147 @@ namespace drawinglayer { namespace attribute { + class ImpLineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + basegfx::BColor maColor; // color + double mfWidth; // absolute line width + basegfx::B2DLineJoin meLineJoin; // type of LineJoin + + ImpLineAttribute( + const basegfx::BColor& rColor, + double fWidth, + basegfx::B2DLineJoin aB2DLineJoin) + : mnRefCount(0), + maColor(rColor), + mfWidth(fWidth), + meLineJoin(aB2DLineJoin) + { + } + + // data read access + const basegfx::BColor& getColor() const { return maColor; } + double getWidth() const { return mfWidth; } + basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } + + bool operator==(const ImpLineAttribute& rCandidate) const + { + return (getColor() == rCandidate.getColor() + && getWidth() == rCandidate.getWidth() + && getLineJoin() == rCandidate.getLineJoin()); + } + + static ImpLineAttribute* get_global_default() + { + static ImpLineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpLineAttribute( + basegfx::BColor(), + 0.0, + basegfx::B2DLINEJOIN_ROUND); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + LineAttribute::LineAttribute( + const basegfx::BColor& rColor, + double fWidth, + basegfx::B2DLineJoin aB2DLineJoin) + : mpLineAttribute(new ImpLineAttribute( + rColor, fWidth, aB2DLineJoin)) + { + } + + LineAttribute::LineAttribute() + : mpLineAttribute(ImpLineAttribute::get_global_default()) + { + mpLineAttribute->mnRefCount++; + } + + LineAttribute::LineAttribute(const LineAttribute& rCandidate) + : mpLineAttribute(rCandidate.mpLineAttribute) + { + mpLineAttribute->mnRefCount++; + } + + LineAttribute::~LineAttribute() + { + if(mpLineAttribute->mnRefCount) + { + mpLineAttribute->mnRefCount--; + } + else + { + delete mpLineAttribute; + } + } + + bool LineAttribute::isDefault() const + { + return mpLineAttribute == ImpLineAttribute::get_global_default(); + } + + LineAttribute& LineAttribute::operator=(const LineAttribute& rCandidate) + { + if(rCandidate.mpLineAttribute != mpLineAttribute) + { + if(mpLineAttribute->mnRefCount) + { + mpLineAttribute->mnRefCount--; + } + else + { + delete mpLineAttribute; + } + + mpLineAttribute = rCandidate.mpLineAttribute; + mpLineAttribute->mnRefCount++; + } + + return *this; + } + + bool LineAttribute::operator==(const LineAttribute& rCandidate) const + { + if(rCandidate.mpLineAttribute == mpLineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpLineAttribute == *mpLineAttribute); + } + + const basegfx::BColor& LineAttribute::getColor() const + { + return mpLineAttribute->getColor(); + } + + double LineAttribute::getWidth() const + { + return mpLineAttribute->getWidth(); + } + + basegfx::B2DLineJoin LineAttribute::getLineJoin() const + { + return mpLineAttribute->getLineJoin(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx index 32180c1460f5..05e607616bae 100644 --- a/drawinglayer/source/attribute/linestartendattribute.cxx +++ b/drawinglayer/source/attribute/linestartendattribute.cxx @@ -30,6 +30,7 @@ #include <drawinglayer/attribute/linestartendattribute.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -37,11 +38,154 @@ namespace drawinglayer { namespace attribute { + class ImpLineStartEndAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + double mfWidth; // absolute line StartEndGeometry base width + basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon + + // bitfield + unsigned mbCentered : 1; // use centered to ineStart/End point? + + ImpLineStartEndAttribute( + double fWidth, + const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered) + : mnRefCount(0), + mfWidth(fWidth), + maPolyPolygon(rPolyPolygon), + mbCentered(bCentered) + { + } + + // data read access + double getWidth() const { return mfWidth; } + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + bool isCentered() const { return mbCentered; } + + bool operator==(const ImpLineStartEndAttribute& rCandidate) const + { + return (basegfx::fTools::equal(getWidth(), rCandidate.getWidth()) + && getB2DPolyPolygon() == rCandidate.getB2DPolyPolygon() + && isCentered() == rCandidate.isCentered()); + } + + static ImpLineStartEndAttribute* get_global_default() + { + static ImpLineStartEndAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpLineStartEndAttribute( + 0.0, + basegfx::B2DPolyPolygon(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + LineStartEndAttribute::LineStartEndAttribute( + double fWidth, + const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered) + : mpLineStartEndAttribute(new ImpLineStartEndAttribute( + fWidth, rPolyPolygon, bCentered)) + { + } + + LineStartEndAttribute::LineStartEndAttribute() + : mpLineStartEndAttribute(ImpLineStartEndAttribute::get_global_default()) + { + mpLineStartEndAttribute->mnRefCount++; + } + + LineStartEndAttribute::LineStartEndAttribute(const LineStartEndAttribute& rCandidate) + : mpLineStartEndAttribute(rCandidate.mpLineStartEndAttribute) + { + mpLineStartEndAttribute->mnRefCount++; + } + + LineStartEndAttribute::~LineStartEndAttribute() + { + if(mpLineStartEndAttribute->mnRefCount) + { + mpLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpLineStartEndAttribute; + } + } + + bool LineStartEndAttribute::isDefault() const + { + return mpLineStartEndAttribute == ImpLineStartEndAttribute::get_global_default(); + } + + LineStartEndAttribute& LineStartEndAttribute::operator=(const LineStartEndAttribute& rCandidate) + { + if(rCandidate.mpLineStartEndAttribute != mpLineStartEndAttribute) + { + if(mpLineStartEndAttribute->mnRefCount) + { + mpLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpLineStartEndAttribute; + } + + mpLineStartEndAttribute = rCandidate.mpLineStartEndAttribute; + mpLineStartEndAttribute->mnRefCount++; + } + + return *this; + } + + bool LineStartEndAttribute::operator==(const LineStartEndAttribute& rCandidate) const + { + if(rCandidate.mpLineStartEndAttribute == mpLineStartEndAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpLineStartEndAttribute == *mpLineStartEndAttribute); + } + + double LineStartEndAttribute::getWidth() const + { + return mpLineStartEndAttribute->getWidth(); + } + + const basegfx::B2DPolyPolygon& LineStartEndAttribute::getB2DPolyPolygon() const + { + return mpLineStartEndAttribute->getB2DPolyPolygon(); + } + + bool LineStartEndAttribute::isCentered() const + { + return mpLineStartEndAttribute->isCentered(); + } + bool LineStartEndAttribute::isActive() const { return (0.0 != getWidth() - && 0.0 != getB2DPolyPolygon().count() - && 0.0 != getB2DPolyPolygon().getB2DPolygon(0L).count()); + && 0 != getB2DPolyPolygon().count() + && 0 != getB2DPolyPolygon().getB2DPolygon(0).count()); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk index 291cf313a62b..32cef7c7b49c 100644 --- a/drawinglayer/source/attribute/makefile.mk +++ b/drawinglayer/source/attribute/makefile.mk @@ -37,16 +37,23 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/fillattribute.obj \ - $(SLO)$/fillbitmapattribute.obj \ - $(SLO)$/fontattribute.obj \ - $(SLO)$/materialattribute3d.obj \ - $(SLO)$/sdrallattribute3d.obj \ - $(SLO)$/sdrattribute.obj \ - $(SLO)$/sdrattribute3d.obj \ - $(SLO)$/sdrfillbitmapattribute.obj \ - $(SLO)$/lineattribute.obj \ - $(SLO)$/linestartendattribute.obj \ + $(SLO)$/fillgradientattribute.obj \ + $(SLO)$/fillhatchattribute.obj \ + $(SLO)$/fillbitmapattribute.obj \ + $(SLO)$/fontattribute.obj \ + $(SLO)$/materialattribute3d.obj \ + $(SLO)$/sdrallattribute3d.obj \ + $(SLO)$/sdrlineattribute.obj \ + $(SLO)$/sdrlinestartendattribute.obj \ + $(SLO)$/sdrshadowattribute.obj \ + $(SLO)$/sdrfillattribute.obj \ + $(SLO)$/sdrobjectattribute3d.obj \ + $(SLO)$/sdrlightattribute3d.obj \ + $(SLO)$/sdrlightingattribute3d.obj \ + $(SLO)$/sdrsceneattribute3d.obj \ + $(SLO)$/sdrfillbitmapattribute.obj \ + $(SLO)$/lineattribute.obj \ + $(SLO)$/linestartendattribute.obj \ $(SLO)$/strokeattribute.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx index 10dee5ec4ce9..4dbb152130ff 100644 --- a/drawinglayer/source/attribute/materialattribute3d.cxx +++ b/drawinglayer/source/attribute/materialattribute3d.cxx @@ -40,74 +40,87 @@ namespace drawinglayer class ImpMaterialAttribute3D { public: + // refcounter + sal_uInt32 mnRefCount; + // materialAttribute3D definitions basegfx::BColor maColor; // object color basegfx::BColor maSpecular; // material specular color basegfx::BColor maEmission; // material emissive color - sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128] - - // refcounter - sal_uInt32 mnRefCount; + sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128] ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) - : maColor(rColor), + : mnRefCount(0), + maColor(rColor), maSpecular(rSpecular), maEmission(rEmission), - mnSpecularIntensity(nSpecularIntensity), - mnRefCount(0L) + mnSpecularIntensity(nSpecularIntensity) { } ImpMaterialAttribute3D(const basegfx::BColor& rColor) - : maColor(rColor), + : mnRefCount(0), + maColor(rColor), maSpecular(1.0, 1.0, 1.0), maEmission(), - mnSpecularIntensity(15), - mnRefCount(0L) + mnSpecularIntensity(15) { } - ImpMaterialAttribute3D() - : mnSpecularIntensity(0), - mnRefCount(0L) - { - } + // data read access + const basegfx::BColor& getColor() const { return maColor; } + const basegfx::BColor& getSpecular() const { return maSpecular; } + const basegfx::BColor& getEmission() const { return maEmission; } + sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; } bool operator==(const ImpMaterialAttribute3D& rCandidate) const { - return (maColor == rCandidate.maColor - && maSpecular == rCandidate.maSpecular - && maEmission == rCandidate.maEmission - && mnSpecularIntensity == rCandidate.mnSpecularIntensity); + return (getColor() == rCandidate.getColor() + && getSpecular() == rCandidate.getSpecular() + && getEmission() == rCandidate.getEmission() + && getSpecularIntensity() == rCandidate.getSpecularIntensity()); } - const basegfx::BColor& getColor() const { return maColor; } - const basegfx::BColor& getSpecular() const { return maSpecular; } - const basegfx::BColor& getEmission() const { return maEmission; } - sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; } - }; - } // end of anonymous namespace -} // end of namespace drawinglayer + static ImpMaterialAttribute3D* get_global_default() + { + static ImpMaterialAttribute3D* pDefault = 0; -////////////////////////////////////////////////////////////////////////////// + if(!pDefault) + { + pDefault = new ImpMaterialAttribute3D( + basegfx::BColor(), + basegfx::BColor(), + basegfx::BColor(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } -namespace drawinglayer -{ - namespace attribute - { - MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) - : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor, rSpecular, rEmission, nSpecularIntensity)) + return pDefault; + } + }; + + MaterialAttribute3D::MaterialAttribute3D( + const basegfx::BColor& rColor, + const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, + sal_uInt16 nSpecularIntensity) + : mpMaterialAttribute3D(new ImpMaterialAttribute3D( + rColor, rSpecular, rEmission, nSpecularIntensity)) { } - MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor) + MaterialAttribute3D::MaterialAttribute3D( + const basegfx::BColor& rColor) : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor)) { } MaterialAttribute3D::MaterialAttribute3D() - : mpMaterialAttribute3D(new ImpMaterialAttribute3D()) + : mpMaterialAttribute3D(ImpMaterialAttribute3D::get_global_default()) { + mpMaterialAttribute3D->mnRefCount++; } MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate) @@ -128,6 +141,11 @@ namespace drawinglayer } } + bool MaterialAttribute3D::isDefault() const + { + return mpMaterialAttribute3D == ImpMaterialAttribute3D::get_global_default(); + } + MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate) { if(rCandidate.mpMaterialAttribute3D != mpMaterialAttribute3D) @@ -155,6 +173,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpMaterialAttribute3D == *mpMaterialAttribute3D); } diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx index 4ecf74afa2fd..c3ad3db80add 100644 --- a/drawinglayer/source/attribute/sdrallattribute3d.cxx +++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx @@ -29,12 +29,6 @@ #include "precompiled_drawinglayer.hxx" #include <drawinglayer/attribute/sdrallattribute3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) ////////////////////////////////////////////////////////////////////////////// @@ -42,150 +36,47 @@ namespace drawinglayer { namespace attribute { - SdrLineFillShadowAttribute::SdrLineFillShadowAttribute( - SdrLineAttribute* pLine, - SdrFillAttribute* pFill, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - FillGradientAttribute* pFillFloatTransGradient) - : mpShadow(pShadow), - mpLine(pLine), - mpLineStartEnd(pLineStartEnd), - mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient) - { - } - - SdrLineFillShadowAttribute::SdrLineFillShadowAttribute( - const SdrLineFillShadowAttribute& rCandidate) - : mpShadow(0), - mpLine(0), - mpLineStartEnd(0), - mpFill(0), - mpFillFloatTransGradient(0) + SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient) + : maLine(rLine), + maFill(rFill), + maLineStartEnd(rLineStartEnd), + maShadow(rShadow), + maFillFloatTransGradient(rFillFloatTransGradient) { - *this = rCandidate; } - SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute() + SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D() + : maLine(), + maFill(), + maLineStartEnd(), + maShadow(), + maFillFloatTransGradient() { - delete mpShadow; - delete mpLine; - delete mpLineStartEnd; - delete mpFill; - delete mpFillFloatTransGradient; } - SdrLineFillShadowAttribute& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute& rCandidate) + bool SdrLineFillShadowAttribute3D::isDefault() const { - // handle mpShadow - { - // delete local mpShadow if necessary - if(mpShadow) - { - delete mpShadow; - mpShadow = 0; - } - - // copy mpShadow if necessary - if(rCandidate.mpShadow) - { - mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); - } - } - - // handle mpLine - { - // delete local mpLine if necessary - if(mpLine) - { - delete mpLine; - mpLine = 0; - } - - // copy mpLine if necessary - if(rCandidate.mpLine) - { - mpLine = new SdrLineAttribute(*rCandidate.mpLine); - } - } - - // handle mpLineStartEnd - { - // delete local mpLineStartEnd if necessary - if(mpLineStartEnd) - { - delete mpLineStartEnd; - mpLineStartEnd = 0; - } - - // copy mpLineStartEnd if necessary - if(rCandidate.mpLineStartEnd) - { - mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); - } - } - - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - return *this; + return(getLine().isDefault() + && getFill().isDefault() + && getLineStartEnd().isDefault() + && getShadow().isDefault() + && getFillFloatTransGradient().isDefault()); } - bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute& rCandidate) const + bool SdrLineFillShadowAttribute3D::operator==(const SdrLineFillShadowAttribute3D& rCandidate) const { - // handle mpShadow - if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) - return false; - - // handle mpLine - if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) - return false; - - // handle mpLineStartEnd - if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) - return false; - - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - return true; + return(getLine() == rCandidate.getLine() + && getFill() == rCandidate.getFill() + && getLineStartEnd() == rCandidate.getLineStartEnd() + && getShadow() == rCandidate.getShadow() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()); } - } // end of namespace attribute + } // end of namespace overlay } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx deleted file mode 100644 index 1f19a631585e..000000000000 --- a/drawinglayer/source/attribute/sdrattribute.cxx +++ /dev/null @@ -1,285 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> -#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineAttribute::SdrLineAttribute( - basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, - const ::std::vector< double >& rDotDashArray, double fFullDotDashLen) - : meJoin(eJoin), - mfWidth(fWidth), - mfTransparence(fTransparence), - maColor(rColor), - maDotDashArray(rDotDashArray), - mfFullDotDashLen(fFullDotDashLen) - { - } - - SdrLineAttribute::SdrLineAttribute(const basegfx::BColor& rColor) - : meJoin(basegfx::B2DLINEJOIN_NONE), - mfWidth(0.0), - mfTransparence(0.0), - maColor(rColor), - maDotDashArray(), - mfFullDotDashLen(0.0) - { - } - - SdrLineAttribute::~SdrLineAttribute() - { - } - - bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const - { - return (meJoin == rCandidate.meJoin - && mfWidth == rCandidate.mfWidth - && mfTransparence == rCandidate.mfTransparence - && maColor == rCandidate.maColor - && maDotDashArray == rCandidate.maDotDashArray); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineStartEndAttribute::SdrLineStartEndAttribute( - const basegfx::B2DPolyPolygon& rStartPolyPolygon, const basegfx::B2DPolyPolygon& rEndPolyPolygon, - double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered) - : maStartPolyPolygon(rStartPolyPolygon), - maEndPolyPolygon(rEndPolyPolygon), - mfStartWidth(fStartWidth), - mfEndWidth(fEndWidth), - mbStartActive(bStartActive), - mbEndActive(bEndActive), - mbStartCentered(bStartCentered), - mbEndCentered(bEndCentered) - { - } - - SdrLineStartEndAttribute::~SdrLineStartEndAttribute() - { - } - - bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const - { - return (mbStartActive == rCandidate.mbStartActive - && mbEndActive == rCandidate.mbEndActive - && mbStartCentered == rCandidate.mbStartCentered - && mbEndCentered == rCandidate.mbEndCentered - && mfStartWidth == rCandidate.mfStartWidth - && mfEndWidth == rCandidate.mfEndWidth - && maStartPolyPolygon == rCandidate.maStartPolyPolygon - && maEndPolyPolygon == rCandidate.maEndPolyPolygon); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrShadowAttribute::SdrShadowAttribute(const basegfx::B2DVector& rOffset, double fTransparence, const basegfx::BColor& rColor) - : maOffset(rOffset), - mfTransparence(fTransparence), - maColor(rColor) - { - } - - SdrShadowAttribute::~SdrShadowAttribute() - { - } - - bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const - { - return (mfTransparence == rCandidate.mfTransparence - && maColor == rCandidate.maColor - && maOffset == rCandidate.maOffset); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrFillAttribute::SdrFillAttribute( - double fTransparence, - const basegfx::BColor& rColor, - FillGradientAttribute* pGradient, - FillHatchAttribute* pHatch, - SdrFillBitmapAttribute* pBitmap) - : mfTransparence(fTransparence), - maColor(rColor), - mpGradient(pGradient), - mpHatch(pHatch), - mpBitmap(pBitmap) - { - } - - SdrFillAttribute::SdrFillAttribute(const SdrFillAttribute& rCandidate) - : mfTransparence(1.0), - mpGradient(0L), - mpHatch(0L), - mpBitmap(0L) - { - if(!(*this == rCandidate)) - { - *this = rCandidate; - } - } - - SdrFillAttribute::~SdrFillAttribute() - { - delete mpGradient; - delete mpHatch; - delete mpBitmap; - } - - SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute& rCandidate) - { - // copy data - mfTransparence = rCandidate.mfTransparence; - maColor = rCandidate.maColor; - - // handle mpGradient - { - // delete local mpGradient if necessary - if(mpGradient && ((!rCandidate.mpGradient) || (!(*mpGradient == *rCandidate.mpGradient)))) - { - delete mpGradient; - mpGradient = 0L; - } - - // copy mpGradient if necessary - if(!mpGradient && rCandidate.mpGradient) - { - mpGradient = new FillGradientAttribute(*rCandidate.mpGradient); - } - } - - // handle mpHatch - { - // delete local mpHatch if necessary - if(mpHatch && ((!rCandidate.mpHatch) || (!(*mpHatch == *rCandidate.mpHatch)))) - { - delete mpHatch; - mpHatch = 0L; - } - - // copy mpHatch if necessary - if(!mpHatch && rCandidate.mpHatch) - { - mpHatch = new FillHatchAttribute(*rCandidate.mpHatch); - } - } - - // handle mpBitmap - { - // delete local mpBitmap if necessary - if(mpBitmap && ((!rCandidate.mpBitmap) || (!(*mpBitmap == *rCandidate.mpBitmap)))) - { - delete mpBitmap; - mpBitmap = 0L; - } - - // copy mpBitmap if necessary - if(!mpBitmap && rCandidate.mpBitmap) - { - mpBitmap = new SdrFillBitmapAttribute(*rCandidate.mpBitmap); - } - } - - return *this; - } - - bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const - { - if(mfTransparence != rCandidate.mfTransparence) - return false; - - if(mpGradient) - { - if(!rCandidate.mpGradient) - return false; - - if(!(*mpGradient == *rCandidate.mpGradient)) - return false; - } - else if(mpHatch) - { - if(!rCandidate.mpHatch) - return false; - - if(!(*mpHatch == *rCandidate.mpHatch)) - return false; - - if(mpHatch->isFillBackground() && !(maColor == rCandidate.maColor)) - return false; - } - else if(mpBitmap) - { - if(!rCandidate.mpBitmap) - return false; - - if(!(*mpBitmap == *rCandidate.mpBitmap)) - return false; - } - else - { - if(!rCandidate.isColor()) - return false; - - if(!(maColor == rCandidate.maColor)) - return false; - } - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/sdrattribute3d.cxx b/drawinglayer/source/attribute/sdrattribute3d.cxx deleted file mode 100644 index 7934bba67201..000000000000 --- a/drawinglayer/source/attribute/sdrattribute3d.cxx +++ /dev/null @@ -1,211 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include <drawinglayer/attribute/sdrattribute3d.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - Sdr3DObjectAttribute::Sdr3DObjectAttribute( - ::com::sun::star::drawing::NormalsKind aNormalsKind, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, - ::com::sun::star::drawing::TextureKind2 aTextureKind, - ::com::sun::star::drawing::TextureMode aTextureMode, - const MaterialAttribute3D& rMaterial, - bool bNormalsInvert, - bool bDoubleSided, - bool bShadow3D, - bool bTextureFilter, - bool bReducedLineGeometry) - : maNormalsKind(aNormalsKind), - maTextureProjectionX(aTextureProjectionX), - maTextureProjectionY(aTextureProjectionY), - maTextureKind(aTextureKind), - maTextureMode(aTextureMode), - maMaterial(rMaterial), - mbNormalsInvert(bNormalsInvert), - mbDoubleSided(bDoubleSided), - mbShadow3D(bShadow3D), - mbTextureFilter(bTextureFilter), - mbReducedLineGeometry(bReducedLineGeometry) - { - } - - bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const - { - return (maNormalsKind == rCandidate.maNormalsKind - && maTextureProjectionX == rCandidate.maTextureProjectionX - && maTextureProjectionY == rCandidate.maTextureProjectionY - && maTextureKind == rCandidate.maTextureKind - && maTextureMode == rCandidate.maTextureMode - && maMaterial == rCandidate.maMaterial - && mbNormalsInvert == rCandidate.mbNormalsInvert - && mbDoubleSided == rCandidate.mbDoubleSided - && mbShadow3D == rCandidate.mbShadow3D - && mbTextureFilter == rCandidate.mbTextureFilter - && mbReducedLineGeometry == rCandidate.mbReducedLineGeometry); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - Sdr3DLightAttribute::Sdr3DLightAttribute(const basegfx::BColor& rColor, const basegfx::B3DVector& rDirection, bool bSpecular) - : maColor(rColor), - maDirection(rDirection), - mbSpecular(bSpecular) - { - } - - bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const - { - return (maColor == rCandidate.maColor - && maDirection == rCandidate.maDirection - && mbSpecular == rCandidate.mbSpecular); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLightingAttribute::SdrLightingAttribute( - const basegfx::BColor& rAmbientLight, - const ::std::vector< Sdr3DLightAttribute >& rLightVector) - : maAmbientLight(rAmbientLight), - maLightVector(rLightVector) - { - } - - bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const - { - return (maAmbientLight == rCandidate.maAmbientLight - && maLightVector == rCandidate.maLightVector); - } - - // color model solver - basegfx::BColor SdrLightingAttribute::solveColorModel( - const basegfx::B3DVector& rNormalInEyeCoordinates, - const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, - const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const - { - // initialize with emissive color - basegfx::BColor aRetval(rEmission); - - // take care of global ambient light - aRetval += getAmbientLight() * rColor; - - // prepare light access. Is there a light? - const sal_uInt32 nLightCount(maLightVector.size()); - - if(nLightCount && !rNormalInEyeCoordinates.equalZero()) - { - // prepare normal - basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates); - aEyeNormal.normalize(); - - for(sal_uInt32 a(0L); a < nLightCount; a++) - { - const Sdr3DLightAttribute& rLight(maLightVector[a]); - const double fCosFac(rLight.getDirection().scalar(aEyeNormal)); - - if(basegfx::fTools::more(fCosFac, 0.0)) - { - aRetval += ((rLight.getColor() * rColor) * fCosFac); - - if(rLight.getSpecular()) - { - // expand by (0.0, 0.0, 1.0) in Z - basegfx::B3DVector aSpecularNormal(rLight.getDirection().getX(), rLight.getDirection().getY(), rLight.getDirection().getZ() + 1.0); - aSpecularNormal.normalize(); - double fCosFac2(aSpecularNormal.scalar(aEyeNormal)); - - if(basegfx::fTools::more(fCosFac2, 0.0)) - { - fCosFac2 = pow(fCosFac2, (double)nSpecularIntensity); - aRetval += (rSpecular * fCosFac2); - } - } - } - } - } - - // clamp to color space before usage - aRetval.clamp(); - - return aRetval; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrSceneAttribute::SdrSceneAttribute( - double fDistance, - double fShadowSlant, - ::com::sun::star::drawing::ProjectionMode aProjectionMode, - ::com::sun::star::drawing::ShadeMode aShadeMode, - bool bTwoSidedLighting) - : mfDistance(fDistance), - mfShadowSlant(fShadowSlant), - maProjectionMode(aProjectionMode), - maShadeMode(aShadeMode), - mbTwoSidedLighting(bTwoSidedLighting) - { - } - - bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const - { - return (mfDistance == rCandidate.mfDistance - && mfShadowSlant == rCandidate.mfShadowSlant - && maProjectionMode == rCandidate.maProjectionMode - && maShadeMode == rCandidate.maShadeMode - && mbTwoSidedLighting == rCandidate.mbTwoSidedLighting); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/sdrfillattribute.cxx b/drawinglayer/source/attribute/sdrfillattribute.cxx new file mode 100644 index 000000000000..bd99ba2c4ba4 --- /dev/null +++ b/drawinglayer/source/attribute/sdrfillattribute.cxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <basegfx/color/bcolor.hxx> +#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrFillAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // fill definitions + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // fill color + FillGradientAttribute maGradient; // fill gradient (if used) + FillHatchAttribute maHatch; // fill hatch (if used) + SdrFillBitmapAttribute maBitmap; // fill bitmap (if used) + + public: + ImpSdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap) + : mnRefCount(0), + mfTransparence(fTransparence), + maColor(rColor), + maGradient(rGradient), + maHatch(rHatch), + maBitmap(rBitmap) + { + } + + // data read access + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + const FillGradientAttribute& getGradient() const { return maGradient; } + const FillHatchAttribute& getHatch() const { return maHatch; } + const SdrFillBitmapAttribute& getBitmap() const { return maBitmap; } + + // compare operator + bool operator==(const ImpSdrFillAttribute& rCandidate) const + { + return(getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor() + && getGradient() == rCandidate.getGradient() + && getHatch() == rCandidate.getHatch() + && getBitmap() == rCandidate.getBitmap()); + } + + static ImpSdrFillAttribute* get_global_default() + { + static ImpSdrFillAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFillAttribute( + 0.0, + basegfx::BColor(), + FillGradientAttribute(), + FillHatchAttribute(), + SdrFillBitmapAttribute()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrFillAttribute::SdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap) + : mpSdrFillAttribute(new ImpSdrFillAttribute( + fTransparence, rColor, rGradient, rHatch, rBitmap)) + { + } + + SdrFillAttribute::SdrFillAttribute() + : mpSdrFillAttribute(ImpSdrFillAttribute::get_global_default()) + { + mpSdrFillAttribute->mnRefCount++; + } + + SdrFillAttribute::SdrFillAttribute(const SdrFillAttribute& rCandidate) + : mpSdrFillAttribute(rCandidate.mpSdrFillAttribute) + { + mpSdrFillAttribute->mnRefCount++; + } + + SdrFillAttribute::~SdrFillAttribute() + { + if(mpSdrFillAttribute->mnRefCount) + { + mpSdrFillAttribute->mnRefCount--; + } + else + { + delete mpSdrFillAttribute; + } + } + + bool SdrFillAttribute::isDefault() const + { + return mpSdrFillAttribute == ImpSdrFillAttribute::get_global_default(); + } + + SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute& rCandidate) + { + if(rCandidate.mpSdrFillAttribute != mpSdrFillAttribute) + { + if(mpSdrFillAttribute->mnRefCount) + { + mpSdrFillAttribute->mnRefCount--; + } + else + { + delete mpSdrFillAttribute; + } + + mpSdrFillAttribute = rCandidate.mpSdrFillAttribute; + mpSdrFillAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const + { + if(rCandidate.mpSdrFillAttribute == mpSdrFillAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFillAttribute == *mpSdrFillAttribute); + } + + double SdrFillAttribute::getTransparence() const + { + return mpSdrFillAttribute->getTransparence(); + } + + const basegfx::BColor& SdrFillAttribute::getColor() const + { + return mpSdrFillAttribute->getColor(); + } + + const FillGradientAttribute& SdrFillAttribute::getGradient() const + { + return mpSdrFillAttribute->getGradient(); + } + + const FillHatchAttribute& SdrFillAttribute::getHatch() const + { + return mpSdrFillAttribute->getHatch(); + } + + const SdrFillBitmapAttribute& SdrFillAttribute::getBitmap() const + { + return mpSdrFillAttribute->getBitmap(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx index 032cf8c4ce78..abc34cfd87b5 100644 --- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx @@ -30,8 +30,7 @@ #include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> -#include <basegfx/numeric/ftools.hxx> -#include <basegfx/range/b2drange.hxx> +#include <vcl/bitmapex.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -39,37 +38,213 @@ namespace drawinglayer { namespace attribute { + class ImpSdrFillBitmapAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + Bitmap maBitmap; + basegfx::B2DVector maSize; + basegfx::B2DVector maOffset; + basegfx::B2DVector maOffsetPosition; + basegfx::B2DVector maRectPoint; + + // bitfield + unsigned mbTiling : 1; + unsigned mbStretch : 1; + unsigned mbLogSize : 1; + + ImpSdrFillBitmapAttribute( + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize) + : mnRefCount(0), + maBitmap(rBitmap), + maSize(rSize), + maOffset(rOffset), + maOffsetPosition(rOffsetPosition), + maRectPoint(rRectPoint), + mbTiling(bTiling), + mbStretch(bStretch), + mbLogSize(bLogSize) + { + } + + // data read access + const Bitmap& getBitmap() const { return maBitmap; } + const basegfx::B2DVector& getSize() const { return maSize; } + const basegfx::B2DVector& getOffset() const { return maOffset; } + const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; } + const basegfx::B2DVector& getRectPoint() const { return maRectPoint; } + bool getTiling() const { return mbTiling; } + bool getStretch() const { return mbStretch; } + bool getLogSize() const { return mbLogSize; } + + bool operator==(const ImpSdrFillBitmapAttribute& rCandidate) const + { + return (getBitmap() == rCandidate.getBitmap() + && getSize() == rCandidate.getSize() + && getOffset() == rCandidate.getOffset() + && getOffsetPosition() == rCandidate.getOffsetPosition() + && getRectPoint() == rCandidate.getRectPoint() + && getTiling() == rCandidate.getTiling() + && getStretch() == rCandidate.getStretch() + && getLogSize() == rCandidate.getLogSize()); + } + + static ImpSdrFillBitmapAttribute* get_global_default() + { + static ImpSdrFillBitmapAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFillBitmapAttribute( + Bitmap(), + basegfx::B2DVector(), + basegfx::B2DVector(), + basegfx::B2DVector(), + basegfx::B2DVector(), + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrFillBitmapAttribute::SdrFillBitmapAttribute( - const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, - const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint, - bool bTiling, bool bStretch, bool bLogSize) - : maBitmap(rBitmap), - maSize(rSize), - maOffset(rOffset), - maOffsetPosition(rOffsetPosition), - maRectPoint(rRectPoint), - mbTiling(bTiling), - mbStretch(bStretch), - mbLogSize(bLogSize) + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize) + : mpSdrFillBitmapAttribute(new ImpSdrFillBitmapAttribute( + rBitmap, rSize, rOffset, rOffsetPosition, rRectPoint, bTiling, bStretch, bLogSize)) { } + SdrFillBitmapAttribute::SdrFillBitmapAttribute() + : mpSdrFillBitmapAttribute(ImpSdrFillBitmapAttribute::get_global_default()) + { + mpSdrFillBitmapAttribute->mnRefCount++; + } + + SdrFillBitmapAttribute::SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate) + : mpSdrFillBitmapAttribute(rCandidate.mpSdrFillBitmapAttribute) + { + mpSdrFillBitmapAttribute->mnRefCount++; + } + + SdrFillBitmapAttribute::~SdrFillBitmapAttribute() + { + if(mpSdrFillBitmapAttribute->mnRefCount) + { + mpSdrFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpSdrFillBitmapAttribute; + } + } + + bool SdrFillBitmapAttribute::isDefault() const + { + return mpSdrFillBitmapAttribute == ImpSdrFillBitmapAttribute::get_global_default(); + } + + SdrFillBitmapAttribute& SdrFillBitmapAttribute::operator=(const SdrFillBitmapAttribute& rCandidate) + { + if(rCandidate.mpSdrFillBitmapAttribute != mpSdrFillBitmapAttribute) + { + if(mpSdrFillBitmapAttribute->mnRefCount) + { + mpSdrFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpSdrFillBitmapAttribute; + } + + mpSdrFillBitmapAttribute = rCandidate.mpSdrFillBitmapAttribute; + mpSdrFillBitmapAttribute->mnRefCount++; + } + + return *this; + } + bool SdrFillBitmapAttribute::operator==(const SdrFillBitmapAttribute& rCandidate) const { - return (maBitmap == rCandidate.maBitmap - && maSize == rCandidate.maSize - && maOffset == rCandidate.maOffset - && maOffsetPosition == rCandidate.maOffsetPosition - && maRectPoint == rCandidate.maRectPoint - && mbTiling == rCandidate.mbTiling - && mbStretch == rCandidate.mbStretch - && mbLogSize == rCandidate.mbLogSize); + if(rCandidate.mpSdrFillBitmapAttribute == mpSdrFillBitmapAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFillBitmapAttribute == *mpSdrFillBitmapAttribute); + } + + const Bitmap& SdrFillBitmapAttribute::getBitmap() const + { + return mpSdrFillBitmapAttribute->getBitmap(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getSize() const + { + return mpSdrFillBitmapAttribute->getSize(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getOffset() const + { + return mpSdrFillBitmapAttribute->getOffset(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getOffsetPosition() const + { + return mpSdrFillBitmapAttribute->getOffsetPosition(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getRectPoint() const + { + return mpSdrFillBitmapAttribute->getRectPoint(); + } + + bool SdrFillBitmapAttribute::getTiling() const + { + return mpSdrFillBitmapAttribute->getTiling(); + } + + bool SdrFillBitmapAttribute::getStretch() const + { + return mpSdrFillBitmapAttribute->getStretch(); + } + + bool SdrFillBitmapAttribute::getLogSize() const + { + return mpSdrFillBitmapAttribute->getLogSize(); } FillBitmapAttribute SdrFillBitmapAttribute::getFillBitmapAttribute(const basegfx::B2DRange& rRange) const { // get logical size of bitmap (before expanding eventually) - Bitmap aBitmap(maBitmap); + Bitmap aBitmap(getBitmap()); const basegfx::B2DVector aLogicalSize(aBitmap.GetPrefSize().getWidth(), aBitmap.GetPrefSize().getHeight()); // get hor/ver shiftings and apply them eventually to the bitmap, but only @@ -77,17 +252,17 @@ namespace drawinglayer bool bExpandWidth(false); bool bExpandHeight(false); - if(mbTiling) + if(getTiling()) { - if(0.0 != maOffset.getX() || 0.0 != maOffset.getY()) + if(0.0 != getOffset().getX() || 0.0 != getOffset().getY()) { const sal_uInt32 nWidth(aBitmap.GetSizePixel().getWidth()); const sal_uInt32 nHeight(aBitmap.GetSizePixel().getHeight()); - if(0.0 != maOffset.getX()) + if(0.0 != getOffset().getX()) { bExpandHeight = true; - const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * maOffset.getX()) / 100.0)); + const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * getOffset().getX()) / 100.0)); aBitmap.Expand(0L, nHeight); const Size aSizeA(nOffset, nHeight); @@ -103,7 +278,7 @@ namespace drawinglayer else { bExpandWidth = true; - const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * maOffset.getY()) / 100.0)); + const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * getOffset().getY()) / 100.0)); aBitmap.Expand(nWidth, 0L); const Size aSize(nWidth, nHeight); @@ -129,7 +304,7 @@ namespace drawinglayer basegfx::B2DVector aBitmapTopLeft(0.0, 0.0); // are canges needed? - if(mbTiling || !mbStretch) + if(getTiling() || !getStretch()) { // init values with range sizes const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0); @@ -137,15 +312,15 @@ namespace drawinglayer aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight); // size changes - if(0.0 != maSize.getX()) + if(0.0 != getSize().getX()) { - if(maSize.getX() < 0.0) + if(getSize().getX() < 0.0) { - aBitmapSize.setX(aBitmapSize.getX() * (maSize.getX() * -0.01)); + aBitmapSize.setX(aBitmapSize.getX() * (getSize().getX() * -0.01)); } else { - aBitmapSize.setX(maSize.getX()); + aBitmapSize.setX(getSize().getX()); } } else @@ -153,15 +328,15 @@ namespace drawinglayer aBitmapSize.setX(aLogicalSize.getX()); } - if(0.0 != maSize.getY()) + if(0.0 != getSize().getY()) { - if(maSize.getY() < 0.0) + if(getSize().getY() < 0.0) { - aBitmapSize.setY(aBitmapSize.getY() * (maSize.getY() * -0.01)); + aBitmapSize.setY(aBitmapSize.getY() * (getSize().getY() * -0.01)); } else { - aBitmapSize.setY(maSize.getY()); + aBitmapSize.setY(getSize().getY()); } } else @@ -170,7 +345,7 @@ namespace drawinglayer } // get values, force to centered if necessary - const basegfx::B2DVector aRectPoint(mbTiling ? maRectPoint : basegfx::B2DVector(0.0, 0.0)); + const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0)); // position changes X if(0.0 == aRectPoint.getX()) @@ -182,9 +357,9 @@ namespace drawinglayer aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX()); } - if(mbTiling && 0.0 != maOffsetPosition.getX()) + if(getTiling() && 0.0 != getOffsetPosition().getX()) { - aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (maOffsetPosition.getX() * 0.01))); + aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01))); } // position changes Y @@ -197,9 +372,9 @@ namespace drawinglayer aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY()); } - if(mbTiling && 0.0 != maOffsetPosition.getY()) + if(getTiling() && 0.0 != getOffsetPosition().getY()) { - aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (maOffsetPosition.getY() * 0.01))); + aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01))); } // apply expand @@ -220,7 +395,7 @@ namespace drawinglayer aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight); } - return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, mbTiling); + return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, getTiling()); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/sdrlightattribute3d.cxx b/drawinglayer/source/attribute/sdrlightattribute3d.cxx new file mode 100644 index 000000000000..bc22d0a5f183 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrlightattribute3d.hxx> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/vector/b3dvector.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdr3DLightAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D light attribute definitions + basegfx::BColor maColor; + basegfx::B3DVector maDirection; + + // bitfield + unsigned mbSpecular : 1; + + ImpSdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular) + : mnRefCount(0), + maColor(rColor), + maDirection(rDirection), + mbSpecular(bSpecular) + { + } + + // data read access + const basegfx::BColor& getColor() const { return maColor; } + const basegfx::B3DVector& getDirection() const { return maDirection; } + bool getSpecular() const { return mbSpecular; } + + bool operator==(const ImpSdr3DLightAttribute& rCandidate) const + { + return (getColor() == rCandidate.getColor() + && getDirection() == rCandidate.getDirection() + && getSpecular() == rCandidate.getSpecular()); + } + + static ImpSdr3DLightAttribute* get_global_default() + { + static ImpSdr3DLightAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdr3DLightAttribute( + basegfx::BColor(), + basegfx::B3DVector(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + Sdr3DLightAttribute::Sdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular) + : mpSdr3DLightAttribute(new ImpSdr3DLightAttribute( + rColor, rDirection, bSpecular)) + { + } + + Sdr3DLightAttribute::Sdr3DLightAttribute() + : mpSdr3DLightAttribute(ImpSdr3DLightAttribute::get_global_default()) + { + mpSdr3DLightAttribute->mnRefCount++; + } + + Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate) + : mpSdr3DLightAttribute(rCandidate.mpSdr3DLightAttribute) + { + mpSdr3DLightAttribute->mnRefCount++; + } + + Sdr3DLightAttribute::~Sdr3DLightAttribute() + { + if(mpSdr3DLightAttribute->mnRefCount) + { + mpSdr3DLightAttribute->mnRefCount--; + } + else + { + delete mpSdr3DLightAttribute; + } + } + + bool Sdr3DLightAttribute::isDefault() const + { + return mpSdr3DLightAttribute == ImpSdr3DLightAttribute::get_global_default(); + } + + Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const Sdr3DLightAttribute& rCandidate) + { + if(rCandidate.mpSdr3DLightAttribute != mpSdr3DLightAttribute) + { + if(mpSdr3DLightAttribute->mnRefCount) + { + mpSdr3DLightAttribute->mnRefCount--; + } + else + { + delete mpSdr3DLightAttribute; + } + + mpSdr3DLightAttribute = rCandidate.mpSdr3DLightAttribute; + mpSdr3DLightAttribute->mnRefCount++; + } + + return *this; + } + + bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const + { + if(rCandidate.mpSdr3DLightAttribute == mpSdr3DLightAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdr3DLightAttribute == *mpSdr3DLightAttribute); + } + + const basegfx::BColor& Sdr3DLightAttribute::getColor() const + { + return mpSdr3DLightAttribute->getColor(); + } + + const basegfx::B3DVector& Sdr3DLightAttribute::getDirection() const + { + return mpSdr3DLightAttribute->getDirection(); + } + + bool Sdr3DLightAttribute::getSpecular() const + { + return mpSdr3DLightAttribute->getSpecular(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx new file mode 100644 index 000000000000..25407d52f282 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/vector/b3dvector.hxx> +#include <drawinglayer/attribute/sdrlightattribute3d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLightingAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D light attribute definitions + basegfx::BColor maAmbientLight; + ::std::vector< Sdr3DLightAttribute > maLightVector; + + ImpSdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector) + : mnRefCount(0), + maAmbientLight(rAmbientLight), + maLightVector(rLightVector) + { + } + + // data read access + const basegfx::BColor& getAmbientLight() const { return maAmbientLight; } + const ::std::vector< Sdr3DLightAttribute >& getLightVector() const { return maLightVector; } + + bool operator==(const ImpSdrLightingAttribute& rCandidate) const + { + return (getAmbientLight() == rCandidate.getAmbientLight() + && getLightVector() == rCandidate.getLightVector()); + } + + static ImpSdrLightingAttribute* get_global_default() + { + static ImpSdrLightingAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLightingAttribute( + basegfx::BColor(), + std::vector< Sdr3DLightAttribute >()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLightingAttribute::SdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector) + : mpSdrLightingAttribute(new ImpSdrLightingAttribute( + rAmbientLight, rLightVector)) + { + } + + SdrLightingAttribute::SdrLightingAttribute() + : mpSdrLightingAttribute(ImpSdrLightingAttribute::get_global_default()) + { + mpSdrLightingAttribute->mnRefCount++; + } + + SdrLightingAttribute::SdrLightingAttribute(const SdrLightingAttribute& rCandidate) + : mpSdrLightingAttribute(rCandidate.mpSdrLightingAttribute) + { + mpSdrLightingAttribute->mnRefCount++; + } + + SdrLightingAttribute::~SdrLightingAttribute() + { + if(mpSdrLightingAttribute->mnRefCount) + { + mpSdrLightingAttribute->mnRefCount--; + } + else + { + delete mpSdrLightingAttribute; + } + } + + bool SdrLightingAttribute::isDefault() const + { + return mpSdrLightingAttribute == ImpSdrLightingAttribute::get_global_default(); + } + + SdrLightingAttribute& SdrLightingAttribute::operator=(const SdrLightingAttribute& rCandidate) + { + if(rCandidate.mpSdrLightingAttribute != mpSdrLightingAttribute) + { + if(mpSdrLightingAttribute->mnRefCount) + { + mpSdrLightingAttribute->mnRefCount--; + } + else + { + delete mpSdrLightingAttribute; + } + + mpSdrLightingAttribute = rCandidate.mpSdrLightingAttribute; + mpSdrLightingAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const + { + if(rCandidate.mpSdrLightingAttribute == mpSdrLightingAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLightingAttribute == *mpSdrLightingAttribute); + } + + const basegfx::BColor& SdrLightingAttribute::getAmbientLight() const + { + return mpSdrLightingAttribute->getAmbientLight(); + } + + const ::std::vector< Sdr3DLightAttribute >& SdrLightingAttribute::getLightVector() const + { + return mpSdrLightingAttribute->getLightVector(); + } + + // color model solver + basegfx::BColor SdrLightingAttribute::solveColorModel( + const basegfx::B3DVector& rNormalInEyeCoordinates, + const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const + { + // initialize with emissive color + basegfx::BColor aRetval(rEmission); + + // take care of global ambient light + aRetval += mpSdrLightingAttribute->getAmbientLight() * rColor; + + // prepare light access. Is there a light? + const sal_uInt32 nLightCount(mpSdrLightingAttribute->getLightVector().size()); + + if(nLightCount && !rNormalInEyeCoordinates.equalZero()) + { + // prepare normal + basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates); + aEyeNormal.normalize(); + + for(sal_uInt32 a(0L); a < nLightCount; a++) + { + const Sdr3DLightAttribute& rLight(mpSdrLightingAttribute->getLightVector()[a]); + const double fCosFac(rLight.getDirection().scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac, 0.0)) + { + aRetval += ((rLight.getColor() * rColor) * fCosFac); + + if(rLight.getSpecular()) + { + // expand by (0.0, 0.0, 1.0) in Z + basegfx::B3DVector aSpecularNormal(rLight.getDirection().getX(), rLight.getDirection().getY(), rLight.getDirection().getZ() + 1.0); + aSpecularNormal.normalize(); + double fCosFac2(aSpecularNormal.scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac2, 0.0)) + { + fCosFac2 = pow(fCosFac2, (double)nSpecularIntensity); + aRetval += (rSpecular * fCosFac2); + } + } + } + } + } + + // clamp to color space before usage + aRetval.clamp(); + + return aRetval; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx b/drawinglayer/source/attribute/sdrlineattribute.cxx new file mode 100644 index 000000000000..1850d919069f --- /dev/null +++ b/drawinglayer/source/attribute/sdrlineattribute.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <basegfx/color/bcolor.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // line definitions + basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines + double mfWidth; // 1/100th mm, 0.0==hair + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // color of line + ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern + double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + + ImpSdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mnRefCount(0), + meJoin(eJoin), + mfWidth(fWidth), + mfTransparence(fTransparence), + maColor(rColor), + maDotDashArray(rDotDashArray), + mfFullDotDashLen(fFullDotDashLen) + { + } + + ImpSdrLineAttribute(const basegfx::BColor& rColor) + : mnRefCount(0), + meJoin(basegfx::B2DLINEJOIN_NONE), + mfWidth(0.0), + mfTransparence(0.0), + maColor(rColor), + maDotDashArray(), + mfFullDotDashLen(0.0) + { + } + + // data read access + basegfx::B2DLineJoin getJoin() const { return meJoin; } + double getWidth() const { return mfWidth; } + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + double getFullDotDashLen() const { return mfFullDotDashLen; } + + bool operator==(const ImpSdrLineAttribute& rCandidate) const + { + return (getJoin() == rCandidate.getJoin() + && getWidth() == rCandidate.getWidth() + && getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor() + && getDotDashArray() == rCandidate.getDotDashArray()); + } + + static ImpSdrLineAttribute* get_global_default() + { + static ImpSdrLineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLineAttribute( + basegfx::B2DLINEJOIN_ROUND, + 0.0, + 0.0, + basegfx::BColor(), + std::vector< double >(), + 0.0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLineAttribute::SdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mpSdrLineAttribute(new ImpSdrLineAttribute( + eJoin, fWidth, fTransparence, rColor, rDotDashArray, fFullDotDashLen)) + { + } + + SdrLineAttribute::SdrLineAttribute( + const basegfx::BColor& rColor) + : mpSdrLineAttribute(new ImpSdrLineAttribute(rColor)) + { + } + + SdrLineAttribute::SdrLineAttribute() + : mpSdrLineAttribute(ImpSdrLineAttribute::get_global_default()) + { + mpSdrLineAttribute->mnRefCount++; + } + + SdrLineAttribute::SdrLineAttribute(const SdrLineAttribute& rCandidate) + : mpSdrLineAttribute(rCandidate.mpSdrLineAttribute) + { + mpSdrLineAttribute->mnRefCount++; + } + + SdrLineAttribute::~SdrLineAttribute() + { + if(mpSdrLineAttribute->mnRefCount) + { + mpSdrLineAttribute->mnRefCount--; + } + else + { + delete mpSdrLineAttribute; + } + } + + bool SdrLineAttribute::isDefault() const + { + return mpSdrLineAttribute == ImpSdrLineAttribute::get_global_default(); + } + + SdrLineAttribute& SdrLineAttribute::operator=(const SdrLineAttribute& rCandidate) + { + if(rCandidate.mpSdrLineAttribute != mpSdrLineAttribute) + { + if(mpSdrLineAttribute->mnRefCount) + { + mpSdrLineAttribute->mnRefCount--; + } + else + { + delete mpSdrLineAttribute; + } + + mpSdrLineAttribute = rCandidate.mpSdrLineAttribute; + mpSdrLineAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const + { + if(rCandidate.mpSdrLineAttribute == mpSdrLineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLineAttribute == *mpSdrLineAttribute); + } + + basegfx::B2DLineJoin SdrLineAttribute::getJoin() const + { + return mpSdrLineAttribute->getJoin(); + } + + double SdrLineAttribute::getWidth() const + { + return mpSdrLineAttribute->getWidth(); + } + + double SdrLineAttribute::getTransparence() const + { + return mpSdrLineAttribute->getTransparence(); + } + + const basegfx::BColor& SdrLineAttribute::getColor() const + { + return mpSdrLineAttribute->getColor(); + } + + const ::std::vector< double >& SdrLineAttribute::getDotDashArray() const + { + return mpSdrLineAttribute->getDotDashArray(); + } + + double SdrLineAttribute::getFullDotDashLen() const + { + return mpSdrLineAttribute->getFullDotDashLen(); + } + + bool SdrLineAttribute::isDashed() const + { + return (0L != getDotDashArray().size()); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx new file mode 100644 index 000000000000..ce85bdff5678 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLineStartEndAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // line arrow definitions + basegfx::B2DPolyPolygon maStartPolyPolygon; // start Line PolyPolygon + basegfx::B2DPolyPolygon maEndPolyPolygon; // end Line PolyPolygon + double mfStartWidth; // 1/100th mm + double mfEndWidth; // 1/100th mm + + // bitfield + unsigned mbStartActive : 1L; // start of Line is active + unsigned mbEndActive : 1L; // end of Line is active + unsigned mbStartCentered : 1L; // Line is centered on line start point + unsigned mbEndCentered : 1L; // Line is centered on line end point + + ImpSdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered) + : mnRefCount(0), + maStartPolyPolygon(rStartPolyPolygon), + maEndPolyPolygon(rEndPolyPolygon), + mfStartWidth(fStartWidth), + mfEndWidth(fEndWidth), + mbStartActive(bStartActive), + mbEndActive(bEndActive), + mbStartCentered(bStartCentered), + mbEndCentered(bEndCentered) + { + } + + // data read access + const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; } + const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; } + double getStartWidth() const { return mfStartWidth; } + double getEndWidth() const { return mfEndWidth; } + bool isStartActive() const { return mbStartActive; } + bool isEndActive() const { return mbEndActive; } + bool isStartCentered() const { return mbStartCentered; } + bool isEndCentered() const { return mbEndCentered; } + + bool operator==(const ImpSdrLineStartEndAttribute& rCandidate) const + { + return (getStartPolyPolygon() == rCandidate.getStartPolyPolygon() + && getEndPolyPolygon() == rCandidate.getEndPolyPolygon() + && getStartWidth() == rCandidate.getStartWidth() + && getEndWidth() == rCandidate.getEndWidth() + && isStartActive() == rCandidate.isStartActive() + && isEndActive() == rCandidate.isEndActive() + && isStartCentered() == rCandidate.isStartCentered() + && isEndCentered() == rCandidate.isEndCentered()); + } + + static ImpSdrLineStartEndAttribute* get_global_default() + { + static ImpSdrLineStartEndAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLineStartEndAttribute( + basegfx::B2DPolyPolygon(), + basegfx::B2DPolyPolygon(), + 0.0, + 0.0, + false, + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLineStartEndAttribute::SdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered) + : mpSdrLineStartEndAttribute(new ImpSdrLineStartEndAttribute( + rStartPolyPolygon, rEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered)) + { + } + + SdrLineStartEndAttribute::SdrLineStartEndAttribute() + : mpSdrLineStartEndAttribute(ImpSdrLineStartEndAttribute::get_global_default()) + { + mpSdrLineStartEndAttribute->mnRefCount++; + } + + SdrLineStartEndAttribute::SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate) + : mpSdrLineStartEndAttribute(rCandidate.mpSdrLineStartEndAttribute) + { + mpSdrLineStartEndAttribute->mnRefCount++; + } + + SdrLineStartEndAttribute::~SdrLineStartEndAttribute() + { + if(mpSdrLineStartEndAttribute->mnRefCount) + { + mpSdrLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpSdrLineStartEndAttribute; + } + } + + bool SdrLineStartEndAttribute::isDefault() const + { + return mpSdrLineStartEndAttribute == ImpSdrLineStartEndAttribute::get_global_default(); + } + + SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(const SdrLineStartEndAttribute& rCandidate) + { + if(rCandidate.mpSdrLineStartEndAttribute != mpSdrLineStartEndAttribute) + { + if(mpSdrLineStartEndAttribute->mnRefCount) + { + mpSdrLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpSdrLineStartEndAttribute; + } + + mpSdrLineStartEndAttribute = rCandidate.mpSdrLineStartEndAttribute; + mpSdrLineStartEndAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const + { + if(rCandidate.mpSdrLineStartEndAttribute == mpSdrLineStartEndAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLineStartEndAttribute == *mpSdrLineStartEndAttribute); + } + + const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getStartPolyPolygon() const + { + return mpSdrLineStartEndAttribute->getStartPolyPolygon(); + } + + const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getEndPolyPolygon() const + { + return mpSdrLineStartEndAttribute->getEndPolyPolygon(); + } + + double SdrLineStartEndAttribute::getStartWidth() const + { + return mpSdrLineStartEndAttribute->getStartWidth(); + } + + double SdrLineStartEndAttribute::getEndWidth() const + { + return mpSdrLineStartEndAttribute->getEndWidth(); + } + + bool SdrLineStartEndAttribute::isStartActive() const + { + return mpSdrLineStartEndAttribute->isStartActive(); + } + + bool SdrLineStartEndAttribute::isEndActive() const + { + return mpSdrLineStartEndAttribute->isEndActive(); + } + + bool SdrLineStartEndAttribute::isStartCentered() const + { + return mpSdrLineStartEndAttribute->isStartCentered(); + } + + bool SdrLineStartEndAttribute::isEndCentered() const + { + return mpSdrLineStartEndAttribute->isEndCentered(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrobjectattribute3d.cxx b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx new file mode 100644 index 000000000000..a51e333236bc --- /dev/null +++ b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx @@ -0,0 +1,292 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrobjectattribute3d.hxx> +#include <drawinglayer/attribute/materialattribute3d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdr3DObjectAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D object attribute definitions + ::com::sun::star::drawing::NormalsKind maNormalsKind; // normals type (0..2) + ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2) + ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2) + ::com::sun::star::drawing::TextureKind2 maTextureKind; // texture kind (see uno API) + ::com::sun::star::drawing::TextureMode maTextureMode; // texture kind (see uno API) + MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity + + // bitfield + unsigned mbNormalsInvert : 1; // invert normals + unsigned mbDoubleSided : 1; // surfaces are double sided + unsigned mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene + unsigned mbTextureFilter : 1; // filter texture to make more smooth + unsigned mbReducedLineGeometry : 1; // use reduced line geometry (object specific) + + ImpSdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry) + : mnRefCount(0), + maNormalsKind(aNormalsKind), + maTextureProjectionX(aTextureProjectionX), + maTextureProjectionY(aTextureProjectionY), + maTextureKind(aTextureKind), + maTextureMode(aTextureMode), + maMaterial(rMaterial), + mbNormalsInvert(bNormalsInvert), + mbDoubleSided(bDoubleSided), + mbShadow3D(bShadow3D), + mbTextureFilter(bTextureFilter), + mbReducedLineGeometry(bReducedLineGeometry) + { + } + + // data read access + ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; } + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; } + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; } + ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; } + ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; } + const MaterialAttribute3D& getMaterial() const { return maMaterial; } + bool getNormalsInvert() const { return mbNormalsInvert; } + bool getDoubleSided() const { return mbDoubleSided; } + bool getShadow3D() const { return mbShadow3D; } + bool getTextureFilter() const { return mbTextureFilter; } + bool getReducedLineGeometry() const { return mbReducedLineGeometry; } + + bool operator==(const ImpSdr3DObjectAttribute& rCandidate) const + { + return (getNormalsKind() == rCandidate.getNormalsKind() + && getTextureProjectionX() == rCandidate.getTextureProjectionX() + && getTextureProjectionY() == rCandidate.getTextureProjectionY() + && getTextureKind() == rCandidate.getTextureKind() + && getTextureMode() == rCandidate.getTextureMode() + && getMaterial() == rCandidate.getMaterial() + && getNormalsInvert() == rCandidate.getNormalsInvert() + && getDoubleSided() == rCandidate.getDoubleSided() + && getShadow3D() == rCandidate.getShadow3D() + && getTextureFilter() == rCandidate.getTextureFilter() + && getReducedLineGeometry() == rCandidate.getReducedLineGeometry()); + } + + static ImpSdr3DObjectAttribute* get_global_default() + { + static ImpSdr3DObjectAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind_SPECIFIC, + ::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC, + ::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC, + ::com::sun::star::drawing::TextureKind2_LUMINANCE, + ::com::sun::star::drawing::TextureMode_REPLACE, + MaterialAttribute3D(), + false, + false, + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + Sdr3DObjectAttribute::Sdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry) + : mpSdr3DObjectAttribute(new ImpSdr3DObjectAttribute( + aNormalsKind, aTextureProjectionX, aTextureProjectionY, aTextureKind, aTextureMode, + rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry)) + { + } + + Sdr3DObjectAttribute::Sdr3DObjectAttribute() + : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute::get_global_default()) + { + mpSdr3DObjectAttribute->mnRefCount++; + } + + Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate) + : mpSdr3DObjectAttribute(rCandidate.mpSdr3DObjectAttribute) + { + mpSdr3DObjectAttribute->mnRefCount++; + } + + Sdr3DObjectAttribute::~Sdr3DObjectAttribute() + { + if(mpSdr3DObjectAttribute->mnRefCount) + { + mpSdr3DObjectAttribute->mnRefCount--; + } + else + { + delete mpSdr3DObjectAttribute; + } + } + + bool Sdr3DObjectAttribute::isDefault() const + { + return mpSdr3DObjectAttribute == ImpSdr3DObjectAttribute::get_global_default(); + } + + Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute& rCandidate) + { + if(rCandidate.mpSdr3DObjectAttribute != mpSdr3DObjectAttribute) + { + if(mpSdr3DObjectAttribute->mnRefCount) + { + mpSdr3DObjectAttribute->mnRefCount--; + } + else + { + delete mpSdr3DObjectAttribute; + } + + mpSdr3DObjectAttribute = rCandidate.mpSdr3DObjectAttribute; + mpSdr3DObjectAttribute->mnRefCount++; + } + + return *this; + } + + bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const + { + if(rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdr3DObjectAttribute == *mpSdr3DObjectAttribute); + } + + ::com::sun::star::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const + { + return mpSdr3DObjectAttribute->getNormalsKind(); + } + + ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const + { + return mpSdr3DObjectAttribute->getTextureProjectionX(); + } + + ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const + { + return mpSdr3DObjectAttribute->getTextureProjectionY(); + } + + ::com::sun::star::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const + { + return mpSdr3DObjectAttribute->getTextureKind(); + } + + ::com::sun::star::drawing::TextureMode Sdr3DObjectAttribute::getTextureMode() const + { + return mpSdr3DObjectAttribute->getTextureMode(); + } + + const MaterialAttribute3D& Sdr3DObjectAttribute::getMaterial() const + { + return mpSdr3DObjectAttribute->getMaterial(); + } + + bool Sdr3DObjectAttribute::getNormalsInvert() const + { + return mpSdr3DObjectAttribute->getNormalsInvert(); + } + + bool Sdr3DObjectAttribute::getDoubleSided() const + { + return mpSdr3DObjectAttribute->getDoubleSided(); + } + + bool Sdr3DObjectAttribute::getShadow3D() const + { + return mpSdr3DObjectAttribute->getShadow3D(); + } + + bool Sdr3DObjectAttribute::getTextureFilter() const + { + return mpSdr3DObjectAttribute->getTextureFilter(); + } + + bool Sdr3DObjectAttribute::getReducedLineGeometry() const + { + return mpSdr3DObjectAttribute->getReducedLineGeometry(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx new file mode 100644 index 000000000000..141f4c904873 --- /dev/null +++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrSceneAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D scene attribute definitions + double mfDistance; + double mfShadowSlant; + ::com::sun::star::drawing::ProjectionMode maProjectionMode; + ::com::sun::star::drawing::ShadeMode maShadeMode; + + // bitfield + unsigned mbTwoSidedLighting : 1; + + public: + ImpSdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting) + : mnRefCount(0), + mfDistance(fDistance), + mfShadowSlant(fShadowSlant), + maProjectionMode(aProjectionMode), + maShadeMode(aShadeMode), + mbTwoSidedLighting(bTwoSidedLighting) + { + } + + // data read access + double getDistance() const { return mfDistance; } + double getShadowSlant() const { return mfShadowSlant; } + ::com::sun::star::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; } + ::com::sun::star::drawing::ShadeMode getShadeMode() const { return maShadeMode; } + bool getTwoSidedLighting() const { return mbTwoSidedLighting; } + + bool operator==(const ImpSdrSceneAttribute& rCandidate) const + { + return (getDistance() == rCandidate.getDistance() + && getShadowSlant() == rCandidate.getShadowSlant() + && getProjectionMode() == rCandidate.getProjectionMode() + && getShadeMode() == rCandidate.getShadeMode() + && getTwoSidedLighting() == rCandidate.getTwoSidedLighting()); + } + + static ImpSdrSceneAttribute* get_global_default() + { + static ImpSdrSceneAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrSceneAttribute( + 0.0, 0.0, + ::com::sun::star::drawing::ProjectionMode_PARALLEL, + ::com::sun::star::drawing::ShadeMode_FLAT, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrSceneAttribute::SdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting) + : mpSdrSceneAttribute(new ImpSdrSceneAttribute( + fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting)) + { + } + + SdrSceneAttribute::SdrSceneAttribute() + : mpSdrSceneAttribute(ImpSdrSceneAttribute::get_global_default()) + { + mpSdrSceneAttribute->mnRefCount++; + } + + SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute& rCandidate) + : mpSdrSceneAttribute(rCandidate.mpSdrSceneAttribute) + { + mpSdrSceneAttribute->mnRefCount++; + } + + SdrSceneAttribute::~SdrSceneAttribute() + { + if(mpSdrSceneAttribute->mnRefCount) + { + mpSdrSceneAttribute->mnRefCount--; + } + else + { + delete mpSdrSceneAttribute; + } + } + + bool SdrSceneAttribute::isDefault() const + { + return mpSdrSceneAttribute == ImpSdrSceneAttribute::get_global_default(); + } + + SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute& rCandidate) + { + if(rCandidate.mpSdrSceneAttribute != mpSdrSceneAttribute) + { + if(mpSdrSceneAttribute->mnRefCount) + { + mpSdrSceneAttribute->mnRefCount--; + } + else + { + delete mpSdrSceneAttribute; + } + + mpSdrSceneAttribute = rCandidate.mpSdrSceneAttribute; + mpSdrSceneAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const + { + if(rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrSceneAttribute == *mpSdrSceneAttribute); + } + + double SdrSceneAttribute::getDistance() const + { + return mpSdrSceneAttribute->getDistance(); + } + + double SdrSceneAttribute::getShadowSlant() const + { + return mpSdrSceneAttribute->getShadowSlant(); + } + + ::com::sun::star::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const + { + return mpSdrSceneAttribute->getProjectionMode(); + } + + ::com::sun::star::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const + { + return mpSdrSceneAttribute->getShadeMode(); + } + + bool SdrSceneAttribute::getTwoSidedLighting() const + { + return mpSdrSceneAttribute->getTwoSidedLighting(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx b/drawinglayer/source/attribute/sdrshadowattribute.cxx new file mode 100644 index 000000000000..9b31b5c6d348 --- /dev/null +++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/color/bcolor.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrShadowAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // shadow definitions + basegfx::B2DVector maOffset; // shadow offset 1/100th mm + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // color of shadow + + ImpSdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor) + : mnRefCount(0), + maOffset(rOffset), + mfTransparence(fTransparence), + maColor(rColor) + { + } + + // data read access + const basegfx::B2DVector& getOffset() const { return maOffset; } + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + + bool operator==(const ImpSdrShadowAttribute& rCandidate) const + { + return (getOffset() == rCandidate.getOffset() + && getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor()); + } + + static ImpSdrShadowAttribute* get_global_default() + { + static ImpSdrShadowAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrShadowAttribute( + basegfx::B2DVector(), + 0.0, + basegfx::BColor()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrShadowAttribute::SdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor) + : mpSdrShadowAttribute(new ImpSdrShadowAttribute( + rOffset, fTransparence, rColor)) + { + } + + SdrShadowAttribute::SdrShadowAttribute() + : mpSdrShadowAttribute(ImpSdrShadowAttribute::get_global_default()) + { + mpSdrShadowAttribute->mnRefCount++; + } + + SdrShadowAttribute::SdrShadowAttribute(const SdrShadowAttribute& rCandidate) + : mpSdrShadowAttribute(rCandidate.mpSdrShadowAttribute) + { + mpSdrShadowAttribute->mnRefCount++; + } + + SdrShadowAttribute::~SdrShadowAttribute() + { + if(mpSdrShadowAttribute->mnRefCount) + { + mpSdrShadowAttribute->mnRefCount--; + } + else + { + delete mpSdrShadowAttribute; + } + } + + bool SdrShadowAttribute::isDefault() const + { + return mpSdrShadowAttribute == ImpSdrShadowAttribute::get_global_default(); + } + + SdrShadowAttribute& SdrShadowAttribute::operator=(const SdrShadowAttribute& rCandidate) + { + if(rCandidate.mpSdrShadowAttribute != mpSdrShadowAttribute) + { + if(mpSdrShadowAttribute->mnRefCount) + { + mpSdrShadowAttribute->mnRefCount--; + } + else + { + delete mpSdrShadowAttribute; + } + + mpSdrShadowAttribute = rCandidate.mpSdrShadowAttribute; + mpSdrShadowAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const + { + if(rCandidate.mpSdrShadowAttribute == mpSdrShadowAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrShadowAttribute == *mpSdrShadowAttribute); + } + + const basegfx::B2DVector& SdrShadowAttribute::getOffset() const + { + return mpSdrShadowAttribute->getOffset(); + } + + double SdrShadowAttribute::getTransparence() const + { + return mpSdrShadowAttribute->getTransparence(); + } + + const basegfx::BColor& SdrShadowAttribute::getColor() const + { + return mpSdrShadowAttribute->getColor(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/strokeattribute.cxx b/drawinglayer/source/attribute/strokeattribute.cxx index ece326a4579e..3c2a5a2bc18f 100644 --- a/drawinglayer/source/attribute/strokeattribute.cxx +++ b/drawinglayer/source/attribute/strokeattribute.cxx @@ -37,16 +37,143 @@ namespace drawinglayer { namespace attribute { - double StrokeAttribute::getFullDotDashLen() const + class ImpStrokeAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern + double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + + ImpStrokeAttribute( + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mnRefCount(0), + maDotDashArray(rDotDashArray), + mfFullDotDashLen(fFullDotDashLen) + { + } + + // data read access + const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + double getFullDotDashLen() const + { + if(0.0 == mfFullDotDashLen && maDotDashArray.size()) + { + // calculate length on demand + const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0)); + const_cast< ImpStrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated; + } + + return mfFullDotDashLen; + } + + bool operator==(const ImpStrokeAttribute& rCandidate) const + { + return (getDotDashArray() == rCandidate.getDotDashArray() + && getFullDotDashLen() == rCandidate.getFullDotDashLen()); + } + + static ImpStrokeAttribute* get_global_default() + { + static ImpStrokeAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpStrokeAttribute( + std::vector< double >(), + 0.0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + StrokeAttribute::StrokeAttribute( + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mpStrokeAttribute(new ImpStrokeAttribute( + rDotDashArray, fFullDotDashLen)) + { + } + + StrokeAttribute::StrokeAttribute() + : mpStrokeAttribute(ImpStrokeAttribute::get_global_default()) + { + mpStrokeAttribute->mnRefCount++; + } + + StrokeAttribute::StrokeAttribute(const StrokeAttribute& rCandidate) + : mpStrokeAttribute(rCandidate.mpStrokeAttribute) + { + mpStrokeAttribute->mnRefCount++; + } + + StrokeAttribute::~StrokeAttribute() + { + if(mpStrokeAttribute->mnRefCount) + { + mpStrokeAttribute->mnRefCount--; + } + else + { + delete mpStrokeAttribute; + } + } + + bool StrokeAttribute::isDefault() const + { + return mpStrokeAttribute == ImpStrokeAttribute::get_global_default(); + } + + StrokeAttribute& StrokeAttribute::operator=(const StrokeAttribute& rCandidate) + { + if(rCandidate.mpStrokeAttribute != mpStrokeAttribute) + { + if(mpStrokeAttribute->mnRefCount) + { + mpStrokeAttribute->mnRefCount--; + } + else + { + delete mpStrokeAttribute; + } + + mpStrokeAttribute = rCandidate.mpStrokeAttribute; + mpStrokeAttribute->mnRefCount++; + } + + return *this; + } + + bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) const { - if(0.0 == mfFullDotDashLen && maDotDashArray.size()) + if(rCandidate.mpStrokeAttribute == mpStrokeAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) { - // calculate length on demand - const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0)); - const_cast< StrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated; + return false; } - return mfFullDotDashLen; + return (*rCandidate.mpStrokeAttribute == *mpStrokeAttribute); + } + + const ::std::vector< double >& StrokeAttribute::getDotDashArray() const + { + return mpStrokeAttribute->getDotDashArray(); + } + + double StrokeAttribute::getFullDotDashLen() const + { + return mpStrokeAttribute->getFullDotDashLen(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 7cb03954812a..f3f6dc7cc953 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -305,6 +305,22 @@ namespace drawinglayer impInterpretPropertyValues(rViewParameters); } + ImpViewInformation2D() + : mnRefCount(0), + maObjectTransformation(), + maViewTransformation(), + maObjectToViewTransformation(), + maInverseObjectToViewTransformation(), + maViewport(), + maDiscreteViewport(), + mxVisualizedPage(), + mfViewTime(), + mbReducedDisplayQuality(false), + mxViewInformation(), + mxExtendedInformation() + { + } + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; @@ -402,6 +418,21 @@ namespace drawinglayer && mfViewTime == rCandidate.mfViewTime && mxExtendedInformation == rCandidate.mxExtendedInformation); } + + static ImpViewInformation2D* get_global_default() + { + static ImpViewInformation2D* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpViewInformation2D(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } }; } // end of anonymous namespace } // end of namespace drawinglayer @@ -434,6 +465,12 @@ namespace drawinglayer { } + ViewInformation2D::ViewInformation2D() + : mpViewInformation2D(ImpViewInformation2D::get_global_default()) + { + mpViewInformation2D->mnRefCount++; + } + ViewInformation2D::ViewInformation2D(const ViewInformation2D& rCandidate) : mpViewInformation2D(rCandidate.mpViewInformation2D) { @@ -455,6 +492,11 @@ namespace drawinglayer } } + bool ViewInformation2D::isDefault() const + { + return mpViewInformation2D == ImpViewInformation2D::get_global_default(); + } + ViewInformation2D& ViewInformation2D::operator=(const ViewInformation2D& rCandidate) { ::osl::Mutex m_mutex; @@ -481,6 +523,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpViewInformation2D == *mpViewInformation2D); } diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx index 3d4ee30cee33..3ce81680f7c1 100644 --- a/drawinglayer/source/geometry/viewinformation3d.cxx +++ b/drawinglayer/source/geometry/viewinformation3d.cxx @@ -387,6 +387,18 @@ namespace drawinglayer impInterpretPropertyValues(rViewParameters); } + ImpViewInformation3D() + : mnRefCount(0), + maObjectTransformation(), + maOrientation(), + maProjection(), + maDeviceToView(), + mfViewTime(), + mxViewInformation(), + mxExtendedInformation() + { + } + const basegfx::B3DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::B3DHomMatrix& getOrientation() const { return maOrientation; } const basegfx::B3DHomMatrix& getProjection() const { return maProjection; } @@ -432,6 +444,21 @@ namespace drawinglayer && mfViewTime == rCandidate.mfViewTime && mxExtendedInformation == rCandidate.mxExtendedInformation); } + + static ImpViewInformation3D* get_global_default() + { + static ImpViewInformation3D* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpViewInformation3D(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } }; } // end of anonymous namespace } // end of namespace drawinglayer @@ -449,7 +476,9 @@ namespace drawinglayer const basegfx::B3DHomMatrix& rDeviceToView, double fViewTime, const uno::Sequence< beans::PropertyValue >& rExtendedParameters) - : mpViewInformation3D(new ImpViewInformation3D(rObjectObjectTransformation, rOrientation, rProjection, rDeviceToView, fViewTime, rExtendedParameters)) + : mpViewInformation3D(new ImpViewInformation3D( + rObjectObjectTransformation, rOrientation, rProjection, + rDeviceToView, fViewTime, rExtendedParameters)) { } @@ -458,6 +487,12 @@ namespace drawinglayer { } + ViewInformation3D::ViewInformation3D() + : mpViewInformation3D(ImpViewInformation3D::get_global_default()) + { + mpViewInformation3D->mnRefCount++; + } + ViewInformation3D::ViewInformation3D(const ViewInformation3D& rCandidate) : mpViewInformation3D(rCandidate.mpViewInformation3D) { @@ -479,6 +514,11 @@ namespace drawinglayer } } + bool ViewInformation3D::isDefault() const + { + return mpViewInformation3D == ImpViewInformation3D::get_global_default(); + } + ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D& rCandidate) { ::osl::Mutex m_mutex; @@ -505,6 +545,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpViewInformation3D == *mpViewInformation3D); } diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx index 3fa5c9a90d7d..66497a1aef5e 100644 --- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx @@ -48,46 +48,54 @@ namespace drawinglayer { Primitive2DSequence FillBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel()); Primitive2DSequence aRetval; - // is there a tile with some size at all? - if(aTileSizePixel.getWidth() && aTileSizePixel.getHeight()) + if(!getFillBitmap().isDefault()) { - if(getFillBitmap().getTiling()) - { - // get object range and create tiling matrices - ::std::vector< basegfx::B2DHomMatrix > aMatrices; - texture::GeoTexSvxTiled aTiling(getFillBitmap().getTopLeft(), getFillBitmap().getSize()); - aTiling.appendTransformations(aMatrices); - - // resize result - aRetval.realloc(aMatrices.size()); + const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel()); - // create one primitive for each matrix - for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + // is there a tile with some size at all? + if(aTileSizePixel.getWidth() && aTileSizePixel.getHeight()) + { + if(getFillBitmap().getTiling()) { - basegfx::B2DHomMatrix aNewMatrix = aMatrices[a]; - aNewMatrix *= getTransformation(); - - // create bitmap primitive and add to result - const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix)); - aRetval[a] = xRef; + // get object range and create tiling matrices + ::std::vector< basegfx::B2DHomMatrix > aMatrices; + texture::GeoTexSvxTiled aTiling(getFillBitmap().getTopLeft(), getFillBitmap().getSize()); + aTiling.appendTransformations(aMatrices); + + // resize result + aRetval.realloc(aMatrices.size()); + + // create one primitive for each matrix + for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + { + basegfx::B2DHomMatrix aNewMatrix = aMatrices[a]; + aNewMatrix *= getTransformation(); + + // create bitmap primitive and add to result + const Primitive2DReference xRef( + new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix)); + + aRetval[a] = xRef; + } + } + else + { + // create new object transform + basegfx::B2DHomMatrix aObjectTransform; + aObjectTransform.set(0L, 0L, getFillBitmap().getSize().getX()); + aObjectTransform.set(1L, 1L, getFillBitmap().getSize().getY()); + aObjectTransform.set(0L, 2L, getFillBitmap().getTopLeft().getX()); + aObjectTransform.set(1L, 2L, getFillBitmap().getTopLeft().getY()); + aObjectTransform *= getTransformation(); + + // create bitmap primitive and add exclusive to decomposition (hand over ownership) + const Primitive2DReference xRef( + new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform)); + + aRetval = Primitive2DSequence(&xRef, 1L); } - } - else - { - // create new object transform - basegfx::B2DHomMatrix aObjectTransform; - aObjectTransform.set(0L, 0L, getFillBitmap().getSize().getX()); - aObjectTransform.set(1L, 1L, getFillBitmap().getSize().getY()); - aObjectTransform.set(0L, 2L, getFillBitmap().getTopLeft().getX()); - aObjectTransform.set(1L, 2L, getFillBitmap().getTopLeft().getY()); - aObjectTransform *= getTransformation(); - - // create bitmap primitive and add exclusive to decomposition (hand over ownership) - const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform)); - aRetval = Primitive2DSequence(&xRef, 1L); } } @@ -119,7 +127,7 @@ namespace drawinglayer basegfx::B2DRange FillBitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { // return range of it - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(getTransformation()); return basegfx::tools::getRange(aPolygon); } diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 47c64be3f53f..c2d097d74a3b 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -54,10 +54,10 @@ namespace drawinglayer rColors.clear(); // make sure steps is not too high/low - const basegfx::BColor aStart(maFillGradient.getStartColor()); - const basegfx::BColor aEnd(maFillGradient.getEndColor()); + const basegfx::BColor aStart(getFillGradient().getStartColor()); + const basegfx::BColor aEnd(getFillGradient().getEndColor()); const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); - sal_uInt32 nSteps(maFillGradient.getSteps()); + sal_uInt32 nSteps(getFillGradient().getSteps()); if(nSteps == 0) { @@ -74,46 +74,46 @@ namespace drawinglayer nSteps = nMaxSteps; } - switch(maFillGradient.getStyle()) + switch(getFillGradient().getStyle()) { case attribute::GRADIENTSTYLE_LINEAR: { - texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_AXIAL: { - texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RADIAL: { - texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY()); + texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_SQUARE: { - texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RECT: { - texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; @@ -210,15 +210,15 @@ namespace drawinglayer // prepare shape of the Unit Polygon basegfx::B2DPolygon aUnitPolygon; - if(attribute::GRADIENTSTYLE_RADIAL == maFillGradient.getStyle() - || attribute::GRADIENTSTYLE_ELLIPTICAL == maFillGradient.getStyle()) + if(attribute::GRADIENTSTYLE_RADIAL == getFillGradient().getStyle() + || attribute::GRADIENTSTYLE_ELLIPTICAL == getFillGradient().getStyle()) { const basegfx::B2DPoint aCircleCenter(0.5, 0.5); aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // get the transform matrices and colors (where colors @@ -245,7 +245,15 @@ namespace drawinglayer // that the rings will not overlap. This is useful fir the old XOR-paint // 'trick' of VCL which is recorded in Metafiles; so this version may be // used from the MetafilePrimitive2D in it's decomposition. - return createFill(true); + + if(!getFillGradient().isDefault()) + { + return createFill(true); + } + else + { + return Primitive2DSequence(); + } } FillGradientPrimitive2D::FillGradientPrimitive2D( @@ -264,7 +272,7 @@ namespace drawinglayer const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive; return (getObjectRange() == rCompare.getObjectRange() - && maFillGradient == rCompare.maFillGradient); + && getFillGradient() == rCompare.getFillGradient()); } return false; diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index 7d536f5c0443..b606f4a286fc 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -49,65 +49,73 @@ namespace drawinglayer { Primitive2DSequence FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create hatch - const basegfx::BColor aHatchColor(maFillHatch.getColor()); - const double fAngle(-maFillHatch.getAngle()); - ::std::vector< basegfx::B2DHomMatrix > aMatrices; + Primitive2DSequence aRetval; - // get hatch transformations - switch(maFillHatch.getStyle()) + if(!getFillHatch().isDefault()) { - case attribute::HATCHSTYLE_TRIPLE: - { - // rotated 45 degrees - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI4); - aHatch.appendTransformations(aMatrices); + // create hatch + const basegfx::BColor aHatchColor(getFillHatch().getColor()); + const double fAngle(-getFillHatch().getAngle()); + ::std::vector< basegfx::B2DHomMatrix > aMatrices; - // fall-through by purpose - } - case attribute::HATCHSTYLE_DOUBLE: + // get hatch transformations + switch(getFillHatch().getStyle()) { - // rotated 90 degrees - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI2); - aHatch.appendTransformations(aMatrices); - - // fall-through by purpose + case attribute::HATCHSTYLE_TRIPLE: + { + // rotated 45 degrees + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle + F_PI4); + aHatch.appendTransformations(aMatrices); + + // fall-through by purpose + } + case attribute::HATCHSTYLE_DOUBLE: + { + // rotated 90 degrees + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle + F_PI2); + aHatch.appendTransformations(aMatrices); + + // fall-through by purpose + } + case attribute::HATCHSTYLE_SINGLE: + { + // angle as given + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle); + aHatch.appendTransformations(aMatrices); + } } - case attribute::HATCHSTYLE_SINGLE: - { - // angle as given - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle); - aHatch.appendTransformations(aMatrices); - } - } - // prepare return value - const bool bFillBackground(maFillHatch.isFillBackground()); - Primitive2DSequence aRetval(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); + // prepare return value + const bool bFillBackground(getFillHatch().isFillBackground()); + aRetval.realloc(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); - // evtl. create filled background - if(bFillBackground) - { - // create primitive for background - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), maBColor)); - aRetval[0L] = xRef; - } + // evtl. create filled background + if(bFillBackground) + { + // create primitive for background + const Primitive2DReference xRef( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect(getObjectRange())), getBColor())); + aRetval[0] = xRef; + } - // create primitives - const basegfx::B2DPoint aStart(0.0, 0.0); - const basegfx::B2DPoint aEnd(1.0, 0.0); + // create primitives + const basegfx::B2DPoint aStart(0.0, 0.0); + const basegfx::B2DPoint aEnd(1.0, 0.0); - for(sal_uInt32 a(0L); a < aMatrices.size(); a++) - { - const basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; - basegfx::B2DPolygon aNewLine; + for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + { + const basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; + basegfx::B2DPolygon aNewLine; - aNewLine.append(rMatrix * aStart); - aNewLine.append(rMatrix * aEnd); + aNewLine.append(rMatrix * aStart); + aNewLine.append(rMatrix * aEnd); - // create hairline - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); - aRetval[bFillBackground ? (a + 1L) : a] = xRef; + // create hairline + const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); + aRetval[bFillBackground ? (a + 1) : a] = xRef; + } } return aRetval; @@ -131,8 +139,8 @@ namespace drawinglayer const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive; return (getObjectRange() == rCompare.getObjectRange() - && maFillHatch == rCompare.maFillHatch - && maBColor == rCompare.maBColor); + && getFillHatch() == rCompare.getFillHatch() + && getBColor() == rCompare.getBColor()); } return false; diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 59fa3aa04778..1e26881c9757 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -764,9 +764,7 @@ namespace drawinglayer { // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1); - basegfx::B2DPolygon aMaskPolygon( - basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon()); aMaskPolygon.transform(aTransform); xPrimitive = Primitive2DReference( @@ -872,7 +870,7 @@ namespace drawinglayer else { // cropped got bigger, mask it with original object's bounds - basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createUnitPolygon()); aMaskPolyPolygon.transform(getTransform()); // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector diff --git a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx new file mode 100644 index 000000000000..2b3afeb0f8ed --- /dev/null +++ b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.cxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + HiddenGeometryPrimitive2D::HiddenGeometryPrimitive2D( + const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + basegfx::B2DRange HiddenGeometryPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + } + + Primitive2DSequence HiddenGeometryPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + return Primitive2DSequence(); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(HiddenGeometryPrimitive2D, PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index 87c6c15437e2..bca5805ae6eb 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -37,50 +37,51 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/alphaprimitive2d.obj \ - $(SLO)$/animatedprimitive2d.obj \ - $(SLO)$/baseprimitive2d.obj \ - $(SLO)$/backgroundcolorprimitive2d.obj \ - $(SLO)$/bitmapprimitive2d.obj \ - $(SLO)$/borderlineprimitive2d.obj \ - $(SLO)$/chartprimitive2d.obj \ - $(SLO)$/controlprimitive2d.obj \ - $(SLO)$/discretebitmapprimitive2d.obj \ - $(SLO)$/embedded3dprimitive2d.obj \ - $(SLO)$/epsprimitive2d.obj \ - $(SLO)$/fillbitmapprimitive2d.obj \ - $(SLO)$/fillgradientprimitive2d.obj \ - $(SLO)$/fillhatchprimitive2d.obj \ - $(SLO)$/graphicprimitive2d.obj \ - $(SLO)$/gridprimitive2d.obj \ - $(SLO)$/groupprimitive2d.obj \ - $(SLO)$/helplineprimitive2d.obj \ - $(SLO)$/hittestprimitive2d.obj \ - $(SLO)$/invertprimitive2d.obj \ - $(SLO)$/markerarrayprimitive2d.obj \ - $(SLO)$/pointarrayprimitive2d.obj \ - $(SLO)$/maskprimitive2d.obj \ - $(SLO)$/mediaprimitive2d.obj \ - $(SLO)$/metafileprimitive2d.obj \ - $(SLO)$/modifiedcolorprimitive2d.obj \ - $(SLO)$/pagepreviewprimitive2d.obj \ - $(SLO)$/polypolygonprimitive2d.obj \ - $(SLO)$/polygonprimitive2d.obj \ - $(SLO)$/primitivetools2d.obj \ - $(SLO)$/sceneprimitive2d.obj \ - $(SLO)$/shadowprimitive2d.obj \ - $(SLO)$/structuretagprimitive2d.obj \ - $(SLO)$/texteffectprimitive2d.obj \ - $(SLO)$/textenumsprimitive2d.obj \ - $(SLO)$/textlayoutdevice.obj \ - $(SLO)$/textlineprimitive2d.obj \ - $(SLO)$/textprimitive2d.obj \ - $(SLO)$/textstrikeoutprimitive2d.obj \ - $(SLO)$/textdecoratedprimitive2d.obj \ - $(SLO)$/texthierarchyprimitive2d.obj \ - $(SLO)$/transformprimitive2d.obj \ - $(SLO)$/unifiedalphaprimitive2d.obj \ - $(SLO)$/wallpaperprimitive2d.obj \ + $(SLO)$/transparenceprimitive2d.obj \ + $(SLO)$/animatedprimitive2d.obj \ + $(SLO)$/baseprimitive2d.obj \ + $(SLO)$/backgroundcolorprimitive2d.obj \ + $(SLO)$/bitmapprimitive2d.obj \ + $(SLO)$/borderlineprimitive2d.obj \ + $(SLO)$/chartprimitive2d.obj \ + $(SLO)$/controlprimitive2d.obj \ + $(SLO)$/discretebitmapprimitive2d.obj \ + $(SLO)$/embedded3dprimitive2d.obj \ + $(SLO)$/epsprimitive2d.obj \ + $(SLO)$/fillbitmapprimitive2d.obj \ + $(SLO)$/fillgradientprimitive2d.obj \ + $(SLO)$/fillhatchprimitive2d.obj \ + $(SLO)$/graphicprimitive2d.obj \ + $(SLO)$/gridprimitive2d.obj \ + $(SLO)$/groupprimitive2d.obj \ + $(SLO)$/helplineprimitive2d.obj \ + $(SLO)$/hiddengeometryprimitive2d.obj \ + $(SLO)$/invertprimitive2d.obj \ + $(SLO)$/markerarrayprimitive2d.obj \ + $(SLO)$/pointarrayprimitive2d.obj \ + $(SLO)$/maskprimitive2d.obj \ + $(SLO)$/mediaprimitive2d.obj \ + $(SLO)$/metafileprimitive2d.obj \ + $(SLO)$/modifiedcolorprimitive2d.obj \ + $(SLO)$/pagepreviewprimitive2d.obj \ + $(SLO)$/polypolygonprimitive2d.obj \ + $(SLO)$/polygonprimitive2d.obj \ + $(SLO)$/primitivetools2d.obj \ + $(SLO)$/sceneprimitive2d.obj \ + $(SLO)$/sdrdecompositiontools2d.obj \ + $(SLO)$/shadowprimitive2d.obj \ + $(SLO)$/structuretagprimitive2d.obj \ + $(SLO)$/texteffectprimitive2d.obj \ + $(SLO)$/textenumsprimitive2d.obj \ + $(SLO)$/textlayoutdevice.obj \ + $(SLO)$/textlineprimitive2d.obj \ + $(SLO)$/textprimitive2d.obj \ + $(SLO)$/textstrikeoutprimitive2d.obj \ + $(SLO)$/textdecoratedprimitive2d.obj \ + $(SLO)$/texthierarchyprimitive2d.obj \ + $(SLO)$/transformprimitive2d.obj \ + $(SLO)$/unifiedtransparenceprimitive2d.obj \ + $(SLO)$/wallpaperprimitive2d.obj \ $(SLO)$/wrongspellprimitive2d.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index 82af04b5ffe6..dc867171a9b9 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -38,6 +38,7 @@ #include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -50,9 +51,12 @@ namespace drawinglayer Primitive2DSequence xRetval(1); // create background object - basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createUnitPolygon()); aBackgroundPolygon.transform(getTransform()); - const Primitive2DReference xRefBackground(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aBackgroundPolygon), getBackgroundColor())); + const Primitive2DReference xRefBackground( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aBackgroundPolygon), + getBackgroundColor())); xRetval[0] = xRefBackground; // try to get graphic snapshot @@ -79,10 +83,13 @@ namespace drawinglayer basegfx::B2DRange aDestRange(aSourceRange); aDestRange.grow(-0.5 * fDiscreteSize); - if(::basegfx::fTools::equalZero(aDestRange.getWidth()) || ::basegfx::fTools::equalZero(aDestRange.getHeight())) + if(basegfx::fTools::equalZero(aDestRange.getWidth()) || basegfx::fTools::equalZero(aDestRange.getHeight())) { - // shrunk primitive has no content (zero size in X or Y), nothing to display, nothing to return - xRetval = Primitive2DSequence(); + // shrunk primitive has no content (zero size in X or Y), nothing to display. Still create + // invisible content for HitTest and BoundRect + const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(xRetval)); + + xRetval = Primitive2DSequence(&xHiddenLines, 1); } else { diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 7af4516eb14f..238c47419eb9 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -45,10 +45,10 @@ #include <drawinglayer/primitive2d/discretebitmapprimitive2d.hxx> #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> #include <vcl/salbtype.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> #include <vcl/svapp.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <basegfx/polygon/b2dpolygonclipper.hxx> @@ -581,7 +581,14 @@ namespace drawinglayer Primitive2DSequence NonOverlappingFillGradientPrimitive2D::create2DDecomposition( const geometry::ViewInformation2D& /*rViewInformation*/) const { - return createFill(false); + if(!getFillGradient().isDefault()) + { + return createFill(false); + } + else + { + return Primitive2DSequence(); + } } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -833,7 +840,7 @@ namespace } /** helper to create a regular BotmapEx from a MaskAction (definitions - which use a bitmap without alpha but define one of the colors as + which use a bitmap without transparence but define one of the colors as transparent) */ BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) @@ -966,7 +973,42 @@ namespace TargetHolders& rTargetHolders, PropertyHolders& rPropertyHolders) { - // process evtl. created primitives which belong to the current region settings + const bool bNewActive(pRegion && !pRegion->IsEmpty()); + + // #i108636# The handlig of new ClipRegions was not done as good as possible + // in the first version of this interpreter; e.g. when a ClipRegion was set + // initially and then using a lot of push/pop actions, the pop always leads + // to setting a 'new' ClipRegion which indeed is the return to the ClipRegion + // of the properties next on the stack. + // This ClipRegion is identical to the current one, so there is no need to + // create a MaskPrimitive2D containing the up-to-now created primitives, but + // this was done before. While this does not lead to wrong primitive + // representations of the metafile data, it creates unneccesarily expensive + // representations. Just detecting when no really 'new' ClipRegion gets set + // solves the problem. + + if(!rPropertyHolders.Current().getRegionActive() && !bNewActive) + { + // no active region exchanged by no new one, done + return; + } + + if(rPropertyHolders.Current().getRegionActive() && bNewActive) + { + // active region and new active region + if(rPropertyHolders.Current().getRegion() == *pRegion) + { + // new region is the same as the old region, done + return; + } + } + + // Here the old region and the new one are definitively different, maybe + // old one and/or new one is not active. + + // Handle deletion of old region.The process evtl. created primitives which + // belong to this active region. These need to be embedded to a + // MaskPrimitive2D accordingly. if(rPropertyHolders.Current().getRegionActive() && rTargetHolders.size() > 1) { drawinglayer::primitive2d::Primitive2DSequence aSubContent; @@ -986,8 +1028,8 @@ namespace } } - // apply new settings - const bool bNewActive(pRegion && !pRegion->IsEmpty()); + // apply new settings to current properties by setting + // the new region now rPropertyHolders.Current().setRegionActive(bNewActive); if(bNewActive) @@ -1244,13 +1286,12 @@ namespace const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLength, - sal_Int32* pDXArray, + const ::std::vector< double >& rDXArray, TargetHolder& rTarget, PropertyHolder& rProperty) { drawinglayer::primitive2d::BasePrimitive2D* pResult = 0; const Font& rFont = rProperty.getFont(); - std::vector< double > aDXArray; basegfx::B2DVector aAlignmentOffset(0.0, 0.0); if(nTextLength) @@ -1268,17 +1309,6 @@ namespace // add TextStartPosition aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); - // preapare DXArray (if used) - if(pDXArray && nTextLength) - { - aDXArray.reserve(nTextLength); - - for(xub_StrLen a(0); a < nTextLength; a++) - { - aDXArray.push_back((double)(*(pDXArray + a))); - } - } - // prepare FontColor and Locale const basegfx::BColor aFontColor(rProperty.getTextColor()); const com::sun::star::lang::Locale aLocale(MsLangId::convertLanguageToLocale(rProperty.getLanguageType())); @@ -1338,7 +1368,7 @@ namespace rText, nTextStart, nTextLength, - aDXArray, + rDXArray, aFontAttribute, aLocale, aFontColor, @@ -1365,7 +1395,7 @@ namespace rText, nTextStart, nTextLength, - aDXArray, + rDXArray, aFontAttribute, aLocale, aFontColor); @@ -1381,13 +1411,13 @@ namespace // get text width double fTextWidth(0.0); - if(aDXArray.empty()) + if(rDXArray.empty()) { fTextWidth = aTextLayouterDevice.getTextWidth(rText, nTextStart, nTextLength); } else { - fTextWidth = aDXArray.back(); + fTextWidth = rDXArray.back(); } if(basegfx::fTools::more(fTextWidth, 0.0)) @@ -1942,15 +1972,24 @@ namespace { /** CHECKED, WORKS WELL */ const MetaTextAction* pA = (const MetaTextAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); + + if(nTextLength + nTextIndex > nStringLength) + { + nTextLength = nStringLength - nTextIndex; + } - if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) { + const std::vector< double > aDXArray; proccessMetaTextAction( pA->GetPoint(), pA->GetText(), - pA->GetIndex(), - pA->GetLen(), - 0, + nTextIndex, + nTextLength, + aDXArray, rTargetHolders.Current(), rPropertyHolders.Current()); } @@ -1961,15 +2000,37 @@ namespace { /** CHECKED, WORKS WELL */ const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); + + if(nTextLength + nTextIndex > nStringLength) + { + nTextLength = nStringLength - nTextIndex; + } - if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) { + // preapare DXArray (if used) + std::vector< double > aDXArray; + sal_Int32* pDXArray = pA->GetDXArray(); + + if(pDXArray) + { + aDXArray.reserve(nTextLength); + + for(sal_uInt32 a(0); a < nTextLength; a++) + { + aDXArray.push_back((double)(*(pDXArray + a))); + } + } + proccessMetaTextAction( pA->GetPoint(), pA->GetText(), - pA->GetIndex(), - pA->GetLen(), - pA->GetDXArray(), + nTextIndex, + nTextLength, + aDXArray, rTargetHolders.Current(), rPropertyHolders.Current()); } @@ -1978,10 +2039,65 @@ namespace } case META_STRETCHTEXT_ACTION : { - /** NEEDS IMPLEMENTATION */ - OSL_ENSURE(false, "META_STRETCHTEXT_ACTION requested (!)"); - // use OutputDevice::GetTextArray() to map the... - // const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + // #i108440# StarMath uses MetaStretchTextAction, thus support is needed. + // It looks as if it pretty never really uses a width different from + // the default text-layout width, but it's not possible to be sure. + // Implemented getting the DXArray and checking for scale at all. If + // scale is more than 3.5% different, scale the DXArray before usage. + // New status: + + /** CHECKED, WORKS WELL */ + const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); + + if(nTextLength + nTextIndex > nStringLength) + { + nTextLength = nStringLength - nTextIndex; + } + + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) + { + drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; + aTextLayouterDevice.setFont(rPropertyHolders.Current().getFont()); + + ::std::vector< double > aTextArray( + aTextLayouterDevice.getTextArray( + pA->GetText(), + nTextIndex, + nTextLength)); + + if(!aTextArray.empty()) + { + const double fTextLength(aTextArray.back()); + + if(0.0 != fTextLength && pA->GetWidth()) + { + const double fRelative(pA->GetWidth() / fTextLength); + + if(fabs(fRelative - 1.0) >= 0.035) + { + // when derivation is more than 3,5% from default text size, + // scale the DXArray + for(sal_uInt32 a(0); a < aTextArray.size(); a++) + { + aTextArray[a] *= fRelative; + } + } + } + } + + proccessMetaTextAction( + pA->GetPoint(), + pA->GetText(), + nTextIndex, + nTextLength, + aTextArray, + rTargetHolders.Current(), + rPropertyHolders.Current()); + } + break; } case META_TEXTRECT_ACTION : @@ -1990,8 +2106,9 @@ namespace // OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)"); const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; const Rectangle& rRectangle = pA->GetRect(); + const sal_uInt32 nStringLength(pA->GetText().Len()); - if(!rRectangle.IsEmpty() && 0 != pA->GetText().Len()) + if(!rRectangle.IsEmpty() && 0 != nStringLength) { // The problem with this action is that it describes unlayouted text // and the layout capabilities are in EditEngine/Outliner in SVX. The @@ -2720,7 +2837,7 @@ namespace if(aSubContent.hasElements()) { rTargetHolders.Current().append( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aSubContent, nTransparence * 0.01)); } @@ -2831,9 +2948,9 @@ namespace if(aAttribute.getStartColor() == aAttribute.getEndColor()) { - // not really a gradient; create UnifiedAlphaPrimitive2D + // not really a gradient; create UnifiedTransparencePrimitive2D rTargetHolders.Current().append( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( xSubContent, aAttribute.getStartColor().luminance())); } @@ -2845,17 +2962,17 @@ namespace aTargetRectangle.Right(), aTargetRectangle.Bottom()); aRange.transform(rPropertyHolders.Current().getTransformation()); - // prepare gradient for alpha content - const drawinglayer::primitive2d::Primitive2DReference xAlpha( + // prepare gradient for transparent content + const drawinglayer::primitive2d::Primitive2DReference xTransparence( new drawinglayer::primitive2d::FillGradientPrimitive2D( aRange, aAttribute)); - // create alpha primitive + // create transparence primitive rTargetHolders.Current().append( - new drawinglayer::primitive2d::AlphaPrimitive2D( + new drawinglayer::primitive2d::TransparencePrimitive2D( xSubContent, - drawinglayer::primitive2d::Primitive2DSequence(&xAlpha, 1))); + drawinglayer::primitive2d::Primitive2DSequence(&xTransparence, 1))); } } } diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index 8ace785266c8..795ac14b1f91 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -69,7 +69,10 @@ namespace drawinglayer if(!aAllowedContentRange.isInside(aRealContentRange)) { - const Primitive2DReference xReferenceA(new MaskPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aAllowedContentRange)), aContent)); + const Primitive2DReference xReferenceA( + new MaskPrimitive2D( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect(aAllowedContentRange)), aContent)); aContent = Primitive2DSequence(&xReferenceA, 1); } diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 92f8026d06a2..9623c02dc5bd 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -35,6 +35,7 @@ #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> +#include <basegfx/polygon/b2dlinegeometry.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -235,7 +236,7 @@ namespace drawinglayer const basegfx::B2DPolygon aB2DPolygon(basegfx::tools::simplifyCurveSegments(getB2DPolygon())); basegfx::B2DPolyPolygon aHairLinePolyPolygon; - if(0.0 == getStrokeAttribute().getFullDotDashLen()) + if(getStrokeAttribute().isDefault() || 0.0 == getStrokeAttribute().getFullDotDashLen()) { // no line dashing, just copy aHairLinePolyPolygon.append(aB2DPolygon); @@ -243,12 +244,14 @@ namespace drawinglayer else { // apply LineStyle - basegfx::tools::applyLineDashing(aB2DPolygon, getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); + basegfx::tools::applyLineDashing( + aB2DPolygon, getStrokeAttribute().getDotDashArray(), + &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); } const sal_uInt32 nCount(aHairLinePolyPolygon.count()); - if(getLineAttribute().getWidth()) + if(!getLineAttribute().isDefault() && getLineAttribute().getWidth()) { // create fat line data const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0); @@ -285,7 +288,11 @@ namespace drawinglayer else { // prepare return value - const Primitive2DReference xRef(new PolyPolygonHairlinePrimitive2D(aHairLinePolyPolygon, getLineAttribute().getColor())); + const Primitive2DReference xRef( + new PolyPolygonHairlinePrimitive2D( + aHairLinePolyPolygon, + getLineAttribute().getColor())); + return Primitive2DSequence(&xRef, 1); } } @@ -511,7 +518,7 @@ namespace drawinglayer double fStart(0.0); double fEnd(0.0); - if(getStart().isActive()) + if(!getStart().isDefault() && getStart().isActive()) { // create start arrow primitive and consume aArrowA = basegfx::tools::createAreaGeometryForLineStartEnd( @@ -522,7 +529,7 @@ namespace drawinglayer fStart *= 0.8; } - if(getEnd().isActive()) + if(!getEnd().isDefault() && getEnd().isActive()) { // create end arrow primitive and consume aArrowB = basegfx::tools::createAreaGeometryForLineStartEnd( @@ -545,18 +552,24 @@ namespace drawinglayer sal_uInt32 nInd(0L); // add shaft - const Primitive2DReference xRefShaft(new PolygonStrokePrimitive2D(aLocalPolygon, getLineAttribute(), getStrokeAttribute())); + const Primitive2DReference xRefShaft(new + PolygonStrokePrimitive2D( + aLocalPolygon, getLineAttribute(), getStrokeAttribute())); aRetval[nInd++] = xRefShaft; if(aArrowA.count()) { - const Primitive2DReference xRefA(new PolyPolygonColorPrimitive2D(aArrowA, getLineAttribute().getColor())); + const Primitive2DReference xRefA( + new PolyPolygonColorPrimitive2D( + aArrowA, getLineAttribute().getColor())); aRetval[nInd++] = xRefA; } if(aArrowB.count()) { - const Primitive2DReference xRefB(new PolyPolygonColorPrimitive2D(aArrowB, getLineAttribute().getColor())); + const Primitive2DReference xRefB( + new PolyPolygonColorPrimitive2D( + aArrowB, getLineAttribute().getColor())); aRetval[nInd++] = xRefB; } diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index b13e1050427d..4e01d5285c7a 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -188,7 +188,9 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); + aRetval[a] = Primitive2DReference( + new PolygonStrokePrimitive2D( + aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); } return aRetval; @@ -276,11 +278,14 @@ namespace drawinglayer if(aPolygon.isClosed()) { // no need for PolygonStrokeArrowPrimitive2D when polygon is closed - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); + aRetval[a] = Primitive2DReference( + new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); } else { - aRetval[a] = Primitive2DReference(new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute(), getStart(), getEnd())); + aRetval[a] = Primitive2DReference( + new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), + getStrokeAttribute(), getStart(), getEnd())); } } @@ -398,16 +403,24 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillGradientPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient()); - const Primitive2DReference xSubRef(pNewGradient); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillGradient().isDefault()) + { + // create SubSequence with FillGradientPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient()); + const Primitive2DReference xSubRef(pNewGradient); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( @@ -445,16 +458,24 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillHatchPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); - const Primitive2DReference xSubRef(pNewHatch); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillHatch().isDefault()) + { + // create SubSequence with FillHatchPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); + const Primitive2DReference xSubRef(pNewHatch); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( @@ -495,21 +516,29 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillBitmapPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - basegfx::B2DHomMatrix aNewObjectTransform; - aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); - aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); - aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); - aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); - FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap()); - const Primitive2DReference xSubRef(pNewBitmap); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillBitmap().isDefault()) + { + // create SubSequence with FillBitmapPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + basegfx::B2DHomMatrix aNewObjectTransform; + aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); + aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); + aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); + aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); + FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap()); + const Primitive2DReference xSubRef(pNewBitmap); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonBitmapPrimitive2D::PolyPolygonBitmapPrimitive2D( diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 760932c4b28c..0820d6ba09c0 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -148,8 +148,10 @@ namespace drawinglayer if(impGetShadow3D(rViewInformation)) { // test visibility - const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); - const basegfx::B2DRange aViewRange(rViewInformation.getViewport()); + const basegfx::B2DRange aShadow2DRange( + getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + const basegfx::B2DRange aViewRange( + rViewInformation.getViewport()); if(aViewRange.isEmpty() || aShadow2DRange.overlaps(aViewRange)) { @@ -162,6 +164,7 @@ namespace drawinglayer basegfx::B2DRange aDiscreteRange; basegfx::B2DRange aVisibleDiscreteRange; basegfx::B2DRange aUnitVisibleRange; + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); if(!aVisibleDiscreteRange.isEmpty()) @@ -227,8 +230,9 @@ namespace drawinglayer aUnitVisibleRange, nOversampleValue); - aZBufferProcessor3D.processNonTransparent(getChildren3D()); - aZBufferProcessor3D.processTransparent(getChildren3D()); + aZBufferProcessor3D.process(getChildren3D()); + aZBufferProcessor3D.finish(); + const_cast< ScenePrimitive2D* >(this)->maOldRenderedBitmap = aZBufferProcessor3D.getBitmapEx(); const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); @@ -254,7 +258,7 @@ namespace drawinglayer if(bAddOutlineToCreated3DSceneRepresentation) { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(aNew2DTransform); const Primitive2DReference xRef2(new PolygonHairlinePrimitive2D(aOutline, basegfx::BColor(1.0, 0.0, 0.0))); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef2); diff --git a/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx new file mode 100644 index 000000000000..9d90c35103d9 --- /dev/null +++ b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrdecompositiontools3d.cxx,v $ + * + * $Revision: 1.7 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DHomMatrix& rMatrix) + { + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); + + return createHiddenGeometryPrimitives2D( + bFilled, + basegfx::B2DPolyPolygon(aUnitOutline), + rMatrix); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolyPolygon) + { + return createHiddenGeometryPrimitives2D( + bFilled, + rPolyPolygon, + basegfx::B2DHomMatrix()); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange) + { + return createHiddenGeometryPrimitives2D( + bFilled, + rRange, + basegfx::B2DHomMatrix()); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange, + const basegfx::B2DHomMatrix& rMatrix) + { + const basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange)); + + return createHiddenGeometryPrimitives2D( + bFilled, + aOutline, + rMatrix); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DHomMatrix& rMatrix) + { + // create fill or line primitive + Primitive2DReference xReference; + basegfx::B2DPolyPolygon aScaledOutline(rPolyPolygon); + aScaledOutline.transform(rMatrix); + + if(bFilled) + { + xReference = new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aScaledOutline), + basegfx::BColor(0.0, 0.0, 0.0)); + } + else + { + const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); + + xReference = new PolyPolygonHairlinePrimitive2D( + aScaledOutline, + aGrayTone); + } + + // create HiddenGeometryPrimitive2D + return Primitive2DReference( + new HiddenGeometryPrimitive2D(Primitive2DSequence(&xReference, 1))); + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index c517f542d0ff..a9bfec89b490 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -33,8 +33,8 @@ #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <basegfx/tools/canvastools.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 416a415fa465..9418e8afe8bd 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -215,8 +215,8 @@ namespace drawinglayer double TextLayouterDevice::getTextWidth( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const + sal_uInt32 nIndex, + sal_uInt32 nLength) const { return mrDevice.GetTextWidth(rText, nIndex, nLength); } @@ -224,15 +224,22 @@ namespace drawinglayer bool TextLayouterDevice::getTextOutlines( basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector, const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength, - const ::std::vector< double >& rDXArray) + sal_uInt32 nIndex, + sal_uInt32 nLength, + const ::std::vector< double >& rDXArray) const { const sal_uInt32 nDXArrayCount(rDXArray.size()); + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } if(nDXArrayCount) { - OSL_ENSURE(nDXArrayCount == nLength, "DXArray size does not correspond to text portion size (!)"); + OSL_ENSURE(nDXArrayCount == nTextLength, "DXArray size does not correspond to text portion size (!)"); std::vector< sal_Int32 > aIntegerDXArray(nDXArrayCount); for(sal_uInt32 a(0); a < nDXArrayCount; a++) @@ -266,10 +273,18 @@ namespace drawinglayer basegfx::B2DRange TextLayouterDevice::getTextBoundRect( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const + sal_uInt32 nIndex, + sal_uInt32 nLength) const { - if(nLength) + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if(nTextLength) { Rectangle aRect; @@ -283,7 +298,9 @@ namespace drawinglayer // #i104432#, #i102556# take empty results into account if(!aRect.IsEmpty()) { - return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + return basegfx::B2DRange( + aRect.Left(), aRect.Top(), + aRect.Right(), aRect.Bottom()); } } @@ -306,11 +323,41 @@ namespace drawinglayer const Rectangle& rRectangle, const String& rText, sal_uInt16 nStyle, - GDIMetaFile& rGDIMetaFile) + GDIMetaFile& rGDIMetaFile) const { mrDevice.AddTextRectActions( rRectangle, rText, nStyle, rGDIMetaFile); } + + ::std::vector< double > TextLayouterDevice::getTextArray( + const String& rText, + sal_uInt32 nIndex, + sal_uInt32 nLength) const + { + ::std::vector< double > aRetval; + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if(nTextLength) + { + aRetval.reserve(nTextLength); + sal_Int32* pArray = new sal_Int32[nTextLength]; + mrDevice.GetTextArray(rText, pArray, nIndex, nLength); + + for(sal_uInt32 a(0); a < nTextLength; a++) + { + aRetval.push_back(pArray[a]); + } + } + + return aRetval; + } + } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx new file mode 100644 index 000000000000..cfe1e184e89e --- /dev/null +++ b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: alphaprimitive2d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TransparencePrimitive2D::TransparencePrimitive2D( + const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTransparence) + : GroupPrimitive2D(rChildren), + maTransparence(rTransparence) + { + } + + bool TransparencePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const TransparencePrimitive2D& rCompare = (TransparencePrimitive2D&)rPrimitive; + + return (getTransparence() == rCompare.getTransparence()); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TransparencePrimitive2D, PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D) + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx deleted file mode 100644 index 15aaf18fb58d..000000000000 --- a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/color/bcolor.hxx> -#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> -#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - UnifiedAlphaPrimitive2D::UnifiedAlphaPrimitive2D( - const Primitive2DSequence& rChildren, - double fAlpha) - : GroupPrimitive2D(rChildren), - mfAlpha(fAlpha) - { - } - - bool UnifiedAlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const UnifiedAlphaPrimitive2D& rCompare = (UnifiedAlphaPrimitive2D&)rPrimitive; - - return (getAlpha() == rCompare.getAlpha()); - } - - return false; - } - - Primitive2DSequence UnifiedAlphaPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const - { - if(0.0 == getAlpha()) - { - // no transparence used, so just use the content - return getChildren(); - } - else if(getAlpha() > 0.0 && getAlpha() < 1.0) - { - // The idea is to create a AlphaPrimitive2D with alpha content using a fill color - // corresponding to the alpha value. Problem is that in most systems, the right - // and bottom pixel array is not filled when filling polygons, thus this would not - // always produce a complete alpha bitmap. There are some solutions: - // - // - Grow the used polygon range by one discrete unit in X and Y. This - // will make the decomposition view-dependent. - // - // - For all filled polygon renderings, dra wthe polygon outline extra. This - // would lead to unwanted side effects when using concatenated polygons. - // - // - At this decomposition, add a filled polygon and a hairline polygon. This - // solution stays view-independent. - // - // I will take the last one here. The small overhead of two primitives will only be - // used when UnifiedAlphaPrimitive2D is not handled directly. - const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); - const basegfx::BColor aGray(getAlpha(), getAlpha(), getAlpha()); - Primitive2DSequence aAlphaContent(2); - - aAlphaContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); - aAlphaContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); - - // create sub-transparence group with a gray-colored rectangular fill polygon - const Primitive2DReference xRefB(new AlphaPrimitive2D(getChildren(), aAlphaContent)); - return Primitive2DSequence(&xRefB, 1L); - } - else - { - // completely transparent or invalid definition, add nothing - return Primitive2DSequence(); - } - } - - // provide unique ID - ImplPrimitrive2DIDBlock(UnifiedAlphaPrimitive2D, PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D) - - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx new file mode 100644 index 000000000000..6d930e40f5d7 --- /dev/null +++ b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UnifiedTransparencePrimitive2D.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/color/bcolor.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + UnifiedTransparencePrimitive2D::UnifiedTransparencePrimitive2D( + const Primitive2DSequence& rChildren, + double fTransparence) + : GroupPrimitive2D(rChildren), + mfTransparence(fTransparence) + { + } + + bool UnifiedTransparencePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const UnifiedTransparencePrimitive2D& rCompare = (UnifiedTransparencePrimitive2D&)rPrimitive; + + return (getTransparence() == rCompare.getTransparence()); + } + + return false; + } + + basegfx::B2DRange UnifiedTransparencePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + // do not use the fallback to decomposition here since for a correct BoundRect we also + // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition + return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + } + + Primitive2DSequence UnifiedTransparencePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + if(0.0 == getTransparence()) + { + // no transparence used, so just use the content + return getChildren(); + } + else if(getTransparence() > 0.0 && getTransparence() < 1.0) + { + // The idea is to create a TransparencePrimitive2D with transparent content using a fill color + // corresponding to the transparence value. Problem is that in most systems, the right + // and bottom pixel array is not filled when filling polygons, thus this would not + // always produce a complete transparent bitmap. There are some solutions: + // + // - Grow the used polygon range by one discrete unit in X and Y. This + // will make the decomposition view-dependent. + // + // - For all filled polygon renderings, dra wthe polygon outline extra. This + // would lead to unwanted side effects when using concatenated polygons. + // + // - At this decomposition, add a filled polygon and a hairline polygon. This + // solution stays view-independent. + // + // I will take the last one here. The small overhead of two primitives will only be + // used when UnifiedTransparencePrimitive2D is not handled directly. + const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); + const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence()); + Primitive2DSequence aTransparenceContent(2); + + aTransparenceContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); + aTransparenceContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); + + // create sub-transparence group with a gray-colored rectangular fill polygon + const Primitive2DReference xRefB(new TransparencePrimitive2D(getChildren(), aTransparenceContent)); + return Primitive2DSequence(&xRefB, 1L); + } + else + { + // completely transparent or invalid definition, add nothing + return Primitive2DSequence(); + } + } + + // provide unique ID + ImplPrimitrive2DIDBlock(UnifiedTransparencePrimitive2D, PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx index c618d4da1d98..efa51c75b611 100644 --- a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx @@ -215,7 +215,8 @@ namespace drawinglayer if(bNeedsClipping) { // embed to clipping; this is necessary for tiled fills - const basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createPolygonFromRect(getLocalObjectRange())); + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::tools::createPolygonFromRect(getLocalObjectRange())); const drawinglayer::primitive2d::Primitive2DReference xClippedFill( new drawinglayer::primitive2d::MaskPrimitive2D( aPolyPolygon, diff --git a/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx new file mode 100644 index 000000000000..e94eeb99f764 --- /dev/null +++ b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.cxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ + * + * 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 + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include <drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx> +#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive3d + { + HiddenGeometryPrimitive3D::HiddenGeometryPrimitive3D( + const Primitive3DSequence& rChildren) + : GroupPrimitive3D(rChildren) + { + } + + basegfx::B3DRange HiddenGeometryPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const + { + return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); + } + + Primitive3DSequence HiddenGeometryPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + { + // return empty sequence + return Primitive3DSequence(); + } + + // provide unique ID + ImplPrimitrive3DIDBlock(HiddenGeometryPrimitive3D, PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D) + + } // end of namespace primitive3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx b/drawinglayer/source/primitive3d/hittestprimitive3d.cxx deleted file mode 100644 index 5c6d9b6008ae..000000000000 --- a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> -#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive3d - { - HitTestPrimitive3D::HitTestPrimitive3D( - const Primitive3DSequence& rChildren) - : GroupPrimitive3D(rChildren) - { - } - - basegfx::B3DRange HitTestPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const - { - return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); - } - - Primitive3DSequence HitTestPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const - { - // return empty sequence - return Primitive3DSequence(); - } - - // provide unique ID - ImplPrimitrive3DIDBlock(HitTestPrimitive3D, PRIMITIVE3D_ID_HITTESTPRIMITIVE3D) - - } // end of namespace primitive3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive3d/makefile.mk b/drawinglayer/source/primitive3d/makefile.mk index dfae99b81066..afad990c0e28 100644 --- a/drawinglayer/source/primitive3d/makefile.mk +++ b/drawinglayer/source/primitive3d/makefile.mk @@ -40,7 +40,7 @@ SLOFILES= \ $(SLO)$/baseprimitive3d.obj \ $(SLO)$/groupprimitive3d.obj \ $(SLO)$/hatchtextureprimitive3d.obj \ - $(SLO)$/hittestprimitive3d.obj \ + $(SLO)$/hiddengeometryprimitive3d.obj \ $(SLO)$/modifiedcolorprimitive3d.obj \ $(SLO)$/polypolygonprimitive3d.obj \ $(SLO)$/polygonprimitive3d.obj \ diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index 7bad5e0c97f7..7b5f183575b2 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -57,7 +57,7 @@ namespace drawinglayer // may exclusively change static data, use mutex ::osl::Mutex m_mutex; - if(nSegments != nLineTubeSegments || rMaterial != aLineMaterial) + if(nSegments != nLineTubeSegments || !(rMaterial == aLineMaterial)) { nLineTubeSegments = nSegments; aLineMaterial = rMaterial; @@ -118,7 +118,7 @@ namespace drawinglayer // may exclusively change static data, use mutex ::osl::Mutex m_mutex; - if(nSegments != nLineCapSegments || rMaterial != aLineMaterial) + if(nSegments != nLineCapSegments || !(rMaterial == aLineMaterial)) { nLineCapSegments = nSegments; aLineMaterial = rMaterial; diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx index 4be87617b825..6dcea7b0d759 100644 --- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx @@ -35,8 +35,9 @@ #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx> #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -55,7 +56,7 @@ namespace drawinglayer basegfx::B3DPolyPolygon aFill(basegfx::tools::createCubeFillPolyPolygonFromB3DRange(aUnitRange)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind() || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) @@ -73,7 +74,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // handle texture coordinates X const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); @@ -145,7 +146,7 @@ namespace drawinglayer a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -153,39 +154,33 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( a3DPolyPolygonVector, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aLine(basegfx::tools::createCubePolyPolygonFromB3DRange(aUnitRange)); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } @@ -195,7 +190,7 @@ namespace drawinglayer SdrCubePrimitive3D::SdrCubePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute) { diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index b6badf9d1f18..471d18ed846e 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -31,14 +31,11 @@ #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx> #include <basegfx/polygon/b3dpolygon.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <drawinglayer/primitive3d/baseprimitive3d.hxx> #include <drawinglayer/primitive3d/polygonprimitive3d.hxx> #include <basegfx/polygon/b3dpolypolygon.hxx> #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <vcl/vclenum.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> #include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> #include <vcl/bmpacc.hxx> @@ -47,8 +44,12 @@ #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx> #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx> #include <drawinglayer/primitive3d/shadowprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <basegfx/range/b2drange.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrobjectattribute3d.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -167,8 +168,8 @@ namespace drawinglayer if(0.0 != rLine.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D, add created primitives and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rLine.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D, add created primitives and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rLine.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } @@ -181,7 +182,7 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { Primitive3DSequence aRetval; @@ -209,27 +210,45 @@ namespace drawinglayer } // look for and evtl. build texture sub-group primitive - if(rFill.isGradient() || rFill.isHatch() || rFill.isBitmap()) + if(!rFill.getGradient().isDefault() + || !rFill.getHatch().isDefault() + || !rFill.getBitmap().isDefault()) { bool bModulate(::com::sun::star::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode()); bool bFilter(aSdr3DObjectAttribute.getTextureFilter()); - BasePrimitive3D* pNewTexturePrimitive3D = 0L; + BasePrimitive3D* pNewTexturePrimitive3D = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { // create gradientTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new GradientTexturePrimitive3D(*rFill.getGradient(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new GradientTexturePrimitive3D( + rFill.getGradient(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { // create hatchTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new HatchTexturePrimitive3D(*rFill.getHatch(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new HatchTexturePrimitive3D( + rFill.getHatch(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else // if(rFill.isBitmap()) + else // if(!rFill.getBitmap().isDefault()) { // create bitmapTexture3D with sublist, add to local aRetval basegfx::B2DRange aTexRange(0.0, 0.0, rTextureSize.getX(), rTextureSize.getY()); - pNewTexturePrimitive3D = new BitmapTexturePrimitive3D(rFill.getBitmap()->getFillBitmapAttribute(aTexRange), aRetval, rTextureSize, bModulate, bFilter); + + pNewTexturePrimitive3D = new BitmapTexturePrimitive3D( + rFill.getBitmap().getFillBitmapAttribute(aTexRange), + aRetval, + rTextureSize, + bModulate, + bFilter); } // exchange aRetval content with texture group @@ -247,14 +266,14 @@ namespace drawinglayer if(0.0 != rFill.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rFill.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rFill.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { - // create AlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new AlphaTexturePrimitive3D(*pFillGradient, aRetval, rTextureSize)); + // create TransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(rFillGradient, aRetval, rTextureSize)); aRetval = Primitive3DSequence(&xRef, 1L); } } @@ -284,6 +303,35 @@ namespace drawinglayer return Primitive3DSequence(); } } + + Primitive3DSequence createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute) + { + // create hidden sub-geometry which can be used for HitTest + // and BoundRect calculations, but will not be visualized + const attribute::SdrFillAttribute aSimplifiedFillAttribute( + 0.0, + basegfx::BColor(), + attribute::FillGradientAttribute(), + attribute::FillHatchAttribute(), + attribute::SdrFillBitmapAttribute()); + + const Primitive3DReference aHidden( + new HiddenGeometryPrimitive3D( + create3DPolyPolygonFillPrimitives( + r3DPolyPolygonVector, + rObjectTransform, + rTextureSize, + aSdr3DObjectAttribute, + aSimplifiedFillAttribute, + attribute::FillGradientAttribute()))); + + return Primitive3DSequence(&aHidden, 1); + } + } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index b6a8621f7d8b..2485d467b7f4 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -36,8 +36,9 @@ #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> #include <drawinglayer/geometry/viewinformation3d.hxx> -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -68,7 +69,7 @@ namespace drawinglayer double fRelativeTextureWidth(1.0); basegfx::B2DHomMatrix aTexTransform; - if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) + if(!getSdrLFSAttribute().getFill().isDefault() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) { const basegfx::B2DPolygon aFirstPolygon(maCorrectedPolyPolygon.getB2DPolygon(0L)); const double fFrontLength(basegfx::tools::getLength(aFirstPolygon)); @@ -98,7 +99,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { @@ -116,7 +117,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -126,7 +127,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -134,29 +135,21 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { if(getSdr3DObjectAttribute().getReducedLineGeometry()) { @@ -341,7 +334,8 @@ namespace drawinglayer if(aNewLineGeometry.count()) { - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aNewLineGeometry, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } } @@ -352,19 +346,22 @@ namespace drawinglayer const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector)); // add horizontal lines - const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives( + aHorLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines); // add vertical lines - const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives( + aVerLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines); } } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -401,7 +398,7 @@ namespace drawinglayer SdrExtrudePrimitive3D::SdrExtrudePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, double fDepth, diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index 16cee3fbf86a..d2ca2f5786bc 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -36,8 +36,9 @@ #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> #include <drawinglayer/geometry/viewinformation3d.hxx> -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -69,7 +70,8 @@ namespace drawinglayer const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); basegfx::B2DHomMatrix aTexTransform; - if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) + if(!getSdrLFSAttribute().getFill().isDefault() + && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) { aTexTransform.set(0, 0, 0.0); aTexTransform.set(0, 1, 1.0); @@ -91,7 +93,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { @@ -109,7 +111,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -119,7 +121,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -127,29 +129,21 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { if(getSdr3DObjectAttribute().getReducedLineGeometry()) { @@ -183,7 +177,8 @@ namespace drawinglayer if(aNewLineGeometry.count()) { - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aNewLineGeometry, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } } @@ -194,19 +189,23 @@ namespace drawinglayer const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector)); // add horizontal lines - const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives( + aHorLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines); // add vertical lines - const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives( + aVerLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines); } } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -254,7 +253,7 @@ namespace drawinglayer SdrLathePrimitive3D::SdrLathePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, sal_uInt32 nHorizontalSegments, diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index 6f6d2a106ac0..825bd6ee4671 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -32,8 +32,9 @@ #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> #include <basegfx/polygon/b3dpolypolygontools.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -58,7 +59,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // #i98295# normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) { @@ -76,7 +77,7 @@ namespace drawinglayer } // #i98314# texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -86,7 +87,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -94,41 +95,36 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aLine(getPolyPolygon3D()); aLine.clearNormals(); aLine.clearTextureCoordinates(); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -140,7 +136,7 @@ namespace drawinglayer const basegfx::B3DPolyPolygon& rPolyPolygon3D, const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute), maPolyPolygon3D(rPolyPolygon3D) @@ -173,11 +169,11 @@ namespace drawinglayer aRetval = basegfx::tools::getRange(getPolyPolygon3D()); aRetval.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by half LineWidth as tube radius aRetval.grow(rLine.getWidth() / 2.0); diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index 3d8ff55024ff..e5f722126d42 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -29,9 +29,9 @@ #include "precompiled_drawinglayer.hxx" #include <drawinglayer/primitive3d/sdrprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <basegfx/polygon/b3dpolypolygontools.hxx> #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -48,11 +48,11 @@ namespace drawinglayer basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); aUnitRange.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by hald LineWidth as tube radius aUnitRange.grow(rLine.getWidth() / 2.0); @@ -75,11 +75,11 @@ namespace drawinglayer aRetval.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by half LineWidth as tube radius aRetval.grow(rLine.getWidth() / 2.0); @@ -93,7 +93,7 @@ namespace drawinglayer SdrPrimitive3D::SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : BufferedDecompositionPrimitive3D(), maTransform(rTransform), diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index a2c8f4c0cc03..b10b4ad6164b 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -35,8 +35,9 @@ #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx> #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -60,7 +61,7 @@ namespace drawinglayer getHorizontalSegments(), getVerticalSegments(), bCreateNormals)); // normal inversion - if(getSdrLFSAttribute().getFill() + if(!getSdrLFSAttribute().getFill().isDefault() && bCreateNormals && getSdr3DObjectAttribute().getNormalsInvert() && aFill.areNormalsUsed()) @@ -70,7 +71,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // handle texture coordinates X const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); @@ -134,7 +135,7 @@ namespace drawinglayer a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -142,39 +143,34 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( a3DPolyPolygonVector, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aSphere(basegfx::tools::createSpherePolyPolygonFromB3DRange(aUnitRange, getHorizontalSegments(), getVerticalSegments())); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aSphere, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aSphere, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } @@ -184,7 +180,7 @@ namespace drawinglayer SdrSpherePrimitive3D::SdrSpherePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments) diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index 1e3e803cea38..d10fc52b8bb2 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -30,6 +30,7 @@ #include <drawinglayer/primitive3d/textureprimitive3d.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> +#include <basegfx/color/bcolor.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -73,7 +74,7 @@ namespace drawinglayer { namespace primitive3d { - UnifiedAlphaTexturePrimitive3D::UnifiedAlphaTexturePrimitive3D( + UnifiedTransparenceTexturePrimitive3D::UnifiedTransparenceTexturePrimitive3D( double fTransparence, const Primitive3DSequence& rChildren) : TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false), @@ -81,11 +82,11 @@ namespace drawinglayer { } - bool UnifiedAlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const + bool UnifiedTransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { if(TexturePrimitive3D::operator==(rPrimitive)) { - const UnifiedAlphaTexturePrimitive3D& rCompare = (UnifiedAlphaTexturePrimitive3D&)rPrimitive; + const UnifiedTransparenceTexturePrimitive3D& rCompare = (UnifiedTransparenceTexturePrimitive3D&)rPrimitive; return (getTransparence() == rCompare.getTransparence()); } @@ -93,7 +94,14 @@ namespace drawinglayer return false; } - Primitive3DSequence UnifiedAlphaTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + basegfx::B3DRange UnifiedTransparenceTexturePrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const + { + // do not use the fallback to decomposition here since for a correct BoundRect we also + // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition + return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); + } + + Primitive3DSequence UnifiedTransparenceTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { if(0.0 == getTransparence()) { @@ -102,10 +110,10 @@ namespace drawinglayer } else if(getTransparence() > 0.0 && getTransparence() < 1.0) { - // create AlphaTexturePrimitive3D with fixed transparence as replacement + // create TransparenceTexturePrimitive3D with fixed transparence as replacement const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence()); const attribute::FillGradientAttribute aFillGradient(attribute::GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1); - const Primitive3DReference xRef(new AlphaTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize())); + const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize())); return Primitive3DSequence(&xRef, 1L); } else @@ -116,7 +124,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(UnifiedAlphaTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D) + ImplPrimitrive3DIDBlock(UnifiedTransparenceTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer @@ -196,7 +204,7 @@ namespace drawinglayer { namespace primitive3d { - AlphaTexturePrimitive3D::AlphaTexturePrimitive3D( + TransparenceTexturePrimitive3D::TransparenceTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize) @@ -204,13 +212,13 @@ namespace drawinglayer { } - bool AlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const + bool TransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { return (GradientTexturePrimitive3D::operator==(rPrimitive)); } // provide unique ID - ImplPrimitrive3DIDBlock(AlphaTexturePrimitive3D, PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D) + ImplPrimitrive3DIDBlock(TransparenceTexturePrimitive3D, PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index e61af11497bf..e20f1a417dcc 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -53,7 +53,7 @@ #include <vclhelperbitmaptransform.hxx> #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <basegfx/tuple/b2i64tuple.hxx> #include <basegfx/range/b2irange.hxx> #include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp> @@ -62,7 +62,7 @@ #include <com/sun/star/rendering/PathJoinType.hpp> #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> #include <com/sun/star/rendering/TexturingMode.hpp> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <vclhelperbufferdevice.hxx> #include <drawinglayer/primitive2d/chartprimitive2d.hxx> #include <helperchartrenderer.hxx> @@ -380,7 +380,7 @@ using namespace com::sun::star; // slightly inside), slightly enlarge the // gradient: // - // y/2 sin(alpha) + x/2 cos(alpha) + // y/2 sin(transparence) + x/2 cos(transparence) // // (values to change are not actual // gradient scales, but original bound @@ -595,8 +595,7 @@ using namespace com::sun::star; } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // create geometries @@ -969,10 +968,10 @@ using namespace com::sun::star; // paint content to it process(rSubList); - // TODO(F3): render transparent list to alpha + // TODO(F3): render transparent list to transparence // channel. Note that the OutDev implementation has a // shortcoming, in that nested transparency groups - // don't work - alpha is not combined properly. + // don't work - transparence is not combined properly. // process(rTransCandidate.getTransparenceList()); @@ -980,7 +979,7 @@ using namespace com::sun::star; mxCanvas = xLastCanvas; setWorldToView(aLastWorldToView); - // DUMMY: add alpha modulation value to DeviceColor + // DUMMY: add transparence modulation value to DeviceColor // TODO(F3): color management canvas::tools::setDeviceColor( maRenderState, 1.0, 1.0, 1.0, 0.5 ); @@ -1299,7 +1298,7 @@ namespace drawinglayer { // there are principally two methods for implementing the mask primitive. One // is to set a clip polygon at the canvas, the other is to create and use a - // alpha-using XBitmap for content and draw the mask as alpha. Both have their + // transparence-using XBitmap for content and draw the mask as transparence. Both have their // advantages and disadvantages, so here are both with a bool allowing simple // change if(bUseMaskBitmapMethod) @@ -1372,8 +1371,8 @@ namespace drawinglayer if(getOptionsDrawinglayer().IsAntiAliasing()) { // with AA, use 8bit AlphaMask to get nice borders - VirtualDevice& rAlpha = aBufferDevice.getAlpha(); - rAlpha.GetCanvas()->fillPolyPolygon( + VirtualDevice& rTransparence = aBufferDevice.getTransparence(); + rTransparence.GetCanvas()->fillPolyPolygon( basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), aMask), maViewState, maRenderState); } @@ -1578,7 +1577,7 @@ namespace drawinglayer { // replace with color filled polygon const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice()); canvas::tools::setRenderStateTransform(maRenderState, @@ -1611,12 +1610,12 @@ namespace drawinglayer } } - void canvasProcessor2D::impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate) + void canvasProcessor2D::impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate) { - const primitive2d::Primitive2DSequence& rChildren = rAlphaCandidate.getChildren(); - const primitive2d::Primitive2DSequence& rAlpha = rAlphaCandidate.getAlpha(); + const primitive2d::Primitive2DSequence& rChildren = rTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DSequence& rTransparence = rTransparenceCandidate.getTransparence(); - if(rChildren.hasElements() && rAlpha.hasElements()) + if(rChildren.hasElements() && rTransparence.hasElements()) { // get logic range of transparent part and clip with ViewRange basegfx::B2DRange aLogicRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rChildren, getViewInformation2D())); @@ -1680,16 +1679,16 @@ namespace drawinglayer process(rChildren); // set to mask - mpOutputDevice = &aBufferDevice.getAlpha(); + mpOutputDevice = &aBufferDevice.getTransparence(); mxCanvas = mpOutputDevice->GetCanvas(); canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation()); - // when painting alpha masks, reset the color stack + // when painting transparence masks, reset the color stack basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); - // paint mask to it (always with alpha intensities, evtl. with AA) - process(rAlpha); + // paint mask to it (always with transparence intensities, evtl. with AA) + process(rTransparence); // back to old color stack, OutDev, Canvas and ViewTransform maBColorModifierStack = aLastBColorModifierStack; @@ -1793,7 +1792,7 @@ namespace drawinglayer { // replace with color filled polygon const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice()); canvas::tools::setRenderStateTransform(maRenderState, @@ -1824,7 +1823,7 @@ namespace drawinglayer aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; // canvas needs a polygon to fill, create unit rectangle polygon - const basegfx::B2DPolygon aOutlineRectangle(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aOutlineRectangle(basegfx::tools::createUnitPolygon()); // set primitive's transformation as render state transform canvas::tools::setRenderStateTransform(maRenderState, @@ -1852,52 +1851,60 @@ namespace drawinglayer } } - void canvasProcessor2D::impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate) + void canvasProcessor2D::impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate) { - const primitive2d::Primitive2DSequence rChildren = rUniAlphaCandidate.getChildren(); - - if(rChildren.hasElements()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) + { + // not transparent at all, directly use content + process(rUniTransparenceCandidate.getChildren()); + } + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - bool bOutputDone(false); + const primitive2d::Primitive2DSequence rChildren = rUniTransparenceCandidate.getChildren(); - // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, - // use the fillPolyPolygon method with correctly set alpha. This is a often used - // case, so detectiong it is valuable - if(1 == rChildren.getLength()) + if(rChildren.hasElements()) { - const primitive2d::Primitive2DReference xReference(rChildren[0]); - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + bool bOutputDone(false); - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, + // use the fillPolyPolygon method with correctly set transparence. This is a often used + // case, so detectiong it is valuable + if(1 == rChildren.getLength()) { - // direct draw of PolyPolygon with color and transparence - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - - // add alpha modulation value to DeviceColor - uno::Sequence< double > aColor(4); - - aColor[0] = aPolygonColor.getRed(); - aColor[1] = aPolygonColor.getGreen(); - aColor[2] = aPolygonColor.getBlue(); - aColor[3] = 1.0 - rUniAlphaCandidate.getAlpha(); - maRenderState.DeviceColor = aColor; - - canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation()); - mxCanvas->fillPolyPolygon( - basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), pPoPoColor->getB2DPolyPolygon()), - maViewState, maRenderState); - bOutputDone = true; + const primitive2d::Primitive2DReference xReference(rChildren[0]); + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // direct draw of PolyPolygon with color and transparence + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + + // add transparence modulation value to DeviceColor + uno::Sequence< double > aColor(4); + + aColor[0] = aPolygonColor.getRed(); + aColor[1] = aPolygonColor.getGreen(); + aColor[2] = aPolygonColor.getBlue(); + aColor[3] = 1.0 - rUniTransparenceCandidate.getTransparence(); + maRenderState.DeviceColor = aColor; + + canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation()); + mxCanvas->fillPolyPolygon( + basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), pPoPoColor->getB2DPolyPolygon()), + maViewState, maRenderState); + bOutputDone = true; + } } - } - if(!bOutputDone) - { - // process decomposition. This will be decomposed to an AlphaPrimitive2D - // with the same child context and a single polygon for alpha context. This could be - // directly handled here with known VCL-buffer technology, but would only - // make a small difference compared to directly rendering the AlphaPrimitive2D - // using impRenderAlphaPrimitive2D above. - process(rUniAlphaCandidate.get2DDecomposition(getViewInformation2D())); + if(!bOutputDone) + { + // process decomposition. This will be decomposed to an TransparencePrimitive2D + // with the same child context and a single polygon for transparent context. This could be + // directly handled here with known VCL-buffer technology, but would only + // make a small difference compared to directly rendering the TransparencePrimitive2D + // using impRenderTransparencePrimitive2D above. + process(rUniTransparenceCandidate.get2DDecomposition(getViewInformation2D())); + } } } } @@ -2055,10 +2062,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { - // Alpha primitive - impRenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + // Transparence primitive + impRenderTransparencePrimitive2D(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); break; } @@ -2076,10 +2083,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { - // UnifiedAlphaPrimitive2D - impRenderUnifiedAlphaPrimitive2D(static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate)); + // UnifiedTransparencePrimitive2D + impRenderUnifiedTransparencePrimitive2D(static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate)); break; } diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index 74406ee050e0..d87b13551e1a 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -35,7 +35,7 @@ #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <drawinglayer/primitive2d/metafileprimitive2d.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/sceneprimitive2d.hxx> @@ -95,7 +95,7 @@ namespace drawinglayer // extract BoundRect from bitmaps in world coordinates const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate)); basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rBitmapCandidate.getTransform()); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon)); break; @@ -105,15 +105,15 @@ namespace drawinglayer // extract BoundRect from MetaFiles in world coordinates const primitive2d::MetafilePrimitive2D& rMetaCandidate(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate)); basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rMetaCandidate.getTransform()); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon)); break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group. Look at children - const primitive2d::AlphaPrimitive2D& rTransCandidate(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + const primitive2d::TransparencePrimitive2D& rTransCandidate(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); process(rTransCandidate.getChildren()); break; } diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index ec8fcb76b816..aaafa42ec44e 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -35,13 +35,14 @@ #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <drawinglayer/primitive2d/sceneprimitive2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> #include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> #include <drawinglayer/processor3d/cutfindprocessor3d.hxx> +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> +#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -58,7 +59,7 @@ namespace drawinglayer mfDiscreteHitTolerance(0.0), mbHit(false), mbHitToleranceUsed(false), - mbUseHitTestPrimitiveContent(true), + mbUseInvisiblePrimitiveContent(true), mbHitTextOnly(bHitTextOnly) { // init hit tolerance @@ -239,7 +240,7 @@ namespace drawinglayer if(!getHit()) { // empty 3D scene; Check for border hit - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rCandidate.getObjectTransformation()); mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); @@ -412,10 +413,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group - const primitive2d::AlphaPrimitive2D& rTransCandidate(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + const primitive2d::TransparencePrimitive2D& rTransCandidate(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); // Currently the transparence content is not taken into account; only // the children are recursively checked for hit. This may be refined for @@ -479,6 +480,49 @@ namespace drawinglayer break; } case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D : + { + if(!getHitTextOnly()) + { + // The recently added BitmapEx::GetTransparency() makes it easy to extend + // the BitmapPrimitive2D HitTest to take the contained BotmapEx and it's + // transparency into account + const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); + + if(!aRange.isEmpty()) + { + const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate)); + const BitmapEx& rBitmapEx = rBitmapCandidate.getBitmapEx(); + const Size& rSizePixel(rBitmapEx.GetSizePixel()); + + if(rSizePixel.Width() && rSizePixel.Height()) + { + basegfx::B2DHomMatrix aBackTransform( + getViewInformation2D().getObjectToViewTransformation() * + rBitmapCandidate.getTransform()); + aBackTransform.invert(); + + const basegfx::B2DPoint aRelativePoint(aBackTransform * getDiscreteHitPosition()); + const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); + + if(aUnitRange.isInside(aRelativePoint)) + { + const sal_Int32 nX(basegfx::fround(aRelativePoint.getX() * rSizePixel.Width())); + const sal_Int32 nY(basegfx::fround(aRelativePoint.getY() * rSizePixel.Height())); + + mbHit = (0xff != rBitmapEx.GetTransparency(nX, nY)); + } + } + else + { + // fallback to standard HitTest + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance()); + } + } + } + + break; + } case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D : case PRIMITIVE2D_ID_CONTROLPRIMITIVE2D : case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D : @@ -491,7 +535,7 @@ namespace drawinglayer // will be used for HitTest currently. // // This may be refined in the future, e.g: - // - For Bitamps, the mask and/or alpha information may be used + // - For Bitamps, the mask and/or transparence information may be used // - For MetaFiles, the MetaFile content may be used const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); @@ -504,15 +548,20 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D : + case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D : { - // HitTest primitive; the default decomposition would return an empty seqence, + // HiddenGeometryPrimitive2D; the default decomposition would return an empty seqence, // so force this primitive to process it's children directly if the switch is set // (which is the default). Else, ignore invisible content - if(getUseHitTestPrimitiveContent()) + const primitive2d::HiddenGeometryPrimitive2D& rHiddenGeometry(static_cast< const primitive2d::HiddenGeometryPrimitive2D& >(rCandidate)); + const primitive2d::Primitive2DSequence& rChildren = rHiddenGeometry.getChildren(); + + if(rChildren.hasElements()) { - const primitive2d::HitTestPrimitive2D& rHitTestCandidate(static_cast< const primitive2d::HitTestPrimitive2D& >(rCandidate)); - process(rHitTestCandidate.getChildren()); + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } } break; diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 394cbc4aea34..87b33b16c53d 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -115,7 +115,7 @@ namespace drawinglayer if(bDoSaveForVisualControl) { - SvFileStream aNew((const String&)String(ByteString( "c:\\alpha.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); + SvFileStream aNew((const String&)String(ByteString( "c:\\transparence.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); aNew << aAlphaMask.GetBitmap(); } @@ -162,7 +162,7 @@ namespace drawinglayer return *mpMask; } - VirtualDevice& impBufferDevice::getAlpha() + VirtualDevice& impBufferDevice::getTransparence() { if(!mpAlpha) { diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx index 31293f27c886..857b673e36ad 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx @@ -59,7 +59,7 @@ namespace drawinglayer bool isVisible() const { return !maDestPixel.IsEmpty(); } VirtualDevice& getContent() { return maContent; } VirtualDevice& getMask(); - VirtualDevice& getAlpha(); + VirtualDevice& getTransparence(); }; } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx index 2285db6289b1..b9fa91a89750 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.cxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx @@ -217,7 +217,7 @@ namespace drawinglayer } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // make sure steps is not too high/low diff --git a/drawinglayer/source/processor2d/vclhelpergradient.hxx b/drawinglayer/source/processor2d/vclhelpergradient.hxx index cfdd214dcd22..d02b20d54e4e 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.hxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.hxx @@ -28,7 +28,8 @@ #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX -#include <drawinglayer/attribute/fillattribute.hxx> +#include <sal/types.h> +#include <drawinglayer/attribute/fillgradientattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 39db8624f882..0bc1b57113b8 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -33,7 +33,6 @@ #include <vcl/virdev.hxx> #include <vcl/gdimtf.hxx> #include <vcl/gradient.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> @@ -44,8 +43,8 @@ #include <basegfx/polygon/b2dpolygonclipper.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> #include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> #include <tools/stream.hxx> @@ -65,8 +64,8 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> #include <helperchartrenderer.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> #include <drawinglayer/primitive2d/epsprimitive2d.hxx> +#include <basegfx/polygon/b2dlinegeometry.hxx> ////////////////////////////////////////////////////////////////////////////// // for PDFExtOutDevData Graphic support @@ -152,7 +151,7 @@ namespace drawinglayer { if(bIsTransparenceGradient) { - // it's about alpha channel intensities (black/white), do not use color modifier + // it's about transparence channel intensities (black/white), do not use color modifier o_rVCLGradient.SetStartColor(Color(rFiGrAtt.getStartColor())); o_rVCLGradient.SetEndColor(Color(rFiGrAtt.getEndColor())); } @@ -436,13 +435,13 @@ namespace drawinglayer fills. Thus, users have the choice to use the SvtGraphicFill info or the created output actions. Even for XFillTransparenceItem it is used, thus it may need to be supported in - UnifiedAlphaPrimitive2D, too, when interpreted as normally filled PolyPolygon. + UnifiedTransparencePrimitive2D, too, when interpreted as normally filled PolyPolygon. Implemented for: PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D, - and for PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D when detected unified alpha + and for PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D when detected unified transparence XPATHSTROKE_SEQ_BEGIN, XPATHSTROKE_SEQ_END: @@ -1475,138 +1474,166 @@ namespace drawinglayer RenderModifiedColorPrimitive2D(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate)); break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D : + { + // HiddenGeometryPrimitive2D; 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; + } + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { // for metafile: Need to examine what the pure vcl version is doing here actually // - uses DrawTransparent with metafile for content and a gradient // - uses DrawTransparent for single PolyPoylgons directly. Can be detected by // checking the content for single PolyPolygonColorPrimitive2D - const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate = static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); + const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); if(rContent.hasElements()) { - // try to identify a single PolyPolygonColorPrimitive2D in the - // content part of the alpha primitive - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = 0; - static bool bForceToMetafile(false); - - if(!bForceToMetafile && 1 == rContent.getLength()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) { - const primitive2d::Primitive2DReference xReference(rContent[0]); - pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + // not transparent at all, use content + process(rUniTransparenceCandidate.getChildren()); } - - // PolyPolygonGradientPrimitive2D, PolyPolygonHatchPrimitive2D and - // PolyPolygonBitmapPrimitive2D are derived from PolyPolygonColorPrimitive2D. - // Check also for correct ID to exclude derived implementations - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - // single transparent PolyPolygon identified, use directly - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); - - // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support - SvtGraphicFill* pSvtGraphicFill = 0; + // try to identify a single PolyPolygonColorPrimitive2D in the + // content part of the transparence primitive + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = 0; + static bool bForceToMetafile(false); - if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) + if(!bForceToMetafile && 1 == rContent.getLength()) { - // setup simple color with transparence fill stuff like in impgrfll - pSvtGraphicFill = new SvtGraphicFill( - PolyPolygon(aLocalPolyPolygon), - Color(aPolygonColor), - rUniAlphaCandidate.getAlpha(), - SvtGraphicFill::fillEvenOdd, - SvtGraphicFill::fillSolid, - SvtGraphicFill::Transform(), - false, - SvtGraphicFill::hatchSingle, - Color(), - SvtGraphicFill::gradientLinear, - Color(), - Color(), - 0, - Graphic()); + const primitive2d::Primitive2DReference xReference(rContent[0]); + pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); } - // set line and fill color - const sal_uInt16 nTransPercentVcl((sal_uInt16)basegfx::fround(rUniAlphaCandidate.getAlpha() * 100.0)); - mpOutputDevice->SetFillColor(Color(aPolygonColor)); - mpOutputDevice->SetLineColor(); + // PolyPolygonGradientPrimitive2D, PolyPolygonHatchPrimitive2D and + // PolyPolygonBitmapPrimitive2D are derived from PolyPolygonColorPrimitive2D. + // Check also for correct ID to exclude derived implementations + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // single transparent PolyPolygon identified, use directly + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); + aLocalPolyPolygon.transform(maCurrentTransformation); - // call VCL directly; encapsulate with SvtGraphicFill - impStartSvtGraphicFill(pSvtGraphicFill); - mpOutputDevice->DrawTransparent( - PolyPolygon(aLocalPolyPolygon), - nTransPercentVcl); - impEndSvtGraphicFill(pSvtGraphicFill); - } - else - { - // svae old mfCurrentUnifiedTransparence and set new one - // so that contained SvtGraphicStroke may use the current one - const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); - // #i105377# paint the content metafile opaque as the transparency gets - // split of into the gradient below - // mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha(); - mfCurrentUnifiedTransparence = 0; + // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support + SvtGraphicFill* pSvtGraphicFill = 0; - // various content, create content-metafile - GDIMetaFile aContentMetafile; - const Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, aContentMetafile)); - - // restore mfCurrentUnifiedTransparence; it may have been used - // while processing the sub-content in impDumpToMetaFile - mfCurrentUnifiedTransparence = fLastCurrentUnifiedTransparence; + if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) + { + // setup simple color with transparence fill stuff like in impgrfll + pSvtGraphicFill = new SvtGraphicFill( + PolyPolygon(aLocalPolyPolygon), + Color(aPolygonColor), + rUniTransparenceCandidate.getTransparence(), + SvtGraphicFill::fillEvenOdd, + SvtGraphicFill::fillSolid, + SvtGraphicFill::Transform(), + false, + SvtGraphicFill::hatchSingle, + Color(), + SvtGraphicFill::gradientLinear, + Color(), + Color(), + 0, + Graphic()); + } - // create uniform VCL gradient for uniform transparency - Gradient aVCLGradient; - const sal_uInt8 nTransPercentVcl((sal_uInt8)basegfx::fround(rUniAlphaCandidate.getAlpha() * 255.0)); - const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); - - aVCLGradient.SetStyle(GRADIENT_LINEAR); - aVCLGradient.SetStartColor(aTransColor); - aVCLGradient.SetEndColor(aTransColor); - aVCLGradient.SetAngle(0); - aVCLGradient.SetBorder(0); - aVCLGradient.SetOfsX(0); - aVCLGradient.SetOfsY(0); - aVCLGradient.SetStartIntensity(100); - aVCLGradient.SetEndIntensity(100); - aVCLGradient.SetSteps(2); + // set line and fill color + const sal_uInt16 nTransPercentVcl((sal_uInt16)basegfx::fround(rUniTransparenceCandidate.getTransparence() * 100.0)); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); - // render it to VCL - mpOutputDevice->DrawTransparent( - aContentMetafile, aPrimitiveRectangle.TopLeft(), - aPrimitiveRectangle.GetSize(), aVCLGradient); + // call VCL directly; encapsulate with SvtGraphicFill + impStartSvtGraphicFill(pSvtGraphicFill); + mpOutputDevice->DrawTransparent( + PolyPolygon(aLocalPolyPolygon), + nTransPercentVcl); + impEndSvtGraphicFill(pSvtGraphicFill); + } + else + { + // svae old mfCurrentUnifiedTransparence and set new one + // so that contained SvtGraphicStroke may use the current one + const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); + // #i105377# paint the content metafile opaque as the transparency gets + // split of into the gradient below + // mfCurrentUnifiedTransparence = rUniTransparenceCandidate.getTransparence(); + mfCurrentUnifiedTransparence = 0; + + // various content, create content-metafile + GDIMetaFile aContentMetafile; + const Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, aContentMetafile)); + + // restore mfCurrentUnifiedTransparence; it may have been used + // while processing the sub-content in impDumpToMetaFile + mfCurrentUnifiedTransparence = fLastCurrentUnifiedTransparence; + + // create uniform VCL gradient for uniform transparency + Gradient aVCLGradient; + const sal_uInt8 nTransPercentVcl((sal_uInt8)basegfx::fround(rUniTransparenceCandidate.getTransparence() * 255.0)); + const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); + + aVCLGradient.SetStyle(GRADIENT_LINEAR); + aVCLGradient.SetStartColor(aTransColor); + aVCLGradient.SetEndColor(aTransColor); + aVCLGradient.SetAngle(0); + aVCLGradient.SetBorder(0); + aVCLGradient.SetOfsX(0); + aVCLGradient.SetOfsY(0); + aVCLGradient.SetStartIntensity(100); + aVCLGradient.SetEndIntensity(100); + aVCLGradient.SetSteps(2); + + // render it to VCL + mpOutputDevice->DrawTransparent( + aContentMetafile, aPrimitiveRectangle.TopLeft(), + aPrimitiveRectangle.GetSize(), aVCLGradient); + } } } break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // for metafile: Need to examine what the pure vcl version is doing here actually // - uses DrawTransparent with metafile for content and a gradient // i can detect this here with checking the gradient part for a single // FillGradientPrimitive2D and reconstruct the gradient. - // If that detection goes wrong, i have to create an alpha-blended bitmap. Eventually - // do that in stripes, else RenderAlphaPrimitive2D may just be used - const primitive2d::AlphaPrimitive2D& rAlphaCandidate = static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rAlphaCandidate.getChildren(); - const primitive2d::Primitive2DSequence rAlpha = rAlphaCandidate.getAlpha(); + // If that detection goes wrong, i have to create an transparence-blended bitmap. Eventually + // do that in stripes, else RenderTransparencePrimitive2D may just be used + const primitive2d::TransparencePrimitive2D& rTransparenceCandidate = static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DSequence rTransparence = rTransparenceCandidate.getTransparence(); - if(rContent.hasElements() && rAlpha.hasElements()) + if(rContent.hasElements() && rTransparence.hasElements()) { // try to identify a single FillGradientPrimitive2D in the - // alpha part of the primitive + // transparence part of the primitive const primitive2d::FillGradientPrimitive2D* pFiGradient = 0; static bool bForceToBigTransparentVDev(false); - if(!bForceToBigTransparentVDev && 1 == rAlpha.getLength()) + if(!bForceToBigTransparentVDev && 1 == rTransparence.getLength()) { - const primitive2d::Primitive2DReference xReference(rAlpha[0]); + const primitive2d::Primitive2DReference xReference(rTransparence[0]); pFiGradient = dynamic_cast< const primitive2d::FillGradientPrimitive2D* >(xReference.get()); } @@ -1638,7 +1665,7 @@ namespace drawinglayer // Okay, basic implementation finished and tested. The DPI stuff was hard // and not easy to find out that it's needed. // Since this will not yet happen normally (as long as noone constructs - // alpha primitives with non-trivial alpha content) i will for now not + // transparence primitives with non-trivial transparence content) i will for now not // refine to tiling here. basegfx::B2DRange aViewRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); @@ -1689,9 +1716,9 @@ namespace drawinglayer aBufferProcessor.process(rContent); const Bitmap aBmContent(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel)); - // draw alpha using pixel renderer + // draw transparence using pixel renderer aBufferDevice.Erase(); - aBufferProcessor.process(rAlpha); + aBufferProcessor.process(rTransparence); const AlphaMask aBmAlpha(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel)); #ifdef DBG_UTIL @@ -1777,27 +1804,6 @@ 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; - } case PRIMITIVE2D_ID_EPSPRIMITIVE2D : { RenderEpsPrimitive2D(static_cast< const primitive2d::EpsPrimitive2D& >(rCandidate)); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index f3f09c25f6d7..a1b1393a2fac 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -39,14 +39,14 @@ #include <drawinglayer/primitive2d/metafileprimitive2d.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx> #include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx> #include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx> #include <drawinglayer/primitive2d/controlprimitive2d.hxx> #include <com/sun/star/awt/XWindow2.hpp> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> #include <drawinglayer/primitive2d/chartprimitive2d.hxx> #include <helperchartrenderer.hxx> @@ -259,50 +259,62 @@ namespace drawinglayer RenderModifiedColorPrimitive2D(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate)); break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, // use the faster OutputDevice::DrawTransparent method - const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate = static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); - bool bDrawTransparentUsed(false); + const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); - // since DEV300 m33 DrawTransparent is supported in VCL (for some targets - // natively), so i am now enabling this shortcut - static bool bAllowUsingDrawTransparent(true); - - if(bAllowUsingDrawTransparent && rContent.hasElements() && 1 == rContent.getLength()) + if(rContent.hasElements()) { - const primitive2d::Primitive2DReference xReference(rContent[0]); - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); - - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) + { + // not transparent at all, use content + process(rUniTransparenceCandidate.getChildren()); + } + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - // single transparent PolyPolygon identified, use directly - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - mpOutputDevice->SetFillColor(Color(aPolygonColor)); - mpOutputDevice->SetLineColor(); + bool bDrawTransparentUsed(false); - basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); + // since DEV300 m33 DrawTransparent is supported in VCL (for some targets + // natively), so i am now enabling this shortcut + static bool bAllowUsingDrawTransparent(true); - mpOutputDevice->DrawTransparent(aLocalPolyPolygon, rUniAlphaCandidate.getAlpha()); - bDrawTransparentUsed = true; - } - } + if(bAllowUsingDrawTransparent && 1 == rContent.getLength()) + { + const primitive2d::Primitive2DReference xReference(rContent[0]); + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // single transparent PolyPolygon identified, use directly + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + + basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); + aLocalPolyPolygon.transform(maCurrentTransformation); + + mpOutputDevice->DrawTransparent(aLocalPolyPolygon, rUniTransparenceCandidate.getTransparence()); + bDrawTransparentUsed = true; + } + } - if(!bDrawTransparentUsed) - { - // unified sub-transparence. Draw to VDev first. - RenderUnifiedAlphaPrimitive2D(rUniAlphaCandidate); + if(!bDrawTransparentUsed) + { + // unified sub-transparence. Draw to VDev first. + RenderUnifiedTransparencePrimitive2D(rUniTransparenceCandidate); + } + } } break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group. Draw to VDev first. - RenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + RenderTransparencePrimitive2D(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); break; } case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D : diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index f4cb4e194ec5..fe0c6ff1ea4f 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -40,7 +40,6 @@ #include <vclhelperbitmaprender.hxx> #include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <vclhelpergradient.hxx> #include <drawinglayer/primitive2d/metafileprimitive2d.hxx> @@ -48,8 +47,8 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <vclhelperbufferdevice.hxx> #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx> #include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx> @@ -75,6 +74,7 @@ // for test, can be removed again #include <basegfx/polygon/b2dpolygonclipper.hxx> +#include <basegfx/polygon/b2dtrapezoid.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -294,17 +294,69 @@ namespace drawinglayer basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(maCurrentTransformation); - if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()) + static bool bCheckTrapezoidDecomposition(false); + static bool bShowOutlinesThere(false); + if(bCheckTrapezoidDecomposition) { - // #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); + // clip against discrete ViewPort + const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport(); + basegfx::B2DPolyPolygon aLocalPolyPolygon(basegfx::tools::clipPolygonOnRange( + aLocalPolygon, rDiscreteViewport, true, false)); + + if(aLocalPolyPolygon.count()) + { + // subdivide + aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance( + aLocalPolyPolygon, 0.5); + + // trapezoidize + static double fLineWidth(2.0); + basegfx::B2DTrapezoidVector aB2DTrapezoidVector; + basegfx::tools::createLineTrapezoidFromB2DPolyPolygon(aB2DTrapezoidVector, aLocalPolyPolygon, fLineWidth); + + const sal_uInt32 nCount(aB2DTrapezoidVector.size()); + + if(nCount) + { + basegfx::BColor aInvPolygonColor(aHairlineColor); + aInvPolygonColor.invert(); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon()); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(Color(aHairlineColor)); + mpOutputDevice->SetLineColor(); + } + + mpOutputDevice->DrawPolygon(aTempPolygon); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aInvPolygonColor)); + mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0); + } + } + } + } } + else + { + 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); + mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); + } } // direct draw of transformed BitmapEx primitive @@ -323,7 +375,7 @@ namespace drawinglayer { // color gets completely replaced, get it const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); mpOutputDevice->SetFillColor(Color(aModifiedColor)); @@ -397,7 +449,7 @@ namespace drawinglayer { // color gets completely replaced, get it const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); mpOutputDevice->SetFillColor(Color(aModifiedColor)); @@ -553,7 +605,7 @@ namespace drawinglayer else { // try to catch cases where the bitmap will be color-modified to a single - // color (e.g. shadow). This would NOT be optimizable with an alpha channel + // color (e.g. shadow). This would NOT be optimizable with an transparence channel // at the Bitmap which we do not have here. When this should change, this // optimization has to be reworked accordingly. const sal_uInt32 nBColorModifierStackCount(maBColorModifierStack.count()); @@ -635,53 +687,72 @@ namespace drawinglayer basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon()); aLocalPolyPolygon.transform(maCurrentTransformation); - mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(mnPolygonStrokePrimitive2D - && getOptionsDrawinglayer().IsAntiAliasing() - && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW)) + static bool bCheckTrapezoidDecomposition(false); + static bool bShowOutlinesThere(false); + if(bCheckTrapezoidDecomposition) { - // when AA is on and this filled polygons are the result of stroked line geometry, - // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons - mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(Color(aPolygonColor)); - const sal_uInt32 nCount(aLocalPolyPolygon.count()); + // clip against discrete ViewPort + const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport(); + aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange( + aLocalPolyPolygon, rDiscreteViewport, true, false); - for(sal_uInt32 a(0); a < nCount; a++) + if(aLocalPolyPolygon.count()) { - mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); - } - } + // subdivide + aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance( + aLocalPolyPolygon, 0.5); - static bool bTestPolygonClipping(false); - if(bTestPolygonClipping) - { - static bool bInside(true); - static bool bFilled(false); - static bool bLine(false); + // trapezoidize + basegfx::B2DTrapezoidVector aB2DTrapezoidVector; + basegfx::tools::trapezoidSubdivide(aB2DTrapezoidVector, aLocalPolyPolygon); - basegfx::B2DRange aRange(aLocalPolyPolygon.getB2DRange()); - aRange.grow(aRange.getWidth() * -0.1); + const sal_uInt32 nCount(aB2DTrapezoidVector.size()); - if(bFilled) - { - basegfx::B2DPolyPolygon aFilledClipped(basegfx::tools::clipPolyPolygonOnRange(aLocalPolyPolygon, aRange, bInside, false)); - basegfx::BColor aRand(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0); - mpOutputDevice->SetFillColor(Color(aRand)); - mpOutputDevice->SetLineColor(); - mpOutputDevice->DrawPolyPolygon(aFilledClipped); + if(nCount) + { + basegfx::BColor aInvPolygonColor(aPolygonColor); + aInvPolygonColor.invert(); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon()); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + } + + mpOutputDevice->DrawPolygon(aTempPolygon); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aInvPolygonColor)); + mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0); + } + } + } } + } + else + { + mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(bLine) + if(mnPolygonStrokePrimitive2D + && getOptionsDrawinglayer().IsAntiAliasing() + && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW)) { - basegfx::B2DPolyPolygon aLineClipped(basegfx::tools::clipPolyPolygonOnRange(aLocalPolyPolygon, aRange, bInside, true)); - basegfx::BColor aRand(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0); + // when AA is on and this filled polygons are the result of stroked line geometry, + // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(Color(aRand)); + mpOutputDevice->SetLineColor(Color(aPolygonColor)); + const sal_uInt32 nCount(aLocalPolyPolygon.count()); - for(sal_uInt32 a(0); a < aLineClipped.count(); a++) + for(sal_uInt32 a(0); a < nCount; a++) { - mpOutputDevice->DrawPolyLine(aLineClipped.getB2DPolygon(a), 0.0); + mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); } } } @@ -807,10 +878,10 @@ namespace drawinglayer if(getOptionsDrawinglayer().IsAntiAliasing()) { // with AA, use 8bit AlphaMask to get nice borders - VirtualDevice& rAlpha = aBufferDevice.getAlpha(); - rAlpha.SetLineColor(); - rAlpha.SetFillColor(COL_BLACK); - rAlpha.DrawPolyPolygon(aMask); + VirtualDevice& rTransparence = aBufferDevice.getTransparence(); + rTransparence.SetLineColor(); + rTransparence.SetFillColor(COL_BLACK); + rTransparence.DrawPolyPolygon(aMask); // dump buffer to outdev aBufferDevice.paint(); @@ -843,7 +914,7 @@ namespace drawinglayer } // unified sub-transparence. Draw to VDev first. - void VclProcessor2D::RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate) + void VclProcessor2D::RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate) { static bool bForceToDecomposition(false); @@ -856,14 +927,14 @@ namespace drawinglayer } else { - if(0.0 == rTransCandidate.getAlpha()) + if(0.0 == rTransCandidate.getTransparence()) { // no transparence used, so just use the content process(rTransCandidate.getChildren()); } - else if(rTransCandidate.getAlpha() > 0.0 && rTransCandidate.getAlpha() < 1.0) + else if(rTransCandidate.getTransparence() > 0.0 && rTransCandidate.getTransparence() < 1.0) { - // alpha is in visible range + // transparence is in visible range basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D())); aRange.transform(maCurrentTransformation); impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true); @@ -880,8 +951,8 @@ namespace drawinglayer // back to old OutDev mpOutputDevice = pLastOutputDevice; - // dump buffer to outdev using given alpha - aBufferDevice.paint(rTransCandidate.getAlpha()); + // dump buffer to outdev using given transparence + aBufferDevice.paint(rTransCandidate.getTransparence()); } } } @@ -889,7 +960,7 @@ namespace drawinglayer } // sub-transparence group. Draw to VDev first. - void VclProcessor2D::RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate) + void VclProcessor2D::RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate) { if(rTransCandidate.getChildren().hasElements()) { @@ -907,14 +978,14 @@ namespace drawinglayer process(rTransCandidate.getChildren()); // set to mask - mpOutputDevice = &aBufferDevice.getAlpha(); + mpOutputDevice = &aBufferDevice.getTransparence(); - // when painting alpha masks, reset the color stack + // when painting transparence masks, reset the color stack basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); - // paint mask to it (always with alpha intensities, evtl. with AA) - process(rTransCandidate.getAlpha()); + // paint mask to it (always with transparence intensities, evtl. with AA) + process(rTransCandidate.getTransparence()); // back to old color stack maBColorModifierStack = aLastBColorModifierStack; diff --git a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx index 9b466258f57e..8d0f63de93de 100644 --- a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx +++ b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx @@ -32,11 +32,11 @@ #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> #include <drawinglayer/primitive3d/transformprimitive3d.hxx> #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx> -#include <drawinglayer/primitive3d/hittestprimitive3d.hxx> #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> #include <basegfx/polygon/b3dpolygon.hxx> #include <basegfx/polygon/b3dpolygontools.hxx> #include <basegfx/polygon/b3dpolypolygontools.hxx> +#include <drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -53,7 +53,8 @@ namespace drawinglayer maBack(rBack), maResult(), maCombinedTransform(), - mbAnyHit(bAnyHit) + mbAnyHit(bAnyHit), + mbUseInvisiblePrimitiveContent(true) { } @@ -124,13 +125,46 @@ namespace drawinglayer process(rPrimitive.getChildren()); break; } - case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D : + case PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D : { - // HitTestPrimitive3D, force usage due to we are doing a hit test and this - // primitive only gets generated on 3d objects without fill, exactly for this - // purpose - const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate); - process(rPrimitive.getChildren()); + // HiddenGeometryPrimitive3D; the default decomposition would return an empty seqence, + // so force this primitive to process it's children directly if the switch is set + // (which is the default). Else, ignore invisible content + const primitive3d::HiddenGeometryPrimitive3D& rHiddenGeometry(static_cast< const primitive3d::HiddenGeometryPrimitive3D& >(rCandidate)); + const primitive3d::Primitive3DSequence& rChildren = rHiddenGeometry.getChildren(); + + if(rChildren.hasElements()) + { + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } + } + + break; + } + case PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D : + { + const primitive3d::UnifiedTransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::UnifiedTransparenceTexturePrimitive3D& >(rCandidate); + const primitive3d::Primitive3DSequence rChildren = rPrimitive.getChildren(); + + if(rChildren.getLength()) + { + if(1.0 <= rPrimitive.getTransparence()) + { + // not visible, but use for HitTest + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } + } + else if(rPrimitive.getTransparence() >= 0.0 && rPrimitive.getTransparence() < 1.0) + { + // visible; use content + process(rChildren); + } + } + break; } case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 6ecdbf050855..b6f5cd60f271 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -40,9 +40,11 @@ #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> #include <basegfx/polygon/b3dpolypolygontools.hxx> #include <com/sun/star/drawing/ShadeMode.hpp> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <drawinglayer/primitive3d/transformprimitive3d.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> +#include <vcl/bitmapex.hxx> +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -63,8 +65,8 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - const bool bOldSimpleTextureActive(mbSimpleTextureActive); - texture::GeoTexSvx* pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx; + const bool bOldSimpleTextureActive(getSimpleTextureActive()); + boost::shared_ptr< texture::GeoTexSvx > pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx; // create texture const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient(); @@ -74,7 +76,7 @@ namespace drawinglayer const basegfx::BColor aStart(rFillGradient.getStartColor()); const basegfx::BColor aEnd(rFillGradient.getEndColor()); const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); - texture::GeoTexSvx* pNewTex = 0L; + boost::shared_ptr< texture::GeoTexSvx > pNewTex; if(nMaxSteps) { @@ -98,32 +100,32 @@ namespace drawinglayer { case attribute::GRADIENTSTYLE_LINEAR: { - pNewTex = new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_AXIAL: { - pNewTex = new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RADIAL: { - pNewTex = new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()); + pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY())); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - pNewTex = new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_SQUARE: { - pNewTex = new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RECT: { - pNewTex = new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } } @@ -133,7 +135,7 @@ namespace drawinglayer else { // no color distance -> same color, use simple texture - pNewTex = new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance()); + pNewTex.reset(new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance())); mbSimpleTextureActive = true; } @@ -150,9 +152,6 @@ namespace drawinglayer // process sub-list process(rSubSequence); - // delete texture - delete pNewTex; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -178,7 +177,7 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - texture::GeoTexSvx* pOldTex = mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx; // calculate logic pixel size in object coordinates. Create transformation view // to object by inverting ObjectToView @@ -198,15 +197,11 @@ namespace drawinglayer const double fLogicTexSize(fLogicTexSizeX > fLogicTexSizeY ? fLogicTexSizeX : fLogicTexSizeY); // create texture and set - texture::GeoTexSvxMultiHatch* pNewTex = new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize); - mpGeoTexSvx = pNewTex; + mpGeoTexSvx.reset(new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize)); // process sub-list process(rSubSequence); - // delete texture - delete mpGeoTexSvx; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -223,32 +218,29 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - texture::GeoTexSvx* pOldTex = mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx; // create texture const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getFillBitmapAttribute(); if(rFillBitmapAttribute.getTiling()) { - mpGeoTexSvx = new texture::GeoTexSvxBitmapTiled( + mpGeoTexSvx.reset(new texture::GeoTexSvxBitmapTiled( rFillBitmapAttribute.getBitmapEx().GetBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), - rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); + rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize())); } else { - mpGeoTexSvx = new texture::GeoTexSvxBitmap( + mpGeoTexSvx.reset(new texture::GeoTexSvxBitmap( rFillBitmapAttribute.getBitmapEx().GetBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), - rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); + rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize())); } // process sub-list process(rSubSequence); - // delete texture - delete mpGeoTexSvx; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -312,7 +304,7 @@ namespace drawinglayer if(bPaintIt) { // get rid of texture coordinates if there is no texture - if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx() && !getTransparenceGeoTexSvx()) + if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx().get() && !getTransparenceGeoTexSvx().get()) { aFill.clearTextureCoordinates(); } @@ -495,11 +487,13 @@ namespace drawinglayer impRenderBitmapTexturePrimitive3D(rPrimitive); break; } - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D : { - // AlphaTexturePrimitive3D - const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); + // TransparenceTexturePrimitive3D + const primitive3d::TransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::TransparenceTexturePrimitive3D& >(rBasePrimitive); + mnTransparenceCounter++; impRenderGradientTexturePrimitive3D(rPrimitive, true); + mnTransparenceCounter--; break; } case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D : @@ -548,8 +542,10 @@ namespace drawinglayer mrSdrLightingAttribute(rSdrLightingAttribute), maRasterRange(), maBColorModifierStack(), - mpGeoTexSvx(0), - mpTransparenceGeoTexSvx(0), + mpGeoTexSvx(), + mpTransparenceGeoTexSvx(), + maDrawinglayerOpt(), + mnTransparenceCounter(0), mbModulate(false), mbFilter(false), mbSimpleTextureActive(false) diff --git a/drawinglayer/source/processor3d/geometry2dextractor.cxx b/drawinglayer/source/processor3d/geometry2dextractor.cxx index d0de942071b2..44ce55f13b8a 100644 --- a/drawinglayer/source/processor3d/geometry2dextractor.cxx +++ b/drawinglayer/source/processor3d/geometry2dextractor.cxx @@ -127,8 +127,8 @@ namespace drawinglayer case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D : case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D : - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : - case PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D : { // TexturePrimitive3D: Process children, do not try to decompose const primitive3d::TexturePrimitive3D& rTexturePrimitive = static_cast< const primitive3d::TexturePrimitive3D& >(rCandidate); diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 55fea5b69aa9..2abbcaa9f83f 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -31,7 +31,7 @@ #include <drawinglayer/processor3d/shadow3dextractor.hxx> #include <drawinglayer/primitive3d/shadowprimitive3d.hxx> #include <drawinglayer/primitive2d/shadowprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <drawinglayer/primitive3d/transformprimitive3d.hxx> #include <drawinglayer/primitive3d/polygonprimitive3d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> @@ -91,7 +91,7 @@ namespace drawinglayer { // create simpleTransparencePrimitive, add created primitives const primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&xRef, 1L); - const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedAlphaPrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence())); + const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedTransparencePrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence())); primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef2); } else diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 929f9366d747..326b9d392999 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -35,13 +35,14 @@ #include <basegfx/raster/bzpixelraster.hxx> #include <drawinglayer/attribute/materialattribute3d.hxx> #include <drawinglayer/texture/texture.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx> #include <drawinglayer/primitive3d/textureprimitive3d.hxx> #include <drawinglayer/primitive3d/polygonprimitive3d.hxx> #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <basegfx/polygon/b3dpolygontools.hxx> +#include <basegfx/polygon/b3dpolypolygontools.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -225,14 +226,14 @@ private: basegfx::B2DPoint aTexCoor(0.0, 0.0); getTextureCoor(aTexCoor); - if(mrProcessor.getGeoTexSvx()) + if(mrProcessor.getGeoTexSvx().get()) { // calc color in spot. This may also set to invisible already when // e.g. bitmap textures have transparent parts mrProcessor.getGeoTexSvx()->modifyBColor(aTexCoor, rColor, fOpacity); } - if(basegfx::fTools::more(fOpacity, 0.0) && mrProcessor.getTransparenceGeoTexSvx()) + if(basegfx::fTools::more(fOpacity, 0.0) && mrProcessor.getTransparenceGeoTexSvx().get()) { // calc opacity. Object has a 2nd texture, a transparence texture mrProcessor.getTransparenceGeoTexSvx()->modifyOpacity(aTexCoor, fOpacity); @@ -241,7 +242,7 @@ private: if(basegfx::fTools::more(fOpacity, 0.0)) { - if(mrProcessor.getGeoTexSvx()) + if(mrProcessor.getGeoTexSvx().get()) { if(mbUseNrm) { @@ -309,9 +310,9 @@ private: mbModifyColor = mrProcessor.getBColorModifierStack().count(); mbHasTexCoor = SCANLINE_EMPTY_INDEX != rA.getTextureIndex() && SCANLINE_EMPTY_INDEX != rB.getTextureIndex(); mbHasInvTexCoor = SCANLINE_EMPTY_INDEX != rA.getInverseTextureIndex() && SCANLINE_EMPTY_INDEX != rB.getInverseTextureIndex(); - const bool bTextureActive(mrProcessor.getGeoTexSvx() || mrProcessor.getTransparenceGeoTexSvx()); + const bool bTextureActive(mrProcessor.getGeoTexSvx().get() || mrProcessor.getTransparenceGeoTexSvx().get()); mbUseTex = bTextureActive && (mbHasTexCoor || mbHasInvTexCoor || mrProcessor.getSimpleTextureActive()); - const bool bUseColorTex(mbUseTex && mrProcessor.getGeoTexSvx()); + const bool bUseColorTex(mbUseTex && mrProcessor.getGeoTexSvx().get()); const bool bNeedNrmOrCol(!bUseColorTex || (bUseColorTex && mrProcessor.getModulate())); mbUseNrm = bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getNormalIndex() && SCANLINE_EMPTY_INDEX != rB.getNormalIndex(); mbUseCol = !mbUseNrm && bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getColorIndex() && SCANLINE_EMPTY_INDEX != rB.getColorIndex(); @@ -426,7 +427,7 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(nOpacity >= 0x00ff) { - // full opacity, set z and color + // full opacity (not transparent), set z and color rOldZ = nNewZ; mrBuffer.getBPixel(nScanlineIndex) = basegfx::BPixel(aNewColor, 0xff); } @@ -436,8 +437,8 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(rDest.getOpacity()) { - // both transparent, mix color based on front pixel's opacity - // (the new one) + // mix new color by using + // color' = color * (1 - opacity) + newcolor * opacity const sal_uInt16 nTransparence(0x0100 - nOpacity); rDest.setRed((sal_uInt8)(((rDest.getRed() * nTransparence) + ((sal_uInt16)(255.0 * aNewColor.getRed()) * nOpacity)) >> 8)); rDest.setGreen((sal_uInt8)(((rDest.getGreen() * nTransparence) + ((sal_uInt16)(255.0 * aNewColor.getGreen()) * nOpacity)) >> 8)); @@ -445,14 +446,14 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(0xff != rDest.getOpacity()) { - // destination is also transparent, mix opacities by weighting - // old opacity with new pixel's transparence and adding new opacity - rDest.setOpacity((sal_uInt8)(((rDest.getOpacity() * nTransparence) >> 8) + nOpacity)); + // both are transparent, mix new opacity by using + // opacity = newopacity * (1 - oldopacity) + oldopacity + rDest.setOpacity(((sal_uInt8)((nOpacity * (0x0100 - rDest.getOpacity())) >> 8)) + rDest.getOpacity()); } } else { - // dest is not visible. Set color. + // dest is unused, set color rDest = basegfx::BPixel(aNewColor, (sal_uInt8)nOpacity); } } @@ -470,134 +471,161 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi } ////////////////////////////////////////////////////////////////////////////// +// helper class to buffer output for transparent rasterprimitives (filled areas +// and lines) until the end of processing. To ensure correct transparent +// visualisation, ZBuffers require to not set Z and to mix with the transparent +// color. If transparent rasterprimitives overlap, it gets necessary to +// paint transparent rasterprimitives from back to front to ensure that the +// mixing happens from back to front. For that purpose, transparent +// rasterprimitives are held in this class during the processing run, remember +// all data and will be rendered + +class RasterPrimitive3D +{ +private: + boost::shared_ptr< drawinglayer::texture::GeoTexSvx > mpGeoTexSvx; + boost::shared_ptr< drawinglayer::texture::GeoTexSvx > mpTransparenceGeoTexSvx; + drawinglayer::attribute::MaterialAttribute3D maMaterial; + basegfx::B3DPolyPolygon maPolyPolygon; + sal_uInt32 mfCenterZ; + + // bitfield + bool mbModulate : 1; + bool mbFilter : 1; + bool mbSimpleTextureActive : 1; + bool mbIsLine : 1; + +public: + RasterPrimitive3D( + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& pGeoTexSvx, + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& pTransparenceGeoTexSvx, + const drawinglayer::attribute::MaterialAttribute3D& rMaterial, + const basegfx::B3DPolyPolygon& rPolyPolygon, + bool bModulate, + bool bFilter, + bool bSimpleTextureActive, + bool bIsLine) + : mpGeoTexSvx(pGeoTexSvx), + mpTransparenceGeoTexSvx(pTransparenceGeoTexSvx), + maMaterial(rMaterial), + maPolyPolygon(rPolyPolygon), + mfCenterZ(basegfx::tools::getRange(rPolyPolygon).getCenter().getZ()), + mbModulate(bModulate), + mbFilter(bFilter), + mbSimpleTextureActive(bSimpleTextureActive), + mbIsLine(bIsLine) + { + } + + RasterPrimitive3D& operator=(const RasterPrimitive3D& rComp) + { + mpGeoTexSvx = rComp.mpGeoTexSvx; + mpTransparenceGeoTexSvx = rComp.mpTransparenceGeoTexSvx; + maMaterial = rComp.maMaterial; + maPolyPolygon = rComp.maPolyPolygon; + mfCenterZ = rComp.mfCenterZ; + mbModulate = rComp.mbModulate; + mbFilter = rComp.mbFilter; + mbSimpleTextureActive = rComp.mbSimpleTextureActive; + mbIsLine = rComp.mbIsLine; + + return *this; + } + + bool operator<(const RasterPrimitive3D& rComp) const + { + return mfCenterZ < rComp.mfCenterZ; + } + + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + const drawinglayer::attribute::MaterialAttribute3D& getMaterial() const { return maMaterial; } + const basegfx::B3DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; } + bool getModulate() const { return mbModulate; } + bool getFilter() const { return mbFilter; } + bool getSimpleTextureActive() const { return mbSimpleTextureActive; } + bool getIsLine() const { return mbIsLine; } +}; + +////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace processor3d { - // the processing method for a single, known primitive - void ZBufferProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) + void ZBufferProcessor3D::rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const { - // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch - switch(rBasePrimitive.getPrimitive3DID()) + if(mpBZPixelRaster) { - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : + if(getTransparenceCounter()) { - // AlphaTexturePrimitive3D - const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); - - if(mbProcessTransparent) - { - impRenderGradientTexturePrimitive3D(rPrimitive, true); - } - else + // transparent output; record for later sorting and painting from + // back to front + if(!mpRasterPrimitive3Ds) { - mbContainsTransparent = true; + const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds = new std::vector< RasterPrimitive3D >; } - break; - } - case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : - { - // directdraw of PolygonHairlinePrimitive3D - const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rBasePrimitive); - // do something when either not transparent and no transMap, or transparent and a TransMap - if((bool)mbProcessTransparent == (0 != getTransparenceGeoTexSvx())) - { - impRenderPolygonHairlinePrimitive3D(rPrimitive); - } - break; + mpRasterPrimitive3Ds->push_back(RasterPrimitive3D( + getGeoTexSvx(), + getTransparenceGeoTexSvx(), + rMaterial, + basegfx::B3DPolyPolygon(rHairline), + getModulate(), + getFilter(), + getSimpleTextureActive(), + true)); } - case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : + else { - // directdraw of PolyPolygonMaterialPrimitive3D - const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rBasePrimitive); + // do rasterconversion + mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); - // do something when either not transparent and no transMap, or transparent and a TransMap - if((bool)mbProcessTransparent == (0 != getTransparenceGeoTexSvx())) + if(mnAntiAlialize > 1) { - impRenderPolyPolygonMaterialPrimitive3D(rPrimitive); - } - break; - } - default: - { - // use the DefaultProcessor3D::processBasePrimitive3D() - DefaultProcessor3D::processBasePrimitive3D(rBasePrimitive); - break; - } - } - } - - void ZBufferProcessor3D::processNonTransparent(const primitive3d::Primitive3DSequence& rSource) - { - if(mpBZPixelRaster) - { - mbProcessTransparent = false; - mbContainsTransparent = false; - process(rSource); - } - } - - void ZBufferProcessor3D::processTransparent(const primitive3d::Primitive3DSequence& rSource) - { - if(mpBZPixelRaster && mbContainsTransparent) - { - mbProcessTransparent = true; - process(rSource); - } - } + const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); - void ZBufferProcessor3D::rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const - { - if(mpBZPixelRaster) - { - mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); + if(bForceLineSnap) + { + basegfx::B3DHomMatrix aTransform; + basegfx::B3DPolygon aSnappedHairline(rHairline); + const double fScaleDown(1.0 / mnAntiAlialize); + const double fScaleUp(mnAntiAlialize); - if(mnAntiAlialize > 1) - { - const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); + // take oversampling out + aTransform.scale(fScaleDown, fScaleDown, 1.0); + aSnappedHairline.transform(aTransform); - if(bForceLineSnap) - { - basegfx::B3DHomMatrix aTransform; - basegfx::B3DPolygon aSnappedHairline(rHairline); - const double fScaleDown(1.0 / mnAntiAlialize); - const double fScaleUp(mnAntiAlialize); + // snap to integer + aSnappedHairline = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aSnappedHairline); - // take oversampling out - aTransform.scale(fScaleDown, fScaleDown, 1.0); - aSnappedHairline.transform(aTransform); + // add oversampling again + aTransform.identity(); + aTransform.scale(fScaleUp, fScaleUp, 1.0); - // snap to integer - aSnappedHairline = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aSnappedHairline); + if(false) + { + // when really want to go to single pixel lines, move to center. + // Without this translation, all hor/ver hairlines will be centered exactly + // between two pixel lines (which looks best) + const double fTranslateToCenter(mnAntiAlialize * 0.5); + aTransform.translate(fTranslateToCenter, fTranslateToCenter, 0.0); + } - // add oversampling again - aTransform.identity(); - aTransform.scale(fScaleUp, fScaleUp, 1.0); + aSnappedHairline.transform(aTransform); - if(false) + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(aSnappedHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); + } + else { - // when really want to go to single pixel lines, move to center. - // Without this translation, all hor/ver hairlines will be centered exactly - // between two pixel lines (which looks best) - const double fTranslateToCenter(mnAntiAlialize * 0.5); - aTransform.translate(fTranslateToCenter, fTranslateToCenter, 0.0); + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); } - - aSnappedHairline.transform(aTransform); - - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(aSnappedHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); } else { - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), 1); } } - else - { - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), 1); - } } } @@ -605,8 +633,30 @@ namespace drawinglayer { if(mpBZPixelRaster) { - mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); - mpZBufferRasterConverter3D->rasterconvertB3DPolyPolygon(rFill, &maInvEyeToView, 0, mpBZPixelRaster->getHeight()); + if(getTransparenceCounter()) + { + // transparent output; record for later sorting and painting from + // back to front + if(!mpRasterPrimitive3Ds) + { + const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds = new std::vector< RasterPrimitive3D >; + } + + mpRasterPrimitive3Ds->push_back(RasterPrimitive3D( + getGeoTexSvx(), + getTransparenceGeoTexSvx(), + rMaterial, + rFill, + getModulate(), + getFilter(), + getSimpleTextureActive(), + false)); + } + else + { + mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); + mpZBufferRasterConverter3D->rasterconvertB3DPolyPolygon(rFill, &maInvEyeToView, 0, mpBZPixelRaster->getHeight()); + } } } @@ -624,8 +674,7 @@ namespace drawinglayer maInvEyeToView(), mpZBufferRasterConverter3D(0), mnAntiAlialize(nAntiAlialize), - mbProcessTransparent(false), - mbContainsTransparent(false) + mpRasterPrimitive3Ds(0) { // generate ViewSizes const double fFullViewSizeX((rViewInformation2D.getObjectToViewTransformation() * basegfx::B2DVector(fSizeX, 0.0)).getLength()); @@ -721,6 +770,58 @@ namespace drawinglayer delete mpZBufferRasterConverter3D; delete mpBZPixelRaster; } + + if(mpRasterPrimitive3Ds) + { + OSL_ASSERT("ZBufferProcessor3D: destructed, but there are unrendered transparent geometries. Use ZBufferProcessor3D::finish() to render these (!)"); + delete mpRasterPrimitive3Ds; + } + } + + void ZBufferProcessor3D::finish() + { + if(mpRasterPrimitive3Ds) + { + // there are transparent rasterprimitives + const sal_uInt32 nSize(mpRasterPrimitive3Ds->size()); + + if(nSize > 1) + { + // sort them from back to front + std::sort(mpRasterPrimitive3Ds->begin(), mpRasterPrimitive3Ds->end()); + } + + for(sal_uInt32 a(0); a < nSize; a++) + { + // paint each one by setting the remembered data and calling + // the render method + const RasterPrimitive3D& rCandidate = (*mpRasterPrimitive3Ds)[a]; + + mpGeoTexSvx = rCandidate.getGeoTexSvx(); + mpTransparenceGeoTexSvx = rCandidate.getTransparenceGeoTexSvx(); + mbModulate = rCandidate.getModulate(); + mbFilter = rCandidate.getFilter(); + mbSimpleTextureActive = rCandidate.getSimpleTextureActive(); + + if(rCandidate.getIsLine()) + { + rasterconvertB3DPolygon( + rCandidate.getMaterial(), + rCandidate.getPolyPolygon().getB3DPolygon(0)); + } + else + { + rasterconvertB3DPolyPolygon( + rCandidate.getMaterial(), + rCandidate.getPolyPolygon()); + } + } + + // delete them to signal the destructor that all is done and + // to allow asserting there + delete mpRasterPrimitive3Ds; + mpRasterPrimitive3Ds = 0; + } } BitmapEx ZBufferProcessor3D::getBitmapEx() const diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 2dc2970d521c..d83998df9efd 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -30,7 +30,6 @@ #include <drawinglayer/texture/texture3d.hxx> #include <vcl/bmpacc.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx> ////////////////////////////////////////////////////////////////////////////// diff --git a/editeng/inc/editeng/AccessibleEditableTextPara.hxx b/editeng/inc/editeng/AccessibleEditableTextPara.hxx index 2588850b4565..8e35f0f7d138 100644 --- a/editeng/inc/editeng/AccessibleEditableTextPara.hxx +++ b/editeng/inc/editeng/AccessibleEditableTextPara.hxx @@ -31,7 +31,7 @@ #include <tools/gen.hxx> #include <tools/string.hxx> #include <cppuhelper/weakref.hxx> -#include <cppuhelper/compbase8.hxx> +#include <cppuhelper/compbase9.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/interfacecontainer.hxx> @@ -42,6 +42,7 @@ #include <com/sun/star/accessibility/XAccessibleComponent.hpp> #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleHypertext.hpp> #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> #include <comphelper/accessibletexthelper.hxx> @@ -53,12 +54,13 @@ namespace accessibility { - typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::accessibility::XAccessible, + typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleComponent, ::com::sun::star::accessibility::XAccessibleEditableText, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleTextAttributes, + ::com::sun::star::accessibility::XAccessibleHypertext, ::com::sun::star::accessibility::XAccessibleMultiLineText, ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase; @@ -162,6 +164,11 @@ namespace accessibility virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XAccessibleHypertext + virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XAccessibleMultiLineText virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); diff --git a/editeng/inc/editeng/unoedprx.hxx b/editeng/inc/editeng/unoedprx.hxx index 67ff8ce44d7f..693fabe7d49f 100644 --- a/editeng/inc/editeng/unoedprx.hxx +++ b/editeng/inc/editeng/unoedprx.hxx @@ -50,7 +50,10 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; + virtual sal_Int32 CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ); + virtual USHORT CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ); + + virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; virtual void QuickInsertText( const String& rText, const ESelection& rSel ); @@ -61,6 +64,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/editeng/inc/editeng/unoedsrc.hxx b/editeng/inc/editeng/unoedsrc.hxx index c9e71da3d84f..3890bb009cae 100644 --- a/editeng/inc/editeng/unoedsrc.hxx +++ b/editeng/inc/editeng/unoedsrc.hxx @@ -171,6 +171,7 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) = 0; virtual SfxItemPool* GetPool() const = 0; diff --git a/editeng/inc/editeng/unofored.hxx b/editeng/inc/editeng/unofored.hxx index fddce62342a6..1c201043511d 100644 --- a/editeng/inc/editeng/unofored.hxx +++ b/editeng/inc/editeng/unofored.hxx @@ -63,6 +63,7 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/editeng/inc/editeng/unoforou.hxx b/editeng/inc/editeng/unoforou.hxx index 0757b2ad20fb..10aeb5805d11 100644 --- a/editeng/inc/editeng/unoforou.hxx +++ b/editeng/inc/editeng/unoforou.hxx @@ -81,6 +81,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; Outliner& GetOutliner() const { return rOutliner; } diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx index 78de836ba0ee..732c2f4d17dc 100644 --- a/editeng/inc/editeng/unotext.hxx +++ b/editeng/inc/editeng/unotext.hxx @@ -207,6 +207,8 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ); virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual sal_Bool IsValid() const; virtual void SetNotifyHdl( const Link& ); diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 94b0d92c8d3e..94981dc32e73 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -40,6 +40,7 @@ #include <vos/mutex.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> +#include <editeng/flditem.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/awt/Point.hpp> @@ -52,11 +53,8 @@ #include <comphelper/accessibleeventnotifier.hxx> #include <comphelper/sequenceashashmap.hxx> #include <unotools/accessiblestatesethelper.hxx> - -// --> OD 2006-01-11 #i27138# #include <unotools/accessiblerelationsethelper.hxx> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> -// <-- #include <vcl/unohelp.hxx> #include <editeng/editeng.hxx> #include <editeng/unoprnms.hxx> @@ -70,9 +68,16 @@ //------------------------------------------------------------------------ #include <com/sun/star/beans/PropertyState.hpp> + +//!!!#include <svx/unoshape.hxx> +//!!!#include <svx/dialmgr.hxx> +//!!!#include "accessibility.hrc" + #include <editeng/unolingu.hxx> #include <editeng/unopracc.hxx> #include "editeng/AccessibleEditableTextPara.hxx" +#include "AccessibleHyperlink.hxx" + #include <svtools/colorcfg.hxx> @@ -525,7 +530,9 @@ namespace accessibility { uno::Reference< XAccessible > xPara = xParentContext->getAccessibleChild( nIndex ); if( xPara.is() ) + { return uno::Reference< XAccessibleText > ( xPara, uno::UNO_QUERY ); + } } } @@ -811,6 +818,11 @@ namespace accessibility uno::Reference< XAccessibleEditableText > aAccEditText = this; aRet <<= aAccEditText; } + else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) ) + { + uno::Reference< XAccessibleHypertext > aAccHyperText = this; + aRet <<= aAccHyperText; + } else { aRet = AccessibleTextParaInterfaceBase::queryInterface(rType); @@ -2063,6 +2075,84 @@ namespace accessibility return aOutSequence; } + // XAccessibleHypertext + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException) + { + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLinks = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + nHyperLinks++; + } + return nHyperLinks; + } + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL AccessibleEditableTextPara::getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > xRef; + + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( nHyperLink == nLinkIndex ) + { + USHORT nEEStart = aField.aPosition.nIndex; + + // Translate EE Index to accessible index + USHORT nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); + USHORT nEnd = nStart + aField.aCurrentText.Len(); + xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText ); + break; + } + nHyperLink++; + } + } + + return xRef; + } + + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + const sal_Int32 nPara = GetParagraphIndex(); + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + +// SvxAccessibleTextIndex aIndex; +// aIndex.SetIndex(nPara, nCharIndex, rT); +// const USHORT nEEIndex = aIndex.GetEEIndex(); + + const USHORT nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex ); + sal_Int32 nHLIndex = 0; + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( aField.aPosition.nIndex == nEEIndex ) + { + nHLIndex = nHyperLink; + break; + } + nHyperLink++; + } + } + + return nHLIndex; + } + // XAccessibleMultiLineText sal_Int32 SAL_CALL AccessibleEditableTextPara::getLineNumberAtIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx new file mode 100644 index 000000000000..52c12b08a27b --- /dev/null +++ b/editeng/source/accessibility/AccessibleHyperlink.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * 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: AccessibleEditableTextPara.cxx,v $ + * $Revision: 1.53 $ + * + * 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_editeng.hxx" + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <comphelper/accessiblekeybindinghelper.hxx> + +#include "AccessibleHyperlink.hxx" +#include "editeng/unoedprx.hxx" +#include <editeng/flditem.hxx> +#include <vcl/keycodes.hxx> + +using namespace ::com::sun::star; + + +//------------------------------------------------------------------------ +// +// AccessibleHyperlink implementation +// +//------------------------------------------------------------------------ + +namespace accessibility +{ + + AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) + : rTA( r ) + { + pFld = p; + nPara = nP; + nRealIdx = nR; + nStartIdx = nStt; + nEndIdx = nEnd; + aDescription = rD; + } + + AccessibleHyperlink::~AccessibleHyperlink() + { + delete pFld; + } + + // XAccessibleAction + sal_Int32 SAL_CALL AccessibleHyperlink::getAccessibleActionCount() throw (uno::RuntimeException) + { + return isValid() ? 1 : 0; + } + + sal_Bool SAL_CALL AccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + sal_Bool bRet = sal_False; + if ( isValid() && ( nIndex == 0 ) ) + { + rTA.FieldClicked( *pFld, nPara, nRealIdx ); + bRet = sal_True; + } + return bRet; + } + + ::rtl::OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + ::rtl::OUString aDesc; + + if ( isValid() && ( nIndex == 0 ) ) + aDesc = aDescription; + + return aDesc; + } + + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > xKeyBinding; + + if( isValid() && ( nIndex == 0 ) ) + { + ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); + xKeyBinding = pKeyBindingHelper; + + awt::KeyStroke aKeyStroke; + aKeyStroke.Modifiers = 0; + aKeyStroke.KeyCode = KEY_RETURN; + aKeyStroke.KeyChar = 0; + aKeyStroke.KeyFunc = 0; + pKeyBindingHelper->AddKeyBinding( aKeyStroke ); + } + + return xKeyBinding; + } + + // XAccessibleHyperlink + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionObject( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getStartIndex() throw (uno::RuntimeException) + { + return nStartIdx; + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getEndIndex() throw (uno::RuntimeException) + { + return nEndIdx; + } + + sal_Bool SAL_CALL AccessibleHyperlink::isValid( ) throw (uno::RuntimeException) + { + return rTA.IsValid(); + } + +} // end of namespace accessibility + +//------------------------------------------------------------------------ diff --git a/editeng/source/accessibility/AccessibleHyperlink.hxx b/editeng/source/accessibility/AccessibleHyperlink.hxx new file mode 100644 index 000000000000..5192f4b5be0b --- /dev/null +++ b/editeng/source/accessibility/AccessibleHyperlink.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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: AccessibleEditableTextPara.hxx,v $ + * $Revision: 1.22 $ + * + * 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 _SVX_ACCESSIBLE_HYPERLINK_HXX +#define _SVX_ACCESSIBLE_HYPERLINK_HXX + +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp> + +#include <tools/solar.h> + +class SvxFieldItem; +class SvxAccessibleTextAdapter; + +namespace accessibility +{ + + class AccessibleHyperlink : public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleHyperlink > + { + private: + + SvxAccessibleTextAdapter& rTA; + SvxFieldItem* pFld; + USHORT nPara, nRealIdx; // EE values + sal_Int32 nStartIdx, nEndIdx; // translated values + ::rtl::OUString aDescription; + + public: + AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ); + ~AccessibleHyperlink(); + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleHyperlink + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getStartIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEndIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid() throw (::com::sun::star::uno::RuntimeException); + }; + +} // end of namespace accessibility + +#endif + diff --git a/editeng/source/accessibility/makefile.mk b/editeng/source/accessibility/makefile.mk index e29b6477f608..80cb6df746e5 100755..100644 --- a/editeng/source/accessibility/makefile.mk +++ b/editeng/source/accessibility/makefile.mk @@ -50,6 +50,7 @@ SLOFILES = \ $(SLO)$/AccessibleStaticTextBase.obj \ $(SLO)$/AccessibleParaManager.obj \ $(SLO)$/AccessibleEditableTextPara.obj \ + $(SLO)$/AccessibleHyperlink.obj \ $(SLO)$/AccessibleImageBullet.obj # --- Tagets ------------------------------------------------------- diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 6e49976cfc1d..9fe556190f27 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -687,6 +687,33 @@ XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + mrTextForwarder->FieldClicked( rField, nPara, nPos ); +} + +sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetEEIndex(nPara, nEEIndex, *mrTextForwarder); + return aIndex.GetIndex(); +} + +USHORT SvxAccessibleTextAdapter::CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetIndex(nPara, nLogicalIndex, *mrTextForwarder); + return aIndex.GetEEIndex(); +} + + + BOOL SvxAccessibleTextAdapter::IsValid() const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index f24e815fd6b5..2f21e88f3bfa 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -171,6 +171,11 @@ XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, US return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rEditEngine.FieldClicked( rField, nPara, nPos ); +} + USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich ) { EECharAttribArray aAttribs; diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index 14e9dd69f082..2b309a6f8aa6 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -241,6 +241,11 @@ XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, USHO return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rOutliner.FieldClicked( rField, nPara, nPos ); +} + BOOL SvxOutlinerForwarder::IsValid() const { // cannot reliably query outliner state diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 1acc71e19c48..45ef23c2be8f 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -2588,6 +2588,10 @@ XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_uInt16, s return XubString(); } +void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) +{ +} + sal_Bool SvxDummyTextSource::IsValid() const { return sal_False; diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index fa4ae8893589..3d360245f1ea 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -189,7 +189,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) if ( !m_xObjectStorage.is() ) throw io::IOException(); //TODO: access denied - m_pDocHolder->SetComponent( LoadDocumentFromStorage_Impl( m_xObjectStorage ), m_bReadOnly ); + m_pDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly ); } else { diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 86fff7d913aa..97cc5d2d499b 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -63,6 +63,7 @@ OCommonEmbeddedObject::OCommonEmbeddedObject( const uno::Reference< lang::XMulti , m_xFactory( xFactory ) , m_nMiscStatus( 0 ) , m_bEmbeddedScriptSupport( sal_True ) +, m_bDocumentRecoverySupport( sal_True ) , m_bWaitSaveCompleted( sal_False ) , m_bIsLink( sal_False ) , m_bLinkHasPassword( sal_False ) @@ -89,6 +90,7 @@ OCommonEmbeddedObject::OCommonEmbeddedObject( , m_xFactory( xFactory ) , m_nMiscStatus( 0 ) , m_bEmbeddedScriptSupport( sal_True ) +, m_bDocumentRecoverySupport( sal_True ) , m_bWaitSaveCompleted( sal_False ) , m_bIsLink( sal_True ) , m_bLinkHasPassword( sal_False ) @@ -641,7 +643,8 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership ) } catch ( uno::Exception& ) {} } - m_xObjectStorage = uno::Reference< embed::XStorage >(); + m_xObjectStorage.clear(); + m_xRecoveryStorage.clear(); } m_bClosed = sal_True; // the closing succeeded diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index e1c272bd2f3b..0312d28315a6 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -60,9 +60,12 @@ #include <comphelper/fileformat.h> #include <comphelper/storagehelper.hxx> #include <comphelper/mimeconfighelper.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <rtl/logfile.hxx> +#include <tools/diagnose_ex.h> + #define USE_STORAGEBASED_DOCUMENT using namespace ::com::sun::star; @@ -195,23 +198,34 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor( } //------------------------------------------------------ +static void TransferMediaType( const uno::Reference< embed::XStorage >& i_rSource, const uno::Reference< embed::XStorage >& i_rTarget ) +{ + try + { + const uno::Reference< beans::XPropertySet > xSourceProps( i_rSource, uno::UNO_QUERY_THROW ); + const uno::Reference< beans::XPropertySet > xTargetProps( i_rTarget, uno::UNO_QUERY_THROW ); + const ::rtl::OUString sMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); + xTargetProps->setPropertyValue( sMediaTypePropName, xSourceProps->getPropertyValue( sMediaTypePropName ) ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------ static uno::Reference< util::XCloseable > CreateDocument( const uno::Reference< lang::XMultiServiceFactory >& _rxFactory, - const ::rtl::OUString& _rDocumentServiceName, bool _bEmbeddedScriptSupport ) + const ::rtl::OUString& _rDocumentServiceName, bool _bEmbeddedScriptSupport, const bool i_bDocumentRecoverySupport ) { - uno::Sequence< uno::Any > aArguments(2); - aArguments[0] <<= beans::NamedValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbeddedObject" ) ), - uno::makeAny( (sal_Bool)sal_True ) - ); - aArguments[1] <<= beans::NamedValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbeddedScriptSupport" ) ), - uno::makeAny( (sal_Bool)_bEmbeddedScriptSupport ) - ); + ::comphelper::NamedValueCollection aArguments; + aArguments.put( "EmbeddedObject", (sal_Bool)sal_True ); + aArguments.put( "EmbeddedScriptSupport", (sal_Bool)_bEmbeddedScriptSupport ); + aArguments.put( "DocumentRecoverySupport", (sal_Bool)i_bDocumentRecoverySupport ); uno::Reference< uno::XInterface > xDocument; try { - xDocument = _rxFactory->createInstanceWithArguments( _rDocumentServiceName, aArguments ); + xDocument = _rxFactory->createInstanceWithArguments( _rDocumentServiceName, aArguments.getWrappedPropertyValues() ); } catch( const uno::Exception& ) { @@ -273,7 +287,7 @@ void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::X { uno::Reference< document::XStorageBasedDocument > xDoc( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); if ( xDoc.is() ) - xDoc->switchToStorage( m_xObjectStorage ); + SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); } #endif @@ -302,10 +316,27 @@ void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::X } //------------------------------------------------------ +void OCommonEmbeddedObject::EmbedAndReparentDoc_Impl( const uno::Reference< util::XCloseable >& i_rxDocument ) const +{ + SetDocToEmbedded( uno::Reference< frame::XModel >( i_rxDocument, uno::UNO_QUERY ), m_aModuleName ); + + try + { + uno::Reference < container::XChild > xChild( i_rxDocument, uno::UNO_QUERY ); + if ( xChild.is() ) + xChild->setParent( m_xParent ); + } + catch( const lang::NoSupportException & ) + { + OSL_ENSURE( false, "OCommonEmbeddedObject::EmbedAndReparentDoc: cannot set parent at document!" ); + } +} + +//------------------------------------------------------ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() { uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY ); uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY ); @@ -315,22 +346,31 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() try { // set the document mode to embedded as the first action on document!!! - SetDocToEmbedded( xModel, m_aModuleName ); + EmbedAndReparentDoc_Impl( xDocument ); - try + // if we have a storage to recover the document from, do not use initNew, but instead load from that storage + bool bInitNew = true; + if ( m_xRecoveryStorage.is() ) { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); + uno::Reference< document::XStorageBasedDocument > xDoc( xLoadable, uno::UNO_QUERY ); + OSL_ENSURE( xDoc.is(), "OCommonEmbeddedObject::InitNewDocument_Impl: cannot recover from a storage when the document is not storage based!" ); + if ( xDoc.is() ) + { + ::comphelper::NamedValueCollection aLoadArgs; + FillDefaultLoadArgs_Impl( m_xRecoveryStorage, aLoadArgs ); + + xDoc->loadFromStorage( m_xRecoveryStorage, aLoadArgs.getPropertyValues() ); + SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); + bInitNew = false; + } } - catch( const lang::NoSupportException & ) + + if ( bInitNew ) { - OSL_ENSURE( false, "Cannot set parent at document" ); + // init document as a new + xLoadable->initNew(); } - - // init document as a new - xLoadable->initNew(); - xModel->attachResource( xModel->getURL(),m_aDocMediaDescriptor); + xModel->attachResource( xModel->getURL(), m_aDocMediaDescriptor ); } catch( uno::Exception& ) { @@ -356,7 +396,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() { uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY ); if ( !xLoadable.is() ) @@ -385,18 +425,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() try { // the document is not really an embedded one, it is a link - SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName ); - - try - { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); - } - catch( const lang::NoSupportException & ) - { - OSL_ENSURE( false, "Cannot set parent at document" ); - } + EmbedAndReparentDoc_Impl( xDocument ); // load the document xLoadable->load( aArgs ); @@ -437,7 +466,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() } //------------------------------------------------------ -::rtl::OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) +::rtl::OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const { ::rtl::OUString aFilterName = GetPresetFilterName(); if ( !aFilterName.getLength() ) @@ -453,13 +482,30 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() } //------------------------------------------------------ -uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorage_Impl( - const uno::Reference< embed::XStorage >& xStorage ) +void OCommonEmbeddedObject::FillDefaultLoadArgs_Impl( const uno::Reference< embed::XStorage >& i_rxStorage, + ::comphelper::NamedValueCollection& o_rLoadArgs ) const { - OSL_ENSURE( xStorage.is(), "The storage can not be empty!" ); + o_rLoadArgs.put( "DocumentBaseURL", GetBaseURL_Impl() ); + o_rLoadArgs.put( "HierarchicalDocumentName", m_aEntryName ); + o_rLoadArgs.put( "ReadOnly", m_bReadOnly ); + + ::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( i_rxStorage ) ); + OSL_ENSURE( aFilterName.getLength(), "OCommonEmbeddedObject::FillDefaultLoadArgs_Impl: Wrong document service name!" ); + if ( !aFilterName.getLength() ) + throw io::IOException(); // TODO: error message/code + + o_rLoadArgs.put( "FilterName", aFilterName ); +} + +//------------------------------------------------------ +uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorage_Impl() +{ + ENSURE_OR_THROW( m_xObjectStorage.is(), "no object storage" ); + + const uno::Reference< embed::XStorage > xSourceStorage( m_xRecoveryStorage.is() ? m_xRecoveryStorage : m_xObjectStorage ); uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); //#i103460# ODF: take the size given from the parent frame as default uno::Reference< chart2::XChartDocument > xChart( xDocument, uno::UNO_QUERY ); @@ -479,28 +525,13 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag if ( !xDoc.is() && !xLoadable.is() ) ///BUG: This should be || instead of && ? throw uno::RuntimeException(); - ::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( xStorage ) ); - - OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" ); - if ( !aFilterName.getLength() ) - throw io::IOException(); - - sal_Int32 nLen = xDoc.is() ? 4 : 6; - uno::Sequence< beans::PropertyValue > aArgs( nLen ); - - aArgs[0].Name = ::rtl::OUString::createFromAscii( "DocumentBaseURL" ); - aArgs[0].Value <<= GetBaseURL_Impl(); - aArgs[1].Name = ::rtl::OUString::createFromAscii( "HierarchicalDocumentName" ); - aArgs[1].Value <<= m_aEntryName; - aArgs[2].Name = ::rtl::OUString::createFromAscii( "ReadOnly" ); - aArgs[2].Value <<= m_bReadOnly; - aArgs[3].Name = ::rtl::OUString::createFromAscii( "FilterName" ); - aArgs[3].Value <<= aFilterName; + ::comphelper::NamedValueCollection aLoadArgs; + FillDefaultLoadArgs_Impl( xSourceStorage, aLoadArgs ); uno::Reference< io::XInputStream > xTempInpStream; if ( !xDoc.is() ) { - xTempInpStream = createTempInpStreamFromStor( xStorage, m_xFactory ); + xTempInpStream = createTempInpStreamFromStor( xSourceStorage, m_xFactory ); if ( !xTempInpStream.is() ) throw uno::RuntimeException(); @@ -518,42 +549,27 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag OSL_ENSURE( aTempFileURL.getLength(), "Coudn't retrieve temporary file URL!\n" ); - aArgs[4].Name = ::rtl::OUString::createFromAscii( "URL" ); - aArgs[4].Value <<= aTempFileURL; // ::rtl::OUString::createFromAscii( "private:stream" ); - aArgs[5].Name = ::rtl::OUString::createFromAscii( "InputStream" ); - aArgs[5].Value <<= xTempInpStream; + aLoadArgs.put( "URL", aTempFileURL ); + aLoadArgs.put( "InputStream", xTempInpStream ); } - // aArgs[4].Name = ::rtl::OUString::createFromAscii( "AsTemplate" ); - // aArgs[4].Value <<= sal_True; + // aLoadArgs.put( "AsTemplate", sal_True ); - aArgs.realloc( m_aDocMediaDescriptor.getLength() + nLen ); - for ( sal_Int32 nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ ) - { - aArgs[nInd+nLen].Name = m_aDocMediaDescriptor[nInd].Name; - aArgs[nInd+nLen].Value = m_aDocMediaDescriptor[nInd].Value; - } + aLoadArgs.merge( m_aDocMediaDescriptor, true ); try { // set the document mode to embedded as the first step!!! - SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName ); + EmbedAndReparentDoc_Impl( xDocument ); - try - { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); - } - catch( const lang::NoSupportException & ) + if ( xDoc.is() ) { - OSL_ENSURE( false, "Cannot set parent at document" ); + xDoc->loadFromStorage( xSourceStorage, aLoadArgs.getPropertyValues() ); + if ( xSourceStorage != m_xObjectStorage ) + SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); } - - if ( xDoc.is() ) - xDoc->loadFromStorage( xStorage, aArgs ); else - xLoadable->load( aArgs ); + xLoadable->load( aLoadArgs.getPropertyValues() ); } catch( uno::Exception& ) { @@ -566,6 +582,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag } catch( uno::Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } @@ -655,7 +672,7 @@ void OCommonEmbeddedObject::SaveObject_Impl() } //------------------------------------------------------ -::rtl::OUString OCommonEmbeddedObject::GetBaseURL_Impl() +::rtl::OUString OCommonEmbeddedObject::GetBaseURL_Impl() const { ::rtl::OUString aBaseURL; sal_Int32 nInd = 0; @@ -727,6 +744,19 @@ void OCommonEmbeddedObject::SaveObject_Impl() //------------------------------------------------------ +void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< document::XStorageBasedDocument >& xDoc, const uno::Reference< embed::XStorage >& xStorage ) +{ + xDoc->switchToStorage( xStorage ); + + uno::Reference< util::XModifiable > xModif( xDoc, uno::UNO_QUERY ); + if ( xModif.is() ) + xModif->setModified( sal_False ); + + if ( m_xRecoveryStorage.is() ) + m_xRecoveryStorage.clear(); +} + +//------------------------------------------------------ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Int32 nStorageFormat, const ::rtl::OUString& aBaseURL, @@ -764,12 +794,7 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed: xDoc->storeToStorage( xStorage, aArgs ); if ( bAttachToTheStorage ) - { - xDoc->switchToStorage( xStorage ); - uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); - if ( xModif.is() ) - xModif->setModified( sal_False ); - } + SwitchDocToStorage_Impl( xDoc, xStorage ); } else #endif @@ -801,7 +826,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDesc const uno::Sequence< beans::PropertyValue >& aMedDescr ) { uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY ); if ( !xLoadable.is() ) @@ -810,18 +835,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDesc try { // set the document mode to embedded as the first action on the document!!! - SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName ); - - try - { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); - } - catch( const lang::NoSupportException & ) - { - OSL_ENSURE( false, "Cannot set parent at document" ); - } + EmbedAndReparentDoc_Impl( xDocument ); xLoadable->load( addAsTemplate( aMedDescr ) ); } @@ -1060,6 +1074,14 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( { OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bEmbeddedScriptSupport ); } + else if ( lObjArgs[nObjInd].Name.equalsAscii( "DocumentRecoverySupport" ) ) + { + OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bDocumentRecoverySupport ); + } + else if ( lObjArgs[nObjInd].Name.equalsAscii( "RecoveryStorage" ) ) + { + OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_xRecoveryStorage ); + } sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE; @@ -1095,6 +1117,9 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( } else if ( nEntryConnectionMode == embed::EntryInitModes::TRUNCATE_INIT ) { + if ( m_xRecoveryStorage.is() ) + TransferMediaType( m_xRecoveryStorage, m_xObjectStorage ); + // TODO: m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly ); diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 59e709ac3ec7..8d3b830c2cc4 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -32,6 +32,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XVisualObject.hpp> #include <com/sun/star/embed/XEmbedPersist.hpp> @@ -71,6 +72,10 @@ namespace cppu { class OMultiTypeInterfaceContainerHelper; } +namespace comphelper { + class NamedValueCollection; +} + #define NUM_SUPPORTED_STATES 5 // #define NUM_SUPPORTED_VERBS 5 @@ -126,6 +131,7 @@ protected: ::rtl::OUString m_aDefaultParentBaseURL; ::rtl::OUString m_aModuleName; sal_Bool m_bEmbeddedScriptSupport; + sal_Bool m_bDocumentRecoverySupport; Interceptor* m_pInterceptor; @@ -146,6 +152,7 @@ protected: ::rtl::OUString m_aEntryName; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xObjectStorage; + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xRecoveryStorage; // link related stuff ::rtl::OUString m_aLinkURL; @@ -177,8 +184,8 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewParentStorage, const ::rtl::OUString& aNewName ); - ::rtl::OUString GetDocumentServiceName() { return m_aDocServiceName; } - ::rtl::OUString GetPresetFilterName() { return m_aPresetFilterName; } + ::rtl::OUString GetDocumentServiceName() const { return m_aDocServiceName; } + ::rtl::OUString GetPresetFilterName() const { return m_aPresetFilterName; } ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > StoreDocumentToTempStream_Impl( sal_Int32 nStorageFormat, @@ -195,9 +202,8 @@ private: ::com::sun::star::uno::Sequence< sal_Int32 > GetIntermediateStatesSequence_Impl( sal_Int32 nNewState ); - ::rtl::OUString GetFilterName( sal_Int32 nVersion ); - ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadDocumentFromStorage_Impl( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + ::rtl::OUString GetFilterName( sal_Int32 nVersion ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadDocumentFromStorage_Impl(); ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadLink_Impl(); @@ -209,12 +215,25 @@ private: const ::rtl::OUString& aHierarchName, sal_Bool bAttachToStorage ); + void SwitchDocToStorage_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + + void FillDefaultLoadArgs_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rxStorage, + ::comphelper::NamedValueCollection& o_rLoadArgs + ) const; + + void EmbedAndReparentDoc_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >& i_rxDocument + ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > CreateDocFromMediaDescr_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMedDescr ); ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > CreateTempDocFromLink_Impl(); - ::rtl::OUString GetBaseURL_Impl(); + ::rtl::OUString GetBaseURL_Impl() const; ::rtl::OUString GetBaseURLFrom_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ); diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 5232598f56f2..f1a97171fa11 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -32,7 +32,6 @@ #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> #include <sfx2/viewfrm.hxx> -#include <sfx2/topfrm.hxx> #include <vcl/svapp.hxx> #include <vcl/mnemonic.hxx> #include <vcl/tabpage.hxx> diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx index 2b4ce95a9bad..10e429f201c5 100644 --- a/fpicker/source/aqua/FilterHelper.cxx +++ b/fpicker/source/aqua/FilterHelper.cxx @@ -391,30 +391,25 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); -// OSL_TRACE("filter event handler called"); - if (m_aCurrentFilter == NULL) { OSL_TRACE("filter name is null"); return sal_True; } NSFileManager *manager = [NSFileManager defaultManager]; - MacOSBOOL bDir = NO; - if ([manager fileExistsAtPath:sFilename isDirectory:&bDir] && bDir == YES) { -// 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; + NSDictionary* pAttribs = [manager fileAttributesAtPath: sFilename traverseLink: NO]; + if( pAttribs ) + { + NSObject* pType = [pAttribs objectForKey: NSFileType]; + if( pType && [pType isKindOfClass: [NSString class]] ) + { + NSString* pT = (NSString*)pType; + if( [pT isEqualToString: NSFileTypeDirectory] || + [pT isEqualToString: NSFileTypeSymbolicLink] ) + return sal_True; + } } -// OSL_TRACE(" file"); - FilterList::iterator filter = ::std::find_if(m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch(m_aCurrentFilter)); if (filter == m_pFilterList->end()) { OSL_TRACE("filter not found in list"); @@ -424,7 +419,6 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) OUStringList suffixList = filter->getFilterSuffixList(); { -// OSL_TRACE(" starting to work"); rtl::OUString aName = [sFilename OUString]; rtl::OUString allMatcher = rtl::OUString::createFromAscii(".*"); for(OUStringList::iterator iter = suffixList.begin(); iter != suffixList.end(); iter++) { diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx index 058796fa4e4a..046147ff4b77 100644 --- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx +++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx @@ -139,8 +139,6 @@ KDE4FilePicker::KDE4FilePicker( const uno::Reference<lang::XMultiServiceFactory> //default mode _dialog->setOperationMode(KFileDialog::Opening); - - _dialog->setStyleSheet("color: black;"); } KDE4FilePicker::~KDE4FilePicker() @@ -185,6 +183,7 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute() _dialog->clearFilter(); _dialog->setFilter(_filter); + _dialog->filterWidget()->setEditable(false); //block and wait for user input if (_dialog->exec() == KFileDialog::Accepted) @@ -236,7 +235,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() QCheckBox *cb = dynamic_cast<QCheckBox*> ( _customWidgets[ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ]); - if (cb->isChecked()) + if (cb && cb->isChecked()) { extension = _dialog->currentFilter(); // assuming filter value is like this *.ext extension.replace("*",""); @@ -631,13 +630,13 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) case FILESAVE_AUTOEXTENSION: operationMode = KFileDialog::Saving; - addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); break; case FILESAVE_AUTOEXTENSION_PASSWORD: { operationMode = KFileDialog::Saving; - addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); break; } @@ -688,6 +687,7 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) } _dialog->setOperationMode(operationMode); + _dialog->setConfirmOverwrite(true); } void SAL_CALL KDE4FilePicker::cancel() diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk index feea7ee80349..17e4f2609069 100644 --- a/fpicker/source/win32/filepicker/makefile.mk +++ b/fpicker/source/win32/filepicker/makefile.mk @@ -43,6 +43,7 @@ CDEFS+=-D_UNICODE CDEFS+=-DUNICODE #CDEFS+=-DWIN32_LEAN_AND_MEAN #CDEFS+=-DWIN32 +CDEFS+=-U_WIN32_WINNT -D_WIN32_WINNT=0x0600 # --- Resources ---------------------------------------------------- diff --git a/framework/inc/classes/checkediterator.hxx b/framework/inc/classes/checkediterator.hxx index 04015ce3003c..7c337b023ba3 100644 --- a/framework/inc/classes/checkediterator.hxx +++ b/framework/inc/classes/checkediterator.hxx @@ -138,7 +138,7 @@ class CheckedIterator if( m_eEndState == E_UNKNOWN ) { - // Set new container and actualize other member. + // Set new container and update other member. m_pContainer = &rContainer ; m_eEndState = E_BEFOREEND ; m_pPosition = m_pContainer->begin(); diff --git a/framework/inc/framework.hrc b/framework/inc/framework.hrc index acf1d19a193d..e49192aa7c33 100644 --- a/framework/inc/framework.hrc +++ b/framework/inc/framework.hrc @@ -59,14 +59,11 @@ #define BMP_BACKING_FORMULA 11 #define BMP_BACKING_OPENFILE 12 #define BMP_BACKING_OPENTEMPLATE 13 -#define BMP_BACKING_EXT 14 #define STR_BACKING_EXTHELP 15 -#define BMP_BACKING_REG 16 #define STR_BACKING_REGHELP 17 -#define BMP_BACKING_INFO 18 #define STR_BACKING_INFOHELP 19 -#define BMP_BACKING_TPLREP 20 #define STR_BACKING_TPLREP 21 +#define BMP_BACKING_FOLDER 22 #define RES_BACKING_IMAGES (DLG_BACKING+1) #define RES_BACKING_IMAGES_HC (DLG_BACKING+2) @@ -76,6 +73,10 @@ #define BMP_BACKING_BACKGROUND_RIGHT 3 #define BMP_BACKING_BACKGROUND_RTL_LEFT 4 #define BMP_BACKING_BACKGROUND_RTL_RIGHT 5 +#define BMP_BACKING_EXT 6 +#define BMP_BACKING_REG 7 +#define BMP_BACKING_INFO 8 +#define BMP_BACKING_TPLREP 9 // Ids of TabWindow #define WIN_TABWINDOW (RID_FWK_DIALOG_START+101) diff --git a/framework/inc/interaction/preventduplicateinteraction.hxx b/framework/inc/interaction/preventduplicateinteraction.hxx index ee46ddba2842..4ba9554b21f9 100644 --- a/framework/inc/interaction/preventduplicateinteraction.hxx +++ b/framework/inc/interaction/preventduplicateinteraction.hxx @@ -37,7 +37,7 @@ //_________________________________________________________________________________________________________________ // interface includes //_________________________________________________________________________________________________________________ -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/XInteractionHandler2.hpp> #include <com/sun/star/task/XInteractionRequest.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -83,7 +83,7 @@ struct ThreadHelpBase2 }; class PreventDuplicateInteraction : private ThreadHelpBase2 - ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler > + ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 > { //_____________________________________ // structs, types etcp. @@ -155,6 +155,30 @@ class PreventDuplicateInteraction : private ThreadHelpBase2 virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) throw(css::uno::RuntimeException); + //_________________________________ + /** + @interface XInteractionHandler2 + @short called from outside to handle a problem + @descr We filter the incoming interactions. some of them + will be forwarded to the generic UI interaction handler. + So we must not implement it twice. Some other ones + will be aborted only. + + @threadsafe yes + */ + virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest ) + throw (::com::sun::star::uno::RuntimeException); + + //_________________________________ + /** + @interface XInterface + @short called to query another interface of the component + @descr Will allow to query for XInteractionHandler2 if and only if m_xHandler supports this interface, too. + + @threadsafe yes + */ + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); //_____________________________________ // c++ interface public: diff --git a/framework/inc/jobs/jobdata.hxx b/framework/inc/jobs/jobdata.hxx index f4e1d2076c6a..21aa027cc874 100644 --- a/framework/inc/jobs/jobdata.hxx +++ b/framework/inc/jobs/jobdata.hxx @@ -230,7 +230,7 @@ class JobData : private ThreadHelpBase after a job was sucessfully executed (by any outside code using our informations) it can return a result. This member make it part of this container too. So it can be used for further things. - We use it also to actualize our internal state and the configuration + We use it also to update our internal state and the configuration of the job. But note: only the last result will be saved here! */ JobResult m_aLastExecutionResult; diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx index 3af8f0cdf704..1c64e99ed91d 100644 --- a/framework/inc/services/autorecovery.hxx +++ b/framework/inc/services/autorecovery.hxx @@ -167,12 +167,6 @@ class AutoRecovery : public css::lang::XTypeProvider E_UNKNOWN = 0, /// modified against the original file E_MODIFIED = 1, - /** We differe between the states: "modified in general" and "modified after last AutoSave". - The first state will be interesting in case the crashed document will be restored. Then we have - set the right modify state after loading the document. But the second state let us optimize the - AutoSave itself. see member ListenForModify too ... - */ - E_MODIFIED_SINCE_LAST_AUTOSAVE = 1024, /// an active document can be postponed to be saved later. E_POSTPONED = 2, /// was already handled during one AutoSave/Recovery session. @@ -306,10 +300,13 @@ class AutoRecovery : public css::lang::XTypeProvider ::rtl::OUString NewTempURL; ::rtl::OUString AppModule; // e.g. com.sun.star.text.TextDocument - used to identify app module + ::rtl::OUString FactoryService; // the service to create a document of the module ::rtl::OUString RealFilter; // real filter, which was used at loading time ::rtl::OUString DefaultFilter; // supports saving of the default format without loosing data ::rtl::OUString Extension; // file extension of the default filter ::rtl::OUString Title; // can be used as "DisplayName" on every recovery UI! + ::com::sun::star::uno::Sequence< ::rtl::OUString > + ViewNames; // names of the view which were active at emergency-save time sal_Int32 ID; }; @@ -605,7 +602,7 @@ class AutoRecovery : public css::lang::XTypeProvider @threadsafe */ - void implts_actualizeTimer(); + void implts_updateTimer(); //--------------------------------------- /** @short stop the timer. @@ -673,7 +670,7 @@ class AutoRecovery : public css::lang::XTypeProvider //--------------------------------------- // TODO document me - void implts_actualizeModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument); + void implts_updateModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument); //--------------------------------------- // TODO document me @@ -862,7 +859,17 @@ class AutoRecovery : public css::lang::XTypeProvider //--------------------------------------- // TODO document me - void implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentInfo& rInfo); + void implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo& rInfo); + + /** retrieves the names of all active views of the given document + @param rInfo + the document info, whose <code>Document</code> member must not be <NULL/>. + */ + void implts_collectActiveViewNames( AutoRecovery::TDocumentInfo& rInfo ); + + /** updates the configuration so that for all documents, their current view/names are stored + */ + void implts_persistAllActiveViewNames(); //--------------------------------------- // TODO document me diff --git a/framework/source/inc/loadenv/loaddispatchlistener.hxx b/framework/source/inc/loadenv/loaddispatchlistener.hxx deleted file mode 100644 index 6d1bf8d165a2..000000000000 --- a/framework/source/inc/loadenv/loaddispatchlistener.hxx +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ -#define __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ - -//_______________________________________________ -// includes of own project - -#include <threadhelp/threadhelpbase.hxx> -#include <threadhelp/gate.hxx> -#include <macros/xinterface.hxx> - -//_______________________________________________ -// includes of uno interface -#include <com/sun/star/frame/XDispatchResultListener.hpp> - -/* -#include <com/sun/star/frame/DispatchResultEvent.hpp> -*/ - -//_______________________________________________ -// includes of an other project - -#ifndef _OSL_CONDITN_HXX_ -#include <osl/condition.hxx> -#endif -#include <cppuhelper/weak.hxx> - -//_______________________________________________ -// namespace - -namespace framework{ - -namespace css = ::com::sun::star; - -//_______________________________________________ -// definitions - -/** @short listen for finished dispatches, where document will be loaded. - - @descr This listener can be bound to an URL - so its well known - for which load request this event was triggered. - Thats needed - but not supported by the XDispatchResultListener - notification. - Further a condition can be used to synchronize any outside code - against the occurence of this event. - - @author as96863 - */ -class LoadDispatchListener : public css::frame::XDispatchResultListener // => css.lang.XEventListener - , private ThreadHelpBase - , public ::cppu::OWeakObject -{ - //___________________________________________ - // member - - private: - - /** @short the URL which is bound to this callback. */ - ::rtl::OUString m_sURL; - - /** @short the original event, which was notified to this object. */ - css::frame::DispatchResultEvent m_aResult; - - /** @short used to let the user of this instance wait, till an - event occures. - */ - ::osl::Condition m_aUserWait; - - //___________________________________________ - // native interface - - public: - - //_______________________________________ - /** @short initialize a new instance of this class. */ - LoadDispatchListener(); - - //_______________________________________ - /** @short deinitialize an instance of this class. */ - virtual ~LoadDispatchListener(); - - //_______________________________________ - /** @short bind this listenerr to a new URL. - - @param sURL - the new URL bound to this instance. - */ - void setURL(const ::rtl::OUString & sURL); - - //_______________________________________ - /** @short let the user of this instance wait. - - @descr If the call timed out - false is returned. - Otherwise it returns true. - Then the method getResult() has to be called, - to get the origianl event. - - @param nWait_ms - the time for wait in [ms]. - If its set to 0 this call is blocked till - an event occures! - - @return TRUE if an event occured in time - FALSE otherwhise. - */ - sal_Bool wait(sal_Int32 nWait_ms); - - //_______________________________________ - /** @short returns the result of this listener operation. - - @descr If wait() (which must be called before!) returns FALSE - the return of getResult() is undefined! - - @return The result of the got listener notification. - */ - css::frame::DispatchResultEvent getResult() const; - - //___________________________________________ - // uno interface - - public: - - //_______________________________________ - // css.uno.XInterface - FWK_DECLARE_XINTERFACE - - //_______________________________________ - // css.frame.XDispatchResultListener - virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aEvent) - throw(css::uno::RuntimeException); - - //_______________________________________ - // css.lang.XEventListener - virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) - throw(css::uno::RuntimeException); -}; - -} // namespace framework - -#endif // __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index f78117d7021b..982f390f8469 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -417,6 +417,7 @@ class LoadEnv : private ThreadHelpBase virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) throw(css::uno::RuntimeException); */ + //___________________________________________ // static interface @@ -455,6 +456,14 @@ class LoadEnv : private ThreadHelpBase const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor); /** TODO document me ... */ + static void initializeUIDefaults( + const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + ::comphelper::MediaDescriptor& io_lMediaDescriptor, + const bool _bUIMode, + QuietInteraction** o_ppQuiteInteraction + ); + + /** TODO document me ... */ void impl_setResult(sal_Bool bResult); /** TODO document me ... */ @@ -484,7 +493,7 @@ class LoadEnv : private ThreadHelpBase /** @short tries to detect the type and the filter of the specified content. - @descr This method actualize the available media descriptor of this instance, + @descr This method update the available media descriptor of this instance, so it contains the right type, a corresponding filter, may a valid frame loader etc. In case detection failed, this descriptor is corrected first, before a suitable exception will be thrown. diff --git a/framework/source/inc/loadenv/loadenvexception.hxx b/framework/source/inc/loadenv/loadenvexception.hxx index 45282fb252bc..bb26e98f4695 100644 --- a/framework/source/inc/loadenv/loadenvexception.hxx +++ b/framework/source/inc/loadenv/loadenvexception.hxx @@ -172,11 +172,11 @@ class LoadEnvException @param exUno the original catched uno exception. */ - LoadEnvException( sal_Int32 nID , - const css::uno::Exception& exUno) + LoadEnvException( sal_Int32 nID , + const css::uno::Any& exUno) { - m_nID = nID ; - m_exOriginal <<= exUno; + m_nID = nID ; + m_exOriginal = exUno; } //_______________________________________ diff --git a/framework/source/interaction/preventduplicateinteraction.cxx b/framework/source/interaction/preventduplicateinteraction.cxx index 5bfd05bbb4b8..6d0185a48080 100644 --- a/framework/source/interaction/preventduplicateinteraction.cxx +++ b/framework/source/interaction/preventduplicateinteraction.cxx @@ -109,6 +109,20 @@ void PreventDuplicateInteraction::useDefaultUUIHandler() } //_________________________________________________________________________________________________________________ +css::uno::Any SAL_CALL PreventDuplicateInteraction::queryInterface( const css::uno::Type& aType ) + throw (css::uno::RuntimeException) +{ + if ( aType.equals( XInteractionHandler2::static_type() ) ) + { + ::osl::ResettableMutexGuard aLock(m_aLock); + css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY ); + if ( !xHandler.is() ) + return css::uno::Any(); + } + return ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 >::queryInterface( aType ); +} + +//_________________________________________________________________________________________________________________ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) throw(css::uno::RuntimeException) @@ -166,6 +180,65 @@ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css //_________________________________________________________________________________________________________________ +::sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) + throw (css::uno::RuntimeException) +{ + css::uno::Any aRequest = xRequest->getRequest(); + sal_Bool bHandleIt = sal_True; + + // SAFE -> + ::osl::ResettableMutexGuard aLock(m_aLock); + + InteractionList::iterator pIt; + for ( pIt = m_lInteractionRules.begin(); + pIt != m_lInteractionRules.end() ; + ++pIt ) + { + InteractionInfo& rInfo = *pIt; + + if (aRequest.isExtractableTo(rInfo.m_aInteraction)) + { + ++rInfo.m_nCallCount; + rInfo.m_xRequest = xRequest; + bHandleIt = (rInfo.m_nCallCount <= rInfo.m_nMaxCount); + break; + } + } + + css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY ); + OSL_ENSURE( xHandler.is() || !m_xHandler.is(), + "PreventDuplicateInteraction::handleInteractionRequest: inconsistency!" ); + + aLock.clear(); + // <- SAFE + + if ( + (bHandleIt ) && + (xHandler.is()) + ) + { + return xHandler->handleInteractionRequest(xRequest); + } + else + { + const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations(); + sal_Int32 c = lContinuations.getLength(); + sal_Int32 i = 0; + for (i=0; i<c; ++i) + { + css::uno::Reference< css::task::XInteractionAbort > xAbort(lContinuations[i], css::uno::UNO_QUERY); + if (xAbort.is()) + { + xAbort->select(); + break; + } + } + } + return false; +} + +//_________________________________________________________________________________________________________________ + void PreventDuplicateInteraction::addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo) { // SAFE -> diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 0d2da921b9f0..4acbce44f831 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -302,10 +302,10 @@ void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& /* SAFE { */ WriteGuard aWriteLock(m_aLock); - // actualize member + // update member m_lArguments = lArguments; - // actualize the configuration ... if possible! + // update the configuration ... if possible! if (m_eMode==E_ALIAS) { // It doesn't matter if this config object was already opened before. @@ -363,7 +363,7 @@ void JobData::setResult( const JobResult& aResult ) // overwrite the last saved result m_aLastExecutionResult = aResult; - // Don't use his informations to actualize + // Don't use his informations to update // e.g. the arguments of this job. It must be done // from outside! Here we save this information only. @@ -533,7 +533,7 @@ void JobData::disableJob() if (m_eMode!=E_EVENT) return; - // actualize the configuration + // update the configuration // It doesn't matter if this config object was already opened before. // It doesn nothing here then ... or it change the mode automaticly, if // it was opened using another one before. diff --git a/framework/source/jobs/jobresult.cxx b/framework/source/jobs/jobresult.cxx index b5d9ee440fe8..375a3e5fc4d6 100644 --- a/framework/source/jobs/jobresult.cxx +++ b/framework/source/jobs/jobresult.cxx @@ -81,7 +81,7 @@ JobResult::JobResult() /** @short special ctor @descr It initialize this new instance with a pure job execution result - and analyze it. Doing so, we actualize our other members. + and analyze it. Doing so, we update our other members. <p> It's a list of named values, packed inside this any. @@ -133,7 +133,7 @@ JobResult::JobResult( /*IN*/ const css::uno::Any& aResult ) // That can be usefull if something will fail here ... m_eParts = E_NOPART; - // analyze the result and actualize our other members + // analyze the result and update our other members ::comphelper::SequenceAsHashMap aProtocol(aResult); if ( aProtocol.empty() ) return; diff --git a/framework/source/loadenv/loaddispatchlistener.cxx b/framework/source/loadenv/loaddispatchlistener.cxx deleted file mode 100644 index e0cce20c8758..000000000000 --- a/framework/source/loadenv/loaddispatchlistener.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_______________________________________________ -// includes of own project -#include <loadenv/loaddispatchlistener.hxx> -#include <threadhelp/writeguard.hxx> -#include <threadhelp/readguard.hxx> - -//_______________________________________________ -// includes of uno interface -#include <com/sun/star/frame/DispatchResultState.hpp> - -//_______________________________________________ -// includes of an other project -#include <vcl/svapp.hxx> - -//_______________________________________________ -// namespace - -namespace framework{ - -// may there exist already a define .-( -#ifndef css -namespace css = ::com::sun::star; -#endif - -//_______________________________________________ -// declarations - -//----------------------------------------------- -DEFINE_XINTERFACE_2(LoadDispatchListener , - OWeakObject , - DIRECT_INTERFACE (css::frame::XDispatchResultListener ), - DERIVED_INTERFACE(css::lang::XEventListener, css::frame::XDispatchResultListener)) - -//----------------------------------------------- -LoadDispatchListener::LoadDispatchListener() - : ThreadHelpBase(&Application::GetSolarMutex()) -{ - // reset the condition object - so our user can wait there. - m_aUserWait.reset(); - // set defined state for our result value - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); -} - -//----------------------------------------------- -LoadDispatchListener::~LoadDispatchListener() -{ -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::dispatchFinished(const css::frame::DispatchResultEvent& aEvent) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult = aEvent; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::disposing(const css::lang::EventObject&) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void LoadDispatchListener::setURL(const ::rtl::OUString & sURL) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_sURL = sURL; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- -} - -//----------------------------------------------- -sal_Bool LoadDispatchListener::wait(sal_Int32 /*nWait_ms*/) -{ - // Wait till an event occures - m_aUserWait.wait(0); - // reset the condition, so this method can be called again. - // Of course a new action has to be started outside too! - m_aUserWait.reset(); - - // TODO implement real timeout :-) - return sal_True; -} - -//----------------------------------------------- -css::frame::DispatchResultEvent LoadDispatchListener::getResult() const -{ - // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); - return m_aResult; - // <- SAFE ---------------------------------- -} - -} // namespace framework diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index c1d76d6f8985..b9f1d2c8a09a 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -321,22 +321,41 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& /*TODO progress is bound to a frame ... How can we set it here? */ + // UI mode + const bool bUIMode = + ( ( m_eFeature & E_WORK_WITH_UI ) == E_WORK_WITH_UI ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False ) == sal_False ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False ) == sal_False ); + + initializeUIDefaults( + m_xSMGR, + m_lMediaDescriptor, + bUIMode, + &m_pQuietInteraction + ); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +/*----------------------------------------------- + 22.01.2010 +-----------------------------------------------*/ +void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + ::comphelper::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode, + QuietInteraction** o_ppQuietInteraction ) +{ css::uno::Reference< css::task::XInteractionHandler > xInteractionHandler; sal_Int16 nMacroMode ; sal_Int16 nUpdateMode ; - // UI mode - if ( - ((m_eFeature & E_WORK_WITH_UI) == E_WORK_WITH_UI) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False) == sal_False ) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False) == sal_False ) - ) + if ( i_bUIMode ) { nMacroMode = css::document::MacroExecMode::USE_CONFIG; nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG; try { - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(m_xSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(i_rSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); } catch(const css::uno::RuntimeException&) {throw;} catch(const css::uno::Exception& ) { } @@ -346,27 +365,28 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& { nMacroMode = css::document::MacroExecMode::NEVER_EXECUTE; nUpdateMode = css::document::UpdateDocMode::NO_UPDATE; - m_pQuietInteraction = new QuietInteraction(); - m_pQuietInteraction->acquire(); - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(m_pQuietInteraction), css::uno::UNO_QUERY); + QuietInteraction* pQuietInteraction = new QuietInteraction(); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(pQuietInteraction), css::uno::UNO_QUERY); + if ( o_ppQuietInteraction != NULL ) + { + *o_ppQuietInteraction = pQuietInteraction; + (*o_ppQuietInteraction)->acquire(); + } } if ( - (xInteractionHandler.is() ) && - (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == m_lMediaDescriptor.end()) + (xInteractionHandler.is() ) && + (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == io_lMediaDescriptor.end()) ) { - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; } - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; } /*----------------------------------------------- @@ -818,7 +838,7 @@ void LoadEnv::impl_detectTypeAndFilter() // Attention: Because our stl media descriptor is a copy of an uno sequence // we cant use as an in/out parameter here. Copy it before and dont forget to - // actualize structure afterwards again! + // update structure afterwards again! css::uno::Sequence< css::beans::PropertyValue > lDescriptor = m_lMediaDescriptor.getAsConstPropertyValueList(); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; @@ -1626,7 +1646,6 @@ void LoadEnv::impl_reactForLoadingState() // We dont hide already visible frames here ... css::uno::Reference< css::awt::XWindow > xWindow = m_xTargetFrame->getContainerWindow(); sal_Bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN(), sal_False); - sal_Bool bRecovered = (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()) != m_lMediaDescriptor.end()); sal_Bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_MINIMIZED(), sal_False); if (bMinimized) @@ -1638,7 +1657,7 @@ void LoadEnv::impl_reactForLoadingState() ((WorkWindow*)pWindow)->Minimize(); } else - if (!bHidden && !bRecovered) + if (!bHidden) { // show frame ... if it's not still visible ... // But do nothing if it's already visible! @@ -1723,9 +1742,8 @@ void LoadEnv::impl_reactForLoadingState() if (bThrow) { - css::uno::Exception aEx; - if ( aRequest >>= aEx ) - throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aEx ); + if ( aRequest.isExtractableTo( ::cppu::UnoType< css::uno::Exception >::get() ) ) + throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aRequest ); } // <- SAFE ---------------------------------- diff --git a/framework/source/loadenv/makefile.mk b/framework/source/loadenv/makefile.mk index fead332b0678..c68ad8d304cb 100644 --- a/framework/source/loadenv/makefile.mk +++ b/framework/source/loadenv/makefile.mk @@ -38,7 +38,6 @@ ENABLE_EXCEPTIONS= TRUE SLOFILES= \ $(SLO)$/loadenv.obj \ - $(SLO)$/loaddispatchlistener.obj \ $(SLO)$/targethelper.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 57429468461f..c4cc7149ab6d 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -28,10 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" #include "services/autorecovery.hxx" +#include <loadenv/loadenv.hxx> //_______________________________________________ // own includes -#include <loadenv/loaddispatchlistener.hxx> #include <loadenv/targethelper.hxx> #include <pattern/frame.hxx> #include <threadhelp/readguard.hxx> @@ -47,6 +47,8 @@ // interface includes #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XLoadable.hpp> +#include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -67,6 +69,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentRecovery.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> @@ -75,10 +78,12 @@ // other includes #include <comphelper/configurationhelper.hxx> #include <comphelper/mediadescriptor.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <vcl/svapp.hxx> #include <unotools/pathoptions.hxx> #include <tools/link.hxx> #include <tools/string.hxx> +#include <tools/diagnose_ex.h> #include <unotools/tempfile.hxx> #include <ucbhelper/content.hxx> @@ -88,6 +93,7 @@ #include <unotools/bootstrap.hxx> #include <unotools/configmgr.hxx> #include <svl/documentlockfile.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <tools/urlobj.hxx> @@ -98,6 +104,23 @@ namespace css = ::com::sun::star; #endif +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Any; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::document::XDocumentRecovery; +using ::com::sun::star::frame::XModel2; +using ::com::sun::star::frame::XModel; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::frame::XLoadable; +using ::com::sun::star::frame::XStorable; +using ::com::sun::star::lang::XComponent; + namespace fpf = ::framework::pattern::frame; namespace framework @@ -131,6 +154,7 @@ static const ::rtl::OUString CFG_ENTRY_PROP_DOCUMENTSTATE = ::rtl::OUString: static const ::rtl::OUString CFG_ENTRY_PROP_FILTER = ::rtl::OUString::createFromAscii("Filter" ); static const ::rtl::OUString CFG_ENTRY_PROP_TITLE = ::rtl::OUString::createFromAscii("Title" ); static const ::rtl::OUString CFG_ENTRY_PROP_ID = ::rtl::OUString::createFromAscii("ID" ); +static const ::rtl::OUString CFG_ENTRY_PROP_VIEWNAMES = ::rtl::OUString::createFromAscii("ViewNames" ); static const ::rtl::OUString FILTER_PROP_TYPE = ::rtl::OUString::createFromAscii("Type" ); static const ::rtl::OUString FILTER_PROP_NAME = ::rtl::OUString::createFromAscii("Name" ); @@ -140,6 +164,7 @@ static const ::rtl::OUString DOCINFO_PROP_TEMPLATE = ::rtl::OUString:: // setup.xcu static const ::rtl::OUString CFG_ENTRY_PROP_EMPTYDOCUMENTURL = ::rtl::OUString::createFromAscii("ooSetupFactoryEmptyDocumentURL"); static const ::rtl::OUString CFG_ENTRY_PROP_DEFAULTFILTER = ::rtl::OUString::createFromAscii("ooSetupFactoryDefaultFilter" ); +static const ::rtl::OUString CFG_ENTRY_PROP_FACTORYSERVICE = ::rtl::OUString::createFromAscii("ooSetupFactoryDocumentService" ); static const ::rtl::OUString EVENT_ON_NEW = ::rtl::OUString::createFromAscii("OnNew" ); static const ::rtl::OUString EVENT_ON_LOAD = ::rtl::OUString::createFromAscii("OnLoad" ); @@ -619,7 +644,7 @@ void SAL_CALL AutoRecovery::dispatch(const css::util::URL& // dont enable AutoSave hardly ! // reload configuration to know the current state. implts_readAutoSaveConfig(); - implts_actualizeTimer(); + implts_updateTimer(); // can it happen that might be the listener was stopped ? .-) // make sure it runs always ... even if AutoSave itself was disabled temporarly. implts_startListening(); @@ -775,7 +800,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) // <- SAFE ---------------------------------- // depends on bAllowAutoSaveReactivation implicitly by looking on m_eJob=E_AUTO_SAVE! see before ... - implts_actualizeTimer(); + implts_updateTimer(); if (bAllowAutoSaveReactivation) implts_startListening(); @@ -791,7 +816,7 @@ void SAL_CALL AutoRecovery::addStatusListener(const css::uno::Reference< css::fr // container is threadsafe by using a shared mutex! m_lListener.addInterface(aURL.Complete, xListener); - // REINTRANT !? -> -------------------------------- + // REENTRANT !? -> -------------------------------- CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_USE); // THREAD SAFE -> ---------------------------------- @@ -845,7 +870,7 @@ void SAL_CALL AutoRecovery::notifyEvent(const css::document::EventObject& aEvent else if (aEvent.EventName.equals(EVENT_ON_MODIFYCHANGED)) { - implts_actualizeModifiedState(xDocument); + implts_updateModifiedState(xDocument); } /* at least one document starts saving process => Our application code isnt ready for multiple save requests @@ -954,7 +979,7 @@ void SAL_CALL AutoRecovery::changesOccurred(const css::util::ChangesEvent& aEven // Note: This call stops the timer and starts it again. // But it checks the different timer states internaly and // may be supress the restart! - implts_actualizeTimer(); + implts_updateTimer(); } //----------------------------------------------- @@ -1096,7 +1121,7 @@ void AutoRecovery::implts_readConfig() css::uno::Reference< css::container::XHierarchicalNameAccess > xCommonRegistry(implts_openConfig(), css::uno::UNO_QUERY); - // REINTRANT -> -------------------------------- + // REENTRANT -> -------------------------------- CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_ADD_REMOVE); // THREADSAFE -> ------------------------------- @@ -1108,7 +1133,7 @@ void AutoRecovery::implts_readConfig() // <- THREADSAFE ------------------------------- aCacheLock.unlock(); - // <- REINTRANT -------------------------------- + // <- REENTRANT -------------------------------- css::uno::Any aValue; @@ -1123,7 +1148,7 @@ void AutoRecovery::implts_readConfig() sal_Int32 c = lItems.getLength(); sal_Int32 i = 0; - // REINTRANT -> -------------------------- + // REENTRANT -> -------------------------- aCacheLock.lock(LOCK_FOR_CACHE_ADD_REMOVE); for (i=0; i<c; ++i) @@ -1143,7 +1168,8 @@ void AutoRecovery::implts_readConfig() xItem->getPropertyValue(CFG_ENTRY_PROP_DOCUMENTSTATE) >>= aInfo.DocumentState; xItem->getPropertyValue(CFG_ENTRY_PROP_MODULE ) >>= aInfo.AppModule ; xItem->getPropertyValue(CFG_ENTRY_PROP_TITLE ) >>= aInfo.Title ; - implts_specifyAppModuleAndFactoryURL(aInfo); + xItem->getPropertyValue(CFG_ENTRY_PROP_VIEWNAMES ) >>= aInfo.ViewNames ; + implts_specifyAppModuleAndFactory(aInfo); implts_specifyDefaultFilterAndExtension(aInfo); if (pItems[i].indexOf(RECOVERY_ITEM_BASE_IDENTIFIER)==0) @@ -1173,10 +1199,10 @@ void AutoRecovery::implts_readConfig() } aCacheLock.unlock(); - // <- REINTRANT -------------------------- + // <- REENTRANT -------------------------- } - implts_actualizeTimer(); + implts_updateTimer(); } //----------------------------------------------- @@ -1241,17 +1267,12 @@ void AutoRecovery::implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocume } //----------------------------------------------- -void AutoRecovery::implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentInfo& rInfo) +void AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo& rInfo) { - if ( - (!rInfo.AppModule.getLength()) && - (!rInfo.Document.is() ) - ) - { - throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("Cant find out the application module nor its factory URL, if no application module (or a suitable) document is known!"), - static_cast< css::frame::XDispatch* >(this)); - } + ENSURE_OR_THROW2( + rInfo.AppModule.getLength() || rInfo.Document.is(), + "Cant find out the application module nor its factory URL, if no application module (or a suitable) document is known!", + *this ); // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); @@ -1267,6 +1288,65 @@ void AutoRecovery::implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentI ::comphelper::SequenceAsHashMap lModuleDescription(xModuleConfig->getByName(rInfo.AppModule)); lModuleDescription[CFG_ENTRY_PROP_EMPTYDOCUMENTURL] >>= rInfo.FactoryURL; + lModuleDescription[CFG_ENTRY_PROP_FACTORYSERVICE] >>= rInfo.FactoryService; +} + +//----------------------------------------------- +void AutoRecovery::implts_collectActiveViewNames( AutoRecovery::TDocumentInfo& i_rInfo ) +{ + ENSURE_OR_THROW2( i_rInfo.Document.is(), "need at document, at the very least", *this ); + + i_rInfo.ViewNames.realloc(0); + + // obtain list of controllers of this document + ::std::vector< ::rtl::OUString > aViewNames; + const Reference< XModel2 > xModel( i_rInfo.Document, UNO_QUERY ); + if ( xModel.is() ) + { + const Reference< XEnumeration > xEnumControllers( xModel->getControllers() ); + while ( xEnumControllers->hasMoreElements() ) + { + const Reference< XController2 > xController( xEnumControllers->nextElement(), UNO_QUERY ); + ::rtl::OUString sViewName; + if ( xController.is() ) + sViewName = xController->getViewControllerName(); + OSL_ENSURE( sViewName.getLength(), "AutoRecovery::implts_collectActiveViewNames: (no XController2 ->) no view name -> no recovery of this view!" ); + + if ( sViewName.getLength() ) + aViewNames.push_back( sViewName ); + } + } + else + { + const Reference< XController2 > xController( xModel->getCurrentController(), UNO_QUERY ); + ::rtl::OUString sViewName; + if ( xController.is() ) + sViewName = xController->getViewControllerName(); + OSL_ENSURE( sViewName.getLength(), "AutoRecovery::implts_collectActiveViewNames: (no XController2 ->) no view name -> no recovery of this view!" ); + + if ( sViewName.getLength() ) + aViewNames.push_back( sViewName ); + } + + i_rInfo.ViewNames.realloc( aViewNames.size() ); + ::std::copy( aViewNames.begin(), aViewNames.end(), i_rInfo.ViewNames.getArray() ); +} + +//----------------------------------------------- +void AutoRecovery::implts_persistAllActiveViewNames() +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + // This list will be filled with every document + AutoRecovery::TDocumentList::iterator pIt; + for ( pIt = m_lDocCache.begin(); + pIt != m_lDocCache.end() ; + ++pIt ) + { + implts_collectActiveViewNames( *pIt ); + implts_flushConfigItem( *pIt ); + } } //----------------------------------------------- @@ -1319,6 +1399,7 @@ void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rIn xSet->setPropertyValue(CFG_ENTRY_PROP_DOCUMENTSTATE, css::uno::makeAny(rInfo.DocumentState)); xSet->setPropertyValue(CFG_ENTRY_PROP_MODULE , css::uno::makeAny(rInfo.AppModule )); xSet->setPropertyValue(CFG_ENTRY_PROP_TITLE , css::uno::makeAny(rInfo.Title )); + xSet->setPropertyValue(CFG_ENTRY_PROP_VIEWNAMES , css::uno::makeAny(rInfo.ViewNames )); if (bNew) xModify->insertByName(sID, css::uno::makeAny(xSet)); @@ -1478,7 +1559,7 @@ void AutoRecovery::implts_stopModifyListeningOnDoc(AutoRecovery::TDocumentInfo& } //----------------------------------------------- -void AutoRecovery::implts_actualizeTimer() +void AutoRecovery::implts_updateTimer() { implts_stopTimer(); @@ -1569,7 +1650,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) m_eTimerType = AutoRecovery::E_POLL_TILL_AUTOSAVE_IS_ALLOWED; aWriteLock.unlock(); // <- SAFE ------------------------------ - implts_actualizeTimer(); + implts_updateTimer(); return 0; } @@ -1584,7 +1665,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) sal_Bool bUserIdle = (Application::GetLastInputInterval()>MIN_TIME_FOR_USER_IDLE); if (!bUserIdle) { - implts_actualizeTimer(); + implts_updateTimer(); return 0; } } @@ -1625,7 +1706,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) aWriteLock.unlock(); // <- SAFE ---------------------------------- - implts_actualizeTimer(); + implts_updateTimer(); } catch(const css::uno::Exception&) { @@ -1662,7 +1743,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // notification for already existing document ! // Can happen if events came in asynchronous on recovery time. // Then our cache was filled from the configuration ... but now we get some - // asynchronous events from the global event broadcaster. We must be shure that + // asynchronous events from the global event broadcaster. We must be sure that // we dont add the same document more then once. AutoRecovery::TDocumentList::iterator pIt = AutoRecovery::impl_searchDocument(m_lDocCache, xDocument); if (pIt != m_lDocCache.end()) @@ -1670,7 +1751,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // Normaly nothing must be done for this "late" notification. // But may be the modified state was changed inbetween. // Check it ... - implts_actualizeModifiedState(xDocument); + implts_updateModifiedState(xDocument); return; } @@ -1695,6 +1776,11 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame if (!xDesktop.is()) return; + // if the document doesn't support the XDocumentRecovery interface, we're not interested in it. + Reference< XDocumentRecovery > xDocRecovery( xDocument, UNO_QUERY ); + if ( !xDocRecovery.is() ) + return; + // get all needed informations of this document // We need it to update our cache or to locate already existing elements there! AutoRecovery::TDocumentInfo aNew; @@ -1714,7 +1800,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // <- SAFE ---------------------------------- // classify the used application module, which is used by this document. - implts_specifyAppModuleAndFactoryURL(aNew); + implts_specifyAppModuleAndFactory(aNew); // Hack! Check for "illegal office documents" ... as e.g. the Basic IDE // Its not realy a full featured office document. It doesnt provide an URL, any filter, a factory URL etcpp. @@ -1723,7 +1809,12 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame (!aNew.OrgURL.getLength() ) && (!aNew.FactoryURL.getLength()) ) - return; + { + OSL_ENSURE( false, "AutoRecovery::implts_registerDocument: this should not happen anymore!" ); + // nowadays, the Basic IDE should already die on the "supports XDocumentRecovery" check. And no other known + // document type fits in here ... + return; + } // By the way - get some information about the default format for saving! // and save an information about the real used filter by this document. @@ -1744,7 +1835,6 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame if (xModifyCheck->isModified()) { aNew.DocumentState |= AutoRecovery::E_MODIFIED; - aNew.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } aCacheLock.lock(LOCK_FOR_CACHE_ADD_REMOVE); @@ -1752,7 +1842,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - // create a new cache entry ... this document isnt well known. + // create a new cache entry ... this document isn't known. ++m_nIdPool; aNew.ID = m_nIdPool; LOG_ASSERT(m_nIdPool>=0, "AutoRecovery::implts_registerDocument()\nOverflow of ID pool detected.") @@ -1831,7 +1921,6 @@ void AutoRecovery::implts_markDocumentModifiedAgainstLastBackup(const css::uno:: if (pIt != m_lDocCache.end()) { AutoRecovery::TDocumentInfo& rInfo = *pIt; - rInfo.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; /* Now we know, that this document was modified again and must be saved next time. But we dont need this information for every e.g. key input of the user. @@ -1846,7 +1935,7 @@ void AutoRecovery::implts_markDocumentModifiedAgainstLastBackup(const css::uno:: } //----------------------------------------------- -void AutoRecovery::implts_actualizeModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument) +void AutoRecovery::implts_updateModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument) { CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_USE); @@ -1866,12 +1955,10 @@ void AutoRecovery::implts_actualizeModifiedState(const css::uno::Reference< css: if (bModified) { rInfo.DocumentState |= AutoRecovery::E_MODIFIED; - rInfo.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } else { rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED; - rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } } @@ -1964,6 +2051,33 @@ AutoRecovery::TDocumentList::iterator AutoRecovery::impl_searchDocument( Au } //----------------------------------------------- +namespace +{ + void lcl_changeVisibility( const css::uno::Reference< css::frame::XFramesSupplier >& i_rFrames, sal_Bool i_bVisible ) + { + css::uno::Reference< css::container::XIndexAccess > xFramesContainer( i_rFrames->getFrames(), css::uno::UNO_QUERY ); + const sal_Int32 count = xFramesContainer->getCount(); + + Any aElement; + for ( sal_Int32 i=0; i < count; ++i ) + { + aElement = xFramesContainer->getByIndex(i); + // check for sub frames + css::uno::Reference< css::frame::XFramesSupplier > xFramesSupp( aElement, css::uno::UNO_QUERY ); + if ( xFramesSupp.is() ) + lcl_changeVisibility( xFramesSupp, i_bVisible ); + + css::uno::Reference< css::frame::XFrame > xFrame( aElement, css::uno::UNO_QUERY ); + if ( !xFrame.is() ) + continue; + + css::uno::Reference< css::awt::XWindow > xWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + xWindow->setVisible( i_bVisible ); + } + } +} + +//----------------------------------------------- void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) { // SAFE -> ---------------------------------- @@ -1972,22 +2086,8 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFramesSupplier > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); - css::uno::Reference< css::container::XIndexAccess > xContainer(xDesktop->getFrames() , css::uno::UNO_QUERY); - sal_Int32 c = xContainer->getCount(); - sal_Int32 i = 0; - - for (i=0; i<c; ++i) - { - css::uno::Reference< css::frame::XFrame > xTask; - - xContainer->getByIndex(i) >>= xTask; - if (!xTask.is()) - continue; - - css::uno::Reference< css::awt::XWindow > xWindow = xTask->getContainerWindow(); - xWindow->setVisible(bVisible); - } + css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + lcl_changeVisibility( xDesktop, bVisible ); aReadLock.unlock(); // <- SAFE ---------------------------------- @@ -2180,15 +2280,15 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl continue; // already auto saved during this session :-) - // This state must be reseted for all documents + // This state must be reset for all documents // if timer is started with normnal AutoSaveTimerIntervall! if ((aInfo.DocumentState & AutoRecovery::E_HANDLED) == AutoRecovery::E_HANDLED) continue; // Not modified documents are not saved. // We safe an information about the URL only! - sal_Bool bModified = ((aInfo.DocumentState & AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE ) == AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE); - if (! bModified) + Reference< XDocumentRecovery > xDocRecover( aInfo.Document, UNO_QUERY_THROW ); + if ( !xDocRecover->wasModifiedSinceLastSave() ) { aInfo.DocumentState |= AutoRecovery::E_HANDLED; continue; @@ -2333,7 +2433,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& // try to save this document as a new temp file everytimes. // Mark AutoSave state as "INCOMPLETE" if it failed. // Because the last temp file is to old and does not include all changes. - css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW); + Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY_THROW); // safe the state about "trying to save" // ... we need it for recovery if e.g. a crash occures inside next line! @@ -2346,7 +2446,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& { try { - xStore->storeToURL(rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList()); + xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); #ifdef TRIGGER_FULL_DISC_CHECK throw css::uno::Exception(); @@ -2390,7 +2490,6 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& rInfo.DocumentState &= ~AutoRecovery::E_TRY_SAVE; rInfo.DocumentState |= AutoRecovery::E_HANDLED; rInfo.DocumentState |= AutoRecovery::E_SUCCEDED; - rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } else { @@ -2466,6 +2565,9 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa lDescriptor[::comphelper::MediaDescriptor::PROP_REFERRER()] <<= REFERRER_USER; lDescriptor[::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()] <<= ::rtl::OUString(); + // recovered documents are loaded hidden, and shown all at once, later + lDescriptor[::comphelper::MediaDescriptor::PROP_HIDDEN()] <<= true; + if (aParams.m_xProgress.is()) lDescriptor[::comphelper::MediaDescriptor::PROP_STATUSINDICATOR()] <<= aParams.m_xProgress; @@ -2531,6 +2633,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa else continue; // TODO ERROR! + LoadEnv::initializeUIDefaults( m_xSMGR, lDescriptor, true, NULL ); + // <- SAFE ------------------------------ aWriteLock.unlock(); @@ -2571,12 +2675,18 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa { ::comphelper::MediaDescriptor lPatchDescriptor(rInfo.Document->getArgs()); lPatchDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= rInfo.RealFilter; - rInfo.Document->attachResource(sURL, lPatchDescriptor.getAsConstPropertyValueList()); + rInfo.Document->attachResource(rInfo.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList()); + // do *not* use sURL here. In case this points to the recovery file, it has already been passed + // to recoverFromFile. Also, passing it here is logically wrong, as attachResource is intended + // to take the logical file URL. } css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); - sal_Bool bModified = ((rInfo.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED); - xModify->setModified(bModified); + if ( xModify.is() ) + { + sal_Bool bModified = ((rInfo.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED); + xModify->setModified(bModified); + } rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_BACKUP; rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_ORIGINAL; @@ -2589,8 +2699,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa /* Normaly we listen as XModifyListener on a document to know if a document was changed since our last AutoSave. And we deregister us in case we know this state. - But directly after one documentw as recovered ... we must start listening. - Otherwhise the first "modify" dont reach us. Because weself called setModified() + But directly after one document as recovered ... we must start listening. + Otherwhise the first "modify" doesnt reach us. Because we ourself called setModified() on the document via API. And currently we dont listen for any events (not at the GlobalEventBroadcaster nor at any document!). */ @@ -2618,60 +2728,113 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); - css::util::URL aURL; - aURL.Complete = sURL; - xParser->parseStrict(aURL); - - LoadDispatchListener* pLoadListener = new LoadDispatchListener(); - css::uno::Reference< css::frame::XDispatchResultListener > xLoadListener (static_cast< css::frame::XDispatchResultListener* >(pLoadListener), css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XFrame > xNewTarget = xDesktop->findFrame(SPECIALTARGET_BLANK, 0); - css::uno::Reference< css::frame::XDispatchProvider > xProvider (xNewTarget, css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XNotifyingDispatch > xDispatcher( - xProvider->queryDispatch(aURL, SPECIALTARGET_SELF, 0), - css::uno::UNO_QUERY_THROW); - - // load the document and listen for the state of this operation. - pLoadListener->setURL(aURL.Complete); - - // make sure the right progress is used always. - impl_establishProgress(rInfo, lDescriptor, xNewTarget); + css::uno::Reference< css::frame::XFrame > xDesktop( xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW ); + ::std::vector< Reference< XComponent > > aCleanup; try { - xDispatcher->dispatchWithNotification( - aURL, - lDescriptor.getAsConstPropertyValueList(), - xLoadListener); + // create a new document of the desired type + Reference< XModel2 > xModel( xSMGR->createInstance( rInfo.FactoryService ), UNO_QUERY_THROW ); + aCleanup.push_back( xModel.get() ); - pLoadListener->wait(0); // wait for ever! + // put the filter name into the descriptor - we're not going to involve any type detection, so + // the document might be lost without the FilterName property + lDescriptor[ ::comphelper::MediaDescriptor::PROP_FILTERNAME() ] <<= rInfo.RealFilter; - css::frame::DispatchResultEvent aResult = pLoadListener->getResult(); - if (aResult.State != css::frame::DispatchResultState::SUCCESS) + if ( sURL == rInfo.FactoryURL ) { - ::rtl::OUStringBuffer sMsg(256); - sMsg.appendAscii("Recovery of \""); - sMsg.append (aURL.Complete ); - sMsg.appendAscii("\" failed." ); - throw css::uno::Exception(sMsg.makeStringAndClear(), static_cast< css::frame::XDispatch* >(this)); + // if the document was a new, unmodified document, then there's nothing to recover, just to init + ENSURE_OR_THROW( ( rInfo.DocumentState & AutoRecovery::E_MODIFIED ) == 0, + "unexpected document state" ); + Reference< XLoadable > xModelLoad( xModel, UNO_QUERY_THROW ); + xModelLoad->initNew(); + + // TODO: remove load-process specific arguments from the descriptor, e.g. the status indicator + xModel->attachResource( sURL, lDescriptor.getAsConstPropertyValueList() ); } + else + { + // let it recover itself + Reference< XDocumentRecovery > xDocRecover( xModel, UNO_QUERY_THROW ); + xDocRecover->recoverFromFile( + sURL, + lDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_SALVAGEDFILE(), ::rtl::OUString() ), + lDescriptor.getAsConstPropertyValueList() + ); + + // No attachResource needed here. By definition (of XDocumentRecovery), the implementation is responsible + // for completely initializing the model, which includes attachResource (or equivalent), if required. + } + + // re-create all the views + ::std::vector< ::rtl::OUString > aViewsToRestore( rInfo.ViewNames.getLength() ); + if ( rInfo.ViewNames.getLength() ) + ::std::copy( rInfo.ViewNames.getConstArray(), rInfo.ViewNames.getConstArray() + rInfo.ViewNames.getLength(), aViewsToRestore.begin() ); + // if we don't have views for whatever reason, then create a default-view, at least + if ( aViewsToRestore.empty() ) + aViewsToRestore.push_back( ::rtl::OUString() ); + + for ( ::std::vector< ::rtl::OUString >::const_iterator viewName = aViewsToRestore.begin(); + viewName != aViewsToRestore.end(); + ++viewName + ) + { + // create a frame + Reference< XFrame > xTargetFrame = xDesktop->findFrame( SPECIALTARGET_BLANK, 0 ); + aCleanup.push_back( xTargetFrame.get() ); - rInfo.Document = fpf::extractFrameModel(xNewTarget); + // create a view to the document + Reference< XController2 > xController; + if ( viewName->getLength() ) + { + xController.set( xModel->createViewController( *viewName, Sequence< PropertyValue >(), xTargetFrame ), UNO_SET_THROW ); + } + else + { + xController.set( xModel->createDefaultViewController( xTargetFrame ), UNO_SET_THROW ); + } + + // introduce model/view/controller to each other + xController->attachModel( xModel.get() ); + xModel->connectController( xController.get() ); + xTargetFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( xTargetFrame ); + xModel->setCurrentController( xController.get() ); + } + + rInfo.Document = xModel.get(); } catch(const css::uno::RuntimeException&) { throw; } catch(const css::uno::Exception&) { - css::uno::Reference< css::util::XCloseable > xClose(xNewTarget, css::uno::UNO_QUERY); - xClose->close(sal_True); - xNewTarget.clear(); - throw; - } + Any aCaughtException( ::cppu::getCaughtException() ); + + // clean up + for ( ::std::vector< Reference< XComponent > >::const_iterator component = aCleanup.begin(); + component != aCleanup.end(); + ++component + ) + { + css::uno::Reference< css::util::XCloseable > xClose( *component, css::uno::UNO_QUERY ); + if ( xClose.is() ) + xClose->close( sal_True ); + else + (*component)->dispose(); + } + + // re-throw + ::rtl::OUStringBuffer sMsg(256); + sMsg.appendAscii("Recovery of \""); + sMsg.append (sURL ); + sMsg.appendAscii("\" failed." ); - // of course we must forget all references to this temp(!) progress - impl_forgetProgress(rInfo, lDescriptor, xNewTarget); + throw css::lang::WrappedTargetException( + sMsg.makeStringAndClear(), + static_cast< css::frame::XDispatch* >(this), + aCaughtException + ); + } } //----------------------------------------------- @@ -2783,7 +2946,7 @@ void AutoRecovery::implts_informListener( sal_Int32 eJ if ((eJob & AutoRecovery::E_AUTO_SAVE) == AutoRecovery::E_AUTO_SAVE) sFeature.append(CMD_DO_AUTO_SAVE); #ifdef ENABLE_WARNINGS - else + else if ( eJob != AutoRecovery::E_NO_JOB ) LOG_WARNING("AutoRecovery::implst_getJobDescription()", "Invalid job identifier detected.") #endif @@ -2842,35 +3005,18 @@ css::frame::FeatureStateEvent AutoRecovery::implst_createFeatureStateEvent( if (sEventType.equals(OPERATION_UPDATE) && pInfo) { // pack rInfo for transport via UNO - css::uno::Sequence< css::beans::NamedValue > lInfo(8); - lInfo[0].Name = CFG_ENTRY_PROP_ID; - lInfo[0].Value <<= pInfo->ID; - - lInfo[1].Name = CFG_ENTRY_PROP_ORIGINALURL; - lInfo[1].Value <<= pInfo->OrgURL; - - lInfo[2].Name = CFG_ENTRY_PROP_FACTORYURL; - lInfo[2].Value <<= pInfo->FactoryURL; - - lInfo[3].Name = CFG_ENTRY_PROP_TEMPLATEURL; - lInfo[3].Value <<= pInfo->TemplateURL; - - lInfo[4].Name = CFG_ENTRY_PROP_TEMPURL; - if (pInfo->OldTempURL.getLength()) - lInfo[4].Value <<= pInfo->OldTempURL; - else - lInfo[4].Value <<= pInfo->NewTempURL; - - lInfo[5].Name = CFG_ENTRY_PROP_MODULE; - lInfo[5].Value <<= pInfo->AppModule; - - lInfo[6].Name = CFG_ENTRY_PROP_TITLE; - lInfo[6].Value <<= pInfo->Title; + ::comphelper::NamedValueCollection aInfo; + aInfo.put( CFG_ENTRY_PROP_ID, pInfo->ID ); + aInfo.put( CFG_ENTRY_PROP_ORIGINALURL, pInfo->OrgURL ); + aInfo.put( CFG_ENTRY_PROP_FACTORYURL, pInfo->FactoryURL ); + aInfo.put( CFG_ENTRY_PROP_TEMPLATEURL, pInfo->TemplateURL ); + aInfo.put( CFG_ENTRY_PROP_TEMPURL, pInfo->OldTempURL.getLength() ? pInfo->OldTempURL : pInfo->NewTempURL ); + aInfo.put( CFG_ENTRY_PROP_MODULE, pInfo->AppModule ); + aInfo.put( CFG_ENTRY_PROP_TITLE, pInfo->Title ); + aInfo.put( CFG_ENTRY_PROP_VIEWNAMES, pInfo->ViewNames ); + aInfo.put( CFG_ENTRY_PROP_DOCUMENTSTATE, pInfo->DocumentState ); - lInfo[7].Name = CFG_ENTRY_PROP_DOCUMENTSTATE; - lInfo[7].Value <<= pInfo->DocumentState; - - aEvent.State <<= lInfo; + aEvent.State <<= aInfo.getPropertyValues(); } return aEvent; @@ -2928,6 +3074,9 @@ void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) css::uno::makeAny(sal_True), ::comphelper::ConfigurationHelper::E_STANDARD); + // for all docs, store their current view/names in the configurtion + implts_persistAllActiveViewNames(); + // The called method for saving documents runs // during normal AutoSave more then once. Because // it postpone active documents and save it later. @@ -2995,6 +3144,9 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) // Be sure to know all open documents realy .-) implts_verifyCacheAgainstDesktopDocumentList(); + // for all docs, store their current view/names in the configurtion + implts_persistAllActiveViewNames(); + // The called method for saving documents runs // during normal AutoSave more then once. Because // it postpone active documents and save it later. diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 4e1e094b0c72..bbbefdbdbda1 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -110,39 +110,66 @@ Size DecoToolBox::getMinSize() return maMinSize; } +#define STC_BUTTON_STYLE (WB_LEFT | WB_VCENTER | WB_FLATBUTTON | WB_BEVELBUTTON) BackingWindow::BackingWindow( Window* i_pParent ) : Window( i_pParent, FwkResId( DLG_BACKING ) ), maWelcome( this, WB_LEFT ), maProduct( this, WB_LEFT ), - maCreateText( this, WB_LEFT ), maWriterText( this, WB_WORDBREAK | WB_VCENTER ), - maWriterButton( this, WB_CENTER | WB_BEVELBUTTON ), + maWriterButton( this, STC_BUTTON_STYLE ), maCalcText( this, WB_WORDBREAK | WB_VCENTER ), - maCalcButton( this, WB_CENTER | WB_BEVELBUTTON ), + maCalcButton( this, STC_BUTTON_STYLE ), maImpressText( this, WB_WORDBREAK | WB_VCENTER ), - maImpressButton( this, WB_CENTER | WB_BEVELBUTTON ), + maImpressButton( this, STC_BUTTON_STYLE ), + maOpenText( this, WB_WORDBREAK | WB_VCENTER ), + maOpenButton( this, STC_BUTTON_STYLE ), maDrawText( this, WB_WORDBREAK | WB_VCENTER ), - maDrawButton( this, WB_CENTER | WB_BEVELBUTTON ), + maDrawButton( this, STC_BUTTON_STYLE ), maDBText( this, WB_WORDBREAK | WB_VCENTER ), - maDBButton( this, WB_CENTER | WB_BEVELBUTTON ), + maDBButton( this, STC_BUTTON_STYLE ), maMathText( this, WB_WORDBREAK | WB_VCENTER ), - maMathButton( this, WB_CENTER | WB_BEVELBUTTON ), + maMathButton( this, STC_BUTTON_STYLE ), maTemplateText( this, WB_WORDBREAK | WB_VCENTER ), - maTemplateButton( this, WB_CENTER | WB_BEVELBUTTON ), - maOpenText( this, WB_WORDBREAK | WB_VCENTER ), - maOpenButton( this, WB_CENTER | WB_BEVELBUTTON ), + maTemplateButton( this, STC_BUTTON_STYLE ), maToolbox( this, WB_DIALOGCONTROL ), maWelcomeString( FwkResId( STR_BACKING_WELCOME ) ), maProductString( FwkResId( STR_BACKING_WELCOMEPRODUCT ) ), - maCreateString( FwkResId( STR_BACKING_CREATE ) ), maOpenString( FwkResId( STR_BACKING_FILE ) ), maTemplateString( FwkResId( STR_BACKING_TEMPLATE ) ), maButtonImageSize( 10, 10 ), mbInitControls( false ), - mpAccExec( NULL ) + mnLayoutStyle( 0 ), + mpAccExec( NULL ), + mnBtnPos( 120 ) { mnColumnWidth[0] = mnColumnWidth[1] = 0; + mnTextColumnWidth[0] = mnTextColumnWidth[1] = 0; + + try + { + Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY); + if( xConfig.is() ) + { + Sequence<Any> args(1); + PropertyValue val( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath") ), + 0, + Any(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Help/StartCenter"))), + PropertyState_DIRECT_VALUE); + args.getArray()[0] <<= val; + Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY); + if( xNameAccess.is() ) + { + //throws css::container::NoSuchElementException, css::lang::WrappedTargetException + Any value( xNameAccess->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartCenterLayoutStyle"))) ); + mnLayoutStyle = value.get<sal_Int32>(); + } + } + } + catch (Exception& ) + { + } // get icon images from vcl resource and set them on the appropriate buttons loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton ); @@ -151,16 +178,12 @@ BackingWindow::BackingWindow( Window* i_pParent ) : loadImage( FwkResId( BMP_BACKING_DRAW ), maDrawButton ); loadImage( FwkResId( BMP_BACKING_DATABASE ), maDBButton ); loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton ); - loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton ); - loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton ); + loadImage( FwkResId( BMP_BACKING_FOLDER ), maOpenButton ); + loadImage( FwkResId( BMP_BACKING_FOLDER ), maTemplateButton ); - BitmapEx aExtImage( FwkResId( BMP_BACKING_EXT ) ); String aExtHelpText( FwkResId( STR_BACKING_EXTHELP ) ); - BitmapEx aRegImage( FwkResId( BMP_BACKING_REG ) ); String aRegHelpText( FwkResId( STR_BACKING_REGHELP ) ); - BitmapEx aInfoImage( FwkResId( BMP_BACKING_INFO ) ); String aInfoHelpText( FwkResId( STR_BACKING_INFOHELP ) ); - BitmapEx aTplRepImage( FwkResId( BMP_BACKING_TPLREP ) ); String aTplRepHelpText( FwkResId( STR_BACKING_TPLREP ) ); // clean up resource stack @@ -180,25 +203,25 @@ BackingWindow::BackingWindow( Window* i_pParent ) : maToolbox.SetStyle( maToolbox.GetStyle() | WB_FORCETABCYCLE ); // insert toolbox items - maToolbox.InsertItem( nItemId_TplRep, Image( aTplRepImage ) ); + maToolbox.InsertItem( nItemId_TplRep, Image() ); maToolbox.SetItemText( nItemId_TplRep, aTplRepHelpText ); maToolbox.SetQuickHelpText( nItemId_TplRep, aTplRepHelpText ); maToolbox.SetItemCommand( nItemId_TplRep, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:TemplateRepository" ) ) ); maToolbox.ShowItem( nItemId_TplRep ); - maToolbox.InsertItem( nItemId_Extensions, Image( aExtImage ) ); + maToolbox.InsertItem( nItemId_Extensions, Image() ); maToolbox.SetQuickHelpText( nItemId_Extensions, aExtHelpText ); maToolbox.SetItemText( nItemId_Extensions, aExtHelpText ); maToolbox.SetItemCommand( nItemId_Extensions, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Extensions" ) ) ); maToolbox.ShowItem( nItemId_Extensions ); - maToolbox.InsertItem( nItemId_Reg, Image( aRegImage ) ); + maToolbox.InsertItem( nItemId_Reg, Image() ); maToolbox.SetQuickHelpText( nItemId_Reg, aRegHelpText ); maToolbox.SetItemText( nItemId_Reg, aRegHelpText ); maToolbox.SetItemCommand( nItemId_Reg, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Register" ) ) ); maToolbox.ShowItem( nItemId_Reg ); - maToolbox.InsertItem( nItemId_Info, Image( aInfoImage ) ); + maToolbox.InsertItem( nItemId_Info, Image() ); maToolbox.SetItemText( nItemId_Info, aInfoHelpText ); maToolbox.SetQuickHelpText( nItemId_Info, aInfoHelpText ); maToolbox.SetItemCommand( nItemId_Info, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Info" ) ) ); @@ -259,7 +282,13 @@ void BackingWindow::initBackground() SetBackground( GetSettings().GetStyleSettings().GetWorkspaceGradient() ); bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode(); - maWelcomeTextColor = maLabelTextColor = bDark ? Color( COL_WHITE ) : Color( 0x26, 0x35, 0x42 ); + if( bDark ) + maWelcomeTextColor = maLabelTextColor = Color( COL_WHITE ); + else if( mnLayoutStyle == 1 ) + maWelcomeTextColor = maLabelTextColor = Color( COL_BLACK ); + else + maWelcomeTextColor = maLabelTextColor = Color( 0x26, 0x35, 0x42 ); + Color aTextBGColor( bDark ? COL_BLACK : COL_WHITE ); // select image set @@ -286,13 +315,15 @@ void BackingWindow::initBackground() maBackgroundLeft = BitmapEx( FwkResId( BMP_BACKING_BACKGROUND_LEFT ) ); maBackgroundRight = BitmapEx( FwkResId( BMP_BACKING_BACKGROUND_RIGHT ) ); } + maToolbox.SetItemImage( nItemId_Extensions, BitmapEx( FwkResId( BMP_BACKING_EXT ) ) ); + maToolbox.SetItemImage( nItemId_Reg, BitmapEx( FwkResId( BMP_BACKING_REG ) ) ); + maToolbox.SetItemImage( nItemId_Info, BitmapEx( FwkResId( BMP_BACKING_INFO ) ) ); + maToolbox.SetItemImage( nItemId_TplRep, BitmapEx( FwkResId( BMP_BACKING_TPLREP ) ) ); maWelcome.SetControlForeground( maWelcomeTextColor ); maWelcome.SetBackground(); maProduct.SetControlForeground( maWelcomeTextColor ); maProduct.SetBackground(); - maCreateText.SetControlForeground( maLabelTextColor ); - maCreateText.SetControlBackground( aTextBGColor ); maWriterText.SetControlForeground( maLabelTextColor ); maWriterText.SetControlBackground( aTextBGColor ); maCalcText.SetControlForeground( maLabelTextColor ); @@ -309,6 +340,14 @@ void BackingWindow::initBackground() maTemplateText.SetControlBackground( aTextBGColor ); maOpenText.SetControlForeground( maLabelTextColor ); maOpenText.SetControlBackground( aTextBGColor ); + + if( mnLayoutStyle == 1 ) + { + if( Application::GetSettings().GetLayoutRTL() ) + mnBtnPos = maBackgroundRight.GetSizePixel().Width() + 40; + else + mnBtnPos = maBackgroundLeft.GetSizePixel().Width() + 40; + } } void BackingWindow::initControls() @@ -344,10 +383,8 @@ void BackingWindow::initControls() nYPos += (maWelcomeSize.Height()*3)/2; - if( maControlRect.GetWidth() < nBtnPos + maWelcomeSize.Width() + 20 ) - maControlRect.Right() = maControlRect.Left() + maWelcomeSize.Width() + nBtnPos + 20; - - maWelcome.Show(); + if( maControlRect.GetWidth() < mnBtnPos + maWelcomeSize.Width() + 20 ) + maControlRect.Right() = maControlRect.Left() + maWelcomeSize.Width() + mnBtnPos + 20; nYPos += maWelcomeSize.Height(); @@ -365,10 +402,14 @@ void BackingWindow::initControls() maProductSize = Size( maProduct.GetTextWidth( maProductString ), maProduct.GetTextHeight() ); maProductSize.Width() = (maProductSize.Width() * 20)/19; - if( maControlRect.GetWidth() < maProductSize.Width() + nBtnPos + 10 ) - maControlRect.Right() = maControlRect.Left() + maProductSize.Width() + nBtnPos + 10; + if( maControlRect.GetWidth() < maProductSize.Width() + mnBtnPos + 10 ) + maControlRect.Right() = maControlRect.Left() + maProductSize.Width() + mnBtnPos + 10; - maProduct.Show(); + if( mnLayoutStyle == 1 ) + { + maWelcome.Show(); + maProduct.Show(); + } nYPos += (maProductSize.Height()*3)/2; @@ -376,14 +417,6 @@ void BackingWindow::initControls() maTextFont.SetSize( Size( 0, 11 ) ); maTextFont.SetWeight( WEIGHT_NORMAL ); - maCreateText.SetText( maCreateString ); - maCreateText.SetFont( maTextFont ); - maCreateText.SetControlFont( maTextFont ); - maCreateSize = Size( maCreateText.GetTextWidth( maCreateString ), maCreateText.GetTextHeight() ); - maCreateText.Show(); - - nYPos += (maCreateSize.Height()*3)/2; - // collect the URLs of the entries in the File/New menu SvtModuleOptions aModuleOptions; std::set< rtl::OUString > aFileNewAppsAvailable; @@ -426,41 +459,62 @@ void BackingWindow::initControls() layoutButtonAndText( WRITER_URL, 0, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SWRITER, maWriterButton, maWriterText, aMnemns ); - layoutButtonAndText( CALC_URL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SCALC, - maCalcButton, maCalcText, aMnemns ); - nYPos += maButtonImageSize.Height() + 10; - layoutButtonAndText( IMPRESS_WIZARD_URL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SIMPRESS, - maImpressButton, maImpressText, aMnemns ); layoutButtonAndText( DRAW_URL, 1, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SDRAW, maDrawButton, maDrawText, aMnemns ); nYPos += maButtonImageSize.Height() + 10; - layoutButtonAndText( BASE_URL, 0, aFileNewAppsAvailable, + layoutButtonAndText( CALC_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SCALC, + maCalcButton, maCalcText, aMnemns ); + layoutButtonAndText( BASE_URL, 1, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SDATABASE, maDBButton, maDBText, aMnemns ); + nYPos += maButtonImageSize.Height() + 10; + layoutButtonAndText( IMPRESS_WIZARD_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SIMPRESS, + maImpressButton, maImpressText, aMnemns ); layoutButtonAndText( MATH_URL, 1, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SMATH, maMathButton, maMathText, aMnemns ); nYPos += 3*maButtonImageSize.Height() / 2; - layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maTemplateButton, maTemplateText, aMnemns, maTemplateString ); - nYPos += 10; - layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, + layoutButtonAndText( NULL, 0, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SWRITER, maOpenButton, maOpenText, aMnemns, maOpenString ); + layoutButtonAndText( NULL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maTemplateButton, maTemplateText, aMnemns, maTemplateString ); nYPos += 10; DBG_ASSERT( nYPos < maControlRect.GetHeight(), "misformatting !" ); - if( mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20 > maControlRect.GetWidth() ) - maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20; + if( mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20 > maControlRect.GetWidth() ) + maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20; + + mnTextColumnWidth[0] = mnColumnWidth[0]; + mnTextColumnWidth[1] = mnColumnWidth[1]; + + if( mnTextColumnWidth[1] > mnTextColumnWidth[0] ) + { + mnColumnWidth[0] = mnColumnWidth[1]; + mnTextColumnWidth[0] = mnTextColumnWidth[1]; + } + else + { + mnColumnWidth[1] = mnColumnWidth[0]; + mnTextColumnWidth[1] = mnTextColumnWidth[0]; + } + if( maControlRect.GetWidth() < maControlRect.GetHeight() * 3 / 2 ) + { + maControlRect.Right() = maControlRect.Left() + maControlRect.GetHeight() * 3 / 2; + long nDelta = (maControlRect.GetWidth() - mnBtnPos - mnColumnWidth[1] - mnColumnWidth[0] - 20); + mnColumnWidth[0] += nDelta/2; + mnColumnWidth[1] += nDelta/2; + } maToolbox.SetSelectHdl( LINK( this, BackingWindow, ToolboxHdl ) ); - maToolbox.Show(); + if( mnLayoutStyle == 0 ) + maToolbox.Show(); // scale middle map to formatted width Size aMiddleSegmentSize( maControlRect.GetSize().Width() + nShadowLeft + nShadowRight, @@ -510,37 +564,34 @@ void BackingWindow::layoutButtonAndText( } // setup text - i_rText.SetFont( maTextFont ); - i_rText.SetControlFont( maTextFont ); + i_rBtn.SetFont( maTextFont ); + i_rBtn.SetControlFont( maTextFont ); String aText( i_rStr.Len() ? i_rStr : SvFileInformationManager::GetDescription( INetURLObject( aURL ) ) ); i_rMnemns.CreateMnemonic( aText ); - i_rText.SetText( aText ); + i_rBtn.SetText( aText ); - long nTextWidth = i_rText.GetTextWidth( i_rText.GetText() ); - i_rText.SetPaintTransparent( TRUE ); + long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() ); - nTextWidth += maButtonImageSize.Width() + 30; + nTextWidth += maButtonImageSize.Width(); if( nColumn >= 0 && nColumn < static_cast<int>(sizeof(mnColumnWidth)/sizeof(mnColumnWidth[0])) ) { if( nTextWidth > mnColumnWidth[nColumn] ) mnColumnWidth[nColumn] = nTextWidth; } + i_rBtn.SetImageAlign( IMAGEALIGN_LEFT ); // show the controls i_rBtn.Show(); - i_rText.Show(); + i_rText.Show( FALSE ); + + + // FIXME: the only reason the FixedTexts are left are not to trigger + // a translation change due to changed src files. For the next minor + // the FixedTexts should be removed completely } void BackingWindow::Paint( const Rectangle& ) { - bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode(); - - Color aBackColor( bDark ? COL_BLACK : COL_WHITE ); - - // fill control rect - SetLineColor(); - SetFillColor( aBackColor ); - DrawRect( maControlRect ); // draw bitmap if( GetSettings().GetLayoutRTL() ) @@ -607,8 +658,10 @@ void BackingWindow::Resize() maToolbox.calcMinSize(); Size aTBSize( maToolbox.getMinSize() ); - Point aTBPos( maControlRect.Right() - aTBSize.Width() - 10, + Point aTBPos( maControlRect.Left() + mnBtnPos, maControlRect.Bottom() - aTBSize.Height() - 10 ); + if( Application::GetSettings().GetLayoutRTL() ) + aTBPos.X() = maControlRect.Right() - aTBSize.Width() - mnBtnPos; maToolbox.SetPosSizePixel( aTBPos, aTBSize ); // #i93631# squeeze controls so they fit into the box @@ -617,7 +670,6 @@ void BackingWindow::Resize() 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(); @@ -626,7 +678,6 @@ void BackingWindow::Resize() (nWDelta - nDiff) + (nW2Delta- nDiff) + (nPDelta - nDiff) + - (nCDelta - nDiff) + 3 * (nBDelta - nDiff) + (nB2Delta- nDiff) + nLastDelta @@ -637,47 +688,26 @@ void BackingWindow::Resize() long nYPos = maControlRect.Top(); nYPos += nW2Delta - nDiff; - maWelcome.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), - Size( maControlRect.GetWidth() - nBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); + maWelcome.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), + Size( maControlRect.GetWidth() - mnBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); nYPos += nWDelta - nDiff; - maProduct.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, (maProductSize.Height()*20)/19 ) ); + maProduct.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( maControlRect.GetWidth() - mnBtnPos - 5, (maProductSize.Height()*20)/19 ) ); nYPos += nPDelta - nDiff; - maCreateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), - Size( maControlRect.GetWidth() - nBtnPos - 5, maCreateSize.Height() ) ); + nYPos += nWDelta/2 - nDiff; - nYPos += nCDelta - nDiff; - - maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maWriterText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - 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() ) ); + maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); 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() ) ); + maCalcButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maDBButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); 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() ) ); - maMathButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); - maMathText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), - Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + maImpressButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maMathButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); 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 += 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 += nBDelta - nDiff; + maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); + maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); } IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index de3797d3ab4f..7b7dfa34b110 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -86,14 +86,14 @@ namespace framework Size maWelcomeSize; FixedText maProduct; Size maProductSize; - FixedText maCreateText; - Size maCreateSize; FixedText maWriterText; ImageButton maWriterButton; FixedText maCalcText; ImageButton maCalcButton; FixedText maImpressText; ImageButton maImpressButton; + FixedText maOpenText; + ImageButton maOpenButton; FixedText maDrawText; ImageButton maDrawButton; FixedText maDBText; @@ -102,8 +102,6 @@ namespace framework ImageButton maMathButton; FixedText maTemplateText; ImageButton maTemplateButton; - FixedText maOpenText; - ImageButton maOpenButton; DecoToolBox maToolbox; @@ -121,16 +119,17 @@ namespace framework Rectangle maControlRect; long mnColumnWidth[2]; + long mnTextColumnWidth[2]; Color maLabelTextColor; Color maWelcomeTextColor; Size maButtonImageSize; bool mbInitControls; + sal_Int32 mnLayoutStyle; svt::AcceleratorExecute* mpAccExec; + long mnBtnPos; - - static const long nBtnPos = 240; static const int nItemId_Extensions = 1; static const int nItemId_Reg = 2; static const int nItemId_Info = 3; diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 8a90adb7efa7..18d5a1c31bef 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -2701,21 +2701,7 @@ css::uno::Any SAL_CALL Frame::impl_getPropertyValue(const ::rtl::OUString& /*sPr break; case FRAME_PROPHANDLE_ISHIDDEN : -// aValue <<= m_bIsHidden; - { - sal_Bool bLoadedHidden = m_bIsHidden; - css::uno::Reference< css::frame::XModel > xModel; - if (m_xController.is()) - xModel = m_xController->getModel(); - if (xModel.is()) - { - ::comphelper::MediaDescriptor lDesc(xModel->getArgs()); - bLoadedHidden = lDesc.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_HIDDEN(), - (sal_Bool)sal_False); - } - aValue <<= bLoadedHidden; - } + aValue <<= m_bIsHidden; break; case FRAME_PROPHANDLE_LAYOUTMANAGER : diff --git a/framework/source/services/fwk_services.src b/framework/source/services/fwk_services.src index 62cc4a6055a9..7e2ee3253e71 100644 --- a/framework/source/services/fwk_services.src +++ b/framework/source/services/fwk_services.src @@ -77,42 +77,22 @@ Window DLG_BACKING { File = "odf_32.png"; }; - Bitmap BMP_BACKING_OPENFILE + Bitmap BMP_BACKING_FOLDER { - File = "open_32.png"; - }; - Bitmap BMP_BACKING_OPENTEMPLATE - { - File = "template_32.png"; - }; - Bitmap BMP_BACKING_EXT - { - File = "extension_plus_26.png"; + File = "folder_32.png"; }; String STR_BACKING_EXTHELP { Text [ en-US ] = "Add new features to %PRODUCTNAME"; }; - Bitmap BMP_BACKING_REG - { - File = "register_32.png"; - }; String STR_BACKING_REGHELP { Text [ en-US ] = "Register your %PRODUCTNAME"; }; - Bitmap BMP_BACKING_INFO - { - File = "info_26.png"; - }; String STR_BACKING_INFOHELP { Text [ en-US ] = "Get more information about %PRODUCTNAME"; }; - Bitmap BMP_BACKING_TPLREP - { - File = "addtemplate_32.png"; - }; String STR_BACKING_TPLREP { Text [ en-US ] = "Get more templates for %PRODUCTNAME"; @@ -141,6 +121,22 @@ Resource RES_BACKING_IMAGES { File = "backing_rtl_right.png"; }; + Bitmap BMP_BACKING_EXT + { + File = "extension.png"; + }; + Bitmap BMP_BACKING_REG + { + File = "register_32.png"; + }; + Bitmap BMP_BACKING_INFO + { + File = "info_26.png"; + }; + Bitmap BMP_BACKING_TPLREP + { + File = "addtemplate_32.png"; + }; }; Resource RES_BACKING_IMAGES_HC @@ -165,6 +161,22 @@ Resource RES_BACKING_IMAGES_HC { File = "backing_rtl_right_hc.png"; }; + Bitmap BMP_BACKING_EXT + { + File = "extension_hc.png"; + }; + Bitmap BMP_BACKING_REG + { + File = "register_hc.png"; + }; + Bitmap BMP_BACKING_INFO + { + File = "info_hc.png"; + }; + Bitmap BMP_BACKING_TPLREP + { + File = "template_hc.png"; + }; }; Window WIN_TABWINDOW diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index d3596e878caf..65edaff42d35 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -278,7 +278,6 @@ SHL4OBJS= \ $(SLO)$/langselectionstatusbarcontroller.obj \ $(SLO)$/layoutmanager.obj \ $(SLO)$/loaddispatcher.obj \ - $(SLO)$/loaddispatchlistener.obj \ $(SLO)$/loadenv.obj \ $(SLO)$/menubarfactory.obj \ $(SLO)$/menubarmanager.obj \ diff --git a/officecfg/registry/data/org/openoffice/Interaction.xcu b/officecfg/registry/data/org/openoffice/Interaction.xcu new file mode 100644 index 000000000000..afd78005fb71 --- /dev/null +++ b/officecfg/registry/data/org/openoffice/Interaction.xcu @@ -0,0 +1,56 @@ +<?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 + * + * 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-data SYSTEM "../../../component-update.dtd"> +<oor:component-data oor:name="Interaction" oor:package="org.openoffice" xmlns:oor="http://openoffice.org/2001/registry" xmlns:install="http://openoffice.org/2004/installation" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="InteractionHandlers"> + <!-- The interaction handler for SQLExceptions (and derived exceptions), implemented in the Base module. + --> + <node oor:name="org.openoffice.Office.Base.DatabaseInteractions" oor:op="replace"> + <node oor:name="HandledRequestTypes"> + <node oor:name="com.sun.star.sdbc.SQLException" oor:op="replace"> + <prop oor:name="Propagation" oor:type="xs:string"> + <value>named-and-derived</value> + </prop> + </node> + <node oor:name="com.sun.star.sdb.ParametersRequest" oor:op="replace"> + <prop oor:name="Propagation" oor:type="xs:string"> + <value>named-and-derived</value> + </prop> + </node> + <node oor:name="com.sun.star.sdb.DocumentSaveRequest" oor:op="replace"> + <prop oor:name="Propagation" oor:type="xs:string"> + <value>named-and-derived</value> + </prop> + </node> + </node> + <prop oor:name="ServiceName" oor:type="xs:string"> + <value>com.sun.star.comp.dbaccess.DatabaseInteractionHandler</value> + </prop> + </node> + </node> +</oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index 8c20db415c12..bf08c7b5da6a 100644..100755 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -1869,6 +1869,12 @@ </node> </node> <node oor:name="com.sun.star.presentation.PresentationDocument" oor:op="replace"> + <node oor:name="N_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"> + <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">.uno:InsertAnnotation</value> + </prop> + </node> <node oor:name="PAGEDOWN_MOD1_MOD2" oor:op="replace"> <prop oor:name="Command"> <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> @@ -5499,7 +5505,13 @@ </node> </node> <node oor:name="com.sun.star.drawing.DrawingDocument" oor:op="replace"> - <node oor:name="BACKSPACE_MOD2" oor:op="replace"> + <node oor:name="N_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"> + <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">.uno:InsertAnnotation</value> + </prop> + </node> + <node oor:name="BACKSPACE_MOD2" oor:op="replace"> <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> <value xml:lang="en-US">.uno:Undo</value> </prop> diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index ddd4145e57da..fe1fb92abb0e 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -134,6 +134,9 @@ <prop oor:name="TemplateRepositoryURL" oor:type="xs:string"> <value>${STARTCENTER_TEMPLREP_URL}</value> </prop> + <prop oor:name="StartCenterLayoutStyle" oor:type="xs:int"> + <value>${STARTCENTER_LAYOUT_STYLE}</value> + </prop> </node> <node oor:name="Registration"> <prop oor:name="TemplateURL"> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu index 9341fbd3930d..42aaad16af86 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu @@ -529,7 +529,7 @@ <value xml:lang="en-US">Select Chart Element</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> - <value>1</value> + <value>0</value> </prop> </node> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu index 824cc3d5ac21..079855def699 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu @@ -129,9 +129,6 @@ <prop oor:name="DockingArea" oor:type="xs:int"> <value>0</value> </prop> - <prop oor:name="Style" oor:type="xs:int"> - <value>2</value> - </prop> <prop oor:name="Visible" oor:type="xs:boolean"> <value>true</value> </prop> diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 4acf93dee764..6d7259b00ac2 100644..100755 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -594,7 +594,7 @@ <value>GenericCategories</value> </prop> <prop oor:name="ooSetupFactoryUIName"> - <value>Table Data View</value> + <value xml:lang="en-US">Base: Table Data View</value> </prop> </node> <node oor:name="com.sun.star.frame.Bibliography" oor:op="replace"> @@ -616,7 +616,7 @@ <value >GenericCategories</value> </prop> <prop oor:name="ooSetupFactoryUIName"> - <value >Bibliography</value> + <value xml:lang="en-US">Bibliography</value> </prop> </node> <node oor:name="com.sun.star.script.BasicIDE" oor:op="replace"> @@ -750,174 +750,182 @@ <value>true</value> </prop> </node> - <node oor:name="Migration"> - <prop oor:name="SupportedVersions"> - <value oor:separator=",">OpenOffice.org 2=openoffice.org2,StarOffice 8=staroffice8,StarSuite 8=starsuite8</value> + <node oor:name="Migration"> + <node oor:name="SupportedVersions"> + <node oor:name="OpenOffice.org2+StarOffice8+StarSuite8" oor:op="replace"> + <prop oor:name="Priority"> + <value>10</value> </prop> - <node oor:name="MigrationSteps"> - <node oor:name="Datasources" oor:op="replace"> - <prop oor:name="IncludedFiles"> - <value>.*/database/biblio/biblio\.dbf</value> - </prop> - <prop oor:name="ExcludedFiles"> - </prop> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.DataAccess</value> - </prop> - <prop oor:name="ExcludedNodes"> - <value> - org.openoffice.Office.DataAccess/Bibliography - org.openoffice.Office.DataAccess/ConnectionPool - org.openoffice.Office.DataAccess/DataSources - org.openoffice.Office.DataAccess/DriverManager - </value> - </prop> - </node> - <node oor:name="Deployment" oor:op="replace"> - <prop oor:name="MigrationService"> - <value>com.sun.star.migration.Extensions</value> - </prop> - </node> - <node oor:name="Inet" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Inet - </value> - </prop> - </node> - <node oor:name="Basic" oor:op="replace"> - <prop oor:name="MigrationService"> - <value>com.sun.star.migration.Basic</value> - </prop> - </node> - <node oor:name="UserProfile" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.UserProfile</value> - </prop> - </node> - <node oor:name="Common" oor:op="replace"> - <prop oor:name="IncludedFiles"> - <value> - .*/autotext/.* - .*/autocorr/.* - .*/config/.*\.so[bcdegh] - .*/config/soffice.cfg/modules/.*/toolbar/custom.*\.xml - .*/config/soffice.cfg/modules/.*/images/.* - .*/gallery/.* - .*/template/.* - </value> - </prop> - <prop oor:name="IncludedNodes"> - <value> - org.openoffice.Office.Compatibility - org.openoffice.Office.Custom - org.openoffice.Office.Embedding - org.openoffice.Office.Events - org.openoffice.Office.ExtendedColorScheme - org.openoffice.Office.Common/Accessibility - org.openoffice.Office.Common/Accessibility/AutoDetectSystemHC - org.openoffice.Office.Common/AsianLayout - org.openoffice.Office.Common/AutoCorrect - org.openoffice.Office.Common/Cache - org.openoffice.Office.Common/DateFormat - org.openoffice.Office.Common/ExternalMailer/Program - org.openoffice.Office.Common/Filter - org.openoffice.Office.Common/Font - org.openoffice.Office.Common/Forms - org.openoffice.Office.Common/Gallery - org.openoffice.Office.Common/Help - org.openoffice.Office.Common/History - org.openoffice.Office.Common/I18N - org.openoffice.Office.Common/InternalMSExport - org.openoffice.Office.Common/Load - org.openoffice.Office.Common/Misc/FormControlPilotsEnabled - org.openoffice.Office.Common/Misc/PluginsEnabled - org.openoffice.Office.Common/Misc/SymbolSet - org.openoffice.Office.Common/Misc/UseSystemFileDialog - org.openoffice.Office.Common/Misc/UseSystemPrintDialog - org.openoffice.Office.Common/Misc/SymbolStyle - org.openoffice.Office.Common/Passwords - org.openoffice.Office.Common/Print/PrintingModifiesDocument - org.openoffice.Office.Common/Print/Warning - org.openoffice.Office.Common/Vectorize - org.openoffice.Office.Common/Save - org.openoffice.Office.Common/SearchOptions - org.openoffice.Office.Common/Undo - org.openoffice.Office.Common/View/Dialog/Dialog/MiddleMouseButton - org.openoffice.Office.Common/View/Dialog/MousePositioning - org.openoffice.Office.Common/View/Localization - org.openoffice.Office.Common/View/Menu - org.openoffice.Office.Common/_3D_Engine - </value> - </prop> - <prop oor:name="ExcludedNodes"> - <value> - org.openoffice.Office.Common/_3D_Engine/OpenGL - org.openoffice.Office.Common/Help/Registration - </value> - </prop> - </node> - <node oor:name="Calc" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Calc</value> - </prop> - </node> - <node oor:name="Chart" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Chart</value> - </prop> - </node> - <node oor:name="Draw" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Draw</value> - </prop> - </node> - <node oor:name="Impress" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Impress</value> - </prop> - </node> - <node oor:name="Labels" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Labels</value> - </prop> - </node> - <node oor:name="Linguistic" oor:op="replace"> - <prop oor:name="MigrationService"> - <value>com.sun.star.migration.Wordbooks</value> - </prop> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Linguistic</value> - </prop> - <prop oor:name="ExcludedNodes"> - <value>org.openoffice.Office.Linguistic/ServiceManager</value> - </prop> - </node> - <node oor:name="Math" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Math</value> - </prop> - </node> - <node oor:name="Security" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.Security</value> - </prop> - </node> - <node oor:name="UI" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value>org.openoffice.Office.UI/ColorScheme</value> - </prop> - </node> - <node oor:name="Writer" oor:op="replace"> - <prop oor:name="IncludedNodes"> - <value> - org.openoffice.Office.Writer - org.openoffice.Office.WriterWeb - </value> - </prop> - <prop oor:name="ExcludedNodes"> - <value>org.openoffice.Office.Writer/Wizard</value> + <prop oor:name="VersionIdentifiers"> + <value oor:separator=",">OpenOffice.org 2=openoffice.org2,StarOffice 8=staroffice8,StarSuite 8=starsuite8</value> </prop> + <node oor:name="MigrationSteps"> + <node oor:name="Datasources" oor:op="replace"> + <prop oor:name="IncludedFiles"> + <value>.*/database/biblio/biblio\.dbf</value> + </prop> + <prop oor:name="ExcludedFiles"> + </prop> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.DataAccess</value> + </prop> + <prop oor:name="ExcludedNodes"> + <value> + org.openoffice.Office.DataAccess/Bibliography + org.openoffice.Office.DataAccess/ConnectionPool + org.openoffice.Office.DataAccess/DataSources + org.openoffice.Office.DataAccess/DriverManager + </value> + </prop> + </node> + <node oor:name="Deployment" oor:op="replace"> + <prop oor:name="MigrationService"> + <value>com.sun.star.migration.Extensions</value> + </prop> + </node> + <node oor:name="Inet" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value> + org.openoffice.Inet + </value> + </prop> + </node> + <node oor:name="Basic" oor:op="replace"> + <prop oor:name="MigrationService"> + <value>com.sun.star.migration.Basic</value> + </prop> + </node> + <node oor:name="UserProfile" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.UserProfile</value> + </prop> + </node> + <node oor:name="Common" oor:op="replace"> + <prop oor:name="IncludedFiles"> + <value> + .*/autotext/.* + .*/autocorr/.* + .*/config/.*\.so[bcdegh] + .*/config/soffice.cfg/modules/.*/toolbar/custom.*\.xml + .*/config/soffice.cfg/modules/.*/images/.* + .*/gallery/.* + .*/template/.* + </value> + </prop> + <prop oor:name="IncludedNodes"> + <value> + org.openoffice.Office.Compatibility + org.openoffice.Office.Custom + org.openoffice.Office.Embedding + org.openoffice.Office.Events + org.openoffice.Office.ExtendedColorScheme + org.openoffice.Office.Common/Accessibility + org.openoffice.Office.Common/Accessibility/AutoDetectSystemHC + org.openoffice.Office.Common/AsianLayout + org.openoffice.Office.Common/AutoCorrect + org.openoffice.Office.Common/Cache + org.openoffice.Office.Common/DateFormat + org.openoffice.Office.Common/ExternalMailer/Program + org.openoffice.Office.Common/Filter + org.openoffice.Office.Common/Font + org.openoffice.Office.Common/Forms + org.openoffice.Office.Common/Gallery + org.openoffice.Office.Common/Help + org.openoffice.Office.Common/History + org.openoffice.Office.Common/I18N + org.openoffice.Office.Common/InternalMSExport + org.openoffice.Office.Common/Load + org.openoffice.Office.Common/Misc/FormControlPilotsEnabled + org.openoffice.Office.Common/Misc/PluginsEnabled + org.openoffice.Office.Common/Misc/SymbolSet + org.openoffice.Office.Common/Misc/UseSystemFileDialog + org.openoffice.Office.Common/Misc/UseSystemPrintDialog + org.openoffice.Office.Common/Misc/SymbolStyle + org.openoffice.Office.Common/Passwords + org.openoffice.Office.Common/Print/PrintingModifiesDocument + org.openoffice.Office.Common/Print/Warning + org.openoffice.Office.Common/Vectorize + org.openoffice.Office.Common/Save + org.openoffice.Office.Common/SearchOptions + org.openoffice.Office.Common/Undo + org.openoffice.Office.Common/View/Dialog/Dialog/MiddleMouseButton + org.openoffice.Office.Common/View/Dialog/MousePositioning + org.openoffice.Office.Common/View/Localization + org.openoffice.Office.Common/View/Menu + org.openoffice.Office.Common/_3D_Engine + </value> + </prop> + <prop oor:name="ExcludedNodes"> + <value> + org.openoffice.Office.Common/_3D_Engine/OpenGL + org.openoffice.Office.Common/Help/Registration + </value> + </prop> + </node> + <node oor:name="Calc" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Calc</value> + </prop> + </node> + <node oor:name="Chart" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Chart</value> + </prop> + </node> + <node oor:name="Draw" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Draw</value> + </prop> + </node> + <node oor:name="Impress" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Impress</value> + </prop> + </node> + <node oor:name="Labels" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Labels</value> + </prop> + </node> + <node oor:name="Linguistic" oor:op="replace"> + <prop oor:name="MigrationService"> + <value>com.sun.star.migration.Wordbooks</value> + </prop> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Linguistic</value> + </prop> + <prop oor:name="ExcludedNodes"> + <value>org.openoffice.Office.Linguistic/ServiceManager</value> + </prop> + </node> + <node oor:name="Math" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Math</value> + </prop> + </node> + <node oor:name="Security" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.Security</value> + </prop> + </node> + <node oor:name="UI" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value>org.openoffice.Office.UI/ColorScheme</value> + </prop> + </node> + <node oor:name="Writer" oor:op="replace"> + <prop oor:name="IncludedNodes"> + <value> + org.openoffice.Office.Writer + org.openoffice.Office.WriterWeb + </value> + </prop> + <prop oor:name="ExcludedNodes"> + <value>org.openoffice.Office.Writer/Wizard</value> + </prop> </node> </node> + </node> + </node> </node> </oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/makefile.mk b/officecfg/registry/data/org/openoffice/makefile.mk index 4e69cfecf132..b51285af50cc 100644..100755 --- a/officecfg/registry/data/org/openoffice/makefile.mk +++ b/officecfg/registry/data/org/openoffice/makefile.mk @@ -41,7 +41,8 @@ XCUFILES= \ System.xcu \ VCL.xcu \ FirstStartWizard.xcu \ - UserProfile.xcu + UserProfile.xcu \ + Interaction.xcu MODULEFILES= \ Inet-macosx.xcu \ diff --git a/officecfg/registry/schema/org/openoffice/Interaction.xcs b/officecfg/registry/schema/org/openoffice/Interaction.xcs new file mode 100644 index 000000000000..e39d44da7fd1 --- /dev/null +++ b/officecfg/registry/schema/org/openoffice/Interaction.xcs @@ -0,0 +1,86 @@ +<?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 + * + * 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="Interaction" oor:package="org.openoffice" xml:lang="en-US"> + <info> + <author>Frank Schönheit</author> + <desc>contains configuration related to the interaction system of OpenOffice.org.</desc> + </info> + <templates> + <group oor:name="RequestTypeResponsibility"> + <info> + <desc>describes the responsibility for a single interaction request type.</desc> + </info> + <prop oor:name="Propagation" oor:type="xs:string"> + <info> + <desc>describes how the responsibility for this particular request type propagates through the + type hierarchy.</desc> + </info> + <constraints> + <enumeration oor:value="named-only"> + <info> + <desc>specifies that the interaction handler is responsible only for this particular type.</desc> + </info> + </enumeration> + <enumeration oor:value="named-and-derived"> + <info> + <desc> + specifies that the interaction handler is responsible not only for this particular type, + but also for all derived types. + </desc> + </info> + </enumeration> + </constraints> + </prop> + </group> + <group oor:name="InteractionHandlerImplementation"> + <info> + <desc>contains information about a concrete interaction handler implementation.</desc> + </info> + <set oor:name="HandledRequestTypes" oor:node-type="RequestTypeResponsibility"> + <info> + <desc>specifies the types which the interaction handler implementation is responsible for. The node names + of this set are interpreted as names in the UNO type system, this way specifying the request types + which should be delegated to the given interaction handler.</desc> + </info> + </set> + <prop oor:name="ServiceName" oor:type="xs:string"> + <info> + <desc>contains the name to be used to create an instance of the interaction handler implementation.</desc> + </info> + </prop> + </group> + </templates> + <component> + <set oor:name="InteractionHandlers" oor:node-type="InteractionHandlerImplementation"> + <info> + <desc>collects information about registered interaction handlers.</desc> + </info> + </set> + </component> +</oor:component-schema> diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index 6daeaf69a85a..b5232c21eb82 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -1016,6 +1016,97 @@ <value>NULL</value> </prop> </group> + <group oor:name="Dialogs"> + <info> + <desc>Contains the dialogs settings.</desc> + </info> + <group oor:name="CSVImport"> + <info> + <desc>Contains setting for Text CSV Import</desc> + </info> + <prop oor:name="MergeDelimiters" oor:type="xs:boolean"> + <info> + <author>muthusuba</author> + <desc>Merge Delimiter check box status</desc> + <label>MergeDelimiters</label> + </info> + <value>false</value> + </prop> + <prop oor:name="QuotedFieldAsText" oor:type="xs:boolean"> + <info> + <author>kyoshida</author> + <desc>If true, quoted field is always imported as text + with no exception.</desc> + <label>QuotedFieldAsText</label> + </info> + <value>true</value> + </prop> + <prop oor:name="DetectSpecialNumbers" oor:type="xs:boolean"> + <info> + <author>kyoshida</author> + <desc>If true, Calc tries to detect special number format, such as date and scientific notation.</desc> + <label>DetectSpecialNumbers</label> + </info> + <value>false</value> + </prop> + <prop oor:name="Language" oor:type="xs:int"> + <info> + <author>kyoshida</author> + <desc>Language to use for CSV import. This determines how the numbers are parsed.</desc> + <label>Language</label> + </info> + <value>0</value> + </prop> + <prop oor:name="Separators" oor:type="xs:string"> + <info> + <author>muthusuba</author> + <desc>List of Separators - as a String</desc> + <label>Separators</label> + </info> + <value>; </value> + </prop> + <prop oor:name="TextSeparators" oor:type="xs:string"> + <info> + <author>muthusuba</author> + <desc>Text Separators</desc> + <label>TextSeparators</label> + </info> + <value>"</value> + </prop> + <prop oor:name="FixedWidth" oor:type="xs:boolean"> + <info> + <author>muthusuba</author> + <desc>Fixed width</desc> + <label>FixedWidth</label> + </info> + <value>false</value> + </prop> + <prop oor:name="FromRow" oor:type="xs:int"> + <info> + <author>muthusuba</author> + <desc>From Row</desc> + <label>FromRow</label> + </info> + <value>1</value> + </prop> + <prop oor:name="CharSet" oor:type="xs:int"> + <info> + <author>muthusuba</author> + <desc>Char Set</desc> + <label>CharSet</label> + </info> + <value>-1</value> + </prop> + <prop oor:name="FixedWidthList" oor:type="xs:string"> + <info> + <author>muthusuba</author> + <desc>Fixed Width List of separators</desc> + <label>FixedWidthList</label> + </info> + <value></value> + </prop> + </group> + </group> <group oor:name="Calculate"> <info> <desc>Contains settings that affect cell calculation.</desc> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index a0e17004f5be..a1e203a29366 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -2238,17 +2238,6 @@ </info> <value>true</value> </prop> - <prop oor:name="DocumentWindows" oor:type="xs:boolean"> - <!-- OldPath: General/Restore --> - <!-- OldLocation: soffice.cfg --> - <!-- UIHints: Tools Options - General Save - [Section] Restore editing view - Open windows--> - <info> - <author>MBA</author> - <desc>Specifies whether all currently open windows of a document should be saved. If true the view properties for all open document views of that document are saved.</desc> - <label>Open windows</label> - </info> - <value>false</value> - </prop> <prop oor:name="PrettyPrinting" oor:type="xs:boolean"> <!-- UIHints: Tools Options - General Save - optimize XML file size--> <!--the UI setting is inverse to this setting--> @@ -3562,6 +3551,12 @@ </info> <value/> </prop> + <prop oor:name="StartCenterLayoutStyle" oor:type="xs:int"> + <info> + <desc>Contains a number deciding the layout style of the start center</desc> + </info> + <value>0</value> + </prop> </group> <group oor:name="Registration"> <info> diff --git a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs index 6f6c661e8f76..f424180c7609 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs @@ -28,54 +28,59 @@ <!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="Recovery" oor:package="org.openoffice.Office" xml:lang="en-US"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <templates> <group oor:name="RecoveryEntry"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <prop oor:name="TempURL" oor:type="xs:string"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </prop> <prop oor:name="OriginalURL" oor:type="xs:string"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </prop> <prop oor:name="TemplateURL" oor:type="xs:string"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </prop> <prop oor:name="Module" oor:type="xs:string"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </prop> <prop oor:name="DocumentState" oor:type="xs:int"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </prop> <prop oor:name="Filter" oor:type="xs:string"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </prop> <prop oor:name="Title" oor:type="xs:string"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </prop> - </group> + <prop oor:name="ViewNames" oor:type="oor:string-list"> + <info> + <desc> </desc> + </info> + </prop> + </group> </templates> <component> <set oor:name="RecoveryList" oor:node-type="RecoveryEntry"> <info> - <desc>TODO</desc> + <desc> </desc> </info> </set> <group oor:name="SessionShutdown"> @@ -93,7 +98,7 @@ </group> <group oor:name="RecoveryInfo"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <prop oor:name="Enabled" oor:type="xs:boolean"> <info> @@ -103,13 +108,13 @@ </prop> <prop oor:name="Crashed" oor:type="xs:boolean"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <value>false</value> </prop> <prop oor:name="SessionData" oor:type="xs:boolean"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <value>false</value> </prop> @@ -127,17 +132,17 @@ </group> <group oor:name="AutoSave"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <prop oor:name="Enabled" oor:type="xs:boolean"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <value>true</value> </prop> <prop oor:name="TimeIntervall" oor:type="xs:int"> <info> - <desc>TODO</desc> + <desc> </desc> </info> <value>15</value> </prop> diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs index 9e5551bda18a..de8a64e2b0d8 100644 --- a/officecfg/registry/schema/org/openoffice/Setup.xcs +++ b/officecfg/registry/schema/org/openoffice/Setup.xcs @@ -34,61 +34,86 @@ <templates> <group oor:name="InstalledLocale"> <info> - <author>JB</author> + <author>JB</author> <desc>Describes a language pack that is installed to provide a localized office UI.</desc> </info> <prop oor:name="Origin" oor:type="xs:string"> - <info> - <author>JB</author> - <desc>Identifies the organization, group or person that provided this language pack.</desc> - </info> + <info> + <author>JB</author> + <desc>Identifies the organization, group or person that provided this language pack.</desc> + </info> </prop> </group> - <group oor:name="MigrationStep"> + <group oor:name="MigrationStep"> + <info> + <desc>Describes one step of migration</desc> + </info> + <prop oor:name="MigrationService" oor:type="xs:string"> + <info> + <desc>an optional uno service that is called after files and nodes have been copied in order to perform custom migration actions. The service needs to support XInitializable and XJob interfaces according do http://specs.openoffice.org/appwide/migration/spec_migration.sxw</desc> + </info> + </prop> + <prop oor:name="ServiceConfigComponents" oor:type="oor:string-list"> + <info> + <desc>a list of config components that are to be passed to service</desc> + </info> + </prop> + <prop oor:name="IncludedFiles" oor:type="oor:string-list"> + <info> + <desc>a list of wildcards relative to the old userdata origin that are to be copied</desc> + </info> + </prop> + <prop oor:name="ExcludedFiles" oor:type="oor:string-list"> + <info> + <desc>a list of wildcards relative to the old userdata origin that are to be copied</desc> + </info> + </prop> + <prop oor:name="IncludedNodes" oor:type="oor:string-list"> + <info> + <desc>a list of configuration node paths that are to be moved from the old user layer to the new user layer</desc> + </info> + </prop> + <prop oor:name="ExcludedNodes" oor:type="oor:string-list"> + <info> + <desc>a list of configuration node paths that are not to be moved from the old user layer to the new user layer</desc> + </info> + </prop> + <prop oor:name="IncludedExtensions" oor:type="oor:string-list"> + <info> + <desc>a list of extension identifiers that are to be copied from the old user layer to the new user layer</desc> + </info> + </prop> + <prop oor:name="ExcludedExtensions" oor:type="oor:string-list"> + <info> + <desc>a list of extension identifiers that are not to be copied from the old user layer to the new user layer</desc> + </info> + </prop> + </group> + <group oor:name="MigrateVersion"> + <info> + <desc>Describes migration steps specific for certain version(s)</desc> + </info> + <prop oor:name="VersionIdentifiers" oor:type="oor:string-list"> + <info> + <desc>version identifiers, that are supported for migration</desc> + </info> + <value/> + </prop> + <prop oor:name="Priority" oor:type="xs:int"> + <info> + <desc>Contains the priority value to specify which migration should be prefered. Higher values are prefered.</desc> + </info> + <value/> + </prop> + <set oor:name="MigrationSteps" oor:node-type="MigrationStep"> + <info> + <desc>Contains necessary migration steps for specific versions</desc> + </info> + </set> + </group> + <group oor:name="Factory"> <info> - <author>LO</author> - <desc>Describes one step of migration</desc> - </info> - <prop oor:name="MigrationService" oor:type="xs:string"> - <info> - <author>LO</author> - <desc>an optional uno service that is called after files and nodes have been copied in order to perform custom migration actions. The service needs to support XInitializable and XJob interfaces according do http://specs.openoffice.org/appwide/migration/spec_migration.sxw</desc> - </info> - </prop> - <prop oor:name="ServiceConfigComponents" oor:type="oor:string-list"> - <info> - <author>LO</author> - <desc>a list of config components that are to be passed to service</desc> - </info> - </prop> - <prop oor:name="IncludedFiles" oor:type="oor:string-list"> - <info> - <author>LO</author> - <desc>a list of wildcards relative to the old userdata origin that are to be copied</desc> - </info> - </prop> - <prop oor:name="ExcludedFiles" oor:type="oor:string-list"> - <info> - <author>LO</author> - <desc>a list of wildcards relative to the old userdata origin that are to be copied</desc> - </info> - </prop> - <prop oor:name="IncludedNodes" oor:type="oor:string-list"> - <info> - <author>LO</author> - <desc>a list of configuration node paths that are to be moved from the old user layer to the new user layer</desc> - </info> - </prop> - <prop oor:name="ExcludedNodes" oor:type="oor:string-list"> - <info> - <author>LO</author> - <desc>a list of configuration node paths that are not to be moved from the old user layer to the new user layer</desc> - </info> - </prop> - </group> - <group oor:name="Factory"> - <info> - <author>AS</author> + <author>AS</author> <desc>Describes an application module (a document factory, such as Writer).</desc> </info> <prop oor:name="ooSetupFactoryActualFilter" oor:type="xs:string"> @@ -416,30 +441,21 @@ </info> <prop oor:name="TransferUserSettingsOnce" oor:type="xs:boolean" oor:nillable="false"> <info> - <deprecated>This feature is not supported any more since OOo 2.0</deprecated> + <deprecated>This feature is not supported any more since OOo 2.0</deprecated> <author>JB</author> - <desc>Deprecated</desc> - </info> - </prop> - </group> - <group oor:name="Migration"> - <info> - <author>LO</author> - <desc>Contains settings that control configuration data access.</desc> - </info> - <set oor:name="MigrationSteps" oor:node-type="MigrationStep"> - <info> - <author>LO</author> - <desc>The enumeration of migration steps that are to be applied on first start</desc> - </info> - </set> - <prop oor:name="SupportedVersions" oor:type="oor:string-list"> - <info> - <author>LO</author> - <desc>version identifiers, that are supported for migration</desc> + <desc>Deprecated</desc> </info> - <value/> </prop> </group> - </component> + <group oor:name="Migration"> + <info> + <desc>Contains settings that control the migration process for certain versions.</desc> + </info> + <set oor:name="SupportedVersions" oor:node-type="MigrateVersion"> + <info> + <desc>Define migration steps for supported versions</desc> + </info> + </set> + </group> + </component> </oor:component-schema> diff --git a/officecfg/registry/schema/org/openoffice/makefile.mk b/officecfg/registry/schema/org/openoffice/makefile.mk index 98cbdb4b2153..f928e447f404 100644 --- a/officecfg/registry/schema/org/openoffice/makefile.mk +++ b/officecfg/registry/schema/org/openoffice/makefile.mk @@ -42,7 +42,8 @@ XCSFILES= \ System.xcs \ UserProfile.xcs \ VCL.xcs \ - FirstStartWizard.xcs + FirstStartWizard.xcs \ + Interaction.xcs .INCLUDE : target.mk diff --git a/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs b/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs index 8775baa91df7..ea6de5b80a03 100644 --- a/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs +++ b/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs @@ -26,39 +26,28 @@ * ************************************************************************ --> <!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 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>Deprecated. Use org.openoffice.Interaction instead.</desc> + </info> + <templates> + <group oor:name="InteractionHandlerData"> + <info> + <desc>Deprecated. Use org.openoffice.Interaction instead.</desc> + </info> + <prop oor:name="ServiceName" oor:type="xs:string"> + <info> + <desc>Deprecated. Use org.openoffice.Interaction instead.</desc> + </info> + </prop> + </group> + </templates> + <component> + <set oor:name="InteractionHandlers" oor:node-type="InteractionHandlerData"> + <info> + <desc>Deprecated. Use org.openoffice.Interaction instead.</desc> + </info> + </set> + </component> </oor:component-schema> - - - - - - - - - - - - diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py index 6a57fa792873..88e0a9efbc9d 100644 --- a/scripting/source/pyprov/pythonscript.py +++ b/scripting/source/pyprov/pythonscript.py @@ -5,6 +5,7 @@ import sys import os import imp import time +import compiler class LogLevel: NONE = 0 @@ -340,6 +341,32 @@ class ProviderContext: ret = url[0:pos]+ package.transientPathElement + "/" + url[pos:len(url)] log.isDebugLevel() and log.debug( "getStorageUrlFromPersistentUrl " + url + " -> "+ ret) return ret + + def getFuncsByUrl( self, url ): + src = readTextFromStream( self.sfa.openFileRead( url ) ) + checkForPythonPathBesideScript( url[0:url.rfind('/')] ) + src = ensureSourceState( src ) + + code = compiler.parse( src ) + + allFuncs = [] + + if code == None: + return allFuncs + + g_exportedScripts = [] + for node in code.node.nodes: + if node.__class__.__name__ == 'Function': + allFuncs.append(node.name) + elif node.__class__.__name__ == 'Assign': + for assignee in node.nodes: + if assignee.name == 'g_exportedScripts': + for item in node.expr: + if item.__class__.__name__ == 'Name': + g_exportedScripts.append(item.name) + return g_exportedScripts + + return allFuncs def getModuleByUrl( self, url ): entry = self.modules.get(url) @@ -382,11 +409,10 @@ def isScript( candidate ): #------------------------------------------------------- class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, XActionListener ): - def __init__( self, provCtx, uri, fileName, funcName, func ): + def __init__( self, provCtx, uri, fileName, funcName ): self.fileName = fileName self.funcName = funcName self.provCtx = provCtx - self.func = func self.uri = uri def getName( self ): @@ -407,8 +433,6 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, if name == "URI": ret = self.provCtx.uriHelper.getScriptURI( self.provCtx.getPersistentUrlFromStorageUrl( self.uri + "$" + self.funcName ) ) - elif name == "Description": - ret = getattr( self.func, "__doc__", None ) elif name == "Editable" and ENABLE_EDIT_DIALOG: ret = not self.provCtx.sfa.isReadOnly( self.uri ) @@ -506,7 +530,7 @@ class FileBrowseNode( unohelper.Base, XBrowseNode ): self.provCtx = provCtx self.uri = uri self.name = name - self.module = None + self.funcnames = None def getName( self ): return self.name @@ -514,21 +538,14 @@ class FileBrowseNode( unohelper.Base, XBrowseNode ): def getChildNodes(self): ret = () try: - self.module = self.provCtx.getModuleByUrl( self.uri ) - values = self.module.__dict__.get( CALLABLE_CONTAINER_NAME , None ) + self.funcnames = self.provCtx.getFuncsByUrl( self.uri ) - # no g_exportedScripts, export every function - if not isinstance(values, type(())): - values = self.module.__dict__.values() - scriptNodeList = [] - for i in values: - if isScript( i ): - scriptNodeList.append( - ScriptBrowseNode( - self.provCtx, self.uri, self.name, i.__name__, i )) + for i in self.funcnames: + scriptNodeList.append( + ScriptBrowseNode( + self.provCtx, self.uri, self.name, i )) ret = tuple( scriptNodeList ) - # must compile ! log.isDebugLevel() and log.debug( "returning " +str(len(ret)) + " ScriptChildNodes on " + self.uri ) except Exception, e: text = lastException2String() diff --git a/sfx2/inc/about.hxx b/sfx2/inc/about.hxx index eecb6e0cd7f8..b3b347917ddc 100644 --- a/sfx2/inc/about.hxx +++ b/sfx2/inc/about.hxx @@ -29,15 +29,10 @@ // include --------------------------------------------------------------- -#ifndef _RESARY_HXX //autogen #include <tools/resary.hxx> -#endif -#ifndef _BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif -#ifndef _ACCEL_HXX //autogen #include <vcl/accel.hxx> -#endif +#include <svtools/svmedit.hxx> #include <tools/list.hxx> #include <svtools/stdctrl.hxx> #include <sfx2/basedlgs.hxx> // SfxModalDialog @@ -53,13 +48,14 @@ private: Image aAppLogo; FixedInfo aVersionText; - FixedInfo aCopyrightText; + MultiLineEdit aCopyrightText; FixedInfo aBuildData; ResStringArray aDeveloperAry; String aDevVersionStr; String aAccelStr; String aVersionData; + String aCopyrightTextStr; AccelList aAccelList; diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 7fc5ba91f8c7..b03bdd724c20 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -28,80 +28,126 @@ #ifndef _SFX_FRMLOAD_HXX #define _SFX_FRMLOAD_HXX +#include "sfx2/sfxuno.hxx" +#include "sfx2/objsh.hxx" + +/** === begin UNO includes === **/ #include <com/sun/star/frame/XLoadEventListener.hpp> -#include <rtl/ustring.hxx> -#include <tools/debug.hxx> #include <com/sun/star/frame/XSynchronousFrameLoader.hpp> +#include <com/sun/star/frame/XController2.hpp> +#include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/document/XExtendedFilterDetection.hpp> #include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +/** === end UNO includes === **/ + +#include <rtl/ustring.hxx> +#include <tools/debug.hxx> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase3.hxx> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <cppuhelper/factory.hxx> #include <tools/link.hxx> #include <tools/string.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> -class SfxObjectFactory; +class SfxFilter; class SfxFilterMatcher; -class LoadEnvironment_Impl; -class SfxMedium; -namespace com -{ - namespace sun - { - namespace star - { - namespace uno - { - class Any; - } - namespace lang - { - class XMultiServiceFactory; - } - namespace frame - { - class XFrame; - } - namespace beans - { - struct PropertyValue; - } - } - } -} - -#include <sfx2/sfxuno.hxx> - -#define REFERENCE ::com::sun::star::uno::Reference -#define SEQUENCE ::com::sun::star::uno::Sequence -#define RUNTIME_EXCEPTION ::com::sun::star::uno::RuntimeException - -class SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > -{ - REFERENCE < ::com::sun::star::frame::XFrame > xFrame; - REFERENCE < ::com::sun::star::frame::XLoadEventListener > xListener; - String aFilterName; - SfxMedium* pMedium; +class SfxFrameWeak; - DECL_LINK( LoadDone_Impl, void* ); +class SAL_DLLPRIVATE SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > +{ + ::comphelper::ComponentContext m_aContext; public: - SfxFrameLoader_Impl( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); - virtual ~SfxFrameLoader_Impl(); + SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); SFX_DECL_XSERVICEINFO //---------------------------------------------------------------------------------- // XSynchronousFrameLoader //---------------------------------------------------------------------------------- - virtual sal_Bool SAL_CALL load( const SEQUENCE< ::com::sun::star::beans::PropertyValue >& lDescriptor, const REFERENCE< ::com::sun::star::frame::XFrame >& xFrame ) throw( RUNTIME_EXCEPTION ); - virtual void SAL_CALL cancel() throw( RUNTIME_EXCEPTION ); + virtual sal_Bool SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL cancel() throw( ::com::sun::star::uno::RuntimeException ); + +protected: + virtual ~SfxFrameLoader_Impl(); + +private: + const SfxFilter* impl_getFilterFromServiceName_nothrow( + const ::rtl::OUString& i_rServiceName + ) const; + + ::rtl::OUString impl_askForFilter_nothrow( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& i_rxHandler, + const ::rtl::OUString& i_rDocumentURL + ) const; + + const SfxFilter* impl_detectFilterForURL( + const ::rtl::OUString& _rURL, + const ::comphelper::NamedValueCollection& i_rDescriptor, + const SfxFilterMatcher& rMatcher + ) const; + + sal_Bool impl_createNewDocWithSlotParam( + const USHORT _nSlotID, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, + const bool i_bHidden + ); + + void impl_determineFilter( + ::comphelper::NamedValueCollection& io_rDescriptor + ) const; + + bool impl_determineTemplateDocument( + ::comphelper::NamedValueCollection& io_rDescriptor + ) const; + + USHORT impl_findSlotParam( + const ::rtl::OUString& i_rFactoryURL + ) const; + + SfxObjectShellLock impl_findObjectShell( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rxDocument + ) const; + + void impl_lockHiddenDocument( + SfxObjectShell& i_rDocument, + const ::comphelper::NamedValueCollection& i_rDescriptor + ) const; + + void impl_handleCaughtError_nothrow( + const ::com::sun::star::uno::Any& i_rCaughtError, + const ::comphelper::NamedValueCollection& i_rDescriptor + ) const; + + void impl_removeLoaderArguments( + ::comphelper::NamedValueCollection& io_rDescriptor + ); + + sal_Int16 impl_determineEffectiveViewId_nothrow( + const SfxObjectShell& i_rDocument, + const ::comphelper::NamedValueCollection& i_rDescriptor + ); + + ::comphelper::NamedValueCollection + impl_extractViewCreationArgs( + ::comphelper::NamedValueCollection& io_rDescriptor + ); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > + impl_createDocumentView( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, + const ::rtl::OUString& i_rViewName + ); }; #endif diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx index 401097c25fe9..fe8358bfe646 100644 --- a/sfx2/inc/inettbc.hxx +++ b/sfx2/inc/inettbc.hxx @@ -74,19 +74,6 @@ public: virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); }; -class SfxCancelToolBoxControl_Impl : public SfxToolBoxControl -{ -public: - - SFX_DECL_TOOLBOX_CONTROL(); - - SfxCancelToolBoxControl_Impl( USHORT nSlotId, USHORT nId, ToolBox& rBox ); - - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); -}; - #endif #endif diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx index 2bc592b686a7..8cd8f9d8561f 100644 --- a/sfx2/inc/pch/precompiled_sfx2.hxx +++ b/sfx2/inc/pch/precompiled_sfx2.hxx @@ -492,7 +492,6 @@ #include "svl/aeitem.hxx" #include "svtools/asynclink.hxx" #include "svl/brdcst.hxx" -#include "svl/cancel.hxx" #include "svl/cntwids.hrc" #include "svtools/controldims.hrc" #include "svl/ctypeitm.hxx" diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index 458ef15036b3..17b2dee417cd 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -58,7 +58,6 @@ class AppSettings; struct SfxChildWinContextFactory; class SfxAppData_Impl; class SfxBindings; -class SfxCancelManager; class SfxChildWinFactArr_Impl; class SfxChildWindow; class SfxDispatcher; @@ -218,7 +217,6 @@ public: // members SfxFilterMatcher& GetFilterMatcher(); - SfxCancelManager* GetCancelManager() const; SfxMacroConfig* GetMacroConfig() const; SfxProgress* GetProgress() const; const String& GetLastSaveDirectory() const; @@ -264,7 +262,6 @@ public: SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl(); SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl(); - SAL_DLLPRIVATE SfxObjectShellLock NewDoc_Impl( const String& rFactory, const SfxItemSet* pSet = NULL ); SAL_DLLPRIVATE BOOL QueryExit_Impl(); SAL_DLLPRIVATE void SetOptions_Impl(const SfxItemSet &); SAL_DLLPRIVATE FASTBOOL Initialize_Impl(); @@ -290,7 +287,6 @@ public: // TODO/CLEANUP: still needed? SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &); SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &); - SAL_DLLPRIVATE const SfxPoolItem* NewDocDirectExec_ImplOld(SfxRequest &); // used by FrameLoader to work with the old behaviour ... SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &); SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); diff --git a/sfx2/inc/sfx2/bindings.hxx b/sfx2/inc/sfx2/bindings.hxx index 6f7660d71e40..e568fe7305f0 100644 --- a/sfx2/inc/sfx2/bindings.hxx +++ b/sfx2/inc/sfx2/bindings.hxx @@ -96,8 +96,7 @@ class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster der Klasse SfxBindings. Sie wird von der SfxApplication automatisch angelegt und zerst"ort. Instanzen werden aber i.d.R. "uber das Makro <SFX_BINDINGS> oder den zugeh"origen <SfxViewFrame> besorgt - werden. Bestimmte SfxViewFrame Subklassen (z.B. <SfxInPlaceFrame>) - legen ihre eigene Instanz der SfxBindings an. + werden. Die SfxBindings verwalten alle in den an ihr angemeldeten Controllern gebundenen Slot-Ids und cachen die jeweiligen <Slot-Server> diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index be1d5b1d973a..3cc3eecc7ce7 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -82,6 +82,7 @@ public: const SvGlobalName& GetClassId() const; SfxObjectShellFlags GetFlags() { return nFlags; } const char* GetShortName() const { return pShortName; } + String GetFactoryURL() const; // shortcut for "private:factory/GetShortName()" String GetFactoryName() const { return String::CreateFromAscii( pShortName ); } String GetModuleName() const; void SetDocumentTypeNameResource( const ResId& rId ); @@ -93,6 +94,9 @@ public: USHORT GetViewFactoryCount() const; SfxViewFactory& GetViewFactory(USHORT i = 0) const; + /// returns the view factory whose GetViewName delivers the requested logical name + SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const; + // Filter const SfxFilter* GetTemplateFilter() const; static String GetStandardTemplate( const String& rServiceName ); @@ -106,6 +110,7 @@ public: //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetModule_Impl( SfxModule* ); SAL_DLLPRIVATE static void UpdateFilterContainers_Impl(); + SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const; //#endif private: diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 03bcfec5818f..074f74cb0e72 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -48,7 +48,6 @@ #include <svl/lstner.hxx> #include <tools/globname.hxx> -#include <svl/cancel.hxx> #include <cppuhelper/weak.hxx> #include <ucbhelper/content.hxx> @@ -64,16 +63,6 @@ class SfxItemSet; class DateTime; class SvStringsDtor; class SvEaMgr; -class SfxPoolCancelManager_Impl; - -#define SFX_TFPRIO_SYNCHRON 0 -#define SFX_TFPRIO_DOC 10 -#define SFX_TFPRIO_VISIBLE_LOWRES_GRAPHIC 20 -#define SFX_TFPRIO_VISIBLE_HIGHRES_GRAPHIC 21 -#define SFX_TFPRIO_PLUGINS 40 -#define SFX_TFPRIO_INVISIBLE_LOWRES_GRAPHIC 50 -#define SFX_TFPRIO_INVISIBLE_HIGHRES_GRAPHIC 51 -#define SFX_TFPRIO_DOWNLOADS 60 #define S2BS(s) ByteString( s, RTL_TEXTENCODING_MS_1252 ) @@ -157,7 +146,6 @@ public: void SetLoadTargetFrame(SfxFrame* pFrame ); SfxFrame* GetLoadTargetFrame() const; - void CancelTransfers(); void SetReferer( const String& rRefer ); const String& GetReferer( ) const; @@ -235,7 +223,6 @@ public: void SetUsesCache( sal_Bool ); sal_Bool IsExpired() const; void SetName( const String& rName, sal_Bool bSetOrigURL = sal_False ); - void SetDontCreateCancellable(); sal_Bool IsAllowedForExternalBrowser() const; long GetFileVersion() const; @@ -273,8 +260,6 @@ public: SAL_DLLPRIVATE sal_Bool TransferVersionList_Impl( SfxMedium& rMedium ); SAL_DLLPRIVATE sal_Bool SaveVersionList_Impl( sal_Bool bUseXML ); SAL_DLLPRIVATE sal_Bool RemoveVersion_Impl( const ::rtl::OUString& rVersion ); - SAL_DLLPRIVATE SfxPoolCancelManager_Impl* GetCancelManager_Impl() const; - SAL_DLLPRIVATE void SetCancelManager_Impl( SfxPoolCancelManager_Impl* pMgr ); SAL_DLLPRIVATE void SetExpired_Impl( const DateTime& rDateTime ); SAL_DLLPRIVATE SvKeyValueIterator* GetHeaderAttributes_Impl(); diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 77c578d6946f..b94e9038e8bb 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -68,6 +68,7 @@ namespace com #include <svl/brdcst.hxx> #include <tools/list.hxx> #include <svl/poolitem.hxx> +#include <comphelper/namedvaluecollection.hxx> class SvBorder; class SfxWorkWindow; @@ -83,31 +84,18 @@ class SfxMedium; class SfxFrameHistory_Impl; class SfxDispatcher; class SfxMedium; -class SfxCancellable; class Rectangle; class SfxRequest; class SfxUnoControllerItem; class SvCompatWeakHdl; +class SystemWindow; typedef SfxFrame* SfxFramePtr; class SfxFrameArr_Impl; DECLARE_LIST( TargetList, String* ) -#define SFXFRAME_INTERNAL 0x0001 -#define SFXFRAME_EXTERNAL 0x0002 -#define SFXFRAME_OWNSDOCUMENT 0x0004 -#define SFXFRAME_PLUGIN 0x0008 -#define SFXFRAME_HASTITLE 0x0010 -#define SFXFRAME_SERVER 0x0020 // Is es ein Frame, der in einem Container steckt ? -#define SFXFRAME_FRAMESET 0x0040 - -#define BROWSE_NORMAL 0 -#define BROWSE_FORWARD 1 -#define BROWSE_BACKWARD 2 -#define NO_BROWSE 3 -#define BROWSE_FRAME 4 -#define BROWSE_MAX_MODE 10 +#define SFXFRAME_HASTITLE 0x0001 //========================================================================== // Ein SfxFrame ist eine Verwaltungsklasse f"ur Fenster und deren Inhalte. @@ -123,82 +111,63 @@ DECLARE_LIST( TargetList, String* ) //========================================================================== class SfxFrameArr_Impl; -class SfxCancelManager; struct SfxFramePickEntry_Impl; -class SfxUnoFrame; class SFX2_DLLPUBLIC SfxFrame { friend class SfxFrameIterator; - friend struct SfxFramePickEntry_Impl; - friend class SfxUnoFrame; - friend class SfxViewFrame; /*HACK!*/ + friend class SfxFrameWindow_Impl; private: - String aName; SfxFrame* pParentFrame; SfxFrameArr_Impl* pChildArr; SfxFrame_Impl* pImp; - SfxUnoFrame* pUnoImp; - - SAL_DLLPRIVATE void UpdateUndoHistory_Impl( - SfxObjectShell *pDocSh, const String* pNew, const String *pTitle = 0 ); - SAL_DLLPRIVATE void UpdateCurrentHistory_Impl( - SfxObjectShell *pDocSh, const String* pNew ); + Window* pWindow; protected: - virtual sal_Bool Close() = 0; + sal_Bool Close(); virtual ~SfxFrame(); -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void SetCurrentDocument_Impl( SfxObjectShell* ); - SAL_DLLPRIVATE void InsertChildFrame_Impl( SfxFrame*, sal_uInt16 nPos = 0 ); - SAL_DLLPRIVATE void RemoveChildFrame_Impl( sal_uInt16 nPos ); SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* ); - SAL_DLLPRIVATE void SetIsTop_Impl( sal_Bool bIsTop = sal_True ); -//#endif + + SfxFrame( ); // not implemented + SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden ); public: TYPEINFO(); - SfxFrame(SfxFrame* pParent = 0); + + static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); + static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + CreateBlankFrame(); + static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ); SvCompatWeakHdl* GetHdl(); - virtual Window& GetWindow() const = 0; + Window& GetWindow() const; void CancelTransfers( sal_Bool bCancelLoadEnv = sal_True ); sal_Bool DoClose(); sal_uInt16 GetChildFrameCount() const; SfxFrame* GetChildFrame( sal_uInt16 nPos ) const; - void SetFrameName( const String& rName ); - const String& GetFrameName() const - { return aName; } SfxFrame* GetParentFrame() const { return pParentFrame; } - String GetContent() const; + + void SetPresentationMode( BOOL bSet ); + SystemWindow* GetSystemWindow() const; static SfxFrame* GetFirst(); static SfxFrame* GetNext( SfxFrame& ); - virtual sal_Bool InsertDocument( SfxObjectShell *pDoc ); - const SfxPoolItem* LoadDocumentSynchron( SfxItemSet& aSet ); - void DocumentInserted( SfxObjectShell* pDoc ); + static const SfxPoolItem* + OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame ); SfxBroadcaster& GetBroadcaster() const; SfxObjectShell* GetCurrentDocument() const; SfxViewFrame* GetCurrentViewFrame() const; - SfxFrame* GetTopFrame() const; + SfxFrame& GetTopFrame() const; sal_Bool IsParent( SfxFrame* ) const; - SfxFrame* findFrame( const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags); - SfxFrame* SearchFrame( const String&, SfxMedium* pMedium = 0 ); sal_uInt32 GetFrameType() const; void GetTargetList( TargetList& ) const; - void ClearHistory(); SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf ); sal_Bool IsTop() const; - sal_Bool CloseChildFrames(); - void UpdatePickEntries(); - void UpdatePickEntries( const ::com::sun::star::uno::Any& rValue ); - void UpdateHistory( const ::rtl::OUString& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::rtl::OUString& rTitle ); - void UpdateHistory(SfxObjectShell*, const String*pNew = 0 ); void UpdateDescriptor( SfxObjectShell *pDoc ); void Resize(); sal_Bool HasComponent() const; @@ -212,68 +181,30 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > GetController() const; - static sal_Bool LoadSfxComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &, - const ::rtl::OUString&, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&, - const SfxObjectFactory* ); - sal_Bool IsInPlace() const; //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Bool DoClose_Impl(); - SAL_DLLPRIVATE void SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet ); - SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > - GetInterceptor_Impl(); - SAL_DLLPRIVATE void Clear_Impl(); - SAL_DLLPRIVATE sal_uInt16 LoadComponent_Impl( const ::rtl::OUString& rURL, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrameLoader > & rLoader, - SfxItemSet* pSet=0, sal_Bool bDontClose=sal_False ); - SAL_DLLPRIVATE void LoadFinished_Impl(); - DECL_DLLPRIVATE_STATIC_LINK( SfxFrame, BindingHasNewPart_Impl, void* ); - SAL_DLLPRIVATE SfxCancelManager* GetCancelManager() const; SAL_DLLPRIVATE void GetViewData_Impl(); - SAL_DLLPRIVATE sal_Bool CheckContentForLoad_Impl(); - SAL_DLLPRIVATE sal_Bool ExecuteHistoryMenu_Impl( sal_uInt16 nWnich, const Rectangle& rRect, sal_uInt16 nFlags=0 ); - SAL_DLLPRIVATE void ActivatePickEntry_Impl( SfxFramePickEntry_Impl*, sal_uInt16 nMode, SfxFrameDescriptor *pD = NULL ); - SAL_DLLPRIVATE void CopyHistory_Impl( SfxFrame *pFrame ) const; - SAL_DLLPRIVATE SfxFrame* SearchChildrenForName_Impl( const String&, sal_Bool bDeep = sal_True ) const; SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 ); - SAL_DLLPRIVATE void Activate_Impl( sal_Bool bBeamerOn ); - SAL_DLLPRIVATE void Deactivate_Impl(); SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False ); SAL_DLLPRIVATE sal_Bool DocIsModified_Impl(); SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* ); - SAL_DLLPRIVATE SfxFrame* SearchFrame_Impl( sal_uInt16, sal_Bool bDeep=sal_False ); - SAL_DLLPRIVATE SfxFrame* SearchFrame_Impl( const String&, sal_Bool bDeep=sal_False ); - SAL_DLLPRIVATE void SetFrameId_Impl( sal_uInt16 ); - SAL_DLLPRIVATE sal_uInt16 GetFrameId_Impl() const; - SAL_DLLPRIVATE void SetFrameIdName_Impl( const String& ); SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const; SAL_DLLPRIVATE void SetIsClosing_Impl(); - SAL_DLLPRIVATE sal_Bool BrowseInFrame( int nDelta ); - SAL_DLLPRIVATE sal_Bool Browse( sal_Bool bForward, sal_uInt16 nDelta = 1, sal_Bool bNewFrame=sal_False ); - SAL_DLLPRIVATE sal_Bool CanBrowseForward() const; - SAL_DLLPRIVATE sal_Bool CanBrowseBackward() const; // Methoden f"ur den Zugriff auf das aktuelle Set SAL_DLLPRIVATE void SetDescriptor( SfxFrameDescriptor* ); SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const; SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock ); - SAL_DLLPRIVATE sal_uInt16 GetLockCount_Impl() const; - //sal_Bool IsLocked_Impl() const - // { return GetLockCount_Impl() > 0; } - SAL_DLLPRIVATE void CloseOnUnlock_Impl(); - SAL_DLLPRIVATE SfxViewFrame* ActivateChildFrame_Impl(); SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const; SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const; SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame ); SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame ); - SAL_DLLPRIVATE void SetItemSet_Impl( const SfxItemSet* pSet ); - SAL_DLLPRIVATE const SfxItemSet* GetItemSet_Impl(); SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet ); SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const; SAL_DLLPRIVATE void InvalidateUnoControllers_Impl(); @@ -284,15 +215,19 @@ public: SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const; SAL_DLLPRIVATE void CreateWorkWindow_Impl(); SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* pWorkwin ); - SAL_DLLPRIVATE const SvBorder& GetBorder_Impl() const; SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); - SAL_DLLPRIVATE void ReFill_Impl( const SfxFrameSetDescriptor* pSet ); - SAL_DLLPRIVATE void LockFocus_Impl( sal_Bool bLock ); - SAL_DLLPRIVATE sal_Bool IsFocusLocked_Impl() const; - SAL_DLLPRIVATE void CloseDocument_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); -// sal_Bool IsPlugin_Impl() const; + + SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc ); + SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); + SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); + SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; + SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; + SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; + SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const; //#endif +private: + SAL_DLLPRIVATE void Construct_Impl(); }; SV_DECL_COMPAT_WEAK( SfxFrame ) @@ -350,7 +285,24 @@ public: ::com::sun::star::uno::Any GetValue() const { return aValue; } virtual int operator==( const SfxPoolItem& ) const; - virtual String GetValueText() const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; + virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); +}; + +class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem +{ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + m_xFrame; + +public: + TYPEINFO(); + SfxUnoFrameItem(); + SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& + GetFrame() const + { return m_xFrame; } + virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); diff --git a/sfx2/inc/sfx2/linkmgr.hxx b/sfx2/inc/sfx2/linkmgr.hxx index ee734dd69773..7dc779e2ba6e 100644 --- a/sfx2/inc/sfx2/linkmgr.hxx +++ b/sfx2/inc/sfx2/linkmgr.hxx @@ -131,8 +131,6 @@ public: // (ist zur Zeit nur fuer die FileLinks interressant!) void CancelTransfers(); - static void SetTransferPriority( sfx2::SvBaseLink& rLink, USHORT nPrio ); - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index e0142e9ba140..5fc5a641fd44 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -92,7 +92,6 @@ class GDIMetaFile; class Bitmap; class INetURLObject; class IndexBitSet; -class SfxTopFrame; class JobSetup; class Size; class Point; @@ -217,17 +216,13 @@ private: SfxMedium * pMedium; // Beschreibung der Datei bzw. des Storage, in dem sich das Objekt befindet SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets SfxObjectCreateMode eCreateMode; // Zweck des Objekts - sal_uInt16 nViewNo; // Numerierung der MDIWins sal_Bool bHasName :1, // sal_True := bestehendes Objekt, sal_False := es ist ein neues Objekt bIsTmp :1; // temp. Storage private: //#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void Construct_Impl(); SAL_DLLPRIVATE void UpdateTime_Impl(const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties> & i_xDocProps); - SAL_DLLPRIVATE sal_Bool MakeBackup_Impl(const String &rName, - sal_Bool bCopyAllways = sal_False); SAL_DLLPRIVATE sal_Bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet ); @@ -237,6 +232,7 @@ private: protected: SfxObjectShell(SfxObjectCreateMode); + SfxObjectShell( const sal_uInt64 i_nCreationFlags ); // see sfxmodelfactory.hxx virtual ~SfxObjectShell(); virtual void ModifyChanged(); @@ -246,10 +242,6 @@ protected: */ void SetHasNoBasic(); -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void StartLoading_Impl(); -//#endif - /// template method, called by FlushDocInfo; this implementation is empty virtual void DoFlushDocInfo(); @@ -501,11 +493,6 @@ public: void SetTitle( const String& rTitle ); String GetTitle( sal_uInt16 nMaxLen = 0 ) const; void InvalidateName(); // Zuruecksetzen auf unbenannt -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void SetLastMark_Impl( const String & ); - SAL_DLLPRIVATE const String& GetLastMark_Impl() const; - SAL_DLLPRIVATE sal_Bool DoInitNew_Impl( const ::rtl::OUString& rName ); -//#endif // DDE-Interface virtual long DdeExecute( const String& rCmd ); @@ -609,19 +596,15 @@ public: virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium ); - void SetModel( SfxBaseModel* pModel ); - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModel() const; // Nur uebergangsweise fuer die Applikationen !!! void SetBaseModel( SfxBaseModel* pModel ); - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const; // Nur uebergangsweise fuer die Applikationen !!! virtual SEQUENCE< OUSTRING > GetEventNames(); -//REMOVE SotStorageStreamRef GetConfigurationStream( const String& rName, BOOL bCreate=FALSE ); -//REMOVE SvStorageRef GetConfigurationStorage( SotStorage* pStor=NULL ); - Window* GetDialogParent( SfxMedium* pMedium=0 ); String UpdateTitle( SfxMedium* pMed=NULL, USHORT nDocViewNo=0 ); static SfxObjectShell* CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); @@ -674,12 +657,10 @@ public: virtual Printer * GetDocumentPrinter(); virtual OutputDevice* GetDocumentRefDev(); virtual void OnDocumentPrinterChanged( Printer * pNewPrinter ); - //virtual UINT32 GetViewAspect() const; virtual Rectangle GetVisArea( USHORT nAspect ) const; virtual void SetVisArea( const Rectangle & rVisArea ); const Rectangle & GetVisArea() const; void SetVisAreaSize( const Size & rVisSize ); -//REMOVE virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferableSnapshot(); virtual ULONG GetMiscStatus() const; MapUnit GetMapUnit() const; @@ -723,9 +704,6 @@ public: SAL_DLLPRIVATE ::rtl::OUString CreateTempCopyOfStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); - SAL_DLLPRIVATE static sal_Bool NoDependencyFromManifest_Impl( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); - SAL_DLLPRIVATE void InitOwnModel_Impl(); SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing ); SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl(); @@ -734,7 +712,6 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos ); SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); - SAL_DLLPRIVATE SEQUENCE< OUSTRING > GetEventNames_Impl(); SAL_DLLPRIVATE void InitBasicManager_Impl(); SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; } @@ -768,12 +745,10 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr ); SAL_DLLPRIVATE void PositionView_Impl(); SAL_DLLPRIVATE void UpdateFromTemplate_Impl(); - SAL_DLLPRIVATE void Reload_Impl(); SAL_DLLPRIVATE sal_Bool CanReload_Impl(); SAL_DLLPRIVATE void SetNamedVisibility_Impl(); SAL_DLLPRIVATE sal_Bool DoSave_Impl( const SfxItemSet* pSet=0 ); SAL_DLLPRIVATE sal_Bool Save_Impl( const SfxItemSet* pSet=0 ); - SAL_DLLPRIVATE void UpdatePickList_Impl(); SAL_DLLPRIVATE sal_Bool PreDoSaveAs_Impl(const String &rFileName, const String &rFiltName, SfxItemSet *); SAL_DLLPRIVATE sal_Bool APISaveAs_Impl ( const String& aFileName, SfxItemSet* aParams ); SAL_DLLPRIVATE sal_Bool CommonSaveAs_Impl ( const INetURLObject& aURL, const String& aFilterName, SfxItemSet* aParams ); @@ -781,15 +756,13 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, sal_Bool bTypeMustBeSetAlready ); SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl(); + SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew ); // public-internals SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl(); SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress ); - SAL_DLLPRIVATE sal_uInt16& GetAktViewNo() { return nViewNo; } SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); -//REMOVE FASTBOOL SaveWindows_Impl( SvStorage &rStor ) const; - SAL_DLLPRIVATE SfxViewFrame* LoadWindows_Impl( SfxTopFrame *pPrefered = 0 ); SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); // configuration items diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc index 83f20874c324..917bd75e4138 100644 --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -216,6 +216,7 @@ #define ABOUT_STR_DEVELOPER_ARY 1 #define ABOUT_STR_FRENCH_COPYRIGHT 2 #define ABOUT_STR_ACCEL 3 +#define ABOUT_STR_COPYRIGHT 4 #define RID_APPTITLE (RID_SFX_START+4) #define RID_BUILDVERSION (RID_SFX_START+5) diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index 7a077f1dd56f..ca30d243bbac 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -35,7 +35,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/DispatchDescriptor.hpp> #include <com/sun/star/frame/XDispatchInformationProvider.hpp> -#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XController2.hpp> #include <com/sun/star/frame/XControllerBorder.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -43,7 +43,8 @@ #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> -#include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase9.hxx> +#include <cppuhelper/basemutex.hxx> #include <osl/mutex.hxx> #include <com/sun/star/task/XStatusIndicatorSupplier.hpp> #include <com/sun/star/ui/XContextMenuInterception.hpp> @@ -67,27 +68,16 @@ #define ANY ::com::sun::star::uno::Any #define SEQUENCE ::com::sun::star::uno::Sequence #define XDISPATCH ::com::sun::star::frame::XDispatch -#define XDISPATCHPROVIDER ::com::sun::star::frame::XDispatchProvider #define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor #define XMODEL ::com::sun::star::frame::XModel #define XFRAME ::com::sun::star::frame::XFrame -#define XCONTROLLER ::com::sun::star::frame::XController -#define XCONTROLLERBORDER ::com::sun::star::frame::XControllerBorder #define XEVENTLISTENER ::com::sun::star::lang::XEventListener #define MUTEX ::osl::Mutex #define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException #define UNOTYPE ::com::sun::star::uno::Type -#define OWEAKOBJECT ::cppu::OWeakObject -#define XTYPEPROVIDER ::com::sun::star::lang::XTypeProvider #define UNOURL ::com::sun::star::util::URL #define OUSTRING ::rtl::OUString -#define XSTATUSINDICATORSUPPLIER ::com::sun::star::task::XStatusIndicatorSupplier -#define XCONTEXTMENUINTERCEPTION ::com::sun::star::ui::XContextMenuInterception #define XCONTEXTMENUINTERCEPTOR ::com::sun::star::ui::XContextMenuInterceptor -#define XUSERINPUTINTERCEPTION ::com::sun::star::awt::XUserInputInterception -#define XDISPATCHINFORMATIONPROVIDER ::com::sun::star::frame::XDispatchInformationProvider -#define XTITLE ::com::sun::star::frame::XTitle -#define XTITLECHANGEBROADCASTER ::com::sun::star::frame::XTitleChangeBroadcaster //________________________________________________________________________________________________________ // forwards @@ -95,6 +85,8 @@ struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController +class SfxViewFrame; + sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID ); sal_Bool SupportsCommandGroup( sal_Int16 nCommandGroup ); sal_Int16 MapCommandGroupToGroupID( sal_Int16 nCommandGroup ); @@ -103,36 +95,19 @@ sal_Int16 MapCommandGroupToGroupID( sal_Int16 nCommandGroup ); // class declarations //________________________________________________________________________________________________________ -struct IMPL_SfxBaseController_MutexContainer -{ - MUTEX m_aMutex ; -} ; - -/**_______________________________________________________________________________________________________ - @short - - - @descr - - - @implements - - - @base - -*/ - -// Forward to impl-baseclass! -//class IMPL_SfxBaseController ; - -class SFX2_DLLPUBLIC SfxBaseController : public XTYPEPROVIDER - , public XCONTROLLER - , public XCONTROLLERBORDER - , public XDISPATCHPROVIDER - , public XSTATUSINDICATORSUPPLIER - , public XCONTEXTMENUINTERCEPTION - , public XUSERINPUTINTERCEPTION - , public XDISPATCHINFORMATIONPROVIDER - , public XTITLE - , public XTITLECHANGEBROADCASTER - , public IMPL_SfxBaseController_MutexContainer - , public OWEAKOBJECT +typedef ::cppu::WeakImplHelper9 < ::com::sun::star::frame::XController2 + , ::com::sun::star::frame::XControllerBorder + , ::com::sun::star::frame::XDispatchProvider + , ::com::sun::star::task::XStatusIndicatorSupplier + , ::com::sun::star::ui::XContextMenuInterception + , ::com::sun::star::awt::XUserInputInterception + , ::com::sun::star::frame::XDispatchInformationProvider + , ::com::sun::star::frame::XTitle + , ::com::sun::star::frame::XTitleChangeBroadcaster + > SfxBaseController_Base; + +class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base + ,public ::cppu::BaseMutex { //________________________________________________________________________________________________________ // public methods @@ -177,93 +152,14 @@ public: SAL_DLLPRIVATE void ReleaseShell_Impl(); SAL_DLLPRIVATE void BorderWidthsChanged_Impl(); - //____________________________________________________________________________________________________ - // XInterface - //____________________________________________________________________________________________________ - - /**___________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual ANY SAL_CALL queryInterface( const UNOTYPE& rType ) throw( RUNTIMEEXCEPTION ) ; - - /**___________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw() ; - - /**___________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw() ; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) throw (::com::sun::star::uno::RuntimeException); //____________________________________________________________________________________________________ - // XTypeProvider + // XController2 //____________________________________________________________________________________________________ - - /**___________________________________________________________________________________________________ - @short get information about supported interfaces - @descr - - - @seealso XTypeProvider - - @param - - - @return Sequence of types of all supported interfaces - - @onerror A RuntimeException is thrown. - */ - - virtual SEQUENCE< UNOTYPE > SAL_CALL getTypes() throw( RUNTIMEEXCEPTION ) ; - - /**___________________________________________________________________________________________________ - @short get implementation id - @descr This ID is neccessary for UNO-caching. If there no ID, cache is disabled. - Another way, cache is enabled. - - @seealso XTypeProvider - - @param - - - @return ID as Sequence of byte - - @onerror A RuntimeException is thrown. - */ - - virtual SEQUENCE< sal_Int8 > SAL_CALL getImplementationId() throw( RUNTIMEEXCEPTION ) ; - - ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getComponentWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getViewControllerName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCreationArguments() throw (::com::sun::star::uno::RuntimeException); //____________________________________________________________________________________________________ // XController @@ -496,23 +392,23 @@ public: SAL_DLLPRIVATE BOOL HandleEvent_Impl( NotifyEvent& rEvent ); SAL_DLLPRIVATE BOOL HasKeyListeners_Impl(); SAL_DLLPRIVATE BOOL HasMouseClickListeners_Impl(); + SAL_DLLPRIVATE void SetCreationArguments_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rCreationArgs ); SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper (); //#endif +private: + enum ConnectSfxFrame + { + E_CONNECT, + E_DISCONNECT, + E_RECONNECT + }; + SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ); + SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const; //________________________________________________________________________________________________________ // private variables //________________________________________________________________________________________________________ - /** With this method you can set the flag that controlls whether the - frame is released together with a controller when the later one is - disposed. - @param bFlag - When passing <true/>, the default value of this flag, then - disposing the controller results in releasing the frame. - Passing <false/> leaves the frame unaffected. - */ - void FrameIsReleasedWithController (sal_Bool bFlag); - private: IMPL_SfxBaseController_DataContainer* m_pData ; diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 2bbf2caa9c22..578dd1fd33bb 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -43,6 +43,7 @@ #include <com/sun/star/document/XDocumentInfo.hpp> #include <com/sun/star/document/XDocumentInfoSupplier.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentRecovery.hpp> #include <com/sun/star/rdf/XDocumentMetadataAccess.hpp> @@ -55,6 +56,8 @@ #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/document/XScriptInvocationContext.hpp> #include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/NotInitializedException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/frame/DoubleInitializationException.hpp> #include <com/sun/star/util/XModifiable2.hpp> @@ -82,6 +85,8 @@ #include <cppuhelper/typeprovider.hxx> #include <com/sun/star/script/XStarBasicAccess.hpp> #include <osl/mutex.hxx> +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> #include <tools/link.hxx> @@ -91,9 +96,9 @@ #include <com/sun/star/task/XInteractionHandler.hpp> //________________________________________________________________________________________________________ -#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29) -#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29 -#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 29 +#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_30) +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_30 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 30 #include <comphelper/implbase_var.hxx> #endif @@ -196,8 +201,12 @@ class SfxPrinter; class SfxViewShell; class SfxObjectShell ; class SfxEventHint; +class SfxViewFrame; struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member of class SfxBaseModel +namespace sfx { namespace intern { + class ViewCreationGuard; +} } //________________________________________________________________________________________________________ // class declarations //________________________________________________________________________________________________________ @@ -228,10 +237,11 @@ struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member o SfxListener */ -typedef ::comphelper::WeakImplHelper29 < XCHILD +typedef ::comphelper::WeakImplHelper30 < XCHILD , XDOCUMENTINFOSUPPLIER , ::com::sun::star::document::XDocumentPropertiesSupplier , ::com::sun::star::rdf::XDocumentMetadataAccess + , ::com::sun::star::document::XDocumentRecovery , XEVENTBROADCASTER , XEVENTLISTENER , XEVENTSSUPPLIER @@ -1284,6 +1294,18 @@ public: virtual ::rtl::OUString SAL_CALL getUntitledPrefix() throw (css::uno::RuntimeException); + // css.document.XDocumentRecovery + virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave() + throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL storeToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) + throw ( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException ); + virtual void SAL_CALL recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) + throw ( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException ); + //____________________________________________________________________________________________________ // ::com::sun::star::rdf::XNode: @@ -1463,6 +1485,7 @@ public: SAL_DLLPRIVATE sal_Bool impl_isDisposed() const ; sal_Bool IsDisposed() const ; + sal_Bool IsInitialized() const; ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess > SAL_CALL getViewData() throw (::com::sun::star::uno::RuntimeException); void SAL_CALL setViewData( const ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess >& aData ) throw (::com::sun::star::uno::RuntimeException); @@ -1473,7 +1496,6 @@ public: /** returns true if someone added a XEventListener to this XEventBroadcaster */ sal_Bool hasEventListeners() const; - protected: /* returns a unique id for the model that is valid as long as the document @@ -1517,6 +1539,13 @@ private: SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper (); SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper (); + SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + ::sfx::intern::ViewCreationGuard& i_rGuard + ) const; + + SAL_DLLPRIVATE void NotifyModifyListeners_Impl() const; + //________________________________________________________________________________________________________ // private variables and methods //________________________________________________________________________________________________________ @@ -1526,9 +1555,42 @@ private: IMPL_SfxBaseModel_DataContainer* m_pData ; // cannot be held in m_pData, since it needs to be accessed in non-threadsafe context const bool m_bSupportEmbeddedScripts; + const bool m_bSupportDocRecovery; } ; // class SfxBaseModel +class SFX2_DLLPUBLIC SfxModelGuard +{ +public: + enum AllowedModelState + { + // not yet initialized + E_INITIALIZING, + // fully alive, i.e. initialized, and not yet disposed + E_FULLY_ALIVE + }; + + SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE ) + :m_aGuard( Application::GetSolarMutex() ) + { + if ( i_rModel.IsDisposed() ) + throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *&i_rModel ); + if ( ( i_eState != E_INITIALIZING ) && !i_rModel.IsInitialized() ) + throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), *&i_rModel ); + } + ~SfxModelGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + +private: + ::vos::OClearableGuard m_aGuard; +}; + #undef css #endif // _SFX_SFXBASEMODEL_HXX_ diff --git a/sfx2/inc/sfx2/sfxmodelfactory.hxx b/sfx2/inc/sfx2/sfxmodelfactory.hxx index 83e046cf8f7b..416358cb60e2 100644 --- a/sfx2/inc/sfx2/sfxmodelfactory.hxx +++ b/sfx2/inc/sfx2/sfxmodelfactory.hxx @@ -40,8 +40,10 @@ namespace sfx2 { //........................................................................ + #define SFXMODEL_STANDARD (sal_uInt64)(0x0000) #define SFXMODEL_EMBEDDED_OBJECT (sal_uInt64)(0x0001) #define SFXMODEL_DISABLE_EMBEDDED_SCRIPTS (sal_uInt64)(0x0002) + #define SFXMODEL_DISABLE_DOCUMENT_RECOVERY (sal_uInt64)(0x0004) typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ( SAL_CALL * SfxModelFactoryFunc ) ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory, diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 27e8b7b3fe65..bc4c11b53184 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -53,7 +53,6 @@ #define SID_NONE 0 #define SID_UNKNOWN SID_SFX_START -#define SID_SUBREQUEST (SID_SFX_START+90) //------------------------------------------------------------------------- @@ -83,79 +82,28 @@ #define SID_PRINTER_CHANGESTODOC (SID_SFX_START + 324) #define SID_PRINTPREVIEW (SID_SFX_START + 325) -#define SID_MAIL_DATE (SID_SFX_START + 326) -#define SID_MAIL_FROM (SID_SFX_START + 327) #define SID_MAIL_SUBJECT (SID_SFX_START + 328) -#define SID_MAIL_OPEN (SID_SFX_START + 329) #define SID_MAIL_NOTIFY (SID_SFX_START + 330) #define SID_MAIL_SENDDOC (SID_SFX_START + 331) #define SID_MAIL_SENDDOCASPDF (SID_SFX_START + 1672) - #define SID_MAIL_RECIPIENT (SID_SFX_START + 334) #define SID_MAIL_TEXT (SID_SFX_START + 335) #define SID_MAIL_ATTACH (SID_SFX_START + 336) #define SID_MAIL_PRIORITY (SID_SFX_START + 337) -#define SID_MAIL_DELETE (SID_SFX_START + 338) -#define SID_MAIL_NEW (SID_SFX_START + 339) - -#define SID_MAIL_NEWWITHSERVER (SID_SFX_START + 360) -#define SID_MAIL_REPLY (SID_SFX_START + 361) -#define SID_MAIL_FOLLOWUP (SID_SFX_START + 362) -#define SID_MAIL_FORWARD (SID_SFX_START + 363) -#define SID_MAIL_SEND (SID_SFX_START + 364) -#define SID_MAIL_FILE (SID_SFX_START + 365) -#define SID_MAIL_MARKASREAD (SID_SFX_START + 366) -#define SID_MAIL_MARKASUNREAD (SID_SFX_START + 367) -#define SID_MAIL_NEXT (SID_SFX_START + 368) -#define SID_MAIL_PREV (SID_SFX_START + 369) -#define SID_MAIL_NEXTDELETE (SID_SFX_START + 370) -#define SID_MAIL_PREVDELETE (SID_SFX_START + 371) -#define SID_MAIL_OPEN_NEWS (SID_SFX_START + 372) -#define SID_MAIL_THREAD_MARKASREAD (SID_SFX_START + 373) -#define SID_MAIL_THREAD_MARKASUNREAD (SID_SFX_START + 374) + #define SID_MAIL_ATTACH_FILE (SID_SFX_START + 375) -#define SID_MAIL_DETACH_FILE (SID_SFX_START + 376) -#define SID_MAIL_MARK (SID_SFX_START + 377) -#define SID_MAIL_TXTFORMAT (SID_SFX_START + 378) -#define SID_MAIL_UPDATETOOLBOX (SID_SFX_START + 379) - -#define SID_OPEN_ANCHOR (SID_SFX_START + 380) -#define SID_MAIL_ADDRESSBOOK (SID_SFX_START + 1644) -#define SID_MAIL_ALLNEWSGROUPS (SID_SFX_START + 382) -#define SID_MAIL_GROUPREPLY (SID_SFX_START + 383) -#define SID_MAIL_SIGNATURE (SID_SFX_START + 384) -#define SID_MAIL_PREPAREEXPORT (SID_SFX_START + 385) -#define SID_MAIL_NEXTUNREAD (SID_SFX_START + 386) -#define SID_MAIL_PREVUNREAD (SID_SFX_START + 387) + #define SID_MAIL_EXPORT_FINISHED (SID_SFX_START + 388) -#define SID_NEWSSERVER_NAME (SID_SFX_START + 389) -#define SID_NEWS_GROUP_CHANGED (SID_SFX_START + 390) -#define SID_MAILBROWSER_CTRL (SID_SFX_START + 391) -#define SID_NEWSGROUP_NAME (SID_SFX_START + 392) #define SID_WEBHTML (SID_SFX_START + 393) #define SID_MAIL_SCROLLBODY_PAGEDOWN (SID_SFX_START + 1588) -#define SID_MAIL_REPLY_FOLLOWUP (SID_SFX_START + 1635) -#define SID_PHONE_STATUSBAR_CONTROL (SID_SFX_START + 398) -#define SID_RECOGNIZER_STATUSBAR_CONTROL (SID_SFX_START + 399) #define SID_PROGRESS_STATUSBAR_CONTROL (SID_SFX_START + 1597) -#define SID_RESOURCE_WARNING (SID_SFX_START + 333) - #define SID_APPLICATION (SID_SFX_START + 340) #define SID_PROGNAME (SID_SFX_START + 341) #define SID_PROGFILENAME (SID_SFX_START + 342) -#define SID_PROGPATH (SID_SFX_START + 343) -#define SID_INTERACTIVEMODE (SID_SFX_START + 344) -#define SID_PARENTOBJECT (SID_SFX_START + 345) #define SID_SELECTION (SID_SFX_START + 346) -#define SID_CREATOR (SID_SFX_START + 347) - -#define SID_COLL_COUNT (SID_SFX_START + 350) -#define SID_COLL_ITEM (SID_SFX_START + 351) -#define SID_COLL_REMOVE (SID_SFX_START + 352) -#define SID_COLL_ADD (SID_SFX_START + 353) // 360-400 siehe SID_MAIL_... @@ -207,26 +155,14 @@ #define SID_RELOAD (SID_SFX_START + 508) #define SID_PRINTDOCDIRECT (SID_SFX_START + 509) #define SID_PICKLIST (SID_SFX_START + 510) -#define SID_EDIT_FRAMESET (SID_SFX_START + 646) -#define SID_SPLIT_HORIZONTAL (SID_SFX_START + 647) -#define SID_SPLIT_VERTICAL (SID_SFX_START + 648) -#define SID_SPLIT_PARENT_HORIZONTAL (SID_SFX_START + 649) -#define SID_SPLIT_PARENT_VERTICAL (SID_SFX_START + 650) -#define SID_MODIFY_FRAME (SID_SFX_START + 651) -#define SID_DELETE_FRAME (SID_SFX_START + 652) -#define SID_FRAME_NAME (SID_SFX_START + 825) -#define SID_FRAME_CONTENT (SID_SFX_START + 826) #define SID_PLUGIN_MODE (SID_SFX_START + 827) -#define SID_LOCKBYTES_FACTORY (SID_SFX_START + 828) #define SID_EXPORTDOC (SID_SFX_START + 829) #define SID_EXPORTDOCASPDF (SID_SFX_START + 1673) #define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674) #define SID_UPDATEDOCMODE (SID_SFX_START + 1668) -#define SID_NOCACHE (SID_SFX_START + 653) #define SID_FORCERELOAD (SID_SFX_START + 1502) #define SID_FILE_DIALOG (SID_SFX_START + 304) -#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 + 450) @@ -235,88 +171,20 @@ // browse-ids #define SID_BROWSE_FORWARD (SID_SFX_START + 1300) #define SID_BROWSE_BACKWARD (SID_SFX_START + 1301) -#define SID_BROWSE_STOP (SID_SFX_START + 1302) #define SID_BROWSE_HOME (SID_SFX_START + 1303) -#define SID_AUTOBROWSE (SID_SFX_START + 1304) -#define SID_AUTOMAIL (SID_SFX_START + 1305) -#define SID_BROWSING (SID_SFX_START + 1306) -#define SID_ADDR_BOOK (SID_SFX_START + 1307) -#define SID_EXPLORER (SID_SFX_START + 1308) #define SID_CREATELINK (SID_SFX_START + 1309) #define SID_BOOKMARK_TITLE (SID_SFX_START + 1310) #define SID_BOOKMARK_URL (SID_SFX_START + 1311) #define SID_EDITDOC (SID_SFX_START + 1312) #define SID_BROWSER_MODE (SID_SFX_START + 1313) #define SID_PLUGINS_ACTIVE (SID_SFX_START + 1314) -#define SID_SAVEDOCTOBOOKMARK (SID_SFX_START + 1315) -#define SID_CLEARMEMCACHE (SID_SFX_START + 1316) #define SID_BROWSER (SID_SFX_START + 1318) #define SID_MACROEXECMODE (SID_SFX_START + 1319) -#define SID_EXPLORERCONTENT_OPEN (SID_SFX_START + 1322) -#define SID_EXPLORERCONTENT_OPEN_DOCUMENT (SID_SFX_START + 1321) -#define SID_EXPLORERCONTENT_OPEN_TEMPLATE (SID_SFX_START + 1362) -#define SID_EXPLORERCONTENT_OPEN_FOLDER (SID_SFX_START + 1542) -#define SID_EXPLORERCONTENT_OPEN_OBJECT (SID_SFX_START + 1543) -#define SID_EXPLORERCONTENT_NEW (SID_SFX_START + 1323) -#define SID_EXPLORERCONTENT_DESTROY (SID_SFX_START + 1324) -#define SID_EXPLORERCONTENT_MAKEROOT (SID_SFX_START + 1325) -#define SID_EXPLORERCONTENT_RENAME (SID_SFX_START + 1326) -#define SID_EXPLORERCONTENT_COPY (SID_SFX_START + 1327) -#define SID_EXPLORERCONTENT_PASTE (SID_SFX_START + 1328) -#define SID_EXPLORERCONTENT_CREATELINK (SID_SFX_START + 1329) -#define SID_EXPLORERCONTENT_DEFAULTTEMPLATE (SID_SFX_START + 1330) -#define SID_EXPLORER_CREATEFOLDER (SID_SFX_START + 1331) -#define SID_EXPLORER_CREATEBOOKMARK (SID_SFX_START + 1332) -#define SID_EXPLORER_CREATEWORKPLACE (SID_SFX_START + 1333) -#define SID_EXPLORER_CREATELINK (SID_SFX_START + 1334) -#define SID_EXPLORER_CREATEMAILINTRAY (SID_SFX_START + 1335) -#define SID_EXPLORER_CREATENEWSSERVER (SID_SFX_START + 1336) -#define SID_EXPLORER_CREATEFTPSERVER (SID_SFX_START + 1337) -#define SID_EXPLORER_CREATEDATABASE (SID_SFX_START + 1338) -#define SID_EXPLORER_CREATEGALLERY (SID_SFX_START + 1339) -#define SID_PROPERTIES (SID_SFX_START + 1350) -#define SID_EXPLORER_MAKEROOT (SID_SFX_START + 1351) -#define SID_EXPLORER_MAKEBMKDIR (SID_SFX_START + 1352) -#define SID_EXPLORER_PREVLEVEL (SID_SFX_START + 1353) -#define SID_EXPLORER_IMPORTBOOKMARKS (SID_SFX_START + 1354) -#define SID_EXPLORER_SEARCHORIGINAL (SID_SFX_START + 1355) -#define SID_EXPLORER_DETAILS (SID_SFX_START + 1356) -#define SID_EXPLORER_ICONS (SID_SFX_START + 1357) -#define SID_VIEWTYPE_DETAILS (SID_SFX_START + 1358) -#define SID_EXPLORER_MSGROUP_FSYS (SID_SFX_START + 1359) -#define SID_EXPLORER_MSGROUP_NEWSARTICLE (SID_SFX_START + 1360) -#define SID_EXPLORER_MSGROUP_NEWSGROUP (SID_SFX_START + 1361) -#define SID_EXPLORER_RESETURL (SID_SFX_START + 1520) - -#define SID_EXPLORER_DOCINFO (SID_SFX_START + 1363) -#define SID_EXPLORER_PREVIEW (SID_SFX_START + 1364) -#define SID_EXPLORER_MSGROUP_FTPFILE (SID_SFX_START + 1365) -#define SID_SEARCHORIGINAL (SID_SFX_START + 1366) -#define SID_EXPLORER_MSGROUP_MAILS (SID_SFX_START + 1367) -#define SID_EXPLORER_MSGROUP_CHAOS (SID_SFX_START + 1368) // die Id steht mit diesem Wert in chaos/cntids.hrc!! //#define SID_INTERNET_ONLINE (SID_SFX_START + 1370) -#define SID_INTERNET_UPDATE (SID_SFX_START + 1371) -#define SID_INTERNET_1 (SID_SFX_START + 1372) -#define SID_INTERNET_2 (SID_SFX_START + 1373) -#define SID_INTERNET_3 (SID_SFX_START + 1374) - #define SID_FILTER_DATA (SID_SFX_START + 1375) -#define SID_EXPLORER_SEARCH_DLG (SID_SFX_START + 1380) -#define SID_EXPLORER_MULTIQUICKSEARCH (SID_SFX_START + 1522) -#define SID_EXPLORER_SHOWEXTENSION (SID_SFX_START + 1594) -#define SID_EXPLORER_MAIL_HEADER (SID_SFX_START + 1595) -#define SID_EXPLORER_MAIL_BODY (SID_SFX_START + 1596) - -#define SID_TABPAGE (SID_SFX_START + 1383) -//#define SID_EXPLORER_CREATESEARCHFOLDER (SID_SFX_START + 1384) -#define SID_EMPTY_TRASH (SID_SFX_START + 1385) -#define SID_AFTEROPENEVENT (SID_SFX_START + 1386) -#define SID_QUERYICON (SID_SFX_START + 1387) -#define SID_SYNCEXPLORER (SID_SFX_START + 1388) -#define SID_EXPLORER_PASTE_ASLINK (SID_SFX_START + 1389) #define SID_EXPLORER_FILEPROPS_START (SID_SFX_START + 1390) #define SID_EXPLORER_FILEPROPS_END (SID_SFX_START + 1399) @@ -324,73 +192,22 @@ #define ID_FILETP_START SID_EXPLORER_FILEPROPS_START #define ID_FILETP_READONLY (ID_FILETP_START + 0) #define ID_FILETP_TITLE (ID_FILETP_START + 1) -#define ID_FILETP_SIZE (ID_FILETP_START + 2) -#define ID_FILETP_TYPE (ID_FILETP_START + 3) -#define ID_FILETP_PATH (ID_FILETP_START + 4) -#define ID_FILETP_CREATED (ID_FILETP_START + 5) -#define ID_FILETP_CHANGED (ID_FILETP_START + 6) -#define ID_FILETP_EDIT (ID_FILETP_START + 7) -#define ID_FILETP_IMAGE (ID_FILETP_START + 8) -#define ID_FILETP_LINK (ID_FILETP_START + 9) -#define ID_FILETP_END (ID_FILETP_START + 9) - -#define SID_NEWFRAMESET (SID_SFX_START + 1400) #define SID_EXPLORER_PROPS_START (SID_SFX_START + 1410) #define SID_EXPLORER_PROPS_END (SID_SFX_START + 1499) - - -#define SID_TRASH_RECOVER (SID_SFX_START + 1502) -#define SID_TRASH_AUTOEMPTY (SID_SFX_START + 1503) -#define SID_TRASH_EMPTY (SID_SFX_START + 1504) -#define SID_EXPLORER_BOOKMARKDIR (SID_SFX_START + 1505) -#define SID_EXPLORER_SEARCHORIG (SID_SFX_START + 1506) -#define SID_FRAMESPACING (SID_SFX_START + 1507) -#define SID_LATEINIT_DONE (SID_SFX_START + 1508) #define SID_AUTOLOAD (SID_SFX_START + 1509) -#define SID_FRAMECOUNT (SID_SFX_START + 1510) -#define SID_ISTOP (SID_SFX_START + 1511) -#define SID_VIEW (SID_SFX_START + 1512) -#define SID_ORIG_PROPERTIES (SID_SFX_START + 1513) -#define SID_MAIL_NOTIFY_RESET (SID_SFX_START + 1514) #define SID_FILLFRAME (SID_SFX_START + 1516) -#define SID_LOAD_LIBRARY (SID_SFX_START + 1517) #define SID_BASEURL (SID_SFX_START + 1518) #define SID_TEMPLATE (SID_SFX_START + 1519) -#define SID_UNLOAD_LIBRARY (SID_SFX_START + 1523) -#define SID_ADD_LIBRARY (SID_SFX_START + 1524) -#define SID_REMOVE_LIBRARY (SID_SFX_START + 1525) -#define SID_CLASSNAME (SID_SFX_START + 1526) -#define SID_INTERCEPTOR (SID_SFX_START + 1527) -#define SID_TARGETPATH (SID_SFX_START + 1528) - -#define SID_START (SID_SFX_START + 1529) -#define SID_STOP (SID_SFX_START + 1530) -#define SID_VALUE (SID_SFX_START + 1531) -#define SID_SUSPEND (SID_SFX_START + 1532) -#define SID_RESUME (SID_SFX_START + 1533) -#define SID_LOCKALL (SID_SFX_START + 1534) -#define SID_WAITPOINTER (SID_SFX_START + 1535) - #define SID_ONLINE_REGISTRATION (SID_SFX_START + 1537) #define SID_ONLINE_REGISTRATION_DLG (SID_SFX_START + 1540) #define SID_CONTENTTYPE (SID_SFX_START + 1541) -#define SID_DOC_IGNOREINFORMATIONLOST (SID_SFX_START + 1544) -#define SID_EXPLORER_SELECTIONSIZE (SID_SFX_START + 1545) #define SID_SAVETO (SID_SFX_START + 1546) -#define SID_ADJUSTICONS (SID_SFX_START + 1547) -#define SID_AUTO_ADJUSTICONS (SID_SFX_START + 1548) -#define SID_ICONGRID (SID_SFX_START + 1549) -#define SID_BINDING (SID_SFX_START + 1550) - -#define SID_ISCHILDFRAMELOAD (SID_SFX_START + 1552) -#define SID_PARENTFRAME (SID_SFX_START + 1554) - #define SID_CREATE_BASICOBJECT (SID_SFX_START + 1555) #define SID_DELETE_BASICOBJECT (SID_SFX_START + 1556) @@ -399,27 +216,11 @@ #define SID_UPDATE_VERSION (SID_SFX_START + 1568) #define SID_BUILD_VERSION (SID_SFX_START + 1569) -#define SID_INSERT_TASKFRAME (SID_SFX_START + 1572) -#define SID_TASK (SID_SFX_START + 1573) -#define SID_ACTIVETASK (SID_SFX_START + 1574) -#define SID_EXPLORER_ISDESKTOP (SID_SFX_START + 1576) - -#define SID_CHAOSDOC_LAYOUT1 (SID_SFX_START + 1578) -#define SID_CHAOSDOC_LAYOUT2 (SID_SFX_START + 1579) -#define SID_CHAOSDOC_LAYOUT3 (SID_SFX_START + 1580) -#define SID_CHAOSDOC_LAYOUT4 (SID_SFX_START + 1581) - #define SID_VERSION (SID_SFX_START + 1583) -#define SID_UNO (SID_SFX_START + 1584) #define SID_DOCUMENT_COMPARE (SID_SFX_START + 1586) #define SID_DOCUMENT_MERGE (SID_SFX_START + 1587) -#define SID_EXECUTE (SID_SFX_START + 1593) -#define SID_OWNS_FRAME (SID_SFX_START + 1598) - -#define SID_OFFICE_VERSION_ID (SID_SFX_START + 1599) -#define SID_USE_FILTEROPTIONS (SID_SFX_START + 1600) #define SID_OFFICE_PLK (SID_SFX_START + 1601) #define SID_OFFICE_PALK (SID_SFX_START + 1604) #define SID_CHECK_KEY (SID_SFX_START + 1605) @@ -452,7 +253,7 @@ #define SID_LOGOUT (SID_SFX_START + 1652) #define SID_JUMPMARK (SID_SFX_START + 1654) #define SID_BROWSE (SID_SFX_START + 1658) -#define SID_BACKTOWEBTOP (SID_SFX_START + 1657) + // FREE (was: SID_BACKTOWEBTOP) #define SID_SEGMENTSIZE (SID_SFX_START + 1659) #define SID_VIEW_DATA_SOURCE_BROWSER (SID_SFX_START + 1660) #define SID_TOGGLE_MENUBAR (SID_SFX_START + 1661) @@ -509,10 +310,10 @@ #define SID_SFX_free_END (SID_SFX_START + 3999) #define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) -#define SID_VIEW_ZOOM_MODE (SID_SFX_START + 521) -#define SID_VIEW_POS_SIZE (SID_SFX_START + 522) + // FREE, was SID_VIEW_ZOOM_MODE + // FREE, was SID_VIEW_POS_SIZE #define SID_VIEW_ID (SID_SFX_START + 523) -#define SID_USER_DATA (SID_SFX_START + 524) + // FREE, was SID_USER_DATA #define SID_VIEW_DATA (SID_SFX_START + 1582) #define SID_SILENT (SID_SFX_START + 528) #define SID_HIDDEN (SID_SFX_START + 534) @@ -663,7 +464,7 @@ #define SID_WIN_MINIMIZED (SID_SFX_START + 625) #define SID_WIN_MAXIMIZED (SID_SFX_START + 626) #define SID_WIN_FULLSCREEN (SID_SFX_START + 627) -#define SID_WIN_POSSIZE (SID_SFX_START + 628) + // FREE, was SID_WIN_POSSIZE #define SID_WIN_VISIBLE (SID_SFX_START + 629) #define SID_VIEWSHELL0 (SID_SFX_START + 630) @@ -932,7 +733,7 @@ #define SID_ATTR_AUTOSAVEMINUTE (SID_OPTIONS_START + 5) #define SID_ATTR_WORKINGSET (SID_OPTIONS_START + 13) #define SID_ATTR_UNDO_COUNT (SID_OPTIONS_START + 16) -#define SID_ATTR_SAVEDOCWINS (SID_OPTIONS_START + 17) + // unused #define SID_ATTR_SAVEDOCVIEW (SID_OPTIONS_START + 18) // GeneralTabPage diff --git a/sfx2/inc/sfx2/shell.hxx b/sfx2/inc/sfx2/shell.hxx index 766f192c071c..314c16fdbf1f 100644 --- a/sfx2/inc/sfx2/shell.hxx +++ b/sfx2/inc/sfx2/shell.hxx @@ -86,7 +86,6 @@ enum SfxInterfaceId SFX_INTERFACE_NONE, SFX_INTERFACE_SFXAPP, SFX_INTERFACE_SFXDOCSH, - SFX_INTERFACE_SFXTOPFRM, SFX_INTERFACE_SFXIPFRM, SFX_INTERFACE_SFXVIEWSH, SFX_INTERFACE_SFXVIEWFRM, diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx deleted file mode 100644 index a84f90481cab..000000000000 --- a/sfx2/inc/sfx2/topfrm.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_TOPFRM_HXX -#define _SFX_TOPFRM_HXX - -#include "sal/config.h" -#include "sfx2/dllapi.h" -#include "sal/types.h" -#include <com/sun/star/uno/Reference.h> -#include <vcl/dockwin.hxx> -#include <vcl/wrkwin.hxx> - -#include <sfx2/frame.hxx> -#include <sfx2/viewfrm.hxx> - -class SfxViewShell; -class SfxTopFrame; -class SfxTopFrame_Impl; -namespace svtools { class AsynchronLink; } - -// class SfxTopFrame ----------------------------------------------------- - -class SFX2_DLLPUBLIC SfxTopFrame : public SfxFrame -{ -friend class SfxTopWindow_Impl; -friend class SfxTopFrameWindow_Impl; -friend class SfxTopFrame_Impl; - - SfxTopFrame_Impl* pImp; - Window* pWindow; - SAL_DLLPRIVATE SfxTopFrame( Window* pWindow=NULL, sal_Bool bHidden = sal_False ); - SAL_DLLPRIVATE virtual ~SfxTopFrame(); -public: - TYPEINFO(); - - static SfxTopFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); - static SfxTopFrame* Create( SfxObjectShell* pDoc=0, USHORT nViewId=0, BOOL bHidden=sal_False, const SfxItemSet* pSet=NULL ); - static SfxTopFrame* Create( SfxObjectShell* pDoc, Window* pWindow, USHORT nViewId=0, BOOL bHidden=sal_False, const SfxItemSet* pSet=NULL ); - - virtual Window& GetWindow() const; - virtual BOOL Close(); - virtual BOOL InsertDocument( SfxObjectShell *pDoc ); - String GetWindowData(); - - void SetPresentationMode( BOOL bSet ); - SystemWindow* GetSystemWindow() const; - -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); - SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); - SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; - SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell *pDoc, USHORT nViewId=0 ); - SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; - SAL_DLLPRIVATE void CheckMenuCloser_Impl( MenuBar* pMenubar ); -//#endif -}; - -// class SfxTopViewFrame ------------------------------------------------- - -class SfxTopViewFrame_Impl; -class SFX2_DLLPUBLIC SfxTopViewFrame : public SfxViewFrame -{ -friend class SfxTopWindow_Impl; -friend class SfxTopViewFrame_Impl; - - SfxTopViewFrame_Impl* pImp; - svtools::AsynchronLink* pCloser; - -protected: - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - virtual void Activate( BOOL bUI ); - virtual void Deactivate( BOOL bUI ); - virtual BOOL Close(); - virtual ~SfxTopViewFrame(); - -public: - TYPEINFO(); - SFX_DECL_INTERFACE(SFX_INTERFACE_SFXTOPFRM) - - SfxTopViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc=NULL, USHORT nViewId=0 ); - - virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); - SAL_DLLPRIVATE virtual BOOL SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); - virtual String UpdateTitle(); - -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void Exec_Impl(SfxRequest &); - SAL_DLLPRIVATE void GetState_Impl(SfxItemSet &); - SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); - SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); - SAL_DLLPRIVATE SfxTopFrame* GetTopFrame_Impl() - { return (SfxTopFrame*) GetFrame(); } -//#endif -}; - -#endif // #ifndef _SFX_TOPFRM_HXX - diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 4fb7a8e94abc..8350bc5f0f9d 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -38,6 +38,7 @@ #include <svl/poolitem.hxx> #include <com/sun/star/frame/status/Verb.hpp> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XController2.hpp> class SfxMacro; class SvBorder; @@ -48,7 +49,6 @@ class SfxProgress; class SvData; class SfxViewShell; class SvPseudoObject; -class SfxCancelManager; class SystemWindow; class Fraction; class Point; @@ -59,6 +59,10 @@ namespace sfx2 { class SvLinkSource; } +namespace svtools +{ + class AsynchronLink; +} #ifndef SFX_DECL_OBJECTSHELL_DEFINED #define SFX_DECL_OBJECTSHELL_DEFINED @@ -127,6 +131,7 @@ Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder ); Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder ); +DBG_NAMEEX(SfxViewFrame) class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener { struct SfxViewFrame_Impl* pImp; @@ -144,39 +149,32 @@ private: protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - SAL_DLLPRIVATE void SetWindow_Impl( Window *pWin ); - #ifndef _SFX_HXX - SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); SAL_DLLPRIVATE void KillDispatcher_Impl(); #endif virtual ~SfxViewFrame(); public: + SfxViewFrame( SfxFrame& rFrame, SfxObjectShell *pDoc = NULL ); + TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) - SfxViewFrame( SfxBindings&, SfxFrame*, SfxObjectShell *pDoc=0, sal_uInt32 nType = 0 ); - SfxViewFrame(SfxObjectShell&, SfxBindings&, SfxFrame*p=0, sal_uInt32 nType = 0); - SfxViewFrame( - const SfxViewFrame &, SfxBindings &, SfxFrame *pFrame); - - static SfxViewFrame* SearchViewFrame( SfxViewFrame*, const String& ); static void SetViewFrame( SfxViewFrame* ); - static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, - USHORT nViewId=0, - BOOL bHidden=FALSE ); + + static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); + static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrameItem, const USHORT i_nViewId = 0 ); + static SfxViewFrame* DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const USHORT i_nViewId = 0 ); static SfxViewFrame* Current(); - static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, - TypeId aType = 0, - BOOL bOnlyVisible = TRUE ); - static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, - const SfxObjectShell* pDoc = 0, - TypeId aType = 0 , - BOOL bOnlyVisible = TRUE ); - static USHORT Count(TypeId = 0); + static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); + static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); + static USHORT Count(); + + static SfxViewFrame* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController, const SfxObjectShell* i_pDoc = NULL ); void DoActivate(BOOL bMDI, SfxViewFrame *pOld=NULL); void DoDeactivate(BOOL bMDI, SfxViewFrame *pOld=NULL); @@ -188,8 +186,7 @@ public: SfxBindings& GetBindings() { return *pBindings; } const SfxBindings& GetBindings() const { return *pBindings; } Window& GetWindow() const; - virtual void SetZoomFactor( const Fraction &rZoomX, - const Fraction &rZoomY ) = 0; + virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); SfxProgress* GetProgress() const; #ifdef ENABLE_INIMANAGER//MUSTINI @@ -213,6 +210,8 @@ public: void ToTop(); void Enable( BOOL bEnable ); virtual BOOL Close(); + virtual void Activate( BOOL bUI ); + virtual void Deactivate( BOOL bUI ); // DDE-Interface virtual long DdeExecute( const String& rCmd ); @@ -224,10 +223,10 @@ public: const ::com::sun::star::uno::Any & rValue ); virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); - virtual void ShowStatusText( const String& rText ); - virtual void HideStatusText(); + void ShowStatusText( const String& rText ); + void HideStatusText(); - virtual String UpdateTitle(); + String UpdateTitle(); // interne Handler SAL_DLLPRIVATE virtual BOOL SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); @@ -236,21 +235,18 @@ public: virtual SfxObjectShell* GetObjectShell(); USHORT GetCurViewId() const; - SfxFrame* GetFrame() const; + SfxFrame& GetFrame() const; SfxViewFrame* GetTopViewFrame() const; BOOL DoClose(); ULONG GetFrameType() const - { return GetFrame()->GetFrameType(); } - SfxFrame* GetTopFrame() const - { return GetFrame()->GetTopFrame(); } - SfxFrame* SearchFrame( const String& rName, SfxMedium* pMedium = 0) - { return GetFrame()->SearchFrame( rName, pMedium ); } + { return GetFrame().GetFrameType(); } + SfxFrame& GetTopFrame() const + { return GetFrame().GetTopFrame(); } void GetTargetList( TargetList& rList ) const - { GetFrame()->GetTargetList( rList ); } + { GetFrame().GetTargetList( rList ); } void CancelTransfers() - { GetFrame()->CancelTransfers(); } - SfxCancelManager* GetCancelManager() const; + { GetFrame().CancelTransfers(); } void SetModalMode( BOOL ); BOOL IsInModalMode() const; @@ -267,19 +263,11 @@ public: void ChildWindowState(SfxItemSet&); //#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE SfxMacro* GetRecordingMacro_Impl(); - SAL_DLLPRIVATE void SetFrame_Impl( SfxFrame* ); SAL_DLLPRIVATE void SetDowning_Impl(); SAL_DLLPRIVATE void GetDocNumber_Impl(); SAL_DLLPRIVATE BOOL IsDowning_Impl() const; - SAL_DLLPRIVATE void SetSetViewFrameAllowed_Impl( BOOL bSet ); - SAL_DLLPRIVATE BOOL IsSetViewFrameAllowed_Impl() const; - SAL_DLLPRIVATE void SetImportingObjectShell_Impl( SfxObjectShell* pSH ); - SAL_DLLPRIVATE SfxObjectShell* GetImportingObjectShell_Impl( ) const; SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh ); - SAL_DLLPRIVATE void SetObjectShell_Impl( SfxObjectShell& rObjSh , - FASTBOOL bDefaultView = FALSE ); - SAL_DLLPRIVATE void ReleaseObjectShell_Impl( BOOL bStoreView = FALSE ); + SAL_DLLPRIVATE void ReleaseObjectShell_Impl(); SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet ); SAL_DLLPRIVATE void ExecReload_Impl( SfxRequest &rReq ); @@ -287,10 +275,8 @@ public: SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet ); SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq ); SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet ); - SAL_DLLPRIVATE void PropState_Impl( SfxItemSet &rSet ); SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq ); SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet ); - SAL_DLLPRIVATE void SetParentViewFrame_Impl(SfxViewFrame *pParentFrame); SAL_DLLPRIVATE SfxViewFrame* GetParentViewFrame_Impl() const; SAL_DLLPRIVATE void ForceOuterResize_Impl(BOOL bOn=TRUE); SAL_DLLPRIVATE BOOL IsResizeInToOut_Impl() const; @@ -301,25 +287,75 @@ public: SAL_DLLPRIVATE void LockObjectShell_Impl(BOOL bLock=TRUE); - SAL_DLLPRIVATE SfxViewShell* CreateView_Impl( USHORT nViewId ); SAL_DLLPRIVATE void MakeActive_Impl( BOOL bActivate ); SAL_DLLPRIVATE void SetQuietMode_Impl( BOOL ); SAL_DLLPRIVATE const Size& GetMargin_Impl() const; - SAL_DLLPRIVATE void SetMargin_Impl( const Size& ); SAL_DLLPRIVATE void SetActiveChildFrame_Impl( SfxViewFrame* ); SAL_DLLPRIVATE SfxViewFrame* GetActiveChildFrame_Impl() const; - SAL_DLLPRIVATE BOOL IsRestoreView_Impl() const; - SAL_DLLPRIVATE void SetRestoreView_Impl( BOOL ); - SAL_DLLPRIVATE void SetViewData_Impl( USHORT, const String& ); - SAL_DLLPRIVATE String& GetViewData_Impl(); SAL_DLLPRIVATE String GetActualPresentationURL_Impl() const; SAL_DLLPRIVATE static void CloseHiddenFrames_Impl(); SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( USHORT nId ); SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const ::rtl::OUString& sMacro); - SAL_DLLPRIVATE BOOL ClearEventFlag_Impl(); + + SAL_DLLPRIVATE void Exec_Impl(SfxRequest &); + SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); + SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); + + SAL_DLLPRIVATE void SetCurViewId_Impl( const USHORT i_nID ); + //#endif +private: + SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); + SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); + + /** loads the given existing document into the given frame + + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. + + @param i_rDoc + the document to load + @param i_rFrame + the frame to load the document into + @param i_rLoadArgs + the arguments to pass to the component loader. If this sequence is empty, then the current arguments of the + model will be obtained, and passed to the loader. This ensures that any arguments in the model will be preserved, + instead of being reset. + @param i_nViewId + the ID of the view to create + @throws Exception + if something goes wrong. The caller is responsible for handling this. + */ + SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl( + const SfxObjectShell& i_rDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs, + const USHORT i_nViewId, + const bool i_bHidden + ); + + /** loads the given existing document into the given frame + + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. + + If no frame is given, a blank top level frame is created. + + If anything fails during the process, as much as possible is cleaned up. + + @param i_rDoc + the document to load + @param i_rFrame + the frame to load the document into. Might be <NULL/>, in which case a new frame is created. + @param i_nViewId + the ID of the view to create + */ + SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow( + const SfxObjectShell& i_rDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const USHORT i_nViewId, + const bool i_bHidden + ); }; //-------------------------------------------------------------------- diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 7d6b1693d977..0109bbbf602d 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -96,24 +96,12 @@ enum SfxScrollingMode // @[SfxViewShell-Flags] -#define SFX_VIEW_MAXIMIZE_FIRST 0x0001 /* die erste View wird maximiert - dargestellt */ -#define SFX_VIEW_OPTIMIZE_EACH 0x0002 /* jede View wird in optimaler - Gr"o\se dargestellt */ -#define SFX_VIEW_DISABLE_ACCELS 0x0004 /* die Acceleratoren werden - disabled, solange diese - View den Focus hat */ -#define SFX_VIEW_OBJECTSIZE_EMBEDDED 0x0008 /* Views von embedded Objekten - werden in optimaler Gr"o\se - dargestellt */ #define SFX_VIEW_HAS_PRINTOPTIONS 0x0010 /* Options-Button und Options- Dialog im PrintDialog */ #define SFX_VIEW_CAN_PRINT 0x0020 /* enabled Printing ohne Printer erzeugen zu m"ussen */ #define SFX_VIEW_NO_SHOW 0x0040 /* Window der ViewShell darf nicht automatisch geshowed werden */ -#define SFX_VIEW_IMPLEMENTED_AS_FRAMESET 0x0080 /* Das Dokument ist als - Frameset implementiert*/ #define SFX_VIEW_NO_NEWWINDOW 0x0100 /* keine weitere View erlauben */ /* [Beschreibung] @@ -159,11 +147,7 @@ class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener { #ifdef _SFXVIEWSH_HXX friend class SfxViewFrame; -friend class SfxTopViewFrame; friend class SfxPlugInFrame; -friend class SfxInternalFrame; -friend class SfxExternalTopViewFrame_Impl; -friend class SfxOfficeDocController; friend class SfxBaseController; #endif @@ -172,8 +156,6 @@ friend class SfxBaseController; SfxViewFrame* pFrame; SfxShell* pSubShell; Window* pWindow; - BOOL bMaximizeFirst; - BOOL bOptimizeEach; BOOL bNoNewWindow; protected: @@ -197,6 +179,8 @@ public: const TypeId* pType = 0, BOOL bOnlyVisible = TRUE ); static SfxViewShell* Current(); + static SfxViewShell* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController ); + // Ctoren/Dtoren Initialisierung TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWSH) @@ -224,9 +208,6 @@ public: void VisAreaChanged(const Rectangle& rRect); // Verhaltens-Flags - BOOL IsMaximizeFirst() const { return bMaximizeFirst; } - BOOL IsOptimizeEach() const { return bOptimizeEach; } - HACK(inline) BOOL UseObjectSize() const; SfxScrollingMode GetScrollingMode() const; void SetScrollingMode( SfxScrollingMode eMode ); @@ -319,7 +300,6 @@ public: SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); SAL_DLLPRIVATE FASTBOOL GlobalKeyInput_Impl( const KeyEvent &rKeyEvent ); - SAL_DLLPRIVATE BOOL IsImplementedAsFrameset_Impl() const; SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient ) { GetIPClientList_Impl(TRUE)->Insert(pIPClient); } @@ -337,6 +317,8 @@ public: SAL_DLLPRIVATE BOOL HasKeyListeners_Impl(); SAL_DLLPRIVATE BOOL HasMouseClickListeners_Impl(); + SAL_DLLPRIVATE SfxBaseController* GetBaseController_Impl() const; + // Shell Interface SAL_DLLPRIVATE void ExecPrint_Impl(SfxRequest &); SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &); @@ -345,11 +327,11 @@ public: SAL_DLLPRIVATE void SetFrameSet_Impl(SfxFrameSetDescriptor*); SAL_DLLPRIVATE void CheckIPClient_Impl( SfxInPlaceClient*, const Rectangle& ); SAL_DLLPRIVATE void PushSubShells_Impl( BOOL bPush=TRUE ); + SAL_DLLPRIVATE void PopSubShells_Impl() { PushSubShells_Impl( FALSE ); } SAL_DLLPRIVATE void TakeOwnerShip_Impl(); SAL_DLLPRIVATE void CheckOwnerShip_Impl(); SAL_DLLPRIVATE void TakeFrameOwnerShip_Impl(); SAL_DLLPRIVATE BOOL ExecKey_Impl(const KeyEvent& aKey); - #endif }; diff --git a/sfx2/inc/viewfac.hxx b/sfx2/inc/viewfac.hxx index d20ed788e739..6f9ae1d3cb37 100644 --- a/sfx2/inc/viewfac.hxx +++ b/sfx2/inc/viewfac.hxx @@ -56,6 +56,9 @@ public: { return String( aDescription ); } USHORT GetOrdinal() const { return nOrd; } + /// returns an API-compatible view name. For the moment, this is "view" with an appended ordinal/ID + String GetViewName() const; + private: SfxViewCtor fnCreate; SfxViewInit fnInit; diff --git a/sfx2/qa/complex/DocumentMetaData.java b/sfx2/qa/complex/DocumentMetaData.java index 6470b563bbda..ae7970227c75 100644 --- a/sfx2/qa/complex/DocumentMetaData.java +++ b/sfx2/qa/complex/DocumentMetaData.java @@ -367,7 +367,7 @@ public class DocumentMetaData extends ComplexTestCase dur.Hours = 777; dur.Minutes = 666; dur.Seconds = 555; - dur.HundredthSeconds = 444; + dur.MilliSeconds = 444; udpc.addProperty("Frobnicate", PropertyAttribute.REMOVEABLE, new Boolean(b)); @@ -444,7 +444,11 @@ public class DocumentMetaData extends ComplexTestCase udps.getPropertyValue("Frobnicate"))); assure ("UserDefined duration", eqDuration(dur, (Duration) udps.getPropertyValue("FrobDuration"))); - assure ("UserDefined time", eqTime(t, (Time) + // this is now a Duration! + Duration t_dur = new Duration(false, (short)0, (short)0, (short)0, + t.Hours, t.Minutes, t.Seconds, + (short)(10 * t.HundredthSeconds)); + assure ("UserDefined time", eqDuration(t_dur, (Duration) udps.getPropertyValue("FrobDuration2"))); assure ("UserDefined date", eqDate(date, (Date) udps.getPropertyValue("FrobEndDate"))); @@ -511,7 +515,7 @@ public class DocumentMetaData extends ComplexTestCase return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days && a.Hours == b.Hours && a.Minutes == b.Minutes && a.Seconds == b.Seconds - && a.HundredthSeconds == b.HundredthSeconds + && a.MilliSeconds == b.MilliSeconds && a.Negative == b.Negative; } diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 3c6dae423b9f..c4210b801bf6 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -396,21 +396,11 @@ interface TopWindow : BrowseWindow [ StateMethod = StateView_Impl ; ] - SID_WIN_POSSIZE // ole(no) api(final/play/rec) - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] SID_CLOSEWIN // ole(no) api(final/play/rec) [ ExecMethod = Exec_Impl ; StateMethod = GetState_Impl ; ] - SID_BACKTOWEBTOP // ole(no) api(final/play/rec) - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] SID_BROWSE_FORWARD // ole(no) api() [ ExecMethod = INetExecute_Impl ; @@ -431,23 +421,29 @@ interface TopWindow : BrowseWindow ExecMethod = INetExecute_Impl ; StateMethod = INetState_Impl ; ] - SID_BROWSE_STOP // ole(no) api() - [ - ExecMethod = INetExecute_Impl ; - StateMethod = INetState_Impl ; - ] - } //========================================================================= shell SfxViewFrame { - import BrowseWindow [Automation]; + import TopWindow [Automation]; SID_FORMATMENUSTATE [ StateMethod = MiscState_Impl ; ] + + SID_ACTIVATE // ole(no) api(final/play/rec) + [ + ExecMethod = Exec_Impl ; + StateMethod = GetState_Impl ; + ] + + SID_SHOWPOPUPS + [ + ExecMethod = Exec_Impl ; + StateMethod = GetState_Impl ; + ] } diff --git a/sfx2/sdi/makefile.mk b/sfx2/sdi/makefile.mk index 800a48d7f608..c02e51eb6998 100644 --- a/sfx2/sdi/makefile.mk +++ b/sfx2/sdi/makefile.mk @@ -50,7 +50,6 @@ SVSDI1DEPEND= \ appslots.sdi \ sfxslots.sdi \ docslots.sdi \ - mdislots.sdi \ viwslots.sdi \ frmslots.sdi diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index e13b26485ee2..10a920852848 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -396,33 +396,6 @@ SfxVoidItem AddWatch SID_BASICIDE_ADDWATCH ] //-------------------------------------------------------------------------- -SfxRectangleItem Area SID_WIN_POSSIZE - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - -//-------------------------------------------------------------------------- SfxStringItem Author SID_DOCINFO_AUTHOR [ @@ -558,31 +531,6 @@ SfxVoidItem Backspace SID_BACKSPACE ] //-------------------------------------------------------------------------- -SfxVoidItem BackToWebtop SID_BACKTOWEBTOP -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- SfxVoidItem BasicBreak SID_BASICBREAK () [ @@ -898,34 +846,6 @@ SfxUInt32Item BuildVersion SID_BUILD_VERSION ] //-------------------------------------------------------------------------- -SfxVoidItem Stop SID_BROWSE_STOP -() -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* status: */ - SlotType = SfxBoolItem - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_NAVIGATOR; -] - -//-------------------------------------------------------------------------- SfxStringItem Caption SID_CAPTION [ @@ -1057,31 +977,6 @@ SfxVoidItem ClearHistory SID_CLEARHISTORY ] //-------------------------------------------------------------------------- -SfxVoidItem ClearMemCache SID_CLEARMEMCACHE -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_OPTIONS; -] - -//-------------------------------------------------------------------------- SfxBoolItem CloseWins SID_CLOSEWINS () [ @@ -1676,31 +1571,6 @@ SfxVoidItem DeleteCurrent SID_BASICIDE_DELETECURRENT ] //-------------------------------------------------------------------------- -SfxVoidItem DeleteFrame SID_DELETE_FRAME -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- SfxUInt16Item DeleteStyle SID_STYLE_DELETE (SfxStringItem Param SID_STYLE_DELETE,SfxUInt16Item Family SID_STYLE_FAMILY) [ @@ -1804,33 +1674,6 @@ SfxBoolItem EditDoc SID_EDITDOC ] //-------------------------------------------------------------------------- -SfxBoolItem EditFrameSet SID_EDIT_FRAMESET - -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- SfxVoidItem EditMacro SID_BASICIDE_EDITMACRO (SfxMacroInfoItem aMacroInfo SID_BASICIDE_ARG_MACROINFO) [ @@ -1934,31 +1777,6 @@ SfxBoolItem ExtendedHelp SID_EXTENDEDHELP ] //-------------------------------------------------------------------------- -SfxVoidItem FileDocument SID_SAVEDOCTOBOOKMARK -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_DOCUMENT; -] - -//-------------------------------------------------------------------------- SfxStringItem FileName SID_FILE_NAME [ @@ -2039,114 +1857,6 @@ SfxVoidItem FormatMenu SID_FORMATMENU ] //-------------------------------------------------------------------------- -SfxStringItem FrameContent SID_FRAME_CONTENT - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = TRUE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxUInt16Item FrameCount SID_FRAMECOUNT - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - -//-------------------------------------------------------------------------- -SfxStringItem FrameName SID_FRAME_NAME - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = TRUE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxUInt16Item FrameSpacing SID_FRAMESPACING - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- SfxTemplateItem FrameStyle SID_STYLE_FAMILY3 [ @@ -3301,33 +3011,6 @@ SfxVoidItem InsertObjectFloatingFrame SID_INSERT_FLOATINGFRAME ] //-------------------------------------------------------------------------- -SfxBoolItem Interactive SID_INTERACTIVEMODE - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - -//-------------------------------------------------------------------------- SfxBoolItem InternetOnline SID_INTERNET_ONLINE [ @@ -3380,31 +3063,6 @@ SfxVoidItem InternetSearch SID_INTERNET_SEARCH ] //-------------------------------------------------------------------------- -SfxVoidItem InternetUpdate SID_INTERNET_UPDATE -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = TRUE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - -//-------------------------------------------------------------------------- SfxBoolItem IsLoading SID_DOC_LOADING [ @@ -3487,33 +3145,6 @@ SfxBoolItem IsPrinting SID_PRINTOUT ] //-------------------------------------------------------------------------- -SfxBoolItem IsTopWindow SID_ISTOP - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - -//-------------------------------------------------------------------------- SfxVoidItem JumpToMark SID_JUMPTOMARK (SfxStringItem Bookmark SID_JUMPTOMARK) [ @@ -3566,33 +3197,6 @@ SfxStringItem Keywords SID_DOCINFO_KEYWORDS ] //-------------------------------------------------------------------------- -SfxBoolItem LateInitDone SID_LATEINIT_DONE - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_APPLICATION; -] - -//-------------------------------------------------------------------------- SfxStringItem LibLoaded SID_BASICIDE_LIBLOADED (SfxUsrAnyItem Document SID_BASICIDE_ARG_DOCUMENT_MODEL,SfxStringItem LibName SID_BASICIDE_ARG_LIBNAME) [ @@ -4040,32 +3644,6 @@ SfxVoidItem MacroDialog SID_BASICCHOOSER ] //-------------------------------------------------------------------------- -SfxVoidItem MailNotifyReset SID_MAIL_NOTIFY_RESET -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = TRUE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - - -//-------------------------------------------------------------------------- SfxUInt16Item MailReceipt SID_MAIL_NOTIFY [ @@ -4278,31 +3856,6 @@ SfxStringItem ModifiedStatus SID_DOC_MODIFIED ] //-------------------------------------------------------------------------- -SfxVoidItem ModifyFrame SID_MODIFY_FRAME -() -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = TRUE, - RecordPerItem; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- SfxVoidItem ModuleDialog SID_BASICIDE_MODULEDLG () [ @@ -4431,34 +3984,6 @@ SfxVoidItem NewDialog SID_BASICIDE_NEWDIALOG ] //-------------------------------------------------------------------------- -SfxObjectItem NewFrameSet SID_NEWFRAMESET -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* status: */ - SlotType = SfxStringItem - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_APPLICATION; -] - -//-------------------------------------------------------------------------- SfxVoidItem NewModule SID_BASICIDE_NEWMODULE () [ @@ -4611,33 +4136,6 @@ SfxStringItem ObjectMenue SID_OBJECT ] //-------------------------------------------------------------------------- -SfxStringItem OfficeVersionId SID_OFFICE_VERSION_ID - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_SPECIAL; -] - -//-------------------------------------------------------------------------- SfxStringItem OldPALK SID_OLD_PALK [ @@ -5057,33 +4555,6 @@ SfxStringItem DocPath SID_DOCPATH ] //-------------------------------------------------------------------------- -SfxStringItem Path SID_PROGPATH - -[ - /* 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, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - -//-------------------------------------------------------------------------- SfxVoidItem PickList SID_PICKLIST () [ @@ -6491,106 +5962,6 @@ SfxBoolItem SourceView SID_SOURCEVIEW ] //-------------------------------------------------------------------------- -SfxObjectItem SplitHorizontal SID_SPLIT_HORIZONTAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxObjectItem SplitParentHorizontal SID_SPLIT_PARENT_HORIZONTAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxObjectItem SplitParentVertical SID_SPLIT_PARENT_VERTICAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxObjectItem SplitVertical SID_SPLIT_VERTICAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- SfxVoidItem StartRegistrationDialog SID_ONLINE_REGISTRATION_DLG () [ @@ -8114,7 +7485,7 @@ SfxVoidItem AutoPilotAddressDataSource SID_ADDRESS_DATA_SOURCE //-------------------------------------------------------------------------- SfxVoidItem InsertBusinessCard FN_BUSINESS_CARD -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -8139,7 +7510,7 @@ SfxVoidItem InsertBusinessCard FN_BUSINESS_CARD //-------------------------------------------------------------------------- SfxVoidItem InsertLabels FN_LABEL -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -8164,7 +7535,7 @@ SfxVoidItem InsertLabels FN_LABEL //-------------------------------------------------------------------------- SfxVoidItem NewXForms FN_XFORMS_INIT -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -8189,7 +7560,7 @@ SfxVoidItem NewXForms FN_XFORMS_INIT //-------------------------------------------------------------------------- SfxVoidItem AutoPilotPresentations SID_SD_AUTOPILOT -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -8214,7 +7585,7 @@ SfxVoidItem AutoPilotPresentations SID_SD_AUTOPILOT //-------------------------------------------------------------------------- SfxVoidItem NewPresentation SID_NEWSD -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sfx2/sdi/sfxitems.sdi b/sfx2/sdi/sfxitems.sdi index d9be2f587eda..421c1cb29529 100644 --- a/sfx2/sdi/sfxitems.sdi +++ b/sfx2/sdi/sfxitems.sdi @@ -18,6 +18,7 @@ item String SfxFrameItem; //! Dummy item String SfxObjectShellItem //! Dummy item String SfxUsrAnyItem //! Dummy + item String SfxUnoFrameItem //! Dummy struct Point { diff --git a/sfx2/sdi/sfxslots.sdi b/sfx2/sdi/sfxslots.sdi index b69bd5df93f3..1479c4716efc 100644 --- a/sfx2/sdi/sfxslots.sdi +++ b/sfx2/sdi/sfxslots.sdi @@ -39,7 +39,6 @@ SlotIdFile( "sfx2/sfx.hrc" ) include "docslots.sdi" include "viwslots.sdi" include "frmslots.sdi" - include "mdislots.sdi" include "appslots.sdi" } diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index d5c26f0fb0be..d42d203e57f5 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -108,7 +108,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/genlink.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "appdata.hxx" #include "openflag.hxx" #include "app.hrc" @@ -472,9 +472,6 @@ SfxDispatcher* SfxApplication::GetDispatcher_Impl() //-------------------------------------------------------------------- void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) { - if( pFrame && !pFrame->IsSetViewFrameAllowed_Impl() ) - return; - if ( pFrame != pAppData_Impl->pViewFrame ) { // get the containerframes ( if one of the frames is an InPlaceFrame ) @@ -491,12 +488,6 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) // BOOL bDocWinActivate = pOldContainerFrame && pNewContainerFrame && // pOldContainerFrame->GetTopViewFrame() == pNewContainerFrame->GetTopViewFrame(); BOOL bTaskActivate = pOldContainerFrame != pNewContainerFrame; - if ( pAppData_Impl->pViewFrame ) - { - if ( bTaskActivate ) - // prepare UI for deacivation - pAppData_Impl->pViewFrame->GetFrame()->Deactivate_Impl(); - } if ( pOldContainerFrame ) { @@ -565,11 +556,11 @@ short SfxApplication::QuerySave_Impl( SfxObjectShell& rDoc, sal_Bool /*bAutoSave String aMsg( SfxResId( STR_ISMODIFIED ) ); aMsg.SearchAndReplaceAscii( "%1", rDoc.GetTitle() ); - SfxFrame *pFrame = SfxViewFrame::GetFirst(&rDoc)->GetFrame(); - pFrame->Appear(); + SfxFrame& rFrame = SfxViewFrame::GetFirst(&rDoc)->GetFrame(); + rFrame.Appear(); WinBits nBits = WB_YES_NO_CANCEL | WB_DEF_NO; - QueryBox aBox( &pFrame->GetWindow(), nBits, aMsg ); + QueryBox aBox( &rFrame.GetWindow(), nBits, aMsg ); return aBox.Execute(); } @@ -693,7 +684,7 @@ uno::Reference< task::XStatusIndicator > SfxApplication::GetStatusIndicator() co while ( pTop->GetParentViewFrame_Impl() ) pTop = pTop->GetParentViewFrame_Impl(); - return pTop->GetFrame()->GetWorkWindow_Impl()->GetStatusIndicator(); + return pTop->GetFrame().GetWorkWindow_Impl()->GetStatusIndicator(); } SfxTbxCtrlFactArr_Impl& SfxApplication::GetTbxCtrlFactories_Impl() const @@ -810,7 +801,7 @@ SfxApplication::ChooseScript() OSL_TRACE("create selector dialog"); const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; + const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() ); AbstractScriptSelectorDialog* pDlg = diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index 9081cd79f6ee..0858e66e7347 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -652,11 +652,6 @@ ToolBox RID_ENVTOOLBOX }; ToolBoxItem { - Identifier = SID_BROWSE_STOP ; - Hide = TRUE; - }; - ToolBoxItem - { Type = TOOLBOXITEM_SEPARATOR ; }; ToolBoxItem diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 3ace03605d5c..10c4a6bc6797 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -351,7 +351,7 @@ void SfxApplication::EnterBasicCall() } // die SbxObjects der SfxShells auf den Stacks der Frames erzeugen - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,0,sal_False); + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,sal_False); pFrame; pFrame = SfxViewFrame::GetNext(*pFrame,0,0,sal_False) ) { @@ -422,16 +422,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq ) break; } - case SID_WIN_POSSIZE: - { - break; - } - - case SID_INTERACTIVEMODE: - { - break; - } - case SID_ATTR_UNDO_COUNT: { SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, sal_False); diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index 54e91df22f3d..6afa8c68ed83 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -268,14 +268,6 @@ BOOL SfxApplication::GetOptions( SfxItemSet& rSet ) bRet = FALSE; } break; - case SID_ATTR_SAVEDOCWINS : - { - bRet = TRUE; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCWINS)) - if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCWINS ), aSaveOptions.IsSaveDocWins()))) - bRet = FALSE; - } - break; case SID_ATTR_SAVEDOCVIEW : { bRet = TRUE; @@ -627,13 +619,6 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) aSaveOptions.SetSaveWorkingSet(((const SfxBoolItem *)pItem)->GetValue()); } - // offene Fenster speichern - if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCWINS), TRUE, &pItem)) - { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); - aSaveOptions.SetSaveDocWins(((const SfxBoolItem *)pItem)->GetValue()); - } - // Fenster-Einstellung speichern if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), TRUE, &pItem)) { diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx index e69be0caadc9..b18fc905abdc 100644 --- a/sfx2/source/appl/appchild.cxx +++ b/sfx2/source/appl/appchild.cxx @@ -167,9 +167,9 @@ SfxTemplateDialog* SfxApplication::GetTemplateDialog() SfxWorkWindow* SfxApplication::GetWorkWindow_Impl(const SfxViewFrame *pFrame) const { if ( pFrame ) - return pFrame->GetFrame()->GetWorkWindow_Impl(); + return pFrame->GetFrame().GetWorkWindow_Impl(); else if ( pAppData_Impl->pViewFrame ) - return pAppData_Impl->pViewFrame->GetFrame()->GetWorkWindow_Impl(); + return pAppData_Impl->pViewFrame->GetFrame().GetWorkWindow_Impl(); else return NULL; } diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index f9abd921cbef..a07623df46b1 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -98,7 +98,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : pTopFrames( new SfxFrameArr_Impl ), pInitLinkList(0), pMatcher( 0 ), - pCancelMgr( 0 ), pLabelResMgr( 0 ), pAppDispatch(NULL), pTemplates( 0 ), @@ -148,7 +147,6 @@ SfxAppData_Impl::~SfxAppData_Impl() { DeInitDDE(); delete pTopFrames; - delete pCancelMgr; delete pSecureURLs; delete pBasicManager; diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 70e52e9a24f1..808731f8bba8 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -46,7 +46,7 @@ #include "appdata.hxx" #include <sfx2/objsh.hxx> #include <sfx2/viewfrm.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include "sfxtypes.hxx" #include <sfx2/sfxsids.hrc> @@ -593,17 +593,12 @@ BOOL ImplDdeService::MakeTopic( const String& rNm ) // dann versuche die Datei zu laden: SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) ); SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, TRUE); -// SfxBoolItem aHidden(SID_HIDDEN, TRUE); - // minimiert! - SfxUInt16Item aViewStat( SID_VIEW_ZOOM_MODE, 0 ); - SfxRectangleItem aRectItem( SID_VIEW_POS_SIZE, Rectangle() ); SfxBoolItem aSilent(SID_SILENT, TRUE); SfxDispatcher* pDispatcher = SFX_APP()->GetDispatcher_Impl(); const SfxPoolItem* pRet = pDispatcher->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, &aName, &aNewView, - &aViewStat,&aRectItem/*aHidden*/, &aSilent, 0L ); if( pRet && pRet->ISA( SfxViewFrameItem ) && @@ -629,7 +624,7 @@ String ImplDdeService::Topics() SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType ); while( pShell ) { - if( SfxViewFrame::GetFirst( pShell, TYPE(SfxTopViewFrame) )) + if( SfxViewFrame::GetFirst( pShell ) ) { if( sRet.Len() ) sRet += '\t'; diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 5d8a03609c2a..70147e8d9146 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -86,7 +86,7 @@ #include <sfx2/templdlg.hxx> #include <sfx2/module.hxx> #include <sfx2/msgpool.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "openflag.hxx" #include <sfx2/viewsh.hxx> #include <sfx2/objface.hxx> @@ -326,13 +326,6 @@ ISfxTemplateCommon* SfxApplication::GetCurrentTemplateCommon( SfxBindings& rBind return 0; } -SfxCancelManager* SfxApplication::GetCancelManager() const -{ - if ( !pAppData_Impl->pCancelMgr ) - pAppData_Impl->pCancelMgr = new SfxCancelManager; - return pAppData_Impl->pCancelMgr; -} - SfxResourceManager& SfxApplication::GetResourceManager() const { return *pAppData_Impl->pResMgr; } BOOL SfxApplication::IsDowning() const { return pAppData_Impl->bDowning; } SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pAppData_Impl->pAppDispat; } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 14f3162f0abf..89bb5f23f1de 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -101,7 +101,7 @@ #include "sfxresid.hxx" #include <sfx2/viewsh.hxx> #include "app.hrc" -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/sfxuno.hxx> #include <sfx2/objface.hxx> #include <sfx2/filedlghelper.hxx> @@ -193,7 +193,7 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded // Vergleiche anhand der URLs INetURLObject aUrl( xDoc->GetMedium()->GetName() ); if ( !aUrl.HasError() && aUrl == aUrlToFind && - (!bForbidVisible || !SfxViewFrame::GetFirst( xDoc, 0, TRUE )) && + (!bForbidVisible || !SfxViewFrame::GetFirst( xDoc, TRUE )) && !xDoc->IsLoading()) { break; @@ -210,12 +210,10 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded DBG_ASSERT( !bForbidVisible, "Unsichtbares kann nicht aktiviert werden" ); - SfxTopViewFrame *pFrame; - for( pFrame = (SfxTopViewFrame*) - SfxViewFrame::GetFirst( xDoc, TYPE(SfxTopViewFrame) ); + SfxViewFrame* pFrame; + for( pFrame = SfxViewFrame::GetFirst( xDoc ); pFrame && !pFrame->IsVisible(); - pFrame = (SfxTopViewFrame*) - SfxViewFrame::GetNext( *pFrame, xDoc, TYPE(SfxTopViewFrame) ) ) ; + pFrame = SfxViewFrame::GetNext( *pFrame, xDoc ) ) ; if ( pFrame ) { SfxViewFrame *pCur = SfxViewFrame::Current(); @@ -511,65 +509,6 @@ ULONG SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const String &rFil //-------------------------------------------------------------------- -SfxObjectShellLock SfxApplication::NewDoc_Impl( const String& rFact, const SfxItemSet *pSet ) -{ - SfxObjectShellLock xDoc; - String aFact( rFact ); - String aPrefix = String::CreateFromAscii( "private:factory/" ); - if ( aPrefix.Len() == aFact.Match( aPrefix ) ) - aFact.Erase( 0, aPrefix.Len() ); - USHORT nPos = aFact.Search( '?' ); - String aParam; - if ( nPos != STRING_NOTFOUND ) - { - aParam = aFact.Copy( nPos, aFact.Len() ); - aFact.Erase( nPos, aFact.Len() ); - aParam.Erase(0,1); - } - - xDoc = SfxObjectShell::CreateObjectByFactoryName( aFact ); - aParam = INetURLObject::decode( aParam, '%', INetURLObject::DECODE_WITH_CHARSET ); - if( xDoc.Is() ) - xDoc->DoInitNew_Impl( aParam ); - - if ( xDoc.Is() ) - { - 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 ); - } - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel ( xDoc->GetModel(), ::com::sun::star::uno::UNO_QUERY ); - if ( xModel.is() ) - { - SfxItemSet* pNew = xDoc->GetMedium()->GetItemSet()->Clone(); - pNew->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; - TransformItems( SID_OPENDOC, *pNew, aArgs ); - - sal_Int32 nLength = aArgs.getLength(); - aArgs.realloc( nLength + 1 ); - - aArgs[nLength].Name = DEFINE_CONST_UNICODE("Title"); - aArgs[nLength].Value <<= ::rtl::OUString( xDoc->GetTitle( SFX_TITLE_DETECT ) ); - - xModel->attachResource( ::rtl::OUString(), aArgs ); - delete pNew; - } - } - - return xDoc; -} - void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); @@ -603,131 +542,6 @@ void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); } -const SfxPoolItem* SfxApplication::NewDocDirectExec_ImplOld( SfxRequest& rReq ) -{ - DBG_MEMTEST(); -/* - SFX_REQUEST_ARG(rReq, pHidden, SfxBoolItem, SID_HIDDEN, FALSE); -//(mba)/task - - if ( !pHidden || !pHidden->GetValue() ) - Application::GetAppWindow()->EnterWait(); -*/ - SfxObjectShellLock xDoc; - - // Factory-RegNo kann per Parameter angegeben sein - SfxErrorContext aEc(ERRCTX_SFX_NEWDOCDIRECT); - rReq.GetArgs(); // -Wall required?? - String aFactory; - rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, TRUE ) ); - SFX_REQUEST_ARG( rReq, pFactoryName, SfxStringItem, SID_NEWDOCDIRECT, FALSE ); - if( pFactoryName ) - aFactory = pFactoryName->GetValue(); - else - aFactory = SvtModuleOptions().GetDefaultModuleName(); - - SFX_REQUEST_ARG( rReq, pFileFlagsItem, SfxStringItem, SID_OPTIONS, FALSE); - if ( pFileFlagsItem ) - { - // Werte auf einzelne Items verteilen - String aFileFlags = pFileFlagsItem->GetValue(); - aFileFlags.ToUpperAscii(); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0054 ) ) // T = 54h - rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0048 ) ) // H = 48h - rReq.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0052 ) ) // R = 52h - rReq.AppendItem( SfxBoolItem( SID_DOC_READONLY, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0042 ) ) // B = 42h - rReq.AppendItem( SfxBoolItem( SID_PREVIEW, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0053 ) ) // S = 53h - rReq.AppendItem( SfxBoolItem( SID_SILENT, TRUE ) ); - } - - xDoc = NewDoc_Impl( aFactory, rReq.GetArgs() ); - if ( xDoc.Is() ) - { - SFX_REQUEST_ARG(rReq, pReadonly, SfxBoolItem, SID_DOC_READONLY, FALSE); - if ( pReadonly ) - xDoc->GetMedium()->GetItemSet()->Put( *pReadonly ); - - SFX_REQUEST_ARG(rReq, pPreview, SfxBoolItem, SID_PREVIEW, FALSE); - if ( pPreview ) - xDoc->GetMedium()->GetItemSet()->Put( *pPreview ); - - SFX_REQUEST_ARG(rReq, pSilent, SfxBoolItem, SID_SILENT, FALSE); - if ( pSilent ) - xDoc->GetMedium()->GetItemSet()->Put( *pSilent ); - - SFX_REQUEST_ARG(rReq, pFlags, SfxStringItem, SID_OPTIONS, FALSE); - if ( pFlags ) - xDoc->GetMedium()->GetItemSet()->Put( *pFlags ); - } - - // View erzeugen - if ( xDoc.Is() ) - { - SFX_REQUEST_ARG(rReq, pHidden, SfxBoolItem, SID_HIDDEN, FALSE); - BOOL bHidden = FALSE; - if ( pHidden ) - { - xDoc->GetMedium()->GetItemSet()->Put( *pHidden, SID_HIDDEN ); - bHidden = pHidden->GetValue(); - } - - SFX_REQUEST_ARG(rReq, pViewId, SfxUInt16Item, SID_VIEW_ID, FALSE); - USHORT nViewId = 0; - if ( pViewId ) - { - xDoc->GetMedium()->GetItemSet()->Put( *pViewId, SID_VIEW_ID ); - nViewId = pViewId->GetValue(); - } - - xDoc->SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); -// xDoc->Get_Impl()->nLoadedFlags = SFX_LOADED_ALL; - const SfxItemSet* pInternalArgs = rReq.GetInternalArgs_Impl(); - if( pInternalArgs ) - xDoc->GetMedium()->GetItemSet()->Put( *pInternalArgs ); - SFX_REQUEST_ARG(rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE); - - SfxFrame* pFrame = NULL; - if (pFrameItem) - pFrame = pFrameItem->GetFrame(); - else - pFrame = (SfxFrame*)SfxTopFrame::Create(xDoc, nViewId, bHidden, pInternalArgs); - if ( pFrame ) - { - if ( pFrame->GetCurrentDocument() == xDoc || pFrame->PrepareClose_Impl( TRUE, TRUE ) == TRUE ) - { - if ( bHidden ) - { - xDoc->RestoreNoDelete(); - xDoc->OwnerLock( TRUE ); - xDoc->Get_Impl()->bHiddenLockedByAPI = TRUE; - } - - if ( pFrame->GetCurrentDocument() != xDoc ) - { - if ( pFrame->InsertDocument( xDoc ) ) - rReq.SetReturnValue( SfxFrameItem( 0, pFrame ) ); - else - xDoc->DoClose(); - } - } - else - xDoc.Clear(); - } - } - - return rReq.GetReturnValue(); - -//(mba)/task -/* - if ( !pHidden || !pHidden->GetValue() ) - Application::GetAppWindow()->LeaveWait(); - */ -} - //-------------------------------------------------------------------- void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) @@ -1303,12 +1117,22 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) return; } - SFX_REQUEST_ARG(rReq, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE); - SfxFrame *pFrame = NULL; - if ( pFrmItem ) - pFrame = pFrmItem->GetFrame(); - else if ( SfxViewFrame::Current() ) - pFrame = SfxViewFrame::Current()->GetFrame(); + SfxFrame* pTargetFrame = NULL; + Reference< XFrame > xTargetFrame; + + SFX_REQUEST_ARG(rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE); + if ( pFrameItem ) + pTargetFrame = pFrameItem->GetFrame(); + + if ( !pTargetFrame ) + { + SFX_REQUEST_ARG(rReq, pUnoFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE); + if ( pUnoFrameItem ) + xTargetFrame = pUnoFrameItem->GetFrame(); + } + + if ( !pTargetFrame && !xTargetFrame.is() && SfxViewFrame::Current() ) + pTargetFrame = &SfxViewFrame::Current()->GetFrame(); // check if caller has set a callback SFX_REQUEST_ARG(rReq, pLinkItem, SfxLinkItem, SID_DONELINK, FALSE ); @@ -1319,21 +1143,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) rReq.RemoveItem( SID_DONELINK ); - // check if caller wants to create a view - BOOL bCreateView = TRUE; - SFX_REQUEST_ARG( rReq, pCreateViewItem, SfxBoolItem, SID_VIEW, FALSE ); - if ( pCreateViewItem ) - { - if ( !pCreateViewItem->GetValue() ) - bCreateView = FALSE; - // this is an "SFX only" parameter - rReq.RemoveItem( SID_VIEW ); - } - - // we can't load without a view - switch to hidden view - if ( !bCreateView ) - rReq.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - // check if the view must be hidden BOOL bHidden = FALSE; SFX_REQUEST_ARG(rReq, pHidItem, SfxBoolItem, SID_HIDDEN, FALSE); @@ -1385,18 +1194,24 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // { // if a frame is given, it must be used for the starting point of the targetting mechanism // this code is also used if asynchronous loading is possible, because loadComponent always is synchron - Reference < XFrame > xFrame; - if ( pFrame ) - xFrame = pFrame->GetFrameInterface(); - else - xFrame = Reference < XFrame >( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + if ( !xTargetFrame.is() ) + { + if ( pTargetFrame ) + { + xTargetFrame = pTargetFrame->GetFrameInterface(); + } + else + { + xTargetFrame.set( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + } + } // make URL ready SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_FILE_NAME, FALSE ); aFileName = pURLItem->GetValue(); if( aFileName.Len() && aFileName.GetChar(0) == '#' ) // Mark without URL { - SfxViewFrame *pView = pFrame ? pFrame->GetCurrentViewFrame() : 0; + SfxViewFrame *pView = pTargetFrame ? pTargetFrame->GetCurrentViewFrame() : 0; if ( !pView ) pView = SfxViewFrame::Current(); pView->GetViewShell()->JumpToMark( aFileName.Copy(1) ); @@ -1414,13 +1229,13 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // if loading must be done synchron, we must wait for completion to get a return value // find frame by myself; I must konw the exact frame to get the controller for the return value from it //if( aTarget.getLength() ) - // xFrame = xFrame->findFrame( aTarget, FrameSearchFlag::ALL ); + // xTargetFrame = xTargetFrame->findFrame( aTarget, FrameSearchFlag::ALL ); Reference < XComponent > xComp; try { - xComp = ::comphelper::SynchronousDispatch::dispatch( xFrame, aFileName, aTarget, 0, aArgs ); -// Reference < XComponentLoader > xLoader( xFrame, UNO_QUERY ); + xComp = ::comphelper::SynchronousDispatch::dispatch( xTargetFrame, aFileName, aTarget, 0, aArgs ); +// Reference < XComponentLoader > xLoader( xTargetFrame, UNO_QUERY ); // xComp = xLoader->loadComponentFromURL( aFileName, aTarget, 0, aArgs ); } catch(const RuntimeException&) @@ -1445,7 +1260,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); xTrans->parseStrict( aURL ); - Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); + Reference < XDispatchProvider > xProv( xTargetFrame, UNO_QUERY ); Reference < XDispatch > xDisp = xProv.is() ? xProv->queryDispatch( aURL, aTarget, FrameSearchFlag::ALL ) : Reference < XDispatch >();; RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, "PERFORMANCE - SfxApplication::OpenDocExec_Impl" ); if ( xDisp.is() ) @@ -1491,7 +1306,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { if ( pShell->GetController() == xController ) { - pCntrFrame = pShell->GetViewFrame()->GetFrame(); + pCntrFrame = &pShell->GetViewFrame()->GetFrame(); break; } } @@ -1501,12 +1316,9 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) SfxObjectShell* pSh = pCntrFrame->GetCurrentDocument(); DBG_ASSERT( pSh, "Controller without ObjectShell ?!" ); - if ( bCreateView ) - rReq.SetReturnValue( SfxViewFrameItem( 0, pCntrFrame->GetCurrentViewFrame() ) ); - else - rReq.SetReturnValue( SfxObjectItem( 0, pSh ) ); + rReq.SetReturnValue( SfxViewFrameItem( 0, pCntrFrame->GetCurrentViewFrame() ) ); - if( ( bHidden || !bCreateView ) ) + if ( bHidden ) pSh->RestoreNoDelete(); } } diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx index c316a9847886..4da32cf9f566 100644 --- a/sfx2/source/appl/appquit.cxx +++ b/sfx2/source/appl/appquit.cxx @@ -116,9 +116,6 @@ BOOL SfxApplication::QueryExit_Impl() } } */ - // alles canceln was zu canceln ist - GetCancelManager()->Cancel(TRUE); - /* SfxObjectShell *pLastDocSh = SfxObjectShell::GetFirst(); if ( bQuit ) diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index a2f34b472732..47bf98292316 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -43,7 +43,7 @@ #include "stbitem.hxx" #include <sfx2/navigat.hxx> #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "partwnd.hxx" #include <sfx2/sfxsids.hrc> #include "recfloat.hxx" @@ -59,7 +59,6 @@ void SfxApplication::Registrations_Impl() SfxApplication::RegisterInterface(); SfxModule::RegisterInterface(); SfxViewFrame::RegisterInterface(); - SfxTopViewFrame::RegisterInterface(); SfxObjectShell::RegisterInterface(); SfxViewShell::RegisterInterface(); @@ -73,7 +72,6 @@ void SfxApplication::Registrations_Impl() // Controller SfxToolBoxControl::RegisterControl(SID_REPEAT); SfxURLToolBoxControl_Impl::RegisterControl(SID_OPENURL); - SfxCancelToolBoxControl_Impl::RegisterControl(SID_BROWSE_STOP); SfxAppToolBoxControl_Impl::RegisterControl( SID_NEWDOCDIRECT ); SfxAppToolBoxControl_Impl::RegisterControl( SID_AUTOPILOTMENU ); }; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 53cf115382e5..14789100bb24 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -68,7 +68,6 @@ #include <tools/config.hxx> #include <tools/diagnose_ex.h> #include <vcl/msgbox.hxx> -#include <svl/cancel.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> @@ -93,9 +92,11 @@ #include <cppuhelper/exc_hlp.hxx> #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include "about.hxx" +#include "frmload.hxx" #include "referers.hxx" #include <sfx2/app.hxx> #include <sfx2/request.hxx> @@ -129,7 +130,7 @@ #include "minfitem.hxx" #include <sfx2/event.hxx> #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "sfxpicklist.hxx" #include "imestatuswindow.hxx" #include <sfx2/sfxdlg.hxx> @@ -262,9 +263,9 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) Reference< XFrame > xFrame; const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); - SFX_ITEMSET_ARG( pIntSet, pFrame, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); - if (pFrame) - pFrame->GetValue() >>= xFrame; + SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); + if ( pFrameItem ) + xFrame = pFrameItem->GetFrame(); SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_SVXDLG_CUSTOMIZE, @@ -822,6 +823,60 @@ namespace } return _pFallback; } + + const ::rtl::OUString& lcl_getBasicIDEServiceName() + { + static const ::rtl::OUString s_sBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) ); + return s_sBasicName; + } + + SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell* i_pBasicIDE ) + { + SfxViewFrame* pView = SfxViewFrame::GetFirst( i_pBasicIDE ); + while ( pView ) + { + if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == lcl_getBasicIDEServiceName() ) + break; + pView = SfxViewFrame::GetNext( *pView, i_pBasicIDE ); + } + return pView; + } + Reference< XFrame > lcl_findStartModuleFrame( const ::comphelper::ComponentContext& i_rContext ) + { + try + { + Reference < XFramesSupplier > xSupplier( i_rContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); + + Reference< XModuleManager > xCheck( i_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + + sal_Int32 nCount = xContainer->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) + { + try + { + Reference < XFrame > xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW ); + ::rtl::OUString sModule = xCheck->identify( xFrame ); + if ( sModule.equalsAscii( "com.sun.star.frame.StartModule" ) ) + return xFrame; + } + catch( const UnknownModuleException& ) + { + // silence + } + catch(const Exception&) + { + // re-throw, caught below + throw; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } } void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) @@ -839,7 +894,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) const SfxPoolItem* pItem = NULL; Reference < XFrame > xFrame; if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) - ( (SfxUnoAnyItem*)pItem )->GetValue() >>= xFrame; + { + OSL_ENSURE( pItem->ISA( SfxUnoFrameItem ), "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" ); + xFrame = static_cast< const SfxUnoFrameItem*>( pItem )->GetFrame(); + } SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) { @@ -902,26 +960,46 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case SID_BASICIDE_APPEAR: { - SfxViewFrame* pView = SfxViewFrame::GetFirst(); - ::rtl::OUString aBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) ); - while ( pView ) - { - if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == aBasicName ) - break; - pView = SfxViewFrame::GetNext( *pView ); - } - + SfxViewFrame* pView = lcl_getBasicIDEViewFrame( NULL ); if ( !pView ) { - SfxObjectShell* pDocShell = SfxObjectShell::CreateObject( aBasicName ); - pDocShell->DoInitNew( 0 ); - pDocShell->SetModified( FALSE ); - pView = SfxViewFrame::CreateViewFrame( *pDocShell, 0 ); - pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); + SfxObjectShell* pBasicIDE = SfxObjectShell::CreateObject( lcl_getBasicIDEServiceName() ); + pBasicIDE->DoInitNew( 0 ); + pBasicIDE->SetModified( FALSE ); + try + { + // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL + // (which could be done via SfxViewFrame::LoadDocumentIntoFrame) is not feasible here, since the Basic IDE + // does not really play nice with the framework's concept. For instance, it is a "singleton document", + // which conflicts, at the latest, with the framework's concept of loading into _blank frames. + // So, since we know that our frame loader can handle it, we skip the generic framework loader + // mechanism, and the type detection (which doesn't know about the Basic IDE). + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XSynchronousFrameLoader > xLoader( aContext.createComponent( + SfxFrameLoader_Impl::impl_getStaticImplementationName() ), UNO_QUERY_THROW ); + ::comphelper::NamedValueCollection aLoadArgs; + aLoadArgs.put( "Model", pBasicIDE->GetModel() ); + aLoadArgs.put( "URL", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/sbasic" ) ) ); + + Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext ) ); + if ( !xTargetFrame.is() ) + xTargetFrame = SfxFrame::CreateBlankFrame(); + ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" ); + + xLoader->load( aLoadArgs.getPropertyValues(), xTargetFrame ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + pView = lcl_getBasicIDEViewFrame( pBasicIDE ); + if ( pView ) + pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); } if ( pView ) - pView->GetFrame()->Appear(); + pView->GetFrame().Appear(); const SfxItemSet* pArgs = rReq.GetArgs(); if ( pArgs && pView ) @@ -988,16 +1066,15 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) Reference< XFrame > xFrame; const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); - SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); + SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); if ( pFrameItem ) - pFrameItem->GetValue() >>= xFrame; + xFrame = pFrameItem->GetFrame(); if ( !xFrame.is() ) { const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; - if ( pFrame ) - xFrame = pFrame->GetFrameInterface(); + if ( pViewFrame ) + xFrame = pViewFrame->GetFrame().GetFrameInterface(); } do // artificial loop for flow control diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 09260972d5fc..fd33e21ea645 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -178,7 +178,6 @@ static char const sMacroExecMode[] = "MacroExecutionMode"; static char const sUpdateDocMode[] = "UpdateDocMode"; static char const sMinimized[] = "Minimized"; static char const sInteractionHdl[] = "InteractionHandler"; -static char const sWindowState[] = "WindowState"; static char const sUCBContent[] = "UCBContent"; static char const sRepairPackage[] = "RepairPackage"; static char const sDocumentTitle[] = "DocumentTitle"; @@ -468,7 +467,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; rtl::OUString aName = rProp.Name; if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) - rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); + { + Reference< XFrame > xFrame; + OSL_VERIFY( rProp.Value >>= xFrame ); + rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); + } else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) ) { @@ -560,11 +563,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque } else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) { - Reference< XFrame > xVal; - sal_Bool bOK = (rProp.Value >>= xVal); + Reference< XFrame > xFrame; + sal_Bool bOK = (rProp.Value >>= xFrame); DBG_ASSERT( bOK, "invalid type for Frame" ); if (bOK) - rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); + rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); } else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAsTemplate)) ) { @@ -738,14 +741,6 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); } - else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sWindowState)) ) - { - ::rtl::OUString sVal; - sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); - DBG_ASSERT( bOK, "invalid type or value for WindowState" ); - if (bOK) - rSet.Put( SfxStringItem( SID_WIN_POSSIZE, sVal ) ); - } else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateName)) ) { ::rtl::OUString sVal; @@ -1015,10 +1010,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET ) nAdditional++; - if ( rSet.GetItemState( SID_WIN_POSSIZE ) == SFX_ITEM_SET ) - nAdditional++; - // if ( rSet.GetItemState( SID_VIEW_POS_SIZE ) == SFX_ITEM_SET ) - // nAdditional++; if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET ) nAdditional++; if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET ) @@ -1174,8 +1165,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta continue; if ( nId == SID_CONTENTTYPE ) continue; - if ( nId == SID_WIN_POSSIZE ) - continue; if ( nId == SID_TEMPLATE_NAME ) continue; if ( nId == SID_TEMPLATE_REGIONNAME ) @@ -1392,7 +1381,15 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame)); - pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); + if ( pItem->ISA( SfxUsrAnyItem ) ) + { + OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); + pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue(); + } + else if ( pItem->ISA( SfxUnoFrameItem ) ) + pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame(); + else + OSL_ENSURE( false, "TransformItems: invalid item type for SID_FILLFRAME!" ); } if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) { @@ -1497,11 +1494,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMediaType)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } - if ( rSet.GetItemState( SID_WIN_POSSIZE, sal_False, &pItem ) == SFX_ITEM_SET ) - { - pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sWindowState)); - pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); - } if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateName)); @@ -1518,12 +1510,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } - SFX_ITEMSET_ARG( &rSet, pRectItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); - if ( pRectItem ) - { - DBG_ERROR("PosSizeItem not supported yet!"); - } - if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCharacterSet)); diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index ecc457760392..294d6ef17da5 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -291,8 +291,6 @@ BOOL SvFileObject::LoadFile_Impl() aStreamToLoadFrom.m_xInputStreamToLoadFrom, aStreamToLoadFrom.m_bIsReadOnly); // setStreamToLoadFrom(0,0); - // Keinen Eintrag im Roter Button Menu - xMed->SetDontCreateCancellable(); if( sReferer.Len() ) xMed->SetReferer( sReferer ); @@ -682,9 +680,6 @@ BOOL SvFileObject::IsDataComplete() const void SvFileObject::CancelTransfers() { - if( xMed.Is() ) - xMed->CancelTransfers(); - // und aus dem Cache austragen, wenn man mitten im Laden ist if( !bDataReady ) { @@ -696,11 +691,6 @@ void SvFileObject::CancelTransfers() } -void SvFileObject::SetTransferPriority( USHORT ) -{ -} - - void SvFileObject::SendStateChg_Impl( sfx2::LinkManager::LinkState nState ) { if( !bStateChangeCalled && HasDataLinks() ) diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx index 58a3c662b92c..50f934a75436 100644 --- a/sfx2/source/appl/fileobj.hxx +++ b/sfx2/source/appl/fileobj.hxx @@ -88,7 +88,6 @@ public: virtual BOOL IsDataComplete() const; void CancelTransfers(); - void SetTransferPriority( USHORT nPrio ); }; diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 3f5dcb78a677..ce69ba225157 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -430,16 +430,6 @@ void LinkManager::CancelTransfers() pFileObj->CancelTransfers(); } -void LinkManager::SetTransferPriority( sfx2::SvBaseLink& /*rLink*/, USHORT /*nPrio*/ ) -{ -// SvFileObject* pFileObj = -// (SvFileObject*)SvFileObject::ClassFactory()-> -// CastAndAddRef( rLink.GetObj() ); -// OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & rLink.GetObjType()) ? -// (SvFileObject*)rLink.GetObj() : 0; -} - - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 54add7271ae1..0074faac192f 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -446,7 +446,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) return; // ignore hidden documents - if ( !SfxViewFrame::GetFirst( pDocSh, 0, TRUE ) ) + if ( !SfxViewFrame::GetFirst( pDocSh, TRUE ) ) return; ::rtl::OUString aTitle = pDocSh->GetTitle(SFX_TITLE_PICKLIST); diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index dcc087767469..24cf7dab8095 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -38,7 +38,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/app.hxx> #include "workwin.hxx" -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "arrdecl.hxx" #include <sfx2/viewfrm.hxx> #include <sfx2/module.hxx> @@ -1431,8 +1431,8 @@ sal_Bool SfxWorkWindow::IsPluginMode( SfxObjectShell* pObjShell ) if ( pDispatcher ) { SfxViewFrame* pFrame = pDispatcher->GetFrame(); - if ( pFrame && pFrame->GetFrame() ) - xFrame = pFrame->GetFrame()->GetFrameInterface(); + if ( pFrame ) + xFrame = pFrame->GetFrame().GetFrameInterface(); } return xFrame; diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index b89494bee8d7..d11b8b5130ed 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -124,7 +124,7 @@ using namespace ::vos; #include <sfx2/doctempl.hxx> #include <sfx2/frame.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "helper.hxx" #include "fltlst.hxx" #include <sfx2/request.hxx> diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 99175a124afa..649ae121c274 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -77,7 +77,7 @@ void AddNumber_Impl( String& aNumber, sal_uInt32 nArg ) } } -struct SfxProgress_Impl : public SfxCancellable +struct SfxProgress_Impl { Reference < XStatusIndicator > xStatusInd; String aText, aStateText; @@ -141,11 +141,9 @@ void SfxProgress_Impl::Enable_Impl( BOOL bEnable ) // ----------------------------------------------------------------------- -SfxProgress_Impl::SfxProgress_Impl( const String &rTitle ) - : SfxCancellable( SFX_APP()->GetCancelManager(), rTitle ), - pActiveProgress( 0 ) +SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ ) + : pActiveProgress( 0 ) { - SFX_APP()->GetCancelManager()->RemoveCancellable(this); } // ----------------------------------------------------------------------- @@ -183,21 +181,6 @@ SfxProgress::SfxProgress pImp->bRunning = TRUE; pImp->bAllowRescheduling = Application::IsInExecute();; - if ( pObjSh ) - { - for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pObjSh ) ) - { - pFrame->GetCancelManager()->InsertCancellable( pImp ); -/* - SfxBindings& rBindings = pFrame->GetBindings(); - rBindings.Invalidate( SID_BROWSE_STOP ); - if ( !rBindings.IsInRegistrations() ) - rBindings.Update( SID_BROWSE_STOP ); - rBindings.Invalidate( SID_BROWSE_STOP ); - */ - } - } - pImp->xObjSh = pObjSh; pImp->aText = rText; pImp->nMax = nRange; @@ -238,14 +221,6 @@ SfxProgress::~SfxProgress() if( pImp->bIsStatusText == TRUE ) GetpApp()->HideStatusText( ); - SfxObjectShell* pDoc = pImp->xObjSh; - if ( pDoc ) - { - for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDoc ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDoc ) ) - pFrame->GetCancelManager()->RemoveCancellable( pImp );//Invalidate( SID_BROWSE_STOP ); - } - else - SFX_APP()->Invalidate( SID_BROWSE_STOP ); delete pImp; } @@ -387,8 +362,8 @@ BOOL SfxProgress::SetState { // wurde via Stop-Button angehalten? - if ( pImp->IsCancelled() ) - return FALSE; +// if ( pImp->IsCancelled() ) +// return FALSE; if( pImp->pActiveProgress ) return TRUE; diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index cef0af899a33..40f6346de8ee 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -68,7 +68,7 @@ #include <sfx2/unoctitm.hxx> #include <sfx2/sfx.hrc> #include <sfx2/sfxuno.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/objsh.hxx> #include <sfx2/msgpool.hxx> @@ -719,7 +719,7 @@ void SfxBindings::InvalidateAll pImp->pCaches->GetObject(n)->Invalidate(bWithMsg); /* ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); if ( bWithMsg && xFrame.is() ) xFrame->contextChanged(); @@ -1381,7 +1381,7 @@ void SfxBindings::UpdateSlotServer_Impl() if ( !nRegLevel ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); //if ( xFrame.is() ) // xFrame->contextChanged(); pImp->bContextChanged = FALSE; @@ -1923,7 +1923,7 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int pImp->bContextChanged = FALSE; /* ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); if ( xFrame.is() ) xFrame->contextChanged();*/ } @@ -2030,7 +2030,7 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > xProv; if ( pDisp ) xProv = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > - ( pDisp->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDisp->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); SetDispatchProvider_Impl( xProv ); InvalidateAll( sal_True ); @@ -2313,7 +2313,7 @@ void SfxBindings::SetActiveFrame( const ::com::sun::star::uno::Reference< ::com: SetDispatchProvider_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > ( rFrame, ::com::sun::star::uno::UNO_QUERY ) ); else SetDispatchProvider_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > ( - pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ) ); + pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ) ); } const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxBindings::GetActiveFrame() const @@ -2322,7 +2322,7 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxBin if ( xFrame.is() || !pDispatcher ) return xFrame; else - return pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(); + return pDispatcher->GetFrame()->GetFrame().GetFrameInterface(); } void SfxBindings::SetDispatchProvider_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & rProv ) @@ -2349,8 +2349,8 @@ SystemWindow* SfxBindings::GetSystemWindow() const SfxViewFrame *pFrame = pDispatcher->GetFrame(); while ( pFrame->GetParentViewFrame_Impl() ) pFrame = pFrame->GetParentViewFrame_Impl(); - SfxTopViewFrame* pTop = PTR_CAST( SfxTopViewFrame, pFrame->GetTopViewFrame() ); - return pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + SfxViewFrame* pTop = pFrame->GetTopViewFrame(); + return pTop->GetFrame().GetTopWindow_Impl(); } BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) @@ -2374,7 +2374,7 @@ BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) xServiceManager->createInstance(our_aModuleManagerName) , ::com::sun::star::uno::UNO_QUERY_THROW); ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame( - pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY_THROW); + pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY_THROW); sAppName = xModuleManager->identify(xFrame); } catch(::com::sun::star::uno::Exception&) {} Sequence<beans::PropertyValue> source; diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 7037edb00178..e66dd2c56eaf 100755..100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -76,7 +76,7 @@ #include <sfx2/docfac.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/sfxuno.hxx> #include <sfx2/docfile.hxx> #include <sfx2/mnumgr.hxx> @@ -239,14 +239,13 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest SFX_STACK(SfxDispatcher::Call_Impl); // darf der Slot gerufen werden (i.S.v. enabled) - SfxApplication *pSfxApp = SFX_APP(); if ( rSlot.IsMode(SFX_SLOT_FASTCALL) || rShell.CanExecuteSlot_Impl(rSlot) ) { if ( GetFrame() ) { // ggf. Recording anwerfen com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrame()->GetFrameInterface(), + GetFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( @@ -270,19 +269,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest // Alles holen, was gebraucht wird, da der Slot den Execute evtl. nicht // "uberlebt, falls es ein 'Pseudoslot' f"ur Macros oder Verben ist sal_Bool bAutoUpdate = rSlot.IsMode(SFX_SLOT_AUTOUPDATE); - SFX_REQUEST_ARG(rReq, pOrigItem, SfxExecuteItem, SID_SUBREQUEST, sal_False); - SfxExecuteItem *pExecuteItem = pOrigItem - ? (SfxExecuteItem*)pOrigItem->Clone() - : 0; - - // ggf. TabPage-ID setzen - SfxAppData_Impl *pAppData = pSfxApp->Get_Impl(); - SFX_REQUEST_ARG(rReq, pTabPageItem, SfxUInt16Item, SID_TABPAGE, sal_False); - if ( pTabPageItem ) - { - pAppData->nAutoTabPageId = pTabPageItem->GetValue(); - rReq.RemoveItem( SID_TABPAGE ); // sonst ArgCount > 0 => Seiteneff. - } // API-Call-Klammerung und Document-Lock w"ahrend des Calls { @@ -295,7 +281,7 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest if ( !pView ) pView = SfxViewFrame::Current(); if ( pView ) - SfxHelp::OpenHelpAgent( pView->GetFrame(), rReq.GetSlot() ); + SfxHelp::OpenHelpAgent( &pView->GetFrame(), rReq.GetSlot() ); SfxExecFunc pFunc = rSlot.GetExecFnc(); rShell.CallExec( pFunc, rReq ); @@ -316,16 +302,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest } } - // TabPage-ID und Executing-SID zurueck setzen - if ( pTabPageItem ) - pAppData->nAutoTabPageId = 0; - - if( pExecuteItem ) - { - Execute( *pExecuteItem ); - delete pExecuteItem; - } - if ( rReq.IsDone() ) { SfxBindings *pBindings = GetBindings(); @@ -519,7 +495,7 @@ void SfxDispatcher::Pop SfxApplication *pSfxApp = SFX_APP(); #ifdef DBG_UTIL - ByteString aMsg( "SfxDispatcher(" ); + ByteString aMsg( "-SfxDispatcher(" ); aMsg += ByteString::CreateFromInt64( (sal_uIntPtr) this ); aMsg += bPush ? ")::Push(" : ")::Pop("; if ( rShell.GetInterface() ) @@ -527,6 +503,7 @@ void SfxDispatcher::Pop else aMsg += ByteString::CreateFromInt64( (sal_uIntPtr) &rShell ); aMsg += bDelete ? ") with delete" : ")"; + if ( bUntil ) aMsg += " (up to)"; DbgTrace( aMsg.GetBuffer() ); #endif @@ -797,7 +774,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) if ( pBindings ) { pBindings->SetDispatcher(this); - pBindings->SetActiveFrame( pImp->pFrame->GetFrame()->GetFrameInterface() ); + pBindings->SetActiveFrame( pImp->pFrame->GetFrame().GetFrameInterface() ); } } else @@ -817,7 +794,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) if ( bMDI && pImp->pFrame ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -825,7 +802,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) pBind = pBind->GetSubBindings_Impl(); } - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->HidePopups_Impl( FALSE, FALSE, 1 ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( FALSE, FALSE, 1 ); } if ( pImp->aToDoStack.Count() ) @@ -883,7 +860,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( pImp->pFrame && !(pImp->pFrame->GetObjectShell()->IsInPlaceActive() ) ) { - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); if ( pWorkWin ) { for (sal_uInt16 n=0; n<pImp->aChildWins.Count();) @@ -911,10 +888,10 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( pNew && pImp->pFrame ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xOldFrame( - pNew->GetFrame()->GetFrameInterface()->getCreator(), com::sun::star::uno::UNO_QUERY ); + pNew->GetFrame().GetFrameInterface()->getCreator(), com::sun::star::uno::UNO_QUERY ); com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xMyFrame( - GetFrame()->GetFrame()->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + GetFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xOldFrame == xMyFrame ) bHidePopups = FALSE; @@ -922,7 +899,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( bHidePopups ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -930,7 +907,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) pBind = pBind->GetSubBindings_Impl(); } - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->HidePopups_Impl( TRUE, FALSE, 1 ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( TRUE, FALSE, 1 ); } Flush(); @@ -1673,13 +1650,13 @@ void SfxDispatcher::SetMenu_Impl() { if ( pImp->pFrame ) { - SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); + SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxTopFrame* pFrm = pTop->GetTopFrame_Impl(); - if ( pFrm->IsMenuBarOn_Impl() ) + SfxFrame& rFrame = pTop->GetFrame(); + if ( rFrame.IsMenuBarOn_Impl() ) { - com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xPropSet.is() ) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -1712,7 +1689,7 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) sal_Bool bUpdate = bForce; while ( pDisp && pDisp->pImp->pFrame ) { - SfxWorkWindow *pWork = pDisp->pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWork = pDisp->pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); if ( pAct == pDisp || pAct == this ) { @@ -1726,10 +1703,10 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) pDisp = pDisp->pImp->pParent; } - if ( !bUpdate || pImp->pFrame->GetFrame()->IsClosing_Impl() ) + if ( !bUpdate || pImp->pFrame->GetFrame().IsClosing_Impl() ) return 0; - SfxTopViewFrame* pTop = pImp->pFrame ? PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ) : NULL; + SfxViewFrame* pTop = pImp->pFrame ? pImp->pFrame->GetTopViewFrame() : NULL; sal_Bool bUIActive = pTop && pTop->GetBindings().GetDispatcher() == this; if ( !bUIActive && pTop && GetBindings() == &pTop->GetBindings() ) @@ -1763,14 +1740,14 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) if ( bUIActive && /* !bIsIPActive && */ ( !pClient || !pClient->IsObjectUIActive() ) ) SetMenu_Impl(); - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); - SfxWorkWindow *pTaskWin = pImp->pFrame->GetTopFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); + SfxWorkWindow *pTaskWin = pImp->pFrame->GetTopFrame().GetWorkWindow_Impl(); pTaskWin->ResetStatusBar_Impl(); SfxDispatcher *pDispat = this; while ( pDispat ) { - SfxWorkWindow *pWork = pDispat->pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWork = pDispat->pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); if ( pAct == pDispat || pAct == this ) { @@ -1808,7 +1785,7 @@ sal_uInt32 SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, { sal_uInt32 nHelpId = 0; SFX_APP(); - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); sal_Bool bIsActive = sal_False; sal_Bool bIsTaskActive = sal_False; SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl(); @@ -1970,7 +1947,7 @@ sal_uInt32 SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, { // internal frames also may control statusbar SfxBindings& rBindings = pImp->pFrame->GetBindings(); - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->SetStatusBar_Impl( nStatBarId, pStatusBarShell, rBindings ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->SetStatusBar_Impl( nStatBarId, pStatusBarShell, rBindings ); } } @@ -2247,7 +2224,7 @@ sal_Bool SfxDispatcher::_TryIntercept_Impl sal_uInt16 nLevels = pImp->aStack.Count(); while ( pParent && pParent->pImp->pFrame ) { - if ( pParent->pImp->pFrame->GetFrame()->HasComponent() ) + if ( pParent->pImp->pFrame->GetFrame().HasComponent() ) { // Components d"urfen intercepten if ( pParent->_TryIntercept_Impl( nSlot, rServer, sal_True ) ) @@ -2321,7 +2298,7 @@ sal_Bool SfxDispatcher::_FindServer { SFX_STACK(SfxDispatcher::_FindServer); - // Dispatcher gelockt? (SID_BROWSE_STOP und SID_HELP_PI trotzdem durchlassen) + // Dispatcher gelockt? (SID_HELP_PI trotzdem durchlassen) SfxApplication *pSfxApp = SFX_APP(); if ( IsLocked(nSlot) ) { @@ -2741,7 +2718,7 @@ SfxPopupMenuManager* SfxDispatcher::Popup( sal_uInt16 nConfigId,Window *pWin, co nShLevel = rDisp.pImp->aStack.Count(); } - Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) { const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); @@ -2781,7 +2758,7 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin nShLevel = rDisp.pImp->aStack.Count(); } - Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) { const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); @@ -2804,7 +2781,7 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin //---------------------------------------------------------------------- void SfxDispatcher::ExecutePopup( const ResId &rId, Window *pWin, const Point *pPos ) { - Window *pWindow = pWin ? pWin : pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); /* SfxPopupMenuManager aPop( rId, *GetBindings() ); aPop.AddClipboardFunctions(); @@ -2908,13 +2885,13 @@ void SfxDispatcher::HideUI( sal_Bool bHide ) pImp->bNoUI = bHide; if ( pImp->pFrame ) { - SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); + SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxTopFrame* pFrm = pTop->GetTopFrame_Impl(); - if ( pFrm->IsMenuBarOn_Impl() ) + SfxFrame& rFrame = pTop->GetFrame(); + if ( rFrame.IsMenuBarOn_Impl() ) { - com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xPropSet.is() ) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -3157,27 +3134,6 @@ void SfxDispatcher::InvalidateBindings_Impl( sal_Bool bModify ) pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) pFrame->GetBindings().InvalidateAll(bModify); -/* - // alle Bindings sind betroffen - for ( SfxInPlaceFrame *pIPFrame = (SfxInPlaceFrame*) - SfxViewFrame::GetFirst(0, TYPE(SfxInPlaceFrame)); - pIPFrame; - pIPFrame = (SfxInPlaceFrame*) - SfxViewFrame::GetNext(*pIPFrame, 0, TYPE(SfxInPlaceFrame)) ) - pIPFrame->GetBindings().InvalidateAll(bModify); - - for ( SfxPlugInFrame *pPIFrame = (SfxPlugInFrame*) - SfxViewFrame::GetFirst(0, TYPE(SfxPlugInFrame)); - pPIFrame; - pPIFrame = (SfxPlugInFrame*) - SfxViewFrame::GetNext(*pPIFrame, 0, TYPE(SfxPlugInFrame)) ) - pPIFrame->GetBindings().InvalidateAll(bModify); - - for ( SfxTask* pTask = SfxTask::GetFirst(); pTask; - pTask = SfxTask::GetNext( *pTask ) ) - if ( !pTask->IsExternal() ) - pTask->GetBindings()->InvalidateAll(bModify); -*/ } else { diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index 9758f7e4d051..88a52d0ad0bf 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -866,7 +866,7 @@ com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxRe com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - (pView ? pView : SfxViewFrame::Current())->GetFrame()->GetFrameInterface(), + (pView ? pView : SfxViewFrame::Current())->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); if(xSet.is()) diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index baddd81ce4a1..3fdd14369856 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -342,7 +342,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons else if ( rDispat.GetFrame() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > xFrameProv( - rDispat.GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + rDispat.GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); if ( xFrameProv != xProv ) return GetSlotServer( rDispat, xFrameProv ); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 0e3209f6a05a..d2ad8c645eb7 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -217,8 +217,8 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !pBindings->GetDispatcher_Impl() || !pBindings->GetDispatcher_Impl()->GetFrame() ) return; - SfxFrame *pFrame = pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(); - SfxFrame *pParent = pFrame->GetParentFrame(); + SfxFrame& rFrame = pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(); + SfxFrame *pParent = rFrame.GetParentFrame(); if ( pParent ) // parent may intercept xDispatch = TryGetDispatch( pParent ); @@ -226,7 +226,7 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !xDispatch.is() ) { // no interception - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = rFrame.GetFrameInterface(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) xDispatch = xProv->queryDispatch( aCommand, ::rtl::OUString(), 0 ); @@ -250,7 +250,7 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !xDisp.is() && pFrame->HasComponent() ) { // no interception - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) xDisp = xProv->queryDispatch( aCommand, ::rtl::OUString(), 0 ); @@ -752,11 +752,11 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util { SfxViewFrame* pViewFrame = pDispatcher->GetFrame(); if (pViewFrame) - xFrameRef = pViewFrame->GetFrame()->GetFrameInterface(); + xFrameRef = pViewFrame->GetFrame().GetFrameInterface(); } SfxAllItemSet aInternalSet( SFX_APP()->GetPool() ); if (xFrameRef.is()) // an empty set is no problem ... but an empty frame reference can be a problem ! - aInternalSet.Put( SfxUnoAnyItem( SID_FILLFRAME, css::uno::makeAny(xFrameRef) ) ); + aInternalSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrameRef ) ); sal_Bool bSuccess = sal_False; sal_Bool bFailure = sal_False; diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index e76b38922166..66d4146d9e62 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -47,6 +47,8 @@ #include <unotools/bootstrap.hxx> #include <com/sun/star/uno/Any.h> #include <unotools/configmgr.hxx> +#include <vcl/graph.hxx> +#include <svtools/filter.hxx> #include <sfx2/sfxuno.hxx> #include "about.hxx" @@ -92,8 +94,15 @@ static bool impl_loadBitmap( SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); if ( !aStrm.GetError() ) { - Bitmap aBmp; - aStrm >> aBmp; + // Use graphic class to also support more graphic formats (bmp,png,...) + Graphic aGraphic; + + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); + + // Default case, we load the intro bitmap from a seperate file + // (e.g. staroffice_intro.bmp or starsuite_intro.bmp) + BitmapEx aBmp = aGraphic.GetBitmapEx(); rLogo = Image( aBmp ); return true; } @@ -111,6 +120,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS aDeveloperAry ( ResId( ABOUT_STR_DEVELOPER_ARY, *rId.GetResMgr() ) ), aDevVersionStr ( rVerStr ), aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ), + aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ), aTimer (), nOff ( 0 ), m_nDeltaWidth ( 0 ), @@ -151,14 +161,22 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS { bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); } if ( !bLoaded ) { bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); } // Transparenter Font @@ -231,46 +249,40 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS // determine size and position of the dialog & elements Size aAppLogoSiz = aAppLogo.GetSizePixel(); - Size aOutSiz = GetOutputSizePixel(); - aOutSiz.Width() = aAppLogoSiz.Width(); - // spacing to the margin - Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); - long nDlgMargin = a6Size.Width() * 4 ; - // The URL (if found in copyright text) should not be line-wrapped - if ( aCopyrightText.GetText().Search( WELCOME_URL ) != STRING_NOTFOUND ) - { - long nURLWidth = GetTextWidth( WELCOME_URL ) + nDlgMargin + (2*SPACE_OFFSET); - if ( nURLWidth > aAppLogoSiz.Width() ) - { - // pb: can be used to align the position of the logo - // m_nDeltaWidth = nURLWidth - aOutSiz.Width(); + Size aOutSiz = GetOutputSizePixel(); + aOutSiz.Width() = aAppLogoSiz.Width(); - aOutSiz.Width() = nURLWidth; - } - } + Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); + long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); + long nDlgMargin = a6Size.Width() * 4 ; + long nCtrlMargin = a6Size.Height() * 2; + long nTextWidth = aOutSiz.Width() - nDlgMargin; - // layout the text-elements - long nTextWidth = aOutSiz.Width() - nDlgMargin; - long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); + aCopyrightText.SetText( aCopyrightTextStr ); layoutText( aVersionText, nY, nTextWidth, a6Size ); - nY += ( a6Size.Height() / 3 ); - layoutText( aCopyrightText, nY, nTextWidth, a6Size ); - nY += ( a6Size.Height() / 3 ); - if( aBuildString.Len() > 0 ) - { - layoutText( aBuildData, nY, nTextWidth, a6Size ); - nY += ( a6Size.Height() / 2 ); - } + nY += nCtrlMargin; // OK-Button-Position (at the bottom and centered) Size aOKSiz = aOKButton.GetSizePixel(); Point aOKPnt = aOKButton.GetPosPixel(); + + // Multiline edit with Copyright-Text + Point aCopyPnt = aCopyrightText.GetPosPixel(); + Size aCopySize = aCopyrightText.GetSizePixel(); + aCopySize.Width() = nTextWidth; + aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - nCtrlMargin; + + aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; + aCopyPnt.Y() = nY; + aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); + + nY += aCopySize.Height() + nCtrlMargin; aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; - aOKPnt.Y() = nY + 8; + aOKPnt.Y() = nY; aOKButton.SetPosPixel( aOKPnt ); - nY = aOKPnt.Y() + aOKSiz.Height() + a6Size.Height(); - aOutSiz.Height() = nY; + + // Change the width of the dialog SetOutputSizePixel( aOutSiz ); FreeResource(); diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 1b15903392ba..2ea5ef5fe4b1 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -426,7 +426,7 @@ long SfxModelessDialog::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); } else if ( rEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() ) { @@ -528,7 +528,7 @@ long SfxFloatingWindow::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); } else if ( rEvt.GetType() == EVENT_LOSEFOCUS ) { diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 0f778a94f091..81c2da0ce78d 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1600,8 +1600,8 @@ class DurationDialog_Impl : public ModalDialog NumericField aMinuteNF; FixedText aSecondFT; NumericField aSecondNF; - FixedText aHSecondFT; - NumericField aHSecondNF; + FixedText aMSecondFT; + NumericField aMSecondNF; public: @@ -1613,8 +1613,9 @@ public: /*-- 20.11.2009 15:40:46--------------------------------------------------- -----------------------------------------------------------------------*/ -DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& rDuration ) : - ModalDialog( pParent, SfxResId( RID_EDIT_DURATIONS ) ), +DurationDialog_Impl::DurationDialog_Impl( + Window* pParent, const util::Duration& rDuration) + : ModalDialog( pParent, SfxResId( RID_EDIT_DURATIONS ) ), aDurationFL(this, SfxResId( FL_DURATION )), aOKPB( this, SfxResId( PB_OK )), aCancelPB( this, SfxResId( PB_CANCEL )), @@ -1632,8 +1633,8 @@ DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& aMinuteNF( this, SfxResId( ED_MINUTE )), aSecondFT( this, SfxResId( FT_SECOND )), aSecondNF( this, SfxResId( ED_SECOND )), - aHSecondFT( this, SfxResId( FT_HSECOND )), - aHSecondNF( this, SfxResId( ED_HSECOND )) + aMSecondFT( this, SfxResId( FT_MSECOND )), + aMSecondNF( this, SfxResId( ED_MSECOND )) { FreeResource(); aNegativeCB.Check(rDuration.Negative); @@ -1643,7 +1644,7 @@ DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& aHourNF.SetValue(rDuration.Hours ); aMinuteNF.SetValue(rDuration.Minutes); aSecondNF.SetValue(rDuration.Seconds); - aHSecondNF.SetValue(rDuration.HundredthSeconds); + aMSecondNF.SetValue(rDuration.MilliSeconds); } /*-- 20.11.2009 16:08:55--------------------------------------------------- @@ -1664,7 +1665,7 @@ util::Duration DurationDialog_Impl::GetDuration() const aRet.Hours = aHourNF.GetValue( ); aRet.Minutes = aMinuteNF.GetValue(); aRet.Seconds = aSecondNF.GetValue(); - aRet.HundredthSeconds = aHSecondNF.GetValue(); + aRet.MilliSeconds = aMSecondNF.GetValue(); return aRet; } diff --git a/sfx2/source/dialog/dinfdlg.hrc b/sfx2/source/dialog/dinfdlg.hrc index d5486db12470..5453e3606026 100644 --- a/sfx2/source/dialog/dinfdlg.hrc +++ b/sfx2/source/dialog/dinfdlg.hrc @@ -169,8 +169,8 @@ #define ED_MINUTE 113 #define FT_SECOND 114 #define ED_SECOND 115 -#define FT_HSECOND 116 -#define ED_HSECOND 117 +#define FT_MSECOND 116 +#define ED_MSECOND 117 #define FL_DURATION 118 #endif diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src index eaa691fe3eff..99a062c4aecf 100644 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -877,14 +877,14 @@ ModalDialog RID_EDIT_DURATIONS SpinSize = 1 ; Value = 0 ; }; - FixedText FT_HSECOND + FixedText FT_MSECOND { Pos = MAP_APPFONT ( 6 , 122 ) ; Size = MAP_APPFONT ( 60 , RSC_CD_FIXEDTEXT_HEIGHT ) ; Left = TRUE ; - Text [ en-US ] = "1/100 se~conds" ; + Text [ en-US ] = "Millise~conds" ; }; - NumericField ED_HSECOND + NumericField ED_MSECOND { Border = TRUE ; Pos = MAP_APPFONT ( 70 , 120 ) ; @@ -893,7 +893,7 @@ ModalDialog RID_EDIT_DURATIONS Spin = TRUE ; Minimum = 0 ; First = 1 ; - Last = 100 ; + Last = 1000 ; SpinSize = 1 ; Value = 0 ; }; diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 041b397d3c92..7b4e4289a49c 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -161,7 +161,7 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , if (xFactoryMgr.is()) { SfxDispatcher* pDispatcher = pBindings->GetDispatcher(); - uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); + uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); uno::Sequence< uno::Any > aArgs(2); beans::PropertyValue aPropValue; aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); @@ -1852,7 +1852,7 @@ long SfxDockingWindow::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); // In VCL geht Notify zun"achst an das Fenster selbst, // also base class rufen, sonst erf"ahrt der parent nichts diff --git a/sfx2/source/dialog/mailmodelapi.cxx b/sfx2/source/dialog/mailmodelapi.cxx index eb6bd2774419..16d12f469205 100644 --- a/sfx2/source/dialog/mailmodelapi.cxx +++ b/sfx2/source/dialog/mailmodelapi.cxx @@ -328,14 +328,6 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocument( const ::rtl::OUString& _sAt // save the document if ( xMod.is() ) { - // save old settings -/* - BOOL bModified = xMod->isModified(); - // prepare for mail export - TODO - SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher(); - pDisp->Execute( SID_MAIL_PREPAREEXPORT, SFX_CALLMODE_SYNCHRON ); -*/ // detect filter const SfxFilter* pFilter = SfxFilter::GetDefaultFilter(lcl_getFactoryName(_xModel)); // sal_Bool bHasFilter = pFilter != NULL; @@ -432,14 +424,6 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocAsPDF( const ::rtl::OUString& _sAt // save the document if ( xMod.is() ) { - /* TODO - // save old settings - BOOL bModified = xMod->isModified(); - // prepare for mail export - SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher(); - pDisp->Execute( SID_MAIL_PREPAREEXPORT, SFX_CALLMODE_SYNCHRON ); - */ - // Get PDF Filter from document ::rtl::OUString sPDFMediaType(RTL_CONSTASCII_USTRINGPARAM("application/pdf")); diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx index d6a4c05baf69..cbbe20bfa203 100644 --- a/sfx2/source/dialog/partwnd.cxx +++ b/sfx2/source/dialog/partwnd.cxx @@ -178,7 +178,7 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl if ( pBind->GetDispatcher() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier > - xSupp ( pBind->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + xSupp ( pBind->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); if ( xSupp.is() ) xSupp->getFrames()->append( xFrame ); } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 6737e8c0ffa3..93c2e0e09595 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -1788,7 +1788,7 @@ long SfxTabDialog::Notify( NotifyEvent& rNEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pViewFrame->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pViewFrame->GetFrame(), nHelpId ); } } diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index adad9cbcbf51..f46f3583cfd8 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -585,7 +585,9 @@ sal_Int32 textToDuration(::rtl::OUString const& i_rText) throw () { css::util::Duration d; if (textToDuration(d, i_rText)) { - return (d.Days * (24*3600)) + // #i107372#: approximate years/months + const sal_Int32 days( (d.Years * 365) + (d.Months * 30) + d.Days ); + return (days * (24*3600)) + (d.Hours * 3600) + (d.Minutes * 60) + d.Seconds; } else { return 0; // default @@ -608,7 +610,7 @@ sal_Int32 textToDuration(::rtl::OUString const& i_rText) throw () ud.Hours = static_cast<sal_Int16>((i_value % (24 * 3600)) / 3600); ud.Minutes = static_cast<sal_Int16>((i_value % 3600) / 60); ud.Seconds = static_cast<sal_Int16>(i_value % 60); - ud.HundredthSeconds = 0; + ud.MilliSeconds = 0; return durationToText(ud); } @@ -925,8 +927,13 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet) values.push_back(s); // #i90847# OOo 2.x does stupid things if value-type="string"; // fortunately string is default anyway, so we can just omit it -// as.push_back(std::make_pair(vt, -// ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")))); +// #i107502#: however, OOo 2.x only reads 4 user-defined without @value-type +// => best backward compatibility: first 4 without @value-type, rest with + if (4 <= i) + { + as.push_back(std::make_pair(vt, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")))); + } } else if (type == ::cppu::UnoType<css::util::DateTime>::get()) { css::util::DateTime dt; any >>= dt; @@ -948,7 +955,7 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet) ud.Hours = ut.Hours; ud.Minutes = ut.Minutes; ud.Seconds = ut.Seconds; - ud.HundredthSeconds = ut.HundredthSeconds; + ud.MilliSeconds = 10 * ut.HundredthSeconds; values.push_back(durationToText(ud)); as.push_back(std::make_pair(vt, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time")))); diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 1aac4ff97ec3..48c01a1ac3fe 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -284,6 +284,14 @@ const SvGlobalName& SfxObjectFactory::GetClassId() const return pImpl->aClassName; } +String SfxObjectFactory::GetFactoryURL() const +{ + ::rtl::OUStringBuffer aURLComposer; + aURLComposer.appendAscii( "private:factory/" ); + aURLComposer.appendAscii( GetShortName() ); + return aURLComposer.makeStringAndClear(); +} + String SfxObjectFactory::GetModuleName() const { static ::rtl::OUString SERVICENAME_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); @@ -302,10 +310,36 @@ String SfxObjectFactory::GetModuleName() const ::rtl::OUString sModuleName = aPropSet.getUnpackedValueOrDefault(PROP_MODULEUINAME, ::rtl::OUString()); return String(sModuleName); } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } + catch(const css::uno::RuntimeException&) + { throw; } catch(const css::uno::Exception&) {} return String(); } + + +sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const +{ + for ( sal_uInt16 curViewNo = 0; curViewNo < GetViewFactoryCount(); ++curViewNo ) + { + const sal_uInt16 curViewId = GetViewFactory( curViewNo ).GetOrdinal(); + if ( i_nViewId == curViewId ) + return curViewNo; + } + return i_nFallback; +} + +SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rViewName ) const +{ + for ( USHORT nViewNo = 0; + nViewNo < GetViewFactoryCount(); + ++nViewNo + ) + { + SfxViewFactory& rViewFac( GetViewFactory( nViewNo ) ); + if ( rViewFac.GetViewName() == i_rViewName ) + return &rViewFac; + } + return NULL; +} diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 0b535088b0bd..6696b7670c63 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -260,79 +260,6 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc } //---------------------------------------------------------------- -class SfxPoolCancelManager_Impl : public SfxCancelManager , - public SfxCancellable , - public SfxListener , - public SvRefBase -{ - SfxCancelManagerWeak wParent; - - ~SfxPoolCancelManager_Impl(); -public: - SfxPoolCancelManager_Impl( SfxCancelManager* pParent, const String& rName ); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - using SfxCancelManager::Cancel; - virtual void Cancel(); -}; - -//---------------------------------------------------------------- -SV_DECL_IMPL_REF( SfxPoolCancelManager_Impl ) - - -//---------------------------------------------------------------- -SfxPoolCancelManager_Impl::SfxPoolCancelManager_Impl( SfxCancelManager* pParent, const String& rName ) - : SfxCancelManager( pParent ), - SfxCancellable( pParent ? pParent : this, rName ), - wParent( pParent ) -{ - if( pParent ) - { - StartListening( *this ); - SetManager( 0 ); - } -} - -//---------------------------------------------------------------- -SfxPoolCancelManager_Impl::~SfxPoolCancelManager_Impl() -{ - for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) - { - // nicht an Parent uebernehmen! - SfxCancellable* pCbl = GetCancellable( nPos ); - if ( pCbl ) - pCbl->SetManager( 0 ); - } -} - - -//---------------------------------------------------------------- -void SfxPoolCancelManager_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/ ) -{ - if( !GetCancellableCount() ) SetManager( 0 ); - else if( !GetManager() ) - { - if( !wParent.Is() ) wParent = SFX_APP()->GetCancelManager(); - SetManager( wParent ); - } -} - -//---------------------------------------------------------------- -void SfxPoolCancelManager_Impl::Cancel() -{ - SfxPoolCancelManager_ImplRef xThis = this; - for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) - { - SfxCancellable* pCbl = GetCancellable( nPos ); - // Wenn wir nicht im Button stehen - if( pCbl && pCbl != this ) - pCbl->Cancel(); - if( GetCancellableCount() < nPos ) - nPos = GetCancellableCount(); - } -} - -//---------------------------------------------------------------- class SfxMedium_Impl : public SvCompatWeakBase { public: @@ -340,7 +267,6 @@ public: sal_Bool bUpdatePickList : 1; sal_Bool bIsTemp : 1; sal_Bool bForceSynchron : 1; - sal_Bool bDontCreateCancellable : 1; sal_Bool bDownloadDone : 1; sal_Bool bDontCallDoneLinkOnSharingError : 1; sal_Bool bIsStorage: 1; @@ -356,7 +282,6 @@ public: uno::Reference < embed::XStorage > xStorage; - SfxPoolCancelManager_ImplRef xCancelManager; SfxMedium* pAntiImpl; long nFileVersion; @@ -399,8 +324,6 @@ public: uno::Reference< logging::XSimpleLogRing > m_xLogRing; - SfxPoolCancelManager_Impl* GetCancelManager(); - SfxMedium_Impl( SfxMedium* pAntiImplP ); ~SfxMedium_Impl(); }; @@ -416,29 +339,12 @@ void SfxMedium::Cancel_Impl() SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } -SfxPoolCancelManager_Impl* SfxMedium_Impl::GetCancelManager() -{ - if( !xCancelManager.Is() ) - { - if( !bDontCreateCancellable ) - xCancelManager = new SfxPoolCancelManager_Impl( - wLoadTargetFrame ? wLoadTargetFrame->GetCancelManager() : - SFX_APP()->GetCancelManager(), - pAntiImpl->GetURLObject().GetURLNoPass() ); - else - xCancelManager = new SfxPoolCancelManager_Impl( - 0, pAntiImpl->GetURLObject().GetURLNoPass() ); - } - return xCancelManager; -} - //------------------------------------------------------------------ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) : SvCompatWeakBase( pAntiImplP ), bUpdatePickList(sal_True), bIsTemp( sal_False ), bForceSynchron( sal_False ), - bDontCreateCancellable( sal_False ), bDownloadDone( sal_True ), bDontCallDoneLinkOnSharingError( sal_False ), bIsStorage( sal_False ), @@ -2439,25 +2345,7 @@ void SfxMedium::GetMedium_Impl() } } -//------------------------------------------------------------------ -SfxPoolCancelManager_Impl* SfxMedium::GetCancelManager_Impl() const -{ - return pImp->GetCancelManager(); -} - -//------------------------------------------------------------------ -void SfxMedium::SetCancelManager_Impl( SfxPoolCancelManager_Impl* pMgr ) -{ - pImp->xCancelManager = pMgr; -} - //---------------------------------------------------------------- -void SfxMedium::CancelTransfers() -{ - if( pImp->xCancelManager.Is() ) - pImp->xCancelManager->Cancel(); -} - sal_Bool SfxMedium::IsRemote() { return bRemote; @@ -3286,13 +3174,6 @@ sal_Bool SfxMedium::IsDownloadDone_Impl() return pImp->bDownloadDone; } -//---------------------------------------------------------------- - -void SfxMedium::SetDontCreateCancellable( ) -{ - pImp->bDontCreateCancellable = sal_True; -} - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SfxMedium::GetInputStream() { if ( !pImp->xInputStream.is() ) diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 207a5096a89a..e73594af1e10 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -47,8 +47,8 @@ #include <svl/eitem.hxx> #include <svl/urihelper.hxx> #include <svl/ctloptions.hxx> -#include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/processfactory.hxx> #include <unotools/securityoptions.hxx> #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> @@ -74,7 +74,7 @@ #include "sfxhelp.hxx" #include <sfx2/dispatch.hxx> #include <sfx2/printer.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "basmgr.hxx" #include <sfx2/doctempl.hxx> #include "doc.hrc" @@ -89,9 +89,6 @@ using namespace ::com::sun::star::uno; //==================================================================== -#define SFX_WINDOWS_STREAM "SfxWindows" -#define SFX_PREVIEW_STREAM "SfxPreview" - //==================================================================== static @@ -189,252 +186,6 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig return pFile; } -//REMOVE FASTBOOL SfxObjectShell::SaveWindows_Impl( SvStorage &rStor ) const -//REMOVE { -//REMOVE SvStorageStreamRef xStream = rStor.OpenStream( DEFINE_CONST_UNICODE( SFX_WINDOWS_STREAM ), -//REMOVE STREAM_TRUNC | STREAM_STD_READWRITE); -//REMOVE if ( !xStream ) -//REMOVE return FALSE; -//REMOVE -//REMOVE xStream->SetBufferSize(1024); -//REMOVE xStream->SetVersion( rStor.GetVersion() ); -//REMOVE -//REMOVE // "uber alle Fenster iterieren (aber aktives Window zuletzt) -//REMOVE SfxViewFrame *pActFrame = SfxViewFrame::Current(); -//REMOVE if ( !pActFrame || pActFrame->GetObjectShell() != this ) -//REMOVE pActFrame = SfxViewFrame::GetFirst(this); -//REMOVE -//REMOVE String aActWinData; -//REMOVE for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame) ); pFrame; -//REMOVE pFrame = SfxViewFrame::GetNext(*pFrame, this, TYPE(SfxTopViewFrame) ) ) -//REMOVE { -//REMOVE // Bei Dokumenten, die Outplace aktiv sind, kann beim Speichern auch schon die View weg sein! -//REMOVE if ( pFrame->GetViewShell() ) -//REMOVE { -//REMOVE SfxTopFrame* pTop = (SfxTopFrame*) pFrame->GetFrame(); -//REMOVE pTop->GetTopWindow_Impl(); -//REMOVE -//REMOVE char cToken = ','; -//REMOVE const BOOL bActWin = pActFrame == pFrame; -//REMOVE String aUserData; -//REMOVE pFrame->GetViewShell()->WriteUserData(aUserData); -//REMOVE -//REMOVE // assemble ini-data -//REMOVE String aWinData; -//REMOVE aWinData += String::CreateFromInt32( pFrame->GetCurViewId() ); -//REMOVE aWinData += cToken; -//REMOVE /* -//REMOVE if ( !pWin || pWin->IsMaximized() ) -//REMOVE aWinData += SFX_WINSIZE_MAX; -//REMOVE else if ( pWin->IsMinimized() ) -//REMOVE aWinData += SFX_WINSIZE_MIN; -//REMOVE else -//REMOVE */ -//REMOVE aWinData += cToken; -//REMOVE aWinData += aUserData; -//REMOVE -//REMOVE // aktives kennzeichnen -//REMOVE aWinData += cToken; -//REMOVE aWinData += bActWin ? '1' : '0'; -//REMOVE -//REMOVE // je nachdem merken oder abspeichern -//REMOVE if ( bActWin ) -//REMOVE aActWinData = aWinData; -//REMOVE else -//REMOVE xStream->WriteByteString( aWinData ); -//REMOVE } -//REMOVE } -//REMOVE -//REMOVE // aktives Window hinterher -//REMOVE xStream->WriteByteString( aActWinData ); -//REMOVE return !xStream->GetError(); -//REMOVE } - -//==================================================================== - -SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) -{ - DBG_ASSERT( pPreferedFrame, "Call without preferred Frame is not supported anymore!" ); - if ( pImp->bLoadingWindows || !pPreferedFrame ) - return NULL; - - DBG_ASSERT( GetMedium(), "A Medium should exist here!"); - if( !GetMedium() ) - return 0; - - // get correct mode - SFX_APP(); - SfxViewFrame *pPrefered = pPreferedFrame ? pPreferedFrame->GetCurrentViewFrame() : 0; - SvtSaveOptions aOpt; - BOOL bLoadDocWins = aOpt.IsSaveDocWins() && !pPrefered; - - // try to get viewdata information for XML format - REFERENCE < XVIEWDATASUPPLIER > xViewDataSupplier( GetModel(), ::com::sun::star::uno::UNO_QUERY ); - REFERENCE < XINDEXACCESS > xViewData; - - if ( xViewDataSupplier.is() ) - { - xViewData = xViewDataSupplier->getViewData(); - if ( !xViewData.is() ) - return NULL; - } - else - return NULL; - - SfxViewFrame *pActiveFrame = 0; - String aWinData; - SfxItemSet *pSet = GetMedium()->GetItemSet(); - - pImp->bLoadingWindows = TRUE; - BOOL bLoaded = FALSE; - sal_Int32 nView = 0; - - // get saved information for all views - while ( TRUE ) - { - USHORT nViewId = 0; - FASTBOOL bMaximized=FALSE; - String aPosSize; - String aUserData; // used in the binary format - SEQUENCE < PROPERTYVALUE > aSeq; // used in the XML format - - // XML format - // active view is the first view in the container - FASTBOOL bActive = ( nView == 0 ); - - if ( nView == xViewData->getCount() ) - // finished - break; - - // get viewdata and look for the stored ViewId - ::com::sun::star::uno::Any aAny = xViewData->getByIndex( nView++ ); - if ( aAny >>= aSeq ) - { - for ( sal_Int32 n=0; n<aSeq.getLength(); n++ ) - { - const PROPERTYVALUE& rProp = aSeq[n]; - if ( rProp.Name.compareToAscii("ViewId") == COMPARE_EQUAL ) - { - ::rtl::OUString aId; - rProp.Value >>= aId; - String aTmp( aId ); - aTmp.Erase( 0, 4 ); // format is like in "view3" - nViewId = (USHORT) aTmp.ToInt32(); - break; - } - } - } - - // load only active view, but current item is not the active one ? - // in XML format the active view is the first one - if ( !bLoadDocWins && !bActive ) - break; - - // check for minimized/maximized/size - if ( aPosSize.EqualsAscii( "max" ) ) - bMaximized = TRUE; - else if ( aPosSize.EqualsAscii( "min" ) ) - { - bMaximized = TRUE; - bActive = FALSE; - } - else - bMaximized = FALSE; - - Point aPt; - Size aSz; - - pSet->ClearItem( SID_USER_DATA ); - SfxViewFrame *pFrame = 0; - if ( pPrefered ) - { - // use the frame from the arguments, but don't set a window size - pFrame = pPrefered; - if ( pFrame->GetViewShell() || !pFrame->GetObjectShell() ) - { - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - // avoid flickering controllers - SfxBindings &rBind = pFrame->GetBindings(); - rBind.ENTERREGISTRATIONS(); - - // set document into frame - pPreferedFrame->InsertDocument( this ); - - // restart controller updating - rBind.LEAVEREGISTRATIONS(); - } - else - { - // create new view - pFrame->CreateView_Impl( nViewId ); - } - } - else - { - if ( bLoadDocWins ) - { - // open in the background - pSet->Put( SfxUInt16Item( SID_VIEW_ZOOM_MODE, 0 ) ); - if ( !bMaximized ) - pSet->Put( SfxRectangleItem( SID_VIEW_POS_SIZE, Rectangle( aPt, aSz ) ) ); - } - - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - if ( pPreferedFrame ) - { - // Frame "ubergeben, allerdings ist der noch leer - pPreferedFrame->InsertDocument( this ); - pFrame = pPreferedFrame->GetCurrentViewFrame(); - } - else - { - pFrame = SfxTopFrame::Create( this, nViewId, FALSE, pSet )->GetCurrentViewFrame(); - } - - // only temporary data, don't hold it in the itemset - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->ClearItem( SID_VIEW_ZOOM_MODE ); - } - - bLoaded = TRUE; - - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pFrame && pFrame->GetViewShell() ) - { - if ( aUserData.Len() ) - pFrame->GetViewShell()->ReadUserData( aUserData, !bLoadDocWins ); - else if ( aSeq.getLength() ) - pFrame->GetViewShell()->ReadUserDataSequence( aSeq, !bLoadDocWins ); - } - - // perhaps there are more windows to load - pPreferedFrame = NULL; - - if ( bActive ) - pActiveFrame = pFrame; - - if( pPrefered || !bLoadDocWins ) - // load only active window - break; - } - - if ( pActiveFrame ) - { - if ( !pPrefered ) - // activate frame - pActiveFrame->MakeActive_Impl( TRUE ); - } - - pImp->bLoadingWindows = FALSE; - return pPrefered && bLoaded ? pPrefered : pActiveFrame; -} - //==================================================================== void SfxObjectShell::UpdateDocInfoForSave() @@ -479,13 +230,24 @@ void SfxObjectShell::UpdateDocInfoForSave() //-------------------------------------------------------------------- +static void +lcl_add(util::Duration & rDur, Time const& rTime) +{ + // here we don't care about overflow: rDur is converted back to seconds + // anyway, and Time cannot store more than ~4000 hours + rDur.Hours += rTime.GetHour(); + rDur.Minutes += rTime.GetMin(); + rDur.Seconds += rTime.GetSec(); +} + // Bearbeitungszeit aktualisieren void SfxObjectShell::UpdateTime_Impl( const uno::Reference<document::XDocumentProperties> & i_xDocProps) { // Get old time from documentinfo - sal_Int32 secs = i_xDocProps->getEditingDuration(); - Time aOldTime(secs/3600, (secs%3600)/60, secs%60); + const sal_Int32 secs = i_xDocProps->getEditingDuration(); + util::Duration editDuration(sal_False, 0, 0, 0, + secs/3600, (secs%3600)/60, secs%60, 0); // Initialize some local member! Its neccessary for wollow operations! DateTime aNow ; // Date and time at current moment @@ -522,13 +284,14 @@ void SfxObjectShell::UpdateTime_Impl( nAddTime += aNow ; } - aOldTime += nAddTime; + lcl_add(editDuration, nAddTime); } pImp->nTime = aNow; try { - i_xDocProps->setEditingDuration( - aOldTime.GetHour()*3600+aOldTime.GetMin()*60+aOldTime.GetSec()); + const sal_Int32 newSecs( (editDuration.Hours*3600) + + (editDuration.Minutes*60) + editDuration.Seconds); + i_xDocProps->setEditingDuration(newSecs); i_xDocProps->setEditingCycles(i_xDocProps->getEditingCycles() + 1); } catch (lang::IllegalArgumentException &) diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index d88fdefdfa2a..1c2105c210b9 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -305,7 +305,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, comphelper::EmbeddedObjectContainer& SfxObjectShell::GetEmbeddedObjectContainer() const { if ( !pImp->mpObjectContainer ) - pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( ((SfxObjectShell*)this)->GetStorage(), pImp->xModel ); + pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( ((SfxObjectShell*)this)->GetStorage(), GetModel() ); return *pImp->mpObjectContainer; } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 1cb88e98f59f..7d931cb6c640 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -84,7 +84,7 @@ #include <comphelper/configurationhelper.hxx> #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> -#include <com/sun/star/task/DocumentMacroConfirmationRequest2.hpp> +#include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp> #include <com/sun/star/task/InteractionClassification.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -405,17 +405,11 @@ void SfxObjectShell::ModifyChanged() return; {DBG_CHKTHIS(SfxObjectShell, 0);} - SfxObjectShell *pDoc; - for ( pDoc = SfxObjectShell::GetFirst(); pDoc; - pDoc = SfxObjectShell::GetNext(*pDoc) ) - if( pDoc->IsModified() ) - break; SfxViewFrame* pViewFrame = SfxViewFrame::Current(); if ( pViewFrame ) pViewFrame->GetBindings().Invalidate( SID_SAVEDOCS ); - Invalidate( SID_SIGNATURE ); Invalidate( SID_MACRO_SIGNATURE ); Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title... @@ -1134,7 +1128,7 @@ void SfxObjectShell::SetProgress_Impl void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame ) { SfxApplication* pSfxApp = SFX_APP(); - if ( !pSfxApp->IsDowning() && !IsLoading() && pFrame && !pFrame->GetFrame()->IsClosing_Impl() ) + if ( !pSfxApp->IsDowning() && !IsLoading() && pFrame && !pFrame->GetFrame().IsClosing_Impl() ) { SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); if ( !pHiddenItem || !pHiddenItem->GetValue() ) @@ -1165,7 +1159,6 @@ void SfxObjectShell::RegisterTransfer( SfxMedium& rMedium ) laden, muessen an der zugehoerigen SfxObjectShell angemeldet werden. So kann dokumentweise abgebrochen werden. */ { - rMedium.SetCancelManager_Impl( GetMedium()->GetCancelManager_Impl() ); rMedium.SetReferer( GetMedium()->GetName() ); } @@ -1437,8 +1430,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) } } - pImp->bInitialized = sal_True; - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); + SetInitialized_Impl( false ); // Title is not available until loading has finished Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); @@ -1557,7 +1549,7 @@ void SfxObjectShell::PositionView_Impl() sal_Bool SfxObjectShell::IsLoading() const /* [Beschreibung ] - Wurde bereits FinishedLoading aufgerufeb? */ + Has FinishedLoading been called? */ { return !( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ); } @@ -1569,7 +1561,6 @@ void SfxObjectShell::CancelTransfers() Hier koennen Transfers gecanceled werden, die nicht mit RegisterTransfer registiert wurden */ { - GetMedium()->CancelTransfers(); if( ( pImp->nLoadedFlags & SFX_LOADED_ALL ) != SFX_LOADED_ALL ) { AbortImport(); @@ -2028,12 +2019,6 @@ void SfxObjectShell::SetHeaderAttributesForSourceViewHack() ->SetAttributes(); } -void SfxObjectShell::StartLoading_Impl() -{ - pImp->nLoadedFlags = 0; - pImp->bModelInitialized = sal_False; -} - sal_Bool SfxObjectShell::IsPreview() const { if ( !pMedium ) @@ -2109,9 +2094,9 @@ void SfxObjectShell::SetWaitCursor( BOOL bSet ) const for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, this ) ) { if ( bSet ) - pFrame->GetFrame()->GetWindow().EnterWait(); + pFrame->GetFrame().GetWindow().EnterWait(); else - pFrame->GetFrame()->GetWindow().LeaveWait(); + pFrame->GetFrame().GetWindow().LeaveWait(); } } @@ -2149,13 +2134,11 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) { Window* pWindow = 0; SfxItemSet* pSet = pLoadingMedium ? pLoadingMedium->GetItemSet() : GetMedium()->GetItemSet(); - SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); if ( pUnoItem ) { - uno::Reference < frame::XFrame > xFrame; - pUnoItem->GetValue() >>= xFrame; - if ( xFrame.is() ) - pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + uno::Reference < frame::XFrame > xFrame( pUnoItem->GetFrame() ); + pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); } if ( !pWindow ) @@ -2173,7 +2156,7 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) // get any visible frame pView = SfxViewFrame::GetFirst(this); if ( pView ) - pFrame = pView->GetFrame(); + pFrame = &pView->GetFrame(); } if ( pFrame ) @@ -2242,7 +2225,7 @@ BOOL SfxObjectShell::IsInPlaceActive() return FALSE; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); - return pFrame && pFrame->GetFrame()->IsInPlace(); + return pFrame && pFrame->GetFrame().IsInPlace(); } BOOL SfxObjectShell::IsUIActive() @@ -2251,7 +2234,7 @@ BOOL SfxObjectShell::IsUIActive() return FALSE; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); - return pFrame && pFrame->GetFrame()->IsInPlace() && pFrame->GetFrame()->GetWorkWindow_Impl()->IsVisible_Impl(); + return pFrame && pFrame->GetFrame().IsInPlace() && pFrame->GetFrame().GetWorkWindow_Impl()->IsVisible_Impl(); } void SfxObjectShell::UIActivate( BOOL ) @@ -2455,9 +2438,9 @@ sal_Bool SfxObjectShell_Impl::hasTrustedScriptingSignature( sal_Bool bAllowUIToA if ( xInteraction.is() ) { - task::DocumentMacroConfirmationRequest2 aRequest; + task::DocumentMacroConfirmationRequest aRequest; aRequest.DocumentURL = getDocumentLocation(); - aRequest.DocumentZipStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl(); + aRequest.DocumentStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl(); aRequest.DocumentSignatureInformation = aInfo; aRequest.DocumentVersion = aVersion; aRequest.Classification = task::InteractionClassification_QUERY; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index b0711f919a7b..c063546da1c7 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -85,7 +85,7 @@ #include "sfxtypes.hxx" //#include "interno.hxx" #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "versdlg.hxx" #include "doc.hrc" #include <sfx2/docfac.hxx> @@ -137,8 +137,6 @@ public: #define SfxObjectShell #include "sfxslots.hxx" -svtools::AsynchronLink* pPendingCloser = 0; - //========================================================================= @@ -280,7 +278,7 @@ void SfxObjectShell::PrintExec_Impl(SfxRequest &rReq) void SfxObjectShell::PrintState_Impl(SfxItemSet &rSet) { bool bPrinting = false; - SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame)); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); if ( pFrame ) { SfxPrinter *pPrinter = pFrame->GetViewShell()->GetPrinter(); @@ -388,7 +386,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( !pFrame ) return; - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq ); return; @@ -427,28 +425,15 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // collect data for dialog String aURL, aTitle; - if ( HasName() && !pImp->aNewName.Len() ) + if ( HasName() ) { aURL = GetMedium()->GetName(); aTitle = GetTitle(); } else { - if ( !pImp->aNewName.Len() ) - { - aURL = DEFINE_CONST_UNICODE( "private:factory/" ); - aURL += String::CreateFromAscii( GetFactory().GetShortName() ); - // aTitle = String( SfxResId( STR_NONAME ) ); - } - else - { - aURL = DEFINE_CONST_UNICODE( "[private:factory/" ); - aURL += String::CreateFromAscii( GetFactory().GetShortName() ); - aURL += DEFINE_CONST_UNICODE( "]" ); - INetURLObject aURLObj( pImp->aNewName ); - aURL += String(aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI )); - // aTitle = aURLObj.GetBase(); - } + aURL = DEFINE_CONST_UNICODE( "private:factory/" ); + aURL += String::CreateFromAscii( GetFactory().GetShortName() ); aTitle = GetTitle(); } @@ -539,10 +524,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // get statusindicator uno::Reference< task::XStatusIndicator > xStatusIndicator; SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame() ) + if ( pFrame ) { uno::Reference< task::XStatusIndicatorFactory > xStatFactory( - pFrame->GetFrame()->GetFrameInterface(), + pFrame->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if( xStatFactory.is() ) xStatusIndicator = xStatFactory->createStatusIndicator(); @@ -662,9 +647,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) && pFilt->GetVersion() >= SOFFICE_FILEFORMAT_60 ) { SfxViewFrame* pDocViewFrame = SfxViewFrame::GetFirst( this ); - SfxFrame* pDocFrame = pDocViewFrame ? pDocViewFrame->GetFrame() : NULL; - if ( pDocFrame ) - SfxHelp::OpenHelpAgent( pDocFrame, HID_DID_SAVE_PACKED_XML ); + if ( pDocViewFrame ) + SfxHelp::OpenHelpAgent( &pDocViewFrame->GetFrame(), HID_DID_SAVE_PACKED_XML ); } // the StoreAsURL/StoreToURL method have called this method with false @@ -728,7 +712,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_CLOSEDOC: { SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das // aktuelle Dokument aber in einem Frame liegt, soll eigentlich @@ -743,7 +727,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { // Auf dieses Dokument existiert noch eine Sicht, die // in einem FrameSet liegt; diese darf nat"urlich nicht @@ -762,8 +746,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( !pFrame->GetFrame()->GetParentFrame() ) - pFrame->GetFrame()->DoClose(); + if ( !pFrame->GetFrame().GetParentFrame() ) + pFrame->GetFrame().DoClose(); pFrame = SfxViewFrame::GetNext( *pFrame, this ); } } @@ -937,7 +921,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) pFrame = SfxViewFrame::GetFirst( this ); if ( pFrame ) { - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { pFrame = pFrame->GetTopViewFrame(); pDoc = pFrame->GetObjectShell(); @@ -970,7 +954,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) { SfxObjectShell *pDoc = this; SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das // aktuelle Dokument aber in einem Frame liegt, soll eigentlich @@ -1190,7 +1174,7 @@ void SfxObjectShell::StateProps_Impl(SfxItemSet &rSet) case SID_CLOSING: { - rSet.Put( SfxBoolItem( SID_CLOSING, Get_Impl()->bInCloseEvent ) ); + rSet.Put( SfxBoolItem( SID_CLOSING, false ) ); break; } @@ -1215,10 +1199,9 @@ void SfxObjectShell::ExecView_Impl(SfxRequest &rReq) { case SID_ACTIVATE: { - SfxViewFrame *pFrame = - SfxViewFrame::GetFirst( this, TYPE(SfxTopViewFrame), TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, TRUE ); if ( pFrame ) - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); rReq.SetReturnValue( SfxObjectItem( 0, pFrame ) ); rReq.Done(); break; @@ -1259,21 +1242,13 @@ sal_uInt16 SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence< bool bCompleteSignature = true; if( nInfos ) { - //These errors of certificates are allowed - sal_Int32 nNonErrors = security::CertificateValidity::VALID | - security::CertificateValidity::UNKNOWN_REVOKATION; - //Build a mask to filter out the allowed errors - sal_Int32 nMask = ~nNonErrors; - nResult = SIGNATURESTATE_SIGNATURES_OK; for ( int n = 0; n < nInfos; n++ ) { if ( bCertValid ) { sal_Int32 nCertStat = aInfos[n].CertificateStatus; - // "subtract" the allowed error flags from the result - sal_Int32 nErrors = ( nCertStat & nMask ); - bCertValid = nErrors > 0 ? sal_False : sal_True; + bCertValid = nCertStat == security::CertificateValidity::VALID ? sal_True : sal_False; } if ( !aInfos[n].SignatureIsValid ) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 593de3d181f1..6d8deb85b687 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -208,31 +208,6 @@ sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd ) } //------------------------------------------------------------------------- -sal_Bool SfxObjectShell::NoDependencyFromManifest_Impl( const uno::Reference< embed::XStorage >& xStorage ) -{ - uno::Sequence< ::rtl::OUString > aElements = xStorage->getElementNames(); - for ( sal_Int32 nInd = 0; nInd < aElements.getLength(); nInd++ ) - { - if ( xStorage->isStorageElement( aElements[nInd] ) ) - { - // if there are other standard elements that do not need manifest.xml the following - // list can be extended - if ( !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Configurations" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Configurations2" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Thumbnails" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ) ) ) - { - // the substorage is not know as one that does not need manifest.xml - return sal_False; - } - } - } - - return sal_True; -} - -//------------------------------------------------------------------------- sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl( ::rtl::OUString aURL, const uno::Reference< embed::XStorage >& xDocStorage, @@ -444,23 +419,6 @@ sal_Bool SfxObjectShell::Load( SfxMedium& rMedium ) return GeneralInit_Impl( rMedium.GetStorage(), sal_True ); } -//------------------------------------------------------------------------- -sal_Bool SfxObjectShell::DoInitNew_Impl( const ::rtl::OUString& rName ) - -/* [Beschreibung] -*/ - -{ - if ( rName.getLength() ) - { - DBG_ERROR( "This code is intended to be removed, the caller part must be checked!\n" ); - return DoInitNew(0); - } - else - return DoInitNew(0); -} - - sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) /* [Beschreibung] @@ -515,9 +473,7 @@ sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) impl_addToModelCollection(xModel); } - pImp->bInitialized = sal_True; - SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); + SetInitialized_Impl( true ); return sal_True; } @@ -2815,7 +2771,6 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl pSet->ClearItem( SID_OPTIONS ); //pSet->ClearItem( SID_FILE_FILTEROPTIONS ); pSet->ClearItem( SID_VERSION ); - //pSet->ClearItem( SID_USE_FILTEROPTIONS ); pSet->ClearItem( SID_EDITDOC ); pSet->ClearItem( SID_OVERWRITE ); pSet->ClearItem( SID_DEFAULTFILEPATH ); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index e3e3a36505a5..6502eeaeb78c 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -62,6 +62,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/signaturestate.hxx> +#include <sfx2/sfxmodelfactory.hxx> #ifndef _BASIC_SBUNO_HXX #include <basic/sbuno.hxx> @@ -131,7 +132,6 @@ DBG_NAME(SfxObjectShell) #define DocumentInfo #include "sfxslots.hxx" -extern svtools::AsynchronLink* pPendingCloser; static WeakReference< XInterface > s_xCurrentComponent; //========================================================================= @@ -186,8 +186,7 @@ TYPEINIT1(SfxObjectShell, SfxShell); //-------------------------------------------------------------------- SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) -:mpObjectContainer(0) - ,pCfgMgr( 0) + :mpObjectContainer(0) ,pBasicManager( new SfxBasicManagerHolder ) ,rDocShell( _rDocShell ) ,aMacroMode( *this ) @@ -196,10 +195,8 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,nVisualDocumentNumber( USHRT_MAX) ,nDocumentSignatureState( SIGNATURESTATE_UNKNOWN ) ,nScriptingSignatureState( SIGNATURESTATE_UNKNOWN ) - ,bTemplateConfig( sal_False) ,bInList( sal_False) ,bClosing( sal_False) - ,bSetInPlaceObj( sal_False) ,bIsSaving( sal_False) ,bPasswd( sal_False) ,bIsTmp( sal_False) @@ -209,15 +206,9 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bImportDone ( sal_False) ,bInPrepareClose( sal_False ) ,bPreparedForClose( sal_False ) - ,bWaitingForPicklist( sal_False ) - ,bModuleSearched( sal_False ) - ,bIsHelpObjSh( sal_False ) - ,bForbidCaching( sal_False ) + ,bWaitingForPicklist( sal_True ) ,bForbidReload( sal_False ) - ,bSupportsEventMacros( sal_True ) - ,bLoadingWindows( sal_False ) ,bBasicInitialized( sal_False ) -// ,bHidden( sal_False ) ,bIsPrintJobCancelable( sal_True ) ,bOwnsStorage( sal_True ) ,bNoBaseURL( sal_False ) @@ -227,6 +218,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bPreserveVersions( sal_True ) ,m_bMacroSignBroken( sal_False ) ,m_bNoBasicCapabilities( sal_False ) + ,m_bDocRecoverySupport( sal_True ) ,bQueryLoadTemplate( sal_True ) ,bLoadReadonly( sal_False ) ,bUseUserData( sal_True ) @@ -235,46 +227,62 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bAllowShareControlFileClean( sal_True ) ,lErr(ERRCODE_NONE) ,nEventId ( 0) - ,bDoNotTouchDocInfo( sal_False ) ,pReloadTimer ( 0) ,pMarkData( 0 ) - ,nLoadedFlags ( SFX_LOADED_MAINDOCUMENT ) + ,nLoadedFlags ( SFX_LOADED_ALL ) ,nFlagsInProgress( 0 ) - ,bInFrame( sal_False ) ,bModalMode( sal_False ) ,bRunningMacro( sal_False ) ,bReloadAvailable( sal_False ) ,nAutoLoadLocks( 0 ) ,pModule( 0 ) - ,pFrame( 0 ) - ,pTbxConfig( 0 ) ,eFlags( SFXOBJECTSHELL_UNDEFINED ) - ,pCloser( 0 ) ,bReadOnlyUI( sal_False ) ,bHiddenLockedByAPI( sal_False ) - ,bInCloseEvent( sal_False ) ,nStyleFilter( 0 ) ,bDisposing( sal_False ) ,m_bEnableSetModified( sal_True ) ,m_bIsModified( sal_False ) ,m_nMapUnit( MAP_100TH_MM ) ,m_bCreateTempStor( sal_False ) - ,m_xDocInfoListener() ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) { + SfxObjectShell* pDoc = &_rDocShell; + SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl(); + rArr.C40_INSERT( SfxObjectShell, pDoc, rArr.Count() ); + bInList = sal_True; } //-------------------------------------------------------------------- SfxObjectShell_Impl::~SfxObjectShell_Impl() { - if ( pPendingCloser == pCloser ) - pPendingCloser = 0; - delete pCloser; delete pBasicManager; } +//-------------------------------------------------------------------- + +SfxObjectShell::SfxObjectShell( const sal_uInt64 i_nCreationFlags ) + : pImp( new SfxObjectShell_Impl( *this ) ) + , pMedium(0) + , pStyleSheetPool(0) + , eCreateMode( ( i_nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD ) + , bHasName( sal_False ) +{ + DBG_CTOR(SfxObjectShell, 0); + + const bool bScriptSupport = ( i_nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; + if ( !bScriptSupport ) + SetHasNoBasic(); + + const bool bDocRecovery = ( i_nCreationFlags & SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) == 0; + if ( !bDocRecovery ) + pImp->m_bDocRecoverySupport = sal_False; +} + +//-------------------------------------------------------------------- + // initializes a document from a file-description SfxObjectShell::SfxObjectShell @@ -308,24 +316,10 @@ SfxObjectShell::SfxObjectShell : pImp( new SfxObjectShell_Impl( *this ) ), pMedium(0), pStyleSheetPool(0), - eCreateMode(eMode) + eCreateMode(eMode), + bHasName( sal_False ) { DBG_CTOR(SfxObjectShell, 0); - - bHasName = sal_False; - nViewNo = 0; - - pImp->bWaitingForPicklist = sal_True; - - // Aggregation InPlaceObject+Automation -//(mba) AddInterface( SvDispatch::ClassFactory() ); - - SfxObjectShell *pThis = this; - SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl(); - rArr.C40_INSERT( SfxObjectShell, pThis, rArr.Count() ); - pImp->bInList = sal_True; - pImp->nLoadedFlags = SFX_LOADED_ALL; -//REMOVE SetObjectShell( TRUE ); } //-------------------------------------------------------------------- @@ -343,12 +337,8 @@ SfxObjectShell::~SfxObjectShell() // Ableitungszweig SfxInternObject ist wegen eines Compiler Bugs nicht // erlaubt SfxObjectShell::Close(); - pImp->xModel = NULL; + pImp->pBaseModel.set( NULL ); -// DELETEX(pImp->pEventConfig); -// DELETEX(pImp->pTbxConfig); -// DELETEX(pImp->pAccMgr); -// DELETEX(pImp->pCfgMgr); DELETEX(pImp->pReloadTimer ); SfxApplication *pSfxApp = SFX_APP(); @@ -361,8 +351,7 @@ SfxObjectShell::~SfxObjectShell() if ( pSfxApp->GetDdeService() ) pSfxApp->RemoveDdeTopic( this ); - if ( pImp->xModel.is() ) - pImp->xModel = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > (); + pImp->pBaseModel.set( NULL ); // don't call GetStorage() here, in case of Load Failure it's possible that a storage was never assigned! if ( pMedium && pMedium->HasStorage_Impl() && pMedium->GetStorage( sal_False ) == pImp->m_xDocStorage ) @@ -488,7 +477,7 @@ SfxObjectShell* SfxObjectShell::GetFirst continue; if ( ( !pType || pSh->IsA(*pType) ) && - ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, 0, sal_True ))) + ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, sal_True ))) return pSh; } @@ -521,7 +510,7 @@ SfxObjectShell* SfxObjectShell::GetNext continue; if ( ( !pType || pSh->IsA(*pType) ) && - ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, 0, sal_True ))) + ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, sal_True ))) return pSh; } return 0; @@ -561,12 +550,11 @@ sal_uInt16 SfxObjectShell::PrepareClose return sal_False; SfxViewFrame* pFirst = SfxViewFrame::GetFirst( this ); - if( pFirst && !pFirst->GetFrame()->PrepareClose_Impl( bUI, bForBrowsing ) ) + if( pFirst && !pFirst->GetFrame().PrepareClose_Impl( bUI, bForBrowsing ) ) return sal_False; // prepare views for closing - for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( - this, TYPE(SfxViewFrame)); + for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this ); pFrm; pFrm = SfxViewFrame::GetNext( *pFrm, this ) ) { DBG_ASSERT(pFrm->GetViewShell(),"KeineShell"); @@ -591,83 +579,69 @@ sal_uInt16 SfxObjectShell::PrepareClose // nur fuer in sichtbaren Fenstern dargestellte Dokumente fragen SfxViewFrame *pFrame = SfxObjectShell::Current() == this ? SfxViewFrame::Current() : SfxViewFrame::GetFirst( this ); - while ( pFrame && (pFrame->GetFrameType() & SFXFRAME_SERVER ) ) - pFrame = SfxViewFrame::GetNext( *pFrame, this ); sal_Bool bClose = sal_False; - if ( bUI && IsModified() ) + if ( bUI && IsModified() && pFrame ) { - if ( pFrame ) + // minimierte restoren + SfxFrame& rTop = pFrame->GetTopFrame(); + SfxViewFrame::SetViewFrame( rTop.GetCurrentViewFrame() ); + pFrame->GetFrame().Appear(); + + // fragen, ob gespeichert werden soll + short nRet = RET_YES; + //TODO/CLEANUP + //brauchen wir UI=2 noch? + //if( SfxApplication::IsPlugin() == sal_False || bUI == 2 ) { - // minimierte restoren - SfxFrame* pTop = pFrame->GetTopFrame(); - SfxViewFrame::SetViewFrame( pTop->GetCurrentViewFrame() ); - pFrame->GetFrame()->Appear(); - - // fragen, ob gespeichert werden soll - short nRet = RET_YES; - //TODO/CLEANUP - //brauchen wir UI=2 noch? - //if( SfxApplication::IsPlugin() == sal_False || bUI == 2 ) + //initiate help agent to inform about "print modifies the document" + SvtPrintWarningOptions aPrintOptions; + if (aPrintOptions.IsModifyDocumentOnPrintingAllowed() && + HasName() && getDocProperties()->getPrintDate().Month > 0) { - //initiate help agent to inform about "print modifies the document" - SvtPrintWarningOptions aPrintOptions; - if (aPrintOptions.IsModifyDocumentOnPrintingAllowed() && - HasName() && getDocProperties()->getPrintDate().Month > 0) - { - SfxHelp::OpenHelpAgent(pFirst->GetFrame(), HID_CLOSE_WARNING); - } - const Reference< XTitle > xTitle(pImp->xModel, UNO_QUERY_THROW); - const ::rtl::OUString sTitle = xTitle->getTitle (); - nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); + SfxHelp::OpenHelpAgent( &pFirst->GetFrame(), HID_CLOSE_WARNING ); } - /*HACK for plugin::destroy()*/ + const Reference< XTitle > xTitle( *pImp->pBaseModel.get(), UNO_QUERY_THROW ); + const ::rtl::OUString sTitle = xTitle->getTitle (); + nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); + } + /*HACK for plugin::destroy()*/ - if ( RET_YES == nRet ) + if ( RET_YES == nRet ) + { + // per Dispatcher speichern + const SfxPoolItem *pPoolItem; + if ( IsSaveVersionOnClose() ) { - // per Dispatcher speichern - const SfxPoolItem *pPoolItem; - if ( IsSaveVersionOnClose() ) - { - SfxStringItem aItem( SID_DOCINFO_COMMENTS, String( SfxResId( STR_AUTOMATICVERSION ) ) ); - SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); - const SfxPoolItem* ppArgs[] = { &aItem, &aWarnItem, 0 }; - pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); - } - else - { - SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); - const SfxPoolItem* ppArgs[] = { &aWarnItem, 0 }; - pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); - } - - if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) - return sal_False; - else - bClose = sal_True; + SfxStringItem aItem( SID_DOCINFO_COMMENTS, String( SfxResId( STR_AUTOMATICVERSION ) ) ); + SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); + const SfxPoolItem* ppArgs[] = { &aItem, &aWarnItem, 0 }; + pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); } - else if ( RET_CANCEL == nRet ) - // abgebrochen - return sal_False; - else if ( RET_NEWTASK == nRet ) + else { - return RET_NEWTASK; + SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); + const SfxPoolItem* ppArgs[] = { &aWarnItem, 0 }; + pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); } + + if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) + return sal_False; else - { - // Bei Nein nicht noch Informationlost bClose = sal_True; - } } - } - - // ggf. hinweisen, da\s unter Fremdformat gespeichert - if( pMedium ) - { - SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIgnoreInformationLost, - SfxBoolItem, SID_DOC_IGNOREINFORMATIONLOST, sal_False); - if( pIgnoreInformationLost && pIgnoreInformationLost->GetValue() ) - bUI = sal_False; + else if ( RET_CANCEL == nRet ) + // abgebrochen + return sal_False; + else if ( RET_NEWTASK == nRet ) + { + return RET_NEWTASK; + } + else + { + // Bei Nein nicht noch Informationlost + bClose = sal_True; + } } pImp->bPreparedForClose = sal_True; @@ -861,20 +835,6 @@ sal_Bool SfxObjectShell::DoClose() //-------------------------------------------------------------------- -void SfxObjectShell::SetLastMark_Impl( const String &rMark ) -{ - pImp->aMark = rMark; -} - -//-------------------------------------------------------------------- - -const String& SfxObjectShell::GetLastMark_Impl() const -{ - return pImp->aMark; -} - -//-------------------------------------------------------------------- - SfxObjectShell* SfxObjectShell::GetObjectShell() { return this; @@ -899,45 +859,28 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames() return *pEventNameContainer; } -SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() -{ - if (!pImp->xEventNames.getLength()) - pImp->xEventNames = GetEventNames(); - return pImp->xEventNames; -} - //-------------------------------------------------------------------- -void SfxObjectShell::SetModel( SfxBaseModel* pModel ) +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetModel() const { - OSL_ENSURE( !pImp->xModel.is() || pModel == NULL, "Model already set!" ); - pImp->xModel = pModel; - if ( pModel ) { - pModel->addCloseListener( new SfxModelListener_Impl(this) ); - //pImp->m_xDocInfoListener = new SfxDocInfoListener_Impl(*this); - //uno::Reference<util::XModifyBroadcaster> xMB( - // pModel->getDocumentProperties(), uno::UNO_QUERY_THROW); - //xMB->addModifyListener(pImp->m_xDocInfoListener); - } -} - -//-------------------------------------------------------------------- - -const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& SfxObjectShell::GetModel() const -{ - return pImp->xModel; + return GetBaseModel(); } void SfxObjectShell::SetBaseModel( SfxBaseModel* pModel ) { - SetModel(pModel); + OSL_ENSURE( !pImp->pBaseModel.is() || pModel == NULL, "Model already set!" ); + pImp->pBaseModel.set( pModel ); + if ( pImp->pBaseModel.is() ) + { + pImp->pBaseModel->addCloseListener( new SfxModelListener_Impl(this) ); + } } //-------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetBaseModel() +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetBaseModel() const { - return pImp->xModel; + return pImp->pBaseModel.get(); } /* -----------------------------10.09.2001 15:56------------------------------ @@ -1118,3 +1061,16 @@ SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, Sfx return NULL; } +void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) +{ + pImp->bInitialized = sal_True; + if ( i_fromInitNew ) + { + SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); + } + else + { + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); + } +} diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 305344baddc6..459a142b9129 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -268,7 +268,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro // Printer beschaffen SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return uno::Sequence< beans::PropertyValue >(); @@ -319,7 +319,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > { // alten Printer beschaffen SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return; @@ -582,7 +582,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // get view for sfx printing capabilities SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return; SfxViewShell* pView = pViewFrm->GetViewShell(); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 8aa0ae2a531c..e1b37c119f1a 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -70,6 +70,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <comphelper/processfactory.hxx> // can be removed when this is a "real" service #include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <svl/itemset.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> @@ -98,6 +99,9 @@ // includes of my own project //________________________________________________________________________________________________________ +#include <sfx2/sfxbasecontroller.hxx> +#include "viewfac.hxx" +#include "workwin.hxx" #include <sfx2/signaturestate.hxx> #include <sfx2/sfxuno.hxx> #include <objshimp.hxx> @@ -114,7 +118,7 @@ #include <sfx2/evntconf.hxx> #include <sfx2/sfx.hrc> #include <sfx2/app.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "appdata.hxx" #include <sfx2/docfac.hxx> #include <sfx2/fcontnr.hxx> @@ -137,11 +141,19 @@ static const ::rtl::OUString SERVICENAME_DESKTOP = ::rtl::OUString::createFromAs namespace css = ::com::sun::star; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::lang::IllegalArgumentException; +using ::com::sun::star::io::IOException; +using ::com::sun::star::lang::WrappedTargetException; +using ::com::sun::star::uno::Type; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::document::XDocumentRecovery; /** This Listener is used to get notified when the XDocumentProperties of the XModel change. - If several changes are done the "bQuiet" member can be used to - temporarily suppress notifications. */ class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XModifyListener > @@ -149,12 +161,9 @@ class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1< public: SfxObjectShell& m_rShell; - bool bQuiet; - bool bGotModified; SfxDocInfoListener_Impl( SfxObjectShell& i_rDoc ) : m_rShell(i_rDoc) - , bQuiet(false) { }; ~SfxDocInfoListener_Impl(); @@ -171,12 +180,9 @@ void SAL_CALL SfxDocInfoListener_Impl::modified( const lang::EventObject& ) throw ( uno::RuntimeException ) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - bGotModified = true; // notify changes to the SfxObjectShell - if ( !bQuiet ) { - m_rShell.FlushDocInfo(); - } + m_rShell.FlushDocInfo(); } void SAL_CALL SfxDocInfoListener_Impl::disposing( const lang::EventObject& ) @@ -212,6 +218,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument sal_Bool m_bClosing ; sal_Bool m_bSaving ; sal_Bool m_bSuicide ; + sal_Bool m_bInitialized ; + sal_Bool m_bModifiedSinceLastSave; uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ; uno::Reference< script::provider::XScriptProvider > m_xScriptProvider; uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager; @@ -230,6 +238,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument , m_bClosing ( sal_False ) , m_bSaving ( sal_False ) , m_bSuicide ( sal_False ) + , m_bInitialized ( sal_False ) + , m_bModifiedSinceLastSave( sal_False ) , m_pStorageModifyListen ( NULL ) , m_xTitleHelper () , m_xNumberedControllers () @@ -357,41 +367,40 @@ SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell* pObjectShell ) if ( !pObjectShell ) return; - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pObjectShell, TYPE(SfxTopViewFrame) ); pFrame; - pFrame = SfxViewFrame::GetNext(*pFrame, pObjectShell, TYPE(SfxTopViewFrame) ) ) + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pObjectShell ); + pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pObjectShell ) + ) { - SfxFrame* pSfxFrame = pFrame->GetFrame(); - if ( pSfxFrame ) + SfxFrame& rSfxFrame = pFrame->GetFrame(); + try { - try + // get vcl window related to the frame and lock it if it is still not locked + uno::Reference< frame::XFrame > xFrame = rSfxFrame.GetFrameInterface(); + Window* pWindow = GetVCLWindow( xFrame ); + if ( !pWindow ) + throw uno::RuntimeException(); + + if ( pWindow->IsEnabled() ) { - // get vcl window related to the frame and lock it if it is still not locked - uno::Reference< frame::XFrame > xFrame = pSfxFrame->GetFrameInterface(); - Window* pWindow = GetVCLWindow( xFrame ); - if ( !pWindow ) - throw uno::RuntimeException(); + pWindow->Disable(); - if ( pWindow->IsEnabled() ) + try { - pWindow->Disable(); - - try - { - sal_Int32 nLen = m_aLockedFrames.getLength(); - m_aLockedFrames.realloc( nLen + 1 ); - m_aLockedFrames[nLen] = xFrame; - } - catch( uno::Exception& ) - { - pWindow->Enable(); - throw; - } + sal_Int32 nLen = m_aLockedFrames.getLength(); + m_aLockedFrames.realloc( nLen + 1 ); + m_aLockedFrames[nLen] = xFrame; + } + catch( uno::Exception& ) + { + pWindow->Enable(); + throw; } } - catch( uno::Exception& ) - { - OSL_ENSURE( sal_False, "Not possible to lock the frame window!\n" ); - } + } + catch( uno::Exception& ) + { + OSL_ENSURE( sal_False, "Not possible to lock the frame window!\n" ); } } } @@ -522,6 +531,7 @@ SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell ) : BaseMutex() , m_pData( new IMPL_SfxBaseModel_DataContainer( m_aMutex, pObjectShell ) ) , m_bSupportEmbeddedScripts( pObjectShell && pObjectShell->Get_Impl() ? !pObjectShell->Get_Impl()->m_bNoBasicCapabilities : false ) +, m_bSupportDocRecovery( pObjectShell && pObjectShell->Get_Impl() ? pObjectShell->Get_Impl()->m_bDocRecoverySupport : false ) { DBG_CTOR(sfx2_SfxBaseModel,NULL); if ( pObjectShell != NULL ) @@ -545,7 +555,9 @@ SfxBaseModel::~SfxBaseModel() uno::Any SAL_CALL SfxBaseModel::queryInterface( const UNOTYPE& rType ) throw( uno::RuntimeException ) { - if ( !m_bSupportEmbeddedScripts && rType.equals( XEMBEDDEDSCRIPTS::static_type() ) ) + if ( ( !m_bSupportEmbeddedScripts && rType.equals( XEMBEDDEDSCRIPTS::static_type() ) ) + || ( !m_bSupportDocRecovery && rType.equals( XDocumentRecovery::static_type() ) ) + ) return Any(); return SfxBaseModel_Base::queryInterface( rType ); @@ -581,21 +593,31 @@ void SAL_CALL SfxBaseModel::release() throw( ) // XTypeProvider //________________________________________________________________________________________________________ -uno::Sequence< UNOTYPE > SAL_CALL SfxBaseModel::getTypes() throw( uno::RuntimeException ) +namespace { - uno::Sequence< UNOTYPE > aTypes( SfxBaseModel_Base::getTypes() ); - if ( !m_bSupportEmbeddedScripts ) + void lcl_stripType( Sequence< Type >& io_rTypes, const Type& i_rTypeToStrip ) { - // remove XEmbeddedScripts type from the sequence - Sequence< UNOTYPE > aStrippedTypes( aTypes.getLength() - 1 ); + Sequence< UNOTYPE > aStrippedTypes( io_rTypes.getLength() - 1 ); ::std::remove_copy_if( - aTypes.getConstArray(), - aTypes.getConstArray() + aTypes.getLength(), + io_rTypes.getConstArray(), + io_rTypes.getConstArray() + io_rTypes.getLength(), aStrippedTypes.getArray(), - ::std::bind2nd( ::std::equal_to< UNOTYPE >(), XEMBEDDEDSCRIPTS::static_type() ) + ::std::bind2nd( ::std::equal_to< Type >(), i_rTypeToStrip ) ); - aTypes = aStrippedTypes; + io_rTypes = aStrippedTypes; } +} + +uno::Sequence< UNOTYPE > SAL_CALL SfxBaseModel::getTypes() throw( uno::RuntimeException ) +{ + uno::Sequence< UNOTYPE > aTypes( SfxBaseModel_Base::getTypes() ); + + if ( !m_bSupportEmbeddedScripts ) + lcl_stripType( aTypes, XEMBEDDEDSCRIPTS::static_type() ); + + if ( !m_bSupportDocRecovery ) + lcl_stripType( aTypes, XDocumentRecovery::static_type() ); + return aTypes; } @@ -648,9 +670,7 @@ uno::Reference< script::XStarBasicAccess > implGetStarBasicAccess( SfxObjectShel uno::Reference< XNAMECONTAINER > SAL_CALL SfxBaseModel::getLibraryContainer() throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -669,9 +689,7 @@ void SAL_CALL SfxBaseModel::createLibrary( const ::rtl::OUString& LibName, const const ::rtl::OUString& ExternalSourceURL, const ::rtl::OUString& LinkTargetURL ) throw(ELEMENTEXISTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -688,9 +706,7 @@ void SAL_CALL SfxBaseModel::addModule( const ::rtl::OUString& LibraryName, const const ::rtl::OUString& Language, const ::rtl::OUString& Source ) throw( NOSUCHELEMENTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -707,9 +723,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const const ::com::sun::star::uno::Sequence< sal_Int8 >& Data ) throw(NOSUCHELEMENTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -726,9 +740,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_xParent; } @@ -739,7 +751,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno: void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& Parent) throw(NOSUPPORTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_xParent = Parent; } @@ -749,11 +761,7 @@ void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& P void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - // object already disposed? - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_bClosed ) { @@ -812,11 +820,7 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTENER >& aListener ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } @@ -827,11 +831,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTEN void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLISTENER >& aListener ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } @@ -841,11 +841,7 @@ void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLIS uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_xDocumentInfo.is() ) { // WARNING: this will only work if (when loading a document) the @@ -891,11 +887,7 @@ uno::Reference< document::XDocumentProperties > SAL_CALL SfxBaseModel::getDocumentProperties() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_xDocumentProperties.is() ) { uno::Reference< lang::XInitialization > xDocProps( @@ -943,10 +935,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& const uno::Sequence< beans::PropertyValue >& rArgs ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( rURL.getLength() == 0 && rArgs.getLength() == 1 && rArgs[0].Name.equalsAscii( "SetEmbedded" ) ) { // allows to set a windowless document to EMBEDDED state @@ -964,53 +953,50 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& if ( m_pData->m_pObjectShell.Is() ) { m_pData->m_sURL = rURL; - uno::Sequence< beans::PropertyValue > aNewSeqArgs( rArgs.getLength() ); - sal_Int32 nNewLen = 0; - for ( sal_Int32 nInd = 0; nInd < rArgs.getLength(); nInd++ ) + SfxObjectShell* pObjectShell = m_pData->m_pObjectShell; + + ::comphelper::NamedValueCollection aArgs( rArgs ); + + Sequence< sal_Int32 > aWinExtent; + if ( ( aArgs.get( "WinExtent" ) >>= aWinExtent )&& ( aWinExtent.getLength() == 4 ) ) { - if ( rArgs[nInd].Name.equalsAscii( "WinExtent" ) ) - { - Sequence< sal_Int32 > aSize; - if ( ( rArgs[nInd].Value >>= aSize ) && aSize.getLength() == 4 ) - { - Rectangle aTmpRect( aSize[0], aSize[1], aSize[2], aSize[3] ); - aTmpRect = OutputDevice::LogicToLogic( aTmpRect, MAP_100TH_MM, m_pData->m_pObjectShell->GetMapUnit() ); - m_pData->m_pObjectShell->SetVisArea( aTmpRect ); - } - } - else if ( rArgs[nInd].Name.equalsAscii( "BreakMacroSignature" ) ) - { - sal_Bool bBreakMacroSign = sal_False; - rArgs[nInd].Value >>= bBreakMacroSign; - m_pData->m_pObjectShell->BreakMacroSign_Impl( bBreakMacroSign ); - } - else if ( !rArgs[nInd].Name.equalsAscii( "Stream" ) && !rArgs[nInd].Name.equalsAscii( "InputStream" ) ) - { - // TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be ignored here - aNewSeqArgs[nNewLen++] = rArgs[nInd]; - } + Rectangle aVisArea( aWinExtent[0], aWinExtent[1], aWinExtent[2], aWinExtent[3] ); + aVisArea = OutputDevice::LogicToLogic( aVisArea, MAP_100TH_MM, pObjectShell->GetMapUnit() ); + pObjectShell->SetVisArea( aVisArea ); + } + + sal_Bool bBreakMacroSign = sal_False; + if ( aArgs.get( "BreakMacroSignature" ) >>= bBreakMacroSign ) + { + pObjectShell->BreakMacroSign_Impl( bBreakMacroSign ); } - aNewSeqArgs.realloc( nNewLen ); + aArgs.remove( "WinExtent" ); + aArgs.remove( "BreakMacroSignature" ); + aArgs.remove( "Stream" ); + aArgs.remove( "InputStream" ); - m_pData->m_seqArguments = aNewSeqArgs; + // TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be removed here - if( m_pData->m_pObjectShell->GetMedium() ) + m_pData->m_seqArguments = aArgs.getPropertyValues(); + + SfxMedium* pMedium = pObjectShell->GetMedium(); + if ( pMedium ) { - SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); + SfxAllItemSet aSet( pObjectShell->GetPool() ); TransformParameters( SID_OPENDOC, rArgs, aSet ); - m_pData->m_pObjectShell->GetMedium()->GetItemSet()->Put( aSet ); + pMedium->GetItemSet()->Put( aSet ); SFX_ITEMSET_ARG( &aSet, pItem, SfxStringItem, SID_FILTER_NAME, sal_False ); if ( pItem ) - m_pData->m_pObjectShell->GetMedium()->SetFilter( - m_pData->m_pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( pItem->GetValue() ) ); + pMedium->SetFilter( + pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( pItem->GetValue() ) ); SFX_ITEMSET_ARG( &aSet, pTitleItem, SfxStringItem, SID_DOCINFO_TITLE, sal_False ); if ( pTitleItem ) { - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjectShell ); if ( pFrame ) pFrame->UpdateTitle(); } @@ -1026,10 +1012,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& ::rtl::OUString SAL_CALL SfxBaseModel::getURL() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this ); return m_pData->m_sURL ; } @@ -1039,10 +1022,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { uno::Sequence< beans::PropertyValue > seqArgsNew; @@ -1142,9 +1122,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::c void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + OSL_PRECOND( xController.is(), "SfxBaseModel::connectController: invalid controller!" ); + if ( !xController.is() ) + return; sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); uno::Sequence< uno::Reference< frame::XController > > aNewSeq( nOldCount + 1 ); @@ -1152,6 +1133,16 @@ void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XCon aNewSeq.getArray()[n] = m_pData->m_seqControllers.getConstArray()[n]; aNewSeq.getArray()[nOldCount] = xController; m_pData->m_seqControllers = aNewSeq; + + if ( m_pData->m_seqControllers.getLength() == 1 ) + { + SfxViewFrame* pViewFrame = SfxViewFrame::Get( xController, GetObjectShell() ); + ENSURE_OR_THROW( pViewFrame, "SFX document without SFX view!?" ); + pViewFrame->UpdateDocument_Impl(); + const String sDocumentURL = GetObjectShell()->GetMedium()->GetName(); + if ( sDocumentURL.Len() ) + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sDocumentURL ) ); + } } //________________________________________________________________________________________________________ @@ -1160,9 +1151,7 @@ void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XCon void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); if ( !nOldCount ) @@ -1190,9 +1179,8 @@ void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::X void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + ++m_pData->m_nControllerLockCount ; } @@ -1202,9 +1190,8 @@ void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::Runti void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + --m_pData->m_nControllerLockCount ; } @@ -1214,9 +1201,7 @@ void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::Run sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return ( m_pData->m_nControllerLockCount != 0 ) ; } @@ -1226,10 +1211,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::u uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); // get the last active controller of this model if ( m_pData->m_xCurrent.is() ) @@ -1246,10 +1228,7 @@ uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::XController >& xCurrentController ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); m_pData->m_xCurrent = xCurrentController; } @@ -1260,10 +1239,7 @@ void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::X uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< uno::XInterface > xReturn; uno::Reference< frame::XController > xController = getCurrentController() ; @@ -1287,9 +1263,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() t sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1302,9 +1276,7 @@ sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::un sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1317,9 +1289,7 @@ sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1333,10 +1303,7 @@ sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star:: sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsModified() : sal_False; } @@ -1348,10 +1315,7 @@ sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::Runtim void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) m_pData->m_pObjectShell->SetModified(bModified); @@ -1363,10 +1327,7 @@ void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified ) void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0),xListener ); } @@ -1377,10 +1338,7 @@ void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTE void SAL_CALL SfxBaseModel::removeModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0), xListener ); } @@ -1394,7 +1352,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo static ::rtl::OUString MSG_1 = ::rtl::OUString::createFromAscii("Cant close while saving."); ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !m_pData || m_pData->m_bClosed || m_pData->m_bClosing ) + if ( impl_isDisposed() || m_pData->m_bClosed || m_pData->m_bClosing ) return; uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) ); @@ -1456,10 +1414,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener ); } @@ -1470,10 +1425,7 @@ void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTEN void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener ); } @@ -1484,10 +1436,7 @@ void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELIS uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) return m_pData->m_xPrintable->getPrinter(); @@ -1498,10 +1447,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw( void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) m_pData->m_xPrintable->setPrinter( rPrinter ); @@ -1510,10 +1456,7 @@ void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& rOptions) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) m_pData->m_xPrintable->print( rOptions ); @@ -1525,10 +1468,7 @@ void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& r sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->HasName() : sal_False; } @@ -1539,10 +1479,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti ::rtl::OUString SAL_CALL SfxBaseModel::getLocation() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1562,10 +1499,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti sal_Bool SAL_CALL SfxBaseModel::isReadonly() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsReadOnly() : sal_True; } @@ -1581,10 +1515,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa { RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeSelf" ); - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1682,10 +1613,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString& { RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeAsURL" ); - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1708,10 +1636,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& const uno::Sequence< beans::PropertyValue >& rArgs ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1721,6 +1646,51 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& } } +::sal_Bool SAL_CALL SfxBaseModel::wasModifiedSinceLastSave() throw ( RuntimeException ) +{ + SfxModelGuard aGuard( *this ); + return m_pData->m_bModifiedSinceLastSave; +} + +void SAL_CALL SfxBaseModel::storeToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + SfxModelGuard aGuard( *this ); + + // delegate + SfxSaveGuard aSaveGuard( this, m_pData, sal_False ); + impl_store( i_TargetLocation, i_MediaDescriptor, sal_True ); + + // no need for subsequent calls to storeToRecoveryFile, unless we're modified, again + m_pData->m_bModifiedSinceLastSave = sal_False; +} + +void SAL_CALL SfxBaseModel::recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + + // delegate to our "load" method + ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); + + // our load implementation expects the SalvagedFile to be in the media descriptor + OSL_ENSURE( !aMediaDescriptor.has( "SalvagedFile" ) || ( aMediaDescriptor.getOrDefault( "SalvagedFile", ::rtl::OUString() ) == i_SalvagedFile ), + "SfxBaseModel::recoverFromFile: inconsistent information!" ); + aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); + + // similar for the to-be-loaded file + OSL_ENSURE( !aMediaDescriptor.has( "URL" ) || ( aMediaDescriptor.getOrDefault( "URL", ::rtl::OUString() ) == i_SourceLocation ), + "SfxBaseModel::recoverFromFile: inconsistent information!" ); + aMediaDescriptor.put( "URL", i_SourceLocation ); + + load( aMediaDescriptor.getPropertyValues() ); + + // Note: The XDocumentRecovery interface specification requires us to do an attachResource after loading. + // However, we will not do this here, as we know that our load implementation (respectively some method + // called from there) already did so. + // In particular, the load process might already have modified some elements of the media + // descriptor, for instance the MacroExecMode (in case the user was involved to decide about it), and we do + // not want to overwrite it with the "old" elements passed to this method here. +} + //________________________________________________________________________________________________________ // XLoadable //________________________________________________________________________________________________________ @@ -1731,10 +1701,9 @@ void SAL_CALL SfxBaseModel::initNew() ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); // the object shell should exist always DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); @@ -1763,10 +1732,9 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); // the object shell should exist always DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); @@ -1910,6 +1878,13 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& nError ? nError : ERRCODE_IO_CANTREAD ); } } + + BOOL bHidden = FALSE; + SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); + if ( pHidItem ) + bHidden = pHidItem->GetValue(); + // !TODO: will be done by Framework! + pMedium->SetUpdatePickList( !bHidden ); } } @@ -1922,10 +1897,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Any aAny; @@ -2164,10 +2136,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors() throw (::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); sal_Int32 nSuppFlavors = GraphicHelper::supportsMetaFileHandle_Impl() ? 10 : 8; uno::Sequence< DATAFLAVOR > aFlavorSeq( nSuppFlavors ); @@ -2236,10 +2205,7 @@ uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors() sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor ) throw (::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) ) { @@ -2298,10 +2264,7 @@ sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xEvents.is() ) { @@ -2317,9 +2280,7 @@ uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() thr uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getBasicLibraries() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries; if ( m_pData->m_pObjectShell ) @@ -2329,9 +2290,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getDialogLibraries() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries; if ( m_pData->m_pObjectShell ) @@ -2341,9 +2300,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g ::sal_Bool SAL_CALL SfxBaseModel::getAllowMacroExecution() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell ) return m_pData->m_pObjectShell->AdjustMacroMode( String(), false ); @@ -2356,9 +2313,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContainer() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); Reference< document::XEmbeddedScripts > xDocumentScripts; @@ -2394,10 +2349,7 @@ Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContaine void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener ); } @@ -2408,10 +2360,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLIS void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener ); } @@ -2489,7 +2438,9 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , if ( pNamedHint ) { - if ( SFX_EVENT_STORAGECHANGED == pNamedHint->GetEventId() ) + switch ( pNamedHint->GetEventId() ) + { + case SFX_EVENT_STORAGECHANGED: { // for now this event is sent only on creation of a new storage for new document // and in case of reload of medium without document reload @@ -2520,12 +2471,17 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); } - else if ( SFX_EVENT_LOADFINISHED == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_LOADFINISHED: { impl_getPrintHelper(); ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); + m_pData->m_bModifiedSinceLastSave = sal_False; } - else if ( SFX_EVENT_SAVEASDOCDONE == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_SAVEASDOCDONE: { m_pData->m_sURL = m_pData->m_pObjectShell->GetMedium()->GetName(); @@ -2536,9 +2492,20 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , addTitle_Impl( aArgs, aTitle ); attachResource( m_pData->m_pObjectShell->GetMedium()->GetName(), aArgs ); } - else if ( SFX_EVENT_DOCCREATED == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_DOCCREATED: { impl_getPrintHelper(); + m_pData->m_bModifiedSinceLastSave = sal_False; + } + break; + + case SFX_EVENT_MODIFYCHANGED: + { + m_pData->m_bModifiedSinceLastSave = isModified(); + } + break; } postEvent_Impl( pNamedHint->GetEventName() ); @@ -2572,36 +2539,29 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , // public impl. //________________________________________________________________________________________________________ +void SfxBaseModel::NotifyModifyListeners_Impl() const +{ + ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); + if ( pIC ) + { + lang::EventObject aEvent( (frame::XModel *)this ); + pIC->notifyEach( &util::XModifyListener::modified, aEvent ); + } + + // this notification here is done too generously, we cannot simply assume that we're really modified + // now, but we need to check it ... + m_pData->m_bModifiedSinceLastSave = const_cast< SfxBaseModel* >( this )->isModified(); +} + void SfxBaseModel::changing() { - // object already disposed? - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); // the notification should not be sent if the document can not be modified if ( !m_pData->m_pObjectShell.Is() || !m_pData->m_pObjectShell->IsEnableSetModified() ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); - if( pIC ) - - { - lang::EventObject aEvent( (frame::XModel *)this ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - try - { - ((XMODIFYLISTENER *)aIt.next())->modified( aEvent ); - } - catch( uno::RuntimeException& ) - { - aIt.remove(); - } - } - } + NotifyModifyListeners_Impl(); } void SfxBaseModel::impl_change() @@ -2610,24 +2570,7 @@ void SfxBaseModel::impl_change() if ( impl_isDisposed() ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); - if( pIC ) - - { - lang::EventObject aEvent( (frame::XModel *)this ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - try - { - ((XMODIFYLISTENER *)aIt.next())->modified( aEvent ); - } - catch( uno::RuntimeException& ) - { - aIt.remove(); - } - } - } + NotifyModifyListeners_Impl(); } //________________________________________________________________________________________________________ @@ -2653,6 +2596,17 @@ sal_Bool SfxBaseModel::IsDisposed() const return ( m_pData == NULL ) ; } +sal_Bool SfxBaseModel::IsInitialized() const +{ + if ( !m_pData || !m_pData->m_pObjectShell ) + { + OSL_ENSURE( false, "SfxBaseModel::IsInitialized: this should have been caught earlier!" ); + return sal_False; + } + + return m_pData->m_pObjectShell->GetMedium() != NULL; +} + sal_Bool SfxBaseModel::impl_isDisposed() const { return ( m_pData == NULL ) ; @@ -2920,16 +2874,13 @@ void SfxBaseModel::postEvent_Impl( ::rtl::OUString aName ) uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() && !m_pData->m_contViewData.is() ) { SfxViewFrame *pActFrame = SfxViewFrame::Current(); if ( !pActFrame || pActFrame->GetObjectShell() != m_pData->m_pObjectShell ) - pActFrame = SfxViewFrame::GetFirst(m_pData->m_pObjectShell, TYPE(SfxTopViewFrame)); + pActFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); if ( !pActFrame || !pActFrame->GetViewShell() ) // currently no frame for this document at all or View is under construction @@ -2950,8 +2901,8 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() sal_Int32 nCount = 0; uno::Sequence < beans::PropertyValue > aSeq; ::com::sun::star::uno::Any aAny; - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(m_pData->m_pObjectShell, TYPE(SfxTopViewFrame) ); pFrame; - pFrame = SfxViewFrame::GetNext(*pFrame, m_pData->m_pObjectShell, TYPE(SfxTopViewFrame) ) ) + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, m_pData->m_pObjectShell ) ) { BOOL bIsActive = ( pFrame == pActFrame ); pFrame->GetViewShell()->WriteUserDataSequence( aSeq ); @@ -2966,10 +2917,7 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() void SAL_CALL SfxBaseModel::setViewData( const uno::Reference < container::XIndexAccess >& aData ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); m_pData->m_contViewData = aData; } @@ -3009,10 +2957,7 @@ sal_Bool SfxBaseModel::hasEventListeners() const void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( impl_getPrintHelper() ) { @@ -3026,10 +2971,7 @@ void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPr void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) { @@ -3048,7 +2990,7 @@ class SvObject; sal_Int64 SAL_CALL SfxBaseModel::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !impl_isDisposed() && GetObjectShell() ) + if ( GetObjectShell() ) { SvGlobalName aName( aIdentifier ); if ( aName == SvGlobalName( SO3_GLOBAL_CLASSID ) ) @@ -3082,9 +3024,7 @@ void SfxBaseModel::ListenForStorage_Impl( const uno::Reference< embed::XStorage uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentSubStorage( const ::rtl::OUString& aStorageName, sal_Int32 nMode ) throw ( uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( m_pData->m_pObjectShell.Is() ) @@ -3109,9 +3049,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() throw ( io::IOException, RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); Sequence< ::rtl::OUString > aResult; sal_Int32 nResultSize = 0; @@ -3150,9 +3088,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() uno::Reference< script::provider::XScriptProvider > SAL_CALL SfxBaseModel::getScriptProvider() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::provider::XScriptProvider > xScriptProvider; @@ -3258,9 +3194,7 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, uno::Reference< contai uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfigurationManager() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_xUIConfigurationManager.is() ) { @@ -3376,17 +3310,15 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz uno::Exception, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling - SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ); - if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pViewFrm->GetFrame()->IsInPlace() ) + SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ); + if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pViewFrm->GetFrame().IsInPlace() ) { - Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame()->GetFrameInterface()->getContainerWindow() ); + Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame().GetFrameInterface()->getContainerWindow() ); Size aWinSize = pWindow->GetSizePixel(); awt::Size aCurrent = getVisualAreaSize( nAspect ); Size aDiff( aSize.Width-aCurrent.Width, aSize.Height-aCurrent.Height ); @@ -3410,9 +3342,7 @@ awt::Size SAL_CALL SfxBaseModel::getVisualAreaSize( sal_Int64 /*nAspect*/ ) uno::Exception, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling @@ -3441,9 +3371,7 @@ sal_Int32 SAL_CALL SfxBaseModel::getMapUnit( sal_Int64 /*nAspect*/ ) throw ( uno::Exception, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling @@ -3457,9 +3385,7 @@ embed::VisualRepresentation SAL_CALL SfxBaseModel::getPreferredVisualRepresentat uno::Exception, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); datatransfer::DataFlavor aDataFlavor( ::rtl::OUString::createFromAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ), @@ -3485,44 +3411,34 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const uno::Reference< XSTORAGE >& x EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); - if ( !m_pData->m_pObjectShell.Is() ) - throw IOEXCEPTION(); // TODO: + // after i36090 is fixed the pool from object shell can be used + // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); + SfxAllItemSet aSet( SFX_APP()->GetPool() ); - if ( m_pData->m_pObjectShell.Is() ) - { - if( m_pData->m_pObjectShell->GetMedium() ) - // if a Medium is present, the document is already initialized - throw DOUBLEINITIALIZATIONEXCEPTION(); + // the BaseURL is part of the ItemSet + SfxMedium* pMedium = new SfxMedium( xStorage, String() ); + TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet ); + pMedium->GetItemSet()->Put( aSet ); - // after i36090 is fixed the pool from object shell can be used - // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); - SfxAllItemSet aSet( SFX_APP()->GetPool() ); + // allow to use an interactionhandler (if there is one) + pMedium->UseInteractionHandler( TRUE ); - // the BaseURL is part of the ItemSet - SfxMedium* pMedium = new SfxMedium( xStorage, String() ); - TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet ); - pMedium->GetItemSet()->Put( aSet ); - - // allow to use an interactionhandler (if there is one) - pMedium->UseInteractionHandler( TRUE ); - - SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); - BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue(); - m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); - m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; + SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); + BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue(); + m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); + m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; - // load document - if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) - { - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); - throw task::ErrorCodeIOException( ::rtl::OUString(), - uno::Reference< uno::XInterface >(), - nError ? nError : ERRCODE_IO_CANTREAD ); - } + // load document + if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) + { + sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + throw task::ErrorCodeIOException( ::rtl::OUString(), + uno::Reference< uno::XInterface >(), + nError ? nError : ERRCODE_IO_CANTREAD ); } } @@ -3533,9 +3449,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const uno::Reference< XSTORAGE >& xS EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3596,9 +3510,7 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3622,9 +3534,7 @@ uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentStorage() EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3637,9 +3547,7 @@ void SAL_CALL SfxBaseModel::addStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener ); @@ -3649,9 +3557,7 @@ void SAL_CALL SfxBaseModel::removeStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener ); @@ -3677,9 +3583,7 @@ bool SfxBaseModel::impl_getPrintHelper() void SAL_CALL SfxBaseModel::setIdentifier(const ::rtl::OUString& Identifier) throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_sModuleIdentifier = Identifier; } @@ -3688,9 +3592,7 @@ bool SfxBaseModel::impl_getPrintHelper() ::rtl::OUString SAL_CALL SfxBaseModel::getIdentifier() throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return ::rtl::OUString(); + SfxModelGuard aGuard( *this ); if (m_pData->m_sModuleIdentifier.getLength() > 0) return m_pData->m_sModuleIdentifier; if (m_pData->m_pObjectShell) @@ -3701,10 +3603,7 @@ bool SfxBaseModel::impl_getPrintHelper() //============================================================================= css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return css::uno::Reference< css::frame::XTitle >(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xTitleHelper.is ()) { @@ -3724,10 +3623,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () //============================================================================= css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitledHelper () { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return css::uno::Reference< css::frame::XUntitledNumbers >(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xNumberedControllers.is ()) { @@ -3749,10 +3645,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return ::rtl::OUString(); + SfxModelGuard aGuard( *this ); ::rtl::OUString aResult = impl_getTitleHelper()->getTitle (); if ( m_pData->m_pObjectShell ) @@ -3783,10 +3676,7 @@ void SAL_CALL SfxBaseModel::setTitle( const ::rtl::OUString& sTitle ) throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); impl_getTitleHelper()->setTitle (sTitle); } @@ -3797,10 +3687,7 @@ void SAL_CALL SfxBaseModel::addTitleChangeListener( const css::uno::Reference< c throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY); if (xBroadcaster.is ()) @@ -3813,10 +3700,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY); if (xBroadcaster.is ()) @@ -3829,10 +3713,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return css::frame::UntitledNumbersConst::INVALID_NUMBER; + SfxModelGuard aGuard( *this ); return impl_getUntitledHelper ()->leaseNumber (xComponent); } @@ -3843,11 +3724,7 @@ void SAL_CALL SfxBaseModel::releaseNumber( ::sal_Int32 nNumber ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this ); impl_getUntitledHelper ()->releaseNumber (nNumber); } @@ -3857,11 +3734,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this ); impl_getUntitledHelper ()->releaseNumberForComponent (xComponent); } @@ -3870,11 +3743,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference ::rtl::OUString SAL_CALL SfxBaseModel::getUntitledPrefix() throw (css::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return ::rtl::OUString (); - + SfxModelGuard aGuard( *this ); return impl_getUntitledHelper ()->getUntitledPrefix (); } @@ -3883,10 +3752,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getControllers() throw (css::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return css::uno::Reference< css::container::XEnumeration >(); + SfxModelGuard aGuard( *this ); sal_Int32 c = m_pData->m_seqControllers.getLength(); sal_Int32 i = 0; @@ -3904,29 +3770,217 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getCo css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewControllerNames() throw (css::uno::RuntimeException) { - return css::uno::Sequence< ::rtl::OUString >(); + SfxModelGuard aGuard( *this ); + + const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + const sal_Int32 nViewFactoryCount = rDocumentFactory.GetViewFactoryCount(); + + Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount ); + for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) + aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetViewName(); + return aViewNames; } //============================================================================= // css::frame::XModel2 -css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& /*Frame*/) +css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDefaultViewController( const css::uno::Reference< css::frame::XFrame >& i_rFrame ) throw (css::uno::RuntimeException , css::lang::IllegalArgumentException, css::uno::Exception ) { - return css::uno::Reference< css::frame::XController2 >(); + SfxModelGuard aGuard( *this ); + + const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName(); + + aGuard.clear(); + + return createViewController( sDefaultViewName, Sequence< PropertyValue >(), i_rFrame ); +} + +//============================================================================= +namespace sfx { namespace intern { + + /** a class which, in its dtor, cleans up variuos objects (well, at the moment only the frame) collected during + the creation of a document view, unless the creation was successful. + */ + class SAL_DLLPRIVATE ViewCreationGuard + { + public: + ViewCreationGuard() + :m_bSuccess( false ) + { + } + + ~ViewCreationGuard() + { + if ( !m_bSuccess ) + impl_closeAll(); + } + + void takeFrameOwnership( SfxFrame* i_pFrame ) + { + OSL_PRECOND( !m_aWeakFrame, "ViewCreationGuard::takeFrameOwnership: already have a frame!" ); + OSL_PRECOND( i_pFrame != NULL, "ViewCreationGuard::takeFrameOwnership: invalid frame!" ); + m_aWeakFrame = i_pFrame; + } + + void releaseAll() + { + m_bSuccess = true; + } + + private: + void impl_closeAll() + { + if ( m_aWeakFrame && !m_aWeakFrame->GetCurrentDocument() ) + { + m_aWeakFrame->SetFrameInterface_Impl( NULL ); + m_aWeakFrame->DoClose(); + } + } + + private: + bool m_bSuccess; + SfxFrameWeak m_aWeakFrame; + }; +} } + +//============================================================================= +SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const Reference< XFrame >& i_rFrame, ::sfx::intern::ViewCreationGuard& i_rGuard ) const +{ + SfxViewFrame* pViewFrame = NULL; + for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), FALSE ); + pViewFrame; + pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), FALSE ) + ) + { + if ( pViewFrame->GetFrame().GetFrameInterface() == i_rFrame ) + break; + } + if ( !pViewFrame ) + { + #if OSL_DEBUG_LEVEL > 0 + for ( SfxFrame* pCheckFrame = SfxFrame::GetFirst(); + pCheckFrame; + pCheckFrame = SfxFrame::GetNext( *pCheckFrame ) + ) + { + if ( pCheckFrame->GetFrameInterface() == i_rFrame ) + { + if ( ( pCheckFrame->GetCurrentViewFrame() != NULL ) + || ( pCheckFrame->GetCurrentDocument() != NULL ) + ) + // Note that it is perfectly letgitimate that during loading into an XFrame which already contains + // a document, there exist two SfxFrame instances bound to this XFrame - the old one, which will be + // destroyed later, and the new one, which we're going to create + continue; + + OSL_ENSURE( false, "SfxBaseModel::FindOrCreateViewFrame_Impl: there already is an SfxFrame for the given XFrame, but no view in it!" ); + // nowadays, we're the only instance allowed to create an SfxFrame for an XFrame, so this case here should not happen + break; + } + } + #endif + + SfxFrame* pTargetFrame = SfxFrame::Create( i_rFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + i_rGuard.takeFrameOwnership( pTargetFrame ); + + // prepare it + pTargetFrame->PrepareForDoc_Impl( *GetObjectShell() ); + + // create view frame + pViewFrame = new SfxViewFrame( *pTargetFrame, GetObjectShell() ); + } + return pViewFrame; } //============================================================================= // css::frame::XModel2 -css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createViewController(const ::rtl::OUString& /*ViewName*/, - const css::uno::Sequence< css::beans::PropertyValue >& /*Arguments*/, - const css::uno::Reference< css::frame::XFrame >& /*Frame */) +css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createViewController( + const ::rtl::OUString& i_rViewName, const Sequence< PropertyValue >& i_rArguments, const Reference< XFrame >& i_rFrame ) throw (css::uno::RuntimeException , css::lang::IllegalArgumentException, css::uno::Exception ) { - return css::uno::Reference< css::frame::XController2 >(); + SfxModelGuard aGuard( *this ); + + if ( !i_rFrame.is() ) + throw css::lang::IllegalArgumentException( ::rtl::OUString(), *this, 3 ); + + // find the proper SFX view factory + SfxViewFactory* pViewFactory = GetObjectShell()->GetFactory().GetViewFactoryByViewName( i_rViewName ); + if ( !pViewFactory ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + + // determine previous shell (used in some special cases) + Reference< XController > xPreviousController( i_rFrame->getController() ); + const Reference< XModel > xMe( this ); + if ( ( xPreviousController.is() ) + && ( xMe != xPreviousController->getModel() ) + ) + { + xPreviousController.clear(); + } + SfxViewShell* pOldViewShell = SfxViewShell::Get( xPreviousController ); + OSL_ENSURE( !xPreviousController.is() || ( pOldViewShell != NULL ), + "SfxBaseModel::createViewController: invalid old controller!" ); + + // a guard which will clean up in case of failure + ::sfx::intern::ViewCreationGuard aViewCreationGuard; + + // determine the ViewFrame belonging to the given XFrame + SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame, aViewCreationGuard ); + OSL_POSTCOND( pViewFrame, "SfxBaseModel::createViewController: no frame?" ); + + // delegate to SFX' view factory + pViewFrame->GetBindings().ENTERREGISTRATIONS(); + SfxViewShell* pViewShell = pViewFactory->CreateInstance( pViewFrame, pOldViewShell ); + pViewFrame->GetBindings().LEAVEREGISTRATIONS(); + ENSURE_OR_THROW( pViewShell, "invalid view shell provided by factory" ); + + // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also + pViewFrame->GetDispatcher()->SetDisableFlags( 0 ); + pViewFrame->SetViewShell_Impl( pViewShell ); + + // remember ViewID + pViewFrame->SetCurViewId_Impl( pViewFactory->GetOrdinal() ); + + // ensure a default controller, if the view shell did not provide an own implementation + if ( !pViewShell->GetController().is() ) + pViewShell->SetController( new SfxBaseController( pViewShell ) ); + + // pass the creation arguments to the controller + SfxBaseController* pBaseController = pViewShell->GetBaseController_Impl(); + ENSURE_OR_THROW( pBaseController, "invalid controller implementation!" ); + pBaseController->SetCreationArguments_Impl( i_rArguments ); + + // some initial view settings, coming from our most recent attachResource call + ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); + if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) + pViewFrame->GetFrame().SetMenuBarOn_Impl( FALSE ); + + const sal_Int16 nPluginMode = aDocumentLoadArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + if ( nPluginMode == 1 ) + { + pViewFrame->ForceOuterResize_Impl( FALSE ); + pViewFrame->GetBindings().HidePopups( TRUE ); + + SfxFrame& rFrame = pViewFrame->GetFrame(); + // MBA: layoutmanager of inplace frame starts locked and invisible + rFrame.GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); + rFrame.GetWorkWindow_Impl()->Lock_Impl( TRUE ); + + rFrame.GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + } + + // tell the guard we were successful + aViewCreationGuard.releaseAll(); + + // outta gere + return pBaseController; } //============================================================================= @@ -3936,9 +3990,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie uno::Reference< rdf::XRepository > SAL_CALL SfxBaseModel::getRDFRepository() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -3953,9 +4005,7 @@ SfxBaseModel::getRDFRepository() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getStringValue() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -3970,9 +4020,7 @@ SfxBaseModel::getStringValue() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getNamespace() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -3986,9 +4034,7 @@ SfxBaseModel::getNamespace() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getLocalName() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4005,9 +4051,7 @@ SfxBaseModel::getElementByMetadataReference( const ::com::sun::star::beans::StringPair & i_rReference) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4022,9 +4066,7 @@ uno::Reference< rdf::XMetadatable > SAL_CALL SfxBaseModel::getElementByURI(const uno::Reference< rdf::XURI > & i_xURI) throw (uno::RuntimeException, lang::IllegalArgumentException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4040,9 +4082,7 @@ SfxBaseModel::getMetadataGraphsWithType( const uno::Reference<rdf::XURI> & i_xType) throw (uno::RuntimeException, lang::IllegalArgumentException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4059,9 +4099,7 @@ SfxBaseModel::addMetadataFile(const ::rtl::OUString & i_rFileName, throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4082,9 +4120,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, datatransfer::UnsupportedFlavorException, container::ElementExistException, rdf::ParseException, io::IOException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4102,9 +4138,7 @@ SfxBaseModel::removeMetadataFile( throw (uno::RuntimeException, lang::IllegalArgumentException, container::NoSuchElementException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4120,9 +4154,7 @@ SfxBaseModel::addContentOrStylesFile(const ::rtl::OUString & i_rFileName) throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4138,9 +4170,7 @@ SfxBaseModel::removeContentOrStylesFile(const ::rtl::OUString & i_rFileName) throw (uno::RuntimeException, lang::IllegalArgumentException, container::NoSuchElementException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4159,9 +4189,7 @@ SfxBaseModel::loadMetadataFromStorage( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA( m_pData->CreateDMAUninitialized()); @@ -4189,9 +4217,7 @@ SfxBaseModel::storeMetadataToStorage( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4208,9 +4234,7 @@ SfxBaseModel::loadMetadataFromMedium( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA( m_pData->CreateDMAUninitialized()); @@ -4237,9 +4261,7 @@ SfxBaseModel::storeMetadataToMedium( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx index 3cc9d022538f..714dfc2ea824 100644 --- a/sfx2/source/doc/sfxmodelfactory.cxx +++ b/sfx2/source/doc/sfxmodelfactory.cxx @@ -149,7 +149,8 @@ namespace sfx2 static bool isSpecialArgumentName( const ::rtl::OUString& _rValueName ) { return _rValueName.equalsAscii( "EmbeddedObject" ) - || _rValueName.equalsAscii( "EmbeddedScriptSupport" ); + || _rValueName.equalsAscii( "EmbeddedScriptSupport" ) + || _rValueName.equalsAscii( "DocumentRecoverySupport" ); } bool operator()( const Any& _rArgument ) const @@ -171,15 +172,17 @@ namespace sfx2 ::comphelper::NamedValueCollection aArgs( _rArguments ); const sal_Bool bEmbeddedObject = aArgs.getOrDefault( "EmbeddedObject", sal_False ); const sal_Bool bScriptSupport = aArgs.getOrDefault( "EmbeddedScriptSupport", sal_True ); + const sal_Bool bDocRecoverySupport = aArgs.getOrDefault( "DocumentRecoverySupport", sal_True ); sal_uInt64 nCreationFlags = ( bEmbeddedObject ? SFXMODEL_EMBEDDED_OBJECT : 0 ) - | ( bScriptSupport ? 0 : SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ); + | ( bScriptSupport ? 0 : SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) + | ( bDocRecoverySupport ? 0 : SFXMODEL_DISABLE_DOCUMENT_RECOVERY ); Reference< XInterface > xInstance( impl_createInstance( nCreationFlags ) ); // to mimic the bahaviour of the default factory's createInstanceWithArguments, we initialize - // the object with the given arguments, stripped by the two special ones + // the object with the given arguments, stripped by the three special ones Sequence< Any > aStrippedArguments( _rArguments.getLength() ); Any* pStrippedArgs = aStrippedArguments.getArray(); Any* pStrippedArgsEnd = ::std::remove_copy_if( diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index b43ec53a614a..91305eb95cce 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -52,7 +52,6 @@ class SfxFilterMatcher; class SvUShorts; class ISfxTemplateCommon; class SfxFilterMatcher; -class SfxCancelManager; class SfxStatusDispatcher; class SfxDdeTriggerTopic_Impl; class SfxDocumentTemplates; @@ -108,7 +107,6 @@ public: // application members SfxFilterMatcher* pMatcher; - SfxCancelManager* pCancelMgr; ResMgr* pLabelResMgr; SfxStatusDispatcher* pAppDispatch; SfxDocumentTemplates* pTemplates; diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index e015058ae280..a882cfedd821 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -32,6 +32,7 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <com/sun/star/logging/XSimpleLogRing.hpp> #include <tools/datetime.hxx> @@ -61,7 +62,6 @@ class SfxBasicManagerHolder; struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess { ::comphelper::EmbeddedObjectContainer* mpObjectContainer; - SfxConfigManager* pCfgMgr; SfxBasicManagerHolder* pBasicManager; SfxObjectShell& rDocShell; @@ -79,10 +79,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_uInt16 nVisualDocumentNumber; sal_Int16 nDocumentSignatureState; sal_Int16 nScriptingSignatureState; - sal_Bool bTemplateConfig:1, - bInList:1, // ob per First/Next erreichbar + sal_Bool bInList:1, // ob per First/Next erreichbar bClosing:1, // sal_True w"aehrend Close(), um Benachrichtigungs-Rekursionen zu verhindern - bSetInPlaceObj:1, // sal_True, falls bereits versucht wurde pInPlaceObject zu casten bIsSaving:1, bPasswd:1, bIsTmp:1, @@ -93,14 +91,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bInPrepareClose : 1, bPreparedForClose : 1, bWaitingForPicklist : 1,// Muss noch in die Pickliste - bModuleSearched : 1, - bIsHelpObjSh : 1, - bForbidCaching : 1, bForbidReload : 1, - bSupportsEventMacros: 1, - bLoadingWindows: 1, bBasicInitialized :1, - //bHidden :1, // indicates a hidden view shell bIsPrintJobCancelable :1, // Stampit disable/enable cancel button for print jobs ... default = true = enable! bOwnsStorage:1, bNoBaseURL:1, @@ -110,6 +102,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bPreserveVersions:1, m_bMacroSignBroken:1, // whether the macro signature was explicitly broken m_bNoBasicCapabilities:1, + m_bDocRecoverySupport:1, bQueryLoadTemplate:1, bLoadReadonly:1, bUseUserData:1, @@ -117,36 +110,25 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess m_bSharedXMLFlag:1, // whether the flag should be stored in xml file m_bAllowShareControlFileClean:1; // whether the flag should be stored in xml file - String aNewName; // Der Name, unter dem das Doc gespeichert - // werden soll IndexBitSet aBitSet; sal_uInt32 lErr; sal_uInt16 nEventId; // falls vor Activate noch ein // Open/Create gesendet werden mu/s - sal_Bool bDoNotTouchDocInfo; - AutoReloadTimer_Impl *pReloadTimer; MarkData_Impl* pMarkData; sal_uInt16 nLoadedFlags; sal_uInt16 nFlagsInProgress; - String aMark; - Size aViewSize; // wird leider vom Writer beim - sal_Bool bInFrame; // HTML-Import gebraucht sal_Bool bModalMode; sal_Bool bRunningMacro; sal_Bool bReloadAvailable; sal_uInt16 nAutoLoadLocks; SfxModule* pModule; - SfxFrame* pFrame; - SfxToolBoxConfig* pTbxConfig; SfxObjectShellFlags eFlags; - svtools::AsynchronLink* pCloser; - String aBaseURL; sal_Bool bReadOnlyUI; SvRefBaseRef xHeaderAttributes; sal_Bool bHiddenLockedByAPI; - sal_Bool bInCloseEvent; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel; + ::rtl::Reference< SfxBaseModel > + pBaseModel; sal_uInt16 nStyleFilter; sal_Bool bDisposing; @@ -159,9 +141,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bCreateTempStor; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xDocStorage; - ::com::sun::star::uno::Reference< - ::com::sun::star::util::XModifyListener > m_xDocInfoListener; - sal_Bool m_bIsInit; ::rtl::OUString m_aSharedFileURL; diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index 0e4f28feb3fe..4ac85a7c98fe 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -39,7 +39,6 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <svl/eitem.hxx> #include <svl/stritem.hxx> -#include <svl/cancel.hxx> #include <unotools/historyoptions.hxx> #include <svl/folderrestriction.hxx> #include <vcl/toolbox.hxx> @@ -302,102 +301,3 @@ void SfxURLToolBoxControl_Impl::StateChanged } } -//*************************************************************************** -// SfxCancelToolBoxControl_Impl -//*************************************************************************** - -SFX_IMPL_TOOLBOX_CONTROL(SfxCancelToolBoxControl_Impl,SfxBoolItem) - -//*************************************************************************** - -SfxCancelToolBoxControl_Impl::SfxCancelToolBoxControl_Impl( USHORT nSlotId, USHORT nId, ToolBox& rBox ) : - SfxToolBoxControl( nSlotId, nId, rBox ) -{ -} - -//*************************************************************************** - -SfxPopupWindowType SfxCancelToolBoxControl_Impl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONTIMEOUT; -} - -//*************************************************************************** - -SfxPopupWindow* SfxCancelToolBoxControl_Impl::CreatePopupWindow() -{ - PopupMenu aMenu; - BOOL bExecute = FALSE, bSeparator = FALSE; - USHORT nIndex = 1; - for ( SfxCancelManager *pCancelMgr = SfxViewFrame::Current()->GetTopViewFrame()->GetCancelManager(); - pCancelMgr; - pCancelMgr = pCancelMgr->GetParent() ) - { - for ( USHORT n=0; n<pCancelMgr->GetCancellableCount(); ++n ) - { - if ( !n && bSeparator ) - { - aMenu.InsertSeparator(); - bSeparator = FALSE; - } - String aItemText = pCancelMgr->GetCancellable(n)->GetTitle(); - if ( aItemText.Len() > 50 ) - { - aItemText.Erase( 48 ); - aItemText += DEFINE_CONST_UNICODE("..."); - } - aMenu.InsertItem( nIndex++, aItemText ); - bExecute = TRUE; - bSeparator = TRUE; - } - } - - ToolBox& rToolBox = GetToolBox(); - USHORT nId = bExecute ? aMenu.Execute( &rToolBox, rToolBox.GetPointerPosPixel() ) : 0; - GetToolBox().EndSelection(); -// ClearCache(); -// UpdateSlot(); - if ( nId ) - { - String aSearchText = aMenu.GetItemText(nId); - for ( SfxCancelManager *pCancelMgr = SfxViewFrame::Current()->GetTopViewFrame()->GetCancelManager(); - pCancelMgr; - pCancelMgr = pCancelMgr->GetParent() ) - { - for ( USHORT n = 0; n < pCancelMgr->GetCancellableCount(); ++n ) - { - SfxCancellable *pCancel = pCancelMgr->GetCancellable(n); - String aItemText = pCancel->GetTitle(); - if ( aItemText.Len() > 50 ) - { - aItemText.Erase( 48 ); - aItemText += DEFINE_CONST_UNICODE("..."); - } - - if ( aItemText == aSearchText ) - { - pCancel->Cancel(); - return 0; - } - } - } - - } - - return 0; -} - -//*************************************************************************** - -void SfxCancelToolBoxControl_Impl::StateChanged -( - USHORT nSID, - SfxItemState eState, - const SfxPoolItem* pState -) -{ - SfxVoidItem aVoidItem( nSID ); - //SfxToolBoxControl::StateChanged( nSID, eState, pState ? &aVoidItem : 0 ); - SfxToolBoxControl::StateChanged( nSID, eState, pState ); -} - diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index 210e1e886969..281b451d8098 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -453,7 +453,7 @@ SfxAppMenuControl_Impl::SfxAppMenuControl_Impl( Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); ::framework::MenuConfiguration aConf( aXMultiServiceFactory ); - Reference<com::sun::star::frame::XFrame> aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); pMenu = aConf.CreateBookmarkMenu( aXFrame, GetId() == SID_NEWDOCDIRECT ? BOOKMARK_NEWMENU : BOOKMARK_WIZARDMENU ); if( pMenu ) { diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 8a7901836149..13c84bc531e2 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -345,7 +345,7 @@ void SfxVirtualMenu::CreateFromSVMenu() DBG_CHKTHIS(SfxVirtualMenu, 0); // Merge Addon popup menus into the SV Menu - Reference< com::sun::star::frame::XFrame > xFrame( pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference< com::sun::star::frame::XFrame > xFrame( pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface() ); if ( pSVMenu->IsMenuBar() ) { @@ -610,7 +610,7 @@ IMPL_LINK( SfxVirtualMenu, SettingsChanged, void*, EMPTYARG ) SfxViewFrame *pViewFrame = pBindings->GetDispatcher()->GetFrame(); BOOL bIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); BOOL bIsHiContrastMode = IsHiContrastMode(); - Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame().GetFrameInterface() ); if ( !bIsAddonPopupMenu ) { @@ -682,7 +682,7 @@ void SfxVirtualMenu::UpdateImages() BOOL bIsHiContrastMode = IsHiContrastMode(); USHORT nItemCount = pSVMenu->GetItemCount(); SfxViewFrame * pViewFrame = pBindings->GetDispatcher()->GetFrame(); - Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame().GetFrameInterface() ); for ( USHORT nSVPos=0; nSVPos < nItemCount; ++nSVPos ) { @@ -731,7 +731,7 @@ void SfxVirtualMenu::UpdateImages( Menu* pMenu ) { BOOL bIsHiContrastMode = IsHiContrastMode(); USHORT nItemCount = pMenu->GetItemCount(); - Reference<com::sun::star::frame::XFrame> aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); for ( USHORT nPos=0; nPos < nItemCount; ++nPos ) { @@ -900,7 +900,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu ) // Create special popup menu that is filled with the 3rd party components popup menu items Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); ::framework::MenuConfiguration aConf( aXMultiServiceFactory ); - Reference<com::sun::star::frame::XFrame> xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); PopupMenu* pAddonMenu = NULL; try diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 4564043a2b0d..32e6887f802c 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -266,7 +266,7 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg { xProv = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > ( - pView->GetFrame()->GetFrameInterface(), UNO_QUERY ); + pView->GetFrame().GetFrameInterface(), UNO_QUERY ); } else { diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 2f6c4bb59903..090e94ecb63f 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -77,7 +77,7 @@ #include <sfx2/fcontnr.hxx> #include "impframe.hxx" #include <sfx2/appuno.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "workwin.hxx" #include <sfx2/sfxuno.hxx> #include <sfx2/msgpool.hxx> @@ -100,41 +100,29 @@ using namespace ::com::sun::star::container; TYPEINIT1(SfxFrame, SfxListener); TYPEINIT1_AUTOFACTORY(SfxFrameItem, SfxPoolItem); TYPEINIT1(SfxUsrAnyItem, SfxPoolItem); - -SfxFrame::SfxFrame(SfxFrame* pParent): - pParentFrame( pParent ), - pChildArr(0), - pUnoImp(0) -{ - pImp = new SfxFrame_Impl( this ); - if ( pParent ) - pParent->InsertChildFrame_Impl( this ); - if ( !pFramesArr_Impl ) - pFramesArr_Impl = new SfxFrameArr_Impl; - pFramesArr_Impl->Insert( this, pFramesArr_Impl->Count() ); -} +TYPEINIT1_AUTOFACTORY(SfxUnoFrameItem, SfxPoolItem); SvCompatWeakHdl* SfxFrame::GetHdl() { return pImp->GetHdl(); } -SfxCancelManager* SfxFrame::GetCancelManager() const +//-------------------------------------------------------------------- +void SfxFrame::Construct_Impl() { - SfxFrame *pFrame = GetTopFrame(); - SfxCancelManager*& rpMgr = pFrame->pImp->pCancelMgr; - if ( !rpMgr ) - { - rpMgr = new SfxCancelManager( SFX_APP()->GetCancelManager() ); - pFrame->pImp->StartListening( *rpMgr ); - } - return rpMgr; + pImp = new SfxFrame_Impl( this ); + if ( !pFramesArr_Impl ) + pFramesArr_Impl = new SfxFrameArr_Impl; + pFramesArr_Impl->Insert( this, pFramesArr_Impl->Count() ); } //-------------------------------------------------------------------- SfxFrame::~SfxFrame() { + RemoveTopFrame_Impl( this ); + DELETEZ( pWindow ); + pFramesArr_Impl->Remove( pFramesArr_Impl->GetPos( this ) ); if ( pParentFrame ) @@ -214,53 +202,6 @@ sal_Bool SfxFrame::DoClose_Impl() return bRet; } -void SfxFrame::Clear_Impl() -{ - CancelTransfers(); - - // Bei FrameSets verhindern, da\s das Closen der Childs zu st"andigen - // ReCalcs im SplitWindow f"uhrt; SetUpdateMode am FrameWindow wirkt - // leider nicht auf dem MAC - Window *pWin = NULL; - SfxViewShell *pViewSh; - if ( pImp->pCurrentViewFrame && - 0 != ( pViewSh = pImp->pCurrentViewFrame->GetViewShell() ) ) - { - pWin = pViewSh->GetWindow(); - if ( pWin ) - pWin->Hide(); - } - - sal_Bool bRet = sal_True; - SfxBindings* pBindings = NULL; - if ( pImp->pCurrentViewFrame ) - { - pBindings = &pImp->pCurrentViewFrame->GetBindings(); - pImp->bClosing = sal_True; - bRet = pImp->pCurrentViewFrame->Close(); - pImp->bClosing = sal_False; - } - - if ( bRet ) - { - // Bei internen Tasks m"ussen Controller und Tools abger"aumt werden - if ( pImp->pWorkWin ) - { - pImp->pWorkWin->DeleteControllers_Impl(); - DELETEZ( pImp->pWorkWin ); - } - - if ( pImp->bOwnsBindings ) - delete pBindings; - } - else - { - if ( pWin ) - pWin->Show(); - } -} - - sal_Bool SfxFrame::DocIsModified_Impl() { if ( pImp->pCurrentViewFrame && pImp->pCurrentViewFrame->GetObjectShell() && @@ -290,7 +231,7 @@ sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing ) for ( const SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pCur ); !bOther && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pCur ) ) { - bOther = ( pFrame->GetFrame() != this ); + bOther = ( &pFrame->GetFrame() != this ); } SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur) ); @@ -333,164 +274,19 @@ SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const return 0L; } -void SfxFrame::InsertChildFrame_Impl( SfxFrame* pFrame, sal_uInt16 nPos ) -{ - if ( !pChildArr ) - pChildArr = new SfxFrameArr_Impl; - pChildArr->Insert( pFrame, nPos ); - pFrame->pParentFrame = this; -} - -void SfxFrame::RemoveChildFrame_Impl( sal_uInt16 nPos ) -{ - DBG_ASSERT( pChildArr, "Unbekannter Frame!"); - pChildArr->Remove( nPos ); -}; - void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) { DBG_ASSERT( pChildArr, "Unbekannter Frame!"); sal_uInt16 nPos = pChildArr->GetPos(pFrame); - RemoveChildFrame_Impl( nPos ); + pChildArr->Remove( nPos ); }; -sal_Bool SfxFrame::CloseChildFrames() -{ - sal_Bool bRet = sal_True; - if ( pChildArr ) - { - // Childs closen - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=nCount; n>0; n--) - { - SfxFrame* pFrame = (*pChildArr)[n-1]; - // pFrame removed sich selbst - bRet = pFrame->DoClose(); - if ( !bRet ) - break; - } - } - - return bRet; -} - -SfxFrame* SfxFrame::SearchChildrenForName_Impl( const String& rName, sal_Bool bDeep ) const -{ - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=nCount; n>0; n--) - { - SfxFrame* pFrame = (*pChildArr)[n-1]; - if ( rName.CompareIgnoreCaseToAscii( pFrame->GetFrameName() ) == COMPARE_EQUAL ) - return pFrame; - if( bDeep ) - { - pFrame = pFrame->SearchChildrenForName_Impl( rName ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -SfxFrame* SfxFrame::GetTopFrame() const +SfxFrame& SfxFrame::GetTopFrame() const { - SfxFrame *pParent = (SfxFrame*) this; + const SfxFrame* pParent = this; while ( pParent->pParentFrame ) pParent = pParent->pParentFrame; - return pParent; -} - -SfxFrame* SfxFrame::SearchFrame( const String& rName, SfxMedium* /*pMedium*/ ) -{ - // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch - // Sollte besser auch bei den FrameNames gemacht werden! - String aFrameName( rName ); - aFrameName.EraseLeadingChars(); - - SfxFrame *pFrame = this; - if( !aFrameName.Len() || aFrameName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL ) - { - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL ) - { - DBG_ERROR("Not supported!"); - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL) - { - // Eigener Name, kein Name oder Selbstbezug - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL ) - { - // Gesucht ist das Parent Frameset - return pParentFrame ? pParentFrame : this; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL ) - { - return NULL; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL ) - { - while ( pFrame->GetParentFrame() ) - pFrame = pFrame->GetParentFrame(); - return pFrame; - } - else - { - // Zuerst unterhalb dieses Frames absuchen - pFrame = SearchChildrenForName_Impl( aFrameName ); - } - - if ( !pFrame && GetParentFrame() ) - { - // Noch nichts gefunden, nach oben weitergehen - // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus - // Performance-Gr"unden markiert werden - SfxFrame *pParent = GetParentFrame(); - do - { - // Ist es der Parent ? - if ( aFrameName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL ) - return pParent; - - // Weiter nach oben - pParent = pParent->GetParentFrame(); - } - while ( pParent ); - } - - if( !pFrame ) - { - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen - // Toplevel Frames checken. - SfxFrame *pTop = GetTopFrame(); - for( sal_uInt16 nPos = rArr.Count(); nPos--; ) - { - // Unser Topframe wurde bereits durchsucht - SfxFrame* pCurFrame = rArr[ nPos ]; - if( pCurFrame != pTop ) - { - if( aFrameName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) == - COMPARE_EQUAL ) - return pCurFrame; - else - { - pFrame = pCurFrame->SearchChildrenForName_Impl( aFrameName ); - if( pFrame ) - return pFrame; - } - } - } - } - - return pFrame; + return *const_cast< SfxFrame* >( pParent ); } sal_Bool SfxFrame::IsClosing_Impl() const @@ -503,21 +299,11 @@ void SfxFrame::SetIsClosing_Impl() pImp->bClosing = TRUE; } -void SfxFrame::DocumentInserted( SfxObjectShell* /*pDoc*/ ) -{ -} - sal_uInt16 SfxFrame::GetChildFrameCount() const { return pChildArr ? pChildArr->Count() : 0; } -sal_Bool SfxFrame::InsertDocument( SfxObjectShell* pDoc ) -{ - DocumentInserted( pDoc ); - return sal_True; -} - void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) { if( !pImp->bInCancelTransfers ) @@ -528,7 +314,7 @@ void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) { SfxViewFrame* pFrm; for( pFrm = SfxViewFrame::GetFirst( pObj ); - pFrm && pFrm->GetFrame() == this; + pFrm && &pFrm->GetFrame() == this; pFrm = SfxViewFrame::GetNext( *pFrm, pObj ) ) ; // Keine anderer Frame mehr auf Doc -> Cancel if( !pFrm ) @@ -566,12 +352,7 @@ SfxObjectShell* SfxFrame::GetCurrentDocument() const { return pImp->pCurrentViewFrame ? pImp->pCurrentViewFrame->GetObjectShell() : - pImp->pCurrentObjectShell; -} - -void SfxFrame::SetCurrentDocument_Impl( SfxObjectShell *pDoc ) -{ - pImp->pCurrentObjectShell = pDoc; + NULL; } void SfxFrame::SetCurrentViewFrame_Impl( SfxViewFrame *pFrame ) @@ -589,56 +370,10 @@ void SfxFrame::SetFrameType_Impl( sal_uInt32 n ) pImp->nType = n; } -void SfxFrame::CopyHistory_Impl( SfxFrame* /*pFrame*/ ) const -{ -} - - -void SfxFrame::ClearHistory() -{ -} - -sal_Bool SfxFrame::ExecuteHistoryMenu_Impl( sal_uInt16 /*nWhich*/, const Rectangle& /*rRect*/, sal_uInt16 /*nFlags*/ ) -{ - return sal_True; -} - -sal_Bool SfxFrame::Browse( sal_Bool /*bForward*/, sal_uInt16 /*nSteps*/, sal_Bool /*bNewFrame*/ ) -{ - return FALSE; -} - -void SfxFrame::UpdatePickEntries() -{ -} - -void SfxFrame::UpdatePickEntries( const ::com::sun::star::uno::Any& /*rValue*/ ) -{ -} - -void SfxFrame::UpdateUndoHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/, const String* /*pTitle*/ ) -{ -} - -void SfxFrame::UpdateCurrentHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ ) -{ -} - -void SfxFrame::UpdateHistory( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ ) -{ -} - -void SfxFrame::UpdateHistory( - const ::rtl::OUString& /*aURL*/, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/, - const ::rtl::OUString& /*rTitle*/ ) -{ -} - void SfxFrame::GetViewData_Impl() { // Alle zwischen Laden und Entfernen "anderbaren Daten aktualisieren; die - // festen Daten werden nur einmal ( nach InsertDocument in UpdateDescriptor ) + // festen Daten werden nur einmal ( nach PrepareForDoc_Impl in UpdateDescriptor ) // geholt, um Zeit zu sparen. SfxViewFrame* pViewFrame = GetCurrentViewFrame(); if( pViewFrame && pViewFrame->GetViewShell() ) @@ -647,10 +382,7 @@ void SfxFrame::GetViewData_Impl() sal_Bool bReadOnly = pMed->GetOpenMode() == SFX_STREAM_READONLY; GetDescriptor()->SetReadOnly( bReadOnly ); - String aUserData; - pViewFrame->GetViewShell()->WriteUserData( aUserData, sal_True ); SfxItemSet *pSet = GetDescriptor()->GetArgs(); - pSet->Put( SfxStringItem( SID_USER_DATA, aUserData )); sal_Bool bGetViewData = sal_False; if ( GetController().is() && pSet->GetItemState( SID_VIEW_DATA ) != SFX_ITEM_SET ) { @@ -678,9 +410,9 @@ void SfxFrame::GetViewData_Impl() void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) { - // Beim InsertDocument wird der Descriptor des Frames aktualisiert + // Beim PrepareForDoc_Impl wird der Descriptor des Frames aktualisiert // und sein ItemSet neu initialisiert. Alle Daten, die f"ur ein sp"ateres - // Restaurieren der ::com::sun::star::sdbcx::View n"otig sind, sind damit festgehalten. + // Restaurieren der View n"otig sind, sind damit festgehalten. // Soll das Dokument ersetzt werden, wird durch GetViewData_Impl (s.o.) // die neueste Information hinzugef"ugt. Alles zusammen wird dann in der // Browse-History gesichert. Beim Aktivieren eines solchen FramePickEntry @@ -732,20 +464,6 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) //------------------------------------------------------------------------- -sal_Bool SfxFrame::CanBrowseBackward() const -{ - return FALSE; -} - -//------------------------------------------------------------------------- - -sal_Bool SfxFrame::CanBrowseForward() const -{ - return FALSE; -} - -//------------------------------------------------------------------------- - void SfxFrame::SetDescriptor( SfxFrameDescriptor *pD ) { DBG_ASSERT( pD, "Kein Descriptor!" ); @@ -793,14 +511,12 @@ void SfxFrame::GetTargetList( TargetList& rList ) const } SfxViewFrame* pView = GetCurrentViewFrame(); - if( pView && pView->GetViewShell() && !pView->GetViewShell()->IsImplementedAsFrameset_Impl() && pChildArr ) + if( pView && pView->GetViewShell() && pChildArr ) { sal_uInt16 nCount = pChildArr->Count(); for ( sal_uInt16 n=0; n<nCount; n++) { SfxFrame* pFrame = (*pChildArr)[n]; - if ( pFrame->GetFrameName().Len() ) - rList.Insert( new String (pFrame->GetFrameName()) ); pFrame->GetTargetList( rList ); } } @@ -808,147 +524,11 @@ void SfxFrame::GetTargetList( TargetList& rList ) const //------------------------------------------------------------------------- -void SfxFrame::SetFrameId_Impl( sal_uInt16 nId ) -{ - pImp->nFrameId = nId; - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->UpdateTitle(); -} - -sal_uInt16 SfxFrame::GetFrameId_Impl() const -{ - return pImp->nFrameId; -} - -void SfxFrame::SetFrameIdName_Impl( const String& rName ) -{ - pImp->aFrameIdName = rName; -} - -//------------------------------------------------------------------------- - -SfxFrame* SfxFrame::SearchFrame_Impl( sal_uInt16 nId, sal_Bool bDeep ) -{ - if ( pImp->nFrameId == nId ) - return this; - - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; n<nCount; n++) - { - SfxFrame* pFrame = (*pChildArr)[n]; - if ( pFrame->pImp->nFrameId == nId ) - return pFrame; - if ( bDeep ) - { - pFrame = pFrame->SearchFrame_Impl( nId, sal_True ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -SfxFrame* SfxFrame::SearchFrame_Impl( const String& rName, sal_Bool bDeep ) -{ - if ( pImp->aFrameIdName == rName ) - return this; - - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; n<nCount; n++) - { - SfxFrame* pFrame = (*pChildArr)[n]; - if ( pFrame->pImp->aFrameIdName == rName ) - return pFrame; - if ( bDeep ) - { - pFrame = pFrame->SearchFrame_Impl( rName ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -//------------------------------------------------------------------------- - -//------------------------------------------------------------------------- - -void SfxFrame::Activate_Impl( sal_Bool bBeamerOn ) - -/* [Description] - - Internal Activate-Handler, called from derived classes which supports - Activate-Handling. -*/ - -{ - if ( GetParentFrame() ) - GetParentFrame()->Activate_Impl( bBeamerOn ); -} - SfxBroadcaster& SfxFrame::GetBroadcaster() const { return *pImp; } -//------------------------------------------------------------------------- - -void SfxFrame::Deactivate_Impl() - -/* [Description] - - Internal Deactivate-Handler, called from derived classes which supports - Activate-Handling. -*/ - -{ - if( GetParentFrame() ) - GetParentFrame()->Deactivate_Impl(); -} - -String SfxFrame::GetContent() const -{ - SfxObjectShell *pObj = GetCurrentDocument(); - if ( !pObj || !pObj->GetMedium() ) - return String(); - else - return pObj->GetMedium()->GetName(); -} - -sal_Bool SfxFrame::CheckContentForLoad_Impl() -{ - if ( GetCurrentDocument() ) - { - SfxMedium* pMedium = GetCurrentDocument()->GetMedium(); -#ifdef DEBUG - SfxItemSet* pSet; - pSet = pMedium->GetItemSet(); -#endif - SfxItemSet* pNew = GetDescriptor()->GetArgs(); - - // Falls URLs nicht uebereinstimmen - if ( INetURLObject( GetDescriptor()->GetActualURL() ) != INetURLObject( pMedium->GetOrigURL() ) ) - return sal_True; - - // Falls die Filter nicht uebereinstimmen - SFX_ITEMSET_ARG( pNew, pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False ); - if( pMedium->GetOrigFilter() && pFilterItem && pFilterItem->GetValue() != pMedium->GetOrigFilter()->GetFilterName() ) - return sal_True; - - return sal_False; - } - - return (GetDescriptor()->GetActualURL().GetMainURL( INetURLObject::NO_DECODE ).getLength() != 0); -} - sal_Bool SfxFrame::IsParent( SfxFrame *pFrame ) const { SfxFrame *pParent = pParentFrame; @@ -975,7 +555,7 @@ void SfxFrame::RemoveTopFrame_Impl( SfxFrame* pFrame ) } SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxViewFrame *p ) - : SfxPoolItem( nWhichId ), pFrame( p ? p->GetFrame() : NULL ) + : SfxPoolItem( nWhichId ), pFrame( p ? &p->GetFrame() : NULL ) { wFrame = pFrame; } @@ -1058,11 +638,6 @@ int SfxUsrAnyItem::operator==( const SfxPoolItem& /*rItem*/ ) const return sal_False; } -String SfxUsrAnyItem::GetValueText() const -{ - return String(); -} - SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const { return new SfxUsrAnyItem( Which(), aValue ); @@ -1080,9 +655,37 @@ sal_Bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*n return sal_True; } -sal_Bool SfxFrame::BrowseInFrame( int /*nDelta*/ ) +SfxUnoFrameItem::SfxUnoFrameItem() + : SfxPoolItem() + , m_xFrame() +{ +} + +SfxUnoFrameItem::SfxUnoFrameItem( sal_uInt16 nWhichId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) + : SfxPoolItem( nWhichId ) + , m_xFrame( i_rFrame ) { - return sal_False; +} + +int SfxUnoFrameItem::operator==( const SfxPoolItem& i_rItem ) const +{ + return i_rItem.ISA( SfxUnoFrameItem ) && static_cast< const SfxUnoFrameItem& >( i_rItem ).m_xFrame == m_xFrame; +} + +SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const +{ + return new SfxUnoFrameItem( Which(), m_xFrame ); +} + +sal_Bool SfxUnoFrameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const +{ + rVal <<= m_xFrame; + return sal_True; +} + +sal_Bool SfxUnoFrameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) +{ + return ( rVal >>= m_xFrame ); } SfxFrameIterator::SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecur ) @@ -1129,116 +732,6 @@ SfxFrame* SfxFrameIterator::NextSibling_Impl( SfxFrame& rPrev ) return pRet; } -void SfxFrame::SetFrameName( const String& rName ) -{ - if ( pImp->pDescr ) - pImp->pDescr->SetName( rName ); - aName = rName; - if ( pImp->pCurrentViewFrame ) - pImp->pCurrentViewFrame->UpdateTitle(); - if ( GetFrameInterface().is() ) - GetFrameInterface()->setName( rName ); -} - -void SfxFrame::LoadFinished_Impl() -{ -} - -SfxFrame* SfxFrame::findFrame(const ::rtl::OUString& aTargetframename, sal_Int32 nSearchFlags) -{ - // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch - // Sollte besser auch bei den FrameNames gemacht werden! - String aTargetName( aTargetframename ); - aTargetName.EraseLeadingChars(); - - SfxFrame *pFrame = this; - - if ( !aTargetName.Len() && GetParentFrame() && GetParentFrame()->GetCurrentViewFrame()->GetViewShell()->IsImplementedAsFrameset_Impl() ) - return GetParentFrame(); - - if( !aTargetName.Len() || aTargetName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL ) - return pFrame; - - if ( aTargetName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL ) - { - DBG_ERROR("Not supported!"); - return pFrame; - } - - if ( aTargetName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL ) - { - // Gesucht ist das Parent Frameset - return pFrame->GetParentFrame(); - } - else if ( aTargetName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL ) - { - return NULL; - - } - else if ( aTargetName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL ) - { - while ( pFrame->GetParentFrame() ) - pFrame = pFrame->GetParentFrame(); - return pFrame; - } - - if ( ( nSearchFlags & FRAME_SEARCH_SELF ) && aTargetName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL ) - { - // Eigener Name - return pFrame; - } - - if ( nSearchFlags & FRAME_SEARCH_CHILDREN ) - { - // Zuerst unterhalb dieses Frames absuchen - pFrame = SearchChildrenForName_Impl( aTargetName ); - } - - if ( ( nSearchFlags & FRAME_SEARCH_CHILDREN ) && !pFrame && GetParentFrame() ) - { - // Noch nichts gefunden, nach oben weitergehen - // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus - // Performance-Gr"unden markiert werden - SfxFrame *pParent = GetParentFrame(); - do - { - // Ist es der Parent ? - if ( aTargetName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL ) - return pParent; - - // Weiter nach oben - pParent = pParent->GetParentFrame(); - } - while ( pParent ); - } - - if( !pFrame ) - { - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen - // Toplevel Frames checken. - SfxFrame *pTop = GetTopFrame(); - for( sal_uInt16 nPos = rArr.Count(); nPos--; ) - { - // Unser Topframe wurde bereits durchsucht - SfxFrame* pCurFrame = rArr[ nPos ]; - if( pCurFrame != pTop ) - { - if( aTargetName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) == COMPARE_EQUAL ) - return pCurFrame; - else - { - pFrame = pCurFrame->SearchChildrenForName_Impl( aTargetName ); - if( pFrame ) - return pFrame; - } - } - } - } - - return pFrame; -} - sal_Bool SfxFrame::IsTop() const { return GetFrameInterface().is() ? GetFrameInterface()->isTop() : sal_False; @@ -1262,7 +755,7 @@ sal_Bool SfxFrame::HasComponent() const return pImp->xFrame; } -void SfxFrame::SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) +void SfxFrame::SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) { pImp->xFrame = rFrame; com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder; @@ -1270,16 +763,6 @@ void SfxFrame::SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com:: GetCurrentViewFrame()->GetBindings().SetRecorder_Impl( xRecorder ); } -void SfxFrame::SetItemSet_Impl( const SfxItemSet* pSet ) -{ - pImp->pSet = pSet; -} - -const SfxItemSet* SfxFrame::GetItemSet_Impl() -{ - return pImp->pSet; -} - void SfxFrame::Appear() { if ( GetCurrentViewFrame() ) @@ -1407,11 +890,6 @@ void SfxFrame::CreateWorkWindow_Impl() pImp->pWorkWin = new SfxFrameWorkWin_Impl( &pFrame->GetWindow(), this, pFrame ); } -const SvBorder& SfxFrame::GetBorder_Impl() const -{ - return pImp->aBorder; -} - void SfxFrame::GrabFocusOnComponent_Impl() { if ( pImp->bReleasingComponent ) @@ -1420,18 +898,12 @@ void SfxFrame::GrabFocusOnComponent_Impl() return; } - Window* pWindow = &GetWindow(); + Window* pFocusWindow = &GetWindow(); if ( GetCurrentViewFrame() && GetCurrentViewFrame()->GetViewShell() && GetCurrentViewFrame()->GetViewShell()->GetWindow() ) - pWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow(); - - if( !pWindow->HasChildPathFocus() ) - pWindow->GrabFocus(); -} + pFocusWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow(); -const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > SfxFrame::GetInterceptor_Impl() -{ -//(mba)/compview: hier fehlt der Zugriff auf den Interceptor !!!!! - return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > (); + if( !pFocusWindow->HasChildPathFocus() ) + pFocusWindow->GrabFocus(); } void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet ) @@ -1439,36 +911,6 @@ void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet ) pImp->bReleasingComponent = bSet; } -sal_Bool SfxFrame::LoadSfxComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & /*aFrame*/, - const ::rtl::OUString& /*aURL*/, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/, - const SfxObjectFactory* /*pFact*/ ) -{ - // get Implementation of xComponents ... - DBG_ERROR( "Should not be called anymore!" ); - return sal_False; -} - -void SfxFrame::LockFocus_Impl( sal_Bool bLock ) -{ - if ( pChildArr && pChildArr->Count() ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; n<nCount; n++ ) - { - SfxFrame* pFrame = (*pChildArr)[n]; - pFrame->pImp->bFocusLocked = bLock; - pFrame->LockFocus_Impl( bLock ); - } - } -} - -sal_Bool SfxFrame::IsFocusLocked_Impl() const -{ - return pImp->bFocusLocked; -} - sal_Bool SfxFrame::IsInPlace() const { return pImp->bInPlace; @@ -1503,7 +945,7 @@ void SfxFrame::Resize() if ( nHandle ) { SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); - pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame()->GetWorkWindow_Impl(); + pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame().GetWorkWindow_Impl(); } } @@ -1543,10 +985,10 @@ SfxFrame* SfxFrame::GetNext( SfxFrame& rFrame ) return NULL; } -const SfxPoolItem* SfxFrame::LoadDocumentSynchron( SfxItemSet& aSet ) +const SfxPoolItem* SfxFrame::OpenDocumentSynchron( SfxItemSet& i_rSet, const Reference< XFrame >& i_rTargetFrame ) { - aSet.Put( SfxFrameItem( SID_DOCFRAME, this ) ); - aSet.ClearItem( SID_TARGETNAME ); - return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, aSet ); + i_rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, i_rTargetFrame ) ); + i_rSet.ClearItem( SID_TARGETNAME ); + return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, i_rSet ); } diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx new file mode 100644 index 000000000000..d99ad8733e03 --- /dev/null +++ b/sfx2/source/view/frame2.cxx @@ -0,0 +1,484 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "impframe.hxx" +#include "objshimp.hxx" +#include "sfxhelp.hxx" +#include "workwin.hxx" + +#include "sfx2/app.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/event.hxx" +#include "sfx2/objface.hxx" +#include "sfx2/request.hxx" + +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> + +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/processfactory.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/itemset.hxx> +#include <svl/rectitem.hxx> +#include <svl/stritem.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::lang::XComponent; +using ::com::sun::star::frame::XComponentLoader; + +//------------------------------------------------------------------------ + +class SfxFrameWindow_Impl : public Window +{ +public: + SfxFrame* pFrame; + + SfxFrameWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ); + ~SfxFrameWindow_Impl( ); + + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rEvt ); + virtual void Resize(); + virtual void GetFocus(); + void DoResize(); + DECL_LINK( CloserHdl, void* ); +}; + +SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ) + : Window( &i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) + , pFrame( pF ) +{ +} + +SfxFrameWindow_Impl::~SfxFrameWindow_Impl( ) +{ +} + +void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Window::DataChanged( rDCEvt ); + SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); + if ( pWorkWin ) + pWorkWin->DataChanged_Impl( rDCEvt ); +} + +long SfxFrameWindow_Impl::Notify( NotifyEvent& rNEvt ) +{ + if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() ) + return sal_False; + + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + if ( !pView || !pView->GetObjectShell() ) + return Window::Notify( rNEvt ); + + if ( rNEvt.GetType() == EVENT_GETFOCUS ) + { + if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) + { + DBG_TRACE("SfxFrame: GotFocus"); + pView->MakeActive_Impl( FALSE ); + } + + // TODO/LATER: do we still need this code? + Window* pWindow = rNEvt.GetWindow(); + ULONG nHelpId = 0; + while ( !nHelpId && pWindow ) + { + nHelpId = pWindow->GetHelpId(); + pWindow = pWindow->GetParent(); + } + + if ( nHelpId ) + SfxHelp::OpenHelpAgent( pFrame, nHelpId ); + + // if focus was on an external window, the clipboard content might have been changed + pView->GetBindings().Invalidate( SID_PASTE ); + pView->GetBindings().Invalidate( SID_PASTE_SPECIAL ); + return sal_True; + } + else if( rNEvt.GetType() == EVENT_KEYINPUT ) + { + if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) ) + return TRUE; + } + else if ( rNEvt.GetType() == EVENT_EXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTDISABLE*/ ) + { + pView->SetModalMode( sal_True ); + return sal_True; + } + else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ ) + { + //EnableInput( sal_True, sal_True ); + pView->SetModalMode( sal_False ); + return sal_True; + } + + return Window::Notify( rNEvt ); +} + +long SfxFrameWindow_Impl::PreNotify( NotifyEvent& rNEvt ) +{ + USHORT nType = rNEvt.GetType(); + if ( nType == EVENT_KEYINPUT || nType == EVENT_KEYUP ) + { + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; + if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) + return sal_True; + } + else if ( nType == EVENT_MOUSEBUTTONUP || nType == EVENT_MOUSEBUTTONDOWN ) + { + Window* pWindow = rNEvt.GetWindow(); + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; + if ( pShell ) + if ( pWindow == pShell->GetWindow() || pShell->GetWindow()->IsChild( pWindow ) ) + if ( pShell->HasMouseClickListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) + return sal_True; + } + + if ( nType == EVENT_MOUSEBUTTONDOWN ) + { + Window* pWindow = rNEvt.GetWindow(); + const MouseEvent* pMEvent = rNEvt.GetMouseEvent(); + Point aPos = pWindow->OutputToScreenPixel( pMEvent->GetPosPixel() ); + SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); + if ( pWorkWin ) + pWorkWin->EndAutoShow_Impl( aPos ); + } + + return Window::PreNotify( rNEvt ); +} + +void SfxFrameWindow_Impl::GetFocus() +{ + if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() ) + pFrame->GetCurrentViewFrame()->MakeActive_Impl( TRUE ); +} + +void SfxFrameWindow_Impl::Resize() +{ + if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) + DoResize(); +} + +void SfxFrameWindow_Impl::StateChanged( StateChangedType nStateChange ) +{ + if ( nStateChange == STATE_CHANGE_INITSHOW ) + { + pFrame->pImp->bHidden = FALSE; + if ( pFrame->IsInPlace() ) + // TODO/MBA: workaround for bug in LayoutManager: the final resize does not get through because the + // LayoutManager works asynchronously and between resize and time execution the DockingAcceptor was exchanged so that + // the resize event never is sent to the component + SetSizePixel( GetParent()->GetOutputSizePixel() ); + + DoResize(); + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + if ( pView ) + pView->GetBindings().GetWorkWindow_Impl()->ShowChilds_Impl(); + } + + Window::StateChanged( nStateChange ); +} + +void SfxFrameWindow_Impl::DoResize() +{ + if ( !pFrame->pImp->bLockResize ) + pFrame->Resize(); +} + +Reference < XFrame > SfxFrame::CreateBlankFrame() +{ + Reference < XFrame > xFrame; + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xFrame; +} + +SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ) +{ + SfxFrame* pFrame = NULL; + try + { + // create and initialize new top level frame for this window + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFramesSupplier > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW ); + + Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW ); + xFrame->initialize( xWin.get() ); + xDesktop->getFrames()->append( xFrame ); + + if ( xWin->isActive() ) + xFrame->activate(); + + // create load arguments + Sequence< PropertyValue > aLoadArgs; + TransformItems( SID_OPENDOC, *rDoc.GetMedium()->GetItemSet(), aLoadArgs ); + + ::comphelper::NamedValueCollection aArgs( aLoadArgs ); + aArgs.put( "Model", rDoc.GetModel() ); + aArgs.put( "Hidden", bHidden ); + if ( nViewId ) + aArgs.put( "ViewId", nViewId ); + + aLoadArgs = aArgs.getPropertyValues(); + + // load the doc into that frame + ::rtl::OUString sLoaderURL( rDoc.GetModel()->getURL() ); + if ( sLoaderURL.getLength() == 0 ) + sLoaderURL = rDoc.GetFactory().GetFactoryURL(); + + Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( + sLoaderURL, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), + 0, + aLoadArgs + ); + + for ( pFrame = SfxFrame::GetFirst(); + pFrame; + pFrame = SfxFrame::GetNext( *pFrame ) + ) + { + if ( pFrame->GetFrameInterface() == xFrame ) + break; + } + + OSL_ENSURE( pFrame, "SfxFrame::Create: load succeeded, but no SfxFrame was created during this!" ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return pFrame; +} + +SfxFrame* SfxFrame::Create( const Reference < XFrame >& i_rFrame ) +{ + // create a new TopFrame to an external XFrame object ( wrap controller ) + ENSURE_OR_THROW( i_rFrame.is(), "NULL frame not allowed" ); + Window* pWindow = VCLUnoHelper::GetWindow( i_rFrame->getContainerWindow() ); + ENSURE_OR_THROW( pWindow, "frame without container window not allowed" ); + + SfxFrame* pFrame = new SfxFrame( *pWindow, false ); + pFrame->SetFrameInterface_Impl( i_rFrame ); + return pFrame; +} + +SfxFrame::SfxFrame( Window& i_rContainerWindow, bool i_bHidden ) + :pParentFrame( NULL ) + ,pChildArr( NULL ) + ,pImp( NULL ) + ,pWindow( NULL ) +{ + Construct_Impl(); + + pImp->bHidden = i_bHidden; + InsertTopFrame_Impl( this ); + pImp->pExternalContainerWindow = &i_rContainerWindow; + + pWindow = new SfxFrameWindow_Impl( this, i_rContainerWindow ); + + // always show pWindow, which is the ComponentWindow of the XFrame we live in + // nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame + // is not done at level of the container window, not at SFX level. Thus, the component window can + // always be visible. + pWindow->Show(); +} + +void SfxFrame::SetPresentationMode( BOOL bSet ) +{ + if ( GetCurrentViewFrame() ) + GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL ); + + Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + + if ( xPropSet.is() ) + { + Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); + aValue >>= xLayoutManager; + } + + if ( xLayoutManager.is() ) + xLayoutManager->setVisible( !bSet ); // we don't want to have ui in presentation mode + + SetMenuBarOn_Impl( !bSet ); + if ( GetWorkWindow_Impl() ) + GetWorkWindow_Impl()->SetDockingAllowed( !bSet ); + if ( GetCurrentViewFrame() ) + GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE ); +} + +SystemWindow* SfxFrame::GetSystemWindow() const +{ + return GetTopWindow_Impl(); +} + +SystemWindow* SfxFrame::GetTopWindow_Impl() const +{ + if ( pImp->pExternalContainerWindow->IsSystemWindow() ) + return (SystemWindow*) pImp->pExternalContainerWindow; + else + return NULL; +} + +Window& SfxFrame::GetWindow() const +{ + return *pWindow; +} + +sal_Bool SfxFrame::Close() +{ + delete this; + return sal_True; +} + +void SfxFrame::LockResize_Impl( BOOL bLock ) +{ + pImp->bLockResize = bLock; +} + +IMPL_LINK( SfxFrameWindow_Impl, CloserHdl, void*, EMPTYARG ) +{ + if ( pFrame && !pFrame->PrepareClose_Impl( TRUE ) ) + return 0L; + + if ( pFrame ) + pFrame->GetCurrentViewFrame()->GetBindings().Execute( SID_CLOSEWIN, 0, 0, SFX_CALLMODE_ASYNCHRON ); + return 0L; +} + +void SfxFrame::SetMenuBarOn_Impl( BOOL bOn ) +{ + pImp->bMenuBarOn = bOn; + + Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + + if ( xPropSet.is() ) + { + Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); + aValue >>= xLayoutManager; + } + + if ( xLayoutManager.is() ) + { + rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )); + + if ( bOn ) + xLayoutManager->showElement( aMenuBarURL ); + else + xLayoutManager->hideElement( aMenuBarURL ); + } +} + +BOOL SfxFrame::IsMenuBarOn_Impl() const +{ + return pImp->bMenuBarOn; +} + +void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const +{ + Window *pWin = pImp->pExternalContainerWindow; + + // Groesse setzen + const Size aAppWindow( pImp->pExternalContainerWindow->GetDesktopRectPixel().GetSize() ); + Point aPos( rWinArea.TopLeft() ); + Size aSz( rWinArea.GetSize() ); + if ( aSz.Width() && aSz.Height() ) + { + aPos.X() = Min(aPos.X(), + long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); + aPos.Y() = Min(aPos.Y(), + long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); + if ( aPos.X() + aSz.Width() < + aAppWindow.Width() + aSz.Width() / 2 && + aPos.Y() + aSz.Height() < + aAppWindow.Height() + aSz.Height() / 2 ) + { + pWin->SetPosPixel( aPos ); + pWin->SetOutputSizePixel( aSz ); + } + } +} + +void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc ) +{ + const ::comphelper::NamedValueCollection aDocumentArgs( i_rDoc.GetModel()->getArgs() ); + + // hidden? + OSL_ENSURE( !pImp->bHidden, "when does this happen?" ); + pImp->bHidden = aDocumentArgs.getOrDefault( "Hidden", pImp->bHidden ); + + // update our descriptor + UpdateDescriptor( &i_rDoc ); + + // plugin mode + sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + if ( nPluginMode && ( nPluginMode != 2 ) ) + SetInPlace_Impl( TRUE ); +} + +bool SfxFrame::IsMarkedHidden_Impl() const +{ + return pImp->bHidden; +} diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index e1177e0a7b5f..ed158ce009e3 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -29,70 +29,85 @@ #include "precompiled_sfx2.hxx" #include "frmload.hxx" - -#include <framework/interaction.hxx> -#include <com/sun/star/frame/XLoadable.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include "objshimp.hxx" +#include "viewfac.hxx" +#include "sfx2/app.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/docfilt.hxx" +#include "sfx2/doctempl.hxx" +#include "sfx2/fcontnr.hxx" +#include "sfx2/frame.hxx" +#include "sfx2/request.hxx" +#include "sfx2/sfx.hrc" +#include "sfx2/sfxsids.hrc" +#include "sfx2/sfxuno.hxx" +#include "sfx2/viewfrm.hxx" +#include "sfx2/viewsh.hxx" + +/** === begin UNO includes === **/ #include <com/sun/star/container/XContainerQuery.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/document/XTypeDetection.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX -#include <comphelper/processfactory.hxx> -#endif -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> -#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> -#include <com/sun/star/ucb/CommandAbortedException.hpp> -#include <com/sun/star/ucb/InteractiveAppException.hpp> -#include <com/sun/star/document/XTypeDetection.hpp> -#include <framework/interaction.hxx> - -#ifndef _TOOLKIT_UNOHLP_HXX -#include <toolkit/helper/vclunohelper.hxx> -#endif -#include <ucbhelper/simpleinteractionrequest.hxx> +#include <com/sun/star/task/XInteractionHandler2.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +/** === end UNO includes === **/ -#include <rtl/ustring.h> +#include <comphelper/interaction.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <cppuhelper/exc_hlp.hxx> +#include <framework/interaction.hxx> #include <rtl/logfile.hxx> -#include <svl/itemset.hxx> -#include <vcl/window.hxx> +#include <rtl/ustring.h> +#include <sot/storinfo.hxx> +#include <svtools/ehdl.hxx> #include <svl/eitem.hxx> +#include <svl/itemset.hxx> +#include <unotools/moduleoptions.hxx> +#include <svtools/sfxecode.hxx> #include <svl/stritem.hxx> -#include <tools/urlobj.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> +#include <ucbhelper/simpleinteractionrequest.hxx> #include <vos/mutex.hxx> -#include <svtools/sfxecode.hxx> -#include <svtools/ehdl.hxx> -#include <sot/storinfo.hxx> -#include <comphelper/sequenceashashmap.hxx> -#include <comphelper/mediadescriptor.hxx> -#include <unotools/moduleoptions.hxx> - -#ifndef css -namespace css = ::com::sun::star; -#endif - -#include <sfx2/doctempl.hxx> -#include <sfx2/app.hxx> -#include <sfx2/request.hxx> -#include <sfx2/sfxsids.hrc> -#include <sfx2/dispatch.hxx> -#include <sfx2/sfxuno.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/topfrm.hxx> -#include <sfx2/frame.hxx> -#include <sfx2/docfac.hxx> -#include <sfx2/fcontnr.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/docfilt.hxx> -#include "brokenpackageint.hxx" -#include "objshimp.hxx" -SfxFrameLoader_Impl::SfxFrameLoader_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& /*xFactory*/ ) +/** === begin UNO using === **/ +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::container::XContainerQuery; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::document::XTypeDetection; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XLoadable; +using ::com::sun::star::frame::XModel; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::task::XInteractionHandler; +using ::com::sun::star::task::XInteractionHandler2; +using ::com::sun::star::task::XInteractionRequest; +using ::com::sun::star::task::XStatusIndicator; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::makeAny; +using ::com::sun::star::util::XCloseable; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XModel2; +/** === end UNO using === **/ + +SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory ) + :m_aContext( _rxFactory ) { } @@ -100,54 +115,46 @@ SfxFrameLoader_Impl::~SfxFrameLoader_Impl() { } -const SfxFilter* impl_detectFilterForURL(const ::rtl::OUString& sURL , - const css::uno::Sequence< css::beans::PropertyValue >& rArgs , - const SfxFilterMatcher& rMatcher) +// -------------------------------------------------------------------------------------------------------------------- +const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUString& sURL, + const ::comphelper::NamedValueCollection& i_rDescriptor, const SfxFilterMatcher& rMatcher ) const { - static ::rtl::OUString SERVICENAME_TYPEDETECTION = ::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection"); - ::rtl::OUString sFilter; try { - if (!sURL.getLength()) + if ( !sURL.getLength() ) return 0; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - if (!xSMGR.is()) - return 0; + Reference< XTypeDetection > xDetect( + m_aContext.createComponent( "com.sun.star.document.TypeDetection" ), + UNO_QUERY_THROW); + + ::comphelper::NamedValueCollection aNewArgs; + aNewArgs.put( "URL", sURL ); - css::uno::Reference< css::document::XTypeDetection > xDetect( - xSMGR->createInstance(SERVICENAME_TYPEDETECTION), - css::uno::UNO_QUERY_THROW); - - ::comphelper::MediaDescriptor lOrgArgs(rArgs); - css::uno::Reference< css::task::XInteractionHandler > xInteraction = lOrgArgs.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER(), - css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::task::XStatusIndicator > xProgress = lOrgArgs.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_STATUSINDICATOR(), - css::uno::Reference< css::task::XStatusIndicator >()); - - ::comphelper::SequenceAsHashMap lNewArgs; - lNewArgs[::comphelper::MediaDescriptor::PROP_URL()] <<= sURL; - if (xInteraction.is()) - lNewArgs[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteraction; - if (xProgress.is()) - lNewArgs[::comphelper::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress; - - css::uno::Sequence< css::beans::PropertyValue > lDescr = lNewArgs.getAsConstPropertyValueList(); - ::rtl::OUString sType = xDetect->queryTypeByDescriptor(lDescr, sal_True); - if (sType.getLength()) + if ( i_rDescriptor.has( "InteractionHandler" ) ) + aNewArgs.put( "InteractionHandler", i_rDescriptor.get( "InteractionHandler" ) ); + if ( i_rDescriptor.has( "StatusIndicator" ) ) + aNewArgs.put( "StatusIndicator", i_rDescriptor.get( "StatusIndicator" ) ); + + Sequence< PropertyValue > aQueryArgs( aNewArgs.getPropertyValues() ); + ::rtl::OUString sType = xDetect->queryTypeByDescriptor( aQueryArgs, sal_True ); + if ( sType.getLength() ) { - const SfxFilter* pFilter = rMatcher.GetFilter4EA(sType); - if (pFilter) + const SfxFilter* pFilter = rMatcher.GetFilter4EA( sType ); + if ( pFilter ) sFilter = pFilter->GetName(); } } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { sFilter = ::rtl::OUString(); } + catch ( const RuntimeException& ) + { + throw; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + sFilter = ::rtl::OUString(); + } const SfxFilter* pFilter = 0; if (sFilter.getLength()) @@ -155,453 +162,548 @@ const SfxFilter* impl_detectFilterForURL(const ::rtl::OUString& return pFilter; } -sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::beans::PropertyValue >& rArgs , - const css::uno::Reference< css::frame::XFrame >& rFrame ) - throw( css::uno::RuntimeException ) +// -------------------------------------------------------------------------------------------------------------------- +const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& i_rServiceName ) const { - static ::rtl::OUString PROP_URL = ::rtl::OUString::createFromAscii("URL" ); - static ::rtl::OUString PROP_FILENAME = ::rtl::OUString::createFromAscii("FileName" ); - static ::rtl::OUString PROP_TYPENAME = ::rtl::OUString::createFromAscii("TypeName" ); - static ::rtl::OUString PROP_FILTERNAME = ::rtl::OUString::createFromAscii("FilterName" ); - static ::rtl::OUString PROP_MODEL = ::rtl::OUString::createFromAscii("Model" ); - static ::rtl::OUString PROP_DOCUMENTSERVICE = ::rtl::OUString::createFromAscii("DocumentService" ); - static ::rtl::OUString PROP_READONLY = ::rtl::OUString::createFromAscii("ReadOnly" ); - static ::rtl::OUString PROP_ASTEMPLATE = ::rtl::OUString::createFromAscii("AsTemplate" ); - static ::rtl::OUString PROP_INTERACTIONHANDLER = ::rtl::OUString::createFromAscii("InteractionHandler"); - - sal_Bool bLoadState = sal_False; - - // this methods assumes that the filter is detected before, usually by calling the detect() method below - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + try + { + ::comphelper::NamedValueCollection aQuery; + aQuery.put( "DocumentService", i_rServiceName ); - RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); + const Reference< XContainerQuery > xQuery( + m_aContext.createComponent( "com.sun.star.document.FilterFactory" ), + UNO_QUERY_THROW ); - if ( !rFrame.is() ) - return sal_False; + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + const SfxFilterFlags nMust = SFX_FILTER_IMPORT; + const SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED; - ::comphelper::SequenceAsHashMap lDescriptor(rArgs); - String rURL = lDescriptor.getUnpackedValueOrDefault(PROP_URL , ::rtl::OUString() ); - String aTypeName = lDescriptor.getUnpackedValueOrDefault(PROP_TYPENAME , ::rtl::OUString() ); - aFilterName = lDescriptor.getUnpackedValueOrDefault(PROP_FILTERNAME , ::rtl::OUString() ); - String aServiceName = lDescriptor.getUnpackedValueOrDefault(PROP_DOCUMENTSERVICE , ::rtl::OUString() ); - css::uno::Reference< css::task::XInteractionHandler > xInteraction = lDescriptor.getUnpackedValueOrDefault(PROP_INTERACTIONHANDLER, css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::frame::XModel > xModel = lDescriptor.getUnpackedValueOrDefault(PROP_MODEL , css::uno::Reference< css::frame::XModel >() ); + Reference < XEnumeration > xEnum( xQuery->createSubSetEnumerationByProperties( + aQuery.getNamedValues() ), UNO_SET_THROW ); + while ( xEnum->hasMoreElements() ) + { + ::comphelper::NamedValueCollection aType( xEnum->nextElement() ); + ::rtl::OUString sFilterName = aType.getOrDefault( "Name", ::rtl::OUString() ); + if ( !sFilterName.getLength() ) + continue; + + const SfxFilter* pFilter = rMatcher.GetFilter4FilterName( sFilterName ); + if ( !pFilter ) + continue; + + SfxFilterFlags nFlags = pFilter->GetFilterFlags(); + if ( ( ( nFlags & nMust ) == nMust ) + && ( ( nFlags & nDont ) == 0 ) + ) + { + return pFilter; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; +} - const SfxFilter* pFilter = NULL; - const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); +// -------------------------------------------------------------------------------------------------------------------- +::rtl::OUString SfxFrameLoader_Impl::impl_askForFilter_nothrow( const Reference< XInteractionHandler >& i_rxHandler, + const ::rtl::OUString& i_rDocumentURL ) const +{ + ENSURE_OR_THROW( i_rxHandler.is(), "invalid interaction handler" ); - /* special mode: use already loaded model ... - In such case no filter name will be selected and no URL will be given! - Such informations are not neccessary. We have to create a new view only - and call setComponent() at the corresponding frame. */ - if( !xModel.is() ) + ::rtl::OUString sFilterName; + try { + ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( i_rDocumentURL ); + Reference< XInteractionRequest > xRequest ( pRequest ); + i_rxHandler->handle( xRequest ); + if( !pRequest->isAbort() ) + sFilterName = pRequest->getFilter(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } - // get filter by its name directly ... - if( aFilterName.Len() ) - pFilter = rMatcher.GetFilter4FilterName( aFilterName ); + return sFilterName; +} - // or search the preferred filter for the detected type ... - if( !pFilter && aTypeName.Len() ) - pFilter = rMatcher.GetFilter4EA(aTypeName); +// -------------------------------------------------------------------------------------------------------------------- +namespace +{ + sal_Bool lcl_getDispatchResult( const SfxPoolItem* _pResult ) + { + if ( !_pResult ) + return sal_False; - // or use given document service for detection too! - if (!pFilter && aServiceName.Len()) - { - ::comphelper::SequenceAsHashMap lQuery; + // default must be set to true, because some return values + // cant be checked, but nonetheless indicate "success"! + sal_Bool bSuccess = sal_True; - if (aServiceName.Len()) - lQuery[::rtl::OUString::createFromAscii("DocumentService")] <<= ::rtl::OUString(aServiceName); + // On the other side some special slots return a boolean state, + // which can be set to FALSE. + SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult ); + if ( pItem ) + bSuccess = pItem->GetValue(); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > xQuery ( xServiceManager->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), ::com::sun::star::uno::UNO_QUERY ); + return bSuccess; + } +} - SfxFilterFlags nMust = SFX_FILTER_IMPORT; - SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED; +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame, + const bool i_bHidden ) +{ + SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() ); + aRequest.AppendItem( SfxUnoFrameItem( SID_FILLFRAME, i_rxFrame ) ); + if ( i_bHidden ) + aRequest.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); + return lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) ); +} - ::com::sun::star::uno::Reference < com::sun::star::container::XEnumeration > xEnum = xQuery->createSubSetEnumerationByProperties(lQuery.getAsConstNamedValueList()); - while ( xEnum->hasMoreElements() ) - { - ::comphelper::SequenceAsHashMap aType( xEnum->nextElement() ); - aFilterName = aType.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("Name"), ::rtl::OUString()); - if (!aFilterName.Len()) - continue; - pFilter = rMatcher.GetFilter4FilterName(aFilterName); - if (!pFilter) - continue; - SfxFilterFlags nFlags = pFilter->GetFilterFlags(); - if ( - ((nFlags & nMust) == nMust) && - (!(nFlags & nDont )) - ) - { - break; - } - pFilter = 0; //! in case we reach end of enumeration we must have a valid value ... - } - } +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const +{ + const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); + if ( !bHidden ) + return; + + const SfxViewFrame* pExistingViewFrame = SfxViewFrame::GetFirst( &i_rDocument ); + if ( pExistingViewFrame ) + return; + + // the document is to be loaded hidden, and it is not yet displayed in any other frame + // To prevent it from being closed when the loader returns, increase its OwnerLock + // (the OwnerLock is normally increased by every frame in which the document is displayed, and by this loader) + i_rDocument.RestoreNoDelete(); + i_rDocument.OwnerLock( TRUE ); + i_rDocument.Get_Impl()->bHiddenLockedByAPI = TRUE; +} - // or use interaction to ask user for right filter. - if ( !pFilter && xInteraction.is() && rURL.Len() ) - { - ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( rURL ); - css::uno::Reference< css::task::XInteractionRequest > xRequest ( pRequest ); - xInteraction->handle( xRequest ); - if( !pRequest->isAbort() ) - { - aFilterName = pRequest->getFilter(); - pFilter = rMatcher.GetFilter4FilterName( aFilterName ); - } - } +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) const +{ + const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + const ::rtl::OUString sTypeName = io_rDescriptor.getOrDefault( "TypeName", ::rtl::OUString() ); + const ::rtl::OUString sFilterName = io_rDescriptor.getOrDefault( "FilterName", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const Reference< XInteractionHandler > + xInteraction = io_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); - if( !pFilter ) - return sal_False; + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + const SfxFilter* pFilter = NULL; + + // get filter by its name directly ... + if ( sFilterName.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sFilterName ); + + // or search the preferred filter for the detected type ... + if ( !pFilter && sTypeName.getLength() ) + pFilter = rMatcher.GetFilter4EA( sTypeName ); - aTypeName = pFilter->GetTypeName(); - // use filter names without prefix - aFilterName = pFilter->GetFilterName(); + // or use given document service for detection, too + if ( !pFilter && sServiceName.getLength() ) + pFilter = impl_getFilterFromServiceName_nothrow( sServiceName ); + + // or use interaction to ask user for right filter. + if ( !pFilter && xInteraction.is() && sURL.getLength() ) + { + ::rtl::OUString sSelectedFilter = impl_askForFilter_nothrow( xInteraction, sURL ); + if ( sSelectedFilter.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sSelectedFilter ); + } + + if ( pFilter ) + { + io_rDescriptor.put( "FilterName", ::rtl::OUString( pFilter->GetFilterName() ) ); // If detected filter indicates using of an own template format - // add property "AsTemplate" to descriptor. But supress this step + // add property "AsTemplate" to descriptor. But suppress this step // if such property already exists. - if( pFilter->IsOwnTemplateFormat()) + if ( pFilter->IsOwnTemplateFormat() && !io_rDescriptor.has( "AsTemplate" ) ) + io_rDescriptor.put( "AsTemplate", sal_Bool( sal_True ) ); + + // The DocumentService property will finally be used to determine the document type to create, so + // override it with the service name as indicated by the found filter. + io_rDescriptor.put( "DocumentService", ::rtl::OUString( pFilter->GetServiceName() ) ); + } +} + +// -------------------------------------------------------------------------------------------------------------------- +SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const +{ + for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) + { + if ( i_rxDocument == pDoc->GetModel() ) { - ::comphelper::SequenceAsHashMap::iterator pIt = lDescriptor.find(PROP_ASTEMPLATE); - if (pIt == lDescriptor.end()) - lDescriptor[PROP_ASTEMPLATE] <<= sal_True; + return pDoc; } } - xFrame = rFrame; + DBG_ERROR( "SfxFrameLoader_Impl::impl_findObjectShell: model is not based on SfxObjectShell - wrong frame loader usage!" ); + return NULL; +} - // Achtung: beim Abraeumen der Objekte kann die SfxApp destruiert werden, vorher noch Deinitialize_Impl rufen - SfxApplication* pApp = SFX_APP(); +// -------------------------------------------------------------------------------------------------------------------- +bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const +{ + const ::rtl::OUString sTemplateRegioName = io_rDescriptor.getOrDefault( "TemplateRegionName", ::rtl::OUString() ); + const ::rtl::OUString sTemplateName = io_rDescriptor.getOrDefault( "TemplateName", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + + // determine the full URL of the template to use, if any + String sTemplateURL; + if ( sTemplateRegioName.getLength() && sTemplateName.getLength() ) + { + SfxDocumentTemplates aTmpFac; + aTmpFac.GetFull( sTemplateRegioName, sTemplateName, sTemplateURL ); + } + else + { + if ( sServiceName.getLength() ) + sTemplateURL = SfxObjectFactory::GetStandardTemplate( sServiceName ); + else + sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) ); + } - // Attention! Because lDescriptor is a copy of rArgs - // and was might by changed (e.g. for AsTemplate) - // move all changes there back! - SfxAllItemSet aSet( pApp->GetPool() ); - TransformParameters( SID_OPENDOC, lDescriptor.getAsConstPropertyValueList(), aSet ); + if ( sTemplateURL.Len() > 0 ) + { + // detect the filter for the template. Might still be NULL (if the template is broken, or does not + // exist, or some such), but this is handled by our caller the same way as if no template/URL was present. + const SfxFilter* pTemplateFilter = impl_detectFilterForURL( sTemplateURL, io_rDescriptor, SFX_APP()->GetFilterMatcher() ); + if ( pTemplateFilter ) + { + // load the template document, but, well, "as template" + io_rDescriptor.put( "FilterName", ::rtl::OUString( pTemplateFilter->GetName() ) ); + io_rDescriptor.put( "FileName", ::rtl::OUString( sTemplateURL ) ); + io_rDescriptor.put( "AsTemplate", sal_True ); - SFX_ITEMSET_ARG( &aSet, pRefererItem, SfxStringItem, SID_REFERER, FALSE ); - if ( !pRefererItem ) - aSet.Put( SfxStringItem( SID_REFERER, String() ) ); + // #i21583# + // the DocumentService property will finally be used to create the document. Thus, override any possibly + // present value with the document service of the template. + io_rDescriptor.put( "DocumentService", ::rtl::OUString( pTemplateFilter->GetServiceName() ) ); + return true; + } + } + return false; +} - SfxFrame* pFrame=0; - for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) +// -------------------------------------------------------------------------------------------------------------------- +USHORT SfxFrameLoader_Impl::impl_findSlotParam( const ::rtl::OUString& i_rFactoryURL ) const +{ + ::rtl::OUString sSlotParam; + const sal_Int32 nParamPos = i_rFactoryURL.indexOf( '?' ); + if ( nParamPos >= 0 ) { - if ( pFrame->GetFrameInterface() == xFrame ) - break; + // currently only the "slot" parameter is supported + const sal_Int32 nSlotPos = i_rFactoryURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "slot=" ), nParamPos ); + if ( nSlotPos > 0 ) + sSlotParam = i_rFactoryURL.copy( nSlotPos + 5 ); } - BOOL bFrameCreated = FALSE; - if ( !pFrame ) + if ( sSlotParam.getLength() ) + return USHORT( sSlotParam.toInt32() ); + + return 0; +} + +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_handleCaughtError_nothrow( const Any& i_rCaughtError, const ::comphelper::NamedValueCollection& i_rDescriptor ) const +{ + try + { + const Reference< XInteractionHandler > xInteraction = + i_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); + if ( !xInteraction.is() ) + return; + ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( i_rCaughtError ) ); + ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove ); + pRequest->addContinuation( pApprove.get() ); + + const Reference< XInteractionHandler2 > xHandler( xInteraction, UNO_QUERY ); + #if OSL_DEBUG_LEVEL > 0 + const sal_Bool bHandled = + #endif + xHandler.is() && xHandler->handleInteractionRequest( pRequest.get() ); + + #if OSL_DEBUG_LEVEL > 0 + if ( !bHandled ) + // the interaction handler couldn't deal with this error + // => report it as assertion, at least (done in the DBG_UNHANDLED_EXCEPTION below) + ::cppu::throwException( i_rCaughtError ); + #endif + } + catch( const Exception& ) { - pFrame = SfxTopFrame::Create( rFrame ); - bFrameCreated = TRUE; + DBG_UNHANDLED_EXCEPTION(); } +} + +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCollection& io_rDescriptor ) +{ + // remove the arguments which are for the loader only, and not for a call to attachResource + io_rDescriptor.remove( "StatusIndicator" ); + io_rDescriptor.remove( "Model" ); +} - if ( xModel.is() ) +// -------------------------------------------------------------------------------------------------------------------- +::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ) +{ + const sal_Char* pKnownViewArgs[] = { + "JumpMark" + }; + + ::comphelper::NamedValueCollection aViewArgs; + for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i ) { - // !TODO: replace by ViewFactory - if ( pFrame->GetFrameInterface()->getController().is() ) + if ( io_rDescriptor.has( pKnownViewArgs[i] ) ) { - // remove old component - // if a frame was created already, it can't be an SfxComponent! - pFrame->GetFrameInterface()->setComponent( 0, 0 ); - if ( !bFrameCreated ) - pFrame = SfxTopFrame::Create( rFrame ); + aViewArgs.put( pKnownViewArgs[i], io_rDescriptor.get( pKnownViewArgs[i] ) ); + io_rDescriptor.remove( pKnownViewArgs[i] ); } + } + return aViewArgs; +} - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - - for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) +// -------------------------------------------------------------------------------------------------------------------- +sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) +{ + sal_Int16 nViewId = i_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) ); + try + { + if ( nViewId == 0 ) do { - if ( xModel == pDoc->GetModel() ) - { - pFrame->SetItemSet_Impl( &aSet ); - ::comphelper::SequenceAsHashMap lUpdateDescr( lDescriptor ); - lUpdateDescr.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) ); - lUpdateDescr.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ); - - xModel->attachResource( rURL, lUpdateDescr.getAsConstPropertyValueList() ); - return pFrame->InsertDocument( pDoc ); - } + Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData.set( xViewDataSupplier->getViewData() ); + + if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) + // no view data stored together with the model + break; + + // obtain the ViewID from the view data + Sequence< PropertyValue > aViewData; + if ( !( xViewData->getByIndex( 0 ) >>= aViewData ) ) + break; + + ::comphelper::NamedValueCollection aNamedViewData( aViewData ); + ::rtl::OUString sViewId = aNamedViewData.getOrDefault( "ViewId", ::rtl::OUString() ); + if ( !sViewId.getLength() ) + break; + + // somewhat weird convention here ... in the view data, the ViewId is a string, effectively describing + // a view name. In the document load descriptor, the ViewId is in fact the numeric ID. + + SfxViewFactory* pViewFactory = i_rDocument.GetFactory().GetViewFactoryByViewName( sViewId ); + if ( pViewFactory ) + nViewId = sal_Int16( pViewFactory->GetOrdinal() ); } - - DBG_ERROR("Model is not based on SfxObjectShell - wrong frame loader use!"); - return sal_False; + while ( false ); } - - // check for the URL pattern of our factory URLs - SfxFrameWeak wFrame = pFrame; - String aPrefix = String::CreateFromAscii( "private:factory/" ); - String aFact( rURL ); - if ( aPrefix.Len() == aFact.Match( aPrefix ) ) + catch( const Exception& ) { - if ( !aServiceName.Len() ) - aServiceName = SfxObjectShell::GetServiceNameFromFactory( rURL ); + DBG_UNHANDLED_EXCEPTION(); + } - // it's a factory URL - aFact.Erase( 0, aPrefix.Len() ); + if ( nViewId == 0 ) + nViewId = i_rDocument.GetFactory().GetViewFactory( 0 ).GetOrdinal(); + return nViewId; +} - // look for parameters - String aParam; - USHORT nPos = aFact.Search( '?' ); - if ( nPos != STRING_NOTFOUND ) - { - // currently only the "slot" parameter is supported - USHORT nParamPos = aFact.Search( String::CreateFromAscii("slot="), nPos ); - if ( nParamPos != STRING_NOTFOUND ) - aParam = aFact.Copy( nParamPos+5, aFact.Len() ); - aFact.Erase( nPos, aFact.Len() ); - } +// -------------------------------------------------------------------------------------------------------------------- +Reference< XController2 > SfxFrameLoader_Impl::impl_createDocumentView( const Reference< XModel2 >& i_rModel, + const Reference< XFrame >& i_rFrame, const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, + const ::rtl::OUString& i_rViewName ) +{ + // let the model create a new controller + const Reference< XController2 > xController( i_rModel->createViewController( + i_rViewName, + i_rViewFactoryArgs.getPropertyValues(), + i_rFrame + ), UNO_SET_THROW ); + + // introduce model/view/controller to each other + xController->attachModel( i_rModel.get() ); + i_rModel->connectController( xController.get() ); + i_rFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( i_rFrame ); + i_rModel->setCurrentController( xController.get() ); + + return xController; +} - WildCard aSearchedFac( aFact.EraseAllChars('4').ToUpperAscii() ); - SFX_ITEMSET_ARG( &aSet, pDocumentTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); - INetURLObject aObj( rURL ); +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rArgs, + const Reference< XFrame >& _rTargetFrame ) + throw( RuntimeException ) +{ + ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); - if ( aParam.Len() ) - { - sal_uInt16 nSlotId = (sal_uInt16) aParam.ToInt32(); - SfxRequest aReq( nSlotId, SFX_CALLMODE_SYNCHRON, pApp->GetPool() ); - aReq.AppendItem( SfxFrameItem ( SID_DOCFRAME, pFrame ) ); - const SfxPoolItem* pRet = pApp->ExecuteSlot( aReq ); - if ( pRet ) - { - // default must be set to true, because some return values - // cant be checked ... but indicates "success"! - bLoadState = sal_True; - - // On the other side some special slots return a boolean state, - // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); - if (pItem) - bLoadState = pItem->GetValue(); - } - else - bLoadState = sal_False; + ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) - { - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - } + RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); - xFrame.clear(); - xListener.clear(); - return bLoadState; - } + ::comphelper::NamedValueCollection aDescriptor( rArgs ); - String sTemplateURL; - SFX_ITEMSET_ARG( &aSet, pTemplateRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, FALSE ); - SFX_ITEMSET_ARG( &aSet, pTemplateNameItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE ); - if ( pTemplateRegionItem && pTemplateNameItem ) - { - SfxDocumentTemplates aTmpFac; - aTmpFac.GetFull( pTemplateRegionItem->GetValue(), pTemplateNameItem->GetValue(), sTemplateURL ); - } - else + // ensure the descriptor contains a referrer + if ( !aDescriptor.has( "Referer" ) ) + aDescriptor.put( "Referer", ::rtl::OUString() ); + + // TODO: is this needed? finally, when loading is successfull, then there should be no need for this item, + // as the document can always obtain its frame. In particular, there might be situations where this frame + // is accessed, but already disposed: Imagine the user loading a document, opening a second view on it, and + // then closing the first view/frame. + aDescriptor.put( "Frame", _rTargetFrame ); + + // did the caller already pass a model? + Reference< XModel2 > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel2 >() ); + const bool bExternalModel = xModel.is(); + + // check for factory URLs to create a new doc, instead of loading one + const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + const bool bIsFactoryURL = ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ); + bool bInitNewModel = bIsFactoryURL; + if ( bIsFactoryURL && !bExternalModel ) + { + const ::rtl::OUString sFactory = sURL.copy( sizeof( "private:factory/" ) -1 ); + // special handling for some weird factory URLs a la private:factory/swriter?slot=21053 + const USHORT nSlotParam = impl_findSlotParam( sFactory ); + if ( nSlotParam != 0 ) { - sTemplateURL = SfxObjectFactory::GetStandardTemplate( aServiceName ); + return impl_createNewDocWithSlotParam( nSlotParam, _rTargetFrame, aDescriptor.getOrDefault( "Hidden", false ) ); } - BOOL bUseTemplate = (sTemplateURL.Len()>0); - if( bUseTemplate ) + const bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); + if ( bDescribesValidTemplate ) { - // #i21583# - // Forget the filter, which was detected for the corresponding "private:factory/xxx" URL. - // We must use the right filter, matching to this document ... not to the private URL! - const SfxFilter* pTemplateFilter = impl_detectFilterForURL(sTemplateURL, rArgs, rMatcher); - if (pTemplateFilter) - { - pFilter = pTemplateFilter; - aFilterName = pTemplateFilter->GetName(); - // standard template set -> load it "AsTemplate" - aSet.Put( SfxStringItem ( SID_FILE_NAME, sTemplateURL ) ); - aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); - } - - // #119268# - // something is wrong with the set default template (e.g. unknown format, missing file etcpp) - // The we have to jump into the following special code, where "private:factory/ URL's are handled. - // We cant "load" such private/factory URL's! - else - bUseTemplate = FALSE; + // if the media descriptor allowed us to determine a template document to create the new document + // from, then do not init a new document model from scratch (below), but instead load the + // template document + bInitNewModel = false; } - - if ( !bUseTemplate ) + else { - // execute "NewDocument" request - /* Attention! - #107913# - Pointers can't be used to check if two objects are equals! - E.g. the memory manager can reuse freed memory ... - and then the holded copy of a pointer will point to another - (and different!) object - may using the same type then before. - In such case we compare one object with itself ... - */ - SfxRequest aReq( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet ); - aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - aReq.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, aFact ) ); - - if ( pDocumentTitleItem ) - aReq.AppendItem( *pDocumentTitleItem ); - - const SfxPoolItem* pRet = pApp->NewDocDirectExec_ImplOld(aReq); - if (pRet) - { - // default must be set to true, because some return values - // cant be checked ... but indicates "success"! - bLoadState = sal_True; - - // On the other side some special slots return a boolean state, - // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); - if (pItem) - bLoadState = pItem->GetValue(); - } - else - bLoadState = sal_False; - - if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) - { - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - } - - xFrame.clear(); - xListener.clear(); - return bLoadState; + const ::rtl::OUString sServiceName = SfxObjectShell::GetServiceNameFromFactory( sFactory ); + aDescriptor.put( "DocumentService", sServiceName ); } } else { - // load the desired file - aSet.Put( SfxStringItem ( SID_FILE_NAME, rURL ) ); + // compatibility + aDescriptor.put( "FileName", aDescriptor.get( "URL" ) ); } - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - aSet.Put( SfxUnoAnyItem( SID_FILLFRAME, css::uno::makeAny(xFrame) ) ); - aSet.Put( SfxStringItem( SID_FILTER_NAME, aFilterName ) ); - - // !TODO: replace by direct construction of model (needs view factory) - DBG_ASSERT( pFilter, "No filter set!" ); - if ( !pFilter ) - return sal_False; - - sal_Bool bDisaster = sal_False; - SfxObjectShell* pDoc = SfxObjectShell::CreateObject( pFilter->GetServiceName() ); - if ( pDoc ) + sal_Bool bLoadSuccess = sal_False; + try { - css::uno::Reference< css::frame::XLoadable > xLoadable = css::uno::Reference< css::frame::XLoadable >( pDoc->GetModel(), css::uno::UNO_QUERY ); - css::uno::Sequence < css::beans::PropertyValue > aLoadArgs; - TransformItems( SID_OPENDOC, aSet, aLoadArgs ); - try + // extract view releant arguments from the loader args + ::comphelper::NamedValueCollection aViewCreationArgs( impl_extractViewCreationArgs( aDescriptor ) ); + + // no model passed from outside? => create one from scratch + if ( !xModel.is() ) { - xLoadable->load( aLoadArgs ); - - SfxMedium* pDocMedium = pDoc->GetMedium(); - BOOL bHidden = FALSE; - SFX_ITEMSET_ARG( pDocMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); - if ( pHidItem ) - bHidden = pHidItem->GetValue(); - - // !TODO: will be done by Framework! - pDocMedium->SetUpdatePickList( !bHidden ); - - /* - #121119# - We dont know why pFrame can be corrupt here. - But if it was deleted it shouldnt exists inside our global list. - May be we can use the damaged pointer to detect if it was removed from - this global list. - */ - SfxFrame* pTmp=0; - for ( pTmp = SfxFrame::GetFirst(); pTmp; pTmp = SfxFrame::GetNext( *pTmp ) ) + // beforehand, determine the filter to use, and update the descriptor with its information + if ( !bInitNewModel ) { - if ( pFrame == pTmp ) - break; + impl_determineFilter( aDescriptor ); } - if ( pTmp == pFrame ) + // create the new doc + const ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + xModel.set( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW ); + + // load resp. init it + const Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); + if ( bInitNewModel ) { - // !TODO: replace by ViewFactory - if ( pFrame->GetFrameInterface()->getController().is() ) - { - // remove old component - // if a frame was created already, it can't be an SfxComponent! - // pFrame->GetFrameInterface()->setComponent( 0, 0 ); - if ( !bFrameCreated ) - pFrame = SfxTopFrame::Create( rFrame ); - } - - wFrame = pFrame; - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - if( pFrame->InsertDocument( pDoc ) ) - { - pFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String aURL = pDoc->GetMedium()->GetName(); - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); - bLoadState = sal_True; - } - else - bDisaster = sal_True; + xLoadable->initNew(); + + impl_removeLoaderArguments( aDescriptor ); + xModel->attachResource( ::rtl::OUString(), aDescriptor.getPropertyValues() ); } else { - DBG_ERROR("#121119# You found the reason for a stacktrace! Frame destroyed while loading document."); - bLoadState = sal_False; + xLoadable->load( aDescriptor.getPropertyValues() ); } } - catch ( css::uno::Exception& ) + else { - bDisaster = sal_True; + // tell the doc its (current) load args. + impl_removeLoaderArguments( aDescriptor ); + xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); + // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could + // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) + // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document + // might have a mode other than the one passed to the loader, and we always overwrite the former with + // the latter. } - if ( bDisaster ) - { - if ( wFrame && !wFrame->GetCurrentDocument() ) - { - // document loading was not successful; close SfxFrame (but not XFrame!) - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - aSet.ClearItem( SID_DOCFRAME ); - } + // get the SfxObjectShell (still needed at the moment) + const SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); + ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); + + // ensure the ID of the to-be-created view is in the descriptor, if possible + const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); + const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); + const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); + + // if the document is created hidden, prevent it from being deleted until it is shown or disposed + impl_lockHiddenDocument( *xDoc, aDescriptor ); + // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, + // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter + // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the + // object is closed (DoClose). The impl_lockHiddenDocument is to prevent exactly that premature + // closing. However, a *Ref object wouldn't close, anyway. And in case of unsuccessfull loading, the + // code at the very end of this method cares for closing the XModel, which should also close the + // ObjectShell. + + // plug the document into the frame + impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName ); + bLoadSuccess = sal_True; + } + catch ( Exception& ) + { + const Any aError( ::cppu::getCaughtException() ); + if ( !aDescriptor.getOrDefault( "Silent", sal_False ) ) + impl_handleCaughtError_nothrow( aError, aDescriptor ); + } - css::uno::Reference< css::util::XCloseable > xCloseable( xLoadable, css::uno::UNO_QUERY ); - if ( xCloseable.is() ) - { - try { - xCloseable->close( sal_True ); - } catch ( css::uno::Exception& ) - {} - } + // if loading was not successful, close the document + if ( !bLoadSuccess && !bExternalModel ) + { + try + { + const Reference< XCloseable > xCloseable( xModel, UNO_QUERY_THROW ); + xCloseable->close( sal_True ); + } + catch ( Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } } - xFrame.clear(); - xListener.clear(); - return bLoadState; + return bLoadSuccess; } -void SfxFrameLoader_Impl::cancel() throw( RUNTIME_EXCEPTION ) +void SfxFrameLoader_Impl::cancel() throw( RuntimeException ) { } SFX_IMPL_SINGLEFACTORY( SfxFrameLoader_Impl ) /* XServiceInfo */ -UNOOUSTRING SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( UNORUNTIMEEXCEPTION ) +UNOOUSTRING SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( RuntimeException ) { return impl_getStaticImplementationName(); } \ /* XServiceInfo */ -sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServiceName ) throw( UNORUNTIMEEXCEPTION ) +sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServiceName ) throw( RuntimeException ) { UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames(); const UNOOUSTRING* pArray = seqServiceNames.getConstArray(); @@ -616,7 +718,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServ } /* XServiceInfo */ -UNOSEQUENCE< UNOOUSTRING > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION ) +UNOSEQUENCE< UNOOUSTRING > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() throw( RuntimeException ) { return impl_getStaticSupportedServiceNames(); } diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index 9098ffd8f842..72f322036efb 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -28,8 +28,6 @@ #ifndef _SFX_IMPFRAME_HXX #define _SFX_IMPFRAME_HXX -#include <svl/cancel.hxx> - #include <sfx2/frame.hxx> #include <sfx2/viewfrm.hxx> // SvBorder @@ -51,60 +49,51 @@ class SfxObjectShell; #define FRAME_SEARCH_CREATE 0x00000008 #endif -class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase, public SfxListener +class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase { -friend class SfxFrame; - +public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame; - String aFrameIdName; sal_uInt32 nType; - sal_uInt32 nHistoryPos; SfxViewFrame* pCurrentViewFrame; - SfxObjectShell* pCurrentObjectShell; SfxFrameDescriptor* pDescr; - sal_uInt16 nFrameId; sal_uInt16 nLocks; - sal_Bool bCloseOnUnlock : 1; sal_Bool bClosing : 1; sal_Bool bPrepClosing : 1; sal_Bool bInCancelTransfers : 1; sal_Bool bOwnsBindings : 1; sal_Bool bReleasingComponent : 1; - sal_Bool bFocusLocked : 1; sal_Bool bInPlace : 1; - SfxCancelManager* pCancelMgr; - SfxCancellable* pLoadCancellable; SfxFrame* pFrame; - const SfxItemSet* pSet; SfxWorkWindow* pWorkWin; SvBorder aBorder; + // formerly SfxTopFrame + Window* pExternalContainerWindow; + bool bHidden; + bool bLockResize; + bool bMenuBarOn; - SfxFrame_Impl( SfxFrame* pAntiImplP ) : - SvCompatWeakBase( pAntiImplP ), - nType( 0L ), - nHistoryPos( 0 ), - pCurrentViewFrame( NULL ), - pCurrentObjectShell( NULL ), - pDescr( NULL ), - nFrameId( 0 ), - nLocks( 0 ), - bCloseOnUnlock( sal_False ), - bClosing(sal_False), - bPrepClosing(sal_False), - bInCancelTransfers( sal_False ), - bOwnsBindings( sal_False ), - bReleasingComponent( sal_False ), - bFocusLocked( sal_False ), - bInPlace( sal_False ), - pCancelMgr( 0 ), - pLoadCancellable( 0 ), - pFrame( pAntiImplP ), - pSet( 0 ), - pWorkWin( 0 ) - {} + SfxFrame_Impl( SfxFrame* pAntiImplP ) + :SvCompatWeakBase( pAntiImplP ) + ,nType( 0L ) + ,pCurrentViewFrame( NULL ) + ,pDescr( NULL ) + ,nLocks( 0 ) + ,bClosing(sal_False) + ,bPrepClosing(sal_False) + ,bInCancelTransfers( sal_False ) + ,bOwnsBindings( sal_False ) + ,bReleasingComponent( sal_False ) + ,bInPlace( sal_False ) + ,pFrame( pAntiImplP ) + ,pWorkWin( 0 ) + ,pExternalContainerWindow( NULL ) + ,bHidden( false ) + ,bLockResize( false ) + ,bMenuBarOn( true ) + { + } - virtual ~SfxFrame_Impl() { delete pCancelMgr; delete pLoadCancellable; } - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual ~SfxFrame_Impl() { } }; #endif diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx new file mode 100644 index 000000000000..5460d613c7e8 --- /dev/null +++ b/sfx2/source/view/impviewframe.hxx @@ -0,0 +1,94 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 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. +************************************************************************/ + +#ifndef SFX2_IMPVIEWFRAME_HXX +#define SFX2_IMPVIEWFRAME_HXX + +#include "sfx2/viewfrm.hxx" + +#include <svtools/asynclink.hxx> +#include <vcl/window.hxx> + +struct SfxViewFrame_Impl +{ + SvBorder aBorder; + Size aMargin; + Size aSize; + String aFrameTitle; + TypeId aLastType; + String aActualURL; + SfxFrame& rFrame; + svtools::AsynchronLink* pReloader; + Window* pWindow; + SfxViewFrame* pActiveChild; + Window* pFocusWin; + sal_uInt16 nDocViewNo; + sal_uInt16 nCurViewId; + sal_Bool bResizeInToOut:1; + sal_Bool bDontOverwriteResizeInToOut:1; + sal_Bool bObjLocked:1; + sal_Bool bReloading:1; + sal_Bool bIsDowning:1; + sal_Bool bModal:1; + sal_Bool bEnabled:1; + sal_Bool bWindowWasEnabled:1; + sal_Bool bActive; + String aFactoryName; + + SfxViewFrame_Impl( SfxFrame& i_rFrame ) + : rFrame( i_rFrame ) + , pReloader(0 ) + , pWindow( 0 ) + , bWindowWasEnabled(sal_True) + , bActive( sal_False ) + { + } + + ~SfxViewFrame_Impl() + { + delete pReloader; + } +}; + +class SfxFrameViewWindow_Impl : public Window +{ + BOOL bActive; + SfxViewFrame* pFrame; + +public: + SfxFrameViewWindow_Impl( SfxViewFrame* p, Window& rParent, WinBits nBits=0 ) : + Window( &rParent, nBits | WB_BORDER | WB_CLIPCHILDREN ), + bActive( FALSE ), + pFrame( p ) + { + p->GetFrame().GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + } + + virtual void Resize(); + virtual void StateChanged( StateChangedType nStateChange ); +}; + +#endif // SFX2_IMPVIEWFRAME_HXX + diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 56e14f43a08c..6d61f4182bbb 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -57,7 +57,7 @@ #include <sfx2/dispatch.hxx> #include "workwin.hxx" #include "guisaveas.hxx" -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <cppuhelper/implbase5.hxx> #include <vcl/salbtype.hxx> #include <svtools/ehdl.hxx> @@ -201,7 +201,7 @@ throw (::com::sun::star::uno::RuntimeException) // currently needs SFX code SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDoc ); - SfxWorkWindow *pWorkWin = pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pFrame->GetFrame().GetWorkWindow_Impl(); pWorkWin->UpdateObjectBars_Impl(); } */ @@ -231,7 +231,7 @@ uno::Reference < frame::XFrame > SfxInPlaceClient_Impl::GetFrame() const { if ( !m_pClient ) throw uno::RuntimeException(); - return m_pClient->GetViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(); + return m_pClient->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(); } void SAL_CALL SfxInPlaceClient_Impl::saveObject() @@ -733,7 +733,7 @@ void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject } } - if ( !m_pViewSh || m_pViewSh->GetViewFrame()->GetFrame()->IsClosing_Impl() ) + if ( !m_pViewSh || m_pViewSh->GetViewFrame()->GetFrame().IsClosing_Impl() ) // sometimes applications reconnect clients on shutting down because it happens in their Paint methods return; @@ -983,7 +983,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) { if ( m_pViewSh ) - ((SfxTopFrame*)m_pViewSh->GetViewFrame()->GetTopFrame())->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(TRUE); try { m_pImp->m_xObject->setClientSite( m_pImp->m_xClient ); @@ -1033,8 +1033,8 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) if ( m_pViewSh ) { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); - ((SfxTopFrame*)pFrame->GetTopFrame())->LockResize_Impl(FALSE); - pFrame->GetTopFrame()->Resize(); + pFrame->GetTopFrame().LockResize_Impl(FALSE); + pFrame->GetTopFrame().Resize(); } } } @@ -1094,7 +1094,7 @@ void SfxInPlaceClient::DeactivateObject() } if ( m_pViewSh ) - ((SfxTopFrame*)m_pViewSh->GetViewFrame()->GetTopFrame())->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(TRUE); if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) { @@ -1116,8 +1116,8 @@ void SfxInPlaceClient::DeactivateObject() { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); SfxViewFrame::SetViewFrame( pFrame ); - ((SfxTopFrame*)pFrame->GetTopFrame())->LockResize_Impl(FALSE); - pFrame->GetTopFrame()->Resize(); + pFrame->GetTopFrame().LockResize_Impl(FALSE); + pFrame->GetTopFrame().Resize(); } } catch (com::sun::star::uno::Exception& ) diff --git a/sfx2/source/view/makefile.mk b/sfx2/source/view/makefile.mk index 758fd5ccb806..9c257f4c9f75 100644 --- a/sfx2/source/view/makefile.mk +++ b/sfx2/source/view/makefile.mk @@ -45,17 +45,17 @@ SRC1FILES = \ view.src SLOFILES = \ - $(SLO)$/ipclient.obj \ + $(SLO)$/ipclient.obj \ $(SLO)$/viewsh.obj \ $(SLO)$/frmload.obj \ $(SLO)$/frame.obj \ + $(SLO)$/frame2.obj \ $(SLO)$/printer.obj \ $(SLO)$/viewprn.obj \ $(SLO)$/viewfac.obj \ $(SLO)$/orgmgr.obj \ $(SLO)$/viewfrm.obj \ - $(SLO)$/impframe.obj \ - $(SLO)$/topfrm.obj \ + $(SLO)$/viewfrm2.obj \ $(SLO)$/sfxbasecontroller.obj \ $(SLO)$/userinputinterception.obj diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx index 9f42f438cffa..a4e96ab1065e 100644 --- a/sfx2/source/view/prnmon.cxx +++ b/sfx2/source/view/prnmon.cxx @@ -319,7 +319,7 @@ SfxPrintProgress::~SfxPrintProgress() pImp->pViewShell->GetPrinter()->EnablePrintFile( pImp->bOldEnablePrintFile ); // EndPrint-Notification an Frame - //pImp->pViewShell->GetViewFrame()->GetFrame()->Lock_Impl(FALSE); + //pImp->pViewShell->GetViewFrame()->GetFrame().Lock_Impl(FALSE); pImp->EndListening( *(pImp->pViewShell->GetObjectShell()) ); // the following call might destroy the view or even the document diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 88afc2796429..f5c24b195af7 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -46,6 +46,7 @@ #include <com/sun/star/util/XCloseBroadcaster.hpp> #include <com/sun/star/util/XCloseListener.hpp> #include <com/sun/star/util/CloseVetoException.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx> #include <com/sun/star/frame/FrameActionEvent.hpp> @@ -53,15 +54,18 @@ #include <com/sun/star/frame/CommandGroup.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XBorderResizeListener.hpp> +#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> #include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/implbase1.hxx> #include <basic/sbstar.hxx> #include <uno/mapping.hxx> #include <sfx2/viewsh.hxx> +#include <sfx2/docfac.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/objsh.hxx> #include <sfx2/app.hxx> @@ -84,10 +88,12 @@ #include <toolkit/helper/convert.hxx> #include <framework/titlehelper.hxx> #include <comphelper/processfactory.hxx> +#include <tools/diagnose_ex.h> #include <hash_map> #include <sfx2/event.hxx> +#include "viewfac.hxx" #define OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper #define OINTERFACECONTAINERHELPER ::cppu::OInterfaceContainerHelper @@ -109,6 +115,24 @@ #define TIMEOUT_START_RESCHEDULE 10L /* 10th s */ using namespace ::com::sun::star; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::lang::DisposedException; +using ::com::sun::star::awt::XWindow; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XDispatchProvider; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XFrameActionListener; +using ::com::sun::star::util::XCloseListener; +using ::com::sun::star::task::XStatusIndicator; +using ::com::sun::star::frame::XTitle; namespace css = ::com::sun::star; struct GroupIDToCommandGroup @@ -220,7 +244,7 @@ void reschedule() class SfxStatusIndicator : public ::cppu::WeakImplHelper2< ::com::sun::star::task::XStatusIndicator, ::com::sun::star::lang::XEventListener > { friend class SfxBaseController; - ::com::sun::star::uno::Reference < XCONTROLLER > xOwner; + ::com::sun::star::uno::Reference < XController > xOwner; ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator > xProgress; SfxWorkWindow* pWorkWindow; sal_Int32 _nRange; @@ -427,29 +451,19 @@ void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::notifyClosing( const E struct IMPL_SfxBaseController_DataContainer { - REFERENCE < XFRAME > m_xFrame; - REFERENCE < XFRAMEACTIONLISTENER > m_xListener ; - REFERENCE < XCLOSELISTENER > m_xCloseListener ; + Reference< XFrame > m_xFrame ; + Reference< XFrameActionListener > m_xListener ; + Reference< XCloseListener > m_xCloseListener ; ::sfx2::UserInputInterception m_aUserInputInterception; OMULTITYPEINTERFACECONTAINERHELPER m_aListenerContainer ; - OINTERFACECONTAINERHELPER m_aInterceptorContainer ; - REFERENCE < ::com::sun::star::task::XStatusIndicator > m_xIndicator; + OINTERFACECONTAINERHELPER m_aInterceptorContainer ; + Reference< XStatusIndicator > m_xIndicator ; SfxViewShell* m_pViewShell ; SfxBaseController* m_pController ; sal_Bool m_bDisposing ; - sal_Bool m_bSuspendState; - /** When this flag is <true/> (the default) then in dispose() the frame - and with it the view shell are released together with the - controller. - A derived class can set the flag to <false/> when it wants to - exchange controllers that work on the same view shell. One - application is the Impress Multi Pane GUI that changes shells that - are stacked on one view shell. Controllers are associated with the - stacked shells and thus must not destroy the view shell which is not - affected by the switching. - */ - sal_Bool m_bIsFrameReleasedWithController; - css::uno::Reference< css::frame::XTitle > m_xTitleHelper; + sal_Bool m_bSuspendState ; + Reference< XTitle > m_xTitleHelper ; + Sequence< PropertyValue > m_aCreationArgs ; IMPL_SfxBaseController_DataContainer( MUTEX& aMutex , SfxViewShell* pViewShell , @@ -463,7 +477,6 @@ struct IMPL_SfxBaseController_DataContainer , m_pController ( pController ) , m_bDisposing ( sal_False ) , m_bSuspendState ( sal_False ) - , m_bIsFrameReleasedWithController( sal_True ) { } @@ -525,8 +538,7 @@ void SAL_CALL IMPL_SfxBaseController_ListenerHelper::disposing( const EVENTOBJEC //________________________________________________________________________________________________________ DBG_NAME(sfx2_SfxBaseController) SfxBaseController::SfxBaseController( SfxViewShell* pViewShell ) - : IMPL_SfxBaseController_MutexContainer ( ) - , m_pData ( new IMPL_SfxBaseController_DataContainer( m_aMutex, pViewShell, this )) + : m_pData ( new IMPL_SfxBaseController_DataContainer( m_aMutex, pViewShell, this )) { DBG_CTOR(sfx2_SfxBaseController,NULL); m_pData->m_pViewShell->SetController( this ); @@ -543,138 +555,60 @@ SfxBaseController::~SfxBaseController() } //________________________________________________________________________________________________________ -// SfxBaseController -> XInterface -//________________________________________________________________________________________________________ -ANY SAL_CALL SfxBaseController::queryInterface( const UNOTYPE& rType ) throw( RUNTIMEEXCEPTION ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Ask for my own supported interfaces ... - ANY aReturn( ::cppu::queryInterface( rType , - static_cast< XTYPEPROVIDER* > ( this ) , - static_cast< XCOMPONENT* > ( this ) , - static_cast< XCONTROLLER* > ( this ) , - static_cast< XCONTROLLERBORDER* > ( this ) , - static_cast< XUSERINPUTINTERCEPTION* > ( this ) , - static_cast< XSTATUSINDICATORSUPPLIER* > ( this ) , - static_cast< XCONTEXTMENUINTERCEPTION* > ( this ) , - static_cast< XDISPATCHPROVIDER* > ( this ), - static_cast< XTITLE* > ( this ), - static_cast< XTITLECHANGEBROADCASTER* > ( this ), - static_cast< XDISPATCHINFORMATIONPROVIDER* > ( this ) ) ) ; - - // If searched interface supported by this class ... - if ( aReturn.hasValue() == sal_True ) - { - // ... return this information. - return aReturn ; - } - else - { - // Else; ... ask baseclass for interfaces! - return OWeakObject::queryInterface( rType ) ; - } -} - -//________________________________________________________________________________________________________ -// SfxBaseController -> XInterface -//________________________________________________________________________________________________________ - -void SAL_CALL SfxBaseController::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::acquire() ; -} - -//________________________________________________________________________________________________________ -// SfxBaseController -> XInterface +// SfxBaseController -> XController2 //________________________________________________________________________________________________________ -void SAL_CALL SfxBaseController::release() throw() +Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (RuntimeException) { - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell ) + throw DisposedException(); - // Forward to baseclass - OWeakObject::release() ; + return Reference< XWindow >( GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); } -//________________________________________________________________________________________________________ -// SfxBaseController -> XTypeProvider -//________________________________________________________________________________________________________ - -SEQUENCE< UNOTYPE > SAL_CALL SfxBaseController::getTypes() throw( RUNTIMEEXCEPTION ) +::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException) { - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTYPECOLLECTION* pTypeCollection = NULL ; + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) + throw DisposedException(); - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; + const SfxObjectFactory& rDocFac( m_pData->m_pViewShell->GetObjectShell()->GetFactory() ); + sal_uInt16 nViewNo = rDocFac.GetViewNo_Impl( GetViewFrame_Impl().GetCurViewId(), rDocFac.GetViewFactoryCount() ); + OSL_ENSURE( nViewNo < rDocFac.GetViewFactoryCount(), "SfxBaseController::getViewControllerName: view ID not found in view factories!" ); - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTYPECOLLECTION aTypeCollection( ::getCppuType(( const REFERENCE< XTYPEPROVIDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTROLLER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTROLLERBORDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XDISPATCHPROVIDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XSTATUSINDICATORSUPPLIER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTEXTMENUINTERCEPTION >*)NULL ) , - ::getCppuType(( const REFERENCE< XUSERINPUTINTERCEPTION >*)NULL ) , - ::getCppuType(( const REFERENCE< XTITLE >*)NULL ) , - ::getCppuType(( const REFERENCE< XTITLECHANGEBROADCASTER >*)NULL ) , - ::getCppuType(( const REFERENCE< XDISPATCHINFORMATIONPROVIDER >*)NULL ) ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } + ::rtl::OUString sViewName; + if ( nViewNo < rDocFac.GetViewFactoryCount() ) + sViewName = rDocFac.GetViewFactory( nViewNo ).GetViewName(); - return pTypeCollection->getTypes() ; + return sViewName; } -//________________________________________________________________________________________________________ -// SfxBaseController -> XTypeProvider -//________________________________________________________________________________________________________ - -SEQUENCE< sal_Int8 > SAL_CALL SfxBaseController::getImplementationId() throw( RUNTIMEEXCEPTION ) +Sequence< PropertyValue > SAL_CALL SfxBaseController::getCreationArguments() throw (RuntimeException) { - // Create one Id for all instances of this class. - // Use ethernet address to do this! (sal_True) - - // Optimize this method - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pID is NULL - for the second call pID is different from NULL! - static OIMPLEMENTATIONID* pID = NULL ; + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) + throw DisposedException(); - if ( pID == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; + return m_pData->m_aCreationArgs; +} - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pID == NULL ) - { - // Create a new static ID ... - static OIMPLEMENTATIONID aID( sal_False ) ; - // ... and set his address to static pointer! - pID = &aID ; - } - } +void SfxBaseController::SetCreationArguments_Impl( const Sequence< PropertyValue >& i_rCreationArgs ) +{ + OSL_ENSURE( m_pData->m_aCreationArgs.getLength() == 0, "SfxBaseController::SetCreationArguments_Impl: not intended to be called twice!" ); + m_pData->m_aCreationArgs = i_rCreationArgs; +} - return pID->getImplementationId() ; +SfxViewFrame& SfxBaseController::GetViewFrame_Impl() const +{ + ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); + SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame(); + ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" ); + return *pActFrame; } //________________________________________________________________________________________________________ -// SfxBaseController -> XController +// SfxBaseController -> XController2 -> XController //________________________________________________________________________________________________________ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame ) throw( ::com::sun::star::uno::RuntimeException ) @@ -701,32 +635,11 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame if ( m_pData->m_pViewShell ) { - SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; - pActFrame->Enable( TRUE ); - pActFrame->GetDispatcher()->Lock( FALSE ); + ConnectSfxFrame_Impl( E_CONNECT ); - if ( ( m_pData->m_pViewShell->GetObjectShell() != NULL ) - && ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) - ) - { - SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame(); - if ( !pViewFrm->GetFrame()->IsInPlace() ) - { - // for outplace embedded objects, we want the layout manager to keep the content window - // size constant, if possible - try - { - uno::Reference< beans::XPropertySet > xFrameProps( m_pData->m_xFrame, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xLayouterProps( - xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW ); - xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) ); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } + // attaching the frame to the controller is the last step in the creation of a new view, so notify this + SfxEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell() ); + SFX_APP()->NotifyEvent( aHint ); } } } @@ -787,9 +700,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: BOOL bRet = bOther || pDocShell->PrepareClose(); if ( bRet ) { - // disable window and dispatcher until suspend call is withdrawn - pActFrame->Enable( FALSE ); - pActFrame->GetDispatcher()->Lock( TRUE ); + ConnectSfxFrame_Impl( E_DISCONNECT ); m_pData->m_bSuspendState = sal_True; } @@ -802,9 +713,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: if ( m_pData->m_pViewShell ) { - SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; - pActFrame->Enable( TRUE ); - pActFrame->GetDispatcher()->Lock( FALSE ); + ConnectSfxFrame_Impl( E_RECONNECT ); } m_pData->m_bSuspendState = sal_False; @@ -893,7 +802,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU if ( xFrame.is() ) xFrame->setName( sTargetFrameName ); - REFERENCE < XDISPATCHPROVIDER > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); + Reference< XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) return xProv->queryDispatch( aURL, sTargetFrameName, ::com::sun::star::frame::FrameSearchFlag::SELF ); } @@ -911,13 +820,13 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pSlot = rSlotPool.GetUnoSlot( aMasterCommand ); else pSlot = rSlotPool.GetUnoSlot( aURL.Path ); - if ( pSlot && ( !pAct->GetFrame()->IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) + if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) return pAct->GetBindings().GetDispatch( pSlot, aURL, bMasterCommand ); else { // try to find parent SfxViewFrame uno::Reference< frame::XFrame > xParentFrame; - uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface(); if ( xOwnFrame.is() ) xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY ); @@ -932,7 +841,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) { - if ( pFrame->GetFrame()->GetFrameInterface() == xParentFrame ) + if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame ) { pParentFrame = pFrame; break; @@ -968,13 +877,13 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pAct ); const SfxSlot* pSlot = rSlotPool.GetSlot( nId ); - if ( pSlot && ( !pAct->GetFrame()->IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) + if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) return pAct->GetBindings().GetDispatch( pSlot, aURL, sal_False ); else { // try to find parent SfxViewFrame uno::Reference< frame::XFrame > xParentFrame; - uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface(); if ( xOwnFrame.is() ) xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY ); @@ -989,7 +898,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) { - if ( pFrame->GetFrame()->GetFrameInterface() == xParentFrame ) + if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame ) { pParentFrame = pFrame; break; @@ -1123,19 +1032,14 @@ void SfxBaseController::BorderWidthsChanged_Impl() // SfxBaseController -> XComponent //________________________________________________________________________________________________________ -void SfxBaseController::FrameIsReleasedWithController (sal_Bool bFlag) -{ - m_pData->m_bIsFrameReleasedWithController = bFlag; -} - void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::RuntimeException ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - REFERENCE < XCONTROLLER > xTmp( this ); + Reference< XController > xTmp( this ); m_pData->m_bDisposing = sal_True ; EVENTOBJECT aEventObject; - aEventObject.Source = (XCONTROLLER*)this ; + aEventObject.Source = *this ; m_pData->m_aListenerContainer.disposeAndClear( aEventObject ) ; if ( m_pData->m_pController && m_pData->m_pController->getFrame().is() ) @@ -1144,18 +1048,15 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime if ( m_pData->m_pViewShell ) { SfxViewFrame* pFrame = m_pData->m_pViewShell->GetViewFrame() ; - if (m_pData->m_bIsFrameReleasedWithController) - { - if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) - pFrame->GetFrame()->SetIsClosing_Impl(); - m_pData->m_pViewShell->DiscardClients_Impl(); - m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; - } + if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) + pFrame->GetFrame().SetIsClosing_Impl(); + m_pData->m_pViewShell->DiscardClients_Impl(); + m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; if ( pFrame ) { EVENTOBJECT aObject; - aObject.Source = (OWEAKOBJECT*)this ; + aObject.Source = *this ; SfxObjectShell* pDoc = pFrame->GetObjectShell() ; SfxViewFrame *pView = SfxViewFrame::GetFirst(pDoc); @@ -1167,12 +1068,9 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime pView = SfxViewFrame::GetNext( *pView, pDoc ); } - if ( m_pData->m_bIsFrameReleasedWithController ) - { - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) ); - if ( !pView ) - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); - } + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) ); + if ( !pView ) + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); REFERENCE< XMODEL > xModel = pDoc->GetModel(); REFERENCE < ::com::sun::star::util::XCloseable > xCloseable( xModel, com::sun::star::uno::UNO_QUERY ); @@ -1189,14 +1087,13 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime m_pData->m_xListener->disposing( aObject ); SfxViewShell *pShell = m_pData->m_pViewShell; m_pData->m_pViewShell = NULL; - if ( pFrame->GetViewShell() == pShell - && m_pData->m_bIsFrameReleasedWithController) + if ( pFrame->GetViewShell() == pShell ) { // Enter registrations only allowed if we are the owner! - if ( pFrame->GetFrame()->OwnsBindings_Impl() ) + if ( pFrame->GetFrame().OwnsBindings_Impl() ) pFrame->GetBindings().ENTERREGISTRATIONS(); - pFrame->GetFrame()->SetFrameInterface_Impl( aXFrame ); - pFrame->GetFrame()->DoClose_Impl(); + pFrame->GetFrame().SetFrameInterface_Impl( aXFrame ); + pFrame->GetFrame().DoClose_Impl(); } } } @@ -1250,7 +1147,7 @@ SfxViewShell* SfxBaseController::GetViewShell_Impl() const { ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pData->m_pViewShell && !m_pData->m_xIndicator.is() ) - m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame()->GetWorkWindow_Impl() ); + m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame().GetWorkWindow_Impl() ); return m_pData->m_xIndicator; } @@ -1395,6 +1292,165 @@ BOOL SfxBaseController::HasMouseClickListeners_Impl() return m_pData->m_aUserInputInterception.hasMouseClickListeners(); } +void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) +{ + ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); + SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); + ENSURE_OR_THROW( pViewFrame, "a view shell without a view frame is pretty pathological" ); + + const bool bConnect = ( i_eConnect != E_DISCONNECT ); + + // disable window and dispatcher + pViewFrame->Enable( bConnect ); + pViewFrame->GetDispatcher()->Lock( !bConnect ); + + if ( bConnect ) + { + if ( i_eConnect == E_CONNECT ) + { + if ( ( m_pData->m_pViewShell->GetObjectShell() != NULL ) + && ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) + ) + { + SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame(); + if ( !pViewFrm->GetFrame().IsInPlace() ) + { + // for outplace embedded objects, we want the layout manager to keep the content window + // size constant, if possible + try + { + uno::Reference< beans::XPropertySet > xFrameProps( m_pData->m_xFrame, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xLayouterProps( + xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW ); + xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } + + // upon DISCONNECT, we did *not* pop the shells from the stack (this is done elsewhere), so upon + // RECONNECT, we're not allowed to push them + if ( i_eConnect != E_RECONNECT ) + { + pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell ); + if ( m_pData->m_pViewShell->GetSubShell() ) + pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() ); + m_pData->m_pViewShell->PushSubShells_Impl(); + pViewFrame->GetDispatcher()->Flush(); + } + + Window* pEditWin = m_pData->m_pViewShell->GetWindow(); + if ( pEditWin && m_pData->m_pViewShell->IsShowView_Impl() ) + pEditWin->Show(); + + if ( SfxViewFrame::Current() == pViewFrame ) + pViewFrame->GetDispatcher()->Update_Impl( sal_True ); + + Window* pFrameWin = &pViewFrame->GetWindow(); + if ( pFrameWin != &pViewFrame->GetFrame().GetWindow() ) + pFrameWin->Show(); + + if ( i_eConnect == E_CONNECT ) + { + ::comphelper::NamedValueCollection aDocumentArgs( getModel()->getArgs() ); + + const sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + const bool bHasPluginMode = ( nPluginMode != 0 ); + + SfxFrame& rFrame = pViewFrame->GetFrame(); + SfxObjectShell& rDoc = *m_pData->m_pViewShell->GetObjectShell(); + if ( !rFrame.IsMarkedHidden_Impl() ) + { + if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) + pViewFrame->GetDispatcher()->HideUI( TRUE ); + else + pViewFrame->GetDispatcher()->HideUI( FALSE ); + + if ( rFrame.IsInPlace() ) + pViewFrame->LockAdjustPosSizePixel(); + + if ( nPluginMode == 3 ) + rFrame.GetWorkWindow_Impl()->SetInternalDockingAllowed( FALSE ); + + if ( !rFrame.IsInPlace() ) + pViewFrame->GetDispatcher()->Update_Impl(); + pViewFrame->Show(); + rFrame.GetWindow().Show(); + if ( !rFrame.IsInPlace() || ( nPluginMode == 3 ) ) + pViewFrame->MakeActive_Impl( rFrame.GetFrameInterface()->isActive() ); + + if ( rFrame.IsInPlace() ) + { + pViewFrame->UnlockAdjustPosSizePixel(); + // force resize for OLE server to fix layout problems of writer and math + // see i53651 + if ( nPluginMode == 3 ) + pViewFrame->Resize( TRUE ); + } + } + else + { + DBG_ASSERT( !rFrame.IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" ); + rFrame.GetWindow().Show(); + } + + // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! + pViewFrame->UpdateTitle(); + + if ( !rFrame.IsInPlace() ) + pViewFrame->Resize( TRUE ); + + // if there's a JumpMark given, then, well, jump to it + ::comphelper::NamedValueCollection aViewArgs( getCreationArguments() ); + const ::rtl::OUString sJumpMark = aViewArgs.getOrDefault( "JumpMark", ::rtl::OUString() ); + const bool bHasJumpMark = ( sJumpMark.getLength() > 0 ); + OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() ) + || ( !sJumpMark.getLength() ), + "SfxBaseController::ConnectSfxFrame_Impl: so this code wasn't dead?" ); + // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time + // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method + // here is never called before the load process finished. At least not with a non-empty jump mark + if ( sJumpMark.getLength() ) + m_pData->m_pViewShell->JumpToMark( sJumpMark ); + + // if no plugin mode and no jump mark was supplied, check whether the document itself can provide view data, and + // if so, forward it to the view/shell. + if ( !bHasPluginMode && !bHasJumpMark ) + { + try + { + Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData = xViewDataSupplier->getViewData(); + if ( xViewData.is() && xViewData->getCount() > 0 ) + { + Sequence< PropertyValue > aViewData; + if ( ( xViewData->getByIndex( 0 ) >>= aViewData ) && ( aViewData.getLength() ) ) + { + m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE ); + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } + + // invalidate slot corresponding to the view shell + const sal_uInt16 nViewNo = m_pData->m_pViewShell->GetObjectShell()->GetFactory().GetViewNo_Impl( pViewFrame->GetCurViewId(), USHRT_MAX ); + DBG_ASSERT( nViewNo != USHRT_MAX, "view shell id not found" ); + if ( nViewNo != USHRT_MAX ) + pViewFrame->GetBindings().Invalidate( nViewNo + SID_VIEWSHELL0 ); +} + //============================================================================= css::uno::Reference< css::frame::XTitle > SfxBaseController::impl_getTitleHelper () { diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx deleted file mode 100644 index 5af48806153f..000000000000 --- a/sfx2/source/view/topfrm.cxx +++ /dev/null @@ -1,1643 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - -#include <sfx2/topfrm.hxx> -#include <sfx2/signaturestate.hxx> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/frame/XFrame.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX -#include <comphelper/processfactory.hxx> -#endif -#include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/util/XCloseable.hpp> -#include <com/sun/star/util/CloseVetoException.hpp> -#ifndef _TOOLKIT_UNOHLP_HXX -#include <toolkit/helper/vclunohelper.hxx> -#endif -#ifndef _UNO_COM_SUN_STAR_AWT_POSSIZE_HPP_ -#include <com/sun/star/awt/PosSize.hpp> -#endif -#include <com/sun/star/container/XIndexAccess.hpp> -#ifndef _COM_SUN_STAR_CONTAINER_XPROPERTYSET_HPP_ -#include <com/sun/star/beans/XPropertySet.hpp> -#endif -#include <com/sun/star/frame/XLayoutManager.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/beans/XMaterialHolder.hpp> -#include <com/sun/star/awt/XWindow2.hpp> -#include <vcl/menu.hxx> -#include <svl/rectitem.hxx> -#include <svl/intitem.hxx> -#include <svl/eitem.hxx> -#include <svl/stritem.hxx> -#include <svtools/asynclink.hxx> -#include <svtools/sfxecode.hxx> -#include <vcl/dialog.hxx> -#include <svl/urihelper.hxx> -#include <unotools/moduleoptions.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/bootstrap.hxx> - -#include <sfxresid.hxx> - -// wg. pTopFrames -#include "appdata.hxx" -#include <sfx2/app.hxx> -#include <sfx2/sfx.hrc> -#include <sfx2/objsh.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/viewsh.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/request.hxx> -#include <sfx2/objitem.hxx> -#include <sfx2/objface.hxx> -#include <sfx2/msg.hxx> -#include "objshimp.hxx" -#include "workwin.hxx" -#include "sfxtypes.hxx" -#include "splitwin.hxx" -#include "arrdecl.hxx" -#include "sfxhelp.hxx" -#include <sfx2/fcontnr.hxx> -#include <sfx2/docfac.hxx> -#include "statcach.hxx" -#include <sfx2/event.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::beans; - -//------------------------------------------------------------------------ - -#define SfxTopViewFrame -#include "sfxslots.hxx" - -DBG_NAME(SfxTopViewFrame) - -#include <comphelper/sequenceashashmap.hxx> -static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) -{ - uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY ); - ::rtl::OUString sVar; - if ( !xMM.is() ) - return sVar; - - try - { - ::comphelper::SequenceAsHashMap aAnalyzer( xMM->getByName(sDocService) ); - sVar = aAnalyzer.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("ooSetupFactoryUIName"), ::rtl::OUString() ); - } - catch( uno::Exception& ) - { - sVar = ::rtl::OUString(); - } - - return sVar; -} - -class SfxTopFrame_Impl -{ -public: - Window* pWindow; // maybe external - BOOL bHidden; - BOOL bLockResize; - BOOL bMenuBarOn; -}; - -class SfxTopWindow_Impl : public Window -{ -public: - SfxTopFrame* pFrame; - - SfxTopWindow_Impl( SfxTopFrame* pF ); -// : Window( pF->pImp->pWindow, WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) -// , pFrame( pF ) -// { SetBackground(); } - ~SfxTopWindow_Impl( ); - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual long Notify( NotifyEvent& rEvt ); - virtual void Resize(); - virtual void GetFocus(); - void DoResize(); - DECL_LINK( CloserHdl, void* ); -}; - -SfxTopWindow_Impl::SfxTopWindow_Impl( SfxTopFrame* pF ) - : Window( pF->pImp->pWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) - , pFrame( pF ) -{ -} - -SfxTopWindow_Impl::~SfxTopWindow_Impl( ) -{ -} - -void SfxTopWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); - if ( pWorkWin ) - pWorkWin->DataChanged_Impl( rDCEvt ); -} - -long SfxTopWindow_Impl::Notify( NotifyEvent& rNEvt ) -{ - if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() ) - return sal_False; - - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - if ( !pView || !pView->GetObjectShell() ) - return Window::Notify( rNEvt ); - - if ( rNEvt.GetType() == EVENT_GETFOCUS ) - { - if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) - { - DBG_TRACE("SfxTopFrame: GotFocus"); - pView->MakeActive_Impl( FALSE ); - } - - // TODO/LATER: do we still need this code? - Window* pWindow = rNEvt.GetWindow(); - ULONG nHelpId = 0; - while ( !nHelpId && pWindow ) - { - nHelpId = pWindow->GetHelpId(); - pWindow = pWindow->GetParent(); - } - - if ( nHelpId ) - SfxHelp::OpenHelpAgent( pFrame, nHelpId ); - - // if focus was on an external window, the clipboard content might have been changed - pView->GetBindings().Invalidate( SID_PASTE ); - pView->GetBindings().Invalidate( SID_PASTE_SPECIAL ); - return sal_True; - } - else if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) ) - return TRUE; - } - else if ( rNEvt.GetType() == EVENT_EXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTDISABLE*/ ) - { - pView->SetModalMode( sal_True ); - return sal_True; - } - else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ ) - { - //EnableInput( sal_True, sal_True ); - pView->SetModalMode( sal_False ); - return sal_True; - } - - return Window::Notify( rNEvt ); -} - -long SfxTopWindow_Impl::PreNotify( NotifyEvent& rNEvt ) -{ - USHORT nType = rNEvt.GetType(); - if ( nType == EVENT_KEYINPUT || nType == EVENT_KEYUP ) - { - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; - if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) - return sal_True; - } - else if ( nType == EVENT_MOUSEBUTTONUP || nType == EVENT_MOUSEBUTTONDOWN ) - { - Window* pWindow = rNEvt.GetWindow(); - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; - if ( pShell ) - if ( pWindow == pShell->GetWindow() || pShell->GetWindow()->IsChild( pWindow ) ) - if ( pShell->HasMouseClickListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) - return sal_True; - } - - if ( nType == EVENT_MOUSEBUTTONDOWN ) - { - Window* pWindow = rNEvt.GetWindow(); - const MouseEvent* pMEvent = rNEvt.GetMouseEvent(); - Point aPos = pWindow->OutputToScreenPixel( pMEvent->GetPosPixel() ); - SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); - if ( pWorkWin ) - pWorkWin->EndAutoShow_Impl( aPos ); - } - - return Window::PreNotify( rNEvt ); -} - -void SfxTopWindow_Impl::GetFocus() -{ - if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() ) - pFrame->GetCurrentViewFrame()->MakeActive_Impl( TRUE ); -} - -void SfxTopWindow_Impl::Resize() -{ - if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) - DoResize(); -} - -void SfxTopWindow_Impl::StateChanged( StateChangedType nStateChange ) -{ - if ( nStateChange == STATE_CHANGE_INITSHOW ) - { - pFrame->pImp->bHidden = FALSE; - if ( pFrame->IsInPlace() ) - // TODO/MBA: workaround for bug in LayoutManager: the final resize does not get through because the - // LayoutManager works asynchronously and between resize and time execution the DockingAcceptor was exchanged so that - // the resize event never is sent to the component - SetSizePixel( GetParent()->GetOutputSizePixel() ); - - DoResize(); - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - if ( pView ) - pView->GetBindings().GetWorkWindow_Impl()->ShowChilds_Impl(); - } - - Window::StateChanged( nStateChange ); -} - -void SfxTopWindow_Impl::DoResize() -{ - if ( !pFrame->pImp->bLockResize ) - pFrame->Resize(); -} - -class StopButtonTimer_Impl : public Timer -{ - BOOL bState; - SfxViewFrame* pFrame; -protected: - virtual void Timeout(); -public: - StopButtonTimer_Impl( SfxViewFrame*); - void SetButtonState( BOOL bStateP ); - BOOL GetButtonState() const { return bState; } -}; - -StopButtonTimer_Impl::StopButtonTimer_Impl( SfxViewFrame*p) - : bState( FALSE ) - , pFrame( p ) -{ - SetTimeout( 200 ); -} - -void StopButtonTimer_Impl::SetButtonState( BOOL bStateP ) -{ - if( bStateP ) - { - bState = TRUE; - Stop(); - } - else if( bState ) - Start(); -} - -void StopButtonTimer_Impl::Timeout() -{ - bState = FALSE; - pFrame->GetBindings().Invalidate( SID_BROWSE_STOP ); -} - -class SfxTopViewWin_Impl : public Window -{ -friend class SfxInternalFrame; - - BOOL bActive; - SfxTopViewFrame* pFrame; - -public: - SfxTopViewWin_Impl( SfxTopViewFrame* p, - Window *pParent, WinBits nBits=0 ) : - Window( pParent, nBits | WB_BORDER | WB_CLIPCHILDREN ), - bActive( FALSE ), - pFrame( p ) - { - p->GetFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } - - virtual void Resize(); - virtual void StateChanged( StateChangedType nStateChange ); -}; - -//-------------------------------------------------------------------- -void SfxTopViewWin_Impl::StateChanged( StateChangedType nStateChange ) -{ - if ( nStateChange == STATE_CHANGE_INITSHOW ) - { - SfxObjectShell* pDoc = pFrame->GetObjectShell(); - if ( pDoc && !pFrame->IsVisible() ) - pFrame->Show(); - - pFrame->Resize(); - } - else - Window::StateChanged( nStateChange ); -} - -void SfxTopViewWin_Impl::Resize() -{ - if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) - pFrame->Resize(); -} - -class SfxTopViewFrame_Impl -{ -public: - sal_Bool bActive; - Window* pWindow; - String aFactoryName; - StopButtonTimer_Impl* pStopButtonTimer; - - SfxTopViewFrame_Impl() - : bActive( sal_False ) - , pWindow( 0 ) - , pStopButtonTimer( 0 ) - {} -}; - -static svtools::AsynchronLink* pPendingCloser = 0; - -static String _getTabString() -{ - String result; - - Reference < XMaterialHolder > xHolder( - ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.tab.tabreg") ), UNO_QUERY ); - if (xHolder.is()) - { - rtl::OUString aTabString; - Sequence< NamedValue > sMaterial; - if (xHolder->getMaterial() >>= sMaterial) { - for (int i=0; i < sMaterial.getLength(); i++) { - if ((sMaterial[i].Name.equalsAscii("title")) && - (sMaterial[i].Value >>= aTabString)) - { - result += ' '; - result += String(aTabString); - } - } - } - } - return result; -} - -SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet ) -{ - Reference < XFrame > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - SfxTopFrame *pFrame = NULL; - BOOL bNewView = FALSE; - if ( pSet ) - { - SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_OPEN_NEW_VIEW, sal_False ); - bNewView = pItem && pItem->GetValue(); - } - - if ( pDoc && !bHidden && !bNewView ) - { - URL aTargetURL; - aTargetURL.Complete = pDoc->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); - - BOOL bIsBasic = FALSE; - if ( !aTargetURL.Complete.getLength() ) - { - String sFactory = String::CreateFromAscii(pDoc->GetFactory().GetShortName()); - bIsBasic = (sFactory.CompareIgnoreCaseToAscii("sbasic")==COMPARE_EQUAL); - - if (!bIsBasic) - { - String aURL = String::CreateFromAscii("private:factory/"); - aURL += sFactory; - aTargetURL.Complete = aURL; - } - } - - if (bIsBasic) - { - Reference < XFramesSupplier > xSupplier( xDesktop, UNO_QUERY ); - if (xSupplier.is()) - { - Reference < XIndexAccess > xContainer(xSupplier->getFrames(), UNO_QUERY); - if (xContainer.is()) - { - Reference< ::com::sun::star::frame::XModuleManager > xCheck(::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager" )), UNO_QUERY); - sal_Int32 nCount = xContainer->getCount(); - for (sal_Int32 i=0; i<nCount; ++i) - { - try - { - Reference < XFrame > xFrame; - if (!(xContainer->getByIndex(i) >>= xFrame) || !xFrame.is()) - continue; - ::rtl::OUString sModule = xCheck->identify(xFrame); - if (sModule.equalsAscii("com.sun.star.frame.StartModule")) - { - pFrame = Create(xFrame); - break; - } - } - catch(const Exception&) {} - } - } - } - } - else - { - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); - xTrans->parseStrict( aTargetURL ); - - Reference < ::com::sun::star::frame::XDispatchProvider > xProv( xDesktop, UNO_QUERY ); - Reference < ::com::sun::star::frame::XDispatch > xDisp; - if ( xProv.is() ) - { - Sequence < ::com::sun::star::beans::PropertyValue > aSeq(1); - aSeq[0].Name = ::rtl::OUString::createFromAscii("Model"); - aSeq[0].Value <<= pDoc->GetModel(); - ::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii("_default") ); - xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 ); - if ( xDisp.is() ) - xDisp->dispatch( aTargetURL, aSeq ); - } - - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - for( USHORT nPos = rArr.Count(); nPos--; ) - { - SfxTopFrame *pF = (SfxTopFrame*) rArr[ nPos ]; - if ( pF->GetCurrentDocument() == pDoc ) - { - pFrame = pF; - break; - } - } - } - } - - if ( !pFrame ) - { - Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ); - pFrame = Create( xFrame ); - } - - pFrame->pImp->bHidden = bHidden; - Window* pWindow = pFrame->GetTopWindow_Impl(); - if ( pWindow && pDoc ) - { - ::rtl::OUString aDocServiceName( pDoc->GetFactory().GetDocumentServiceName() ); - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - String aTitle = pDoc->GetTitle( SFX_TITLE_DETECT ); - aTitle += String::CreateFromAscii( " - " ); - aTitle += String(aProductName); - aTitle += ' '; - aTitle += String( GetModuleName_Impl( aDocServiceName ) ); -#ifdef DBG_UTIL - ::rtl::OUString aDefault; - aTitle += DEFINE_CONST_UNICODE(" ["); - String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); - aTitle += aVerId; - aTitle += ']'; -#endif - - // append TAB string if available - aTitle += _getTabString(); - - /* AS_TITLE - pWindow->SetText( aTitle ); - */ - - /* AS_ICON - if( pWindow->GetType() == WINDOW_WORKWINDOW ) - { - SvtModuleOptions::EFactory eFactory; - if( SvtModuleOptions::ClassifyFactoryByName( aDocServiceName, eFactory ) ) - { - WorkWindow* pWorkWindow = (WorkWindow*)pWindow; - pWorkWindow->SetIcon( (sal_uInt16) SvtModuleOptions().GetFactoryIcon( eFactory ) ); - } - } - */ - } - - pFrame->SetItemSet_Impl( pSet ); - if ( pDoc && pDoc != pFrame->GetCurrentDocument() ) - { - if ( nViewId ) - pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument( pDoc ); - if ( pWindow && !bHidden ) - pWindow->Show(); - } - - return pFrame; -} - -SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, Window* pWindow, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet ) -{ - Reference < ::com::sun::star::lang::XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - Reference < XFramesSupplier > xDesktop ( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - Reference < XFrame > xFrame( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Frame") ), UNO_QUERY ); - - xFrame->initialize( VCLUnoHelper::GetInterface ( pWindow ) ); - if ( xDesktop.is() ) - xDesktop->getFrames()->append( xFrame ); - - uno::Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( pWindow ), uno::UNO_QUERY ); - if ( xWin.is() && xWin->isActive() ) - xFrame->activate(); - - SfxTopFrame* pFrame = new SfxTopFrame( pWindow ); - pFrame->SetFrameInterface_Impl( xFrame ); - pFrame->pImp->bHidden = bHidden; - - pFrame->SetItemSet_Impl( pSet ); - if ( pDoc ) - { - if ( nViewId ) - pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument( pDoc ); - } - - return pFrame; -} - -SfxTopFrame* SfxTopFrame::Create( Reference < XFrame > xFrame ) -{ - // create a new TopFrame to an external XFrame object ( wrap controller ) - DBG_ASSERT( xFrame.is(), "Wrong parameter!" ); - - Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - SfxTopFrame* pFrame = new SfxTopFrame( pWindow ); - pFrame->SetFrameInterface_Impl( xFrame ); - return pFrame; -} - -SfxTopFrame::SfxTopFrame( Window* pExternal, sal_Bool bHidden ) - : SfxFrame( NULL ) - , pWindow( NULL ) -{ - pImp = new SfxTopFrame_Impl; - pImp->bHidden = bHidden; - pImp->bLockResize = FALSE; - pImp->bMenuBarOn = TRUE; - InsertTopFrame_Impl( this ); - if ( pExternal ) - { - pImp->pWindow = pExternal; - } - else - { - DBG_ERROR( "TopFrame without window created!" ); -/* - pImp->pWindow = new SfxTopFrameWindow_Impl( this ); - pImp->pWindow->SetActivateMode( ACTIVATE_MODE_GRABFOCUS ); - pImp->pWindow->SetPosSizePixel( Point( 20,20 ), Size( 800,600 ) ); - if ( GetFrameInterface().is() ) - GetFrameInterface()->initialize( VCLUnoHelper::GetInterface( pImp->pWindow ) ); - pImp->pWindow->Show(); - */ - } - - pWindow = new SfxTopWindow_Impl( this ); -/** AS: - Hide this window till the component was realy loaded. Otherwhise it overpaint e.g. the old component hardly - and produce repaint errors. - pWindow->Show(); - */ -} - -SfxTopFrame::~SfxTopFrame() -{ - RemoveTopFrame_Impl( this ); - DELETEZ( pWindow ); - delete pImp; -} - -void SfxTopFrame::SetPresentationMode( BOOL bSet ) -{ - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL ); - - Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - - if ( xPropSet.is() ) - { - Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - aValue >>= xLayoutManager; - } - - if ( xLayoutManager.is() ) - xLayoutManager->setVisible( !bSet ); // we don't want to have ui in presentation mode - - SetMenuBarOn_Impl( !bSet ); - if ( GetWorkWindow_Impl() ) - GetWorkWindow_Impl()->SetDockingAllowed( !bSet ); - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE ); -} - -SystemWindow* -SfxTopFrame::GetSystemWindow() const -{ - return GetTopWindow_Impl(); -} - -SystemWindow* SfxTopFrame::GetTopWindow_Impl() const -{ - if ( pImp->pWindow->IsSystemWindow() ) - return (SystemWindow*) pImp->pWindow; - else - return NULL; -} - -Window& SfxTopFrame::GetWindow() const -{ - return *pWindow; -} - -sal_Bool SfxTopFrame::Close() -{ - delete this; - return sal_True; -} - -void SfxTopFrame::LockResize_Impl( BOOL bLock ) -{ - pImp->bLockResize = bLock; -} - -IMPL_LINK( SfxTopWindow_Impl, CloserHdl, void*, EMPTYARG ) -{ - if ( pFrame && !pFrame->PrepareClose_Impl( TRUE ) ) - return 0L; - - if ( pFrame ) - pFrame->GetCurrentViewFrame()->GetBindings().Execute( SID_CLOSEWIN, 0, 0, SFX_CALLMODE_ASYNCHRON ); - return 0L; -} - -void SfxTopFrame::SetMenuBarOn_Impl( BOOL bOn ) -{ - pImp->bMenuBarOn = bOn; - - Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - - if ( xPropSet.is() ) - { - Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - aValue >>= xLayoutManager; - } - - if ( xLayoutManager.is() ) - { - rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )); - - if ( bOn ) - xLayoutManager->showElement( aMenuBarURL ); - else - xLayoutManager->hideElement( aMenuBarURL ); - } -} - -BOOL SfxTopFrame::IsMenuBarOn_Impl() const -{ - return pImp->bMenuBarOn; -} - -String SfxTopFrame::GetWindowData() -{ - String aActWinData; - char cToken = ','; - - SfxViewFrame *pActFrame = SfxViewFrame::Current(); - SfxViewFrame *pFrame = GetCurrentViewFrame(); - const sal_Bool bActWin = ( pActFrame->GetTopViewFrame() == pFrame ); - - // ::com::sun::star::sdbcx::User-Daten der ViewShell - String aUserData; - pFrame->GetViewShell()->WriteUserData(aUserData); - - // assemble ini-data - String aWinData; - aWinData += String::CreateFromInt32( pFrame->GetCurViewId() ); - aWinData += cToken; - - aWinData += '1'; // former attribute "isfloating" - aWinData += cToken; - - // aktives kennzeichnen - aWinData += cToken; - aWinData += bActWin ? '1' : '0'; - - aWinData += cToken; - aWinData += aUserData; - - return aWinData; -} - -sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) -/* [Beschreibung] - */ -{ - // Spezielle Bedingungen testen: nicht im ModalMode! - if ( !SfxFrame::InsertDocument( pDoc ) ) - return sal_False; - - SfxObjectShell *pOld = GetCurrentDocument(); - - // Position und Groesse testen - // Wenn diese schon gesetzt sind, soll offensichtlich nicht noch - // LoadWindows_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame() - // an einer Task aufgerufen hat! ) - const SfxItemSet* pSet = GetItemSet_Impl(); - if ( !pSet ) - pSet = pDoc->GetMedium()->GetItemSet(); - SetItemSet_Impl(0); - - // Position und Gr"o\se - SFX_ITEMSET_ARG( - pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); - // View-Id - SFX_ITEMSET_ARG( - pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); - // Zoom - SFX_ITEMSET_ARG( - pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); - // Hidden - SFX_ITEMSET_ARG( - pSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); - // ViewDaten - SFX_ITEMSET_ARG( - pSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); - // ViewOnly - SFX_ITEMSET_ARG( - pSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False); - // InPlace (Hack) - SFX_ITEMSET_ARG( - pSet, pPluginItem, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); - - // Plugin (external InPlace) - SFX_ITEMSET_ARG( - pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False); - // Jump (GotoBookmark) - SFX_ITEMSET_ARG( - pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False); - - if ( pEditItem && pEditItem->GetValue() ) - SetMenuBarOn_Impl( FALSE ); - - if ( pHidItem ) - pImp->bHidden = pHidItem->GetValue(); - - if( !pImp->bHidden ) - pDoc->OwnerLock( sal_True ); - - // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation - // aus den Dokument geladen werden, z.B. weil InsertDocument seinerseits - // aus LoadWindows_Impl aufgerufen wurde! - if ( !pJumpItem && !pPluginMode && pDoc && !pAreaItem && !pViewIdItem && !pModeItem && - pDoc->LoadWindows_Impl( this ) ) - { - if ( GetCurrentDocument() != pDoc ) - // something went wrong during insertion - return sal_False; - pDoc->OwnerLock( sal_False ); - return sal_True; - } - - if ( pDoc ) - { - UpdateHistory( pDoc ); - UpdateDescriptor( pDoc ); - } - - SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); - sal_Bool bBrowsing = sal_True; - SfxViewFrame *pFrame = GetCurrentViewFrame(); - if ( pFrame ) - { - sal_Bool bChildActivated = sal_False; - if ( pFrame->GetActiveChildFrame_Impl() && pFrame->GetActiveChildFrame_Impl() == SfxViewFrame::Current() ) - { -// ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > xFrames( GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); -// if ( xFrames.is() ) -// xFrames->setActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () ); - pFrame->SetActiveChildFrame_Impl(0); - SfxViewFrame::SetViewFrame( pFrame ); - bChildActivated = sal_True; - } - - if ( pFrame->GetObjectShell() ) - { - pFrame->ReleaseObjectShell_Impl( sal_False ); - } - - if ( pViewIdItem ) - pFrame->SetViewData_Impl( pViewIdItem->GetValue(), String() ); - if ( pDoc ) - pFrame->SetObjectShell_Impl( *pDoc ); - } - else - { - // 1: internal embedded object - // 2: external embedded object - // 3: OLE server - if ( pPluginItem && pPluginItem->GetValue() != 2 ) - SetInPlace_Impl( TRUE ); - - bBrowsing = sal_False; - pFrame = new SfxTopViewFrame( this, pDoc, pViewIdItem ? pViewIdItem->GetValue() : 0 ); - if ( !pFrame->GetViewShell() ) - return sal_False; - - if ( pPluginItem && pPluginItem->GetValue() == 1 ) - { - pFrame->ForceOuterResize_Impl( FALSE ); - pFrame->GetBindings().HidePopups(TRUE); - - // MBA: layoutmanager of inplace frame starts locked and invisible - GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); - GetWorkWindow_Impl()->Lock_Impl( TRUE ); - - GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } - } - - String aMark; - SFX_ITEMSET_ARG( pSet, pMarkItem, SfxStringItem, SID_JUMPMARK, FALSE ); - if ( pMarkItem ) - aMark = pMarkItem->GetValue(); - - if ( pDoc->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) - { - if ( pViewDataItem ) - pFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True ); - else if( aMark.Len() ) - GetCurrentViewFrame()->GetViewShell()->JumpToMark( aMark ); - } - else - { - // Daten setzen, die in FinishedLoading ausgewertet werden - MarkData_Impl*& rpMark = pDoc->Get_Impl()->pMarkData; - if (!rpMark) - rpMark = new MarkData_Impl; - rpMark->pFrame = GetCurrentViewFrame(); - if ( pViewDataItem ) - rpMark->aUserData = pViewDataItem->GetValue(); - else - rpMark->aMark = aMark; - } - - // Position und Groesse setzen - //sal_uInt16 nWinMode = pModeItem ? pModeItem->GetValue() : 1; - if ( pAreaItem && !pOld ) - { - Window *pWin = pImp->pWindow; - - // Groesse setzen - const Rectangle aWinRect( pAreaItem->GetValue() ); - const Size aAppWindow( pImp->pWindow->GetDesktopRectPixel().GetSize() ); - Point aPos( aWinRect.TopLeft() ); - Size aSz(aWinRect.GetSize()); - if ( aSz.Width() && aSz.Height() ) - { - aPos.X() = Min(aPos.X(), - long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); - aPos.Y() = Min(aPos.Y(), - long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); - if ( aPos.X() + aSz.Width() < - aAppWindow.Width() + aSz.Width() / 2 && - aPos.Y() + aSz.Height() < - aAppWindow.Height() + aSz.Height() / 2 ) - { - pWin->SetPosPixel( aPos ); - pWin->SetOutputSizePixel( aSz ); - } - } - } - - if ( !pImp->bHidden ) - { - if ( pDoc->IsHelpDocument() || (pPluginItem && pPluginItem->GetValue() == 2) ) - pFrame->GetDispatcher()->HideUI( TRUE ); - else - pFrame->GetDispatcher()->HideUI( FALSE ); - - if ( IsInPlace() ) - pFrame->LockAdjustPosSizePixel(); - - if ( pPluginMode && pPluginMode->GetValue() == 3) - GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE); - - if ( !IsInPlace() ) - pFrame->GetDispatcher()->Update_Impl(); - pFrame->Show(); - GetWindow().Show(); - if ( !IsInPlace() || (pPluginItem && pPluginItem->GetValue() == 3) ) - pFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); - pDoc->OwnerLock( sal_False ); - - // Dont show container window! Its done by framework or directly - // by SfxTopFrame::Create() or SfxViewFrame::ExecView_Impl() ... - - if ( IsInPlace() ) - { - pFrame->UnlockAdjustPosSizePixel(); - // force resize for OLE server to fix layout problems of writer and math - // see i53651 - if ( pPluginItem && pPluginItem->GetValue() == 3 ) - pFrame->Resize(TRUE); - } - } - else - { - DBG_ASSERT( !IsInPlace() && !pPluginMode && !pPluginItem, "Special modes not compatible with hidden mode!" ); - GetWindow().Show(); - } - - // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! - pFrame->UpdateTitle(); - - if ( !IsInPlace() ) - { - if ( pFrame->GetViewShell()->UseObjectSize() ) - { - GetCurrentViewFrame()->UnlockAdjustPosSizePixel(); - GetCurrentViewFrame()->Resize(TRUE); - GetCurrentViewFrame()->ForceInnerResize_Impl( FALSE ); - GetCurrentViewFrame()->Resize(TRUE); - } - else - GetCurrentViewFrame()->Resize(TRUE); - } - - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), pDoc ) ); - return sal_True; -} - - -//======================================================================== - -long SfxViewFrameClose_Impl( void* /*pObj*/, void* pArg ) -{ - ((SfxViewFrame*)pArg)->GetFrame()->DoClose(); - return 0; -} - -TYPEINIT1(SfxTopFrame, SfxFrame); -TYPEINIT1(SfxTopViewFrame, SfxViewFrame); - -//-------------------------------------------------------------------- -SFX_IMPL_INTERFACE(SfxTopViewFrame,SfxViewFrame,SfxResId(0)) -{ -} - -//-------------------------------------------------------------------- -String SfxTopViewFrame::UpdateTitle() - -/* [Beschreibung] - - Mit dieser Methode kann der SfxTopViewFrame gezwungen werden, sich sofort - den neuen Titel vom der <SfxObjectShell> zu besorgen. - - [Anmerkung] - - Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener - zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren - m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames) - jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung - nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. - - - [Beispiel] - - void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) - { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_TITLECHANGED: - for ( SfxTopViewFrame *pTop = (SfxTopViewFrame*) - SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame)); - pTop; - pTop = (SfxTopViewFrame*) - SfxViewFrame::GetNext(this, TYPE(SfxTopViewFrame)); - { - pTop->UpdateTitle(); - ... pTop->GetName() ... - } - break; - ... - } - } - } -*/ - -{ - DBG_CHKTHIS(SfxTopViewFrame, 0); - - const SfxObjectFactory &rFact = GetObjectShell()->GetFactory(); - pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() ); - - String aTitle = SfxViewFrame::UpdateTitle(); - - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - - aTitle += String::CreateFromAscii( " - " ); - aTitle += String(aProductName); - aTitle += ' '; - ::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() ); - aTitle += String( GetModuleName_Impl( aDocServiceName ) ); -#ifdef DBG_UTIL - ::rtl::OUString aDefault; - aTitle += DEFINE_CONST_UNICODE(" ["); - String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); - aTitle += aVerId; - aTitle += ']'; -#endif - - // append TAB string if available - aTitle += _getTabString(); - - GetBindings().Invalidate( SID_NEWDOCDIRECT ); - - /* AS_TITLE - Window* pWindow = GetTopFrame_Impl()->GetTopWindow_Impl(); - if ( pWindow && pWindow->GetText() != aTitle ) - pWindow->SetText( aTitle ); - */ - return aTitle; -} - -//-------------------------------------------------------------------- -void SfxTopViewFrame::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) -{ - {DBG_CHKTHIS(SfxTopViewFrame, 0);} - - if( IsDowning_Impl()) - return; - - // we know only SimpleHints - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_MODECHANGED: - case SFX_HINT_TITLECHANGED: - // when the document changes its title, change views too - UpdateTitle(); - break; - - case SFX_HINT_DEINITIALIZING: - // on all other changes force repaint - GetFrame()->DoClose(); - return; - } - } - - SfxViewFrame::Notify( rBC, rHint ); -} - -//-------------------------------------------------------------------- -sal_Bool SfxTopViewFrame::Close() -{ - {DBG_CHKTHIS(SfxTopViewFrame, 0);} - - // Modaler Dialog oben ?? -// if ( pImp->GetModalDialog() ) -// return sal_False; - - // eigentliches Schlie\sen - if ( SfxViewFrame::Close() ) - { - if (SfxViewFrame::Current() == this) - SfxViewFrame::SetViewFrame(0); - - // Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr - // vern"unftig verwenden - also besser still legen - GetDispatcher()->Lock(sal_True); - delete this; - - return sal_True; - } - - return sal_False; -} - -SfxTopViewFrame::SfxTopViewFrame -( - SfxFrame* pFrame, - SfxObjectShell* pObjShell, - sal_uInt16 nViewId -) - -/* [Beschreibung] - - Ctor des SfxTopViewFrame f"ur eine <SfxObjectShell> aus der Ressource. - Die 'nViewId' der zu erzeugenden <SfxViewShell> kann angegeben werden - (default ist die zuerst registrierte SfxViewShell-Subklasse). -*/ - - : SfxViewFrame( *(new SfxBindings), pFrame, pObjShell, SFXFRAME_HASTITLE ) -{ - DBG_CTOR(SfxTopViewFrame, 0); - - pCloser = 0; - pImp = new SfxTopViewFrame_Impl; - pImp->pStopButtonTimer = new StopButtonTimer_Impl(this); - -//(mba)/task if ( !pFrame->GetTask() ) - { - pImp->pWindow = new SfxTopViewWin_Impl( this, &pFrame->GetWindow() ); - pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); - SetWindow_Impl( pImp->pWindow ); - pFrame->SetOwnsBindings_Impl( sal_True ); - pFrame->CreateWorkWindow_Impl(); - } - - sal_uInt32 nType = SFXFRAME_OWNSDOCUMENT | SFXFRAME_HASTITLE; - if ( pObjShell && pObjShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) - nType |= SFXFRAME_EXTERNAL; - GetFrame()->SetFrameType_Impl( GetFrame()->GetFrameType() | nType ); - - if ( GetFrame()->IsInPlace() ) - { - LockAdjustPosSizePixel(); - } - - try - { - if ( pObjShell ) - SwitchToViewShell_Impl( nViewId ); - } - catch (com::sun::star::uno::Exception& ) - { - // make sure that the ctor is left regularly - ReleaseObjectShell_Impl(); - return; - } - - if ( GetFrame()->IsInPlace() ) - { - UnlockAdjustPosSizePixel(); - } - else if ( GetViewShell() && GetViewShell()->UseObjectSize() ) - { - // initiale Gr"o\se festlegen - // Zuerst die logischen Koordinaten von IP-Objekt und EditWindow - // ber"ucksichtigen - LockAdjustPosSizePixel(); - ForceInnerResize_Impl( TRUE ); - - Window *pWindow = GetViewShell()->GetWindow(); - - // Da in den Applikationen bei der R"ucktransformation immer die - // Eckpunkte tranformiert werden und nicht die Size (um die Ecken - // alignen zu k"onnen), transformieren wir hier auch die Punkte, um - // m"oglichst wenig Rundungsfehler zu erhalten. -/* - Rectangle aRect = pWindow->LogicToLogic( GetObjectShell()->GetVisArea(), - GetObjectShell()->GetMapUnit(), - pWindow->GetMapMode() ); -*/ - Rectangle aRect = pWindow->LogicToPixel( GetObjectShell()->GetVisArea() ); - Size aSize = aRect.GetSize(); - GetViewShell()->GetWindow()->SetSizePixel( aSize ); - DoAdjustPosSizePixel(GetViewShell(), Point(), aSize ); - } -} - -//------------------------------------------------------------------------ -SfxTopViewFrame::~SfxTopViewFrame() -{ - DBG_DTOR(SfxTopViewFrame, 0); - - SetDowning_Impl(); - - if ( SfxViewFrame::Current() == this ) - SfxViewFrame::SetViewFrame(NULL); - - ReleaseObjectShell_Impl(); - if ( pPendingCloser == pCloser ) - pPendingCloser = 0; - delete pCloser; - if ( GetFrame()->OwnsBindings_Impl() ) - // Die Bindings l"oscht der Frame! - KillDispatcher_Impl(); - - delete pImp->pWindow; - delete pImp->pStopButtonTimer; - delete pImp; -} - -//------------------------------------------------------------------------ -sal_Bool SfxTopViewFrame::SetBorderPixelImpl( const SfxViewShell *pVSh, const SvBorder &rBorder ) -{ - if( SfxViewFrame::SetBorderPixelImpl( GetViewShell(), rBorder ) ) - { - if ( IsResizeInToOut_Impl() && !GetFrame()->IsInPlace() ) - { - Size aSize = pVSh->GetWindow()->GetOutputSizePixel(); - if ( aSize.Width() && aSize.Height() ) - { - aSize.Width() += rBorder.Left() + rBorder.Right(); - aSize.Height() += rBorder.Top() + rBorder.Bottom(); - - Size aOldSize = GetWindow().GetOutputSizePixel(); - GetWindow().SetOutputSizePixel( aSize ); - Window* pParent = &GetWindow(); - while ( pParent->GetParent() ) - pParent = pParent->GetParent(); - Size aOuterSize = pParent->GetOutputSizePixel(); - aOuterSize.Width() += ( aSize.Width() - aOldSize.Width() ); - aOuterSize.Height() += ( aSize.Height() - aOldSize.Height() ); - pParent->SetOutputSizePixel( aOuterSize ); - } - } - else - { - Point aPoint; - Rectangle aEditArea( aPoint, GetWindow().GetOutputSizePixel() ); - aEditArea.Left() += rBorder.Left(); - aEditArea.Right() -= rBorder.Right(); - aEditArea.Top() += rBorder.Top(); - aEditArea.Bottom() -= rBorder.Bottom(); - pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() ); - } - return sal_True; - - } - return sal_False; -} - -void SfxTopViewFrame::Exec_Impl(SfxRequest &rReq ) -{ - // Wenn gerade die Shells ausgetauscht werden... - if ( !GetObjectShell() || !GetViewShell() ) - return; - - switch ( rReq.GetSlot() ) - { - case SID_SHOWPOPUPS : - { - SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, SID_SHOWPOPUPS, FALSE); - BOOL bShow = pShowItem ? pShowItem->GetValue() : TRUE; - SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, FALSE); - USHORT nId = pIdItem ? pIdItem->GetValue() : 0; - - // ausfuehren - SfxWorkWindow *pWorkWin = GetFrame()->GetWorkWindow_Impl(); - if ( bShow ) - { - // Zuerst die Floats auch anzeigbar machen - pWorkWin->MakeChildsVisible_Impl( bShow ); - GetDispatcher()->Update_Impl( TRUE ); - - // Dann anzeigen - GetBindings().HidePopups( !bShow ); - } - else - { - // Alles hiden - SfxBindings *pBind = &GetBindings(); - while ( pBind ) - { - pBind->HidePopupCtrls_Impl( !bShow ); - pBind = pBind->GetSubBindings_Impl(); - } - - pWorkWin->HidePopups_Impl( !bShow, TRUE, nId ); - pWorkWin->MakeChildsVisible_Impl( bShow ); - } - - Invalidate( rReq.GetSlot() ); - rReq.Done(); - break; - } - - case SID_ACTIVATE: - { - MakeActive_Impl( TRUE ); - rReq.SetReturnValue( SfxObjectItem( 0, this ) ); - break; - } - - case SID_WIN_POSSIZE: - break; - - case SID_NEWDOCDIRECT : - { - SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE); - String aFactName; - if ( pFactoryItem ) - aFactName = pFactoryItem->GetValue(); - else if ( pImp->aFactoryName.Len() ) - aFactName = pImp->aFactoryName; - else - { - DBG_ERROR("Missing argument!"); - break; - } - - 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( "_blank" ) ) ); - SFX_APP()->ExecuteSlot( aReq ); - const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); - if ( pItem ) - rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); - break; - } - - case SID_CLOSEWIN: - { - // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); - if ( !xTask.is() ) - break; - - if ( GetViewShell()->PrepareClose() ) - { - // weitere Views auf dasselbe Doc? - SfxObjectShell *pDocSh = GetObjectShell(); - int bOther = sal_False; - for ( const SfxTopViewFrame *pFrame = - (SfxTopViewFrame *)SfxViewFrame::GetFirst( pDocSh, TYPE(SfxTopViewFrame) ); - !bOther && pFrame; - pFrame = (SfxTopViewFrame *)SfxViewFrame::GetNext( *pFrame, pDocSh, TYPE(SfxTopViewFrame) ) ) - bOther = (pFrame != this); - - // Doc braucht nur gefragt zu werden, wenn keine weitere View - sal_Bool bClosed = sal_False; - sal_Bool bUI = TRUE; - if ( ( bOther || pDocSh->PrepareClose( bUI ) ) ) - { - if ( !bOther ) - pDocSh->SetModified( FALSE ); - rReq.Done(); // unbedingt vor Close() rufen! - bClosed = sal_False; - try - { - xTask->close(sal_True); - bClosed = sal_True; - } - catch( CloseVetoException& ) - { - bClosed = sal_False; - } - } - - rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bClosed )); - } - return; - } - } - - rReq.Done(); -} - -void SfxTopViewFrame::GetState_Impl( SfxItemSet &rSet ) -{ - SfxObjectShell *pDocSh = GetObjectShell(); - - if ( !pDocSh ) - return; - - const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges, "Set ohne Bereich"); - while ( *pRanges ) - { - for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) - { - switch(nWhich) - { - case SID_NEWDOCDIRECT : - { - if ( pImp->aFactoryName.Len() ) - { - String aFact = String::CreateFromAscii("private:factory/"); - aFact += pImp->aFactoryName; - rSet.Put( SfxStringItem( nWhich, aFact ) ); - } - break; - } - - case SID_NEWWINDOW: - rSet.DisableItem(nWhich); - break; - - case SID_CLOSEWIN: - { - // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); - if ( !xTask.is() ) - rSet.DisableItem(nWhich); - break; - } - - case SID_SHOWPOPUPS : - break; - - case SID_WIN_POSSIZE: - { - rSet.Put( SfxRectangleItem( nWhich, Rectangle( - GetWindow().GetPosPixel(), GetWindow().GetSizePixel() ) ) ); - break; - } - - default: - DBG_ERROR( "invalid message-id" ); - } - } - ++pRanges; - } -} - -void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) -{ - sal_uInt16 nSlotId = rRequest.GetSlot(); - switch( nSlotId ) - { - case SID_BROWSE_FORWARD: - case SID_BROWSE_BACKWARD: - { - // Anzeige der n"achsten oder vorherigen Seite aus der History - SFX_REQUEST_ARG( rRequest, pSteps, SfxUInt16Item, nSlotId, sal_False ); - GetFrame()->Browse( nSlotId == SID_BROWSE_FORWARD, pSteps ? pSteps->GetValue() : 1, - (rRequest.GetModifier() & KEY_MOD1) != 0 ); - break; - } - case SID_CREATELINK: - { -/*! (pb) we need new implementation to create a link -*/ - break; - } - case SID_BROWSE_STOP: - { - if ( GetCancelManager() ) - GetCancelManager()->Cancel( TRUE ); - - // cancel jobs in hidden tasks - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - for( USHORT nPos = rArr.Count(); nPos--; ) - { - SfxFrame *pFrame = rArr[ nPos ]; - if ( !pFrame->GetCurrentViewFrame() ) - pFrame->GetCancelManager()->Cancel( TRUE ); - } - - break; - } - case SID_FOCUSURLBOX: - { - SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); - if( pCache ) - { - SfxControllerItem* pCtrl = pCache->GetItemLink(); - while( pCtrl ) - { - pCtrl->StateChanged( SID_FOCUSURLBOX, SFX_ITEM_UNKNOWN, 0 ); - pCtrl = pCtrl->GetItemLink(); - } - } - } - } - - // Recording - rRequest.Done(); -} - -void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet ) -{ - if ( !GetFrame()->CanBrowseForward() ) - rItemSet.DisableItem( SID_BROWSE_FORWARD ); - - if ( !GetFrame()->CanBrowseBackward() ) - rItemSet.DisableItem( SID_BROWSE_BACKWARD ); - - // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen - SfxObjectShell *pDocSh = GetObjectShell(); - sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ); - sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; - if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) - rItemSet.DisableItem( SID_CREATELINK ); - - pImp->pStopButtonTimer->SetButtonState( GetCancelManager()->CanCancel() ); - if ( !pImp->pStopButtonTimer->GetButtonState() ) - rItemSet.DisableItem( SID_BROWSE_STOP ); -} - -void SfxTopViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) -{ - GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); -} - -void SfxTopViewFrame::Activate( sal_Bool bMDI ) -{ - DBG_ASSERT(GetViewShell(), "Keine Shell"); - if ( bMDI ) - pImp->bActive = sal_True; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! -} - -void SfxTopViewFrame::Deactivate( sal_Bool bMDI ) -{ - DBG_ASSERT(GetViewShell(), "Keine Shell"); - if ( bMDI ) - pImp->bActive = sal_False; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! -} - -void SfxTopFrame::CheckMenuCloser_Impl( MenuBar* pMenuBar ) -{ - Reference < ::com::sun::star::frame::XFrame > xFrame = GetFrameInterface(); - - // checks if there is more than one "real" (not help) task window - // in this case a close button is inserted into the menubar - - DBG_ASSERT( xFrame.is(), "Attention: this bug is very hard to reproduce. Please try to remember how you triggered it!"); - if ( !xFrame.is() || !xFrame->getController().is() ) - // dummy component - return; - - Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop( xFrame->getCreator(), UNO_QUERY ); - if ( !xDesktop.is() ) - // test only for task windows - return; - - sal_Bool bLastTask = sal_False; - Reference < ::com::sun::star::container::XIndexAccess > - xList ( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY ); - sal_Int32 nCount = xList->getCount(); - if ( nCount<=1 ) - // only one task - bLastTask = sal_True; - else if ( nCount==2 ) - { - // if we have to tasks, one can be the help task, that should be ignored - for( sal_Int32 i=0; i<nCount; ++i ) - { - Reference < ::com::sun::star::frame::XFrame > xTask; - ::com::sun::star::uno::Any aVal = xList->getByIndex(i); - if ( (aVal>>=xTask) && xTask.is() && xTask->getName().compareToAscii("OFFICE_HELP_TASK") == COMPARE_EQUAL ) - { - // one of the two open tasks was the help task -> ignored - bLastTask = sal_True; - break; - } - } - } - - pMenuBar->ShowCloser(bLastTask); -} diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx index e8052594f8c8..b58bbc2840da 100644 --- a/sfx2/source/view/viewfac.cxx +++ b/sfx2/source/view/viewfac.cxx @@ -29,10 +29,8 @@ #include "precompiled_sfx2.hxx" // INCLUDE --------------------------------------------------------------- -#ifndef GCC -#endif - #include <sfx2/app.hxx> +#include <rtl/ustrbuf.hxx> #include "viewfac.hxx" // STATIC DATA ----------------------------------------------------------- @@ -51,6 +49,14 @@ void SfxViewFactory::InitFactory() (*fnInit)(); } +String SfxViewFactory::GetViewName() const +{ + ::rtl::OUStringBuffer aViewName; + aViewName.appendAscii( "view" ); + aViewName.append( sal_Int32( GetOrdinal() ) ); + return aViewName.makeStringAndClear(); +} + // CTOR / DTOR ----------------------------------------------------------- SfxViewFactory::SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI, diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 2291e8079b3a..66af0d7ac8ba 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> @@ -53,6 +54,7 @@ #endif #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> +#include <tools/diagnose_ex.h> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> @@ -61,8 +63,9 @@ #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> @@ -76,6 +79,8 @@ #include <unotools/localfilehelper.hxx> #include <unotools/ucbhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <comphelper/configurationhelper.hxx> #include <com/sun/star/uno/Reference.h> @@ -94,6 +99,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; +using ::com::sun::star::awt::XWindow; +using ::com::sun::star::beans::PropertyValue; namespace css = ::com::sun::star; #ifndef GCC @@ -123,7 +130,7 @@ namespace css = ::com::sun::star; #include <sfx2/docfile.hxx> #include <sfx2/module.hxx> #include <sfx2/msgpool.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "viewimp.hxx" #include <sfx2/sfxbasecontroller.hxx> #include <sfx2/sfx.hrc> @@ -136,11 +143,14 @@ namespace css = ::com::sun::star; #include "macro.hxx" #include "minfitem.hxx" #include "../appl/app.hrc" +#include "impviewframe.hxx" + //------------------------------------------------------------------------- DBG_NAME(SfxViewFrame) #define SfxViewFrame #include "sfxslots.hxx" +#undef SfxViewFrame //------------------------------------------------------------------------- @@ -158,54 +168,6 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= -struct SfxViewFrame_Impl -{ - SvBorder aBorder; - Size aMargin; - Size aSize; - String aViewData; - String aFrameTitle; - TypeId aLastType; - String aActualURL; - String aActualPresentationURL; - SfxFrame* pFrame; - SfxCancelManager* pCancelMgr; - svtools::AsynchronLink* pReloader; - //SfxInPlaceFrame* pIPFrame; - Window* pWindow; - SfxViewFrame* pActiveChild; - SfxViewFrame* pParentViewFrame; - SfxObjectShell* pImportShell; - Window* pFocusWin; - SfxMacro* pMacro; - sal_uInt16 nDocViewNo; - sal_uInt16 nCurViewId; - sal_Bool bResizeInToOut:1; - sal_Bool bDontOverwriteResizeInToOut:1; - sal_Bool bObjLocked:1; - sal_Bool bRestoreView:1; - sal_Bool bSetViewFrameLocked:1; - sal_Bool bReloading:1; - sal_Bool bIsDowning:1; - sal_Bool bInCtor:1; - sal_Bool bModal:1; - sal_Bool bEnabled:1; - sal_Bool bEventFlag:1; - sal_Bool bWindowWasEnabled:1; - - SfxViewFrame_Impl() - : pReloader(0 ) - , pMacro( 0 ) - , bWindowWasEnabled(sal_True) - {} - - ~SfxViewFrame_Impl() - { - delete pReloader; - delete pCancelMgr; - } -}; - //------------------------------------------------------------------------- void SfxViewFrame::SetDowning_Impl() { @@ -219,31 +181,7 @@ sal_Bool SfxViewFrame::IsDowning_Impl() const } -//------------------------------------------------------------------------- -void SfxViewFrame::SetSetViewFrameAllowed_Impl( sal_Bool bSet ) -{ - pImp->bSetViewFrameLocked = !bSet; -}; - -//------------------------------------------------------------------------- -sal_Bool SfxViewFrame::IsSetViewFrameAllowed_Impl() const -{ - return !pImp->bSetViewFrameLocked; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetImportingObjectShell_Impl( SfxObjectShell* pSh ) -{ - pImp->pImportShell = pSh; -} - //-------------------------------------------------------------------- -SfxObjectShell* SfxViewFrame::GetImportingObjectShell_Impl() const -{ - return pImp->pImportShell; -} - - class SfxViewNotificatedFrameList_Impl : public SfxListener, public SfxViewFrameArr_Impl { @@ -299,7 +237,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq, sal_Bool bAsync ) void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { - SfxFrame *pParent = GetFrame()->GetParentFrame(); + SfxFrame *pParent = GetFrame().GetParentFrame(); if ( rReq.GetSlot() == SID_RELOAD ) { // Bei CTRL-Reload den aktiven Frame reloaden @@ -319,11 +257,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // Wenn nur ein Reload der Graphiken eines oder mehrerer ChildFrames // gemacht werden soll - SfxFrame *pFrame = GetFrame(); - if ( pParent == pFrame && pFrame->GetChildFrameCount() ) + SfxFrame& rFrame = GetFrame(); + if ( pParent == &rFrame && rFrame.GetChildFrameCount() ) { sal_Bool bReloadAvailable = sal_False; - SfxFrameIterator aIter( *pFrame, sal_False ); + SfxFrameIterator aIter( rFrame, sal_False ); SfxFrame *pChild = aIter.FirstFrame(); while ( pChild ) { @@ -356,13 +294,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } SfxObjectShell* pSh = GetObjectShell(); - sal_Bool bWasReadonly = pSh->IsReadOnly(); - switch ( rReq.GetSlot() ) { case SID_EDITDOC: { - if ( GetFrame()->HasComponent() ) + if ( GetFrame().HasComponent() ) break; // Wg. Doppeltbelegung in Toolboxen (mit/ohne Ctrl) ist es auch @@ -498,12 +434,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // r/o-Doc kann nicht in Editmode geschaltet werden? rReq.Done( sal_False ); - SFX_REQUEST_ARG( rReq, pFSetItem, SfxBoolItem, SID_EDIT_FRAMESET, sal_False); if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) { // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); - if ( !pFSetItem && RET_YES == aBox.Execute() ) + if ( RET_YES == aBox.Execute() ) { SfxApplication* pApp = SFX_APP(); SfxAllItemSet aSet( pApp->GetPool() ); @@ -544,16 +479,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) rReq.Done( sal_True ); // if( nOpenMode == SFX_STREAM_READONLY ) // pMed->Close(); - - // ReloadForEdit bei Framesets schaltet auch FramesetEditmode - sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); - if ( bIsReadonly != bWasReadonly && !GetFrame()->GetParentFrame() ) - { - SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); - GetDispatcher()->Execute( SID_EDIT_FRAMESET, - SFX_CALLMODE_RECORD, &aItem, 0L ); - pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); - } return; } } @@ -596,7 +521,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // AutoLoad ist ggf. verboten SFX_REQUEST_ARG(rReq, pAutoLoadItem, SfxBoolItem, SID_AUTOLOAD, sal_False); if ( pAutoLoadItem && pAutoLoadItem->GetValue() && - GetFrame()->IsAutoLoadLocked_Impl() ) + GetFrame().IsAutoLoadLocked_Impl() ) return; SfxObjectShellLock xOldObj( pSh ); @@ -611,7 +536,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // ggf. beim User nachfragen sal_Bool bDo = ( GetViewShell()->PrepareClose() != FALSE ); SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, sal_False); - if ( bDo && GetFrame()->DocIsModified_Impl() && + if ( bDo && GetFrame().DocIsModified_Impl() && !rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) ) { QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_LASTVERSION) ); @@ -631,25 +556,21 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // bestehende SfxMDIFrames f"ur dieses Doc leeren // eigenes Format oder R/O jetzt editierbar "offnen? - SfxViewNotificatedFrameList_Impl aFrames; SfxObjectShellLock xNewObj; - sal_Bool bRestoreView = ( pURLItem == NULL ); - TypeId aOldType = xOldObj->Type(); - SfxViewFrame *pView = GetFirst(xOldObj); - while(pView) + // collect the views of the document + // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should + // be UNOized, too + typedef ::std::pair< Reference< XFrame >, USHORT > ViewDescriptor; + ::std::list< ViewDescriptor > aViewFrames; + SfxViewFrame *pView = GetFirst( xOldObj ); + while ( pView ) { - if( bHandsOff ) - pView->GetDispatcher()->LockUI_Impl(sal_True); - aFrames.InsertViewFrame( pView ); - pView->GetBindings().ENTERREGISTRATIONS(); - - // RestoreView nur wenn keine neue Datei geladen - // (Client-Pull-Reloading) - pView = /*bHandsOff ? (SfxTopViewFrame*) GetFirst( - xOldObj, TYPE(SfxTopViewFrame) ) :*/ - (SfxTopViewFrame*)GetNext( *pView, xOldObj, - TYPE( SfxTopViewFrame ) ); + Reference< XFrame > xFrame( pView->GetFrame().GetFrameInterface() ); + OSL_ENSURE( xFrame.is(), "SfxViewFrame::ExecReload_Impl: no XFrame?!" ); + aViewFrames.push_back( ViewDescriptor( xFrame, pView->GetCurViewId() ) ); + + pView = GetNext( *pView, xOldObj ); } DELETEZ( xOldObj->Get_Impl()->pReloadTimer ); @@ -672,7 +593,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { pNewSet = new SfxAllItemSet( *pMedium->GetItemSet() ); pNewSet->ClearItem( SID_VIEW_ID ); - pNewSet->ClearItem( SID_USER_DATA ); pNewSet->ClearItem( SID_STREAM ); pNewSet->ClearItem( SID_INPUTSTREAM ); pNewSet->Put( SfxStringItem( SID_FILTER_NAME, pMedium->GetFilter()->GetName() ) ); @@ -741,9 +661,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False); SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedReferer, SfxStringItem, SID_REFERER, sal_False); - if( !pURLItem || pURLItem->GetValue() == xOldObj->GetMedium()->GetName() ) - xOldObj->Get_Impl()->bForbidCaching = sal_True; - sal_Bool bHasStorage = pMedium->HasStorage_Impl(); if( bHandsOff ) { @@ -758,12 +675,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_STANDARD ); + uno::Sequence < beans::PropertyValue > aLoadArgs; + TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs ); try { - uno::Sequence < beans::PropertyValue > aProps; - TransformItems( SID_OPENDOC, *pNewSet, aProps ); uno::Reference < frame::XLoadable > xLoad( xNewObj->GetModel(), uno::UNO_QUERY ); - xLoad->load( aProps ); + xLoad->load( aLoadArgs ); } catch ( uno::Exception& ) { @@ -815,54 +732,41 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { if ( xNewObj->IsDocShared() ) { - // the file is shared but the closing can chang the sharing control file + // the file is shared but the closing can change the sharing control file xOldObj->DoNotCleanShareControlFile(); } + // the Reload and Silent items were only temporary, remove them xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_RELOAD ); xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_SILENT ); - UpdateDocument_Impl(); - } + TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs ); - SfxViewFrame* pThis = (SfxViewFrame*)this; - sal_Bool bDeleted = aFrames.C40_GETPOS( SfxViewFrame, pThis ) == USHRT_MAX; - - if( !bDeleted ) - { - GetBindings().Invalidate( SID_RELOAD ); - pImp->bReloading = sal_False; + UpdateDocument_Impl(); } - // neues Doc in die bestehenden SfxMDIFrames einsetzen; wenn - // das Reload geklappt hat, mu\s in diesem Frame kein Dokument - // eingesetzt werden, weil das schon vom LoadEnvironment - // gemacht wurde - if ( xNewObj.Is() && xNewObj->Type() != aOldType ) - // RestoreView nur, wenn gleicher Dokumenttyp - bRestoreView = sal_False; - - const sal_uInt16 nCount = aFrames.Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) + if ( xNewObj.Is() ) { - SfxViewFrame *pCurrView = aFrames.GetObject( i ); - if ( xNewObj.Is() ) + try { - //if( /*!bHandsOff &&*/ this != pView ) - pCurrView->ReleaseObjectShell_Impl( bRestoreView ); - pCurrView->SetRestoreView_Impl( bRestoreView ); - //if( pView != this || !xNewObj.Is() ) + while ( !aViewFrames.empty() ) { - SfxFrame *pFrame = pCurrView->GetFrame(); - pFrame->InsertDocument(xNewObj.Is() ? xNewObj : xOldObj ); + LoadViewIntoFrame_Impl( *xNewObj, aViewFrames.front().first, aLoadArgs, aViewFrames.front().second, false ); + aViewFrames.pop_front(); + } + } + catch( const Exception& ) + { + // close the remaining frames + // Don't catch exceptions herein, if this fails, then we're left in an indetermined state, and + // crashing is better than trying to proceed + while ( !aViewFrames.empty() ) + { + Reference< util::XCloseable > xClose( aViewFrames.front().first, UNO_QUERY_THROW ); + xClose->close( sal_True ); + aViewFrames.pop_front(); } } - pCurrView->GetBindings().LEAVEREGISTRATIONS(); - pCurrView->GetDispatcher()->LockUI_Impl( sal_False ); - } - - if ( xNewObj.Is() ) - { // Propagate document closure. SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) ); } @@ -870,11 +774,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // als erledigt recorden rReq.Done( sal_True ); rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_True)); - if( !bDeleted ) - { - Notify( *GetObjectShell(), SfxSimpleHint( - SFX_HINT_TITLECHANGED )); - } return; } else @@ -897,11 +796,11 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) // Ich bin gerade am Reloaden und Yielde so vor mich hin ... return; - GetFrame()->GetParentFrame(); + GetFrame().GetParentFrame(); SfxWhichIter aIter( rSet ); for ( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() ) { - if ( GetFrame()->HasComponent() ) + if ( GetFrame().HasComponent() ) { // Wenn die Komponente es nicht selbst dispatched, dann // macht es auch keinen Sinn! @@ -929,16 +828,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) case SID_RELOAD: { - SfxFrame* pFrame = GetTopFrame(); - SfxViewFrame *pView = pFrame->GetCurrentViewFrame(); - if ( pView && pView->GetViewShell() && - pView->GetViewShell()->IsImplementedAsFrameset_Impl() && - pView->GetViewShell()->GetInterface()->GetSlot( nWhich ) ) - { - // Hack f"ur Explorer: Reload wird an der ViewShell ausgef"uhrt - pView->GetViewShell()->GetSlotState( nWhich, 0, &rSet ); - break; - } + SfxFrame* pFrame = &GetTopFrame(); if ( !pSh || !pSh->CanReload_Impl() || pSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) rSet.DisableItem(nWhich); @@ -1009,7 +899,7 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq ) } else if ( GetViewShell() ) { - // der SW hat eigenes Undo an der ::com::sun::star::sdbcx::View + // der SW hat eigenes Undo an der View const SfxPoolItem *pRet = GetViewShell()->ExecuteSlot( rReq ); if ( pRet ) bOK = ((SfxBoolItem*)pRet)->GetValue(); @@ -1031,7 +921,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) SfxUndoManager *pShUndoMgr = pSh->GetUndoManager(); if ( !pShUndoMgr ) { - // der SW hat eigenes Undo an der ::com::sun::star::sdbcx::View + // der SW hat eigenes Undo an der View SfxWhichIter aIter( rSet ); SfxViewShell *pViewSh = GetViewShell(); if( !pViewSh ) return; @@ -1075,86 +965,30 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) } //-------------------------------------------------------------------- -void SfxViewFrame::SetObjectShell_Impl -( - SfxObjectShell& rObjSh, // eine initialisierte SfxObjectShell, - FASTBOOL bDefaultView // sal_True: nicht restaurieren -) - -/* [Beschreibung] - - Diese Methode setzt eine <SfxObjectShell> in den SfxViewFrame ein. - - Zuvor mu\s die vorherige SfxObjectShell, insofern schein eine gesetzt - wurde, mit der Methode ReleaseObjectShell() entfernt worden sein. Somit - kann durch Aufruf von ReleaseObjectShell() und SetObjectShell() die - SfxObjectShell ausgetauscht werden. - - - [Querverweise] - - <SfxViewFrame::ReleaseObjectShell()> -*/ - +void SfxViewFrame::PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ) { - DBG_CHKTHIS(SfxViewFrame, 0); - DBG_ASSERT( !xObjSh.Is(), "old feature used: only one Object per View!" ); - - GetFrame()->ReleasingComponent_Impl( sal_False ); - - // Doc einsetzen - xObjSh = &rObjSh; - if ( xObjSh.Is() && xObjSh->IsPreview() ) - SetQuietMode_Impl( sal_True ); - - GetFrame()->SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); - - // Modulshell einf"ugen - SfxModule* pModule = xObjSh->GetModule(); - if( pModule ) - pDispatcher->InsertShell_Impl( *pModule, 1 ); - - pDispatcher->Push( rObjSh ); - pDispatcher->Flush(); - StartListening( rObjSh ); - - rObjSh.ViewAssigned(); - pDispatcher->SetReadOnly_Impl( rObjSh.IsReadOnly() ); - - const SfxMedium *pMedium = GetObjectShell()->GetMedium(); - SFX_ITEMSET_ARG( - pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( !pHiddenItem || !pHiddenItem->GetValue() ) + i_rViewShell.PopSubShells_Impl(); + sal_uInt16 nLevel = pDispatcher->GetShellLevel( i_rViewShell ); + if ( nLevel != USHRT_MAX ) { - LockObjectShell_Impl(sal_True); - GetDocNumber_Impl(); + if ( nLevel ) + { + // more sub shells on the stack, which were not affected by PopSubShells_Impl + SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); + if ( pSubShell == i_rViewShell.GetSubShell() ) + // "real" sub shells will be deleted elsewhere + pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); + else + pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); + } + pDispatcher->Pop( i_rViewShell ); + pDispatcher->Flush(); } - // ::com::sun::star::sdbcx::View erzeugen - if ( bDefaultView ) - SetRestoreView_Impl( sal_False ); - -// So darf man es nicht machen, da LaodWindows hierueber laeuft. Kann meiner Meinung nach -// auch nur beim Reload mit Dokumenttypwechsel passieren. -/* if ( xObjSh->Type() != pImp->aLastType ) - SetRestoreView_Impl( sal_False ); */ - - SwitchToViewShell_Impl( !IsRestoreView_Impl() ? (sal_uInt16) 0 : GetCurViewId() ); - rObjSh.PostActivateEvent_Impl( this ); - if ( Current() == this ) - SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), &rObjSh ) ); - - Notify( rObjSh, SfxSimpleHint(SFX_HINT_TITLECHANGED) ); - Notify( rObjSh, SfxSimpleHint(SFX_HINT_DOCCHANGED) ); - - // Zur Sicherheit, aber eigentlich sollte jetzt nichts mehr passieren - // ( kein erzwungenes Update ) - if ( SfxViewFrame::Current() == this ) - GetDispatcher()->Update_Impl(); } //-------------------------------------------------------------------- -void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) +void SfxViewFrame::ReleaseObjectShell_Impl() /* [Beschreibung] @@ -1166,7 +1000,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) die SfxObjectShell ausgetauscht werden. Zwischen RealeaseObjectShell() und SetObjectShell() darf die Kontrolle - nicht an das ::com::sun::star::chaos::System abgegeben werden. + nicht an das System abgegeben werden. [Querverweise] @@ -1177,7 +1011,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) DBG_CHKTHIS(SfxViewFrame, 0); DBG_ASSERT( xObjSh.Is(), "no SfxObjectShell to release!" ); - GetFrame()->ReleasingComponent_Impl( sal_True ); + GetFrame().ReleasingComponent_Impl( sal_True ); if ( GetWindow().HasChildPathFocus( sal_True ) ) { DBG_ASSERT( !GetActiveChildFrame_Impl(), "Wrong active child frame!" ); @@ -1187,25 +1021,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) SfxViewShell *pDyingViewSh = GetViewShell(); if ( pDyingViewSh ) { - SetRestoreView_Impl( bStoreView ); - if ( bStoreView ) - pDyingViewSh->WriteUserData( GetViewData_Impl(), sal_True ); - - // Jetzt alle SubShells wechhauen - pDyingViewSh->PushSubShells_Impl( sal_False ); - sal_uInt16 nLevel = pDispatcher->GetShellLevel( *pDyingViewSh ); - if ( nLevel && nLevel != USHRT_MAX ) - { - // Es gibt immer nocht SubShells - SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); - if ( pSubShell == pDyingViewSh->GetSubShell() ) - //"Echte" Subshells nicht deleten - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); - else - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); - } - pDispatcher->Pop( *pDyingViewSh ); - pDispatcher->Flush(); + PopShellAndSubShells_Impl( *pDyingViewSh ); pDyingViewSh->DisconnectAllClients(); SetViewShell_Impl(0); delete pDyingViewSh; @@ -1244,116 +1060,26 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) GetDispatcher()->SetDisableFlags( 0 ); } -//------------------------------------------------------------------------- - -String SfxViewFrame::UpdateTitle() - -/* [Beschreibung] - - Mit dieser Methode kann der SfxMDIFrame gezwungen werden, sich sofort - den neuen Titel vom der <SfxObjectShell> zu besorgen. - - [Anmerkung] - - Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener - zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren - m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxMDIFrames) - jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung - nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. - - - [Beispiel] - - void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) - { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_TITLECHANGED: - for ( SfxMDIFrame *pMDI = (SfxMDIFrame*) - SfxViewFrame::GetFirst(this, TYPE(SfxMDIFrame)); - pMDI; - pMDI = (SfxMDIFrame*) - SfxViewFrame::GetNext(this, TYPE(SfxMDIFrame)); - { - pMDI->UpdateTitle(); - ... pMDI->GetName() ... - } - break; - ... - } - } - } -*/ - -{ - SfxObjectShell *pObjSh = GetObjectShell(); - if ( !pObjSh ) - return String(); - -// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) -// // kein UpdateTitle mit Embedded-ObjectShell -// return String(); - - const SfxMedium *pMedium = pObjSh->GetMedium(); - String aURL; - GetFrame(); // -Wall required?? - if ( pObjSh->HasName() ) - { - INetURLObject aTmp( pMedium->GetName() ); - aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - } - - if ( aURL != pImp->aActualURL ) - // URL hat sich ge"andert - pImp->aActualURL = aURL; - - // gibt es noch eine weitere View? - sal_uInt16 nViews=0; - for ( SfxViewFrame *pView= GetFirst(pObjSh); - pView && nViews<2; - pView = GetNext(*pView,pObjSh) ) - if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && - !IsDowning_Impl()) - nViews++; - - // Titel des Fensters - String aTitle; - if ( nViews == 2 || pImp->nDocViewNo > 1 ) - // dann die Nummer dranh"angen - aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); - else - aTitle = pObjSh->UpdateTitle(); - - // Name des SbxObjects - String aSbxName = pObjSh->SfxShell::GetName(); - if ( IsVisible() ) - { - aSbxName += ':'; - aSbxName += String::CreateFromInt32(pImp->nDocViewNo); - } - - SetName( aSbxName ); - pImp->aFrameTitle = aTitle; - GetBindings().Invalidate( SID_FRAMETITLE ); - GetBindings().Invalidate( SID_CURRENT_URL ); - return aTitle; -} - - //-------------------------------------------------------------------- sal_Bool SfxViewFrame::Close() { DBG_CHKTHIS(SfxViewFrame, 0); - DBG_ASSERT( GetFrame()->IsClosing_Impl() || !GetFrame()->GetFrameInterface().is(), "ViewFrame closed too early!" ); + DBG_ASSERT( GetFrame().IsClosing_Impl() || !GetFrame().GetFrameInterface().is(), "ViewFrame closed too early!" ); // Wenn bis jetzt noch nicht gespeichert wurde, sollen eingebettete Objekte // auch nicht mehr automatisch gespeichert werden! if ( GetViewShell() ) GetViewShell()->DiscardClients_Impl(); - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); + + if (SfxViewFrame::Current() == this) + SfxViewFrame::SetViewFrame( NULL ); + + // Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr + // vern"unftig verwenden - also besser still legen + GetDispatcher()->Lock(sal_True); + delete this; return sal_True; } @@ -1394,7 +1120,7 @@ void SfxViewFrame::DoActivate( sal_Bool bUI, SfxViewFrame* pOldFrame ) SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { - if ( !pOldFrame || !pOldFrame->GetFrame()->IsParent( pFrame->GetFrame() ) ) + if ( !pOldFrame || !pOldFrame->GetFrame().IsParent( &pFrame->GetFrame() ) ) pFrame->pDispatcher->DoParentActivate_Impl(); pFrame = pFrame->GetParentViewFrame(); } @@ -1412,8 +1138,8 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame ) // ViewFrames, erh"alt er ein ParentDeactivate if ( bUI ) { -// if ( GetFrame()->GetWorkWindow_Impl() ) -// GetFrame()->GetWorkWindow_Impl()->SaveStatus_Impl(); +// if ( GetFrame().GetWorkWindow_Impl() ) +// GetFrame().GetWorkWindow_Impl()->SaveStatus_Impl(); /* SfxMedium* pMed = GetObjectShell() ? GetObjectShell()->GetMedium() : NULL; if( pMed ) @@ -1428,7 +1154,7 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame ) SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { - if ( !pNewFrame || !pNewFrame->GetFrame()->IsParent( pFrame->GetFrame() ) ) + if ( !pNewFrame || !pNewFrame->GetFrame().IsParent( &pFrame->GetFrame() ) ) pFrame->pDispatcher->DoParentDeactivate_Impl(); pFrame = pFrame->GetParentViewFrame(); } @@ -1445,7 +1171,7 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) { if ( GetViewShell() && GetWindow().IsVisible() ) { - if ( GetFrame()->IsInPlace() ) + if ( GetFrame().IsInPlace() ) { /* Size aSize( GetViewShell()->GetWindow()->GetSizePixel() ); @@ -1457,24 +1183,8 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) return; } - if ( GetViewShell()->UseObjectSize() ) - { - // Zun"achst die Gr"o\se des MDI-Fensters berechnen - - DoAdjustPosSizePixel( GetViewShell(), Point(), - GetViewShell()->GetWindow()->GetSizePixel() ); - - // Da nach einem InnerResize die Position des EditFensters und - // damit auch der Tools nocht stimmt, mu\s nun noch einmal von - // au\sen resized werden ! - - ForceOuterResize_Impl(sal_True); - } - DoAdjustPosSizePixel( (SfxViewShell *) GetViewShell(), Point(), GetWindow().GetOutputSizePixel() ); - if ( GetViewShell()->UseObjectSize() ) - ForceOuterResize_Impl(sal_False); } } } @@ -1482,12 +1192,43 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) //------------------------------------------------------------------------ sal_Bool SfxViewFrame::SetBorderPixelImpl ( - const SfxViewShell* /*pSh*/, + const SfxViewShell* pVSh, const SvBorder& rBorder ) { pImp->aBorder = rBorder; + + if ( IsResizeInToOut_Impl() && !GetFrame().IsInPlace() ) + { + Size aSize = pVSh->GetWindow()->GetOutputSizePixel(); + if ( aSize.Width() && aSize.Height() ) + { + aSize.Width() += rBorder.Left() + rBorder.Right(); + aSize.Height() += rBorder.Top() + rBorder.Bottom(); + + Size aOldSize = GetWindow().GetOutputSizePixel(); + GetWindow().SetOutputSizePixel( aSize ); + Window* pParent = &GetWindow(); + while ( pParent->GetParent() ) + pParent = pParent->GetParent(); + Size aOuterSize = pParent->GetOutputSizePixel(); + aOuterSize.Width() += ( aSize.Width() - aOldSize.Width() ); + aOuterSize.Height() += ( aSize.Height() - aOldSize.Height() ); + pParent->SetOutputSizePixel( aOuterSize ); + } + } + else + { + Point aPoint; + Rectangle aEditArea( aPoint, GetWindow().GetOutputSizePixel() ); + aEditArea.Left() += rBorder.Left(); + aEditArea.Right() -= rBorder.Right(); + aEditArea.Top() += rBorder.Top(); + aEditArea.Bottom() -= rBorder.Bottom(); + pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() ); + } + return sal_True; } @@ -1505,15 +1246,22 @@ const SvBorder& SfxViewFrame::GetBorderPixelImpl void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { {DBG_CHKTHIS(SfxViewFrame, 0);} - if ( !xObjSh.Is() ) + + if( IsDowning_Impl()) return; + // we know only SimpleHints if ( rHint.IsA(TYPE(SfxSimpleHint)) ) { switch( ( (SfxSimpleHint&) rHint ).GetId() ) { case SFX_HINT_MODECHANGED: { + UpdateTitle(); + + if ( !xObjSh.Is() ) + break; + // r/o Umschaltung? SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_RELOAD ); @@ -1555,13 +1303,15 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) break; } - case SFX_HINT_DYING: case SFX_HINT_DEINITIALIZING: + GetFrame().DoClose(); + break; + case SFX_HINT_DYING: // when the Object is being deleted, destroy the view too if ( xObjSh.Is() ) ReleaseObjectShell_Impl(); else - GetFrame()->DoClose(); + GetFrame().DoClose(); break; } @@ -1586,6 +1336,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_EVENT_OPENDOC: case SFX_EVENT_CREATEDOC: { + if ( !xObjSh.Is() ) + break; + SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_RELOAD ); rBind.Invalidate( SID_EDITDOC ); @@ -1609,7 +1362,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_EVENT_TOGGLEFULLSCREENMODE: { - if ( GetFrame()->OwnsBindings_Impl() ) + if ( GetFrame().OwnsBindings_Impl() ) GetBindings().GetDispatcher_Impl()->Update_Impl( sal_True ); break; } @@ -1620,26 +1373,18 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) //------------------------------------------------------------------------ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { - pImp->pFrame->DocumentInserted( pObjSh ); - pImp->bInCtor = sal_True; - pImp->pParentViewFrame = 0; pImp->bResizeInToOut = sal_True; pImp->bDontOverwriteResizeInToOut = sal_False; - pImp->pImportShell = 0; pImp->bObjLocked = sal_False; - pImp->bEventFlag = sal_True; pImp->pFocusWin = 0; pImp->pActiveChild = NULL; - pImp->bRestoreView = sal_False; pImp->nCurViewId = 0; - pImp->bSetViewFrameLocked = sal_False; pImp->bReloading = sal_False; pImp->bIsDowning = sal_False; pImp->bModal = sal_False; pImp->bEnabled = sal_True; pImp->nDocViewNo = 0; pImp->aMargin = Size( -1, -1 ); - pImp->pCancelMgr = 0; pImp->pWindow = 0; SetPool( &SFX_APP()->GetPool() ); @@ -1651,7 +1396,6 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) if ( xObjSh.Is() && xObjSh->IsPreview() ) SetQuietMode_Impl( sal_True ); - GetFrame()->SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); if ( pObjSh ) { pDispatcher->Push( *SFX_APP() ); @@ -1677,56 +1421,36 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) SfxViewFrame *pThis = this; // wegen der kranken Array-Syntax SfxViewFrameArr_Impl &rViewArr = SFX_APP()->GetViewFrames_Impl(); rViewArr.C40_INSERT(SfxViewFrame, pThis, rViewArr.Count() ); - pImp->bInCtor = sal_False; } -//------------------------------------------------------------------------ -SfxViewFrame::SfxViewFrame( SfxObjectShell &rObjShell, SfxBindings &rBindings, - SfxFrame* pParent, sal_uInt32 nType ) -: - pImp( new SfxViewFrame_Impl ), - pDispatcher(0), - pBindings(&rBindings), - nAdjustPosPixelLock( 0 ) -{ - DBG_CTOR(SfxViewFrame, 0); - - SetFrame_Impl( pParent ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( GetFrameType() | nType ); - Construct_Impl( &rObjShell ); -} +SfxViewFrame::SfxViewFrame +( + SfxFrame& rFrame, + SfxObjectShell* pObjShell +) -//------------------------------------------------------------------------ -SfxViewFrame::SfxViewFrame(const SfxViewFrame &rCopy, SfxBindings &rBindings, - SfxFrame *pFrame ) -: - pImp( new SfxViewFrame_Impl ), - pDispatcher(0), - pBindings(&rBindings), - nAdjustPosPixelLock( 0 ) -{ - DBG_CTOR(SfxViewFrame, 0); +/* [Beschreibung] - SetFrame_Impl( pFrame ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( rCopy.GetFrameType() ); - Construct_Impl( rCopy.GetObjectShell() ); -} + Ctor des SfxViewFrame f"ur eine <SfxObjectShell> aus der Ressource. + Die 'nViewId' der zu erzeugenden <SfxViewShell> kann angegeben werden + (default ist die zuerst registrierte SfxViewShell-Subklasse). +*/ -SfxViewFrame::SfxViewFrame( SfxBindings& rBindings, SfxFrame *pFrame, - SfxObjectShell *pDoc, sal_uInt32 nType ) - : pImp( new SfxViewFrame_Impl ) + : pImp( new SfxViewFrame_Impl( rFrame ) ) , pDispatcher(0) - , pBindings(&rBindings) + , pBindings( new SfxBindings ) , nAdjustPosPixelLock( 0 ) { - DBG_CTOR(SfxViewFrame, 0); + DBG_CTOR( SfxViewFrame, NULL ); + + rFrame.SetCurrentViewFrame_Impl( this ); + rFrame.SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); + Construct_Impl( pObjShell ); - SetFrame_Impl( pFrame ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( GetFrameType() | nType ); - Construct_Impl( pDoc); + pImp->pWindow = new SfxFrameViewWindow_Impl( this, rFrame.GetWindow() ); + pImp->pWindow->SetSizePixel( rFrame.GetWindow().GetOutputSizePixel() ); + rFrame.SetOwnsBindings_Impl( sal_True ); + rFrame.CreateWorkWindow_Impl(); } //------------------------------------------------------------------------ @@ -1734,12 +1458,21 @@ SfxViewFrame::~SfxViewFrame() { DBG_DTOR(SfxViewFrame, 0); - if ( GetFrame() && GetFrame()->GetCurrentViewFrame() == this ) - GetFrame()->SetCurrentViewFrame_Impl( NULL ); + SetDowning_Impl(); - SfxObjectShell* pSh = pImp->pImportShell; - if( pSh ) - pSh->AbortImport(); + if ( SfxViewFrame::Current() == this ) + SfxViewFrame::SetViewFrame( NULL ); + + ReleaseObjectShell_Impl(); + + if ( GetFrame().OwnsBindings_Impl() ) + // Die Bindings l"oscht der Frame! + KillDispatcher_Impl(); + + delete pImp->pWindow; + + if ( GetFrame().GetCurrentViewFrame() == this ) + GetFrame().SetCurrentViewFrame_Impl( NULL ); // von Frame-Liste abmelden SfxApplication *pSfxApp = SFX_APP(); @@ -1781,12 +1514,11 @@ SfxViewFrame* SfxViewFrame::Current() } //-------------------------------------------------------------------- -sal_uInt16 SfxViewFrame::Count(TypeId aType) +sal_uInt16 SfxViewFrame::Count() /* [Beschreibung] - Liefert die Anzahl der sichtbaren <SfxViewFrame>-Instanzen vom Typ - 'aType' bzw. aller sichtbaren, falls 'aType==0' (default). + Liefert die Anzahl der sichtbaren <SfxViewFrame>-Instanzen. */ { @@ -1797,8 +1529,7 @@ sal_uInt16 SfxViewFrame::Count(TypeId aType) for ( sal_uInt16 i = 0; i < nCount; ++i ) { SfxViewFrame *pFrame = rFrames[i]; - if ( ( !aType || pFrame->IsA(aType) ) && - pFrame->IsVisible() ) + if ( pFrame->IsVisible() ) ++nFound; } return nFound; @@ -1809,7 +1540,6 @@ sal_uInt16 SfxViewFrame::Count(TypeId aType) SfxViewFrame* SfxViewFrame::GetFirst ( const SfxObjectShell* pDoc, - TypeId aType, sal_Bool bOnlyIfVisible ) { @@ -1820,9 +1550,9 @@ SfxViewFrame* SfxViewFrame::GetFirst for ( sal_uInt16 nPos = 0; nPos < rFrames.Count(); ++nPos ) { SfxViewFrame *pFrame = rFrames.GetObject(nPos); - if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) && - ( !aType || pFrame->IsA(aType) ) && - ( !bOnlyIfVisible || pFrame->IsVisible()) ) + if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) + && ( !bOnlyIfVisible || pFrame->IsVisible() ) + ) return pFrame; } @@ -1835,7 +1565,6 @@ SfxViewFrame* SfxViewFrame::GetNext ( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc, - TypeId aType, sal_Bool bOnlyIfVisible ) { @@ -1852,9 +1581,9 @@ SfxViewFrame* SfxViewFrame::GetNext for ( ++nPos; nPos < rFrames.Count(); ++nPos ) { SfxViewFrame *pFrame = rFrames.GetObject(nPos); - if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) && - ( !aType || pFrame->IsA(aType) ) && - ( !bOnlyIfVisible || pFrame->IsVisible()) ) + if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) + && ( !bOnlyIfVisible || pFrame->IsVisible() ) + ) return pFrame; } return 0; @@ -1887,7 +1616,7 @@ void SfxViewFrame::ShowStatusText( const String& /*rText*/) /* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); if ( pMgr ) { @@ -1903,7 +1632,7 @@ void SfxViewFrame::HideStatusText() /* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); if ( pMgr ) pMgr->GetStatusBar()->ShowItems(); @@ -1978,7 +1707,7 @@ void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) SfxShell::SetViewShell_Impl( pVSh ); // Hack: InPlaceMode - if ( pVSh && !pVSh->UseObjectSize() ) + if ( pVSh ) pImp->bResizeInToOut = sal_False; } @@ -1988,21 +1717,10 @@ void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) Der ParentViewFrame ist der ViewFrame des Containers bei internem InPlace */ -void SfxViewFrame::SetParentViewFrame_Impl(SfxViewFrame *pFrame) -{ - pImp->pParentViewFrame = pFrame; -} - -//-------------------------------------------------------------------- -/* - Beschreibung: - Der ParentViewFrame ist der ViewFrame des Containers bei internem InPlace -*/ - //TODO/LATER: is it still necessary? is there a replacement for GetParentViewFrame_Impl? SfxViewFrame* SfxViewFrame::GetParentViewFrame_Impl() const { - return pImp->pParentViewFrame; + return NULL; } //-------------------------------------------------------------------- @@ -2027,7 +1745,7 @@ void SfxViewFrame::DoAdjustPosSize( SfxViewShell *pSh, const Point rPos, const Size &rSize ) { DBG_CHKTHIS(SfxViewFrame, 0); - if( pSh && !nAdjustPosPixelLock && pSh->UseObjectSize()) + if( pSh && !nAdjustPosPixelLock ) { Window *pWindow = pSh->GetWindow(); Point aPos = pWindow->LogicToPixel(rPos); @@ -2060,7 +1778,7 @@ void SfxViewFrame::Enable( sal_Bool bEnable ) } else { - Window *pWindow = &GetFrame()->GetTopFrame()->GetWindow(); + Window *pWindow = &GetFrame().GetTopFrame().GetWindow(); if ( !bEnable ) pImp->bWindowWasEnabled = pWindow->IsInputEnabled(); if ( !bEnable || pImp->bWindowWasEnabled ) @@ -2110,7 +1828,7 @@ void SfxViewFrame::Show() LockObjectShell_Impl( sal_True ); // Doc-Shell Titel-Nummer anpassen, get unique view-no - if ( 0 == pImp->nDocViewNo && !(GetFrameType() & SFXFRAME_PLUGIN ) ) + if ( 0 == pImp->nDocViewNo ) { GetDocNumber_Impl(); UpdateTitle(); @@ -2121,12 +1839,12 @@ void SfxViewFrame::Show() // Frame-Window anzeigen, aber nur wenn der ViewFrame kein eigenes Window // hat oder wenn er keine Component enth"alt - if ( &GetWindow() == &GetFrame()->GetWindow() || !GetFrame()->HasComponent() ) + if ( &GetWindow() == &GetFrame().GetWindow() || !GetFrame().HasComponent() ) GetWindow().Show(); - GetFrame()->GetWindow().Show(); + GetFrame().GetWindow().Show(); /* SfxViewFrame* pCurrent = SfxViewFrame::Current(); - if ( GetFrame()->GetFrameInterface()->isActive() && + if ( GetFrame().GetFrameInterface()->isActive() && pCurrent != this && ( !pCurrent || pCurrent->GetParentViewFrame_Impl() != this ) && !GetActiveChildFrame_Impl() ) @@ -2141,8 +1859,6 @@ void SfxViewFrame::Show() //-------------------------------------------------------------------- sal_Bool SfxViewFrame::IsVisible() const { - //Window *pWin = pImp->bInCtor ? 0 : &GetWindow(); - //return GetFrame()->HasComponent() || pImp->bObjLocked || ( pWin && pWin->IsVisible() ); return pImp->bObjLocked; } @@ -2167,7 +1883,7 @@ void SfxViewFrame::LockObjectShell_Impl( sal_Bool bLock ) //-------------------------------------------------------------------- void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) { - if ( GetViewShell() && !GetFrame()->IsClosing_Impl() ) + if ( GetViewShell() && !GetFrame().IsClosing_Impl() ) { if ( IsVisible() ) { @@ -2186,7 +1902,7 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) } SfxViewFrame* pCurrent = SfxViewFrame::Current(); - css::uno::Reference< css::frame::XFrame > xFrame = GetFrame()->GetFrameInterface(); + css::uno::Reference< css::frame::XFrame > xFrame = GetFrame().GetFrameInterface(); if ( !bPreview ) { SetViewFrame( this ); @@ -2202,7 +1918,7 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) SfxInPlaceClient *pCli = GetViewShell()->GetUIActiveClient(); if ( ( !pCli || !pCli->IsObjectUIActive() ) && ( !pCurrent || pCurrent->GetParentViewFrame_Impl() != this ) ) - GetFrame()->GrabFocusOnComponent_Impl(); + GetFrame().GrabFocusOnComponent_Impl(); } } else @@ -2216,89 +1932,6 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) } } -//-------------------------------------------------------------------- - -SfxViewShell* SfxViewFrame::CreateView_Impl( sal_uInt16 nViewId ) - -/* [Beschreibung] - - Erzeugt eine SfxViewShell f"ur diesen SfxViewFrame. Wird auch aus - <SfxObjectShell::LoadWindows_Impl()> - gerufen. -*/ - -{ - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); - - LockAdjustPosSizePixel(); - - // passende ::com::sun::star::sdbcx::View-Factory suchen - SfxObjectFactory &rDocFact = GetObjectShell()->GetFactory(); - sal_uInt16 nNewNo = nViewId ? USHRT_MAX : 0; - for ( sal_uInt16 nNo = 0; - nNo < rDocFact.GetViewFactoryCount(); - ++nNo ) - { - sal_uInt16 nFoundId = rDocFact.GetViewFactory(nNo).GetOrdinal(); - if ( nNewNo == USHRT_MAX ) - { - if ( nViewId == nFoundId ) - nNewNo = nNo; - } - } - - // per Factory erzeugen - GetBindings().ENTERREGISTRATIONS(); - SfxViewFactory &rViewFactory = rDocFact.GetViewFactory( nNewNo ); - SfxViewShell *pViewShell = rViewFactory.CreateInstance(this, 0); - SetViewShell_Impl(pViewShell); - UnlockAdjustPosSizePixel(); - - if ( GetWindow().IsReallyVisible() ) - DoAdjustPosSizePixel(pViewShell, Point(), GetWindow().GetOutputSizePixel()); - - // erste jetzt anzeigen (ausser wenn MTs BASIC-IDE mal wieder keins hat) - Window *pViewWin = pViewShell->GetWindow(); - if ( pViewWin && pViewShell->IsShowView_Impl() ) - pViewWin->Show(); - - // Dispatcher - GetDispatcher()->Push( *pViewShell ); - if ( pViewShell->GetSubShell() ) - GetDispatcher()->Push( *pViewShell->GetSubShell() ); - pViewShell->PushSubShells_Impl(); - -#if defined SFX_HINT_VIEWCREATED - GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_VIEWCREATED ) ); -#endif - - GetBindings().LEAVEREGISTRATIONS(); - - DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); - return pViewShell; -} - -//------------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::SearchViewFrame( SfxViewFrame *pViewFrame, - const String& rName ) -{ - if ( !pViewFrame ) - pViewFrame = SfxViewFrame::Current(); - if ( !pViewFrame ) - return NULL; - SfxFrame *pFrame = pViewFrame->GetFrame()->SearchFrame( rName ); - if ( !pFrame ) - return NULL; - - // Der Frame ist selbst ein ViewFrame oder enth"alt einen -/* - pViewFrame = PTR_CAST( SfxViewFrame, pFrame ); - if ( !pViewFrame && pFrame->GetChildFrameCount() ) - pViewFrame = PTR_CAST( SfxViewFrame, pFrame->GetChildFrame(0) ); -*/ - return pFrame->GetCurrentViewFrame(); -} - //------------------------------------------------------------------------- void SfxViewFrame::SetQuietMode_Impl( sal_Bool bOn ) @@ -2313,11 +1946,6 @@ SfxObjectShell* SfxViewFrame::GetObjectShell() return xObjSh; } -void SfxViewFrame::SetMargin_Impl( const Size& rMargin ) -{ - pImp->aMargin = rMargin; -} - const Size& SfxViewFrame::GetMargin_Impl() const { return pImp->aMargin; @@ -2332,10 +1960,10 @@ void SfxViewFrame::SetActiveChildFrame_Impl( SfxViewFrame *pViewFrame ) pImp->pActiveChild = pViewFrame; - Reference< XFramesSupplier > xFrame( GetFrame()->GetFrameInterface(), UNO_QUERY ); + Reference< XFramesSupplier > xFrame( GetFrame().GetFrameInterface(), UNO_QUERY ); Reference< XFrame > xActive; if ( pViewFrame ) - xActive = pViewFrame->GetFrame()->GetFrameInterface(); + xActive = pViewFrame->GetFrame().GetFrameInterface(); if ( xFrame.is() ) // PB: #74432# xFrame cann be NULL xFrame->setActiveFrame( xActive ); @@ -2364,20 +1992,181 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const } //-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, + const USHORT i_nViewId, const bool i_bHidden ) +{ + Reference< XFrame > xFrame( i_rFrame ); + bool bOwnFrame = false; + SfxViewShell* pSuccessView = NULL; + try + { + if ( !xFrame.is() ) + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + bOwnFrame = true; + } + + pSuccessView = LoadViewIntoFrame_Impl( + i_rDoc, + xFrame, + Sequence< PropertyValue >(), // means "reuse existing model's args" + i_nViewId, + i_bHidden + ); + + if ( bOwnFrame && !i_bHidden ) + { + // ensure the frame/window is visible + Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + xContainerWindow->setVisible( sal_True ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( pSuccessView ) + return pSuccessView->GetViewFrame(); + + if ( bOwnFrame ) + { + try + { + xFrame->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + return NULL; +} + +//-------------------------------------------------------------------- +SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, + const Sequence< PropertyValue >& i_rLoadArgs, const USHORT i_nViewId, + const bool i_bHidden ) +{ + Reference< XModel > xDocument( i_rDoc.GetModel(), UNO_SET_THROW ); + + ::comphelper::NamedValueCollection aTransformLoadArgs( i_rLoadArgs.getLength() ? i_rLoadArgs : xDocument->getArgs() ); + aTransformLoadArgs.put( "Model", xDocument ); + if ( i_nViewId ) + aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) ); + if ( i_bHidden ) + aTransformLoadArgs.put( "Hidden", i_bHidden ); + else + aTransformLoadArgs.remove( "Hidden" ); + + ::rtl::OUString sURL( xDocument->getURL() ); + if ( !sURL.getLength() ) + sURL = i_rDoc.GetFactory().GetFactoryURL(); + + Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, + aTransformLoadArgs.getPropertyValues() ); + + SfxViewShell* pViewShell = SfxViewShell::Get( i_rFrame->getController() ); + ENSURE_OR_THROW( pViewShell, + "SfxViewFrame::LoadViewIntoFrame_Impl: loading an SFX doc into a frame resulted in a non-SFX view - quite impossible" ); + return pViewShell; +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, true ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, false ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rTargetFrame, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, i_nViewId, false ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem && i_pFrameItem->GetFrame() ? i_pFrameItem->GetFrame()->GetFrameInterface() : NULL, i_nViewId, false ); +} + +//-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const USHORT i_nViewId ) +{ + SFX_REQUEST_ARG( i_rCreateDocRequest, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); + SFX_REQUEST_ARG( i_rCreateDocRequest, pHiddenItem, SfxBoolItem, SID_HIDDEN, FALSE ); + + return LoadViewIntoFrame_Impl_NoThrow( + i_rDoc, + pFrameItem ? pFrameItem->GetFrame() : NULL, + i_nViewId, + pHiddenItem ? pHiddenItem->GetValue() : false + ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, const SfxObjectShell* i_pDoc ) +{ + if ( !i_rController.is() ) + return NULL; + + const SfxObjectShell* pDoc = i_pDoc; + if ( !pDoc ) + { + Reference< XModel > xDocument( i_rController->getModel() ); + for ( pDoc = SfxObjectShell::GetFirst( 0, false ); + pDoc; + pDoc = SfxObjectShell::GetNext( *pDoc, 0, false ) + ) + { + if ( pDoc->GetModel() == xDocument ) + break; + } + } + + SfxViewFrame* pViewFrame = NULL; + for ( pViewFrame = SfxViewFrame::GetFirst( pDoc, FALSE ); + pViewFrame; + pViewFrame = SfxViewFrame::GetNext( *pViewFrame, pDoc, FALSE ) + ) + { + if ( pViewFrame->GetViewShell()->GetController() == i_rController ) + break; + } + + return pViewFrame; +} + +//-------------------------------------------------------------------- sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( - sal_uInt16 nViewId, /* > 0 - Registrierungs-Id der ::com::sun::star::sdbcx::View, auf die umge- + sal_uInt16 nViewIdOrNo, /* > 0 + Registrierungs-Id der View, auf die umge- schaltet werden soll, bzw. die erstmalig erzeugt werden soll. == 0 - Es soll die Default-::com::sun::star::sdbcx::View verwendet werden. */ + Es soll die Default-View verwendet werden. */ sal_Bool bIsIndex /* sal_True - 'nViewId' ist keine Registrations-Id sondern - ein ::com::sun::star::sdbcx::Index in die f"ur die in diesem + 'nViewIdOrNo' ist keine Registrations-Id sondern + ein Index in die f"ur die in diesem <SfxViewFrame> dargestellte <SfxObjectShell>. */ ) @@ -2403,174 +2192,64 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl */ { - try{ - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); - - SfxObjectFactory &rDocFact = GetObjectShell()->GetFactory(); - - // find index of old and new ViewShell - sal_uInt16 nOldNo = USHRT_MAX, nNewNo = USHRT_MAX; - bIsIndex |= 0 == nViewId; - for ( sal_uInt16 nNo = 0; nNo < rDocFact.GetViewFactoryCount(); ++nNo ) - { - sal_uInt16 nFoundId = rDocFact.GetViewFactory(nNo).GetOrdinal(); - if ( nNewNo == USHRT_MAX ) - { - if ( bIsIndex && nViewId == nNo ) - { - nNewNo = nNo; - nViewId = nFoundId; // for nViewId == 0 - } - else if ( !bIsIndex && nViewId == nFoundId ) - nNewNo = nNo; - } - if ( pImp->nCurViewId == nFoundId ) - nOldNo = nNo; - } - - if ( nNewNo == USHRT_MAX ) - { - // unknown ID -> fall back to default - sal_uInt16 nFoundId = rDocFact.GetViewFactory(0).GetOrdinal(); - nNewNo = 0; - nViewId = nFoundId; - if ( pImp->nCurViewId == nFoundId ) - nOldNo = 0; - } - - SfxViewShell *pSh = GetViewShell(); - - DBG_ASSERT( !pSh || nOldNo != USHRT_MAX, "old shell id not found" ); - - // does a ViewShell exist already? - SfxViewShell *pOldSh = pSh; - if ( pOldSh ) + try { - // ask wether it can be closed - if ( !pOldSh->PrepareClose() ) - return sal_False; + ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); - // remove SubShells from Dispatcher before switching to new ViewShell - pOldSh->PushSubShells_Impl( sal_False ); - sal_uInt16 nLevel = pDispatcher->GetShellLevel( *pOldSh ); - if ( nLevel ) + // if we already have a view shell, remove it + SfxViewShell* pOldSh = GetViewShell(); + OSL_PRECOND( pOldSh, "SfxViewFrame::SwitchToViewShell_Impl: that's called *switch* (not for *initial-load*) for a reason" ); + if ( pOldSh ) { - SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); - if ( pSubShell == pOldSh->GetSubShell() ) - //"real" SubShells are not deleted - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); - else - // SubShells only known to Dispatcher must be deleted - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); - } - - pDispatcher->Pop( *pOldSh ); - GetBindings().Invalidate( nOldNo + SID_VIEWSHELL0 ); - } - - // remember ViewID - pImp->nCurViewId = nViewId; - GetBindings().Invalidate( nNewNo + SID_VIEWSHELL0 ); - - // create new ViewShell - SfxViewFactory &rViewFactory = rDocFact.GetViewFactory( nNewNo ); - LockAdjustPosSizePixel(); - - GetBindings().ENTERREGISTRATIONS(); - pSh = rViewFactory.CreateInstance(this, pOldSh); - - Window *pEditWin = pSh->GetWindow(); - DBG_ASSERT( !pEditWin || !pEditWin->IsReallyVisible(), "don`t show your ViewShell`s Window by yourself!" ); + // ask wether it can be closed + if ( !pOldSh->PrepareClose( TRUE ) ) + return sal_False; - // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also - GetDispatcher()->SetDisableFlags( 0 ); - SetViewShell_Impl(pSh); - - Reference < ::com::sun::star::awt::XWindow > xWindow( - GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY ); - Reference < XFrame > xFrame( GetFrame()->GetFrameInterface() ); - if ( !pSh->GetController().is() ) - pSh->SetController( new SfxBaseController( pSh ) ); - Reference < XController > xController( pSh->GetController() ); - xFrame->setComponent( xWindow, xController ); - - xController->attachFrame( xFrame ); - Reference < XModel > xModel( GetObjectShell()->GetModel() ); - if ( xModel.is() ) - { - xController->attachModel( xModel ); - xModel->connectController( xController ); - xModel->setCurrentController( xController ); - } - - GetDispatcher()->Push( *pSh ); - if ( pSh->GetSubShell() ) - GetDispatcher()->Push( *pSh->GetSubShell() ); - pSh->PushSubShells_Impl(); - GetDispatcher()->Flush(); - - if ( pImp->bRestoreView && pImp->aViewData.Len() ) - { - // restore view data if required - pSh->ReadUserData( pImp->aViewData, sal_True ); - pImp->bRestoreView = sal_False; - } + // remove sub shells from Dispatcher before switching to new ViewShell + PopShellAndSubShells_Impl( *pOldSh ); + } - // create UI elements before size is set - if ( SfxViewFrame::Current() == this ) - GetDispatcher()->Update_Impl( sal_True ); + GetBindings().ENTERREGISTRATIONS(); + LockAdjustPosSizePixel(); - // allow resize events to be processed - UnlockAdjustPosSizePixel(); + // ID of the new view + SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); + const USHORT nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; - Window* pFrameWin = &GetWindow(); - if ( pFrameWin != &GetFrame()->GetWindow() ) - pFrameWin->Show(); + // create and load new ViewShell + SfxViewShell* pNewSh = LoadViewIntoFrame_Impl( + *GetObjectShell(), + GetFrame().GetFrameInterface(), + Sequence< PropertyValue >(), // means "reuse existing model's args" + nViewId, + false + ); - if ( GetWindow().IsReallyVisible() ) - DoAdjustPosSizePixel( pSh, Point(), GetWindow().GetOutputSizePixel() ); + // allow resize events to be processed + UnlockAdjustPosSizePixel(); - if ( pEditWin && pSh->IsShowView_Impl() ) - pEditWin->Show(); + if ( GetWindow().IsReallyVisible() ) + DoAdjustPosSizePixel( pNewSh, Point(), GetWindow().GetOutputSizePixel() ); - GetBindings().LEAVEREGISTRATIONS(); - delete pOldSh; + GetBindings().LEAVEREGISTRATIONS(); + delete pOldSh; } - catch ( com::sun::star::uno::Exception& ) + catch ( const com::sun::star::uno::Exception& ) { // the SfxCode is not able to cope with exceptions thrown while creating views // the code will crash in the stack unwinding procedure, so we shouldn't let exceptions go through here - DBG_ERROR("Exception in SwitchToViewShell_Impl - urgent issue. Please contact development!"); + DBG_UNHANDLED_EXCEPTION(); + return sal_False; } DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); return sal_True; } -//-------------------------------------------------------------------- - -void SfxViewFrame::SetViewData_Impl( sal_uInt16 nViewId, const String &rViewData ) -{ - pImp->bRestoreView = sal_True; - pImp->nCurViewId = nViewId; - pImp->aViewData = rViewData; -} //------------------------------------------------------------------------- -String& SfxViewFrame::GetViewData_Impl() +void SfxViewFrame::SetCurViewId_Impl( const USHORT i_nID ) { - return pImp->aViewData; -} - -//------------------------------------------------------------------------- -sal_Bool SfxViewFrame::IsRestoreView_Impl() const -{ - return pImp->bRestoreView; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetRestoreView_Impl( sal_Bool bOn ) -{ - pImp->bRestoreView = bOn; + pImp->nCurViewId = i_nID; } //------------------------------------------------------------------------- @@ -2608,58 +2287,17 @@ void SfxViewFrame::ExecView_Impl break; } - case SID_FILLFRAME: - { - // Bei Mail etc. k"onnen die Frames nicht angesprochen werden - SfxFrame *pParent = GetFrame()->GetParentFrame(); - if ( pParent && pParent->GetCurrentViewFrame()-> - GetViewShell()->IsImplementedAsFrameset_Impl() ) - break; - - SfxViewFrame *pRet = NULL; - SFX_REQUEST_ARG( - rReq, pItem, SfxStringItem, SID_FILLFRAME, sal_False ); - if ( pItem ) - { - String aName( pItem->GetValue() ); - sal_uInt16 nFrame = (sal_uInt16) aName.ToInt32(); - if ( nFrame == 0 ) - nFrame = USHRT_MAX; - - SfxFrameIterator aIter( *GetFrame(), sal_False ); - SfxFrame *pFrame = aIter.FirstFrame(); - sal_uInt16 nActFrame = 1; - while ( pFrame ) - { - SfxViewFrame *pView = pFrame->GetCurrentViewFrame(); - if ( - nActFrame == nFrame || - ( - pView && - aName.CompareIgnoreCaseToAscii( pView->SfxShell::GetName() ) == COMPARE_EQUAL - ) - ) - { - pRet = pView; - break; - } - - pFrame = aIter.NextFrame( *pFrame ); - nActFrame++; - } - } - - rReq.SetReturnValue( SfxObjectItem( SID_DOCFRAME, pRet ) ); - break; - } - case SID_VIEWSHELL: { const SfxPoolItem *pItem = 0; - if ( rReq.GetArgs() && - SFX_ITEM_SET == rReq.GetArgs()->GetItemState( SID_VIEWSHELL, sal_False, &pItem ) ) - rReq.SetReturnValue( SfxBoolItem(0, SwitchToViewShell_Impl( - (sal_uInt16)((const SfxUInt16Item*) pItem)->GetValue()) )); + if ( rReq.GetArgs() + && SFX_ITEM_SET == rReq.GetArgs()->GetItemState( SID_VIEWSHELL, sal_False, &pItem ) + ) + { + const sal_uInt16 nViewId = static_cast< const SfxUInt16Item* >( pItem )->GetValue(); + BOOL bSuccess = SwitchToViewShell_Impl( nViewId ); + rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) ); + } break; } @@ -2669,86 +2307,40 @@ void SfxViewFrame::ExecView_Impl case SID_VIEWSHELL3: case SID_VIEWSHELL4: { - rReq.SetReturnValue( SfxBoolItem(0, - SwitchToViewShell_Impl( rReq.GetSlot() - SID_VIEWSHELL0, sal_True ) ) ); + const sal_uInt16 nViewNo = rReq.GetSlot() - SID_VIEWSHELL0; + BOOL bSuccess = SwitchToViewShell_Impl( nViewNo, sal_True ); + rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) ); break; } case SID_NEWWINDOW: { // Hack. demnaechst virtuelle Funktion - if ( !GetViewShell()->NewWindowAllowed() && !GetObjectShell()->HasName() ) - return; - - // ViewData bei FrameSets rekursiv holen - GetFrame()->GetViewData_Impl(); - SfxMedium *pMed = GetObjectShell()->GetMedium(); - String aUserData; - GetViewShell()->WriteUserData( aUserData, sal_True ); if ( !GetViewShell()->NewWindowAllowed() ) { - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); - SfxFrame *pFrame = NULL; - Reference < XFrame > xFrame; - if ( pFrameItem ) - { - pFrameItem->GetValue() >>= xFrame; - pFrame = SfxTopFrame::Create( xFrame ); - } - else - pFrame = SfxTopFrame::Create(); - - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - SFX_REQUEST_ARG( rReq, pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( pHiddenItem ) - aSet.Put( *pHiddenItem ); - - SFX_ITEMSET_ARG( pMed->GetItemSet(), pRefererItem, SfxStringItem, SID_REFERER, sal_False ); - SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE( "private:user" ) ); - if ( !pRefererItem ) - pRefererItem = &aReferer; - - aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) ); - aSet.Put( SfxStringItem( SID_USER_DATA, aUserData ) ); - aSet.Put( SfxUInt16Item( SID_VIEW_ID, GetCurViewId() ) ); - aSet.Put( *pRefererItem ); - if( pMed->GetFilter() ) - aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName()) ); - aSet.Put( SfxFrameItem ( SID_DOCFRAME, pFrame ) ); - if ( xFrame.is() ) - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, aSet ); - else - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); - } - else - { - pMed->GetItemSet()->Put( SfxStringItem( SID_USER_DATA, aUserData ) ); - - BOOL bHidden = FALSE; - SFX_REQUEST_ARG( rReq, pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( pHiddenItem ) - bHidden = pHiddenItem->GetValue(); - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); - if ( pFrameItem ) - { - Reference < XFrame > xFrame; - pFrameItem->GetValue() >>= xFrame; - SfxFrame* pFrame = SfxTopFrame::Create( xFrame ); - pMed->GetItemSet()->ClearItem( SID_HIDDEN ); - pFrame->InsertDocument( GetObjectShell() ); - if ( !bHidden ) - xFrame->getContainerWindow()->setVisible( sal_True ); - } - else - { - SfxAllItemSet aSet( GetPool() ); - aSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, TRUE ) ); - SfxFrame* pFrame = SfxTopFrame::Create( GetObjectShell(), GetCurViewId(), bHidden, &aSet ); - if ( bHidden ) - pFrame->GetCurrentViewFrame()->LockObjectShell_Impl( TRUE ); - } + OSL_ENSURE( false, "You should have disabled the 'Window/New Window' slot!" ); + return; } + // ViewData bei FrameSets rekursiv holen + GetFrame().GetViewData_Impl(); + SfxMedium* pMed = GetObjectShell()->GetMedium(); + + // do not open the new window hidden + pMed->GetItemSet()->ClearItem( SID_HIDDEN ); + + // the view ID (optional arg. TODO: this is currently not supported in the slot definition ...) + SFX_REQUEST_ARG( rReq, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); + const USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : GetCurViewId(); + + Reference < XFrame > xFrame; + // the frame (optional arg. TODO: this is currently not supported in the slot definition ...) + SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False ); + if ( pFrameItem ) + xFrame = pFrameItem->GetFrame(); + + LoadViewIntoFrame_Impl_NoThrow( *GetObjectShell(), xFrame, nViewId, false ); + rReq.Done(); break; } @@ -2912,13 +2504,10 @@ void SfxViewFrame::StateView_Impl case SID_NEWWINDOW: { - if ( !GetViewShell()->NewWindowAllowed() /* && !pDocSh->HasName() */ ) - rSet.DisableItem( nWhich ); - else - { - if (impl_maxOpenDocCountReached()) - rSet.DisableItem( nWhich ); - } + if ( !GetViewShell()->NewWindowAllowed() + || impl_maxOpenDocCountReached() + ) + rSet.DisableItem( nWhich ); break; } } @@ -2927,22 +2516,9 @@ void SfxViewFrame::StateView_Impl } //------------------------------------------------------------------------- -void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) -{ - if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) - { - uno::Any aAny; - aAny <<= GetViewShell()->GetVerbs(); - rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); - } - else - rSet.DisableItem( SID_OBJECT ); -} - -//------------------------------------------------------------------------- void SfxViewFrame::ToTop() { - GetFrame()->Appear(); + GetFrame().Appear(); } //------------------------------------------------------------------------- @@ -2952,66 +2528,41 @@ SfxViewFrame* SfxViewFrame::GetParentViewFrame() const Der ParentViewFrame ist der ViewFrame des ParentFrames */ { - SfxFrame *pFrame = GetFrame()->GetParentFrame(); + SfxFrame *pFrame = GetFrame().GetParentFrame(); return pFrame ? pFrame->GetCurrentViewFrame() : NULL; } //------------------------------------------------------------------------- -SfxFrame* SfxViewFrame::GetFrame() const +SfxFrame& SfxViewFrame::GetFrame() const /* Beschreibung: GetFrame liefert den Frame, in dem sich der ViewFrame befindet */ { - return pImp->pFrame; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetFrame_Impl( SfxFrame *pFrame ) -{ - pImp->pFrame = pFrame; + return pImp->rFrame; } //------------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::GetTopViewFrame() const { - return GetFrame()->GetTopFrame()->GetCurrentViewFrame(); -} - -//------------------------------------------------------------------------- - -SfxCancelManager *SfxViewFrame::GetCancelManager() const - -/* <H3>Description</H3> - - Returns a pointer to the <SfxCancelManager> of the top-view-frame of - this view-frame. -*/ - -{ - return GetTopViewFrame()->GetFrame()->GetCancelManager(); -} - -void SfxViewFrame::SetWindow_Impl( Window *pWin ) -{ - pImp->pWindow = pWin; + return GetFrame().GetTopFrame().GetCurrentViewFrame(); } Window& SfxViewFrame::GetWindow() const { - return pImp->pWindow ? *pImp->pWindow : GetFrame()->GetWindow(); + return pImp->pWindow ? *pImp->pWindow : GetFrame().GetWindow(); } sal_Bool SfxViewFrame::DoClose() { - return GetFrame()->DoClose(); + return GetFrame().DoClose(); } String SfxViewFrame::GetActualPresentationURL_Impl() const { if ( xObjSh.Is() ) return xObjSh->GetMedium()->GetName(); - return pImp->aActualPresentationURL; + return String(); } void SfxViewFrame::SetModalMode( sal_Bool bModal ) @@ -3028,7 +2579,7 @@ void SfxViewFrame::SetModalMode( sal_Bool bModal ) BOOL SfxViewFrame::IsInModalMode() const { - return pImp->bModal || GetFrame()->GetWindow().IsInModalMode(); + return pImp->bModal || GetFrame().GetWindow().IsInModalMode(); } void SfxViewFrame::Resize( BOOL bForce ) @@ -3040,18 +2591,14 @@ void SfxViewFrame::Resize( BOOL bForce ) SfxViewShell *pShell = GetViewShell(); if ( pShell ) { - if ( GetFrame()->IsInPlace() ) + if ( GetFrame().IsInPlace() ) { Point aPoint = GetWindow().GetPosPixel(); DoAdjustPosSizePixel( pShell, aPoint, aSize ); } else { - if ( pShell->UseObjectSize() ) - ForceOuterResize_Impl(TRUE); DoAdjustPosSizePixel( pShell, Point(), aSize ); - if ( pShell->UseObjectSize() ) - ForceOuterResize_Impl(FALSE); } } } @@ -3324,7 +2871,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) // try to find any active recorder on this frame ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet(xFrame,com::sun::star::uno::UNO_QUERY); @@ -3389,7 +2936,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_TOGGLESTATUSBAR: { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -3436,14 +2983,14 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_WIN_FULLSCREEN: { SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), FALSE); - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); + SfxViewFrame *pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); if ( pWork ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< ::com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -3478,7 +3025,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) } pWork->ShowFullScreenMode( bNewFullScreenMode ); pWork->SetMenuBarMode( bNewFullScreenMode ? MENUBAR_MODE_HIDE : MENUBAR_MODE_NORMAL ); - GetFrame()->GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode ); + GetFrame().GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode ); if ( !pItem ) rReq.AppendItem( SfxBoolItem( SID_WIN_FULLSCREEN, bNewFullScreenMode ) ); rReq.Done(); @@ -3532,7 +3079,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue(sProperty); @@ -3555,7 +3102,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue(sProperty); @@ -3569,7 +3116,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )) ); @@ -3587,10 +3134,10 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_WIN_FULLSCREEN: { - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); + SfxViewFrame* pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); if ( pWork ) { rSet.Put( SfxBoolItem( nWhich, pWork->IsFullScreenMode() ) ); @@ -3639,7 +3186,7 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) { if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE)) return; - Reference < XFrame > xFrame = GetFrame()->GetTopFrame()->GetFrameInterface(); + Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface(); Reference < XFrame > xBeamer( xFrame->findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ) ); BOOL bShow = FALSE; BOOL bHasChild = xBeamer.is(); @@ -3740,7 +3287,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) } else if ( nSID == SID_BROWSER ) { - Reference < XFrame > xFrame = GetFrame()->GetTopFrame()->GetFrameInterface()-> + Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface()-> findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ); if ( !xFrame.is() ) rState.DisableItem( nSID ); @@ -3758,7 +3305,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) SfxWorkWindow* SfxViewFrame::GetWorkWindow_Impl( USHORT /*nId*/ ) { SfxWorkWindow* pWork = 0; - pWork = GetFrame()->GetWorkWindow_Impl(); + pWork = GetFrame().GetWorkWindow_Impl(); return pWork; } @@ -3820,11 +3367,6 @@ SfxChildWindow* SfxViewFrame::GetChildWindow(USHORT nId) return pWork ? pWork->GetChildWindow_Impl(nId) : NULL; } -SfxMacro* SfxViewFrame::GetRecordingMacro_Impl() -{ - return pImp->pMacro; -} - void SfxViewFrame::UpdateDocument_Impl() { SfxObjectShell* pDoc = GetObjectShell(); @@ -3835,29 +3377,6 @@ void SfxViewFrame::UpdateDocument_Impl() pDoc->UpdateFromTemplate_Impl(); } -BOOL SfxViewFrame::ClearEventFlag_Impl() -{ - if ( pImp->bEventFlag ) - { - pImp->bEventFlag = FALSE; - return TRUE; - } - else - return FALSE; -} - -SfxViewFrame* SfxViewFrame::CreateViewFrame( SfxObjectShell& rDoc, sal_uInt16 nViewId, sal_Bool bHidden ) -{ - SfxItemSet *pSet = rDoc.GetMedium()->GetItemSet(); - if ( nViewId ) - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - if ( bHidden ) - pSet->Put( SfxBoolItem( SID_HIDDEN, sal_True ) ); - - SfxFrame *pFrame = SfxTopFrame::Create( &rDoc, 0, bHidden ); - return pFrame->GetCurrentViewFrame(); -} - void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) { SFX_APP()->SetViewFrame_Impl( pFrame ); diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx new file mode 100644 index 000000000000..480b5307df2e --- /dev/null +++ b/sfx2/source/view/viewfrm2.cxx @@ -0,0 +1,523 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "impviewframe.hxx" +#include "statcach.hxx" +#include "viewfac.hxx" +#include "workwin.hxx" + +#include "sfx2/app.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/ctrlitem.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/objitem.hxx" +#include "sfx2/objsh.hxx" +#include "sfx2/request.hxx" +#include "sfx2/viewfrm.hxx" +#include "sfx2/viewsh.hxx" + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/XMaterialHolder.hpp> +#include <com/sun/star/util/XCloseable.hpp> + +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/processfactory.hxx> +#include <svtools/asynclink.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/rectitem.hxx> +#include <svl/stritem.hxx> +#include <tools/diagnose_ex.h> +#include <tools/urlobj.hxx> +#include <unotools/bootstrap.hxx> +#include <unotools/configmgr.hxx> +#include <vcl/window.hxx> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::lang::XComponent; + +//------------------------------------------------------------------------ + +static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) +{ + uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY ); + ::rtl::OUString sVar; + if ( !xMM.is() ) + return sVar; + + try + { + ::comphelper::NamedValueCollection aAnalyzer( xMM->getByName( sDocService ) ); + sVar = aAnalyzer.getOrDefault( "ooSetupFactoryUIName", ::rtl::OUString() ); + } + catch( uno::Exception& ) + { + sVar = ::rtl::OUString(); + } + + return sVar; +} + +//-------------------------------------------------------------------- +void SfxFrameViewWindow_Impl::StateChanged( StateChangedType nStateChange ) +{ + if ( nStateChange == STATE_CHANGE_INITSHOW ) + { + SfxObjectShell* pDoc = pFrame->GetObjectShell(); + if ( pDoc && !pFrame->IsVisible() ) + pFrame->Show(); + + pFrame->Resize(); + } + else + Window::StateChanged( nStateChange ); +} + +void SfxFrameViewWindow_Impl::Resize() +{ + if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) + pFrame->Resize(); +} + +static String _getTabString() +{ + String result; + + Reference < XMaterialHolder > xHolder( + ::comphelper::getProcessServiceFactory()->createInstance( + DEFINE_CONST_UNICODE("com.sun.star.tab.tabreg") ), UNO_QUERY ); + if (xHolder.is()) + { + rtl::OUString aTabString; + Sequence< NamedValue > sMaterial; + if (xHolder->getMaterial() >>= sMaterial) { + for (int i=0; i < sMaterial.getLength(); i++) { + if ((sMaterial[i].Name.equalsAscii("title")) && + (sMaterial[i].Value >>= aTabString)) + { + result += ' '; + result += String(aTabString); + } + } + } + } + return result; +} + +//======================================================================== + +//-------------------------------------------------------------------- +String SfxViewFrame::UpdateTitle() + +/* [Beschreibung] + + Mit dieser Methode kann der SfxViewFrame gezwungen werden, sich sofort + den neuen Titel vom der <SfxObjectShell> zu besorgen. + + [Anmerkung] + + Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener + zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren + m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames) + jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung + nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. + + + [Beispiel] + + void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) + { + if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + { + switch( ( (SfxSimpleHint&) rHint ).GetId() ) + { + case SFX_HINT_TITLECHANGED: + for ( SfxViewFrame *pTop = SfxViewFrame::GetFirst( this ); + pTop; + pTop = SfxViewFrame::GetNext( this ); + { + pTop->UpdateTitle(); + ... pTop->GetName() ... + } + break; + ... + } + } + } +*/ + +{ + DBG_CHKTHIS(SfxViewFrame, 0); + + const SfxObjectFactory &rFact = GetObjectShell()->GetFactory(); + pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() ); + + SfxObjectShell *pObjSh = GetObjectShell(); + if ( !pObjSh ) + return String(); + +// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +// // kein UpdateTitle mit Embedded-ObjectShell +// return String(); + + const SfxMedium *pMedium = pObjSh->GetMedium(); + String aURL; + GetFrame(); // -Wall required?? + if ( pObjSh->HasName() ) + { + INetURLObject aTmp( pMedium->GetName() ); + aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + } + + if ( aURL != pImp->aActualURL ) + // URL hat sich ge"andert + pImp->aActualURL = aURL; + + // gibt es noch eine weitere View? + sal_uInt16 nViews=0; + for ( SfxViewFrame *pView= GetFirst(pObjSh); + pView && nViews<2; + pView = GetNext(*pView,pObjSh) ) + if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && + !IsDowning_Impl()) + nViews++; + + // Titel des Fensters + String aTitle; + if ( nViews == 2 || pImp->nDocViewNo > 1 ) + // dann die Nummer dranh"angen + aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); + else + aTitle = pObjSh->UpdateTitle(); + + // Name des SbxObjects + String aSbxName = pObjSh->SfxShell::GetName(); + if ( IsVisible() ) + { + aSbxName += ':'; + aSbxName += String::CreateFromInt32(pImp->nDocViewNo); + } + + SetName( aSbxName ); + pImp->aFrameTitle = aTitle; + GetBindings().Invalidate( SID_FRAMETITLE ); + GetBindings().Invalidate( SID_CURRENT_URL ); + + ::rtl::OUString aProductName; + ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; + + aTitle += String::CreateFromAscii( " - " ); + aTitle += String(aProductName); + aTitle += ' '; + ::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() ); + aTitle += String( GetModuleName_Impl( aDocServiceName ) ); +#ifdef DBG_UTIL + ::rtl::OUString aDefault; + aTitle += DEFINE_CONST_UNICODE(" ["); + String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); + aTitle += aVerId; + aTitle += ']'; +#endif + + // append TAB string if available + aTitle += _getTabString(); + + GetBindings().Invalidate( SID_NEWDOCDIRECT ); + + /* AS_TITLE + Window* pWindow = GetFrame()->GetTopWindow_Impl(); + if ( pWindow && pWindow->GetText() != aTitle ) + pWindow->SetText( aTitle ); + */ + return aTitle; +} + +void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) +{ + // Wenn gerade die Shells ausgetauscht werden... + if ( !GetObjectShell() || !GetViewShell() ) + return; + + switch ( rReq.GetSlot() ) + { + case SID_SHOWPOPUPS : + { + SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, SID_SHOWPOPUPS, FALSE); + BOOL bShow = pShowItem ? pShowItem->GetValue() : TRUE; + SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, FALSE); + USHORT nId = pIdItem ? pIdItem->GetValue() : 0; + + // ausfuehren + SfxWorkWindow *pWorkWin = GetFrame().GetWorkWindow_Impl(); + if ( bShow ) + { + // Zuerst die Floats auch anzeigbar machen + pWorkWin->MakeChildsVisible_Impl( bShow ); + GetDispatcher()->Update_Impl( TRUE ); + + // Dann anzeigen + GetBindings().HidePopups( !bShow ); + } + else + { + // Alles hiden + SfxBindings *pBind = &GetBindings(); + while ( pBind ) + { + pBind->HidePopupCtrls_Impl( !bShow ); + pBind = pBind->GetSubBindings_Impl(); + } + + pWorkWin->HidePopups_Impl( !bShow, TRUE, nId ); + pWorkWin->MakeChildsVisible_Impl( bShow ); + } + + Invalidate( rReq.GetSlot() ); + rReq.Done(); + break; + } + + case SID_ACTIVATE: + { + MakeActive_Impl( TRUE ); + rReq.SetReturnValue( SfxObjectItem( 0, this ) ); + break; + } + + case SID_NEWDOCDIRECT : + { + SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE); + String aFactName; + if ( pFactoryItem ) + aFactName = pFactoryItem->GetValue(); + else if ( pImp->aFactoryName.Len() ) + aFactName = pImp->aFactoryName; + else + { + DBG_ERROR("Missing argument!"); + break; + } + + 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( "_blank" ) ) ); + SFX_APP()->ExecuteSlot( aReq ); + const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); + if ( pItem ) + rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); + break; + } + + case SID_CLOSEWIN: + { + // disable CloseWin, if frame is not a task + Reference < XCloseable > xTask( GetFrame().GetFrameInterface(), UNO_QUERY ); + if ( !xTask.is() ) + break; + + if ( GetViewShell()->PrepareClose() ) + { + // weitere Views auf dasselbe Doc? + SfxObjectShell *pDocSh = GetObjectShell(); + int bOther = sal_False; + for ( const SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); + !bOther && pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) + bOther = (pFrame != this); + + // Doc braucht nur gefragt zu werden, wenn keine weitere View + sal_Bool bClosed = sal_False; + sal_Bool bUI = TRUE; + if ( ( bOther || pDocSh->PrepareClose( bUI ) ) ) + { + if ( !bOther ) + pDocSh->SetModified( FALSE ); + rReq.Done(); // unbedingt vor Close() rufen! + bClosed = sal_False; + try + { + xTask->close(sal_True); + bClosed = sal_True; + } + catch( CloseVetoException& ) + { + bClosed = sal_False; + } + } + + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bClosed )); + } + return; + } + } + + rReq.Done(); +} + +void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) +{ + SfxObjectShell *pDocSh = GetObjectShell(); + + if ( !pDocSh ) + return; + + const sal_uInt16 *pRanges = rSet.GetRanges(); + DBG_ASSERT(pRanges, "Set ohne Bereich"); + while ( *pRanges ) + { + for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) + { + switch(nWhich) + { + case SID_NEWDOCDIRECT : + { + if ( pImp->aFactoryName.Len() ) + { + String aFact = String::CreateFromAscii("private:factory/"); + aFact += pImp->aFactoryName; + rSet.Put( SfxStringItem( nWhich, aFact ) ); + } + break; + } + + case SID_NEWWINDOW: + rSet.DisableItem(nWhich); + break; + + case SID_CLOSEWIN: + { + // disable CloseWin, if frame is not a task + Reference < XCloseable > xTask( GetFrame().GetFrameInterface(), UNO_QUERY ); + if ( !xTask.is() ) + rSet.DisableItem(nWhich); + break; + } + + case SID_SHOWPOPUPS : + break; + + case SID_OBJECT: + if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) + { + uno::Any aAny; + aAny <<= GetViewShell()->GetVerbs(); + rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); + } + else + rSet.DisableItem( SID_OBJECT ); + break; + + default: + DBG_ERROR( "invalid message-id" ); + } + } + ++pRanges; + } +} + +void SfxViewFrame::INetExecute_Impl( SfxRequest &rRequest ) +{ + sal_uInt16 nSlotId = rRequest.GetSlot(); + switch( nSlotId ) + { + case SID_BROWSE_FORWARD: + case SID_BROWSE_BACKWARD: + OSL_ENSURE( false, "SfxViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); + break; + case SID_CREATELINK: + { +/*! (pb) we need new implementation to create a link +*/ + break; + } + case SID_FOCUSURLBOX: + { + SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); + if( pCache ) + { + SfxControllerItem* pCtrl = pCache->GetItemLink(); + while( pCtrl ) + { + pCtrl->StateChanged( SID_FOCUSURLBOX, SFX_ITEM_UNKNOWN, 0 ); + pCtrl = pCtrl->GetItemLink(); + } + } + } + } + + // Recording + rRequest.Done(); +} + +void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet ) +{ + rItemSet.DisableItem( SID_BROWSE_FORWARD ); + rItemSet.DisableItem( SID_BROWSE_BACKWARD ); + + // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen + SfxObjectShell *pDocSh = GetObjectShell(); + sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ); + sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; + if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) + rItemSet.DisableItem( SID_CREATELINK ); +} + +void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) +{ + GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); +} + +void SfxViewFrame::Activate( sal_Bool bMDI ) +{ + DBG_ASSERT(GetViewShell(), "Keine Shell"); + if ( bMDI ) + pImp->bActive = sal_True; +//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +} + +void SfxViewFrame::Deactivate( sal_Bool bMDI ) +{ + DBG_ASSERT(GetViewShell(), "Keine Shell"); + if ( bMDI ) + pImp->bActive = sal_False; +//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +} diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 981d13cc0f9a..69ce837fb023 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -84,12 +84,10 @@ struct SfxViewShell_Impl Size aOptimalSize; Size aMargin; USHORT nPrinterLocks; - BOOL bUseObjectSize; BOOL bCanPrint; BOOL bHasPrintOptions; BOOL bPlugInsActive; BOOL bIsShowView; - BOOL bFrameSetImpl; BOOL bOwnsMenu; BOOL bGotOwnerShip; BOOL bGotFrameOwnerShip; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 3224d1c18d5c..5c65c967434f 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -81,7 +81,7 @@ #include "view.hrc" #include "sfxlocal.hrc" #include <sfx2/sfxbasecontroller.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "mailmodelapi.hxx" #include <sfx2/event.hxx> #include <sfx2/fcontnr.hxx> @@ -389,7 +389,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) case SID_ACTIVATE_STYLE_APPLY: { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetViewFrame()->GetFrame()->GetFrameInterface(), + GetViewFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -485,7 +485,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) if ( pMailDocType ) aDocType = pMailDocType->GetValue(); - uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_ERROR; if ( nId == SID_MAIL_SENDDOC ) @@ -529,7 +529,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) const sal_Int32 FILTERFLAG_EXPORT = 0x00000002; css::uno::Reference< lang::XMultiServiceFactory > xSMGR(::comphelper::getProcessServiceFactory(), css::uno::UNO_QUERY_THROW); - css::uno::Reference < css::frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + css::uno::Reference < css::frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); css::uno::Reference< css::frame::XModel > xModel; const rtl::OUString aModuleManager( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" )); @@ -686,8 +686,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) // ausfuehren if ( !pShowItem || bActive != pImp->bPlugInsActive ) { - SfxFrame* pTopFrame = GetFrame()->GetTopFrame(); - if ( pTopFrame != GetFrame()->GetFrame() ) + SfxFrame* pTopFrame = &GetFrame()->GetTopFrame(); + if ( pTopFrame != &GetFrame()->GetFrame() ) { // FramesetDocument SfxViewShell *pShell = pTopFrame->GetCurrentViewFrame()->GetViewShell(); @@ -773,7 +773,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) aPrinterName = Printer::GetDefaultPrinterName(); if ( aPrinterName.getLength() > 0 ) { - uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); ::rtl::OUStringBuffer aBuffer( 60 ); aBuffer.append( RetrieveLabelFromCommand( @@ -871,7 +871,7 @@ ErrCode SfxViewShell::DoVerb(long /*nVerb*/) void SfxViewShell::OutplaceActivated( sal_Bool bActive, SfxInPlaceClient* /*pClient*/ ) { if ( !bActive ) - GetFrame()->GetFrame()->Appear(); + GetFrame()->GetFrame().Appear(); } //-------------------------------------------------------------------- @@ -893,7 +893,7 @@ void SfxViewShell::InplaceDeactivated( SfxInPlaceClient* /*pClient*/ ) void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ ) { - uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() ); uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); if ( xParentFrame.is() ) xParentFrame->setActiveFrame( xOwnFrame ); @@ -906,12 +906,12 @@ void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ ) void SfxViewShell::UIDeactivated( SfxInPlaceClient* /*pClient*/ ) { - if ( !pFrame->GetFrame()->IsClosing_Impl() || + if ( !pFrame->GetFrame().IsClosing_Impl() || SfxViewFrame::Current() != pFrame ) pFrame->GetDispatcher()->Update_Impl( TRUE ); pFrame->GetBindings().HidePopups(FALSE); - // uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame()->GetFrameInterface() ); + // uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() ); // uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); // if ( xParentFrame.is() ) // xParentFrame->setActiveFrame( uno::Reference < frame::XFrame >() ); @@ -992,7 +992,7 @@ void SfxViewShell::Activate( BOOL bMDI ) { SfxObjectShell *pSh = GetViewFrame()->GetObjectShell(); if ( pSh->GetModel().is() ) - pSh->GetModel()->setCurrentController( GetViewFrame()->GetFrame()->GetController() ); + pSh->GetModel()->setCurrentController( GetViewFrame()->GetFrame().GetController() ); SetCurrentDocument(); } @@ -1252,8 +1252,6 @@ SfxViewShell::SfxViewShell ,pFrame(pViewFrame) ,pSubShell(0) ,pWindow(0) - ,bMaximizeFirst( 0 != (nFlags & SFX_VIEW_MAXIMIZE_FIRST) ) - ,bOptimizeEach(0 != (nFlags & SFX_VIEW_OPTIMIZE_EACH)) ,bNoNewWindow( 0 != (nFlags & SFX_VIEW_NO_NEWWINDOW) ) { DBG_CTOR(SfxViewShell, 0); @@ -1263,11 +1261,7 @@ SfxViewShell::SfxViewShell pImp->bIsShowView = !(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW)); - pImp->bUseObjectSize = FALSE; -// SFX_CREATE_MODE_EMBEDDED==pFrame->GetObjectShell()->GetCreateMode() && -// SFX_VIEW_OBJECTSIZE_EMBEDDED == (nFlags & SFX_VIEW_OBJECTSIZE_EMBEDDED); pImp->bCanPrint = SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT); - pImp->bFrameSetImpl = (nFlags & SFX_VIEW_IMPLEMENTED_AS_FRAMESET) != 0; pImp->bHasPrintOptions = SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS); pImp->bPlugInsActive = TRUE; @@ -1363,6 +1357,24 @@ SfxViewShell* SfxViewShell::Current() //-------------------------------------------------------------------- +SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) +{ + if ( !i_rController.is() ) + return NULL; + + for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst( NULL, FALSE ); + pViewShell; + pViewShell = SfxViewShell::GetNext( *pViewShell, NULL, FALSE ) + ) + { + if ( pViewShell->GetController() == i_rController ) + return pViewShell; + } + return NULL; +} + +//-------------------------------------------------------------------- + SdrView* SfxViewShell::GetDrawView() const /* [Beschreibung] @@ -1514,16 +1526,12 @@ void SfxViewShell::PushSubShells_Impl( BOOL bPush ) { for ( USHORT n=0; n<nCount; n++ ) pDisp->Push( *pImp->aArr[n] ); - -// HACK(evtl. PushSubShells fuer SW virtuell machen oder im SW umbauen) -// Notify( *this, SfxSimpleHint( SFX_HINT_RESERVED4 ) ); } else if ( nCount ) { - pDisp->Pop( *pImp->aArr[0], SFX_SHELL_POP_UNTIL ); - -// HACK(evtl. PushSubShells fuer SW virtuell machen oder im SW umbauen) -// Notify( *this, SfxSimpleHint( SFX_HINT_RESERVED3 ) ); + SfxShell& rPopUntil = *pImp->aArr[0]; + if ( pDisp->GetShellLevel( rPopUntil ) != USHRT_MAX ) + pDisp->Pop( rPopUntil, SFX_SHELL_POP_UNTIL ); } pDisp->Flush(); @@ -1674,7 +1682,7 @@ BOOL SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) if (!pImp->pAccExec) { pImp->pAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper(); - pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame()->GetFrameInterface()); + pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame().GetFrameInterface()); } return pImp->pAccExec->execute(aKey.GetKeyCode()); @@ -1779,13 +1787,6 @@ void SfxViewShell::DisconnectAllClients() //-------------------------------------------------------------------- -BOOL SfxViewShell::UseObjectSize() const -{ - return pImp->bUseObjectSize; -} - -//-------------------------------------------------------------------- - void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const { } @@ -1795,14 +1796,7 @@ void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const void SfxViewShell::AdjustVisArea(const Rectangle& rRect) { DBG_ASSERT (pFrame, "Kein Frame?"); - if ( UseObjectSize() ) - { - Point aPos = rRect.TopLeft(); - Size aSize = GetObjectShell()->GetVisArea().GetSize(); - GetObjectShell()->SetVisArea( Rectangle(aPos, aSize) ); - } - else - GetObjectShell()->SetVisArea( rRect ); + GetObjectShell()->SetVisArea( rRect ); } //-------------------------------------------------------------------- @@ -1974,13 +1968,6 @@ SfxFrame* SfxViewShell::GetSmartSelf( SfxFrame* pSelf, SfxMedium& /*rMedium*/ ) return pSelf; } -//-------------------------------------------------------------------- - -BOOL SfxViewShell::IsImplementedAsFrameset_Impl( ) const -{ - return pImp->bFrameSetImpl; -} - //------------------------------------------------------------------------ void SfxViewShell::JumpToMark( const String& rMark ) @@ -2020,6 +2007,11 @@ Reference < XController > SfxViewShell::GetController() return pImp->pController; } +SfxBaseController* SfxViewShell::GetBaseController_Impl() const +{ + return pImp->pController; +} + void SfxViewShell::AddContextMenuInterceptor_Impl( const REFERENCE< XCONTEXTMENUINTERCEPTOR >& xInterceptor ) { pImp->aInterceptorContainer.addInterface( xInterceptor ); @@ -2174,7 +2166,7 @@ void SfxViewShell::CheckOwnerShip_Impl() { // document couldn't be closed or it shouldn't, now try at least to close the frame com::sun::star::uno::Reference < com::sun::star::util::XCloseable > xFrame( - GetViewFrame()->GetFrame()->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + GetViewFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xFrame.is() ) { try @@ -2253,3 +2245,4 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf { } } + diff --git a/sfx2/util/hidother.src b/sfx2/util/hidother.src index 238e93823e26..72b178b2d629 100644 --- a/sfx2/util/hidother.src +++ b/sfx2/util/hidother.src @@ -57,35 +57,12 @@ hidspecial SID_STYLE_FAMILY4 { HelpID = SID_STYLE_FAMILY4; }; hidspecial SID_STYLE_FAMILY5 { HelpID = SID_STYLE_FAMILY5; }; hidspecial SID_FILTER_NAME { HelpID = SID_FILTER_NAME; }; hidspecial HID_NAVIGATOR_WINDOW { HelpID = HID_NAVIGATOR_WINDOW; }; -hidspecial SID_EXPLORERCONTENT_OPEN { HelpId = SID_EXPLORERCONTENT_OPEN; }; -hidspecial SID_EXPLORERCONTENT_OPEN_FOLDER { HelpId = SID_EXPLORERCONTENT_OPEN_FOLDER; }; -hidspecial SID_EXPLORERCONTENT_OPEN_TEMPLATE { HelpId = SID_EXPLORERCONTENT_OPEN_TEMPLATE; }; -hidspecial SID_EXPLORERCONTENT_OPEN_DOCUMENT { HelpId = SID_EXPLORERCONTENT_OPEN_DOCUMENT; }; -hidspecial SID_EXPLORERCONTENT_OPEN_OBJECT { HelpId = SID_EXPLORERCONTENT_OPEN_OBJECT; }; hidspecial HID_HELPAGENT_TIP_BOX { HelpId = HID_HELPAGENT_TIP_BOX; }; -hidspecial SID_EXPLORER_SEARCH_DLG { HelpId = SID_EXPLORER_SEARCH_DLG; }; -hidspecial SID_TRASH_RECOVER { HelpId = SID_TRASH_RECOVER; }; -hidspecial SID_TRASH_AUTOEMPTY { HelpId = SID_TRASH_AUTOEMPTY; }; -hidspecial SID_TRASH_EMPTY { HelpId = SID_TRASH_EMPTY; }; -hidspecial SID_EXPLORERCONTENT_NEW { HelpId = SID_EXPLORERCONTENT_NEW; }; -hidspecial SID_EXPLORERCONTENT_DESTROY { HelpId = SID_EXPLORERCONTENT_DESTROY; }; -hidspecial SID_EXPLORERCONTENT_RENAME { HelpId = SID_EXPLORERCONTENT_RENAME; }; -hidspecial SID_EXPLORERCONTENT_COPY { HelpId = SID_EXPLORERCONTENT_COPY; }; -hidspecial SID_EXPLORERCONTENT_PASTE { HelpId = SID_EXPLORERCONTENT_PASTE; }; -hidspecial SID_EXPLORERCONTENT_CREATELINK { HelpId = SID_EXPLORERCONTENT_CREATELINK; }; -hidspecial SID_EXPLORERCONTENT_MAKEROOT { HelpId = SID_EXPLORERCONTENT_MAKEROOT; }; -hidspecial SID_EXPLORERCONTENT_DEFAULTTEMPLATE { HelpId = SID_EXPLORERCONTENT_DEFAULTTEMPLATE; }; -hidspecial SID_PROPERTIES { HelpId = SID_PROPERTIES; }; -hidspecial SID_EXPLORER_BOOKMARKDIR { HelpId = SID_EXPLORER_BOOKMARKDIR; }; -hidspecial SID_EXPLORER_SEARCHORIG { HelpId = SID_EXPLORER_SEARCHORIG; }; hidspecial HID_TEMPLDLG_TOOLBOX_LEFT { HelpId = HID_TEMPLDLG_TOOLBOX_LEFT;}; hidspecial HID_EXPLORER_SRCH_COUNT { HelpId = HID_EXPLORER_SRCH_COUNT;}; -hidspecial SID_EXPLORER_PASTE_ASLINK { HelpId = SID_EXPLORER_PASTE_ASLINK;}; hidspecial HID_INTERFACE_SFXPLUGINVIEW { HelpID = HID_INTERFACE_SFXPLUGINVIEW; }; hidspecial HID_TABDLG_RESET_BTN { HelpID = HID_TABDLG_RESET_BTN; }; hidspecial HID_TABDLG_STANDARD_BTN { HelpID = HID_TABDLG_STANDARD_BTN; }; -hidspecial SID_EXPLORER_RESETURL { HelpID = SID_EXPLORER_RESETURL; }; -hidspecial SID_ORIG_PROPERTIES { HelpID = SID_ORIG_PROPERTIES; }; hidspecial HID_CONFIG_EVENT_OFFICE_BASED { HelpID = HID_CONFIG_EVENT_OFFICE_BASED; }; hidspecial HID_CONFIG_EVENT_DOCUMENT_BASED { HelpID = HID_CONFIG_EVENT_DOCUMENT_BASED; }; hidspecial HID_EXPLORER_SRCH_LATEST_COUNT { HelpID = HID_EXPLORER_SRCH_LATEST_COUNT; }; @@ -97,10 +74,6 @@ hidspecial HID_CHAOSDOC_WIN { HelpID = HID_CHAOSDOC_WIN; }; hidspecial HID_CHAOSDOC_WIN_HEADER { HelpID = HID_CHAOSDOC_WIN_HEADER; }; hidspecial HID_CHAOSDOC_WIN_PARTS { HelpID = HID_CHAOSDOC_WIN_PARTS; }; hidspecial HID_CHAOSDOC_WIN_BODY { HelpID = HID_CHAOSDOC_WIN_BODY; }; -hidspecial SID_CHAOSDOC_LAYOUT1 { HelpID = SID_CHAOSDOC_LAYOUT1; }; -hidspecial SID_CHAOSDOC_LAYOUT2 { HelpID = SID_CHAOSDOC_LAYOUT2; }; -hidspecial SID_CHAOSDOC_LAYOUT3 { HelpID = SID_CHAOSDOC_LAYOUT3; }; -hidspecial SID_CHAOSDOC_LAYOUT4 { HelpID = SID_CHAOSDOC_LAYOUT4; }; hidspecial HID_BRWBOX_HEADERBAR { HelpID = HID_BRWBOX_HEADERBAR; }; hidspecial HID_TASKBAR { HelpID = HID_TASKBAR; }; hidspecial HID_TASKBUTTONBAR { HelpID = HID_TASKBUTTONBAR; }; @@ -126,9 +99,6 @@ hidspecial HID_CHAOS_NEW_SUBSCR_BOX { HelpID = HID_CHAOS_NEW_SUBSCR_ hidspecial HID_CHAOS_NEW_BOOKMARK { HelpID = HID_CHAOS_NEW_BOOKMARK; }; hidspecial HID_CHAOS_NEW_PUB_BOX { HelpID = HID_CHAOS_NEW_PUB_BOX; }; hidspecial HID_UUI_END { HelpID = HID_UUI_END; }; // aka HID_CHAOS_NEW_DATABASE -hidspecial SID_EXPLORER_SHOWEXTENSION { HelpID = SID_EXPLORER_SHOWEXTENSION; }; -hidspecial SID_EXPLORER_MAIL_HEADER { HelpID = SID_EXPLORER_MAIL_HEADER; }; -hidspecial SID_EXPLORER_MAIL_BODY { HelpID = SID_EXPLORER_MAIL_BODY; }; hidspecial HID_CNT_DLG_SEARCH_BT_SHOW { HelpID = HID_CNT_DLG_SEARCH_BT_SHOW; }; hidspecial HID_CNT_DLG_SEARCH_BT_UPDATE { HelpID = HID_CNT_DLG_SEARCH_BT_UPDATE; }; hidspecial HID_CNT_DLG_SEARCH_BT_SYNCHRONIZE { HelpID = HID_CNT_DLG_SEARCH_BT_SYNCHRONIZE; }; diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx index e28bab3affe4..af6f1036496d 100644 --- a/shell/source/backends/wininetbe/wininetbackend.cxx +++ b/shell/source/backends/wininetbe/wininetbackend.cxx @@ -37,6 +37,7 @@ #endif #include <windows.h> #include <wininet.h> +#include <sal/alloca.h> #if defined _MSC_VER #pragma warning(pop) #endif @@ -138,11 +139,11 @@ WinInetBackend::WinInetBackend() // in a stack overflow exception, we assume // this never happens, because of the relatively // small amount of memory we need - // _alloca is nice because it is fast and we don't + // alloca is nice because it is fast and we don't // have to free the allocated memory, it will be // automatically done lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >( - _alloca( dwLength ) ); + alloca( dwLength ) ); bRet = lpfnInternetQueryOption( NULL, diff --git a/shell/source/win32/shlxthandler/makefile.mk b/shell/source/win32/shlxthandler/makefile.mk index 0c2abb405be0..4452cb1a90e6 100755..100644 --- a/shell/source/win32/shlxthandler/makefile.mk +++ b/shell/source/win32/shlxthandler/makefile.mk @@ -75,8 +75,14 @@ SHL1STDLIBS+=\ $(SHELL32LIB)\ $(KERNEL32LIB)\ $(GDI32LIB)\ - $(GDIPLUSLIB)\ - msvcprt.lib \ + $(GDIPLUSLIB) + +.IF "$(COM)"!="GCC" +SHL1STDLIBS+=\ + msvcprt.lib +.ENDIF + +SHL1STDLIBS+=\ $(SHLWAPILIB) SHL1LIBS+=$(SLB)$/util.lib\ diff --git a/shell/source/win32/shlxthandler/ooofilt/makefile.mk b/shell/source/win32/shlxthandler/ooofilt/makefile.mk index 0d2a40e147fe..9111069ab889 100755..100644 --- a/shell/source/win32/shlxthandler/ooofilt/makefile.mk +++ b/shell/source/win32/shlxthandler/ooofilt/makefile.mk @@ -73,12 +73,15 @@ SHL1STDLIBS+=$(OLE32LIB)\ $(UUIDLIB)\ $(SHELL32LIB)\ $(KERNEL32LIB)\ - $(OLDNAMESLIB)\ - msvcprt.lib + $(OLDNAMESLIB) + +.IF "$(COM)"!="GCC" +SHL1STDLIBS+=msvcprt.lib .IF "$(PRODUCT)"!="full" SHL1STDLIBS+=msvcrt.lib .ENDIF +.ENDIF # $(LIBSTLPORTST) diff --git a/shell/source/win32/shlxthandler/prophdl/makefile.mk b/shell/source/win32/shlxthandler/prophdl/makefile.mk index 572dcb938591..dc6d0e159046 100755..100644 --- a/shell/source/win32/shlxthandler/prophdl/makefile.mk +++ b/shell/source/win32/shlxthandler/prophdl/makefile.mk @@ -73,12 +73,16 @@ SHL1STDLIBS+=\ $(GDI32LIB)\ $(GDIPLUSLIB)\ $(SHLWAPILIB)\ - $(PROPSYSLIB) \ + $(PROPSYSLIB) + +.IF "$(COM)"!="GCC" +SHL1STDLIBS+=\ msvcprt.lib .IF "$(PRODUCT)"!="full" SHL1STDLIBS+=msvcrt.lib .ENDIF +.ENDIF SHL1LIBS+=$(SLB)$/util.lib\ $(SLB)$/ooofilereader.lib diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx index 3cece320ace4..3f495a7aa53d 100755..100644 --- a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx +++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx @@ -222,7 +222,11 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfM if ( !m_pCache ) { +#ifdef __MINGW32__ + if ( FAILED( PSCreateMemoryPropertyStore( IID_IPropertyStoreCache, reinterpret_cast<void**>(&m_pCache) ) ) ) +#else if ( FAILED( PSCreateMemoryPropertyStore( IID_PPV_ARGS( &m_pCache ) ) ) ) +#endif OutputDebugStringFormat( "CPropertyHdl::Initialize: PSCreateMemoryPropertyStore failed" ); zlib_filefunc_def z_filefunc; diff --git a/shell/source/win32/shlxthandler/propsheets/makefile.mk b/shell/source/win32/shlxthandler/propsheets/makefile.mk index fd83f33b9960..55a31c9c59d3 100644 --- a/shell/source/win32/shlxthandler/propsheets/makefile.mk +++ b/shell/source/win32/shlxthandler/propsheets/makefile.mk @@ -35,13 +35,14 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 +CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE +CDEFS+=-U_WIN32_WINNT -D_WIN32_WINNT=0x0501 -U_WIN32_IE -D_WIN32_IE=0x501 +.IF "$(COM)"!="GCC" CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820 -CDEFS+=-D_WIN32_IE=0x501 - -CFLAGS_X64+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 +CFLAGS_X64+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE CFLAGS_X64+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820 -CDEFS_X64+=-D_WIN32_IE=0x501 +CDEFS_X64+=-D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x501 +.ENDIF # --- Files -------------------------------------------------------- diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index f9ee36de1ab0..e328a39a0707 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -468,12 +468,6 @@ HelpID = SID_LOGOUT ; \ Text [ en-US ] = "Logout" ; \ -#define ITEM_FILE_BACKTOWEBTOP \ - Identifier = SID_BACKTOWEBTOP ; \ - Command = ".uno:BackToWebtop" ; \ - HelpID = SID_BACKTOWEBTOP ; \ - Text [ en-US ] = "Back to Webtop"; \ - #define ITEM_EDIT_UNDO \ Identifier = SID_UNDO ; \ Command = ".uno:UndoAction" ; \ diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 235544f22f28..95ed1449c846 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -754,7 +754,6 @@ #include "svtools/apearcfg.hxx" #include "svl/brdcst.hxx" #include "unotools/cacheoptions.hxx" -#include "svl/cancel.hxx" #include "svl/cjkoptions.hxx" #include "unotools/cmdoptions.hxx" #include "svl/cntwall.hxx" diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx index 886aa74da70e..00da40a852e9 100644 --- a/svx/inc/svx/cube3d.hxx +++ b/svx/inc/svx/cube3d.hxx @@ -52,10 +52,6 @@ enum { CUBE_BOTTOM = 0x0001, CUBE_BACK = 0x0002, CUBE_LEFT = 0x0004, class SVX_DLLPUBLIC E3dCubeObj : public E3dCompoundObject { private: - // Zur Geometrieerzeugung eines Cubes notwendige - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPoint aCubePos; basegfx::B3DVector aCubeSize; @@ -66,6 +62,7 @@ private: protected: void SetDefaultAttributes(E3dDefaultAttributes& rDefault); + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: TYPEINFO(); diff --git a/svx/inc/svx/extrud3d.hxx b/svx/inc/svx/extrud3d.hxx index 621ec9125e6e..f429742be448 100644 --- a/svx/inc/svx/extrud3d.hxx +++ b/svx/inc/svx/extrud3d.hxx @@ -40,11 +40,6 @@ class SVX_DLLPUBLIC E3dExtrudeObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::E3dExtrudeProperties access to SetGeometryValid() friend class sdr::properties::E3dExtrudeProperties; @@ -52,6 +47,8 @@ private: basegfx::B2DPolyPolygon maExtrudePolygon; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/lathe3d.hxx b/svx/inc/svx/lathe3d.hxx index 0a72b826ee0c..9ddd90a6bfac 100644 --- a/svx/inc/svx/lathe3d.hxx +++ b/svx/inc/svx/lathe3d.hxx @@ -44,16 +44,13 @@ class SVX_DLLPUBLIC E3dLatheObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // Partcodes fuer Wireframe-Generierung: Standard oder Deckelflaeche enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 }; basegfx::B2DPolyPolygon maPolyPoly2D; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx index 6d8b354db8be..1116fd3fa033 100644 --- a/svx/inc/svx/obj3d.hxx +++ b/svx/inc/svx/obj3d.hxx @@ -106,8 +106,7 @@ public: class SVX_DLLPUBLIC E3dObject : public SdrAttrObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dProperties access to StructureChanged() friend class sdr::properties::E3dProperties; @@ -116,6 +115,8 @@ class SVX_DLLPUBLIC E3dObject : public SdrAttrObj friend class E3dDragMethod; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + E3dObjList maSubList; // Subliste (Childobjekte) basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts (aus geometrieerzeugung) @@ -220,8 +221,7 @@ public: class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dCompoundProperties access to SetGeometryValid() friend class sdr::properties::E3dCompoundProperties; friend class sdr::properties::E3dExtrudeProperties; @@ -229,6 +229,8 @@ class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject friend class sdr::properties::E3dSphereProperties; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // Material des Objektes Color aMaterialAmbientColor; diff --git a/svx/inc/svx/polygn3d.hxx b/svx/inc/svx/polygn3d.hxx index 644baf65eb88..0517b6464907 100644 --- a/svx/inc/svx/polygn3d.hxx +++ b/svx/inc/svx/polygn3d.hxx @@ -34,9 +34,6 @@ class SVX_DLLPUBLIC E3dPolygonObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPolyPolygon aPolyPoly3D; basegfx::B3DPolyPolygon aPolyNormals3D; @@ -46,6 +43,9 @@ private: SVX_DLLPRIVATE void CreateDefaultNormals(); SVX_DLLPRIVATE void CreateDefaultTexture(); +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: void SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx index 4bae0dcf9d00..dfda9ac1a36e 100644 --- a/svx/inc/svx/scene3d.hxx +++ b/svx/inc/svx/scene3d.hxx @@ -68,17 +68,14 @@ class Imp3DDepthRemapper; class SVX_DLLPUBLIC E3dScene : public E3dObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dSceneProperties access to StructureChanged() friend class sdr::properties::E3dSceneProperties; - // #110094# DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: // Transformationen B3dCamera aCameraSet; Camera3D aCamera; @@ -108,6 +105,8 @@ public: E3dScene(E3dDefaultAttributes& rDefault); virtual ~E3dScene(); + virtual void SetBoundRectDirty(); + // access to cleanup of depth mapper void Cleanup3DDepthMapper() { ImpCleanup3DDepthMapper(); } diff --git a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx deleted file mode 100644 index 40ad89119d51..000000000000 --- a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx +++ /dev/null @@ -1,198 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX -#define _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -#include <sal/types.h> - -////////////////////////////////////////////////////////////////////////////// -// predefines - -namespace drawinglayer { namespace attribute { - class SdrLineAttribute; - class SdrFillAttribute; - class SdrLineStartEndAttribute; - class SdrShadowAttribute; - class FillGradientAttribute; - class SdrTextAttribute; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrShadowTextAttribute - { - // shadow and text attributes - SdrShadowAttribute* mpShadow; // shadow attributes (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrShadowTextAttribute( - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrShadowTextAttribute(); - - // copy constructor and assigment operator - SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); - SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (0 != mpTextAttribute); } - - // data access - const SdrShadowAttribute* getShadow() const { return mpShadow; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrFillTextAttribute - { - // shadow and text attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrFillTextAttribute( - SdrFillAttribute* pFill = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrFillTextAttribute(); - - // copy constructor and assigment operator - SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); - SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrFillTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return ((mpTextAttribute) || (mpFill)); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineShadowTextAttribute : public SdrShadowTextAttribute - { - // line, shadow, lineStartEnd and text attributes - SdrLineAttribute* mpLine; // line attributes (if used) - SdrLineStartEndAttribute* mpLineStartEnd; // line start end (if used) - - public: - SdrLineShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); - SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpLine || (SdrShadowTextAttribute::isVisible())); } - - // data access - const SdrLineAttribute* getLine() const { return mpLine; } - const SdrLineStartEndAttribute* getLineStartEnd() const { return mpLineStartEnd; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute - { - // add fill and transGradient attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - - public: - SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrFillAttribute* pFill = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineFillShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); - SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpFill || (SdrLineShadowTextAttribute::isVisible())); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif // _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -// eof diff --git a/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx new file mode 100644 index 000000000000..df8ee7c666a9 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,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. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +#include <sal/types.h> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <svx/sdr/attribute/sdrtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFillTextAttribute + { + // shadow and text attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrFillTextAttribute(); + SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); + SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrFillTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx index d812549bffcf..03b86ff33a0f 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx @@ -34,8 +34,13 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SfxItemSet; -namespace drawinglayer { namespace attribute { class SdrFormTextOutlineAttribute; }} + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextAttribute; + class SdrFormTextOutlineAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -46,53 +51,36 @@ namespace drawinglayer class SdrFormTextAttribute { private: - // FormText (FontWork) Attributes - sal_Int32 mnFormTextDistance; // distance from line in upright direction - sal_Int32 mnFormTextStart; // shift from polygon start - sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees - sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling - sal_uInt16 mnFormTextShdwTransp; // shadow transparence - XFormTextStyle meFormTextStyle; // on/off and char orientation - XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale - XFormTextShadow meFormTextShadow; // shadow mode - Color maFormTextShdwColor; // shadow color - - // outline attributes; used when getFormTextOutline() is true and (for - // shadow) when getFormTextShadow() != XFTSHADOW_NONE - SdrFormTextOutlineAttribute* mpOutline; - SdrFormTextOutlineAttribute* mpShadowOutline; - - // bitfield - unsigned mbFormTextMirror : 1; // change orientation - unsigned mbFormTextOutline : 1; // show contour of objects + ImpSdrFormTextAttribute* mpSdrFormTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextAttribute(const SfxItemSet& rSet); - ~SdrFormTextAttribute(); - - // copy constructor and assigment operator + SdrFormTextAttribute(); SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate); SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate); + ~SdrFormTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextAttribute& rCandidate) const; - // data access - sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } - sal_Int32 getFormTextStart() const { return mnFormTextStart; } - sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } - sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } - sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } - XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } - XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } - XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } - Color getFormTextShdwColor() const { return maFormTextShdwColor; } - - const SdrFormTextOutlineAttribute* getOutline() const { return mpOutline; } - const SdrFormTextOutlineAttribute* getShadowOutline() const { return mpShadowOutline; } - - bool getFormTextMirror() const { return mbFormTextMirror; } - bool getFormTextOutline() const { return mbFormTextOutline; } + // data read access + sal_Int32 getFormTextDistance() const; + sal_Int32 getFormTextStart() const; + sal_Int32 getFormTextShdwXVal() const; + sal_Int32 getFormTextShdwYVal() const; + sal_uInt16 getFormTextShdwTransp() const; + XFormTextStyle getFormTextStyle() const; + XFormTextAdjust getFormTextAdjust() const; + XFormTextShadow getFormTextShadow() const; + Color getFormTextShdwColor() const; + const SdrFormTextOutlineAttribute& getOutline() const; + const SdrFormTextOutlineAttribute& getShadowOutline() const; + bool getFormTextMirror() const; + bool getFormTextOutline() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx index d2c6d45b3873..fd72607b2f08 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx @@ -29,8 +29,15 @@ #define _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX #include <sal/types.h> -#include <drawinglayer/attribute/lineattribute.hxx> -#include <drawinglayer/attribute/strokeattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute; + class LineAttribute; + class StrokeAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -41,24 +48,29 @@ namespace drawinglayer class SdrFormTextOutlineAttribute { private: - // one set of attributes for FormText (FontWork) outline visualisation - LineAttribute maLineAttribute; - StrokeAttribute maStrokeAttribute; - sal_uInt8 mnTransparence; + ImpSdrFormTextOutlineAttribute* mpSdrFormTextOutlineAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence); + SdrFormTextOutlineAttribute(); + SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate); + SdrFormTextOutlineAttribute& operator=(const SdrFormTextOutlineAttribute& rCandidate); + ~SdrFormTextOutlineAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextOutlineAttribute& rCandidate) const; // data read access - const LineAttribute& getLineAttribute() const { return maLineAttribute; } - const StrokeAttribute getStrokeAttribute() const { return maStrokeAttribute; } - sal_uInt8 getTransparence() const { return mnTransparence; } + const LineAttribute& getLineAttribute() const; + const StrokeAttribute& getStrokeAttribute() const; + sal_uInt8 getTransparence() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx new file mode 100644 index 000000000000..c2fa9200dfe8 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,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. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +#include <sal/types.h> +#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute + { + // add fill and transGradient attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + + public: + SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrLineFillShadowTextAttribute(); + SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); + SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx new file mode 100644 index 000000000000..e5d19cef5f4e --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,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. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +#include <sal/types.h> +#include <svx/sdr/attribute/sdrshadowtextattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineShadowTextAttribute : public SdrShadowTextAttribute + { + // line, shadow, lineStartEnd and text attributes + SdrLineAttribute maLine; // line attributes (if used) + SdrLineStartEndAttribute maLineStartEnd; // line start end (if used) + + public: + SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrLineShadowTextAttribute(); + SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); + SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; + + // data access + const SdrLineAttribute& getLine() const { return maLine; } + const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx new file mode 100644 index 000000000000..f71a74d6a580 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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: sdrallattribute.hxx,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. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +#include <sal/types.h> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <svx/sdr/attribute/sdrtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrShadowTextAttribute + { + // shadow and text attributes + SdrShadowAttribute maShadow; // shadow attributes (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrShadowTextAttribute(); + SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); + SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrShadowTextAttribute& rCandidate) const; + + // data access + const SdrShadowAttribute& getShadow() const { return maShadow; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index 6f113192c891..f202eabbfbff 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -35,9 +35,20 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SdrText; -namespace drawinglayer { namespace animation { class AnimationEntryList; }} -namespace drawinglayer { namespace attribute { class SdrFormTextAttribute; }} + +namespace drawinglayer { namespace animation { + class AnimationEntryList; +}} + +namespace drawinglayer { namespace attribute { + class SdrFormTextAttribute; +}} + +namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -48,40 +59,13 @@ namespace drawinglayer class SdrTextAttribute { private: - // all-text attributes. The SdrText itself and a copy - // of te OPO - const SdrText* mpSdrText; - OutlinerParaObject maOutlinerParaObject; - - // Set when it's a FormText; contains all FormText attributes - SdrFormTextAttribute* mpSdrFormTextAttribute; - - // text distances - sal_Int32 maTextLeftDistance; - sal_Int32 maTextUpperDistance; - sal_Int32 maTextRightDistance; - sal_Int32 maTextLowerDistance; - - // #i101556# use versioning from text attributes to detect changes - sal_uInt32 maPropertiesVersion; - - // text alignments - SdrTextHorzAdjust maSdrTextHorzAdjust; - SdrTextVertAdjust maSdrTextVertAdjust; - - // bitfield - unsigned mbContour : 1; - unsigned mbFitToSize : 1; - unsigned mbHideContour : 1; - unsigned mbBlink : 1; - unsigned mbScroll : 1; - unsigned mbInEditMode : 1; - unsigned mbFixedCellHeight : 1; + ImpSdrTextAttribute* mpSdrTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrTextAttribute( const SdrText& rSdrText, - const OutlinerParaObject& rOutlinerParaObjectPtr, + const OutlinerParaObject& rOutlinerParaObject, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, @@ -95,38 +79,46 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode, - bool bFixedCellHeight); - ~SdrTextAttribute(); - - // copy constructor and assigment operator + bool bFixedCellHeight, + bool bWrongSpell); + SdrTextAttribute(); SdrTextAttribute(const SdrTextAttribute& rCandidate); SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate); + ~SdrTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrTextAttribute& rCandidate) const; - // data access - const SdrText& getSdrText() const { return *mpSdrText; } - const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } - bool isContour() const { return mbContour; } - 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; } - bool isFixedCellHeight() const { return mbFixedCellHeight; } - const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } - sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } - sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } - sal_Int32 getTextRightDistance() const { return maTextRightDistance; } - sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } - sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } - SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } - SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } - - // animation timing generation - void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const; - void getScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const; + // data read access + const SdrText& getSdrText() const; + const OutlinerParaObject& getOutlinerParaObject() const; + bool isContour() const; + bool isFitToSize() const; + bool isHideContour() const; + bool isBlink() const; + bool isScroll() const; + bool isInEditMode() const; + bool isFixedCellHeight() const; + bool isWrongSpell() const; + const SdrFormTextAttribute& getSdrFormTextAttribute() const; + sal_Int32 getTextLeftDistance() const; + sal_Int32 getTextUpperDistance() const; + sal_Int32 getTextRightDistance() const; + sal_Int32 getTextLowerDistance() const; + sal_uInt32 getPropertiesVersion() const; + SdrTextHorzAdjust getSdrTextHorzAdjust() const; + SdrTextVertAdjust getSdrTextVertAdjust() const; + + // helpers: animation timing generators + void getBlinkTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList) const; + void getScrollTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList, + double fFrameLength, + double fTextLength) const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx index beb88046dbe8..0b2efdc3d313 100644 --- a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx +++ b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx @@ -30,22 +30,16 @@ #include <svx/sdr/contact/viewcontactofsdrobj.hxx> #include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> +#include <drawinglayer/geometry/viewinformation3d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> ////////////////////////////////////////////////////////////////////////////// // predeclarations class E3dScene; -namespace drawinglayer { - namespace geometry { - class ViewInformation3D; - } - namespace attribute { - class SdrSceneAttribute; - class SdrLightingAttribute; - } -} - namespace basegfx { class B3DRange; } @@ -67,7 +61,6 @@ namespace sdr public: // basic constructor, used from SdrObject. ViewContactOfE3dScene(E3dScene& rScene); - virtual ~ViewContactOfE3dScene(); // access to SdrObject E3dScene& GetE3dScene() const @@ -98,14 +91,14 @@ namespace sdr protected: // the 3d transformation stack - drawinglayer::geometry::ViewInformation3D* mpViewInformation3D; + drawinglayer::geometry::ViewInformation3D maViewInformation3D; // the object transformation - basegfx::B2DHomMatrix* mpObjectTransformation; + basegfx::B2DHomMatrix maObjectTransformation; // attributes - drawinglayer::attribute::SdrSceneAttribute* mpSdrSceneAttribute; - drawinglayer::attribute::SdrLightingAttribute* mpSdrLightingAttribute; + drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute; + drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute; // create methods for ViewInformation3D and ObjectTransformation void createViewInformation3D(const ::basegfx::B3DRange& rContentRange); diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx index 064b87844e0c..da92072fef18 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx @@ -46,9 +46,6 @@ namespace sdr ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact); virtual ~ViewObjectContactOfGroup(); - // test this VOC for visibility concerning model-view stuff like e.g. Layer - virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; - // This method recursively paints the draw hierarchy. virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; }; diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index b1394fe7aa10..9ea424217757 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -46,7 +46,7 @@ namespace drawinglayer { namespace attribute { class SdrShadowTextAttribute; class SdrLineShadowTextAttribute; class SdrLineFillShadowTextAttribute; - class SdrLineFillShadowAttribute; + class SdrLineFillShadowAttribute3D; class SdrSceneAttribute; class SdrLightingAttribute; class SdrFillTextAttribute; @@ -63,13 +63,21 @@ namespace drawinglayer namespace primitive2d { // SdrAttribute creators - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet); - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth); - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet); - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet); + attribute::SdrLineAttribute createNewSdrLineAttribute( + const SfxItemSet& rSet); + + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth); + + attribute::SdrShadowAttribute createNewSdrShadowAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillAttribute createNewSdrFillAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft = 0, @@ -77,20 +85,37 @@ namespace drawinglayer const sal_Int32* pRight = 0, const sal_Int32* pLower = 0); - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet); - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet); - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute( + attribute::FillGradientAttribute createNewTransparenceGradientAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute( + const SfxItemSet& rSet); + + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( const SfxItemSet& rSet, - const SdrText& rText, + const SdrText* pText, 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); - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet); - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet); + + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute( + const SfxItemSet& rSet, + bool bSuppressFill); + + attribute::SdrSceneAttribute createNewSdrSceneAttribute( + const SfxItemSet& rSet); + + attribute::SdrLightingAttribute createNewSdrLightingAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, const SdrText* pSdrText, const sal_Int32* pLeft = 0, @@ -99,7 +124,11 @@ namespace drawinglayer const sal_Int32* pLower = 0); // helpers - void calculateRelativeCornerRadius(sal_Int32 nRadius, const ::basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY); + void calculateRelativeCornerRadius( + sal_Int32 nRadius, + const ::basegfx::B2DRange& rObjectRange, + double& rfCornerRadiusX, + double& rfCornerRadiusY); } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx index e55d5e16b86f..b8039fd33c61 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -30,8 +30,8 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx index 8367e2f4d2f1..d532d733e60e 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -29,8 +29,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> +#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index a259dc1d7282..9b2a12e5d386 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -29,8 +29,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/attribute/sdrshadowtextattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx index 3b0ad25700f2..7ef8f3a3f476 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx @@ -54,22 +54,22 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference createPolyPolygonFillPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient = 0L); + const attribute::FillGradientAttribute& rFillGradient); Primitive2DReference createPolygonLinePrimitive( - const ::basegfx::B2DPolygon& rUnitPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolygon& rUnitPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke = 0L); + const attribute::SdrLineStartEndAttribute& rStroke); Primitive2DReference createTextPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds); diff --git a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx index 1ba1eb62187a..84f1dfad9b00 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -30,7 +30,7 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx index 1089253bc60d..f488dfaa2ee4 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -30,9 +30,8 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svtools/grfmgr.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index dba0992a558c..943cbbf65940 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -29,8 +29,7 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> +#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx index 966527a7ec42..45702d3300e3 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -30,8 +30,7 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx index de4d761cd706..0601a0696c49 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -30,8 +30,8 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx index a1319c13b638..b3472b4f13ba 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx @@ -36,7 +36,6 @@ namespace basegfx { class BColor; - class B2DHomMatrix; } ////////////////////////////////////////////////////////////////////////////// @@ -51,10 +50,6 @@ 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/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 9df61ec5a9e0..b5c42d850be0 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -30,8 +30,8 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx b/svx/inc/svx/sdr/properties/oleproperties.hxx index fd62fc35e3e3..009c375dff99 100644 --- a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx +++ b/svx/inc/svx/sdr/properties/oleproperties.hxx @@ -2,10 +2,13 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: graphicproperties.hxx,v $ + * $Revision: 1.6 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -25,46 +28,42 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> -#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> - -////////////////////////////////////////////////////////////////////////////// +#ifndef _SDR_PROPERTIES_OLEPROPERTIES_HXX +#define _SDR_PROPERTIES_OLEPROPERTIES_HXX -using namespace com::sun::star; +#include <svx/sdr/properties/rectangleproperties.hxx> ////////////////////////////////////////////////////////////////////////////// -namespace drawinglayer +namespace sdr { - namespace primitive2d + namespace properties { - AlphaPrimitive2D::AlphaPrimitive2D( - const Primitive2DSequence& rChildren, - const Primitive2DSequence& rAlpha) - : GroupPrimitive2D(rChildren), - maAlpha(rAlpha) + class OleProperties : public RectangleProperties { - } + protected: + public: + // basic constructor + OleProperties(SdrObject& rObj); - bool AlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const AlphaPrimitive2D& rCompare = (AlphaPrimitive2D&)rPrimitive; + // constructor for copying, but using new object + OleProperties(const OleProperties& rProps, SdrObject& rObj); - return (getAlpha() == rCompare.getAlpha()); - } + // destructor + virtual ~OleProperties(); - return false; - } + // Clone() operator, normally just calls the local copy constructor + virtual BaseProperties& Clone(SdrObject& rObj) const; - // provide unique ID - ImplPrimitrive2DIDBlock(AlphaPrimitive2D, PRIMITIVE2D_ID_ALPHAPRIMITIVE2D) - } // end of namespace primitive2d -} // end of namespace drawinglayer + // force default attributes for a specific object type, called from + // DefaultProperties::GetObjectItemSet() if a new ItemSet is created + virtual void ForceDefaultAttributes(); + }; + } // end of namespace properties +} // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_PROPERTIES_OLEPROPERTIES_HXX + // eof diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 14409698db9e..8325d2a57fa1 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -34,6 +34,7 @@ ////////////////////////////////////////////////////////////////////////////// // predeclarations class SdrObject; +class SfxItemSet; namespace sdr { @@ -49,17 +50,20 @@ namespace sdr { class MasterPageDescriptor : public sdr::PageUser { + private: SdrPage& maOwnerPage; SdrPage& maUsedPage; SetOfByte maVisibleLayers; // ViewContact part sdr::contact::ViewContact* mpViewContact; - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); // assignment operator defined, but not implemented void operator=(const MasterPageDescriptor& rCandidate); + protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage); virtual ~MasterPageDescriptor(); @@ -86,8 +90,7 @@ namespace sdr sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; - // #i42075# Get the correct BackgroundObject - SdrObject* GetBackgroundObject() const; + const SfxItemSet& getCorrectFillAttributes() const; }; } // end of namespace sdr diff --git a/svx/inc/svx/sphere3d.hxx b/svx/inc/svx/sphere3d.hxx index 29813105374f..90dfca18c173 100644 --- a/svx/inc/svx/sphere3d.hxx +++ b/svx/inc/svx/sphere3d.hxx @@ -41,15 +41,12 @@ class SVX_DLLPUBLIC E3dSphereObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - basegfx::B3DPoint aCenter; basegfx::B3DVector aSize; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index 442b1dae7793..6d19b3f6ade0 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -85,15 +85,16 @@ struct SdrCustomShapeInteraction class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj { +private: // fObjectRotation is containing the object rotation in degrees. double fObjectRotation; -private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +public: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // to allow sdr::properties::CustomShapeProperties access friend class sdr::properties::CustomShapeProperties; diff --git a/svx/inc/svx/svdoattr.hxx b/svx/inc/svx/svdoattr.hxx index 9b10ec3b3405..9c50c633ad72 100644 --- a/svx/inc/svx/svdoattr.hxx +++ b/svx/inc/svx/svdoattr.hxx @@ -52,11 +52,12 @@ class SfxItemPool; class SVX_DLLPUBLIC SdrAttrObj : public SdrObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: friend class SdrOutliner; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + Rectangle maSnapRect; protected: diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index 7d2f5b483e5b..7acc69ab5b9f 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -423,6 +423,7 @@ public: // BaseProperties section private: sdr::properties::BaseProperties* mpProperties; +protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); public: virtual sdr::properties::BaseProperties& GetProperties() const; @@ -431,6 +432,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; @@ -1097,11 +1099,6 @@ public: sal_Bool IsTransparent( BOOL bCheckForAlphaChannel = FALSE ) const; - // #111111# - // Needed again and again i will now add a test for finding out if - // this object is the BackgroundObject of the page. - sal_Bool IsMasterPageBackgroundObject() const; - // #116168# // Give info if object is in destruction sal_Bool IsInDestruction() const; diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx index c2857e026ce1..24a11e6b51de 100644 --- a/svx/inc/svx/svdocapt.hxx +++ b/svx/inc/svx/svdocapt.hxx @@ -60,19 +60,16 @@ public: class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); private: - // to allow sdr::properties::CaptionProperties access to ImpRecalcTail() friend class sdr::properties::CaptionProperties; - friend class SdrTextObj; // fuer ImpRecalcTail() bei AutoGrow protected: - // DrawContact section -private: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: Polygon aTailPoly; // das ganze Polygon des Schwanzes sal_Bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE sal_Bool mbFixedTail; // for calc note box fixed tail, default FALSE diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx index 8ed5406d2cbf..a39417925a1e 100644 --- a/svx/inc/svx/svdocirc.hxx +++ b/svx/inc/svx/svdocirc.hxx @@ -58,20 +58,17 @@ public: class SVX_DLLPUBLIC SdrCircObj : public SdrRectObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo() friend class sdr::properties::CircleProperties; // only for SdrCircleAttributes SdrObjKind GetCircleKind() const { return meCircleKind; } - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: - SdrObjKind meCircleKind; + SdrObjKind meCircleKind; long nStartWink; long nEndWink; diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx index 654e2fd6ddf2..843c49424674 100644 --- a/svx/inc/svx/svdoedge.hxx +++ b/svx/inc/svx/svdoedge.hxx @@ -157,19 +157,16 @@ public: class SVX_DLLPUBLIC SdrEdgeObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo() friend class sdr::properties::ConnectorProperties; friend class SdrCreateView; friend class ImpEdgeHdl; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjConnection aCon1; // Verbindungszustand des Linienanfangs SdrObjConnection aCon2; // Verbindungszustand des Linienendes diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 47bd6f2ad38a..89e2d35c9220 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -85,22 +85,16 @@ class SdrGraphicLink; class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj { private: - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // to allow sdr::properties::GraphicProperties access to SetXPolyDirty() friend class sdr::properties::GraphicProperties; // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink() friend class sdr::contact::ViewObjectContactOfGraphic; - friend class SdrGraphicLink; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren void ImpSetGrafInfoToAttr(); // Werte in den Pool kopieren diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index 28abd0453869..440e758291ca 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -46,14 +46,11 @@ class SfxItemSet; class SVX_DLLPUBLIC SdrObjGroup : public SdrObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // #110094# DrawContact section private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjList* pSub; // Subliste (Kinder) long nDrehWink; long nShearWink; @@ -66,6 +63,7 @@ public: SdrObjGroup(); virtual ~SdrObjGroup(); + virtual void SetBoundRectDirty(); virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual SdrLayerID GetLayer() const; diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx index e48016096fc3..fe8740dd40ed 100644 --- a/svx/inc/svx/svdomeas.hxx +++ b/svx/inc/svx/svdomeas.hxx @@ -66,18 +66,15 @@ public: class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::MeasureProperties access to SetTextDirty() friend class sdr::properties::MeasureProperties; friend class SdrMeasureField; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: Point aPt1; Point aPt2; FASTBOOL bTextDirty; diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx index c5fd58727869..b572bb989451 100644 --- a/svx/inc/svx/svdomedia.hxx +++ b/svx/inc/svx/svdomedia.hxx @@ -80,11 +80,10 @@ public: protected: virtual void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState ); + virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); private: - virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - ::avmedia::MediaItem maMediaProperties; ::std::auto_ptr< Graphic > mapGraphic; }; diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx index 6cb95ae9c504..79933be98a9b 100644 --- a/svx/inc/svx/svdoole2.hxx +++ b/svx/inc/svx/svdoole2.hxx @@ -59,11 +59,10 @@ private: SVX_DLLPRIVATE void GetObjRef_Impl(); SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf); - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: svt::EmbeddedObjectRef xObjRef; Graphic* pGraphic; String aProgName; diff --git a/svx/inc/svx/svdopage.hxx b/svx/inc/svx/svdopage.hxx index 328ea97faf6b..eea49236531e 100644 --- a/svx/inc/svx/svdopage.hxx +++ b/svx/inc/svx/svdopage.hxx @@ -41,17 +41,14 @@ public: virtual void PageInDestruction(const SdrPage& rPage); private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // #111111# // To make things more safe, remember the page, not a number SdrPage* mpShownPage; +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + public: TYPEINFO(); SdrPageObj(SdrPage* pNewPage = 0L); diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx index 665d84a2a168..4ed1deb47f1f 100644 --- a/svx/inc/svx/svdopath.hxx +++ b/svx/inc/svx/svdopath.hxx @@ -62,13 +62,12 @@ public: class SVX_DLLPUBLIC SdrPathObj : public SdrTextObj { +private: friend class ImpPathForDragAndCreate; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: basegfx::B2DPolyPolygon maPathPolygon; SdrObjKind meKind; diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx index 8deac2350e6c..b333ed8757f1 100644 --- a/svx/inc/svx/svdorect.hxx +++ b/svx/inc/svx/svdorect.hxx @@ -51,19 +51,14 @@ namespace sdr { namespace properties { class SVX_DLLPUBLIC SdrRectObj : public SdrTextObj { private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::RectangleProperties access to SetXPolyDirty() friend class sdr::properties::RectangleProperties; - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - friend class SdrTextObj; // wg SetXPolyDirty bei GrowAdjust protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + XPolygon* mpXPoly; protected: diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index a11b31ab9b57..a40b33c3ad18 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -312,14 +312,10 @@ public: private: void init( sal_Int32 nColumns, sal_Int32 nRows ); - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: virtual SdrObjGeoData* NewGeoData() const; virtual void SaveGeoData(SdrObjGeoData& rGeo) const; virtual void RestGeoData(const SdrObjGeoData& rGeo); diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index b48227f0e1e6..3a15d33f2cdd 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -142,13 +142,11 @@ private: // CustomShapeproperties need to access the "bTextFrame" member: friend class sdr::properties::CustomShapeProperties; - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: // This method is only allowed for sdr::properties::TextProperties SVX_DLLPRIVATE SdrOutliner* GetTextEditOutliner() const { diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx index da0066b70ae7..2c1f1ae0878c 100644 --- a/svx/inc/svx/svdovirt.hxx +++ b/svx/inc/svx/svdovirt.hxx @@ -46,11 +46,9 @@ class SVX_DLLPUBLIC SdrVirtObj : public SdrObject public: virtual sdr::properties::BaseProperties& GetProperties() const; -private: - // AW, OD 2004-05-03 #i27224# +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: SdrObject& rRefObj; // Referenziertes Zeichenobjekt Rectangle aSnapRect; diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index f11d41970451..29cf17ec9180 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -29,58 +29,26 @@ #define _SVDPAGE_HXX #include <vcl/bitmap.hxx> - -#ifndef _PRINT_HXX //autogen #include <vcl/print.hxx> -#endif -#ifndef _GDIMTF_HXX //autogen #include <vcl/gdimtf.hxx> -#endif #include <tools/weakbase.hxx> #include <cppuhelper/weakref.hxx> #include <svx/svdtypes.hxx> #include <svx/svdlayer.hxx> - -////////////////////////////////////////////////////////////////////////////// -// sdr::Comment interface #include <svx/sdrcomment.hxx> - -// #111111# #include <vector> #include <svx/sdrpageuser.hxx> - -// StandardCheckVisisbilityRedirector #include <svx/sdr/contact/viewobjectcontactredirector.hxx> #include <svx/sdrmasterpagedescriptor.hxx> #include "svx/svxdllapi.h" - #include <com/sun/star/container/XIndexAccess.hpp> #include <svx/svdobj.hxx> #include <boost/scoped_ptr.hpp> -// #110094# -namespace sdr -{ - namespace contact - { - class ViewContact; - } // end of namespace contact -} // end of namespace sdr - -// ------------------------------ -// - intern benutzte Paint-Modi - -// ------------------------------ - -//#if 0 // _SOLAR__PRIVATE - -#define IMP_PAGEPAINT_NORMAL 0 -#define IMP_PAGEPAINT_PREPARE_CACHE 1 -#define IMP_PAGEPAINT_PAINT_CACHE 2 -#define IMP_PAGEPAINT_PREPARE_BG_CACHE 3 -#define IMP_PAGEPAINT_PAINT_BG_CACHE 4 - -//#endif // __PRIVATE +////////////////////////////////////////////////////////////////////////////// +// predefines +namespace sdr { namespace contact { class ViewContact; }} class SdrPage; class SdrModel; class SfxItemPool; @@ -110,7 +78,11 @@ public: SdrInsertReasonKind GetReason() const { return eReason; } }; -class SVX_DLLPUBLIC SdrObjList { +////////////////////////////////////////////////////////////////////////////// +// class SdrObjList + +class SVX_DLLPUBLIC SdrObjList +{ private: typedef ::std::vector<SdrObject*> SdrObjectContainerType; SdrObjectContainerType maList; @@ -347,8 +319,12 @@ Objektes abgefragt sowie direkt gesetzt werden. // Used for all methods which return a page number #define SDRPAGE_NOTFOUND 0xFFFF +////////////////////////////////////////////////////////////////////////////// +// class SdrPageGridFrame + // Fuer das Fangraster/Punkgitter im Writer -class SdrPageGridFrame { +class SdrPageGridFrame +{ Rectangle aPaper; Rectangle aUserArea; public: @@ -380,8 +356,47 @@ public: }; //////////////////////////////////////////////////////////////////////////////////////////////////// +// class SdrPageProperties -class SVX_DLLPUBLIC SdrPage: public SdrObjList, public tools::WeakBase< SdrPage > +class SVX_DLLPUBLIC SdrPageProperties : public SfxListener +{ +private: + // data + SdrPage* mpSdrPage; + SfxStyleSheet* mpStyleSheet; + SfxItemSet* mpProperties; + + // internal helpers + void ImpRemoveStyleSheet(); + void ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet); + + // not implemented + SdrPageProperties& operator=(const SdrPageProperties& rCandidate); + +public: + // construct/destruct + SdrPageProperties(SdrPage& rSdrPage); + SdrPageProperties(const SdrPageProperties& rCandidate); + virtual ~SdrPageProperties(); + + // Notify(...) from baseclass SfxListener + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); + + // data read/write + const SfxItemSet& GetItemSet() const; + void PutItemSet(const SfxItemSet& rSet); + void PutItem(const SfxPoolItem& rItem); + void ClearItem(const sal_uInt16 nWhich = 0); + + // StyleSheet access + void SetStyleSheet(SfxStyleSheet* pStyleSheet); + SfxStyleSheet* GetStyleSheet() const; +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// class SdrPage + +class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage > { /////////////////////////////////////////////////////////////////////////////// // start PageUser section @@ -400,6 +415,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; @@ -426,9 +442,15 @@ friend class ChXChartDocument; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoPage; protected: - SdrLayerAdmin* pLayerAdmin; - SdrObject* pBackgroundObj; + SdrLayerAdmin* pLayerAdmin; +private: + SdrPageProperties* mpSdrPageProperties; +public: + SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; } + const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; } + +protected: // new MasterPageDescriptorVector ::sdr::MasterPageDescriptor* mpMasterPageDescriptor; @@ -533,9 +555,6 @@ public: bool IsSwappingLocked() const { return mbSwappingLocked; } void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; } - SdrObject* GetBackgroundObj() const { return pBackgroundObj; } - void SetBackgroundObj( SdrObject* pObj ); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage(); virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const; @@ -563,8 +582,8 @@ public: /** Check if page is the HandoutMasterPage (in SVX, no PK_HANDOUT available) */ bool isHandoutMasterPage() const; -////////////////////////////////////////////////////////////////////////////// -// sdr::Comment interface + ////////////////////////////////////////////////////////////////////////////// + // sdr::Comment interface private: sdr::CommentVector maComments; @@ -573,8 +592,6 @@ public: const sdr::Comment& GetCommentByIndex(sal_uInt32 nIndex); void AddComment(const sdr::Comment& rNew); void ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew); - -////////////////////////////////////////////////////////////////////////////// }; typedef tools::WeakReference< SdrPage > SdrPageWeakRef; diff --git a/svx/inc/svx/unomodel.hxx b/svx/inc/svx/unomodel.hxx index dd60be206c2e..35d53a655a86 100644 --- a/svx/inc/svx/unomodel.hxx +++ b/svx/inc/svx/unomodel.hxx @@ -99,12 +99,12 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); }; -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xOut ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pExportService ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pImportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pExportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pImportService ); #endif diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 8b4675feb3e9..7d2f508d9d21 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -637,6 +637,9 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlayselection.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayselection.hxx ..\inc\svx\sdr\overlay\overlaytools.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytools.hxx +mkdir: %_DEST%\inc%_EXT%\svx\sdr\primitive2d +..\inc\svx\sdr\primitive2d\sdrprimitivetools.hxx %_DEST%\inc%_EXT%\svx\sdr\primitive2d\sdrprimitivetools.hxx + mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation ..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx ..\inc\svx\sdr\animation\ainfoscrolltext.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfoscrolltext.hxx diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 8c245a11862f..5f243b90067d 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -13165,31 +13165,6 @@ SfxVoidItem SpellCheckerChanged SID_SPELLCHECKER_CHANGED ] //-------------------------------------------------------------------------- -SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - -//-------------------------------------------------------------------------- SfxUInt16Item Year2000 SID_ATTR_YEAR2000 () [ diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index e498acd0bdef..1c342f5dbfba 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -142,6 +142,8 @@ namespace accessibility { return XubString(); } + void FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) {;} + BOOL IsValid() const { return sal_True; } void SetNotifyHdl( const Link& ) {} diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 48eb2ba6a884..25bed87a23ad 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -49,10 +49,6 @@ #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleComponent.hpp> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/AccessibleTextType.hpp> -#include <com/sun/star/accessibility/XAccessibleText.hpp> -#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <comphelper/accessibleeventnotifier.hxx> #include <unotools/accessiblestatesethelper.hxx> diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 44ef425c05cb..28ad49c6b65f 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1706,19 +1706,6 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { - if( !bLineGeometryNeededOnly ) - { - // hack aNewB2DPolyPolygon to fill logic rect - this is - // needed to produce gradient fills that look like mso - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), - aLogicRect.GetHeight())); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - } // #i37011# bool bForceCreateTwoObjects(false); diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index fe884859afcd..95c27a5dcec8 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -511,8 +511,17 @@ void Svx3DLightControl::TrySelection(Point aPosPixel) if(aResult.size()) { - // take the frontmost one - const E3dCompoundObject* pResult = aResult[0]; + // exclude expansion object which will be part of + // the hits. It's invisible, but for HitTest, it's included + const E3dCompoundObject* pResult = 0; + + for(sal_uInt32 b(0); !pResult && b < aResult.size(); b++) + { + if(aResult[b] && aResult[b] != mpExpansionObject) + { + pResult = aResult[b]; + } + } if(pResult == mp3DObj) { @@ -777,8 +786,8 @@ void Svx3DLightControl::GetPosition(double& rHor, double& rVer) } if(IsGeometrySelected()) { - rHor = mfRotateY; - rVer = mfRotateX; + rHor = mfRotateY / F_PI180; // 0..360.0 + rVer = mfRotateX / F_PI180; // -90.0..90.0 } } @@ -821,8 +830,8 @@ void Svx3DLightControl::SetPosition(double fHor, double fVer) { if(mfRotateX != fVer || mfRotateY != fHor) { - mfRotateX = fVer; - mfRotateY = fHor; + mfRotateX = fVer * F_PI180; + mfRotateY = fHor * F_PI180; if(mp3DObj) { diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx index 117b3b3a9beb..c7c9f7a22939 100644 --- a/svx/source/dialog/hyprlink.cxx +++ b/svx/source/dialog/hyprlink.cxx @@ -482,7 +482,7 @@ void SvxHyperlinkDlg::TargetMenu(const String& rSelEntry, BOOL bExecute) if (pVwFrm) // Alle moeglichen Target Frames zusammensammeln und anzeigen { TargetList aList; - pVwFrm->GetTopFrame()->GetTargetList(aList); + pVwFrm->GetTopFrame().GetTargetList(aList); USHORT nCount = (USHORT)aList.Count(); if( nCount ) @@ -960,7 +960,7 @@ void SvxHyperlinkDlg::OpenDoc( const String& rURL, SfxViewFrame* pViewFrame ) if ( pViewFrame ) { - SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? pViewFrame->GetFrame() : NULL ); + SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? &pViewFrame->GetFrame() : NULL ); if ( pDisp ) pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aName, &aView, &aNewView, &aSilent, &aReadOnly, &aReferer, &aExternal, 0L ); diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index f2cabe5fa4e1..5a5839443170 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -321,7 +321,7 @@ void SvxRubyDialog::Activate() aStylistPB.Enable(bEnable); //get selection from current view frame SfxViewFrame* pCurFrm = SfxViewFrame::Current(); - Reference< XController > xCtrl = pCurFrm->GetFrame()->GetController(); + Reference< XController > xCtrl = pCurFrm->GetFrame().GetController(); pImpl->SetController(xCtrl); if(pImpl->HasSelectionChanged()) { diff --git a/svx/source/dialog/srchdlg.src b/svx/source/dialog/srchdlg.src index a91c5c00aa6b..52c91d17587d 100644 --- a/svx/source/dialog/srchdlg.src +++ b/svx/source/dialog/srchdlg.src @@ -237,7 +237,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 163 ) ; Size = MAP_APPFONT ( 126 , 10 ) ; - Text [ en-US ] = "Current selection ~only" ; + Text [ en-US ] = "C~urrent selection only" ; TabStop = TRUE ; Hide = TRUE ; }; @@ -346,7 +346,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 285 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Search in" ; + Text [ en-US ] = "Search i~n" ; Hide = TRUE ; }; ListBox LB_CALC_SEARCHIN @@ -368,7 +368,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 300 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Search direction" ; + Text [ en-US ] = "Search ~direction" ; Hide = TRUE ; }; RadioButton RB_CALC_ROWS @@ -382,7 +382,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 75 , 313 ) ; Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "Col~umns" ; + Text [ en-US ] = "Colu~mns" ; Hide = TRUE ; }; CheckBox CB_ALL_SHEETS diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 060ab1bd8212..fd44db7b02d9 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -67,8 +67,33 @@ E3dDragMethod::E3dDragMethod ( // eine Unit anlegen const long nCnt(rMark.GetMarkCount()); static bool bDoInvalidate(false); + long nObjs(0); - for(long nObjs = 0;nObjs < nCnt;nObjs++) + if(mbMoveFull) + { + // for non-visible 3D objects fallback to wireframe interaction + bool bInvisibleObjects(false); + + for(nObjs = 0;!bInvisibleObjects && nObjs < nCnt;nObjs++) + { + E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); + + if(pE3dObj) + { + if(!pE3dObj->HasFillStyle() && !pE3dObj->HasLineStyle()) + { + bInvisibleObjects = true; + } + } + } + + if(bInvisibleObjects) + { + mbMoveFull = false; + } + } + + for(nObjs = 0;nObjs < nCnt;nObjs++) { E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 4457ec9af55e..d799aec38eb7 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -334,6 +334,12 @@ UINT16 E3dScene::GetObjIdentifier() const return E3D_SCENE_ID; } +void E3dScene::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + /************************************************************************* |* |* SetSnapRect diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 9ed80caed932..97fee2250658 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -71,7 +71,7 @@ #include <svx/sdr/contact/displayinfo.hxx> #include <svx/sdr/contact/objectcontact.hxx> #include <svx/sdr/contact/viewobjectcontact.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> @@ -205,8 +205,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr // if we have full overlay from selected objects, embed with 50% transparence, the // transformation is added to the OverlayPrimitive2DSequenceObject - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aContent, 0.5)); - aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aContent, 0.5)); + aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayPrimitive2DSequenceObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aContent); diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 0db7b43afb47..e22ee66e0ea2 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1608,7 +1608,7 @@ namespace svxform DBG_ASSERT( pBindings != NULL, "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" ); m_xFrame = Reference<XFrame>( - pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), + pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 5e4f30bd7c83..bcc275896410 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -245,7 +245,7 @@ FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBinding if ( _pBindings->GetDispatcher() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier > - xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); // if ( xSupp.is() ) // xSupp->getFrames()->append( m_xMeAsFrame ); // Don't append frame to frame hierachy to prevent UI_DEACTIVATE messages diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 6a62340b04a6..e679779887a2 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -516,7 +516,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > while (nCurrentSourceIndex <= nIndex) { sal_Bool bEqualDSS = sal_False; - while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bounded by nIndex) + while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bound by nIndex) { xSourceContainer->getByIndex(nCurrentSourceIndex) >>= xCurrentSourceForm; DBG_ASSERT(xCurrentSourceForm.is(), "FmFormObj::ensureModelEnv : invalid form ancestor (2) !"); @@ -578,12 +578,11 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > // correct this ... try { - Reference< XPersistObject > xSourcePersist(xCurrentSourceForm, UNO_QUERY); - DBG_ASSERT(xSourcePersist.is(), "FmFormObj::ensureModelEnv : invalid form (no persist object) !"); - - // create and insert (into the destination) a clone of the form - Reference< XCloneable > xCloneable( xSourcePersist, UNO_QUERY_THROW ); - xCurrentDestForm.set( xCloneable->createClone(), UNO_QUERY_THROW ); + // create and insert (into the destination) a copy of the form + xCurrentDestForm.set( + ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.form.component.DataForm" ) ), + UNO_QUERY_THROW ); + ::comphelper::copyProperties( xCurrentSourceForm, xCurrentDestForm ); DBG_ASSERT(nCurrentDestIndex == xDestContainer->getCount(), "FmFormObj::ensureModelEnv : something went wrong with the numbers !"); xDestContainer->insertByIndex(nCurrentDestIndex, makeAny(xCurrentDestForm)); @@ -601,7 +600,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > } } - // now xCurrentDestForm is a form aequivalent to xSourceForm (which means they have the same DSS and the same number + // now xCurrentDestForm is a form equivalent to xSourceForm (which means they have the same DSS and the same number // of left siblings with the same DSS, which counts for all their ancestors, too) // go down diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 1d22ae5e9516..f507068b6e2d 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -298,9 +298,6 @@ sal_uInt16 FmFormShell::PrepareClose(sal_Bool bUI, sal_Bool bForBrowsing) m_pFormView && m_pFormView->GetActualOutDev() && m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW) { - if (GetImpl()->HasAnyPendingCursorAction()) - GetImpl()->CancelAnyPendingCursorAction(); - SdrPageView* pCurPageView = m_pFormView->GetSdrPageView(); // sal_uInt16 nPos = pCurPageView ? pCurPageView->GetWinList().Find((OutputDevice*)m_pFormView->GetActualOutDev()) : SDRPAGEVIEWWIN_NOTFOUND; @@ -1128,9 +1125,6 @@ void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) || m_bDesignMode || !GetImpl()->getActiveForm().is() || GetImpl()->isInFilterMode() - || ( GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) - && (SID_FM_RECORD_TOTAL != nWhich) - ) ) rSet.DisableItem(nWhich); else @@ -1417,11 +1411,6 @@ void FmFormShell::SetDesignMode( sal_Bool _bDesignMode ) if ( _bDesignMode == m_bDesignMode ) return; - // if we are moving our data source cursor currently .... - if ( GetImpl()->HasAnyPendingCursorAction() ) - // ... cancel this - GetImpl()->CancelAnyPendingCursorAction(); - FmFormModel* pModel = GetFormModel(); if (pModel) // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 79def586af27..463749b68364 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -570,11 +570,6 @@ sal_Bool FmXBoundFormFieldIterator::ShouldHandleElement(const Reference< XInterf return aVal.hasValue(); } -//============================================================================== - -DECL_CURSOR_ACTION_THREAD(FmMoveToLastThread) -IMPL_CURSOR_ACTION_THREAD(FmMoveToLastThread, SVX_RES(RID_STR_MOVING_CURSOR), last()); - //------------------------------------------------------------------------------ sal_Bool isControlList(const SdrMarkList& rMarkList) { @@ -684,9 +679,8 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame ) m_aMarkTimer.SetTimeout(100); m_aMarkTimer.SetTimeoutHdl(LINK(this,FmXFormShell,OnTimeOut)); - SfxFrame* pFrame = _pViewFrame ? _pViewFrame->GetFrame() : NULL; - if ( pFrame ) - m_xAttachedFrame = pFrame->GetFrameInterface(); + if ( _pViewFrame ) + m_xAttachedFrame = _pViewFrame->GetFrame().GetFrameInterface(); // to prevent deletion of this we acquire our refcounter once ::comphelper::increment(FmXFormShell_BASE::m_refCount); @@ -988,8 +982,6 @@ void FmXFormShell::disposing() { ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); - if (HasAnyPendingCursorAction()) - CancelAnyPendingCursorAction(); aGuard.clear(); DBG_ASSERT(!m_nInvalidationEvent, "FmXFormShell::~FmXFormShell : still have an invalidation event !"); @@ -1982,10 +1974,6 @@ void FmXFormShell::setActiveController( const Reference< runtime::XFormControlle if (xController != m_xActiveController) { - // if there is a async cursor action running we have to restore the locking state of the controls of the old controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - restoreControlLocks(); - ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); // switch all nav dispatchers belonging to the form of the current nav controller to 'non active' Reference< XResultSet> xNavigationForm; @@ -2065,10 +2053,6 @@ void FmXFormShell::setActiveController( const Reference< runtime::XFormControlle if (m_xNavigationController.is()) xNavigationForm = Reference< XResultSet>(m_xNavigationController->getModel(), UNO_QUERY); - // if there is a async cursor action running we have to lock the controls of the new controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - setControlLocks(); - m_bInActivate = sal_False; m_pShell->UIFeatureChanged(); @@ -3313,312 +3297,6 @@ void FmXFormShell::clearFilter() } //------------------------------------------------------------------------------ -void FmXFormShell::setControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::setControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - DBG_ASSERT( m_aControlLocks.empty(), "FmXFormShell::setControlLocks: locking state array isn't empty (called me twice ?)!" ); - - Sequence< Reference< XControl> > aControls = xControls->getControls(); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, remember the old locking state, set the lock - for (sal_Int32 i=0; i<aControls.getLength(); ++i) - { - Reference< XBoundControl> xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; j<xContainer->getCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } - } - continue; - } - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } -} - -//------------------------------------------------------------------------------ -void FmXFormShell::restoreControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::restoreControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - Sequence< Reference< XControl> > aControls(xControls->getControls()); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, restore the old locking state - size_t nBoundControl = 0; - for (sal_Int32 i=0; i<aControls.getLength(); ++i) - { - Reference< XBoundControl> xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; j<xContainer->getCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - } - continue; - } - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - // a violation of this condition would mean a) setControlLocks hasn't been called or b) the ControlContainer - // has changed since the last call to setControlLocks. - // a) clearly is a fault of the programmer and b) shouldn't be possible (as we are in alive mode) - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - ::std::vector< sal_Bool > aEmpty; - m_aControlLocks.swap( aEmpty ); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< runtime::XFormController >& _xController, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - DBG_ASSERT(_xController.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - DoAsyncCursorAction(Reference< XResultSet>(_xController->getModel(), UNO_QUERY), _eWhat); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< XResultSet>& _xForm, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - DBG_ASSERT(_xForm.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - - // build the access path for the form - if (HasPendingCursorAction(_xForm)) - { - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : invalid call !"); - return; - } - - CursorActionDescription& rDesc = m_aCursorActions[ _xForm ]; - // [] will create a new one if non-existent - DBG_ASSERT(rDesc.pThread == NULL, "FmXFormShell::DoAsyncCursorAction : the cursor action thread for this form is still alive !"); - - Reference< XResultSet > xCursor( getInternalForm( _xForm ), UNO_QUERY ); - switch (_eWhat) - { - case CA_MOVE_TO_LAST : - rDesc.pThread = new FmMoveToLastThread( xCursor ); - break; - case CA_MOVE_ABSOLUTE: - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : CA_MOVE_ABSOLUTE not supported yet !"); - return; - } - rDesc.pThread->SetTerminationHdl(LINK(this, FmXFormShell, OnCursorActionDone)); - rDesc.pThread->EnableSelfDelete(sal_False); - - rDesc.bCanceling = sal_False; - - // set the control locks before starting the thread - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - if (getInternalForm(_xForm) == m_xActiveForm) - setControlLocks(); - - // go ... - rDesc.pThread->create(); - - // set a priority slightly below normal - rDesc.pThread->setPriority(::vos::OThread::TPriority_BelowNormal); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< XResultSet>& _xForm) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!_xForm.is()) - return sal_False; - - // TODO: if we ever re-implement the asynchronous cursor actions, then this will happen - // in the controller, and not in the form. In such a case, we here probably need to check - // whether the controller for the form has this "pending cursor action" - - return sal_False; -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< runtime::XFormController >& xController) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!xController.is()) - return sal_False; - - return HasPendingCursorAction(Reference< XResultSet>(xController->getModel(), UNO_QUERY)); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasAnyPendingCursorAction() const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasAnyPendingCursorAction" ); - ::osl::MutexGuard aGuard( const_cast< FmXFormShell* >( this )->m_aAsyncSafety ); - - for ( CursorActions::const_iterator aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter ) - { - if (((*aIter).second.pThread != NULL) || ((*aIter).second.nFinishedEvent != 0)) - return sal_True; - } - return sal_False; -} - -//------------------------------------------------------------------------------ -void FmXFormShell::CancelAnyPendingCursorAction() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::CancelAnyPendingCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::ResettableMutexGuard aGuard( m_aAsyncSafety ); - - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if (!(*aIter).second.nFinishedEvent && (*aIter).second.pThread) - { // the thread is really running - (*aIter).second.bCanceling = sal_True; - - aGuard.clear(); - (*aIter).second.pThread->StopItWait(); - // StopItWait returns after the termination handler (our OnCursorActionDone) has been called - aGuard.reset(); - } - } - - // all threads are finished (means canceled), now do the cleanup - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread) - { - LINK(this, FmXFormShell, OnCursorActionDoneMainThread).Call((*aIter).second.pThread); - DBG_ASSERT((*aIter).second.pThread == NULL, "FmXFormShell::CancelAnyPendingCursorAction : strange behaviour of OnCursorActionDoneMainThread !"); - } - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDone, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread == pThread) - break; - } - - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDone : could not ::std::find the thread !"); - DBG_ASSERT((*aIter).second.nFinishedEvent == 0, "FmXFormShell::OnCursorActionDone : another 'ActionDone' for this thread is pending !"); - // as we allow only one async action at a time (per form) this shouldn't happen - - if (!(*aIter).second.bCanceling) - (*aIter).second.nFinishedEvent = Application::PostUserEvent(LINK(this, FmXFormShell, OnCursorActionDoneMainThread), pThread); - // if bCanceling is sal_True an other thread's execution is in CancelAnyPendingCursorAction - return 0L; -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDoneMainThread, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter = m_aCursorActions.find( pThread->getDataSource() ); - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDoneMainThread : could not ::std::find the thread data !"); - DBG_ASSERT((*aIter).second.pThread == pThread, "FmXFormShell::OnCursorActionDoneMainThread : invalid thread data !"); - - // remember some thread parameters - Reference< XResultSet> xForm(pThread->getDataSource(), UNO_QUERY); - - // throw away the thread - delete (*aIter).second.pThread; - (*aIter).second.pThread = NULL; - (*aIter).second.nFinishedEvent = 0; - (*aIter).second.bCanceling = sal_False; - // as we allow exactly one thread per form we may remove this ones data from m_aCursorActions - m_aCursorActions.erase(aIter); - - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - DBG_ASSERT(getInternalForm(xForm) == xForm, "FmXFormShell::DoAsyncCursorAction : the thread's form should always be a internal one !"); - // if one of the two asserts above fails the upcoming comparison is senseless - if (xForm == m_xActiveForm) - { - // the active controller belongs to the form where the action is finished - // -> re-enable the controls if they are not locked because of another running thread - if (!HasPendingCursorAction(xForm)) - restoreControlLocks(); - } - - m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(DatabaseSlotMap); - // it may not be neccessary but me thinks it's faster without the check if we really have to do this - - return 0L; -} - -//------------------------------------------------------------------------------ void FmXFormShell::CreateExternalView() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::CreateExternalView" ); @@ -4604,155 +4282,4 @@ void ControlConversionMenuController::StateChanged(sal_uInt16 nSID, SfxItemState } } -//================================================================== - -FmCursorActionThread::FmCursorActionThread(const Reference< XResultSet>& _xDataSource, const UniString& _rStopperCaption) - :m_xDataSource(_xDataSource) - ,m_sStopperCaption(_rStopperCaption) - ,m_bCanceled(sal_False) - ,m_bDeleteMyself(sal_False) - ,m_bDisposeCursor(sal_False) - ,m_bTerminated(sal_False) - ,m_bRunFailed(sal_False) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmCursorActionThread::FmCursorActionThread" ); - DBG_ASSERT(m_xDataSource.is() && Reference< XCancellable>(m_xDataSource, UNO_QUERY).is(), - "FmCursorActionThread::FmCursorActionThread : invalid cursor !"); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::run() -{ - // On instantiation of a SfxCancellable the application is notified and 'switches on' the red stop button. - // Unfortunally this is conditioned with the acquirement of the solar mutex, and the application tries - // only once and ignores the notification if it fails. - // To prevent that we get the solar mutex and _block_ 'til we got it. - // As we are in the 'top level execution' of this thread (with a rather small stack and no other mutexes locked) - // we shouldn't experience problems with deadlocks ... - ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex()); - ThreadStopper* pStopper = new ThreadStopper(this, m_sStopperCaption); - aSolarGuard.clear(); - - // we're not canceled yet - ::osl::ClearableMutexGuard aInitGuard(m_aAccessSafety); - m_bCanceled = sal_False; - m_bRunFailed = sal_False; - aInitGuard.clear(); - - // start it - try - { - RunImpl(); - } - catch(SQLException e) - { - ::osl::MutexGuard aErrorGuard(m_aAccessSafety); - m_bRunFailed = sal_True; - m_aRunException = e; - } - catch(Exception&) - { - DBG_ERROR("FmCursorActionThread::run : catched a non-database exception !"); - } - - - sal_Bool bReallyCanceled; - ::osl::ClearableMutexGuard aEvalGuard(m_aAccessSafety); - bReallyCanceled = m_bCanceled; - aEvalGuard.clear(); - - pStopper->OwnerTerminated(); - // this will cause the stopper to delete itself (in the main thread) so we don't have to care of the - // solar mutex -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::onTerminated() -{ - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - if (m_aTerminationHandler.IsSet()) - m_aTerminationHandler.Call(this); - - if (IsCursorDisposeEnabled()) - { - Reference< ::com::sun::star::lang::XComponent> xDataSourceComponent(m_xDataSource, UNO_QUERY); - if (xDataSourceComponent.is()) - xDataSourceComponent->dispose(); - } - - aResetGuard.clear(); - // with this StopItWait has a chance to do it's Terminated() - - ::osl::MutexGuard aGuard(m_aFinalExitControl); - // Terminated() in StopItWait still returns sal_False - m_bTerminated = sal_True; - // Terminated() now returns sal_True, but StopItWait can't exit until this method exits (because of the guarded m_aFinalExitControl) - - if (IsSelfDeleteEnabled()) - delete this; -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopIt() -{ - ::osl::MutexGuard aGuard(m_aAccessSafety); - m_bCanceled = sal_True; - - Reference< XCancellable> xCancel(m_xDataSource, UNO_QUERY); - DBG_ASSERT(xCancel.is(), "FmCursorActionThread::StopIt : invalid cursor !"); - xCancel->cancel(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopItWait() -{ - StopIt(); - - while (!Terminated()) - ; - - // OnTerminated has been called, but we can't simply exit : Suppose the caller want's to delete the thread object - // immediately after returning from StopItWait. With the following guard we ensure that we exit this method - // only after onTerminated has exited. - ::osl::ClearableMutexGuard aGuard(m_aFinalExitControl); - - // now onTerminated has exited, so we can leave, too -} - -//------------------------------------------------------------------------------ -FmCursorActionThread::ThreadStopper::ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle) - :SfxCancellable(SFX_APP()->GetCancelManager(), rTitle) - ,m_pOwner(pOwner) -{ -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::Cancel() -{ - if (!m_pOwner) // the owner is already terminated and we're waiting for the OnDeleteInMainThread event - return; - - ::osl::MutexGuard aGuard(m_pOwner->m_aAccessSafety); - if (IsCancelled()) - // we already did pass this to our owner - return; - - SfxCancellable::Cancel(); - m_pOwner->StopIt(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::OwnerTerminated() -{ - m_pOwner = NULL; - Application::PostUserEvent(LINK(this, FmCursorActionThread::ThreadStopper, OnDeleteInMainThread), this); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmCursorActionThread::ThreadStopper, OnDeleteInMainThread, FmCursorActionThread::ThreadStopper*, pThis) -{ - delete pThis; - return 0L; -} - //============================================================================== diff --git a/svx/source/form/fmstring.src b/svx/source/form/fmstring.src index 681f05219424..8e3df1a8cdf5 100644 --- a/svx/source/form/fmstring.src +++ b/svx/source/form/fmstring.src @@ -214,10 +214,6 @@ String RID_STR_PROPTITLE_FORMATTED { Text [ en-US ] = "Formatted Field"; }; -String RID_STR_MOVING_CURSOR -{ - Text [ en-US ] = "align data source"; -}; String RID_STR_PROPTITLE_LISTBOX { Text [ en-US ] = "List Box"; diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index affe5579d49d..b8292785b457 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -4254,7 +4254,7 @@ bool FormController::ensureInteractionHandler() return false; m_bAttemptedHandlerCreation = true; - m_xInteractionHandler.set( m_aContext.createComponent( (::rtl::OUString)SRV_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + m_xInteractionHandler.set( m_aContext.createComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY ); OSL_ENSURE( m_xInteractionHandler.is(), "FormController::ensureInteractionHandler: could not create an interaction handler!" ); return m_xInteractionHandler.is(); } diff --git a/svx/source/inc/fmresids.hrc b/svx/source/inc/fmresids.hrc index 2d8058bc45cc..f6843801e522 100644 --- a/svx/source/inc/fmresids.hrc +++ b/svx/source/inc/fmresids.hrc @@ -183,7 +183,7 @@ #define RID_STR_FILTER_FILTER_OR (RID_FORMS_START + 80) #define RID_STR_PROPTITLE_FORMATTED (RID_FORMS_START + 81) #define RID_STR_SYNTAXERROR (RID_FORMS_START + 82) -#define RID_STR_MOVING_CURSOR (RID_FORMS_START + 83) + // FREE #define RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY (RID_FORMS_START + 84) #define RID_STR_AUTOFIELD (RID_FORMS_START + 89) #define RID_STR_SVT_SQL_SYNTAX_ERROR (RID_FORMS_START + 90) diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx index b06a57148979..d90774cea4ee 100644 --- a/svx/source/inc/fmservs.hxx +++ b/svx/source/inc/fmservs.hxx @@ -56,7 +56,6 @@ #define FM_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.GridControl" ) ) #define FM_FORM_CONTROLLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.runtime.FormController" ) ) #define SRV_SDB_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.Connection" ) ) -#define SRV_SDB_INTERACTION_HANDLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) #define FM_SUN_COMPONENT_FORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.Form" ) ) #define FM_SUN_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ) ) #define FM_SUN_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ) ) diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index d88f891474be..3f89adb42626 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -68,7 +68,6 @@ #include "fmsrccfg.hxx" #include <osl/mutex.hxx> #include <vos/thread.hxx> -#include <svl/cancel.hxx> #include <tools/debug.hxx> #include <cppuhelper/component.hxx> #include <comphelper/stl_types.hxx> @@ -119,21 +118,6 @@ protected: virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const; }; -//======================================================================== -// I would prefer this to be a struct local to FmXFormShell but unfortunately local structs/classes -// are somewhat difficult with some of our compilers -class FmCursorActionThread; -struct SAL_DLLPRIVATE CursorActionDescription -{ - FmCursorActionThread* pThread; - ULONG nFinishedEvent; - // we want to do the cleanup of the thread in the main thread so we post an event to ourself - sal_Bool bCanceling; - // this thread is being canceled - - CursorActionDescription() : pThread(NULL), nFinishedEvent(0), bCanceling(sal_False) { } -}; - class FmFormPage; //======================================================================== struct SAL_DLLPRIVATE FmLoadAction @@ -202,18 +186,6 @@ class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE // we explicitly switch off the propbrw before leaving the design mode // this flag tells us if we have to switch it on again when reentering - typedef ::std::map< - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >, - CursorActionDescription, - ::comphelper::OInterfaceCompare< ::com::sun::star::sdbc::XResultSet > - > CursorActions; - CursorActions m_aCursorActions; - // all actions on async cursors - - ::std::vector< sal_Bool > - m_aControlLocks; - // while doing a async cursor action we have to lock all controls of the active controller. - // m_aControlLocks remembers the previous lock states to be restored afterwards. ::osl::Mutex m_aAsyncSafety; // secure the access to our thread related members ::osl::Mutex m_aInvalidationSafety; @@ -559,20 +531,7 @@ private: // --------------------------------------------------- // asyncronous cursor actions/navigation slot handling - void setControlLocks(); // lock all controls of the active controller - void restoreControlLocks(); // restore the lock state of all controls of the active controller - public: - enum CURSOR_ACTION { CA_MOVE_TO_LAST, CA_MOVE_ABSOLUTE }; - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& _xController, CURSOR_ACTION _eWhat); - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm, CURSOR_ACTION _eWhat); - - sal_Bool HasAnyPendingCursorAction() const; - void CancelAnyPendingCursorAction(); - - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& _xController) const; - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const; - /** execute the given form slot <p>Warning. Only a small set of slots implemented currently.</p> @param _nSlot @@ -585,9 +544,6 @@ public: bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL ); protected: - DECL_LINK(OnCursorActionDone, FmCursorActionThread*); - DECL_LINK(OnCursorActionDoneMainThread, FmCursorActionThread*); - DECL_LINK( OnLoadForms, FmFormPage* ); }; @@ -642,127 +598,4 @@ public: SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); }; -//================================================================== -// FmCursorActionThread -//================================================================== - -class SAL_DLLPRIVATE FmCursorActionThread : public ::vos::OThread -{ - Link m_aTerminationHandler; // the handler to be called upon termination - ::com::sun::star::sdbc::SQLException m_aRunException; // the database exception thrown by RunImpl - ::osl::Mutex m_aAccessSafety; // for securing the multi-thread access - ::osl::Mutex m_aFinalExitControl; // see StopItWait - -protected: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xDataSource; // the cursor which we work with - -private: - - UniString m_sStopperCaption; // the caption for the ThreadStopper - sal_Bool m_bCanceled:1; // StopIt has been called ? - sal_Bool m_bDeleteMyself:1; // delete the thread upon termination (defaults to sal_False) ? - sal_Bool m_bDisposeCursor:1; // dispose the cursor upon termination (defaults to sal_False) ? - sal_Bool m_bTerminated:1; // onTerminated already called ? - sal_Bool m_bRunFailed:1; // a database execption occured in RunImpl ? - - // a ThreadStopper will be instantiated so that the open can be canceled via the UI - class ThreadStopper : protected SfxCancellable - { - FmCursorActionThread* m_pOwner; - - virtual ~ThreadStopper() { } - - public: - ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle); - - virtual void Cancel(); - - virtual void OwnerTerminated(); - // Normally the Owner (a FmCursorActionThread) would delete the stopper when terminated. - // Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted - // if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have make - // sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked) - // and b) that in the time between the termination of the thread and the deletion of the stopper - // the latter doesn't access the former. - // The OwnerTerminated cares for both aspects. - // SO DON'T DELETE THE STOPPER EXPLICITLY ! - - protected: - // HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then .... - DECL_LINK(OnDeleteInMainThread, ThreadStopper*); - }; - friend class FmCursorActionThread::ThreadStopper; - - -public: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getDataSource() const { return m_xDataSource; } - -private: - sal_Bool Terminated() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bTerminated; } - -public: - FmCursorActionThread(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource, const UniString& _rStopperCaption); - virtual ~FmCursorActionThread() {} - - // control of self-deletion - sal_Bool IsSelfDeleteEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDeleteMyself; } - void EnableSelfDelete(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDeleteMyself = bEnable; } - - // control of cursor-dipose - sal_Bool IsCursorDisposeEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDisposeCursor; } - void EnableCursorDispose(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDisposeCursor = bEnable; } - - // error-access - sal_Bool RunFailed() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bRunFailed; } - ::com::sun::star::sdbc::SQLException GetRunException() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_aRunException; } - - /// the excution (within the method "run") was canceled ? - sal_Bool WasCanceled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bCanceled; } - - /// the handler will be called synchronously (the parameter is a pointer to the thread) - void SetTerminationHdl(const Link& aTermHdl) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_aTerminationHandler = aTermHdl; } - - /// cancels the process. returns to the caller immediately. to be called from another thread (of course ;) - void StopIt(); - - /// cancels the process. does not return to the caller until the thread is terminated. - void StopItWait(); - -protected: - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - /// called from within run. run itself handles (de)initialisation of the cancel handling. - virtual void RunImpl() = 0; -}; - -//------------------------------------------------------------------------------ - -#define DECL_CURSOR_ACTION_THREAD(classname) \ - \ -class SAL_DLLPRIVATE classname : public FmCursorActionThread \ -{ \ -public: \ - classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource); \ -protected: \ - virtual void RunImpl(); \ -}; \ - - -//------------------------------------------------------------------------------ - -#define IMPL_CURSOR_ACTION_THREAD(classname, caption, action) \ - \ -classname::classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource) \ - :FmCursorActionThread(_xDataSource, caption) \ -{ \ -} \ - \ -void classname::RunImpl() \ -{ \ - m_xDataSource->action; \ -} \ - - - #endif // _SVX_FMSHIMP_HXX diff --git a/svx/source/intro/iso.src b/svx/source/intro/iso.src index 1b4855228a73..f963d95721fc 100644 --- a/svx/source/intro/iso.src +++ b/svx/source/intro/iso.src @@ -59,7 +59,7 @@ String RID_BUILDVERSION ModalDialog RID_DEFAULTABOUT { OutputSize = TRUE ; - Size = MAP_APPFONT ( 245 , 200 ) ; + Size = MAP_APPFONT ( 245 , 260 ) ; Moveable = TRUE ; SVLook = TRUE ; TEXT_DEFAULTABOUT @@ -76,12 +76,18 @@ ModalDialog RID_DEFAULTABOUT WordBreak = TRUE ; Text = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION" ; }; - FixedText ABOUT_FTXT_COPYRIGHT + MultiLineEdit ABOUT_FTXT_COPYRIGHT { + Border = TRUE ; Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; - WordBreak = TRUE ; - 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." ; + IgnoreTab = TRUE ; + ReadOnly = TRUE ; + AutoVScroll = TRUE ; + }; + String ABOUT_STR_COPYRIGHT + { + Text[ en-US ] = "Copyright © 1995, 2010, Oracle and/or its affiliates. All rights reserved.\n\nThis software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.\n\nThe information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.\n\nIf this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:\n\nU.S. GOVERNMENT RIGHTS\nPrograms, software, databases, and related documentation and technical data delivered to U.S. Government customers are \"commercial computer software\" or \"commercial technical data\" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.\n\nThis software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.\n\nOracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.\n\nThis software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.\n\nThis product is based on the OpenOffice.org project."; }; StringArray ABOUT_STR_DEVELOPER_ARY { @@ -89,7 +95,7 @@ ModalDialog RID_DEFAULTABOUT }; String ABOUT_STR_FRENCH_COPYRIGHT { - 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." ; + Text = "Copyright © 1995, 2010, Oracle and/or its affiliates. All rights reserved.\n\nThis software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.\n\nThe information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.\n\nIf this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:\n\nU.S. GOVERNMENT RIGHTS\nPrograms, software, databases, and related documentation and technical data delivered to U.S. Government customers are ""commercial computer software"" or ""commercial technical data"" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.\n\nThis software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.\n\nOracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.\n\nThis software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.\n\nThis product is based on the OpenOffice.org project." ; }; String ABOUT_STR_ACCEL { diff --git a/svx/source/intro/ooo.src b/svx/source/intro/ooo.src index 6c52a054e3ce..b29f3894c0c5 100644 --- a/svx/source/intro/ooo.src +++ b/svx/source/intro/ooo.src @@ -1,4 +1,4 @@ -/************************************************************************* +/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -65,7 +65,7 @@ String RID_BUILDVERSION ModalDialog RID_DEFAULTABOUT { OutputSize = TRUE ; - Size = MAP_APPFONT ( 245 , 200 ) ; + Size = MAP_APPFONT ( 245 , 260 ) ; Moveable = TRUE ; SVLook = TRUE ; TEXT_DEFAULTABOUT @@ -81,13 +81,19 @@ ModalDialog RID_DEFAULTABOUT Size = MAP_APPFONT ( 118 , 16 ) ; WordBreak = TRUE ; Text = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION" ; - }; - FixedText ABOUT_FTXT_COPYRIGHT + }; + MultiLineEdit ABOUT_FTXT_COPYRIGHT { + Border = TRUE ; Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; - 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 ; + IgnoreTab = TRUE ; + ReadOnly = TRUE ; + AutoVScroll = TRUE ; + }; + String ABOUT_STR_COPYRIGHT + { + Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html."; }; StringArray ABOUT_STR_DEVELOPER_ARY { diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index 5faaf1cb31f0..e21ea8fc6e4b 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -26,8 +26,8 @@ ************************************************************************/ // include ------------------------------------------------------------------ -#include <svx/svxitems.hrc> -#include <svx/svxids.hrc> +#include "svx/svxitems.hrc" +#include "svx/svxids.hrc" #include <editeng/editids.hrc> StringArray RID_ATTR_NAMES diff --git a/svx/source/sdr/attribute/makefile.mk b/svx/source/sdr/attribute/makefile.mk index 5ca44ee5c240..177654ff1e1c 100644 --- a/svx/source/sdr/attribute/makefile.mk +++ b/svx/source/sdr/attribute/makefile.mk @@ -39,7 +39,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES=\ - $(SLO)$/sdrallattribute.obj \ + $(SLO)$/sdrfilltextattribute.obj \ + $(SLO)$/sdrlinefillshadowtextattribute.obj \ + $(SLO)$/sdrlineshadowtextattribute.obj \ + $(SLO)$/sdrshadowtextattribute.obj \ $(SLO)$/sdrtextattribute.obj \ $(SLO)$/sdrformtextattribute.obj \ $(SLO)$/sdrformtextoutlineattribute.obj diff --git a/svx/source/sdr/attribute/sdrallattribute.cxx b/svx/source/sdr/attribute/sdrallattribute.cxx deleted file mode 100644 index b1dd2d37dd69..000000000000 --- a/svx/source/sdr/attribute/sdrallattribute.cxx +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_svx.hxx" - -#include <svx/sdr/attribute/sdrallattribute.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> -#include <svx/sdr/attribute/sdrtextattribute.hxx> - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrShadowTextAttribute::SdrShadowTextAttribute( - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : mpShadow(pShadow), - mpTextAttribute(pTextAttribute) - { - } - - SdrShadowTextAttribute::SdrShadowTextAttribute( - const SdrShadowTextAttribute& rCandidate) - : mpShadow(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrShadowTextAttribute::~SdrShadowTextAttribute() - { - delete mpShadow; - delete mpTextAttribute; - } - - SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) - { - // handle mpShadow - { - // delete local mpShadow if necessary - if(mpShadow) - { - delete mpShadow; - mpShadow = 0; - } - - // copy mpShadow if necessary - if(rCandidate.mpShadow) - { - mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const - { - // handle mpShadow - if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrFillTextAttribute::SdrFillTextAttribute( - SdrFillAttribute* pFill, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient), - mpTextAttribute(pTextAttribute) - { - } - - SdrFillTextAttribute::SdrFillTextAttribute( - const SdrFillTextAttribute& rCandidate) - : mpFill(0), - mpFillFloatTransGradient(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrFillTextAttribute::~SdrFillTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - delete mpTextAttribute; - } - - SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) - { - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const - { - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - SdrLineAttribute* pLine, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : SdrShadowTextAttribute(pShadow, pTextAttribute), - mpLine(pLine), - mpLineStartEnd(pLineStartEnd) - { - } - - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - const SdrLineShadowTextAttribute& rCandidate) - : SdrShadowTextAttribute(0, 0), - mpLine(0), - mpLineStartEnd(0) - { - *this = rCandidate; - } - - SdrLineShadowTextAttribute::~SdrLineShadowTextAttribute() - { - delete mpLine; - delete mpLineStartEnd; - } - - SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) - { - // call parent - SdrShadowTextAttribute::operator=(rCandidate); - - // handle mpLine - { - // delete local mpLine if necessary - if(mpLine) - { - delete mpLine; - mpLine = 0; - } - - // copy mpLine if necessary - if(rCandidate.mpLine) - { - mpLine = new SdrLineAttribute(*rCandidate.mpLine); - } - } - - // handle mpLineStartEnd - { - // delete local mpLineStartEnd if necessary - if(mpLineStartEnd) - { - delete mpLineStartEnd; - mpLineStartEnd = 0; - } - - // copy mpLineStartEnd if necessary - if(rCandidate.mpLineStartEnd) - { - mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); - } - } - - return *this; - } - - bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpLine - if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) - return false; - - // handle mpLineStartEnd - if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine, - attribute::SdrFillAttribute* pFill, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pTextAttribute), - mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient) - { - } - - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - const SdrLineFillShadowTextAttribute& rCandidate) - : SdrLineShadowTextAttribute(0, 0, 0, 0), - mpFill(0), - mpFillFloatTransGradient(0) - { - *this = rCandidate; - } - - SdrLineFillShadowTextAttribute::~SdrLineFillShadowTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - } - - SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) - { - // call parent - SdrLineShadowTextAttribute::operator=(rCandidate); - - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - return *this; - } - - bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrLineShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/svx/source/sdr/attribute/sdrfilltextattribute.cxx b/svx/source/sdr/attribute/sdrfilltextattribute.cxx new file mode 100644 index 000000000000..e281c77068c5 --- /dev/null +++ b/svx/source/sdr/attribute/sdrfilltextattribute.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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: sdrallattribute.cxx,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. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include <svx/sdr/attribute/sdrfilltextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrFillTextAttribute::SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient), + maTextAttribute(rTextAttribute) + { + } + + SdrFillTextAttribute::SdrFillTextAttribute() + : maFill(), + maFillFloatTransGradient(), + maTextAttribute() + { + } + + SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate) + : maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) + { + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrFillTextAttribute::isDefault() const + { + return(getFill().isDefault() + && getFillFloatTransGradient().isDefault() + && getText().isDefault()); + } + + bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const + { + return(getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index a4f15d916215..39037faa5031 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -28,8 +28,8 @@ #include "precompiled_svx.hxx" #include <svx/sdr/attribute/sdrformtextattribute.hxx> +#include <basegfx/vector/b2enums.hxx> #include <svl/itemset.hxx> - #include <svx/xftdiit.hxx> #include <svx/xftstit.hxx> #include <svx/xftshxy.hxx> @@ -40,11 +40,8 @@ #include <svx/xftshcit.hxx> #include <svx/xftmrit.hxx> #include <svx/xftouit.hxx> - #include <svx/sdshtitm.hxx> #include <svx/xlntrit.hxx> -#include <drawinglayer/attribute/lineattribute.hxx> -#include <drawinglayer/attribute/strokeattribute.hxx> #include <svx/sdshcitm.hxx> #include <svx/xlnclit.hxx> #include <svx/xlnwtit.hxx> @@ -52,13 +49,11 @@ #include <svx/xlineit0.hxx> #include <svx/xdash.hxx> #include <svx/xlndsit.hxx> +#include <drawinglayer/attribute/lineattribute.hxx> +#include <drawinglayer/attribute/strokeattribute.hxx> #include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx> ////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - -////////////////////////////////////////////////////////////////////////////// // helper to get line, stroke and transparence attributes from SfxItemSet namespace @@ -154,144 +149,272 @@ namespace drawinglayer { namespace attribute { - SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) - : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), - mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), - mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), - mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), - mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), - meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), - meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), - meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), - maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), - mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) + class ImpSdrFormTextAttribute { - if(getFormTextOutline()) + public: + // refcounter + sal_uInt32 mnRefCount; + + // FormText (FontWork) Attributes + sal_Int32 mnFormTextDistance; // distance from line in upright direction + sal_Int32 mnFormTextStart; // shift from polygon start + sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees + sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling + sal_uInt16 mnFormTextShdwTransp; // shadow transparence + XFormTextStyle meFormTextStyle; // on/off and char orientation + XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale + XFormTextShadow meFormTextShadow; // shadow mode + Color maFormTextShdwColor; // shadow color + + // outline attributes; used when getFormTextOutline() is true and (for + // shadow) when getFormTextShadow() != XFTSHADOW_NONE + SdrFormTextOutlineAttribute maOutline; + SdrFormTextOutlineAttribute maShadowOutline; + + // bitfield + unsigned mbFormTextMirror : 1; // change orientation + unsigned mbFormTextOutline : 1; // show contour of objects + + ImpSdrFormTextAttribute(const SfxItemSet& rSet) + : mnRefCount(0), + mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), + mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), + mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), + mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), + mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), + meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), + meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), + meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), + maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), + maOutline(), + maShadowOutline(), + mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), + mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) { - const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); - - // also need to prepare attributes for outlines + if(getFormTextOutline()) { - const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); - - mpOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); + const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); + + // also need to prepare attributes for outlines + { + const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); + + maOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } + + if(XFTSHADOW_NONE != getFormTextShadow()) + { + // also need to prepare attributes for shadow outlines + const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); + + maShadowOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } } + } - if(XFTSHADOW_NONE != getFormTextShadow()) - { - // also need to prepare attributes for shadow outlines - const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); - - mpShadowOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); - } + ImpSdrFormTextAttribute() + : mnRefCount(0), + mnFormTextDistance(0), + mnFormTextStart(0), + mnFormTextShdwXVal(0), + mnFormTextShdwYVal(0), + mnFormTextShdwTransp(0), + meFormTextStyle(XFT_NONE), + meFormTextAdjust(XFT_CENTER), + meFormTextShadow(XFTSHADOW_NONE), + maFormTextShdwColor(), + maOutline(), + maShadowOutline(), + mbFormTextMirror(false), + mbFormTextOutline(false) + { } - } - SdrFormTextAttribute::~SdrFormTextAttribute() - { - if(mpOutline) + // data read access + sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } + sal_Int32 getFormTextStart() const { return mnFormTextStart; } + sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } + sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } + sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } + XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } + XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } + XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } + Color getFormTextShdwColor() const { return maFormTextShdwColor; } + const SdrFormTextOutlineAttribute& getOutline() const { return maOutline; } + const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; } + bool getFormTextMirror() const { return mbFormTextMirror; } + bool getFormTextOutline() const { return mbFormTextOutline; } + + // compare operator + bool operator==(const ImpSdrFormTextAttribute& rCandidate) const { - delete mpOutline; - mpOutline = 0; + return (getFormTextDistance() == rCandidate.getFormTextDistance() + && getFormTextStart() == rCandidate.getFormTextStart() + && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() + && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() + && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() + && getFormTextStyle() == rCandidate.getFormTextStyle() + && getFormTextAdjust() == rCandidate.getFormTextAdjust() + && getFormTextShadow() == rCandidate.getFormTextShadow() + && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() + && getOutline() == rCandidate.getOutline() + && getShadowOutline() == rCandidate.getShadowOutline() + && getFormTextMirror() == rCandidate.getFormTextMirror() + && getFormTextOutline() == rCandidate.getFormTextOutline()); } - if(mpShadowOutline) + static ImpSdrFormTextAttribute* get_global_default() { - delete mpShadowOutline; - mpShadowOutline = 0; + static ImpSdrFormTextAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; } + }; + + SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) + : mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet)) + { + } + + SdrFormTextAttribute::SdrFormTextAttribute() + : mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default()) + { + mpSdrFormTextAttribute->mnRefCount++; } SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate) - : mnFormTextDistance(rCandidate.getFormTextDistance()), - mnFormTextStart(rCandidate.getFormTextStart()), - mnFormTextShdwXVal(rCandidate.getFormTextShdwXVal()), - mnFormTextShdwYVal(rCandidate.getFormTextShdwYVal()), - mnFormTextShdwTransp(rCandidate.getFormTextShdwTransp()), - meFormTextStyle(rCandidate.getFormTextStyle()), - meFormTextAdjust(rCandidate.getFormTextAdjust()), - meFormTextShadow(rCandidate.getFormTextShadow()), - maFormTextShdwColor(rCandidate.getFormTextShdwColor()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(rCandidate.getFormTextMirror()), - mbFormTextOutline(rCandidate.getFormTextOutline()) + : mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute) { - if(rCandidate.getOutline()) + mpSdrFormTextAttribute->mnRefCount++; + } + + SdrFormTextAttribute::~SdrFormTextAttribute() + { + if(mpSdrFormTextAttribute->mnRefCount) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + mpSdrFormTextAttribute->mnRefCount--; } - - if(rCandidate.getShadowOutline()) + else { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); + delete mpSdrFormTextAttribute; } } + bool SdrFormTextAttribute::isDefault() const + { + return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default(); + } + SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate) { - mnFormTextDistance = rCandidate.getFormTextDistance(); - mnFormTextStart = rCandidate.getFormTextStart(); - mnFormTextShdwXVal = rCandidate.getFormTextShdwXVal(); - mnFormTextShdwYVal = rCandidate.getFormTextShdwYVal(); - mnFormTextShdwTransp = rCandidate.getFormTextShdwTransp(); - meFormTextStyle = rCandidate.getFormTextStyle(); - meFormTextAdjust = rCandidate.getFormTextAdjust(); - meFormTextShadow = rCandidate.getFormTextShadow(); - maFormTextShdwColor = rCandidate.getFormTextShdwColor(); - - if(mpOutline) + if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute) { - delete mpOutline; + if(mpSdrFormTextAttribute->mnRefCount) + { + mpSdrFormTextAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextAttribute; + } + + mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute; + mpSdrFormTextAttribute->mnRefCount++; } - mpOutline = 0; + return *this; + } - if(rCandidate.getOutline()) + bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + return true; } - if(mpShadowOutline) + if(rCandidate.isDefault() != isDefault()) { - delete mpShadowOutline; + return false; } - mpShadowOutline = 0; + return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute); + } - if(rCandidate.getShadowOutline()) - { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); - } + sal_Int32 SdrFormTextAttribute::getFormTextDistance() const + { + return mpSdrFormTextAttribute->getFormTextDistance(); + } - mbFormTextMirror = rCandidate.getFormTextMirror(); - mbFormTextOutline = rCandidate.getFormTextOutline(); + sal_Int32 SdrFormTextAttribute::getFormTextStart() const + { + return mpSdrFormTextAttribute->getFormTextStart(); + } - return *this; + sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwXVal(); } - bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwYVal(); + } + + sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const + { + return mpSdrFormTextAttribute->getFormTextShdwTransp(); + } + + XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const + { + return mpSdrFormTextAttribute->getFormTextStyle(); + } + + XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const + { + return mpSdrFormTextAttribute->getFormTextAdjust(); + } + + XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const + { + return mpSdrFormTextAttribute->getFormTextShadow(); + } + + Color SdrFormTextAttribute::getFormTextShdwColor() const + { + return mpSdrFormTextAttribute->getFormTextShdwColor(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const + { + return mpSdrFormTextAttribute->getOutline(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const + { + return mpSdrFormTextAttribute->getShadowOutline(); + } + + bool SdrFormTextAttribute::getFormTextMirror() const + { + return mpSdrFormTextAttribute->getFormTextMirror(); + } + + bool SdrFormTextAttribute::getFormTextOutline() const { - return (getFormTextDistance() == rCandidate.getFormTextDistance() - && getFormTextStart() == rCandidate.getFormTextStart() - && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() - && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() - && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() - && getFormTextStyle() == rCandidate.getFormTextStyle() - && getFormTextAdjust() == rCandidate.getFormTextAdjust() - && getFormTextShadow() == rCandidate.getFormTextShadow() - && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() - && pointerOrContentEqual(getOutline(), rCandidate.getOutline()) - && pointerOrContentEqual(getShadowOutline(), rCandidate.getShadowOutline()) - && getFormTextMirror() == rCandidate.getFormTextMirror() - && getFormTextOutline() == rCandidate.getFormTextOutline()); + return mpSdrFormTextAttribute->getFormTextOutline(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx index 67cadf41b831..6f1925f1f5a8 100644 --- a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx @@ -28,10 +28,8 @@ #include "precompiled_svx.hxx" #include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx> - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) +#include <drawinglayer/attribute/lineattribute.hxx> +#include <drawinglayer/attribute/strokeattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -39,21 +37,146 @@ namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // one set of attributes for FormText (FontWork) outline visualisation + LineAttribute maLineAttribute; + StrokeAttribute maStrokeAttribute; + sal_uInt8 mnTransparence; + + ImpSdrFormTextOutlineAttribute( + const LineAttribute& rLineAttribute, + const StrokeAttribute& rStrokeAttribute, + sal_uInt8 nTransparence) + : mnRefCount(0), + maLineAttribute(rLineAttribute), + maStrokeAttribute(rStrokeAttribute), + mnTransparence(nTransparence) + { + } + + // data read access + const LineAttribute& getLineAttribute() const { return maLineAttribute; } + const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } + sal_uInt8 getTransparence() const { return mnTransparence; } + + // compare operator + bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const + { + return (getLineAttribute() == rCandidate.getLineAttribute() + && getStrokeAttribute() == rCandidate.getStrokeAttribute() + && getTransparence() == rCandidate.getTransparence()); + } + + static ImpSdrFormTextOutlineAttribute* get_global_default() + { + static ImpSdrFormTextOutlineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextOutlineAttribute( + LineAttribute(), + StrokeAttribute(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence) - : maLineAttribute(rLineAttribute), - maStrokeAttribute(rStrokeAttribute), - mnTransparence(nTransparence) + : mpSdrFormTextOutlineAttribute(new ImpSdrFormTextOutlineAttribute( + rLineAttribute, rStrokeAttribute, nTransparence)) + { + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute() + : mpSdrFormTextOutlineAttribute(ImpSdrFormTextOutlineAttribute::get_global_default()) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate) + : mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute() + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + } + + bool SdrFormTextOutlineAttribute::isDefault() const + { + return mpSdrFormTextOutlineAttribute == ImpSdrFormTextOutlineAttribute::get_global_default(); + } + + SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate) { + if(rCandidate.mpSdrFormTextOutlineAttribute != mpSdrFormTextOutlineAttribute) + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + + mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute; + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + return *this; } bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const { - return (getLineAttribute() == rCandidate.getLineAttribute() - && getStrokeAttribute() == rCandidate.getStrokeAttribute() - && getTransparence() == rCandidate.getTransparence()); + if(rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFormTextOutlineAttribute == *mpSdrFormTextOutlineAttribute); + } + + const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const + { + return mpSdrFormTextOutlineAttribute->getLineAttribute(); + } + + const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const + { + return mpSdrFormTextOutlineAttribute->getStrokeAttribute(); + } + + sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const + { + return mpSdrFormTextOutlineAttribute->getTransparence(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx new file mode 100644 index 000000000000..6d8356833829 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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: sdrallattribute.cxx,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. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : SdrLineShadowTextAttribute(rLine, rLineStartEnd, rShadow, rTextAttribute), + maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient) + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute() + : SdrLineShadowTextAttribute(), + maFill(), + maFillFloatTransGradient() + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate) + : SdrLineShadowTextAttribute(rCandidate), + maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()) + { + } + + SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) + { + SdrLineShadowTextAttribute::operator=(rCandidate); + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + + return *this; + } + + bool SdrLineFillShadowTextAttribute::isDefault() const + { + return (SdrLineShadowTextAttribute::isDefault() + && getFill().isDefault() + && getFillFloatTransGradient().isDefault()); + } + + bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const + { + return(SdrLineShadowTextAttribute::operator==(rCandidate) + && getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx new file mode 100644 index 000000000000..6b863a11aa03 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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: sdrallattribute.cxx,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. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : SdrShadowTextAttribute(rShadow, rTextAttribute), + maLine(rLine), + maLineStartEnd(rLineStartEnd) + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute() + : SdrShadowTextAttribute(), + maLine(), + maLineStartEnd() + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate) + : SdrShadowTextAttribute(rCandidate), + maLine(rCandidate.getLine()), + maLineStartEnd(rCandidate.getLineStartEnd()) + { + } + + SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) + { + SdrShadowTextAttribute::operator=(rCandidate); + maLine = rCandidate.getLine(); + maLineStartEnd = rCandidate.getLineStartEnd(); + + return *this; + } + + bool SdrLineShadowTextAttribute::isDefault() const + { + return(SdrShadowTextAttribute::isDefault() + && getLine().isDefault() + && getLineStartEnd().isDefault()); + } + + bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const + { + return(SdrShadowTextAttribute::operator==(rCandidate) + && getLine() == rCandidate.getLine() + && getLineStartEnd() == rCandidate.getLineStartEnd()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx new file mode 100644 index 000000000000..34485b57399c --- /dev/null +++ b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx @@ -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: sdrallattribute.cxx,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. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include <svx/sdr/attribute/sdrshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrShadowTextAttribute::SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : maShadow(rShadow), + maTextAttribute(rTextAttribute) + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute() + : maShadow(), + maTextAttribute() + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate) + : maShadow(rCandidate.getShadow()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) + { + maShadow = rCandidate.getShadow(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrShadowTextAttribute::isDefault() const + { + return (getShadow().isDefault() + && getText().isDefault()); + } + + bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const + { + return (getShadow() == rCandidate.getShadow() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 72c2a97aa77b..a28430f127c1 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -36,15 +36,230 @@ #include <svx/sdr/properties/properties.hxx> ////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - -////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // all-text attributes. The SdrText itself and a copy + // of te OPO + const SdrText* mpSdrText; + const OutlinerParaObject* mpOutlinerParaObject; + + // Set when it's a FormText; contains all FormText attributes + SdrFormTextAttribute maSdrFormTextAttribute; + + // text distances + sal_Int32 maTextLeftDistance; + sal_Int32 maTextUpperDistance; + sal_Int32 maTextRightDistance; + sal_Int32 maTextLowerDistance; + + // #i101556# use versioning from text attributes to detect changes + sal_uInt32 maPropertiesVersion; + + // text alignments + SdrTextHorzAdjust maSdrTextHorzAdjust; + SdrTextVertAdjust maSdrTextVertAdjust; + + // bitfield + unsigned mbContour : 1; + unsigned mbFitToSize : 1; + unsigned mbHideContour : 1; + unsigned mbBlink : 1; + unsigned mbScroll : 1; + unsigned mbInEditMode : 1; + unsigned mbFixedCellHeight : 1; + unsigned mbWrongSpell : 1; + + public: + ImpSdrTextAttribute( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObject, + XFormTextStyle eFormTextStyle, + sal_Int32 aTextLeftDistance, + sal_Int32 aTextUpperDistance, + sal_Int32 aTextRightDistance, + sal_Int32 aTextLowerDistance, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, + bool bContour, + bool bFitToSize, + bool bHideContour, + bool bBlink, + bool bScroll, + bool bInEditMode, + bool bFixedCellHeight, + bool bWrongSpell) + : mnRefCount(0), + mpSdrText(pSdrText), + mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)), + maSdrFormTextAttribute(), + maTextLeftDistance(aTextLeftDistance), + maTextUpperDistance(aTextUpperDistance), + maTextRightDistance(aTextRightDistance), + maTextLowerDistance(aTextLowerDistance), + maPropertiesVersion(0), + maSdrTextHorzAdjust(aSdrTextHorzAdjust), + maSdrTextVertAdjust(aSdrTextVertAdjust), + mbContour(bContour), + mbFitToSize(bFitToSize), + mbHideContour(bHideContour), + mbBlink(bBlink), + mbScroll(bScroll), + mbInEditMode(bInEditMode), + mbFixedCellHeight(bFixedCellHeight), + mbWrongSpell(bWrongSpell) + { + if(pSdrText) + { + if(XFT_NONE != eFormTextStyle) + { + // text on path. Create FormText attribute + const SfxItemSet& rSet = pSdrText->GetItemSet(); + maSdrFormTextAttribute = SdrFormTextAttribute(rSet); + } + + // #i101556# init with version number to detect changes of single text + // attribute and/or style sheets in primitive data without having to + // copy that data locally (which would be better from principle) + maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion(); + } + } + + ImpSdrTextAttribute() + : mnRefCount(0), + mpSdrText(0), + mpOutlinerParaObject(0), + maSdrFormTextAttribute(), + maTextLeftDistance(0), + maTextUpperDistance(0), + maTextRightDistance(0), + maTextLowerDistance(0), + maPropertiesVersion(0), + maSdrTextHorzAdjust(SDRTEXTHORZADJUST_LEFT), + maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP), + mbContour(false), + mbFitToSize(false), + mbHideContour(false), + mbBlink(false), + mbScroll(false), + mbInEditMode(false), + mbFixedCellHeight(false), + mbWrongSpell(false) + { + } + + ~ImpSdrTextAttribute() + { + if(mpOutlinerParaObject) + { + delete mpOutlinerParaObject; + } + } + + // data read access + const SdrText& getSdrText() const + { + OSL_ENSURE(mpSdrText, "Access to text of default version of ImpSdrTextAttribute (!)"); + return *mpSdrText; + } + const OutlinerParaObject& getOutlinerParaObject() const + { + OSL_ENSURE(mpOutlinerParaObject, "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)"); + return *mpOutlinerParaObject; + } + bool isContour() const { return mbContour; } + 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; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } + bool isWrongSpell() const { return mbWrongSpell; } + const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; } + sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } + sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } + sal_Int32 getTextRightDistance() const { return maTextRightDistance; } + sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } + sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } + SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } + SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } + + // compare operator + bool operator==(const ImpSdrTextAttribute& rCandidate) const + { + if(mpOutlinerParaObject != rCandidate.mpOutlinerParaObject) + { + if(mpOutlinerParaObject && rCandidate.mpOutlinerParaObject) + { + // compares OPO and it's contents, but traditionally not the RedLining + // which is not seen as model, but as temporary information + if(!(getOutlinerParaObject() == rCandidate.getOutlinerParaObject())) + { + return false; + } + + // #i102062# for primitive visualisation, the WrongList (SpellChecking) + // is important, too, so use isWrongListEqual since there is no WrongList + // comparison in the regular OutlinerParaObject compare (since it's + // not-persistent data) + if(!(getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()))) + { + return false; + } + } + else + { + // only one is zero; not equal + return false; + } + } + + return ( + getSdrFormTextAttribute() == rCandidate.getSdrFormTextAttribute() + && getTextLeftDistance() == rCandidate.getTextLeftDistance() + && getTextUpperDistance() == rCandidate.getTextUpperDistance() + && getTextRightDistance() == rCandidate.getTextRightDistance() + && getTextLowerDistance() == rCandidate.getTextLowerDistance() + && getPropertiesVersion() == rCandidate.getPropertiesVersion() + + && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() + && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() + + && isContour() == rCandidate.isContour() + && isFitToSize() == rCandidate.isFitToSize() + && isHideContour() == rCandidate.isHideContour() + && isBlink() == rCandidate.isBlink() + && isScroll() == rCandidate.isScroll() + && isInEditMode() == rCandidate.isInEditMode() + && isFixedCellHeight() == rCandidate.isFixedCellHeight() + && isWrongSpell() == rCandidate.isWrongSpell()); + } + + static ImpSdrTextAttribute* get_global_default() + { + static ImpSdrTextAttribute* pDefault = 0; + + if(!pDefault) + { + // use default constructor + pDefault = new ImpSdrTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrTextAttribute::SdrTextAttribute( const SdrText& rSdrText, const OutlinerParaObject& rOutlinerParaObject, @@ -61,146 +276,174 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode, - bool bFixedCellHeight) - : mpSdrText(&rSdrText), - maOutlinerParaObject(rOutlinerParaObject), - mpSdrFormTextAttribute(0), - maTextLeftDistance(aTextLeftDistance), - maTextUpperDistance(aTextUpperDistance), - maTextRightDistance(aTextRightDistance), - maTextLowerDistance(aTextLowerDistance), - maPropertiesVersion(0), - maSdrTextHorzAdjust(aSdrTextHorzAdjust), - maSdrTextVertAdjust(aSdrTextVertAdjust), - mbContour(bContour), - mbFitToSize(bFitToSize), - mbHideContour(bHideContour), - mbBlink(bBlink), - mbScroll(bScroll), - mbInEditMode(bInEditMode), - mbFixedCellHeight(bFixedCellHeight) - { - if(XFT_NONE != eFormTextStyle) - { - // text on path. Create FormText attribute - const SfxItemSet& rSet = getSdrText().GetItemSet(); - mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet); - } + bool bFixedCellHeight, + bool bWrongSpell) + : mpSdrTextAttribute(new ImpSdrTextAttribute( + &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance, + aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour, + bFitToSize, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell)) + { + } - // #i101556# init with version number to detect changes of single text - // attribute and/or style sheets in primitive data without having to - // copy that data locally (which would be better from principle) - maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion(); + SdrTextAttribute::SdrTextAttribute() + : mpSdrTextAttribute(ImpSdrTextAttribute::get_global_default()) + { + mpSdrTextAttribute->mnRefCount++; + } + + SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) + : mpSdrTextAttribute(rCandidate.mpSdrTextAttribute) + { + mpSdrTextAttribute->mnRefCount++; } SdrTextAttribute::~SdrTextAttribute() { - if(mpSdrFormTextAttribute) + if(mpSdrTextAttribute->mnRefCount) { - delete mpSdrFormTextAttribute; - mpSdrFormTextAttribute = 0; + mpSdrTextAttribute->mnRefCount--; } - } - - SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) - : mpSdrText(&rCandidate.getSdrText()), - maOutlinerParaObject(rCandidate.getOutlinerParaObject()), - mpSdrFormTextAttribute(0), - maTextLeftDistance(rCandidate.getTextLeftDistance()), - maTextUpperDistance(rCandidate.getTextUpperDistance()), - maTextRightDistance(rCandidate.getTextRightDistance()), - maTextLowerDistance(rCandidate.getTextLowerDistance()), - maPropertiesVersion(rCandidate.getPropertiesVersion()), - maSdrTextHorzAdjust(rCandidate.getSdrTextHorzAdjust()), - maSdrTextVertAdjust(rCandidate.getSdrTextVertAdjust()), - mbContour(rCandidate.isContour()), - mbFitToSize(rCandidate.isFitToSize()), - mbHideContour(rCandidate.isHideContour()), - mbBlink(rCandidate.isBlink()), - mbScroll(rCandidate.isScroll()), - mbInEditMode(rCandidate.isInEditMode()), - mbFixedCellHeight(rCandidate.isFixedCellHeight()) - { - if(rCandidate.getSdrFormTextAttribute()) + else { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + delete mpSdrTextAttribute; } } - SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + bool SdrTextAttribute::isDefault() const { - mpSdrText = &rCandidate.getSdrText(); - maOutlinerParaObject = rCandidate.getOutlinerParaObject(); + return mpSdrTextAttribute == ImpSdrTextAttribute::get_global_default(); + } - if(mpSdrFormTextAttribute) + SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + { + if(rCandidate.mpSdrTextAttribute != mpSdrTextAttribute) { - delete mpSdrFormTextAttribute; + if(mpSdrTextAttribute->mnRefCount) + { + mpSdrTextAttribute->mnRefCount--; + } + else + { + delete mpSdrTextAttribute; + } + + mpSdrTextAttribute = rCandidate.mpSdrTextAttribute; + mpSdrTextAttribute->mnRefCount++; } - mpSdrFormTextAttribute = 0; + return *this; + } - if(rCandidate.getSdrFormTextAttribute()) + bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrTextAttribute == mpSdrTextAttribute) { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + return true; } - maTextLeftDistance = rCandidate.getTextLeftDistance(); - maTextUpperDistance = rCandidate.getTextUpperDistance(); - maTextRightDistance = rCandidate.getTextRightDistance(); - maTextLowerDistance = rCandidate.getTextLowerDistance(); - maPropertiesVersion = rCandidate.getPropertiesVersion(); + if(rCandidate.isDefault() != isDefault()) + { + return false; + } - maSdrTextHorzAdjust = rCandidate.getSdrTextHorzAdjust(); - maSdrTextVertAdjust = rCandidate.getSdrTextVertAdjust(); + return (*rCandidate.mpSdrTextAttribute == *mpSdrTextAttribute); + } - mbContour = rCandidate.isContour(); - mbFitToSize = rCandidate.isFitToSize(); - mbHideContour = rCandidate.isHideContour(); - mbBlink = rCandidate.isBlink(); - mbScroll = rCandidate.isScroll(); - mbInEditMode = rCandidate.isInEditMode(); - mbFixedCellHeight = rCandidate.isFixedCellHeight(); + const SdrText& SdrTextAttribute::getSdrText() const + { + return mpSdrTextAttribute->getSdrText(); + } - return *this; + const OutlinerParaObject& SdrTextAttribute::getOutlinerParaObject() const + { + return mpSdrTextAttribute->getOutlinerParaObject(); } - bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + bool SdrTextAttribute::isContour() const + { + return mpSdrTextAttribute->isContour(); + } + + bool SdrTextAttribute::isFitToSize() const + { + return mpSdrTextAttribute->isFitToSize(); + } + + bool SdrTextAttribute::isHideContour() const + { + return mpSdrTextAttribute->isHideContour(); + } + + bool SdrTextAttribute::isBlink() const + { + return mpSdrTextAttribute->isBlink(); + } + + bool SdrTextAttribute::isScroll() const + { + return mpSdrTextAttribute->isScroll(); + } + + bool SdrTextAttribute::isInEditMode() const + { + return mpSdrTextAttribute->isInEditMode(); + } + + bool SdrTextAttribute::isFixedCellHeight() const + { + return mpSdrTextAttribute->isFixedCellHeight(); + } + + bool SdrTextAttribute::isWrongSpell() const { - return ( - // compares OPO and it's contents, but traditionally not the RedLining - // which is not seen as model, but as temporary information - getOutlinerParaObject() == rCandidate.getOutlinerParaObject() + return mpSdrTextAttribute->isWrongSpell(); + } - // #i102062# for primitive visualisation, the WrongList (SpellChecking) - // is important, too, so use isWrongListEqual since there is no WrongList - // comparison in the regular OutlinerParaObject compare (since it's - // not-persistent data) - && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()) + const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const + { + return mpSdrTextAttribute->getSdrFormTextAttribute(); + } - && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute()) - && getTextLeftDistance() == rCandidate.getTextLeftDistance() - && getTextUpperDistance() == rCandidate.getTextUpperDistance() - && getTextRightDistance() == rCandidate.getTextRightDistance() - && getTextLowerDistance() == rCandidate.getTextLowerDistance() - && getPropertiesVersion() == rCandidate.getPropertiesVersion() + sal_Int32 SdrTextAttribute::getTextLeftDistance() const + { + return mpSdrTextAttribute->getTextLeftDistance(); + } - && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() - && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() + sal_Int32 SdrTextAttribute::getTextUpperDistance() const + { + return mpSdrTextAttribute->getTextUpperDistance(); + } - && isContour() == rCandidate.isContour() - && isFitToSize() == rCandidate.isFitToSize() - && isHideContour() == rCandidate.isHideContour() - && isBlink() == rCandidate.isBlink() - && isScroll() == rCandidate.isScroll() - && isInEditMode() == rCandidate.isInEditMode() - && isFixedCellHeight() == rCandidate.isFixedCellHeight()); + sal_Int32 SdrTextAttribute::getTextRightDistance() const + { + return mpSdrTextAttribute->getTextRightDistance(); + } + + sal_Int32 SdrTextAttribute::getTextLowerDistance() const + { + return mpSdrTextAttribute->getTextLowerDistance(); + } + + sal_uInt32 SdrTextAttribute::getPropertiesVersion() const + { + return mpSdrTextAttribute->getPropertiesVersion(); + } + + SdrTextHorzAdjust SdrTextAttribute::getSdrTextHorzAdjust() const + { + return mpSdrTextAttribute->getSdrTextHorzAdjust(); + } + + SdrTextVertAdjust SdrTextAttribute::getSdrTextVertAdjust() const + { + return mpSdrTextAttribute->getSdrTextVertAdjust(); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const { if(isBlink()) { - mpSdrText->GetObject().impGetBlinkTextTiming(rAnimList); + getSdrText().GetObject().impGetBlinkTextTiming(rAnimList); } } @@ -208,7 +451,7 @@ namespace drawinglayer { if(isScroll()) { - mpSdrText->GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); + getSdrText().GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); } } } // end of namespace attribute diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index ef8894b70da0..3057acf55df1 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -277,7 +277,8 @@ namespace sdr DBG_ERROR("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)"); const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0))); const basegfx::BColor aYellow(1.0, 1.0, 0.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx index 082f4ba733fd..9d6b253a676a 100644 --- a/svx/source/sdr/contact/viewcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewcontactofe3d.cxx @@ -33,10 +33,12 @@ #include <svx/obj3d.hxx> #include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx> #include <svx/sdr/contact/viewcontactofe3dscene.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <svx/scene3d.hxx> #include <drawinglayer/primitive3d/transformprimitive3d.hxx> +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightattribute3d.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -124,13 +126,14 @@ namespace sdr // create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl. // 3D shadow extraction for correct B2DRange calculation (shadow is part of the object) - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::Embedded3DPrimitive2D( - rxContent3D, - pVCOfE3DScene->getObjectTransformation(), - aViewInformation3D, - aLightNormal, - fShadowSlant, - rAllContentRange)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::Embedded3DPrimitive2D( + rxContent3D, + pVCOfE3DScene->getObjectTransformation(), + aViewInformation3D, + aLightNormal, + fShadowSlant, + rAllContentRange)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -175,9 +178,12 @@ namespace sdr if(!rObjectTransform.isIdentity()) { - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D( - rObjectTransform, xRetval)); - return drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::TransformPrimitive3D( + rObjectTransform, + xRetval)); + + xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx index 23e0ca426acd..84d456a7a430 100644 --- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx @@ -54,16 +54,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dCubeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get cube geometry and use as traslation and scaling for unit cube basegfx::B3DRange aCubeRange; @@ -96,12 +88,13 @@ namespace sdr const basegfx::B2DVector aTextureSize(aCubeSize.getX(), aCubeSize.getY()); // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrCubePrimitive3D(aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrCubePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx index 9b5ac5c5889d..1ff1d81c827c 100644 --- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx @@ -54,16 +54,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon()); @@ -89,15 +81,15 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrExtrudePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, - bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrExtrudePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, + bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx index 1d8784d31f8b..3cd55fcde828 100644 --- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx @@ -54,16 +54,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dLatheObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D()); @@ -103,16 +95,16 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrLathePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, nHorizontalSegments, nVerticalSegments, - fDiagonal, fBackScale, fRotation, - bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrLathePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, nHorizontalSegments, nVerticalSegments, + fDiagonal, fBackScale, fRotation, + bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index 393353249d86..ee6943bccd4a 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -56,16 +56,8 @@ namespace sdr drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dPolygonObj().GetMergedItemSet(); const bool bSuppressFill(GetE3dPolygonObj().GetLineOnly()); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill)); // get extrude geometry basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D()); @@ -177,13 +169,13 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( - aPolyPolygon3D, aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( + aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 6bb066e369f9..8a7d7694a315 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -38,11 +38,11 @@ #include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b3drange.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <drawinglayer/primitive3d/baseprimitive3d.hxx> #include <svx/sdr/contact/viewcontactofe3d.hxx> #include <drawinglayer/primitive2d/sceneprimitive2d.hxx> #include <drawinglayer/primitive3d/transformprimitive3d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -164,21 +164,13 @@ namespace sdr ViewContactOfE3dScene::ViewContactOfE3dScene(E3dScene& rScene) : ViewContactOfSdrObj(rScene), - mpViewInformation3D(0), - mpObjectTransformation(0), - mpSdrSceneAttribute(0), - mpSdrLightingAttribute(0) + maViewInformation3D(), + maObjectTransformation(), + maSdrSceneAttribute(), + maSdrLightingAttribute() { } - ViewContactOfE3dScene::~ViewContactOfE3dScene() - { - delete mpViewInformation3D; - delete mpObjectTransformation; - delete mpSdrSceneAttribute; - delete mpSdrLightingAttribute; - } - void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rContentRange) { basegfx::B3DHomMatrix aTransformation; @@ -262,34 +254,36 @@ namespace sdr } const uno::Sequence< beans::PropertyValue > aEmptyProperties; - mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(aTransformation, aOrientation, aProjection, aDeviceToView, 0.0, aEmptyProperties); + maViewInformation3D = drawinglayer::geometry::ViewInformation3D( + aTransformation, aOrientation, aProjection, + aDeviceToView, 0.0, aEmptyProperties); } void ViewContactOfE3dScene::createObjectTransformation() { // create 2d Object Transformation from relative point in 2d scene to world - mpObjectTransformation = new basegfx::B2DHomMatrix; const Rectangle& rRectangle = GetE3dScene().GetSnapRect(); - mpObjectTransformation->set(0, 0, rRectangle.getWidth()); - mpObjectTransformation->set(1, 1, rRectangle.getHeight()); - mpObjectTransformation->set(0, 2, rRectangle.Left()); - mpObjectTransformation->set(1, 2, rRectangle.Top()); + maObjectTransformation.set(0, 0, rRectangle.getWidth()); + maObjectTransformation.set(1, 1, rRectangle.getHeight()); + maObjectTransformation.set(0, 2, rRectangle.Left()); + maObjectTransformation.set(1, 2, rRectangle.Top()); } void ViewContactOfE3dScene::createSdrSceneAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); + maSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); } void ViewContactOfE3dScene::createSdrLightingAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); + maSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence( + const SetOfByte* pLayerVisibility) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_uInt32 nChildrenCount(GetObjectCount()); @@ -329,19 +323,27 @@ namespace sdr // on identity and the time on 0.0. const uno::Sequence< beans::PropertyValue > aEmptyProperties; const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties); - const basegfx::B3DRange aContentRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); + const basegfx::B3DRange aContentRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); // create 2d primitive 3dscene with generated sub-list from collector - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ScenePrimitive2D( - bTestVisibility ? aVisibleSequence : aAllSequence, - getSdrSceneAttribute(), - getSdrLightingAttribute(), - getObjectTransformation(), - getViewInformation3D(aContentRange))); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::ScenePrimitive2D( + bTestVisibility ? aVisibleSequence : aAllSequence, + getSdrSceneAttribute(), + getSdrLightingAttribute(), + getObjectTransformation(), + getViewInformation3D(aContentRange))); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, getObjectTransformation())); + return xRetval; } @@ -355,27 +357,7 @@ namespace sdr xRetval = createScenePrimitive2DSequence(0); } - if(xRetval.hasElements()) - { - return xRetval; - } - else - { - // create a gray placeholder hairline polygon in object size as empty 3D scene marker. Use object size - // model information directly, NOT getBoundRect()/getSnapRect() since these will - // be using the geometry data we get just asked for. AFAIK for empty 3D Scenes, the model data - // is SdrObject::aOutRect which i can access directly using GetLastBoundRect() here - const Rectangle aEmptySceneGeometry(GetE3dScene().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aEmptySceneGeometry.Left(), aEmptySceneGeometry.Top(), - aEmptySceneGeometry.Right(), aEmptySceneGeometry.Bottom()))); - const double fGrayTone(0xc0 / 255.0); - const basegfx::BColor aGrayTone(fGrayTone, fGrayTone, fGrayTone); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); - - // The replacement object may also get a text like 'empty 3D Scene' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + return xRetval; } void ViewContactOfE3dScene::ActionChanged() @@ -384,22 +366,15 @@ namespace sdr ViewContactOfSdrObj::ActionChanged(); // mark locally cached values as invalid - delete mpViewInformation3D; - mpViewInformation3D = 0; - - delete mpObjectTransformation; - mpObjectTransformation = 0; - - delete mpSdrSceneAttribute; - mpSdrSceneAttribute = 0; - - delete mpSdrLightingAttribute; - mpSdrLightingAttribute = 0; + maViewInformation3D = drawinglayer::geometry::ViewInformation3D(); + maObjectTransformation.identity(); + maSdrSceneAttribute = drawinglayer::attribute::SdrSceneAttribute(); + maSdrLightingAttribute = drawinglayer::attribute::SdrLightingAttribute(); } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D() const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { // this version will create the content range on demand locally and thus is less // performant than the other one. Since the information is buffered the planned @@ -418,47 +393,47 @@ namespace sdr const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(aContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D(const basegfx::B3DRange& rContentRange) const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(rContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const basegfx::B2DHomMatrix& ViewContactOfE3dScene::getObjectTransformation() const { - if(!mpObjectTransformation) + if(maObjectTransformation.isIdentity()) { const_cast < ViewContactOfE3dScene* >(this)->createObjectTransformation(); } - return *mpObjectTransformation; + return maObjectTransformation; } const drawinglayer::attribute::SdrSceneAttribute& ViewContactOfE3dScene::getSdrSceneAttribute() const { - if(!mpSdrSceneAttribute) + if(maSdrSceneAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrSceneAttribute(); } - return *mpSdrSceneAttribute; + return maSdrSceneAttribute; } const drawinglayer::attribute::SdrLightingAttribute& ViewContactOfE3dScene::getSdrLightingAttribute() const { - if(!mpSdrLightingAttribute) + if(maSdrLightingAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrLightingAttribute(); } - return *mpSdrLightingAttribute; + return maSdrLightingAttribute; } drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dScene::getAllPrimitive3DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx index 5533a9e9ed8e..c16633f7f2c9 100644 --- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx @@ -53,16 +53,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get sphere center and size for geometry basegfx::B3DRange aSphereRange; @@ -88,14 +80,14 @@ namespace sdr F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrSpherePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - nHorizontalSegments, nVerticalSegments)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrSpherePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + nHorizontalSegments, nVerticalSegments)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 656edfdddb20..7172b0840476 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -30,7 +30,6 @@ #include <svx/sdr/contact/viewcontactofgraphic.hxx> #include <svx/sdr/contact/viewobjectcontactofgraphic.hxx> #include <svx/svdograf.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <svl/itemset.hxx> @@ -39,7 +38,6 @@ #endif #include <svx/sdgcpitm.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/contact/displayinfo.hxx> #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/objectcontact.hxx> @@ -59,6 +57,7 @@ #include <editeng/eeitem.hxx> #include <editeng/colritem.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -148,10 +147,9 @@ namespace sdr * aSmallerMatrix; const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( aSmallerMatrix, - aEmptyAttributes, + drawinglayer::attribute::SdrLineFillShadowTextAttribute(), rGraphicObject, rLocalGrafInfo)); @@ -177,14 +175,12 @@ namespace sdr aEmptyGraphicAttr)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); - if(!rAttribute.getLine()) + if(rAttribute.getLine().isDefault()) { // create a surrounding frame when no linestyle given const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor()); const basegfx::BColor aBColor(aColor.getBColor()); - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rObjectMatrix); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, @@ -314,127 +310,123 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetGrafObject().getText(0); - - if(pSdrText) + const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); + drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetGrafObject().getText(0))); + + // create and fill GraphicAttr + GraphicAttr aLocalGrafInfo; + const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); + const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); + aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); + aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); + aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); + aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); + aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); + aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); + aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); + aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); + aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); + aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); + + if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency()) { - const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - bool bVisible(pAttribute && pAttribute->isVisible()); - - // create and fill GraphicAttr - GraphicAttr aLocalGrafInfo; - const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); - const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); - aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); - aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); - aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); - aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); - aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); - aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); - aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); - aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); - aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); - aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); - - if(!bVisible && 255L != aLocalGrafInfo.GetTransparency()) + // no fill, no line, no text (invisible), but the graphic content is visible. + // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet + const drawinglayer::attribute::SdrShadowAttribute aShadow( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet)); + + if(!aShadow.isDefault()) { - // content is visible, so force some fill stuff - delete pAttribute; - bVisible = true; + // create new attribute set if indeed shadow is used + aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute( + aAttribute.getLine(), + aAttribute.getFill(), + aAttribute.getLineStartEnd(), + aShadow, + aAttribute.getFillFloatTransGradient(), + aAttribute.getText()); + } + } - // check shadow - drawinglayer::attribute::SdrShadowAttribute* pShadow = drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet); + // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() + // which will use the primitive data we just create in the near future + const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // look for mirroring + const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); + const sal_Int32 nDrehWink(rGeoStat.nDrehWink); + const bool bRota180(18000 == nDrehWink); + const bool bMirrored(GetGrafObject().IsMirrored()); + const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); + bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); + bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); + + // set mirror flags at LocalGrafInfo. Take into account that the geometry in + // aObjectRange is already changed and rotated when bRota180 is used. To rebuild + // that old behaviour (as long as part of the model data), correct the H/V flags + // accordingly. The created bitmapPrimitive WILL use the rotation, too. + if(bRota180) + { + // if bRota180 which is used for vertical mirroring, the graphic will already be rotated + // by 180 degrees. To correct, switch off VMirror and invert HMirroring. + bHMirr = !bHMirr; + bVMirr = false; + } - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + if(bHMirr || bVMirr) + { + aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); + } - // create new attribute set - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0L, 0L, 0L, pShadow, 0L, 0L); - } + // fill object matrix + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); - if(pAttribute) - { - if(pAttribute->isVisible() || bVisible) - { - // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() - // which will use the primitive data we just create in the near future - const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // look for mirroring - const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); - const sal_Int32 nDrehWink(rGeoStat.nDrehWink); - const bool bRota180(18000 == nDrehWink); - const bool bMirrored(GetGrafObject().IsMirrored()); - const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); - bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); - bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); - - // set mirror flags at LocalGrafInfo. Take into account that the geometry in - // aObjectRange is already changed and rotated when bRota180 is used. To rebuild - // that old behaviour (as long as part of the model data), correct the H/V flags - // accordingly. The created bitmapPrimitive WILL use the rotation, too. - if(bRota180) - { - // if bRota180 which is used for vertical mirroring, the graphic will already be rotated - // by 180 degrees. To correct, switch off VMirror and invert HMirroring. - bHMirr = !bHMirr; - bVMirr = false; - } - - if(bHMirr || bVMirr) - { - aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); - } - - // fill object matrix - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // get the current, unchenged graphic obect from SdrGrafObj - const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - - if(visualisationUsesPresObj()) - { - // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one - // with the content which is the placeholder graphic - xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo); - } - else if(visualisationUsesDraft()) - { - // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism - // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious - // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent - // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster - // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages - xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute); - } - else - { - // create primitive. Info: Calling the copy-constructor of GraphicObject in this - // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aObjectMatrix, - *pAttribute, - rGraphicObject, - aLocalGrafInfo)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // get the current, unchenged graphic obect from SdrGrafObj + const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + + if(visualisationUsesPresObj()) + { + // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one + // with the content which is the placeholder graphic + xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute, aLocalGrafInfo); + } + else if(visualisationUsesDraft()) + { + // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism + // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious + // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent + // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster + // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages + xRetval = createVIP2DSForDraft(aObjectMatrix, aAttribute); } + else + { + // create primitive. Info: Calling the copy-constructor of GraphicObject in this + // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic + const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + aObjectMatrix, + aAttribute, + rGraphicObject, + aLocalGrafInfo)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx index 1e0ed6bb4734..6252811d32a3 100644 --- a/svx/source/sdr/contact/viewcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewcontactofgroup.cxx @@ -36,6 +36,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/color/bcolor.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -78,25 +79,22 @@ namespace sdr drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq); } } - - if(xRetval.hasElements()) - { - return xRetval; - } else { - // create a gray placeholder hairline polygon in object size. Use the model data directly. For empty groups, - // this is SdrObject::aOutRect, as can be seen in SdrObjGroup::GetSnapRect(). Access that using GetLastBoundRect() - // to not execute anything. + // append an invisible outline for the cases where no visible content exists const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()))); - const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); + const basegfx::B2DRange aCurrentRange( + aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), + aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()); - // The replacement object may also get a text like 'empty group' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aCurrentRange)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + + return xRetval; } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index e0c1e46c4e69..ba260e79bba9 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -38,12 +38,14 @@ #include <svx/svdview.hxx> #include <svx/sdr/contact/viewcontactofsdrpage.hxx> #include <svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <svx/svdpage.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -59,33 +61,30 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); - if(pBackgroundCandidate) - { - // build primitive from pBackgroundCandidate's attributes - const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); - - if(pFill) - { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.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); - } + // build primitive from page fill attributes + const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); - delete pFill; - } + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.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, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } return xRetval; @@ -105,23 +104,11 @@ namespace sdr sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const { - sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); - - if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nRetval--; - } - - return nRetval; + return GetMasterPageDescriptor().GetUsedPage().GetObjCount(); } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { - if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nIndex++; - } - return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 05ff5e26308f..84e60392a88f 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -31,7 +31,6 @@ #include <svx/sdr/contact/viewcontactofsdrcaptionobj.hxx> #include <svx/svdocapt.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> @@ -66,107 +65,108 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence xRetval; const SdrCaptionObj& rCaptionObj(GetCaptionObj()); const SfxItemSet& rItemSet = rCaptionObj.GetMergedItemSet(); - SdrText* pSdrText = rCaptionObj.getText(0); - - if(pSdrText) + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + rCaptionObj.getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius( + rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // create primitive. Always create one (even if invisible) to let the decomposition + // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCaptionPrimitive2D( + aObjectMatrix, + aAttribute, + rCaptionObj.getTailPolygon(), + fCornerRadiusX, + fCornerRadiusY)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + + if(!aAttribute.isDefault() && rCaptionObj.GetSpecialTextBoxShadow()) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) + // for SC, the caption object may have a specialized shadow. The usual object shadow is off + // and a specialized shadow gets created here (see old paint) + const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); + const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); + const Color aShadCol(rShadColItem.GetColorValue()); + const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); + + // Create own ItemSet and modify as needed + // Always hide lines for special calc shadow + SfxItemSet aSet(rItemSet); + aSet.Put(XLineStyleItem(XLINE_NONE)); + + if(XFILL_HATCH == eStyle) + { + // #41666# Hatch color is set hard to shadow color + XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); + aHatch.SetColor(aShadCol); + aSet.Put(XFillHatchItem(String(),aHatch)); + } + else { - if(pAttribute->isVisible()) + if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCaptionPrimitive2D( - aObjectMatrix, *pAttribute, rCaptionObj.getTailPolygon(), fCornerRadiusX, fCornerRadiusY)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - - if(rCaptionObj.GetSpecialTextBoxShadow()) - { - // for SC, the caption object may have a specialized shadow. The usual object shadow is off - // and a specialized shadow gets created here (see old paint) - const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); - const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); - const Color aShadCol(rShadColItem.GetColorValue()); - const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); - - // Create own ItemSet and modify as needed - // Always hide lines for special calc shadow - SfxItemSet aSet(rItemSet); - aSet.Put(XLineStyleItem(XLINE_NONE)); - - if(XFILL_HATCH == eStyle) - { - // #41666# Hatch color is set hard to shadow color - XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); - aHatch.SetColor(aShadCol); - aSet.Put(XFillHatchItem(String(),aHatch)); - } - else - { - if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) - { - // force fill to solid (for Gradient and Bitmap) - aSet.Put(XFillStyleItem(XFILL_SOLID)); - } - - aSet.Put(XFillColorItem(String(),aShadCol)); - aSet.Put(XFillTransparenceItem(nTransp)); - } - - // crete FillAttribute from modified ItemSet - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(aSet); - drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; - - if(pFill) - { - if(pFill->isVisible()) - { - // add shadow offset to object matrix - const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); - const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); - aObjectMatrix.translate(nXDist, nYDist); - - // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); - - // create the specialized shadow primitive - xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), aObjectMatrix, *pFill); - } - - delete pFill; - } - - if(xSpecialShadow.is()) - { - // if we really got a special shadow, create a two-element retval with the shadow - // behind the standard object's geometry - xRetval.realloc(2); - - xRetval[0] = xSpecialShadow; - xRetval[1] = xReference; - } - } + // force fill to solid (for Gradient and Bitmap) + aSet.Put(XFillStyleItem(XFILL_SOLID)); } - delete pAttribute; + aSet.Put(XFillColorItem(String(),aShadCol)); + aSet.Put(XFillTransparenceItem(nTransp)); + } + + // crete FillAttribute from modified ItemSet + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(aSet)); + drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; + + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) + { + // add shadow offset to object matrix + const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); + const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); + aObjectMatrix.translate(nXDist, nYDist); + + // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); + + // create the specialized shadow primitive + xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + aObjectMatrix, + aFill, + drawinglayer::attribute::FillGradientAttribute()); + } + + if(xSpecialShadow.is()) + { + // if we really got a special shadow, create a two-element retval with the shadow + // behind the standard object's geometry + xRetval.realloc(2); + + xRetval[0] = xSpecialShadow; + xRetval[1] = xReference; } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 18898463b266..f6f2f094001b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -31,7 +31,6 @@ #include <svx/sdr/contact/viewcontactofsdrcircobj.hxx> #include <svx/svdocirc.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrellipseprimitive2d.hxx> #include <svl/itemset.hxx> #include <svx/sxciaitm.hxx> @@ -54,56 +53,62 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet(); - SdrText* pSdrText = GetCircObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetCircObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetCircObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetCircObj().GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); - // fill object matrix - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); + // fill object matrix + const basegfx::B2DHomMatrix aObjectMatrix( + basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); - // create primitive data - const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); + // create primitive data + const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); - if(OBJ_CIRC == nIdentifier) - { - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipsePrimitive2D(aObjectMatrix, *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - else - { - const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); - const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); - const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); - const bool bCloseSegment(OBJ_CARC != nIdentifier); - const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(aObjectMatrix, *pAttribute, fStart, fEnd, bCloseSegment, bCloseUsingCenter)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } + // always create primitives to allow the decomposition of SdrEllipsePrimitive2D + // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + if(OBJ_CIRC == nIdentifier) + { + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipsePrimitive2D( + aObjectMatrix, + aAttribute)); - delete pAttribute; - } + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); + const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); + const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); + const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); + const bool bCloseSegment(OBJ_CARC != nIdentifier); + const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); + + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D( + aObjectMatrix, + aAttribute, + fStart, + fEnd, + bCloseSegment, + bCloseUsingCenter)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx index 7d9da0707dce..7b4ec93afb38 100644 --- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx @@ -31,7 +31,6 @@ #include <svx/sdr/contact/viewcontactofsdredgeobj.hxx> #include <svx/svdoedge.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -51,35 +50,27 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - ::basegfx::B2DPolygon aEdgeTrack(GetEdgeObj().getEdgeTrack()); + const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack(); - // base visualisation on EdgeTrack - if(aEdgeTrack.count()) - { - // ckeck attributes - const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); - SdrText* pSdrText = GetEdgeObj().getText(0); + // what to do when no EdgeTrack is provided (HitTest and selectability) ? + OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)"); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // ckeck attributes + const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetEdgeObj().getText(0))); - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrConnectorPrimitive2D(*pAttribute, aEdgeTrack)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + // create primitive. Always create primitives to allow the decomposition of + // SdrConnectorPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrConnectorPrimitive2D( + aAttribute, + rEdgeTrack)); - delete pAttribute; - } - } - } - - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx index 237efa3e75e5..9d0d38f688eb 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx @@ -31,7 +31,6 @@ #include <svx/sdr/contact/viewcontactofsdrmeasureobj.hxx> #include <svx/svdomeas.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svl/itemset.hxx> #include <svx/sxmbritm.hxx> #include <svx/sxmlhitm.hxx> @@ -57,91 +56,85 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMeasureObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet(); - SdrText* pSdrText = GetMeasureObj().getText(0); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetMeasureObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // take properties which are the model data. + const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); + const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); + const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); + const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); + const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); + const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); + const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); + const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); + const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); + const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); + drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); + drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - if(pAttribute) + switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) + { + case SDRMEASURE_TEXTLEFTOUTSIDE : { - if(pAttribute->isVisible()) - { - // take properties which are the model data. - const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); - const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); - const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); - const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); - const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); - const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); - const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); - const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); - const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); - const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); - drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - - switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) - { - case SDRMEASURE_TEXTLEFTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURE_TEXTINSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_TEXTRIGHTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTHAUTO - { - break; - } - } - - switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) - { - case SDRMEASURE_ABOVE : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURETEXT_BREAKEDLINE : - case SDRMEASURETEXT_VERTICALCENTERED : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_BELOW : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTVAUTO - { - break; - } - } - - // create primitive with the model data - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrMeasurePrimitive2D(*pAttribute, - aStart, aEnd, aMTPHor, aMTPVer, fDistance, fUpperDistance, fLowerDistance, fLeftDelta, fRightDelta, - bBelow, bTextRotation, bTextAutoAngle)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURE_TEXTINSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_TEXTRIGHTOUTSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTHAUTO + { + break; + } + } - delete pAttribute; + switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) + { + case SDRMEASURE_ABOVE : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURETEXT_BREAKEDLINE : + case SDRMEASURETEXT_VERTICALCENTERED : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_BELOW : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTVAUTO + { + break; } } - return xRetval; + // create primitive with the model data. Always create primitives to allow the + // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrMeasurePrimitive2D( + aAttribute, aStart, aEnd, + aMTPHor, aMTPVer, fDistance, + fUpperDistance, fLowerDistance, + fLeftDelta, fRightDelta, bBelow, + bTextRotation, bTextAutoAngle)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx index 8da5a6426d06..ab6598840a8e 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx @@ -154,7 +154,9 @@ namespace sdr // create range using the model data directly. This is in SdrTextObj::aRect which i will access using // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM. const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); // create object transform basegfx::B2DHomMatrix aTransform; @@ -163,12 +165,15 @@ namespace sdr aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - // create media primitive + // create media primitive. Always create primitives to allow the + // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0); const rtl::OUString& rURL(GetSdrMediaObj().getURL()); const sal_uInt32 nPixelBorder(4L); - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::MediaPrimitive2D( - aTransform, rURL, aBackgroundColor, nPixelBorder)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::MediaPrimitive2D( + aTransform, rURL, aBackgroundColor, nPixelBorder)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 60ce678527f5..6fa63f7c073e 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -31,13 +31,13 @@ #include <svx/svdoashp.hxx> #include <svx/sdr/contact/displayinfo.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svditer.hxx> #include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <svx/obj3d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -112,131 +112,126 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCustomShapeObj().GetMergedItemSet(); - SdrText* pSdrText = GetCustomShapeObj().getText(0); - if(pSdrText) - { - // #i98072# Get shandow and text; eventually suppress the text if it's - // a TextPath FontworkGallery object - drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute( + // #i98072# Get shandow and text; eventually suppress the text if it's + // a TextPath FontworkGallery object + const drawinglayer::attribute::SdrShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrShadowTextAttribute( rItemSet, - *pSdrText, - GetCustomShapeObj().IsTextPath()); - drawinglayer::primitive2d::Primitive2DSequence xGroup; - bool bHasText(pAttribute && pAttribute->getText()); + GetCustomShapeObj().getText(0), + GetCustomShapeObj().IsTextPath())); + drawinglayer::primitive2d::Primitive2DSequence xGroup; + bool bHasText(!aAttribute.getText().isDefault()); + + // create Primitive2DSequence from sub-geometry + const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); - // create Primitive2DSequence from sub-geometry - const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); - bool b3DShape(false); + if(pSdrObjRepresentation) + { + SdrObjListIter aIterator(*pSdrObjRepresentation); - if(pSdrObjRepresentation) + while(aIterator.IsMore()) { - SdrObjListIter aIterator(*pSdrObjRepresentation); + SdrObject& rCandidate = *aIterator.Next(); - while(aIterator.IsMore()) + if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) { - SdrObject& rCandidate = *aIterator.Next(); - - if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) - { - b3DShape = true; - } - - const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); + b3DShape = true; } + + const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); } + } + + if(bHasText || xGroup.hasElements()) + { + // prepare text box geometry + basegfx::B2DHomMatrix aTextBoxMatrix; + bool bWordWrap(false); - if(bHasText || xGroup.hasElements()) + if(bHasText) { - // prepare text box geometry - basegfx::B2DHomMatrix aTextBoxMatrix; - bool bWordWrap(false); + // take unrotated snap rect as default, then get the + // unrotated text box. Rotation needs to be done centered + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); - if(bHasText) - { - // take unrotated snap rect as default, then get the - // unrotated text box. Rotation needs to be done centered - const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); - const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); + // #i101684# get the text range unrotated and absolute to the object range + const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); - // #i101684# get the text range unrotated and absolute to the object range - const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); + // give text object a size + aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); - // give text object a size - aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); + // check if we have a rotation/shear at all to take care of + const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); + const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); - // check if we have a rotation/shear at all to take care of - const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); - const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); + if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + { + if(aObjectRange != aTextRange) + { + // move relative to unrotated object range + aTextBoxMatrix.translate( + aTextRange.getMinX() - aObjectRange.getMinimum().getX(), + aTextRange.getMinY() - aObjectRange.getMinimum().getY()); + } - if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + if(!basegfx::fTools::equalZero(fExtraTextRotation)) { - if(aObjectRange != aTextRange) - { - // move relative to unrotated object range - aTextBoxMatrix.translate( - aTextRange.getMinX() - aObjectRange.getMinimum().getX(), - aTextRange.getMinY() - aObjectRange.getMinimum().getY()); - } - - if(!basegfx::fTools::equalZero(fExtraTextRotation)) - { - basegfx::B2DVector aTranslation( - ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ), - ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) ); - aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() ); - aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); - aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() ); - } - - if(rGeoStat.nShearWink) - { - aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - // give text it's target position - aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + basegfx::B2DVector aTranslation( + ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ), + ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) ); + aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() ); + aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); + aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() ); } - else + + if(rGeoStat.nShearWink) { - aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); + aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); } - // check if SdrTextWordWrapItem is set - bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); - } + if(rGeoStat.nDrehWink) + { + aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); + } - // make sure a (even empty) SdrShadowTextAttribute exists for - // primitive creation - if(!pAttribute) + // give text it's target position + aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + } + else { - pAttribute = new drawinglayer::attribute::SdrShadowTextAttribute(0L, 0L); + aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); } - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( - *pAttribute, - xGroup, - aTextBoxMatrix, - bWordWrap, - b3DShape, - false)); // #SJ# New parameter to force to clipped BlockText for SC - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + // check if SdrTextWordWrapItem is set + bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); } - if(pAttribute) - { - delete pAttribute; - } + // create primitive + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( + aAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + b3DShape, + false)); // #SJ# New parameter to force to clipped BlockText for SC + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + // always append an invisible outline for the cases where no visible content exists + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange( + aObjectBound.Left(), aObjectBound.Top(), + aObjectBound.Right(), aObjectBound.Bottom()); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectRange)); + return xRetval; } } // end of namespace contact diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index a0960a5eb7c5..b88578113c5d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -30,7 +30,6 @@ #include <svx/sdr/contact/viewcontactofsdrole2obj.hxx> #include <svx/svdoole2.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/sdr/primitive2d/sdrole2primitive2d.hxx> @@ -72,59 +71,51 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters( bool bHighContrast) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetOle2Obj().getText(0); - - if(pSdrText) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); - const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object matrix - const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // Prepare attribute settings, will be used soon anyways - const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(!pAttribute) - { - // force existence, even when not visible - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0, 0, 0, 0, 0, 0); - } - - // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing - // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect - // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). - // It will also take care of HighContrast and ScaleContent - const drawinglayer::primitive2d::Primitive2DReference xOleContent( - new drawinglayer::primitive2d::SdrOleContentPrimitive2D( - GetOle2Obj(), - aObjectMatrix, - - // #i104867# add GraphicVersion number to be able to check for - // content change in the primitive later - GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), - - bHighContrast)); - - // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. - const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrOle2Primitive2D( + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); + const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // Prepare attribute settings, will be used soon anyways + const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetOle2Obj().getText(0))); + + // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing + // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect + // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). + // It will also take care of HighContrast and ScaleContent + const drawinglayer::primitive2d::Primitive2DReference xOleContent( + new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + GetOle2Obj(), + aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + + bHighContrast)); + + // create primitive. Use Ole2 primitive here. Prepare attribute settings, will + // be used soon anyways. Always create primitives to allow the decomposition of + // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrOle2Primitive2D( xOLEContent, aObjectMatrix, - *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - delete pAttribute; - } + aAttribute)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index c4a51200d5fc..e486f978fafb 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -42,9 +42,9 @@ #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <basegfx/polygon/b2dpolygon.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -98,7 +98,8 @@ namespace sdr const svtools::ColorConfig aColorConfig; const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); const basegfx::BColor aRGBColor(aInitColor.getBColor()); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -202,38 +203,27 @@ namespace sdr } else { - OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); + // build primitive from pObject's attributes + const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes)); - if(rPage.GetObjCount()) + if(!aFill.isDefault()) { - SdrObject* pObject = rPage.GetObj(0); - OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)"); - - if(pObject && pObject->IsMasterPageBackgroundObject()) - { - // build primitive from pObject's attributes - const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); - - if(pFill) - { - 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; - } - } + // 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, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } } @@ -455,23 +445,11 @@ namespace sdr sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const { - sal_uInt32 nSubObjectCount(getPage().GetObjCount()); - - if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nSubObjectCount--; - } - - return nSubObjectCount; + return getPage().GetObjCount(); } ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const { - if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nIndex++; - } - SdrObject* pObj = getPage().GetObj(nIndex); DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)"); return pObj->GetViewContact(); diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index d7a45de423fd..bc4c500ff155 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -31,7 +31,6 @@ #include <svx/sdr/contact/viewcontactofsdrpathobj.hxx> #include <svx/svdopath.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <svx/sdr/primitive2d/sdrpathprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> @@ -53,93 +52,91 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet(); - SdrText* pSdrText = GetPathObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetPathObj().getText(0))); + basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); + sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); + sal_uInt32 nPointCount(0); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count(); + } + + if(!nPointCount) + { + OSL_ENSURE(false, "PolyPolygon object without geometry detected, this should not be created (!)"); + basegfx::B2DPolygon aFallbackLine; + aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0)); + aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0)); + aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine); + + nPolyCount = 1; + } + + // prepare object transformation and unit polygon (direct model data) + basegfx::B2DHomMatrix aObjectMatrix; + const bool bIsLine( + !aUnitPolyPolygon.areControlPointsUsed() + && 1 == nPolyCount + && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - if(pSdrText) + if(bIsLine) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( - rItemSet, - *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); - const sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); - - if(nPolyCount) - { - // prepare object transformation and unit polygon (direct model data) - basegfx::B2DHomMatrix aObjectMatrix; - const bool bIsLine( - !aUnitPolyPolygon.areControlPointsUsed() - && 1 == nPolyCount - && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - - if(bIsLine) - { - // special handling for single line mode (2 points) - const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); - const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); - const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); - const basegfx::B2DVector aLine(aEnd - aStart); - - // #i102548# create new unit polygon for line (horizontal) - basegfx::B2DPolygon aNewPolygon; - aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); - aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); - aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); - - // #i102548# fill objectMatrix with rotation and offset (no shear for lines) - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aLine.getLength(), 1.0, - 0.0, - atan2(aLine.getY(), aLine.getX()), - aStart.getX(), aStart.getY()); - } - else - { - // #i102548# create unscaled, unsheared, unrotated and untranslated polygon - // (unit polygon) by creating the object matrix and back-transforming the polygon - const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); - const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); - const double fWidth(aObjectRange.getWidth()); - const double fHeight(aObjectRange.getHeight()); - const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); - const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); - - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - fScaleX, fScaleY, - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY()); - - // ceate unit polygon from object's absolute path - basegfx::B2DHomMatrix aInverse(aObjectMatrix); - aInverse.invert(); - aUnitPolyPolygon.transform(aInverse); - } - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrPathPrimitive2D( - aObjectMatrix, - *pAttribute, - aUnitPolyPolygon)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // special handling for single line mode (2 points) + const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); + const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); + const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); + const basegfx::B2DVector aLine(aEnd - aStart); + + // #i102548# create new unit polygon for line (horizontal) + basegfx::B2DPolygon aNewPolygon; + aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); + aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); + aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); + + // #i102548# fill objectMatrix with rotation and offset (no shear for lines) + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aLine.getLength(), 1.0, + 0.0, + atan2(aLine.getY(), aLine.getX()), + aStart.getX(), aStart.getY()); } + else + { + // #i102548# create unscaled, unsheared, unrotated and untranslated polygon + // (unit polygon) by creating the object matrix and back-transforming the polygon + const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); + const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); + const double fWidth(aObjectRange.getWidth()); + const double fHeight(aObjectRange.getHeight()); + const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); + const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); + + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fScaleX, fScaleY, + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY()); + + // ceate unit polygon from object's absolute path + basegfx::B2DHomMatrix aInverse(aObjectMatrix); + aInverse.invert(); + aUnitPolyPolygon.transform(aInverse); + } + + // create primitive. Always create primitives to allow the decomposition of + // SdrPathPrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrPathPrimitive2D( + aObjectMatrix, + aAttribute, + aUnitPolyPolygon)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 11d1e0d004f7..fdbfa16dd584 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -31,7 +31,6 @@ #include <svx/sdr/contact/viewcontactofsdrrectobj.hxx> #include <svx/svdorect.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx> #include <svl/itemset.hxx> #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> @@ -55,70 +54,48 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet(); - SdrText* pSdrText = GetRectObj().getText(0); - - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetRectObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // #i105856# use knowledge about pickthrough from the model - const bool bPickThroughTransparentTextFrames( - GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrRectanglePrimitive2D( - aObjectMatrix, - *pAttribute, - fCornerRadiusX, - fCornerRadiusY, - // #i105856# use fill for HitTest when TextFrame and not PickThrough - GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - 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; + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetRectObj().getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetRectObj().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // #i105856# use knowledge about pickthrough from the model + const bool bPickThroughTransparentTextFrames( + GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); + + // create primitive. Always create primitives to allow the decomposition of + // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrRectanglePrimitive2D( + aObjectMatrix, + aAttribute, + fCornerRadiusX, + fCornerRadiusY, + // #i105856# use fill for HitTest when TextFrame and not PickThrough + GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 4262f0fe190f..2a4d527fdcdd 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -47,6 +47,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/controlprimitive2d.hxx> #include <svx/sdr/contact/displayinfo.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> //........................................................................ namespace sdr { namespace contact { @@ -135,35 +136,43 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence() const { + // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use + // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) + // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything + const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object transform + basegfx::B2DHomMatrix aTransform; + + aTransform.set(0, 0, aRange.getWidth()); + aTransform.set(1, 1, aRange.getHeight()); + aTransform.set(0, 2, aRange.getMinX()); + aTransform.set(1, 2, aRange.getMinY()); + Reference< XControlModel > xControlModel = GetSdrUnoObj().GetUnoControlModel(); if(xControlModel.is()) { - // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use - // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) - // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything - const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object transform - basegfx::B2DHomMatrix aTransform; - aTransform.set(0, 0, aRange.getWidth()); - aTransform.set(1, 1, aRange.getHeight()); - aTransform.set(0, 2, aRange.getMinX()); - aTransform.set(1, 2, aRange.getMinY()); - // create control primitive WITHOUT possibly existing XControl; this would be done in // the VOC in createPrimitive2DSequence() - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( - aTransform, xControlModel)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::ControlPrimitive2D( + aTransform, + xControlModel)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } else { - // #i93161# This UnoControl does not yet have a xControlModel (can happen - // during diverse creations). Without a model, create no visualisation. - return drawinglayer::primitive2d::Primitive2DSequence(); + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xRetval( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aTransform)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx index a58ad8a586ea..54d7e6ddae97 100644 --- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx +++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx @@ -33,6 +33,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <vcl/outdev.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -74,29 +75,39 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + // create displacement transformation if we have content + basegfx::B2DHomMatrix aObjectMatrix; + Point aAnchor(GetVirtObj().GetAnchorPos()); + + if(aAnchor.X() || aAnchor.Y()) + { + aObjectMatrix.set(0, 2, aAnchor.X()); + aObjectMatrix.set(1, 2, aAnchor.Y()); + } // use method from referenced object to get the Primitive2DSequence - const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); + const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual( + GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); if(xSequenceVirtual.hasElements()) { - // create displacement transformation if we have content - ::basegfx::B2DHomMatrix aObjectMatrix; - Point aAnchor(GetVirtObj().GetAnchorPos()); - - if(aAnchor.X() || aAnchor.Y()) - { - aObjectMatrix.set(0, 2, aAnchor.X()); - aObjectMatrix.set(1, 2, aAnchor.Y()); - } - // create transform primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::TransformPrimitive2D(aObjectMatrix, xSequenceVirtual)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::TransformPrimitive2D( + aObjectMatrix, + xSequenceVirtual)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx index 780f89dfd249..ec8cdb4ef5ba 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx @@ -35,7 +35,6 @@ #include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx> #include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx> #include <svx/sdr/contact/viewcontactofe3dscene.hxx> -#include <drawinglayer/attribute/sdrattribute3d.hxx> ////////////////////////////////////////////////////////////////////////////// // predeclarations diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index 91e157aeb966..a549b1db1233 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -121,17 +121,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } - else - { - // do neither print nor PDF export the fallback visualisation - if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) - { - // empty group, fallback to parent method which will create the default - // grayed frame for empty 3d scenes by using model data and - // createViewIndependentPrimitive2DSequence::ViewContactOfE3dScene - xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); - } - } if(bIsActiveVC) { diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index 7c17f0bb9144..47c2cccbd02d 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -55,20 +55,6 @@ namespace sdr { } - bool ViewObjectContactOfGroup::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const - { - const bool bHasChildren(0 != GetViewContact().GetObjectCount()); - - if(!bHasChildren && (GetObjectContact().isOutputToPrinter() || GetObjectContact().isOutputToRecordingMetaFile())) - { - // empty group uses fallback gray empty frame display. Do neither print nor PDF export it - return false; - } - - // call parent - return ViewObjectContactOfSdrObj::isPrimitiveVisible(rDisplayInfo); - } - drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const { const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index 728536151608..e779cac4151e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -94,15 +94,13 @@ namespace sdr rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); - // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet - const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject(); - - if(pBackgroundCandidate && aPreprocessedLayers.IsSet(pBackgroundCandidate->GetLayer())) + // check layer visibility (traditionally was member of layer 1) + if(aPreprocessedLayers.IsSet(1)) { // hide PageBackground for special DrawModes; historical reasons if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) { - // if yes, create the default background primitive sequence + // if visible, create the default background primitive sequence xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); } } diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index 9539d79549ff..5ef26193d4b3 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -40,7 +40,7 @@ #include <svx/svdpage.hxx> #include <unoapi.hxx> #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -292,28 +292,19 @@ namespace sdr else if(bCreateGrayFrame) { // #i105146# no content, but frame display. To make hitting the page preview objects - // on the handout page more simple, add a HitTest fill primitive - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); - aOutline.transform(aPageObjectTransform); - - const drawinglayer::primitive2d::Primitive2DReference xHitFill( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aOutline), - basegfx::BColor(0.0, 0.0, 0.0))); - - const drawinglayer::primitive2d::Primitive2DReference xHit( - new drawinglayer::primitive2d::HitTestPrimitive2D( - drawinglayer::primitive2d::Primitive2DSequence(&xHitFill, 1))); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xHit, 1); + // on the handout page more simple, add hidden fill geometry + const drawinglayer::primitive2d::Primitive2DReference xFrameHit( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aPageObjectTransform)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1); } // add a gray outline frame, except not when printing if(bCreateGrayFrame) { const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor); - basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon()); aOwnOutline.transform(aPageObjectTransform); const drawinglayer::primitive2d::Primitive2DReference xGrayFrame( diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index 4b22ec562e6d..b1a4826609f9 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -35,11 +35,11 @@ #include <svx/sdr/contact/objectcontact.hxx> #include <svx/svdview.hxx> #include <drawinglayer/primitive2d/chartprimitive2d.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <com/sun/star/embed/EmbedMisc.hpp> #include <com/sun/star/embed/EmbedStates.hpp> +#include <basegfx/polygon/b2dpolygon.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -203,7 +203,7 @@ namespace sdr if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) { // shade the representation if the object is activated outplace - basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon()); aObjectOutline.transform(aObjectTransform); // Use a FillHatchPrimitive2D with necessary attributes diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx index ce2563169827..dbf38a8cd0f1 100644 --- a/svx/source/sdr/overlay/overlayobjectcell.cxx +++ b/svx/source/sdr/overlay/overlayobjectcell.cxx @@ -35,7 +35,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <drawinglayer/primitive2d/invertprimitive2d.hxx> using namespace ::basegfx; @@ -84,12 +84,12 @@ namespace sdr if(mePaintType == CELL_OVERLAY_TRANSPARENT) { // embed in 50% transparent paint - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, 0.5)); - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } else // CELL_OVERLAY_INVERT { diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index 54a5f3e06616..2115d3c63120 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -35,7 +35,7 @@ #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> #include <drawinglayer/primitive2d/invertprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> @@ -141,8 +141,8 @@ namespace sdr { // embed all rectangles in transparent paint const double fTransparence(mnLastTransparence / 100.0); - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, fTransparence)); @@ -156,13 +156,13 @@ namespace sdr // add both to result aRetval.realloc(2); - aRetval[0] = aUnifiedAlpha; + aRetval[0] = aUnifiedTransparence; aRetval[1] = aSelectionOutline; } else { // just add transparent part - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } } } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 5c61ec81401a..361fc6e1f24d 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -54,14 +54,11 @@ #include <svx/sdsxyitm.hxx> #include <svx/sdshcitm.hxx> #include <svx/sdshtitm.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <drawinglayer/attribute/sdrfillbitmapattribute.hxx> #include <basegfx/polygon/b2dlinegeometry.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/svdotext.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> #include <svx/sdr/attribute/sdrtextattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/xbtmpit.hxx> #include <svl/itempool.hxx> #include <vcl/svapp.hxx> @@ -69,10 +66,22 @@ #include <svx/svx3ditems.hxx> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> -#include <drawinglayer/attribute/sdrattribute3d.hxx> #include <drawinglayer/attribute/sdrallattribute3d.hxx> #include <svx/rectenum.hxx> #include <svx/sdtfchim.hxx> +#include <svx/svdoutl.hxx> +#include <svx/svdmodel.hxx> +#include <editstat.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <svx/sdr/attribute/sdrshadowtextattribute.hxx> +#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> +#include <svx/sdr/attribute/sdrformtextattribute.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> +#include <drawinglayer/attribute/sdrsceneattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightingattribute3d.hxx> +#include <drawinglayer/attribute/sdrlightattribute3d.hxx> +#include <svx/sdr/attribute/sdrfilltextattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -214,9 +223,8 @@ namespace drawinglayer { namespace primitive2d { - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet) + attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet) { - attribute::SdrLineAttribute* pRetval(0L); const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue()); if(XLINE_NONE != eStyle) @@ -246,7 +254,7 @@ namespace drawinglayer } } - pRetval = new attribute::SdrLineAttribute( + return attribute::SdrLineAttribute( XLineJointtoB2DLineJoin(eJoint), (double)nWidth, (double)nTransparence * 0.01, @@ -256,12 +264,13 @@ namespace drawinglayer } } - return pRetval; + return attribute::SdrLineAttribute(); } - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth) + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth) { - attribute::SdrLineStartEndAttribute* pRetval(0L); const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue()); const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue()); basegfx::B2DPolyPolygon aStartPolyPolygon; @@ -321,15 +330,16 @@ namespace drawinglayer if(bStartActive || bEndActive) { - pRetval = new attribute::SdrLineStartEndAttribute(aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered); + return attribute::SdrLineStartEndAttribute( + aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, + bStartActive, bEndActive, bStartCentered, bEndCentered); } - return pRetval; + return attribute::SdrLineStartEndAttribute(); } - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet) + attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet) { - attribute::SdrShadowAttribute* pRetval(0L); const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue()); if(bShadow) @@ -367,16 +377,15 @@ namespace drawinglayer (double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue()); - pRetval = new attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); + return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); } } - return pRetval; + return attribute::SdrShadowAttribute(); } - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet) + attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet) { - attribute::SdrFillAttribute* pRetval(0L); const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue()); if(XFILL_NONE != eStyle) @@ -391,9 +400,9 @@ namespace drawinglayer if(100 != nTransparence) { const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue()); - attribute::FillGradientAttribute* pGradient(0L); - attribute::FillHatchAttribute* pHatch(0L); - attribute::SdrFillBitmapAttribute* pBitmap(0L); + attribute::FillGradientAttribute aGradient; + attribute::FillHatchAttribute aHatch; + attribute::SdrFillBitmapAttribute aBitmap; switch(eStyle) { @@ -405,10 +414,10 @@ namespace drawinglayer } case XFILL_GRADIENT : { - XGradient aGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); + XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); - const Color aStartColor(aGradient.GetStartColor()); - const sal_uInt16 nStartIntens(aGradient.GetStartIntens()); + const Color aStartColor(aXGradient.GetStartColor()); + const sal_uInt16 nStartIntens(aXGradient.GetStartIntens()); basegfx::BColor aStart(aStartColor.getBColor()); if(nStartIntens != 100) @@ -417,8 +426,8 @@ namespace drawinglayer aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); } - const Color aEndColor(aGradient.GetEndColor()); - const sal_uInt16 nEndIntens(aGradient.GetEndIntens()); + const Color aEndColor(aXGradient.GetEndColor()); + const sal_uInt16 nEndIntens(aXGradient.GetEndIntens()); basegfx::BColor aEnd(aEndColor.getBColor()); if(nEndIntens != 100) @@ -427,12 +436,12 @@ namespace drawinglayer aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); } - pGradient = new attribute::FillGradientAttribute( - XGradientStyleToGradientStyle(aGradient.GetGradientStyle()), - (double)aGradient.GetBorder() * 0.01, - (double)aGradient.GetXOffset() * 0.01, - (double)aGradient.GetYOffset() * 0.01, - (double)aGradient.GetAngle() * F_PI1800, + aGradient = attribute::FillGradientAttribute( + XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()), + (double)aXGradient.GetBorder() * 0.01, + (double)aXGradient.GetXOffset() * 0.01, + (double)aXGradient.GetYOffset() * 0.01, + (double)aXGradient.GetAngle() * F_PI1800, aStart, aEnd, ((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue()); @@ -444,7 +453,7 @@ namespace drawinglayer const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue()); const Color aColorB(rHatch.GetColor()); - pHatch = new attribute::FillHatchAttribute( + aHatch = attribute::FillHatchAttribute( XHatchStyleToHatchStyle(rHatch.GetHatchStyle()), (double)rHatch.GetDistance(), (double)rHatch.GetAngle() * F_PI1800, @@ -455,23 +464,25 @@ namespace drawinglayer } case XFILL_BITMAP : { - pBitmap = createNewSdrFillBitmapAttribute(rSet); + aBitmap = createNewSdrFillBitmapAttribute(rSet); break; } } - pRetval = new attribute::SdrFillAttribute( + return attribute::SdrFillAttribute( (double)nTransparence * 0.01, aColor.getBColor(), - pGradient, pHatch, pBitmap); + aGradient, + aHatch, + aBitmap); } } - return pRetval; + return attribute::SdrFillAttribute(); } // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft, @@ -479,7 +490,6 @@ namespace drawinglayer const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); if(rText.GetOutlinerParaObject() && rText.GetModel()) @@ -519,7 +529,11 @@ namespace drawinglayer const SdrFitToSizeType eFit(rTextObj.GetFitToSize()); const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); - pRetval = new attribute::SdrTextAttribute( + // #i107346# + const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj); + const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING); + + return attribute::SdrTextAttribute( rText, aOutlinerParaObject, ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), @@ -535,18 +549,19 @@ namespace drawinglayer SDRTEXTANI_BLINK == eAniKind, SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, bInEditMode, - ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); + ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(), + bWrongSpell); } - return pRetval; + return attribute::SdrTextAttribute(); } - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet) + attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet) { - attribute::FillGradientAttribute* pRetval = 0L; const SfxPoolItem* pGradientItem; - if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) + if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) + && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) { // test if float transparence is completely transparent const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); @@ -559,7 +574,7 @@ namespace drawinglayer const double fStartLum(nStartLuminance / 255.0); const double fEndLum(nEndLuminance / 255.0); - pRetval = new attribute::FillGradientAttribute( + return attribute::FillGradientAttribute( XGradientStyleToGradientStyle(rGradient.GetGradientStyle()), (double)rGradient.GetBorder() * 0.01, (double)rGradient.GetXOffset() * 0.01, @@ -571,12 +586,11 @@ namespace drawinglayer } } - return pRetval; + return attribute::FillGradientAttribute(); } - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) { - attribute::SdrFillBitmapAttribute* pRetval(0L); Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap()); // make sure it's not empty, use default instead @@ -623,7 +637,7 @@ namespace drawinglayer (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(), (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue()); - pRetval = new attribute::SdrFillBitmapAttribute( + return attribute::SdrFillBitmapAttribute( aBitmap, aSize, aOffset, @@ -632,252 +646,174 @@ namespace drawinglayer ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue()); - - return pRetval; } - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText) + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText, + bool bSuppressText) { - attribute::SdrShadowTextAttribute* pRetval(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrTextAttribute aText; // #i98072# added option to suppress text // look for text first - if(!bSuppressText) + if(!bSuppressText && pText) { - pText = createNewSdrTextAttribute(rSet, rText); + aText = createNewSdrTextAttribute(rSet, *pText); } // try shadow - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } - - if(pText || pShadow) - { - pRetval = new attribute::SdrShadowTextAttribute(pShadow, pText); - } + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - return pRetval; + return attribute::SdrShadowTextAttribute(aShadow, aText); } - attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; + aText = createNewSdrTextAttribute(rSet, *pText); + + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.isDefault() + && !aText.getSdrFormTextAttribute().isDefault() + && aText.isHideContour()) + { + bFontworkHideContour = true; + } } // try line style if(!bFontworkHideContour) { - pLine = createNewSdrLineAttribute(rSet); + aLine = createNewSdrLineAttribute(rSet); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } } - // try shadow - if(pLine || pText) + if(!aLine.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); + // try shadow + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText); } - if(pLine || pText) - { - pRetval = new attribute::SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pText); - } - - return pRetval; + return attribute::SdrLineShadowTextAttribute(); } - attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineFillShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; - } - - // try line style - if(!bFontworkHideContour) - { - pLine = createNewSdrLineAttribute(rSet); - - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } + aText = createNewSdrTextAttribute(rSet, *pText); - if(pLine) + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) { - // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + bFontworkHideContour = true; } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); + // try line style + aLine = createNewSdrLineAttribute(rSet); - if(pFill && !pFill->isVisible()) + if(!aLine.isDefault()) { - delete pFill; - pFill = 0L; + // try LineStartEnd + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } - if(pFill) + // try fill style + aFill = createNewSdrFillAttribute(rSet); + + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - // try shadow - if(pLine || pFill || pText) + if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + return attribute::SdrLineFillShadowTextAttribute( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText); } - if(pLine || pFill || pText) - { - pRetval = new attribute::SdrLineFillShadowTextAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient, pText); - } - - return pRetval; + return attribute::SdrLineFillShadowTextAttribute(); } - attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) { - attribute::SdrLineFillShadowAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; // try line style - pLine = createNewSdrLineAttribute(rSet); + const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet)); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } // try fill style - pFill = bSuppressFill ? 0 : createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) + if(!bSuppressFill) { - delete pFill; - pFill = 0L; - } - - if(pFill) - { - // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); - } + aFill = createNewSdrFillAttribute(rSet); - // try shadow - if(pLine || pFill) - { - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) + if(!aFill.isDefault()) { - delete pShadow; - pShadow = 0L; + // try fillfloattransparence + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pLine || pFill) + if(!aLine.isDefault() || !aFill.isDefault()) { - pRetval = new attribute::SdrLineFillShadowAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient); + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); + + return attribute::SdrLineFillShadowAttribute3D( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient); } - return pRetval; + return attribute::SdrLineFillShadowAttribute3D(); } - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet) + attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet) { // get perspective ::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL); @@ -914,10 +850,10 @@ namespace drawinglayer // get two sided lighting const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue()); - return new attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); + return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); } - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet) + attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet) { // extract lights from given SfxItemSet (from scene) ::std::vector< attribute::Sdr3DLightAttribute > aLightVector; @@ -982,7 +918,7 @@ namespace drawinglayer const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue()); const basegfx::BColor aAmbientLight(aAmbientValue.getBColor()); - return new attribute::SdrLightingAttribute(aAmbientLight, aLightVector); + return attribute::SdrLightingAttribute(aAmbientLight, aLightVector); } void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY) @@ -1039,57 +975,50 @@ namespace drawinglayer } // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, - const SdrText* pSdrText, + const SdrText* pText, const sal_Int32* pLeft, const sal_Int32* pUpper, const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrFillTextAttribute* pRetval(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrFillAttribute aFill; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - if(pSdrText) + if(pText) { - pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower); - } + aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower); - // when object has text and text is fontwork and hide contour is set for fontwork, force - // fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) - { - bFontworkHideContour = true; + // when object has text and text is fontwork and hide contour is set for fontwork, force + // fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) + { + bFontworkHideContour = true; + } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) - { - delete pFill; - pFill = 0L; - } + // try fill style + aFill = createNewSdrFillAttribute(rSet); - if(pFill) + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pFill || pText) + if(!aFill.isDefault() || !aText.isDefault()) { - pRetval = new attribute::SdrFillTextAttribute(pFill, pFillFloatTransGradient, pText); + return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText); } - return pRetval; + return attribute::SdrFillTextAttribute(); } } // end of namespace primitive2d diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index b0b76484526d..3757d60a3d27 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -31,7 +31,7 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,6 @@ namespace drawinglayer Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -55,68 +54,66 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(getSdrLFSTAttribute().getFill().isDefault()) { + // create invisible fill for HitTest appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive( + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - *getSdrLFSTAttribute().getFill(), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } else { - // if no fill, create one for HitTest and BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { + // create invisible line for HitTest/BoundRect appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - *getSdrLFSTAttribute().getLine())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - getTail(), - getTransform(), - *getSdrLFSTAttribute().getLine(), - getSdrLFSTAttribute().getLineStartEnd())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getTail()), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect. It - // is sufficient to use the tail; the body is already ensured with fill creation - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( - getTail(), + aUnitOutline, getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createPolygonLinePrimitive( + getTail(), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, @@ -124,9 +121,9 @@ namespace drawinglayer } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index ec2033a702d1..6b52837c3eca 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -31,7 +31,8 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -47,34 +48,45 @@ namespace drawinglayer { Primitive2DSequence aRetval; - // prepare unit transform - ::basegfx::B2DHomMatrix aEmptyMatrix; - // add line - if(getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getUnitPolygon()))); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + getUnitPolygon(), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getLine(), + getSdrLSTAttribute().getLineStartEnd())); } // add text - if(getSdrLSTAttribute().getText()) + if(!getSdrLSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(getUnitPolygon()), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getText(), + getSdrLSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index d4182bc0ab24..710beeb444f2 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -32,6 +32,7 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -48,21 +49,23 @@ namespace drawinglayer Primitive2DSequence aRetval(getSubPrimitives()); // add text - if(getSdrSTAttribute().getText()) + if(!getSdrSTAttribute().getText().isDefault()) { - const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( - basegfx::B2DPolyPolygon(aUnitOutline), - getTextBox(), - *getSdrSTAttribute().getText(), - 0, - false, - getWordWrap(), - isForceTextClipToTextRange())); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTextBox(), + getSdrSTAttribute().getText(), + attribute::SdrLineAttribute(), + false, + getWordWrap(), + isForceTextClipToTextRange())); } // add shadow - if(aRetval.hasElements() && getSdrSTAttribute().getShadow()) + if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault()) { // #i105323# add generic shadow only for 2D shapes. For // 3D shapes shadow will be set at the individual created @@ -76,7 +79,7 @@ namespace drawinglayer // shadow will be correct (using ColorModifierStack), but expensive. if(!get3DShape()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow()); } } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index c274289c09e3..76e6d81bb252 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -27,12 +27,10 @@ #include "precompiled_svx.hxx" #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> -#include <drawinglayer/primitive2d/alphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> +#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> @@ -51,6 +49,10 @@ #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -66,25 +68,25 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { // prepare fully scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); BasePrimitive2D* pNewFillPrimitive = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { - pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient()); + pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getGradient()); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { - pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getHatch()); + pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getHatch()); } - else if(rFill.isBitmap()) + else if(!rFill.getBitmap().isDefault()) { const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange)); + pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap().getFillBitmapAttribute(aRange)); } else { @@ -96,9 +98,9 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rFill.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rFill.getTransparence())); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { // create sequence with created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); @@ -107,11 +109,11 @@ namespace drawinglayer // create FillGradientPrimitive2D for transparence and add to new sequence // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, *pFillGradient)); + const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient)); const Primitive2DSequence aAlpha(&xRefB, 1L); - // create AlphaPrimitive2D using alpha and content - return Primitive2DReference(new AlphaPrimitive2D(aContent, aAlpha)); + // create TransparencePrimitive2D using alpha and content + return Primitive2DReference(new TransparencePrimitive2D(aContent, aAlpha)); } else { @@ -124,7 +126,7 @@ namespace drawinglayer const basegfx::B2DPolygon& rUnitPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke) + const attribute::SdrLineStartEndAttribute& rStroke) { // prepare fully scaled polygon basegfx::B2DPolygon aScaledPolygon(rUnitPolygon); @@ -135,10 +137,10 @@ namespace drawinglayer const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); BasePrimitive2D* pNewLinePrimitive = 0L; - if(!rUnitPolygon.isClosed() && pStroke) + if(!rUnitPolygon.isClosed() && !rStroke.isDefault()) { - attribute::LineStartEndAttribute aStart(pStroke->getStartWidth(), pStroke->getStartPolyPolygon(), pStroke->isStartCentered()); - attribute::LineStartEndAttribute aEnd(pStroke->getEndWidth(), pStroke->getEndPolyPolygon(), pStroke->isEndCentered()); + attribute::LineStartEndAttribute aStart(rStroke.getStartWidth(), rStroke.getStartPolyPolygon(), rStroke.isStartCentered()); + attribute::LineStartEndAttribute aEnd(rStroke.getEndWidth(), rStroke.getEndPolyPolygon(), rStroke.isEndCentered()); // create data pNewLinePrimitive = new PolygonStrokeArrowPrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute, aStart, aEnd); @@ -154,7 +156,7 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewLinePrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rLine.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rLine.getTransparence())); } else { @@ -167,7 +169,7 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds) @@ -178,7 +180,7 @@ namespace drawinglayer if(rText.isContour()) { // contour text - if(pStroke && 0.0 != pStroke->getWidth()) + if(!rStroke.isDefault() && 0.0 != rStroke.getWidth()) { // take line width into account and shrink contour polygon accordingly // decompose to get scale @@ -193,7 +195,7 @@ namespace drawinglayer fabs(aScale.getX()), fabs(aScale.getY()))); // grow the polygon. To shrink, use negative value (half width) - aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); + aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(rStroke.getWidth() * 0.5)); // scale back to unit polygon aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( @@ -217,7 +219,7 @@ namespace drawinglayer rObjectTransform); } } - else if(rText.getSdrFormTextAttribute()) + else if(!rText.getSdrFormTextAttribute().isDefault()) { // text on path, use scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); @@ -226,7 +228,7 @@ namespace drawinglayer &rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon, - *rText.getSdrFormTextAttribute()); + rText.getSdrFormTextAttribute()); } else { @@ -323,7 +325,7 @@ namespace drawinglayer if(rText.isScroll()) { // suppress scroll when FontWork - if(!rText.getSdrFormTextAttribute()) + if(rText.getSdrFormTextAttribute().isDefault()) { // get scroll direction const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection()); @@ -464,7 +466,7 @@ namespace drawinglayer const Primitive2DSequence aTempContent(&aRetval[0], 1); aRetval[0] = Primitive2DReference( - new UnifiedAlphaPrimitive2D( + new UnifiedTransparencePrimitive2D( aTempContent, rShadow.getTransparence())); } diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 243c55b3a0b3..02de307bee77 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -32,10 +32,9 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> #include <basegfx/color/bcolor.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -55,52 +54,73 @@ namespace drawinglayer // Do use createPolygonFromUnitCircle, but let create from first quadrant to mimic old geometry creation. // This is needed to have the same look when stroke is used since the polygon start point defines the // stroke start, too. - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitCircle(1)); // scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipsePrimitive2D::SdrEllipsePrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) : BufferedDecompositionPrimitive2D(), maTransform(rTransform), @@ -138,7 +158,7 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); if(mbCloseSegment) { @@ -146,57 +166,77 @@ namespace drawinglayer { // for compatibility, insert the center point at polygon start to get the same // line stroking pattern as the old painting mechanisms. - aUnitOutline.insert(0L, ::basegfx::B2DPoint(0.0, 0.0)); + aUnitOutline.insert(0L, basegfx::B2DPoint(0.0, 0.0)); } aUnitOutline.setClosed(true); } // move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0)); - aUnitCorrectionMatrix.scale(0.5, 0.5); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill() && aUnitOutline.isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() && aUnitOutline.isClosed()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipseSegmentPrimitive2D::SdrEllipseSegmentPrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fStartAngle, double fEndAngle, diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 77957c809890..e981af91896b 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -32,7 +32,8 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -45,21 +46,25 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill, but only when graphic ist transparent - if(getSdrLFSTAttribute().getFill() && isTransparent()) + if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { // 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(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -67,46 +72,61 @@ namespace drawinglayer 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 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())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } - else - { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); - } // add graphic content if(255L != getGraphicAttr().GetTransparency()) { - Primitive2DReference xGraphicContentPrimitive(new GraphicPrimitive2D(getTransform(), getGraphicObject(), getGraphicAttr())); + const Primitive2DReference xGraphicContentPrimitive( + new GraphicPrimitive2D( + getTransform(), + getGraphicObject(), + getGraphicAttr())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 40c116271a85..e4403cd6df49 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -35,8 +35,8 @@ #include <basegfx/tools/canvastools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -56,36 +56,44 @@ namespace drawinglayer bool bLeftActive, bool bRightActive) const { - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); basegfx::B2DPolygon aPolygon; aPolygon.append(rStart); aPolygon.append(rEnd); - if(!pLineStartEnd || (!bLeftActive && !bRightActive)) + if(rLineStartEnd.isDefault() || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + attribute::SdrLineStartEndAttribute()); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + rLineStartEnd); } const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( - bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, - bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0, - bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, - bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); + bLeftActive ? rLineStartEnd.getStartPolyPolygon() : aEmpty, bRightActive ? rLineStartEnd.getEndPolyPolygon() : aEmpty, + bLeftActive ? rLineStartEnd.getStartWidth() : 0.0, bRightActive ? rLineStartEnd.getEndWidth() : 0.0, + bLeftActive ? rLineStartEnd.isStartActive() : false, bRightActive ? rLineStartEnd.isEndActive() : false, + bLeftActive ? rLineStartEnd.isStartCentered() : false, bRightActive? rLineStartEnd.isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - SdrBlockTextPrimitive2D* pBlockText = 0L; + SdrBlockTextPrimitive2D* pBlockText = 0; basegfx::B2DRange aTextRange; double fTextX((getStart().getX() + getEnd().getX()) * 0.5); double fTextY((getStart().getX() + getEnd().getX()) * 0.5); @@ -93,11 +101,13 @@ namespace drawinglayer const double fDistance(aLine.getLength()); const double fAngle(atan2(aLine.getY(), aLine.getX())); bool bAutoUpsideDown(false); - const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText(); + const attribute::SdrTextAttribute rTextAttribute = getSdrLSTAttribute().getText(); const basegfx::B2DHomMatrix aObjectMatrix( basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart())); - if(pTextAttribute) + // preapare text, but do not add yet; it needs to be aligned to + // the line geometry + if(!rTextAttribute.isDefault()) { basegfx::B2DHomMatrix aTextMatrix; double fTestAngle(fAngle); @@ -123,58 +133,52 @@ namespace drawinglayer // create primitive and get text range pBlockText = new SdrBlockTextPrimitive2D( - &pTextAttribute->getSdrText(), - pTextAttribute->getOutlinerParaObject(), + &rTextAttribute.getSdrText(), + rTextAttribute.getOutlinerParaObject(), aTextMatrix, SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER, - pTextAttribute->isScroll(), + rTextAttribute.isScroll(), false, false, false, false); + aTextRange = pBlockText->getB2DRange(aViewInformation); } // prepare line attribute and result - const attribute::SdrLineAttribute* pLineAttribute(getSdrLSTAttribute().getLine()); - - if(!pLineAttribute) - { - // if initially no line is defined, create one for HitTest and BoundRect - pLineAttribute = new attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)); - } - { + const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine()); bool bArrowsOutside(false); bool bMainLineSplitted(false); - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); double fStartArrowW(0.0); double fStartArrowH(0.0); double fEndArrowW(0.0); double fEndArrowH(0.0); - if(pLineStartEnd) + if(!rLineStartEnd.isDefault()) { - if(pLineStartEnd->isStartActive()) + if(rLineStartEnd.isStartActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon())); - fStartArrowW = pLineStartEnd->getStartWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getStartPolyPolygon())); + fStartArrowW = rLineStartEnd.getStartWidth(); fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isStartCentered()) + if(rLineStartEnd.isStartCentered()) { fStartArrowH *= 0.5; } } - if(pLineStartEnd->isEndActive()) + if(rLineStartEnd.isEndActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon())); - fEndArrowW = pLineStartEnd->getEndWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getEndPolyPolygon())); + fEndArrowW = rLineStartEnd.getEndWidth(); fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isEndCentered()) + if(rLineStartEnd.isEndCentered()) { fEndArrowH *= 0.5; } @@ -183,7 +187,7 @@ namespace drawinglayer const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5)); const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5); - const double fHalfLineWidth(pLineAttribute->getWidth() * 0.5); + const double fHalfLineWidth(rLineAttribute.getWidth() * 0.5); if(fSpaceNeededByArrows > fDistance) { @@ -275,12 +279,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); } } else @@ -291,12 +295,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); } } @@ -309,13 +313,13 @@ namespace drawinglayer const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); // text horizontal position if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal) @@ -329,9 +333,9 @@ namespace drawinglayer fTextX -= (fArrowsOutsideLen - fStartArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX -= pTextAttribute->getTextRightDistance(); + fTextX -= rTextAttribute.getTextRightDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal) @@ -345,9 +349,9 @@ namespace drawinglayer fTextX += (fArrowsOutsideLen - fEndArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += pTextAttribute->getTextLeftDistance(); + fTextX += rTextAttribute.getTextLeftDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -355,9 +359,9 @@ namespace drawinglayer // centered fTextX = aMainLeft.getX() + ((fDistance - aTextRange.getWidth()) * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += (pTextAttribute->getTextLeftDistance() - pTextAttribute->getTextRightDistance()) / 2L; + fTextX += (rTextAttribute.getTextLeftDistance() - rTextAttribute.getTextRightDistance()) / 2L; } } @@ -368,9 +372,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() - (aTextRange.getHeight() + fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY -= pTextAttribute->getTextLowerDistance(); + fTextY -= rTextAttribute.getTextLowerDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eVertical) @@ -379,9 +383,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() + (fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += pTextAttribute->getTextUpperDistance(); + fTextY += rTextAttribute.getTextUpperDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -389,21 +393,19 @@ namespace drawinglayer // centered fTextY = aMainLeft.getY() - (aTextRange.getHeight() * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += (pTextAttribute->getTextUpperDistance() - pTextAttribute->getTextLowerDistance()) / 2L; + fTextY += (rTextAttribute.getTextUpperDistance() - rTextAttribute.getTextLowerDistance()) / 2L; } } } - if(!getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - // embed line geometry to invisible line group - const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval)); - aRetval = Primitive2DSequence(&xHiddenLines, 1); + // embed line geometry to invisible (100% transparent) line group for HitTest + const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(aRetval)); - // delete temporary LineAttribute again - delete pLineAttribute; + aRetval = Primitive2DSequence(&xHiddenLines, 1); } if(pBlockText) @@ -433,9 +435,11 @@ namespace drawinglayer } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index b99486669e93..43e3cf72ffbb 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -30,7 +30,8 @@ #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -59,7 +60,13 @@ namespace drawinglayer { const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; - if(getOLEContent() == rCompare.getOLEContent() + // #i108636# The standard operator== on two UNO sequences did not work as i + // would have expected; it just checks the .is() states and the data type + // of the sequence. What i need here is detection of equality of the whole + // sequence content, thus i need to use the arePrimitive2DSequencesEqual helper + // here instead of the operator== which lead to always returning false and thus + // always re-decompositions of the subcontent. + if(arePrimitive2DSequencesEqual(getOLEContent(), rCompare.getOLEContent()) && getTransform() == rCompare.getTransform() && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) { @@ -80,23 +87,29 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getFill()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line // #i97981# condition was inverse to purpose. When being compatible to paint version, // border needs to be suppressed - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getLine().isDefault()) { // 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(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -104,27 +117,37 @@ namespace drawinglayer 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 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())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } else { // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add graphic content @@ -132,15 +155,26 @@ namespace drawinglayer // add text, no need to supress to stay compatible since text was // always supported by the old paints, too - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getShadow()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index 0254d84a5ae0..70c1feda75a8 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -134,7 +134,7 @@ namespace drawinglayer if(aColor.bIsVisible) { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); const Color aVclColor(aColor.nColor); aOutline.transform(getObjectTransform()); const drawinglayer::primitive2d::Primitive2DReference xOutline( diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 73db4cffe352..ac9b6307dd05 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -31,7 +31,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -48,50 +48,67 @@ namespace drawinglayer Primitive2DSequence aRetval; // add fill - if(getSdrLFSTAttribute().getFill() && getUnitPolyPolygon().isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() + && getUnitPolyPolygon().isClosed()) { // take care for orientations - basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(basegfx::tools::correctOrientations(getUnitPolyPolygon())); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon( + basegfx::tools::correctOrientations(getUnitPolyPolygon())); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aOrientedUnitPolyPolygon, + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - Primitive2DSequence aTemp(getUnitPolyPolygon().count()); - - for(sal_uInt32 a(0L); a < getUnitPolyPolygon().count(); a++) - { - aTemp[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd()); - } - - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); + // if initially no line is defined, create one for HitTest and BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + getUnitPolyPolygon(), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - Primitive2DSequence xHiddenLineSequence(getUnitPolyPolygon().count()); + Primitive2DSequence aTemp(getUnitPolyPolygon().count()); for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++) { - xHiddenLineSequence[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), aBlackHairline); + aTemp[a] = createPolygonLinePrimitive( + getUnitPolyPolygon().getB2DPolygon(a), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd()); } - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + getUnitPolyPolygon(), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index 8473ba14d6f4..8f188e9fcf6f 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -29,10 +29,6 @@ #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> #include <vcl/lazydelete.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -173,19 +169,6 @@ namespace drawinglayer return aRetVal.get() ? *aRetVal.get() : BitmapEx(); } - // #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/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 6a0293f2ace3..60b8ca1c7817 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -31,7 +31,8 @@ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -46,7 +47,6 @@ namespace drawinglayer Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -55,64 +55,67 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } else if(getForceFillForHitTest()) { // if no fill and it's a text frame, create a fill for HitTest and // BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolyPolygonFillPrimitive( + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( aUnitOutline, getTransform(), - *getSdrLFSTAttribute().getLine())); + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else if(!getForceFillForHitTest()) { // if initially no line is defined and it's not a text frame, create // a line for HitTest and BoundRect - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } - - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx index db9f957280ef..3a15c3a392d9 100644 --- a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx +++ b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx @@ -30,8 +30,11 @@ #include <svl/itemset.hxx> #include <com/sun/star/drawing/NormalsKind.hpp> #include <com/sun/star/drawing/TextureProjectionMode.hpp> -#include <drawinglayer/attribute/sdrattribute3d.hxx> +#include <com/sun/star/drawing/TextureKind2.hpp> +#include <com/sun/star/drawing/TextureMode.hpp> #include <svx/xflclit.hxx> +#include <drawinglayer/attribute/materialattribute3d.hxx> +#include <drawinglayer/attribute/sdrobjectattribute3d.hxx> ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 138505cadf61..15142a86b9cf 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -584,22 +584,6 @@ namespace sdr bHintUsed = sal_True; } - // #111111# - // When it's the BackgroundObject, set the MasterPage to changed to - // get a refresh for the evtl. changed BackgroundStyle - - // #114265# - // To only invalidate the page when the StyleSheet change happens, - // some more rigid testing is necessary. - const SfxSimpleHint *pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint); - - if(pSimpleHint - && pSimpleHint->GetId() == SFX_HINT_DATACHANGED - && GetSdrObject().IsMasterPageBackgroundObject()) - { - GetSdrObject().GetPage()->ActionChanged(); - } - if(!bHintUsed) { // forward to SdrObject ATM. Not sure if this will be necessary diff --git a/svx/source/sdr/properties/makefile.mk b/svx/source/sdr/properties/makefile.mk index 2ab52e18aec1..5296765769b1 100644 --- a/svx/source/sdr/properties/makefile.mk +++ b/svx/source/sdr/properties/makefile.mk @@ -47,6 +47,7 @@ SLOFILES=\ $(SLO)$/textproperties.obj \ $(SLO)$/customshapeproperties.obj \ $(SLO)$/rectangleproperties.obj \ + $(SLO)$/oleproperties.obj \ $(SLO)$/captionproperties.obj \ $(SLO)$/circleproperties.obj \ $(SLO)$/connectorproperties.obj \ diff --git a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx b/svx/source/sdr/properties/oleproperties.cxx index b3159b355c48..b2a103bd8cfc 100644 --- a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx +++ b/svx/source/sdr/properties/oleproperties.cxx @@ -2,10 +2,13 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: graphicproperties.cxx,v $ + * $Revision: 1.12.76.1 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -26,43 +29,52 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" +#include "precompiled_svx.hxx" -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> -#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <svx/sdr/properties/oleproperties.hxx> +#include <svl/itemset.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xlineit0.hxx> ////////////////////////////////////////////////////////////////////////////// -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer +namespace sdr { - namespace primitive2d + namespace properties { - HitTestPrimitive2D::HitTestPrimitive2D( - const Primitive2DSequence& rChildren) - : GroupPrimitive2D(rChildren) + OleProperties::OleProperties(SdrObject& rObj) + : RectangleProperties(rObj) + { + } + + OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj) + : RectangleProperties(rProps, rObj) { } - basegfx::B2DRange HitTestPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + OleProperties::~OleProperties() { - return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); } - Primitive2DSequence HitTestPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + BaseProperties& OleProperties::Clone(SdrObject& rObj) const { - // return empty sequence - return Primitive2DSequence(); + return *(new OleProperties(*this, rObj)); } - // provide unique ID - ImplPrimitrive2DIDBlock(HitTestPrimitive2D, PRIMITIVE2D_ID_HITTESTPRIMITIVE2D) + void OleProperties::ForceDefaultAttributes() + { + // call parent + RectangleProperties::ForceDefaultAttributes(); - } // end of namespace primitive2d -} // end of namespace drawinglayer + // force ItemSet + GetObjectItemSet(); + + // #i108221# + mpItemSet->Put( XFillStyleItem(XFILL_NONE) ); + mpItemSet->Put( XLineStyleItem(XLINE_NONE) ); + } + } // end of namespace properties +} // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// // eof diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 0ba4df9bf2be..6bcdd8f55856 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -33,6 +33,8 @@ // #i42075# #include <svx/svdobj.hxx> +#include <svx/xfillit0.hxx> +#include <svl/itemset.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -73,7 +75,8 @@ namespace sdr { if(!mpViewContact) { - ((MasterPageDescriptor*)this)->mpViewContact = ((MasterPageDescriptor*)this)->CreateObjectSpecificViewContact(); + const_cast< MasterPageDescriptor* >(this)->mpViewContact = + const_cast< MasterPageDescriptor* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; @@ -93,14 +96,6 @@ namespace sdr { maVisibleLayers = rNew; GetViewContact().ActionChanged(); - - // #i42075# For AFs convenience, do a change notify at the MasterPageBackgroundObject, too - SdrObject* pObject = GetBackgroundObject(); - - if(pObject) - { - pObject->BroadcastObjectChange(); - } } } @@ -119,40 +114,16 @@ namespace sdr || maVisibleLayers != rCandidate.maVisibleLayers); } - // #i42075# Get the correct BackgroundObject - SdrObject* MasterPageDescriptor::GetBackgroundObject() const + const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const { - SdrObject* pRetval = 0L; - const SdrPage& rMasterPage = GetUsedPage(); - - // Here i will rely on old knowledge about the 0'st element of a masterpage - // being the PageBackgroundObject. This will be removed again when that definition - // will be changed. -#ifdef DBG_UTIL - const sal_uInt32 nMasterPageObjectCount(rMasterPage.GetObjCount()); - DBG_ASSERT(1 <= nMasterPageObjectCount, - "MasterPageDescriptor::GetBackgroundObject(): MasterPageBackgroundObject missing (!)"); -#endif - pRetval = rMasterPage.GetObj(0L); - - // Test if it's really what we need. There are known problems where - // the 0th object is not the MasterPageBackgroundObject at all. - if(pRetval && !pRetval->IsMasterPageBackgroundObject()) - { - pRetval = 0L; - } - - // Get the evtl. existing page background object from the using page and use it - // preferred to the MasterPageBackgroundObject - const SdrPage& rOwnerPage = GetOwnerPage(); - SdrObject* pCandidate = rOwnerPage.GetBackgroundObj(); + const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); - if(pCandidate) + if(XFILL_NONE != ((const XFillStyleItem&)rOwnerPageAtributes.Get(XATTR_FILLSTYLE)).GetValue()) { - pRetval = pCandidate; + return rOwnerPageAtributes; } - return pRetval; + return GetUsedPage().getSdrPageProperties().GetItemSet(); } } // end of namespace sdr diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 9a0be80c50dc..d04bf8851795 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -66,7 +66,7 @@ #include <svx/sdr/contact/viewcontact.hxx> #include <svx/sdr/contact/displayinfo.hxx> #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <svx/sdr/contact/objectcontact.hxx> #include "svditer.hxx" #include <svx/svdopath.hxx> @@ -75,13 +75,14 @@ #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <svx/svdoole2.hxx> #include <svx/svdovirt.hxx> #include <svx/svdouno.hxx> #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -674,7 +675,7 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay createSdrDragEntries(); } - // if there are entries, derive OverlayObjects fromthe entries, including + // if there are entries, derive OverlayObjects from the entries, including // modification from current interactive state if(maSdrDragEntries.size()) { @@ -723,8 +724,8 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay if(aResultTransparent.hasElements()) { - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aResultTransparent, 0.5)); - aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5)); + aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent); rOverlayManager.add(*pNewOverlayObject); @@ -819,38 +820,36 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla // this polygon is a temporary calculated connector path, so it is not possible to fetch // the needed primitives directly from the pEdge object which does not get changed. If full // drag is on, use the SdrObjects ItemSet to create a adequate representation - if(getSolidDraggingActive()) - { - const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); - drawinglayer::attribute::SdrLineAttribute* pLine = drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet); - drawinglayer::attribute::SdrLineStartEndAttribute* pLineStartEnd = 0; + bool bUseSolidDragging(getSolidDraggingActive()); - if(pLine && !pLine->isVisible()) + if(bUseSolidDragging) + { + // switch off solid dragging if connector is not visible + if(!pEdge->HasLineStyle()) { - delete pLine; - pLine = 0; + bUseSolidDragging = false; } + } - if(pLine) - { - pLineStartEnd = drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(rItemSet, pLine->getWidth()); + if(bUseSolidDragging) + { + const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); + const drawinglayer::attribute::SdrLineAttribute aLine( + drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet)); - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0; - } + if(!aLine.isDefault()) + { + const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd( + drawinglayer::primitive2d::createNewSdrLineStartEndAttribute( + rItemSet, + aLine.getWidth())); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive( - aEdgePolygon, basegfx::B2DHomMatrix(), *pLine, pLineStartEnd)); - - if(pLineStartEnd) - { - delete pLineStartEnd; - } - - delete pLine; + aEdgePolygon, + basegfx::B2DHomMatrix(), + aLine, + aLineStartEnd)); } } else diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index effddf73fd51..3b878ce93138 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -805,16 +805,101 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) void SdrEditView::DeleteMarkedObj() { - if (GetMarkedObjectCount()) { - BrkAction(); - //HMHHideMarkHdl(); - BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + // moved breaking action and undo start outside loop + BrkAction(); + BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + + // remove as long as something is selected. This allows to schedule objects for + // removal for a next run as needed + while(GetMarkedObjectCount()) + { + // vector to remember the parents which may be empty after object removal + std::vector< SdrObject* > aParents; + + { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const sal_uInt32 nCount(rMarkList.GetMarkCount()); + sal_uInt32 a(0); + + for(a = 0; a < nCount; a++) + { + // in the first run, add all found parents, but only once + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + SdrObject* pParent = pObject->GetObjList()->GetOwnerObj(); + + if(pParent) + { + if(aParents.size()) + { + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pParent); + + if(aFindResult == aParents.end()) + { + aParents.push_back(pParent); + } + } + else + { + aParents.push_back(pParent); + } + } + } + + if(aParents.size()) + { + // in a 2nd run, remove all objects which may already be scheduled for + // removal. I am not sure if this can happen, but theoretically + // a to-be-removed object may already be the group/3DScene itself + for(a = 0; a < nCount; a++) + { + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pObject); + + if(aFindResult != aParents.end()) + { + aParents.erase(aFindResult); + } + } + } + } + + // original stuff: remove selected objects. Handle clear will + // do something only once DeleteMarkedList(GetMarkedObjectList()); GetMarkedObjectListWriteAccess().Clear(); aHdl.Clear(); - EndUndo(); - MarkListHasChanged(); + + while(aParents.size() && !GetMarkedObjectCount()) + { + // iterate over remembered parents + SdrObject* pParent = aParents.back(); + aParents.pop_back(); + + if(pParent->GetSubList() && 0 == pParent->GetSubList()->GetObjCount()) + { + // we detected an empty parent, a candidate to leave group/3DScene + // if entered + if(GetSdrPageView()->GetAktGroup() + && GetSdrPageView()->GetAktGroup() == pParent) + { + GetSdrPageView()->LeaveOneGroup(); + } + + // schedule empty parent for removal + GetMarkedObjectListWriteAccess().InsertEntry( + SdrMark(pParent, GetSdrPageView())); + } + } } + + // end undo and change messaging moved at the end + EndUndo(); + MarkListHasChanged(); } void SdrEditView::CopyMarkedObj() diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 46bd31768c93..3d90eae6d68c 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -281,13 +281,13 @@ SdrHdlBitmapSet& getSimpleSet() SdrHdlBitmapSet& getModernSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS)); return *aModernSet.get(); } SdrHdlBitmapSet& getHighContrastSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS)); return *aHighContrastSet.get(); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index d44b44210ca0..6eb96fe4f088 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -326,7 +326,8 @@ sdr::properties::BaseProperties& SdrObject::GetProperties() const { if(!mpProperties) { - ((SdrObject*)this)->mpProperties = ((SdrObject*)this)->CreateObjectSpecificProperties(); + const_cast< SdrObject* >(this)->mpProperties = + const_cast< SdrObject* >(this)->CreateObjectSpecificProperties(); } return *mpProperties; @@ -361,7 +362,8 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const { if(!mpViewContact) { - ((SdrObject*)this)->mpViewContact = ((SdrObject*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrObject* >(this)->mpViewContact = + const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; @@ -370,51 +372,6 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const // DrawContact support: Methods for handling Object changes void SdrObject::ActionChanged() const { - // Forward change call to MasterPageDescriptor if BackgroundObject was changed - const SdrPage* pObjectsPage = GetPage(); - - if(pObjectsPage) - { - // do the necessary ActionChange() forwards when a MasterPageBackgroundObject - // gets changed. This can be removed as soon as the MasterPageBackgroundObject - // handling is replaced with the proper ItemSet handling at the SdrPages. The - // needed ActionChanged calls will then be triggered by changing those ItemSets. - if(pObjectsPage->IsMasterPage()) - { - if(IsMasterPageBackgroundObject()) - { - SdrModel* pObjectsModel = GetModel(); - - if(pObjectsModel) - { - const sal_uInt16 nCount(pObjectsModel->GetPageCount()); - - for(sal_uInt16 a(0); a < nCount; a++) - { - const SdrPage* pUserPage = pObjectsModel->GetPage(a); - - if(pUserPage && pUserPage->TRG_HasMasterPage()) - { - SdrPage& rUsedMasterPage = pUserPage->TRG_GetMasterPage(); - - if(&rUsedMasterPage == pObjectsPage) - { - pUserPage->TRG_GetMasterPageDescriptorViewContact().ActionChanged(); - } - } - } - } - } - } - else - { - if(pObjectsPage->TRG_HasMasterPage() && pObjectsPage->GetBackgroundObj() == this) - { - pObjectsPage->TRG_GetMasterPageDescriptorViewContact().ActionChanged(); - } - } - } - // Do necessary ViewContact actions GetViewContact().ActionChanged(); } @@ -3112,26 +3069,6 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba SetSnapRect(aBaseRect); } -// #111111# -// Needed again and again i will now add a test for finding out if -// this object is the BackgroundObject of the page. -sal_Bool SdrObject::IsMasterPageBackgroundObject() const -{ - if(pObjList - && pObjList == pPage - && pPage->IsMasterPage() - && pObjList->GetObj(0) == this - && 1L == (pPage->GetPageNum() % 2)) - { - // 0'th object, directly on page, page is MasterPage, - // MasterPagePageNum is 1,3,5,... - // --> It's the background object (!) - return sal_True; - } - - return sal_False; -} - // #116168# // Give info if object is in destruction sal_Bool SdrObject::IsInDestruction() const diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 861ca038fd89..b92157823081 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -843,7 +843,7 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons } // geometry access -::basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const +basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const { return aTailPoly.getB2DPolygon(); } diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index adf3379a0330..4060369f8016 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -80,7 +80,7 @@ sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties() { - return new sdr::properties::GroupProperties((SdrObject&)(*this)); + return new sdr::properties::GroupProperties(*this); } ////////////////////////////////////////////////////////////////////////////// @@ -163,6 +163,12 @@ void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const } +void SdrObjGroup::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + UINT16 SdrObjGroup::GetObjIdentifier() const { return UINT16(OBJ_GRUP); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index efafebc62759..88d9aba87673 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -85,6 +85,7 @@ #include <svtools/chartprettypainter.hxx> #include <svx/sdr/contact/viewcontactofsdrole2obj.hxx> #include <svx/svdograf.hxx> +#include <svx/sdr/properties/oleproperties.hxx> // #i100710# #include <svx/xlnclit.hxx> @@ -732,6 +733,14 @@ static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObj } ////////////////////////////////////////////////////////////////////////////// +// BaseProperties section + +sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties() +{ + return new sdr::properties::OleProperties(*this); +} + +////////////////////////////////////////////////////////////////////////////// // DrawContact section sdr::contact::ViewContact* SdrOle2Obj::CreateObjectSpecificViewContact() diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 3278b93a6338..2b495725c006 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -76,6 +76,7 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } #include <svx/sdr/attribute/sdrtextattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <svx/sdr/attribute/sdrformtextattribute.hxx> using namespace sdr; @@ -2741,13 +2742,10 @@ SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index) SdrObject* SdrPathObj::DoConvertToPolyObj(BOOL bBezier) const { // #i89784# check for FontWork with activated HideContour - bool bHideContour(false); - - { - drawinglayer::attribute::SdrTextAttribute* pText = drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0)); - bHideContour = pText && pText->getSdrFormTextAttribute() && pText->isHideContour(); - delete pText; - } + const drawinglayer::attribute::SdrTextAttribute aText( + drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0))); + const bool bHideContour( + !aText.isDefault() && !aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()); SdrObject* pRet = bHideContour ? 0 : diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 1c9075d46886..b03dbf5b903a 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -316,50 +316,67 @@ void SdrRectObj::NbcSetLogicRect(const Rectangle& rRect) sal_uInt32 SdrRectObj::GetHdlCount() const { - return 9L; + return IsTextFrame() ? 10 : 9; } SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const { - SdrHdl* pH=NULL; + SdrHdl* pH = NULL; Point aPnt; - SdrHdlKind eKind=HDL_MOVE; - if( IsTextFrame() && !nHdlNum ) + SdrHdlKind eKind = HDL_MOVE; + + if(!IsTextFrame()) { - pH=new ImpTextframeHdl(aRect); - pH->SetObj((SdrObject*)this); - pH->SetDrehWink(aGeo.nDrehWink); - return pH; + nHdlNum++; } - else + + switch(nHdlNum) { - switch (nHdlNum) { - case 0: { - long a=GetEckenradius(); - long b=Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert - if (a>b) a=b; - if (a<0) a=0; - aPnt=aRect.TopLeft(); - aPnt.X()+=a; - eKind=HDL_CIRC; - } break; // Eckenradius - case 1: aPnt=aRect.TopLeft(); eKind=HDL_UPLFT; break; // Oben links - case 2: aPnt=aRect.TopCenter(); eKind=HDL_UPPER; break; // Oben - case 3: aPnt=aRect.TopRight(); eKind=HDL_UPRGT; break; // Oben rechts - case 4: aPnt=aRect.LeftCenter(); eKind=HDL_LEFT ; break; // Links - case 5: aPnt=aRect.RightCenter(); eKind=HDL_RIGHT; break; // Rechts - case 6: aPnt=aRect.BottomLeft(); eKind=HDL_LWLFT; break; // Unten links - case 7: aPnt=aRect.BottomCenter(); eKind=HDL_LOWER; break; // Unten - case 8: aPnt=aRect.BottomRight(); eKind=HDL_LWRGT; break; // Unten rechts + case 0: + { + pH = new ImpTextframeHdl(aRect); + pH->SetObj((SdrObject*)this); + pH->SetDrehWink(aGeo.nDrehWink); + break; + } + case 1: + { + long a = GetEckenradius(); + long b = Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert + if (a>b) a=b; + if (a<0) a=0; + aPnt=aRect.TopLeft(); + aPnt.X()+=a; + eKind = HDL_CIRC; + break; } + case 2: aPnt=aRect.TopLeft(); eKind = HDL_UPLFT; break; // Oben links + case 3: aPnt=aRect.TopCenter(); eKind = HDL_UPPER; break; // Oben + case 4: aPnt=aRect.TopRight(); eKind = HDL_UPRGT; break; // Oben rechts + case 5: aPnt=aRect.LeftCenter(); eKind = HDL_LEFT ; break; // Links + case 6: aPnt=aRect.RightCenter(); eKind = HDL_RIGHT; break; // Rechts + case 7: aPnt=aRect.BottomLeft(); eKind = HDL_LWLFT; break; // Unten links + case 8: aPnt=aRect.BottomCenter(); eKind = HDL_LOWER; break; // Unten + case 9: aPnt=aRect.BottomRight(); eKind = HDL_LWRGT; break; // Unten rechts } - if (aGeo.nShearWink!=0) ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan); - if (aGeo.nDrehWink!=0) RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); - if (eKind!=HDL_MOVE) { - pH=new SdrHdl(aPnt,eKind); + + if(!pH) + { + if(aGeo.nShearWink) + { + ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan); + } + + if(aGeo.nDrehWink) + { + RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); + } + + pH = new SdrHdl(aPnt,eKind); pH->SetObj((SdrObject*)this); pH->SetDrehWink(aGeo.nDrehWink); } + return pH; } diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 9ac4534b329e..f6780bd7c90d 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -62,7 +62,7 @@ #include <svx/xlinjoit.hxx> #include <svx/xlndsit.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> -#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <editeng/editstat.hxx> #include <unoapi.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> @@ -226,7 +226,7 @@ namespace { class impPolygonParagraphHandler { - const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters + const drawinglayer::attribute::SdrFormTextAttribute maSdrFormTextAttribute; // FormText parameters std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator @@ -269,7 +269,7 @@ namespace const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition) - : mrSdrFormTextAttribute(rSdrFormTextAttribute), + : maSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) { @@ -293,18 +293,18 @@ namespace double fPolyStart(0.0); double fScaleFactor(1.0); - if(mrSdrFormTextAttribute.getFormTextMirror()) + if(maSdrFormTextAttribute.getFormTextMirror()) { aPolygonCandidate.flip(); } - if(mrSdrFormTextAttribute.getFormTextStart() - && (XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust() - || XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust())) + if(maSdrFormTextAttribute.getFormTextStart() + && (XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust() + || XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust())) { - if(XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust()) { - fPolyStart += mrSdrFormTextAttribute.getFormTextStart(); + fPolyStart += maSdrFormTextAttribute.getFormTextStart(); if(fPolyStart > fPolyEnd) { @@ -313,7 +313,7 @@ namespace } else { - fPolyEnd -= mrSdrFormTextAttribute.getFormTextStart(); + fPolyEnd -= maSdrFormTextAttribute.getFormTextStart(); if(fPolyEnd < fPolyStart) { @@ -322,7 +322,7 @@ namespace } } - if(XFT_LEFT != mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT != maSdrFormTextAttribute.getFormTextAdjust()) { // calculate total text length of this paragraph, some layout needs to be done const double fParagraphTextLength(getParagraphTextLength(rTextPortions)); @@ -331,7 +331,7 @@ namespace // but still take care of XFT_AUTOSIZE in that case const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart)); - if(XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -339,7 +339,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength); } } - else if(XFT_CENTER == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_CENTER == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -347,7 +347,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0; } } - else if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) @@ -382,7 +382,7 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand portion length fPortionLength *= fScaleFactor; @@ -397,27 +397,27 @@ namespace aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand text primitive scaling aNewTransformA.scale(fScaleFactor, fScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition - const bool bShadow(XFTSHADOW_NONE != mrSdrFormTextAttribute.getFormTextShadow()); + const bool bShadow(XFTSHADOW_NONE != maSdrFormTextAttribute.getFormTextShadow()); if(bShadow) { - if(XFTSHADOW_NORMAL == mrSdrFormTextAttribute.getFormTextShadow()) + if(XFTSHADOW_NORMAL == maSdrFormTextAttribute.getFormTextShadow()) { aNewShadowTransform.translate( - mrSdrFormTextAttribute.getFormTextShdwXVal(), - -mrSdrFormTextAttribute.getFormTextShdwYVal()); + maSdrFormTextAttribute.getFormTextShdwXVal(), + -maSdrFormTextAttribute.getFormTextShdwYVal()); } else // XFTSHADOW_SLANT { - double fScaleValue(mrSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); - double fShearValue(-mrSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); + double fScaleValue(maSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); + double fShearValue(-maSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); aNewShadowTransform.scale(1.0, fScaleValue); aNewShadowTransform.shearX(sin(fShearValue)); @@ -425,7 +425,7 @@ namespace } } - switch(mrSdrFormTextAttribute.getFormTextStyle()) + switch(maSdrFormTextAttribute.getFormTextStyle()) { case XFT_ROTATE : { @@ -483,7 +483,7 @@ namespace } // distance from path? - if(mrSdrFormTextAttribute.getFormTextDistance()) + if(maSdrFormTextAttribute.getFormTextDistance()) { if(aEndPos.equal(aStartPos)) { @@ -493,7 +493,7 @@ namespace // use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff const basegfx::B2DVector aPerpendicular( basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) * - mrSdrFormTextAttribute.getFormTextDistance()); + maSdrFormTextAttribute.getFormTextDistance()); aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } @@ -502,7 +502,7 @@ namespace { if(pCandidate->getText().Len() && nNextGlyphLen) { - const Color aShadowColor(mrSdrFormTextAttribute.getFormTextShdwColor()); + const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); const ::std::vector< double > aNewDXArray( @@ -623,7 +623,7 @@ namespace { if(rOutlineAttribute.getTransparence()) { - // create UnifiedAlphaPrimitive2D + // create UnifiedTransparencePrimitive2D drawinglayer::primitive2d::Primitive2DSequence aStrokePrimitiveSequence(nStrokeCount); for(sal_uInt32 b(0L); b < nStrokeCount; b++) @@ -631,8 +631,8 @@ namespace aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]); } - drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 = - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + drawinglayer::primitive2d::UnifiedTransparencePrimitive2D* pNew2 = + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aStrokePrimitiveSequence, (double)rOutlineAttribute.getTransparence() / 100.0); aNewPrimitives.push_back(pNew2); @@ -712,7 +712,9 @@ void SdrTextObj::impDecomposePathTextPrimitive( std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition; std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition; impPolygonParagraphHandler aPolygonParagraphHandler( - rFormTextAttribute, aRegularDecomposition, aShadowDecomposition); + rFormTextAttribute, + aRegularDecomposition, + aShadowDecomposition); sal_uInt32 a; for(a = 0L; a < nLoopCount; a++) @@ -751,10 +753,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add shadow outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getShadowOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getShadowOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aShadowDecomposition, *rFormTextAttribute.getShadowOutline())); + impAddPathTextOutlines( + aShadowDecomposition, + rFormTextAttribute.getShadowOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalA, aOutlines); } } @@ -770,10 +776,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aRegularDecomposition, *rFormTextAttribute.getOutline())); + impAddPathTextOutlines( + aRegularDecomposition, + rFormTextAttribute.getOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalB, aOutlines); } } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index e9eeb1428ba8..6dd816d429da 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -66,6 +66,7 @@ #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/displayinfo.hxx> #include <algorithm> +#include <svl/smplhint.hxx> using namespace ::com::sun::star; @@ -1165,7 +1166,8 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const { if(!mpViewContact) { - ((SdrPage*)this)->mpViewContact = ((SdrPage*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrPage* >(this)->mpViewContact = + const_cast< SdrPage* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; @@ -1173,6 +1175,140 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const //////////////////////////////////////////////////////////////////////////////////////////////////// +void SdrPageProperties::ImpRemoveStyleSheet() +{ + if(mpStyleSheet) + { + EndListening(*mpStyleSheet); + mpProperties->SetParent(0); + mpStyleSheet = 0; + } +} + +void SdrPageProperties::ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet) +{ + if(mpStyleSheet != &rNewStyleSheet) + { + ImpRemoveStyleSheet(); + mpStyleSheet = &rNewStyleSheet; + StartListening(rNewStyleSheet); + mpProperties->SetParent(&rNewStyleSheet.GetItemSet()); + } +} + +void ImpPageChange(SdrPage& rSdrPage) +{ + rSdrPage.ActionChanged(); + + if(rSdrPage.GetModel()) + { + rSdrPage.GetModel()->SetChanged(true); + SdrHint aHint(HINT_PAGEORDERCHG); + aHint.SetPage(&rSdrPage); + rSdrPage.GetModel()->Broadcast(aHint); + } +} + +SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) +: SfxListener(), + mpSdrPage(&rSdrPage), + mpStyleSheet(0), + mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST)) +{ + if(!rSdrPage.IsMasterPage()) + { + mpProperties->Put(XFillStyleItem(XFILL_NONE)); + } +} + +SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) +: SfxListener(), + mpSdrPage(rCandidate.mpSdrPage), + mpStyleSheet(0), + mpProperties(new SfxItemSet(*rCandidate.mpProperties)) +{ + if(rCandidate.GetStyleSheet()) + { + ImpAddStyleSheet(*rCandidate.GetStyleSheet()); + } +} + +SdrPageProperties::~SdrPageProperties() +{ + ImpRemoveStyleSheet(); + delete mpProperties; +} + +void SdrPageProperties::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) +{ + const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint); + + if(pSimpleHint) + { + switch(pSimpleHint->GetId()) + { + case SFX_HINT_DATACHANGED : + { + // notify change, broadcast + ImpPageChange(*mpSdrPage); + break; + } + case SFX_HINT_DYING : + { + // Style needs to be forgotten + ImpRemoveStyleSheet(); + break; + } + } + } +} + +const SfxItemSet& SdrPageProperties::GetItemSet() const +{ + return *mpProperties; +} + +void SdrPageProperties::PutItemSet(const SfxItemSet& rSet) +{ + OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)"); + mpProperties->Put(rSet); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::PutItem(const SfxPoolItem& rItem) +{ + OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)"); + mpProperties->Put(rItem); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::ClearItem(const sal_uInt16 nWhich) +{ + mpProperties->ClearItem(nWhich); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet) +{ + if(pStyleSheet) + { + ImpAddStyleSheet(*pStyleSheet); + } + else + { + ImpRemoveStyleSheet(); + } + + ImpPageChange(*mpSdrPage); +} + +SfxStyleSheet* SdrPageProperties::GetStyleSheet() const +{ + return mpStyleSheet; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + TYPEINIT1(SdrPage,SdrObjList); DBG_NAME(SdrPage) SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) @@ -1185,7 +1321,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) nBordRgt(0L), nBordLwr(0L), pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())), - pBackgroundObj(0L), + mpSdrPageProperties(0), mpMasterPageDescriptor(0L), nPageNum(0L), mbMaster(bMasterPage), @@ -1197,6 +1333,8 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) DBG_CTOR(SdrPage,NULL); aPrefVisiLayers.SetAll(); eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; + + mpSdrPageProperties = new SdrPageProperties(*this); } SdrPage::SdrPage(const SdrPage& rSrcPage) @@ -1210,7 +1348,7 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) nBordRgt(rSrcPage.nBordRgt), nBordLwr(rSrcPage.nBordLwr), pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())), - pBackgroundObj(0L), + mpSdrPageProperties(0), mpMasterPageDescriptor(0L), nPageNum(rSrcPage.nPageNum), mbMaster(rSrcPage.mbMaster), @@ -1244,6 +1382,8 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) mxUnoPage = NULL; xComponent->dispose(); } + + mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } SdrPage::~SdrPage() @@ -1277,7 +1417,6 @@ SdrPage::~SdrPage() // when they get called from PageInDestruction(). maPageUsers.clear(); - SdrObject::Free( pBackgroundObj ); delete pLayerAdmin; TRG_ClearMasterPage(); @@ -1289,6 +1428,11 @@ SdrPage::~SdrPage() mpViewContact = 0L; } + { + delete mpSdrPageProperties; + mpSdrPageProperties = 0; + } + DBG_DTOR(SdrPage,NULL); } @@ -1300,8 +1444,6 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mpViewContact = 0L; } - SdrObject::Free( pBackgroundObj ); - // Joe also sets some parameters for the class this one // is derived from. SdrObjList does the same bad handling of // copy constructor and operator=, so i better let it stand here. @@ -1335,14 +1477,9 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; - if(rSrcPage.pBackgroundObj) { - pBackgroundObj = rSrcPage.pBackgroundObj->Clone(); - pBackgroundObj->SetPage( this ); - pBackgroundObj->SetModel( pModel ); - - // #i62000# for single-page MPBGO, force no line - pBackgroundObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); + delete mpSdrPageProperties; + mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } // Now copy the contained obejcts (by cloning them) @@ -1522,8 +1659,9 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); - if( pBackgroundObj ) - pBackgroundObj->SetModel( pNewModel ); + SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + delete mpSdrPageProperties; + mpSdrPageProperties = pNew; } // update listeners at possible api wrapper object @@ -1657,22 +1795,6 @@ XubString SdrPage::GetLayoutName() const return String(); } -void SdrPage::SetBackgroundObj( SdrObject* pObj ) -{ - if ( pObj ) - { - pObj->SetPage( this ); - pObj->SetModel( pModel ); - pObj->SetLayer( 1 ); // Nothing known about the backgroundlayer... - - // #i62000# for single-page MPBGO, force no line - pObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); - } - - SdrObject::Free( pBackgroundObj ); - pBackgroundObj = pObj; -} - void SdrPage::SetInserted( bool bIns ) { if( mbInserted != bIns ) @@ -1746,38 +1868,17 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) aColor = pView->GetApplicationDocumentColor(); } - // first, see if we have a background object - SdrObject* pBackgroundObj2 = NULL; - + const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet(); - if( IsMasterPage() ) - { - if( GetObjCount() ) - pBackgroundObj2 = GetObj( 0 ); - } - else + if(!IsMasterPage() && TRG_HasMasterPage()) { - pBackgroundObj2 = GetBackgroundObj(); - if( NULL == pBackgroundObj2 ) + if(XFILL_NONE == ((const XFillStyleItem&)pBackgroundFill->Get(XATTR_FILLSTYLE)).GetValue()) { - // if not, see if we have a masterpage and get that background object - if(TRG_HasMasterPage()) - { - SdrPage& rMasterPage = TRG_GetMasterPage(); - - if(rMasterPage.GetObjCount()) - { - pBackgroundObj2 = rMasterPage.GetObj( 0 ); - } - } + pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); } } - if( pBackgroundObj2 ) - { - const SfxItemSet& rSet = pBackgroundObj2->GetMergedItemSet(); - GetDraftFillColor( rSet, aColor ); - } + GetDraftFillColor(*pBackgroundFill, aColor); return aColor; } diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index fb47734b1091..998c687608fc 100644..100755 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -294,6 +294,9 @@ SdrPaintView::SdrPaintView(SdrModel* pModel1, OutputDevice* pOut) SdrPaintView::~SdrPaintView() { DBG_DTOR(SdrPaintView,NULL); + if (pDefaultStyleSheet) + EndListening(*pDefaultStyleSheet); + maColorConfig.RemoveListener(this); ClearPageView(); @@ -317,8 +320,16 @@ SdrPaintView::~SdrPaintView() //////////////////////////////////////////////////////////////////////////////////////////////////// -void __EXPORT SdrPaintView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) +void __EXPORT SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { + //If the stylesheet has been destroyed + if (&rBC == pDefaultStyleSheet) + { + if (rHint.ISA(SfxSimpleHint) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING) + pDefaultStyleSheet = NULL; + return; + } + BOOL bObjChg=!bSomeObjChgdFlag; // TRUE= auswerten fuer ComeBack-Timer if (bObjChg) { SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); @@ -333,7 +344,7 @@ void __EXPORT SdrPaintView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint if (eKind==HINT_PAGEORDERCHG) { const SdrPage* pPg=pSdrHint->GetPage(); - if(!pPg->IsInserted()) + if(pPg && !pPg->IsInserted()) { if(mpPageView && mpPageView->GetPage() == pPg) { @@ -1238,7 +1249,12 @@ void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, BOOL bReplaceAll) void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, BOOL bDontRemoveHardAttr) { + if (pDefaultStyleSheet) + EndListening(*pDefaultStyleSheet); pDefaultStyleSheet=pStyleSheet; + if (pDefaultStyleSheet) + StartListening(*pDefaultStyleSheet); + if (pStyleSheet!=NULL && !bDontRemoveHardAttr) { SfxWhichIter aIter(pStyleSheet->GetItemSet()); USHORT nWhich=aIter.FirstWhich(); diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 02fdf1c1c888..33833f8b81b1 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -47,7 +47,7 @@ #include <svx/svdpagv.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <svx/sdr/overlay/overlayhatchrect.hxx> -#include <drawinglayer/primitive2d/hittestprimitive2d.hxx> +#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx> namespace sdr { namespace table { @@ -242,10 +242,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in HitTest primitive to support HitTest of this overlay object + // embed in HiddenGeometryPrimitive2D to support HitTest of this invisible + // overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::HitTestPrimitive2D(aSequence)); + new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(aSequence)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 05ac0b9aeb75..63d1066e7149 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -34,19 +34,20 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> -#include <drawinglayer/attribute/sdrattribute.hxx> #include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <drawinglayer/attribute/fillattribute.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <svx/sdr/attribute/sdrtextattribute.hxx> -#include <svx/sdr/attribute/sdrallattribute.hxx> #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> #include <editeng/borderline.hxx> #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> +#include <svx/sdr/attribute/sdrfilltextattribute.hxx> +#include <drawinglayer/attribute/sdrlineattribute.hxx> +#include <drawinglayer/attribute/sdrshadowattribute.hxx> +#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "cell.hxx" #include "tablelayouter.hxx" @@ -94,34 +95,42 @@ namespace drawinglayer Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { + // prepare unit polygon Primitive2DSequence aRetval; + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - if(getSdrFTAttribute().getFill() || getSdrFTAttribute().getText()) + // add fill + if(!getSdrFTAttribute().getFill().isDefault()) { - // prepare unit polygon - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createPolygonFromRect(aUnitRange)); - - // add fill - if(getSdrFTAttribute().getFill()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( aUnitPolyPolygon, getTransform(), - *getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFill(), getSdrFTAttribute().getFillFloatTransGradient())); - } + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); + } - // add text - if(getSdrFTAttribute().getText()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( + // add text + if(!getSdrFTAttribute().getText().isDefault()) + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( aUnitPolyPolygon, getTransform(), - *getSdrFTAttribute().getText(), - 0, - true, false, false)); - } + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } return aRetval; @@ -536,14 +545,13 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfTableObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const sdr::table::SdrTableObj& rTableObj = GetTableObj(); const uno::Reference< com::sun::star::table::XTable > xTable = rTableObj.getTable(); - const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); if(xTable.is()) { // create primitive representation for table + drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_Int32 nRowCount(xTable->getRowCount()); const sal_Int32 nColCount(xTable->getColumnCount()); const sal_Int32 nAllCount(nRowCount * nColCount); @@ -596,7 +604,7 @@ namespace sdr const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet(); const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol); const SdrText* pSdrText = rTableObj.getText(nTextIndex); - drawinglayer::attribute::SdrFillTextAttribute* pAttribute = 0; + drawinglayer::attribute::SdrFillTextAttribute aAttribute; if(pSdrText) { @@ -606,7 +614,7 @@ namespace sdr const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance()); const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance()); - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText, &nLeft, @@ -616,21 +624,17 @@ namespace sdr } else { - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText); } - if(pAttribute) + // always create cell primitives for BoundRect and HitTest { - if(pAttribute->isVisible()) - { - const drawinglayer::primitive2d::Primitive2DReference xCellReference(new drawinglayer::primitive2d::SdrCellPrimitive2D( - aCellMatrix, *pAttribute)); - xCellSequence[nCellInsert++] = xCellReference; - } - - delete pAttribute; + const drawinglayer::primitive2d::Primitive2DReference xCellReference( + new drawinglayer::primitive2d::SdrCellPrimitive2D( + aCellMatrix, aAttribute)); + xCellSequence[nCellInsert++] = xCellReference; } // handle cell borders @@ -675,21 +679,46 @@ namespace sdr xRetval = xCellSequence; drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xBorderSequence); } - } - - if(xRetval.hasElements()) - { - // check and create evtl. shadow for created content - drawinglayer::attribute::SdrShadowAttribute* pNewShadowAttribute = drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet); - if(pNewShadowAttribute) + if(xRetval.hasElements()) { - xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, *pNewShadowAttribute); - delete pNewShadowAttribute; + // check and create evtl. shadow for created content + const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); + const drawinglayer::attribute::SdrShadowAttribute aNewShadowAttribute( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet)); + + if(!aNewShadowAttribute.isDefault()) + { + xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, aNewShadowAttribute); + } } - } - return xRetval; + return xRetval; + } + else + { + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rTableObj.GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(rTableObj.GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // credate an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aObjectMatrix)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } ViewContactOfTableObj::ViewContactOfTableObj(::sdr::table::SdrTableObj& rTableObj) diff --git a/svx/source/tbxctrls/tbxcolor.cxx b/svx/source/tbxctrls/tbxcolor.cxx index 072d56e0f772..57d791f1babd 100644 --- a/svx/source/tbxctrls/tbxcolor.cxx +++ b/svx/source/tbxctrls/tbxcolor.cxx @@ -62,7 +62,7 @@ namespace svx { try { - Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY ); if ( xFrameProps.is() ) xFrameProps->getPropertyValue( PROPNAME_LAYOUTMANAGER ) >>= m_xLayouter; diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 6417be63f45c..b80be1076b7e 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -615,32 +615,17 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, VirtualDevice aVDev; const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY ); - // create a view - SdrView* pView; - - if( PTR_CAST( FmFormModel, mpDoc ) ) - { - pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); - } - else - { - pView = new SdrView( mpDoc, &aVDev ); - } - - pView->SetBordVisible( FALSE ); - pView->SetPageVisible( FALSE ); - pView->ShowSdrPage( pPage ); - SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL); maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl(); rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) ); - rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) ); + rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() ); // #i102251# const sal_uInt32 nOldCntrl(rOutl.GetControlWord()); sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING; rOutl.SetControlWord(nCntrl); + SdrObject* pTempBackgroundShape = 0; std::vector< SdrObject* > aShapes; bool bRet = true; @@ -649,19 +634,10 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { if( rSettings.mbExportOnlyBackground ) { - SdrObject* pShape = 0; - if( pPage->IsMasterPage() ) - { - if( pPage->GetObjCount() > 0 ) - pShape = pPage->GetObj(0); - } - else - { - pShape = pPage->GetBackgroundObj(); - } - - if( pShape ) - aShapes.push_back( pShape ); + pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); + pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet()); + pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); + aShapes.push_back(pTempBackgroundShape); } else { @@ -738,8 +714,24 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); aVDev.EnableOutput( FALSE ); aMtf.Record( &aVDev ); - Size aNewSize; + + // create a view + SdrView* pView; + + if( PTR_CAST( FmFormModel, mpDoc ) ) + { + pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); + } + else + { + pView = new SdrView( mpDoc, &aVDev ); + } + + pView->SetBordVisible( FALSE ); + pView->SetPageVisible( FALSE ); + pView->ShowSdrPage( pPage ); + if ( pView && pPage ) { pView->SetBordVisible( FALSE ); @@ -780,6 +772,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aGraphic = Graphic(aMtf); } + if ( pView ) + { + pView->HideSdrPage(); + delete pView; + } + if( rSettings.mbTranslucent ) { Size aOutSize; @@ -904,15 +902,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, // calculate bound rect for all shapes Rectangle aBound; - if(rSettings.mbExportOnlyBackground) - { - // shape is MPBGO and if it's not yet set, it's size will - // be empty when using GetCurrentBoundRect(). Since anyways - // the page size is used by MPBGO and MPBGO is EOLd, get - // the wanted size from the page model directly - aBound = Rectangle(Point(0,0), pPage->GetSize()); - } - else { std::vector< SdrObject* >::iterator aIter = aShapes.begin(); const std::vector< SdrObject* >::iterator aEnd = aShapes.end(); @@ -986,10 +975,9 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, } } - if ( pView ) + if(pTempBackgroundShape) { - pView->HideSdrPage(); - delete pView; + SdrObject::Free(pTempBackgroundShape); } rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl ); diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx index e39b3a82b017..55a80ec40d89 100644 --- a/svx/source/xml/xmlexport.cxx +++ b/svx/source/xml/xmlexport.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <com/sun/star/xml/sax/InputSource.hpp> #include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -52,12 +53,12 @@ using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStream> xOut, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerExport( pModel, xOut, xComponent, "com.sun.star.comp.DrawingLayer.XMLExporter" ); } -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStream> xOut, Reference< lang::XComponent > xComponent, const char* pExportService ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut, const Reference< lang::XComponent >& xComponent, const char* pExportService ) { sal_Bool bDocRet = xOut.is(); @@ -67,12 +68,13 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre Reference< document::XEmbeddedObjectResolver > xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; + Reference< lang::XComponent > xSourceDoc( xComponent ); try { - if( !xComponent.is() ) + if( !xSourceDoc.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xSourceDoc = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xSourceDoc ) ); } uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); @@ -127,7 +129,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY ); if( xExporter.is() ) { - xExporter->setSourceDocument( xComponent ); + xExporter->setSourceDocument( xSourceDoc ); uno::Sequence< beans::PropertyValue > aDescriptor( 0 ); bDocRet = xFilter->filter( aDescriptor ); @@ -138,11 +140,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre } catch(uno::Exception e) { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "uno Exception caught while exporting:\n" ); - aError += ByteString( String( e.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#endif + DBG_UNHANDLED_EXCEPTION(); bDocRet = sal_False; } @@ -157,7 +155,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre return bDocRet; } -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStream> xOut ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerExport( pModel, xOut, xComponent ); @@ -165,12 +163,12 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference<io::XOutputStre //-//////////////////////////////////////////////////////////////////// -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStream> xInputStream, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Draw.XMLOasisImporter" ); } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStream> xInputStream, Reference< lang::XComponent > xComponent, const char* pImportService ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream, const Reference< lang::XComponent >& xComponent, const char* pImportService ) { sal_uInt32 nRet = 0; @@ -180,13 +178,14 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea Reference< document::XEmbeddedObjectResolver > xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; - if( !xComponent.is() ) + Reference< lang::XComponent > xTargetDocument( xComponent ); + if( !xTargetDocument.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xTargetDocument = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xTargetDocument ) ); } - Reference< frame::XModel > xModel( xComponent, UNO_QUERY ); + Reference< frame::XModel > xTargetModel( xTargetDocument, UNO_QUERY ); try { @@ -199,7 +198,8 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea if( 0 == nRet ) { - xModel->lockControllers(); + if ( xTargetModel.is() ) + xTargetModel->lockControllers(); // ------------------------------------- @@ -248,7 +248,7 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea // connect model and filter uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY ); - xImporter->setTargetDocument( xComponent ); + xImporter->setTargetDocument( xTargetDocument ); // finally, parser the stream xParser->parseStream( aParserInput ); @@ -257,45 +257,9 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea } } } - catch( xml::sax::SAXParseException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "SAX parse exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( xml::sax::SAXException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "SAX exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( io::IOException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "IO exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } catch( uno::Exception& r ) { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "uno exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif + DBG_UNHANDLED_EXCEPTION(); } if( pGraphicHelper ) @@ -306,13 +270,13 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStrea SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper ); xObjectResolver = 0; - if( xModel.is() ) - xModel->unlockControllers(); + if ( xTargetModel.is() ) + xTargetModel->unlockControllers(); return nRet == 0; } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference<io::XInputStream> xInputStream ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerImport( pModel, xInputStream, xComponent ); diff --git a/svx/xml/AccessibleEditableTextPara.xml b/svx/xml/AccessibleEditableTextPara.xml index 1859980760df..affb15f4dd55 100644 --- a/svx/xml/AccessibleEditableTextPara.xml +++ b/svx/xml/AccessibleEditableTextPara.xml @@ -28,6 +28,7 @@ title="Link to a general description of UNO accessibility"/> <type>com.sun.star.accessibility.XAccessibleEventBroadcaster</type> <type>com.sun.star.accessibility.XAccessibleComponent</type> <type>com.sun.star.accessibility.XAccessibleEditableText</type> +<type>com.sun.star.accessibility.XAccessibleHyperext</type> <type>com.sun.star.accessibility.XAccessibleTextAttributes</type> <type>com.sun.star.lang.XTypeProvider</type> <type>com.sun.star.lang.XServiceInfo</type> diff --git a/sysui/desktop/freedesktop/freedesktop-menus.spec b/sysui/desktop/freedesktop/freedesktop-menus.spec index 14a7c7795b24..501f8432d940 100644 --- a/sysui/desktop/freedesktop/freedesktop-menus.spec +++ b/sysui/desktop/freedesktop/freedesktop-menus.spec @@ -325,6 +325,7 @@ done /usr/share/applications/%unixfilename-printeradmin.desktop /usr/share/applications/%unixfilename-writer.desktop /usr/share/applications/%unixfilename-startcenter.desktop +/usr/share/applications/%unixfilename-javafilter.desktop /usr/share/icons/gnome/*/apps/*png /usr/share/icons/gnome/*/mimetypes/*png /usr/share/icons/hicolor/*/apps/*png diff --git a/sysui/desktop/icons/database.icns b/sysui/desktop/icons/database.icns Binary files differnew file mode 100644 index 000000000000..115dc859cdcd --- /dev/null +++ b/sysui/desktop/icons/database.icns diff --git a/sysui/desktop/icons/database.ico b/sysui/desktop/icons/database.ico Binary files differnew file mode 100644 index 000000000000..171d39bb9643 --- /dev/null +++ b/sysui/desktop/icons/database.ico diff --git a/sysui/desktop/icons/drawing-template.icns b/sysui/desktop/icons/drawing-template.icns Binary files differindex 359164f314ac..407484582f93 100644 --- a/sysui/desktop/icons/drawing-template.icns +++ b/sysui/desktop/icons/drawing-template.icns diff --git a/sysui/desktop/icons/drawing-template.ico b/sysui/desktop/icons/drawing-template.ico Binary files differnew file mode 100644 index 000000000000..5b5a74e99f41 --- /dev/null +++ b/sysui/desktop/icons/drawing-template.ico diff --git a/sysui/desktop/icons/drawing.icns b/sysui/desktop/icons/drawing.icns Binary files differindex 81777c7f92b6..5322625b0507 100644 --- a/sysui/desktop/icons/drawing.icns +++ b/sysui/desktop/icons/drawing.icns diff --git a/sysui/desktop/icons/drawing.ico b/sysui/desktop/icons/drawing.ico Binary files differnew file mode 100644 index 000000000000..1065490a2807 --- /dev/null +++ b/sysui/desktop/icons/drawing.ico diff --git a/sysui/desktop/icons/empty-document.icns b/sysui/desktop/icons/empty-document.icns Binary files differindex 18d1133eb66b..ab676f6ef8f1 100644 --- a/sysui/desktop/icons/empty-document.icns +++ b/sysui/desktop/icons/empty-document.icns diff --git a/sysui/desktop/icons/empty-document.ico b/sysui/desktop/icons/empty-document.ico Binary files differnew file mode 100644 index 000000000000..4115c3089682 --- /dev/null +++ b/sysui/desktop/icons/empty-document.ico diff --git a/sysui/desktop/icons/empty-template.icns b/sysui/desktop/icons/empty-template.icns Binary files differindex 034d30bccb32..50e63b94256d 100644 --- a/sysui/desktop/icons/empty-template.icns +++ b/sysui/desktop/icons/empty-template.icns diff --git a/sysui/desktop/icons/empty-template.ico b/sysui/desktop/icons/empty-template.ico Binary files differnew file mode 100644 index 000000000000..dec147610af4 --- /dev/null +++ b/sysui/desktop/icons/empty-template.ico diff --git a/sysui/desktop/icons/formula.icns b/sysui/desktop/icons/formula.icns Binary files differindex 61cd00a0e001..4620688c79c6 100644 --- a/sysui/desktop/icons/formula.icns +++ b/sysui/desktop/icons/formula.icns diff --git a/sysui/desktop/icons/formula.ico b/sysui/desktop/icons/formula.ico Binary files differnew file mode 100644 index 000000000000..e06aef187734 --- /dev/null +++ b/sysui/desktop/icons/formula.ico diff --git a/sysui/desktop/icons/hicolor/128x128/apps/base.png b/sysui/desktop/icons/hicolor/128x128/apps/base.png Binary files differindex 42b027626c3a..398c2f058d92 100755 --- a/sysui/desktop/icons/hicolor/128x128/apps/base.png +++ b/sysui/desktop/icons/hicolor/128x128/apps/base.png diff --git a/sysui/desktop/icons/hicolor/128x128/apps/calc.png b/sysui/desktop/icons/hicolor/128x128/apps/calc.png Binary files differindex 368fb03e2d9c..8156308833f7 100644 --- a/sysui/desktop/icons/hicolor/128x128/apps/calc.png +++ b/sysui/desktop/icons/hicolor/128x128/apps/calc.png diff --git a/sysui/desktop/icons/hicolor/128x128/apps/draw.png b/sysui/desktop/icons/hicolor/128x128/apps/draw.png Binary files differindex 72b67c831218..3f71b25fe107 100755 --- a/sysui/desktop/icons/hicolor/128x128/apps/draw.png +++ b/sysui/desktop/icons/hicolor/128x128/apps/draw.png diff --git a/sysui/desktop/icons/hicolor/128x128/apps/impress.png b/sysui/desktop/icons/hicolor/128x128/apps/impress.png Binary files differindex 32ad785e16ce..b62b449e574f 100755 --- a/sysui/desktop/icons/hicolor/128x128/apps/impress.png +++ b/sysui/desktop/icons/hicolor/128x128/apps/impress.png diff --git a/sysui/desktop/icons/hicolor/128x128/apps/main.png b/sysui/desktop/icons/hicolor/128x128/apps/main.png Binary files differindex fd68a10960a6..1b51a60bddea 100755 --- a/sysui/desktop/icons/hicolor/128x128/apps/main.png +++ b/sysui/desktop/icons/hicolor/128x128/apps/main.png diff --git a/sysui/desktop/icons/hicolor/128x128/apps/math.png b/sysui/desktop/icons/hicolor/128x128/apps/math.png Binary files differindex 79e71ce22321..d37c98aa405e 100755 --- a/sysui/desktop/icons/hicolor/128x128/apps/math.png +++ b/sysui/desktop/icons/hicolor/128x128/apps/math.png diff --git a/sysui/desktop/icons/hicolor/128x128/apps/writer.png b/sysui/desktop/icons/hicolor/128x128/apps/writer.png Binary files differindex 0d057fa4baff..b991a6d2e233 100755 --- a/sysui/desktop/icons/hicolor/128x128/apps/writer.png +++ b/sysui/desktop/icons/hicolor/128x128/apps/writer.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/database.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/database.png Binary files differnew file mode 100644 index 000000000000..93b8e60cb276 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/database.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing-template.png Binary files differnew file mode 100644 index 000000000000..15b80e039313 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing.png Binary files differnew file mode 100644 index 000000000000..9d47f747dffa --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/formula.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/formula.png Binary files differnew file mode 100644 index 000000000000..184dd0ca6ca8 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/formula.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/master-document.png Binary files differnew file mode 100644 index 000000000000..acf19ff835f2 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/master-document.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png Binary files differindex 1429d82ce829..f95bbf137a5b 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png Binary files differindex 4fdde3c34c3f..630a51ebb430 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png Binary files differindex 7272482a04b3..82ac8d15bfc3 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png Binary files differindex 9e4c72eab7af..c838eaa12851 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png Binary files differindex 6f191e2cf0d4..640e2d98614c 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png Binary files differindex bf8229c1f55c..c4954802e82c 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png Binary files differindex 2b3a5bb90065..1d5acededb94 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png Binary files differindex 18c00ad4bb82..01781db415fa 100644 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png Binary files differindex ca480522d847..bc46714afa92 100644 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png Binary files differindex ef5b5dd7a5f4..569bd514fcb7 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png Binary files differindex 178d4e26d967..b45244ac1a4b 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png Binary files differindex 7edd66d369d0..8e6c4580e9fd 100755 --- a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation-template.png Binary files differnew file mode 100644 index 000000000000..c8a3813188de --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation.png Binary files differnew file mode 100644 index 000000000000..2a0552eb62b4 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet-template.png Binary files differnew file mode 100644 index 000000000000..cc7aa51bcb3c --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet.png Binary files differnew file mode 100644 index 000000000000..c701fd7b5d46 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/text-template.png Binary files differnew file mode 100644 index 000000000000..652c1ce480c9 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/text-template.png diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/text.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/text.png Binary files differnew file mode 100644 index 000000000000..f881aca21839 --- /dev/null +++ b/sysui/desktop/icons/hicolor/128x128/mimetypes/text.png diff --git a/sysui/desktop/icons/hicolor/16x16/apps/base.png b/sysui/desktop/icons/hicolor/16x16/apps/base.png Binary files differindex 3a08ee118221..57a4477cc662 100644 --- a/sysui/desktop/icons/hicolor/16x16/apps/base.png +++ b/sysui/desktop/icons/hicolor/16x16/apps/base.png diff --git a/sysui/desktop/icons/hicolor/16x16/apps/calc.png b/sysui/desktop/icons/hicolor/16x16/apps/calc.png Binary files differindex 2dc540711b3c..78f923d0edf7 100644 --- a/sysui/desktop/icons/hicolor/16x16/apps/calc.png +++ b/sysui/desktop/icons/hicolor/16x16/apps/calc.png diff --git a/sysui/desktop/icons/hicolor/16x16/apps/draw.png b/sysui/desktop/icons/hicolor/16x16/apps/draw.png Binary files differindex afc037060da2..7779dd46f374 100644 --- a/sysui/desktop/icons/hicolor/16x16/apps/draw.png +++ b/sysui/desktop/icons/hicolor/16x16/apps/draw.png diff --git a/sysui/desktop/icons/hicolor/16x16/apps/impress.png b/sysui/desktop/icons/hicolor/16x16/apps/impress.png Binary files differindex f1957da748a3..ff07597b1d5e 100644 --- a/sysui/desktop/icons/hicolor/16x16/apps/impress.png +++ b/sysui/desktop/icons/hicolor/16x16/apps/impress.png diff --git a/sysui/desktop/icons/hicolor/16x16/apps/main.png b/sysui/desktop/icons/hicolor/16x16/apps/main.png Binary files differnew file mode 100755 index 000000000000..3aa8f08a8c5d --- /dev/null +++ b/sysui/desktop/icons/hicolor/16x16/apps/main.png diff --git a/sysui/desktop/icons/hicolor/16x16/apps/math.png b/sysui/desktop/icons/hicolor/16x16/apps/math.png Binary files differindex de1488226a19..10c71e6caa2e 100644 --- a/sysui/desktop/icons/hicolor/16x16/apps/math.png +++ b/sysui/desktop/icons/hicolor/16x16/apps/math.png diff --git a/sysui/desktop/icons/hicolor/16x16/apps/writer.png b/sysui/desktop/icons/hicolor/16x16/apps/writer.png Binary files differindex 8304269862ac..2b82110e180b 100644 --- a/sysui/desktop/icons/hicolor/16x16/apps/writer.png +++ b/sysui/desktop/icons/hicolor/16x16/apps/writer.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png Binary files differindex bbf485561e19..fb32e00a1ba6 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png Binary files differindex 74770d5d482f..f045190f395a 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png Binary files differindex 30303797baf7..3bd7b7d29cb1 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png Binary files differindex 3eb7f884f91d..e7e95875efed 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png Binary files differindex c424e4fbf430..e442a0c0985d 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png Binary files differindex 2f2d56dd0daa..e4ae28570f08 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png Binary files differindex 94f4ac9ec58e..eaad54fcdf7e 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png Binary files differindex d65439afbc6c..3d66cc97eb5e 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png Binary files differindex 9c628ce789f9..4cefbb690d10 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png Binary files differindex 137778d11fa2..12aab4a27c32 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png Binary files differindex 3153d8e3c705..9f281836d793 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png Binary files differindex c642127abc1e..46942cba2852 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png Binary files differindex 689bb5aef425..4781bfc3a6fc 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png Binary files differindex f51a29a85492..abc38d4310c9 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png Binary files differindex 1c20ed072ba8..9836814c6c2c 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png Binary files differindex 8b095bfcbafb..06c1f30c8fa2 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png Binary files differindex 795d92615e4f..01c04a0ea697 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png Binary files differindex bb20d139e1a5..df1d5293a83d 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png Binary files differindex b82ddf720912..6803ae4c7492 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png Binary files differindex 3546349b59a3..5be785e40f64 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png Binary files differindex df164ff2caae..46c72242a02a 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png Binary files differindex 4d895288251e..2827f29f3a4e 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png Binary files differindex 6ff2517af44d..c0d1cd3dcc7a 100644 --- a/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png +++ b/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png diff --git a/sysui/desktop/icons/hicolor/32x32/apps/base.png b/sysui/desktop/icons/hicolor/32x32/apps/base.png Binary files differindex f30fe4a53c54..f4772d75dac3 100644 --- a/sysui/desktop/icons/hicolor/32x32/apps/base.png +++ b/sysui/desktop/icons/hicolor/32x32/apps/base.png diff --git a/sysui/desktop/icons/hicolor/32x32/apps/calc.png b/sysui/desktop/icons/hicolor/32x32/apps/calc.png Binary files differindex 4e7e423d713e..a1eae7b37a17 100644 --- a/sysui/desktop/icons/hicolor/32x32/apps/calc.png +++ b/sysui/desktop/icons/hicolor/32x32/apps/calc.png diff --git a/sysui/desktop/icons/hicolor/32x32/apps/draw.png b/sysui/desktop/icons/hicolor/32x32/apps/draw.png Binary files differindex f34faf5b51fa..4dc928a35168 100644 --- a/sysui/desktop/icons/hicolor/32x32/apps/draw.png +++ b/sysui/desktop/icons/hicolor/32x32/apps/draw.png diff --git a/sysui/desktop/icons/hicolor/32x32/apps/impress.png b/sysui/desktop/icons/hicolor/32x32/apps/impress.png Binary files differindex 7b8ec6432fc7..9abced7df4ba 100644 --- a/sysui/desktop/icons/hicolor/32x32/apps/impress.png +++ b/sysui/desktop/icons/hicolor/32x32/apps/impress.png diff --git a/sysui/desktop/icons/hicolor/32x32/apps/main.png b/sysui/desktop/icons/hicolor/32x32/apps/main.png Binary files differnew file mode 100755 index 000000000000..296c6f4c58b1 --- /dev/null +++ b/sysui/desktop/icons/hicolor/32x32/apps/main.png diff --git a/sysui/desktop/icons/hicolor/32x32/apps/math.png b/sysui/desktop/icons/hicolor/32x32/apps/math.png Binary files differindex 6c3c3b68f05d..146a7dea71b6 100644 --- a/sysui/desktop/icons/hicolor/32x32/apps/math.png +++ b/sysui/desktop/icons/hicolor/32x32/apps/math.png diff --git a/sysui/desktop/icons/hicolor/32x32/apps/writer.png b/sysui/desktop/icons/hicolor/32x32/apps/writer.png Binary files differindex 8a5943255821..97b9d3f5cfb3 100644 --- a/sysui/desktop/icons/hicolor/32x32/apps/writer.png +++ b/sysui/desktop/icons/hicolor/32x32/apps/writer.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png Binary files differindex 709903d46c21..6e0a4b8f60ba 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png Binary files differindex 76e5abdab9f0..a341632dabb7 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png Binary files differindex 380c60a7df2c..4abe5c0f80af 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png Binary files differindex 37306ac617ec..d989593924c2 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png Binary files differindex 1f3e79927608..d4b033f4aab8 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png Binary files differindex ddfcd7d19588..461bdf37b774 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png Binary files differindex e742adc40258..cdc2f2df0fc8 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png Binary files differindex 8d78d91c1866..55dda2143e57 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png Binary files differindex 302c7ab633f4..6b8f2f732201 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png Binary files differindex fc032402b756..234bac461e74 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png Binary files differindex 03c96f8dd867..012516065215 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png Binary files differindex 465583b9b06b..fedeb0620a75 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png Binary files differindex 383906a70a2e..9d63063e67d0 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png Binary files differindex 67da85c10bf1..020d95bef310 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png Binary files differindex feb935cc1df4..983b39e611ae 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png Binary files differindex 571e6a0e4a48..ac350cb409d1 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png Binary files differindex e3bd788ea1dc..8e906f8be1df 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png Binary files differindex 0edabbc86f16..5163f441039a 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png Binary files differindex 0eee1162ce15..730f86f0ba63 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png Binary files differindex 158a63a58c92..d81cd27dd93f 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png Binary files differindex f7352ab51783..dc9bd083c218 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png Binary files differindex cfba26102380..7c738c21eb59 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png Binary files differindex 77f87e777b7a..1454b20fd5db 100644 --- a/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png +++ b/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png diff --git a/sysui/desktop/icons/hicolor/48x48/apps/base.png b/sysui/desktop/icons/hicolor/48x48/apps/base.png Binary files differindex d68e712812d1..382ad3e6ec54 100644 --- a/sysui/desktop/icons/hicolor/48x48/apps/base.png +++ b/sysui/desktop/icons/hicolor/48x48/apps/base.png diff --git a/sysui/desktop/icons/hicolor/48x48/apps/calc.png b/sysui/desktop/icons/hicolor/48x48/apps/calc.png Binary files differindex 33690ba3c21c..d94aae38fbdd 100644 --- a/sysui/desktop/icons/hicolor/48x48/apps/calc.png +++ b/sysui/desktop/icons/hicolor/48x48/apps/calc.png diff --git a/sysui/desktop/icons/hicolor/48x48/apps/draw.png b/sysui/desktop/icons/hicolor/48x48/apps/draw.png Binary files differindex 2acb57226dc0..1a2d252c7cbf 100644 --- a/sysui/desktop/icons/hicolor/48x48/apps/draw.png +++ b/sysui/desktop/icons/hicolor/48x48/apps/draw.png diff --git a/sysui/desktop/icons/hicolor/48x48/apps/impress.png b/sysui/desktop/icons/hicolor/48x48/apps/impress.png Binary files differindex a46324e006bb..35d3b25c5566 100644 --- a/sysui/desktop/icons/hicolor/48x48/apps/impress.png +++ b/sysui/desktop/icons/hicolor/48x48/apps/impress.png diff --git a/sysui/desktop/icons/hicolor/48x48/apps/main.png b/sysui/desktop/icons/hicolor/48x48/apps/main.png Binary files differnew file mode 100755 index 000000000000..86bcf599553f --- /dev/null +++ b/sysui/desktop/icons/hicolor/48x48/apps/main.png diff --git a/sysui/desktop/icons/hicolor/48x48/apps/math.png b/sysui/desktop/icons/hicolor/48x48/apps/math.png Binary files differindex 691ef832b1a0..3572d76b6bd9 100644 --- a/sysui/desktop/icons/hicolor/48x48/apps/math.png +++ b/sysui/desktop/icons/hicolor/48x48/apps/math.png diff --git a/sysui/desktop/icons/hicolor/48x48/apps/writer.png b/sysui/desktop/icons/hicolor/48x48/apps/writer.png Binary files differindex 9ae740237401..8041a209ddda 100644 --- a/sysui/desktop/icons/hicolor/48x48/apps/writer.png +++ b/sysui/desktop/icons/hicolor/48x48/apps/writer.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png Binary files differindex 224943b0e9ea..b385ed9db537 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png Binary files differindex 043dd5dfae71..b7da9bfa2c81 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png Binary files differindex 8857034ce262..85499fd2199f 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png Binary files differindex 45f6d919387c..bcc61b432b94 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png Binary files differindex 191a619f7cf3..7a7b86956537 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png Binary files differindex 2c2ffb86e6c5..77e684960ec2 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png Binary files differindex 655a938f826c..8cb4dd3fa7d0 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png Binary files differindex c1bbdc4de6bb..258b3b2fc1e2 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png Binary files differindex fbdede243a6f..f6508de45379 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png Binary files differindex d06b5ca8b11f..1923fc9b9ff4 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png Binary files differindex f77c9c6e9ad9..00d311317566 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png Binary files differindex 7336f3530367..635953e1c714 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png Binary files differindex 850250c71a45..7c4beda53d60 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png Binary files differindex 6f6328cece2c..4c407a0f5fc1 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png Binary files differindex ac0d373a0362..64b86940885a 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png Binary files differindex 8c2b714b292b..0c04210a0c9a 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png Binary files differindex a7cf8d0f7d14..0ff92ec7a267 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png Binary files differindex 2193c98931ae..d9651bf654af 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png Binary files differindex bd59fbbbaf82..e058d25f822e 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png Binary files differindex 34c60c2819d6..5d5e46e21bc0 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png Binary files differindex 6868f577ce1a..c352966320a1 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png Binary files differindex 52a28fb3af80..ad5129774837 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png Binary files differindex 7ead079cade2..2a1707006d82 100644 --- a/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png +++ b/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png diff --git a/sysui/desktop/icons/main.icns b/sysui/desktop/icons/main.icns Binary files differindex c7ee5d7552aa..8357c09c0c89 100644..100755 --- a/sysui/desktop/icons/main.icns +++ b/sysui/desktop/icons/main.icns diff --git a/sysui/desktop/icons/makefile.mk b/sysui/desktop/icons/makefile.mk index f98b235d1252..1af3f4367fee 100644 --- a/sysui/desktop/icons/makefile.mk +++ b/sysui/desktop/icons/makefile.mk @@ -37,6 +37,33 @@ TARGET=icons # --- Targets ------------------------------------------------------------- all: \ + $(MISC)$/oasis-database.ico \ + $(MISC)$/oasis-drawing-template.ico \ + $(MISC)$/oasis-drawing.ico \ + $(MISC)$/oasis-empty-template.ico \ + $(MISC)$/oasis-empty-document.ico \ + $(MISC)$/oasis-formula.ico \ + $(MISC)$/oasis-master-document.ico \ + $(MISC)$/oasis-presentation-template.ico \ + $(MISC)$/oasis-presentation.ico \ + $(MISC)$/oasis-spreadsheet-template.ico \ + $(MISC)$/oasis-spreadsheet.ico \ + $(MISC)$/oasis-text-template.ico \ + $(MISC)$/oasis-text.ico \ + $(MISC)$/oasis-web-template.ico \ + $(MISC)$/database.ico \ + $(MISC)$/drawing-template.ico \ + $(MISC)$/drawing.ico \ + $(MISC)$/empty-template.ico \ + $(MISC)$/empty-document.ico \ + $(MISC)$/formula.ico \ + $(MISC)$/master-document.ico \ + $(MISC)$/presentation-template.ico \ + $(MISC)$/presentation.ico \ + $(MISC)$/spreadsheet-template.ico \ + $(MISC)$/spreadsheet.ico \ + $(MISC)$/text-template.ico \ + $(MISC)$/text.ico \ $(MISC)$/ooo-base-app.ico \ $(MISC)$/ooo-base-doc.ico \ $(MISC)$/ooo-calc-app.ico \ diff --git a/sysui/desktop/icons/master-document.icns b/sysui/desktop/icons/master-document.icns Binary files differindex 2089b9a660ef..33fdae3d47b7 100644 --- a/sysui/desktop/icons/master-document.icns +++ b/sysui/desktop/icons/master-document.icns diff --git a/sysui/desktop/icons/master-document.ico b/sysui/desktop/icons/master-document.ico Binary files differnew file mode 100644 index 000000000000..2c581f59a2b2 --- /dev/null +++ b/sysui/desktop/icons/master-document.ico diff --git a/sysui/desktop/icons/oasis-database.icns b/sysui/desktop/icons/oasis-database.icns Binary files differindex f64c6d2570ae..4d70286b0d9f 100644 --- a/sysui/desktop/icons/oasis-database.icns +++ b/sysui/desktop/icons/oasis-database.icns diff --git a/sysui/desktop/icons/oasis-database.ico b/sysui/desktop/icons/oasis-database.ico Binary files differnew file mode 100644 index 000000000000..3157568c3252 --- /dev/null +++ b/sysui/desktop/icons/oasis-database.ico diff --git a/sysui/desktop/icons/oasis-drawing-template.icns b/sysui/desktop/icons/oasis-drawing-template.icns Binary files differindex bb357bae58a1..dcb55db8e98f 100644 --- a/sysui/desktop/icons/oasis-drawing-template.icns +++ b/sysui/desktop/icons/oasis-drawing-template.icns diff --git a/sysui/desktop/icons/oasis-drawing-template.ico b/sysui/desktop/icons/oasis-drawing-template.ico Binary files differnew file mode 100644 index 000000000000..f98a2d6f44cb --- /dev/null +++ b/sysui/desktop/icons/oasis-drawing-template.ico diff --git a/sysui/desktop/icons/oasis-drawing.icns b/sysui/desktop/icons/oasis-drawing.icns Binary files differindex 80adc9feaaf5..3802af5ef3b5 100644 --- a/sysui/desktop/icons/oasis-drawing.icns +++ b/sysui/desktop/icons/oasis-drawing.icns diff --git a/sysui/desktop/icons/oasis-drawing.ico b/sysui/desktop/icons/oasis-drawing.ico Binary files differnew file mode 100644 index 000000000000..b24f2dadbe86 --- /dev/null +++ b/sysui/desktop/icons/oasis-drawing.ico diff --git a/sysui/desktop/icons/oasis-empty-document.icns b/sysui/desktop/icons/oasis-empty-document.icns Binary files differnew file mode 100644 index 000000000000..c52970324b27 --- /dev/null +++ b/sysui/desktop/icons/oasis-empty-document.icns diff --git a/sysui/desktop/icons/oasis-empty-document.ico b/sysui/desktop/icons/oasis-empty-document.ico Binary files differnew file mode 100644 index 000000000000..a12b54c2a2bf --- /dev/null +++ b/sysui/desktop/icons/oasis-empty-document.ico diff --git a/sysui/desktop/icons/oasis-empty-template.icns b/sysui/desktop/icons/oasis-empty-template.icns Binary files differnew file mode 100644 index 000000000000..ee6d299991d7 --- /dev/null +++ b/sysui/desktop/icons/oasis-empty-template.icns diff --git a/sysui/desktop/icons/oasis-empty-template.ico b/sysui/desktop/icons/oasis-empty-template.ico Binary files differnew file mode 100644 index 000000000000..63ac9f348fda --- /dev/null +++ b/sysui/desktop/icons/oasis-empty-template.ico diff --git a/sysui/desktop/icons/oasis-formula.icns b/sysui/desktop/icons/oasis-formula.icns Binary files differindex a7bded196c99..657ea29eb95c 100644 --- a/sysui/desktop/icons/oasis-formula.icns +++ b/sysui/desktop/icons/oasis-formula.icns diff --git a/sysui/desktop/icons/oasis-formula.ico b/sysui/desktop/icons/oasis-formula.ico Binary files differnew file mode 100644 index 000000000000..8ba738304e85 --- /dev/null +++ b/sysui/desktop/icons/oasis-formula.ico diff --git a/sysui/desktop/icons/oasis-master-document.icns b/sysui/desktop/icons/oasis-master-document.icns Binary files differindex 1891c129ad47..c39cb8963c82 100644 --- a/sysui/desktop/icons/oasis-master-document.icns +++ b/sysui/desktop/icons/oasis-master-document.icns diff --git a/sysui/desktop/icons/oasis-master-document.ico b/sysui/desktop/icons/oasis-master-document.ico Binary files differnew file mode 100644 index 000000000000..2104eafef55c --- /dev/null +++ b/sysui/desktop/icons/oasis-master-document.ico diff --git a/sysui/desktop/icons/oasis-presentation-template.icns b/sysui/desktop/icons/oasis-presentation-template.icns Binary files differindex 337df2fa7b25..57455ada701a 100644 --- a/sysui/desktop/icons/oasis-presentation-template.icns +++ b/sysui/desktop/icons/oasis-presentation-template.icns diff --git a/sysui/desktop/icons/oasis-presentation-template.ico b/sysui/desktop/icons/oasis-presentation-template.ico Binary files differnew file mode 100644 index 000000000000..ef561b821598 --- /dev/null +++ b/sysui/desktop/icons/oasis-presentation-template.ico diff --git a/sysui/desktop/icons/oasis-presentation.icns b/sysui/desktop/icons/oasis-presentation.icns Binary files differindex 4b9ba4231f24..cf768ac47ba9 100644 --- a/sysui/desktop/icons/oasis-presentation.icns +++ b/sysui/desktop/icons/oasis-presentation.icns diff --git a/sysui/desktop/icons/oasis-presentation.ico b/sysui/desktop/icons/oasis-presentation.ico Binary files differnew file mode 100644 index 000000000000..6f2c1602efdf --- /dev/null +++ b/sysui/desktop/icons/oasis-presentation.ico diff --git a/sysui/desktop/icons/oasis-spreadsheet-template.icns b/sysui/desktop/icons/oasis-spreadsheet-template.icns Binary files differindex 2bae7e38a860..8235e5287806 100644 --- a/sysui/desktop/icons/oasis-spreadsheet-template.icns +++ b/sysui/desktop/icons/oasis-spreadsheet-template.icns diff --git a/sysui/desktop/icons/oasis-spreadsheet-template.ico b/sysui/desktop/icons/oasis-spreadsheet-template.ico Binary files differnew file mode 100644 index 000000000000..1124d9f433e9 --- /dev/null +++ b/sysui/desktop/icons/oasis-spreadsheet-template.ico diff --git a/sysui/desktop/icons/oasis-spreadsheet.icns b/sysui/desktop/icons/oasis-spreadsheet.icns Binary files differindex 69b46c2a1d86..5facf50dbcf2 100644 --- a/sysui/desktop/icons/oasis-spreadsheet.icns +++ b/sysui/desktop/icons/oasis-spreadsheet.icns diff --git a/sysui/desktop/icons/oasis-spreadsheet.ico b/sysui/desktop/icons/oasis-spreadsheet.ico Binary files differnew file mode 100644 index 000000000000..160ab0cbf36c --- /dev/null +++ b/sysui/desktop/icons/oasis-spreadsheet.ico diff --git a/sysui/desktop/icons/oasis-text-template.icns b/sysui/desktop/icons/oasis-text-template.icns Binary files differindex 1986a329cbf8..0f0fe3f89788 100644 --- a/sysui/desktop/icons/oasis-text-template.icns +++ b/sysui/desktop/icons/oasis-text-template.icns diff --git a/sysui/desktop/icons/oasis-text-template.ico b/sysui/desktop/icons/oasis-text-template.ico Binary files differnew file mode 100644 index 000000000000..602124fabee7 --- /dev/null +++ b/sysui/desktop/icons/oasis-text-template.ico diff --git a/sysui/desktop/icons/oasis-text.icns b/sysui/desktop/icons/oasis-text.icns Binary files differindex 21a44a91d6b7..2d031fe49953 100644 --- a/sysui/desktop/icons/oasis-text.icns +++ b/sysui/desktop/icons/oasis-text.icns diff --git a/sysui/desktop/icons/oasis-text.ico b/sysui/desktop/icons/oasis-text.ico Binary files differnew file mode 100644 index 000000000000..d2bd5943164c --- /dev/null +++ b/sysui/desktop/icons/oasis-text.ico diff --git a/sysui/desktop/icons/oasis-web-template.icns b/sysui/desktop/icons/oasis-web-template.icns Binary files differindex 66b0db74ad0a..ee6d299991d7 100644 --- a/sysui/desktop/icons/oasis-web-template.icns +++ b/sysui/desktop/icons/oasis-web-template.icns diff --git a/sysui/desktop/icons/oasis-web-template.ico b/sysui/desktop/icons/oasis-web-template.ico Binary files differnew file mode 100644 index 000000000000..63ac9f348fda --- /dev/null +++ b/sysui/desktop/icons/oasis-web-template.ico diff --git a/sysui/desktop/icons/ooo3_base_app.ico b/sysui/desktop/icons/ooo3_base_app.ico Binary files differindex c728e830273d..ba96b7987627 100644..100755 --- a/sysui/desktop/icons/ooo3_base_app.ico +++ b/sysui/desktop/icons/ooo3_base_app.ico diff --git a/sysui/desktop/icons/ooo3_calc_app.ico b/sysui/desktop/icons/ooo3_calc_app.ico Binary files differindex f46433ec0864..c96041541556 100644..100755 --- a/sysui/desktop/icons/ooo3_calc_app.ico +++ b/sysui/desktop/icons/ooo3_calc_app.ico diff --git a/sysui/desktop/icons/ooo3_draw_app.ico b/sysui/desktop/icons/ooo3_draw_app.ico Binary files differindex 74abe03ace38..6e00cb893786 100644..100755 --- a/sysui/desktop/icons/ooo3_draw_app.ico +++ b/sysui/desktop/icons/ooo3_draw_app.ico diff --git a/sysui/desktop/icons/ooo3_impress_app.ico b/sysui/desktop/icons/ooo3_impress_app.ico Binary files differindex 1eed9c1f1753..23ee3ecc5edf 100644..100755 --- a/sysui/desktop/icons/ooo3_impress_app.ico +++ b/sysui/desktop/icons/ooo3_impress_app.ico diff --git a/sysui/desktop/icons/ooo3_main_app.ico b/sysui/desktop/icons/ooo3_main_app.ico Binary files differindex f858d92bdd6f..98fcea3748a9 100644..100755 --- a/sysui/desktop/icons/ooo3_main_app.ico +++ b/sysui/desktop/icons/ooo3_main_app.ico diff --git a/sysui/desktop/icons/ooo3_math_app.ico b/sysui/desktop/icons/ooo3_math_app.ico Binary files differindex a7123627957a..605814c96e95 100644..100755 --- a/sysui/desktop/icons/ooo3_math_app.ico +++ b/sysui/desktop/icons/ooo3_math_app.ico diff --git a/sysui/desktop/icons/ooo3_writer_app.ico b/sysui/desktop/icons/ooo3_writer_app.ico Binary files differindex 3e7efa610be3..005bd587661b 100644..100755 --- a/sysui/desktop/icons/ooo3_writer_app.ico +++ b/sysui/desktop/icons/ooo3_writer_app.ico diff --git a/sysui/desktop/icons/presentation-template.icns b/sysui/desktop/icons/presentation-template.icns Binary files differindex 5cdf700d9744..f4d01878b9fb 100644 --- a/sysui/desktop/icons/presentation-template.icns +++ b/sysui/desktop/icons/presentation-template.icns diff --git a/sysui/desktop/icons/presentation-template.ico b/sysui/desktop/icons/presentation-template.ico Binary files differnew file mode 100644 index 000000000000..471940369aaf --- /dev/null +++ b/sysui/desktop/icons/presentation-template.ico diff --git a/sysui/desktop/icons/presentation.icns b/sysui/desktop/icons/presentation.icns Binary files differindex 3f6e268c681b..091be5b13677 100644 --- a/sysui/desktop/icons/presentation.icns +++ b/sysui/desktop/icons/presentation.icns diff --git a/sysui/desktop/icons/presentation.ico b/sysui/desktop/icons/presentation.ico Binary files differnew file mode 100644 index 000000000000..360ef79e18b9 --- /dev/null +++ b/sysui/desktop/icons/presentation.ico diff --git a/sysui/desktop/icons/so9_base_app.ico b/sysui/desktop/icons/so9_base_app.ico Binary files differindex 56a323c07e61..aa7036eb90fc 100644..100755 --- a/sysui/desktop/icons/so9_base_app.ico +++ b/sysui/desktop/icons/so9_base_app.ico diff --git a/sysui/desktop/icons/so9_calc_app.ico b/sysui/desktop/icons/so9_calc_app.ico Binary files differindex 81e6948d3971..d7182cad0943 100644..100755 --- a/sysui/desktop/icons/so9_calc_app.ico +++ b/sysui/desktop/icons/so9_calc_app.ico diff --git a/sysui/desktop/icons/so9_draw_app.ico b/sysui/desktop/icons/so9_draw_app.ico Binary files differindex a2c108ad6fe2..a8b3c3270fc0 100644..100755 --- a/sysui/desktop/icons/so9_draw_app.ico +++ b/sysui/desktop/icons/so9_draw_app.ico diff --git a/sysui/desktop/icons/so9_impress_app.ico b/sysui/desktop/icons/so9_impress_app.ico Binary files differindex 0fe4cea9f267..cf10331c5ff9 100644..100755 --- a/sysui/desktop/icons/so9_impress_app.ico +++ b/sysui/desktop/icons/so9_impress_app.ico diff --git a/sysui/desktop/icons/so9_main_app.ico b/sysui/desktop/icons/so9_main_app.ico Binary files differindex 197b924d3369..90f193d80dd9 100644..100755 --- a/sysui/desktop/icons/so9_main_app.ico +++ b/sysui/desktop/icons/so9_main_app.ico diff --git a/sysui/desktop/icons/so9_math_app.ico b/sysui/desktop/icons/so9_math_app.ico Binary files differindex 4d947c2e593d..11fbbf9a494a 100644..100755 --- a/sysui/desktop/icons/so9_math_app.ico +++ b/sysui/desktop/icons/so9_math_app.ico diff --git a/sysui/desktop/icons/so9_writer_app.ico b/sysui/desktop/icons/so9_writer_app.ico Binary files differindex 2df20830d9d2..10c964dba966 100644..100755 --- a/sysui/desktop/icons/so9_writer_app.ico +++ b/sysui/desktop/icons/so9_writer_app.ico diff --git a/sysui/desktop/icons/spreadsheet-template.icns b/sysui/desktop/icons/spreadsheet-template.icns Binary files differindex 058a147b5011..d2dfa849296b 100644 --- a/sysui/desktop/icons/spreadsheet-template.icns +++ b/sysui/desktop/icons/spreadsheet-template.icns diff --git a/sysui/desktop/icons/spreadsheet-template.ico b/sysui/desktop/icons/spreadsheet-template.ico Binary files differnew file mode 100644 index 000000000000..be267eb21bb1 --- /dev/null +++ b/sysui/desktop/icons/spreadsheet-template.ico diff --git a/sysui/desktop/icons/spreadsheet.icns b/sysui/desktop/icons/spreadsheet.icns Binary files differindex 8594b9ba862e..5c893541954b 100644 --- a/sysui/desktop/icons/spreadsheet.icns +++ b/sysui/desktop/icons/spreadsheet.icns diff --git a/sysui/desktop/icons/spreadsheet.ico b/sysui/desktop/icons/spreadsheet.ico Binary files differnew file mode 100644 index 000000000000..a88045e9c1c3 --- /dev/null +++ b/sysui/desktop/icons/spreadsheet.ico diff --git a/sysui/desktop/icons/text-template.icns b/sysui/desktop/icons/text-template.icns Binary files differindex 0f7c006b42f4..8b9694ac755a 100644 --- a/sysui/desktop/icons/text-template.icns +++ b/sysui/desktop/icons/text-template.icns diff --git a/sysui/desktop/icons/text-template.ico b/sysui/desktop/icons/text-template.ico Binary files differnew file mode 100644 index 000000000000..07986929a6f1 --- /dev/null +++ b/sysui/desktop/icons/text-template.ico diff --git a/sysui/desktop/icons/text.icns b/sysui/desktop/icons/text.icns Binary files differindex 169ef0961d98..401d2b9dbf6c 100644 --- a/sysui/desktop/icons/text.icns +++ b/sysui/desktop/icons/text.icns diff --git a/sysui/desktop/icons/text.ico b/sysui/desktop/icons/text.ico Binary files differnew file mode 100644 index 000000000000..f19a7812b15a --- /dev/null +++ b/sysui/desktop/icons/text.ico diff --git a/sysui/desktop/menus/javafilter.desktop b/sysui/desktop/menus/javafilter.desktop new file mode 100644 index 000000000000..9d230f954a7b --- /dev/null +++ b/sysui/desktop/menus/javafilter.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Terminal=false +Type=Application +Exec=openoffice -writer %U +MimeType=application/x-aportisdoc;application/x-pocket-word;application/x-pocket-excel; +Name=%PRODUCTNAME Small Device Format Importer +GenericName=Small Device Format Importer +NoDisplay=true diff --git a/sysui/desktop/redhat/redhat-menus.spec b/sysui/desktop/redhat/redhat-menus.spec index 4ad74ad1b31f..e153b55c3fd4 100644 --- a/sysui/desktop/redhat/redhat-menus.spec +++ b/sysui/desktop/redhat/redhat-menus.spec @@ -279,6 +279,7 @@ done /usr/share/applications/%unixfilename-base.desktop /usr/share/applications/%unixfilename-printeradmin.desktop /usr/share/applications/%unixfilename-startcenter.desktop +/usr/share/applications/%unixfilename-javafilter.desktop /usr/share/applnk-redhat/Office/%unixfilename-writer.desktop /usr/share/applnk-redhat/Office/%unixfilename-calc.desktop /usr/share/applnk-redhat/Office/%unixfilename-draw.desktop @@ -287,6 +288,7 @@ done /usr/share/applnk-redhat/Office/%unixfilename-base.desktop /usr/share/applnk-redhat/Office/%unixfilename-printeradmin.desktop /usr/share/applnk-redhat/Office/%unixfilename-startcenter.desktop +/usr/share/applnk-redhat/Office/%unixfilename-javafilter.desktop /usr/share/mime-info/*.keys /usr/share/mime-info/*.mime /usr/share/mimelnk/application/*.desktop diff --git a/sysui/desktop/share/launcher_genericname.ulf b/sysui/desktop/share/launcher_genericname.ulf index ea11da04e03f..ff8041a155fc 100644 --- a/sysui/desktop/share/launcher_genericname.ulf +++ b/sysui/desktop/share/launcher_genericname.ulf @@ -18,3 +18,6 @@ en-US = "Drawing Program" [startcenter] en-US = "Office" + +[javafilter] +en-US = "Small Device Format Importer" diff --git a/sysui/desktop/share/makefile.mk b/sysui/desktop/share/makefile.mk index 9668272a5615..e1e47648b077 100644 --- a/sysui/desktop/share/makefile.mk +++ b/sysui/desktop/share/makefile.mk @@ -52,7 +52,7 @@ ULFFILES= \ launcher_genericname.ulf \ launcher_name.ulf -LAUNCHERLIST = writer calc draw impress math base printeradmin qstart startcenter +LAUNCHERLIST = writer calc draw impress math base printeradmin qstart startcenter javafilter LAUNCHERDEPN = ../menus/{$(LAUNCHERLIST)}.desktop LAUNCHERFLAGFILE = $(COMMONMISC)/$(TARGET)/xdg.flag @@ -126,9 +126,9 @@ MIMEICONLIST = \ extension ICONDEPN = \ - ../icons/hicolor/{16x16 32x32 48x48}/apps/{$(LAUNCHERLIST:s/qstart//)}.png \ + ../icons/hicolor/{16x16 32x32 48x48}/apps/{$(LAUNCHERLIST:s/qstart//:s/javafilter//)}.png \ ../icons/hicolor/{16x16 32x32 48x48}/mimetypes/{$(MIMEICONLIST)}.png \ - ../icons/locolor/{16x16 32x32}/apps/{$(LAUNCHERLIST:s/qstart//)}.png \ + ../icons/locolor/{16x16 32x32}/apps/{$(LAUNCHERLIST:s/qstart//:s/javafilter//)}.png \ ../icons/locolor/{16x16 32x32}/mimetypes/{$(MIMEICONLIST)}.png # --- Targets ------------------------------------------------------ diff --git a/sysui/desktop/suse/suse-menus.spec b/sysui/desktop/suse/suse-menus.spec index a1bd2b0359f1..7280d9dbae8b 100644 --- a/sysui/desktop/suse/suse-menus.spec +++ b/sysui/desktop/suse/suse-menus.spec @@ -291,6 +291,7 @@ done /usr/share/applications/%unixfilename-base.desktop /usr/share/applications/%unixfilename-printeradmin.desktop /usr/share/applications/%unixfilename-startcenter.desktop +/usr/share/applications/%unixfilename-javafilter.desktop /opt/gnome/share/mime-info/*.keys /opt/gnome/share/mime-info/*.mime /opt/kde3/share/mimelnk/application/*.desktop diff --git a/sysui/prj/d.lst b/sysui/prj/d.lst index 126376930c0d..c6019cea9a43 100644 --- a/sysui/prj/d.lst +++ b/sysui/prj/d.lst @@ -20,6 +20,8 @@ mkdir: %_DEST%\bin%_EXT%\desktop-integration\pkg ..\%__SRC%\bin\soquickstart.exe %_DEST%\bin%_EXT%\so\quickstart.exe ..\%__SRC%\bin\soquickstart.exe %_DEST%\bin%_EXT%\so\install_quickstart.exe +..\%__SRC%\misc\ooo3_main_app.ico %_DEST%\bin%_EXT%\soffice.ico + ..\%__SRC%\misc\desktopshare\*.desktop %_DEST%\pck%_EXT%\*.desktop ..\%__SRC%\misc\PkgInfo %_DEST%\pck%_EXT%\PkgInfo ..\%__SRC%\misc\Info.plist %_DEST%\pck%_EXT%\Info.plist diff --git a/sysui/source/win32/QuickStart/OOQuickStart.rc b/sysui/source/win32/QuickStart/OOQuickStart.rc index ebeed2560dd5..0dc4dab256b6 100644 --- a/sysui/source/win32/QuickStart/OOQuickStart.rc +++ b/sysui/source/win32/QuickStart/OOQuickStart.rc @@ -31,10 +31,10 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -ICON_ACTIVE ICON DISCARDABLE "../../desktop/icons/ooo-main-app.ico" -IDI_QUICKSTART ICON DISCARDABLE "../../desktop/icons/ooo-main-app.ico" -IDI_SMALL ICON DISCARDABLE "../../desktop/icons/ooo-main-app.ico" -ICON_INACTIVE ICON DISCARDABLE "../../desktop/icons/ooo-main-app.ico" +ICON_ACTIVE ICON DISCARDABLE "../../desktop/icons/ooo3_main_app.ico" +IDI_QUICKSTART ICON DISCARDABLE "../../desktop/icons/ooo3_main_app.ico" +IDI_SMALL ICON DISCARDABLE "../../desktop/icons/ooo3_main_app.ico" +ICON_INACTIVE ICON DISCARDABLE "../../desktop/icons/ooo3_main_app.ico" ///////////////////////////////////////////////////////////////////////////// diff --git a/sysui/source/win32/QuickStart/so/QuickStart.rc b/sysui/source/win32/QuickStart/so/QuickStart.rc index 48da2388b174..c48dc2358d0d 100644 --- a/sysui/source/win32/QuickStart/so/QuickStart.rc +++ b/sysui/source/win32/QuickStart/so/QuickStart.rc @@ -31,10 +31,10 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -ICON_ACTIVE ICON DISCARDABLE "../../../desktop/icons/so8-main-app.ico" -IDI_QUICKSTART ICON DISCARDABLE "../../../desktop/icons/so8-main-app.ico" -IDI_SMALL ICON DISCARDABLE "../../../desktop/icons/so8-main-app.ico" -ICON_INACTIVE ICON DISCARDABLE "../../../desktop/icons/so8-main-app.ico" +ICON_ACTIVE ICON DISCARDABLE "../../../desktop/icons/so9_main_app.ico" +IDI_QUICKSTART ICON DISCARDABLE "../../../desktop/icons/so9_main_app.ico" +IDI_SMALL ICON DISCARDABLE "../../../desktop/icons/so9_main_app.ico" +ICON_INACTIVE ICON DISCARDABLE "../../../desktop/icons/so9_main_app.ico" ///////////////////////////////////////////////////////////////////////////// @@ -105,7 +105,7 @@ STRINGTABLE DISCARDABLE BEGIN IDS_APP_TITLE "SoQuickStart" IDC_QUICKSTART "QUICKSTART" - IDS_TOOLTIP "StarOffice 6.0 QuickStart" + IDS_TOOLTIP "Oracle Open Office 3.2 QuickStart" END STRINGTABLE DISCARDABLE diff --git a/ucb/source/ucp/gio/gio_content.hxx b/ucb/source/ucp/gio/gio_content.hxx index 824fa6514379..1c00f8c79d6e 100644 --- a/ucb/source/ucp/gio/gio_content.hxx +++ b/ucb/source/ucp/gio/gio_content.hxx @@ -140,7 +140,7 @@ public: virtual ~Content(); - static com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo( + com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo( GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv, const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties); diff --git a/ucb/source/ucp/gio/gio_datasupplier.cxx b/ucb/source/ucp/gio/gio_datasupplier.cxx index e7d55039ed27..22cd4afa08fe 100644 --- a/ucb/source/ucp/gio/gio_datasupplier.cxx +++ b/ucb/source/ucp/gio/gio_datasupplier.cxx @@ -236,11 +236,31 @@ uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 nInde if ( getResult( nIndex ) ) { - uno::Reference< sdbc::XRow > xRow = Content::getPropertyValuesFromGFileInfo( - maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getEnvironment(), getResultSet()->getProperties()); - - maResults[ nIndex ]->xRow = xRow; - return xRow; + uno::Reference< ucb::XContent > xContent( queryContent( nIndex ) ); + if ( xContent.is() ) + { + try + { + uno::Reference< ucb::XCommandProcessor > xCmdProc( + xContent, uno::UNO_QUERY_THROW ); + sal_Int32 nCmdId( xCmdProc->createCommandIdentifier() ); + ucb::Command aCmd; + aCmd.Name = rtl::OUString::createFromAscii( "getPropertyValues" ); + aCmd.Handle = -1; + aCmd.Argument <<= getResultSet()->getProperties(); + uno::Any aResult( xCmdProc->execute( + aCmd, nCmdId, getResultSet()->getEnvironment() ) ); + uno::Reference< sdbc::XRow > xRow; + if ( aResult >>= xRow ) + { + maResults[ nIndex ]->xRow = xRow; + return xRow; + } + } + catch ( uno::Exception const & ) + { + } + } } return uno::Reference< sdbc::XRow >(); } diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index ea1c09efaa3f..4ffc8dd88cf5 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -960,6 +960,7 @@ void DAVResourceAccess::LOCK( while ( bRetry ); } +#if 0 // currently not used, but please don't remove code //========================================================================= // refresh existing lock. sal_Int64 DAVResourceAccess::LOCK( @@ -1003,6 +1004,7 @@ sal_Int64 DAVResourceAccess::LOCK( return nNewTimeout; } +#endif //========================================================================= void DAVResourceAccess::UNLOCK( diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/ucb/source/ucp/webdav/DAVResourceAccess.hxx index 87e306d94e02..53a98847078b 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.hxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.hxx @@ -209,12 +209,14 @@ public: com::sun::star::ucb::XCommandEnvironment > & xEnv ) throw( DAVException ); +#if 0 // currently not used, but please don't remove code // refresh existing lock. sal_Int64 LOCK( sal_Int64 nTimeout, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv ) throw ( DAVException ); +#endif void UNLOCK( const com::sun::star::uno::Reference< diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index 0d979ae72ada..8fc1730ba018 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -435,7 +435,7 @@ extern "C" int NeonSession_CertificationNotify( void *userdata, char * dn = ne_ssl_readable_dname( ne_ssl_cert_subject( cert ) ); rtl::OUString cert_subject( dn, strlen( dn ), RTL_TEXTENCODING_UTF8, 0 ); - free( dn ); + ne_free( dn ); security::CertificateContainerStatus certificateContainer( xCertificateContainer->hasCertificate( diff --git a/ucb/source/ucp/webdav/NeonUri.cxx b/ucb/source/ucp/webdav/NeonUri.cxx index f71056ba83a9..774faa06b9dd 100644 --- a/ucb/source/ucp/webdav/NeonUri.cxx +++ b/ucb/source/ucp/webdav/NeonUri.cxx @@ -32,6 +32,7 @@ #include <rtl/uri.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> +#include "ne_alloc.h" #include "NeonUri.hxx" #include "DAVException.hxx" @@ -127,7 +128,7 @@ NeonUri::NeonUri( const ne_uri * inUri ) throw DAVException( DAVException::DAV_INVALID_ARG ); init( rtl::OString( uri ), inUri ); - free( uri ); + ne_free( uri ); calculateURI(); } diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index b6c1eb613f5f..e883bd60848d 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -34,13 +34,11 @@ #include "com/sun/star/container/XHierarchicalNameAccess.hpp" #include "com/sun/star/document/BrokenPackageRequest.hpp" #include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp" -#include "com/sun/star/task/DocumentMacroConfirmationRequest2.hpp" #include "com/sun/star/java/WrongJavaVersionException.hpp" #include "com/sun/star/lang/XInitialization.hpp" #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/DocumentMacroConfirmationRequest2.hpp" #include "com/sun/star/task/ErrorCodeIOException.hpp" #include "com/sun/star/task/ErrorCodeRequest.hpp" #include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp" @@ -73,12 +71,16 @@ #include "tools/rcid.h" // RSC_STRING #include "tools/errinf.hxx" // ErrorHandler, ErrorContext, ... #include "vos/mutex.hxx" +#include "tools/diagnose_ex.h" #include "comphelper/documentconstants.hxx" // ODFVER_012_TEXT #include "svtools/sfxecode.hxx" // ERRCODE_SFX_* #include "vcl/msgbox.hxx" #include "vcl/svapp.hxx" #include "unotools/configmgr.hxx" #include "toolkit/helper/vclunohelper.hxx" +#include "comphelper/namedvaluecollection.hxx" +#include "typelib/typedescription.hxx" +#include "unotools/confignode.hxx" #include "ids.hrc" @@ -88,7 +90,26 @@ #include "iahndl.hxx" -using namespace com::sun::star; +/** === begin UNO using === **/ +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::task::XInteractionContinuation; +using ::com::sun::star::task::XInteractionAbort; +using ::com::sun::star::task::XInteractionApprove; +using ::com::sun::star::task::XInteractionAskLater; +using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest; +using ::com::sun::star::uno::XInterface; +using ::com::sun::star::lang::XInitialization; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::task::XInteractionHandler2; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Any; +using ::com::sun::star::task::XInteractionRequest; +using ::com::sun::star::lang::XMultiServiceFactory; +/** === end UNO using === **/ + +using namespace ::com::sun::star; namespace { @@ -310,47 +331,116 @@ UUIInteractionHelper::tryOtherInteractionHandler( aIt != aEnd; ++aIt) { - uno::Reference< uno::XInterface > xIfc; + if ( handleCustomRequest( rRequest, aIt->ServiceName ) ) + return true; + } + return false; +} - try - { - xIfc = m_xServiceFactory->createInstance(aIt->ServiceName); - } - catch ( uno::RuntimeException const & ) - { - throw; - } - catch ( uno::Exception const & ) +namespace +{ + // ................................................................................................................. + static bool lcl_matchesRequest( const Any& i_rRequest, const ::rtl::OUString& i_rTypeName, const ::rtl::OUString& i_rPropagation ) + { + const ::com::sun::star::uno::TypeDescription aTypeDesc( i_rTypeName ); + const typelib_TypeDescription* pTypeDesc = aTypeDesc.get(); + if ( !pTypeDesc || !pTypeDesc->pWeakRef ) { +#if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer aMessage; + aMessage.append( "no type found for '" ); + aMessage.append( ::rtl::OUStringToOString( i_rTypeName, RTL_TEXTENCODING_UTF8 ) ); + aMessage.append( "'" ); + OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); +#endif + return false; } + const ::com::sun::star::uno::Type aType( pTypeDesc->pWeakRef ); - uno::Reference< lang::XInitialization > - xInitialization( xIfc, uno::UNO_QUERY ); + const bool bExactMatch = ( i_rPropagation.compareToAscii( "named-only" ) == 0 ); + if ( bExactMatch ) + return i_rRequest.getValueType().equals( aType ); - OSL_ENSURE( xInitialization.is(), - "Custom Interactionhandler does not " - "implement mandatory interface XInitialization!" ); - if (xInitialization.is()) - { - uno::Sequence< uno::Any > propertyValues(1); - beans::PropertyValue aProperty; + return i_rRequest.isExtractableTo( aType ); + } +} - aProperty.Name = rtl::OUString::createFromAscii( "Parent" ); - aProperty.Value <<= getParentXWindow(); - propertyValues[ 0 ] <<= aProperty; +// --------------------------------------------------------------------------------------------------------------------- +bool UUIInteractionHelper::handleCustomRequest( const Reference< XInteractionRequest >& i_rRequest, const ::rtl::OUString& i_rServiceName ) const +{ + try + { + Reference< XInteractionHandler2 > xHandler( m_xServiceFactory->createInstance( i_rServiceName ), UNO_QUERY_THROW ); - xInitialization->initialize(propertyValues); + Reference< XInitialization > xHandlerInit( xHandler, UNO_QUERY ); + if ( xHandlerInit.is() ) + { + ::comphelper::NamedValueCollection aInitArgs; + aInitArgs.put( "Parent", getParentXWindow() ); + xHandlerInit->initialize( aInitArgs.getWrappedPropertyValues() ); } - uno::Reference< task::XInteractionHandler2 > - xIH( xIfc, uno::UNO_QUERY ); - - OSL_ENSURE( xIH.is(), - "Custom Interactionhandler does not " - "implement mandatory interface XInteractionHandler2!" ); - if (xIH.is() && xIH->handleInteractionRequest(rRequest)) + if ( xHandler->handleInteractionRequest( i_rRequest ) ) return true; } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; +} + +// --------------------------------------------------------------------------------------------------------------------- +bool UUIInteractionHelper::handleTypedHandlerImplementations( Reference< XInteractionRequest > const & rRequest ) +{ + // the request + const Any aRequest( rRequest->getRequest() ); + + const StringHashMap::const_iterator aCacheHitTest = m_aTypedCustomHandlers.find( aRequest.getValueTypeName() ); + if ( aCacheHitTest != m_aTypedCustomHandlers.end() ) + return handleCustomRequest( rRequest, aCacheHitTest->second ); + + // the base registration node for "typed" interaction handlers + const ::utl::OConfigurationTreeRoot aConfigRoot( ::utl::OConfigurationTreeRoot::createWithServiceFactory( + m_xServiceFactory, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Interaction/InteractionHandlers" ) ), + -1, + ::utl::OConfigurationTreeRoot::CM_READONLY + ) ); + + // loop through all registered implementations + const Sequence< ::rtl::OUString > aRegisteredHandlers( aConfigRoot.getNodeNames() ); + const ::rtl::OUString* pHandlerName = aRegisteredHandlers.getConstArray(); + const ::rtl::OUString* pHandlersEnd = aRegisteredHandlers.getConstArray() + aRegisteredHandlers.getLength(); + for ( ; pHandlerName != pHandlersEnd; ++pHandlerName ) + { + const ::utl::OConfigurationNode aHandlerNode( aConfigRoot.openNode( *pHandlerName ) ); + const ::utl::OConfigurationNode aTypesNode( aHandlerNode.openNode( "HandledRequestTypes" ) ); + + // loop through all the types which the current handler is registered for + const Sequence< ::rtl::OUString > aHandledTypes( aTypesNode.getNodeNames() ); + const ::rtl::OUString* pType = aHandledTypes.getConstArray(); + const ::rtl::OUString* pTypesEnd = aHandledTypes.getConstArray() + aHandledTypes.getLength(); + for ( ; pType != pTypesEnd; ++pType ) + { + // the UNO type is the node name + ::utl::OConfigurationNode aType( aTypesNode.openNode( *pType ) ); + // and there's a child denoting how the responsibility propagates + ::rtl::OUString sPropagation; + OSL_VERIFY( aType.getNodeValue( "Propagation" ) >>= sPropagation ); + if ( lcl_matchesRequest( aRequest, *pType, sPropagation ) ) + { + // retrieve the service/implementation name of the handler + ::rtl::OUString sServiceName; + OSL_VERIFY( aHandlerNode.getNodeValue( "ServiceName" ) >>= sServiceName ); + // cache the information who feels responsible for requests of this type + m_aTypedCustomHandlers[ aRequest.getValueTypeName() ] = sServiceName; + // actually handle the request + return handleCustomRequest( rRequest, sServiceName ); + } + } + } + return false; } @@ -819,24 +909,12 @@ UUIInteractionHelper::handleRequest_impl( handleMacroConfirmRequest( aMacroConfirmRequest.DocumentURL, aMacroConfirmRequest.DocumentStorage, - ODFVER_012_TEXT, + aMacroConfirmRequest.DocumentVersion.getLength() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT, aMacroConfirmRequest.DocumentSignatureInformation, rRequest->getContinuations()); return true; } - task::DocumentMacroConfirmationRequest2 aMacroConfirmRequest2; - if (aAnyRequest >>= aMacroConfirmRequest2) - { - handleMacroConfirmRequest( - aMacroConfirmRequest2.DocumentURL, - aMacroConfirmRequest2.DocumentZipStorage, - aMacroConfirmRequest2.DocumentVersion, - aMacroConfirmRequest2.DocumentSignatureInformation, - rRequest->getContinuations()); - return true; - } - task::FutureDocumentVersionProductUpdateRequest aProductUpdateRequest; if (aAnyRequest >>= aProductUpdateRequest) @@ -848,8 +926,14 @@ UUIInteractionHelper::handleRequest_impl( } /////////////////////////////////////////////////////////////// - // Last chance: try to find and use another IH for the request. + // Last chance: interaction handlers registered in the configuration /////////////////////////////////////////////////////////////// + + // typed InteractionHandlers (ooo.Interactions) + if ( handleTypedHandlerImplementations( rRequest ) ) + return true; + + // legacy configuration (ooo.ucb.InteractionHandlers) if (tryOtherInteractionHandler( rRequest )) return true; } @@ -863,6 +947,15 @@ UUIInteractionHelper::handleRequest_impl( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")), uno::Reference< uno::XInterface >()); } + catch( const uno::RuntimeException& ) + { + throw; // allowed to leave here + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; } void @@ -997,21 +1090,16 @@ UUIInteractionHelper::getParentProperty() } uno::Reference< awt::XWindow> -UUIInteractionHelper::getParentXWindow() +UUIInteractionHelper::getParentXWindow() const SAL_THROW(()) { osl::MutexGuard aGuard(m_aPropertyMutex); - for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i) + ::comphelper::NamedValueCollection aProperties( m_aProperties ); + if ( aProperties.has( "Parent" ) ) { - beans::PropertyValue aProperty; - if ((m_aProperties[i] >>= aProperty) - && aProperty. - Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Parent"))) - { - uno::Reference< awt::XWindow > xWindow; - aProperty.Value >>= xWindow; - return xWindow; - } + uno::Reference< awt::XWindow > xWindow; + OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow ); + return xWindow; } return 0; } @@ -1350,11 +1438,8 @@ UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest( // suitable place), again, and we would only have one place where we remember the s_bDeferredToNextSession // flag. // - // The side effect (well, actually the more important effect) would be that we do not need to burden - // this central implementation with all interactions which are possible. Instead, separate parts of OOo - // can define/implement different requests. (for instance, everything which today is done in the - // css.sdb.InteractionHandler can then be routed through a "normal" interaction handler, where today we - // always need to tell people to instantiate the SDB-version of the handler, not the normal one.) + // Note: The above pattern has been implemented in CWS autorecovery. Now the remaining task is to move the + // handling of this interaction to SFX, again. if ( !s_bDeferredToNextSession ) { diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index dc1a3e8b8834..6402653d3bda 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -68,6 +68,8 @@ namespace com { namespace sun { namespace star { } } } } +#include <hash_map> + class Window; //============================================================================ @@ -84,15 +86,18 @@ struct InteractionHandlerData typedef std::vector< InteractionHandlerData > InteractionHandlerDataList; +typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > Continuations; + +typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > StringHashMap; + //============================================================================ class UUIInteractionHelper { private: - osl::Mutex m_aPropertyMutex; - com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; - com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties; - + mutable osl::Mutex m_aPropertyMutex; + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + ::com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties; + StringHashMap m_aTypedCustomHandlers; UUIInteractionHelper(UUIInteractionHelper &); // not implemented void operator =(UUIInteractionHelper); // not implemented @@ -155,7 +160,7 @@ private: SAL_THROW(()); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> - getParentXWindow() + getParentXWindow() const SAL_THROW(()); rtl::OUString @@ -166,6 +171,10 @@ private: getInteractionHandler() SAL_THROW((com::sun::star::uno::RuntimeException)); + bool handleTypedHandlerImplementations( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest + ); + bool tryOtherInteractionHandler( com::sun::star::uno::Reference< @@ -328,6 +337,11 @@ private: com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest > const & rRequest) SAL_THROW((::com::sun::star::uno::RuntimeException)); + + bool handleCustomRequest( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& i_rRequest, + const ::rtl::OUString& i_rServiceName + ) const; }; class ErrorResource: private Resource diff --git a/uui/source/lockfailed.src b/uui/source/lockfailed.src index 66d6a1d4bb7e..1a3e1534d0ff 100644 --- a/uui/source/lockfailed.src +++ b/uui/source/lockfailed.src @@ -37,7 +37,7 @@ String STR_LOCKFAILED_TITLE }; String STR_LOCKFAILED_MSG { - Text [ en-US ] = "The file could not be locked for exclusive access by %PRODUCTNAME, due to missing permission to created a lock file on that file location."; + Text [ en-US ] = "The file could not be locked for exclusive access by %PRODUCTNAME, due to missing permission to create a lock file on that file location."; }; String STR_LOCKFAILED_DONTSHOWAGAIN { diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 83bd677dd7de..a99b3fd47e00 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -608,7 +608,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno:: { if ( bPreview ) { - if ( !pViewFrame->GetFrame()->IsInPlace() ) + if ( !pViewFrame->GetFrame().IsInPlace() ) { // #TODO is this necessary ( calc specific ) // SC_MOD()->InputEnterHandler(); diff --git a/xmlhelp/source/com/sun/star/help/makefile.mk b/xmlhelp/source/com/sun/star/help/makefile.mk index 14311cdddc77..ffa08b30cfed 100644 --- a/xmlhelp/source/com/sun/star/help/makefile.mk +++ b/xmlhelp/source/com/sun/star/help/makefile.mk @@ -28,42 +28,18 @@ PRJ = ..$/..$/..$/..$/.. PRJNAME = xmlhelp TARGET = HelpLinker -LIBBASENAME = helplinker PACKAGE = com$/sun$/star$/help -TARGETTYPE=CUI .IF "$(SOLAR_JAVA)"!="" # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : helplinker.pmk -.IF "$(SYSTEM_LIBXSLT)" == "YES" -CFLAGS+= $(LIBXSLT_CFLAGS) -.ELSE -LIBXSLTINCDIR=external$/libxslt -CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR) -.ENDIF - -.IF "$(SYSTEM_DB)" == "YES" -CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) -.ENDIF - -.IF "$(SYSTEM_EXPAT)" == "YES" -CFLAGS+=-DSYSTEM_EXPAT -.ENDIF - - JAVACLASSFILES = \ $(CLASSDIR)$/$(PACKAGE)$/HelpSearch.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpComponent.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpIndexer.class -JAVAFILES = \ - HelpSearch.java \ - HelpComponent.java \ - HelpIndexer.java - TRANSEX3FILES = \ $(SOLARBINDIR)$/help$/$(PACKAGE)$/HelpIndexerTool.class \ $(SOLARBINDIR)$/help$/$(PACKAGE)$/HelpFileDocument.class @@ -87,14 +63,12 @@ CUSTOMMANIFESTFILE = MANIFEST.MF .INCLUDE : target.mk -ALLTAR : $(ADDFILES) - .IF "$(JARTARGETN)"!="" $(JAVATARGET) : $(ADDFILES) $(JARTARGETN) : $(ADDFILES) .ENDIF -$(CLASSDIR)$/$(PACKAGE)$/%.class : $(SOLARBINDIR)$/help$/$(PACKAGE)$/%.class +$(ADDFILES) : $(SOLARBINDIR)$/help$/$(PACKAGE)$/$$(@:f) $(MKDIRHIER) $(@:d) $(COPY) $< $@ diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index a2c70ca45b71..c5e2582b3905 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -57,6 +57,12 @@ #include <com/sun/star/script/XInvocation.hpp> #include <comphelper/locale.hxx> +#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XExtendedToolkit.hpp> +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/XTopWindow.hpp> + #include <l10ntools/compilehelp.hxx> #include <comphelper/storagehelper.hxx> @@ -1271,19 +1277,47 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language, bool error = true; rtl::OUString fileURL; + sal_Bool bHighContrastMode = sal_False; + rtl::OUString aCSS( m_aCSS ); + if ( aCSS.compareToAscii( "default" ) == 0 ) + { + // #i50760: "default" needs to adapt HC mode + uno::Reference< awt::XToolkit > xToolkit = uno::Reference< awt::XToolkit >( + ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), uno::UNO_QUERY ); + if ( xToolkit.is() ) + { + uno::Reference< awt::XExtendedToolkit > xExtToolkit( xToolkit, uno::UNO_QUERY ); + if ( xExtToolkit.is() ) + { + uno::Reference< awt::XTopWindow > xTopWindow = xExtToolkit->getActiveTopWindow(); + if ( xTopWindow.is() ) + { + uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY ); + if ( xVclWindowPeer.is() ) + { + uno::Any aHCMode = xVclWindowPeer->getProperty( rtl::OUString::createFromAscii( "HighContrastMode" ) ); + if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode ) + aCSS = rtl::OUString::createFromAscii( "highcontrastblack" ); + } + } + } + } + } + while( error && retry ) { + if( retry == 2 ) fileURL = getInstallPathAsURL() + processLang( Language ) + rtl::OUString::createFromAscii( "/" ) + - m_aCSS + + aCSS + rtl::OUString::createFromAscii( ".css" ); else if( retry == 1 ) fileURL = getInstallPathAsURL() + - m_aCSS + + aCSS + rtl::OUString::createFromAscii( ".css" ); osl::DirectoryItem aDirItem; @@ -1304,6 +1338,13 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language, } --retry; + if ( !retry && error && bHighContrastMode ) + { + // fall back to default css + aCSS = rtl::OUString::createFromAscii( "default" ); + retry = 2; + bHighContrastMode = sal_False; + } } if( error ) diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx index 2f943f100170..d6227754a5f2 100644 --- a/xmloff/inc/SchXMLExport.hxx +++ b/xmloff/inc/SchXMLExport.hxx @@ -38,7 +38,6 @@ namespace com { namespace sun { namespace star { namespace chart { class XDiagram; class XChartDocument; - class XChartDataArray; struct ChartSeriesAddress; } namespace drawing { diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx index 5876ce989c30..64f579a7c252 100644 --- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx +++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx @@ -44,7 +44,6 @@ namespace com { namespace sun { namespace star { namespace chart { class XDiagram; class XChartDocument; - class XChartDataArray; struct ChartSeriesAddress; } namespace chart2 { @@ -114,6 +113,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes; tDataSequenceCont m_aDataSequencesToExport; + rtl::OUString maCategoriesRange; /** first parseDocument: collect autostyles and store names in this queue second parseDocument: export content and use names from this queue @@ -179,8 +179,6 @@ private: SAL_DLLPRIVATE void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); /// fills the member msString with the appropriate String (i.e. "A3") SAL_DLLPRIVATE void getCellAddress( sal_Int32 nCol, sal_Int32 nRow ); - /// interchanges rows and columns of the sequence given - SAL_DLLPRIVATE void swapDataArray( com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< double > >& rSequence ); /// exports a string as a paragraph element SAL_DLLPRIVATE void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false ); SAL_DLLPRIVATE void exportErrorBarRanges(); diff --git a/xmloff/inc/xmloff/SchXMLImportHelper.hxx b/xmloff/inc/xmloff/SchXMLImportHelper.hxx index f3cb28a754e2..03fa8c8e16c0 100644 --- a/xmloff/inc/xmloff/SchXMLImportHelper.hxx +++ b/xmloff/inc/xmloff/SchXMLImportHelper.hxx @@ -136,10 +136,6 @@ public: static sal_uInt16 GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID; } - sal_Int32 GetNumberOfSeries(); - sal_Int32 GetLengthOfSeries(); - void ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoints = -1 ); - /** @param bPushLastChartType If </FALSE>, in case a new chart type has to be added (because it does not exist yet), it is appended at the end of the chart-type container. When </TRUE>, a new chart type diff --git a/xmloff/inc/xmloff/SettingsExportHelper.hxx b/xmloff/inc/xmloff/SettingsExportHelper.hxx index 406a1a2a1d1b..63c7d9f5df54 100644 --- a/xmloff/inc/xmloff/SettingsExportHelper.hxx +++ b/xmloff/inc/xmloff/SettingsExportHelper.hxx @@ -28,6 +28,8 @@ #ifndef _XMLOFF_SETTINGSEXPORTHELPER_HXX #define _XMLOFF_SETTINGSEXPORTHELPER_HXX +#include "xmloff/dllapi.h" + #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/formula/SymbolDescriptor.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> @@ -40,9 +42,15 @@ namespace com namespace util { struct DateTime; } } } } -class XMLSettingsExportHelper + +namespace xmloff +{ + class XMLSettingsExportContext; +} + +class XMLOFF_DLLPUBLIC XMLSettingsExportHelper { - SvXMLExport& rExport; + ::xmloff::XMLSettingsExportContext& m_rContext; ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubsitution; @@ -91,10 +99,10 @@ class XMLSettingsExportHelper const rtl::OUString rName) const; public: - XMLSettingsExportHelper(SvXMLExport& rExport); + XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext ); ~XMLSettingsExportHelper(); - void exportSettings( + void exportAllSettings( const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps, const rtl::OUString& rName) const; }; diff --git a/xmloff/inc/xmloff/XMLSettingsExportContext.hxx b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx new file mode 100644 index 000000000000..d3e0b6a8c5ee --- /dev/null +++ b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx @@ -0,0 +1,66 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 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. +************************************************************************/ + +#ifndef XML_SETTINGS_EXPORT_CONTEXT_HXX +#define XML_SETTINGS_EXPORT_CONTEXT_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +/** === end UNO includes === **/ + +#include "xmloff/xmltoken.hxx" + +//........................................................................ +namespace xmloff +{ +//........................................................................ + + //==================================================================== + //= XMLExporter + //==================================================================== + class SAL_NO_VTABLE XMLSettingsExportContext + { + public: + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + const ::rtl::OUString& i_rValue ) = 0; + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + enum ::xmloff::token::XMLTokenEnum i_eValue ) = 0; + + virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, + const sal_Bool i_bIgnoreWhitespace ) = 0; + virtual void EndElement( const sal_Bool i_bIgnoreWhitespace ) = 0; + + virtual void Characters( const ::rtl::OUString& i_rCharacters ) = 0; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + GetServiceFactory() const = 0; + + }; + +//........................................................................ +} // namespace xmloff +//........................................................................ + +#endif // XML_SETTINGS_EXPORT_CONTEXT_HXX diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst index ae4f8cd13ffb..0b51b0dd97cb 100644 --- a/xmloff/prj/d.lst +++ b/xmloff/prj/d.lst @@ -88,6 +88,7 @@ mkdir: %_DEST%\inc%_EXT%\xmloff ..\inc\HatchStyle.hxx %_DEST%\inc%_EXT%\xmloff\HatchStyle.hxx ..\inc\ImageStyle.hxx %_DEST%\inc%_EXT%\xmloff\ImageStyle.hxx ..\inc\xmloff\SettingsExportHelper.hxx %_DEST%\inc%_EXT%\xmloff\SettingsExportHelper.hxx +..\inc\xmloff\XMLSettingsExportContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLSettingsExportContext.hxx ..\inc\xmloff\DocumentSettingsContext.hxx %_DEST%\inc%_EXT%\xmloff\DocumentSettingsContext.hxx ..\inc\xmloff\XMLGraphicsDefaultStyle.hxx %_DEST%\inc%_EXT%\xmloff\XMLGraphicsDefaultStyle.hxx ..\inc\XMLEmbeddedObjectExportFilter.hxx %_DEST%\inc%_EXT%\xmloff\XMLEmbeddedObjectExportFilter.hxx diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index fa6481015e5c..e9e3771eb0d7 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -57,7 +57,6 @@ #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> -#include <com/sun/star/chart/XChartDataArray.hpp> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/embed/Aspects.hpp> #include <com/sun/star/embed/XVisualObject.hpp> @@ -874,6 +873,9 @@ void SchXMLChartContext::EndElement() { //own data or only rectangular range available + if( xNewDoc->hasInternalDataProvider() ) + SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc ); + bool bOlderThan2_3 = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( Reference< frame::XModel >( xNewDoc, uno::UNO_QUERY )); bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && bHasOwnData && (meDataRowSource==chart::ChartDataRowSource_ROWS)); // in this case there are range addresses that are simply wrong. @@ -882,21 +884,12 @@ void SchXMLChartContext::EndElement() { //bHasOwnData is true in this case! //e.g. for normal files with own data or also in case of copy paste scenario (e.g. calc to impress) - if( xNewDoc->hasInternalDataProvider() ) - SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc ); bSwitchRangesFromOuterToInternalIfNecessary = true; } else { //apply data from rectangular range - // apply data read from the table sub-element to the chart - // if the data provider supports the XChartDataArray interface like - // the internal data provider - uno::Reference< chart::XChartDataArray > xChartData( xNewDoc->getDataProvider(), uno::UNO_QUERY ); - if( xChartData.is()) - SchXMLTableHelper::applyTableSimple( maTable, xChartData ); - // create datasource from data provider with rectangular range // parameters and change the diagram via template mechanism try @@ -919,9 +912,7 @@ void SchXMLChartContext::EndElement() if( !xNewDoc->hasInternalDataProvider() ) { xNewDoc->createInternalDataProvider( sal_False /* bCloneExistingData */ ); - xChartData = uno::Reference< chart::XChartDataArray >( xNewDoc->getDataProvider(), uno::UNO_QUERY ); - if( xChartData.is()) - SchXMLTableHelper::applyTableSimple( maTable, xChartData ); + SchXMLTableHelper::applyTableToInternalDataProvider( maTable, xNewDoc ); try { lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans ); diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 3dea947dcb8c..9940f99d9f7a 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -71,7 +71,7 @@ #include <com/sun/star/chart/XTwoAxisXSupplier.hpp> #include <com/sun/star/chart/XTwoAxisYSupplier.hpp> #include <com/sun/star/chart/XAxisZSupplier.hpp> -#include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/ChartAxisAssign.hpp> #include <com/sun/star/chart/ChartSeriesAddress.hpp> @@ -116,6 +116,7 @@ using ::rtl::OUStringToOString; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; +using ::std::vector; namespace { @@ -166,6 +167,13 @@ template< typename T > ::std::back_inserter( rDestination )); } +template< typename T > + void lcl_SequenceToVector( const Sequence< T > & rSource, ::std::vector< T > & rDestination ) +{ + rDestination.clear(); + lcl_SequenceToVectorAppend( rSource, rDestination ); +} + Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Reference< chart2::XDiagram > & xDiagram ) { Reference< chart2::data::XLabeledDataSequence > xResult; @@ -209,24 +217,6 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr()); } - /* - //unused ranges are very problematic as they bear the risk to damage the rectangular structure completly - if(!xResult.is()) - { - Sequence< Reference< chart2::data::XLabeledDataSequence > > aUnusedSequences( xDiagram->getUnusedData() ); - - lcl_MatchesRole aHasCategories( OUString::createFromAscii("categories" ) ); - for( sal_Int32 nN=0; nN<aUnusedSequences.getLength(); nN++ ) - { - if( aHasCategories( aUnusedSequences[nN] ) ) - { - xResult.set( aUnusedSequences[nN] ); - break; - } - } - } - */ - return xResult; } @@ -471,12 +461,6 @@ sal_Int32 lcl_getMaxSequenceLength( for( SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( rContainer.begin()); aIt != rContainer.end(); ++aIt ) { - if( aIt->first.is()) - { - sal_Int32 nSeqLength = aIt->first->getData().getLength(); - if( nSeqLength > nResult ) - nResult = nSeqLength; - } if( aIt->second.is()) { sal_Int32 nSeqLength = aIt->second->getData().getLength(); @@ -487,30 +471,6 @@ sal_Int32 lcl_getMaxSequenceLength( return nResult; } -void lcl_fillCategoriesIntoStringVector( - const Reference< chart2::data::XDataSequence > & xCategories, - ::std::vector< OUString > & rOutCategories ) -{ - OSL_ASSERT( xCategories.is()); - if( !xCategories.is()) - return; - Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xCategories, uno::UNO_QUERY ); - if( xTextualDataSequence.is()) - { - rOutCategories.clear(); - Sequence< OUString > aTextData( xTextualDataSequence->getTextualData()); - ::std::copy( aTextData.getConstArray(), aTextData.getConstArray() + aTextData.getLength(), - ::std::back_inserter( rOutCategories )); - } - else - { - Sequence< uno::Any > aAnies( xCategories->getData()); - rOutCategories.resize( aAnies.getLength()); - for( sal_Int32 i=0; i<aAnies.getLength(); ++i ) - aAnies[i] >>= rOutCategories[i]; - } -} - double lcl_getValueFromSequence( const Reference< chart2::data::XDataSequence > & xSeq, sal_Int32 nIndex ) { double fResult = 0.0; @@ -579,17 +539,23 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque return false; } +typedef vector< OUString > tStringVector; +typedef vector< vector< OUString > > t2DStringVector; +typedef vector< vector< double > > t2DNumberContainer; + struct lcl_TableData { - typedef ::std::vector< OUString > tStringContainer; - typedef ::std::vector< ::std::vector< double > > tTwoDimNumberContainer; + t2DNumberContainer aDataInRows; + tStringVector aDataRangeRepresentations; - tTwoDimNumberContainer aDataInRows; - tStringContainer aDataRangeRepresentations; - tStringContainer aFirstRowStrings; - tStringContainer aFirstRowRangeRepresentations; - tStringContainer aFirstColumnStrings; - tStringContainer aFirstColumnRangeRepresentations; + tStringVector aColumnDescriptions; + tStringVector aColumnDescriptions_Ranges; + + tStringVector aRowDescriptions; + tStringVector aRowDescriptions_Ranges; + + Sequence< Sequence< OUString > > aComplexColumnDescriptions;//outer index is columns - inner index is level + Sequence< Sequence< OUString > > aComplexRowDescriptions;//outer index is rows - inner index is level ::std::vector< sal_Int32 > aHiddenColumns; }; @@ -613,39 +579,29 @@ typedef ::std::map< sal_Int32, SchXMLExportHelper::tLabelValuesDataPair > struct lcl_SequenceToMapElement : public ::std::unary_function< lcl_DataSequenceMap::mapped_type, lcl_DataSequenceMap::value_type > { - lcl_SequenceToMapElement( sal_Int32 nOffset = 0 ) : - m_nOffset( nOffset ) + lcl_SequenceToMapElement() {} result_type operator() ( const argument_type & rContent ) { sal_Int32 nIndex = -1; - if( rContent.second.is()) + if( rContent.second.is()) //has values { OUString aRangeRep( rContent.second->getSourceRangeRepresentation()); - if( aRangeRep.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("categories"))) - { - OSL_ASSERT( m_nOffset > 0 ); - nIndex = 0; - } - else - nIndex = aRangeRep.toInt32() + m_nOffset; + nIndex = aRangeRep.toInt32(); } - else if( rContent.first.is()) - nIndex = rContent.first->getSourceRangeRepresentation().copy( sizeof("label ")).toInt32() + m_nOffset; + else if( rContent.first.is()) //has labels + nIndex = rContent.first->getSourceRangeRepresentation().copy( sizeof("label ")).toInt32(); return result_type( nIndex, rContent ); } -private: - sal_Int32 m_nOffset; }; -void lcl_PrepareInternalSequencesForTableExport( - SchXMLExportHelper::tDataSequenceCont & rInOutSequences, bool bHasCategories ) +void lcl_ReorderInternalSequencesAccordingToTheirRangeName( + SchXMLExportHelper::tDataSequenceCont & rInOutSequences ) { lcl_DataSequenceMap aIndexSequenceMap; - const sal_Int32 nOffset = bHasCategories ? 1 : 0; ::std::transform( rInOutSequences.begin(), rInOutSequences.end(), ::std::inserter( aIndexSequenceMap, aIndexSequenceMap.begin()), - lcl_SequenceToMapElement( nOffset )); + lcl_SequenceToMapElement()); rInOutSequences.clear(); sal_Int32 nIndex = 0; @@ -665,113 +621,113 @@ void lcl_PrepareInternalSequencesForTableExport( lcl_TableData lcl_getDataForLocalTable( - const SchXMLExportHelper::tDataSequenceCont & aPassedSequences, bool bHasCategoryLabels, - bool bSwap, - bool bHasOwnData, + const SchXMLExportHelper::tDataSequenceCont & aSequencesToExport, + const Reference< chart::XComplexDescriptionAccess >& xComplexDescriptionAccess, + const OUString& rCategoriesRange, + bool bSeriesFromColumns, const Reference< chart2::data::XRangeXMLConversion > & xRangeConversion ) { lcl_TableData aResult; - SchXMLExportHelper::tDataSequenceCont aSequencesToExport( aPassedSequences ); - if( bHasOwnData ) - lcl_PrepareInternalSequencesForTableExport( aSequencesToExport, bHasCategoryLabels ); + try + { + Sequence< OUString > aSimpleCategories; + if( xComplexDescriptionAccess.is() ) + { + if( bSeriesFromColumns ) + aSimpleCategories = xComplexDescriptionAccess->getRowDescriptions(); + else + aSimpleCategories = xComplexDescriptionAccess->getColumnDescriptions(); - SchXMLExportHelper::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size(); - SchXMLExportHelper::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin()); - SchXMLExportHelper::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end()); - SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( aBegin ); + aResult.aComplexColumnDescriptions = xComplexDescriptionAccess->getComplexColumnDescriptions(); + aResult.aComplexRowDescriptions = xComplexDescriptionAccess->getComplexRowDescriptions(); + } - if( bHasCategoryLabels ) - { - if( nNumSequences>=1 ) //#i83537# - --nNumSequences; - else - bHasCategoryLabels=false; - } - size_t nMaxSequenceLength( lcl_getMaxSequenceLength( aSequencesToExport )); - size_t nNumColumns( bSwap ? nMaxSequenceLength : nNumSequences ); - size_t nNumRows( bSwap ? nNumSequences : nMaxSequenceLength ); + SchXMLExportHelper::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size(); + SchXMLExportHelper::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin()); + SchXMLExportHelper::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end()); + SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( aBegin ); - // resize data - aResult.aDataInRows.resize( nNumRows ); - double fNan = 0.0; - ::rtl::math::setNan( &fNan ); - ::std::for_each( aResult.aDataInRows.begin(), aResult.aDataInRows.end(), - lcl_resize< lcl_TableData::tTwoDimNumberContainer::value_type >( nNumColumns, fNan )); - aResult.aFirstRowStrings.resize( nNumColumns ); - aResult.aFirstColumnStrings.resize( nNumRows ); + size_t nMaxSequenceLength( lcl_getMaxSequenceLength( aSequencesToExport )); + nMaxSequenceLength = std::max( nMaxSequenceLength, size_t( aSimpleCategories.getLength() ) ); + size_t nNumColumns( bSeriesFromColumns ? nNumSequences : nMaxSequenceLength ); + size_t nNumRows( bSeriesFromColumns ? nMaxSequenceLength : nNumSequences ); - lcl_TableData::tStringContainer & rCategories = - (bSwap ? aResult.aFirstRowStrings : aResult.aFirstColumnStrings ); - lcl_TableData::tStringContainer & rLabels = - (bSwap ? aResult.aFirstColumnStrings : aResult.aFirstRowStrings ); + // resize data + aResult.aDataInRows.resize( nNumRows ); + double fNan = 0.0; + ::rtl::math::setNan( &fNan ); + ::std::for_each( aResult.aDataInRows.begin(), aResult.aDataInRows.end(), + lcl_resize< t2DNumberContainer::value_type >( nNumColumns, fNan )); + aResult.aColumnDescriptions.resize( nNumColumns ); + aResult.aComplexColumnDescriptions.realloc( nNumColumns ); + aResult.aRowDescriptions.resize( nNumRows ); + aResult.aComplexRowDescriptions.realloc( nNumRows ); - if( aIt != aEnd ) - { - if( bHasCategoryLabels ) - { - lcl_fillCategoriesIntoStringVector( aIt->second, rCategories ); - if( aIt->second.is()) - { - OUString aRange( aIt->second->getSourceRangeRepresentation()); - if( xRangeConversion.is()) - aRange = xRangeConversion->convertRangeToXML( aRange ); - if( bSwap ) - aResult.aFirstRowRangeRepresentations.push_back( aRange ); - else - aResult.aFirstColumnRangeRepresentations.push_back( aRange ); - } - ++aIt; - } - else - { - // autogenerated categories - rCategories.clear(); - lcl_SequenceToVectorAppend( aIt->second->generateLabel( chart2::data::LabelOrigin_LONG_SIDE ), rCategories ); - } - } + tStringVector& rCategories = bSeriesFromColumns ? aResult.aRowDescriptions : aResult.aColumnDescriptions; + tStringVector& rLabels = bSeriesFromColumns ? aResult.aColumnDescriptions : aResult.aRowDescriptions; - // iterate over all sequences - size_t nSeqIdx = 0; - for( ; aIt != aEnd; ++aIt, ++nSeqIdx ) - { - OUString aRange; - if( aIt->first.is()) + //categories + lcl_SequenceToVector( aSimpleCategories, rCategories ); + if( rCategoriesRange.getLength() ) { - rLabels[nSeqIdx] = lcl_getLabelString( aIt->first ); - aRange = aIt->first->getSourceRangeRepresentation(); + OUString aRange(rCategoriesRange); if( xRangeConversion.is()) aRange = xRangeConversion->convertRangeToXML( aRange ); + if( bSeriesFromColumns ) + aResult.aRowDescriptions_Ranges.push_back( aRange ); + else + aResult.aColumnDescriptions_Ranges.push_back( aRange ); } - else if( aIt->second.is()) - rLabels[nSeqIdx] = lcl_flattenStringSequence( - aIt->second->generateLabel( chart2::data::LabelOrigin_SHORT_SIDE )); - if( bSwap ) - aResult.aFirstColumnRangeRepresentations.push_back( aRange ); - else - aResult.aFirstRowRangeRepresentations.push_back( aRange ); - ::std::vector< double > aNumbers( lcl_getAllValuesFromSequence( aIt->second )); - if( bSwap ) - aResult.aDataInRows[nSeqIdx] = aNumbers; - else + // iterate over all sequences + size_t nSeqIdx = 0; + for( ; aIt != aEnd; ++aIt, ++nSeqIdx ) { - const sal_Int32 nSize( static_cast< sal_Int32 >( aNumbers.size())); - for( sal_Int32 nIdx=0; nIdx<nSize; ++nIdx ) - aResult.aDataInRows[nIdx][nSeqIdx] = aNumbers[nIdx]; - } + OUString aRange; + if( aIt->first.is()) + { + rLabels[nSeqIdx] = lcl_getLabelString( aIt->first ); + aRange = aIt->first->getSourceRangeRepresentation(); + if( xRangeConversion.is()) + aRange = xRangeConversion->convertRangeToXML( aRange ); + } + else if( aIt->second.is()) + rLabels[nSeqIdx] = lcl_flattenStringSequence( + aIt->second->generateLabel( chart2::data::LabelOrigin_SHORT_SIDE )); + if( bSeriesFromColumns ) + aResult.aColumnDescriptions_Ranges.push_back( aRange ); + else + aResult.aRowDescriptions_Ranges.push_back( aRange ); - if( aIt->second.is()) - { - aRange = aIt->second->getSourceRangeRepresentation(); - if( xRangeConversion.is()) - aRange = xRangeConversion->convertRangeToXML( aRange ); - } - aResult.aDataRangeRepresentations.push_back( aRange ); + ::std::vector< double > aNumbers( lcl_getAllValuesFromSequence( aIt->second )); + if( bSeriesFromColumns ) + { + const sal_Int32 nSize( static_cast< sal_Int32 >( aNumbers.size())); + for( sal_Int32 nIdx=0; nIdx<nSize; ++nIdx ) + aResult.aDataInRows[nIdx][nSeqIdx] = aNumbers[nIdx]; + } + else + aResult.aDataInRows[nSeqIdx] = aNumbers; + + if( aIt->second.is()) + { + aRange = aIt->second->getSourceRangeRepresentation(); + if( xRangeConversion.is()) + aRange = xRangeConversion->convertRangeToXML( aRange ); + } + aResult.aDataRangeRepresentations.push_back( aRange ); - //is column hidden? - if( !lcl_SequenceHasUnhiddenData(aIt->first) && !lcl_SequenceHasUnhiddenData(aIt->second) ) - aResult.aHiddenColumns.push_back(nSeqIdx); + //is column hidden? + if( !lcl_SequenceHasUnhiddenData(aIt->first) && !lcl_SequenceHasUnhiddenData(aIt->second) ) + aResult.aHiddenColumns.push_back(nSeqIdx); + } + } + catch( uno::Exception & rEx ) + { + (void)rEx; // avoid warning for pro build + OSL_TRACE( OUStringToOString( OUString( RTL_CONSTASCII_USTRINGPARAM( + "something went wrong during table data collection: " )) + rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr()); } return aResult; @@ -1452,6 +1408,19 @@ void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rCha delete pElChart; } +void lcl_exportComplexLabel( const Sequence< OUString >& rComplexLabel, SvXMLExport& rExport ) +{ + sal_Int32 nLength = rComplexLabel.getLength(); + if( nLength<=1 ) + return; + SvXMLElementExport aTextList( rExport, XML_NAMESPACE_TEXT, XML_LIST, sal_True, sal_True ); + for(sal_Int32 nN=0; nN<nLength; nN++) + { + SvXMLElementExport aListItem( rExport, XML_NAMESPACE_TEXT, XML_LIST_ITEM, sal_True, sal_True ); + SchXMLTools::exportText( rExport, rComplexLabel[nN], false /*bConvertTabsLFs*/ ); + } +} + void SchXMLExportHelper::exportTable() { // table element @@ -1468,13 +1437,24 @@ void SchXMLExportHelper::exportTable() xRangeConversion.set( xNewDoc->getDataProvider(), uno::UNO_QUERY ); } - lcl_TableData aData( lcl_getDataForLocalTable( - m_aDataSequencesToExport, mbHasCategoryLabels, !mbRowSourceColumns, bHasOwnData, xRangeConversion )); + Reference< chart::XComplexDescriptionAccess > xComplexDescriptionAccess; + { + Reference< chart::XChartDocument > xChartDoc( mrExport.GetModel(), uno::UNO_QUERY ); + if( xChartDoc.is() ) + xComplexDescriptionAccess = Reference< chart::XComplexDescriptionAccess >( xChartDoc->getData(), uno::UNO_QUERY ); + } - lcl_TableData::tStringContainer::const_iterator aDataRangeIter( aData.aDataRangeRepresentations.begin()); - const lcl_TableData::tStringContainer::const_iterator aDataRangeEndIter( aData.aDataRangeRepresentations.end()); - lcl_TableData::tStringContainer::const_iterator aFirstColumnRangeIter( aData.aFirstColumnRangeRepresentations.begin()); - const lcl_TableData::tStringContainer::const_iterator aFirstColumnRangeEndIter( aData.aFirstColumnRangeRepresentations.end()); + if( bHasOwnData ) + lcl_ReorderInternalSequencesAccordingToTheirRangeName( m_aDataSequencesToExport ); + lcl_TableData aData( lcl_getDataForLocalTable( m_aDataSequencesToExport + , xComplexDescriptionAccess, maCategoriesRange + , mbRowSourceColumns, xRangeConversion )); + + tStringVector::const_iterator aDataRangeIter( aData.aDataRangeRepresentations.begin()); + const tStringVector::const_iterator aDataRangeEndIter( aData.aDataRangeRepresentations.end()); + + tStringVector::const_iterator aRowDescriptions_RangeIter( aData.aRowDescriptions_Ranges.begin()); + const tStringVector::const_iterator aRowDescriptions_RangeEnd( aData.aRowDescriptions_Ranges.end()); // declare columns { @@ -1502,7 +1482,7 @@ void SchXMLExportHelper::exportTable() nNextIndex = nHiddenIndex+1; } - sal_Int32 nEndIndex = aData.aFirstRowStrings.size()-1; + sal_Int32 nEndIndex = aData.aColumnDescriptions.size()-1; if( nEndIndex >= nNextIndex ) { sal_Int64 nRepeat = static_cast< sal_Int64 >( nEndIndex - nNextIndex + 1 ); @@ -1514,59 +1494,78 @@ void SchXMLExportHelper::exportTable() } // export rows with content + //export header row { SvXMLElementExport aHeaderRows( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, sal_True, sal_True ); SvXMLElementExport aRow( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True ); + + //first one empty cell for the row descriptions { SvXMLElementExport aEmptyCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); SvXMLElementExport aEmptyParagraph( mrExport, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_True ); } - lcl_TableData::tStringContainer::const_iterator aFirstRowRangeIter( aData.aFirstRowRangeRepresentations.begin()); - const lcl_TableData::tStringContainer::const_iterator aFirstRowRangeEndIter( aData.aFirstRowRangeRepresentations.end()); - for( lcl_TableData::tStringContainer::const_iterator aIt( aData.aFirstRowStrings.begin()); - aIt != aData.aFirstRowStrings.end(); ++aIt ) + //export column descriptions + tStringVector::const_iterator aColumnDescriptions_RangeIter( aData.aColumnDescriptions_Ranges.begin()); + const tStringVector::const_iterator aColumnDescriptions_RangeEnd( aData.aColumnDescriptions_Ranges.end()); + const Sequence< Sequence< OUString > >& rComplexColumnDescriptions = aData.aComplexColumnDescriptions; + sal_Int32 nComplexCount = rComplexColumnDescriptions.getLength(); + sal_Int32 nC = 0; + for( tStringVector::const_iterator aIt( aData.aColumnDescriptions.begin()); + aIt != aData.aColumnDescriptions.end(); ++aIt ) { mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); // write the original range name as id into the local table // to allow a correct re-association when copying via clipboard - if( !bHasOwnData && aFirstRowRangeIter != aFirstRowRangeEndIter ) + if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd ) { - if( (*aFirstRowRangeIter).getLength()) - mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aFirstRowRangeIter ); - ++aFirstRowRangeIter; + if( (*aColumnDescriptions_RangeIter).getLength()) + mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aColumnDescriptions_RangeIter ); + ++aColumnDescriptions_RangeIter; } exportText( *aIt ); + if( nC < nComplexCount ) + lcl_exportComplexLabel( rComplexColumnDescriptions[nC++], mrExport ); } - OSL_ASSERT( bHasOwnData || aFirstRowRangeIter == aFirstRowRangeEndIter ); + OSL_ASSERT( bHasOwnData || aColumnDescriptions_RangeIter == aColumnDescriptions_RangeEnd ); } // closing row and header-rows elements - // value rows + // export value rows { SvXMLElementExport aRows( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROWS, sal_True, sal_True ); - lcl_TableData::tStringContainer::const_iterator aFirstColIt( aData.aFirstColumnStrings.begin()); - for( lcl_TableData::tTwoDimNumberContainer::const_iterator aColIt( aData.aDataInRows.begin()); - aColIt != aData.aDataInRows.end(); ++aColIt ) + tStringVector::const_iterator aRowDescriptionsIter( aData.aRowDescriptions.begin()); + const Sequence< Sequence< OUString > >& rComplexRowDescriptions = aData.aComplexRowDescriptions; + sal_Int32 nComplexCount = rComplexRowDescriptions.getLength(); + sal_Int32 nC = 0; + + for( t2DNumberContainer::const_iterator aRowIt( aData.aDataInRows.begin()); + aRowIt != aData.aDataInRows.end(); ++aRowIt ) { SvXMLElementExport aRow( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True ); + + //export row descriptions { mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); - if( aFirstColIt != aData.aFirstColumnStrings.end()) + if( aRowDescriptionsIter != aData.aRowDescriptions.end()) { // write the original range name as id into the local table // to allow a correct re-association when copying via clipboard - if( !bHasOwnData && aFirstColumnRangeIter != aFirstColumnRangeEndIter ) - mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aFirstColumnRangeIter++ ); - exportText( *aFirstColIt ); - ++aFirstColIt; + if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd ) + mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aRowDescriptions_RangeIter++ ); + exportText( *aRowDescriptionsIter ); + ++aRowDescriptionsIter; + if( nC < nComplexCount ) + lcl_exportComplexLabel( rComplexRowDescriptions[nC++], mrExport ); } } - for( lcl_TableData::tTwoDimNumberContainer::value_type::const_iterator aInnerIt( aColIt->begin()); - aInnerIt != aColIt->end(); ++aInnerIt ) + + //export row values + for( t2DNumberContainer::value_type::const_iterator aColIt( aRowIt->begin()); + aColIt != aRowIt->end(); ++aColIt ) { - SvXMLUnitConverter::convertDouble( msStringBuffer, *aInnerIt ); + SvXMLUnitConverter::convertDouble( msStringBuffer, *aColIt ); msString = msStringBuffer.makeStringAndClear(); mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT ); mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString ); @@ -1574,7 +1573,7 @@ void SchXMLExportHelper::exportTable() // write the original range name as id into the local table to // allow a correct re-association when copying via clipboard if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) && - ( mbRowSourceColumns || (aInnerIt == aColIt->begin())) ) + ( mbRowSourceColumns || (aColIt == aRowIt->begin())) ) { if( (*aDataRangeIter).getLength()) mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aDataRangeIter ); @@ -1587,7 +1586,7 @@ void SchXMLExportHelper::exportTable() // if range iterator was used it should have reached its end OSL_ASSERT( bHasOwnData || (aDataRangeIter == aDataRangeEndIter) ); - OSL_ASSERT( bHasOwnData || (aFirstColumnRangeIter == aFirstColumnRangeEndIter) ); + OSL_ASSERT( bHasOwnData || (aRowDescriptions_RangeIter == aRowDescriptions_RangeEnd) ); } void SchXMLExportHelper::exportPlotArea( @@ -2112,8 +2111,8 @@ void SchXMLExportHelper::exportAxes( if( xValues.is()) { Reference< chart2::XChartDocument > xNewDoc( mrExport.GetModel(), uno::UNO_QUERY ); - aCategoriesRange = lcl_ConvertRange( xValues->getSourceRangeRepresentation(), xNewDoc ); - m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, xValues )); + maCategoriesRange = xValues->getSourceRangeRepresentation(); + aCategoriesRange = lcl_ConvertRange( maCategoriesRange, xNewDoc ); } } } @@ -3422,24 +3421,6 @@ awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocume return aSize; } -void SchXMLExportHelper::swapDataArray( Sequence< Sequence< double > >& rSequence ) -{ - sal_Int32 nOuterSize = rSequence.getLength(); - sal_Int32 nInnerSize = rSequence[0].getLength(); // assume that all subsequences have same length - sal_Int32 i, o; - - Sequence< Sequence< double > > aResult( nInnerSize ); - Sequence< double >* pArray = aResult.getArray(); - for( i = 0; i < nInnerSize; i++ ) - { - pArray[ i ].realloc( nOuterSize ); - for( o = 0 ; o < nOuterSize ; o++ ) - aResult[ i ][ o ] = rSequence[ o ][ i ]; - } - - rSequence = aResult; -} - void SchXMLExportHelper::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates ) { if( !aStates.empty() ) diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 4f32e90e861f..6afbaecb551c 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -47,7 +47,6 @@ #include <xmloff/xmlstyle.hxx> #include <com/sun/star/task/XStatusIndicatorSupplier.hpp> #include <com/sun/star/chart/XChartDocument.hpp> -#include <com/sun/star/chart/XChartDataArray.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -507,113 +506,6 @@ const SvXMLTokenMap& SchXMLImportHelper::GetRegEquationAttrTokenMap() // ---------------------------------------- -sal_Int32 SchXMLImportHelper::GetNumberOfSeries() -{ - if( mxChartDoc.is()) - { - Reference< chart::XChartDataArray > xData( mxChartDoc->getData(), uno::UNO_QUERY ); - if( xData.is()) - { - Sequence< Sequence< double > > xArray = xData->getData(); - - if( xArray.getLength()) - return xArray[ 0 ].getLength(); - } - } - - return 0; -} - -sal_Int32 SchXMLImportHelper::GetLengthOfSeries() -{ - if( mxChartDoc.is()) - { - Reference< chart::XChartDataArray > xData( mxChartDoc->getData(), uno::UNO_QUERY ); - if( xData.is()) - { - Sequence< Sequence< double > > xArray = xData->getData(); - - return xArray.getLength(); - } - } - - return 0; -} - -// -1 means don't change -void SchXMLImportHelper::ResizeChartData( sal_Int32 nSeries, sal_Int32 nDataPoints ) -{ - if( mxChartDoc.is()) - { - sal_Bool bWasChanged = sal_False; - - sal_Bool bDataInColumns = sal_True; - Reference< beans::XPropertySet > xDiaProp( mxChartDoc->getDiagram(), uno::UNO_QUERY ); - if( xDiaProp.is()) - { - chart::ChartDataRowSource eRowSource; - xDiaProp->getPropertyValue( OUString::createFromAscii( "DataRowSource" )) >>= eRowSource; - bDataInColumns = ( eRowSource == chart::ChartDataRowSource_COLUMNS ); - - // the chart core treats donut chart with interchanged rows/columns - Reference< chart::XDiagram > xDiagram( xDiaProp, uno::UNO_QUERY ); - if( xDiagram.is()) - { - OUString sChartType = xDiagram->getDiagramType(); - if( 0 == sChartType.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart.DonutDiagram" ))) - { - bDataInColumns = ! bDataInColumns; - } - } - } - sal_Int32 nColCount = bDataInColumns ? nSeries : nDataPoints; - sal_Int32 nRowCount = bDataInColumns ? nDataPoints : nSeries; - - Reference< chart::XChartDataArray > xData( mxChartDoc->getData(), uno::UNO_QUERY ); - if( xData.is()) - { - Sequence< Sequence< double > > xArray = xData->getData(); - - // increase number of rows - if( xArray.getLength() < nRowCount ) - { - sal_Int32 nOldLen = xArray.getLength(); - xArray.realloc( nRowCount ); - if( nColCount == -1 ) - { - sal_Int32 nSize = xArray[ 0 ].getLength(); - for( sal_Int32 i = nOldLen; i < nRowCount; i++ ) - xArray[ i ].realloc( nSize ); - } - bWasChanged = sal_True; - } - - if( nSeries == -1 && - nRowCount > 0 ) - nColCount = xArray[ 0 ].getLength(); - - // columns - if( nColCount > 0 && - xArray[ 0 ].getLength() < nColCount ) - { - if( nDataPoints == -1 ) - nRowCount = xArray.getLength(); - - for( sal_Int32 i = 0; i < nRowCount; i++ ) - xArray[ i ].realloc( nColCount ); - bWasChanged = sal_True; - } - - if( bWasChanged ) - { - xData->setData( xArray ); - mxChartDoc->attachData( - Reference< chart::XChartData >( xData, uno::UNO_QUERY )); - } - } - } -} - //static void SchXMLImportHelper::DeleteDataSeries( const Reference< chart2::XDataSeries > & xSeries, diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 742d42cb5f15..6ba9a49e4502 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -30,6 +30,7 @@ #include "SchXMLTableContext.hxx" #include "SchXMLParagraphContext.hxx" +#include "SchXMLTextListContext.hxx" #include "SchXMLImport.hxx" #include "SchXMLTools.hxx" #include "transporttypes.hxx" @@ -44,7 +45,7 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XInternalDataProvider.hpp> -#include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> #include <com/sun/star/chart/ChartSeriesAddress.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> @@ -138,26 +139,10 @@ std::vector< Reference< chart2::XAxis > > lcl_getAxesHoldingCategoriesFromDiagra return aRet; } -void lcl_ApplyColumnLabels( - const ::std::vector< SchXMLCell > & rFirstRow, - Sequence< OUString > & rOutColumnLabels, - sal_Int32 nOffset ) -{ - const sal_Int32 nColumnLabelsSize = rOutColumnLabels.getLength(); - const sal_Int32 nMax = ::std::min< sal_Int32 >( nColumnLabelsSize, - static_cast< sal_Int32 >( rFirstRow.size()) - nOffset ); - OSL_ASSERT( nMax == nColumnLabelsSize ); - for( sal_Int32 i=0; i<nMax; ++i ) - if( rFirstRow[i+nOffset].eType == SCH_CELL_TYPE_STRING ) - rOutColumnLabels[i] = rFirstRow[i+nOffset].aString; -} - struct lcl_ApplyCellToData : public ::std::unary_function< SchXMLCell, void > { - lcl_ApplyCellToData( Sequence< double > & rOutData, - Sequence< OUString > & rOutRowLabels ) : + lcl_ApplyCellToData( Sequence< double > & rOutData ) : m_rData( rOutData ), - m_rRowLabels( rOutRowLabels ), m_nIndex( 0 ), m_nSize( rOutData.getLength()) { @@ -178,49 +163,11 @@ struct lcl_ApplyCellToData : public ::std::unary_function< SchXMLCell, void > private: Sequence< double > & m_rData; - Sequence< OUString > & m_rRowLabels; sal_Int32 m_nIndex; sal_Int32 m_nSize; double m_fNaN; }; -struct lcl_ApplyRowsToData : public ::std::unary_function< ::std::vector< SchXMLCell >, void > -{ - lcl_ApplyRowsToData( Sequence< Sequence< double > > & rOutData, - Sequence< OUString > & rOutRowLabels, - sal_Int32 nOffset, - bool bHasHeader ) : - m_rData( rOutData ), - m_rRowLabels( rOutRowLabels ), - m_nIndex( 0 ), - m_nOuterSize( rOutData.getLength()), - m_nOffset( nOffset ), - m_bHasHeader( bHasHeader ) - {} - void operator() ( const ::std::vector< SchXMLCell > & rRow ) - { - if( ! rRow.empty()) - { - // label - if( m_bHasHeader && m_nIndex < m_rRowLabels.getLength() && rRow.front().eType == SCH_CELL_TYPE_STRING ) - m_rRowLabels[m_nIndex] = rRow.front().aString; - - // values - if( m_nIndex < m_nOuterSize ) - ::std::for_each( rRow.begin() + m_nOffset, rRow.end(), lcl_ApplyCellToData( m_rData[m_nIndex], m_rRowLabels )); - } - ++m_nIndex; - } - -private: - Sequence< Sequence< double > > & m_rData; - Sequence< OUString > & m_rRowLabels; - sal_Int32 m_nIndex; - sal_Int32 m_nOuterSize; - sal_Int32 m_nOffset; - bool m_bHasHeader; -}; - Sequence< Sequence< double > > lcl_getSwappedArray( const Sequence< Sequence< double > > & rData ) { sal_Int32 nOldOuterSize = rData.getLength(); @@ -237,47 +184,6 @@ Sequence< Sequence< double > > lcl_getSwappedArray( const Sequence< Sequence< do return aResult; } -void lcl_applyXMLTableToInternalDataprovider( - const SchXMLTable & rTable, - const Reference< chart::XChartDataArray > & xDataArray ) -{ - sal_Int32 nNumRows( static_cast< sal_Int32 >( rTable.aData.size())); - sal_Int32 nRowOffset = 0; - if( rTable.bHasHeaderRow ) - { - --nNumRows; - nRowOffset = 1; - } - sal_Int32 nNumColumns( rTable.nMaxColumnIndex + 1 ); - sal_Int32 nColOffset = 0; - if( rTable.bHasHeaderColumn ) - { - --nNumColumns; - nColOffset = 1; - } - - Sequence< Sequence< double > > aData( nNumRows ); - Sequence< OUString > aRowLabels( nNumRows ); - Sequence< OUString > aColumnLabels( nNumColumns ); - for( sal_Int32 i=0; i<nNumRows; ++i ) - aData[i].realloc( nNumColumns ); - - if( rTable.aData.begin() != rTable.aData.end()) - { - if( rTable.bHasHeaderRow ) - lcl_ApplyColumnLabels( rTable.aData.front(), aColumnLabels, nColOffset ); - ::std::for_each( rTable.aData.begin() + nRowOffset, rTable.aData.end(), - lcl_ApplyRowsToData( aData, aRowLabels, nColOffset, rTable.bHasHeaderColumn )); - } - - xDataArray->setData( aData ); - - if( rTable.bHasHeaderColumn ) - xDataArray->setRowDescriptions( aRowLabels ); - if( rTable.bHasHeaderRow ) - xDataArray->setColumnDescriptions( aColumnLabels ); -} - void lcl_fillRangeMapping( const SchXMLTable & rTable, lcl_tOriginalRangeToInternalRangeMap & rOutRangeMap, @@ -830,7 +736,7 @@ void SchXMLTableCellContext::StartElement( const uno::Reference< xml::sax::XAttr } } - mbReadPara = sal_True; + mbReadText = sal_True; SchXMLCell aCell; aCell.eType = eValueType; @@ -841,8 +747,8 @@ void SchXMLTableCellContext::StartElement( const uno::Reference< xml::sax::XAttr SvXMLUnitConverter::convertDouble( fData, aCellContent ); aCell.fValue = fData; - // dont read following <text:p> element - mbReadPara = sal_False; + // dont read text from following <text:p> or <text:list> element + mbReadText = sal_False; } mrTable.aData[ mrTable.nRowIndex ].push_back( aCell ); @@ -858,9 +764,17 @@ SvXMLImportContext* SchXMLTableCellContext::CreateChildContext( { SvXMLImportContext* pContext = 0; - // <text:p> element - if( nPrefix == XML_NAMESPACE_TEXT && - IsXMLToken( rLocalName, XML_P ) ) + // <text:list> element + if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_LIST ) && mbReadText ) + { + SchXMLCell& rCell = mrTable.aData[ mrTable.nRowIndex ][ mrTable.nColumnIndex ]; + rCell.pComplexString = new Sequence< OUString >(); + rCell.eType = SCH_CELL_TYPE_COMPLEX_STRING; + pContext = new SchXMLTextListContext( GetImport(), rLocalName, *rCell.pComplexString ); + mbReadText = sal_False;//don't apply text from <text:p> + } + // <text:p> element - read text and range-id + else if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) ) { pContext = new SchXMLParagraphContext( GetImport(), rLocalName, maCellContent, &maRangeId ); } @@ -874,7 +788,7 @@ SvXMLImportContext* SchXMLTableCellContext::CreateChildContext( void SchXMLTableCellContext::EndElement() { - if( mbReadPara && maCellContent.getLength()) + if( mbReadText && maCellContent.getLength() ) //apply text from <text:p> element mrTable.aData[ mrTable.nRowIndex ][ mrTable.nColumnIndex ].aString = maCellContent; if( maRangeId.getLength()) mrTable.aData[ mrTable.nRowIndex ][ mrTable.nColumnIndex ].aRangeId = maRangeId; @@ -882,133 +796,90 @@ void SchXMLTableCellContext::EndElement() // ======================================== -// just interpret the table in a linear way with no references used -// (this is just a workaround for clipboard handling in EA2) -void SchXMLTableHelper::applyTableSimple( - const SchXMLTable& rTable, - const uno::Reference< chart::XChartDataArray > & xData ) +void lcl_ApplyCellToComplexLabel( const SchXMLCell& rCell, Sequence< OUString >& rComplexLabel ) { - // interpret table like this: - // - // series ----+---+ - // | | - // categories | | - // | | | - // V V V - // A B C ... - // 1 x x <--- labels - // 2 x 0 0 - // 3 x 0 0 - // ... - - // Standard Role-interpretation: - - // Column 1 contains the Categories - - // Chart Type/Class | Col 2 Col 3 Col 4 Col 5 Col 6 | Series | Domain - // -----------------+-----------------------------------+--------+------- - // Category Charts | Y 1 Y 2 Y 3 Y 4 ... | Y | - - // XY Chart | X all Y 1 Y 2 Y 3 ... | Y | X - // Stock Chart 1 | Min Max Close - - | Close | - - // Stock Chart 2 | Open Min Max Close - | Close | - - // Stock Chart 3 | Volume Min Max Close - | Close | - - // Stock Chart 4 | Volume Open Min Max Close | Close | - - - if( xData.is()) + if( rCell.eType == SCH_CELL_TYPE_STRING ) { - // get NaN - double fSolarNaN; - ::rtl::math::setNan( &fSolarNaN ); - double fNaN = fSolarNaN; - sal_Bool bConvertNaN = sal_False; - - uno::Reference< chart::XChartData > xChartData( xData, uno::UNO_QUERY ); - if( xChartData.is()) - { - fNaN = xChartData->getNotANumber(); - bConvertNaN = ( ! ::rtl::math::isNan( fNaN )); - } + rComplexLabel.realloc(1); + rComplexLabel[0] = rCell.aString; + } + else if( rCell.pComplexString && rCell.eType == SCH_CELL_TYPE_COMPLEX_STRING ) + rComplexLabel = *rCell.pComplexString; +} - sal_Int32 nRowCount = rTable.aData.size(); - sal_Int32 nColumnCount = 0; - sal_Int32 nCol = 0, nRow = 0; - if( nRowCount ) - { - nColumnCount = rTable.aData[ 0 ].size(); - ::std::vector< ::std::vector< SchXMLCell > >::const_iterator iRow = rTable.aData.begin(); - while( iRow != rTable.aData.end() ) - { - nColumnCount = ::std::max( nColumnCount, static_cast<sal_Int32>(iRow->size()) ); - iRow++; - } - } +void SchXMLTableHelper::applyTableToInternalDataProvider( + const SchXMLTable& rTable, + uno::Reference< chart2::XChartDocument > xChartDoc ) +{ + // apply all data read from the local table to the internal data provider + if( !xChartDoc.is() || !xChartDoc->hasInternalDataProvider() ) + return; + Reference< chart2::data::XDataProvider > xDataProv( xChartDoc->getDataProvider() ); + if( !xDataProv.is() ) + return; - // #i27909# avoid illegal index access for empty tables - if( nColumnCount == 0 || nRowCount == 0 ) - return; + //prepare the read local table data + sal_Int32 nNumRows( static_cast< sal_Int32 >( rTable.aData.size())); + sal_Int32 nRowOffset = 0; + if( rTable.bHasHeaderRow ) + { + --nNumRows; + nRowOffset = 1; + } + sal_Int32 nNumColumns( rTable.nMaxColumnIndex + 1 ); + sal_Int32 nColOffset = 0; + if( rTable.bHasHeaderColumn ) + { + --nNumColumns; + nColOffset = 1; + } - uno::Sequence< ::rtl::OUString > aCategories( nRowCount - 1 ); - uno::Sequence< ::rtl::OUString > aLabels( nColumnCount - 1 ); - uno::Sequence< uno::Sequence< double > > aData( nRowCount - 1 ); - for( nRow = 0; nRow < nRowCount - 1; nRow++ ) - aData[ nRow ].realloc( nColumnCount - 1 ); + Sequence< Sequence< double > > aDataInRows( nNumRows ); + Sequence< Sequence< OUString > > aComplexRowDescriptions( nNumRows ); + Sequence< Sequence< OUString > > aComplexColumnDescriptions( nNumColumns ); + for( sal_Int32 i=0; i<nNumRows; ++i ) + aDataInRows[i].realloc( nNumColumns ); - // set labels - ::std::vector< ::std::vector< SchXMLCell > >::const_iterator iRow = rTable.aData.begin(); - sal_Int32 nColumnCountOnFirstRow = iRow->size(); - for( nCol = 1; nCol < nColumnCountOnFirstRow; nCol++ ) + if( rTable.aData.begin() != rTable.aData.end()) + { + //apply column labels + if( rTable.bHasHeaderRow ) { - aLabels[ nCol - 1 ] = (*iRow)[ nCol ].aString; + const ::std::vector< SchXMLCell >& rFirstRow = rTable.aData.front(); + const sal_Int32 nColumnLabelsSize = aComplexColumnDescriptions.getLength(); + const sal_Int32 nMax = ::std::min< sal_Int32 >( nColumnLabelsSize, static_cast< sal_Int32 >( rFirstRow.size()) - nColOffset ); + OSL_ASSERT( nMax == nColumnLabelsSize ); + for( sal_Int32 i=0; i<nMax; ++i ) + lcl_ApplyCellToComplexLabel( rFirstRow[i+nColOffset], aComplexColumnDescriptions[i] ); } - xData->setColumnDescriptions( aLabels ); - double fVal; - const sal_Bool bConstConvertNan = bConvertNaN; - for( ++iRow, nRow = 0; iRow != rTable.aData.end(); iRow++, nRow++ ) + std::vector< ::std::vector< SchXMLCell > >::const_iterator aRowIter( rTable.aData.begin() + nRowOffset ); + std::vector< ::std::vector< SchXMLCell > >::const_iterator aEnd( rTable.aData.end() ); + for( sal_Int32 nRow = 0; aRowIter != aEnd && nRow < nNumRows; ++aRowIter, ++nRow ) { - aCategories[ nRow ] = (*iRow)[ 0 ].aString; - sal_Int32 nTableColCount( static_cast< sal_Int32 >((*iRow).size())); - for( nCol = 1; nCol < nTableColCount; nCol++ ) + const ::std::vector< SchXMLCell >& rRow = *aRowIter; + if( !rRow.empty() ) { - fVal = (*iRow)[ nCol ].fValue; - if( bConstConvertNan && - ::rtl::math::isNan( fVal )) - aData[ nRow ][ nCol - 1 ] = fNaN; - else - aData[ nRow ][ nCol - 1 ] = fVal; + // row label + if( rTable.bHasHeaderColumn ) + lcl_ApplyCellToComplexLabel( rRow.front(), aComplexRowDescriptions[nRow] ); + + // values + ::std::for_each( rRow.begin() + nColOffset, rRow.end(), lcl_ApplyCellToData( aDataInRows[nRow] )); } - // set remaining cells to NaN - for( ; nCol < nColumnCount; ++nCol ) - if( bConstConvertNan ) - aData[ nRow ][nCol - 1 ] = fNaN; - else - ::rtl::math::setNan( &(aData[ nRow ][nCol - 1 ])); } - xData->setRowDescriptions( aCategories ); - xData->setData( aData ); } -} -// ---------------------------------------- - -void SchXMLTableHelper::applyTableToInternalDataProvider( - const SchXMLTable& rTable, - uno::Reference< chart2::XChartDocument > xChartDoc ) -{ - if( ! (xChartDoc.is() && xChartDoc->hasInternalDataProvider())) - return; - Reference< chart2::data::XDataProvider > xDataProv( xChartDoc->getDataProvider()); - Reference< chart::XChartDataArray > xDataArray( xDataProv, uno::UNO_QUERY ); - if( ! xDataArray.is()) + //apply the collected data to the chart + Reference< chart::XComplexDescriptionAccess > xDataAccess( xDataProv, uno::UNO_QUERY ); + if( !xDataAccess.is() ) return; - OSL_ASSERT( xDataProv.is()); - // prerequisite for this method: all objects (data series, domains, etc.) - // need their own range string. - - // apply all data read in the table to the chart data-array of the internal - // data provider - lcl_applyXMLTableToInternalDataprovider( rTable, xDataArray ); + xDataAccess->setData( aDataInRows ); + if( rTable.bHasHeaderColumn ) + xDataAccess->setComplexRowDescriptions( aComplexRowDescriptions ); + if( rTable.bHasHeaderRow ) + xDataAccess->setComplexColumnDescriptions( aComplexColumnDescriptions ); } void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( diff --git a/xmloff/source/chart/SchXMLTableContext.hxx b/xmloff/source/chart/SchXMLTableContext.hxx index e6c8ef61ac28..717628b18de0 100644 --- a/xmloff/source/chart/SchXMLTableContext.hxx +++ b/xmloff/source/chart/SchXMLTableContext.hxx @@ -45,7 +45,6 @@ namespace com { namespace sun { namespace star { }} namespace chart { class XChartDocument; - class XChartDataArray; struct ChartSeriesAddress; }}}} @@ -96,21 +95,11 @@ private: sal_Int32& nRows, sal_Int32& nColumns ); public: - /// The data for the ChartDocument is applied linearly - static void applyTableSimple( - const SchXMLTable& rTable, - const com::sun::star::uno::Reference< com::sun::star::chart::XChartDataArray > & xData ); - - /** The data for the ChartDocument is applied by reading the - table, the addresses of series, the addresses of labels, - the cell-range-address for the categories - */ static void applyTableToInternalDataProvider( const SchXMLTable& rTable, com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > xChartDoc ); - /** Second part of applyTableToInternalDataProvider that has to be called after the data series - got their styles set. This function reorders local data to fit the - correct data structure. + /** This function reorders local data to fit the correct data structure. + Call it after the data series got their styles set. */ static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable& rTable, const tSchXMLLSequencesPerIndex & rLSequencesPerIndex, @@ -220,7 +209,7 @@ private: SchXMLTable& mrTable; rtl::OUString maCellContent; rtl::OUString maRangeId; - sal_Bool mbReadPara; + sal_Bool mbReadText; public: SchXMLTableCellContext( SchXMLImportHelper& rImpHelper, diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx new file mode 100644 index 000000000000..884acb473108 --- /dev/null +++ b/xmloff/source/chart/SchXMLTextListContext.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" + +#include "SchXMLImport.hxx" +#include "SchXMLTextListContext.hxx" +#include "SchXMLParagraphContext.hxx" + +#include "xmlnmspe.hxx" +#include <xmloff/xmltoken.hxx> +#include <xmloff/nmspmap.hxx> + +using ::rtl::OUString; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Reference; +using namespace com::sun::star; +using namespace ::xmloff::token; + +//------------------------------------------------- +class SchXMLListItemContext : public SvXMLImportContext +{ +public: + SchXMLListItemContext( SvXMLImport& rImport, const OUString& rLocalName, OUString& rText ); + virtual ~SchXMLListItemContext(); + virtual void StartElement( const Reference< xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); + + virtual SvXMLImportContext* CreateChildContext( + USHORT nPrefix, + const ::rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ); + +private: + ::rtl::OUString& m_rText; +}; + +SchXMLListItemContext::SchXMLListItemContext( + SvXMLImport& rImport + , const OUString& rLocalName + , OUString& rText ) + : SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ) + , m_rText( rText ) +{ +} + +SchXMLListItemContext::~SchXMLListItemContext() +{} + +void SchXMLListItemContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ ) +{ +} + +void SchXMLListItemContext::EndElement() +{ +} + +SvXMLImportContext* SchXMLListItemContext::CreateChildContext( + USHORT nPrefix, const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList >& ) +{ + SvXMLImportContext* pContext = 0; + if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) ) + pContext = new SchXMLParagraphContext( GetImport(), rLocalName, m_rText ); + else + pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); + return pContext; +} + +//------------------------------------------------- + +SchXMLTextListContext::SchXMLTextListContext( + SvXMLImport& rImport + , const OUString& rLocalName + , Sequence< OUString>& rTextList ) + : SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ) + , m_rTextList( rTextList ) + , m_aTextVector() +{ +} + +SchXMLTextListContext::~SchXMLTextListContext() +{ +} + +void SchXMLTextListContext::StartElement( const Reference< xml::sax::XAttributeList >& /*xAttrList*/ ) +{ +} + +void SchXMLTextListContext::EndElement() +{ + sal_Int32 nCount = m_aTextVector.size(); + m_rTextList.realloc(nCount); + for( sal_Int32 nN=0; nN<nCount; nN++ ) + m_rTextList[nN]=m_aTextVector[nN]; +} + +SvXMLImportContext* SchXMLTextListContext::CreateChildContext( + USHORT nPrefix, const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList >& ) +{ + SvXMLImportContext* pContext = 0; + if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_LIST_ITEM ) ) + { + m_aTextVector.push_back( OUString() ); + pContext = new SchXMLListItemContext( GetImport(), rLocalName, m_aTextVector.back() ); + } + else + pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); + return pContext; +} diff --git a/sfx2/sdi/mdislots.sdi b/xmloff/source/chart/SchXMLTextListContext.hxx index 2759f6bcd4d8..736331d10e71 100644 --- a/sfx2/sdi/mdislots.sdi +++ b/xmloff/source/chart/SchXMLTextListContext.hxx @@ -24,21 +24,35 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#ifndef _SCH_XMLTEXTLISTCONTEXT_HXX_ +#define _SCH_XMLTEXTLISTCONTEXT_HXX_ -shell SfxTopViewFrame : SfxViewFrame +#include <xmloff/xmlictxt.hxx> +#include "rtl/ustring.hxx" +#include <vector> + +namespace com { namespace sun { namespace star { namespace xml { namespace sax { + class XAttributeList; +}}}}} + +class SchXMLTextListContext : public SvXMLImportContext { - import TopWindow [Automation]; +public: + SchXMLTextListContext( SvXMLImport& rImport, + const ::rtl::OUString& rLocalName, + ::com::sun::star::uno::Sequence< ::rtl::OUString>& rTextList ); + virtual ~SchXMLTextListContext(); + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); - SID_ACTIVATE // ole(no) api(final/play/rec) - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] + virtual SvXMLImportContext* CreateChildContext( + USHORT nPrefix, + const ::rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ); - SID_SHOWPOPUPS - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] -} +private: + ::com::sun::star::uno::Sequence< ::rtl::OUString>& m_rTextList; + std::vector< ::rtl::OUString> m_aTextVector; +}; +#endif // _SCH_XMLTEXTLISTCONTEXT_HXX_ diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx index 14928b697a1b..8d9ba3b7ff26 100644 --- a/xmloff/source/chart/contexts.cxx +++ b/xmloff/source/chart/contexts.cxx @@ -35,13 +35,6 @@ #include "SchXMLImport.hxx" #include "SchXMLCalculationSettingsContext.hxx" -// #ifndef _XMLOFF_XMLCHARTSTYLECONTEXT_HXX_ -// #include "XMLChartStyleContext.hxx" -// #endif -#include <com/sun/star/chart/XChartDocument.hpp> -#include <com/sun/star/chart/XChartDataArray.hpp> -#include <com/sun/star/chart/ChartDataRowSource.hpp> - #include "contexts.hxx" #include "SchXMLChartContext.hxx" diff --git a/xmloff/source/chart/makefile.mk b/xmloff/source/chart/makefile.mk index 33c217e51326..bfdc9aeb5e22 100644 --- a/xmloff/source/chart/makefile.mk +++ b/xmloff/source/chart/makefile.mk @@ -47,6 +47,7 @@ SLOFILES = $(SLO)$/ColorPropertySet.obj \ $(SLO)$/SchXMLChartContext.obj \ $(SLO)$/SchXMLPlotAreaContext.obj \ $(SLO)$/SchXMLParagraphContext.obj \ + $(SLO)$/SchXMLTextListContext.obj \ $(SLO)$/SchXMLSeriesHelper.obj \ $(SLO)$/SchXMLSeries2Context.obj \ $(SLO)$/PropertyMaps.obj \ diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx index 213f97590c9d..27c8850e2b81 100644 --- a/xmloff/source/chart/transporttypes.hxx +++ b/xmloff/source/chart/transporttypes.hxx @@ -37,17 +37,37 @@ enum SchXMLCellType { SCH_CELL_TYPE_UNKNOWN, SCH_CELL_TYPE_FLOAT, - SCH_CELL_TYPE_STRING + SCH_CELL_TYPE_STRING, + SCH_CELL_TYPE_COMPLEX_STRING }; struct SchXMLCell { rtl::OUString aString; + ::com::sun::star::uno::Sequence< rtl::OUString >* pComplexString; double fValue; SchXMLCellType eType; rtl::OUString aRangeId; - SchXMLCell() : fValue( 0.0 ), eType( SCH_CELL_TYPE_UNKNOWN ) {} + SchXMLCell() : pComplexString(0), fValue( 0.0 ), eType( SCH_CELL_TYPE_UNKNOWN ) + {} + + SchXMLCell( const SchXMLCell& rOther ) + : aString( rOther.aString ) + , pComplexString( rOther.pComplexString ? new ::com::sun::star::uno::Sequence< rtl::OUString >( *rOther.pComplexString ) : 0 ) + , fValue( rOther.fValue ) + , eType( rOther.eType ) + , aRangeId( rOther.aRangeId ) + {} + + ~SchXMLCell() + { + if(pComplexString) + { + delete pComplexString; + pComplexString=0; + } + } }; struct SchXMLTable diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx index e2b3efeefb4f..48e3dc92b61d 100644 --- a/xmloff/source/core/SettingsExportHelper.cxx +++ b/xmloff/source/core/SettingsExportHelper.cxx @@ -32,32 +32,27 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/xmluconv.hxx> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <comphelper/extract.hxx> -// #110680# -//#ifndef _COMPHELPER_PROCESSFACTORYHXX_ -//#include <comphelper/processfactory.hxx> -//#endif #include <com/sun/star/linguistic2/XSupportedLocales.hpp> #include <com/sun/star/i18n/XForbiddenCharacters.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#ifndef _COM_SUN_STAR_CONTAINER_XIndexCONTAINER_HPP_ #include <com/sun/star/container/XIndexContainer.hpp> -#endif #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/formula/SymbolDescriptor.hpp> #include <com/sun/star/document/PrinterIndependentLayout.hpp> -#include <xmloff/nmspmap.hxx> +#include <xmloff/XMLSettingsExportContext.hxx> #include <xmlenums.hxx> using namespace ::com::sun::star; using namespace ::xmloff::token; -XMLSettingsExportHelper::XMLSettingsExportHelper(SvXMLExport& rTempExport) -: rExport(rTempExport) +XMLSettingsExportHelper::XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext ) +: m_rContext( i_rContext ) , msPrinterIndependentLayout( RTL_CONSTASCII_USTRINGPARAM( "PrinterIndependentLayout" ) ) , msColorTableURL( RTL_CONSTASCII_USTRINGPARAM( "ColorTableURL" ) ) , msLineEndTableURL( RTL_CONSTASCII_USTRINGPARAM( "LineEndTableURL" ) ) @@ -194,89 +189,97 @@ void XMLSettingsExportHelper::CallTypeFunction(const uno::Any& rAny, void XMLSettingsExportHelper::exportBool(const sal_Bool bValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BOOLEAN); - SvXMLElementExport aBoolElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_BOOLEAN ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUString sValue; if (bValue) sValue = GetXMLToken(XML_TRUE); else sValue = GetXMLToken(XML_FALSE); - rExport.GetDocHandler()->characters(sValue); + m_rContext.Characters( sValue ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportByte(const sal_Int8 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BYTE); - SvXMLElementExport aShortElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_BYTE ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue)); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportShort(const sal_Int16 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_SHORT); - SvXMLElementExport aShortElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_SHORT ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue)); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportInt(const sal_Int32 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_INT); - SvXMLElementExport aIntElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_INT ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertNumber(sBuffer, nValue); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportLong(const sal_Int64 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_LONG); - SvXMLElementExport aIntElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_LONG ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUString sValue(rtl::OUString::valueOf(nValue)); - rExport.GetDocHandler()->characters(sValue); + m_rContext.Characters( sValue ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportDouble(const double fValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_DOUBLE); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_DOUBLE ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertDouble(sBuffer, fValue); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportString(const rtl::OUString& sValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_STRING); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_STRING ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); if (sValue.getLength()) - rExport.GetDocHandler()->characters(sValue); + m_rContext.Characters( sValue ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportDateTime(const util::DateTime& aValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_DATETIME); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_DATETIME ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertDateTime(sBuffer, aValue); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportSequencePropertyValue( @@ -287,10 +290,11 @@ void XMLSettingsExportHelper::exportSequencePropertyValue( sal_Int32 nLength(aProps.getLength()); if(nLength) { - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aSequenceElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_SET, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_SET, sal_True ); for (sal_Int32 i = 0; i < nLength; i++) CallTypeFunction(aProps[i].Value, aProps[i].Name); + m_rContext.EndElement( sal_True ); } } void XMLSettingsExportHelper::exportSymbolDescriptors( @@ -299,7 +303,7 @@ void XMLSettingsExportHelper::exportSymbolDescriptors( { // #110680# // uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory( rExport.getServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() ); DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportSymbolDescriptors: got no service manager" ); if( xServiceFactory.is() ) @@ -362,15 +366,16 @@ void XMLSettingsExportHelper::exportbase64Binary( { DBG_ASSERT(rName.getLength(), "no name"); sal_Int32 nLength(aProps.getLength()); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BASE64BINARY); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_BASE64BINARY ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); if(nLength) { rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::encodeBase64(sBuffer, aProps); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); } + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny, @@ -384,10 +389,11 @@ void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny, if (nLength) { if (bNameAccess) - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aEntryElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_ENTRY, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_MAP_ENTRY, sal_True ); for (sal_Int32 i = 0; i < nLength; i++) CallTypeFunction(aProps[i].Value, aProps[i].Name); + m_rContext.EndElement( sal_True ); } } @@ -400,11 +406,12 @@ void XMLSettingsExportHelper::exportNameAccess( "wrong NameAccess" ); if(aNamed->hasElements()) { - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aNamedElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_NAMED, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_MAP_NAMED, sal_True ); uno::Sequence< rtl::OUString > aNames(aNamed->getElementNames()); for (sal_Int32 i = 0; i < aNames.getLength(); i++) exportMapEntry(aNamed->getByName(aNames[i]), aNames[i], sal_True); + m_rContext.EndElement( sal_True ); } } @@ -414,17 +421,18 @@ void XMLSettingsExportHelper::exportIndexAccess( { DBG_ASSERT(rName.getLength(), "no name"); DBG_ASSERT(aIndexed->getElementType().equals(getCppuType( (uno::Sequence<beans::PropertyValue> *)0 ) ), - "wrong NameAccess" ); + "wrong IndexAccess" ); rtl::OUString sEmpty;// ( RTLCONSTASCII_USTRINGPARAM( "View" ) ); if(aIndexed->hasElements()) { - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aIndexedElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_INDEXED, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_MAP_INDEXED, sal_True ); sal_Int32 nCount = aIndexed->getCount(); for (sal_Int32 i = 0; i < nCount; i++) { exportMapEntry(aIndexed->getByIndex(i), sEmpty, sal_False); } + m_rContext.EndElement( sal_True ); } } @@ -445,7 +453,7 @@ void XMLSettingsExportHelper::exportForbiddenCharacters( // #110680# // uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory( rExport.getServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() ); DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportForbiddenCharacters: got no service manager" ); if( xServiceFactory.is() ) @@ -496,14 +504,12 @@ void XMLSettingsExportHelper::exportForbiddenCharacters( } } -void XMLSettingsExportHelper::exportSettings( +void XMLSettingsExportHelper::exportAllSettings( const uno::Sequence<beans::PropertyValue>& aProps, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - ::rtl::OUString aQName = - rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, rName ); - exportSequencePropertyValue(aProps, aQName); + exportSequencePropertyValue(aProps, rName); } @@ -531,15 +537,16 @@ void XMLSettingsExportHelper::ManipulateSetting( uno::Any& rAny, const rtl::OUSt { if( !mxStringSubsitution.is() ) { - if( rExport.getServiceFactory().is() ) try + if( m_rContext.GetServiceFactory().is() ) try { const_cast< XMLSettingsExportHelper* >(this)->mxStringSubsitution = uno::Reference< util::XStringSubstitution >::query( - rExport.getServiceFactory()-> + m_rContext.GetServiceFactory()-> createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ) ); } catch( uno::Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 2eaaeceb444e..f310150e9ade 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -53,6 +53,7 @@ #include <xmloff/xmlexp.hxx> #include <xmloff/xmlnumfe.hxx> #include <xmloff/xmlmetae.hxx> +#include <xmloff/XMLSettingsExportContext.hxx> #include <xmloff/families.hxx> #include <xmloff/XMLEventExport.hxx> #include "XMLStarBasicExportHandler.hxx" @@ -157,6 +158,72 @@ const XMLServiceMapEntry_Impl aServiceMap[] = //============================================================================== +class SAL_DLLPRIVATE SettingsExportFacade : public ::xmloff::XMLSettingsExportContext +{ +public: + SettingsExportFacade( SvXMLExport& i_rExport ) + :m_rExport( i_rExport ) + { + } + + virtual ~SettingsExportFacade() + { + } + + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + const ::rtl::OUString& i_rValue ); + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + enum ::xmloff::token::XMLTokenEnum i_eValue ); + + virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, + const sal_Bool i_bIgnoreWhitespace ); + virtual void EndElement( const sal_Bool i_bIgnoreWhitespace ); + + virtual void Characters( const ::rtl::OUString& i_rCharacters ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + GetServiceFactory() const; +private: + SvXMLExport& m_rExport; + ::std::stack< ::rtl::OUString > m_aElements; +}; + +void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const ::rtl::OUString& i_rValue ) +{ + m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_rValue ); +} + +void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, enum ::xmloff::token::XMLTokenEnum i_eValue ) +{ + m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_eValue ); +} + +void SettingsExportFacade::StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, const sal_Bool i_bIgnoreWhitespace ) +{ + const ::rtl::OUString sElementName( m_rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_CONFIG, GetXMLToken( i_eName ) ) ); + m_rExport.StartElement( sElementName, i_bIgnoreWhitespace ); + m_aElements.push( sElementName ); +} + +void SettingsExportFacade::EndElement( const sal_Bool i_bIgnoreWhitespace ) +{ + const ::rtl::OUString sElementName( m_aElements.top() ); + m_rExport.EndElement( sElementName, i_bIgnoreWhitespace ); + m_aElements.pop(); +} + +void SettingsExportFacade::Characters( const ::rtl::OUString& i_rCharacters ) +{ + m_rExport.GetDocHandler()->characters( i_rCharacters ); +} + +Reference< XMultiServiceFactory > SettingsExportFacade::GetServiceFactory() const +{ + return m_rExport.getServiceFactory(); +} + +//============================================================================== + class SvXMLExportEventListener : public cppu::WeakImplHelper1< com::sun::star::lang::XEventListener > { @@ -1100,7 +1167,9 @@ void SvXMLExport::ImplExportSettings() nSettingsCount != 0, XML_NAMESPACE_OFFICE, XML_SETTINGS, sal_True, sal_True ); - XMLSettingsExportHelper aSettingsExportHelper(*this); + + SettingsExportFacade aSettingsExportContext( *this ); + XMLSettingsExportHelper aSettingsExportHelper( aSettingsExportContext ); for ( ::std::list< SettingsGroup >::const_iterator settings = aSettings.begin(); settings != aSettings.end(); @@ -1111,7 +1180,8 @@ void SvXMLExport::ImplExportSettings() continue; OUString sSettingsName( GetXMLToken( settings->eGroupName ) ); - aSettingsExportHelper.exportSettings( settings->aSettings, sSettingsName ); + OUString sQName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, sSettingsName ); + aSettingsExportHelper.exportAllSettings( settings->aSettings, sQName ); } } } diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 0bbdf9e18482..5292b92d4128 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -197,13 +197,22 @@ sal_Bool XMLStyleExport::exportStyle( OUStringBuffer sTmp; sTmp.append( static_cast<sal_Int32>(nOutlineLevel)); GetExport().AddAttribute( XML_NAMESPACE_STYLE, - XML_DEFAULT_OUTLINE_LEVEL, - sTmp.makeStringAndClear() ); + XML_DEFAULT_OUTLINE_LEVEL, + sTmp.makeStringAndClear() ); } else { - GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DEFAULT_OUTLINE_LEVEL, - OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); + // --> OD 2009-12-29 #i104889# + // empty value for style:default-outline-level does exist + // since ODF 1.2. Thus, suppress its export for former versions. + if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 && + GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + // <-- + { + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + XML_DEFAULT_OUTLINE_LEVEL, + OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); + } } } }//<-end,zhaojianwei @@ -308,8 +317,9 @@ sal_Bool XMLStyleExport::exportStyle( } ///////////////////////////////////////////////// if ( bNoInheritedListStyle ) - GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_LIST_STYLE_NAME, - OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + XML_LIST_STYLE_NAME, + OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); } //<-end,zhaojianwei } diff --git a/xmloff/source/text/XMLTextNumRuleInfo.cxx b/xmloff/source/text/XMLTextNumRuleInfo.cxx index 5d37764d5726..482d94d05889 100644 --- a/xmloff/source/text/XMLTextNumRuleInfo.cxx +++ b/xmloff/source/text/XMLTextNumRuleInfo.cxx @@ -120,6 +120,15 @@ void XMLTextNumRuleInfo::Set( } // <-- + // --> OD 2010-01-13 #b6912256# + if ( mnListLevel < 0 ) + { + DBG_ASSERT( false, + "<XMLTextNumRuleInfo::Set(..)> - unexpected numbering level" ); + Reset(); + return; + } + // --> OD 2006-09-27 #i69627# bool bSuppressListStyle( false ); if ( mxNumRules.is() ) |