(ieft),createNew);打開word文件代碼段UT_ErrorPD_Document::readF" />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

abiword架構分析筆記

系統 1815 0

源碼版本:2.4.6

打開文件文件操作:

響應函數:UT_Error AP_Frame::loadDocument(const char * szFilename, int ieft, bool createNew)

加載操作:loadDocument::errorCode = ?_loadDocument(szFilename, static_cast<IEFileType>(ieft), createNew);

?

打開word文件代碼段

UT_Error PD_Document::readFromFile(const char * szFilename, int ieft,
const char * impProps)

?

?

      UT_Error PD_Document::readFromFile(
      
        const
      
      
        char
      
       * szFilename, 
      
        int
      
      
         ieft,

                                   
      
      
        const
      
      
        char
      
       *
      
         impProps)

{

    
      
      
        if
      
       (!szFilename || !*
      
        szFilename)

    {

        UT_DEBUGMSG((
      
      
        "
      
      
        PD_Document::readFromFile -- invalid filename\n
      
      
        "
      
      
        ));

        
      
      
        return
      
      
         UT_INVALIDFILENAME;

    }



    
      
      
        if
      
       ( !
      
        UT_isRegularFile(szFilename) )

    {

      UT_DEBUGMSG ((
      
      
        "
      
      
        PD_Document::readFromFile -- file (%s) is not plain file\n
      
      
        "
      
      
        ,szFilename));

      
      
      
        return
      
      
         UT_INVALIDFILENAME;

    }



    
      
      
        if
      
       (!
      
        UT_fileSize(szFilename))

    {

        UT_DEBUGMSG((
      
      
        "
      
      
        PD_Document::readFromFile -- file (%s) is empty\n
      
      
        "
      
      
        ,szFilename));

        
      
      
        return
      
      
         UT_IE_BOGUSDOCUMENT;

    }

    

    m_pPieceTable 
      
      = 
      
        new
      
       pt_PieceTable(
      
        this
      
      
        );

    
      
      
        if
      
       (!
      
        m_pPieceTable)

    {

        UT_DEBUGMSG((
      
      
        "
      
      
        PD_Document::readFromFile -- could not construct piece table\n
      
      
        "
      
      
        ));

        
      
      
        return
      
      
         UT_NOPIECETABLE;

    }



    m_pPieceTable
      
      ->
      
        setPieceTableState(PTS_Loading);



    {

        UT_String template_list[
      
      
        6
      
      
        ];

        

        buildTemplateList (template_list, 
      
      
        "
      
      
        normal.awt
      
      
        "
      
      
        );



        
      
      
        bool
      
       success = 
      
        false
      
      
        ;

        
      
      
        for
      
       (UT_uint32 i = 
      
        0
      
      ; i < 
      
        6
      
       && !success; i++
      
        )

            success 
      
      = (importStyles(template_list[i].c_str(), ieft, 
      
        true
      
      ) ==
      
         UT_OK);



        
      
      
        //
      
      
         don't worry if this fails
      
      
            }



    IE_Imp 
      
      * pie =
      
         NULL;

    UT_Error errorCode;



    errorCode 
      
      = IE_Imp::constructImporter(
      
        this
      
      , szFilename, static_cast<IEFileType>(ieft), &pie, &
      
        m_lastOpenedType);

    
      
      
        if
      
      
         (errorCode)

    {

        UT_DEBUGMSG((
      
      
        "
      
      
        PD_Document::readFromFile -- could not construct importer\n
      
      
        "
      
      
        ));

        
      
      
        return
      
      
         errorCode;

    }

    
      
      
        if
      
       (impProps &&
      
         strlen(impProps))

        pie
      
      ->
      
        setProps (impProps);



    _syncFileTypes(
      
      
        false
      
      
        );



    
      
      
        //
      
      
         set standard document properties and attributes, such as dtd, lang,

    
      
      
        //
      
      
         dom-dir, etc., which the importer can then overwite

    
      
      
        //
      
      
         this also initializes m_indexAP
      
      

    m_indexAP = 
      
        0xffffffff
      
      
        ;

    setAttrProp(NULL);



    errorCode 
      
      = pie->
      
        importFile(szFilename);

    delete pie;

        repairDoc();    
      
      
        //
      
      
        意味著之前已經讀取并且分析了文檔結構了
      
    

?

abiword架構分析筆記


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 英山县| 峨边| 澜沧| 依安县| 武宣县| 迁西县| 堆龙德庆县| 同心县| 富民县| 儋州市| 汽车| 镇雄县| 遵义市| 怀化市| 仙游县| 宁晋县| 云龙县| 卫辉市| 嘉义市| 彭山县| 泊头市| 长宁县| 富锦市| 阳西县| 疏勒县| 许昌市| 祥云县| 隆昌县| 若尔盖县| 渭源县| 文化| 尚义县| 绿春县| 寻甸| 合川市| 巴塘县| 水城县| 哈尔滨市| 兰西县| 凌云县| 监利县|