LCOV - code coverage report
Current view: top level - libreoffice/sdext/source/minimizer - optimizerdialog.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 16 0.0 %
Date: 2012-12-27 Functions: 0 23 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 OPTIMIZERDIALOG_HXX
      21             : #define OPTIMIZERDIALOG_HXX
      22             : #include "optimizerdialog.hrc"
      23             : #include <vector>
      24             : #include "unodialog.hxx"
      25             : #include "pppoptimizertoken.hxx"
      26             : #include "optimizationstats.hxx"
      27             : #include "configurationaccess.hxx"
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/awt/XItemListener.hpp>
      30             : #include <com/sun/star/awt/XSpinField.hpp>
      31             : #include <com/sun/star/awt/XSpinListener.hpp>
      32             : #include <com/sun/star/beans/XPropertySet.hpp>
      33             : #include <com/sun/star/uno/Sequence.h>
      34             : #include <com/sun/star/text/XTextRange.hpp>
      35             : #include <com/sun/star/drawing/XShapes.hpp>
      36             : #include <com/sun/star/container/XIndexAccess.hpp>
      37             : #include <com/sun/star/frame/XController.hpp>
      38             : #include <com/sun/star/view/XSelectionSupplier.hpp>
      39             : #include <com/sun/star/uno/XComponentContext.hpp>
      40             : #include <com/sun/star/awt/XItemEventBroadcaster.hpp>
      41             : #include <com/sun/star/util/XCloseListener.hpp>
      42             : #include <com/sun/star/frame/XStorable.hpp>
      43             : #include <com/sun/star/frame/XDispatch.hpp>
      44             : #include <com/sun/star/frame/XDesktop.hpp>
      45             : #include <com/sun/star/awt/PushButtonType.hpp>
      46             : 
      47             : #define MAX_STEP        4
      48             : #define OD_DIALOG_WIDTH 330
      49             : #define DIALOG_HEIGHT   210
      50             : #define BUTTON_WIDTH    50
      51             : #define BUTTON_HEIGHT   14
      52             : #define BUTTON_POS_Y    DIALOG_HEIGHT - BUTTON_HEIGHT - 6
      53             : 
      54             : #define PAGE_POS_X      91
      55             : #define PAGE_POS_Y      8
      56             : #define PAGE_WIDTH      OD_DIALOG_WIDTH - PAGE_POS_X
      57             : 
      58             : // -------------------
      59             : // - OPTIMIZERDIALOG -
      60             : // -------------------
      61             : class OptimizerDialog : public UnoDialog, public ConfigurationAccess
      62             : {
      63             : public :
      64             : 
      65             :     OptimizerDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF, com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rxFrame,
      66             :         com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > rxStatusDispatcher );
      67             :     ~OptimizerDialog();
      68             : 
      69             :     sal_Bool                execute();
      70             : 
      71             :     sal_Int16               mnCurrentStep;
      72             :     sal_Int16               mnTabIndex;
      73             :     sal_Bool                mbIsReadonly;
      74             : 
      75             : private :
      76             :     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >mxMSF;
      77             :     com::sun::star::uno::Reference< com::sun::star::frame::XFrame >         mxFrame;
      78             : 
      79             :     com::sun::star::uno::Reference< com::sun::star::uno::XInterface >       mxRoadmapControl;
      80             :     com::sun::star::uno::Reference< com::sun::star::uno::XInterface >       mxRoadmapControlModel;
      81             : 
      82             :     com::sun::star::uno::Reference< com::sun::star::awt::XItemListener >    mxItemListener;
      83             :     com::sun::star::uno::Reference< com::sun::star::awt::XActionListener >  mxActionListener;
      84             :     com::sun::star::uno::Reference< com::sun::star::awt::XActionListener >  mxActionListenerListBox0Pg0;
      85             :     com::sun::star::uno::Reference< com::sun::star::awt::XTextListener >    mxTextListenerFormattedField0Pg1;
      86             :     com::sun::star::uno::Reference< com::sun::star::awt::XTextListener >    mxTextListenerComboBox0Pg1;
      87             :     com::sun::star::uno::Reference< com::sun::star::awt::XSpinListener >    mxSpinListenerFormattedField0Pg1;
      88             :     com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >      mxStatusDispatcher;
      89             : 
      90             :     std::vector< std::vector< rtl::OUString > > maControlPages;
      91             : 
      92             :     void InitDialog();
      93             :     void InitRoadmap();
      94             :     void InitNavigationBar();
      95             :     void InitPage0();
      96             :     void InitPage1();
      97             :     void InitPage2();
      98             :     void InitPage3();
      99             :     void InitPage4();
     100             :     void UpdateControlStatesPage0();
     101             :     void UpdateControlStatesPage1();
     102             :     void UpdateControlStatesPage2();
     103             :     void UpdateControlStatesPage3();
     104             :     void UpdateControlStatesPage4();
     105             : 
     106             :     void ActivatePage( sal_Int16 nStep );
     107             :     void DeactivatePage( sal_Int16 nStep );
     108             :     void InsertRoadmapItem( const sal_Int32 nIndex, const sal_Bool bEnabled, const rtl::OUString& rLabel, const sal_Int32 nItemID );
     109             : 
     110             : public :
     111             : 
     112             :     OptimizationStats maStats;
     113             : 
     114             :     void UpdateStatus( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rStatus );
     115             : 
     116             :     // the ConfigurationAccess is updated to actual control settings
     117             :     void UpdateConfiguration();
     118             : 
     119             :     void EnablePage( sal_Int16 nStep );
     120             :     void DisablePage( sal_Int16 nStep );
     121             : 
     122             :     void SwitchPage( sal_Int16 nNewStep );
     123             :     void UpdateControlStates( sal_Int16 nStep = -1 );
     124             : 
     125             :     rtl::OUString GetSelectedString( PPPOptimizerTokenEnum eListBox );
     126           0 :     com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >& GetStatusDispatcher() { return mxStatusDispatcher; };
     127           0 :     com::sun::star::uno::Reference< com::sun::star::frame::XFrame>& GetFrame() { return mxFrame; };
     128           0 :     const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& GetComponentContext() { return mxMSF; };
     129             : };
     130             : 
     131             : // -----------------------------------------------------------------------------
     132             : 
     133           0 : class ItemListener : public ::cppu::WeakImplHelper1< com::sun::star::awt::XItemListener >
     134             : {
     135             : public:
     136           0 :     ItemListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
     137             : 
     138             :     virtual void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     139             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
     140             : private:
     141             : 
     142             :     OptimizerDialog& mrOptimizerDialog;
     143             : };
     144             : 
     145             : // -----------------------------------------------------------------------------
     146             : 
     147           0 : class ActionListener : public ::cppu::WeakImplHelper1< com::sun::star::awt::XActionListener >
     148             : {
     149             : public:
     150           0 :     ActionListener( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
     151             : 
     152             :     virtual void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     153             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
     154             : private:
     155             : 
     156             :     OptimizerDialog& mrOptimizerDialog;
     157             : };
     158             : 
     159             : // -----------------------------------------------------------------------------
     160             : 
     161           0 : class ActionListenerListBox0Pg0 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XActionListener >
     162             : {
     163             : public:
     164           0 :     ActionListenerListBox0Pg0( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
     165             : 
     166             :     virtual void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     167             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
     168             : private:
     169             : 
     170             :     OptimizerDialog& mrOptimizerDialog;
     171             : };
     172             : 
     173             : // -----------------------------------------------------------------------------
     174             : 
     175           0 : class TextListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XTextListener >
     176             : {
     177             : public:
     178           0 :     TextListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
     179             : 
     180             :     virtual void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     181             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
     182             : private:
     183             : 
     184             :     OptimizerDialog& mrOptimizerDialog;
     185             : };
     186             : 
     187             : // -----------------------------------------------------------------------------
     188             : 
     189           0 : class TextListenerComboBox0Pg1 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XTextListener >
     190             : {
     191             : public:
     192           0 :     TextListenerComboBox0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
     193             : 
     194             :     virtual void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     195             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
     196             : private:
     197             : 
     198             :     OptimizerDialog& mrOptimizerDialog;
     199             : };
     200             : 
     201             : // -----------------------------------------------------------------------------
     202             : 
     203           0 : class SpinListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XSpinListener >
     204             : {
     205             : public:
     206           0 :     SpinListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
     207             : 
     208             :     virtual void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     209             :     virtual void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     210             :     virtual void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     211             :     virtual void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
     212             :     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
     213             : private:
     214             : 
     215             :     OptimizerDialog& mrOptimizerDialog;
     216             : };
     217             : 
     218             : // -----------------------------------------------------------------------------
     219             : 
     220           0 : class HelpCloseListener : public ::cppu::WeakImplHelper1< com::sun::star::util::XCloseListener >
     221             : {
     222             : public:
     223             :     HelpCloseListener( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rXFrame ) : mrXFrame( rXFrame ){};
     224             : 
     225             :     virtual void SAL_CALL addCloseListener(const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& ) throw( com::sun::star::uno::RuntimeException );
     226             :     virtual void SAL_CALL removeCloseListener( const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
     227             :     virtual void SAL_CALL notifyClosing( const com::sun::star::lang::EventObject& aEvent ) throw (com::sun::star::uno::RuntimeException) ;
     228             :     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) ;
     229             :     virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& aEvent ) throw (com::sun::star::uno::RuntimeException) ;
     230             : 
     231             : private:
     232             : 
     233             :     com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& mrXFrame;
     234             : };
     235             : 
     236             : 
     237             : #endif // OPTIMIZERDIALOG_HXX
     238             : 
     239             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10