Tag: cws_src680_oj14
User: oj      
Date: 2007/03/15 07:42:56

Modified:
   dba/dbaccess/source/core/dataaccess/documentdefinition.cxx

Log:
 use mim config helper

File Changes:

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

File [changed]: documentdefinition.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.cxx?r1=1.29.4.5&r2=1.29.4.6
Delta lines:  +41 -10
---------------------
--- documentdefinition.cxx      7 Nov 2006 08:50:01 -0000       1.29.4.5
+++ documentdefinition.cxx      15 Mar 2007 14:42:53 -0000      1.29.4.6
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: documentdefinition.cxx,v $
  *
- *  $Revision: 1.29.4.5 $
+ *  $Revision: 1.29.4.6 $
  *
- *  last change: $Author: oj $ $Date: 2006/11/07 08:50:01 $
+ *  last change: $Author: oj $ $Date: 2007/03/15 14:42:53 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -436,6 +436,7 @@
 ::rtl::OUString lcl_GetDocumentServiceFromMediaType( const Reference< XStorage 
>& xStorage
                                                                                
                        ,const ::rtl::OUString& sEntName 
                                                                                
                        ,const Reference< XMultiServiceFactory >& _xORB
+                                                    ,Sequence< sal_Int8 >& 
_rClassId
                                                                                
                        )
 {
        ::rtl::OUString sResult;
@@ -459,7 +460,34 @@
                        }
                        ::comphelper::MimeConfigurationHelper 
aConfigHelper(_xORB);
                        sResult = 
aConfigHelper.GetDocServiceNameFromMediaType(aMediaType);
-                       //_rClassID = 
aConfigHelper.GetSequenceClassIDRepresentation(aConfigHelper.GetExplicitlyRegisteredObjClassID(aMediaType));
+                       _rClassId = 
aConfigHelper.GetSequenceClassIDRepresentation(aConfigHelper.GetExplicitlyRegisteredObjClassID(aMediaType));
+            if ( !_rClassId.getLength() && sResult.getLength() )
+            {
+                Reference< XNameAccess > xObjConfig = 
aConfigHelper.GetObjConfiguration();
+                if ( xObjConfig.is() )
+                       {
+                               try
+                               {
+                                       Sequence< ::rtl::OUString > aClassIDs = 
xObjConfig->getElementNames();
+                                       for ( sal_Int32 nInd = 0; nInd < 
aClassIDs.getLength(); nInd++ )
+                                       {
+                                               Reference< XNameAccess > 
xObjectProps;
+                                               ::rtl::OUString aEntryDocName;
+
+                                               if (    ( 
xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is()
+                                 && ( 
xObjectProps->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectDocumentServiceName"))
+                                                                           ) 
>>= aEntryDocName )
+                                                    && aEntryDocName.equals( 
sResult ) )
+                                               {
+                                _rClassId = 
aConfigHelper.GetSequenceClassIDRepresentation(aClassIDs[nInd]);
+                                                       break;
+                                               }
+                                       }
+                               }
+                               catch( Exception& )
+                               {}
+                       }
+            }
 
                        try
                        {
@@ -1171,7 +1199,7 @@
                _rArgs[nLen++].Value <<= aDocumentContext;
        }
 
-       _rArgs.realloc(nLen+3);
+       _rArgs.realloc(nLen+2);
        _rArgs[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
        _rArgs[nLen++].Value <<= _bReadOnly;
 
@@ -1224,11 +1252,14 @@
                                }
                                else
                                {
+                                       sDocumentService = 
lcl_GetDocumentServiceFromMediaType(xStorage,m_pImpl->m_aProps.sPersistentName,m_xORB,aClassID);
+                    if ( !aClassID.getLength() )
+                    {
                                        if ( m_bForm )
                                                aClassID = 
MimeConfigurationHelper::GetSequenceClassID(SO3_SW_CLASSID);
                                        else
                                                aClassID = 
MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90);
-                                       sDocumentService = 
lcl_GetDocumentServiceFromMediaType(xStorage,m_pImpl->m_aProps.sPersistentName,m_xORB);
+                    }
                                }
 
                                Sequence<PropertyValue> 
aArgs,aEmbeddedObjectDescriptor;




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

Reply via email to