LibreOffice Module sw (master)  1
GraphicSizeCheck.hxx
Go to the documentation of this file.
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 
11 #pragma once
12 
13 #include <doc.hxx>
15 
16 namespace sw
17 {
23 {
24 private:
26 
27  sal_Int32 m_nLowDPILimit = 0;
28  sal_Int32 m_nHighDPILimit = 0;
29 
30  sal_Int32 m_nDPIX = 0;
31  sal_Int32 m_nDPIY = 0;
32 
33 public:
34  GraphicSizeViolation(sal_Int32 nDPI, const SwGrfNode* pGraphicNode);
35  bool check();
36 
37  const OUString& getGraphicName();
38 
39  bool isDPITooLow() { return m_nDPIX < m_nLowDPILimit || m_nDPIY < m_nLowDPILimit; }
40 
41  bool isDPITooHigh() { return m_nDPIX > m_nHighDPILimit || m_nDPIY > m_nHighDPILimit; }
42 
43  sal_Int32 getDPIX() { return m_nDPIX; }
44 
45  sal_Int32 getDPIY() { return m_nDPIY; }
46 };
47 
52 class GraphicSizeCheck final
53 {
54 private:
56  std::vector<std::unique_ptr<GraphicSizeViolation>> m_aGraphicSizeViolationList;
57 
58 public:
59  GraphicSizeCheck(SwDoc* pDocument)
60  : m_pDocument(pDocument)
61  {
62  }
63 
64  void check();
65 
66  std::vector<std::unique_ptr<GraphicSizeViolation>>& getViolationList()
67  {
69  }
70 };
71 
74 {
75 private:
77  std::unique_ptr<GraphicSizeViolation> m_pViolation;
78 
79 public:
80  GraphicSizeCheckGUIEntry(SwDoc* pDocument, std::unique_ptr<GraphicSizeViolation>&& pViolation)
81  : m_pDocument(pDocument)
82  , m_pViolation(std::move(pViolation))
83  {
84  }
85 
86  OUString getText() override;
87 
88  bool canMarkObject() override { return true; }
89 
90  void markObject() override;
91 
92  bool hasProperties() override { return true; }
93 
94  void runProperties() override;
95 };
96 
102 {
103 public:
104  GraphicSizeCheckGUIResult(SwDoc* pDocument);
105 
106  OUString getTitle() override;
107 };
108 
109 } // end sw namespace
110 
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< std::unique_ptr< GraphicSizeViolation > > & getViolationList()
The UI part of the GraphicSizeViolation used by GenericCheckDialog.
const OUString & getGraphicName()
Definition: doc.hxx:187
Dialog to specify the properties of date form field.
GraphicSizeCheck(SwDoc *pDocument)
GraphicSizeCheckGUIEntry(SwDoc *pDocument, std::unique_ptr< GraphicSizeViolation > &&pViolation)
GraphicSizeCheckGUIResult(SwDoc *pDocument)
GraphicSizeViolation(sal_Int32 nDPI, const SwGrfNode *pGraphicNode)
Class responsible to check if a graphic object violates the size constraints and store the results...
Run the graphic size checks for all the graphic objects in the DOM and store a list of violations...
The UI part presenting the graphic size check results, which is used by GenericCheckDialog.
const SwGrfNode * m_pGraphicNode
std::vector< std::unique_ptr< GraphicSizeViolation > > m_aGraphicSizeViolationList
std::unique_ptr< GraphicSizeViolation > m_pViolation