| 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 | |
| 10 | #ifndef INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX |
| 11 | #define INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX |
| 12 | |
| 13 | #include <sal/config.h> |
| 14 | #include <sfx2/doctempl.hxx> |
| 15 | #include <vcl/weld.hxx> |
| 16 | |
| 17 | #include <com/sun/star/frame/XModel.hpp> |
| 18 | |
| 19 | // class SfxSaveAsTemplateDialog ------------------------------------------------------------------- |
| 20 | class SfxSaveAsTemplateDialog final : public weld::GenericDialogController |
| 21 | { |
| 22 | private: |
| 23 | std::unique_ptr<weld::TreeView> m_xLBCategory; |
| 24 | std::unique_ptr<weld::CheckButton> m_xCBXDefault; |
| 25 | std::unique_ptr<weld::Entry> m_xTemplateNameEdit; |
| 26 | std::unique_ptr<weld::Button> m_xOKButton; |
| 27 | |
| 28 | OUString msSelectedCategory; |
| 29 | OUString msTemplateName; |
| 30 | sal_uInt16 mnRegionPos; |
| 31 | |
| 32 | std::vector<OUString> msCategories; |
| 33 | |
| 34 | SfxDocumentTemplates maDocTemplates; |
| 35 | |
| 36 | css::uno::Reference<css::frame::XModel> m_xModel; |
| 37 | |
| 38 | public: |
| 39 | DECL_LINK(OkClickHdl, weld::Button&, void); |
| 40 | DECL_LINK(TemplateNameEditHdl, weld::Entry&, void); |
| 41 | DECL_LINK(SelectCategoryHdl, weld::TreeView&, void); |
| 42 | |
| 43 | void initialize(); |
| 44 | void SetCategoryLBEntries(const std::vector<OUString>& names); |
| 45 | |
| 46 | /*Check whether template name is unique or not in a region*/ |
| 47 | bool IsTemplateNameUnique(); |
| 48 | |
| 49 | bool SaveTemplate(); |
| 50 | |
| 51 | public: |
| 52 | SfxSaveAsTemplateDialog(weld::Window* pParent, css::uno::Reference<css::frame::XModel> xModel); |
| 53 | }; |
| 54 | |
| 55 | #endif // INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX |
| 56 | |
| 57 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |