xref: /aoo41x/main/ucb/source/ucp/file/bc.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_ucb.hxx"
30 #include <rtl/uri.hxx>
31 #include <rtl/ustrbuf.hxx>
32 #include <osl/file.hxx>
33 
34 #include "osl/diagnose.h"
35 #include <com/sun/star/ucb/OpenMode.hpp>
36 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_
37 #include <com/sun/star/beans/PropertyAttribute.hpp>
38 #endif
39 #include <com/sun/star/ucb/XProgressHandler.hpp>
40 #include <com/sun/star/task/XInteractionHandler.hpp>
41 #include <com/sun/star/io/XActiveDataStreamer.hpp>
42 #include <com/sun/star/io/XOutputStream.hpp>
43 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
44 #include <com/sun/star/io/XActiveDataSink.hpp>
45 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
46 #include <com/sun/star/beans/PropertySetInfoChange.hpp>
47 #include <com/sun/star/ucb/ContentAction.hpp>
48 #include <com/sun/star/ucb/NameClash.hpp>
49 #include "filglob.hxx"
50 #include "filid.hxx"
51 #include "filrow.hxx"
52 #include "bc.hxx"
53 #include "prov.hxx"
54 #ifndef _FILERROR_HXX_
55 #include "filerror.hxx"
56 #endif
57 #include "filinsreq.hxx"
58 
59 
60 using namespace fileaccess;
61 using namespace com::sun::star;
62 using namespace com::sun::star::uno;
63 using namespace com::sun::star::ucb;
64 
65 // PropertyListeners
66 
67 
68 typedef cppu::OMultiTypeInterfaceContainerHelperVar< rtl::OUString,hashOUString,equalOUString >
69 PropertyListeners_impl;
70 
71 class fileaccess::PropertyListeners
72     : public PropertyListeners_impl
73 {
74 public:
75     PropertyListeners( ::osl::Mutex& aMutex )
76         : PropertyListeners_impl( aMutex )
77     {
78     }
79 };
80 
81 
82 /****************************************************************************************/
83 /*                                                                                      */
84 /*                    BaseContent                                                       */
85 /*                                                                                      */
86 /****************************************************************************************/
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 // Private Constructor for just inserted Contents
90 
91 BaseContent::BaseContent( shell* pMyShell,
92                           const rtl::OUString& parentName,
93                           sal_Bool bFolder )
94     : m_pMyShell( pMyShell ),
95       m_xContentIdentifier( 0 ),
96       m_aUncPath( parentName ),
97       m_bFolder( bFolder ),
98       m_nState( JustInserted ),
99       m_pDisposeEventListeners( 0 ),
100       m_pContentEventListeners( 0 ),
101       m_pPropertySetInfoChangeListeners( 0 ),
102       m_pPropertyListener( 0 )
103 {
104     m_pMyShell->m_pProvider->acquire();
105     // No registering, since we have no name
106 }
107 
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 // Constructor for full featured Contents
111 
112 BaseContent::BaseContent( shell* pMyShell,
113                           const Reference< XContentIdentifier >& xContentIdentifier,
114                           const rtl::OUString& aUncPath )
115     : m_pMyShell( pMyShell ),
116       m_xContentIdentifier( xContentIdentifier ),
117       m_aUncPath( aUncPath ),
118       m_bFolder( false ),
119       m_nState( FullFeatured ),
120       m_pDisposeEventListeners( 0 ),
121       m_pContentEventListeners( 0 ),
122       m_pPropertySetInfoChangeListeners( 0 ),
123       m_pPropertyListener( 0 )
124 {
125     m_pMyShell->m_pProvider->acquire();
126     m_pMyShell->registerNotifier( m_aUncPath,this );
127     m_pMyShell->insertDefaultProperties( m_aUncPath );
128 }
129 
130 
131 BaseContent::~BaseContent( )
132 {
133     if( ( m_nState & FullFeatured ) || ( m_nState & Deleted ) )
134     {
135         m_pMyShell->deregisterNotifier( m_aUncPath,this );
136     }
137     m_pMyShell->m_pProvider->release();
138 
139     delete m_pDisposeEventListeners;
140     delete m_pContentEventListeners;
141     delete m_pPropertyListener;
142     delete m_pPropertySetInfoChangeListeners;
143 }
144 
145 
146 //////////////////////////////////////////////////////////////////////////
147 // XInterface
148 //////////////////////////////////////////////////////////////////////////
149 
150 void SAL_CALL
151 BaseContent::acquire( void )
152     throw()
153 {
154     OWeakObject::acquire();
155 }
156 
157 
158 void SAL_CALL
159 BaseContent::release( void )
160     throw()
161 {
162     OWeakObject::release();
163 }
164 
165 
166 Any SAL_CALL
167 BaseContent::queryInterface( const Type& rType )
168     throw( RuntimeException )
169 {
170     Any aRet = cppu::queryInterface( rType,
171                                      SAL_STATIC_CAST( lang::XComponent*, this ),
172                                      SAL_STATIC_CAST( lang::XTypeProvider*, this ),
173                                      SAL_STATIC_CAST( lang::XServiceInfo*, this ),
174                                      SAL_STATIC_CAST( XCommandProcessor*, this ),
175                                      SAL_STATIC_CAST( container::XChild*, this ),
176                                      SAL_STATIC_CAST( beans::XPropertiesChangeNotifier*, this ),
177                                      SAL_STATIC_CAST( beans::XPropertyContainer*, this ),
178                                      SAL_STATIC_CAST( XContentCreator*,this ),
179                                      SAL_STATIC_CAST( beans::XPropertySetInfoChangeNotifier*, this ),
180                                      SAL_STATIC_CAST( XContent*,this) );
181     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
182 }
183 
184 
185 
186 
187 //////////////////////////////////////////////////////////////////////////////////////////
188 // XComponent
189 ////////////////////////////////////////////////////////////////////////////////////////
190 
191 void SAL_CALL
192 BaseContent::addEventListener( const Reference< lang::XEventListener >& Listener )
193     throw( RuntimeException )
194 {
195     osl::MutexGuard aGuard( m_aMutex );
196 
197     if ( ! m_pDisposeEventListeners )
198         m_pDisposeEventListeners =
199             new cppu::OInterfaceContainerHelper( m_aEventListenerMutex );
200 
201     m_pDisposeEventListeners->addInterface( Listener );
202 }
203 
204 
205 void SAL_CALL
206 BaseContent::removeEventListener( const Reference< lang::XEventListener >& Listener )
207     throw( RuntimeException )
208 {
209     osl::MutexGuard aGuard( m_aMutex );
210 
211     if ( m_pDisposeEventListeners )
212         m_pDisposeEventListeners->removeInterface( Listener );
213 }
214 
215 
216 void SAL_CALL
217 BaseContent::dispose()
218     throw( RuntimeException )
219 {
220     lang::EventObject aEvt;
221     cppu::OInterfaceContainerHelper* pDisposeEventListeners;
222     cppu::OInterfaceContainerHelper* pContentEventListeners;
223     cppu::OInterfaceContainerHelper* pPropertySetInfoChangeListeners;
224     PropertyListeners* pPropertyListener;
225 
226     {
227         osl::MutexGuard aGuard( m_aMutex );
228         aEvt.Source = static_cast< XContent* >( this );
229 
230 
231         pDisposeEventListeners =
232             m_pDisposeEventListeners, m_pDisposeEventListeners = 0;
233 
234         pContentEventListeners =
235             m_pContentEventListeners, m_pContentEventListeners = 0;
236 
237         pPropertySetInfoChangeListeners =
238             m_pPropertySetInfoChangeListeners,
239             m_pPropertySetInfoChangeListeners = 0;
240 
241         pPropertyListener =
242             m_pPropertyListener, m_pPropertyListener = 0;
243     }
244 
245     if ( pDisposeEventListeners && pDisposeEventListeners->getLength() )
246         pDisposeEventListeners->disposeAndClear( aEvt );
247 
248     if ( pContentEventListeners && pContentEventListeners->getLength() )
249         pContentEventListeners->disposeAndClear( aEvt );
250 
251     if( pPropertyListener )
252         pPropertyListener->disposeAndClear( aEvt );
253 
254     if( pPropertySetInfoChangeListeners )
255         pPropertySetInfoChangeListeners->disposeAndClear( aEvt );
256 
257     delete pDisposeEventListeners;
258     delete pContentEventListeners;
259     delete pPropertyListener;
260     delete pPropertySetInfoChangeListeners;
261 }
262 
263 
264 
265 //////////////////////////////////////////////////////////////////////////////////////////
266 //  XServiceInfo
267 //////////////////////////////////////////////////////////////////////////////////////////
268 
269 rtl::OUString SAL_CALL
270 BaseContent::getImplementationName()
271     throw( RuntimeException)
272 {
273     return rtl::OUString::createFromAscii( "com.sun.star.comp.ucb.FileContent" );
274 }
275 
276 
277 
278 sal_Bool SAL_CALL
279 BaseContent::supportsService( const rtl::OUString& ServiceName )
280     throw( RuntimeException)
281 {
282     if( ServiceName.compareToAscii( "com.sun.star.ucb.FileContent" ) == 0 )
283         return true;
284     else
285         return false;
286 }
287 
288 
289 
290 Sequence< rtl::OUString > SAL_CALL
291 BaseContent::getSupportedServiceNames()
292     throw( RuntimeException )
293 {
294     Sequence< rtl::OUString > ret( 1 );
295     ret[0] = rtl::OUString::createFromAscii( "com.sun.star.ucb.FileContent" );
296     return ret;
297 }
298 
299 
300 
301 //////////////////////////////////////////////////////////////////////////////////////////
302 //  XTypeProvider
303 //////////////////////////////////////////////////////////////////////////////////////////
304 
305 XTYPEPROVIDER_IMPL_10( BaseContent,
306                        lang::XComponent,
307                        lang::XTypeProvider,
308                        lang::XServiceInfo,
309                        XCommandProcessor,
310                        XContentCreator,
311                        XContent,
312                        container::XChild,
313                        beans::XPropertiesChangeNotifier,
314                        beans::XPropertyContainer,
315                        beans::XPropertySetInfoChangeNotifier )
316 
317 
318 //////////////////////////////////////////////////////////////////////////////////////////
319 //  XCommandProcessor
320 //////////////////////////////////////////////////////////////////////////////////////////
321 
322 sal_Int32 SAL_CALL
323 BaseContent::createCommandIdentifier( void )
324     throw( RuntimeException )
325 {
326     return m_pMyShell->getCommandId();
327 }
328 
329 
330 void SAL_CALL
331 BaseContent::abort( sal_Int32 CommandId )
332     throw( RuntimeException )
333 {
334     m_pMyShell->abort( CommandId );
335 }
336 
337 
338 Any SAL_CALL
339 BaseContent::execute( const Command& aCommand,
340                       sal_Int32 CommandId,
341                       const Reference< XCommandEnvironment >& Environment )
342     throw( Exception,
343            CommandAbortedException,
344            RuntimeException )
345 {
346     if( ! CommandId )
347         // A Command with commandid zero cannot be aborted
348         CommandId = createCommandIdentifier();
349 
350     m_pMyShell->startTask( CommandId,
351                            Environment );
352 
353     Any aAny;
354 
355     if( ! aCommand.Name.compareToAscii( "getPropertySetInfo" ) )  // No exceptions
356     {
357         aAny <<= getPropertySetInfo( CommandId );
358     }
359     else if( ! aCommand.Name.compareToAscii( "getCommandInfo" ) )  // no exceptions
360     {
361         aAny <<= getCommandInfo();
362     }
363     else if( ! aCommand.Name.compareToAscii( "setPropertyValues" ) )
364     {
365         Sequence< beans::PropertyValue > sPropertyValues;
366 
367         if( ! ( aCommand.Argument >>= sPropertyValues ) )
368             m_pMyShell->installError( CommandId,
369                                       TASKHANDLING_WRONG_SETPROPERTYVALUES_ARGUMENT );
370         else
371             aAny <<= setPropertyValues( CommandId,sPropertyValues );  // calls endTask by itself
372     }
373     else if( ! aCommand.Name.compareToAscii( "getPropertyValues" ) )
374     {
375         Sequence< beans::Property > ListOfRequestedProperties;
376 
377         if( ! ( aCommand.Argument >>= ListOfRequestedProperties ) )
378             m_pMyShell->installError( CommandId,
379                                       TASKHANDLING_WRONG_GETPROPERTYVALUES_ARGUMENT );
380         else
381             aAny <<= getPropertyValues( CommandId,
382                                         ListOfRequestedProperties );
383     }
384     else if( ! aCommand.Name.compareToAscii( "open" ) )
385     {
386         OpenCommandArgument2 aOpenArgument;
387         if( ! ( aCommand.Argument >>= aOpenArgument ) )
388             m_pMyShell->installError( CommandId,
389                                       TASKHANDLING_WRONG_OPEN_ARGUMENT );
390         else
391         {
392             Reference< XDynamicResultSet > result = open( CommandId,aOpenArgument );
393             if( result.is() )
394                 aAny <<= result;
395         }
396     }
397     else if( ! aCommand.Name.compareToAscii( "delete" ) )
398     {
399         if( ! aCommand.Argument.has< sal_Bool >() )
400             m_pMyShell->installError( CommandId,
401                                       TASKHANDLING_WRONG_DELETE_ARGUMENT );
402         else
403             deleteContent( CommandId );
404     }
405     else if( ! aCommand.Name.compareToAscii( "transfer" ) )
406     {
407         TransferInfo aTransferInfo;
408         if( ! ( aCommand.Argument >>= aTransferInfo ) )
409             m_pMyShell->installError( CommandId,
410                                       TASKHANDLING_WRONG_TRANSFER_ARGUMENT );
411         else
412             transfer( CommandId, aTransferInfo );
413     }
414     else if( ! aCommand.Name.compareToAscii( "insert" ) )
415     {
416         InsertCommandArgument aInsertArgument;
417         if( ! ( aCommand.Argument >>= aInsertArgument ) )
418             m_pMyShell->installError( CommandId,
419                                       TASKHANDLING_WRONG_INSERT_ARGUMENT );
420         else
421             insert( CommandId,aInsertArgument );
422     }
423     else if( ! aCommand.Name.compareToAscii( "getCasePreservingURL" ) )
424     {
425         Sequence< beans::Property > seq(1);
426         seq[0] = beans::Property(
427             rtl::OUString::createFromAscii("CasePreservingURL"),
428             -1,
429             getCppuType( static_cast< sal_Bool* >(0) ),
430             0 );
431         Reference< sdbc::XRow > xRow = getPropertyValues( CommandId,seq );
432         rtl::OUString CasePreservingURL = xRow->getString(1);
433         if(!xRow->wasNull())
434             aAny <<= CasePreservingURL;
435     }
436     else if( ! aCommand.Name.compareToAscii( "createNewContent" ) )
437     {
438         ucb::ContentInfo aArg;
439         if ( !( aCommand.Argument >>= aArg ) )
440             m_pMyShell->installError( CommandId,
441                                       TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT );
442         else
443             aAny <<= createNewContent( aArg );
444     }
445     else
446         m_pMyShell->installError( CommandId,
447                                   TASKHANDLER_UNSUPPORTED_COMMAND );
448 
449 
450     // This is the only function allowed to throw an exception
451     endTask( CommandId );
452 
453     return aAny;
454 }
455 
456 
457 
458 void SAL_CALL
459 BaseContent::addPropertiesChangeListener(
460     const Sequence< rtl::OUString >& PropertyNames,
461     const Reference< beans::XPropertiesChangeListener >& Listener )
462     throw( RuntimeException )
463 {
464     if( ! Listener.is() )
465         return;
466 
467     osl::MutexGuard aGuard( m_aMutex );
468 
469     if( ! m_pPropertyListener )
470         m_pPropertyListener = new PropertyListeners( m_aEventListenerMutex );
471 
472 
473     if( PropertyNames.getLength() == 0 )
474         m_pPropertyListener->addInterface( rtl::OUString(),Listener );
475     else
476     {
477         Reference< beans::XPropertySetInfo > xProp = m_pMyShell->info_p( m_aUncPath );
478         for( sal_Int32 i = 0; i < PropertyNames.getLength(); ++i )
479             if( xProp->hasPropertyByName( PropertyNames[i] ) )
480                 m_pPropertyListener->addInterface( PropertyNames[i],Listener );
481     }
482 }
483 
484 
485 void SAL_CALL
486 BaseContent::removePropertiesChangeListener( const Sequence< rtl::OUString >& PropertyNames,
487                                              const Reference< beans::XPropertiesChangeListener >& Listener )
488     throw( RuntimeException )
489 {
490     if( ! Listener.is() )
491         return;
492 
493     osl::MutexGuard aGuard( m_aMutex );
494 
495     if( ! m_pPropertyListener )
496         return;
497 
498     for( sal_Int32 i = 0; i < PropertyNames.getLength(); ++i )
499         m_pPropertyListener->removeInterface( PropertyNames[i],Listener );
500 
501     m_pPropertyListener->removeInterface( rtl::OUString(), Listener );
502 }
503 
504 
505 /////////////////////////////////////////////////////////////////////////////////////////
506 // XContent
507 /////////////////////////////////////////////////////////////////////////////////////////
508 
509 Reference< ucb::XContentIdentifier > SAL_CALL
510 BaseContent::getIdentifier()
511     throw( RuntimeException )
512 {
513     return m_xContentIdentifier;
514 }
515 
516 
517 rtl::OUString SAL_CALL
518 BaseContent::getContentType()
519     throw( RuntimeException )
520 {
521     if( !( m_nState & Deleted ) )
522     {
523         if( m_nState & JustInserted )
524         {
525             if ( m_bFolder )
526                 return m_pMyShell->FolderContentType;
527             else
528                 return m_pMyShell->FileContentType;
529         }
530         else
531         {
532             try
533             {
534                 // Who am I ?
535                 Sequence< beans::Property > seq(1);
536                 seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"),
537                                           -1,
538                                           getCppuType( static_cast< sal_Bool* >(0) ),
539                                           0 );
540                 Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
541                 sal_Bool IsDocument = xRow->getBoolean( 1 );
542 
543                 if ( !xRow->wasNull() )
544                 {
545                     if ( IsDocument )
546                         return m_pMyShell->FileContentType;
547                     else
548                         return m_pMyShell->FolderContentType;
549                 }
550                 else
551                 {
552                     OSL_ENSURE( false,
553                                 "BaseContent::getContentType - Property value was null!" );
554                 }
555             }
556             catch ( sdbc::SQLException const & )
557             {
558                 OSL_ENSURE( false,
559                             "BaseContent::getContentType - Caught SQLException!" );
560             }
561         }
562     }
563 
564     return rtl::OUString();
565 }
566 
567 
568 
569 void SAL_CALL
570 BaseContent::addContentEventListener(
571     const Reference< XContentEventListener >& Listener )
572     throw( RuntimeException )
573 {
574     osl::MutexGuard aGuard( m_aMutex );
575 
576     if ( ! m_pContentEventListeners )
577         m_pContentEventListeners =
578             new cppu::OInterfaceContainerHelper( m_aEventListenerMutex );
579 
580 
581     m_pContentEventListeners->addInterface( Listener );
582 }
583 
584 
585 void SAL_CALL
586 BaseContent::removeContentEventListener(
587     const Reference< XContentEventListener >& Listener )
588     throw( RuntimeException )
589 {
590     osl::MutexGuard aGuard( m_aMutex );
591 
592     if ( m_pContentEventListeners )
593         m_pContentEventListeners->removeInterface( Listener );
594 }
595 
596 
597 
598 ////////////////////////////////////////////////////////////////////////////////
599 // XPropertyContainer
600 ////////////////////////////////////////////////////////////////////////////////
601 
602 
603 void SAL_CALL
604 BaseContent::addProperty(
605     const rtl::OUString& Name,
606     sal_Int16 Attributes,
607     const Any& DefaultValue )
608     throw( beans::PropertyExistException,
609            beans::IllegalTypeException,
610            lang::IllegalArgumentException,
611            RuntimeException)
612 {
613     if( ( m_nState & JustInserted ) || ( m_nState & Deleted ) || Name == rtl::OUString() )
614     {
615         throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
616     }
617 
618     m_pMyShell->associate( m_aUncPath,Name,DefaultValue,Attributes );
619 }
620 
621 
622 void SAL_CALL
623 BaseContent::removeProperty(
624     const rtl::OUString& Name )
625     throw( beans::UnknownPropertyException,
626            beans::NotRemoveableException,
627            RuntimeException)
628 {
629 
630     if( m_nState & Deleted )
631         throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
632 
633     m_pMyShell->deassociate( m_aUncPath, Name );
634 }
635 
636 ////////////////////////////////////////////////////////////////////////////////
637 // XContentCreator
638 ////////////////////////////////////////////////////////////////////////////////
639 
640 Sequence< ContentInfo > SAL_CALL
641 BaseContent::queryCreatableContentsInfo(
642     void )
643     throw( RuntimeException )
644 {
645     return m_pMyShell->queryCreatableContentsInfo();
646 }
647 
648 
649 Reference< XContent > SAL_CALL
650 BaseContent::createNewContent(
651     const ContentInfo& Info )
652     throw( RuntimeException )
653 {
654     // Check type.
655     if ( !Info.Type.getLength() )
656         return Reference< XContent >();
657 
658     sal_Bool bFolder
659         = ( Info.Type.compareTo( m_pMyShell->FolderContentType ) == 0 );
660     if ( !bFolder )
661     {
662         if ( Info.Type.compareTo( m_pMyShell->FileContentType ) != 0 )
663         {
664             // Neither folder nor file to create!
665             return Reference< XContent >();
666         }
667     }
668 
669     // Who am I ?
670     sal_Bool IsDocument = false;
671 
672     try
673     {
674         Sequence< beans::Property > seq(1);
675         seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"),
676                                   -1,
677                                   getCppuType( static_cast< sal_Bool* >(0) ),
678                                   0 );
679         Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
680         IsDocument = xRow->getBoolean( 1 );
681 
682         if ( xRow->wasNull() )
683         {
684             IsDocument = false;
685 //              OSL_ENSURE( false,
686 //                          "BaseContent::createNewContent - Property value was null!" );
687 //              return Reference< XContent >();
688         }
689     }
690     catch ( sdbc::SQLException const & )
691     {
692         OSL_ENSURE( false,
693                     "BaseContent::createNewContent - Caught SQLException!" );
694         return Reference< XContent >();
695     }
696 
697     rtl::OUString dstUncPath;
698 
699     if( IsDocument )
700     {
701         // KSO: Why is a document a XContentCreator? This is quite unusual.
702         dstUncPath = getParentName( m_aUncPath );
703     }
704     else
705         dstUncPath = m_aUncPath;
706 
707     BaseContent* p = new BaseContent( m_pMyShell, dstUncPath, bFolder );
708     return Reference< XContent >( p );
709 }
710 
711 
712 ////////////////////////////////////////////////////////////////////////////////
713 // XPropertySetInfoChangeNotifier
714 ////////////////////////////////////////////////////////////////////////////////
715 
716 
717 void SAL_CALL
718 BaseContent::addPropertySetInfoChangeListener(
719     const Reference< beans::XPropertySetInfoChangeListener >& Listener )
720     throw( RuntimeException )
721 {
722     osl::MutexGuard aGuard( m_aMutex );
723     if( ! m_pPropertySetInfoChangeListeners )
724         m_pPropertySetInfoChangeListeners = new cppu::OInterfaceContainerHelper( m_aEventListenerMutex );
725 
726     m_pPropertySetInfoChangeListeners->addInterface( Listener );
727 }
728 
729 
730 void SAL_CALL
731 BaseContent::removePropertySetInfoChangeListener(
732     const Reference< beans::XPropertySetInfoChangeListener >& Listener )
733     throw( RuntimeException )
734 {
735     osl::MutexGuard aGuard( m_aMutex );
736 
737     if( m_pPropertySetInfoChangeListeners )
738         m_pPropertySetInfoChangeListeners->removeInterface( Listener );
739 }
740 
741 
742 ////////////////////////////////////////////////////////////////////////////////
743 // XChild
744 ////////////////////////////////////////////////////////////////////////////////
745 
746 Reference< XInterface > SAL_CALL
747 BaseContent::getParent(
748     void )
749     throw( RuntimeException )
750 {
751     rtl::OUString ParentUnq = getParentName( m_aUncPath );
752     rtl::OUString ParentUrl;
753 
754 
755     sal_Bool err = m_pMyShell->getUrlFromUnq( ParentUnq, ParentUrl );
756     if( err )
757         return Reference< XInterface >( 0 );
758 
759     FileContentIdentifier* p = new FileContentIdentifier( m_pMyShell,ParentUnq );
760     Reference< XContentIdentifier > Identifier( p );
761 
762     try
763     {
764         Reference< XContent > content = m_pMyShell->m_pProvider->queryContent( Identifier );
765         return Reference<XInterface>(content,UNO_QUERY);
766     }
767     catch( IllegalIdentifierException )
768     {
769         return Reference< XInterface >();
770     }
771 }
772 
773 
774 void SAL_CALL
775 BaseContent::setParent(
776     const Reference< XInterface >& )
777     throw( lang::NoSupportException,
778            RuntimeException)
779 {
780     throw lang::NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
781 }
782 
783 
784 //////////////////////////////////////////////////////////////////////////////////////////
785 // Private Methods
786 //////////////////////////////////////////////////////////////////////////////////////////
787 
788 
789 Reference< XCommandInfo > SAL_CALL
790 BaseContent::getCommandInfo()
791     throw( RuntimeException )
792 {
793     if( m_nState & Deleted )
794         return Reference< XCommandInfo >();
795 
796     return m_pMyShell->info_c();
797 }
798 
799 
800 Reference< beans::XPropertySetInfo > SAL_CALL
801 BaseContent::getPropertySetInfo(
802     sal_Int32 )
803     throw( RuntimeException )
804 {
805     if( m_nState & Deleted )
806         return Reference< beans::XPropertySetInfo >();
807 
808     return m_pMyShell->info_p( m_aUncPath );
809 }
810 
811 
812 
813 
814 Reference< sdbc::XRow > SAL_CALL
815 BaseContent::getPropertyValues(
816     sal_Int32 nMyCommandIdentifier,
817     const Sequence< beans::Property >& PropertySet )
818     throw( RuntimeException )
819 {
820     sal_Int32 nProps = PropertySet.getLength();
821     if ( !nProps )
822         return Reference< sdbc::XRow >();
823 
824     if( m_nState & Deleted )
825     {
826         Sequence< Any > aValues( nProps );
827         return Reference< sdbc::XRow >( new XRow_impl( m_pMyShell, aValues ) );
828     }
829 
830     if( m_nState & JustInserted )
831     {
832         Sequence< Any > aValues( nProps );
833         Any* pValues = aValues.getArray();
834 
835         const beans::Property* pProps = PropertySet.getConstArray();
836 
837         for ( sal_Int32 n = 0; n < nProps; ++n )
838         {
839             const beans::Property& rProp = pProps[ n ];
840             Any& rValue = pValues[ n ];
841 
842             if( rProp.Name.compareToAscii( "ContentType" ) == 0 )
843             {
844                 rValue <<= m_bFolder ? m_pMyShell->FolderContentType
845                     : m_pMyShell->FileContentType;
846             }
847             else if( rProp.Name.compareToAscii( "IsFolder" ) == 0 )
848             {
849                 rValue <<= m_bFolder;
850             }
851             else if( rProp.Name.compareToAscii( "IsDocument" ) == 0 )
852             {
853                 rValue <<= sal_Bool( !m_bFolder );
854             }
855         }
856 
857         return Reference< sdbc::XRow >(
858             new XRow_impl( m_pMyShell, aValues ) );
859     }
860 
861     return m_pMyShell->getv( nMyCommandIdentifier,
862                              m_aUncPath,
863                              PropertySet );
864 }
865 
866 
867 Sequence< Any > SAL_CALL
868 BaseContent::setPropertyValues(
869     sal_Int32 nMyCommandIdentifier,
870     const Sequence< beans::PropertyValue >& Values )
871     throw()
872 {
873     if( m_nState & Deleted )
874     {   //  To do
875         return Sequence< Any >( Values.getLength() );
876     }
877 
878     const rtl::OUString Title = rtl::OUString::createFromAscii( "Title" );
879 
880     // Special handling for files which have to be inserted
881     if( m_nState & JustInserted )
882     {
883         for( sal_Int32 i = 0; i < Values.getLength(); ++i )
884         {
885             if( Values[i].Name == Title )
886             {
887                 rtl::OUString NewTitle;
888                 if( Values[i].Value >>= NewTitle )
889                 {
890                     if ( m_nState & NameForInsertionSet )
891                     {
892                         // User wants to set another Title before "insert".
893                         // m_aUncPath contains previous own URI.
894 
895                         sal_Int32 nLastSlash = m_aUncPath.lastIndexOf( '/' );
896                         bool bTrailingSlash = false;
897                         if ( nLastSlash == m_aUncPath.getLength() - 1 )
898                         {
899                             bTrailingSlash = true;
900                             nLastSlash
901                                 = m_aUncPath.lastIndexOf( '/', nLastSlash );
902                         }
903 
904                         OSL_ENSURE( nLastSlash != -1,
905                                     "BaseContent::setPropertyValues: "
906                                     "Invalid URL!" );
907 
908                         rtl::OUStringBuffer aBuf(
909                             m_aUncPath.copy( 0, nLastSlash + 1 ) );
910 
911                         if ( NewTitle.getLength() > 0 )
912                         {
913                             aBuf.append( NewTitle );
914                             if ( bTrailingSlash )
915                                 aBuf.append( sal_Unicode( '/' ) );
916                         }
917                         else
918                         {
919                             m_nState &= ~NameForInsertionSet;
920                         }
921 
922                         m_aUncPath = aBuf.makeStringAndClear();
923                     }
924                     else
925                     {
926                         if ( NewTitle.getLength() > 0 )
927                         {
928                             // Initial Title before "insert".
929                             // m_aUncPath contains parent's URI.
930 
931                             if( m_aUncPath.lastIndexOf( sal_Unicode('/') ) != m_aUncPath.getLength() - 1 )
932                                 m_aUncPath += rtl::OUString::createFromAscii("/");
933 
934                             m_aUncPath += rtl::Uri::encode( NewTitle,
935                                                             rtl_UriCharClassPchar,
936                                                             rtl_UriEncodeIgnoreEscapes,
937                                                             RTL_TEXTENCODING_UTF8 );
938                             m_nState |= NameForInsertionSet;
939                         }
940                     }
941                 }
942             }
943         }
944 
945         return Sequence< Any >( Values.getLength() );
946     }
947     else
948     {
949         Sequence< Any > ret = m_pMyShell->setv( m_aUncPath,  // Does not handle Title
950                                                 Values );
951 
952         // Special handling Title: Setting Title is equivalent to a renaming of the underlying file
953         for( sal_Int32 i = 0; i < Values.getLength(); ++i )
954         {
955             if( Values[i].Name != Title )
956                 continue;                  // handled by setv
957 
958             rtl::OUString NewTitle;
959             if( !( Values[i].Value >>= NewTitle ) )
960             {
961                 ret[i] <<= beans::IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
962                 break;
963             }
964             else if( ! NewTitle.getLength() )
965             {
966                 ret[i] <<= lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
967                 break;
968             }
969 
970 
971             rtl::OUString aDstName = getParentName( m_aUncPath );
972             if( aDstName.lastIndexOf( sal_Unicode('/') ) != aDstName.getLength() - 1 )
973                 aDstName += rtl::OUString::createFromAscii("/");
974 
975             aDstName += rtl::Uri::encode( NewTitle,
976                                           rtl_UriCharClassPchar,
977                                           rtl_UriEncodeIgnoreEscapes,
978                                           RTL_TEXTENCODING_UTF8 );
979 
980             m_pMyShell->move( nMyCommandIdentifier,     // move notifies the childs also;
981                               m_aUncPath,
982                               aDstName,
983                               NameClash::KEEP );
984 
985             try
986             {
987                 endTask( nMyCommandIdentifier );
988             }
989             catch( const Exception& e )
990             {
991                 ret[i] <<= e;
992             }
993 
994             // NameChanges come back trough a ContentEvent
995             break; // only handling Title
996         } // end for
997 
998         return ret;
999     }
1000 }
1001 
1002 
1003 
1004 Reference< XDynamicResultSet > SAL_CALL
1005 BaseContent::open(
1006     sal_Int32 nMyCommandIdentifier,
1007     const OpenCommandArgument2& aCommandArgument )
1008     throw()
1009 {
1010     Reference< XDynamicResultSet > retValue( 0 );
1011 
1012     if( ( m_nState & Deleted ) )
1013     {
1014         m_pMyShell->installError( nMyCommandIdentifier,
1015                                   TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND );
1016     }
1017     else if( m_nState & JustInserted )
1018     {
1019         m_pMyShell->installError( nMyCommandIdentifier,
1020                                   TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND );
1021     }
1022     else
1023     {
1024         if( aCommandArgument.Mode == OpenMode::DOCUMENT ||
1025             aCommandArgument.Mode == OpenMode::DOCUMENT_SHARE_DENY_NONE )
1026 
1027         {
1028             Reference< io::XOutputStream > outputStream( aCommandArgument.Sink,UNO_QUERY );
1029             if( outputStream.is() )
1030             {
1031                 m_pMyShell->page( nMyCommandIdentifier,
1032                                   m_aUncPath,
1033                                   outputStream );
1034             }
1035 
1036             sal_Bool bLock = ( aCommandArgument.Mode != OpenMode::DOCUMENT_SHARE_DENY_NONE );
1037 
1038             Reference< io::XActiveDataSink > activeDataSink( aCommandArgument.Sink,UNO_QUERY );
1039             if( activeDataSink.is() )
1040             {
1041                 activeDataSink->setInputStream( m_pMyShell->open( nMyCommandIdentifier,
1042                                                                   m_aUncPath,
1043                                                                   bLock ) );
1044             }
1045 
1046             Reference< io::XActiveDataStreamer > activeDataStreamer( aCommandArgument.Sink,UNO_QUERY );
1047             if( activeDataStreamer.is() )
1048             {
1049                 activeDataStreamer->setStream( m_pMyShell->open_rw( nMyCommandIdentifier,
1050                                                                     m_aUncPath,
1051                                                                     bLock ) );
1052             }
1053         }
1054         else if ( aCommandArgument.Mode == OpenMode::ALL        ||
1055                   aCommandArgument.Mode == OpenMode::FOLDERS    ||
1056                   aCommandArgument.Mode == OpenMode::DOCUMENTS )
1057         {
1058             retValue = m_pMyShell->ls( nMyCommandIdentifier,
1059                                        m_aUncPath,
1060                                        aCommandArgument.Mode,
1061                                        aCommandArgument.Properties,
1062                                        aCommandArgument.SortingInfo );
1063         }
1064 //          else if(  aCommandArgument.Mode ==
1065 //                    OpenMode::DOCUMENT_SHARE_DENY_NONE  ||
1066 //                    aCommandArgument.Mode ==
1067 //                    OpenMode::DOCUMENT_SHARE_DENY_WRITE )
1068 //              m_pMyShell->installError( nMyCommandIdentifier,
1069 //                                        TASKHANDLING_UNSUPPORTED_OPEN_MODE,
1070 //                                        aCommandArgument.Mode);
1071         else
1072             m_pMyShell->installError( nMyCommandIdentifier,
1073                                       TASKHANDLING_UNSUPPORTED_OPEN_MODE,
1074                                       aCommandArgument.Mode);
1075     }
1076 
1077     return retValue;
1078 }
1079 
1080 
1081 
1082 void SAL_CALL
1083 BaseContent::deleteContent( sal_Int32 nMyCommandIdentifier )
1084     throw()
1085 {
1086     if( m_nState & Deleted )
1087         return;
1088 
1089     if( m_pMyShell->remove( nMyCommandIdentifier,m_aUncPath ) )
1090     {
1091         osl::MutexGuard aGuard( m_aMutex );
1092         m_nState |= Deleted;
1093     }
1094 }
1095 
1096 
1097 
1098 void SAL_CALL
1099 BaseContent::transfer( sal_Int32 nMyCommandIdentifier,
1100                        const TransferInfo& aTransferInfo )
1101     throw()
1102 {
1103     if( m_nState & Deleted )
1104         return;
1105 
1106     if( aTransferInfo.SourceURL.compareToAscii( "file:",5 ) != 0 )
1107     {
1108         m_pMyShell->installError( nMyCommandIdentifier,
1109                                   TASKHANDLING_TRANSFER_INVALIDSCHEME );
1110         return;
1111     }
1112 
1113     rtl::OUString srcUnc;
1114     if( m_pMyShell->getUnqFromUrl( aTransferInfo.SourceURL,srcUnc ) )
1115     {
1116         m_pMyShell->installError( nMyCommandIdentifier,
1117                                   TASKHANDLING_TRANSFER_INVALIDURL );
1118         return;
1119     }
1120 
1121     rtl::OUString srcUncPath = srcUnc;
1122 
1123     // Determine the new title !
1124     rtl::OUString NewTitle;
1125     if( aTransferInfo.NewTitle.getLength() )
1126         NewTitle = rtl::Uri::encode( aTransferInfo.NewTitle,
1127                                      rtl_UriCharClassPchar,
1128                                      rtl_UriEncodeIgnoreEscapes,
1129                                      RTL_TEXTENCODING_UTF8 );
1130     else
1131         NewTitle = srcUncPath.copy( 1 + srcUncPath.lastIndexOf( sal_Unicode('/') ) );
1132 
1133     // Is destination a document or a folder ?
1134     Sequence< beans::Property > seq(1);
1135     seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"),
1136                               -1,
1137                               getCppuType( static_cast< sal_Bool* >(0) ),
1138                               0 );
1139     Reference< sdbc::XRow > xRow = getPropertyValues( nMyCommandIdentifier,seq );
1140     sal_Bool IsDocument = xRow->getBoolean( 1 );
1141     if( xRow->wasNull() )
1142     {   // Destination file type could not be determined
1143         m_pMyShell->installError( nMyCommandIdentifier,
1144                                   TASKHANDLING_TRANSFER_DESTFILETYPE );
1145         return;
1146     }
1147 
1148     rtl::OUString dstUncPath;
1149     if( IsDocument )
1150     {   // as sibling
1151         sal_Int32 lastSlash = m_aUncPath.lastIndexOf( sal_Unicode('/') );
1152         dstUncPath = m_aUncPath.copy(0,lastSlash );
1153     }
1154     else
1155         // as child
1156         dstUncPath = m_aUncPath;
1157 
1158     dstUncPath += ( rtl::OUString::createFromAscii( "/" ) + NewTitle );
1159 
1160     sal_Int32 NameClash = aTransferInfo.NameClash;
1161 
1162     if( aTransferInfo.MoveData )
1163         m_pMyShell->move( nMyCommandIdentifier,srcUncPath,dstUncPath,NameClash );
1164     else
1165         m_pMyShell->copy( nMyCommandIdentifier,srcUncPath,dstUncPath,NameClash );
1166 }
1167 
1168 
1169 
1170 
1171 void SAL_CALL BaseContent::insert( sal_Int32 nMyCommandIdentifier,
1172                                    const InsertCommandArgument& aInsertArgument )
1173     throw()
1174 {
1175     if( m_nState & FullFeatured )
1176     {
1177         m_pMyShell->write( nMyCommandIdentifier,
1178                            m_aUncPath,
1179                            aInsertArgument.ReplaceExisting,
1180                            aInsertArgument.Data );
1181         return;
1182     }
1183 
1184     if( ! ( m_nState & JustInserted ) )
1185     {
1186         m_pMyShell->installError( nMyCommandIdentifier,
1187                                   TASKHANDLING_NOFRESHINSERT_IN_INSERT_COMMAND );
1188         return;
1189     }
1190 
1191     // Inserts the content, which has the flag m_bIsFresh
1192 
1193     if( ! m_nState & NameForInsertionSet )
1194     {
1195         m_pMyShell->installError( nMyCommandIdentifier,
1196                                   TASKHANDLING_NONAMESET_INSERT_COMMAND );
1197         return;
1198     }
1199 
1200     // Inserting a document or a file?
1201     sal_Bool bDocument = false;
1202 
1203     Sequence< beans::Property > seq(1);
1204     seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"),
1205                               -1,
1206                               getCppuType( static_cast< sal_Bool* >(0) ),
1207                               0 );
1208 
1209     Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
1210 
1211     bool contentTypeSet = true;  // is set to false, if contentType not set
1212     try
1213     {
1214         bDocument = xRow->getBoolean( 1 );
1215         if( xRow->wasNull() )
1216             contentTypeSet = false;
1217 
1218     }
1219     catch ( sdbc::SQLException const & )
1220     {
1221         OSL_ENSURE( false,
1222                     "BaseContent::insert - Caught SQLException!" );
1223         contentTypeSet = false;
1224     }
1225 
1226     if( ! contentTypeSet )
1227     {
1228         m_pMyShell->installError( nMyCommandIdentifier,
1229                                   TASKHANDLING_NOCONTENTTYPE_INSERT_COMMAND );
1230         return;
1231     }
1232 
1233 
1234     sal_Bool success = false;
1235     if( bDocument )
1236         success = m_pMyShell->mkfil( nMyCommandIdentifier,
1237                                      m_aUncPath,
1238                                      aInsertArgument.ReplaceExisting,
1239                                      aInsertArgument.Data );
1240     else
1241     {
1242         while( ! success )
1243         {
1244             success = m_pMyShell->mkdir( nMyCommandIdentifier,
1245                                          m_aUncPath,
1246                                          aInsertArgument.ReplaceExisting );
1247             if( success )
1248                 break;
1249 
1250             XInteractionRequestImpl *aRequestImpl =
1251                 new XInteractionRequestImpl(
1252                     rtl::Uri::decode(
1253                         getTitle(m_aUncPath),
1254                         rtl_UriDecodeWithCharset,
1255                         RTL_TEXTENCODING_UTF8),
1256                     (cppu::OWeakObject*)this,
1257                     m_pMyShell,nMyCommandIdentifier);
1258             uno::Reference< task::XInteractionRequest > aReq( aRequestImpl );
1259 
1260             m_pMyShell->handleTask( nMyCommandIdentifier,aReq );
1261             if(  aRequestImpl->aborted() ||
1262                  !aRequestImpl->newName().getLength() )
1263                 // means aborting
1264                 break;
1265 
1266             // determine new uncpath
1267             m_pMyShell->clearError( nMyCommandIdentifier );
1268             m_aUncPath = getParentName( m_aUncPath );
1269             if( m_aUncPath.lastIndexOf( sal_Unicode('/') ) != m_aUncPath.getLength() - 1 )
1270                 m_aUncPath += rtl::OUString::createFromAscii("/");
1271 
1272             m_aUncPath += rtl::Uri::encode( aRequestImpl->newName(),
1273                                             rtl_UriCharClassPchar,
1274                                             rtl_UriEncodeIgnoreEscapes,
1275                                             RTL_TEXTENCODING_UTF8 );
1276         }
1277     }
1278 
1279     if ( ! success )
1280         return;
1281 
1282     FileContentIdentifier* p = new FileContentIdentifier( m_pMyShell,m_aUncPath );
1283     m_xContentIdentifier = Reference< XContentIdentifier >( p );
1284 
1285     m_pMyShell->registerNotifier( m_aUncPath,this );
1286     m_pMyShell->insertDefaultProperties( m_aUncPath );
1287 
1288     osl::MutexGuard aGuard( m_aMutex );
1289     m_nState = FullFeatured;
1290 }
1291 
1292 
1293 
1294 void SAL_CALL BaseContent::endTask( sal_Int32 CommandId )
1295 {
1296     // This is the only function allowed to throw an exception
1297     m_pMyShell->endTask( CommandId,m_aUncPath,this );
1298 }
1299 
1300 
1301 
1302 ContentEventNotifier*
1303 BaseContent::cDEL( void )
1304 {
1305     osl::MutexGuard aGuard( m_aMutex );
1306 
1307     m_nState |= Deleted;
1308 
1309     ContentEventNotifier* p;
1310     if( m_pContentEventListeners )
1311         p = new ContentEventNotifier( m_pMyShell,
1312                                       this,
1313                                       m_xContentIdentifier,
1314                                       m_pContentEventListeners->getElements() );
1315     else
1316         p = 0;
1317 
1318     return p;
1319 }
1320 
1321 
1322 ContentEventNotifier*
1323 BaseContent::cEXC( const rtl::OUString aNewName )
1324 {
1325     osl::MutexGuard aGuard( m_aMutex );
1326 
1327     Reference< XContentIdentifier > xOldRef = m_xContentIdentifier;
1328     m_aUncPath = aNewName;
1329     FileContentIdentifier* pp = new FileContentIdentifier( m_pMyShell,aNewName );
1330     m_xContentIdentifier = Reference< XContentIdentifier >( pp );
1331 
1332     ContentEventNotifier* p = 0;
1333     if( m_pContentEventListeners )
1334         p = new ContentEventNotifier( m_pMyShell,
1335                                       this,
1336                                       m_xContentIdentifier,
1337                                       xOldRef,
1338                                       m_pContentEventListeners->getElements() );
1339 
1340     return p;
1341 }
1342 
1343 
1344 ContentEventNotifier*
1345 BaseContent::cCEL( void )
1346 {
1347     osl::MutexGuard aGuard( m_aMutex );
1348     ContentEventNotifier* p = 0;
1349     if( m_pContentEventListeners )
1350         p = new ContentEventNotifier( m_pMyShell,
1351                                       this,
1352                                       m_xContentIdentifier,
1353                                       m_pContentEventListeners->getElements() );
1354 
1355     return p;
1356 }
1357 
1358 PropertySetInfoChangeNotifier*
1359 BaseContent::cPSL( void )
1360 {
1361     osl::MutexGuard aGuard( m_aMutex );
1362     PropertySetInfoChangeNotifier* p = 0;
1363     if( m_pPropertySetInfoChangeListeners  )
1364         p = new PropertySetInfoChangeNotifier( m_pMyShell,
1365                                                this,
1366                                                m_xContentIdentifier,
1367                                                m_pPropertySetInfoChangeListeners->getElements() );
1368 
1369     return p;
1370 }
1371 
1372 
1373 
1374 PropertyChangeNotifier*
1375 BaseContent::cPCL( void )
1376 {
1377     osl::MutexGuard aGuard( m_aMutex );
1378 
1379     Sequence< rtl::OUString > seqNames;
1380 
1381     if( m_pPropertyListener )
1382         seqNames = m_pPropertyListener->getContainedTypes();
1383 
1384     PropertyChangeNotifier* p = 0;
1385 
1386     sal_Int32 length = seqNames.getLength();
1387 
1388     if( length )
1389     {
1390         ListenerMap* listener = new ListenerMap();
1391         for( sal_Int32 i = 0; i < length; ++i )
1392         {
1393             (*listener)[seqNames[i]] = m_pPropertyListener->getContainer( seqNames[i] )->getElements();
1394         }
1395 
1396         p = new PropertyChangeNotifier( m_pMyShell,
1397                                         this,
1398                                         m_xContentIdentifier,
1399                                         listener );
1400     }
1401 
1402     return p;
1403 }
1404 
1405 
1406 rtl::OUString BaseContent::getKey( void )
1407 {
1408     return m_aUncPath;
1409 }
1410