106bcd5d2SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 306bcd5d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 406bcd5d2SAndrew Rist * or more contributor license agreements. See the NOTICE file 506bcd5d2SAndrew Rist * distributed with this work for additional information 606bcd5d2SAndrew Rist * regarding copyright ownership. The ASF licenses this file 706bcd5d2SAndrew Rist * to you under the Apache License, Version 2.0 (the 806bcd5d2SAndrew Rist * "License"); you may not use this file except in compliance 906bcd5d2SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 1106bcd5d2SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 1306bcd5d2SAndrew Rist * Unless required by applicable law or agreed to in writing, 1406bcd5d2SAndrew Rist * software distributed under the License is distributed on an 1506bcd5d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1606bcd5d2SAndrew Rist * KIND, either express or implied. See the License for the 1706bcd5d2SAndrew Rist * specific language governing permissions and limitations 1806bcd5d2SAndrew Rist * under the License. 19cdf0e10cSrcweir * 2006bcd5d2SAndrew Rist *************************************************************/ 2106bcd5d2SAndrew Rist 2206bcd5d2SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef OPTIMIZERDIALOG_HXX 25cdf0e10cSrcweir #define OPTIMIZERDIALOG_HXX 26cdf0e10cSrcweir #ifndef _OPTIMIZERDIALOG_HRC 27cdf0e10cSrcweir #include "optimizerdialog.hrc" 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir #include <vector> 30cdf0e10cSrcweir #include "unodialog.hxx" 31cdf0e10cSrcweir #include "pppoptimizertoken.hxx" 32cdf0e10cSrcweir #include "optimizationstats.hxx" 33cdf0e10cSrcweir #include "configurationaccess.hxx" 34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 35cdf0e10cSrcweir #include <com/sun/star/awt/XItemListener.hpp> 36cdf0e10cSrcweir #include <com/sun/star/awt/XSpinField.hpp> 37cdf0e10cSrcweir #include <com/sun/star/awt/XSpinListener.hpp> 38cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 39cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 40cdf0e10cSrcweir #include <com/sun/star/text/XTextRange.hpp> 41cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp> 42cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 43cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 44cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp> 45cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 46cdf0e10cSrcweir #include <com/sun/star/awt/XItemEventBroadcaster.hpp> 47cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_XCloseListener_HPP_ 48cdf0e10cSrcweir #include <com/sun/star/util/XCloseListener.hpp> 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir #include <com/sun/star/frame/XStorable.hpp> 51cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 52cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp> 53cdf0e10cSrcweir #include <com/sun/star/awt/PushButtonType.hpp> 54*597a4c59SAriel Constenla-Haile #include <cppuhelper/implbase5.hxx> 55*597a4c59SAriel Constenla-Haile #include <cppuhelper/implbase1.hxx> 56cdf0e10cSrcweir 57cdf0e10cSrcweir #define MAX_STEP 4 58cdf0e10cSrcweir #define OD_DIALOG_WIDTH 330 59cdf0e10cSrcweir #define DIALOG_HEIGHT 210 60cdf0e10cSrcweir #define BUTTON_WIDTH 50 61cdf0e10cSrcweir #define BUTTON_HEIGHT 14 62cdf0e10cSrcweir #define BUTTON_POS_Y DIALOG_HEIGHT - BUTTON_HEIGHT - 6 63cdf0e10cSrcweir 64cdf0e10cSrcweir #define PAGE_POS_X 91 65cdf0e10cSrcweir #define PAGE_POS_Y 8 66cdf0e10cSrcweir #define PAGE_WIDTH OD_DIALOG_WIDTH - PAGE_POS_X 67cdf0e10cSrcweir 68cdf0e10cSrcweir // ------------------- 69cdf0e10cSrcweir // - OPTIMIZERDIALOG - 70cdf0e10cSrcweir // ------------------- 71*597a4c59SAriel Constenla-Haile 72*597a4c59SAriel Constenla-Haile typedef ::cppu::WeakImplHelper5< 73*597a4c59SAriel Constenla-Haile com::sun::star::frame::XStatusListener, 74*597a4c59SAriel Constenla-Haile com::sun::star::awt::XSpinListener, 75*597a4c59SAriel Constenla-Haile com::sun::star::awt::XItemListener, 76*597a4c59SAriel Constenla-Haile com::sun::star::awt::XActionListener, 77*597a4c59SAriel Constenla-Haile com::sun::star::awt::XTextListener > OptimizerDialog_Base; 78*597a4c59SAriel Constenla-Haile 79*597a4c59SAriel Constenla-Haile class OptimizerDialog : public UnoDialog, public ConfigurationAccess, public OptimizerDialog_Base 80cdf0e10cSrcweir { 81cdf0e10cSrcweir public : 82cdf0e10cSrcweir 83*597a4c59SAriel Constenla-Haile OptimizerDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, 84*597a4c59SAriel Constenla-Haile const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame, 85*597a4c59SAriel Constenla-Haile const com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >& rxParent ); 86cdf0e10cSrcweir ~OptimizerDialog(); 87cdf0e10cSrcweir 88*597a4c59SAriel Constenla-Haile virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& aState ) throw (::com::sun::star::uno::RuntimeException); 89*597a4c59SAriel Constenla-Haile virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aSource ) throw (::com::sun::star::uno::RuntimeException); 90*597a4c59SAriel Constenla-Haile 91*597a4c59SAriel Constenla-Haile virtual void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException ); 92*597a4c59SAriel Constenla-Haile virtual void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException ); 93*597a4c59SAriel Constenla-Haile virtual void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException ); 94*597a4c59SAriel Constenla-Haile virtual void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException ); 95*597a4c59SAriel Constenla-Haile virtual void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& Event ) throw ( com::sun::star::uno::RuntimeException ); 96*597a4c59SAriel Constenla-Haile virtual void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& Event ) throw ( com::sun::star::uno::RuntimeException ); 97*597a4c59SAriel Constenla-Haile virtual void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& Event ) throw ( com::sun::star::uno::RuntimeException ); 98*597a4c59SAriel Constenla-Haile 99cdf0e10cSrcweir sal_Bool execute(); 100cdf0e10cSrcweir 101*597a4c59SAriel Constenla-Haile private : 102*597a4c59SAriel Constenla-Haile com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxFrame; 103cdf0e10cSrcweir sal_Int16 mnCurrentStep; 104cdf0e10cSrcweir sal_Int16 mnTabIndex; 105cdf0e10cSrcweir sal_Bool mbIsReadonly; 106*597a4c59SAriel Constenla-Haile com::sun::star::uno::Reference< com::sun::star::frame::XModel > mxModel; 107cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxRoadmapControl; 108cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxRoadmapControlModel; 109cdf0e10cSrcweir 110cdf0e10cSrcweir std::vector< std::vector< rtl::OUString > > maControlPages; 111*597a4c59SAriel Constenla-Haile OptimizationStats maStats; 112cdf0e10cSrcweir 113cdf0e10cSrcweir void InitDialog(); 114cdf0e10cSrcweir void InitRoadmap(); 115cdf0e10cSrcweir void InitNavigationBar(); 116cdf0e10cSrcweir void InitPage0(); 117cdf0e10cSrcweir void InitPage1(); 118cdf0e10cSrcweir void InitPage2(); 119cdf0e10cSrcweir void InitPage3(); 120cdf0e10cSrcweir void InitPage4(); 121cdf0e10cSrcweir void UpdateControlStatesPage0(); 122cdf0e10cSrcweir void UpdateControlStatesPage1(); 123cdf0e10cSrcweir void UpdateControlStatesPage2(); 124cdf0e10cSrcweir void UpdateControlStatesPage3(); 125cdf0e10cSrcweir void UpdateControlStatesPage4(); 126cdf0e10cSrcweir 127cdf0e10cSrcweir void ActivatePage( sal_Int16 nStep ); 128cdf0e10cSrcweir void DeactivatePage( sal_Int16 nStep ); 129*597a4c59SAriel Constenla-Haile void EnablePage( sal_Int16 nStep ); 130*597a4c59SAriel Constenla-Haile void DisablePage( sal_Int16 nStep ); 131*597a4c59SAriel Constenla-Haile void SwitchPage( sal_Int16 nNewStep ); 132cdf0e10cSrcweir 133cdf0e10cSrcweir // the ConfigurationAccess is updated to actual control settings 134cdf0e10cSrcweir void UpdateConfiguration(); 135*597a4c59SAriel Constenla-Haile void UpdateStatus( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rStatus ); 136cdf0e10cSrcweir void UpdateControlStates( sal_Int16 nStep = -1 ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir rtl::OUString GetSelectedString( PPPOptimizerTokenEnum eListBox ); 139*597a4c59SAriel Constenla-Haile void ImplSetBold( const rtl::OUString& rControl ); 140*597a4c59SAriel Constenla-Haile void InsertRoadmapItem( const sal_Int32 nIndex, 141*597a4c59SAriel Constenla-Haile const sal_Bool bEnabled, 142*597a4c59SAriel Constenla-Haile const rtl::OUString& rLabel, 143*597a4c59SAriel Constenla-Haile const sal_Int32 nItemID ); 144*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertSeparator( const rtl::OUString& rControlName, 145*597a4c59SAriel Constenla-Haile sal_Int32 nOrientation, 146*597a4c59SAriel Constenla-Haile sal_Int32 nPosX, 147*597a4c59SAriel Constenla-Haile sal_Int32 nPosY, 148*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 149*597a4c59SAriel Constenla-Haile sal_Int32 nHeight ); 150*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertButton( const rtl::OUString& rControlName, 151*597a4c59SAriel Constenla-Haile const rtl::OUString& rHelpURL, 152*597a4c59SAriel Constenla-Haile sal_Int32 nXPos, 153*597a4c59SAriel Constenla-Haile sal_Int32 nYPos, 154*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 155*597a4c59SAriel Constenla-Haile sal_Int32 nHeight, 156*597a4c59SAriel Constenla-Haile sal_Int16 nTabIndex, 157*597a4c59SAriel Constenla-Haile sal_Bool bEnabled, 158*597a4c59SAriel Constenla-Haile sal_Int32 nResID, 159*597a4c59SAriel Constenla-Haile sal_Int16 nPushButtonType ); 160*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertFixedText( const rtl::OUString& rControlName, 161*597a4c59SAriel Constenla-Haile const rtl::OUString& rLabel, 162*597a4c59SAriel Constenla-Haile sal_Int32 nXPos, 163*597a4c59SAriel Constenla-Haile sal_Int32 nYPos, 164*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 165*597a4c59SAriel Constenla-Haile sal_Int32 nHeight, 166*597a4c59SAriel Constenla-Haile sal_Bool bMultiLine, 167*597a4c59SAriel Constenla-Haile sal_Bool bBold, 168*597a4c59SAriel Constenla-Haile sal_Int16 nTabIndex ); 169*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertCheckBox( const rtl::OUString& rControlName, 170*597a4c59SAriel Constenla-Haile const rtl::OUString& rLabel, 171*597a4c59SAriel Constenla-Haile const rtl::OUString& rHelpURL, 172*597a4c59SAriel Constenla-Haile sal_Int32 nXPos, 173*597a4c59SAriel Constenla-Haile sal_Int32 nYPos, 174*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 175*597a4c59SAriel Constenla-Haile sal_Int32 nHeight, 176*597a4c59SAriel Constenla-Haile sal_Int16 nTabIndex ); 177*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertFormattedField( const rtl::OUString& rControlName, 178*597a4c59SAriel Constenla-Haile const rtl::OUString& rHelpURL, 179*597a4c59SAriel Constenla-Haile sal_Int32 nXPos, 180*597a4c59SAriel Constenla-Haile sal_Int32 nYPos, 181*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 182*597a4c59SAriel Constenla-Haile double fEffectiveMin, 183*597a4c59SAriel Constenla-Haile double fEffectiveMax, 184*597a4c59SAriel Constenla-Haile sal_Int16 nTabIndex ); 185*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertComboBox( const rtl::OUString& rControlName, 186*597a4c59SAriel Constenla-Haile const rtl::OUString& rHelpURL, 187*597a4c59SAriel Constenla-Haile const sal_Bool bEnabled, 188*597a4c59SAriel Constenla-Haile const com::sun::star::uno::Sequence< rtl::OUString >& rItemList, 189*597a4c59SAriel Constenla-Haile sal_Int32 nXPos, 190*597a4c59SAriel Constenla-Haile sal_Int32 nYPos, 191*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 192*597a4c59SAriel Constenla-Haile sal_Int32 nHeight, 193*597a4c59SAriel Constenla-Haile sal_Int16 nTabIndex, 194*597a4c59SAriel Constenla-Haile bool bListen = true ); 195*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertRadioButton( const rtl::OUString& rControlName, 196*597a4c59SAriel Constenla-Haile const rtl::OUString& rLabel, 197*597a4c59SAriel Constenla-Haile const rtl::OUString& rHelpURL, 198*597a4c59SAriel Constenla-Haile sal_Int32 nXPos, 199*597a4c59SAriel Constenla-Haile sal_Int32 nYPos, 200*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 201*597a4c59SAriel Constenla-Haile sal_Int32 nHeight, 202*597a4c59SAriel Constenla-Haile sal_Bool bMultiLine, 203*597a4c59SAriel Constenla-Haile sal_Int16 nTabIndex ); 204*597a4c59SAriel Constenla-Haile rtl::OUString ImplInsertListBox( const rtl::OUString& rControlName, 205*597a4c59SAriel Constenla-Haile const rtl::OUString& rHelpURL, 206*597a4c59SAriel Constenla-Haile const sal_Bool bEnabled, 207*597a4c59SAriel Constenla-Haile const com::sun::star::uno::Sequence< rtl::OUString >& rItemList, 208*597a4c59SAriel Constenla-Haile sal_Int32 nXPos, 209*597a4c59SAriel Constenla-Haile sal_Int32 nYPos, 210*597a4c59SAriel Constenla-Haile sal_Int32 nWidth, 211*597a4c59SAriel Constenla-Haile sal_Int32 nHeight, 212*597a4c59SAriel Constenla-Haile sal_Int16 nTabIndex ); 213cdf0e10cSrcweir }; 214cdf0e10cSrcweir 215cdf0e10cSrcweir #endif // OPTIMIZERDIALOG_HXX 216