1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SC_SOURCE_UI_INC_PVFUNDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_PVFUNDLG_HXX
23 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
24 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
26 #include <vcl/fixed.hxx>
27 #include <vcl/layout.hxx>
28 #include <vcl/lstbox.hxx>
29 #include <vcl/dialog.hxx>
30 #include <vcl/button.hxx>
31 #include <vcl/morebtn.hxx>
32 #include <vcl/field.hxx>
33 #include <svtools/stdctrl.hxx>
34 #include <svx/checklbx.hxx>
35 #include <sfx2/itemconnect.hxx>
38 #include <boost/scoped_ptr.hpp>
39 #include <unordered_map>
41 typedef sfx::ListBoxWrapper
< sal_Int32
> ScDPListBoxWrapper
;
45 class ScDPFunctionListBox
: public ListBox
48 ScDPFunctionListBox(vcl::Window
* pParent
, WinBits nStyle
);
50 void SetSelection( sal_uInt16 nFuncMask
);
51 sal_uInt16
GetSelection() const;
54 void FillFunctionNames();
57 class ScDPFunctionDlg
: public ModalDialog
59 typedef std::unordered_map
< OUString
, OUString
, OUStringHash
> NameMapType
;
61 explicit ScDPFunctionDlg( vcl::Window
* pParent
, const ScDPLabelDataVector
& rLabelVec
,
62 const ScDPLabelData
& rLabelData
, const ScPivotFuncData
& rFuncData
);
63 virtual ~ScDPFunctionDlg();
64 virtual void dispose() SAL_OVERRIDE
;
65 sal_uInt16
GetFuncMask() const;
66 ::com::sun::star::sheet::DataPilotFieldReference
GetFieldRef() const;
69 void Init( const ScDPLabelData
& rLabelData
, const ScPivotFuncData
& rFuncData
);
71 const OUString
& GetBaseFieldName(const OUString
& rLayoutName
) const;
72 const OUString
& GetBaseItemName(const OUString
& rLayoutName
) const;
74 /** Searches for a listbox entry, starts search at specified position. */
75 sal_Int32
FindBaseItemPos( const OUString
& rEntry
, sal_Int32 nStartPos
) const;
77 DECL_LINK( SelectHdl
, ListBox
* );
78 DECL_LINK( DblClickHdl
, void* );
81 VclPtr
<ScDPFunctionListBox
> mpLbFunc
;
82 VclPtr
<FixedText
> mpFtName
;
83 VclPtr
<ListBox
> mpLbType
;
84 VclPtr
<FixedText
> mpFtBaseField
;
85 VclPtr
<ListBox
> mpLbBaseField
;
86 VclPtr
<FixedText
> mpFtBaseItem
;
87 VclPtr
<ListBox
> mpLbBaseItem
;
88 VclPtr
<OKButton
> mpBtnOk
;
90 NameMapType maBaseFieldNameMap
; // cache for base field display -> original name.
91 NameMapType maBaseItemNameMap
; // cache for base item display -> original name.
93 boost::scoped_ptr
<ScDPListBoxWrapper
> mxLbTypeWrp
; /// Wrapper for direct usage of API constants.
95 const ScDPLabelDataVector
& mrLabelVec
; /// Data of all labels.
96 bool mbEmptyItem
; /// true = Empty base item in listbox.
99 class ScDPSubtotalDlg
: public ModalDialog
102 explicit ScDPSubtotalDlg( vcl::Window
* pParent
, ScDPObject
& rDPObj
,
103 const ScDPLabelData
& rLabelData
, const ScPivotFuncData
& rFuncData
,
104 const ScDPNameVec
& rDataFields
, bool bEnableLayout
);
105 virtual ~ScDPSubtotalDlg();
106 virtual void dispose() SAL_OVERRIDE
;
107 sal_uInt16
GetFuncMask() const;
109 void FillLabelData( ScDPLabelData
& rLabelData
) const;
112 void Init( const ScDPLabelData
& rLabelData
, const ScPivotFuncData
& rFuncData
);
114 DECL_LINK(DblClickHdl
, void *);
115 DECL_LINK( RadioClickHdl
, RadioButton
* );
116 DECL_LINK( ClickHdl
, PushButton
* );
119 VclPtr
<RadioButton
> mpRbNone
;
120 VclPtr
<RadioButton
> mpRbAuto
;
121 VclPtr
<RadioButton
> mpRbUser
;
122 VclPtr
<ScDPFunctionListBox
> mpLbFunc
;
123 VclPtr
<FixedText
> mpFtName
;
124 VclPtr
<CheckBox
> mpCbShowAll
;
125 VclPtr
<OKButton
> mpBtnOk
;
126 VclPtr
<PushButton
> mpBtnOptions
;
128 ScDPObject
& mrDPObj
; /// The DataPilot object (for member names).
129 const ScDPNameVec
& mrDataFields
; /// The list of all data field names.
131 ScDPLabelData maLabelData
; /// Cache for sub dialog.
132 bool mbEnableLayout
; /// true = Enable Layout mode controls.
135 class ScDPSubtotalOptDlg
: public ModalDialog
138 explicit ScDPSubtotalOptDlg( vcl::Window
* pParent
, ScDPObject
& rDPObj
,
139 const ScDPLabelData
& rLabelData
, const ScDPNameVec
& rDataFields
,
140 bool bEnableLayout
);
141 virtual ~ScDPSubtotalOptDlg();
142 virtual void dispose() SAL_OVERRIDE
;
143 void FillLabelData( ScDPLabelData
& rLabelData
) const;
146 void Init( const ScDPNameVec
& rDataFields
, bool bEnableLayout
);
147 void InitHideListBox();
149 ScDPName
GetFieldName(const OUString
& rLayoutName
) const;
151 /** Searches for a listbox entry, starts search at specified position. */
152 sal_Int32
FindListBoxEntry( const ListBox
& rLBox
, const OUString
& rEntry
, sal_Int32 nStartPos
) const;
154 DECL_LINK( RadioClickHdl
, RadioButton
* );
155 DECL_LINK( CheckHdl
, CheckBox
* );
156 DECL_LINK( SelectHdl
, ListBox
* );
159 VclPtr
<ListBox
> m_pLbSortBy
;
160 VclPtr
<RadioButton
> m_pRbSortAsc
;
161 VclPtr
<RadioButton
> m_pRbSortDesc
;
162 VclPtr
<RadioButton
> m_pRbSortMan
;
163 VclPtr
<VclContainer
> m_pLayoutFrame
;
164 VclPtr
<ListBox
> m_pLbLayout
;
165 VclPtr
<CheckBox
> m_pCbLayoutEmpty
;
166 VclPtr
<CheckBox
> m_pCbRepeatItemLabels
;
167 VclPtr
<CheckBox
> m_pCbShow
;
168 VclPtr
<NumericField
> m_pNfShow
;
169 VclPtr
<FixedText
> m_pFtShow
;
170 VclPtr
<FixedText
> m_pFtShowFrom
;
171 VclPtr
<ListBox
> m_pLbShowFrom
;
172 VclPtr
<FixedText
> m_pFtShowUsing
;
173 VclPtr
<ListBox
> m_pLbShowUsing
;
174 VclPtr
<VclContainer
> m_pHideFrame
;
175 VclPtr
<SvxCheckListBox
> m_pLbHide
;
176 VclPtr
<FixedText
> m_pFtHierarchy
;
177 VclPtr
<ListBox
> m_pLbHierarchy
;
179 boost::scoped_ptr
<ScDPListBoxWrapper
> m_xLbLayoutWrp
; /// Wrapper for direct usage of API constants.
180 boost::scoped_ptr
<ScDPListBoxWrapper
> m_xLbShowFromWrp
; /// Wrapper for direct usage of API constants.
182 ScDPObject
& mrDPObj
; /// The DataPilot object (for member names).
183 ScDPLabelData maLabelData
; /// Cache for members data.
185 typedef std::unordered_map
<OUString
, ScDPName
, OUStringHash
> NameMapType
;
186 NameMapType maDataFieldNameMap
; /// Cache for displayed name to field name mapping.
189 class ScDPShowDetailDlg
: public ModalDialog
192 explicit ScDPShowDetailDlg( vcl::Window
* pParent
, ScDPObject
& rDPObj
, sal_uInt16 nOrient
);
193 virtual ~ScDPShowDetailDlg();
194 virtual void dispose() SAL_OVERRIDE
;
195 virtual short Execute() SAL_OVERRIDE
;
198 * @return String internal name of the selected field. Note that this may
199 * be different from the name displayed in the dialog if the field
202 OUString
GetDimensionName() const;
205 DECL_LINK( DblClickHdl
, ListBox
* );
208 VclPtr
<ListBox
> mpLbDims
;
209 VclPtr
<OKButton
> mpBtnOk
;
211 typedef std::unordered_map
<OUString
, long, OUStringHash
> DimNameIndexMap
;
212 DimNameIndexMap maNameIndexMap
;
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */