/** * @file XTPSyntaxEditDoc.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPSYNTAXEDITSYNTAXEDITDOC_H__) # define __XTPSYNTAXEDITSYNTAXEDITDOC_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPSyntaxEditBufferManager; /** * @brief * This class represents the Document portion of an Edit control. It * extends the functionality provided by the CDocument class from MFC's * document-view model implementation. The CXTPSyntaxEditDoc class works * together with CXTPSyntaxEditView and provides storage facilities for it. * @see * CXTPSyntaxEditView */ class _XTP_EXT_CLASS CXTPSyntaxEditDoc : public CDocument { protected: /** * @brief * Protected object constructor. Used by dynamic creation */ CXTPSyntaxEditDoc(); /** * @brief * Destroys a CXTPSyntaxEditDoc object, handles cleanup and * de-allocation. */ virtual ~CXTPSyntaxEditDoc(); /** @cond */ DECLARE_DYNCREATE(CXTPSyntaxEditDoc) /** @endcond */ // Attributes public: // Operations public: // Overrides /** @cond */ //{{AFX_VIRTUAL(CXTPSyntaxEditDoc) public: virtual void Serialize(CArchive& ar); /**< overridden for document i/o */ virtual void OnChangedViewList(); virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); virtual BOOL OnSaveDocument(LPCTSTR lpszPathName); virtual void OnCloseDocument(); protected: virtual BOOL OnNewDocument(); //}}AFX_VIRTUAL /** @endcond */ // Implementation public: /** * @brief * Re-opens an opened file. * @return * TRUE if the file was re-opened successfully, otherwise FALSE. */ BOOL ReOpen(); /** * @brief * Sets the edit buffer manager. * @param pBuffer [in] Pointer to the buffer manager to be set. * @see * CXTPSyntaxEditBufferManager */ void SetDataManager(CXTPSyntaxEditBufferManager* pBuffer); /** * @brief * Gets the edit buffer manager. * @return * A pointer to the edit buffer manager. * @see * CXTPSyntaxEditBufferManager */ CXTPSyntaxEditBufferManager* GetDataManager() const; /** * @brief * Sets the the path to the main configuration file. * @param szPath [in] Path to be set. * @details * The configuration will be reloaded. * @see * CXTPSyntaxEditCtrl::GetConfigFile */ void SetConfigFile(LPCTSTR szPath); /** * @brief * Determines if auto-reload for external files is enabled/disabled. * @return * TRUE if auto-reload for external files is enabled, * FALSE if auto-reload for external files is disabled. */ BOOL GetAutoReload() const; /** * @brief * Enables/disables auto-reload for external files. * @param bAutoReload [in] TRUE to enable auto-reload for external files, * FALSE to disable auto-reload for external files. * @param bUpdateReg [in] TRUE to update this setting in the registry, FALSE otherwise. * By default, this parameter is FALSE. * @return * TRUE if successful, otherwise FALSE. */ BOOL SetAutoReload(BOOL bAutoReload, BOOL bUpdateReg = FALSE); /** * @brief * Determines if the current file has been externally modified and * prompts the user to reload it. * @param lpszPathName Full file name. * @details * This method only works when auto-reload is enabled. * @return * TRUE if the file was externally modified and reloaded, * otherwise FALSE. * @see * GetAutoReload, SetAutoReload */ BOOL CheckFileModified(LPCTSTR lpszPathName); /** * @brief * Determines if the current file is read-only. * @return * TRUE if the current file is read-only, otherwise FALSE. */ BOOL IsReadonly(); /** * @brief * Gets a first view for the document object. * @return * A pointer to a CXTPSyntaxEditView object. * @see * CDocument::GetFirstViewPosition, CDocument::GetNextView */ CXTPSyntaxEditView* GetFirstView(); # ifdef _DEBUG /** @cond */ virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; /** @endcond */ # endif // Generated message map functions protected: virtual BOOL SaveFileData(LPCTSTR lpszPathName); /** @cond */ //{{AFX_MSG(CXTPSyntaxEditDoc) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG DECLARE_MESSAGE_MAP() /** @endcond */ protected: CXTPSyntaxEditBufferManager* m_ptrDataMan; /**< Data manager pointer. */ BOOL m_bAutoReload; /**< TRUE if auto-reload for externally modified files is enabled, FALSE otherwise. */ BOOL m_bOpened; /**< TRUE if opened, FALSE otherwise. */ BOOL m_bNewFile; /**< TRUE if either a new file is created or a file is opened, FALSE otherwise. */ BOOL m_bDocCreated; /**< TRUE if a document is created, FALSE otherwise. */ BOOL m_bReloading; /**< TRUE if the document is being reloaded, FALSE otherwise. */ int m_iTopRow; /**< Identifier of top row. */ int m_iHScrollPos; /**< Scrolling position. */ WIN32_FIND_DATA m_curFileData; }; AFX_INLINE CXTPSyntaxEditBufferManager* CXTPSyntaxEditDoc::GetDataManager() const { return m_ptrDataMan; } AFX_INLINE BOOL CXTPSyntaxEditDoc::GetAutoReload() const { return m_bAutoReload; } ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPSYNTAXEDITSYNTAXEDITDOC_H__) /** @endcond */