15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 55b190011SAndrew Rist * distributed with this work for additional information 65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 85b190011SAndrew Rist * "License"); you may not use this file except in compliance 95b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 145b190011SAndrew Rist * software distributed under the License is distributed on an 155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165b190011SAndrew Rist * KIND, either express or implied. See the License for the 175b190011SAndrew Rist * specific language governing permissions and limitations 185b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 205b190011SAndrew Rist *************************************************************/ 215b190011SAndrew Rist 225b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "DrawViewShell.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "ViewShellHint.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 32cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 33cdf0e10cSrcweir #endif 34cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 35cdf0e10cSrcweir #ifndef _SVXIDS_HXX 36cdf0e10cSrcweir #include <svx/svxids.hrc> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #include <vcl/msgbox.hxx> 39cdf0e10cSrcweir #include <svx/svddef.hxx> 40cdf0e10cSrcweir #include <sfx2/bindings.hxx> 41cdf0e10cSrcweir #include <sfx2/request.hxx> 42cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 43cdf0e10cSrcweir #include <svx/svdograf.hxx> 44cdf0e10cSrcweir #include <svx/svdpagv.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include "app.hrc" 47cdf0e10cSrcweir #include "strings.hrc" 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "misc.hxx" 50cdf0e10cSrcweir #include "fuzoom.hxx" 51cdf0e10cSrcweir #include "fudspord.hxx" 52cdf0e10cSrcweir #include "futransf.hxx" 53cdf0e10cSrcweir #include "fuline.hxx" 54cdf0e10cSrcweir #include "fuarea.hxx" 55cdf0e10cSrcweir #include "fuchar.hxx" 56cdf0e10cSrcweir #include "fuparagr.hxx" 57cdf0e10cSrcweir #include "fubullet.hxx" 58cdf0e10cSrcweir #include "futempl.hxx" 59cdf0e10cSrcweir #include "fuinsert.hxx" 60cdf0e10cSrcweir #include "fuprlout.hxx" 61cdf0e10cSrcweir #include "fupage.hxx" 62cdf0e10cSrcweir #ifndef SD_FU_OBJECT_ANIMATION_PARAMETERS_HXX 63cdf0e10cSrcweir #include "fuoaprms.hxx" 64cdf0e10cSrcweir #endif 65cdf0e10cSrcweir #include "fucopy.hxx" 66cdf0e10cSrcweir #ifndef SD_FU_LINE_END_HXX 67cdf0e10cSrcweir #include "fulinend.hxx" 68cdf0e10cSrcweir #endif 69cdf0e10cSrcweir #include "fusnapln.hxx" 70cdf0e10cSrcweir #include "fuolbull.hxx" 71cdf0e10cSrcweir #include "fuinsfil.hxx" 72cdf0e10cSrcweir #include "fulink.hxx" 73cdf0e10cSrcweir #include "futhes.hxx" 74cdf0e10cSrcweir #include "futxtatt.hxx" 75cdf0e10cSrcweir #include "fumeasur.hxx" 76cdf0e10cSrcweir #include "fuconnct.hxx" 77cdf0e10cSrcweir #include "fumorph.hxx" 78cdf0e10cSrcweir #include "fuvect.hxx" 79cdf0e10cSrcweir #include "sdresid.hxx" 80cdf0e10cSrcweir #include "Window.hxx" 81cdf0e10cSrcweir #include "drawview.hxx" 82cdf0e10cSrcweir #include "zoomlist.hxx" 83cdf0e10cSrcweir #include <vos/mutex.hxx> 84cdf0e10cSrcweir #include <vcl/salbtype.hxx> // FRound 85cdf0e10cSrcweir #include <vcl/svapp.hxx> 86cdf0e10cSrcweir 87cdf0e10cSrcweir namespace sd { 88cdf0e10cSrcweir 89cdf0e10cSrcweir /************************************************************************* 90cdf0e10cSrcweir |* 91cdf0e10cSrcweir |* SfxRequests fuer temporaere Funktionen 92cdf0e10cSrcweir |* 93cdf0e10cSrcweir \************************************************************************/ 94cdf0e10cSrcweir 95cdf0e10cSrcweir void DrawViewShell::FuTemp01(SfxRequest& rReq) 96cdf0e10cSrcweir { 97cdf0e10cSrcweir switch(rReq.GetSlot()) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir case SID_ATTRIBUTES_LINE: // BASIC 100cdf0e10cSrcweir { 101cdf0e10cSrcweir SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 102cdf0e10cSrcweir Cancel(); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir break; 105cdf0e10cSrcweir 106cdf0e10cSrcweir case SID_ATTRIBUTES_AREA: // BASIC 107cdf0e10cSrcweir { 108cdf0e10cSrcweir SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 109cdf0e10cSrcweir Cancel(); 110cdf0e10cSrcweir } 111cdf0e10cSrcweir break; 112cdf0e10cSrcweir 113cdf0e10cSrcweir case SID_ATTR_TRANSFORM: 114cdf0e10cSrcweir { 115cdf0e10cSrcweir SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 116cdf0e10cSrcweir Invalidate(SID_RULER_OBJECT); 117cdf0e10cSrcweir Cancel(); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir break; 120cdf0e10cSrcweir 121*c55fa23cSZheng Fan case SID_CHAR_DLG_EFFECT: 122cdf0e10cSrcweir case SID_CHAR_DLG: // BASIC 123cdf0e10cSrcweir { 124cdf0e10cSrcweir SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 125cdf0e10cSrcweir Cancel(); 126cdf0e10cSrcweir } 127cdf0e10cSrcweir break; 128cdf0e10cSrcweir 129cdf0e10cSrcweir case SID_PARA_DLG: 130cdf0e10cSrcweir { 131cdf0e10cSrcweir SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 132cdf0e10cSrcweir Cancel(); 133cdf0e10cSrcweir } 134cdf0e10cSrcweir break; 135cdf0e10cSrcweir 136cdf0e10cSrcweir case SID_OUTLINE_BULLET: 137cdf0e10cSrcweir { 138cdf0e10cSrcweir SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 139cdf0e10cSrcweir Cancel(); 140cdf0e10cSrcweir } 141cdf0e10cSrcweir break; 142cdf0e10cSrcweir 143cdf0e10cSrcweir case FN_INSERT_SOFT_HYPHEN: 144cdf0e10cSrcweir case FN_INSERT_HARDHYPHEN: 145cdf0e10cSrcweir case FN_INSERT_HARD_SPACE: 146cdf0e10cSrcweir case SID_INSERT_RLM : 147cdf0e10cSrcweir case SID_INSERT_LRM : 148cdf0e10cSrcweir case SID_INSERT_ZWNBSP : 149cdf0e10cSrcweir case SID_INSERT_ZWSP: 150cdf0e10cSrcweir case SID_CHARMAP: 151cdf0e10cSrcweir { 152cdf0e10cSrcweir SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 153cdf0e10cSrcweir Cancel(); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir break; 156cdf0e10cSrcweir 157cdf0e10cSrcweir case SID_PRESENTATION_LAYOUT: 158cdf0e10cSrcweir { 159cdf0e10cSrcweir SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); 160cdf0e10cSrcweir Cancel(); 161cdf0e10cSrcweir } 162cdf0e10cSrcweir break; 163cdf0e10cSrcweir 164cdf0e10cSrcweir case SID_PASTE_SPECIAL: 165cdf0e10cSrcweir { 166cdf0e10cSrcweir SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 167cdf0e10cSrcweir Cancel(); 168cdf0e10cSrcweir rReq.Ignore (); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir break; 171cdf0e10cSrcweir 172cdf0e10cSrcweir case SID_INSERT_GRAPHIC: 173cdf0e10cSrcweir { 174cdf0e10cSrcweir SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 175cdf0e10cSrcweir Cancel(); 176cdf0e10cSrcweir rReq.Ignore (); 177cdf0e10cSrcweir Invalidate(SID_DRAWTBX_INSERT); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir break; 180cdf0e10cSrcweir 181cdf0e10cSrcweir case SID_INSERT_AVMEDIA: 182cdf0e10cSrcweir { 183cdf0e10cSrcweir SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 184cdf0e10cSrcweir 185cdf0e10cSrcweir Cancel(); 186cdf0e10cSrcweir rReq.Ignore (); 187cdf0e10cSrcweir 188cdf0e10cSrcweir Invalidate(SID_DRAWTBX_INSERT); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir break; 191cdf0e10cSrcweir 192cdf0e10cSrcweir case SID_INSERT_OBJECT: 193cdf0e10cSrcweir case SID_INSERT_PLUGIN: 194cdf0e10cSrcweir case SID_INSERT_SOUND: 195cdf0e10cSrcweir case SID_INSERT_VIDEO: 196cdf0e10cSrcweir case SID_INSERT_FLOATINGFRAME: 197cdf0e10cSrcweir case SID_INSERT_MATH: 198cdf0e10cSrcweir case SID_INSERT_DIAGRAM: 199cdf0e10cSrcweir case SID_ATTR_TABLE: 200cdf0e10cSrcweir { 201cdf0e10cSrcweir SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 202cdf0e10cSrcweir 203cdf0e10cSrcweir Cancel(); 204cdf0e10cSrcweir rReq.Ignore (); 205cdf0e10cSrcweir 206cdf0e10cSrcweir Invalidate(SID_DRAWTBX_INSERT); 207cdf0e10cSrcweir } 208cdf0e10cSrcweir break; 209cdf0e10cSrcweir 210cdf0e10cSrcweir case SID_COPYOBJECTS: 211cdf0e10cSrcweir { 212cdf0e10cSrcweir if ( mpDrawView->IsPresObjSelected(sal_False, sal_True) ) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir ::sd::Window* pWindow = GetActiveWindow(); 215cdf0e10cSrcweir InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute(); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir else 218cdf0e10cSrcweir { 219cdf0e10cSrcweir if ( mpDrawView->IsTextEdit() ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir mpDrawView->SdrEndTextEdit(); 222cdf0e10cSrcweir } 223cdf0e10cSrcweir 224cdf0e10cSrcweir SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir Cancel(); 227cdf0e10cSrcweir rReq.Ignore (); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir break; 230cdf0e10cSrcweir 231cdf0e10cSrcweir case SID_INSERTFILE: // BASIC 232cdf0e10cSrcweir { 233cdf0e10cSrcweir Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START)); 234cdf0e10cSrcweir SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 235cdf0e10cSrcweir Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END)); 236cdf0e10cSrcweir Cancel(); 237cdf0e10cSrcweir rReq.Done (); 238cdf0e10cSrcweir 239cdf0e10cSrcweir Invalidate(SID_DRAWTBX_INSERT); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir break; 242cdf0e10cSrcweir 243cdf0e10cSrcweir case SID_SELECT_BACKGROUND: 244cdf0e10cSrcweir case SID_PAGESETUP: // BASIC ?? 245cdf0e10cSrcweir { 246cdf0e10cSrcweir SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 247cdf0e10cSrcweir Cancel(); 248cdf0e10cSrcweir rReq.Ignore (); // es werden eigenstaendige macros generiert !! 249cdf0e10cSrcweir } 250cdf0e10cSrcweir break; 251cdf0e10cSrcweir 252cdf0e10cSrcweir case SID_ZOOM_OUT: 253cdf0e10cSrcweir case SID_ZOOM_PANNING: 254cdf0e10cSrcweir { 255cdf0e10cSrcweir mbZoomOnPage = sal_False; 256cdf0e10cSrcweir SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); 257cdf0e10cSrcweir // Beendet sich selbst, kein Cancel() notwendig! 258cdf0e10cSrcweir Invalidate( SID_ZOOM_TOOLBOX ); 259cdf0e10cSrcweir rReq.Ignore (); 260cdf0e10cSrcweir } 261cdf0e10cSrcweir break; 262cdf0e10cSrcweir 263cdf0e10cSrcweir case SID_BEFORE_OBJ: 264cdf0e10cSrcweir case SID_BEHIND_OBJ: 265cdf0e10cSrcweir { 266cdf0e10cSrcweir SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); 267cdf0e10cSrcweir Invalidate( SID_POSITION ); 268cdf0e10cSrcweir rReq.Ignore (); 269cdf0e10cSrcweir // Beendet sich selbst, kein Cancel() notwendig! 270cdf0e10cSrcweir } 271cdf0e10cSrcweir break; 272cdf0e10cSrcweir 273cdf0e10cSrcweir case SID_REVERSE_ORDER: // BASIC 274cdf0e10cSrcweir { 275cdf0e10cSrcweir mpDrawView->ReverseOrderOfMarked(); 276cdf0e10cSrcweir Invalidate( SID_POSITION ); 277cdf0e10cSrcweir Cancel(); 278cdf0e10cSrcweir rReq.Done (); 279cdf0e10cSrcweir } 280cdf0e10cSrcweir break; 281cdf0e10cSrcweir 282cdf0e10cSrcweir case SID_ANIMATION_EFFECTS: 283cdf0e10cSrcweir { 284cdf0e10cSrcweir SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); 285cdf0e10cSrcweir Cancel(); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir break; 288cdf0e10cSrcweir 289cdf0e10cSrcweir case SID_LINEEND_POLYGON: 290cdf0e10cSrcweir { 291cdf0e10cSrcweir SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 292cdf0e10cSrcweir Cancel(); 293cdf0e10cSrcweir } 294cdf0e10cSrcweir break; 295cdf0e10cSrcweir 296cdf0e10cSrcweir case SID_CAPTUREPOINT: 297cdf0e10cSrcweir // negative Werte um Aufruf aus Menue zu signalisieren 298cdf0e10cSrcweir maMousePos = Point(-1,-1); 299cdf0e10cSrcweir case SID_SET_SNAPITEM: 300cdf0e10cSrcweir { 301cdf0e10cSrcweir SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) ); 302cdf0e10cSrcweir Cancel(); 303cdf0e10cSrcweir } 304cdf0e10cSrcweir break; 305cdf0e10cSrcweir 306cdf0e10cSrcweir case SID_MANAGE_LINKS: 307cdf0e10cSrcweir { 308cdf0e10cSrcweir SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 309cdf0e10cSrcweir Cancel(); 310cdf0e10cSrcweir rReq.Ignore (); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir break; 313cdf0e10cSrcweir 314cdf0e10cSrcweir case SID_THESAURUS: 315cdf0e10cSrcweir { 316cdf0e10cSrcweir SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 317cdf0e10cSrcweir Cancel(); 318cdf0e10cSrcweir rReq.Ignore (); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir break; 321cdf0e10cSrcweir 322cdf0e10cSrcweir case SID_TEXTATTR_DLG: 323cdf0e10cSrcweir { 324cdf0e10cSrcweir SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 325cdf0e10cSrcweir Cancel(); 326cdf0e10cSrcweir rReq.Ignore (); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir break; 329cdf0e10cSrcweir 330cdf0e10cSrcweir case SID_MEASURE_DLG: 331cdf0e10cSrcweir { 332cdf0e10cSrcweir SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 333cdf0e10cSrcweir Cancel(); 334cdf0e10cSrcweir rReq.Ignore (); 335cdf0e10cSrcweir } 336cdf0e10cSrcweir break; 337cdf0e10cSrcweir 338cdf0e10cSrcweir case SID_CONNECTION_DLG: 339cdf0e10cSrcweir { 340cdf0e10cSrcweir SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 341cdf0e10cSrcweir Cancel(); 342cdf0e10cSrcweir rReq.Done(); 343cdf0e10cSrcweir } 344cdf0e10cSrcweir break; 345cdf0e10cSrcweir 346cdf0e10cSrcweir case SID_CONNECTION_NEW_ROUTING: 347cdf0e10cSrcweir { 348cdf0e10cSrcweir SfxItemSet aDefAttr( GetPool(), SDRATTR_EDGELINE1DELTA, SDRATTR_EDGELINE3DELTA ); 349cdf0e10cSrcweir GetView()->SetAttributes( aDefAttr, sal_True ); // (ReplaceAll) 350cdf0e10cSrcweir 351cdf0e10cSrcweir Cancel(); 352cdf0e10cSrcweir rReq.Done(); 353cdf0e10cSrcweir } 354cdf0e10cSrcweir break; 355cdf0e10cSrcweir 356cdf0e10cSrcweir case SID_TWAIN_SELECT: 357cdf0e10cSrcweir { 358cdf0e10cSrcweir sal_Bool bDone = sal_False; 359cdf0e10cSrcweir 360cdf0e10cSrcweir if( mxScannerManager.is() ) 361cdf0e10cSrcweir { 362cdf0e10cSrcweir try 363cdf0e10cSrcweir { 364cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext > 365cdf0e10cSrcweir aContexts( mxScannerManager->getAvailableScanners() ); 366cdf0e10cSrcweir 367cdf0e10cSrcweir if( aContexts.getLength() ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir ::com::sun::star::scanner::ScannerContext aContext( aContexts.getConstArray()[ 0 ] ); 370cdf0e10cSrcweir bDone = mxScannerManager->configureScanner( aContext ); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir } 373cdf0e10cSrcweir catch(...) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir } 376cdf0e10cSrcweir } 377cdf0e10cSrcweir 378cdf0e10cSrcweir Cancel(); 379cdf0e10cSrcweir rReq.Done(); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir break; 382cdf0e10cSrcweir 383cdf0e10cSrcweir case SID_TWAIN_TRANSFER: 384cdf0e10cSrcweir { 385cdf0e10cSrcweir sal_Bool bDone = sal_False; 386cdf0e10cSrcweir 387cdf0e10cSrcweir if( mxScannerManager.is() ) 388cdf0e10cSrcweir { 389cdf0e10cSrcweir try 390cdf0e10cSrcweir { 391cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext > aContexts( mxScannerManager->getAvailableScanners() ); 392cdf0e10cSrcweir 393cdf0e10cSrcweir if( aContexts.getLength() ) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir mxScannerManager->startScan( aContexts.getConstArray()[ 0 ], mxScannerListener ); 396cdf0e10cSrcweir bDone = sal_True; 397cdf0e10cSrcweir } 398cdf0e10cSrcweir } 399cdf0e10cSrcweir catch( ... ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir } 402cdf0e10cSrcweir } 403cdf0e10cSrcweir 404cdf0e10cSrcweir if( !bDone ) 405cdf0e10cSrcweir { 406cdf0e10cSrcweir #ifndef UNX 407cdf0e10cSrcweir const sal_uInt16 nId = STR_TWAIN_NO_SOURCE; 408cdf0e10cSrcweir #else 409cdf0e10cSrcweir const sal_uInt16 nId = STR_TWAIN_NO_SOURCE_UNX; 410cdf0e10cSrcweir #endif 411cdf0e10cSrcweir 412cdf0e10cSrcweir ::sd::Window* pWindow = GetActiveWindow(); 413cdf0e10cSrcweir InfoBox(pWindow, String( SdResId( nId ) ) ).Execute(); 414cdf0e10cSrcweir } 415cdf0e10cSrcweir else 416cdf0e10cSrcweir { 417cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 418cdf0e10cSrcweir rBindings.Invalidate( SID_TWAIN_SELECT ); 419cdf0e10cSrcweir rBindings.Invalidate( SID_TWAIN_TRANSFER ); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir Cancel(); 423cdf0e10cSrcweir rReq.Done(); 424cdf0e10cSrcweir } 425cdf0e10cSrcweir break; 426cdf0e10cSrcweir 427cdf0e10cSrcweir case SID_POLYGON_MORPHING: 428cdf0e10cSrcweir { 429cdf0e10cSrcweir SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 430cdf0e10cSrcweir Cancel(); 431cdf0e10cSrcweir } 432cdf0e10cSrcweir break; 433cdf0e10cSrcweir 434cdf0e10cSrcweir case SID_VECTORIZE: 435cdf0e10cSrcweir { 436cdf0e10cSrcweir SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); 437cdf0e10cSrcweir Cancel(); 438cdf0e10cSrcweir } 439cdf0e10cSrcweir break; 440cdf0e10cSrcweir 441cdf0e10cSrcweir default: 442cdf0e10cSrcweir { 443cdf0e10cSrcweir // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die 444cdf0e10cSrcweir // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8), 445cdf0e10cSrcweir // FuTemp02 (drviewsb) gewandert. 446cdf0e10cSrcweir FuTemp02(rReq); 447cdf0e10cSrcweir } 448cdf0e10cSrcweir break; 449cdf0e10cSrcweir } 450cdf0e10cSrcweir } 451cdf0e10cSrcweir 452cdf0e10cSrcweir /************************************************************************* 453cdf0e10cSrcweir |* 454cdf0e10cSrcweir |* Scanner-Event 455cdf0e10cSrcweir |* 456cdf0e10cSrcweir \************************************************************************/ 457cdf0e10cSrcweir 458cdf0e10cSrcweir void DrawViewShell::ScannerEvent( const ::com::sun::star::lang::EventObject& ) 459cdf0e10cSrcweir { 460cdf0e10cSrcweir if( mxScannerManager.is() ) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir const ::com::sun::star::scanner::ScannerContext aContext( mxScannerManager->getAvailableScanners().getConstArray()[ 0 ] ); 463cdf0e10cSrcweir const ::com::sun::star::scanner::ScanError eError = mxScannerManager->getError( aContext ); 464cdf0e10cSrcweir 465cdf0e10cSrcweir if( ::com::sun::star::scanner::ScanError_ScanErrorNone == eError ) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( mxScannerManager->getBitmap( aContext ) ); 468cdf0e10cSrcweir 469cdf0e10cSrcweir if( xBitmap.is() ) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) ); 472cdf0e10cSrcweir 473cdf0e10cSrcweir if( !!aScanBmp ) 474cdf0e10cSrcweir { 475cdf0e10cSrcweir const ::vos::OGuard aGuard( Application::GetSolarMutex() ); 476cdf0e10cSrcweir SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage(); 477cdf0e10cSrcweir Size aBmpSize( aScanBmp.GetPrefSize() ), aPageSize( pPage->GetSize() ); 478cdf0e10cSrcweir const MapMode aMap100( MAP_100TH_MM ); 479cdf0e10cSrcweir 480cdf0e10cSrcweir if( !aBmpSize.Width() || !aBmpSize.Height() ) 481cdf0e10cSrcweir aBmpSize = aScanBmp.GetSizePixel(); 482cdf0e10cSrcweir 483cdf0e10cSrcweir if( aScanBmp.GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) 484cdf0e10cSrcweir aBmpSize = GetActiveWindow()->PixelToLogic( aBmpSize, aMap100 ); 485cdf0e10cSrcweir else 486cdf0e10cSrcweir aBmpSize = OutputDevice::LogicToLogic( aBmpSize, aScanBmp.GetPrefMapMode(), aMap100 ); 487cdf0e10cSrcweir 488cdf0e10cSrcweir aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder(); 489cdf0e10cSrcweir aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder(); 490cdf0e10cSrcweir 491cdf0e10cSrcweir if( ( ( aBmpSize.Height() > aPageSize.Height() ) || ( aBmpSize.Width() > aPageSize.Width() ) ) && aBmpSize.Height() && aPageSize.Height() ) 492cdf0e10cSrcweir { 493cdf0e10cSrcweir double fGrfWH = (double) aBmpSize.Width() / aBmpSize.Height(); 494cdf0e10cSrcweir double fWinWH = (double) aPageSize.Width() / aPageSize.Height(); 495cdf0e10cSrcweir 496cdf0e10cSrcweir if( fGrfWH < fWinWH ) 497cdf0e10cSrcweir { 498cdf0e10cSrcweir aBmpSize.Width() = FRound( aPageSize.Height() * fGrfWH ); 499cdf0e10cSrcweir aBmpSize.Height()= aPageSize.Height(); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir else if( fGrfWH > 0.F ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir aBmpSize.Width() = aPageSize.Width(); 504cdf0e10cSrcweir aBmpSize.Height()= FRound( aPageSize.Width() / fGrfWH ); 505cdf0e10cSrcweir } 506cdf0e10cSrcweir } 507cdf0e10cSrcweir 508cdf0e10cSrcweir Point aPnt ( ( aPageSize.Width() - aBmpSize.Width() ) >> 1, ( aPageSize.Height() - aBmpSize.Height() ) >> 1 ); 509cdf0e10cSrcweir aPnt += Point( pPage->GetLftBorder(), pPage->GetUppBorder() ); 510cdf0e10cSrcweir Rectangle aRect( aPnt, aBmpSize ); 511cdf0e10cSrcweir SdrGrafObj* pGrafObj = NULL; 512cdf0e10cSrcweir sal_Bool bInsertNewObject = sal_True; 513cdf0e10cSrcweir 514cdf0e10cSrcweir if( GetView()->AreObjectsMarked() ) 515cdf0e10cSrcweir { 516cdf0e10cSrcweir const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 517cdf0e10cSrcweir 518cdf0e10cSrcweir if( rMarkList.GetMarkCount() == 1 ) 519cdf0e10cSrcweir { 520cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 521cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 522cdf0e10cSrcweir 523cdf0e10cSrcweir if( pObj->ISA( SdrGrafObj ) ) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir pGrafObj = static_cast< SdrGrafObj* >( pObj ); 526cdf0e10cSrcweir 527cdf0e10cSrcweir if( pGrafObj->IsEmptyPresObj() ) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir bInsertNewObject = sal_False; 530cdf0e10cSrcweir pGrafObj->SetEmptyPresObj(sal_False); 531cdf0e10cSrcweir pGrafObj->SetOutlinerParaObject(NULL); 532cdf0e10cSrcweir pGrafObj->SetGraphic( Graphic( aScanBmp ) ); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir } 535cdf0e10cSrcweir } 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir if( bInsertNewObject ) 539cdf0e10cSrcweir { 540cdf0e10cSrcweir pGrafObj = new SdrGrafObj( Graphic( aScanBmp ), aRect ); 541cdf0e10cSrcweir SdrPageView* pPV = GetView()->GetSdrPageView(); 542cdf0e10cSrcweir GetView()->InsertObjectAtView( pGrafObj, *pPV, SDRINSERT_SETDEFLAYER ); 543cdf0e10cSrcweir } 544cdf0e10cSrcweir } 545cdf0e10cSrcweir } 546cdf0e10cSrcweir } 547cdf0e10cSrcweir } 548cdf0e10cSrcweir 549cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 550cdf0e10cSrcweir rBindings.Invalidate( SID_TWAIN_SELECT ); 551cdf0e10cSrcweir rBindings.Invalidate( SID_TWAIN_TRANSFER ); 552cdf0e10cSrcweir } 553cdf0e10cSrcweir 554cdf0e10cSrcweir } // end of namespace sd 555