LCOV - code coverage report
Current view: top level - basctl/source/basicide - tbxctl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 66 0.0 %
Date: 2014-04-14 Functions: 0 9 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 <svl/solar.hrc>
      21             : #include <svx/svxids.hrc>
      22             : 
      23             : #include "idetemp.hxx"
      24             : #include "tbxctl.hxx"
      25             : 
      26             : #include <sfx2/dispatch.hxx>
      27             : #include <sfx2/imagemgr.hxx>
      28             : #include <sfx2/viewfrm.hxx>
      29             : #include <svl/aeitem.hxx>
      30             : #include <vcl/toolbox.hxx>
      31             : 
      32             : namespace basctl
      33             : {
      34             : 
      35             : using namespace ::com::sun::star::uno;
      36             : 
      37             : namespace
      38             : {
      39           0 :     OUString aSubToolBarResName( "private:resource/toolbar/insertcontrolsbar" );
      40             : }
      41             : 
      42           0 : SFX_IMPL_TOOLBOX_CONTROL( TbxControls, SfxAllEnumItem )
      43             : 
      44             : /*************************************************************************
      45             : |*
      46             : |* Toolbox Class
      47             : |*
      48             : \************************************************************************/
      49             : 
      50           0 : TbxControls::TbxControls( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      51           0 :         SfxToolBoxControl( nSlotId, nId, rTbx )
      52             : {
      53           0 :     nLastSlot = USHRT_MAX;
      54             : 
      55           0 :     rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
      56           0 :     rTbx.Invalidate();
      57           0 : }
      58             : 
      59             : /*************************************************************************
      60             : |*
      61             : |* If you want to create a pop-up window
      62             : |*
      63             : \************************************************************************/
      64           0 : SfxPopupWindowType TbxControls::GetPopupWindowType() const
      65             : {
      66           0 :     if( nLastSlot == USHRT_MAX )
      67           0 :         return(SFX_POPUPWINDOW_ONCLICK);
      68           0 :     return(SFX_POPUPWINDOW_ONTIMEOUT);
      69             : }
      70             : 
      71           0 : void TbxControls::StateChanged( sal_uInt16 nSID, SfxItemState eState,
      72             :   const SfxPoolItem* pState )
      73             : {
      74           0 :     if( pState )
      75             :     {
      76           0 :         if (SfxAllEnumItem const* pItem = dynamic_cast<SfxAllEnumItem const*>(pState))
      77             :         {
      78           0 :             sal_uInt16 nTemp = 0;
      79           0 :             sal_uInt16 nLastEnum = pItem->GetValue();
      80           0 :             switch (nLastEnum)
      81             :             {
      82           0 :                 case SVX_SNAP_PUSHBUTTON:       nTemp = SID_INSERT_PUSHBUTTON; break;
      83           0 :                 case SVX_SNAP_CHECKBOX:         nTemp = SID_INSERT_CHECKBOX; break;
      84           0 :                 case SVX_SNAP_RADIOBUTTON:      nTemp = SID_INSERT_RADIOBUTTON; break;
      85           0 :                 case SVX_SNAP_SPINBUTTON:       nTemp = SID_INSERT_SPINBUTTON; break;
      86           0 :                 case SVX_SNAP_FIXEDTEXT:        nTemp = SID_INSERT_FIXEDTEXT; break;
      87           0 :                 case SVX_SNAP_GROUPBOX:         nTemp = SID_INSERT_GROUPBOX; break;
      88           0 :                 case SVX_SNAP_LISTBOX:          nTemp = SID_INSERT_LISTBOX; break;
      89           0 :                 case SVX_SNAP_COMBOBOX:         nTemp = SID_INSERT_COMBOBOX; break;
      90           0 :                 case SVX_SNAP_EDIT:             nTemp = SID_INSERT_EDIT; break;
      91           0 :                 case SVX_SNAP_HSCROLLBAR:       nTemp = SID_INSERT_HSCROLLBAR; break;
      92           0 :                 case SVX_SNAP_VSCROLLBAR:       nTemp = SID_INSERT_VSCROLLBAR; break;
      93           0 :                 case SVX_SNAP_PREVIEW:          nTemp = SID_INSERT_PREVIEW; break;
      94           0 :                 case SVX_SNAP_URLBUTTON:        nTemp = SID_INSERT_URLBUTTON; break;
      95           0 :                 case SVX_SNAP_IMAGECONTROL:     nTemp = SID_INSERT_IMAGECONTROL; break;
      96           0 :                 case SVX_SNAP_PROGRESSBAR:      nTemp = SID_INSERT_PROGRESSBAR; break;
      97           0 :                 case SVX_SNAP_HFIXEDLINE:       nTemp = SID_INSERT_HFIXEDLINE; break;
      98           0 :                 case SVX_SNAP_VFIXEDLINE:       nTemp = SID_INSERT_VFIXEDLINE; break;
      99           0 :                 case SVX_SNAP_DATEFIELD:        nTemp = SID_INSERT_DATEFIELD; break;
     100           0 :                 case SVX_SNAP_TIMEFIELD:        nTemp = SID_INSERT_TIMEFIELD; break;
     101           0 :                 case SVX_SNAP_NUMERICFIELD:     nTemp = SID_INSERT_NUMERICFIELD; break;
     102           0 :                 case SVX_SNAP_CURRENCYFIELD:    nTemp = SID_INSERT_CURRENCYFIELD; break;
     103           0 :                 case SVX_SNAP_FORMATTEDFIELD:   nTemp = SID_INSERT_FORMATTEDFIELD; break;
     104           0 :                 case SVX_SNAP_PATTERNFIELD:     nTemp = SID_INSERT_PATTERNFIELD; break;
     105           0 :                 case SVX_SNAP_FILECONTROL:      nTemp = SID_INSERT_FILECONTROL; break;
     106           0 :                 case SVX_SNAP_TREECONTROL:      nTemp = SID_INSERT_TREECONTROL; break;
     107             :             }
     108           0 :             if( nTemp )
     109             :             {
     110           0 :                 OUString aSlotURL( "slot:" );
     111           0 :                 aSlotURL += OUString::number( nTemp);
     112             :                 Image aImage = GetImage( m_xFrame,
     113             :                                          aSlotURL,
     114           0 :                                          hasBigImages()
     115           0 :                                        );
     116           0 :                 ToolBox& rBox = GetToolBox();
     117           0 :                 rBox.SetItemImage(GetId(), aImage);
     118           0 :                 nLastSlot = nLastEnum;
     119             :             }
     120             :         }
     121             :     }
     122           0 :     SfxToolBoxControl::StateChanged( nSID, eState,pState );
     123           0 : }
     124             : 
     125           0 : void TbxControls::Select( sal_uInt16 nModifier )
     126             : {
     127             :     (void)nModifier;
     128           0 :     SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS, nLastSlot );
     129           0 :     SfxViewFrame* pCurFrame = SfxViewFrame::Current();
     130             :     DBG_ASSERT( pCurFrame != NULL, "No current view frame!" );
     131           0 :     SfxDispatcher* pDispatcher = pCurFrame ? pCurFrame->GetDispatcher() : NULL;
     132           0 :     if( pDispatcher )
     133             :     {
     134           0 :         pDispatcher->Execute( SID_CHOOSE_CONTROLS, SFX_CALLMODE_SYNCHRON, &aItem, 0L );
     135           0 :     }
     136           0 : }
     137             : 
     138             : /*************************************************************************
     139             : |*
     140             : |* the window is created here
     141             : |* position of the toolbox can be requested with GetToolBox()
     142             : |* rItemRect are the screen coordinates
     143             : |*
     144             : \************************************************************************/
     145           0 : SfxPopupWindow* TbxControls::CreatePopupWindow()
     146             : {
     147           0 :     if ( GetSlotId() == SID_CHOOSE_CONTROLS )
     148           0 :         createAndPositionSubToolBar( aSubToolBarResName );
     149             : 
     150           0 :     return(0);
     151             : }
     152             : 
     153             : 
     154           0 : } // namespace basctl
     155             : 
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10