LibreOffice Module formula (master) 1
parawin.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 <formula/funcutl.hxx>
23#include <vcl/weld.hxx>
24#include "ControlHelper.hxx"
25#include <vector>
26
27namespace formula
28{
29
30#define NOT_FOUND 0xffff
31
32class IFunctionDescription;
33class IControlReferenceHandler;
34
36{
37private:
40
41 ::std::vector<sal_uInt16> aVisibleArgMapping;
44 sal_uInt16 nArgs; // unsuppressed arguments, may be >= VAR_ARGS to indicate repeating parameters
45 sal_uInt16 nMaxArgs; // max arguments, limited to supported number of arguments
48
49 OUString m_sOptional;
50 OUString m_sRequired;
51
52 sal_uInt16 nEdFocus;
53 sal_uInt16 nActiveLine;
54
57 ::std::vector<OUString> aParaArray;
58
59 std::unique_ptr<weld::Builder> m_xBuilder;
60 std::unique_ptr<weld::Container> m_xContainer;
61
62 std::unique_ptr<weld::ScrolledWindow> m_xSlider;
63 std::unique_ptr<weld::Widget> m_xParamGrid;
64 std::unique_ptr<weld::Widget> m_xGrid;
65
66 std::unique_ptr<weld::Label> m_xFtEditDesc;
67 std::unique_ptr<weld::Label> m_xFtArgName;
68 std::unique_ptr<weld::Label> m_xFtArgDesc;
69
70 std::unique_ptr<weld::Button> m_xBtnFx1;
71 std::unique_ptr<weld::Button> m_xBtnFx2;
72 std::unique_ptr<weld::Button> m_xBtnFx3;
73 std::unique_ptr<weld::Button> m_xBtnFx4;
74
75 std::unique_ptr<weld::Label> m_xFtArg1;
76 std::unique_ptr<weld::Label> m_xFtArg2;
77 std::unique_ptr<weld::Label> m_xFtArg3;
78 std::unique_ptr<weld::Label> m_xFtArg4;
79
80 std::unique_ptr<ArgEdit> m_xEdArg1;
81 std::unique_ptr<ArgEdit> m_xEdArg2;
82 std::unique_ptr<ArgEdit> m_xEdArg3;
83 std::unique_ptr<ArgEdit> m_xEdArg4;
84
85 std::unique_ptr<RefButton> m_xRefBtn1;
86 std::unique_ptr<RefButton> m_xRefBtn2;
87 std::unique_ptr<RefButton> m_xRefBtn3;
88 std::unique_ptr<RefButton> m_xRefBtn4;
89
90 DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void);
91 DECL_LINK( ModifyHdl, ArgInput&, void );
92 DECL_LINK( GetEdFocusHdl, ArgInput&, void );
93 DECL_LINK( GetFxFocusHdl, ArgInput&, void );
94 DECL_LINK( GetFxHdl, ArgInput&, void );
95
96 void ArgumentModified();
97
98 void InitArgInput(sal_uInt16 nPos, weld::Label& rFtArg, weld::Button& rBtnFx,
99 ArgEdit& rEdArg, RefButton& rRefBtn);
100
101 void SetArgumentDesc(const OUString& aText);
102 void SetArgumentText(const OUString& aText);
103
104
105 void SetArgName (sal_uInt16 no,const OUString &aArg);
106 void SetArgNameFont (sal_uInt16 no,const vcl::Font&);
107
108 void UpdateArgDesc( sal_uInt16 nArg );
109 void UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i );
110
111public:
113 ~ParaWin();
114
115 void SetFunctionDesc(const IFunctionDescription* pFDesc);
116 void SetArgumentOffset(sal_uInt16 nOffset);
117 void SetEditDesc(const OUString& aText);
118 void UpdateParas();
119 void ClearAll();
120
121 sal_uInt16 GetActiveLine() const { return nActiveLine;}
122 void SetActiveLine(sal_uInt16 no);
124 OUString GetActiveArgName() const;
125
126 OUString GetArgument(sal_uInt16 no);
127 void SetArgument(sal_uInt16 no, std::u16string_view aString);
128 void SetArgumentFonts(const vcl::Font& aBoldFont,const vcl::Font& aLightFont);
129
130 void SetEdFocus(); // visible edit lines
131 sal_uInt16 GetSliderPos() const;
132 void SetSliderPos(sal_uInt16 nSliderPos);
133
135 void SetFxHdl( const Link<ParaWin&,void>& rLink ) { aFxLink = rLink; }
136
137 void SliderMoved();
138
139 void Show() { m_xContainer->show(); }
140};
141
142
143} // formula
144
145/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString m_sRequired
Definition: parawin.hxx:50
void SetArgumentDesc(const OUString &aText)
Definition: parawin.cxx:346
Link< ParaWin &, void > aFxLink
Definition: parawin.hxx:38
void SetEditDesc(const OUString &aText)
Definition: parawin.cxx:351
DECL_LINK(GetFxFocusHdl, ArgInput &, void)
std::unique_ptr< ArgEdit > m_xEdArg1
Definition: parawin.hxx:80
sal_uInt16 nArgs
Definition: parawin.hxx:44
ArgInput aArgInput[4]
Definition: parawin.hxx:55
std::unique_ptr< RefButton > m_xRefBtn3
Definition: parawin.hxx:87
std::unique_ptr< weld::Button > m_xBtnFx1
Definition: parawin.hxx:70
DECL_LINK(GetFxHdl, ArgInput &, void)
ParaWin(weld::Container *pParent, IControlReferenceHandler *_pDlg)
Definition: parawin.cxx:38
std::unique_ptr< weld::Label > m_xFtArgDesc
Definition: parawin.hxx:68
std::unique_ptr< weld::Label > m_xFtArg4
Definition: parawin.hxx:78
std::unique_ptr< RefButton > m_xRefBtn4
Definition: parawin.hxx:88
sal_uInt16 nMaxArgs
Definition: parawin.hxx:45
std::unique_ptr< weld::Button > m_xBtnFx3
Definition: parawin.hxx:72
vcl::Font aFntLight
Definition: parawin.hxx:47
void SetFxHdl(const Link< ParaWin &, void > &rLink)
Definition: parawin.hxx:135
void SetArgumentFonts(const vcl::Font &aBoldFont, const vcl::Font &aLightFont)
Definition: parawin.cxx:294
void SetArgModifiedHdl(const Link< ParaWin &, void > &rLink)
Definition: parawin.hxx:134
std::unique_ptr< weld::Label > m_xFtArg3
Definition: parawin.hxx:77
DECL_LINK(GetEdFocusHdl, ArgInput &, void)
void SetArgName(sal_uInt16 no, const OUString &aArg)
Definition: parawin.cxx:356
DECL_LINK(ScrollHdl, weld::ScrolledWindow &, void)
DECL_LINK(ModifyHdl, ArgInput &, void)
std::unique_ptr< weld::Label > m_xFtEditDesc
Definition: parawin.hxx:66
void ArgumentModified()
Definition: parawin.cxx:490
std::unique_ptr< weld::Container > m_xContainer
Definition: parawin.hxx:60
std::unique_ptr< weld::Label > m_xFtArg2
Definition: parawin.hxx:76
void SetArgNameFont(sal_uInt16 no, const vcl::Font &)
Definition: parawin.cxx:362
std::unique_ptr< weld::Button > m_xBtnFx2
Definition: parawin.hxx:71
std::unique_ptr< weld::Widget > m_xGrid
Definition: parawin.hxx:64
OUString aDefaultString
Definition: parawin.hxx:56
sal_uInt16 nActiveLine
Definition: parawin.hxx:53
sal_uInt16 GetSliderPos() const
Definition: parawin.cxx:452
std::unique_ptr< ArgEdit > m_xEdArg3
Definition: parawin.hxx:82
std::unique_ptr< weld::Builder > m_xBuilder
Definition: parawin.hxx:59
std::unique_ptr< ArgEdit > m_xEdArg2
Definition: parawin.hxx:81
::std::vector< sal_uInt16 > aVisibleArgMapping
Definition: parawin.hxx:41
void SetArgumentOffset(sal_uInt16 nOffset)
Definition: parawin.cxx:398
std::unique_ptr< RefButton > m_xRefBtn2
Definition: parawin.hxx:86
void SetSliderPos(sal_uInt16 nSliderPos)
Definition: parawin.cxx:457
OUString m_sOptional
Definition: parawin.hxx:49
void UpdateParas()
Definition: parawin.cxx:433
std::unique_ptr< weld::Label > m_xFtArg1
Definition: parawin.hxx:75
void UpdateArgInput(sal_uInt16 nOffset, sal_uInt16 i)
Definition: parawin.cxx:161
sal_uInt16 GetActiveLine() const
Definition: parawin.hxx:121
std::unique_ptr< RefButton > m_xRefBtn1
Definition: parawin.hxx:85
::std::vector< OUString > aParaArray
Definition: parawin.hxx:57
std::unique_ptr< weld::Widget > m_xParamGrid
Definition: parawin.hxx:63
Link< ParaWin &, void > aArgModifiedLink
Definition: parawin.hxx:39
IControlReferenceHandler * pMyParent
Definition: parawin.hxx:43
void SetArgument(sal_uInt16 no, std::u16string_view aString)
Definition: parawin.cxx:288
void SetFunctionDesc(const IFunctionDescription *pFDesc)
Definition: parawin.cxx:300
RefEdit * GetActiveEdit()
Definition: parawin.cxx:252
const IFunctionDescription * pFuncDesc
Definition: parawin.hxx:42
std::unique_ptr< weld::Label > m_xFtArgName
Definition: parawin.hxx:67
void SliderMoved()
Definition: parawin.cxx:471
void InitArgInput(sal_uInt16 nPos, weld::Label &rFtArg, weld::Button &rBtnFx, ArgEdit &rEdArg, RefButton &rRefBtn)
Definition: parawin.cxx:374
std::unique_ptr< ArgEdit > m_xEdArg4
Definition: parawin.hxx:83
void SetEdFocus()
Definition: parawin.cxx:367
std::unique_ptr< weld::ScrolledWindow > m_xSlider
Definition: parawin.hxx:62
vcl::Font aFntBold
Definition: parawin.hxx:46
void SetActiveLine(sal_uInt16 no)
Definition: parawin.cxx:234
void UpdateArgDesc(sal_uInt16 nArg)
Definition: parawin.cxx:102
OUString GetArgument(sal_uInt16 no)
Definition: parawin.cxx:265
OUString GetActiveArgName() const
Definition: parawin.cxx:277
std::unique_ptr< weld::Button > m_xBtnFx4
Definition: parawin.hxx:73
sal_uInt16 nEdFocus
Definition: parawin.hxx:52
void SetArgumentText(const OUString &aText)
Definition: parawin.cxx:341