LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/framework/module - SlideSorterModule.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 57 0.0 %
Date: 2012-12-27 Functions: 0 6 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             : 
      21             : #include "SlideSorterModule.hxx"
      22             : 
      23             : #include "framework/FrameworkHelper.hxx"
      24             : #include <com/sun/star/drawing/framework/XTabBar.hpp>
      25             : #include <com/sun/star/drawing/framework/TabBarButton.hpp>
      26             : 
      27             : #include "strings.hrc"
      28             : #include "sdresid.hxx"
      29             : #include "svtools/slidesorterbaropt.hxx"
      30             : 
      31             : using namespace ::com::sun::star;
      32             : using namespace ::com::sun::star::uno;
      33             : using namespace ::com::sun::star::drawing::framework;
      34             : 
      35             : using ::rtl::OUString;
      36             : using ::sd::framework::FrameworkHelper;
      37             : 
      38             : 
      39             : namespace sd { namespace framework {
      40             : 
      41             : 
      42             : //===== SlideSorterModule ==================================================
      43             : 
      44           0 : SlideSorterModule::SlideSorterModule (
      45             :     const Reference<frame::XController>& rxController,
      46             :     const OUString& rsLeftPaneURL)
      47             :     : ResourceManager(rxController,
      48             :         FrameworkHelper::CreateResourceId(FrameworkHelper::msSlideSorterURL, rsLeftPaneURL)),
      49             :       mxViewTabBarId(FrameworkHelper::CreateResourceId(
      50             :           FrameworkHelper::msViewTabBarURL,
      51             :           FrameworkHelper::msCenterPaneURL)),
      52           0 :       mxControllerManager(rxController,UNO_QUERY)
      53             : {
      54           0 :     if (mxConfigurationController.is())
      55             :     {
      56           0 :         UpdateViewTabBar(NULL);
      57             : 
      58           0 :         if (SvtSlideSorterBarOptions().GetVisibleImpressView()==sal_True)
      59           0 :             AddActiveMainView(FrameworkHelper::msImpressViewURL);
      60           0 :         if (SvtSlideSorterBarOptions().GetVisibleOutlineView()==sal_True)
      61           0 :             AddActiveMainView(FrameworkHelper::msOutlineViewURL);
      62           0 :         if (SvtSlideSorterBarOptions().GetVisibleNotesView()==sal_True)
      63           0 :             AddActiveMainView(FrameworkHelper::msNotesViewURL);
      64           0 :         if (SvtSlideSorterBarOptions().GetVisibleHandoutView()==sal_True)
      65           0 :             AddActiveMainView(FrameworkHelper::msHandoutViewURL);
      66           0 :         if (SvtSlideSorterBarOptions().GetVisibleSlideSorterView()==sal_True)
      67           0 :             AddActiveMainView(FrameworkHelper::msSlideSorterURL);
      68           0 :         if (SvtSlideSorterBarOptions().GetVisibleDrawView()==sal_True)
      69           0 :             AddActiveMainView(FrameworkHelper::msDrawViewURL);
      70             : 
      71           0 :         mxConfigurationController->addConfigurationChangeListener(
      72             :             this,
      73             :             FrameworkHelper::msResourceActivationEvent,
      74           0 :             Any());
      75             :     }
      76           0 : }
      77             : 
      78             : 
      79             : 
      80             : 
      81           0 : SlideSorterModule::~SlideSorterModule (void)
      82             : {
      83           0 : }
      84             : 
      85           0 : void SlideSorterModule::SaveResourceState (void)
      86             : {
      87           0 :     SvtSlideSorterBarOptions().SetVisibleImpressView(IsResourceActive(FrameworkHelper::msImpressViewURL));
      88           0 :     SvtSlideSorterBarOptions().SetVisibleOutlineView(IsResourceActive(FrameworkHelper::msOutlineViewURL));
      89           0 :     SvtSlideSorterBarOptions().SetVisibleNotesView(IsResourceActive(FrameworkHelper::msNotesViewURL));
      90           0 :     SvtSlideSorterBarOptions().SetVisibleHandoutView(IsResourceActive(FrameworkHelper::msHandoutViewURL));
      91           0 :     SvtSlideSorterBarOptions().SetVisibleSlideSorterView(IsResourceActive(FrameworkHelper::msSlideSorterURL));
      92           0 :     SvtSlideSorterBarOptions().SetVisibleDrawView(IsResourceActive(FrameworkHelper::msDrawViewURL));
      93           0 : }
      94             : 
      95             : 
      96           0 : void SAL_CALL SlideSorterModule::notifyConfigurationChange (
      97             :     const ConfigurationChangeEvent& rEvent)
      98             :     throw (RuntimeException)
      99             : {
     100           0 :     if (rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent))
     101             :     {
     102           0 :         if (rEvent.ResourceId->compareTo(mxViewTabBarId) == 0)
     103             :         {
     104             :             // Update the view tab bar because the view tab bar has just
     105             :             // become active.
     106           0 :             UpdateViewTabBar(Reference<XTabBar>(rEvent.ResourceObject,UNO_QUERY));
     107             :         }
     108           0 :         else if (rEvent.ResourceId->getResourceTypePrefix().equals(
     109           0 :             FrameworkHelper::msViewURLPrefix)
     110           0 :             && rEvent.ResourceId->isBoundTo(
     111             :                 FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL),
     112           0 :                 AnchorBindingMode_DIRECT))
     113             :         {
     114             :             // Update the view tab bar because the view in the center pane
     115             :             // has changed.
     116           0 :             UpdateViewTabBar(NULL);
     117             :         }
     118             :     }
     119             :     else
     120             :     {
     121           0 :         ResourceManager::notifyConfigurationChange(rEvent);
     122             :     }
     123           0 : }
     124             : 
     125           0 : void SlideSorterModule::UpdateViewTabBar (const Reference<XTabBar>& rxTabBar)
     126             : {
     127           0 :     if ( ! mxControllerManager.is())
     128           0 :         return;
     129             : 
     130           0 :     Reference<XTabBar> xBar (rxTabBar);
     131           0 :     if ( ! xBar.is())
     132             :     {
     133             :         Reference<XConfigurationController> xCC (
     134           0 :             mxControllerManager->getConfigurationController());
     135           0 :         if (xCC.is())
     136           0 :             xBar = Reference<XTabBar>(xCC->getResource(mxViewTabBarId), UNO_QUERY);
     137             :     }
     138             : 
     139           0 :     if (xBar.is())
     140             :     {
     141           0 :         TabBarButton aButtonA;
     142             :         aButtonA.ResourceId = FrameworkHelper::CreateResourceId(
     143             :             FrameworkHelper::msSlideSorterURL,
     144           0 :             FrameworkHelper::msCenterPaneURL);
     145           0 :         aButtonA.ButtonLabel = String(SdResId(STR_SLIDE_MODE));
     146             : 
     147           0 :         TabBarButton aButtonB;
     148             :         aButtonB.ResourceId = FrameworkHelper::CreateResourceId(
     149             :             FrameworkHelper::msHandoutViewURL,
     150           0 :             FrameworkHelper::msCenterPaneURL);
     151             : 
     152           0 :         if ( ! xBar->hasTabBarButton(aButtonA))
     153           0 :             xBar->addTabBarButtonAfter(aButtonA, aButtonB);
     154           0 :     }
     155             : }
     156             : 
     157             : 
     158             : 
     159             : } } // end of namespace sd::framework
     160             : 
     161             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10