1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlgcont.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef BASIC_DIALOGCONTAINER_HXX
32 #define BASIC_DIALOGCONTAINER_HXX
34 #include "namecont.hxx"
36 #ifndef _COM_SUN_STAR_AWT_XSTRINGRESOURCESUPPLIER_HPP_
37 #include <com/sun/star/resource/XStringResourceSupplier.hpp>
39 #include "com/sun/star/resource/XStringResourcePersistence.hpp"
41 #include <cppuhelper/implbase1.hxx>
42 #include <comphelper/uno3.hxx>
47 //============================================================================
49 class SfxDialogLibraryContainer
: public SfxLibraryContainer
51 // Methods to distinguish between different library types
52 virtual SfxLibrary
* SAL_CALL
implCreateLibrary( const ::rtl::OUString
& aName
);
53 virtual SfxLibrary
* SAL_CALL implCreateLibraryLink
54 ( const ::rtl::OUString
& aName
, const ::rtl::OUString
& aLibInfoFileURL
,
55 const ::rtl::OUString
& StorageURL
, sal_Bool ReadOnly
);
56 virtual ::com::sun::star::uno::Any SAL_CALL
createEmptyLibraryElement( void );
57 virtual bool SAL_CALL
isLibraryElementValid( ::com::sun::star::uno::Any aElement
) const;
58 virtual void SAL_CALL writeLibraryElement
60 ::com::sun::star::uno::Any aElement
,
61 const ::rtl::OUString
& aElementName
,
62 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
> xOutput
64 throw(::com::sun::star::uno::Exception
);
66 virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
67 ( const ::rtl::OUString
& aFile
,
68 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xElementStream
);
70 virtual void SAL_CALL
importFromOldStorage( const ::rtl::OUString
& aFile
);
72 virtual SfxLibraryContainer
* createInstanceImpl( void );
74 virtual void onNewRootStorage();
76 virtual const sal_Char
* SAL_CALL
getInfoFileName() const;
77 virtual const sal_Char
* SAL_CALL
getOldInfoFileName() const;
78 virtual const sal_Char
* SAL_CALL
getLibElementFileExtension() const;
79 virtual const sal_Char
* SAL_CALL
getLibrariesDir() const;
82 SfxDialogLibraryContainer( void );
83 SfxDialogLibraryContainer( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
85 // Methods XStorageBasedLibraryContainer
86 virtual void SAL_CALL
storeLibrariesToStorage(
87 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& RootStorage
)
88 throw (::com::sun::star::uno::RuntimeException
);
91 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourcePersistence
>
92 implCreateStringResource( class SfxDialogLibrary
* pDialog
);
94 // Methods XServiceInfo
95 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
96 throw (::com::sun::star::uno::RuntimeException
);
97 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
98 throw (::com::sun::star::uno::RuntimeException
);
99 // XLibraryQueryExecutable
100 virtual sal_Bool SAL_CALL
HasExecutableCode(const rtl::OUString
&)
101 throw (::com::sun::star::uno::RuntimeException
);
103 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> getSupportedServiceNames_static();
104 static ::rtl::OUString
getImplementationName_static();
105 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL Create
106 ( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& xServiceManager
)
107 throw( ::com::sun::star::uno::Exception
);
110 //============================================================================
112 typedef ::cppu::ImplHelper1
< ::com::sun::star::resource::XStringResourceSupplier
113 > SfxDialogLibrary_BASE
;
115 class SfxDialogLibrary
:public SfxLibrary
116 ,public SfxDialogLibrary_BASE
118 SfxDialogLibraryContainer
* m_pParent
;
119 ::com::sun::star::uno::Reference
120 < ::com::sun::star::resource::XStringResourcePersistence
> m_xStringResourcePersistence
;
121 ::rtl::OUString m_aName
;
123 // Provide modify state including resources
124 virtual sal_Bool
isModified( void );
125 virtual void storeResources( void );
126 virtual void storeResourcesAsURL( const ::rtl::OUString
& URL
, const ::rtl::OUString
& NewName
);
127 virtual void storeResourcesToURL( const ::rtl::OUString
& URL
,
128 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& xHandler
);
129 virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
130 < ::com::sun::star::embed::XStorage
>& xStorage
);
135 ModifiableHelper
& _rModifiable
,
136 const ::rtl::OUString
& aName
,
137 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xMSF
,
138 const ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess
>& xSFI
,
139 SfxDialogLibraryContainer
* pParent
144 ModifiableHelper
& _rModifiable
,
145 const ::rtl::OUString
& aName
,
146 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xMSF
,
147 const ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess
>& xSFI
,
148 const ::rtl::OUString
& aLibInfoFileURL
, const ::rtl::OUString
& aStorageURL
, sal_Bool ReadOnly
,
149 SfxDialogLibraryContainer
* pParent
153 DECLARE_XTYPEPROVIDER()
155 // XStringResourceSupplier
156 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourceResolver
>
157 SAL_CALL
getStringResource( ) throw (::com::sun::star::uno::RuntimeException
);
159 ::rtl::OUString
getName( void )
162 ::com::sun::star::uno::Reference
< ::com::sun::star::resource::XStringResourcePersistence
>
163 getStringResourcePersistence( void )
165 return m_xStringResourcePersistence
;
168 static bool containsValidDialog( const ::com::sun::star::uno::Any
& aElement
);
171 virtual bool SAL_CALL
isLibraryElementValid( ::com::sun::star::uno::Any aElement
) const;