1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_BASIC_SOURCE_INC_DLGCONT_HXX
21 #define INCLUDED_BASIC_SOURCE_INC_DLGCONT_HXX
23 #include "namecont.hxx"
25 #include <com/sun/star/resource/XStringResourceSupplier.hpp>
26 #include <com/sun/star/resource/XStringResourcePersistence.hpp>
28 #include <cppuhelper/implbase1.hxx>
29 #include <comphelper/uno3.hxx>
35 class SfxDialogLibraryContainer
: public SfxLibraryContainer
37 // Methods to distinguish between different library types
38 virtual SfxLibrary
* implCreateLibrary( const OUString
& aName
) override
;
39 virtual SfxLibrary
* implCreateLibraryLink
40 ( const OUString
& aName
, const OUString
& aLibInfoFileURL
,
41 const OUString
& StorageURL
, bool ReadOnly
) override
;
42 virtual css::uno::Any
createEmptyLibraryElement() override
;
43 virtual bool isLibraryElementValid(const css::uno::Any
& rElement
) const override
;
44 virtual void writeLibraryElement
46 const css::uno::Reference
< css::container::XNameContainer
>& xLibrary
,
47 const OUString
& aElementName
,
48 const css::uno::Reference
< css::io::XOutputStream
>& xOutput
51 virtual css::uno::Any importLibraryElement
53 const css::uno::Reference
< css::container::XNameContainer
>& xLibrary
,
54 const OUString
& aElementName
,
55 const OUString
& aFile
,
56 const css::uno::Reference
< css::io::XInputStream
>& xElementStream
) override
;
58 virtual void importFromOldStorage( const OUString
& aFile
) override
;
60 virtual SfxLibraryContainer
* createInstanceImpl() override
;
62 virtual void onNewRootStorage() override
;
64 virtual const sal_Char
* getInfoFileName() const override
;
65 virtual const sal_Char
* getOldInfoFileName() const override
;
66 virtual const sal_Char
* getLibElementFileExtension() const override
;
67 virtual const sal_Char
* getLibrariesDir() const override
;
70 SfxDialogLibraryContainer();
71 SfxDialogLibraryContainer( const css::uno::Reference
< css::embed::XStorage
>& xStorage
);
73 // Methods XStorageBasedLibraryContainer
74 virtual void SAL_CALL
storeLibrariesToStorage(
75 const css::uno::Reference
< css::embed::XStorage
>& RootStorage
) override
;
78 css::uno::Reference
< css::resource::XStringResourcePersistence
>
79 implCreateStringResource( class SfxDialogLibrary
* pDialog
);
81 // Methods XServiceInfo
82 virtual OUString SAL_CALL
getImplementationName( ) override
;
83 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
84 // XLibraryQueryExecutable
85 virtual sal_Bool SAL_CALL
HasExecutableCode(const OUString
&) override
;
89 typedef ::cppu::ImplHelper1
< css::resource::XStringResourceSupplier
90 > SfxDialogLibrary_BASE
;
92 class SfxDialogLibrary
:public SfxLibrary
93 ,public SfxDialogLibrary_BASE
95 SfxDialogLibraryContainer
* m_pParent
;
96 css::uno::Reference
< css::resource::XStringResourcePersistence
> m_xStringResourcePersistence
;
99 // Provide modify state including resources
100 virtual bool isModified() override
;
101 virtual void storeResources() override
;
102 virtual void storeResourcesAsURL( const OUString
& URL
, const OUString
& NewName
) override
;
103 virtual void storeResourcesToURL( const OUString
& URL
,
104 const css::uno::Reference
< css::task::XInteractionHandler
>& xHandler
) override
;
105 virtual void storeResourcesToStorage( const css::uno::Reference
106 < css::embed::XStorage
>& xStorage
) override
;
111 ModifiableHelper
& _rModifiable
,
112 const OUString
& aName
,
113 const css::uno::Reference
< css::ucb::XSimpleFileAccess3
>& xSFI
,
114 SfxDialogLibraryContainer
* pParent
119 ModifiableHelper
& _rModifiable
,
120 const OUString
& aName
,
121 const css::uno::Reference
< css::ucb::XSimpleFileAccess3
>& xSFI
,
122 const OUString
& aLibInfoFileURL
, const OUString
& aStorageURL
, bool ReadOnly
,
123 SfxDialogLibraryContainer
* pParent
127 DECLARE_XTYPEPROVIDER()
129 // XStringResourceSupplier
130 virtual css::uno::Reference
< css::resource::XStringResourceResolver
>
131 SAL_CALL
getStringResource( ) override
;
133 const OUString
& getName() const
136 const css::uno::Reference
< css::resource::XStringResourcePersistence
>&
137 getStringResourcePersistence() const
139 return m_xStringResourcePersistence
;
142 static bool containsValidDialog( const css::uno::Any
& aElement
);
145 virtual bool isLibraryElementValid(const css::uno::Any
& rElement
) const override
;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */