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:
12 #include "PivotLayoutTreeListLabel.hxx"
13 #include "PivotLayoutDialog.hxx"
15 #include <vcl/builderfactory.hxx>
16 #include <svtools/treelistentry.hxx>
18 #include "scabstdlg.hxx"
22 VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeListLabel
,
23 WB_BORDER
| WB_TABSTOP
| WB_CLIPCHILDREN
|
24 WB_FORCE_MAKEVISIBLE
);
26 ScPivotLayoutTreeListLabel::ScPivotLayoutTreeListLabel(vcl::Window
* pParent
, WinBits nBits
)
27 : ScPivotLayoutTreeListBase(pParent
, nBits
, LABEL_LIST
)
32 ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
35 void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector
& rLabelVector
)
40 ScDPLabelDataVector::iterator it
;
41 for (it
= rLabelVector
.begin(); it
!= rLabelVector
.end(); ++it
)
43 const ScDPLabelData
& rLabelData
= *it
;
45 ScItemValue
* pValue
= new ScItemValue(rLabelData
.maName
, rLabelData
.mnCol
, rLabelData
.mnFuncMask
);
46 maItemValues
.push_back(pValue
);
47 if (rLabelData
.mbDataLayout
)
49 maDataItem
= maItemValues
.size() - 1;
52 if (rLabelData
.mnOriginalDim
< 0 && !rLabelData
.mbDataLayout
)
54 SvTreeListEntry
* pEntry
= InsertEntry(rLabelData
.maName
);
55 pEntry
->SetUserData(pValue
);
60 void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry
* /*pSource*/, SvTreeListEntry
* /*pTarget*/)
62 if(mpParent
->mpPreviouslyFocusedListBox
.get() != this)
63 mpParent
->mpPreviouslyFocusedListBox
->RemoveSelection();
66 bool ScPivotLayoutTreeListLabel::IsDataElement(SCCOL nColumn
)
68 return (nColumn
== PIVOT_DATA_FIELD
|| nColumn
== maDataItem
);
71 ScItemValue
* ScPivotLayoutTreeListLabel::GetItem(SCCOL nColumn
)
73 if (nColumn
== PIVOT_DATA_FIELD
)
74 return &maItemValues
[maDataItem
];
75 return &maItemValues
[nColumn
];
78 void ScPivotLayoutTreeListLabel::KeyInput(const KeyEvent
& rKeyEvent
)
80 vcl::KeyCode aCode
= rKeyEvent
.GetKeyCode();
81 sal_uInt16 nCode
= aCode
.GetCode();
83 if (nCode
== KEY_DELETE
)
85 const SvTreeListEntry
* pEntry
= GetCurEntry();
87 GetModel()->Remove(pEntry
);
91 SvTreeListBox::KeyInput(rKeyEvent
);
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */