LCOV - code coverage report
Current view: top level - cui/source/options - optfltr.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 240 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 29 0.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             :  *   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 .
      18             :  */
      19             : 
      20             : #include <unotools/moduleoptions.hxx>
      21             : #include <unotools/fltrcfg.hxx>
      22             : #include "optfltr.hxx"
      23             : #include <cuires.hrc>
      24             : #include "helpid.hrc"
      25             : #include <dialmgr.hxx>
      26             : 
      27             : #include "svtools/svlbitm.hxx"
      28             : #include "svtools/treelistentry.hxx"
      29             : 
      30             : enum MSFltrPg2_CheckBoxEntries {
      31             :     Math,
      32             :     Writer,
      33             :     Calc,
      34             :     Impress,
      35             :     SmartArt,
      36             :     InvalidCBEntry
      37             : };
      38             : 
      39             : 
      40             : 
      41           0 : OfaMSFilterTabPage::OfaMSFilterTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
      42           0 :     : SfxTabPage( pParent, "OptFltrPage", "cui/ui/optfltrpage.ui", &rSet )
      43             : {
      44           0 :     get( aWBasicCodeCB      , "wo_basic"    );
      45           0 :     get( aWBasicWbctblCB    , "wo_exec"     );
      46           0 :     get( aWBasicStgCB       , "wo_saveorig" );
      47           0 :     get( aEBasicCodeCB      , "ex_basic"    );
      48           0 :     get( aEBasicExectblCB   , "ex_exec"     );
      49           0 :     get( aEBasicStgCB       , "ex_saveorig" );
      50           0 :     get( aPBasicCodeCB      , "pp_basic"    );
      51           0 :     get( aPBasicStgCB       , "pp_saveorig" );
      52             : 
      53           0 :     aWBasicCodeCB->SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
      54           0 :     aEBasicCodeCB->SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
      55           0 : }
      56             : 
      57           0 : OfaMSFilterTabPage::~OfaMSFilterTabPage()
      58             : {
      59           0 :     disposeOnce();
      60           0 : }
      61             : 
      62           0 : void OfaMSFilterTabPage::dispose()
      63             : {
      64           0 :     aWBasicCodeCB.clear();
      65           0 :     aWBasicWbctblCB.clear();
      66           0 :     aWBasicStgCB.clear();
      67           0 :     aEBasicCodeCB.clear();
      68           0 :     aEBasicExectblCB.clear();
      69           0 :     aEBasicStgCB.clear();
      70           0 :     aPBasicCodeCB.clear();
      71           0 :     aPBasicStgCB.clear();
      72           0 :     SfxTabPage::dispose();
      73           0 : }
      74             : 
      75             : 
      76           0 : IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl)
      77             : {
      78           0 :     aWBasicWbctblCB->Enable( aWBasicCodeCB->IsChecked() );
      79           0 :     return 0;
      80             : }
      81             : 
      82           0 : IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl)
      83             : {
      84           0 :     aEBasicExectblCB->Enable( aEBasicCodeCB->IsChecked() );
      85           0 :     return 0;
      86             : }
      87             : 
      88           0 : VclPtr<SfxTabPage> OfaMSFilterTabPage::Create( vcl::Window* pParent,
      89             :                                                const SfxItemSet* rAttrSet )
      90             : {
      91           0 :     return VclPtr<OfaMSFilterTabPage>::Create( pParent, *rAttrSet );
      92             : }
      93             : 
      94           0 : bool OfaMSFilterTabPage::FillItemSet( SfxItemSet* )
      95             : {
      96           0 :     SvtFilterOptions& rOpt = SvtFilterOptions::Get();
      97             : 
      98           0 :     if( aWBasicCodeCB->IsValueChangedFromSaved() )
      99           0 :         rOpt.SetLoadWordBasicCode( aWBasicCodeCB->IsChecked() );
     100           0 :     if( aWBasicWbctblCB->IsValueChangedFromSaved() )
     101           0 :         rOpt.SetLoadWordBasicExecutable( aWBasicWbctblCB->IsChecked() );
     102           0 :     if( aWBasicStgCB->IsValueChangedFromSaved() )
     103           0 :         rOpt.SetLoadWordBasicStorage( aWBasicStgCB->IsChecked() );
     104             : 
     105           0 :     if( aEBasicCodeCB->IsValueChangedFromSaved())
     106           0 :         rOpt.SetLoadExcelBasicCode( aEBasicCodeCB->IsChecked() );
     107           0 :     if( aEBasicExectblCB->IsValueChangedFromSaved())
     108           0 :         rOpt.SetLoadExcelBasicExecutable( aEBasicExectblCB->IsChecked() );
     109           0 :     if( aEBasicStgCB->IsValueChangedFromSaved())
     110           0 :         rOpt.SetLoadExcelBasicStorage( aEBasicStgCB->IsChecked() );
     111             : 
     112           0 :     if( aPBasicCodeCB->IsValueChangedFromSaved())
     113           0 :         rOpt.SetLoadPPointBasicCode( aPBasicCodeCB->IsChecked() );
     114           0 :     if( aPBasicStgCB->IsValueChangedFromSaved())
     115           0 :         rOpt.SetLoadPPointBasicStorage( aPBasicStgCB->IsChecked() );
     116             : 
     117           0 :     return false;
     118             : }
     119             : 
     120           0 : void OfaMSFilterTabPage::Reset( const SfxItemSet* )
     121             : {
     122           0 :     const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
     123             : 
     124           0 :     aWBasicCodeCB->Check( rOpt.IsLoadWordBasicCode() );
     125           0 :     aWBasicCodeCB->SaveValue();
     126           0 :     aWBasicWbctblCB->Check( rOpt.IsLoadWordBasicExecutable() );
     127           0 :     aWBasicWbctblCB->SaveValue();
     128           0 :     aWBasicStgCB->Check( rOpt.IsLoadWordBasicStorage() );
     129           0 :     aWBasicStgCB->SaveValue();
     130           0 :     LoadWordBasicCheckHdl_Impl( aWBasicCodeCB );
     131             : 
     132           0 :     aEBasicCodeCB->Check( rOpt.IsLoadExcelBasicCode() );
     133           0 :     aEBasicCodeCB->SaveValue();
     134           0 :     aEBasicExectblCB->Check( rOpt.IsLoadExcelBasicExecutable() );
     135           0 :     aEBasicExectblCB->SaveValue();
     136           0 :     aEBasicStgCB->Check( rOpt.IsLoadExcelBasicStorage() );
     137           0 :     aEBasicStgCB->SaveValue();
     138           0 :     LoadExcelBasicCheckHdl_Impl( aEBasicCodeCB );
     139             : 
     140           0 :     aPBasicCodeCB->Check( rOpt.IsLoadPPointBasicCode() );
     141           0 :     aPBasicCodeCB->SaveValue();
     142           0 :     aPBasicStgCB->Check( rOpt.IsLoadPPointBasicStorage() );
     143           0 :     aPBasicStgCB->SaveValue();
     144           0 : }
     145             : 
     146           0 : OfaMSFilterTabPage2::OfaMSFilterTabPage2( vcl::Window* pParent, const SfxItemSet& rSet ) :
     147             :     SfxTabPage( pParent, "OptFilterPage", "cui/ui/optfltrembedpage.ui", &rSet ),
     148           0 :     sHeader1(CUI_RES(RID_SVXSTR_HEADER1)),
     149           0 :     sHeader2(CUI_RES(RID_SVXSTR_HEADER2)),
     150           0 :     sChgToFromMath(CUI_RES(RID_SVXSTR_CHG_MATH)),
     151           0 :     sChgToFromWriter(CUI_RES(RID_SVXSTR_CHG_WRITER)),
     152           0 :     sChgToFromCalc(CUI_RES(RID_SVXSTR_CHG_CALC)),
     153           0 :     sChgToFromImpress(CUI_RES(RID_SVXSTR_CHG_IMPRESS)),
     154           0 :     sChgToFromSmartArt(CUI_RES(RID_SVXSTR_CHG_SMARTART)),
     155           0 :     pCheckButtonData(0)
     156             : {
     157           0 :     get(m_pCheckLBContainer, "checklbcontainer");
     158             : 
     159           0 :     get( aHighlightingRB, "highlighting");
     160           0 :     get( aShadingRB,      "shading"     );
     161             : 
     162           0 :     Size aControlSize(248, 55);
     163           0 :     aControlSize = LogicToPixel(aControlSize, MAP_APPFONT);
     164           0 :     m_pCheckLBContainer->set_width_request(aControlSize.Width());
     165           0 :     m_pCheckLBContainer->set_height_request(aControlSize.Height());
     166             : 
     167           0 :     m_pCheckLB = VclPtr<MSFltrSimpleTable>::Create(*m_pCheckLBContainer);
     168             : 
     169             :     static long aStaticTabs[] = { 3, 0, 20, 40 };
     170           0 :     m_pCheckLB->SvSimpleTable::SetTabs( aStaticTabs );
     171             : 
     172           0 :     OUString sHeader = sHeader1 + "\t" + sHeader2 + "\t";
     173           0 :     m_pCheckLB->InsertHeaderEntry( sHeader, HEADERBAR_APPEND,
     174           0 :                     HeaderBarItemBits::CENTER | HeaderBarItemBits::VCENTER | HeaderBarItemBits::FIXEDPOS | HeaderBarItemBits::FIXED );
     175             : 
     176           0 :     m_pCheckLB->SetStyle( m_pCheckLB->GetStyle()|WB_HSCROLL| WB_VSCROLL );
     177           0 : }
     178             : 
     179           0 : OfaMSFilterTabPage2::~OfaMSFilterTabPage2()
     180             : {
     181           0 :     disposeOnce();
     182           0 : }
     183             : 
     184           0 : void OfaMSFilterTabPage2::dispose()
     185             : {
     186           0 :     delete pCheckButtonData;
     187           0 :     pCheckButtonData = NULL;
     188           0 :     m_pCheckLB.disposeAndClear();
     189           0 :     m_pCheckLBContainer.clear();
     190           0 :     aHighlightingRB.clear();
     191           0 :     aShadingRB.clear();
     192             : 
     193           0 :     SfxTabPage::dispose();
     194           0 : }
     195             : 
     196           0 : VclPtr<SfxTabPage> OfaMSFilterTabPage2::Create( vcl::Window* pParent,
     197             :                                                 const SfxItemSet* rAttrSet )
     198             : {
     199           0 :     return VclPtr<OfaMSFilterTabPage2>::Create( pParent, *rAttrSet );
     200             : }
     201             : 
     202           0 : bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* )
     203             : {
     204           0 :     SvtFilterOptions& rOpt = SvtFilterOptions::Get();
     205             : 
     206             :     static struct ChkCBoxEntries{
     207             :         MSFltrPg2_CheckBoxEntries eType;
     208             :         bool (SvtFilterOptions:: *FnIs)() const;
     209             :         void (SvtFilterOptions:: *FnSet)( bool bFlag );
     210             :     } aChkArr[] = {
     211             :         { Math,     &SvtFilterOptions::IsMathType2Math,
     212             :                         &SvtFilterOptions::SetMathType2Math },
     213             :         { Math,     &SvtFilterOptions::IsMath2MathType,
     214             :                         &SvtFilterOptions::SetMath2MathType },
     215             :         { Writer,   &SvtFilterOptions::IsWinWord2Writer,
     216             :                         &SvtFilterOptions::SetWinWord2Writer },
     217             :         { Writer,   &SvtFilterOptions::IsWriter2WinWord,
     218             :                         &SvtFilterOptions::SetWriter2WinWord },
     219             :         { Calc,     &SvtFilterOptions::IsExcel2Calc,
     220             :                         &SvtFilterOptions::SetExcel2Calc },
     221             :         { Calc,     &SvtFilterOptions::IsCalc2Excel,
     222             :                         &SvtFilterOptions::SetCalc2Excel },
     223             :         { Impress,  &SvtFilterOptions::IsPowerPoint2Impress,
     224             :                         &SvtFilterOptions::SetPowerPoint2Impress },
     225             :         { Impress,  &SvtFilterOptions::IsImpress2PowerPoint,
     226             :                         &SvtFilterOptions::SetImpress2PowerPoint },
     227             :         { SmartArt,  &SvtFilterOptions::IsSmartArt2Shape,
     228             :                         &SvtFilterOptions::SetSmartArt2Shape },
     229             :         { InvalidCBEntry, 0, 0 }
     230             :     };
     231             : 
     232           0 :     bool bCheck, bFirst = true;
     233           0 :     for( const ChkCBoxEntries* pArr = aChkArr;
     234           0 :             InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
     235             :     {
     236           0 :         sal_uInt16 nCol = bFirst ? 1 : 2;
     237           0 :         SvTreeListEntry* pEntry = GetEntry4Type( pArr->eType );
     238           0 :         if( pEntry )
     239             :         {
     240           0 :             SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem( nCol ));
     241           0 :             if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON)
     242             :             {
     243           0 :                 SvItemStateFlags nButtonFlags = pItem->GetButtonFlags();
     244             :                 bCheck = SV_BUTTON_CHECKED ==
     245           0 :                         SvLBoxButtonData::ConvertToButtonState( nButtonFlags );
     246             : 
     247           0 :                 if( bCheck != (rOpt.*pArr->FnIs)() )
     248           0 :                     (rOpt.*pArr->FnSet)( bCheck );
     249             :             }
     250             :         }
     251             :     }
     252             : 
     253           0 :     if( aHighlightingRB->IsValueChangedFromSaved() )
     254             :     {
     255           0 :         if( aHighlightingRB->IsChecked() )
     256           0 :             rOpt.SetCharBackground2Highlighting();
     257             :         else
     258           0 :             rOpt.SetCharBackground2Shading();
     259             :     }
     260             : 
     261           0 :     return true;
     262             : }
     263             : 
     264           0 : void OfaMSFilterTabPage2::Reset( const SfxItemSet* )
     265             : {
     266           0 :     SvtFilterOptions& rOpt = SvtFilterOptions::Get();
     267             : 
     268           0 :     m_pCheckLB->SetUpdateMode(false);
     269           0 :     m_pCheckLB->Clear();
     270             : 
     271           0 :     SvtModuleOptions aModuleOpt;
     272             : 
     273             :     // int the same sequence as the enums of MSFltrPg2_CheckBoxEntries
     274           0 :     if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
     275           0 :         InsertEntry( sChgToFromMath, static_cast< sal_IntPtr >( Math ) );
     276           0 :     if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
     277           0 :         InsertEntry( sChgToFromWriter, static_cast< sal_IntPtr >( Writer ) );
     278           0 :     if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) )
     279           0 :         InsertEntry( sChgToFromCalc, static_cast< sal_IntPtr >( Calc ) );
     280           0 :     if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) )
     281           0 :         InsertEntry( sChgToFromImpress, static_cast< sal_IntPtr >( Impress ) );
     282           0 :     InsertEntry( sChgToFromSmartArt, static_cast< sal_IntPtr >( SmartArt ), true, false );
     283             : 
     284             :     static struct ChkCBoxEntries{
     285             :         MSFltrPg2_CheckBoxEntries eType;
     286             :         bool (SvtFilterOptions:: *FnIs)() const;
     287             :     } aChkArr[] = {
     288             :         { Math,     &SvtFilterOptions::IsMathType2Math },
     289             :         { Math,     &SvtFilterOptions::IsMath2MathType },
     290             :         { Writer,   &SvtFilterOptions::IsWinWord2Writer },
     291             :         { Writer,   &SvtFilterOptions::IsWriter2WinWord },
     292             :         { Calc,     &SvtFilterOptions::IsExcel2Calc },
     293             :         { Calc,     &SvtFilterOptions::IsCalc2Excel },
     294             :         { Impress,  &SvtFilterOptions::IsPowerPoint2Impress },
     295             :         { Impress,  &SvtFilterOptions::IsImpress2PowerPoint },
     296             :         { SmartArt, &SvtFilterOptions::IsSmartArt2Shape },
     297             :         { InvalidCBEntry, NULL }
     298             :     };
     299             : 
     300           0 :     bool bFirst = true;
     301           0 :     for( const ChkCBoxEntries* pArr = aChkArr;
     302           0 :             InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst )
     303             :     {
     304           0 :         sal_uInt16 nCol = bFirst ? 1 : 2;
     305           0 :         SvTreeListEntry* pEntry = GetEntry4Type( static_cast< sal_IntPtr >( pArr->eType ) );
     306           0 :         if( pEntry )
     307             :         {
     308           0 :             SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem( nCol ));
     309           0 :             if (pItem && pItem->GetType() == SV_ITEM_ID_LBOXBUTTON)
     310             :             {
     311           0 :                 if( (rOpt.*pArr->FnIs)() )
     312           0 :                     pItem->SetStateChecked();
     313             :                 else
     314           0 :                     pItem->SetStateUnchecked();
     315           0 :                 m_pCheckLB->InvalidateEntry( pEntry );
     316             :             }
     317             :         }
     318             :     }
     319           0 :     m_pCheckLB->SetUpdateMode( true );
     320             : 
     321           0 :     if (rOpt.IsCharBackground2Highlighting())
     322           0 :         aHighlightingRB->Check(true);
     323             :     else
     324           0 :         aShadingRB->Check(true);
     325             : 
     326           0 :     aHighlightingRB->SaveValue();
     327           0 : }
     328             : 
     329           0 : void OfaMSFilterTabPage2::InsertEntry( const OUString& _rTxt, sal_IntPtr _nType )
     330             : {
     331           0 :     InsertEntry( _rTxt, _nType, true, true );
     332           0 : }
     333             : 
     334           0 : void OfaMSFilterTabPage2::InsertEntry( const OUString& _rTxt, sal_IntPtr _nType,
     335             :                                        bool loadEnabled, bool saveEnabled )
     336             : {
     337           0 :     SvTreeListEntry* pEntry = new SvTreeListEntry;
     338             : 
     339           0 :     if( !pCheckButtonData )
     340           0 :         pCheckButtonData = new SvLBoxButtonData( m_pCheckLB );
     341             : 
     342           0 :     pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
     343             :     pEntry->AddItem( new SvLBoxButton( pEntry, loadEnabled? SvLBoxButtonKind_enabledCheckbox :
     344             :                                                             SvLBoxButtonKind_disabledCheckbox,
     345           0 :                                        0, pCheckButtonData ) );
     346             :     pEntry->AddItem( new SvLBoxButton( pEntry, saveEnabled? SvLBoxButtonKind_enabledCheckbox :
     347             :                                                             SvLBoxButtonKind_disabledCheckbox,
     348           0 :                                        0, pCheckButtonData ) );
     349           0 :     pEntry->AddItem( new SvLBoxString( pEntry, 0, _rTxt ) );
     350             : 
     351           0 :     pEntry->SetUserData( reinterpret_cast<void*>(_nType) );
     352           0 :     m_pCheckLB->Insert( pEntry );
     353           0 : }
     354             : 
     355           0 : SvTreeListEntry* OfaMSFilterTabPage2::GetEntry4Type( sal_IntPtr _nType ) const
     356             : {
     357           0 :     SvTreeListEntry* pEntry = m_pCheckLB->First();
     358           0 :     while ( pEntry )
     359             :     {
     360           0 :         if ( _nType == sal_IntPtr( pEntry->GetUserData() ) )
     361           0 :             return pEntry;
     362           0 :         pEntry = m_pCheckLB->Next( pEntry );
     363             :     }
     364           0 :     return NULL;
     365             : }
     366             : 
     367           0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::SetTabs()
     368             : {
     369           0 :     SvSimpleTable::SetTabs();
     370           0 :     SvLBoxTabFlags nAdjust = SvLBoxTabFlags::ADJUST_RIGHT|SvLBoxTabFlags::ADJUST_LEFT|SvLBoxTabFlags::ADJUST_CENTER|SvLBoxTabFlags::ADJUST_NUMERIC|SvLBoxTabFlags::FORCE;
     371             : 
     372           0 :     if( aTabs.size() > 1 )
     373             :     {
     374           0 :         SvLBoxTab* pTab = aTabs[1];
     375           0 :         pTab->nFlags &= ~nAdjust;
     376           0 :         pTab->nFlags |= SvLBoxTabFlags::PUSHABLE|SvLBoxTabFlags::ADJUST_CENTER|SvLBoxTabFlags::FORCE;
     377             :     }
     378           0 :     if( aTabs.size() > 2 )
     379             :     {
     380           0 :         SvLBoxTab* pTab = aTabs[2];
     381           0 :         pTab->nFlags &= ~nAdjust;
     382           0 :         pTab->nFlags |= SvLBoxTabFlags::PUSHABLE|SvLBoxTabFlags::ADJUST_CENTER|SvLBoxTabFlags::FORCE;
     383             :     }
     384           0 : }
     385             : 
     386           0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::HBarClick()
     387             : {
     388             :     // sorting is stopped by this override
     389           0 : }
     390             : 
     391           0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::SetCheckButtonState(
     392             :                             SvTreeListEntry* pEntry, sal_uInt16 nCol, SvButtonState eState)
     393             : {
     394           0 :     SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1));
     395             : 
     396             :     DBG_ASSERT(pItem,"SetCheckButton:Item not found");
     397           0 :     if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON)
     398             :     {
     399           0 :         switch( eState )
     400             :         {
     401             :             case SV_BUTTON_CHECKED:
     402           0 :                 pItem->SetStateChecked();
     403           0 :                 break;
     404             : 
     405             :             case SV_BUTTON_UNCHECKED:
     406           0 :                 pItem->SetStateUnchecked();
     407           0 :                 break;
     408             : 
     409             :             case SV_BUTTON_TRISTATE:
     410           0 :                 pItem->SetStateTristate();
     411           0 :                 break;
     412             :         }
     413           0 :         InvalidateEntry( pEntry );
     414             :     }
     415           0 : }
     416             : 
     417           0 : SvButtonState OfaMSFilterTabPage2::MSFltrSimpleTable::GetCheckButtonState(
     418             :                                     SvTreeListEntry* pEntry, sal_uInt16 nCol )
     419             : {
     420           0 :     SvButtonState eState = SV_BUTTON_UNCHECKED;
     421           0 :     SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetItem(nCol + 1));
     422             :     DBG_ASSERT(pItem,"GetChButnState:Item not found");
     423             : 
     424           0 :     if (pItem->GetType() == SV_ITEM_ID_LBOXBUTTON)
     425             :     {
     426           0 :         SvItemStateFlags nButtonFlags = pItem->GetButtonFlags();
     427           0 :         eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags );
     428             :     }
     429             : 
     430           0 :     return eState;
     431             : }
     432             : 
     433           0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, bool bChecked)
     434             : {
     435           0 :     if ( nPos < GetEntryCount() )
     436             :         SetCheckButtonState(
     437             :             GetEntry(nPos),
     438             :             nCol,
     439             :             bChecked ? SvButtonState( SV_BUTTON_CHECKED ) :
     440           0 :                                        SvButtonState( SV_BUTTON_UNCHECKED ) );
     441           0 : }
     442             : 
     443           0 : void OfaMSFilterTabPage2::MSFltrSimpleTable::KeyInput( const KeyEvent& rKEvt )
     444             : {
     445           0 :     if(!rKEvt.GetKeyCode().GetModifier() &&
     446           0 :         KEY_SPACE == rKEvt.GetKeyCode().GetCode())
     447             :     {
     448           0 :         sal_uLong nSelPos = GetModel()->GetAbsPos(GetCurEntry());
     449           0 :         sal_uInt16 nCol = GetCurrentTabPos() - 1;
     450           0 :         if ( nCol < 2 )
     451             :         {
     452           0 :             SvTreeListEntry* pEntry = GetEntry( nSelPos );
     453           0 :             bool bIsChecked = ( GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED );
     454           0 :             CheckEntryPos( nSelPos, nCol, !bIsChecked );
     455           0 :             CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, static_cast<void*>(pEntry) );
     456             :         }
     457             :         else
     458             :         {
     459           0 :             sal_uInt16 nCheck = GetCheckButtonState( GetEntry(nSelPos), 1 ) == SV_BUTTON_CHECKED ? 1 : 0;
     460           0 :             if(GetCheckButtonState( GetEntry(nSelPos), 0 ))
     461           0 :                 nCheck += 2;
     462           0 :             nCheck--;
     463           0 :             nCheck &= 3;
     464           0 :             CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1));
     465           0 :             CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2));
     466             :         }
     467             :     }
     468             :     else
     469           0 :         SvSimpleTable::KeyInput(rKEvt);
     470           0 : }
     471             : 
     472             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11