LibreOffice Module extensions (master) 1
browserlistbox.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#pragma once
21
22#include "browserline.hxx"
23
24#include <com/sun/star/inspection/XPropertyControl.hpp>
25#include <com/sun/star/inspection/XPropertyHandler.hpp>
26#include <utility>
27#include <vcl/weld.hxx>
28#include <rtl/ref.hxx>
29
30#include <memory>
31#include <vector>
32
33#define EDITOR_LIST_REPLACE_EXISTING \
34 std::numeric_limits<ListBoxLines::size_type>::max()
35
36namespace pcr
37{
38
39
40 class IPropertyLineListener;
41 class IPropertyControlObserver;
42 struct OLineDescriptor;
43 class InspectorHelpWindow;
44 class PropertyControlContext_Impl;
45
46
47 // administrative structures for OBrowserListBox
48
49 typedef std::shared_ptr< OBrowserLine > BrowserLinePointer;
51 {
52 OUString aName;
54 css::uno::Reference< css::inspection::XPropertyHandler >
56
57 ListBoxLine( OUString _aName, BrowserLinePointer _pLine, css::uno::Reference< css::inspection::XPropertyHandler > _xHandler )
58 : aName(std::move( _aName )),
59 pLine(std::move( _pLine )),
60 xHandler(std::move( _xHandler ))
61 {
62 }
63 };
64 typedef std::vector< ListBoxLine > ListBoxLines;
65
66
68 {
69 std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
70 std::unique_ptr<weld::Container> m_xLinesPlayground;
71 std::unique_ptr<weld::SizeGroup> m_xSizeGroup;
72 std::unique_ptr<InspectorHelpWindow> m_xHelpWindow;
77 css::uno::Reference< css::inspection::XPropertyControl >
79 sal_uInt16 m_nTheNameSize;
83
84 void UpdatePlayGround();
85 void ShowEntry(sal_uInt16 nPos);
86
87 public:
88 explicit OBrowserListBox(weld::Builder& rBuilder, weld::Container* pContainer);
90
91 void SetListener( IPropertyLineListener* _pListener );
92 void SetObserver( IPropertyControlObserver* _pObserver );
93
94 void EnableHelpSection( bool _bEnable );
95 bool HasHelpSection() const;
96 void SetHelpText( const OUString& _rHelpText );
97
98 void Clear();
99
100 void InsertEntry( const OLineDescriptor&, sal_uInt16 nPos );
101 bool RemoveEntry( const OUString& _rName );
102 void ChangeEntry( const OLineDescriptor&, ListBoxLines::size_type nPos );
103
104 void SetPropertyValue( const OUString& rEntryName, const css::uno::Any& rValue, bool _bUnknownValue );
105 sal_uInt16 GetPropertyPos( std::u16string_view rEntryName ) const;
106 css::uno::Reference< css::inspection::XPropertyControl >
107 GetPropertyControl( const OUString& rEntryName );
108 void EnablePropertyControls( const OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
109 void EnablePropertyLine( const OUString& _rEntryName, bool _bEnable );
110
111 bool IsModified( ) const;
112 void CommitModified( );
113
115 void focusGained( const css::uno::Reference< css::inspection::XPropertyControl >& Control );
117 void valueChanged( const css::uno::Reference< css::inspection::XPropertyControl >& Control );
119 void activateNextControl( const css::uno::Reference< css::inspection::XPropertyControl >& CurrentControl );
120
121 private:
122 // IButtonClickListener
123 void buttonClicked( OBrowserLine* _pLine, bool _bPrimary ) override;
124
129 sal_uInt16 impl_getControlPos( const css::uno::Reference< css::inspection::XPropertyControl >& _rxControl ) const;
130
138 static void impl_setControlAsPropertyValue( const ListBoxLine& _rLine, const css::uno::Any& _rPropertyValue );
139
144 static css::uno::Any
146
156 bool impl_getBrowserLineForName( const OUString& _rEntryName, BrowserLinePointer& _out_rpLine ) const;
157 };
158
159
160} // namespace pcr
161
162
163
164/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
non-UNO version of the XPropertyControlObserver
std::unique_ptr< weld::Container > m_xLinesPlayground
void focusGained(const css::uno::Reference< css::inspection::XPropertyControl > &Control)
std::unique_ptr< weld::SizeGroup > m_xSizeGroup
void ChangeEntry(const OLineDescriptor &, ListBoxLines::size_type nPos)
static void impl_setControlAsPropertyValue(const ListBoxLine &_rLine, const css::uno::Any &_rPropertyValue)
sets the given property value at the given control, after converting it as necessary
IPropertyLineListener * m_pLineListener
void EnablePropertyControls(const OUString &_rEntryName, sal_Int16 _nControls, bool _bEnable)
void activateNextControl(const css::uno::Reference< css::inspection::XPropertyControl > &CurrentControl)
std::unique_ptr< InspectorHelpWindow > m_xHelpWindow
bool RemoveEntry(const OUString &_rName)
css::uno::Reference< css::inspection::XPropertyControl > GetPropertyControl(const OUString &rEntryName)
IPropertyControlObserver * m_pControlObserver
css::uno::Reference< css::inspection::XPropertyControl > m_xActiveControl
std::unique_ptr< weld::ScrolledWindow > m_xScrolledWindow
sal_uInt16 GetPropertyPos(std::u16string_view rEntryName) const
OBrowserListBox(weld::Builder &rBuilder, weld::Container *pContainer)
void SetPropertyValue(const OUString &rEntryName, const css::uno::Any &rValue, bool _bUnknownValue)
static css::uno::Any impl_getControlAsPropertyValue(const ListBoxLine &_rLine)
retrieves the value for the given control, as a property value, after converting it as necessary
void EnableHelpSection(bool _bEnable)
weld::Container * m_pInitialControlParent
sal_uInt16 impl_getControlPos(const css::uno::Reference< css::inspection::XPropertyControl > &_rxControl) const
retrieves the index of a given control in our line list
void valueChanged(const css::uno::Reference< css::inspection::XPropertyControl > &Control)
bool HasHelpSection() const
void EnablePropertyLine(const OUString &_rEntryName, bool _bEnable)
void SetObserver(IPropertyControlObserver *_pObserver)
void SetHelpText(const OUString &_rHelpText)
void buttonClicked(OBrowserLine *_pLine, bool _bPrimary) override
void InsertEntry(const OLineDescriptor &, sal_uInt16 nPos)
::rtl::Reference< PropertyControlContext_Impl > m_pControlContextImpl
void SetListener(IPropertyLineListener *_pListener)
void ShowEntry(sal_uInt16 nPos)
bool impl_getBrowserLineForName(const OUString &_rEntryName, BrowserLinePointer &_out_rpLine) const
retrieves the ->BrowserLinePointer for a given entry name
a property handler for any virtual string properties
Definition: browserline.cxx:39
std::vector< ListBoxLine > ListBoxLines
std::shared_ptr< OBrowserLine > BrowserLinePointer
css::uno::Reference< css::inspection::XPropertyHandler > xHandler
ListBoxLine(OUString _aName, BrowserLinePointer _pLine, css::uno::Reference< css::inspection::XPropertyHandler > _xHandler)
BrowserLinePointer pLine