24#include <officecfg/Office/Common.hxx>
56#include <com/sun/star/frame/XModel.hpp>
57#include <com/sun/star/embed/XEmbeddedObject.hpp>
66 svx::ExtrusionBar::RegisterInterface();
67 svx::FontworkBar::RegisterInterface();
78struct TheSdrGlobalData:
public rtl::Static<SdrGlobalData, TheSdrGlobalData> {};
83 return TheSdrGlobalData::get();
92#if defined _WIN32 && !defined _WIN64
93 nSize = officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get();
102 pTimer->SetTimeout(20000);
113 if (nSize >= maObjs.size())
118 size_t nCount2 = maObjs.size();
119 size_t nIndex = nCount2-1;
120 while(
nIndex && nCount2 > nSize )
129 const uno::Reference< embed::XEmbeddedObject > & xUnloadObj = pUnloadObj->
GetObjRef_NoInit();
134 if ( xUnloadObj.is() && bUnload )
136 uno::Reference< frame::XModel > xUnloadModel( xUnloadObj->getComponent(), uno::UNO_QUERY );
137 if ( xUnloadModel.is() )
141 if ( pCacheObj && pCacheObj != pUnloadObj )
143 uno::Reference< frame::XModel > xParentModel = pCacheObj->GetParentXModel();
144 if ( xUnloadModel == xParentModel )
154 if (bUnload && UnloadObj(*pUnloadObj))
157 RemoveObj(pUnloadObj);
158 nCount2 = std::min(nCount2 - 1, maObjs.size());
163 catch( uno::Exception& )
173 if ( pObj == pExistingObj )
179 std::vector<SdrOle2Obj*>::iterator it = std::find(
maObjs.begin(),
maObjs.end(), pObj);
180 bool bFound = it !=
maObjs.end();
191 if (!bFound || !
pTimer->IsActive())
197 std::vector<SdrOle2Obj*>::iterator it = std::find(
maObjs.begin(),
maObjs.end(), pObj);
221 bool bUnloaded =
false;
235 bUnloaded = rObj.
Unload();
244 bool bRetval =
false;
248 case drawing::FillStyle_SOLID:
255 case drawing::FillStyle_HATCH:
262 if(bFillHatchBackground)
268 rCol =
Color(aAverageColor);
273 case drawing::FillStyle_GRADIENT: {
278 rCol =
Color(aAverageColor);
283 case drawing::FillStyle_BITMAP:
287 const sal_uInt32 nWidth = aSize.
Width();
288 const sal_uInt32 nHeight = aSize.
Height();
289 if (nWidth <= 0 || nHeight <= 0)
299 const sal_uInt32 nMaxSteps(8);
300 const sal_uInt32 nXStep((nWidth > nMaxSteps) ? nWidth / nMaxSteps : 1);
301 const sal_uInt32 nYStep((nHeight > nMaxSteps) ? nHeight / nMaxSteps : 1);
304 for(sal_uInt32 nY(0); nY < nHeight; nY += nYStep)
306 for(sal_uInt32 nX(0); nX < nWidth; nX += nXStep)
308 const BitmapColor& rCol2 = pAccess->GetColor(nY, nX);
310 nRt += rCol2.GetRed();
311 nGn += rCol2.GetGreen();
312 nBl += rCol2.GetBlue();
336 std::unique_ptr<SdrOutliner> pOutl(
new SdrOutliner( pPool, nOutlinerMode ));
337 pOutl->SetEditTextObjectPool( pPool );
357 bool bLookOnly=pbOnlyEE!=
nullptr;
360 while (((bLookOnly && bOnly) || !bHas) && nWhich!=0) {
365 if ((eState==SfxItemState::DEFAULT && bInklDefaults) || eState==SfxItemState::SET) {
366 if (nWhich<EE_ITEMS_START || nWhich>
EE_ITEMS_END) bOnly=
false;
371 if (!bHas) bOnly=
false;
372 if (pbOnlyEE!=
nullptr) *pbOnlyEE=bOnly;
383 std::vector<WhichPair> buf;
384 for (
const auto & rPair : pOldWhichTable) {
385 auto const begin = rPair.first;
386 auto const end = rPair.second;
387 if (end < nRangeBeg || begin > nRangeEnd) {
389 }
else if (
begin >= nRangeBeg &&
end <= nRangeEnd) {
391 }
else if (
end <= nRangeEnd) {
392 buf.push_back({
begin, nRangeBeg - 1});
393 }
else if (
begin >= nRangeBeg) {
394 buf.push_back({nRangeEnd + 1,
end});
396 buf.push_back({
begin, nRangeBeg - 1});
397 buf.push_back({nRangeEnd + 1,
end});
400 std::unique_ptr<WhichPair[]> pNewWhichTable(
new WhichPair[buf.size()]);
401 std::copy(buf.begin(), buf.end(), pNewWhichTable.get());
477 bool impGetSdrObjListFillColor(
487 for(
size_t no(rList.
GetObjCount()); !bRet && no > 0; )
496 bRet = impGetSdrObjListFillColor(*pOL, rPnt, rTextEditPV, rVisLayers, rCol);
518 bool impGetSdrPageFillColor(
524 bool bSkipBackgroundShape)
526 bool bRet(impGetSdrObjListFillColor(rPage, rPnt, rTextEditPV, rVisLayers, rCol));
542 bRet = impGetSdrPageFillColor(rMasterPage, rPnt, rTextEditPV, aSet, rCol,
true);
547 if(!bRet && !bSkipBackgroundShape)
556 Color impCalcBackgroundColor(
568 const sal_uInt16 SPOTCOUNT(5);
569 Point aSpotPos[SPOTCOUNT];
570 Color aSpotColor[SPOTCOUNT];
573 sal_uInt32 nWidth14 = nWidth / 4;
574 sal_uInt32 nHeight14 = nHeight / 4;
575 sal_uInt32 nWidth34 = ( 3 * nWidth ) / 4;
576 sal_uInt32 nHeight34 = ( 3 * nHeight ) / 4;
579 for ( i = 0;
i < SPOTCOUNT;
i++ )
595 aSpotPos[
i].AdjustX(nWidth14 );
596 aSpotPos[
i].AdjustY(nHeight14 );
604 aSpotPos[
i].AdjustX(nWidth34 );
605 aSpotPos[
i].AdjustY(nHeight14 );
613 aSpotPos[
i].AdjustX(nWidth14 );
614 aSpotPos[
i].AdjustY(nHeight34 );
622 aSpotPos[
i].AdjustX(nWidth34 );
623 aSpotPos[
i].AdjustY(nHeight34 );
630 impGetSdrPageFillColor(rPage, aSpotPos[i], rTextEditPV, rTextEditPV.
GetVisibleLayers(), aSpotColor[i],
false);
633 sal_uInt16 aMatch[SPOTCOUNT];
635 for ( i = 0;
i < SPOTCOUNT;
i++ )
640 for ( sal_uInt16 j = 0; j < SPOTCOUNT; j++ )
644 if( aSpotColor[i] == aSpotColor[j] )
653 aBackground = aSpotColor[0];
655 for ( sal_uInt16 nMatchCount = SPOTCOUNT - 1; nMatchCount > 1; nMatchCount-- )
658 for ( i = 0;
i < SPOTCOUNT;
i++ )
660 if( aMatch[i] == nMatchCount )
662 aBackground = aSpotColor[
i];
708 aSnapRect.
Move(aPvOfs.X(), aPvOfs.Y());
710 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)
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::ColorStops & 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, sal_uInt16 nTol, 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)