xref: /AOO41X/main/svx/source/dialog/swframeexample.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <tools/poly.hxx>
29cdf0e10cSrcweir #include <vcl/metric.hxx>
30cdf0e10cSrcweir #include <vcl/svapp.hxx>
31cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
32cdf0e10cSrcweir #include <svx/swframeexample.hxx>
33cdf0e10cSrcweir #include <com/sun/star/text/TextContentAnchorType.hpp>
34cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
35cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp>
36cdf0e10cSrcweir #include <com/sun/star/text/RelOrientation.hpp>
37cdf0e10cSrcweir #include <com/sun/star/text/WrapTextMode.hpp>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir using namespace ::com::sun::star::text;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #define FLYINFLY_BORDER 3
42cdf0e10cSrcweir #define DEMOTEXT        "Ij"
43cdf0e10cSrcweir #define C2S(cChar) UniString::CreateFromAscii(cChar)
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
SvxSwFrameExample(Window * pParent,const ResId & rResID)46cdf0e10cSrcweir SvxSwFrameExample::SvxSwFrameExample( Window *pParent, const ResId& rResID ) :
47cdf0e10cSrcweir 
48cdf0e10cSrcweir     Window(pParent, rResID),
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     nHAlign     (HoriOrientation::CENTER),
51cdf0e10cSrcweir     nHRel       (RelOrientation::FRAME),
52cdf0e10cSrcweir     nVAlign     (VertOrientation::TOP),
53cdf0e10cSrcweir     nVRel       (RelOrientation::PRINT_AREA),
54cdf0e10cSrcweir     nWrap       (WrapTextMode_NONE),
55cdf0e10cSrcweir     nAnchor     (TextContentAnchorType_AT_PAGE),
56cdf0e10cSrcweir     bTrans      (sal_False),
57cdf0e10cSrcweir     aRelPos     (Point(0,0))
58cdf0e10cSrcweir {
59cdf0e10cSrcweir     InitColors_Impl();
60cdf0e10cSrcweir     SetMapMode(MAP_PIXEL);
61cdf0e10cSrcweir }
62cdf0e10cSrcweir 
~SvxSwFrameExample()63cdf0e10cSrcweir SvxSwFrameExample::~SvxSwFrameExample()
64cdf0e10cSrcweir {
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
InitColors_Impl(void)67cdf0e10cSrcweir void SvxSwFrameExample::InitColors_Impl( void )
68cdf0e10cSrcweir {
69cdf0e10cSrcweir     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
70cdf0e10cSrcweir     m_aBgCol = Color( rSettings.GetWindowColor() );                             // old: COL_WHITE
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     sal_Bool bHC = rSettings.GetHighContrastMode();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     m_aFrameColor = Color( COL_LIGHTGREEN );
75cdf0e10cSrcweir     m_aAlignColor = Color( COL_LIGHTRED );
76cdf0e10cSrcweir     m_aTransColor = Color( COL_TRANSPARENT );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     m_aTxtCol = bHC?
79cdf0e10cSrcweir         svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR).nColor :
80cdf0e10cSrcweir         Color( COL_GRAY );      // old: COL_GRAY
81cdf0e10cSrcweir     m_aPrintAreaCol = bHC? m_aTxtCol : Color( COL_GRAY );
82cdf0e10cSrcweir     m_aBorderCol = m_aTxtCol;                                                   // old: COL_BLACK;
83cdf0e10cSrcweir     m_aBlankCol = bHC? m_aTxtCol : Color( COL_LIGHTGRAY );
84cdf0e10cSrcweir     m_aBlankFrameCol = bHC? m_aTxtCol : Color( COL_GRAY );
85cdf0e10cSrcweir }
86cdf0e10cSrcweir 
DataChanged(const DataChangedEvent & rDCEvt)87cdf0e10cSrcweir void SvxSwFrameExample::DataChanged( const DataChangedEvent& rDCEvt )
88cdf0e10cSrcweir {
89cdf0e10cSrcweir     Window::DataChanged( rDCEvt );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
92cdf0e10cSrcweir         InitColors_Impl();
93cdf0e10cSrcweir }
94cdf0e10cSrcweir 
InitAllRects_Impl()95cdf0e10cSrcweir void SvxSwFrameExample::InitAllRects_Impl()
96cdf0e10cSrcweir {
97cdf0e10cSrcweir //    const Size aSz(GetOutputSizePixel());
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     // Seite
100cdf0e10cSrcweir //    aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3));
101cdf0e10cSrcweir     aPage.SetSize( GetOutputSizePixel() );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     sal_uIntPtr nOutWPix = aPage.GetWidth();
104cdf0e10cSrcweir     sal_uIntPtr nOutHPix = aPage.GetHeight();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // PrintArea
107cdf0e10cSrcweir     sal_uIntPtr nLBorder;
108cdf0e10cSrcweir     sal_uIntPtr nRBorder;
109cdf0e10cSrcweir     sal_uIntPtr nTBorder;
110cdf0e10cSrcweir     sal_uIntPtr nBBorder;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     sal_uIntPtr nLTxtBorder;
113cdf0e10cSrcweir     sal_uIntPtr nRTxtBorder;
114cdf0e10cSrcweir     sal_uIntPtr nTTxtBorder;
115cdf0e10cSrcweir     sal_uIntPtr nBTxtBorder;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     if (nAnchor != TextContentAnchorType_AS_CHARACTER)
118cdf0e10cSrcweir     {
119cdf0e10cSrcweir         nLBorder = 14;
120cdf0e10cSrcweir         nRBorder = 10;
121cdf0e10cSrcweir         nTBorder = 10;
122cdf0e10cSrcweir         nBBorder = 15;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir         nLTxtBorder = 8;
125cdf0e10cSrcweir         nRTxtBorder = 4;
126cdf0e10cSrcweir         nTTxtBorder = 2;
127cdf0e10cSrcweir         nBTxtBorder = 2;
128cdf0e10cSrcweir     }
129cdf0e10cSrcweir     else
130cdf0e10cSrcweir     {
131cdf0e10cSrcweir         nLBorder = 2;
132cdf0e10cSrcweir         nRBorder = 2;
133cdf0e10cSrcweir         nTBorder = 2;
134cdf0e10cSrcweir         nBBorder = 2;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         nLTxtBorder = 2;
137cdf0e10cSrcweir         nRTxtBorder = 2;
138cdf0e10cSrcweir         nTTxtBorder = 2;
139cdf0e10cSrcweir         nBTxtBorder = 2;
140cdf0e10cSrcweir     }
141cdf0e10cSrcweir     aPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder));
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     // Beispiel-Text: Vorbereiten fuer die Textausgabe
144cdf0e10cSrcweir     // Eine Textzeile
145cdf0e10cSrcweir     aTextLine = aPagePrtArea;
146cdf0e10cSrcweir     aTextLine.SetSize(Size(aTextLine.GetWidth(), 2));
147cdf0e10cSrcweir     aTextLine.Left()    += nLTxtBorder;
148cdf0e10cSrcweir     aTextLine.Right()   -= nRTxtBorder;
149cdf0e10cSrcweir     aTextLine.Move(0, nTTxtBorder);
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     // Rechteck um Absatz incl. Raender
152cdf0e10cSrcweir     sal_uInt16 nLines = (sal_uInt16)((aPagePrtArea.GetHeight() / 2 - nTTxtBorder - nBTxtBorder)
153cdf0e10cSrcweir              / (aTextLine.GetHeight() + 2));
154cdf0e10cSrcweir     aPara = aPagePrtArea;
155cdf0e10cSrcweir     aPara.SetSize(Size(aPara.GetWidth(),
156cdf0e10cSrcweir         (aTextLine.GetHeight() + 2) * nLines + nTTxtBorder + nBTxtBorder));
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     // Rechteck um Absatz ohne Raender
159cdf0e10cSrcweir     aParaPrtArea = aPara;
160cdf0e10cSrcweir     aParaPrtArea.Left()     += nLTxtBorder;
161cdf0e10cSrcweir     aParaPrtArea.Right()    -= nRTxtBorder;
162cdf0e10cSrcweir     aParaPrtArea.Top()      += nTTxtBorder;
163cdf0e10cSrcweir     aParaPrtArea.Bottom()   -= nBTxtBorder;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     if (nAnchor == TextContentAnchorType_AS_CHARACTER || nAnchor == TextContentAnchorType_AT_CHARACTER)
166cdf0e10cSrcweir     {
167cdf0e10cSrcweir         Font aFont = OutputDevice::GetDefaultFont(
168cdf0e10cSrcweir                                 DEFAULTFONT_LATIN_TEXT, Application::GetSettings().GetLanguage(),
169cdf0e10cSrcweir                                 DEFAULTFONT_FLAGS_ONLYONE, this );
170cdf0e10cSrcweir         aFont.SetColor( m_aTxtCol );
171cdf0e10cSrcweir         aFont.SetFillColor( m_aBgCol );
172cdf0e10cSrcweir         aFont.SetWeight(WEIGHT_NORMAL);
173cdf0e10cSrcweir 
174cdf0e10cSrcweir         if (nAnchor == TextContentAnchorType_AS_CHARACTER)
175cdf0e10cSrcweir         {
176cdf0e10cSrcweir             aFont.SetSize(Size(0, aParaPrtArea.GetHeight() - 2));
177cdf0e10cSrcweir             SetFont(aFont);
178cdf0e10cSrcweir             aParaPrtArea.SetSize(Size(GetTextWidth(C2S(DEMOTEXT)), GetTextHeight()));
179cdf0e10cSrcweir         }
180cdf0e10cSrcweir         else
181cdf0e10cSrcweir         {
182cdf0e10cSrcweir             aFont.SetSize(Size(0, aParaPrtArea.GetHeight() / 2));
183cdf0e10cSrcweir             SetFont(aFont);
184cdf0e10cSrcweir             aAutoCharFrame.SetSize(Size(GetTextWidth('A'), GetTextHeight()));
185cdf0e10cSrcweir             aAutoCharFrame.SetPos(Point(aParaPrtArea.Left() + (aParaPrtArea.GetWidth() - aAutoCharFrame.GetWidth()) / 2,
186cdf0e10cSrcweir                 aParaPrtArea.Top() + (aParaPrtArea.GetHeight() - aAutoCharFrame.GetHeight()) / 2));
187cdf0e10cSrcweir         }
188cdf0e10cSrcweir     }
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     // Innerer Frame fuer am Frame verankerte Rahmen
191cdf0e10cSrcweir     aFrameAtFrame = aPara;
192cdf0e10cSrcweir     aFrameAtFrame.Left() += 9;
193cdf0e10cSrcweir     aFrameAtFrame.Right() -= 5;
194cdf0e10cSrcweir     aFrameAtFrame.Bottom() += 5;
195cdf0e10cSrcweir     aFrameAtFrame.SetPos(Point(aFrameAtFrame.Left() + 2, (aPagePrtArea.Bottom() - aFrameAtFrame.GetHeight()) / 2 + 5));
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     // Groesse des zu positionierenden Rahmens
198cdf0e10cSrcweir     if (nAnchor != TextContentAnchorType_AS_CHARACTER)
199cdf0e10cSrcweir     {
200cdf0e10cSrcweir         sal_uIntPtr nLFBorder = nAnchor == TextContentAnchorType_AT_PAGE ? nLBorder : nLTxtBorder;
201cdf0e10cSrcweir         sal_uIntPtr nRFBorder = nAnchor == TextContentAnchorType_AT_PAGE ? nRBorder : nRTxtBorder;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir         switch (nHRel)
204cdf0e10cSrcweir         {
205cdf0e10cSrcweir             case RelOrientation::PAGE_LEFT:
206cdf0e10cSrcweir             case RelOrientation::FRAME_LEFT:
207cdf0e10cSrcweir                 aFrmSize = Size(nLFBorder - 4, (aTextLine.GetHeight() + 2) * 3);
208cdf0e10cSrcweir                 break;
209cdf0e10cSrcweir 
210cdf0e10cSrcweir             case RelOrientation::PAGE_RIGHT:
211cdf0e10cSrcweir             case RelOrientation::FRAME_RIGHT:
212cdf0e10cSrcweir                 aFrmSize = Size(nRFBorder - 4, (aTextLine.GetHeight() + 2) * 3);
213cdf0e10cSrcweir                 break;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir             default:
216cdf0e10cSrcweir                 aFrmSize = Size(nLBorder - 3, (aTextLine.GetHeight() + 2) * 3);
217cdf0e10cSrcweir                 break;
218cdf0e10cSrcweir         }
219cdf0e10cSrcweir         aFrmSize.Width() = Max(5L, aFrmSize.Width());
220cdf0e10cSrcweir         aFrmSize.Height() = Max(5L, aFrmSize.Height());
221cdf0e10cSrcweir     }
222cdf0e10cSrcweir     else
223cdf0e10cSrcweir     {
224cdf0e10cSrcweir         sal_uIntPtr nFreeWidth = aPagePrtArea.GetWidth() - GetTextWidth(C2S(DEMOTEXT));
225cdf0e10cSrcweir 
226cdf0e10cSrcweir         aFrmSize = Size(nFreeWidth / 2, (aTextLine.GetHeight() + 2) * 3);
227cdf0e10cSrcweir         aDrawObj.SetSize(Size(Max(5L, (long)nFreeWidth / 3L), Max(5L, aFrmSize.Height() * 3L)));
228cdf0e10cSrcweir         aDrawObj.SetPos(Point(aParaPrtArea.Right() + 1, aParaPrtArea.Bottom() / 2));
229cdf0e10cSrcweir         aParaPrtArea.Right() = aDrawObj.Right();
230cdf0e10cSrcweir     }
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
CalcBoundRect_Impl(Rectangle & rRect)233cdf0e10cSrcweir void SvxSwFrameExample::CalcBoundRect_Impl(Rectangle &rRect)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     switch (nAnchor)
236cdf0e10cSrcweir     {
237cdf0e10cSrcweir         case TextContentAnchorType_AT_PAGE:
238cdf0e10cSrcweir         {
239cdf0e10cSrcweir             switch (nHRel)
240cdf0e10cSrcweir             {
241cdf0e10cSrcweir                 case RelOrientation::FRAME:
242cdf0e10cSrcweir                 case RelOrientation::PAGE_FRAME:
243cdf0e10cSrcweir                     rRect.Left() = aPage.Left();
244cdf0e10cSrcweir                     rRect.Right() = aPage.Right();
245cdf0e10cSrcweir                     break;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir                 case RelOrientation::PRINT_AREA:
248cdf0e10cSrcweir                 case RelOrientation::PAGE_PRINT_AREA:
249cdf0e10cSrcweir                     rRect.Left() = aPagePrtArea.Left();
250cdf0e10cSrcweir                     rRect.Right() = aPagePrtArea.Right();
251cdf0e10cSrcweir                     break;
252cdf0e10cSrcweir 
253cdf0e10cSrcweir                 case RelOrientation::PAGE_LEFT:
254cdf0e10cSrcweir                     rRect.Left() = aPage.Left();
255cdf0e10cSrcweir                     rRect.Right() = aPagePrtArea.Left();
256cdf0e10cSrcweir                     break;
257cdf0e10cSrcweir 
258cdf0e10cSrcweir                 case RelOrientation::PAGE_RIGHT:
259cdf0e10cSrcweir                     rRect.Left() = aPagePrtArea.Right();
260cdf0e10cSrcweir                     rRect.Right() = aPage.Right();
261cdf0e10cSrcweir                     break;
262cdf0e10cSrcweir             }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir             switch (nVRel)
265cdf0e10cSrcweir             {
266cdf0e10cSrcweir                 case RelOrientation::PRINT_AREA:
267cdf0e10cSrcweir                 case RelOrientation::PAGE_PRINT_AREA:
268cdf0e10cSrcweir                     rRect.Top() = aPagePrtArea.Top();
269cdf0e10cSrcweir                     rRect.Bottom() = aPagePrtArea.Bottom();
270cdf0e10cSrcweir                     break;
271cdf0e10cSrcweir 
272cdf0e10cSrcweir                 case RelOrientation::FRAME:
273cdf0e10cSrcweir                 case RelOrientation::PAGE_FRAME:
274cdf0e10cSrcweir                     rRect.Top() = aPage.Top();
275cdf0e10cSrcweir                     rRect.Bottom() = aPage.Bottom();
276cdf0e10cSrcweir                     break;
277cdf0e10cSrcweir             }
278cdf0e10cSrcweir         }
279cdf0e10cSrcweir         break;
280cdf0e10cSrcweir 
281cdf0e10cSrcweir         case TextContentAnchorType_AT_FRAME:
282cdf0e10cSrcweir         {
283cdf0e10cSrcweir             switch (nHRel)
284cdf0e10cSrcweir             {
285cdf0e10cSrcweir                 case RelOrientation::FRAME:
286cdf0e10cSrcweir                 case RelOrientation::PAGE_FRAME:
287cdf0e10cSrcweir                     rRect.Left() = aFrameAtFrame.Left();
288cdf0e10cSrcweir                     rRect.Right() = aFrameAtFrame.Right();
289cdf0e10cSrcweir                     break;
290cdf0e10cSrcweir 
291cdf0e10cSrcweir                 case RelOrientation::PRINT_AREA:
292cdf0e10cSrcweir                 case RelOrientation::PAGE_PRINT_AREA:
293cdf0e10cSrcweir                     rRect.Left() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
294cdf0e10cSrcweir                     rRect.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
295cdf0e10cSrcweir                     break;
296cdf0e10cSrcweir 
297cdf0e10cSrcweir                 case RelOrientation::PAGE_RIGHT:
298cdf0e10cSrcweir                     rRect.Left() = aFrameAtFrame.Left();
299cdf0e10cSrcweir                     rRect.Right() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
300cdf0e10cSrcweir                     break;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir                 case RelOrientation::PAGE_LEFT:
303cdf0e10cSrcweir                     rRect.Left() = aFrameAtFrame.Right();
304cdf0e10cSrcweir                     rRect.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
305cdf0e10cSrcweir                     break;
306cdf0e10cSrcweir             }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir             switch (nVRel)
309cdf0e10cSrcweir             {
310cdf0e10cSrcweir                 case RelOrientation::FRAME:
311cdf0e10cSrcweir                 case RelOrientation::PAGE_FRAME:
312cdf0e10cSrcweir                     rRect.Top() = aFrameAtFrame.Top();
313cdf0e10cSrcweir                     rRect.Bottom() = aFrameAtFrame.Bottom();
314cdf0e10cSrcweir                     break;
315cdf0e10cSrcweir 
316cdf0e10cSrcweir                 case RelOrientation::PRINT_AREA:
317cdf0e10cSrcweir                 case RelOrientation::PAGE_PRINT_AREA:
318cdf0e10cSrcweir                     rRect.Top() = aFrameAtFrame.Top() + FLYINFLY_BORDER;
319cdf0e10cSrcweir                     rRect.Bottom() = aFrameAtFrame.Bottom() - FLYINFLY_BORDER;
320cdf0e10cSrcweir                     break;
321cdf0e10cSrcweir             }
322cdf0e10cSrcweir         }
323cdf0e10cSrcweir         break;
324cdf0e10cSrcweir         case TextContentAnchorType_AT_PARAGRAPH:
325cdf0e10cSrcweir         case TextContentAnchorType_AT_CHARACTER:
326cdf0e10cSrcweir         {
327cdf0e10cSrcweir             switch (nHRel)
328cdf0e10cSrcweir             {
329cdf0e10cSrcweir                 case RelOrientation::FRAME:
330cdf0e10cSrcweir                     rRect.Left() = aPara.Left();
331cdf0e10cSrcweir                     rRect.Right() = aPara.Right();
332cdf0e10cSrcweir                     break;
333cdf0e10cSrcweir 
334cdf0e10cSrcweir                 case RelOrientation::PRINT_AREA:
335cdf0e10cSrcweir                     rRect.Left() = aParaPrtArea.Left();
336cdf0e10cSrcweir                     rRect.Right() = aParaPrtArea.Right();
337cdf0e10cSrcweir                     break;
338cdf0e10cSrcweir 
339cdf0e10cSrcweir                 case RelOrientation::PAGE_LEFT:
340cdf0e10cSrcweir                     rRect.Left() = aPage.Left();
341cdf0e10cSrcweir                     rRect.Right() = aPagePrtArea.Left();
342cdf0e10cSrcweir                     break;
343cdf0e10cSrcweir 
344cdf0e10cSrcweir                 case RelOrientation::PAGE_RIGHT:
345cdf0e10cSrcweir                     rRect.Left() = aPagePrtArea.Right();
346cdf0e10cSrcweir                     rRect.Right() = aPage.Right();
347cdf0e10cSrcweir                     break;
348cdf0e10cSrcweir 
349cdf0e10cSrcweir                 case RelOrientation::PAGE_FRAME:
350cdf0e10cSrcweir                     rRect.Left() = aPage.Left();
351cdf0e10cSrcweir                     rRect.Right() = aPage.Right();
352cdf0e10cSrcweir                     break;
353cdf0e10cSrcweir 
354cdf0e10cSrcweir                 case RelOrientation::PAGE_PRINT_AREA:
355cdf0e10cSrcweir                     rRect.Left() = aPagePrtArea.Left();
356cdf0e10cSrcweir                     rRect.Right() = aPagePrtArea.Right();
357cdf0e10cSrcweir                     break;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir                 case RelOrientation::FRAME_LEFT:
360cdf0e10cSrcweir                     rRect.Left() = aPara.Left();
361cdf0e10cSrcweir                     rRect.Right() = aParaPrtArea.Left();
362cdf0e10cSrcweir                     break;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir                 case RelOrientation::FRAME_RIGHT:
365cdf0e10cSrcweir                     rRect.Left() = aParaPrtArea.Right();
366cdf0e10cSrcweir                     rRect.Right() = aPara.Right();
367cdf0e10cSrcweir                     break;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir                 case RelOrientation::CHAR:
370cdf0e10cSrcweir                     rRect.Left() = aAutoCharFrame.Left();
371cdf0e10cSrcweir                     rRect.Right() = aAutoCharFrame.Left();
372cdf0e10cSrcweir                     break;
373cdf0e10cSrcweir             }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir             switch (nVRel)
376cdf0e10cSrcweir             {
377cdf0e10cSrcweir                 case RelOrientation::FRAME:
378cdf0e10cSrcweir                     rRect.Top() = aPara.Top();
379cdf0e10cSrcweir                     rRect.Bottom() = aPara.Bottom();
380cdf0e10cSrcweir                     break;
381cdf0e10cSrcweir 
382cdf0e10cSrcweir                 case RelOrientation::PRINT_AREA:
383cdf0e10cSrcweir                     rRect.Top() = aParaPrtArea.Top();
384cdf0e10cSrcweir                     rRect.Bottom() = aParaPrtArea.Bottom();
385cdf0e10cSrcweir                     break;
386cdf0e10cSrcweir 
387cdf0e10cSrcweir                 case RelOrientation::CHAR:
388cdf0e10cSrcweir                     if (nVAlign != VertOrientation::NONE &&
389cdf0e10cSrcweir                                 nVAlign != VertOrientation::CHAR_BOTTOM)
390cdf0e10cSrcweir                         rRect.Top() = aAutoCharFrame.Top();
391cdf0e10cSrcweir                     else
392cdf0e10cSrcweir                         rRect.Top() = aAutoCharFrame.Bottom();
393cdf0e10cSrcweir                     rRect.Bottom() = aAutoCharFrame.Bottom();
394cdf0e10cSrcweir                     break;
395cdf0e10cSrcweir                 // OD 12.11.2003 #i22341#
396cdf0e10cSrcweir                 case RelOrientation::TEXT_LINE:
397cdf0e10cSrcweir                     rRect.Top() = aAutoCharFrame.Top();
398cdf0e10cSrcweir                     rRect.Bottom() = aAutoCharFrame.Top();
399cdf0e10cSrcweir                 break;
400cdf0e10cSrcweir             }
401cdf0e10cSrcweir         }
402cdf0e10cSrcweir         break;
403cdf0e10cSrcweir 
404cdf0e10cSrcweir         case TextContentAnchorType_AS_CHARACTER:
405cdf0e10cSrcweir             rRect.Left() = aParaPrtArea.Left();
406cdf0e10cSrcweir             rRect.Right() = aParaPrtArea.Right();
407cdf0e10cSrcweir 
408cdf0e10cSrcweir             switch (nVAlign)
409cdf0e10cSrcweir             {
410cdf0e10cSrcweir                 case VertOrientation::NONE:
411cdf0e10cSrcweir                 case VertOrientation::TOP:
412cdf0e10cSrcweir                 case VertOrientation::CENTER:
413cdf0e10cSrcweir                 case VertOrientation::BOTTOM:
414cdf0e10cSrcweir                 {
415cdf0e10cSrcweir                     FontMetric aMetric(GetFontMetric());
416cdf0e10cSrcweir 
417cdf0e10cSrcweir                     rRect.Top() = aParaPrtArea.Bottom() - aMetric.GetDescent();
418cdf0e10cSrcweir                     rRect.Bottom() = rRect.Top();
419cdf0e10cSrcweir                 }
420cdf0e10cSrcweir                 break;
421cdf0e10cSrcweir 
422cdf0e10cSrcweir                 default:
423cdf0e10cSrcweir 
424cdf0e10cSrcweir                 case VertOrientation::LINE_TOP:
425cdf0e10cSrcweir                 case VertOrientation::LINE_CENTER:
426cdf0e10cSrcweir                 case VertOrientation::LINE_BOTTOM:
427cdf0e10cSrcweir                     rRect.Top() = aParaPrtArea.Top();
428cdf0e10cSrcweir                     rRect.Bottom() = aDrawObj.Bottom();
429cdf0e10cSrcweir                     break;
430cdf0e10cSrcweir 
431cdf0e10cSrcweir                 case VertOrientation::CHAR_TOP:
432cdf0e10cSrcweir                 case VertOrientation::CHAR_CENTER:
433cdf0e10cSrcweir                 case VertOrientation::CHAR_BOTTOM:
434cdf0e10cSrcweir                     rRect.Top() = aParaPrtArea.Top();
435cdf0e10cSrcweir                     rRect.Bottom() = aParaPrtArea.Bottom();
436cdf0e10cSrcweir                     break;
437cdf0e10cSrcweir             }
438cdf0e10cSrcweir             break;
439cdf0e10cSrcweir 
440cdf0e10cSrcweir         default:
441cdf0e10cSrcweir             break;
442cdf0e10cSrcweir     }
443cdf0e10cSrcweir }
444cdf0e10cSrcweir 
DrawInnerFrame_Impl(const Rectangle & rRect,const Color & rFillColor,const Color & rBorderColor)445cdf0e10cSrcweir Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor)
446cdf0e10cSrcweir {
447cdf0e10cSrcweir     DrawRect_Impl(rRect, rFillColor, rBorderColor);
448cdf0e10cSrcweir 
449cdf0e10cSrcweir     // Bereich, zu dem relativ positioniert wird, bestimmen
450cdf0e10cSrcweir     Rectangle aRect(rRect); // aPagePrtArea = Default
451cdf0e10cSrcweir     CalcBoundRect_Impl(aRect);
452cdf0e10cSrcweir 
453cdf0e10cSrcweir     if (nAnchor == TextContentAnchorType_AT_FRAME && &rRect == &aPagePrtArea)
454cdf0e10cSrcweir     {
455cdf0e10cSrcweir         // Testabsatz zeichnen
456cdf0e10cSrcweir         Rectangle aTxt(aTextLine);
457cdf0e10cSrcweir         sal_Int32 nStep = aTxt.GetHeight() + 2;
458cdf0e10cSrcweir         sal_uInt16 nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
459cdf0e10cSrcweir 
460cdf0e10cSrcweir         for (sal_uInt16 i = 0; i < nLines; i++)
461cdf0e10cSrcweir         {
462cdf0e10cSrcweir             if (i == nLines - 1)
463cdf0e10cSrcweir                 aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight()));
464cdf0e10cSrcweir             DrawRect_Impl(aTxt, m_aTxtCol, m_aTransColor);
465cdf0e10cSrcweir             aTxt.Move(0, nStep);
466cdf0e10cSrcweir         }
467cdf0e10cSrcweir     }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir     return aRect;
470cdf0e10cSrcweir }
471cdf0e10cSrcweir 
Paint(const Rectangle &)472cdf0e10cSrcweir void SvxSwFrameExample::Paint(const Rectangle&)
473cdf0e10cSrcweir {
474cdf0e10cSrcweir     InitAllRects_Impl();
475cdf0e10cSrcweir 
476cdf0e10cSrcweir     // Schatten zeichnen
477cdf0e10cSrcweir //    Rectangle aShadow(aPage);
478cdf0e10cSrcweir //    aShadow += Point(3, 3);
479cdf0e10cSrcweir //    DrawRect_Impl(aShadow, Color(COL_GRAY), aTransColor);
480cdf0e10cSrcweir 
481cdf0e10cSrcweir     // Seite zeichnen
482cdf0e10cSrcweir     DrawRect_Impl( aPage, m_aBgCol, m_aBorderCol );
483cdf0e10cSrcweir 
484cdf0e10cSrcweir     // PrintArea zeichnen
485cdf0e10cSrcweir     Rectangle aRect = DrawInnerFrame_Impl( aPagePrtArea, m_aTransColor, m_aPrintAreaCol );
486cdf0e10cSrcweir 
487cdf0e10cSrcweir     if (nAnchor == TextContentAnchorType_AT_FRAME)
488cdf0e10cSrcweir         aRect = DrawInnerFrame_Impl( aFrameAtFrame, m_aBgCol, m_aBorderCol );
489cdf0e10cSrcweir 
490cdf0e10cSrcweir     long lXPos    = 0;
491cdf0e10cSrcweir     long lYPos    = 0;
492cdf0e10cSrcweir 
493cdf0e10cSrcweir     // Horizontale Ausrichtung
494cdf0e10cSrcweir     //
495cdf0e10cSrcweir     if (nAnchor != TextContentAnchorType_AS_CHARACTER)
496cdf0e10cSrcweir     {
497cdf0e10cSrcweir         switch (nHAlign)
498cdf0e10cSrcweir         {
499cdf0e10cSrcweir             case HoriOrientation::RIGHT:
500cdf0e10cSrcweir             {
501cdf0e10cSrcweir                 lXPos = aRect.Right() - aFrmSize.Width() + 1;
502cdf0e10cSrcweir                 break;
503cdf0e10cSrcweir             }
504cdf0e10cSrcweir             case HoriOrientation::CENTER:
505cdf0e10cSrcweir             {
506cdf0e10cSrcweir                 lXPos = aRect.Left() + (aRect.GetWidth() - aFrmSize.Width()) / 2;
507cdf0e10cSrcweir                 break;
508cdf0e10cSrcweir             }
509cdf0e10cSrcweir             case HoriOrientation::NONE:
510cdf0e10cSrcweir             {
511cdf0e10cSrcweir                 lXPos = aRect.Left() + aRelPos.X();
512cdf0e10cSrcweir                 break;
513cdf0e10cSrcweir             }
514cdf0e10cSrcweir 
515cdf0e10cSrcweir             default: // HoriOrientation::LEFT
516cdf0e10cSrcweir                 lXPos = aRect.Left();
517cdf0e10cSrcweir                 break;
518cdf0e10cSrcweir         }
519cdf0e10cSrcweir     }
520cdf0e10cSrcweir     else
521cdf0e10cSrcweir        lXPos = aRect.Right() + 2;
522cdf0e10cSrcweir 
523cdf0e10cSrcweir     // Vertikale Ausrichtung
524cdf0e10cSrcweir     //
525cdf0e10cSrcweir     if (nAnchor != TextContentAnchorType_AS_CHARACTER)
526cdf0e10cSrcweir     {
527cdf0e10cSrcweir         switch (nVAlign)
528cdf0e10cSrcweir         {
529cdf0e10cSrcweir             case VertOrientation::BOTTOM:
530cdf0e10cSrcweir             case VertOrientation::LINE_BOTTOM:
531cdf0e10cSrcweir             {
532cdf0e10cSrcweir                 // OD 12.11.2003 #i22341#
533cdf0e10cSrcweir                 if ( nVRel != RelOrientation::TEXT_LINE )
534cdf0e10cSrcweir                 {
535cdf0e10cSrcweir                     lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
536cdf0e10cSrcweir                 }
537cdf0e10cSrcweir                 else
538cdf0e10cSrcweir                 {
539cdf0e10cSrcweir                     lYPos = aRect.Top();
540cdf0e10cSrcweir                 }
541cdf0e10cSrcweir                 break;
542cdf0e10cSrcweir             }
543cdf0e10cSrcweir             case VertOrientation::CENTER:
544cdf0e10cSrcweir             case VertOrientation::LINE_CENTER:
545cdf0e10cSrcweir             {
546cdf0e10cSrcweir                 lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2;
547cdf0e10cSrcweir                 break;
548cdf0e10cSrcweir             }
549cdf0e10cSrcweir             case VertOrientation::NONE:
550cdf0e10cSrcweir             {
551cdf0e10cSrcweir                 // OD 12.11.2003 #i22341#
552cdf0e10cSrcweir                 if ( nVRel != RelOrientation::CHAR && nVRel != RelOrientation::TEXT_LINE )
553cdf0e10cSrcweir                     lYPos = aRect.Top() + aRelPos.Y();
554cdf0e10cSrcweir                 else
555cdf0e10cSrcweir                     lYPos = aRect.Top() - aRelPos.Y();
556cdf0e10cSrcweir                 break;
557cdf0e10cSrcweir             }
558cdf0e10cSrcweir             default:
559cdf0e10cSrcweir                 // OD 12.11.2003 #i22341#
560cdf0e10cSrcweir                 if ( nVRel != RelOrientation::TEXT_LINE )
561cdf0e10cSrcweir                 {
562cdf0e10cSrcweir                     lYPos = aRect.Top();
563cdf0e10cSrcweir                 }
564cdf0e10cSrcweir                 else
565cdf0e10cSrcweir                 {
566cdf0e10cSrcweir                     lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
567cdf0e10cSrcweir                 }
568cdf0e10cSrcweir                 break;
569cdf0e10cSrcweir         }
570cdf0e10cSrcweir     }
571cdf0e10cSrcweir     else
572cdf0e10cSrcweir     {
573cdf0e10cSrcweir         switch(nVAlign)
574cdf0e10cSrcweir         {
575cdf0e10cSrcweir             case VertOrientation::CENTER:
576cdf0e10cSrcweir             case VertOrientation::CHAR_CENTER:
577cdf0e10cSrcweir             case VertOrientation::LINE_CENTER:
578cdf0e10cSrcweir                 lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2;
579cdf0e10cSrcweir                 break;
580cdf0e10cSrcweir 
581cdf0e10cSrcweir             case VertOrientation::TOP:
582cdf0e10cSrcweir             case VertOrientation::CHAR_BOTTOM:
583cdf0e10cSrcweir             case VertOrientation::LINE_BOTTOM:
584cdf0e10cSrcweir                 lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
585cdf0e10cSrcweir                 break;
586cdf0e10cSrcweir 
587cdf0e10cSrcweir /*          case VertOrientation::NONE:
588cdf0e10cSrcweir             case VertOrientation::BOTTOM:
589cdf0e10cSrcweir             case VertOrientation::CHAR_TOP:
590cdf0e10cSrcweir             case VertOrientation::LINE_TOP:*/
591cdf0e10cSrcweir             default:
592cdf0e10cSrcweir                 lYPos = aRect.Top() - aRelPos.Y();
593cdf0e10cSrcweir                 break;
594cdf0e10cSrcweir         }
595cdf0e10cSrcweir     }
596cdf0e10cSrcweir 
597cdf0e10cSrcweir     Rectangle aFrmRect(Point(lXPos, lYPos), aFrmSize);
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     Rectangle *pOuterFrame = &aPage;
600cdf0e10cSrcweir 
601cdf0e10cSrcweir     if (nAnchor == TextContentAnchorType_AT_FRAME)
602cdf0e10cSrcweir         pOuterFrame = &aFrameAtFrame;
603cdf0e10cSrcweir 
604cdf0e10cSrcweir     if (aFrmRect.Left() < pOuterFrame->Left())
605cdf0e10cSrcweir         aFrmRect.Move(pOuterFrame->Left() - aFrmRect.Left(), 0);
606cdf0e10cSrcweir     if (aFrmRect.Right() > pOuterFrame->Right())
607cdf0e10cSrcweir         aFrmRect.Move(pOuterFrame->Right() - aFrmRect.Right(), 0);
608cdf0e10cSrcweir 
609cdf0e10cSrcweir     if (aFrmRect.Top() < pOuterFrame->Top())
610cdf0e10cSrcweir         aFrmRect.Move(0, pOuterFrame->Top() - aFrmRect.Top());
611cdf0e10cSrcweir     if (aFrmRect.Bottom() > pOuterFrame->Bottom())
612cdf0e10cSrcweir         aFrmRect.Move(0, pOuterFrame->Bottom() - aFrmRect.Bottom());
613cdf0e10cSrcweir 
614cdf0e10cSrcweir     // Testabsatz zeichnen
615cdf0e10cSrcweir     const long nTxtLineHeight = aTextLine.GetHeight();
616cdf0e10cSrcweir     Rectangle aTxt(aTextLine);
617cdf0e10cSrcweir     sal_Int32 nStep;
618cdf0e10cSrcweir     sal_uInt16 nLines;
619cdf0e10cSrcweir 
620cdf0e10cSrcweir     if (nAnchor == TextContentAnchorType_AT_FRAME)
621cdf0e10cSrcweir     {
622cdf0e10cSrcweir         aTxt.Left() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
623cdf0e10cSrcweir         aTxt.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
624cdf0e10cSrcweir         aTxt.Top() = aFrameAtFrame.Top() + FLYINFLY_BORDER;
625cdf0e10cSrcweir         aTxt.Bottom() = aTxt.Top() + aTextLine.GetHeight() - 1;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir         nStep = aTxt.GetHeight() + 2;
628cdf0e10cSrcweir         nLines = (sal_uInt16)(((aFrameAtFrame.GetHeight() - 2 * FLYINFLY_BORDER) * 2 / 3)
629cdf0e10cSrcweir                  / (aTxt.GetHeight() + 2));
630cdf0e10cSrcweir     }
631cdf0e10cSrcweir     else
632cdf0e10cSrcweir     {
633cdf0e10cSrcweir         nStep = aTxt.GetHeight() + 2;
634cdf0e10cSrcweir         nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
635cdf0e10cSrcweir     }
636cdf0e10cSrcweir 
637cdf0e10cSrcweir     if (nAnchor != TextContentAnchorType_AS_CHARACTER)
638cdf0e10cSrcweir     {
639cdf0e10cSrcweir         // Text simulieren
640cdf0e10cSrcweir         //
641cdf0e10cSrcweir         const long nOldR = aTxt.Right();
642cdf0e10cSrcweir         const long nOldL = aTxt.Left();
643cdf0e10cSrcweir 
644cdf0e10cSrcweir         // OD 12.11.2003 #i22341#
645cdf0e10cSrcweir         const bool bIgnoreWrap = nAnchor == TextContentAnchorType_AT_CHARACTER &&
646cdf0e10cSrcweir                            ( nHRel == RelOrientation::CHAR || nVRel == RelOrientation::CHAR ||
647cdf0e10cSrcweir                              nVRel == RelOrientation::TEXT_LINE );
648cdf0e10cSrcweir 
649cdf0e10cSrcweir         for (sal_uInt16 i = 0; i < nLines; ++i)
650cdf0e10cSrcweir         {
651cdf0e10cSrcweir             if (i == (nLines - 1))
652cdf0e10cSrcweir                 aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight()));
653cdf0e10cSrcweir 
654cdf0e10cSrcweir             if (aTxt.IsOver(aFrmRect) && nAnchor != TextContentAnchorType_AS_CHARACTER && !bIgnoreWrap)
655cdf0e10cSrcweir             {
656cdf0e10cSrcweir                 switch(nWrap)
657cdf0e10cSrcweir                 {
658cdf0e10cSrcweir                     case WrapTextMode_NONE:
659cdf0e10cSrcweir                         aTxt.Top()    = aFrmRect.Bottom() + nTxtLineHeight;
660cdf0e10cSrcweir                         aTxt.Bottom() = aTxt.Top() + nTxtLineHeight - 1;
661cdf0e10cSrcweir                         break;
662cdf0e10cSrcweir 
663cdf0e10cSrcweir                     case WrapTextMode_LEFT:
664cdf0e10cSrcweir                         aTxt.Right() = aFrmRect.Left();
665cdf0e10cSrcweir                         break;
666cdf0e10cSrcweir 
667cdf0e10cSrcweir                     case WrapTextMode_RIGHT:
668cdf0e10cSrcweir                         aTxt.Left() = aFrmRect.Right();
669cdf0e10cSrcweir                         break;
670cdf0e10cSrcweir                 }
671cdf0e10cSrcweir             }
672cdf0e10cSrcweir             if (pOuterFrame->IsInside(aTxt))
673cdf0e10cSrcweir                 DrawRect_Impl( aTxt, m_aTxtCol, m_aTransColor );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir             aTxt.Move(0, nStep);
676cdf0e10cSrcweir             aTxt.Right() = nOldR;
677cdf0e10cSrcweir             aTxt.Left()  = nOldL;
678cdf0e10cSrcweir         }
679cdf0e10cSrcweir         aTxt.Move(0, -nStep);
680cdf0e10cSrcweir 
681cdf0e10cSrcweir         if (nAnchor != TextContentAnchorType_AT_FRAME && aTxt.Bottom() > aParaPrtArea.Bottom())
682cdf0e10cSrcweir         {
683cdf0e10cSrcweir             // Text wurde durch Rahmen verdraengt, daher Para-Hoehe anpassen
684cdf0e10cSrcweir             sal_uIntPtr nDiff = aTxt.Bottom() - aParaPrtArea.Bottom();
685cdf0e10cSrcweir             aParaPrtArea.Bottom() += nDiff;
686cdf0e10cSrcweir             aPara.Bottom() += nDiff;
687cdf0e10cSrcweir 
688cdf0e10cSrcweir             CalcBoundRect_Impl(aRect);
689cdf0e10cSrcweir 
690cdf0e10cSrcweir             aParaPrtArea.Bottom() -= nDiff;
691cdf0e10cSrcweir             aPara.Bottom() -= nDiff;
692cdf0e10cSrcweir         }
693cdf0e10cSrcweir         if (nAnchor == TextContentAnchorType_AT_CHARACTER && bIgnoreWrap)
694cdf0e10cSrcweir             DrawText(aAutoCharFrame, 'A');
695cdf0e10cSrcweir     }
696cdf0e10cSrcweir     else
697cdf0e10cSrcweir     {
698cdf0e10cSrcweir         DrawText(aParaPrtArea, C2S(DEMOTEXT));
699cdf0e10cSrcweir         DrawRect_Impl(aDrawObj, m_aBlankCol, m_aBlankFrameCol );
700cdf0e10cSrcweir     }
701cdf0e10cSrcweir 
702cdf0e10cSrcweir     // Rechteck zeichnen, zu dem der Rahmen ausgerichtet wird:
703cdf0e10cSrcweir     DrawRect_Impl(aRect, m_aTransColor, m_aAlignColor);
704cdf0e10cSrcweir 
705cdf0e10cSrcweir     // Frame anzeigen
706cdf0e10cSrcweir     sal_Bool bDontFill = (nAnchor == TextContentAnchorType_AT_CHARACTER && aFrmRect.IsOver(aAutoCharFrame)) ? sal_True : bTrans;
707cdf0e10cSrcweir     DrawRect_Impl( aFrmRect, bDontFill? m_aTransColor : m_aBgCol, m_aFrameColor );
708cdf0e10cSrcweir }
709cdf0e10cSrcweir 
SetRelPos(const Point & rP)710cdf0e10cSrcweir void SvxSwFrameExample::SetRelPos(const Point& rP)
711cdf0e10cSrcweir {
712cdf0e10cSrcweir     aRelPos = rP;
713cdf0e10cSrcweir 
714cdf0e10cSrcweir     if (aRelPos.X() > 0)
715cdf0e10cSrcweir         aRelPos.X() = 5;
716cdf0e10cSrcweir     if (aRelPos.X() < 0)
717cdf0e10cSrcweir         aRelPos.X() = -5;
718cdf0e10cSrcweir 
719cdf0e10cSrcweir     if (aRelPos.Y() > 0)
720cdf0e10cSrcweir         aRelPos.Y() = 5;
721cdf0e10cSrcweir     if (aRelPos.Y() < 0)
722cdf0e10cSrcweir         aRelPos.Y() = -5;
723cdf0e10cSrcweir }
724cdf0e10cSrcweir 
DrawRect_Impl(const Rectangle & rRect,const Color & rFillColor,const Color & rLineColor)725cdf0e10cSrcweir void SvxSwFrameExample::DrawRect_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor)
726cdf0e10cSrcweir {
727cdf0e10cSrcweir     SetFillColor(rFillColor);
728cdf0e10cSrcweir     SetLineColor(rLineColor);
729cdf0e10cSrcweir     Window::DrawRect(rRect);
730cdf0e10cSrcweir }
731cdf0e10cSrcweir 
732cdf0e10cSrcweir 
733cdf0e10cSrcweir 
734