Tag: cws_dev300_odbmacros3 User: fs Date: 2008-05-08 10:08:15+0000 Modified: dba/dbaccess/source/ui/app/AppController.cxx
Log: #i49133# no migration warning when the document is read-only, or the warning has been explicitly suppressed File Changes: Directory: /dba/dbaccess/source/ui/app/ ======================================= File [changed]: AppController.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.cxx?r1=1.56.6.2&r2=1.56.6.3 Delta lines: +22 -10 --------------------- --- AppController.cxx 2008-04-15 13:11:38+0000 1.56.6.2 +++ AppController.cxx 2008-05-08 10:08:12+0000 1.56.6.3 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: AppController.cxx,v $ - * $Revision: 1.56.6.2 $ + * $Revision: 1.56.6.3 $ * * This file is part of OpenOffice.org. * @@ -68,7 +68,6 @@ #include <com/sun/star/container/XHierarchicalNameContainer.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/util/XModifiable.hpp> -#include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/util/XFlushable.hpp> #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" @@ -721,7 +720,9 @@ // Our document supports embedding scripts into it, if and only if there are no // forms/reports with macros/scripts into them. So, we need to enable migration // if and only if the database document does *not* support embedding scripts. - bool bAvailable = !Reference< XEmbeddedScripts >( m_xModel, UNO_QUERY ).is(); + bool bAvailable = + !Reference< XEmbeddedScripts >( m_xModel, UNO_QUERY ).is() + && !Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly(); aReturn.bEnabled = bAvailable; if ( !bAvailable ) aReturn.bInvisible = true; @@ -2483,14 +2484,25 @@ return 0L; } + try + { + // If the migration just happened, but was not successful, the document is reloaded. + // In this case, we should not show the warning, again. + ::comphelper::NamedValueCollection aModelArgs( m_xModel->getArgs() ); + if ( aModelArgs.getOrDefault( "SuppressMigrationWarning", sal_False ) ) + return 0L; + + // also, if the document is read-only, then no migration is possible, and the + // respective menu entry is hidden. So, don't show the warning in this case, too. + if ( Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly() ) + return 0L; + SQLWarning aWarning; aWarning.Message = String( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS ) ); SQLException aDetail; aDetail.Message = String( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS_DETAIL ) ); aWarning.NextException <<= aDetail; - try - { ::comphelper::ComponentContext aContext( getORB() ); Sequence< Any > aArgs(1); aArgs[0] <<= NamedValue( PROPERTY_SQLEXCEPTION, makeAny( aWarning ) ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
