1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx> 28cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx> 29cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofsdrpage.hxx> 30cdf0e10cSrcweir #include <svx/svdview.hxx> 31cdf0e10cSrcweir #include <svx/svdpage.hxx> 32cdf0e10cSrcweir #include <svx/sdr/contact/objectcontact.hxx> 33cdf0e10cSrcweir #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx> 34cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx> 35cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> 36cdf0e10cSrcweir #include <drawinglayer/primitive2d/gridprimitive2d.hxx> 37cdf0e10cSrcweir #include <drawinglayer/primitive2d/helplineprimitive2d.hxx> 38cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx> 39cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrprimitivetools.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 42cdf0e10cSrcweir 43cdf0e10cSrcweir using namespace com::sun::star; 44cdf0e10cSrcweir 45cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace sdr 48cdf0e10cSrcweir { 49cdf0e10cSrcweir namespace contact 50cdf0e10cSrcweir { getPage() const51cdf0e10cSrcweir const SdrPage& ViewObjectContactOfPageSubObject::getPage() const 52cdf0e10cSrcweir { 53cdf0e10cSrcweir return static_cast< ViewContactOfPageSubObject& >(GetViewContact()).getPage(); 54cdf0e10cSrcweir } 55cdf0e10cSrcweir ViewObjectContactOfPageSubObject(ObjectContact & rObjectContact,ViewContact & rViewContact)56cdf0e10cSrcweir ViewObjectContactOfPageSubObject::ViewObjectContactOfPageSubObject(ObjectContact& rObjectContact, ViewContact& rViewContact) 57cdf0e10cSrcweir : ViewObjectContact(rObjectContact, rViewContact) 58cdf0e10cSrcweir { 59cdf0e10cSrcweir } 60cdf0e10cSrcweir ~ViewObjectContactOfPageSubObject()61cdf0e10cSrcweir ViewObjectContactOfPageSubObject::~ViewObjectContactOfPageSubObject() 62cdf0e10cSrcweir { 63cdf0e10cSrcweir } 64cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const65cdf0e10cSrcweir bool ViewObjectContactOfPageSubObject::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 66cdf0e10cSrcweir { 67cdf0e10cSrcweir if(rDisplayInfo.GetSubContentActive()) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir return false; 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir if(rDisplayInfo.GetControlLayerProcessingActive()) 73cdf0e10cSrcweir { 74cdf0e10cSrcweir return false; 75cdf0e10cSrcweir } 76cdf0e10cSrcweir 77cdf0e10cSrcweir if(!rDisplayInfo.GetPageProcessingActive()) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir return false; 80cdf0e10cSrcweir } 81cdf0e10cSrcweir 82cdf0e10cSrcweir if(GetObjectContact().isOutputToPrinter()) 83cdf0e10cSrcweir { 84cdf0e10cSrcweir return false; 85cdf0e10cSrcweir } 86cdf0e10cSrcweir 87cdf0e10cSrcweir if(!GetObjectContact().TryToGetSdrPageView()) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir return false; 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir return true; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir isPrimitiveGhosted(const DisplayInfo &) const95cdf0e10cSrcweir bool ViewObjectContactOfPageSubObject::isPrimitiveGhosted(const DisplayInfo& /*rDisplayInfo*/) const 96cdf0e10cSrcweir { 97cdf0e10cSrcweir // suppress ghosted for page parts 98cdf0e10cSrcweir return false; 99cdf0e10cSrcweir } 100cdf0e10cSrcweir } // end of namespace contact 101cdf0e10cSrcweir } // end of namespace sdr 102cdf0e10cSrcweir 103cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 104cdf0e10cSrcweir 105cdf0e10cSrcweir namespace sdr 106cdf0e10cSrcweir { 107cdf0e10cSrcweir namespace contact 108cdf0e10cSrcweir { ViewObjectContactOfPageBackground(ObjectContact & rObjectContact,ViewContact & rViewContact)109cdf0e10cSrcweir ViewObjectContactOfPageBackground::ViewObjectContactOfPageBackground(ObjectContact& rObjectContact, ViewContact& rViewContact) 110cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir } 113cdf0e10cSrcweir ~ViewObjectContactOfPageBackground()114cdf0e10cSrcweir ViewObjectContactOfPageBackground::~ViewObjectContactOfPageBackground() 115cdf0e10cSrcweir { 116cdf0e10cSrcweir } 117cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const118cdf0e10cSrcweir bool ViewObjectContactOfPageBackground::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 119cdf0e10cSrcweir { 120cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir return false; 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir // no page background for preview renderers 126cdf0e10cSrcweir if(GetObjectContact().IsPreviewRenderer()) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir return false; 129cdf0e10cSrcweir } 130cdf0e10cSrcweir 131cdf0e10cSrcweir return true; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir createPrimitive2DSequence(const DisplayInfo &) const134cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageBackground::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const 135cdf0e10cSrcweir { 136cdf0e10cSrcweir // Initialize background. Dependent of IsPageVisible, use ApplicationBackgroundColor or ApplicationDocumentColor. Most 137cdf0e10cSrcweir // old renderers for export (html, pdf, gallery, ...) set the page to not visible (SetPageVisible(false)). They expect the 138cdf0e10cSrcweir // given OutputDevice to be initialized with the ApplicationDocumentColor then. 139cdf0e10cSrcweir const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); 140cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence xRetval; 141cdf0e10cSrcweir 142cdf0e10cSrcweir if(pPageView) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir const SdrView& rView = pPageView->GetView(); 145cdf0e10cSrcweir Color aInitColor; 146cdf0e10cSrcweir 147cdf0e10cSrcweir if(rView.IsPageVisible()) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir aInitColor = pPageView->GetApplicationBackgroundColor(); 150cdf0e10cSrcweir } 151cdf0e10cSrcweir else 152cdf0e10cSrcweir { 153cdf0e10cSrcweir aInitColor = pPageView->GetApplicationDocumentColor(); 154cdf0e10cSrcweir 155cdf0e10cSrcweir if(Color(COL_AUTO) == aInitColor) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir const svtools::ColorConfig aColorConfig; 158cdf0e10cSrcweir aInitColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor; 159cdf0e10cSrcweir } 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir // init background with InitColor 163cdf0e10cSrcweir xRetval.realloc(1); 164cdf0e10cSrcweir const basegfx::BColor aRGBColor(aInitColor.getBColor()); 165cdf0e10cSrcweir xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir 168cdf0e10cSrcweir return xRetval; 169cdf0e10cSrcweir } 170cdf0e10cSrcweir } // end of namespace contact 171cdf0e10cSrcweir } // end of namespace sdr 172cdf0e10cSrcweir 173cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 174cdf0e10cSrcweir 175cdf0e10cSrcweir namespace sdr 176cdf0e10cSrcweir { 177cdf0e10cSrcweir namespace contact 178cdf0e10cSrcweir { ViewObjectContactOfMasterPage(ObjectContact & rObjectContact,ViewContact & rViewContact)179cdf0e10cSrcweir ViewObjectContactOfMasterPage::ViewObjectContactOfMasterPage(ObjectContact& rObjectContact, ViewContact& rViewContact) 180cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir } 183cdf0e10cSrcweir ~ViewObjectContactOfMasterPage()184cdf0e10cSrcweir ViewObjectContactOfMasterPage::~ViewObjectContactOfMasterPage() 185cdf0e10cSrcweir { 186cdf0e10cSrcweir } 187cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const188cdf0e10cSrcweir bool ViewObjectContactOfMasterPage::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 189cdf0e10cSrcweir { 190cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir return false; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir // this object is only used for MasterPages. When not the MasterPage is 196cdf0e10cSrcweir // displayed as a page, but another page is using it as sub-object, the 197cdf0e10cSrcweir // geometry needs to be hidden 198cdf0e10cSrcweir if(rDisplayInfo.GetSubContentActive()) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir return false; 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir return true; 204cdf0e10cSrcweir } 205cdf0e10cSrcweir } // end of namespace contact 206cdf0e10cSrcweir } // end of namespace sdr 207cdf0e10cSrcweir 208cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 209cdf0e10cSrcweir 210cdf0e10cSrcweir namespace sdr 211cdf0e10cSrcweir { 212cdf0e10cSrcweir namespace contact 213cdf0e10cSrcweir { ViewObjectContactOfPageFill(ObjectContact & rObjectContact,ViewContact & rViewContact)214cdf0e10cSrcweir ViewObjectContactOfPageFill::ViewObjectContactOfPageFill(ObjectContact& rObjectContact, ViewContact& rViewContact) 215cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir } 218cdf0e10cSrcweir ~ViewObjectContactOfPageFill()219cdf0e10cSrcweir ViewObjectContactOfPageFill::~ViewObjectContactOfPageFill() 220cdf0e10cSrcweir { 221cdf0e10cSrcweir } 222cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const223cdf0e10cSrcweir bool ViewObjectContactOfPageFill::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 224cdf0e10cSrcweir { 225cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir return false; 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); 231cdf0e10cSrcweir 232cdf0e10cSrcweir if(!pSdrPageView) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir return false; 235cdf0e10cSrcweir } 236cdf0e10cSrcweir 237cdf0e10cSrcweir if(!pSdrPageView->GetView().IsPageVisible()) 238cdf0e10cSrcweir { 239cdf0e10cSrcweir return false; 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir return true; 243cdf0e10cSrcweir } 244cdf0e10cSrcweir createPrimitive2DSequence(const DisplayInfo &) const245cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageFill::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const 246cdf0e10cSrcweir { 247cdf0e10cSrcweir const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); 248cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence xRetval; 249cdf0e10cSrcweir 250cdf0e10cSrcweir if(pPageView) 251cdf0e10cSrcweir { 252cdf0e10cSrcweir const SdrPage& rPage = getPage(); 253cdf0e10cSrcweir 254cdf0e10cSrcweir const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt()); 255cdf0e10cSrcweir const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange)); 256cdf0e10cSrcweir Color aPageFillColor; 257cdf0e10cSrcweir 258cdf0e10cSrcweir if(pPageView->GetApplicationDocumentColor() != COL_AUTO) 259cdf0e10cSrcweir { 260cdf0e10cSrcweir aPageFillColor = pPageView->GetApplicationDocumentColor(); 261cdf0e10cSrcweir } 262cdf0e10cSrcweir else 263cdf0e10cSrcweir { 264cdf0e10cSrcweir const svtools::ColorConfig aColorConfig; 265cdf0e10cSrcweir aPageFillColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor; 266cdf0e10cSrcweir } 267cdf0e10cSrcweir 268cdf0e10cSrcweir // create and add primitive 269cdf0e10cSrcweir xRetval.realloc(1); 270cdf0e10cSrcweir const basegfx::BColor aRGBColor(aPageFillColor.getBColor()); 271cdf0e10cSrcweir xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor)); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir 274cdf0e10cSrcweir return xRetval; 275cdf0e10cSrcweir } 276cdf0e10cSrcweir } // end of namespace contact 277cdf0e10cSrcweir } // end of namespace sdr 278cdf0e10cSrcweir 279cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 280cdf0e10cSrcweir 281cdf0e10cSrcweir namespace sdr 282cdf0e10cSrcweir { 283cdf0e10cSrcweir namespace contact 284cdf0e10cSrcweir { ViewObjectContactOfPageShadow(ObjectContact & rObjectContact,ViewContact & rViewContact)285cdf0e10cSrcweir ViewObjectContactOfPageShadow::ViewObjectContactOfPageShadow(ObjectContact& rObjectContact, ViewContact& rViewContact) 286cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir } 289cdf0e10cSrcweir ~ViewObjectContactOfPageShadow()290cdf0e10cSrcweir ViewObjectContactOfPageShadow::~ViewObjectContactOfPageShadow() 291cdf0e10cSrcweir { 292cdf0e10cSrcweir } 293cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const294cdf0e10cSrcweir bool ViewObjectContactOfPageShadow::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 295cdf0e10cSrcweir { 296cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir return false; 299cdf0e10cSrcweir } 300cdf0e10cSrcweir 301cdf0e10cSrcweir SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); 302cdf0e10cSrcweir 303cdf0e10cSrcweir if(!pSdrPageView) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir return false; 306cdf0e10cSrcweir } 307cdf0e10cSrcweir 308cdf0e10cSrcweir if(!pSdrPageView->GetView().IsPageVisible()) 309cdf0e10cSrcweir { 310cdf0e10cSrcweir return false; 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir // no page shadow for preview renderers 314cdf0e10cSrcweir if(GetObjectContact().IsPreviewRenderer()) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir return false; 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir // no page shadow for high contrast mode 320cdf0e10cSrcweir if(GetObjectContact().isDrawModeHighContrast()) 321cdf0e10cSrcweir { 322cdf0e10cSrcweir return false; 323cdf0e10cSrcweir } 324cdf0e10cSrcweir 325cdf0e10cSrcweir return true; 326cdf0e10cSrcweir } 327cdf0e10cSrcweir } // end of namespace contact 328cdf0e10cSrcweir } // end of namespace sdr 329cdf0e10cSrcweir 330cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 331cdf0e10cSrcweir 332cdf0e10cSrcweir namespace sdr 333cdf0e10cSrcweir { 334cdf0e10cSrcweir namespace contact 335cdf0e10cSrcweir { ViewObjectContactOfOuterPageBorder(ObjectContact & rObjectContact,ViewContact & rViewContact)336cdf0e10cSrcweir ViewObjectContactOfOuterPageBorder::ViewObjectContactOfOuterPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact) 337cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir } 340cdf0e10cSrcweir ~ViewObjectContactOfOuterPageBorder()341cdf0e10cSrcweir ViewObjectContactOfOuterPageBorder::~ViewObjectContactOfOuterPageBorder() 342cdf0e10cSrcweir { 343cdf0e10cSrcweir } 344cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const345cdf0e10cSrcweir bool ViewObjectContactOfOuterPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 346cdf0e10cSrcweir { 347cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir return false; 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); 353cdf0e10cSrcweir 354cdf0e10cSrcweir if(!pSdrPageView) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir return false; 357cdf0e10cSrcweir } 358cdf0e10cSrcweir 359cdf0e10cSrcweir const SdrView& rView = pSdrPageView->GetView(); 360cdf0e10cSrcweir 361cdf0e10cSrcweir if(!rView.IsPageVisible() && rView.IsPageBorderVisible()) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir return false; 364cdf0e10cSrcweir } 365cdf0e10cSrcweir 366cdf0e10cSrcweir return true; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir } // end of namespace contact 369cdf0e10cSrcweir } // end of namespace sdr 370cdf0e10cSrcweir 371cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 372cdf0e10cSrcweir 373cdf0e10cSrcweir namespace sdr 374cdf0e10cSrcweir { 375cdf0e10cSrcweir namespace contact 376cdf0e10cSrcweir { ViewObjectContactOfInnerPageBorder(ObjectContact & rObjectContact,ViewContact & rViewContact)377cdf0e10cSrcweir ViewObjectContactOfInnerPageBorder::ViewObjectContactOfInnerPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact) 378cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 379cdf0e10cSrcweir { 380cdf0e10cSrcweir } 381cdf0e10cSrcweir ~ViewObjectContactOfInnerPageBorder()382cdf0e10cSrcweir ViewObjectContactOfInnerPageBorder::~ViewObjectContactOfInnerPageBorder() 383cdf0e10cSrcweir { 384cdf0e10cSrcweir } 385cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const386cdf0e10cSrcweir bool ViewObjectContactOfInnerPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 387cdf0e10cSrcweir { 388cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 389cdf0e10cSrcweir { 390cdf0e10cSrcweir return false; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); 394cdf0e10cSrcweir 395cdf0e10cSrcweir if(!pSdrPageView) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir return false; 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir if(!pSdrPageView->GetView().IsBordVisible()) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir return false; 403cdf0e10cSrcweir } 404cdf0e10cSrcweir 405cdf0e10cSrcweir const SdrPage& rPage = getPage(); 406cdf0e10cSrcweir 407cdf0e10cSrcweir if(!rPage.GetLftBorder() && !rPage.GetUppBorder() && !rPage.GetRgtBorder() && !rPage.GetLwrBorder()) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir return false; 410cdf0e10cSrcweir } 411cdf0e10cSrcweir 412cdf0e10cSrcweir // no inner page border for preview renderers 413cdf0e10cSrcweir if(GetObjectContact().IsPreviewRenderer()) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir return false; 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir return true; 419cdf0e10cSrcweir } 420cdf0e10cSrcweir } // end of namespace contact 421cdf0e10cSrcweir } // end of namespace sdr 422cdf0e10cSrcweir 423cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 424cdf0e10cSrcweir 425cdf0e10cSrcweir namespace sdr 426cdf0e10cSrcweir { 427cdf0e10cSrcweir namespace contact 428cdf0e10cSrcweir { ViewObjectContactOfPageHierarchy(ObjectContact & rObjectContact,ViewContact & rViewContact)429cdf0e10cSrcweir ViewObjectContactOfPageHierarchy::ViewObjectContactOfPageHierarchy(ObjectContact& rObjectContact, ViewContact& rViewContact) 430cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir } 433cdf0e10cSrcweir ~ViewObjectContactOfPageHierarchy()434cdf0e10cSrcweir ViewObjectContactOfPageHierarchy::~ViewObjectContactOfPageHierarchy() 435cdf0e10cSrcweir { 436cdf0e10cSrcweir } 437cdf0e10cSrcweir getPrimitive2DSequenceHierarchy(DisplayInfo & rDisplayInfo) const438cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const 439cdf0e10cSrcweir { 440cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence xRetval; 441cdf0e10cSrcweir 442cdf0e10cSrcweir // process local sub-hierarchy 443cdf0e10cSrcweir const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); 444cdf0e10cSrcweir 445cdf0e10cSrcweir if(nSubHierarchyCount) 446cdf0e10cSrcweir { 447cdf0e10cSrcweir xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo); 448cdf0e10cSrcweir 449cdf0e10cSrcweir if(xRetval.hasElements()) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir // get ranges 452cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); 453cdf0e10cSrcweir const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D)); 454cdf0e10cSrcweir const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); 455cdf0e10cSrcweir 456cdf0e10cSrcweir // check geometrical visibility 457cdf0e10cSrcweir if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir // not visible, release 460cdf0e10cSrcweir xRetval.realloc(0); 461cdf0e10cSrcweir } 462cdf0e10cSrcweir } 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir return xRetval; 466cdf0e10cSrcweir } 467cdf0e10cSrcweir } // end of namespace contact 468cdf0e10cSrcweir } // end of namespace sdr 469cdf0e10cSrcweir 470cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 471cdf0e10cSrcweir 472cdf0e10cSrcweir namespace sdr 473cdf0e10cSrcweir { 474cdf0e10cSrcweir namespace contact 475cdf0e10cSrcweir { ViewObjectContactOfPageGrid(ObjectContact & rObjectContact,ViewContact & rViewContact)476cdf0e10cSrcweir ViewObjectContactOfPageGrid::ViewObjectContactOfPageGrid(ObjectContact& rObjectContact, ViewContact& rViewContact) 477cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir } 480cdf0e10cSrcweir ~ViewObjectContactOfPageGrid()481cdf0e10cSrcweir ViewObjectContactOfPageGrid::~ViewObjectContactOfPageGrid() 482cdf0e10cSrcweir { 483cdf0e10cSrcweir } 484cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const485cdf0e10cSrcweir bool ViewObjectContactOfPageGrid::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 486cdf0e10cSrcweir { 487cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 488cdf0e10cSrcweir { 489cdf0e10cSrcweir return false; 490cdf0e10cSrcweir } 491cdf0e10cSrcweir 492cdf0e10cSrcweir SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); 493cdf0e10cSrcweir 494cdf0e10cSrcweir if(!pSdrPageView) 495cdf0e10cSrcweir { 496cdf0e10cSrcweir return false; 497cdf0e10cSrcweir } 498cdf0e10cSrcweir 499cdf0e10cSrcweir const SdrView& rView = pSdrPageView->GetView(); 500cdf0e10cSrcweir 501cdf0e10cSrcweir if(!rView.IsGridVisible()) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir return false; 504cdf0e10cSrcweir } 505cdf0e10cSrcweir 506cdf0e10cSrcweir // no page grid for preview renderers 507cdf0e10cSrcweir if(GetObjectContact().IsPreviewRenderer()) 508cdf0e10cSrcweir { 509cdf0e10cSrcweir return false; 510cdf0e10cSrcweir } 511cdf0e10cSrcweir 512cdf0e10cSrcweir if(static_cast< ViewContactOfGrid& >(GetViewContact()).getFront() != (bool)rView.IsGridFront()) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir return false; 515cdf0e10cSrcweir } 516cdf0e10cSrcweir 517cdf0e10cSrcweir return true; 518cdf0e10cSrcweir } 519cdf0e10cSrcweir createPrimitive2DSequence(const DisplayInfo &) const520cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageGrid::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const 521cdf0e10cSrcweir { 522cdf0e10cSrcweir const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); 523cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence xRetval; 524cdf0e10cSrcweir 525cdf0e10cSrcweir if(pPageView) 526cdf0e10cSrcweir { 527cdf0e10cSrcweir const SdrView& rView = pPageView->GetView(); 528cdf0e10cSrcweir const SdrPage& rPage = getPage(); 529cdf0e10cSrcweir const Color aGridColor(rView.GetGridColor()); 530cdf0e10cSrcweir const basegfx::BColor aRGBGridColor(aGridColor.getBColor()); 531cdf0e10cSrcweir 532cdf0e10cSrcweir basegfx::B2DHomMatrix aGridMatrix; 533cdf0e10cSrcweir aGridMatrix.set(0, 0, (double)(rPage.GetWdt() - (rPage.GetRgtBorder() + rPage.GetLftBorder()))); 534cdf0e10cSrcweir aGridMatrix.set(1, 1, (double)(rPage.GetHgt() - (rPage.GetLwrBorder() + rPage.GetUppBorder()))); 535cdf0e10cSrcweir aGridMatrix.set(0, 2, (double)rPage.GetLftBorder()); 536cdf0e10cSrcweir aGridMatrix.set(1, 2, (double)rPage.GetUppBorder()); 537cdf0e10cSrcweir 538cdf0e10cSrcweir const Size aRaw(rView.GetGridCoarse()); 539cdf0e10cSrcweir const Size aFine(rView.GetGridFine()); 540cdf0e10cSrcweir const double fWidthX(aRaw.getWidth()); 541cdf0e10cSrcweir const double fWidthY(aRaw.getHeight()); 542cdf0e10cSrcweir const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0L); 543cdf0e10cSrcweir const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0L); 544cdf0e10cSrcweir 545cdf0e10cSrcweir xRetval.realloc(1); 546cdf0e10cSrcweir xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::GridPrimitive2D( 547cdf0e10cSrcweir aGridMatrix, fWidthX, fWidthY, 10.0, 3.0, nSubdivisionsX, nSubdivisionsY, aRGBGridColor, 548cdf0e10cSrcweir drawinglayer::primitive2d::createDefaultCross_3x3(aRGBGridColor))); 549cdf0e10cSrcweir } 550cdf0e10cSrcweir 551cdf0e10cSrcweir return xRetval; 552cdf0e10cSrcweir } 553cdf0e10cSrcweir } // end of namespace contact 554cdf0e10cSrcweir } // end of namespace sdr 555cdf0e10cSrcweir 556cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 557cdf0e10cSrcweir 558cdf0e10cSrcweir namespace sdr 559cdf0e10cSrcweir { 560cdf0e10cSrcweir namespace contact 561cdf0e10cSrcweir { ViewObjectContactOfPageHelplines(ObjectContact & rObjectContact,ViewContact & rViewContact)562cdf0e10cSrcweir ViewObjectContactOfPageHelplines::ViewObjectContactOfPageHelplines(ObjectContact& rObjectContact, ViewContact& rViewContact) 563cdf0e10cSrcweir : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir } 566cdf0e10cSrcweir ~ViewObjectContactOfPageHelplines()567cdf0e10cSrcweir ViewObjectContactOfPageHelplines::~ViewObjectContactOfPageHelplines() 568cdf0e10cSrcweir { 569cdf0e10cSrcweir } 570cdf0e10cSrcweir isPrimitiveVisible(const DisplayInfo & rDisplayInfo) const571cdf0e10cSrcweir bool ViewObjectContactOfPageHelplines::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const 572cdf0e10cSrcweir { 573cdf0e10cSrcweir if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo)) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir return false; 576cdf0e10cSrcweir } 577cdf0e10cSrcweir 578cdf0e10cSrcweir SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView(); 579cdf0e10cSrcweir 580cdf0e10cSrcweir if(!pSdrPageView) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir return false; 583cdf0e10cSrcweir } 584cdf0e10cSrcweir 585cdf0e10cSrcweir const SdrView& rView = pSdrPageView->GetView(); 586cdf0e10cSrcweir 587cdf0e10cSrcweir if(!rView.IsHlplVisible()) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir return false; 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir // no helplines for preview renderers 593cdf0e10cSrcweir if(GetObjectContact().IsPreviewRenderer()) 594cdf0e10cSrcweir { 595cdf0e10cSrcweir return false; 596cdf0e10cSrcweir } 597cdf0e10cSrcweir 598cdf0e10cSrcweir if(static_cast< ViewContactOfHelplines& >(GetViewContact()).getFront() != (bool)rView.IsHlplFront()) 599cdf0e10cSrcweir { 600cdf0e10cSrcweir return false; 601cdf0e10cSrcweir } 602cdf0e10cSrcweir 603cdf0e10cSrcweir return true; 604cdf0e10cSrcweir } 605cdf0e10cSrcweir createPrimitive2DSequence(const DisplayInfo &) const606cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHelplines::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const 607cdf0e10cSrcweir { 608cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence xRetval; 609cdf0e10cSrcweir const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); 610cdf0e10cSrcweir 611cdf0e10cSrcweir if(pPageView) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir const SdrHelpLineList& rHelpLineList = pPageView->GetHelpLines(); 614cdf0e10cSrcweir const sal_uInt32 nCount(rHelpLineList.GetCount()); 615cdf0e10cSrcweir 616cdf0e10cSrcweir if(nCount) 617cdf0e10cSrcweir { 618cdf0e10cSrcweir const basegfx::BColor aRGBColorA(1.0, 1.0, 1.0); 619cdf0e10cSrcweir const basegfx::BColor aRGBColorB(0.0, 0.0, 0.0); 620cdf0e10cSrcweir xRetval.realloc(nCount); 621cdf0e10cSrcweir 622cdf0e10cSrcweir for(sal_uInt32 a(0L); a < nCount; a++) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir const SdrHelpLine& rHelpLine = rHelpLineList[(sal_uInt16)a]; 625cdf0e10cSrcweir const basegfx::B2DPoint aPosition((double)rHelpLine.GetPos().X(), (double)rHelpLine.GetPos().Y()); 626cdf0e10cSrcweir const double fDiscreteDashLength(4.0); 627cdf0e10cSrcweir 628cdf0e10cSrcweir switch(rHelpLine.GetKind()) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir default : // SDRHELPLINE_POINT 631cdf0e10cSrcweir { 632cdf0e10cSrcweir xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D( 633cdf0e10cSrcweir aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_POINT, 634cdf0e10cSrcweir aRGBColorA, aRGBColorB, fDiscreteDashLength)); 635cdf0e10cSrcweir break; 636cdf0e10cSrcweir } 637cdf0e10cSrcweir case SDRHELPLINE_VERTICAL : 638cdf0e10cSrcweir { 639cdf0e10cSrcweir xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D( 640cdf0e10cSrcweir aPosition, basegfx::B2DVector(0.0, 1.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE, 641cdf0e10cSrcweir aRGBColorA, aRGBColorB, fDiscreteDashLength)); 642cdf0e10cSrcweir break; 643cdf0e10cSrcweir } 644cdf0e10cSrcweir case SDRHELPLINE_HORIZONTAL : 645cdf0e10cSrcweir { 646cdf0e10cSrcweir xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D( 647cdf0e10cSrcweir aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE, 648cdf0e10cSrcweir aRGBColorA, aRGBColorB, fDiscreteDashLength)); 649cdf0e10cSrcweir break; 650cdf0e10cSrcweir } 651cdf0e10cSrcweir } 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir return xRetval; 657cdf0e10cSrcweir } 658cdf0e10cSrcweir } // end of namespace contact 659cdf0e10cSrcweir } // end of namespace sdr 660cdf0e10cSrcweir 661cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 662cdf0e10cSrcweir 663cdf0e10cSrcweir namespace sdr 664cdf0e10cSrcweir { 665cdf0e10cSrcweir namespace contact 666cdf0e10cSrcweir { ViewObjectContactOfSdrPage(ObjectContact & rObjectContact,ViewContact & rViewContact)667cdf0e10cSrcweir ViewObjectContactOfSdrPage::ViewObjectContactOfSdrPage(ObjectContact& rObjectContact, ViewContact& rViewContact) 668cdf0e10cSrcweir : ViewObjectContact(rObjectContact, rViewContact) 669cdf0e10cSrcweir { 670cdf0e10cSrcweir } 671cdf0e10cSrcweir ~ViewObjectContactOfSdrPage()672cdf0e10cSrcweir ViewObjectContactOfSdrPage::~ViewObjectContactOfSdrPage() 673cdf0e10cSrcweir { 674cdf0e10cSrcweir } 675cdf0e10cSrcweir getPrimitive2DSequenceHierarchy(DisplayInfo & rDisplayInfo) const676cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const 677cdf0e10cSrcweir { 678cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence xRetval; 679cdf0e10cSrcweir 680cdf0e10cSrcweir // process local sub-hierarchy 681cdf0e10cSrcweir const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); 682cdf0e10cSrcweir 683cdf0e10cSrcweir if(nSubHierarchyCount) 684cdf0e10cSrcweir { 685cdf0e10cSrcweir const sal_Bool bDoGhostedDisplaying( 686cdf0e10cSrcweir GetObjectContact().DoVisualizeEnteredGroup() 687cdf0e10cSrcweir && !GetObjectContact().isOutputToPrinter() 688cdf0e10cSrcweir && GetObjectContact().getActiveViewContact() == &GetViewContact()); 689cdf0e10cSrcweir 690cdf0e10cSrcweir if(bDoGhostedDisplaying) 691cdf0e10cSrcweir { 692cdf0e10cSrcweir rDisplayInfo.ClearGhostedDrawMode(); 693cdf0e10cSrcweir } 694cdf0e10cSrcweir 695cdf0e10cSrcweir // create object hierarchy 696cdf0e10cSrcweir xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo); 697cdf0e10cSrcweir 698cdf0e10cSrcweir if(xRetval.hasElements()) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir // get ranges 701cdf0e10cSrcweir const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); 702cdf0e10cSrcweir const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D)); 703cdf0e10cSrcweir const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); 704cdf0e10cSrcweir 705cdf0e10cSrcweir // check geometrical visibility 706cdf0e10cSrcweir if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir // not visible, release 709cdf0e10cSrcweir xRetval.realloc(0); 710cdf0e10cSrcweir } 711cdf0e10cSrcweir } 712cdf0e10cSrcweir 713cdf0e10cSrcweir if(bDoGhostedDisplaying) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir rDisplayInfo.SetGhostedDrawMode(); 716cdf0e10cSrcweir } 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir return xRetval; 720cdf0e10cSrcweir } 721cdf0e10cSrcweir } // end of namespace contact 722cdf0e10cSrcweir } // end of namespace sdr 723cdf0e10cSrcweir 724cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 725cdf0e10cSrcweir // eof 726