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 : #define _SVX_SRCHDLG_CXX // so that private methods from SrchDlgare known
26 :
27 : #include "srchctrl.hxx"
28 : #include "svx/srchdlg.hxx"
29 : #include <svl/srchitem.hxx>
30 :
31 : // class SvxSearchFamilyControllerItem -----------------------------------
32 :
33 0 : SvxSearchController::SvxSearchController
34 : (
35 : sal_uInt16 _nId,
36 : SfxBindings& rBind,
37 : SvxSearchDialog& rDlg
38 : ) :
39 : SfxControllerItem( _nId, rBind ),
40 :
41 0 : rSrchDlg( rDlg )
42 : {
43 0 : }
44 :
45 : // -----------------------------------------------------------------------
46 :
47 0 : void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
48 : const SfxPoolItem* pState )
49 : {
50 0 : if ( SFX_ITEM_AVAILABLE == eState )
51 : {
52 0 : if ( SID_STYLE_FAMILY1 <= nSID && nSID <= SID_STYLE_FAMILY4 )
53 : {
54 0 : SfxObjectShell* pShell = SfxObjectShell::Current();
55 :
56 0 : if ( pShell && pShell->GetStyleSheetPool() )
57 0 : rSrchDlg.TemplatesChanged_Impl( *pShell->GetStyleSheetPool() );
58 : }
59 0 : else if ( SID_SEARCH_OPTIONS == nSID )
60 : {
61 : DBG_ASSERT( pState->ISA(SfxUInt16Item), "wrong item type" );
62 0 : sal_uInt16 nFlags = (sal_uInt16)( (SfxUInt16Item*)pState )->GetValue();
63 0 : rSrchDlg.EnableControls_Impl( nFlags );
64 : }
65 0 : else if ( SID_SEARCH_ITEM == nSID )
66 : {
67 : DBG_ASSERT( pState->ISA(SvxSearchItem), "wrong item type" );
68 0 : rSrchDlg.SetItem_Impl( (const SvxSearchItem*)pState );
69 : }
70 : }
71 0 : else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
72 0 : rSrchDlg.EnableControls_Impl( 0 );
73 0 : }
74 :
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|