optimizerdialog.hxx (e4a7f284) optimizerdialog.hxx (880c69c6)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 37 unchanged lines hidden (view full) ---

46#include <com/sun/star/awt/XItemEventBroadcaster.hpp>
47#ifndef _COM_SUN_STAR_UTIL_XCloseListener_HPP_
48#include <com/sun/star/util/XCloseListener.hpp>
49#endif
50#include <com/sun/star/frame/XStorable.hpp>
51#include <com/sun/star/frame/XDispatch.hpp>
52#include <com/sun/star/frame/XDesktop.hpp>
53#include <com/sun/star/awt/PushButtonType.hpp>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 37 unchanged lines hidden (view full) ---

46#include <com/sun/star/awt/XItemEventBroadcaster.hpp>
47#ifndef _COM_SUN_STAR_UTIL_XCloseListener_HPP_
48#include <com/sun/star/util/XCloseListener.hpp>
49#endif
50#include <com/sun/star/frame/XStorable.hpp>
51#include <com/sun/star/frame/XDispatch.hpp>
52#include <com/sun/star/frame/XDesktop.hpp>
53#include <com/sun/star/awt/PushButtonType.hpp>
54#include <cppuhelper/implbase5.hxx>
55#include <cppuhelper/implbase1.hxx>
56
57#define MAX_STEP 4
58#define OD_DIALOG_WIDTH 330
59#define DIALOG_HEIGHT 210
60#define BUTTON_WIDTH 50
61#define BUTTON_HEIGHT 14
62#define BUTTON_POS_Y DIALOG_HEIGHT - BUTTON_HEIGHT - 6
63
64#define PAGE_POS_X 91
65#define PAGE_POS_Y 8
66#define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X
67
68// -------------------
69// - OPTIMIZERDIALOG -
70// -------------------
54
55#define MAX_STEP 4
56#define OD_DIALOG_WIDTH 330
57#define DIALOG_HEIGHT 210
58#define BUTTON_WIDTH 50
59#define BUTTON_HEIGHT 14
60#define BUTTON_POS_Y DIALOG_HEIGHT - BUTTON_HEIGHT - 6
61
62#define PAGE_POS_X 91
63#define PAGE_POS_Y 8
64#define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X
65
66// -------------------
67// - OPTIMIZERDIALOG -
68// -------------------
71
72typedef ::cppu::WeakImplHelper5<
73 com::sun::star::frame::XStatusListener,
74 com::sun::star::awt::XSpinListener,
75 com::sun::star::awt::XItemListener,
76 com::sun::star::awt::XActionListener,
77 com::sun::star::awt::XTextListener > OptimizerDialog_Base;
78
79class OptimizerDialog : public UnoDialog, public ConfigurationAccess, public OptimizerDialog_Base
69class OptimizerDialog : public UnoDialog, public ConfigurationAccess
80{
81public :
82
70{
71public :
72
83 OptimizerDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
84 const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame,
85 const com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >& rxParent );
73 OptimizerDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF, com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rxFrame,
74 com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > rxStatusDispatcher );
86 ~OptimizerDialog();
87
75 ~OptimizerDialog();
76
88 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& aState ) throw (::com::sun::star::uno::RuntimeException);
89 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aSource ) throw (::com::sun::star::uno::RuntimeException);
90
91 virtual void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
92 virtual void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
93 virtual void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
94 virtual void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
95 virtual void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
96 virtual void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
97 virtual void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
98
99 sal_Bool execute();
100
77 sal_Bool execute();
78
79 sal_Int16 mnCurrentStep;
80 sal_Int16 mnTabIndex;
81 sal_Bool mbIsReadonly;
82
101private :
83private :
102 com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxFrame;
103 sal_Int16 mnCurrentStep;
104 sal_Int16 mnTabIndex;
105 sal_Bool mbIsReadonly;
106 com::sun::star::uno::Reference< com::sun::star::frame::XModel > mxModel;
84 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >mxMSF;
85 com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxFrame;
86
107 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxRoadmapControl;
108 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxRoadmapControlModel;
109
87 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxRoadmapControl;
88 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxRoadmapControlModel;
89
90 com::sun::star::uno::Reference< com::sun::star::awt::XItemListener > mxItemListener;
91 com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > mxActionListener;
92 com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > mxActionListenerListBox0Pg0;
93 com::sun::star::uno::Reference< com::sun::star::awt::XTextListener > mxTextListenerFormattedField0Pg1;
94 com::sun::star::uno::Reference< com::sun::star::awt::XTextListener > mxTextListenerComboBox0Pg1;
95 com::sun::star::uno::Reference< com::sun::star::awt::XSpinListener > mxSpinListenerFormattedField0Pg1;
96 com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > mxStatusDispatcher;
97
110 std::vector< std::vector< rtl::OUString > > maControlPages;
98 std::vector< std::vector< rtl::OUString > > maControlPages;
111 OptimizationStats maStats;
112
113 void InitDialog();
114 void InitRoadmap();
115 void InitNavigationBar();
116 void InitPage0();
117 void InitPage1();
118 void InitPage2();
119 void InitPage3();
120 void InitPage4();
121 void UpdateControlStatesPage0();
122 void UpdateControlStatesPage1();
123 void UpdateControlStatesPage2();
124 void UpdateControlStatesPage3();
125 void UpdateControlStatesPage4();
126
127 void ActivatePage( sal_Int16 nStep );
128 void DeactivatePage( sal_Int16 nStep );
99
100 void InitDialog();
101 void InitRoadmap();
102 void InitNavigationBar();
103 void InitPage0();
104 void InitPage1();
105 void InitPage2();
106 void InitPage3();
107 void InitPage4();
108 void UpdateControlStatesPage0();
109 void UpdateControlStatesPage1();
110 void UpdateControlStatesPage2();
111 void UpdateControlStatesPage3();
112 void UpdateControlStatesPage4();
113
114 void ActivatePage( sal_Int16 nStep );
115 void DeactivatePage( sal_Int16 nStep );
129 void EnablePage( sal_Int16 nStep );
130 void DisablePage( sal_Int16 nStep );
131 void SwitchPage( sal_Int16 nNewStep );
116 void InsertRoadmapItem( const sal_Int32 nIndex, const sal_Bool bEnabled, const rtl::OUString& rLabel, const sal_Int32 nItemID );
132
117
133 // the ConfigurationAccess is updated to actual control settings
134 void UpdateConfiguration();
135 void UpdateStatus( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rStatus );
136 void UpdateControlStates( sal_Int16 nStep = -1 );
118public :
137
119
138 rtl::OUString GetSelectedString( PPPOptimizerTokenEnum eListBox );
139 void ImplSetBold( const rtl::OUString& rControl );
140 void InsertRoadmapItem( const sal_Int32 nIndex,
141 const sal_Bool bEnabled,
142 const rtl::OUString& rLabel,
143 const sal_Int32 nItemID );
144 rtl::OUString ImplInsertSeparator( const rtl::OUString& rControlName,
145 sal_Int32 nOrientation,
146 sal_Int32 nPosX,
147 sal_Int32 nPosY,
148 sal_Int32 nWidth,
149 sal_Int32 nHeight );
150 rtl::OUString ImplInsertButton( const rtl::OUString& rControlName,
151 const rtl::OUString& rHelpURL,
152 sal_Int32 nXPos,
153 sal_Int32 nYPos,
154 sal_Int32 nWidth,
155 sal_Int32 nHeight,
156 sal_Int16 nTabIndex,
157 sal_Bool bEnabled,
158 sal_Int32 nResID,
159 sal_Int16 nPushButtonType );
160 rtl::OUString ImplInsertFixedText( const rtl::OUString& rControlName,
161 const rtl::OUString& rLabel,
162 sal_Int32 nXPos,
163 sal_Int32 nYPos,
164 sal_Int32 nWidth,
165 sal_Int32 nHeight,
166 sal_Bool bMultiLine,
167 sal_Bool bBold,
168 sal_Int16 nTabIndex );
169 rtl::OUString ImplInsertCheckBox( const rtl::OUString& rControlName,
170 const rtl::OUString& rLabel,
171 const rtl::OUString& rHelpURL,
172 sal_Int32 nXPos,
173 sal_Int32 nYPos,
174 sal_Int32 nWidth,
175 sal_Int32 nHeight,
176 sal_Int16 nTabIndex );
177 rtl::OUString ImplInsertFormattedField( const rtl::OUString& rControlName,
178 const rtl::OUString& rHelpURL,
179 sal_Int32 nXPos,
180 sal_Int32 nYPos,
181 sal_Int32 nWidth,
182 double fEffectiveMin,
183 double fEffectiveMax,
184 sal_Int16 nTabIndex );
185 rtl::OUString ImplInsertComboBox( const rtl::OUString& rControlName,
186 const rtl::OUString& rHelpURL,
187 const sal_Bool bEnabled,
188 const com::sun::star::uno::Sequence< rtl::OUString >& rItemList,
189 sal_Int32 nXPos,
190 sal_Int32 nYPos,
191 sal_Int32 nWidth,
192 sal_Int32 nHeight,
193 sal_Int16 nTabIndex,
194 bool bListen = true );
195 rtl::OUString ImplInsertRadioButton( const rtl::OUString& rControlName,
196 const rtl::OUString& rLabel,
197 const rtl::OUString& rHelpURL,
198 sal_Int32 nXPos,
199 sal_Int32 nYPos,
200 sal_Int32 nWidth,
201 sal_Int32 nHeight,
202 sal_Bool bMultiLine,
203 sal_Int16 nTabIndex );
204 rtl::OUString ImplInsertListBox( const rtl::OUString& rControlName,
205 const rtl::OUString& rHelpURL,
206 const sal_Bool bEnabled,
207 const com::sun::star::uno::Sequence< rtl::OUString >& rItemList,
208 sal_Int32 nXPos,
209 sal_Int32 nYPos,
210 sal_Int32 nWidth,
211 sal_Int32 nHeight,
212 sal_Int16 nTabIndex );
120 OptimizationStats maStats;
121
122 void UpdateStatus( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rStatus );
123
124 // the ConfigurationAccess is updated to actual control settings
125 void UpdateConfiguration();
126
127 void EnablePage( sal_Int16 nStep );
128 void DisablePage( sal_Int16 nStep );
129
130 void SwitchPage( sal_Int16 nNewStep );
131 void UpdateControlStates( sal_Int16 nStep = -1 );
132
133 rtl::OUString GetSelectedString( PPPOptimizerTokenEnum eListBox );
134 com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >& GetStatusDispatcher() { return mxStatusDispatcher; };
135 com::sun::star::uno::Reference< com::sun::star::frame::XFrame>& GetFrame() { return mxFrame; };
136 const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& GetComponentContext() { return mxMSF; };
213};
214
137};
138
139// -----------------------------------------------------------------------------
140
141class ItemListener : public ::cppu::WeakImplHelper1< com::sun::star::awt::XItemListener >
142{
143public:
144 ItemListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
145
146 virtual void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
147 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
148private:
149
150 OptimizerDialog& mrOptimizerDialog;
151};
152
153// -----------------------------------------------------------------------------
154
155class ActionListener : public ::cppu::WeakImplHelper1< com::sun::star::awt::XActionListener >
156{
157public:
158 ActionListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
159
160 virtual void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
161 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
162private:
163
164 OptimizerDialog& mrOptimizerDialog;
165};
166
167// -----------------------------------------------------------------------------
168
169class ActionListenerListBox0Pg0 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XActionListener >
170{
171public:
172 ActionListenerListBox0Pg0( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
173
174 virtual void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
175 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
176private:
177
178 OptimizerDialog& mrOptimizerDialog;
179};
180
181// -----------------------------------------------------------------------------
182
183class TextListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XTextListener >
184{
185public:
186 TextListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
187
188 virtual void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
189 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
190private:
191
192 OptimizerDialog& mrOptimizerDialog;
193};
194
195// -----------------------------------------------------------------------------
196
197class TextListenerComboBox0Pg1 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XTextListener >
198{
199public:
200 TextListenerComboBox0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
201
202 virtual void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
203 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
204private:
205
206 OptimizerDialog& mrOptimizerDialog;
207};
208
209// -----------------------------------------------------------------------------
210
211class SpinListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XSpinListener >
212{
213public:
214 SpinListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
215
216 virtual void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
217 virtual void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
218 virtual void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
219 virtual void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
220 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
221private:
222
223 OptimizerDialog& mrOptimizerDialog;
224};
225
226// -----------------------------------------------------------------------------
227
228class HelpCloseListener : public ::cppu::WeakImplHelper1< com::sun::star::util::XCloseListener >
229{
230public:
231 HelpCloseListener( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rXFrame ) : mrXFrame( rXFrame ){};
232
233 virtual void SAL_CALL addCloseListener(const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& ) throw( com::sun::star::uno::RuntimeException );
234 virtual void SAL_CALL removeCloseListener( const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
235 virtual void SAL_CALL notifyClosing( const com::sun::star::lang::EventObject& aEvent ) throw (com::sun::star::uno::RuntimeException) ;
236 virtual void SAL_CALL queryClosing( const com::sun::star::lang::EventObject& aEvent, sal_Bool bDeliverOwnership ) throw (com::sun::star::uno::RuntimeException, com::sun::star::util::CloseVetoException) ;
237 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& aEvent ) throw (com::sun::star::uno::RuntimeException) ;
238
239private:
240
241 com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& mrXFrame;
242};
243
244
215#endif // OPTIMIZERDIALOG_HXX
245#endif // OPTIMIZERDIALOG_HXX