13#include <svx/strings.hrc>
16#include <svx/svxids.hrc>
31class ModelTraverseHandler
34 virtual ~ModelTraverseHandler() {}
36 virtual void handleSdrObject(
SdrObject* pObject) = 0;
46 std::vector<std::shared_ptr<ModelTraverseHandler>> m_pNodeHandler;
51 : m_pDocument(pDocument)
60 for (sal_uInt16 nPage = 0; nPage < m_pDocument->
GetPageCount(); ++nPage)
65 for (
size_t nObject = 0; nObject < pPage->
GetObjCount(); ++nObject)
70 for (
auto& pNodeHandler : m_pNodeHandler)
72 pNodeHandler->handleSdrObject(pObject);
80 void addNodeHandler(std::shared_ptr<ModelTraverseHandler> pHandler)
82 m_pNodeHandler.push_back(pHandler);
88 : m_pGraphicObject(pGraphicObject)
90 constexpr double fLowPercentage = 110;
91 constexpr double fHighPercentage = 50;
118class GraphicSizeCheckHandler :
public ModelTraverseHandler
121 std::vector<std::unique_ptr<GraphicSizeViolation>>& m_rGraphicSizeViolationList;
124 GraphicSizeCheckHandler(
126 std::vector<std::unique_ptr<GraphicSizeViolation>>& rGraphicSizeViolationList)
128 , m_rGraphicSizeViolationList(rGraphicSizeViolationList)
132 void handleSdrObject(
SdrObject* pObject)
override
138 auto pEntry = std::make_unique<GraphicSizeViolation>(m_nDPI, pGraphicObject);
141 m_rGraphicSizeViolationList.push_back(std::move(pEntry));
160 aModelTraverser.addNodeHandler(pHandler);
161 aModelTraverser.traverse();
170 sText =
SdResId(STR_WARNING_GRAPHIC_PIXEL_COUNT_LOW);
174 sText =
SdResId(STR_WARNING_GRAPHIC_PIXEL_COUNT_HIGH);
177 sText = sText.replaceAll(
"%NAME%",
m_pViolation->getGraphicName());
178 sText = sText.replaceAll(
"%DPIX%", OUString::number(
m_pViolation->getDPIX()));
179 sText = sText.replaceAll(
"%DPIY%", OUString::number(
m_pViolation->getDPIY()));
209 = std::make_unique<GraphicSizeCheckGUIEntry>(pDocument, std::move(rpViolation));
210 rCollection.push_back(std::move(rGUIEntry));
216 return SdResId(STR_GRAPHIC_SIZE_CHECK_DIALOG_TITLE);
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
sal_Int32 getImagePreferredDPI() const override
const Graphic & GetGraphic() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
SdrPageView * ShowSdrPage(SdrPage *pPage) override
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual const OUString & GetName() const
SdrPageView * GetSdrPageView() const
virtual const tools::Rectangle & GetLogicRect() const override
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SfxDispatcher * GetDispatcher() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void markObject() override
SdDrawDocument * m_pDocument
std::unique_ptr< GraphicSizeViolation > m_pViolation
OUString getText() override
void runProperties() override
OUString getTitle() override
GraphicSizeCheckGUIResult(SdDrawDocument *m_pDocument)
Run the graphic size checks for all the graphic objects in the DOM and store a list of violations.
std::vector< std::unique_ptr< GraphicSizeViolation > > & getViolationList()
std::vector< std::unique_ptr< GraphicSizeViolation > > m_aGraphicSizeViolationList
SdDrawDocument * m_pDocument
sal_Int32 m_nHighDPILimit
GraphicSizeViolation(sal_Int32 nDPI, SdrGrafObj *pGraphicObject)
SdrGrafObj * m_pGraphicObject
const OUString & getGraphicName()
Base class of the stacked shell hierarchy.
::sd::View * GetView() const
std::vector< std::unique_ptr< CheckData > > & getCollection()
EmbeddedObjectRef * pObject
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OUString SdResId(TranslateId aId)