1/*****************************************************************************/ 2// STXTTranslator 3// Written by Michael Wilber, Haiku Translation Kit Team 4// 5// STXTTranslator.h 6// 7// This BTranslator based object is for opening and writing 8// StyledEdit (STXT) files. 9// 10// 11// Copyright (c) 2002 Haiku Project 12// 13// Permission is hereby granted, free of charge, to any person obtaining a 14// copy of this software and associated documentation files (the "Software"), 15// to deal in the Software without restriction, including without limitation 16// the rights to use, copy, modify, merge, publish, distribute, sublicense, 17// and/or sell copies of the Software, and to permit persons to whom the 18// Software is furnished to do so, subject to the following conditions: 19// 20// The above copyright notice and this permission notice shall be included 21// in all copies or substantial portions of the Software. 22// 23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29// DEALINGS IN THE SOFTWARE. 30/*****************************************************************************/ 31 32#ifndef STXT_TRANSLATOR_H 33#define STXT_TRANSLATOR_H 34 35#include <Translator.h> 36#include <TranslatorFormats.h> 37#include <TranslationDefs.h> 38#include <GraphicsDefs.h> 39#include <InterfaceDefs.h> 40#include <File.h> 41#include <ByteOrder.h> 42#include <fs_attr.h> 43#include "BaseTranslator.h" 44 45#define STXT_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(1,0,0) 46#define STXT_IN_QUALITY 0.5 47#define STXT_IN_CAPABILITY 0.5 48#define STXT_OUT_QUALITY 0.5 49#define STXT_OUT_CAPABILITY 0.5 50 51#define TEXT_IN_QUALITY 0.4 52#define TEXT_IN_CAPABILITY 0.6 53#define TEXT_OUT_QUALITY 0.4 54#define TEXT_OUT_CAPABILITY 0.6 55 56class STXTTranslator : public BaseTranslator { 57public: 58 STXTTranslator(); 59 60 virtual status_t Identify(BPositionIO *inSource, 61 const translation_format *inFormat, BMessage *ioExtension, 62 translator_info *outInfo, uint32 outType); 63 // determines whether or not this translator can convert the 64 // data in inSource to the type outType 65 66 virtual status_t Translate(BPositionIO *inSource, 67 const translator_info *inInfo, BMessage *ioExtension, 68 uint32 outType, BPositionIO *outDestination); 69 // this function is the whole point of the Translation Kit, 70 // it translates the data in inSource to outDestination 71 // using the format outType 72 73 virtual BView *NewConfigView(TranslatorSettings *settings); 74 75protected: 76 virtual ~STXTTranslator(); 77 // this is protected because the object is deleted by the 78 // Release() function instead of being deleted directly by 79 // the user 80 81private: 82}; 83 84#endif // #ifndef STXT_TRANSLATOR_H 85