20#include <config_features.h>
35#include <com/sun/star/frame/FrameSearchFlag.hpp>
36#include <com/sun/star/sheet/TableValidationVisibility.hpp>
48#include <document.hxx>
67#include <officecfg/Office/Common.hxx>
95 rRange =
ScRange( nCol, nRow, nTab, nCol, nRow, nTab );
101 if ( bDoEmptyCheckOnly )
115 bool bShrunk =
false;
117 nEndCol, nEndRow,
false,
false,
true );
148 rSortParam.
nCol2, rSortParam.
nRow2, nTab, eFillDir );
150 ::std::min( rSortParam.
nRow1 + sal::static_int_cast<SCROW>(
nCount ), rDoc.
MaxRow()), nTab,
167 rDoc.
GetDataArea( aExternalRange.
aStart.
Tab(), nStartCol, nStartRow, nEndCol, nEndRow,
false,
false );
187 short bResult = pWarningDlg->Execute();
192 pTabViewShell->
MarkRange( aExternalRange,
false );
210 class ScValidationRegisteredDlg
212 std::shared_ptr<SfxDialogController> m_xDlg;
214 ScValidationRegisteredDlg(
weld::Window* pParent, std::shared_ptr<SfxDialogController> xDlg)
215 : m_xDlg(
std::move(xDlg))
219 ~ScValidationRegisteredDlg()
230 sal_uInt16 nSlotId = rReq.
GetSlot();
244 case SID_VIEW_DATA_SOURCE_BROWSER:
249 bool bWasOpen =
false;
252 uno::Reference<frame::XFrame> xBeamerFrame =
xFrame->findFrame(
254 frame::FrameSearchFlag::CHILDREN);
255 if ( xBeamerFrame.is() )
284 case SID_REIMPORT_DATA:
300 if (!bOk && ! rReq.
IsAPI() )
308 case SID_REFRESH_DBAREA:
315 bool bContinue =
true;
320 bContinue = pTabViewShell->
ImportData( aImportParam );
348 case SID_SBA_BRW_INSERT:
350 OSL_FAIL(
"Deprecated Slot" );
371 case SID_SORT_DESCENDING:
372 case SID_SORT_ASCENDING:
391 if( nCol < aSortParam.
nCol1 )
392 nCol = aSortParam.
nCol1;
393 else if( nCol > aSortParam.
nCol2 )
394 nCol = aSortParam.
nCol2;
406 aSortParam.
maKeyState[0].bAscending = ( nSlotId == SID_SORT_ASCENDING );
411 pTabViewShell->
UISort( aSortParam );
445 aSortParam.
bByRow = pItem->GetValue();
449 aSortParam.
bCaseSens = pItem->GetValue();
460 sal_uInt16 nUserIndex = pItem->GetValue();
461 aSortParam.
bUserDef = ( nUserIndex != 0 );
468 if ( pArgs->
GetItemState( FN_PARAM_1,
true, &pItem ) == SfxItemState::SET )
470 aSortParam.
maKeyState[0].bDoSort = ( nField0 != 0 );
471 aSortParam.
maKeyState[0].nField = nField0 > 0 ? (nField0-1) : 0;
472 if ( pArgs->
GetItemState( FN_PARAM_2,
true, &pItem ) == SfxItemState::SET )
475 if ( pArgs->
GetItemState( FN_PARAM_3,
true, &pItem ) == SfxItemState::SET )
477 aSortParam.
maKeyState[1].bDoSort = ( nField1 != 0 );
478 aSortParam.
maKeyState[1].nField = nField1 > 0 ? (nField1-1) : 0;
479 if ( pArgs->
GetItemState( FN_PARAM_4,
true, &pItem ) == SfxItemState::SET )
482 if ( pArgs->
GetItemState( FN_PARAM_5,
true, &pItem ) == SfxItemState::SET )
484 aSortParam.
maKeyState[2].bDoSort = ( nField2 != 0 );
485 aSortParam.
maKeyState[2].nField = nField2 > 0 ? (nField2-1) : 0;
486 if ( pArgs->
GetItemState( FN_PARAM_6,
true, &pItem ) == SfxItemState::SET )
490 pTabViewShell->
UISort( aSortParam );
516 pDlg->SetCurPageId(
"criteria");
519 aContext.
maEndDialogFn = [pDlg, &rData, pTabViewShell](sal_Int32 nResult)
523 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
529 pTabViewShell->
UISort( rOutParam );
579 rData.GetDocShell()->CancelAutoDBRange();
583 pDlg->StartExecuteAsync(aContext);
594 OSL_FAIL(
"SID_FILTER with arguments?");
595 pTabViewShell->
Query(
601 sal_uInt16
nId = ScFilterDlgWrapper::GetChildWindowId();
610 case SID_SPECIAL_FILTER:
615 OSL_FAIL(
"SID_SPECIAL_FILTER with arguments?");
616 pTabViewShell->
Query(
622 sal_uInt16
nId = ScSpecialFilterDlgWrapper::GetChildWindowId();
634 if ( pReqArgs && (pQueryItem =
643 if ( nCurTab != nRefTab )
654 rReq.
Done( *pReqArgs );
669 pTabViewShell->
Query( aParam,
nullptr,
true );
674 case SID_AUTO_FILTER:
679 case SID_AUTOFILTER_HIDE:
684 case SID_PIVOT_TABLE:
687 if ( pReqArgs && (pPItem =
696 if ( nCurTab != nRefTab )
712#if HAVE_FEATURE_SCRIPTING
713 else if (rReq.
IsAPI())
719 case SID_OPENDLG_PIVOTTABLE:
722 case SID_DEFINE_DBNAME:
725 sal_uInt16
nId = ScDbNameDlgWrapper::GetChildWindowId();
749 std::vector<OUString> aList;
751 for (
const auto& rxDB : rDBs)
752 aList.push_back(rxDB->GetName());
757 if ( pDlg->Execute() ==
RET_OK )
759 OUString
aName = pDlg->GetSelectedEntry();
768 case SID_DATA_STREAMS:
775 aDialog.
Init(*pStrm);
781 case SID_DATA_STREAMS_PLAY:
790 case SID_DATA_STREAMS_STOP:
799 case SID_DATA_PROVIDER:
801 auto xDoc = o3tl::make_shared<ScDocument>();
802 xDoc->InsertTab(0,
"test");
811 case SID_DATA_PROVIDER_REFRESH:
815 for (
auto& rDataSource : rDataMapper.getDataSources())
817 rDataSource.refresh(&rDoc,
false);
821 case SID_MANAGE_XML_SOURCE:
825 case FID_CURRENTVALIDATION:
830 OSL_FAIL(
"later...");
837 OUString aExpr1, aExpr2;
839 sal_Int16 nListType = css::sheet::TableValidationVisibility::UNSORTED;
840 bool bShowHelp =
false;
841 OUString aHelpTitle, aHelpText;
842 bool bShowError =
false;
844 OUString aErrTitle, aErrText;
850 ScAddress aCursorPos( nCurX, nCurY, nTab );
860 sal_uInt32 nNumFmt = 0;
864 : SvNumFormatType::TIME;
873 bShowHelp = pOldData->
GetInput( aHelpTitle, aHelpText );
874 bShowError = pOldData->
GetErrMsg( aErrTitle, aErrText, eErrStyle );
877 aArgSet.
Put(
SfxUInt16Item( FID_VALID_CONDMODE, sal::static_int_cast<sal_uInt16>(eOper) ) );
886 aArgSet.
Put(
SfxUInt16Item( FID_VALID_ERRSTYLE, sal::static_int_cast<sal_uInt16>(eErrStyle) ) );
895 auto xDlg = std::make_shared<ScValidationDlg>(pParentWin, &aArgSet, pTabViewShell);
896 ScValidationRegisteredDlg aRegisterThatDlgExists(pParentWin, xDlg);
898 short nResult = xDlg->run();
901 const SfxItemSet* pOutSet = xDlg->GetOutputItemSet();
909 OUString aTemp1 = pItem->GetValue();
912 sal_uInt32 nNumIndex = 0;
915 aExpr1 = ::rtl::math::doubleToUString( nVal,
916 rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
926 OUString aTemp2 = pItem->GetValue();
929 sal_uInt32 nNumIndex = 0;
932 aExpr2 = ::rtl::math::doubleToUString( nVal,
933 rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
938 sal_Int32 wraparound = aExpr1.compareTo(aExpr2);
939 if (wraparound > 0) {
942 std::swap( aExpr1, aExpr2 );
946 std::swap( aExpr1, aExpr2 );
955 bBlank = pItem->GetValue();
957 nListType = pItem->GetValue();
960 bShowHelp = pItem->GetValue();
962 aHelpTitle = pItem->GetValue();
964 aHelpText = pItem->GetValue();
967 bShowError = pItem->GetValue();
971 aErrTitle = pItem->GetValue();
973 aErrText = pItem->GetValue();
976 aData.SetIgnoreBlank( bBlank );
977 aData.SetListType( nListType );
979 aData.SetInput(aHelpTitle, aHelpText);
983 aData.SetError(aErrTitle, aErrText, eErrStyle);
989 rReq.
Done( *pOutSet );
995 case SID_TEXT_TO_COLUMNS:
1013 aExport.
ExportStream( aStream, OUString(), SotClipboardFormatId::STRING );
1019 if ( pDlg->Execute() ==
RET_OK )
1022 OSL_ENSURE( pDocSh,
"ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDocSh is null!" );
1024 OUString aUndo =
ScResId( STR_UNDO_TEXTTOCOLUMNS );
1029 pDlg->GetOptions( aOptions );
1030 pDlg->SaveParameters();
1036 aImport.
ImportStream( aStream, OUString(), SotClipboardFormatId::STRING );
1056 bool bAutoFilter =
false;
1057 bool bAutoFilterTested =
false;
1065 case SID_REFRESH_DBAREA:
1088 case SID_SPECIAL_FILTER:
1100 case SID_SORT_ASCENDING:
1101 case SID_SORT_DESCENDING:
1104 case SID_OPENDLG_PIVOTTABLE:
1116 case SID_REIMPORT_DATA:
1128 case SID_VIEW_DATA_SOURCE_BROWSER:
1137 case SID_SBA_BRW_INSERT:
1145 case SID_AUTO_FILTER:
1146 case SID_AUTOFILTER_HIDE:
1148 if (!bAutoFilterTested)
1151 bAutoFilterTested =
true;
1153 if ( nWhich == SID_AUTO_FILTER )
1176 SCCOL nStartCol, nEndCol;
1177 SCROW nStartRow, nEndRow;
1178 SCTAB nStartTab, nEndTab;
1179 bool bAnyQuery =
false;
1182 nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab )
1187 if (nStartCol==nEndCol && nStartRow==nEndRow)
1198 ? rDoc.
GetDBAtArea( nStartTab, nStartCol, nStartRow, nEndCol, nEndRow )
1214 case SID_DEFINE_DBNAME:
1222 case SID_DATA_PROVIDER:
1224 case SID_DATA_PROVIDER_REFRESH:
1228 if (rDataMapper.getDataSources().empty())
1232 case SID_DATA_STREAMS:
1233 case SID_DATA_STREAMS_PLAY:
1234 case SID_DATA_STREAMS_STOP:
1236 if ( !officecfg::Office::Common::Misc::ExperimentalMode::get() )
1240 case SID_TEXT_TO_COLUMNS:
1249 case SID_MANAGE_XML_SOURCE:
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
static bool lcl_GetTextToColumnsRange(const ScViewData &rData, ScRange &rRange, bool bDoEmptyCheckOnly)
static bool lcl_GetSortParam(const ScViewData &rData, const ScSortParam &rSortParam)
sal_Int32 GetValue() const
const OUString & GetValue() const
const OUString & getNumDecimalSep() const
static void SetError(ErrCode)
virtual VclPtr< AbstractScSelEntryDlg > CreateScSelEntryDlg(weld::Window *pParent, const std::vector< OUString > &rEntryList)=0
virtual VclPtr< AbstractScSortWarningDlg > CreateScSortWarningDlg(weld::Window *pParent, const OUString &rExtendText, const OUString &rCurrentText)=0
virtual std::shared_ptr< ScAsyncTabController > CreateScSortDlg(weld::Window *pParent, const SfxItemSet *pArgSet)=0
virtual VclPtr< AbstractScDataFormDlg > CreateScDataFormDlg(weld::Window *pParent, ScTabViewShell *pTabViewShell)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
virtual VclPtr< AbstractScImportAsciiDlg > CreateScImportAsciiDlg(weld::Window *pParent, const OUString &aDatName, SvStream *pInStream, ScImportAsciiCall eCall)=0
void GetDBState(SfxItemSet &rSet)
void ExecuteDB(SfxRequest &rReq)
void ExecuteDataPilotDialog()
void ExecuteSubtotals(SfxRequest &rReq)
void ExecuteXMLSourceDialog()
ScConditionMode GetOperation() const
bool IsIgnoreBlank() const
OUString GetExpression(const ScAddress &rCursor, sal_uInt16 nPos, sal_uInt32 nNumFmt=0, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
Stores global named database ranges.
void GetImportParam(ScImportParam &rImportParam) const
SC_DLLPUBLIC bool HasQueryParam() const
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
void SetImportParam(const ScImportParam &rImportParam)
bool HasSubTotalParam() const
SC_DLLPUBLIC void GetSortParam(ScSortParam &rSortParam) const
bool HasSortParam() const
SC_DLLPUBLIC void GetQueryParam(ScQueryParam &rQueryParam) const
bool HasImportSelection() const
bool HasImportParam() const
void SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
static void ShowInBeamer(const ScImportParam &rParam, const SfxViewFrame *pFrame)
bool MakePivotTable(const ScDPSaveData &rData, const ScRange &rDest, bool bNewTable, const ScDPObject &rSource)
ScDBData * GetDBData(bool bMarkArea=true, ScGetDBMode eMode=SC_DB_MAKE, ScGetDBSelection eSel=ScGetDBSelection::Keep)
SC_DLLPUBLIC void Query(const ScQueryParam &rQueryParam, const ScRange *pAdvSource, bool bRecord)
void GotoDBArea(const OUString &rDBName)
void UISort(const ScSortParam &rSortParam)
void RepeatDB(bool bRecord=true)
bool ImportData(const ScImportParam &rParam)
void import(ScDocument &rDoc, bool bInternal=false)
const ScDocument & GetDocument() const
virtual SfxUndoManager * GetUndoManager() override
void RefreshPivotTables(const ScRange &rSource)
ScDPObject * GetDPAtBlock(const ScRange &rBlock) const
SC_DLLPUBLIC const ScValidationData * GetValidationEntry(sal_uInt32 nIndex) const
const ScDBData * GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC const ScDBData * GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
bool ShrinkToUsedDataArea(bool &o_bShrunk, SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bColumnsOnly, bool bStickyTopRow=false, bool bStickyLeftCol=false, ScDataAreaExtras *pDataAreaExtras=nullptr) const
Shrink a range to only include used data area.
SC_DLLPUBLIC sc::ExternalDataMapper & GetExternalDataMapper()
SC_DLLPUBLIC bool HasColHeader(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
sc::DocumentLinkManager & GetDocLinkManager()
ScChangeTrack * GetChangeTrack() const
bool IsBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
SC_DLLPUBLIC void GetDataArea(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bIncludeOld, bool bOnlyDown) const
Return the smallest area containing at least all contiguous cells having data.
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
bool HasAutoFilter(SCCOL nCol, SCROW nRow, SCTAB nTab)
SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, ScDirection eDir)
static SC_DLLPUBLIC LanguageType eLnge
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
void SetExportTextOptions(const ScExportTextOptions &options)
bool ExportStream(SvStream &, const OUString &rBaseURL, SotClipboardFormatId)
bool ImportStream(SvStream &, const OUString &rBaseURL, SotClipboardFormatId)
void SetImportBroadcast(bool b)
void SetOverwriting(const bool bOverwriting)
static void SetNoEndianSwap(SvStream &rStrm)
only if stream is only used in own (!) memory
void SetExtOptions(const ScAsciiOptions &rOpt)
void SetDelimiter(sal_Unicode c)
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
const ScRange & GetMarkArea() const
bool IsMultiMarked() const
SC_DLLPUBLIC void SetRefDialog(sal_uInt16 nId, bool bVis, SfxViewFrame *pViewFrm=nullptr)
Reference dialogs.
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
const ScDPSaveData & GetData() const
const ScRange & GetDestRange() const
bool GetAdvancedQuerySource(ScRange &rSource) const
const ScQueryParam & GetQueryData() const
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
static const WhichRangesContainer & GetRanges()
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
const ScDPObject * GetDialogDPObject() const
weld::Window * GetDialogParent()
parent window for dialogs Problem: OLE Server!
void AddHighlightRange(const ScRange &rRange, const Color &rColor)
void ErrorMessage(TranslateId pGlobStrId)
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
void ClearHighlightRanges()
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
ScValidationMode GetDataMode() const
sal_Int16 GetListType() const
bool GetInput(OUString &rTitle, OUString &rMsg) const
bool GetErrMsg(OUString &rTitle, OUString &rMsg, ScValidErrorStyle &rStyle) const
ScMarkData & GetMarkData()
ScDocument & GetDocument() const
ScDocShell * GetDocShell() const
ScGridWindow * GetActiveWin()
ScTabViewShell * GetViewShell() const
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
SCTAB GetRefTabNo() const
void SetValidation(const ScValidationData &rNew)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) 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)
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void AppendItem(const SfxPoolItem &)
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
SfxItemPool & GetPool() const
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
SfxChildWindow * GetChildWindow(sal_uInt16)
SfxFrame & GetFrame() const
weld::Window * GetFrameWeld() const
ViewShellId GetViewShellId() const override
SfxViewFrame & GetViewFrame() const
sal_uInt64 Seek(sal_uInt64 nPos)
void SetStreamCharSet(rtl_TextEncoding eCharSet)
void Init(const DataStream &rStrm)
DataStream * getDataStream()
weld::Window * GetFrameWeld() const
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
constexpr OUStringLiteral aData
#define ERRCODE_BASIC_BAD_PARAMETER
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALIDDATA(153)
#define BTN_CURRENT_SELECTION
These options control how multi-line cells are converted during export in certain lossy formats (such...
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
SC_DLLPUBLIC SCSIZE GetEntryCount() const
::std::vector< ScSortKeyState > maKeyState
ScDataAreaExtras aDataAreaExtras
sal_uInt16 GetSortKeyCount() const
std::function< void(sal_Int32)> maEndDialogFn
Reference< XFrame > xFrame
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
ScMarkType
States GetSimpleArea() returns for the underlying selection marks, so the caller can react if the res...
@ SC_MARK_SIMPLE_FILTERED