Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "DrawDocShell.hxx"
31 : :
32 : : #include "app.hrc"
33 : :
34 : : #include <svx/svxids.hrc>
35 : : #include <svx/dialogs.hrc>
36 : :
37 : : #include <svx/ofaitem.hxx>
38 : : #include <svx/svxerr.hxx>
39 : : #include <svx/dialmgr.hxx>
40 : : #include <svl/srchitem.hxx>
41 : : #include <svx/srchdlg.hxx>
42 : : #ifdef _OUTLINER_HXX
43 : : #include <editeng/outliner.hxx>
44 : : #endif
45 : : #include <sfx2/request.hxx>
46 : : #include <svl/style.hxx>
47 : : #include <svx/drawitem.hxx>
48 : : #include <editeng/unolingu.hxx>
49 : : #include <com/sun/star/i18n/TextConversionOption.hpp>
50 : :
51 : :
52 : : #include "strings.hrc"
53 : : #include "glob.hrc"
54 : : #include "res_bmp.hrc"
55 : :
56 : : #include "app.hxx"
57 : : #include "drawdoc.hxx"
58 : : #include "sdpage.hxx"
59 : : #include "sdattr.hxx"
60 : : #include "fusearch.hxx"
61 : : #include "ViewShell.hxx"
62 : : #include "View.hxx"
63 : : #include "slideshow.hxx"
64 : : #include "fuhhconv.hxx"
65 : :
66 : : using namespace ::com::sun::star;
67 : : using namespace ::com::sun::star::beans;
68 : : using namespace ::com::sun::star::uno;
69 : :
70 : : namespace sd {
71 : :
72 : : /*************************************************************************
73 : : |*
74 : : |* SFX-Requests bearbeiten
75 : : |*
76 : : \************************************************************************/
77 : :
78 : 0 : void DrawDocShell::Execute( SfxRequest& rReq )
79 : : {
80 [ # # ][ # # ]: 0 : if(mpViewShell && SlideShow::IsRunning( mpViewShell->GetViewShellBase() ))
[ # # ]
81 : : {
82 : : // during a running presentation no slot will be executed
83 : 0 : return;
84 : : }
85 : :
86 [ # # # # : 0 : switch ( rReq.GetSlot() )
# # # # #
# ]
87 : : {
88 : : case SID_SEARCH_ITEM:
89 : : {
90 : 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
91 : :
92 [ # # ]: 0 : if (pReqArgs)
93 : : {
94 : : const SvxSearchItem* pSearchItem =
95 : 0 : (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
96 : :
97 : : // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
98 : 0 : SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
99 [ # # ]: 0 : delete pAppSearchItem;
100 : 0 : pAppSearchItem = (SvxSearchItem*) pSearchItem->Clone();
101 : 0 : SD_MOD()->SetSearchItem(pAppSearchItem);
102 : : }
103 : :
104 : 0 : rReq.Done();
105 : : }
106 : 0 : break;
107 : :
108 : : case FID_SEARCH_ON:
109 : : {
110 : : // Keine Aktion noetig
111 : 0 : rReq.Done();
112 : : }
113 : 0 : break;
114 : :
115 : : case FID_SEARCH_OFF:
116 : : {
117 [ # # ][ # # ]: 0 : if( dynamic_cast< FuSearch* >(mxDocShellFunction.get()) )
[ # # ]
118 : : {
119 : : // End Search&Replace in all docshells
120 : 0 : SfxObjectShell* pFirstShell = SfxObjectShell::GetFirst();
121 : 0 : SfxObjectShell* pShell = pFirstShell;
122 : :
123 [ # # ]: 0 : while (pShell)
124 : : {
125 [ # # ]: 0 : if (pShell->ISA(DrawDocShell))
126 : : {
127 : 0 : ( (DrawDocShell*) pShell)->CancelSearching();
128 : : }
129 : :
130 : 0 : pShell = SfxObjectShell::GetNext(*pShell);
131 : :
132 [ # # ]: 0 : if (pShell == pFirstShell)
133 : : {
134 : 0 : pShell = NULL;
135 : : }
136 : : }
137 : :
138 [ # # ]: 0 : SetDocShellFunction(0);
139 : 0 : Invalidate();
140 : 0 : rReq.Done();
141 : : }
142 : : }
143 : 0 : break;
144 : :
145 : : case FID_SEARCH_NOW:
146 : : {
147 : 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
148 : :
149 [ # # ]: 0 : if ( pReqArgs )
150 : : {
151 [ # # ][ # # ]: 0 : rtl::Reference< FuSearch > xFuSearch( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
[ # # ][ # # ]
152 : :
153 [ # # ][ # # ]: 0 : if( !xFuSearch.is() && mpViewShell )
[ # # ]
154 : : {
155 : 0 : ::sd::View* pView = mpViewShell->GetView();
156 [ # # ][ # # ]: 0 : SetDocShellFunction( FuSearch::Create( mpViewShell, mpViewShell->GetActiveWindow(), pView, mpDoc, rReq ) );
[ # # ][ # # ]
157 [ # # ][ # # ]: 0 : xFuSearch.set( dynamic_cast< FuSearch* >( GetDocShellFunction().get() ) );
[ # # ][ # # ]
158 : : }
159 : :
160 [ # # ]: 0 : if( xFuSearch.is() )
161 : : {
162 : : const SvxSearchItem* pSearchItem =
163 [ # # ]: 0 : (const SvxSearchItem*) &pReqArgs->Get(SID_SEARCH_ITEM);
164 : :
165 : : // ein Zuweisungsoperator am SearchItem waer nicht schlecht...
166 [ # # ]: 0 : SvxSearchItem* pAppSearchItem = SD_MOD()->GetSearchItem();
167 [ # # ][ # # ]: 0 : delete pAppSearchItem;
168 [ # # ]: 0 : pAppSearchItem = (SvxSearchItem*)pSearchItem->Clone();
169 [ # # ]: 0 : SD_MOD()->SetSearchItem(pAppSearchItem);
170 [ # # ]: 0 : xFuSearch->SearchAndReplace(pSearchItem);
171 [ # # ]: 0 : }
172 : : }
173 : :
174 : 0 : rReq.Done();
175 : : }
176 : 0 : break;
177 : :
178 : : case SID_CLOSEDOC:
179 : : {
180 : 0 : ExecuteSlot(rReq, SfxObjectShell::GetStaticInterface());
181 : : }
182 : 0 : break;
183 : :
184 : : case SID_GET_COLORLIST:
185 : : {
186 [ # # ]: 0 : SvxColorListItem* pColItem = (SvxColorListItem*) GetItem( SID_COLOR_TABLE );
187 [ # # ]: 0 : XColorListRef pList = pColItem->GetColorList();
188 [ # # ][ # # ]: 0 : rReq.SetReturnValue( OfaRefItem<XColorList>( SID_GET_COLORLIST, pList ) );
[ # # ]
189 : : }
190 : 0 : break;
191 : :
192 : : case SID_VERSION:
193 : : {
194 : 0 : const sal_uLong nOldSwapMode = mpDoc->GetSwapGraphicsMode();
195 : :
196 : 0 : mpDoc->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP );
197 : 0 : ExecuteSlot( rReq, SfxObjectShell::GetStaticInterface() );
198 : 0 : mpDoc->SetSwapGraphicsMode( nOldSwapMode );
199 : : }
200 : 0 : break;
201 : :
202 : : case SID_HANGUL_HANJA_CONVERSION:
203 : : {
204 [ # # ]: 0 : if( mpViewShell )
205 : : {
206 [ # # ][ # # ]: 0 : FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
207 [ # # ][ # # ]: 0 : static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL, i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True );
208 : : }
209 : : }
210 : 0 : break;
211 : :
212 : : case SID_CHINESE_CONVERSION:
213 : : {
214 [ # # ]: 0 : if( mpViewShell )
215 : : {
216 [ # # ][ # # ]: 0 : FunctionReference aFunc( FuHangulHanjaConversion::Create( mpViewShell, mpViewShell->GetActiveWindow(), mpViewShell->GetView(), mpDoc, rReq ) );
217 [ # # ][ # # ]: 0 : static_cast< FuHangulHanjaConversion* >( aFunc.get() )->StartChineseConversion();
218 : : }
219 : : }
220 : 0 : break;
221 : :
222 : : default:
223 : 0 : break;
224 : : }
225 : : }
226 : :
227 : : /*************************************************************************
228 : : |*
229 : : |* Suchmaske fuer Organizer
230 : : |*
231 : : \************************************************************************/
232 : :
233 : 0 : void DrawDocShell::SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const
234 : : {
235 : 0 : pBasePool->SetSearchMask(SD_STYLE_FAMILY_GRAPHICS, SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED);
236 : 0 : }
237 : :
238 : :
239 : 299 : void DrawDocShell::SetDocShellFunction( const ::sd::FunctionReference& xFunction )
240 : : {
241 [ - + ]: 299 : if( mxDocShellFunction.is() )
242 : 0 : mxDocShellFunction->Dispose();
243 : :
244 : 299 : mxDocShellFunction = xFunction;
245 : 299 : }
246 : :
247 : : } // end of namespace sd
248 : :
249 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|