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 "OutlineViewShell.hxx"
31 : :
32 : : #include "ViewShellImplementation.hxx"
33 : : #include <memory>
34 : : #include "helpids.h"
35 : : #include "app.hrc"
36 : : #include <svx/hyperdlg.hxx>
37 : : #include <svx/zoomslideritem.hxx>
38 : :
39 : : #include <sfx2/objface.hxx>
40 : : #include <sot/exchange.hxx>
41 : : #include <svx/ruler.hxx>
42 : : #include <sfx2/zoomitem.hxx>
43 : : #include <editeng/eeitem.hxx>
44 : : #include <editeng/flditem.hxx>
45 : : #include <sfx2/shell.hxx>
46 : : #include <sfx2/templdlg.hxx>
47 : : #include <sfx2/viewfac.hxx>
48 : : #include <sfx2/request.hxx>
49 : : #include <svx/hlnkitem.hxx>
50 : : #include <svx/svdotext.hxx>
51 : : #include <sfx2/dispatch.hxx>
52 : : #include <vcl/scrbar.hxx>
53 : : #include <svl/whiter.hxx>
54 : : #include <editeng/editstat.hxx>
55 : : #include <svl/itempool.hxx>
56 : : #include <sfx2/tplpitem.hxx>
57 : : #include <svx/svdorect.hxx>
58 : : #include <sot/formats.hxx>
59 : : #include <com/sun/star/linguistic2/XThesaurus.hpp>
60 : : #include <com/sun/star/i18n/TransliterationModules.hpp>
61 : : #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
62 : : #include <editeng/unolingu.hxx>
63 : : #include <comphelper/processfactory.hxx>
64 : : #include <editeng/outlobj.hxx>
65 : : #include <svl/cjkoptions.hxx>
66 : : #include <svtools/cliplistener.hxx>
67 : : #include <svl/srchitem.hxx>
68 : : #include <editeng/editobj.hxx>
69 : : #include "fubullet.hxx"
70 : : #include "optsitem.hxx"
71 : :
72 : : #include "strings.hrc"
73 : : #include "glob.hrc"
74 : : #include "res_bmp.hrc"
75 : : #include "Outliner.hxx"
76 : : #include "Window.hxx"
77 : : #include "TextObjectBar.hxx"
78 : : #include "drawdoc.hxx"
79 : : #include "sdresid.hxx"
80 : : #include "sdpage.hxx"
81 : : #include "fuoltext.hxx"
82 : : #include "FrameView.hxx"
83 : : #include "zoomlist.hxx"
84 : : #include "stlsheet.hxx"
85 : : #include "slideshow.hxx"
86 : : #include "SdUnoOutlineView.hxx"
87 : : #include "SpellDialogChildWindow.hxx"
88 : :
89 : : #include "AccessibleOutlineView.hxx"
90 : : #include "ViewShellBase.hxx"
91 : : #include "ViewShellManager.hxx"
92 : : #include "DrawController.hxx"
93 : : #include "framework/FrameworkHelper.hxx"
94 : :
95 : : using ::rtl::OUString;
96 : : using namespace ::com::sun::star;
97 : : using namespace ::com::sun::star::uno;
98 : : using namespace ::com::sun::star::lang;
99 : : using namespace ::com::sun::star::linguistic2;
100 : :
101 : : using namespace sd;
102 : : #define OutlineViewShell
103 : : #include "sdslots.hxx"
104 : :
105 : : namespace sd {
106 : :
107 : : #define MIN_ZOOM 10 // minimum zoom factor
108 : : #define MAX_ZOOM 1000 // maximum zoom factor
109 : :
110 : : /************************************************************************/
111 : :
112 : :
113 : : /*************************************************************************
114 : : |*
115 : : |* Declare SFX-Slotmap and standard interface
116 : : |*
117 : : \************************************************************************/
118 : :
119 : :
120 [ + + ][ + - ]: 225 : SFX_IMPL_INTERFACE(OutlineViewShell, SfxShell, SdResId(STR_OUTLINEVIEWSHELL))
[ + - ]
121 : : {
122 [ + - ][ + - ]: 25 : SFX_POPUPMENU_REGISTRATION( SdResId(RID_OUTLINE_POPUP) );
123 [ + - ]: 25 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD |
124 : : SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
125 [ + - ]: 25 : SdResId(RID_OUTLINE_TOOLBOX) );
126 [ + - ]: 25 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC,
127 [ + - ]: 25 : SdResId(RID_DRAW_VIEWER_TOOLBOX) );
128 : 25 : SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() );
129 : 25 : SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() );
130 : 25 : SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
131 : 25 : SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
132 : 25 : }
133 : :
134 : :
135 [ # # ][ # # ]: 1066 : TYPEINIT1( OutlineViewShell, ViewShell );
136 : :
137 : :
138 : : /*************************************************************************
139 : : |*
140 : : |* common initialization part of both constructors
141 : : |*
142 : : \************************************************************************/
143 : :
144 : 0 : void OutlineViewShell::Construct(DrawDocShell* )
145 : : {
146 [ # # ]: 0 : sal_Bool bModified = GetDoc()->IsChanged();
147 : :
148 : 0 : meShellType = ST_OUTLINE;
149 : 0 : Size aSize(29700, 21000);
150 : 0 : Point aWinPos (0, 0);
151 : 0 : Point aViewOrigin(0, 0);
152 [ # # ][ # # ]: 0 : GetActiveWindow()->SetMinZoomAutoCalc(sal_False);
153 [ # # ][ # # ]: 0 : GetActiveWindow()->SetMinZoom( MIN_ZOOM );
154 [ # # ][ # # ]: 0 : GetActiveWindow()->SetMaxZoom( MAX_ZOOM );
155 [ # # ]: 0 : InitWindows(aViewOrigin, aSize, aWinPos);
156 [ # # ][ # # ]: 0 : pOlView = new OutlineView(*GetDocSh(), GetActiveWindow(), *this);
[ # # ][ # # ]
157 : 0 : mpView = pOlView; // Pointer of base class ViewShell
158 : :
159 [ # # ]: 0 : SetPool( &GetDoc()->GetPool() );
160 : :
161 [ # # ]: 0 : SetZoom(69);
162 : :
163 : : // Apply settings of FrameView
164 [ # # ]: 0 : ReadFrameViewData(mpFrameView);
165 : :
166 : 0 : ::Outliner* pOutl = pOlView->GetOutliner();
167 [ # # ]: 0 : pOutl->SetUpdateMode(sal_True);
168 : :
169 [ # # ]: 0 : if (!bModified)
170 : : {
171 [ # # ]: 0 : pOutl->ClearModifyFlag();
172 : : }
173 : :
174 [ # # ]: 0 : pLastPage = GetActualPage();
175 : :
176 [ # # ][ # # ]: 0 : SetName( OUString( "OutlineViewShell" ) );
[ # # ]
177 : :
178 [ # # ]: 0 : SetHelpId( SD_IF_SDOUTLINEVIEWSHELL );
179 [ # # ][ # # ]: 0 : GetActiveWindow()->SetHelpId( HID_SDOUTLINEVIEWSHELL );
180 [ # # ][ # # ]: 0 : GetActiveWindow()->SetUniqueId( HID_SDOUTLINEVIEWSHELL );
181 : 0 : }
182 : :
183 : :
184 : :
185 : :
186 : 0 : Reference<drawing::XDrawSubController> OutlineViewShell::CreateSubController (void)
187 : : {
188 : 0 : Reference<drawing::XDrawSubController> xSubController;
189 : :
190 [ # # ][ # # ]: 0 : if (IsMainViewShell())
191 : : {
192 : : // Create uno sub controller for the main view shell.
193 : : xSubController = Reference<drawing::XDrawSubController>(
194 : : new SdUnoOutlineView (
195 [ # # ]: 0 : GetViewShellBase().GetDrawController(),
196 : : *this,
197 [ # # ][ # # ]: 0 : *GetView()));
[ # # ][ # # ]
198 : : }
199 : :
200 : 0 : return xSubController;
201 : : }
202 : :
203 : :
204 : :
205 : :
206 : : /*************************************************************************
207 : : |*
208 : : |* Default constructor, windows must not center themselves automatically
209 : : |*
210 : : \************************************************************************/
211 : :
212 : 0 : OutlineViewShell::OutlineViewShell (
213 : : SfxViewFrame* pFrame,
214 : : ViewShellBase& rViewShellBase,
215 : : ::Window* pParentWindow,
216 : : FrameView* pFrameViewArgument)
217 : : : ViewShell(pFrame, pParentWindow, rViewShellBase),
218 : : pOlView(NULL),
219 : : pLastPage( NULL ),
220 : : pClipEvtLstnr(NULL),
221 : : bPastePossible(false),
222 : 0 : mbInitialized(false)
223 : :
224 : : {
225 [ # # ]: 0 : if (pFrameViewArgument != NULL)
226 : 0 : mpFrameView = pFrameViewArgument;
227 : : else
228 [ # # ][ # # ]: 0 : mpFrameView = new FrameView(GetDoc());
[ # # ]
229 : :
230 [ # # ]: 0 : mpFrameView->Connect();
231 : :
232 [ # # ][ # # ]: 0 : Construct(GetDocSh());
233 : :
234 [ # # ]: 0 : doShow();
235 : 0 : }
236 : :
237 : : /*************************************************************************
238 : : |*
239 : : |* Destructor
240 : : |*
241 : : \************************************************************************/
242 : :
243 : 0 : OutlineViewShell::~OutlineViewShell()
244 : : {
245 [ # # ]: 0 : DisposeFunctions();
246 : :
247 [ # # ][ # # ]: 0 : delete pOlView;
248 : :
249 [ # # ]: 0 : mpFrameView->Disconnect();
250 : :
251 [ # # ]: 0 : if ( pClipEvtLstnr )
252 : : {
253 [ # # ][ # # ]: 0 : pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_False );
254 [ # # ]: 0 : pClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
255 : 0 : pClipEvtLstnr->release();
256 : : }
257 [ # # ]: 0 : }
258 : :
259 : :
260 : :
261 : :
262 : 0 : void OutlineViewShell::Shutdown (void)
263 : : {
264 : 0 : ViewShell::Shutdown();
265 : :
266 : 0 : PrepareClose();
267 : 0 : }
268 : :
269 : :
270 : :
271 : :
272 : : /*************************************************************************
273 : : |*
274 : : |* Paint method: the event gets forwarded from pWindow to the Viewshell
275 : : |* and the current function
276 : : |*
277 : : \************************************************************************/
278 : :
279 : 0 : void OutlineViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
280 : : {
281 [ # # ]: 0 : if (pOlView)
282 : : {
283 : 0 : pOlView->Paint(rRect, pWin);
284 : : }
285 : :
286 [ # # ]: 0 : if(HasCurrentFunction())
287 : : {
288 [ # # ]: 0 : GetCurrentFunction()->Paint(rRect, pWin);
289 : : }
290 : 0 : }
291 : :
292 : 0 : void OutlineViewShell::ArrangeGUIElements ()
293 : : {
294 : : // Retrieve the current size (thickness) of the scroll bars. That is
295 : : // the width of the vertical and the height of the horizontal scroll
296 : : // bar.
297 : : int nScrollBarSize =
298 : 0 : GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
299 : 0 : maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
300 : :
301 : 0 : ViewShell::ArrangeGUIElements ();
302 : :
303 : 0 : ::sd::Window* pWindow = mpContentWindow.get();
304 [ # # ]: 0 : if (pWindow != NULL)
305 : : {
306 [ # # ]: 0 : pWindow->SetMinZoomAutoCalc(sal_False);
307 : :
308 : :
309 : : // change OuputArea of the OutlinerView
310 [ # # ]: 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
311 : :
312 [ # # ]: 0 : Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
313 : :
314 [ # # ]: 0 : aWin = pWindow->PixelToLogic(aWin);
315 [ # # ]: 0 : pOutlinerView->SetOutputArea(aWin);
316 : :
317 [ # # ]: 0 : Rectangle aVis = pOutlinerView->GetVisArea();
318 : :
319 : : Rectangle aText = Rectangle(Point(0,0),
320 : 0 : Size(pOlView->GetPaperWidth(),
321 [ # # # # ]: 0 : pOlView->GetOutliner()->GetTextHeight()));
322 [ # # ]: 0 : aText.Bottom() += aWin.GetHeight();
323 : :
324 [ # # ][ # # ]: 0 : if (!aWin.IsEmpty()) // not when opening
325 : : {
326 [ # # ][ # # ]: 0 : InitWindows(Point(0,0), aText.GetSize(), Point(aVis.TopLeft()));
327 [ # # ]: 0 : UpdateScrollBars();
328 : : }
329 : : }
330 : 0 : }
331 : :
332 : : /*************************************************************************
333 : : |*
334 : : |* Handle SfxRequest for the Controller
335 : : |*
336 : : \************************************************************************/
337 : :
338 : 0 : void OutlineViewShell::ExecCtrl(SfxRequest &rReq)
339 : : {
340 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
341 [ # # # ]: 0 : switch ( nSlot )
342 : : {
343 : : case SID_MAIL_SCROLLBODY_PAGEDOWN:
344 : : {
345 : 0 : ExecReq( rReq );
346 : 0 : break;
347 : : }
348 : :
349 : : case SID_OPT_LOCALE_CHANGED:
350 : : {
351 : 0 : pOlView->GetOutliner()->UpdateFields();
352 : 0 : UpdatePreview( GetActualPage() );
353 : 0 : rReq.Done();
354 : 0 : break;
355 : : }
356 : :
357 : : default:
358 : 0 : break;
359 : : }
360 : 0 : }
361 : :
362 : :
363 : :
364 : :
365 : 0 : void OutlineViewShell::AddWindow (::sd::Window* pWin)
366 : : {
367 : 0 : pOlView->AddWindowToPaintView(pWin);
368 : 0 : }
369 : :
370 : :
371 : :
372 : :
373 : 0 : void OutlineViewShell::RemoveWindow (::sd::Window* pWin)
374 : : {
375 : 0 : pOlView->DeleteWindowFromPaintView(pWin);
376 : 0 : }
377 : :
378 : :
379 : :
380 : :
381 : : /*************************************************************************
382 : : |*
383 : : |* Activate(): during the first invocation the fields get updated
384 : : |*
385 : : \************************************************************************/
386 : 0 : void OutlineViewShell::Activate( sal_Bool bIsMDIActivate )
387 : : {
388 [ # # ]: 0 : if ( ! mbInitialized)
389 : : {
390 : 0 : mbInitialized = true;
391 [ # # ][ # # ]: 0 : SfxRequest aRequest (SID_EDIT_OUTLINER, 0, GetDoc()->GetItemPool());
392 [ # # ][ # # ]: 0 : FuPermanent (aRequest);
393 : : }
394 : :
395 : 0 : ViewShell::Activate( bIsMDIActivate );
396 : 0 : pOlView->SetLinks();
397 : 0 : pOlView->ConnectToApplication();
398 : :
399 [ # # ]: 0 : if( bIsMDIActivate )
400 : : {
401 : 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
402 : 0 : ::Outliner* pOutl = pOutlinerView->GetOutliner();
403 : 0 : pOutl->UpdateFields();
404 : : }
405 : 0 : }
406 : :
407 : : /*************************************************************************
408 : : |*
409 : : |* Deactivate()
410 : : |*
411 : : \************************************************************************/
412 : 0 : void OutlineViewShell::Deactivate( sal_Bool bIsMDIActivate )
413 : : {
414 : 0 : pOlView->DisconnectFromApplication();
415 : :
416 : : // Links must be kept also on deactivated viewshell, to allow drag'n'drop
417 : : // to function properly
418 : 0 : ViewShell::Deactivate( bIsMDIActivate );
419 : 0 : }
420 : :
421 : : /*************************************************************************
422 : : |*
423 : : |* Set status of Controller-SfxSlots
424 : : |*
425 : : \************************************************************************/
426 : 0 : void OutlineViewShell::GetCtrlState(SfxItemSet &rSet)
427 : : {
428 [ # # ]: 0 : if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
429 : : {
430 [ # # ]: 0 : SvxHyperlinkItem aHLinkItem;
431 : :
432 [ # # ][ # # ]: 0 : OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow());
433 [ # # ]: 0 : if (pOLV)
434 : : {
435 [ # # ]: 0 : const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
436 [ # # ]: 0 : if (pFieldItem)
437 : : {
438 [ # # ]: 0 : ESelection aSel = pOLV->GetSelection();
439 [ # # ]: 0 : if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
440 : : {
441 : 0 : const SvxFieldData* pField = pFieldItem->GetField();
442 [ # # ][ # # ]: 0 : if ( pField->ISA(SvxURLField) )
[ # # ]
443 : : {
444 [ # # ][ # # ]: 0 : aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
[ # # ]
445 [ # # ][ # # ]: 0 : aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
[ # # ]
446 [ # # ][ # # ]: 0 : aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
[ # # ]
447 : : }
448 : : }
449 : : }
450 : : }
451 [ # # ][ # # ]: 0 : rSet.Put(aHLinkItem);
452 : : }
453 [ # # ]: 0 : rSet.Put( SfxBoolItem( SID_READONLY_MODE, GetDocSh()->IsReadOnly() ) );
454 : :
455 [ # # ]: 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
456 [ # # ]: 0 : rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
457 : :
458 [ # # # # : 0 : if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HALFWIDTH) ||
# # # # ]
[ # # ]
459 : 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_FULLWIDTH) ||
460 : 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HIRAGANA) ||
461 : 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_KATAGANA) )
462 : : {
463 [ # # ]: 0 : SvtCJKOptions aCJKOptions;
464 [ # # ][ # # ]: 0 : if( !aCJKOptions.IsChangeCaseMapEnabled() )
465 : : {
466 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
467 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
468 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
469 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
470 [ # # ]: 0 : rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
471 [ # # ]: 0 : rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
472 [ # # ]: 0 : rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
473 [ # # ]: 0 : rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
474 : : }
475 : : else
476 : : {
477 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
478 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
479 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
480 [ # # ][ # # ]: 0 : GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
481 [ # # ]: 0 : }
482 : : }
483 : 0 : }
484 : :
485 : : /*************************************************************************
486 : : |*
487 : : |* SfxRequests for support functions
488 : : |*
489 : : \************************************************************************/
490 : :
491 : 0 : void OutlineViewShell::FuSupport(SfxRequest &rReq)
492 : : {
493 [ # # ][ # # ]: 0 : if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs())
[ # # ]
494 [ # # ][ # # ]: 0 : GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue());
495 : :
496 : 0 : sal_Bool bPreviewState = sal_False;
497 : 0 : sal_uLong nSlot = rReq.GetSlot();
498 : :
499 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
500 : 0 : std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
501 : : SAL_WNODEPRECATED_DECLARATIONS_POP
502 [ # # ][ # # ]: 0 : if( pOlView && (
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
503 : : (nSlot == SID_TRANSLITERATE_SENTENCE_CASE) ||
504 : : (nSlot == SID_TRANSLITERATE_TITLE_CASE) ||
505 : : (nSlot == SID_TRANSLITERATE_TOGGLE_CASE) ||
506 : : (nSlot == SID_TRANSLITERATE_UPPER) ||
507 : : (nSlot == SID_TRANSLITERATE_LOWER) ||
508 : : (nSlot == SID_TRANSLITERATE_HALFWIDTH) ||
509 : : (nSlot == SID_TRANSLITERATE_FULLWIDTH) ||
510 : : (nSlot == SID_TRANSLITERATE_HIRAGANA) ||
511 : : (nSlot == SID_TRANSLITERATE_KATAGANA) ||
512 : : (nSlot == SID_CUT) ||
513 : : (nSlot == SID_PASTE) ||
514 : : (nSlot == SID_DELETE)))
515 : : {
516 [ # # ][ # # ]: 0 : aGuard.reset( new OutlineViewModelChangeGuard( *pOlView ) );
517 : : }
518 : :
519 [ # # # # : 0 : switch ( nSlot )
# # # # #
# # # # ]
520 : : {
521 : : case SID_CUT:
522 : : {
523 [ # # ][ # # ]: 0 : if(HasCurrentFunction())
524 : : {
525 [ # # ][ # # ]: 0 : GetCurrentFunction()->DoCut();
[ # # ]
526 : : }
527 [ # # ]: 0 : else if (pOlView)
528 : : {
529 [ # # ]: 0 : pOlView->DoCut();
530 : : }
531 [ # # ]: 0 : rReq.Done();
532 : 0 : bPreviewState = sal_True;
533 : : }
534 : 0 : break;
535 : :
536 : : case SID_COPY:
537 : : {
538 [ # # ][ # # ]: 0 : if(HasCurrentFunction())
539 : : {
540 [ # # ][ # # ]: 0 : GetCurrentFunction()->DoCopy();
[ # # ]
541 : : }
542 [ # # ]: 0 : else if (pOlView)
543 : : {
544 [ # # ]: 0 : pOlView->DoCopy();
545 : : }
546 [ # # ]: 0 : rReq.Done();
547 : 0 : bPreviewState = sal_True;
548 : : }
549 : 0 : break;
550 : :
551 : : case SID_PASTE:
552 : : {
553 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard2(pOlView);
554 : :
555 [ # # ][ # # ]: 0 : if(HasCurrentFunction())
556 : : {
557 [ # # ][ # # ]: 0 : GetCurrentFunction()->DoPaste();
[ # # ]
558 : : }
559 [ # # ]: 0 : else if (pOlView)
560 : : {
561 [ # # ]: 0 : pOlView->DoPaste();
562 : : }
563 [ # # ]: 0 : rReq.Done();
564 [ # # ]: 0 : bPreviewState = sal_True;
565 : : }
566 : 0 : break;
567 : :
568 : : case SID_DELETE:
569 : : {
570 [ # # ]: 0 : if( pOlView )
571 : : {
572 [ # # ][ # # ]: 0 : OutlinerView* pOutlView = pOlView->GetViewByWindow(GetActiveWindow());
573 [ # # ]: 0 : if (pOutlView)
574 : : {
575 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard2(pOlView);
576 : :
577 : 0 : KeyCode aKCode(KEY_DELETE);
578 [ # # ]: 0 : KeyEvent aKEvt( 0, aKCode );
579 [ # # ]: 0 : pOutlView->PostKeyEvent(aKEvt);
580 : :
581 [ # # ]: 0 : FunctionReference xFunc( GetCurrentFunction() );
582 [ # # ]: 0 : FuOutlineText* pFuOutlineText = dynamic_cast< FuOutlineText* >( xFunc.get() );
583 [ # # ]: 0 : if( pFuOutlineText )
584 [ # # ][ # # ]: 0 : pFuOutlineText->UpdateForKeyPress (aKEvt);
[ # # ]
585 : : }
586 : : }
587 [ # # ]: 0 : rReq.Done();
588 : 0 : bPreviewState = sal_True;
589 : : }
590 : 0 : break;
591 : :
592 : : case SID_DRAWINGMODE:
593 : : case SID_NOTESMODE:
594 : : case SID_HANDOUTMODE:
595 : : case SID_DIAMODE:
596 : : case SID_OUTLINEMODE:
597 [ # # ]: 0 : framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
598 : : nSlot,
599 [ # # ][ # # ]: 0 : rReq);
[ # # ]
600 [ # # ]: 0 : rReq.Done();
601 : 0 : break;
602 : :
603 : : case SID_RULER:
604 [ # # ][ # # ]: 0 : SetRuler( !HasRuler() );
605 [ # # ]: 0 : Invalidate( SID_RULER );
606 [ # # ]: 0 : rReq.Done();
607 : 0 : break;
608 : :
609 : : case SID_ZOOM_PREV:
610 : : {
611 [ # # ][ # # ]: 0 : if (mpZoomList->IsPreviousPossible())
612 : : {
613 [ # # ][ # # ]: 0 : SetZoomRect(mpZoomList->GetPreviousZoomRect());
614 : : }
615 [ # # ]: 0 : rReq.Done ();
616 : : }
617 : 0 : break;
618 : :
619 : : case SID_ZOOM_NEXT:
620 : : {
621 [ # # ][ # # ]: 0 : if (mpZoomList->IsNextPossible())
622 : : {
623 [ # # ][ # # ]: 0 : SetZoomRect(mpZoomList->GetNextZoomRect());
624 : : }
625 [ # # ]: 0 : rReq.Done ();
626 : : }
627 : 0 : break;
628 : :
629 : : case SID_AUTOSPELL_CHECK:
630 : : {
631 [ # # ][ # # ]: 0 : GetDoc()->SetOnlineSpell(!GetDoc()->GetOnlineSpell());
[ # # ]
632 [ # # ]: 0 : rReq.Done ();
633 : : }
634 : 0 : break;
635 : :
636 : : case SID_TRANSLITERATE_SENTENCE_CASE:
637 : : case SID_TRANSLITERATE_TITLE_CASE:
638 : : case SID_TRANSLITERATE_TOGGLE_CASE:
639 : : case SID_TRANSLITERATE_UPPER:
640 : : case SID_TRANSLITERATE_LOWER:
641 : : case SID_TRANSLITERATE_HALFWIDTH:
642 : : case SID_TRANSLITERATE_FULLWIDTH:
643 : : case SID_TRANSLITERATE_HIRAGANA:
644 : : case SID_TRANSLITERATE_KATAGANA:
645 : : {
646 [ # # ][ # # ]: 0 : OutlinerView* pOLV = pOlView->GetViewByWindow( GetActiveWindow() );
647 [ # # ]: 0 : if( pOLV )
648 : : {
649 : : using namespace ::com::sun::star::i18n;
650 : 0 : sal_Int32 nType = 0;
651 : :
652 [ # # # # : 0 : switch( nSlot )
# # # # #
# ]
653 : : {
654 : : case SID_TRANSLITERATE_SENTENCE_CASE:
655 : 0 : nType = TransliterationModulesExtra::SENTENCE_CASE;
656 : 0 : break;
657 : : case SID_TRANSLITERATE_TITLE_CASE:
658 : 0 : nType = TransliterationModulesExtra::TITLE_CASE;
659 : 0 : break;
660 : : case SID_TRANSLITERATE_TOGGLE_CASE:
661 : 0 : nType = TransliterationModulesExtra::TOGGLE_CASE;
662 : 0 : break;
663 : : case SID_TRANSLITERATE_UPPER:
664 : 0 : nType = TransliterationModules_LOWERCASE_UPPERCASE;
665 : 0 : break;
666 : : case SID_TRANSLITERATE_LOWER:
667 : 0 : nType = TransliterationModules_UPPERCASE_LOWERCASE;
668 : 0 : break;
669 : : case SID_TRANSLITERATE_HALFWIDTH:
670 : 0 : nType = TransliterationModules_FULLWIDTH_HALFWIDTH;
671 : 0 : break;
672 : : case SID_TRANSLITERATE_FULLWIDTH:
673 : 0 : nType = TransliterationModules_HALFWIDTH_FULLWIDTH;
674 : 0 : break;
675 : : case SID_TRANSLITERATE_HIRAGANA:
676 : 0 : nType = TransliterationModules_KATAKANA_HIRAGANA;
677 : 0 : break;
678 : : case SID_TRANSLITERATE_KATAGANA:
679 : 0 : nType = TransliterationModules_HIRAGANA_KATAKANA;
680 : 0 : break;
681 : : }
682 : :
683 [ # # ]: 0 : pOLV->TransliterateText( nType );
684 : : }
685 : :
686 [ # # ]: 0 : rReq.Done();
687 : 0 : bPreviewState = sal_True;
688 : : }
689 : 0 : break;
690 : :
691 : : // added Undo/Redo handling
692 : : case SID_UNDO :
693 : : {
694 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard2(pOlView);
695 [ # # ][ # # ]: 0 : ImpSidUndo(sal_False, rReq);
696 : : }
697 : 0 : break;
698 : : case SID_REDO :
699 : : {
700 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard2(pOlView);
701 [ # # ][ # # ]: 0 : ImpSidRedo(sal_False, rReq);
702 : : }
703 : 0 : break;
704 : :
705 : : default:
706 : 0 : break;
707 : : }
708 : :
709 [ # # ]: 0 : if( bPreviewState )
710 [ # # ]: 0 : Invalidate( SID_PREVIEW_STATE );
711 : :
712 [ # # ]: 0 : Invalidate(SID_CUT);
713 [ # # ]: 0 : Invalidate(SID_COPY);
714 [ # # ][ # # ]: 0 : Invalidate(SID_PASTE);
715 : 0 : }
716 : :
717 : : /*************************************************************************
718 : : |*
719 : : |* SfxRequests for permanent functions
720 : : |*
721 : : \************************************************************************/
722 : :
723 : 0 : void OutlineViewShell::FuPermanent(SfxRequest &rReq)
724 : : {
725 [ # # ]: 0 : if(HasCurrentFunction())
726 : : {
727 : 0 : DeactivateCurrentFunction(true);
728 : : }
729 : :
730 [ # # ]: 0 : switch ( rReq.GetSlot() )
731 : : {
732 : : case SID_EDIT_OUTLINER:
733 : : {
734 : 0 : ::Outliner* pOutl = pOlView->GetOutliner();
735 [ # # ]: 0 : if( pOutl )
736 : : {
737 : 0 : pOutl->GetUndoManager().Clear();
738 : 0 : pOutl->UpdateFields();
739 : : }
740 : :
741 [ # # ]: 0 : SetCurrentFunction( FuOutlineText::Create(this,GetActiveWindow(),pOlView,GetDoc(),rReq) );
742 : :
743 : 0 : rReq.Done();
744 : : }
745 : 0 : break;
746 : :
747 : : default:
748 : 0 : break;
749 : : }
750 : :
751 [ # # ]: 0 : if(HasOldFunction())
752 : : {
753 [ # # ]: 0 : GetOldFunction()->Deactivate();
754 [ # # ]: 0 : SetOldFunction(0);
755 : : }
756 : :
757 [ # # ]: 0 : if(HasCurrentFunction())
758 : : {
759 [ # # ]: 0 : GetCurrentFunction()->Activate();
760 [ # # ]: 0 : SetOldFunction(GetCurrentFunction());
761 : : }
762 : 0 : }
763 : :
764 : :
765 : 0 : IMPL_LINK( OutlineViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
766 : : {
767 [ # # ]: 0 : if ( pDataHelper )
768 : : {
769 : 0 : bPastePossible = ( pDataHelper->GetFormatCount() != 0 &&
770 : 0 : ( pDataHelper->HasFormat( FORMAT_STRING ) ||
771 : 0 : pDataHelper->HasFormat( FORMAT_RTF ) ||
772 [ # # ][ # # : 0 : pDataHelper->HasFormat( SOT_FORMATSTR_ID_HTML ) ) );
# # # # ]
773 : :
774 : 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
775 : 0 : rBindings.Invalidate( SID_PASTE );
776 : 0 : rBindings.Invalidate( SID_PASTE_SPECIAL );
777 : 0 : rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
778 : : }
779 : 0 : return 0;
780 : : }
781 : :
782 : : /*************************************************************************
783 : : |*
784 : : |* Set Status (Enabled/Disabled) of Menu-SfxSlots
785 : : |*
786 : : \************************************************************************/
787 : :
788 : 0 : void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
789 : : {
790 [ # # ]: 0 : ViewShell::GetMenuState(rSet);
791 : :
792 : : // Style catalog must not be called
793 [ # # ]: 0 : rSet.DisableItem( SID_STYLE_CATALOG );
794 : :
795 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_DIAMODE, sal_False));
[ # # ]
796 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False));
[ # # ]
797 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_OUTLINEMODE, sal_True));
[ # # ]
798 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False));
[ # # ]
799 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False));
[ # # ]
800 : :
801 [ # # ][ # # ]: 0 : if (!mpZoomList->IsNextPossible())
802 : : {
803 [ # # ]: 0 : rSet.DisableItem(SID_ZOOM_NEXT);
804 : : }
805 [ # # ][ # # ]: 0 : if (!mpZoomList->IsPreviousPossible())
806 : : {
807 [ # # ]: 0 : rSet.DisableItem(SID_ZOOM_PREV);
808 : : }
809 : :
810 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) ||
[ # # ][ # # ]
811 [ # # ]: 0 : SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT ) )
812 : : {
813 [ # # ][ # # ]: 0 : if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
814 [ # # ]: 0 : rSet.DisableItem( SID_ZOOM_IN );
815 [ # # ][ # # ]: 0 : if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
816 [ # # ]: 0 : rSet.DisableItem( SID_ZOOM_OUT );
817 : : }
818 : :
819 : 0 : ::Outliner* pOutl = pOlView->GetOutliner();
820 : : DBG_ASSERT(pOutl, "OutlineViewShell::GetMenuState(), no outliner? Fatality!");
821 [ # # ]: 0 : if( !pOutl )
822 : 0 : return;
823 : :
824 : : // allow 'Select All'?
825 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) )
826 : : {
827 [ # # ]: 0 : sal_uLong nParaCount = pOutl->GetParagraphCount();
828 : 0 : sal_Bool bDisable = nParaCount == 0;
829 [ # # ][ # # ]: 0 : if (!bDisable && nParaCount == 1)
830 : : {
831 [ # # ][ # # ]: 0 : String aTest( pOutl->GetText( pOutl->GetParagraph( 0 ) ) );
832 [ # # ]: 0 : if (aTest.Len() == 0)
833 : : {
834 : 0 : bDisable = sal_True;
835 [ # # ]: 0 : }
836 : : }
837 [ # # ]: 0 : if (bDisable)
838 [ # # ]: 0 : rSet.DisableItem(SID_SELECTALL);
839 : : }
840 : :
841 : : // set status of Ruler
842 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) );
[ # # ][ # # ]
843 : :
844 : : // Enable formatting?
845 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_OUTLINE_FORMAT, !pOutl->IsFlatMode() ) );
[ # # ][ # # ]
846 : :
847 [ # # ][ # # ]: 0 : if( pOutl->IsFlatMode() )
848 [ # # ]: 0 : rSet.DisableItem( SID_COLORVIEW );
849 : : else
850 : : {
851 : : // Enable color view?
852 [ # # ]: 0 : sal_uLong nCntrl = pOutl->GetControlWord();
853 : 0 : sal_Bool bNoColor = sal_False;
854 [ # # ]: 0 : if (nCntrl & EE_CNTRL_NOCOLORS)
855 : 0 : bNoColor = sal_True;
856 : :
857 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_COLORVIEW, bNoColor ) );
[ # # ]
858 : : }
859 : :
860 : : // Buttons of toolbar
861 : : // first the selection dependent ones: COLLAPSE, EXPAND
862 : 0 : sal_Bool bDisableCollapse = sal_True;
863 : 0 : sal_Bool bDisableExpand = sal_True;
864 : 0 : sal_Bool bUnique = sal_True;
865 [ # # ][ # # ]: 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow(GetActiveWindow());
866 : :
867 [ # # ]: 0 : std::vector<Paragraph*> aSelList;
868 [ # # ]: 0 : pOutlinerView->CreateSelectionList(aSelList);
869 : :
870 [ # # ]: 0 : if (!aSelList.empty())
871 : : {
872 [ # # ]: 0 : std::vector<Paragraph*>::const_iterator iter = aSelList.begin();
873 : 0 : Paragraph* pPara = *iter;
874 : :
875 : : sal_Int16 nDepth;
876 [ # # ][ # # ]: 0 : sal_Int16 nTmpDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
877 [ # # ]: 0 : bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
878 : :
879 [ # # ][ # # ]: 0 : while (iter != aSelList.begin())
880 : : {
881 : 0 : pPara = *iter;
882 : :
883 [ # # ][ # # ]: 0 : nDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
884 : :
885 [ # # ][ # # ]: 0 : if( nDepth != nTmpDepth || bPage != pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ))
[ # # ][ # # ]
886 : 0 : bUnique = sal_False;
887 : :
888 [ # # ][ # # ]: 0 : if (pOutl->HasChildren(pPara))
889 : : {
890 [ # # ][ # # ]: 0 : if (!pOutl->IsExpanded(pPara))
891 : 0 : bDisableExpand = sal_False;
892 : : else
893 : 0 : bDisableCollapse = sal_False;
894 : : }
895 : :
896 : 0 : ++iter;
897 : : }
898 : : }
899 : :
900 [ # # ]: 0 : if (bDisableExpand)
901 [ # # ]: 0 : rSet.DisableItem(SID_OUTLINE_EXPAND);
902 [ # # ]: 0 : if (bDisableCollapse)
903 [ # # ]: 0 : rSet.DisableItem(SID_OUTLINE_COLLAPSE);
904 : :
905 : : // does the selection provide a unique presentation layout?
906 : : // if not, the templates must not be edited
907 [ # # ]: 0 : SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
908 [ # # ]: 0 : GetStatusBarState(aSet);
909 [ # # ][ # # ]: 0 : String aTest(((SfxStringItem&)aSet.Get(SID_STATUS_LAYOUT)).GetValue());
910 [ # # ]: 0 : if (aTest.Len() == 0)
911 : : {
912 : 0 : bUnique = sal_False;
913 [ # # ]: 0 : rSet.DisableItem(SID_PRESENTATION_TEMPLATES);
914 : : }
915 : :
916 [ # # ]: 0 : if (!bUnique)
917 [ # # ]: 0 : rSet.DisableItem( SID_PRESENTATIONOBJECT );
918 : :
919 : : // now the selection independent ones: COLLAPSE_ALL, EXPAND_ALL
920 : 0 : sal_Bool bDisableCollapseAll = sal_True;
921 : 0 : sal_Bool bDisableExpandAll = sal_True;
922 : :
923 : : // does the selection contain something collapsable/expandable?
924 [ # # ]: 0 : if (!bDisableCollapse)
925 : 0 : bDisableCollapseAll = sal_False;
926 [ # # ]: 0 : if (!bDisableExpand)
927 : 0 : bDisableExpandAll = sal_False;
928 : :
929 : : // otherwise look through all paragraphs
930 [ # # ][ # # ]: 0 : if (bDisableCollapseAll || bDisableExpandAll)
931 : : {
932 : 0 : sal_uLong nParaPos = 0;
933 [ # # ]: 0 : Paragraph* pPara = pOutl->GetParagraph( nParaPos );
934 [ # # ][ # # ]: 0 : while (pPara && (bDisableCollapseAll || bDisableExpandAll))
[ # # ][ # # ]
935 : : {
936 [ # # ][ # # ]: 0 : if (!pOutl->IsExpanded(pPara) && pOutl->HasChildren(pPara))
[ # # ][ # # ]
[ # # ]
937 : 0 : bDisableExpandAll = sal_False;
938 : :
939 [ # # ][ # # ]: 0 : if (pOutl->IsExpanded(pPara) && pOutl->HasChildren(pPara))
[ # # ][ # # ]
[ # # ]
940 : 0 : bDisableCollapseAll = sal_False;
941 : :
942 [ # # ]: 0 : pPara = pOutl->GetParagraph( ++nParaPos );
943 : : }
944 : : }
945 : :
946 [ # # ]: 0 : if (bDisableExpandAll)
947 [ # # ]: 0 : rSet.DisableItem(SID_OUTLINE_EXPAND_ALL);
948 [ # # ]: 0 : if (bDisableCollapseAll)
949 [ # # ]: 0 : rSet.DisableItem(SID_OUTLINE_COLLAPSE_ALL);
950 : :
951 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) )
952 : : {
953 [ # # ]: 0 : if ( !pClipEvtLstnr )
954 : : {
955 : : // create listener
956 [ # # ][ # # ]: 0 : pClipEvtLstnr = new TransferableClipboardListener( LINK( this, OutlineViewShell, ClipboardChanged ) );
957 : 0 : pClipEvtLstnr->acquire();
958 [ # # ][ # # ]: 0 : pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_True );
959 : :
960 : : // get initial state
961 [ # # ][ # # ]: 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
962 [ # # ]: 0 : bPastePossible = ( aDataHelper.GetFormatCount() != 0 &&
963 [ # # ]: 0 : ( aDataHelper.HasFormat( FORMAT_STRING ) ||
964 [ # # ]: 0 : aDataHelper.HasFormat( FORMAT_RTF ) ||
965 [ # # ][ # # ]: 0 : aDataHelper.HasFormat( SOT_FORMATSTR_ID_HTML ) ) );
[ # # ][ # # ]
[ # # ][ # # ]
966 : : }
967 : :
968 [ # # ]: 0 : if( !bPastePossible )
969 : : {
970 [ # # ]: 0 : rSet.DisableItem( SID_PASTE );
971 : : }
972 : : }
973 : :
974 [ # # ][ # # ]: 0 : if (!pOlView->GetViewByWindow(GetActiveWindow())->HasSelection())
[ # # ][ # # ]
975 : : {
976 [ # # ]: 0 : rSet.DisableItem(SID_CUT);
977 [ # # ]: 0 : rSet.DisableItem(SID_COPY);
978 : : }
979 : :
980 [ # # ][ # # ]: 0 : if (pOlView->GetOutliner()->IsModified())
981 : : {
982 [ # # ][ # # ]: 0 : GetDoc()->SetChanged(sal_True);
983 : : }
984 : :
985 : : // the status has to be set here because of overloading
986 [ # # ][ # # ]: 0 : if( !GetDocSh()->IsModified() )
[ # # ]
987 : : {
988 [ # # ]: 0 : rSet.DisableItem( SID_SAVEDOC );
989 : : }
990 : :
991 [ # # ][ # # ]: 0 : if ( GetDocSh()->IsReadOnly() )
[ # # ]
992 : : {
993 [ # # ]: 0 : rSet.DisableItem( SID_AUTOSPELL_CHECK );
994 : : }
995 : : else
996 : : {
997 [ # # ][ # # ]: 0 : if (GetDoc()->GetOnlineSpell())
998 : : {
999 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_True));
[ # # ]
1000 : : }
1001 : : else
1002 : : {
1003 [ # # ][ # # ]: 0 : rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_False));
[ # # ]
1004 : : }
1005 : : }
1006 : :
1007 : : // field commands
1008 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MODIFY_FIELD ) )
1009 : : {
1010 [ # # ]: 0 : const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
1011 : :
1012 [ # # ][ # # ]: 0 : if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
[ # # ]
1013 [ # # ][ # # ]: 0 : pFldItem->GetField()->ISA( SvxAuthorField ) ||
1014 [ # # ][ # # ]: 0 : pFldItem->GetField()->ISA( SvxExtFileField ) ||
1015 [ # # ][ # # ]: 0 : pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1016 : : {
1017 [ # # ]: 0 : rSet.DisableItem( SID_MODIFY_FIELD );
1018 : : }
1019 : : }
1020 : :
1021 [ # # ][ # # ]: 0 : if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
1022 : : {
1023 : 0 : sal_Bool bDisable = sal_True;
1024 : 0 : sal_uInt16 i = 0;
1025 [ # # ][ # # ]: 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
1026 [ # # ]: 0 : pOlView->SetSelectedPages();
1027 : :
1028 [ # # ][ # # ]: 0 : while (i < nCount && bDisable)
[ # # ]
1029 : : {
1030 [ # # ][ # # ]: 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
1031 : :
1032 [ # # ]: 0 : if (pPage->IsSelected())
1033 : : {
1034 [ # # ]: 0 : SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
1035 : :
1036 [ # # ]: 0 : if (pObj!=NULL )
1037 : : {
1038 [ # # ][ # # ]: 0 : if( !pObj->IsEmptyPresObj() )
1039 : : {
1040 : 0 : bDisable = false;
1041 : : }
1042 : : else
1043 : : {
1044 : : // check if the object is in edit, than its temporarely not empty
1045 [ # # ]: 0 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
1046 [ # # ]: 0 : if( pTextObj )
1047 : : {
1048 [ # # ]: 0 : OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
1049 [ # # ]: 0 : if( pParaObj )
1050 : : {
1051 [ # # ][ # # ]: 0 : delete pParaObj;
1052 : 0 : bDisable = false;
1053 : : }
1054 : : }
1055 : : }
1056 : : }
1057 : : }
1058 : :
1059 : 0 : i++;
1060 : : }
1061 : :
1062 [ # # ]: 0 : if (bDisable)
1063 : : {
1064 [ # # ]: 0 : rSet.DisableItem(SID_EXPAND_PAGE);
1065 : : }
1066 : : }
1067 : :
1068 [ # # ][ # # ]: 0 : if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
1069 : : {
1070 : 0 : sal_Bool bDisable = sal_True;
1071 : 0 : sal_uInt16 i = 0;
1072 [ # # ][ # # ]: 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
1073 [ # # ]: 0 : pOlView->SetSelectedPages();
1074 : :
1075 [ # # ][ # # ]: 0 : while (i < nCount && bDisable)
[ # # ]
1076 : : {
1077 [ # # ][ # # ]: 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
1078 : :
1079 [ # # ]: 0 : if (pPage->IsSelected())
1080 : : {
1081 [ # # ]: 0 : SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
1082 : :
1083 [ # # ][ # # ]: 0 : if (pObj && !pObj->IsEmptyPresObj())
[ # # ][ # # ]
1084 : : {
1085 : 0 : bDisable = sal_False;
1086 : : }
1087 : : }
1088 : :
1089 : 0 : i++;
1090 : : }
1091 : :
1092 [ # # ]: 0 : if (bDisable)
1093 : : {
1094 [ # # ]: 0 : rSet.DisableItem(SID_SUMMARY_PAGE);
1095 : : }
1096 : : }
1097 : :
1098 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) )
1099 : : {
1100 [ # # ][ # # ]: 0 : if ( !pOlView->IsTextEdit() )
1101 : : {
1102 [ # # ]: 0 : rSet.DisableItem( SID_THESAURUS );
1103 : : }
1104 : : else
1105 : : {
1106 [ # # ][ # # ]: 0 : LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE );
1107 [ # # ]: 0 : Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() );
1108 : 0 : Locale aLocale;
1109 : :
1110 [ # # ]: 0 : SvxLanguageToLocale( aLocale, eLang );
1111 : :
1112 [ # # ][ # # ]: 0 : if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale))
[ # # ][ # # ]
[ # # ][ # # ]
1113 [ # # ]: 0 : rSet.DisableItem( SID_THESAURUS );
1114 : : }
1115 : : }
1116 : :
1117 : : // is starting the presentation possible?
1118 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) )
1119 : : {
1120 : 0 : sal_Bool bDisable = sal_True;
1121 [ # # ][ # # ]: 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount( PK_STANDARD );
1122 : :
1123 [ # # ][ # # ]: 0 : for( sal_uInt16 i = 0; i < nCount && bDisable; i++ )
[ # # ]
1124 : : {
1125 [ # # ][ # # ]: 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
1126 : :
1127 [ # # ]: 0 : if( !pPage->IsExcluded() )
1128 : 0 : bDisable = sal_False;
1129 : : }
1130 [ # # ][ # # ]: 0 : if( bDisable || GetDocSh()->IsPreview())
[ # # ][ # # ]
[ # # ]
1131 : : {
1132 [ # # ]: 0 : rSet.DisableItem( SID_PRESENTATION );
1133 : : }
1134 : : }
1135 : :
1136 [ # # ][ # # ]: 0 : FuBullet::GetSlotState( rSet, this, GetViewFrame() );
[ # # ][ # # ]
1137 : :
1138 : : }
1139 : :
1140 : : /*************************************************************************
1141 : : |*
1142 : : |* gets invoked when ScrollBar is used
1143 : : |*
1144 : : \************************************************************************/
1145 : :
1146 : 0 : long OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
1147 : : {
1148 : 0 : long nThumb = pHScroll->GetThumbPos();
1149 : 0 : long nRange = pHScroll->GetRange().Len();
1150 : 0 : double fX = (double) nThumb / nRange;
1151 : :
1152 : 0 : Window* pWin = mpContentWindow.get();
1153 : 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin);
1154 : : long nViewWidth = pWin->PixelToLogic(
1155 [ # # ]: 0 : pWin->GetSizePixel()).Width();
1156 : 0 : long nTextWidth = pOlView->GetPaperWidth();
1157 : 0 : nViewWidth = Max(nViewWidth, nTextWidth);
1158 : 0 : long nCurrentPos = pOutlinerView->GetVisArea().Left();
1159 : 0 : long nTargetPos = (long)(fX * nViewWidth);
1160 : 0 : long nDelta = nTargetPos - nCurrentPos;
1161 : :
1162 : 0 : pOutlinerView->HideCursor();
1163 : 0 : pOutlinerView->Scroll(-nDelta, 0);
1164 : 0 : pOutlinerView->ShowCursor(sal_False);
1165 : :
1166 : 0 : pOlView->InvalidateSlideNumberArea();
1167 : 0 : return 0;
1168 : : }
1169 : :
1170 : 0 : long OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
1171 : : {
1172 : 0 : long nThumb = pVScroll->GetThumbPos();
1173 : 0 : long nRange = pVScroll->GetRange().Len();
1174 : 0 : double fY = (double) nThumb / nRange;
1175 : :
1176 : 0 : Window* pWin = mpContentWindow.get();
1177 : 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin);
1178 : : long nViewHeight = pWin->PixelToLogic(
1179 [ # # ]: 0 : pWin->GetSizePixel()).Height();
1180 : 0 : long nTextHeight = pOlView->GetOutliner()->GetTextHeight();
1181 : 0 : nViewHeight += nTextHeight;
1182 : 0 : long nCurrentPos = pOutlinerView->GetVisArea().Top();
1183 : 0 : long nTargetPos = (long)(fY * nViewHeight);
1184 : 0 : long nDelta = nTargetPos - nCurrentPos;
1185 : :
1186 : 0 : pOutlinerView->HideCursor();
1187 : 0 : pOutlinerView->Scroll(0, -nDelta);
1188 : 0 : pOutlinerView->ShowCursor(sal_False);
1189 : :
1190 : 0 : pOlView->InvalidateSlideNumberArea();
1191 : :
1192 : 0 : return 0;
1193 : : }
1194 : :
1195 : : /*************************************************************************
1196 : : |*
1197 : : |* PrepareClose, gets called when the Shell shall be destroyed.
1198 : : |* Forwards the invocation to the View
1199 : : |*
1200 : : \************************************************************************/
1201 : :
1202 : 0 : sal_uInt16 OutlineViewShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
1203 : : {
1204 [ # # ]: 0 : if( ViewShell::PrepareClose(bUI, bForBrowsing) != sal_True )
1205 : 0 : return sal_False;
1206 : :
1207 [ # # ][ # # ]: 0 : return pOlView == NULL || pOlView->PrepareClose(bUI);
1208 : : }
1209 : :
1210 : :
1211 : : /*************************************************************************
1212 : : |*
1213 : : |* Zoom with zoom factor. Inform OutlinerView
1214 : : |*
1215 : : \************************************************************************/
1216 : :
1217 : 0 : void OutlineViewShell::SetZoom(long nZoom)
1218 : : {
1219 : 0 : ViewShell::SetZoom(nZoom);
1220 : :
1221 : 0 : ::sd::Window* pWindow = mpContentWindow.get();
1222 [ # # ]: 0 : if (pWindow)
1223 : : {
1224 : : // change OutputArea of OutlinerView
1225 [ # # ]: 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
1226 [ # # ]: 0 : Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
1227 [ # # ]: 0 : aWin = pWindow->PixelToLogic(aWin);
1228 [ # # ]: 0 : pOutlinerView->SetOutputArea(aWin);
1229 : : }
1230 : :
1231 : 0 : GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
1232 : 0 : GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
1233 : 0 : }
1234 : :
1235 : : /*************************************************************************
1236 : : |*
1237 : : |* Zoom with zoom rectangle. Inform OutlinerView
1238 : : |*
1239 : : \************************************************************************/
1240 : :
1241 : 0 : void OutlineViewShell::SetZoomRect(const Rectangle& rZoomRect)
1242 : : {
1243 : 0 : ViewShell::SetZoomRect(rZoomRect);
1244 : :
1245 : 0 : ::sd::Window* pWindow = mpContentWindow.get();
1246 [ # # ]: 0 : if (pWindow)
1247 : : {
1248 : : // change OutputArea of OutlinerView
1249 [ # # ]: 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
1250 [ # # ]: 0 : Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
1251 [ # # ]: 0 : aWin = pWindow->PixelToLogic(aWin);
1252 [ # # ]: 0 : pOutlinerView->SetOutputArea(aWin);
1253 : : }
1254 : :
1255 : 0 : GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
1256 : 0 : GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
1257 : 0 : }
1258 : :
1259 : : /*************************************************************************
1260 : : |*
1261 : : |* Before saving: Update Model of the Drawing Engine, then forward the
1262 : : |* invocation to the ObjectShell.
1263 : : |*
1264 : : \************************************************************************/
1265 : :
1266 : 0 : void OutlineViewShell::Execute(SfxRequest& rReq)
1267 : : {
1268 : 0 : bool bForwardCall = true;
1269 : :
1270 [ # # # # ]: 0 : switch(rReq.GetSlot())
1271 : : {
1272 : : case SID_SAVEDOC:
1273 : : case SID_SAVEASDOC:
1274 : 0 : PrepareClose();
1275 : 0 : break;
1276 : :
1277 : : case SID_SEARCH_ITEM:
1278 : : // Forward this request to the the common (old) code of the
1279 : : // document shell.
1280 : 0 : GetDocSh()->Execute (rReq);
1281 : 0 : bForwardCall = false;
1282 : 0 : break;
1283 : :
1284 : : case SID_SPELL_DIALOG:
1285 : : {
1286 : 0 : SfxViewFrame* pViewFrame = GetViewFrame();
1287 [ # # ]: 0 : if (rReq.GetArgs() != NULL)
1288 : : pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
1289 : 0 : ((const SfxBoolItem&) (rReq.GetArgs()->
1290 : 0 : Get(SID_SPELL_DIALOG))).GetValue());
1291 : : else
1292 : 0 : pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
1293 : :
1294 : 0 : pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
1295 : 0 : rReq.Done ();
1296 : :
1297 : 0 : bForwardCall = false;
1298 : : }
1299 : 0 : break;
1300 : :
1301 : : default:
1302 : : OSL_TRACE ("OutlineViewShell::Execute(): can not handle slot %d", rReq.GetSlot());
1303 : 0 : break;
1304 : :
1305 : : }
1306 : :
1307 [ # # ]: 0 : if (bForwardCall)
1308 : 0 : ((DrawDocShell*)GetViewFrame()->GetObjectShell())->ExecuteSlot( rReq );
1309 : 0 : }
1310 : :
1311 : : /*************************************************************************
1312 : : |*
1313 : : |* Read FrameViews data and set actual views data
1314 : : |*
1315 : : \************************************************************************/
1316 : :
1317 : 0 : void OutlineViewShell::ReadFrameViewData(FrameView* pView)
1318 : : {
1319 : 0 : ::Outliner* pOutl = pOlView->GetOutliner();
1320 : :
1321 : 0 : pOutl->SetFlatMode( static_cast<bool>(pView->IsNoAttribs()) );
1322 : :
1323 : 0 : sal_uLong nCntrl = pOutl->GetControlWord();
1324 : :
1325 [ # # ]: 0 : if ( pView->IsNoColors() )
1326 : 0 : pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS);
1327 : : else
1328 : 0 : pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
1329 : :
1330 : 0 : sal_uInt16 nPage = mpFrameView->GetSelectedPage();
1331 : 0 : pLastPage = GetDoc()->GetSdPage( nPage, PK_STANDARD );
1332 : 0 : pOlView->SetActualPage(pLastPage);
1333 : 0 : }
1334 : :
1335 : :
1336 : :
1337 : : /*************************************************************************
1338 : : |*
1339 : : |* Write actual views data to FrameView
1340 : : |*
1341 : : \************************************************************************/
1342 : :
1343 : 0 : void OutlineViewShell::WriteFrameViewData()
1344 : : {
1345 : 0 : ::Outliner* pOutl = pOlView->GetOutliner();
1346 : :
1347 : 0 : sal_uLong nCntrl = pOutl->GetControlWord();
1348 : 0 : sal_Bool bNoColor = sal_False;
1349 [ # # ]: 0 : if (nCntrl & EE_CNTRL_NOCOLORS)
1350 : 0 : bNoColor = sal_True;
1351 : 0 : mpFrameView->SetNoColors(bNoColor);
1352 : 0 : mpFrameView->SetNoAttribs( pOutl->IsFlatMode() );
1353 : 0 : SdPage* pActualPage = pOlView->GetActualPage();
1354 : : DBG_ASSERT(pActualPage, "No current page");
1355 [ # # ]: 0 : if( pActualPage )
1356 : 0 : mpFrameView->SetSelectedPage((pActualPage->GetPageNum() - 1) / 2);
1357 : 0 : }
1358 : :
1359 : :
1360 : : /*************************************************************************
1361 : : |*
1362 : : |* Handle SfxRequests for the StatusBar
1363 : : |*
1364 : : \************************************************************************/
1365 : :
1366 : 0 : void OutlineViewShell::ExecStatusBar(SfxRequest&)
1367 : : {
1368 : 0 : }
1369 : :
1370 : : /*************************************************************************
1371 : : |*
1372 : : |* Return state values of the StatusBar
1373 : : |*
1374 : : \************************************************************************/
1375 : :
1376 : 0 : void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
1377 : : {
1378 : : // Zoom-Item
1379 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOM ) )
1380 : : {
1381 : : SvxZoomItem* pZoomItem;
1382 [ # # ][ # # ]: 0 : sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom();
1383 : :
1384 [ # # ][ # # ]: 0 : pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom );
1385 : :
1386 : : // limit area
1387 : 0 : sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
1388 : 0 : nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
1389 : 0 : nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
1390 : 0 : nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
1391 : :
1392 : 0 : pZoomItem->SetValueSet( nZoomValues );
1393 [ # # ]: 0 : rSet.Put( *pZoomItem );
1394 [ # # ][ # # ]: 0 : delete pZoomItem;
1395 : : }
1396 : :
1397 [ # # ][ # # ]: 0 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
1398 : : {
1399 [ # # ][ # # ]: 0 : if (GetDocSh()->IsUIActive() || !GetActiveWindow() )
[ # # ][ # # ]
[ # # ][ # # ]
1400 : : {
1401 [ # # ]: 0 : rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
1402 : : }
1403 : : else
1404 : : {
1405 [ # # ]: 0 : sd::Window * pActiveWindow = GetActiveWindow();
1406 [ # # ][ # # ]: 0 : SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ;
[ # # ][ # # ]
1407 [ # # ]: 0 : aZoomItem.AddSnappingPoint(100);
1408 [ # # ][ # # ]: 0 : rSet.Put( aZoomItem );
1409 : : }
1410 : : }
1411 : :
1412 : :
1413 : : // page view and layout
1414 : :
1415 [ # # ][ # # ]: 0 : sal_uInt16 nPageCount = GetDoc()->GetSdPageCount( PK_STANDARD );
1416 [ # # ][ # # ]: 0 : String aPageStr, aLayoutStr;
1417 : :
1418 [ # # ]: 0 : ::sd::Window* pWin = GetActiveWindow();
1419 [ # # ]: 0 : OutlinerView* pActiveView = pOlView->GetViewByWindow( pWin );
1420 : 0 : ::Outliner* pOutliner = pOlView->GetOutliner();
1421 : :
1422 [ # # ]: 0 : std::vector<Paragraph*> aSelList;
1423 [ # # ]: 0 : pActiveView->CreateSelectionList(aSelList);
1424 : :
1425 : 0 : Paragraph *pFirstPara = NULL;
1426 : 0 : Paragraph *pLastPara = NULL;
1427 : :
1428 [ # # ]: 0 : if (!aSelList.empty())
1429 : : {
1430 : 0 : pFirstPara = *(aSelList.begin());
1431 [ # # ]: 0 : pLastPara = *(aSelList.rbegin());
1432 : : }
1433 : :
1434 [ # # ][ # # ]: 0 : if( !pOutliner->HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) )
1435 [ # # ]: 0 : pFirstPara = pOlView->GetPrevTitle( pFirstPara );
1436 : :
1437 [ # # ][ # # ]: 0 : if( !pOutliner->HasParaFlag(pLastPara, PARAFLAG_ISPAGE) )
1438 [ # # ]: 0 : pLastPara = pOlView->GetPrevTitle( pLastPara );
1439 : :
1440 : : // only one page selected?
1441 [ # # ]: 0 : if( pFirstPara == pLastPara )
1442 : : {
1443 : : // how many pages are we before the selected page?
1444 : 0 : sal_uLong nPos = 0L;
1445 [ # # ]: 0 : while( pFirstPara )
1446 : : {
1447 [ # # ]: 0 : pFirstPara = pOlView->GetPrevTitle( pFirstPara );
1448 [ # # ]: 0 : if( pFirstPara )
1449 : 0 : nPos++;
1450 : : }
1451 : :
1452 [ # # ][ # # ]: 0 : if( nPos >= GetDoc()->GetSdPageCount( PK_STANDARD ) )
[ # # ]
1453 : 0 : nPos = 0;
1454 : :
1455 [ # # ][ # # ]: 0 : SdrPage* pPage = GetDoc()->GetSdPage( (sal_uInt16) nPos, PK_STANDARD );
1456 : :
1457 [ # # ][ # # ]: 0 : aPageStr = String(SdResId( STR_SD_PAGE ));
[ # # ][ # # ]
1458 [ # # ]: 0 : aPageStr += sal_Unicode(' ');
1459 [ # # ][ # # ]: 0 : aPageStr += String::CreateFromInt32( (sal_Int32)(nPos + 1) ); // sal_uLong -> sal_Int32
[ # # ]
1460 [ # # ]: 0 : aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
1461 [ # # ][ # # ]: 0 : aPageStr += String::CreateFromInt32( nPageCount );
[ # # ]
1462 : :
1463 [ # # ][ # # ]: 0 : aLayoutStr = pPage->GetLayoutName();
[ # # ]
1464 [ # # ][ # # ]: 0 : aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
1465 : : }
1466 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
[ # # ]
1467 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
[ # # ][ # # ]
[ # # ]
1468 : 0 : }
1469 : :
1470 : : /*************************************************************************
1471 : : |*
1472 : : |* Command event
1473 : : |*
1474 : : \************************************************************************/
1475 : :
1476 : 0 : void OutlineViewShell::Command( const CommandEvent& rCEvt, ::sd::Window* pWin )
1477 : : {
1478 [ # # ]: 0 : if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
1479 : : {
1480 [ # # ][ # # ]: 0 : GetActiveWindow()->ReleaseMouse();
1481 : :
1482 [ # # ][ # # ]: 0 : OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow());
1483 : 0 : Point aPos(rCEvt.GetMousePosPixel());
1484 : :
1485 [ # # ][ # # ]: 0 : if (pOLV && pOLV->IsWrongSpelledWordAtPos(aPos))
[ # # ][ # # ]
1486 : : {
1487 : : // Popup for Online-Spelling now handled by DrawDocShell
1488 [ # # ][ # # ]: 0 : Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback);
1489 : :
1490 [ # # ]: 0 : pOLV->ExecuteSpellPopup(aPos, &aLink);
1491 : : }
1492 : : else
1493 : : {
1494 [ # # ][ # # ]: 0 : GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(RID_OUTLINE_POPUP));
[ # # ]
1495 : : }
1496 : : }
1497 : : else
1498 : : {
1499 : 0 : ViewShell::Command( rCEvt, pWin );
1500 : :
1501 : : // if necessary communicate the new context to the Preview
1502 : 0 : Invalidate( SID_PREVIEW_STATE );
1503 : :
1504 : : }
1505 : 0 : }
1506 : :
1507 : :
1508 : : /*************************************************************************
1509 : : |*
1510 : : |* Keyboard event
1511 : : |*
1512 : : \************************************************************************/
1513 : :
1514 : 0 : sal_Bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
1515 : : {
1516 : 0 : sal_Bool bReturn = sal_False;
1517 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(pOlView);
1518 : :
1519 [ # # ][ # # ]: 0 : if (pWin == NULL && HasCurrentFunction())
[ # # ][ # # ]
1520 : : {
1521 [ # # ][ # # ]: 0 : bReturn = GetCurrentFunction()->KeyInput(rKEvt);
[ # # ]
1522 : : }
1523 : :
1524 : : // no, forward to base class
1525 : : else
1526 : : {
1527 [ # # ]: 0 : bReturn = ViewShell::KeyInput(rKEvt, pWin);
1528 : : }
1529 : :
1530 [ # # ]: 0 : Invalidate(SID_STYLE_EDIT);
1531 [ # # ]: 0 : Invalidate(SID_STYLE_NEW);
1532 [ # # ]: 0 : Invalidate(SID_STYLE_DELETE);
1533 [ # # ]: 0 : Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
1534 [ # # ]: 0 : Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
1535 [ # # ]: 0 : Invalidate(SID_STYLE_WATERCAN);
1536 [ # # ]: 0 : Invalidate(SID_STYLE_FAMILY5);
1537 : :
1538 : : // check and distinguish cursor movements- or input-keys
1539 : 0 : KeyCode aKeyGroup( rKEvt.GetKeyCode().GetGroup() );
1540 [ # # ][ # # ]: 0 : if( (aKeyGroup != KEYGROUP_CURSOR && aKeyGroup != KEYGROUP_FKEYS) ||
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ][ # # ]
1541 [ # # ]: 0 : (GetActualPage() != pLastPage) )
1542 : : {
1543 [ # # ]: 0 : Invalidate( SID_PREVIEW_STATE );
1544 : : }
1545 : :
1546 [ # # ]: 0 : return(bReturn);
1547 : : }
1548 : :
1549 : :
1550 : : /*************************************************************************
1551 : : |*
1552 : : |* Return optimal Size
1553 : : |*
1554 : : \************************************************************************/
1555 : :
1556 : 0 : Size OutlineViewShell::GetOptimalSizePixel() const
1557 : : {
1558 : 0 : Size aResult(200, 200);
1559 [ # # ]: 0 : if (pOlView)
1560 : : {
1561 : 0 : ::Outliner* pOutliner = pOlView->GetOutliner();
1562 [ # # ]: 0 : if (pOutliner)
1563 : : {
1564 [ # # ]: 0 : Size aTemp = pOutliner->CalcTextSize();
1565 [ # # ][ # # ]: 0 : aTemp = GetActiveWindow()->LogicToPixel(aTemp);
1566 : 0 : aResult.Width() = Max(aResult.Width(), aTemp.Width());
1567 : 0 : aResult.Height() = Max(aResult.Height(), aTemp.Height());
1568 [ # # ]: 0 : if (4 * aResult.Height() > 3 * aResult.Width())
1569 : : {
1570 : 0 : aResult.Height() = 3 * aResult.Width() / 4;
1571 : : }
1572 : : }
1573 : : }
1574 : :
1575 : : // now add the default stuff
1576 : 0 : aResult.Width() += mpVerticalScrollBar->GetSizePixel().Width();
1577 : 0 : aResult.Height() += mpHorizontalScrollBar->GetSizePixel().Height();
1578 : 0 : return aResult;
1579 : : }
1580 : :
1581 : :
1582 : : /*************************************************************************
1583 : : |*
1584 : : |* Return text of the selection
1585 : : |*
1586 : : \************************************************************************/
1587 : :
1588 : 0 : String OutlineViewShell::GetSelectionText(sal_Bool bCompleteWords)
1589 : : {
1590 : 0 : String aStrSelection;
1591 : 0 : ::Outliner* pOl = pOlView->GetOutliner();
1592 [ # # ][ # # ]: 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
1593 : :
1594 [ # # ][ # # ]: 0 : if (pOl && pOlView)
1595 : : {
1596 [ # # ]: 0 : if (bCompleteWords)
1597 : : {
1598 [ # # ]: 0 : ESelection aSel = pOutlinerView->GetSelection();
1599 [ # # ]: 0 : String aStrCurrentDelimiters = pOl->GetWordDelimiters();
1600 : :
1601 [ # # ][ # # ]: 0 : pOl->SetWordDelimiters( OUString( " .,;\"'" ) );
[ # # ]
1602 [ # # ][ # # ]: 0 : aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
[ # # ]
1603 [ # # ][ # # ]: 0 : pOl->SetWordDelimiters( aStrCurrentDelimiters );
1604 : : }
1605 : : else
1606 : : {
1607 [ # # ][ # # ]: 0 : aStrSelection = pOutlinerView->GetSelected();
[ # # ]
1608 : : }
1609 : : }
1610 : :
1611 : 0 : return (aStrSelection);
1612 : : }
1613 : :
1614 : :
1615 : : /*************************************************************************
1616 : : |*
1617 : : |* Is something selected?
1618 : : |*
1619 : : \************************************************************************/
1620 : :
1621 : 0 : sal_Bool OutlineViewShell::HasSelection(sal_Bool bText) const
1622 : : {
1623 : 0 : sal_Bool bReturn = sal_False;
1624 : :
1625 [ # # ]: 0 : if (bText)
1626 : : {
1627 : 0 : OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
1628 : :
1629 [ # # ][ # # ]: 0 : if (pOutlinerView && pOutlinerView->GetSelected().Len() != 0)
[ # # ]
[ # # # # ]
[ # # ]
1630 : : {
1631 : 0 : bReturn = sal_True;
1632 : : }
1633 : : }
1634 : :
1635 : 0 : return bReturn;
1636 : : }
1637 : :
1638 : :
1639 : : /*************************************************************************
1640 : : |*
1641 : : |* Status of Attribute-Items
1642 : : |*
1643 : : \************************************************************************/
1644 : :
1645 : 0 : void OutlineViewShell::GetAttrState( SfxItemSet& rSet )
1646 : : {
1647 [ # # ]: 0 : SfxWhichIter aIter( rSet );
1648 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
1649 [ # # ]: 0 : SfxAllItemSet aAllSet( *rSet.GetPool() );
1650 : :
1651 [ # # ]: 0 : while ( nWhich )
1652 : : {
1653 : 0 : sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
1654 : 0 : ? GetPool().GetSlotId(nWhich)
1655 [ # # # # ]: 0 : : nWhich;
1656 : :
1657 [ # # # # : 0 : switch ( nSlotId )
# # ]
1658 : : {
1659 : : case SID_STYLE_FAMILY2:
1660 : : case SID_STYLE_FAMILY3:
1661 : : {
1662 [ # # ]: 0 : rSet.DisableItem( nWhich );
1663 : : }
1664 : 0 : break;
1665 : :
1666 : : case SID_STYLE_FAMILY5:
1667 : : {
1668 [ # # ][ # # ]: 0 : SfxStyleSheet* pStyleSheet = pOlView->GetViewByWindow(GetActiveWindow())->GetStyleSheet();
[ # # ]
1669 : :
1670 [ # # ]: 0 : if( pStyleSheet )
1671 : : {
1672 [ # # ]: 0 : pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
1673 : :
1674 [ # # ]: 0 : if (pStyleSheet)
1675 : : {
1676 [ # # ][ # # ]: 0 : SfxTemplateItem aItem( nWhich, pStyleSheet->GetName() );
1677 [ # # ][ # # ]: 0 : aAllSet.Put( aItem, aItem.Which() );
1678 : : }
1679 : : }
1680 : :
1681 [ # # ]: 0 : if( !pStyleSheet )
1682 : : {
1683 [ # # ][ # # ]: 0 : SfxTemplateItem aItem( nWhich, String() );
[ # # ]
1684 [ # # ][ # # ]: 0 : aAllSet.Put( aItem, aItem.Which() );
1685 : : // rSet.DisableItem( nWhich );
1686 : : }
1687 : : }
1688 : 0 : break;
1689 : :
1690 : : case SID_STYLE_EDIT:
1691 : : {
1692 [ # # ][ # # ]: 0 : ISfxTemplateCommon* pTmplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
[ # # ]
1693 : :
1694 [ # # ][ # # ]: 0 : if (pTmplCommon && pTmplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
[ # # ][ # # ]
1695 : : {
1696 [ # # ]: 0 : SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
1697 [ # # ]: 0 : GetStatusBarState(aSet);
1698 [ # # ][ # # ]: 0 : String aRealStyle(((SfxStringItem&) aSet.Get(SID_STATUS_LAYOUT)).GetValue());
1699 : :
1700 [ # # ]: 0 : if (!aRealStyle.Len())
1701 : : {
1702 : : // no unique layout name found
1703 [ # # ]: 0 : rSet.DisableItem(nWhich);
1704 [ # # ][ # # ]: 0 : }
1705 : : }
1706 : : }
1707 : 0 : break;
1708 : :
1709 : : case SID_STYLE_UPDATE_BY_EXAMPLE:
1710 : : {
1711 [ # # ]: 0 : ::sd::Window* pActWin = GetActiveWindow();
1712 [ # # ]: 0 : OutlinerView* pOV = pOlView->GetViewByWindow(pActWin);
1713 [ # # ]: 0 : ESelection aESel(pOV->GetSelection());
1714 : :
1715 [ # # ][ # # ]: 0 : if (aESel.nStartPara != aESel.nEndPara ||
1716 : : aESel.nStartPos != aESel.nEndPos)
1717 : : // spanned selection, i.e. StyleSheet and/or
1718 : : // attribution not necessarily unqiue
1719 [ # # ]: 0 : rSet.DisableItem(nWhich);
1720 : : }
1721 : 0 : break;
1722 : :
1723 : : case SID_STYLE_NEW:
1724 : : case SID_STYLE_DELETE:
1725 : : case SID_STYLE_NEW_BY_EXAMPLE:
1726 : : case SID_STYLE_WATERCAN:
1727 : : {
1728 [ # # ]: 0 : rSet.DisableItem(nWhich);
1729 : : }
1730 : 0 : break;
1731 : : }
1732 : :
1733 [ # # ]: 0 : nWhich = aIter.NextWhich();
1734 : : }
1735 : :
1736 [ # # ][ # # ]: 0 : rSet.Put( aAllSet, sal_False );
[ # # ]
1737 : 0 : }
1738 : :
1739 : :
1740 : :
1741 : : /*************************************************************************
1742 : : |*
1743 : : |* MouseButtonUp event
1744 : : |*
1745 : : \************************************************************************/
1746 : :
1747 : 0 : void OutlineViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
1748 : : {
1749 : : // first the base classes
1750 : 0 : ViewShell::MouseButtonUp(rMEvt, pWin);
1751 : :
1752 : 0 : Invalidate(SID_STYLE_EDIT);
1753 : 0 : Invalidate(SID_STYLE_NEW);
1754 : 0 : Invalidate(SID_STYLE_DELETE);
1755 : 0 : Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
1756 : 0 : Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
1757 : 0 : Invalidate(SID_STYLE_WATERCAN);
1758 : 0 : Invalidate(SID_STYLE_FAMILY5);
1759 : :
1760 : : // if necessary communicate the new context to the Preview
1761 [ # # ]: 0 : if( GetActualPage() != pLastPage )
1762 : 0 : Invalidate( SID_PREVIEW_STATE );
1763 : 0 : }
1764 : :
1765 : :
1766 : :
1767 : 0 : SdPage* OutlineViewShell::getCurrentPage() const
1768 : : {
1769 : : // since there are no master pages in outline view, we can
1770 : : // for now use the GetActualPage method
1771 : 0 : return const_cast<OutlineViewShell*>(this)->GetActualPage();
1772 : : }
1773 : :
1774 : : /*************************************************************************
1775 : : |*
1776 : : |* Returns the first selected page.
1777 : : |* If nothing is selected, the first page is returned.
1778 : : |*
1779 : : \************************************************************************/
1780 : 0 : SdPage* OutlineViewShell::GetActualPage()
1781 : : {
1782 : 0 : return pOlView->GetActualPage();
1783 : : }
1784 : :
1785 : 0 : void OutlineViewShell::UpdatePreview( SdPage* pPage, sal_Bool )
1786 : : {
1787 : 0 : const bool bNewPage = pPage != pLastPage;
1788 : 0 : pLastPage = pPage;
1789 [ # # ]: 0 : if (bNewPage)
1790 : : {
1791 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard(pOlView);
1792 [ # # ][ # # ]: 0 : SetCurrentPage(pPage);
1793 : : }
1794 : 0 : }
1795 : :
1796 : : /*************************************************************************
1797 : : |*
1798 : : |* Update Title
1799 : : |*
1800 : : \************************************************************************/
1801 : :
1802 : 0 : bool OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph* pPara )
1803 : : {
1804 : : DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateTitleObject(), pPage == 0?" );
1805 : : DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateTitleObject(), pPara == 0?" );
1806 : :
1807 [ # # ][ # # ]: 0 : if( !pPage || !pPara )
1808 : 0 : return false;
1809 : :
1810 : 0 : ::Outliner* pOutliner = pOlView->GetOutliner();
1811 [ # # ]: 0 : SdrTextObj* pTO = pOlView->GetTitleTextObject( pPage );
1812 : 0 : OutlinerParaObject* pOPO = NULL;
1813 : :
1814 [ # # ]: 0 : String aTest( pOutliner->GetText( pPara ) );
1815 : 0 : bool bText = aTest.Len() > 0;
1816 : 0 : bool bNewObject = false;
1817 : :
1818 [ # # ]: 0 : if( bText )
1819 : : {
1820 : : // create a title object if we don't have one but have text
1821 [ # # ]: 0 : if( !pTO )
1822 : : {
1823 : : DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1824 [ # # ]: 0 : pTO = pOlView->CreateTitleTextObject(pPage);
1825 : 0 : bNewObject = sal_True;
1826 : : }
1827 : :
1828 : : // if we have a title object and a text, set the text
1829 [ # # ]: 0 : if( pTO )
1830 : : {
1831 [ # # ][ # # ]: 0 : pOPO = pOutliner->CreateParaObject( (sal_uInt16) pOutliner->GetAbsPos( pPara ), 1 );
1832 [ # # ]: 0 : pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT );
1833 [ # # ][ # # ]: 0 : pOPO->SetVertical( pTO->IsVerticalWriting() );
1834 [ # # ][ # # ]: 0 : if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1835 : : {
1836 : : // do nothing, same text already set
1837 [ # # ][ # # ]: 0 : delete pOPO;
1838 : : }
1839 : : else
1840 : : {
1841 : : DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1842 [ # # ][ # # ]: 0 : if( !bNewObject && pOlView->isRecordingUndo() )
[ # # ][ # # ]
1843 [ # # ][ # # ]: 0 : pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
[ # # ][ # # ]
1844 : :
1845 [ # # ]: 0 : pTO->SetOutlinerParaObject( pOPO );
1846 [ # # ]: 0 : pTO->SetEmptyPresObj( sal_False );
1847 [ # # ]: 0 : pTO->ActionChanged();
1848 : : }
1849 : : }
1850 : : }
1851 [ # # ]: 0 : else if( pTO )
1852 : : {
1853 : : // no text but object available?
1854 : : // outline object available, but we have no text
1855 [ # # ][ # # ]: 0 : if(pPage->IsPresObj(pTO))
1856 : : {
1857 : : // if it is not already empty
1858 [ # # ][ # # ]: 0 : if( !pTO->IsEmptyPresObj() )
1859 : : {
1860 : : DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1861 : :
1862 : : // make it empty
1863 [ # # ][ # # ]: 0 : if( pOlView->isRecordingUndo() )
1864 [ # # ][ # # ]: 0 : pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
[ # # ][ # # ]
1865 [ # # ]: 0 : pPage->RestoreDefaultText( pTO );
1866 [ # # ]: 0 : pTO->SetEmptyPresObj(sal_True);
1867 [ # # ]: 0 : pTO->ActionChanged();
1868 : : }
1869 : : }
1870 : : else
1871 : : {
1872 : : DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1873 : : // outline object is not part of the layout, delete it
1874 [ # # ][ # # ]: 0 : if( pOlView->isRecordingUndo() )
1875 [ # # ][ # # ]: 0 : pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO));
[ # # ][ # # ]
1876 [ # # ][ # # ]: 0 : pPage->RemoveObject(pTO->GetOrdNum());
1877 : : }
1878 : : }
1879 : :
1880 [ # # ]: 0 : return bNewObject;
1881 : : }
1882 : :
1883 : : /*************************************************************************
1884 : : |*
1885 : : |* Update LayoutObject
1886 : : |*
1887 : : \************************************************************************/
1888 : :
1889 : 0 : bool OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara )
1890 : : {
1891 : : DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateOutlineObject(), pPage == 0?" );
1892 : : DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateOutlineObject(), pPara == 0?" );
1893 : :
1894 [ # # ][ # # ]: 0 : if( !pPage || !pPara )
1895 : 0 : return false;
1896 : :
1897 : 0 : ::Outliner* pOutliner = pOlView->GetOutliner();
1898 : 0 : OutlinerParaObject* pOPO = NULL;
1899 : 0 : SdrTextObj* pTO = NULL;
1900 : :
1901 : 0 : sal_Bool bNewObject = sal_False;
1902 : :
1903 : 0 : sal_uInt16 eOutlinerMode = OUTLINERMODE_TITLEOBJECT;
1904 : 0 : pTO = (SdrTextObj*)pPage->GetPresObj( PRESOBJ_TEXT );
1905 [ # # ]: 0 : if( !pTO )
1906 : : {
1907 : 0 : eOutlinerMode = OUTLINERMODE_OUTLINEOBJECT;
1908 : 0 : pTO = pOlView->GetOutlineTextObject( pPage );
1909 : : }
1910 : :
1911 : : // how many paragraphs in the outline?
1912 : 0 : sal_uLong nTitlePara = pOutliner->GetAbsPos( pPara );
1913 : 0 : sal_uLong nPara = nTitlePara + 1;
1914 : 0 : sal_uLong nParasInLayout = 0L;
1915 : 0 : pPara = pOutliner->GetParagraph( nPara );
1916 [ # # ][ # # ]: 0 : while( pPara && !pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
[ # # ]
1917 : : {
1918 : 0 : nParasInLayout++;
1919 : 0 : pPara = pOutliner->GetParagraph( ++nPara );
1920 : : }
1921 [ # # ]: 0 : if( nParasInLayout )
1922 : : {
1923 : : // create an OutlinerParaObject
1924 : 0 : pPara = pOutliner->GetParagraph( nTitlePara + 1 );
1925 : 0 : pOPO = pOutliner->CreateParaObject( (sal_uInt16) nTitlePara + 1, (sal_uInt16) nParasInLayout );
1926 : : }
1927 : :
1928 [ # # ]: 0 : if( pOPO )
1929 : : {
1930 : : DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
1931 : :
1932 : : // do we need an outline text object?
1933 [ # # ]: 0 : if( !pTO )
1934 : : {
1935 : 0 : pTO = pOlView->CreateOutlineTextObject( pPage );
1936 : 0 : bNewObject = sal_True;
1937 : : }
1938 : :
1939 : : // page object, outline text in Outliner:
1940 : : // apply text
1941 [ # # ]: 0 : if( pTO )
1942 : : {
1943 : 0 : pOPO->SetVertical( pTO->IsVerticalWriting() );
1944 : 0 : pOPO->SetOutlinerMode( eOutlinerMode );
1945 [ # # ][ # # ]: 0 : if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
[ # # ]
1946 : : {
1947 : : // do nothing, same text already set
1948 [ # # ]: 0 : delete pOPO;
1949 : : }
1950 : : else
1951 : : {
1952 [ # # ][ # # ]: 0 : if( !bNewObject && pOlView->isRecordingUndo() )
[ # # ]
1953 : 0 : pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
1954 : :
1955 : 0 : pTO->SetOutlinerParaObject( pOPO );
1956 : 0 : pTO->SetEmptyPresObj( sal_False );
1957 : 0 : pTO->ActionChanged();
1958 : : }
1959 : : }
1960 : : }
1961 [ # # ]: 0 : else if( pTO )
1962 : : {
1963 : : // page object but no outline text:
1964 : : // if the object is in the outline of the page -> default text
1965 : :
1966 : : // otherwise delete object
1967 [ # # ]: 0 : if( pPage->IsPresObj(pTO) )
1968 : : {
1969 [ # # ]: 0 : if( !pTO->IsEmptyPresObj() )
1970 : : {
1971 : : DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
1972 : :
1973 : : // delete old OutlinerParaObject, too
1974 [ # # ]: 0 : if( pOlView->isRecordingUndo() )
1975 : 0 : pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
1976 : 0 : pPage->RestoreDefaultText( pTO );
1977 : 0 : pTO->SetEmptyPresObj(sal_True);
1978 : 0 : pTO->ActionChanged();
1979 : : }
1980 : : }
1981 : : else
1982 : : {
1983 : : DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
1984 [ # # ]: 0 : if( pOlView->isRecordingUndo() )
1985 : 0 : pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO));
1986 : 0 : pPage->RemoveObject(pTO->GetOrdNum());
1987 : : }
1988 : : }
1989 : :
1990 : 0 : return bNewObject;
1991 : : }
1992 : :
1993 : :
1994 : : /*************************************************************************
1995 : : |*
1996 : : |* Fill Outliner from Stream
1997 : : |*
1998 : : \************************************************************************/
1999 : :
2000 : 0 : sal_uLong OutlineViewShell::Read(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
2001 : : {
2002 : 0 : sal_uLong bRet = 0;
2003 : :
2004 : 0 : ::Outliner* pOutl = pOlView->GetOutliner();
2005 : :
2006 : : {
2007 [ # # ]: 0 : OutlineViewPageChangesGuard aGuard( pOlView );
2008 [ # # ]: 0 : OutlineViewModelChangeGuard aGuard2( *pOlView );
2009 : :
2010 [ # # ][ # # ]: 0 : bRet = pOutl->Read( rInput, rBaseURL, eFormat, GetDocSh()->GetHeaderAttributes() );
[ # # ]
2011 : :
2012 [ # # ][ # # ]: 0 : SdPage* pPage = GetDoc()->GetSdPage( GetDoc()->GetSdPageCount(PK_STANDARD) - 1, PK_STANDARD );;
[ # # ][ # # ]
2013 [ # # ]: 0 : SfxStyleSheet* pTitleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2014 [ # # ]: 0 : SfxStyleSheet* pOutlSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
2015 : :
2016 [ # # ]: 0 : sal_uInt16 nParaCount = (sal_uInt16)pOutl->GetParagraphCount();
2017 [ # # ]: 0 : if ( nParaCount > 0 )
2018 : : {
2019 [ # # ]: 0 : for ( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
2020 : : {
2021 [ # # ]: 0 : pOlView->UpdateParagraph( nPara );
2022 : :
2023 [ # # ]: 0 : sal_Int16 nDepth = pOutl->GetDepth( nPara );
2024 : :
2025 [ # # ][ # # ]: 0 : if( (nDepth == 0) || !nPara )
2026 : : {
2027 [ # # ]: 0 : Paragraph* pPara = pOutl->GetParagraph( nPara );
2028 [ # # ]: 0 : pOutl->SetDepth(pPara, -1);
2029 [ # # ]: 0 : pOutl->SetParaFlag(pPara, PARAFLAG_ISPAGE);
2030 : :
2031 [ # # ]: 0 : pOutl->SetStyleSheet( nPara, pTitleSheet );
2032 : :
2033 [ # # ]: 0 : if( nPara ) // first slide already exists
2034 [ # # ]: 0 : pOlView->InsertSlideForParagraph( pPara );
2035 : : }
2036 : : else
2037 : : {
2038 [ # # ][ # # ]: 0 : pOutl->SetDepth( pOutl->GetParagraph( nPara ), nDepth - 1 );
2039 [ # # ][ # # ]: 0 : String aStyleSheetName( pOutlSheet->GetName() );
2040 [ # # ]: 0 : aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
2041 [ # # ][ # # ]: 0 : aStyleSheetName += String::CreateFromInt32( nDepth );
[ # # ]
2042 [ # # ][ # # ]: 0 : SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
2043 [ # # ]: 0 : SfxStyleSheet* pStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pOutlSheet->GetFamily() );
2044 : : DBG_ASSERT( pStyle, "AutoStyleSheetName - Style not found!" );
2045 [ # # ]: 0 : if ( pStyle )
2046 [ # # ][ # # ]: 0 : pOutl->SetStyleSheet( nPara, pStyle );
2047 : : }
2048 : : }
2049 [ # # ][ # # ]: 0 : }
2050 : : }
2051 : :
2052 : 0 : pOutl->GetUndoManager().Clear();
2053 : :
2054 : 0 : return( bRet );
2055 : : }
2056 : :
2057 : 0 : void OutlineViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
2058 : : {
2059 : 0 : WriteFrameViewData();
2060 : :
2061 : 0 : ViewShell::WriteUserDataSequence( rSequence, bBrowse );
2062 : 0 : }
2063 : :
2064 : 0 : void OutlineViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
2065 : : {
2066 : 0 : WriteFrameViewData();
2067 : :
2068 : 0 : ViewShell::ReadUserDataSequence( rSequence, bBrowse );
2069 : :
2070 : 0 : ReadFrameViewData( mpFrameView );
2071 : 0 : }
2072 : :
2073 : 0 : void OutlineViewShell::VisAreaChanged(const Rectangle& rRect)
2074 : : {
2075 : 0 : ViewShell::VisAreaChanged( rRect );
2076 : :
2077 : 0 : GetViewShellBase().GetDrawController().FireVisAreaChanged(rRect);
2078 : 0 : }
2079 : :
2080 : : /** If there is a valid controller then create a new instance of
2081 : : <type>AccessibleDrawDocumentView</type>. Otherwise return an empty
2082 : : reference.
2083 : : */
2084 : : ::com::sun::star::uno::Reference<
2085 : : ::com::sun::star::accessibility::XAccessible>
2086 : 0 : OutlineViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
2087 : : {
2088 : : OSL_ASSERT (GetViewShell()!=NULL);
2089 [ # # ][ # # ]: 0 : if (GetViewShell()->GetController() != NULL)
2090 : : {
2091 : : ::accessibility::AccessibleOutlineView* pDocumentView =
2092 : : new ::accessibility::AccessibleOutlineView (
2093 : : pWindow,
2094 : : this,
2095 : : GetViewShell()->GetController(),
2096 [ # # ][ # # ]: 0 : pWindow->GetAccessibleParentWindow()->GetAccessible());
[ # # ]
2097 : 0 : pDocumentView->Init();
2098 : : return ::com::sun::star::uno::Reference<
2099 : : ::com::sun::star::accessibility::XAccessible>
2100 : : (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
2101 : 0 : ::com::sun::star::uno::UNO_QUERY);
2102 : : }
2103 : :
2104 : : OSL_TRACE ("OutlineViewShell::CreateAccessibleDocumentView: no controller");
2105 : 0 : return ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >();
2106 : : }
2107 : :
2108 : :
2109 : :
2110 : :
2111 : 0 : void OutlineViewShell::GetState (SfxItemSet& rSet)
2112 : : {
2113 : : // Iterate over all requested items in the set.
2114 [ # # ]: 0 : SfxWhichIter aIter( rSet );
2115 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
2116 [ # # ]: 0 : while (nWhich)
2117 : : {
2118 [ # # ]: 0 : switch (nWhich)
2119 : : {
2120 : : case SID_SEARCH_ITEM:
2121 : : case SID_SEARCH_OPTIONS:
2122 : : // Call common (old) implementation in the document shell.
2123 [ # # ][ # # ]: 0 : GetDocSh()->GetState (rSet);
2124 : 0 : break;
2125 : : default:
2126 : : OSL_TRACE ("OutlineViewShell::GetState(): can not handle which id %d", nWhich);
2127 : 0 : break;
2128 : : }
2129 [ # # ]: 0 : nWhich = aIter.NextWhich();
2130 [ # # ]: 0 : }
2131 : 0 : }
2132 : :
2133 : :
2134 : :
2135 : :
2136 : 0 : void OutlineViewShell::SetCurrentPage (SdPage* pPage)
2137 : : {
2138 : : // Adapt the selection of the model.
2139 [ # # ]: 0 : for (sal_uInt16 i=0; i<GetDoc()->GetSdPageCount(PK_STANDARD); i++)
2140 : : GetDoc()->SetSelected(
2141 : : GetDoc()->GetSdPage(i, PK_STANDARD),
2142 : 0 : sal_False);
2143 : 0 : GetDoc()->SetSelected (pPage, sal_True);
2144 : :
2145 : 0 : DrawController& rController(GetViewShellBase().GetDrawController());
2146 : 0 : rController.FireSelectionChangeListener();
2147 : 0 : rController.FireSwitchCurrentPage (pPage);
2148 : :
2149 : 0 : pOlView->SetActualPage(pPage);
2150 : 0 : }
2151 : :
2152 : :
2153 : : } // end of namespace sd
2154 : :
2155 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|