24#include <officecfg/Office/Common.hxx>
55#include <com/sun/star/frame/XModel.hpp>
56#include <com/sun/star/embed/XEmbeddedObject.hpp>
65 svx::ExtrusionBar::RegisterInterface();
66 svx::FontworkBar::RegisterInterface();
77struct TheSdrGlobalData:
public rtl::Static<SdrGlobalData, TheSdrGlobalData> {};
82 return TheSdrGlobalData::get();
91#if defined _WIN32 && !defined _WIN64
92 nSize = officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get();
101 pTimer->SetTimeout(20000);
112 if (nSize >= maObjs.size())
117 size_t nCount2 = maObjs.size();
118 size_t nIndex = nCount2-1;
119 while(
nIndex && nCount2 > nSize )
128 const uno::Reference< embed::XEmbeddedObject > & xUnloadObj = pUnloadObj->
GetObjRef_NoInit();
133 if ( xUnloadObj.is() && bUnload )
135 uno::Reference< frame::XModel > xUnloadModel( xUnloadObj->getComponent(), uno::UNO_QUERY );
136 if ( xUnloadModel.is() )
140 if ( pCacheObj && pCacheObj != pUnloadObj )
142 uno::Reference< frame::XModel > xParentModel = pCacheObj->GetParentXModel();
143 if ( xUnloadModel == xParentModel )
153 if (bUnload && UnloadObj(*pUnloadObj))
156 RemoveObj(pUnloadObj);
157 nCount2 = std::min(nCount2 - 1, maObjs.size());
162 catch( uno::Exception& )
172 if ( pObj == pExistingObj )
178 std::vector<SdrOle2Obj*>::iterator it = std::find(
maObjs.begin(),
maObjs.end(), pObj);
179 bool bFound = it !=
maObjs.end();
190 if (!bFound || !
pTimer->IsActive())
196 std::vector<SdrOle2Obj*>::iterator it = std::find(
maObjs.begin(),
maObjs.end(), pObj);
220 bool bUnloaded =
false;
234 bUnloaded = rObj.
Unload();
243 bool bRetval =
false;
247 case drawing::FillStyle_SOLID:
254 case drawing::FillStyle_HATCH:
261 if(bFillHatchBackground)
267 rCol =
Color(aAverageColor);
272 case drawing::FillStyle_GRADIENT: {
277 rCol =
Color(aAverageColor);
282 case drawing::FillStyle_BITMAP:
286 const sal_uInt32 nWidth = aSize.
Width();
287 const sal_uInt32 nHeight = aSize.
Height();
288 if (nWidth <= 0 || nHeight <= 0)
298 const sal_uInt32 nMaxSteps(8);
299 const sal_uInt32 nXStep((nWidth > nMaxSteps) ? nWidth / nMaxSteps : 1);
300 const sal_uInt32 nYStep((nHeight > nMaxSteps) ? nHeight / nMaxSteps : 1);
303 for(sal_uInt32 nY(0); nY < nHeight; nY += nYStep)
305 for(sal_uInt32 nX(0); nX < nWidth; nX += nXStep)
307 const BitmapColor& rCol2 = pAccess->GetColor(nY, nX);
309 nRt += rCol2.GetRed();
310 nGn += rCol2.GetGreen();
311 nBl += rCol2.GetBlue();
335 std::unique_ptr<SdrOutliner> pOutl(
new SdrOutliner( pPool, nOutlinerMode ));
336 pOutl->SetEditTextObjectPool( pPool );
356 bool bLookOnly=pbOnlyEE!=
nullptr;
359 while (((bLookOnly && bOnly) || !bHas) && nWhich!=0) {
364 if ((eState==SfxItemState::DEFAULT && bInklDefaults) || eState==SfxItemState::SET) {
365 if (nWhich<EE_ITEMS_START || nWhich>
EE_ITEMS_END) bOnly=
false;
370 if (!bHas) bOnly=
false;
371 if (pbOnlyEE!=
nullptr) *pbOnlyEE=bOnly;
382 std::vector<WhichPair> buf;
383 for (
const auto & rPair : pOldWhichTable) {
384 auto const begin = rPair.first;
385 auto const end = rPair.second;
386 if (end < nRangeBeg || begin > nRangeEnd) {
388 }
else if (
begin >= nRangeBeg &&
end <= nRangeEnd) {
390 }
else if (
end <= nRangeEnd) {
391 buf.push_back({
begin, nRangeBeg - 1});
392 }
else if (
begin >= nRangeBeg) {
393 buf.push_back({nRangeEnd + 1,
end});
395 buf.push_back({
begin, nRangeBeg - 1});
396 buf.push_back({nRangeEnd + 1,
end});
399 std::unique_ptr<WhichPair[]> pNewWhichTable(
new WhichPair[buf.size()]);
400 std::copy(buf.begin(), buf.end(), pNewWhichTable.get());
476 bool impGetSdrObjListFillColor(
486 for(
size_t no(rList.
GetObjCount()); !bRet && no > 0; )
495 bRet = impGetSdrObjListFillColor(*pOL, rPnt, rTextEditPV, rVisLayers, rCol);
517 bool impGetSdrPageFillColor(
523 bool bSkipBackgroundShape)
525 bool bRet(impGetSdrObjListFillColor(rPage, rPnt, rTextEditPV, rVisLayers, rCol));
541 bRet = impGetSdrPageFillColor(rMasterPage, rPnt, rTextEditPV, aSet, rCol,
true);
546 if(!bRet && !bSkipBackgroundShape)
555 Color impCalcBackgroundColor(
567 const sal_uInt16 SPOTCOUNT(5);
568 Point aSpotPos[SPOTCOUNT];
569 Color aSpotColor[SPOTCOUNT];
572 sal_uInt32 nWidth14 = nWidth / 4;
573 sal_uInt32 nHeight14 = nHeight / 4;
574 sal_uInt32 nWidth34 = ( 3 * nWidth ) / 4;
575 sal_uInt32 nHeight34 = ( 3 * nHeight ) / 4;
578 for ( i = 0;
i < SPOTCOUNT;
i++ )
629 impGetSdrPageFillColor(rPage, aSpotPos[i], rTextEditPV, rTextEditPV.
GetVisibleLayers(), aSpotColor[i],
false);
632 sal_uInt16 aMatch[SPOTCOUNT];
634 for ( i = 0;
i < SPOTCOUNT;
i++ )
639 for ( sal_uInt16 j = 0; j < SPOTCOUNT; j++ )
643 if( aSpotColor[i] == aSpotColor[j] )
652 aBackground = aSpotColor[0];
654 for ( sal_uInt16 nMatchCount = SPOTCOUNT - 1; nMatchCount > 1; nMatchCount-- )
657 for ( i = 0;
i < SPOTCOUNT;
i++ )
659 if( aMatch[i] == nMatchCount )
661 aBackground = aSpotColor[
i];
707 aSnapRect.
Move(aPvOfs.
X(), aPvOfs.
Y());
709 return impCalcBackgroundColor(aSnapRect, *pTextEditPV, *pPg);
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
Size GetSizePixel() const
basegfx::BColor getBColor() const
std::vector< SdrOle2Obj * > maObjs
SVXCORE_DLLPUBLIC ~OLEObjCache()
void InsertObj(SdrOle2Obj *pObj)
SVXCORE_DLLPUBLIC size_t size() const
static bool UnloadObj(SdrOle2Obj &rObj)
SVXCORE_DLLPUBLIC SdrOle2Obj * operator[](size_t nPos)
void RemoveObj(SdrOle2Obj *pObj)
std::unique_ptr< AutoTimer > pTimer
static void SetForbiddenCharsTable(const std::shared_ptr< SvxForbiddenCharactersTable > &xForbiddenChars)
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
virtual const tools::Rectangle & GetSnapRect() const override
const SvtSysLocale & GetSysLocale()
std::vector< Link< SdrObjCreatorParams, rtl::Reference< SdrObject > > > aUserMakeObjHdl
const LocaleDataWrapper & GetLocaleData()
bool IsKernAsianPunctuation() const
sal_uInt16 GetDefaultTabulator() const
bool IsAddExtLeading() const
const SfxItemPool & GetItemPool() const
CharCompressType GetCharCompressType() const
SfxStyleSheetBasePool * GetStyleSheetPool() const
const std::shared_ptr< SvxForbiddenCharactersTable > & GetForbiddenCharsTable() const
SdrTextObj * GetTextEditObject() const
SdrPageView * GetTextEditPageView() const
virtual SdrPage * getSdrPageFromSdrObjList() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual SdrObjList * GetSubList() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
sdr::contact::ViewContact & GetViewContact() const
const SfxItemSet & GetMergedItemSet() const
bool IsNotVisibleAsMaster() const
sal_Int64 GetAspect() const
static bool CanUnloadRunningObj(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
SVX_DLLPRIVATE css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef_NoInit() const
static bool Unload(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
const SdrLayerIDSet & GetVisibleLayers() const
SdrPage * GetPage() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
SdrPage & TRG_GetMasterPage() const
bool IsMasterPage() const
bool TRG_HasMasterPage() const
Color GetPageBackgroundColor() const
deprecated returns an averaged background color of this page
const SdrLayerIDSet & TRG_GetMasterPageVisibleLayers() const
const Point & GetTextEditOffset() const
bool IsHideContour() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
bool GetHighContrastMode() const
Link< void *, bool > maLink
void ReportInserts(size_t nInsertCount)
void SetActionCount(size_t _nActionCount)
bool ReportActions(size_t nActionCount)
void SetInsertCount(size_t _nInsertCount)
void ReportRescales(size_t nRescaleCount)
SvdProgressInfo(const Link< void *, bool > &_pLink)
void Init(size_t _nObjCount)
const LocaleDataWrapper & GetLocaleData() const
const basegfx::BColorStops & GetColorStops() const
const SfxItemSet & GetActiveCellItemSet() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
#define LINK(Instance, Class, Member)
B2DTuple average(const B2DTuple &rOld1, const B2DTuple &rOld2)
enumrange< T >::Iterator begin(enumrange< T >)
SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, const basegfx::B2DVector &rHitTolerance, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer)
SdrGlobalData & GetSdrGlobalData()
bool GetDraftFillColor(const SfxItemSet &rSet, Color &rCol)
Returns a replacement for an XFillStyle.
WhichRangesContainer RemoveWhichRange(const WhichRangesContainer &pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd)
std::vector< Link< SdrObjCreatorParams, rtl::Reference< SdrObject > > > & ImpGetUserMakeObjHdl()
bool SearchOutlinerItems(const SfxItemSet &rSet, bool bInklDefaults, bool *pbOnlyEE)
Search an ItemSet for Outliner/EditEngine Items.
Color GetTextEditBackgroundColor(const SdrObjEditView &rView)
std::unique_ptr< SdrOutliner > SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel &rModel)
Create an Outliner with the engine-global default settings on the heap.
IMPL_LINK_NOARG(OLEObjCache, UnloadCheckHdl, Timer *, void)
SdrTextObj * DynCastSdrTextObj(SdrObject *pObj)
std::pair< sal_uInt16, sal_uInt16 > WhichPair
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XFillBackgroundItem > XATTR_FILLBACKGROUND(XATTR_FILL_FIRST+19)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)