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