LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - tbxalign.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 32 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/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           0 : 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( "alignmentbar" )
      46           0 :     ,   m_aSubTbResName( "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, std::exception)
      86             : {
      87             :     // We control a sub-toolbar therefor, we have to return true.
      88           0 :     return sal_True;
      89             : }
      90             : 
      91           0 : OUString SAL_CALL SvxTbxCtlAlign::getSubToolbarName() throw (::com::sun::star::uno::RuntimeException, std::exception)
      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 OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     100             : {
     101             :     // remember the new command
     102           0 :     m_aCommand = aCommand;
     103             : 
     104             :     // Our sub-toolbar wants to execute a function.
     105             :     // We have to change the image of our toolbar button to reflect the new function.
     106           0 :     updateImage();
     107           0 : }
     108             : 
     109           0 : void SAL_CALL SvxTbxCtlAlign::updateImage() throw (::com::sun::star::uno::RuntimeException, std::exception)
     110             : {
     111             :     // We should update the button image of our parent (toolbar). Use the stored
     112             :     // command to set the correct current image.
     113           0 :     SolarMutexGuard aGuard;
     114           0 :     if ( !m_aCommand.isEmpty() )
     115             :     {
     116           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
     117           0 :         Image aImage = GetImage( xFrame, m_aCommand, hasBigImages() );
     118           0 :         if ( !!aImage )
     119           0 :             GetToolBox().SetItemImage( GetId(), aImage );
     120           0 :     }
     121           0 : }
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10