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_UNODIALOG_HXX 21 #define INCLUDED_SDEXT_SOURCE_MINIMIZER_UNODIALOG_HXX 22 23 #include <com/sun/star/uno/Sequence.h> 24 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 25 #include <com/sun/star/frame/XController.hpp> 26 #include <com/sun/star/frame/XFrame.hpp> 27 #include <com/sun/star/beans/XMultiPropertySet.hpp> 28 #include <com/sun/star/awt/XControl.hpp> 29 #include <com/sun/star/awt/XControlModel.hpp> 30 #include <com/sun/star/container/XNameContainer.hpp> 31 #include <com/sun/star/container/XNameAccess.hpp> 32 #include <com/sun/star/uno/XComponentContext.hpp> 33 #include <com/sun/star/awt/XActionListener.hpp> 34 #include <com/sun/star/awt/XButton.hpp> 35 #include <com/sun/star/awt/XCheckBox.hpp> 36 #include <com/sun/star/awt/XComboBox.hpp> 37 #include <com/sun/star/awt/XRadioButton.hpp> 38 #include <com/sun/star/awt/XListBox.hpp> 39 #include <com/sun/star/awt/XFixedText.hpp> 40 #include <com/sun/star/awt/XUnoControlDialog.hpp> 41 #include <com/sun/star/awt/XReschedule.hpp> 42 43 44 class UnoDialog 45 { 46 public: 47 48 UnoDialog( const css::uno::Reference< css::uno::XComponentContext >& rxMSF, css::uno::Reference< css::frame::XFrame > const & rxFrame ); 49 ~UnoDialog(); 50 51 void execute(); 52 void endExecute( bool bStatus ); 53 54 css::uno::Reference< css::uno::XInterface > insertControlModel( const OUString& rServiceName, const OUString& rName, 55 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 56 57 void setVisible( const OUString& rName, bool bVisible ); 58 59 css::uno::Reference< css::awt::XButton > insertButton( const OUString& rName, 60 const css::uno::Reference< css::awt::XActionListener >& xActionListener, const css::uno::Sequence< OUString >& rPropertyNames, 61 const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 62 63 css::uno::Reference< css::awt::XFixedText > insertFixedText( const OUString& rName, 64 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 65 66 css::uno::Reference< css::awt::XCheckBox > insertCheckBox( const OUString& rName, 67 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 68 69 css::uno::Reference< css::awt::XControl > insertFormattedField( const OUString& rName, 70 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 71 72 css::uno::Reference< css::awt::XComboBox > insertComboBox( const OUString& rName, 73 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 74 75 css::uno::Reference< css::awt::XRadioButton > insertRadioButton( const OUString& rName, 76 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 77 78 css::uno::Reference< css::awt::XListBox > insertListBox( const OUString& rName, 79 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 80 81 css::uno::Reference< css::awt::XControl > insertImage( const OUString& rName, 82 const css::uno::Sequence< OUString >& rPropertyNames, const css::uno::Sequence< css::uno::Any >& rPropertyValues ); 83 84 void setControlProperty( const OUString& rControlName, const OUString& rPropertyName, const css::uno::Any& rPropertyValue ); 85 css::uno::Any getControlProperty( const OUString& rControlName, const OUString& rPropertyName ); 86 87 void enableControl( const OUString& rControlName ); 88 void disableControl( const OUString& rControlName ); 89 reschedule() const90 void reschedule() const { mxReschedule->reschedule(); } endStatus() const91 bool endStatus() const { return mbStatus; } getControl(const OUString & rControlName) const92 css::uno::Reference<css::awt::XControl> getControl(const OUString& rControlName) const { return mxDialog->getControl(rControlName); } controller() const93 const css::uno::Reference<css::frame::XController>& controller() const { return mxController; } setPropertyValues(const css::uno::Sequence<OUString> & rNameSeq,const css::uno::Sequence<css::uno::Any> & rValueSeq)94 void setPropertyValues(const css::uno::Sequence<OUString>& rNameSeq, const css::uno::Sequence<css::uno::Any>& rValueSeq) 95 { mxDialogModelMultiPropertySet->setPropertyValues(rNameSeq, rValueSeq); } 96 97 protected: 98 css::uno::Reference< css::uno::XComponentContext > mxContext; 99 css::uno::Reference< css::frame::XController > mxController; 100 101 private: 102 css::uno::Reference< css::awt::XReschedule > mxReschedule; 103 css::uno::Reference< css::uno::XInterface > mxDialogModel; 104 css::uno::Reference< css::beans::XMultiPropertySet > mxDialogModelMultiPropertySet; 105 css::uno::Reference< css::lang::XMultiServiceFactory > mxDialogModelMSF; 106 css::uno::Reference< css::container::XNameContainer > mxDialogModelNameContainer; 107 css::uno::Reference< css::container::XNameAccess > mxDialogModelNameAccess; 108 109 css::uno::Reference< css::awt::XControlModel > mxControlModel; 110 111 css::uno::Reference< css::awt::XUnoControlDialog > mxDialog; 112 css::uno::Reference< css::awt::XControl > mxControl; 113 bool mbStatus; 114 }; 115 116 #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_UNODIALOG_HXX 117 118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 119