xref: /trunk/main/svx/source/dialog/srchctrl.cxx (revision f6e50924)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 // include ---------------------------------------------------------------
28 #include <tools/pstm.hxx>
29 #include <svl/intitem.hxx>
30 #include <sfx2/objsh.hxx>
31 
32 #include <svx/svxids.hrc>
33 
34 #define _SVX_SRCHDLG_CXX // damit private-Methoden vom SrchDlg bekannt sind
35 
36 
37 
38 #include "srchctrl.hxx"
39 #include "svx/srchdlg.hxx"
40 #include <svl/srchitem.hxx>
41 
42 // class SvxSearchFamilyControllerItem -----------------------------------
43 
SvxSearchController(sal_uInt16 _nId,SfxBindings & rBind,SvxSearchDialog & rDlg)44 SvxSearchController::SvxSearchController
45 (
46     sal_uInt16 _nId,
47 	SfxBindings& rBind,
48 	SvxSearchDialog& rDlg
49 ) :
50     SfxControllerItem( _nId, rBind ),
51 
52 	rSrchDlg( rDlg )
53 {
54 }
55 
56 // -----------------------------------------------------------------------
57 
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)58 void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
59 										const SfxPoolItem* pState )
60 {
61 	if ( SFX_ITEM_AVAILABLE == eState )
62 	{
63 		if ( SID_STYLE_FAMILY1 <= nSID && nSID <= SID_STYLE_FAMILY4 )
64 		{
65 			SfxObjectShell* pShell = SfxObjectShell::Current();
66 
67 			if ( pShell && pShell->GetStyleSheetPool() )
68 				rSrchDlg.TemplatesChanged_Impl( *pShell->GetStyleSheetPool() );
69 		}
70 		else if ( SID_SEARCH_OPTIONS == nSID )
71 		{
72 			DBG_ASSERT( pState->ISA(SfxUInt16Item), "wrong item type" );
73 			sal_uInt16 nFlags = (sal_uInt16)( (SfxUInt16Item*)pState )->GetValue();
74 			rSrchDlg.EnableControls_Impl( nFlags );
75 		}
76 		else if ( SID_SEARCH_ITEM == nSID )
77 		{
78 			DBG_ASSERT( pState->ISA(SvxSearchItem), "wrong item type" );
79 			rSrchDlg.SetItem_Impl( (const SvxSearchItem*)pState );
80 		}
81 	}
82 	else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
83 		rSrchDlg.EnableControls_Impl( 0 );
84 }
85 
86 
87