From f50b87327aba6d6186702c8c9b927ce6412182a6 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 23 Feb 2001 12:12:55 +0000 Subject: [PATCH] class SvxJSearchOptionsDialog added --- svx/inc/srchdlg.hxx | 42 +++++++++++++++++++- svx/source/dialog/srchdlg.cxx | 75 ++++++++++++++++++++++++++++++----- 2 files changed, 106 insertions(+), 11 deletions(-) diff --git a/svx/inc/srchdlg.hxx b/svx/inc/srchdlg.hxx index ecf7d4ad5948..17cbf15b571d 100644 --- a/svx/inc/srchdlg.hxx +++ b/svx/inc/srchdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: srchdlg.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: tl $ $Date: 2001-02-21 13:23:36 $ + * last change: $Author: tl $ $Date: 2001-02-23 13:08:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,6 +91,9 @@ #ifndef _SFX_CHILDWIN_HXX //autogen #include #endif +#ifndef _BASEDLGS_HXX +#include +#endif #ifndef _SVARRAY_HXX //autogen #include #endif @@ -111,6 +114,8 @@ class SvxSearchItem; class MoreButton; class SfxStyleSheetBasePool; +class SvxJSearchOptionsPage; + struct SearchDlg_Impl; #ifndef NO_SVX_SEARCH @@ -181,6 +186,7 @@ class SvxSearchDialog : public ModelessDialog { friend class SvxSearchController; friend class SvxSearchDialogWrapper; + friend class SvxJSearchOptionsDialog; public: SvxSearchDialog( Window* pParent, SfxBindings& rBind ); @@ -188,6 +194,9 @@ public: virtual BOOL Close(); + // Window + virtual void Activate(); + void GetSearchItems( SfxItemSet& rSet ); void GetReplaceItems( SfxItemSet& rSet ); @@ -329,6 +338,35 @@ inline BOOL SvxSearchDialog::HasReplaceAttributes() const return ( aReplaceAttrText.IsEnabled() && bLen ); } + +////////////////////////////////////////////////////////////////////// + + +class SvxJSearchOptionsDialog : public SfxSingleTabDialog +{ + SvxSearchDialog &rDialog; + SvxJSearchOptionsPage *pPage; + + // disallow copy-constructor and assignment-operator for now + SvxJSearchOptionsDialog( const SvxJSearchOptionsDialog & ); + SvxJSearchOptionsDialog & operator == ( const SvxJSearchOptionsDialog & ); + +public: + SvxJSearchOptionsDialog( SvxSearchDialog &rParent, + const SfxItemSet& rOptionsSet, USHORT nUniqueId ); + virtual ~SvxJSearchOptionsDialog(); + + // Window + virtual void Activate(); + + INT32 GetTransliterationFlags() const; + void SetTransliterationFlags( INT32 nSettings ); +}; + + +////////////////////////////////////////////////////////////////////// + + #endif // SV_NODIALOG #endif // NO_SVX_SEARCH diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index b3ffbec480cf..cb6b706c3b4c 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: srchdlg.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: tl $ $Date: 2001-02-21 13:27:46 $ + * last change: $Author: tl $ $Date: 2001-02-23 13:12:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -310,6 +310,52 @@ void SearchAttrItemList::Remove( USHORT nPos, USHORT nLen ) SrchAttrItemList::Remove( nPos, nLen ); } + +// class SvxJSearchOptionsDialog ----------------------------------------- + + +SvxJSearchOptionsDialog::SvxJSearchOptionsDialog( + SvxSearchDialog &rParent, + const SfxItemSet& rOptionsSet, USHORT nUniqueId ) : + SfxSingleTabDialog ( &rParent, rOptionsSet, RID_SVXPAGE_JSEARCH_OPTIONS ), + rDialog ( rParent ) +{ + pPage = (SvxJSearchOptionsPage *) + SvxJSearchOptionsPage::Create( this, rOptionsSet ); + SetTabPage( pPage ); //! implicitly calls pPage->Reset(...)! + pPage->EnableSaveOptions( FALSE ); +} + + +SvxJSearchOptionsDialog::~SvxJSearchOptionsDialog() +{ + // pPage will be implicitly destroyed by the + // SfxSingleTabDialog destructor +} + + +void SvxJSearchOptionsDialog::Activate() +{ + // apply changes of transliteration in configuration + SvxSearchItem *pItem = rDialog.pSearchItem; + DBG_ASSERT( pItem, "SearchItem missing" ); + if (pItem) + pPage->SetTransliterationFlags( pItem->GetTransliterationFlags() ); +} + + +INT32 SvxJSearchOptionsDialog::GetTransliterationFlags() const +{ + return pPage->GetTransliterationFlags(); +} + + +void SvxJSearchOptionsDialog::SetTransliterationFlags( INT32 nSettings ) +{ + pPage->SetTransliterationFlags( nSettings ); +} + + // class SvxSearchDialog ------------------------------------------------- SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxBindings& rBind ) : @@ -537,6 +583,19 @@ void SvxSearchDialog::ApplyTransliterationFlags_Impl( INT32 nSettings ) // ----------------------------------------------------------------------- +void SvxSearchDialog::Activate() +{ + // apply possible transliteration changes of the SvxSearchItem member + DBG_ASSERT( pSearchItem, "SearchItem missing" ); + if (pSearchItem) + { + aMatchCaseCB .Check( pSearchItem->GetExact() ); + aJapMatchFullHalfWidthCB.Check( pSearchItem->IsMatchFullHalfWidthForms() ); + } +} + +// ----------------------------------------------------------------------- + void SvxSearchDialog::InitControls_Impl() { // CaseSensitives AutoComplete @@ -1195,14 +1254,12 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn ) else if ( pBtn == &aJapOptionsBtn ) { SfxItemSet aSet( SFX_APP()->GetPool() ); - SfxSingleTabDialog aDlg( SfxSingleTabDialog( this, aSet, RID_SVXPAGE_JSEARCH_OPTIONS ) ); - SvxJSearchOptionsPage *pPage = (SvxJSearchOptionsPage *) - SvxJSearchOptionsPage::Create( &aDlg, aSet ); - aDlg.SetTabPage( pPage ); //! implicitly calls pPage->Reset(...)! - pPage->EnableSaveOptions( FALSE ); - pPage->SetTransliterationFlags( GetTransliterationFlags() ); + SvxJSearchOptionsDialog aDlg( *this, aSet, RID_SVXPAGE_JSEARCH_OPTIONS ); + pSearchItem->SetTransliterationFlags( GetTransliterationFlags() ); aDlg.Execute(); - ApplyTransliterationFlags_Impl( pPage->GetTransliterationFlags() ); + INT32 nFlags = aDlg.GetTransliterationFlags(); + pSearchItem->SetTransliterationFlags( nFlags ); + ApplyTransliterationFlags_Impl( nFlags ); } return 0;