30 #include <document.hxx>
36 #include <string_view>
37 #include <unordered_map>
64 namespace sfx2 {
class FileDialogHelper; }
75 #define SC_PF_TESTMERGE 2
76 #define SC_PF_WHOLEROWS 4
93 bool m_bDocumentModifiedPending:1;
94 bool m_bUpdateEnabled:1;
96 bool m_bAreasChangedNeedBroadcast:1;
108 std::unique_ptr<ScDocShellModificator, o3tl::default_delete<ScDocShellModificator>>
m_pModificator;
114 css::uno::Reference<css::datatransfer::XTransferable2>
m_xClipData;
116 SAL_DLLPRIVATE
void InitItems();
117 SAL_DLLPRIVATE
void DoEnterHandler();
118 SAL_DLLPRIVATE
void InitOptions(
bool bForLoading);
119 SAL_DLLPRIVATE
void ResetDrawObjectShell();
132 SAL_DLLPRIVATE
bool LoadXML(
SfxMedium* pMedium,
const css::uno::Reference< css::embed::XStorage >& );
133 SAL_DLLPRIVATE
bool SaveXML(
SfxMedium* pMedium,
const css::uno::Reference< css::embed::XStorage >& );
134 SAL_DLLPRIVATE
SCTAB GetSaveTab();
136 SAL_DLLPRIVATE
ErrCode DBaseImport(
const OUString& rFullFileName, rtl_TextEncoding eCharSet,
138 SAL_DLLPRIVATE
ErrCode DBaseExport(
139 const OUString& rFullFileName, rtl_TextEncoding eCharSet,
bool& bHasMemo );
145 SAL_DLLPRIVATE
void LockPaint_Impl(
bool bDoc);
146 SAL_DLLPRIVATE
void UnlockPaint_Impl(
bool bDoc);
147 SAL_DLLPRIVATE
void LockDocument_Impl(sal_uInt16 nNew);
148 SAL_DLLPRIVATE
void UnlockDocument_Impl(sal_uInt16 nNew);
150 SAL_DLLPRIVATE
void EnableSharedSettings(
bool bEnable );
151 SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel > LoadSharedDocument();
153 SAL_DLLPRIVATE
void UseSheetSaveEntries();
155 SAL_DLLPRIVATE std::unique_ptr<ScDocFunc> CreateDocFunc();
161 SFX_DECL_OBJECTFACTORY();
165 static
void InitInterface_Impl();
173 GetUndoManager() override;
177 OUString * pFullTypeName,
178 sal_Int32 nFileFormat,
179 bool bTemplate = false ) const override;
181 virtual
std::set<
Color> GetDocColors() override;
183 virtual
bool InitNew( const
css::
uno::Reference<
css::embed::XStorage >& ) override;
184 virtual
bool Load(
SfxMedium& rMedium ) override;
185 virtual
bool LoadFrom(
SfxMedium& rMedium ) override;
186 virtual
bool ConvertFrom(
SfxMedium &rMedium ) override;
187 virtual
bool LoadExternal(
SfxMedium& rMedium ) override;
188 virtual
bool Save() override;
189 virtual
bool SaveAs(
SfxMedium& rMedium ) override;
190 virtual
bool ConvertTo(
SfxMedium &rMedium ) override;
191 virtual
bool PrepareClose(
bool bUI = true ) override;
194 virtual
bool DoSaveCompleted(
SfxMedium * pNewStor=
nullptr,
bool bRegisterRecent=true ) override;
195 virtual
bool QuerySlotExecutable( sal_uInt16 nSlotId ) override;
199 virtual
void SetVisArea( const
tools::Rectangle & rVisArea ) override;
201 virtual
void TerminateEditing() override;
204 virtual
tools::Rectangle GetVisArea( sal_uInt16 nAspect ) const override;
206 virtual
Printer* GetDocumentPrinter() override;
208 virtual
void SetModified(
bool = true ) override;
210 void SetVisAreaOrSize( const
tools::Rectangle& rVisArea );
216 const
ScDocument& GetDocument()
const {
return m_aDocument; }
220 css::uno::Reference<css::datatransfer::XTransferable2>
const &
GetClipData()
const {
return m_xClipData; }
221 void SetClipData(
const css::uno::Reference<css::datatransfer::XTransferable2>& xTransferable) { m_xClipData = xTransferable; }
223 SfxPrinter* GetPrinter(
bool bCreateIfNotExist =
true );
226 void UpdateFontList();
237 void CompareDocument(
ScDocument& rOtherDoc );
239 bool MergeSharedDocument(
ScDocShell* pSharedDocShell );
242 void SetChangeComment(
ScChangeAction* pAction,
const OUString& rComment );
249 bool ExecuteChangeProtectionDialog(
bool bJustQueryIfProtected =
false );
251 void SetPrintZoom(
SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages );
252 bool AdjustPrintZoom(
const ScRange& rRange );
254 void LoadStylesArgs(
ScDocShell& rSource,
bool bReplace,
bool bCellStyles,
bool bPageStyles );
256 void PageStyleModified( std::u16string_view rStyleName,
bool bApi );
259 void DoAutoStyle(
const ScRange& rRange,
const OUString& rStyle );
262 void ErrorMessage(
const char* pGlobStrId);
263 bool IsEditable()
const;
266 void UpdateAllRowHeights(
const ScMarkData* pTabMark =
nullptr );
267 void UpdatePendingRowHeights(
SCTAB nUpdateTab,
bool bBefore =
false );
269 void RefreshPivotTables(
const ScRange& rSource );
271 void UseScenario(
SCTAB nTab,
const OUString& rName,
bool bRecord =
true );
272 SCTAB MakeScenario(
SCTAB nTab,
const OUString& rName,
const OUString& rComment,
275 void ModifyScenario(
SCTAB nTab,
const OUString& rName,
const OUString& rComment,
278 SCTAB nDestPos,
bool bInsertNew,
279 bool bNotifyAndPaint );
281 bool MoveTable(
SCTAB nSrcTab,
SCTAB nDestTab,
bool bCopy,
bool bRecord );
283 void DoRecalc(
bool bApi );
286 void UpdateOle(
const ScViewData& rViewData,
bool bSnapSize =
false);
292 std::unique_ptr<ScDBData> GetOldAutoDBRange();
293 void CancelAutoDBRange();
297 void AllowLinkUpdate();
298 void ReloadAllLinks();
299 void ReloadTabLinks();
302 void SetFormulaOptions(
const ScFormulaOptions& rOpt,
bool bForLoading =
false );
307 void CheckConfigOptions();
313 sal_uInt16 nExtFlags = 0 );
317 void PostPaintCell(
const ScAddress& rPos );
318 void PostPaintGridAll();
319 void PostPaintExtras();
323 void PostDataChanged();
325 void UpdatePaintExt( sal_uInt16& rExtFlags,
SCCOL nStartCol,
SCROW nStartRow,
SCTAB nStartTab,
327 void UpdatePaintExt( sal_uInt16& rExtFlags,
const ScRange& rRange );
329 void SetDocumentModified();
330 void SetDrawModified();
335 void SetLockCount(sal_uInt16 nNew);
338 void UnlockDocument();
345 void SetInplace(
bool bInplace );
347 void SetEmpty(
bool bSet);
350 void SetInUndo(
bool bSet);
352 void CalcOutputFactor();
354 void GetPageOnFromPageStyleSet(
const SfxItemSet* pStyleSet,
360 virtual bool DdeGetData(
const OUString& rItem,
const OUString& rMimeType,
361 css::uno::Any & rValue )
override;
362 virtual bool DdeSetData(
const OUString& rItem,
const OUString& rMimeType,
363 const css::uno::Any & rValue )
override;
375 { m_bDocumentModifiedPending = bVal; }
377 {
return m_bDocumentModifiedPending; }
380 {
return m_bUpdateEnabled; }
382 { m_bUpdateEnabled = bValue; }
385 { m_bAreasChangedNeedBroadcast =
true; }
390 static SCTAB GetCurTab();
392 static ScDocShell* GetShellByNum( sal_uInt16 nDocNo );
393 static OUString GetOwnFilterName();
394 static OUString GetHtmlFilterName();
395 static OUString GetWebQueryFilterName();
396 static OUString GetAsciiFilterName();
397 static OUString GetLotusFilterName();
398 static OUString GetDBaseFilterName();
399 static OUString GetDifFilterName();
400 static bool HasAutomaticTableName( std::u16string_view rFilter );
405 void BeforeXMLLoading();
406 void AfterXMLLoading(
bool bRet);
411 void SetSolverSaveData( std::unique_ptr<ScOptSolverSave> pData );
421 virtual void SetChangeRecording(
bool bActivate,
bool bLockAllViews =
false )
override;
423 virtual bool GetProtectionHash( css::uno::Sequence< sal_Int8 > &rPasswordHash )
override;
429 void RegisterAutomationWorkbookObject(css::uno::Reference< ooo::vba::excel::XWorkbook >
const& xWorkbook);
472 ScModelObj* pModelObj = comphelper::getUnoTunnelImplementation<ScModelObj>(rDocShell.
GetModel());
479 const OUString &rType = OUString(
"cell-change"),
480 const css::uno::Sequence< css::beans::PropertyValue >& rProperties =
481 css::uno::Sequence< css::beans::PropertyValue >())
487 const OUString &rType = OUString(
"cell-change"))
492 Notify(*pModelObj, aChangeRanges, rType);
void UpdateAcceptChangesDialog()
constexpr OUStringLiteral IsDocument(u"IsDocument")
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
std::unordered_map< sal_uLong, sal_uLong > ScChangeActionMergeMap
std::unique_ptr< ScDBData > m_pOldAutoDBRange
virtual void UpdateLinks()
double m_nPrtToScreenFactor
css::uno::Reference< css::datatransfer::XTransferable2 > const & GetClipData() const
Do things that need to be done before saving to our own format and necessary clean ups in dtor...
bool IsUpdateEnabled() const
double GetOutputFactor() const
css::uno::Reference< css::frame::XModel > GetModel() const
css::uno::Reference< css::script::vba::XVBAScriptListener > m_xVBAListener
~ScDocShellModificator() COVERITY_NOEXCEPT_FALSE
sal_uInt16 GetLockCount() const
virtual SfxStyleSheetBasePool * GetStyleSheetPool()
ScDocument & GetDocument()
Additional class containing cell annotation data.
std::unique_ptr< ScPaintLockData > m_pPaintLockData
std::unique_ptr< ScDocFunc > m_pDocFunc
const OUString & GetDdeTextFmt() const
void SetClipData(const css::uno::Reference< css::datatransfer::XTransferable2 > &xTransferable)
bool IsDocumentModifiedPending() const
virtual void ReconnectDdeLink(SfxObjectShell &rServer)
virtual bool IsChangeRecording() const
virtual bool HasChangeRecordProtection() const
std::unique_ptr< ScAutoStyleList > m_pAutoStyleList
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
std::unique_ptr< ScDocShellModificator, o3tl::default_delete< ScDocShellModificator > > m_pModificator
sal_uInt16 m_nDocumentLock
void LOKCommentNotify(CommentNotificationType nType, const SfxViewShell *pViewShell, uno::Reference< office::XAnnotation > const &rxAnnotation)
virtual ::sfx2::SvLinkSource * DdeCreateLinkSource(const OUString &rItem)
void SetPrinter(IDocumentDeviceAccess *, SfxPrinter const *, bool bWeb)
bool KillFile(const INetURLObject &rURL)
void SetAreasChangedNeedBroadcast()
virtual HiddenInformation GetHiddenInformationState(HiddenInformation nStates)
virtual void SetChangeRecording(bool bActivate, bool bLockAllViews=false)
void SetUpdateEnabled(bool bValue)
bool IsPaintLocked() const
ScModelObj * getMustPropagateChangesModel(const ScDocShell &rDocShell)
std::unique_ptr< ScRefreshTimerProtector > mpProtector
void NotifyChanges(const OUString &rOperation, const ScRangeList &rRanges, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
std::unique_ptr< ScOptSolverSave > m_pSolverSaveData
void VBA_InsertModule(ScDocument &rDoc, SCTAB nTab, const OUString &sModuleSource)
std::unique_ptr< ScSheetSaveData > m_pSheetSaveData
css::uno::Reference< css::datatransfer::XTransferable2 > m_xClipData
ScGetDBSelection
For ScDBFunc::GetDBData()
ScDocShellModificator & operator=(const ScDocShellModificator &)=delete
std::unique_ptr< ScFormatSaveData > m_pFormatSaveData
const ScOptSolverSave * GetSolverSaveData() const
All settings from the dialog, saved with the DocShell for the next call.
tools::SvRef< ScDocShell > ScDocShellRef
virtual bool GetProtectionHash(css::uno::Sequence< sal_Int8 > &rPasswordHash)
LOKCommentNotificationType
std::unique_ptr< DocShell_Impl > m_pImpl
css::uno::Reference< ooo::vba::excel::XWorkbook > mxAutomationWorkbookObject
void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType=OUString("cell-change"))
ScDocShellModificator(const ScDocShellModificator &)=delete
void SetDocumentModified()
virtual void SetProtectionPassword(const OUString &rPassword)
bool HasChangesListeners() const
void SetDocumentModifiedPending(bool bVal)
DECL_LINK(SignDocumentHandler, weld::Button &, void)
Create before modifications of the document and destroy thereafter.
bool bAutoCalcShellDisabled
#define SFX_DECL_INTERFACE(nId)