LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / basic / source / inc / dlgcont.hxx
blob58d1dbeb65f4eed179e9e8c94ec742c53ecad8cb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include "namecont.hxx"
24 #include <com/sun/star/resource/XStringResourceSupplier.hpp>
25 #include <com/sun/star/resource/XStringResourcePersistence.hpp>
27 #include <cppuhelper/implbase1.hxx>
28 #include <comphelper/uno3.hxx>
30 namespace basic
34 class SfxDialogLibraryContainer final : public SfxLibraryContainer
36 // Methods to distinguish between different library types
37 virtual rtl::Reference<SfxLibrary> implCreateLibrary( const OUString& aName ) override;
38 virtual rtl::Reference<SfxLibrary> implCreateLibraryLink
39 ( const OUString& aName, const OUString& aLibInfoFileURL,
40 const OUString& StorageURL, bool ReadOnly ) override;
41 virtual css::uno::Any createEmptyLibraryElement() override;
42 virtual bool isLibraryElementValid(const css::uno::Any& rElement) const override;
43 virtual void writeLibraryElement
45 const css::uno::Reference< css::container::XNameContainer>& xLibrary,
46 const OUString& aElementName,
47 const css::uno::Reference< css::io::XOutputStream >& xOutput
48 ) override;
50 virtual css::uno::Any importLibraryElement
52 const css::uno::Reference< css::container::XNameContainer>& xLibrary,
53 const OUString& aElementName,
54 const OUString& aFile,
55 const css::uno::Reference< css::io::XInputStream >& xElementStream ) override;
57 virtual void importFromOldStorage( const OUString& aFile ) override;
59 virtual rtl::Reference<SfxLibraryContainer> createInstanceImpl() override;
61 virtual void onNewRootStorage() override;
63 virtual const char* getInfoFileName() const override;
64 virtual const char* getOldInfoFileName() const override;
65 virtual const char* getLibElementFileExtension() const override;
66 virtual const char* getLibrariesDir() const override;
68 public:
69 SfxDialogLibraryContainer();
70 SfxDialogLibraryContainer( const css::uno::Reference< css::embed::XStorage >& xStorage );
72 // Methods XStorageBasedLibraryContainer
73 virtual void SAL_CALL storeLibrariesToStorage(
74 const css::uno::Reference< css::embed::XStorage >& RootStorage ) override;
76 // Resource handling
77 css::uno::Reference< css::resource::XStringResourcePersistence >
78 implCreateStringResource( class SfxDialogLibrary* pDialog );
80 // Methods XServiceInfo
81 virtual OUString SAL_CALL getImplementationName( ) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
83 // XLibraryQueryExecutable
84 virtual sal_Bool SAL_CALL HasExecutableCode(const OUString&) override;
88 typedef ::cppu::ImplHelper1 < css::resource::XStringResourceSupplier
89 > SfxDialogLibrary_BASE;
91 class SfxDialogLibrary final : public SfxLibrary
92 ,public SfxDialogLibrary_BASE
94 SfxDialogLibraryContainer* m_pParent;
95 css::uno::Reference< css::resource::XStringResourcePersistence> m_xStringResourcePersistence;
96 OUString m_aName;
98 // Provide modify state including resources
99 virtual bool isModified() override;
100 virtual void storeResources() override;
101 virtual void storeResourcesAsURL( const OUString& URL, const OUString& NewName ) override;
102 virtual void storeResourcesToURL( const OUString& URL,
103 const css::uno::Reference< css::task::XInteractionHandler >& xHandler ) override;
104 virtual void storeResourcesToStorage( const css::uno::Reference
105 < css::embed::XStorage >& xStorage ) override;
107 public:
108 SfxDialogLibrary
110 ModifiableHelper& _rModifiable,
111 const OUString& aName,
112 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xSFI,
113 SfxDialogLibraryContainer* pParent
116 SfxDialogLibrary
118 ModifiableHelper& _rModifiable,
119 const OUString& aName,
120 const css::uno::Reference< css::ucb::XSimpleFileAccess3 >& xSFI,
121 const OUString& aLibInfoFileURL, const OUString& aStorageURL, bool ReadOnly,
122 SfxDialogLibraryContainer* pParent
125 DECLARE_XINTERFACE()
126 DECLARE_XTYPEPROVIDER()
128 // XStringResourceSupplier
129 virtual css::uno::Reference< css::resource::XStringResourceResolver >
130 SAL_CALL getStringResource( ) override;
132 const OUString& getName() const
133 { return m_aName; }
135 const css::uno::Reference< css::resource::XStringResourcePersistence >&
136 getStringResourcePersistence() const
138 return m_xStringResourcePersistence;
141 static bool containsValidDialog( const css::uno::Any& aElement );
143 private:
144 virtual bool isLibraryElementValid(const css::uno::Any& rElement) const override;
147 } // namespace basic
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */