LibreOffice Module svx (master)  1
svdetc.cxx
Go to the documentation of this file.
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 <sal/config.h>
21 
22 #include <algorithm>
23 
24 #include <officecfg/Office/Common.hxx>
25 #include <svtools/colorcfg.hxx>
26 #include <svx/svdetc.hxx>
27 #include <svx/svdedxv.hxx>
28 #include <svx/svdmodel.hxx>
29 #include <svx/svdoutl.hxx>
30 #include <vcl/BitmapReadAccess.hxx>
31 #include <editeng/eeitem.hxx>
32 #include <svl/itemset.hxx>
33 #include <svl/whiter.hxx>
34 #include <svx/xgrad.hxx>
35 #include <svx/xfillit0.hxx>
36 #include <svx/xflclit.hxx>
37 #include <svx/xflhtit.hxx>
38 #include <svx/xbtmpit.hxx>
39 #include <svx/xflgrit.hxx>
40 #include <svx/svdoole2.hxx>
41 #include <svl/itempool.hxx>
42 #include <unotools/configmgr.hxx>
44 #include <unotools/syslocale.hxx>
45 #include <svx/xflbckit.hxx>
46 #include <svx/extrusionbar.hxx>
47 #include <svx/fontworkbar.hxx>
48 #include <vcl/svapp.hxx>
49 #include <vcl/settings.hxx>
51 #include <svx/svdpage.hxx>
52 #include <svx/svdpagv.hxx>
53 #include <svx/svdotable.hxx>
54 #include <svx/sdrhittesthelper.hxx>
55 
56 #include <com/sun/star/frame/XModel.hpp>
57 #include <com/sun/star/embed/XEmbeddedObject.hpp>
58 
59 using namespace ::com::sun::star;
60 
61 // Global data of the DrawingEngine
63  : pSysLocale(nullptr)
64 {
66  {
67  svx::ExtrusionBar::RegisterInterface();
68  svx::FontworkBar::RegisterInterface();
69  }
70 }
71 
73 {
74  if ( !pSysLocale )
76  return pSysLocale;
77 }
79 {
80  return &GetSysLocale()->GetLocaleData();
81 }
82 
83 namespace {
84 
85 struct TheSdrGlobalData: public rtl::Static<SdrGlobalData, TheSdrGlobalData> {};
86 
87 }
88 
90  return TheSdrGlobalData::get();
91 }
92 
94 {
96  {
97 // This limit is only useful on 32-bit windows, where we can run out of virtual memory (see tdf#95579)
98 // For everything else, we are better off keeping it in main memory rather than using our hacky page-out thing
99 #if defined _WIN32 && !defined _WIN64
100  nSize = officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get();
101 #else
102  nSize = SAL_MAX_INT32; // effectively disable the page-out mechanism
103 #endif
104  }
105  else
106  nSize = 100;
107  pTimer.reset( new AutoTimer( "svx OLEObjCache pTimer UnloadCheck" ) );
108  pTimer->SetInvokeHandler( LINK(this, OLEObjCache, UnloadCheckHdl) );
109  pTimer->SetTimeout(20000);
110  pTimer->SetStatic();
111 }
112 
114 {
115  pTimer->Stop();
116 }
117 
118 IMPL_LINK_NOARG(OLEObjCache, UnloadCheckHdl, Timer*, void)
119 {
120  if (nSize >= maObjs.size())
121  return;
122 
123  // more objects than configured cache size try to remove objects
124  // of course not the freshly inserted one at nIndex=0
125  size_t nCount2 = maObjs.size();
126  size_t nIndex = nCount2-1;
127  while( nIndex && nCount2 > nSize )
128  {
129  SdrOle2Obj* pUnloadObj = maObjs[nIndex--];
130  if (!pUnloadObj)
131  continue;
132 
133  try
134  {
135  // it is important to get object without reinitialization to avoid reentrance
136  const uno::Reference< embed::XEmbeddedObject > & xUnloadObj = pUnloadObj->GetObjRef_NoInit();
137 
138  bool bUnload = !xUnloadObj || SdrOle2Obj::CanUnloadRunningObj( xUnloadObj, pUnloadObj->GetAspect() );
139 
140  // check whether the object can be unloaded before looking for the parent objects
141  if ( xUnloadObj.is() && bUnload )
142  {
143  uno::Reference< frame::XModel > xUnloadModel( xUnloadObj->getComponent(), uno::UNO_QUERY );
144  if ( xUnloadModel.is() )
145  {
146  for (SdrOle2Obj* pCacheObj : maObjs)
147  {
148  if ( pCacheObj && pCacheObj != pUnloadObj )
149  {
150  uno::Reference< frame::XModel > xParentModel = pCacheObj->GetParentXModel();
151  if ( xUnloadModel == xParentModel )
152  {
153  bUnload = false; // the object has running embedded objects
154  break;
155  }
156  }
157  }
158  }
159  }
160 
161  if (bUnload && UnloadObj(*pUnloadObj))
162  {
163  // object was successfully unloaded
164  RemoveObj(pUnloadObj);
165  nCount2 = std::min(nCount2 - 1, maObjs.size());
166  if (nIndex >= nCount2)
167  nIndex = nCount2 - 1;
168  }
169  }
170  catch( uno::Exception& )
171  {}
172  }
173 }
174 
176 {
177  if (!maObjs.empty())
178  {
179  SdrOle2Obj* pExistingObj = maObjs.front();
180  if ( pObj == pExistingObj )
181  // the object is already on the top, nothing has to be changed
182  return;
183  }
184 
185  // get the old position of the object to know whether it is already in container
186  std::vector<SdrOle2Obj*>::iterator it = std::find(maObjs.begin(), maObjs.end(), pObj);
187  bool bFound = it != maObjs.end();
188 
189  if (bFound)
190  maObjs.erase(it);
191  // insert object into first position
192  maObjs.insert(maObjs.begin(), pObj);
193 
194  // if a new object was inserted, recalculate the cache
195  if (!bFound)
196  pTimer->Invoke();
197 
198  if (!bFound || !pTimer->IsActive())
199  pTimer->Start();
200 }
201 
203 {
204  std::vector<SdrOle2Obj*>::iterator it = std::find(maObjs.begin(), maObjs.end(), pObj);
205  if (it != maObjs.end())
206  maObjs.erase(it);
207  if (maObjs.empty())
208  pTimer->Stop();
209 }
210 
211 size_t OLEObjCache::size() const
212 {
213  return maObjs.size();
214 }
215 
217 {
218  return maObjs[nPos];
219 }
220 
221 const SdrOle2Obj* OLEObjCache::operator[](size_t nPos) const
222 {
223  return maObjs[nPos];
224 }
225 
227 {
228  bool bUnloaded = false;
229 
230  //#i80528# The old mechanism is completely useless, only taking into account if
231  // in all views the GrafDraft feature is used. This will nearly never have been the
232  // case since no one ever used this option.
233 
234  // A much better (and working) criteria would be the VOC contact count.
235  // The question is what will happen when i make it work now suddenly? I
236  // will try it for 2.4.
237  const sdr::contact::ViewContact& rViewContact = rObj.GetViewContact();
238  const bool bVisible(rViewContact.HasViewObjectContacts());
239 
240  if(!bVisible)
241  {
242  bUnloaded = rObj.Unload();
243  }
244 
245  return bUnloaded;
246 }
247 
248 bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
249 {
250  drawing::FillStyle eFill=rSet.Get(XATTR_FILLSTYLE).GetValue();
251  bool bRetval = false;
252 
253  switch(eFill)
254  {
255  case drawing::FillStyle_SOLID:
256  {
257  rCol = rSet.Get(XATTR_FILLCOLOR).GetColorValue();
258  bRetval = true;
259 
260  break;
261  }
262  case drawing::FillStyle_HATCH:
263  {
264  Color aCol1(rSet.Get(XATTR_FILLHATCH).GetHatchValue().GetColor());
265  Color aCol2(COL_WHITE);
266 
267  // when hatched background is activated, use object fill color as hatch color
268  bool bFillHatchBackground = rSet.Get(XATTR_FILLBACKGROUND).GetValue();
269  if(bFillHatchBackground)
270  {
271  aCol2 = rSet.Get(XATTR_FILLCOLOR).GetColorValue();
272  }
273 
274  const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor()));
275  rCol = Color(aAverageColor);
276  bRetval = true;
277 
278  break;
279  }
280  case drawing::FillStyle_GRADIENT: {
281  const XGradient& rGrad=rSet.Get(XATTR_FILLGRADIENT).GetGradientValue();
282  Color aCol1(rGrad.GetStartColor());
283  Color aCol2(rGrad.GetEndColor());
284  const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor()));
285  rCol = Color(aAverageColor);
286  bRetval = true;
287 
288  break;
289  }
290  case drawing::FillStyle_BITMAP:
291  {
292  Bitmap aBitmap(rSet.Get(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
293  const Size aSize(aBitmap.GetSizePixel());
294  const sal_uInt32 nWidth = aSize.Width();
295  const sal_uInt32 nHeight = aSize.Height();
296  if (nWidth <= 0 || nHeight <= 0)
297  return bRetval;
298 
299  Bitmap::ScopedReadAccess pAccess(aBitmap);
300 
301  if (pAccess)
302  {
303  sal_uInt32 nRt(0);
304  sal_uInt32 nGn(0);
305  sal_uInt32 nBl(0);
306  const sal_uInt32 nMaxSteps(8);
307  const sal_uInt32 nXStep((nWidth > nMaxSteps) ? nWidth / nMaxSteps : 1);
308  const sal_uInt32 nYStep((nHeight > nMaxSteps) ? nHeight / nMaxSteps : 1);
309  sal_uInt32 nCount(0);
310 
311  for(sal_uInt32 nY(0); nY < nHeight; nY += nYStep)
312  {
313  for(sal_uInt32 nX(0); nX < nWidth; nX += nXStep)
314  {
315  const BitmapColor& rCol2 = pAccess->GetColor(nY, nX);
316 
317  nRt += rCol2.GetRed();
318  nGn += rCol2.GetGreen();
319  nBl += rCol2.GetBlue();
320  nCount++;
321  }
322  }
323 
324  nRt /= nCount;
325  nGn /= nCount;
326  nBl /= nCount;
327 
328  rCol = Color(sal_uInt8(nRt), sal_uInt8(nGn), sal_uInt8(nBl));
329 
330  bRetval = true;
331  }
332  break;
333  }
334  default: break;
335  }
336 
337  return bRetval;
338 }
339 
340 std::unique_ptr<SdrOutliner> SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rModel)
341 {
342  SfxItemPool* pPool = &rModel.GetItemPool();
343  std::unique_ptr<SdrOutliner> pOutl(new SdrOutliner( pPool, nOutlinerMode ));
344  pOutl->SetEditTextObjectPool( pPool );
345  pOutl->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(rModel.GetStyleSheetPool()));
346  pOutl->SetDefTab(rModel.GetDefaultTabulator());
348  pOutl->SetAsianCompressionMode(rModel.GetCharCompressType());
349  pOutl->SetKernAsianPunctuation(rModel.IsKernAsianPunctuation());
350  pOutl->SetAddExtLeading(rModel.IsAddExtLeading());
351  return pOutl;
352 }
353 
354 std::vector<Link<SdrObjCreatorParams, SdrObject*>>& ImpGetUserMakeObjHdl()
355 {
356  SdrGlobalData& rGlobalData=GetSdrGlobalData();
357  return rGlobalData.aUserMakeObjHdl;
358 }
359 
360 bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE)
361 {
362  bool bHas=false;
363  bool bOnly=true;
364  bool bLookOnly=pbOnlyEE!=nullptr;
365  SfxWhichIter aIter(rSet);
366  sal_uInt16 nWhich=aIter.FirstWhich();
367  while (((bLookOnly && bOnly) || !bHas) && nWhich!=0) {
368  // For bInklDefaults, the entire Which range is decisive,
369  // in other cases only the set items are.
370  // Disabled and DontCare are regarded as holes in the Which range.
371  SfxItemState eState=aIter.GetItemState();
372  if ((eState==SfxItemState::DEFAULT && bInklDefaults) || eState==SfxItemState::SET) {
373  if (nWhich<EE_ITEMS_START || nWhich>EE_ITEMS_END) bOnly=false;
374  else bHas=true;
375  }
376  nWhich=aIter.NextWhich();
377  }
378  if (!bHas) bOnly=false;
379  if (pbOnlyEE!=nullptr) *pbOnlyEE=bOnly;
380  return bHas;
381 }
382 
383 WhichRangesContainer RemoveWhichRange(const WhichRangesContainer& pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd)
384 {
385  // Six possible cases (per range):
386  // [Beg..End] [nRangeBeg, nRangeEnd], to delete
387  // [b..e] [b..e] [b..e] Cases 1,3,2: doesn't matter, delete, doesn't matter + Ranges
388  // [b........e] [b........e] Cases 4,5 : shrink range | in
389  // [b......................e] Case 6 : splitting + pOldWhichTable
390  std::vector<WhichPair> buf;
391  for (const auto & rPair : pOldWhichTable) {
392  auto const begin = rPair.first;
393  auto const end = rPair.second;
394  if (end < nRangeBeg || begin > nRangeEnd) { // cases 1, 2
395  buf.push_back({begin, end});
396  } else if (begin >= nRangeBeg && end <= nRangeEnd) { // case 3
397  // drop
398  } else if (end <= nRangeEnd) { // case 4
399  buf.push_back({begin, nRangeBeg - 1});
400  } else if (begin >= nRangeBeg) { // case 5
401  buf.push_back({nRangeEnd + 1, end});
402  } else { // case 6
403  buf.push_back({begin, nRangeBeg - 1});
404  buf.push_back({nRangeEnd + 1, end});
405  }
406  }
407  std::unique_ptr<WhichPair[]> pNewWhichTable(new WhichPair[buf.size()]);
408  std::copy(buf.begin(), buf.end(), pNewWhichTable.get());
409  return WhichRangesContainer(std::move(pNewWhichTable), buf.size());
410 }
411 
412 
414 {
415  maLink = _rLink;
416  m_nSumCurAction = 0;
417 
418  m_nObjCount = 0;
419  m_nCurObj = 0;
420 
421  m_nActionCount = 0;
422  m_nCurAction = 0;
423 
424  m_nInsertCount = 0;
425  m_nCurInsert = 0;
426 }
427 
428 void SvdProgressInfo::Init( size_t nObjCount )
429 {
430  m_nObjCount = nObjCount;
431 }
432 
433 bool SvdProgressInfo::ReportActions( size_t nActionCount )
434 {
435  m_nSumCurAction += nActionCount;
436  m_nCurAction += nActionCount;
439 
440  return maLink.Call(nullptr);
441 }
442 
443 void SvdProgressInfo::ReportInserts( size_t nInsertCount )
444 {
445  m_nSumCurAction += nInsertCount;
446  m_nCurInsert += nInsertCount;
447 
448  maLink.Call(nullptr);
449 }
450 
451 void SvdProgressInfo::ReportRescales( size_t nRescaleCount )
452 {
453  m_nSumCurAction += nRescaleCount;
454  maLink.Call(nullptr);
455 }
456 
457 void SvdProgressInfo::SetActionCount( size_t nActionCount )
458 {
459  m_nActionCount = nActionCount;
460 }
461 
462 void SvdProgressInfo::SetInsertCount( size_t nInsertCount )
463 {
464  m_nInsertCount = nInsertCount;
465 }
466 
468 {
469  m_nActionCount = 0;
470  m_nCurAction = 0;
471 
472  m_nInsertCount = 0;
473  m_nCurInsert = 0;
474 
475  m_nCurObj++;
476  ReportActions(0);
477 }
478 
479 // #i101872# isolate GetTextEditBackgroundColor to tooling; it will anyways only be used as long
480 // as text edit is not running on overlay
481 
482 namespace
483 {
484  bool impGetSdrObjListFillColor(
485  const SdrObjList& rList,
486  const Point& rPnt,
487  const SdrPageView& rTextEditPV,
488  const SdrLayerIDSet& rVisLayers,
489  Color& rCol)
490  {
491  bool bRet(false);
492  bool bMaster(rList.getSdrPageFromSdrObjList() && rList.getSdrPageFromSdrObjList()->IsMasterPage());
493 
494  for(size_t no(rList.GetObjCount()); !bRet && no > 0; )
495  {
496  no--;
497  SdrObject* pObj = rList.GetObj(no);
498  SdrObjList* pOL = pObj->GetSubList();
499 
500  if(pOL)
501  {
502  // group object
503  bRet = impGetSdrObjListFillColor(*pOL, rPnt, rTextEditPV, rVisLayers, rCol);
504  }
505  else
506  {
507  SdrTextObj* pText = dynamic_cast< SdrTextObj * >(pObj);
508 
509  // Exclude zero master page object (i.e. background shape) from color query
510  if(pText
511  && pObj->IsClosedObj()
512  && (!bMaster || (!pObj->IsNotVisibleAsMaster() && 0 != no))
513  && pObj->GetCurrentBoundRect().Contains(rPnt)
514  && !pText->IsHideContour()
515  && SdrObjectPrimitiveHit(*pObj, rPnt, 0, rTextEditPV, &rVisLayers, false))
516  {
517  bRet = GetDraftFillColor(pObj->GetMergedItemSet(), rCol);
518  }
519  }
520  }
521 
522  return bRet;
523  }
524 
525  bool impGetSdrPageFillColor(
526  const SdrPage& rPage,
527  const Point& rPnt,
528  const SdrPageView& rTextEditPV,
529  const SdrLayerIDSet& rVisLayers,
530  Color& rCol,
531  bool bSkipBackgroundShape)
532  {
533  bool bRet(impGetSdrObjListFillColor(rPage, rPnt, rTextEditPV, rVisLayers, rCol));
534 
535  if(!bRet && !rPage.IsMasterPage())
536  {
537  if(rPage.TRG_HasMasterPage())
538  {
539  SdrLayerIDSet aSet(rVisLayers);
540  aSet &= rPage.TRG_GetMasterPageVisibleLayers();
541  SdrPage& rMasterPage = rPage.TRG_GetMasterPage();
542 
543  // Don't fall back to background shape on
544  // master pages. This is later handled by
545  // GetBackgroundColor, and is necessary to cater for
546  // the silly ordering: 1. shapes, 2. master page
547  // shapes, 3. page background, 4. master page
548  // background.
549  bRet = impGetSdrPageFillColor(rMasterPage, rPnt, rTextEditPV, aSet, rCol, true);
550  }
551  }
552 
553  // Only now determine background color from background shapes
554  if(!bRet && !bSkipBackgroundShape)
555  {
556  rCol = rPage.GetPageBackgroundColor();
557  return true;
558  }
559 
560  return bRet;
561  }
562 
563  Color impCalcBackgroundColor(
564  const tools::Rectangle& rArea,
565  const SdrPageView& rTextEditPV,
566  const SdrPage& rPage)
567  {
568  svtools::ColorConfig aColorConfig;
569  Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
570  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
571 
572  if(!rStyleSettings.GetHighContrastMode())
573  {
574  // search in page
575  const sal_uInt16 SPOTCOUNT(5);
576  Point aSpotPos[SPOTCOUNT];
577  Color aSpotColor[SPOTCOUNT];
578  sal_uInt32 nHeight( rArea.GetSize().Height() );
579  sal_uInt32 nWidth( rArea.GetSize().Width() );
580  sal_uInt32 nWidth14 = nWidth / 4;
581  sal_uInt32 nHeight14 = nHeight / 4;
582  sal_uInt32 nWidth34 = ( 3 * nWidth ) / 4;
583  sal_uInt32 nHeight34 = ( 3 * nHeight ) / 4;
584 
585  sal_uInt16 i;
586  for ( i = 0; i < SPOTCOUNT; i++ )
587  {
588  // five spots are used
589  switch ( i )
590  {
591  case 0 :
592  {
593  // Center-Spot
594  aSpotPos[i] = rArea.Center();
595  }
596  break;
597 
598  case 1 :
599  {
600  // TopLeft-Spot
601  aSpotPos[i] = rArea.TopLeft();
602  aSpotPos[i].AdjustX(nWidth14 );
603  aSpotPos[i].AdjustY(nHeight14 );
604  }
605  break;
606 
607  case 2 :
608  {
609  // TopRight-Spot
610  aSpotPos[i] = rArea.TopLeft();
611  aSpotPos[i].AdjustX(nWidth34 );
612  aSpotPos[i].AdjustY(nHeight14 );
613  }
614  break;
615 
616  case 3 :
617  {
618  // BottomLeft-Spot
619  aSpotPos[i] = rArea.TopLeft();
620  aSpotPos[i].AdjustX(nWidth14 );
621  aSpotPos[i].AdjustY(nHeight34 );
622  }
623  break;
624 
625  case 4 :
626  {
627  // BottomRight-Spot
628  aSpotPos[i] = rArea.TopLeft();
629  aSpotPos[i].AdjustX(nWidth34 );
630  aSpotPos[i].AdjustY(nHeight34 );
631  }
632  break;
633 
634  }
635 
636  aSpotColor[i] = COL_WHITE;
637  impGetSdrPageFillColor(rPage, aSpotPos[i], rTextEditPV, rTextEditPV.GetVisibleLayers(), aSpotColor[i], false);
638  }
639 
640  sal_uInt16 aMatch[SPOTCOUNT];
641 
642  for ( i = 0; i < SPOTCOUNT; i++ )
643  {
644  // were same spot colors found?
645  aMatch[i] = 0;
646 
647  for ( sal_uInt16 j = 0; j < SPOTCOUNT; j++ )
648  {
649  if( j != i )
650  {
651  if( aSpotColor[i] == aSpotColor[j] )
652  {
653  aMatch[i]++;
654  }
655  }
656  }
657  }
658 
659  // highest weight to center spot
660  aBackground = aSpotColor[0];
661 
662  for ( sal_uInt16 nMatchCount = SPOTCOUNT - 1; nMatchCount > 1; nMatchCount-- )
663  {
664  // which spot color was found most?
665  for ( i = 0; i < SPOTCOUNT; i++ )
666  {
667  if( aMatch[i] == nMatchCount )
668  {
669  aBackground = aSpotColor[i];
670  nMatchCount = 1; // break outer for-loop
671  break;
672  }
673  }
674  }
675  }
676 
677  return aBackground;
678  }
679 } // end of anonymous namespace
680 
682 {
683  svtools::ColorConfig aColorConfig;
684  Color aBackground(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
685  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
686 
687  if(!rStyleSettings.GetHighContrastMode())
688  {
689  bool bFound(false);
690  SdrTextObj* pText = rView.GetTextEditObject();
691 
692  if(pText && pText->IsClosedObj())
693  {
694  sdr::table::SdrTableObj* pTable = dynamic_cast< sdr::table::SdrTableObj * >( pText );
695 
696  if( pTable )
697  bFound = GetDraftFillColor(pTable->GetActiveCellItemSet(), aBackground );
698 
699  if( !bFound )
700  bFound=GetDraftFillColor(pText->GetMergedItemSet(), aBackground);
701  }
702 
703  if(!bFound && pText)
704  {
705  SdrPageView* pTextEditPV = rView.GetTextEditPageView();
706 
707  if(pTextEditPV)
708  {
709  Point aPvOfs(pText->GetTextEditOffset());
710  const SdrPage* pPg = pTextEditPV->GetPage();
711 
712  if(pPg)
713  {
714  tools::Rectangle aSnapRect( pText->GetSnapRect() );
715  aSnapRect.Move(aPvOfs.X(), aPvOfs.Y());
716 
717  return impCalcBackgroundColor(aSnapRect, *pTextEditPV, *pPg);
718  }
719  }
720  }
721  }
722 
723  return aBackground;
724 }
725 
726 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrPage & TRG_GetMasterPage() const
Definition: svdpage.cxx:1651
void ReportRescales(size_t nRescaleCount)
Definition: svdetc.cxx:451
sal_Int32 nIndex
bool SearchOutlinerItems(const SfxItemSet &rSet, bool bInklDefaults, bool *pbOnlyEE)
Search an ItemSet for Outliner/EditEngine Items.
Definition: svdetc.cxx:360
bool bVisible
OutlinerMode
bool IsNotVisibleAsMaster() const
Definition: svdobj.hxx:835
bool IsClosedObj() const
Definition: svdobj.hxx:740
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:954
const SvtSysLocale * GetSysLocale()
Definition: svdetc.cxx:72
CharCompressType GetCharCompressType() const
Definition: svdmodel.hxx:565
Color GetPageBackgroundColor() const
deprecated returns an averaged background color of this page
Definition: svdpage.cxx:1817
bool IsKernAsianPunctuation() const
Definition: svdmodel.hxx:568
WhichRangesContainer RemoveWhichRange(const WhichRangesContainer &pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd)
Definition: svdetc.cxx:383
std::pair< sal_uInt16, sal_uInt16 > WhichPair
bool Contains(const Point &rPOINT) const
SdrTextObj * GetTextEditObject() const
Definition: svdedxv.hxx:233
std::vector< Link< SdrObjCreatorParams, SdrObject * > > & ImpGetUserMakeObjHdl()
Definition: svdetc.cxx:354
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
void SetNextObject()
Definition: svdetc.cxx:467
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:807
size_t GetObjCount() const
Definition: svdpage.cxx:801
sal_uInt16 FirstWhich()
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
B2DTuple average(const B2DTuple &rOld1, const B2DTuple &rOld2)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:49
SVXCORE_DLLPUBLIC ~OLEObjCache()
Definition: svdetc.cxx:113
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:743
constexpr TypedWhichId< XFillBackgroundItem > XATTR_FILLBACKGROUND(XATTR_FILL_FIRST+19)
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:256
sal_uInt16 NextWhich()
const Color & GetStartColor() const
Definition: xgrad.hxx:69
constexpr tools::Long Width() const
const LocaleDataWrapper & GetLocaleData() const
enumrange< T >::Iterator begin(enumrange< T >)
const SvtSysLocale * pSysLocale
Definition: svdetc.hxx:185
static bool IsFuzzing()
int nCount
void Init(size_t _nObjCount)
Definition: svdetc.cxx:428
const LocaleDataWrapper * GetLocaleData()
Definition: svdetc.cxx:78
void RemoveObj(SdrOle2Obj *pObj)
Definition: svdetc.cxx:202
SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, sal_uInt16 nTol, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer)
std::vector< SdrOle2Obj * > maObjs
Definition: svdetc.hxx:162
const Point & GetTextEditOffset() const
Definition: svdotext.hxx:204
static bool Unload(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
SVX_DLLPRIVATE css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef_NoInit() const
Definition: svdoole2.cxx:1793
size_t nSize
Definition: svdetc.hxx:164
void SetInsertCount(size_t _nInsertCount)
Definition: svdetc.cxx:462
void SetActionCount(size_t _nActionCount)
Definition: svdetc.cxx:457
bool HasViewObjectContacts() const
const SdrLayerIDSet & GetVisibleLayers() const
Definition: svdpagv.hxx:210
#define SAL_MAX_INT32
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
int i
bool IsAddExtLeading() const
Definition: svdmodel.hxx:571
size_t m_nSumCurAction
Definition: svdetc.hxx:115
size_t m_nObjCount
Definition: svdetc.hxx:123
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
const SdrLayerIDSet & TRG_GetMasterPageVisibleLayers() const
Definition: svdpage.cxx:1657
BitmapColor GetColor(tools::Long nY, tools::Long nX) const
size_t m_nInsertCount
Definition: svdetc.hxx:120
size_t m_nActionCount
Definition: svdetc.hxx:117
size_t m_nCurInsert
Definition: svdetc.hxx:121
Link< void *, bool > maLink
Definition: svdetc.hxx:126
static bool CanUnloadRunningObj(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
Definition: svdoole2.cxx:1662
bool IsHideContour() const
Definition: svdotext.cxx:1725
bool IsMasterPage() const
Definition: svdpage.hxx:459
size_t m_nCurAction
Definition: svdetc.hxx:118
bool TRG_HasMasterPage() const
Definition: svdpage.hxx:495
Abstract DrawObject.
Definition: svdobj.hxx:260
bool ReportActions(size_t nActionCount)
Definition: svdetc.cxx:433
enumrange< T >::Iterator end(enumrange< T >)
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
constexpr Point Center() const
constexpr Point TopLeft() const
const SfxItemSet & GetActiveCellItemSet() const
Definition: svdotable.cxx:1300
static bool UnloadObj(SdrOle2Obj &rObj)
Definition: svdetc.cxx:226
SdrGlobalData & GetSdrGlobalData()
Definition: svdetc.cxx:89
const std::shared_ptr< SvxForbiddenCharactersTable > & GetForbiddenCharsTable() const
Definition: svdmodel.hxx:562
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr Size GetSize() const
SfxItemState
sal_Int64 GetAspect() const
Definition: svdoole2.cxx:808
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
IMPL_LINK_NOARG(OLEObjCache, UnloadCheckHdl, Timer *, void)
Definition: svdetc.cxx:118
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
SdrPageView * GetTextEditPageView() const
Definition: svdedxv.cxx:1697
unsigned char sal_uInt8
SdrPage * GetPage() const
Definition: svdpagv.hxx:166
OLEObjCache()
Definition: svdetc.cxx:93
SfxStyleSheetBasePool * GetStyleSheetPool() const
Definition: svdmodel.hxx:541
Color GetTextEditBackgroundColor(const SdrObjEditView &rView)
Definition: svdetc.cxx:681
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1977
std::unique_ptr< SdrOutliner > SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel &rModel)
Create an Outliner with the engine-global default settings on the heap.
Definition: svdetc.cxx:340
static void SetForbiddenCharsTable(const std::shared_ptr< SvxForbiddenCharactersTable > &xForbiddenChars)
SvdProgressInfo(const Link< void *, bool > &_pLink)
Definition: svdetc.cxx:413
virtual SdrPage * getSdrPageFromSdrObjList() const
Definition: svdpage.cxx:117
void ReportInserts(size_t nInsertCount)
Definition: svdetc.cxx:443
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:317
std::vector< Link< SdrObjCreatorParams, SdrObject * > > aUserMakeObjHdl
Definition: svdetc.hxx:188
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:373
void InsertObj(SdrOle2Obj *pObj)
Definition: svdetc.cxx:175
SVXCORE_DLLPUBLIC SdrOle2Obj * operator[](size_t nPos)
Definition: svdetc.cxx:216
size_t m_nCurObj
Definition: svdetc.hxx:124
bool GetDraftFillColor(const SfxItemSet &rSet, Color &rCol)
Returns a replacement for an XFillStyle.
Definition: svdetc.cxx:248
SVXCORE_DLLPUBLIC size_t size() const
Definition: svdetc.cxx:211
const Color & GetEndColor() const
Definition: xgrad.hxx:70
std::unique_ptr< AutoTimer > pTimer
Definition: svdetc.hxx:165
sal_uInt16 GetDefaultTabulator() const
Definition: svdmodel.hxx:340