Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / dialog / srchctrl.cxx
blob51c8d03337843547704340451913f70744850c80
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 SvxSearchController::SvxSearchController
31 sal_uInt16 _nId,
32 SfxBindings& rBind,
33 SvxSearchDialog& rDlg
34 ) :
35 SfxControllerItem( _nId, rBind ),
37 rSrchDlg( rDlg )
42 void SvxSearchController::StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
43 const SfxPoolItem* pState )
45 if ( SfxItemState::DEFAULT == eState )
47 if ( SID_STYLE_FAMILY1 <= nSID && nSID <= SID_STYLE_FAMILY4 )
49 SfxObjectShell* pShell = SfxObjectShell::Current();
51 if ( pShell && pShell->GetStyleSheetPool() )
52 rSrchDlg.TemplatesChanged_Impl( *pShell->GetStyleSheetPool() );
54 else if ( SID_SEARCH_OPTIONS == nSID )
56 DBG_ASSERT( dynamic_cast<const SfxUInt16Item* >(pState) != nullptr, "wrong item type" );
57 SearchOptionFlags nFlags = static_cast<SearchOptionFlags>(static_cast<const SfxUInt16Item*>(pState)->GetValue());
58 rSrchDlg.EnableControls_Impl( nFlags );
60 else if ( SID_SEARCH_ITEM == nSID )
62 DBG_ASSERT( dynamic_cast<const SvxSearchItem*>( pState) != nullptr, "wrong item type" );
63 rSrchDlg.SetItem_Impl( static_cast<const SvxSearchItem*>(pState) );
66 else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
67 rSrchDlg.EnableControls_Impl( SearchOptionFlags::NONE );
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */