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