diff options
author | Andreas Martens <ama@openoffice.org> | 2001-10-19 09:25:19 +0000 |
---|---|---|
committer | Andreas Martens <ama@openoffice.org> | 2001-10-19 09:25:19 +0000 |
commit | 636f3140734b1ae0a7a68ad1ec671123ac7dc8d2 (patch) | |
tree | c782214f3b336a27e9f5f5d7a3d1a03ecf79f1bf /sw | |
parent | 00226c8a3cdbf1faa960e70a69181de65f304394 (diff) |
Chg: Vertical layout grow/shrink
Diffstat (limited to 'sw')
29 files changed, 920 insertions, 293 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 4ca63a7434f4..6f1dba0a8795 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: notxtfrm.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: ama $ $Date: 2001-08-23 13:53:11 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:06:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -713,11 +713,18 @@ void SwNoTxtFrm::Format( const SwBorderAttrs * ) // hat sich die Hoehe geaendert? SwTwips nChgHght = (SwTwips)(aNewSize.Height() - Prt().Height()); +#ifdef VERTICAL_LAYOUT + if( nChgHght > 0) + Grow( nChgHght ); + else if( nChgHght < 0) + Shrink( Min(Prt().Height(), -nChgHght) ); +#else const SzPtr pVar = pVARSIZE; if( nChgHght > 0) Grow( nChgHght, pVar ); else if( nChgHght < 0) Shrink( Min(Prt().Height(), -nChgHght), pVar ); +#endif } /************************************************************************* diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx index 8d3c8022ae82..111916976a3f 100644 --- a/sw/source/core/inc/cntfrm.hxx +++ b/sw/source/core/inc/cntfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: cntfrm.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2001-10-12 13:22:10 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:09:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,9 +95,9 @@ protected: BOOL MakePrtArea( const SwBorderAttrs & ); virtual void Modify( SfxPoolItem*, SfxPoolItem* ); - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); SwCntntFrm( SwCntntNode * const ); diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 49ed70acf2e7..a530d41ca101 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: flyfrm.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2001-10-12 13:22:10 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:10:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -179,8 +179,8 @@ public: virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); #endif - SwTwips _Shrink( SwTwips, const SzPtr, BOOL bTst ); - SwTwips _Grow ( SwTwips, const SzPtr, BOOL bTst ); + SwTwips _Shrink( SwTwips, SZPTR BOOL bTst ); + SwTwips _Grow ( SwTwips, SZPTR BOOL bTst ); void _Invalidate( SwPageFrm *pPage = 0 ); BOOL FrmSizeChg( const SwFmtFrmSize & ); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 6d1e26cd80af..d66f787673e1 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -2,9 +2,9 @@ * * $RCSfile: frame.hxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: ama $ $Date: 2001-10-05 12:30:53 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:10:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,12 +68,27 @@ #include "swrect.hxx" #include "calbck.hxx" // fuer SwClient +#ifdef VERTICAL_LAYOUT + +#define SZPTR +#define PHEIGHT +#define PWIDTH +#define BFIXHEIGHT bFixSize +#define PTPTR PointPtr +#define SIZEPTR SizePtr +typedef long Size::* SizePtr; +typedef long Point::* PointPtr; + +#else + typedef long Size::* SzPtr; extern SzPtr pHeight; extern SzPtr pWidth; typedef long Point::* PtPtr; extern PtPtr pX; extern PtPtr pY; +#define PTPTR PtPtr +#define SIZEPTR SzPtr //Liefern Memberpointer auf die jeweiligen Groessen. #define pFIXPOS ( bVarHeight ? pX : pY ) @@ -81,6 +96,12 @@ extern PtPtr pY; #define pVARPOS ( bVarHeight ? pY : pX ) #define pVARSIZE ( bVarHeight ? pHeight : pWidth ) +#define SZPTR const SzPtr, +#define PHEIGHT ,pHeight +#define PWIDTH ,pWidth +#define BFIXHEIGHT bFixHeight +#endif + class SwLayoutFrm; class SwRootFrm; class SwPageFrm; @@ -99,7 +120,6 @@ class ViewShell; class Brush; class Color; class SwBorderAttrs; -class Sw3FrameIo; class SwCache; class SvxBrushItem; class SwTxtFtn; @@ -177,11 +197,6 @@ struct SwCrsrMoveState; #define FRM_NEIGHBOUR 0x2004 #define FRM_NOTE_VERT 0x5a60 -#define V_WIDTH SSize().*pDir1Sz -#define V_HEIGHT SSize().*pDir2Sz -#define V_X Pos().*pDir1Pt -#define V_Y Pos().*pDir2Pt - class SwFrm; typedef long (SwFrm:: *SwFrmGet)() const; typedef BOOL (SwFrm:: *SwFrmMax)( long ); @@ -232,6 +247,10 @@ extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R; SwRectFn fnRect = bVert ? \ ( bRev ? fnRectVL2R : fnRectVert ): \ ( bRev ? fnRectB2T : fnRectHori ); +#define SWRECTFN2( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \ + sal_Bool bNeighb = pFrm->IsNeighbourFrm(); \ + SwRectFn fnRect = bVert == bNeighb ? \ + fnRectHori : fnRectVert; #define POS_DIFF( aFrm1, aFrm2 ) \ ( (aFrm1.*fnRect->fnGetTop)() != (aFrm2.*fnRect->fnGetTop)() || \ (aFrm1.*fnRect->fnGetLeft)() != (aFrm2.*fnRect->fnGetLeft)() ) @@ -417,8 +436,13 @@ protected: BOOL bValidPrtArea: 1; BOOL bValidSize: 1; BOOL bValidLineNum: 1; +#ifdef VERTICAL_LAYOUT + BOOL bFixSize: 1; + BOOL bUnUsed1: 1; +#else BOOL bFixHeight: 1; BOOL bFixWidth: 1; +#endif BOOL bCompletePaint: 1; //Frame wird ganz gepaintet wenn TRUE, auch //wenn der Inhalt nur teilw. veraendert ist; //Bei CntntFrms wird ausschliesslich wenn TRUE @@ -426,7 +450,11 @@ protected: BOOL bRetouche: 1; //Der Frame ist fuer Retusche verantwortlich //wenn TRUE. public: +#ifdef VERTICAL_LAYOUT + BOOL bUnUsed2: 1; +#else BOOL bVarHeight: 1; //Variable groesse ist die Hoehe wenn TRUE. +#endif protected: BOOL bInfInvalid: 1; //InfoFlags sind Invalid. BOOL bInfBody: 1; //Frm steht im DokumentBody. @@ -450,9 +478,9 @@ protected: //Aendern nur die Framesize, nicht die PrtArea-SSize - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ) = 0; - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ) = 0; SwModify *GetDep() { return pRegisteredIn; } @@ -460,7 +488,6 @@ protected: SwFrm( SwModify* ); - SwFrm( Sw3FrameIo&, SwLayoutFrm* ); public: TYPEINFO(); //Bereits in Basisklasse Client drin. @@ -474,15 +501,12 @@ public: static SwCache *GetCachePtr() { return pCache; } static void SetCache( SwCache *pNew ) { pCache = pNew; } - virtual void Store( Sw3FrameIo& ) const; - //Aendern die PrtArea-SSize und die FrmSize. - SwTwips Shrink( SwTwips, const SzPtr, + SwTwips Shrink( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - SwTwips Grow ( SwTwips, const SzPtr, + SwTwips Grow ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - //Wir brauchen unterschiedliche Methoden (wg. Performance) fuer das //Einfuegenin den Layout Baum: @@ -587,7 +611,11 @@ public: SwAttrSet *GetAttrSet(); void GetAttrSet( SwAttrSet* ); +#ifdef VERTICAL_LAYOUT + inline BOOL HasFixSize() const { return bFixSize; } +#else BOOL HasFixSize( const SzPtr ) const; +#endif //Kann 0 liefern, pruefen auch ob die Shell zum richtigen Dokument //gehoert. Impl in frmsh.hxx diff --git a/sw/source/core/inc/ftnfrm.hxx b/sw/source/core/inc/ftnfrm.hxx index 6cf873db5fb3..d68def31c4af 100644 --- a/sw/source/core/inc/ftnfrm.hxx +++ b/sw/source/core/inc/ftnfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ftnfrm.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jp $ $Date: 2001-10-15 12:50:20 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:12:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,9 +82,9 @@ public: const SwFtnFrm* FindFootNote() const; const SwFtnFrm* FindEndNote() const; - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm( SwTwips, const SzPtr, + virtual SwTwips GrowFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); virtual void Format( const SwBorderAttrs *pAttrs = 0 ); virtual void PaintBorder( const SwRect &, const SwPageFrm *pPage, @@ -107,9 +107,9 @@ class SwFtnFrm: public SwLayoutFrm //nicht rueckwaerts fliessen. #ifndef PRODUCT protected: - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); #endif diff --git a/sw/source/core/inc/hffrm.hxx b/sw/source/core/inc/hffrm.hxx index 7ecefc50006d..f1a0001d60fa 100644 --- a/sw/source/core/inc/hffrm.hxx +++ b/sw/source/core/inc/hffrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: hffrm.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2001-10-12 13:26:44 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:13:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,9 +73,9 @@ class SwHeaderFrm: public SwLayoutFrm public: SwHeaderFrm( SwFrmFmt* ); - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); DECL_FIXEDMEMPOOL_NEWDEL(SwHeaderFrm) @@ -87,9 +87,9 @@ public: SwFooterFrm( SwFrmFmt* ); virtual void Format( const SwBorderAttrs *pAttrs = 0 ); - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); DECL_FIXEDMEMPOOL_NEWDEL(SwFooterFrm) }; diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index e09b789d5f28..80afc08bb7fc 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: layfrm.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: ama $ $Date: 2001-08-23 13:54:44 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:13:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,7 +65,6 @@ class SwCntntFrm; class SwFlowFrm; -class Sw3FrameIo; class SwFmtCol; struct SwCrsrMoveState; class SwFrmFmt; @@ -93,16 +92,13 @@ protected: SwFrm *pLower; - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); long CalcRel( const SwFmtFrmSize &rSz, BOOL bWidth ) const; - SwLayoutFrm( Sw3FrameIo&, SwLayoutFrm* ); - void LoadLower( Sw3FrameIo& ); - void StoreLower( Sw3FrameIo& ) const; public: void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const; void RefreshLaySubsidiary( const SwPageFrm*, const SwRect& ) const; @@ -120,8 +116,6 @@ public: void PaintColLines( const SwRect &, const SwFmtCol &, const SwPageFrm * ) const; - virtual void Store( Sw3FrameIo& ) const; - virtual BOOL GetCrsrOfst( SwPosition *, Point&, const SwCrsrMoveState* = 0 ) const; diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 0b4b344c66af..7f6c4adf3eeb 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: pagefrm.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: ama $ $Date: 2001-08-23 13:58:01 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:14:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,7 +77,6 @@ class SwFlyFrm; class SwFrmFmt; class SwPageDesc; class SwCntntFrm; -class Sw3FrameIo; struct SwPosition; struct SwCrsrMoveState; class SwFmtAnchor; @@ -137,7 +136,6 @@ public: DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm) SwPageFrm( SwFrmFmt*, SwPageDesc* ); - SwPageFrm( Sw3FrameIo&, SwLayoutFrm* ); ~SwPageFrm(); //public, damit die ViewShell beim Umschalten vom BrowseMode darauf @@ -183,8 +181,6 @@ public: //fuer SwFEShell und Modify der Flys. SwFrm *PlaceFly( SwFlyFrm *, SwFrmFmt *, const SwFmtAnchor * ); - virtual void Store( Sw3FrameIo& ) const; - virtual BOOL GetCrsrOfst( SwPosition *, Point&, const SwCrsrMoveState* = 0 ) const; virtual void Modify( SfxPoolItem*, SfxPoolItem* ); diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index 82fcd7273e2a..8dac711a1355 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: rootfrm.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mib $ $Date: 2001-10-12 13:55:54 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:14:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -216,17 +216,19 @@ public: virtual BOOL GetCrsrOfst( SwPosition *, Point&, const SwCrsrMoveState* = 0 ) const; virtual void Paint( const SwRect& ) const; - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); #ifndef PRODUCT virtual void Cut(); virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); #endif - Point GetNextPrevCntntPos( const Point &rPoint, BOOL bNext ) const; +#ifndef VERTICAL_LAYOUT void SetFixSize( SzPtr ); +#endif + Point GetNextPrevCntntPos( const Point &rPoint, BOOL bNext ) const; virtual void ChgSize( const Size& aNewSize ); inline void SetIdleFlags(); diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx index fa44cc369651..56fd1627fd68 100644 --- a/sw/source/core/inc/rowfrm.hxx +++ b/sw/source/core/inc/rowfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: rowfrm.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2001-10-12 13:26:44 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:15:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,9 +74,9 @@ class SwRowFrm: public SwLayoutFrm { virtual void Format( const SwBorderAttrs *pAttrs = 0 ); //Aendern nur die Framesize, nicht die PrtArea-SSize - virtual SwTwips ShrinkFrm( SwTwips, const SzPtr, + virtual SwTwips ShrinkFrm( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); const SwTableLine *pTabLine; diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx index 84ee50c2ccf6..c74ceb3de1d1 100644 --- a/sw/source/core/inc/sectfrm.hxx +++ b/sw/source/core/inc/sectfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: sectfrm.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2001-10-12 13:26:44 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:15:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,8 +135,8 @@ public: SwSectionFrm *FindFirstSectionMaster(); SwFtnContFrm* ContainsFtnCont( const SwFtnContFrm* pCont = NULL ) const; BOOL Growable() const; - SwTwips _Shrink( SwTwips, const SzPtr, BOOL bTst ); - SwTwips _Grow ( SwTwips, const SzPtr, BOOL bTst ); + SwTwips _Shrink( SwTwips, SZPTR BOOL bTst ); + SwTwips _Grow ( SwTwips, SZPTR BOOL bTst ); // A sectionfrm has to maximize, if he has a follow or a ftncontainer at // the end of the page. A superfluous follow will be ignored, diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx index b8763d0eb384..a3fb0de6fa5f 100644 --- a/sw/source/core/inc/tabfrm.hxx +++ b/sw/source/core/inc/tabfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tabfrm.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2001-10-12 13:26:44 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:16:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,7 +114,7 @@ protected: virtual void MakeAll(); virtual void Format( const SwBorderAttrs *pAttrs = 0 ); //Aendert nur die Framesize, nicht die PrtArea-SSize - virtual SwTwips GrowFrm ( SwTwips, const SzPtr, + virtual SwTwips GrowFrm ( SwTwips, SZPTR BOOL bTst = FALSE, BOOL bInfo = FALSE ); public: SwTabFrm( SwTable & ); //Immer nach dem erzeugen _und_ pasten das diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 1207efafefed..dd8fa0aa15e6 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtfrm.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fme $ $Date: 2001-08-31 06:21:21 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:16:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,7 +77,6 @@ class SwTxtFormatter; class SwTxtFormatInfo; class SwParaPortion; class WidowsAndOrphans; -class Sw3FrameIo; class SwBodyFrm; class SwFooterFrm; class SwTxtFtn; @@ -315,11 +314,8 @@ public: { return (SwTxtNode*)SwCntntFrm::GetNode(); } SwTxtFrm(SwTxtNode * const); - SwTxtFrm( Sw3FrameIo&, SwLayoutFrm* ); inline ~SwTxtFrm() { if( HasAnimation() ) ClearPara(); } - virtual void Store( Sw3FrameIo& ) const; - // SwCntntFrm: der "kurze Dienstweg" fuer die Frames. // Wer den void* falsch casted ist selbst Schuld! // Auf jedenfall muss der void* auf 0 geprueft werden. @@ -559,10 +555,13 @@ inline SwTwips SwTxtFrm::GetRightMargin() const } inline SwTwips SwTxtFrm::GrowTst( const SwTwips nGrow ) { +#ifdef VERTICAL_LAYOUT + return Grow( nGrow, sal_True ); +#else return Grow( nGrow, pHeight, sal_True ); +#endif } - #ifdef DEBUG // fragt auf WYSIWYG DBG ab extern sal_Bool IsDbg( const SwTxtFrm *pFrm ); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index d232afe3c3b1..e9618a775fe2 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -2,9 +2,9 @@ * * $RCSfile: calcmove.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: ama $ $Date: 2001-10-05 12:34:22 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:17:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -205,7 +205,7 @@ BOOL SwCntntFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL & ) ( pNewUpper->IsColBodyFrm() && !pNewUpper->GetUpper()->GetPrev() && !pNewUpper->GetUpper()->GetNext() ) ) ) ) - nSpace += pNewUpper->Grow( LONG_MAX, pHeight, TRUE ); + nSpace += pNewUpper->Grow( LONG_MAX PHEIGHT, TRUE ); if ( nSpace ) { //Keine Beruecksichtigung der Fussnoten die an dem Absatz @@ -784,7 +784,11 @@ void SwPageFrm::MakeAll() //Der Upper (Root) muss mindestens so breit //sein, dass er die breiteste Seite aufnehmen kann. if ( GetUpper() ) - { if ( bVarHeight ) + { +#ifdef VERTICAL_LAYOUT + ASSERT( GetUpper()->Prt().Width() >= aFrm.Width(), "Rootsize" ); +#else + if ( bVarHeight ) { ASSERT( GetUpper()->Prt().Width() >= aFrm.Width(), "Rootsize" ); } @@ -792,6 +796,7 @@ void SwPageFrm::MakeAll() { ASSERT( GetUpper()->Prt().Height() >= aFrm.Height(), "Rootsize" ); } +#endif } #endif } @@ -813,7 +818,8 @@ void SwLayoutFrm::MakeAll() //uebernimmt im DTor die Benachrichtigung const SwLayNotify aNotify( this ); #ifdef VERTICAL_LAYOUT - SwRectFn fnRect = ( bVarHeight == IsVertical() )? fnRectVert : fnRectHori; + SwRectFn fnRect = ( IsNeighbourFrm() == IsVertical() )? fnRectHori + : fnRectVert; #else const SzPtr pFix = pFIXSIZE; #endif @@ -986,9 +992,9 @@ BOOL SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs ) if ( nUpper ) { if ( nUpper > 0 ) - GrowFrm( nUpper, bVert ? pWidth : pHeight ); + GrowFrm( nUpper ); else - ShrinkFrm( -nUpper, bVert ? pWidth : pHeight ); + ShrinkFrm( -nUpper ); bSizeChgd = TRUE; } #else @@ -1517,7 +1523,7 @@ void SwCntntFrm::MakeAll() long nDiff = Frm().Top()+Frm().Height() -GetUpper()->Prt().Top() -GetUpper()->Prt().Height()-GetUpper()->Frm().Top(); #endif - long nReal = Grow( nDiff, pHeight ); + long nReal = Grow( nDiff PHEIGHT ); if( nReal ) continue; } diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index 6f28a94bc4aa..fe7367ddbe23 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: colfrm.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: ama $ $Date: 2001-09-17 11:20:34 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:18:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -228,7 +228,9 @@ BOOL MA_FASTCALL lcl_AddColumns( SwLayoutFrm *pCont, USHORT nCount ) SwColumnFrm *pTmp = new SwColumnFrm( pNeighbourCol->GetFmt() ); pTmp->SetMaxFtnHeight( nMax ); pTmp->InsertBefore( pCont, NULL ); +#ifndef VERTICAL_LAYOUT pTmp->bVarHeight = FALSE; +#endif pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext(); } } @@ -424,30 +426,35 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, BOOL bAdjustAttributes ) if ( bLine ) nMin = USHORT(20 + (pAttr->GetLineWidth() / 2)); SwFrm *pCol = Lower(); + long nGutter = 0; + BOOL bOrtho = pAttr->IsOrtho() && bAdjustAttributes && + pAttr->GetNumCols() > 0; for ( USHORT i = 0; i < pAttr->GetNumCols(); pCol = pCol->GetNext(), ++i ) { + if( !bOrtho ) + { #ifdef VERTICAL_LAYOUT - const SwTwips nWidth = i == (pAttr->GetNumCols() - 1) ? nAvail : - pAttr->CalcColWidth( i, USHORT( (Prt().*fnRect->fnGetWidth)() ) ); - Size aColSz = bVert ? Size( Prt().Width(), nWidth ) : - Size( nWidth, Prt().Height() ); + const SwTwips nWidth = i == (pAttr->GetNumCols() - 1) ? nAvail : + pAttr->CalcColWidth( i, USHORT( (Prt().*fnRect->fnGetWidth)() ) ); + Size aColSz = bVert ? Size( Prt().Width(), nWidth ) : + Size( nWidth, Prt().Height() ); #else - const SwTwips nWidth = i == (pAttr->GetNumCols() - 1) ? - nAvail : - pAttr->CalcColWidth( i, USHORT(Prt().SSize().*pDir) ); - const Size aColSz( nWidth, Prt().Height() ); + const SwTwips nWidth = i == (pAttr->GetNumCols() - 1) ? + nAvail : + pAttr->CalcColWidth( i, USHORT(Prt().SSize().*pDir) ); + const Size aColSz( nWidth, Prt().Height() ); #endif - pCol->ChgSize( aColSz ); + pCol->ChgSize( aColSz ); // Hierdurch werden die ColumnBodyFrms von Seitenspalten angepasst und // ihr bFixHeight-Flag wird gesetzt, damit sie nicht schrumpfen/wachsen. // Bei Rahmenspalten hingegen soll das Flag _nicht_ gesetzt werden, // da BodyFrms in Rahmenspalten durchaus wachsen/schrumpfen duerfen. - if( IsBodyFrm() ) - ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz ); - - nAvail -= nWidth; + if( IsBodyFrm() ) + ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz ); + nAvail -= nWidth; + } if ( bAdjustAttributes ) { SwColumn *pC = pAttr->GetColumns()[i]; @@ -485,6 +492,36 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, BOOL bAdjustAttributes ) } ((SwLayoutFrm*)pCol)->GetFmt()->SetAttr( aLR ); ((SwLayoutFrm*)pCol)->GetFmt()->SetAttr( aUL ); + nGutter += aLR.GetLeft() + aLR.GetRight(); + } + } + if( bOrtho ) + { + nAvail = (Prt().*fnRect->fnGetWidth)(); + long nInnerWidth = ( nAvail - nGutter )/ pAttr->GetNumCols(); + pCol = Lower(); + for( USHORT i = 0; i < pAttr->GetNumCols(); pCol = pCol->GetNext(), ++i) + { + SwTwips nWidth; + if( i == (pAttr->GetNumCols() - 1) ) + nWidth = nAvail; + else + { + SvxLRSpaceItem aLR( pCol->GetAttrSet()->GetLRSpace() ); + nWidth = nInnerWidth + aLR.GetLeft() + aLR.GetRight(); + } + if( nWidth < 0 ) + nWidth = 0; +#ifdef VERTICAL_LAYOUT + Size aColSz = bVert ? Size( Prt().Width(), nWidth ) : + Size( nWidth, Prt().Height() ); +#else + const Size aColSz( nWidth, Prt().Height() ); +#endif + pCol->ChgSize( aColSz ); + if( IsBodyFrm() ) + ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz ); + nAvail -= nWidth; } } } diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 64886bef6988..8e0a76540f50 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: findfrm.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: ama $ $Date: 2001-10-05 12:35:46 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:18:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1136,7 +1136,7 @@ void SwFrm::SetDirFlags( BOOL bVert ) } } -#endif +#else /************************************************************************* |* @@ -1156,4 +1156,5 @@ BOOL SwFrm::HasFixSize( const SzPtr pSize ) const ((pSize == pWidth) && bFixWidth && pVar == pWidth); } +#endif diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 99756e185e5d..03fc0615ccfc 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: flowfrm.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: ama $ $Date: 2001-10-05 12:36:10 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:19:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -526,8 +526,8 @@ BOOL SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, if ( nGrowVal ) { if ( pOldParent && pOldParent->IsBodyFrm() ) //Fuer variable Seitenhoehe beim Browsen - pOldParent->Shrink( nGrowVal, pHeight ); - pParent->Grow( nGrowVal, pHeight ); + pOldParent->Shrink( nGrowVal PHEIGHT ); + pParent->Grow( nGrowVal PHEIGHT ); } if ( pParent->IsFtnFrm() ) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index d7695ce2c6f7..9a13a640d3ca 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fly.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: ama $ $Date: 2001-08-24 12:46:29 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:19:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -186,8 +186,10 @@ SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : //Grosseneinstellung, Fixe groesse ist immer die Breite const SwFmtFrmSize &rFrmSize = pFmt->GetFrmSize(); +#ifndef VERTICAL_LAYOUT bVarHeight = TRUE; bFixWidth = TRUE; +#endif Frm().Width( rFrmSize.GetWidth() ); Frm().Height( rFrmSize.GetHeight() ); @@ -195,7 +197,11 @@ SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : if ( rFrmSize.GetSizeType() == ATT_MIN_SIZE ) bMinHeight = TRUE; else if ( rFrmSize.GetSizeType() == ATT_FIX_SIZE ) +#ifdef VERTICAL_LAYOUT + bFixSize = TRUE; +#else bFixHeight = TRUE; +#endif //Spalten? const SwFmtCol &rCol = pFmt->GetCol(); @@ -255,7 +261,11 @@ SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) : //NoTxt haben immer eine FixHeight. if ( Lower() && Lower()->IsNoTxtFrm() ) { +#ifdef VERTICAL_LAYOUT + bFixSize = TRUE; +#else bFixHeight = TRUE; +#endif bMinHeight = FALSE; } } @@ -588,15 +598,15 @@ BOOL SwFlyFrm::FrmSizeChg( const SwFmtFrmSize &rFrmSize ) BOOL bRet = FALSE; SwTwips nDiffHeight = Frm().Height(); if ( rFrmSize.GetSizeType() == ATT_VAR_SIZE ) - bFixHeight = bMinHeight = FALSE; + BFIXHEIGHT = bMinHeight = FALSE; else { if ( rFrmSize.GetSizeType() == ATT_FIX_SIZE ) - { bFixHeight = TRUE; + { BFIXHEIGHT = TRUE; bMinHeight = FALSE; } else if ( rFrmSize.GetSizeType() == ATT_MIN_SIZE ) - { bFixHeight = FALSE; + { BFIXHEIGHT = FALSE; bMinHeight = TRUE; } nDiffHeight -= rFrmSize.GetHeight(); @@ -622,7 +632,7 @@ BOOL SwFlyFrm::FrmSizeChg( const SwFmtFrmSize &rFrmSize ) } else if ( Lower()->IsNoTxtFrm() ) { - bFixHeight = TRUE; + BFIXHEIGHT = TRUE; bMinHeight = FALSE; } } @@ -1122,7 +1132,11 @@ void SwFlyFrm::Format( const SwBorderAttrs *pAttrs ) ASSERT( rSz.Height() != 0 || rFrmSz.GetHeightPercent(), "Hoehe des RahmenAttr ist 0." ); ASSERT( rSz.Width() != 0 || rFrmSz.GetWidthPercent(), "Breite des RahmenAttr ist 0." ); +#ifdef VERTICAL_LAYOUT + if( !HasFixSize() ) +#else if ( !HasFixSize( pHeight ) ) +#endif { //Die Groesse in der VarSize wird durch den Inhalt plus den //Raendern bestimmt. @@ -1493,7 +1507,11 @@ void SwFlyFrm::MakeFlyPos() // Hoehe besitzt. if( bFlyAtFly && VERT_TOP != aVert.GetVertOrient() && SURROUND_THROUGHT != pFmt->GetSurround().GetSurround() && +#ifdef VERTICAL_LAYOUT + !GetAnchor()->HasFixSize() ) +#else !GetAnchor()->HasFixSize( pHeight ) ) +#endif aRelPos.Y() = rUL.GetUpper(); else if ( aVert.GetVertOrient() == VERT_CENTER ) aRelPos.Y() = (nRel / 2) - (aFrm.Height() / 2); @@ -1520,7 +1538,7 @@ void SwFlyFrm::MakeFlyPos() if ( nAnchorBottom < nBottom ) { ((SwPageFrm*)GetAnchor())->FindBodyCont()-> - Grow( nBottom - nAnchorBottom, pHeight ); + Grow( nBottom - nAnchorBottom PHEIGHT ); } } @@ -1648,6 +1666,116 @@ void SwFlyFrm::MakePrtArea( const SwBorderAttrs &rAttrs ) |* |*************************************************************************/ +#ifdef VERTICAL_LAYOUT +SwTwips SwFlyFrm::_Grow( SwTwips nDist, BOOL bTst ) +{ + SWRECTFN( this ) + if ( Lower() && !IsColLocked() && !HasFixSize() ) + { + SwTwips nSize = (Frm().*fnRect->fnGetHeight)(); + if( nSize > 0 && nDist > ( LONG_MAX - nSize ) ) + nDist = LONG_MAX - nSize; + + if ( nDist <= 0L ) + return 0L; + + if ( Lower()->IsColumnFrm() ) + { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber + //das Wachstum (wg. des Ausgleichs). + if ( !bTst ) + { _InvalidatePos(); + InvalidateSize(); + } + return 0L; + } + + if ( !bTst ) + { + const SwRect aOld( AddSpacesToFrm() ); + _InvalidateSize(); + const BOOL bOldLock = bLocked; + Unlock(); + if ( IsFlyFreeFrm() ) + ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll(); + else + MakeAll(); + _InvalidateSize(); + InvalidatePos(); + if ( bOldLock ) + Lock(); + const SwRect aNew( AddSpacesToFrm() ); + if ( aOld != aNew ) + ::Notify( this, FindPageFrm(), aOld ); + return (aNew.*fnRect->fnGetHeight)()-(aOld.*fnRect->fnGetHeight)(); + } + return nDist; + } + return 0L; +} + +SwTwips SwFlyFrm::_Shrink( SwTwips nDist, BOOL bTst ) +{ + SWRECTFN( this ) + if( Lower() && !IsColLocked() && !HasFixSize() ) + { + SwTwips nHeight = (Frm().*fnRect->fnGetHeight)(); + if ( nDist > nHeight ) + nDist = nHeight; + + SwTwips nVal = IsMinHeight() ? + Min( nDist, nHeight - GetFmt()->GetFrmSize().GetHeight() ) : + nDist; + if ( nVal <= 0L ) + return 0L; + + if ( Lower()->IsColumnFrm() ) + { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber + //das Wachstum (wg. des Ausgleichs). + if ( !bTst ) + { + SwRect aOld( AddSpacesToFrm() ); + (Frm().*fnRect->fnSetHeight)( nHeight - nVal ); + nHeight = (Prt().*fnRect->fnGetHeight)(); + (Prt().*fnRect->fnSetHeight)( nHeight - nVal ); + _InvalidatePos(); + InvalidateSize(); + ::Notify( this, FindPageFrm(), aOld ); + NotifyDrawObj(); + if ( GetAnchor()->IsInFly() ) + GetAnchor()->FindFlyFrm()->Shrink( nDist, bTst ); + } + return 0L; + } + + if ( !bTst ) + { + const SwRect aOld( AddSpacesToFrm() ); + _InvalidateSize(); + const BOOL bOldLocked = bLocked; + Unlock(); + if ( IsFlyFreeFrm() ) + ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll(); + else + MakeAll(); + _InvalidateSize(); + InvalidatePos(); + if ( bOldLocked ) + Lock(); + const SwRect aNew( AddSpacesToFrm() ); + if ( aOld != aNew ) + { + ::Notify( this, FindPageFrm(), aOld ); + if ( GetAnchor()->IsInFly() ) + GetAnchor()->FindFlyFrm()->Shrink( nDist, bTst ); + } + return (aOld.*fnRect->fnGetHeight)() - + (aNew.*fnRect->fnGetHeight)(); + } + return nVal; + } + return 0L; +} +#else SwTwips SwFlyFrm::_Grow( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) { if ( Lower() && !IsColLocked() && !HasFixSize( pDirection ) ) @@ -1751,6 +1879,7 @@ SwTwips SwFlyFrm::_Shrink( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) } return 0L; } +#endif /************************************************************************* |* diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 89f2493bfbcc..6070fe1421e8 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: flycnt.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: ama $ $Date: 2001-07-03 10:39:03 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:20:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1549,9 +1549,9 @@ void SwFlyAtCntFrm::MakeFlyPos() while ( nRel ) { if ( nRel <= nAvail || (bBrowse && - ((SwFrm*)pOrient)->Grow( nRel-nAvail, pHeight, TRUE)) || + ((SwFrm*)pOrient)->Grow( nRel-nAvail PHEIGHT, TRUE)) || (pOrient->IsInTab() && bGrow && //MA_FLY_HEIGHT - ((SwFrm*)pOrient)->Grow( nRel-nAvail, pHeight, TRUE))) + ((SwFrm*)pOrient)->Grow( nRel-nAvail PHEIGHT, TRUE))) { aRelPos.Y() = (pOrient->Frm().Top() + pOrient->Prt().Top() + (pOrient->Prt().Height() - @@ -1560,7 +1560,7 @@ void SwFlyAtCntFrm::MakeFlyPos() if ( ( bBrowse || ( pOrient->IsInTab() && bGrow ) ) && nRel - nAvail > 0 ) { - nRel = ((SwFrm*)pOrient)->Grow( nRel-nAvail, pHeight ); + nRel = ((SwFrm*)pOrient)->Grow( nRel-nAvail PHEIGHT ); SwFrm *pTmp = (SwFrm*) pOrient->FindPageFrm(); ::ValidateSz( pTmp ); bInvalidatePage = TRUE; @@ -1649,7 +1649,7 @@ void SwFlyAtCntFrm::MakeFlyPos() ( GetAnchor()->IsInTab() && bGrow ) ) { ((SwFrm*)pOrient)->Grow( - aFrm.Bottom() - (pOrient->Frm().Top() + pOrient->Prt().Bottom()), pHeight ); + aFrm.Bottom() - (pOrient->Frm().Top() + pOrient->Prt().Bottom()) PHEIGHT ); SwFrm *pTmp = (SwFrm*) pOrient->FindPageFrm(); ::ValidateSz( pTmp ); bInvalidatePage = TRUE; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 6e4727539ae9..55aa89c90287 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -2,9 +2,9 @@ * * $RCSfile: frmtool.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: ama $ $Date: 2001-10-05 12:35:13 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:20:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2297,7 +2297,7 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling ) pLast->pNext = pNxt; pNxt->pPrev = pLast; } - pParent->Grow( nGrowVal, pHeight ); + pParent->Grow( nGrowVal PHEIGHT ); } /************************************************************************* diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 11bb5613e11b..54f3d384957c 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ftnfrm.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jp $ $Date: 2001-10-15 12:47:19 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:21:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -373,12 +373,7 @@ void SwFtnContFrm::Format( const SwBorderAttrs * ) if ( !bValidSize ) { if ( pPage->IsFtnPage() && !GetFmt()->GetDoc()->IsBrowseMode() ) - { - //Das Teil ist immer so gross wie moeglich -//MA 17. Nov. 98 Wozu soll das Probegrow sinnvoll sein? -// if ( Grow( LONG_MAX, pHeight, TRUE ) ) - Grow( LONG_MAX, pHeight, FALSE ); - } + Grow( LONG_MAX PHEIGHT, FALSE ); else { //Die Groesse in der VarSize wird durch den Inhalt plus den @@ -419,10 +414,10 @@ void SwFtnContFrm::Format( const SwBorderAttrs * ) nDiff = Frm().SSize().Height() - nRemaining; #endif if ( nDiff > 0 ) - Shrink( nDiff, pHeight ); + Shrink( nDiff PHEIGHT ); else if ( nDiff < 0 ) { - Grow( -nDiff, pHeight ); + Grow( -nDiff PHEIGHT ); //Es kann passieren, dass weniger Platz zur Verfuegung steht, //als der bereits der Border benoetigt - die Groesse der //PrtArea wird dann negativ. @@ -459,9 +454,12 @@ void SwFtnContFrm::Format( const SwBorderAttrs * ) |* |*************************************************************************/ - +#ifdef VERTICAL_LAYOUT +SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +#else SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) +#endif { //Keine Pruefung ob FixSize oder nicht, die FtnContainer sind immer bis //zur Maximalhoehe variabel. @@ -477,11 +475,10 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, #endif #ifdef VERTICAL_LAYOUT - const SzPtr pDir = IsVertical() ? ( pDirection==pHeight ? pWidth : pHeight ) - : pDirection; - if( Frm().SSize().*pDir > 0 && - nDist > (LONG_MAX - Frm().SSize().*pDir) ) - nDist = LONG_MAX - Frm().SSize().*pDir; + SWRECTFN( this ) + if( (Frm().*fnRect->fnGetHeight)() > 0 && + nDist > ( LONG_MAX - (Frm().*fnRect->fnGetHeight)() ) ) + nDist = LONG_MAX - (Frm().*fnRect->fnGetHeight)(); #else if ( Frm().SSize().*pDirection > 0 && nDist > (LONG_MAX - Frm().SSize().*pDirection) ) @@ -509,7 +506,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, { nDist = Min( nDist, pBoss->GetMaxFtnHeight() #ifdef VERTICAL_LAYOUT - - Frm().SSize().*pDir ); + - (Frm().*fnRect->fnGetHeight)() ); #else - Frm().SSize().*pDirection ); #endif @@ -527,18 +524,18 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, } } #ifdef VERTICAL_LAYOUT - else if( nDist > GetPrev()->Frm().SSize().*pDir ) + else if( nDist > (GetPrev()->Frm().*fnRect->fnGetHeight)() ) //aber mehr als der Body kann koennen und wollen wir nun auch wieder //nicht herausruecken. - nDist = GetPrev()->Frm().SSize().*pDir; + nDist = (GetPrev()->Frm().*fnRect->fnGetHeight)(); long nAvail = 0; if ( GetFmt()->GetDoc()->IsBrowseMode() ) { - nAvail = GetUpper()->Prt().SSize().*pDir; + nAvail = GetUpper()->Prt().Height(); const SwFrm *pAvail = GetUpper()->Lower(); do - { nAvail -= pAvail->Frm().SSize().*pDir; + { nAvail -= pAvail->Frm().Height(); pAvail = pAvail->GetNext(); } while ( pAvail ); if ( nAvail > nDist ) @@ -547,7 +544,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, if ( !bTst ) { - Frm().SSize().*pDir += nDist; + (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)() + nDist ); if( IsVertical() && !IsReverse() ) Frm().Pos().X() -= nDist; } @@ -597,7 +594,11 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, } } } +#ifdef VERTICAL_LAYOUT + nReal += pBoss->Grow( nGrow - nReal, bTst ); +#else nReal += pBoss->Grow( nGrow - nReal, pDirection, bTst ); +#endif if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust ) && nReal < nGrow ) nReal += AdjustNeighbourhood( nGrow - nReal, bTst ); @@ -613,7 +614,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, nDist -= nReal; //Den masslosen Wunsch koennen wir leider nur in Grenzen erfuellen. #ifdef VERTICAL_LAYOUT - Frm().SSize().*pDir -= nDist; + Frm().SSize().Height() -= nDist; if( IsVertical() && !IsReverse() ) Frm().Pos().X() += nDist; #else @@ -634,6 +635,14 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, } +#ifdef VERTICAL_LAYOUT +SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, BOOL bTst, BOOL bInfo ) +{ + SwPageFrm *pPage = FindPageFrm(); + if ( pPage && (!pPage->IsFtnPage() || GetFmt()->GetDoc()->IsBrowseMode()) ) + { + SwTwips nRet = SwLayoutFrm::ShrinkFrm( nDiff, bTst, bInfo ); +#else SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) { @@ -641,6 +650,7 @@ SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, const SzPtr pDirection, if ( pPage && (!pPage->IsFtnPage() || GetFmt()->GetDoc()->IsBrowseMode()) ) { SwTwips nRet = SwLayoutFrm::ShrinkFrm( nDiff, pDirection, bTst, bInfo ); +#endif if ( !bTst && nRet ) { _InvalidatePos(); @@ -709,7 +719,37 @@ void SwFtnFrm::InvalidateNxtFtnCnts( SwPageFrm *pPage ) #ifndef PRODUCT +#ifdef VERTICAL_LAYOUT +SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ +#ifdef DEBUG + static USHORT nNum = USHRT_MAX; + SwTxtFtn* pTxtFtn = GetAttr(); + if ( pTxtFtn->GetFtn().GetNumber() == nNum ) + { + int bla = 5; + } +#endif + return SwLayoutFrm::GrowFrm( nDist, bTst, bInfo ); +} + +SwTwips SwFtnFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ +#ifdef DEBUG + static USHORT nNum = USHRT_MAX; + if( nNum != USHRT_MAX ) + { + SwTxtFtn* pTxtFtn = GetAttr(); + if( &pTxtFtn->GetAttr() && pTxtFtn->GetFtn().GetNumber() == nNum ) + { + int bla = 5; + } + } +#endif + return SwLayoutFrm::ShrinkFrm( nDist, bTst, bInfo ); +} +#else SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) { @@ -725,7 +765,6 @@ SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, } - SwTwips SwFtnFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) { @@ -743,6 +782,7 @@ SwTwips SwFtnFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, return SwLayoutFrm::ShrinkFrm( nDist, pDirection, bTst, bInfo ); } #endif +#endif /************************************************************************* |* @@ -798,7 +838,7 @@ void SwFtnFrm::Cut() } else { if ( Frm().Height() ) - pUp->Shrink( Frm().Height(), pHeight ); + pUp->Shrink( Frm().Height() PHEIGHT ); pUp->SetCompletePaint(); pUp->InvalidatePage(); } @@ -841,7 +881,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) GetNext()->_InvalidatePos(); #ifdef VERTICAL_LAYOUT if( (Frm().*fnRect->fnGetHeight)() ) - pParent->Grow( (Frm().*fnRect->fnGetHeight)(), pHeight ); + pParent->Grow( (Frm().*fnRect->fnGetHeight)() ); #else if ( Frm().Height() ) pParent->Grow( Frm().Height(), pHeight ); @@ -2691,9 +2731,9 @@ void SwFtnBossFrm::SetFtnDeadLine( const SwTwips nDeadLine ) #endif if ( GetFmt()->GetDoc()->IsBrowseMode() ) - nMaxFtnHeight += pBody->Grow( LONG_MAX, pHeight, TRUE ); + nMaxFtnHeight += pBody->Grow( LONG_MAX PHEIGHT, TRUE ); if ( IsInSct() ) - nMaxFtnHeight += FindSctFrm()->Grow( LONG_MAX, pHeight, TRUE ); + nMaxFtnHeight += FindSctFrm()->Grow( LONG_MAX PHEIGHT, TRUE ); if ( nMaxFtnHeight < 0 ) nMaxFtnHeight = 0; diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index a8a15119f8d0..4c8e4c534096 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: hffrm.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: ama $ $Date: 2001-08-29 10:39:15 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:21:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -121,6 +121,23 @@ SwHeaderFrm::SwHeaderFrm( SwFrmFmt *pFmt ): bObjsDirect = bOld; } +#ifdef VERTICAL_LAYOUT +SwTwips SwHeaderFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + SwTwips nRet = SwLayoutFrm::GrowFrm( nDist, bTst, bInfo ); + if ( nRet && !bTst ) + SetCompletePaint(); + return nRet; +} + +SwTwips SwHeaderFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + SwTwips nRet = SwLayoutFrm::ShrinkFrm( nDist, bTst, bInfo ); + if ( nRet && !bTst ) + SetCompletePaint(); + return nRet; +} +#else SwTwips SwHeaderFrm::GrowFrm( SwTwips nDist, const SzPtr pPtr, BOOL bTst, BOOL bInfo ) { @@ -138,7 +155,7 @@ SwTwips SwHeaderFrm::ShrinkFrm( SwTwips nDist, const SzPtr pPtr, SetCompletePaint(); return nRet; } - +#endif /************************************************************************* |* @@ -177,7 +194,7 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) if ( bValidPrtArea && bValidSize ) return; - const USHORT nLR = pAttrs->CalcLeft( this ) + pAttrs->CalcRight(); + const long nLR = pAttrs->CalcLeft( this ) + pAttrs->CalcRight(); const USHORT nUL = pAttrs->CalcTop() + pAttrs->CalcBottom(); if ( !bValidPrtArea ) @@ -196,6 +213,14 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) if ( !bValidSize ) { +#ifdef VERTICAL_LAYOUT + if ( !HasFixSize() ) + { + if( !IsColLocked() ) + { + bValidSize = bValidPrtArea = TRUE; + const SwTwips nBorder = nUL; +#else const SzPtr pVarSz = pVARSIZE; if ( !HasFixSize( pVarSz ) ) { @@ -204,6 +229,7 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) bValidSize = bValidPrtArea = TRUE; const SwTwips nBorder = bVarHeight ? nUL : nLR; const PtPtr pVarPs = pVARPOS; +#endif const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize(); SwTwips nMinHeight = rSz.GetSizeType() == ATT_MIN_SIZE ? rSz.GetHeight() : 0; ColLock(); @@ -212,7 +238,7 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) Point aOldPos; do { - nOldHeight = Frm().SSize().*pVarSz; + nOldHeight = Frm().Height(); SwFrm* pFrm = Lower(); if( Frm().Pos() != aOldPos && pFrm ) { @@ -227,7 +253,7 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) nRemaining = nBorder; pFrm = Lower(); while ( pFrm ) - { nRemaining += pFrm->Frm().SSize().*pVarSz; + { nRemaining += pFrm->Frm().Height(); if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() ) // Dieser TxtFrm waere gern ein bisschen groesser nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight() @@ -256,9 +282,9 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) { ColUnlock(); if ( nDiff > 0 ) - Grow( nDiff, pVarSz ); + Grow( nDiff PHEIGHT ); else - Shrink( -nDiff, pVarSz ); + Shrink( -nDiff PHEIGHT ); //Schnell auf dem kurzen Dienstweg die Position updaten. MakePos(); ColLock(); @@ -266,22 +292,19 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) else break; //Unterkante des Uppers nicht ueberschreiten. - if ( GetUpper() && Frm().SSize().*pVarSz ) + if ( GetUpper() && Frm().Height() ) { - const SwTwips nDeadLine = - GetUpper()->Frm().Pos().*pVarPs + - (bVarHeight ? GetUpper()->Prt().Bottom() : - GetUpper()->Prt().Right()); - const SwTwips nBot = bVarHeight ? - Frm().Bottom():Frm().Right(); + const SwTwips nDeadLine = GetUpper()->Frm().Top() + + GetUpper()->Prt().Bottom(); + const SwTwips nBot = Frm().Bottom(); if ( nBot > nDeadLine ) { Frm().Bottom( nDeadLine ); - Prt().SSize().Height() = Frm().SSize().Height() - nBorder; + Prt().SSize().Height() = Frm().Height() - nBorder; } } bValidSize = bValidPrtArea = TRUE; - } while( nRemaining < nMaxHeight && nOldHeight != Frm().SSize().*pVarSz ); + } while( nRemaining<nMaxHeight && nOldHeight!=Frm().Height() ); ColUnlock(); } bValidSize = bValidPrtArea = TRUE; @@ -300,6 +323,21 @@ void SwFooterFrm::Format( const SwBorderAttrs *pAttrs ) } } +#ifdef VERTICAL_LAYOUT +SwTwips SwFooterFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + if( IsColLocked() ) + return 0; + return SwLayoutFrm::GrowFrm( nDist, bTst, bInfo ); +} + +SwTwips SwFooterFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + if( IsColLocked() ) + return 0; + return SwLayoutFrm::ShrinkFrm( nDist, bTst, bInfo ); +} +#else SwTwips SwFooterFrm::GrowFrm( SwTwips nDist, const SzPtr pPtr, BOOL bTst, BOOL bInfo ) { @@ -315,7 +353,7 @@ SwTwips SwFooterFrm::ShrinkFrm( SwTwips nDist, const SzPtr pPtr, return 0; return SwLayoutFrm::ShrinkFrm( nDist, pPtr, bTst, bInfo ); } - +#endif /************************************************************************* |* diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 17f6dfb812e7..90335957ea88 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: newfrm.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: ama $ $Date: 2001-10-05 12:31:39 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:22:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -127,11 +127,12 @@ #include <pagedesc.hxx> #endif - +#ifndef VERTICAL_LAYOUT PtPtr pX = &Point::nA; PtPtr pY = &Point::nB; SzPtr pWidth = &Size::nA; SzPtr pHeight = &Size::nB; +#endif SwLayVout *SwRootFrm::pVout = 0; BOOL SwRootFrm::bInPaint = FALSE; @@ -454,12 +455,14 @@ SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) : pDoc->SetRootFrm( this ); //Fuer das Erzeugen der Flys durch MakeFrms() bCallbackActionEnabled = FALSE; //vor Verlassen auf TRUE setzen! +#ifndef VERTICAL_LAYOUT #ifdef QUER //StarWriter /QUER ? bitteschoen: SetFixSize( pHeight ); #else SetFixSize( pWidth ); #endif +#endif SdrModel *pMd = pDoc->GetDrawModel(); if ( pMd ) @@ -557,7 +560,7 @@ SwRootFrm::~SwRootFrm() |* |*************************************************************************/ - +#ifndef VERTICAL_LAYOUT void SwRootFrm::SetFixSize( SzPtr pNew ) { @@ -575,6 +578,8 @@ void SwRootFrm::SetFixSize( SzPtr pNew ) } } +#endif + /************************************************************************* |* |* SwRootFrm::RemoveMasterObjs() diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 32dc4e32a77b..41e6b461134b 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: pagechg.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: ama $ $Date: 2001-10-05 12:32:37 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:22:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -589,8 +589,7 @@ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew, if ( 0 != (pSh = GetShell()) && pSh->GetWin() && aOldRect.HasArea() ) pSh->InvalidateWindows( aOldRect ); rInvFlags |= 0x03; - SzPtr pVar = pVARSIZE; - if ( aOldRect.SSize().*pVar != Frm().SSize().*pVar) + if ( aOldRect.Height() != Frm().Height() ) rInvFlags |= 0x04; } break; @@ -782,6 +781,122 @@ void AdjustSizeChgNotify( SwRootFrm *pRoot ) pRoot->bCheckSuperfluous = bOld; } +#ifdef VERTICAL_LAYOUT +void MA_FASTCALL lcl_AdjustRoot( SwFrm *pPage, long nOld ) +{ + //Groesse der groessten Seite ermitteln. + //nOld enthaelt den alten Wert wenn die Seite geschrumpft ist und + //den aktuellen Wert wenn sie etwa ausgeschnitten wurde. Dadurch + //kann abgebrochen werden, wenn eine Seite gefunden wird, deren Wert + //dem alten entspricht. + long nMax = pPage->Frm().Width(); + if ( nMax == nOld ) + nMax = 0; + const SwFrm *pFrm = pPage->GetUpper()->Lower(); + while ( pFrm ) + { + if ( pFrm != pPage ) + { + const SwTwips nTmp = pFrm->Frm().Width(); + if ( nTmp == nOld ) + { + nMax = 0; + break; + } + else if ( nTmp > nMax ) + nMax = nTmp; + } + pFrm = pFrm->GetNext(); + } + if ( nMax ) + pPage->GetUpper()->ChgSize( Size( nMax, + pPage->GetUpper()->Frm().Height() ) ); +} + +void SwPageFrm::AdjustRootSize( const SwPageChg eChgType, const SwRect *pOld ) +{ + if ( !GetUpper() ) + return; + + const SwRect aOld( GetUpper()->Frm() ); + + const SwTwips nVar = Frm().Height(); + SwTwips nFix = Frm().Width(); + SwTwips nDiff = 0; + + switch ( eChgType ) + { + case CHG_NEWPAGE: + { + if( nFix > GetUpper()->Prt().Width() ) + GetUpper()->ChgSize( Size(nFix,GetUpper()->Frm().Height())); + nDiff = nVar; + if ( GetPrev() && !((SwPageFrm*)GetPrev())->IsEmptyPage() ) + nDiff += DOCUMENTBORDER/2; + else if ( !IsEmptyPage() && GetNext() ) + nDiff += DOCUMENTBORDER/2; + } + break; + case CHG_CUTPAGE: + { + if ( nFix == GetUpper()->Prt().Width() ) + ::lcl_AdjustRoot( this, nFix ); + nDiff = -nVar; + if ( GetPrev() && !((SwPageFrm*)GetPrev())->IsEmptyPage() ) + nDiff -= DOCUMENTBORDER/2; + else if ( !IsEmptyPage() && GetNext() ) + nDiff -= DOCUMENTBORDER/2; + if ( IsEmptyPage() && GetNext() && GetPrev() ) + nDiff = -nVar; + } + break; + case CHG_CHGPAGE: + { + ASSERT( pOld, "ChgPage ohne OldValue nicht moeglich." ); + if ( pOld->Width() < nFix ) + { + if ( nFix > GetUpper()->Prt().Width() ) + GetUpper()->ChgSize( Size( nFix, + GetUpper()->Frm().Height() ) ); + } + else if ( pOld->Width() > nFix ) + ::lcl_AdjustRoot( this, pOld->Width() ); + nDiff = nVar - pOld->Height(); + } + break; + + default: + ASSERT( FALSE, "Neuer Typ fuer PageChg." ); + } + + if ( nDiff > 0 ) + GetUpper()->Grow( nDiff ); + else if ( nDiff < 0 ) + GetUpper()->Shrink( -nDiff ); + + //Fix(8522): Calc auf die Root damit sich dir PrtArea sofort einstellt. + //Anderfalls gibt es Probleme wenn mehrere Aenderungen innerhalb einer + //Action laufen. + GetUpper()->Calc(); + + if ( aOld != GetUpper()->Frm() ) + { + SwLayoutFrm *pUp = GetUpper(); + if ( eChgType == CHG_CUTPAGE ) + { + //Seiten vorher kurz aushaengen, weil sonst falsch formatiert wuerde. + SwFrm *pSibling = GetNext(); + if ( ((SwRootFrm*)pUp)->GetLastPage() == this ) + ::SetLastPage( (SwPageFrm*)GetPrev() ); + Remove(); + ::AdjustSizeChgNotify( (SwRootFrm*)pUp ); + InsertBefore( pUp, pSibling ); + } + else + ::AdjustSizeChgNotify( (SwRootFrm*)pUp ); + } +} +#else void MA_FASTCALL lcl_ChgRootSize( SwFrm *pP, SwTwips nVal ) { if ( pP->bVarHeight ) @@ -904,6 +1019,7 @@ void SwPageFrm::AdjustRootSize( const SwPageChg eChgType, const SwRect *pOld ) ::AdjustSizeChgNotify( (SwRootFrm*)pUp ); } } +#endif /************************************************************************* |* @@ -1017,6 +1133,9 @@ void SwPageFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) else ::SetLastPage( this ); +#ifdef VERTICAL_LAYOUT + if( Frm().Width() != pParent->Prt().Width() ) +#else //ggf. die Memberpointer korrigieren. const SwFmtFillOrder &rFill =((SwLayoutFrm*)pParent)->GetFmt()->GetFillOrder(); if ( rFill.GetFillOrder() == ATT_BOTTOM_UP || @@ -1027,6 +1146,7 @@ void SwPageFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) const SzPtr pFix = pFIXSIZE; if( Frm().SSize().*pFix != pParent->Prt().SSize().*pFix ) +#endif _InvalidateSize(); InvalidatePos(); @@ -1438,6 +1558,35 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn ) |* Letzte Aenderung MA 05. May. 94 |* |*************************************************************************/ + +#ifdef VERTICAL_LAYOUT + +SwTwips SwRootFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + if ( !bTst ) + Frm().SSize().Height() += nDist; + return nDist; +} +/************************************************************************* +|* +|* SwRootFrm::ShrinkFrm() +|* +|* Ersterstellung MA 30. Jul. 92 +|* Letzte Aenderung MA 05. May. 94 +|* +|*************************************************************************/ +SwTwips SwRootFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + ASSERT( nDist >= 0, "nDist < 0." ); + ASSERT( nDist <= Frm().Height(), "nDist > als aktuelle Groesse." ); + + if ( !bTst ) + Frm().SSize().Height() -= nDist; + return nDist; +} + +#else + SwTwips SwRootFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) { @@ -1464,6 +1613,8 @@ SwTwips SwRootFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, return nDist; } +#endif + /************************************************************************* |* |* SwRootFrm::RemoveSuperfluous() @@ -1679,8 +1830,8 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage ) //Das er auf der falschen Seite steht muss noch nichts //heissen, wenn er eigentlich auf der Vorseite //stehen will und diese eine EmptyPage ist. - if ( !(pPage->GetPhyPageNum()-1 == nPg && - ((SwPageFrm*)pPage->GetPrev())->IsEmptyPage()) ) + if( nPg && !(pPage->GetPhyPageNum()-1 == nPg && + ((SwPageFrm*)pPage->GetPrev())->IsEmptyPage()) ) { //Umhaengen kann er sich selbst, indem wir ihm //einfach ein Modify mit seinem AnkerAttr schicken. @@ -1714,8 +1865,12 @@ void SwRootFrm::ChgSize( const Size& aNewSize ) { Frm().SSize() = aNewSize; _InvalidatePrt(); +#ifdef VERTICAL_LAYOUT + bFixSize = FALSE; +#else bFixHeight = bVarHeight; bFixWidth = !bVarHeight; +#endif } /************************************************************************* diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 2fcb12233492..dc4edeaff49a 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: paintfrm.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: ama $ $Date: 2001-09-19 08:45:57 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:23:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -848,7 +848,8 @@ void SwLineRects::PaintLines( OutputDevice *pOut ) pLast = rLRect.GetColor(); pOut->SetFillColor( *pLast ); } - pOut->DrawRect( rLRect.SVRect() ); + if( !rLRect.IsEmpty() ) + pOut->DrawRect( rLRect.SVRect() ); rLRect.SetPainted(); } else @@ -872,7 +873,8 @@ void SwLineRects::PaintLines( OutputDevice *pOut ) pLast = rLRect.GetColor(); pOut->SetFillColor( *pLast ); } - pOut->DrawRect( rLRect.SVRect() ); + if( !rLRect.IsEmpty() ) + pOut->DrawRect( rLRect.SVRect() ); rLRect.SetPainted(); } nLastCount = nMinCount; @@ -1120,9 +1122,9 @@ void MA_FASTCALL lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm, (rRect.*fnRect->fnSubLeft)(rBox.GetDistance( BOX_LINE_LEFT )+1); if ( rBox.GetRight() ) - (rRect.*fnRect->fnAddBottom)(rBox.CalcLineSpace(BOX_LINE_RIGHT)); + (rRect.*fnRect->fnAddRight)(rBox.CalcLineSpace(BOX_LINE_RIGHT)); else if ( rAttrs.IsBorderDist() ) - (rRect.*fnRect->fnAddBottom)(rBox.GetDistance(BOX_LINE_RIGHT)+1); + (rRect.*fnRect->fnAddRight)(rBox.GetDistance(BOX_LINE_RIGHT)+1); if ( bShadow && rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE ) { @@ -3133,6 +3135,12 @@ void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage, |*************************************************************************/ //Malt die angegebene Linie, achtet darauf, dass keine Flys uebermalt werden. +#ifdef VERTICAL_LAYOUT + PointPtr pX = &Point::nA; + PointPtr pY = &Point::nB; + SizePtr pWidth = &Size::nA; + SizePtr pHeight = &Size::nB; +#endif void MA_FASTCALL lcl_RefreshLine( const SwLayoutFrm *pLay, const SwPageFrm *pPage, const Point &rP1, const Point &rP2, const BYTE nSubColor ) @@ -3140,10 +3148,10 @@ void MA_FASTCALL lcl_RefreshLine( const SwLayoutFrm *pLay, const SwPageFrm *pPag //In welche Richtung gehts? Kann nur Horizontal oder Vertikal sein. ASSERT( ((rP1.X() == rP2.X()) || (rP1.Y() == rP2.Y())), "Schraege Hilfslinien sind nicht erlaubt." ); - const PtPtr pDirPt = rP1.X() == rP2.X() ? pY : pX; - const PtPtr pOthPt = pDirPt == pX ? pY : pX; - const SzPtr pDirSz = pDirPt == pX ? pWidth : pHeight; - const SzPtr pOthSz = pDirSz == pWidth ? pHeight : pWidth; + const PTPTR pDirPt = rP1.X() == rP2.X() ? pY : pX; + const PTPTR pOthPt = pDirPt == pX ? pY : pX; + const SIZEPTR pDirSz = pDirPt == pX ? pWidth : pHeight; + const SIZEPTR pOthSz = pDirSz == pWidth ? pHeight : pWidth; Point aP1( rP1 ), aP2( rP2 ); diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 0152f2c4d557..98c01ca6725b 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sectfrm.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: ama $ $Date: 2001-08-23 14:36:02 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:24:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -411,7 +411,7 @@ void SwSectionFrm::_Cut( BOOL bRemove ) Frm().Height( 0 ); Prt().Height( 0 ); } - pUp->Shrink( nFrmHeight, pHeight ); + pUp->Shrink( nFrmHeight PHEIGHT ); } } } @@ -505,7 +505,7 @@ void SwSectionFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) } if ( Frm().Height() ) - pParent->Grow( Frm().Height(), pHeight ); + pParent->Grow( Frm().Height() PHEIGHT ); if ( GetPrev() ) { @@ -813,7 +813,11 @@ void SwSectionFrm::MakeAll() { if( GetPrev() ) { aFrm.Pos( GetPrev()->Frm().Pos() ); +#ifdef VERTICAL_LAYOUT + aFrm.Pos().X() += GetPrev()->Frm().Height(); +#else aFrm.Pos().*pVARPOS += GetPrev()->Frm().SSize().*pVARSIZE; +#endif } else if( GetUpper() ) { @@ -1070,7 +1074,7 @@ void SwSectionFrm::_CheckClipping( BOOL bGrow, BOOL bMaximize ) { long nBottom = Frm().Top() + Frm().Height() + ( bMaximize ? 0 : Undersize() ); if( nBottom > nDeadLine ) - nDeadLine += GetUpper()->Grow( nBottom - nDeadLine, pHeight ); + nDeadLine += GetUpper()->Grow( nBottom - nDeadLine PHEIGHT ); } // Bei maximierten SectionFrms ist das Undersized-Flag ueberfluessig, // aber sonst muss es auch gesetzt werden, wenn die DeadLine genau @@ -1135,7 +1139,11 @@ void SwSectionFrm::SimpleFormat() if( GetPrev() ) { aFrm.Pos( GetPrev()->Frm().Pos() ); +#ifdef VERTICAL_LAYOUT + aFrm.Pos().X() += GetPrev()->Frm().Height(); +#else aFrm.Pos().*pVARPOS += GetPrev()->Frm().SSize().*pVARSIZE; +#endif bValidPos = TRUE; } else if( GetUpper() ) @@ -1282,7 +1290,7 @@ void SwSectionFrm::Format( const SwBorderAttrs *pAttr ) long nBottom = Frm().Bottom() - nDiff; if( nBottom > nDeadLine ) { - nDeadLine += GetUpper()->Grow( nBottom - nDeadLine, pHeight, TRUE ); + nDeadLine += GetUpper()->Grow( nBottom - nDeadLine PHEIGHT, TRUE ); if( nBottom > nDeadLine ) nDiff += nBottom - nDeadLine; if( nDiff > 0 ) @@ -1343,7 +1351,7 @@ void SwSectionFrm::Format( const SwBorderAttrs *pAttr ) if( !GetNext() ) SetRetouche(); // Dann muessen wir die Retusche selbst uebernehmen if( GetUpper() ) - GetUpper()->Shrink( nOldHeight - Frm().Height(), pHeight ); + GetUpper()->Shrink( nOldHeight - Frm().Height() PHEIGHT ); } if( IsUndersized() ) bValidPrtArea = TRUE; @@ -1776,7 +1784,7 @@ BOOL SwSectionFrm::Growable() const { if( Frm().Top() + Frm().Height() < lcl_DeadLine( this ) ) return TRUE; - return ( GetUpper() && ((SwFrm*)GetUpper())->Grow( LONG_MAX, pHeight, TRUE ) ); + return ( GetUpper() && ((SwFrm*)GetUpper())->Grow( LONG_MAX PHEIGHT, TRUE ) ); } /************************************************************************* @@ -1788,6 +1796,15 @@ BOOL SwSectionFrm::Growable() const |* |*************************************************************************/ +#ifdef VERTICAL_LAYOUT +SwTwips SwSectionFrm::_Grow( SwTwips nDist, BOOL bTst ) +{ + if ( !IsColLocked() && !HasFixSize() ) + { + if ( Frm().Height() > 0 && + nDist > (LONG_MAX - Frm().Height()) ) + nDist = LONG_MAX - Frm().Height(); +#else SwTwips SwSectionFrm::_Grow( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) { if ( !IsColLocked() && !HasFixSize( pDirection ) ) @@ -1795,6 +1812,7 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) if ( Frm().SSize().*pDirection > 0 && nDist > (LONG_MAX - Frm().SSize().*pDirection) ) nDist = LONG_MAX - Frm().SSize().*pDirection; +#endif if ( nDist <= 0L ) return 0L; @@ -1807,7 +1825,7 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) lcl_DeadLine( this ) - Frm().Top() - Frm().Height(); SwTwips nSpace = nGrow; if( !bInCalcCntnt && nGrow < nDist ) - nGrow += GetUpper()->Grow( LONG_MAX, pHeight, TRUE ); + nGrow += GetUpper()->Grow( LONG_MAX PHEIGHT, TRUE ); if( nGrow > nDist ) nGrow = nDist; @@ -1827,7 +1845,11 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) if( bInCalcCntnt ) _InvalidateSize(); else if( nSpace < nGrow && nDist != nSpace + GetUpper()-> +#ifdef VERTICAL_LAYOUT + Grow( nGrow - nSpace, FALSE ) ) +#else Grow( nGrow - nSpace, pDirection, FALSE ) ) +#endif InvalidateSize(); else { @@ -1841,8 +1863,13 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) if( GetUpper()->IsHeaderFrm() || GetUpper()->IsFooterFrm() ) GetUpper()->InvalidateSize(); } +#ifdef VERTICAL_LAYOUT + Frm().SSize().Height() += nGrow; + Prt().SSize().Height() += nGrow; +#else Frm().SSize().*pDirection += nGrow; Prt().SSize().*pDirection += nGrow; +#endif if( Lower() && Lower()->IsColumnFrm() && Lower()->GetNext() ) { SwFrm* pTmp = Lower(); @@ -1880,9 +1907,15 @@ SwTwips SwSectionFrm::_Grow( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) return 0L; } +#ifdef VERTICAL_LAYOUT +SwTwips SwSectionFrm::_Shrink( SwTwips nDist, BOOL bTst ) +{ + if ( Lower() && !IsColLocked() && !HasFixSize() ) +#else SwTwips SwSectionFrm::_Shrink( SwTwips nDist, const SzPtr pDirection, BOOL bTst ) { if ( Lower() && !IsColLocked() && !HasFixSize( pDirection ) ) +#endif { if( ToMaximize( FALSE ) ) { @@ -1891,26 +1924,19 @@ SwTwips SwSectionFrm::_Shrink( SwTwips nDist, const SzPtr pDirection, BOOL bTst } else { +#ifdef VERTICAL_LAYOUT + if ( nDist > Frm().Height() ) + nDist = Frm().Height(); +#else if ( nDist > Frm().SSize().*pDirection ) nDist = Frm().SSize().*pDirection; - +#endif if ( Lower()->IsColumnFrm() && Lower()->GetNext() && // FtnAtEnd !GetSection()->GetFmt()->GetBalancedColumns().GetValue() ) { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber //das Wachstum (wg. des Ausgleichs). if ( !bTst ) - { -#ifdef USED - Frm().SSize().*pDirection -= nDist; - Prt().SSize().*pDirection -= nDist; -#endif InvalidateSize(); -#ifdef USED - if( !GetNext() ) - SetRetouche(); - GetUpper()->Shrink( nDist, pDirection, FALSE ); -#endif - } return nDist; } else if( !bTst ) @@ -1922,9 +1948,15 @@ SwTwips SwSectionFrm::_Shrink( SwTwips nDist, const SzPtr pDirection, BOOL bTst SetCompletePaint(); InvalidatePage(); } +#ifdef VERTICAL_LAYOUT + Frm().SSize().Height() -= nDist; + Prt().SSize().Height() -= nDist; + const SwTwips nReal = GetUpper()->Shrink( nDist, bTst ); +#else Frm().SSize().*pDirection -= nDist; Prt().SSize().*pDirection -= nDist; const SwTwips nReal = GetUpper()->Shrink( nDist, pDirection, bTst ); +#endif if( Lower() && Lower()->IsColumnFrm() && Lower()->GetNext() ) { SwFrm* pTmp = Lower(); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 430619518089..a2319698ec61 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabfrm.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: ama $ $Date: 2001-08-30 14:52:51 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:25:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,7 @@ #include "dcontact.hxx" #include "viewopt.hxx" #include "hints.hxx" +#include "dbg_lay.hxx" #include <ftnidx.hxx> @@ -148,7 +149,7 @@ SwTabFrm::SwTabFrm( SwTable &rTab ): { bComplete = bCalcLowers = bONECalcLowers = bLowersFormatted = bLockBackMove = bResizeHTMLTable = FALSE; - bFixHeight = FALSE; //Nicht nochmal auf die Importfilter hereinfallen. + BFIXHEIGHT = FALSE; //Nicht nochmal auf die Importfilter hereinfallen. nType = FRMC_TAB; //Gleich die Zeilen erzeugen und einfuegen. @@ -175,7 +176,7 @@ SwTabFrm::SwTabFrm( SwTabFrm &rTab ) : bIsFollow = TRUE; bLockJoin = bComplete = bONECalcLowers = bCalcLowers = bLowersFormatted = bLockBackMove = bResizeHTMLTable = FALSE; - bFixHeight = FALSE; //Nicht nochmal auf die Importfilter hereinfallen. + BFIXHEIGHT = FALSE; //Nicht nochmal auf die Importfilter hereinfallen. nType = FRMC_TAB; SetFollow( rTab.GetFollow() ); @@ -352,7 +353,7 @@ SwTwips SwTabFrm::Split( const SwTwips nCutPos ) } } ASSERT( !bNewFollow || !pFoll->Frm().Height(), "Dont care about Performance"); - Shrink( nRet, pHeight ); + Shrink( nRet PHEIGHT ); return nRet; } @@ -387,7 +388,7 @@ SwTwips SwTabFrm::Join() } SetFollow( pFoll->GetFollow() ); delete pFoll; - Grow( nHeight, pHeight ); + Grow( nHeight PHEIGHT ); } return nHeight; } @@ -436,6 +437,7 @@ BOOL MA_FASTCALL lcl_CalcLowers( SwLayoutFrm *pLay, long nBottom ) BOOL MA_FASTCALL lcl_InnerCalcLayout( SwFrm *pFrm, long nBottom ) { BOOL bRet = FALSE; + const SwFrm* pOldUp = pFrm->GetUpper(); do { if( pFrm->IsLayoutFrm() ) @@ -446,7 +448,7 @@ BOOL MA_FASTCALL lcl_InnerCalcLayout( SwFrm *pFrm, long nBottom ) bRet |= lcl_InnerCalcLayout( ((SwLayoutFrm*)pFrm)->Lower(), nBottom); } pFrm = pFrm->GetNext(); - } while ( pFrm && pFrm->Frm().Top() < nBottom ); + } while( pFrm && pFrm->Frm().Top() < nBottom && pFrm->GetUpper()==pOldUp ); return bRet; } @@ -499,6 +501,10 @@ void MA_FASTCALL lcl_FirstTabCalc( SwTabFrm *pTab ) pCell = (SwLayoutFrm*)pCell->GetNext(); } while ( pCell ); + SwTwips nRowTop = pRow->Frm().Top(); + SwTwips nUpBot = pTab->GetUpper()->Frm().Bottom(); + if( nUpBot < nRowTop ) + break; pRow = (SwLayoutFrm*)pRow->GetNext(); } while ( pRow ); @@ -508,7 +514,7 @@ void MA_FASTCALL lcl_FirstTabCalc( SwTabFrm *pTab ) SwFrm *pUp = pTab->GetUpper(); long nBottom = pUp->Prt().Bottom() + pUp->Frm().Top(); if ( pTab->GetFmt()->GetDoc()->IsBrowseMode() ) - nBottom += pUp->Grow( LONG_MAX, pHeight, TRUE ); + nBottom += pUp->Grow( LONG_MAX PHEIGHT, TRUE ); lcl_CalcLowers( (SwLayoutFrm*)pTab->Lower(), nBottom ); } @@ -545,6 +551,8 @@ void SwTabFrm::MakeAll() if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 ) return; + PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 ) + LockJoin(); //Ich lass mich nicht unterwegs vernichten. SwLayNotify aNotify( this ); //uebernimmt im DTor die Benachrichtigung @@ -841,7 +849,7 @@ void SwTabFrm::MakeAll() SwFrm *pTmp = GetUpper(); SwTwips nDeadLine = pTmp->Prt().Bottom() + pTmp->Frm().Top(); if ( GetFmt()->GetDoc()->IsBrowseMode() ) - nDeadLine += pTmp->Grow( LONG_MAX, pHeight, TRUE ); + nDeadLine += pTmp->Grow( LONG_MAX PHEIGHT, TRUE ); if ( Frm().Bottom() < nDeadLine ) { SwFrm *pRow = GetFollow()->Lower(); @@ -941,7 +949,7 @@ void SwTabFrm::MakeAll() SwTwips nDeadLine = GetUpper()->Prt().Bottom() + GetUpper()->Frm().Top(); if( IsInSct() ) - nDeadLine += GetUpper()->Grow( LONG_MAX, pHeight, TRUE ); + nDeadLine += GetUpper()->Grow( LONG_MAX PHEIGHT, TRUE ); //Zunaechst einmal sollten wir fuer Stabilitaet sorgen, //denn andernfalls koennen wir nicht hinreichend zuverlaessig @@ -970,8 +978,10 @@ void SwTabFrm::MakeAll() //Follow gleich gueltig gemacht werden. if ( GetFollow() ) { - if ( !StackHack::IsLocked() ) + static BYTE nStack = 0; + if ( !StackHack::IsLocked() && nStack < 4 ) { + ++nStack; StackHack aHack; delete pAccess; GetFollow()->MakeAll(); @@ -987,6 +997,7 @@ void SwTabFrm::MakeAll() if ( pNxt ) pNxt->Calc(); } + --nStack; } else if ( GetFollow() == GetNext() ) ((SwTabFrm*)GetFollow())->MoveFwd( TRUE, FALSE ); @@ -1324,9 +1335,9 @@ void SwTabFrm::Format( const SwBorderAttrs *pAttrs ) nDiff = Frm().Height() - nRemaining; if ( nDiff > 0 ) - Shrink( nDiff, pHeight ); + Shrink( nDiff PHEIGHT ); else if ( nDiff < 0 ) - Grow( -nDiff, pHeight ); + Grow( -nDiff PHEIGHT ); } } /************************************************************************* @@ -1337,20 +1348,24 @@ void SwTabFrm::Format( const SwBorderAttrs *pAttrs ) |* Letzte Aenderung MA 23. Sep. 96 |* |*************************************************************************/ +#ifdef VERTICAL_LAYOUT +SwTwips SwTabFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + SWRECTFN( this ) + SwTwips nHeight =(Frm().*fnRect->fnGetHeight)(); + if( nHeight > 0 && nDist > ( LONG_MAX - nHeight ) ) + nDist = LONG_MAX - nHeight; +#else SwTwips SwTabFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) { - //Horizontal tables has fixed width, vertical fixed height -#ifdef VERTICAL_LAYOUT - if( ( pDirection == pHeight ) == IsVertical() ) -#else if( pDirection == pWidth ) -#endif return 0; if ( Frm().SSize().*pDirection > 0 && nDist > (LONG_MAX - Frm().SSize().*pDirection) ) nDist = LONG_MAX - Frm().SSize().*pDirection; +#endif //Tabelle waechst immer (sie kann ja ggf. aufgespalten werden). if ( !bTst ) @@ -1359,6 +1374,29 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, { //Der Upper wird nur soweit wie notwendig gegrowed. In nReal wird erstmal //die bereits zur Verfuegung stehende Strecke bereitgestellt. +#ifdef VERTICAL_LAYOUT + SwTwips nReal = (GetUpper()->Prt().*fnRect->fnGetHeight)(); + SwFrm *pFrm = GetUpper()->Lower(); + while ( pFrm ) + { nReal -= (pFrm->Frm().*fnRect->fnGetHeight)(); + pFrm = pFrm->GetNext(); + } + + nHeight = (Frm().*fnRect->fnGetHeight)(); + (Frm().*fnRect->fnSetHeight)( nHeight + nDist ); + if( IsVertical() && !IsReverse() ) + Frm().Pos().X() -= nDist; + if ( nReal < nDist ) + GetUpper()->Grow( nDist - (nReal>0 ? nReal : 0), bTst, bInfo ); + } + else + { + ASSERT( !this, "Table without Upper" ); + nHeight = (Frm().*fnRect->fnGetHeight)(); + (Frm().*fnRect->fnSetHeight)( nHeight + nDist ); + if( IsVertical() && !IsReverse() ) + Frm().Pos().X() -= nDist; +#else SwTwips nReal = GetUpper()->Prt().SSize().*pDirection; SwFrm *pFrm = GetUpper()->Lower(); while ( pFrm ) @@ -1367,10 +1405,6 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, } Frm().SSize().*pDirection += nDist; -#ifdef VERTICAL_LAYOUT - if( IsVertical() ) - Frm().Pos().X() -= nDist; -#endif if ( nReal < nDist ) GetUpper()->Grow( nDist - (nReal > 0 ? nReal : 0), @@ -1380,9 +1414,6 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, { ASSERT( !this, "Table without Upper" ); Frm().SSize().*pDirection += nDist; -#ifdef VERTICAL_LAYOUT - if( IsVertical() ) - Frm().Pos().X() -= nDist; #endif } @@ -1711,7 +1742,7 @@ BOOL SwTabFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReform bMoveAnyway = BwdMoveNecessary( pNewPage, aRect) > 1; nSpace = aRect.Height(); if ( GetFmt()->GetDoc()->IsBrowseMode() ) - nSpace += pNewUpper->Grow( LONG_MAX, pHeight, TRUE ); + nSpace += pNewUpper->Grow( LONG_MAX PHEIGHT, TRUE ); } } else if ( SwFlowFrm::IsMoveBwdJump() || !bLockBackMove ) @@ -1810,7 +1841,7 @@ void SwTabFrm::Cut() } } else if ( Frm().Height() ) - pUp->Shrink( Frm().Height(), pHeight ); + pUp->Shrink( Frm().Height() PHEIGHT ); } if ( pPage && !IsFollow() && pPage->GetUpper() ) @@ -1850,7 +1881,7 @@ void SwTabFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) } if ( Frm().Height() ) - pParent->Grow( Frm().Height(), pHeight ); + pParent->Grow( Frm().Height() PHEIGHT ); if ( Frm().Width() != pParent->Prt().Width() ) Prepare( PREP_FIXSIZE_CHG ); @@ -1907,7 +1938,9 @@ SwRowFrm::SwRowFrm( const SwTableLine &rLine ): { SwCellFrm *pNew = new SwCellFrm( *rBoxes[i] ); pNew->InsertBehind( this, pPrev ); +#ifndef VERTICAL_LAYOUT pNew->bVarHeight = FALSE; +#endif pPrev = pNew; } } @@ -2071,7 +2104,11 @@ SwTwips MA_FASTCALL lcl_CalcMinCellHeight( SwLayoutFrm *pCell, SwTwips MA_FASTCALL lcl_CalcMinRowHeight( SwLayoutFrm *pRow ) { +#ifdef VERTICAL_LAYOUT + if ( pRow->HasFixSize() ) +#else if ( pRow->HasFixSize( pHeight ) ) +#endif return pRow->Frm().Height(); SwTwips nHeight = 0; @@ -2093,7 +2130,7 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) { ASSERT( pAttrs, "SwRowFrm::Format ohne Attrs." ); - const BOOL bFix = bFixHeight; + const BOOL bFix = BFIXHEIGHT; if ( !bValidPrtArea ) { @@ -2110,6 +2147,18 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) { bValidSize = TRUE; +#ifdef VERTICAL_LAYOUT +#ifndef PRODUCT + if ( HasFixSize() ) + { + const SwFmtFrmSize &rFrmSize = GetFmt()->GetFrmSize(); + ASSERT( rFrmSize.GetSize().Height() > 0, "Hat ihn" ); + } +#endif + const SwTwips nDiff = Frm().Height() - (HasFixSize() ? + pAttrs->GetSize().Height() : + ::lcl_CalcMinRowHeight( this )); +#else #ifndef PRODUCT if ( HasFixSize( pHeight ) ) { @@ -2120,14 +2169,15 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) const SwTwips nDiff = Frm().Height() - (HasFixSize( pHeight ) ? pAttrs->GetSize().Height() : ::lcl_CalcMinRowHeight( this )); +#endif if ( nDiff ) { - bFixHeight = FALSE; + BFIXHEIGHT = FALSE; if ( nDiff > 0 ) - Shrink( nDiff, pHeight, FALSE, TRUE ); + Shrink( nDiff PHEIGHT, FALSE, TRUE ); else if ( nDiff < 0 ) - Grow( -nDiff, pHeight ); - bFixHeight = bFix; + Grow( -nDiff PHEIGHT ); + BFIXHEIGHT = bFix; } } if ( !GetNext() ) @@ -2141,9 +2191,9 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) } while ( pSibling ); if ( nDiff > 0 ) { - bFixHeight = FALSE; - Grow( nDiff, pHeight ); - bFixHeight = bFix; + BFIXHEIGHT = FALSE; + Grow( nDiff PHEIGHT ); + BFIXHEIGHT = bFix; bValidSize = TRUE; } } @@ -2209,6 +2259,125 @@ void SwRowFrm::Cut() |* Letzte Aenderung MA 05. May. 94 |* |*************************************************************************/ + +#ifdef VERTICAL_LAYOUT + +SwTwips SwRowFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + const SwTwips nReal = SwLayoutFrm::GrowFrm( nDist, bTst, bInfo); + + //Hoehe der Zellen auf den neuesten Stand bringen. + if ( !bTst ) + { + SWRECTFN( this ) + AdjustCells( (Prt().*fnRect->fnGetHeight)() + nReal, !bVert ); + if ( nReal ) + SetCompletePaint(); + } + return nReal; +} +/************************************************************************* +|* +|* SwRowFrm::ShrinkFrm() +|* +|* Ersterstellung MA 15. Mar. 93 +|* Letzte Aenderung MA 20. Jun. 96 +|* +|*************************************************************************/ +SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) +{ + SWRECTFN( this ) + if( HasFixSize() ) + { + AdjustCells( (Prt().*fnRect->fnGetHeight)(), !bVert ); + return 0L; + } + + //bInfo wird ggf. vom SwRowFrm::Format auf TRUE gesetzt, hier muss dann + //entsprechend reagiert werden + const BOOL bShrinkAnyway = bInfo; + + //Nur soweit Shrinken, wie es der Inhalt der groessten Zelle zulaesst. + SwTwips nRealDist = nDist; + if( !bVert ) + { + const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize(); + SwTwips nMinHeight = rSz.GetSizeType() == ATT_MIN_SIZE ? + ( bVert ? rSz.GetWidth() : rSz.GetHeight() ) : 0; + SwLayoutFrm *pCell = (SwLayoutFrm*)Lower(); + if( nMinHeight < (Frm().*fnRect->fnGetHeight)() ) + { + SwLayoutFrm *pCell = (SwLayoutFrm*)Lower(); + while ( pCell ) + { + SwTwips nAct = ::lcl_CalcMinCellHeight( pCell ); + if ( nAct > nMinHeight ) + nMinHeight = nAct; + if ( nMinHeight >= (Frm().*fnRect->fnGetHeight)() ) + break; + pCell = (SwLayoutFrm*)pCell->GetNext(); + } + } + if ( ((Frm().*fnRect->fnGetHeight)() - nRealDist) < nMinHeight ) + nRealDist = (Frm().*fnRect->fnGetHeight)() - nMinHeight; + } + if ( nRealDist < 0 ) + nRealDist = 0; + + SwTwips nReal = nRealDist; + if ( nReal ) + { + if ( !bTst ) + { + SwTwips nHeight = (Frm().*fnRect->fnGetHeight)(); + (Frm().*fnRect->fnSetHeight)( nHeight - nReal ); + if( IsVertical() && !bRev ) + Frm().Pos().X() -= nReal; + } + + SwTwips nTmp = GetUpper()->Shrink( nReal, bTst ); + if ( !bShrinkAnyway && !GetNext() && nTmp != nReal ) + { + //Der letzte bekommt den Rest im Upper und nimmt deshalb + //ggf. Ruecksichten (sonst: Endlosschleife) + if ( !bTst ) + { + nReal -= nTmp; + SwTwips nHeight = (Frm().*fnRect->fnGetHeight)(); + (Frm().*fnRect->fnSetHeight)( nHeight + nReal ); + if( IsVertical() && !bRev ) + Frm().Pos().X() -= nReal; + } + nReal = nTmp; + } + } + + //Geeignet invalidieren und die Hoehe der Zellen auf den neuesten + //Stand bringen. + if ( !bTst ) + { + if ( nReal ) + { + if ( GetNext() ) + GetNext()->_InvalidatePos(); + _InvalidateAll(); + SetCompletePaint(); + + SwTabFrm *pTab = FindTabFrm(); + if ( pTab->IsFollow() && + (!GetPrev() || + (pTab->GetTable()->IsHeadlineRepeat() && !GetPrev()->GetPrev()))) + { + pTab->FindMaster()->InvalidatePos(); + } + } + AdjustCells( (Prt().*fnRect->fnGetHeight)() - nReal, !bVert ); + } + return nReal; +} + +#else + SwTwips SwRowFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) { @@ -2218,11 +2387,7 @@ SwTwips SwRowFrm::GrowFrm( SwTwips nDist, const SzPtr pDirection, if ( !bTst ) { AdjustCells( Prt().SSize().*pDirection + nReal, -#ifdef VERTICAL_LAYOUT - ( IsVertical() == ( pDirection == pWidth ) ) ? TRUE : FALSE ); -#else pDirection == pHeight ? TRUE : FALSE ); -#endif if ( nReal ) SetCompletePaint(); } @@ -2240,11 +2405,7 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, BOOL bTst, BOOL bInfo ) { BOOL bVariable = -#ifdef VERTICAL_LAYOUT - IsVertical() == ( pDirection == pWidth ); -#else pDirection == pHeight; -#endif if ( HasFixSize( pDirection ) ) { AdjustCells( Prt().SSize().*pDirection, bVariable ); @@ -2260,12 +2421,7 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, if ( bVariable ) { const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize(); -#ifdef VERTICAL_LAYOUT - SwTwips nMinHeight = rSz.GetSizeType() == ATT_MIN_SIZE ? - ( IsVertical() ? rSz.GetWidth() : rSz.GetHeight() ) : 0; -#else SwTwips nMinHeight = rSz.GetSizeType() == ATT_MIN_SIZE ? rSz.GetHeight() : 0; -#endif SwLayoutFrm *pCell = (SwLayoutFrm*)Lower(); if ( nMinHeight < Frm().SSize().*pDirection ) { @@ -2290,13 +2446,7 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, if ( nReal ) { if ( !bTst ) - { Frm().SSize().*pDirection -= nReal; -#ifdef VERTICAL_LAYOUT - if( IsVertical() ) - Frm().Pos().X() -= nReal; -#endif - } SwTwips nTmp = GetUpper()->Shrink( nReal, pDirection, bTst ); if ( !bShrinkAnyway && !GetNext() && nTmp != nReal ) @@ -2307,10 +2457,6 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, { nReal -= nTmp; Frm().SSize().*pDirection += nReal; -#ifdef VERTICAL_LAYOUT - if( IsVertical() ) - Frm().Pos().X() -= nReal; -#endif } nReal = nTmp; } @@ -2340,6 +2486,9 @@ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, const SzPtr pDirection, return nReal; } + +#endif + /************************************************************************* |* |* SwCellFrm::SwCellFrm(), ~SwCellFrm() @@ -2526,7 +2675,7 @@ void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) { //Wieder validieren wenn kein Wachstum stattgefunden hat. //Invalidiert wird durch AdjustCells von der Row. - if ( !Grow( nDiffHeight, pHeight ) ) + if ( !Grow( nDiffHeight PHEIGHT ) ) bValidSize = bValidPrtArea = TRUE; } else @@ -2534,7 +2683,7 @@ void SwCellFrm::Format( const SwBorderAttrs *pAttrs ) //Nur dann invalidiert lassen, wenn tatsaechlich //geshrinkt wurde; das kann abgelehnt werden, weil alle //nebeneinanderliegenden Zellen gleichgross sein muessen. - if ( !Shrink( -nDiffHeight, pHeight ) ) + if ( !Shrink( -nDiffHeight PHEIGHT ) ) bValidSize = bValidPrtArea = TRUE; } } diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 516ef3f20463..38cb990b3fe7 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -2,9 +2,9 @@ * * $RCSfile: frmform.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: fme $ $Date: 2001-10-10 15:19:15 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:07:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -310,11 +310,12 @@ sal_Bool SwTxtFrm::_GetDropRect( SwRect &rRect ) const #ifdef VERTICAL_LAYOUT if ( IsVertical() ) - pFrm->SwitchHorizontalToVertical( rOrig ); + SwitchHorizontalToVertical( rRect ); #endif - + UNDO_SWAP return sal_True; } + UNDO_SWAP return sal_False; } @@ -530,7 +531,7 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) { if( IsInFtn() && !IsInSct() ) { - SwTwips nReal = Grow( nChgHght, pHeight, sal_True ); + SwTwips nReal = Grow( nChgHght PHEIGHT, sal_True ); if( nReal < nChgHght ) { SwTwips nBot = Frm().Top() + Frm().Height() + nChgHght @@ -549,7 +550,7 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) } } - Grow( nChgHght, pHeight ); + Grow( nChgHght PHEIGHT ); if ( IsInFly() ) { @@ -625,7 +626,7 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) //Kann sein, dass ich die richtige Grosse habe, der Upper aber zu //klein ist und der Upper noch Platz schaffen kann. if( ( nRstHeight >= 0 || ( IsInFtn() && IsInSct() ) ) && !bHasToFit ) - nRstHeight += GetUpper()->Grow( Frm().Height()-nRstHeight, pHeight ); + nRstHeight += GetUpper()->Grow( Frm().Height()-nRstHeight PHEIGHT ); // In spaltigen Bereichen wollen wir moeglichst nicht zu gross werden, damit // nicht ueber GetNextSctLeaf weitere Bereiche angelegt werden. Stattdessen // schrumpfen wir und notieren bUndersized, damit FormatWidthCols die richtige @@ -636,8 +637,8 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) ( IsInSct() && !FindSctFrm()->MoveAllowed(this) ) ) { SetUndersized( sal_True ); - Shrink( Min( ( nFrmHeight - nRstHeight), nPrtHeight ), - pHeight ); + Shrink( Min( ( nFrmHeight - nRstHeight), nPrtHeight ) + PHEIGHT ); } else SetUndersized( sal_False ); @@ -648,7 +649,7 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) if( nRstHeight - nFrmHeight < nChgHeight ) nChgHeight = nRstHeight - nFrmHeight; if( nChgHeight ) - Grow( nChgHeight, pHeight ); + Grow( nChgHeight ); } #else if( nRstHeight < Frm().Height() ) @@ -685,7 +686,7 @@ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit ) #endif } else if ( nChgHght ) - Shrink( -nChgHght, pHeight ); + Shrink( -nChgHght PHEIGHT ); #ifdef VERTICAL_LAYOUT UNDO_SWAP @@ -1022,7 +1023,7 @@ sal_Bool SwTxtFrm::CalcPreps() GetFollow()->SetJustWidow( sal_True ); GetFollow()->Prepare( PREP_CLEAR ); - Shrink( nChgHeight, pHeight ); + Shrink( nChgHeight PHEIGHT ); SwRect &rRepaint = *(pPara->GetRepaint()); #ifdef VERTICAL_LAYOUT @@ -1135,14 +1136,14 @@ sal_Bool SwTxtFrm::CalcPreps() #ifdef VERTICAL_LAYOUT if( bVert && nIs < nMust ) { - Shrink( nMust - nIs, pHeight ); + Shrink( nMust - nIs ); if( Prt().Width() < 0 ) Prt().Width( 0 ); SetUndersized( sal_True ); } else if ( ! bVert && nIs > nMust ) { - Shrink( nIs - nMust, pHeight ); + Shrink( nIs - nMust ); if( Prt().Height() < 0 ) Prt().Height( 0 ); SetUndersized( sal_True ); @@ -1966,12 +1967,12 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) + GetUpper()->Frm().Height(); const SwTwips nIs = Frm().Top() + Frm().Height(); if( nIs > nMust ) - Shrink( nIs - nMust, pHeight ); + Shrink( nIs - nMust PHEIGHT ); } else if( 240 < Frm().Height() ) - Shrink( Frm().Height() - 240, pHeight ); + Shrink( Frm().Height() - 240 PHEIGHT ); else if( 240 > Frm().Height() ) - Grow( 240 - Frm().Height(), pHeight ); + Grow( 240 - Frm().Height() PHEIGHT ); if( Prt().Top() > Frm().Height() ) Prt().Top( Frm().Height() ); if( Prt().Height() < 0 ) @@ -2017,7 +2018,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) if( Prt().Height() ) { HideHidden(); - Shrink( Prt().Height(), pHeight ); + Shrink( Prt().Height() PHEIGHT ); } ChgThisLines(); return; diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 7c6a4064f27c..69c8415407b4 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtftn.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: fme $ $Date: 2001-10-11 10:54:19 $ + * last change: $Author: ama $ $Date: 2001-10-19 10:07:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -304,10 +304,10 @@ SwTwips SwTxtFrm::_GetFtnFrmHeight() const if ( !pRef->IsInFtnConnect() ) { SwSaveFtnHeight aSave( (SwFtnBossFrm*)pBoss, nHeight ); - nHeight = ((SwFtnContFrm*)pCont)->Grow( LONG_MAX, pHeight, sal_True ); + nHeight = ((SwFtnContFrm*)pCont)->Grow( LONG_MAX PHEIGHT, sal_True ); } else - nHeight = ((SwFtnContFrm*)pCont)->Grow( LONG_MAX, pHeight, sal_True ); + nHeight = ((SwFtnContFrm*)pCont)->Grow( LONG_MAX PHEIGHT, sal_True ); nHeight += nTmp; if( nHeight < 0 ) |