1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <vcl/metric.hxx>
21 #include <vcl/outdev.hxx>
22 #include <vcl/svapp.hxx>
23 #include <vcl/settings.hxx>
24 #include <svtools/colorcfg.hxx>
25 #include <svx/swframeexample.hxx>
26 #include <i18nlangtag/languagetag.hxx>
27 #include <com/sun/star/text/HoriOrientation.hpp>
28 #include <com/sun/star/text/VertOrientation.hpp>
29 #include <com/sun/star/text/RelOrientation.hpp>
31 using namespace ::com::sun::star::text
;
33 #define FLYINFLY_BORDER 3
34 constexpr OUString DEMOTEXT
= u
"Ij"_ustr
;
38 void DrawRect_Impl(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&rRect
,
39 const Color
&rFillColor
, const Color
&rLineColor
)
41 rRenderContext
.SetFillColor(rFillColor
);
42 rRenderContext
.SetLineColor(rLineColor
);
43 rRenderContext
.DrawRect(rRect
);
48 SwFrameExample::SwFrameExample()
49 : nHAlign(HoriOrientation::CENTER
)
50 , nHRel(RelOrientation::FRAME
)
51 , nVAlign(VertOrientation::TOP
)
52 , nVRel(RelOrientation::PRINT_AREA
)
53 , nWrap(WrapTextMode_NONE
)
54 , nAnchor(RndStdIds::FLY_AT_PAGE
)
61 void SwFrameExample::SetDrawingArea(weld::DrawingArea
* pDrawingArea
)
63 CustomWidgetController::SetDrawingArea(pDrawingArea
);
64 pDrawingArea
->set_size_request(pDrawingArea
->get_approximate_digit_width() * 16,
65 pDrawingArea
->get_text_height() * 12);
68 void SwFrameExample::InitColors_Impl()
70 const StyleSettings
& rSettings
= Application::GetSettings().GetStyleSettings();
71 m_aBgCol
= rSettings
.GetWindowColor();
73 bool bHC
= rSettings
.GetHighContrastMode();
75 m_aFrameColor
= COL_LIGHTGREEN
;
76 m_aAlignColor
= COL_LIGHTRED
;
77 m_aTransColor
= COL_TRANSPARENT
;
80 svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR
).nColor
:
82 m_aPrintAreaCol
= bHC
? m_aTxtCol
: COL_GRAY
;
83 m_aBorderCol
= m_aTxtCol
;
84 m_aBlankCol
= bHC
? m_aTxtCol
: COL_LIGHTGRAY
;
85 m_aBlankFrameCol
= bHC
? m_aTxtCol
: COL_GRAY
;
88 void SwFrameExample::StyleUpdated()
91 CustomWidgetController::StyleUpdated();
94 void SwFrameExample::InitAllRects_Impl(vcl::RenderContext
& rRenderContext
)
96 aPage
.SetSize(GetOutputSizePixel());
98 sal_uInt32 nOutWPix
= aPage
.GetWidth();
99 sal_uInt32 nOutHPix
= aPage
.GetHeight();
101 assert(nOutWPix
> 0 && nOutHPix
> 0);
109 sal_uInt32 nLTxtBorder
;
110 sal_uInt32 nRTxtBorder
;
111 sal_uInt32 nTTxtBorder
;
112 sal_uInt32 nBTxtBorder
;
114 if (nAnchor
!= RndStdIds::FLY_AS_CHAR
)
138 aPagePrtArea
= tools::Rectangle(Point(nLBorder
, nTBorder
), Point((nOutWPix
- 1) - nRBorder
, (nOutHPix
- 1) - nBBorder
));
140 // Example text: Preparing for the text output
142 aTextLine
= aPagePrtArea
;
143 aTextLine
.SetSize(Size(aTextLine
.GetWidth(), 2));
144 aTextLine
.AdjustLeft(nLTxtBorder
);
145 aTextLine
.AdjustRight( -sal_Int32(nRTxtBorder
) );
146 aTextLine
.Move(0, nTTxtBorder
);
148 // Rectangle to edges including paragraph
149 sal_uInt16 nLines
= static_cast<sal_uInt16
>((aPagePrtArea
.GetHeight() / 2 - nTTxtBorder
- nBTxtBorder
)
150 / (aTextLine
.GetHeight() + 2));
151 aPara
= aPagePrtArea
;
152 aPara
.SetSize(Size(aPara
.GetWidth(),
153 (aTextLine
.GetHeight() + 2) * nLines
+ nTTxtBorder
+ nBTxtBorder
));
155 // Rectangle around paragraph without borders
156 aParaPrtArea
= aPara
;
157 aParaPrtArea
.AdjustLeft(nLTxtBorder
);
158 aParaPrtArea
.AdjustRight( -sal_Int32(nRTxtBorder
) );
159 aParaPrtArea
.AdjustTop(nTTxtBorder
);
160 aParaPrtArea
.AdjustBottom( -sal_Int32(nBTxtBorder
) );
162 if (nAnchor
== RndStdIds::FLY_AS_CHAR
|| nAnchor
== RndStdIds::FLY_AT_CHAR
)
164 vcl::Font aFont
= OutputDevice::GetDefaultFont(
165 DefaultFontType::LATIN_TEXT
, Application::GetSettings().GetLanguageTag().getLanguageType(),
166 GetDefaultFontFlags::OnlyOne
, &rRenderContext
);
167 aFont
.SetColor( m_aTxtCol
);
168 aFont
.SetFillColor( m_aBgCol
);
169 aFont
.SetWeight(WEIGHT_NORMAL
);
171 if (nAnchor
== RndStdIds::FLY_AS_CHAR
)
173 aFont
.SetFontSize(Size(0, aParaPrtArea
.GetHeight() - 2));
174 rRenderContext
.SetFont(aFont
);
175 aParaPrtArea
.SetSize(Size(rRenderContext
.GetTextWidth(DEMOTEXT
), rRenderContext
.GetTextHeight()));
179 aFont
.SetFontSize(Size(0, aParaPrtArea
.GetHeight() / 2));
180 rRenderContext
.SetFont(aFont
);
181 aAutoCharFrame
.SetSize(Size(rRenderContext
.GetTextWidth(OUString('A')), GetTextHeight()));
182 aAutoCharFrame
.SetPos(Point(aParaPrtArea
.Left() + (aParaPrtArea
.GetWidth() - aAutoCharFrame
.GetWidth()) / 2,
183 aParaPrtArea
.Top() + (aParaPrtArea
.GetHeight() - aAutoCharFrame
.GetHeight()) / 2));
187 // Inner Frame anchored at the Frame
188 aFrameAtFrame
= aPara
;
189 aFrameAtFrame
.AdjustLeft(9 );
190 aFrameAtFrame
.AdjustRight( -5 );
191 aFrameAtFrame
.AdjustBottom(5 );
192 aFrameAtFrame
.SetPos(Point(aFrameAtFrame
.Left() + 2, (aPagePrtArea
.Bottom() - aFrameAtFrame
.GetHeight()) / 2 + 5));
194 // Size of the frame to be positioned
195 if (nAnchor
!= RndStdIds::FLY_AS_CHAR
)
197 sal_uInt32 nLFBorder
= nAnchor
== RndStdIds::FLY_AT_PAGE
? nLBorder
: nLTxtBorder
;
198 sal_uInt32 nRFBorder
= nAnchor
== RndStdIds::FLY_AT_PAGE
? nRBorder
: nRTxtBorder
;
202 case RelOrientation::PAGE_LEFT
:
203 case RelOrientation::FRAME_LEFT
:
204 aFrmSize
= Size(nLFBorder
- 4, (aTextLine
.GetHeight() + 2) * 3);
207 case RelOrientation::PAGE_RIGHT
:
208 case RelOrientation::FRAME_RIGHT
:
209 aFrmSize
= Size(nRFBorder
- 4, (aTextLine
.GetHeight() + 2) * 3);
213 aFrmSize
= Size(nLBorder
- 3, (aTextLine
.GetHeight() + 2) * 3);
216 aFrmSize
.setWidth( std::max(tools::Long(5), aFrmSize
.Width()) );
217 aFrmSize
.setHeight( std::max(tools::Long(5), aFrmSize
.Height()) );
221 sal_uInt32 nFreeWidth
= aPagePrtArea
.GetWidth() - rRenderContext
.GetTextWidth(DEMOTEXT
);
223 aFrmSize
= Size(nFreeWidth
/ 2, (aTextLine
.GetHeight() + 2) * 3);
224 aDrawObj
.SetSize(Size(std::max(tools::Long(5), tools::Long(nFreeWidth
/ 3)), std::max(tools::Long(5), aFrmSize
.Height() * 3)));
225 aDrawObj
.SetPos(Point(aParaPrtArea
.Right() + 1, aParaPrtArea
.Bottom() / 2));
226 aParaPrtArea
.SetRight( aDrawObj
.Right() );
230 void SwFrameExample::CalcBoundRect_Impl(const vcl::RenderContext
& rRenderContext
, tools::Rectangle
&rRect
)
234 case RndStdIds::FLY_AT_PAGE
:
238 case RelOrientation::FRAME
:
239 case RelOrientation::PAGE_FRAME
:
240 rRect
.SetLeft( aPage
.Left() );
241 rRect
.SetRight( aPage
.Right() );
244 case RelOrientation::PRINT_AREA
:
245 case RelOrientation::PAGE_PRINT_AREA
:
246 rRect
.SetLeft( aPagePrtArea
.Left() );
247 rRect
.SetRight( aPagePrtArea
.Right() );
250 case RelOrientation::PAGE_LEFT
:
251 rRect
.SetLeft( aPage
.Left() );
252 rRect
.SetRight( aPagePrtArea
.Left() );
255 case RelOrientation::PAGE_RIGHT
:
256 rRect
.SetLeft( aPagePrtArea
.Right() );
257 rRect
.SetRight( aPage
.Right() );
263 case RelOrientation::PRINT_AREA
:
264 case RelOrientation::PAGE_PRINT_AREA
:
265 rRect
.SetTop( aPagePrtArea
.Top() );
266 rRect
.SetBottom( aPagePrtArea
.Bottom() );
269 case RelOrientation::FRAME
:
270 case RelOrientation::PAGE_FRAME
:
271 rRect
.SetTop( aPage
.Top() );
272 rRect
.SetBottom( aPage
.Bottom() );
278 case RndStdIds::FLY_AT_FLY
:
282 case RelOrientation::FRAME
:
283 case RelOrientation::PAGE_FRAME
:
284 rRect
.SetLeft( aFrameAtFrame
.Left() );
285 rRect
.SetRight( aFrameAtFrame
.Right() );
288 case RelOrientation::PRINT_AREA
:
289 case RelOrientation::PAGE_PRINT_AREA
:
290 rRect
.SetLeft( aFrameAtFrame
.Left() + FLYINFLY_BORDER
);
291 rRect
.SetRight( aFrameAtFrame
.Right() - FLYINFLY_BORDER
);
294 case RelOrientation::PAGE_LEFT
:
295 rRect
.SetLeft( aFrameAtFrame
.Left() );
296 rRect
.SetRight( aFrameAtFrame
.Left() + FLYINFLY_BORDER
);
299 case RelOrientation::PAGE_RIGHT
:
300 rRect
.SetLeft( aFrameAtFrame
.Right() );
301 rRect
.SetRight( aFrameAtFrame
.Right() - FLYINFLY_BORDER
);
307 case RelOrientation::FRAME
:
308 case RelOrientation::PAGE_FRAME
:
309 rRect
.SetTop( aFrameAtFrame
.Top() );
310 rRect
.SetBottom( aFrameAtFrame
.Bottom() );
313 case RelOrientation::PRINT_AREA
:
314 case RelOrientation::PAGE_PRINT_AREA
:
315 rRect
.SetTop( aFrameAtFrame
.Top() + FLYINFLY_BORDER
);
316 rRect
.SetBottom( aFrameAtFrame
.Bottom() - FLYINFLY_BORDER
);
321 case RndStdIds::FLY_AT_PARA
:
322 case RndStdIds::FLY_AT_CHAR
:
326 case RelOrientation::FRAME
:
327 rRect
.SetLeft( aPara
.Left() );
328 rRect
.SetRight( aPara
.Right() );
331 case RelOrientation::PRINT_AREA
:
332 rRect
.SetLeft( aParaPrtArea
.Left() );
333 rRect
.SetRight( aParaPrtArea
.Right() );
336 case RelOrientation::PAGE_LEFT
:
337 rRect
.SetLeft( aPage
.Left() );
338 rRect
.SetRight( aPagePrtArea
.Left() );
341 case RelOrientation::PAGE_RIGHT
:
342 rRect
.SetLeft( aPagePrtArea
.Right() );
343 rRect
.SetRight( aPage
.Right() );
346 case RelOrientation::PAGE_FRAME
:
347 rRect
.SetLeft( aPage
.Left() );
348 rRect
.SetRight( aPage
.Right() );
351 case RelOrientation::PAGE_PRINT_AREA
:
352 rRect
.SetLeft( aPagePrtArea
.Left() );
353 rRect
.SetRight( aPagePrtArea
.Right() );
356 case RelOrientation::FRAME_LEFT
:
357 rRect
.SetLeft( aPara
.Left() );
358 rRect
.SetRight( aParaPrtArea
.Left() );
361 case RelOrientation::FRAME_RIGHT
:
362 rRect
.SetLeft( aParaPrtArea
.Right() );
363 rRect
.SetRight( aPara
.Right() );
366 case RelOrientation::CHAR
:
367 rRect
.SetLeft( aAutoCharFrame
.Left() );
368 rRect
.SetRight( aAutoCharFrame
.Left() );
374 case RelOrientation::FRAME
:
375 rRect
.SetTop( aPara
.Top() );
376 rRect
.SetBottom( aPara
.Bottom() );
379 case RelOrientation::PRINT_AREA
:
380 rRect
.SetTop( aParaPrtArea
.Top() );
381 rRect
.SetBottom( aParaPrtArea
.Bottom() );
384 case RelOrientation::CHAR
:
385 if (nVAlign
!= VertOrientation::NONE
&&
386 nVAlign
!= VertOrientation::CHAR_BOTTOM
)
387 rRect
.SetTop( aAutoCharFrame
.Top() );
389 rRect
.SetTop( aAutoCharFrame
.Bottom() );
390 rRect
.SetBottom( aAutoCharFrame
.Bottom() );
392 // OD 12.11.2003 #i22341#
393 case RelOrientation::TEXT_LINE
:
394 rRect
.SetTop( aAutoCharFrame
.Top() );
395 rRect
.SetBottom( aAutoCharFrame
.Top() );
401 case RndStdIds::FLY_AS_CHAR
:
402 rRect
.SetLeft( aParaPrtArea
.Left() );
403 rRect
.SetRight( aParaPrtArea
.Right() );
407 case VertOrientation::NONE
:
408 case VertOrientation::TOP
:
409 case VertOrientation::CENTER
:
410 case VertOrientation::BOTTOM
:
412 FontMetric
aMetric(rRenderContext
.GetFontMetric());
414 rRect
.SetTop( aParaPrtArea
.Bottom() - aMetric
.GetDescent() );
415 rRect
.SetBottom( rRect
.Top() );
421 case VertOrientation::LINE_TOP
:
422 case VertOrientation::LINE_CENTER
:
423 case VertOrientation::LINE_BOTTOM
:
424 rRect
.SetTop( aParaPrtArea
.Top() );
425 rRect
.SetBottom( aDrawObj
.Bottom() );
428 case VertOrientation::CHAR_TOP
:
429 case VertOrientation::CHAR_CENTER
:
430 case VertOrientation::CHAR_BOTTOM
:
431 rRect
.SetTop( aParaPrtArea
.Top() );
432 rRect
.SetBottom( aParaPrtArea
.Bottom() );
442 tools::Rectangle
SwFrameExample::DrawInnerFrame_Impl(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&rRect
,
443 const Color
&rFillColor
, const Color
&rBorderColor
)
445 DrawRect_Impl(rRenderContext
, rRect
, rFillColor
, rBorderColor
);
447 // determine the area relative to which the positioning happens
448 tools::Rectangle
aRect(rRect
); // aPagePrtArea = Default
449 CalcBoundRect_Impl(rRenderContext
, aRect
);
451 if (nAnchor
== RndStdIds::FLY_AT_FLY
&& &rRect
== &aPagePrtArea
)
453 // draw text paragraph
454 tools::Rectangle
aTxt(aTextLine
);
455 sal_Int32 nStep
= aTxt
.GetHeight() + 2;
456 sal_uInt16 nLines
= static_cast<sal_uInt16
>(aParaPrtArea
.GetHeight() / (aTextLine
.GetHeight() + 2));
458 for (sal_uInt16 i
= 0; i
< nLines
; i
++)
461 aTxt
.SetSize(Size(aTxt
.GetWidth() / 2, aTxt
.GetHeight()));
462 DrawRect_Impl(rRenderContext
, aTxt
, m_aTxtCol
, m_aTransColor
);
470 void SwFrameExample::Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&)
472 rRenderContext
.SetMapMode(MapMode(MapUnit::MapPixel
));
474 InitAllRects_Impl(rRenderContext
);
477 DrawRect_Impl(rRenderContext
, aPage
, m_aBgCol
, m_aBorderCol
);
480 tools::Rectangle aRect
= DrawInnerFrame_Impl(rRenderContext
, aPagePrtArea
, m_aTransColor
, m_aPrintAreaCol
);
482 if (nAnchor
== RndStdIds::FLY_AT_FLY
)
483 aRect
= DrawInnerFrame_Impl(rRenderContext
, aFrameAtFrame
, m_aBgCol
, m_aBorderCol
);
485 tools::Long lXPos
= 0;
486 tools::Long lYPos
= 0;
488 // Horizontal alignment
489 if (nAnchor
!= RndStdIds::FLY_AS_CHAR
)
493 case HoriOrientation::RIGHT
:
495 lXPos
= aRect
.Right() - aFrmSize
.Width() + 1;
498 case HoriOrientation::CENTER
:
500 lXPos
= aRect
.Left() + (aRect
.GetWidth() - aFrmSize
.Width()) / 2;
503 case HoriOrientation::NONE
:
505 lXPos
= aRect
.Left() + aRelPos
.X();
509 default: // HoriOrientation::LEFT
510 lXPos
= aRect
.Left();
516 lXPos
= aRect
.Right() + 2;
519 // Vertical Alignment
520 if (nAnchor
!= RndStdIds::FLY_AS_CHAR
)
524 case VertOrientation::BOTTOM
:
525 case VertOrientation::LINE_BOTTOM
:
528 if ( nVRel
!= RelOrientation::TEXT_LINE
)
530 lYPos
= aRect
.Bottom() - aFrmSize
.Height() + 1;
538 case VertOrientation::CENTER
:
539 case VertOrientation::LINE_CENTER
:
541 lYPos
= aRect
.Top() + (aRect
.GetHeight() - aFrmSize
.Height()) / 2;
544 case VertOrientation::NONE
:
547 if ( nVRel
!= RelOrientation::CHAR
&& nVRel
!= RelOrientation::TEXT_LINE
)
548 lYPos
= aRect
.Top() + aRelPos
.Y();
550 lYPos
= aRect
.Top() - aRelPos
.Y();
555 if ( nVRel
!= RelOrientation::TEXT_LINE
)
561 lYPos
= aRect
.Bottom() - aFrmSize
.Height() + 1;
570 case VertOrientation::CENTER
:
571 case VertOrientation::CHAR_CENTER
:
572 case VertOrientation::LINE_CENTER
:
573 lYPos
= aRect
.Top() + (aRect
.GetHeight() - aFrmSize
.Height()) / 2;
576 case VertOrientation::TOP
:
577 case VertOrientation::CHAR_BOTTOM
:
578 case VertOrientation::LINE_BOTTOM
:
579 lYPos
= aRect
.Bottom() - aFrmSize
.Height() + 1;
583 lYPos
= aRect
.Top() - aRelPos
.Y();
588 tools::Rectangle
aFrmRect(Point(lXPos
, lYPos
), aFrmSize
);
590 tools::Rectangle
* pOuterFrame
= &aPage
;
592 if (nAnchor
== RndStdIds::FLY_AT_FLY
)
593 pOuterFrame
= &aFrameAtFrame
;
595 if (aFrmRect
.Left() < pOuterFrame
->Left())
596 aFrmRect
.Move(pOuterFrame
->Left() - aFrmRect
.Left(), 0);
597 if (aFrmRect
.Right() > pOuterFrame
->Right())
598 aFrmRect
.Move(pOuterFrame
->Right() - aFrmRect
.Right(), 0);
600 if (aFrmRect
.Top() < pOuterFrame
->Top())
601 aFrmRect
.Move(0, pOuterFrame
->Top() - aFrmRect
.Top());
602 if (aFrmRect
.Bottom() > pOuterFrame
->Bottom())
603 aFrmRect
.Move(0, pOuterFrame
->Bottom() - aFrmRect
.Bottom());
605 // Draw Test paragraph
606 const tools::Long nTxtLineHeight
= aTextLine
.GetHeight();
607 tools::Rectangle
aTxt(aTextLine
);
611 if (nAnchor
== RndStdIds::FLY_AT_FLY
)
613 aTxt
.SetLeft( aFrameAtFrame
.Left() + FLYINFLY_BORDER
);
614 aTxt
.SetRight( aFrameAtFrame
.Right() - FLYINFLY_BORDER
);
615 aTxt
.SetTop( aFrameAtFrame
.Top() + FLYINFLY_BORDER
);
616 aTxt
.SetBottom( aTxt
.Top() + aTextLine
.GetHeight() - 1 );
618 nStep
= aTxt
.GetHeight() + 2;
619 nLines
= static_cast<sal_uInt16
>(((aFrameAtFrame
.GetHeight() - 2 * FLYINFLY_BORDER
) * 2 / 3)
620 / (aTxt
.GetHeight() + 2));
624 nStep
= aTxt
.GetHeight() + 2;
625 nLines
= static_cast<sal_uInt16
>(aParaPrtArea
.GetHeight() / (aTextLine
.GetHeight() + 2));
628 if (nAnchor
!= RndStdIds::FLY_AS_CHAR
)
631 const tools::Long nOldR
= aTxt
.Right();
632 const tools::Long nOldL
= aTxt
.Left();
635 const bool bIgnoreWrap
= nAnchor
== RndStdIds::FLY_AT_CHAR
&&
636 ( nHRel
== RelOrientation::CHAR
|| nVRel
== RelOrientation::CHAR
||
637 nVRel
== RelOrientation::TEXT_LINE
);
639 for (sal_uInt16 i
= 0; i
< nLines
; ++i
)
641 if (i
== (nLines
- 1))
642 aTxt
.SetSize(Size(aTxt
.GetWidth() / 2, aTxt
.GetHeight()));
644 if (aTxt
.Overlaps(aFrmRect
) && nAnchor
!= RndStdIds::FLY_AS_CHAR
&& !bIgnoreWrap
)
648 case WrapTextMode_NONE
:
649 aTxt
.SetTop( aFrmRect
.Bottom() + nTxtLineHeight
);
650 aTxt
.SetBottom( aTxt
.Top() + nTxtLineHeight
- 1 );
653 case WrapTextMode_LEFT
:
654 aTxt
.SetRight( aFrmRect
.Left() );
657 case WrapTextMode_RIGHT
:
658 aTxt
.SetLeft( aFrmRect
.Right() );
663 if (pOuterFrame
->Contains(aTxt
))
664 DrawRect_Impl(rRenderContext
, aTxt
, m_aTxtCol
, m_aTransColor
);
667 aTxt
.SetRight( nOldR
);
668 aTxt
.SetLeft( nOldL
);
670 aTxt
.Move(0, -nStep
);
672 if (nAnchor
!= RndStdIds::FLY_AT_FLY
&& aTxt
.Bottom() > aParaPrtArea
.Bottom())
674 // Text has been replaced by frame, so adjust parameters height
675 sal_Int32 nDiff
= aTxt
.Bottom() - aParaPrtArea
.Bottom();
676 aParaPrtArea
.AdjustBottom(nDiff
);
677 aPara
.AdjustBottom(nDiff
);
679 CalcBoundRect_Impl(rRenderContext
, aRect
);
681 aParaPrtArea
.AdjustBottom( -nDiff
);
682 aPara
.AdjustBottom( -nDiff
);
684 if (nAnchor
== RndStdIds::FLY_AT_CHAR
&& bIgnoreWrap
)
685 rRenderContext
.DrawText(aAutoCharFrame
, OUString('A'));
689 rRenderContext
.DrawText(aParaPrtArea
, DEMOTEXT
);
690 DrawRect_Impl(rRenderContext
, aDrawObj
, m_aBlankCol
, m_aBlankFrameCol
);
693 // Draw rectangle on which the frame is aligned:
694 DrawRect_Impl(rRenderContext
, aRect
, m_aTransColor
, m_aAlignColor
);
697 bool bDontFill
= (nAnchor
== RndStdIds::FLY_AT_CHAR
&& aFrmRect
.Overlaps(aAutoCharFrame
)) || bTrans
;
698 DrawRect_Impl(rRenderContext
, aFrmRect
, bDontFill
? m_aTransColor
: m_aBgCol
, m_aFrameColor
);
701 void SwFrameExample::SetRelPos(const Point
& rP
)
716 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */