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 4110 : 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() SAL_OVERRIDE;
44 : virtual bool SAL_CALL isLibraryElementValid(const css::uno::Any& rElement) 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() 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();
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 : };
95 :
96 :
97 :
98 : typedef ::cppu::ImplHelper1 < ::com::sun::star::resource::XStringResourceSupplier
99 : > SfxDialogLibrary_BASE;
100 :
101 4936 : class SfxDialogLibrary :public SfxLibrary
102 : ,public SfxDialogLibrary_BASE
103 : {
104 : SfxDialogLibraryContainer* m_pParent;
105 : ::com::sun::star::uno::Reference
106 : < ::com::sun::star::resource::XStringResourcePersistence> m_xStringResourcePersistence;
107 : OUString m_aName;
108 :
109 : // Provide modify state including resources
110 : virtual bool isModified() SAL_OVERRIDE;
111 : virtual void storeResources() SAL_OVERRIDE;
112 : virtual void storeResourcesAsURL( const OUString& URL, const OUString& NewName ) SAL_OVERRIDE;
113 : virtual void storeResourcesToURL( const OUString& URL,
114 : const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) SAL_OVERRIDE;
115 : virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
116 : < ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
117 :
118 : public:
119 : SfxDialogLibrary
120 : (
121 : ModifiableHelper& _rModifiable,
122 : const OUString& aName,
123 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
124 : const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xSFI,
125 : SfxDialogLibraryContainer* pParent
126 : );
127 :
128 : SfxDialogLibrary
129 : (
130 : ModifiableHelper& _rModifiable,
131 : const OUString& aName,
132 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
133 : const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xSFI,
134 : const OUString& aLibInfoFileURL, const OUString& aStorageURL, bool ReadOnly,
135 : SfxDialogLibraryContainer* pParent
136 : );
137 :
138 : DECLARE_XINTERFACE()
139 : DECLARE_XTYPEPROVIDER()
140 :
141 : // XStringResourceSupplier
142 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >
143 : SAL_CALL getStringResource( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 :
145 2 : OUString getName()
146 2 : { return m_aName; }
147 :
148 : ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourcePersistence >
149 1210 : getStringResourcePersistence()
150 : {
151 1210 : return m_xStringResourcePersistence;
152 : }
153 :
154 : static bool containsValidDialog( const ::com::sun::star::uno::Any& aElement );
155 :
156 : protected:
157 : virtual bool SAL_CALL isLibraryElementValid(const css::uno::Any& rElement) const SAL_OVERRIDE;
158 : };
159 :
160 : } // namespace basic
161 :
162 : #endif
163 :
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|