Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / scabstdlg.hxx
blob7a94af5f6fe9afdb6984b0a4c8bdbe69aba8f3f4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
23 #include <sfx2/tabdlg.hxx>
24 #include <tools/fldunit.hxx>
25 #include <vcl/abstdlg.hxx>
26 #include "global.hxx"
27 #include "pivot.hxx"
28 #include <i18nlangtag/lang.h>
29 #include <asciiopt.hxx>
31 class ScAutoFormat;
32 class ScAutoFormatData;
33 class ScDocument;
34 struct ScImportSourceDesc;
35 class ScViewData;
36 class ScQueryItem;
37 class ScImportOptions;
38 class SfxStyleSheetBase;
39 class SfxAbstractTabDialog;
40 class ScDPObject;
41 struct ScDPNumGroupInfo;
42 class ScTabViewShell;
43 class ScConditionalFormat;
44 class ScConditionalFormatList;
45 class Date;
46 class SdrView;
47 enum class CreateNameFlags;
48 enum class CellShiftDisabledFlags;
50 namespace com::sun::star::sheet { struct DataPilotFieldReference; }
52 class ScAsyncTabController
54 public:
55 virtual ~ScAsyncTabController() = default;
56 virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) = 0;
57 virtual const SfxItemSet* GetOutputItemSet() const = 0;
58 virtual void SetCurPageId( const OUString &rName ) = 0;
61 class AbstractScImportAsciiDlg : public VclAbstractDialog
63 protected:
64 virtual ~AbstractScImportAsciiDlg() override = default;
65 public:
66 virtual void GetOptions( ScAsciiOptions& rOpt ) = 0;
67 virtual void SaveParameters() = 0;
70 class AbstractScAutoFormatDlg : public VclAbstractDialog
72 protected:
73 virtual ~AbstractScAutoFormatDlg() override = default;
74 public:
75 virtual sal_uInt16 GetIndex() const = 0 ;
76 virtual OUString GetCurrFormatName() = 0;
79 class AbstractScColRowLabelDlg : public VclAbstractDialog
81 protected:
82 virtual ~AbstractScColRowLabelDlg() override = default;
83 public:
84 virtual bool IsCol() = 0;
85 virtual bool IsRow() = 0;
88 class AbstractScCondFormatManagerDlg : public VclAbstractDialog
90 protected:
91 virtual ~AbstractScCondFormatManagerDlg() override = default;
92 public:
93 virtual std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList() = 0;
95 virtual bool CondFormatsChanged() const = 0;
97 virtual void SetModified() = 0;
99 virtual ScConditionalFormat* GetCondFormatSelected() = 0;
102 class AbstractScDataPilotDatabaseDlg :public VclAbstractDialog
104 protected:
105 virtual ~AbstractScDataPilotDatabaseDlg() override = default;
106 public:
107 virtual void GetValues( ScImportSourceDesc& rDesc ) = 0;
110 class AbstractScDataPilotSourceTypeDlg : public VclAbstractDialog
112 protected:
113 virtual ~AbstractScDataPilotSourceTypeDlg() override = default;
114 public:
115 virtual bool IsDatabase() const = 0;
116 virtual bool IsExternal() const = 0;
117 virtual bool IsNamedRange() const = 0;
118 virtual OUString GetSelectedNamedRange() const = 0;
119 virtual void AppendNamedRange(const OUString& rName) = 0;
122 class AbstractScDataPilotServiceDlg : public VclAbstractDialog
124 protected:
125 virtual ~AbstractScDataPilotServiceDlg() override = default;
126 public:
127 virtual OUString GetServiceName() const = 0;
128 virtual OUString GetParSource() const = 0 ;
129 virtual OUString GetParName() const = 0 ;
130 virtual OUString GetParUser() const = 0;
131 virtual OUString GetParPass() const = 0;
134 class AbstractScDeleteCellDlg : public VclAbstractDialog
136 protected:
137 virtual ~AbstractScDeleteCellDlg() override = default;
138 public:
139 virtual DelCellCmd GetDelCellCmd() const = 0;
142 //for dataform
143 class AbstractScDataFormDlg : public VclAbstractDialog
145 protected:
146 virtual ~AbstractScDataFormDlg() override = default;
149 class AbstractScDeleteContentsDlg: public VclAbstractDialog
151 protected:
152 virtual ~AbstractScDeleteContentsDlg() override = default;
153 public:
154 virtual void DisableObjects() = 0 ;
155 virtual InsertDeleteFlags GetDelContentsCmdBits() const = 0;
158 class AbstractScFillSeriesDlg: public VclAbstractDialog
160 protected:
161 virtual ~AbstractScFillSeriesDlg() override = default;
162 public:
163 virtual FillDir GetFillDir() const = 0;
164 virtual FillCmd GetFillCmd() const = 0;
165 virtual FillDateCmd GetFillDateCmd() const = 0;
166 virtual double GetStart() const = 0;
167 virtual double GetStep() const = 0;
168 virtual double GetMax() const = 0;
169 virtual OUString GetStartStr() const = 0;
170 virtual void SetEdStartValEnabled(bool bFlag) = 0;
173 class AbstractScGroupDlg : public VclAbstractDialog
175 protected:
176 virtual ~AbstractScGroupDlg() override = default;
177 public:
178 virtual bool GetColsChecked() const = 0;
181 class AbstractScInsertCellDlg : public VclAbstractDialog
183 protected:
184 virtual ~AbstractScInsertCellDlg() override = default;
185 public:
186 virtual InsCellCmd GetInsCellCmd() const = 0;
189 class AbstractScInsertContentsDlg : public VclAbstractDialog
191 protected:
192 virtual ~AbstractScInsertContentsDlg() override = default;
193 public:
194 virtual InsertDeleteFlags GetInsContentsCmdBits() const = 0;
195 virtual ScPasteFunc GetFormulaCmdBits() const = 0 ;
196 virtual bool IsSkipEmptyCells() const = 0;
197 virtual bool IsLink() const = 0;
198 virtual void SetFillMode( bool bSet ) = 0;
199 virtual void SetOtherDoc( bool bSet ) = 0;
200 virtual bool IsTranspose() const = 0;
201 virtual void SetChangeTrack( bool bSet ) = 0;
202 virtual void SetCellShiftDisabled( CellShiftDisabledFlags nDisable ) = 0;
203 virtual InsCellCmd GetMoveMode() = 0;
206 class AbstractScInsertTableDlg : public VclAbstractDialog
208 protected:
209 virtual ~AbstractScInsertTableDlg() override = default;
210 public:
211 virtual bool GetTablesFromFile() = 0;
212 virtual bool GetTablesAsLink() = 0;
213 virtual const OUString* GetFirstTable( sal_uInt16* pN = nullptr ) = 0;
214 virtual ScDocShell* GetDocShellTables() = 0;
215 virtual bool IsTableBefore() = 0;
216 virtual sal_uInt16 GetTableCount() = 0;
217 virtual const OUString* GetNextTable( sal_uInt16* pN ) = 0;
221 class AbstractScSelEntryDlg : public VclAbstractDialog
223 protected:
224 virtual ~AbstractScSelEntryDlg() override = default;
225 public:
226 virtual OUString GetSelectedEntry() const = 0;
229 class AbstractScLinkedAreaDlg : public VclAbstractDialog
231 protected:
232 virtual ~AbstractScLinkedAreaDlg() override = default;
233 public:
234 virtual void InitFromOldLink( const OUString& rFile, const OUString& rFilter,
235 const OUString& rOptions, const OUString& rSource,
236 sal_Int32 nRefreshDelaySeconds ) = 0;
237 virtual OUString GetURL() = 0;
238 virtual OUString GetFilter() = 0; // may be empty
239 virtual OUString GetOptions() = 0; // filter options
240 virtual OUString GetSource() = 0; // separated by ";"
241 virtual sal_Int32 GetRefreshDelaySeconds() = 0; // 0 if disabled
244 class AbstractScMetricInputDlg : public VclAbstractDialog
246 protected:
247 virtual ~AbstractScMetricInputDlg() override = default;
248 public:
249 virtual int GetInputValue() const = 0;
252 class AbstractScMoveTableDlg : public VclAbstractDialog
254 protected:
255 virtual ~AbstractScMoveTableDlg() override = default;
256 public:
257 virtual sal_uInt16 GetSelectedDocument () const = 0;
258 virtual sal_uInt16 GetSelectedTable () const = 0;
259 virtual bool GetCopyTable () const = 0;
260 virtual bool GetRenameTable () const = 0;
261 virtual void GetTabNameString( OUString& rString ) const = 0;
262 virtual void SetForceCopyTable () = 0;
263 virtual void EnableRenameTable (bool bFlag) = 0;
266 class AbstractScNameCreateDlg : public VclAbstractDialog // Manage Name Dialog
268 protected:
269 virtual ~AbstractScNameCreateDlg() override = default;
270 public:
271 virtual CreateNameFlags GetFlags() const = 0;
274 class AbstractScNamePasteDlg : public VclAbstractDialog
276 protected:
277 virtual ~AbstractScNamePasteDlg() override = default;
278 public:
279 virtual std::vector<OUString> GetSelectedNames() const = 0;
282 class AbstractScPivotFilterDlg : public VclAbstractDialog
284 protected:
285 virtual ~AbstractScPivotFilterDlg() override = default;
286 public:
287 virtual const ScQueryItem& GetOutputItem() = 0;
290 class AbstractScDPFunctionDlg : public VclAbstractDialog
292 protected:
293 virtual ~AbstractScDPFunctionDlg() override = default;
294 public:
295 virtual PivotFunc GetFuncMask() const = 0;
296 virtual css::sheet::DataPilotFieldReference GetFieldRef() const = 0;
297 virtual void Response(int nResponse) = 0;
300 class AbstractScDPSubtotalDlg : public VclAbstractDialog
302 protected:
303 virtual ~AbstractScDPSubtotalDlg() override = default;
304 public:
305 virtual PivotFunc GetFuncMask() const = 0;
306 virtual void FillLabelData( ScDPLabelData& rLabelData ) const = 0;
307 virtual void Response(int nResponse) = 0;
310 class AbstractScDPNumGroupDlg : public VclAbstractDialog
312 protected:
313 virtual ~AbstractScDPNumGroupDlg() override = default;
314 public:
315 virtual ScDPNumGroupInfo GetGroupInfo() const = 0;
318 class AbstractScDPDateGroupDlg : public VclAbstractDialog
320 protected:
321 virtual ~AbstractScDPDateGroupDlg() override = default;
322 public:
323 virtual ScDPNumGroupInfo GetGroupInfo() const = 0;
324 virtual sal_Int32 GetDatePart() const = 0;
327 class AbstractScDPShowDetailDlg : public VclAbstractDialog
329 protected:
330 virtual ~AbstractScDPShowDetailDlg() override = default;
331 public:
332 virtual OUString GetDimensionName() const = 0;
335 class AbstractScNewScenarioDlg : public VclAbstractDialog
337 protected:
338 virtual ~AbstractScNewScenarioDlg() override = default;
339 public:
341 virtual void SetScenarioData( const OUString& rName, const OUString& rComment,
342 const Color& rColor, ScScenarioFlags nFlags ) = 0;
344 virtual void GetScenarioData( OUString& rName, OUString& rComment,
345 Color& rColor, ScScenarioFlags& rFlags ) const = 0;
348 class AbstractScShowTabDlg : public VclAbstractDialog
350 protected:
351 virtual ~AbstractScShowTabDlg() override = default;
352 public:
353 virtual void Insert( const OUString& rString, bool bSelected ) = 0;
354 virtual void SetDescription(const OUString& rTitle, const OUString& rFixedText, const OUString& nDlgHelpId, const OUString& nLbHelpId ) = 0;
355 virtual std::vector<sal_Int32> GetSelectedRows() const = 0;
356 virtual OUString GetEntry(sal_Int32 nPos) const = 0;
359 class AbstractScSortWarningDlg : public VclAbstractDialog
361 protected:
362 virtual ~AbstractScSortWarningDlg() override = default;
365 class AbstractScStringInputDlg : public VclAbstractDialog
367 protected:
368 virtual ~AbstractScStringInputDlg() override = default;
369 public:
370 virtual OUString GetInputString() const = 0;
373 class AbstractScTabBgColorDlg : public VclAbstractDialog
375 protected:
376 virtual ~AbstractScTabBgColorDlg() override = default;
377 public:
378 virtual void GetSelectedColor( Color& rColor ) const = 0;
381 class AbstractScImportOptionsDlg : public VclAbstractDialog
383 protected:
384 virtual ~AbstractScImportOptionsDlg() override = default;
385 public:
386 virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0;
387 virtual void SaveImportOptions() const = 0;
390 class AbstractScTextImportOptionsDlg : public VclAbstractDialog
392 protected:
393 virtual ~AbstractScTextImportOptionsDlg() override = default;
394 public:
395 virtual LanguageType GetLanguageType() const = 0;
396 virtual bool IsDateConversionSet() const = 0;
397 virtual bool IsScientificConversionSet() const = 0;
398 virtual bool IsKeepAskingSet() const = 0;
401 class AbstractScGoToTabDlg : public VclAbstractDialog
403 protected:
404 virtual ~AbstractScGoToTabDlg() override = default;
405 public:
406 virtual void Insert( const OUString& rString, bool bSelected ) = 0;
407 virtual void SetDescription(const OUString& rTitle, const OUString& rEntryLabel, const OUString& rListLabel,
408 const OUString& rDlgHelpId, const OUString& rEnHelpId, const OUString& rLbHelpId) = 0;
409 virtual OUString GetSelectedEntry() const = 0;
412 class ScAbstractDialogFactory
414 public:
415 SC_DLLPUBLIC static ScAbstractDialogFactory* Create();
417 virtual VclPtr<AbstractScImportAsciiDlg> CreateScImportAsciiDlg(weld::Window* pParent,
418 const OUString& aDatName,
419 SvStream* pInStream,
420 ScImportAsciiCall eCall) = 0;
422 virtual VclPtr<AbstractScTextImportOptionsDlg> CreateScTextImportOptionsDlg(weld::Window* pParent) = 0;
424 virtual VclPtr<AbstractScAutoFormatDlg> CreateScAutoFormatDlg(weld::Window* pParent,
425 ScAutoFormat* pAutoFormat,
426 const ScAutoFormatData* pSelFormatData,
427 ScViewData& rViewData) = 0;
428 virtual VclPtr<AbstractScColRowLabelDlg> CreateScColRowLabelDlg (weld::Window* pParent,
429 bool bCol,
430 bool bRow) = 0;
432 virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) = 0;
434 virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList ) = 0;
436 virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) = 0;
438 virtual VclPtr<AbstractScDataPilotSourceTypeDlg> CreateScDataPilotSourceTypeDlg(weld::Window* pParent,
439 bool bEnableExternal) = 0;
441 virtual VclPtr<AbstractScDataPilotServiceDlg> CreateScDataPilotServiceDlg(weld::Window* pParent,
442 const std::vector<OUString>& rServices) = 0;
444 virtual VclPtr<AbstractScDeleteCellDlg> CreateScDeleteCellDlg(weld::Window* pParent, bool bDisallowCellMove) = 0 ;
446 //for dataform
447 virtual VclPtr<AbstractScDataFormDlg> CreateScDataFormDlg(weld::Window* pParent, ScTabViewShell* pTabViewShell) = 0;
449 virtual VclPtr<AbstractScDeleteContentsDlg> CreateScDeleteContentsDlg(weld::Window* pParent) = 0;
450 virtual VclPtr<AbstractScFillSeriesDlg> CreateScFillSeriesDlg(weld::Window* pParent,
451 ScDocument& rDocument,
452 FillDir eFillDir,
453 FillCmd eFillCmd,
454 FillDateCmd eFillDateCmd,
455 const OUString& aStartStr,
456 double fStep,
457 double fMax,
458 SCSIZE nSelectHeight,
459 SCSIZE nSelectWidth,
460 sal_uInt16 nPossDir) = 0;
462 virtual VclPtr<AbstractScGroupDlg> CreateAbstractScGroupDlg(weld::Window* pParent, bool bUnGroup = false) = 0;
464 virtual VclPtr<AbstractScInsertCellDlg> CreateScInsertCellDlg(weld::Window* pParent,
465 bool bDisallowCellMove) = 0;
467 virtual VclPtr<AbstractScInsertContentsDlg> CreateScInsertContentsDlg(weld::Window* pParent,
468 const OUString* pStrTitle = nullptr) = 0;
470 virtual VclPtr<AbstractScInsertTableDlg> CreateScInsertTableDlg(weld::Window* pParent, ScViewData& rViewData,
471 SCTAB nTabCount, bool bFromFile) = 0;
473 virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg(weld::Window* pParent, const std::vector<OUString> &rEntryList) = 0;
474 virtual VclPtr<AbstractScLinkedAreaDlg> CreateScLinkedAreaDlg(weld::Widget* pParent) = 0;
476 virtual VclPtr<AbstractScMetricInputDlg> CreateScMetricInputDlg(weld::Window* pParent,
477 const OUString& sDialogName,
478 tools::Long nCurrent,
479 tools::Long nDefault,
480 FieldUnit eFUnit,
481 sal_uInt16 nDecimals,
482 tools::Long nMaximum,
483 tools::Long nMinimum = 0 ) = 0;
485 virtual VclPtr<AbstractScMoveTableDlg> CreateScMoveTableDlg(weld::Window * pParent,
486 const OUString& rDefault) = 0;
488 virtual VclPtr<AbstractScNameCreateDlg> CreateScNameCreateDlg(weld::Window * pParent,
489 CreateNameFlags nFlags) = 0;
491 virtual VclPtr<AbstractScNamePasteDlg> CreateScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell) = 0;
493 virtual VclPtr<AbstractScPivotFilterDlg> CreateScPivotFilterDlg(weld::Window* pParent,
494 const SfxItemSet& rArgSet,
495 sal_uInt16 nSourceTab) = 0;
497 virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Widget* pParent,
498 const ScDPLabelDataVector& rLabelVec,
499 const ScDPLabelData& rLabelData,
500 const ScPivotFuncData& rFuncData ) = 0;
502 virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Widget* pParent,
503 ScDPObject& rDPObj,
504 const ScDPLabelData& rLabelData,
505 const ScPivotFuncData& rFuncData,
506 const ScDPNameVec& rDataFields) = 0;
508 virtual VclPtr<AbstractScDPNumGroupDlg> CreateScDPNumGroupDlg(weld::Window* pParent,
509 const ScDPNumGroupInfo& rInfo) = 0;
511 virtual VclPtr<AbstractScDPDateGroupDlg> CreateScDPDateGroupDlg(weld::Window* pParent,
512 const ScDPNumGroupInfo& rInfo,
513 sal_Int32 nDatePart,
514 const Date& rNullDate ) = 0;
516 virtual VclPtr<AbstractScDPShowDetailDlg> CreateScDPShowDetailDlg(weld::Window* pParent,
517 ScDPObject& rDPObj,
518 css::sheet::DataPilotFieldOrientation nOrient ) = 0;
520 virtual VclPtr<AbstractScNewScenarioDlg> CreateScNewScenarioDlg(weld::Window* pParent, const OUString& rName,
521 bool bEdit, bool bSheetProtected) = 0;
522 virtual VclPtr<AbstractScShowTabDlg> CreateScShowTabDlg(weld::Window* pParent) = 0;
524 virtual VclPtr<AbstractScStringInputDlg> CreateScStringInputDlg(weld::Window* pParent,
525 const OUString& rTitle,
526 const OUString& rEditTitle,
527 const OUString& rDefault,
528 const OUString& rHelpId,
529 const OUString& rEditHelpId) = 0;
531 virtual VclPtr<AbstractScTabBgColorDlg> CreateScTabBgColorDlg(weld::Window* pParent,
532 const OUString& rTitle, //Dialog Title
533 const OUString& rTabBgColorNoColorText, //Label for no tab color
534 const Color& rDefaultColor) = 0; //Currently selected Color
536 virtual VclPtr<AbstractScImportOptionsDlg> CreateScImportOptionsDlg(weld::Window* pParent, bool bAscii,
537 const ScImportOptions* pOptions,
538 const OUString* pStrTitle,
539 bool bOnlyDbtoolsEncodings,
540 bool bImport = true ) = 0;
542 virtual VclPtr<AbstractScGoToTabDlg> CreateScGoToTabDlg(weld::Window* pParent) = 0;
544 virtual VclPtr<SfxAbstractTabDialog> CreateScAttrDlg(weld::Window* pParent,
545 const SfxItemSet* pCellAttrs) = 0;
547 virtual VclPtr<SfxAbstractTabDialog> CreateScHFEditDlg(weld::Window* pParent,
548 const SfxItemSet& rCoreSet,
549 const OUString& rPageStyle,
550 sal_uInt16 nResId ) = 0;
552 virtual VclPtr<SfxAbstractTabDialog> CreateScStyleDlg(weld::Window* pParent,
553 SfxStyleSheetBase& rStyleBase,
554 bool bPage /*true : page, false: para*/) = 0;
556 virtual VclPtr<SfxAbstractTabDialog> CreateScDrawStyleDlg(weld::Window* pParent,
557 SfxStyleSheetBase& rStyleBase,
558 SdrView* pView) = 0;
560 virtual VclPtr<SfxAbstractTabDialog> CreateScSubTotalDlg(weld::Window* pParent,
561 const SfxItemSet& rArgSet) = 0;
563 virtual VclPtr<SfxAbstractTabDialog> CreateScCharDlg(weld::Window* pParent,
564 const SfxItemSet* pAttr, const SfxObjectShell* pDocShell, bool bDrawText) = 0;
566 virtual VclPtr<SfxAbstractTabDialog> CreateScParagraphDlg(weld::Window* pParent,
567 const SfxItemSet* pAttr) = 0;
569 virtual std::shared_ptr<ScAsyncTabController> CreateScSortDlg(weld::Window* pParent, const SfxItemSet* pArgSet) = 0;
571 // for tabpage
572 virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
574 protected:
575 ~ScAbstractDialogFactory() {}
578 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */