Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / ext / ucpext_content.cxx
blob69d60f47469bca6e0f3a17b920a6999fc48c6614
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
29 #include "ucpext_content.hxx"
31 #include "ucpext_content.hxx"
32 #include "ucpext_provider.hxx"
33 #include "ucpext_resultset.hxx"
35 /** === begin UNO includes === **/
36 #include <com/sun/star/beans/PropertyAttribute.hpp>
37 #include <com/sun/star/beans/XPropertyAccess.hpp>
38 #include <com/sun/star/lang/IllegalAccessException.hpp>
39 #include <com/sun/star/sdbc/XRow.hpp>
40 #include <com/sun/star/ucb/XCommandInfo.hpp>
41 #include <com/sun/star/ucb/XPersistentPropertySet.hpp>
42 #include <com/sun/star/io/XOutputStream.hpp>
43 #include <com/sun/star/io/XActiveDataSink.hpp>
44 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
45 #include <com/sun/star/ucb/OpenMode.hpp>
46 #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
47 #include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
48 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
49 #include <com/sun/star/ucb/OpenMode.hpp>
50 #include <com/sun/star/ucb/XDynamicResultSet.hpp>
51 #include <com/sun/star/lang/IllegalAccessException.hpp>
52 #include <com/sun/star/deployment/XPackageInformationProvider.hpp>
53 /** === end UNO includes === **/
55 #include <ucbhelper/contentidentifier.hxx>
56 #include <ucbhelper/propertyvalueset.hxx>
57 #include <ucbhelper/cancelcommandexecution.hxx>
58 #include <ucbhelper/content.hxx>
59 #include <tools/diagnose_ex.h>
60 #include <comphelper/string.hxx>
61 #include <comphelper/componentcontext.hxx>
62 #include <rtl/ustrbuf.hxx>
63 #include <rtl/uri.hxx>
64 #include <sal/macros.h>
66 #include <algorithm>
68 //......................................................................................................................
69 namespace ucb { namespace ucp { namespace ext
71 //......................................................................................................................
73 /** === begin UNO using === **/
74 using ::com::sun::star::uno::Reference;
75 using ::com::sun::star::uno::XInterface;
76 using ::com::sun::star::uno::UNO_QUERY;
77 using ::com::sun::star::uno::UNO_QUERY_THROW;
78 using ::com::sun::star::uno::UNO_SET_THROW;
79 using ::com::sun::star::uno::Exception;
80 using ::com::sun::star::uno::RuntimeException;
81 using ::com::sun::star::uno::Any;
82 using ::com::sun::star::uno::makeAny;
83 using ::com::sun::star::uno::Sequence;
84 using ::com::sun::star::uno::Type;
85 using ::com::sun::star::lang::XMultiServiceFactory;
86 using ::com::sun::star::ucb::XContentIdentifier;
87 using ::com::sun::star::ucb::IllegalIdentifierException;
88 using ::com::sun::star::ucb::XContent;
89 using ::com::sun::star::ucb::XCommandEnvironment;
90 using ::com::sun::star::ucb::Command;
91 using ::com::sun::star::ucb::CommandAbortedException;
92 using ::com::sun::star::beans::Property;
93 using ::com::sun::star::lang::IllegalArgumentException;
94 using ::com::sun::star::beans::PropertyValue;
95 using ::com::sun::star::ucb::OpenCommandArgument2;
96 using ::com::sun::star::ucb::XDynamicResultSet;
97 using ::com::sun::star::ucb::UnsupportedOpenModeException;
98 using ::com::sun::star::io::XOutputStream;
99 using ::com::sun::star::io::XActiveDataSink;
100 using ::com::sun::star::io::XInputStream;
101 using ::com::sun::star::ucb::UnsupportedDataSinkException;
102 using ::com::sun::star::ucb::UnsupportedCommandException;
103 using ::com::sun::star::sdbc::XRow;
104 using ::com::sun::star::beans::XPropertySet;
105 using ::com::sun::star::beans::PropertyChangeEvent;
106 using ::com::sun::star::lang::IllegalAccessException;
107 using ::com::sun::star::ucb::CommandInfo;
108 using ::com::sun::star::deployment::XPackageInformationProvider;
109 /** === end UNO using === **/
110 namespace OpenMode = ::com::sun::star::ucb::OpenMode;
111 namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
113 //==================================================================================================================
114 //= helper
115 //==================================================================================================================
116 namespace
118 //--------------------------------------------------------------------------------------------------------------
119 ::rtl::OUString lcl_compose( const ::rtl::OUString& i_rBaseURL, const ::rtl::OUString& i_rRelativeURL )
121 ENSURE_OR_RETURN( !i_rBaseURL.isEmpty(), "illegal base URL", i_rRelativeURL );
123 ::rtl::OUStringBuffer aComposer( i_rBaseURL );
124 if ( i_rBaseURL.getStr()[ i_rBaseURL.getLength() - 1 ] != '/' )
125 aComposer.append( sal_Unicode( '/' ) );
126 aComposer.append( i_rRelativeURL );
127 return aComposer.makeStringAndClear();
130 //--------------------------------------------------------------------------------------------------------------
131 struct SelectPropertyName : public ::std::unary_function< Property, ::rtl::OUString >
133 const ::rtl::OUString& operator()( const Property& i_rProperty ) const
135 return i_rProperty.Name;
140 //==================================================================================================================
141 //= Content
142 //==================================================================================================================
143 //------------------------------------------------------------------------------------------------------------------
144 Content::Content( const Reference< XMultiServiceFactory >& i_rORB, ::ucbhelper::ContentProviderImplHelper* i_pProvider,
145 const Reference< XContentIdentifier >& i_rIdentifier )
146 :Content_Base( i_rORB, i_pProvider, i_rIdentifier )
147 ,m_eExtContentType( E_UNKNOWN )
148 ,m_aIsFolder()
149 ,m_aContentType()
150 ,m_sExtensionId()
151 ,m_sPathIntoExtension()
153 const ::rtl::OUString sURL( getIdentifier()->getContentIdentifier() );
154 if ( denotesRootContent( sURL ) )
156 m_eExtContentType = E_ROOT;
158 else
160 const ::rtl::OUString sRelativeURL( sURL.copy( ContentProvider::getRootURL().getLength() ) );
161 const sal_Int32 nSepPos = sRelativeURL.indexOf( '/' );
162 if ( ( nSepPos == -1 ) || ( nSepPos == sRelativeURL.getLength() - 1 ) )
164 m_eExtContentType = E_EXTENSION_ROOT;
166 else
168 m_eExtContentType = E_EXTENSION_CONTENT;
172 if ( m_eExtContentType != E_ROOT )
174 const ::rtl::OUString sRootURL = ContentProvider::getRootURL();
175 m_sExtensionId = sURL.copy( sRootURL.getLength() );
177 const sal_Int32 nNextSep = m_sExtensionId.indexOf( '/' );
178 if ( nNextSep > -1 )
180 m_sPathIntoExtension = m_sExtensionId.copy( nNextSep + 1 );
181 m_sExtensionId = m_sExtensionId.copy( 0, nNextSep );
183 m_sExtensionId = Content::decodeIdentifier( m_sExtensionId );
187 //------------------------------------------------------------------------------------------------------------------
188 Content::~Content()
192 //------------------------------------------------------------------------------------------------------------------
193 ::rtl::OUString SAL_CALL Content::getImplementationName() throw( RuntimeException )
195 return ::rtl::OUString( "org.openoffice.comp.ucp.ext.Content" );
198 //------------------------------------------------------------------------------------------------------------------
199 Sequence< ::rtl::OUString > SAL_CALL Content::getSupportedServiceNames() throw( RuntimeException )
201 Sequence< ::rtl::OUString > aServiceNames(2);
202 aServiceNames[0] = ::rtl::OUString( "com.sun.star.ucb.Content" );
203 aServiceNames[1] = ::rtl::OUString( "com.sun.star.ucb.ExtensionContent" );
204 return aServiceNames;
207 //------------------------------------------------------------------------------------------------------------------
208 ::rtl::OUString SAL_CALL Content::getContentType() throw( RuntimeException )
210 impl_determineContentType();
211 return *m_aContentType;
214 //------------------------------------------------------------------------------------------------------------------
215 Any SAL_CALL Content::execute( const Command& aCommand, sal_Int32 /* CommandId */, const Reference< XCommandEnvironment >& i_rEvironment )
216 throw( Exception, CommandAbortedException, RuntimeException )
218 Any aRet;
220 if ( aCommand.Name == "getPropertyValues" )
222 Sequence< Property > Properties;
223 if ( !( aCommand.Argument >>= Properties ) )
225 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
226 ::rtl::OUString(), *this, -1 ) ),
227 i_rEvironment );
228 // unreachable
231 aRet <<= getPropertyValues( Properties, i_rEvironment );
233 else if ( aCommand.Name == "setPropertyValues" )
235 Sequence< PropertyValue > aProperties;
236 if ( !( aCommand.Argument >>= aProperties ) )
238 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
239 ::rtl::OUString(), *this, -1 ) ),
240 i_rEvironment );
241 // unreachable
244 if ( !aProperties.getLength() )
246 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
247 ::rtl::OUString(), *this, -1 ) ),
248 i_rEvironment );
249 // unreachable
252 aRet <<= setPropertyValues( aProperties, i_rEvironment );
254 else if ( aCommand.Name == "getPropertySetInfo" )
256 // implemented by base class.
257 aRet <<= getPropertySetInfo( i_rEvironment );
259 else if ( aCommand.Name == "getCommandInfo" )
261 // implemented by base class.
262 aRet <<= getCommandInfo( i_rEvironment );
264 else if ( aCommand.Name == "open" )
266 OpenCommandArgument2 aOpenCommand;
267 if ( !( aCommand.Argument >>= aOpenCommand ) )
269 ::ucbhelper::cancelCommandExecution( makeAny( IllegalArgumentException(
270 ::rtl::OUString(), *this, -1 ) ),
271 i_rEvironment );
272 // unreachable
275 sal_Bool bOpenFolder =
276 ( ( aOpenCommand.Mode == OpenMode::ALL ) ||
277 ( aOpenCommand.Mode == OpenMode::FOLDERS ) ||
278 ( aOpenCommand.Mode == OpenMode::DOCUMENTS ) );
281 if ( bOpenFolder && impl_isFolder() )
283 Reference< XDynamicResultSet > xSet = new ResultSet(
284 m_xSMgr, this, aOpenCommand, i_rEvironment );
285 aRet <<= xSet;
288 if ( aOpenCommand.Sink.is() )
290 const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() );
291 ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEvironment );
292 aRet = aRequestedContent.executeCommand( ::rtl::OUString( "open" ), makeAny( aOpenCommand ) );
296 else
298 ::ucbhelper::cancelCommandExecution( makeAny( UnsupportedCommandException(
299 ::rtl::OUString(), *this ) ),
300 i_rEvironment );
301 // unreachable
304 return aRet;
307 //------------------------------------------------------------------------------------------------------------------
308 void SAL_CALL Content::abort( sal_Int32 ) throw( RuntimeException )
312 //------------------------------------------------------------------------------------------------------------------
313 ::rtl::OUString Content::encodeIdentifier( const ::rtl::OUString& i_rIdentifier )
315 return ::rtl::Uri::encode( i_rIdentifier, rtl_UriCharClassRegName, rtl_UriEncodeIgnoreEscapes,
316 RTL_TEXTENCODING_UTF8 );
319 //------------------------------------------------------------------------------------------------------------------
320 ::rtl::OUString Content::decodeIdentifier( const ::rtl::OUString& i_rIdentifier )
322 return ::rtl::Uri::decode( i_rIdentifier, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
325 //------------------------------------------------------------------------------------------------------------------
326 bool Content::denotesRootContent( const ::rtl::OUString& i_rContentIdentifier )
328 const ::rtl::OUString sRootURL( ContentProvider::getRootURL() );
329 if ( i_rContentIdentifier == sRootURL )
330 return true;
332 // the root URL contains only two trailing /, but we also recognize 3 of them as denoting the root URL
333 if ( i_rContentIdentifier.match( sRootURL )
334 && ( i_rContentIdentifier.getLength() == sRootURL.getLength() + 1 )
335 && ( i_rContentIdentifier[ i_rContentIdentifier.getLength() - 1 ] == '/' )
337 return true;
339 return false;
342 //------------------------------------------------------------------------------------------------------------------
343 ::rtl::OUString Content::getParentURL()
345 const ::rtl::OUString sRootURL( ContentProvider::getRootURL() );
347 switch ( m_eExtContentType )
349 case E_ROOT:
350 // don't have a parent
351 return sRootURL;
353 case E_EXTENSION_ROOT:
354 // our parent is the root itself
355 return sRootURL;
357 case E_EXTENSION_CONTENT:
359 const ::rtl::OUString sURL = m_xIdentifier->getContentIdentifier();
361 // cut the root URL
362 if ( !sURL.match( sRootURL, 0 ) )
364 SAL_INFO( "ucb.ucp", "illegal URL structure - no root" );
365 break;
368 ::rtl::OUString sRelativeURL( sURL.copy( sRootURL.getLength() ) );
370 // cut the extension ID
371 const ::rtl::OUString sSeparatedExtensionId( encodeIdentifier( m_sExtensionId ) + ::rtl::OUString( sal_Unicode( '/' ) ) );
372 if ( !sRelativeURL.match( sSeparatedExtensionId ) )
374 SAL_INFO( "ucb.ucp", "illegal URL structure - no extension ID" );
375 break;
378 sRelativeURL = sRelativeURL.copy( sSeparatedExtensionId.getLength() );
380 // cut the final slash (if any)
381 if ( sRelativeURL.isEmpty() )
383 SAL_INFO( "ucb.ucp", "illegal URL structure - ExtensionContent should have a level below the extension ID" );
384 break;
387 if ( sRelativeURL.getStr()[ sRelativeURL.getLength() - 1 ] == '/' )
388 sRelativeURL = sRelativeURL.copy( 0, sRelativeURL.getLength() - 1 );
390 // remove the last segment
391 const sal_Int32 nLastSep = sRelativeURL.lastIndexOf( '/' );
392 sRelativeURL = sRelativeURL.copy( 0, nLastSep != -1 ? nLastSep : 0 );
394 ::rtl::OUStringBuffer aComposer;
395 aComposer.append( sRootURL );
396 aComposer.append( sSeparatedExtensionId );
397 aComposer.append( sRelativeURL );
398 return aComposer.makeStringAndClear();
401 default:
402 OSL_FAIL( "Content::getParentURL: unhandled case!" );
403 break;
405 return ::rtl::OUString();
408 //------------------------------------------------------------------------------------------------------------------
409 Reference< XRow > Content::getArtificialNodePropertyValues( const Reference< XMultiServiceFactory >& i_rORB,
410 const Sequence< Property >& i_rProperties, const ::rtl::OUString& i_rTitle )
412 // note: empty sequence means "get values of all supported properties".
413 ::rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( i_rORB );
415 const sal_Int32 nCount = i_rProperties.getLength();
416 if ( nCount )
418 Reference< XPropertySet > xAdditionalPropSet;
420 const Property* pProps = i_rProperties.getConstArray();
421 for ( sal_Int32 n = 0; n < nCount; ++n )
423 const Property& rProp = pProps[ n ];
425 // Process Core properties.
426 if ( rProp.Name == "ContentType" )
428 xRow->appendString ( rProp, ContentProvider::getArtificialNodeContentType() );
430 else if ( rProp.Name == "Title" )
432 xRow->appendString ( rProp, i_rTitle );
434 else if ( rProp.Name == "IsDocument" )
436 xRow->appendBoolean( rProp, sal_False );
438 else if ( rProp.Name == "IsFolder" )
440 xRow->appendBoolean( rProp, sal_True );
442 else
444 // append empty entry.
445 xRow->appendVoid( rProp );
449 else
451 // Append all Core Properties.
452 xRow->appendString ( Property( ::rtl::OUString("ContentType"),
454 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
455 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
456 ContentProvider::getArtificialNodeContentType() );
457 xRow->appendString ( Property( ::rtl::OUString("Title"),
459 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
460 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
461 i_rTitle );
462 xRow->appendBoolean( Property( ::rtl::OUString("IsDocument"),
464 getCppuBooleanType(),
465 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
466 sal_False );
467 xRow->appendBoolean( Property( ::rtl::OUString("IsFolder"),
469 getCppuBooleanType(),
470 PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
471 sal_True );
474 return Reference< XRow >( xRow.get() );
477 //------------------------------------------------------------------------------------------------------------------
478 ::rtl::OUString Content::getPhysicalURL() const
480 ENSURE_OR_RETURN( m_eExtContentType != E_ROOT, "illegal call", ::rtl::OUString() );
482 // create an ucb::XContent for the physical file within the deployed extension
483 const ::comphelper::ComponentContext aContext( m_xSMgr );
484 const Reference< XPackageInformationProvider > xPackageInfo(
485 aContext.getSingleton( "com.sun.star.deployment.PackageInformationProvider" ), UNO_QUERY_THROW );
486 const ::rtl::OUString sPackageLocation( xPackageInfo->getPackageLocation( m_sExtensionId ) );
488 if ( m_sPathIntoExtension.isEmpty() )
489 return sPackageLocation;
490 return lcl_compose( sPackageLocation, m_sPathIntoExtension );
493 //------------------------------------------------------------------------------------------------------------------
494 Reference< XRow > Content::getPropertyValues( const Sequence< Property >& i_rProperties, const Reference< XCommandEnvironment >& i_rEnv )
496 ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
498 switch ( m_eExtContentType )
500 case E_ROOT:
501 return getArtificialNodePropertyValues( m_xSMgr, i_rProperties, ContentProvider::getRootURL() );
502 case E_EXTENSION_ROOT:
503 return getArtificialNodePropertyValues( m_xSMgr, i_rProperties, m_sExtensionId );
504 case E_EXTENSION_CONTENT:
506 const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() );
507 ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEnv );
509 // translate the property request
510 Sequence< ::rtl::OUString > aPropertyNames( i_rProperties.getLength() );
511 ::std::transform(
512 i_rProperties.getConstArray(),
513 i_rProperties.getConstArray() + i_rProperties.getLength(),
514 aPropertyNames.getArray(),
515 SelectPropertyName()
517 const Sequence< Any > aPropertyValues = aRequestedContent.getPropertyValues( aPropertyNames );
518 const ::rtl::Reference< ::ucbhelper::PropertyValueSet > xValueRow = new ::ucbhelper::PropertyValueSet( m_xSMgr );
519 sal_Int32 i=0;
520 for ( const Any* value = aPropertyValues.getConstArray();
521 value != aPropertyValues.getConstArray() + aPropertyValues.getLength();
522 ++value, ++i
525 xValueRow->appendObject( aPropertyNames[i], *value );
527 return xValueRow.get();
530 default:
531 OSL_FAIL( "Content::getPropertyValues: unhandled case!" );
532 break;
535 OSL_FAIL( "Content::getPropertyValues: unreachable!" );
536 return NULL;
539 //------------------------------------------------------------------------------------------------------------------
540 Sequence< Any > Content::setPropertyValues( const Sequence< PropertyValue >& i_rValues, const Reference< XCommandEnvironment >& /* xEnv */)
542 ::osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
544 Sequence< Any > aRet( i_rValues.getLength() );
545 Sequence< PropertyChangeEvent > aChanges( i_rValues.getLength() );
547 PropertyChangeEvent aEvent;
548 aEvent.Source = static_cast< cppu::OWeakObject * >( this );
549 aEvent.Further = sal_False;
550 aEvent.PropertyHandle = -1;
552 const PropertyValue* pValues = i_rValues.getConstArray();
553 const sal_Int32 nCount = i_rValues.getLength();
555 for ( sal_Int32 n = 0; n < nCount; ++n, ++pValues )
557 // all our properties are read-only ...
558 aRet[ n ] <<= IllegalAccessException( ::rtl::OUString("property is read-only."), *this );
561 return aRet;
564 //------------------------------------------------------------------------------------------------------------------
565 Sequence< CommandInfo > Content::getCommands( const Reference< XCommandEnvironment > & /*xEnv*/ )
567 sal_uInt32 nCommandCount = 5;
568 static const CommandInfo aCommandInfoTable[] =
570 ///////////////////////////////////////////////////////////////
571 // Mandatory commands
572 ///////////////////////////////////////////////////////////////
573 CommandInfo(
574 ::rtl::OUString( "getCommandInfo" ),
576 getCppuVoidType()
578 CommandInfo(
579 ::rtl::OUString( "getPropertySetInfo" ),
581 getCppuVoidType()
583 CommandInfo(
584 ::rtl::OUString( "getPropertyValues" ),
586 getCppuType(
587 static_cast< Sequence< Property > * >( 0 ) )
589 CommandInfo(
590 ::rtl::OUString( "setPropertyValues" ),
592 getCppuType(
593 static_cast< Sequence< PropertyValue > * >( 0 ) )
595 ///////////////////////////////////////////////////////////////
596 // Optional standard commands
597 ///////////////////////////////////////////////////////////////
598 , CommandInfo(
599 ::rtl::OUString( "open" ),
601 getCppuType( static_cast< OpenCommandArgument2 * >( 0 ) )
605 return Sequence< CommandInfo >( aCommandInfoTable, nCommandCount );
608 //------------------------------------------------------------------------------------------------------------------
609 Sequence< Property > Content::getProperties( const Reference< XCommandEnvironment > & /*xEnv*/ )
611 static Property aProperties[] =
613 Property(
614 ::rtl::OUString( "ContentType" ),
616 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
617 PropertyAttribute::BOUND | PropertyAttribute::READONLY
619 Property(
620 ::rtl::OUString( "IsDocument" ),
622 getCppuBooleanType(),
623 PropertyAttribute::BOUND | PropertyAttribute::READONLY
625 Property(
626 ::rtl::OUString( "IsFolder" ),
628 getCppuBooleanType(),
629 PropertyAttribute::BOUND | PropertyAttribute::READONLY
631 Property(
632 ::rtl::OUString( "Title" ),
634 getCppuType( static_cast< const ::rtl::OUString * >( 0 ) ),
635 PropertyAttribute::BOUND | PropertyAttribute::READONLY
638 return Sequence< Property >( aProperties, sizeof( aProperties ) / sizeof( aProperties[0] ) );
641 //------------------------------------------------------------------------------------------------------------------
642 bool Content::impl_isFolder()
644 if ( !!m_aIsFolder )
645 return *m_aIsFolder;
647 bool bIsFolder = false;
650 Sequence< Property > aProps(1);
651 aProps[0].Name = ::rtl::OUString( "IsFolder" );
652 Reference< XRow > xRow( getPropertyValues( aProps, NULL ), UNO_SET_THROW );
653 bIsFolder = xRow->getBoolean(1);
655 catch( const Exception& )
657 DBG_UNHANDLED_EXCEPTION();
659 m_aIsFolder.reset( bIsFolder );
660 return *m_aIsFolder;
663 //------------------------------------------------------------------------------------------------------------------
664 void Content::impl_determineContentType()
666 if ( !!m_aContentType )
667 return;
669 m_aContentType.reset( ContentProvider::getArtificialNodeContentType() );
670 if ( m_eExtContentType == E_EXTENSION_CONTENT )
674 Sequence< Property > aProps(1);
675 aProps[0].Name = ::rtl::OUString( "ContentType" );
676 Reference< XRow > xRow( getPropertyValues( aProps, NULL ), UNO_SET_THROW );
677 m_aContentType.reset( xRow->getString(1) );
679 catch( const Exception& )
681 DBG_UNHANDLED_EXCEPTION();
686 //......................................................................................................................
687 } } } // namespace ucp::ext
688 //......................................................................................................................
690 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */