1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
14 #include <svx/GenericCheckDialog.hxx>
19 * Class responsible to check if a graphic object violates the size
20 * constraints and store the results.
22 class GraphicSizeViolation final
25 const SwGrfNode
* m_pGraphicNode
;
27 sal_Int32 m_nLowDPILimit
= 0;
28 sal_Int32 m_nHighDPILimit
= 0;
30 sal_Int32 m_nDPIX
= 0;
31 sal_Int32 m_nDPIY
= 0;
34 GraphicSizeViolation(sal_Int32 nDPI
, const SwGrfNode
* pGraphicNode
);
37 const OUString
& getGraphicName();
39 bool isDPITooLow() { return m_nDPIX
< m_nLowDPILimit
|| m_nDPIY
< m_nLowDPILimit
; }
41 bool isDPITooHigh() { return m_nDPIX
> m_nHighDPILimit
|| m_nDPIY
> m_nHighDPILimit
; }
43 sal_Int32
getDPIX() { return m_nDPIX
; }
45 sal_Int32
getDPIY() { return m_nDPIY
; }
49 * Run the graphic size checks for all the graphic objects in the DOM
50 * and store a list of violations.
52 class GraphicSizeCheck final
56 std::vector
<std::unique_ptr
<GraphicSizeViolation
>> m_aGraphicSizeViolationList
;
59 GraphicSizeCheck(SwDoc
* pDocument
)
60 : m_pDocument(pDocument
)
66 std::vector
<std::unique_ptr
<GraphicSizeViolation
>>& getViolationList()
68 return m_aGraphicSizeViolationList
;
72 /** The UI part of the GraphicSizeViolation used by GenericCheckDialog */
73 class GraphicSizeCheckGUIEntry final
: public svx::CheckData
77 std::unique_ptr
<GraphicSizeViolation
> m_pViolation
;
80 GraphicSizeCheckGUIEntry(SwDoc
* pDocument
, std::unique_ptr
<GraphicSizeViolation
>&& pViolation
)
81 : m_pDocument(pDocument
)
82 , m_pViolation(std::move(pViolation
))
86 OUString
getText() override
;
88 bool canMarkObject() override
{ return true; }
90 void markObject() override
;
92 bool hasProperties() override
{ return true; }
94 void runProperties() override
;
98 * The UI part presenting the graphic size check results, which is
99 * used by GenericCheckDialog
101 class GraphicSizeCheckGUIResult final
: public svx::CheckDataCollection
104 GraphicSizeCheckGUIResult(SwDoc
* pDocument
);
106 OUString
getTitle() override
;
109 } // end sw namespace
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */