LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/slidesorter/model - SlsPageDescriptor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 105 0.0 %
Date: 2012-12-27 Functions: 0 16 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 "model/SlsPageDescriptor.hxx"
      22             : 
      23             : #include "sdpage.hxx"
      24             : #include "drawdoc.hxx"
      25             : 
      26             : #include <svx/svdopage.hxx>
      27             : #include <svx/svdpagv.hxx>
      28             : #include <svx/sdr/contact/viewcontact.hxx>
      29             : #include <svx/sdr/contact/viewobjectcontact.hxx>
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star;
      33             : 
      34             : namespace sd {  namespace slidesorter { namespace model {
      35             : 
      36             : 
      37           0 : PageDescriptor::PageDescriptor (
      38             :     const Reference<drawing::XDrawPage>& rxPage,
      39             :     SdPage* pPage,
      40             :     const sal_Int32 nIndex)
      41             :     : mpPage(pPage),
      42             :       mxPage(rxPage),
      43             :       mpMasterPage(NULL),
      44             :       mnIndex(nIndex),
      45             :       maBoundingBox(),
      46             :       maVisualState(nIndex),
      47             :       mbIsSelected(false),
      48             :       mbWasSelected(false),
      49             :       mbIsVisible(false),
      50             :       mbIsFocused(false),
      51             :       mbIsCurrent(false),
      52             :       mbIsMouseOver(false),
      53           0 :       mbHasTransition(false)
      54             : {
      55             :     OSL_ASSERT(mpPage);
      56             :     OSL_ASSERT(mpPage == SdPage::getImplementation(rxPage));
      57           0 :     if (mpPage != NULL)
      58             :     {
      59           0 :         if (mpPage->TRG_HasMasterPage())
      60           0 :             mpMasterPage = &mpPage->TRG_GetMasterPage();
      61           0 :         if (mpPage->getTransitionType() > 0)
      62           0 :             mbHasTransition = true;
      63             :     }
      64           0 : }
      65             : 
      66             : 
      67             : 
      68             : 
      69           0 : PageDescriptor::~PageDescriptor (void)
      70             : {
      71           0 : }
      72             : 
      73             : 
      74             : 
      75             : 
      76           0 : SdPage* PageDescriptor::GetPage (void) const
      77             : {
      78           0 :     return mpPage;
      79             : }
      80             : 
      81             : 
      82             : 
      83             : 
      84           0 : Reference<drawing::XDrawPage> PageDescriptor::GetXDrawPage (void) const
      85             : {
      86           0 :     return mxPage;
      87             : }
      88             : 
      89             : 
      90             : 
      91             : 
      92           0 : sal_Int32 PageDescriptor::GetPageIndex (void) const
      93             : {
      94           0 :     return mnIndex;
      95             : }
      96             : 
      97             : 
      98             : 
      99             : 
     100           0 : void PageDescriptor::SetPageIndex (const sal_Int32 nNewIndex)
     101             : {
     102           0 :     mnIndex = nNewIndex;
     103           0 :     maVisualState.mnPageId = nNewIndex;
     104           0 : }
     105             : 
     106             : 
     107             : 
     108             : 
     109           0 : bool PageDescriptor::UpdateMasterPage (void)
     110             : {
     111           0 :     const SdrPage* pMaster = NULL;
     112           0 :     if (mpPage!=NULL && mpPage->TRG_HasMasterPage())
     113           0 :         pMaster = &mpPage->TRG_GetMasterPage();
     114           0 :     if (mpMasterPage != pMaster)
     115             :     {
     116           0 :         mpMasterPage = pMaster;
     117           0 :         return true;
     118             :     }
     119             :     else
     120           0 :         return false;
     121             : }
     122             : 
     123             : 
     124             : 
     125             : 
     126           0 : bool PageDescriptor::UpdateTransitionFlag (void)
     127             : {
     128           0 :     bool bHasSlideTransition (false);
     129           0 :     if (mpPage != NULL)
     130           0 :         bHasSlideTransition = mpPage->getTransitionType() > 0;
     131           0 :     if (bHasSlideTransition != mbHasTransition)
     132             :     {
     133           0 :         mbHasTransition = bHasSlideTransition;
     134           0 :         return true;
     135             :     }
     136             :     else
     137           0 :         return false;
     138             : }
     139             : 
     140             : 
     141             : 
     142             : 
     143           0 : bool PageDescriptor::HasState (const State eState) const
     144             : {
     145           0 :     switch (eState)
     146             :     {
     147             :         case ST_Visible:
     148           0 :             return mbIsVisible;
     149             : 
     150             :         case ST_Selected:
     151           0 :             return mbIsSelected;
     152             : 
     153             :         case ST_WasSelected:
     154           0 :             return mbWasSelected;
     155             : 
     156             :         case ST_Focused:
     157           0 :             return mbIsFocused;
     158             : 
     159             :         case ST_MouseOver:
     160           0 :             return mbIsMouseOver;
     161             : 
     162             :         case ST_Current:
     163           0 :             return mbIsCurrent;
     164             : 
     165             :         case ST_Excluded:
     166           0 :             return mpPage!=NULL && mpPage->IsExcluded();
     167             : 
     168             :         default:
     169             :             OSL_ASSERT(false);
     170           0 :             return false;
     171             :     }
     172             : }
     173             : 
     174             : 
     175             : 
     176             : 
     177           0 : bool PageDescriptor::SetState (const State eState, const bool bNewStateValue)
     178             : {
     179           0 :     bool bModified (false);
     180           0 :     switch (eState)
     181             :     {
     182             :         case ST_Visible:
     183           0 :             bModified = (bNewStateValue!=mbIsVisible);
     184           0 :             if (bModified)
     185           0 :                 mbIsVisible = bNewStateValue;
     186           0 :             break;
     187             : 
     188             :         case ST_Selected:
     189           0 :             bModified = (bNewStateValue!=mbIsSelected);
     190           0 :             if (bModified)
     191           0 :                 mbIsSelected = bNewStateValue;
     192           0 :             break;
     193             : 
     194             :         case ST_WasSelected:
     195           0 :             bModified = (bNewStateValue!=mbWasSelected);
     196           0 :             if (bModified)
     197           0 :                 mbWasSelected = bNewStateValue;
     198           0 :             break;
     199             : 
     200             :         case ST_Focused:
     201           0 :             bModified = (bNewStateValue!=mbIsFocused);
     202           0 :             if (bModified)
     203           0 :                 mbIsFocused = bNewStateValue;
     204           0 :             break;
     205             : 
     206             :         case ST_MouseOver:
     207           0 :             bModified = (bNewStateValue!=mbIsMouseOver);
     208           0 :             if (bModified)
     209           0 :                 mbIsMouseOver = bNewStateValue;
     210           0 :             break;
     211             : 
     212             :         case ST_Current:
     213           0 :             bModified = (bNewStateValue!=mbIsCurrent);
     214           0 :             if (bModified)
     215           0 :                 mbIsCurrent = bNewStateValue;
     216           0 :             break;
     217             : 
     218             :         case ST_Excluded:
     219             :             // This is a state of the page and has to be handled differently
     220             :             // from the view-only states.
     221           0 :             if (mpPage != NULL)
     222           0 :                 if (bNewStateValue != (mpPage->IsExcluded()==sal_True))
     223             :                 {
     224           0 :                     mpPage->SetExcluded(bNewStateValue);
     225           0 :                     bModified = true;
     226             :                 }
     227           0 :             break;
     228             :     }
     229             : 
     230           0 :     if (bModified)
     231           0 :         maVisualState.UpdateVisualState(*this);
     232           0 :     return bModified;
     233             : }
     234             : 
     235             : 
     236             : 
     237             : 
     238           0 : VisualState& PageDescriptor::GetVisualState (void)
     239             : {
     240           0 :     return maVisualState;
     241             : }
     242             : 
     243             : 
     244             : 
     245             : 
     246           0 : bool PageDescriptor::GetCoreSelection (void)
     247             : {
     248           0 :     if (mpPage!=NULL && (mpPage->IsSelected()==sal_True) != mbIsSelected)
     249           0 :         return SetState(ST_Selected, !mbIsSelected);
     250             :     else
     251           0 :         return false;
     252             : }
     253             : 
     254             : 
     255             : 
     256             : 
     257           0 : void PageDescriptor::SetCoreSelection (void)
     258             : {
     259           0 :     if (mpPage != NULL)
     260           0 :         if (HasState(ST_Selected))
     261           0 :             mpPage->SetSelected(sal_True);
     262             :         else
     263           0 :             mpPage->SetSelected(sal_False);
     264             :     else
     265             :     {
     266             :         OSL_ASSERT(mpPage!=NULL);
     267             :     }
     268           0 : }
     269             : 
     270             : 
     271             : 
     272             : 
     273           0 : Rectangle PageDescriptor::GetBoundingBox (void) const
     274             : {
     275           0 :     Rectangle aBox (maBoundingBox);
     276           0 :     const Point aOffset (maVisualState.GetLocationOffset());
     277           0 :     aBox.Move(aOffset.X(), aOffset.Y());
     278           0 :     return aBox;
     279             : }
     280             : 
     281             : 
     282             : 
     283             : 
     284           0 : Point PageDescriptor::GetLocation (const bool bIgnoreOffset) const
     285             : {
     286           0 :     if (bIgnoreOffset)
     287           0 :         return maBoundingBox.TopLeft();
     288             :     else
     289           0 :         return maBoundingBox.TopLeft() + maVisualState.GetLocationOffset();
     290             : }
     291             : 
     292             : 
     293             : 
     294             : 
     295           0 : void PageDescriptor::SetBoundingBox (const Rectangle& rBoundingBox)
     296             : {
     297           0 :     maBoundingBox = rBoundingBox;
     298           0 : }
     299             : 
     300             : 
     301             : 
     302             : } } } // end of namespace ::sd::slidesorter::model
     303             : 
     304             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10