LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofsdrpage.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 212 254 83.5 %
Date: 2015-06-13 12:38:46 Functions: 49 63 77.8 %
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 <sdr/contact/viewcontactofsdrpage.hxx>
      21             : #include <svx/sdr/contact/viewobjectcontact.hxx>
      22             : #include <svx/svdpage.hxx>
      23             : #include <svx/sdr/contact/displayinfo.hxx>
      24             : #include <sdr/contact/viewobjectcontactofsdrpage.hxx>
      25             : #include <basegfx/polygon/b2dpolygontools.hxx>
      26             : #include <basegfx/matrix/b2dhommatrix.hxx>
      27             : #include <svx/svdpagv.hxx>
      28             : #include <svx/svdview.hxx>
      29             : #include <vcl/svapp.hxx>
      30             : #include <svx/sdr/contact/objectcontact.hxx>
      31             : #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
      32             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      33             : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
      34             : #include <basegfx/polygon/b2dpolygon.hxx>
      35             : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
      36             : #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
      37             : #include <vcl/lazydelete.hxx>
      38             : #include <vcl/settings.hxx>
      39             : #include <svx/svdstr.hrc>
      40             : #include <svdglob.hxx>
      41             : #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
      42             : #include <drawinglayer/attribute/sdrfillattribute.hxx>
      43             : 
      44             : namespace sdr { namespace contact {
      45             : 
      46       70356 : ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
      47       70356 : :   mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
      48             : {
      49       70356 : }
      50             : 
      51       69564 : ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
      52             : {
      53       69564 : }
      54             : 
      55           0 : ViewContact* ViewContactOfPageSubObject::GetParentContact() const
      56             : {
      57           0 :     return &mrParentViewContactOfSdrPage;
      58             : }
      59             : 
      60      125448 : const SdrPage& ViewContactOfPageSubObject::getPage() const
      61             : {
      62      125448 :     return mrParentViewContactOfSdrPage.GetSdrPage();
      63             : }
      64             : 
      65        2843 : ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
      66             : {
      67        2843 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
      68             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
      69             : 
      70        2843 :     return *pRetval;
      71             : }
      72             : 
      73         418 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
      74             : {
      75             :     // We have only the page information, not the view information. Use the
      76             :     // svtools::DOCCOLOR color for initialisation
      77         418 :     const svtools::ColorConfig aColorConfig;
      78         418 :     const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
      79         836 :     const basegfx::BColor aRGBColor(aInitColor.getBColor());
      80             :     const drawinglayer::primitive2d::Primitive2DReference xReference(
      81         836 :         new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
      82             : 
      83         836 :     return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
      84             : }
      85             : 
      86        6396 : ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
      87        6396 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
      88             : {
      89        6396 : }
      90             : 
      91        6324 : ViewContactOfPageBackground::~ViewContactOfPageBackground()
      92             : {
      93        6324 : }
      94             : 
      95        2843 : ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
      96             : {
      97        2843 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
      98             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
      99             : 
     100        2843 :     return *pRetval;
     101             : }
     102             : 
     103        1663 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
     104             : {
     105             :     static bool bUseOldPageShadow(false);
     106        1663 :     const SdrPage& rPage = getPage();
     107        1663 :     basegfx::B2DHomMatrix aPageMatrix;
     108        1663 :     aPageMatrix.set(0, 0, (double)rPage.GetWdt());
     109        1663 :     aPageMatrix.set(1, 1, (double)rPage.GetHgt());
     110             : 
     111        1663 :     if(bUseOldPageShadow)
     112             :     {
     113             :         // create page shadow polygon
     114           0 :         const double fPageBorderFactor(1.0 / 256.0);
     115           0 :         basegfx::B2DPolygon aPageShadowPolygon;
     116           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
     117           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
     118           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
     119           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
     120           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
     121           0 :         aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
     122           0 :         aPageShadowPolygon.setClosed(true);
     123           0 :         aPageShadowPolygon.transform(aPageMatrix);
     124             : 
     125             :         // We have only the page information, not the view information. Use the
     126             :         // svtools::FONTCOLOR color for initialisation
     127           0 :         const svtools::ColorConfig aColorConfig;
     128           0 :         const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
     129           0 :         const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
     130             :         const drawinglayer::primitive2d::Primitive2DReference xReference(
     131             :             new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
     132             :                 basegfx::B2DPolyPolygon(aPageShadowPolygon),
     133           0 :                 aRGBShadowColor));
     134             : 
     135           0 :         return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     136             :     }
     137             :     else
     138             :     {
     139             :         static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(
     140             :             new drawinglayer::primitive2d::DiscreteShadow(
     141             :                 BitmapEx(
     142             :                     ResId(
     143             :                         SIP_SA_PAGESHADOW35X35,
     144        1663 :                         *ImpGetResMgr()))));
     145             : 
     146        1663 :         if(aDiscreteShadow.get())
     147             :         {
     148             :             const drawinglayer::primitive2d::Primitive2DReference xReference(
     149             :                 new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
     150             :                     aPageMatrix,
     151        1663 :                     *aDiscreteShadow.get()));
     152             : 
     153        1663 :             return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     154             :         }
     155             : 
     156           0 :         return drawinglayer::primitive2d::Primitive2DSequence();
     157        1663 :     }
     158             : }
     159             : 
     160        6396 : ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     161        6396 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     162             : {
     163        6396 : }
     164             : 
     165        6324 : ViewContactOfPageShadow::~ViewContactOfPageShadow()
     166             : {
     167        6324 : }
     168             : 
     169        2571 : ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     170             : {
     171        2571 :     ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
     172             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     173             : 
     174        2571 :     return *pRetval;
     175             : }
     176             : 
     177        1019 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
     178             : {
     179        1019 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     180             : 
     181             :     // this class is used when the page is a MasterPage and is responsible to
     182             :     // create a visualisation for the MPBGO, if exists. This needs to be suppressed
     183             :     // when a SdrPage which uses a MasterPage creates it's output. Suppression
     184             :     // is done in the corresponding VOC since DisplayInfo data is needed
     185        1019 :     const SdrPage& rPage = getPage();
     186             : 
     187        1019 :     if(rPage.IsMasterPage())
     188             :     {
     189         166 :         if(0 == rPage.GetPageNum())
     190             :         {
     191             :             // #i98063#
     192             :             // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
     193             :             // MasterPage, but has no MPBGO, so there is nothing to do here.
     194             :         }
     195             :         else
     196             :         {
     197         166 :             drawinglayer::attribute::SdrFillAttribute aFill;
     198             : 
     199             :             // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
     200             :             // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
     201             :             // MasterPages should have a StyleSheet excactly for this reason, but historically
     202             :             // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
     203         166 :             if(rPage.getSdrPageProperties().GetStyleSheet())
     204             :             {
     205             :                 // create page fill attributes with correct properties
     206         332 :                 aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
     207         332 :                     rPage.getSdrPageProperties().GetItemSet());
     208             :             }
     209             : 
     210         166 :             if(!aFill.isDefault())
     211             :             {
     212             :                 // direct model data is the page size, get and use it
     213             :                 const basegfx::B2DRange aInnerRange(
     214           0 :                     rPage.GetLftBorder(), rPage.GetUppBorder(),
     215           0 :                     rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
     216           0 :                 const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
     217             :                 const drawinglayer::primitive2d::Primitive2DReference xReference(
     218             :                     drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
     219             :                         basegfx::B2DPolyPolygon(aInnerPolgon),
     220             :                         aFill,
     221           0 :                         drawinglayer::attribute::FillGradientAttribute()));
     222             : 
     223           0 :                 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     224         166 :             }
     225             :         }
     226             :     }
     227             : 
     228        1019 :     return xRetval;
     229             : }
     230             : 
     231        6396 : ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     232        6396 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     233             : {
     234        6396 : }
     235             : 
     236        6324 : ViewContactOfMasterPage::~ViewContactOfMasterPage()
     237             : {
     238        6324 : }
     239             : 
     240        2843 : ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     241             : {
     242        2843 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
     243             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     244             : 
     245        2843 :     return *pRetval;
     246             : }
     247             : 
     248         418 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
     249             : {
     250         418 :     const SdrPage& rPage = getPage();
     251         418 :     const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
     252         418 :     const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
     253             : 
     254             :     // We have only the page information, not the view information. Use the
     255             :     // svtools::DOCCOLOR color for initialisation
     256         836 :     const svtools::ColorConfig aColorConfig;
     257         418 :     const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
     258             : 
     259             :     // create and add primitive
     260         836 :     const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
     261         836 :     const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
     262             : 
     263         836 :     return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     264             : }
     265             : 
     266        6396 : ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     267        6396 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     268             : {
     269        6396 : }
     270             : 
     271        6324 : ViewContactOfPageFill::~ViewContactOfPageFill()
     272             : {
     273        6324 : }
     274             : 
     275        2843 : ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     276             : {
     277        2843 :     ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
     278             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     279             : 
     280        2843 :     return *pRetval;
     281             : }
     282             : 
     283        2510 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
     284             : {
     285        2510 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     286        2510 :     const SdrPage& rPage = getPage();
     287        2510 :     const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
     288             : 
     289             :     // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
     290             :     // Added old case as fallback for HighContrast.
     291        5020 :     basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
     292             : 
     293        2510 :     if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     294             :     {
     295           0 :         const svtools::ColorConfig aColorConfig;
     296           0 :         const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
     297             : 
     298           0 :         aRGBBorderColor = aBorderColor.getBColor();
     299             :     }
     300             : 
     301        2510 :     if(rPage.getPageBorderOnlyLeftRight())
     302             :     {
     303             :         // #i93597# for Report Designer, the page border shall be only displayed right and left,
     304             :         // but not top and bottom. Create simplified geometry.
     305           0 :         basegfx::B2DPolygon aLeft, aRight;
     306             : 
     307           0 :         aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
     308           0 :         aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
     309             : 
     310           0 :         aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
     311           0 :         aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
     312             : 
     313           0 :         xRetval.realloc(2);
     314           0 :         xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
     315           0 :         xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
     316             :     }
     317             :     else
     318             :     {
     319        2510 :         xRetval.realloc(1);
     320        2510 :         const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
     321        2510 :         xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
     322             :     }
     323             : 
     324        5020 :     return xRetval;
     325             : }
     326             : 
     327        6396 : ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     328        6396 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     329             : {
     330        6396 : }
     331             : 
     332        6324 : ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
     333             : {
     334        6324 : }
     335             : 
     336        2843 : ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     337             : {
     338        2843 :     ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
     339             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     340             : 
     341        2843 :     return *pRetval;
     342             : }
     343             : 
     344        1619 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
     345             : {
     346        1619 :     const SdrPage& rPage = getPage();
     347             :     const basegfx::B2DRange aPageBorderRange(
     348        3238 :         (double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
     349        4857 :         (double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
     350        1619 :     const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
     351             : 
     352             :     // We have only the page information, not the view information. Use the
     353             :     // svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
     354        3238 :     const svtools::ColorConfig aColorConfig;
     355        1619 :     Color aBorderColor;
     356             : 
     357        1619 :     if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     358             :     {
     359           0 :         aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
     360             :     }
     361             :     else
     362             :     {
     363        1619 :         aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
     364             :     }
     365             : 
     366             :     // create page outer border primitive
     367        3238 :     const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
     368        3238 :     const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
     369             : 
     370        3238 :     return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     371             : }
     372             : 
     373        6396 : ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     374        6396 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     375             : {
     376        6396 : }
     377             : 
     378        6324 : ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
     379             : {
     380        6324 : }
     381             : 
     382        2843 : ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     383             : {
     384        2843 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
     385             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     386             : 
     387        2843 :     return *pRetval;
     388             : }
     389             : 
     390         418 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
     391             : {
     392             :     // collect sub-hierarchy
     393         418 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     394         418 :     const sal_uInt32 nObjectCount(GetObjectCount());
     395             : 
     396             :     // collect all sub-primitives
     397        2594 :     for(sal_uInt32 a(0); a < nObjectCount; a++)
     398             :     {
     399        2176 :         const ViewContact& rCandidate(GetViewContact(a));
     400        2176 :         const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
     401             : 
     402        2176 :         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
     403        2176 :     }
     404             : 
     405         418 :     return xRetval;
     406             : }
     407             : 
     408        6396 : ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
     409        6396 : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
     410             : {
     411        6396 : }
     412             : 
     413        6324 : ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
     414             : {
     415        6324 : }
     416             : 
     417       62371 : sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
     418             : {
     419       62371 :     return getPage().GetObjCount();
     420             : }
     421             : 
     422       52919 : ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
     423             : {
     424       52919 :     SdrObject* pObj = getPage().GetObj(nIndex);
     425             :     assert(pObj && "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
     426       52919 :     return pObj->GetViewContact();
     427             : }
     428             : 
     429        5686 : ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     430             : {
     431        5686 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
     432             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     433             : 
     434        5686 :     return *pRetval;
     435             : }
     436             : 
     437           0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
     438             : {
     439             :     // We have only the page information, not the view information and thus no grid settings. Create empty
     440             :     // default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
     441           0 :     return drawinglayer::primitive2d::Primitive2DSequence();
     442             : }
     443             : 
     444       12792 : ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
     445             : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
     446       12792 :     mbFront(bFront)
     447             : {
     448       12792 : }
     449             : 
     450       12648 : ViewContactOfGrid::~ViewContactOfGrid()
     451             : {
     452       12648 : }
     453             : 
     454        5686 : ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     455             : {
     456        5686 :     ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
     457             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     458             : 
     459        5686 :     return *pRetval;
     460             : }
     461             : 
     462           0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
     463             : {
     464             :     // We have only the page information, not the view information and thus no helplines. Create empty
     465             :     // default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
     466           0 :     return drawinglayer::primitive2d::Primitive2DSequence();
     467             : }
     468             : 
     469       12792 : ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
     470             : :   ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
     471       12792 :     mbFront(bFront)
     472             : {
     473       12792 : }
     474             : 
     475       12648 : ViewContactOfHelplines::~ViewContactOfHelplines()
     476             : {
     477       12648 : }
     478             : 
     479             : // Create a Object-Specific ViewObjectContact, set ViewContact and
     480             : // ObjectContact. Always needs to return something.
     481        2843 : ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
     482             : {
     483        2843 :     ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
     484             :     DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
     485             : 
     486        2843 :     return *pRetval;
     487             : }
     488             : 
     489        6396 : ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
     490             : :   ViewContact(),
     491             :     mrPage(rPage),
     492             :     maViewContactOfPageBackground(*this),
     493             :     maViewContactOfPageShadow(*this),
     494             :     maViewContactOfPageFill(*this),
     495             :     maViewContactOfMasterPage(*this),
     496             :     maViewContactOfOuterPageBorder(*this),
     497             :     maViewContactOfInnerPageBorder(*this),
     498             :     maViewContactOfGridBack(*this, false),
     499             :     maViewContactOfHelplinesBack(*this, false),
     500             :     maViewContactOfPageHierarchy(*this),
     501             :     maViewContactOfGridFront(*this, true),
     502        6396 :     maViewContactOfHelplinesFront(*this, true)
     503             : {
     504        6396 : }
     505             : 
     506       12648 : ViewContactOfSdrPage::~ViewContactOfSdrPage()
     507             : {
     508       12648 : }
     509             : 
     510             : // Access to possible sub-hierarchy
     511      126547 : sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
     512             : {
     513             :     // Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
     514             :     // then - depending on if the page has a MasterPage - either MasterPage Hierarchy
     515             :     // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
     516             :     // (for front and back) which internally are visible or not depending on the current
     517             :     // front/back setting for those.
     518      126547 :     return 11;
     519             : }
     520             : 
     521      482438 : ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
     522             : {
     523      482438 :     switch(nIndex)
     524             :     {
     525       43858 :         case 0: return (ViewContact&)maViewContactOfPageBackground;
     526       43858 :         case 1: return (ViewContact&)maViewContactOfPageShadow;
     527       43858 :         case 2: return (ViewContact&)maViewContactOfPageFill;
     528             :         case 3:
     529             :         {
     530       43858 :             const SdrPage& rPage = GetSdrPage();
     531             : 
     532       43858 :             if(rPage.TRG_HasMasterPage())
     533             :             {
     534        2084 :                 return rPage.TRG_GetMasterPageDescriptorViewContact();
     535             :             }
     536             :             else
     537             :             {
     538       41774 :                 return (ViewContact&)maViewContactOfMasterPage;
     539             :             }
     540             :         }
     541       43858 :         case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
     542       43858 :         case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
     543       43858 :         case 6: return (ViewContact&)maViewContactOfGridBack;
     544       43858 :         case 7: return (ViewContact&)maViewContactOfHelplinesBack;
     545       43858 :         case 8: return (ViewContact&)maViewContactOfPageHierarchy;
     546       43858 :         case 9: return (ViewContact&)maViewContactOfGridFront;
     547       43858 :         case 10: case 11: return (ViewContact&)maViewContactOfHelplinesFront;
     548           0 :         default: assert(false);return (ViewContact&)maViewContactOfHelplinesFront;
     549             :     }
     550             : }
     551             : 
     552             : // React on changes of the object of this ViewContact
     553       25730 : void ViewContactOfSdrPage::ActionChanged()
     554             : {
     555             :     // call parent
     556       25730 :     ViewContact::ActionChanged();
     557             : 
     558             :     // apply to local viewContacts, they all rely on page information. Exception
     559             :     // is the sub hierarchy; this will not be influenced by the change
     560       25730 :     maViewContactOfPageBackground.ActionChanged();
     561       25730 :     maViewContactOfPageShadow.ActionChanged();
     562       25730 :     maViewContactOfPageFill.ActionChanged();
     563             : 
     564       25730 :     const SdrPage& rPage = GetSdrPage();
     565             : 
     566       25730 :     if(rPage.TRG_HasMasterPage())
     567             :     {
     568        5856 :         rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
     569             :     }
     570       19874 :     else if(rPage.IsMasterPage())
     571             :     {
     572        5357 :         maViewContactOfMasterPage.ActionChanged();
     573             :     }
     574             : 
     575       25730 :     maViewContactOfOuterPageBorder.ActionChanged();
     576       25730 :     maViewContactOfInnerPageBorder.ActionChanged();
     577       25730 :     maViewContactOfGridBack.ActionChanged();
     578       25730 :     maViewContactOfHelplinesBack.ActionChanged();
     579       25730 :     maViewContactOfGridFront.ActionChanged();
     580       25730 :     maViewContactOfHelplinesFront.ActionChanged();
     581       25730 : }
     582             : 
     583             : // override for acessing the SdrPage
     584           0 : SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
     585             : {
     586           0 :     return &GetSdrPage();
     587             : }
     588             : 
     589         418 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
     590             : {
     591         418 :     drawinglayer::primitive2d::Primitive2DSequence xRetval;
     592             : 
     593             :     // collect all sub-sequences including sub hierarchy.
     594         418 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
     595         418 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
     596         418 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
     597             : 
     598         418 :     const SdrPage& rPage = GetSdrPage();
     599             : 
     600         418 :     if(rPage.TRG_HasMasterPage())
     601             :     {
     602             :         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
     603          54 :             rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
     604             :     }
     605         364 :     else if(rPage.IsMasterPage())
     606             :     {
     607             :         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
     608          63 :             maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
     609             :     }
     610             : 
     611         418 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
     612         418 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
     613         418 :     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageHierarchy.getViewIndependentPrimitive2DSequence());
     614             : 
     615             :     // Only add front versions of grid and helplines since no visibility test is done,
     616             :     // so adding the back incarnations is not necessary. This makes the Front
     617             :     // visualisation the default when no visibility tests are done.
     618             : 
     619             :     // Since we have no view here, no grid and helpline definitions are available currently. The used
     620             :     // methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
     621             :     // do not need to be called ATM. This may change later if grid or helpline info gets
     622             :     // model data (it should not). Keeping the lines commented to hold this hint.
     623             : 
     624             :     // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
     625             :     // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
     626             : 
     627         418 :     return xRetval;
     628             : }
     629             : 
     630         435 : }}
     631             : 
     632             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11