LCOV - code coverage report
Current view: top level - svx/source/svdraw - sdrmasterpagedescriptor.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 42 0.0 %
Date: 2014-04-14 Functions: 0 10 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 <svx/sdrmasterpagedescriptor.hxx>
      21             : #include <svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx>
      22             : #include <svx/svdpage.hxx>
      23             : 
      24             : // #i42075#
      25             : #include <svx/svdobj.hxx>
      26             : #include <svx/xfillit0.hxx>
      27             : #include <svl/itemset.hxx>
      28             : 
      29             : 
      30             : 
      31             : namespace sdr
      32             : {
      33             :     // ViewContact part
      34           0 :     sdr::contact::ViewContact* MasterPageDescriptor::CreateObjectSpecificViewContact()
      35             :     {
      36           0 :         return new sdr::contact::ViewContactOfMasterPageDescriptor(*this);
      37             :     }
      38             : 
      39           0 :     MasterPageDescriptor::MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage)
      40             :     :   maOwnerPage(aOwnerPage),
      41             :         maUsedPage(aUsedPage),
      42           0 :         mpViewContact(0L)
      43             :     {
      44             :         // all layers visible
      45           0 :         maVisibleLayers.SetAll();
      46             : 
      47             :         // register at used page
      48           0 :         maUsedPage.AddPageUser(*this);
      49           0 :     }
      50             : 
      51           0 :     MasterPageDescriptor::~MasterPageDescriptor()
      52             :     {
      53             :         // de-register at used page
      54           0 :         maUsedPage.RemovePageUser(*this);
      55             : 
      56           0 :         if(mpViewContact)
      57             :         {
      58           0 :             delete mpViewContact;
      59           0 :             mpViewContact = 0L;
      60             :         }
      61           0 :     }
      62             : 
      63             :     // ViewContact part
      64           0 :     sdr::contact::ViewContact& MasterPageDescriptor::GetViewContact() const
      65             :     {
      66           0 :         if(!mpViewContact)
      67             :         {
      68             :             const_cast< MasterPageDescriptor* >(this)->mpViewContact =
      69           0 :                 const_cast< MasterPageDescriptor* >(this)->CreateObjectSpecificViewContact();
      70             :         }
      71             : 
      72           0 :         return *mpViewContact;
      73             :     }
      74             : 
      75             :     // this method is called form the destructor of the referenced page.
      76             :     // do all necessary action to forget the page. It is not necessary to call
      77             :     // RemovePageUser(), that is done form the destructor.
      78           0 :     void MasterPageDescriptor::PageInDestruction(const SdrPage& /*rPage*/)
      79             :     {
      80           0 :         maOwnerPage.TRG_ClearMasterPage();
      81           0 :     }
      82             : 
      83           0 :     void MasterPageDescriptor::SetVisibleLayers(const SetOfByte& rNew)
      84             :     {
      85           0 :         if(rNew != maVisibleLayers)
      86             :         {
      87           0 :             maVisibleLayers = rNew;
      88           0 :             GetViewContact().ActionChanged();
      89             :         }
      90           0 :     }
      91             : 
      92             :     // operators
      93           0 :     bool MasterPageDescriptor::operator==(const MasterPageDescriptor& rCandidate) const
      94             :     {
      95           0 :         return (&maOwnerPage == &rCandidate.maOwnerPage
      96           0 :             && &maUsedPage == &rCandidate.maUsedPage
      97           0 :             && maVisibleLayers == rCandidate.maVisibleLayers);
      98             :     }
      99             : 
     100           0 :     bool MasterPageDescriptor::operator!=(const MasterPageDescriptor& rCandidate) const
     101             :     {
     102           0 :         return (&maOwnerPage != &rCandidate.maOwnerPage
     103           0 :             || &maUsedPage != &rCandidate.maUsedPage
     104           0 :             || maVisibleLayers != rCandidate.maVisibleLayers);
     105             :     }
     106             : 
     107           0 :     const SdrPageProperties* MasterPageDescriptor::getCorrectSdrPageProperties() const
     108             :     {
     109           0 :         const SdrPage* pCorrectPage = &GetOwnerPage();
     110           0 :         const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties();
     111             : 
     112           0 :         if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
     113             :         {
     114           0 :             pCorrectPage = &GetUsedPage();
     115           0 :             pCorrectProperties = &pCorrectPage->getSdrPageProperties();
     116             :         }
     117             : 
     118           0 :         if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet())
     119             :         {
     120             :             // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
     121             :             // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
     122             :             // MasterPages should have a StyleSheet excactly for this reason, but historically
     123             :             // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
     124           0 :             pCorrectProperties = 0;
     125             :         }
     126             : 
     127           0 :         return pCorrectProperties;
     128             :     }
     129             : } // end of namespace sdr
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10