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

Generated by: LCOV version 1.10