1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5f6e50924SAndrew Rist * distributed with this work for additional information
6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist * software distributed under the License is distributed on an
15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17f6e50924SAndrew Rist * specific language governing permissions and limitations
18f6e50924SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20f6e50924SAndrew Rist *************************************************************/
21f6e50924SAndrew Rist
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_svx.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir #include <vcl/bitmap.hxx>
26cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
27cdf0e10cSrcweir #include <svx/pageitem.hxx>
28cdf0e10cSrcweir #include <svx/pagectrl.hxx>
29cdf0e10cSrcweir #include <editeng/boxitem.hxx>
30cdf0e10cSrcweir #include <algorithm>
31*56b35d86SArmin Le Grand #include <basegfx/matrix/b2dhommatrix.hxx>
32*56b35d86SArmin Le Grand #include <drawinglayer/geometry/viewinformation2d.hxx>
33*56b35d86SArmin Le Grand #include <drawinglayer/processor2d/processor2dtools.hxx>
34*56b35d86SArmin Le Grand #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
35*56b35d86SArmin Le Grand #include <basegfx/polygon/b2dpolygontools.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
38cdf0e10cSrcweir
39cdf0e10cSrcweir #define CELL_WIDTH 1600L
40cdf0e10cSrcweir #define CELL_HEIGHT 800L
41cdf0e10cSrcweir
42cdf0e10cSrcweir // class SvxPageWindow ---------------------------------------------------
43cdf0e10cSrcweir
SvxPageWindow(Window * pParent,const ResId & rId)44*56b35d86SArmin Le Grand SvxPageWindow::SvxPageWindow(Window* pParent,const ResId& rId)
45*56b35d86SArmin Le Grand : Window(pParent,rId),
46*56b35d86SArmin Le Grand aWinSize(),
47*56b35d86SArmin Le Grand aSize(),
48cdf0e10cSrcweir
49cdf0e10cSrcweir nTop(0),
50cdf0e10cSrcweir nBottom(0),
51cdf0e10cSrcweir nLeft(0),
52cdf0e10cSrcweir nRight(0),
53*56b35d86SArmin Le Grand
54*56b35d86SArmin Le Grand //UUUU
55*56b35d86SArmin Le Grand pBorder(0),
56*56b35d86SArmin Le Grand bResetBackground(sal_False),
57*56b35d86SArmin Le Grand bFrameDirection(sal_False),
58*56b35d86SArmin Le Grand nFrameDirection(0),
59*56b35d86SArmin Le Grand
60cdf0e10cSrcweir nHdLeft(0),
61cdf0e10cSrcweir nHdRight(0),
62cdf0e10cSrcweir nHdDist(0),
63cdf0e10cSrcweir nHdHeight(0),
64*56b35d86SArmin Le Grand
65cdf0e10cSrcweir pHdBorder(0),
66cdf0e10cSrcweir nFtLeft(0),
67cdf0e10cSrcweir nFtRight(0),
68cdf0e10cSrcweir nFtDist(0),
69cdf0e10cSrcweir nFtHeight(0),
70*56b35d86SArmin Le Grand
71cdf0e10cSrcweir pFtBorder(0),
72*56b35d86SArmin Le Grand
73*56b35d86SArmin Le Grand maHeaderFillAttributes(),
74*56b35d86SArmin Le Grand maFooterFillAttributes(),
75*56b35d86SArmin Le Grand maPageFillAttributes(),
76*56b35d86SArmin Le Grand
77cdf0e10cSrcweir bFooter(sal_False),
78cdf0e10cSrcweir bHeader(sal_False),
79cdf0e10cSrcweir bTable(sal_False),
80cdf0e10cSrcweir bHorz(sal_False),
81cdf0e10cSrcweir bVert(sal_False),
82*56b35d86SArmin Le Grand eUsage(SVX_PAGE_ALL),
83*56b35d86SArmin Le Grand
84*56b35d86SArmin Le Grand aLeftText(),
85*56b35d86SArmin Le Grand aRightText()
86cdf0e10cSrcweir
87cdf0e10cSrcweir {
88cdf0e10cSrcweir // defaultmaessing in Twips rechnen
89cdf0e10cSrcweir SetMapMode(MapMode(MAP_TWIP));
90cdf0e10cSrcweir aWinSize = GetOutputSizePixel();
91cdf0e10cSrcweir aWinSize.Height() -= 4;
92cdf0e10cSrcweir aWinSize.Width() -= 4;
93cdf0e10cSrcweir
94cdf0e10cSrcweir aWinSize = PixelToLogic(aWinSize);
95cdf0e10cSrcweir SetBackground();
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
98cdf0e10cSrcweir // -----------------------------------------------------------------------
99cdf0e10cSrcweir
~SvxPageWindow()100cdf0e10cSrcweir SvxPageWindow::~SvxPageWindow()
101cdf0e10cSrcweir {
102cdf0e10cSrcweir delete pHdBorder;
103cdf0e10cSrcweir delete pFtBorder;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir
106cdf0e10cSrcweir // -----------------------------------------------------------------------
107cdf0e10cSrcweir
Paint(const Rectangle &)108cdf0e10cSrcweir void __EXPORT SvxPageWindow::Paint(const Rectangle&)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir Fraction aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L));
111cdf0e10cSrcweir Fraction aYScale(aWinSize.Height(),std::max(aSize.Height(),1L));
112cdf0e10cSrcweir MapMode aMapMode(GetMapMode());
113cdf0e10cSrcweir
114cdf0e10cSrcweir if(aYScale < aXScale)
115cdf0e10cSrcweir {
116cdf0e10cSrcweir aMapMode.SetScaleX(aYScale);
117cdf0e10cSrcweir aMapMode.SetScaleY(aYScale);
118cdf0e10cSrcweir }
119cdf0e10cSrcweir else
120cdf0e10cSrcweir {
121cdf0e10cSrcweir aMapMode.SetScaleX(aXScale);
122cdf0e10cSrcweir aMapMode.SetScaleY(aXScale);
123cdf0e10cSrcweir }
124cdf0e10cSrcweir SetMapMode(aMapMode);
125cdf0e10cSrcweir Size aSz(PixelToLogic(GetSizePixel()));
126cdf0e10cSrcweir long nYPos = (aSz.Height() - aSize.Height()) / 2;
127cdf0e10cSrcweir
128cdf0e10cSrcweir if(eUsage == SVX_PAGE_ALL)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir // alle Seiten gleich -> eine Seite malen
131cdf0e10cSrcweir if(aSize.Width() > aSize.Height())
132cdf0e10cSrcweir {
133cdf0e10cSrcweir // Querformat in gleicher Gr"osse zeichnen
134cdf0e10cSrcweir Fraction aX = aMapMode.GetScaleX();
135cdf0e10cSrcweir Fraction aY = aMapMode.GetScaleY();
136cdf0e10cSrcweir Fraction a2(1.5);
137cdf0e10cSrcweir aX *= a2;
138cdf0e10cSrcweir aY *= a2;
139cdf0e10cSrcweir aMapMode.SetScaleX(aX);
140cdf0e10cSrcweir aMapMode.SetScaleY(aY);
141cdf0e10cSrcweir SetMapMode(aMapMode);
142cdf0e10cSrcweir aSz = PixelToLogic(GetSizePixel());
143cdf0e10cSrcweir nYPos = (aSz.Height() - aSize.Height()) / 2;
144cdf0e10cSrcweir long nXPos = (aSz.Width() - aSize.Width()) / 2;
145cdf0e10cSrcweir DrawPage(Point(nXPos,nYPos),sal_True,sal_True);
146cdf0e10cSrcweir }
147cdf0e10cSrcweir else
148cdf0e10cSrcweir // Hochformat
149cdf0e10cSrcweir DrawPage(Point((aSz.Width() - aSize.Width()) / 2,nYPos),sal_True,sal_True);
150cdf0e10cSrcweir }
151cdf0e10cSrcweir else
152cdf0e10cSrcweir {
153cdf0e10cSrcweir // Linke und rechte Seite unterschiedlich -> ggf. zwei Seiten malen
154cdf0e10cSrcweir DrawPage(Point(0,nYPos),sal_False,(sal_Bool)(eUsage & SVX_PAGE_LEFT));
155cdf0e10cSrcweir DrawPage(Point(aSize.Width() + aSize.Width() / 8,nYPos),sal_True,
156cdf0e10cSrcweir (sal_Bool)(eUsage & SVX_PAGE_RIGHT));
157cdf0e10cSrcweir }
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir // -----------------------------------------------------------------------
DrawPage(const Point & rOrg,const sal_Bool bSecond,const sal_Bool bEnabled)161cdf0e10cSrcweir void SvxPageWindow::DrawPage(const Point& rOrg,const sal_Bool bSecond,const sal_Bool bEnabled)
162cdf0e10cSrcweir {
163cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
164cdf0e10cSrcweir const Color& rFieldColor = rStyleSettings.GetFieldColor();
165cdf0e10cSrcweir const Color& rFieldTextColor = rStyleSettings.GetFieldTextColor();
166cdf0e10cSrcweir const Color& rDisableColor = rStyleSettings.GetDisableColor();
167cdf0e10cSrcweir const Color& rDlgColor = rStyleSettings.GetDialogColor();
168cdf0e10cSrcweir
169cdf0e10cSrcweir // background
170*56b35d86SArmin Le Grand if(!bSecond || bResetBackground)
171cdf0e10cSrcweir {
172cdf0e10cSrcweir SetLineColor(Color(COL_TRANSPARENT));
173cdf0e10cSrcweir SetFillColor(rDlgColor);
174cdf0e10cSrcweir Size winSize(GetOutputSize());
175cdf0e10cSrcweir DrawRect(Rectangle(Point(0,0),winSize));
176cdf0e10cSrcweir
177*56b35d86SArmin Le Grand if(bResetBackground)
178*56b35d86SArmin Le Grand bResetBackground = sal_False;
179cdf0e10cSrcweir }
180cdf0e10cSrcweir SetLineColor(rFieldTextColor);
181cdf0e10cSrcweir // Schatten
182cdf0e10cSrcweir Size aTempSize = aSize;
183cdf0e10cSrcweir // Seite
184cdf0e10cSrcweir if(!bEnabled)
185cdf0e10cSrcweir {
186cdf0e10cSrcweir SetFillColor(rDisableColor);
187cdf0e10cSrcweir DrawRect(Rectangle(rOrg,aTempSize));
188cdf0e10cSrcweir return;
189cdf0e10cSrcweir }
190cdf0e10cSrcweir SetFillColor(rFieldColor);
191cdf0e10cSrcweir DrawRect(Rectangle(rOrg,aTempSize));
192cdf0e10cSrcweir
193cdf0e10cSrcweir // Border Top Bottom Left Right
194cdf0e10cSrcweir Point aBegin(rOrg);
195cdf0e10cSrcweir Point aEnd(rOrg);
196cdf0e10cSrcweir
197cdf0e10cSrcweir long nL = nLeft;
198cdf0e10cSrcweir long nR = nRight;
199cdf0e10cSrcweir
200cdf0e10cSrcweir if(eUsage == SVX_PAGE_MIRROR && !bSecond)
201cdf0e10cSrcweir {
202cdf0e10cSrcweir // f"ur gespiegelt drehen
203cdf0e10cSrcweir nL = nRight;
204cdf0e10cSrcweir nR = nLeft;
205cdf0e10cSrcweir }
206cdf0e10cSrcweir
207cdf0e10cSrcweir Rectangle aRect;
208cdf0e10cSrcweir
209cdf0e10cSrcweir aRect.Left() = rOrg.X() + nL;
210cdf0e10cSrcweir aRect.Right() = rOrg.X() + aTempSize.Width() - nR;
211cdf0e10cSrcweir aRect.Top() = rOrg.Y() + nTop;
212cdf0e10cSrcweir aRect.Bottom() = rOrg.Y() + aTempSize.Height() - nBottom;
213cdf0e10cSrcweir
214cdf0e10cSrcweir Rectangle aHdRect(aRect);
215cdf0e10cSrcweir Rectangle aFtRect(aRect);
216cdf0e10cSrcweir
217*56b35d86SArmin Le Grand if(bHeader || bFooter)
218*56b35d86SArmin Le Grand {
219*56b35d86SArmin Le Grand //UUUU Header and/or footer used
220*56b35d86SArmin Le Grand const Color aLineColor(GetLineColor());
221*56b35d86SArmin Le Grand
222*56b35d86SArmin Le Grand //UUUU draw PageFill first and on the whole page, no outline
223*56b35d86SArmin Le Grand SetLineColor();
224*56b35d86SArmin Le Grand drawFillAttributes(maPageFillAttributes, aRect, aRect);
225*56b35d86SArmin Le Grand SetLineColor(aLineColor);
226*56b35d86SArmin Le Grand
227cdf0e10cSrcweir if(bHeader)
228cdf0e10cSrcweir {
229cdf0e10cSrcweir // ggf. Header anzeigen
230cdf0e10cSrcweir aHdRect.Left() += nHdLeft;
231cdf0e10cSrcweir aHdRect.Right() -= nHdRight;
232cdf0e10cSrcweir aHdRect.Bottom() = aRect.Top() + nHdHeight;
233cdf0e10cSrcweir aRect.Top() += nHdHeight + nHdDist;
234*56b35d86SArmin Le Grand
235*56b35d86SArmin Le Grand // draw header over PageFill, plus outline
236*56b35d86SArmin Le Grand drawFillAttributes(maHeaderFillAttributes, aHdRect, aHdRect);
237cdf0e10cSrcweir }
238cdf0e10cSrcweir
239cdf0e10cSrcweir if(bFooter)
240cdf0e10cSrcweir {
241cdf0e10cSrcweir // ggf. Footer anzeigen
242cdf0e10cSrcweir aFtRect.Left() += nFtLeft;
243cdf0e10cSrcweir aFtRect.Right() -= nFtRight;
244cdf0e10cSrcweir aFtRect.Top() = aRect.Bottom() - nFtHeight;
245cdf0e10cSrcweir aRect.Bottom() -= nFtHeight + nFtDist;
246*56b35d86SArmin Le Grand
247*56b35d86SArmin Le Grand // draw footer over PageFill, plus outline
248*56b35d86SArmin Le Grand drawFillAttributes(maFooterFillAttributes, aFtRect, aFtRect);
249cdf0e10cSrcweir }
250cdf0e10cSrcweir
251*56b35d86SArmin Le Grand // draw page's reduced outline, only outline
252*56b35d86SArmin Le Grand drawFillAttributes(drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect);
253cdf0e10cSrcweir }
254cdf0e10cSrcweir else
255*56b35d86SArmin Le Grand {
256*56b35d86SArmin Le Grand //UUUU draw PageFill and outline
257*56b35d86SArmin Le Grand drawFillAttributes(maPageFillAttributes, aRect, aRect);
258*56b35d86SArmin Le Grand }
259cdf0e10cSrcweir
260*56b35d86SArmin Le Grand if(bFrameDirection && !bTable)
261cdf0e10cSrcweir {
262cdf0e10cSrcweir //pImpl->nFrameDirection
263cdf0e10cSrcweir Point aPos;
264cdf0e10cSrcweir Font aFont(GetFont());
265cdf0e10cSrcweir const Size aSaveSize = aFont.GetSize();
266cdf0e10cSrcweir Size aDrawSize(0,aRect.GetHeight() / 6);
267cdf0e10cSrcweir aFont.SetSize(aDrawSize);
268cdf0e10cSrcweir SetFont(aFont);
269cdf0e10cSrcweir String sText(String::CreateFromAscii("ABC"));
270cdf0e10cSrcweir Point aMove(1,GetTextHeight());
271cdf0e10cSrcweir sal_Unicode cArrow = 0x2193;
272cdf0e10cSrcweir long nAWidth = GetTextWidth(String(sText.GetChar(0)));
273*56b35d86SArmin Le Grand switch(nFrameDirection)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir case FRMDIR_HORI_LEFT_TOP:
276cdf0e10cSrcweir aPos = aRect.TopLeft();
277cdf0e10cSrcweir aPos.X() += PixelToLogic(Point(1,1)).X();
278cdf0e10cSrcweir aMove.Y() = 0;
279cdf0e10cSrcweir cArrow = 0x2192;
280cdf0e10cSrcweir break;
281cdf0e10cSrcweir case FRMDIR_HORI_RIGHT_TOP:
282cdf0e10cSrcweir aPos = aRect.TopRight();
283cdf0e10cSrcweir aPos.X() -= nAWidth;
284cdf0e10cSrcweir aMove.Y() = 0;
285cdf0e10cSrcweir aMove.X() *= -1;
286cdf0e10cSrcweir cArrow = 0x2190;
287cdf0e10cSrcweir break;
288cdf0e10cSrcweir case FRMDIR_VERT_TOP_LEFT:
289cdf0e10cSrcweir aPos = aRect.TopLeft();
290cdf0e10cSrcweir aPos.X() += PixelToLogic(Point(1,1)).X();
291cdf0e10cSrcweir aMove.X() = 0;
292cdf0e10cSrcweir break;
293cdf0e10cSrcweir case FRMDIR_VERT_TOP_RIGHT:
294cdf0e10cSrcweir aPos = aRect.TopRight();
295cdf0e10cSrcweir aPos.X() -= nAWidth;
296cdf0e10cSrcweir aMove.X() = 0;
297cdf0e10cSrcweir break;
298cdf0e10cSrcweir }
299cdf0e10cSrcweir sText.Append(cArrow);
300cdf0e10cSrcweir for(sal_uInt16 i = 0; i < sText.Len(); i++)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir String sDraw(sText.GetChar(i));
303cdf0e10cSrcweir long nHDiff = 0;
304cdf0e10cSrcweir long nCharWidth = GetTextWidth(sDraw);
305cdf0e10cSrcweir sal_Bool bHorizontal = 0 == aMove.Y();
306cdf0e10cSrcweir if(!bHorizontal)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir nHDiff = (nAWidth - nCharWidth) / 2;
309cdf0e10cSrcweir aPos.X() += nHDiff;
310cdf0e10cSrcweir }
311cdf0e10cSrcweir DrawText(aPos,sDraw);
312cdf0e10cSrcweir if(bHorizontal)
313cdf0e10cSrcweir {
314cdf0e10cSrcweir aPos.X() += aMove.X() < 0 ? -nCharWidth : nCharWidth;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir else
317cdf0e10cSrcweir {
318cdf0e10cSrcweir aPos.X() -= nHDiff;
319cdf0e10cSrcweir aPos.Y() += aMove.Y();
320cdf0e10cSrcweir }
321cdf0e10cSrcweir }
322cdf0e10cSrcweir aFont.SetSize(aSaveSize);
323cdf0e10cSrcweir SetFont(aFont);
324cdf0e10cSrcweir
325cdf0e10cSrcweir }
326cdf0e10cSrcweir if(bTable)
327cdf0e10cSrcweir {
328cdf0e10cSrcweir // Tabelle malen, ggf. zentrieren
329cdf0e10cSrcweir SetLineColor(Color(COL_LIGHTGRAY));
330cdf0e10cSrcweir
331cdf0e10cSrcweir long nW = aRect.GetWidth(),nH = aRect.GetHeight();
332cdf0e10cSrcweir long nTW = CELL_WIDTH * 3,nTH = CELL_HEIGHT * 3;
333cdf0e10cSrcweir long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left();
334cdf0e10cSrcweir long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top();
335cdf0e10cSrcweir Rectangle aCellRect(Point(_nLeft,_nTop),Size(CELL_WIDTH,CELL_HEIGHT));
336cdf0e10cSrcweir
337cdf0e10cSrcweir for(sal_uInt16 i = 0; i < 3; ++i)
338cdf0e10cSrcweir {
339cdf0e10cSrcweir aCellRect.Left() = _nLeft;
340cdf0e10cSrcweir aCellRect.Right() = _nLeft + CELL_WIDTH;
341cdf0e10cSrcweir if(i > 0)
342cdf0e10cSrcweir aCellRect.Move(0,CELL_HEIGHT);
343cdf0e10cSrcweir
344cdf0e10cSrcweir for(sal_uInt16 j = 0; j < 3; ++j)
345cdf0e10cSrcweir {
346cdf0e10cSrcweir if(j > 0)
347cdf0e10cSrcweir aCellRect.Move(CELL_WIDTH,0);
348cdf0e10cSrcweir DrawRect(aCellRect);
349cdf0e10cSrcweir }
350cdf0e10cSrcweir }
351cdf0e10cSrcweir }
352cdf0e10cSrcweir }
353cdf0e10cSrcweir
354*56b35d86SArmin Le Grand //UUUU
drawFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr & rFillAttributes,const Rectangle & rPaintRange,const Rectangle & rDefineRange)355*56b35d86SArmin Le Grand void SvxPageWindow::drawFillAttributes(
356*56b35d86SArmin Le Grand const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
357*56b35d86SArmin Le Grand const Rectangle& rPaintRange,
358*56b35d86SArmin Le Grand const Rectangle& rDefineRange)
359*56b35d86SArmin Le Grand {
360*56b35d86SArmin Le Grand const basegfx::B2DRange aPaintRange(
361*56b35d86SArmin Le Grand rPaintRange.Left(),
362*56b35d86SArmin Le Grand rPaintRange.Top(),
363*56b35d86SArmin Le Grand rPaintRange.Right(),
364*56b35d86SArmin Le Grand rPaintRange.Bottom());
365*56b35d86SArmin Le Grand
366*56b35d86SArmin Le Grand if(!aPaintRange.isEmpty() &&
367*56b35d86SArmin Le Grand !basegfx::fTools::equalZero(aPaintRange.getWidth()) &&
368*56b35d86SArmin Le Grand !basegfx::fTools::equalZero(aPaintRange.getHeight()))
369*56b35d86SArmin Le Grand {
370*56b35d86SArmin Le Grand const basegfx::B2DRange aDefineRange(
371*56b35d86SArmin Le Grand rDefineRange.Left(),
372*56b35d86SArmin Le Grand rDefineRange.Top(),
373*56b35d86SArmin Le Grand rDefineRange.Right(),
374*56b35d86SArmin Le Grand rDefineRange.Bottom());
375*56b35d86SArmin Le Grand
376*56b35d86SArmin Le Grand // prepare primitive sequence
377*56b35d86SArmin Le Grand drawinglayer::primitive2d::Primitive2DSequence aSequence;
378*56b35d86SArmin Le Grand
379*56b35d86SArmin Le Grand // create fill geometry if there is something to fill
380*56b35d86SArmin Le Grand if(rFillAttributes.get() && rFillAttributes->isUsed())
381*56b35d86SArmin Le Grand {
382*56b35d86SArmin Le Grand aSequence = rFillAttributes->getPrimitive2DSequence(
383*56b35d86SArmin Le Grand aPaintRange,
384*56b35d86SArmin Le Grand aDefineRange);
385*56b35d86SArmin Le Grand }
386*56b35d86SArmin Le Grand
387*56b35d86SArmin Le Grand // create line geometry if a LineColor is set at the target device
388*56b35d86SArmin Le Grand if(IsLineColor())
389*56b35d86SArmin Le Grand {
390*56b35d86SArmin Le Grand const drawinglayer::primitive2d::Primitive2DReference xOutline(
391*56b35d86SArmin Le Grand new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
392*56b35d86SArmin Le Grand basegfx::tools::createPolygonFromRect(aPaintRange),
393*56b35d86SArmin Le Grand GetLineColor().getBColor()));
394*56b35d86SArmin Le Grand
395*56b35d86SArmin Le Grand drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(
396*56b35d86SArmin Le Grand aSequence,
397*56b35d86SArmin Le Grand xOutline);
398*56b35d86SArmin Le Grand }
399*56b35d86SArmin Le Grand
400*56b35d86SArmin Le Grand // draw that if we have something to draw
401*56b35d86SArmin Le Grand if(aSequence.getLength())
402*56b35d86SArmin Le Grand {
403*56b35d86SArmin Le Grand const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
404*56b35d86SArmin Le Grand basegfx::B2DHomMatrix(),
405*56b35d86SArmin Le Grand GetViewTransformation(),
406*56b35d86SArmin Le Grand aPaintRange,
407*56b35d86SArmin Le Grand 0,
408*56b35d86SArmin Le Grand 0.0,
409*56b35d86SArmin Le Grand com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >());
410*56b35d86SArmin Le Grand drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
411*56b35d86SArmin Le Grand *this,
412*56b35d86SArmin Le Grand aViewInformation2D);
413*56b35d86SArmin Le Grand
414*56b35d86SArmin Le Grand if(pProcessor)
415*56b35d86SArmin Le Grand {
416*56b35d86SArmin Le Grand pProcessor->process(aSequence);
417*56b35d86SArmin Le Grand
418*56b35d86SArmin Le Grand delete pProcessor;
419*56b35d86SArmin Le Grand }
420*56b35d86SArmin Le Grand }
421*56b35d86SArmin Le Grand }
422*56b35d86SArmin Le Grand }
423*56b35d86SArmin Le Grand
424cdf0e10cSrcweir // -----------------------------------------------------------------------
425cdf0e10cSrcweir
SetBorder(const SvxBoxItem & rNew)426cdf0e10cSrcweir void SvxPageWindow::SetBorder(const SvxBoxItem& rNew)
427cdf0e10cSrcweir {
428*56b35d86SArmin Le Grand delete pBorder;
429*56b35d86SArmin Le Grand pBorder = new SvxBoxItem(rNew);
430cdf0e10cSrcweir }
431cdf0e10cSrcweir
432cdf0e10cSrcweir // -----------------------------------------------------------------------
433cdf0e10cSrcweir
SetHdBorder(const SvxBoxItem & rNew)434cdf0e10cSrcweir void SvxPageWindow::SetHdBorder(const SvxBoxItem& rNew)
435cdf0e10cSrcweir {
436cdf0e10cSrcweir delete pHdBorder;
437cdf0e10cSrcweir pHdBorder = new SvxBoxItem(rNew);
438cdf0e10cSrcweir }
439cdf0e10cSrcweir // -----------------------------------------------------------------------
440cdf0e10cSrcweir
SetFtBorder(const SvxBoxItem & rNew)441cdf0e10cSrcweir void SvxPageWindow::SetFtBorder(const SvxBoxItem& rNew)
442cdf0e10cSrcweir {
443cdf0e10cSrcweir delete pFtBorder;
444cdf0e10cSrcweir pFtBorder = new SvxBoxItem(rNew);
445cdf0e10cSrcweir }
446cdf0e10cSrcweir
EnableFrameDirection(sal_Bool bEnable)447cdf0e10cSrcweir void SvxPageWindow::EnableFrameDirection(sal_Bool bEnable)
448cdf0e10cSrcweir {
449*56b35d86SArmin Le Grand bFrameDirection = bEnable;
450cdf0e10cSrcweir }
451cdf0e10cSrcweir
SetFrameDirection(sal_Int32 nDirection)452*56b35d86SArmin Le Grand void SvxPageWindow::SetFrameDirection(sal_Int32 nDirection)
453cdf0e10cSrcweir {
454*56b35d86SArmin Le Grand nFrameDirection = nDirection;
455cdf0e10cSrcweir }
456cdf0e10cSrcweir
ResetBackground()457cdf0e10cSrcweir void SvxPageWindow::ResetBackground()
458cdf0e10cSrcweir {
459*56b35d86SArmin Le Grand bResetBackground = sal_True;
460cdf0e10cSrcweir }
461*56b35d86SArmin Le Grand
462*56b35d86SArmin Le Grand //eof
463