LCOV - code coverage report
Current view: top level - libreoffice/svx/source/tbxctrls - tbxalign.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 38 2.6 %
Date: 2012-12-27 Functions: 1 9 11.1 %
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/aeitem.hxx>
      21             : 
      22             : #include <svx/dialmgr.hxx>
      23             : #include <svx/dialogs.hrc>
      24             : 
      25             : #include "svx/tbxalign.hxx"
      26             : #include "svx/tbxdraw.hxx"
      27             : #include <tools/shl.hxx>
      28             : #include <sfx2/imagemgr.hxx>
      29             : #include <vcl/svapp.hxx>
      30             : #include <osl/mutex.hxx>
      31             : 
      32             : #include <sfx2/app.hxx>
      33             : #include <vcl/toolbox.hxx>
      34             : 
      35          15 : SFX_IMPL_TOOLBOX_CONTROL(SvxTbxCtlAlign, SfxAllEnumItem);
      36             : 
      37             : /*************************************************************************
      38             : |*
      39             : |* Klasse fuer SwToolbox
      40             : |*
      41             : \************************************************************************/
      42             : 
      43           0 : SvxTbxCtlAlign::SvxTbxCtlAlign( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      44             :     SfxToolBoxControl( nSlotId, nId, rTbx )
      45             :     ,   m_aSubTbName( RTL_CONSTASCII_USTRINGPARAM( "alignmentbar" ))
      46           0 :     ,   m_aSubTbResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/alignmentbar" ))
      47             : {
      48           0 :     rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
      49           0 :     rTbx.Invalidate();
      50             : 
      51           0 :     m_aCommand = m_aCommandURL;
      52           0 : }
      53             : 
      54             : /*************************************************************************
      55             : |*
      56             : |* Wenn man ein PopupWindow erzeugen will
      57             : |*
      58             : \************************************************************************/
      59             : 
      60           0 : SfxPopupWindowType SvxTbxCtlAlign::GetPopupWindowType() const
      61             : {
      62           0 :     return(SFX_POPUPWINDOW_ONCLICK);
      63             : }
      64             : 
      65             : /*************************************************************************
      66             : |*
      67             : |* Hier wird das Fenster erzeugt
      68             : |* Lage der Toolbox mit GetToolBox() abfragbar
      69             : |* rItemRect sind die Screen-Koordinaten
      70             : |*
      71             : \************************************************************************/
      72             : 
      73           0 : SfxPopupWindow* SvxTbxCtlAlign::CreatePopupWindow()
      74             : {
      75           0 :     SolarMutexGuard aGuard;
      76           0 :     if ( GetSlotId() == SID_OBJECT_ALIGN )
      77           0 :         createAndPositionSubToolBar( m_aSubTbResName );
      78           0 :     return NULL;
      79             : }
      80             : 
      81             : //========================================================================
      82             : // XSubToolbarController
      83             : //========================================================================
      84             : 
      85           0 : ::sal_Bool SAL_CALL SvxTbxCtlAlign::opensSubToolbar() throw (::com::sun::star::uno::RuntimeException)
      86             : {
      87             :     // We control a sub-toolbar therefor, we have to return true.
      88           0 :     return sal_True;
      89             : }
      90             : 
      91           0 : ::rtl::OUString SAL_CALL SvxTbxCtlAlign::getSubToolbarName() throw (::com::sun::star::uno::RuntimeException)
      92             : {
      93             :     // Provide the controlled sub-toolbar name, so we are notified whenever
      94             :     // this toolbar executes a function.
      95           0 :     SolarMutexGuard aGuard;
      96           0 :     return m_aSubTbName;
      97             : }
      98             : 
      99           0 : void SAL_CALL SvxTbxCtlAlign::functionSelected( const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException)
     100             : {
     101             :     // Our sub-toolbar wants to executes a function. We have to change
     102             :     // the image of our toolbar button to reflect the new function.
     103           0 :     SolarMutexGuard aGuard;
     104           0 :     if ( !m_bDisposed )
     105             :     {
     106           0 :         if ( !aCommand.isEmpty() )
     107             :         {
     108           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
     109           0 :             Image aImage = GetImage( xFrame, aCommand, hasBigImages() );
     110           0 :             if ( !!aImage )
     111           0 :                 GetToolBox().SetItemImage( GetId(), aImage );
     112             :         }
     113           0 :     }
     114           0 : }
     115             : 
     116           0 : void SAL_CALL SvxTbxCtlAlign::updateImage() throw (::com::sun::star::uno::RuntimeException)
     117             : {
     118             :     // We should update the button image of our parent (toolbar). Use the stored
     119             :     // command to set the correct current image.
     120           0 :     SolarMutexGuard aGuard;
     121           0 :     if ( !m_aCommand.isEmpty() )
     122             :     {
     123           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
     124           0 :         Image aImage = GetImage( xFrame, m_aCommand, hasBigImages() );
     125           0 :         if ( !!aImage )
     126           0 :             GetToolBox().SetItemImage( GetId(), aImage );
     127           0 :     }
     128           0 : }
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10