LCOV - code coverage report
Current view: top level - sc/source/ui/dbgui - PivotLayoutTreeListBase.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 71 1.4 %
Date: 2015-06-13 12:38:46 Functions: 2 20 10.0 %
Legend: Lines: hit not hit

          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 "PivotLayoutTreeListBase.hxx"
      13             : #include "PivotLayoutDialog.hxx"
      14             : 
      15             : #include <reffact.hxx>
      16             : #include <svtools/treelistentry.hxx>
      17             : #include "scabstdlg.hxx"
      18             : 
      19             : using namespace std;
      20             : 
      21           0 : ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBits nBits, SvPivotTreeListType eType)
      22             :     : SvTreeListBox(pParent, nBits)
      23             :     , meType(eType)
      24           0 :     , mpParent(NULL)
      25             : {
      26           0 :     SetHighlightRange();
      27           0 :     SetDragDropMode(DragDropMode::CTRL_MOVE | DragDropMode::APP_MOVE  | DragDropMode::APP_DROP);
      28           0 : }
      29             : 
      30           0 : ScPivotLayoutTreeListBase::~ScPivotLayoutTreeListBase()
      31             : {
      32           0 :     disposeOnce();
      33           0 : }
      34             : 
      35           0 : void ScPivotLayoutTreeListBase::dispose()
      36             : {
      37           0 :     mpParent.clear();
      38           0 :     SvTreeListBox::dispose();
      39           0 : }
      40             : 
      41           0 : void ScPivotLayoutTreeListBase::Setup(ScPivotLayoutDialog* pParent)
      42             : {
      43           0 :     mpParent = pParent;
      44           0 : }
      45             : 
      46           0 : DragDropMode ScPivotLayoutTreeListBase::NotifyStartDrag(TransferDataContainer& /*aTransferDataContainer*/,
      47             :                                                   SvTreeListEntry* /*pEntry*/ )
      48             : {
      49           0 :     return GetDragDropMode();
      50             : }
      51             : 
      52           0 : void ScPivotLayoutTreeListBase::DragFinished(sal_Int8 /*nDropAction*/)
      53           0 : {}
      54             : 
      55           0 : sal_Int8 ScPivotLayoutTreeListBase::AcceptDrop(const AcceptDropEvent& rEvent)
      56             : {
      57           0 :     return SvTreeListBox::AcceptDrop(rEvent);
      58             : }
      59             : 
      60           0 : bool ScPivotLayoutTreeListBase::NotifyAcceptDrop(SvTreeListEntry* /*pEntry*/)
      61             : {
      62           0 :     return true;
      63             : }
      64             : 
      65           0 : TriState ScPivotLayoutTreeListBase::NotifyMoving(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
      66             :                                                 SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
      67             : {
      68           0 :     InsertEntryForSourceTarget(pSource, pTarget);
      69           0 :     return TRISTATE_FALSE;
      70             : }
      71             : 
      72           0 : TriState ScPivotLayoutTreeListBase::NotifyCopying(SvTreeListEntry* /*pTarget*/, SvTreeListEntry* /*pSource*/,
      73             :                                                  SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
      74             : {
      75           0 :     return TRISTATE_FALSE;
      76             : }
      77             : 
      78           0 : bool ScPivotLayoutTreeListBase::HasEntry(SvTreeListEntry* pEntry)
      79             : {
      80             :     SvTreeListEntry* pEachEntry;
      81           0 :     for (pEachEntry = First(); pEachEntry != NULL; pEachEntry = Next(pEachEntry))
      82             :     {
      83           0 :         if(pEachEntry == pEntry)
      84           0 :             return true;
      85             :     }
      86           0 :     return false;
      87             : }
      88             : 
      89           0 : void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector)
      90             : {
      91             :     SvTreeListEntry* pEachEntry;
      92           0 :     for (pEachEntry = First(); pEachEntry != NULL; pEachEntry = Next(pEachEntry))
      93             :     {
      94           0 :         ScItemValue* pItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
      95           0 :         ScPivotFuncData& rFunctionData = pItemValue->maFunctionData;
      96             : 
      97           0 :         ScPivotField aField;
      98           0 :         aField.nCol          = rFunctionData.mnCol;
      99           0 :         aField.mnOriginalDim = rFunctionData.mnOriginalDim;
     100           0 :         aField.nFuncMask     = rFunctionData.mnFuncMask;
     101           0 :         aField.mnDupCount    = rFunctionData.mnDupCount;
     102           0 :         aField.maFieldRef    = rFunctionData.maFieldRef;
     103           0 :         rVector.push_back(aField);
     104           0 :     }
     105           0 : }
     106             : 
     107           0 : void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
     108           0 : {}
     109             : 
     110           0 : void ScPivotLayoutTreeListBase::InsertEntryForItem(ScItemValue* /*pItemValue*/, sal_uLong /*nPosition*/)
     111           0 : {}
     112             : 
     113           0 : void ScPivotLayoutTreeListBase::RemoveEntryForItem(ScItemValue* pItemValue)
     114             : {
     115             :     SvTreeListEntry* pEachEntry;
     116           0 :     for (pEachEntry = First(); pEachEntry != NULL; pEachEntry = Next(pEachEntry))
     117             :     {
     118           0 :         ScItemValue* pEachItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
     119           0 :         if (pEachItemValue == pItemValue)
     120             :         {
     121           0 :             GetModel()->Remove(pEachEntry);
     122           0 :             return;
     123             :         }
     124             :     }
     125             : }
     126             : 
     127           0 : void ScPivotLayoutTreeListBase::GetFocus()
     128             : {
     129           0 :     SvTreeListBox::GetFocus();
     130             : 
     131           0 :     if( GetGetFocusFlags() & GetFocusFlags::Mnemonic )
     132             :     {
     133           0 :         SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry();
     134           0 :         if (pEntry)
     135           0 :             InsertEntryForSourceTarget(pEntry, NULL);
     136             : 
     137           0 :         if (mpParent->mpPreviouslyFocusedListBox != nullptr)
     138           0 :             mpParent->mpPreviouslyFocusedListBox->GrabFocus();
     139             :     }
     140             : 
     141           0 :     mpParent->mpCurrentlyFocusedListBox = this;
     142           0 : }
     143             : 
     144           0 : void ScPivotLayoutTreeListBase::LoseFocus()
     145             : {
     146           0 :     SvTreeListBox::LoseFocus();
     147           0 :     if (mpParent)
     148           0 :         mpParent->mpPreviouslyFocusedListBox = this;
     149         156 : }
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11