20#include <com/sun/star/embed/XEmbeddedObject.hpp>
39#include <LibreOfficeKit/LibreOfficeKitEnums.h>
45#include <osl/diagnose.h>
47#include <drawview.hxx>
50#include <document.hxx>
69#define SC_HANDLESIZE_BIG 9
148 pView->CreateAnchorHandles(
maHdlList, pAnchor->maStart);
171 rBindings.
Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
173 rBindings.
Invalidate( SID_ATTR_CHAR_POSTURE );
174 rBindings.
Invalidate( SID_ATTR_CHAR_UNDERLINE );
179 rBindings.
Invalidate( SID_ATTR_CHAR_OVERLINE );
181 rBindings.
Invalidate( SID_ATTR_CHAR_BACK_COLOR );
182 rBindings.
Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
183 rBindings.
Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
184 rBindings.
Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
185 rBindings.
Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
190 rBindings.
Invalidate( SID_ATTR_PARA_LINESPACE_10 );
191 rBindings.
Invalidate( SID_ATTR_PARA_LINESPACE_15 );
192 rBindings.
Invalidate( SID_ATTR_PARA_LINESPACE_20 );
195 rBindings.
Invalidate( SID_ATTR_CHAR_KERNING );
196 rBindings.
Invalidate( SID_ATTR_CHAR_STRIKEOUT );
197 rBindings.
Invalidate( SID_ATTR_CHAR_SHADOWED );
198 rBindings.
Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
199 rBindings.
Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
200 rBindings.
Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
201 rBindings.
Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
203 rBindings.
Invalidate( SID_TABLE_VERT_CENTER );
204 rBindings.
Invalidate( SID_TABLE_VERT_BOTTOM );
207 rBindings.
Invalidate( SID_ALIGN_ANY_HCENTER );
209 rBindings.
Invalidate( SID_ALIGN_ANY_JUSTIFIED );
228 AddUndo( std::make_unique<SdrUndoObjectLayerChange>( *pObj, pObj->
GetLayer(), nLayerNo) );
248 if(
dynamic_cast<const SdrUnoObj*
>( pObj) !=
nullptr )
270 if ( aPageSize.
Width() < 0 )
280 OSL_FAIL(
"Page not found");
316 nPPTX = aLogic.
X() / 1000.0;
317 nPPTY = aLogic.
Y() / 1000.0;
330 rDoc,
nTab, 0, 0, nEndCol, nEndRow,
pDev, aZoomX, aZoomY,
nPPTX,
nPPTY,
342 const size_t nCount = pPage->GetObjCount();
370 SC_MOD()->InputEnterHandler();
401 bool bSubShellSet =
false;
432 if ( nMarkCount && !bSubShellSet )
434 bool bOnlyControls =
true;
435 bool bOnlyGraf =
true;
436 for (
size_t i=0;
i<nMarkCount; ++
i)
439 if (
auto pObjGroup =
dynamic_cast<const SdrObjGroup*
>( pObj) )
441 const SdrObjList *pLst = pObjGroup->GetSubList();
443 if ( nListCount == 0 )
447 bOnlyControls =
false;
450 for (
size_t j = 0; j < nListCount; ++j )
454 if (
dynamic_cast<const SdrUnoObj*
>( pSubObj) ==
nullptr)
455 bOnlyControls =
false;
459 if ( !bOnlyControls && !bOnlyGraf )
break;
464 if (
dynamic_cast<const SdrUnoObj*
>( pObj) ==
nullptr)
465 bOnlyControls =
false;
470 if ( !bOnlyControls && !bOnlyGraf )
break;
481 else if(nMarkCount>1)
491 uno::Sequence< embed::VerbDescriptor > aVerbs;
492 if ( pOle2Obj && !bOle )
494 const uno::Reference < embed::XEmbeddedObject >& xObj = pOle2Obj->
GetObjRef();
495 OSL_ENSURE( xObj.is(),
"SdrOle2Obj without ObjRef" );
497 aVerbs = xObj->getSupportedVerbs();
547 bool bDontDeleteOutliner,
552 pObj, pPV, pWinL, bIsNewObj,
553 pGivenOutliner, pGivenOutlinerView, bDontDeleteOutliner,
554 bOnlyOneView, bGrabFocus );
567 OString sRectangle = aRectangle.
toString();
650 for (sal_uInt16
i=0;
i<nTabCount;
i++)
676 sal_uInt16 nObjectTab = 0;
683 for (sal_uInt16
i=0;
i<nTabCount && !pFound;
i++)
707 if ( nObjectTab !=
nTab )
709 DBG_ASSERT(
nTab == nObjectTab,
"Switching sheets did not work" );
722 MarkObj( pFound, pPV, bUnMark);
729 SCTAB nObjectTab = 0;
737 for (
SCTAB i=0;
i<nTabCount && !pFound;
i++)
740 OSL_ENSURE(pPage,
"Page ?");
761 if ( nObjectTab !=
nTab )
764 OSL_ENSURE(
nTab == nObjectTab,
"Switching sheets did not work" );
783 return ( pFound !=
nullptr );
789 bool bisMarked =
false;
807 nOptions |= SdrInsertFlags::DONTMARK;
821 if( ppCaptData ) *ppCaptData = pCaptData;
862 OSL_ENSURE( pNote,
"ScDrawView::DeleteMarked - cell note missing in document" );
867 OSL_ENSURE( aNoteData.
mxCaption.get() == pCaptObj,
"ScDrawView::DeleteMarked - caption object does not match" );
921 if (
auto pObjGroup =
dynamic_cast<const SdrObjGroup*
>( pObj) )
937 aOldStt =
pData->maStart;
961 Point aGridOff = aCurPosHmm - aOldPos;
971 if(
nullptr == pPageView)
977 assert(pPageWindow &&
"SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
979 if(
nullptr != pPageWindow)
997 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1002 if(
nullptr == pGridWin)
1010 if(
nullptr !=
pData &&
pData->maStart.IsValid())
1012 aOldStt =
pData->maStart;
1040 Point aGridOff(aCurPosHmm - aOldPos);
1046 if(bNegativePage && !bLOKActive)
1051 rTarget.setX(bNegativePage && bLOKActive ? -aGridOff.
X() : aGridOff.
X());
1062 if(
nullptr == pGridWin || rB2DRange.
isEmpty())
1091 Point aGridOff(aCurPosHmm - aOldPos);
1097 if(bNegativePage && !bLOKActive)
1102 rTarget.setX(bLOKActive && bNegativePage ? -aGridOff.
X() : aGridOff.
X());
1110 std::unique_ptr<SdrUndoManager> pUndoManager(
new SdrUndoManager);
1112 pUndoManager->SetDocShell(pDocShell);
1113 return pUndoManager;
1120 const OUString& rBeginUndoText,
1121 const OUString& rFile)
1123 if(
auto pGrafHitObj =
dynamic_cast< SdrGrafObj*
>(&rHitObject))
1127 pNewGrafObj->SetGraphic(rGraphic);
1132 pNewGrafObj->SetGraphicLink( rFile );
1135 return pNewGrafObj.get();
1139 AddUndo(std::make_unique<SdrUndoAttrObj>(rHitObject));
1158 class ObjectContactOfScDrawView final :
public ObjectContactOfPageView
1165 explicit ObjectContactOfScDrawView(
1168 const char* pDebugName);
1170 virtual bool supportsGridOffsets()
const override;
1171 virtual void calculateGridOffsetForViewOjectContact(
1173 const ViewObjectContact& rClient)
const override;
1174 virtual void calculateGridOffsetForB2DRange(
1181 ObjectContactOfScDrawView::ObjectContactOfScDrawView(
1184 const char* pDebugName)
1185 : ObjectContactOfPageView(rPageWindow, pDebugName),
1190 bool ObjectContactOfScDrawView::supportsGridOffsets()
const
1196 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1200 if(isOutputToPrinter())
1206 if(isOutputToPDFFile())
1215 void ObjectContactOfScDrawView::calculateGridOffsetForViewOjectContact(
1217 const ViewObjectContact& rClient)
const
1220 SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1222 if(
nullptr != pTargetSdrObject)
1230 void ObjectContactOfScDrawView::calculateGridOffsetForB2DRange(
1247 const char* pDebugName)
const
1249 return new sdr::contact::ObjectContactOfScDrawView(
constexpr auto convertTwipToMm100(N n)
MapUnit GetMapUnit() const
OutDevType GetOutDevType() const
virtual vcl::Window * GetOwnerWindow() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long getX() const
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
void SetDrawModified()
SetDrawModified - without Formula update.
virtual SfxUndoManager * GetUndoManager() override
SC_DLLPUBLIC tools::Long GetColOffset(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
SC_DLLPUBLIC std::unique_ptr< ScPostIt > ReleaseNote(const ScAddress &rPos)
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
SC_DLLPUBLIC bool GetTableArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bCalcHiddens=false) const
SfxObjectShell * GetDocumentShell() const
static bool IsChart(const SdrObject *pObject)
bool IsUndoEnabled() const
SC_DLLPUBLIC tools::Long GetRowOffset(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC SCTAB GetTableCount() const
static ScDrawObjData * GetObjDataTab(SdrObject *pObj, SCTAB nTab)
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
static OUString GetVisibleName(const SdrObject *pObj)
static void GetCellAnchorFromPosition(const tools::Rectangle &rRectangle, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bHiddenAsZero=true)
void BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
std::unique_ptr< SdrUndoGroup > GetCalcUndo()
static ScDrawObjData * GetNoteCaptionData(SdrObject *pObj, SCTAB nTab)
Returns the object data, if the passed object is a cell note caption.
static void CalcScale(const ScDocument &rDoc, SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const OutputDevice *pDev, const Fraction &rZoomX, const Fraction &rZoomY, double nPPTX, double nPPTY, Fraction &rScaleX, Fraction &rScaleY)
SdrObject * ApplyGraphicToObject(SdrObject &rHitObject, const Graphic &rGraphic, const OUString &rBeginUndoText, const OUString &rFile)
void SyncForGrid(SdrObject *pObj)
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true) override
std::unique_ptr< SdrDropMarkerOverlay > pDropMarker
bool calculateGridOffsetForB2DRange(const basegfx::B2DRange &rB2DRange, basegfx::B2DVector &rTarget) const
SdrEndTextEditKind ScEndTextEdit()
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
void LockInternalLayer(bool bLock=true)
Locks/unlocks the internal layer that contains caption objects of cell notes.
void ImplClearCalcDropMarker()
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
virtual void DeleteMarked() override
virtual void ModelHasChanged() override
bool calculateGridOffsetForSdrObject(SdrObject &rSdrObject, basegfx::B2DVector &rTarget) const
void UpdateIMap(SdrObject *pObj)
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
void InvalidateDrawTextAttrs()
bool SelectObject(std::u16string_view rName)
std::unique_ptr< SdrUndoManager > createLocalTextUndoManager() override
void LockCalcLayer(SdrLayerID nLayer, bool bLock)
Locks/unlocks the specified layer in the draw page.
bool InsertObjectSafe(SdrObject *pObj, SdrPageView &rPV)
void SetMarkedToLayer(SdrLayerID nLayerNo)
void SelectCurrentViewObject(std::u16string_view rName)
void MarkDropObj(SdrObject *pObj)
ScDocument & rDoc
needed ?
void GetScale(Fraction &rFractX, Fraction &rFractY) const
VclPtr< OutputDevice > pDev
bool HasMarkedInternal() const
void resetGridOffsetsForAllSdrPageViews()
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const override
bool HasMarkedControl() const
void LockBackgroundLayer(bool bLock)
Locks/unlocks the background layer that contains background objects.
void UpdateUserViewOptions()
virtual void DoConnect(SdrOle2Obj *pOleObj) override
virtual void MarkListHasChanged() override
virtual void AddCustomHdl() override
SdrObject * GetObjectByName(std::u16string_view rName)
virtual ~ScDrawView() override
SdrObject * GetMarkedNoteCaption(ScDrawObjData **ppCaptData)
Returns the selected object, if it is the caption object of a cell note.
bool GetObjectIsMarked(const SdrObject *pObject)
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
sal_uInt16 GetCurRefDlgId() const
void SetGraphicShell(bool bActive)
void SetChartShell(bool bActive)
void SetDrawTextUndo(SfxUndoManager *pUndoMgr)
void ConnectObject(const SdrOle2Obj *pObj)
void SetDrawFormShell(bool bActive)
void SetOleObjectShell(bool bActive)
void SetMediaShell(bool bActive)
bool IsDrawTextShell() const
void SetDrawShell(bool bActive)
void MakeVisible(const tools::Rectangle &rHMMRect)
void ScrollToObject(const SdrObject *pDrawObj)
void CheckSelectionTransfer()
bool IsDrawSelMode() const
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
const ScViewOptions & GetOptions() const
const Fraction & GetZoomY() const
ScDocShell * GetDocShell() const
ScGridWindow * GetActiveWin()
ScTabViewShell * GetViewShell() const
ScDBFunc * GetView() const
ScSplitPos GetActivePart() const
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
const Fraction & GetZoomX() const
SfxObjectShell * GetSfxDocShell() const
SfxBindings & GetBindings()
const ScGridOptions & GetGridOptions() const
bool GetOption(ScViewOption eOpt) const
void SetCreateMode(bool bOn=true)
void SetWorkArea(const tools::Rectangle &rRect)
void SetDragStripes(bool bOn)
void ReplaceObjectAtView(SdrObject *pOldObj, SdrPageView &rPV, SdrObject *pNewObj, bool bMark=true)
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
SdrLayer * GetLayerPerID(SdrLayerID nID)
const OUString & GetName() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
void SetFrameDragSingles(bool bOn=true)
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
void SetMarkHdlSizePixel(sal_uInt16 nSiz)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SdrLayerAdmin & GetLayerAdmin() const
SdrTextObj * GetTextEditObject() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
const OutlinerView * GetTextEditOutlinerView() const
virtual void ModelHasChanged() override
virtual bool IsTextEdit() const final override
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
static rtl::Reference< T > Clone(T const &rObj, SdrModel &rTargetModel)
SdrModel & getSdrModelFromSdrObject() const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
virtual SdrObjKind GetObjIdentifier() const
virtual SdrLayerID GetLayer() const
virtual void SetLayer(SdrLayerID nLayer)
virtual const tools::Rectangle & GetLogicRect() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
sal_uInt32 PageWindowCount() const
SdrPage * GetPage() const
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
const sdr::contact::ObjectContact & GetObjectContact() const
void SetLayerLocked(const OUString &rName, bool bLock=true)
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
void SetActiveLayer(const OUString &rName)
void SetGridFine(const Size &rSiz)
void SetHitTolerancePixel(sal_uInt16 nVal)
void SetSwapAsynchron(bool bJa=true)
sal_uInt32 PaintWindowCount() const
bool IsLayerLocked(const OUString &rName) const
void SetGridCoarse(const Size &rSiz)
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
void SetMinMoveDistancePixel(sal_uInt16 nVal)
void SetLayerVisible(const OUString &rName, bool bShow)
void SetGridVisible(bool bOn)
OutputDevice & GetOutputDevice() const
void SetSnapGridWidth(const Fraction &rX, const Fraction &rY)
void SetGridSnap(bool bOn)
void SetSnapEnabled(bool bOn)
void EnableExtendedMouseEventDispatcher(bool bOn)
virtual void DeleteMarked()
void EnableExtendedKeyInputDispatcher(bool bOn)
void Invalidate(sal_uInt16 nId)
void InvalidateAll(bool bWithMsg)
css::uno::Reference< css::frame::XController > GetController() const
bool IsObjectInPlaceActive() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
void SetVerbs(const css::uno::Sequence< css::embed::VerbDescriptor > &aVerbs)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
SfxFrame & GetFrame() const
SfxViewFrame & GetViewFrame() const
SfxInPlaceClient * GetIPClient() const
constexpr tools::Long Width() const
bool GetGridVisible() const
bool GetUseGridSnap() const
sal_uInt32 GetFieldDivisionY() const
sal_uInt32 GetFieldDrawY() const
sal_uInt32 GetFieldDrawX() const
sal_uInt32 GetFieldDivisionX() const
const MapMode & GetMapMode() const
Point PixelToLogic(const Point &rDevicePt) const
#define DBG_ASSERT(sCon, aError)
#define SC_HANDLESIZE_BIG
const ScDrawView & mrScDrawView
EmbeddedObjectRef * pObject
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_INTERN(2)
constexpr SdrLayerID SC_LAYER_BACK(1)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
std::unique_ptr< sal_Int32[]> pData
B2IRange fround(const B2DRange &rRange)
bool isCompatFlagSet(Compat flag)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OUString ScResId(TranslateId aId)
Internal data for a cell annotation.
rtl::Reference< SdrCaptionObj > mxCaption
Initial data for invisible notes without SdrObject.
Reference< XController > xController