19949213aSStephan Aßmus /*****************************************************************************/ 29949213aSStephan Aßmus // STXTTranslator 3*2ca13760SColdfirex // Written by Michael Wilber, Haiku Translation Kit Team 49949213aSStephan Aßmus // 59949213aSStephan Aßmus // STXTTranslator.h 69949213aSStephan Aßmus // 79949213aSStephan Aßmus // This BTranslator based object is for opening and writing 89949213aSStephan Aßmus // StyledEdit (STXT) files. 99949213aSStephan Aßmus // 109949213aSStephan Aßmus // 11*2ca13760SColdfirex // Copyright (c) 2002 Haiku Project 129949213aSStephan Aßmus // 139949213aSStephan Aßmus // Permission is hereby granted, free of charge, to any person obtaining a 149949213aSStephan Aßmus // copy of this software and associated documentation files (the "Software"), 159949213aSStephan Aßmus // to deal in the Software without restriction, including without limitation 169949213aSStephan Aßmus // the rights to use, copy, modify, merge, publish, distribute, sublicense, 179949213aSStephan Aßmus // and/or sell copies of the Software, and to permit persons to whom the 189949213aSStephan Aßmus // Software is furnished to do so, subject to the following conditions: 199949213aSStephan Aßmus // 209949213aSStephan Aßmus // The above copyright notice and this permission notice shall be included 219949213aSStephan Aßmus // in all copies or substantial portions of the Software. 229949213aSStephan Aßmus // 239949213aSStephan Aßmus // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 249949213aSStephan Aßmus // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 259949213aSStephan Aßmus // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 269949213aSStephan Aßmus // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 279949213aSStephan Aßmus // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 289949213aSStephan Aßmus // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 299949213aSStephan Aßmus // DEALINGS IN THE SOFTWARE. 309949213aSStephan Aßmus /*****************************************************************************/ 319949213aSStephan Aßmus 329949213aSStephan Aßmus #ifndef STXT_TRANSLATOR_H 339949213aSStephan Aßmus #define STXT_TRANSLATOR_H 349949213aSStephan Aßmus 359949213aSStephan Aßmus #include <Translator.h> 369949213aSStephan Aßmus #include <TranslatorFormats.h> 379949213aSStephan Aßmus #include <TranslationDefs.h> 389949213aSStephan Aßmus #include <GraphicsDefs.h> 399949213aSStephan Aßmus #include <InterfaceDefs.h> 409949213aSStephan Aßmus #include <File.h> 419949213aSStephan Aßmus #include <ByteOrder.h> 429949213aSStephan Aßmus #include <fs_attr.h> 439949213aSStephan Aßmus #include "BaseTranslator.h" 449949213aSStephan Aßmus 459949213aSStephan Aßmus #define STXT_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(1,0,0) 469949213aSStephan Aßmus #define STXT_IN_QUALITY 0.5 479949213aSStephan Aßmus #define STXT_IN_CAPABILITY 0.5 489949213aSStephan Aßmus #define STXT_OUT_QUALITY 0.5 499949213aSStephan Aßmus #define STXT_OUT_CAPABILITY 0.5 509949213aSStephan Aßmus 519949213aSStephan Aßmus #define TEXT_IN_QUALITY 0.4 529949213aSStephan Aßmus #define TEXT_IN_CAPABILITY 0.6 539949213aSStephan Aßmus #define TEXT_OUT_QUALITY 0.4 549949213aSStephan Aßmus #define TEXT_OUT_CAPABILITY 0.6 559949213aSStephan Aßmus 569949213aSStephan Aßmus class STXTTranslator : public BaseTranslator { 579949213aSStephan Aßmus public: 589949213aSStephan Aßmus STXTTranslator(); 599949213aSStephan Aßmus 609949213aSStephan Aßmus virtual status_t Identify(BPositionIO *inSource, 619949213aSStephan Aßmus const translation_format *inFormat, BMessage *ioExtension, 629949213aSStephan Aßmus translator_info *outInfo, uint32 outType); 639949213aSStephan Aßmus // determines whether or not this translator can convert the 649949213aSStephan Aßmus // data in inSource to the type outType 659949213aSStephan Aßmus 669949213aSStephan Aßmus virtual status_t Translate(BPositionIO *inSource, 679949213aSStephan Aßmus const translator_info *inInfo, BMessage *ioExtension, 689949213aSStephan Aßmus uint32 outType, BPositionIO *outDestination); 699949213aSStephan Aßmus // this function is the whole point of the Translation Kit, 709949213aSStephan Aßmus // it translates the data in inSource to outDestination 719949213aSStephan Aßmus // using the format outType 729949213aSStephan Aßmus 739949213aSStephan Aßmus virtual BView *NewConfigView(TranslatorSettings *settings); 749949213aSStephan Aßmus 759949213aSStephan Aßmus protected: 769949213aSStephan Aßmus virtual ~STXTTranslator(); 779949213aSStephan Aßmus // this is protected because the object is deleted by the 789949213aSStephan Aßmus // Release() function instead of being deleted directly by 799949213aSStephan Aßmus // the user 809949213aSStephan Aßmus 819949213aSStephan Aßmus private: 829949213aSStephan Aßmus }; 839949213aSStephan Aßmus 849949213aSStephan Aßmus #endif // #ifndef STXT_TRANSLATOR_H 85