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 <svl/intitem.hxx>
21 #include <sfx2/objsh.hxx>
23 #include <svx/svxids.hrc>
25 #include "srchctrl.hxx"
26 #include "svx/srchdlg.hxx"
27 #include <svl/srchitem.hxx>
29 // class SvxSearchFamilyControllerItem -----------------------------------
31 SvxSearchController::SvxSearchController
37 SfxControllerItem( _nId
, rBind
),
43 // -----------------------------------------------------------------------
45 void SvxSearchController::StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
46 const SfxPoolItem
* pState
)
48 if ( SFX_ITEM_AVAILABLE
== eState
)
50 if ( SID_STYLE_FAMILY1
<= nSID
&& nSID
<= SID_STYLE_FAMILY4
)
52 SfxObjectShell
* pShell
= SfxObjectShell::Current();
54 if ( pShell
&& pShell
->GetStyleSheetPool() )
55 rSrchDlg
.TemplatesChanged_Impl( *pShell
->GetStyleSheetPool() );
57 else if ( SID_SEARCH_OPTIONS
== nSID
)
59 DBG_ASSERT( pState
->ISA(SfxUInt16Item
), "wrong item type" );
60 sal_uInt16 nFlags
= (sal_uInt16
)( (SfxUInt16Item
*)pState
)->GetValue();
61 rSrchDlg
.EnableControls_Impl( nFlags
);
63 else if ( SID_SEARCH_ITEM
== nSID
)
65 DBG_ASSERT( pState
->ISA(SvxSearchItem
), "wrong item type" );
66 rSrchDlg
.SetItem_Impl( (const SvxSearchItem
*)pState
);
69 else if ( SID_SEARCH_OPTIONS
== nSID
|| SID_SEARCH_ITEM
== nSID
)
70 rSrchDlg
.EnableControls_Impl( 0 );
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */