20#include <com/sun/star/chart2/data/XDataReceiver.hpp>
21#include <com/sun/star/awt/XRequestCallback.hpp>
22#include <com/sun/star/awt/Rectangle.hpp>
24#include <com/sun/star/embed/EmbedMisc.hpp>
25#include <com/sun/star/embed/XEmbeddedObject.hpp>
48#include <svtools/strings.hrc>
55#include <document.hxx>
58#include <fuinsert.hxx>
60#include <drawview.hxx>
63#include <undomanager.hxx>
64#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
76 uno::Reference < embed::XEmbeddedObject > xObj = pObj->
GetObjRef();
112class PopupCallback :
public cppu::WeakImplHelper<css::awt::XCallback>
119 : m_pViewShell(pViewShell)
124 virtual void SAL_CALL notify(
const css::uno::Any& aData)
override
127 if (!(aData >>= aProperties))
130 awt::Rectangle xRectangle;
131 sal_Int32 dimensionIndex = 0;
132 OUString sPivotTableName(
"DataPilot1");
134 for (beans::PropertyValue
const & rProperty : std::as_const(aProperties))
136 if (rProperty.Name ==
"Rectangle")
137 rProperty.Value >>= xRectangle;
138 if (rProperty.Name ==
"DimensionIndex")
139 rProperty.Value >>= dimensionIndex;
140 if (rProperty.Name ==
"PivotTableName")
141 rProperty.Value >>= sPivotTableName;
146 Point aPoint(xRectangle.X + aChartRect.
Left(), xRectangle.Y + aChartRect.
Top());
147 Size aSize(xRectangle.Width, xRectangle.Height);
149 m_pViewShell->
DoDPFieldPopup(sPivotTableName, dimensionIndex, aPoint, aSize);
160 uno::Reference < embed::XEmbeddedObject > xObj = pObj->
GetObjRef();
163 bool bErrorShown =
false;
186 aRect.
Move(aDelta.
X(), aDelta.
Y());
191 MapMode aMapMode( MapUnit::Map100thMM );
194 if ( pClient->
GetAspect() != embed::Aspects::MSOLE_ICON
195 && ( xObj->getStatus( pClient->
GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
199 if ( aDrawSize != aOleSize )
204 awt::Size aSz( aOleSize.
Width(), aOleSize.
Height() );
205 xObj->setVisualAreaSize( pClient->
GetAspect(), aSz );
226 nErr = pClient->
DoVerb( nVerb );
240 uno::Reference < embed::XComponentSupplier > xSup( xObj, uno::UNO_QUERY_THROW );
241 uno::Reference< chart2::data::XDataReceiver > xDataReceiver(
242 xSup->getComponent(), uno::UNO_QUERY_THROW );
243 uno::Reference< chart2::data::XRangeHighlighter > xRangeHighlighter(
244 xDataReceiver->getRangeHighlighter());
245 if (xRangeHighlighter.is())
247 uno::Reference< view::XSelectionChangeListener > xListener(
249 xRangeHighlighter->addSelectionChangeListener( xListener );
251 uno::Reference<awt::XRequestCallback> xPopupRequest(xDataReceiver->getPopupRequest());
252 if (xPopupRequest.is())
254 uno::Reference<awt::XCallback> xCallback(
new PopupCallback(
this, pObj));
256 xPopupRequest->addCallback(xCallback, aAny);
259 catch(
const uno::Exception & )
302 OSL_FAIL(
"no object for Verb found");
322 if( pEvent->DialogResult == ui::dialogs::ExecutableDialogResults::CANCEL )
324 ScTabView* pTabView = GetViewData().GetView();
338 SetDrawShell(
false );
341 ScMarkData aMark = GetViewData().GetMarkData();
342 GetViewData().GetViewShell()->SetMarkData(aMark);
346 OSL_ASSERT( pEvent->DialogResult == ui::dialogs::ExecutableDialogResults::OK );
353 sal_uInt16 nSlot = rReq.
GetSlot();
354 if (nSlot != SID_OBJECTRESIZE )
356 SC_MOD()->InputEnterHandler();
362 if ( pPoor && pPoor->
GetSlotID() == SID_DRAW_CHART )
377 case SID_INSERT_GRAPHIC:
382 case SID_INSERT_AVMEDIA:
387 case SID_INSERT_DIAGRAM:
393 case SID_INSERT_OBJECT:
394 case SID_INSERT_SMATH:
395 case SID_INSERT_FLOATINGFRAME:
399 case SID_INSERT_SIGNATURELINE:
400 case SID_EDIT_SIGNATURELINE:
402 const uno::Reference<frame::XModel>
xModel(
GetViewData().GetDocShell()->GetBaseModel() );
411 case SID_SIGN_SIGNATURELINE:
413 const uno::Reference<frame::XModel>
xModel(
423 case SID_INSERT_QRCODE:
424 case SID_EDIT_QRCODE:
426 const uno::Reference<frame::XModel>
xModel(
GetViewData().GetDocShell()->GetBaseModel() );
435 case SID_ADDITIONS_DIALOG:
437 OUString sAdditionsTag =
"";
441 sAdditionsTag = pStringArg->
GetValue();
450 case SID_OBJECTRESIZE:
472 if (nSdrObjKind == SdrObjKind::OLE2)
474 if (
static_cast<SdrOle2Obj*
>(pObj)->GetObjRef().is() )
496 case SID_FM_CREATE_FIELDCONTROL:
499 OSL_ENSURE( pDescriptorItem,
"SID_FM_CREATE_FIELDCONTROL: invalid request args!" );
516 Size aObjSize(pNewDBField->GetLogicRect().GetSize());
521 pNewDBField->SetLogicRect(aNewObjectRectangle);
524 if (
dynamic_cast<const SdrUnoObj*
>( pNewDBField.get() ) !=
nullptr )
528 if (
dynamic_cast<const SdrObjGroup*
>( pNewDBField.get() ) !=
nullptr)
530 SdrObjListIter aIter( *pNewDBField, SdrIterMode::DeepWithGroups );
534 if (
dynamic_cast<const SdrUnoObj*
>( pSubObj) !=
nullptr )
538 pSubObj = aIter.
Next();
550 case SID_FONTWORK_GALLERY_FLOATER:
562 bool bShared = pDocShell && pDocShell->
IsDocShared();
571 case SID_INSERT_DIAGRAM:
576 case SID_INSERT_SMATH:
581 case SID_INSERT_OBJECT:
582 case SID_INSERT_FLOATINGFRAME:
583 if ( bOle || bTabProt || bShared )
587 case SID_INSERT_AVMEDIA:
588 case SID_FONTWORK_GALLERY_FLOATER:
589 if ( bTabProt || bShared )
593 case SID_INSERT_SIGNATURELINE:
597 case SID_EDIT_SIGNATURELINE:
598 case SID_SIGN_SIGNATURELINE:
603 case SID_INSERT_QRCODE:
607 case SID_EDIT_QRCODE:
612 case SID_INSERT_GRAPHIC:
613 if (bTabProt || bShared)
617 bool bDisableInsertImage =
true;
620 bDisableInsertImage =
false;
626 bDisableInsertImage =
false;
630 if (bDisableInsertImage)
637 if (
GetViewData().GetDocument().GetLinkManager()->GetLinks().empty())
723 sal_uInt16 nSlot = rReq.
GetSlot();
730 bool bIsUndo = ( nSlot == SID_UNDO );
734 if ( pReqArgs && pReqArgs->
GetItemState( nSlot,
true, &pItem ) == SfxItemState::SET )
739 bool bRepair =
false;
740 if (pReqArgs && pReqArgs->
GetItemState(SID_REPAIRPACKAGE,
false, &pItem) == SfxItemState::SET)
743 sal_uInt16 nUndoOffset = 0;
749 if (pUndoManager->GetUndoActionCount() != 0)
750 pAction = pUndoManager->GetUndoAction();
754 if (pUndoManager->GetRedoActionCount() != 0)
755 pAction = pUndoManager->GetRedoAction();
764 sal_uInt16 nOffset = 0;
769 nUndoOffset += nOffset;
793 pUndoManager->UndoWithContext(aUndoRedoContext);
795 pUndoManager->RedoWithContext(aUndoRedoContext);
798 catch (
const uno::Exception& )
830 case SID_GETUNDOSTRINGS:
831 case SID_GETREDOSTRINGS:
836 std::vector<OUString> &aList = aStrLst.
GetList();
837 bool bIsUndo = ( nWhich == SID_GETUNDOSTRINGS );
853 if (pScUndoManager->GetUndoActionCount())
855 const SfxUndoAction* pAction = pScUndoManager->GetUndoAction();
879 if (pScUndoManager->GetRedoActionCount())
881 const SfxUndoAction* pAction = pScUndoManager->GetRedoAction();
PropertiesInfo aProperties
SfxApplication * SfxGetpApp()
sal_uInt16 GetValue() const
const OUString & GetValue() const
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
void ReduceInaccurate(unsigned nSignificantBits)
Base class for all functions.
sal_uInt16 GetSlotID() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
virtual void SetModified(bool=true) override
const ScDocument & GetDocument() const
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
SC_DLLPUBLIC ScUndoManager * GetUndoManager()
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
ScRangeList GetMarkedRanges() const
sal_uInt16 GetCurRefDlgId() const
void ExecuteUndo(SfxRequest &rReq)
void GetUndoState(SfxItemSet &rSet)
void ConnectObject(const SdrOle2Obj *pObj)
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
bool IsSignatureLineSigned()
virtual ErrCode DoVerb(sal_Int32 nVerb) override
bool IsSignatureLineSelected()
void ActivateObject(SdrOle2Obj *pObj, sal_Int32 nVerb)
void ExecDrawIns(SfxRequest &rReq)
void GetDrawInsState(SfxItemSet &rSet)
FuPoor * GetDrawFuncPtr()
ScViewData & GetViewData()
ScGridWindow * GetActiveWin()
ScDrawView * GetScDrawView()
void DoDPFieldPopup(std::u16string_view rPivotTableName, sal_Int32 nDimensionIndex, Point aPoint, Size aSize)
bool IsViewUndoActionIndependent(const SfxViewShell *pView, sal_uInt16 &rOffset) const
Checks if the topmost undo action owned by pView is independent from the topmost action undo action.
void SetUndoOffset(size_t nUndoOffset)
SfxDispatcher & GetDispatcher()
ScMarkData & GetMarkData()
ScDocument & GetDocument() const
ScDocShell * GetDocShell() const
ScDBFunc * GetView() const
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
bool isSignatureLineSigned() const
bool isSignatureLine() const
css::drawing::BarCode * getQrCode() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
void UnMarkAll(SdrPageView const *pPV=nullptr)
size_t GetMarkedObjectCount() const
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
SdrObject * GetMarkedSdrObj() const
virtual void NbcSetLayer(SdrLayerID nLayer)
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual void SetLogicRect(const tools::Rectangle &rRect)
virtual SdrObjKind GetObjIdentifier() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
Size GetOrigObjSize(MapMode const *pTargetMapMode=nullptr) const
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
virtual const tools::Rectangle & GetLogicRect() const override
virtual bool Undo() override
void Invalidate(sal_uInt16 nId)
void InvalidateAll(bool bWithMsg)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SfxShell * GetShell(sal_uInt16 nIdx) const
void SetNegativeX(bool bSet)
bool SetObjArea(const tools::Rectangle &)
void SetSizeScale(const Fraction &rScaleWidth, const Fraction &rScaleHeight)
bool IsObjectInPlaceActive() const
ErrCode DoVerb(sal_Int32 nVerb)
sal_Int64 GetAspect() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
const tools::Rectangle & GetValue() const
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
virtual SfxUndoManager * GetUndoManager()
SfxViewShell * GetViewShell() const
std::vector< OUString > & GetList()
virtual ViewShellId GetViewShellId() const
OUString GetRedoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
OUString GetUndoActionComment(size_t nNo=0, bool const i_currentLevel=CurrentLevel) const
virtual size_t GetRedoActionCount(bool const i_currentLevel=CurrentLevel) const
virtual size_t GetUndoActionCount(bool const i_currentLevel=CurrentLevel) const
const css::uno::Any & GetValue() const
SfxBindings & GetBindings()
SfxFrame & GetFrame() const
weld::Window * GetFrameWeld() const
ViewShellId GetViewShellId() const override
SfxViewFrame & GetViewFrame() const
SfxInPlaceClient * FindIPClient(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, vcl::Window *pObjParentWin) const
SfxInPlaceClient * GetIPClient() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static sal_uInt16 IsChart(const SvGlobalName &rName)
static SvxAbstractDialogFactory * Create()
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
virtual VclPtr< AbstractSignSignatureLineDialog > CreateSignSignatureLineDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XModel > xModel)=0
virtual VclPtr< AbstractSignatureLineDialog > CreateSignatureLineDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XModel > xModel, bool bEditExisting)=0
static VclAbstractDialogFactory * Create()
virtual VclPtr< AbstractAdditionsDialog > CreateAdditionsDialog(weld::Window *pParent, const OUString &sAdditionsTag)=0
virtual VclPtr< AbstractQrCodeGenDialog > CreateQrCodeGenDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XModel > xModel, bool bEditExisting)=0
static void execute(SdrView &rSdrView, SfxRequest const &rReq, SfxBindings &rBindings)
Point PixelToLogic(const Point &rDevicePt) const
Size GetOutputSizePixel() const
weld::Window * GetFrameWeld() const
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual SfxBindings & GetBindings() override
EmbeddedObjectRef * pObject
#define ERRCODE_ERROR_MASK
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
#define LINK(Instance, Class, Member)
constexpr T & temporary(T &&x)
#define ERRCODE_SO_NOTIMPL
Reference< XModel > xModel
SVT_DLLPUBLIC OUString SvtResId(TranslateId aId)
IMPL_LINK(ScTabViewShell, DialogClosedHdl, css::ui::dialogs::DialogClosedEvent *, pEvent, void)