| 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_SFX2_INC_GUISAVEAS_HXX |
| 21 | #define INCLUDED_SFX2_INC_GUISAVEAS_HXX |
| 22 | |
| 23 | #include <sal/config.h> |
| 24 | |
| 25 | #include <string_view> |
| 26 | |
| 27 | #include <com/sun/star/uno/Sequence.hxx> |
| 28 | #include <com/sun/star/beans/PropertyValue.hpp> |
| 29 | #include <com/sun/star/container/XNameAccess.hpp> |
| 30 | #include <com/sun/star/container/XContainerQuery.hpp> |
| 31 | #include <com/sun/star/frame/XModel2.hpp> |
| 32 | #include <com/sun/star/frame/XModuleManager2.hpp> |
| 33 | |
| 34 | #include <comphelper/sequenceashashmap.hxx> |
| 35 | |
| 36 | #include <sfx2/bindings.hxx> |
| 37 | #include <sfx2/signaturestate.hxx> |
| 38 | |
| 39 | #include <svtools/dialogclosedlistener.hxx> |
| 40 | |
| 41 | #include <unotools/saveopt.hxx> |
| 42 | |
| 43 | #include <tools/urlobj.hxx> |
| 44 | |
| 45 | |
| 46 | namespace com::sun::star::document { class XDocumentProperties; } |
| 47 | |
| 48 | namespace weld { class Window; } |
| 49 | class ModelData_Impl; |
| 50 | |
| 51 | namespace sfx2 { |
| 52 | bool UseODFWholesomeEncryption(SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion); |
| 53 | } // namespace sfx2 |
| 54 | |
| 55 | class SfxStoringHelper |
| 56 | { |
| 57 | friend class ModelData_Impl; |
| 58 | |
| 59 | private: |
| 60 | css::uno::Reference< css::container::XNameAccess > m_xFilterCFG; |
| 61 | css::uno::Reference< css::container::XContainerQuery > m_xFilterQuery; |
| 62 | css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; |
| 63 | |
| 64 | std::shared_ptr<ModelData_Impl> m_xModelData; |
| 65 | css::uno::Sequence< css::beans::PropertyValue > m_aArgsSequence; |
| 66 | |
| 67 | css::uno::Reference< css::container::XNameAccess > const & GetFilterConfiguration(); |
| 68 | css::uno::Reference< css::container::XContainerQuery > const & GetFilterQuery(); |
| 69 | css::uno::Reference< css::frame::XModuleManager2 > const & GetModuleManager(); |
| 70 | |
| 71 | bool m_bRemote; |
| 72 | bool m_bPreselectPassword; |
| 73 | bool m_bDialogUsed; |
| 74 | bool m_bSetStandardName; |
| 75 | sal_Int16 m_nStoreMode; |
| 76 | SignatureState m_nScriptingSignatureState{SignatureState::UNKNOWN}; |
| 77 | |
| 78 | static bool FinishGUIStoreModel(::comphelper::SequenceAsHashMap::const_iterator& aFileNameIter, |
| 79 | ModelData_Impl& aModelData, bool bRemote, sal_Int16 nStoreMode, |
| 80 | const css::uno::Sequence< css::beans::PropertyValue >& aFilterProps, |
| 81 | bool bSetStandardName, bool bPreselectPassword, bool bDialogUsed, |
| 82 | std::u16string_view aFilterFromMediaDescr, std::u16string_view aOldFilterName, |
| 83 | css::uno::Sequence< css::beans::PropertyValue >& aArgsSequence, |
| 84 | OUString aFilterName, |
| 85 | SignatureState nScriptingSignatureState); |
| 86 | |
| 87 | void CallFinishGUIStoreModel(); |
| 88 | |
| 89 | public: |
| 90 | SfxStoringHelper(); |
| 91 | |
| 92 | bool GUIStoreModel( |
| 93 | const css::uno::Reference< css::frame::XModel2 >& xModel, |
| 94 | std::u16string_view aSlotName, |
| 95 | css::uno::Sequence< css::beans::PropertyValue >& aArgsSequence, |
| 96 | bool bPreselectPassword, |
| 97 | SignatureState nDocumentSignatureState, |
| 98 | SignatureState nScriptingSignatureState, |
| 99 | bool bIsAsync ); |
| 100 | |
| 101 | static bool CheckFilterOptionsAppearance( |
| 102 | const css::uno::Reference< css::container::XNameAccess >& xFilterCFG, |
| 103 | const OUString& aFilterName ); |
| 104 | |
| 105 | |
| 106 | static void SetDocInfoState( |
| 107 | const css::uno::Reference< css::frame::XModel2 >& xModel, |
| 108 | const css::uno::Reference< css::document::XDocumentProperties>& i_xOldDocInfo ); |
| 109 | |
| 110 | static bool WarnUnacceptableFormat( |
| 111 | const css::uno::Reference< css::frame::XModel2 >& xModel, |
| 112 | std::u16string_view aOldUIName, |
| 113 | std::u16string_view aExtension, |
| 114 | const OUString& aDefExtension, |
| 115 | bool rDefaultIsAlien ); |
| 116 | |
| 117 | static css::uno::Reference<css::awt::XWindow> GetModelXWindow(const css::uno::Reference<css::frame::XModel2>& rModel); |
| 118 | static weld::Window* GetModelWindow( const css::uno::Reference< css::frame::XModel2 >& xModel ); |
| 119 | |
| 120 | }; |
| 121 | |
| 122 | #endif |
| 123 | |
| 124 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |