tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / sfx2 / new.hxx
blobf76bb8ebab05fc78520dbb02241446baa1fc2f91
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 .
19 #pragma once
21 #include <memory>
22 #include <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <sfx2/basedlgs.hxx>
25 #include <sfx2/objsh.hxx>
27 #include <vcl/idle.hxx>
28 #include <sfx2/doctempl.hxx>
29 #include <o3tl/typed_flags_set.hxx>
31 namespace weld { class Button; }
32 namespace weld { class CheckButton; }
33 namespace weld { class CustomWeld; }
34 namespace weld { class Expander; }
35 namespace weld { class Label; }
36 namespace weld { class TreeView; }
37 namespace weld { class Window; }
39 class SfxPreviewWin_Impl;
41 enum class SfxNewFileDialogMode {
42 NONE, Preview, LoadTemplate
45 enum class SfxTemplateFlags
47 NONE = 0x00,
48 LOAD_TEXT_STYLES = 0x01,
49 LOAD_FRAME_STYLES = 0x02,
50 LOAD_PAGE_STYLES = 0x04,
51 LOAD_NUM_STYLES = 0x08,
52 MERGE_STYLES = 0x10,
54 namespace o3tl
56 template<> struct typed_flags<SfxTemplateFlags> : is_typed_flags<SfxTemplateFlags, 0x1f> {};
59 #define RET_TEMPLATE_LOAD 100
61 class SFX2_DLLPUBLIC SfxNewFileDialog final : public SfxDialogController
63 private:
64 Idle m_aPrevIdle;
65 SfxNewFileDialogMode m_nFlags;
66 SfxDocumentTemplates m_aTemplates;
67 SfxObjectShellLock m_xDocShell;
69 std::unique_ptr<SfxPreviewWin_Impl> m_xPreviewController;
71 std::unique_ptr<weld::TreeView> m_xRegionLb;
72 std::unique_ptr<weld::TreeView> m_xTemplateLb;
73 std::unique_ptr<weld::CheckButton> m_xTextStyleCB;
74 std::unique_ptr<weld::CheckButton> m_xFrameStyleCB;
75 std::unique_ptr<weld::CheckButton> m_xPageStyleCB;
76 std::unique_ptr<weld::CheckButton> m_xNumStyleCB;
77 std::unique_ptr<weld::CheckButton> m_xMergeStyleCB;
78 std::unique_ptr<weld::Button> m_xLoadFilePB;
79 std::unique_ptr<weld::Expander> m_xMoreBt;
80 std::unique_ptr<weld::CustomWeld> m_xPreviewWin;
81 std::unique_ptr<weld::Label> m_xAltTitleFt;
83 DECL_DLLPRIVATE_LINK( Update, Timer *, void );
85 DECL_DLLPRIVATE_LINK(RegionSelect, weld::TreeView&, void);
86 DECL_DLLPRIVATE_LINK(TemplateSelect, weld::TreeView&, void);
87 DECL_DLLPRIVATE_LINK(DoubleClick, weld::TreeView&, bool);
88 DECL_DLLPRIVATE_LINK(Expand, weld::Expander&, void);
89 sal_uInt16 GetSelectedTemplatePos() const;
91 public:
92 SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode nFlags);
93 virtual ~SfxNewFileDialog() override;
95 // Returns false, when '- No -' is set as Template
96 // Template names can only be obtained when IsTemplate() returns true.
97 bool IsTemplate() const;
98 OUString GetTemplateFileName() const;
100 // load template methods
101 SfxTemplateFlags GetTemplateFlags() const;
102 void SetTemplateFlags(SfxTemplateFlags nSet);
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */