User: kz      
Date: 2008-03-06 17:59:35+0000
Modified:
   dba/dbaccess/source/core/dataaccess/documentcontainer.cxx

Log:
 INTEGRATION: CWS odbmacros2 (1.26.2); FILE MERGED
 2008/02/04 13:07:20 fs 1.26.2.3: RESYNC: (1.26-1.27); FILE MERGED
 2008/01/23 14:21:05 fs 1.26.2.2: loadComponentFromURL: better error message 
for non-existent components
 2007/12/12 09:54:56 fs 1.26.2.1: #i49133# when loading an embedded object, 
prohibit it to have embedded scripts/macros (unless it already has some)

File Changes:

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: documentcontainer.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentcontainer.cxx?r1=1.27&r2=1.28
Delta lines:  +41 -35
---------------------
--- documentcontainer.cxx       2008-01-30 08:34:25+0000        1.27
+++ documentcontainer.cxx       2008-03-06 17:59:32+0000        1.28
@@ -81,6 +81,9 @@
 #ifndef _COMPHELPER_MIMECONFIGHELPER_HXX_
 #include <comphelper/mimeconfighelper.hxx>
 #endif
+#ifndef INCLUDED_COMPHELPER_STRING_HXX
+#include <comphelper/string.hxx>
+#endif
 #ifndef CONNECTIVITY_SQLERROR_HXX
 #include <connectivity/sqlerror.hxx>
 #endif
@@ -253,14 +256,14 @@
                        // 
-----------------------------------------------------------------------------
                        sPersistentName = sBaseName;
                        sPersistentName += 
::rtl::OUString::valueOf(sal_Int32(rDefinitions.size() + 1));
-                       Reference<XNameAccess> 
xElements(getStorage(),UNO_QUERY);
+                       Reference<XNameAccess> 
xElements(getContainerStorage(),UNO_QUERY);
                        if ( xElements.is() )
                                sPersistentName = 
::dbtools::createUniqueName(xElements,sPersistentName);
 
             if ( xCopyFrom.is() )
                        {
                                Sequence<Any> aIni(2);
-                               aIni[0] <<= getStorage();
+                               aIni[0] <<= getContainerStorage();
                                aIni[1] <<= sPersistentName;
                                Command aCommand;
                                aCommand.Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("copyTo"));
@@ -273,7 +276,7 @@
                        }
 
             if ( ( aClassID.getLength() == 0 ) && ( 0 == sURL.getLength() ) )
-                ODocumentDefinition::GetDocumentServiceFromMediaType( 
getStorage(), sPersistentName, m_aContext.getLegacyServiceFactory(), aClassID );
+                ODocumentDefinition::GetDocumentServiceFromMediaType( 
getContainerStorage(), sPersistentName, m_aContext.getLegacyServiceFactory(), 
aClassID );
                }
 
                ODefinitionContainer_Impl::const_iterator aFind = 
rDefinitions.find( sName );
@@ -530,8 +533,14 @@
                Any aContent;
                Reference< XNameContainer > xNameContainer(this);
                ::rtl::OUString sName;
-               if ( lcl_queryContent(_sURL,xNameContainer,aContent,sName) )
+               if ( !lcl_queryContent(_sURL,xNameContainer,aContent,sName) )
                {
+            ::rtl::OUString sMessage( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "Unable to find the document '$name$'." ) ) );
+                // TODO: resource
+            ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", 
_sURL );
+                       throw IllegalArgumentException( sMessage, *this, 1 );
+        }
+
                        Reference< XCommandProcessor > 
xContent(aContent,UNO_QUERY);
                        if ( xContent.is() )
                        {
@@ -562,9 +571,6 @@
                                
xComp.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference<
 XCommandEnvironment >()),UNO_QUERY);
                        }
                }
-               else
-                       throw IllegalArgumentException();
-       }
        catch(NoSuchElementException)
        {
                throw IllegalArgumentException();
@@ -676,7 +682,7 @@
                if ( xTrans.is() )
                        xTrans->commit();
        }
-       Reference<XTransactedObject> xTrans(getStorage(),UNO_QUERY);
+       Reference<XTransactedObject> xTrans(getContainerStorage(),UNO_QUERY);
        if ( xTrans.is() )
                xTrans->commit();
 }
@@ -692,12 +698,12 @@
                if ( xTrans.is() )
                        xTrans->revert();
        }
-       Reference<XTransactedObject> xTrans(getStorage(),UNO_QUERY);
+       Reference<XTransactedObject> xTrans(getContainerStorage(),UNO_QUERY);
        if ( xTrans.is() )
                xTrans->revert();
 }
 // 
-----------------------------------------------------------------------------
-Reference< XStorage> ODocumentContainer::getStorage() const
+Reference< XStorage> ODocumentContainer::getContainerStorage() const
 { 
        return  m_pImpl->m_pDataSource
         ?   m_pImpl->m_pDataSource->getStorage( 
ODatabaseModelImpl::getObjectContainerStorageName( m_bFormsContainer ? 
ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) )




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to