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 Window* SAL_CALL makeScPivotLayoutTreeListLabel(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(Window* pParent, WinBits nBits) :
27 0 : ScPivotLayoutTreeListBase(pParent, nBits, LABEL_LIST)
28 0 : {}
29 :
30 0 : ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
31 0 : {}
32 :
33 0 : void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVector)
34 : {
35 0 : Clear();
36 0 : maItemValues.clear();
37 :
38 0 : ScDPLabelDataVector::iterator it;
39 0 : for (it = rLabelVector.begin(); it != rLabelVector.end(); ++it)
40 : {
41 0 : const ScDPLabelData& rLabelData = *it;
42 :
43 0 : ScItemValue* pValue = new ScItemValue(rLabelData.maName, rLabelData.mnCol, rLabelData.mnFuncMask);
44 0 : maItemValues.push_back(pValue);
45 0 : if (rLabelData.mbDataLayout)
46 : {
47 0 : maDataItem = maItemValues.size() - 1;
48 : }
49 :
50 0 : if (rLabelData.mnOriginalDim < 0 && !rLabelData.mbDataLayout)
51 : {
52 0 : SvTreeListEntry* pEntry = InsertEntry(rLabelData.maName);
53 0 : pEntry->SetUserData(pValue);
54 : }
55 : }
56 0 : }
57 :
58 0 : void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
59 : {
60 0 : if(mpParent->mpPreviouslyFocusedListBox != this)
61 0 : mpParent->mpPreviouslyFocusedListBox->RemoveSelection();
62 0 : }
63 :
64 0 : bool ScPivotLayoutTreeListLabel::IsDataElement(SCCOL nColumn)
65 : {
66 0 : return (nColumn == PIVOT_DATA_FIELD || nColumn == maDataItem);
67 : }
68 :
69 0 : ScItemValue* ScPivotLayoutTreeListLabel::GetItem(SCCOL nColumn)
70 : {
71 0 : if (nColumn == PIVOT_DATA_FIELD)
72 0 : return &maItemValues[maDataItem];
73 0 : return &maItemValues[nColumn];
74 : }
75 :
76 0 : void ScPivotLayoutTreeListLabel::KeyInput(const KeyEvent& rKeyEvent)
77 : {
78 0 : KeyCode aCode = rKeyEvent.GetKeyCode();
79 0 : sal_uInt16 nCode = aCode.GetCode();
80 :
81 0 : switch (nCode)
82 : {
83 : case KEY_DELETE:
84 0 : GetModel()->Remove(GetCurEntry());
85 0 : return;
86 : }
87 0 : SvTreeListBox::KeyInput(rKeyEvent);
88 0 : }
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|