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 INCLUDED_BASIC_SOURCE_INC_DLGCONT_HXX
21 : #define INCLUDED_BASIC_SOURCE_INC_DLGCONT_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 0 : class SfxDialogLibraryContainer : public SfxLibraryContainer
37 : {
38 : // Methods to distinguish between different library types
39 : virtual SfxLibrary* SAL_CALL implCreateLibrary( const OUString& aName ) SAL_OVERRIDE;
40 : virtual SfxLibrary* SAL_CALL implCreateLibraryLink
41 : ( const OUString& aName, const OUString& aLibInfoFileURL,
42 : const OUString& StorageURL, bool ReadOnly ) SAL_OVERRIDE;
43 : virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) SAL_OVERRIDE;
44 : virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const SAL_OVERRIDE;
45 : virtual void SAL_CALL writeLibraryElement
46 : (
47 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
48 : const OUString& aElementName,
49 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
50 : )
51 : throw(::com::sun::star::uno::Exception) SAL_OVERRIDE;
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 OUString& aElementName,
57 : const OUString& aFile,
58 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) SAL_OVERRIDE;
59 :
60 : virtual void SAL_CALL importFromOldStorage( const OUString& aFile ) SAL_OVERRIDE;
61 :
62 : virtual SfxLibraryContainer* createInstanceImpl( void ) SAL_OVERRIDE;
63 :
64 : virtual void onNewRootStorage() SAL_OVERRIDE;
65 :
66 : virtual const sal_Char* SAL_CALL getInfoFileName() const SAL_OVERRIDE;
67 : virtual const sal_Char* SAL_CALL getOldInfoFileName() const SAL_OVERRIDE;
68 : virtual const sal_Char* SAL_CALL getLibElementFileExtension() const SAL_OVERRIDE;
69 : virtual const sal_Char* SAL_CALL getLibrariesDir() const SAL_OVERRIDE;
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 (css::uno::RuntimeException,
79 : css::lang::WrappedTargetException,
80 : std::exception) SAL_OVERRIDE;
81 :
82 : // Resource handling
83 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
84 : implCreateStringResource( class SfxDialogLibrary* pDialog );
85 :
86 : // Methods XServiceInfo
87 : virtual OUString SAL_CALL getImplementationName( )
88 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
90 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 : // XLibraryQueryExecutable
92 : virtual sal_Bool SAL_CALL HasExecutableCode(const OUString&)
93 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : // Service
95 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static();
96 : static OUString getImplementationName_static();
97 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create
98 : ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager )
99 : throw( ::com::sun::star::uno::Exception );
100 : };
101 :
102 :
103 :
104 : typedef ::cppu::ImplHelper1 < ::com::sun::star::resource::XStringResourceSupplier
105 : > SfxDialogLibrary_BASE;
106 :
107 0 : class SfxDialogLibrary :public SfxLibrary
108 : ,public SfxDialogLibrary_BASE
109 : {
110 : SfxDialogLibraryContainer* m_pParent;
111 : ::com::sun::star::uno::Reference
112 : < ::com::sun::star::resource::XStringResourcePersistence> m_xStringResourcePersistence;
113 : OUString m_aName;
114 :
115 : // Provide modify state including resources
116 : virtual bool isModified( void ) SAL_OVERRIDE;
117 : virtual void storeResources( void ) SAL_OVERRIDE;
118 : virtual void storeResourcesAsURL( const OUString& URL, const OUString& NewName ) SAL_OVERRIDE;
119 : virtual void storeResourcesToURL( const OUString& URL,
120 : const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) SAL_OVERRIDE;
121 : virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
122 : < ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
123 :
124 : public:
125 : SfxDialogLibrary
126 : (
127 : ModifiableHelper& _rModifiable,
128 : const OUString& aName,
129 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
130 : const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xSFI,
131 : SfxDialogLibraryContainer* pParent
132 : );
133 :
134 : SfxDialogLibrary
135 : (
136 : ModifiableHelper& _rModifiable,
137 : const OUString& aName,
138 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
139 : const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xSFI,
140 : const OUString& aLibInfoFileURL, const OUString& aStorageURL, bool ReadOnly,
141 : SfxDialogLibraryContainer* pParent
142 : );
143 :
144 : DECLARE_XINTERFACE()
145 : DECLARE_XTYPEPROVIDER()
146 :
147 : // XStringResourceSupplier
148 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >
149 : SAL_CALL getStringResource( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 :
151 0 : OUString getName( void )
152 0 : { return m_aName; }
153 :
154 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
155 0 : getStringResourcePersistence( void )
156 : {
157 0 : return m_xStringResourcePersistence;
158 : }
159 :
160 : static bool containsValidDialog( const ::com::sun::star::uno::Any& aElement );
161 :
162 : protected:
163 : virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const SAL_OVERRIDE;
164 : };
165 :
166 : } // namespace basic
167 :
168 : #endif
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|