lok: initialize the load-language
[LibreOffice.git] / include / svx / GenericCheckDialog.hxx
blob9878ea9fab2a24a4feb05996401deaf29b84063a
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 */
11 #pragma once
13 #include <svx/svxdllapi.h>
14 #include <tools/link.hxx>
15 #include <vcl/weld.hxx>
17 namespace svx
19 /**
20 * Interface for the data of a check, which must be extended by the
21 * check itself, to show the data in the GenericCheckDialog.
23 class CheckData
25 public:
26 virtual ~CheckData() {}
28 /// check entry text
29 virtual OUString getText() = 0;
31 /// true, if we can show the "Mark" button
32 virtual bool canMarkObject() = 0;
33 /// executed, when the "Mark" button is hit
34 virtual void markObject() = 0;
36 /// true, if we can show the "Properties" button
37 virtual bool hasProperties() = 0;
38 /// executed, when the "Properties" button is hit
39 virtual void runProperties() = 0;
42 /**
43 * Check data collection contains all the checks in one data structure,
44 * and also serves to define additional attributes that are used by the
45 * GenericCheckDialog (the title of the check dialog).
47 class CheckDataCollection
49 protected:
50 std::vector<std::unique_ptr<CheckData>> m_aCollection;
52 public:
53 virtual ~CheckDataCollection() {}
55 std::vector<std::unique_ptr<CheckData>>& getCollection() { return m_aCollection; }
57 virtual OUString getTitle() = 0;
60 /**
61 * A UI piece to show check result text and other widgets, which are
62 * relevant for the check (various buttons to act on the check result).
64 class GenericCheckEntry final
66 private:
67 std::unique_ptr<weld::Builder> m_xBuilder;
68 std::unique_ptr<weld::Container> m_xContainer;
69 std::unique_ptr<weld::Label> m_xLabel;
70 std::unique_ptr<weld::Button> m_xMarkButton;
71 std::unique_ptr<weld::Button> m_xPropertiesButton;
73 std::unique_ptr<CheckData>& m_pCheckData;
75 public:
76 GenericCheckEntry(weld::Container* pParent, std::unique_ptr<CheckData>& rCheckData);
78 weld::Widget* get_widget() const { return m_xContainer.get(); }
80 DECL_LINK(MarkButtonClicked, weld::Button&, void);
81 DECL_LINK(PropertiesButtonClicked, weld::Button&, void);
84 /**
85 * This is a generic dialog, which is used to display results of a
86 * document checks, like for example image size check.
88 class SVX_DLLPUBLIC GenericCheckDialog final : public weld::GenericDialogController
90 private:
91 std::vector<std::unique_ptr<GenericCheckEntry>> m_aCheckEntries;
92 CheckDataCollection& m_rCheckDataCollection;
94 std::unique_ptr<weld::Box> m_xCheckBox;
96 public:
97 GenericCheckDialog(weld::Window* pParent, CheckDataCollection& rCheckDataCollection);
98 virtual ~GenericCheckDialog() override;
99 virtual short run() override;
102 } // end svx namespace
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */