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

Generated by: LCOV version 1.11