fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sdext / source / minimizer / optimizerdialog.hxx
blobcfd280cceb18ebcc46cbdf5b92d25e279c8e4f50
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 "optimizerdialog.hrc"
23 #include <vector>
24 #include "unodialog.hxx"
25 #include "optimizationstats.hxx"
26 #include "configurationaccess.hxx"
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/awt/XItemListener.hpp>
29 #include <com/sun/star/awt/XSpinField.hpp>
30 #include <com/sun/star/awt/XSpinListener.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/uno/Sequence.h>
33 #include <com/sun/star/text/XTextRange.hpp>
34 #include <com/sun/star/drawing/XShapes.hpp>
35 #include <com/sun/star/container/XIndexAccess.hpp>
36 #include <com/sun/star/frame/XController.hpp>
37 #include <com/sun/star/view/XSelectionSupplier.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 #include <com/sun/star/awt/XItemEventBroadcaster.hpp>
40 #include <com/sun/star/frame/XStorable.hpp>
41 #include <com/sun/star/frame/XDispatch.hpp>
42 #include <com/sun/star/frame/XDesktop.hpp>
43 #include <com/sun/star/awt/PushButtonType.hpp>
45 #define MAX_STEP 4
46 #define OD_DIALOG_WIDTH 330
47 #define DIALOG_HEIGHT 210
48 #define BUTTON_WIDTH 50
49 #define BUTTON_HEIGHT 14
50 #define BUTTON_POS_Y DIALOG_HEIGHT - BUTTON_HEIGHT - 6
52 #define PAGE_POS_X 91
53 #define PAGE_POS_Y 8
54 #define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X
57 // - OPTIMIZERDIALOG -
59 class OptimizerDialog : public UnoDialog, public ConfigurationAccess
61 public :
63 OptimizerDialog( const css::uno::Reference< css::uno::XComponentContext >& rxContext, css::uno::Reference< css::frame::XFrame >& rxFrame,
64 css::uno::Reference< css::frame::XDispatch > rxStatusDispatcher );
65 ~OptimizerDialog();
67 bool execute();
69 sal_Int16 mnCurrentStep;
70 sal_Int16 mnTabIndex;
71 bool mbIsReadonly;
73 private :
74 css::uno::Reference< css::frame::XFrame > mxFrame;
76 css::uno::Reference< css::uno::XInterface > mxRoadmapControl;
77 css::uno::Reference< css::uno::XInterface > mxRoadmapControlModel;
79 css::uno::Reference< css::awt::XItemListener > mxItemListener;
80 css::uno::Reference< css::awt::XActionListener > mxActionListener;
81 css::uno::Reference< css::awt::XActionListener > mxActionListenerListBox0Pg0;
82 css::uno::Reference< css::awt::XTextListener > mxTextListenerFormattedField0Pg1;
83 css::uno::Reference< css::awt::XTextListener > mxTextListenerComboBox0Pg1;
84 css::uno::Reference< css::awt::XSpinListener > mxSpinListenerFormattedField0Pg1;
85 css::uno::Reference< css::frame::XDispatch > mxStatusDispatcher;
87 std::vector< std::vector< OUString > > maControlPages;
89 void InitDialog();
90 void InitRoadmap();
91 void InitNavigationBar();
92 void InitPage0();
93 void InitPage1();
94 void InitPage2();
95 void InitPage3();
96 void InitPage4();
97 void UpdateControlStatesPage0();
98 void UpdateControlStatesPage1();
99 void UpdateControlStatesPage2();
100 void UpdateControlStatesPage3();
101 void UpdateControlStatesPage4();
103 void ActivatePage( sal_Int16 nStep );
104 void DeactivatePage( sal_Int16 nStep );
105 void InsertRoadmapItem( const sal_Int32 nIndex, const bool bEnabled, const OUString& rLabel, const sal_Int32 nItemID );
107 public :
109 OptimizationStats maStats;
111 void UpdateStatus( const css::uno::Sequence< css::beans::PropertyValue >& rStatus );
113 // the ConfigurationAccess is updated to actual control settings
114 void UpdateConfiguration();
116 void EnablePage( sal_Int16 nStep );
117 void DisablePage( sal_Int16 nStep );
119 void SwitchPage( sal_Int16 nNewStep );
120 void UpdateControlStates( sal_Int16 nStep = -1 );
122 OUString GetSelectedString( OUString const & token );
123 css::uno::Reference< css::frame::XDispatch >& GetStatusDispatcher() { return mxStatusDispatcher; };
124 css::uno::Reference< css::frame::XFrame>& GetFrame() { return mxFrame; };
125 const css::uno::Reference< css::uno::XComponentContext >& GetComponentContext() { return UnoDialog::mxContext; };
130 class ItemListener : public ::cppu::WeakImplHelper1< css::awt::XItemListener >
132 public:
133 ItemListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
135 virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
136 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 private:
139 OptimizerDialog& mrOptimizerDialog;
144 class ActionListener : public ::cppu::WeakImplHelper1< css::awt::XActionListener >
146 public:
147 ActionListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
149 virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
150 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 private:
153 OptimizerDialog& mrOptimizerDialog;
158 class ActionListenerListBox0Pg0 : public ::cppu::WeakImplHelper1< css::awt::XActionListener >
160 public:
161 ActionListenerListBox0Pg0( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
163 virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
164 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 private:
167 OptimizerDialog& mrOptimizerDialog;
172 class TextListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper1< css::awt::XTextListener >
174 public:
175 TextListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
177 virtual void SAL_CALL textChanged( const css::awt::TextEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
178 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 private:
181 OptimizerDialog& mrOptimizerDialog;
186 class TextListenerComboBox0Pg1 : public ::cppu::WeakImplHelper1< css::awt::XTextListener >
188 public:
189 TextListenerComboBox0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
191 virtual void SAL_CALL textChanged( const css::awt::TextEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
192 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
193 private:
195 OptimizerDialog& mrOptimizerDialog;
200 class SpinListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper1< css::awt::XSpinListener >
202 public:
203 SpinListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
205 virtual void SAL_CALL up( const css::awt::SpinEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
206 virtual void SAL_CALL down( const css::awt::SpinEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
207 virtual void SAL_CALL first( const css::awt::SpinEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
208 virtual void SAL_CALL last( const css::awt::SpinEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
209 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
210 private:
212 OptimizerDialog& mrOptimizerDialog;
215 #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_OPTIMIZERDIALOG_HXX
217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */