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 0 : SvxSearchController::SvxSearchController
30 : (
31 : sal_uInt16 _nId,
32 : SfxBindings& rBind,
33 : SvxSearchDialog& rDlg
34 : ) :
35 : SfxControllerItem( _nId, rBind ),
36 :
37 0 : rSrchDlg( rDlg )
38 : {
39 0 : }
40 :
41 :
42 :
43 0 : void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
44 : const SfxPoolItem* pState )
45 : {
46 0 : if ( SfxItemState::DEFAULT == eState )
47 : {
48 0 : if ( SID_STYLE_FAMILY1 <= nSID && nSID <= SID_STYLE_FAMILY4 )
49 : {
50 0 : SfxObjectShell* pShell = SfxObjectShell::Current();
51 :
52 0 : if ( pShell && pShell->GetStyleSheetPool() )
53 0 : rSrchDlg.TemplatesChanged_Impl( *pShell->GetStyleSheetPool() );
54 : }
55 0 : else if ( SID_SEARCH_OPTIONS == nSID )
56 : {
57 : DBG_ASSERT( pState->ISA(SfxUInt16Item), "wrong item type" );
58 0 : SearchOptionFlags nFlags = (SearchOptionFlags) static_cast<const SfxUInt16Item*>(pState)->GetValue();
59 0 : rSrchDlg.EnableControls_Impl( nFlags );
60 : }
61 0 : else if ( SID_SEARCH_ITEM == nSID )
62 : {
63 : DBG_ASSERT( pState->ISA(SvxSearchItem), "wrong item type" );
64 0 : rSrchDlg.SetItem_Impl( static_cast<const SvxSearchItem*>(pState) );
65 : }
66 : }
67 0 : else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
68 0 : rSrchDlg.EnableControls_Impl( SearchOptionFlags::NONE );
69 390 : }
70 :
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|