LibreOffice Module extensions (master) 1
propertyeditor.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 "browserpage.hxx"
23#include "pcrcommon.hxx"
24
25#include <com/sun/star/inspection/XPropertyControl.hpp>
26#include <com/sun/star/uno/XComponentContext.hpp>
27#include <vcl/weld.hxx>
28#include <map>
29
30namespace pcr
31{
32 class IPropertyLineListener;
33 class IPropertyControlObserver;
34 class OBrowserPage;
35 struct OLineDescriptor;
36 class OBrowserListBox;
37
38 //= OPropertyEditor
39 class OPropertyEditor final
40 {
41 private:
42 typedef std::map< OUString, sal_uInt16 > MapStringToPageId;
44 {
45 sal_uInt16 nPos;
46 OUString sLabel;
47 std::unique_ptr<OBrowserPage> xPage;
49 PropertyPage(sal_uInt16 nPagePos, OUString aLabel, std::unique_ptr<OBrowserPage> pPage);
50 };
51
52 std::unique_ptr<weld::Container> m_xContainer;
53 std::unique_ptr<weld::Notebook> m_xTabControl;
54 // controls initially have this parent before they are moved
55 std::unique_ptr<weld::Container> m_xControlHoldingParent;
56 css::uno::Reference<css::uno::XComponentContext> m_xContext;
59 sal_uInt16 m_nNextId;
62
64 std::map<sal_uInt16, PropertyPage> m_aShownPages;
65 std::map<sal_uInt16, PropertyPage> m_aHiddenPages;
66
67 public:
68 explicit OPropertyEditor(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Builder& rBuilder);
70
73
74 void EnableHelpSection( bool _bEnable );
75 bool HasHelpSection() const { return m_bHasHelpSection; }
76 void SetHelpText( const OUString& _rHelpText );
77
78 void SetHelpId( const OUString& sHelpId );
79 sal_uInt16 AppendPage( const OUString& r, const OUString& _rHelpId );
80 void SetPage( sal_uInt16 );
81 void RemovePage(sal_uInt16 nID);
82 sal_uInt16 GetCurPage() const;
83 void ClearAll();
84
85 void SetPropertyValue(const OUString& _rEntryName, const css::uno::Any& _rValue, bool _bUnknownValue );
86 sal_uInt16 GetPropertyPos(const OUString& rEntryName ) const;
87 css::uno::Reference< css::inspection::XPropertyControl >
88 GetPropertyControl( const OUString& rEntryName );
89 void EnablePropertyLine( const OUString& _rEntryName, bool _bEnable );
90 void EnablePropertyControls( const OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
91
92 void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow );
93
94 void InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND );
95 void RemoveEntry( const OUString& _rName );
96 void ChangeEntry( const OLineDescriptor& );
97
99
100 Size get_preferred_size() const;
101
102 weld::Widget* getWidget() const { return m_xTabControl.get(); }
103
104 void Show() { m_xTabControl->show(); }
105 void Hide() { m_xTabControl->hide(); }
106 void GrabFocus() { m_xTabControl->grab_focus(); }
107
108 void CommitModified();
109
110 private:
111 OBrowserPage* getPage( sal_uInt16 _rPageId );
112 const OBrowserPage* getPage( sal_uInt16 _rPageId ) const;
113
114 OBrowserPage* getPage( const OUString& _rPropertyName );
115 const OBrowserPage* getPage( const OUString& _rPropertyName ) const;
116
117 typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* );
118 void forEachPage( PageOperation _pOperation );
119
120 void setPageLineListener( OBrowserPage& _rPage, const void* );
121 void setPageControlObserver( OBrowserPage& _rPage, const void* );
122 void enableHelpSection( OBrowserPage& _rPage, const void* );
123 static void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString );
124
125 DECL_LINK(OnPageDeactivate, const OUString&, bool);
126 DECL_LINK(OnPageActivate, const OUString&, void);
127 };
128
129
130} // namespace pcr
131
132
133
134/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
non-UNO version of the XPropertyControlObserver
Link< const OUString &, void > m_aPageActivationHandler
IPropertyControlObserver * m_pObserver
void EnablePropertyControls(const OUString &_rEntryName, sal_Int16 _nControls, bool _bEnable)
void forEachPage(PageOperation _pOperation)
OPropertyEditor(const css::uno::Reference< css::uno::XComponentContext > &rContext, weld::Builder &rBuilder)
void RemoveEntry(const OUString &_rName)
std::unique_ptr< weld::Container > m_xContainer
DECL_LINK(OnPageDeactivate, const OUString &, bool)
void SetControlObserver(IPropertyControlObserver *)
css::uno::Reference< css::uno::XComponentContext > m_xContext
DECL_LINK(OnPageActivate, const OUString &, void)
std::map< sal_uInt16, PropertyPage > m_aShownPages
css::uno::Reference< css::inspection::XPropertyControl > GetPropertyControl(const OUString &rEntryName)
Size get_preferred_size() const
sal_uInt16 GetPropertyPos(const OUString &rEntryName) const
bool HasHelpSection() const
std::unique_ptr< weld::Container > m_xControlHoldingParent
void RemovePage(sal_uInt16 nID)
MapStringToPageId m_aPropertyPageIds
std::map< sal_uInt16, PropertyPage > m_aHiddenPages
void ChangeEntry(const OLineDescriptor &)
void SetHelpText(const OUString &_rHelpText)
void enableHelpSection(OBrowserPage &_rPage, const void *)
std::unique_ptr< weld::Notebook > m_xTabControl
sal_uInt16 GetCurPage() const
weld::Widget * getWidget() const
void(OPropertyEditor::* PageOperation)(OBrowserPage &, const void *)
void setPageActivationHandler(const Link< const OUString &, void > &_rHdl)
void ShowPropertyPage(sal_uInt16 _nPageId, bool _bShow)
static void setHelpSectionText(OBrowserPage &_rPage, const void *_pPointerToOUString)
void EnableHelpSection(bool _bEnable)
void SetPropertyValue(const OUString &_rEntryName, const css::uno::Any &_rValue, bool _bUnknownValue)
void SetLineListener(IPropertyLineListener *)
void setPageLineListener(OBrowserPage &_rPage, const void *)
std::map< OUString, sal_uInt16 > MapStringToPageId
sal_uInt16 AppendPage(const OUString &r, const OUString &_rHelpId)
void InsertEntry(const OLineDescriptor &, sal_uInt16 _nPageId, sal_uInt16 nPos=EDITOR_LIST_APPEND)
void SetPage(sal_uInt16)
void EnablePropertyLine(const OUString &_rEntryName, bool _bEnable)
void setPageControlObserver(OBrowserPage &_rPage, const void *)
IPropertyLineListener * m_pListener
void SetHelpId(const OUString &sHelpId)
OBrowserPage * getPage(sal_uInt16 _rPageId)
a property handler for any virtual string properties
Definition: browserline.cxx:39
#define EDITOR_LIST_APPEND
Definition: pcrcommon.hxx:22
std::unique_ptr< OBrowserPage > xPage