1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22f53e21faSmseidel
23f53e21faSmseidel
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
28cdf0e10cSrcweir #include <hintids.hxx>
29cdf0e10cSrcweir #include <vcl/sound.hxx>
30cdf0e10cSrcweir #include <tools/poly.hxx>
31cdf0e10cSrcweir #define _SVSTDARR_LONGS
32cdf0e10cSrcweir #include <svl/svstdarr.hxx>
33cdf0e10cSrcweir #include <svx/xoutbmp.hxx>
34cdf0e10cSrcweir #include <sfx2/progress.hxx>
35cdf0e10cSrcweir #include <editeng/brshitem.hxx>
36cdf0e10cSrcweir #include <editeng/opaqitem.hxx>
37cdf0e10cSrcweir #include <editeng/prntitem.hxx>
38cdf0e10cSrcweir #include <editeng/boxitem.hxx>
39cdf0e10cSrcweir #include <editeng/shaditem.hxx>
40cdf0e10cSrcweir #include <svx/framelink.hxx>
41cdf0e10cSrcweir #include <vcl/graph.hxx>
42cdf0e10cSrcweir #include <svx/svdpagv.hxx>
43cdf0e10cSrcweir #include <hintids.hxx>
44cdf0e10cSrcweir #include <tgrditem.hxx>
45cdf0e10cSrcweir #include <switerator.hxx>
46cdf0e10cSrcweir #include <fmtsrnd.hxx>
47cdf0e10cSrcweir #include <fmtclds.hxx>
48cdf0e10cSrcweir #include <tools/shl.hxx>
49cdf0e10cSrcweir #include <comcore.hrc>
50cdf0e10cSrcweir #include <swmodule.hxx>
51cdf0e10cSrcweir #include <rootfrm.hxx>
52cdf0e10cSrcweir #include <pagefrm.hxx>
53cdf0e10cSrcweir #include <cntfrm.hxx>
54cdf0e10cSrcweir #include <viewsh.hxx>
55cdf0e10cSrcweir #include <section.hxx>
56cdf0e10cSrcweir #include <sectfrm.hxx>
57cdf0e10cSrcweir #include <doc.hxx>
58cdf0e10cSrcweir #include <viewimp.hxx>
59cdf0e10cSrcweir #include <dflyobj.hxx>
60cdf0e10cSrcweir #include <flyfrm.hxx>
61cdf0e10cSrcweir #include <frmtool.hxx>
62cdf0e10cSrcweir #include <viewopt.hxx>
63cdf0e10cSrcweir #include <dview.hxx>
64cdf0e10cSrcweir #include <dcontact.hxx>
65cdf0e10cSrcweir #include <txtfrm.hxx>
66cdf0e10cSrcweir #include <ftnfrm.hxx>
67cdf0e10cSrcweir #include <tabfrm.hxx>
68cdf0e10cSrcweir #include <rowfrm.hxx>
69cdf0e10cSrcweir #include <cellfrm.hxx>
70cdf0e10cSrcweir #include <notxtfrm.hxx>
71cdf0e10cSrcweir #include <swregion.hxx>
72cdf0e10cSrcweir #include <layact.hxx>
73cdf0e10cSrcweir #include <pagedesc.hxx>
74cdf0e10cSrcweir #include <ptqueue.hxx>
75cdf0e10cSrcweir #include <noteurl.hxx>
76cdf0e10cSrcweir #include <virtoutp.hxx>
77cdf0e10cSrcweir #include <lineinfo.hxx>
78cdf0e10cSrcweir #include <dbg_lay.hxx>
79cdf0e10cSrcweir #include <accessibilityoptions.hxx>
80cdf0e10cSrcweir #include <docsh.hxx>
81cdf0e10cSrcweir #include <swtable.hxx>
82cdf0e10cSrcweir #include <svx/svdogrp.hxx>
83cdf0e10cSrcweir #include <sortedobjs.hxx>
84cdf0e10cSrcweir #include <EnhancedPDFExportHelper.hxx>
85cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
86cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx>
87cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx>
88cdf0e10cSrcweir #include <ndole.hxx>
8978d93489SArmin Le Grand #include <svx/charthelper.hxx>
90cdf0e10cSrcweir #include <PostItMgr.hxx>
91cdf0e10cSrcweir #include <tools/color.hxx>
92cdf0e10cSrcweir #include <vcl/svapp.hxx>
9356b35d86SArmin Le Grand #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
9464b14621SArmin Le Grand #include <drawinglayer/processor2d/processor2dtools.hxx>
9556b35d86SArmin Le Grand #include <ndtxt.hxx>
9626ea3662SArmin Le Grand #include <drawdoc.hxx>
9764b14621SArmin Le Grand
98cdf0e10cSrcweir #define COL_NOTES_SIDEPANE RGB_COLORDATA(230,230,230)
99cdf0e10cSrcweir #define COL_NOTES_SIDEPANE_BORDER RGB_COLORDATA(200,200,200)
100cdf0e10cSrcweir #define COL_NOTES_SIDEPANE_SCROLLAREA RGB_COLORDATA(230,230,220)
101cdf0e10cSrcweir
102cdf0e10cSrcweir using namespace ::com::sun::star;
103cdf0e10cSrcweir
104cdf0e10cSrcweir #define GETOBJSHELL() ((SfxObjectShell*)rSh.GetDoc()->GetDocShell())
105cdf0e10cSrcweir
106cdf0e10cSrcweir //Tabellenhilfslinien an?
107cdf0e10cSrcweir #define IS_SUBS_TABLE \
108cdf0e10cSrcweir (pGlobalShell->GetViewOptions()->IsTable() && \
109cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsPagePreview()&&\
110cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsReadonly()&&\
111cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsFormView() &&\
112cdf0e10cSrcweir SwViewOption::IsTableBoundaries())
113cdf0e10cSrcweir //sonstige Hilfslinien an?
114cdf0e10cSrcweir #define IS_SUBS (!pGlobalShell->GetViewOptions()->IsPagePreview() && \
115cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsReadonly() && \
116cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsFormView() &&\
117cdf0e10cSrcweir SwViewOption::IsDocBoundaries())
118cdf0e10cSrcweir //Hilfslinien fuer Bereiche
119cdf0e10cSrcweir #define IS_SUBS_SECTION (!pGlobalShell->GetViewOptions()->IsPagePreview() && \
120cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsReadonly()&&\
121cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsFormView() &&\
122cdf0e10cSrcweir SwViewOption::IsSectionBoundaries())
123cdf0e10cSrcweir #define IS_SUBS_FLYS (!pGlobalShell->GetViewOptions()->IsPagePreview() && \
124cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsReadonly()&&\
125cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsFormView() &&\
126cdf0e10cSrcweir SwViewOption::IsObjectBoundaries())
127cdf0e10cSrcweir
128cdf0e10cSrcweir #define SW_MAXBORDERCACHE 20
129cdf0e10cSrcweir
130cdf0e10cSrcweir //Klassendeklarationen. Hier weil sie eben nur in diesem File benoetigt
131cdf0e10cSrcweir //werden.
132cdf0e10cSrcweir
133cdf0e10cSrcweir #define SUBCOL_PAGE 0x01 //Helplines of the page
134cdf0e10cSrcweir #define SUBCOL_BREAK 0x02 //Helpline for a page or column break
135cdf0e10cSrcweir #define SUBCOL_TAB 0x08 //Helplines inside tables
136cdf0e10cSrcweir #define SUBCOL_FLY 0x10 //Helplines inside fly frames
137cdf0e10cSrcweir #define SUBCOL_SECT 0x20 //Helplines inside sections
138cdf0e10cSrcweir
139cdf0e10cSrcweir //----- Klassen zum Sammeln von Umrandungen und Hilfslinien ---
140cdf0e10cSrcweir class SwLineRect : public SwRect
141cdf0e10cSrcweir {
142cdf0e10cSrcweir const Color *pColor;
143cdf0e10cSrcweir const SwTabFrm *pTab;
144cdf0e10cSrcweir sal_uInt8 nSubColor; //Hilfslinien einfaerben
145cdf0e10cSrcweir sal_Bool bPainted; //schon gepaintet?
146cdf0e10cSrcweir sal_uInt8 nLock; //Um die Linien zum Hell-Layer abzugrenzen.
147cdf0e10cSrcweir public:
148cdf0e10cSrcweir SwLineRect( const SwRect &rRect, const Color *pCol,
149cdf0e10cSrcweir const SwTabFrm *pT , const sal_uInt8 nSCol );
150cdf0e10cSrcweir
GetColor() const151cdf0e10cSrcweir const Color *GetColor() const { return pColor;}
GetTab() const152cdf0e10cSrcweir const SwTabFrm *GetTab() const { return pTab; }
SetPainted()153cdf0e10cSrcweir void SetPainted() { bPainted = sal_True; }
Lock(sal_Bool bLock)154cdf0e10cSrcweir void Lock( sal_Bool bLock ) { if ( bLock )
155cdf0e10cSrcweir ++nLock;
156cdf0e10cSrcweir else if ( nLock )
157cdf0e10cSrcweir --nLock;
158cdf0e10cSrcweir }
IsPainted() const159cdf0e10cSrcweir sal_Bool IsPainted() const { return bPainted; }
IsLocked() const160cdf0e10cSrcweir sal_Bool IsLocked() const { return nLock != 0; }
GetSubColor() const161cdf0e10cSrcweir sal_uInt8 GetSubColor() const { return nSubColor;}
162cdf0e10cSrcweir
163cdf0e10cSrcweir sal_Bool MakeUnion( const SwRect &rRect );
164cdf0e10cSrcweir };
165cdf0e10cSrcweir
166cdf0e10cSrcweir SV_DECL_VARARR( SwLRects, SwLineRect, 100, 100 )
167cdf0e10cSrcweir
168cdf0e10cSrcweir class SwLineRects : public SwLRects
169cdf0e10cSrcweir {
17060d78278Smseidel sal_uInt16 nLastCount; // unnuetze Durchlaeufe im PaintLines verhindern.
171cdf0e10cSrcweir public:
SwLineRects()172cdf0e10cSrcweir SwLineRects() : nLastCount( 0 ) {}
173cdf0e10cSrcweir void AddLineRect( const SwRect& rRect, const Color *pColor,
174cdf0e10cSrcweir const SwTabFrm *pTab, const sal_uInt8 nSCol );
175cdf0e10cSrcweir void ConnectEdges( OutputDevice *pOut );
176cdf0e10cSrcweir void PaintLines ( OutputDevice *pOut );
177cdf0e10cSrcweir void LockLines( sal_Bool bLock );
178cdf0e10cSrcweir
179cdf0e10cSrcweir /// OD 13.08.2002 - correct type of function
Free() const180cdf0e10cSrcweir sal_uInt16 Free() const { return nFree; }
181cdf0e10cSrcweir };
182cdf0e10cSrcweir
183cdf0e10cSrcweir class SwSubsRects : public SwLineRects
184cdf0e10cSrcweir {
185cdf0e10cSrcweir void RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ); //;-)
186cdf0e10cSrcweir public:
187cdf0e10cSrcweir void PaintSubsidiary( OutputDevice *pOut, const SwLineRects *pRects );
188cdf0e10cSrcweir
189cdf0e10cSrcweir inline void Ins( const SwRect &rRect, const sal_uInt8 nSCol );
190cdf0e10cSrcweir };
191cdf0e10cSrcweir
192cdf0e10cSrcweir //----------------- End Klassen Umrandungen ----------------------
193cdf0e10cSrcweir
194cdf0e10cSrcweir static ViewShell *pGlobalShell = 0;
195cdf0e10cSrcweir
19660d78278Smseidel //Wenn durchsichtige FlyInCnts im PaintBackground gepaintet werden so soll der
197cdf0e10cSrcweir //Hintergrund nicht mehr retouchiert werden.
198cdf0e10cSrcweir //static sal_Bool bLockFlyBackground = sal_False;
199cdf0e10cSrcweir
200cdf0e10cSrcweir //Wenn vom Fly ein Metafile abgezogen wird, so soll nur der FlyInhalt und vor
201cdf0e10cSrcweir //nur hintergrund vom FlyInhalt gepaintet werden.
202cdf0e10cSrcweir static sal_Bool bFlyMetafile = sal_False;
203cdf0e10cSrcweir static OutputDevice *pFlyMetafileOut = 0;
204cdf0e10cSrcweir
205cdf0e10cSrcweir //Die Retouche fuer Durchsichtige Flys wird vom Hintergrund der Flys
206cdf0e10cSrcweir //erledigt. Dabei darf der Fly selbst natuerlich nicht ausgespart werden.
207cdf0e10cSrcweir //siehe PaintBackground und lcl_SubtractFlys()
208cdf0e10cSrcweir static SwFlyFrm *pRetoucheFly = 0;
209cdf0e10cSrcweir static SwFlyFrm *pRetoucheFly2 = 0;
210cdf0e10cSrcweir
211cdf0e10cSrcweir //Groesse eines Pixel und die Haelfte davon. Wird jeweils bei Eintritt in
212cdf0e10cSrcweir //SwRootFrm::Paint neu gesetzt.
213cdf0e10cSrcweir static long nPixelSzW = 0, nPixelSzH = 0;
214cdf0e10cSrcweir static long nHalfPixelSzW = 0, nHalfPixelSzH = 0;
215cdf0e10cSrcweir static long nMinDistPixelW = 0, nMinDistPixelH = 0;
216cdf0e10cSrcweir
217cdf0e10cSrcweir //Aktueller Zoomfaktor
218cdf0e10cSrcweir static double aScaleX = 1.0;
219cdf0e10cSrcweir static double aScaleY = 1.0;
220cdf0e10cSrcweir static double aMinDistScale = 0.73;
221cdf0e10cSrcweir static double aEdgeScale = 0.5;
222cdf0e10cSrcweir
223cdf0e10cSrcweir
224cdf0e10cSrcweir //In pLines werden Umrandungen waehrend des Paint gesammelt und soweit
225cdf0e10cSrcweir //moeglich zusammengefasst.
226cdf0e10cSrcweir //In pSubsLines werden Hilfslinien gesammelt und zusammengefasst. Diese
227cdf0e10cSrcweir //werden vor der Ausgabe mit pLines abgeglichen, so dass moeglichst keine
228cdf0e10cSrcweir //Umrandungen von den Hilfslinen verdeckt werden.
22960d78278Smseidel //bTablines ist waehrend des Paints einer Tabelle sal_True.
230cdf0e10cSrcweir static SwLineRects *pLines = 0;
231cdf0e10cSrcweir static SwSubsRects *pSubsLines = 0;
232cdf0e10cSrcweir // OD 18.11.2002 #99672# - global variable for sub-lines of body, header, footer,
233cdf0e10cSrcweir // section and footnote frames.
234cdf0e10cSrcweir static SwSubsRects *pSpecSubsLines = 0;
235cdf0e10cSrcweir
236cdf0e10cSrcweir static SfxProgress *pProgress = 0;
237cdf0e10cSrcweir
238cdf0e10cSrcweir static SwFlyFrm *pFlyOnlyDraw = 0;
239cdf0e10cSrcweir
240cdf0e10cSrcweir //Damit die Flys auch fuer den Hack richtig gepaintet werden koennen.
241cdf0e10cSrcweir static sal_Bool bTableHack = sal_False;
242cdf0e10cSrcweir
243cdf0e10cSrcweir //Um das teure Ermitteln der RetoucheColor zu optimieren
244cdf0e10cSrcweir Color aGlobalRetoucheColor;
245cdf0e10cSrcweir
246cdf0e10cSrcweir //Statics fuer Umrandungsalignment setzen.
247cdf0e10cSrcweir // OD 05.05.2003 #107169# - adjustment for 'small' twip-to-pixel relations:
248cdf0e10cSrcweir // For 'small' twip-to-pixel relations (less then 2:1)
249cdf0e10cSrcweir // values of <nHalfPixelSzW> and <nHalfPixelSzH> are set to ZERO.
SwCalcPixStatics(OutputDevice * pOut)250cdf0e10cSrcweir void SwCalcPixStatics( OutputDevice *pOut )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir // OD 30.04.2003 #107169# - determine 'small' twip-to-pixel relation
253cdf0e10cSrcweir sal_Bool bSmallTwipToPxRelW = sal_False;
254cdf0e10cSrcweir sal_Bool bSmallTwipToPxRelH = sal_False;
255cdf0e10cSrcweir {
256cdf0e10cSrcweir Size aCheckTwipToPxRelSz( pOut->PixelToLogic( Size( 100, 100 )) );
257cdf0e10cSrcweir if ( (aCheckTwipToPxRelSz.Width()/100.0) < 2.0 )
258cdf0e10cSrcweir {
259cdf0e10cSrcweir bSmallTwipToPxRelW = sal_True;
260cdf0e10cSrcweir }
261cdf0e10cSrcweir if ( (aCheckTwipToPxRelSz.Height()/100.0) < 2.0 )
262cdf0e10cSrcweir {
263cdf0e10cSrcweir bSmallTwipToPxRelH = sal_True;
264cdf0e10cSrcweir }
265cdf0e10cSrcweir }
266cdf0e10cSrcweir
267cdf0e10cSrcweir Size aSz( pOut->PixelToLogic( Size( 1,1 )) );
268cdf0e10cSrcweir
269cdf0e10cSrcweir nPixelSzW = aSz.Width();
270cdf0e10cSrcweir if( !nPixelSzW )
271cdf0e10cSrcweir nPixelSzW = 1;
272cdf0e10cSrcweir nPixelSzH = aSz.Height();
273cdf0e10cSrcweir if( !nPixelSzH )
274cdf0e10cSrcweir nPixelSzH = 1;
275cdf0e10cSrcweir
276cdf0e10cSrcweir // OD 06.05.2003 #107169# - consider 'small' twip-to-pixel relations
277cdf0e10cSrcweir if ( !bSmallTwipToPxRelW )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir nHalfPixelSzW = nPixelSzW / 2 + 1;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir else
282cdf0e10cSrcweir {
283cdf0e10cSrcweir nHalfPixelSzW = 0;
284cdf0e10cSrcweir }
285cdf0e10cSrcweir // OD 06.05.2003 #107169# - consider 'small' twip-to-pixel relations
286cdf0e10cSrcweir if ( !bSmallTwipToPxRelH )
287cdf0e10cSrcweir {
288cdf0e10cSrcweir nHalfPixelSzH = nPixelSzH / 2 + 1;
289cdf0e10cSrcweir }
290cdf0e10cSrcweir else
291cdf0e10cSrcweir {
292cdf0e10cSrcweir nHalfPixelSzH = 0;
293cdf0e10cSrcweir }
294cdf0e10cSrcweir
295cdf0e10cSrcweir nMinDistPixelW = nPixelSzW * 2 + 1;
296cdf0e10cSrcweir nMinDistPixelH = nPixelSzH * 2 + 1;
297cdf0e10cSrcweir
298cdf0e10cSrcweir const MapMode &rMap = pOut->GetMapMode();
299cdf0e10cSrcweir aScaleX = rMap.GetScaleX();
300cdf0e10cSrcweir aScaleY = rMap.GetScaleY();
301cdf0e10cSrcweir }
302cdf0e10cSrcweir
303cdf0e10cSrcweir //Zum Sichern der statics, damit das Paint (quasi) reentrant wird.
304cdf0e10cSrcweir class SwSavePaintStatics
305cdf0e10cSrcweir {
306987f0866SArmin Le Grand sal_Bool bSFlyMetafile; // not used: bSPageOnly;
307cdf0e10cSrcweir ViewShell *pSGlobalShell;
308cdf0e10cSrcweir OutputDevice *pSFlyMetafileOut;
309cdf0e10cSrcweir SwFlyFrm *pSRetoucheFly,
310cdf0e10cSrcweir *pSRetoucheFly2,
311cdf0e10cSrcweir *pSFlyOnlyDraw;
312cdf0e10cSrcweir SwLineRects *pSLines;
313cdf0e10cSrcweir SwSubsRects *pSSubsLines;
314cdf0e10cSrcweir // --> OD 2005-07-04 #123196#
315cdf0e10cSrcweir SwSubsRects* pSSpecSubsLines;
316cdf0e10cSrcweir // <--
317cdf0e10cSrcweir SfxProgress *pSProgress;
318cdf0e10cSrcweir long nSPixelSzW,
319cdf0e10cSrcweir nSPixelSzH,
320cdf0e10cSrcweir nSHalfPixelSzW,
321cdf0e10cSrcweir nSHalfPixelSzH,
322cdf0e10cSrcweir nSMinDistPixelW,
323cdf0e10cSrcweir nSMinDistPixelH;
324cdf0e10cSrcweir Color aSGlobalRetoucheColor;
325cdf0e10cSrcweir double aSScaleX,
326cdf0e10cSrcweir aSScaleY;
327cdf0e10cSrcweir public:
328cdf0e10cSrcweir SwSavePaintStatics();
329cdf0e10cSrcweir ~SwSavePaintStatics();
330cdf0e10cSrcweir };
331cdf0e10cSrcweir
SwSavePaintStatics()332cdf0e10cSrcweir SwSavePaintStatics::SwSavePaintStatics() :
333cdf0e10cSrcweir bSFlyMetafile ( bFlyMetafile ),
334cdf0e10cSrcweir pSGlobalShell ( pGlobalShell ),
335cdf0e10cSrcweir pSFlyMetafileOut ( pFlyMetafileOut ),
336cdf0e10cSrcweir pSRetoucheFly ( pRetoucheFly ),
337cdf0e10cSrcweir pSRetoucheFly2 ( pRetoucheFly2 ),
338cdf0e10cSrcweir pSFlyOnlyDraw ( pFlyOnlyDraw ),
339cdf0e10cSrcweir pSLines ( pLines ),
340cdf0e10cSrcweir pSSubsLines ( pSubsLines ),
341cdf0e10cSrcweir // --> OD 2005-07-04 #123196#
342cdf0e10cSrcweir pSSpecSubsLines ( pSpecSubsLines ),
343cdf0e10cSrcweir // <--
344cdf0e10cSrcweir pSProgress ( pProgress ),
345cdf0e10cSrcweir nSPixelSzW ( nPixelSzW ),
346cdf0e10cSrcweir nSPixelSzH ( nPixelSzH ),
347cdf0e10cSrcweir nSHalfPixelSzW ( nHalfPixelSzW ),
348cdf0e10cSrcweir nSHalfPixelSzH ( nHalfPixelSzH ),
349cdf0e10cSrcweir nSMinDistPixelW ( nMinDistPixelW ),
350cdf0e10cSrcweir nSMinDistPixelH ( nMinDistPixelH ),
351cdf0e10cSrcweir aSGlobalRetoucheColor( aGlobalRetoucheColor ),
352cdf0e10cSrcweir aSScaleX ( aScaleX ),
353cdf0e10cSrcweir aSScaleY ( aScaleY )
354cdf0e10cSrcweir {
355cdf0e10cSrcweir bFlyMetafile = sal_False;
356cdf0e10cSrcweir pFlyMetafileOut = 0;
357cdf0e10cSrcweir pRetoucheFly = 0;
358cdf0e10cSrcweir pRetoucheFly2 = 0;
359cdf0e10cSrcweir nPixelSzW = nPixelSzH =
360cdf0e10cSrcweir nHalfPixelSzW = nHalfPixelSzH =
361cdf0e10cSrcweir nMinDistPixelW = nMinDistPixelH = 0;
362cdf0e10cSrcweir aScaleX = aScaleY = 1.0;
363cdf0e10cSrcweir aMinDistScale = 0.73;
364cdf0e10cSrcweir aEdgeScale = 0.5;
365cdf0e10cSrcweir pLines = 0;
366cdf0e10cSrcweir pSubsLines = 0;
367cdf0e10cSrcweir // --> OD 2005-07-04 #123196#
368cdf0e10cSrcweir pSpecSubsLines = 0L;
369cdf0e10cSrcweir // <--
370cdf0e10cSrcweir pProgress = 0;
371cdf0e10cSrcweir }
372cdf0e10cSrcweir
~SwSavePaintStatics()373cdf0e10cSrcweir SwSavePaintStatics::~SwSavePaintStatics()
374cdf0e10cSrcweir {
375cdf0e10cSrcweir pGlobalShell = pSGlobalShell;
376cdf0e10cSrcweir bFlyMetafile = bSFlyMetafile;
377cdf0e10cSrcweir pFlyMetafileOut = pSFlyMetafileOut;
378cdf0e10cSrcweir pRetoucheFly = pSRetoucheFly;
379cdf0e10cSrcweir pRetoucheFly2 = pSRetoucheFly2;
380cdf0e10cSrcweir pFlyOnlyDraw = pSFlyOnlyDraw;
381cdf0e10cSrcweir pLines = pSLines;
382cdf0e10cSrcweir pSubsLines = pSSubsLines;
383cdf0e10cSrcweir // --> OD 2005-07-04 #123196#
384cdf0e10cSrcweir pSpecSubsLines = pSSpecSubsLines;
385cdf0e10cSrcweir // <--
386cdf0e10cSrcweir pProgress = pSProgress;
387cdf0e10cSrcweir nPixelSzW = nSPixelSzW;
388cdf0e10cSrcweir nPixelSzH = nSPixelSzH;
389cdf0e10cSrcweir nHalfPixelSzW = nSHalfPixelSzW;
390cdf0e10cSrcweir nHalfPixelSzH = nSHalfPixelSzH;
391cdf0e10cSrcweir nMinDistPixelW = nSMinDistPixelW;
392cdf0e10cSrcweir nMinDistPixelH = nSMinDistPixelH;
393cdf0e10cSrcweir aGlobalRetoucheColor = aSGlobalRetoucheColor;
394cdf0e10cSrcweir aScaleX = aSScaleX;
395cdf0e10cSrcweir aScaleY = aSScaleY;
396cdf0e10cSrcweir }
397cdf0e10cSrcweir
398cdf0e10cSrcweir //----------------- Implementierungen fuer Tabellenumrandung --------------
399cdf0e10cSrcweir
400cdf0e10cSrcweir SV_IMPL_VARARR( SwLRects, SwLineRect );
401cdf0e10cSrcweir
402cdf0e10cSrcweir
SwLineRect(const SwRect & rRect,const Color * pCol,const SwTabFrm * pT,const sal_uInt8 nSCol)403cdf0e10cSrcweir SwLineRect::SwLineRect( const SwRect &rRect, const Color *pCol,
404cdf0e10cSrcweir const SwTabFrm *pT, const sal_uInt8 nSCol ) :
405cdf0e10cSrcweir SwRect( rRect ),
406cdf0e10cSrcweir pColor( pCol ),
407cdf0e10cSrcweir pTab( pT ),
408cdf0e10cSrcweir nSubColor( nSCol ),
409cdf0e10cSrcweir bPainted( sal_False ),
410cdf0e10cSrcweir nLock( 0 )
411cdf0e10cSrcweir {
412cdf0e10cSrcweir }
413cdf0e10cSrcweir
MakeUnion(const SwRect & rRect)414cdf0e10cSrcweir sal_Bool SwLineRect::MakeUnion( const SwRect &rRect )
415cdf0e10cSrcweir {
416cdf0e10cSrcweir //Es wurde bereits ausserhalb geprueft, ob die Rechtecke die gleiche
417cdf0e10cSrcweir //Ausrichtung (horizontal bzw. vertikal), Farbe usw. besitzen.
418cdf0e10cSrcweir if ( Height() > Width() ) //Vertikale Linie
419cdf0e10cSrcweir {
420cdf0e10cSrcweir if ( Left() == rRect.Left() && Width() == rRect.Width() )
421cdf0e10cSrcweir {
422cdf0e10cSrcweir //Zusammenfassen wenn kein Luecke zwischen den Linien ist.
423cdf0e10cSrcweir const long nAdd = nPixelSzW + nHalfPixelSzW;
424cdf0e10cSrcweir if ( Bottom() + nAdd >= rRect.Top() &&
425cdf0e10cSrcweir Top() - nAdd <= rRect.Bottom() )
426cdf0e10cSrcweir {
427cdf0e10cSrcweir Bottom( Max( Bottom(), rRect.Bottom() ) );
428cdf0e10cSrcweir Top ( Min( Top(), rRect.Top() ) );
429cdf0e10cSrcweir return sal_True;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir }
432cdf0e10cSrcweir }
433cdf0e10cSrcweir else
434cdf0e10cSrcweir {
435cdf0e10cSrcweir if ( Top() == rRect.Top() && Height() == rRect.Height() )
436cdf0e10cSrcweir {
437cdf0e10cSrcweir //Zusammenfassen wenn kein Luecke zwischen den Linien ist.
438cdf0e10cSrcweir const long nAdd = nPixelSzW + nHalfPixelSzW;
439cdf0e10cSrcweir if ( Right() + nAdd >= rRect.Left() &&
440cdf0e10cSrcweir Left() - nAdd <= rRect.Right() )
441cdf0e10cSrcweir {
442cdf0e10cSrcweir Right( Max( Right(), rRect.Right() ) );
443cdf0e10cSrcweir Left ( Min( Left(), rRect.Left() ) );
444cdf0e10cSrcweir return sal_True;
445cdf0e10cSrcweir }
446cdf0e10cSrcweir }
447cdf0e10cSrcweir }
448cdf0e10cSrcweir return sal_False;
449cdf0e10cSrcweir }
450cdf0e10cSrcweir
AddLineRect(const SwRect & rRect,const Color * pCol,const SwTabFrm * pTab,const sal_uInt8 nSCol)451cdf0e10cSrcweir void SwLineRects::AddLineRect( const SwRect &rRect, const Color *pCol,
452cdf0e10cSrcweir const SwTabFrm *pTab, const sal_uInt8 nSCol )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir //Rueckwaerts durch, weil Linien die zusammengefasst werden koennen i.d.R.
455cdf0e10cSrcweir //im gleichen Kontext gepaintet werden.
456cdf0e10cSrcweir for ( sal_uInt16 i = Count(); i ; )
457cdf0e10cSrcweir {
458cdf0e10cSrcweir SwLineRect &rLRect = operator[](--i);
459cdf0e10cSrcweir //Pruefen von Ausrichtung, Farbe, Tabelle.
460cdf0e10cSrcweir if ( rLRect.GetTab() == pTab &&
461cdf0e10cSrcweir !rLRect.IsPainted() && rLRect.GetSubColor() == nSCol &&
462cdf0e10cSrcweir (rLRect.Height() > rLRect.Width()) == (rRect.Height() > rRect.Width()) &&
463cdf0e10cSrcweir ((!rLRect.GetColor() && !pCol) ||
464cdf0e10cSrcweir (rLRect.GetColor() && pCol && *rLRect.GetColor() == *pCol)) )
465cdf0e10cSrcweir {
466cdf0e10cSrcweir if ( rLRect.MakeUnion( rRect ) )
467cdf0e10cSrcweir return;
468cdf0e10cSrcweir }
469cdf0e10cSrcweir }
470cdf0e10cSrcweir Insert( SwLineRect( rRect, pCol, pTab, nSCol ), Count() );
471cdf0e10cSrcweir }
472cdf0e10cSrcweir
ConnectEdges(OutputDevice * pOut)473cdf0e10cSrcweir void SwLineRects::ConnectEdges( OutputDevice *pOut )
474cdf0e10cSrcweir {
475cdf0e10cSrcweir if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
476cdf0e10cSrcweir {
477cdf0e10cSrcweir //Fuer einen zu kleinen Zoom arbeite ich nicht.
478cdf0e10cSrcweir if ( aScaleX < aEdgeScale || aScaleY < aEdgeScale )
479cdf0e10cSrcweir return;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir
482cdf0e10cSrcweir static const long nAdd = 20;
483cdf0e10cSrcweir
484cdf0e10cSrcweir SvPtrarr aCheck( 64, 64 );
485cdf0e10cSrcweir
486cdf0e10cSrcweir for ( int i = 0; i < (int)Count(); ++i )
487cdf0e10cSrcweir {
488cdf0e10cSrcweir SwLineRect &rL1 = operator[](sal_uInt16(i));
489cdf0e10cSrcweir if ( !rL1.GetTab() || rL1.IsPainted() || rL1.IsLocked() )
490cdf0e10cSrcweir continue;
491cdf0e10cSrcweir
492cdf0e10cSrcweir aCheck.Remove( 0, aCheck.Count() );
493cdf0e10cSrcweir
494cdf0e10cSrcweir const sal_Bool bVert = rL1.Height() > rL1.Width();
495cdf0e10cSrcweir long nL1a, nL1b, nL1c, nL1d;
496cdf0e10cSrcweir
497cdf0e10cSrcweir if ( bVert )
498cdf0e10cSrcweir {
499cdf0e10cSrcweir nL1a = rL1.Top(); nL1b = rL1.Left();
500cdf0e10cSrcweir nL1c = rL1.Right(); nL1d = rL1.Bottom();
501cdf0e10cSrcweir }
502cdf0e10cSrcweir else
503cdf0e10cSrcweir {
504cdf0e10cSrcweir nL1a = rL1.Left(); nL1b = rL1.Top();
505cdf0e10cSrcweir nL1c = rL1.Bottom(); nL1d = rL1.Right();
506cdf0e10cSrcweir }
507cdf0e10cSrcweir
508cdf0e10cSrcweir //Alle moeglicherweise mit i1 zu verbindenden Linien einsammeln.
509cdf0e10cSrcweir for ( sal_uInt16 i2 = 0; i2 < Count(); ++i2 )
510cdf0e10cSrcweir {
511cdf0e10cSrcweir SwLineRect &rL2 = operator[](i2);
512cdf0e10cSrcweir if ( rL2.GetTab() != rL1.GetTab() ||
513cdf0e10cSrcweir rL2.IsPainted() ||
514cdf0e10cSrcweir rL2.IsLocked() ||
515cdf0e10cSrcweir (bVert == (rL2.Height() > rL2.Width())) )
516cdf0e10cSrcweir continue;
517cdf0e10cSrcweir
518cdf0e10cSrcweir long nL2a, nL2b, nL2c, nL2d;
519cdf0e10cSrcweir if ( bVert )
520cdf0e10cSrcweir {
521cdf0e10cSrcweir nL2a = rL2.Top(); nL2b = rL2.Left();
522cdf0e10cSrcweir nL2c = rL2.Right(); nL2d = rL2.Bottom();
523cdf0e10cSrcweir }
524cdf0e10cSrcweir else
525cdf0e10cSrcweir {
526cdf0e10cSrcweir nL2a = rL2.Left(); nL2b = rL2.Top();
527cdf0e10cSrcweir nL2c = rL2.Bottom(); nL2d = rL2.Right();
528cdf0e10cSrcweir }
529cdf0e10cSrcweir
530cdf0e10cSrcweir if ( (nL1a - nAdd < nL2d && nL1d + nAdd > nL2a) &&
531cdf0e10cSrcweir ((nL1b > nL2b && nL1c < nL2c) ||
532cdf0e10cSrcweir (nL1c >= nL2c && nL1b - nAdd < nL2c) ||
533cdf0e10cSrcweir (nL1b <= nL2b && nL1c + nAdd > nL2b)) )
534cdf0e10cSrcweir {
535cdf0e10cSrcweir SwLineRect *pMSC = &rL2;
536cdf0e10cSrcweir aCheck.Insert( pMSC, aCheck.Count() );
537cdf0e10cSrcweir }
538cdf0e10cSrcweir }
539cdf0e10cSrcweir if ( aCheck.Count() < 2 )
540cdf0e10cSrcweir continue;
541cdf0e10cSrcweir
542cdf0e10cSrcweir sal_Bool bRemove = sal_False;
543cdf0e10cSrcweir
544cdf0e10cSrcweir //Fuer jede Linie jede alle folgenden checken.
545cdf0e10cSrcweir for ( sal_uInt16 k = 0; !bRemove && k < aCheck.Count(); ++k )
546cdf0e10cSrcweir {
547cdf0e10cSrcweir SwLineRect &rR1 = (SwLineRect&)*(SwLineRect*)aCheck[k];
548cdf0e10cSrcweir
549cdf0e10cSrcweir for ( sal_uInt16 k2 = k+1; !bRemove && k2 < aCheck.Count(); ++k2 )
550cdf0e10cSrcweir {
551cdf0e10cSrcweir SwLineRect &rR2 = (SwLineRect&)*(SwLineRect*)aCheck[k2];
552cdf0e10cSrcweir if ( bVert )
553cdf0e10cSrcweir {
554cdf0e10cSrcweir SwLineRect *pLA = 0;
555cdf0e10cSrcweir SwLineRect *pLB = 0;
556cdf0e10cSrcweir if ( rR1.Top() < rR2.Top() )
557cdf0e10cSrcweir {
558cdf0e10cSrcweir pLA = &rR1; pLB = &rR2;
559cdf0e10cSrcweir }
560cdf0e10cSrcweir else if ( rR1.Top() > rR2.Top() )
561cdf0e10cSrcweir {
562cdf0e10cSrcweir pLA = &rR2; pLB = &rR1;
563cdf0e10cSrcweir }
564cdf0e10cSrcweir //beschreiben k1 und k2 eine Doppellinie?
565cdf0e10cSrcweir if ( pLA && pLA->Bottom() + 60 > pLB->Top() )
566cdf0e10cSrcweir {
567cdf0e10cSrcweir if ( rL1.Top() < pLA->Top() )
568cdf0e10cSrcweir {
569cdf0e10cSrcweir if ( rL1.Bottom() == pLA->Bottom() )
570cdf0e10cSrcweir continue; //kleiner Irrtum (woher?)
571cdf0e10cSrcweir
572cdf0e10cSrcweir SwRect aIns( rL1 );
573cdf0e10cSrcweir aIns.Bottom( pLA->Bottom() );
574cdf0e10cSrcweir if ( !rL1.IsInside( aIns ) )
575cdf0e10cSrcweir continue;
576cdf0e10cSrcweir const sal_uInt16 nTmpFree = Free();
577cdf0e10cSrcweir Insert( SwLineRect( aIns, rL1.GetColor(),
578cdf0e10cSrcweir rL1.GetTab(), SUBCOL_TAB ), Count() );
579cdf0e10cSrcweir if ( !nTmpFree )
580cdf0e10cSrcweir {
581cdf0e10cSrcweir --i;
582cdf0e10cSrcweir k = aCheck.Count();
583cdf0e10cSrcweir break;
584cdf0e10cSrcweir }
585cdf0e10cSrcweir }
586cdf0e10cSrcweir
587cdf0e10cSrcweir if ( rL1.Bottom() > pLB->Bottom() )
588cdf0e10cSrcweir rL1.Top( pLB->Top() ); //i1 nach oben verlaengern
589cdf0e10cSrcweir else
590cdf0e10cSrcweir bRemove = sal_True; //abbrechen, i1 entfernen
591cdf0e10cSrcweir }
592cdf0e10cSrcweir }
593cdf0e10cSrcweir else
594cdf0e10cSrcweir {
595cdf0e10cSrcweir SwLineRect *pLA = 0;
596cdf0e10cSrcweir SwLineRect *pLB = 0;
597cdf0e10cSrcweir if ( rR1.Left() < rR2.Left() )
598cdf0e10cSrcweir {
599cdf0e10cSrcweir pLA = &rR1; pLB = &rR2;
600cdf0e10cSrcweir }
601cdf0e10cSrcweir else if ( rR1.Left() > rR2.Left() )
602cdf0e10cSrcweir {
603cdf0e10cSrcweir pLA = &rR2; pLB = &rR1;
604cdf0e10cSrcweir }
605cdf0e10cSrcweir //Liegt eine 'doppellinie' vor?
606cdf0e10cSrcweir if ( pLA && pLA->Right() + 60 > pLB->Left() )
607cdf0e10cSrcweir {
608cdf0e10cSrcweir if ( rL1.Left() < pLA->Left() )
609cdf0e10cSrcweir {
610cdf0e10cSrcweir if ( rL1.Right() == pLA->Right() )
611cdf0e10cSrcweir continue; //kleiner irrtum
612cdf0e10cSrcweir
613cdf0e10cSrcweir SwRect aIns( rL1 );
614cdf0e10cSrcweir aIns.Right( pLA->Right() );
615cdf0e10cSrcweir if ( !rL1.IsInside( aIns ) )
616cdf0e10cSrcweir continue;
617cdf0e10cSrcweir const sal_uInt16 nTmpFree = Free();
618cdf0e10cSrcweir Insert( SwLineRect( aIns, rL1.GetColor(),
619cdf0e10cSrcweir rL1.GetTab(), SUBCOL_TAB ), Count() );
620cdf0e10cSrcweir if ( !nTmpFree )
621cdf0e10cSrcweir {
622cdf0e10cSrcweir --i;
623cdf0e10cSrcweir k = aCheck.Count();
624cdf0e10cSrcweir break;
625cdf0e10cSrcweir }
626cdf0e10cSrcweir }
627cdf0e10cSrcweir if ( rL1.Right() > pLB->Right() )
628cdf0e10cSrcweir rL1.Left( pLB->Left() );
629cdf0e10cSrcweir else
630cdf0e10cSrcweir bRemove = sal_True;
631cdf0e10cSrcweir }
632cdf0e10cSrcweir }
633cdf0e10cSrcweir }
634cdf0e10cSrcweir }
635cdf0e10cSrcweir if ( bRemove )
636cdf0e10cSrcweir {
637cdf0e10cSrcweir Remove( static_cast<sal_uInt16>(i), 1 );
638cdf0e10cSrcweir --i; //keinen auslassen!
639cdf0e10cSrcweir }
640cdf0e10cSrcweir }
641cdf0e10cSrcweir }
642cdf0e10cSrcweir
Ins(const SwRect & rRect,const sal_uInt8 nSCol)643cdf0e10cSrcweir inline void SwSubsRects::Ins( const SwRect &rRect, const sal_uInt8 nSCol )
644cdf0e10cSrcweir {
645cdf0e10cSrcweir //Linien die kuerzer als die breiteste Linienbreite sind werden
646cdf0e10cSrcweir //nicht aufgenommen.
647cdf0e10cSrcweir if ( rRect.Height() > DEF_LINE_WIDTH_4 || rRect.Width() > DEF_LINE_WIDTH_4 )
648cdf0e10cSrcweir Insert( SwLineRect( rRect, 0, 0, nSCol ), Count());
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
RemoveSuperfluousSubsidiaryLines(const SwLineRects & rRects)651cdf0e10cSrcweir void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
652cdf0e10cSrcweir {
653cdf0e10cSrcweir //Alle Hilfslinien, die sich mit irgendwelchen Umrandungen decken werden
654cdf0e10cSrcweir //entfernt bzw. zerstueckelt..
655cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < Count(); ++i )
656cdf0e10cSrcweir {
657cdf0e10cSrcweir // OD 18.11.2002 #99672# - get a copy instead of a reference, because
658cdf0e10cSrcweir // an <insert> may destroy the object due to a necessary array resize.
659cdf0e10cSrcweir const SwLineRect aSubsLineRect = SwLineRect( operator[](i) );
660cdf0e10cSrcweir
661cdf0e10cSrcweir // OD 19.12.2002 #106318# - add condition <aSubsLineRect.IsLocked()>
662cdf0e10cSrcweir // in order to consider only border lines, which are *not* locked.
663cdf0e10cSrcweir if ( aSubsLineRect.IsPainted() ||
664cdf0e10cSrcweir aSubsLineRect.IsLocked() )
665cdf0e10cSrcweir continue;
666cdf0e10cSrcweir
667cdf0e10cSrcweir const bool bVerticalSubs = aSubsLineRect.Height() > aSubsLineRect.Width();
668cdf0e10cSrcweir SwRect aSubsRect( aSubsLineRect );
669cdf0e10cSrcweir if ( bVerticalSubs )
670cdf0e10cSrcweir {
671cdf0e10cSrcweir aSubsRect.Left ( aSubsRect.Left() - (nPixelSzW+nHalfPixelSzW) );
672cdf0e10cSrcweir aSubsRect.Right ( aSubsRect.Right() + (nPixelSzW+nHalfPixelSzW) );
673cdf0e10cSrcweir }
674cdf0e10cSrcweir else
675cdf0e10cSrcweir {
676cdf0e10cSrcweir aSubsRect.Top ( aSubsRect.Top() - (nPixelSzH+nHalfPixelSzH) );
677cdf0e10cSrcweir aSubsRect.Bottom( aSubsRect.Bottom() + (nPixelSzH+nHalfPixelSzH) );
678cdf0e10cSrcweir }
679cdf0e10cSrcweir for ( sal_uInt16 k = 0; k < rRects.Count(); ++k )
680cdf0e10cSrcweir {
681cdf0e10cSrcweir SwLineRect &rLine = rRects[k];
682cdf0e10cSrcweir
683cdf0e10cSrcweir // OD 20.12.2002 #106318# - do *not* consider painted or locked
684cdf0e10cSrcweir // border lines.
685cdf0e10cSrcweir // OD 20.01.2003 #i1837# - locked border lines have to be considered.
686cdf0e10cSrcweir if ( rLine.IsLocked () )
687cdf0e10cSrcweir continue;
688cdf0e10cSrcweir
689cdf0e10cSrcweir if ( (!bVerticalSubs == (rLine.Height() > rLine.Width())) ) //gleiche Ausrichtung?
690cdf0e10cSrcweir continue;
691cdf0e10cSrcweir
692cdf0e10cSrcweir if ( aSubsRect.IsOver( rLine ) )
693cdf0e10cSrcweir {
694cdf0e10cSrcweir if ( bVerticalSubs ) //Vertikal?
695cdf0e10cSrcweir {
696cdf0e10cSrcweir if ( aSubsRect.Left() <= rLine.Right() &&
697cdf0e10cSrcweir aSubsRect.Right() >= rLine.Left() )
698cdf0e10cSrcweir {
699cdf0e10cSrcweir long nTmp = rLine.Top()-(nPixelSzH+1);
700cdf0e10cSrcweir if ( aSubsLineRect.Top() < nTmp )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir SwRect aNewSubsRect( aSubsLineRect );
703cdf0e10cSrcweir aNewSubsRect.Bottom( nTmp );
704cdf0e10cSrcweir Insert( SwLineRect( aNewSubsRect, 0, 0,
705cdf0e10cSrcweir aSubsLineRect.GetSubColor() ), Count());
706cdf0e10cSrcweir }
707cdf0e10cSrcweir nTmp = rLine.Bottom()+nPixelSzH+1;
708cdf0e10cSrcweir if ( aSubsLineRect.Bottom() > nTmp )
709cdf0e10cSrcweir {
710cdf0e10cSrcweir SwRect aNewSubsRect( aSubsLineRect );
711cdf0e10cSrcweir aNewSubsRect.Top( nTmp );
712cdf0e10cSrcweir Insert( SwLineRect( aNewSubsRect, 0, 0,
713cdf0e10cSrcweir aSubsLineRect.GetSubColor() ), Count());
714cdf0e10cSrcweir }
715cdf0e10cSrcweir Remove( i, 1 );
716cdf0e10cSrcweir --i;
717cdf0e10cSrcweir break;
718cdf0e10cSrcweir }
719cdf0e10cSrcweir }
720cdf0e10cSrcweir else //Horizontal
721cdf0e10cSrcweir {
722cdf0e10cSrcweir if ( aSubsRect.Top() <= rLine.Bottom() &&
723cdf0e10cSrcweir aSubsRect.Bottom() >= rLine.Top() )
724cdf0e10cSrcweir {
725cdf0e10cSrcweir long nTmp = rLine.Left()-(nPixelSzW+1);
726cdf0e10cSrcweir if ( aSubsLineRect.Left() < nTmp )
727cdf0e10cSrcweir {
728cdf0e10cSrcweir SwRect aNewSubsRect( aSubsLineRect );
729cdf0e10cSrcweir aNewSubsRect.Right( nTmp );
730cdf0e10cSrcweir Insert( SwLineRect( aNewSubsRect, 0, 0,
731cdf0e10cSrcweir aSubsLineRect.GetSubColor() ), Count());
732cdf0e10cSrcweir }
733cdf0e10cSrcweir nTmp = rLine.Right()+nPixelSzW+1;
734cdf0e10cSrcweir if ( aSubsLineRect.Right() > nTmp )
735cdf0e10cSrcweir {
736cdf0e10cSrcweir SwRect aNewSubsRect( aSubsLineRect );
737cdf0e10cSrcweir aNewSubsRect.Left( nTmp );
738cdf0e10cSrcweir Insert( SwLineRect( aNewSubsRect, 0, 0,
739cdf0e10cSrcweir aSubsLineRect.GetSubColor() ), Count());
740cdf0e10cSrcweir }
741cdf0e10cSrcweir Remove( i, 1 );
742cdf0e10cSrcweir --i;
743cdf0e10cSrcweir break;
744cdf0e10cSrcweir }
745cdf0e10cSrcweir }
746cdf0e10cSrcweir }
747cdf0e10cSrcweir }
748cdf0e10cSrcweir }
749cdf0e10cSrcweir }
750cdf0e10cSrcweir
LockLines(sal_Bool bLock)751cdf0e10cSrcweir void SwLineRects::LockLines( sal_Bool bLock )
752cdf0e10cSrcweir {
753cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < Count(); ++i )
754cdf0e10cSrcweir operator[](i).Lock( bLock );
755cdf0e10cSrcweir }
756cdf0e10cSrcweir
PaintLines(OutputDevice * pOut)757cdf0e10cSrcweir void SwLineRects::PaintLines( OutputDevice *pOut )
758cdf0e10cSrcweir {
759cdf0e10cSrcweir //Painten der Umrandungen. Leider muessen wir zweimal durch.
760cdf0e10cSrcweir //Einmal fuer die innenliegenden und einmal fuer die Aussenkanten
761cdf0e10cSrcweir //der Tabellen.
762cdf0e10cSrcweir if ( Count() != nLastCount )
763cdf0e10cSrcweir {
764cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
765cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
766cdf0e10cSrcweir // <--
767cdf0e10cSrcweir
768cdf0e10cSrcweir // OD 2004-04-23 #116347#
769cdf0e10cSrcweir pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
770cdf0e10cSrcweir pOut->SetLineColor();
771cdf0e10cSrcweir ConnectEdges( pOut );
772cdf0e10cSrcweir const Color *pLast = 0;
773cdf0e10cSrcweir
774cdf0e10cSrcweir sal_Bool bPaint2nd = sal_False;
775cdf0e10cSrcweir sal_uInt16 nMinCount = Count();
776cdf0e10cSrcweir sal_uInt16 i;
777cdf0e10cSrcweir
778cdf0e10cSrcweir for ( i = 0; i < Count(); ++i )
779cdf0e10cSrcweir {
780cdf0e10cSrcweir SwLineRect &rLRect = operator[](i);
781cdf0e10cSrcweir
782cdf0e10cSrcweir if ( rLRect.IsPainted() )
783cdf0e10cSrcweir continue;
784cdf0e10cSrcweir
785cdf0e10cSrcweir if ( rLRect.IsLocked() )
786cdf0e10cSrcweir {
787cdf0e10cSrcweir nMinCount = Min( nMinCount, i );
788cdf0e10cSrcweir continue;
789cdf0e10cSrcweir }
790cdf0e10cSrcweir
791cdf0e10cSrcweir //Jetzt malen oder erst in der zweiten Runde?
792cdf0e10cSrcweir sal_Bool bPaint = sal_True;
793cdf0e10cSrcweir if ( rLRect.GetTab() )
794cdf0e10cSrcweir {
795cdf0e10cSrcweir if ( rLRect.Height() > rLRect.Width() )
796cdf0e10cSrcweir {
797cdf0e10cSrcweir //Senkrechte Kante, ueberlappt sie mit der TabellenKante?
798cdf0e10cSrcweir SwTwips nLLeft = rLRect.Left() - 30,
799cdf0e10cSrcweir nLRight = rLRect.Right() + 30,
800cdf0e10cSrcweir nTLeft = rLRect.GetTab()->Frm().Left() + rLRect.GetTab()->Prt().Left(),
801cdf0e10cSrcweir nTRight = rLRect.GetTab()->Frm().Left() + rLRect.GetTab()->Prt().Right();
802cdf0e10cSrcweir if ( (nTLeft >= nLLeft && nTLeft <= nLRight) ||
803cdf0e10cSrcweir (nTRight>= nLLeft && nTRight<= nLRight) )
804cdf0e10cSrcweir bPaint = sal_False;
805cdf0e10cSrcweir }
806cdf0e10cSrcweir else
807cdf0e10cSrcweir { //Waagerechte Kante, ueberlappt sie mit der Tabellenkante?
808cdf0e10cSrcweir SwTwips nLTop = rLRect.Top() - 30,
809cdf0e10cSrcweir nLBottom = rLRect.Bottom() + 30,
810cdf0e10cSrcweir nTTop = rLRect.GetTab()->Frm().Top() + rLRect.GetTab()->Prt().Top(),
811cdf0e10cSrcweir nTBottom = rLRect.GetTab()->Frm().Top() + rLRect.GetTab()->Prt().Bottom();
812cdf0e10cSrcweir if ( (nTTop >= nLTop && nTTop <= nLBottom) ||
813cdf0e10cSrcweir (nTBottom >= nLTop && nTBottom <= nLBottom) )
814cdf0e10cSrcweir bPaint = sal_False;
815cdf0e10cSrcweir }
816cdf0e10cSrcweir }
817cdf0e10cSrcweir if ( bPaint )
818cdf0e10cSrcweir {
819cdf0e10cSrcweir if ( !pLast || *pLast != *rLRect.GetColor() )
820cdf0e10cSrcweir {
821cdf0e10cSrcweir pLast = rLRect.GetColor();
822cdf0e10cSrcweir
823cdf0e10cSrcweir sal_uLong nOldDrawMode = pOut->GetDrawMode();
824cdf0e10cSrcweir if( pGlobalShell->GetWin() &&
825cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
826cdf0e10cSrcweir pOut->SetDrawMode( 0 );
827cdf0e10cSrcweir
828cdf0e10cSrcweir pOut->SetFillColor( *pLast );
829cdf0e10cSrcweir pOut->SetDrawMode( nOldDrawMode );
830cdf0e10cSrcweir }
831cdf0e10cSrcweir if( !rLRect.IsEmpty() )
832cdf0e10cSrcweir pOut->DrawRect( rLRect.SVRect() );
833cdf0e10cSrcweir rLRect.SetPainted();
834cdf0e10cSrcweir }
835cdf0e10cSrcweir else
836cdf0e10cSrcweir bPaint2nd = sal_True;
837cdf0e10cSrcweir }
838cdf0e10cSrcweir if ( bPaint2nd )
839cdf0e10cSrcweir for ( i = 0; i < Count(); ++i )
840cdf0e10cSrcweir {
841cdf0e10cSrcweir SwLineRect &rLRect = operator[](i);
842cdf0e10cSrcweir if ( rLRect.IsPainted() )
843cdf0e10cSrcweir continue;
844cdf0e10cSrcweir
845cdf0e10cSrcweir if ( rLRect.IsLocked() )
846cdf0e10cSrcweir {
847cdf0e10cSrcweir nMinCount = Min( nMinCount, i );
848cdf0e10cSrcweir continue;
849cdf0e10cSrcweir }
850cdf0e10cSrcweir
851cdf0e10cSrcweir if ( !pLast || *pLast != *rLRect.GetColor() )
852cdf0e10cSrcweir {
853cdf0e10cSrcweir pLast = rLRect.GetColor();
854cdf0e10cSrcweir
855cdf0e10cSrcweir sal_uLong nOldDrawMode = pOut->GetDrawMode();
856cdf0e10cSrcweir if( pGlobalShell->GetWin() &&
857cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
858cdf0e10cSrcweir {
859cdf0e10cSrcweir pOut->SetDrawMode( 0 );
860cdf0e10cSrcweir }
861cdf0e10cSrcweir
862cdf0e10cSrcweir pOut->SetFillColor( *pLast );
863cdf0e10cSrcweir pOut->SetDrawMode( nOldDrawMode );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir if( !rLRect.IsEmpty() )
866cdf0e10cSrcweir pOut->DrawRect( rLRect.SVRect() );
867cdf0e10cSrcweir rLRect.SetPainted();
868cdf0e10cSrcweir }
869cdf0e10cSrcweir nLastCount = nMinCount;
870cdf0e10cSrcweir pOut->Pop();
871cdf0e10cSrcweir }
872cdf0e10cSrcweir }
873cdf0e10cSrcweir
PaintSubsidiary(OutputDevice * pOut,const SwLineRects * pRects)874cdf0e10cSrcweir void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
875cdf0e10cSrcweir const SwLineRects *pRects )
876cdf0e10cSrcweir {
877cdf0e10cSrcweir if ( Count() )
878cdf0e10cSrcweir {
879cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
880cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
881cdf0e10cSrcweir // <--
882cdf0e10cSrcweir
883cdf0e10cSrcweir //Alle Hilfslinien, die sich fast decken entfernen (Tabellen)
884cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < Count(); ++i )
885cdf0e10cSrcweir {
886cdf0e10cSrcweir SwLineRect &rLi = operator[](i);
887cdf0e10cSrcweir const bool bVerticalSubs = rLi.Height() > rLi.Width();
888cdf0e10cSrcweir
889cdf0e10cSrcweir for ( sal_uInt16 k = i+1; k < Count(); ++k )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir SwLineRect &rLk = operator[](k);
892cdf0e10cSrcweir if ( rLi.SSize() == rLk.SSize() )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir if ( (bVerticalSubs == (rLk.Height() > rLk.Width())) )
895cdf0e10cSrcweir {
896cdf0e10cSrcweir if ( bVerticalSubs )
897cdf0e10cSrcweir {
898cdf0e10cSrcweir long nLi = rLi.Right();
899cdf0e10cSrcweir long nLk = rLk.Right();
900cdf0e10cSrcweir if ( rLi.Top() == rLk.Top() &&
901cdf0e10cSrcweir ((nLi < rLk.Left() && nLi+21 > rLk.Left()) ||
902cdf0e10cSrcweir (nLk < rLi.Left() && nLk+21 > rLi.Left())))
903cdf0e10cSrcweir {
904cdf0e10cSrcweir Remove( k, 1 );
905cdf0e10cSrcweir //Nicht mit der inneren Schleife weiter, weil
906cdf0e10cSrcweir //das Array schrumpfen koennte!
907cdf0e10cSrcweir --i; k = Count();
908cdf0e10cSrcweir }
909cdf0e10cSrcweir }
910cdf0e10cSrcweir else
911cdf0e10cSrcweir {
912cdf0e10cSrcweir long nLi = rLi.Bottom();
913cdf0e10cSrcweir long nLk = rLk.Bottom();
914cdf0e10cSrcweir if ( rLi.Left() == rLk.Left() &&
915cdf0e10cSrcweir ((nLi < rLk.Top() && nLi+21 > rLk.Top()) ||
916cdf0e10cSrcweir (nLk < rLi.Top() && nLk+21 > rLi.Top())))
917cdf0e10cSrcweir {
918cdf0e10cSrcweir Remove( k, 1 );
919cdf0e10cSrcweir --i; k = Count();
920cdf0e10cSrcweir }
921cdf0e10cSrcweir }
922cdf0e10cSrcweir }
923cdf0e10cSrcweir }
924cdf0e10cSrcweir }
925cdf0e10cSrcweir }
926cdf0e10cSrcweir
927cdf0e10cSrcweir
928cdf0e10cSrcweir if ( pRects && pRects->Count() )
929cdf0e10cSrcweir RemoveSuperfluousSubsidiaryLines( *pRects );
930cdf0e10cSrcweir
931cdf0e10cSrcweir if ( Count() )
932cdf0e10cSrcweir {
933cdf0e10cSrcweir // OD 2004-04-23 #116347#
934cdf0e10cSrcweir pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
935cdf0e10cSrcweir pOut->SetLineColor();
936cdf0e10cSrcweir
937cdf0e10cSrcweir // OD 14.01.2003 #106660# - reset draw mode in high contrast
938cdf0e10cSrcweir // mode in order to get fill color set at output device.
939cdf0e10cSrcweir // Recover draw mode after draw of lines.
940cdf0e10cSrcweir // Necessary for the subsidiary lines painted by the fly frames.
941cdf0e10cSrcweir sal_uLong nOldDrawMode = pOut->GetDrawMode();
942cdf0e10cSrcweir if( pGlobalShell->GetWin() &&
943cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
944cdf0e10cSrcweir {
945cdf0e10cSrcweir pOut->SetDrawMode( 0 );
946cdf0e10cSrcweir }
947cdf0e10cSrcweir
948cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < Count(); ++i )
949cdf0e10cSrcweir {
950cdf0e10cSrcweir SwLineRect &rLRect = operator[](i);
951cdf0e10cSrcweir // OD 19.12.2002 #106318# - add condition <!rLRect.IsLocked()>
952cdf0e10cSrcweir // to prevent paint of locked subsidiary lines.
953cdf0e10cSrcweir if ( !rLRect.IsPainted() &&
954cdf0e10cSrcweir !rLRect.IsLocked() )
955cdf0e10cSrcweir {
956cdf0e10cSrcweir const Color *pCol = 0;
957cdf0e10cSrcweir switch ( rLRect.GetSubColor() )
958cdf0e10cSrcweir {
959cdf0e10cSrcweir case SUBCOL_PAGE: pCol = &SwViewOption::GetDocBoundariesColor(); break;
960cdf0e10cSrcweir case SUBCOL_FLY: pCol = &SwViewOption::GetObjectBoundariesColor(); break;
961cdf0e10cSrcweir case SUBCOL_TAB: pCol = &SwViewOption::GetTableBoundariesColor(); break;
962cdf0e10cSrcweir case SUBCOL_SECT: pCol = &SwViewOption::GetSectionBoundColor(); break;
963cdf0e10cSrcweir case SUBCOL_BREAK: pCol = &SwViewOption::GetPageBreakColor(); break;
964cdf0e10cSrcweir }
965cdf0e10cSrcweir
966cdf0e10cSrcweir if ( pOut->GetFillColor() != *pCol )
967cdf0e10cSrcweir pOut->SetFillColor( *pCol );
968cdf0e10cSrcweir pOut->DrawRect( rLRect.SVRect() );
969cdf0e10cSrcweir
970cdf0e10cSrcweir rLRect.SetPainted();
971cdf0e10cSrcweir }
972cdf0e10cSrcweir }
973cdf0e10cSrcweir
974cdf0e10cSrcweir // OD 14.01.2003 #106660# - recovering draw mode
975cdf0e10cSrcweir pOut->SetDrawMode( nOldDrawMode );
976cdf0e10cSrcweir
977cdf0e10cSrcweir pOut->Pop();
978cdf0e10cSrcweir }
979cdf0e10cSrcweir }
980cdf0e10cSrcweir }
981cdf0e10cSrcweir
982cdf0e10cSrcweir //-------------------------------------------------------------------------
983cdf0e10cSrcweir //Diverse Functions die in diesem File so verwendet werden.
984cdf0e10cSrcweir
985cdf0e10cSrcweir // OD 20.02.2003 - Note: function <SwAlignRect(..)> also used outside this file.
986cdf0e10cSrcweir // OD 29.04.2003 #107169# - correction: adjust rectangle on pixel level in order
987cdf0e10cSrcweir // to assure, that the border 'leaves its original pixel', if it has to.
988cdf0e10cSrcweir // No prior adjustments for odd relation between pixel and twip.
SwAlignRect(SwRect & rRect,ViewShell * pSh)989cdf0e10cSrcweir void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh )
990cdf0e10cSrcweir {
991cdf0e10cSrcweir if( !rRect.HasArea() )
992cdf0e10cSrcweir return;
993cdf0e10cSrcweir
994cdf0e10cSrcweir // OD 03.09.2002 #102450#
995cdf0e10cSrcweir // Assure that view shell (parameter <pSh>) exists, if the output device
996cdf0e10cSrcweir // is taken from this view shell --> no output device, no alignment.
997cdf0e10cSrcweir // Output device taken from view shell <pSh>, if <bFlyMetafile> not set.
998cdf0e10cSrcweir if ( !bFlyMetafile && !pSh )
999cdf0e10cSrcweir {
1000cdf0e10cSrcweir return;
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir
1003cdf0e10cSrcweir const OutputDevice *pOut = bFlyMetafile ?
1004cdf0e10cSrcweir pFlyMetafileOut : pSh->GetOut();
1005cdf0e10cSrcweir
1006cdf0e10cSrcweir // OD 28.04.2003 #107169# - hold original rectangle in pixel
1007cdf0e10cSrcweir const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() );
1008cdf0e10cSrcweir // OD 29.04.2003 #107169# - determine pixel-center rectangle in twip
1009cdf0e10cSrcweir const SwRect aPxCenterRect( pOut->PixelToLogic( aOrgPxRect ) );
1010cdf0e10cSrcweir
1011cdf0e10cSrcweir // OD 06.05.2003 #107169# - perform adjustments on pixel level.
1012cdf0e10cSrcweir SwRect aAlignedPxRect( aOrgPxRect );
1013cdf0e10cSrcweir if ( rRect.Top() > aPxCenterRect.Top() )
1014cdf0e10cSrcweir {
1015cdf0e10cSrcweir // 'leave pixel overlapping on top'
1016cdf0e10cSrcweir aAlignedPxRect.Top( aAlignedPxRect.Top() + 1 );
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir
1019cdf0e10cSrcweir if ( rRect.Bottom() < aPxCenterRect.Bottom() )
1020cdf0e10cSrcweir {
1021cdf0e10cSrcweir // 'leave pixel overlapping on bottom'
1022cdf0e10cSrcweir aAlignedPxRect.Bottom( aAlignedPxRect.Bottom() - 1 );
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir
1025cdf0e10cSrcweir if ( rRect.Left() > aPxCenterRect.Left() )
1026cdf0e10cSrcweir {
1027cdf0e10cSrcweir // 'leave pixel overlapping on left'
1028cdf0e10cSrcweir aAlignedPxRect.Left( aAlignedPxRect.Left() + 1 );
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir
1031cdf0e10cSrcweir if ( rRect.Right() < aPxCenterRect.Right() )
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir // 'leave pixel overlapping on right'
1034cdf0e10cSrcweir aAlignedPxRect.Right( aAlignedPxRect.Right() - 1 );
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir
1037cdf0e10cSrcweir // OD 11.10.2002 #103636# - consider negative width/height
1038cdf0e10cSrcweir // check, if aligned SwRect has negative width/height.
1039cdf0e10cSrcweir // If Yes, adjust it to width/height = 0 twip.
1040cdf0e10cSrcweir // NOTE: A SwRect with negative width/height can occur, if the width/height
1041cdf0e10cSrcweir // of the given SwRect in twip was less than a pixel in twip and that
1042cdf0e10cSrcweir // the alignment calculates that the aligned SwRect should not contain
1043cdf0e10cSrcweir // the pixels the width/height is on.
1044cdf0e10cSrcweir if ( aAlignedPxRect.Width() < 0 )
1045cdf0e10cSrcweir {
1046cdf0e10cSrcweir aAlignedPxRect.Width(0);
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir if ( aAlignedPxRect.Height() < 0 )
1049cdf0e10cSrcweir {
1050cdf0e10cSrcweir aAlignedPxRect.Height(0);
1051cdf0e10cSrcweir }
1052cdf0e10cSrcweir // OD 30.04.2003 #107169# - consider zero width/height
1053cdf0e10cSrcweir // For converting a rectangle from pixel to logic it needs a width/height.
1054cdf0e10cSrcweir // Thus, set width/height to one, if it's zero and correct this on the twip
1055cdf0e10cSrcweir // level after the conversion.
1056cdf0e10cSrcweir sal_Bool bZeroWidth = sal_False;
1057cdf0e10cSrcweir if ( aAlignedPxRect.Width() == 0 )
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir aAlignedPxRect.Width(1);
1060cdf0e10cSrcweir bZeroWidth = sal_True;
1061cdf0e10cSrcweir }
1062cdf0e10cSrcweir sal_Bool bZeroHeight = sal_False;
1063cdf0e10cSrcweir if ( aAlignedPxRect.Height() == 0 )
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir aAlignedPxRect.Height(1);
1066cdf0e10cSrcweir bZeroHeight = sal_True;
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir
1069cdf0e10cSrcweir rRect = pOut->PixelToLogic( aAlignedPxRect.SVRect() );
1070cdf0e10cSrcweir
1071cdf0e10cSrcweir // OD 30.04.2003 #107169# - consider zero width/height and adjust calculated
1072cdf0e10cSrcweir // aligned twip rectangle.
1073cdf0e10cSrcweir // OD 19.05.2003 #109667# - reset width/height to zero; previous negative
1074cdf0e10cSrcweir // width/height haven't to be considered.
1075cdf0e10cSrcweir if ( bZeroWidth )
1076cdf0e10cSrcweir {
1077cdf0e10cSrcweir rRect.Width(0);
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir if ( bZeroHeight )
1080cdf0e10cSrcweir {
1081cdf0e10cSrcweir rRect.Height(0);
1082cdf0e10cSrcweir }
1083cdf0e10cSrcweir }
1084cdf0e10cSrcweir
1085cdf0e10cSrcweir /** OD 19.05.2003 #109667# - helper method for twip adjustments on pixel base
1086cdf0e10cSrcweir
1087cdf0e10cSrcweir method compares the x- or y-pixel position of two twip-point. If the x-/y-pixel
1088cdf0e10cSrcweir positions are the same, the x-/y-pixel position of the second twip point is
1089cdf0e10cSrcweir adjusted by a given amount of pixels.
1090cdf0e10cSrcweir
1091cdf0e10cSrcweir @author OD
1092cdf0e10cSrcweir */
lcl_CompPxPosAndAdjustPos(const OutputDevice & _rOut,const Point & _rRefPt,Point & _rCompPt,const sal_Bool _bChkXPos,const sal_Int8 _nPxAdjustment)1093cdf0e10cSrcweir void lcl_CompPxPosAndAdjustPos( const OutputDevice& _rOut,
1094cdf0e10cSrcweir const Point& _rRefPt,
1095cdf0e10cSrcweir Point& _rCompPt,
1096cdf0e10cSrcweir const sal_Bool _bChkXPos,
1097cdf0e10cSrcweir const sal_Int8 _nPxAdjustment )
1098cdf0e10cSrcweir {
1099cdf0e10cSrcweir const Point aRefPxPt = _rOut.LogicToPixel( _rRefPt );
1100cdf0e10cSrcweir Point aCompPxPt = _rOut.LogicToPixel( _rCompPt );
1101cdf0e10cSrcweir
1102cdf0e10cSrcweir if ( _bChkXPos )
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir if ( aCompPxPt.X() == aRefPxPt.X() )
1105cdf0e10cSrcweir {
1106cdf0e10cSrcweir aCompPxPt.X() += _nPxAdjustment ;
1107cdf0e10cSrcweir const Point aAdjustedCompPt = _rOut.PixelToLogic( aCompPxPt );
1108cdf0e10cSrcweir _rCompPt.X() = aAdjustedCompPt.X();
1109cdf0e10cSrcweir }
1110cdf0e10cSrcweir }
1111cdf0e10cSrcweir else
1112cdf0e10cSrcweir {
1113cdf0e10cSrcweir if ( aCompPxPt.Y() == aRefPxPt.Y() )
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir aCompPxPt.Y() += _nPxAdjustment ;
1116cdf0e10cSrcweir const Point aAdjustedCompPt = _rOut.PixelToLogic( aCompPxPt );
1117cdf0e10cSrcweir _rCompPt.Y() = aAdjustedCompPt.Y();
1118cdf0e10cSrcweir }
1119cdf0e10cSrcweir }
1120cdf0e10cSrcweir }
1121cdf0e10cSrcweir
1122cdf0e10cSrcweir /** OD 25.09.2002 #99739# - method to pixel-align rectangle for drawing graphic object
1123cdf0e10cSrcweir
1124cdf0e10cSrcweir Because for drawing a graphic left-top-corner and size coordinations are
1125cdf0e10cSrcweir used, these coordinations have to be determined on pixel level.
1126cdf0e10cSrcweir Thus, convert rectangle to pixel and then convert left-top-corner and
1127cdf0e10cSrcweir size of pixel rectangle back to logic.
1128cdf0e10cSrcweir This calculation is necessary, because there exists a different between
1129cdf0e10cSrcweir the convert from logic to pixel of a normal rectangle with its left-top-
1130cdf0e10cSrcweir and right-bottom-corner and the same convert of the same rectangle
1131cdf0e10cSrcweir with left-top-corner and size.
1132cdf0e10cSrcweir Call this method before each <GraphicObject.Draw(...)>
1133cdf0e10cSrcweir
1134cdf0e10cSrcweir @author OD
1135cdf0e10cSrcweir */
SwAlignGrfRect(SwRect * pGrfRect,const OutputDevice & rOut)1136cdf0e10cSrcweir void SwAlignGrfRect( SwRect *pGrfRect, const OutputDevice &rOut )
1137cdf0e10cSrcweir {
1138cdf0e10cSrcweir Rectangle aPxRect = rOut.LogicToPixel( pGrfRect->SVRect() );
1139cdf0e10cSrcweir pGrfRect->Pos( rOut.PixelToLogic( aPxRect.TopLeft() ) );
1140cdf0e10cSrcweir pGrfRect->SSize( rOut.PixelToLogic( aPxRect.GetSize() ) );
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir
lcl_AlignWidth(const long nWidth)1143cdf0e10cSrcweir long MA_FASTCALL lcl_AlignWidth( const long nWidth )
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir if ( nWidth )
1146cdf0e10cSrcweir {
1147cdf0e10cSrcweir const long nW = nWidth % nPixelSzW;
1148cdf0e10cSrcweir
1149cdf0e10cSrcweir if ( !nW || nW > nHalfPixelSzW )
1150cdf0e10cSrcweir return Max(1L, nWidth - nHalfPixelSzW);
1151cdf0e10cSrcweir }
1152cdf0e10cSrcweir return nWidth;
1153cdf0e10cSrcweir }
1154cdf0e10cSrcweir
lcl_AlignHeight(const long nHeight)1155cdf0e10cSrcweir long MA_FASTCALL lcl_AlignHeight( const long nHeight )
1156cdf0e10cSrcweir {
1157cdf0e10cSrcweir if ( nHeight )
1158cdf0e10cSrcweir {
1159cdf0e10cSrcweir const long nH = nHeight % nPixelSzH;
1160cdf0e10cSrcweir
1161cdf0e10cSrcweir if ( !nH || nH > nHalfPixelSzH )
1162cdf0e10cSrcweir return Max(1L, nHeight - nHalfPixelSzH);
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir return nHeight;
1165cdf0e10cSrcweir }
1166cdf0e10cSrcweir
lcl_MinHeightDist(const long nDist)1167cdf0e10cSrcweir long MA_FASTCALL lcl_MinHeightDist( const long nDist )
1168cdf0e10cSrcweir {
1169cdf0e10cSrcweir if ( aScaleX < aMinDistScale || aScaleY < aMinDistScale )
1170cdf0e10cSrcweir return nDist;
1171cdf0e10cSrcweir return ::lcl_AlignHeight( Max( nDist, nMinDistPixelH ));
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir
lcl_MinWidthDist(const long nDist)1174cdf0e10cSrcweir long MA_FASTCALL lcl_MinWidthDist( const long nDist )
1175cdf0e10cSrcweir {
1176cdf0e10cSrcweir if ( aScaleX < aMinDistScale || aScaleY < aMinDistScale )
1177cdf0e10cSrcweir return nDist;
1178cdf0e10cSrcweir return ::lcl_AlignWidth( Max( nDist, nMinDistPixelW ));
1179cdf0e10cSrcweir }
1180cdf0e10cSrcweir
1181cdf0e10cSrcweir
1182cdf0e10cSrcweir //Ermittelt PrtArea plus Umrandung plus Schatten.
lcl_CalcBorderRect(SwRect & rRect,const SwFrm * pFrm,const SwBorderAttrs & rAttrs,const sal_Bool bShadow)1183cdf0e10cSrcweir void MA_FASTCALL lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm,
1184cdf0e10cSrcweir const SwBorderAttrs &rAttrs,
1185cdf0e10cSrcweir const sal_Bool bShadow )
1186cdf0e10cSrcweir {
1187cdf0e10cSrcweir // OD 23.01.2003 #106386# - special handling for cell frames.
1188cdf0e10cSrcweir // The printing area of a cell frame is completely enclosed in the frame area
1189cdf0e10cSrcweir // and a cell frame has no shadow. Thus, for cell frames the calculated
1190cdf0e10cSrcweir // area equals the frame area.
1191cdf0e10cSrcweir // Notes: Borders of cell frames in R2L text direction will switch its side
1192cdf0e10cSrcweir // - left border is painted on the right; right border on the left.
1193cdf0e10cSrcweir // See <lcl_PaintLeftLine> and <lcl_PaintRightLine>.
1194cdf0e10cSrcweir if( pFrm->IsSctFrm() )
1195cdf0e10cSrcweir {
1196cdf0e10cSrcweir rRect = pFrm->Prt();
1197cdf0e10cSrcweir rRect.Pos() += pFrm->Frm().Pos();
1198cdf0e10cSrcweir }
1199cdf0e10cSrcweir else if ( pFrm->IsCellFrm() )
1200cdf0e10cSrcweir rRect = pFrm->Frm();
1201cdf0e10cSrcweir else
1202cdf0e10cSrcweir {
1203cdf0e10cSrcweir rRect = pFrm->Prt();
1204cdf0e10cSrcweir rRect.Pos() += pFrm->Frm().Pos();
1205cdf0e10cSrcweir
1206cdf0e10cSrcweir if ( rAttrs.IsLine() || rAttrs.IsBorderDist() ||
1207cdf0e10cSrcweir (bShadow && rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE) )
1208cdf0e10cSrcweir {
1209cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1210cdf0e10cSrcweir SwRectFn fnRect = pFrm->IsVertical() ? ( pFrm->IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
1211cdf0e10cSrcweir
1212cdf0e10cSrcweir const SvxBoxItem &rBox = rAttrs.GetBox();
1213cdf0e10cSrcweir const sal_Bool bTop = 0 != (pFrm->*fnRect->fnGetTopMargin)();
1214cdf0e10cSrcweir if ( bTop )
1215cdf0e10cSrcweir {
1216cdf0e10cSrcweir SwTwips nDiff = rBox.GetTop() ?
1217cdf0e10cSrcweir rBox.CalcLineSpace( BOX_LINE_TOP ) :
1218cdf0e10cSrcweir ( rAttrs.IsBorderDist() ?
1219cdf0e10cSrcweir // OD 23.01.2003 #106386# - increase of distance by
1220cdf0e10cSrcweir // one twip is incorrect.
1221cdf0e10cSrcweir rBox.GetDistance( BOX_LINE_TOP ) : 0 );
1222cdf0e10cSrcweir if( nDiff )
1223cdf0e10cSrcweir (rRect.*fnRect->fnSubTop)( nDiff );
1224cdf0e10cSrcweir }
1225cdf0e10cSrcweir
1226cdf0e10cSrcweir const sal_Bool bBottom = 0 != (pFrm->*fnRect->fnGetBottomMargin)();
1227cdf0e10cSrcweir if ( bBottom )
1228cdf0e10cSrcweir {
1229cdf0e10cSrcweir SwTwips nDiff = 0;
1230cdf0e10cSrcweir // --> collapsing borders FME 2005-05-27 #i29550#
1231cdf0e10cSrcweir if ( pFrm->IsTabFrm() &&
1232cdf0e10cSrcweir ((SwTabFrm*)pFrm)->IsCollapsingBorders() )
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir // For collapsing borders, we have to add the height of
1235cdf0e10cSrcweir // the height of the last line
1236cdf0e10cSrcweir nDiff = ((SwTabFrm*)pFrm)->GetBottomLineSize();
1237cdf0e10cSrcweir }
1238cdf0e10cSrcweir // <-- collapsing
1239cdf0e10cSrcweir else
1240cdf0e10cSrcweir {
1241cdf0e10cSrcweir nDiff = rBox.GetBottom() ?
1242cdf0e10cSrcweir rBox.CalcLineSpace( BOX_LINE_BOTTOM ) :
1243cdf0e10cSrcweir ( rAttrs.IsBorderDist() ?
1244cdf0e10cSrcweir // OD 23.01.2003 #106386# - increase of distance by
1245cdf0e10cSrcweir // one twip is incorrect.
1246cdf0e10cSrcweir rBox.GetDistance( BOX_LINE_BOTTOM ) : 0 );
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir if( nDiff )
1249cdf0e10cSrcweir (rRect.*fnRect->fnAddBottom)( nDiff );
1250cdf0e10cSrcweir }
1251cdf0e10cSrcweir
1252cdf0e10cSrcweir if ( rBox.GetLeft() )
1253cdf0e10cSrcweir (rRect.*fnRect->fnSubLeft)( rBox.CalcLineSpace( BOX_LINE_LEFT ) );
1254cdf0e10cSrcweir else if ( rAttrs.IsBorderDist() )
1255cdf0e10cSrcweir // OD 23.01.2003 #106386# - increase of distance by one twip is incorrect.
1256cdf0e10cSrcweir (rRect.*fnRect->fnSubLeft)( rBox.GetDistance( BOX_LINE_LEFT ) );
1257cdf0e10cSrcweir
1258cdf0e10cSrcweir if ( rBox.GetRight() )
1259cdf0e10cSrcweir (rRect.*fnRect->fnAddRight)( rBox.CalcLineSpace( BOX_LINE_RIGHT ) );
1260cdf0e10cSrcweir else if ( rAttrs.IsBorderDist() )
1261cdf0e10cSrcweir // OD 23.01.2003 #106386# - increase of distance by one twip is incorrect.
1262cdf0e10cSrcweir (rRect.*fnRect->fnAddRight)( rBox.GetDistance( BOX_LINE_RIGHT ) );
1263cdf0e10cSrcweir
1264cdf0e10cSrcweir if ( bShadow && rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE )
1265cdf0e10cSrcweir {
1266cdf0e10cSrcweir const SvxShadowItem &rShadow = rAttrs.GetShadow();
1267cdf0e10cSrcweir if ( bTop )
1268cdf0e10cSrcweir (rRect.*fnRect->fnSubTop)(rShadow.CalcShadowSpace(SHADOW_TOP));
1269cdf0e10cSrcweir (rRect.*fnRect->fnSubLeft)(rShadow.CalcShadowSpace(SHADOW_LEFT));
1270cdf0e10cSrcweir if ( bBottom )
1271cdf0e10cSrcweir (rRect.*fnRect->fnAddBottom)
1272cdf0e10cSrcweir (rShadow.CalcShadowSpace( SHADOW_BOTTOM ));
1273cdf0e10cSrcweir (rRect.*fnRect->fnAddRight)(rShadow.CalcShadowSpace(SHADOW_RIGHT));
1274cdf0e10cSrcweir }
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir }
1277cdf0e10cSrcweir
1278cdf0e10cSrcweir ::SwAlignRect( rRect, pGlobalShell );
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir
lcl_ExtendLeftAndRight(SwRect & _rRect,const SwFrm & _rFrm,const SwBorderAttrs & _rAttrs,const SwRectFn & _rRectFn)1281cdf0e10cSrcweir void MA_FASTCALL lcl_ExtendLeftAndRight( SwRect& _rRect,
1282cdf0e10cSrcweir const SwFrm& _rFrm,
1283cdf0e10cSrcweir const SwBorderAttrs& _rAttrs,
1284cdf0e10cSrcweir const SwRectFn& _rRectFn )
1285cdf0e10cSrcweir {
1286cdf0e10cSrcweir // OD 21.05.2003 #108789# - extend left/right border/shadow rectangle to
1287cdf0e10cSrcweir // bottom of previous frame/to top of next frame, if border/shadow is joined
1288cdf0e10cSrcweir // with previous/next frame.
1289cdf0e10cSrcweir if ( _rAttrs.JoinedWithPrev( _rFrm ) )
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir const SwFrm* pPrevFrm = _rFrm.GetPrev();
1292cdf0e10cSrcweir (_rRect.*_rRectFn->fnSetTop)( (pPrevFrm->*_rRectFn->fnGetPrtBottom)() );
1293cdf0e10cSrcweir }
1294cdf0e10cSrcweir if ( _rAttrs.JoinedWithNext( _rFrm ) )
1295cdf0e10cSrcweir {
1296cdf0e10cSrcweir const SwFrm* pNextFrm = _rFrm.GetNext();
1297cdf0e10cSrcweir (_rRect.*_rRectFn->fnSetBottom)( (pNextFrm->*_rRectFn->fnGetPrtTop)() );
1298cdf0e10cSrcweir }
1299cdf0e10cSrcweir }
1300cdf0e10cSrcweir
1301cdf0e10cSrcweir
130264b14621SArmin Le Grand //void MA_FASTCALL lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
130364b14621SArmin Le Grand // const SwRect &rRect, SwRegionRects &rRegion )
130464b14621SArmin Le Grand //{
130564b14621SArmin Le Grand // const SwSortedObjs& rObjs = *pPage->GetSortedObjs();
130664b14621SArmin Le Grand // const SwFlyFrm* pSelfFly = pFrm->IsInFly() ? pFrm->FindFlyFrm() : pRetoucheFly2;
130764b14621SArmin Le Grand // if ( !pRetoucheFly )
130864b14621SArmin Le Grand // pRetoucheFly = pRetoucheFly2;
130964b14621SArmin Le Grand //
131064b14621SArmin Le Grand // for ( sal_uInt16 j = 0; (j < rObjs.Count()) && rRegion.Count(); ++j )
131164b14621SArmin Le Grand // {
131264b14621SArmin Le Grand // const SwAnchoredObject* pAnchoredObj = rObjs[j];
131364b14621SArmin Le Grand // const SdrObject* pSdrObj = pAnchoredObj->GetDrawObj();
131464b14621SArmin Le Grand //
131564b14621SArmin Le Grand // // OD 2004-01-15 #110582# - do not consider invisible objects
131664b14621SArmin Le Grand // if ( !pPage->GetFmt()->GetDoc()->IsVisibleLayerId( pSdrObj->GetLayer() ) )
131764b14621SArmin Le Grand // continue;
131864b14621SArmin Le Grand //
131964b14621SArmin Le Grand // if ( !pAnchoredObj->ISA(SwFlyFrm) )
132064b14621SArmin Le Grand // continue;
132164b14621SArmin Le Grand //
132264b14621SArmin Le Grand // const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
132364b14621SArmin Le Grand //
132464b14621SArmin Le Grand // if ( pSelfFly == pFly || pRetoucheFly == pFly || !rRect.IsOver( pFly->Frm() ) )
132564b14621SArmin Le Grand // continue;
132664b14621SArmin Le Grand //
132764b14621SArmin Le Grand // if ( !pFly->GetFmt()->GetPrint().GetValue() &&
132864b14621SArmin Le Grand // (OUTDEV_PRINTER == pGlobalShell->GetOut()->GetOutDevType() ||
132964b14621SArmin Le Grand // pGlobalShell->IsPreView()))
133064b14621SArmin Le Grand // continue;
133164b14621SArmin Le Grand //
133264b14621SArmin Le Grand // const sal_Bool bLowerOfSelf = pSelfFly && pFly->IsLowerOf( pSelfFly ) ?
133364b14621SArmin Le Grand // sal_True : sal_False;
133464b14621SArmin Le Grand //
133564b14621SArmin Le Grand // //Bei zeichengebundenem Fly nur diejenigen betrachten, in denen er
133664b14621SArmin Le Grand // //nicht selbst verankert ist.
133764b14621SArmin Le Grand // //#33429# Warum nur bei zeichengebundenen? Es macht doch nie Sinn
133864b14621SArmin Le Grand // //Rahmen abzuziehen in denen er selbst verankert ist oder?
133964b14621SArmin Le Grand // if ( pSelfFly && pSelfFly->IsLowerOf( pFly ) )
134064b14621SArmin Le Grand // continue;
134164b14621SArmin Le Grand //
134264b14621SArmin Le Grand // //#57194# Und warum gilt das nicht analog fuer den RetoucheFly?
134364b14621SArmin Le Grand // if ( pRetoucheFly && pRetoucheFly->IsLowerOf( pFly ) )
134464b14621SArmin Le Grand // continue;
134564b14621SArmin Le Grand //
134664b14621SArmin Le Grand //
134764b14621SArmin Le Grand //#ifdef DBG_UTIL
134864b14621SArmin Le Grand // //Flys, die innerhalb des eigenen verankert sind, muessen eine
134964b14621SArmin Le Grand // //groessere OrdNum haben oder Zeichengebunden sein.
135064b14621SArmin Le Grand // if ( pSelfFly && bLowerOfSelf )
135164b14621SArmin Le Grand // {
135264b14621SArmin Le Grand // ASSERT( pFly->IsFlyInCntFrm() ||
135364b14621SArmin Le Grand // pSdrObj->GetOrdNumDirect() > pSelfFly->GetVirtDrawObj()->GetOrdNumDirect(),
135464b14621SArmin Le Grand // "Fly with wrong z-Order" );
135564b14621SArmin Le Grand // }
135664b14621SArmin Le Grand //#endif
135764b14621SArmin Le Grand //
135864b14621SArmin Le Grand // sal_Bool bStopOnHell = sal_True;
135964b14621SArmin Le Grand // if ( pSelfFly )
136064b14621SArmin Le Grand // {
136164b14621SArmin Le Grand // const SdrObject *pTmp = pSelfFly->GetVirtDrawObj();
136264b14621SArmin Le Grand // if ( pSdrObj->GetLayer() == pTmp->GetLayer() )
136364b14621SArmin Le Grand // {
136464b14621SArmin Le Grand // if ( pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
136564b14621SArmin Le Grand // //Im gleichen Layer werden nur obenliegende beachtet.
136664b14621SArmin Le Grand // continue;
136764b14621SArmin Le Grand // }
136864b14621SArmin Le Grand // else
136964b14621SArmin Le Grand // {
137064b14621SArmin Le Grand // if ( !bLowerOfSelf && !pFly->GetFmt()->GetOpaque().GetValue() )
137164b14621SArmin Le Grand // //Aus anderem Layer interessieren uns nur nicht transparente
137264b14621SArmin Le Grand // //oder innenliegende
137364b14621SArmin Le Grand // continue;
137464b14621SArmin Le Grand // bStopOnHell = sal_False;
137564b14621SArmin Le Grand // }
137664b14621SArmin Le Grand // }
137764b14621SArmin Le Grand // if ( pRetoucheFly )
137864b14621SArmin Le Grand // {
137964b14621SArmin Le Grand // const SdrObject *pTmp = pRetoucheFly->GetVirtDrawObj();
138064b14621SArmin Le Grand // if ( pSdrObj->GetLayer() == pTmp->GetLayer() )
138164b14621SArmin Le Grand // {
138264b14621SArmin Le Grand // if ( pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
138364b14621SArmin Le Grand // //Im gleichen Layer werden nur obenliegende beachtet.
138464b14621SArmin Le Grand // continue;
138564b14621SArmin Le Grand // }
138664b14621SArmin Le Grand // else
138764b14621SArmin Le Grand // {
138864b14621SArmin Le Grand // if ( !pFly->IsLowerOf( pRetoucheFly ) && !pFly->GetFmt()->GetOpaque().GetValue() )
138964b14621SArmin Le Grand // //Aus anderem Layer interessieren uns nur nicht transparente
139064b14621SArmin Le Grand // //oder innenliegende
139164b14621SArmin Le Grand // continue;
139264b14621SArmin Le Grand // bStopOnHell = sal_False;
139364b14621SArmin Le Grand // }
139464b14621SArmin Le Grand // }
139564b14621SArmin Le Grand //
139664b14621SArmin Le Grand // //Wenn der Inhalt des Fly Transparent ist, wird er nicht abgezogen, es sei denn
139764b14621SArmin Le Grand // //er steht im Hell-Layer (#31941#)
139864b14621SArmin Le Grand // const IDocumentDrawModelAccess* pIDDMA = pFly->GetFmt()->getIDocumentDrawModelAccess();
139964b14621SArmin Le Grand // sal_Bool bHell = pSdrObj->GetLayer() == pIDDMA->GetHellId();
140064b14621SArmin Le Grand // if ( (bStopOnHell && bHell) ||
140164b14621SArmin Le Grand // /// OD 05.08.2002 - change internal order of condition
140264b14621SArmin Le Grand // /// first check "!bHell", then "..->Lower()" and "..->IsNoTxtFrm()"
140364b14621SArmin Le Grand // /// have not to be performed, if frame is in "Hell"
140464b14621SArmin Le Grand // ( !bHell && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() &&
140564b14621SArmin Le Grand // ( ((SwNoTxtFrm*)pFly->Lower())->IsTransparent() ||
140664b14621SArmin Le Grand // ((SwNoTxtFrm*)pFly->Lower())->HasAnimation() ||
140764b14621SArmin Le Grand // pFly->GetFmt()->GetSurround().IsContour()
140864b14621SArmin Le Grand // )
140964b14621SArmin Le Grand // )
141064b14621SArmin Le Grand // )
141164b14621SArmin Le Grand // continue;
141264b14621SArmin Le Grand //
141364b14621SArmin Le Grand // // OD 08.10.2002 #103898#
141464b14621SArmin Le Grand // // Own if-statements for transparent background/shadow of fly frames
141564b14621SArmin Le Grand // // (#99657#) in order to handle special conditions.
141664b14621SArmin Le Grand // if ( pFly->IsBackgroundTransparent() )
141764b14621SArmin Le Grand // {
141864b14621SArmin Le Grand // // Background <pFly> is transparent drawn. Thus normally, its region
141986e1cf34SPedro Giffuni // // have not to be subtracted from given region.
142064b14621SArmin Le Grand // // But, if method is called for a fly frame and
142164b14621SArmin Le Grand // // <pFly> is a direct lower of this fly frame and
1422f53e21faSmseidel // // <pFly> inherits its transparent background brush from its parent,
142364b14621SArmin Le Grand // // then <pFly> frame area have to be subtracted from given region.
142464b14621SArmin Le Grand // // NOTE: Because in Status Quo transparent backgrounds can only be
142564b14621SArmin Le Grand // // assigned to fly frames, the handle of this special case
142664b14621SArmin Le Grand // // avoids drawing of transparent areas more than once, if
1427f53e21faSmseidel // // a fly frame inherits a transparent background from its
142864b14621SArmin Le Grand // // parent fly frame.
142964b14621SArmin Le Grand // if ( pFrm->IsFlyFrm() &&
143064b14621SArmin Le Grand // (pFly->GetAnchorFrm()->FindFlyFrm() == pFrm) &&
143164b14621SArmin Le Grand // static_cast<const SwFlyFrmFmt*>(pFly->GetFmt())->IsBackgroundBrushInherited()
143264b14621SArmin Le Grand // )
143364b14621SArmin Le Grand // {
143464b14621SArmin Le Grand // SwRect aRect;
143564b14621SArmin Le Grand // SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
143664b14621SArmin Le Grand // const SwBorderAttrs &rAttrs = *aAccess.Get();
143764b14621SArmin Le Grand // ::lcl_CalcBorderRect( aRect, pFly, rAttrs, sal_True );
143864b14621SArmin Le Grand // rRegion -= aRect;
143964b14621SArmin Le Grand // continue;
144064b14621SArmin Le Grand // }
144164b14621SArmin Le Grand // else
144264b14621SArmin Le Grand // {
144364b14621SArmin Le Grand // continue;
144464b14621SArmin Le Grand // }
144564b14621SArmin Le Grand // }
144664b14621SArmin Le Grand // if ( pFly->IsShadowTransparent() )
144764b14621SArmin Le Grand // {
144864b14621SArmin Le Grand // continue;
144964b14621SArmin Le Grand // }
145064b14621SArmin Le Grand //
145164b14621SArmin Le Grand // if ( bHell && pFly->GetAnchorFrm()->IsInFly() )
145264b14621SArmin Le Grand // {
145364b14621SArmin Le Grand // //Damit die Umrandung nicht vom Hintergrund des anderen Flys
145464b14621SArmin Le Grand // //zerlegt wird.
145564b14621SArmin Le Grand // SwRect aRect;
145664b14621SArmin Le Grand // SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
145764b14621SArmin Le Grand // const SwBorderAttrs &rAttrs = *aAccess.Get();
145864b14621SArmin Le Grand // ::lcl_CalcBorderRect( aRect, pFly, rAttrs, sal_True );
145964b14621SArmin Le Grand // rRegion -= aRect;
146064b14621SArmin Le Grand // }
146164b14621SArmin Le Grand // else
146264b14621SArmin Le Grand // {
146364b14621SArmin Le Grand // SwRect aRect( pFly->Prt() );
146464b14621SArmin Le Grand // aRect += pFly->Frm().Pos();
146564b14621SArmin Le Grand // rRegion -= aRect;
146664b14621SArmin Le Grand // }
146764b14621SArmin Le Grand // }
146864b14621SArmin Le Grand // if ( pRetoucheFly == pRetoucheFly2 )
146964b14621SArmin Le Grand // pRetoucheFly = 0;
147064b14621SArmin Le Grand //}
1471cdf0e10cSrcweir
1472cdf0e10cSrcweir // --> OD 2008-05-16 #i84659# - no longer needed
1473cdf0e10cSrcweir //inline sal_Bool IsShortCut( const SwRect &rRect, const SwRect &rFrmRect )
1474cdf0e10cSrcweir //{
1475cdf0e10cSrcweir // //Wenn der Frm vollstaendig rechts neben bzw. unter dem
1476cdf0e10cSrcweir // //Rect sitzt ist's genug mit Painten.
1477cdf0e10cSrcweir // return rFrmRect.Top() > rRect.Bottom();
1478cdf0e10cSrcweir // // PAGES01 || (rFrmRect.Left() > rRect.Right()) );
1479cdf0e10cSrcweir //}
1480cdf0e10cSrcweir // <--
1481cdf0e10cSrcweir
1482cdf0e10cSrcweir //---------------- Ausgabe fuer das BrushItem ----------------
1483cdf0e10cSrcweir
1484cdf0e10cSrcweir /** lcl_DrawGraphicBackgrd - local help method to draw a background for a graphic
1485cdf0e10cSrcweir
1486cdf0e10cSrcweir OD 17.10.2002 #103876#
1487cdf0e10cSrcweir Under certain circumstances we have to draw a background for a graphic.
1488cdf0e10cSrcweir This method takes care of the conditions and draws the background with the
1489cdf0e10cSrcweir corresponding color.
1490cdf0e10cSrcweir Method introduced for bug fix #103876# in order to optimize drawing tiled
1491cdf0e10cSrcweir background graphics. Previously, this code was integrated in method
1492cdf0e10cSrcweir <lcl_DrawGraphic>.
1493cdf0e10cSrcweir Method implemented as a inline, checking the conditions and calling method
1494cdf0e10cSrcweir method <lcl_implDrawGraphicBackgrd(..)> for the intrinsic drawing.
1495cdf0e10cSrcweir
1496cdf0e10cSrcweir @author OD
1497cdf0e10cSrcweir
1498cdf0e10cSrcweir @param _rBackgrdBrush
1499cdf0e10cSrcweir background brush contain the color the background has to be drawn.
1500cdf0e10cSrcweir
1501cdf0e10cSrcweir @param _pOut
1502cdf0e10cSrcweir output device the background has to be drawn in.
1503cdf0e10cSrcweir
1504cdf0e10cSrcweir @param _rPaintRect
1505f53e21faSmseidel paint rectangle in the output device, which has to be drawn with the background.
1506cdf0e10cSrcweir rectangle have to be aligned by method ::SwAlignRect
1507cdf0e10cSrcweir
1508cdf0e10cSrcweir @param _rGraphicObj
1509cdf0e10cSrcweir graphic object, for which the background has to be drawn. Used for checking
1510cdf0e10cSrcweir the transparency of its bitmap, its type and if the graphic is drawn transparent
1511cdf0e10cSrcweir
1512cdf0e10cSrcweir @param _bNumberingGraphic
1513cdf0e10cSrcweir boolean indicating that graphic is used as a numbering.
1514cdf0e10cSrcweir
1515cdf0e10cSrcweir @param _bBackgrdAlreadyDrawn
1516cdf0e10cSrcweir boolean (optional; default: false) indicating, if the background is already drawn.
1517cdf0e10cSrcweir */
lcl_implDrawGraphicBackgrd(const SvxBrushItem & _rBackgrdBrush,OutputDevice * _pOut,const SwRect & _rAlignedPaintRect,const GraphicObject & _rGraphicObj)1518cdf0e10cSrcweir void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
1519cdf0e10cSrcweir OutputDevice* _pOut,
1520cdf0e10cSrcweir const SwRect& _rAlignedPaintRect,
1521cdf0e10cSrcweir const GraphicObject& _rGraphicObj )
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir /// determine color of background
1524cdf0e10cSrcweir /// If color of background brush is not "no fill"/"auto fill" or
1525cdf0e10cSrcweir /// <bFlyMetafile> is set, use color of background brush, otherwise
1526cdf0e10cSrcweir /// use global retouche color.
1527cdf0e10cSrcweir const Color aColor( ( (_rBackgrdBrush.GetColor() != COL_TRANSPARENT) || bFlyMetafile )
1528cdf0e10cSrcweir ? _rBackgrdBrush.GetColor()
1529cdf0e10cSrcweir : aGlobalRetoucheColor );
1530cdf0e10cSrcweir
1531cdf0e10cSrcweir /// determine, if background color have to be drawn transparent
1532cdf0e10cSrcweir /// and calculate transparency percent value
1533cdf0e10cSrcweir sal_Int8 nTransparencyPercent = 0;
1534cdf0e10cSrcweir bool bDrawTransparent = false;
1535cdf0e10cSrcweir if ( aColor.GetTransparency() != 0 )
1536cdf0e10cSrcweir /// background color is transparent --> draw transparent.
1537cdf0e10cSrcweir {
1538cdf0e10cSrcweir bDrawTransparent = true;
1539cdf0e10cSrcweir nTransparencyPercent = (aColor.GetTransparency()*100 + 0x7F)/0xFF;
1540cdf0e10cSrcweir }
1541cdf0e10cSrcweir else if ( (_rGraphicObj.GetAttr().GetTransparency() != 0) &&
1542cdf0e10cSrcweir (_rBackgrdBrush.GetColor() == COL_TRANSPARENT) )
1543cdf0e10cSrcweir /// graphic is drawn transparent and background color is
1544cdf0e10cSrcweir /// "no fill"/"auto fill" --> draw transparent
1545cdf0e10cSrcweir {
1546cdf0e10cSrcweir bDrawTransparent = true;
1547cdf0e10cSrcweir nTransparencyPercent = (_rGraphicObj.GetAttr().GetTransparency()*100 + 0x7F)/0xFF;
1548cdf0e10cSrcweir }
1549cdf0e10cSrcweir
1550cdf0e10cSrcweir if ( bDrawTransparent )
1551cdf0e10cSrcweir {
1552cdf0e10cSrcweir /// draw background transparent
1553cdf0e10cSrcweir if( _pOut->GetFillColor() != aColor.GetRGBColor() )
1554cdf0e10cSrcweir _pOut->SetFillColor( aColor.GetRGBColor() );
1555cdf0e10cSrcweir PolyPolygon aPoly( _rAlignedPaintRect.SVRect() );
1556cdf0e10cSrcweir _pOut->DrawTransparent( aPoly, nTransparencyPercent );
1557cdf0e10cSrcweir }
1558cdf0e10cSrcweir else
1559cdf0e10cSrcweir {
1560cdf0e10cSrcweir /// draw background opaque
1561cdf0e10cSrcweir if ( _pOut->GetFillColor() != aColor )
1562cdf0e10cSrcweir _pOut->SetFillColor( aColor );
1563cdf0e10cSrcweir _pOut->DrawRect( _rAlignedPaintRect.SVRect() );
1564cdf0e10cSrcweir }
1565cdf0e10cSrcweir }
1566cdf0e10cSrcweir
lcl_DrawGraphicBackgrd(const SvxBrushItem & _rBackgrdBrush,OutputDevice * _pOut,const SwRect & _rAlignedPaintRect,const GraphicObject & _rGraphicObj,bool _bNumberingGraphic,bool _bBackgrdAlreadyDrawn=false)1567cdf0e10cSrcweir inline void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
1568cdf0e10cSrcweir OutputDevice* _pOut,
1569cdf0e10cSrcweir const SwRect& _rAlignedPaintRect,
1570cdf0e10cSrcweir const GraphicObject& _rGraphicObj,
1571cdf0e10cSrcweir bool _bNumberingGraphic,
1572cdf0e10cSrcweir bool _bBackgrdAlreadyDrawn = false )
1573cdf0e10cSrcweir {
1574cdf0e10cSrcweir /// draw background with background color, if
1575cdf0e10cSrcweir /// (1) graphic is not used as a numbering AND
1576cdf0e10cSrcweir /// (2) background is not already drawn AND
1577cdf0e10cSrcweir /// (3) intrinsic graphic is transparent OR intrinsic graphic doesn't exists
1578cdf0e10cSrcweir if ( !_bNumberingGraphic &&
1579cdf0e10cSrcweir !_bBackgrdAlreadyDrawn &&
1580cdf0e10cSrcweir ( _rGraphicObj.IsTransparent() || _rGraphicObj.GetType() == GRAPHIC_NONE )
1581cdf0e10cSrcweir )
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _pOut, _rAlignedPaintRect, _rGraphicObj );
1584cdf0e10cSrcweir }
1585cdf0e10cSrcweir }
1586cdf0e10cSrcweir
1587cdf0e10cSrcweir /// OD 06.08.2002 #99657# - Note: the transparency of the background graphic
1588cdf0e10cSrcweir /// is saved in SvxBrushItem.GetGraphicObject(<shell>).GetAttr().Set/GetTransparency()
1589cdf0e10cSrcweir /// and is considered in the drawing of the graphic.
1590cdf0e10cSrcweir /// Thus, to provide transparent background graphic for text frames nothing
1591cdf0e10cSrcweir /// has to be coded.
1592cdf0e10cSrcweir /// OD 25.09.2002 #99739# - use align rectangle for drawing graphic
1593cdf0e10cSrcweir /// OD 25.09.2002 #99739# - pixel-align coordinations for drawing graphic.
1594cdf0e10cSrcweir /// OD 17.10.2002 #103876# - outsource code for drawing background of the graphic
1595cdf0e10cSrcweir /// with a background color in method <lcl_DrawGraphicBackgrd>
1596cdf0e10cSrcweir /// Also, change type of <bGrfNum> and <bClip> from <sal_Bool> to <bool>.
lcl_DrawGraphic(const SvxBrushItem & rBrush,OutputDevice * pOut,ViewShell & rSh,const SwRect & rGrf,const SwRect & rOut,bool bClip,bool bGrfNum,bool bBackgrdAlreadyDrawn=false)1597cdf0e10cSrcweir void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut,
1598cdf0e10cSrcweir ViewShell &rSh, const SwRect &rGrf, const SwRect &rOut,
1599cdf0e10cSrcweir bool bClip, bool bGrfNum,
1600cdf0e10cSrcweir bool bBackgrdAlreadyDrawn = false )
1601cdf0e10cSrcweir /// OD 02.09.2002 #99657#
1602cdf0e10cSrcweir /// add parameter <bBackgrdAlreadyDrawn> to indicate
1603cdf0e10cSrcweir /// that the background is already drawn.
1604cdf0e10cSrcweir {
1605cdf0e10cSrcweir /// OD 25.09.2002 #99739# - calculate align rectangle from parameter <rGrf>
1606cdf0e10cSrcweir /// and use aligned rectangle <aAlignedGrfRect> in the following code
1607cdf0e10cSrcweir SwRect aAlignedGrfRect = rGrf;
1608cdf0e10cSrcweir ::SwAlignRect( aAlignedGrfRect, &rSh );
1609cdf0e10cSrcweir
1610cdf0e10cSrcweir /// OD 17.10.2002 #103876# - change type from <sal_Bool> to <bool>.
1611cdf0e10cSrcweir const bool bNotInside = bClip && !rOut.IsInside( aAlignedGrfRect );
1612cdf0e10cSrcweir if ( bNotInside )
1613cdf0e10cSrcweir {
1614cdf0e10cSrcweir pOut->Push( PUSH_CLIPREGION );
1615cdf0e10cSrcweir pOut->IntersectClipRegion( rOut.SVRect() );
1616cdf0e10cSrcweir }
1617cdf0e10cSrcweir
1618cdf0e10cSrcweir //Hier kein Link, wir wollen die Grafik synchron laden!
1619cdf0e10cSrcweir ((SvxBrushItem&)rBrush).SetDoneLink( Link() );
1620cdf0e10cSrcweir GraphicObject *pGrf = (GraphicObject*)rBrush.GetGraphicObject();
1621cdf0e10cSrcweir
1622cdf0e10cSrcweir /// OD 17.10.2002 #103876# - outsourcing drawing of background with a background color.
1623cdf0e10cSrcweir ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, *pGrf, bGrfNum, bBackgrdAlreadyDrawn );
1624cdf0e10cSrcweir
1625cdf0e10cSrcweir /// OD 25.09.2002 #99739# -
1626cdf0e10cSrcweir /// Because for drawing a graphic left-top-corner and size coordinations are
1627cdf0e10cSrcweir /// used, these coordinations have to be determined on pixel level.
1628cdf0e10cSrcweir ::SwAlignGrfRect( &aAlignedGrfRect, *pOut );
1629cdf0e10cSrcweir pGrf->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() );
1630cdf0e10cSrcweir
1631cdf0e10cSrcweir if ( bNotInside )
1632cdf0e10cSrcweir pOut->Pop();
1633cdf0e10cSrcweir } // end of method <lcl_DrawGraphic>
1634cdf0e10cSrcweir
DrawFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr & rFillAttributes,const SwRect & rOriginalLayoutRect,const SwRect & rPaintRect,OutputDevice & rOut)163564b14621SArmin Le Grand bool MA_FASTCALL DrawFillAttributes(
163656b35d86SArmin Le Grand const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
163764b14621SArmin Le Grand const SwRect& rOriginalLayoutRect,
163864b14621SArmin Le Grand const SwRect& rPaintRect,
163964b14621SArmin Le Grand OutputDevice& rOut)
164064b14621SArmin Le Grand {
164164b14621SArmin Le Grand static bool bUseNew(true);
164264b14621SArmin Le Grand static bool bReturnWhenNew(true);
164364b14621SArmin Le Grand
164464b14621SArmin Le Grand if(bUseNew && rFillAttributes.get() && rFillAttributes->isUsed())
164564b14621SArmin Le Grand {
1646d5bf989cSArmin Le Grand basegfx::B2DRange aPaintRange(
1647d5bf989cSArmin Le Grand rPaintRect.Left(),
1648d5bf989cSArmin Le Grand rPaintRect.Top(),
164964b14621SArmin Le Grand rPaintRect.Right(),
165064b14621SArmin Le Grand rPaintRect.Bottom());
165164b14621SArmin Le Grand
165264b14621SArmin Le Grand if(!aPaintRange.isEmpty() &&
165364b14621SArmin Le Grand !basegfx::fTools::equalZero(aPaintRange.getWidth()) &&
165464b14621SArmin Le Grand !basegfx::fTools::equalZero(aPaintRange.getHeight()))
165564b14621SArmin Le Grand {
1656734ca04eSArmin Le Grand const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
1657d5bf989cSArmin Le Grand
1658734ca04eSArmin Le Grand //UUUU need to expand for correct AAed and non-AAed visualization as primitive.
1659734ca04eSArmin Le Grand // This must probably be removed again when we will be able to get all Writer visualization
1660734ca04eSArmin Le Grand // as primitives and Writer prepares all it's stuff in high precision coordinates (also
1661734ca04eSArmin Le Grand // needs to avoid moving boundaries around to better show overlapping stuff...)
1662734ca04eSArmin Le Grand if(aSvtOptionsDrawinglayer.IsAntiAliasing())
1663734ca04eSArmin Le Grand {
1664734ca04eSArmin Le Grand // if AAed in principle expand by 0.5 in all directions. Since painting edges of
1665f53e21faSmseidel // AAed regions does not add to no transparency (0.5 opacity covered by 0.5 opacity
1666734ca04eSArmin Le Grand // is not full opacity but 0.75 opacity) we need some overlap here to avoid paint
1667734ca04eSArmin Le Grand // artifacts. Checked experimentally - a little bit more in Y is needed, probably
1668f53e21faSmseidel // due to still existing integer alignment and crunching in Writer.
1669734ca04eSArmin Le Grand static double fExpandX = 0.55;
1670734ca04eSArmin Le Grand static double fExpandY = 0.70;
1671734ca04eSArmin Le Grand const basegfx::B2DVector aSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(fExpandX, fExpandY));
1672734ca04eSArmin Le Grand
1673734ca04eSArmin Le Grand aPaintRange.expand(aPaintRange.getMinimum() - aSingleUnit);
1674734ca04eSArmin Le Grand aPaintRange.expand(aPaintRange.getMaximum() + aSingleUnit);
1675734ca04eSArmin Le Grand }
1676734ca04eSArmin Le Grand else
1677734ca04eSArmin Le Grand {
1678734ca04eSArmin Le Grand // if not AAed expand by one unit to bottom right due to the missing unit
1679734ca04eSArmin Le Grand // from SwRect/Rectangle integer handling
1680734ca04eSArmin Le Grand const basegfx::B2DVector aSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0));
1681734ca04eSArmin Le Grand
1682734ca04eSArmin Le Grand aPaintRange.expand(aPaintRange.getMaximum() + aSingleUnit);
1683734ca04eSArmin Le Grand }
1684d5bf989cSArmin Le Grand
168564b14621SArmin Le Grand const basegfx::B2DRange aDefineRange(
168664b14621SArmin Le Grand rOriginalLayoutRect.Left(),
168764b14621SArmin Le Grand rOriginalLayoutRect.Top(),
168864b14621SArmin Le Grand rOriginalLayoutRect.Right(),
168964b14621SArmin Le Grand rOriginalLayoutRect.Bottom());
169064b14621SArmin Le Grand
169164b14621SArmin Le Grand const drawinglayer::primitive2d::Primitive2DSequence& rSequence = rFillAttributes->getPrimitive2DSequence(
169264b14621SArmin Le Grand aPaintRange,
169364b14621SArmin Le Grand aDefineRange);
169464b14621SArmin Le Grand
169564b14621SArmin Le Grand if(rSequence.getLength())
169664b14621SArmin Le Grand {
169764b14621SArmin Le Grand const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
169864b14621SArmin Le Grand basegfx::B2DHomMatrix(),
169964b14621SArmin Le Grand rOut.GetViewTransformation(),
170064b14621SArmin Le Grand aPaintRange,
170164b14621SArmin Le Grand 0,
170264b14621SArmin Le Grand 0.0,
170364b14621SArmin Le Grand uno::Sequence< beans::PropertyValue >());
170464b14621SArmin Le Grand drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
170564b14621SArmin Le Grand rOut,
170664b14621SArmin Le Grand aViewInformation2D);
170764b14621SArmin Le Grand
170864b14621SArmin Le Grand if(pProcessor)
170964b14621SArmin Le Grand {
171064b14621SArmin Le Grand pProcessor->process(rSequence);
171164b14621SArmin Le Grand
171264b14621SArmin Le Grand delete pProcessor;
171364b14621SArmin Le Grand
171464b14621SArmin Le Grand if(bReturnWhenNew)
171564b14621SArmin Le Grand {
171664b14621SArmin Le Grand return true;
171764b14621SArmin Le Grand }
171864b14621SArmin Le Grand }
171964b14621SArmin Le Grand }
172064b14621SArmin Le Grand }
172164b14621SArmin Le Grand }
172264b14621SArmin Le Grand
172364b14621SArmin Le Grand return false;
172464b14621SArmin Le Grand }
172564b14621SArmin Le Grand
DrawGraphic(const SvxBrushItem * pBrush,OutputDevice * pOutDev,const SwRect & rOrg,const SwRect & rOut,const sal_uInt8 nGrfNum,const sal_Bool bConsiderBackgroundTransparency)172664b14621SArmin Le Grand void MA_FASTCALL DrawGraphic(
172764b14621SArmin Le Grand const SvxBrushItem *pBrush,
1728cdf0e10cSrcweir OutputDevice *pOutDev,
1729cdf0e10cSrcweir const SwRect &rOrg,
1730cdf0e10cSrcweir const SwRect &rOut,
1731cdf0e10cSrcweir const sal_uInt8 nGrfNum,
1732cdf0e10cSrcweir const sal_Bool bConsiderBackgroundTransparency )
1733cdf0e10cSrcweir /// OD 05.08.2002 #99657# - add 6th parameter to indicate that method should
1734cdf0e10cSrcweir /// consider background transparency, saved in the color of the brush item
1735cdf0e10cSrcweir {
1736cdf0e10cSrcweir ViewShell &rSh = *pGlobalShell;
1737cdf0e10cSrcweir /// OD 17.10.2002 #103876# - change type from <sal_Bool> to <bool>
1738cdf0e10cSrcweir bool bReplaceGrfNum = GRFNUM_REPLACE == nGrfNum;
1739cdf0e10cSrcweir bool bGrfNum = GRFNUM_NO != nGrfNum;
1740cdf0e10cSrcweir Size aGrfSize;
1741cdf0e10cSrcweir SvxGraphicPosition ePos = GPOS_NONE;
1742cdf0e10cSrcweir if( pBrush && !bReplaceGrfNum )
1743cdf0e10cSrcweir {
1744cdf0e10cSrcweir if( rSh.GetViewOptions()->IsGraphic() )
1745cdf0e10cSrcweir {
1746cdf0e10cSrcweir //#125488#: load graphic directly in PDF import
1747cdf0e10cSrcweir // --> OD 2006-08-25 #i68953# - also during print load graphic directly.
1748cdf0e10cSrcweir if ( (rSh).GetViewOptions()->IsPDFExport() ||
1749cdf0e10cSrcweir rSh.GetOut()->GetOutDevType() == OUTDEV_PRINTER )
1750cdf0e10cSrcweir // <--
1751cdf0e10cSrcweir {
1752cdf0e10cSrcweir ((SvxBrushItem*)pBrush)->PurgeMedium();
1753cdf0e10cSrcweir ((SvxBrushItem*)pBrush)->SetDoneLink( Link() );
1754cdf0e10cSrcweir }
1755cdf0e10cSrcweir else
1756cdf0e10cSrcweir ((SvxBrushItem*)pBrush)->SetDoneLink( STATIC_LINK(
1757cdf0e10cSrcweir rSh.GetDoc(), SwDoc, BackgroundDone ) );
1758cdf0e10cSrcweir //SfxObjectShell &rObjSh = *GETOBJSHELL();
1759cdf0e10cSrcweir const Graphic* pGrf = pBrush->GetGraphic();
1760cdf0e10cSrcweir if( pGrf && GRAPHIC_NONE != pGrf->GetType() )
1761cdf0e10cSrcweir {
1762cdf0e10cSrcweir ePos = pBrush->GetGraphicPos();
1763cdf0e10cSrcweir if( pGrf->IsSupportedGraphic() )
1764cdf0e10cSrcweir // don't the use the specific output device! Bug 94802
1765cdf0e10cSrcweir aGrfSize = ::GetGraphicSizeTwip( *pGrf, 0 );
1766cdf0e10cSrcweir }
1767cdf0e10cSrcweir }
1768cdf0e10cSrcweir else
1769cdf0e10cSrcweir bReplaceGrfNum = bGrfNum;
1770cdf0e10cSrcweir }
1771cdf0e10cSrcweir
1772cdf0e10cSrcweir SwRect aGrf;
1773cdf0e10cSrcweir aGrf.SSize( aGrfSize );
1774cdf0e10cSrcweir sal_Bool bDraw = sal_True;
1775cdf0e10cSrcweir sal_Bool bRetouche = sal_True;
1776cdf0e10cSrcweir switch ( ePos )
1777cdf0e10cSrcweir {
1778cdf0e10cSrcweir case GPOS_LT:
1779cdf0e10cSrcweir aGrf.Pos() = rOrg.Pos();
1780cdf0e10cSrcweir break;
1781cdf0e10cSrcweir
1782cdf0e10cSrcweir case GPOS_MT:
1783cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Top();
1784cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Left() + rOrg.Width()/2 - aGrfSize.Width()/2;
1785cdf0e10cSrcweir break;
1786cdf0e10cSrcweir
1787cdf0e10cSrcweir case GPOS_RT:
1788cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Top();
1789cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Right() - aGrfSize.Width();
1790cdf0e10cSrcweir break;
1791cdf0e10cSrcweir
1792cdf0e10cSrcweir case GPOS_LM:
1793cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Top() + rOrg.Height()/2 - aGrfSize.Height()/2;
1794cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Left();
1795cdf0e10cSrcweir break;
1796cdf0e10cSrcweir
1797cdf0e10cSrcweir case GPOS_MM:
1798cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Top() + rOrg.Height()/2 - aGrfSize.Height()/2;
1799cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Left() + rOrg.Width()/2 - aGrfSize.Width()/2;
1800cdf0e10cSrcweir break;
1801cdf0e10cSrcweir
1802cdf0e10cSrcweir case GPOS_RM:
1803cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Top() + rOrg.Height()/2 - aGrfSize.Height()/2;
1804cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Right() - aGrfSize.Width();
1805cdf0e10cSrcweir break;
1806cdf0e10cSrcweir
1807cdf0e10cSrcweir case GPOS_LB:
1808cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Bottom() - aGrfSize.Height();
1809cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Left();
1810cdf0e10cSrcweir break;
1811cdf0e10cSrcweir
1812cdf0e10cSrcweir case GPOS_MB:
1813cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Bottom() - aGrfSize.Height();
1814cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Left() + rOrg.Width()/2 - aGrfSize.Width()/2;
1815cdf0e10cSrcweir break;
1816cdf0e10cSrcweir
1817cdf0e10cSrcweir case GPOS_RB:
1818cdf0e10cSrcweir aGrf.Pos().Y() = rOrg.Bottom() - aGrfSize.Height();
1819cdf0e10cSrcweir aGrf.Pos().X() = rOrg.Right() - aGrfSize.Width();
1820cdf0e10cSrcweir break;
1821cdf0e10cSrcweir
1822cdf0e10cSrcweir case GPOS_AREA:
1823cdf0e10cSrcweir aGrf = rOrg;
1824cdf0e10cSrcweir /// OD 05.09.2002 #102912#
1825cdf0e10cSrcweir /// In spite the fact that the background graphic have to fill the complete
1826cdf0e10cSrcweir /// area, it has been checked, if the graphic will completely fill out
1827cdf0e10cSrcweir /// the region to be painted <rOut> and thus, nothing has to be retouched.
1828cdf0e10cSrcweir /// For example, this is the case for a fly frame without a background
1829cdf0e10cSrcweir /// brush positioned on the border of the page and inherited the
1830cdf0e10cSrcweir /// background brush from the page.
1831cdf0e10cSrcweir bRetouche = !rOut.IsInside( aGrf );
1832cdf0e10cSrcweir break;
1833cdf0e10cSrcweir
1834cdf0e10cSrcweir case GPOS_TILED:
1835cdf0e10cSrcweir {
1836cdf0e10cSrcweir // OD 17.10.2002 #103876# - draw background of tiled graphic
1837cdf0e10cSrcweir // before drawing tiled graphic in loop
1838cdf0e10cSrcweir // determine graphic object
1839cdf0e10cSrcweir GraphicObject* pGraphicObj = const_cast< GraphicObject* >(pBrush->GetGraphicObject());
1840cdf0e10cSrcweir // calculate aligned paint rectangle
1841cdf0e10cSrcweir SwRect aAlignedPaintRect = rOut;
1842cdf0e10cSrcweir ::SwAlignRect( aAlignedPaintRect, &rSh );
1843cdf0e10cSrcweir // OD 25.10.2002 #103876# - draw background color for aligned paint rectangle
1844cdf0e10cSrcweir lcl_DrawGraphicBackgrd( *pBrush, pOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum );
1845cdf0e10cSrcweir
1846cdf0e10cSrcweir // set left-top-corner of background graphic to left-top-corner of the
1847cdf0e10cSrcweir // area, from which the background brush is determined.
1848cdf0e10cSrcweir aGrf.Pos() = rOrg.Pos();
1849cdf0e10cSrcweir // setup clipping at output device
1850cdf0e10cSrcweir pOutDev->Push( PUSH_CLIPREGION );
1851cdf0e10cSrcweir pOutDev->IntersectClipRegion( rOut.SVRect() );
1852cdf0e10cSrcweir // OD 28.10.2002 #103876# - use new method <GraphicObject::DrawTiled(::)>
1853cdf0e10cSrcweir {
1854cdf0e10cSrcweir // calculate paint offset
1855cdf0e10cSrcweir Point aPaintOffset( aAlignedPaintRect.Pos() - aGrf.Pos() );
1856cdf0e10cSrcweir // draw background graphic tiled for aligned paint rectangle
1857cdf0e10cSrcweir // --> OD 2005-02-15 #i42643# - apply fix #104004# for Calc
1858cdf0e10cSrcweir // also for Writer - see /sc/source/view/printfun.cxx
1859cdf0e10cSrcweir // For PDF export, every draw operation for bitmaps takes a
1860cdf0e10cSrcweir // noticeable amount of place (~50 characters). Thus, optimize
1861cdf0e10cSrcweir // between tile bitmap size and number of drawing operations here.
1862cdf0e10cSrcweir //
1863cdf0e10cSrcweir // A_out
1864cdf0e10cSrcweir // n_chars = k1 * ---------- + k2 * A_bitmap
1865cdf0e10cSrcweir // A_bitmap
1866cdf0e10cSrcweir //
1867cdf0e10cSrcweir // minimum n_chars is obtained for (derive for A_bitmap,
1868cdf0e10cSrcweir // set to 0, take positive solution):
1869cdf0e10cSrcweir // k1
1870cdf0e10cSrcweir // A_bitmap = Sqrt( ---- A_out )
1871cdf0e10cSrcweir // k2
1872cdf0e10cSrcweir //
1873cdf0e10cSrcweir // where k1 is the number of chars per draw operation, and
1874cdf0e10cSrcweir // k2 is the number of chars per bitmap pixel.
1875cdf0e10cSrcweir // This is approximately 50 and 7 for current PDF writer, respectively.
1876cdf0e10cSrcweir //
1877cdf0e10cSrcweir const double k1( 50 );
1878cdf0e10cSrcweir const double k2( 7 );
1879cdf0e10cSrcweir const Size aSize( aAlignedPaintRect.SSize() );
1880cdf0e10cSrcweir const double Abitmap( k1/k2 * static_cast<double>(aSize.Width())*aSize.Height() );
1881cdf0e10cSrcweir
1882cdf0e10cSrcweir pGraphicObj->DrawTiled( pOutDev,
1883cdf0e10cSrcweir aAlignedPaintRect.SVRect(),
1884cdf0e10cSrcweir aGrf.SSize(),
1885cdf0e10cSrcweir Size( aPaintOffset.X(), aPaintOffset.Y() ),
1886cdf0e10cSrcweir NULL, GRFMGR_DRAW_STANDARD,
1887cdf0e10cSrcweir ::std::max( 128, static_cast<int>( sqrt(sqrt( Abitmap)) + .5 ) ) );
1888cdf0e10cSrcweir // <--
1889cdf0e10cSrcweir }
1890cdf0e10cSrcweir // reset clipping at output device
1891cdf0e10cSrcweir pOutDev->Pop();
1892cdf0e10cSrcweir // set <bDraw> and <bRetouche> to false, indicating that background
1893cdf0e10cSrcweir // graphic and background are already drawn.
1894cdf0e10cSrcweir bDraw = bRetouche = sal_False;
1895cdf0e10cSrcweir }
1896cdf0e10cSrcweir break;
1897cdf0e10cSrcweir
1898cdf0e10cSrcweir case GPOS_NONE:
1899cdf0e10cSrcweir bDraw = sal_False;
1900cdf0e10cSrcweir break;
1901cdf0e10cSrcweir
1902cdf0e10cSrcweir default: ASSERT( !pOutDev, "new Graphic position?" );
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir
1905cdf0e10cSrcweir /// OD 02.09.2002 #99657#
1906cdf0e10cSrcweir /// init variable <bGrfBackgrdAlreadDrawn> to indicate, if background of
1907cdf0e10cSrcweir /// graphic is already drawn or not.
1908cdf0e10cSrcweir bool bGrfBackgrdAlreadyDrawn = false;
1909cdf0e10cSrcweir if ( bRetouche )
1910cdf0e10cSrcweir {
1911cdf0e10cSrcweir // OD 2004-04-23 #116347#
1912cdf0e10cSrcweir pOutDev->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
1913cdf0e10cSrcweir pOutDev->SetLineColor();
1914cdf0e10cSrcweir
1915cdf0e10cSrcweir // OD 07.08.2002 #99657# #GetTransChg#
1916cdf0e10cSrcweir // check, if a existing background graphic (not filling the complete
1917cdf0e10cSrcweir // background) is transparent drawn and the background color is
1918cdf0e10cSrcweir // "no fill" respectively "auto fill", if background transparency
1919cdf0e10cSrcweir // has to be considered.
1920cdf0e10cSrcweir // If YES, memorise transparency of background graphic.
1921cdf0e10cSrcweir // check also, if background graphic bitmap is transparent.
1922cdf0e10cSrcweir bool bTransparentGrfWithNoFillBackgrd = false;
1923cdf0e10cSrcweir sal_Int32 nGrfTransparency = 0;
1924cdf0e10cSrcweir bool bGrfIsTransparent = false;
1925cdf0e10cSrcweir if ( (ePos != GPOS_NONE) &&
1926cdf0e10cSrcweir (ePos != GPOS_TILED) && (ePos != GPOS_AREA)
1927cdf0e10cSrcweir )
1928cdf0e10cSrcweir {
1929cdf0e10cSrcweir GraphicObject *pGrf = (GraphicObject*)pBrush->GetGraphicObject();
1930cdf0e10cSrcweir if ( bConsiderBackgroundTransparency )
1931cdf0e10cSrcweir {
1932cdf0e10cSrcweir GraphicAttr pGrfAttr = pGrf->GetAttr();
1933cdf0e10cSrcweir if ( (pGrfAttr.GetTransparency() != 0) &&
1934cdf0e10cSrcweir ( pBrush && (pBrush->GetColor() == COL_TRANSPARENT) )
1935cdf0e10cSrcweir )
1936cdf0e10cSrcweir {
1937cdf0e10cSrcweir bTransparentGrfWithNoFillBackgrd = true;
1938cdf0e10cSrcweir nGrfTransparency = pGrfAttr.GetTransparency();
1939cdf0e10cSrcweir }
1940cdf0e10cSrcweir }
1941cdf0e10cSrcweir if ( pGrf->IsTransparent() )
1942cdf0e10cSrcweir {
1943cdf0e10cSrcweir bGrfIsTransparent = true;
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir }
1946cdf0e10cSrcweir
1947cdf0e10cSrcweir /// OD 06.08.2002 #99657# #GetTransChg# - to get color of brush,
1948cdf0e10cSrcweir /// check background color against COL_TRANSPARENT ("no fill"/"auto fill")
1949cdf0e10cSrcweir /// instead of checking, if transparency is not set.
1950cdf0e10cSrcweir const Color aColor( pBrush &&
1951cdf0e10cSrcweir ( !(pBrush->GetColor() == COL_TRANSPARENT) ||
1952cdf0e10cSrcweir bFlyMetafile )
1953cdf0e10cSrcweir ? pBrush->GetColor()
1954cdf0e10cSrcweir : aGlobalRetoucheColor );
1955cdf0e10cSrcweir
1956cdf0e10cSrcweir /// OD 08.08.2002 #99657# - determine, if background region have to be
1957cdf0e10cSrcweir /// drawn transparent.
1958cdf0e10cSrcweir /// background region has to be drawn transparent, if
1959cdf0e10cSrcweir /// background transparency have to be considered
1960cdf0e10cSrcweir /// AND
1961cdf0e10cSrcweir /// ( background color is transparent OR
1962cdf0e10cSrcweir /// background graphic is transparent and background color is "no fill"
1963cdf0e10cSrcweir /// )
1964cdf0e10cSrcweir sal_Bool bDrawTransparent = bConsiderBackgroundTransparency &&
1965cdf0e10cSrcweir ( ( aColor.GetTransparency() != 0) ||
1966cdf0e10cSrcweir bTransparentGrfWithNoFillBackgrd );
1967cdf0e10cSrcweir
1968cdf0e10cSrcweir // --> OD 2008-06-02 #i75614#
1969cdf0e10cSrcweir // reset draw mode in high contrast mode in order to get fill color set
1970cdf0e10cSrcweir const sal_uLong nOldDrawMode = pOutDev->GetDrawMode();
1971cdf0e10cSrcweir if ( pGlobalShell->GetWin() &&
1972cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1973cdf0e10cSrcweir {
1974cdf0e10cSrcweir pOutDev->SetDrawMode( 0 );
1975cdf0e10cSrcweir }
1976cdf0e10cSrcweir // <--
1977cdf0e10cSrcweir
1978cdf0e10cSrcweir /// OD 06.08.2002 #99657# - if background region have to be drawn
1979cdf0e10cSrcweir /// transparent, set only the RGB values of the background color as
1980cdf0e10cSrcweir /// the fill color for the output device.
1981cdf0e10cSrcweir if ( bDrawTransparent )
1982cdf0e10cSrcweir {
1983cdf0e10cSrcweir if( pOutDev->GetFillColor() != aColor.GetRGBColor() )
1984cdf0e10cSrcweir pOutDev->SetFillColor( aColor.GetRGBColor() );
1985cdf0e10cSrcweir }
1986cdf0e10cSrcweir else
1987cdf0e10cSrcweir {
1988cdf0e10cSrcweir if( pOutDev->GetFillColor() != aColor )
1989cdf0e10cSrcweir pOutDev->SetFillColor( aColor );
1990cdf0e10cSrcweir }
1991cdf0e10cSrcweir
1992cdf0e10cSrcweir // --> OD 2008-06-02 #i75614#
1993cdf0e10cSrcweir // restore draw mode
1994cdf0e10cSrcweir pOutDev->SetDrawMode( nOldDrawMode );
1995cdf0e10cSrcweir // <--
1996cdf0e10cSrcweir
1997cdf0e10cSrcweir /// OD 02.09.2002 #99657#
1998cdf0e10cSrcweir if ( bDrawTransparent )
1999cdf0e10cSrcweir {
2000cdf0e10cSrcweir /// background region have to be drawn transparent.
2001cdf0e10cSrcweir /// Thus, create a poly-polygon from the region and draw it with
2002cdf0e10cSrcweir /// the corresponding transparency precent.
2003cdf0e10cSrcweir PolyPolygon aDrawPoly( rOut.SVRect() );
2004cdf0e10cSrcweir if ( aGrf.HasArea() )
2005cdf0e10cSrcweir {
2006cdf0e10cSrcweir if ( !bGrfIsTransparent )
2007cdf0e10cSrcweir {
200886e1cf34SPedro Giffuni /// subtract area of background graphic from draw area
2009cdf0e10cSrcweir /// OD 08.10.2002 #103898# - consider only that part of the
2010cdf0e10cSrcweir /// graphic area that is overlapping with draw area.
2011cdf0e10cSrcweir SwRect aTmpGrf = aGrf;
2012cdf0e10cSrcweir aTmpGrf.Intersection( rOut );
2013cdf0e10cSrcweir if ( aTmpGrf.HasArea() )
2014cdf0e10cSrcweir {
2015cdf0e10cSrcweir Polygon aGrfPoly( aTmpGrf.SVRect() );
2016cdf0e10cSrcweir aDrawPoly.Insert( aGrfPoly );
2017cdf0e10cSrcweir }
2018cdf0e10cSrcweir }
2019cdf0e10cSrcweir else
2020cdf0e10cSrcweir bGrfBackgrdAlreadyDrawn = true;
2021cdf0e10cSrcweir }
2022cdf0e10cSrcweir /// calculate transparency percent:
2023cdf0e10cSrcweir /// ( <transparency value[0x01..0xFF]>*100 + 0x7F ) / 0xFF
2024cdf0e10cSrcweir /// If there is a background graphic with a background color "no fill"/"auto fill",
2025cdf0e10cSrcweir /// the transparency value is taken from the background graphic,
2026cdf0e10cSrcweir /// otherwise take the transparency value from the color.
2027cdf0e10cSrcweir sal_Int8 nTransparencyPercent = static_cast<sal_Int8>(
2028cdf0e10cSrcweir (( bTransparentGrfWithNoFillBackgrd ? nGrfTransparency : aColor.GetTransparency()
2029cdf0e10cSrcweir )*100 + 0x7F)/0xFF);
2030cdf0e10cSrcweir /// draw poly-polygon transparent
2031cdf0e10cSrcweir pOutDev->DrawTransparent( aDrawPoly, nTransparencyPercent );
2032cdf0e10cSrcweir }
2033cdf0e10cSrcweir else
2034cdf0e10cSrcweir {
2035cdf0e10cSrcweir SwRegionRects aRegion( rOut, 4 );
2036cdf0e10cSrcweir if ( !bGrfIsTransparent )
2037cdf0e10cSrcweir aRegion -= aGrf;
2038cdf0e10cSrcweir else
2039cdf0e10cSrcweir bGrfBackgrdAlreadyDrawn = true;
2040cdf0e10cSrcweir /// loop rectangles of background region, which has to be drawn
2041cdf0e10cSrcweir for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
2042cdf0e10cSrcweir {
2043cdf0e10cSrcweir pOutDev->DrawRect( aRegion[i].SVRect() );
2044cdf0e10cSrcweir }
2045cdf0e10cSrcweir }
2046cdf0e10cSrcweir pOutDev ->Pop();
2047cdf0e10cSrcweir }
2048cdf0e10cSrcweir
2049cdf0e10cSrcweir if( bDraw && aGrf.IsOver( rOut ) )
2050cdf0e10cSrcweir /// OD 02.09.2002 #99657#
2051cdf0e10cSrcweir /// add parameter <bGrfBackgrdAlreadyDrawn>
2052cdf0e10cSrcweir lcl_DrawGraphic( *pBrush, pOutDev, rSh, aGrf, rOut, true, bGrfNum,
2053cdf0e10cSrcweir bGrfBackgrdAlreadyDrawn );
2054cdf0e10cSrcweir
2055cdf0e10cSrcweir if( bReplaceGrfNum )
2056cdf0e10cSrcweir {
2057cdf0e10cSrcweir const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( false );
2058cdf0e10cSrcweir Font aTmp( pOutDev->GetFont() );
2059cdf0e10cSrcweir Graphic::DrawEx( pOutDev, aEmptyStr, aTmp, rBmp, rOrg.Pos(), rOrg.SSize() );
2060cdf0e10cSrcweir }
2061cdf0e10cSrcweir }
2062cdf0e10cSrcweir
2063cdf0e10cSrcweir //------------------------------------------------------------------------
2064cdf0e10cSrcweir
2065cdf0e10cSrcweir /** local help method for SwRootFrm::Paint(..) - Adjust given rectangle to pixel size
2066cdf0e10cSrcweir
2067cdf0e10cSrcweir By OD at 27.09.2002 for #103636#
2068cdf0e10cSrcweir In order to avoid paint errors caused by multiple alignments - e.g. method
2069cdf0e10cSrcweir ::SwAlignRect(..) - and other changes to the rectangle to be painted,
2070cdf0e10cSrcweir this method is called for the rectangle to be painted in order to
2071cdf0e10cSrcweir adjust it to the pixel it is overlapping.
2072cdf0e10cSrcweir
2073cdf0e10cSrcweir @author OD
2074cdf0e10cSrcweir */
lcl_AdjustRectToPixelSize(SwRect & io_aSwRect,const OutputDevice & aOut)2075cdf0e10cSrcweir void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const OutputDevice &aOut )
2076cdf0e10cSrcweir {
2077cdf0e10cSrcweir /// local constant object of class <Size> to determine number of Twips
2078cdf0e10cSrcweir /// representing a pixel.
2079cdf0e10cSrcweir const Size aTwipToPxSize( aOut.PixelToLogic( Size( 1,1 )) );
2080cdf0e10cSrcweir
2081cdf0e10cSrcweir /// local object of class <Rectangle> in Twip coordinates
2082cdf0e10cSrcweir /// calculated from given rectangle aligned to pixel centers.
2083cdf0e10cSrcweir const Rectangle aPxCenterRect = aOut.PixelToLogic(
2084cdf0e10cSrcweir aOut.LogicToPixel( io_aSwRect.SVRect() ) );
2085cdf0e10cSrcweir
2086cdf0e10cSrcweir /// local constant object of class <Rectangle> representing given rectangle
2087cdf0e10cSrcweir /// in pixel.
2088cdf0e10cSrcweir const Rectangle aOrgPxRect = aOut.LogicToPixel( io_aSwRect.SVRect() );
2089cdf0e10cSrcweir
2090cdf0e10cSrcweir /// calculate adjusted rectangle from pixel centered rectangle.
2091cdf0e10cSrcweir /// Due to rounding differences <aPxCenterRect> doesn't exactly represents
2092cdf0e10cSrcweir /// the Twip-centers. Thus, adjust borders by half of pixel width/height plus 1.
2093cdf0e10cSrcweir /// Afterwards, adjust calculated Twip-positions of the all borders.
2094cdf0e10cSrcweir Rectangle aSizedRect = aPxCenterRect;
2095cdf0e10cSrcweir aSizedRect.Left() -= (aTwipToPxSize.Width()/2 + 1);
2096cdf0e10cSrcweir aSizedRect.Right() += (aTwipToPxSize.Width()/2 + 1);
2097cdf0e10cSrcweir aSizedRect.Top() -= (aTwipToPxSize.Height()/2 + 1);
2098cdf0e10cSrcweir aSizedRect.Bottom() += (aTwipToPxSize.Height()/2 + 1);
2099cdf0e10cSrcweir
2100cdf0e10cSrcweir /// adjust left()
2101cdf0e10cSrcweir while ( (aOut.LogicToPixel(aSizedRect)).Left() < aOrgPxRect.Left() )
2102cdf0e10cSrcweir {
2103cdf0e10cSrcweir ++aSizedRect.Left();
2104cdf0e10cSrcweir }
2105cdf0e10cSrcweir /// adjust right()
2106cdf0e10cSrcweir while ( (aOut.LogicToPixel(aSizedRect)).Right() > aOrgPxRect.Right() )
2107cdf0e10cSrcweir {
2108cdf0e10cSrcweir --aSizedRect.Right();
2109cdf0e10cSrcweir }
2110cdf0e10cSrcweir /// adjust top()
2111cdf0e10cSrcweir while ( (aOut.LogicToPixel(aSizedRect)).Top() < aOrgPxRect.Top() )
2112cdf0e10cSrcweir {
2113cdf0e10cSrcweir ++aSizedRect.Top();
2114cdf0e10cSrcweir }
2115cdf0e10cSrcweir /// adjust bottom()
2116cdf0e10cSrcweir while ( (aOut.LogicToPixel(aSizedRect)).Bottom() > aOrgPxRect.Bottom() )
2117cdf0e10cSrcweir {
2118cdf0e10cSrcweir --aSizedRect.Bottom();
2119cdf0e10cSrcweir }
2120cdf0e10cSrcweir
2121cdf0e10cSrcweir io_aSwRect = SwRect( aSizedRect );
2122cdf0e10cSrcweir
2123cdf0e10cSrcweir #ifdef DBG_UTIL
2124cdf0e10cSrcweir Rectangle aTestOrgPxRect = aOut.LogicToPixel( io_aSwRect.SVRect() );
2125cdf0e10cSrcweir Rectangle aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2126cdf0e10cSrcweir ASSERT( aTestOrgPxRect == aTestNewPxRect,
2127cdf0e10cSrcweir "Error in lcl_AlignRectToPixelSize(..): Adjusted rectangle has incorrect position or size");
2128cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
2129cdf0e10cSrcweir Rectangle aTestNewRect( aSizedRect );
2130cdf0e10cSrcweir /// check Left()
2131cdf0e10cSrcweir --aSizedRect.Left();
2132cdf0e10cSrcweir aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2133cdf0e10cSrcweir ASSERT( aTestOrgPxRect.Left() >= (aTestNewPxRect.Left()+1),
2134cdf0e10cSrcweir "Error in lcl_AlignRectToPixelSize(..): Left() not correct adjusted");
2135cdf0e10cSrcweir ++aSizedRect.Left();
2136cdf0e10cSrcweir /// check Right()
2137cdf0e10cSrcweir ++aSizedRect.Right();
2138cdf0e10cSrcweir aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2139cdf0e10cSrcweir ASSERT( aTestOrgPxRect.Right() <= (aTestNewPxRect.Right()-1),
2140cdf0e10cSrcweir "Error in lcl_AlignRectToPixelSize(..): Right() not correct adjusted");
2141cdf0e10cSrcweir --aSizedRect.Right();
2142cdf0e10cSrcweir /// check Top()
2143cdf0e10cSrcweir --aSizedRect.Top();
2144cdf0e10cSrcweir aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2145cdf0e10cSrcweir ASSERT( aTestOrgPxRect.Top() >= (aTestNewPxRect.Top()+1),
2146cdf0e10cSrcweir "Error in lcl_AlignRectToPixelSize(..): Top() not correct adjusted");
2147cdf0e10cSrcweir ++aSizedRect.Top();
2148cdf0e10cSrcweir /// check Bottom()
2149cdf0e10cSrcweir ++aSizedRect.Bottom();
2150cdf0e10cSrcweir aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2151cdf0e10cSrcweir ASSERT( aTestOrgPxRect.Bottom() <= (aTestNewPxRect.Bottom()-1),
2152cdf0e10cSrcweir "Error in lcl_AlignRectToPixelSize(..): Bottom() not correct adjusted");
2153cdf0e10cSrcweir --aSizedRect.Bottom();
2154cdf0e10cSrcweir #endif
2155cdf0e10cSrcweir #endif
2156cdf0e10cSrcweir }
2157cdf0e10cSrcweir
2158cdf0e10cSrcweir
2159cdf0e10cSrcweir //
2160cdf0e10cSrcweir // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES START
2161cdf0e10cSrcweir //
2162cdf0e10cSrcweir
2163cdf0e10cSrcweir struct SwLineEntry
2164cdf0e10cSrcweir {
2165cdf0e10cSrcweir SwTwips mnKey;
2166cdf0e10cSrcweir SwTwips mnStartPos;
2167cdf0e10cSrcweir SwTwips mnEndPos;
2168cdf0e10cSrcweir
2169cdf0e10cSrcweir svx::frame::Style maAttribute;
2170cdf0e10cSrcweir
2171cdf0e10cSrcweir enum OverlapType { NO_OVERLAP, OVERLAP1, OVERLAP2, OVERLAP3 };
2172cdf0e10cSrcweir
2173cdf0e10cSrcweir public:
2174cdf0e10cSrcweir SwLineEntry( SwTwips nKey,
2175cdf0e10cSrcweir SwTwips nStartPos,
2176cdf0e10cSrcweir SwTwips nEndPos,
2177cdf0e10cSrcweir const svx::frame::Style& rAttribute );
2178cdf0e10cSrcweir
2179cdf0e10cSrcweir OverlapType Overlaps( const SwLineEntry& rComp ) const;
2180cdf0e10cSrcweir };
2181cdf0e10cSrcweir
SwLineEntry(SwTwips nKey,SwTwips nStartPos,SwTwips nEndPos,const svx::frame::Style & rAttribute)2182cdf0e10cSrcweir SwLineEntry::SwLineEntry( SwTwips nKey,
2183cdf0e10cSrcweir SwTwips nStartPos,
2184cdf0e10cSrcweir SwTwips nEndPos,
2185cdf0e10cSrcweir const svx::frame::Style& rAttribute )
2186cdf0e10cSrcweir : mnKey( nKey ),
2187cdf0e10cSrcweir mnStartPos( nStartPos ),
2188cdf0e10cSrcweir mnEndPos( nEndPos ),
2189cdf0e10cSrcweir maAttribute( rAttribute )
2190cdf0e10cSrcweir {
2191cdf0e10cSrcweir }
2192cdf0e10cSrcweir
2193cdf0e10cSrcweir /*
2194cdf0e10cSrcweir
2195cdf0e10cSrcweir 1. ---------- rOld
2196cdf0e10cSrcweir ---------- rNew
2197cdf0e10cSrcweir
2198cdf0e10cSrcweir 2. ---------- rOld
2199cdf0e10cSrcweir ------------- rNew
2200cdf0e10cSrcweir
2201cdf0e10cSrcweir 3. ------- rOld
2202cdf0e10cSrcweir ------------- rNew
2203cdf0e10cSrcweir
2204cdf0e10cSrcweir 4. ------------- rOld
2205cdf0e10cSrcweir ---------- rNew
2206cdf0e10cSrcweir
2207cdf0e10cSrcweir 5. ---------- rOld
2208cdf0e10cSrcweir ---- rNew
2209cdf0e10cSrcweir
2210cdf0e10cSrcweir 6. ---------- rOld
2211cdf0e10cSrcweir ---------- rNew
2212cdf0e10cSrcweir
2213cdf0e10cSrcweir 7. ------------- rOld
2214cdf0e10cSrcweir ---------- rNew
2215cdf0e10cSrcweir
2216cdf0e10cSrcweir 8. ---------- rOld
2217cdf0e10cSrcweir ------------- rNew
2218cdf0e10cSrcweir
2219cdf0e10cSrcweir 9. ---------- rOld
2220cdf0e10cSrcweir ---------- rNew
2221cdf0e10cSrcweir */
2222cdf0e10cSrcweir
Overlaps(const SwLineEntry & rNew) const2223cdf0e10cSrcweir SwLineEntry::OverlapType SwLineEntry::Overlaps( const SwLineEntry& rNew ) const
2224cdf0e10cSrcweir {
2225cdf0e10cSrcweir SwLineEntry::OverlapType eRet = OVERLAP3;
2226cdf0e10cSrcweir
2227cdf0e10cSrcweir if ( mnStartPos >= rNew.mnEndPos || mnEndPos <= rNew.mnStartPos )
2228cdf0e10cSrcweir eRet = NO_OVERLAP;
2229cdf0e10cSrcweir
2230cdf0e10cSrcweir // 1, 2, 3
2231cdf0e10cSrcweir else if ( mnEndPos < rNew.mnEndPos )
2232cdf0e10cSrcweir eRet = OVERLAP1;
2233cdf0e10cSrcweir
2234cdf0e10cSrcweir // 4, 5, 6, 7
2235cdf0e10cSrcweir else if ( mnStartPos <= rNew.mnStartPos && mnEndPos >= rNew.mnEndPos )
2236cdf0e10cSrcweir eRet = OVERLAP2;
2237cdf0e10cSrcweir
2238cdf0e10cSrcweir // 8, 9
2239cdf0e10cSrcweir return eRet;
2240cdf0e10cSrcweir }
2241cdf0e10cSrcweir
2242cdf0e10cSrcweir struct lt_SwLineEntry
2243cdf0e10cSrcweir {
operator ()lt_SwLineEntry2244cdf0e10cSrcweir bool operator()( const SwLineEntry& e1, const SwLineEntry& e2 ) const
2245cdf0e10cSrcweir {
2246cdf0e10cSrcweir return e1.mnStartPos < e2.mnStartPos;
2247cdf0e10cSrcweir }
2248cdf0e10cSrcweir };
2249cdf0e10cSrcweir
2250cdf0e10cSrcweir typedef std::set< SwLineEntry, lt_SwLineEntry > SwLineEntrySet;
2251cdf0e10cSrcweir typedef std::set< SwLineEntry, lt_SwLineEntry >::iterator SwLineEntrySetIter;
2252cdf0e10cSrcweir typedef std::set< SwLineEntry, lt_SwLineEntry >::const_iterator SwLineEntrySetConstIter;
2253cdf0e10cSrcweir typedef std::map< SwTwips, SwLineEntrySet > SwLineEntryMap;
2254cdf0e10cSrcweir typedef std::map< SwTwips, SwLineEntrySet >::iterator SwLineEntryMapIter;
2255cdf0e10cSrcweir typedef std::map< SwTwips, SwLineEntrySet >::const_iterator SwLineEntryMapConstIter;
2256cdf0e10cSrcweir
2257cdf0e10cSrcweir class SwTabFrmPainter
2258cdf0e10cSrcweir {
2259cdf0e10cSrcweir SwLineEntryMap maVertLines;
2260cdf0e10cSrcweir SwLineEntryMap maHoriLines;
2261cdf0e10cSrcweir const SwTabFrm& mrTabFrm;
2262cdf0e10cSrcweir
2263cdf0e10cSrcweir void Insert( SwLineEntry&, bool bHori );
2264cdf0e10cSrcweir void Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem );
2265cdf0e10cSrcweir void HandleFrame( const SwLayoutFrm& rFrm );
2266cdf0e10cSrcweir void FindStylesForLine( const Point&,
2267cdf0e10cSrcweir const Point&,
2268cdf0e10cSrcweir svx::frame::Style*,
2269cdf0e10cSrcweir bool bHori ) const;
2270cdf0e10cSrcweir
2271cdf0e10cSrcweir public:
2272cdf0e10cSrcweir SwTabFrmPainter( const SwTabFrm& rTabFrm );
2273cdf0e10cSrcweir
2274cdf0e10cSrcweir void PaintLines( OutputDevice& rDev, const SwRect& rRect ) const;
2275cdf0e10cSrcweir };
2276cdf0e10cSrcweir
SwTabFrmPainter(const SwTabFrm & rTabFrm)2277cdf0e10cSrcweir SwTabFrmPainter::SwTabFrmPainter( const SwTabFrm& rTabFrm )
2278cdf0e10cSrcweir : mrTabFrm( rTabFrm )
2279cdf0e10cSrcweir {
2280cdf0e10cSrcweir HandleFrame( rTabFrm );
2281cdf0e10cSrcweir }
2282cdf0e10cSrcweir
HandleFrame(const SwLayoutFrm & rLayoutFrm)2283cdf0e10cSrcweir void SwTabFrmPainter::HandleFrame( const SwLayoutFrm& rLayoutFrm )
2284cdf0e10cSrcweir {
2285cdf0e10cSrcweir // Add border lines of cell frames. Skip covered cells. Skip cells
2286cdf0e10cSrcweir // in special row span row, which do not have a negative row span:
2287cdf0e10cSrcweir if ( rLayoutFrm.IsCellFrm() && !rLayoutFrm.IsCoveredCell() )
2288cdf0e10cSrcweir {
2289cdf0e10cSrcweir const SwCellFrm* pThisCell = static_cast<const SwCellFrm*>(&rLayoutFrm);
2290cdf0e10cSrcweir const SwRowFrm* pRowFrm = static_cast<const SwRowFrm*>(pThisCell->GetUpper());
2291cdf0e10cSrcweir const long nRowSpan = pThisCell->GetTabBox()->getRowSpan();
2292cdf0e10cSrcweir if ( !pRowFrm->IsRowSpanLine() || nRowSpan > 1 || nRowSpan < -1 )
2293cdf0e10cSrcweir {
2294cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), &rLayoutFrm );
2295cdf0e10cSrcweir const SwBorderAttrs& rAttrs = *aAccess.Get();
2296cdf0e10cSrcweir const SvxBoxItem& rBox = rAttrs.GetBox();
2297cdf0e10cSrcweir Insert( rLayoutFrm, rBox );
2298cdf0e10cSrcweir }
2299cdf0e10cSrcweir }
2300cdf0e10cSrcweir
2301cdf0e10cSrcweir // Recurse into lower layout frames, but do not recurse into lower tabframes.
2302cdf0e10cSrcweir const SwFrm* pLower = rLayoutFrm.Lower();
2303cdf0e10cSrcweir while ( pLower )
2304cdf0e10cSrcweir {
2305cdf0e10cSrcweir const SwLayoutFrm* pLowerLayFrm = dynamic_cast<const SwLayoutFrm*>(pLower);
2306cdf0e10cSrcweir if ( pLowerLayFrm && !pLowerLayFrm->IsTabFrm() )
2307cdf0e10cSrcweir HandleFrame( *pLowerLayFrm );
2308cdf0e10cSrcweir
2309cdf0e10cSrcweir pLower = pLower->GetNext();
2310cdf0e10cSrcweir }
2311cdf0e10cSrcweir }
2312cdf0e10cSrcweir
PaintLines(OutputDevice & rDev,const SwRect & rRect) const2313cdf0e10cSrcweir void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) const
2314cdf0e10cSrcweir {
2315cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
2316cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, rDev );
2317cdf0e10cSrcweir // <--
2318cdf0e10cSrcweir
2319cdf0e10cSrcweir const SwFrm* pTmpFrm = &mrTabFrm;
2320cdf0e10cSrcweir const bool bVert = pTmpFrm->IsVertical();
2321cdf0e10cSrcweir
2322cdf0e10cSrcweir SwLineEntryMapConstIter aIter = maHoriLines.begin();
2323cdf0e10cSrcweir bool bHori = true;
2324cdf0e10cSrcweir
2325cdf0e10cSrcweir // color for subsidiary lines:
2326cdf0e10cSrcweir const Color& rCol( SwViewOption::GetTableBoundariesColor() );
2327cdf0e10cSrcweir
2328cdf0e10cSrcweir // high contrast mode:
2329cdf0e10cSrcweir // overrides the color of non-subsidiary lines.
2330cdf0e10cSrcweir const Color* pHCColor = 0;
2331cdf0e10cSrcweir sal_uLong nOldDrawMode = rDev.GetDrawMode();
2332cdf0e10cSrcweir if( pGlobalShell->GetWin() &&
2333cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
2334cdf0e10cSrcweir {
2335cdf0e10cSrcweir pHCColor = &SwViewOption::GetFontColor();
2336cdf0e10cSrcweir rDev.SetDrawMode( 0 );
2337cdf0e10cSrcweir }
2338cdf0e10cSrcweir
2339cdf0e10cSrcweir // set clip region:
2340cdf0e10cSrcweir rDev.Push( PUSH_CLIPREGION );
2341cdf0e10cSrcweir Size aSize( rRect.SSize() );
2342cdf0e10cSrcweir // Hack! Necessary, because the layout is not pixel aligned!
2343cdf0e10cSrcweir aSize.Width() += nPixelSzW; aSize.Height() += nPixelSzH;
2344cdf0e10cSrcweir rDev.SetClipRegion( Rectangle( rRect.Pos(), aSize ) );
2345cdf0e10cSrcweir
2346cdf0e10cSrcweir // The following stuff if necessary to have the new table borders fit
2347cdf0e10cSrcweir // into a ::SwAlignRect adjusted world.
2348cdf0e10cSrcweir const SwTwips nTwipXCorr = bVert ? 0 : Max( 0L, nHalfPixelSzW - 2 ); // 1 < 2 < 3 ;-)
2349cdf0e10cSrcweir const SwTwips nTwipYCorr = !bVert ? 0 : Max( 0L, nHalfPixelSzW - 2 ); // 1 < 2 < 3 ;-)
2350cdf0e10cSrcweir const SwFrm* pUpper = mrTabFrm.GetUpper();
2351cdf0e10cSrcweir SwRect aUpper( pUpper->Prt() );
2352cdf0e10cSrcweir aUpper.Pos() += pUpper->Frm().Pos();
2353cdf0e10cSrcweir SwRect aUpperAligned( aUpper );
2354cdf0e10cSrcweir ::SwAlignRect( aUpperAligned, pGlobalShell );
2355cdf0e10cSrcweir
2356cdf0e10cSrcweir while ( true )
2357cdf0e10cSrcweir {
2358cdf0e10cSrcweir if ( bHori && aIter == maHoriLines.end() )
2359cdf0e10cSrcweir {
2360cdf0e10cSrcweir aIter = maVertLines.begin();
2361cdf0e10cSrcweir bHori = false;
2362cdf0e10cSrcweir }
2363cdf0e10cSrcweir
2364cdf0e10cSrcweir if ( !bHori && aIter == maVertLines.end() )
2365cdf0e10cSrcweir break;
2366cdf0e10cSrcweir
2367cdf0e10cSrcweir const SwLineEntrySet& rEntrySet = (*aIter).second;
236824b62240SHerbert Dürr SwLineEntrySetConstIter aSetIter = rEntrySet.begin();
2369cdf0e10cSrcweir while ( aSetIter != rEntrySet.end() )
2370cdf0e10cSrcweir {
2371cdf0e10cSrcweir const SwLineEntry& rEntry = *aSetIter;
2372cdf0e10cSrcweir const svx::frame::Style& rEntryStyle( (*aSetIter).maAttribute );
2373cdf0e10cSrcweir
2374cdf0e10cSrcweir Point aStart, aEnd;
2375cdf0e10cSrcweir if ( bHori )
2376cdf0e10cSrcweir {
2377cdf0e10cSrcweir aStart.X() = rEntry.mnStartPos;
2378cdf0e10cSrcweir aStart.Y() = rEntry.mnKey;
2379cdf0e10cSrcweir aEnd.X() = rEntry.mnEndPos;
2380cdf0e10cSrcweir aEnd.Y() = rEntry.mnKey;
2381cdf0e10cSrcweir }
2382cdf0e10cSrcweir else
2383cdf0e10cSrcweir {
2384cdf0e10cSrcweir aStart.X() = rEntry.mnKey;
2385cdf0e10cSrcweir aStart.Y() = rEntry.mnStartPos;
2386cdf0e10cSrcweir aEnd.X() = rEntry.mnKey;
2387cdf0e10cSrcweir aEnd.Y() = rEntry.mnEndPos;
2388cdf0e10cSrcweir }
2389cdf0e10cSrcweir
2390cdf0e10cSrcweir SwRect aRepaintRect( aStart, aEnd );
2391cdf0e10cSrcweir
2392cdf0e10cSrcweir // the repaint rectangle has to be moved a bit for the centered lines:
2393cdf0e10cSrcweir SwTwips nRepaintRectSize = !rEntryStyle.GetWidth() ? 1 : rEntryStyle.GetWidth();
2394cdf0e10cSrcweir if ( bHori )
2395cdf0e10cSrcweir {
2396cdf0e10cSrcweir aRepaintRect.Height( 2 * nRepaintRectSize );
2397cdf0e10cSrcweir aRepaintRect.Pos().Y() -= nRepaintRectSize;
2398cdf0e10cSrcweir }
2399cdf0e10cSrcweir else
2400cdf0e10cSrcweir {
2401cdf0e10cSrcweir aRepaintRect.Width( 2 * nRepaintRectSize );
2402cdf0e10cSrcweir aRepaintRect.Pos().X() -= nRepaintRectSize;
2403cdf0e10cSrcweir }
2404cdf0e10cSrcweir
2405cdf0e10cSrcweir if ( rRect.IsOver( aRepaintRect ) )
2406cdf0e10cSrcweir {
2407cdf0e10cSrcweir svx::frame::Style aStyles[ 7 ];
2408cdf0e10cSrcweir aStyles[ 0 ] = rEntryStyle;
2409cdf0e10cSrcweir FindStylesForLine( aStart, aEnd, aStyles, bHori );
2410cdf0e10cSrcweir
2411cdf0e10cSrcweir // subsidiary lines
2412cdf0e10cSrcweir const Color* pTmpColor = 0;
2413cdf0e10cSrcweir if ( 0 == aStyles[ 0 ].GetWidth() )
2414cdf0e10cSrcweir {
2415cdf0e10cSrcweir if ( IS_SUBS_TABLE && pGlobalShell->GetWin() )
2416cdf0e10cSrcweir aStyles[ 0 ].Set( rCol, 1, 0, 0 );
2417cdf0e10cSrcweir }
2418cdf0e10cSrcweir else
2419cdf0e10cSrcweir pTmpColor = pHCColor;
2420cdf0e10cSrcweir
2421cdf0e10cSrcweir // The line sizes stored in the line style have to be adjusted as well.
2422cdf0e10cSrcweir // This will guarantee that lines with the same twip size will have the
2423cdf0e10cSrcweir // same pixel size.
2424cdf0e10cSrcweir for ( int i = 0; i < 7; ++i )
2425cdf0e10cSrcweir {
2426cdf0e10cSrcweir sal_uInt16 nPrim = aStyles[ i ].Prim();
2427cdf0e10cSrcweir sal_uInt16 nDist = aStyles[ i ].Dist();
2428cdf0e10cSrcweir sal_uInt16 nSecn = aStyles[ i ].Secn();
2429cdf0e10cSrcweir
2430cdf0e10cSrcweir if ( nPrim > 0 )
2431cdf0e10cSrcweir nPrim = (sal_uInt16)( Max( 1L, nPixelSzH * ( nPrim / nPixelSzH ) ) );
2432cdf0e10cSrcweir if ( nDist > 0 )
2433cdf0e10cSrcweir nDist = (sal_uInt16)( Max( 1L, nPixelSzH * ( nDist / nPixelSzH ) ) );
2434cdf0e10cSrcweir if ( nSecn > 0 )
2435cdf0e10cSrcweir nSecn = (sal_uInt16)( Max( 1L, nPixelSzH * ( nSecn / nPixelSzH ) ) );
2436cdf0e10cSrcweir
2437cdf0e10cSrcweir aStyles[ i ].Set( nPrim, nDist, nSecn );
2438cdf0e10cSrcweir }
2439cdf0e10cSrcweir
2440cdf0e10cSrcweir // The (twip) positions will be adjusted to meet these requirements:
2441cdf0e10cSrcweir // 1. The y coordinates are located in the middle of the pixel grid
2442cdf0e10cSrcweir // 2. The x coordinated are located at the beginning of the pixel grid
2443cdf0e10cSrcweir // This is done, because the horizontal lines are painted "at beginning",
2444cdf0e10cSrcweir // whereas the vertical lines are painted "centered". By making the line
2445cdf0e10cSrcweir // sizes a multiple of one pixel size, we can assure, that all lines having
2446cdf0e10cSrcweir // the same twip size have the same pixel size, independent of their position
2447cdf0e10cSrcweir // on the screen.
2448cdf0e10cSrcweir Point aPaintStart = rDev.PixelToLogic( rDev.LogicToPixel( aStart ) );
2449cdf0e10cSrcweir Point aPaintEnd = rDev.PixelToLogic( rDev.LogicToPixel( aEnd ) );
2450cdf0e10cSrcweir
2451cdf0e10cSrcweir if( pGlobalShell->GetWin() )
2452cdf0e10cSrcweir {
2453cdf0e10cSrcweir // The table borders do not use SwAlignRect, but all the other frames do.
2454cdf0e10cSrcweir // Therefore we tweak the outer borders a bit to achieve that the outer
2455cdf0e10cSrcweir // borders match the subsidiary lines of the upper:
2456cdf0e10cSrcweir if ( aStart.X() == aUpper.Left() )
2457cdf0e10cSrcweir aPaintStart.X() = aUpperAligned.Left();
2458cdf0e10cSrcweir else if ( aStart.X() == aUpper._Right() )
2459cdf0e10cSrcweir aPaintStart.X() = aUpperAligned._Right();
2460cdf0e10cSrcweir if ( aStart.Y() == aUpper.Top() )
2461cdf0e10cSrcweir aPaintStart.Y() = aUpperAligned.Top();
2462cdf0e10cSrcweir else if ( aStart.Y() == aUpper._Bottom() )
2463cdf0e10cSrcweir aPaintStart.Y() = aUpperAligned._Bottom();
2464cdf0e10cSrcweir
2465cdf0e10cSrcweir if ( aEnd.X() == aUpper.Left() )
2466cdf0e10cSrcweir aPaintEnd.X() = aUpperAligned.Left();
2467cdf0e10cSrcweir else if ( aEnd.X() == aUpper._Right() )
2468cdf0e10cSrcweir aPaintEnd.X() = aUpperAligned._Right();
2469cdf0e10cSrcweir if ( aEnd.Y() == aUpper.Top() )
2470cdf0e10cSrcweir aPaintEnd.Y() = aUpperAligned.Top();
2471cdf0e10cSrcweir else if ( aEnd.Y() == aUpper._Bottom() )
2472cdf0e10cSrcweir aPaintEnd.Y() = aUpperAligned._Bottom();
2473cdf0e10cSrcweir }
2474cdf0e10cSrcweir
2475cdf0e10cSrcweir aPaintStart.X() -= nTwipXCorr; // nHalfPixelSzW - 2 to assure that we do not leave the pixel
2476cdf0e10cSrcweir aPaintEnd.X() -= nTwipXCorr;
2477cdf0e10cSrcweir aPaintStart.Y() -= nTwipYCorr;
2478cdf0e10cSrcweir aPaintEnd.Y() -= nTwipYCorr;
2479cdf0e10cSrcweir
2480cdf0e10cSrcweir // Here comes the painting stuff: Thank you, DR, great job!!!
2481cdf0e10cSrcweir if ( bHori )
2482cdf0e10cSrcweir {
2483cdf0e10cSrcweir svx::frame::DrawHorFrameBorder
2484cdf0e10cSrcweir (
2485cdf0e10cSrcweir rDev,
2486cdf0e10cSrcweir aPaintStart,
2487cdf0e10cSrcweir aPaintEnd,
2488cdf0e10cSrcweir aStyles[ 0 ], // current style
2489cdf0e10cSrcweir aStyles[ 1 ], // aLFromT
2490cdf0e10cSrcweir aStyles[ 2 ], // aLFromL
2491cdf0e10cSrcweir aStyles[ 3 ], // aLFromB
2492cdf0e10cSrcweir aStyles[ 4 ], // aRFromT
2493cdf0e10cSrcweir aStyles[ 5 ], // aRFromR
2494cdf0e10cSrcweir aStyles[ 6 ], // aRFromB
2495cdf0e10cSrcweir pTmpColor
2496cdf0e10cSrcweir );
2497cdf0e10cSrcweir }
2498cdf0e10cSrcweir else
2499cdf0e10cSrcweir {
2500cdf0e10cSrcweir svx::frame::DrawVerFrameBorder
2501cdf0e10cSrcweir (
2502cdf0e10cSrcweir rDev,
2503cdf0e10cSrcweir aPaintStart,
2504cdf0e10cSrcweir aPaintEnd,
2505cdf0e10cSrcweir aStyles[ 0 ], // current style
2506cdf0e10cSrcweir aStyles[ 1 ], // aTFromL
2507cdf0e10cSrcweir aStyles[ 2 ], // aTFromT
2508cdf0e10cSrcweir aStyles[ 3 ], // aTFromR
2509cdf0e10cSrcweir aStyles[ 4 ], // aBFromL
2510cdf0e10cSrcweir aStyles[ 5 ], // aBFromB
2511cdf0e10cSrcweir aStyles[ 6 ], // aBFromR
2512cdf0e10cSrcweir pTmpColor
2513cdf0e10cSrcweir );
2514cdf0e10cSrcweir }
2515cdf0e10cSrcweir }
2516cdf0e10cSrcweir
2517cdf0e10cSrcweir ++aSetIter;
2518cdf0e10cSrcweir }
2519cdf0e10cSrcweir
2520cdf0e10cSrcweir ++aIter;
2521cdf0e10cSrcweir }
2522cdf0e10cSrcweir
2523cdf0e10cSrcweir // restore output device:
2524cdf0e10cSrcweir rDev.Pop();
2525cdf0e10cSrcweir rDev.SetDrawMode( nOldDrawMode );
2526cdf0e10cSrcweir }
2527cdf0e10cSrcweir
2528cdf0e10cSrcweir // Finds the lines that join the line defined by (StartPoint, EndPoint) in either
2529cdf0e10cSrcweir // StartPoint or Endpoint. The styles of these lines are required for DR's magic
2530cdf0e10cSrcweir // line painting functions.
FindStylesForLine(const Point & rStartPoint,const Point & rEndPoint,svx::frame::Style * pStyles,bool bHori) const2531cdf0e10cSrcweir void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint,
2532cdf0e10cSrcweir const Point& rEndPoint,
2533cdf0e10cSrcweir svx::frame::Style* pStyles,
2534cdf0e10cSrcweir bool bHori ) const
2535cdf0e10cSrcweir {
2536cdf0e10cSrcweir // pStyles[ 1 ] = bHori ? aLFromT : TFromL
2537cdf0e10cSrcweir // pStyles[ 2 ] = bHori ? aLFromL : TFromT,
2538cdf0e10cSrcweir // pStyles[ 3 ] = bHori ? aLFromB : TFromR,
2539cdf0e10cSrcweir // pStyles[ 4 ] = bHori ? aRFromT : BFromL,
2540cdf0e10cSrcweir // pStyles[ 5 ] = bHori ? aRFromR : BFromB,
2541cdf0e10cSrcweir // pStyles[ 6 ] = bHori ? aRFromB : BFromR,
2542cdf0e10cSrcweir
2543cdf0e10cSrcweir SwLineEntryMapConstIter aMapIter = maVertLines.find( rStartPoint.X() );
2544cdf0e10cSrcweir ASSERT( aMapIter != maVertLines.end(), "FindStylesForLine: Error" )
2545cdf0e10cSrcweir const SwLineEntrySet& rVertSet = (*aMapIter).second;
2546cdf0e10cSrcweir SwLineEntrySetConstIter aIter = rVertSet.begin();
2547cdf0e10cSrcweir
2548cdf0e10cSrcweir while ( aIter != rVertSet.end() )
2549cdf0e10cSrcweir {
2550cdf0e10cSrcweir const SwLineEntry& rEntry = *aIter;
2551cdf0e10cSrcweir if ( bHori )
2552cdf0e10cSrcweir {
2553cdf0e10cSrcweir if ( rStartPoint.Y() == rEntry.mnStartPos )
2554cdf0e10cSrcweir pStyles[ 3 ] = rEntry.maAttribute;
2555cdf0e10cSrcweir else if ( rStartPoint.Y() == rEntry.mnEndPos )
2556cdf0e10cSrcweir pStyles[ 1 ] = rEntry.maAttribute;
2557cdf0e10cSrcweir }
2558cdf0e10cSrcweir else
2559cdf0e10cSrcweir {
2560cdf0e10cSrcweir if ( rStartPoint.Y() == rEntry.mnEndPos )
2561cdf0e10cSrcweir pStyles[ 2 ] = rEntry.maAttribute;
2562cdf0e10cSrcweir else if ( rEndPoint.Y() == rEntry.mnStartPos )
2563cdf0e10cSrcweir pStyles[ 5 ] = rEntry.maAttribute;
2564cdf0e10cSrcweir }
2565cdf0e10cSrcweir ++aIter;
2566cdf0e10cSrcweir }
2567cdf0e10cSrcweir
2568cdf0e10cSrcweir aMapIter = maHoriLines.find( rStartPoint.Y() );
2569cdf0e10cSrcweir ASSERT( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" )
2570cdf0e10cSrcweir const SwLineEntrySet& rHoriSet = (*aMapIter).second;
2571cdf0e10cSrcweir aIter = rHoriSet.begin();
2572cdf0e10cSrcweir
2573cdf0e10cSrcweir while ( aIter != rHoriSet.end() )
2574cdf0e10cSrcweir {
2575cdf0e10cSrcweir const SwLineEntry& rEntry = *aIter;
2576cdf0e10cSrcweir if ( bHori )
2577cdf0e10cSrcweir {
2578cdf0e10cSrcweir if ( rStartPoint.X() == rEntry.mnEndPos )
2579cdf0e10cSrcweir pStyles[ 2 ] = rEntry.maAttribute;
2580cdf0e10cSrcweir else if ( rEndPoint.X() == rEntry.mnStartPos )
2581cdf0e10cSrcweir pStyles[ 5 ] = rEntry.maAttribute;
2582cdf0e10cSrcweir }
2583cdf0e10cSrcweir else
2584cdf0e10cSrcweir {
2585cdf0e10cSrcweir if ( rStartPoint.X() == rEntry.mnEndPos )
2586cdf0e10cSrcweir pStyles[ 1 ] = rEntry.maAttribute;
2587cdf0e10cSrcweir else if ( rStartPoint.X() == rEntry.mnStartPos )
2588cdf0e10cSrcweir pStyles[ 3 ] = rEntry.maAttribute;
2589cdf0e10cSrcweir }
2590cdf0e10cSrcweir ++aIter;
2591cdf0e10cSrcweir }
2592cdf0e10cSrcweir
2593cdf0e10cSrcweir if ( bHori )
2594cdf0e10cSrcweir {
2595cdf0e10cSrcweir aMapIter = maVertLines.find( rEndPoint.X() );
2596cdf0e10cSrcweir ASSERT( aMapIter != maVertLines.end(), "FindStylesForLine: Error" )
2597cdf0e10cSrcweir const SwLineEntrySet& rVertSet2 = (*aMapIter).second;
2598cdf0e10cSrcweir aIter = rVertSet2.begin();
2599cdf0e10cSrcweir
2600cdf0e10cSrcweir while ( aIter != rVertSet2.end() )
2601cdf0e10cSrcweir {
2602cdf0e10cSrcweir const SwLineEntry& rEntry = *aIter;
2603cdf0e10cSrcweir if ( rEndPoint.Y() == rEntry.mnStartPos )
2604cdf0e10cSrcweir pStyles[ 6 ] = rEntry.maAttribute;
2605cdf0e10cSrcweir else if ( rEndPoint.Y() == rEntry.mnEndPos )
2606cdf0e10cSrcweir pStyles[ 4 ] = rEntry.maAttribute;
2607cdf0e10cSrcweir ++aIter;
2608cdf0e10cSrcweir }
2609cdf0e10cSrcweir }
2610cdf0e10cSrcweir else
2611cdf0e10cSrcweir {
2612cdf0e10cSrcweir aMapIter = maHoriLines.find( rEndPoint.Y() );
2613cdf0e10cSrcweir ASSERT( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" )
2614cdf0e10cSrcweir const SwLineEntrySet& rHoriSet2 = (*aMapIter).second;
2615cdf0e10cSrcweir aIter = rHoriSet2.begin();
2616cdf0e10cSrcweir
2617cdf0e10cSrcweir while ( aIter != rHoriSet2.end() )
2618cdf0e10cSrcweir {
2619cdf0e10cSrcweir const SwLineEntry& rEntry = *aIter;
2620cdf0e10cSrcweir if ( rEndPoint.X() == rEntry.mnEndPos )
2621cdf0e10cSrcweir pStyles[ 4 ] = rEntry.maAttribute;
2622cdf0e10cSrcweir else if ( rEndPoint.X() == rEntry.mnStartPos )
2623cdf0e10cSrcweir pStyles[ 6 ] = rEntry.maAttribute;
2624cdf0e10cSrcweir ++aIter;
2625cdf0e10cSrcweir }
2626cdf0e10cSrcweir }
2627cdf0e10cSrcweir }
2628cdf0e10cSrcweir
Insert(const SwFrm & rFrm,const SvxBoxItem & rBoxItem)2629cdf0e10cSrcweir void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem )
2630cdf0e10cSrcweir {
2631cdf0e10cSrcweir std::vector< const SwFrm* > aTestVec;
2632cdf0e10cSrcweir aTestVec.push_back( &rFrm );
2633cdf0e10cSrcweir aTestVec.push_back( &rFrm );
2634cdf0e10cSrcweir aTestVec.push_back( &rFrm );
2635cdf0e10cSrcweir
2636cdf0e10cSrcweir // build 4 line entries for the 4 borders:
2637cdf0e10cSrcweir SwRect aBorderRect = rFrm.Frm();
2638cdf0e10cSrcweir if ( rFrm.IsTabFrm() )
2639cdf0e10cSrcweir {
2640cdf0e10cSrcweir aBorderRect = rFrm.Prt();
2641cdf0e10cSrcweir aBorderRect.Pos() += rFrm.Frm().Pos();
2642cdf0e10cSrcweir }
2643cdf0e10cSrcweir
2644cdf0e10cSrcweir const SwTwips nLeft = aBorderRect._Left();
2645cdf0e10cSrcweir const SwTwips nRight = aBorderRect._Right();
2646cdf0e10cSrcweir const SwTwips nTop = aBorderRect._Top();
2647cdf0e10cSrcweir const SwTwips nBottom = aBorderRect._Bottom();
2648cdf0e10cSrcweir
2649cdf0e10cSrcweir svx::frame::Style aL( rBoxItem.GetLeft() );
2650cdf0e10cSrcweir svx::frame::Style aR( rBoxItem.GetRight() );
2651cdf0e10cSrcweir svx::frame::Style aT( rBoxItem.GetTop() );
2652cdf0e10cSrcweir svx::frame::Style aB( rBoxItem.GetBottom() );
2653cdf0e10cSrcweir
2654cdf0e10cSrcweir aR.MirrorSelf();
2655cdf0e10cSrcweir aB.MirrorSelf();
2656cdf0e10cSrcweir
2657cdf0e10cSrcweir bool bVert = mrTabFrm.IsVertical();
2658cdf0e10cSrcweir bool bR2L = mrTabFrm.IsRightToLeft();
2659cdf0e10cSrcweir
2660cdf0e10cSrcweir aL.SetRefMode( svx::frame::REFMODE_CENTERED );
2661cdf0e10cSrcweir aR.SetRefMode( svx::frame::REFMODE_CENTERED );
2662cdf0e10cSrcweir aT.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END );
2663cdf0e10cSrcweir aB.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END );
2664cdf0e10cSrcweir
2665cdf0e10cSrcweir SwLineEntry aLeft ( nLeft, nTop, nBottom, bVert ? aB : ( bR2L ? aR : aL ) );
2666cdf0e10cSrcweir SwLineEntry aRight ( nRight, nTop, nBottom, bVert ? aT : ( bR2L ? aL : aR ) );
2667cdf0e10cSrcweir SwLineEntry aTop ( nTop, nLeft, nRight, bVert ? aL : aT );
2668cdf0e10cSrcweir SwLineEntry aBottom( nBottom, nLeft, nRight, bVert ? aR : aB );
2669cdf0e10cSrcweir
2670cdf0e10cSrcweir Insert( aLeft, false );
2671cdf0e10cSrcweir Insert( aRight, false );
2672cdf0e10cSrcweir Insert( aTop, true );
2673cdf0e10cSrcweir Insert( aBottom, true );
2674cdf0e10cSrcweir
2675cdf0e10cSrcweir const SwRowFrm* pThisRowFrm = dynamic_cast<const SwRowFrm*>(rFrm.GetUpper());
2676cdf0e10cSrcweir
2677cdf0e10cSrcweir // special case: #i9860#
2678cdf0e10cSrcweir // first line in follow table without repeated headlines
2679cdf0e10cSrcweir if ( pThisRowFrm &&
2680cdf0e10cSrcweir pThisRowFrm->GetUpper() == &mrTabFrm &&
2681cdf0e10cSrcweir mrTabFrm.IsFollow() &&
2682cdf0e10cSrcweir !mrTabFrm.GetTable()->GetRowsToRepeat() &&
2683cdf0e10cSrcweir (!pThisRowFrm->GetPrev() || static_cast<const SwRowFrm*>(pThisRowFrm->GetPrev())->IsRowSpanLine()) &&
2684cdf0e10cSrcweir !rBoxItem.GetTop() &&
2685cdf0e10cSrcweir rBoxItem.GetBottom() )
2686cdf0e10cSrcweir {
2687cdf0e10cSrcweir SwLineEntry aFollowTop( !bVert ? nTop : nRight, !bVert ? nLeft : nTop, !bVert ? nRight : nBottom, aB );
2688cdf0e10cSrcweir Insert( aFollowTop, !bVert );
2689cdf0e10cSrcweir }
2690cdf0e10cSrcweir }
2691cdf0e10cSrcweir
Insert(SwLineEntry & rNew,bool bHori)2692cdf0e10cSrcweir void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori )
2693cdf0e10cSrcweir {
2694cdf0e10cSrcweir // get all lines from structure, that have key entry of pLE
2695cdf0e10cSrcweir SwLineEntryMap* pLine2 = bHori ? &maHoriLines : &maVertLines;
2696cdf0e10cSrcweir const SwTwips nKey = rNew.mnKey;
2697cdf0e10cSrcweir SwLineEntryMapIter aMapIter = pLine2->find( nKey );
2698cdf0e10cSrcweir
2699cdf0e10cSrcweir SwLineEntrySet* pLineSet = aMapIter != pLine2->end() ? &((*aMapIter).second) : 0;
2700cdf0e10cSrcweir if ( !pLineSet )
2701cdf0e10cSrcweir {
2702cdf0e10cSrcweir SwLineEntrySet aNewSet;
2703cdf0e10cSrcweir (*pLine2)[ nKey ] = aNewSet;
2704cdf0e10cSrcweir pLineSet = &(*pLine2)[ nKey ];
2705cdf0e10cSrcweir }
2706cdf0e10cSrcweir SwLineEntrySetIter aIter = pLineSet->begin();
2707cdf0e10cSrcweir
2708cdf0e10cSrcweir while ( pLineSet && aIter != pLineSet->end() && rNew.mnStartPos < rNew.mnEndPos )
2709cdf0e10cSrcweir {
2710cdf0e10cSrcweir const SwLineEntry& rOld = *aIter;
2711cdf0e10cSrcweir const SwLineEntry::OverlapType nOverlapType = rOld.Overlaps( rNew );
2712cdf0e10cSrcweir
2713cdf0e10cSrcweir const svx::frame::Style& rOldAttr = rOld.maAttribute;
2714cdf0e10cSrcweir const svx::frame::Style& rNewAttr = rNew.maAttribute;
2715cdf0e10cSrcweir const svx::frame::Style& rCmpAttr = rNewAttr > rOldAttr ? rNewAttr : rOldAttr;
2716cdf0e10cSrcweir
2717cdf0e10cSrcweir if ( SwLineEntry::OVERLAP1 == nOverlapType )
2718cdf0e10cSrcweir {
2719cdf0e10cSrcweir ASSERT( rNew.mnStartPos >= rOld.mnStartPos, "Overlap type 3? How this?" )
2720cdf0e10cSrcweir
2721cdf0e10cSrcweir // new left segment
2722cdf0e10cSrcweir const SwLineEntry aLeft( nKey, rOld.mnStartPos, rNew.mnStartPos, rOldAttr );
2723cdf0e10cSrcweir
2724cdf0e10cSrcweir // new middle segment
2725cdf0e10cSrcweir const SwLineEntry aMiddle( nKey, rNew.mnStartPos, rOld.mnEndPos, rCmpAttr );
2726cdf0e10cSrcweir
2727cdf0e10cSrcweir // new right segment
2728cdf0e10cSrcweir rNew.mnStartPos = rOld.mnEndPos;
2729cdf0e10cSrcweir
2730cdf0e10cSrcweir // update current lines set
2731cdf0e10cSrcweir pLineSet->erase( aIter );
2732cdf0e10cSrcweir if ( aLeft.mnStartPos < aLeft.mnEndPos ) pLineSet->insert( aLeft );
2733cdf0e10cSrcweir if ( aMiddle.mnStartPos < aMiddle.mnEndPos ) pLineSet->insert( aMiddle );
2734cdf0e10cSrcweir
2735cdf0e10cSrcweir aIter = pLineSet->begin();
2736cdf0e10cSrcweir
2737cdf0e10cSrcweir continue; // start over
2738cdf0e10cSrcweir }
2739cdf0e10cSrcweir else if ( SwLineEntry::OVERLAP2 == nOverlapType )
2740cdf0e10cSrcweir {
2741cdf0e10cSrcweir // new left segment
2742cdf0e10cSrcweir const SwLineEntry aLeft( nKey, rOld.mnStartPos, rNew.mnStartPos, rOldAttr );
2743cdf0e10cSrcweir
2744cdf0e10cSrcweir // new middle segment
2745cdf0e10cSrcweir const SwLineEntry aMiddle( nKey, rNew.mnStartPos, rNew.mnEndPos, rCmpAttr );
2746cdf0e10cSrcweir
2747cdf0e10cSrcweir // new right segment
2748cdf0e10cSrcweir const SwLineEntry aRight( nKey, rNew.mnEndPos, rOld.mnEndPos, rOldAttr );
2749cdf0e10cSrcweir
2750cdf0e10cSrcweir // update current lines set
2751cdf0e10cSrcweir pLineSet->erase( aIter );
2752cdf0e10cSrcweir if ( aLeft.mnStartPos < aLeft.mnEndPos ) pLineSet->insert( aLeft );
2753cdf0e10cSrcweir if ( aMiddle.mnStartPos < aMiddle.mnEndPos ) pLineSet->insert( aMiddle );
2754cdf0e10cSrcweir if ( aRight.mnStartPos < aRight.mnEndPos ) pLineSet->insert( aRight );
2755cdf0e10cSrcweir
2756cdf0e10cSrcweir rNew.mnStartPos = rNew.mnEndPos; // rNew should not be inserted!
2757cdf0e10cSrcweir
2758cdf0e10cSrcweir break; // we are finished
2759cdf0e10cSrcweir }
2760cdf0e10cSrcweir else if ( SwLineEntry::OVERLAP3 == nOverlapType )
2761cdf0e10cSrcweir {
2762cdf0e10cSrcweir // new left segment
2763cdf0e10cSrcweir const SwLineEntry aLeft( nKey, rNew.mnStartPos, rOld.mnStartPos, rNewAttr );
2764cdf0e10cSrcweir
2765cdf0e10cSrcweir // new middle segment
2766cdf0e10cSrcweir const SwLineEntry aMiddle( nKey, rOld.mnStartPos, rNew.mnEndPos, rCmpAttr );
2767cdf0e10cSrcweir
2768cdf0e10cSrcweir // new right segment
2769cdf0e10cSrcweir const SwLineEntry aRight( nKey, rNew.mnEndPos, rOld.mnEndPos, rOldAttr );
2770cdf0e10cSrcweir
2771cdf0e10cSrcweir // update current lines set
2772cdf0e10cSrcweir pLineSet->erase( aIter );
2773cdf0e10cSrcweir if ( aLeft.mnStartPos < aLeft.mnEndPos ) pLineSet->insert( aLeft );
2774cdf0e10cSrcweir if ( aMiddle.mnStartPos < aMiddle.mnEndPos ) pLineSet->insert( aMiddle );
2775cdf0e10cSrcweir if ( aRight.mnStartPos < aRight.mnEndPos ) pLineSet->insert( aRight );
2776cdf0e10cSrcweir
2777cdf0e10cSrcweir rNew.mnStartPos = rNew.mnEndPos; // rNew should not be inserted!
2778cdf0e10cSrcweir
2779cdf0e10cSrcweir break; // we are finished
2780cdf0e10cSrcweir }
2781cdf0e10cSrcweir
2782cdf0e10cSrcweir ++aIter;
2783cdf0e10cSrcweir }
2784cdf0e10cSrcweir
2785cdf0e10cSrcweir if ( rNew.mnStartPos < rNew.mnEndPos ) // insert rest
2786cdf0e10cSrcweir pLineSet->insert( rNew );
2787cdf0e10cSrcweir }
2788cdf0e10cSrcweir
2789cdf0e10cSrcweir //
2790cdf0e10cSrcweir // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES END
2791cdf0e10cSrcweir //
2792cdf0e10cSrcweir
2793cdf0e10cSrcweir // --> OD #i76669#
2794cdf0e10cSrcweir namespace
2795cdf0e10cSrcweir {
2796cdf0e10cSrcweir class SwViewObjectContactRedirector : public ::sdr::contact::ViewObjectContactRedirector
2797cdf0e10cSrcweir {
2798cdf0e10cSrcweir private:
2799cdf0e10cSrcweir const ViewShell& mrViewShell;
2800cdf0e10cSrcweir
2801cdf0e10cSrcweir public:
SwViewObjectContactRedirector(const ViewShell & rSh)2802cdf0e10cSrcweir SwViewObjectContactRedirector( const ViewShell& rSh )
2803cdf0e10cSrcweir : mrViewShell( rSh )
2804cdf0e10cSrcweir {};
2805cdf0e10cSrcweir
~SwViewObjectContactRedirector()2806cdf0e10cSrcweir virtual ~SwViewObjectContactRedirector()
2807cdf0e10cSrcweir {}
2808cdf0e10cSrcweir
createRedirectedPrimitive2DSequence(const sdr::contact::ViewObjectContact & rOriginal,const sdr::contact::DisplayInfo & rDisplayInfo)2809cdf0e10cSrcweir virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
2810cdf0e10cSrcweir const sdr::contact::ViewObjectContact& rOriginal,
2811cdf0e10cSrcweir const sdr::contact::DisplayInfo& rDisplayInfo)
2812cdf0e10cSrcweir {
2813cdf0e10cSrcweir sal_Bool bPaint( sal_True );
2814cdf0e10cSrcweir
2815cdf0e10cSrcweir SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject();
2816cdf0e10cSrcweir if ( pObj )
2817cdf0e10cSrcweir {
2818cdf0e10cSrcweir bPaint = SwFlyFrm::IsPaint( pObj, &mrViewShell );
2819cdf0e10cSrcweir }
2820cdf0e10cSrcweir
2821cdf0e10cSrcweir if ( !bPaint )
2822cdf0e10cSrcweir {
2823cdf0e10cSrcweir return drawinglayer::primitive2d::Primitive2DSequence();
2824cdf0e10cSrcweir }
2825cdf0e10cSrcweir
2826cdf0e10cSrcweir return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
2827cdf0e10cSrcweir rOriginal, rDisplayInfo );
2828cdf0e10cSrcweir }
2829cdf0e10cSrcweir };
2830cdf0e10cSrcweir
2831cdf0e10cSrcweir } // end of anonymous namespace
2832cdf0e10cSrcweir // <--
2833cdf0e10cSrcweir
2834cdf0e10cSrcweir /*************************************************************************
2835cdf0e10cSrcweir |*
2836cdf0e10cSrcweir |* SwRootFrm::Paint()
2837cdf0e10cSrcweir |*
2838cdf0e10cSrcweir |* Beschreibung
2839f53e21faSmseidel |* Fuer jede sichtbare Seite, die von Rect berührt wird einmal Painten.
2840cdf0e10cSrcweir |* 1. Umrandungen und Hintergruende Painten.
2841f53e21faSmseidel |* 2. Den Draw Layer (Rahmen und Zeichenobjekte) der unter dem Dokument
2842cdf0e10cSrcweir |* liegt painten (Hoelle).
2843cdf0e10cSrcweir |* 3. Den Dokumentinhalt (Text) Painten.
2844f53e21faSmseidel |* 4. Den Drawlayer der ueber dem Dokument liegt painten.
2845cdf0e10cSrcweir |*
2846cdf0e10cSrcweir |* Ersterstellung MA 01. Jun. 92
2847cdf0e10cSrcweir |* Letzte Aenderung MA 10. Oct. 97
2848cdf0e10cSrcweir |*
2849cdf0e10cSrcweir |*************************************************************************/
2850cdf0e10cSrcweir
2851cdf0e10cSrcweir void
Paint(SwRect const & rRect,SwPrintData const * const pPrintData) const2852cdf0e10cSrcweir SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
2853cdf0e10cSrcweir {
2854cdf0e10cSrcweir ASSERT( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." );
2855cdf0e10cSrcweir
2856cdf0e10cSrcweir PROTOCOL( this, PROT_FILE_INIT, 0, 0)
2857cdf0e10cSrcweir
2858cdf0e10cSrcweir sal_Bool bResetRootPaint = sal_False;
2859cdf0e10cSrcweir ViewShell *pSh = pCurrShell;
2860cdf0e10cSrcweir
2861cdf0e10cSrcweir if ( pSh->GetWin() )
2862cdf0e10cSrcweir {
2863cdf0e10cSrcweir if ( pSh->GetOut() == pSh->GetWin() && !pSh->GetWin()->IsVisible() )
2864cdf0e10cSrcweir {
2865cdf0e10cSrcweir return;
2866cdf0e10cSrcweir }
2867cdf0e10cSrcweir if ( SwRootFrm::bInPaint )
2868cdf0e10cSrcweir {
2869cdf0e10cSrcweir SwPaintQueue::Add( pSh, rRect );
2870cdf0e10cSrcweir return;
2871cdf0e10cSrcweir }
2872cdf0e10cSrcweir }
2873cdf0e10cSrcweir else
2874cdf0e10cSrcweir SwRootFrm::bInPaint = bResetRootPaint = sal_True;
2875cdf0e10cSrcweir
2876cdf0e10cSrcweir SwSavePaintStatics *pStatics = 0;
2877cdf0e10cSrcweir if ( pGlobalShell )
2878cdf0e10cSrcweir pStatics = new SwSavePaintStatics();
2879cdf0e10cSrcweir pGlobalShell = pSh;
2880cdf0e10cSrcweir
2881cdf0e10cSrcweir if( !pSh->GetWin() )
2882cdf0e10cSrcweir pProgress = SfxProgress::GetActiveProgress( (SfxObjectShell*) pSh->GetDoc()->GetDocShell() );
2883cdf0e10cSrcweir
2884cdf0e10cSrcweir ::SwCalcPixStatics( pSh->GetOut() );
2885cdf0e10cSrcweir aGlobalRetoucheColor = pSh->Imp()->GetRetoucheColor();
2886cdf0e10cSrcweir
2887f53e21faSmseidel //Ggf. eine Aktion ausloesen um klare Verhaeltnisse zu schaffen.
2888cdf0e10cSrcweir //Durch diesen Kunstgriff kann in allen Paints davon ausgegangen werden,
2889cdf0e10cSrcweir //das alle Werte gueltigt sind - keine Probleme, keine Sonderbehandlung(en).
2890cdf0e10cSrcweir // --> OD 2008-10-07 #i92745#
2891cdf0e10cSrcweir // Extend check on certain states of the 'current' <ViewShell> instance to
2892cdf0e10cSrcweir // all existing <ViewShell> instances.
2893cdf0e10cSrcweir bool bPerformLayoutAction( true );
2894cdf0e10cSrcweir {
2895cdf0e10cSrcweir ViewShell* pTmpViewShell = pSh;
2896cdf0e10cSrcweir do {
2897cdf0e10cSrcweir if ( pTmpViewShell->IsInEndAction() ||
2898cdf0e10cSrcweir pTmpViewShell->IsPaintInProgress() ||
2899cdf0e10cSrcweir ( pTmpViewShell->Imp()->IsAction() &&
2900cdf0e10cSrcweir pTmpViewShell->Imp()->GetLayAction().IsActionInProgress() ) )
2901cdf0e10cSrcweir {
2902cdf0e10cSrcweir bPerformLayoutAction = false;
2903cdf0e10cSrcweir }
2904cdf0e10cSrcweir
2905cdf0e10cSrcweir pTmpViewShell = static_cast<ViewShell*>(pTmpViewShell->GetNext());
2906cdf0e10cSrcweir } while ( bPerformLayoutAction && pTmpViewShell != pSh );
2907cdf0e10cSrcweir }
2908cdf0e10cSrcweir if ( bPerformLayoutAction )
2909cdf0e10cSrcweir // <--
2910cdf0e10cSrcweir {
2911cdf0e10cSrcweir ((SwRootFrm*)this)->ResetTurbo();
2912cdf0e10cSrcweir SwLayAction aAction( (SwRootFrm*)this, pSh->Imp() );
2913cdf0e10cSrcweir aAction.SetPaint( sal_False );
2914cdf0e10cSrcweir aAction.SetComplete( sal_False );
2915cdf0e10cSrcweir aAction.SetReschedule( pProgress ? sal_True : sal_False );
2916cdf0e10cSrcweir aAction.Action();
2917cdf0e10cSrcweir ((SwRootFrm*)this)->ResetTurboFlag();
2918cdf0e10cSrcweir if ( !pSh->ActionPend() )
2919cdf0e10cSrcweir pSh->Imp()->DelRegion();
2920cdf0e10cSrcweir }
2921cdf0e10cSrcweir
2922cdf0e10cSrcweir SwRect aRect( rRect );
2923cdf0e10cSrcweir aRect.Intersection( pSh->VisArea() );
2924cdf0e10cSrcweir
2925cdf0e10cSrcweir const sal_Bool bExtraData = ::IsExtraData( GetFmt()->GetDoc() );
2926cdf0e10cSrcweir
2927cdf0e10cSrcweir pLines = new SwLineRects; //Sammler fuer Umrandungen.
2928cdf0e10cSrcweir
2929cdf0e10cSrcweir // #104289#. During painting, something (OLE) can
2930cdf0e10cSrcweir // load the linguistic, which in turn can cause a reformat
2931cdf0e10cSrcweir // of the document. Dangerous! We better set this flag to
2932cdf0e10cSrcweir // avoid the reformat.
2933cdf0e10cSrcweir const sal_Bool bOldAction = IsCallbackActionEnabled();
2934cdf0e10cSrcweir ((SwRootFrm*)this)->SetCallbackActionEnabled( sal_False );
2935cdf0e10cSrcweir
2936cdf0e10cSrcweir const SwPageFrm *pPage = pSh->Imp()->GetFirstVisPage();
2937cdf0e10cSrcweir
2938cdf0e10cSrcweir const bool bBookMode = pGlobalShell->GetViewOptions()->IsViewLayoutBookMode();
2939cdf0e10cSrcweir if ( bBookMode && pPage->GetPrev() && static_cast<const SwPageFrm*>(pPage->GetPrev())->IsEmptyPage() )
2940cdf0e10cSrcweir pPage = static_cast<const SwPageFrm*>(pPage->GetPrev());
2941cdf0e10cSrcweir
2942cdf0e10cSrcweir const bool bLTR = IsLeftToRightViewLayout();
2943cdf0e10cSrcweir
2944cdf0e10cSrcweir // #i68597#
2945cdf0e10cSrcweir const bool bGridPainting(pSh->GetWin() && pSh->Imp()->HasDrawView() && pSh->Imp()->GetDrawView()->IsGridVisible());
2946cdf0e10cSrcweir
2947cdf0e10cSrcweir // --> OD #i76669#
2948cdf0e10cSrcweir SwViewObjectContactRedirector aSwRedirector( *pSh );
2949cdf0e10cSrcweir // <--
2950cdf0e10cSrcweir
2951cdf0e10cSrcweir while ( pPage )
2952cdf0e10cSrcweir {
2953cdf0e10cSrcweir const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
2954cdf0e10cSrcweir
2955cdf0e10cSrcweir if ( !pPage->IsEmptyPage() )
2956cdf0e10cSrcweir {
2957cdf0e10cSrcweir SwRect aPaintRect;
2958cdf0e10cSrcweir SwPageFrm::GetBorderAndShadowBoundRect( pPage->Frm(), pSh, aPaintRect, bRightSidebar );
2959cdf0e10cSrcweir
2960cdf0e10cSrcweir if ( aRect.IsOver( aPaintRect ) )
2961cdf0e10cSrcweir {
2962cdf0e10cSrcweir if ( pSh->GetWin() )
2963cdf0e10cSrcweir {
2964cdf0e10cSrcweir pSubsLines = new SwSubsRects;
2965cdf0e10cSrcweir pSpecSubsLines = new SwSubsRects;
2966cdf0e10cSrcweir }
2967cdf0e10cSrcweir
2968cdf0e10cSrcweir aPaintRect._Intersection( aRect );
2969cdf0e10cSrcweir
2970cdf0e10cSrcweir // --> OD 2007-11-14 #i82616#
2971cdf0e10cSrcweir // Invalidate area for extra data (line numbers or change tracking
2972cdf0e10cSrcweir // marks), if painting on a window and the paint is trigger by an
2973cdf0e10cSrcweir // end action. The inefficient and simple enlargement of the
2974cdf0e10cSrcweir // paint area is replaced by this invalidation.
2975cdf0e10cSrcweir if ( bExtraData &&
2976cdf0e10cSrcweir pSh->GetWin() && pSh->IsInEndAction() )
2977cdf0e10cSrcweir {
2978cdf0e10cSrcweir // enlarge paint rectangle to complete page width, subtract
2979cdf0e10cSrcweir // current paint area and invalidate the resulting region.
2980cdf0e10cSrcweir SWRECTFN( pPage )
2981cdf0e10cSrcweir SwRect aPageRectTemp( aPaintRect );
2982cdf0e10cSrcweir (aPageRectTemp.*fnRect->fnSetLeftAndWidth)(
2983cdf0e10cSrcweir (pPage->Frm().*fnRect->fnGetLeft)(),
2984cdf0e10cSrcweir (pPage->Frm().*fnRect->fnGetWidth)() );
2985cdf0e10cSrcweir aPageRectTemp._Intersection( pSh->VisArea() );
2986cdf0e10cSrcweir Region aPageRectRegion( aPageRectTemp.SVRect() );
2987cdf0e10cSrcweir aPageRectRegion.Exclude( aPaintRect.SVRect() );
2988cdf0e10cSrcweir pSh->GetWin()->Invalidate( aPageRectRegion, INVALIDATE_CHILDREN );
2989cdf0e10cSrcweir }
2990cdf0e10cSrcweir // <--
2991cdf0e10cSrcweir
2992cdf0e10cSrcweir // --> OD 2007-08-20 #i80793#
2993cdf0e10cSrcweir // enlarge paint rectangle for objects overlapping the same pixel
2994cdf0e10cSrcweir // in all cases and before the DrawingLayer overlay is initialized.
2995cdf0e10cSrcweir lcl_AdjustRectToPixelSize( aPaintRect, *(pSh->GetOut()) );
2996cdf0e10cSrcweir // <--
2997cdf0e10cSrcweir
2998cdf0e10cSrcweir // #i68597#
2999cdf0e10cSrcweir // moved paint pre-process for DrawingLayer overlay here since the above
3000cdf0e10cSrcweir // code dependent from bExtraData may expand the PaintRect
3001cdf0e10cSrcweir {
3002f53e21faSmseidel // #i75172# if called from ViewShell::ImplEndAction it should no longer
3003cdf0e10cSrcweir // really be used but handled by ViewShell::ImplEndAction already
3004cdf0e10cSrcweir const Region aDLRegion(aPaintRect.SVRect());
3005cdf0e10cSrcweir pSh->DLPrePaint2(aDLRegion);
3006cdf0e10cSrcweir }
3007cdf0e10cSrcweir
3008cdf0e10cSrcweir if(OUTDEV_WINDOW == pGlobalShell->GetOut()->GetOutDevType())
3009cdf0e10cSrcweir {
3010cdf0e10cSrcweir /// OD 27.09.2002 #103636# - changed method SwLayVout::Enter(..)
3011cdf0e10cSrcweir /// 2nd parameter is no longer <const> and will be set to the
3012cdf0e10cSrcweir /// rectangle the virtual output device is calculated from <aPaintRect>,
3013cdf0e10cSrcweir /// if the virtual output is used.
3014cdf0e10cSrcweir pVout->Enter( pSh, aPaintRect, !bNoVirDev );
3015cdf0e10cSrcweir
3016cdf0e10cSrcweir /// OD 27.09.2002 #103636# - adjust paint rectangle to pixel size
3017cdf0e10cSrcweir /// Thus, all objects overlapping on pixel level with the unadjusted
3018cdf0e10cSrcweir /// paint rectangle will be considered in the paint.
3019cdf0e10cSrcweir lcl_AdjustRectToPixelSize( aPaintRect, *(pSh->GetOut()) );
3020cdf0e10cSrcweir }
3021cdf0e10cSrcweir
3022cdf0e10cSrcweir // maybe this can be put in the above scope. Since we are not sure, just leave it ATM
3023cdf0e10cSrcweir pVout->SetOrgRect( aPaintRect );
3024cdf0e10cSrcweir
3025cdf0e10cSrcweir /// OD 29.08.2002 #102450#
3026cdf0e10cSrcweir /// determine background color of page for <PaintLayer> method
3027cdf0e10cSrcweir /// calls, paint <hell> or <heaven>
3028987f0866SArmin Le Grand const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor());
3029cdf0e10cSrcweir
3030cdf0e10cSrcweir pPage->PaintBaBo( aPaintRect, pPage, sal_True );
3031cdf0e10cSrcweir
3032cdf0e10cSrcweir if ( pSh->Imp()->HasDrawView() )
3033cdf0e10cSrcweir {
3034cdf0e10cSrcweir pLines->LockLines( sal_True );
3035cdf0e10cSrcweir const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
3036cdf0e10cSrcweir pSh->Imp()->PaintLayer( pIDDMA->GetHellId(),
3037cdf0e10cSrcweir pPrintData,
3038cdf0e10cSrcweir aPaintRect,
3039cdf0e10cSrcweir &aPageBackgrdColor,
3040cdf0e10cSrcweir (pPage->IsRightToLeft() ? true : false),
3041cdf0e10cSrcweir &aSwRedirector );
3042cdf0e10cSrcweir pLines->PaintLines( pSh->GetOut() );
3043cdf0e10cSrcweir pLines->LockLines( sal_False );
3044cdf0e10cSrcweir }
3045cdf0e10cSrcweir
3046cdf0e10cSrcweir if( pSh->GetWin() )
3047cdf0e10cSrcweir {
3048cdf0e10cSrcweir // collect sub-lines
3049cdf0e10cSrcweir pPage->RefreshSubsidiary( aPaintRect );
3050cdf0e10cSrcweir // paint special sub-lines
3051cdf0e10cSrcweir pSpecSubsLines->PaintSubsidiary( pSh->GetOut(), NULL );
3052cdf0e10cSrcweir }
3053cdf0e10cSrcweir
3054cdf0e10cSrcweir pPage->Paint( aPaintRect );
3055cdf0e10cSrcweir
3056a4b2faf0Smseidel // no paint of page border if writer is in place mode.
3057cdf0e10cSrcweir if( pSh->GetWin() && pSh->GetDoc()->GetDocShell() &&
3058cdf0e10cSrcweir !pSh->GetDoc()->GetDocShell()->IsInPlaceActive() )
3059cdf0e10cSrcweir {
3060a4b2faf0Smseidel SwPageFrm::PaintPageBorder( pPage->Frm(), pSh, bRightSidebar );
3061cdf0e10cSrcweir SwPageFrm::PaintNotesSidebar( pPage->Frm(), pSh, pPage->GetPhyPageNum(), bRightSidebar);
3062cdf0e10cSrcweir }
3063cdf0e10cSrcweir
3064cdf0e10cSrcweir pLines->PaintLines( pSh->GetOut() );
3065cdf0e10cSrcweir
3066cdf0e10cSrcweir if ( pSh->Imp()->HasDrawView() )
3067cdf0e10cSrcweir {
3068cdf0e10cSrcweir /// OD 29.08.2002 #102450# - add 3rd parameter
3069cdf0e10cSrcweir // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction.
3070cdf0e10cSrcweir pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(),
3071cdf0e10cSrcweir pPrintData,
3072cdf0e10cSrcweir aPaintRect,
3073cdf0e10cSrcweir &aPageBackgrdColor,
3074cdf0e10cSrcweir (pPage->IsRightToLeft() ? true : false),
3075cdf0e10cSrcweir &aSwRedirector );
3076cdf0e10cSrcweir }
3077cdf0e10cSrcweir
3078cdf0e10cSrcweir if ( bExtraData )
3079cdf0e10cSrcweir pPage->RefreshExtraData( aPaintRect );
3080cdf0e10cSrcweir
3081cdf0e10cSrcweir if ( pSh->GetWin() )
3082cdf0e10cSrcweir {
3083cdf0e10cSrcweir pSubsLines->PaintSubsidiary( pSh->GetOut(), pLines );
3084cdf0e10cSrcweir DELETEZ( pSubsLines );
3085cdf0e10cSrcweir DELETEZ( pSpecSubsLines );
3086cdf0e10cSrcweir }
3087cdf0e10cSrcweir pVout->Leave();
3088cdf0e10cSrcweir
3089cdf0e10cSrcweir // #i68597#
3090cdf0e10cSrcweir // needed to move grid painting inside Begin/EndDrawLayer bounds and to change
3091cdf0e10cSrcweir // output rect for it accordingly
3092cdf0e10cSrcweir if(bGridPainting)
3093cdf0e10cSrcweir {
3094cdf0e10cSrcweir SdrPaintView* pPaintView = pSh->Imp()->GetDrawView();
3095cdf0e10cSrcweir SdrPageView* pPageView = pPaintView->GetSdrPageView();
3096cdf0e10cSrcweir pPageView->DrawPageViewGrid(*pSh->GetOut(), aPaintRect.SVRect(), SwViewOption::GetTextGridColor() );
3097cdf0e10cSrcweir }
3098cdf0e10cSrcweir
3099cdf0e10cSrcweir // #i68597#
3100cdf0e10cSrcweir // moved paint post-process for DrawingLayer overlay here, see above
3101cdf0e10cSrcweir {
3102cdf0e10cSrcweir pSh->DLPostPaint2(true);
3103cdf0e10cSrcweir }
3104cdf0e10cSrcweir }
3105cdf0e10cSrcweir }
3106cdf0e10cSrcweir else if ( bBookMode && pSh->GetWin() && !pSh->GetDoc()->GetDocShell()->IsInPlaceActive() )
3107cdf0e10cSrcweir {
3108cdf0e10cSrcweir // paint empty page
3109cdf0e10cSrcweir SwRect aPaintRect;
3110cdf0e10cSrcweir SwRect aEmptyPageRect( pPage->Frm() );
3111cdf0e10cSrcweir
3112cdf0e10cSrcweir // code from vprint.cxx
3113cdf0e10cSrcweir const SwPageFrm& rFormatPage = pPage->GetFormatPage();
3114cdf0e10cSrcweir aEmptyPageRect.SSize() = rFormatPage.Frm().SSize();
3115cdf0e10cSrcweir
3116cdf0e10cSrcweir SwPageFrm::GetBorderAndShadowBoundRect( aEmptyPageRect, pSh, aPaintRect, bRightSidebar );
3117cdf0e10cSrcweir aPaintRect._Intersection( aRect );
3118cdf0e10cSrcweir
3119cdf0e10cSrcweir if ( aRect.IsOver( aEmptyPageRect ) )
3120cdf0e10cSrcweir {
3121f53e21faSmseidel // #i75172# if called from ViewShell::ImplEndAction it should no longer
3122cdf0e10cSrcweir // really be used but handled by ViewShell::ImplEndAction already
3123cdf0e10cSrcweir {
3124cdf0e10cSrcweir const Region aDLRegion(aPaintRect.SVRect());
3125cdf0e10cSrcweir pSh->DLPrePaint2(aDLRegion);
3126cdf0e10cSrcweir }
3127cdf0e10cSrcweir
3128cdf0e10cSrcweir if( pSh->GetOut()->GetFillColor() != aGlobalRetoucheColor )
3129cdf0e10cSrcweir pSh->GetOut()->SetFillColor( aGlobalRetoucheColor );
3130cdf0e10cSrcweir
3131cdf0e10cSrcweir pSh->GetOut()->SetLineColor(); // OD 20.02.2003 #107369# - no line color
3132cdf0e10cSrcweir // OD 20.02.2003 #107369# - use aligned page rectangle
3133cdf0e10cSrcweir {
3134cdf0e10cSrcweir SwRect aTmpPageRect( aEmptyPageRect );
3135cdf0e10cSrcweir ::SwAlignRect( aTmpPageRect, pSh );
3136cdf0e10cSrcweir aEmptyPageRect = aTmpPageRect;
3137cdf0e10cSrcweir }
3138cdf0e10cSrcweir
3139cdf0e10cSrcweir pSh->GetOut()->DrawRect( aEmptyPageRect.SVRect() );
3140cdf0e10cSrcweir
3141cdf0e10cSrcweir // paint empty page text
3142cdf0e10cSrcweir const Font& rEmptyPageFont = SwPageFrm::GetEmptyPageFont();
3143cdf0e10cSrcweir const Font aOldFont( pSh->GetOut()->GetFont() );
3144cdf0e10cSrcweir
3145cdf0e10cSrcweir pSh->GetOut()->SetFont( rEmptyPageFont );
3146cdf0e10cSrcweir pSh->GetOut()->DrawText( aEmptyPageRect.SVRect(), SW_RESSTR( STR_EMPTYPAGE ),
3147cdf0e10cSrcweir TEXT_DRAW_VCENTER |
3148cdf0e10cSrcweir TEXT_DRAW_CENTER |
3149cdf0e10cSrcweir TEXT_DRAW_CLIP );
3150cdf0e10cSrcweir
3151cdf0e10cSrcweir pSh->GetOut()->SetFont( aOldFont );
3152ad095790Smseidel // paint border for empty page (shadow removed now)
3153ad095790Smseidel // OD 19.02.2003 #107369# - use new method to paint page border
3154a4b2faf0Smseidel SwPageFrm::PaintPageBorder( aEmptyPageRect, pSh, bRightSidebar );
3155cdf0e10cSrcweir SwPageFrm::PaintNotesSidebar( aEmptyPageRect, pSh, pPage->GetPhyPageNum(), bRightSidebar);
3156cdf0e10cSrcweir
3157cdf0e10cSrcweir {
3158cdf0e10cSrcweir pSh->DLPostPaint2(true);
3159cdf0e10cSrcweir }
3160cdf0e10cSrcweir }
3161cdf0e10cSrcweir }
3162cdf0e10cSrcweir
3163cdf0e10cSrcweir ASSERT( !pPage->GetNext() || pPage->GetNext()->IsPageFrm(),
3164cdf0e10cSrcweir "Nachbar von Seite keine Seite." );
3165cdf0e10cSrcweir pPage = (SwPageFrm*)pPage->GetNext();
3166cdf0e10cSrcweir }
3167cdf0e10cSrcweir
3168cdf0e10cSrcweir DELETEZ( pLines );
3169cdf0e10cSrcweir
3170cdf0e10cSrcweir #ifdef FRANK_TEST
3171cdf0e10cSrcweir if ( pSh->GetWin() )
3172cdf0e10cSrcweir {
3173cdf0e10cSrcweir Rectangle aRect( aFrm.SVRect() );
3174cdf0e10cSrcweir pSh->GetWin()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
3175cdf0e10cSrcweir pSh->GetWin()->SetFillColor();
3176cdf0e10cSrcweir pSh->GetWin()->SetLineColor( COL_LIGHTRED );
3177cdf0e10cSrcweir pSh->GetWin()->DrawRect( aRect );
3178cdf0e10cSrcweir pSh->GetWin()->Pop();
3179cdf0e10cSrcweir }
3180cdf0e10cSrcweir #endif
3181cdf0e10cSrcweir
3182cdf0e10cSrcweir if ( bResetRootPaint )
3183cdf0e10cSrcweir SwRootFrm::bInPaint = sal_False;
3184cdf0e10cSrcweir if ( pStatics )
3185cdf0e10cSrcweir delete pStatics;
3186cdf0e10cSrcweir else
3187cdf0e10cSrcweir {
3188cdf0e10cSrcweir pProgress = 0;
3189cdf0e10cSrcweir pGlobalShell = 0;
3190cdf0e10cSrcweir }
3191cdf0e10cSrcweir
3192cdf0e10cSrcweir ((SwRootFrm*)this)->SetCallbackActionEnabled( bOldAction );
3193cdf0e10cSrcweir }
3194cdf0e10cSrcweir
3195cdf0e10cSrcweir #ifdef LONG_TABLE_HACK
3196cdf0e10cSrcweir
3197cdf0e10cSrcweir /*************************************************************************
3198cdf0e10cSrcweir |*
3199cdf0e10cSrcweir |* SwRootFrm::HackPrepareLongTblPaint()
3200cdf0e10cSrcweir |*
3201cdf0e10cSrcweir |* Ersterstellung MA 27. Sep. 96
3202cdf0e10cSrcweir |* Letzte Aenderung MA 18. Nov. 97
3203cdf0e10cSrcweir |*
3204cdf0e10cSrcweir |*************************************************************************/
3205cdf0e10cSrcweir
HackPrepareLongTblPaint(int nMode)3206cdf0e10cSrcweir void SwRootFrm::HackPrepareLongTblPaint( int nMode )
3207cdf0e10cSrcweir {
3208cdf0e10cSrcweir switch ( nMode )
3209cdf0e10cSrcweir {
3210cdf0e10cSrcweir case HACK_TABLEMODE_INIT : ASSERT( !pLines, "HackPrepare: already prepared" );
3211cdf0e10cSrcweir pLines = new SwLineRects;
3212cdf0e10cSrcweir ASSERT( !pGlobalShell, "old GlobalShell lost" );
3213cdf0e10cSrcweir pGlobalShell = GetCurrShell();
3214cdf0e10cSrcweir bTableHack = sal_True;
3215cdf0e10cSrcweir break;
3216cdf0e10cSrcweir case HACK_TABLEMODE_LOCKLINES : pLines->LockLines( sal_True ); break;
3217cdf0e10cSrcweir case HACK_TABLEMODE_PAINTLINES : pLines->PaintLines( GetShell()->GetOut() );
3218cdf0e10cSrcweir break;
3219cdf0e10cSrcweir case HACK_TABLEMODE_UNLOCKLINES: pLines->LockLines( sal_False ); break;
3220cdf0e10cSrcweir case HACK_TABLEMODE_EXIT : pLines->PaintLines( GetCurrShell()->GetOut() );
3221cdf0e10cSrcweir DELETEZ( pLines );
3222cdf0e10cSrcweir pGlobalShell = 0;
3223cdf0e10cSrcweir bTableHack = sal_False;
3224cdf0e10cSrcweir break;
3225cdf0e10cSrcweir }
3226cdf0e10cSrcweir }
3227cdf0e10cSrcweir
3228cdf0e10cSrcweir #endif
3229cdf0e10cSrcweir
3230cdf0e10cSrcweir
3231cdf0e10cSrcweir /*************************************************************************
3232cdf0e10cSrcweir |*
3233cdf0e10cSrcweir |* SwLayoutFrm::Paint()
3234cdf0e10cSrcweir |*
3235cdf0e10cSrcweir |* Ersterstellung MA 19. May. 92
3236cdf0e10cSrcweir |* Letzte Aenderung MA 19. Apr. 95
3237cdf0e10cSrcweir |*
3238cdf0e10cSrcweir |*************************************************************************/
3239cdf0e10cSrcweir
lcl_EmergencyFormatFtnCont(SwFtnContFrm * pCont)3240cdf0e10cSrcweir void MA_FASTCALL lcl_EmergencyFormatFtnCont( SwFtnContFrm *pCont )
3241cdf0e10cSrcweir {
3242cdf0e10cSrcweir //Es kann sein, dass der Cont vernichtet wird.
3243cdf0e10cSrcweir SwCntntFrm *pCnt = pCont->ContainsCntnt();
3244cdf0e10cSrcweir while ( pCnt && pCnt->IsInFtn() )
3245cdf0e10cSrcweir {
3246cdf0e10cSrcweir pCnt->Calc();
3247cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
3248cdf0e10cSrcweir }
3249cdf0e10cSrcweir }
3250cdf0e10cSrcweir
3251cdf0e10cSrcweir class SwShortCut
3252cdf0e10cSrcweir {
3253cdf0e10cSrcweir SwRectDist fnCheck;
3254cdf0e10cSrcweir long nLimit;
3255cdf0e10cSrcweir public:
3256cdf0e10cSrcweir SwShortCut( const SwFrm& rFrm, const SwRect& rRect );
Stop(const SwRect & rRect) const3257cdf0e10cSrcweir sal_Bool Stop( const SwRect& rRect ) const
3258cdf0e10cSrcweir { return (rRect.*fnCheck)( nLimit ) > 0; }
3259cdf0e10cSrcweir };
3260cdf0e10cSrcweir
SwShortCut(const SwFrm & rFrm,const SwRect & rRect)3261cdf0e10cSrcweir SwShortCut::SwShortCut( const SwFrm& rFrm, const SwRect& rRect )
3262cdf0e10cSrcweir {
3263cdf0e10cSrcweir sal_Bool bVert = rFrm.IsVertical();
3264cdf0e10cSrcweir sal_Bool bR2L = rFrm.IsRightToLeft();
3265cdf0e10cSrcweir if( rFrm.IsNeighbourFrm() && bVert == bR2L )
3266cdf0e10cSrcweir {
3267cdf0e10cSrcweir if( bVert )
3268cdf0e10cSrcweir {
3269cdf0e10cSrcweir fnCheck = &SwRect::GetBottomDistance;
3270cdf0e10cSrcweir nLimit = rRect.Top();
3271cdf0e10cSrcweir }
3272cdf0e10cSrcweir else
3273cdf0e10cSrcweir {
3274cdf0e10cSrcweir fnCheck = &SwRect::GetLeftDistance;
3275cdf0e10cSrcweir nLimit = rRect.Left() + rRect.Width();
3276cdf0e10cSrcweir }
3277cdf0e10cSrcweir }
3278cdf0e10cSrcweir else if( bVert == rFrm.IsNeighbourFrm() )
3279cdf0e10cSrcweir {
3280cdf0e10cSrcweir fnCheck = &SwRect::GetTopDistance;
3281cdf0e10cSrcweir nLimit = rRect.Top() + rRect.Height();
3282cdf0e10cSrcweir }
3283cdf0e10cSrcweir else
3284cdf0e10cSrcweir {
3285cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
3286cdf0e10cSrcweir if ( rFrm.IsVertLR() )
3287cdf0e10cSrcweir {
3288cdf0e10cSrcweir fnCheck = &SwRect::GetLeftDistance;
3289cdf0e10cSrcweir nLimit = rRect.Right();
3290cdf0e10cSrcweir }
3291cdf0e10cSrcweir else
3292cdf0e10cSrcweir {
3293cdf0e10cSrcweir fnCheck = &SwRect::GetRightDistance;
3294cdf0e10cSrcweir nLimit = rRect.Left();
3295cdf0e10cSrcweir }
3296cdf0e10cSrcweir }
3297cdf0e10cSrcweir }
3298cdf0e10cSrcweir
Paint(SwRect const & rRect,SwPrintData const * const) const3299cdf0e10cSrcweir void SwLayoutFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
3300cdf0e10cSrcweir {
3301cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
3302cdf0e10cSrcweir
3303cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
3304cdf0e10cSrcweir Frm_Info aFrmInfo( *this );
3305cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, &aFrmInfo, 0, *pSh->GetOut() );
3306cdf0e10cSrcweir // <--
3307cdf0e10cSrcweir
3308cdf0e10cSrcweir const SwFrm *pFrm = Lower();
3309cdf0e10cSrcweir if ( !pFrm )
3310cdf0e10cSrcweir return;
3311cdf0e10cSrcweir
3312cdf0e10cSrcweir SwShortCut aShortCut( *pFrm, rRect );
3313cdf0e10cSrcweir sal_Bool bCnt;
3314cdf0e10cSrcweir if ( sal_True == (bCnt = pFrm->IsCntntFrm()) )
3315cdf0e10cSrcweir pFrm->Calc();
3316cdf0e10cSrcweir
3317cdf0e10cSrcweir if ( pFrm->IsFtnContFrm() )
3318cdf0e10cSrcweir {
3319cdf0e10cSrcweir ::lcl_EmergencyFormatFtnCont( (SwFtnContFrm*)pFrm );
3320cdf0e10cSrcweir pFrm = Lower();
3321cdf0e10cSrcweir }
3322cdf0e10cSrcweir
3323cdf0e10cSrcweir const SwPageFrm *pPage = 0;
3324cdf0e10cSrcweir const sal_Bool bWin = pGlobalShell->GetWin() ? sal_True : sal_False;
3325cdf0e10cSrcweir
3326cdf0e10cSrcweir while ( IsAnLower( pFrm ) )
3327cdf0e10cSrcweir {
3328cdf0e10cSrcweir SwRect aPaintRect( pFrm->PaintArea() );
3329cdf0e10cSrcweir if( aShortCut.Stop( aPaintRect ) )
3330cdf0e10cSrcweir break;
3331cdf0e10cSrcweir if ( bCnt && pProgress )
3332cdf0e10cSrcweir pProgress->Reschedule();
3333cdf0e10cSrcweir
3334cdf0e10cSrcweir //Wenn ein Frm es explizit will muss retouchiert werden.
3335cdf0e10cSrcweir //Erst die Retouche, denn selbige koennte die aligned'en Raender
3336cdf0e10cSrcweir //plaetten.
3337cdf0e10cSrcweir if ( pFrm->IsRetouche() )
3338cdf0e10cSrcweir {
3339cdf0e10cSrcweir if ( pFrm->IsRetoucheFrm() && bWin && !pFrm->GetNext() )
3340cdf0e10cSrcweir { if ( !pPage )
3341cdf0e10cSrcweir pPage = FindPageFrm();
3342cdf0e10cSrcweir pFrm->Retouche( pPage, rRect );
3343cdf0e10cSrcweir }
3344cdf0e10cSrcweir pFrm->ResetRetouche();
3345cdf0e10cSrcweir }
3346cdf0e10cSrcweir
3347cdf0e10cSrcweir if ( rRect.IsOver( aPaintRect ) )
3348cdf0e10cSrcweir {
3349cdf0e10cSrcweir if ( bCnt && pFrm->IsCompletePaint() &&
3350cdf0e10cSrcweir !rRect.IsInside( aPaintRect ) && GetpApp()->AnyInput( INPUT_KEYBOARD ) )
3351cdf0e10cSrcweir {
3352cdf0e10cSrcweir //fix(8104): Es kann vorkommen, dass die Verarbeitung nicht
3353cdf0e10cSrcweir //vollstaendig war, aber trotzdem Teile des Absatzes gepaintet
3354cdf0e10cSrcweir //werden. In der Folge werden dann evtl. wiederum andere Teile
3355cdf0e10cSrcweir //des Absatzes garnicht mehr gepaintet. Einziger Ausweg scheint
3356cdf0e10cSrcweir //hier ein Invalidieren der Windows zu sein.
3357cdf0e10cSrcweir //Um es nicht alzu Heftig werden zu lassen versuche ich hier
3358cdf0e10cSrcweir //das Rechteck zu begrenzen indem der gewuenschte Teil gepaintet
3359cdf0e10cSrcweir //und nur die uebrigen Absatzanteile invalidiert werden.
3360cdf0e10cSrcweir if ( aPaintRect.Left() == rRect.Left() &&
3361cdf0e10cSrcweir aPaintRect.Right() == rRect.Right() )
3362cdf0e10cSrcweir {
3363cdf0e10cSrcweir aPaintRect.Bottom( rRect.Top() - 1 );
3364cdf0e10cSrcweir if ( aPaintRect.Height() > 0 )
3365cdf0e10cSrcweir pGlobalShell->InvalidateWindows(aPaintRect);
3366cdf0e10cSrcweir aPaintRect.Top( rRect.Bottom() + 1 );
3367cdf0e10cSrcweir aPaintRect.Bottom( pFrm->Frm().Bottom() );
3368cdf0e10cSrcweir if ( aPaintRect.Height() > 0 )
3369cdf0e10cSrcweir pGlobalShell->InvalidateWindows(aPaintRect);
3370cdf0e10cSrcweir aPaintRect.Top( pFrm->Frm().Top() );
3371cdf0e10cSrcweir aPaintRect.Bottom( pFrm->Frm().Bottom() );
3372cdf0e10cSrcweir }
3373cdf0e10cSrcweir else
3374cdf0e10cSrcweir {
3375cdf0e10cSrcweir pGlobalShell->InvalidateWindows( aPaintRect );
3376cdf0e10cSrcweir pFrm = pFrm->GetNext();
3377cdf0e10cSrcweir if ( pFrm && (sal_True == (bCnt = pFrm->IsCntntFrm())) )
3378cdf0e10cSrcweir pFrm->Calc();
3379cdf0e10cSrcweir continue;
3380cdf0e10cSrcweir }
3381cdf0e10cSrcweir }
3382cdf0e10cSrcweir pFrm->ResetCompletePaint();
3383cdf0e10cSrcweir aPaintRect._Intersection( rRect );
3384cdf0e10cSrcweir
3385cdf0e10cSrcweir pFrm->Paint( aPaintRect );
3386cdf0e10cSrcweir
3387cdf0e10cSrcweir if ( Lower() && Lower()->IsColumnFrm() )
3388cdf0e10cSrcweir {
3389cdf0e10cSrcweir //Ggf. die Spaltentrennlinien malen. Fuer den Seitenbody ist
3390cdf0e10cSrcweir //nicht der Upper sondern die Seite Zustaendig.
3391cdf0e10cSrcweir const SwFrmFmt *pFmt = GetUpper() && GetUpper()->IsPageFrm()
3392cdf0e10cSrcweir ? GetUpper()->GetFmt()
3393cdf0e10cSrcweir : GetFmt();
3394cdf0e10cSrcweir const SwFmtCol &rCol = pFmt->GetCol();
3395cdf0e10cSrcweir if ( rCol.GetLineAdj() != COLADJ_NONE )
3396cdf0e10cSrcweir {
3397cdf0e10cSrcweir if ( !pPage )
3398cdf0e10cSrcweir pPage = pFrm->FindPageFrm();
3399cdf0e10cSrcweir
3400cdf0e10cSrcweir PaintColLines( aPaintRect, rCol, pPage );
3401cdf0e10cSrcweir }
3402cdf0e10cSrcweir }
3403cdf0e10cSrcweir }
3404cdf0e10cSrcweir if ( !bCnt && pFrm->GetNext() && pFrm->GetNext()->IsFtnContFrm() )
3405cdf0e10cSrcweir ::lcl_EmergencyFormatFtnCont( (SwFtnContFrm*)pFrm->GetNext() );
3406cdf0e10cSrcweir
3407cdf0e10cSrcweir pFrm = pFrm->GetNext();
3408cdf0e10cSrcweir if ( pFrm && (sal_True == (bCnt = pFrm->IsCntntFrm())) )
3409cdf0e10cSrcweir pFrm->Calc();
3410cdf0e10cSrcweir }
3411cdf0e10cSrcweir }
3412cdf0e10cSrcweir
3413cdf0e10cSrcweir
3414cdf0e10cSrcweir /** FlyFrm::IsBackgroundTransparent - for feature #99657#
3415cdf0e10cSrcweir
3416cdf0e10cSrcweir OD 12.08.2002
3417cdf0e10cSrcweir determines, if background of fly frame has to be drawn transparent
3418cdf0e10cSrcweir declaration found in /core/inc/flyfrm.cxx
3419cdf0e10cSrcweir OD 08.10.2002 #103898# - If the background of the fly frame itself is not
3420cdf0e10cSrcweir transparent and the background is inherited from its parent/grandparent,
3421cdf0e10cSrcweir the background brush, used for drawing, has to be investigated for transparency.
3422cdf0e10cSrcweir
3423cdf0e10cSrcweir @author OD
3424cdf0e10cSrcweir
3425cdf0e10cSrcweir @return true, if background is transparent drawn.
3426cdf0e10cSrcweir */
IsBackgroundTransparent() const3427cdf0e10cSrcweir sal_Bool SwFlyFrm::IsBackgroundTransparent() const
3428cdf0e10cSrcweir {
3429cdf0e10cSrcweir sal_Bool bBackgroundTransparent = GetFmt()->IsBackgroundTransparent();
3430cdf0e10cSrcweir if ( !bBackgroundTransparent &&
3431cdf0e10cSrcweir static_cast<const SwFlyFrmFmt*>(GetFmt())->IsBackgroundBrushInherited() )
3432cdf0e10cSrcweir {
3433cdf0e10cSrcweir const SvxBrushItem* pBackgrdBrush = 0;
3434cdf0e10cSrcweir const Color* pSectionTOXColor = 0;
3435cdf0e10cSrcweir SwRect aDummyRect;
343664b14621SArmin Le Grand
343764b14621SArmin Le Grand //UUUU
343856b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
343964b14621SArmin Le Grand
344064b14621SArmin Le Grand if ( GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false) )
3441cdf0e10cSrcweir {
3442cdf0e10cSrcweir if ( pSectionTOXColor &&
3443cdf0e10cSrcweir (pSectionTOXColor->GetTransparency() != 0) &&
3444cdf0e10cSrcweir (pSectionTOXColor->GetColor() != COL_TRANSPARENT) )
3445cdf0e10cSrcweir {
3446cdf0e10cSrcweir bBackgroundTransparent = sal_True;
3447cdf0e10cSrcweir }
34486104255bSArmin Le Grand else if(aFillAttributes.get() && aFillAttributes->isUsed()) //UUUU
34496104255bSArmin Le Grand {
34506104255bSArmin Le Grand bBackgroundTransparent = aFillAttributes->isTransparent();
34516104255bSArmin Le Grand }
3452cdf0e10cSrcweir else if ( pBackgrdBrush )
3453cdf0e10cSrcweir {
3454cdf0e10cSrcweir if ( (pBackgrdBrush->GetColor().GetTransparency() != 0) &&
3455cdf0e10cSrcweir (pBackgrdBrush->GetColor() != COL_TRANSPARENT) )
3456cdf0e10cSrcweir {
3457cdf0e10cSrcweir bBackgroundTransparent = sal_True;
3458cdf0e10cSrcweir }
3459cdf0e10cSrcweir else
3460cdf0e10cSrcweir {
3461cdf0e10cSrcweir const GraphicObject *pTmpGrf =
3462cdf0e10cSrcweir static_cast<const GraphicObject*>(pBackgrdBrush->GetGraphicObject());
3463cdf0e10cSrcweir if ( (pTmpGrf) &&
3464cdf0e10cSrcweir (pTmpGrf->GetAttr().GetTransparency() != 0)
3465cdf0e10cSrcweir )
3466cdf0e10cSrcweir {
3467cdf0e10cSrcweir bBackgroundTransparent = sal_True;
3468cdf0e10cSrcweir }
3469cdf0e10cSrcweir }
3470cdf0e10cSrcweir }
3471cdf0e10cSrcweir }
3472cdf0e10cSrcweir }
3473cdf0e10cSrcweir
3474cdf0e10cSrcweir return bBackgroundTransparent;
3475cdf0e10cSrcweir };
3476cdf0e10cSrcweir
3477cdf0e10cSrcweir /** FlyFrm::IsShadowTransparent - for feature #99657#
3478cdf0e10cSrcweir
3479cdf0e10cSrcweir OD 13.08.2002
3480cdf0e10cSrcweir determine, if shadow color of fly frame has to be drawn transparent
3481cdf0e10cSrcweir declaration found in /core/inc/flyfrm.cxx
3482cdf0e10cSrcweir
3483cdf0e10cSrcweir @author OD
3484cdf0e10cSrcweir
3485cdf0e10cSrcweir @return true, if shadow color is transparent.
3486cdf0e10cSrcweir */
IsShadowTransparent() const3487cdf0e10cSrcweir sal_Bool SwFlyFrm::IsShadowTransparent() const
3488cdf0e10cSrcweir {
3489cdf0e10cSrcweir return GetFmt()->IsShadowTransparent();
3490cdf0e10cSrcweir };
3491cdf0e10cSrcweir
3492cdf0e10cSrcweir /*************************************************************************
3493cdf0e10cSrcweir |*
3494cdf0e10cSrcweir |* SwFlyFrm::IsPaint()
3495cdf0e10cSrcweir |*
3496cdf0e10cSrcweir |* Ersterstellung MA 16. Jan. 97
3497cdf0e10cSrcweir |* Letzte Aenderung MA 16. Jan. 97
3498cdf0e10cSrcweir |*
3499cdf0e10cSrcweir |*************************************************************************/
3500cdf0e10cSrcweir
IsPaint(SdrObject * pObj,const ViewShell * pSh)3501cdf0e10cSrcweir sal_Bool SwFlyFrm::IsPaint( SdrObject *pObj, const ViewShell *pSh )
3502cdf0e10cSrcweir {
3503cdf0e10cSrcweir SdrObjUserCall *pUserCall;
3504cdf0e10cSrcweir
3505cdf0e10cSrcweir if ( 0 == ( pUserCall = GetUserCall(pObj) ) )
3506cdf0e10cSrcweir return sal_True;
3507cdf0e10cSrcweir
3508cdf0e10cSrcweir //Attributabhaengig nicht fuer Drucker oder PreView painten
3509cdf0e10cSrcweir sal_Bool bPaint = pFlyOnlyDraw ||
3510cdf0e10cSrcweir ((SwContact*)pUserCall)->GetFmt()->GetPrint().GetValue();
3511cdf0e10cSrcweir if ( !bPaint )
3512cdf0e10cSrcweir bPaint = pSh->GetWin() && !pSh->IsPreView();
3513cdf0e10cSrcweir
3514cdf0e10cSrcweir if ( bPaint )
3515cdf0e10cSrcweir {
3516cdf0e10cSrcweir //Das Paint kann evtl. von von uebergeordneten Flys verhindert werden.
3517cdf0e10cSrcweir SwFrm *pAnch = 0;
351873916cc0SMichael Stahl // --> OD #i117962#
351973916cc0SMichael Stahl if ( pObj->ISA(SwFlyDrawObj) )
352073916cc0SMichael Stahl {
352173916cc0SMichael Stahl bPaint = false;
352273916cc0SMichael Stahl }
352373916cc0SMichael Stahl // <--
352473916cc0SMichael Stahl else if ( pObj->ISA(SwVirtFlyDrawObj) )
3525cdf0e10cSrcweir {
3526cdf0e10cSrcweir SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
3527cdf0e10cSrcweir if ( pFlyOnlyDraw && pFlyOnlyDraw == pFly )
3528cdf0e10cSrcweir return sal_True;
3529cdf0e10cSrcweir
3530cdf0e10cSrcweir //Die Anzeige eines Zwischenstadiums vermeiden, Flys die nicht mit
3531cdf0e10cSrcweir //der Seite auf der sie verankert sind ueberlappen werden auch
3532cdf0e10cSrcweir //nicht gepaintet.
3533cdf0e10cSrcweir //HACK: Ausnahme: Drucken von Rahmen in Tabellen, diese koennen
3534cdf0e10cSrcweir //bei uebergrossen Tabellen (HTML) schon mal auserhalb der Seite
3535cdf0e10cSrcweir //stehen.
3536cdf0e10cSrcweir SwPageFrm *pPage = pFly->FindPageFrm();
3537cdf0e10cSrcweir if ( pPage )
3538cdf0e10cSrcweir {
3539cdf0e10cSrcweir if ( pPage->Frm().IsOver( pFly->Frm() ) )
3540cdf0e10cSrcweir pAnch = pFly->AnchorFrm();
3541cdf0e10cSrcweir else if ( bTableHack &&
3542cdf0e10cSrcweir pFly->Frm().Top() >= pFly->GetAnchorFrm()->Frm().Top() &&
3543cdf0e10cSrcweir pFly->Frm().Top() < pFly->GetAnchorFrm()->Frm().Bottom() &&
3544cdf0e10cSrcweir long(pSh->GetOut()) ==
3545cdf0e10cSrcweir long(pSh->getIDocumentDeviceAccess()->getPrinter( false ) ) )
3546cdf0e10cSrcweir {
3547cdf0e10cSrcweir pAnch = pFly->AnchorFrm();
3548cdf0e10cSrcweir }
3549cdf0e10cSrcweir }
3550cdf0e10cSrcweir
3551cdf0e10cSrcweir }
3552cdf0e10cSrcweir else
3553cdf0e10cSrcweir {
3554cdf0e10cSrcweir // OD 13.10.2003 #i19919# - consider 'virtual' drawing objects
3555cdf0e10cSrcweir // OD 2004-03-29 #i26791#
3556cdf0e10cSrcweir pAnch = ((SwDrawContact*)pUserCall)->GetAnchorFrm( pObj );
3557cdf0e10cSrcweir if ( pAnch )
3558cdf0e10cSrcweir {
3559cdf0e10cSrcweir if ( !pAnch->GetValidPosFlag() )
3560cdf0e10cSrcweir pAnch = 0;
3561cdf0e10cSrcweir else if ( long(pSh->GetOut()) == long(pSh->getIDocumentDeviceAccess()->getPrinter( false )))
3562cdf0e10cSrcweir {
3563cdf0e10cSrcweir //HACK: fuer das Drucken muessen wir ein paar Objekte
3564cdf0e10cSrcweir //weglassen, da diese sonst doppelt gedruckt werden.
3565cdf0e10cSrcweir //Die Objekte sollen gedruckt werden, wenn der TableHack
3566cdf0e10cSrcweir //gerade greift. In der Folge duerfen sie nicht gedruckt werden
3567cdf0e10cSrcweir //wenn sie mit der Seite dran sind, ueber der sie von der
3568cdf0e10cSrcweir //Position her gerade schweben.
3569cdf0e10cSrcweir const SwPageFrm *pPage = pAnch->FindPageFrm();
3570cdf0e10cSrcweir if ( !bTableHack &&
3571cdf0e10cSrcweir !pPage->Frm().IsOver( pObj->GetCurrentBoundRect() ) )
3572cdf0e10cSrcweir pAnch = 0;
3573cdf0e10cSrcweir }
3574cdf0e10cSrcweir }
3575cdf0e10cSrcweir else
3576cdf0e10cSrcweir {
3577cdf0e10cSrcweir // OD 02.07.2003 #108784# - debug assert
3578cdf0e10cSrcweir if ( !pObj->ISA(SdrObjGroup) )
3579cdf0e10cSrcweir {
3580cdf0e10cSrcweir ASSERT( false, "<SwFlyFrm::IsPaint(..)> - paint of drawing object without anchor frame!?" );
3581cdf0e10cSrcweir }
3582cdf0e10cSrcweir }
3583cdf0e10cSrcweir }
3584cdf0e10cSrcweir if ( pAnch )
3585cdf0e10cSrcweir {
3586cdf0e10cSrcweir if ( pAnch->IsInFly() )
3587cdf0e10cSrcweir bPaint = SwFlyFrm::IsPaint( pAnch->FindFlyFrm()->GetVirtDrawObj(),
3588cdf0e10cSrcweir pSh );
3589cdf0e10cSrcweir else if ( pFlyOnlyDraw )
3590cdf0e10cSrcweir bPaint = sal_False;
3591cdf0e10cSrcweir }
3592cdf0e10cSrcweir else
3593cdf0e10cSrcweir bPaint = sal_False;
3594cdf0e10cSrcweir }
3595cdf0e10cSrcweir return bPaint;
3596cdf0e10cSrcweir }
3597cdf0e10cSrcweir
3598cdf0e10cSrcweir /*************************************************************************
3599cdf0e10cSrcweir |* SwCellFrm::Paint( const SwRect& ) const
3600cdf0e10cSrcweir |*************************************************************************/
Paint(SwRect const & rRect,SwPrintData const * const) const3601cdf0e10cSrcweir void SwCellFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
3602cdf0e10cSrcweir {
3603cdf0e10cSrcweir if ( GetLayoutRowSpan() >= 1 )
3604cdf0e10cSrcweir SwLayoutFrm::Paint( rRect );
3605cdf0e10cSrcweir }
3606cdf0e10cSrcweir
3607cdf0e10cSrcweir /*************************************************************************
3608cdf0e10cSrcweir |*
3609cdf0e10cSrcweir |* SwFlyFrm::Paint()
3610cdf0e10cSrcweir |*
3611cdf0e10cSrcweir |* Ersterstellung MA ??
3612cdf0e10cSrcweir |* Letzte Aenderung MA 16. Jan. 97
3613cdf0e10cSrcweir |*
3614cdf0e10cSrcweir |*************************************************************************/
3615cdf0e10cSrcweir
3616cdf0e10cSrcweir //Weiter unten definiert
3617cdf0e10cSrcweir void MA_FASTCALL lcl_PaintLowerBorders( const SwLayoutFrm *pLay,
3618cdf0e10cSrcweir const SwRect &rRect, const SwPageFrm *pPage );
3619cdf0e10cSrcweir
Paint(SwRect const & rRect,SwPrintData const * const) const3620cdf0e10cSrcweir void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
3621cdf0e10cSrcweir {
3622cb65df5dSJürgen Schmidt //begin:optimize thumbnail generate and store procedure to improve odt saving performance, i120030
3623cb65df5dSJürgen Schmidt ViewShell *pShell = getRootFrm()->GetCurrShell();
3624cb65df5dSJürgen Schmidt if (pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocShell())
3625cb65df5dSJürgen Schmidt {
3626cb65df5dSJürgen Schmidt sal_Bool bInGenerateThumbnail = pShell->GetDoc()->GetDocShell()->IsInGenerateAndStoreThumbnail();
3627cb65df5dSJürgen Schmidt if (bInGenerateThumbnail)
3628cb65df5dSJürgen Schmidt {
3629cb65df5dSJürgen Schmidt SwRect aVisRect = pShell->VisArea();
3630cb65df5dSJürgen Schmidt if (!aVisRect.IsOver(Frm()))
3631cb65df5dSJürgen Schmidt return;
3632cb65df5dSJürgen Schmidt }
3633cb65df5dSJürgen Schmidt }
3634cb65df5dSJürgen Schmidt //end:i120030
3635cb65df5dSJürgen Schmidt
3636cdf0e10cSrcweir //wegen der Ueberlappung von Rahmen und Zeichenobjekten muessen die
3637cdf0e10cSrcweir //Flys ihre Umrandung (und die der Innenliegenden) direkt ausgeben.
3638cdf0e10cSrcweir //z.B. #33066#
3639cdf0e10cSrcweir pLines->LockLines(sal_True);
3640cdf0e10cSrcweir
3641cdf0e10cSrcweir SwRect aRect( rRect );
3642cdf0e10cSrcweir aRect._Intersection( Frm() );
3643cdf0e10cSrcweir
3644cdf0e10cSrcweir OutputDevice* pOut = pGlobalShell->GetOut();
3645cdf0e10cSrcweir pOut->Push( PUSH_CLIPREGION );
3646cdf0e10cSrcweir pOut->SetClipRegion();
3647cdf0e10cSrcweir const SwPageFrm* pPage = FindPageFrm();
3648cdf0e10cSrcweir
3649cdf0e10cSrcweir const SwNoTxtFrm *pNoTxt = Lower() && Lower()->IsNoTxtFrm()
3650cdf0e10cSrcweir ? (SwNoTxtFrm*)Lower() : 0;
3651cdf0e10cSrcweir
3652cdf0e10cSrcweir bool bIsChart = false; //#i102950# don't paint additional borders for charts
3653cdf0e10cSrcweir //check whether we have a chart
3654cdf0e10cSrcweir if(pNoTxt)
3655cdf0e10cSrcweir {
3656cdf0e10cSrcweir const SwNoTxtNode* pNoTNd = dynamic_cast<const SwNoTxtNode*>(pNoTxt->GetNode());
3657cdf0e10cSrcweir if( pNoTNd )
3658cdf0e10cSrcweir {
3659cdf0e10cSrcweir SwOLENode* pOLENd = const_cast<SwOLENode*>(pNoTNd->GetOLENode());
366078d93489SArmin Le Grand if( pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() ) )
3661cdf0e10cSrcweir bIsChart = true;
3662cdf0e10cSrcweir }
3663cdf0e10cSrcweir }
3664cdf0e10cSrcweir
3665cdf0e10cSrcweir {
3666cdf0e10cSrcweir bool bContour = GetFmt()->GetSurround().IsContour();
3667cdf0e10cSrcweir PolyPolygon aPoly;
3668cdf0e10cSrcweir if ( bContour )
3669cdf0e10cSrcweir {
3670cdf0e10cSrcweir // OD 16.04.2003 #i13147# - add 2nd parameter with value <sal_True>
3671cdf0e10cSrcweir // to indicate that method is called for paint in order to avoid
3672cdf0e10cSrcweir // load of the intrinsic graphic.
3673cdf0e10cSrcweir bContour = GetContour( aPoly, sal_True );
3674cdf0e10cSrcweir }
3675cdf0e10cSrcweir
3676cdf0e10cSrcweir // --> OD 2005-06-08 #i47804# - distinguish complete background paint
3677cdf0e10cSrcweir // and margin paint.
3678cdf0e10cSrcweir // paint complete background for Writer text fly frames
3679cdf0e10cSrcweir bool bPaintCompleteBack( !pNoTxt );
3680cdf0e10cSrcweir // <--
3681cdf0e10cSrcweir // paint complete background for transparent graphic and contour,
3682cdf0e10cSrcweir // if own background color exists.
3683cdf0e10cSrcweir const bool bIsGraphicTransparent = pNoTxt ? pNoTxt->IsTransparent() : false;
3684cdf0e10cSrcweir if ( !bPaintCompleteBack &&
3685cdf0e10cSrcweir ( bIsGraphicTransparent|| bContour ) )
3686cdf0e10cSrcweir {
368764b14621SArmin Le Grand const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(GetFmt());
368864b14621SArmin Le Grand
368928160478SArmin Le Grand if(pSwFrmFmt && pSwFrmFmt->supportsFullDrawingLayerFillAttributeSet())
369064b14621SArmin Le Grand {
369164b14621SArmin Le Grand //UUUU check for transparency
369256b35d86SArmin Le Grand const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pSwFrmFmt->getSdrAllFillAttributesHelper());
369364b14621SArmin Le Grand
3694b740b198SArmin Le Grand // check if the new fill attributes are used
3695b740b198SArmin Le Grand if(aFillAttributes.get() && aFillAttributes->isUsed())
369664b14621SArmin Le Grand {
3697b740b198SArmin Le Grand bPaintCompleteBack = true;
369864b14621SArmin Le Grand }
369964b14621SArmin Le Grand }
370064b14621SArmin Le Grand else
370164b14621SArmin Le Grand {
3702cdf0e10cSrcweir const SvxBrushItem &rBack = GetFmt()->GetBackground();
3703cdf0e10cSrcweir // OD 07.08.2002 #99657# #GetTransChg#
3704cdf0e10cSrcweir // to determine, if background has to be painted, by checking, if
3705cdf0e10cSrcweir // background color is not COL_TRANSPARENT ("no fill"/"auto fill")
3706cdf0e10cSrcweir // or a background graphic exists.
3707cdf0e10cSrcweir bPaintCompleteBack = !(rBack.GetColor() == COL_TRANSPARENT) ||
3708cdf0e10cSrcweir rBack.GetGraphicPos() != GPOS_NONE;
3709cdf0e10cSrcweir }
371064b14621SArmin Le Grand }
3711cdf0e10cSrcweir // paint of margin needed.
3712cdf0e10cSrcweir const bool bPaintMarginOnly( !bPaintCompleteBack &&
3713cdf0e10cSrcweir Prt().SSize() != Frm().SSize() );
3714cdf0e10cSrcweir
3715cdf0e10cSrcweir // --> OD 2005-06-08 #i47804# - paint background of parent fly frame
3716cdf0e10cSrcweir // for transparent graphics in layer Hell, if parent fly frame isn't
3717cdf0e10cSrcweir // in layer Hell. It's only painted the intersection between the
3718cdf0e10cSrcweir // parent fly frame area and the paint area <aRect>
3719cdf0e10cSrcweir const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
3720cdf0e10cSrcweir
3721cdf0e10cSrcweir if ( bIsGraphicTransparent &&
3722cdf0e10cSrcweir GetVirtDrawObj()->GetLayer() == pIDDMA->GetHellId() &&
3723cdf0e10cSrcweir GetAnchorFrm()->FindFlyFrm() )
3724cdf0e10cSrcweir {
3725cdf0e10cSrcweir const SwFlyFrm* pParentFlyFrm = GetAnchorFrm()->FindFlyFrm();
3726cdf0e10cSrcweir if ( pParentFlyFrm->GetDrawObj()->GetLayer() !=
3727cdf0e10cSrcweir pIDDMA->GetHellId() )
3728cdf0e10cSrcweir {
3729cdf0e10cSrcweir SwFlyFrm* pOldRet = pRetoucheFly2;
3730cdf0e10cSrcweir pRetoucheFly2 = const_cast<SwFlyFrm*>(this);
3731cdf0e10cSrcweir
3732cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), pParentFlyFrm );
3733cdf0e10cSrcweir const SwBorderAttrs &rAttrs = *aAccess.Get();
3734cdf0e10cSrcweir SwRect aPaintRect( aRect );
3735cdf0e10cSrcweir aPaintRect._Intersection( pParentFlyFrm->Frm() );
3736cdf0e10cSrcweir pParentFlyFrm->PaintBackground( aPaintRect, pPage, rAttrs, sal_False, sal_False );
3737cdf0e10cSrcweir
3738cdf0e10cSrcweir pRetoucheFly2 = pOldRet;
3739cdf0e10cSrcweir }
3740cdf0e10cSrcweir }
3741cdf0e10cSrcweir
3742cdf0e10cSrcweir if ( bPaintCompleteBack || bPaintMarginOnly )
3743cdf0e10cSrcweir {
3744cdf0e10cSrcweir //#24926# JP 01.02.96, PaintBaBo in teilen hier, damit PaintBorder
3745cdf0e10cSrcweir //das orig. Rect bekommt, aber PaintBackground das begrenzte.
3746cdf0e10cSrcweir
3747cdf0e10cSrcweir // OD 2004-04-23 #116347#
3748cdf0e10cSrcweir pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
3749cdf0e10cSrcweir pOut->SetLineColor();
3750cdf0e10cSrcweir
3751cdf0e10cSrcweir pPage = FindPageFrm();
3752cdf0e10cSrcweir
3753cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this );
3754cdf0e10cSrcweir const SwBorderAttrs &rAttrs = *aAccess.Get();
3755cdf0e10cSrcweir
3756cdf0e10cSrcweir // OD 06.08.2002 #99657# - paint border before painting background
3757cdf0e10cSrcweir // paint border
3758cdf0e10cSrcweir {
3759cdf0e10cSrcweir SwRect aTmp( rRect );
3760cdf0e10cSrcweir PaintBorder( aTmp, pPage, rAttrs );
3761cdf0e10cSrcweir }
3762cdf0e10cSrcweir
3763cdf0e10cSrcweir // paint background
3764cdf0e10cSrcweir {
3765cdf0e10cSrcweir SwRegionRects aRegion( aRect );
3766cdf0e10cSrcweir // --> OD 2007-12-13 #i80822#
3767cdf0e10cSrcweir // suppress painting of background in printing area for
3768cdf0e10cSrcweir // non-transparent graphics.
3769cdf0e10cSrcweir // if ( bPaintMarginOnly )
3770cdf0e10cSrcweir if ( bPaintMarginOnly ||
3771cdf0e10cSrcweir ( pNoTxt && !bIsGraphicTransparent ) )
3772cdf0e10cSrcweir // <--
3773cdf0e10cSrcweir {
3774cdf0e10cSrcweir //Was wir eigentlich Painten wollen ist der schmale Streifen
3775cdf0e10cSrcweir //zwischen PrtArea und aeusserer Umrandung.
3776cdf0e10cSrcweir SwRect aTmp( Prt() ); aTmp += Frm().Pos();
3777cdf0e10cSrcweir aRegion -= aTmp;
3778cdf0e10cSrcweir }
3779cdf0e10cSrcweir if ( bContour )
3780cdf0e10cSrcweir {
3781cdf0e10cSrcweir pOut->Push();
3782cdf0e10cSrcweir // --> OD 2007-12-13 #i80822#
3783cdf0e10cSrcweir // apply clip region under the same conditions, which are
3784cdf0e10cSrcweir // used in <SwNoTxtFrm::Paint(..)> to set the clip region
3785cdf0e10cSrcweir // for painting the graphic/OLE. Thus, the clip region is
3786cdf0e10cSrcweir // also applied for the PDF export.
3787cdf0e10cSrcweir // if ( !pOut->GetConnectMetaFile() || pOut->GetOutDevType() == OUTDEV_PRINTER )
3788cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
3789cdf0e10cSrcweir if ( !pOut->GetConnectMetaFile() || !pSh || !pSh->GetWin() )
3790cdf0e10cSrcweir // <--
3791cdf0e10cSrcweir {
3792cdf0e10cSrcweir pOut->SetClipRegion( aPoly );
3793cdf0e10cSrcweir }
3794cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
3795cdf0e10cSrcweir PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
3796cdf0e10cSrcweir pOut->Pop();
3797cdf0e10cSrcweir }
3798cdf0e10cSrcweir else
3799cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
3800cdf0e10cSrcweir PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
3801cdf0e10cSrcweir }
3802cdf0e10cSrcweir
3803cdf0e10cSrcweir pOut->Pop();
3804cdf0e10cSrcweir }
3805cdf0e10cSrcweir }
3806cdf0e10cSrcweir
3807f53e21faSmseidel // OD 19.12.2002 #106318# - fly frame will paint its subsidiary lines and
3808cdf0e10cSrcweir // the subsidiary lines of its lowers on its own, due to overlapping with
3809cdf0e10cSrcweir // other fly frames or other objects.
3810cdf0e10cSrcweir if( pGlobalShell->GetWin()
3811cdf0e10cSrcweir && !bIsChart ) //#i102950# don't paint additional borders for charts
3812cdf0e10cSrcweir {
3813cdf0e10cSrcweir bool bSubsLineRectsCreated;
3814cdf0e10cSrcweir if ( pSubsLines )
3815cdf0e10cSrcweir {
3816cdf0e10cSrcweir // Lock already existing subsidiary lines
3817cdf0e10cSrcweir pSubsLines->LockLines( sal_True );
3818cdf0e10cSrcweir bSubsLineRectsCreated = false;
3819cdf0e10cSrcweir }
3820cdf0e10cSrcweir else
3821cdf0e10cSrcweir {
3822cdf0e10cSrcweir // create new subsidiardy lines
3823cdf0e10cSrcweir pSubsLines = new SwSubsRects;
3824cdf0e10cSrcweir bSubsLineRectsCreated = true;
3825cdf0e10cSrcweir }
3826cdf0e10cSrcweir
3827cdf0e10cSrcweir bool bSpecSubsLineRectsCreated;
3828cdf0e10cSrcweir if ( pSpecSubsLines )
3829cdf0e10cSrcweir {
3830cdf0e10cSrcweir // Lock already existing special subsidiary lines
3831cdf0e10cSrcweir pSpecSubsLines->LockLines( sal_True );
3832cdf0e10cSrcweir bSpecSubsLineRectsCreated = false;
3833cdf0e10cSrcweir }
3834cdf0e10cSrcweir else
3835cdf0e10cSrcweir {
3836f53e21faSmseidel // create new special subsidiary lines
3837cdf0e10cSrcweir pSpecSubsLines = new SwSubsRects;
3838cdf0e10cSrcweir bSpecSubsLineRectsCreated = true;
3839cdf0e10cSrcweir }
3840cdf0e10cSrcweir // Add subsidiary lines of fly frame and its lowers
3841cdf0e10cSrcweir RefreshLaySubsidiary( pPage, aRect );
3842cdf0e10cSrcweir // paint subsidiary lines of fly frame and its lowers
3843cdf0e10cSrcweir pSpecSubsLines->PaintSubsidiary( pOut, NULL );
3844cdf0e10cSrcweir pSubsLines->PaintSubsidiary( pOut, pLines );
3845cdf0e10cSrcweir if ( !bSubsLineRectsCreated )
3846cdf0e10cSrcweir // unlock subsidiary lines
3847cdf0e10cSrcweir pSubsLines->LockLines( sal_False );
3848cdf0e10cSrcweir else
3849cdf0e10cSrcweir // delete created subsidiary lines container
3850cdf0e10cSrcweir DELETEZ( pSubsLines );
3851cdf0e10cSrcweir
3852cdf0e10cSrcweir if ( !bSpecSubsLineRectsCreated )
3853cdf0e10cSrcweir // unlock special subsidiary lines
3854cdf0e10cSrcweir pSpecSubsLines->LockLines( sal_False );
3855cdf0e10cSrcweir else
3856cdf0e10cSrcweir {
3857cdf0e10cSrcweir // delete created special subsidiary lines container
3858cdf0e10cSrcweir DELETEZ( pSpecSubsLines );
3859cdf0e10cSrcweir }
3860cdf0e10cSrcweir }
3861cdf0e10cSrcweir
3862cdf0e10cSrcweir SwLayoutFrm::Paint( aRect );
3863cdf0e10cSrcweir
3864cdf0e10cSrcweir Validate();
3865cdf0e10cSrcweir
3866cdf0e10cSrcweir // OD 19.12.2002 #106318# - first paint lines added by fly frame paint
3867cdf0e10cSrcweir // and then unlock other lines.
3868cdf0e10cSrcweir pLines->PaintLines( pOut );
3869cdf0e10cSrcweir pLines->LockLines( sal_False );
3870cdf0e10cSrcweir
3871cdf0e10cSrcweir pOut->Pop();
3872cdf0e10cSrcweir
3873cdf0e10cSrcweir if ( pProgress && pNoTxt )
3874cdf0e10cSrcweir pProgress->Reschedule();
3875cdf0e10cSrcweir }
3876cdf0e10cSrcweir /*************************************************************************
3877cdf0e10cSrcweir |*
3878cdf0e10cSrcweir |* SwTabFrm::Paint()
3879cdf0e10cSrcweir |*
3880cdf0e10cSrcweir |* Ersterstellung MA 11. May. 93
3881cdf0e10cSrcweir |* Letzte Aenderung MA 23. Mar. 95
3882cdf0e10cSrcweir |*
3883cdf0e10cSrcweir |*************************************************************************/
3884cdf0e10cSrcweir
Paint(SwRect const & rRect,SwPrintData const * const) const3885cdf0e10cSrcweir void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
3886cdf0e10cSrcweir {
3887cdf0e10cSrcweir if ( pGlobalShell->GetViewOptions()->IsTable() )
3888cdf0e10cSrcweir {
3889cdf0e10cSrcweir // --> collapsing borders FME 2005-05-27 #i29550#
3890cdf0e10cSrcweir if ( IsCollapsingBorders() )
3891cdf0e10cSrcweir {
3892cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this );
3893cdf0e10cSrcweir const SwBorderAttrs &rAttrs = *aAccess.Get();
3894cdf0e10cSrcweir
3895cdf0e10cSrcweir // paint shadow
3896cdf0e10cSrcweir if ( rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE )
3897cdf0e10cSrcweir {
3898cdf0e10cSrcweir SwRect aRect;
3899cdf0e10cSrcweir ::lcl_CalcBorderRect( aRect, this, rAttrs, sal_True );
3900cdf0e10cSrcweir PaintShadow( rRect, aRect, rAttrs );
3901cdf0e10cSrcweir }
3902cdf0e10cSrcweir
3903cdf0e10cSrcweir // paint lines
3904cdf0e10cSrcweir SwTabFrmPainter aHelper( *this );
3905cdf0e10cSrcweir aHelper.PaintLines( *pGlobalShell->GetOut(), rRect );
3906cdf0e10cSrcweir }
3907cdf0e10cSrcweir // <-- collapsing
3908cdf0e10cSrcweir
3909cdf0e10cSrcweir SwLayoutFrm::Paint( rRect );
3910cdf0e10cSrcweir }
3911cdf0e10cSrcweir // OD 10.01.2003 #i6467# - no light grey rectangle for page preview
3912cdf0e10cSrcweir else if ( pGlobalShell->GetWin() && !pGlobalShell->IsPreView() )
3913cdf0e10cSrcweir {
3914cdf0e10cSrcweir // OD 10.01.2003 #i6467# - intersect output rectangle with table frame
3915cdf0e10cSrcweir SwRect aTabRect( Prt() );
3916cdf0e10cSrcweir aTabRect.Pos() += Frm().Pos();
3917cdf0e10cSrcweir SwRect aTabOutRect( rRect );
3918cdf0e10cSrcweir aTabOutRect.Intersection( aTabRect );
3919cdf0e10cSrcweir pGlobalShell->GetViewOptions()->
3920cdf0e10cSrcweir DrawRect( pGlobalShell->GetOut(), aTabOutRect, COL_LIGHTGRAY );
3921cdf0e10cSrcweir }
3922cdf0e10cSrcweir ((SwTabFrm*)this)->ResetComplete();
3923cdf0e10cSrcweir }
3924cdf0e10cSrcweir
3925cdf0e10cSrcweir /*************************************************************************
3926cdf0e10cSrcweir |*
3927cdf0e10cSrcweir |* SwFrm::PaintShadow()
3928cdf0e10cSrcweir |*
3929cdf0e10cSrcweir |* Beschreibung Malt einen Schatten wenns das FrmFormat fordert.
3930cdf0e10cSrcweir |* Der Schatten wird immer an den auesseren Rand des OutRect gemalt.
3931cdf0e10cSrcweir |* Das OutRect wird ggf. so verkleinert, dass auf diesem das
3932cdf0e10cSrcweir |* malen der Umrandung stattfinden kann.
3933cdf0e10cSrcweir |* Ersterstellung MA 21. Dec. 92
3934cdf0e10cSrcweir |* Letzte Aenderung MA 29. May. 97
3935cdf0e10cSrcweir |*
3936cdf0e10cSrcweir |*************************************************************************/
3937cdf0e10cSrcweir /// OD 23.08.2002 #99657#
3938cdf0e10cSrcweir /// draw full shadow rectangle for frames with transparent drawn backgrounds.
PaintShadow(const SwRect & rRect,SwRect & rOutRect,const SwBorderAttrs & rAttrs) const3939cdf0e10cSrcweir void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
3940cdf0e10cSrcweir const SwBorderAttrs &rAttrs ) const
3941cdf0e10cSrcweir {
3942cdf0e10cSrcweir const SvxShadowItem &rShadow = rAttrs.GetShadow();
3943cdf0e10cSrcweir const long nWidth = ::lcl_AlignWidth ( rShadow.GetWidth() );
3944cdf0e10cSrcweir const long nHeight = ::lcl_AlignHeight( rShadow.GetWidth() );
3945cdf0e10cSrcweir
3946cdf0e10cSrcweir SwRects aRegion( 2, 2 );
3947cdf0e10cSrcweir SwRect aOut( rOutRect );
3948cdf0e10cSrcweir
3949cdf0e10cSrcweir const sal_Bool bCnt = IsCntntFrm();
3950cdf0e10cSrcweir const sal_Bool bTop = !bCnt || rAttrs.GetTopLine ( *(this) ) ? sal_True : sal_False;
3951cdf0e10cSrcweir const sal_Bool bBottom = !bCnt || rAttrs.GetBottomLine( *(this) ) ? sal_True : sal_False;
3952cdf0e10cSrcweir
3953cdf0e10cSrcweir SvxShadowLocation eLoc = rShadow.GetLocation();
3954cdf0e10cSrcweir
3955cdf0e10cSrcweir SWRECTFN( this )
3956cdf0e10cSrcweir if( IsVertical() )
3957cdf0e10cSrcweir {
3958cdf0e10cSrcweir switch( eLoc )
3959cdf0e10cSrcweir {
3960cdf0e10cSrcweir case SVX_SHADOW_BOTTOMRIGHT: eLoc = SVX_SHADOW_BOTTOMLEFT; break;
3961cdf0e10cSrcweir case SVX_SHADOW_TOPLEFT: eLoc = SVX_SHADOW_TOPRIGHT; break;
3962cdf0e10cSrcweir case SVX_SHADOW_TOPRIGHT: eLoc = SVX_SHADOW_BOTTOMRIGHT; break;
3963cdf0e10cSrcweir case SVX_SHADOW_BOTTOMLEFT: eLoc = SVX_SHADOW_TOPLEFT; break;
3964cdf0e10cSrcweir default: break;
3965cdf0e10cSrcweir }
3966cdf0e10cSrcweir }
3967cdf0e10cSrcweir
3968cdf0e10cSrcweir /// OD 23.08.2002 #99657# - determine, if full shadow rectangle have to
3969cdf0e10cSrcweir /// be drawn or only two shadow rectangles beside the frame.
3970cdf0e10cSrcweir /// draw full shadow rectangle, if frame background is drawn transparent.
3971cdf0e10cSrcweir /// Status Quo:
3972cdf0e10cSrcweir /// SwLayoutFrm can have transparent drawn backgrounds. Thus,
3973cdf0e10cSrcweir /// "asked" their frame format.
3974cdf0e10cSrcweir sal_Bool bDrawFullShadowRectangle =
3975cdf0e10cSrcweir ( IsLayoutFrm() &&
3976cdf0e10cSrcweir (static_cast<const SwLayoutFrm*>(this))->GetFmt()->IsBackgroundTransparent()
3977cdf0e10cSrcweir );
3978cdf0e10cSrcweir switch ( eLoc )
3979cdf0e10cSrcweir {
3980cdf0e10cSrcweir case SVX_SHADOW_BOTTOMRIGHT:
3981cdf0e10cSrcweir {
3982cdf0e10cSrcweir if ( bDrawFullShadowRectangle )
3983cdf0e10cSrcweir {
3984cdf0e10cSrcweir /// OD 06.08.2002 #99657# - draw full shadow rectangle
3985cdf0e10cSrcweir aOut.Top( aOut.Top() + nHeight );
3986cdf0e10cSrcweir aOut.Left( aOut.Left() + nWidth );
3987cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
3988cdf0e10cSrcweir }
3989cdf0e10cSrcweir else
3990cdf0e10cSrcweir {
3991cdf0e10cSrcweir aOut.Top ( aOut.Bottom() - nHeight );
3992cdf0e10cSrcweir aOut.Left( aOut.Left() + nWidth );
3993cdf0e10cSrcweir if ( bBottom )
3994cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
3995cdf0e10cSrcweir aOut.Left( aOut.Right() - nWidth );
3996cdf0e10cSrcweir aOut.Top ( rOutRect.Top() + nHeight );
3997cdf0e10cSrcweir if ( bBottom )
3998cdf0e10cSrcweir aOut.Bottom( aOut.Bottom() - nHeight );
3999cdf0e10cSrcweir if ( bCnt && (!bTop || !bBottom) )
4000cdf0e10cSrcweir ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4001cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4002cdf0e10cSrcweir }
4003cdf0e10cSrcweir
4004cdf0e10cSrcweir rOutRect.Right ( rOutRect.Right() - nWidth );
4005cdf0e10cSrcweir rOutRect.Bottom( rOutRect.Bottom()- nHeight );
4006cdf0e10cSrcweir }
4007cdf0e10cSrcweir break;
4008cdf0e10cSrcweir case SVX_SHADOW_TOPLEFT:
4009cdf0e10cSrcweir {
4010cdf0e10cSrcweir if ( bDrawFullShadowRectangle )
4011cdf0e10cSrcweir {
4012cdf0e10cSrcweir /// OD 06.08.2002 #99657# - draw full shadow rectangle
4013cdf0e10cSrcweir aOut.Bottom( aOut.Bottom() - nHeight );
4014cdf0e10cSrcweir aOut.Right( aOut.Right() - nWidth );
4015cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4016cdf0e10cSrcweir }
4017cdf0e10cSrcweir else
4018cdf0e10cSrcweir {
4019cdf0e10cSrcweir aOut.Bottom( aOut.Top() + nHeight );
4020cdf0e10cSrcweir aOut.Right ( aOut.Right() - nWidth );
4021cdf0e10cSrcweir if ( bTop )
4022cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4023cdf0e10cSrcweir aOut.Right ( aOut.Left() + nWidth );
4024cdf0e10cSrcweir aOut.Bottom( rOutRect.Bottom() - nHeight );
4025cdf0e10cSrcweir if ( bTop )
4026cdf0e10cSrcweir aOut.Top( aOut.Top() + nHeight );
4027cdf0e10cSrcweir if ( bCnt && (!bBottom || !bTop) )
4028cdf0e10cSrcweir ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4029cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4030cdf0e10cSrcweir }
4031cdf0e10cSrcweir
4032cdf0e10cSrcweir rOutRect.Left( rOutRect.Left() + nWidth );
4033cdf0e10cSrcweir rOutRect.Top( rOutRect.Top() + nHeight );
4034cdf0e10cSrcweir }
4035cdf0e10cSrcweir break;
4036cdf0e10cSrcweir case SVX_SHADOW_TOPRIGHT:
4037cdf0e10cSrcweir {
4038cdf0e10cSrcweir if ( bDrawFullShadowRectangle )
4039cdf0e10cSrcweir {
4040cdf0e10cSrcweir /// OD 06.08.2002 #99657# - draw full shadow rectangle
4041cdf0e10cSrcweir aOut.Bottom( aOut.Bottom() - nHeight);
4042cdf0e10cSrcweir aOut.Left( aOut.Left() + nWidth );
4043cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4044cdf0e10cSrcweir }
4045cdf0e10cSrcweir else
4046cdf0e10cSrcweir {
4047cdf0e10cSrcweir aOut.Bottom( aOut.Top() + nHeight );
4048cdf0e10cSrcweir aOut.Left ( aOut.Left()+ nWidth );
4049cdf0e10cSrcweir if ( bTop )
4050cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4051cdf0e10cSrcweir aOut.Left ( aOut.Right() - nWidth );
4052cdf0e10cSrcweir aOut.Bottom( rOutRect.Bottom() - nHeight );
4053cdf0e10cSrcweir if ( bTop )
4054cdf0e10cSrcweir aOut.Top( aOut.Top() + nHeight );
4055cdf0e10cSrcweir if ( bCnt && (!bBottom || bTop) )
4056cdf0e10cSrcweir ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4057cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4058cdf0e10cSrcweir }
4059cdf0e10cSrcweir
4060cdf0e10cSrcweir rOutRect.Right( rOutRect.Right() - nWidth );
4061cdf0e10cSrcweir rOutRect.Top( rOutRect.Top() + nHeight );
4062cdf0e10cSrcweir }
4063cdf0e10cSrcweir break;
4064cdf0e10cSrcweir case SVX_SHADOW_BOTTOMLEFT:
4065cdf0e10cSrcweir {
4066cdf0e10cSrcweir if ( bDrawFullShadowRectangle )
4067cdf0e10cSrcweir {
4068cdf0e10cSrcweir /// OD 06.08.2002 #99657# - draw full shadow rectangle
4069cdf0e10cSrcweir aOut.Top( aOut.Top() + nHeight );
4070cdf0e10cSrcweir aOut.Right( aOut.Right() - nWidth );
4071cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4072cdf0e10cSrcweir }
4073cdf0e10cSrcweir else
4074cdf0e10cSrcweir {
4075cdf0e10cSrcweir aOut.Top ( aOut.Bottom()- nHeight );
4076cdf0e10cSrcweir aOut.Right( aOut.Right() - nWidth );
4077cdf0e10cSrcweir if ( bBottom )
4078cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4079cdf0e10cSrcweir aOut.Right( aOut.Left() + nWidth );
4080cdf0e10cSrcweir aOut.Top( rOutRect.Top() + nHeight );
4081cdf0e10cSrcweir if ( bBottom )
4082cdf0e10cSrcweir aOut.Bottom( aOut.Bottom() - nHeight );
4083cdf0e10cSrcweir if ( bCnt && (!bTop || !bBottom) )
4084cdf0e10cSrcweir ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4085cdf0e10cSrcweir aRegion.Insert( aOut, aRegion.Count() );
4086cdf0e10cSrcweir }
4087cdf0e10cSrcweir
4088cdf0e10cSrcweir rOutRect.Left( rOutRect.Left() + nWidth );
4089cdf0e10cSrcweir rOutRect.Bottom( rOutRect.Bottom() - nHeight );
4090cdf0e10cSrcweir }
4091cdf0e10cSrcweir break;
4092cdf0e10cSrcweir default:
4093870262e3SDon Lewis ASSERT( sal_False, "new ShadowLocation() ?" )
4094cdf0e10cSrcweir break;
4095cdf0e10cSrcweir }
4096cdf0e10cSrcweir
4097cdf0e10cSrcweir OutputDevice *pOut = pGlobalShell->GetOut();
4098cdf0e10cSrcweir
4099cdf0e10cSrcweir sal_uLong nOldDrawMode = pOut->GetDrawMode();
4100cdf0e10cSrcweir Color aShadowColor( rShadow.GetColor() );
4101cdf0e10cSrcweir if( aRegion.Count() && pGlobalShell->GetWin() &&
4102cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
4103cdf0e10cSrcweir {
4104f53e21faSmseidel // In high contrast mode, the output device has already set the
4105cdf0e10cSrcweir // DRAWMODE_SETTINGSFILL flag. This causes the SetFillColor function
4106cdf0e10cSrcweir // to ignore the setting of a new color. Therefore we have to reset
4107cdf0e10cSrcweir // the drawing mode
4108cdf0e10cSrcweir pOut->SetDrawMode( 0 );
4109cdf0e10cSrcweir aShadowColor = SwViewOption::GetFontColor();
4110cdf0e10cSrcweir }
4111cdf0e10cSrcweir
4112cdf0e10cSrcweir if ( pOut->GetFillColor() != aShadowColor )
4113cdf0e10cSrcweir pOut->SetFillColor( aShadowColor );
4114cdf0e10cSrcweir
4115cdf0e10cSrcweir pOut->SetDrawMode( nOldDrawMode );
4116cdf0e10cSrcweir
4117cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
4118cdf0e10cSrcweir {
4119cdf0e10cSrcweir SwRect &rOut = aRegion[i];
4120cdf0e10cSrcweir aOut = rOut;
4121cdf0e10cSrcweir // OD 30.09.2002 #103636# - no SwAlign of shadow rectangle
4122cdf0e10cSrcweir // no alignment necessary, because (1) <rRect> is already aligned
4123cdf0e10cSrcweir // and because (2) paint of border and background will occur later.
412486e1cf34SPedro Giffuni // Thus, (1) assures that no conflicts with neighbour object will occur
4125cdf0e10cSrcweir // and (2) assures that border and background is not affected by the
4126cdf0e10cSrcweir // shadow paint.
4127cdf0e10cSrcweir /*
4128cdf0e10cSrcweir ::SwAlignRect( aOut, pGlobalShell );
4129cdf0e10cSrcweir */
4130cdf0e10cSrcweir if ( rRect.IsOver( aOut ) && aOut.Height() > 0 && aOut.Width() > 0 )
4131cdf0e10cSrcweir {
4132cdf0e10cSrcweir aOut._Intersection( rRect );
4133cdf0e10cSrcweir pOut->DrawRect( aOut.SVRect() );
4134cdf0e10cSrcweir }
4135cdf0e10cSrcweir }
4136cdf0e10cSrcweir }
4137cdf0e10cSrcweir
4138cdf0e10cSrcweir /*************************************************************************
4139cdf0e10cSrcweir |*
4140cdf0e10cSrcweir |* SwFrm::PaintBorderLine()
4141cdf0e10cSrcweir |*
4142cdf0e10cSrcweir |* Ersterstellung MA 22. Dec. 92
4143cdf0e10cSrcweir |* Letzte Aenderung MA 22. Jan. 95
4144cdf0e10cSrcweir |*
4145cdf0e10cSrcweir |*************************************************************************/
4146cdf0e10cSrcweir
PaintBorderLine(const SwRect & rRect,const SwRect & rOutRect,const SwPageFrm *,const Color * pColor) const4147cdf0e10cSrcweir void SwFrm::PaintBorderLine( const SwRect& rRect,
4148cdf0e10cSrcweir const SwRect& rOutRect,
4149b740b198SArmin Le Grand const SwPageFrm* /*pPage*/,
4150cdf0e10cSrcweir const Color *pColor ) const
4151cdf0e10cSrcweir {
4152cdf0e10cSrcweir if ( !rOutRect.IsOver( rRect ) )
4153cdf0e10cSrcweir return;
4154cdf0e10cSrcweir
4155cdf0e10cSrcweir SwRect aOut( rOutRect );
4156cdf0e10cSrcweir aOut._Intersection( rRect );
4157cdf0e10cSrcweir
4158cdf0e10cSrcweir const SwTabFrm *pTab = IsCellFrm() ? FindTabFrm() : 0;
4159cdf0e10cSrcweir sal_uInt8 nSubCol = ( IsCellFrm() || IsRowFrm() ) ? SUBCOL_TAB :
4160cdf0e10cSrcweir ( IsInSct() ? SUBCOL_SECT :
4161cdf0e10cSrcweir ( IsInFly() ? SUBCOL_FLY : SUBCOL_PAGE ) );
4162cdf0e10cSrcweir if( pColor && pGlobalShell->GetWin() &&
4163cdf0e10cSrcweir Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
4164cdf0e10cSrcweir {
4165cdf0e10cSrcweir pColor = &SwViewOption::GetFontColor();
4166cdf0e10cSrcweir }
4167cdf0e10cSrcweir
416864b14621SArmin Le Grand //if ( pPage->GetSortedObjs() )
416964b14621SArmin Le Grand //{
417064b14621SArmin Le Grand // SwRegionRects aRegion( aOut, 4, 1 );
417164b14621SArmin Le Grand // ::lcl_SubtractFlys( this, pPage, aOut, aRegion );
417264b14621SArmin Le Grand // for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
417364b14621SArmin Le Grand // pLines->AddLineRect( aRegion[i], pColor, pTab, nSubCol );
417464b14621SArmin Le Grand //}
417564b14621SArmin Le Grand //else
4176cdf0e10cSrcweir pLines->AddLineRect( aOut, pColor, pTab, nSubCol );
4177cdf0e10cSrcweir }
4178cdf0e10cSrcweir
4179cdf0e10cSrcweir /*************************************************************************
4180cdf0e10cSrcweir |*
4181cdf0e10cSrcweir |* SwFrm::PaintBorderLines()
4182cdf0e10cSrcweir |*
4183cdf0e10cSrcweir |* Beschreibung Nur alle Linien einfach oder alle Linien doppelt!!!!
4184cdf0e10cSrcweir |* Ersterstellung MA 22. Dec. 92
4185cdf0e10cSrcweir |* Letzte Aenderung MA 22. Mar. 95
4186cdf0e10cSrcweir |*
4187cdf0e10cSrcweir |*************************************************************************/
4188cdf0e10cSrcweir
4189cdf0e10cSrcweir // OD 29.04.2003 #107169# - method called for left and right border rectangles.
4190cdf0e10cSrcweir // For a printer output device perform adjustment for non-overlapping top and
4191cdf0e10cSrcweir // bottom border rectangles. Thus, add parameter <_bPrtOutputDev> to indicate
4192cdf0e10cSrcweir // printer output device.
4193cdf0e10cSrcweir // NOTE: For printer output device left/right border rectangle <_iorRect>
4194cdf0e10cSrcweir // has to be already non-overlapping the outer top/bottom border rectangle.
lcl_SubTopBottom(SwRect & _iorRect,const SvxBoxItem & _rBox,const SwBorderAttrs & _rAttrs,const SwFrm & _rFrm,const SwRectFn & _rRectFn,const sal_Bool _bPrtOutputDev)4195cdf0e10cSrcweir void MA_FASTCALL lcl_SubTopBottom( SwRect& _iorRect,
4196cdf0e10cSrcweir const SvxBoxItem& _rBox,
4197cdf0e10cSrcweir const SwBorderAttrs& _rAttrs,
4198cdf0e10cSrcweir const SwFrm& _rFrm,
4199cdf0e10cSrcweir const SwRectFn& _rRectFn,
4200cdf0e10cSrcweir const sal_Bool _bPrtOutputDev )
4201cdf0e10cSrcweir {
4202cdf0e10cSrcweir const sal_Bool bCnt = _rFrm.IsCntntFrm();
4203cdf0e10cSrcweir if ( _rBox.GetTop() && _rBox.GetTop()->GetInWidth() &&
4204cdf0e10cSrcweir ( !bCnt || _rAttrs.GetTopLine( _rFrm ) )
4205cdf0e10cSrcweir )
4206cdf0e10cSrcweir {
420786e1cf34SPedro Giffuni // subtract distance between outer and inner line.
4208cdf0e10cSrcweir SwTwips nDist = ::lcl_MinHeightDist( _rBox.GetTop()->GetDistance() );
4209cdf0e10cSrcweir // OD 19.05.2003 #109667# - non-overlapping border rectangles:
4210cdf0e10cSrcweir // adjust x-/y-position, if inner top line is a hair line (width = 1)
4211cdf0e10cSrcweir sal_Bool bIsInnerTopLineHairline = sal_False;
4212cdf0e10cSrcweir if ( !_bPrtOutputDev )
4213cdf0e10cSrcweir {
421486e1cf34SPedro Giffuni // additionally subtract width of top outer line
4215cdf0e10cSrcweir // --> left/right inner/outer line doesn't overlap top outer line.
4216cdf0e10cSrcweir nDist += ::lcl_AlignHeight( _rBox.GetTop()->GetOutWidth() );
4217cdf0e10cSrcweir }
4218cdf0e10cSrcweir else
4219cdf0e10cSrcweir {
422086e1cf34SPedro Giffuni // OD 29.04.2003 #107169# - additionally subtract width of top inner line
4221cdf0e10cSrcweir // --> left/right inner/outer line doesn't overlap top inner line.
4222cdf0e10cSrcweir nDist += ::lcl_AlignHeight( _rBox.GetTop()->GetInWidth() );
4223cdf0e10cSrcweir bIsInnerTopLineHairline = _rBox.GetTop()->GetInWidth() == 1;
4224cdf0e10cSrcweir }
4225cdf0e10cSrcweir (_iorRect.*_rRectFn->fnSubTop)( -nDist );
4226cdf0e10cSrcweir // OD 19.05.2003 #109667# - adjust calculated border top, if inner top line
4227cdf0e10cSrcweir // is a hair line
4228cdf0e10cSrcweir if ( bIsInnerTopLineHairline )
4229cdf0e10cSrcweir {
4230cdf0e10cSrcweir if ( _rFrm.IsVertical() )
4231cdf0e10cSrcweir {
4232cdf0e10cSrcweir // right of border rectangle has to be checked and adjusted
4233cdf0e10cSrcweir Point aCompPt( _iorRect.Right(), 0 );
4234cdf0e10cSrcweir Point aRefPt( aCompPt.X() + 1, aCompPt.Y() );
4235cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4236cdf0e10cSrcweir aRefPt, aCompPt,
4237cdf0e10cSrcweir sal_True, -1 );
4238cdf0e10cSrcweir _iorRect.Right( aCompPt.X() );
4239cdf0e10cSrcweir }
4240cdf0e10cSrcweir else
4241cdf0e10cSrcweir {
4242cdf0e10cSrcweir // top of border rectangle has to be checked and adjusted
4243cdf0e10cSrcweir Point aCompPt( 0, _iorRect.Top() );
4244cdf0e10cSrcweir Point aRefPt( aCompPt.X(), aCompPt.Y() - 1 );
4245cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4246cdf0e10cSrcweir aRefPt, aCompPt,
4247cdf0e10cSrcweir sal_False, +1 );
4248cdf0e10cSrcweir _iorRect.Top( aCompPt.Y() );
4249cdf0e10cSrcweir }
4250cdf0e10cSrcweir }
4251cdf0e10cSrcweir }
4252cdf0e10cSrcweir
4253cdf0e10cSrcweir if ( _rBox.GetBottom() && _rBox.GetBottom()->GetInWidth() &&
4254cdf0e10cSrcweir ( !bCnt || _rAttrs.GetBottomLine( _rFrm ) )
4255cdf0e10cSrcweir )
4256cdf0e10cSrcweir {
425786e1cf34SPedro Giffuni // subtract distance between outer and inner line.
4258cdf0e10cSrcweir SwTwips nDist = ::lcl_MinHeightDist( _rBox.GetBottom()->GetDistance() );
4259cdf0e10cSrcweir // OD 19.05.2003 #109667# - non-overlapping border rectangles:
4260cdf0e10cSrcweir // adjust x-/y-position, if inner bottom line is a hair line (width = 1)
4261cdf0e10cSrcweir sal_Bool bIsInnerBottomLineHairline = sal_False;
4262cdf0e10cSrcweir if ( !_bPrtOutputDev )
4263cdf0e10cSrcweir {
426486e1cf34SPedro Giffuni // additionally subtract width of bottom outer line
4265cdf0e10cSrcweir // --> left/right inner/outer line doesn't overlap bottom outer line.
4266cdf0e10cSrcweir nDist += ::lcl_AlignHeight( _rBox.GetBottom()->GetOutWidth() );
4267cdf0e10cSrcweir }
4268cdf0e10cSrcweir else
4269cdf0e10cSrcweir {
427086e1cf34SPedro Giffuni // OD 29.04.2003 #107169# - additionally subtract width of bottom inner line
4271cdf0e10cSrcweir // --> left/right inner/outer line doesn't overlap bottom inner line.
4272cdf0e10cSrcweir nDist += ::lcl_AlignHeight( _rBox.GetBottom()->GetInWidth() );
4273cdf0e10cSrcweir bIsInnerBottomLineHairline = _rBox.GetBottom()->GetInWidth() == 1;
4274cdf0e10cSrcweir }
4275cdf0e10cSrcweir (_iorRect.*_rRectFn->fnAddBottom)( -nDist );
4276cdf0e10cSrcweir // OD 19.05.2003 #109667# - adjust calculated border bottom, if inner
4277cdf0e10cSrcweir // bottom line is a hair line.
4278cdf0e10cSrcweir if ( bIsInnerBottomLineHairline )
4279cdf0e10cSrcweir {
4280cdf0e10cSrcweir if ( _rFrm.IsVertical() )
4281cdf0e10cSrcweir {
4282cdf0e10cSrcweir // left of border rectangle has to be checked and adjusted
4283cdf0e10cSrcweir Point aCompPt( _iorRect.Left(), 0 );
4284cdf0e10cSrcweir Point aRefPt( aCompPt.X() - 1, aCompPt.Y() );
4285cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4286cdf0e10cSrcweir aRefPt, aCompPt,
4287cdf0e10cSrcweir sal_True, +1 );
4288cdf0e10cSrcweir _iorRect.Left( aCompPt.X() );
4289cdf0e10cSrcweir }
4290cdf0e10cSrcweir else
4291cdf0e10cSrcweir {
4292cdf0e10cSrcweir // bottom of border rectangle has to be checked and adjusted
4293cdf0e10cSrcweir Point aCompPt( 0, _iorRect.Bottom() );
4294cdf0e10cSrcweir Point aRefPt( aCompPt.X(), aCompPt.Y() + 1 );
4295cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4296cdf0e10cSrcweir aRefPt, aCompPt,
4297cdf0e10cSrcweir sal_False, -1 );
4298cdf0e10cSrcweir _iorRect.Bottom( aCompPt.Y() );
4299cdf0e10cSrcweir }
4300cdf0e10cSrcweir }
4301cdf0e10cSrcweir }
4302cdf0e10cSrcweir }
4303cdf0e10cSrcweir
4304cdf0e10cSrcweir // method called for top and bottom border rectangles.
lcl_SubLeftRight(SwRect & rRect,const SvxBoxItem & rBox,const SwRectFn & rRectFn)4305cdf0e10cSrcweir void MA_FASTCALL lcl_SubLeftRight( SwRect& rRect,
4306cdf0e10cSrcweir const SvxBoxItem& rBox,
4307cdf0e10cSrcweir const SwRectFn& rRectFn )
4308cdf0e10cSrcweir {
4309cdf0e10cSrcweir if ( rBox.GetLeft() && rBox.GetLeft()->GetInWidth() )
4310cdf0e10cSrcweir {
4311cdf0e10cSrcweir const long nDist = ::lcl_MinWidthDist( rBox.GetLeft()->GetDistance() )
4312cdf0e10cSrcweir + ::lcl_AlignWidth( rBox.GetLeft()->GetOutWidth() );
4313cdf0e10cSrcweir (rRect.*rRectFn->fnSubLeft)( -nDist );
4314cdf0e10cSrcweir }
4315cdf0e10cSrcweir
4316cdf0e10cSrcweir if ( rBox.GetRight() && rBox.GetRight()->GetInWidth() )
4317cdf0e10cSrcweir {
4318cdf0e10cSrcweir const long nDist = ::lcl_MinWidthDist( rBox.GetRight()->GetDistance() )
4319cdf0e10cSrcweir + ::lcl_AlignWidth( rBox.GetRight()->GetOutWidth() );
4320cdf0e10cSrcweir (rRect.*rRectFn->fnAddRight)( -nDist );
4321cdf0e10cSrcweir }
4322cdf0e10cSrcweir }
4323cdf0e10cSrcweir
4324cdf0e10cSrcweir // OD 19.05.2003 #109667# - merge <lcl_PaintLeftLine> and <lcl_PaintRightLine>
4325cdf0e10cSrcweir // into new method <lcl_PaintLeftRightLine(..)>
lcl_PaintLeftRightLine(const sal_Bool _bLeft,const SwFrm & _rFrm,const SwPageFrm & _rPage,const SwRect & _rOutRect,const SwRect & _rRect,const SwBorderAttrs & _rAttrs,const SwRectFn & _rRectFn)4326cdf0e10cSrcweir void lcl_PaintLeftRightLine( const sal_Bool _bLeft,
4327cdf0e10cSrcweir const SwFrm& _rFrm,
4328cdf0e10cSrcweir const SwPageFrm& _rPage,
4329cdf0e10cSrcweir const SwRect& _rOutRect,
4330cdf0e10cSrcweir const SwRect& _rRect,
4331cdf0e10cSrcweir const SwBorderAttrs& _rAttrs,
4332cdf0e10cSrcweir const SwRectFn& _rRectFn )
4333cdf0e10cSrcweir {
4334cdf0e10cSrcweir const SvxBoxItem& rBox = _rAttrs.GetBox();
4335cdf0e10cSrcweir const sal_Bool bR2L = _rFrm.IsCellFrm() && _rFrm.IsRightToLeft();
4336cdf0e10cSrcweir const SvxBorderLine* pLeftRightBorder = 0;
4337cdf0e10cSrcweir if ( _bLeft )
4338cdf0e10cSrcweir {
4339cdf0e10cSrcweir pLeftRightBorder = bR2L ? rBox.GetRight() : rBox.GetLeft();
4340cdf0e10cSrcweir }
4341cdf0e10cSrcweir else
4342cdf0e10cSrcweir {
4343cdf0e10cSrcweir pLeftRightBorder = bR2L ? rBox.GetLeft() : rBox.GetRight();
4344cdf0e10cSrcweir }
4345cdf0e10cSrcweir // OD 06.05.2003 #107169# - init boolean indicating printer output device.
4346cdf0e10cSrcweir const sal_Bool bPrtOutputDev =
4347cdf0e10cSrcweir ( OUTDEV_PRINTER == pGlobalShell->GetOut()->GetOutDevType() );
4348cdf0e10cSrcweir
4349cdf0e10cSrcweir if ( !pLeftRightBorder )
4350cdf0e10cSrcweir {
4351cdf0e10cSrcweir return;
4352cdf0e10cSrcweir }
4353cdf0e10cSrcweir
4354cdf0e10cSrcweir SwRect aRect( _rOutRect );
4355cdf0e10cSrcweir if ( _bLeft )
4356cdf0e10cSrcweir {
4357cdf0e10cSrcweir (aRect.*_rRectFn->fnAddRight)( ::lcl_AlignWidth( pLeftRightBorder->GetOutWidth() ) -
4358cdf0e10cSrcweir (aRect.*_rRectFn->fnGetWidth)() );
4359cdf0e10cSrcweir }
4360cdf0e10cSrcweir else
4361cdf0e10cSrcweir {
4362cdf0e10cSrcweir (aRect.*_rRectFn->fnSubLeft)( ::lcl_AlignWidth( pLeftRightBorder->GetOutWidth() ) -
4363cdf0e10cSrcweir (aRect.*_rRectFn->fnGetWidth)() );
4364cdf0e10cSrcweir }
4365cdf0e10cSrcweir
4366cdf0e10cSrcweir const sal_Bool bCnt = _rFrm.IsCntntFrm();
4367cdf0e10cSrcweir
4368cdf0e10cSrcweir if ( bCnt )
4369cdf0e10cSrcweir {
4370cdf0e10cSrcweir ::lcl_ExtendLeftAndRight( aRect, _rFrm, _rAttrs, _rRectFn );
4371cdf0e10cSrcweir }
4372cdf0e10cSrcweir
4373cdf0e10cSrcweir // OD 06.05.2003 #107169# - adjustments for printer output device
4374cdf0e10cSrcweir if ( bPrtOutputDev )
4375cdf0e10cSrcweir {
437686e1cf34SPedro Giffuni // subtract width of outer top line.
4377cdf0e10cSrcweir if ( rBox.GetTop() && (!bCnt || _rAttrs.GetTopLine( _rFrm )) )
4378cdf0e10cSrcweir {
4379cdf0e10cSrcweir long nDist = ::lcl_AlignHeight( rBox.GetTop()->GetOutWidth() );
4380cdf0e10cSrcweir (aRect.*_rRectFn->fnSubTop)( -nDist );
4381cdf0e10cSrcweir // OD 19.05.2003 #109667# - If outer top line is hair line, calculated
4382cdf0e10cSrcweir // top has to be adjusted.
4383cdf0e10cSrcweir if ( nDist == 1 )
4384cdf0e10cSrcweir {
4385cdf0e10cSrcweir if ( _rFrm.IsVertical() )
4386cdf0e10cSrcweir {
4387cdf0e10cSrcweir // right of border rectangle has to be checked and adjusted
4388cdf0e10cSrcweir Point aCompPt( aRect.Right(), 0 );
4389cdf0e10cSrcweir Point aRefPt( aCompPt.X() + 1, aCompPt.Y() );
4390cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4391cdf0e10cSrcweir aRefPt, aCompPt,
4392cdf0e10cSrcweir sal_True, -1 );
4393cdf0e10cSrcweir aRect.Right( aCompPt.X() );
4394cdf0e10cSrcweir }
4395cdf0e10cSrcweir else
4396cdf0e10cSrcweir {
4397cdf0e10cSrcweir // top of border rectangle has to be checked and adjusted
4398cdf0e10cSrcweir Point aCompPt( 0, aRect.Top() );
4399cdf0e10cSrcweir Point aRefPt( aCompPt.X(), aCompPt.Y() - 1 );
4400cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4401cdf0e10cSrcweir aRefPt, aCompPt,
4402cdf0e10cSrcweir sal_False, +1 );
4403cdf0e10cSrcweir aRect.Top( aCompPt.Y() );
4404cdf0e10cSrcweir }
4405cdf0e10cSrcweir }
4406cdf0e10cSrcweir }
440786e1cf34SPedro Giffuni // subtract width of outer bottom line.
4408cdf0e10cSrcweir if ( rBox.GetBottom() && (!bCnt || _rAttrs.GetBottomLine( _rFrm )) )
4409cdf0e10cSrcweir {
4410cdf0e10cSrcweir long nDist = ::lcl_AlignHeight( rBox.GetBottom()->GetOutWidth());
4411cdf0e10cSrcweir (aRect.*_rRectFn->fnAddBottom)( -nDist );
4412cdf0e10cSrcweir // OD 19.05.2003 #109667# - If outer bottom line is hair line, calculated
4413cdf0e10cSrcweir // top has to be adjusted.
4414cdf0e10cSrcweir if ( nDist == 1 )
4415cdf0e10cSrcweir {
4416cdf0e10cSrcweir if ( _rFrm.IsVertical() )
4417cdf0e10cSrcweir {
4418cdf0e10cSrcweir // left of border rectangle has to be checked and adjusted
4419cdf0e10cSrcweir Point aCompPt( aRect.Left(), 0 );
4420cdf0e10cSrcweir Point aRefPt( aCompPt.X() - 1, aCompPt.Y() );
4421cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4422cdf0e10cSrcweir aRefPt, aCompPt,
4423cdf0e10cSrcweir sal_True, +1 );
4424cdf0e10cSrcweir aRect.Left( aCompPt.X() );
4425cdf0e10cSrcweir }
4426cdf0e10cSrcweir else
4427cdf0e10cSrcweir {
4428cdf0e10cSrcweir // bottom of border rectangle has to be checked and adjusted
4429cdf0e10cSrcweir Point aCompPt( 0, aRect.Bottom() );
4430cdf0e10cSrcweir Point aRefPt( aCompPt.X(), aCompPt.Y() + 1 );
4431cdf0e10cSrcweir lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4432cdf0e10cSrcweir aRefPt, aCompPt,
4433cdf0e10cSrcweir sal_False, -1 );
4434cdf0e10cSrcweir aRect.Bottom( aCompPt.Y() );
4435cdf0e10cSrcweir }
4436cdf0e10cSrcweir }
4437cdf0e10cSrcweir }
4438cdf0e10cSrcweir }
4439cdf0e10cSrcweir
4440cdf0e10cSrcweir if ( !pLeftRightBorder->GetInWidth() )
4441cdf0e10cSrcweir {
4442cdf0e10cSrcweir // OD 06.05.2003 #107169# - add 6th parameter
4443cdf0e10cSrcweir ::lcl_SubTopBottom( aRect, rBox, _rAttrs, _rFrm, _rRectFn, bPrtOutputDev );
4444cdf0e10cSrcweir }
4445cdf0e10cSrcweir
4446cdf0e10cSrcweir // OD 29.04.2003 #107169# - paint SwAligned-rectangle
4447cdf0e10cSrcweir {
4448cdf0e10cSrcweir SwRect aPaintRect( aRect );
4449cdf0e10cSrcweir ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() );
4450cdf0e10cSrcweir // if <SwAlignRect> reveals rectangle with no width, adjust rectangle
4451*ebe15e47SJohn Bampton // to the prior left position with width of one twip.
4452cdf0e10cSrcweir if ( (aPaintRect.*_rRectFn->fnGetWidth)() == 0 )
4453cdf0e10cSrcweir {
4454cdf0e10cSrcweir if ( _bLeft )
4455cdf0e10cSrcweir {
4456cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetLeft)() );
4457cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetLeft)() );
4458cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddRight)( 1 );
4459cdf0e10cSrcweir }
4460cdf0e10cSrcweir else
4461cdf0e10cSrcweir {
4462cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetRight)() - 1 );
4463cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetRight)() - 1 );
4464cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddRight)( 1 );
4465cdf0e10cSrcweir }
4466cdf0e10cSrcweir }
4467cdf0e10cSrcweir _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pLeftRightBorder->GetColor() );
4468cdf0e10cSrcweir }
4469cdf0e10cSrcweir
4470cdf0e10cSrcweir if ( pLeftRightBorder->GetInWidth() )
4471cdf0e10cSrcweir {
4472cdf0e10cSrcweir const long nDist = ::lcl_MinWidthDist( pLeftRightBorder->GetDistance() );
4473cdf0e10cSrcweir long nWidth = ::lcl_AlignWidth( pLeftRightBorder->GetInWidth() );
4474cdf0e10cSrcweir if ( _bLeft )
4475cdf0e10cSrcweir {
4476cdf0e10cSrcweir (aRect.*_rRectFn->fnAddRight)( nDist + nWidth );
4477cdf0e10cSrcweir (aRect.*_rRectFn->fnSubLeft)( nWidth - (aRect.*_rRectFn->fnGetWidth)() );
4478cdf0e10cSrcweir }
4479cdf0e10cSrcweir else
4480cdf0e10cSrcweir {
4481cdf0e10cSrcweir (aRect.*_rRectFn->fnSubLeft)( nDist + nWidth );
4482cdf0e10cSrcweir (aRect.*_rRectFn->fnAddRight)( nWidth - (aRect.*_rRectFn->fnGetWidth)() );
4483cdf0e10cSrcweir }
4484cdf0e10cSrcweir // OD 06.05.2003 #107169# - add 6th parameter
4485cdf0e10cSrcweir ::lcl_SubTopBottom( aRect, rBox, _rAttrs, _rFrm, _rRectFn, bPrtOutputDev );
4486cdf0e10cSrcweir // OD 29.04.2003 #107169# - paint SwAligned-rectangle
4487cdf0e10cSrcweir {
4488cdf0e10cSrcweir SwRect aPaintRect( aRect );
4489cdf0e10cSrcweir ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() );
4490cdf0e10cSrcweir // if <SwAlignRect> reveals rectangle with no width, adjust
4491*ebe15e47SJohn Bampton // rectangle to the prior left position with width of one twip.
4492cdf0e10cSrcweir if ( (aPaintRect.*_rRectFn->fnGetWidth)() == 0 )
4493cdf0e10cSrcweir {
4494cdf0e10cSrcweir if ( _bLeft )
4495cdf0e10cSrcweir {
4496cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetLeft)() );
4497cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetLeft)() );
4498cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddRight)( 1 );
4499cdf0e10cSrcweir }
4500cdf0e10cSrcweir else
4501cdf0e10cSrcweir {
4502cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetRight)() - 1 );
4503cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetRight)() - 1 );
4504cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddRight)( 1 );
4505cdf0e10cSrcweir }
4506cdf0e10cSrcweir }
4507cdf0e10cSrcweir _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pLeftRightBorder->GetColor() );
4508cdf0e10cSrcweir }
4509cdf0e10cSrcweir }
4510cdf0e10cSrcweir }
4511cdf0e10cSrcweir
4512cdf0e10cSrcweir // OD 19.05.2003 #109667# - merge <lcl_PaintTopLine> and <lcl_PaintBottomLine>
4513cdf0e10cSrcweir // into <lcl_PaintTopLine>
lcl_PaintTopBottomLine(const sal_Bool _bTop,const SwFrm & _rFrm,const SwPageFrm & _rPage,const SwRect & _rOutRect,const SwRect & _rRect,const SwBorderAttrs & _rAttrs,const SwRectFn & _rRectFn)4514cdf0e10cSrcweir void lcl_PaintTopBottomLine( const sal_Bool _bTop,
4515cdf0e10cSrcweir const SwFrm& _rFrm,
4516cdf0e10cSrcweir const SwPageFrm& _rPage,
4517cdf0e10cSrcweir const SwRect& _rOutRect,
4518cdf0e10cSrcweir const SwRect& _rRect,
4519cdf0e10cSrcweir const SwBorderAttrs& _rAttrs,
4520cdf0e10cSrcweir const SwRectFn& _rRectFn )
4521cdf0e10cSrcweir {
4522cdf0e10cSrcweir const SvxBoxItem& rBox = _rAttrs.GetBox();
4523cdf0e10cSrcweir const SvxBorderLine* pTopBottomBorder = 0;
4524cdf0e10cSrcweir if ( _bTop )
4525cdf0e10cSrcweir {
4526cdf0e10cSrcweir pTopBottomBorder = rBox.GetTop();
4527cdf0e10cSrcweir }
4528cdf0e10cSrcweir else
4529cdf0e10cSrcweir {
4530cdf0e10cSrcweir pTopBottomBorder = rBox.GetBottom();
4531cdf0e10cSrcweir }
4532cdf0e10cSrcweir
4533cdf0e10cSrcweir if ( !pTopBottomBorder )
4534cdf0e10cSrcweir {
4535cdf0e10cSrcweir return;
4536cdf0e10cSrcweir }
4537cdf0e10cSrcweir
4538cdf0e10cSrcweir SwRect aRect( _rOutRect );
4539cdf0e10cSrcweir if ( _bTop )
4540cdf0e10cSrcweir {
4541cdf0e10cSrcweir (aRect.*_rRectFn->fnAddBottom)( ::lcl_AlignHeight( pTopBottomBorder->GetOutWidth() ) -
4542cdf0e10cSrcweir (aRect.*_rRectFn->fnGetHeight)() );
4543cdf0e10cSrcweir }
4544cdf0e10cSrcweir else
4545cdf0e10cSrcweir {
4546cdf0e10cSrcweir (aRect.*_rRectFn->fnSubTop)( ::lcl_AlignHeight( pTopBottomBorder->GetOutWidth() ) -
4547cdf0e10cSrcweir (aRect.*_rRectFn->fnGetHeight)() );
4548cdf0e10cSrcweir }
4549cdf0e10cSrcweir
4550cdf0e10cSrcweir // OD 29.04.2003 #107169# - paint SwAligned-rectangle
4551cdf0e10cSrcweir {
4552cdf0e10cSrcweir SwRect aPaintRect( aRect );
4553cdf0e10cSrcweir ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() );
4554cdf0e10cSrcweir // if <SwAlignRect> reveals rectangle with no width, adjust rectangle
4555*ebe15e47SJohn Bampton // to the prior top position with width of one twip.
4556cdf0e10cSrcweir if ( (aPaintRect.*_rRectFn->fnGetHeight)() == 0 )
4557cdf0e10cSrcweir {
4558cdf0e10cSrcweir if ( _bTop )
4559cdf0e10cSrcweir {
4560cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetTop)() );
4561cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetTop)() );
4562cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddBottom)( 1 );
4563cdf0e10cSrcweir }
4564cdf0e10cSrcweir else
4565cdf0e10cSrcweir {
4566cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetBottom)() - 1 );
4567cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetBottom)() - 1 );
4568cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddBottom)( 1 );
4569cdf0e10cSrcweir }
4570cdf0e10cSrcweir }
4571cdf0e10cSrcweir _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pTopBottomBorder->GetColor() );
4572cdf0e10cSrcweir }
4573cdf0e10cSrcweir
4574cdf0e10cSrcweir if ( pTopBottomBorder->GetInWidth() )
4575cdf0e10cSrcweir {
4576cdf0e10cSrcweir const long nDist = ::lcl_MinHeightDist( pTopBottomBorder->GetDistance() );
4577cdf0e10cSrcweir const long nHeight = ::lcl_AlignHeight( pTopBottomBorder->GetInWidth() );
4578cdf0e10cSrcweir if ( _bTop )
4579cdf0e10cSrcweir {
4580cdf0e10cSrcweir (aRect.*_rRectFn->fnAddBottom)( nDist + nHeight );
4581cdf0e10cSrcweir (aRect.*_rRectFn->fnSubTop)( nHeight - (aRect.*_rRectFn->fnGetHeight)() );
4582cdf0e10cSrcweir }
4583cdf0e10cSrcweir else
4584cdf0e10cSrcweir {
4585cdf0e10cSrcweir (aRect.*_rRectFn->fnSubTop)( nDist + nHeight );
4586cdf0e10cSrcweir (aRect.*_rRectFn->fnAddBottom)( nHeight -(aRect.*_rRectFn->fnGetHeight)() );
4587cdf0e10cSrcweir }
4588cdf0e10cSrcweir ::lcl_SubLeftRight( aRect, rBox, _rRectFn );
4589cdf0e10cSrcweir // OD 29.04.2003 #107169# - paint SwAligned-rectangle
4590cdf0e10cSrcweir {
4591cdf0e10cSrcweir SwRect aPaintRect( aRect );
4592cdf0e10cSrcweir ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() );
4593cdf0e10cSrcweir // if <SwAlignRect> reveals rectangle with no width, adjust
4594*ebe15e47SJohn Bampton // rectangle to the prior top position with width of one twip.
4595cdf0e10cSrcweir if ( (aPaintRect.*_rRectFn->fnGetHeight)() == 0 )
4596cdf0e10cSrcweir {
4597cdf0e10cSrcweir if ( _bTop )
4598cdf0e10cSrcweir {
4599cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetTop)() );
4600cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetTop)() );
4601cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddBottom)( 1 );
4602cdf0e10cSrcweir }
4603cdf0e10cSrcweir else
4604cdf0e10cSrcweir {
4605cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetBottom)() - 1 );
4606cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetBottom)() - 1 );
4607cdf0e10cSrcweir (aPaintRect.*_rRectFn->fnAddBottom)( 1 );
4608cdf0e10cSrcweir }
4609cdf0e10cSrcweir }
4610cdf0e10cSrcweir _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pTopBottomBorder->GetColor() );
4611cdf0e10cSrcweir }
4612cdf0e10cSrcweir }
4613cdf0e10cSrcweir }
4614cdf0e10cSrcweir
4615cdf0e10cSrcweir
4616cdf0e10cSrcweir /*************************************************************************
4617cdf0e10cSrcweir |*
4618cdf0e10cSrcweir |* const SwFrm* lcl_HasNextCell( const SwFrm& rFrm )
4619cdf0e10cSrcweir |*
4620cdf0e10cSrcweir |* No comment. #i15844#
4621cdf0e10cSrcweir |*
4622cdf0e10cSrcweir |*************************************************************************/
4623cdf0e10cSrcweir
lcl_HasNextCell(const SwFrm & rFrm)4624cdf0e10cSrcweir const SwFrm* lcl_HasNextCell( const SwFrm& rFrm )
4625cdf0e10cSrcweir {
4626cdf0e10cSrcweir ASSERT( rFrm.IsCellFrm(),
4627cdf0e10cSrcweir "lcl_HasNextCell( const SwFrm& rFrm ) should be called with SwCellFrm" )
4628cdf0e10cSrcweir
4629cdf0e10cSrcweir const SwFrm* pTmpFrm = &rFrm;
4630cdf0e10cSrcweir do
4631cdf0e10cSrcweir {
4632cdf0e10cSrcweir if ( pTmpFrm->GetNext() )
4633cdf0e10cSrcweir return pTmpFrm->GetNext();
4634cdf0e10cSrcweir
4635cdf0e10cSrcweir pTmpFrm = pTmpFrm->GetUpper()->GetUpper();
4636cdf0e10cSrcweir }
4637cdf0e10cSrcweir while ( pTmpFrm->IsCellFrm() );
4638cdf0e10cSrcweir
4639cdf0e10cSrcweir return 0;
4640cdf0e10cSrcweir }
4641cdf0e10cSrcweir
4642cdf0e10cSrcweir
4643cdf0e10cSrcweir /*************************************************************************
4644cdf0e10cSrcweir |*
4645cdf0e10cSrcweir |* SwFrm::PaintBorder()
4646cdf0e10cSrcweir |*
4647cdf0e10cSrcweir |* Beschreibung Malt Schatten und Umrandung
4648cdf0e10cSrcweir |* Ersterstellung MA 23.01.92
4649cdf0e10cSrcweir |* Letzte Aenderung MA 29. Jul. 96
4650cdf0e10cSrcweir |*
4651cdf0e10cSrcweir |*************************************************************************/
4652cdf0e10cSrcweir
4653cdf0e10cSrcweir /** local method to determine cell frame, from which the border attributes
4654cdf0e10cSrcweir for paint of top/bottom border has to be used.
4655cdf0e10cSrcweir
4656cdf0e10cSrcweir OD 21.02.2003 #b4779636#, #107692#
4657cdf0e10cSrcweir
4658cdf0e10cSrcweir @author OD
4659cdf0e10cSrcweir
4660cdf0e10cSrcweir
4661cdf0e10cSrcweir @param _pCellFrm
4662cdf0e10cSrcweir input parameter - constant pointer to cell frame for which the cell frame
4663cdf0e10cSrcweir for the border attributes has to be determined.
4664cdf0e10cSrcweir
4665cdf0e10cSrcweir @param _rCellBorderAttrs
4666cdf0e10cSrcweir input parameter - constant reference to the border attributes of cell frame
4667cdf0e10cSrcweir <_pCellFrm>.
4668cdf0e10cSrcweir
4669cdf0e10cSrcweir @param _bTop
4670cdf0e10cSrcweir input parameter - boolean, that controls, if cell frame for top border or
4671cdf0e10cSrcweir for bottom border has to be determined.
4672cdf0e10cSrcweir
4673cdf0e10cSrcweir @return constant pointer to cell frame, for which the border attributes has
4674cdf0e10cSrcweir to be used
4675cdf0e10cSrcweir */
lcl_GetCellFrmForBorderAttrs(const SwFrm * _pCellFrm,const SwBorderAttrs & _rCellBorderAttrs,const bool _bTop)4676cdf0e10cSrcweir const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm,
4677cdf0e10cSrcweir const SwBorderAttrs& _rCellBorderAttrs,
4678cdf0e10cSrcweir const bool _bTop )
4679cdf0e10cSrcweir {
4680cdf0e10cSrcweir ASSERT( _pCellFrm, "No cell frame available, dying soon" )
4681cdf0e10cSrcweir
4682cdf0e10cSrcweir // determine, if cell frame is at bottom/top border of a table frame and
4683cdf0e10cSrcweir // the table frame has/is a follow.
4684cdf0e10cSrcweir const SwFrm* pTmpFrm = _pCellFrm;
4685cdf0e10cSrcweir bool bCellAtBorder = true;
4686cdf0e10cSrcweir bool bCellAtLeftBorder = !_pCellFrm->GetPrev();
4687cdf0e10cSrcweir bool bCellAtRightBorder = !_pCellFrm->GetNext();
4688cdf0e10cSrcweir while( !pTmpFrm->IsRowFrm() || !pTmpFrm->GetUpper()->IsTabFrm() )
4689cdf0e10cSrcweir {
4690cdf0e10cSrcweir pTmpFrm = pTmpFrm->GetUpper();
4691cdf0e10cSrcweir if ( pTmpFrm->IsRowFrm() &&
4692cdf0e10cSrcweir (_bTop ? pTmpFrm->GetPrev() : pTmpFrm->GetNext())
4693cdf0e10cSrcweir )
4694cdf0e10cSrcweir {
4695cdf0e10cSrcweir bCellAtBorder = false;
4696cdf0e10cSrcweir }
4697cdf0e10cSrcweir if ( pTmpFrm->IsCellFrm() )
4698cdf0e10cSrcweir {
4699cdf0e10cSrcweir if ( pTmpFrm->GetPrev() )
4700cdf0e10cSrcweir {
4701cdf0e10cSrcweir bCellAtLeftBorder = false;
4702cdf0e10cSrcweir }
4703cdf0e10cSrcweir if ( pTmpFrm->GetNext() )
4704cdf0e10cSrcweir {
4705cdf0e10cSrcweir bCellAtRightBorder = false;
4706cdf0e10cSrcweir }
4707cdf0e10cSrcweir }
4708cdf0e10cSrcweir }
4709cdf0e10cSrcweir ASSERT( pTmpFrm && pTmpFrm->IsRowFrm(), "No RowFrm available" );
4710cdf0e10cSrcweir
4711cdf0e10cSrcweir const SwLayoutFrm* pParentRowFrm = static_cast<const SwLayoutFrm*>(pTmpFrm);
4712cdf0e10cSrcweir const SwTabFrm* pParentTabFrm =
4713cdf0e10cSrcweir static_cast<const SwTabFrm*>(pParentRowFrm->GetUpper());
4714cdf0e10cSrcweir
4715cdf0e10cSrcweir const bool bCellNeedsAttribute = bCellAtBorder &&
4716cdf0e10cSrcweir ( _bTop ?
4717cdf0e10cSrcweir // bCellInFirstRowWithMaster
4718cdf0e10cSrcweir ( !pParentRowFrm->GetPrev() &&
4719cdf0e10cSrcweir pParentTabFrm->IsFollow() &&
4720cdf0e10cSrcweir 0 == pParentTabFrm->GetTable()->GetRowsToRepeat() ) :
4721cdf0e10cSrcweir // bCellInLastRowWithFollow
4722cdf0e10cSrcweir ( !pParentRowFrm->GetNext() &&
4723cdf0e10cSrcweir pParentTabFrm->GetFollow() )
4724cdf0e10cSrcweir );
4725cdf0e10cSrcweir
4726cdf0e10cSrcweir const SwFrm* pRet = _pCellFrm;
4727cdf0e10cSrcweir if ( bCellNeedsAttribute )
4728cdf0e10cSrcweir {
4729cdf0e10cSrcweir // determine, if cell frame has no borders inside the table.
4730cdf0e10cSrcweir const SwFrm* pNextCell = 0;
4731cdf0e10cSrcweir bool bNoBordersInside = false;
4732cdf0e10cSrcweir
4733cdf0e10cSrcweir if ( bCellAtLeftBorder && ( 0 != ( pNextCell = lcl_HasNextCell( *_pCellFrm ) ) ) )
4734cdf0e10cSrcweir {
4735cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNextCell );
4736cdf0e10cSrcweir const SwBorderAttrs &rBorderAttrs = *aAccess.Get();
4737cdf0e10cSrcweir const SvxBoxItem& rBorderBox = rBorderAttrs.GetBox();
4738cdf0e10cSrcweir bCellAtRightBorder = !lcl_HasNextCell( *pNextCell );
4739cdf0e10cSrcweir bNoBordersInside =
4740cdf0e10cSrcweir ( !rBorderBox.GetTop() || !pParentRowFrm->GetPrev() ) &&
4741cdf0e10cSrcweir !rBorderBox.GetLeft() &&
4742cdf0e10cSrcweir ( !rBorderBox.GetRight() || bCellAtRightBorder ) &&
4743cdf0e10cSrcweir ( !rBorderBox.GetBottom() || !pParentRowFrm->GetNext() );
4744cdf0e10cSrcweir }
4745cdf0e10cSrcweir else
4746cdf0e10cSrcweir {
4747cdf0e10cSrcweir const SvxBoxItem& rBorderBox = _rCellBorderAttrs.GetBox();
4748cdf0e10cSrcweir bNoBordersInside =
4749cdf0e10cSrcweir ( !rBorderBox.GetTop() || !pParentRowFrm->GetPrev() ) &&
4750cdf0e10cSrcweir ( !rBorderBox.GetLeft() || bCellAtLeftBorder ) &&
4751cdf0e10cSrcweir ( !rBorderBox.GetRight() || bCellAtRightBorder ) &&
4752cdf0e10cSrcweir ( !rBorderBox.GetBottom() || !pParentRowFrm->GetNext() );
4753cdf0e10cSrcweir }
4754cdf0e10cSrcweir
4755cdf0e10cSrcweir if ( bNoBordersInside )
4756cdf0e10cSrcweir {
4757cdf0e10cSrcweir if ( _bTop && !_rCellBorderAttrs.GetBox().GetTop() )
4758cdf0e10cSrcweir {
4759cdf0e10cSrcweir // #b4779636#-hack:
4760cdf0e10cSrcweir // Cell frame has no top border and no border inside the table, but
4761cdf0e10cSrcweir // it is at the top border of a table frame, which is a follow.
4762cdf0e10cSrcweir // Thus, use border attributes of cell frame in first row of complete table.
4763cdf0e10cSrcweir // First, determine first table frame of complete table.
4764cdf0e10cSrcweir SwTabFrm* pMasterTabFrm = pParentTabFrm->FindMaster( true );
4765cdf0e10cSrcweir // determine first row of complete table.
4766cdf0e10cSrcweir const SwFrm* pFirstRow = pMasterTabFrm->GetLower();
4767cdf0e10cSrcweir // return first cell in first row
4768cdf0e10cSrcweir SwFrm* pLowerCell = const_cast<SwFrm*>(pFirstRow->GetLower());
4769cdf0e10cSrcweir while ( !pLowerCell->IsCellFrm() ||
4770cdf0e10cSrcweir ( pLowerCell->GetLower() && pLowerCell->GetLower()->IsRowFrm() )
4771cdf0e10cSrcweir )
4772cdf0e10cSrcweir {
4773cdf0e10cSrcweir pLowerCell = pLowerCell->GetLower();
4774cdf0e10cSrcweir }
4775cdf0e10cSrcweir ASSERT( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" );
4776cdf0e10cSrcweir pRet = pLowerCell;
4777cdf0e10cSrcweir }
4778cdf0e10cSrcweir else if ( !_bTop && !_rCellBorderAttrs.GetBox().GetBottom() )
4779cdf0e10cSrcweir {
4780cdf0e10cSrcweir // #b4779636#-hack:
4781cdf0e10cSrcweir // Cell frame has no bottom border and no border inside the table,
4782cdf0e10cSrcweir // but it is at the bottom border of a table frame, which has a follow.
4783cdf0e10cSrcweir // Thus, use border attributes of cell frame in last row of complete table.
4784cdf0e10cSrcweir // First, determine last table frame of complete table.
4785cdf0e10cSrcweir SwTabFrm* pLastTabFrm = const_cast<SwTabFrm*>(pParentTabFrm->GetFollow());
4786cdf0e10cSrcweir while ( pLastTabFrm->GetFollow() )
4787cdf0e10cSrcweir {
4788cdf0e10cSrcweir pLastTabFrm = pLastTabFrm->GetFollow();
4789cdf0e10cSrcweir }
4790cdf0e10cSrcweir // determine last row of complete table.
4791cdf0e10cSrcweir SwFrm* pLastRow = pLastTabFrm->GetLastLower();
4792cdf0e10cSrcweir // return first bottom border cell in last row
4793cdf0e10cSrcweir SwFrm* pLowerCell = const_cast<SwFrm*>(pLastRow->GetLower());
4794cdf0e10cSrcweir while ( !pLowerCell->IsCellFrm() ||
4795cdf0e10cSrcweir ( pLowerCell->GetLower() && pLowerCell->GetLower()->IsRowFrm() )
4796cdf0e10cSrcweir )
4797cdf0e10cSrcweir {
4798cdf0e10cSrcweir if ( pLowerCell->IsRowFrm() )
4799cdf0e10cSrcweir {
4800cdf0e10cSrcweir while ( pLowerCell->GetNext() )
4801cdf0e10cSrcweir {
4802cdf0e10cSrcweir pLowerCell = pLowerCell->GetNext();
4803cdf0e10cSrcweir }
4804cdf0e10cSrcweir }
4805cdf0e10cSrcweir pLowerCell = pLowerCell->GetLower();
4806cdf0e10cSrcweir }
4807cdf0e10cSrcweir ASSERT( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" );
4808cdf0e10cSrcweir pRet = pLowerCell;
4809cdf0e10cSrcweir }
4810cdf0e10cSrcweir }
4811cdf0e10cSrcweir }
4812cdf0e10cSrcweir
4813cdf0e10cSrcweir return pRet;
4814cdf0e10cSrcweir }
4815cdf0e10cSrcweir
PaintBorder(const SwRect & rRect,const SwPageFrm * pPage,const SwBorderAttrs & rAttrs) const4816cdf0e10cSrcweir void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage,
4817cdf0e10cSrcweir const SwBorderAttrs &rAttrs ) const
4818cdf0e10cSrcweir {
4819cdf0e10cSrcweir //fuer (Row,Body,Ftn,Root,Column,NoTxt) gibt's hier nix zu tun
4820cdf0e10cSrcweir if ( (GetType() & 0x90C5) || (Prt().SSize() == Frm().SSize()) )
4821cdf0e10cSrcweir return;
4822cdf0e10cSrcweir
4823cdf0e10cSrcweir if ( (GetType() & 0x2000) && //Cell
4824cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsTable() )
4825cdf0e10cSrcweir return;
4826cdf0e10cSrcweir
4827cdf0e10cSrcweir // --> collapsing borders FME 2005-05-27 #i29550#
4828cdf0e10cSrcweir if ( IsTabFrm() || IsCellFrm() || IsRowFrm() )
4829cdf0e10cSrcweir {
4830cdf0e10cSrcweir const SwTabFrm* pTabFrm = FindTabFrm();
4831cdf0e10cSrcweir if ( pTabFrm->IsCollapsingBorders() )
4832cdf0e10cSrcweir return;
4833cdf0e10cSrcweir
4834cdf0e10cSrcweir if ( pTabFrm->GetTable()->IsNewModel() && ( !IsCellFrm() || IsCoveredCell() ) )
4835cdf0e10cSrcweir return;
4836cdf0e10cSrcweir }
4837cdf0e10cSrcweir // <--
4838cdf0e10cSrcweir
4839cdf0e10cSrcweir const bool bLine = rAttrs.IsLine() ? true : false;
4840cdf0e10cSrcweir const bool bShadow = rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE;
4841cdf0e10cSrcweir
4842cdf0e10cSrcweir // OD 24.02.2003 #b4779636#, #107692# - flag to control,
4843cdf0e10cSrcweir // if #b4779636#-hack has to be used.
4844cdf0e10cSrcweir const bool bb4779636HackActive = true;
4845cdf0e10cSrcweir // OD 21.02.2003 #b4779636#, #107692#
4846cdf0e10cSrcweir const SwFrm* pCellFrmForBottomBorderAttrs = 0;
4847cdf0e10cSrcweir const SwFrm* pCellFrmForTopBorderAttrs = 0;
4848cdf0e10cSrcweir bool bFoundCellForTopOrBorderAttrs = false;
4849cdf0e10cSrcweir if ( bb4779636HackActive && IsCellFrm() )
4850cdf0e10cSrcweir {
4851cdf0e10cSrcweir pCellFrmForBottomBorderAttrs = lcl_GetCellFrmForBorderAttrs( this, rAttrs, false );
4852cdf0e10cSrcweir if ( pCellFrmForBottomBorderAttrs != this )
4853cdf0e10cSrcweir bFoundCellForTopOrBorderAttrs = true;
4854cdf0e10cSrcweir pCellFrmForTopBorderAttrs = lcl_GetCellFrmForBorderAttrs( this, rAttrs, true );
4855cdf0e10cSrcweir if ( pCellFrmForTopBorderAttrs != this )
4856cdf0e10cSrcweir bFoundCellForTopOrBorderAttrs = true;
4857cdf0e10cSrcweir }
4858cdf0e10cSrcweir
4859cdf0e10cSrcweir // OD 24.02.2003 #b4779636#, #107692# - add condition <bFoundCellForTopOrBorderAttrs>
4860cdf0e10cSrcweir // for #b4779636#-hack
4861cdf0e10cSrcweir if ( bLine || bShadow || bFoundCellForTopOrBorderAttrs )
4862cdf0e10cSrcweir {
4863cdf0e10cSrcweir //Wenn das Rechteck vollstandig innerhalb der PrtArea liegt,
486460d78278Smseidel //so braucht kein Rand gepaintet werden.
4865cdf0e10cSrcweir //Fuer die PrtArea muss der Aligned'e Wert zugrunde gelegt werden,
4866cdf0e10cSrcweir //anderfalls wuerden u.U. Teile nicht verarbeitet.
4867cdf0e10cSrcweir SwRect aRect( Prt() );
4868cdf0e10cSrcweir aRect += Frm().Pos();
4869cdf0e10cSrcweir ::SwAlignRect( aRect, pGlobalShell );
4870cdf0e10cSrcweir // OD 27.09.2002 #103636# - new local boolean variable in order to
4871cdf0e10cSrcweir // suspend border paint under special cases - see below.
4872cdf0e10cSrcweir // NOTE: This is a fix for the implementation of feature #99657#.
4873cdf0e10cSrcweir bool bDrawOnlyShadowForTransparentFrame = false;
4874cdf0e10cSrcweir if ( aRect.IsInside( rRect ) )
4875cdf0e10cSrcweir {
4876cdf0e10cSrcweir // OD 27.09.2002 #103636# - paint shadow, if background is transparent.
4877cdf0e10cSrcweir // Because of introduced transparent background for fly frame #99657#,
4878ad095790Smseidel // the shadow has to be drawn if the background is transparent,
4879cdf0e10cSrcweir // in spite the fact that the paint rectangle <rRect> lies fully
4880cdf0e10cSrcweir // in the printing area.
4881cdf0e10cSrcweir // NOTE to chosen solution:
4882cdf0e10cSrcweir // On transparent background, continue processing, but suspend
4883cdf0e10cSrcweir // drawing of border by setting <bDrawOnlyShadowForTransparentFrame>
4884cdf0e10cSrcweir // to true.
4885cdf0e10cSrcweir if ( IsLayoutFrm() &&
4886cdf0e10cSrcweir static_cast<const SwLayoutFrm*>(this)->GetFmt()->IsBackgroundTransparent() )
4887cdf0e10cSrcweir {
4888cdf0e10cSrcweir bDrawOnlyShadowForTransparentFrame = true;
4889cdf0e10cSrcweir }
4890cdf0e10cSrcweir else
4891cdf0e10cSrcweir {
4892cdf0e10cSrcweir return;
4893cdf0e10cSrcweir }
4894cdf0e10cSrcweir }
4895cdf0e10cSrcweir
4896cdf0e10cSrcweir if ( !pPage )
4897cdf0e10cSrcweir pPage = FindPageFrm();
4898cdf0e10cSrcweir
4899cdf0e10cSrcweir ::lcl_CalcBorderRect( aRect, this, rAttrs, sal_True );
4900cdf0e10cSrcweir rAttrs.SetGetCacheLine( sal_True );
4901cdf0e10cSrcweir if ( bShadow )
4902cdf0e10cSrcweir PaintShadow( rRect, aRect, rAttrs );
4903cdf0e10cSrcweir // OD 27.09.2002 #103636# - suspend drawing of border
4904cdf0e10cSrcweir // add condition < NOT bDrawOnlyShadowForTransparentFrame > - see above
4905cdf0e10cSrcweir // OD 24.02.2003 #b4779636#, #107692# - add condition <bFoundCellForTopOrBorderAttrs>
4906cdf0e10cSrcweir // for #b4779636#-hack.
4907cdf0e10cSrcweir if ( ( bLine || bFoundCellForTopOrBorderAttrs ) &&
4908cdf0e10cSrcweir !bDrawOnlyShadowForTransparentFrame )
4909cdf0e10cSrcweir {
4910cdf0e10cSrcweir const SwFrm* pDirRefFrm = IsCellFrm() ? FindTabFrm() : this;
4911cdf0e10cSrcweir SWRECTFN( pDirRefFrm )
4912cdf0e10cSrcweir // OD 19.05.2003 #109667# - use new method <lcl_PaintLeftRightLine(..)>
4913cdf0e10cSrcweir //::lcl_PaintLeftLine ( this, pPage, aRect, rRect, rAttrs, fnRect );
4914cdf0e10cSrcweir //::lcl_PaintRightLine ( this, pPage, aRect, rRect, rAttrs, fnRect );
4915cdf0e10cSrcweir ::lcl_PaintLeftRightLine ( sal_True, *(this), *(pPage), aRect, rRect, rAttrs, fnRect );
4916cdf0e10cSrcweir ::lcl_PaintLeftRightLine ( sal_False, *(this), *(pPage), aRect, rRect, rAttrs, fnRect );
4917cdf0e10cSrcweir if ( !IsCntntFrm() || rAttrs.GetTopLine( *(this) ) )
4918cdf0e10cSrcweir {
4919cdf0e10cSrcweir // OD 21.02.2003 #b4779636#, #107692# -
4920cdf0e10cSrcweir // #b4779636#-hack: If another cell frame for top border
4921cdf0e10cSrcweir // paint is found, paint its top border.
4922cdf0e10cSrcweir if ( IsCellFrm() && pCellFrmForTopBorderAttrs != this )
4923cdf0e10cSrcweir {
4924cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(),
4925cdf0e10cSrcweir pCellFrmForTopBorderAttrs );
4926cdf0e10cSrcweir const SwBorderAttrs &rTopAttrs = *aAccess.Get();
4927cdf0e10cSrcweir // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)>
4928cdf0e10cSrcweir //::lcl_PaintTopLine( this, pPage, aRect, rRect, rTopAttrs, fnRect );
4929cdf0e10cSrcweir ::lcl_PaintTopBottomLine( sal_True, *(this), *(pPage), aRect, rRect, rTopAttrs, fnRect );
4930cdf0e10cSrcweir }
4931cdf0e10cSrcweir else
4932cdf0e10cSrcweir {
4933cdf0e10cSrcweir // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)>
4934cdf0e10cSrcweir //::lcl_PaintTopLine( this, pPage, aRect, rRect, rAttrs, fnRect );
4935cdf0e10cSrcweir ::lcl_PaintTopBottomLine( sal_True, *(this), *(pPage), aRect, rRect, rAttrs, fnRect );
4936cdf0e10cSrcweir }
4937cdf0e10cSrcweir }
4938cdf0e10cSrcweir if ( !IsCntntFrm() || rAttrs.GetBottomLine( *(this) ) )
4939cdf0e10cSrcweir {
4940cdf0e10cSrcweir // OD 21.02.2003 #b4779636#, #107692# -
4941cdf0e10cSrcweir // #b4779636#-hack: If another cell frame for bottom border
4942cdf0e10cSrcweir // paint is found, paint its bottom border.
4943cdf0e10cSrcweir if ( IsCellFrm() && pCellFrmForBottomBorderAttrs != this )
4944cdf0e10cSrcweir {
4945cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(),
4946cdf0e10cSrcweir pCellFrmForBottomBorderAttrs );
4947cdf0e10cSrcweir const SwBorderAttrs &rBottomAttrs = *aAccess.Get();
4948cdf0e10cSrcweir // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)>
4949cdf0e10cSrcweir //::lcl_PaintBottomLine(this, pPage, aRect, rRect, rBottomAttrs, fnRect);
4950cdf0e10cSrcweir ::lcl_PaintTopBottomLine(sal_False, *(this), *(pPage), aRect, rRect, rBottomAttrs, fnRect);
4951cdf0e10cSrcweir }
4952cdf0e10cSrcweir else
4953cdf0e10cSrcweir {
4954cdf0e10cSrcweir // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)>
4955cdf0e10cSrcweir //::lcl_PaintBottomLine(this, pPage, aRect, rRect, rAttrs, fnRect);
4956cdf0e10cSrcweir ::lcl_PaintTopBottomLine(sal_False, *(this), *(pPage), aRect, rRect, rAttrs, fnRect);
4957cdf0e10cSrcweir }
4958cdf0e10cSrcweir }
4959cdf0e10cSrcweir }
4960cdf0e10cSrcweir rAttrs.SetGetCacheLine( sal_False );
4961cdf0e10cSrcweir }
4962cdf0e10cSrcweir }
4963cdf0e10cSrcweir /*************************************************************************
4964cdf0e10cSrcweir |*
4965cdf0e10cSrcweir |* SwFtnContFrm::PaintBorder()
4966cdf0e10cSrcweir |*
4967cdf0e10cSrcweir |* Beschreibung Spezialimplementierung wg. der Fussnotenlinie.
4968cdf0e10cSrcweir |* Derzeit braucht nur der obere Rand beruecksichtigt werden.
4969cdf0e10cSrcweir |* Auf andere Linien und Schatten wird verzichtet.
4970cdf0e10cSrcweir |* Ersterstellung MA 27. Feb. 93
4971cdf0e10cSrcweir |* Letzte Aenderung MA 08. Sep. 93
4972cdf0e10cSrcweir |*
4973cdf0e10cSrcweir |*************************************************************************/
4974cdf0e10cSrcweir
PaintBorder(const SwRect & rRect,const SwPageFrm * pPage,const SwBorderAttrs &) const4975cdf0e10cSrcweir void SwFtnContFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage,
4976cdf0e10cSrcweir const SwBorderAttrs & ) const
4977cdf0e10cSrcweir {
4978cdf0e10cSrcweir //Wenn das Rechteck vollstandig innerhalb der PrtArea liegt, so gibt es
4979cdf0e10cSrcweir //keinen Rand zu painten.
4980cdf0e10cSrcweir SwRect aRect( Prt() );
4981cdf0e10cSrcweir aRect.Pos() += Frm().Pos();
4982cdf0e10cSrcweir if ( !aRect.IsInside( rRect ) )
4983cdf0e10cSrcweir PaintLine( rRect, pPage );
4984cdf0e10cSrcweir }
4985cdf0e10cSrcweir /*************************************************************************
4986cdf0e10cSrcweir |*
4987cdf0e10cSrcweir |* SwFtnContFrm::PaintLine()
4988cdf0e10cSrcweir |*
4989cdf0e10cSrcweir |* Beschreibung Fussnotenline malen.
4990cdf0e10cSrcweir |* Ersterstellung MA 02. Mar. 93
4991cdf0e10cSrcweir |* Letzte Aenderung MA 28. Mar. 94
4992cdf0e10cSrcweir |*
4993cdf0e10cSrcweir |*************************************************************************/
4994cdf0e10cSrcweir
PaintLine(const SwRect & rRect,const SwPageFrm * pPage) const4995cdf0e10cSrcweir void SwFtnContFrm::PaintLine( const SwRect& rRect,
4996cdf0e10cSrcweir const SwPageFrm *pPage ) const
4997cdf0e10cSrcweir {
4998cdf0e10cSrcweir //Laenge der Linie ergibt sich aus der prozentualen Angabe am PageDesc.
4999cdf0e10cSrcweir //Die Position ist ebenfalls am PageDesc angegeben.
5000cdf0e10cSrcweir //Der Pen steht direkt im PageDesc.
5001cdf0e10cSrcweir
5002cdf0e10cSrcweir if ( !pPage )
5003cdf0e10cSrcweir pPage = FindPageFrm();
5004cdf0e10cSrcweir const SwPageFtnInfo &rInf = pPage->GetPageDesc()->GetFtnInfo();
5005cdf0e10cSrcweir
5006cdf0e10cSrcweir SWRECTFN( this )
5007cdf0e10cSrcweir SwTwips nPrtWidth = (Prt().*fnRect->fnGetWidth)();
5008cdf0e10cSrcweir Fraction aFract( nPrtWidth, 1 );
5009cdf0e10cSrcweir const SwTwips nWidth = (long)(aFract *= rInf.GetWidth());
5010cdf0e10cSrcweir
5011cdf0e10cSrcweir SwTwips nX = (this->*fnRect->fnGetPrtLeft)();
5012cdf0e10cSrcweir switch ( rInf.GetAdj() )
5013cdf0e10cSrcweir {
5014cdf0e10cSrcweir case FTNADJ_CENTER:
5015cdf0e10cSrcweir nX += nPrtWidth/2 - nWidth/2; break;
5016cdf0e10cSrcweir case FTNADJ_RIGHT:
5017cdf0e10cSrcweir nX += nPrtWidth - nWidth; break;
5018cdf0e10cSrcweir case FTNADJ_LEFT:
5019cdf0e10cSrcweir /* do nothing */; break;
5020cdf0e10cSrcweir default:
5021870262e3SDon Lewis ASSERT( sal_False, "New adjustment for footnote line?" );
5022cdf0e10cSrcweir }
5023cdf0e10cSrcweir SwTwips nLineWidth = rInf.GetLineWidth();
5024cdf0e10cSrcweir const SwRect aLineRect = bVert ?
5025cdf0e10cSrcweir SwRect( Point(Frm().Left()+Frm().Width()-rInf.GetTopDist()-nLineWidth,
5026cdf0e10cSrcweir nX), Size( nLineWidth, nWidth ) )
5027cdf0e10cSrcweir : SwRect( Point( nX, Frm().Pos().Y() + rInf.GetTopDist() ),
5028cdf0e10cSrcweir Size( nWidth, rInf.GetLineWidth()));
5029cdf0e10cSrcweir if ( aLineRect.HasArea() )
5030cdf0e10cSrcweir PaintBorderLine( rRect, aLineRect , pPage, &rInf.GetLineColor() );
5031cdf0e10cSrcweir }
5032cdf0e10cSrcweir
5033cdf0e10cSrcweir /*************************************************************************
5034cdf0e10cSrcweir |*
5035cdf0e10cSrcweir |* SwLayoutFrm::PaintColLines()
5036cdf0e10cSrcweir |*
5037cdf0e10cSrcweir |* Beschreibung Painted die Trennlinien fuer die innenliegenden
5038cdf0e10cSrcweir |* Spalten.
5039cdf0e10cSrcweir |* Ersterstellung MA 21. Jun. 93
5040cdf0e10cSrcweir |* Letzte Aenderung MA 28. Mar. 94
5041cdf0e10cSrcweir |*
5042cdf0e10cSrcweir |*************************************************************************/
5043cdf0e10cSrcweir
PaintColLines(const SwRect & rRect,const SwFmtCol & rFmtCol,const SwPageFrm * pPage) const5044cdf0e10cSrcweir void SwLayoutFrm::PaintColLines( const SwRect &rRect, const SwFmtCol &rFmtCol,
5045cdf0e10cSrcweir const SwPageFrm *pPage ) const
5046cdf0e10cSrcweir {
5047cdf0e10cSrcweir const SwFrm *pCol = Lower();
5048cdf0e10cSrcweir if ( !pCol || !pCol->IsColumnFrm() )
5049cdf0e10cSrcweir return;
5050cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
5051cdf0e10cSrcweir SwRectFn fnRect = pCol->IsVertical() ? ( pCol->IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
5052cdf0e10cSrcweir
5053cdf0e10cSrcweir SwRect aLineRect = Prt();
5054cdf0e10cSrcweir aLineRect += Frm().Pos();
5055cdf0e10cSrcweir
5056cdf0e10cSrcweir SwTwips nTop = ((aLineRect.*fnRect->fnGetHeight)()*rFmtCol.GetLineHeight())
5057cdf0e10cSrcweir / 100 - (aLineRect.*fnRect->fnGetHeight)();
5058cdf0e10cSrcweir SwTwips nBottom = 0;
5059cdf0e10cSrcweir
5060cdf0e10cSrcweir switch ( rFmtCol.GetLineAdj() )
5061cdf0e10cSrcweir {
5062cdf0e10cSrcweir case COLADJ_CENTER:
5063cdf0e10cSrcweir nBottom = nTop / 2; nTop -= nBottom; break;
5064cdf0e10cSrcweir case COLADJ_TOP:
5065cdf0e10cSrcweir nBottom = nTop; nTop = 0; break;
5066cdf0e10cSrcweir case COLADJ_BOTTOM:
5067cdf0e10cSrcweir break;
5068cdf0e10cSrcweir default:
5069870262e3SDon Lewis ASSERT( sal_False, "New adjustment for column line?" );
5070cdf0e10cSrcweir }
5071cdf0e10cSrcweir
5072cdf0e10cSrcweir if( nTop )
5073cdf0e10cSrcweir (aLineRect.*fnRect->fnSubTop)( nTop );
5074cdf0e10cSrcweir if( nBottom )
5075cdf0e10cSrcweir (aLineRect.*fnRect->fnAddBottom)( nBottom );
5076cdf0e10cSrcweir
5077cdf0e10cSrcweir SwTwips nPenHalf = rFmtCol.GetLineWidth();
5078cdf0e10cSrcweir (aLineRect.*fnRect->fnSetWidth)( nPenHalf );
5079cdf0e10cSrcweir nPenHalf /= 2;
5080cdf0e10cSrcweir
5081cdf0e10cSrcweir //Damit uns nichts verlorengeht muessen wir hier etwas grosszuegiger sein.
5082cdf0e10cSrcweir SwRect aRect( rRect );
5083cdf0e10cSrcweir (aRect.*fnRect->fnSubLeft)( nPenHalf + nPixelSzW );
5084cdf0e10cSrcweir (aRect.*fnRect->fnAddRight)( nPenHalf + nPixelSzW );
5085cdf0e10cSrcweir SwRectGet fnGetX = IsRightToLeft() ? fnRect->fnGetLeft : fnRect->fnGetRight;
5086cdf0e10cSrcweir while ( pCol->GetNext() )
5087cdf0e10cSrcweir {
5088cdf0e10cSrcweir (aLineRect.*fnRect->fnSetPosX)
5089cdf0e10cSrcweir ( (pCol->Frm().*fnGetX)() - nPenHalf );
5090cdf0e10cSrcweir if ( aRect.IsOver( aLineRect ) )
5091cdf0e10cSrcweir PaintBorderLine( aRect, aLineRect , pPage, &rFmtCol.GetLineColor());
5092cdf0e10cSrcweir pCol = pCol->GetNext();
5093cdf0e10cSrcweir }
5094cdf0e10cSrcweir }
5095cdf0e10cSrcweir
PaintGrid(OutputDevice * pOut,SwRect & rRect) const5096cdf0e10cSrcweir void SwPageFrm::PaintGrid( OutputDevice* pOut, SwRect &rRect ) const
5097cdf0e10cSrcweir {
5098cdf0e10cSrcweir if( !bHasGrid || pRetoucheFly || pRetoucheFly2 )
5099cdf0e10cSrcweir return;
5100cdf0e10cSrcweir GETGRID( this )
5101cdf0e10cSrcweir if( pGrid && ( OUTDEV_PRINTER != pOut->GetOutDevType() ?
5102cdf0e10cSrcweir pGrid->GetDisplayGrid() : pGrid->GetPrintGrid() ) )
5103cdf0e10cSrcweir {
5104cdf0e10cSrcweir const SwLayoutFrm* pBody = FindBodyCont();
5105cdf0e10cSrcweir if( pBody )
5106cdf0e10cSrcweir {
5107cdf0e10cSrcweir SwRect aGrid( pBody->Prt() );
5108cdf0e10cSrcweir aGrid += pBody->Frm().Pos();
5109cdf0e10cSrcweir
5110cdf0e10cSrcweir SwRect aInter( aGrid );
5111cdf0e10cSrcweir aInter.Intersection( rRect );
5112cdf0e10cSrcweir if( aInter.HasArea() )
5113cdf0e10cSrcweir {
5114cdf0e10cSrcweir sal_Bool bGrid = pGrid->GetRubyTextBelow();
5115cdf0e10cSrcweir sal_Bool bCell = GRID_LINES_CHARS == pGrid->GetGridType();
5116cdf0e10cSrcweir long nGrid = pGrid->GetBaseHeight();
5117cdf0e10cSrcweir const SwDoc* pDoc = GetFmt()->GetDoc();
5118cdf0e10cSrcweir long nGridWidth = GETGRIDWIDTH(pGrid,pDoc); //for textgrid refactor
5119cdf0e10cSrcweir long nRuby = pGrid->GetRubyHeight();
5120cdf0e10cSrcweir long nSum = nGrid + nRuby;
5121cdf0e10cSrcweir const Color *pCol = &pGrid->GetColor();
5122cdf0e10cSrcweir
5123cdf0e10cSrcweir SwTwips nRight = aInter.Left() + aInter.Width();
5124cdf0e10cSrcweir SwTwips nBottom = aInter.Top() + aInter.Height();
5125cdf0e10cSrcweir if( IsVertical() )
5126cdf0e10cSrcweir {
5127cdf0e10cSrcweir SwTwips nOrig = aGrid.Left() + aGrid.Width();
5128cdf0e10cSrcweir SwTwips nY = nOrig + nSum *
5129cdf0e10cSrcweir ( ( nOrig - aInter.Left() ) / nSum );
5130cdf0e10cSrcweir SwRect aTmp( Point( nY, aInter.Top() ),
5131cdf0e10cSrcweir Size( 1, aInter.Height() ) );
5132cdf0e10cSrcweir SwTwips nX = aGrid.Top() + nGrid *
5133cdf0e10cSrcweir ( ( aInter.Top() - aGrid.Top() )/ nGrid );
5134cdf0e10cSrcweir if( nX < aInter.Top() )
5135cdf0e10cSrcweir nX += nGrid;
5136cdf0e10cSrcweir SwTwips nGridBottom = aGrid.Top() + aGrid.Height();
5137cdf0e10cSrcweir sal_Bool bLeft = aGrid.Top() >= aInter.Top();
5138cdf0e10cSrcweir sal_Bool bRight = nGridBottom <= nBottom;
5139cdf0e10cSrcweir sal_Bool bBorder = bLeft || bRight;
5140cdf0e10cSrcweir while( nY > nRight )
5141cdf0e10cSrcweir {
5142cdf0e10cSrcweir aTmp.Pos().X() = nY;
5143cdf0e10cSrcweir if( bGrid )
5144cdf0e10cSrcweir {
5145cdf0e10cSrcweir nY -= nGrid;
5146cdf0e10cSrcweir SwTwips nPosY = Max( aInter.Left(), nY );
5147cdf0e10cSrcweir SwTwips nHeight = Min(nRight, aTmp.Pos().X())-nPosY;
5148cdf0e10cSrcweir if( nHeight > 0 )
5149cdf0e10cSrcweir {
5150cdf0e10cSrcweir if( bCell )
5151cdf0e10cSrcweir {
5152cdf0e10cSrcweir SwRect aVert( Point( nPosY, nX ),
5153cdf0e10cSrcweir Size( nHeight, 1 ) );
5154cdf0e10cSrcweir while( aVert.Top() <= nBottom )
5155cdf0e10cSrcweir {
5156cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5157cdf0e10cSrcweir aVert.Pos().Y() += nGrid;
5158cdf0e10cSrcweir }
5159cdf0e10cSrcweir }
5160cdf0e10cSrcweir else if( bBorder )
5161cdf0e10cSrcweir {
5162cdf0e10cSrcweir SwRect aVert( Point( nPosY, aGrid.Top() ),
5163cdf0e10cSrcweir Size( nHeight, 1 ) );
5164cdf0e10cSrcweir if( bLeft )
5165cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5166cdf0e10cSrcweir if( bRight )
5167cdf0e10cSrcweir {
5168cdf0e10cSrcweir aVert.Pos().Y() = nGridBottom;
5169cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5170cdf0e10cSrcweir }
5171cdf0e10cSrcweir }
5172cdf0e10cSrcweir }
5173cdf0e10cSrcweir }
5174cdf0e10cSrcweir else
5175cdf0e10cSrcweir {
5176cdf0e10cSrcweir nY -= nRuby;
5177cdf0e10cSrcweir if( bBorder )
5178cdf0e10cSrcweir {
5179cdf0e10cSrcweir SwTwips nPos = Max( aInter.Left(), nY );
5180cdf0e10cSrcweir SwTwips nW = Min(nRight, aTmp.Pos().X()) - nPos;
5181cdf0e10cSrcweir SwRect aVert( Point( nPos, aGrid.Top() ),
5182cdf0e10cSrcweir Size( nW, 1 ) );
5183cdf0e10cSrcweir if( nW > 0 )
5184cdf0e10cSrcweir {
5185cdf0e10cSrcweir if( bLeft )
5186cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5187cdf0e10cSrcweir if( bRight )
5188cdf0e10cSrcweir {
5189cdf0e10cSrcweir aVert.Pos().Y() = nGridBottom;
5190cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5191cdf0e10cSrcweir }
5192cdf0e10cSrcweir }
5193cdf0e10cSrcweir }
5194cdf0e10cSrcweir }
5195cdf0e10cSrcweir bGrid = !bGrid;
5196cdf0e10cSrcweir }
5197cdf0e10cSrcweir while( nY >= aInter.Left() )
5198cdf0e10cSrcweir {
5199cdf0e10cSrcweir aTmp.Pos().X() = nY;
5200cdf0e10cSrcweir PaintBorderLine( rRect, aTmp, this, pCol);
5201cdf0e10cSrcweir if( bGrid )
5202cdf0e10cSrcweir {
5203cdf0e10cSrcweir nY -= nGrid;
5204cdf0e10cSrcweir SwTwips nHeight = aTmp.Pos().X()
5205cdf0e10cSrcweir - Max(aInter.Left(), nY );
5206cdf0e10cSrcweir if( nHeight > 0 )
5207cdf0e10cSrcweir {
5208cdf0e10cSrcweir if( bCell )
5209cdf0e10cSrcweir {
5210cdf0e10cSrcweir SwRect aVert( Point(aTmp.Pos().X()-nHeight,
5211cdf0e10cSrcweir nX ), Size( nHeight, 1 ) );
5212cdf0e10cSrcweir while( aVert.Top() <= nBottom )
5213cdf0e10cSrcweir {
5214cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5215cdf0e10cSrcweir aVert.Pos().Y() += nGrid;
5216cdf0e10cSrcweir }
5217cdf0e10cSrcweir }
5218cdf0e10cSrcweir else if( bBorder )
5219cdf0e10cSrcweir {
5220cdf0e10cSrcweir SwRect aVert( Point(aTmp.Pos().X()-nHeight,
5221cdf0e10cSrcweir aGrid.Top() ), Size( nHeight, 1 ) );
5222cdf0e10cSrcweir if( bLeft )
5223cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5224cdf0e10cSrcweir if( bRight )
5225cdf0e10cSrcweir {
5226cdf0e10cSrcweir aVert.Pos().Y() = nGridBottom;
5227cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5228cdf0e10cSrcweir }
5229cdf0e10cSrcweir }
5230cdf0e10cSrcweir }
5231cdf0e10cSrcweir }
5232cdf0e10cSrcweir else
5233cdf0e10cSrcweir {
5234cdf0e10cSrcweir nY -= nRuby;
5235cdf0e10cSrcweir if( bBorder )
5236cdf0e10cSrcweir {
5237cdf0e10cSrcweir SwTwips nPos = Max( aInter.Left(), nY );
5238cdf0e10cSrcweir SwTwips nW = Min(nRight, aTmp.Pos().X()) - nPos;
5239cdf0e10cSrcweir SwRect aVert( Point( nPos, aGrid.Top() ),
5240cdf0e10cSrcweir Size( nW, 1 ) );
5241cdf0e10cSrcweir if( nW > 0 )
5242cdf0e10cSrcweir {
5243cdf0e10cSrcweir if( bLeft )
5244cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5245cdf0e10cSrcweir if( bRight )
5246cdf0e10cSrcweir {
5247cdf0e10cSrcweir aVert.Pos().Y() = nGridBottom;
5248cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5249cdf0e10cSrcweir }
5250cdf0e10cSrcweir }
5251cdf0e10cSrcweir }
5252cdf0e10cSrcweir }
5253cdf0e10cSrcweir bGrid = !bGrid;
5254cdf0e10cSrcweir }
5255cdf0e10cSrcweir }
5256cdf0e10cSrcweir else
5257cdf0e10cSrcweir {
5258cdf0e10cSrcweir SwTwips nOrig = aGrid.Top();
5259cdf0e10cSrcweir SwTwips nY = nOrig + nSum *( (aInter.Top()-nOrig)/nSum );
5260cdf0e10cSrcweir SwRect aTmp( Point( aInter.Left(), nY ),
5261cdf0e10cSrcweir Size( aInter.Width(), 1 ) );
5262cdf0e10cSrcweir //for textgrid refactor
5263cdf0e10cSrcweir SwTwips nX = aGrid.Left() + nGridWidth *
5264cdf0e10cSrcweir ( ( aInter.Left() - aGrid.Left() )/ nGridWidth );
5265cdf0e10cSrcweir if( nX < aInter.Left() )
5266cdf0e10cSrcweir nX += nGridWidth;
5267cdf0e10cSrcweir SwTwips nGridRight = aGrid.Left() + aGrid.Width();
5268cdf0e10cSrcweir sal_Bool bLeft = aGrid.Left() >= aInter.Left();
5269cdf0e10cSrcweir sal_Bool bRight = nGridRight <= nRight;
5270cdf0e10cSrcweir sal_Bool bBorder = bLeft || bRight;
5271cdf0e10cSrcweir while( nY < aInter.Top() )
5272cdf0e10cSrcweir {
5273cdf0e10cSrcweir aTmp.Pos().Y() = nY;
5274cdf0e10cSrcweir if( bGrid )
5275cdf0e10cSrcweir {
5276cdf0e10cSrcweir nY += nGrid;
5277cdf0e10cSrcweir SwTwips nPosY = Max( aInter.Top(), aTmp.Pos().Y() );
5278cdf0e10cSrcweir SwTwips nHeight = Min(nBottom, nY ) - nPosY;
5279cdf0e10cSrcweir if( nHeight )
5280cdf0e10cSrcweir {
5281cdf0e10cSrcweir if( bCell )
5282cdf0e10cSrcweir {
5283cdf0e10cSrcweir SwRect aVert( Point( nX, nPosY ),
5284cdf0e10cSrcweir Size( 1, nHeight ) );
5285cdf0e10cSrcweir while( aVert.Left() <= nRight )
5286cdf0e10cSrcweir {
5287cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5288cdf0e10cSrcweir aVert.Pos().X() += nGridWidth; //for textgrid refactor
5289cdf0e10cSrcweir }
5290cdf0e10cSrcweir }
5291cdf0e10cSrcweir else if ( bBorder )
5292cdf0e10cSrcweir {
5293cdf0e10cSrcweir SwRect aVert( Point( aGrid.Left(), nPosY ),
5294cdf0e10cSrcweir Size( 1, nHeight ) );
5295cdf0e10cSrcweir if( bLeft )
5296cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5297cdf0e10cSrcweir if( bRight )
5298cdf0e10cSrcweir {
5299cdf0e10cSrcweir aVert.Pos().X() = nGridRight;
5300cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5301cdf0e10cSrcweir }
5302cdf0e10cSrcweir }
5303cdf0e10cSrcweir }
5304cdf0e10cSrcweir }
5305cdf0e10cSrcweir else
5306cdf0e10cSrcweir {
5307cdf0e10cSrcweir nY += nRuby;
5308cdf0e10cSrcweir if( bBorder )
5309cdf0e10cSrcweir {
5310cdf0e10cSrcweir SwTwips nPos = Max(aInter.Top(),aTmp.Pos().Y());
5311cdf0e10cSrcweir SwTwips nH = Min( nBottom, nY ) - nPos;
5312cdf0e10cSrcweir SwRect aVert( Point( aGrid.Left(), nPos ),
5313cdf0e10cSrcweir Size( 1, nH ) );
5314cdf0e10cSrcweir if( nH > 0 )
5315cdf0e10cSrcweir {
5316cdf0e10cSrcweir if( bLeft )
5317cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5318cdf0e10cSrcweir if( bRight )
5319cdf0e10cSrcweir {
5320cdf0e10cSrcweir aVert.Pos().X() = nGridRight;
5321cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5322cdf0e10cSrcweir }
5323cdf0e10cSrcweir }
5324cdf0e10cSrcweir }
5325cdf0e10cSrcweir }
5326cdf0e10cSrcweir bGrid = !bGrid;
5327cdf0e10cSrcweir }
5328cdf0e10cSrcweir while( nY <= nBottom )
5329cdf0e10cSrcweir {
5330cdf0e10cSrcweir aTmp.Pos().Y() = nY;
5331cdf0e10cSrcweir PaintBorderLine( rRect, aTmp, this, pCol);
5332cdf0e10cSrcweir if( bGrid )
5333cdf0e10cSrcweir {
5334cdf0e10cSrcweir nY += nGrid;
5335cdf0e10cSrcweir SwTwips nHeight = Min(nBottom, nY) - aTmp.Pos().Y();
5336cdf0e10cSrcweir if( nHeight )
5337cdf0e10cSrcweir {
5338cdf0e10cSrcweir if( bCell )
5339cdf0e10cSrcweir {
5340cdf0e10cSrcweir SwRect aVert( Point( nX, aTmp.Pos().Y() ),
5341cdf0e10cSrcweir Size( 1, nHeight ) );
5342cdf0e10cSrcweir while( aVert.Left() <= nRight )
5343cdf0e10cSrcweir {
5344cdf0e10cSrcweir PaintBorderLine( rRect, aVert, this, pCol);
5345cdf0e10cSrcweir aVert.Pos().X() += nGridWidth; //for textgrid refactor
5346cdf0e10cSrcweir }
5347cdf0e10cSrcweir }
5348cdf0e10cSrcweir else if( bBorder )
5349cdf0e10cSrcweir {
5350cdf0e10cSrcweir SwRect aVert( Point( aGrid.Left(),
5351cdf0e10cSrcweir aTmp.Pos().Y() ), Size( 1, nHeight ) );
5352cdf0e10cSrcweir if( bLeft )
5353cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5354cdf0e10cSrcweir if( bRight )
5355cdf0e10cSrcweir {
5356cdf0e10cSrcweir aVert.Pos().X() = nGridRight;
5357cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5358cdf0e10cSrcweir }
5359cdf0e10cSrcweir }
5360cdf0e10cSrcweir }
5361cdf0e10cSrcweir }
5362cdf0e10cSrcweir else
5363cdf0e10cSrcweir {
5364cdf0e10cSrcweir nY += nRuby;
5365cdf0e10cSrcweir if( bBorder )
5366cdf0e10cSrcweir {
5367cdf0e10cSrcweir SwTwips nPos = Max(aInter.Top(),aTmp.Pos().Y());
5368cdf0e10cSrcweir SwTwips nH = Min( nBottom, nY ) - nPos;
5369cdf0e10cSrcweir SwRect aVert( Point( aGrid.Left(), nPos ),
5370cdf0e10cSrcweir Size( 1, nH ) );
5371cdf0e10cSrcweir if( nH > 0 )
5372cdf0e10cSrcweir {
5373cdf0e10cSrcweir if( bLeft )
5374cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5375cdf0e10cSrcweir if( bRight )
5376cdf0e10cSrcweir {
5377cdf0e10cSrcweir aVert.Pos().X() = nGridRight;
5378cdf0e10cSrcweir PaintBorderLine(rRect,aVert,this,pCol);
5379cdf0e10cSrcweir }
5380cdf0e10cSrcweir }
5381cdf0e10cSrcweir }
5382cdf0e10cSrcweir }
5383cdf0e10cSrcweir bGrid = !bGrid;
5384cdf0e10cSrcweir }
5385cdf0e10cSrcweir }
5386cdf0e10cSrcweir }
5387cdf0e10cSrcweir }
5388cdf0e10cSrcweir }
5389cdf0e10cSrcweir }
5390cdf0e10cSrcweir
5391cdf0e10cSrcweir /** paint margin area of a page
5392cdf0e10cSrcweir
5393cdf0e10cSrcweir OD 20.11.2002 for #104598#:
5394cdf0e10cSrcweir implement paint of margin area; margin area will be painted for a
5395cdf0e10cSrcweir view shell with a window and if the document is not in online layout.
5396cdf0e10cSrcweir
5397cdf0e10cSrcweir @author OD
5398cdf0e10cSrcweir
5399cdf0e10cSrcweir @param _rOutputRect
5400cdf0e10cSrcweir input parameter - constant instance reference of the rectangle, for
5401cdf0e10cSrcweir which an output has to be generated.
5402cdf0e10cSrcweir
5403cdf0e10cSrcweir @param _pViewShell
5404cdf0e10cSrcweir input parameter - instance of the view shell, on which the output
5405cdf0e10cSrcweir has to be generated.
5406cdf0e10cSrcweir */
PaintMarginArea(const SwRect & _rOutputRect,ViewShell * _pViewShell) const5407cdf0e10cSrcweir void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect,
5408cdf0e10cSrcweir ViewShell* _pViewShell ) const
5409cdf0e10cSrcweir {
541056b35d86SArmin Le Grand if ( _pViewShell->GetWin() && !_pViewShell->GetViewOptions()->getBrowseMode() )
5411cdf0e10cSrcweir {
541256b35d86SArmin Le Grand //UUUU Simplified paint with DrawingLayer FillStyle
5413cdf0e10cSrcweir SwRect aPgRect = Frm();
5414cdf0e10cSrcweir aPgRect._Intersection( _rOutputRect );
541556b35d86SArmin Le Grand
541656b35d86SArmin Le Grand if(!aPgRect.IsEmpty())
5417cdf0e10cSrcweir {
5418cdf0e10cSrcweir OutputDevice *pOut = _pViewShell->GetOut();
541956b35d86SArmin Le Grand
5420cdf0e10cSrcweir if(pOut->GetFillColor() != aGlobalRetoucheColor)
542156b35d86SArmin Le Grand {
5422cdf0e10cSrcweir pOut->SetFillColor(aGlobalRetoucheColor);
5423cdf0e10cSrcweir }
542456b35d86SArmin Le Grand
542556b35d86SArmin Le Grand pOut->DrawRect(aPgRect.SVRect());
5426cdf0e10cSrcweir }
5427cdf0e10cSrcweir }
5428cdf0e10cSrcweir }
5429cdf0e10cSrcweir
5430cdf0e10cSrcweir // OD 12.02.2003 for #i9719# and #105645#
5431cdf0e10cSrcweir // ----------------------------------------------------------------------
5432cdf0e10cSrcweir
5433cdf0e10cSrcweir const sal_Int8 SwPageFrm::mnBorderPxWidth = 1;
5434cdf0e10cSrcweir
5435cdf0e10cSrcweir /** determine rectangle for page border
5436cdf0e10cSrcweir
5437cdf0e10cSrcweir OD 12.02.2003 for #i9719# and #105645#
5438cdf0e10cSrcweir
5439cdf0e10cSrcweir @author OD
5440cdf0e10cSrcweir */
GetBorderRect(const SwRect & _rPageRect,ViewShell * _pViewShell,SwRect & _orBorderRect,bool bRightSidebar)5441cdf0e10cSrcweir /*static*/ void SwPageFrm::GetBorderRect( const SwRect& _rPageRect,
5442cdf0e10cSrcweir ViewShell* _pViewShell,
5443cdf0e10cSrcweir SwRect& _orBorderRect,
5444cdf0e10cSrcweir bool bRightSidebar )
5445cdf0e10cSrcweir {
5446cdf0e10cSrcweir SwRect aAlignedPageRect( _rPageRect );
5447cdf0e10cSrcweir ::SwAlignRect( aAlignedPageRect, _pViewShell );
5448cdf0e10cSrcweir Rectangle aBorderPxRect =
5449cdf0e10cSrcweir _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
5450cdf0e10cSrcweir
5451cdf0e10cSrcweir aBorderPxRect.Left() = aBorderPxRect.Left() - mnBorderPxWidth;
5452cdf0e10cSrcweir aBorderPxRect.Top() = aBorderPxRect.Top() - mnBorderPxWidth;
5453cdf0e10cSrcweir aBorderPxRect.Right() = aBorderPxRect.Right() + mnBorderPxWidth;
5454cdf0e10cSrcweir aBorderPxRect.Bottom() = aBorderPxRect.Bottom() + mnBorderPxWidth;
5455cdf0e10cSrcweir
5456cdf0e10cSrcweir AddSidebarBorders(aBorderPxRect,_pViewShell, bRightSidebar, true);
5457cdf0e10cSrcweir
5458cdf0e10cSrcweir _orBorderRect =
5459cdf0e10cSrcweir SwRect( _pViewShell->GetOut()->PixelToLogic( aBorderPxRect ) );
5460cdf0e10cSrcweir }
5461cdf0e10cSrcweir
5462cdf0e10cSrcweir /** determine rectangle for right page shadow
5463cdf0e10cSrcweir
5464cdf0e10cSrcweir OD 12.02.2003 for #i9719# and #105645#
5465cdf0e10cSrcweir
5466cdf0e10cSrcweir @author OD
5467cdf0e10cSrcweir */
GetRightShadowRect(const SwRect & _rPageRect,ViewShell * _pViewShell,SwRect & _orRightShadowRect,bool bRightSidebar)5468cdf0e10cSrcweir /*static*/ void SwPageFrm::GetRightShadowRect( const SwRect& _rPageRect,
5469cdf0e10cSrcweir ViewShell* _pViewShell,
5470cdf0e10cSrcweir SwRect& _orRightShadowRect,
5471cdf0e10cSrcweir bool bRightSidebar )
5472cdf0e10cSrcweir {
5473cdf0e10cSrcweir SwRect aAlignedPageRect( _rPageRect );
5474cdf0e10cSrcweir ::SwAlignRect( aAlignedPageRect, _pViewShell );
5475cdf0e10cSrcweir Rectangle aPagePxRect =
5476cdf0e10cSrcweir _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
5477cdf0e10cSrcweir
5478cdf0e10cSrcweir Rectangle aRightShadowPxRect(
5479307b55caSmseidel aPagePxRect.Right(),
5480cdf0e10cSrcweir aPagePxRect.Top() + 1,
5481307b55caSmseidel aPagePxRect.Right() + mnBorderPxWidth,
5482307b55caSmseidel aPagePxRect.Bottom() + mnBorderPxWidth );
5483cdf0e10cSrcweir
5484cdf0e10cSrcweir if ( bRightSidebar )
5485cdf0e10cSrcweir AddSidebarBorders(aRightShadowPxRect,_pViewShell, bRightSidebar, true);
5486cdf0e10cSrcweir
5487cdf0e10cSrcweir _orRightShadowRect =
5488cdf0e10cSrcweir SwRect( _pViewShell->GetOut()->PixelToLogic( aRightShadowPxRect ) );
5489cdf0e10cSrcweir }
5490cdf0e10cSrcweir
5491cdf0e10cSrcweir /** determine rectangle for bottom page shadow
5492cdf0e10cSrcweir
5493cdf0e10cSrcweir OD 12.02.2003 for #i9719# and #105645#
5494cdf0e10cSrcweir
5495cdf0e10cSrcweir @author OD
5496cdf0e10cSrcweir */
GetBottomShadowRect(const SwRect & _rPageRect,ViewShell * _pViewShell,SwRect & _orBottomShadowRect,bool bRightSidebar)5497cdf0e10cSrcweir /*static*/ void SwPageFrm::GetBottomShadowRect( const SwRect& _rPageRect,
5498cdf0e10cSrcweir ViewShell* _pViewShell,
5499cdf0e10cSrcweir SwRect& _orBottomShadowRect,
5500cdf0e10cSrcweir bool bRightSidebar )
5501cdf0e10cSrcweir {
5502cdf0e10cSrcweir SwRect aAlignedPageRect( _rPageRect );
5503cdf0e10cSrcweir ::SwAlignRect( aAlignedPageRect, _pViewShell );
5504cdf0e10cSrcweir Rectangle aPagePxRect =
5505cdf0e10cSrcweir _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
5506cdf0e10cSrcweir
5507cdf0e10cSrcweir Rectangle aBottomShadowPxRect(
5508cdf0e10cSrcweir aPagePxRect.Left() + 1,
5509307b55caSmseidel aPagePxRect.Bottom(),
5510307b55caSmseidel aPagePxRect.Right() + mnBorderPxWidth,
5511307b55caSmseidel aPagePxRect.Bottom() + mnBorderPxWidth );
5512cdf0e10cSrcweir
5513cdf0e10cSrcweir AddSidebarBorders(aBottomShadowPxRect,_pViewShell, bRightSidebar, true);
5514cdf0e10cSrcweir
5515cdf0e10cSrcweir _orBottomShadowRect =
5516cdf0e10cSrcweir SwRect( _pViewShell->GetOut()->PixelToLogic( aBottomShadowPxRect ) );
5517cdf0e10cSrcweir }
5518cdf0e10cSrcweir
5519ad095790Smseidel /** paint page border (shadow removed now)
5520cdf0e10cSrcweir
5521cdf0e10cSrcweir OD 12.02.2003 for #i9719# and #105645#
5522ad095790Smseidel implement paint of page border
5523cdf0e10cSrcweir
5524cdf0e10cSrcweir @author OD
5525cdf0e10cSrcweir */
PaintPageBorder(const SwRect & _rPageRect,ViewShell * _pViewShell,bool bRightSidebar)5526a4b2faf0Smseidel /*static*/ void SwPageFrm::PaintPageBorder( const SwRect& _rPageRect,
5527cdf0e10cSrcweir ViewShell* _pViewShell,
5528cdf0e10cSrcweir bool bRightSidebar )
5529cdf0e10cSrcweir {
5530cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
5531cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *_pViewShell->GetOut() );
5532cdf0e10cSrcweir // <--
5533cdf0e10cSrcweir
5534ad095790Smseidel // get color for page border
5535cdf0e10cSrcweir const Color& rColor = SwViewOption::GetFontColor();
5536cdf0e10cSrcweir
5537cdf0e10cSrcweir // save current fill and line color of output device
5538cdf0e10cSrcweir Color aFill( _pViewShell->GetOut()->GetFillColor() );
5539cdf0e10cSrcweir Color aLine( _pViewShell->GetOut()->GetLineColor() );
5540cdf0e10cSrcweir
5541cdf0e10cSrcweir // paint page border
5542cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(); // OD 20.02.2003 #107369# - no fill color
5543cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor( rColor );
5544cdf0e10cSrcweir SwRect aPaintRect;
5545cdf0e10cSrcweir SwPageFrm::GetBorderRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar );
5546cdf0e10cSrcweir _pViewShell->GetOut()->DrawRect( aPaintRect.SVRect() );
5547cdf0e10cSrcweir }
5548cdf0e10cSrcweir
5549cdf0e10cSrcweir //mod #i6193# paint sidebar for notes
5550cdf0e10cSrcweir //IMPORTANT: if you change the rects here, also change SwPostItMgr::ScrollbarHit
PaintNotesSidebar(const SwRect & _rPageRect,ViewShell * _pViewShell,sal_uInt16 nPageNum,bool bRight)5551cdf0e10cSrcweir /*static*/void SwPageFrm::PaintNotesSidebar(const SwRect& _rPageRect, ViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight)
5552cdf0e10cSrcweir {
5553f3bf8e1eSmseidel //TODO: cut out scrollbar area and arrows out of sidepane rect, otherwise it could flicker when pressing arrow buttons
5554cdf0e10cSrcweir if (!_pViewShell )
5555cdf0e10cSrcweir return;
5556cdf0e10cSrcweir
5557cdf0e10cSrcweir SwRect aPageRect( _rPageRect );
5558cdf0e10cSrcweir SwAlignRect( aPageRect, _pViewShell );
5559cdf0e10cSrcweir
5560cdf0e10cSrcweir const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
5561cdf0e10cSrcweir if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes()) // do not show anything in print preview
5562cdf0e10cSrcweir {
5563cdf0e10cSrcweir sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight();
5564cdf0e10cSrcweir const Rectangle &aVisRect = _pViewShell->VisArea().SVRect();
5565cdf0e10cSrcweir //draw border and sidepane
5566cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor();
5567cdf0e10cSrcweir if (!bRight)
5568cdf0e10cSrcweir {
5569cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
5570cdf0e10cSrcweir _pViewShell->GetOut()->DrawRect(Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()))) ;
5571cdf0e10cSrcweir if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5572cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5573cdf0e10cSrcweir else
5574cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
5575cdf0e10cSrcweir _pViewShell->GetOut()->DrawRect(Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarWidth()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()))) ;
5576cdf0e10cSrcweir }
5577cdf0e10cSrcweir else
5578cdf0e10cSrcweir {
5579cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
5580cdf0e10cSrcweir SwRect aSidebarBorder(aPageRect.TopRight(),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()));
5581cdf0e10cSrcweir _pViewShell->GetOut()->DrawRect(aSidebarBorder.SVRect());
5582cdf0e10cSrcweir if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5583cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5584cdf0e10cSrcweir else
5585cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
5586cdf0e10cSrcweir SwRect aSidebar(Point(aPageRect.Right()+pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()));
5587cdf0e10cSrcweir _pViewShell->GetOut()->DrawRect(aSidebar.SVRect());
5588cdf0e10cSrcweir }
5589cdf0e10cSrcweir if (pMgr->ShowScrollbar(nPageNum))
5590cdf0e10cSrcweir {
5591cdf0e10cSrcweir // draw scrollbar area and arrows
5592cdf0e10cSrcweir Point aPointBottom;
5593cdf0e10cSrcweir Point aPointTop;
5594cdf0e10cSrcweir aPointBottom = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() - pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height()) :
5595cdf0e10cSrcweir Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height());
5596cdf0e10cSrcweir aPointTop = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height()) :
5597cdf0e10cSrcweir Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height());
5598cdf0e10cSrcweir Size aSize(pMgr->GetSidebarWidth() - _pViewShell->GetOut()->PixelToLogic(Size(4,0)).Width(), _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()) ;
5599cdf0e10cSrcweir Rectangle aRectBottom(aPointBottom,aSize);
5600cdf0e10cSrcweir Rectangle aRectTop(aPointTop,aSize);
5601cdf0e10cSrcweir
5602cdf0e10cSrcweir if (aRectBottom.IsOver(aVisRect))
5603cdf0e10cSrcweir {
5604cdf0e10cSrcweir
5605cdf0e10cSrcweir if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5606cdf0e10cSrcweir {
5607cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor(COL_WHITE);
5608cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5609cdf0e10cSrcweir }
5610cdf0e10cSrcweir else
5611cdf0e10cSrcweir {
5612cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor(COL_BLACK);
5613cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
5614cdf0e10cSrcweir }
5615cdf0e10cSrcweir _pViewShell->GetOut()->DrawRect(aRectBottom);
5616cdf0e10cSrcweir _pViewShell->GetOut()->DrawLine(aPointBottom + Point(pMgr->GetSidebarWidth()/3,0), aPointBottom + Point(pMgr->GetSidebarWidth()/3 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
5617cdf0e10cSrcweir
5618cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor();
5619cdf0e10cSrcweir Point aMiddleFirst(aPointBottom + Point(pMgr->GetSidebarWidth()/6,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5620cdf0e10cSrcweir Point aMiddleSecond(aPointBottom + Point(pMgr->GetSidebarWidth()/3*2,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5621cdf0e10cSrcweir PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell,pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
5622cdf0e10cSrcweir }
5623cdf0e10cSrcweir if (aRectTop.IsOver(aVisRect))
5624cdf0e10cSrcweir {
5625cdf0e10cSrcweir if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5626cdf0e10cSrcweir {
5627cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor(COL_WHITE);
5628cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5629cdf0e10cSrcweir }
5630cdf0e10cSrcweir else
5631cdf0e10cSrcweir {
5632cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor(COL_BLACK);
5633cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
5634cdf0e10cSrcweir }
5635cdf0e10cSrcweir _pViewShell->GetOut()->DrawRect(aRectTop);
5636cdf0e10cSrcweir _pViewShell->GetOut()->DrawLine(aPointTop + Point(pMgr->GetSidebarWidth()/3*2,0), aPointTop + Point(pMgr->GetSidebarWidth()/3*2 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
5637cdf0e10cSrcweir
5638cdf0e10cSrcweir _pViewShell->GetOut()->SetLineColor();
5639cdf0e10cSrcweir Point aMiddleFirst(aPointTop + Point(pMgr->GetSidebarWidth()/3,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5640cdf0e10cSrcweir Point aMiddleSecond(aPointTop + Point(pMgr->GetSidebarWidth()/6*5,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5641cdf0e10cSrcweir PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell, pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
5642cdf0e10cSrcweir }
5643cdf0e10cSrcweir }
5644cdf0e10cSrcweir }
5645cdf0e10cSrcweir }
5646cdf0e10cSrcweir
PaintNotesSidebarArrows(const Point & aMiddleFirst,const Point & aMiddleSecond,ViewShell * _pViewShell,const Color aColorUp,const Color aColorDown)5647cdf0e10cSrcweir /*static*/ void SwPageFrm::PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, ViewShell* _pViewShell, const Color aColorUp, const Color aColorDown)
5648cdf0e10cSrcweir {
5649cdf0e10cSrcweir Polygon aTriangleUp(3);
5650cdf0e10cSrcweir Polygon aTriangleDown(3);
5651cdf0e10cSrcweir
5652cdf0e10cSrcweir aTriangleUp.SetPoint(aMiddleFirst + Point(0,_pViewShell->GetOut()->PixelToLogic(Size(0,-3)).Height()),0);
5653cdf0e10cSrcweir aTriangleUp.SetPoint(aMiddleFirst + Point(_pViewShell->GetOut()->PixelToLogic(Size(-3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,3)).Height()),1);
5654cdf0e10cSrcweir aTriangleUp.SetPoint(aMiddleFirst + Point(_pViewShell->GetOut()->PixelToLogic(Size(3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,3)).Height()),2);
5655cdf0e10cSrcweir
5656cdf0e10cSrcweir aTriangleDown.SetPoint(aMiddleSecond + Point(_pViewShell->GetOut()->PixelToLogic(Size(-3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,-3)).Height()),0);
5657cdf0e10cSrcweir aTriangleDown.SetPoint(aMiddleSecond + Point(_pViewShell->GetOut()->PixelToLogic(Size(+3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,-3)).Height()),1);
5658cdf0e10cSrcweir aTriangleDown.SetPoint(aMiddleSecond + Point(0,_pViewShell->GetOut()->PixelToLogic(Size(0,3)).Height()),2);
5659cdf0e10cSrcweir
5660cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(aColorUp);
5661cdf0e10cSrcweir _pViewShell->GetOut()->DrawPolygon(aTriangleUp);
5662cdf0e10cSrcweir _pViewShell->GetOut()->SetFillColor(aColorDown);
5663cdf0e10cSrcweir _pViewShell->GetOut()->DrawPolygon(aTriangleDown);
5664cdf0e10cSrcweir }
5665cdf0e10cSrcweir
5666cdf0e10cSrcweir /** get bound rectangle of border and shadow for repaints
5667cdf0e10cSrcweir
5668cdf0e10cSrcweir OD 12.02.2003 for #i9719# and #105645#
5669cdf0e10cSrcweir
5670cdf0e10cSrcweir author OD
5671cdf0e10cSrcweir */
GetBorderAndShadowBoundRect(const SwRect & _rPageRect,ViewShell * _pViewShell,SwRect & _orBorderAndShadowBoundRect,bool bRightSidebar)5672cdf0e10cSrcweir /*static*/ void SwPageFrm::GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
5673cdf0e10cSrcweir ViewShell* _pViewShell,
5674cdf0e10cSrcweir SwRect& _orBorderAndShadowBoundRect,
5675cdf0e10cSrcweir bool bRightSidebar )
5676cdf0e10cSrcweir {
5677cdf0e10cSrcweir SwRect aTmpRect;
5678cdf0e10cSrcweir SwPageFrm::GetBorderRect( _rPageRect, _pViewShell, _orBorderAndShadowBoundRect, bRightSidebar );
5679cdf0e10cSrcweir SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aTmpRect, bRightSidebar );
5680cdf0e10cSrcweir _orBorderAndShadowBoundRect.Union( aTmpRect );
5681cdf0e10cSrcweir SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aTmpRect, bRightSidebar );
5682cdf0e10cSrcweir _orBorderAndShadowBoundRect.Union( aTmpRect );
5683cdf0e10cSrcweir
5684cdf0e10cSrcweir AddSidebarBorders(_orBorderAndShadowBoundRect, _pViewShell, bRightSidebar, false);
5685cdf0e10cSrcweir }
5686cdf0e10cSrcweir
AddSidebarBorders(SwRect & aRect,ViewShell * _pViewShell,bool bRightSidebar,bool bPx)5687cdf0e10cSrcweir /*static*/ void SwPageFrm::AddSidebarBorders(SwRect &aRect, ViewShell* _pViewShell, bool bRightSidebar, bool bPx)
5688cdf0e10cSrcweir {
5689cdf0e10cSrcweir const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
5690cdf0e10cSrcweir if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes())
5691cdf0e10cSrcweir {
5692cdf0e10cSrcweir if (!bRightSidebar)
5693cdf0e10cSrcweir aRect.SetLeftAndWidth(aRect.Left() - pMgr->GetSidebarWidth(bPx) - pMgr->GetSidebarBorderWidth(bPx), aRect.Width() + pMgr->GetSidebarWidth(bPx) + pMgr->GetSidebarBorderWidth(bPx));
5694cdf0e10cSrcweir else
5695cdf0e10cSrcweir aRect.AddRight(pMgr->GetSidebarWidth(bPx) + pMgr->GetSidebarBorderWidth(bPx));
5696cdf0e10cSrcweir }
5697cdf0e10cSrcweir }
5698cdf0e10cSrcweir
AddSidebarBorders(Rectangle & aRect,ViewShell * _pViewShell,bool bRightSidebar,bool bPx)5699cdf0e10cSrcweir /*static*/ void SwPageFrm::AddSidebarBorders(Rectangle &aRect, ViewShell* _pViewShell, bool bRightSidebar, bool bPx)
5700cdf0e10cSrcweir {
5701cdf0e10cSrcweir const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
5702cdf0e10cSrcweir if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes())
5703cdf0e10cSrcweir {
5704cdf0e10cSrcweir if (!bRightSidebar)
5705cdf0e10cSrcweir aRect.Left() -= (pMgr->GetSidebarWidth(bPx) + pMgr->GetSidebarBorderWidth(bPx));
5706cdf0e10cSrcweir else
5707cdf0e10cSrcweir aRect.Right() += pMgr->GetSidebarWidth(bPx) + pMgr->GetSidebarBorderWidth(bPx);
5708cdf0e10cSrcweir }
5709cdf0e10cSrcweir }
5710cdf0e10cSrcweir
GetSidebarBorderWidth(const ViewShell * _pViewShell)5711cdf0e10cSrcweir /*static*/ SwTwips SwPageFrm::GetSidebarBorderWidth( const ViewShell* _pViewShell )
5712cdf0e10cSrcweir {
5713cdf0e10cSrcweir const SwPostItMgr* pPostItMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
5714cdf0e10cSrcweir const SwTwips nRet = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
5715cdf0e10cSrcweir return nRet;
5716cdf0e10cSrcweir }
5717cdf0e10cSrcweir
5718cdf0e10cSrcweir /*************************************************************************
5719cdf0e10cSrcweir |*
5720cdf0e10cSrcweir |* SwFrm::PaintBaBo()
5721cdf0e10cSrcweir |*
5722cdf0e10cSrcweir |* Ersterstellung MA 22. Oct. 93
5723cdf0e10cSrcweir |* Letzte Aenderung MA 19. Jun. 96
5724cdf0e10cSrcweir |*
5725cdf0e10cSrcweir |*************************************************************************/
5726cdf0e10cSrcweir
PaintBaBo(const SwRect & rRect,const SwPageFrm * pPage,const sal_Bool bLowerBorder) const5727cdf0e10cSrcweir void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage,
5728cdf0e10cSrcweir const sal_Bool bLowerBorder ) const
5729cdf0e10cSrcweir {
5730cdf0e10cSrcweir if ( !pPage )
5731cdf0e10cSrcweir pPage = FindPageFrm();
5732cdf0e10cSrcweir
5733cdf0e10cSrcweir OutputDevice *pOut = pGlobalShell->GetOut();
5734cdf0e10cSrcweir
5735cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
5736cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
5737cdf0e10cSrcweir // <--
5738cdf0e10cSrcweir
5739cdf0e10cSrcweir // OD 2004-04-23 #116347#
5740cdf0e10cSrcweir pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
5741cdf0e10cSrcweir pOut->SetLineColor();
5742cdf0e10cSrcweir
5743cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this );
5744cdf0e10cSrcweir const SwBorderAttrs &rAttrs = *aAccess.Get();
5745cdf0e10cSrcweir
5746cdf0e10cSrcweir // OD 20.11.2002 #104598# - take care of page margin area
5747cdf0e10cSrcweir // Note: code move from <SwFrm::PaintBackground(..)> to new method
5748cdf0e10cSrcweir // <SwPageFrm::Paintmargin(..)>.
5749cdf0e10cSrcweir if ( IsPageFrm() )
5750cdf0e10cSrcweir {
5751cdf0e10cSrcweir static_cast<const SwPageFrm*>(this)->PaintMarginArea( rRect, pGlobalShell );
5752cdf0e10cSrcweir }
5753cdf0e10cSrcweir
5754cdf0e10cSrcweir // OD 06.08.2002 #99657# - paint border before painting background
5755cdf0e10cSrcweir // paint grid for page frame and paint border
5756cdf0e10cSrcweir {
5757cdf0e10cSrcweir SwRect aRect( rRect );
5758cdf0e10cSrcweir if( IsPageFrm() )
5759cdf0e10cSrcweir ((SwPageFrm*)this)->PaintGrid( pOut, aRect );
5760cdf0e10cSrcweir PaintBorder( aRect, pPage, rAttrs );
5761cdf0e10cSrcweir }
5762cdf0e10cSrcweir
5763cdf0e10cSrcweir // paint background
5764cdf0e10cSrcweir {
5765cdf0e10cSrcweir PaintBackground( rRect, pPage, rAttrs, sal_False, bLowerBorder );
5766cdf0e10cSrcweir }
5767cdf0e10cSrcweir
5768cdf0e10cSrcweir pOut->Pop();
5769cdf0e10cSrcweir }
5770cdf0e10cSrcweir
5771cdf0e10cSrcweir /*************************************************************************
5772cdf0e10cSrcweir |*
5773cdf0e10cSrcweir |* SwFrm::PaintBackground()
5774cdf0e10cSrcweir |*
5775cdf0e10cSrcweir |* Ersterstellung MA 04. Jan. 93
5776cdf0e10cSrcweir |* Letzte Aenderung MA 06. Feb. 97
5777cdf0e10cSrcweir |*
5778cdf0e10cSrcweir |*************************************************************************/
5779cdf0e10cSrcweir /// OD 05.09.2002 #102912#
5780cdf0e10cSrcweir /// Do not paint background for fly frames without a background brush by
5781cdf0e10cSrcweir /// calling <PaintBaBo> at the page or at the fly frame its anchored
PaintBackground(const SwRect & rRect,const SwPageFrm * pPage,const SwBorderAttrs & rAttrs,const sal_Bool bLowerMode,const sal_Bool bLowerBorder) const5782cdf0e10cSrcweir void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
5783cdf0e10cSrcweir const SwBorderAttrs & rAttrs,
5784cdf0e10cSrcweir const sal_Bool bLowerMode,
5785cdf0e10cSrcweir const sal_Bool bLowerBorder ) const
5786cdf0e10cSrcweir {
5787cdf0e10cSrcweir // OD 20.01.2003 #i1837# - no paint of table background, if corresponding
5788cdf0e10cSrcweir // option is *not* set.
5789cdf0e10cSrcweir if( IsTabFrm() &&
5790cdf0e10cSrcweir !pGlobalShell->GetViewOptions()->IsTable() )
5791cdf0e10cSrcweir {
5792cdf0e10cSrcweir return;
5793cdf0e10cSrcweir }
5794cdf0e10cSrcweir
5795cdf0e10cSrcweir // nothing to do for covered table cells:
5796cdf0e10cSrcweir if( IsCellFrm() && IsCoveredCell() )
5797cdf0e10cSrcweir return;
5798cdf0e10cSrcweir
5799cdf0e10cSrcweir ViewShell *pSh = pGlobalShell;
5800cdf0e10cSrcweir
5801cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
5802cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() );
5803cdf0e10cSrcweir // <--
5804cdf0e10cSrcweir
5805cdf0e10cSrcweir const SvxBrushItem* pItem;
5806cdf0e10cSrcweir /// OD 05.09.2002 #102912#
5807cdf0e10cSrcweir /// temporary background brush for a fly frame without a background brush
5808cdf0e10cSrcweir SvxBrushItem* pTmpBackBrush = 0;
5809cdf0e10cSrcweir const Color* pCol;
5810cdf0e10cSrcweir SwRect aOrigBackRect;
5811cdf0e10cSrcweir const sal_Bool bPageFrm = IsPageFrm();
5812cdf0e10cSrcweir sal_Bool bLowMode = sal_True;
5813cdf0e10cSrcweir
581464b14621SArmin Le Grand //UUUU
581556b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
581664b14621SArmin Le Grand
581764b14621SArmin Le Grand sal_Bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode );
581864b14621SArmin Le Grand
5819cdf0e10cSrcweir //- Ausgabe wenn ein eigener Hintergrund mitgebracht wird.
5820cdf0e10cSrcweir bool bNoFlyBackground = !bFlyMetafile && !bBack && IsFlyFrm();
5821cdf0e10cSrcweir if ( bNoFlyBackground )
5822cdf0e10cSrcweir {
5823cdf0e10cSrcweir // OD 05.09.2002 #102912# - Fly frame has no background.
5824cdf0e10cSrcweir // Try to find background brush at parents, if previous call of
5825cdf0e10cSrcweir // <GetBackgroundBrush> disabled this option with the parameter <bLowerMode>
5826cdf0e10cSrcweir if ( bLowerMode )
5827cdf0e10cSrcweir {
582864b14621SArmin Le Grand bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false );
5829cdf0e10cSrcweir }
5830cdf0e10cSrcweir // If still no background found for the fly frame, initialize the
5831cdf0e10cSrcweir // background brush <pItem> with global retouche color and set <bBack>
5832cdf0e10cSrcweir // to sal_True, that fly frame will paint its background using this color.
5833cdf0e10cSrcweir if ( !bBack )
5834cdf0e10cSrcweir {
5835cdf0e10cSrcweir // OD 10.01.2003 #i6467# - on print output, pdf output and
5836cdf0e10cSrcweir // in embedded mode not editing color COL_WHITE is used instead of
5837cdf0e10cSrcweir // the global retouche color.
5838cdf0e10cSrcweir if ( pSh->GetOut()->GetOutDevType() == OUTDEV_PRINTER ||
5839cdf0e10cSrcweir pSh->GetViewOptions()->IsPDFExport() ||
5840cdf0e10cSrcweir ( pSh->GetDoc()->GetDocShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED &&
5841cdf0e10cSrcweir !pSh->GetDoc()->GetDocShell()->IsInPlaceActive()
5842cdf0e10cSrcweir )
5843cdf0e10cSrcweir )
5844cdf0e10cSrcweir {
5845cdf0e10cSrcweir pTmpBackBrush = new SvxBrushItem( Color( COL_WHITE ), RES_BACKGROUND );
584664b14621SArmin Le Grand
584764b14621SArmin Le Grand //UUU
584856b35d86SArmin Le Grand aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(Color( COL_WHITE )));
5849cdf0e10cSrcweir }
5850cdf0e10cSrcweir else
5851cdf0e10cSrcweir {
5852cdf0e10cSrcweir pTmpBackBrush = new SvxBrushItem( aGlobalRetoucheColor, RES_BACKGROUND);
585364b14621SArmin Le Grand
585464b14621SArmin Le Grand //UUU
585556b35d86SArmin Le Grand aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aGlobalRetoucheColor));
5856cdf0e10cSrcweir }
585764b14621SArmin Le Grand
5858cdf0e10cSrcweir pItem = pTmpBackBrush;
5859cdf0e10cSrcweir bBack = true;
5860cdf0e10cSrcweir }
5861cdf0e10cSrcweir }
5862cdf0e10cSrcweir
5863cdf0e10cSrcweir SwRect aPaintRect( Frm() );
5864cdf0e10cSrcweir if( IsTxtFrm() || IsSctFrm() )
5865cdf0e10cSrcweir aPaintRect = UnionFrm( sal_True );
5866cdf0e10cSrcweir
5867cdf0e10cSrcweir if ( aPaintRect.IsOver( rRect ) )
5868cdf0e10cSrcweir {
5869cdf0e10cSrcweir if ( bBack || bPageFrm || !bLowerMode )
5870cdf0e10cSrcweir {
5871cdf0e10cSrcweir const sal_Bool bBrowse = pSh->GetViewOptions()->getBrowseMode();
5872cdf0e10cSrcweir SwRect aRect;
5873cdf0e10cSrcweir if ( (bPageFrm && bBrowse) ||
5874cdf0e10cSrcweir (IsTxtFrm() && Prt().SSize() == Frm().SSize()) )
5875cdf0e10cSrcweir {
5876cdf0e10cSrcweir aRect = Frm();
5877cdf0e10cSrcweir ::SwAlignRect( aRect, pGlobalShell );
5878cdf0e10cSrcweir }
5879cdf0e10cSrcweir else
5880cdf0e10cSrcweir {
5881cdf0e10cSrcweir ::lcl_CalcBorderRect( aRect, this, rAttrs, sal_False );
5882cdf0e10cSrcweir if ( (IsTxtFrm() || IsTabFrm()) && GetPrev() )
5883cdf0e10cSrcweir {
5884cdf0e10cSrcweir if ( GetPrev()->GetAttrSet()->GetBackground() ==
5885cdf0e10cSrcweir GetAttrSet()->GetBackground() )
5886cdf0e10cSrcweir {
5887cdf0e10cSrcweir aRect.Top( Frm().Top() );
5888cdf0e10cSrcweir }
5889cdf0e10cSrcweir }
5890cdf0e10cSrcweir }
5891cdf0e10cSrcweir aRect.Intersection( rRect );
5892cdf0e10cSrcweir
5893cdf0e10cSrcweir OutputDevice *pOut = pSh->GetOut();
5894cdf0e10cSrcweir
5895cdf0e10cSrcweir if ( aRect.HasArea() )
5896cdf0e10cSrcweir {
5897cdf0e10cSrcweir SvxBrushItem* pNewItem = 0;
589864b14621SArmin Le Grand //SwRegionRects aRegion( aRect );
589964b14621SArmin Le Grand
5900cdf0e10cSrcweir if( pCol )
5901cdf0e10cSrcweir {
5902cdf0e10cSrcweir pNewItem = new SvxBrushItem( *pCol, RES_BACKGROUND );
5903cdf0e10cSrcweir pItem = pNewItem;
590464b14621SArmin Le Grand
590564b14621SArmin Le Grand //UUUU
590656b35d86SArmin Le Grand aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pCol));
5907cdf0e10cSrcweir }
590864b14621SArmin Le Grand
590964b14621SArmin Le Grand //if ( pPage->GetSortedObjs() )
591064b14621SArmin Le Grand //{
591164b14621SArmin Le Grand // ::lcl_SubtractFlys( this, pPage, aRect, aRegion );
591264b14621SArmin Le Grand //}
5913cdf0e10cSrcweir
5914cdf0e10cSrcweir {
5915cdf0e10cSrcweir /// OD 06.08.2002 #99657# - determine, if background transparency
5916cdf0e10cSrcweir /// have to be considered for drawing.
5917cdf0e10cSrcweir /// --> Status Quo: background transparency have to be
5918cdf0e10cSrcweir /// considered for fly frames
5919cdf0e10cSrcweir const sal_Bool bConsiderBackgroundTransparency = IsFlyFrm();
592064b14621SArmin Le Grand bool bDone(false);
592164b14621SArmin Le Grand
592209ef3841SArmin Le Grand // #i125189# We are also done when the new DrawingLayer FillAttributes are used
592309ef3841SArmin Le Grand // or the FillStyle is set (different from XFILL_NONE)
592409ef3841SArmin Le Grand if(pOut && aFillAttributes.get())
5925cdf0e10cSrcweir {
592609ef3841SArmin Le Grand if(aFillAttributes->isUsed())
592709ef3841SArmin Le Grand {
592809ef3841SArmin Le Grand // check if really something is painted
592964b14621SArmin Le Grand bDone = DrawFillAttributes(aFillAttributes, aOrigBackRect, aRect, *pOut);
5930cdf0e10cSrcweir }
593164b14621SArmin Le Grand
593264b14621SArmin Le Grand if(!bDone)
593364b14621SArmin Le Grand {
593409ef3841SArmin Le Grand // if not, still a FillStyle could be set but the transparency is at 100%,
593509ef3841SArmin Le Grand // thus need to check the model data itself for FillStyle (do not rely on
593609ef3841SArmin Le Grand // SdrAllFillAttributesHelper since it already contains optimized information,
593709ef3841SArmin Le Grand // e.g. transparency leads to no fill)
593809ef3841SArmin Le Grand const XFillStyle eFillStyle(static_cast< const XFillStyleItem& >(GetAttrSet()->Get(XATTR_FILLSTYLE)).GetValue());
593909ef3841SArmin Le Grand
594009ef3841SArmin Le Grand if(XFILL_NONE != eFillStyle)
594109ef3841SArmin Le Grand {
594209ef3841SArmin Le Grand bDone = true;
594309ef3841SArmin Le Grand }
594409ef3841SArmin Le Grand }
594509ef3841SArmin Le Grand }
594609ef3841SArmin Le Grand
594709ef3841SArmin Le Grand if(!bDone)
594809ef3841SArmin Le Grand {
594964b14621SArmin Le Grand //for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
595064b14621SArmin Le Grand //{
595164b14621SArmin Le Grand // if ( 1 < aRegion.Count() )
595264b14621SArmin Le Grand // {
595364b14621SArmin Le Grand // ::SwAlignRect( aRegion[i], pGlobalShell );
595464b14621SArmin Le Grand // if( !aRegion[i].HasArea() )
595564b14621SArmin Le Grand // continue;
595664b14621SArmin Le Grand // }
5957cdf0e10cSrcweir /// OD 06.08.2002 #99657# - add 6th parameter to indicate, if
5958cdf0e10cSrcweir /// background transparency have to be considered
5959cdf0e10cSrcweir /// Set missing 5th parameter to the default value GRFNUM_NO
5960cdf0e10cSrcweir /// - see declaration in /core/inc/frmtool.hxx.
596164b14621SArmin Le Grand ::DrawGraphic(
596264b14621SArmin Le Grand pItem,
596364b14621SArmin Le Grand pOut,
596464b14621SArmin Le Grand aOrigBackRect,
596564b14621SArmin Le Grand aRect, // aRegion[i],
596664b14621SArmin Le Grand GRFNUM_NO,
5967cdf0e10cSrcweir bConsiderBackgroundTransparency );
596864b14621SArmin Le Grand //}
5969cdf0e10cSrcweir }
5970cdf0e10cSrcweir }
5971cdf0e10cSrcweir if( pCol )
5972cdf0e10cSrcweir delete pNewItem;
5973cdf0e10cSrcweir }
5974cdf0e10cSrcweir }
5975cdf0e10cSrcweir else
5976cdf0e10cSrcweir bLowMode = bLowerMode ? sal_True : sal_False;
5977cdf0e10cSrcweir }
5978cdf0e10cSrcweir
5979cdf0e10cSrcweir /// OD 05.09.2002 #102912#
5980cdf0e10cSrcweir /// delete temporary background brush.
5981cdf0e10cSrcweir delete pTmpBackBrush;
5982cdf0e10cSrcweir
5983cdf0e10cSrcweir //Jetzt noch Lower und dessen Nachbarn.
5984ad095790Smseidel //Wenn ein Frm dabei die Kette verlaesst also nicht mehr Lower von mir ist
5985cdf0e10cSrcweir //so hoert der Spass auf.
5986cdf0e10cSrcweir const SwFrm *pFrm = GetLower();
5987cdf0e10cSrcweir if ( pFrm )
5988cdf0e10cSrcweir {
5989cdf0e10cSrcweir SwRect aFrmRect;
5990cdf0e10cSrcweir SwRect aRect( PaintArea() );
5991cdf0e10cSrcweir aRect._Intersection( rRect );
5992cdf0e10cSrcweir SwRect aBorderRect( aRect );
5993cdf0e10cSrcweir SwShortCut aShortCut( *pFrm, aBorderRect );
5994cdf0e10cSrcweir do
5995cdf0e10cSrcweir { if ( pProgress )
5996cdf0e10cSrcweir pProgress->Reschedule();
5997cdf0e10cSrcweir
5998cdf0e10cSrcweir aFrmRect = pFrm->PaintArea();
5999cdf0e10cSrcweir if ( aFrmRect.IsOver( aBorderRect ) )
6000cdf0e10cSrcweir {
6001cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFrm );
6002cdf0e10cSrcweir const SwBorderAttrs &rTmpAttrs = *aAccess.Get();
6003cdf0e10cSrcweir /// OD 06.08.2002 #99657# - paint border before painting background
6004cdf0e10cSrcweir if ( bLowerBorder )
6005cdf0e10cSrcweir pFrm->PaintBorder( aBorderRect, pPage, rTmpAttrs );
6006cdf0e10cSrcweir if ( ( pFrm->IsLayoutFrm() && bLowerBorder ) ||
6007cdf0e10cSrcweir aFrmRect.IsOver( aRect ) )
6008cdf0e10cSrcweir pFrm->PaintBackground( aRect, pPage, rTmpAttrs, bLowMode,
6009cdf0e10cSrcweir bLowerBorder );
6010cdf0e10cSrcweir }
6011cdf0e10cSrcweir pFrm = pFrm->GetNext();
6012cdf0e10cSrcweir } while ( pFrm && pFrm->GetUpper() == this &&
6013cdf0e10cSrcweir !aShortCut.Stop( aFrmRect ) );
6014cdf0e10cSrcweir }
6015cdf0e10cSrcweir }
6016cdf0e10cSrcweir
6017cdf0e10cSrcweir /*************************************************************************
6018cdf0e10cSrcweir |*
6019cdf0e10cSrcweir |* SwPageFrm::RefreshSubsidiary()
6020cdf0e10cSrcweir |*
6021cdf0e10cSrcweir |* Beschreibung Erneuert alle Hilfslinien der Seite.
6022cdf0e10cSrcweir |* Ersterstellung MA 04. Nov. 92
6023cdf0e10cSrcweir |* Letzte Aenderung MA 10. May. 95
6024cdf0e10cSrcweir |*
6025cdf0e10cSrcweir |*************************************************************************/
6026cdf0e10cSrcweir
RefreshSubsidiary(const SwRect & rRect) const6027cdf0e10cSrcweir void SwPageFrm::RefreshSubsidiary( const SwRect &rRect ) const
6028cdf0e10cSrcweir {
6029cdf0e10cSrcweir if ( IS_SUBS || IS_SUBS_TABLE || IS_SUBS_SECTION || IS_SUBS_FLYS )
6030cdf0e10cSrcweir {
6031cdf0e10cSrcweir SwRect aRect( rRect );
6032cdf0e10cSrcweir // OD 18.02.2003 #104989# - Not necessary and incorrect alignment of
6033cdf0e10cSrcweir // the output rectangle.
6034cdf0e10cSrcweir //::SwAlignRect( aRect, pGlobalShell );
6035cdf0e10cSrcweir if ( aRect.HasArea() )
6036cdf0e10cSrcweir {
6037cdf0e10cSrcweir //Beim Paint ueber die Root wird das Array von dort gesteuert.
6038cdf0e10cSrcweir //Anderfalls kuemmern wir uns selbst darum.
6039cdf0e10cSrcweir sal_Bool bDelSubs = sal_False;
6040cdf0e10cSrcweir if ( !pSubsLines )
6041cdf0e10cSrcweir {
6042cdf0e10cSrcweir pSubsLines = new SwSubsRects;
6043cdf0e10cSrcweir // OD 20.12.2002 #106318# - create container for special subsidiary lines
6044cdf0e10cSrcweir pSpecSubsLines = new SwSubsRects;
6045cdf0e10cSrcweir bDelSubs = sal_True;
6046cdf0e10cSrcweir }
6047cdf0e10cSrcweir
6048cdf0e10cSrcweir RefreshLaySubsidiary( this, aRect );
6049cdf0e10cSrcweir
6050cdf0e10cSrcweir if ( bDelSubs )
6051cdf0e10cSrcweir {
6052cdf0e10cSrcweir // OD 20.12.2002 #106318# - paint special subsidiary lines
6053cdf0e10cSrcweir // and delete its container
6054cdf0e10cSrcweir pSpecSubsLines->PaintSubsidiary( pGlobalShell->GetOut(), NULL );
6055cdf0e10cSrcweir DELETEZ( pSpecSubsLines );
6056cdf0e10cSrcweir
6057cdf0e10cSrcweir pSubsLines->PaintSubsidiary( pGlobalShell->GetOut(), pLines );
6058cdf0e10cSrcweir DELETEZ( pSubsLines );
6059cdf0e10cSrcweir }
6060cdf0e10cSrcweir }
6061cdf0e10cSrcweir }
6062cdf0e10cSrcweir }
6063cdf0e10cSrcweir
6064cdf0e10cSrcweir /*************************************************************************
6065cdf0e10cSrcweir |*
6066cdf0e10cSrcweir |* SwLayoutFrm::RefreshLaySubsidiary()
6067cdf0e10cSrcweir |*
6068cdf0e10cSrcweir |* Ersterstellung MA 04. Nov. 92
6069cdf0e10cSrcweir |* Letzte Aenderung MA 22. Jan. 95
6070cdf0e10cSrcweir |*
6071cdf0e10cSrcweir |*************************************************************************/
RefreshLaySubsidiary(const SwPageFrm * pPage,const SwRect & rRect) const6072cdf0e10cSrcweir void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage,
6073cdf0e10cSrcweir const SwRect &rRect ) const
6074cdf0e10cSrcweir {
6075cdf0e10cSrcweir const sal_Bool bNoLowerColumn = !Lower() || !Lower()->IsColumnFrm();
6076cdf0e10cSrcweir const sal_Bool bSubsOpt = IS_SUBS;
6077cdf0e10cSrcweir const sal_Bool bSubsTable = ((GetType() & (FRM_ROW | FRM_CELL)) && IS_SUBS_TABLE);
6078cdf0e10cSrcweir const sal_Bool bSubsOther = (GetType() & (FRM_HEADER | FRM_FOOTER | FRM_FTN )) && bSubsOpt;
6079cdf0e10cSrcweir const sal_Bool bSubsSect = IsSctFrm() &&
6080cdf0e10cSrcweir bNoLowerColumn &&
6081cdf0e10cSrcweir IS_SUBS_SECTION;
6082cdf0e10cSrcweir const sal_Bool bSubsFly = IS_SUBS_FLYS &&
6083cdf0e10cSrcweir (GetType() & FRM_FLY) &&
6084cdf0e10cSrcweir bNoLowerColumn &&
6085cdf0e10cSrcweir (!Lower() || !Lower()->IsNoTxtFrm() ||
6086cdf0e10cSrcweir !((SwNoTxtFrm*)Lower())->HasAnimation());
6087cdf0e10cSrcweir sal_Bool bSubsBody = sal_False;
6088cdf0e10cSrcweir if ( GetType() & FRM_BODY )
6089cdf0e10cSrcweir {
6090cdf0e10cSrcweir if ( IsPageBodyFrm() )
6091cdf0e10cSrcweir bSubsBody = bSubsOpt && bNoLowerColumn; //nur ohne Spalten
6092cdf0e10cSrcweir else //Spaltenbody
6093cdf0e10cSrcweir {
6094cdf0e10cSrcweir if ( GetUpper()->GetUpper()->IsSctFrm() )
6095cdf0e10cSrcweir bSubsBody = IS_SUBS_SECTION;
6096cdf0e10cSrcweir else
6097cdf0e10cSrcweir bSubsBody = bSubsOpt;
6098cdf0e10cSrcweir }
6099cdf0e10cSrcweir }
6100cdf0e10cSrcweir
6101cdf0e10cSrcweir if ( bSubsOther || bSubsSect || bSubsBody || bSubsTable || bSubsFly )
6102cdf0e10cSrcweir PaintSubsidiaryLines( pPage, rRect );
6103cdf0e10cSrcweir
6104cdf0e10cSrcweir const SwFrm *pLow = Lower();
6105cdf0e10cSrcweir if( !pLow )
6106cdf0e10cSrcweir return;
6107cdf0e10cSrcweir SwShortCut aShortCut( *pLow, rRect );
6108cdf0e10cSrcweir while( pLow && !aShortCut.Stop( pLow->Frm() ) )
6109cdf0e10cSrcweir {
6110cdf0e10cSrcweir if ( pLow->Frm().IsOver( rRect ) && pLow->Frm().HasArea() )
6111cdf0e10cSrcweir {
6112cdf0e10cSrcweir if ( pLow->IsLayoutFrm() )
6113cdf0e10cSrcweir ((const SwLayoutFrm*)pLow)->RefreshLaySubsidiary( pPage, rRect);
6114cdf0e10cSrcweir else if ( pLow->GetDrawObjs() )
6115cdf0e10cSrcweir {
6116cdf0e10cSrcweir const SwSortedObjs& rObjs = *(pLow->GetDrawObjs());
6117cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < rObjs.Count(); ++i )
6118cdf0e10cSrcweir {
6119cdf0e10cSrcweir const SwAnchoredObject* pAnchoredObj = rObjs[i];
6120cdf0e10cSrcweir if ( pPage->GetFmt()->GetDoc()->IsVisibleLayerId(
6121cdf0e10cSrcweir pAnchoredObj->GetDrawObj()->GetLayer() ) &&
6122cdf0e10cSrcweir pAnchoredObj->ISA(SwFlyFrm) )
6123cdf0e10cSrcweir {
6124cdf0e10cSrcweir const SwFlyFrm *pFly =
6125cdf0e10cSrcweir static_cast<const SwFlyFrm*>(pAnchoredObj);
6126cdf0e10cSrcweir if ( pFly->IsFlyInCntFrm() && pFly->Frm().IsOver( rRect ) )
6127cdf0e10cSrcweir {
6128cdf0e10cSrcweir if ( !pFly->Lower() || !pFly->Lower()->IsNoTxtFrm() ||
6129cdf0e10cSrcweir !((SwNoTxtFrm*)pFly->Lower())->HasAnimation())
6130cdf0e10cSrcweir pFly->RefreshLaySubsidiary( pPage, rRect );
6131cdf0e10cSrcweir }
6132cdf0e10cSrcweir }
6133cdf0e10cSrcweir }
6134cdf0e10cSrcweir }
6135cdf0e10cSrcweir }
6136cdf0e10cSrcweir pLow = pLow->GetNext();
6137cdf0e10cSrcweir }
6138cdf0e10cSrcweir }
6139cdf0e10cSrcweir
6140cdf0e10cSrcweir /*************************************************************************
6141cdf0e10cSrcweir |*
6142cdf0e10cSrcweir |* SwLayoutFrm::PaintSubsidiaryLines()
6143cdf0e10cSrcweir |*
6144cdf0e10cSrcweir |* Beschreibung Hilfslinien um die PrtAreas malen
6145cdf0e10cSrcweir |* Nur die LayoutFrm's die direkt Cntnt enthalten.
6146cdf0e10cSrcweir |* Ersterstellung MA 21. May. 92
6147cdf0e10cSrcweir |* Letzte Aenderung MA 22. Jan. 95
6148cdf0e10cSrcweir |*
6149cdf0e10cSrcweir |*************************************************************************/
6150cdf0e10cSrcweir
6151cdf0e10cSrcweir //Malt die angegebene Linie, achtet darauf, dass keine Flys uebermalt werden.
6152cdf0e10cSrcweir
6153cdf0e10cSrcweir typedef long Size::* SizePtr;
6154cdf0e10cSrcweir typedef long Point::* PointPtr;
6155cdf0e10cSrcweir
6156cdf0e10cSrcweir PointPtr pX = &Point::nA;
6157cdf0e10cSrcweir PointPtr pY = &Point::nB;
6158cdf0e10cSrcweir SizePtr pWidth = &Size::nA;
6159cdf0e10cSrcweir SizePtr pHeight = &Size::nB;
6160cdf0e10cSrcweir
6161cdf0e10cSrcweir // OD 18.11.2002 #99672# - new parameter <_pSubsLines>
lcl_RefreshLine(const SwLayoutFrm * pLay,const SwPageFrm * pPage,const Point & rP1,const Point & rP2,const sal_uInt8 nSubColor,SwLineRects * _pSubsLines)6162cdf0e10cSrcweir void MA_FASTCALL lcl_RefreshLine( const SwLayoutFrm *pLay,
6163cdf0e10cSrcweir const SwPageFrm *pPage,
6164cdf0e10cSrcweir const Point &rP1,
6165cdf0e10cSrcweir const Point &rP2,
6166cdf0e10cSrcweir const sal_uInt8 nSubColor,
6167cdf0e10cSrcweir SwLineRects* _pSubsLines )
6168cdf0e10cSrcweir {
6169cdf0e10cSrcweir //In welche Richtung gehts? Kann nur Horizontal oder Vertikal sein.
6170cdf0e10cSrcweir ASSERT( ((rP1.X() == rP2.X()) || (rP1.Y() == rP2.Y())),
6171cdf0e10cSrcweir "Schraege Hilfslinien sind nicht erlaubt." );
6172cdf0e10cSrcweir const PointPtr pDirPt = rP1.X() == rP2.X() ? pY : pX;
6173cdf0e10cSrcweir const PointPtr pOthPt = pDirPt == pX ? pY : pX;
6174cdf0e10cSrcweir const SizePtr pDirSz = pDirPt == pX ? pWidth : pHeight;
6175cdf0e10cSrcweir const SizePtr pOthSz = pDirSz == pWidth ? pHeight : pWidth;
6176cdf0e10cSrcweir Point aP1( rP1 ),
6177cdf0e10cSrcweir aP2( rP2 );
6178cdf0e10cSrcweir
6179cdf0e10cSrcweir while ( aP1.*pDirPt < aP2.*pDirPt )
6180cdf0e10cSrcweir { //Der Startpunkt wird jetzt, falls er in einem Fly sitzt, direkt
6181cdf0e10cSrcweir //hinter den Fly gesetzt.
6182cdf0e10cSrcweir //Wenn der Endpunkt in einem Fly sitzt oder zwischen Start und Endpunkt
6183cdf0e10cSrcweir //ein Fly sitzt, so wird der Endpunkt eben an den Start herangezogen.
6184307b55caSmseidel //Auf diese Art und Weise wird eine Portion nach der anderen
6185cdf0e10cSrcweir //ausgegeben.
6186cdf0e10cSrcweir
6187cdf0e10cSrcweir //Wenn ich selbst ein Fly bin, weiche ich nur denjenigen Flys aus,
6188cdf0e10cSrcweir //die 'ueber' mir sitzen; d.h. die in dem Array hinter mir stehen.
6189cdf0e10cSrcweir //Auch wenn ich in einem Fly sitze oder in einem Fly im Fly usw. weiche
6190cdf0e10cSrcweir //ich keinem dieser Flys aus.
6191cdf0e10cSrcweir SwOrderIter aIter( pPage );
6192cdf0e10cSrcweir const SwFlyFrm *pMyFly = pLay->FindFlyFrm();
6193cdf0e10cSrcweir if ( pMyFly )
6194cdf0e10cSrcweir {
6195cdf0e10cSrcweir aIter.Current( pMyFly->GetVirtDrawObj() );
6196cdf0e10cSrcweir while ( 0 != (pMyFly = pMyFly->GetAnchorFrm()->FindFlyFrm()) )
6197cdf0e10cSrcweir {
6198cdf0e10cSrcweir if ( aIter()->GetOrdNum() > pMyFly->GetVirtDrawObj()->GetOrdNum() )
6199cdf0e10cSrcweir aIter.Current( pMyFly->GetVirtDrawObj() );
6200cdf0e10cSrcweir }
6201cdf0e10cSrcweir }
6202cdf0e10cSrcweir else
6203cdf0e10cSrcweir aIter.Bottom();
6204cdf0e10cSrcweir
6205cdf0e10cSrcweir while ( aIter() )
6206cdf0e10cSrcweir {
6207cdf0e10cSrcweir const SwVirtFlyDrawObj *pObj = (SwVirtFlyDrawObj*)aIter();
6208cdf0e10cSrcweir const SwFlyFrm *pFly = pObj ? pObj->GetFlyFrm() : 0;
6209cdf0e10cSrcweir
6210cdf0e10cSrcweir //Mir selbst weiche ich natuerlich nicht aus. Auch wenn ich
6211cdf0e10cSrcweir //_in_ dem Fly sitze weiche ich nicht aus.
6212cdf0e10cSrcweir if ( !pFly || (pFly == pLay || pFly->IsAnLower( pLay )) )
6213cdf0e10cSrcweir {
6214cdf0e10cSrcweir aIter.Next();
6215cdf0e10cSrcweir continue;
6216cdf0e10cSrcweir }
6217cdf0e10cSrcweir
6218cdf0e10cSrcweir // OD 19.12.2002 #106318# - do *not* consider fly frames with
6219cdf0e10cSrcweir // a transparent background.
6220cdf0e10cSrcweir // OD 2004-02-12 #110582#-2 - do *not* consider fly frame, which
6221cdf0e10cSrcweir // belongs to a invisible layer
6222cdf0e10cSrcweir if ( pFly->IsBackgroundTransparent() ||
6223cdf0e10cSrcweir !pFly->GetFmt()->GetDoc()->IsVisibleLayerId( pObj->GetLayer() ) )
6224cdf0e10cSrcweir {
6225cdf0e10cSrcweir aIter.Next();
6226cdf0e10cSrcweir continue;
6227cdf0e10cSrcweir }
6228cdf0e10cSrcweir
6229cdf0e10cSrcweir //Sitzt das Obj auf der Linie
6230cdf0e10cSrcweir const Rectangle &rBound = pObj->GetCurrentBoundRect();
6231cdf0e10cSrcweir const Point aDrPt( rBound.TopLeft() );
6232cdf0e10cSrcweir const Size aDrSz( rBound.GetSize() );
6233cdf0e10cSrcweir if ( rP1.*pOthPt >= aDrPt.*pOthPt &&
6234cdf0e10cSrcweir rP1.*pOthPt <= (aDrPt.*pOthPt + aDrSz.*pOthSz) )
6235cdf0e10cSrcweir {
6236cdf0e10cSrcweir if ( aP1.*pDirPt >= aDrPt.*pDirPt &&
6237cdf0e10cSrcweir aP1.*pDirPt <= (aDrPt.*pDirPt + aDrSz.*pDirSz) )
6238cdf0e10cSrcweir aP1.*pDirPt = aDrPt.*pDirPt + aDrSz.*pDirSz;
6239cdf0e10cSrcweir
6240cdf0e10cSrcweir if ( aP2.*pDirPt >= aDrPt.*pDirPt &&
6241cdf0e10cSrcweir aP1.*pDirPt < (aDrPt.*pDirPt - 1) )
6242cdf0e10cSrcweir aP2.*pDirPt = aDrPt.*pDirPt - 1;
6243cdf0e10cSrcweir }
6244cdf0e10cSrcweir aIter.Next();
6245cdf0e10cSrcweir }
6246cdf0e10cSrcweir
6247cdf0e10cSrcweir if ( aP1.*pDirPt < aP2.*pDirPt )
6248cdf0e10cSrcweir {
6249cdf0e10cSrcweir SwRect aRect( aP1, aP2 );
6250cdf0e10cSrcweir // OD 18.11.2002 #99672# - use parameter <_pSubsLines> instead of
6251cdf0e10cSrcweir // global variable <pSubsLines>.
6252cdf0e10cSrcweir _pSubsLines->AddLineRect( aRect, 0, 0, nSubColor );
6253cdf0e10cSrcweir }
6254cdf0e10cSrcweir aP1 = aP2;
6255cdf0e10cSrcweir aP1.*pDirPt += 1;
6256cdf0e10cSrcweir aP2 = rP2;
6257cdf0e10cSrcweir }
6258cdf0e10cSrcweir }
6259cdf0e10cSrcweir
PaintSubsidiaryLines(const SwPageFrm * pPage,const SwRect & rRect) const6260cdf0e10cSrcweir void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage,
6261cdf0e10cSrcweir const SwRect &rRect ) const
6262cdf0e10cSrcweir {
6263cdf0e10cSrcweir bool bNewTableModel = false;
6264cdf0e10cSrcweir
6265cdf0e10cSrcweir // --> collapsing borders FME 2005-05-27 #i29550#
6266cdf0e10cSrcweir if ( IsTabFrm() || IsCellFrm() || IsRowFrm() )
6267cdf0e10cSrcweir {
6268cdf0e10cSrcweir const SwTabFrm* pTabFrm = FindTabFrm();
6269cdf0e10cSrcweir if ( pTabFrm->IsCollapsingBorders() )
6270cdf0e10cSrcweir return;
6271cdf0e10cSrcweir
6272cdf0e10cSrcweir bNewTableModel = pTabFrm->GetTable()->IsNewModel();
6273cdf0e10cSrcweir // in the new table model, we have an early return for all cell-related
6274cdf0e10cSrcweir // frames, except from non-covered table cells
6275cdf0e10cSrcweir if ( bNewTableModel )
6276cdf0e10cSrcweir if ( IsTabFrm() ||
6277cdf0e10cSrcweir IsRowFrm() ||
6278cdf0e10cSrcweir ( IsCellFrm() && IsCoveredCell() ) )
6279cdf0e10cSrcweir return;
6280cdf0e10cSrcweir }
6281cdf0e10cSrcweir // <-- collapsing
6282cdf0e10cSrcweir
6283cdf0e10cSrcweir const bool bFlys = pPage->GetSortedObjs() ? true : false;
6284cdf0e10cSrcweir
6285cdf0e10cSrcweir const bool bCell = IsCellFrm() ? true : false;
6286cdf0e10cSrcweir // use frame area for cells
6287cdf0e10cSrcweir // OD 13.02.2003 #i3662# - for section use also frame area
6288cdf0e10cSrcweir const bool bUseFrmArea = bCell || IsSctFrm();
6289cdf0e10cSrcweir SwRect aOriginal( bUseFrmArea ? Frm() : Prt() );
6290cdf0e10cSrcweir if ( !bUseFrmArea )
6291cdf0e10cSrcweir aOriginal.Pos() += Frm().Pos();
6292cdf0e10cSrcweir
6293cdf0e10cSrcweir // OD 13.02.2003 #i3662# - enlarge top of column body frame's printing area
6294cdf0e10cSrcweir // in sections to top of section frame.
6295cdf0e10cSrcweir const bool bColBodyInSection = IsBodyFrm() &&
6296cdf0e10cSrcweir !IsPageBodyFrm() &&
6297cdf0e10cSrcweir GetUpper()->GetUpper()->IsSctFrm();
6298cdf0e10cSrcweir if ( bColBodyInSection )
6299cdf0e10cSrcweir {
6300cdf0e10cSrcweir if ( IsVertical() )
6301cdf0e10cSrcweir aOriginal.Right( GetUpper()->GetUpper()->Frm().Right() );
6302cdf0e10cSrcweir else
6303cdf0e10cSrcweir aOriginal.Top( GetUpper()->GetUpper()->Frm().Top() );
6304cdf0e10cSrcweir }
6305cdf0e10cSrcweir
6306cdf0e10cSrcweir ::SwAlignRect( aOriginal, pGlobalShell );
6307cdf0e10cSrcweir
6308cdf0e10cSrcweir if ( !aOriginal.IsOver( rRect ) )
6309cdf0e10cSrcweir return;
6310cdf0e10cSrcweir
6311cdf0e10cSrcweir SwRect aOut( aOriginal );
6312cdf0e10cSrcweir aOut._Intersection( rRect );
6313cdf0e10cSrcweir // OD 13.02.2003 #i3662# - do not intersect *enlarged* column body frame's
6314cdf0e10cSrcweir // printing area with the paint area of the body frame. Otherwise enlargement
6315cdf0e10cSrcweir // will get lost.
6316cdf0e10cSrcweir if ( !bColBodyInSection )
6317cdf0e10cSrcweir {
6318cdf0e10cSrcweir aOut.Intersection( PaintArea() );
6319cdf0e10cSrcweir }
6320cdf0e10cSrcweir
6321cdf0e10cSrcweir const SwTwips nRight = aOut.Right();
6322cdf0e10cSrcweir const SwTwips nBottom= aOut.Bottom();
6323cdf0e10cSrcweir
6324cdf0e10cSrcweir const Point aRT( nRight, aOut.Top() );
6325cdf0e10cSrcweir const Point aRB( nRight, nBottom );
6326cdf0e10cSrcweir const Point aLB( aOut.Left(), nBottom );
6327cdf0e10cSrcweir
6328cdf0e10cSrcweir sal_uInt8 nSubColor = ( bCell || IsRowFrm() ) ? SUBCOL_TAB :
6329cdf0e10cSrcweir ( IsInSct() ? SUBCOL_SECT :
6330cdf0e10cSrcweir ( IsInFly() ? SUBCOL_FLY : SUBCOL_PAGE ) );
6331cdf0e10cSrcweir
6332cdf0e10cSrcweir // OD 05.11.2002 #102406# - body frames are responsible for page/column breaks.
6333cdf0e10cSrcweir sal_Bool bBreak = sal_False;
6334cdf0e10cSrcweir if ( IsBodyFrm() )
6335cdf0e10cSrcweir {
6336cdf0e10cSrcweir const SwCntntFrm *pCnt = ContainsCntnt();
6337cdf0e10cSrcweir if ( pCnt )
6338cdf0e10cSrcweir {
6339cdf0e10cSrcweir // OD 05.11.2002 #102406# - adjust setting of <bBreak>.
6340cdf0e10cSrcweir bBreak = pCnt->IsPageBreak( sal_True ) ||
6341cdf0e10cSrcweir ( IsColBodyFrm() && pCnt->IsColBreak( sal_True ) );
6342cdf0e10cSrcweir }
6343cdf0e10cSrcweir }
6344cdf0e10cSrcweir
6345cdf0e10cSrcweir // OD 18.11.2002 #99672# - collect body, header, footer, footnote and section
6346cdf0e10cSrcweir // sub-lines in <pSpecSubsLine> array.
6347cdf0e10cSrcweir const bool bSpecialSublines = IsBodyFrm() || IsHeaderFrm() || IsFooterFrm() ||
6348cdf0e10cSrcweir IsFtnFrm() || IsSctFrm();
6349cdf0e10cSrcweir SwLineRects* pUsedSubsLines = bSpecialSublines ? pSpecSubsLines : pSubsLines;
6350cdf0e10cSrcweir
6351cdf0e10cSrcweir // NOTE: for cell frames only left and right (horizontal layout) respectively
6352cdf0e10cSrcweir // top and bottom (vertical layout) lines painted.
6353cdf0e10cSrcweir // NOTE2: this does not hold for the new table model!!! We paint the top border
6354cdf0e10cSrcweir // of each non-covered table cell.
6355cdf0e10cSrcweir const bool bVert = IsVertical() ? true : false;
6356cdf0e10cSrcweir if ( bFlys )
6357cdf0e10cSrcweir {
6358cdf0e10cSrcweir // OD 14.11.2002 #104822# - add control for drawing left and right lines
6359cdf0e10cSrcweir if ( !bCell || bNewTableModel || !bVert )
6360cdf0e10cSrcweir {
6361cdf0e10cSrcweir if ( aOriginal.Left() == aOut.Left() )
6362cdf0e10cSrcweir ::lcl_RefreshLine( this, pPage, aOut.Pos(), aLB, nSubColor,
6363cdf0e10cSrcweir pUsedSubsLines );
6364cdf0e10cSrcweir // OD 14.11.2002 #104821# - in vertical layout set page/column break at right
6365cdf0e10cSrcweir if ( aOriginal.Right() == nRight )
6366cdf0e10cSrcweir ::lcl_RefreshLine( this, pPage, aRT, aRB,
6367cdf0e10cSrcweir (bBreak && bVert) ? SUBCOL_BREAK : nSubColor,
6368cdf0e10cSrcweir pUsedSubsLines );
6369cdf0e10cSrcweir }
6370cdf0e10cSrcweir // OD 14.11.2002 #104822# - adjust control for drawing top and bottom lines
6371cdf0e10cSrcweir if ( !bCell || bNewTableModel || bVert )
6372cdf0e10cSrcweir {
6373cdf0e10cSrcweir if ( aOriginal.Top() == aOut.Top() )
6374cdf0e10cSrcweir // OD 14.11.2002 #104821# - in horizontal layout set page/column break at top
6375cdf0e10cSrcweir ::lcl_RefreshLine( this, pPage, aOut.Pos(), aRT,
6376cdf0e10cSrcweir (bBreak && !bVert) ? SUBCOL_BREAK : nSubColor,
6377cdf0e10cSrcweir pUsedSubsLines );
6378cdf0e10cSrcweir if ( aOriginal.Bottom() == nBottom )
6379cdf0e10cSrcweir ::lcl_RefreshLine( this, pPage, aLB, aRB, nSubColor,
6380cdf0e10cSrcweir pUsedSubsLines );
6381cdf0e10cSrcweir }
6382cdf0e10cSrcweir }
6383cdf0e10cSrcweir else
6384cdf0e10cSrcweir {
6385cdf0e10cSrcweir // OD 14.11.2002 #104822# - add control for drawing left and right lines
6386cdf0e10cSrcweir if ( !bCell || bNewTableModel || !bVert )
6387cdf0e10cSrcweir {
6388cdf0e10cSrcweir if ( aOriginal.Left() == aOut.Left() )
6389cdf0e10cSrcweir {
6390cdf0e10cSrcweir const SwRect aRect( aOut.Pos(), aLB );
6391cdf0e10cSrcweir pUsedSubsLines->AddLineRect( aRect, 0, 0, nSubColor );
6392cdf0e10cSrcweir }
6393cdf0e10cSrcweir // OD 14.11.2002 #104821# - in vertical layout set page/column break at right
6394cdf0e10cSrcweir if ( aOriginal.Right() == nRight )
6395cdf0e10cSrcweir {
6396cdf0e10cSrcweir const SwRect aRect( aRT, aRB );
6397cdf0e10cSrcweir pUsedSubsLines->AddLineRect( aRect, 0, 0,
6398cdf0e10cSrcweir (bBreak && bVert) ? SUBCOL_BREAK : nSubColor );
6399cdf0e10cSrcweir }
6400cdf0e10cSrcweir }
6401cdf0e10cSrcweir // OD 14.11.2002 #104822# - adjust control for drawing top and bottom lines
6402cdf0e10cSrcweir if ( !bCell || bNewTableModel || bVert )
6403cdf0e10cSrcweir {
6404cdf0e10cSrcweir if ( aOriginal.Top() == aOut.Top() )
6405cdf0e10cSrcweir {
6406cdf0e10cSrcweir // OD 14.11.2002 #104821# - in horizontal layout set page/column break at top
6407cdf0e10cSrcweir const SwRect aRect( aOut.Pos(), aRT );
6408cdf0e10cSrcweir pUsedSubsLines->AddLineRect( aRect, 0, 0,
6409cdf0e10cSrcweir (bBreak && !bVert) ? SUBCOL_BREAK : nSubColor );
6410cdf0e10cSrcweir }
6411cdf0e10cSrcweir if ( aOriginal.Bottom() == nBottom )
6412cdf0e10cSrcweir {
6413cdf0e10cSrcweir const SwRect aRect( aLB, aRB );
6414cdf0e10cSrcweir pUsedSubsLines->AddLineRect( aRect, 0, 0, nSubColor );
6415cdf0e10cSrcweir }
6416cdf0e10cSrcweir }
6417cdf0e10cSrcweir }
6418cdf0e10cSrcweir }
6419cdf0e10cSrcweir
6420cdf0e10cSrcweir /*************************************************************************
6421cdf0e10cSrcweir |*
6422cdf0e10cSrcweir |* SwPageFrm::RefreshExtraData(), SwLayoutFrm::RefreshExtraData()
6423cdf0e10cSrcweir |*
6424cdf0e10cSrcweir |* Beschreibung Erneuert alle Extradaten (Zeilennummern usw) der Seite.
6425cdf0e10cSrcweir |* Grundsaetzlich sind nur diejenigen Objekte beruecksichtig,
6426cdf0e10cSrcweir |* die in die seitliche Ausdehnung des Rects ragen.
6427cdf0e10cSrcweir |* Ersterstellung MA 20. Jan. 98
6428cdf0e10cSrcweir |* Letzte Aenderung MA 18. Feb. 98
6429cdf0e10cSrcweir |*
6430cdf0e10cSrcweir |*************************************************************************/
6431cdf0e10cSrcweir
RefreshExtraData(const SwRect & rRect) const6432cdf0e10cSrcweir void SwPageFrm::RefreshExtraData( const SwRect &rRect ) const
6433cdf0e10cSrcweir {
6434cdf0e10cSrcweir const SwLineNumberInfo &rInfo = GetFmt()->GetDoc()->GetLineNumberInfo();
6435cdf0e10cSrcweir sal_Bool bLineInFly = (rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys())
6436cdf0e10cSrcweir || (sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE;
6437cdf0e10cSrcweir
6438cdf0e10cSrcweir SwRect aRect( rRect );
6439cdf0e10cSrcweir ::SwAlignRect( aRect, pGlobalShell );
6440cdf0e10cSrcweir if ( aRect.HasArea() )
6441cdf0e10cSrcweir {
6442cdf0e10cSrcweir SwLayoutFrm::RefreshExtraData( aRect );
6443cdf0e10cSrcweir
6444cdf0e10cSrcweir if ( bLineInFly && GetSortedObjs() )
6445cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < GetSortedObjs()->Count(); ++i )
6446cdf0e10cSrcweir {
6447cdf0e10cSrcweir const SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i];
6448cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
6449cdf0e10cSrcweir {
6450cdf0e10cSrcweir const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
6451cdf0e10cSrcweir if ( pFly->Frm().Top() <= aRect.Bottom() &&
6452cdf0e10cSrcweir pFly->Frm().Bottom() >= aRect.Top() )
6453cdf0e10cSrcweir pFly->RefreshExtraData( aRect );
6454cdf0e10cSrcweir }
6455cdf0e10cSrcweir }
6456cdf0e10cSrcweir }
6457cdf0e10cSrcweir }
6458cdf0e10cSrcweir
RefreshExtraData(const SwRect & rRect) const6459cdf0e10cSrcweir void SwLayoutFrm::RefreshExtraData( const SwRect &rRect ) const
6460cdf0e10cSrcweir {
6461cdf0e10cSrcweir
6462cdf0e10cSrcweir const SwLineNumberInfo &rInfo = GetFmt()->GetDoc()->GetLineNumberInfo();
6463cdf0e10cSrcweir sal_Bool bLineInBody = rInfo.IsPaintLineNumbers(),
6464cdf0e10cSrcweir bLineInFly = bLineInBody && rInfo.IsCountInFlys(),
6465cdf0e10cSrcweir bRedLine = (sal_Int16)SW_MOD()->GetRedlineMarkPos()!=text::HoriOrientation::NONE;
6466cdf0e10cSrcweir
6467cdf0e10cSrcweir const SwCntntFrm *pCnt = ContainsCntnt();
6468cdf0e10cSrcweir while ( pCnt && IsAnLower( pCnt ) )
6469cdf0e10cSrcweir {
6470cdf0e10cSrcweir if ( pCnt->IsTxtFrm() && ( bRedLine ||
6471cdf0e10cSrcweir ( !pCnt->IsInTab() &&
6472cdf0e10cSrcweir ((bLineInBody && pCnt->IsInDocBody()) ||
6473cdf0e10cSrcweir (bLineInFly && pCnt->IsInFly())) ) ) &&
6474cdf0e10cSrcweir pCnt->Frm().Top() <= rRect.Bottom() &&
6475cdf0e10cSrcweir pCnt->Frm().Bottom() >= rRect.Top() )
6476cdf0e10cSrcweir {
6477cdf0e10cSrcweir ((SwTxtFrm*)pCnt)->PaintExtraData( rRect );
6478cdf0e10cSrcweir }
6479cdf0e10cSrcweir if ( bLineInFly && pCnt->GetDrawObjs() )
6480cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < pCnt->GetDrawObjs()->Count(); ++i )
6481cdf0e10cSrcweir {
6482cdf0e10cSrcweir const SwAnchoredObject* pAnchoredObj = (*pCnt->GetDrawObjs())[i];
6483cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
6484cdf0e10cSrcweir {
6485cdf0e10cSrcweir const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
6486cdf0e10cSrcweir if ( pFly->IsFlyInCntFrm() &&
6487cdf0e10cSrcweir pFly->Frm().Top() <= rRect.Bottom() &&
6488cdf0e10cSrcweir pFly->Frm().Bottom() >= rRect.Top() )
6489cdf0e10cSrcweir pFly->RefreshExtraData( rRect );
6490cdf0e10cSrcweir }
6491cdf0e10cSrcweir }
6492cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
6493cdf0e10cSrcweir }
6494cdf0e10cSrcweir }
6495cdf0e10cSrcweir
6496cdf0e10cSrcweir /** SwPageFrm::GetDrawBackgrdColor - for #102450#
6497cdf0e10cSrcweir
6498cdf0e10cSrcweir determine the color, that is respectively will be drawn as background
6499cdf0e10cSrcweir for the page frame.
6500cdf0e10cSrcweir Using existing method SwFrm::GetBackgroundBrush to determine the color
6501cdf0e10cSrcweir that is set at the page frame respectively is parent. If none is found
6502cdf0e10cSrcweir return the global retouche color
6503cdf0e10cSrcweir
6504cdf0e10cSrcweir @author OD
6505cdf0e10cSrcweir
6506cdf0e10cSrcweir @return Color
6507cdf0e10cSrcweir */
GetDrawBackgrdColor() const6508987f0866SArmin Le Grand const Color SwPageFrm::GetDrawBackgrdColor() const
6509cdf0e10cSrcweir {
6510cdf0e10cSrcweir const SvxBrushItem* pBrushItem;
6511cdf0e10cSrcweir const Color* pDummyColor;
6512cdf0e10cSrcweir SwRect aDummyRect;
6513ca28ca1fSArmin Le Grand
651464b14621SArmin Le Grand //UUUU
651556b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
651664b14621SArmin Le Grand
651764b14621SArmin Le Grand if ( GetBackgroundBrush( aFillAttributes, pBrushItem, pDummyColor, aDummyRect, true) )
6518ca28ca1fSArmin Le Grand {
651956b35d86SArmin Le Grand if(aFillAttributes.get() && aFillAttributes->isUsed()) //UUUU
652056b35d86SArmin Le Grand {
652156b35d86SArmin Le Grand // let SdrAllFillAttributesHelper do the average color calculation
652256b35d86SArmin Le Grand return Color(aFillAttributes->getAverageColor(aGlobalRetoucheColor.getBColor()));
652356b35d86SArmin Le Grand }
652456b35d86SArmin Le Grand else if(pBrushItem)
652556b35d86SArmin Le Grand {
6526ca28ca1fSArmin Le Grand const Graphic* pGraphic = pBrushItem->GetGraphic();
6527ca28ca1fSArmin Le Grand
6528ca28ca1fSArmin Le Grand if(pGraphic)
6529ca28ca1fSArmin Le Grand {
6530ca28ca1fSArmin Le Grand // #29105# when a graphic is set, it may be possible to calculate a single
6531ca28ca1fSArmin Le Grand // color which looks good in all places of the graphic. Since it is
6532ca28ca1fSArmin Le Grand // planned to have text edit on the overlay one day and the fallback
6533ca28ca1fSArmin Le Grand // to aGlobalRetoucheColor returns something useful, just use that
6534ca28ca1fSArmin Le Grand // for now.
6535ca28ca1fSArmin Le Grand }
6536cdf0e10cSrcweir else
6537ca28ca1fSArmin Le Grand {
6538ca28ca1fSArmin Le Grand // not a graphic, use (hopefully) initialized color
6539ca28ca1fSArmin Le Grand return pBrushItem->GetColor();
6540ca28ca1fSArmin Le Grand }
6541ca28ca1fSArmin Le Grand }
654256b35d86SArmin Le Grand }
6543ca28ca1fSArmin Le Grand
6544cdf0e10cSrcweir return aGlobalRetoucheColor;
6545cdf0e10cSrcweir }
6546cdf0e10cSrcweir
6547cdf0e10cSrcweir /*************************************************************************
6548cdf0e10cSrcweir |*
6549cdf0e10cSrcweir |* SwPageFrm::GetEmptyPageFont()
6550cdf0e10cSrcweir |*
6551cdf0e10cSrcweir |* create/return font used to paint the "empty page" string
6552cdf0e10cSrcweir |*
6553cdf0e10cSrcweir |*************************************************************************/
6554cdf0e10cSrcweir
GetEmptyPageFont()6555cdf0e10cSrcweir const Font& SwPageFrm::GetEmptyPageFont()
6556cdf0e10cSrcweir {
6557cdf0e10cSrcweir static Font* pEmptyPgFont = 0;
6558cdf0e10cSrcweir if ( 0 == pEmptyPgFont )
6559cdf0e10cSrcweir {
6560cdf0e10cSrcweir pEmptyPgFont = new Font;
6561cdf0e10cSrcweir pEmptyPgFont->SetSize( Size( 0, 80 * 20 )); // == 80 pt
6562cdf0e10cSrcweir pEmptyPgFont->SetWeight( WEIGHT_BOLD );
6563cdf0e10cSrcweir pEmptyPgFont->SetStyleName( aEmptyStr );
6564cdf0e10cSrcweir pEmptyPgFont->SetName( String::CreateFromAscii(
6565cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM( "Helvetica" )) );
6566cdf0e10cSrcweir pEmptyPgFont->SetFamily( FAMILY_SWISS );
6567cdf0e10cSrcweir pEmptyPgFont->SetTransparent( sal_True );
6568cdf0e10cSrcweir pEmptyPgFont->SetColor( COL_GRAY );
6569cdf0e10cSrcweir }
6570cdf0e10cSrcweir
6571cdf0e10cSrcweir return *pEmptyPgFont;
6572cdf0e10cSrcweir }
6573cdf0e10cSrcweir
6574cdf0e10cSrcweir /*************************************************************************
6575cdf0e10cSrcweir |*
6576cdf0e10cSrcweir |* SwFrm::Retouche
6577cdf0e10cSrcweir |*
6578cdf0e10cSrcweir |* Beschreibung Retouche fuer einen Bereich.
6579cdf0e10cSrcweir |* Retouche wird nur dann durchgefuehrt, wenn der Frm der letzte seiner
6580cdf0e10cSrcweir |* Kette ist. Der Gesamte Bereich des Upper unterhalb des Frm wird
6581cdf0e10cSrcweir |* per PaintBackground gecleared.
6582cdf0e10cSrcweir |* Ersterstellung MA 13. Apr. 93
6583cdf0e10cSrcweir |* Letzte Aenderung MA 25. Jul. 96
6584cdf0e10cSrcweir |*
6585cdf0e10cSrcweir |*************************************************************************/
6586cdf0e10cSrcweir
Retouche(const SwPageFrm * pPage,const SwRect & rRect) const6587cdf0e10cSrcweir void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const
6588cdf0e10cSrcweir {
6589cdf0e10cSrcweir if ( bFlyMetafile )
6590cdf0e10cSrcweir return;
6591cdf0e10cSrcweir
6592cdf0e10cSrcweir ASSERT( GetUpper(), "Retoucheversuch ohne Upper." );
6593cdf0e10cSrcweir ASSERT( getRootFrm()->GetCurrShell() && pGlobalShell->GetWin(), "Retouche auf dem Drucker?" );
6594cdf0e10cSrcweir
6595cdf0e10cSrcweir SwRect aRetouche( GetUpper()->PaintArea() );
6596cdf0e10cSrcweir aRetouche.Top( Frm().Top() + Frm().Height() );
6597cdf0e10cSrcweir aRetouche.Intersection( pGlobalShell->VisArea() );
6598cdf0e10cSrcweir
6599cdf0e10cSrcweir if ( aRetouche.HasArea() )
6600cdf0e10cSrcweir {
6601307b55caSmseidel //Uebergebenes Rect aussparen. Dafuer brauchen wir leider eine Region
6602cdf0e10cSrcweir //zum ausstanzen.
6603cdf0e10cSrcweir SwRegionRects aRegion( aRetouche );
6604cdf0e10cSrcweir aRegion -= rRect;
6605cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
6606cdf0e10cSrcweir
6607cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
6608cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() );
6609cdf0e10cSrcweir // <--
6610cdf0e10cSrcweir
6611cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
6612cdf0e10cSrcweir {
6613cdf0e10cSrcweir SwRect &rRetouche = aRegion[i];
6614cdf0e10cSrcweir
6615cdf0e10cSrcweir GetUpper()->PaintBaBo( rRetouche, pPage, sal_True );
6616cdf0e10cSrcweir
6617cdf0e10cSrcweir //Hoelle und Himmel muessen auch refreshed werden.
6618cdf0e10cSrcweir //Um Rekursionen zu vermeiden muss mein Retouche Flag zuerst
6619cdf0e10cSrcweir //zurueckgesetzt werden!
6620cdf0e10cSrcweir ResetRetouche();
6621cdf0e10cSrcweir SwRect aRetouchePart( rRetouche );
6622cdf0e10cSrcweir if ( aRetouchePart.HasArea() )
6623cdf0e10cSrcweir {
6624987f0866SArmin Le Grand const Color aPageBackgrdColor(pPage->GetDrawBackgrdColor());
6625cdf0e10cSrcweir const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
6626cdf0e10cSrcweir // --> OD #i76669#
6627cdf0e10cSrcweir SwViewObjectContactRedirector aSwRedirector( *pSh );
6628cdf0e10cSrcweir // <--
6629cdf0e10cSrcweir
6630cdf0e10cSrcweir pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), 0,
6631cdf0e10cSrcweir aRetouchePart, &aPageBackgrdColor,
6632cdf0e10cSrcweir (pPage->IsRightToLeft() ? true : false),
6633cdf0e10cSrcweir &aSwRedirector );
6634cdf0e10cSrcweir pSh->Imp()->PaintLayer( pIDDMA->GetHeavenId(), 0,
6635cdf0e10cSrcweir aRetouchePart, &aPageBackgrdColor,
6636cdf0e10cSrcweir (pPage->IsRightToLeft() ? true : false),
6637cdf0e10cSrcweir &aSwRedirector );
6638cdf0e10cSrcweir }
6639cdf0e10cSrcweir
6640cdf0e10cSrcweir SetRetouche();
6641cdf0e10cSrcweir
6642cdf0e10cSrcweir //Da wir uns ausserhalb aller Paint-Bereiche begeben muessen hier
6643cdf0e10cSrcweir //leider die Hilfslinien erneuert werden.
6644cdf0e10cSrcweir pPage->RefreshSubsidiary( aRetouchePart );
6645cdf0e10cSrcweir }
6646cdf0e10cSrcweir }
6647cdf0e10cSrcweir if ( ViewShell::IsLstEndAction() )
6648cdf0e10cSrcweir ResetRetouche();
6649cdf0e10cSrcweir }
6650cdf0e10cSrcweir
6651cdf0e10cSrcweir /** SwFrm::GetBackgroundBrush
6652cdf0e10cSrcweir
6653cdf0e10cSrcweir @descr
6654cdf0e10cSrcweir determine the background brush for the frame:
6655cdf0e10cSrcweir the background brush is taken from it-self or from its parent (anchor/upper).
6656cdf0e10cSrcweir Normally, the background brush is taken, which has no transparent color or
6657cdf0e10cSrcweir which has a background graphic. But there are some special cases:
6658cdf0e10cSrcweir (1) No background brush is taken from a page frame, if view option "IsPageBack"
6659cdf0e10cSrcweir isn't set.
6660cdf0e10cSrcweir (2) Background brush from a index section is taken under special conditions.
6661cdf0e10cSrcweir In this case parameter <rpCol> is set to the index shading color.
6662cdf0e10cSrcweir (3) New (OD 20.08.2002) - Background brush is taken, if on background drawing
6663cdf0e10cSrcweir of the frame transparency is considered and its color is not "no fill"/"auto fill"
6664cdf0e10cSrcweir ---- old description in german:
6665cdf0e10cSrcweir Beschreibung Liefert die Backgroundbrush fuer den Bereich des
6666cdf0e10cSrcweir des Frm. Die Brush wird entweder von ihm selbst oder von einem
6667cdf0e10cSrcweir Upper vorgegeben, die erste Brush wird benutzt.
6668cdf0e10cSrcweir Ist fuer keinen Frm eine Brush angegeben, so wird sal_False zurueck-
6669cdf0e10cSrcweir geliefert.
6670cdf0e10cSrcweir Ersterstellung MA 23. Dec. 92
6671cdf0e10cSrcweir Letzte Aenderung MA 04. Feb. 97
6672cdf0e10cSrcweir
6673cdf0e10cSrcweir @param rpBrush
6674cdf0e10cSrcweir output parameter - constant reference pointer the found background brush
6675cdf0e10cSrcweir
6676cdf0e10cSrcweir @param rpCol
6677cdf0e10cSrcweir output parameter - constant reference pointer to the color of the index shading
6678cdf0e10cSrcweir set under special conditions, if background brush is taken from an index section.
6679cdf0e10cSrcweir
6680cdf0e10cSrcweir @param rOrigRect
6681307b55caSmseidel in-/output parameter - reference to the rectangle the background brush is
6682cdf0e10cSrcweir considered for - adjusted to the frame, from which the background brush is
6683cdf0e10cSrcweir taken.
6684cdf0e10cSrcweir
6685cdf0e10cSrcweir @parem bLowerMode
6686cdf0e10cSrcweir input parameter - boolean indicating, if background brush should *not* be
6687cdf0e10cSrcweir taken from parent.
6688cdf0e10cSrcweir
6689cdf0e10cSrcweir @author MA
6690cdf0e10cSrcweir @change 20.08.2002 by OD
6691cdf0e10cSrcweir @docdate 20.08.2002
6692cdf0e10cSrcweir
6693cdf0e10cSrcweir @return true, if a background brush for the frame is found
6694cdf0e10cSrcweir */
GetBackgroundBrush(drawinglayer::attribute::SdrAllFillAttributesHelperPtr & rFillAttributes,const SvxBrushItem * & rpBrush,const Color * & rpCol,SwRect & rOrigRect,sal_Bool bLowerMode) const669564b14621SArmin Le Grand sal_Bool SwFrm::GetBackgroundBrush(
669656b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
669764b14621SArmin Le Grand const SvxBrushItem* & rpBrush,
6698cdf0e10cSrcweir const Color*& rpCol,
6699cdf0e10cSrcweir SwRect &rOrigRect,
6700cdf0e10cSrcweir sal_Bool bLowerMode ) const
6701cdf0e10cSrcweir {
6702cdf0e10cSrcweir const SwFrm *pFrm = this;
6703cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
6704cdf0e10cSrcweir const SwViewOption *pOpt = pSh->GetViewOptions();
6705cdf0e10cSrcweir rpBrush = 0;
6706cdf0e10cSrcweir rpCol = NULL;
6707cdf0e10cSrcweir do
6708cdf0e10cSrcweir { if ( pFrm->IsPageFrm() && !pOpt->IsPageBack() )
6709cdf0e10cSrcweir return sal_False;
6710cdf0e10cSrcweir
671164b14621SArmin Le Grand //UUUU
671256b35d86SArmin Le Grand rFillAttributes = pFrm->getSdrAllFillAttributesHelper();
6713cdf0e10cSrcweir const SvxBrushItem &rBack = pFrm->GetAttrSet()->GetBackground();
671464b14621SArmin Le Grand
6715cdf0e10cSrcweir if( pFrm->IsSctFrm() )
6716cdf0e10cSrcweir {
6717cdf0e10cSrcweir const SwSection* pSection = ((SwSectionFrm*)pFrm)->GetSection();
6718cdf0e10cSrcweir /// OD 20.08.2002 #99657# #GetTransChg#
6719cdf0e10cSrcweir /// Note: If frame <pFrm> is a section of the index and
6720cdf0e10cSrcweir /// it its background color is "no fill"/"auto fill" and
6721cdf0e10cSrcweir /// it has no background graphic and
6722cdf0e10cSrcweir /// we are not in the page preview and
6723cdf0e10cSrcweir /// we are not in read-only mode and
6724cdf0e10cSrcweir /// option "index shadings" is set and
6725cdf0e10cSrcweir /// the output is not the printer
6726cdf0e10cSrcweir /// then set <rpCol> to the color of the index shading
6727cdf0e10cSrcweir if( pSection && ( TOX_HEADER_SECTION == pSection->GetType() ||
6728cdf0e10cSrcweir TOX_CONTENT_SECTION == pSection->GetType() ) &&
6729cdf0e10cSrcweir (rBack.GetColor() == COL_TRANSPARENT) &&
6730cdf0e10cSrcweir ///rBack.GetColor().GetTransparency() &&
6731cdf0e10cSrcweir rBack.GetGraphicPos() == GPOS_NONE &&
6732cdf0e10cSrcweir !pOpt->IsPagePreview() &&
6733cdf0e10cSrcweir !pOpt->IsReadonly() &&
6734cdf0e10cSrcweir // --> FME 2004-06-29 #114856# Formular view
6735cdf0e10cSrcweir !pOpt->IsFormView() &&
6736cdf0e10cSrcweir // <--
6737cdf0e10cSrcweir SwViewOption::IsIndexShadings() &&
6738cdf0e10cSrcweir !pOpt->IsPDFExport() &&
6739cdf0e10cSrcweir pSh->GetOut()->GetOutDevType() != OUTDEV_PRINTER )
6740cdf0e10cSrcweir {
6741cdf0e10cSrcweir rpCol = &SwViewOption::GetIndexShadingsColor();
6742cdf0e10cSrcweir }
6743cdf0e10cSrcweir }
6744cdf0e10cSrcweir
6745cdf0e10cSrcweir /// OD 20.08.2002 #99657#
6746cdf0e10cSrcweir /// determine, if background draw of frame <pFrm> considers transparency
6747cdf0e10cSrcweir /// --> Status Quo: background transparency have to be
6748cdf0e10cSrcweir /// considered for fly frames
6749cdf0e10cSrcweir const sal_Bool bConsiderBackgroundTransparency = pFrm->IsFlyFrm();
675064b14621SArmin Le Grand
675109ef3841SArmin Le Grand // #i125189# Do not base the decision for using the parent's fill style for this
675209ef3841SArmin Le Grand // frame when the new DrawingLayer FillAttributes are used on the SdrAllFillAttributesHelper
675309ef3841SArmin Le Grand // information. There the data is already optimized to no fill in the case that the
6754f53e21faSmseidel // transparency is at 100% while no fill is the criteria for derivation
675509ef3841SArmin Le Grand bool bNewDrawingLayerFillStyleIsUsedAndNotNoFill(false);
675609ef3841SArmin Le Grand
675709ef3841SArmin Le Grand if(rFillAttributes.get())
675809ef3841SArmin Le Grand {
675909ef3841SArmin Le Grand // the new DrawingLayer FillStyle is used
676009ef3841SArmin Le Grand if(rFillAttributes->isUsed())
676109ef3841SArmin Le Grand {
676209ef3841SArmin Le Grand // it's not XFILL_NONE
676309ef3841SArmin Le Grand bNewDrawingLayerFillStyleIsUsedAndNotNoFill = true;
676409ef3841SArmin Le Grand }
676509ef3841SArmin Le Grand else
676609ef3841SArmin Le Grand {
676709ef3841SArmin Le Grand // maybe optimized already when 100% transparency is used somewhere, need to test
676809ef3841SArmin Le Grand // XFillStyleItem directly from the model data
676909ef3841SArmin Le Grand const XFillStyle eFillStyle(static_cast< const XFillStyleItem& >(pFrm->GetAttrSet()->Get(XATTR_FILLSTYLE)).GetValue());
677009ef3841SArmin Le Grand
677109ef3841SArmin Le Grand if(XFILL_NONE != eFillStyle)
677209ef3841SArmin Le Grand {
677309ef3841SArmin Le Grand bNewDrawingLayerFillStyleIsUsedAndNotNoFill = true;
677409ef3841SArmin Le Grand }
677509ef3841SArmin Le Grand }
677609ef3841SArmin Le Grand }
677709ef3841SArmin Le Grand
6778cdf0e10cSrcweir /// OD 20.08.2002 #99657#
6779cdf0e10cSrcweir /// add condition:
6780cdf0e10cSrcweir /// If <bConsiderBackgroundTransparency> is set - see above -,
6781cdf0e10cSrcweir /// return brush of frame <pFrm>, if its color is *not* "no fill"/"auto fill"
678264b14621SArmin Le Grand if (
678309ef3841SArmin Le Grand // #i125189# Done when the new DrawingLayer FillAttributes are used and
678409ef3841SArmin Le Grand // not XFILL_NONE (see above)
678509ef3841SArmin Le Grand bNewDrawingLayerFillStyleIsUsedAndNotNoFill ||
678664b14621SArmin Le Grand
678764b14621SArmin Le Grand // done when SvxBrushItem is used
678864b14621SArmin Le Grand !rBack.GetColor().GetTransparency() || rBack.GetGraphicPos() != GPOS_NONE ||
678964b14621SArmin Le Grand
679064b14621SArmin Le Grand // done when direct color is forced
6791cdf0e10cSrcweir rpCol ||
679264b14621SArmin Le Grand
679364b14621SArmin Le Grand // done when consider BG transparency and color is not completely transparent
6794cdf0e10cSrcweir (bConsiderBackgroundTransparency && (rBack.GetColor() != COL_TRANSPARENT))
6795cdf0e10cSrcweir )
6796cdf0e10cSrcweir {
6797cdf0e10cSrcweir rpBrush = &rBack;
679864b14621SArmin Le Grand
679964b14621SArmin Le Grand if ( pFrm->IsPageFrm() && pSh->GetViewOptions()->getBrowseMode() )
680064b14621SArmin Le Grand {
6801cdf0e10cSrcweir rOrigRect = pFrm->Frm();
680264b14621SArmin Le Grand }
6803cdf0e10cSrcweir else
6804cdf0e10cSrcweir {
6805cdf0e10cSrcweir if ( pFrm->Frm().SSize() != pFrm->Prt().SSize() )
6806cdf0e10cSrcweir {
6807cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm );
6808cdf0e10cSrcweir const SwBorderAttrs &rAttrs = *aAccess.Get();
6809cdf0e10cSrcweir ::lcl_CalcBorderRect( rOrigRect, pFrm, rAttrs, sal_False );
6810cdf0e10cSrcweir }
6811cdf0e10cSrcweir else
6812cdf0e10cSrcweir {
6813cdf0e10cSrcweir rOrigRect = pFrm->Prt();
6814cdf0e10cSrcweir rOrigRect += pFrm->Frm().Pos();
6815cdf0e10cSrcweir }
6816cdf0e10cSrcweir }
681764b14621SArmin Le Grand
6818cdf0e10cSrcweir return sal_True;
6819cdf0e10cSrcweir }
6820cdf0e10cSrcweir
6821cdf0e10cSrcweir if ( bLowerMode )
682264b14621SArmin Le Grand {
6823cdf0e10cSrcweir /// Do not try to get background brush from parent (anchor/upper)
6824cdf0e10cSrcweir return sal_False;
682564b14621SArmin Le Grand }
6826cdf0e10cSrcweir
6827cdf0e10cSrcweir /// get parent frame - anchor or upper - for next loop
6828cdf0e10cSrcweir if ( pFrm->IsFlyFrm() )
682964b14621SArmin Le Grand {
6830cdf0e10cSrcweir /// OD 20.08.2002 - use "static_cast" instead of "old C-cast"
6831cdf0e10cSrcweir pFrm = (static_cast<const SwFlyFrm*>(pFrm))->GetAnchorFrm();
6832cdf0e10cSrcweir ///pFrm = ((SwFlyFrm*)pFrm)->GetAnchor();
683364b14621SArmin Le Grand }
6834cdf0e10cSrcweir else
683564b14621SArmin Le Grand {
6836cdf0e10cSrcweir pFrm = pFrm->GetUpper();
683764b14621SArmin Le Grand }
6838cdf0e10cSrcweir } while ( pFrm );
6839cdf0e10cSrcweir
6840cdf0e10cSrcweir return sal_False;
6841cdf0e10cSrcweir }
6842cdf0e10cSrcweir
6843cdf0e10cSrcweir /*************************************************************************
6844cdf0e10cSrcweir |*
6845cdf0e10cSrcweir |* SwFrmFmt::GetGraphic()
6846cdf0e10cSrcweir |*
6847cdf0e10cSrcweir |* Ersterstellung MA 23. Jul. 96
6848cdf0e10cSrcweir |* Letzte Aenderung MA 23. Jul. 96
6849cdf0e10cSrcweir |*
6850cdf0e10cSrcweir |*************************************************************************/
6851cdf0e10cSrcweir
SetOutDevAndWin(ViewShell * pSh,OutputDevice * pO,Window * pW,sal_uInt16 nZoom)6852cdf0e10cSrcweir void SetOutDevAndWin( ViewShell *pSh, OutputDevice *pO,
6853cdf0e10cSrcweir Window *pW, sal_uInt16 nZoom )
6854cdf0e10cSrcweir {
6855cdf0e10cSrcweir pSh->pOut = pO;
6856cdf0e10cSrcweir pSh->pWin = pW;
6857cdf0e10cSrcweir pSh->pOpt->SetZoom( nZoom );
6858cdf0e10cSrcweir }
6859cdf0e10cSrcweir
MakeGraphic(ImageMap *)6860cdf0e10cSrcweir Graphic SwFrmFmt::MakeGraphic( ImageMap* )
6861cdf0e10cSrcweir {
6862cdf0e10cSrcweir return Graphic();
6863cdf0e10cSrcweir }
6864cdf0e10cSrcweir
MakeGraphic(ImageMap * pMap)6865cdf0e10cSrcweir Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
6866cdf0e10cSrcweir {
6867cdf0e10cSrcweir Graphic aRet;
6868cdf0e10cSrcweir //irgendeinen Fly suchen!
6869cdf0e10cSrcweir SwIterator<SwFrm,SwFmt> aIter( *this );
6870cdf0e10cSrcweir SwFrm *pFirst = aIter.First();
6871cdf0e10cSrcweir ViewShell *pSh;
6872cdf0e10cSrcweir if ( pFirst && 0 != ( pSh = pFirst->getRootFrm()->GetCurrShell()) )
6873cdf0e10cSrcweir {
6874cdf0e10cSrcweir ViewShell *pOldGlobal = pGlobalShell;
6875cdf0e10cSrcweir pGlobalShell = pSh;
6876cdf0e10cSrcweir
6877cdf0e10cSrcweir sal_Bool bNoteURL = pMap &&
6878cdf0e10cSrcweir SFX_ITEM_SET != GetAttrSet().GetItemState( RES_URL, sal_True );
6879cdf0e10cSrcweir if( bNoteURL )
6880cdf0e10cSrcweir {
6881cdf0e10cSrcweir ASSERT( !pNoteURL, "MakeGraphic: pNoteURL already used? " );
6882cdf0e10cSrcweir pNoteURL = new SwNoteURL;
6883cdf0e10cSrcweir }
6884cdf0e10cSrcweir SwFlyFrm *pFly = (SwFlyFrm*)pFirst;
6885cdf0e10cSrcweir
6886cdf0e10cSrcweir OutputDevice *pOld = pSh->GetOut();
6887cdf0e10cSrcweir VirtualDevice aDev( *pOld );
6888cdf0e10cSrcweir aDev.EnableOutput( sal_False );
6889cdf0e10cSrcweir
6890cdf0e10cSrcweir GDIMetaFile aMet;
6891cdf0e10cSrcweir MapMode aMap( pOld->GetMapMode().GetMapUnit() );
6892cdf0e10cSrcweir aDev.SetMapMode( aMap );
6893cdf0e10cSrcweir aMet.SetPrefMapMode( aMap );
6894cdf0e10cSrcweir
6895cdf0e10cSrcweir ::SwCalcPixStatics( pSh->GetOut() );
6896cdf0e10cSrcweir aMet.SetPrefSize( pFly->Frm().SSize() );
6897cdf0e10cSrcweir
6898cdf0e10cSrcweir aMet.Record( &aDev );
6899cdf0e10cSrcweir aDev.SetLineColor();
6900cdf0e10cSrcweir aDev.SetFillColor();
6901cdf0e10cSrcweir aDev.SetFont( pOld->GetFont() );
6902cdf0e10cSrcweir
690360d78278Smseidel //Rechteck ggf. ausdehnen, damit die Umrandungen mit aufgezeichnet werden.
6904cdf0e10cSrcweir SwRect aOut( pFly->Frm() );
6905cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFly );
6906cdf0e10cSrcweir const SwBorderAttrs &rAttrs = *aAccess.Get();
6907cdf0e10cSrcweir if ( rAttrs.CalcRightLine() )
6908cdf0e10cSrcweir aOut.SSize().Width() += 2*nPixelSzW;
6909cdf0e10cSrcweir if ( rAttrs.CalcBottomLine() )
6910cdf0e10cSrcweir aOut.SSize().Height()+= 2*nPixelSzH;
6911cdf0e10cSrcweir
6912cdf0e10cSrcweir // #i92711# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev
6913cdf0e10cSrcweir const Region aRepaintRegion(aOut.SVRect());
6914cdf0e10cSrcweir pSh->DLPrePaint2(aRepaintRegion);
6915cdf0e10cSrcweir
6916cdf0e10cSrcweir Window *pWin = pSh->GetWin();
6917cdf0e10cSrcweir sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom();
6918cdf0e10cSrcweir ::SetOutDevAndWin( pSh, &aDev, 0, 100 );
6919cdf0e10cSrcweir bFlyMetafile = sal_True;
6920cdf0e10cSrcweir pFlyMetafileOut = pWin;
6921cdf0e10cSrcweir
6922cdf0e10cSrcweir SwViewImp *pImp = pSh->Imp();
6923cdf0e10cSrcweir pFlyOnlyDraw = pFly;
6924cdf0e10cSrcweir pLines = new SwLineRects;
6925cdf0e10cSrcweir
6926cdf0e10cSrcweir // OD 09.12.2002 #103045# - determine page, fly frame is on
6927cdf0e10cSrcweir const SwPageFrm* pFlyPage = pFly->FindPageFrm();
6928987f0866SArmin Le Grand const Color aPageBackgrdColor(pFlyPage->GetDrawBackgrdColor());
6929cdf0e10cSrcweir const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
6930cdf0e10cSrcweir // --> OD #i76669#
6931cdf0e10cSrcweir SwViewObjectContactRedirector aSwRedirector( *pSh );
6932cdf0e10cSrcweir // <--
6933cdf0e10cSrcweir pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor,
6934cdf0e10cSrcweir (pFlyPage->IsRightToLeft() ? true : false),
6935cdf0e10cSrcweir &aSwRedirector );
6936cdf0e10cSrcweir pLines->PaintLines( &aDev );
6937cdf0e10cSrcweir if ( pFly->IsFlyInCntFrm() )
6938cdf0e10cSrcweir pFly->Paint( aOut );
6939cdf0e10cSrcweir pLines->PaintLines( &aDev );
6940cdf0e10cSrcweir /// OD 30.08.2002 #102450# - add 3rd parameter
6941cdf0e10cSrcweir pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor,
6942cdf0e10cSrcweir (pFlyPage->IsRightToLeft() ? true : false),
6943cdf0e10cSrcweir &aSwRedirector );
6944cdf0e10cSrcweir pLines->PaintLines( &aDev );
6945cdf0e10cSrcweir DELETEZ( pLines );
6946cdf0e10cSrcweir pFlyOnlyDraw = 0;
6947cdf0e10cSrcweir
6948cdf0e10cSrcweir pFlyMetafileOut = 0;
6949cdf0e10cSrcweir bFlyMetafile = sal_False;
6950cdf0e10cSrcweir ::SetOutDevAndWin( pSh, pOld, pWin, nZoom );
6951cdf0e10cSrcweir
6952cdf0e10cSrcweir // #i92711# end Pre/PostPaint encapsulation when pOut is back and content is painted
6953cdf0e10cSrcweir pSh->DLPostPaint2(true);
6954cdf0e10cSrcweir
6955cdf0e10cSrcweir aMet.Stop();
6956cdf0e10cSrcweir aMet.Move( -pFly->Frm().Left(), -pFly->Frm().Top() );
6957cdf0e10cSrcweir aRet = Graphic( aMet );
6958cdf0e10cSrcweir
6959cdf0e10cSrcweir if( bNoteURL )
6960cdf0e10cSrcweir {
6961cdf0e10cSrcweir ASSERT( pNoteURL, "MakeGraphic: Good Bye, NoteURL." );
6962cdf0e10cSrcweir pNoteURL->FillImageMap( pMap, pFly->Frm().Pos(), aMap );
6963cdf0e10cSrcweir delete pNoteURL;
6964cdf0e10cSrcweir pNoteURL = NULL;
6965cdf0e10cSrcweir }
6966cdf0e10cSrcweir pGlobalShell = pOldGlobal;
6967cdf0e10cSrcweir }
6968cdf0e10cSrcweir return aRet;
6969cdf0e10cSrcweir }
6970cdf0e10cSrcweir
MakeGraphic(ImageMap *)6971cdf0e10cSrcweir Graphic SwDrawFrmFmt::MakeGraphic( ImageMap* )
6972cdf0e10cSrcweir {
6973cdf0e10cSrcweir Graphic aRet;
697426ea3662SArmin Le Grand SwDrawModel* pMod = getIDocumentDrawModelAccess()->GetDrawModel();
6975cdf0e10cSrcweir if ( pMod )
6976cdf0e10cSrcweir {
6977cdf0e10cSrcweir SdrObject *pObj = FindSdrObject();
6978cdf0e10cSrcweir SdrView *pView = new SdrView( pMod );
6979cdf0e10cSrcweir SdrPageView *pPgView = pView->ShowSdrPage(pView->GetModel()->GetPage(0));
6980cdf0e10cSrcweir pView->MarkObj( pObj, pPgView );
6981bb18ee55SArmin Le Grand aRet = pView->GetMarkedObjBitmapEx();
6982cdf0e10cSrcweir pView->HideSdrPage();
6983cdf0e10cSrcweir delete pView;
6984cdf0e10cSrcweir }
6985cdf0e10cSrcweir return aRet;
6986cdf0e10cSrcweir }
6987cdf0e10cSrcweir
698826ea3662SArmin Le Grand //eof
6989