LCOV - code coverage report
Current view: top level - basctl/source/basicide - tbxctl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 66 0.0 %
Date: 2012-08-25 Functions: 0 9 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

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

Generated by: LCOV version 1.10