diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-12-07 23:25:54 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-12-20 06:21:34 +0100 |
commit | 046e6cfa544d2ffd67fd29ba7dde41b495744618 (patch) | |
tree | b32fa69e90091ab53c311a0735edb49fa62730d0 /svx | |
parent | b5c616d10bff3213840d4893d13b4493de71fa56 (diff) |
Add graphic size checker for the preferred document DPI
This change adds a graphic size checker, which checks all the
images in the document, if they largely differ (outside of 50% and
110% of the image size) from the set preferred image DPI document
setting. For all images that don't fall under this bounds, list
them in the dialog and offer the posibility to select/goto the
image and pop-up the properties dialog for the image to change
its size.
Change-Id: I06efce77c291fdb6ec3864d72c2f4d15dba9c42b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127094
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Library_svx.mk | 1 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 2 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 17 | ||||
-rw-r--r-- | svx/source/dialog/GenericCheckDialog.cxx | 70 | ||||
-rw-r--r-- | svx/uiconfig/ui/genericcheckdialog.ui | 132 | ||||
-rw-r--r-- | svx/uiconfig/ui/genericcheckentry.ui | 56 |
6 files changed, 278 insertions, 0 deletions
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index efb5a6e1b031..a13f1cade697 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -105,6 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/customshapes/EnhancedCustomShapeFontWork \ svx/source/customshapes/EnhancedCustomShapeHandle \ svx/source/dialog/AccessibilityCheckDialog \ + svx/source/dialog/GenericCheckDialog \ svx/source/dialog/_bmpmask \ svx/source/dialog/charmap \ svx/source/dialog/searchcharmap \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 2186185f10c2..33bc1797f20f 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -78,6 +78,8 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/functionmenu \ svx/uiconfig/ui/gallerymenu1 \ svx/uiconfig/ui/gallerymenu2 \ + svx/uiconfig/ui/genericcheckdialog \ + svx/uiconfig/ui/genericcheckentry \ svx/uiconfig/ui/grafctrlbox \ svx/uiconfig/ui/grafmodebox \ svx/uiconfig/ui/headfootformatpage \ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 1e08145d3644..f0314fe63360 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -12425,6 +12425,23 @@ SfxVoidItem SpellCheckApplySuggestion SID_SPELLCHECK_APPLY_SUGGESTION GroupId = SfxGroupId::Format; ] +SfxVoidItem GraphicSizeCheck SID_GRAPHIC_SIZE_CHECK +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Modify; +] + SfxVoidItem AccessibilityCheck SID_ACCESSIBILITY_CHECK () [ diff --git a/svx/source/dialog/GenericCheckDialog.cxx b/svx/source/dialog/GenericCheckDialog.cxx new file mode 100644 index 000000000000..09fc3d678769 --- /dev/null +++ b/svx/source/dialog/GenericCheckDialog.cxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#include <svx/GenericCheckDialog.hxx> +#include <vcl/svapp.hxx> + +namespace svx +{ +GenericCheckEntry::GenericCheckEntry(weld::Container* pParent, + std::unique_ptr<CheckData>& pCheckData) + : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/genericcheckentry.ui")) + , m_xContainer(m_xBuilder->weld_container("checkEntryBox")) + , m_xLabel(m_xBuilder->weld_label("label")) + , m_xMarkButton(m_xBuilder->weld_button("markButton")) + , m_xPropertiesButton(m_xBuilder->weld_button("propertiesButton")) + , m_pCheckData(pCheckData) +{ + m_xLabel->set_label(m_pCheckData->getText()); + m_xMarkButton->set_visible(m_pCheckData->canMarkObject()); + m_xMarkButton->connect_clicked(LINK(this, GenericCheckEntry, MarkButtonClicked)); + m_xPropertiesButton->set_visible(m_pCheckData->hasProperties()); + m_xPropertiesButton->connect_clicked(LINK(this, GenericCheckEntry, PropertiesButtonClicked)); + + m_xContainer->show(); +} + +IMPL_LINK_NOARG(GenericCheckEntry, MarkButtonClicked, weld::Button&, void) +{ + m_pCheckData->markObject(); +} + +IMPL_LINK_NOARG(GenericCheckEntry, PropertiesButtonClicked, weld::Button&, void) +{ + m_pCheckData->runProperties(); +} + +GenericCheckDialog::GenericCheckDialog(weld::Window* pParent, + CheckDataCollection& rCheckDataCollection) + : GenericDialogController(pParent, "svx/ui/genericcheckdialog.ui", "GenericCheckDialog") + , m_rCheckDataCollection(rCheckDataCollection) + , m_xCheckBox(m_xBuilder->weld_box("checkBox")) +{ + set_title(m_rCheckDataCollection.getTitle()); +} + +GenericCheckDialog::~GenericCheckDialog() {} + +short GenericCheckDialog::run() +{ + sal_Int32 i = 0; + + for (std::unique_ptr<CheckData>& pCheckData : m_rCheckDataCollection.getCollection()) + { + auto xEntry = std::make_unique<GenericCheckEntry>(m_xCheckBox.get(), pCheckData); + m_xCheckBox->reorder_child(xEntry->get_widget(), i++); + m_aCheckEntries.push_back(std::move(xEntry)); + } + return GenericDialogController::run(); +} + +} // end svx namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/uiconfig/ui/genericcheckdialog.ui b/svx/uiconfig/ui/genericcheckdialog.ui new file mode 100644 index 000000000000..232221c0a878 --- /dev/null +++ b/svx/uiconfig/ui/genericcheckdialog.ui @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkDialog" id="GenericCheckDialog"> + <property name="width-request">850</property> + <property name="height-request">480</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border-width">6</property> + <property name="modal">True</property> + <property name="type-hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialogBox1"> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialogButtons"> + <property name="can-focus">False</property> + <property name="layout-style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label" translatable="yes" context="stock">_OK</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="can-default">True</property> + <property name="has-default">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label" translatable="yes" context="stock">_Cancel</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label" translatable="yes" context="stock">_Help</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + <property name="secondary">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack-type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow-type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkBox" id="checkBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> + <action-widget response="-11">help</action-widget> + </action-widgets> + </object> +</interface> diff --git a/svx/uiconfig/ui/genericcheckentry.ui b/svx/uiconfig/ui/genericcheckentry.ui new file mode 100644 index 000000000000..1b02ca13eeac --- /dev/null +++ b/svx/uiconfig/ui/genericcheckentry.ui @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkBox" id="checkEntryBox"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="border-width">3</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="hexpand">True</property> + <property name="selectable">True</property> + <property name="xalign">0</property> + <child internal-child="accessible"> + <object class="AtkObject" id="label-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="markButton"> + <property name="label" translatable="yes" context="genericcheckentry|markButton">Mark</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="propertiesButton"> + <property name="label" translatable="yes" context="genericcheckentry|propertiesButton">Properties</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + </object> +</interface> |