26#include <osl/diagnose.h>
31#include <document.hxx>
51 OUString aFilter, OUString aOpt,
52 OUString aArea,
const ScRange& rDest,
53 sal_Int32 nRefreshDelaySeconds ) :
57 aFileName (
std::move(aFile)),
58 aFilterName (
std::move(aFilter)),
59 aOptions (
std::move(aOpt)),
60 aSourceArea (
std::move(aArea)),
66 OSL_ENSURE(
dynamic_cast< const ScDocShell *
>( pShell ) !=
nullptr,
"ScAreaLink with wrong ObjectShell");
83 if ( pDlg->Execute() ==
RET_OK )
86 Refresh( pDlg->GetURL(), pDlg->GetFilter(),
87 pDlg->GetSource(), pDlg->GetRefreshDelaySeconds() );
90 OUString aNewLinkName;
97 const OUString&,
const css::uno::Any& )
106 if (pLinkManager!=
nullptr)
108 OUString aFile, aArea, aFilter;
121 OUString aNewLinkName;
122 OUString aTmp = aFilter;
153 SvBaseLink::Closed();
162 const OUString& rArea)
170 OUString aNewLinkName;
175bool ScAreaLink::IsEqual( std::u16string_view rFile, std::u16string_view rFilter, std::u16string_view rOpt,
176 std::u16string_view rSource,
const ScRange& rDest )
const
191 if (
p &&
p->IsValidReference(rRange))
205 pDB->
GetArea(nTab,nCol1,nRow1,nCol2,nRow2);
206 rRange =
ScRange( nCol1,nRow1,nTab, nCol2,nRow2,nTab );
223 const OUString& rNewArea, sal_Int32 nNewRefreshDelaySeconds )
227 if (rNewFile.isEmpty() || rNewFilter.isEmpty())
234 bool bNewUrlName = (aNewUrl !=
aFileName);
252 ScDocShell* pSrcShell =
new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS);
260 if (aNewOpt.isEmpty())
269 aTempArea = rNewArea;
286 nWidth = nEndCol + 1;
287 nHeight = nEndRow + 2;
291 if (!aTempArea.isEmpty())
297 if(
FindExtRange( aTokenRange, rSrcDoc, aTempArea.getToken( 0,
';', nIdx ) ) )
301 nWidth = std::max( nWidth,
static_cast<SCCOL>(aTokenRange.
aEnd.
Col() - aTokenRange.
aStart.
Col() + 1) );
318 if (nWidth > 0 && nHeight > 0)
336 ScAddress(std::max(nOldEndX,nNewEndX), std::max(nOldEndY,nNewEndY), nDestTab) );
346 if ( nNewEndX != nOldEndX || nNewEndY != nOldEndY )
353 pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab );
358 pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab );
367 rDoc.
FitBlock( aOldRange, aNewRange );
373 if (nWidth > 0 && nHeight > 0)
377 for (
size_t nRange = 0; nRange < aSourceRanges.
size(); ++nRange)
379 ScRange const & rTokenRange( aSourceRanges[nRange]);
386 rSrcDoc.
CopyToClip(aClipParam, &aClipDoc, &aSourceMark,
false,
false);
410 OUString aErr =
ScResId(STR_LINKERROR);
419 pRedoDoc->InitUndo( rDoc, nDestTab, nDestTab );
423 std::make_unique<ScUndoUpdateAreaLink>(
m_pDocSh,
426 aNewUrl, rNewFilter, aNewOpt,
427 rNewArea, aNewRange, nNewRefreshDelaySeconds,
428 std::move(pUndoDoc), std::move(pRedoDoc),
bDoInsert ) );
452 nPaintEndX = rDoc.
MaxCol();
454 nPaintEndY = rDoc.
MaxRow();
458 ScRange(aDestPos.
Col(), aDestPos.
Row(), nDestTab, nPaintEndX, nPaintEndY, nDestTab),
471 VclMessageType::Info, VclButtonsType::Ok,
472 ScResId(STR_MSSG_DOSUBTOTALS_2)));
496 Refresh( aFileName, aFilterName, aSourceArea, GetRefreshDelaySeconds() );
IMPL_LINK_NOARG(ScAreaLink, RefreshHdl, Timer *, void)
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
virtual VclPtr< AbstractScLinkedAreaDlg > CreateScLinkedAreaDlg(weld::Widget *pParent)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
virtual ~ScAreaLink() override
void SetDestArea(const ScRange &rNew)
void SetSource(const OUString &rDoc, const OUString &rFlt, const OUString &rOpt, const OUString &rArea)
virtual void Closed() override
virtual void Edit(weld::Window *, const Link< SvBaseLink &, void > &rEndEditHdl) override
virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(const OUString &rMimeType, const css::uno::Any &rValue) override
bool IsEqual(std::u16string_view rFile, std::u16string_view rFilter, std::u16string_view rOpt, std::u16string_view rSource, const ScRange &rDest) const
bool Refresh(const OUString &rNewFile, const OUString &rNewFilter, const OUString &rNewArea, sal_Int32 nRefreshDelaySeconds)
static bool FindExtRange(ScRange &rRange, const ScDocument &rSrcDoc, const OUString &rAreaName)
ScAreaLink(SfxObjectShell *pShell, OUString aFile, OUString aFilter, OUString aOpt, OUString aArea, const ScRange &rDest, sal_Int32 nRefreshDelaySeconds)
ScDBData * findByUpperName(const OUString &rName)
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Create before modifications of the document and destroy thereafter.
void SetDocumentModified()
const ScDocument & GetDocument() const
static OUString GetWebQueryFilterName()
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
virtual SfxUndoManager * GetUndoManager() override
static SfxMedium * CreateMedium(const OUString &rFileName, std::shared_ptr< const SfxFilter > const &pFilter, const OUString &rOptions, weld::Window *pInteractionParent=nullptr)
Create SfxMedium for stream read with SfxFilter and filter options set at the medium's SfxItemSet.
static void RemoveAppPrefix(OUString &rFilterName)
static OUString GetOptions(const SfxMedium &rMedium)
ScSheetLimits & GetSheetLimits() const
SC_DLLPUBLIC void CopyFromClip(const ScRange &rDestRange, const ScMarkData &rMark, InsertDeleteFlags nInsFlag, ScDocument *pRefUndoDoc, ScDocument *pClipDoc, bool bResetCut=true, bool bAsLink=false, bool bIncludeFiltered=true, bool bSkipEmptyCells=false, const ScRangeList *pDestRanges=nullptr)
Paste data from a clipboard document into this document.
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC SCROW MaxRow() const
std::unique_ptr< ScRefreshTimerControl > const & GetRefreshTimerControlAddress() const
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
SC_DLLPUBLIC void CopyToClip(const ScClipParam &rClipParam, ScDocument *pClipDoc, const ScMarkData *pMarks, bool bKeepScenarioFlags, bool bIncludeObjects)
void SetInLinkUpdate(bool bSet)
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, InsertDeleteFlags nFlags, bool bMarked, ScDocument &rDestDoc, const ScMarkData *pMarks=nullptr, bool bColRowFlags=true)
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
void FitBlock(const ScRange &rOld, const ScRange &rNew, bool bClear=true)
SC_DLLPUBLIC bool GetCellArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow) const
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
bool IsUndoEnabled() const
bool CanFitBlock(const ScRange &rOld, const ScRange &rNew)
void BroadcastUno(const SfxHint &rHint)
SC_DLLPUBLIC SCTAB GetTableCount() const
bool ValidColRow(SCCOL nCol, SCROW nRow) const
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
static SC_DLLPUBLIC const CharClass & getCharClass()
void SetAreaLink(const ScAddress &rPos)
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
void SelectOneTable(SCTAB nTab)
void SetMarkArea(const ScRange &rRange)
SfxItemSet & GetItemSet()
void push_back(const ScRange &rRange)
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
sal_Int32 GetRefreshDelaySeconds() const
void SetRefreshHandler(const Link< Timer *, void > &rLink)
void SetRefreshControl(std::unique_ptr< ScRefreshTimerControl > const *pp)
void SetRefreshDelay(sal_Int32 nSeconds)
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxFilterContainer * GetFilterContainer() const
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
virtual SfxObjectFactory & GetFactory() const=0
css::uno::Reference< css::awt::XWindow > GetDialogParent(SfxMedium const *pMedium=nullptr)
bool DoLoad(SfxMedium *pMedium)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
bool getUserAllowsLinkUpdate() const
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
void SetName(const OUString &rLn)
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
constexpr OUStringLiteral SC_TEXT_CSV_FILTER_NAME
@ NOTE
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
#define LINK(Instance, Class, Member)
void MakeLnkName(OUString &rName, const OUString *pType, std::u16string_view rFile, std::u16string_view rLink, const OUString *pFilter)
OUString ScResId(TranslateId aId)
This struct stores general clipboard parameters associated with a ScDocument instance created in clip...