1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
9 * last change: $Author: tml $ $Date: 2008-03-26 02:30:23 +0200 (on, 26 mar 2008) $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 ************************************************************************/
36 // MARKER(update_precomp.py): autogen include statement, do not remove
37 #include "precompiled_fpicker.hxx"
39 #include "ODMAFolderPicker.hxx"
41 #define _SVSTDARR_STRINGSDTOR
42 #include "svtools/svstdarr.hxx"
44 #ifndef _COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HPP_
45 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
47 #ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
48 #include <com/sun/star/container/XSet.hpp>
50 #ifndef _COM_SUN_STAR_UNO_ANY_HXX_
51 #include <com/sun/star/uno/Any.hxx>
53 #ifndef _CPPUHELPER_FACTORY_HXX_
54 #include <cppuhelper/factory.hxx>
56 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
57 #include <com/sun/star/beans/XPropertySet.hpp>
60 #ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
61 #include <svtools/pathoptions.hxx>
65 #include <tools/prewin.h>
66 #include <odma_lib.hxx>
67 #include <tools/postwin.h>
70 // using ----------------------------------------------------------------
72 using namespace ::com::sun::star::beans
;
73 using namespace ::com::sun::star::container
;
74 using namespace ::com::sun::star::lang
;
75 using namespace ::com::sun::star::uno
;
77 //------------------------------------------------------------------------------------
78 // class ODMAFolderPicker
79 //------------------------------------------------------------------------------------
81 //------------------------------------------------------------------------------------
82 ODMAFolderPicker::ODMAFolderPicker( const Reference
< XMultiServiceFactory
>& xFactory
) :
83 cppu::WeakComponentImplHelper2
<
85 XServiceInfo
>( m_rbHelperMtx
),
86 m_bUseDMS( sal_False
)
88 m_xInterface
= xFactory
->createInstance(
89 ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFolderPicker" ) );
92 // XExecutableDialog functions
94 void SAL_CALL
ODMAFolderPicker::setTitle( const ::rtl::OUString
& _rTitle
) throw (RuntimeException
)
99 Reference
< XExecutableDialog
> xExecutableDialog( m_xInterface
, UNO_QUERY
);
100 xExecutableDialog
->setTitle( _rTitle
);
103 sal_Int16 SAL_CALL
ODMAFolderPicker::execute( )
104 throw (RuntimeException
)
107 throw new RuntimeException( );
109 Reference
< XExecutableDialog
> xExecutableDialog( m_xInterface
, UNO_QUERY
);
110 return xExecutableDialog
->execute();
113 // XFolderPicker functions
115 void SAL_CALL
ODMAFolderPicker::setDisplayDirectory( const ::rtl::OUString
& aDirectory
)
116 throw( IllegalArgumentException
, RuntimeException
)
121 Reference
< XFolderPicker
> xFolderPicker( m_xInterface
, UNO_QUERY
);
122 xFolderPicker
->setDisplayDirectory( aDirectory
);
125 ::rtl::OUString SAL_CALL
ODMAFolderPicker::getDisplayDirectory( )
126 throw( RuntimeException
)
129 return rtl::OUString();
131 Reference
< XFolderPicker
> xFolderPicker( m_xInterface
, UNO_QUERY
);
132 return xFolderPicker
->getDisplayDirectory();
135 ::rtl::OUString SAL_CALL
ODMAFolderPicker::getDirectory( )
136 throw( RuntimeException
)
139 return rtl::OUString();
141 Reference
< XFolderPicker
> xFolderPicker( m_xInterface
, UNO_QUERY
);
142 return xFolderPicker
->getDirectory();
145 void SAL_CALL
ODMAFolderPicker::setDescription( const ::rtl::OUString
& aDescription
)
146 throw( RuntimeException
)
151 Reference
< XFolderPicker
> xFolderPicker( m_xInterface
, UNO_QUERY
);
152 xFolderPicker
->setDescription( aDescription
);
157 ::rtl::OUString SAL_CALL
ODMAFolderPicker::getImplementationName( )
158 throw( RuntimeException
)
160 return impl_getStaticImplementationName();
163 sal_Bool SAL_CALL
ODMAFolderPicker::supportsService( const ::rtl::OUString
& sServiceName
)
164 throw( RuntimeException
)
166 Sequence
< ::rtl::OUString
> seqServiceNames
= getSupportedServiceNames();
167 const ::rtl::OUString
* pArray
= seqServiceNames
.getConstArray();
168 for ( sal_Int32 i
= 0; i
< seqServiceNames
.getLength(); i
++ )
170 if ( sServiceName
== pArray
[i
] )
178 Sequence
< ::rtl::OUString
> SAL_CALL
ODMAFolderPicker::getSupportedServiceNames()
179 throw( RuntimeException
)
181 return impl_getStaticSupportedServiceNames();
184 Sequence
< ::rtl::OUString
> ODMAFolderPicker::impl_getStaticSupportedServiceNames( )
186 Sequence
< ::rtl::OUString
> seqServiceNames( 1 );
187 ::rtl::OUString
* pArray
= seqServiceNames
.getArray();
188 pArray
[0] = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.ODMAFolderPicker" );
189 return seqServiceNames
;
192 ::rtl::OUString
ODMAFolderPicker::impl_getStaticImplementationName( )
194 return ::rtl::OUString::createFromAscii( "com.sun.star.svtools.ODMAFolderPicker" );
197 Reference
< XInterface
> SAL_CALL
ODMAFolderPicker::impl_createInstance( const Reference
< XComponentContext
>& rxContext
)
200 Reference
< XMultiServiceFactory
> xServiceManager (rxContext
->getServiceManager(), UNO_QUERY_THROW
);
201 return Reference
< XInterface
>( *new ODMAFolderPicker( xServiceManager
) );