LibreOffice Module sdext (master) 1
optimizerdialog.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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <vector>
23#include "optimizationstats.hxx"
25#include <com/sun/star/uno/Sequence.h>
26#include <com/sun/star/uno/XComponentContext.hpp>
27#include <com/sun/star/frame/XDispatch.hpp>
29#include <vcl/roadmapwizard.hxx>
30
31#define MAX_STEP 4
32#define OD_DIALOG_WIDTH 330
33#define DIALOG_HEIGHT 210
34#define BUTTON_WIDTH 50
35#define BUTTON_HEIGHT 14
36#define BUTTON_POS_Y DIALOG_HEIGHT - BUTTON_HEIGHT - 6
37
38#define PAGE_POS_X 91
39#define PAGE_POS_Y 8
40#define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X
41
42#define ITEM_ID_INTRODUCTION 0
43#define ITEM_ID_SLIDES 1
44#define ITEM_ID_GRAPHIC_OPTIMIZATION 2
45#define ITEM_ID_OLE_OPTIMIZATION 3
46#define ITEM_ID_SUMMARY 4
47
48class OptimizerDialog;
49
51{
52private:
54 std::unique_ptr<weld::ComboBox> mxComboBox;
55 std::unique_ptr<weld::Button> mxButton;
56
57 DECL_LINK(ComboBoxActionPerformed, weld::ComboBox&, void);
58 DECL_LINK(ButtonActionPerformed, weld::Button&, void);
59
60public:
61 IntroPage(weld::Container* pPage, OptimizerDialog& rOptimizerDialog);
62 void UpdateControlStates(const std::vector<OUString>& rItemList, int nSelectedItem, bool bRemoveButtonEnabled);
63 OUString Get_TK_Name() const
64 {
65 return mxComboBox->get_active_text();
66 }
67};
68
70{
71private:
73 std::unique_ptr<weld::CheckButton> mxMasterSlides;
74 std::unique_ptr<weld::CheckButton> mxHiddenSlides;
75 std::unique_ptr<weld::CheckButton> mxUnusedSlides;
76 std::unique_ptr<weld::ComboBox> mxComboBox;
77 std::unique_ptr<weld::CheckButton> mxClearNodes;
78
79 DECL_LINK(UnusedMasterPagesActionPerformed, weld::Toggleable&, void);
80 DECL_LINK(UnusedHiddenSlidesActionPerformed, weld::Toggleable&, void);
81 DECL_LINK(UnusedSlidesActionPerformed, weld::Toggleable&, void);
82 DECL_LINK(DeleteNotesActionPerformed, weld::Toggleable&, void);
83
84public:
85 SlidesPage(weld::Container* pPage, OptimizerDialog& rOptimizerDialog);
86 void Init(const css::uno::Sequence<OUString>& rCustomShowList);
87 void UpdateControlStates(bool bDeleteUnusedMasterPages, bool bDeleteHiddenSlides, bool bDeleteNotesPages);
88 OUString Get_TK_CustomShowName() const
89 {
90 if (!mxUnusedSlides->get_sensitive())
91 return OUString();
92 return mxComboBox->get_active_text();
93 }
94};
95
97{
98private:
100 std::unique_ptr<weld::RadioButton> m_xLossLessCompression;
101 std::unique_ptr<weld::Label> m_xQualityLabel;
102 std::unique_ptr<weld::SpinButton> m_xQuality;
103 std::unique_ptr<weld::RadioButton> m_xJpegCompression;
104 std::unique_ptr<weld::ComboBox> m_xResolution;
105 std::unique_ptr<weld::CheckButton> m_xRemoveCropArea;
106 std::unique_ptr<weld::CheckButton> m_xEmbedLinkedGraphics;
107
108 DECL_LINK(EmbedLinkedGraphicsActionPerformed, weld::Toggleable&, void);
109 DECL_LINK(RemoveCropAreaActionPerformed, weld::Toggleable&, void);
110 DECL_LINK(ComboBoxActionPerformed, weld::ComboBox&, void);
111 DECL_LINK(CompressionActionPerformed, weld::Toggleable&, void);
112 DECL_LINK(SpinButtonActionPerformed, weld::SpinButton&, void);
113
114public:
115 ImagesPage(weld::Container* pPage, OptimizerDialog& rOptimizerDialog);
116
117 void UpdateControlStates(bool bJPEGCompression, int nJPEGQuality, bool bRemoveCropArea,
118 int nResolution, bool bEmbedLinkedGraphics);
119};
120
122{
123private:
125 std::unique_ptr<weld::CheckButton> m_xCreateStaticImage;
126 std::unique_ptr<weld::RadioButton> m_xAllOLEObjects;
127 std::unique_ptr<weld::RadioButton> m_xForeignOLEObjects;
128 std::unique_ptr<weld::Label> m_xLabel;
129
130 DECL_LINK(OLEOptimizationActionPerformed, weld::Toggleable&, void);
131 DECL_LINK(OLEActionPerformed, weld::Toggleable&, void);
132
133public:
134 ObjectsPage(weld::Container* pPage, OptimizerDialog& rOptimizerDialog);
135
136 void Init(const OUString& rDesc);
137
138 void UpdateControlStates(bool bConvertOLEObjects, int nOLEOptimizationType);
139};
140
142{
143private:
145 std::unique_ptr<weld::Label> m_xLabel1;
146 std::unique_ptr<weld::Label> m_xLabel2;
147 std::unique_ptr<weld::Label> m_xLabel3;
148 std::unique_ptr<weld::Label> m_xCurrentSize;
149 std::unique_ptr<weld::Label> m_xEstimatedSize;
150 std::unique_ptr<weld::Label> m_xStatus;
151 std::unique_ptr<weld::ProgressBar> m_xProgress;
152 std::unique_ptr<weld::RadioButton> m_xApplyToCurrent;
153 std::unique_ptr<weld::RadioButton> m_xSaveToNew;
154 std::unique_ptr<weld::ComboBox> m_xComboBox;
155 std::unique_ptr<weld::CheckButton> m_xSaveSettings;
156
157 DECL_LINK(SaveSettingsActionPerformed, weld::Toggleable&, void);
158 DECL_LINK(SaveAsNewActionPerformed, weld::Toggleable&, void);
159
160public:
161 SummaryPage(weld::Container* pPage, OptimizerDialog& rOptimizerDialog);
162
163 void Init(const OUString& rSettingsName, bool bIsReadonly);
164
165 void UpdateControlStates(bool bSaveAs, bool bSaveSettingsEnabled,
166 const std::vector<OUString>& rItemList,
167 const std::vector<OUString>& rSummaryStrings,
168 const OUString& rCurrentFileSize,
169 const OUString& rEstimatedFileSize);
170
171 void UpdateStatusLabel(const OUString& rStatus);
172 void UpdateProgressValue(int nProgress);
173
174 bool GetSaveAsNew() const { return m_xSaveToNew->get_active(); }
175 bool GetSaveSettings() const { return m_xSaveSettings->get_active(); }
176 OUString GetSettingsName() const { return m_xComboBox->get_active_text(); }
177};
178
180{
181public:
182
183 OptimizerDialog( const css::uno::Reference< css::uno::XComponentContext >& rxContext, css::uno::Reference< css::frame::XFrame > const & rxFrame,
184 css::uno::Reference< css::frame::XDispatch > const & rxStatusDispatcher );
185 std::unique_ptr<BuilderPage> createPage(vcl::WizardTypes::WizardState nState) override;
187
188 void execute();
189
192
193private:
194 css::uno::Reference< css::frame::XFrame > mxFrame;
195 css::uno::Reference< css::frame::XController > mxController;
196
197 css::uno::Reference< css::frame::XDispatch > mxStatusDispatcher;
198
204
205 void InitDialog();
206 void InitRoadmap();
207 void InitNavigationBar();
208 void InitPage0();
209 void InitPage1();
210 void InitPage2();
211 void InitPage3();
212 void InitPage4();
218
219 virtual OUString getStateDisplayName(vcl::WizardTypes::WizardState nState) const override;
220
221 virtual bool onFinish() override;
222
223public:
224
226
227 void UpdateStatus( const css::uno::Sequence< css::beans::PropertyValue >& rStatus );
228
229 // the ConfigurationAccess is updated to actual control settings
230 void UpdateConfiguration();
231
232 void UpdateControlStates( sal_Int16 nStep = -1 );
233
234 css::uno::Reference< css::frame::XDispatch >& GetStatusDispatcher() { return mxStatusDispatcher; };
235 css::uno::Reference< css::frame::XFrame>& GetFrame() { return mxFrame; };
236};
237
238/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::RadioButton > m_xLossLessCompression
DECL_LINK(SpinButtonActionPerformed, weld::SpinButton &, void)
std::unique_ptr< weld::CheckButton > m_xEmbedLinkedGraphics
void UpdateControlStates(bool bJPEGCompression, int nJPEGQuality, bool bRemoveCropArea, int nResolution, bool bEmbedLinkedGraphics)
DECL_LINK(CompressionActionPerformed, weld::Toggleable &, void)
ImagesPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
std::unique_ptr< weld::CheckButton > m_xRemoveCropArea
std::unique_ptr< weld::ComboBox > m_xResolution
std::unique_ptr< weld::Label > m_xQualityLabel
DECL_LINK(EmbedLinkedGraphicsActionPerformed, weld::Toggleable &, void)
OptimizerDialog & mrOptimizerDialog
std::unique_ptr< weld::RadioButton > m_xJpegCompression
DECL_LINK(ComboBoxActionPerformed, weld::ComboBox &, void)
std::unique_ptr< weld::SpinButton > m_xQuality
DECL_LINK(RemoveCropAreaActionPerformed, weld::Toggleable &, void)
DECL_LINK(ComboBoxActionPerformed, weld::ComboBox &, void)
OUString Get_TK_Name() const
void UpdateControlStates(const std::vector< OUString > &rItemList, int nSelectedItem, bool bRemoveButtonEnabled)
IntroPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
OptimizerDialog & mrOptimizerDialog
std::unique_ptr< weld::ComboBox > mxComboBox
std::unique_ptr< weld::Button > mxButton
DECL_LINK(ButtonActionPerformed, weld::Button &, void)
DECL_LINK(OLEActionPerformed, weld::Toggleable &, void)
void Init(const OUString &rDesc)
OptimizerDialog & mrOptimizerDialog
std::unique_ptr< weld::RadioButton > m_xForeignOLEObjects
std::unique_ptr< weld::Label > m_xLabel
std::unique_ptr< weld::RadioButton > m_xAllOLEObjects
DECL_LINK(OLEOptimizationActionPerformed, weld::Toggleable &, void)
ObjectsPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
void UpdateControlStates(bool bConvertOLEObjects, int nOLEOptimizationType)
std::unique_ptr< weld::CheckButton > m_xCreateStaticImage
SummaryPage * mpPage4
std::unique_ptr< BuilderPage > createPage(vcl::WizardTypes::WizardState nState) override
css::uno::Reference< css::frame::XController > mxController
css::uno::Reference< css::frame::XFrame > mxFrame
void UpdateControlStates(sal_Int16 nStep=-1)
OptimizerDialog(const css::uno::Reference< css::uno::XComponentContext > &rxContext, css::uno::Reference< css::frame::XFrame > const &rxFrame, css::uno::Reference< css::frame::XDispatch > const &rxStatusDispatcher)
css::uno::Reference< css::frame::XFrame > & GetFrame()
SlidesPage * mpPage1
OptimizationStats maStats
css::uno::Reference< css::frame::XDispatch > & GetStatusDispatcher()
void UpdateStatus(const css::uno::Sequence< css::beans::PropertyValue > &rStatus)
css::uno::Reference< css::frame::XDispatch > mxStatusDispatcher
virtual OUString getStateDisplayName(vcl::WizardTypes::WizardState nState) const override
ObjectsPage * mpPage3
virtual bool onFinish() override
ImagesPage * mpPage2
void Init(const css::uno::Sequence< OUString > &rCustomShowList)
DECL_LINK(UnusedSlidesActionPerformed, weld::Toggleable &, void)
std::unique_ptr< weld::CheckButton > mxClearNodes
OUString Get_TK_CustomShowName() const
std::unique_ptr< weld::CheckButton > mxUnusedSlides
DECL_LINK(DeleteNotesActionPerformed, weld::Toggleable &, void)
std::unique_ptr< weld::CheckButton > mxHiddenSlides
void UpdateControlStates(bool bDeleteUnusedMasterPages, bool bDeleteHiddenSlides, bool bDeleteNotesPages)
SlidesPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
OptimizerDialog & mrOptimizerDialog
DECL_LINK(UnusedHiddenSlidesActionPerformed, weld::Toggleable &, void)
DECL_LINK(UnusedMasterPagesActionPerformed, weld::Toggleable &, void)
std::unique_ptr< weld::ComboBox > mxComboBox
std::unique_ptr< weld::CheckButton > mxMasterSlides
void Init(const OUString &rSettingsName, bool bIsReadonly)
SummaryPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
void UpdateControlStates(bool bSaveAs, bool bSaveSettingsEnabled, const std::vector< OUString > &rItemList, const std::vector< OUString > &rSummaryStrings, const OUString &rCurrentFileSize, const OUString &rEstimatedFileSize)
bool GetSaveAsNew() const
std::unique_ptr< weld::Label > m_xLabel3
DECL_LINK(SaveSettingsActionPerformed, weld::Toggleable &, void)
std::unique_ptr< weld::Label > m_xLabel2
std::unique_ptr< weld::Label > m_xEstimatedSize
bool GetSaveSettings() const
OptimizerDialog & mrOptimizerDialog
std::unique_ptr< weld::CheckButton > m_xSaveSettings
std::unique_ptr< weld::Label > m_xLabel1
std::unique_ptr< weld::ProgressBar > m_xProgress
OUString GetSettingsName() const
void UpdateProgressValue(int nProgress)
DECL_LINK(SaveAsNewActionPerformed, weld::Toggleable &, void)
std::unique_ptr< weld::Label > m_xCurrentSize
std::unique_ptr< weld::Label > m_xStatus
void UpdateStatusLabel(const OUString &rStatus)
std::unique_ptr< weld::ComboBox > m_xComboBox
std::unique_ptr< weld::RadioButton > m_xSaveToNew
std::unique_ptr< weld::RadioButton > m_xApplyToCurrent
sal_Int32 nState
sal_Int16 WizardState