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

Generated by: LCOV version 1.10