LibreOffice Module sdext (master)  1
unodialog.hxx
Go to the documentation of this file.
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 
90  void reschedule() const { mxReschedule->reschedule(); }
91  bool endStatus() const { return mbStatus; }
92  css::uno::Reference<css::awt::XControl> getControl(const OUString& rControlName) const { return mxDialog->getControl(rControlName); }
93  const css::uno::Reference<css::frame::XController>& controller() const { return mxController; }
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: */
void disableControl(const OUString &rControlName)
Definition: unodialog.cxx:304
css::uno::Any getControlProperty(const OUString &rControlName, const OUString &rPropertyName)
Definition: unodialog.cxx:279
bool bVisible
css::uno::Reference< css::awt::XReschedule > mxReschedule
Definition: unodialog.hxx:102
css::uno::Reference< css::uno::XInterface > mxDialogModel
Definition: unodialog.hxx:103
css::uno::Reference< css::awt::XListBox > insertListBox(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:229
css::uno::Reference< css::awt::XControl > insertImage(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:246
void setPropertyValues(const css::uno::Sequence< OUString > &rNameSeq, const css::uno::Sequence< css::uno::Any > &rValueSeq)
Definition: unodialog.hxx:94
void execute()
Definition: unodialog.cxx:73
void reschedule() const
Definition: unodialog.hxx:90
css::uno::Reference< css::awt::XControl > insertFormattedField(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:178
void setControlProperty(const OUString &rControlName, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
Definition: unodialog.cxx:263
css::uno::Reference< css::awt::XUnoControlDialog > mxDialog
Definition: unodialog.hxx:111
bool mbStatus
Definition: unodialog.hxx:113
css::uno::Reference< css::awt::XControlModel > mxControlModel
Definition: unodialog.hxx:109
css::uno::Reference< css::awt::XFixedText > insertFixedText(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:144
bool endStatus() const
Definition: unodialog.hxx:91
css::uno::Reference< css::lang::XMultiServiceFactory > mxDialogModelMSF
Definition: unodialog.hxx:105
void endExecute(bool bStatus)
Definition: unodialog.cxx:80
const css::uno::Reference< css::frame::XController > & controller() const
Definition: unodialog.hxx:93
css::uno::Reference< css::awt::XComboBox > insertComboBox(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:195
css::uno::Reference< css::awt::XRadioButton > insertRadioButton(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:212
void enableControl(const OUString &rControlName)
Definition: unodialog.cxx:297
css::uno::Reference< css::container::XNameAccess > mxDialogModelNameAccess
Definition: unodialog.hxx:107
css::uno::Reference< css::uno::XComponentContext > mxContext
Definition: unodialog.hxx:98
UnoDialog(const css::uno::Reference< css::uno::XComponentContext > &rxMSF, css::uno::Reference< css::frame::XFrame > const &rxFrame)
Definition: unodialog.cxx:37
css::uno::Reference< css::awt::XCheckBox > insertCheckBox(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:161
css::uno::Reference< css::frame::XController > mxController
Definition: unodialog.hxx:99
css::uno::Reference< css::container::XNameContainer > mxDialogModelNameContainer
Definition: unodialog.hxx:106
css::uno::Reference< css::awt::XControl > mxControl
Definition: unodialog.hxx:112
css::uno::Reference< css::uno::XInterface > insertControlModel(const OUString &rServiceName, const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:86
void setVisible(const OUString &rName, bool bVisible)
Definition: unodialog.cxx:104
css::uno::Reference< css::awt::XControl > getControl(const OUString &rControlName) const
Definition: unodialog.hxx:92
css::uno::Reference< css::beans::XMultiPropertySet > mxDialogModelMultiPropertySet
Definition: unodialog.hxx:104
css::uno::Reference< css::awt::XButton > insertButton(const OUString &rName, const css::uno::Reference< css::awt::XActionListener > &xActionListener, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:118