vcl: allow for overriding the default PDF rendering resolution
[LibreOffice.git] / sdext / source / minimizer / optimizerdialog.hxx
blob4ea28eb7590a0567a3cf27ae917d464a3f2558db
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SDEXT_SOURCE_MINIMIZER_OPTIMIZERDIALOG_HXX
21 #define INCLUDED_SDEXT_SOURCE_MINIMIZER_OPTIMIZERDIALOG_HXX
22 #include <vector>
23 #include "unodialog.hxx"
24 #include "optimizationstats.hxx"
25 #include "configurationaccess.hxx"
26 #include <com/sun/star/awt/XItemListener.hpp>
27 #include <com/sun/star/awt/XSpinListener.hpp>
28 #include <com/sun/star/awt/XTextListener.hpp>
29 #include <com/sun/star/uno/Sequence.h>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/frame/XDispatch.hpp>
32 #include <cppuhelper/implbase.hxx>
34 #define MAX_STEP 4
35 #define OD_DIALOG_WIDTH 330
36 #define DIALOG_HEIGHT 210
37 #define BUTTON_WIDTH 50
38 #define BUTTON_HEIGHT 14
39 #define BUTTON_POS_Y DIALOG_HEIGHT - BUTTON_HEIGHT - 6
41 #define PAGE_POS_X 91
42 #define PAGE_POS_Y 8
43 #define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X
45 #define ITEM_ID_INTRODUCTION 0
46 #define ITEM_ID_SLIDES 1
47 #define ITEM_ID_GRAPHIC_OPTIMIZATION 2
48 #define ITEM_ID_OLE_OPTIMIZATION 3
49 #define ITEM_ID_SUMMARY 4
51 class OptimizerDialog : public UnoDialog, public ConfigurationAccess
53 public:
55 OptimizerDialog( const css::uno::Reference< css::uno::XComponentContext >& rxContext, css::uno::Reference< css::frame::XFrame > const & rxFrame,
56 css::uno::Reference< css::frame::XDispatch > const & rxStatusDispatcher );
57 ~OptimizerDialog();
59 void execute();
61 sal_Int16 mnCurrentStep;
62 sal_Int16 mnTabIndex;
63 bool mbIsReadonly;
65 private:
66 css::uno::Reference< css::frame::XFrame > mxFrame;
68 css::uno::Reference< css::uno::XInterface > mxRoadmapControl;
69 css::uno::Reference< css::uno::XInterface > mxRoadmapControlModel;
71 css::uno::Reference< css::awt::XItemListener > mxItemListener;
72 css::uno::Reference< css::awt::XActionListener > mxActionListener;
73 css::uno::Reference< css::awt::XActionListener > mxActionListenerListBox0Pg0;
74 css::uno::Reference< css::awt::XTextListener > mxTextListenerFormattedField0Pg1;
75 css::uno::Reference< css::awt::XTextListener > mxTextListenerComboBox0Pg1;
76 css::uno::Reference< css::awt::XSpinListener > mxSpinListenerFormattedField0Pg1;
77 css::uno::Reference< css::frame::XDispatch > mxStatusDispatcher;
79 std::vector< std::vector< OUString > > maControlPages;
81 void InitDialog();
82 void InitRoadmap();
83 void InitNavigationBar();
84 void InitPage0();
85 void InitPage1();
86 void InitPage2();
87 void InitPage3();
88 void InitPage4();
89 void UpdateControlStatesPage0();
90 void UpdateControlStatesPage1();
91 void UpdateControlStatesPage2();
92 void UpdateControlStatesPage3();
93 void UpdateControlStatesPage4();
95 void ActivatePage( sal_Int16 nStep );
96 void DeactivatePage( sal_Int16 nStep );
97 void InsertRoadmapItem( const sal_Int32 nIndex, const OUString& rLabel, const sal_Int32 nItemID );
99 public:
101 OptimizationStats maStats;
103 void UpdateStatus( const css::uno::Sequence< css::beans::PropertyValue >& rStatus );
105 // the ConfigurationAccess is updated to actual control settings
106 void UpdateConfiguration();
108 void EnablePage( sal_Int16 nStep );
109 void DisablePage( sal_Int16 nStep );
111 void SwitchPage( sal_Int16 nNewStep );
112 void UpdateControlStates( sal_Int16 nStep = -1 );
114 OUString GetSelectedString( OUString const & token );
115 css::uno::Reference< css::frame::XDispatch >& GetStatusDispatcher() { return mxStatusDispatcher; };
116 css::uno::Reference< css::frame::XFrame>& GetFrame() { return mxFrame; };
117 const css::uno::Reference< css::uno::XComponentContext >& GetComponentContext() const { return UnoDialog::mxContext; };
121 class ItemListener : public ::cppu::WeakImplHelper< css::awt::XItemListener >
123 public:
124 explicit ItemListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
126 virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& Event ) override;
127 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
128 private:
130 OptimizerDialog& mrOptimizerDialog;
134 class ActionListener : public ::cppu::WeakImplHelper< css::awt::XActionListener >
136 public:
137 explicit ActionListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
139 virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& Event ) override;
140 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
141 private:
143 OptimizerDialog& mrOptimizerDialog;
147 class ActionListenerListBox0Pg0 : public ::cppu::WeakImplHelper< css::awt::XActionListener >
149 public:
150 explicit ActionListenerListBox0Pg0( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
152 virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& Event ) override;
153 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
154 private:
156 OptimizerDialog& mrOptimizerDialog;
160 class TextListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper< css::awt::XTextListener >
162 public:
163 explicit TextListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
165 virtual void SAL_CALL textChanged( const css::awt::TextEvent& Event ) override;
166 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
167 private:
169 OptimizerDialog& mrOptimizerDialog;
173 class TextListenerComboBox0Pg1 : public ::cppu::WeakImplHelper< css::awt::XTextListener >
175 public:
176 explicit TextListenerComboBox0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
178 virtual void SAL_CALL textChanged( const css::awt::TextEvent& Event ) override;
179 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
180 private:
182 OptimizerDialog& mrOptimizerDialog;
186 class SpinListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper< css::awt::XSpinListener >
188 public:
189 explicit SpinListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
191 virtual void SAL_CALL up( const css::awt::SpinEvent& Event ) override;
192 virtual void SAL_CALL down( const css::awt::SpinEvent& Event ) override;
193 virtual void SAL_CALL first( const css::awt::SpinEvent& Event ) override;
194 virtual void SAL_CALL last( const css::awt::SpinEvent& Event ) override;
195 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
196 private:
198 OptimizerDialog& mrOptimizerDialog;
201 #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_OPTIMIZERDIALOG_HXX
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */