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 <i18nutil/unicode.hxx>
21 #include <vcl/builderfactory.hxx>
22 #include <vcl/msgbox.hxx>
23 #include <vcl/field.hxx>
24 #include <vcl/keycodes.hxx>
25 #include <vcl/settings.hxx>
26 #include <sot/exchange.hxx>
27 #include <svtools/transfer.hxx>
28 #include <tools/shl.hxx>
29 #include <unotools/syslocale.hxx>
30 #include <sfx2/objsh.hxx>
31 #include <sfx2/viewsh.hxx>
32 #include <unotools/charclass.hxx>
33 #include <unotools/collatorwrapper.hxx>
34 #include <com/sun/star/i18n/CollatorOptions.hpp>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <comphelper/processfactory.hxx>
37 #include <comphelper/string.hxx>
38 #include <vcl/svapp.hxx>
39 #include <sfx2/module.hxx>
40 #include <sfx2/request.hxx>
41 #include <sfx2/sfxsids.hrc>
42 #include <svl/eitem.hxx>
43 #include <svl/languageoptions.hxx>
44 #include <svx/SmartTagMgr.hxx>
45 #include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
46 #include <com/sun/star/smarttags/XSmartTagAction.hpp>
47 #include <rtl/strbuf.hxx>
49 #include "autocdlg.hxx"
51 #include <editeng/acorrcfg.hxx>
52 #include <editeng/svxacorr.hxx>
53 #include "cuicharmap.hxx"
55 #include <editeng/unolingu.hxx>
56 #include <dialmgr.hxx>
57 #include <svx/svxids.hrc>
58 #include <boost/scoped_ptr.hpp>
60 static LanguageType eLastDialogLanguage
= LANGUAGE_SYSTEM
;
62 using namespace ::com::sun::star::util
;
63 using namespace ::com::sun::star
;
65 OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window
* pParent
, const SfxItemSet
* _pSet
)
66 : SfxTabDialog(pParent
, "AutoCorrectDialog", "cui/ui/autocorrectdialog.ui", _pSet
)
68 get(m_pLanguageBox
, "langbox");
69 get(m_pLanguageLB
, "lang");
71 bool bShowSWOptions
= false;
72 bool bOpenSmartTagOptions
= false;
76 SFX_ITEMSET_ARG( _pSet
, pItem
, SfxBoolItem
, SID_AUTO_CORRECT_DLG
, false );
77 if ( pItem
&& pItem
->GetValue() )
78 bShowSWOptions
= true;
80 SFX_ITEMSET_ARG( _pSet
, pItem2
, SfxBoolItem
, SID_OPEN_SMARTTAGOPTIONS
, false );
81 if ( pItem2
&& pItem2
->GetValue() )
82 bOpenSmartTagOptions
= true;
85 AddTabPage("options", OfaAutocorrOptionsPage::Create
, 0);
86 AddTabPage("apply", OfaSwAutoFmtOptionsPage::Create
, 0);
87 AddTabPage("wordcompletion", OfaAutoCompleteTabPage::Create
, 0);
88 AddTabPage("smarttags", OfaSmartTagOptionsTabPage::Create
, 0);
92 RemoveTabPage("apply");
93 RemoveTabPage("wordcompletion");
94 RemoveTabPage("smarttags");
98 // remove smart tag tab page if no extensions are installed
99 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
100 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
101 if ( !pOpt
|| !pOpt
->pSmartTagMgr
|| 0 == pOpt
->pSmartTagMgr
->NumberOfRecognizers() )
102 RemoveTabPage("smarttags");
104 RemoveTabPage("options");
107 m_nReplacePageId
= AddTabPage("replace", OfaAutocorrReplacePage::Create
, 0);
108 m_nExceptionsPageId
= AddTabPage("exceptions", OfaAutocorrExceptPage::Create
, 0);
109 AddTabPage("localized", OfaQuoteTabPage::Create
, 0);
111 // initialize languages
112 //! LANGUAGE_NONE is displayed as '[All]' and the LanguageType
113 //! will be set to LANGUAGE_UNDETERMINED
114 SvxLanguageListFlags nLangList
= SvxLanguageListFlags::WESTERN
;
116 if( SvtLanguageOptions().IsCTLFontEnabled() )
117 nLangList
|= SvxLanguageListFlags::CTL
;
118 m_pLanguageLB
->SetLanguageList( nLangList
, true, true );
119 m_pLanguageLB
->SelectLanguage( LANGUAGE_NONE
);
120 sal_Int32 nPos
= m_pLanguageLB
->GetSelectEntryPos();
121 DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND
!= nPos
, "listbox entry missing" );
122 m_pLanguageLB
->SetEntryData( nPos
, reinterpret_cast<void*>(LANGUAGE_UNDETERMINED
) );
124 // Initializing doesn't work for static on linux - therefore here
125 if( LANGUAGE_SYSTEM
== eLastDialogLanguage
)
126 eLastDialogLanguage
= Application::GetSettings().GetLanguageTag().getLanguageType();
128 LanguageType nSelectLang
= LANGUAGE_UNDETERMINED
;
129 nPos
= m_pLanguageLB
->GetEntryPos( reinterpret_cast<void*>(eLastDialogLanguage
) );
130 if (LISTBOX_ENTRY_NOTFOUND
!= nPos
)
131 nSelectLang
= eLastDialogLanguage
;
132 m_pLanguageLB
->SelectLanguage( nSelectLang
);
134 m_pLanguageLB
->SetSelectHdl(LINK(this, OfaAutoCorrDlg
, SelectLanguageHdl
));
136 if ( bOpenSmartTagOptions
)
137 SetCurPageId("smarttags");
140 OfaAutoCorrDlg::~OfaAutoCorrDlg()
145 void OfaAutoCorrDlg::dispose()
147 m_pLanguageBox
.clear();
148 m_pLanguageLB
.clear();
149 SfxTabDialog::dispose();
152 void OfaAutoCorrDlg::EnableLanguage(bool bEnable
)
154 m_pLanguageBox
->Enable(bEnable
);
157 static bool lcl_FindEntry( ListBox
& rLB
, const OUString
& rEntry
,
158 CollatorWrapper
& rCmpClass
)
160 sal_Int32 nCount
= rLB
.GetEntryCount();
161 sal_Int32 nSelPos
= rLB
.GetSelectEntryPos();
163 for(i
= 0; i
< nCount
; i
++)
165 if( 0 == rCmpClass
.compareString(rEntry
, rLB
.GetEntry(i
) ))
167 rLB
.SelectEntryPos(i
, true);
171 if(LISTBOX_ENTRY_NOTFOUND
!= nSelPos
)
172 rLB
.SelectEntryPos(nSelPos
, false);
176 IMPL_LINK(OfaAutoCorrDlg
, SelectLanguageHdl
, ListBox
*, pBox
)
178 sal_Int32 nPos
= pBox
->GetSelectEntryPos();
179 void* pVoid
= pBox
->GetEntryData(nPos
);
180 LanguageType eNewLang
= (LanguageType
)reinterpret_cast<sal_IntPtr
>(pVoid
);
181 // save old settings and fill anew
182 if(eNewLang
!= eLastDialogLanguage
)
184 sal_uInt16 nPageId
= GetCurPageId();
185 if (m_nReplacePageId
== nPageId
)
186 static_cast<OfaAutocorrReplacePage
*>(GetTabPage( nPageId
))->SetLanguage(eNewLang
);
187 else if (m_nExceptionsPageId
== nPageId
)
188 static_cast<OfaAutocorrExceptPage
*>(GetTabPage( nPageId
))->SetLanguage(eNewLang
);
193 OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(vcl::Window
* pParent
, const SfxItemSet
& rSet
)
194 : SfxTabPage(pParent
, "AutocorrectOptionsPage", "cui/ui/acoroptionspage.ui", &rSet
)
195 , m_sInput(CUI_RESSTR(RID_SVXSTR_USE_REPLACE
))
196 , m_sDoubleCaps(CUI_RESSTR(RID_SVXSTR_CPTL_STT_WORD
))
197 , m_sStartCap(CUI_RESSTR(RID_SVXSTR_CPTL_STT_SENT
))
198 , m_sBoldUnderline(CUI_RESSTR(RID_SVXSTR_BOLD_UNDER
))
199 , m_sURL(CUI_RESSTR(RID_SVXSTR_DETECT_URL
))
200 , m_sNoDblSpaces(CUI_RESSTR(RID_SVXSTR_NO_DBL_SPACES
))
201 , m_sDash(CUI_RESSTR(RID_SVXSTR_DASH
))
202 , m_sAccidentalCaps(CUI_RESSTR(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK
))
204 get(m_pCheckLB
, "checklist");
207 OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage()
212 void OfaAutocorrOptionsPage::dispose()
215 SfxTabPage::dispose();
218 VclPtr
<SfxTabPage
> OfaAutocorrOptionsPage::Create( vcl::Window
* pParent
,
219 const SfxItemSet
* rSet
)
221 return VclPtr
<OfaAutocorrOptionsPage
>::Create(pParent
, *rSet
);
224 bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet
* )
226 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
227 long nFlags
= pAutoCorrect
->GetFlags();
230 pAutoCorrect
->SetAutoCorrFlag(Autocorrect
, m_pCheckLB
->IsChecked(nPos
++));
231 pAutoCorrect
->SetAutoCorrFlag(CptlSttWrd
, m_pCheckLB
->IsChecked(nPos
++));
232 pAutoCorrect
->SetAutoCorrFlag(CptlSttSntnc
, m_pCheckLB
->IsChecked(nPos
++));
233 pAutoCorrect
->SetAutoCorrFlag(ChgWeightUnderl
, m_pCheckLB
->IsChecked(nPos
++));
234 pAutoCorrect
->SetAutoCorrFlag(SetINetAttr
, m_pCheckLB
->IsChecked(nPos
++));
235 pAutoCorrect
->SetAutoCorrFlag(ChgToEnEmDash
, m_pCheckLB
->IsChecked(nPos
++));
236 pAutoCorrect
->SetAutoCorrFlag(IgnoreDoubleSpace
, m_pCheckLB
->IsChecked(nPos
++));
237 pAutoCorrect
->SetAutoCorrFlag(CorrectCapsLock
, m_pCheckLB
->IsChecked(nPos
++));
239 bool bReturn
= nFlags
!= pAutoCorrect
->GetFlags();
242 SvxAutoCorrCfg
& rCfg
= SvxAutoCorrCfg::Get();
249 void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet
& )
251 static_cast<OfaAutoCorrDlg
*>(GetTabDialog())->EnableLanguage(false);
254 void OfaAutocorrOptionsPage::Reset( const SfxItemSet
* )
256 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
257 const long nFlags
= pAutoCorrect
->GetFlags();
259 m_pCheckLB
->SetUpdateMode(false);
262 m_pCheckLB
->InsertEntry(m_sInput
);
263 m_pCheckLB
->InsertEntry(m_sDoubleCaps
);
264 m_pCheckLB
->InsertEntry(m_sStartCap
);
265 m_pCheckLB
->InsertEntry(m_sBoldUnderline
);
266 m_pCheckLB
->InsertEntry(m_sURL
);
267 m_pCheckLB
->InsertEntry(m_sDash
);
268 m_pCheckLB
->InsertEntry(m_sNoDblSpaces
);
269 m_pCheckLB
->InsertEntry(m_sAccidentalCaps
);
272 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& Autocorrect
) );
273 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& CptlSttWrd
) );
274 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& CptlSttSntnc
) );
275 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& ChgWeightUnderl
) );
276 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& SetINetAttr
) );
277 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& ChgToEnEmDash
) );
278 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& IgnoreDoubleSpace
) );
279 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& CorrectCapsLock
) );
281 m_pCheckLB
->SetUpdateMode(true);
284 /*********************************************************************/
286 /* helping struct for dUserData of the Checklistbox */
288 /*********************************************************************/
295 ImpUserData(OUString
* pText
, vcl::Font
* pFnt
)
296 { pString
= pText
; pFont
= pFnt
;}
300 /*********************************************************************/
302 /* dialog for per cent settings */
304 /*********************************************************************/
306 class OfaAutoFmtPrcntSet
: public ModalDialog
308 VclPtr
<MetricField
> m_pPrcntMF
;
310 OfaAutoFmtPrcntSet(vcl::Window
* pParent
)
311 : ModalDialog(pParent
, "PercentDialog","cui/ui/percentdialog.ui")
313 get(m_pPrcntMF
, "margin");
315 virtual ~OfaAutoFmtPrcntSet() { disposeOnce(); }
316 virtual void dispose() SAL_OVERRIDE
{ m_pPrcntMF
.clear(); ModalDialog::dispose(); }
318 MetricField
& GetPrcntFld()
324 /*********************************************************************/
326 /* changed LBoxString */
328 /*********************************************************************/
330 class OfaImpBrwString
: public SvLBoxString
334 OfaImpBrwString( SvTreeListEntry
* pEntry
, sal_uInt16 nFlags
,
335 const OUString
& rStr
) : SvLBoxString(pEntry
,nFlags
,rStr
){}
337 virtual void Paint(const Point
& rPos
, SvTreeListBox
& rDev
, vcl::RenderContext
& rRenderContext
,
338 const SvViewDataEntry
* pView
, const SvTreeListEntry
* pEntry
) SAL_OVERRIDE
;
341 void OfaImpBrwString::Paint(const Point
& rPos
, SvTreeListBox
& /*rDev*/, vcl::RenderContext
& rRenderContext
,
342 const SvViewDataEntry
* /*pView*/, const SvTreeListEntry
* pEntry
)
344 rRenderContext
.DrawText(rPos
, GetText());
345 if (pEntry
->GetUserData())
347 ImpUserData
* pUserData
= static_cast<ImpUserData
*>(pEntry
->GetUserData());
349 aNewPos
.X() += rRenderContext
.GetTextWidth(GetText());
350 vcl::Font
aOldFont(rRenderContext
.GetFont());
351 vcl::Font
aFont(aOldFont
);
352 if (pUserData
->pFont
)
354 aFont
= *pUserData
->pFont
;
355 aFont
.SetColor(aOldFont
.GetColor());
356 aFont
.SetSize(aOldFont
.GetSize());
358 aFont
.SetWeight(WEIGHT_BOLD
);
363 OUString
sTxt(pUserData
->pString
->getToken(0, 1, nPos
));
366 rRenderContext
.SetFont(aFont
);
368 rRenderContext
.DrawText(aNewPos
, sTxt
);
371 aNewPos
.X() += rRenderContext
.GetTextWidth(sTxt
);
374 rRenderContext
.SetFont(aOldFont
);
381 /*********************************************************************/
383 /* use TabPage autoformat */
385 /*********************************************************************/
387 #define CBCOL_FIRST 0
388 #define CBCOL_SECOND 1
391 enum OfaAutoFmtOptions
399 DEL_SPACES_AT_STT_END
,
400 DEL_SPACES_BETWEEN_LINES
,
410 MERGE_SINGLE_LINE_PARA
413 OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( vcl::Window
* pParent
,
414 const SfxItemSet
& rSet
)
415 : SfxTabPage(pParent
, "ApplyAutoFmtPage", "cui/ui/applyautofmtpage.ui", &rSet
)
416 , sDeleteEmptyPara(CUI_RESSTR(RID_SVXSTR_DEL_EMPTY_PARA
))
417 , sUseReplaceTbl(CUI_RESSTR(RID_SVXSTR_USE_REPLACE
))
418 , sCptlSttWord(CUI_RESSTR(RID_SVXSTR_CPTL_STT_WORD
))
419 , sCptlSttSent(CUI_RESSTR(RID_SVXSTR_CPTL_STT_SENT
))
420 , sUserStyle(CUI_RESSTR(RID_SVXSTR_USER_STYLE
))
421 , sBullet(CUI_RESSTR(RID_SVXSTR_BULLET
))
422 , sBoldUnder(CUI_RESSTR(RID_SVXSTR_BOLD_UNDER
))
423 , sNoDblSpaces(CUI_RESSTR(RID_SVXSTR_NO_DBL_SPACES
))
424 , sCorrectCapsLock(CUI_RESSTR(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK
))
425 , sDetectURL(CUI_RESSTR(RID_SVXSTR_DETECT_URL
))
426 , sDash(CUI_RESSTR(RID_SVXSTR_DASH
))
427 , sRightMargin(CUI_RESSTR(RID_SVXSTR_RIGHT_MARGIN
))
428 , sNum(CUI_RESSTR(RID_SVXSTR_NUM
))
429 , sBorder(CUI_RESSTR(RID_SVXSTR_BORDER
))
430 , sTable(CUI_RESSTR(RID_SVXSTR_CREATE_TABLE
))
431 , sReplaceTemplates(CUI_RESSTR(RID_SVXSTR_REPLACE_TEMPLATES
))
432 , sDelSpaceAtSttEnd(CUI_RESSTR(RID_SVXSTR_DEL_SPACES_AT_STT_END
))
433 , sDelSpaceBetweenLines(CUI_RESSTR(RID_SVXSTR_DEL_SPACES_BETWEEN_LINES
))
435 , pCheckButtonData(NULL
)
437 get(m_pEditPB
, "edit");
439 SvSimpleTableContainer
* pCheckLBContainer(get
<SvSimpleTableContainer
>("list"));
440 Size
aControlSize(248 , 149);
441 aControlSize
= LogicToPixel(aControlSize
, MAP_APPFONT
);
442 pCheckLBContainer
->set_width_request(aControlSize
.Width());
443 pCheckLBContainer
->set_height_request(aControlSize
.Height());
444 m_pCheckLB
= VclPtr
<OfaACorrCheckListBox
>::Create(*pCheckLBContainer
);
446 m_pCheckLB
->SetStyle(m_pCheckLB
->GetStyle()|WB_HSCROLL
| WB_VSCROLL
);
448 m_pCheckLB
->SetSelectHdl(LINK(this, OfaSwAutoFmtOptionsPage
, SelectHdl
));
449 m_pCheckLB
->SetDoubleClickHdl(LINK(this, OfaSwAutoFmtOptionsPage
, EditHdl
));
451 static long aStaticTabs
[]=
456 m_pCheckLB
->SvSimpleTable::SetTabs(aStaticTabs
);
457 OUStringBuffer
sHeader(get
<vcl::Window
>("m")->GetText());
458 sHeader
.append('\t');
459 sHeader
.append(get
<vcl::Window
>("t")->GetText());
460 sHeader
.append('\t');
461 m_pCheckLB
->InsertHeaderEntry(sHeader
.makeStringAndClear(), HEADERBAR_APPEND
,
462 HeaderBarItemBits::CENTER
| HeaderBarItemBits::VCENTER
| HeaderBarItemBits::FIXEDPOS
| HeaderBarItemBits::FIXED
);
464 m_pEditPB
->SetClickHdl(LINK(this, OfaSwAutoFmtOptionsPage
, EditHdl
));
467 SvTreeListEntry
* OfaSwAutoFmtOptionsPage::CreateEntry(OUString
& rTxt
, sal_uInt16 nCol
)
469 SvTreeListEntry
* pEntry
= new SvTreeListEntry
;
471 if ( !pCheckButtonData
)
473 pCheckButtonData
= new SvLBoxButtonData( m_pCheckLB
);
474 m_pCheckLB
->SetCheckButtonData( pCheckButtonData
);
477 pEntry
->AddItem( new SvLBoxContextBmp( pEntry
, 0, Image(), Image(), false));
480 if (nCol
== CBCOL_SECOND
)
481 pEntry
->AddItem( new SvLBoxString( pEntry
, 0, sEmpty
) );
483 pEntry
->AddItem( new SvLBoxButton( pEntry
, SvLBoxButtonKind_enabledCheckbox
, 0, pCheckButtonData
) );
485 if (nCol
== CBCOL_FIRST
)
486 pEntry
->AddItem( new SvLBoxString( pEntry
, 0, sEmpty
) );
488 pEntry
->AddItem( new SvLBoxButton( pEntry
, SvLBoxButtonKind_enabledCheckbox
, 0, pCheckButtonData
) );
489 pEntry
->AddItem( new OfaImpBrwString( pEntry
, 0, rTxt
) );
494 OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage()
499 void OfaSwAutoFmtOptionsPage::dispose()
503 delete static_cast<ImpUserData
*>(m_pCheckLB
->GetUserData( REPLACE_BULLETS
));
504 delete static_cast<ImpUserData
*>(m_pCheckLB
->GetUserData( APPLY_NUMBERING
));
505 delete static_cast<ImpUserData
*>(m_pCheckLB
->GetUserData( MERGE_SINGLE_LINE_PARA
));
506 delete pCheckButtonData
;
507 pCheckButtonData
= NULL
;
509 m_pCheckLB
.disposeAndClear();
511 SfxTabPage::dispose();
514 VclPtr
<SfxTabPage
> OfaSwAutoFmtOptionsPage::Create( vcl::Window
* pParent
,
515 const SfxItemSet
* rAttrSet
)
517 return VclPtr
<OfaSwAutoFmtOptionsPage
>::Create(pParent
, *rAttrSet
);
520 bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet
* )
522 bool bModified
= false;
523 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
524 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
525 long nFlags
= pAutoCorrect
->GetFlags();
527 bool bCheck
= m_pCheckLB
->IsChecked(USE_REPLACE_TABLE
, CBCOL_FIRST
);
528 bModified
|= pOpt
->bAutoCorrect
!= bCheck
;
529 pOpt
->bAutoCorrect
= bCheck
;
530 pAutoCorrect
->SetAutoCorrFlag(Autocorrect
,
531 m_pCheckLB
->IsChecked(USE_REPLACE_TABLE
, CBCOL_SECOND
));
533 bCheck
= m_pCheckLB
->IsChecked(CORR_UPPER
, CBCOL_FIRST
);
534 bModified
|= pOpt
->bCptlSttWrd
!= bCheck
;
535 pOpt
->bCptlSttWrd
= bCheck
;
536 pAutoCorrect
->SetAutoCorrFlag(CptlSttWrd
,
537 m_pCheckLB
->IsChecked(CORR_UPPER
, CBCOL_SECOND
));
539 bCheck
= m_pCheckLB
->IsChecked(BEGIN_UPPER
, CBCOL_FIRST
);
540 bModified
|= pOpt
->bCptlSttSntnc
!= bCheck
;
541 pOpt
->bCptlSttSntnc
= bCheck
;
542 pAutoCorrect
->SetAutoCorrFlag(CptlSttSntnc
,
543 m_pCheckLB
->IsChecked(BEGIN_UPPER
, CBCOL_SECOND
));
545 bCheck
= m_pCheckLB
->IsChecked(BOLD_UNDERLINE
, CBCOL_FIRST
);
546 bModified
|= pOpt
->bChgWeightUnderl
!= bCheck
;
547 pOpt
->bChgWeightUnderl
= bCheck
;
548 pAutoCorrect
->SetAutoCorrFlag(ChgWeightUnderl
,
549 m_pCheckLB
->IsChecked(BOLD_UNDERLINE
, CBCOL_SECOND
));
551 pAutoCorrect
->SetAutoCorrFlag(IgnoreDoubleSpace
,
552 m_pCheckLB
->IsChecked(IGNORE_DBLSPACE
, CBCOL_SECOND
));
554 pAutoCorrect
->SetAutoCorrFlag(CorrectCapsLock
,
555 m_pCheckLB
->IsChecked(CORRECT_CAPS_LOCK
, CBCOL_SECOND
));
557 bCheck
= m_pCheckLB
->IsChecked(DETECT_URL
, CBCOL_FIRST
);
558 bModified
|= pOpt
->bSetINetAttr
!= bCheck
;
559 pOpt
->bSetINetAttr
= bCheck
;
560 pAutoCorrect
->SetAutoCorrFlag(SetINetAttr
,
561 m_pCheckLB
->IsChecked(DETECT_URL
, CBCOL_SECOND
));
563 bCheck
= m_pCheckLB
->IsChecked(DEL_EMPTY_NODE
, CBCOL_FIRST
);
564 bModified
|= pOpt
->bDelEmptyNode
!= bCheck
;
565 pOpt
->bDelEmptyNode
= bCheck
;
567 bCheck
= m_pCheckLB
->IsChecked(REPLACE_USER_COLL
, CBCOL_FIRST
);
568 bModified
|= pOpt
->bChgUserColl
!= bCheck
;
569 pOpt
->bChgUserColl
= bCheck
;
571 bCheck
= m_pCheckLB
->IsChecked(REPLACE_BULLETS
, CBCOL_FIRST
);
572 bModified
|= pOpt
->bChgEnumNum
!= bCheck
;
573 pOpt
->bChgEnumNum
= bCheck
;
574 bModified
|= aBulletFont
!= pOpt
->aBulletFont
;
575 pOpt
->aBulletFont
= aBulletFont
;
576 bModified
|= !comphelper::string::equals(sBulletChar
, pOpt
->cBullet
);
577 pOpt
->cBullet
= sBulletChar
[0];
579 bModified
|= aByInputBulletFont
!= pOpt
->aByInputBulletFont
;
580 bModified
|= !comphelper::string::equals(sByInputBulletChar
, pOpt
->cByInputBullet
);
581 pOpt
->aByInputBulletFont
= aByInputBulletFont
;
582 pOpt
->cByInputBullet
= sByInputBulletChar
[0];
584 bCheck
= m_pCheckLB
->IsChecked(MERGE_SINGLE_LINE_PARA
, CBCOL_FIRST
);
585 bModified
|= pOpt
->bRightMargin
!= bCheck
;
586 pOpt
->bRightMargin
= bCheck
;
587 bModified
|= nPercent
!= pOpt
->nRightMargin
;
588 pOpt
->nRightMargin
= (sal_uInt8
)nPercent
;
590 bCheck
= m_pCheckLB
->IsChecked(APPLY_NUMBERING
, CBCOL_SECOND
);
591 bModified
|= pOpt
->bSetNumRule
!= bCheck
;
592 pOpt
->bSetNumRule
= bCheck
;
594 bCheck
= m_pCheckLB
->IsChecked(INSERT_BORDER
, CBCOL_SECOND
);
595 bModified
|= pOpt
->bSetBorder
!= bCheck
;
596 pOpt
->bSetBorder
= bCheck
;
598 bCheck
= m_pCheckLB
->IsChecked(CREATE_TABLE
, CBCOL_SECOND
);
599 bModified
|= pOpt
->bCreateTable
!= bCheck
;
600 pOpt
->bCreateTable
= bCheck
;
602 bCheck
= m_pCheckLB
->IsChecked(REPLACE_STYLES
, CBCOL_SECOND
);
603 bModified
|= pOpt
->bReplaceStyles
!= bCheck
;
604 pOpt
->bReplaceStyles
= bCheck
;
606 bCheck
= m_pCheckLB
->IsChecked(REPLACE_DASHES
, CBCOL_FIRST
);
607 bModified
|= pOpt
->bChgToEnEmDash
!= bCheck
;
608 pOpt
->bChgToEnEmDash
= bCheck
;
609 pAutoCorrect
->SetAutoCorrFlag(ChgToEnEmDash
,
610 m_pCheckLB
->IsChecked(REPLACE_DASHES
, CBCOL_SECOND
));
612 bCheck
= m_pCheckLB
->IsChecked(DEL_SPACES_AT_STT_END
, CBCOL_FIRST
);
613 bModified
|= pOpt
->bAFormatDelSpacesAtSttEnd
!= bCheck
;
614 pOpt
->bAFormatDelSpacesAtSttEnd
= bCheck
;
615 bCheck
= m_pCheckLB
->IsChecked(DEL_SPACES_AT_STT_END
, CBCOL_SECOND
);
616 bModified
|= pOpt
->bAFormatByInpDelSpacesAtSttEnd
!= bCheck
;
617 pOpt
->bAFormatByInpDelSpacesAtSttEnd
= bCheck
;
619 bCheck
= m_pCheckLB
->IsChecked(DEL_SPACES_BETWEEN_LINES
, CBCOL_FIRST
);
620 bModified
|= pOpt
->bAFormatDelSpacesBetweenLines
!= bCheck
;
621 pOpt
->bAFormatDelSpacesBetweenLines
= bCheck
;
622 bCheck
= m_pCheckLB
->IsChecked(DEL_SPACES_BETWEEN_LINES
, CBCOL_SECOND
);
623 bModified
|= pOpt
->bAFormatByInpDelSpacesBetweenLines
!= bCheck
;
624 pOpt
->bAFormatByInpDelSpacesBetweenLines
= bCheck
;
626 if(bModified
|| nFlags
!= pAutoCorrect
->GetFlags())
628 SvxAutoCorrCfg
& rCfg
= SvxAutoCorrCfg::Get();
636 void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet
& )
638 static_cast<OfaAutoCorrDlg
*>(GetTabDialog())->EnableLanguage(false);
641 void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet
* )
643 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
644 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
645 const long nFlags
= pAutoCorrect
->GetFlags();
647 m_pCheckLB
->SetUpdateMode(false);
650 // The following entries have to be inserted in the same order
651 // as in the OfaAutoFmtOptions-enum!
652 m_pCheckLB
->GetModel()->Insert(CreateEntry(sUseReplaceTbl
, CBCOL_BOTH
));
653 m_pCheckLB
->GetModel()->Insert(CreateEntry(sCptlSttWord
, CBCOL_BOTH
));
654 m_pCheckLB
->GetModel()->Insert(CreateEntry(sCptlSttSent
, CBCOL_BOTH
));
655 m_pCheckLB
->GetModel()->Insert(CreateEntry(sBoldUnder
, CBCOL_BOTH
));
656 m_pCheckLB
->GetModel()->Insert(CreateEntry(sDetectURL
, CBCOL_BOTH
));
657 m_pCheckLB
->GetModel()->Insert(CreateEntry(sDash
, CBCOL_BOTH
));
658 m_pCheckLB
->GetModel()->Insert(CreateEntry(sDelSpaceAtSttEnd
, CBCOL_BOTH
));
659 m_pCheckLB
->GetModel()->Insert(CreateEntry(sDelSpaceBetweenLines
, CBCOL_BOTH
));
661 m_pCheckLB
->GetModel()->Insert(CreateEntry(sNoDblSpaces
, CBCOL_SECOND
));
662 m_pCheckLB
->GetModel()->Insert(CreateEntry(sCorrectCapsLock
, CBCOL_SECOND
));
663 m_pCheckLB
->GetModel()->Insert(CreateEntry(sNum
, CBCOL_SECOND
));
664 m_pCheckLB
->GetModel()->Insert(CreateEntry(sBorder
, CBCOL_SECOND
));
665 m_pCheckLB
->GetModel()->Insert(CreateEntry(sTable
, CBCOL_SECOND
));
666 m_pCheckLB
->GetModel()->Insert(CreateEntry(sReplaceTemplates
, CBCOL_SECOND
));
667 m_pCheckLB
->GetModel()->Insert(CreateEntry(sDeleteEmptyPara
, CBCOL_FIRST
));
668 m_pCheckLB
->GetModel()->Insert(CreateEntry(sUserStyle
, CBCOL_FIRST
));
669 m_pCheckLB
->GetModel()->Insert(CreateEntry(sBullet
, CBCOL_FIRST
));
670 m_pCheckLB
->GetModel()->Insert(CreateEntry(sRightMargin
, CBCOL_FIRST
));
672 m_pCheckLB
->CheckEntryPos( USE_REPLACE_TABLE
, CBCOL_FIRST
, pOpt
->bAutoCorrect
);
673 m_pCheckLB
->CheckEntryPos( USE_REPLACE_TABLE
, CBCOL_SECOND
, 0 != (nFlags
& Autocorrect
));
674 m_pCheckLB
->CheckEntryPos( CORR_UPPER
, CBCOL_FIRST
, pOpt
->bCptlSttWrd
);
675 m_pCheckLB
->CheckEntryPos( CORR_UPPER
, CBCOL_SECOND
, 0 != (nFlags
& CptlSttWrd
) );
676 m_pCheckLB
->CheckEntryPos( BEGIN_UPPER
, CBCOL_FIRST
, pOpt
->bCptlSttSntnc
);
677 m_pCheckLB
->CheckEntryPos( BEGIN_UPPER
, CBCOL_SECOND
, 0 != (nFlags
& CptlSttSntnc
) );
678 m_pCheckLB
->CheckEntryPos( BOLD_UNDERLINE
, CBCOL_FIRST
, pOpt
->bChgWeightUnderl
);
679 m_pCheckLB
->CheckEntryPos( BOLD_UNDERLINE
, CBCOL_SECOND
, 0 != (nFlags
& ChgWeightUnderl
) );
680 m_pCheckLB
->CheckEntryPos( IGNORE_DBLSPACE
, CBCOL_SECOND
, 0 != (nFlags
& IgnoreDoubleSpace
) );
681 m_pCheckLB
->CheckEntryPos( CORRECT_CAPS_LOCK
, CBCOL_SECOND
, 0 != (nFlags
& CorrectCapsLock
) );
682 m_pCheckLB
->CheckEntryPos( DETECT_URL
, CBCOL_FIRST
, pOpt
->bSetINetAttr
);
683 m_pCheckLB
->CheckEntryPos( DETECT_URL
, CBCOL_SECOND
, 0 != (nFlags
& SetINetAttr
) );
684 m_pCheckLB
->CheckEntryPos( REPLACE_DASHES
, CBCOL_FIRST
, pOpt
->bChgToEnEmDash
);
685 m_pCheckLB
->CheckEntryPos( REPLACE_DASHES
, CBCOL_SECOND
, 0 != (nFlags
& ChgToEnEmDash
) );
686 m_pCheckLB
->CheckEntryPos( DEL_SPACES_AT_STT_END
, CBCOL_FIRST
, pOpt
->bAFormatDelSpacesAtSttEnd
);
687 m_pCheckLB
->CheckEntryPos( DEL_SPACES_AT_STT_END
, CBCOL_SECOND
, pOpt
->bAFormatByInpDelSpacesAtSttEnd
);
688 m_pCheckLB
->CheckEntryPos( DEL_SPACES_BETWEEN_LINES
, CBCOL_FIRST
, pOpt
->bAFormatDelSpacesBetweenLines
);
689 m_pCheckLB
->CheckEntryPos( DEL_SPACES_BETWEEN_LINES
, CBCOL_SECOND
, pOpt
->bAFormatByInpDelSpacesBetweenLines
);
690 m_pCheckLB
->CheckEntryPos( DEL_EMPTY_NODE
, CBCOL_FIRST
, pOpt
->bDelEmptyNode
);
691 m_pCheckLB
->CheckEntryPos( REPLACE_USER_COLL
, CBCOL_FIRST
, pOpt
->bChgUserColl
);
692 m_pCheckLB
->CheckEntryPos( REPLACE_BULLETS
, CBCOL_FIRST
, pOpt
->bChgEnumNum
);
694 aBulletFont
= pOpt
->aBulletFont
;
695 sBulletChar
= OUString(pOpt
->cBullet
);
696 ImpUserData
* pUserData
= new ImpUserData(&sBulletChar
, &aBulletFont
);
697 m_pCheckLB
->SetUserData( REPLACE_BULLETS
, pUserData
);
699 nPercent
= pOpt
->nRightMargin
;
701 unicode::formatPercent(nPercent
, Application::GetSettings().GetUILanguageTag());
702 pUserData
= new ImpUserData(&sMargin
, 0);
703 m_pCheckLB
->SetUserData( MERGE_SINGLE_LINE_PARA
, pUserData
);
705 m_pCheckLB
->CheckEntryPos( APPLY_NUMBERING
, CBCOL_SECOND
, pOpt
->bSetNumRule
);
707 aByInputBulletFont
= pOpt
->aByInputBulletFont
;
708 sByInputBulletChar
= OUString( pOpt
->cByInputBullet
);
709 ImpUserData
* pUserData2
= new ImpUserData(&sByInputBulletChar
, &aByInputBulletFont
);
710 m_pCheckLB
->SetUserData( APPLY_NUMBERING
, pUserData2
);
712 m_pCheckLB
->CheckEntryPos( MERGE_SINGLE_LINE_PARA
, CBCOL_FIRST
, pOpt
->bRightMargin
);
713 m_pCheckLB
->CheckEntryPos( INSERT_BORDER
, CBCOL_SECOND
, pOpt
->bSetBorder
);
714 m_pCheckLB
->CheckEntryPos( CREATE_TABLE
, CBCOL_SECOND
, pOpt
->bCreateTable
);
715 m_pCheckLB
->CheckEntryPos( REPLACE_STYLES
, CBCOL_SECOND
, pOpt
->bReplaceStyles
);
717 m_pCheckLB
->SetUpdateMode(true);
720 IMPL_LINK(OfaSwAutoFmtOptionsPage
, SelectHdl
, OfaACorrCheckListBox
*, pBox
)
722 m_pEditPB
->Enable(0 != pBox
->FirstSelected()->GetUserData());
726 IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage
, EditHdl
)
728 sal_uLong nSelEntryPos
= m_pCheckLB
->GetSelectEntryPos();
729 if( nSelEntryPos
== REPLACE_BULLETS
||
730 nSelEntryPos
== APPLY_NUMBERING
)
732 ScopedVclPtrInstance
< SvxCharacterMap
> pMapDlg(this);
733 ImpUserData
* pUserData
= static_cast<ImpUserData
*>(m_pCheckLB
->FirstSelected()->GetUserData());
734 pMapDlg
->SetCharFont(*pUserData
->pFont
);
735 pMapDlg
->SetChar( (*pUserData
->pString
)[0] );
736 if(RET_OK
== pMapDlg
->Execute())
738 vcl::Font
aFont(pMapDlg
->GetCharFont());
739 *pUserData
->pFont
= aFont
;
740 sal_UCS4 aChar
= pMapDlg
->GetChar();
741 // using the UCS4 constructor
742 OUString
aOUStr( &aChar
, 1 );
743 *pUserData
->pString
= aOUStr
;
746 else if( MERGE_SINGLE_LINE_PARA
== nSelEntryPos
)
748 // dialog for per cent settings
749 ScopedVclPtrInstance
< OfaAutoFmtPrcntSet
> aDlg(this);
750 aDlg
->GetPrcntFld().SetValue(nPercent
);
751 if(RET_OK
== aDlg
->Execute())
753 nPercent
= (sal_uInt16
)aDlg
->GetPrcntFld().GetValue();
755 unicode::formatPercent(nPercent
, Application::GetSettings().GetUILanguageTag());
758 m_pCheckLB
->Invalidate();
762 void OfaACorrCheckListBox::SetTabs()
764 SvSimpleTable::SetTabs();
765 SvLBoxTabFlags nAdjust
= SvLBoxTabFlags::ADJUST_RIGHT
|SvLBoxTabFlags::ADJUST_LEFT
|SvLBoxTabFlags::ADJUST_CENTER
|SvLBoxTabFlags::ADJUST_NUMERIC
|SvLBoxTabFlags::FORCE
;
767 if( aTabs
.size() > 1 )
769 SvLBoxTab
* pTab
= aTabs
[1];
770 pTab
->nFlags
&= ~nAdjust
;
771 pTab
->nFlags
|= SvLBoxTabFlags::PUSHABLE
|SvLBoxTabFlags::ADJUST_CENTER
|SvLBoxTabFlags::FORCE
;
773 if( aTabs
.size() > 2 )
775 SvLBoxTab
* pTab
= aTabs
[2];
776 pTab
->nFlags
&= ~nAdjust
;
777 pTab
->nFlags
|= SvLBoxTabFlags::PUSHABLE
|SvLBoxTabFlags::ADJUST_CENTER
|SvLBoxTabFlags::FORCE
;
781 void OfaACorrCheckListBox::CheckEntryPos(sal_uLong nPos
, sal_uInt16 nCol
, bool bChecked
)
783 if ( nPos
< GetEntryCount() )
787 bChecked
? SvButtonState( SV_BUTTON_CHECKED
) :
788 SvButtonState( SV_BUTTON_UNCHECKED
) );
791 bool OfaACorrCheckListBox::IsChecked(sal_uLong nPos
, sal_uInt16 nCol
)
793 return GetCheckButtonState( GetEntry(nPos
), nCol
) == SV_BUTTON_CHECKED
;
796 void OfaACorrCheckListBox::SetCheckButtonState( SvTreeListEntry
* pEntry
, sal_uInt16 nCol
, SvButtonState eState
)
798 SvLBoxButton
* pItem
= static_cast<SvLBoxButton
*>(pEntry
->GetItem(nCol
+ 1));
800 DBG_ASSERT(pItem
,"SetCheckButton:Item not found");
801 if (pItem
->GetType() == SV_ITEM_ID_LBOXBUTTON
)
805 case SV_BUTTON_CHECKED
:
806 pItem
->SetStateChecked();
809 case SV_BUTTON_UNCHECKED
:
810 pItem
->SetStateUnchecked();
813 case SV_BUTTON_TRISTATE
:
814 pItem
->SetStateTristate();
817 InvalidateEntry( pEntry
);
821 SvButtonState
OfaACorrCheckListBox::GetCheckButtonState( SvTreeListEntry
* pEntry
, sal_uInt16 nCol
)
823 SvButtonState eState
= SV_BUTTON_UNCHECKED
;
824 SvLBoxButton
* pItem
= static_cast<SvLBoxButton
*>(pEntry
->GetItem(nCol
+ 1));
825 DBG_ASSERT(pItem
,"GetChButnState:Item not found");
827 if (pItem
->GetType() == SV_ITEM_ID_LBOXBUTTON
)
829 SvItemStateFlags nButtonFlags
= pItem
->GetButtonFlags();
830 eState
= SvLBoxButtonData::ConvertToButtonState( nButtonFlags
);
836 void OfaACorrCheckListBox::HBarClick()
838 // sorting is stopped by this override
841 void OfaACorrCheckListBox::KeyInput( const KeyEvent
& rKEvt
)
843 if(!rKEvt
.GetKeyCode().GetModifier() &&
844 KEY_SPACE
== rKEvt
.GetKeyCode().GetCode())
846 sal_uLong nSelPos
= GetSelectEntryPos();
847 sal_uInt16 nCol
= GetCurrentTabPos() - 1;
850 CheckEntryPos( nSelPos
, nCol
, !IsChecked( nSelPos
, nCol
) );
851 CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE
, (void*)GetEntry( nSelPos
) );
855 sal_uInt16 nCheck
= IsChecked(nSelPos
, 1) ? 1 : 0;
856 if(IsChecked(nSelPos
, 0))
860 CheckEntryPos(nSelPos
, 1, 0 != (nCheck
& 1));
861 CheckEntryPos(nSelPos
, 0, 0 != (nCheck
& 2));
865 SvSimpleTable::KeyInput(rKEvt
);
868 OfaAutocorrReplacePage::OfaAutocorrReplacePage( vcl::Window
* pParent
,
869 const SfxItemSet
& rSet
)
870 : SfxTabPage(pParent
, "AcorReplacePage", "cui/ui/acorreplacepage.ui", &rSet
)
871 , eLang(eLastDialogLanguage
)
872 , bHasSelectionText(false)
874 , bReplaceEditChanged(false)
877 get(m_pTextOnlyCB
, "textonly");
878 get(m_pDeleteReplacePB
, "delete");
879 get(m_pNewReplacePB
, "new");
880 sNew
= m_pNewReplacePB
->GetText();
881 sModify
= get
<PushButton
>("replace")->GetText();
882 get(m_pShortED
, "origtext");
883 get(m_pReplaceED
, "newtext");
884 get(m_pReplaceTLB
, "tabview");
885 m_pReplaceTLB
->set_height_request(16 * GetTextHeight());
887 SfxModule
*pMod
= *reinterpret_cast<SfxModule
**>(GetAppData(SHL_WRITER
));
888 bSWriter
= pMod
== SfxModule::GetActiveModule();
890 LanguageTag
aLanguageTag( eLastDialogLanguage
);
891 pCompareClass
= new CollatorWrapper( comphelper::getProcessComponentContext() );
892 pCompareClass
->loadDefaultCollator( aLanguageTag
.getLocale(), 0 );
893 pCharClass
= new CharClass( aLanguageTag
);
895 static long aTabs
[] = { 2 /* Tab-Count */, 1, 61 };
896 m_pReplaceTLB
->SetTabs( &aTabs
[0], MAP_APPFONT
);
898 m_pReplaceTLB
->SetStyle( m_pReplaceTLB
->GetStyle()|WB_HSCROLL
|WB_CLIPCHILDREN
);
899 m_pReplaceTLB
->SetSelectHdl( LINK(this, OfaAutocorrReplacePage
, SelectHdl
) );
900 m_pNewReplacePB
->SetClickHdl( LINK(this, OfaAutocorrReplacePage
, NewDelHdl
) );
901 m_pDeleteReplacePB
->SetClickHdl( LINK(this, OfaAutocorrReplacePage
, NewDelHdl
) );
902 m_pShortED
->SetModifyHdl( LINK(this, OfaAutocorrReplacePage
, ModifyHdl
) );
903 m_pReplaceED
->SetModifyHdl( LINK(this, OfaAutocorrReplacePage
, ModifyHdl
) );
904 m_pShortED
->SetActionHdl( LINK(this, OfaAutocorrReplacePage
, NewDelHdl
) );
905 m_pReplaceED
->SetActionHdl( LINK(this, OfaAutocorrReplacePage
, NewDelHdl
) );
907 m_pReplaceED
->SetSpaces(true);
908 m_pShortED
->SetSpaces(true);
910 m_pShortED
->ConnectColumn(m_pReplaceTLB
, 0);
911 m_pReplaceED
->ConnectColumn(m_pReplaceTLB
, 1);
914 OfaAutocorrReplacePage::~OfaAutocorrReplacePage()
919 void OfaAutocorrReplacePage::dispose()
921 aDoubleStringTable
.clear();
922 aChangesTable
.clear();
924 delete pCompareClass
;
925 pCompareClass
= NULL
;
929 m_pTextOnlyCB
.clear();
931 m_pReplaceED
.clear();
932 m_pReplaceTLB
.clear();
933 m_pNewReplacePB
.clear();
934 m_pDeleteReplacePB
.clear();
935 SfxTabPage::dispose();
938 VclPtr
<SfxTabPage
> OfaAutocorrReplacePage::Create( vcl::Window
* pParent
, const SfxItemSet
* rSet
)
940 return VclPtr
<OfaAutocorrReplacePage
>::Create(pParent
, *rSet
);
943 void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet
& )
945 if(eLang
!= eLastDialogLanguage
)
946 SetLanguage(eLastDialogLanguage
);
947 static_cast<OfaAutoCorrDlg
*>(GetTabDialog())->EnableLanguage(true);
950 SfxTabPage::sfxpg
OfaAutocorrReplacePage::DeactivatePage( SfxItemSet
* )
955 bool OfaAutocorrReplacePage::FillItemSet( SfxItemSet
* )
957 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
959 for (StringChangeTable::reverse_iterator it
= aChangesTable
.rbegin(); it
!= aChangesTable
.rend(); ++it
)
961 LanguageType eCurrentLang
= it
->first
;
962 StringChangeList
& rStringChangeList
= it
->second
;
963 std::vector
<SvxAutocorrWord
> aDeleteWords
;
964 std::vector
<SvxAutocorrWord
> aNewWords
;
966 for (sal_uInt32 i
= 0; i
< rStringChangeList
.aDeletedEntries
.size(); i
++)
968 DoubleString
& deleteEntry
= rStringChangeList
.aDeletedEntries
[i
];
969 SvxAutocorrWord
aDeleteWord( deleteEntry
.sShort
, deleteEntry
.sLong
);
970 aDeleteWords
.push_back( aDeleteWord
);
973 for (sal_uInt32 i
= 0; i
< rStringChangeList
.aNewEntries
.size(); i
++)
975 DoubleString
& newEntry
= rStringChangeList
.aNewEntries
[i
];
977 //fdo#67697 if the user data is set then we want to retain the
978 //source formatting of the entry, so don't use the optimized
979 //text-only MakeCombinedChanges for this entry
980 bool bKeepSourceFormatting
= newEntry
.pUserData
== &bHasSelectionText
;
981 if (bKeepSourceFormatting
)
983 pAutoCorrect
->PutText(newEntry
.sShort
, *SfxObjectShell::Current(), eCurrentLang
);
987 SvxAutocorrWord
aNewWord( newEntry
.sShort
, newEntry
.sLong
);
988 aNewWords
.push_back( aNewWord
);
990 pAutoCorrect
->MakeCombinedChanges( aNewWords
, aDeleteWords
, eCurrentLang
);
992 aChangesTable
.clear();
996 void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset
,
997 LanguageType eOldLanguage
,
998 LanguageType eNewLanguage
)
1000 eLang
= eNewLanguage
;
1003 aDoubleStringTable
.clear();
1004 aChangesTable
.clear();
1008 DoubleStringArray
* pArray
;
1009 if(aDoubleStringTable
.find(eOldLanguage
) != aDoubleStringTable
.end())
1011 pArray
= &aDoubleStringTable
[eOldLanguage
];
1016 pArray
= &aDoubleStringTable
[eOldLanguage
]; // create new array
1019 sal_uInt32 nListBoxCount
= (sal_uInt32
) m_pReplaceTLB
->GetEntryCount();
1021 for(i
= 0; i
< nListBoxCount
; i
++)
1023 pArray
->push_back(DoubleString());
1024 DoubleString
& rDouble
= (*pArray
)[pArray
->size() - 1];
1025 SvTreeListEntry
* pEntry
= m_pReplaceTLB
->GetEntry( i
);
1026 rDouble
.sShort
= SvTabListBox::GetEntryText(pEntry
, 0);
1027 rDouble
.sLong
= SvTabListBox::GetEntryText(pEntry
, 1);
1028 rDouble
.pUserData
= pEntry
->GetUserData();
1032 m_pReplaceTLB
->Clear();
1034 aFormatText
.clear();
1036 if( aDoubleStringTable
.find(eLang
) != aDoubleStringTable
.end() )
1038 DoubleStringArray
& rArray
= aDoubleStringTable
[eNewLanguage
];
1039 for( sal_uInt32 i
= 0; i
< rArray
.size(); i
++ )
1041 DoubleString
& rDouble
= rArray
[i
];
1042 bool bTextOnly
= 0 == rDouble
.pUserData
;
1043 // formatted text is only in Writer
1044 if(bSWriter
|| bTextOnly
)
1046 OUString
sEntry(rDouble
.sShort
);
1048 sEntry
+= rDouble
.sLong
;
1049 SvTreeListEntry
* pEntry
= m_pReplaceTLB
->InsertEntry(sEntry
);
1050 m_pTextOnlyCB
->Check(bTextOnly
);
1052 pEntry
->SetUserData(rDouble
.pUserData
); // that means: with format info or even with selection text
1056 aFormatText
.insert(rDouble
.sShort
);
1062 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
1063 SvxAutocorrWordList
* pWordList
= pAutoCorrect
->LoadAutocorrWordList(eLang
);
1064 m_pReplaceTLB
->SetUpdateMode(false);
1065 SvxAutocorrWordList::Content aContent
= pWordList
->getSortedContent();
1066 for( SvxAutocorrWordList::Content::const_iterator it
= aContent
.begin();
1067 it
!= aContent
.end(); ++it
)
1069 SvxAutocorrWord
* pWordPtr
= *it
;
1070 bool bTextOnly
= pWordPtr
->IsTextOnly();
1071 // formatted text is only in Writer
1072 if(bSWriter
|| bTextOnly
)
1074 OUString
sEntry(pWordPtr
->GetShort());
1076 sEntry
+= pWordPtr
->GetLong();
1077 SvTreeListEntry
* pEntry
= m_pReplaceTLB
->InsertEntry(sEntry
);
1078 m_pTextOnlyCB
->Check(pWordPtr
->IsTextOnly());
1080 pEntry
->SetUserData(m_pTextOnlyCB
); // that means: with format info
1084 aFormatText
.insert(pWordPtr
->GetShort());
1087 m_pNewReplacePB
->Enable(false);
1088 m_pDeleteReplacePB
->Enable(false);
1089 m_pReplaceTLB
->SetUpdateMode(true);
1092 SfxViewShell
* pViewShell
= SfxViewShell::Current();
1093 if( pViewShell
&& pViewShell
->HasSelection( true ) )
1095 bHasSelectionText
= true;
1096 const OUString
sSelection( pViewShell
->GetSelectionText() );
1097 m_pReplaceED
->SetText( sSelection
);
1098 m_pTextOnlyCB
->Check( !bSWriter
);
1099 m_pTextOnlyCB
->Enable( bSWriter
&& !sSelection
.isEmpty() );
1103 m_pTextOnlyCB
->Enable( false );
1107 void OfaAutocorrReplacePage::Reset( const SfxItemSet
* )
1109 RefillReplaceBox(true, eLang
, eLang
);
1110 m_pShortED
->GrabFocus();
1113 void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet
)
1115 //save old settings an refill
1118 RefillReplaceBox(false, eLang
, eSet
);
1119 eLastDialogLanguage
= eSet
;
1120 delete pCompareClass
;
1123 LanguageTag
aLanguageTag( eLastDialogLanguage
);
1124 pCompareClass
= new CollatorWrapper( comphelper::getProcessComponentContext() );
1125 pCompareClass
->loadDefaultCollator( aLanguageTag
.getLocale(), 0 );
1126 pCharClass
= new CharClass( aLanguageTag
);
1127 ModifyHdl(m_pShortED
);
1131 IMPL_LINK(OfaAutocorrReplacePage
, SelectHdl
, SvTabListBox
*, pBox
)
1133 if(!bFirstSelect
|| !bHasSelectionText
)
1135 SvTreeListEntry
* pEntry
= pBox
->FirstSelected();
1136 OUString
sTmpShort(SvTabListBox::GetEntryText(pEntry
, 0));
1137 // if the text is set via ModifyHdl, the cursor is always at the beginning
1138 // of a word, although you're editing here
1139 bool bSameContent
= 0 == pCompareClass
->compareString( sTmpShort
, m_pShortED
->GetText() );
1140 Selection aSel
= m_pShortED
->GetSelection();
1141 if(m_pShortED
->GetText() != sTmpShort
)
1143 m_pShortED
->SetText(sTmpShort
);
1144 // if it was only a different notation, the selection has to be set again
1147 m_pShortED
->SetSelection(aSel
);
1150 m_pReplaceED
->SetText( SvTabListBox::GetEntryText(pEntry
, 1) );
1151 // with UserData there is a Formatinfo
1152 m_pTextOnlyCB
->Check( pEntry
->GetUserData() == 0);
1156 bFirstSelect
= false;
1159 m_pNewReplacePB
->Enable(false);
1160 m_pDeleteReplacePB
->Enable();
1164 void OfaAutocorrReplacePage::NewEntry(const OUString
& sShort
, const OUString
& sLong
, bool bKeepSourceFormatting
)
1166 DoubleStringArray
& rNewArray
= aChangesTable
[eLang
].aNewEntries
;
1167 for (sal_uInt32 i
= 0; i
< rNewArray
.size(); i
++)
1169 if (rNewArray
[i
].sShort
== sShort
)
1171 rNewArray
.erase(rNewArray
.begin() + i
);
1176 DoubleStringArray
& rDeletedArray
= aChangesTable
[eLang
].aDeletedEntries
;
1177 for (sal_uInt32 i
= 0; i
< rDeletedArray
.size(); i
++)
1179 if (rDeletedArray
[i
].sShort
== sShort
)
1181 rDeletedArray
.erase(rDeletedArray
.begin() + i
);
1186 DoubleString aNewString
= DoubleString();
1187 aNewString
.sShort
= sShort
;
1188 aNewString
.sLong
= sLong
;
1189 rNewArray
.push_back(aNewString
);
1190 if (bKeepSourceFormatting
)
1191 rNewArray
.back().pUserData
= &bHasSelectionText
;
1194 void OfaAutocorrReplacePage::DeleteEntry(const OUString
& sShort
, const OUString
& sLong
)
1196 DoubleStringArray
& rNewArray
= aChangesTable
[eLang
].aNewEntries
;
1197 for (sal_uInt32 i
= 0; i
< rNewArray
.size(); i
++)
1199 if (rNewArray
[i
].sShort
== sShort
)
1201 rNewArray
.erase(rNewArray
.begin() + i
);
1206 DoubleStringArray
& rDeletedArray
= aChangesTable
[eLang
].aDeletedEntries
;
1207 for (sal_uInt32 i
= 0; i
< rDeletedArray
.size(); i
++)
1209 if (rDeletedArray
[i
].sShort
== sShort
)
1211 rDeletedArray
.erase(rDeletedArray
.begin() + i
);
1216 DoubleString aDeletedString
= DoubleString();
1217 aDeletedString
.sShort
= sShort
;
1218 aDeletedString
.sLong
= sLong
;
1219 rDeletedArray
.push_back(aDeletedString
);
1222 IMPL_LINK(OfaAutocorrReplacePage
, NewDelHdl
, PushButton
*, pBtn
)
1224 SvTreeListEntry
* pEntry
= m_pReplaceTLB
->FirstSelected();
1225 if( pBtn
== m_pDeleteReplacePB
)
1227 DBG_ASSERT( pEntry
, "no entry selected" );
1230 DeleteEntry(SvTabListBox::GetEntryText(pEntry
, 0), SvTabListBox::GetEntryText(pEntry
, 1));
1231 m_pReplaceTLB
->GetModel()->Remove(pEntry
);
1232 ModifyHdl(m_pShortED
);
1236 if(pBtn
== m_pNewReplacePB
|| m_pNewReplacePB
->IsEnabled())
1238 SvTreeListEntry
* _pNewEntry
= m_pReplaceTLB
->FirstSelected();
1239 OUString
sEntry(m_pShortED
->GetText());
1240 if(!sEntry
.isEmpty() && ( !m_pReplaceED
->GetText().isEmpty() ||
1241 ( bHasSelectionText
&& bSWriter
) ))
1243 bool bKeepSourceFormatting
= !bReplaceEditChanged
&& !m_pTextOnlyCB
->IsChecked();
1245 NewEntry(m_pShortED
->GetText(), m_pReplaceED
->GetText(), bKeepSourceFormatting
);
1246 m_pReplaceTLB
->SetUpdateMode(false);
1247 sal_uLong nPos
= TREELIST_ENTRY_NOTFOUND
;
1249 sEntry
+= m_pReplaceED
->GetText();
1252 nPos
= m_pReplaceTLB
->GetModel()->GetAbsPos(_pNewEntry
);
1253 m_pReplaceTLB
->GetModel()->Remove(_pNewEntry
);
1258 for( j
= 0; j
< m_pReplaceTLB
->GetEntryCount(); j
++ )
1260 SvTreeListEntry
* pReplaceEntry
= m_pReplaceTLB
->GetEntry(j
);
1261 if( 0 >= pCompareClass
->compareString(sEntry
, SvTabListBox::GetEntryText(pReplaceEntry
, 0) ) )
1266 SvTreeListEntry
* pInsEntry
= m_pReplaceTLB
->InsertEntry(
1267 sEntry
, static_cast< SvTreeListEntry
* >(NULL
), false,
1268 nPos
== TREELIST_ENTRY_NOTFOUND
? TREELIST_APPEND
: nPos
);
1269 if (bKeepSourceFormatting
)
1271 pInsEntry
->SetUserData(&bHasSelectionText
); // new formatted text
1274 m_pReplaceTLB
->MakeVisible( pInsEntry
);
1275 m_pReplaceTLB
->SetUpdateMode( true );
1276 // if the request came from the ReplaceEdit, give focus to the ShortEdit
1277 if(m_pReplaceED
->HasFocus())
1279 m_pShortED
->GrabFocus();
1285 // this can only be an enter in one of the two edit fields
1286 // which means EndDialog() - has to be evaluated in KeyInput
1289 ModifyHdl(m_pShortED
);
1293 IMPL_LINK(OfaAutocorrReplacePage
, ModifyHdl
, Edit
*, pEdt
)
1295 SvTreeListEntry
* pFirstSel
= m_pReplaceTLB
->FirstSelected();
1296 bool bShort
= pEdt
== m_pShortED
;
1297 const OUString rEntry
= pEdt
->GetText();
1298 const OUString rRepString
= m_pReplaceED
->GetText();
1299 OUString
aWordStr( pCharClass
->lowercase( rEntry
));
1303 if(!rEntry
.isEmpty())
1305 bool bFound
= false;
1306 bool bTmpSelEntry
=false;
1308 for(sal_uInt32 i
= 0; i
< m_pReplaceTLB
->GetEntryCount(); i
++)
1310 SvTreeListEntry
* pEntry
= m_pReplaceTLB
->GetEntry( i
);
1311 OUString aTestStr
= SvTabListBox::GetEntryText(pEntry
, 0);
1312 if( pCompareClass
->compareString(rEntry
, aTestStr
) == 0 )
1314 if( !rRepString
.isEmpty() )
1316 bFirstSelect
= true;
1318 m_pReplaceTLB
->SetCurEntry(pEntry
);
1320 m_pNewReplacePB
->SetText(sModify
);
1326 aTestStr
= pCharClass
->lowercase( aTestStr
);
1327 if( aTestStr
.startsWith(aWordStr
) && !bTmpSelEntry
)
1329 m_pReplaceTLB
->MakeVisible( pEntry
);
1330 bTmpSelEntry
= true;
1336 m_pReplaceTLB
->SelectAll( false );
1338 m_pNewReplacePB
->SetText( sNew
);
1339 if( bReplaceEditChanged
)
1340 m_pTextOnlyCB
->Enable(false);
1342 m_pDeleteReplacePB
->Enable( bFound
);
1344 else if( m_pReplaceTLB
->GetEntryCount() > 0 )
1346 SvTreeListEntry
* pEntry
= m_pReplaceTLB
->GetEntry( 0 );
1347 m_pReplaceTLB
->MakeVisible( pEntry
);
1353 bReplaceEditChanged
= true;
1356 m_pNewReplacePB
->SetText( sModify
);
1360 const OUString
& rShortTxt
= m_pShortED
->GetText();
1361 bool bEnableNew
= !rShortTxt
.isEmpty() &&
1362 ( !rRepString
.isEmpty() ||
1363 ( bHasSelectionText
&& bSWriter
)) &&
1364 ( !pFirstSel
|| rRepString
!=
1365 SvTabListBox::GetEntryText( pFirstSel
, 1 ) );
1368 for(std::set
<OUString
>::iterator i
= aFormatText
.begin(); i
!= aFormatText
.end(); ++i
)
1370 if((*i
).equals(rShortTxt
))
1377 m_pNewReplacePB
->Enable( bEnableNew
);
1382 static bool lcl_FindInArray(std::vector
<OUString
>& rStrings
, const OUString
& rString
)
1384 for(std::vector
<OUString
>::iterator i
= rStrings
.begin(); i
!= rStrings
.end(); ++i
)
1386 if((*i
).equals(rString
))
1394 OfaAutocorrExceptPage::OfaAutocorrExceptPage(vcl::Window
* pParent
, const SfxItemSet
& rSet
)
1395 : SfxTabPage(pParent
, "AcorExceptPage", "cui/ui/acorexceptpage.ui", &rSet
)
1396 , eLang(eLastDialogLanguage
)
1398 get(m_pAbbrevED
, "abbrev");
1399 get(m_pAbbrevLB
, "abbrevlist");
1400 m_pAbbrevLB
->SetStyle(m_pAbbrevLB
->GetStyle() | WB_SORT
);
1401 m_pAbbrevLB
->SetDropDownLineCount(7);
1402 get(m_pNewAbbrevPB
, "newabbrev");
1403 get(m_pDelAbbrevPB
, "delabbrev");
1404 get(m_pAutoAbbrevCB
, "autoabbrev");
1406 get(m_pDoubleCapsED
, "double");
1407 get(m_pDoubleCapsLB
, "doublelist");
1408 m_pDoubleCapsLB
->SetStyle(m_pDoubleCapsLB
->GetStyle() | WB_SORT
);
1409 m_pDoubleCapsLB
->SetDropDownLineCount(7);
1410 get(m_pNewDoublePB
, "newdouble");
1411 get(m_pDelDoublePB
, "deldouble");
1412 get(m_pAutoCapsCB
, "autodouble");
1414 ::com::sun::star::lang::Locale
aLcl( LanguageTag::convertToLocale(eLastDialogLanguage
));
1415 pCompareClass
= new CollatorWrapper( comphelper::getProcessComponentContext() );
1416 pCompareClass
->loadDefaultCollator( aLcl
, 0 );
1418 m_pNewAbbrevPB
->SetClickHdl(LINK(this, OfaAutocorrExceptPage
, NewDelHdl
));
1419 m_pDelAbbrevPB
->SetClickHdl(LINK(this, OfaAutocorrExceptPage
, NewDelHdl
));
1420 m_pNewDoublePB
->SetClickHdl(LINK(this, OfaAutocorrExceptPage
, NewDelHdl
));
1421 m_pDelDoublePB
->SetClickHdl(LINK(this, OfaAutocorrExceptPage
, NewDelHdl
));
1423 m_pAbbrevLB
->SetSelectHdl(LINK(this, OfaAutocorrExceptPage
, SelectHdl
));
1424 m_pDoubleCapsLB
->SetSelectHdl(LINK(this, OfaAutocorrExceptPage
, SelectHdl
));
1425 m_pAbbrevED
->SetModifyHdl(LINK(this, OfaAutocorrExceptPage
, ModifyHdl
));
1426 m_pDoubleCapsED
->SetModifyHdl(LINK(this, OfaAutocorrExceptPage
, ModifyHdl
));
1428 m_pAbbrevED
->SetActionHdl(LINK(this, OfaAutocorrExceptPage
, NewDelHdl
));
1429 m_pDoubleCapsED
->SetActionHdl(LINK(this, OfaAutocorrExceptPage
, NewDelHdl
));
1432 OfaAutocorrExceptPage::~OfaAutocorrExceptPage()
1437 void OfaAutocorrExceptPage::dispose()
1439 aStringsTable
.clear();
1440 delete pCompareClass
;
1441 m_pAbbrevED
.clear();
1442 m_pAbbrevLB
.clear();
1443 m_pNewAbbrevPB
.clear();
1444 m_pDelAbbrevPB
.clear();
1445 m_pAutoAbbrevCB
.clear();
1446 m_pDoubleCapsED
.clear();
1447 m_pDoubleCapsLB
.clear();
1448 m_pNewDoublePB
.clear();
1449 m_pDelDoublePB
.clear();
1450 m_pAutoCapsCB
.clear();
1451 SfxTabPage::dispose();
1454 VclPtr
<SfxTabPage
> OfaAutocorrExceptPage::Create( vcl::Window
* pParent
,
1455 const SfxItemSet
* rSet
)
1457 return VclPtr
<OfaAutocorrExceptPage
>::Create(pParent
, *rSet
);
1460 void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet
& )
1462 if(eLang
!= eLastDialogLanguage
)
1463 SetLanguage(eLastDialogLanguage
);
1464 static_cast<OfaAutoCorrDlg
*>(GetTabDialog())->EnableLanguage(true);
1467 SfxTabPage::sfxpg
OfaAutocorrExceptPage::DeactivatePage( SfxItemSet
* )
1472 bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet
* )
1474 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
1475 for(StringsTable::reverse_iterator it1
= aStringsTable
.rbegin(); it1
!= aStringsTable
.rend(); ++it1
)
1477 LanguageType eCurLang
= it1
->first
;
1478 StringsArrays
& rArrays
= it1
->second
;
1479 if(eCurLang
!= eLang
) // current language is treated later
1481 SvStringsISortDtor
* pWrdList
= pAutoCorrect
->LoadWrdSttExceptList(eCurLang
);
1485 size_t nCount
= pWrdList
->size();
1487 for( i
= nCount
; i
; )
1489 OUString aString
= (*pWrdList
)[ --i
];
1491 if( !lcl_FindInArray(rArrays
.aDoubleCapsStrings
, aString
))
1497 for(std::vector
<OUString
>::iterator it
= rArrays
.aDoubleCapsStrings
.begin(); it
!= rArrays
.aDoubleCapsStrings
.end(); ++it
)
1499 pWrdList
->insert(*it
);
1501 pAutoCorrect
->SaveWrdSttExceptList(eCurLang
);
1504 SvStringsISortDtor
* pCplList
= pAutoCorrect
->LoadCplSttExceptList(eCurLang
);
1508 size_t nCount
= pCplList
->size();
1510 for( i
= nCount
; i
; )
1512 OUString aString
= (*pCplList
)[ --i
];
1513 if( !lcl_FindInArray(rArrays
.aAbbrevStrings
, aString
))
1519 for(std::vector
<OUString
>::iterator it
= rArrays
.aAbbrevStrings
.begin(); it
!= rArrays
.aAbbrevStrings
.end(); ++it
)
1521 pCplList
->insert(*it
);
1524 pAutoCorrect
->SaveCplSttExceptList(eCurLang
);
1528 aStringsTable
.clear();
1530 SvStringsISortDtor
* pWrdList
= pAutoCorrect
->LoadWrdSttExceptList(eLang
);
1534 size_t nCount
= pWrdList
->size();
1536 for( i
= nCount
; i
; )
1538 OUString aString
= (*pWrdList
)[ --i
];
1539 if( LISTBOX_ENTRY_NOTFOUND
== m_pDoubleCapsLB
->GetEntryPos(aString
) )
1544 nCount
= m_pDoubleCapsLB
->GetEntryCount();
1545 for( i
= 0; i
< nCount
; ++i
)
1547 pWrdList
->insert( m_pDoubleCapsLB
->GetEntry( i
) );
1549 pAutoCorrect
->SaveWrdSttExceptList(eLang
);
1552 SvStringsISortDtor
* pCplList
= pAutoCorrect
->LoadCplSttExceptList(eLang
);
1556 size_t nCount
= pCplList
->size();
1557 for( size_t i
= nCount
; i
; )
1559 OUString aString
= (*pCplList
)[ --i
];
1560 if( LISTBOX_ENTRY_NOTFOUND
== m_pAbbrevLB
->GetEntryPos(aString
) )
1565 sal_Int32 nAbbrevCount
= m_pAbbrevLB
->GetEntryCount();
1566 for( sal_Int32 ia
= 0; ia
< nAbbrevCount
; ++ia
)
1568 pCplList
->insert( m_pAbbrevLB
->GetEntry( ia
) );
1570 pAutoCorrect
->SaveCplSttExceptList(eLang
);
1572 if(m_pAutoAbbrevCB
->IsValueChangedFromSaved())
1573 pAutoCorrect
->SetAutoCorrFlag( SaveWordCplSttLst
, m_pAutoAbbrevCB
->IsChecked());
1574 if(m_pAutoCapsCB
->IsValueChangedFromSaved())
1575 pAutoCorrect
->SetAutoCorrFlag( SaveWordWrdSttLst
, m_pAutoCapsCB
->IsChecked());
1579 void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet
)
1583 // save old settings and fill anew
1584 RefillReplaceBoxes(false, eLang
, eSet
);
1585 eLastDialogLanguage
= eSet
;
1586 delete pCompareClass
;
1587 pCompareClass
= new CollatorWrapper( comphelper::getProcessComponentContext() );
1588 pCompareClass
->loadDefaultCollator( LanguageTag::convertToLocale( eLastDialogLanguage
), 0 );
1589 ModifyHdl(m_pAbbrevED
);
1590 ModifyHdl(m_pDoubleCapsED
);
1594 void OfaAutocorrExceptPage::RefillReplaceBoxes(bool bFromReset
,
1595 LanguageType eOldLanguage
,
1596 LanguageType eNewLanguage
)
1598 eLang
= eNewLanguage
;
1601 aStringsTable
.clear();
1605 StringsArrays
* pArrays
;
1606 if(aStringsTable
.find(eOldLanguage
) != aStringsTable
.end())
1608 pArrays
= &aStringsTable
[eOldLanguage
];
1609 pArrays
->aAbbrevStrings
.clear();
1610 pArrays
->aDoubleCapsStrings
.clear();
1614 pArrays
= &aStringsTable
[eOldLanguage
]; // create new array
1618 for(i
= 0; i
< m_pAbbrevLB
->GetEntryCount(); i
++)
1619 pArrays
->aAbbrevStrings
.push_back(OUString(m_pAbbrevLB
->GetEntry(i
)));
1621 for(i
= 0; i
< m_pDoubleCapsLB
->GetEntryCount(); i
++)
1622 pArrays
->aDoubleCapsStrings
.push_back(OUString(m_pDoubleCapsLB
->GetEntry(i
)));
1624 m_pDoubleCapsLB
->Clear();
1625 m_pAbbrevLB
->Clear();
1627 m_pAbbrevED
->SetText(sTemp
);
1628 m_pDoubleCapsED
->SetText(sTemp
);
1630 if(aStringsTable
.find(eLang
) != aStringsTable
.end())
1632 StringsArrays
& rArrays
= aStringsTable
[eLang
];
1633 for(std::vector
<OUString
>::iterator i
= rArrays
.aAbbrevStrings
.begin(); i
!= rArrays
.aAbbrevStrings
.end(); ++i
)
1634 m_pAbbrevLB
->InsertEntry(*i
);
1636 for(std::vector
<OUString
>::iterator i
= rArrays
.aDoubleCapsStrings
.begin(); i
!= rArrays
.aDoubleCapsStrings
.end(); ++i
)
1637 m_pDoubleCapsLB
->InsertEntry(*i
);
1641 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
1642 const SvStringsISortDtor
* pCplList
= pAutoCorrect
->GetCplSttExceptList(eLang
);
1643 const SvStringsISortDtor
* pWrdList
= pAutoCorrect
->GetWrdSttExceptList(eLang
);
1645 for( i
= 0; i
< pCplList
->size(); i
++ )
1647 m_pAbbrevLB
->InsertEntry((*pCplList
)[i
]);
1649 for( i
= 0; i
< pWrdList
->size(); i
++ )
1651 m_pDoubleCapsLB
->InsertEntry((*pWrdList
)[i
]);
1656 void OfaAutocorrExceptPage::Reset( const SfxItemSet
* )
1658 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
1659 RefillReplaceBoxes(true, eLang
, eLang
);
1660 m_pAutoAbbrevCB
-> Check( pAutoCorrect
->IsAutoCorrFlag( SaveWordCplSttLst
));
1661 m_pAutoCapsCB
-> Check( pAutoCorrect
->IsAutoCorrFlag( SaveWordWrdSttLst
));
1662 m_pAutoAbbrevCB
->SaveValue();
1663 m_pAutoCapsCB
->SaveValue();
1666 IMPL_LINK(OfaAutocorrExceptPage
, NewDelHdl
, void*, pBtn
)
1668 if((pBtn
== m_pNewAbbrevPB
|| pBtn
== m_pAbbrevED
.get() )
1669 && !m_pAbbrevED
->GetText().isEmpty())
1671 m_pAbbrevLB
->InsertEntry(m_pAbbrevED
->GetText());
1672 ModifyHdl(m_pAbbrevED
);
1674 else if(pBtn
== m_pDelAbbrevPB
)
1676 m_pAbbrevLB
->RemoveEntry(m_pAbbrevED
->GetText());
1677 ModifyHdl(m_pAbbrevED
);
1679 else if((pBtn
== m_pNewDoublePB
|| pBtn
== m_pDoubleCapsED
.get() )
1680 && !m_pDoubleCapsED
->GetText().isEmpty())
1682 m_pDoubleCapsLB
->InsertEntry(m_pDoubleCapsED
->GetText());
1683 ModifyHdl(m_pDoubleCapsED
);
1685 else if(pBtn
== m_pDelDoublePB
)
1687 m_pDoubleCapsLB
->RemoveEntry(m_pDoubleCapsED
->GetText());
1688 ModifyHdl(m_pDoubleCapsED
);
1693 IMPL_LINK(OfaAutocorrExceptPage
, SelectHdl
, ListBox
*, pBox
)
1695 if (pBox
== m_pAbbrevLB
)
1697 m_pAbbrevED
->SetText(pBox
->GetSelectEntry());
1698 m_pNewAbbrevPB
->Enable(false);
1699 m_pDelAbbrevPB
->Enable();
1703 m_pDoubleCapsED
->SetText(pBox
->GetSelectEntry());
1704 m_pNewDoublePB
->Enable(false);
1705 m_pDelDoublePB
->Enable();
1710 IMPL_LINK(OfaAutocorrExceptPage
, ModifyHdl
, Edit
*, pEdt
)
1712 // sal_Bool bSame = pEdt->GetText() == ->GetSelectEntry();
1713 const OUString
& sEntry
= pEdt
->GetText();
1714 bool bEntryLen
= !sEntry
.isEmpty();
1715 if(pEdt
== m_pAbbrevED
)
1717 bool bSame
= lcl_FindEntry(*m_pAbbrevLB
, sEntry
, *pCompareClass
);
1718 if(bSame
&& sEntry
!= m_pAbbrevLB
->GetSelectEntry())
1719 pEdt
->SetText(m_pAbbrevLB
->GetSelectEntry());
1720 m_pNewAbbrevPB
->Enable(!bSame
&& bEntryLen
);
1721 m_pDelAbbrevPB
->Enable(bSame
&& bEntryLen
);
1725 bool bSame
= lcl_FindEntry(*m_pDoubleCapsLB
, sEntry
, *pCompareClass
);
1726 if(bSame
&& sEntry
!= m_pDoubleCapsLB
->GetSelectEntry())
1727 pEdt
->SetText(m_pDoubleCapsLB
->GetSelectEntry());
1728 m_pNewDoublePB
->Enable(!bSame
&& bEntryLen
);
1729 m_pDelDoublePB
->Enable(bSame
&& bEntryLen
);
1734 VCL_BUILDER_FACTORY(AutoCorrEdit
)
1736 void AutoCorrEdit::dispose()
1738 m_xReplaceTLB
.disposeAndClear();
1742 AutoCorrEdit::~AutoCorrEdit() {
1746 void AutoCorrEdit::ConnectColumn(const VclPtr
<SvTabListBox
>& rTable
, sal_Int32 nCol
)
1748 m_xReplaceTLB
= rTable
;
1752 void AutoCorrEdit::KeyInput( const KeyEvent
& rKEvt
)
1754 const vcl::KeyCode aKeyCode
= rKEvt
.GetKeyCode();
1755 const sal_uInt16 nModifier
= aKeyCode
.GetModifier();
1756 if( aKeyCode
.GetCode() == KEY_RETURN
)
1758 // if there's nothing done on enter, call the
1759 // base class after all to close the dialog
1760 if(!nModifier
&& !aActionLink
.Call(this))
1761 Edit::KeyInput(rKEvt
);
1763 else if(bSpaces
|| aKeyCode
.GetCode() != KEY_SPACE
)
1764 Edit::KeyInput(rKEvt
);
1767 void AutoCorrEdit::Resize()
1772 m_xReplaceTLB
->SetTab(m_nCol
, GetPosPixel().X(), MAP_PIXEL
);
1775 enum OfaQuoteOptions
1781 SvTreeListEntry
* OfaQuoteTabPage::CreateEntry(OUString
& rTxt
, sal_uInt16 nCol
)
1783 SvTreeListEntry
* pEntry
= new SvTreeListEntry
;
1785 if ( !pCheckButtonData
)
1787 pCheckButtonData
= new SvLBoxButtonData(m_pSwCheckLB
);
1788 m_pSwCheckLB
->SetCheckButtonData(pCheckButtonData
);
1791 pEntry
->AddItem( new SvLBoxContextBmp( pEntry
, 0, Image(), Image(), false));
1794 if (nCol
== CBCOL_SECOND
)
1795 pEntry
->AddItem( new SvLBoxString( pEntry
, 0, sEmpty
) );
1797 pEntry
->AddItem( new SvLBoxButton( pEntry
, SvLBoxButtonKind_enabledCheckbox
, 0, pCheckButtonData
) );
1799 if (nCol
== CBCOL_FIRST
)
1800 pEntry
->AddItem( new SvLBoxString( pEntry
, 0, sEmpty
) );
1802 pEntry
->AddItem( new SvLBoxButton( pEntry
, SvLBoxButtonKind_enabledCheckbox
, 0, pCheckButtonData
) );
1804 pEntry
->AddItem( new OfaImpBrwString( pEntry
, 0, rTxt
) );
1809 OfaQuoteTabPage::OfaQuoteTabPage(vcl::Window
* pParent
, const SfxItemSet
& rSet
)
1810 : SfxTabPage(pParent
, "ApplyLocalizedPage", "cui/ui/applylocalizedpage.ui", &rSet
)
1811 , sNonBrkSpace(CUI_RESSTR(RID_SVXSTR_NON_BREAK_SPACE
))
1812 , sOrdinal(CUI_RESSTR(RID_SVXSTR_ORDINAL
))
1813 , pCheckButtonData(NULL
)
1819 get(m_pCheckLB
, "checklist");
1821 SvSimpleTableContainer
*pListContainer
= get
<SvSimpleTableContainer
>("list");
1822 Size
aControlSize(252 , 85);
1823 aControlSize
= LogicToPixel(aControlSize
, MAP_APPFONT
);
1824 pListContainer
->set_width_request(aControlSize
.Width());
1825 pListContainer
->set_height_request(aControlSize
.Height());
1826 m_pSwCheckLB
= VclPtr
<OfaACorrCheckListBox
>::Create(*pListContainer
),
1828 get(m_pSingleTypoCB
, "singlereplace");
1829 get(m_pSglStartQuotePB
, "startsingle");
1830 get(m_pSglStartExFT
, "singlestartex");
1831 get(m_pSglEndQuotePB
, "endsingle");
1832 get(m_pSglEndExFT
, "singleendex");
1833 get(m_pSglStandardPB
, "defaultsingle");
1835 get(m_pDoubleTypoCB
, "doublereplace");
1836 get(m_pDblStartQuotePB
, "startdouble");
1837 get(m_pDblStartExFT
, "doublestartex");
1838 get(m_pDblEndQuotePB
, "enddouble");
1839 get(m_pDblEndExFT
, "doubleendex");
1840 get(m_pDblStandardPB
, "defaultdouble");
1842 using comphelper::string::strip
;
1844 m_sStartQuoteDlg
= strip(get
<FixedText
>("startquoteft")->GetText(), ':');
1845 m_sEndQuoteDlg
= strip(get
<FixedText
>("endquoteft")->GetText(), ':');
1846 m_sStandard
= get
<FixedText
>("singlestartex")->GetText();
1848 bool bShowSWOptions
= false;
1850 SFX_ITEMSET_ARG( &rSet
, pItem
, SfxBoolItem
, SID_AUTO_CORRECT_DLG
, false );
1851 if ( pItem
&& pItem
->GetValue() )
1852 bShowSWOptions
= true;
1854 if ( bShowSWOptions
)
1856 static long aStaticTabs
[]=
1861 m_pSwCheckLB
->SetStyle(m_pSwCheckLB
->GetStyle() | WB_HSCROLL
| WB_VSCROLL
);
1863 m_pSwCheckLB
->SvSimpleTable::SetTabs(aStaticTabs
);
1864 OUString
sHeader(get
<vcl::Window
>("m")->GetText());
1866 sHeader
+= get
<vcl::Window
>("t")->GetText();
1868 m_pSwCheckLB
->InsertHeaderEntry( sHeader
, HEADERBAR_APPEND
,
1869 HeaderBarItemBits::CENTER
| HeaderBarItemBits::VCENTER
| HeaderBarItemBits::FIXEDPOS
| HeaderBarItemBits::FIXED
);
1874 m_pSwCheckLB
->HideTable();
1877 m_pDblStartQuotePB
->SetClickHdl(LINK(this, OfaQuoteTabPage
, QuoteHdl
));
1878 m_pDblEndQuotePB
->SetClickHdl(LINK(this, OfaQuoteTabPage
, QuoteHdl
));
1879 m_pSglStartQuotePB
->SetClickHdl(LINK(this, OfaQuoteTabPage
, QuoteHdl
));
1880 m_pSglEndQuotePB
->SetClickHdl(LINK(this, OfaQuoteTabPage
, QuoteHdl
));
1881 m_pDblStandardPB
->SetClickHdl(LINK(this, OfaQuoteTabPage
, StdQuoteHdl
));
1882 m_pSglStandardPB
->SetClickHdl(LINK(this, OfaQuoteTabPage
, StdQuoteHdl
));
1885 OfaQuoteTabPage::~OfaQuoteTabPage()
1890 void OfaQuoteTabPage::dispose()
1892 delete pCheckButtonData
;
1893 pCheckButtonData
= NULL
;
1894 m_pSwCheckLB
.disposeAndClear();
1895 m_pCheckLB
.disposeAndClear();
1896 m_pSingleTypoCB
.clear();
1897 m_pSglStartQuotePB
.clear();
1898 m_pSglStartExFT
.clear();
1899 m_pSglEndQuotePB
.clear();
1900 m_pSglEndExFT
.clear();
1901 m_pSglStandardPB
.clear();
1902 m_pDoubleTypoCB
.clear();
1903 m_pDblStartQuotePB
.clear();
1904 m_pDblStartExFT
.clear();
1905 m_pDblEndQuotePB
.clear();
1906 m_pDblEndExFT
.clear();
1907 m_pDblStandardPB
.clear();
1908 SfxTabPage::dispose();
1911 VclPtr
<SfxTabPage
> OfaQuoteTabPage::Create( vcl::Window
* pParent
,
1912 const SfxItemSet
* rAttrSet
)
1914 return VclPtr
<OfaQuoteTabPage
>::Create(pParent
, *rAttrSet
);
1917 bool OfaQuoteTabPage::FillItemSet( SfxItemSet
* )
1919 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
1921 long nFlags
= pAutoCorrect
->GetFlags();
1923 if (m_pCheckLB
->IsVisible())
1926 pAutoCorrect
->SetAutoCorrFlag(AddNonBrkSpace
, m_pCheckLB
->IsChecked(nPos
++));
1927 pAutoCorrect
->SetAutoCorrFlag(ChgOrdinalNumber
, m_pCheckLB
->IsChecked(nPos
++));
1930 bool bModified
= false;
1931 if (m_pSwCheckLB
->IsVisible())
1933 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
1935 bool bCheck
= m_pSwCheckLB
->IsChecked(ADD_NONBRK_SPACE
, CBCOL_FIRST
);
1936 bModified
|= pOpt
->bAddNonBrkSpace
!= bCheck
;
1937 pOpt
->bAddNonBrkSpace
= bCheck
;
1938 pAutoCorrect
->SetAutoCorrFlag(AddNonBrkSpace
,
1939 m_pSwCheckLB
->IsChecked(ADD_NONBRK_SPACE
, CBCOL_SECOND
));
1941 bCheck
= m_pSwCheckLB
->IsChecked(REPLACE_1ST
, CBCOL_FIRST
);
1942 bModified
|= pOpt
->bChgOrdinalNumber
!= bCheck
;
1943 pOpt
->bChgOrdinalNumber
= bCheck
;
1944 pAutoCorrect
->SetAutoCorrFlag(ChgOrdinalNumber
,
1945 m_pSwCheckLB
->IsChecked(REPLACE_1ST
, CBCOL_SECOND
));
1948 pAutoCorrect
->SetAutoCorrFlag(ChgQuotes
, m_pDoubleTypoCB
->IsChecked());
1949 pAutoCorrect
->SetAutoCorrFlag(ChgSglQuotes
, m_pSingleTypoCB
->IsChecked());
1950 bool bReturn
= nFlags
!= pAutoCorrect
->GetFlags();
1951 if(cStartQuote
!= pAutoCorrect
->GetStartDoubleQuote())
1954 sal_Unicode cUCS2
= static_cast<sal_Unicode
>(cStartQuote
); //TODO
1955 pAutoCorrect
->SetStartDoubleQuote(cUCS2
);
1957 if(cEndQuote
!= pAutoCorrect
->GetEndDoubleQuote())
1960 sal_Unicode cUCS2
= static_cast<sal_Unicode
>(cEndQuote
); //TODO
1961 pAutoCorrect
->SetEndDoubleQuote(cUCS2
);
1963 if(cSglStartQuote
!= pAutoCorrect
->GetStartSingleQuote())
1966 sal_Unicode cUCS2
= static_cast<sal_Unicode
>(cSglStartQuote
); //TODO
1967 pAutoCorrect
->SetStartSingleQuote(cUCS2
);
1969 if(cSglEndQuote
!= pAutoCorrect
->GetEndSingleQuote())
1972 sal_Unicode cUCS2
= static_cast<sal_Unicode
>(cSglEndQuote
); //TODO
1973 pAutoCorrect
->SetEndSingleQuote(cUCS2
);
1976 if( bModified
|| bReturn
)
1978 SvxAutoCorrCfg
& rCfg
= SvxAutoCorrCfg::Get();
1985 void OfaQuoteTabPage::ActivatePage( const SfxItemSet
& )
1987 static_cast<OfaAutoCorrDlg
*>(GetTabDialog())->EnableLanguage(false);
1990 void OfaQuoteTabPage::Reset( const SfxItemSet
* )
1992 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
1993 const long nFlags
= pAutoCorrect
->GetFlags();
1995 // Initialize the Sw options
1996 if (m_pSwCheckLB
->IsVisible())
1998 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
2000 m_pSwCheckLB
->SetUpdateMode( false );
2001 m_pSwCheckLB
->Clear();
2003 m_pSwCheckLB
->GetModel()->Insert(CreateEntry(sNonBrkSpace
, CBCOL_BOTH
));
2004 m_pSwCheckLB
->GetModel()->Insert(CreateEntry(sOrdinal
, CBCOL_BOTH
));
2006 m_pSwCheckLB
->CheckEntryPos( ADD_NONBRK_SPACE
, CBCOL_FIRST
, pOpt
->bAddNonBrkSpace
);
2007 m_pSwCheckLB
->CheckEntryPos( ADD_NONBRK_SPACE
, CBCOL_SECOND
, 0 != (nFlags
& AddNonBrkSpace
) );
2008 m_pSwCheckLB
->CheckEntryPos( REPLACE_1ST
, CBCOL_FIRST
, pOpt
->bChgOrdinalNumber
);
2009 m_pSwCheckLB
->CheckEntryPos( REPLACE_1ST
, CBCOL_SECOND
, 0 != (nFlags
& ChgOrdinalNumber
) );
2011 m_pSwCheckLB
->SetUpdateMode( true );
2014 // Initialize the non Sw options
2015 if (m_pCheckLB
->IsVisible())
2017 m_pCheckLB
->SetUpdateMode(false);
2018 m_pCheckLB
->Clear();
2020 m_pCheckLB
->InsertEntry( sNonBrkSpace
);
2021 m_pCheckLB
->InsertEntry( sOrdinal
);
2024 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& AddNonBrkSpace
) );
2025 m_pCheckLB
->CheckEntryPos( nPos
++, 0 != (nFlags
& ChgOrdinalNumber
) );
2027 m_pCheckLB
->SetUpdateMode(true);
2030 // Initialize the quote stuffs
2031 m_pDoubleTypoCB
->Check(0 != (nFlags
& ChgQuotes
));
2032 m_pSingleTypoCB
->Check(0 != (nFlags
& ChgSglQuotes
));
2033 m_pDoubleTypoCB
->SaveValue();
2034 m_pSingleTypoCB
->SaveValue();
2036 cStartQuote
= pAutoCorrect
->GetStartDoubleQuote();
2037 cEndQuote
= pAutoCorrect
->GetEndDoubleQuote();
2038 cSglStartQuote
= pAutoCorrect
->GetStartSingleQuote();
2039 cSglEndQuote
= pAutoCorrect
->GetEndSingleQuote();
2041 m_pSglStartExFT
->SetText(ChangeStringExt_Impl(cSglStartQuote
));
2042 m_pSglEndExFT
->SetText(ChangeStringExt_Impl(cSglEndQuote
));
2043 m_pDblStartExFT
->SetText(ChangeStringExt_Impl(cStartQuote
));
2044 m_pDblEndExFT
->SetText(ChangeStringExt_Impl(cEndQuote
));
2053 IMPL_LINK( OfaQuoteTabPage
, QuoteHdl
, PushButton
*, pBtn
)
2055 sal_uInt16 nMode
= SGL_START
;
2056 if (pBtn
== m_pSglEndQuotePB
)
2058 else if (pBtn
== m_pDblStartQuotePB
)
2060 else if (pBtn
== m_pDblEndQuotePB
)
2062 // start character selection dialog
2063 ScopedVclPtrInstance
< SvxCharacterMap
> pMap( this, true );
2064 pMap
->SetCharFont( OutputDevice::GetDefaultFont(DefaultFontType::LATIN_TEXT
,
2065 LANGUAGE_ENGLISH_US
, GetDefaultFontFlags::OnlyOne
, 0 ));
2066 pMap
->SetText(nMode
< SGL_END
? m_sStartQuoteDlg
: m_sEndQuoteDlg
);
2068 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
2069 LanguageType eLang
= Application::GetSettings().GetLanguageTag().getLanguageType();
2073 cDlg
= cSglStartQuote
;
2075 cDlg
= pAutoCorrect
->GetQuote('\'', true, eLang
);
2078 cDlg
= cSglEndQuote
;
2080 cDlg
= pAutoCorrect
->GetQuote('\'', false, eLang
);
2085 cDlg
= pAutoCorrect
->GetQuote('\"', true, eLang
);
2090 cDlg
= pAutoCorrect
->GetQuote('\"', false, eLang
);
2093 OSL_FAIL("svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" );
2098 pMap
->SetChar( cDlg
);
2099 pMap
->DisableFontSelection();
2100 if(pMap
->Execute() == RET_OK
)
2102 sal_UCS4 cNewChar
= pMap
->GetChar();
2106 cSglStartQuote
= cNewChar
;
2107 m_pSglStartExFT
->SetText(ChangeStringExt_Impl(cNewChar
));
2110 cSglEndQuote
= cNewChar
;
2111 m_pSglEndExFT
->SetText(ChangeStringExt_Impl(cNewChar
));
2114 cStartQuote
= cNewChar
;
2115 m_pDblStartExFT
->SetText(ChangeStringExt_Impl(cNewChar
));
2118 cEndQuote
= cNewChar
;
2119 m_pDblEndExFT
->SetText(ChangeStringExt_Impl(cNewChar
));
2127 IMPL_LINK( OfaQuoteTabPage
, StdQuoteHdl
, PushButton
*, pBtn
)
2129 if (pBtn
== m_pDblStandardPB
)
2132 m_pDblStartExFT
->SetText(ChangeStringExt_Impl(0));
2134 m_pDblEndExFT
->SetText(ChangeStringExt_Impl(0));
2140 m_pSglStartExFT
->SetText(ChangeStringExt_Impl(0));
2142 m_pSglEndExFT
->SetText(ChangeStringExt_Impl(0));
2149 OUString
OfaQuoteTabPage::ChangeStringExt_Impl( sal_UCS4 cChar
)
2154 // convert codepoint value to unicode-hex string
2155 sal_UCS4 aStrCodes
[32] = { 0, ' ', '(', 'U', '+', '0' };
2156 aStrCodes
[0] = cChar
;
2159 while( (cChar
>> (4*nHexLen
)) != 0 )
2161 for( int i
= nHexLen
; --i
>= 0;)
2163 sal_UCS4 cHexDigit
= ((cChar
>> (4*i
)) & 0x0f) + '0';
2164 if( cHexDigit
> '9' )
2165 cHexDigit
+= 'A' - ('9' + 1);
2166 aStrCodes
[ nFullLen
++ ] = cHexDigit
;
2168 aStrCodes
[ nFullLen
++ ] = ')';
2169 // using the new UCS4 constructor
2170 OUString
aOUStr( aStrCodes
, nFullLen
);
2174 OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(vcl::Window
* pParent
,
2175 const SfxItemSet
& rSet
)
2176 : SfxTabPage(pParent
, "WordCompletionPage",
2177 "cui/ui/wordcompletionpage.ui", &rSet
)
2178 , m_pAutoCompleteList(0)
2179 , m_nAutoCmpltListCnt(0)
2181 get(m_pCBActiv
, "enablewordcomplete");
2182 get(m_pCBAppendSpace
, "appendspace");
2183 get(m_pCBAsTip
, "showastip");
2184 get(m_pCBCollect
, "collectwords");
2185 get(m_pCBRemoveList
, "whenclosing");
2187 //fdo#65595, we need height-for-width support here, but for now we can
2189 Size
aPrefSize(m_pCBRemoveList
->get_preferred_size());
2190 Size
aSize(m_pCBRemoveList
->CalcMinimumSize(32*approximate_char_width()));
2191 if (aPrefSize
.Width() > aSize
.Width())
2193 m_pCBRemoveList
->set_width_request(aSize
.Width());
2194 m_pCBRemoveList
->set_height_request(aSize
.Height());
2197 get(m_pDCBExpandKey
, "acceptwith");
2198 get(m_pNFMinWordlen
, "minwordlen");
2199 get(m_pNFMaxEntries
, "maxentries");
2200 get(m_pLBEntries
, "entries");
2201 m_pLBEntries
->SetPage(this);
2202 aSize
= LogicToPixel(Size(121, 158), MAP_APPFONT
);
2203 m_pLBEntries
->set_width_request(aSize
.Width());
2204 m_pLBEntries
->set_height_request(aSize
.Height());
2205 get(m_pPBEntries
, "delete");
2208 static const sal_uInt16 aKeyCodes
[] = {
2217 for( const sal_uInt16
* pKeys
= aKeyCodes
; *pKeys
; ++pKeys
)
2219 vcl::KeyCode
aKCode( *pKeys
);
2220 sal_Int32 nPos
= m_pDCBExpandKey
->InsertEntry( aKCode
.GetName() );
2221 m_pDCBExpandKey
->SetEntryData( nPos
, reinterpret_cast<void*>(*pKeys
) );
2222 if( KEY_RETURN
== *pKeys
) // default to RETURN
2223 m_pDCBExpandKey
->SelectEntryPos( nPos
);
2226 m_pPBEntries
->SetClickHdl(LINK(this, OfaAutoCompleteTabPage
, DeleteHdl
));
2227 m_pCBActiv
->SetToggleHdl(LINK(this, OfaAutoCompleteTabPage
, CheckHdl
));
2228 m_pCBCollect
->SetToggleHdl(LINK(this, OfaAutoCompleteTabPage
, CheckHdl
));
2231 OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage()
2236 void OfaAutoCompleteTabPage::dispose()
2239 m_pCBAppendSpace
.clear();
2241 m_pCBCollect
.clear();
2242 m_pCBRemoveList
.clear();
2243 m_pDCBExpandKey
.clear();
2244 m_pNFMinWordlen
.clear();
2245 m_pNFMaxEntries
.clear();
2246 m_pLBEntries
.clear();
2247 m_pPBEntries
.clear();
2248 SfxTabPage::dispose();
2251 VclPtr
<SfxTabPage
> OfaAutoCompleteTabPage::Create( vcl::Window
* pParent
,
2252 const SfxItemSet
* rSet
)
2254 return VclPtr
<OfaAutoCompleteTabPage
>::Create( pParent
, *rSet
);
2257 bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet
* )
2259 bool bModified
= false, bCheck
;
2260 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
2261 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
2264 bCheck
= m_pCBActiv
->IsChecked();
2265 bModified
|= pOpt
->bAutoCompleteWords
!= bCheck
;
2266 pOpt
->bAutoCompleteWords
= bCheck
;
2267 bCheck
= m_pCBCollect
->IsChecked();
2268 bModified
|= pOpt
->bAutoCmpltCollectWords
!= bCheck
;
2269 pOpt
->bAutoCmpltCollectWords
= bCheck
;
2270 bCheck
= !m_pCBRemoveList
->IsChecked(); // inverted value!
2271 bModified
|= pOpt
->bAutoCmpltKeepList
!= bCheck
;
2272 pOpt
->bAutoCmpltKeepList
= bCheck
;
2273 bCheck
= m_pCBAppendSpace
->IsChecked();
2274 bModified
|= pOpt
->bAutoCmpltAppendBlanc
!= bCheck
;
2275 pOpt
->bAutoCmpltAppendBlanc
= bCheck
;
2276 bCheck
= m_pCBAsTip
->IsChecked();
2277 bModified
|= pOpt
->bAutoCmpltShowAsTip
!= bCheck
;
2278 pOpt
->bAutoCmpltShowAsTip
= bCheck
;
2280 nVal
= (sal_uInt16
)m_pNFMinWordlen
->GetValue();
2281 bModified
|= nVal
!= pOpt
->nAutoCmpltWordLen
;
2282 pOpt
->nAutoCmpltWordLen
= nVal
;
2284 nVal
= (sal_uInt16
)m_pNFMaxEntries
->GetValue();
2285 bModified
|= nVal
!= pOpt
->nAutoCmpltListLen
;
2286 pOpt
->nAutoCmpltListLen
= nVal
;
2288 nVal
= m_pDCBExpandKey
->GetSelectEntryPos();
2289 if( nVal
< m_pDCBExpandKey
->GetEntryCount() )
2291 sal_uLong nKey
= reinterpret_cast<sal_uLong
>(m_pDCBExpandKey
->GetEntryData( nVal
));
2292 bModified
|= nKey
!= pOpt
->nAutoCmpltExpandKey
;
2293 pOpt
->nAutoCmpltExpandKey
= (sal_uInt16
)nKey
;
2296 if (m_pAutoCompleteList
&& m_nAutoCmpltListCnt
!= m_pLBEntries
->GetEntryCount())
2299 pOpt
->m_pAutoCompleteList
= m_pAutoCompleteList
;
2303 SvxAutoCorrCfg
& rCfg
= SvxAutoCorrCfg::Get();
2310 void OfaAutoCompleteTabPage::Reset( const SfxItemSet
* )
2312 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
2313 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
2315 m_pCBActiv
->Check( pOpt
->bAutoCompleteWords
);
2316 m_pCBCollect
->Check( pOpt
->bAutoCmpltCollectWords
);
2317 m_pCBRemoveList
->Check( !pOpt
->bAutoCmpltKeepList
); //inverted value!
2318 m_pCBAppendSpace
->Check( pOpt
->bAutoCmpltAppendBlanc
);
2319 m_pCBAsTip
->Check( pOpt
->bAutoCmpltShowAsTip
);
2321 m_pNFMinWordlen
->SetValue( pOpt
->nAutoCmpltWordLen
);
2322 m_pNFMaxEntries
->SetValue( pOpt
->nAutoCmpltListLen
);
2324 // select the specific KeyCode:
2326 sal_uLong nKey
= pOpt
->nAutoCmpltExpandKey
;
2327 for( sal_Int32 n
= 0, nCnt
= m_pDCBExpandKey
->GetEntryCount(); n
< nCnt
; ++n
)
2328 if( nKey
== reinterpret_cast<sal_uLong
>(m_pDCBExpandKey
->GetEntryData( n
)))
2330 m_pDCBExpandKey
->SelectEntryPos( n
);
2335 if (pOpt
->m_pAutoCompleteList
&& pOpt
->m_pAutoCompleteList
->size())
2337 m_pAutoCompleteList
= const_cast<editeng::SortedAutoCompleteStrings
*>(
2338 pOpt
->m_pAutoCompleteList
);
2339 pOpt
->m_pAutoCompleteList
= 0;
2340 m_nAutoCmpltListCnt
= m_pAutoCompleteList
->size();
2341 for (size_t n
= 0; n
< m_nAutoCmpltListCnt
; ++n
)
2343 const OUString
* pStr
=
2344 &(*m_pAutoCompleteList
)[n
]->GetAutoCompleteString();
2345 sal_Int32 nPos
= m_pLBEntries
->InsertEntry( *pStr
);
2346 m_pLBEntries
->SetEntryData( nPos
, (void*)pStr
);
2351 m_pLBEntries
->Disable();
2352 m_pPBEntries
->Disable();
2355 CheckHdl(m_pCBActiv
);
2356 CheckHdl(m_pCBCollect
);
2359 void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet
& )
2361 static_cast<OfaAutoCorrDlg
*>(GetTabDialog())->EnableLanguage( false );
2364 IMPL_LINK_NOARG(OfaAutoCompleteTabPage
, DeleteHdl
)
2367 (m_pAutoCompleteList
) ? m_pLBEntries
->GetSelectEntryCount() : 0;
2370 sal_Int32 nPos
= m_pLBEntries
->GetSelectEntryPos( --nSelCnt
);
2371 OUString
* pStr
= static_cast<OUString
*>(m_pLBEntries
->GetEntryData(nPos
));
2372 m_pLBEntries
->RemoveEntry( nPos
);
2373 editeng::IAutoCompleteString
hack(*pStr
); // UGLY
2374 m_pAutoCompleteList
->erase(&hack
);
2379 IMPL_LINK( OfaAutoCompleteTabPage
, CheckHdl
, CheckBox
*, pBox
)
2381 bool bEnable
= pBox
->IsChecked();
2382 if (pBox
== m_pCBActiv
)
2384 m_pCBAppendSpace
->Enable( bEnable
);
2385 m_pCBAppendSpace
->Enable( bEnable
);
2386 m_pCBAsTip
->Enable( bEnable
);
2387 m_pDCBExpandKey
->Enable( bEnable
);
2389 else if (m_pCBCollect
== pBox
)
2390 m_pCBRemoveList
->Enable( bEnable
);
2394 void OfaAutoCompleteTabPage::CopyToClipboard() const
2396 sal_Int32 nSelCnt
= m_pLBEntries
->GetSelectEntryCount();
2397 if (m_pAutoCompleteList
&& nSelCnt
)
2399 TransferDataContainer
* pCntnr
= new TransferDataContainer
;
2400 ::com::sun::star::uno::Reference
<
2401 ::com::sun::star::datatransfer::XTransferable
> xRef( pCntnr
);
2403 OStringBuffer sData
;
2404 const sal_Char aLineEnd
[] =
2411 rtl_TextEncoding nEncode
= osl_getThreadTextEncoding();
2413 for( sal_Int32 n
= 0; n
< nSelCnt
; ++n
)
2415 sData
.append(OUStringToOString(m_pLBEntries
->GetSelectEntry(n
),
2417 sData
.append(aLineEnd
);
2419 pCntnr
->CopyByteString( SotClipboardFormatId::STRING
, sData
.makeStringAndClear() );
2420 pCntnr
->CopyToClipboard( (vcl::Window
*)this );
2424 OfaAutoCompleteTabPage::AutoCompleteMultiListBox::~AutoCompleteMultiListBox()
2429 void OfaAutoCompleteTabPage::AutoCompleteMultiListBox::dispose()
2432 MultiListBox::dispose();
2435 bool OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify(
2436 NotifyEvent
& rNEvt
)
2438 bool nHandled
= MultiListBox::PreNotify( rNEvt
);
2440 if( !nHandled
&& MouseNotifyEvent::KEYUP
== rNEvt
.GetType() )
2442 const vcl::KeyCode
& rKeyCode
= rNEvt
.GetKeyEvent()->GetKeyCode();
2443 switch( rKeyCode
.GetModifier() | rKeyCode
.GetCode() )
2446 m_pPage
->DeleteHdl( 0 );
2451 if( KeyFuncType::COPY
== rKeyCode
.GetFunction() )
2453 m_pPage
->CopyToClipboard();
2462 VCL_BUILDER_DECL_FACTORY(AutoCompleteMultiListBox
)
2464 WinBits nWinBits
= WB_TABSTOP
;
2466 OString sBorder
= VclBuilder::extractCustomProperty(rMap
);
2467 if (!sBorder
.isEmpty())
2468 nWinBits
|= WB_BORDER
;
2470 rRet
= VclPtr
<OfaAutoCompleteTabPage::AutoCompleteMultiListBox
>::Create(pParent
, nWinBits
);
2473 // class OfaSmartTagOptionsTabPage ---------------------------------------------
2475 OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( vcl::Window
* pParent
,
2476 const SfxItemSet
& rSet
)
2477 : SfxTabPage(pParent
, "SmartTagOptionsPage", "cui/ui/smarttagoptionspage.ui", &rSet
)
2479 get(m_pMainCB
, "main");
2480 get(m_pSmartTagTypesLB
, "list");
2481 get(m_pPropertiesPB
, "properties");
2483 // some options for the list box:
2484 m_pSmartTagTypesLB
->SetStyle( m_pSmartTagTypesLB
->GetStyle() | WB_HSCROLL
| WB_HIDESELECTION
);
2485 m_pSmartTagTypesLB
->SetHighlightRange();
2486 Size
aControlSize(LogicToPixel(Size(172, 154), MAP_APPFONT
));
2487 m_pSmartTagTypesLB
->set_width_request(aControlSize
.Width());
2488 m_pSmartTagTypesLB
->set_height_request(aControlSize
.Height());
2490 // set the handlers:
2491 m_pMainCB
->SetToggleHdl(LINK(this, OfaSmartTagOptionsTabPage
, CheckHdl
));
2492 m_pPropertiesPB
->SetClickHdl(LINK(this, OfaSmartTagOptionsTabPage
, ClickHdl
));
2493 m_pSmartTagTypesLB
->SetSelectHdl(LINK(this, OfaSmartTagOptionsTabPage
, SelectHdl
));
2496 OfaSmartTagOptionsTabPage::~OfaSmartTagOptionsTabPage()
2501 void OfaSmartTagOptionsTabPage::dispose()
2504 m_pSmartTagTypesLB
.clear();
2505 m_pPropertiesPB
.clear();
2506 SfxTabPage::dispose();
2509 VclPtr
<SfxTabPage
> OfaSmartTagOptionsTabPage::Create( vcl::Window
* pParent
, const SfxItemSet
* rSet
)
2511 return VclPtr
<OfaSmartTagOptionsTabPage
>::Create( pParent
, *rSet
);
2514 /** This struct is used to associate list box entries with smart tag data
2516 struct ImplSmartTagLBUserData
2518 OUString maSmartTagType
;
2519 uno::Reference
< smarttags::XSmartTagRecognizer
> mxRec
;
2520 sal_Int32 mnSmartTagIdx
;
2522 ImplSmartTagLBUserData( const OUString
& rSmartTagType
,
2523 uno::Reference
< smarttags::XSmartTagRecognizer
> xRec
,
2524 sal_Int32 nSmartTagIdx
) :
2525 maSmartTagType( rSmartTagType
),
2527 mnSmartTagIdx( nSmartTagIdx
) {}
2530 /** Clears m_pSmartTagTypesLB
2532 void OfaSmartTagOptionsTabPage::ClearListBox()
2534 const sal_uLong nCount
= m_pSmartTagTypesLB
->GetEntryCount();
2535 for ( sal_uLong i
= 0; i
< nCount
; ++i
)
2537 const SvTreeListEntry
* pEntry
= m_pSmartTagTypesLB
->GetEntry(i
);
2538 const ImplSmartTagLBUserData
* pUserData
= static_cast< ImplSmartTagLBUserData
* >(pEntry
->GetUserData());
2542 m_pSmartTagTypesLB
->Clear();
2545 /** Inserts items into m_pSmartTagTypesLB
2547 void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr
& rSmartTagMgr
)
2549 // first we have to clear the list box:
2553 const sal_uInt32 nNumberOfRecognizers
= rSmartTagMgr
.NumberOfRecognizers();
2554 const lang::Locale
aLocale( LanguageTag::convertToLocale( eLastDialogLanguage
) );
2556 for ( sal_uInt32 i
= 0; i
< nNumberOfRecognizers
; ++i
)
2558 uno::Reference
< smarttags::XSmartTagRecognizer
> xRec
= rSmartTagMgr
.GetRecognizer(i
);
2560 const OUString aName
= xRec
->getName( aLocale
);
2561 const sal_Int32 nNumberOfSupportedSmartTags
= xRec
->getSmartTagCount();
2563 for ( sal_Int32 j
= 0; j
< nNumberOfSupportedSmartTags
; ++j
)
2565 const OUString aSmartTagType
= xRec
->getSmartTagName(j
);
2566 OUString aSmartTagCaption
= rSmartTagMgr
.GetSmartTagCaption( aSmartTagType
, aLocale
);
2568 if ( aSmartTagCaption
.isEmpty() )
2569 aSmartTagCaption
= aSmartTagType
;
2571 const OUString aLBEntry
= aSmartTagCaption
+ " (" + aName
+ ")";
2573 SvTreeListEntry
* pEntry
= m_pSmartTagTypesLB
->SvTreeListBox::InsertEntry( aLBEntry
);
2576 const bool bCheck
= rSmartTagMgr
.IsSmartTagTypeEnabled( aSmartTagType
);
2577 m_pSmartTagTypesLB
->SetCheckButtonState( pEntry
, bCheck
? SV_BUTTON_CHECKED
: SV_BUTTON_UNCHECKED
);
2578 pEntry
->SetUserData(static_cast<void*>(new ImplSmartTagLBUserData( aSmartTagType
, xRec
, j
) ) );
2584 /** Handler for the push button
2586 IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage
, ClickHdl
)
2588 const sal_uLong nPos
= m_pSmartTagTypesLB
->GetSelectEntryPos();
2589 const SvTreeListEntry
* pEntry
= m_pSmartTagTypesLB
->GetEntry(nPos
);
2590 const ImplSmartTagLBUserData
* pUserData
= static_cast< ImplSmartTagLBUserData
* >(pEntry
->GetUserData());
2591 uno::Reference
< smarttags::XSmartTagRecognizer
> xRec
= pUserData
->mxRec
;
2592 const sal_Int32 nSmartTagIdx
= pUserData
->mnSmartTagIdx
;
2594 const lang::Locale
aLocale( LanguageTag::convertToLocale( eLastDialogLanguage
) );
2595 if ( xRec
->hasPropertyPage( nSmartTagIdx
, aLocale
) )
2596 xRec
->displayPropertyPage( nSmartTagIdx
, aLocale
);
2601 /** Handler for the check box
2603 IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage
, CheckHdl
)
2605 const bool bEnable
= m_pMainCB
->IsChecked();
2606 m_pSmartTagTypesLB
->Enable( bEnable
);
2607 m_pSmartTagTypesLB
->Invalidate();
2608 m_pPropertiesPB
->Enable( false );
2610 // if the controls are currently enabled, we still have to check
2611 // if the properties button should be disabled because the currently
2612 // seleted smart tag type does not have a properties dialog.
2613 // We do this by calling SelectHdl:
2615 SelectHdl(m_pSmartTagTypesLB
);
2620 /** Handler for the list box
2622 IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage
, SelectHdl
)
2624 if ( m_pSmartTagTypesLB
->GetEntryCount() < 1 )
2627 const sal_uLong nPos
= m_pSmartTagTypesLB
->GetSelectEntryPos();
2628 const SvTreeListEntry
* pEntry
= m_pSmartTagTypesLB
->GetEntry(nPos
);
2629 const ImplSmartTagLBUserData
* pUserData
= static_cast< ImplSmartTagLBUserData
* >(pEntry
->GetUserData());
2630 uno::Reference
< smarttags::XSmartTagRecognizer
> xRec
= pUserData
->mxRec
;
2631 const sal_Int32 nSmartTagIdx
= pUserData
->mnSmartTagIdx
;
2633 const lang::Locale
aLocale( LanguageTag::convertToLocale( eLastDialogLanguage
) );
2634 if ( xRec
->hasPropertyPage( nSmartTagIdx
, aLocale
) )
2635 m_pPropertiesPB
->Enable( true );
2637 m_pPropertiesPB
->Enable( false );
2642 /** Propagates the current settings to the smart tag manager.
2644 bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet
* )
2646 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
2647 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
2648 SmartTagMgr
* pSmartTagMgr
= pOpt
->pSmartTagMgr
;
2651 if ( !pSmartTagMgr
)
2654 bool bModifiedSmartTagTypes
= false;
2655 std::vector
< OUString
> aDisabledSmartTagTypes
;
2657 const sal_uLong nCount
= m_pSmartTagTypesLB
->GetEntryCount();
2659 for ( sal_uLong i
= 0; i
< nCount
; ++i
)
2661 const SvTreeListEntry
* pEntry
= m_pSmartTagTypesLB
->GetEntry(i
);
2662 const ImplSmartTagLBUserData
* pUserData
= static_cast< ImplSmartTagLBUserData
* >(pEntry
->GetUserData());
2663 const bool bChecked
= m_pSmartTagTypesLB
->IsChecked(i
);
2664 const bool bIsCurrentlyEnabled
= pSmartTagMgr
->IsSmartTagTypeEnabled( pUserData
->maSmartTagType
);
2666 bModifiedSmartTagTypes
= bModifiedSmartTagTypes
|| ( !bChecked
!= !bIsCurrentlyEnabled
);
2669 aDisabledSmartTagTypes
.push_back( pUserData
->maSmartTagType
);
2674 const bool bModifiedRecognize
= ( !m_pMainCB
->IsChecked() != !pSmartTagMgr
->IsLabelTextWithSmartTags() );
2675 if ( bModifiedSmartTagTypes
|| bModifiedRecognize
)
2677 bool bLabelTextWithSmartTags
= m_pMainCB
->IsChecked();
2678 pSmartTagMgr
->WriteConfiguration( bModifiedRecognize
? &bLabelTextWithSmartTags
: 0,
2679 bModifiedSmartTagTypes
? &aDisabledSmartTagTypes
: 0 );
2685 /** Sets the controls based on the current settings at SmartTagMgr.
2687 void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet
* )
2689 SvxAutoCorrect
* pAutoCorrect
= SvxAutoCorrCfg::Get().GetAutoCorrect();
2690 SvxSwAutoFormatFlags
*pOpt
= &pAutoCorrect
->GetSwFlags();
2691 const SmartTagMgr
* pSmartTagMgr
= pOpt
->pSmartTagMgr
;
2693 // robust, should not happen!
2694 if ( !pSmartTagMgr
)
2697 FillListBox( *pSmartTagMgr
);
2698 m_pSmartTagTypesLB
->SelectEntryPos( 0 );
2699 m_pMainCB
->Check( pSmartTagMgr
->IsLabelTextWithSmartTags() );
2700 CheckHdl(m_pMainCB
);
2703 void OfaSmartTagOptionsTabPage::ActivatePage( const SfxItemSet
& )
2705 static_cast<OfaAutoCorrDlg
*>(GetTabDialog())->EnableLanguage( false );
2708 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */