Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <svl/intitem.hxx>
21 : #include <sfx2/objsh.hxx>
22 :
23 : #include <svx/svxids.hrc>
24 :
25 : #include "srchctrl.hxx"
26 : #include "svx/srchdlg.hxx"
27 : #include <svl/srchitem.hxx>
28 :
29 : // class SvxSearchFamilyControllerItem -----------------------------------
30 :
31 0 : SvxSearchController::SvxSearchController
32 : (
33 : sal_uInt16 _nId,
34 : SfxBindings& rBind,
35 : SvxSearchDialog& rDlg
36 : ) :
37 : SfxControllerItem( _nId, rBind ),
38 :
39 0 : rSrchDlg( rDlg )
40 : {
41 0 : }
42 :
43 :
44 :
45 0 : void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
46 : const SfxPoolItem* pState )
47 : {
48 0 : if ( SFX_ITEM_AVAILABLE == eState )
49 : {
50 0 : if ( SID_STYLE_FAMILY1 <= nSID && nSID <= SID_STYLE_FAMILY4 )
51 : {
52 0 : SfxObjectShell* pShell = SfxObjectShell::Current();
53 :
54 0 : if ( pShell && pShell->GetStyleSheetPool() )
55 0 : rSrchDlg.TemplatesChanged_Impl( *pShell->GetStyleSheetPool() );
56 : }
57 0 : else if ( SID_SEARCH_OPTIONS == nSID )
58 : {
59 : DBG_ASSERT( pState->ISA(SfxUInt16Item), "wrong item type" );
60 0 : sal_uInt16 nFlags = (sal_uInt16)( (SfxUInt16Item*)pState )->GetValue();
61 0 : rSrchDlg.EnableControls_Impl( nFlags );
62 : }
63 0 : else if ( SID_SEARCH_ITEM == nSID )
64 : {
65 : DBG_ASSERT( pState->ISA(SvxSearchItem), "wrong item type" );
66 0 : rSrchDlg.SetItem_Impl( (const SvxSearchItem*)pState );
67 : }
68 : }
69 0 : else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
70 0 : rSrchDlg.EnableControls_Impl( 0 );
71 0 : }
72 :
73 :
74 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|