/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _TV_DWG2VISUALIZE_H_ #define _TV_DWG2VISUALIZE_H_ #include "TD_PackPush.h" #include "RxDispatchImpl.h" #include "RxObject.h" #include "DbHostAppServices.h" #include "HatchPatternManager.h" #include "StaticRxObject.h" #include "ExSystemServices.h" #include "TvVisualizeFiler.h" //SEA #include "ExVisualizeDeviceExtensions.h" #include "ExPageController.h" #include "PartialImportNotifier.h" //#define OD_TV_MEASURE_PARTIAL #ifndef ODA_UNIXOS #define pathChar '\\' #define oldPathChar '/' #define separatorChar ';' #else #define pathChar '/' #define oldPathChar '\\' #define separatorChar ':' #endif namespace DWG2Visualize { /** \details This class implements the properties of the dwg loader */ class OdTvVisualizeDwgFilerProperties : public OdRxDispatchImpl<> { enum ParamFlags { kObjectNaming = 1 << 0, // Give the names for the tv entities according to the file objects name (like AcDbCircle etc). If object names exist kStoreSource = 1 << 1, // Store source objects (OdDbEntities) kClearEmptyObjects = 1 << 2, // Clear empty objects kMultithreading = 1 << 3, // Enable/Disable multithreading kUseAdvancedTess = 1 << 4, // Using facet res kPartialOpen = 1 << 5, // Open source .dwg file in partial mode kLowMemoryImportToVSF = 1 << 6, // Use per-object import to VSF mechanism (in this mode the result of loadFrom will not the database but the VSF file) kImportBrepAsBrep = 1 << 7, // import brep as OdTvBrepData kConvertIndexedToRGB = 1 << 8, // Converted indexed colors to RGB during import kNeedCDATree = 1 << 9, // Need create CDA tree kNeedCollectPropertiesInCDA = 1 << 10, // Need collect native properties in CDA nodes kDisableFontSubstitution = 1 << 11, // Disable font substitution for missed fonts kImportFrozenLayers = 1 << 12, // Import objects on frozen layer kOverrideDevicePalette = 1 << 13, // Override device palette during append kIgnoreEdgesVisibilities = 1 << 14, // Ignore edge's visibilities kImportDbPoints = 1 << 15, // Import Db points kUseNewPDMODE = 1 << 16, // Use PDMODE from appended file kUseCustomDeviationForCurves = 1 << 17, // Use custom deviation for curves kDxfTextAdjustAlignment = 1 << 18, // Use test adjust alignment kIgnorePaperBackground = 1 << 19, // Ignore paper background kIgnorePaperPrintableArea = 1 << 20, // Ignore paper printable area kNeedOverrideDbPointsMode = 1 << 21, // Need to override DbPoints PDMODE kNeedOverrideDbPointsSize = 1 << 22, // Need to override DbPoints PDSIZE kNeedImportBlockAttributeDefinition = 1 << 23 // Need import block attribute definition }; public: OdTvVisualizeDwgFilerProperties(); virtual ~OdTvVisualizeDwgFilerProperties(); ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(OdTvVisualizeDwgFilerProperties); static OdRxDictionaryPtr createObject(); void setBackgroundColor(OdIntPtr pBackgroundColor); OdIntPtr getBackgroundColor() const; void setPalette(OdIntPtr palette); //palette should have 256 colors OdIntPtr getPalette() const; void setDCRect(OdIntPtr rect); //should be pointer to OdTvDCRect OdIntPtr getDCRect() const; void setObjectNaming(bool bSet) { SETBIT(m_flags, kObjectNaming, bSet); } bool getObjectNaming() const { return GETBIT(m_flags, kObjectNaming); } void setStoreSourceObjects(bool bSet) { SETBIT(m_flags, kStoreSource, bSet); } bool getStoreSourceObjects() const { return GETBIT(m_flags, kStoreSource); } void setClearEmptyObjects(bool bSet) { SETBIT(m_flags, kClearEmptyObjects, bSet); } bool getClearEmptyObjects() const { return GETBIT(m_flags, kClearEmptyObjects); } void setMultithreading(bool bSet) { SETBIT(m_flags, kMultithreading, bSet); } bool getMultithreading() const { return GETBIT(m_flags, kMultithreading); } void setCountOfThreads(OdUInt16 nThreads); OdUInt16 getCountOfThreads() const; void setFeedbackForChooseCallback(OdIntPtr pCallback); OdIntPtr getFeedbackForChooseCallback() const; void setUseAdvancedTess(bool bSet) { SETBIT(m_flags, kUseAdvancedTess, bSet); } bool getUseAdvancedTess() const { return GETBIT(m_flags, kUseAdvancedTess); } void setFacetRes(double dFacetRes); double getFacetRes() const; void setAppendTransform(OdIntPtr pTransform); OdIntPtr getAppendTransform() const; void setPartialOpen( bool b ) { SETBIT( m_flags, kPartialOpen, b ); } bool getPartialOpen() const { return GETBIT( m_flags, kPartialOpen ); } void setLowMemoryImportToVSF(bool b) { SETBIT(m_flags, kLowMemoryImportToVSF, b); } bool getLowMemoryImportToVSF() const { return GETBIT(m_flags, kLowMemoryImportToVSF); } void setPartialImportDumpFile(const OdString& str) { m_strPartialImportDumpFile = str; } OdString getPartialImportDumpFile() const { return m_strPartialImportDumpFile; } void setImportBrepAsBrep(bool b) { SETBIT(m_flags, kImportBrepAsBrep, b); } bool getImportBrepAsBrep() const { return GETBIT(m_flags, kImportBrepAsBrep); } void setConvertIndexedToRGB(bool b) { SETBIT(m_flags, kConvertIndexedToRGB, b); } bool getConvertIndexedToRGB() const { return GETBIT(m_flags, kConvertIndexedToRGB); } void setNeedCDATree(bool bSet) { SETBIT(m_flags, kNeedCDATree, bSet); } bool getNeedCDATree() const { return GETBIT(m_flags, kNeedCDATree); } void setNeedCollectPropertiesInCDA(bool bSet) { SETBIT(m_flags, kNeedCollectPropertiesInCDA, bSet); } bool getNeedCollectPropertiesInCDA() const { return GETBIT(m_flags, kNeedCollectPropertiesInCDA); } void setHostAppProgressMeter(OdIntPtr pProgressMeter); OdIntPtr getHostAppProgressMeter() const; void setLowMemoryImportAbort(OdIntPtr pAbort); OdIntPtr getLowMemoryImportAbort() const; void setLowMemoryImportVSFCompression(OdIntPtr pOptions); OdIntPtr getLowMemoryImportVSFCompression() const; void setDisableFontSubstitution( bool bSet ) { SETBIT( m_flags, kDisableFontSubstitution, bSet ); } bool getDisableFontSubstitution() const { return GETBIT( m_flags, kDisableFontSubstitution ); } void setImportFrozenLayers(bool bSet) { SETBIT(m_flags, kImportFrozenLayers, bSet); }; bool getImportFrozenLayers() const { return GETBIT(m_flags, kImportFrozenLayers); }; void setDefaultUnits(OdInt16 units) { m_defaultUnits = units; } OdInt16 getDefaultUnits() const { return m_defaultUnits; } void setOverrideDevicePalette(bool bSet) { SETBIT(m_flags, kOverrideDevicePalette, bSet); }; bool getOverrideDevicePalette() const { return GETBIT(m_flags, kOverrideDevicePalette); }; void setIgnoreEdgesVisibilities(bool bSet) { SETBIT(m_flags, kIgnoreEdgesVisibilities, bSet); } bool getIgnoreEdgesVisibilities() const { return GETBIT(m_flags, kIgnoreEdgesVisibilities); } void setUnloadQueueSize( OdUInt32 nSize ) { m_unloadQueueSize = nSize; } OdUInt32 getUnloadQueueSize() const { return m_unloadQueueSize; } void setImportDbPoints(bool bSet) { SETBIT(m_flags, kImportDbPoints, bSet); } bool getImportDbPoints() const { return GETBIT(m_flags, kImportDbPoints); } void setUseNewPDMODE(bool bSet) { SETBIT(m_flags, kUseNewPDMODE, bSet); } bool getUseNewPDMODE() const { return GETBIT(m_flags, kUseNewPDMODE); } void setUnloadQueueSizePercentLimit( double limit ) { if( limit < 0 ) m_unloadQueueSizePercentLimit = 0.; else if( limit > 1.0 ) m_unloadQueueSizePercentLimit = 1.0; else m_unloadQueueSizePercentLimit = limit; } double getUnloadQueueSizePercentLimit() const { return m_unloadQueueSizePercentLimit; } void setUseCustomDeviationForCurves(bool bUseCustomDeviationForCurves) { SETBIT(m_flags, kUseCustomDeviationForCurves, bUseCustomDeviationForCurves); } bool getUseCustomDeviationForCurves() const { return GETBIT(m_flags, kUseCustomDeviationForCurves); } void setCustomDeviationForCurves(double customDeviationForCurves) { m_dCustomDeviationForCurves = customDeviationForCurves; } double getCustomDeviationForCurves() const { return m_dCustomDeviationForCurves; } void setDxfTextAdjustAlignment( bool bEnable ) { SETBIT( m_flags, kDxfTextAdjustAlignment, bEnable ); } bool getDxfTextAdjustAlignment() const { return GETBIT( m_flags, kDxfTextAdjustAlignment ); } void setIgnorePaperBackground(bool bEnable) { SETBIT(m_flags, kIgnorePaperBackground, bEnable); } bool getIgnorePaperBackground() const { return GETBIT(m_flags, kIgnorePaperBackground); } void setIgnorePaperPrintableArea(bool bEnable) { SETBIT(m_flags, kIgnorePaperPrintableArea, bEnable); } bool getIgnorePaperPrintableArea() const { return GETBIT(m_flags, kIgnorePaperPrintableArea); } void setCustomFontFolder( const OdString& str ) { m_customFontFolder = str; } OdString getCustomFontFolder() const { return m_customFontFolder; } void setRecoverFileCallback(OdIntPtr pCallback); OdIntPtr getRecoverFileCallback() const; OdTvRecoverFileCallback getRecoverFileCallbackVal() const; void setRecoverFileAuditInfoCallback(OdIntPtr pCallback); OdIntPtr getRecoverFileAuditInfoCallback() const; OdTvRecoverFileAuditInfoCallback getRecoverFileAuditInfoCallbackVal() const; void setPlineSimplification( OdUInt8 val ); OdUInt8 getPlineSimplification() const; void setNeedOverrideDbPointsMode(bool bSet); bool getNeedOverrideDbPointsMode() const; void setNeedOverrideDbPointsSize(bool bSet); bool getNeedOverrideDbPointsSize() const; void setOverridePDMODE(OdInt16 PDMODE); OdInt16 getOverridePDMODE() const; void setOverridePDSIZE(double dPDSIZE); double getOverridePDSIZE() const; void setNeedImportBlockAttributeDefinition(bool bEnable) { SETBIT(m_flags, kNeedImportBlockAttributeDefinition, bEnable); } bool getNeedImportBlockAttributeDefinition() const { return GETBIT(m_flags, kNeedImportBlockAttributeDefinition); } protected: ODCOLORREF m_background; // Background color. Default: black const ODCOLORREF* m_pPalette; // Palette to be used. If NULL, one of two default palettes will be used depending on background color. Should have 256 colors OdTvDCRect m_importRect; // Output rectangle. Used for correct import of some specific objects (OLE image, camera). The normal way is to set the output window size OdUInt32 m_flags; // Different options OdUInt16 m_nThreads; // Count of threads OdTvFeedbackForChooseCallback m_pCallback; // Callback for choose double m_dFACETRES; // Facet res value (between from 0.01 to 10.0) OdTvMatrix m_appendTransform; // Transform for the append OdString m_strPartialImportDumpFile; // output VSF file name (used only in low memory import mode) OdTvHostAppProgressMeter* m_pHostAppProgressMeter; // host app progress meter (used only in low memory import mode) OdTvLowMemoryImportAbort* m_pLowMemoryImportAbort; // callback for giving ability to abort the low memory process OdTvVSFExportOptions m_VSFCompressOptions; // options for VSF file compression during low memory process OdInt16 m_defaultUnits; // default units OdUInt32 m_unloadQueueSize; //Number of objects to be unload together double m_unloadQueueSizePercentLimit; //Unload queue size limit: percent of blocks objects count double m_dCustomDeviationForCurves; // Custom deviation OdString m_customFontFolder; //Custom font folder OdTvRecoverFileCallback m_pRecoverFileCallback; // Callback for file recover. OdTvRecoverFileAuditInfoCallback m_pRecoverFileAuditInfoCallback; // Callback for file recover audit info. OdUInt8 m_plineSimplif; //pline simplification type OdInt16 m_overridePDMODE; // Override PDMODE, which specifies the display of Point entities during import. double m_dOverridePDSIZE; // Override PDSIZE, which specifies the display size of point entities during import. }; typedef OdSmartPtr OdTvVisualizeDwgFilerPropertiesPtr; } /** \details This class is an interface for the internal helper objects used inside the import process */ class OdTvVisualizeDwgFilerDbSource { public: virtual ~OdTvVisualizeDwgFilerDbSource() {}; virtual OdDbDatabasePtr getDb() = 0; virtual OdString getFilename() = 0; virtual double getInitTime() const { return 0; } virtual bool odWasInitialized() const { return true; } virtual bool isPartialOpen() const{ return false; } virtual OdDbHostAppProgressMeter* progressMeter() { return NULL; } }; /** \details This class helps tp manipulate with custom font folder */ class OdTvVisualizeDwgFilerCustomFontFolderSaver { bool m_bNeedRevert; OdString m_strOldEnvVar; public: OdTvVisualizeDwgFilerCustomFontFolderSaver(const OdString& strCustomFontFolder) : m_bNeedRevert(false) { if (!strCustomFontFolder.isEmpty()) { OdRxSystemServices* pSs = ::odrxSystemServices(); if (pSs != NULL) { OdString sEnv; pSs->getEnvVar(OD_T("ACAD"), sEnv); m_strOldEnvVar = sEnv; if (sEnv.isEmpty()) sEnv = strCustomFontFolder; else sEnv += (OdChar(separatorChar) + strCustomFontFolder); pSs->setEnvVar("ACAD", sEnv); m_bNeedRevert = true; } } } ~OdTvVisualizeDwgFilerCustomFontFolderSaver() { if (m_bNeedRevert) { OdRxSystemServices* pSs = ::odrxSystemServices(); if (pSs != NULL) { pSs->setEnvVar("ACAD", m_strOldEnvVar); } } } }; /** \details This class is dwg loader (to the Visualize database) */ class OdTvVisualizeDwgFiler : public OdTvVisualizeFiler { public: OdTvVisualizeDwgFiler(); virtual OdRxDictionaryPtr properties() { return m_properties; } virtual OdTvDatabaseId loadFrom(OdDbBaseDatabase* pDatabase, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; virtual OdTvDatabaseId loadFrom(OdStreamBuf* pBuffer, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; virtual OdTvDatabaseId loadFrom(const OdString& filePath, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; virtual OdTvDatabaseId generate(OdTvFilerTimeProfiling* pProfileRes = NULL) const; virtual OdTvModelId appendFrom(const OdTvDatabaseId& databaseId, OdDbBaseDatabase* pDatabase, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; virtual OdTvModelId appendFrom(const OdTvDatabaseId& databaseId, OdStreamBuf* pBuffer, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; virtual OdTvModelId appendFrom(const OdTvDatabaseId& databaseId, const OdString& filePath, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; virtual OdTvBlockId appendFrom(const OdTvDatabaseId& databaseId, const OdString& filePath, const OdTvModelId& modelId, OdTvFilerTimeProfiling* pProfileRes = NULL , OdTvResult* rc = NULL) const; //Native properties support virtual bool hasNativePropertiesSupport() const { return true; } virtual OdTvResult startActionsWithNativeProperties(const OdString& sFilePath, bool bPartial); virtual bool isActionsWithNativePropertiesStarted(const OdString& sFilePath); virtual OdTvResult endActionsWithNativeProperties(); virtual OdRxMemberIteratorPtr getNativePropertiesIterator(OdUInt64 dbHandle, OdTvResult* rc = NULL); virtual OdRxValue getNativePropertyValue(OdUInt64 dbHandle, const OdRxPropertyPtr& pProperty, bool* bReadOnly = NULL, OdTvResult* rc = NULL); virtual OdRxValueIteratorPtr getNativeCollectionPropertyIterator(OdUInt64 dbHandle, const OdRxCollectionPropertyPtr& pCollectionProperty, bool* bReadOnly = NULL, OdTvResult* rc = NULL); virtual OdTvResult setNativePropertyValue(OdUInt64 dbHandle, OdRxPropertyPtr& pProperty, const OdRxValue& value); virtual OdDbBaseDatabase* getNativeDatabase(OdTvResult* rc = NULL) const; private: OdTvDatabaseId loadFrom(OdTvVisualizeDwgFilerDbSource *pDwgDatabaseSource, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; OdTvDatabaseId partialLoadFrom(OdTvVisualizeDwgFilerDbSource *pDwgDatabaseSource, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; OdTvGsDeviceId findAndSetupActiveDevice(const OdTvDatabaseId& databaseId, ODCOLORREF& background, OdTvDCRect& rect, OdArray >& pPalCpy) const; void setupTriangParams(bool bUseAdvTess, OdRxModulePtr& pModelerModule, bool& bApplyFacetRes) const; OdDbDatabasePtr readDb(OdTvVisualizeDwgFilerDbSource* pDwgDatabaseSource, bool bApplyFacetRes, double facetRes) const; OdTvModelId appendFrom(const OdTvDatabaseId& databaseId, OdTvVisualizeDwgFilerDbSource *pDwgDatabaseSource, OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; OdTvBlockId appendFrom(const OdTvDatabaseId& databaseId, OdTvVisualizeDwgFilerDbSource* pDwgDatabaseSource, const OdTvModelId& modelId , OdTvFilerTimeProfiling* pProfileRes = NULL, OdTvResult* rc = NULL) const; void setupTvViews(OdDbObjectId layoutId, OdGsLayoutHelper* pLayoutHelper, OdTvGsDeviceId idTVDevice, const ODCOLORREF& borderColor, OdString* pNewModelName = NULL) const; int getActiveViewId(OdGsLayoutHelper* pLayoutHelper, int& iPaperViewId) const; void setViewBorderProperties(OdGsDevice* pDevice, const ODCOLORREF& color) const; int getChoosedSpaces(const OdDbDatabasePtr pDbDatabase, OdTvFilerFeedbackForChooseObject& filerFeedbackForChoose, bool& bCanceled) const; void setViewAndModelNames(const OdTvGsViewId& viewId, const OdString& deviceName, const OdGsClientViewInfo& viewInfo, OdString* pNewModelName = NULL) const; void setViewportConfiguration(const OdTvGsViewId& viewId, const OdTvGsViewId& activeViewId, OdGsLayoutHelperPtr pLayoutHelper, int iActViewInd, int ind) const; void setupExVisualizeDeviceProp(OdRxDictionaryPtr& pProperties, const OdTvDatabaseId& tvDbId, bool bUseTimeProfiling, const OdString& modelSpaceName, const OdString& strDwgPath, const DWG2Visualize::OdTvVisualizeDwgFilerPropertiesPtr& importProperties, const ExGsVisualizeDeviceCache& deviceCache, OdTvGsDeviceId& tvDeviceIdForAppend, bool bHavePaperSpace) const; void createCommonDataAccessTree(OdTvDatabasePtr pTvDb, OdDbDatabase *pDatabase, const OdString& strTreeName, const std::set& spaces) const; OdTvRegAppId setLayoutUserData(OdTvGsDeviceId tvDeviceId, OdDbObjectId layoutId, OdTvDatabaseId databaseId) const; void changeFrozenLayersToHidden(const OdDbDatabasePtr& pDb); void setFrozenLayersTotallyInvisible(const ExGsVisualizeDeviceCache* pDeviceCache); void markMaterialDwgGlobal(OdTvDatabaseId databaseId) const; bool dwgGlobalMaterialExists(OdTvDatabaseId databaseId) const; void changeMaterialsName(const OdTvDatabaseId& tvDbId, OdDbDatabasePtr pSourceDb) const; void addAttributeDefinitionUserDataToTvBlocks(const OdTvDatabaseId& tvdbId, OdDbDatabasePtr pDb) const; private: DWG2Visualize::OdTvVisualizeDwgFilerPropertiesPtr m_properties; OdRxModulePtr m_pDbPropertiesModule; OdRxModulePtr m_pRxPropertiesModule; OdDbDatabasePtr m_pDatabaseForNativeProp; OdSharedPtr m_pSourceOfDatabaseForNativeProp; //we need to store it for having services valid all the time between startActions/endActions std::map m_viewportMap; mutable OdDbObjectId m_paperViewportId; OdArray m_frozenLayers; }; /** \details This class is dwg loader module implementation */ class OdTvVisualizeDwgFilerModule : public OdTvVisualizeFilerModule { public: virtual OdTvVisualizeFilerPtr getVisualizeFiler() const; void initApp(); void uninitApp(); }; /** \details This class is service for getting database for dwg file */ class OdTvDwgService : public RxSystemServicesImpl, public OdDbHostAppServices2, public OdDbHostAppProgressMeter { int m_pagingType; OdTvHostAppProgressMeter* m_pProgressMeter; bool m_bDisableFontSubstitution; OdHatchPatternManagerPtr m_patternManager; public: OdTvDwgService() { m_pagingType = 0; m_pProgressMeter = 0; m_bDisableFontSubstitution = false; } void setHostAppProgressMeter(OdTvHostAppProgressMeter* pMeter) { m_pProgressMeter = pMeter; } virtual void start(const OdString& displayString = OdString::kEmpty) { if (m_pProgressMeter) m_pProgressMeter->start(displayString); } virtual void stop() { if (m_pProgressMeter) m_pProgressMeter->stop(); } virtual void meterProgress() { if (m_pProgressMeter) m_pProgressMeter->meterProgress(); } virtual void setLimit(int max) { if (m_pProgressMeter) m_pProgressMeter->setLimit(max); } virtual OdHatchPatternManager* patternManager() { if (m_patternManager.isNull()) { // dna: use odrxSafeCreateObject() for no linking to TD_DbFull m_patternManager = odrxSafeCreateObject("OdHatchPatternManager", OdDbEntitiesAppName); m_patternManager->setApplicationService(this); } return m_patternManager.get(); } virtual OdDbPageControllerPtr newPageController() { switch (m_pagingType) { case 1: //OdDb::kUnload // Simple unloading of objects for partially loaded database. return OdRxObjectImpl::createObject(); case 2: //OdDb::kPage case 3: //OdDb::kUnload | OdDb::kPage // Unloading of objects for partially loaded database and paging of objects thru ExPageController. return OdRxObjectImpl::createObject(); } // Paging is not used. return OdDbPageControllerPtr(); } int setPagingType(int pagingType) { int oldType = m_pagingType; m_pagingType = pagingType; return oldType; } bool getDisableFontSubstitution() const { return m_bDisableFontSubstitution; } void setDisableFontSubstitution( bool bSet ) { m_bDisableFontSubstitution = bSet; } virtual OdString findFile( const OdString& filename, OdDbBaseDatabase* pDb = 0, FindFileHint hint = kDefault ) { if (m_bDisableFontSubstitution && (hint == kFontFile || hint == kCompiledShapeFile || hint == kTrueTypeFontFile)) { // 1. Check file name itself as full path OdDbSystemServices* pSs = odSystemServices(); if (pSs->accessFile(filename, Oda::kFileRead)) return filename; if (!pDb) return OdString(); // 2. Check around database OdString sFilenameFromAttr = filename; sFilenameFromAttr.replace('\\', '/'); int iSlashPos = sFilenameFromAttr.reverseFind(L'/'); if (iSlashPos != -1) sFilenameFromAttr = sFilenameFromAttr.right(sFilenameFromAttr.getAllocLength() - iSlashPos - 1); OdString sDatabaseFileName = OdDbBaseDatabasePEPtr(pDb)->getFilename(pDb); sDatabaseFileName.replace('\\', '/'); iSlashPos = sDatabaseFileName.reverseFind(L'/'); if (iSlashPos == -1) return OdString(); OdString sFontFile = sDatabaseFileName.left(iSlashPos + 1); sFontFile += sFilenameFromAttr; if (pSs->accessFile(sFontFile, Oda::kFileRead)) return sFontFile; return OdString(); } return OdDbHostAppServices2::findFile( filename, pDb, hint ); } virtual OdString getSubstituteFont( const OdString& fontName, OdFontType fontType ) { if( m_bDisableFontSubstitution ) return OdString(); return OdDbHostAppServices2::getSubstituteFont( fontName, fontType ); } virtual OdString getSubstituteFontByChar( const OdFont& pFont, OdChar unicodeChar, OdDbBaseDatabase* pDb ) { if( m_bDisableFontSubstitution ) return OdString(); return OdDbHostAppServices2::getSubstituteFontByChar( pFont, unicodeChar, pDb ); } }; bool addTvPaperDrawingCustomization(bool bIgnorePrintableArea); void removeTvPaperDrawingCustomization(); void writeNativeDbDataAsUserData(const OdTvDatabaseId& dbId, OdDbDatabasePtr pNativeDb, DWG2Visualize::OdTvVisualizeDwgFilerPropertiesPtr pProperties, bool bAppendMode = false); void updateNativeDbDataAsUserData(const OdTvDatabaseId& dbId, OdDbDatabasePtr pNativeDb); void setupTextStyleHandles( const OdTvDatabaseId& tvdbId, OdDbDatabasePtr pDb, const OdString& prefix = OdString::kEmpty ); #include "TD_PackPop.h" #endif