Line data Source code
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 :
12 : #include "PivotLayoutTreeListLabel.hxx"
13 : #include "PivotLayoutDialog.hxx"
14 :
15 : #include <svtools/treelistentry.hxx>
16 : #include "pivot.hxx"
17 : #include "scabstdlg.hxx"
18 :
19 : using namespace std;
20 :
21 0 : extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeScPivotLayoutTreeListLabel(vcl::Window *pParent, VclBuilder::stringmap& )
22 : {
23 0 : return new ScPivotLayoutTreeListLabel(pParent, WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
24 : }
25 :
26 0 : ScPivotLayoutTreeListLabel::ScPivotLayoutTreeListLabel(vcl::Window* pParent, WinBits nBits)
27 : : ScPivotLayoutTreeListBase(pParent, nBits, LABEL_LIST)
28 0 : , maDataItem(0)
29 : {
30 0 : }
31 :
32 0 : ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
33 0 : {}
34 :
35 0 : void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVector)
36 : {
37 0 : Clear();
38 0 : maItemValues.clear();
39 :
40 0 : ScDPLabelDataVector::iterator it;
41 0 : for (it = rLabelVector.begin(); it != rLabelVector.end(); ++it)
42 : {
43 0 : const ScDPLabelData& rLabelData = *it;
44 :
45 0 : ScItemValue* pValue = new ScItemValue(rLabelData.maName, rLabelData.mnCol, rLabelData.mnFuncMask);
46 0 : maItemValues.push_back(pValue);
47 0 : if (rLabelData.mbDataLayout)
48 : {
49 0 : maDataItem = maItemValues.size() - 1;
50 : }
51 :
52 0 : if (rLabelData.mnOriginalDim < 0 && !rLabelData.mbDataLayout)
53 : {
54 0 : SvTreeListEntry* pEntry = InsertEntry(rLabelData.maName);
55 0 : pEntry->SetUserData(pValue);
56 : }
57 : }
58 0 : }
59 :
60 0 : void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
61 : {
62 0 : if(mpParent->mpPreviouslyFocusedListBox != this)
63 0 : mpParent->mpPreviouslyFocusedListBox->RemoveSelection();
64 0 : }
65 :
66 0 : bool ScPivotLayoutTreeListLabel::IsDataElement(SCCOL nColumn)
67 : {
68 0 : return (nColumn == PIVOT_DATA_FIELD || nColumn == maDataItem);
69 : }
70 :
71 0 : ScItemValue* ScPivotLayoutTreeListLabel::GetItem(SCCOL nColumn)
72 : {
73 0 : if (nColumn == PIVOT_DATA_FIELD)
74 0 : return &maItemValues[maDataItem];
75 0 : return &maItemValues[nColumn];
76 : }
77 :
78 0 : void ScPivotLayoutTreeListLabel::KeyInput(const KeyEvent& rKeyEvent)
79 : {
80 0 : vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
81 0 : sal_uInt16 nCode = aCode.GetCode();
82 :
83 0 : switch (nCode)
84 : {
85 : case KEY_DELETE:
86 0 : GetModel()->Remove(GetCurEntry());
87 0 : return;
88 : }
89 0 : SvTreeListBox::KeyInput(rKeyEvent);
90 228 : }
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|