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