use insert function instead of for loop
[LibreOffice.git] / extensions / source / propctrlr / browserline.hxx
blobdfde2969f41fb70a849e3ae0c75891380928682b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <com/sun/star/inspection/XPropertyControl.hpp>
23 #include <vcl/weld.hxx>
25 namespace com::sun::star::inspection::PropertyLineElement
27 const sal_Int16 CompleteLine = 0x4000;
31 namespace pcr
35 class OBrowserLine;
38 class IButtonClickListener
40 public:
41 virtual void buttonClicked( OBrowserLine* pLine, bool bPrimary ) = 0;
43 protected:
44 ~IButtonClickListener() {}
48 class OBrowserLine
50 private:
51 OUString m_sEntryName;
52 std::unique_ptr<weld::Builder> m_xBuilder;
53 std::unique_ptr<weld::Container> m_xContainer;
54 std::unique_ptr<weld::Label> m_xFtTitle;
55 std::unique_ptr<weld::Button> m_xBrowseButton;
56 std::unique_ptr<weld::Button> m_xAdditionalBrowseButton;
57 css::uno::Reference< css::inspection::XPropertyControl >
58 m_xControl;
59 weld::Container* m_pInitialControlParent;
60 weld::Container* m_pParent;
61 weld::Widget* m_pControlWindow;
62 weld::Button* m_pBrowseButton;
63 weld::Button* m_pAdditionalBrowseButton;
64 IButtonClickListener* m_pClickListener;
65 sal_uInt16 m_nNameWidth;
66 sal_uInt16 m_nEnableFlags;
67 bool m_bIndentTitle;
68 bool m_bReadOnly;
70 public:
71 OBrowserLine(OUString aEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup,
72 weld::Container* pInitialControlParent);
73 ~OBrowserLine();
75 void setControl( const css::uno::Reference< css::inspection::XPropertyControl >& rxControl );
76 const css::uno::Reference< css::inspection::XPropertyControl >& getControl() const
78 return m_xControl;
80 weld::Widget* getControlWindow() const
82 return m_pControlWindow;
85 const OUString& GetEntryName() const { return m_sEntryName; }
87 void SetComponentHelpIds(const OUString& rHelpId);
89 void SetTitle(const OUString& rString );
90 void FullFillTitleString();
91 OUString GetTitle() const;
92 void SetTitleWidth(sal_uInt16);
94 int GetRowHeight() const { return m_xContainer->get_preferred_size().Height(); }
95 void Show(bool bFlag=true);
96 void Hide();
98 bool GrabFocus();
99 void ShowBrowseButton( const OUString& rImageURL, bool bPrimary );
100 void ShowBrowseButton( const css::uno::Reference<css::graphic::XGraphic>& rGraphic, bool bPrimary );
101 void ShowBrowseButton( bool bPrimary );
102 void HideBrowseButton( bool bPrimary );
104 void EnablePropertyControls( sal_Int16 nControls, bool bEnable );
105 void EnablePropertyLine( bool bEnable );
107 void SetReadOnly( bool bReadOnly );
109 void SetClickListener( IButtonClickListener* pListener );
111 void IndentTitle( bool bIndent );
113 private:
114 DECL_LINK( OnButtonClicked, weld::Button&, void );
115 DECL_LINK( OnButtonFocus, weld::Widget&, void );
117 void implHideBrowseButton(bool bPrimary);
118 void implUpdateEnabledDisabled();
120 weld::Button& impl_ensureButton(bool bPrimary);
124 } // namespace pcr
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */