LibreOffice Module extensions (master) 1
commoncontrol.cxx
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#include "commoncontrol.hxx"
22
23
24namespace pcr
25{
26
27
28 using ::com::sun::star::uno::Reference;
29 using ::com::sun::star::inspection::XPropertyControlContext;
30 using ::com::sun::star::uno::Exception;
31 using ::com::sun::star::inspection::XPropertyControl;
32
33 CommonBehaviourControlHelper::CommonBehaviourControlHelper( sal_Int16 _nControlType, XPropertyControl& _rAntiImpl )
34 :m_nControlType( _nControlType )
35 ,m_rAntiImpl( _rAntiImpl )
36 ,m_bModified( false )
37 {
38 }
39
40
42 {
43 }
44
45 void CommonBehaviourControlHelper::setControlContext( const Reference< XPropertyControlContext >& _controlcontext )
46 {
47 m_xContext = _controlcontext;
48 }
49
51 {
52 if ( isModified() && m_xContext.is() )
53 {
54 try
55 {
56 m_xContext->valueChanged( &m_rAntiImpl );
57 m_bModified = false;
58 }
59 catch( const Exception& )
60 {
61 DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
62 }
63 }
64 }
65
67 {
69 }
70
72 {
73 editChanged();
74 }
75
77 {
78 setModified();
79 // notify as soon as the Data source is changed, don't wait until we lose focus
80 // because the Content dropdown cannot be populated after it is popped up
81 // and going from Data source direct to Content may give focus-lost to
82 // Content after the popup attempt is made
83 notifyModifiedValue();
84 }
85
87 {
88 setModified();
89 }
90
92 {
93 setModified();
94 }
95
97 {
98 setModified();
99 }
100
102 {
103 setModified();
104 }
105
107 {
108 setModified();
109 }
110
112 {
113 try
114 {
115 if ( m_xContext.is() )
116 m_xContext->focusGained( &m_rAntiImpl );
117 }
118 catch( const Exception& )
119 {
120 DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
121 }
122 }
123
125 {
126 // TODO/UNOize: should this be outside the default control's implementations? If somebody
127 // has an own control implementation, which does *not* do this - would this be allowed?
128 // If not, then we must move this logic out of here.
129 notifyModifiedValue();
130 }
131
132} // namespace pcr
133
134/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A helper class for implementing the <type scope="css::inspection">XPropertyControl</type> or one of i...
CommonBehaviourControlHelper(sal_Int16 nControlType, css::inspection::XPropertyControl &rAntiImpl)
creates the instance
css::uno::Reference< css::inspection::XPropertyControlContext > m_xContext
void setControlContext(const css::uno::Reference< css::inspection::XPropertyControlContext > &controlcontext)
css::inspection::XPropertyControl & m_rAntiImpl
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XComponentContext > m_xContext
Definition: filehandler.cxx:78
@ Exception
a property handler for any virtual string properties
Definition: browserline.cxx:39
IMPL_LINK_NOARG(OBrowserLine, OnButtonFocus, weld::Widget &, void)