diff options
Diffstat (limited to 'dbaccess/source/core/dataaccess/documentdefinition.cxx')
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.cxx | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index d3383cc837b0..227bde4cde1b 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -21,8 +21,9 @@ #include <ModelImpl.hxx> #include <stringconstants.hxx> #include <sdbcoretools.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <osl/diagnose.h> +#include <comphelper/compbase.hxx> #include <comphelper/sequence.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/classids.hxx> @@ -147,22 +148,20 @@ namespace dbaccess } // OEmbedObjectHolder - typedef ::cppu::WeakComponentImplHelper< embed::XStateChangeListener > TEmbedObjectHolder; + typedef ::comphelper::WeakComponentImplHelper< embed::XStateChangeListener > TEmbedObjectHolder; namespace { - class OEmbedObjectHolder : public ::cppu::BaseMutex - ,public TEmbedObjectHolder + class OEmbedObjectHolder : public TEmbedObjectHolder { Reference< XEmbeddedObject > m_xBroadCaster; ODocumentDefinition* m_pDefinition; bool m_bInStateChange; protected: - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>& rGuard) override; public: OEmbedObjectHolder(const Reference< XEmbeddedObject >& _xBroadCaster,ODocumentDefinition* _pDefinition) - : TEmbedObjectHolder(m_aMutex) - ,m_xBroadCaster(_xBroadCaster) + : m_xBroadCaster(_xBroadCaster) ,m_pDefinition(_pDefinition) ,m_bInStateChange(false) { @@ -181,7 +180,7 @@ namespace dbaccess } - void SAL_CALL OEmbedObjectHolder::disposing() + void OEmbedObjectHolder::disposing(std::unique_lock<std::mutex>& /*rGuard*/) { if ( m_xBroadCaster.is() ) m_xBroadCaster->removeStateChangeListener(this); @@ -508,7 +507,7 @@ void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int3 OUString sPersistentPath; if ( !m_pImpl->m_aProps.sPersistentName.isEmpty() ) { - sPersistentPath = ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) + sPersistentPath = ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report ) + "/" + m_pImpl->m_aProps.sPersistentName; } o_rValue <<= sPersistentPath; @@ -721,14 +720,14 @@ void ODocumentDefinition::impl_initFormEditView( const Reference< XController >& LayoutManagerLock aLockLayout( _rxController ); // setting of the visual properties - xViewSettings->setPropertyValue("ShowRulers",makeAny(true)); - xViewSettings->setPropertyValue("ShowVertRuler",makeAny(true)); - xViewSettings->setPropertyValue("ShowHoriRuler",makeAny(true)); - xViewSettings->setPropertyValue("IsRasterVisible",makeAny(true)); - xViewSettings->setPropertyValue("IsSnapToRaster",makeAny(true)); - xViewSettings->setPropertyValue("ShowOnlineLayout",makeAny(true)); - xViewSettings->setPropertyValue("RasterSubdivisionX",makeAny(sal_Int32(5))); - xViewSettings->setPropertyValue("RasterSubdivisionY",makeAny(sal_Int32(5))); + xViewSettings->setPropertyValue("ShowRulers",Any(true)); + xViewSettings->setPropertyValue("ShowVertRuler",Any(true)); + xViewSettings->setPropertyValue("ShowHoriRuler",Any(true)); + xViewSettings->setPropertyValue("IsRasterVisible",Any(true)); + xViewSettings->setPropertyValue("IsSnapToRaster",Any(true)); + xViewSettings->setPropertyValue("ShowOnlineLayout",Any(true)); + xViewSettings->setPropertyValue("RasterSubdivisionX",Any(sal_Int32(5))); + xViewSettings->setPropertyValue("RasterSubdivisionY",Any(sal_Int32(5))); } catch( const Exception& ) { @@ -852,7 +851,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons // So, in such a case, and with 2. above, we would silently execute those macros, // regardless of the global security settings - which would be a security issue, of // course. - if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eNoMacros ) + if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::NONE ) { // this is case 2. from above // So, pass a USE_CONFIG to the to-be-loaded document. This means that @@ -882,7 +881,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons { // not supported ucbhelper::cancelCommandExecution( - makeAny( UnsupportedOpenModeException( + Any( UnsupportedOpenModeException( OUString(), static_cast< cppu::OWeakObject * >( this ), sal_Int16( nOpenMode ) ) ), @@ -930,8 +929,8 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons xReportEngine->setReportDefinition(xReportDefinition); xReportEngine->setActiveConnection(m_xLastKnownConnection); if ( bOpenHidden ) - return makeAny( xReportEngine->createDocumentModel() ); - return makeAny( xReportEngine->createDocumentAlive( nullptr ) ); + return Any( xReportEngine->createDocumentModel() ); + return Any( xReportEngine->createDocumentAlive( nullptr ) ); } if ( _bActivate && !bOpenHidden ) @@ -949,7 +948,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons if ( !m_bForm && m_pImpl->m_aProps.bAsTemplate && !m_bOpenInDesign ) ODocumentDefinition::fillReportData( m_aContext, getComponent(), xConnection ); - return makeAny( xModel ); + return Any( xModel ); } Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 CommandId, const Reference< XCommandEnvironment >& Environment ) @@ -996,7 +995,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co if ( !bIsAliveNewStyleReport ) { impl_onActivateEmbeddedObject_nothrow( true ); - return makeAny( getComponent() ); + return Any( getComponent() ); } } } @@ -1017,7 +1016,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co { OSL_FAIL( "Wrong argument type!" ); ucbhelper::cancelCommandExecution( - makeAny( IllegalArgumentException( + Any( IllegalArgumentException( OUString(), static_cast< cppu::OWeakObject * >( this ), -1 ) ), @@ -1043,7 +1042,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co { OSL_FAIL( "Wrong argument count!" ); ucbhelper::cancelCommandExecution( - makeAny( IllegalArgumentException( + Any( IllegalArgumentException( OUString(), static_cast< cppu::OWeakObject * >( this ), -1 ) ), @@ -1114,7 +1113,7 @@ namespace try { Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW ); - xFormProps->setPropertyValue( PROPERTY_DATASOURCENAME, makeAny( OUString() ) ); + xFormProps->setPropertyValue( PROPERTY_DATASOURCENAME, Any( OUString() ) ); } catch( const Exception& ) { @@ -1160,7 +1159,7 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc Sequence<OUString> aProps { PROPERTY_URL }; ucbhelper::cancelCommandExecution( - makeAny( MissingPropertiesException( + Any( MissingPropertiesException( OUString(), static_cast< cppu::OWeakObject * >( this ), aProps ) ), @@ -1230,7 +1229,7 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw } aRequest.Content.set(m_xParentContainer,UNO_QUERY); - rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aRequest)); + rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest)); // some knittings // two continuations allowed: OK and Cancel rtl::Reference<ODocumentSaveContinuation> pDocuSave; @@ -1271,7 +1270,7 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw m_pImpl->m_aProps.aTitle = pDocuSave->getName(); Reference< XContent> xContent = this; - xNC->insertByName(pDocuSave->getName(),makeAny(xContent)); + xNC->insertByName(pDocuSave->getName(),Any(xContent)); updateDocumentTitle(); } @@ -1316,7 +1315,7 @@ void ODocumentDefinition::saveAs() aRequest.Name = m_pImpl->m_aProps.aTitle; aRequest.Content.set(m_xParentContainer,UNO_QUERY); - rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aRequest)); + rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest)); // some knittings // two continuations allowed: OK and Cancel rtl::Reference<ODocumentSaveContinuation> pDocuSave = new ODocumentSaveContinuation; @@ -1362,7 +1361,7 @@ void ODocumentDefinition::saveAs() Reference< XMultiServiceFactory > xORB( m_xParentContainer, UNO_QUERY_THROW ); Reference< XInterface > xComponent( xORB->createInstanceWithArguments( SERVICE_SDB_DOCUMENTDEFINITION, aArguments ) ); Reference< XNameContainer > xNameContainer( m_xParentContainer, UNO_QUERY_THROW ); - xNameContainer->insertByName( sOldName, makeAny( xComponent ) ); + xNameContainer->insertByName( sOldName, Any( xComponent ) ); } catch(const Exception&) { @@ -1388,7 +1387,7 @@ namespace { void lcl_putLoadArgs( ::comphelper::NamedValueCollection& _io_rArgs, const optional_bool& _bSuppressMacros, const optional_bool& _bReadOnly ) { - if ( !!_bSuppressMacros ) + if ( _bSuppressMacros.has_value() ) { if ( *_bSuppressMacros ) { @@ -1405,7 +1404,7 @@ namespace } } - if ( !!_bReadOnly ) + if ( _bReadOnly.has_value() ) _io_rArgs.put( "ReadOnly", *_bReadOnly ); } } @@ -1431,7 +1430,7 @@ namespace bool ODocumentDefinition::objectSupportsEmbeddedScripts() const { bool bAllowDocumentMacros = !m_pImpl->m_pDataSource - || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eSubDocumentMacros ); + || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::SubDocument ); // if *any* of the objects of the database document already has macros, we // continue to allow it to have them, until the user does a migration. @@ -1567,9 +1566,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_ Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName); if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() ) { - css::io::WrongFormatException aWFE; - aWFE.Message = DBA_RES( RID_STR_MISSING_EXTENSION ); - throw aWFE; + throw css::io::WrongFormatException(DBA_RES(RID_STR_MISSING_EXTENSION)); } } if ( !aClassID.hasElements() ) @@ -1927,7 +1924,7 @@ void SAL_CALL ODocumentDefinition::rename( const OUString& _rNewName ) Reference< XStorage> ODocumentDefinition::getContainerStorage() const { return m_pImpl->m_pDataSource - ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) + ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report ) : Reference< XStorage>(); } @@ -2077,8 +2074,8 @@ void ODocumentDefinition::firePropertyChange( sal_Int32 i_nHandle, const Any& i_ NameChangeNotifier::NameChangeNotifier( ODocumentDefinition& i_rDocumentDefinition, const OUString& i_rNewName, ::osl::ResettableMutexGuard& i_rClearForNotify ) :m_rDocumentDefinition( i_rDocumentDefinition ) - ,m_aOldValue( makeAny( i_rDocumentDefinition.getCurrentName() ) ) - ,m_aNewValue( makeAny( i_rNewName ) ) + ,m_aOldValue( Any( i_rDocumentDefinition.getCurrentName() ) ) + ,m_aNewValue( Any( i_rNewName ) ) ,m_rClearForNotify( i_rClearForNotify ) { impl_fireEvent_throw( true ); |