Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / ucb / source / ucp / ext / ucpext_content.cxx
blob9496dcc6a7bcf226dc6cb0fd16be018028bb6ea9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "ucpext_content.hxx"
23 #include "ucpext_content.hxx"
24 #include "ucpext_provider.hxx"
25 #include "ucpext_resultset.hxx"
27 #include <com/sun/star/beans/PropertyAttribute.hpp>
28 #include <com/sun/star/beans/XPropertyAccess.hpp>
29 #include <com/sun/star/lang/IllegalAccessException.hpp>
30 #include <com/sun/star/sdbc/XRow.hpp>
31 #include <com/sun/star/ucb/XCommandInfo.hpp>
32 #include <com/sun/star/ucb/XPersistentPropertySet.hpp>
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <com/sun/star/io/XActiveDataSink.hpp>
35 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
36 #include <com/sun/star/ucb/OpenMode.hpp>
37 #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
38 #include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
39 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
40 #include <com/sun/star/ucb/OpenMode.hpp>
41 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
42 #include <com/sun/star/lang/IllegalAccessException.hpp>
43 #include <com/sun/star/deployment/PackageInformationProvider.hpp>
45 #include <ucbhelper/contentidentifier.hxx>
46 #include <ucbhelper/propertyvalueset.hxx>
47 #include <ucbhelper/cancelcommandexecution.hxx>
48 #include <ucbhelper/content.hxx>
49 #include <tools/diagnose_ex.h>
50 #include <comphelper/componentcontext.hxx>
51 #include <comphelper/processfactory.hxx>
52 #include <comphelper/string.hxx>
53 #include <rtl/ustrbuf.hxx>
54 #include <rtl/uri.hxx>
55 #include <sal/macros.h>
57 #include <algorithm>
59 //......................................................................................................................
60 namespace ucb { namespace ucp { namespace ext
62 //......................................................................................................................
64 /** === begin UNO using === **/
65 using ::com::sun::star::uno::Reference;
66 using ::com::sun::star::uno::XInterface;
67 using ::com::sun::star::uno::UNO_QUERY;
68 using ::com::sun::star::uno::UNO_QUERY_THROW;
69 using ::com::sun::star::uno::UNO_SET_THROW;
70 using ::com::sun::star::uno::Exception;
71 using ::com::sun::star::uno::RuntimeException;
72 using ::com::sun::star::uno::Any;
73 using ::com::sun::star::uno::makeAny;
74 using ::com::sun::star::uno::Sequence;
75 using ::com::sun::star::uno::Type;
76 using ::com::sun::star::uno::XComponentContext;
77 using ::com::sun::star::lang::XMultiServiceFactory;
78 using ::com::sun::star::ucb::XContentIdentifier;
79 using ::com::sun::star::ucb::IllegalIdentifierException;
80 using ::com::sun::star::ucb::XContent;
81 using ::com::sun::star::ucb::XCommandEnvironment;
82 using ::com::sun::star::ucb::Command;
83 using ::com::sun::star::ucb::CommandAbortedException;
84 using ::com::sun::star::beans::Property;
85 using ::com::sun::star::lang::IllegalArgumentException;
86 using ::com::sun::star::beans::PropertyValue;
87 using ::com::sun::star::ucb::OpenCommandArgument2;
88 using ::com::sun::star::ucb::XDynamicResultSet;
89 using ::com::sun::star::ucb::UnsupportedOpenModeException;
90 using ::com::sun::star::io::XOutputStream;
91 using ::com::sun::star::io::XActiveDataSink;
92 using ::com::sun::star::io::XInputStream;
93 using ::com::sun::star::ucb::UnsupportedDataSinkException;
94 using ::com::sun::star::ucb::UnsupportedCommandException;
95 using ::com::sun::star::sdbc::XRow;
96 using ::com::sun::star::beans::XPropertySet;
97 using ::com::sun::star::beans::PropertyChangeEvent;
98 using ::com::sun::star::lang::IllegalAccessException;
99 using ::com::sun::star::ucb::CommandInfo;
100 using ::com::sun::star::deployment::PackageInformationProvider;
101 using ::com::sun::star::deployment::XPackageInformationProvider;
102 /** === end UNO using === **/
103 namespace OpenMode = ::com::sun::star::ucb::OpenMode;
104 namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
106 //==================================================================================================================
107 //= helper
108 //==================================================================================================================
109 namespace
111 //--------------------------------------------------------------------------------------------------------------
112 ::rtl::OUString lcl_compose( const ::rtl::OUString& i_rBaseURL, const ::rtl::OUString& i_rRelativeURL )
114 ENSURE_OR_RETURN( !i_rBaseURL.isEmpty(), "illegal base URL", i_rRelativeURL );
116 ::rtl::OUStringBuffer aComposer( i_rBaseURL );
117 if ( i_rBaseURL.getStr()[ i_rBaseURL.getLength() - 1 ] != '/' )
118 aComposer.append( sal_Unicode( '/' ) );
119 aComposer.append( i_rRelativeURL );
120 return aComposer.makeStringAndClear();
123 //--------------------------------------------------------------------------------------------------------------
124 struct SelectPropertyName : public ::std::unary_function< Property, ::rtl::OUString >
126 const ::rtl::OUString& operator()( const Property& i_rProperty ) const
128 return i_rProperty.Name;
133 //==================================================================================================================
134 //= Content
135 //==================================================================================================================
136 //------------------------------------------------------------------------------------------------------------------
137 Content::Content( const Reference< XComponentContext >& rxContext, ::ucbhelper::ContentProviderImplHelper* i_pProvider,
138 const Reference< XContentIdentifier >& i_rIdentifier )
139 :Content_Base( rxContext, i_pProvider, i_rIdentifier )
140 ,m_eExtContentType( E_UNKNOWN )
141 ,m_aIsFolder()
142 ,m_aContentType()
143 ,m_sExtensionId()
144 ,m_sPathIntoExtension()
146 const ::rtl::OUString sURL( getIdentifier()->getContentIdentifier() );
147 if ( denotesRootContent( sURL ) )
149 m_eExtContentType = E_ROOT;
151 else
153 const ::rtl::OUString sRelativeURL( sURL.copy( ContentProvider::getRootURL().getLength() ) );
154 const sal_Int32 nSepPos = sRelativeURL.indexOf( '/' );
155 if ( ( nSepPos == -1 ) || ( nSepPos == sRelativeURL.getLength() - 1 ) )
157 m_eExtContentType = E_EXTENSION_ROOT;
159 else
161 m_eExtContentType = E_EXTENSION_CONTENT;
165 if ( m_eExtContentType != E_ROOT )
167 const ::rtl::OUString sRootURL = ContentProvider::getRootURL();
168 m_sExtensionId = sURL.copy( sRootURL.getLength() );
170 const sal_Int32 nNextSep = m_sExtensionId.indexOf( '/' );
171 if ( nNextSep > -1 )
173 m_sPathIntoExtension = m_sExtensionId.copy( nNextSep + 1 );
174 m_sExtensionId = m_sExtensionId.copy( 0, nNextSep );
176 m_sExtensionId = Content::decodeIdentifier( m_sExtensionId );
180 //------------------------------------------------------------------------------------------------------------------
181 Content::~Content()
185 //------------------------------------------------------------------------------------------------------------------
186 ::rtl::OUString SAL_CALL Content::getImplementationName() throw( RuntimeException )
188 return ::rtl::OUString( "org.openoffice.comp.ucp.ext.Content" );
191 //------------------------------------------------------------------------------------------------------------------
192 Sequence< ::rtl::OUString > SAL_CALL Content::getSupportedServiceNames() throw( RuntimeException )
194 Sequence< ::rtl::OUString > aServiceNames(2);
195 aServiceNames[0] = ::rtl::OUString( "com.sun.star.ucb.Content" );
196 aServiceNames[1] = ::rtl::OUString( "com.sun.star.ucb.ExtensionContent" );
197 return aServiceNames;
200 //------------------------------------------------------------------------------------------------------------------
201 ::rtl::OUString SAL_CALL Content::getContentType() throw( RuntimeException )
203 impl_determineContentType();
204 return *m_aContentType;
207 //------------------------------------------------------------------------------------------------------------------
208 Any SAL_CALL Content::execute( const Command& aCommand, sal_Int32 /* CommandId */, const Reference< XCommandEnvironment >& i_rEvironment )
209 throw( Exception, CommandAbortedException, RuntimeException )
211 Any aRet;
213 if ( aCommand.Name == "getPropertyValues" )
215 Sequence< Property > Properties;
216 if ( !( aCommand.Argument >>= Properties ) )
218 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
219 ::rtl::OUString(), *this, -1 ) ),
220 i_rEvironment );
221 // unreachable
224 aRet <<= getPropertyValues( Properties, i_rEvironment );
226 else if ( aCommand.Name == "setPropertyValues" )
228 Sequence< PropertyValue > aProperties;
229 if ( !( aCommand.Argument >>= aProperties ) )
231 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
232 ::rtl::OUString(), *this, -1 ) ),
233 i_rEvironment );
234 // unreachable
237 if ( !aProperties.getLength() )
239 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
240 ::rtl::OUString(), *this, -1 ) ),
241 i_rEvironment );
242 // unreachable
245 aRet <<= setPropertyValues( aProperties, i_rEvironment );
247 else if ( aCommand.Name == "getPropertySetInfo" )
249 // implemented by base class.
250 aRet <<= getPropertySetInfo( i_rEvironment );
252 else if ( aCommand.Name == "getCommandInfo" )
254 // implemented by base class.
255 aRet <<= getCommandInfo( i_rEvironment );
257 else if ( aCommand.Name == "open" )
259 OpenCommandArgument2 aOpenCommand;
260 if ( !( aCommand.Argument >>= aOpenCommand ) )
262 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
263 ::rtl::OUString(), *this, -1 ) ),
264 i_rEvironment );
265 // unreachable
268 sal_Bool bOpenFolder =
269 ( ( aOpenCommand.Mode == OpenMode::ALL ) ||
270 ( aOpenCommand.Mode == OpenMode::FOLDERS ) ||
271 ( aOpenCommand.Mode == OpenMode::DOCUMENTS ) );
274 if ( bOpenFolder && impl_isFolder() )
276 Reference< XDynamicResultSet > xSet = new ResultSet( m_xContext, this, aOpenCommand, i_rEvironment );
277 aRet <<= xSet;
280 if ( aOpenCommand.Sink.is() )
282 const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() );
283 ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEvironment, m_xContext );
284 aRet = aRequestedContent.executeCommand( ::rtl::OUString( "open" ), makeAny( aOpenCommand ) );
288 else
290 ::ucbhelper::cancelCommandExecution( makeAny( UnsupportedCommandException(
291 ::rtl::OUString(), *this ) ),
292 i_rEvironment );
293 // unreachable
296 return aRet;
299 //------------------------------------------------------------------------------------------------------------------
300 void SAL_CALL Content::abort( sal_Int32 ) throw( RuntimeException )
304 //------------------------------------------------------------------------------------------------------------------
305 ::rtl::OUString Content::encodeIdentifier( const ::rtl::OUString& i_rIdentifier )
307 return ::rtl::Uri::encode( i_rIdentifier, rtl_UriCharClassRegName, rtl_UriEncodeIgnoreEscapes,
308 RTL_TEXTENCODING_UTF8 );
311 //------------------------------------------------------------------------------------------------------------------
312 ::rtl::OUString Content::decodeIdentifier( const ::rtl::OUString& i_rIdentifier )
314 return ::rtl::Uri::decode( i_rIdentifier, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
317 //------------------------------------------------------------------------------------------------------------------
318 bool Content::denotesRootContent( const ::rtl::OUString& i_rContentIdentifier )
320 const ::rtl::OUString sRootURL( ContentProvider::getRootURL() );
321 if ( i_rContentIdentifier == sRootURL )
322 return true;
324 // the root URL contains only two trailing /, but we also recognize 3 of them as denoting the root URL
325 if ( i_rContentIdentifier.match( sRootURL )
326 && ( i_rContentIdentifier.getLength() == sRootURL.getLength() + 1 )
327 && ( i_rContentIdentifier[ i_rContentIdentifier.getLength() - 1 ] == '/' )
329 return true;
331 return false;
334 //------------------------------------------------------------------------------------------------------------------
335 ::rtl::OUString Content::getParentURL()
337 const ::rtl::OUString sRootURL( ContentProvider::getRootURL() );
339 switch ( m_eExtContentType )
341 case E_ROOT:
342 // don't have a parent
343 return sRootURL;
345 case E_EXTENSION_ROOT:
346 // our parent is the root itself
347 return sRootURL;
349 case E_EXTENSION_CONTENT:
351 const ::rtl::OUString sURL = m_xIdentifier->getContentIdentifier();
353 // cut the root URL
354 if ( !sURL.match( sRootURL, 0 ) )
356 SAL_INFO( "ucb.ucp", "illegal URL structure - no root" );
357 break;
360 ::rtl::OUString sRelativeURL( sURL.copy( sRootURL.getLength() ) );
362 // cut the extension ID
363 const ::rtl::OUString sSeparatedExtensionId( encodeIdentifier( m_sExtensionId ) + ::rtl::OUString( sal_Unicode( '/' ) ) );
364 if ( !sRelativeURL.match( sSeparatedExtensionId ) )
366 SAL_INFO( "ucb.ucp", "illegal URL structure - no extension ID" );
367 break;
370 sRelativeURL = sRelativeURL.copy( sSeparatedExtensionId.getLength() );
372 // cut the final slash (if any)
373 if ( sRelativeURL.isEmpty() )
375 SAL_INFO( "ucb.ucp", "illegal URL structure - ExtensionContent should have a level below the extension ID" );
376 break;
379 if ( sRelativeURL.getStr()[ sRelativeURL.getLength() - 1 ] == '/' )
380 sRelativeURL = sRelativeURL.copy( 0, sRelativeURL.getLength() - 1 );
382 // remove the last segment
383 const sal_Int32 nLastSep = sRelativeURL.lastIndexOf( '/' );
384 sRelativeURL = sRelativeURL.copy( 0, nLastSep != -1 ? nLastSep : 0 );
386 ::rtl::OUStringBuffer aComposer;
387 aComposer.append( sRootURL );
388 aComposer.append( sSeparatedExtensionId );
389 aComposer.append( sRelativeURL );
390 return aComposer.makeStringAndClear();
393 default:
394 OSL_FAIL( "Content::getParentURL: unhandled case!" );
395 break;
397 return ::rtl::OUString();
400 //------------------------------------------------------------------------------------------------------------------
401 Reference< XRow > Content::getArtificialNodePropertyValues( const Reference< XComponentContext >& rxContext,
402 const Sequence< Property >& i_rProperties, const ::rtl::OUString& i_rTitle )
404 // note: empty sequence means "get values of all supported properties".
405 ::rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( rxContext );
407 const sal_Int32 nCount = i_rProperties.getLength();
408 if ( nCount )
410 Reference< XPropertySet > xAdditionalPropSet;
412 const Property* pProps = i_rProperties.getConstArray();
413 for ( sal_Int32 n = 0; n < nCount; ++n )
415 const Property& rProp = pProps[ n ];
417 // Process Core properties.
418 if ( rProp.Name == "ContentType" )
420 xRow->appendString ( rProp, ContentProvider::getArtificialNodeContentType() );
422 else if ( rProp.Name == "Title" )
424 xRow->appendString ( rProp, i_rTitle );
426 else if ( rProp.Name == "IsDocument" )
428 xRow->appendBoolean( rProp, sal_False );
430 else if ( rProp.Name == "IsFolder" )
432 xRow->appendBoolean( rProp, sal_True );
434 else
436 // append empty entry.
437 xRow->appendVoid( rProp );
441 else
443 // Append all Core Properties.
444 xRow->appendString ( Property( ::rtl::OUString("ContentType"),
446 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
447 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
448 ContentProvider::getArtificialNodeContentType() );
449 xRow->appendString ( Property( ::rtl::OUString("Title"),
451 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
452 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
453 i_rTitle );
454 xRow->appendBoolean( Property( ::rtl::OUString("IsDocument"),
456 getCppuBooleanType(),
457 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
458 sal_False );
459 xRow->appendBoolean( Property( ::rtl::OUString("IsFolder"),
461 getCppuBooleanType(),
462 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
463 sal_True );
466 return Reference< XRow >( xRow.get() );
469 //------------------------------------------------------------------------------------------------------------------
470 ::rtl::OUString Content::getPhysicalURL() const
472 ENSURE_OR_RETURN( m_eExtContentType != E_ROOT, "illegal call", ::rtl::OUString() );
474 // create an ucb::XContent for the physical file within the deployed extension
475 const Reference< XPackageInformationProvider > xPackageInfo = PackageInformationProvider::get(m_xContext);
476 const ::rtl::OUString sPackageLocation( xPackageInfo->getPackageLocation( m_sExtensionId ) );
478 if ( m_sPathIntoExtension.isEmpty() )
479 return sPackageLocation;
480 return lcl_compose( sPackageLocation, m_sPathIntoExtension );
483 //------------------------------------------------------------------------------------------------------------------
484 Reference< XRow > Content::getPropertyValues( const Sequence< Property >& i_rProperties, const Reference< XCommandEnvironment >& i_rEnv )
486 ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
488 switch ( m_eExtContentType )
490 case E_ROOT:
491 return getArtificialNodePropertyValues( m_xContext, i_rProperties, ContentProvider::getRootURL() );
492 case E_EXTENSION_ROOT:
493 return getArtificialNodePropertyValues( m_xContext, i_rProperties, m_sExtensionId );
494 case E_EXTENSION_CONTENT:
496 const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() );
497 ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEnv, m_xContext );
499 // translate the property request
500 Sequence< ::rtl::OUString > aPropertyNames( i_rProperties.getLength() );
501 ::std::transform(
502 i_rProperties.getConstArray(),
503 i_rProperties.getConstArray() + i_rProperties.getLength(),
504 aPropertyNames.getArray(),
505 SelectPropertyName()
507 const Sequence< Any > aPropertyValues = aRequestedContent.getPropertyValues( aPropertyNames );
508 const ::rtl::Reference< ::ucbhelper::PropertyValueSet > xValueRow = new ::ucbhelper::PropertyValueSet( m_xContext );
509 sal_Int32 i=0;
510 for ( const Any* value = aPropertyValues.getConstArray();
511 value != aPropertyValues.getConstArray() + aPropertyValues.getLength();
512 ++value, ++i
515 xValueRow->appendObject( aPropertyNames[i], *value );
517 return xValueRow.get();
520 default:
521 OSL_FAIL( "Content::getPropertyValues: unhandled case!" );
522 break;
525 OSL_FAIL( "Content::getPropertyValues: unreachable!" );
526 return NULL;
529 //------------------------------------------------------------------------------------------------------------------
530 Sequence< Any > Content::setPropertyValues( const Sequence< PropertyValue >& i_rValues, const Reference< XCommandEnvironment >& /* xEnv */)
532 ::osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
534 Sequence< Any > aRet( i_rValues.getLength() );
535 Sequence< PropertyChangeEvent > aChanges( i_rValues.getLength() );
537 PropertyChangeEvent aEvent;
538 aEvent.Source = static_cast< cppu::OWeakObject * >( this );
539 aEvent.Further = sal_False;
540 aEvent.PropertyHandle = -1;
542 const PropertyValue* pValues = i_rValues.getConstArray();
543 const sal_Int32 nCount = i_rValues.getLength();
545 for ( sal_Int32 n = 0; n < nCount; ++n, ++pValues )
547 // all our properties are read-only ...
548 aRet[ n ] <<= IllegalAccessException( ::rtl::OUString("property is read-only."), *this );
551 return aRet;
554 //------------------------------------------------------------------------------------------------------------------
555 Sequence< CommandInfo > Content::getCommands( const Reference< XCommandEnvironment > & /*xEnv*/ )
557 sal_uInt32 nCommandCount = 5;
558 static const CommandInfo aCommandInfoTable[] =
560 ///////////////////////////////////////////////////////////////
561 // Mandatory commands
562 ///////////////////////////////////////////////////////////////
563 CommandInfo(
564 ::rtl::OUString( "getCommandInfo" ),
566 getCppuVoidType()
568 CommandInfo(
569 ::rtl::OUString( "getPropertySetInfo" ),
571 getCppuVoidType()
573 CommandInfo(
574 ::rtl::OUString( "getPropertyValues" ),
576 getCppuType(
577 static_cast< Sequence< Property > * >( 0 ) )
579 CommandInfo(
580 ::rtl::OUString( "setPropertyValues" ),
582 getCppuType(
583 static_cast< Sequence< PropertyValue > * >( 0 ) )
585 ///////////////////////////////////////////////////////////////
586 // Optional standard commands
587 ///////////////////////////////////////////////////////////////
588 , CommandInfo(
589 ::rtl::OUString( "open" ),
591 getCppuType( static_cast< OpenCommandArgument2 * >( 0 ) )
595 return Sequence< CommandInfo >( aCommandInfoTable, nCommandCount );
598 //------------------------------------------------------------------------------------------------------------------
599 Sequence< Property > Content::getProperties( const Reference< XCommandEnvironment > & /*xEnv*/ )
601 static Property aProperties[] =
603 Property(
604 ::rtl::OUString( "ContentType" ),
606 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
607 PropertyAttribute::BOUND | PropertyAttribute::READONLY
609 Property(
610 ::rtl::OUString( "IsDocument" ),
612 getCppuBooleanType(),
613 PropertyAttribute::BOUND | PropertyAttribute::READONLY
615 Property(
616 ::rtl::OUString( "IsFolder" ),
618 getCppuBooleanType(),
619 PropertyAttribute::BOUND | PropertyAttribute::READONLY
621 Property(
622 ::rtl::OUString( "Title" ),
624 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
625 PropertyAttribute::BOUND | PropertyAttribute::READONLY
628 return Sequence< Property >( aProperties, sizeof( aProperties ) / sizeof( aProperties[0] ) );
631 //------------------------------------------------------------------------------------------------------------------
632 bool Content::impl_isFolder()
634 if ( !!m_aIsFolder )
635 return *m_aIsFolder;
637 bool bIsFolder = false;
640 Sequence< Property > aProps(1);
641 aProps[0].Name = ::rtl::OUString( "IsFolder" );
642 Reference< XRow > xRow( getPropertyValues( aProps, NULL ), UNO_SET_THROW );
643 bIsFolder = xRow->getBoolean(1);
645 catch( const Exception& )
647 DBG_UNHANDLED_EXCEPTION();
649 m_aIsFolder.reset( bIsFolder );
650 return *m_aIsFolder;
653 //------------------------------------------------------------------------------------------------------------------
654 void Content::impl_determineContentType()
656 if ( !!m_aContentType )
657 return;
659 m_aContentType.reset( ContentProvider::getArtificialNodeContentType() );
660 if ( m_eExtContentType == E_EXTENSION_CONTENT )
664 Sequence< Property > aProps(1);
665 aProps[0].Name = ::rtl::OUString( "ContentType" );
666 Reference< XRow > xRow( getPropertyValues( aProps, NULL ), UNO_SET_THROW );
667 m_aContentType.reset( xRow->getString(1) );
669 catch( const Exception& )
671 DBG_UNHANDLED_EXCEPTION();
676 //......................................................................................................................
677 } } } // namespace ucp::ext
678 //......................................................................................................................
680 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */