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 #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>
33 
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
40 
41 #define PAGE_POS_X 91
42 #define PAGE_POS_Y 8
43 #define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X
44 
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
50 
52 {
53 public:
54 
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 );
58 
59  void execute();
60 
61  sal_Int16 mnCurrentStep;
62  sal_Int16 mnTabIndex;
64 
65 private:
66  css::uno::Reference< css::frame::XFrame > mxFrame;
67 
68  css::uno::Reference< css::uno::XInterface > mxRoadmapControl;
69  css::uno::Reference< css::uno::XInterface > mxRoadmapControlModel;
70 
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;
78 
79  std::vector< std::vector< OUString > > maControlPages;
80 
81  void InitDialog();
82  void InitRoadmap();
83  void InitNavigationBar();
84  void InitPage0();
85  void InitPage1();
86  void InitPage2();
87  void InitPage3();
88  void InitPage4();
94 
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 );
98 
99 public:
100 
102 
103  void UpdateStatus( const css::uno::Sequence< css::beans::PropertyValue >& rStatus );
104 
105  // the ConfigurationAccess is updated to actual control settings
106  void UpdateConfiguration();
107 
108  void EnablePage( sal_Int16 nStep );
109  void DisablePage( sal_Int16 nStep );
110 
111  void SwitchPage( sal_Int16 nNewStep );
112  void UpdateControlStates( sal_Int16 nStep = -1 );
113 
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; };
118 };
119 
120 
121 class ItemListener : public ::cppu::WeakImplHelper< css::awt::XItemListener >
122 {
123 public:
124  explicit ItemListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
125 
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:
129 
131 };
132 
133 
134 class ActionListener : public ::cppu::WeakImplHelper< css::awt::XActionListener >
135 {
136 public:
137  explicit ActionListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
138 
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:
142 
144 };
145 
146 
147 class ActionListenerListBox0Pg0 : public ::cppu::WeakImplHelper< css::awt::XActionListener >
148 {
149 public:
150  explicit ActionListenerListBox0Pg0( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
151 
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:
155 
157 };
158 
159 
160 class TextListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper< css::awt::XTextListener >
161 {
162 public:
163  explicit TextListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
164 
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:
168 
170 };
171 
172 
173 class TextListenerComboBox0Pg1 : public ::cppu::WeakImplHelper< css::awt::XTextListener >
174 {
175 public:
176  explicit TextListenerComboBox0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
177 
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:
181 
183 };
184 
185 
186 class SpinListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper< css::awt::XSpinListener >
187 {
188 public:
189  explicit SpinListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){}
190 
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:
197 
199 };
200 
201 #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_OPTIMIZERDIALOG_HXX
202 
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TextListenerComboBox0Pg1(OptimizerDialog &rOptimizerDialog)
virtual void SAL_CALL actionPerformed(const css::awt::ActionEvent &Event) override
void EnablePage(sal_Int16 nStep)
css::uno::Reference< css::awt::XTextListener > mxTextListenerComboBox0Pg1
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
std::vector< std::vector< OUString > > maControlPages
SpinListenerFormattedField0Pg1(OptimizerDialog &rOptimizerDialog)
virtual void SAL_CALL up(const css::awt::SpinEvent &Event) override
OptimizerDialog & mrOptimizerDialog
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)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::uno::Reference< css::awt::XActionListener > mxActionListenerListBox0Pg0
void ActivatePage(sal_Int16 nStep)
css::uno::Reference< css::frame::XFrame > & GetFrame()
virtual void SAL_CALL itemStateChanged(const css::awt::ItemEvent &Event) override
css::uno::Reference< css::frame::XDispatch > & GetStatusDispatcher()
ActionListener(OptimizerDialog &rOptimizerDialog)
void InsertRoadmapItem(const sal_Int32 nIndex, const OUString &rLabel, const sal_Int32 nItemID)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
OptimizerDialog & mrOptimizerDialog
css::uno::Reference< css::uno::XInterface > mxRoadmapControl
OptimizerDialog & mrOptimizerDialog
ItemListener(OptimizerDialog &rOptimizerDialog)
css::uno::Reference< css::awt::XItemListener > mxItemListener
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
TextListenerFormattedField0Pg1(OptimizerDialog &rOptimizerDialog)
void SwitchPage(sal_Int16 nNewStep)
void DeactivatePage(sal_Int16 nStep)
void UpdateStatus(const css::uno::Sequence< css::beans::PropertyValue > &rStatus)
OptimizerDialog & mrOptimizerDialog
virtual void SAL_CALL actionPerformed(const css::awt::ActionEvent &Event) override
css::uno::Reference< css::uno::XComponentContext > mxContext
Definition: unodialog.hxx:98
css::uno::Reference< css::awt::XTextListener > mxTextListenerFormattedField0Pg1
virtual void SAL_CALL first(const css::awt::SpinEvent &Event) override
void DisablePage(sal_Int16 nStep)
css::uno::Reference< css::frame::XFrame > mxFrame
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL last(const css::awt::SpinEvent &Event) override
virtual void SAL_CALL textChanged(const css::awt::TextEvent &Event) override
void UpdateControlStates(sal_Int16 nStep=-1)
OUString GetSelectedString(OUString const &token)
css::uno::Reference< css::awt::XSpinListener > mxSpinListenerFormattedField0Pg1
css::uno::Reference< css::uno::XInterface > mxRoadmapControlModel
ActionListenerListBox0Pg0(OptimizerDialog &rOptimizerDialog)
css::uno::Reference< css::awt::XActionListener > mxActionListener
OptimizationStats maStats
css::uno::Reference< css::frame::XDispatch > mxStatusDispatcher
sal_Int16 mnCurrentStep
virtual void SAL_CALL down(const css::awt::SpinEvent &Event) override
const css::uno::Reference< css::uno::XComponentContext > & GetComponentContext() const
virtual void SAL_CALL textChanged(const css::awt::TextEvent &Event) override