Home | History | Annotate | Download | only in mac
      1 /*
      2  * Copyright (C) 2010 Apple Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  * 1. Redistributions of source code must retain the above copyright
      8  *    notice, this list of conditions and the following disclaimer.
      9  * 2. Redistributions in binary form must reproduce the above copyright
     10  *    notice, this list of conditions and the following disclaimer in the
     11  *    documentation and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
     14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
     17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     23  * THE POSSIBILITY OF SUCH DAMAGE.
     24  */
     25 
     26 @class DOMDocument;
     27 @class DOMRange;
     28 
     29 namespace WebCore {
     30     class DocumentLoader;
     31     class Range;
     32 }
     33 
     34 @interface WebHTMLConverter : NSObject {
     35     NSMutableAttributedString *_attrStr;
     36     NSURL *_baseURL;
     37     DOMDocument *_document;
     38     DOMRange *_domRange;
     39     NSMutableArray *_domStartAncestors;
     40     WebCore::DocumentLoader *_dataSource;
     41     NSString *_standardFontFamily;
     42     CGFloat _textSizeMultiplier;
     43     CGFloat _webViewTextSizeMultiplier;
     44     CGFloat _defaultTabInterval;
     45     CGFloat _defaultFontSize;
     46     CGFloat _minimumFontSize;
     47     NSMutableArray *_textLists;
     48     NSMutableArray *_textBlocks;
     49     NSMutableArray *_textTables;
     50     NSMutableDictionary *_textTableFooters;
     51     NSMutableArray *_textTableSpacings;
     52     NSMutableArray *_textTablePaddings;
     53     NSMutableArray *_textTableRows;
     54     NSMutableArray *_textTableRowArrays;
     55     NSMutableArray *_textTableRowBackgroundColors;
     56     NSMutableDictionary *_computedStylesForElements;
     57     NSMutableDictionary *_specifiedStylesForElements;
     58     NSMutableDictionary *_stringsForNodes;
     59     NSMutableDictionary *_floatsForNodes;
     60     NSMutableDictionary *_colorsForNodes;
     61     NSMutableDictionary *_attributesForElements;
     62     NSMutableDictionary *_elementIsBlockLevel;
     63     NSMutableDictionary *_fontCache;
     64     NSMutableArray *_writingDirectionArray;
     65     NSUInteger _domRangeStartIndex;
     66     NSInteger _indexingLimit;
     67     NSUInteger _thumbnailLimit;
     68     NSInteger _errorCode;
     69     NSInteger _quoteLevel;
     70 
     71     struct {
     72         unsigned int isSoft:1;
     73         unsigned int reachedStart:1;
     74         unsigned int reachedEnd:1;
     75         unsigned int isIndexing:1;
     76         unsigned int isTesting:1;
     77         unsigned int hasTrailingNewline:1;
     78         unsigned int pad:26;
     79     } _flags;
     80 }
     81 
     82 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     83 - (id)init;
     84 - (id)initWithDOMRange:(DOMRange *)domRange;
     85 
     86 - (NSAttributedString *)attributedString;
     87 #endif
     88 
     89 + (NSAttributedString *)editingAttributedStringFromRange:(WebCore::Range*)range;
     90 @end
     91 
     92