Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef SC_DOCSHELL_HXX
21 : #define SC_DOCSHELL_HXX
22 :
23 :
24 : #include <sfx2/objsh.hxx>
25 :
26 : #include <sfx2/docfac.hxx>
27 : #include <sfx2/sfxmodelfactory.hxx>
28 : #include <sfx2/viewsh.hxx>
29 :
30 : #include "scdllapi.h"
31 : #include "scdll.hxx"
32 : #include "document.hxx"
33 : #include "appoptio.hxx"
34 : #include "formulaopt.hxx"
35 : #include "shellids.hxx"
36 : #include "optutil.hxx"
37 : #include "docuno.hxx"
38 :
39 : #include <boost/unordered_map.hpp>
40 : #include <boost/scoped_ptr.hpp>
41 : #include <cppuhelper/implbase1.hxx>
42 :
43 : #include <config_telepathy.h>
44 :
45 : class ScRefreshTimerProtector;
46 : class ScEditEngineDefaulter;
47 : class SfxStyleSheetBasePool;
48 : class SfxStyleSheetHint;
49 : class INetURLObject;
50 :
51 : class ScViewData;
52 : class ScDocFunc;
53 : class ScDrawLayer;
54 : class ScTabViewShell;
55 : class ScSbxDocHelper;
56 : class ScAutoStyleList;
57 : class ScRange;
58 : class ScMarkData;
59 : class ScPaintLockData;
60 : class ScChangeAction;
61 : class VirtualDevice;
62 : class ScImportOptions;
63 : class ScDocShellModificator;
64 : class ScOptSolverSave;
65 : class ScRefreshTimer;
66 : class ScSheetSaveData;
67 : class ScFlatBoolRowSegments;
68 : class HelperModelObj;
69 : struct ScColWidthParam;
70 : #if ENABLE_TELEPATHY
71 : class ScCollaboration;
72 : #endif
73 :
74 : namespace sfx2 { class FileDialogHelper; }
75 : struct DocShell_Impl;
76 :
77 : typedef ::boost::unordered_map< sal_uLong, sal_uLong > ScChangeActionMergeMap;
78 :
79 : //enum ScDBFormat { SC_FORMAT_SDF, SC_FORMAT_DBF };
80 :
81 : // Extra flags for Repaint
82 : #define SC_PF_LINES 1
83 : #define SC_PF_TESTMERGE 2
84 : #define SC_PF_WHOLEROWS 4
85 :
86 : class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
87 : {
88 : ScDocument aDocument;
89 :
90 : OUString aDdeTextFmt;
91 :
92 : double nPrtToScreenFactor;
93 : DocShell_Impl* pImpl;
94 : ScDocFunc* pDocFunc;
95 :
96 : bool bHeaderOn;
97 : bool bFooterOn;
98 : bool bIsInplace:1; // Is set by the View
99 : bool bIsEmpty:1;
100 : bool bIsInUndo:1;
101 : bool bDocumentModifiedPending:1;
102 : bool bUpdateEnabled:1;
103 : sal_uInt16 nDocumentLock;
104 : sal_Int16 nCanUpdate; // stores the UpdateDocMode from loading a document till update links
105 :
106 : ScDBData* pOldAutoDBRange;
107 :
108 : ScSbxDocHelper* pDocHelper;
109 :
110 : ScAutoStyleList* pAutoStyleList;
111 : ScPaintLockData* pPaintLockData;
112 : ScOptSolverSave* pSolverSaveData;
113 : ScSheetSaveData* pSheetSaveData;
114 :
115 : ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading)
116 : #if ENABLE_TELEPATHY
117 : ScCollaboration* mpCollaboration;
118 : #endif
119 :
120 : SAL_DLLPRIVATE void InitItems();
121 : SAL_DLLPRIVATE void DoEnterHandler();
122 : SAL_DLLPRIVATE void InitOptions(bool bForLoading);
123 : SAL_DLLPRIVATE void ResetDrawObjectShell();
124 :
125 : // SUNWS needs a forward declared friend, otherwise types and members
126 : // of the outer class are not accessible.
127 : class PrepareSaveGuard;
128 : friend class ScDocShell::PrepareSaveGuard;
129 : /** Do things that need to be done before saving to our own format and
130 : necessary clean ups in dtor. */
131 : class PrepareSaveGuard
132 : {
133 : public:
134 : explicit PrepareSaveGuard( ScDocShell & rDocShell );
135 : ~PrepareSaveGuard();
136 : private:
137 : ScDocShell & mrDocShell;
138 : };
139 :
140 : SAL_DLLPRIVATE bool LoadXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& );
141 : SAL_DLLPRIVATE bool SaveXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& );
142 : SAL_DLLPRIVATE SCTAB GetSaveTab();
143 :
144 : SAL_DLLPRIVATE bool SaveCurrentChart( SfxMedium& rMedium );
145 :
146 : SAL_DLLPRIVATE sal_uLong DBaseImport( const OUString& rFullFileName, rtl_TextEncoding eCharSet,
147 : ScColWidthParam aColWidthParam[MAXCOLCOUNT], ScFlatBoolRowSegments& rRowHeightsRecalc );
148 : SAL_DLLPRIVATE sal_uLong DBaseExport(
149 : const OUString& rFullFileName, rtl_TextEncoding eCharSet, bool& bHasMemo );
150 :
151 : SAL_DLLPRIVATE static bool MoveFile( const INetURLObject& rSource, const INetURLObject& rDest );
152 : SAL_DLLPRIVATE static bool KillFile( const INetURLObject& rURL );
153 : SAL_DLLPRIVATE static bool IsDocument( const INetURLObject& rURL );
154 :
155 : SAL_DLLPRIVATE void LockPaint_Impl(bool bDoc);
156 : SAL_DLLPRIVATE void UnlockPaint_Impl(bool bDoc);
157 : SAL_DLLPRIVATE void LockDocument_Impl(sal_uInt16 nNew);
158 : SAL_DLLPRIVATE void UnlockDocument_Impl(sal_uInt16 nNew);
159 :
160 : SAL_DLLPRIVATE void EnableSharedSettings( bool bEnable );
161 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument();
162 :
163 : SAL_DLLPRIVATE void UseSheetSaveEntries();
164 :
165 : SAL_DLLPRIVATE ScDocFunc *CreateDocFunc();
166 :
167 : protected:
168 :
169 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
170 :
171 : public:
172 : TYPEINFO_OVERRIDE();
173 :
174 0 : SFX_DECL_INTERFACE(SCID_DOC_SHELL)
175 0 : SFX_DECL_OBJECTFACTORY();
176 :
177 : ScDocShell( const ScDocShell& rDocShell );
178 : ScDocShell( const sal_uInt64 i_nSfxCreationFlags = SFXMODEL_EMBEDDED_OBJECT );
179 : virtual ~ScDocShell();
180 :
181 : using SotObject::GetInterface;
182 : using SfxShell::Activate; // with sal_Bool bMDI
183 : using SfxShell::Deactivate; // with sal_Bool bMDI
184 :
185 : #if ENABLE_TELEPATHY
186 : SAL_DLLPRIVATE ScCollaboration* GetCollaboration();
187 : #endif
188 : virtual void Activate();
189 : virtual void Deactivate();
190 :
191 : virtual ::svl::IUndoManager*
192 : GetUndoManager() SAL_OVERRIDE;
193 :
194 : virtual void FillClass( SvGlobalName * pClassName,
195 : sal_uInt32 * pFormat,
196 : OUString * pAppName,
197 : OUString * pFullTypeName,
198 : OUString * pShortTypeName,
199 : sal_Int32 nFileFormat,
200 : bool bTemplate = false ) const SAL_OVERRIDE;
201 :
202 : virtual bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ) SAL_OVERRIDE;
203 : virtual bool Load( SfxMedium& rMedium ) SAL_OVERRIDE;
204 : virtual bool LoadFrom( SfxMedium& rMedium ) SAL_OVERRIDE;
205 : virtual bool ConvertFrom( SfxMedium &rMedium ) SAL_OVERRIDE;
206 : virtual bool LoadExternal( SfxMedium& rMedium ) SAL_OVERRIDE;
207 : virtual bool Save() SAL_OVERRIDE;
208 : virtual bool SaveAs( SfxMedium& rMedium ) SAL_OVERRIDE;
209 : virtual bool ConvertTo( SfxMedium &rMedium ) SAL_OVERRIDE;
210 : virtual bool PrepareClose( bool bUI = true ) SAL_OVERRIDE;
211 : virtual void PrepareReload() SAL_OVERRIDE;
212 : virtual bool IsInformationLost() SAL_OVERRIDE;
213 : virtual void LoadStyles( SfxObjectShell &rSource ) SAL_OVERRIDE;
214 :
215 : virtual bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ) SAL_OVERRIDE; // SfxInPlaceObject
216 : virtual bool DoSaveCompleted( SfxMedium * pNewStor) SAL_OVERRIDE; // SfxObjectShell
217 : virtual bool QuerySlotExecutable( sal_uInt16 nSlotId ) SAL_OVERRIDE;
218 :
219 : virtual void Draw( OutputDevice *, const JobSetup & rSetup,
220 : sal_uInt16 nAspect = ASPECT_CONTENT ) SAL_OVERRIDE;
221 :
222 : virtual void SetVisArea( const Rectangle & rVisArea ) SAL_OVERRIDE;
223 :
224 : using SfxObjectShell::GetVisArea;
225 : virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const SAL_OVERRIDE;
226 :
227 : virtual Printer* GetDocumentPrinter() SAL_OVERRIDE;
228 :
229 : virtual void SetModified( bool = true ) SAL_OVERRIDE;
230 :
231 : void SetVisAreaOrSize( const Rectangle& rVisArea, bool bModifyStart );
232 :
233 : virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( Window *pParent,
234 : const SfxItemSet &rSet ) SAL_OVERRIDE;
235 :
236 : void GetDocStat( ScDocStat& rDocStat );
237 :
238 0 : ScDocument* GetDocument() { return &aDocument; }
239 0 : ScDocFunc& GetDocFunc() { return *pDocFunc; }
240 : void SetDocFunc( ScDocFunc *pDF ) { pDocFunc = pDF; }
241 :
242 : SfxPrinter* GetPrinter( bool bCreateIfNotExist = true );
243 : sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL );
244 :
245 : void UpdateFontList();
246 :
247 : OUString CreateObjectName( const OUString& rPrefix );
248 :
249 : ScDrawLayer* MakeDrawLayer();
250 :
251 : void AsciiSave( SvStream& rStream, const ScImportOptions& rOpt );
252 :
253 : void GetSbxState( SfxItemSet &rSet );
254 : void GetDrawObjState( SfxItemSet &rSet );
255 :
256 : void Execute( SfxRequest& rReq );
257 : void GetState( SfxItemSet &rSet );
258 : void ExecutePageStyle ( SfxViewShell& rCaller, SfxRequest& rReq, SCTAB nCurTab );
259 : void GetStatePageStyle( SfxViewShell& rCaller, SfxItemSet& rSet, SCTAB nCurTab );
260 :
261 : void CompareDocument( ScDocument& rOtherDoc );
262 : void MergeDocument( ScDocument& rOtherDoc, bool bShared = false, bool bCheckDuplicates = false, sal_uLong nOffset = 0, ScChangeActionMergeMap* pMergeMap = NULL, bool bInverseMap = false );
263 : bool MergeSharedDocument( ScDocShell* pSharedDocShell );
264 :
265 : ScChangeAction* GetChangeAction( const ScAddress& rPos );
266 : void SetChangeComment( ScChangeAction* pAction, const OUString& rComment );
267 : void ExecuteChangeCommentDialog( ScChangeAction* pAction, Window* pParent, bool bPrevNext = true );
268 : /// Protect/unprotect ChangeTrack and return <TRUE/> if
269 : /// protection was successfully changed.
270 : /// If bJustQueryIfProtected==sal_True protection is not
271 : /// changed and <TRUE/> is returned if not protected or
272 : /// password was entered correctly.
273 : bool ExecuteChangeProtectionDialog( Window* _pParent, bool bJustQueryIfProtected = false );
274 :
275 : void SetPrintZoom( SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages );
276 : bool AdjustPrintZoom( const ScRange& rRange );
277 :
278 : void LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellStyles, bool bPageStyles );
279 :
280 : void PageStyleModified( const OUString& rStyleName, bool bApi );
281 :
282 : void NotifyStyle( const SfxStyleSheetHint& rHint );
283 : void DoAutoStyle( const ScRange& rRange, const OUString& rStyle );
284 :
285 : Window* GetActiveDialogParent();
286 : void ErrorMessage( sal_uInt16 nGlobStrId );
287 : bool IsEditable() const;
288 :
289 : bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab );
290 : void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL );
291 : void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false );
292 :
293 : void RefreshPivotTables( const ScRange& rSource );
294 : void DoConsolidate( const ScConsolidateParam& rParam, bool bRecord = true );
295 : void UseScenario( SCTAB nTab, const OUString& rName, bool bRecord = true );
296 : SCTAB MakeScenario( SCTAB nTab, const OUString& rName, const OUString& rComment,
297 : const Color& rColor, sal_uInt16 nFlags,
298 : ScMarkData& rMark, bool bRecord = true );
299 : void ModifyScenario( SCTAB nTab, const OUString& rName, const OUString& rComment,
300 : const Color& rColor, sal_uInt16 nFlags );
301 : sal_uLong TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
302 : SCTAB nDestPos, bool bInsertNew,
303 : bool bNotifyAndPaint );
304 :
305 : bool MoveTable( SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRecord );
306 :
307 : void DoRecalc( bool bApi );
308 : void DoHardRecalc( bool bApi );
309 :
310 : void UpdateOle( const ScViewData* pViewData, bool bSnapSize = false);
311 : bool IsOle();
312 :
313 : void DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 );
314 : ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel );
315 : ScDBData* GetAnonymousDBData(const ScRange& rRange);
316 : ScDBData* GetOldAutoDBRange(); // has to be deleted by caller!
317 : void CancelAutoDBRange(); // called when dialog is cancelled
318 :
319 : virtual void ReconnectDdeLink(SfxObjectShell& rServer) SAL_OVERRIDE;
320 : void UpdateLinks() SAL_OVERRIDE;
321 : bool ReloadTabLinks();
322 :
323 : void SetFormulaOptions(const ScFormulaOptions& rOpt );
324 : void SetCalcConfig( const ScCalcConfig& rConfig );
325 : virtual void CheckConfigOptions() SAL_OVERRIDE;
326 :
327 : void PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos );
328 :
329 : void PostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
330 : SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, sal_uInt16 nPart,
331 : sal_uInt16 nExtFlags = 0 );
332 : void PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uInt16 nExtFlags = 0 );
333 :
334 : void PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
335 : void PostPaintCell( const ScAddress& rPos );
336 : void PostPaintGridAll();
337 : void PostPaintExtras();
338 :
339 0 : bool IsPaintLocked() const { return pPaintLockData != NULL; }
340 :
341 : void PostDataChanged();
342 :
343 : void UpdatePaintExt( sal_uInt16& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
344 : SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab );
345 : void UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange );
346 :
347 : void SetDocumentModified( bool bIsModified = true );
348 : void SetDrawModified( bool bIsModified = true );
349 :
350 : void LockPaint();
351 : void UnlockPaint();
352 : sal_uInt16 GetLockCount() const;
353 : void SetLockCount(sal_uInt16 nNew);
354 :
355 : void LockDocument();
356 : void UnlockDocument();
357 :
358 : DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
359 :
360 : virtual SfxStyleSheetBasePool* GetStyleSheetPool() SAL_OVERRIDE;
361 :
362 : void SetInplace( bool bInplace );
363 : bool IsEmpty() const;
364 : void SetEmpty(bool bSet);
365 :
366 0 : bool IsInUndo() const { return bIsInUndo; }
367 : void SetInUndo(bool bSet);
368 :
369 : void CalcOutputFactor();
370 : double GetOutputFactor() const;
371 : void GetPageOnFromPageStyleSet( const SfxItemSet* pStyleSet,
372 : SCTAB nCurTab,
373 : bool& rbHeader,
374 : bool& rbFooter );
375 :
376 : virtual bool DdeGetData( const OUString& rItem, const OUString& rMimeType,
377 : ::com::sun::star::uno::Any & rValue ) SAL_OVERRIDE;
378 : virtual bool DdeSetData( const OUString& rItem, const OUString& rMimeType,
379 : const ::com::sun::star::uno::Any & rValue ) SAL_OVERRIDE;
380 : virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem ) SAL_OVERRIDE;
381 :
382 0 : const OUString& GetDdeTextFmt() const { return aDdeTextFmt; }
383 :
384 : SfxBindings* GetViewBindings();
385 :
386 : ScTabViewShell* GetBestViewShell( bool bOnlyVisible = true );
387 : ScSbxDocHelper* GetDocHelperObject() { return pDocHelper; }
388 :
389 0 : void SetDocumentModifiedPending( bool bVal )
390 0 : { bDocumentModifiedPending = bVal; }
391 0 : bool IsDocumentModifiedPending() const
392 0 : { return bDocumentModifiedPending; }
393 :
394 0 : bool IsUpdateEnabled() const
395 0 : { return bUpdateEnabled; }
396 0 : void SetUpdateEnabled(bool bValue)
397 0 : { bUpdateEnabled = bValue; }
398 :
399 : OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
400 :
401 : static ScViewData* GetViewData();
402 : static SCTAB GetCurTab();
403 :
404 : static ScDocShell* GetShellByNum( sal_uInt16 nDocNo );
405 : static OUString GetOwnFilterName();
406 : static OUString GetHtmlFilterName();
407 : static OUString GetWebQueryFilterName();
408 : static OUString GetAsciiFilterName();
409 : static OUString GetLotusFilterName();
410 : static OUString GetDBaseFilterName();
411 : static OUString GetDifFilterName();
412 : static bool HasAutomaticTableName( const OUString& rFilter );
413 :
414 : DECL_LINK( RefreshDBDataHdl, ScRefreshTimer* );
415 :
416 : void BeforeXMLLoading();
417 : void AfterXMLLoading(bool bRet);
418 :
419 : virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates ) SAL_OVERRIDE;
420 :
421 0 : const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null
422 : void SetSolverSaveData( const ScOptSolverSave& rData );
423 : ScSheetSaveData* GetSheetSaveData();
424 :
425 : void ResetKeyBindings( ScOptionsUtil::KeyBindingType eType );
426 :
427 : // password protection for Calc (derived from SfxObjectShell)
428 : // see also: FID_CHG_RECORD, SID_CHG_PROTECT
429 : virtual bool IsChangeRecording() const SAL_OVERRIDE;
430 : virtual bool HasChangeRecordProtection() const SAL_OVERRIDE;
431 : virtual void SetChangeRecording( bool bActivate ) SAL_OVERRIDE;
432 : virtual bool SetProtectionPassword( const OUString &rPassword ) SAL_OVERRIDE;
433 : virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ) SAL_OVERRIDE;
434 :
435 :
436 : void SnapVisArea( Rectangle& rRect ) const;
437 : };
438 :
439 :
440 : void UpdateAcceptChangesDialog();
441 :
442 : class ScDocShell;
443 : typedef tools::SvRef<ScDocShell> ScDocShellRef;
444 :
445 : /** Create before modifications of the document and destroy thereafter.
446 : Call SetDocumentModified() at an instance of this class instead of at
447 : ScDocShell.
448 :
449 : Remembers in the ctor ScDocument's AutoCalcShellDisabled and IdleDisabled,
450 : switches them off and restores them in the dtor, AutoCalcShellDisabled
451 : also before a ScDocShell::SetDocumentModified() call if necessary.
452 : In the dtor, if ScDocShell's bDocumentModifiedPending is set and
453 : bAutoCalcShellDisabled is not set, then ScDocShell::SetDocumentModified()
454 : is called.
455 :
456 : Several instances can be used in nested calls to ScDocFunc or ScDocShell
457 : methods to avoid multiple modified status changes, only the last instance
458 : destroyed calls ScDocShell::SetDocumentModified().
459 : */
460 : class SC_DLLPUBLIC ScDocShellModificator
461 : {
462 : ScDocShell& rDocShell;
463 : boost::scoped_ptr<ScRefreshTimerProtector> mpProtector;
464 : bool bAutoCalcShellDisabled;
465 : bool bIdleEnabled;
466 :
467 : // not implemented
468 : ScDocShellModificator( const ScDocShellModificator& );
469 : ScDocShellModificator& operator=( const ScDocShellModificator& );
470 :
471 : public:
472 : ScDocShellModificator( ScDocShell& );
473 : ~ScDocShellModificator();
474 : void SetDocumentModified();
475 : };
476 :
477 : //#i97876# Spreadsheet data changes are not notified
478 : namespace HelperNotifyChanges
479 : {
480 0 : inline ScModelObj* getMustPropagateChangesModel(ScDocShell &rDocShell)
481 : {
482 0 : ScModelObj* pModelObj = ScModelObj::getImplementation(rDocShell.GetModel());
483 0 : if (pModelObj && pModelObj->HasChangesListeners())
484 0 : return pModelObj;
485 0 : return NULL;
486 : }
487 :
488 0 : inline void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges,
489 : const OUString &rType = OUString("cell-change"),
490 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProperties =
491 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >())
492 : {
493 0 : rModelObj.NotifyChanges(rType, rChangeRanges, rProperties);
494 0 : }
495 :
496 0 : inline void NotifyIfChangesListeners(ScDocShell &rDocShell, const ScRange &rRange,
497 : const OUString &rType = OUString("cell-change"))
498 : {
499 0 : if (ScModelObj* pModelObj = getMustPropagateChangesModel(rDocShell))
500 : {
501 0 : ScRangeList aChangeRanges;
502 0 : aChangeRanges.Append(rRange);
503 0 : Notify(*pModelObj, aChangeRanges, rType);
504 : }
505 0 : }
506 : };
507 :
508 :
509 : #endif
510 :
511 :
512 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|