1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drpcps.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
39 #include <hintids.hxx>
40 #define _SVSTDARR_STRINGSDTOR
41 #define _SVSTDARR_STRINGSISORTDTOR
42 #include <svtools/svstdarr.hxx>
45 #include "swmodule.hxx"
48 #include "globals.hrc"
51 #ifndef _METRIC_HXX //autogen
52 #include <vcl/metric.hxx>
54 #include <svtools/stritem.hxx>
55 #include <svx/fontitem.hxx>
56 #include <svx/htmlmode.hxx>
57 #include <sfx2/objsh.hxx>
58 #include <svx/svxfont.hxx>
59 #include <vcl/print.hxx>
60 #include <sfx2/printer.hxx>
61 #ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
62 #include <com/sun/star/i18n/ScriptType.hdl>
64 #include <svx/scripttypeitem.hxx>
65 #include <com/sun/star/i18n/XBreakIterator.hpp>
66 #include <comphelper/processfactory.hxx>
68 #define _SVSTDARR_XUB_STRLEN
69 #define _SVSTDARR_USHORTS
70 #define _SVSTDARR_ULONGS
71 #include <svtools/svstdarr.hxx>
73 #include "charatr.hxx"
74 #include "viewopt.hxx"
78 #include "charfmt.hxx"
84 using namespace ::com::sun::star
;
85 using namespace ::com::sun::star::uno
;
86 using namespace ::com::sun::star::lang
;
87 //using namespace i18n; !using this namespace leads to mysterious conflicts with ScriptType::...!
88 // so don't use this instead of the following defines!
90 #define I18N ::com::sun::star::i18n
91 #define I18N_SCRIPTTYPE ::com::sun::star::i18n::ScriptType
93 // Globals ******************************************************************
95 static USHORT __FAR_DATA aPageRg
[] = {
96 RES_PARATR_DROP
, RES_PARATR_DROP
,
102 // class SwDropCapsPict *****************************************************
104 class SwDropCapsPict
: public Control
109 Color maTextLineColor
;
118 SvULongs maTextWidth
;
119 SvXub_StrLens maScriptChg
;
120 SvUShorts maScriptType
;
125 Reference
< I18N::XBreakIterator
> xBreak
;
127 virtual void Paint(const Rectangle
&rRect
);
128 void CheckScript( void );
129 Size
CalcTextSize( void );
130 inline void InitPrinter( void );
131 void _InitPrinter( void );
132 void GetFontSettings( const SwDropCapsPage
& _rPage
, Font
& _rFont
, USHORT _nWhich
);
135 SwDropCapsPict(Window
*pParent
, const ResId
&rResId
) :
136 Control(pParent
, rResId
), mpPrinter( NULL
), mbDelPrinter( FALSE
) {}
139 void UpdatePaintSettings( void ); // also invalidates control!
141 inline void SetText( const String
& rT
);
142 inline void SetLines( BYTE nL
);
143 inline void SetDistance( USHORT nD
);
144 inline void SetValues( const String
& rText
, BYTE nLines
, USHORT nDistance
);
146 void DrawPrev( const Point
& rPt
);
149 inline void SwDropCapsPict::SetText( const String
& rT
)
152 UpdatePaintSettings();
155 inline void SwDropCapsPict::SetLines( BYTE nL
)
158 UpdatePaintSettings();
161 inline void SwDropCapsPict::SetDistance( USHORT nD
)
164 UpdatePaintSettings();
167 inline void SwDropCapsPict::SetValues( const String
& rText
, BYTE nLines
, USHORT nDistance
)
171 mnDistance
= nDistance
;
173 UpdatePaintSettings();
176 inline void SwDropCapsPict::InitPrinter( void )
182 /****************************************************************************
183 Default-String aus Zeichenanzahl erzeugen (A, AB, ABC, ...)
184 ****************************************************************************/
187 String
GetDefaultString(USHORT nChars
)
190 for (USHORT i
= 0; i
< nChars
; i
++)
191 aStr
+= String((char) (i
+ 65));
195 static void calcFontHeightAnyAscent( OutputDevice
* _pWin
, Font
& _rFont
, long& _nHeight
, long& _nAscent
)
199 _pWin
->SetFont( _rFont
);
200 FontMetric
aMetric( _pWin
->GetFontMetric() );
201 _nHeight
= aMetric
.GetLineHeight();
202 _nAscent
= aMetric
.GetAscent();
206 /****************************************************************************
208 ****************************************************************************/
211 SwDropCapsPict::~SwDropCapsPict()
217 /****************************************************************************
219 ****************************************************************************/
224 void SwDropCapsPict::GetFontSettings( const SwDropCapsPage
& _rPage
, Font
& _rFont
, USHORT _nWhich
)
226 SfxItemSet
aSet( _rPage
.rSh
.GetAttrPool(), _nWhich
, _nWhich
);
227 _rPage
.rSh
.GetCurAttr(aSet
);
228 SvxFontItem
aFmtFont((SvxFontItem
&) aSet
.Get(_nWhich
));
230 _rFont
.SetFamily (aFmtFont
.GetFamily());
231 _rFont
.SetName (aFmtFont
.GetFamilyName());
232 _rFont
.SetPitch (aFmtFont
.GetPitch());
233 _rFont
.SetCharSet(aFmtFont
.GetCharSet());
236 void SwDropCapsPict::UpdatePaintSettings( void )
238 maBackColor
= GetSettings().GetStyleSettings().GetWindowColor();
239 maTextLineColor
= Color( COL_LIGHTGRAY
);
242 mnTotLineH
= (GetOutputSizePixel().Height() - 2 * BORDER
) / LINES
;
243 mnLineH
= mnTotLineH
- 2;
244 mnLeading
= GetFontMetric().GetIntLeading();
248 SwDropCapsPage
* pPage
= ( SwDropCapsPage
* ) GetParent();
249 if (!pPage
->aTemplateBox
.GetSelectEntryPos())
251 // Font an Absatzanfang erfragen
252 pPage
->rSh
.SttCrsrMove();
254 pPage
->rSh
.ClearMark();
255 SwWhichPara pSwuifnParaCurr
= GetfnParaCurr();
256 SwPosPara pSwuifnParaStart
= GetfnParaStart();
257 pPage
->rSh
.MovePara(pSwuifnParaCurr
,pSwuifnParaStart
);
259 GetFontSettings( *pPage
, aFont
, RES_CHRATR_FONT
);
262 GetFontSettings( *pPage
, maCJKFont
, RES_CHRATR_CJK_FONT
);
265 GetFontSettings( *pPage
, maCTLFont
, RES_CHRATR_CTL_FONT
);
267 pPage
->rSh
.Pop(FALSE
);
268 pPage
->rSh
.EndCrsrMove();
272 // Font an Zeichenvorlage erfragen
273 SwCharFmt
*pFmt
= pPage
->rSh
.GetCharStyle(
274 pPage
->aTemplateBox
.GetSelectEntry(),
275 SwWrtShell::GETSTYLE_CREATEANY
);
276 ASSERT(pFmt
, "Zeichenvorlage existiert nicht!");
277 const SvxFontItem
&rFmtFont
= pFmt
->GetFont();
279 aFont
.SetFamily (rFmtFont
.GetFamily());
280 aFont
.SetName (rFmtFont
.GetFamilyName());
281 aFont
.SetPitch (rFmtFont
.GetPitch());
282 aFont
.SetCharSet(rFmtFont
.GetCharSet());
286 mnTextH
= mnLines
* mnTotLineH
;
287 aFont
.SetSize(Size(0, mnTextH
));
288 maCJKFont
.SetSize(Size(0, mnTextH
));
289 maCTLFont
.SetSize(Size(0, mnTextH
));
291 aFont
.SetTransparent(TRUE
);
292 maCJKFont
.SetTransparent(TRUE
);
293 maCTLFont
.SetTransparent(TRUE
);
295 aFont
.SetColor( SwViewOption::GetFontColor() );
296 maCJKFont
.SetColor( SwViewOption::GetFontColor() );
297 maCTLFont
.SetColor( SwViewOption::GetFontColor() );
299 aFont
.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor());
300 maCJKFont
.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor());
301 maCTLFont
.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor());
303 maCJKFont
.SetSize(Size(0, maCJKFont
.GetSize().Height() + mnLeading
));
304 maCTLFont
.SetSize(Size(0, maCTLFont
.GetSize().Height() + mnLeading
));
307 aFont
.SetSize(Size(0, aFont
.GetSize().Height() + mnLeading
));
313 maTextSize
= CalcTextSize();
318 /****************************************************************************
320 ****************************************************************************/
322 void SwDropCapsPict::Paint(const Rectangle
&/*rRect*/)
327 SetMapMode(MapMode(MAP_PIXEL
));
330 SetFillColor( maBackColor
);
332 Size
aOutputSizePixel( GetOutputSizePixel() );
334 DrawRect(Rectangle(Point(0, 0), aOutputSizePixel
));
335 SetClipRegion(Region(Rectangle(
336 Point(BORDER
, BORDER
),
337 Size (aOutputSizePixel
.Width () - 2 * BORDER
,
338 aOutputSizePixel
.Height() - 2 * BORDER
))));
340 ASSERT(mnLineH
> 0, "So klein lassen wir uns nicht machen");
341 long nY0
= (aOutputSizePixel
.Height() - (LINES
* mnTotLineH
)) / 2;
342 SetFillColor( maTextLineColor
);
343 for (USHORT i
= 0; i
< LINES
; ++i
)
344 DrawRect(Rectangle(Point(BORDER
, nY0
+ i
* mnTotLineH
), Size(aOutputSizePixel
.Width() - 2 * BORDER
, mnLineH
)));
346 // Texthintergrund mit Abstand (240 twips ~ 1 Zeilenhoehe)
347 ULONG lDistance
= mnDistance
;
348 USHORT nDistW
= (USHORT
) (ULONG
) (((lDistance
* 100) / 240) * mnTotLineH
) / 100;
349 SetFillColor( maBackColor
);
350 if(((SwDropCapsPage
*)GetParent())->aDropCapsBox
.IsChecked())
352 Size
aTextSize( maTextSize
);
353 aTextSize
.Width() += nDistW
;
354 DrawRect( Rectangle( Point( BORDER
, nY0
), aTextSize
) );
357 DrawPrev( Point( BORDER
, nY0
- mnLeading
) );
363 void SwDropCapsPict::DrawPrev( const Point
& rPt
)
368 Font aOldFont
= mpPrinter
->GetFont();
371 xub_StrLen nStart
= 0;
373 USHORT nCnt
= maScriptChg
.Count();
377 nEnd
= maScriptChg
[ nIdx
];
378 nScript
= maScriptType
[ nIdx
];
383 nScript
= I18N_SCRIPTTYPE::LATIN
;
387 SvxFont
& rFnt
= (nScript
==I18N_SCRIPTTYPE::ASIAN
) ? maCJKFont
: ((nScript
==I18N_SCRIPTTYPE::COMPLEX
) ? maCTLFont
: maFont
);
388 mpPrinter
->SetFont( rFnt
);
390 rFnt
.DrawPrev( this, mpPrinter
, aPt
, maText
, nStart
, nEnd
- nStart
);
392 aPt
.X() += maTextWidth
[ nIdx
++ ];
393 if( nEnd
< maText
.Len() && nIdx
< nCnt
)
396 nEnd
= maScriptChg
[ nIdx
];
397 nScript
= maScriptType
[ nIdx
];
403 mpPrinter
->SetFont( aOldFont
);
406 void SwDropCapsPict::CheckScript( void )
408 if( maScriptText
== maText
)
411 maScriptText
= maText
;
412 USHORT nCnt
= maScriptChg
.Count();
415 maScriptChg
.Remove( 0, nCnt
);
416 maScriptType
.Remove( 0, nCnt
);
417 maTextWidth
.Remove( 0, nCnt
);
422 Reference
< XMultiServiceFactory
> xMSF
= ::comphelper::getProcessServiceFactory();
423 xBreak
= Reference
< I18N::XBreakIterator
>(xMSF
->createInstance(
424 ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),UNO_QUERY
);
428 USHORT nScript
= xBreak
->getScriptType( maText
, 0 );
430 if( I18N_SCRIPTTYPE::WEAK
== nScript
)
432 nChg
= (xub_StrLen
)xBreak
->endOfScript( maText
, nChg
, nScript
);
433 if( nChg
< maText
.Len() )
434 nScript
= xBreak
->getScriptType( maText
, nChg
);
436 nScript
= I18N_SCRIPTTYPE::LATIN
;
441 nChg
= (xub_StrLen
)xBreak
->endOfScript( maText
, nChg
, nScript
);
442 maScriptChg
.Insert( nChg
, nCnt
);
443 maScriptType
.Insert( nScript
, nCnt
);
444 maTextWidth
.Insert( ULONG(0), nCnt
++ );
446 if( nChg
< maText
.Len() )
447 nScript
= xBreak
->getScriptType( maText
, nChg
);
454 Size
SwDropCapsPict::CalcTextSize( void )
460 xub_StrLen nStart
= 0;
462 USHORT nCnt
= maScriptChg
.Count();
465 nEnd
= maScriptChg
[ nIdx
];
466 nScript
= maScriptType
[ nIdx
];
471 nScript
= I18N_SCRIPTTYPE::LATIN
;
482 SvxFont
& rFnt
= ( nScript
== I18N_SCRIPTTYPE::ASIAN
)? maCJKFont
:
483 ( ( nScript
== I18N_SCRIPTTYPE::COMPLEX
)? maCTLFont
: maFont
);
484 ULONG nWidth
= rFnt
.GetTxtSize( mpPrinter
, maText
, nStart
, nEnd
-nStart
).Width();
486 if( nIdx
< maTextWidth
.Count() )
487 maTextWidth
[ nIdx
++ ] = nWidth
;
491 case I18N_SCRIPTTYPE::ASIAN
:
492 calcFontHeightAnyAscent( this, maCJKFont
, nCJKHeight
, nCJKAscent
);
494 case I18N_SCRIPTTYPE::COMPLEX
:
495 calcFontHeightAnyAscent( this, maCTLFont
, nCTLHeight
, nCTLAscent
);
498 calcFontHeightAnyAscent( this, maFont
, nHeight
, nAscent
);
501 if( nEnd
< maText
.Len() && nIdx
< nCnt
)
504 nEnd
= maScriptChg
[ nIdx
];
505 nScript
= maScriptType
[ nIdx
];
512 nCJKHeight
-= nCJKAscent
;
513 nCTLHeight
-= nCTLAscent
;
514 if( nHeight
< nCJKHeight
)
515 nHeight
= nCJKHeight
;
516 if( nAscent
< nCJKAscent
)
517 nAscent
= nCJKAscent
;
518 if( nHeight
< nCTLHeight
)
519 nHeight
= nCTLHeight
;
520 if( nAscent
< nCTLAscent
)
521 nAscent
= nCTLAscent
;
524 Size
aTxtSize( nTxtWidth
, nHeight
);
528 void SwDropCapsPict::_InitPrinter()
530 SfxViewShell
* pSh
= SfxViewShell::Current();
533 mpPrinter
= pSh
->GetPrinter();
537 mpPrinter
= new Printer
;
542 /****************************************************************************
544 ****************************************************************************/
547 SwDropCapsDlg::SwDropCapsDlg(Window
*pParent
, const SfxItemSet
&rSet
) :
549 SfxSingleTabDialog(pParent
, rSet
, 0)
552 SwDropCapsPage
* pNewPage
= (SwDropCapsPage
*) SwDropCapsPage::Create(this, rSet
);
553 pNewPage
->SetFormat(FALSE
);
554 SetTabPage(pNewPage
);
557 /****************************************************************************
559 ****************************************************************************/
562 SwDropCapsDlg::~SwDropCapsDlg()
566 /****************************************************************************
568 ****************************************************************************/
571 SwDropCapsPage::SwDropCapsPage(Window
*pParent
, const SfxItemSet
&rSet
) :
573 SfxTabPage(pParent
, SW_RES(TP_DROPCAPS
), rSet
),
575 aDropCapsBox (this, SW_RES(CB_SWITCH
)),
576 aWholeWordCB (this, SW_RES(CB_WORD
)),
577 aSwitchText (this, SW_RES(FT_DROPCAPS
)),
578 aDropCapsField(this, SW_RES(FLD_DROPCAPS
)),
579 aLinesText (this, SW_RES(TXT_LINES
)),
580 aLinesField (this, SW_RES(FLD_LINES
)),
581 aDistanceText (this, SW_RES(TXT_DISTANCE
)),
582 aDistanceField(this, SW_RES(FLD_DISTANCE
)),
583 aSettingsFL (this, SW_RES(FL_SETTINGS
)),
585 aTextText (this, SW_RES(TXT_TEXT
)),
586 aTextEdit (this, SW_RES(EDT_TEXT
)),
587 aTemplateText (this, SW_RES(TXT_TEMPLATE
)),
588 aTemplateBox (this, SW_RES(BOX_TEMPLATE
)),
589 aContentFL (this, SW_RES(FL_CONTENT
)),
591 pPict (new SwDropCapsPict(this, SW_RES(CNT_PICT
))),
595 rSh(::GetActiveView()->GetWrtShell())
598 SetExchangeSupport();
600 USHORT nHtmlMode
= ::GetHtmlMode((const SwDocShell
*)SfxObjectShell::Current());
601 bHtmlMode
= nHtmlMode
& HTMLMODE_ON
? TRUE
: FALSE
;
603 //Im Vorlagendialog kann der Text nicht beeinflusst werden
604 aTextText
.Enable( !bFormat
);
605 aTextEdit
.Enable( !bFormat
);
608 SetMetric( aDistanceField
, GetDfltMetric(bHtmlMode
) );
610 pPict
->SetBorderStyle( WINDOW_BORDER_MONO
);
612 // Handler installieren
613 Link aLk
= LINK(this, SwDropCapsPage
, ModifyHdl
);
614 aDropCapsField
.SetModifyHdl( aLk
);
615 aLinesField
.SetModifyHdl( aLk
);
616 aDistanceField
.SetModifyHdl( aLk
);
617 aTextEdit
.SetModifyHdl( aLk
);
618 aDropCapsBox
.SetClickHdl (LINK(this, SwDropCapsPage
, ClickHdl
));
619 aTemplateBox
.SetSelectHdl(LINK(this, SwDropCapsPage
, SelectHdl
));
620 aWholeWordCB
.SetClickHdl (LINK(this, SwDropCapsPage
, WholeWordHdl
));
623 /****************************************************************************
625 ****************************************************************************/
628 SwDropCapsPage::~SwDropCapsPage()
634 int SwDropCapsPage::DeactivatePage(SfxItemSet
* _pSet
)
642 /****************************************************************************
644 ****************************************************************************/
647 SfxTabPage
* SwDropCapsPage::Create(Window
*pParent
,
648 const SfxItemSet
&rSet
)
650 return new SwDropCapsPage(pParent
, rSet
);
653 /****************************************************************************
654 Page: FillItemSet-Overload
655 ****************************************************************************/
658 BOOL
SwDropCapsPage::FillItemSet(SfxItemSet
&rSet
)
665 /****************************************************************************
667 ****************************************************************************/
670 void SwDropCapsPage::Reset(const SfxItemSet
&rSet
)
672 // Zeichen, Zeilen, Abstand und Text
673 SwFmtDrop
aFmtDrop((SwFmtDrop
&) rSet
.Get(RES_PARATR_DROP
));
674 if (aFmtDrop
.GetLines() > 1)
676 aDropCapsField
.SetValue(aFmtDrop
.GetChars());
677 aLinesField
.SetValue(aFmtDrop
.GetLines());
678 aDistanceField
.SetValue(aDistanceField
.Normalize(aFmtDrop
.GetDistance()), FUNIT_TWIP
);
679 aWholeWordCB
.Check (aFmtDrop
.GetWholeWord());
683 aDropCapsField
.SetValue(1);
684 aLinesField
.SetValue(3);
685 aDistanceField
.SetValue(0);
688 ::FillCharStyleListBox(aTemplateBox
, rSh
.GetView().GetDocShell(), TRUE
);
690 aTemplateBox
.InsertEntry(SW_RESSTR(SW_STR_NONE
), 0);
692 aTemplateBox
.SelectEntryPos(0);
693 if (aFmtDrop
.GetCharFmt())
694 aTemplateBox
.SelectEntry(aFmtDrop
.GetCharFmt()->GetName());
697 aDropCapsBox
.Check(aFmtDrop
.GetLines() > 1);
698 const USHORT nVal
= USHORT(aDropCapsField
.GetValue());
700 aTextEdit
.SetText(GetDefaultString(nVal
));
703 aTextEdit
.SetText(rSh
.GetDropTxt(nVal
));
709 pPict
->SetValues( aTextEdit
.GetText(),
710 BYTE( aLinesField
.GetValue() ),
711 USHORT( aDistanceField
.Denormalize( aDistanceField
.GetValue( FUNIT_TWIP
) ) ) );
713 ClickHdl(&aDropCapsBox
);
717 /****************************************************************************
718 Page: Click-Handler der CheckBox
719 ****************************************************************************/
722 IMPL_LINK( SwDropCapsPage
, ClickHdl
, Button
*, EMPTYARG
)
724 BOOL bChecked
= aDropCapsBox
.IsChecked();
726 aWholeWordCB
.Enable( bChecked
&& !bHtmlMode
);
728 aSwitchText
.Enable( bChecked
&& !aWholeWordCB
.IsChecked() );
729 aDropCapsField
.Enable( bChecked
&& !aWholeWordCB
.IsChecked() );
730 aLinesText
.Enable( bChecked
);
731 aLinesField
.Enable( bChecked
);
732 aDistanceText
.Enable( bChecked
);
733 aDistanceField
.Enable( bChecked
);
734 aTemplateText
.Enable( bChecked
);
735 aTemplateBox
.Enable( bChecked
);
736 aTextEdit
.Enable( bChecked
&& !bFormat
);
737 aTextText
.Enable( bChecked
&& !bFormat
);
741 ModifyHdl(&aDropCapsField
);
742 aDropCapsField
.GrabFocus();
745 pPict
->SetText(aEmptyStr
);
752 /****************************************************************************
753 Page: Click-Handler der CheckBox
754 ****************************************************************************/
757 IMPL_LINK( SwDropCapsPage
, WholeWordHdl
, CheckBox
*, EMPTYARG
)
759 aDropCapsField
.Enable( !aWholeWordCB
.IsChecked() );
761 ModifyHdl(&aDropCapsField
);
768 /****************************************************************************
769 Page: Modify-Handler der SpinFields
770 ****************************************************************************/
773 IMPL_LINK( SwDropCapsPage
, ModifyHdl
, Edit
*, pEdit
)
778 if (pEdit
== &aDropCapsField
)
781 BOOL bSetText
= FALSE
;
783 if (!aWholeWordCB
.IsChecked())
784 nVal
= (USHORT
)aDropCapsField
.GetValue();
788 if (bFormat
|| !rSh
.GetDropTxt(1).Len())
789 sPreview
= GetDefaultString(nVal
);
793 sPreview
= rSh
.GetDropTxt(nVal
);
796 String
sEdit(aTextEdit
.GetText());
798 if (sEdit
.Len() && sPreview
.CompareTo(sEdit
, sEdit
.Len()) != COMPARE_EQUAL
)
800 sPreview
= sEdit
.Copy(0, sPreview
.Len());
805 aTextEdit
.SetText(sPreview
);
807 else if (pEdit
== &aTextEdit
) // Ggf. Anzahl setzen
809 USHORT nTmp
= aTextEdit
.GetText().Len();
810 aDropCapsField
.SetValue(Max((USHORT
)1, nTmp
));
812 sPreview
= aTextEdit
.GetText().Copy(0, nTmp
);
816 if (pEdit
== &aDropCapsField
|| pEdit
== &aTextEdit
)
817 pPict
->SetText (sPreview
);
818 else if (pEdit
== &aLinesField
)
819 pPict
->SetLines((BYTE
)aLinesField
.GetValue());
821 pPict
->SetDistance((USHORT
)aDistanceField
.Denormalize(aDistanceField
.GetValue(FUNIT_TWIP
)));
828 /****************************************************************************
829 Page: Select-Handler der Template-Box.
830 *****************************************************************************/
833 IMPL_LINK_INLINE_START( SwDropCapsPage
, SelectHdl
, ListBox
*, EMPTYARG
)
835 pPict
->UpdatePaintSettings();
839 IMPL_LINK_INLINE_END( SwDropCapsPage
, SelectHdl
, ListBox
*, EMPTYARG
)
842 USHORT
* SwDropCapsPage::GetRanges()
848 void SwDropCapsPage::FillSet( SfxItemSet
&rSet
)
854 BOOL bOn
= aDropCapsBox
.IsChecked();
857 // Anzahl, Zeilen, Abstand
858 aFmt
.GetChars() = (BYTE
) aDropCapsField
.GetValue();
859 aFmt
.GetLines() = (BYTE
) aLinesField
.GetValue();
860 aFmt
.GetDistance() = (USHORT
) aDistanceField
.Denormalize(aDistanceField
.GetValue(FUNIT_TWIP
));
861 aFmt
.GetWholeWord() = aWholeWordCB
.IsChecked();
864 if (aTemplateBox
.GetSelectEntryPos())
865 aFmt
.SetCharFmt(rSh
.GetCharStyle(aTemplateBox
.GetSelectEntry()));
871 aFmt
.GetDistance() = 0;
875 const SfxPoolItem
* pOldItem
;
876 if(0 == (pOldItem
= GetOldItem( rSet
, FN_FORMAT_DROPCAPS
)) ||
880 // Harte Textformatierung
881 // Bug 24974: In Gestalter/Vorlagenkatoplog macht das keinen Sinn!!
882 if( !bFormat
&& aDropCapsBox
.IsChecked() )
884 String
sText(aTextEdit
.GetText());
886 if (!aWholeWordCB
.IsChecked())
887 sText
.Erase( static_cast< xub_StrLen
>(aDropCapsField
.GetValue()));
889 SfxStringItem
aStr(FN_PARAM_1
, sText
);