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 :
21 : #include "DrawDocShell.hxx"
22 :
23 : #include "app.hrc"
24 :
25 : #include <svx/svxids.hrc>
26 : #include <svx/dialogs.hrc>
27 :
28 : #include <svx/ofaitem.hxx>
29 : #include <svx/svxerr.hxx>
30 : #include <svx/dialmgr.hxx>
31 : #include <svl/srchitem.hxx>
32 : #include <svx/srchdlg.hxx>
33 : #ifdef _OUTLINER_HXX
34 : #include <editeng/outliner.hxx>
35 : #endif
36 : #include <sfx2/request.hxx>
37 : #include <svl/style.hxx>
38 : #include <svx/drawitem.hxx>
39 : #include <editeng/unolingu.hxx>
40 : #include <com/sun/star/i18n/TextConversionOption.hpp>
41 :
42 :
43 : #include "strings.hrc"
44 : #include "glob.hrc"
45 : #include "res_bmp.hrc"
46 :
47 : #include "app.hxx"
48 : #include "drawdoc.hxx"
49 : #include "sdpage.hxx"
50 : #include "sdattr.hxx"
51 : #include "fusearch.hxx"
52 : #include "ViewShell.hxx"
53 : #include "View.hxx"
54 : #include "slideshow.hxx"
55 : #include "fuhhconv.hxx"
56 :
57 : using namespace ::com::sun::star;
58 : using namespace ::com::sun::star::beans;
59 : using namespace ::com::sun::star::uno;
60 :
61 : namespace sd {
62 :
63 : /*************************************************************************
64 : |*
65 : |* SFX-Requests bearbeiten
66 : |*
67 : \************************************************************************/
68 :
69 0 : void DrawDocShell::Execute( SfxRequest& rReq )
70 : {
71 0 : if(mpViewShell && SlideShow::IsRunning( mpViewShell->GetViewShellBase() ))
72 : {
73 : // during a running presentation no slot will be executed
74 0 : return;
75 : }
76 :
77 0 : switch ( rReq.GetSlot() )
78 : {
79 : case SID_SEARCH_ITEM:
80 : {
81 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
82 :
83 0 : if (pReqArgs)
84 : {
85 : const SvxSearchItem* pSearchItem =
86 0 : (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
87 :
88 : // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
89 0 : SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
90 0 : delete pAppSearchItem;
91 0 : pAppSearchItem = (SvxSearchItem*) pSearchItem->Clone();
92 0 : SD_MOD()->SetSearchItem(pAppSearchItem);
93 : }
94 :
95 0 : rReq.Done();
96 : }
97 0 : break;
98 :
99 : case FID_SEARCH_ON:
100 : {
101 : // Keine Aktion noetig
102 0 : rReq.Done();
103 : }
104 0 : break;
105 :
106 : case FID_SEARCH_OFF:
107 : {
108 0 : if( dynamic_cast< FuSearch* >(mxDocShellFunction.get()) )
109 : {
110 : // End Search&Replace in all docshells
111 0 : SfxObjectShell* pFirstShell = SfxObjectShell::GetFirst();
112 0 : SfxObjectShell* pShell = pFirstShell;
113 :
114 0 : while (pShell)
115 : {
116 0 : if (pShell->ISA(DrawDocShell))
117 : {
118 0 : ( (DrawDocShell*) pShell)->CancelSearching();
119 : }
120 :
121 0 : pShell = SfxObjectShell::GetNext(*pShell);
122 :
123 0 : if (pShell == pFirstShell)
124 : {
125 0 : pShell = NULL;
126 : }
127 : }
128 :
129 0 : SetDocShellFunction(0);
130 0 : Invalidate();
131 0 : rReq.Done();
132 : }
133 : }
134 0 : break;
135 :
136 : case FID_SEARCH_NOW:
137 : {
138 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
139 :
140 0 : if ( pReqArgs )
141 : {
142 0 : rtl::Reference< FuSearch > xFuSearch( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
143 :
144 0 : if( !xFuSearch.is() && mpViewShell )
145 : {
146 0 : ::sd::View* pView = mpViewShell->GetView();
147 0 : SetDocShellFunction( FuSearch::Create( mpViewShell, mpViewShell->GetActiveWindow(), pView, mpDoc, rReq ) );
148 0 : xFuSearch.set( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
149 : }
150 :
151 0 : if( xFuSearch.is() )
152 : {
153 : const SvxSearchItem* pSearchItem =
154 0 : (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
155 :
156 : // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
157 0 : SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
158 0 : delete pAppSearchItem;
159 0 : pAppSearchItem = (SvxSearchItem*)pSearchItem->Clone();
160 0 : SD_MOD()->SetSearchItem(pAppSearchItem);
161 0 : xFuSearch->SearchAndReplace(pSearchItem);
162 0 : }
163 : }
164 :
165 0 : rReq.Done();
166 : }
167 0 : break;
168 :
169 : case SID_CLOSEDOC:
170 : {
171 0 : ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface());
172 : }
173 0 : break;
174 :
175 : case SID_GET_COLORLIST:
176 : {
177 0 : SvxColorListItem* pColItem = (SvxColorListItem*) GetItem( SID_COLOR_TABLE );
178 0 : XColorListRef pList = pColItem->GetColorList();
179 0 : rReq.SetReturnValue( OfaRefItem<XColorList>( SID_GET_COLORLIST, pList ) );
180 : }
181 0 : break;
182 :
183 : case SID_VERSION:
184 : {
185 0 : const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode();
186 :
187 0 : mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
188 0 : ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() );
189 0 : mpDoc->SetSwapGraphicsMode( nOldSwapMode );
190 : }
191 0 : break;
192 :
193 : case SID_HANGUL_HANJA_CONVERSION:
194 : {
195 0 : if( mpViewShell )
196 : {
197 0 : FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
198 0 : static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True );
199 : }
200 : }
201 0 : break;
202 :
203 : case SID_CHINESE_CONVERSION:
204 : {
205 0 : if( mpViewShell )
206 : {
207 0 : FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
208 0 : static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartChineseConversion();
209 : }
210 : }
211 0 : break;
212 :
213 : default:
214 0 : break;
215 : }
216 : }
217 :
218 : /*************************************************************************
219 : |*
220 : |* Suchmaske fuer Organizer
221 : |*
222 : \************************************************************************/
223 :
224 0 : void DrawDocShell::SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const
225 : {
226 0 : pBasePool->SetSearchMask(SD_STYLE_FAMILY_GRAPHICS, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED);
227 0 : }
228 :
229 :
230 16 : void DrawDocShell::SetDocShellFunction( const ::sd::FunctionReference& xFunction )
231 : {
232 16 : if( mxDocShellFunction.is() )
233 0 : mxDocShellFunction->Dispose();
234 :
235 16 : mxDocShellFunction = xFunction;
236 16 : }
237 :
238 : } // end of namespace sd
239 :
240 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|