Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef BASIC_DIALOGCONTAINER_HXX
21 : : #define BASIC_DIALOGCONTAINER_HXX
22 : :
23 : : #include "namecont.hxx"
24 : :
25 : : #include <com/sun/star/resource/XStringResourceSupplier.hpp>
26 : : #include "com/sun/star/resource/XStringResourcePersistence.hpp"
27 : :
28 : : #include <cppuhelper/implbase1.hxx>
29 : : #include <comphelper/uno3.hxx>
30 : :
31 : : namespace basic
32 : : {
33 : :
34 : : //============================================================================
35 : :
36 [ - + ]: 248 : class SfxDialogLibraryContainer : public SfxLibraryContainer
37 : : {
38 : : // Methods to distinguish between different library types
39 : : virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );
40 : : virtual SfxLibrary* SAL_CALL implCreateLibraryLink
41 : : ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
42 : : const ::rtl::OUString& StorageURL, sal_Bool ReadOnly );
43 : : virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void );
44 : : virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
45 : : virtual void SAL_CALL writeLibraryElement
46 : : (
47 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
48 : : const ::rtl::OUString& aElementName,
49 : : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
50 : : )
51 : : throw(::com::sun::star::uno::Exception);
52 : :
53 : : virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
54 : : (
55 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
56 : : const ::rtl::OUString& aElementName,
57 : : const ::rtl::OUString& aFile,
58 : : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
59 : :
60 : : virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
61 : :
62 : : virtual SfxLibraryContainer* createInstanceImpl( void );
63 : :
64 : : virtual void onNewRootStorage();
65 : :
66 : : virtual const sal_Char* SAL_CALL getInfoFileName() const;
67 : : virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
68 : : virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
69 : : virtual const sal_Char* SAL_CALL getLibrariesDir() const;
70 : :
71 : : public:
72 : : SfxDialogLibraryContainer( void );
73 : : SfxDialogLibraryContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
74 : :
75 : : // Methods XStorageBasedLibraryContainer
76 : : virtual void SAL_CALL storeLibrariesToStorage(
77 : : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& RootStorage )
78 : : throw (::com::sun::star::uno::RuntimeException);
79 : :
80 : : // Resource handling
81 : : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
82 : : implCreateStringResource( class SfxDialogLibrary* pDialog );
83 : :
84 : : // Methods XServiceInfo
85 : : virtual ::rtl::OUString SAL_CALL getImplementationName( )
86 : : throw (::com::sun::star::uno::RuntimeException);
87 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
88 : : throw (::com::sun::star::uno::RuntimeException);
89 : : // XLibraryQueryExecutable
90 : : virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
91 : : throw (::com::sun::star::uno::RuntimeException);
92 : : // Service
93 : : static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
94 : : static ::rtl::OUString getImplementationName_static();
95 : : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create
96 : : ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager )
97 : : throw( ::com::sun::star::uno::Exception );
98 : : };
99 : :
100 : : //============================================================================
101 : :
102 : : typedef ::cppu::ImplHelper1 < ::com::sun::star::resource::XStringResourceSupplier
103 : : > SfxDialogLibrary_BASE;
104 : :
105 [ - + ]: 1364 : class SfxDialogLibrary :public SfxLibrary
106 : : ,public SfxDialogLibrary_BASE
107 : : {
108 : : SfxDialogLibraryContainer* m_pParent;
109 : : ::com::sun::star::uno::Reference
110 : : < ::com::sun::star::resource::XStringResourcePersistence> m_xStringResourcePersistence;
111 : : ::rtl::OUString m_aName;
112 : :
113 : : // Provide modify state including resources
114 : : virtual sal_Bool isModified( void );
115 : : virtual void storeResources( void );
116 : : virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName );
117 : : virtual void storeResourcesToURL( const ::rtl::OUString& URL,
118 : : const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
119 : : virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
120 : : < ::com::sun::star::embed::XStorage >& xStorage );
121 : :
122 : : public:
123 : : SfxDialogLibrary
124 : : (
125 : : ModifiableHelper& _rModifiable,
126 : : const ::rtl::OUString& aName,
127 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
128 : : const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI,
129 : : SfxDialogLibraryContainer* pParent
130 : : );
131 : :
132 : : SfxDialogLibrary
133 : : (
134 : : ModifiableHelper& _rModifiable,
135 : : const ::rtl::OUString& aName,
136 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
137 : : const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI,
138 : : const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly,
139 : : SfxDialogLibraryContainer* pParent
140 : : );
141 : :
142 : : DECLARE_XINTERFACE()
143 : : DECLARE_XTYPEPROVIDER()
144 : :
145 : : // XStringResourceSupplier
146 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >
147 : : SAL_CALL getStringResource( ) throw (::com::sun::star::uno::RuntimeException);
148 : :
149 : 0 : ::rtl::OUString getName( void )
150 : 0 : { return m_aName; }
151 : :
152 : : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
153 : 36 : getStringResourcePersistence( void )
154 : : {
155 : 36 : return m_xStringResourcePersistence;
156 : : }
157 : :
158 : : static bool containsValidDialog( const ::com::sun::star::uno::Any& aElement );
159 : :
160 : : protected:
161 : : virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
162 : : };
163 : :
164 : : } // namespace basic
165 : :
166 : : #endif
167 : :
168 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|