home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Pages.h
-
- Contains: xxx put contents here xxx
-
- Written by: Essam Zaky
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <3> 1/5/94 EZ don't compile if txtnMultiFrames compilation var is not defined
- <2> 1/4/94 EZ clean up
- <1> 1/4/94 EZ first checked in
-
- */
-
- #ifdef txtnMultiFrames
-
- #ifndef _Pages_
- #define _Pages_
-
- #ifndef _ToolBoxDump_
- #include "ToolBoxDump.h"
- #endif
-
- #ifndef _TextensionCommon_
- #include "TextensionCommon.h"
- #endif
-
- #ifndef _Array_
- #include "Array.h"
- #endif
-
- #ifndef _Frames_
- #include "Frames.h"
- #endif
-
- #ifndef _FrameFormatter_
- #include "FrameFormatter.h"
- #endif
-
- //***************************************************************************************************
-
- const short kPageGutter = 5;
-
- class CPageFrames : public CMonoSizeFrames {
- public:
- CPageFrames();
-
- void IPageFrames();
-
- //•override
-
- virtual void SectFrames(const Rect* theRect, CSectFrames* sectedFrames) const;
-
-
- #ifdef txtnScal
- virtual void GetAbsTextFrame(long frameNo, TxtnLongRect* absRect, Boolean scaled = true) const;
-
- virtual void GetAbsFrameRect(long frameNo, TxtnLongRect* theRect, Boolean scaled = true) const;
- #else
- virtual void GetAbsTextFrame(long frameNo, TxtnLongRect* absRect) const;
-
- virtual void GetAbsFrameRect(long frameNo, TxtnLongRect* theRect) const;
- #endif
-
- virtual long GetTotalHite() const;
- virtual long GetTotalWidth() const;
-
- //•own members
- inline short GetCountRowPages() {return fRowPages;}
- void SetCountRowPages(short newCount, CDisplayChanges* changes = nil);
-
- virtual long GetCountPages() const;
-
- virtual long Point2Frame(const LongPoint* thePt) const;
- //up to now, always return a value >= 0
-
- void PageNo2Cell(long frameNo, TCell* cell) const;
-
- protected:
- short fRowPages;
-
- //•override
- virtual void CreateFrameFormatter();
-
- //•own members
- #ifdef txtnScal
- long GetPageHite(Boolean scaled = true) const; //scaled, without gutter
- long GetPageWidth(Boolean scaled = true) const; //scaled, without gutter
- #else
- long GetPageHite() const; //scaled, without gutter
- long GetPageWidth() const; //scaled, without gutter
- #endif
-
- short Flip(short indexInRow, short countInRow, char direction) const;
-
- virtual short GetPageGutter() const; //returns kPageGutter, never scaled
-
-
- private:
- };
- //*************************************************************************************************
-
-
- //array element for fFramesLines
- struct TFrameLines {
- long lastLine;
- short linesHite; //non scaled
- };
- typedef TFrameLines* TFrameLinesPtr;
-
- class CMultiFrameFormatter : public CFrameFormatter {
- public:
- CMultiFrameFormatter();
-
- void IMultiFrameFormatter();
-
- //•override
- virtual void Free();
- virtual void FreeData();
- virtual void Compact();
-
- virtual void SetFrameHite(long frameNo, short newHite) = 0;
- virtual short GetFrameHite(long frameNo) const = 0; //non scaled
-
- virtual OSErr InsertLine(const TLineHiteInfo* lineHiteInfo, CFormatReflowLines* formatReflowLines,
- long lineNo = -1);
- virtual OSErr SetLineHiteInfo(const TLineHiteInfo* lineHiteInfo, long lineNo
- , CFormatReflowLines* formatReflowLines);
- virtual void RemoveLines(long countLines, long lineNo, CFormatReflowLines* formatReflowLines);
-
- virtual OSErr ForceOverflow(long lineNo);
-
- virtual Boolean GetFrameLineRange(long frameNo, TOffsetPair* frameLines) const;
- virtual long Line2Frame(TOffset offset) const;
-
- virtual long GetCountFrames() const;
-
- #ifdef txtnScal
- virtual long GetFrameTextHite(long frameNo, Boolean scaled = true) const;
- #else
- virtual long GetFrameTextHite(long frameNo) const;
- #endif
-
- protected:
- CRanges* fFramesLines; //TFrameLines array
-
- Boolean fCheckReflow;
-
- //•override
-
-
- //•own members
- virtual Boolean VariableSizeFrames() const;
-
- OSErr CheckReflow(long frameNo, CFormatReflowLines* formatReflowLines
- , Boolean checkFrameBefore =false
- , short pixReflow =0, const TOffsetPair* linesReflow=nil);
-
- virtual Boolean MeasureFrame(long frameNo, short* pixReflow, long* newFrameEnd
- , TOffsetPair* linesReflow);
-
- virtual Boolean BreakFrame(long frameNo, short* pixReflow, TOffsetPair* linesReflow
- , CFormatReflowLines* formatReflowLines);
-
- virtual OSErr AppendFrame(short framePix, long lastLine =-1);
-
- void RemoveFrames(long count, long frameNo);
-
- #ifdef txtnDebug
- void CheckFramesLines();
- #endif
-
-
- private:
- void RemoveFrameLines(long frameNo, long firstLine, long lastLine);
-
- long RemoveFormattedFrames(long frameNo, short* pix2Remove, TOffsetPair* lines2Remove);
- };
- //*************************************************************************************************
-
- class CPageFormatter : public CMultiFrameFormatter { //multi frame formatter with fixed size frame
- public:
- CPageFormatter();
-
- void IPageFormatter();
-
- //•override
- virtual void SetFrameHite(long frameNo, short newHite);
- virtual short GetFrameHite(long frameNo) const;
-
- virtual OSErr Format();
-
- //•own members
-
- protected:
- //•override
-
- //•own members
-
- private:
- short fPageHite;
- };
- //*************************************************************************************************
-
- #endif //_Pages_
-
-
- #endif //txtnMultiFrames